run-scene-v2 0.0.95 → 0.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):"function"==typeof define&&define.amd?define(["axios","js-funcs","three","@allex/md5"],t):"object"==typeof exports?exports.RunScene=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):e.RunScene=t(e.axios,e["js-funcs"],e.three,e["@allex/md5"])}(self,((__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__6001__,__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__1129__)=>(()=>{"use strict";var __webpack_modules__={2958:(e,t,r)=>{function n(){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===m(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof 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 f(e){return void 0===e}function g(){return"undefined"!=typeof window}function v(e){return Ge(e)||Ve(e)}function b(e){return(nt=D(e,rt))&&Sr}function y(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(rt[e]=t)&&nt&&(nt[e]=t)||rt}function w(){return 0}function S(e,t,r){return(r=e[t])&&Ge(r)?e[t]():f(r)&&e.getAttribute&&e.getAttribute(t)||r}function M(e,t){(e=e.split(",")).forEach(t)}function T(e,t,r,n){st.length&>(),e.render(t,r,n),st.length&>()}function _(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:Ve(e)?e.trim():e}function E(e){return e}function D(e,t){for(var r in t)e[r]=t[r];return e}function O(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=Ze(t[r])?O(e[r]||(e[r]={}),t[r]):t[r]);return e}function P(e){var t,r=e.parent||le,n=e.keyframes?(t=qe(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):vt;if(We(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function k(e){return!e||e._ts&&k(e.parent)}function A(e){return e._repeat?C(e._tTime,e=e.duration()+e._rDelay)*e:0}function C(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function L(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function R(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=L(e.rawTime(),t),(!t._dur||H(0,t.totalDuration(),r)-t._tTime>Ie)&&t.render(r,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-Ie}}function I(e,t,r,n){return t.parent&&xt(t),t._start=ft((He(r)?r:r||e!==le?V(e,r,t):e._time)+t._delay),t._end=ft(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=4<arguments.length?arguments[4]:void 0,s=e[a];if(i)for(r=t[i];s&&s[i]>r;)s=s._prev;s?(t._next=s._next,s._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[a]=t,t._prev=s,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),N(t)||(e._recent=t),n||R(e,t),e}function B(e,t){(rt.ScrollTrigger||at("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function U(e,t,r,n){return Kt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==jt.frame?(st.push(e),e._lazy=[t,n]):void 0:1}function j(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||j(e))}function N(e){return"isFromStart"===(e=e.data)||"isStart"===e}function z(e,t,r,n){var a=e._repeat,i=ft(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=i/e._dur),e._dur=i,e._tDur=a?a<0?1e10:ft(i*(a+1)+e._rDelay*a):i,0<t&&!n?Mt(e,e._tTime=e._tDur*t):e.parent&&St(e),r||wt(e.parent,e),e}function F(e){return e instanceof ir?wt(e):z(e,e._dur)}function V(e,t,r){var n,a,i,s=e.labels,o=e._recent||Tt,l=e.duration()>=Re?o.endTime(!1):e._dur;return Ve(t)&&(isNaN(t)||t in s)?(a=t.charAt(0),i="%"===t.substr(-1),n=t.indexOf("="),"<"===a||">"===a?(0<=n&&(t=t.replace(/=/,"")),("<"===a?o._start:o.endTime(0<=o._repeat))+(parseFloat(t.substr(1))||0)*(i?(n<0?o:r).totalDuration()/100:1)):n<0?(t in s||(s[t]=l),s[t]):(a=parseFloat(t.charAt(n-1)+t.substr(n+1)),i&&r&&(a=a/100*(qe(r)?r[0]:r).totalDuration()),1<n?V(e,t.substr(0,n-1),r)+a:l+a)):null==t?l:+t}function G(e,t,r){var n,a,i=He(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s];if(i&&(o.duration=t[1]),o.parent=r,e){for(n=o,a=r;a&&!("immediateRender"in n);)n=a.vars.defaults||{},a=We(a.vars.inherit)&&a.parent;o.immediateRender=We(n.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new dr(t[0],o,t[1+s])}function H(e,t,r){return r<e?e:t<r?t:r}function Z(e){if(Ge(e))return e;var t=Ze(e)?e:{each:e},r=Ht(t.ease),n=t.from||0,a=parseFloat(t.base)||0,i={},s=(e=0<n&&n<1,isNaN(n)||e),o=t.axis,l=n,c=n;return Ve(n)?l=c={center:.5,edges:.5,end:1}[n]||0:!e&&s&&(l=n[0],c=n[1]),function(e,u,d){var h,p,m,f,g,v,b,y,x=(d||t).length,w=i[x];if(!w){if(!(y="auto"===t.grid?0:(t.grid||[1,Re])[1])){for(v=-Re;v<(v=d[y++].getBoundingClientRect().left)&&y<x;);y--}for(w=i[x]=[],h=s?Math.min(y,x)*l-.5:n%y,p=y===Re?0:s?x*c/y-.5:n/y|0,b=Re,g=v=0;g<x;g++)f=g%y-h,m=p-(g/y|0),w[g]=f=o?Math.abs("y"===o?m:f):Ne(f*f+m*m),v<f&&(v=f),f<b&&(b=f);"random"===n&&kt(w),w.max=v-b,w.min=b,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<y?x-1:o?"y"===o?x/y:y:Math.max(y,x/y))||0)*("edges"===n?-1:1),w.b=x<0?a-x:a,w.u=Et(t.amount||t.each)||0,r=r&&x<0?Gt(r):r}return x=(w[e]-w.min)/w.max||0,ft(w.b+(r?r(x):x)*w.v)+w.u}}function W(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+(He(r)?0:Et(r))}}function K(e,t){var r,n,a=qe(e);return!a&&Ze(e)&&(r=a=e.radius||Re,e.values?(e=Pt(e.values),(n=!He(e[0]))&&(r*=r)):e=W(e.increment)),_t(t,a?Ge(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var a,i,s=parseFloat(n?t.x:t),o=parseFloat(n?t.y:0),l=Re,c=0,u=e.length;u--;)(a=n?(a=e[u].x-s)*a+(i=e[u].y-o)*i:Math.abs(e[u]-s))<l&&(l=a,c=u);return c=!r||l<=r?e[c]:t,n||c===t||He(t)?c:c+Et(t)}:W(e))}function q(e,t,r,n){return _t(qe(e)?!t:!0===r?!!(r=0):!n,(function(){return qe(e)?e[~~(Math.random()*e.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((e-r/2+Math.random()*(t-e+.99*r))/r)*r*n)/n}))}function X(e,t,r){return _t(r,(function(r){return e[~~t(r)]}))}function Y(e,t,r,n,a){var i=t-e,s=n-r;return _t(a,(function(t){return r+((t-e)/i*s||0)}))}function Q(e,t,r){var n,a,i,s=e.labels,o=Re;for(n in s)(a=s[n]-t)<0==!!r&&a&&o>(a=Math.abs(a))&&(i=n,o=a);return i}function J(e,t,r){var n=e.vars,a=n[t];a&&(t=n[t+"Params"],n=n.callbackScope||e,r&&st.length&>(),t?a.apply(n,t):a.call(n))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&J(e,"onInterrupt"),e}function ee(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*Ct+.5|0}function te(e,t,r){var n,a,i,s,o="",l=(e+o).match(Bt),c=t?"hsla(":"rgba(",u=0;if(!l)return e;if(l=l.map((function(e){return(e=Rt(e,t,1))&&c+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(i=It(e),(n=r.c).join(o)!==i.c.join(o)))for(s=(a=e.replace(Bt,"1").split(Qe)).length-1;u<s;u++)o+=a[u]+(~n.indexOf(u)?l.shift()||c+"0,0,0,0)":(i.length?i:l.length?l:r).shift());if(!a)for(s=(a=e.split(Bt)).length-1;u<s;u++)o+=a[u]+l[u];return o+a[s]}function re(e,t){for(var r,n=e._first;n;)n instanceof ir?re(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?re(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function ne(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},a={easeIn:t,easeOut:n,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};M(e,(function(e){for(var t in zt[e]=rt[e]=a,zt[r=e.toLowerCase()]=n,a)zt[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=zt[e+"."+t]=a[t]}))}function ae(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function ie(e,t,r){function n(e){return 1===e?1:a*Math.pow(2,-10*e)*Fe((e-i)*s)+1}var a=1<=t?t:1,i=(s=(r||(e?.3:.45))/(t<1?t:1))/Be*(Math.asin(1/a)||0),s=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ae(n),Be/s);return r.config=function(t,r){return ie(e,t,r)},r}function se(e){function t(e){return e?--e*e*((r+1)*e+r)+1:0}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,n="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ae(t);return n.config=function(t){return se(e,t)},n}r.d(t,{Q3:()=>dr});var oe,le,ce,ue,de,he,pe,me,fe,ge,ve,be,ye,xe,we,Se,Me,Te,_e,Ee,De,Oe,Pe,ke,Ae,Ce={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Le={duration:.5,overwrite:!1,delay:0},Re=1e8,Ie=1/Re,Be=2*Math.PI,Ue=Be/4,je=0,Ne=Math.sqrt,ze=Math.cos,Fe=Math.sin,Ve=function(e){return"string"==typeof e},Ge=function(e){return"function"==typeof e},He=function(e){return"number"==typeof e},Ze=function(e){return"object"==m(e)},We=function(e){return!1!==e},Ke="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},qe=Array.isArray,Xe=/(?:-?\.?\d|\.)+/gi,Ye=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Qe=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Je=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,$e=/[+-]=-?[.\d]+/,et=/[^,'"\[\]\s]+/gi,tt=/[\d.+\-=]+(?:e[-+]\d*)*/i,rt={},nt={},at=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},it={},st=[],ot={},lt={},ct={},ut=30,dt=[],ht="",pt=function(e){var t,r,n=e[0];if(Ze(n)||Ge(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=dt.length;r--&&!dt[r].targetTest(n););t=dt[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new nr(e[r],t)))||e.splice(r,1);return e},mt=function(e){return e._gsap||pt(Pt(e))[0]._gsap},ft=function(e){return Math.round(1e7*e)/1e7||0},gt=function(){var e,t,r=st.length,n=st.slice(0);for(ot={},e=st.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},vt=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},bt=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},yt=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",a=t._prev,i=t._next;a?a._next=i:e[r]===t&&(e[r]=i),i?i._prev=a:e[n]===t&&(e[n]=a),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},St=function(e){return e._end=ft(e._start+(e._tDur/Math.abs(e._ts||e._rts||Ie)||0))},Mt=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=ft(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),St(e),r._dirty||wt(r,e)),e},Tt={_start:0,endTime:w,totalDuration:w},_t=function(e,t){return e||0===e?t(e):t},Et=function(e,t){return Ve(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},Dt=[].slice,Ot=function(e,t){return e&&Ze(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Ze(e[0]))&&!e.nodeType&&e!==ce},Pt=function(e,t,r){return!Ve(e)||r||!ue&&Nt()?qe(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Ve(e)&&!t||Ot(e,1)?r.push.apply(r,h(Pt(e))):r.push(e)}))||r}(e,r):Ot(e)?Dt.call(e,0):e?[e]:[]:Dt.call((t||de).querySelectorAll(e),0)},kt=function(e){return e.sort((function(){return.5-Math.random()}))},At=function(e){for(var t,r,n,a,i=0,s="";~(t=e.indexOf("random(",i));)n=e.indexOf(")",t),a="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(a?et:Xe),s+=e.substr(i,t-i)+q(a?r:+r[0],a?0:+r[1],+r[2]||1e-5),i=n+1;return s+e.substr(i,e.length-i)},Ct=255,Lt={aqua:[0,Ct,Ct],lime:[0,Ct,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ct],navy:[0,0,128],white:[Ct,Ct,Ct],olive:[128,128,0],yellow:[Ct,Ct,0],orange:[Ct,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ct,0,0],pink:[Ct,192,203],cyan:[0,Ct,Ct],transparent:[Ct,Ct,Ct,0]},Rt=function(e,t,r){var n,a,i,s,o,l,c,u=e?He(e)?[e>>16,e>>8&Ct,e&Ct]:0:Lt.black;if(!u){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Lt[e])u=Lt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(a=e.charAt(2))+a+(i=e.charAt(3))+i+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(u=parseInt(e.substr(1,6),16))>>16,u>>8&Ct,u&Ct,parseInt(e.substr(7),16)/255];u=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ct,e&Ct]}else if("hsl"===e.substr(0,3))if(u=c=e.match(Xe),t){if(~e.indexOf("="))return u=e.match(Ye),r&&u.length<4&&(u[3]=1),u}else s=+u[0]%360/360,o=+u[1]/100,n=2*(l=+u[2]/100)-(a=l<=.5?l*(o+1):l+o-l*o),3<u.length&&(u[3]*=1),u[0]=ee(s+1/3,n,a),u[1]=ee(s,n,a),u[2]=ee(s-1/3,n,a);else u=e.match(Xe)||Lt.transparent;u=u.map(Number)}return t&&!c&&(n=u[0]/Ct,a=u[1]/Ct,i=u[2]/Ct,l=((e=Math.max(n,a,i))+(t=Math.min(n,a,i)))/2,e===t?s=o=0:(c=e-t,o=.5<l?c/(2-e-t):c/(e+t),s=e===n?(a-i)/c+(a<i?6:0):e===a?(i-n)/c+2:(n-a)/c+4,s*=60),u[0]=~~(s+.5),u[1]=~~(100*o+.5),u[2]=~~(100*l+.5)),r&&u.length<4&&(u[3]=1),u},It=function(e){var t=[],r=[],n=-1;return e.split(Bt).forEach((function(e){e=e.match(Qe)||[],t.push.apply(t,h(e)),r.push(n+=e.length+1)})),t.c=r,t},Bt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Lt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ut=/hsl[a]?\(/,jt=(we=Date.now,Se=500,Me=33,Te=we(),_e=Te,De=Ee=1e3/240,Pe={time:0,frame:0,tick:function(){Zt(!0)},deltaRatio:function(e){return ye/(1e3/(e||60))},wake:function(){he&&(!ue&&g()&&(ce=ue=window,de=ce.document||{},rt.gsap=Sr,(ce.gsapVersions||(ce.gsapVersions=[])).push(Sr.version),b(nt||ce.GreenSockGlobals||!ce.gsap&&ce||{}),be=ce.requestAnimationFrame),ge&&Pe.sleep(),ve=be||function(e){return setTimeout(e,De-1e3*Pe.time+1|0)},fe=1,Zt(2))},sleep:function(){(be?ce.cancelAnimationFrame:clearTimeout)(ge),fe=0,ve=w},lagSmoothing:function(e,t){Se=e||1/Ie,Me=Math.min(t,Se,0)},fps:function(e){Ee=1e3/(e||240),De=1e3*Pe.time+Ee},add:function(e){Oe.indexOf(e)<0&&Oe.push(e),Nt()},remove:function(e,t){~(t=Oe.indexOf(e))&&Oe.splice(t,1)&&t<=xe&&xe--},_listeners:Oe=[]}),Nt=function(){return!fe&&jt.wake()},zt={},Ft=/^[\d.\-M][\d.\-,\s]/,Vt=/["']/g,Gt=function(e){return function(t){return 1-e(1-t)}},Ht=function(e,t){return e&&(Ge(e)?e:zt[e]||function(e){var t,r,n,a=(e+"").split("("),i=zt[a[0]];return i&&1<a.length&&i.config?i.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,a={},i=e.substr(1,e.length-3).split(":"),s=i[0],o=1,l=i.length;o<l;o++)r=i[o],t=o!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),a[s]=isNaN(n)?n.replace(Vt,"").trim():+n,s=r.substr(t+1).trim();return a}(a[1])]:(t=(a=e).indexOf("(")+1,r=a.indexOf(")"),n=a.indexOf("(",t),a.substring(t,~n&&n<r?a.indexOf(")",r+1):r).split(",").map(_))):zt._CE&&Ft.test(e)?zt._CE("",e):i}(e))||t};function Zt(e){var t,r,n,a=we()-_e,i=!0===e;if(Se<a&&(Te+=a-Me),(0<(a=(r=(_e+=a)-Te)-De)||i)&&(n=++Pe.frame,ye=r-1e3*Pe.time,Pe.time=r/=1e3,De+=a+(Ee<=a?4:Ee-a),t=1),i||(ge=ve(Zt)),t)for(xe=0;xe<Oe.length;xe++)Oe[xe](r,ye,n,e)}function Wt(e){return e<Ae?ke*e*e:e<.7272727272727273?ke*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?ke*(e-=2.25/2.75)*e+.9375:ke*Math.pow(e-2.625/2.75,2)+.984375}function Kt(e,t){var r,n,a,i,s,o,l,c,u,d,h,p,m,f=e.vars,g=f.ease,v=f.startAt,b=f.immediateRender,y=f.lazy,x=f.onUpdate,w=f.onUpdateParams,S=f.callbackScope,M=f.runBackwards,T=f.yoyoEase,_=f.keyframes,E=f.autoRevert,D=e._dur,O=e._startAt,P=e._targets,k=e.parent,A=k&&"nested"===k.data?k.parent._targets:P,C="auto"===e._overwrite&&!oe,L=e.timeline;if(e._ease=Ht(g=!L||_&&g?g:"none",Le.ease),e._yEase=T?Gt(Ht(!0===T?g:T,Le.ease)):0,T&&e._yoyo&&!e._repeat&&(T=e._yEase,e._yEase=e._ease,e._ease=T),e._from=!L&&!!f.runBackwards,!L||_&&!f.stagger){if(p=(c=P[0]?mt(P[0]).harness:0)&&f[c.prop],r=bt(f,it),O&&xt(O.render(-1,!0)),v)if(xt(e._startAt=dr.set(P,vt({data:"isStart",overwrite:!1,parent:k,immediateRender:!0,lazy:We(y),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:S,stagger:0},v))),t<0&&!b&&!E&&e._startAt.render(-1,!0),b){if(0<t&&!E&&(e._startAt=0),D&&t<=0)return void(t&&(e._zTime=t))}else!1===E&&(e._startAt=0);else if(M&&D)if(O)E||(e._startAt=0);else if(a=vt({overwrite:!1,data:"isFromStart",lazy:(b=!t&&b)&&We(y),immediateRender:b,stagger:0,parent:k},r),p&&(a[c.prop]=p),xt(e._startAt=dr.set(P,a)),t<0&&e._startAt.render(-1,!0),e._zTime=t,b){if(!t)return}else Kt(e._startAt,Ie);for(e._pt=0,y=D&&We(y)||y&&!D,n=0;n<P.length;n++){if(l=(s=P[n])._gsap||pt(P)[n]._gsap,e._ptLookup[n]=d={},ot[l.id]&&st.length&>(),h=A===P?n:A.indexOf(s),c&&!1!==(u=new c).init(s,p||r,e,h,A)&&(e._pt=i=new yr(e._pt,s,u.name,0,1,u.render,u,0,u.priority),u._props.forEach((function(e){d[e]=i})),u.priority&&(o=1)),!c||p)for(a in r)lt[a]&&(u=lr(a,r,e,h,s,A))?u.priority&&(o=1):d[a]=i=or.call(e,s,a,"get",r[a],h,A,0,f.stringFilter);e._op&&e._op[n]&&e.kill(s,e._op[n]),C&&e._pt&&(rr=e,le.killTweensOf(s,d,e.globalTime(t)),m=!e.parent,rr=0),e._pt&&y&&(ot[l.id]=1)}o&&br(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!m,_&&t<=0&&L.render(Re,!0,!0)}function qt(e,t,r,n,a){return Ge(e)?e.call(t,r,n,a):Ve(e)&&~e.indexOf("random(")?At(e):e}function Xt(e,t,r){return e.setAttribute(t,r)}function Yt(e,t){var r=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*e):Math.round(1e4*(r.s+r.c*e))/1e4)+n,r=r._next;n+=t.c}t.set(t.t,t.p,n,t)}function Qt(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function Jt(e,t,r,n){for(var a,i=this._pt;i;)a=i._next,i.p===n&&i.modifier(e,t,r),i=a}function $t(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?yt(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function er(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function tr(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,a;if(Ve(r)&&(n={},M(r,(function(e){return n[e]=1})),r=n),t){for(a in n={},r)n[a]=t(r[a]);r=n}var i,s,o,l=e,c=r,u=l._targets;for(i in c)for(s=u.length;s--;)(o=(o=l._ptLookup[s][i])&&o.d)&&(o=o._pt?wr(o,i):o)&&o.modifier&&o.modifier(c[i],l,u[s],i)}}}}M("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;ne(e+",Power"+(r-1),t?function(e){return Math.pow(e,r)}:function(e){return e},(function(e){return 1-Math.pow(1-e,r)}),(function(e){return e<.5?Math.pow(2*e,r)/2:1-Math.pow(2*(1-e),r)/2}))})),zt.Linear.easeNone=zt.none=zt.Linear.easeIn,ne("Elastic",ie("in"),ie("out"),ie()),ke=7.5625,Ae=1/2.75,ne("Bounce",(function(e){return 1-Wt(1-e)}),Wt),ne("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),ne("Circ",(function(e){return-(Ne(1-e*e)-1)})),ne("Sine",(function(e){return 1===e?1:1-ze(e*Ue)})),ne("Back",se("in"),se("out"),se()),zt.SteppedEase=zt.steps=rt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),a=t?1:0,i=1-Ie;return function(e){return((n*H(0,i,e)|0)+a)*r}}},Le.ease=zt["quad.out"],M("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return ht+=e+","+e+"Params,"}));var rr,nr=u((function e(t,r){d(this,e),this.id=je++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:S,this.set=r?r.getSetter:fr})),ar=function(){function e(t){d(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,z(this,+t.duration,1,1),this.data=t.data,fe||jt.wake()}return u(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,z(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Nt(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(Mt(this,e),r._dp&&!r.parent&&R(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&I(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Ie||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),T(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+A(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)+A(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?C(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-Ie?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?L(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Ie?0:this._rts,e=this.totalTime(H(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return St(this),this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Nt(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Ie&&(this._tTime-=Ie)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||I(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(We(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?L(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,F(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,F(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(V(this,e),We(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,We(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-Ie:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Ie,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-Ie))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,Ge(a)&&(a=a(t))&&(a.then||a===t)&&(t.then=e),r(a),t.then=e}var a=Ge(e)?e:E;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){$(this)}}]),e}(),ir=(vt(ar.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Ie,_prom:0,_ps:!1,_rts:1}),function(){a(t,ar);var e=s(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=1<arguments.length?arguments[1]:void 0;return d(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=We(n.sortChildren),le&&I(n.parent||le,o(r),a),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&B(o(r),n.scrollTrigger),r}return u(t,[{key:"to",value:function(e,t,r){return G(0,arguments,this),this}},{key:"from",value:function(e,t,r){return G(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return G(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,P(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new dr(e,t,V(this,r),1),this}},{key:"call",value:function(e,t,r){return I(this,dr.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,a,i,s){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=i,r.onCompleteParams=s,r.parent=this,new dr(e,r,V(this,a)),this}},{key:"staggerFrom",value:function(e,t,r,n,a,i,s){return r.runBackwards=1,P(r).immediateRender=We(r.immediateRender),this.staggerTo(e,t,r,n,a,i,s)}},{key:"staggerFromTo",value:function(e,t,r,n,a,i,s,o){return n.startAt=r,P(n).immediateRender=We(n.immediateRender),this.staggerTo(e,t,n,a,i,s,o)}},{key:"render",value:function(e,t,r){var n,a,i,s,o,l,c,u,d,h,p=this._time,m=this._dirty?this.totalDuration():this._tDur,f=this._dur,g=e<=0?0:ft(e),v=this._zTime<0!=e<0&&(this._initted||!f);if((g=this!==le&&m<g&&0<=e?m:g)!==this._tTime||r||v){if(p!==this._time&&f&&(g+=this._time-p,e+=this._time-p),n=g,u=this._start,o=!(c=this._ts),v&&(f||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(v=this._yoyo,s=f+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*s+e,t,r);if(n=ft(g%s),g===m?(i=this._repeat,n=f):((i=~~(g/s))&&i===g/s&&(n=f,i--),f<n&&(n=f)),d=C(this._tTime,s),v&&1&i&&(n=f-n,h=1),i!==(d=!p&&this._tTime&&d!==i?i:d)&&!this._lock){var b=v&&1&d;if(v=b===(v&&1&i),p=(b=i<d?!b:b)?0:f,this._lock=1,this.render(p||(h?0:ft(i*s)),t,!f)._lock=0,this._tTime=g,!t&&this.parent&&J(this,"onRepeat"),this.vars.repeatRefresh&&!h&&(this.invalidate()._lock=1),p&&p!==this._time||o!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(f=this._dur,m=this._tDur,v&&(this._lock=2,this.render(p=b?f:-1e-4,!0),this.vars.repeatRefresh&&!h&&this.invalidate()),this._lock=0,!this._ts&&!o)return this;re(this,h)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,ft(p),ft(n)))&&(g-=n-(n=l._start)),this._tTime=g,this._time=n,this._act=!c,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&n&&!t&&(J(this,"onStart"),this._tTime!==g))return this;if(p<=n&&0<=e)for(y=this._first;y;){if(a=y._next,(y._act||n>=y._start)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(n-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(n-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=-Ie);break}}y=a}else for(var y=this._last,x=e<0?e:n;y;){if(a=y._prev,(y._act||x<=y._end)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(x-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(x-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=x?-Ie:Ie);break}}y=a}if(l&&!t&&(this.pause(),l.render(p<=n?0:-Ie)._zTime=p<=n?1:-1,this._ts))return this._start=u,St(this),this.render(e,t,r);this._onUpdate&&!t&&J(this,"onUpdate",!0),!(g===m&&m>=this.totalDuration()||!g&&p)||u!==this._start&&Math.abs(c)===Math.abs(this._ts)||this._lock||(!e&&f||!(g===m&&0<this._ts||!g&&this._ts<0)||xt(this,1),t||e<0&&!p||!g&&!p&&m||(J(this,g===m&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||g<m&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(He(t)||(t=V(this,t,e)),!(e instanceof ar)){if(qe(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Ve(e))return this.addLabel(e,t);if(!Ge(e))return this;e=dr.delayedCall(0,e)}return this!==e?I(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Re,a=[],i=this._first;i;)i._start>=n&&(i instanceof dr?t&&a.push(i):(r&&a.push(i),e&&a.push.apply(a,h(i.getChildren(!0,t,r))))),i=i._next;return a}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return Ve(e)?this.removeLabel(e):Ge(e)?this.killTweensOf(e):(yt(this,e),e===this._recent&&(this._recent=this._last),wt(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ft(jt.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),n(l(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=V(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=dr.delayedCall(0,t||w,r)).data="isPause",this._hasPause=1,I(this,t,V(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=V(this,e);t;)t._start===e&&"isPause"===t.data&&xt(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),a=n.length;a--;)rr!==n[a]&&n[a].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],a=Pt(e),i=this._first,s=He(t);i;)i instanceof dr?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(i._targets,a)&&(s?(!rr||i._initted&&i._ts)&&i.globalTime(0)<=t&&i.globalTime(i.totalDuration())>t:!t||i.isActive())&&n.push(i):(r=i.getTweensOf(a,t)).length&&n.push.apply(n,h(r)),i=i._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,a=V(n,e),i=(e=t).startAt,s=e.onStart,o=e.onStartParams,l=(e=e.immediateRender,dr.to(n,vt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale())||Ie,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale()),l._dur!==e&&z(l,e,0,1).render(l._time,!0,!0),r=1),s&&s.apply(l,o||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,vt({startAt:{time:V(this,e)}},r))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Q(this,V(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Q(this,V(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Ie)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,a=this._first,i=this.labels;a;)a._start>=n&&(a._start+=e,a._end+=e),a=a._next;if(t)for(r in i)i[r]>=n&&(i[r]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return n(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,r,n,a=0,i=this,s=i._last,o=Re;if(arguments.length)return i.timeScale((i._repeat<0?i.duration():i.totalDuration())/(i.reversed()?-e:e));if(i._dirty){for(n=i.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(r=s._start)>o&&i._sort&&s._ts&&!i._lock?(i._lock=1,I(i,s,r-s._delay,1)._lock=0):o=r,r<0&&s._ts&&(a-=r,(!n&&!i._dp||n&&n.smoothChildTiming)&&(i._start+=r/i._ts,i._time-=r,i._tTime-=r),i.shiftChildren(-r,!1,-1/0),o=0),s._end>a&&s._ts&&(a=s._end),s=t;z(i,i===le&&i._time>a?i._time:a,1,1),i._dirty=0}return i._tDur}}],[{key:"updateRoot",value:function(e){if(le._ts&&(T(le,L(e,le)),pe=jt.frame),jt.frame>=ut){ut+=Ce.autoSleep||120;var t=le._first;if((!t||!t._ts)&&Ce.autoSleep&&jt._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||jt.sleep()}}}}]),t}()),sr=(vt(ir.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,a,i,s){var o,l,c,u,d,h=new yr(this._pt,e,t,0,1,Yt,null,a),p=0,m=0;for(h.b=r,h.e=n,r+="",(a=~(n+="").indexOf("random("))&&(n=At(n)),i&&(i(i=[r,n],e,t),r=i[0],n=i[1]),o=r.match(Je)||[];u=Je.exec(n);)c=u[0],u=n.substring(p,u.index),l?l=(l+1)%5:"rgba("===u.substr(-5)&&(l=1),c!==o[m++]&&(d=parseFloat(o[m-1])||0,h._pt={_next:h._pt,p:u||1===m?u:",",s:d,c:"="===c.charAt(1)?parseFloat(c.substr(2))*("-"===c.charAt(0)?-1:1):parseFloat(c)-d,m:l&&l<4?Math.round:0},p=Je.lastIndex);return h.c=p<n.length?n.substring(p,n.length):"",h.fp=s,($e.test(n)||a)&&(h.e=0),this._pt=h}),or=function(e,t,r,n,a,i,s,o,l){var c;if(Ge(n)&&(n=n(a||0,e,i)),a=e[t],i="get"!==r?r:Ge(a)?l?e[t.indexOf("set")||!Ge(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():a,r=Ge(a)?l?mr:pr:hr,Ve(n)&&"="===(n=~n.indexOf("random(")?At(n):n).charAt(1)&&(!(c=parseFloat(i)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Et(i)||0))&&0!==c||(n=c)),i!==n)return isNaN(i*n)||""===n?(a||t in e||at(t,n),sr.call(this,e,t,i,n,r,o||Ce.stringFilter,l)):(c=new yr(this._pt,e,t,+i||0,n-(i||0),"boolean"==typeof a?vr:gr,0,r),l&&(c.fp=l),s&&c.modifier(s,this,e),this._pt=c)},lr=function(e,t,r,n,a,i){var s,o,l,c;if(lt[e]&&!1!==(s=new lt[e]).init(a,s.rawVars?t[e]:function(e,t,r,n,a){if(Ge(e)&&(e=qt(e,a,t,r,n)),!Ze(e)||e.style&&e.nodeType||qe(e)||Ke(e))return Ve(e)?qt(e,a,t,r,n):e;var i,s={};for(i in e)s[i]=qt(e[i],a,t,r,n);return s}(t[e],n,a,i,r),r,n,i)&&(r._pt=o=new yr(r._pt,a,e,0,1,s.render,s,0,s.priority),r!==me))for(l=r._ptLookup[r._targets.indexOf(a)],c=s._props.length;c--;)l[s._props[c]]=o;return s},cr=ht+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",ur={},dr=(M(cr+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return ur[e]=1})),function(){a(t,ar);var e=s(t);function t(r,n,a,i){d(this,t),"number"==typeof n&&(a.duration=n,n=a,a=null);var s,l,c,u,h,p,m,f,g,b=(i=(s=e.call(this,i?n:P(n))).vars).duration,x=i.delay,w=i.immediateRender,S=i.stagger,M=i.overwrite,T=i.keyframes,_=i.defaults,E=i.scrollTrigger,O=i.yoyoEase,A=(i=n.parent||le,(qe(r)||Ke(r)?He(r[0]):"length"in n)?[r]:Pt(r));if(s._targets=A.length?pt(A):y("GSAP target "+r+" not found. https://greensock.com",!Ce.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=M,T||S||v(b)||v(x)){if(n=s.vars,(l=s.timeline=new ir({data:"nested",defaults:_||{}})).kill(),l.parent=l._dp=o(s),l._start=0,S||v(b)||v(x)){if(h=A.length,f=S&&Z(S),Ze(S))for(p in S)~cr.indexOf(p)&&((g=g||{})[p]=S[p]);for(c=0;c<h;c++)(u=bt(n,ur)).stagger=0,O&&(u.yoyoEase=O),g&&D(u,g),m=A[c],u.duration=+qt(b,o(s),c,m,A),u.delay=(+qt(x,o(s),c,m,A)||0)-s._delay,!S&&1===h&&u.delay&&(s._delay=x=u.delay,s._start+=x,u.delay=0),l.to(m,u,f?f(c,m,A):0),l._ease=zt.none;l.duration()?b=x=0:s.timeline=0}else if(T){P(vt(l.vars.defaults,{ease:"none"})),l._ease=Ht(T.ease||n.ease||"none");var C,L,R,U=0;if(qe(T))T.forEach((function(e){return l.to(A,e,">")}));else{for(p in u={},T)"ease"!==p&&"easeEach"!==p&&function(e,t,r,n){var a,i,s=t.ease||n||"power1.inOut";if(qe(t))i=r[e]||(r[e]=[]),t.forEach((function(e,r){return i.push({t:r/(t.length-1)*100,v:e,e:s})}));else for(a in t)i=r[a]||(r[a]=[]),"ease"!==a&&i.push({t:parseFloat(e),v:t[a],e:s})}(p,T[p],u,T.easeEach);for(p in u)for(C=u[p].sort((function(e,t){return e.t-t.t})),c=U=0;c<C.length;c++)(R={ease:(L=C[c]).e,duration:(L.t-(c?C[c-1].t:0))/100*b})[p]=L.v,l.to(A,R,U),U+=R.duration;l.duration()<b&&l.to({},{duration:b-l.duration()})}}b||s.duration(b=l.duration())}else s.timeline=0;return!0!==M||oe||(rr=o(s),le.killTweensOf(A),rr=0),I(i,o(s),a),n.reversed&&s.reverse(),n.paused&&s.paused(!0),(w||!b&&!T&&s._start===ft(i._time)&&We(w)&&k(o(s))&&"nested"!==i.data)&&(s._tTime=-Ie,s.render(Math.max(0,-x))),E&&B(o(s),E),s}return u(t,[{key:"render",value:function(e,t,r){var n,a,i=this._time,s=this._tDur,o=this._dur,l=s-Ie<e&&0<=e?s:e<Ie?0:e;if(o){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(f=l,m=this.timeline,this._repeat){if(d=o+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*d+e,t,r);if(f=ft(l%d),l===s?(v=this._repeat,f=o):((v=~~(l/d))&&v===l/d&&(f=o,v--),o<f&&(f=o)),(p=this._yoyo&&1&v)&&(h=this._yEase,f=o-f),b=C(this._tTime,d),f===i&&!r&&this._initted)return this;v!==b&&(m&&this._yEase&&re(m,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(ft(d*v),!0).invalidate()._lock=0))}if(!this._initted){if(U(this,e<0?e:f,r,t))return this._tTime=0,this;if(o!==this._dur)return this.render(e,t,r)}if(this._tTime=l,this._time=f,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=a=(h||this._ease)(f/o),this._from&&(this.ratio=a=1-a),f&&!i&&!t&&(J(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(a,n.d),n=n._next;m&&m.render(e<0?e:!f&&p?-Ie:m._dur*m._ease(f/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),J(this,"onUpdate")),this._repeat&&v!==b&&this.vars.onRepeat&&!t&&this.parent&&J(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&o||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!i||!l&&!i||(J(this,l===s?"onComplete":"onReverseComplete",!0),!this._prom||l<s&&0<this.timeScale()||this._prom()))}}else{var c,u,d=this,h=e,p=t,m=r,f=d.ratio,g=h<0||!h&&(!d._start&&j(d)&&(d._initted||!N(d))||(d._ts<0||d._dp._ts<0)&&!N(d))?0:1,v=d._rDelay,b=0;if(v&&d._repeat&&(u=C(b=H(0,d._tDur,h),v),d._yoyo&&1&u&&(g=1-g),u!==C(d._tTime,v)&&(f=1-g,d.vars.repeatRefresh&&d._initted&&d.invalidate())),g!==f||m||d._zTime===Ie||!h&&d._zTime){if(d._initted||!U(d,h,m,p)){for(u=d._zTime,d._zTime=h||(p?Ie:0),p=p||h&&!u,d.ratio=g,d._from&&(g=1-g),d._time=0,d._tTime=b,c=d._pt;c;)c.r(g,c.d),c=c._next;d._startAt&&h<0&&d._startAt.render(h,!0,!0),d._onUpdate&&!p&&J(d,"onUpdate"),b&&d._repeat&&!p&&d.parent&&J(d,"onRepeat"),(h>=d._tDur||h<0)&&d.ratio===g&&(g&&xt(d,1),p||(J(d,g?"onComplete":"onReverseComplete",!0),d._prom&&d._prom()))}}else d._zTime||(d._zTime=h)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),n(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return h=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,rr&&!0!==rr.vars.overwrite)._first||$(this),this.parent&&h!==this.timeline.totalDuration()&&z(this,this._dur*this.timeline._tDur/h,0,1),this;var r,n,a,i,s,o,l,c=this._targets,u=e?Pt(e):c,d=this._ptLookup,h=this._pt;if((!t||"all"===t)&&function(e,t){for(var r=e.length,n=r===t.length;n&&r--&&e[r]===t[r];);return r<0}(c,u))return"all"===t&&(this._pt=0),$(this);for(r=this._op=this._op||[],"all"!==t&&(Ve(t)&&(s={},M(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var r,n,a,i,s=(e=e[0]?mt(e[0]).harness:0)&&e.aliases;if(!s)return t;for(n in r=D({},t),s)if(n in r)for(a=(i=s[n].split(",")).length;a--;)r[i[a]]=r[n];return r}(c,t)),l=c.length;l--;)if(~u.indexOf(c[l]))for(s in n=d[l],"all"===t?(r[l]=t,i=n,a={}):(a=r[l]=r[l]||{},i=t),i)(o=n&&n[s])&&("kill"in o.d&&!0!==o.d.kill(s)||yt(this,o,"_pt"),delete n[s]),"all"!==a&&(a[s]=1);return this._initted&&!this._pt&&h&&$(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return G(1,arguments)}},{key:"delayedCall",value:function(e,r,n,a){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:a})}},{key:"fromTo",value:function(e,t,r){return G(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return le.killTweensOf(e,t,r)}}]),t}()),hr=(vt(dr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),M("staggerTo,staggerFrom,staggerFromTo",(function(e){dr[e]=function(){var t=new ir,r=Dt.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),pr=function(e,t,r){return e[t](r)},mr=function(e,t,r,n){return e[t](n.fp,r)},fr=function(e,t){return Ge(e[t])?pr:f(e[t])&&e.setAttribute?Xt:hr},gr=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},vr=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},br=function(e){for(var t,r,n,a,i=e._pt;i;){for(t=i._next,r=n;r&&r.pr>i.pr;)r=r._next;(i._prev=r?r._prev:a)?i._prev._next=i:n=i,(i._next=r)?r._prev=i:a=i,i=t}e._pt=n},yr=function(){function e(t,r,n,a,i,s,o,l,c){d(this,e),this.t=r,this.s=a,this.c=i,this.p=n,this.r=s||gr,this.d=o||this,this.set=l||hr,this.pr=c||0,(this._next=t)&&(t._prev=this)}return u(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=er,this.m=e,this.mt=r,this.tween=t}}]),e}(),xr=(M(ht+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return it[e]=1})),rt.TweenMax=rt.TweenLite=dr,rt.TimelineLite=rt.TimelineMax=ir,le=new ir({sortChildren:!1,defaults:Le,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ce.stringFilter=function(e){var t=e.join(" ");if(Bt.lastIndex=0,Bt.test(t))return t=Ut.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,It(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=Ge(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:w,render:Qt,add:or,kill:$t,modifier:Jt,rawVars:0}),a={targetTest:0,get:0,getSetter:fr,aliases:{},register:0};if(Nt(),e!==r){if(lt[t])return;vt(r,vt(bt(e,n),a)),D(r.prototype,D(n,bt(e,a))),lt[r.prop=t]=r,e.targetTest&&(dt.push(r),it[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,r),e.register&&e.register(Sr,r,yr)}))},timeline:function(e){return new ir(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,r,n){Ve(e)&&(e=Pt(e)[0]);var a=mt(e||{}).get,i=r?E:_;return"native"===r&&(r=""),e&&(t?i((lt[t]&<[t].get||a)(e,t,r,n)):function(t,r,n){return i((lt[t]&<[t].get||a)(e,t,r,n))})},quickSetter:function(e,t,r){var n,a;if(1<(e=Pt(e)).length)return n=e.map((function(e){return Sr.quickSetter(e,t,r)})),a=n.length,function(e){for(var t=a;t--;)n[t](e)};e=e[0]||{};var i=lt[t],s=mt(e),o=s.harness&&(s.harness.aliases||{})[t]||t,l=i?function(t){var n=new i;me._pt=0,n.init(e,r?t+r:t,me,0,[e]),n.render(1,n),me._pt&&Qt(1,me)}:s.set(e,o);return i?l:function(t){return l(e,o,r?t+r:t,s,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Ht(e.ease,Le.ease)),O(Le,e||{})},config:function(e){return O(Ce,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,a=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!lt[e]&&!rt[e]&&y(t+" effect requires "+e+" plugin.")})),ct[t]=function(e,t,n){return r(Pt(e),vt(t||{},a),n)},e&&(ir.prototype[t]=function(e,r,n){return this.add(ct[t](e,Ze(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){zt[e]=Ht(t)},parseEase:function(e,t){return arguments.length?Ht(e,t):zt},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,a=new ir(r);for(a.smoothChildTiming=We(r.smoothChildTiming),le.remove(a),a._dp=0,a._time=a._tTime=le._time,e=le._first;e;)t=e._next,!n&&!e._dur&&e instanceof dr&&e.vars.onComplete===e._targets[0]||I(a,e,e._start-e._delay),e=t;return I(le,a,0),a},utils:{wrap:function e(t,r,n){var a=r-t;return qe(t)?X(t,e(0,t.length),r):_t(n,(function(e){return(a+(e-t)%a)%a+t}))},wrapYoyo:function e(t,r,n){var a=r-t,i=2*a;return qe(t)?X(t,e(0,t.length-1),r):_t(n,(function(e){return t+(a<(e=(i+(e-t)%i)%i||0)?i-e:e)}))},distribute:Z,random:q,snap:K,normalize:function(e,t,r){return Y(e,t,0,1,r)},getUnit:Et,clamp:function(e,t,r){return _t(r,(function(r){return H(e,t,r)}))},splitColor:Rt,toArray:Pt,selector:function(e){return e=Pt(e)[0]||y("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Pt(t,r.querySelectorAll?r:r===e?y("Invalid scope")||de.createElement("div"):e)}},mapRange:Y,pipe:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(r){return e(parseFloat(r))+(t||Et(r))}},interpolate:function e(t,r,n,a){var i=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!i){var s,o,l,c,u,d=Ve(t),h={};if(!0===n&&(a=1)&&(n=null),d)t={p:t},r={p:r};else if(qe(t)&&!qe(r)){for(l=[],c=t.length,u=c-2,o=1;o<c;o++)l.push(e(t[o-1],t[o]));c--,i=function(e){e*=c;var t=Math.min(u,~~e);return l[t](e-t)},n=r}else a||(t=D(qe(t)?[]:{},t));if(!l){for(s in r)or.call(h,t,s,"get",r[s]);i=function(e){return Qt(e,h),d?t.p:t}}}return _t(n,i)},shuffle:kt},install:b,effects:ct,ticker:jt,updateRoot:ir.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:yr,globals:x,Tween:dr,Timeline:ir,Animation:ar,getCache:mt,_removeLinkedListItem:yt,suppressOverwrites:function(e){return oe=e}}}),wr=(M("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return xr[e]=dr[e]})),jt.add(ir.updateRoot),me=xr.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),Sr=xr.registerPlugin({name:"attr",init:function(e,t,r,n,a){var i,s;for(i in t)(s=this.add(e,"setAttribute",(e.getAttribute(i)||0)+"",t[i],n,a,0,0,i))&&(s.op=i),this._props.push(i)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},tr("roundProps",W),tr("modifiers"),tr("snap",K))||xr;dr.version=ir.version=Sr.version="3.9.1",he=1,g()&&Nt(),zt.Power0,zt.Power1,zt.Power2,zt.Power3,zt.Power4,zt.Linear,zt.Quad,zt.Cubic,zt.Quart,zt.Quint,zt.Strong,zt.Elastic,zt.Back,zt.SteppedEase,zt.Bounce,zt.Sine,zt.Expo,zt.Circ},7995:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(6001);class a{constructor(){this.cbs=[],this.cb=e=>this.cbs.map((t=>{var r;return null==(r=t.fn)?void 0:r.call(t,e)})).filter((e=>e)),this.emit=this.cb}add(e,t){return this.cbs.push({fn:t,name:e})}on(e,t){return this.add(t||"custom_"+(0,n.getId)(),e)}get(e){var t=this.cbs.findIndex((t=>t.name===e));if(-1!==t)return{data:this.cbs[t],index:t}}reset(e,t){return!!(e=this.get(e))&&(e.data.fn=t,!0)}remove(e){this.reset(e,null)}delete(e){void 0!==(e=(this.get(e)||{}).index)&&this.cbs.splice(e,1)}}},4230:(e,t,r)=>{r.d(t,{N:()=>o,Z:()=>s});var n=r(8881),a=r(1794),i=r(6272);class s{constructor(e){this.mode="PerspectiveCamera",this.oCam=this.createOrthographic(),this.pCam=this.create(),this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"camera",map:{parse:e=>Promise.all(e.childs.map((e=>new Promise((t=>{this.setTemp(e,{time:.5,onComplete:()=>{t(0)}})})))))}})},this.clean=()=>{this.temp.clear()},this.backgroudDom=null,this.temp=new a.Z,this.pointerDown=()=>{this.closeAnima()},this.animaData={animaIns:null,onComplete:null},this.runScene=e,this.runScene.cb.events.pointer.down.add("camera",this.pointerDown),this.runScene.cb.clean.add("camera",this.clean),this.runScene.cb.inited.add("camera",this.onInited),this.runScene.cb.renderEx.setSize.add("camera",(({width:e,height:t})=>{const r=this.runScene.assetsEx.get().camera;r.aspect=e/t,r.updateProjectionMatrix(),this.setBackgroundSize(e,t)}))}setBackground(e){this.backgroudData=e;const t=this.runScene.assetsEx.engineDom;var r,n;this.backgroudDom||(this.backgroudDom=document.createElement("div"),({width:r,height:n}=this.runScene.assetsEx.renderer.domElement.getBoundingClientRect()),this.backgroudDom.style.position="absolute",this.backgroudDom.style.left="50%",this.backgroudDom.style.top="50%",this.backgroudDom.style.transform="translate(-50%,-50%)",this.backgroudDom.style.width=r+"px",this.backgroudDom.style.height=n+"px",t.appendChild(this.backgroudDom)),this.runScene.cb.camera.set.cb({type:"background",data:e}),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+URL.createObjectURL(e)+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}setBackgroundSize(e,t){this.backgroudDom&&(this.backgroudDom.style.width=e+"px",this.backgroudDom.style.height=t+"px")}create(){return new n.PerspectiveCamera}createOrthographic(){return new n.OrthographicCamera}setMode(e){if(e!==this.mode){this.runScene.helperEx.transContro.reset(),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize();const t=this.runScene.assetsEx.get().controls;"OrthographicCamera"===e&&(t.enableRotate=!1,t.enablePan=!1)}}getCamera(){return"OrthographicCamera"===this.mode?this.oCam:this.pCam}reset(e){e.position.set(0,20,20),e.near=.1,e.far=1e3,e.fov=50,e.updateProjectionMatrix()}get(){return this.runScene.assetsEx.get().camera}setSize(){var{width:e,height:t}=this.runScene.renderEx.getDomSize();const r=this.getCamera();r.aspect=e/t,r.updateProjectionMatrix()}addTemp(e){var{name:e,data:t}=e;this.temp.set(e,{name:e,data:t})}delTemp(e){this.temp.delete(e)}getLocal(){var{camera:e,controls:t}=this.runScene.assetsEx.get(),{x:e,y:r,z:n}=e.position,{x:t,y:a,z:i}=t.target;return{x:e,y:r,z:n,tx:t,ty:a,tz:i}}closeAnima(){var e,t;null!=(e=this.animaData.animaIns)&&e.kill(),(this.animaData.animaIns=null)!=(t=(e=this.animaData).onComplete)&&t.call(e),this.animaData.onComplete=null}setTemp(e,t){return(e=this.temp.get(e))?this.anima(e.data,t):Promise.resolve()}anima(e,t){return new Promise((r=>{const{time:n,onComplete:a,onUpdate:s}=t||{},{camera:o,controls:l}=this.runScene.assetsEx.get();this.closeAnima(),this.animaData.onComplete=a,this.animaData.animaIns=(0,i.gY)(this.getLocal(),e,n||.5,(e=>{var{x:t,y:r,z:n,tx:a,ty:i,tz:c}=e;o.position.set(t,r,n),l.target.set(a,i,c),l.update(),null!=s&&s(e)}),(()=>{null!=a&&a(),r(0)}))}))}static toJSON(e){const t=e.assetsEx.get().camera;return{temp:e.cameraEx.temp.toJSON(),camera:t.toJSON()}}}const o=e=>null==e?void 0:e.isCamera},713:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>Code});var js_funcs__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6001),js_funcs__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_0__),_RunScene__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(9106),_Libs_Three__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6292),_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(6272);class Code{constructor(e){this.inited=()=>{this.bindEvent()},this.str={const:"",code:"()=>{}"},(this.runScene=e).cb.inited.add("code",this.inited),e.cb.clean.add("code",(()=>{this.str={const:void 0,code:void 0}}))}set(e,t){this.str[e]=_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.encrypt(t)}get(e){return _Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.decrypt(this.str[e])}bindEvent(){this.runScene.exporter.gltf.options.addOption({type:"code",process:()=>JSON.stringify(this.str),parse:e=>{if(e)try{var t=JSON.parse(e);this.str=t}catch(e){}}})}copy(e){return this.mergeStr(this.get("code"),e)}mergeStr(e,t){let r=`(map)=>{\n const { \n camera,\n scene,\n controls,\n renderer,\n render2,\n render3,\n bus,\n runScene,\n getModel,\n core,\n Three,\n constant,\n Utils,\n } = map;\n /**\n *以下为内置环境变量 可直接使用 不可重复定义\n *camera,\n *scene,\n *controls,\n *renderer,\n *render2,\n *render3,\n *bus,\n *runScene,\n *getModel,\n *core:各导出模块挂载的根对象,\n *Three,\n *constant:常亮对象,\n *Utils,\n */\n ${e}\n };`;return t?`(runScene, inputData= {}, constant= {})=>{\n const fn = ${r}\n const modules = fn({\n runScene,\n getModel: runScene.modelEx.getModel.bind(runScene.modelEx),\n core: runScene.custom,\n ...runScene.assetsEx.get(),\n ...inputData,\n Three,\n constant,\n window:null,\n });\n if(!modules) return;\n modules.map((TheClass) => {\n const ins = new TheClass();\n if (!ins.name) throw TypeError("代码出错");\n runScene.custom[ins.name] = ins;\n return ins;\n }).map((ins)=>ins.mounted?.())\n }`:r}getParms(){return{base:{Three:_Libs_Three__WEBPACK_IMPORTED_MODULE_2__.Z,Utils:_RunScene__WEBPACK_IMPORTED_MODULE_1__.cQ,window:null},other:Object.assign(Object.assign({bus:new _RunScene__WEBPACK_IMPORTED_MODULE_1__.Gc},this.runScene.assetsEx.get()),{runScene:this.runScene,getModel:this.runScene.modelEx.getModel.bind(this.runScene.modelEx),core:this.runScene.custom})}}getAll(){return{code:_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.decrypt(this.str.code),const:_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.decrypt(this.str.const)}}createFunc(map){const tMap=map||this.getAll(),tStr=this.mergeStr(tMap.code||"()=>{}"),fn=eval(tStr),constFn=eval(" ()=>{"+tMap.const+"};"),baseData=this.getParms();return(e={})=>{e=Object.assign(Object.assign(Object.assign(Object.assign({},baseData.other),e),baseData.base),{constant:constFn()||{}});const t=fn(e);null!=t&&t.map((e=>{if(!(e=new e).name)throw TypeError("代码出错");this.runScene.custom[e.name]=e})),(0,js_funcs__WEBPACK_IMPORTED_MODULE_0__.mapObj)(this.runScene.custom,((e,t)=>{var r;return null==(r=t.mounted)?void 0:r.call(t)})),e.bus}}run(){this.createFunc()()}}},4330:(e,t,r)=>{r.d(t,{sG:()=>n,zX:()=>a});const n=["map","normalMap","aoMap"],a=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},3263:(e,t,r)=>{r.d(t,{F6:()=>n,YD:()=>h});var n={};r.r(n),r.d(n,{filter:()=>a,findMultiIndex:()=>d,findThenDel:()=>u,isDef:()=>l,isEmpty:()=>i,notEmpty:()=>s,random:()=>o,toArr:()=>c});const a=e=>e.filter((e=>e)),i=e=>0===e.length,s=e=>0!==e.length,o=e=>{var t=Math.random()*e.length;return e[Math.floor(t)]},l=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!0;return!1},c=e=>Array.isArray(e)?e:[e],u=(e,t)=>-1!==(t=e.findIndex(t))&&(e.splice(t,1),!0),d=(e,t)=>e.map(((e,r)=>t(e)?r:void 0)).filter((e=>void 0!==e));r(1794),r(272);var h=r(7201)},1794:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(6001);class a extends Map{constructor(e){e?super((0,n.mapObj)(e,((e,t)=>[e,t]))):super()}toArray(e){let t=[];for(const r of this.entries())"key"==e?t.push(r[0]):t.push(r[1]);return t}map(e){return[...this.entries()].map((t=>{var[t,r]=t;return e(t,r)}))}toJSON(){const e={};return this.forEach(((t,r)=>{e[r]=t})),e}toString(){return JSON.stringify(this.map)}filterData(e){let t=[];for(var[r,n]of this.entries())e(r,n)&&t.push({key:r,val:n});return t}find(e){for(var[t,r]of this.entries())if(e(t,r))return r}static formJSON(e){return new a(e)}copy(e){e.map(((e,t)=>this.set(e,t)))}}},7201:(e,t,r)=>{r.r(t),r.d(t,{is:()=>i,isDef:()=>a,logObj:()=>u,objLength:()=>d,objToStr:()=>c,replaceKVForObj:()=>o,replaceKeyForObj:()=>l,replaceValForObj:()=>s});var n=r(6001);const a=(e,t)=>{if(!i(e))return!0;var r=Object.keys(e);for(let o=0;o<r.length;o++){var n=r[o],s=e[n];if(n=t[n],i(s))return!i(n)||a(s,n);if(s!==n)return!0}return!1},i=e=>(null==e?void 0:e.constructor)===Object,s=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[n]=t(n,i,a)})),r},o=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n],{k:n,v:i}=t(n,i,a);r[n]=i})),r},l=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[t(n,i,a)]=i})),r},c=e=>{let t="";return(0,n.mapObj)(e,((e,r)=>{t=(t+=e+":")+(i(r)?c(r):r)})),t},u=e=>{console.log(c(e))},d=e=>Object.keys(e).length},272:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends Set{constructor(e){super(),this.isSet=!0,null!=e&&e.map((e=>this.add(e)))}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const r=[];return this.forEach((n=>{if(n=e(n),!t)return r.push(n);n&&r.push(n)})),r}find(e){for(const t of this)if(e(t))return t}findThenDel(e){for(const t of this)if(e(t))return this.delete(t),!0}filter(e){const t=[];for(const r of this)e(r)&&t.push(r);return t}toJSON(){return this.toArray()}}},6292:(e,t,r)=>{r.d(t,{z:()=>h,Z:()=>p});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if("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&&s(e,t)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}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)}var c={type:"change"},u={type:"start"},d={type:"end"},h=function(){i(t,n.EventDispatcher);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}(t);function t(r,a){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),(i=e.call(this)).object=r,i.domElement=a,i.domElement.style.touchAction="none",i.enabled=!0,i.target=new n.Vector3,i.minDistance=0,i.maxDistance=1/0,i.minZoom=0,i.maxZoom=1/0,i.minPolarAngle=0,i.maxPolarAngle=Math.PI,i.minAzimuthAngle=-1/0,i.maxAzimuthAngle=1/0,i.enableDamping=!1,i.dampingFactor=.05,i.enableZoom=!0,i.zoomSpeed=1,i.enableRotate=!0,i.rotateSpeed=1,i.enablePan=!0,i.panSpeed=1,i.screenSpacePanning=!0,i.keyPanSpeed=7,i.autoRotate=!1,i.autoRotateSpeed=2,i.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},i.mouseButtons={LEFT:n.MOUSE.ROTATE,MIDDLE:n.MOUSE.DOLLY,RIGHT:n.MOUSE.PAN},i.touches={ONE:n.TOUCH.ROTATE,TWO:n.TOUCH.DOLLY_PAN},i.target0=i.target.clone(),i.position0=i.object.position.clone(),i.zoom0=i.object.zoom,i._domElementKeyEvents=null,i.getPolarAngle=function(){return x.phi},i.getAzimuthalAngle=function(){return x.theta},i.getDistance=function(){return this.object.position.distanceTo(this.target)},i.listenToKeyEvents=function(e){e.addEventListener("keydown",se),this._domElementKeyEvents=e},i.saveState=function(){g.target0.copy(g.target),g.position0.copy(g.object.position),g.zoom0=g.object.zoom},i.reset=function(){g.target.copy(g.target0),g.object.position.copy(g.position0),g.object.zoom=g.zoom0,g.object.updateProjectionMatrix(),g.dispatchEvent(c),g.update(),b=v.NONE},i.update=(s=new n.Vector3,l=(new n.Quaternion).setFromUnitVectors(r.up,new n.Vector3(0,1,0)),h=l.clone().invert(),p=new n.Vector3,m=new n.Quaternion,f=2*Math.PI,function(){var e=g.object.position,t=(s.copy(e).sub(g.target),s.applyQuaternion(l),x.setFromVector3(s),g.autoRotate&&b===v.NONE&&U(2*Math.PI/60/60*g.autoRotateSpeed),g.enableDamping?(x.theta+=w.theta*g.dampingFactor,x.phi+=w.phi*g.dampingFactor):(x.theta+=w.theta,x.phi+=w.phi),g.minAzimuthAngle),r=g.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=f:t>Math.PI&&(t-=f),r<-Math.PI?r+=f:r>Math.PI&&(r-=f),x.theta=t<=r?Math.max(t,Math.min(r,x.theta)):x.theta>(t+r)/2?Math.max(t,x.theta):Math.min(r,x.theta)),x.phi=Math.max(g.minPolarAngle,Math.min(g.maxPolarAngle,x.phi)),x.makeSafe(),x.radius*=S,x.radius=Math.max(g.minDistance,Math.min(g.maxDistance,x.radius)),!0===g.enableDamping?g.target.addScaledVector(M,g.dampingFactor):g.target.add(M),s.setFromSpherical(x),s.applyQuaternion(h),e.copy(g.target).add(s),g.object.lookAt(g.target),!0===g.enableDamping?(w.theta*=1-g.dampingFactor,w.phi*=1-g.dampingFactor,M.multiplyScalar(1-g.dampingFactor)):(w.set(0,0,0),M.set(0,0,0)),S=1,!(!(T||p.distanceToSquared(g.object.position)>y||8*(1-m.dot(g.object.quaternion))>y)||(g.dispatchEvent(c),p.copy(g.object.position),m.copy(g.object.quaternion),T=!1))}),i.dispose=function(){g.domElement.removeEventListener("contextmenu",oe),g.domElement.removeEventListener("pointerdown",te),g.domElement.removeEventListener("pointercancel",ae),g.domElement.removeEventListener("wheel",ie),g.domElement.removeEventListener("pointermove",re),g.domElement.removeEventListener("pointerup",ne),null!==g._domElementKeyEvents&&g._domElementKeyEvents.removeEventListener("keydown",se)};var i,s,l,h,p,m,f,g=o(i),v={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},b=v.NONE,y=1e-6,x=new n.Spherical,w=new n.Spherical,S=1,M=new n.Vector3,T=!1,_=new n.Vector2,E=new n.Vector2,D=new n.Vector2,O=new n.Vector2,P=new n.Vector2,k=new n.Vector2,A=new n.Vector2,C=new n.Vector2,L=new n.Vector2,R=[],I={};function B(){return Math.pow(.95,g.zoomSpeed)}function U(e){w.theta-=e}function j(e){w.phi-=e}N=new n.Vector3;var N,z,F,V=function(e,t){N.setFromMatrixColumn(t,0),N.multiplyScalar(-e),M.add(N)},G=(z=new n.Vector3,function(e,t){!0===g.screenSpacePanning?z.setFromMatrixColumn(t,1):(z.setFromMatrixColumn(t,0),z.crossVectors(g.object.up,z)),z.multiplyScalar(e),M.add(z)}),H=(F=new n.Vector3,function(e,t){var r,n=g.domElement;g.object.isPerspectiveCamera?(r=g.object.position,F.copy(r).sub(g.target),r=F.length(),r*=Math.tan(g.object.fov/2*Math.PI/180),V(2*e*r/n.clientHeight,g.object.matrix),G(2*t*r/n.clientHeight,g.object.matrix)):g.object.isOrthographicCamera?(V(e*(g.object.right-g.object.left)/g.object.zoom/n.clientWidth,g.object.matrix),G(t*(g.object.top-g.object.bottom)/g.object.zoom/n.clientHeight,g.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),g.enablePan=!1)});function Z(e){g.object.isPerspectiveCamera?S/=e:g.object.isOrthographicCamera?(g.object.zoom=Math.max(g.minZoom,Math.min(g.maxZoom,g.object.zoom*e)),g.object.updateProjectionMatrix(),T=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),g.enableZoom=!1)}function W(e){g.object.isPerspectiveCamera?S*=e:g.object.isOrthographicCamera?(g.object.zoom=Math.max(g.minZoom,Math.min(g.maxZoom,g.object.zoom/e)),g.object.updateProjectionMatrix(),T=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),g.enableZoom=!1)}function K(e){_.set(e.clientX,e.clientY)}function q(e){O.set(e.clientX,e.clientY)}function X(){var e,t;1===R.length?_.set(R[0].pageX,R[0].pageY):(e=.5*(R[0].pageX+R[1].pageX),t=.5*(R[0].pageY+R[1].pageY),_.set(e,t))}function Y(){var e,t;1===R.length?O.set(R[0].pageX,R[0].pageY):(e=.5*(R[0].pageX+R[1].pageX),t=.5*(R[0].pageY+R[1].pageY),O.set(e,t))}function Q(){var e=R[0].pageX-R[1].pageX,t=R[0].pageY-R[1].pageY;e=Math.sqrt(e*e+t*t),A.set(0,e)}function J(e){1==R.length?E.set(e.pageX,e.pageY):(r=ue(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),E.set(t,e)),D.subVectors(E,_).multiplyScalar(g.rotateSpeed);var t,r=g.domElement;U(2*Math.PI*D.x/r.clientHeight),j(2*Math.PI*D.y/r.clientHeight),_.copy(E)}function $(e){var t,r;1===R.length?P.set(e.pageX,e.pageY):(t=ue(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),P.set(r,e)),k.subVectors(P,O).multiplyScalar(g.panSpeed),H(k.x,k.y),O.copy(P)}function ee(e){var t=ue(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),C.set(0,t),L.set(0,Math.pow(C.y/A.y,g.zoomSpeed)),Z(L.y),A.copy(C)}function te(e){if(!1!==g.enabled)if(0===R.length&&(g.domElement.setPointerCapture(e.pointerId),g.domElement.addEventListener("pointermove",re),g.domElement.addEventListener("pointerup",ne)),R.push(e),"touch"===e.pointerType){switch(ce(e),R.length){case 1:switch(g.touches.ONE){case n.TOUCH.ROTATE:if(!1===g.enableRotate)return;X(),b=v.TOUCH_ROTATE;break;case n.TOUCH.PAN:if(!1===g.enablePan)return;Y(),b=v.TOUCH_PAN;break;default:b=v.NONE}break;case 2:switch(g.touches.TWO){case n.TOUCH.DOLLY_PAN:if(!1===g.enableZoom&&!1===g.enablePan)return;g.enableZoom&&Q(),g.enablePan&&Y(),b=v.TOUCH_DOLLY_PAN;break;case n.TOUCH.DOLLY_ROTATE:if(!1===g.enableZoom&&!1===g.enableRotate)return;g.enableZoom&&Q(),g.enableRotate&&X(),b=v.TOUCH_DOLLY_ROTATE;break;default:b=v.NONE}break;default:b=v.NONE}b!==v.NONE&&g.dispatchEvent(u)}else{var t,r=e;switch(r.button){case 0:t=g.mouseButtons.LEFT;break;case 1:t=g.mouseButtons.MIDDLE;break;case 2:t=g.mouseButtons.RIGHT;break;default:t=-1}switch(t){case n.MOUSE.DOLLY:if(!1===g.enableZoom)return;!function(e){A.set(e.clientX,e.clientY)}(r),b=v.DOLLY;break;case n.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===g.enablePan)return;q(r),b=v.PAN}else{if(!1===g.enableRotate)return;K(r),b=v.ROTATE}break;case n.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===g.enableRotate)return;K(r),b=v.ROTATE}else{if(!1===g.enablePan)return;q(r),b=v.PAN}break;default:b=v.NONE}b!==v.NONE&&g.dispatchEvent(u)}}function re(e){if(!1!==g.enabled)if("touch"===e.pointerType){var t=e;switch(ce(t),b){case v.TOUCH_ROTATE:if(!1===g.enableRotate)return;J(t),g.update();break;case v.TOUCH_PAN:if(!1===g.enablePan)return;$(t),g.update();break;case v.TOUCH_DOLLY_PAN:if(!1===g.enableZoom&&!1===g.enablePan)return;!function(e){g.enableZoom&&ee(e),g.enablePan&&$(e)}(t),g.update();break;case v.TOUCH_DOLLY_ROTATE:if(!1===g.enableZoom&&!1===g.enableRotate)return;!function(e){g.enableZoom&&ee(e),g.enableRotate&&J(e)}(t),g.update();break;default:b=v.NONE}}else{var r=e;switch(b){case v.ROTATE:if(!1===g.enableRotate)return;!function(e){E.set(e.clientX,e.clientY),D.subVectors(E,_).multiplyScalar(g.rotateSpeed),e=g.domElement,U(2*Math.PI*D.x/e.clientHeight),j(2*Math.PI*D.y/e.clientHeight),_.copy(E),g.update()}(r);break;case v.DOLLY:if(!1===g.enableZoom)return;!function(e){C.set(e.clientX,e.clientY),L.subVectors(C,A),0<L.y?Z(B()):L.y<0&&W(B()),A.copy(C),g.update()}(r);break;case v.PAN:if(!1===g.enablePan)return;!function(e){P.set(e.clientX,e.clientY),k.subVectors(P,O).multiplyScalar(g.panSpeed),H(k.x,k.y),O.copy(P),g.update()}(r)}}}function ne(e){le(e),0===R.length&&(g.domElement.releasePointerCapture(e.pointerId),g.domElement.removeEventListener("pointermove",re),g.domElement.removeEventListener("pointerup",ne)),g.dispatchEvent(d),b=v.NONE}function ae(e){le(e)}function ie(e){!1!==g.enabled&&!1!==g.enableZoom&&b===v.NONE&&(e.preventDefault(),g.dispatchEvent(u),e.deltaY<0?W(B()):0<e.deltaY&&Z(B()),g.update(),g.dispatchEvent(d))}function se(e){if(!1!==g.enabled&&!1!==g.enablePan){var t=e,r=!1;switch(t.code){case g.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?j(2*Math.PI*g.rotateSpeed/g.domElement.clientHeight):H(0,g.keyPanSpeed),r=!0;break;case g.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?j(-2*Math.PI*g.rotateSpeed/g.domElement.clientHeight):H(0,-g.keyPanSpeed),r=!0;break;case g.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?U(2*Math.PI*g.rotateSpeed/g.domElement.clientHeight):H(g.keyPanSpeed,0),r=!0;break;case g.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?U(-2*Math.PI*g.rotateSpeed/g.domElement.clientHeight):H(-g.keyPanSpeed,0),r=!0}r&&(t.preventDefault(),g.update())}}function oe(e){!1!==g.enabled&&e.preventDefault()}function le(e){delete I[e.pointerId];for(var t=0;t<R.length;t++)if(R[t].pointerId==e.pointerId)return void R.splice(t,1)}function ce(e){var t=I[e.pointerId];void 0===t&&(t=new n.Vector2,I[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ue(e){return e=e.pointerId===R[0].pointerId?R[1]:R[0],I[e.pointerId]}return g.domElement.addEventListener("contextmenu",oe),g.domElement.addEventListener("pointerdown",te),g.domElement.addEventListener("pointercancel",ae),g.domElement.addEventListener("wheel",ie,{passive:!1}),i.update(),i}return function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}();const p=n},7625:(e,t,r)=>{r.d(t,{Z:()=>n});class n{constructor(e){this.snapshot={create:e=>({}),set(e){}},this.runScene=e}}},7585:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(8609),a=r(3736),i=r(1398),s=r(2233),o=r(5317);t=r(7625);const l={far:1e5,near:.5,mapSizeX:512,scaleX:1,targetPosition:{x:0,y:-10,z:0}},c={position:{type:"v3",val:{x:0,y:10,z:0},shortKey:"p"},intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class u extends t.Z{constructor(){super(...arguments),this.type="DirectionalLight",this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,n.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},u.toJSON(t)),e}}}static toJSON(e){const{intensity:t,name:r,type:n,position:a,visible:i,color:o,castShadow:l,shadow:c,rotation:u,target:d}=e;var{mapSize:h,camera:p}=c,{scale:p,near:m,far:f}=p;return{type:n,intensity:t,name:r,visible:i,color:o.getHexString(),castShadow:l,shadow:{mapSize:h.x,camera:{near:m,far:f,scale:p.x}},id:(0,s.Ki)(e),position:{x:a.x,y:a.y,z:a.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:d.position.x,y:d.position.y,z:d.position.z}}}parseJSON(e,t){t=this.runScene.lightEx.get("DirectionalLight",t);var[r]=t;return u.setConfig(r,e),(0,a.M)(r,"id",e.id),t}get(e){return this.runScene.lightEx.get("DirectionalLight",e)}static setConfig(e,t){var{intensity:t,position:r,rotation:n,targetPosition:a,name:i,visible:s,color:l,castShadow:c,shadow:u}=t,{mapSize:u,camera:d}=u,{scale:d,near:h,far:p}=d;e.intensity=t,e.name=i,e.visible=s,e.castShadow=c,e.color=(0,o.getColorByHexStr)(l),r&&e.position.set(r.x,r.y,r.z),n&&e.rotation.set(n.x,n.y,n.z),a&&e.target.position.set(a.x,a.y,a.z),e.add(e.target),e.shadow.mapSize.x=u,e.shadow.mapSize.y=u,e.shadow.camera.scale.x=d,e.shadow.camera.scale.y=d,e.shadow.camera.scale.z=d,e.shadow.camera.near=h,e.shadow.camera.far=p,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}setConfig(e,t){return u.setConfig(e,t)}}u.snapshot={create:e=>{const t=i.LV.getDiff(c,e);var r=e.shadow,{mapSize:r,camera:n}=r,{scale:n,near:a,far:s}=n,{x:e,y:u,z:d}=e.target.position;return(0,o.isDef)(r.x,l.mapSizeX)&&(t.m=r.x),(0,o.isDef)({x:e,y:u,z:d},l.targetPosition)&&(t.tp={x:e,y:u,z:d}),(0,o.isDef)(n.x,l.scaleX)&&(t.s=n.x),(0,o.isDef)(a,l.near)&&(t.n=a),(0,o.isDef)(s,l.far)&&(t.f=s),t},set:e=>{const{map:t,light:r,runScene:n,data:a}=e,{m:s,tp:o,s:u,n:d,f:h}=(i.LV.set({def:c,data:a,runScene:n,map:t,target:r}),a);t.data.completedCbs.push((()=>{var{far:e,near:t,mapSizeX:n,scaleX:a,targetPosition:i}=l,{x:i,y:c,z:p}=o||i,i=(r.target.position.set(i,c,p),s||n),c=(r.shadow.mapSize.x=i,r.shadow.mapSize.y=i,u||a);r.shadow.camera.scale.x=c,r.shadow.camera.scale.y=c,r.shadow.camera.scale.z=c,r.shadow.camera.near=d||t,r.shadow.camera.far=h||e,r.shadow.camera.updateProjectionMatrix(),null!=(p=r.cameraHelper)&&p.update()}))}}},1269:(e,t,r)=>{r.d(t,{ZP:()=>O,RQ:()=>P});var n=r(6001),a=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(n);function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var i=new a.BufferGeometry,s=(i.setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),new a.LineBasicMaterial({fog:!1}));return((i=r.call(this,i,s)).light=e,i.color=t,i.type="RectAreaLightHelper",s=new a.BufferGeometry).setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),i.add(new a.Mesh(s,new a.MeshBasicMaterial({side:a.BackSide,fog:!1}))),i}return t=n,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.Line),u=r(6292),d=r(3736),h=r(1398),p=r(2233),m=(t=r(7625),r(8609));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 g extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},g.toJSON(t)),e}},this.type="AmbientLight"}get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i}=e;return{type:t,intensity:r,name:n,visible:a,id:(0,p.Ki)(e),color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i}=t;return e.intensity=r,e.type=t,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e}parseJSON(e,t){t=this.runScene.lightEx.get("AmbientLight",t);var[r]=t,n=e.id;return this.setConfig(r,e),(0,d.M)(r,"id",n),t}}g.snapshot={create:e=>h.LV.getDiff(f,e),set:e=>{var{map:e,light:t,runScene:r,data:n}=e;h.LV.set({def:f,data:n,runScene:r,map:e,target:t})}};var v=r(7585);class b extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},b.toJSON(t)),e}},this.type="HemisphereLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,groundColor:s,position:o}=e;return{name:n,id:(0,p.Ki)(e),type:t,intensity:r,visible:a,position:{x:o.x,y:o.y,z:o.z},groundColor:s.getHexString(),color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i,groundColor:s,position:o}=t;e.type=t,e.intensity=r,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e.groundColor=new u.Z.Color("#"+s),e.position.set(o.x,o.y,o.z)}parseJSON(e,t){t=this.runScene.lightEx.get("HemisphereLight",t);var[r]=t,n=e.id;return this.setConfig(r,e),(0,d.M)(r,"id",n),t}}class y extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},y.toJSON(t)),e}},this.type="PointLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:a,decay:i,renderOrder:s,color:o,visible:l,castShadow:c,shadow:u,position:d}=e;var{mapSize:h,camera:m,bias:f,radius:g}=u,{scale:m,near:v,far:b}=m;return{name:t,type:r,intensity:n,visible:l,color:o.getHexString(),castShadow:c,id:(0,p.Ki)(e),distance:a,decay:i,renderOrder:s,shadow:{mapSize:h.x,camera:{near:v,far:b,scale:m.x},radius:g,bias:f},position:{x:d.x,y:d.y,z:d.z}}}setConfig(e,t){var{name:t,type:r,intensity:n,distance:a,decay:i,renderOrder:s,color:o,visible:l,castShadow:c,shadow:d,position:h}=t,{mapSize:d,camera:p,bias:m,radius:f}=d,{scale:p,near:g,far:v}=p;e.intensity=n,e.type=r,e.name=t,e.visible=l,e.castShadow=c,e.distance=a,e.renderOrder=s,e.color=new u.Z.Color("#"+o),e.position.set(h.x,h.y,h.z),e.shadow.mapSize.x=d,e.shadow.mapSize.y=d,e.shadow.bias=m,e.decay=i,e.shadow.radius=f,e.shadow.camera.scale.x=p,e.shadow.camera.scale.y=p,e.shadow.camera.scale.z=p,e.shadow.camera.near=g,e.shadow.camera.far=v,e.shadow.camera.updateProjectionMatrix()}parseJSON(e,t){t=this.runScene.lightEx.get("PointLight",t);var[r]=t,n=e.id;return this.setConfig(r,e),(0,d.M)(r,"id",n),t}}class x extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},x.toJSON(t)),e}},this.type="RectAreaLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,position:s}=e;return{name:n,type:t,intensity:r,id:(0,p.Ki)(e),visible:a,position:{x:s.x,y:s.y,z:s.z},color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i,position:s}=t;e.type=t,e.intensity=r,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e.position.set(s.x,s.y,s.z)}parseJSON(e,t){t=this.runScene.lightEx.get("RectAreaLight",t);var[r]=t,n=e.id;return this.setConfig(r,e),(0,d.M)(r,"id",n),t}}class w extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},w.toJSON(t)),e}},this.type="SpotLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,color:n,distance:a,decay:i,intensity:s,angle:o,penumbra:l,visible:c,castShadow:u,shadow:d,renderOrder:h,position:m,target:f}=e;var{bias:g,camera:v,normalBias:b,mapSize:y,radius:x}=d,v=v.near;return{type:r,intensity:s,name:t,visible:c,distance:a,angle:o,id:(0,p.Ki)(e),decay:i,penumbra:l,renderOrder:h,color:n.getHexString(),castShadow:u,shadow:{bias:g,normalBias:b,mapSize:y.x,camera:{near:v},radius:x},position:{x:m.x,y:m.y,z:m.z},targetPosition:{x:f.position.x,y:f.position.y,z:f.position.z}}}setConfig(e,t){var{name:t,type:r,color:n,distance:a,decay:i,intensity:s,angle:o,penumbra:l,visible:c,castShadow:d,shadow:h,renderOrder:p,position:m,targetPosition:f}=t,{bias:h,camera:g,normalBias:v,mapSize:b,radius:y}=h,g=g.near;return e.intensity=s,e.type=r,e.name=t,e.visible=c,e.distance=a,e.decay=i,e.angle=o,e.penumbra=l,e.renderOrder=p,e.castShadow=d,e.color=new u.Z.Color("#"+n),e.position.set(m.x,m.y,m.z),e.shadow.mapSize.x=b,e.shadow.mapSize.y=b,e.shadow.camera.near=g,e.target.position.set(f.x,f.y,f.z),e.shadow.bias=h,e.shadow.normalBias=v,e.shadow.radius=y,e.shadow.camera.updateProjectionMatrix(),e}parseJSON(e,t){t=this.runScene.lightEx.get("SpotLight",t);var[r]=t,n=e.id;return this.setConfig(r,e),(0,d.M)(r,"id",n),t}}var S=r(3735),M=r(2510),T=r(7169),_=r(5317),E=r(7201);const D={DirectionalLight:v.Z,PointLight:y,SpotLight:w,RectAreaLight:x,HemisphereLight:b,AmbientLight:g};class O{constructor(e){this.inited=()=>{(0,n.mapObj)(this.lightExMap,((e,t)=>{this.runScene.modelEx.importAndExport.addParses(t.type,{parse:t.parseNromalLight,toNormal:t.toNormalLight})}))},this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.snapshot={create:e=>{const t=this.runScene.uniqueEx.model.getModelsByType("light"),r={};t.map((e=>{var t=e.type,n=(0,p.Ki)(e),a=null==(a=null==(t=D[t].snapshot)?void 0:t.create)?void 0:a.call(t,e);a&&n&&(r[n]=a)})),0!==(0,E.objLength)(r)&&e.data.set("light",r)},set:e=>{var t=e.snapshot.data.get("light");t&&(0,n.mapObj)(t,((t,r)=>{var n,a=((t=this.runScene.modelEx.getById(t))||{}).type;a&&null!=(n=null==(a=D[a].snapshot)?void 0:a.set)&&n.call(a,{data:r,runScene:this.runScene,light:t,map:e})}))}},this.runScene=e,this.lightExMap={DirectionalLight:new v.Z(e),PointLight:new y(e),SpotLight:new w(e),RectAreaLight:new x(e),HemisphereLight:new b(e),AmbientLight:new g(e)},e.cb.snapshot.create.add("light",this.snapshot.create),e.cb.snapshot.delUseless.add("light",(t=>{(0,n.mapObj)(t,((t,r)=>{const a=r.data.light;a&&((0,n.mapObj)(a,(t=>{e.uniqueEx.model.has(t)||delete a[t]})),0===(0,E.objLength)(a)&&delete r.data.light)}))})),e.cb.snapshot.set.add("light",this.snapshot.set),e.cb.snapshot.getLength.add("light",(e=>{var t=e.data.data.get("light");t&&(e.inputData.light=Object.keys(t).length)})),e.cb.inited.add("light",this.inited)}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:!!P(e)&&t.select,addUndo:!1})))),t.addUndo&&this.runScene.undoEx.addUndo(e)}get(e,t){t=(0,_.mergeObject)({id:(0,n.getId)()},t).id;let r=new u.Z[e],a=[r];return r.position.y=10,r.name=e,r.userData.id=t,this.shadowList.includes(e)&&(r.castShadow=!0),this.setLight(r),a.push(...this.setLightHelper(r)),null!=(t=null==r?void 0:r.lightHelper)&&t.update(),a}setNull(e){e.lightTarget&&this.setNull(e.lightTarget),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.lightTarget&&this.setSelect(e.lightTarget),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.lightTarget&&(e=e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(null!=(t=e.helper)&&t.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new T.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)):[e,e.helper].map((t=>{if(t)return new T.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&r&&this.runScene.undoEx.addUndo(r),r}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const r=(0,p.Ki)(t);let n,a=[];switch(e){case"RectAreaLight":n=new c(t,16773120);break;case"DirectionalLight":if(n=new u.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new u.Z.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.lightTarget=t).add(e)}t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();const e=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=r,e.userData.unClick=!0})),e.userData.id=r,e.userData.unClick=!0,e.visible=!1,t.cameraHelper=e,a.push(e);break;case"PointLight":n=new u.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new u.Z.SpotLightHelper(t);let i=new u.Z.Object3D;(t.target=i).name="helperModel",i.userData.isLightTarget=!0,i.lightTarget=t,i.position.y=-10,t.shadow.autoUpdate=!0,t.add(i);const s=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(s,!0,(e=>{e.userData.id=r})),s.userData.id=r,s.visible=!1,t.cameraHelper=s,a.push(s);break;case"HemisphereLight":n=new u.Z.HemisphereLightHelper(t,1,16773135)}return n.name="helperModel",this.runScene.helperEx.setHelper(n,!0,(e=>{e.userData.id=r})),n.userData.id=r,(n.light=t).helper=n,this.update(t),a.push(n),a}setLightHelper(e){return"editor"===this.runScene.optionsEx.options.mode&&this.helperList.includes(e.type)?this.getLightHelper(e.type,e):[]}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:r,val:n,cb:a}=e;return new M.Z({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:a}).execute()}setMultip(e,t,r=!0,n=!0){if(e instanceof Array)return a=e.map((e=>{var{model:e,typeList:n,newVal:a}=e;const i=new S.Z({target:e,typeList:n,newVal:a,cb:t});return r?i.execute():i})),n&&this.runScene.undoEx.addUndo(a),a;{var{model:a,typeList:e,newVal:i}=e;const s=new S.Z({target:a,typeList:e,newVal:i,cb:t});return n&&this.runScene.undoEx.addUndo(s),r?s.execute():s}}isLight(e){return null==(e=null==e?void 0:e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){var t=D[e.type].toJSON(e),r=this.get(e.type),[n]=r;return this.lightExMap[e.type].setConfig(n,t),r}toJSON(e){return e.filter((e=>!(0,m.isHelper)(e))).map((e=>D[e.type].toJSON(e)))}}const P=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},2353:(e,t,r)=>{r.d(t,{B:()=>Ie,Z:()=>Re});var n=r(8881),a=(t=r(3300),r.n(t));function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}r(6001);var s=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!==("undefined"==typeof WebAssembly?"undefined":i(WebAssembly)))return{supported:!1};var r,n=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",a=WebAssembly.instantiate(s(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));function s(e){for(var r=new Uint8Array(e.length),n=0;n<e.length;++n){var a=e.charCodeAt(n);r[n]=96<a?a-97:64<a?a-39:a+4}var i=0;for(n=0;n<e.length;++n)r[i++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,i)}function o(e,t,n,a,i,s){var o=r.exports.sbrk,l=n+3&-4,c=o(l*a),u=o(i.length),d=new Uint8Array(r.exports.memory.buffer);if(0==(d.set(i,u),e=e(c,n,a,u,i.length))&&s&&s(c,l,a),t.set(d.subarray(c,c+n*a)),o(c-o(0)),0!=e)throw new Error("Malformed buffer data: "+e)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},c={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],d=0;return{ready:a,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s(n))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+o.toString()+function(e){a.then((function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);o(r.exports[t.mode],n,t.count,t.size,t.source,r.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:n},[n.buffer])}catch(n){self.postMessage({id:t.id,count:t.count,action:"reject",value:n})}}))}.toString(),i=(t=new Blob([t],{type:"text/javascript"}),URL.createObjectURL(t)),l=0;l<e;++l)u[l]=function(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){e=e.data,t.pending-=e.count,t.requests[e.id][e.action](e.value),delete t.requests[e.id]},t}(i);URL.revokeObjectURL(i)}(e)},decodeVertexBuffer:function(e,t,n,a,i){o(r.exports.meshopt_decodeVertexBuffer,e,t,n,a,r.exports[l[i]])},decodeIndexBuffer:function(e,t,n,a){o(r.exports.meshopt_decodeIndexBuffer,e,t,n,a)},decodeIndexSequence:function(e,t,n,a){o(r.exports.meshopt_decodeIndexSequence,e,t,n,a)},decodeGltfBuffer:function(e,t,n,a,i,s){o(r.exports[c[i]],e,t,n,a,r.exports[l[s]])},decodeGltfBufferAsync:function(e,t,n,i,s){if(0<u.length){for(var h=e,p=t,m=n,f=c[i],g=l[s],v=u[0],b=1;b<u.length;++b)u[b].pending<v.pending&&(v=u[b]);return new Promise((function(e,t){var r=new Uint8Array(m),n=d++;v.pending+=h,v.requests[n]={resolve:e,reject:t},v.object.postMessage({id:n,count:h,size:p,source:r,mode:f,filter:g},[r.buffer])}))}return a.then((function(){var a=new Uint8Array(e*t);return o(r.exports[c[i]],a,e,t,n,r.exports[l[s]]),a}))}}}();function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=new WeakMap,h=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=c(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,r,a){var i=this,s=new n.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){i.decodeDracoFile(e,t).catch(a)}),r,a)}},{key:"decodeDracoFile",value:function(e,t,r,n){return n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r},this.decodeGeometry(e,n).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,n=this,a=JSON.stringify(t);if(d.has(e)){if((s=d.get(e)).key===a)return s.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var i=this.workerNextTaskID++,s=e.byteLength;return s=this._getWorker(i,s).then((function(n){return r=n,new Promise((function(n,a){r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),s.catch((function(){return!0})).then((function(){r&&i&&n._releaseTask(r,i)})),d.set(e,{key:a,promise:s}),s}},{key:"_createGeometry",value:function(e){var t=new n.BufferGeometry;e.index&&t.setIndex(new n.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var a=(s=e.attributes[r]).name,i=s.array,s=s.itemSize;t.setAttribute(a,new n.BufferAttribute(i,s))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new n.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,n){r.load(e,t,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":o(WebAssembly))||"js"===this.decoderConfig.type,r=[];return t?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];t||(e.decoderConfig.wasmBinary=r[1]),r=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=n.buffer,i=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(a),a.byteLength);try{var s=function(e,t,r,n){var a,i=n.attributeIDs,s=n.attributeTypes,o=t.GetEncodedGeometryType(r);if(o===e.TRIANGULAR_MESH)a=new e.Mesh,v=t.DecodeBufferToMesh(r,a);else{if(o!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,v=t.DecodeBufferToPointCloud(r,a)}if(!v.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());var l,c,u,d,h,p,m,f,g,v,b,y,x,w={index:null,attributes:[]};for(l in i){var S=self[s[l]],M=void 0,T=void 0;if(n.useUniqueIDs)T=i[l],M=t.GetAttributeByUniqueId(a,T);else{if(-1===(T=t.GetAttributeId(a,e[i[l]])))continue;M=t.GetAttribute(a,T)}w.attributes.push((T=e,c=t,u=a,d=l,h=M.num_components(),m=(p=u.num_points()*h)*S.BYTES_PER_ELEMENT,f=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(T,S),g=T._malloc(m),c.GetAttributeDataArrayForAllPoints(u,M,f,m,g),c=new S(T.HEAPF32.buffer,g,p).slice(),T._free(g),{name:d,array:c,itemSize:h}))}return o===e.TRIANGULAR_MESH&&(w.index=(r=e,v=t,y=4*(b=3*(o=a).num_faces()),x=r._malloc(y),v.GetTrianglesUInt32Array(o,y,x),v=new Uint32Array(r.HEAPF32.buffer,x,b).slice(),r._free(x),{array:v,itemSize:1})),e.destroy(a),w}(e,t,r,i),o=s.attributes.map((function(e){return e.array.buffer}));s.index&&o.push(s.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:s},o)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(r),e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){r.workerPool.length<r.workerLimit?((n=new Worker(r.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(n)):r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n,a=r.workerPool[r.workerPool.length-1];return a._taskCosts[e]=t,a._taskLoad+=t,a}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Loader),p=r(4091),m={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};var f=new(function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var a=this,i=!1,s=0,o=0,l=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==a.onStart&&a.onStart(e,s,o),i=!0},this.itemEnd=function(e){s++,void 0!==a.onProgress&&a.onProgress(e,s,o),s===o&&(i=!1,void 0!==a.onLoad&&a.onLoad())},this.itemError=function(e){void 0!==a.onError&&a.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){return-1!==(e=c.indexOf(e))&&c.splice(e,2),this},this.getHandler=function(e){for(var t=0,r=c.length;t<r;t+=2){var n=c[t],a=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return a}return null}})));var g=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:f,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,r;return t=e,(r=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.load(e,n,t,a)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w=function(){var e=n,t=g;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=x(e);if(r=t?(r=x(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,r,n,a){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,s=m.get(e);if(void 0!==s)return i.manager.itemStart(e),setTimeout((function(){t&&t(s),i.manager.itemEnd(e)}),0),s;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var r=(n=i.options).textureQuality,n=n.reverseTexture,s=a.notCompress,o=a.size,l=0===e.size?new ImageData(1,1):e;t(o&&1!==r?(o=(t=a.size).w,t=t.h,s=s?1:r,createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY",resizeHeight:t*s,resizeWidth:o*s}))):createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(r){r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),2!==i.length);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e)||function(e,t){if(e){if("string"==typeof e)return b(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,2):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r);var n=r[0];r=r[1],m.add(e,n),t&&t(n,r),i.manager.itemEnd(e)})).catch((function(t){n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),S=r(5317),M=r(6422);function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e,t)||O(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(){return(E="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=B(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function D(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=O(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function O(e,t){if(e){if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(e,t):void 0}}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,r){return t&&A(e.prototype,t),r&&A(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}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&&R(e,t)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=B(e);if(r=t?(r=B(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===_(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var U=function(){L(t,n.Loader);var e=I(t);function t(r){return k(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new G(e)})),r.register((function(e){return new Y(e)})),r.register((function(e){return new Q(e)})),r.register((function(e){return new Z(e)})),r.register((function(e){return new W(e)})),r.register((function(e){return new K(e)})),r.register((function(e){return new q(e)})),r.register((function(e){return new V(e)})),r.register((function(e){return new X(e)})),r.register((function(e){return new H(e)})),r.register((function(e){return new z(e)})),r.register((function(e){return new J(e)})),r.register((function(e){return new $(e)})),r}return C(t,[{key:"load",value:function(e,t,r,a){function i(t){a?a(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)}var s=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:n.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new n.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{s.parse(r,o,(function(r){t(r),s.manager.itemEnd(e)}),i)}catch(r){i(r)}}),r,i)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n,a){var i,s={},o={},l=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===ee){try{s[N.KHR_BINARY_GLTF]=new te(e)}catch(e){return void(n&&n(e))}i=JSON.parse(s[N.KHR_BINARY_GLTF].content)}else i=JSON.parse(l.decode(e));else i=e;if(void 0===i.asset||i.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else if(a.valid(i)){var c=new we(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,ex:a});c.fileLoader.setRequestHeader(this.requestHeader);for(var u=0;u<this.pluginCallbacks.length;u++){var d=this.pluginCallbacks[u](c);s[(o[d.name]=d).name]=!0}if(i.extensionsUsed)for(var h=0;h<i.extensionsUsed.length;++h){var p=i.extensionsUsed[h],m=i.extensionsRequired||[];switch(p){case N.KHR_MATERIALS_UNLIT:s[p]=new F;break;case N.KHR_DRACO_MESH_COMPRESSION:s[p]=new re(i,this.dracoLoader);break;case N.KHR_TEXTURE_TRANSFORM:s[p]=new ne;break;case N.KHR_MESH_QUANTIZATION:s[p]=new ae;break;default:0<=m.indexOf(p)&&void 0===o[p]&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(r,n)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,t,n,a)}))}}]),t}();function j(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var N={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},z=function(){function e(t){k(this,e),this.parser=t,this.name=N.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return C(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var a=t[r];a.extensions&&a.extensions[this.name]&&void 0!==a.extensions[this.name].light&&e._addNodeRef(this.cache,a.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,r="light:"+e,a=t.cache.get(r);if(a)return a;var i,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new n.Color(16777215),c=(void 0!==o.color&&l.fromArray(o.color),void 0!==o.range?o.range:0);switch(o.type){case"directional":(i=new n.DirectionalLight(l)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new n.PointLight(l)).distance=c;break;case"spot":(i=new n.SpotLight(l)).distance=c,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,i.angle=o.spot.outerConeAngle,i.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return i.position.set(0,0,0),i.decay=2,ve(i,o),void 0!==o.intensity&&(i.intensity=o.intensity),i.name=t.createUniqueName(o.name||"light_"+e),a=Promise.resolve(i),t.cache.add(r,a),a}},{key:"getDependency",value:function(e,t){if("light"===e)return this._loadLight(t)}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,n=((e=r.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),F=function(){function e(){k(this,e),this.name=N.KHR_MATERIALS_UNLIT}return C(e,[{key:"getMaterialType",value:function(){return n.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var a,i=[];return e.color=new n.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(a=t.baseColorFactor,e.color.fromArray(a),e.opacity=a[3]),void 0!==t.baseColorTexture&&i.push(r.assignTexture(e,"map",t.baseColorTexture,n.sRGBEncoding))),Promise.all(i)}}]),e}(),V=function(){function e(t){k(this,e),this.parser=t,this.name=N.KHR_MATERIALS_EMISSIVE_STRENGTH}return C(e,[{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(void 0!==(e=e.extensions[this.name].emissiveStrength)&&(t.emissiveIntensity=e),Promise.resolve()):Promise.resolve()}}]),e}(),G=function(){function e(t){k(this,e),this.parser=t,this.name=N.KHR_MATERIALS_CLEARCOAT}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&a.push(r.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&a.push(r.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(a.push(r.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(r=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new n.Vector2(r,r))),Promise.all(a)}}]),e}(),H=function(){function e(t){k(this,e),this.parser=t,this.name=N.KHR_MATERIALS_IRIDESCENCE}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).iridescenceFactor&&(t.iridescence=e.iridescenceFactor),void 0!==e.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",e.iridescenceTexture)),void 0!==e.iridescenceIor&&(t.iridescenceIOR=e.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==e.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=e.iridescenceThicknessMinimum),void 0!==e.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=e.iridescenceThicknessMaximum),void 0!==e.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",e.iridescenceThicknessTexture)),Promise.all(n)}}]),e}(),Z=function(){function e(t){k(this,e),this.parser=t,this.name=N.KHR_MATERIALS_SHEEN}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[];return void 0!==(t.sheenColor=new n.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&a.push(r.assignTexture(t,"sheenColorMap",e.sheenColorTexture,n.sRGBEncoding)),void 0!==e.sheenRoughnessTexture&&a.push(r.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(a)}}]),e}(),W=function(){function e(t){k(this,e),this.parser=t,this.name=N.KHR_MATERIALS_TRANSMISSION}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(n)}}]),e}(),K=function(){function e(t){k(this,e),this.parser=t,this.name=N.KHR_MATERIALS_VOLUME}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(a=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[],a=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&r.push(a.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||1/0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new n.Color(a[0],a[1],a[2]),Promise.all(r)}}]),e}(),q=function(){function e(t){k(this,e),this.parser=t,this.name=N.KHR_MATERIALS_IOR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5,Promise.resolve()):Promise.resolve()}}]),e}(),X=function(){function e(t){k(this,e),this.parser=t,this.name=N.KHR_MATERIALS_SPECULAR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[],i=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&a.push(r.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new n.Color(i[0],i[1],i[2]),void 0!==e.specularColorTexture&&a.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture,n.sRGBEncoding)),Promise.all(a)}}]),e}(),Y=function(){function e(t){k(this,e),this.parser=t,this.name=N.KHR_TEXTURE_BASISU}return C(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json;if(!(n=r.textures[e]).extensions||!n.extensions[this.name])return null;var n=n.extensions[this.name],a=t.options.ktx2Loader;if(a)return t.loadTextureImage(e,n.source,a);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),Q=function(){function e(t){k(this,e),this.parser=t,this.name=N.EXT_TEXTURE_WEBP,this.isSupported=null}return C(e,[{key:"loadTexture",value:function(e){var t=this.name,r=this.parser,n=r.json;if(!(i=n.textures[e]).extensions||!i.extensions[t])return null;var a=i.extensions[t],i=n.images[a.source],s=r.textureLoader;return i.uri&&null!==(i=r.options.manager.getHandler(i.uri))&&(s=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,a.source,s);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),J=function(){function e(t){k(this,e),this.name=N.EXT_MESHOPT_COMPRESSION,this.parser=t}return C(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var r=e.extensions[this.name],n=(e=this.parser.getDependency("buffer",r.buffer),this.parser.options.meshoptDecoder);if(n&&n.supported)return e.then((function(e){var t=r.byteOffset||0,a=r.byteLength||0,i=r.count,s=r.byteStride,o=new Uint8Array(e,t,a);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,s,o,r.mode,r.filter).then((function(e){return e.buffer})):n.ready.then((function(){var e=new ArrayBuffer(i*s);return n.decodeGltfBuffer(new Uint8Array(e),i,s,o,r.mode,r.filter),e}))}));if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return null}}]),e}(),$=function(){function e(t){k(this,e),this.name=N.EXT_MESH_GPU_INSTANCING,this.parser=t}return C(e,[{key:"createNodeMesh",value:function(e){var t=this,r=this.parser.json,a=r.nodes[e];if(!a.extensions||!a.extensions[this.name]||void 0===a.mesh)return null;var i,s=D(r.meshes[a.mesh].primitives);try{for(s.s();!(i=s.n()).done;){var o=i.value;if(o.mode!==le.TRIANGLES&&o.mode!==le.TRIANGLE_STRIP&&o.mode!==le.TRIANGLE_FAN&&void 0!==o.mode)return null}}catch(e){s.e(e)}finally{s.f()}var l,c=a.extensions[this.name].attributes,u=[],d={};for(l in c)!function(e){u.push(t.parser.getDependency("accessor",c[e]).then((function(t){return d[e]=t,d[e]})))}(l);return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then((function(e){var r,a=e.pop(),i=a.isGroup?a.children:[a],s=e[0].count,o=[],l=D(i);try{for(l.s();!(r=l.n()).done;){for(var c,u=r.value,h=new n.Matrix4,p=new n.Vector3,m=new n.Quaternion,f=new n.Vector3(1,1,1),g=new n.InstancedMesh(u.geometry,u.material,s),v=0;v<s;v++)d.TRANSLATION&&p.fromBufferAttribute(d.TRANSLATION,v),d.ROTATION&&m.fromBufferAttribute(d.ROTATION,v),d.SCALE&&f.fromBufferAttribute(d.SCALE,v),g.setMatrixAt(v,h.compose(p,m,f));for(c in d)"TRANSLATION"!==c&&"ROTATION"!==c&&"SCALE"!==c&&u.geometry.setAttribute(c,d[c]);n.Object3D.prototype.copy.call(g,u),g.frustumCulled=!1,t.parser.assignFinalMaterial(g),o.push(g)}}catch(e){l.e(e)}finally{l.f()}return a.isGroup?(a.clear(),a.add.apply(a,o),a):o[0]})))}}]),e}(),ee="glTF",te=C((function e(t){k(this,e),this.name=N.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==ee)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var a=this.header.length-12,i=new DataView(t,12),s=0;s<a;){var o,l=i.getUint32(s,!0),c=(s+=4,i.getUint32(s,!0));s+=4,1313821514===c?(o=new Uint8Array(t,12+s,l),this.content=n.decode(o)):5130562===c&&(this.body=t.slice(o=12+s,o+l)),s+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),re=function(){function e(t,r){if(k(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=N.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return C(e,[{key:"decodePrimitive",value:function(e,t){var r,n,a=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},c={},u={};for(r in o){var d=pe[r]||r.toLowerCase();l[d]=o[r]}for(n in e.attributes){var h,p,m=pe[n]||n.toLowerCase();void 0!==o[n]&&(h=a.accessors[e.attributes[n]],p=ce[h.componentType],u[m]=p.name,c[m]=!0===h.normalized)}return t.getDependency("bufferView",s).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=c[r])&&(n.normalized=r)}t(e)}),l,u)}))}))}}]),e}(),ne=function(){function e(){k(this,e),this.name=N.KHR_TEXTURE_TRANSFORM}return C(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),ae=C((function e(){k(this,e),this.name=N.KHR_MESH_QUANTIZATION})),ie=function(){L(t,n.Interpolant);var e=I(t);function t(r,n,a,i){return k(this,t),e.call(this,r,n,a,i)}return C(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,a=e*n*3+n,i=0;i!==n;i++)t[i]=r[a+i];return t}},{key:"interpolate_",value:function(e,t,r,n){for(var a=this.resultBuffer,i=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,c=n-t,u=e*l,d=u-l,h=-2*(t=(r=(n=(r-t)/c)*n)*n)+3*r,p=t-r,m=1-h,f=p-r+n,g=0;g!==s;g++){var v=i[d+g+s],b=i[d+g+o]*c,y=i[u+g+s],x=i[u+g]*c;a[g]=m*v+f*b+h*y+p*x}return a}}]),t}(),se=new n.Quaternion,oe=function(){L(t,ie);var e=I(t);function t(){return k(this,t),e.apply(this,arguments)}return C(t,[{key:"interpolate_",value:function(e,r,n,a){return e=E(B(t.prototype),"interpolate_",this).call(this,e,r,n,a),se.fromArray(e).normalize().toArray(e),e}}]),t}(),le={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ce={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:n.NearestFilter,9729:n.LinearFilter,9984:n.NearestMipmapNearestFilter,9985:n.LinearMipmapNearestFilter,9986:n.NearestMipmapLinearFilter,9987:n.LinearMipmapLinearFilter},de={33071:n.ClampToEdgeWrapping,33648:n.MirroredRepeatWrapping,10497:n.RepeatWrapping},he={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pe={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},me={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},fe={CUBICSPLINE:void 0,LINEAR:n.InterpolateLinear,STEP:n.InterpolateDiscrete};function ge(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function ve(e,t){void 0!==t.extras&&("object"===_(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function be(e){for(var t="",r=Object.keys(e).sort(),n=0,a=r.length;n<a;n++)t+=r[n]+":"+e[r[n]]+";";return t}function ye(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var xe=new n.Matrix4,we=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=(k(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new j,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},t=!(this.nodeNamesUsed={}),r=!1,-1);"undefined"!=typeof navigator&&(t=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),a=(r=-1<navigator.userAgent.indexOf("Firefox"))?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||t||r&&a<98?this.textureLoader=new n.TextureLoader(this.options.manager):this.textureLoader=new w(this.options.manager),this.options.ex.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new n.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.rgbeLoader=new M.x(this.options.manager),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return C(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,n=this.json,a=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var i={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};ge(a,i,n),ve(i,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(i)}))).then((function(){e(i)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,a=t.length;n<a;n++)for(var i=t[n].joints,s=0,o=i.length;s<o;s++)e[i[s]].isBone=!0;for(var l=0,c=e.length;l<c;l++){var u=e[l];void 0!==u.mesh&&(this._addNodeRef(this.meshCache,u.mesh),void 0!==u.skin&&(r[u.mesh].isSkinnedMesh=!0)),void 0!==u.camera&&this._addNodeRef(this.cameraCache,u.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,r){var n=this;if(e.refs[t]<=1)return r;var a=r.clone();return function e(t,r){var a,i=n.associations.get(t),s=(null!=i&&n.associations.set(r,i),D(t.children.entries()));try{for(s.s();!(a=s.n()).done;){var o=T(a.value,2),l=o[0];e(o[1],r.children[l])}}catch(e){s.e(e)}finally{s.f()}}(r,a),a.name+="_instance_"+e.uses[t]++,a}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var n=e(t[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),r=(t.unshift(this),[]),n=0;n<t.length;n++){var a=e(t[n]);a&&r.push(a)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":n=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":n=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})))break;throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(e){var t,r,n=this.cache.get(e);return n||(r=(t=this).json[e+("mesh"===e?"es":"s")]||[],n=Promise.all(r.map((function(r,n){return t.getDependency(e,n)}))),this.cache.add(e,n)),n}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[N.KHR_BINARY_GLTF].body);var a=this.options;return new Promise((function(e,i){r.load(n.LoaderUtils.resolveURL(t.uri,a.path),e,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))}},{key:"loadAccessor",value:function(e){var t,r=this,a=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse)return e=he[i.type],s=ce[i.componentType],t=!0===i.normalized,s=new s(i.count*e),Promise.resolve(new n.BufferAttribute(s,e,t));var s=[];return void 0!==i.bufferView?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),void 0!==i.sparse&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then((function(e){var t,s=e[0],o=he[i.type],l=ce[i.componentType],c=l.BYTES_PER_ELEMENT,u=i.byteOffset||0,d=void 0!==i.bufferView?a.bufferViews[i.bufferView].byteStride:void 0,h=!0===i.normalized,p=d&&d!==c*o?(m=Math.floor(u/d),f="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+m+":"+i.count,(g=r.cache.get(f))||(t=new l(s,m*d,i.count*d/c),g=new n.InterleavedBuffer(t,d/c),r.cache.add(f,g)),new n.InterleavedBufferAttribute(g,o,u%d/c,h)):(t=null===s?new l(i.count*o):new l(s,u,i.count*o),new n.BufferAttribute(t,o,h));if(void 0!==i.sparse){var m=ce[i.sparse.indices.componentType],f=i.sparse.indices.byteOffset||0,g=i.sparse.values.byteOffset||0,v=new m(e[1],f,i.sparse.count*he.SCALAR),b=new l(e[2],g,i.sparse.count*o);null!==s&&(p=new n.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var y=0,x=v.length;y<x;y++){var w=v[y];if(p.setX(w,b[y*o]),2<=o&&p.setY(w,b[y*o+1]),3<=o&&p.setZ(w,b[y*o+2]),4<=o&&p.setW(w,b[y*o+3]),5<=o)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,a=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(a=r),this.loadTextureImage(e,n,a)}},{key:"loadTextureImage",value:function(e,t,r){var a=this,i=this.json,s=i.textures[e],o=i.images[t],l=(o.uri||o.bufferView)+":"+s.sampler;return this.textureCache[l]?this.textureCache[l]:(t=this.loadImageSource(t,r,e).then((function(t){t.flipY=!1,t.name=s.name||o.name||"";var r=(i.samplers||{})[s.sampler]||{};return t.magFilter=ue[r.magFilter]||n.LinearFilter,t.minFilter=ue[r.minFilter]||n.LinearMipmapLinearFilter,t.wrapS=de[r.wrapS]||n.RepeatWrapping,t.wrapT=de[r.wrapT]||n.RepeatWrapping,a.associations.set(t,{textures:e}),a.options.ex.loadTexture({texture:t,textureDef:s}),t})).catch((function(){return null})),this.textureCache[l]=t)}},{key:"loadImageSource",value:function(e,t,r){var a=this,i=this.json,s=this.options,o=i.textures[r];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var l=i.images[e],c=self.URL||self.webkitURL,u=l.uri||"",d=!1;if(void 0!==l.bufferView)u=a.getDependency("bufferView",l.bufferView).then((function(e){d=!0;var t=new Blob([e],{type:l.mimeType});return{sourceURI:u=c.createObjectURL(t),blob:t,bufferView:e}}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return r=Promise.resolve(u).then((function(e){var r=e.sourceURI,i=e.blob;return new Promise((function(e,l){if(0===i.size)return c=new n.Texture,e({texture:c,blob:i});var c;o.isHdr?o.cloneSourceId?e({texture:new n.Texture(document.createElement("canvas")),blob:new Blob([new ArrayBuffer(1)])}):((c=new FileReader).readAsDataURL(i),c.addEventListener("load",(function(t){t=t.target.result,a.rgbeLoader.loadAsync(t).then((function(t){t.encoding=n.sRGBEncoding,t.needsUpdate=!0,e({texture:t,blob:i})}))}))):!0===t.isImageBitmapLoader?(c=function(t,r){(t=new n.Texture(t)).needsUpdate=!0,e({texture:t,blob:r})},o.cloneSourceId?e({texture:new n.Texture(document.createElement("canvas")),blob:new Blob([new ArrayBuffer(1)])}):t.load(n.LoaderUtils.resolveURL(r,s.path),c,void 0,l,o)):(s.ex.options.loadConfig.reverseTexture,t.load(n.LoaderUtils.resolveURL(r,s.path),(function(t){e({texture:t,blob:i})}),void 0,l))}))})).then((function(e){var t=e.texture;return e=e.blob,"editor"===s.ex.options.mode?(o.isHdr||(t.userData.url=u),t.userData.blob=e):!0===d&&c.revokeObjectURL(u),t.userData.mimeType=l.mimeType||(0<(e=l.uri||"").search(/\.jpe?g($|\?)/i)||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":0<e.search(/\.webp($|\?)/i)||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't loadImageSource texture",u),e})),this.sourceCache[e]=r}},{key:"assignTexture",value:function(e,t,r,n){var a=this;return this.getDependency("texture",r.index).then((function(i){return i?(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),a.extensions[N.KHR_TEXTURE_TRANSFORM]&&(s=void 0!==r.extensions?r.extensions[N.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=a.associations.get(i),i=a.extensions[N.KHR_TEXTURE_TRANSFORM].extendTexture(i,s),a.associations.set(i,o)),void 0!==n&&(i.encoding=n),e[t]=i):null;var s,o}))}},{key:"assignFinalMaterial",value:function(e){var t,r,a=e.geometry,i=e.material,s=void 0===a.attributes.tangent,o=void 0!==a.attributes.color,l=void 0===a.attributes.normal;e.isPoints?(t="PointsMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.PointsMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,r.sizeAttenuation=!1,this.cache.add(t,r)),i=r):e.isLine&&(t="LineBasicMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.LineBasicMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),this.cache.add(t,r)),i=r),(s||o||l)&&(t="ClonedMaterial:"+i.uuid+":",s&&(t+="derivative-tangents:"),o&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(r=this.cache.get(t))||(r=i.clone(),o&&(r.vertexColors=!0),l&&(r.flatShading=!0),s&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(t,r),this.associations.set(r,this.associations.get(i)))),i.aoMap&&void 0===a.attributes.uv2&&void 0!==a.attributes.uv&&a.setAttribute("uv2",a.attributes.uv),this.options.ex.loadMaterial({material:i,materialDef:i.userData,model:e}),e.material=i}},{key:"getMaterialType",value:function(){return n.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,r,a=this,i=this.json,s=this.extensions,o=i.materials[e],l={},c=(i=[],(o.extensions||{})[N.KHR_MATERIALS_UNLIT]?(r=s[N.KHR_MATERIALS_UNLIT],t=r.getMaterialType(),i.push(r.extendParams(l,o,a))):(r=o.pbrMetallicRoughness||{},l.color=new n.Color(1,1,1),l.opacity=1,Array.isArray(r.baseColorFactor)&&(c=r.baseColorFactor,l.color.fromArray(c),l.opacity=c[3]),void 0!==r.baseColorTexture&&i.push(a.assignTexture(l,"map",r.baseColorTexture,n.sRGBEncoding)),l.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,l.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(i.push(a.assignTexture(l,"metalnessMap",r.metallicRoughnessTexture)),i.push(a.assignTexture(l,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),i.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))),!0===o.doubleSided&&(l.side=n.DoubleSide),o.alphaMode||"OPAQUE");return"BLEND"===c?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===c&&(l.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new n.Vector2(1,1),void 0!==o.normalTexture.scale&&(r=o.normalTexture.scale,l.normalScale.set(r,r))),void 0!==o.occlusionTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==n.MeshBasicMaterial&&(l.emissive=(new n.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==n.MeshBasicMaterial&&i.push(a.assignTexture(l,"emissiveMap",o.emissiveTexture,n.sRGBEncoding)),Promise.all(i).then((function(){var r=new t(l);return o.name&&(r.name=o.name),ve(r,o),a.associations.set(r,{materials:e}),o.extensions&&ge(s,r,o),r}))}},{key:"createUniqueName",value:function(e){for(var t=n.PropertyBinding.sanitizeNodeName(e||""),r=t,a=1;this.nodeNamesUsed[r];++a)r=t+"_"+a;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){for(var t=this,r=this.extensions,a=this.primitiveCache,i=[],s=0,o=e.length;s<o;s++){var l=e[s],c=(u=void 0,u=(u=(c=l).extensions&&c.extensions[N.KHR_DRACO_MESH_COMPRESSION])?"draco:"+u.bufferView+":"+u.indices+":"+be(u.attributes):c.indices+":"+be(c.attributes)+":"+c.mode),u=a[c];u?i.push(u.promise):(u=void 0,u=l.extensions&&l.extensions[N.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[N.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return Se(r,e,t)}))}(l):Se(new n.BufferGeometry,l,t),a[c]={primitive:l,promise:u},i.push(u))}return Promise.all(i)}},{key:"loadMesh",value:function(e){for(var t=this,r=this.json,a=this.extensions,i=r.meshes[e],s=i.primitives,o=[],l=0,c=s.length;l<c;l++){var u=void 0===s[l].material?(void 0===(u=this.cache).DefaultMaterial&&(u.DefaultMaterial=new n.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:n.FrontSide})),u.DefaultMaterial):this.getDependency("material",s[l].material);o.push(u)}return o.push(t.loadGeometries(s)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),l=r[r.length-1],c=[],u=0,d=l.length;u<d;u++){var h=l[u],m=s[u],f=void 0,g=o[u];if(m.mode===le.TRIANGLES||m.mode===le.TRIANGLE_STRIP||m.mode===le.TRIANGLE_FAN||void 0===m.mode)!0!==(f=new(!0===i.isSkinnedMesh?n.SkinnedMesh:n.Mesh)(h,g)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),m.mode===le.TRIANGLE_STRIP?f.geometry=(0,p.Vs)(f.geometry,n.TriangleStripDrawMode):m.mode===le.TRIANGLE_FAN&&(f.geometry=(0,p.Vs)(f.geometry,n.TriangleFanDrawMode));else if(m.mode===le.LINES)f=new n.LineSegments(h,g);else if(m.mode===le.LINE_STRIP)f=new n.Line(h,g);else if(m.mode===le.LINE_LOOP)f=new n.LineLoop(h,g);else{if(m.mode!==le.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);f=new n.Points(h,g)}if(0<Object.keys(f.geometry.morphAttributes).length){M=S=w=x=y=v=void 0;var v=f,b=i;if(v.updateMorphTargets(),void 0!==b.weights)for(var y=0,x=b.weights.length;y<x;y++)v.morphTargetInfluences[y]=b.weights[y];if(b.extras&&Array.isArray(b.extras.targetNames)){var w=b.extras.targetNames;if(v.morphTargetInfluences.length===w.length){v.morphTargetDictionary={};for(var S=0,M=w.length;S<M;S++)v.morphTargetDictionary[w[S]]=S}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}f.name=t.createUniqueName(i.name||"mesh_"+e),ve(f,i),m.extensions&&ge(a,f,m),t.assignFinalMaterial(f),c.push(f)}for(var T=0,_=c.length;T<_;T++)t.associations.set(c[T],{meshes:e,primitives:T});if(1===c.length)return c[0];var E=new n.Group;t.associations.set(E,{meshes:e});for(var D=0,O=c.length;D<O;D++)E.add(c[D]);return E}))}},{key:"loadCamera",value:function(e){var t,r=(e=this.json.cameras[e])[e.type];if(r)return"perspective"===e.type?t=new n.PerspectiveCamera(n.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new n.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),ve(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],r=[],a=0,i=t.joints.length;a<i;a++)r.push(this.getDependency("node",t.joints[a]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){for(var r=e.pop(),a=e,i=[],s=[],o=0,l=a.length;o<l;o++){var c=a[o];c?(i.push(c),c=new n.Matrix4,null!==r&&c.fromArray(r.array,16*o),s.push(c)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new n.Skeleton(i,s)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],r=[],a=[],i=[],s=[],o=[],l=0,c=t.channels.length;l<c;l++){var u=t.channels[l],d=t.samplers[u.sampler],h=(u=u.target).node,p=void 0!==t.parameters?t.parameters[d.input]:d.input,m=void 0!==t.parameters?t.parameters[d.output]:d.output;r.push(this.getDependency("node",h)),a.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",m)),s.push(d),o.push(u)}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(i),Promise.all(s),Promise.all(o)]).then((function(r){for(var a=r[0],i=r[1],s=r[2],o=r[3],l=r[4],c=[],u=0,d=a.length;u<d;u++)!function(e){var t=a[e],r=i[e],u=s[e],d=o[e],h=l[e];if(void 0!==t){t.updateMatrix();var p=void 0;switch(me[h.path]){case me.weights:p=n.NumberKeyframeTrack;break;case me.rotation:p=n.QuaternionKeyframeTrack;break;default:p=n.VectorKeyframeTrack}e=t.name||t.uuid;var m=void 0!==d.interpolation?fe[d.interpolation]:n.InterpolateLinear,f=[],g=(me[h.path]===me.weights?t.traverse((function(e){e.morphTargetInfluences&&f.push(e.name||e.uuid)})):f.push(e),u.array);if(u.normalized){for(var v=ye(g.constructor),b=new Float32Array(g.length),y=0,x=g.length;y<x;y++)b[y]=g[y]*v;g=b}for(var w=0,S=f.length;w<S;w++){var M=new p(f[w]+"."+me[h.path],r.array,g,m);"CUBICSPLINE"===d.interpolation&&(M.createInterpolant=function(e){return new(this instanceof n.QuaternionKeyframeTrack?oe:ie)(this.times,this.values,this.getValueSize()/3,e)},M.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(M)}}}(u);return r=t.name||"animation_"+e,new n.AnimationClip(r,void 0,c)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(e){return e=r._getNodeRef(r.meshCache,n.mesh,e),void 0!==n.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t=this.json,r=this.extensions,a=this,i=t.nodes[e],s=i.name?a.createUniqueName(i.name):"";return function(){for(var t=[],r=a._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})),n=(r&&t.push(r),void 0!==i.camera&&t.push(a.getDependency("camera",i.camera).then((function(e){return a._getNodeRef(a.cameraCache,i.camera,e)}))),a._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),[]),s=i.children||[],o=0,l=s.length;o<l;o++)n.push(a.getDependency("node",s[o]));return r=void 0===i.skin?Promise.resolve(null):a.getDependency("skin",i.skin),Promise.all([Promise.all(t),Promise.all(n),r])}().then((function(t){var o=t[0],l=t[1],c=t[2],u=!0===i.isBone?new n.Bone:1<o.length?new n.Group:1===o.length?o[0]:new n.Object3D;if(u!==o[0])for(var d=0,h=o.length;d<h;d++)u.add(o[d]);i.name&&(u.userData.name=i.name,u.name=s),ve(u,i),i.extensions&&ge(r,u,i),void 0!==i.matrix?((t=new n.Matrix4).fromArray(i.matrix),u.applyMatrix4(t)):(void 0!==i.translation&&u.position.fromArray(i.translation),void 0!==i.rotation&&u.quaternion.fromArray(i.rotation),void 0!==i.scale&&u.scale.fromArray(i.scale)),a.associations.has(u)||a.associations.set(u,{}),a.associations.get(u).nodes=e,null!==c&&u.traverse((function(e){e.isSkinnedMesh&&e.bind(c,xe)}));for(var p=0,m=l.length;p<m;p++)u.add(l[p]);return a.options.ex.loadNode({node:u,nodeDef:i})||u}))}},{key:"loadScene",value:function(e){for(var t=this.extensions,r=(e=this.json.scenes[e],this),a=new n.Group,i=(e.name&&(a.name=r.createUniqueName(e.name)),ve(a,e),e.extensions&&ge(t,a,e),e.nodes||[]),s=[],o=0,l=i.length;o<l;o++)s.push(r.getDependency("node",i[o]));return Promise.all(s).then((function(e){for(var t=0,i=e.length;t<i;t++)a.add(e[t]);return r.options.ex.loadScene(a),r.associations=function(e){var t,a=new Map,i=D(r.associations);try{for(i.s();!(t=i.n()).done;){var s=T(t.value,2),o=s[0],l=s[1];(o instanceof n.Material||o instanceof n.Texture)&&a.set(o,l)}}catch(e){i.e(e)}finally{i.f()}return e.traverse((function(e){var t=r.associations.get(e);null!=t&&a.set(e,t)})),a}(a),a}))}}]),e}();function Se(e,t,r){var a,i=t.attributes,s=[];for(a in i){var o=pe[a]||a.toLowerCase();o in e.attributes||s.push(function(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}(i[a],o))}void 0===t.indices||e.index||(l=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),s.push(l)),ve(e,t);var l=e,c=t,u=r,d=c.attributes,h=new n.Box3;if(void 0!==d.POSITION){var p=(d=u.json.accessors[d.POSITION]).min,m=d.max;if(void 0===p||void 0===m)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{h.set(new n.Vector3(p[0],p[1],p[2]),new n.Vector3(m[0],m[1],m[2])),d.normalized&&(p=ye(ce[d.componentType]),h.min.multiplyScalar(p),h.max.multiplyScalar(p));var f=c.targets;if(void 0!==f){for(var g=new n.Vector3,v=new n.Vector3,b=0,y=f.length;b<y;b++){var x,w,S=f[b];void 0!==S.POSITION&&(w=(S=u.json.accessors[S.POSITION]).min,x=S.max,void 0!==w&&void 0!==x?(v.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),v.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),v.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),S.normalized&&(w=ye(ce[S.componentType]),v.multiplyScalar(w)),g.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}h.expandByVector(g)}l.boundingBox=h,m=new n.Sphere,h.getCenter(m.center),m.radius=h.min.distanceTo(h.max)/2,l.boundingSphere=m}}return Promise.all(s).then((function(){if(void 0===t.targets)return e;for(var n=e,a=t.targets,i=r,s=!1,o=!1,l=!1,c=0,u=a.length;c<u;c++){var d=a[c];if(void 0!==d.POSITION&&(s=!0),void 0!==d.NORMAL&&(o=!0),void 0!==d.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(n);for(var h=[],p=[],m=[],f=0,g=a.length;f<g;f++){var v,b=a[f];s&&(v=void 0!==b.POSITION?i.getDependency("accessor",b.POSITION):n.attributes.position,h.push(v)),o&&(v=void 0!==b.NORMAL?i.getDependency("accessor",b.NORMAL):n.attributes.normal,p.push(v)),l&&(b=void 0!==b.COLOR_0?i.getDependency("accessor",b.COLOR_0):n.attributes.color,m.push(b))}return Promise.all([Promise.all(h),Promise.all(p),Promise.all(m)]).then((function(e){var t=e[0],r=e[1];return e=e[2],s&&(n.morphAttributes.position=t),o&&(n.morphAttributes.normal=r),l&&(n.morphAttributes.color=e),n.morphTargetsRelative=!0,n}))}))}var Me=r(1794),Te=r(6272);class _e{constructor(e,t){this.runScene=e,this.helper=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof w?(this.helper.isImageBitmapLoader=!0,e.setOptions({reverseTexture:this.helper.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})):this.helper.isImageBitmapLoader=!1}}class Ee{constructor(e,t){this.pending=[],this.models=[],this.module=new Me.Z,this.isImageBitmapLoader=!0,this.runScene=e,this.loadConfig=t,this.options=new _e(e,this),this.callback("mountModule",null)}beforeLoader(e){this.callback("getJSON",e),this.json=e;var t=this.processBase64(e);return"editor"===this.runScene.optionsEx.options.mode?(this.callback("beforeParse",e),!0):(t&&this.callback("beforeParse",e),t)}complete(e,t){this.parseSavedMap(t),this.callback("complete",{models:e,json:t})}clean(){}parseSavedMap(e){var t;(e=null==(e=null==(e=null==e?void 0:e.asset)?void 0:e.ex)?void 0:e.savedMap)&&null!=(t=this.module.get("material"))&&t.parseSavedMap(e.materialIds)}loadTexture(e){this.callback("loadTexture",e)}processBase64(e){if(null==(t=e.asset)||!t.ex)return!0;var t=e.asset.ex.base64;return!t||!!(e=(0,Te.Ne)(t))&&(t=Number(e),!isNaN(t)&&(new Date).getTime()<t)}callback(e,t){var r,n;return this.loadConfig.triggerCb&&null!=(r=null==(n=this.runScene.cb.loaderer.gltf[e])?void 0:n.cb)&&r.call(n,t),null!=(n=null==(r=this.loadConfig.callBack)?void 0:r[e])&&n.call(r,t),this.runScene.exporter.gltf.module.loadCallback({type:e,json:this.json,data:t,config:this.loadConfig,core:this})}loadMaterial(e){this.callback("loadMaterial",e)}loadNode(e){if(1===(e=this.callback("loadNode",e)).length)return e[0]}}class De{constructor(e,t){this.options=e,this.runScene=t}static getGltfLoader(e){let t=this._gltf;if(!t){t=this._gltf=new U;const r=new h;r.setDecoderPath(e),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(r)}return t}parse(e){const{arrayBuffer:t,onDone:r,onError:n}=e;De.getGltfLoader(this.runScene.optionsEx.options.decodePath).parse(t,"",r,(e=>{console.log(e,"e"),n(e)}),this)}valid(e){return this.options.core.beforeLoader(e)}loadTexture(e){return this.options.core.loadTexture(e)}loadMaterial(e){return this.options.core.loadMaterial(e)}loadNode(e){return this.options.core.loadNode(e)}setTextureLoader(e){this.options.core.options.setTextureLoader(e)}loadScene(e){this.scene=e,this.options.models.push(e)}onBuildNodeHierarchy(e){const{nodeId:t,parentObject:r,node:n,idMap:a,children:i}=e;a&&a.set(t,n);try{if(void 0!==i&&(null==i?void 0:i.length)===r.children.length){let e=!0;i.forEach((t=>{a.get(t)||(e=!1)})),e&&(r.children=[...a.entries()].sort(((e,t)=>e[0]-t[0])).map((e=>{var[,e]=e;return e})),a.clear())}}catch(e){console.log(e,"e")}}}var Oe=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class Pe{constructor(e){this.dracoPath="./draco/",this._gltf=new U,this.runScene=e}init(){const e=new h;e.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(e)}load(e,t){return Oe(this,void 0,void 0,(function*(){var r=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var r,{total:e,loaded:n}=e;let a=n/e;1<(a=a<0?0:a)&&(a=1);var n=Number(a.toFixed(2));e=Math.floor(100*n),null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&r.call(n,e),this.runScene.optionsEx.log("下载场景进度:"+e,"detail"),null!=t&&t.triggerCb&&this.runScene.cb.loaderer.gltf.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.runScene.optionsEx.log("下载场景失败:",e)}));return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){const r=(0,S.deepMergeObject)({cleanJSON:!0,triggerCb:!1,reverseTexture:!1,callBack:{mountModule:void 0,getJSON:void 0,beforeParse:void 0,afterParse:void 0,lazyLoadedTexture:void 0,loaded:void 0,loadMaterial:void 0,loadNode:void 0,modelLoaded:void 0,progress:void 0,getArrayBuffer:void 0,complete:void 0,loadedGltf:void 0,loadTexture:void 0},module:{light:!0,model:!0,camera:!0,controls:!0,tags:!0,objects:!0,timeline:!0,sceneConfig:!0}},t||{}),n=new Ee(this.runScene,r);return n.callback("getArrayBuffer",e),new Promise((t=>{new De({rootModel:this.runScene.assetsEx.get().scene,models:[],core:n,runScene:this.runScene,loadConfig:r,mode:this.runScene.optionsEx.options.mode},this.runScene).parse({arrayBuffer:e,onDone:e=>Oe(this,void 0,void 0,(function*(){n.callback("loadedGltf",e);try{yield this.afterParse(e.parser.options.ex.options,e,r)}catch(e){this.runScene.cb.error.cb({tip:"加载glb出错",msg:e}),console.log(e,"e")}t(n.models)})),onError:e=>{console.log(e,"_a")}})}))}afterParse(e,t,r){var n;return Oe(this,void 0,void 0,(function*(){const a=e.core;yield Promise.all(a.pending),a.callback("afterParse",{options:e,json:t,loadConfig:r});var{cleanJSON:i,callBack:s}=r;if(!t.asset.ex){const{models:r,core:n}=e,a=this.runScene.sceneEx.cleanUnlessLevel(r[0]);a.traverse((e=>{e.material&&this.runScene.materialEx.afterLoader(e.material)})),n.models.push(a),0<t.animations.length&&(a.animations=[...t.animations])}this.runScene.optionsEx.log(t,"detail"),a.complete(e.models,t),null!=(n=null==s?void 0:s.getJSON)&&n.call(s,t),i&&this.disposeJSON(t),a.clean()}))}disposeJSON(e){}}var ke=r(3736),Ae=r(110);class Ce{constructor(e){this._objectLoader=new n.ObjectLoader,this.runScene=e,this._parser=new Le(e)}parse(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class Le{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,ke.M)(t,"type",Ae.Z.tools.type),this.runScene.uniqueEx.material.add(e.material)}afterParse(e){return e instanceof Array?e.map((e=>{e.traverse((e=>{this.parseModel(e)}))})):e.traverse((e=>{this.parseModel(e)})),e}}class Re{constructor(e){this.imgBitMap=new n.ImageBitmapLoader,this.object=new n.ObjectLoader,this.runScene=e,this.gltf=new Pe(e),this.json=new Ce(e)}init(){this.gltf.init()}}const Ie=new class{constructor(){this.load=new n.AnimationLoader}parse(e){return this.load.parse(e)}}},4098:(e,t,r)=>{r.d(t,{Ws:()=>ge,ZP:()=>ve,ee:()=>be}),t=r(8990);var n,a,i=r(1863),s=r(135),o=r(4707),l=r(6001),c=r(8881),u=r(6651),d=r(3735),h=r(3736);class p{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;p.TextureNames.includes((0,l.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,l.lastArrayEle)(t),newVal:r}):this.runScene.undoEx.addUndo(new d.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}(n=p).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],p.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"],p.tools={type:"FakeInterior",textureNames:n.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new d.Z({target:t,typeList:["uniforms",r,"value"],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e.uniforms[t].value},getTextures:e=>{const t=[];return e.uniforms.ceilingTex.value&&t.push({type:"ceilingTex",texture:e.uniforms.ceilingTex.value}),e.uniforms.floorTex.value&&t.push({type:"floorTex",texture:e.uniforms.floorTex.value}),e.uniforms.sideWallTex.value&&t.push({type:"sideWallTex",texture:e.uniforms.sideWallTex.value}),e.uniforms.backWallTex.value&&t.push({type:"backWallTex",texture:e.uniforms.backWallTex.value}),t},create:(e,t)=>{var r=new c.ShaderMaterial({uniforms:(0,u.d9)(m.uniforms),vertexShader:m.vertexShader,fragmentShader:m.fragmentShader});return n.tools.bind(r),r},parseData:(e,t)=>{const{texture:r,normal:a,material:i}=e,{data:s,load:o}=r,l=new c.ShaderMaterial({uniforms:(0,u.d9)(m.uniforms),vertexShader:m.vertexShader,fragmentShader:m.fragmentShader}),d=[];return o&&d.push(...s.map((e=>()=>{t.materialEx.setTexture({material:l,type:e.type,newVal:e.texture})}))),Object.keys(a.uniforms).filter((e=>!p.TextureNames.includes(e))).map((e=>{var t=a.uniforms[e];l.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new c.Vector4(t.x,t.y,t.z,t.w):t})),l.name=a.name,l.userData.id=i.userData.id,n.tools.bind(l),{material:l,setTextureFns:d}},toNormal:e=>{const t=(0,s.createDefMaterial)(),r=(t.userData=Object.assign({},t.userData),{}),a=e.uniforms,i=m.uniforms;return Object.keys(a).filter((e=>!p.TextureNames.includes(e))).map((e=>{var t,n,s,o,l,u,d=a[e].value,h=i[e].value;d instanceof c.Vector4?(({x:t,y:n,z:s}=d),({x:o,y:l,z:u}=h),t===o&&n===l&&s===u||(r[e]=d)):d!==h&&(r[e]=d)})),{material:t,normal:{type:n.tools.type,uniforms:r,name:e.name},textures:n.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=n.tools.create(t);return Object.keys(r).filter((e=>!p.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",n.tools.type)},validType:e=>"FakeInterior"===e.userData.type};const m={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new c.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 c.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new c.Vector4(4.7,2,-11,-3)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "};class f{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;f.TextureNames.includes((0,l.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,l.lastArrayEle)(t),newVal:r}).then():this.runScene.undoEx.addUndo(new d.Z({target:e,typeList:[...t],newVal:r}).execute())}}(a=f).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],f.TextureNames=["envMap","displacementMap"],f.tools={type:"Fresnel",textureNames:a.TextureNames.map((e=>"envMap"===e?{type:e,isEnv:!0}:{type:e})),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new d.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),e.displacementMap&&t.push({type:"displacementMap",texture:e.displacementMap}),t},create:(e,t)=>{const r=new g(void 0,void 0,e);return r.insertFresnelShader(),a.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),r},parseData:(e,t)=>{const{texture:r,normal:n,material:i}=e,{data:o,load:l}=r,c=(0,s.mergeMaterial)(i,new g(void 0,void 0,t)),u=[];return l&&u.push(...o.map((e=>()=>{t.materialEx.setTexture({material:c,type:e.type,newVal:e.texture},!1)}))),Object.keys(n.uniforms).filter((e=>!f.TextureNames.includes(e))).map((e=>{c[e]=n.uniforms[e]})),c.insertFresnelShader(),c.name=n.name,c.userData.id=i.userData.id,a.tools.bind(c),{material:c,setTextureFns:u}},toNormal:e=>{const t=(0,s.mergeMaterial)(e,(0,s.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=v.uniforms;return Object.keys(n).filter((e=>!f.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),{material:t,normal:{type:a.tools.type,uniforms:r,name:e.name},textures:a.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=a.tools.create(t);return Object.keys(r).filter((e=>!f.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",a.tools.type)},validType:e=>"Fresnel"===e.userData.type};class g extends c.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new c.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,this.isSpecialMaterial=!0,t?(this.fresnelBias=new c.Uniform(t.fresnelBias),this.fresnelScale=new c.Uniform(t.fresnelScale),this.fresnelPower=new c.Uniform(t.fresnelPower)):(this.fresnelBias=new c.Uniform(v.uniforms.fresnelBias.value),this.fresnelScale=new c.Uniform(v.uniforms.fresnelScale.value),this.fresnelPower=new c.Uniform(v.uniforms.fresnelPower.value)),this.clock=new c.Clock,this.isSurge=new c.Uniform(!1),this.deltaTime=new c.Uniform(0),!this.cubeCamera){const e=new c.WebGLCubeRenderTarget(2048);e.texture.mapping=c.CubeRefractionMapping,this.cubeCamera=new c.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,v.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,v.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,v.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,v.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,v.fragmentShaderEmissive)}}update(){this.clock&&(this.deltaTime.value+=3*this.clock.getDelta()),this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const v={uniforms:{depthTest:new c.Uniform(!0),depthWrite:new c.Uniform(!0),isSurge:new c.Uniform(!1),deltaTime:new c.Uniform(0),fresnelBias:new c.Uniform(0),fresnelScale:new c.Uniform(1),fresnelPower:new c.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "};var b,y,x=r(3263),w=r(1398);const S={color:o.Gf.color,opacity:o.Gf.opacity};class M{constructor(e){this.runScene=e}}(b=M).tools={type:"LineBasicMaterial",bind(e){(0,h.M)(e,"type","LineBasicMaterial")},create:()=>{var e=new c.LineBasicMaterial;return b.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:i,load:s}=t,o=[];return s&&o.push(...x.F6.filter(i.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.materialEx.setTexture({material:a,type:t,newVal:r},!1)}})))),n.runScene.materialEx.parseNromals(r,a),b.tools.bind(a),{material:a,setTextureFns:o}},toNormal:e=>({material:e.clone(),normal:{type:b.tools.type},textures:[]}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:()=>[],snapshot:{getDiff:e=>w.LV.getDiff(S,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;w.LV.set({def:S,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,s.updateMaterial)(r)}))}},validType:e=>e.type===b.tools.type,setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new d.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},textureNames:[]};class T{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;T.TextureNames.includes((0,l.lastArrayEle)(r))?this.runScene.materialEx.setTexture({material:t,type:(0,l.lastArrayEle)(r),newVal:n}).then():this.runScene.undoEx.addUndo(new d.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(y=T).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],T.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"],T.tools={type:"Matcap",textureNames:y.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new d.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return T.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new c.MeshMatcapMaterial;return y.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="Matcap-"+t.name),r},parseData:(e,t)=>{const{normal:r,texture:n,material:a}=e,{data:i,load:o}=n,l=(0,s.mergeMaterial)(a,new c.MeshMatcapMaterial),u=(delete l.emissive,[]);return o&&u.push(...i.map((e=>()=>{t.materialEx.setTexture({material:l,type:e.type,newVal:e.texture},!1)}))),Object.keys(r.uniforms).filter((e=>!T.IgnoredAttributes.includes(e))).map((e=>{l[e]="normalScale"===e?new c.Vector2(r.uniforms[e].x,r.uniforms[e].y):r.uniforms[e]})),l.name=r.name,l.userData.id=a.userData.id,y.tools.bind(l),{material:l,setTextureFns:u}},toNormal:e=>{var t=y.tools.getTextures(e);const r=(0,s.mergeMaterial)(e,(0,s.createDefMaterial)()),n=(r.userData=Object.assign({},r.userData),r.name=e.name,{}),a=new c.MeshMatcapMaterial;return Object.keys(e).filter((e=>!T.TextureNames.includes(e))).filter((e=>!T.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],i=a[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?r!==i&&(n[t]=r):"normalScale"!==t||r.x===i.x&&r.y===i.y||(n[t]=r)})),{material:r,normal:{type:y.tools.type,uniforms:n,name:e.name},textures:t}},clone:(e,t)=>e,copy:(e,t)=>{const r=y.tools.create(t);return Object.keys(r).filter((e=>!T.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",y.tools.type)},validType:e=>"Matcap"===e.userData.type};const _="\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 ",E="\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 ",D={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 c.Matrix3,new c.Matrix3,new c.Matrix3,new c.Matrix3,new c.Matrix3,new c.Matrix3]},maskUvTransArray:{value:[new c.Matrix3,new c.Matrix3,new c.Matrix3,new c.Matrix3,new c.Matrix3]},diffuse:{value:new c.Color(16777215)},uvTransform:{value:new c.Matrix3},shadowShade:{value:.6}},vertex:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n // vUv = (uvTransform * vec3(uv, 1.0)).xy;\n}\n ",fragment:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#define MAX_TEX 6\nuniform mat3 mapUvTransArray[MAX_TEX];\nuniform mat3 maskUvTransArray[MAX_TEX - 1];\nuniform sampler2D mapArray[MAX_TEX];\nuniform sampler2D maskArray[MAX_TEX - 1];\nuniform float shadowShade;\n\n// Insert Noise2D\nfloat sum(vec3 v) {return v.x + v.y + v.z;}\nvec3 textureNoTile(sampler2D tex, vec2 tUv, float offsetScale) {\n // cheap (cache friendly) lookup\n float k = noise2D(0.25 * tUv);\n\n float l = k * 8.0;\n float f = fract(l);\n float ia = floor(l);\n float ib = ia + 1.0;\n\n // can replace with any other hash\n vec2 offa = sin(vec2(3.0, 7.0) * ia);\n vec2 offb = sin(vec2(3.0, 7.0) * ib);\n\n vec2 duvdx = dFdx(tUv);\n vec2 duvdy = dFdy(tUv);\n vec3 cola = textureGrad(tex, tUv + offsetScale * offa, duvdx, duvdy).xyz;\n vec3 colb = textureGrad(tex, tUv + offsetScale * offb, duvdx, duvdy).xyz;\n\n return mix(cola, colb, smoothstep(0.2, 0.8, f - 0.1 * sum(cola-colb)));\n}\nvec4 texSampler(sampler2D tex, vec2 tUv, float offsetScale) {\n return vec4(textureNoTile(tex, tUv, offsetScale), 1.0);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n \n // Custom UV Start\n #if MAX_TEX > 0\n vec2 vCustomMapUv[MAX_TEX];\n for (int i = 0; i < MAX_TEX; i++) {\n vCustomMapUv[i] = (mapUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n #if MAX_TEX > 1\n vec2 vCustomMaskUv[MAX_TEX - 1];\n for (int i = 0; i < MAX_TEX - 1; i++) {\n vCustomMaskUv[i] = (maskUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n // Custom UV End\n \n // Custom Texture Start\n float offsetScale = 1.2;\n vec4 maskColor = vec4(1.0);\n vec4 textureColor = vec4(1.0);\n #if MAX_TEX > 0\n textureColor = texSampler(mapArray[0], vCustomMapUv[0], offsetScale);\n #endif\n #if MAX_TEX > 1\n maskColor = texture2D(maskArray[0], vCustomMaskUv[0]);\n textureColor = mix(textureColor, texSampler(mapArray[1], vCustomMapUv[1], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 2\n maskColor = texture2D(maskArray[1], vCustomMaskUv[1]);\n textureColor = mix(textureColor, texSampler(mapArray[2], vCustomMapUv[2], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 3\n maskColor = texture2D(maskArray[2], vCustomMaskUv[2]);\n textureColor = mix(textureColor, texSampler(mapArray[3], vCustomMapUv[3], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 4\n maskColor = texture2D(maskArray[3], vCustomMaskUv[3]);\n textureColor = mix(textureColor, texSampler(mapArray[4], vCustomMapUv[4], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 5\n maskColor = texture2D(maskArray[4], vCustomMaskUv[4]);\n textureColor = mix(textureColor, texSampler(mapArray[5], vCustomMapUv[5], offsetScale), maskColor.r);\n #endif\n diffuseColor *= textureColor;\n // Custom Texture End\n \n // ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n // reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n // vec3 outgoingLight = reflectedLight.indirectDiffuse;\n vec3 outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n \n // gl_FragColor = vec4(diffuse, opacity * (1.0 - getShadowMask()));\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n "};var O,P=r(2233),k=r(9430);const A={diffuse:{type:"color",label:["uniforms","diffuse","value"],val:{r:1,g:1,b:1},shortKey:"df"},shadowShade:{type:"number",label:["uniforms","shadowShade","value"],val:.6,shortKey:"ss"},terrainMap0:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[0])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[0]=r},shortKey:"p0"},terrainMap1:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[1])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[1]=r},shortKey:"p1"},terrainMap2:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[2])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[2]=r},shortKey:"p2"},terrainMap3:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[3])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[3]=r},shortKey:"p3"},terrainMap4:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[4])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[4]=r},shortKey:"p4"},terrainMap5:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[5])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[5]=r},shortKey:"p5"},terrainMap6:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[6])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[6]=r},shortKey:"p6"},terrainMap7:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[7])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[7]=r},shortKey:"p7"},terrainMask0:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[0])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[0]=r},shortKey:"k0"},terrainMask1:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[1])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[1]=r},shortKey:"k1"},terrainMask2:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[2])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[2]=r},shortKey:"k2"},terrainMask3:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[3])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[3]=r},shortKey:"k3"},terrainMask4:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[4])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[4]=r},shortKey:"k4"},terrainMask5:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[5])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[5]=r},shortKey:"k5"},terrainMask6:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[6])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[6]=r},shortKey:"k6"}};class C{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e,a=r[0],i=(0,l.lastArrayEle)(r),s=a+"-"+i;if(C.BaseTextureNames.includes(a)){const e=ve.getTexture({material:t,type:s});this.runScene.undoEx.addUndo(new k.Z({undo:()=>{t.uniforms[a].value[Number(i)]=e,this.runScene.cb.texture.setMaterial.cb({target:t,type:s,oldVal:n,val:e,targetType:"material"})},redo:()=>{t.uniforms[a].value[Number(i)]=n,this.runScene.cb.texture.setMaterial.cb({target:t,type:s,oldVal:e,val:n,targetType:"material"})}}).execute())}else this.runScene.undoEx.addUndo(new d.Z({target:t,typeList:["uniforms",...r],newVal:n}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=D.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=D.vertex,t.fragmentShader=D.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,_)})}mergeUniforms(e,t){if(e&&t)for(const r in e)t[r]=e[r]}onTexRepeatChange(e,t,r){e&&0<=t&&(r?(r=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)):(r=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)))}}(O=C).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],C.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"],C.BaseTextureNames=["maskArray","mapArray"],C.tools={type:"MixTexture",textureNames:O.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:r,texture:n}=e;var[e,a]=r.split("-");return e=new d.Z({target:t,typeList:["uniforms",e,"value",a+""],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){const{material:t,type:r}=e;var[e,n]=r.split("-");return t.uniforms[e].value[Number(n)]},getTextures:e=>{const t=[];return C.TextureNames.forEach((r=>{var n=parseInt(r.slice(-1));r.startsWith("terrainMap")?e.uniforms.mapArray.value[n]&&t.push({type:r,texture:e.uniforms.mapArray.value[n]}):r.startsWith("terrainMask")&&e.uniforms.maskArray.value[n]&&t.push({type:r,texture:e.uniforms.maskArray.value[n]})})),t},create:(e,t)=>{const r=new c.ShadowMaterial({color:0,opacity:1});return r.uniforms=c.UniformsUtils.clone(D.uniforms),e.materialEx.def.map.MixTexture.insertShader(r),O.tools.bind(r),r},parseData:(e,t)=>{const{texture:r,normal:n,material:a}=e,{data:i,load:s}=r,o=new c.ShadowMaterial({color:0,opacity:1}),l=(o.uniforms=c.UniformsUtils.clone(D.uniforms),t.materialEx.def.map.MixTexture.insertShader(o),[]);return s&&l.push(...i.map((e=>()=>{var r=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(o.uniforms.mapArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(o,r,!0),t.cb.texture.setMaterial.cb({target:o,type:"mapArray-"+r,oldVal:null,val:e.texture,targetType:"material"})):e.type.startsWith("terrainMask")&&(o.uniforms.maskArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(o,r,!1),t.cb.texture.setMaterial.cb({target:o,type:"maskArray-"+r,oldVal:null,val:e.texture,targetType:"material"}))}))),Object.keys(n.uniforms).filter((e=>!C.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];"diffuse"===e?o.uniforms[e].value=new c.Color(parseInt(t,16)):"uvTransform"!==e&&(o.uniforms[e].value=t)})),o.name=n.name,o.userData.id=a.userData.id,O.tools.bind(o),{material:o,setTextureFns:l}},toNormal:e=>{const t=(0,s.createDefMaterial)(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:O.tools.type,uniforms:{},name:e.name},textures:O.tools.getTextures(e)}),{}),n=e.uniforms,a=D.uniforms;return Object.keys(n).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=n[e].value,i=a[e].value;"diffuse"===e?t.getHexString()!==i.getHexString()&&(r[e]=t.getHexString()):"uvTransform"!==e&&t!==i&&(r[e]=t)})),{material:t,normal:{type:O.tools.type,uniforms:r,name:e.name},textures:O.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=O.tools.create(t);return Object.keys(r).filter((e=>!C.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",O.tools.type)},validType:e=>"MixTexture"===e.userData.type,snapshot:{getDiff:e=>w.LV.getDiff(A,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;w.LV.set({def:A,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,s.updateMaterial)(r)}))}}};var L,R=r(4156),I=r(9457);class B{constructor(e){this.runScene=e}}(L=B).tools={type:"MyPointsMaterial",bind(e){(0,h.M)(e,"type","MyPointsMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:(e,t)=>(t=t.modelEx.def.vertices.rain.createMaterial(e),L.tools.bind(t),t),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new d.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,o=[];var{name:e,size:n}=n;const l=B.tools.create({size:n},t);return(0,P.x)(l,(0,P.Ki)(r)),l.fog=r.fog,e&&(l.name=e),i&&o.push(...a.map((e=>{const{type:r,texture:n}=e;return()=>{t.materialEx.setTexture({material:l,type:r,newVal:n},!1),(0,s.updateMaterial)(l)}}))),{material:l,setTextureFns:o}},toNormal:e=>{const t=(0,s.createDefMaterial)();var r={type:B.tools.type,name:e.name,size:e.size};return t.map=e.map,t.userData=Object.assign({},t.userData),{normal:r,textures:B.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=B.tools.type,t},textureNames:[]};var U,j=r(110),N=r(6272),z=r(8089),F=r(6292);const V="\n#ifdef USE_UV\n #ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n #else\n varying vec2 vUv;\n varying vec2 vUvC;\n #endif\n uniform mat3 uvTransform;\n#endif\n ",G="\n#ifdef USE_UV\n vUv = (uvTransform * vec3(uv, 1)).xy;\n vUvC = uv;\n#endif\n ",H="\n#if (defined(USE_UV) && !defined(UVS_VERTEX_ONLY))\n varying vec2 vUv;\n varying vec2 vUvC;\n#endif\n ",Z="\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughUvTrans;\n uniform sampler2D roughnessMap;\n#endif\n ",W="\n#ifdef USE_METALNESSMAP\n uniform mat3 metalUvTrans;\n uniform sampler2D metalnessMap;\n#endif\n ",K="\nfloat roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D(roughnessMap, (roughUvTrans * vec3(vUvC, 1.0)).xy);\n roughnessFactor *= texelRoughness.g;\n#endif\n ",q="\nfloat metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D(metalnessMap, (metalUvTrans * vec3(vUvC, 1.0)).xy);\n metalnessFactor *= texelMetalness.b;\n#endif\n ",X="\n#ifdef USE_NORMALMAP\n uniform mat3 normalUvTrans;\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n uniform mat3 normalMatrix;\n#endif\n#if !defined(USE_TANGENT) && (defined(TANGENTSPACE_NORMALMAP) || defined(USE_CLEARCOAT_NORMALMAP))\n vec3 perturbNormal2Arb(vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n }\n#endif\n ",Y="\n#ifdef OBJECTSPACE_NORMALMAP\n normal = texture2D(normalMap, (normalUvTrans * vec3(vUvC, 1.0)).xy).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = -normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined(TANGENTSPACE_NORMALMAP)\n vec3 mapN = texture2D(normalMap, (normalUvTrans * vec3(vUvC, 1.0)).xy).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n #ifdef USE_TANGENT\n normal = normalize( vTBN * mapN );\n #else\n normal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n #endif\n#elif defined(USE_BUMPMAP)\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif\n ";class Q{constructor(e){this.runScene=e,this.runScene.cb.texture.setInfo.add("Physical",(({type:t,texture:r})=>{"repeat"===t&&(t=e.uniqueEx.texture.getMaterials((0,P.Ki)(r)))&&(0,l.mapObj)(t,(t=>{var n;(t=e.uniqueEx.material.get(t))&&ve.getTypeByMaterial(t)===Q.tools.type&&((null==(n=t.roughnessMap)?void 0:n.uuid)===r.uuid&&this.onTexRepeatChange(t,"roughUvTrans"),(null==(n=t.metalnessMap)?void 0:n.uuid)===r.uuid&&this.onTexRepeatChange(t,"metalUvTrans"),(null==(n=t.normalMap)?void 0:n.uuid)===r.uuid&&this.onTexRepeatChange(t,"normalUvTrans"))}))}))}undo(e){var{material:e,list:t,val:r}=e;Q.TextureNames.includes((0,l.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,l.lastArrayEle)(t),newVal:r}).then():this.runScene.undoEx.addUndo(new d.Z({target:e,typeList:[...t],newVal:r}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.uniforms.roughUvTrans=e.roughUvTrans,t.uniforms.metalUvTrans=e.metalUvTrans,t.uniforms.normalUvTrans=e.normalUvTrans,t.vertexShader=t.vertexShader.replace(/#include <uv_pars_vertex>/g,V),t.vertexShader=t.vertexShader.replace(/#include <uv_vertex>/g,G),t.fragmentShader=t.fragmentShader.replace(/#include <uv_pars_fragment>/g,H),t.fragmentShader=t.fragmentShader.replace(/#include <roughnessmap_pars_fragment>/g,Z),t.fragmentShader=t.fragmentShader.replace(/#include <roughnessmap_fragment>/g,K),t.fragmentShader=t.fragmentShader.replace(/#include <metalnessmap_pars_fragment>/g,W),t.fragmentShader=t.fragmentShader.replace(/#include <metalnessmap_fragment>/g,q),t.fragmentShader=t.fragmentShader.replace(/#include <normalmap_pars_fragment>/g,X),t.fragmentShader=t.fragmentShader.replace(/#include <normal_fragment_maps>/g,Y)})}onTexRepeatChange(e,t){e&&(e.roughnessMap&&"roughUvTrans"===t?(e.roughUvTrans.value.identity(),e.roughUvTrans.value.scale(e.roughnessMap.repeat.x,e.roughnessMap.repeat.y)):e.metalnessMap&&"metalUvTrans"===t?(e.metalUvTrans.value.identity(),e.metalUvTrans.value.scale(e.metalnessMap.repeat.x,e.metalnessMap.repeat.y)):e.normalMap&&"normalUvTrans"===t&&(e.normalUvTrans.value.identity(),e.normalUvTrans.value.scale(e.normalMap.repeat.x,e.normalMap.repeat.y)))}}(U=Q).IgnoredAttributes=["_listeners","version","userData","color","emissive","uuid","name","type","defines","onBeforeCompile"],Q.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap","iridescenceMap","iridescenceThicknessMap"],Q.tools={type:"Physical",textureNames:U.TextureNames.map((e=>"envMap"===e?{type:e,isEnv:!0}:{type:e})),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new d.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return Q.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new F.Z.MeshPhysicalMaterial;return r.roughUvTrans=new F.Z.Uniform(new F.Z.Matrix3),r.metalUvTrans=new F.Z.Uniform(new F.Z.Matrix3),r.normalUvTrans=new F.Z.Uniform(new F.Z.Matrix3),e.materialEx.def.map.Physical.insertShader(r),U.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="Physical-"+t.name),r},parseData:(e,t)=>{const{normal:r,texture:n,material:a}=e,{data:i,load:o}=n,l=(0,s.mergeMaterial)(a,new F.Z.MeshPhysicalMaterial),c=[];return o&&c.push(...i.map((e=>()=>{t.materialEx.setTexture({material:l,type:e.type,newVal:e.texture},!1).then()}))),Object.keys(r.uniforms).filter((e=>!Q.IgnoredAttributes.includes(e))).map((e=>{var t=r.uniforms[e];"attenuationColor"===e||"sheenColor"===e||"specularColor"===e?l[e]=(0,z.ZD)(t):"clearcoatNormalScale"===e?l[e]=new F.Z.Vector2(t.x,t.y):"normalScale"===e?l[e].set(t,t):l[e]="roughUvTrans"===e||"metalUvTrans"===e||"normalUvTrans"===e?new F.Z.Uniform((new F.Z.Matrix3).fromArray(t.value.elements)):t})),l.name=r.name,l.userData.id=a.userData.id,l.roughUvTrans||(l.roughUvTrans=new F.Z.Uniform(new F.Z.Matrix3)),l.metalUvTrans||(l.metalUvTrans=new F.Z.Uniform(new F.Z.Matrix3)),l.normalUvTrans||(l.normalUvTrans=new F.Z.Uniform(new F.Z.Matrix3)),t.materialEx.def.map.Physical.insertShader(l),U.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,s.mergeMaterial)(e,(0,s.createDefMaterial)()),r=(t.name=e.name,{}),n=new F.Z.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!Q.TextureNames.includes(e))).filter((e=>!Q.IgnoredAttributes.includes(e))).map((t=>{let a=e[t];const i=n[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?a.getHexString()!==i.getHexString()&&(r[t]=a.getHexString()):"clearcoatNormalScale"===t?a.x===i.x&&a.y===i.y||(r[t]=a):"normalScale"===t?a.x===i.x&&a.y===i.y||(r[t]=a.x):(0,N.Xq)(i,a)&&(r[t]=a)})),{material:t,normal:{type:U.tools.type,uniforms:r,name:e.name},textures:U.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=U.tools.create(t);return Object.keys(r).filter((e=>!Q.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r.color.copy(e.color),r.emissive.copy(e.emissive),r},bind:e=>{(0,h.M)(e,"type",U.tools.type)},validType:e=>"MeshPhysicalMaterial"===e.type};var J=r(5180);const $={uniforms:{tDiffuse:new c.Uniform(null),h:new c.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}"},ee={uniforms:{tDiffuse:new c.Uniform(null),v:new c.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 te;new c.Uniform(null),new c.Uniform(null),new c.Uniform(0),new c.Uniform(0),new c.Uniform(0),new c.Uniform(new c.Vector2),new c.Uniform(.1),new c.Uniform(1e3);class re{constructor(e){this.materials={},this.render=()=>{(0,l.mapObj)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.runScene=e,this.init(),this.runScene.cb.material.dispose.add("Reflector",this.dispose.bind(this))}init(){this.runScene.cb.render.add("Reflector-render",this.render),this.runScene.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){const t=e.material;var r=(0,l.getId)();t.userData.id=r,this.materials[r]=e}undo(e){var{material:e,list:t,val:r}=e;re.TextureNames.includes((0,l.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,l.lastArrayEle)(t),newVal:r}).then():this.runScene.undoEx.addUndo(new d.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}(te=re).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],re.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"],re.tools={type:"Reflector",textureNames:te.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new d.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>(0,s.getTexturesByMaterial)(e),create:(e,t)=>{const r=new ne(void 0,void 0,e);return r.insertReflectorShader(),te.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),e.materialEx.def.map.Reflector.bindData({model:t,material:r}),r},parseData:(e,t)=>{const{texture:r,normal:n,models:a,material:i}=e,{data:o,load:l}=r,u=(0,s.mergeMaterial)(i,new ne(void 0,void 0,t)),d=[];return l&&d.push(...o.map((e=>()=>{t.materialEx.setTexture({material:u,type:e.type,newVal:e.texture},!1)}))),Object.keys(n.uniforms).filter((e=>!re.TextureNames.includes(e))).map((e=>{u[e]="normalScale"===e?new c.Vector2(n.uniforms[e].x,n.uniforms[e].y):n.uniforms[e]})),u.setRTSize(u.resolution),u.setBlurPass(u.blurSize),u.insertReflectorShader(),t.materialEx.def.map.Reflector.bindData({model:a[0],material:u}),u.name=n.name,u.userData.id=i.userData.id,te.tools.bind(u),{material:u,setTextureFns:d}},toNormal:e=>{const t=(0,s.mergeMaterial)(e,(0,s.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=ae.uniforms;return Object.keys(n).filter((e=>!re.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),t.normalScale&&(r.normalScale=t.normalScale),{material:t,normal:{type:te.tools.type,uniforms:r,name:e.name},textures:te.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=te.tools.create(t);return Object.keys(r).filter((e=>!re.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",te.tools.type)},validType:e=>"Reflector"===e.userData.type};class ne extends c.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=ae.uniforms.opacity.value,this.transparent=ae.uniforms.transparent.value,this.roughness=ae.uniforms.roughness.value,this.metalness=ae.uniforms.metalness.value),this.runScene=r,this.isSpecialMaterial=!0,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new c.Uniform(t.mirror),this.mixBlur=new c.Uniform(t.mixBlur),this.mixStrength=new c.Uniform(t.mixStrength),this.mixContrast=new c.Uniform(t.mixContrast)):(this.resolution=ae.uniforms.resolution.value,this.blurSize=ae.uniforms.blurSize.value,this.mirror=new c.Uniform(ae.uniforms.mirror.value),this.mixBlur=new c.Uniform(ae.uniforms.mixBlur.value),this.mixStrength=new c.Uniform(ae.uniforms.mixStrength.value),this.mixContrast=new c.Uniform(ae.uniforms.mixContrast.value)),this.textureMatrix=new c.Uniform(new c.Matrix4),this.reflectorWorldPosition=new c.Vector3,this.cameraWorldPosition=new c.Vector3,this.rotationMatrix=new c.Matrix4,this.normal=new c.Vector3,this.view=new c.Vector3,this.lookAtPosition=new c.Vector3,this.target=new c.Vector3,this.tempQuaternion=new c.Vector4,this.virtualCamera=new c.PerspectiveCamera,this.reflectorPlane=new c.Plane,this.clipPlane=new c.Vector4,e={minFilter:c.LinearFilter,magFilter:c.LinearFilter,type:c.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new c.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new c.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new c.Uniform(this.glRT1.texture),this.tDiffuseBlur=new c.Uniform(this.glRT2.texture),this.hBlurPass=new J.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 J.T(ee),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=ae.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",ae.vertexShader),e.fragmentShader=ae.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",ae.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 ae={uniforms:{opacity:new c.Uniform(1),transparent:new c.Uniform(!1),roughness:new c.Uniform(1),metalness:new c.Uniform(.6),resolution:new c.Uniform(1024),blurSize:new c.Uniform(1024),mirror:new c.Uniform(0),mixBlur:new c.Uniform(10),mixStrength:new c.Uniform(2),mixContrast:new c.Uniform(1),depthTest:new c.Uniform(!0),depthWrite:new c.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "};var ie,se,oe=r(9667);const le={opacity:{type:"number",label:["uniforms","opacity","value"],val:1,shortKey:"op"},tFlip:{type:"number",label:["uniforms","tFlip","value"],val:-1,shortKey:"tf"},tCube:{type:"texture",val:null,get:e=>(e=e.uniforms.tCube.value)?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.tCube.value=r},shortKey:"tc"}};class ce{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;ce.TextureNames.includes(t[1])?this.runScene.materialEx.setTexture({material:e,type:t[1],newVal:r}).then():this.runScene.undoEx.addUndo(new d.Z({target:e,typeList:[...t],newVal:r}).execute())}}(ie=ce).TextureNames=["tCube"],ce.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],ce.tools={type:"SkyBox",textureNames:ie.TextureNames.map((e=>"tCube"===e?{type:e,isCube:!0}:{type:e})),setTexture:e=>{const{material:t,type:r,texture:n}=e;if(n&&!(0,oe.isCubeTexture)(n))throw TypeError("SkyBox材质仅可使用立方体纹理");return e=new d.Z({target:t,typeList:["uniforms",r,"value"],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:e=>{var{material:e,type:t}=e;return e.uniforms[t].value},getTextures:e=>{const t=[];return ce.TextureNames.forEach((r=>{var n;e[r]?t.push({type:r,texture:e[r]}):null!=(n=e.uniforms[r])&&n.value&&t.push({type:r,texture:e.uniforms[r].value})})),t},create:(e,t)=>{var r=F.Z.ShaderLib.cube;const n=new F.Z.ShaderMaterial({uniforms:(0,u.d9)(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,depthWrite:!1,side:F.Z.BackSide});return n.name="SkyBoxMaterial",ie.tools.bind(n),n},parseData:(e,t)=>{const{texture:r,normal:n,material:a}=e,{data:i,load:s}=r;e=F.Z.ShaderLib.cube;const o=new F.Z.ShaderMaterial({uniforms:(0,u.d9)(e.uniforms),vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,depthWrite:!1,side:F.Z.BackSide}),l=(o.name="SkyBoxMaterial",[]);return s&&l.push(...i.map((e=>()=>{o.uniforms[e.type].value=e.texture,t.materialEx.setTexture({material:o,type:e.type,newVal:e.texture},!1).then()}))),Object.keys(n.uniforms).filter((e=>!ce.TextureNames.includes(e))).map((e=>{o.uniforms[e].value=n.uniforms[e]})),o.name=n.name,o.userData.id=a.userData.id,ie.tools.bind(o),{material:o,setTextureFns:l}},toNormal:e=>{const t=(0,s.createDefMaterial)(),r=(t.name=e.name,{}),n=e.uniforms;var a=F.Z.ShaderLib.cube;const i=new F.Z.ShaderMaterial({uniforms:(0,u.d9)(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,depthWrite:!1,side:F.Z.BackSide});return Object.keys(n).filter((e=>!ce.TextureNames.includes(e))).map((e=>{var t=n[e].value,a=i.uniforms[e].value;(0,N.Xq)(a,t)&&(r[e]=t)})),{material:t,normal:{type:ie.tools.type,uniforms:r,name:e.name},textures:ie.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=ie.tools.create(t);return Object.keys(r).filter((e=>!ce.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",ie.tools.type)},validType:e=>"SkyBox"===e.userData.type,snapshot:{getDiff:e=>w.LV.getDiff(le,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;w.LV.set({def:le,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,s.updateMaterial)(r)}))}}};const ue="\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 ",de="\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 ",he={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 pe{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;pe.TextureNames.includes((0,l.lastArrayEle)(r))?this.runScene.materialEx.setTexture({material:t,type:(0,l.lastArrayEle)(r),newVal:n}).then():this.runScene.undoEx.addUndo(new d.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(se=pe).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],pe.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],pe.tools={type:"TreeLeaf",textureNames:se.TextureNames.map((e=>"envMap"===e?{type:e,isEnv:!0}:{type:e})),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new d.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return pe.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new fe(e);return se.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name,r.setSize(t),r.setWorldPos(t)),r},parseData:(e,t)=>{const{normal:r,texture:n,material:a,models:i}=e,{data:o,load:l}=n,u=(0,s.mergeMaterial)(a,new fe(t)),d=(u.setSize(i[0]),u.setWorldPos(i[0]),[]);return l&&d.push(...o.map((e=>()=>{t.materialEx.setTexture({material:u,type:e.type,newVal:e.texture},!1)}))),Object.keys(r.uniforms).filter((e=>!pe.IgnoredAttributes.includes(e))).map((e=>{var t=r.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?u[e]=new c.Vector2(t.x,t.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?u.uniforms[e]=new c.Uniform(t):"colorGradient"===e?u.uniforms[e]=new c.Uniform(new c.Color(parseInt(t,16))):u[e]=r.uniforms[e])})),u.name=r.name,u.userData.id=a.userData.id,se.tools.bind(u),{material:u,setTextureFns:d}},toNormal:(e,t)=>{var r=se.tools.getTextures(e);const n=(0,s.mergeMaterial)(e,(0,s.createDefMaterial)()),a=(n.name=e.name,{}),i=new fe(t);return Object.keys(e).filter((e=>!pe.TextureNames.includes(e))).filter((e=>!pe.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],n=i[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?r.x===n.x&&r.y===n.y||(a[t]=r):"uniforms"===t?Object.keys(r).map((t=>{const r=e.uniforms[t].value,n=i.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?r!==n&&(a[t]=r):"colorGradient"===t&&r.getHexString()!==n.getHexString()&&(a[t]=r.getHexString())})):r!==n&&(a[t]=r))})),{material:n,normal:{type:se.tools.type,uniforms:a,name:e.name},textures:r}},clone:(e,t)=>e,copy:(e,t)=>{const r=se.tools.create(t);return Object.keys(r).filter((e=>!pe.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",se.tools.type)},validType:e=>"TreeLeaf"===e.userData.type,snapshot:{getDiff:e=>w.LV.getDiff(he,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;w.LV.set({def:he,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,s.updateMaterial)(r)}))}}};const me=new c.Clock;class fe extends c.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new c.Uniform(0),windForce:new c.Uniform(.3),windSpeed:new c.Uniform(.5),windWaveScale:new c.Uniform(.25),colorGradient:new c.Uniform(new c.Color(65280)),colorLevel:new c.Uniform(-.5),colorFade:new c.Uniform(-.25),leavesCore:new c.Uniform(.3),leavesSize:new c.Uniform(new c.Vector3),leavesPos:new c.Uniform(new c.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=ue,e.fragmentShader=de,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,E)}}update(){this.uniforms.time.value=me.getElapsedTime()}setSize(e){var t=new c.Vector3;e.getWorldScale(t),t=new c.Vector3,(new c.Box3).setFromObject(e).getSize(t),this.uniforms.leavesSize.value=t}setWorldPos(e){var t=new c.Vector3;e.getWorldPosition(t),this.uniforms.leavesPos.value=t}}const ge={SpriteMaterial:j.Z,FakeInterior:p,Fresnel:f,Matcap:T,MixTexture:C,Physical:Q,MeshLambertMaterial:R.Z,MyMeshPhongMaterial:I.Z,MeshPhongMaterial:I.Z,Reflector:re,TreeLeaf:pe,SkyBox:ce,BasicMaterial:o.ZP,LineBasicMaterial:M,MyPointsMaterial:B,Water:i.Z,MyMeshLambertMaterial:R.Z,[t.Z.tools.type]:t.Z};class ve{constructor(e){this.runScene=e,this.map={SpriteMaterial:new j.Z(e),FakeInterior:new p(e),Fresnel:new f(e),Matcap:new T(e),MixTexture:new C(e),Physical:new Q(e),Reflector:new re(e),TreeLeaf:new pe(e),SkyBox:new ce(e),BasicMaterial:new o.ZP(e)}}static create(e,t){return ge[e].tools.create(t)}static copy(e,t,r){return ge[e].tools.copy(t,r)}static clone(e,t){return ge[e].tools.clone(t)}static setTexture(e){var t=e.material;if(t=this.getTypeByMaterial(t))return ge[t].tools.setTexture(e)}static getTexture(e){var t=e.material;return(t=this.getTypeByMaterial(t))?ge[t].tools.getTexture(e):null}static toNromal(e,t,r){return ge[e].tools.toNormal(t,r)}static parseData(e,t,r){var n=t.material;let a=e;return ge.LineBasicMaterial.tools.validType(n)&&(a=ge.LineBasicMaterial.tools.type),(null==(e=ge[a])?void 0:e.tools.parseData(t,r))||{material:(0,s.createDefMaterial)(),setTextureFns:[]}}static bind(e){e.material&&("MeshStandardMaterial"===e.material.type?o.ZP.tools.bind(e):"SpriteMaterial"===e.material.type&&j.Z.tools.bind(e))}static _getTextures(e){var t=be(e);return t?ge[t].tools.getTextures(e):[]}static getTextures(e){let t=[];return(Array.isArray(e)?e:[e]).map((e=>{t.push(...this._getTextures(e))})),t}static parseNode(e){e.material&&(e=e.material,(0,s.isBaseMaterial)(e)&&o.ZP.tools.bind(e),e.isSpriteMaterial&&j.Z.tools.bind(e))}static validType(e,t){return!ge[e].tools.validType||ge[e].tools.validType(t)}static getTypeByMaterial(e){var t=e.userData.type;if(this.validType(t,e))return t}static getTextureNames(e){var t=e.userData.type;return this.validType(t,e)?ge[t].tools.textureNames:[]}}ve.snapshot={getDiff:e=>{var t=be(e);if(ge[t])return ge[t].tools.snapshot.getDiff(e);throw TypeError("该材质没有类型")},set:e=>{var t=e.material;if(t=be(t),ge[t])return ge[t].tools.snapshot.set(e);throw TypeError("该材质没有类型")}};const be=e=>{var t=e.userData.type;if(t)return ve.validType(t,e)?t:void 0}},135:(e,t,r)=>{r.r(t),r.d(t,{SpecialMaterial:()=>Z,baseIgnoreTypes:()=>P,canSetMaterial:()=>J,createDefMaterial:()=>C,defAllMaterialMap:()=>k,defBaseMaterialMap:()=>O,default:()=>A,disposeMaterial:()=>R,getBaseTextures:()=>U,getMaterialType:()=>W,getMaterials:()=>Y,getTextures:()=>B,getTexturesByMaterial:()=>I,initMaterial:()=>N,isBaseMaterial:()=>H,isColor:()=>z,isMaterial:()=>V,isMultiMaterial:()=>X,materialIgnore:()=>K,mergeMaterial:()=>L,mergeMaterialAll:()=>q,setDefMaterialForSameGeo:()=>G,setMaterialIds:()=>Q,setMaterialTexture:()=>j,updateMaterial:()=>F});var n=r(6001),a=r(8881),i=r(4330),s=r(1794),o=r(3736),l=r(9667);class c extends r(4616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:a,cb:i}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,this.cb=i}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,i.zX.includes(this.info)){if(!e)return;this.runScene.materialEx.setTexture({material:this.target,type:this.info,newVal:e},!1)}"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 u=c;var d=r(2510),h=r(2233),p=r(6272),m=r(4707),f=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class g{constructor(e){this.data=this.getData(),this.pending=[],this.clonedTextures=[],this.mount=e=>{e.core.module.set("material",this)},this.complete=()=>{this.reset()},this.load=e=>{e=e.data;let{materialDef:t,material:r,model:a}=e;N(r),t.id||(e=(0,n.getId)(),t.id=e,(0,h.x)(r,e)),this.data.materialIns[t.id]||(this.data.materialIns[t.id]={material:r,models:[]}),this.data.materialIns[t.id].models.push(a)},this.done=e=>f(this,void 0,void 0,(function*(){var{json:t,core:r}=e,{materialMap:n,textureMap:a}=(null==(n=t.asset)?void 0:n.ex)||{};yield this.processTextureMap(a||{}),this.processMaterialMap(n||{},t),this.processClonedTextures(),yield this.loadTextures(r)})),this.parser=null,this.loadTexture=e=>{var t=e.data;const{textureDef:r,texture:a}=t;(0,l.mergeDefUserData)(r,a.userData),r.id||(t=(0,n.getId)(),r.id=t,(0,h.x)(a,t),(0,l.bindTextureBaseData)(a,this.runScene)),e.core.isImageBitmapLoader||(a.userData.flipY=!0);let i=a;(t=(0,l.isClonedTexture)(a))?(i=a,this.clonedTextures.push(a)):i=this.runScene.textureEx.getSameTexture(r.md5,a)||a,this.data.textureIns[r.id]=i},this.processTextureMap=(()=>{const e=e=>{const{target:t,data:r}=e;var n;r&&(({x:e,y:n}="object"==typeof r?r:{x:r,y:r}),t.x=e,t.y=n)};return t=>Promise.all((0,n.mapObj)(t,((t,r)=>f(this,void 0,void 0,(function*(){var{format:a,center:i,rotation:s,offset:o,repeat:l,isHelper:c,encoding:u,flipY:d}=r;if(!c){let r=this.data.textureIns[t];if(r){if(r.userData.cubeMap){const e={};(0,n.mapObj)(r.userData.cubeMap,((t,r)=>{e[t]=this.data.textureIns[r].userData.blob}));var c=r.userData;(r=yield this.runScene.textureEx.praseCubeByBlobMap(e)).userData=Object.assign(Object.assign({},c),r.userData),void 0!==r.userData.lightProbeIntensity&&(c=this.runScene.textureEx.setLightProbeForCube(r,!0,r.userData.lightProbeIntensity),r.userData.lightProbe=c),r.userData.blob=e.px,this.data.textureIns[t]=r}r.encoding=u||3e3,r.format=a,e({target:r.repeat,data:l}),e({target:r.center,data:i}),e({target:r.offset,data:o}),s&&(r.rotation=s),void 0!==d&&(r.userData.flipY=1===d),this.runScene.textureEx.initTextureAndAddtoAll(r)}}})))))})(),this.processMaterialMap=(()=>{const e=e=>f(this,void 0,void 0,(function*(){const{textures:t,normal:r,models:a,material:i}=e;var s=(0,n.mapObj)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));const{material:o,setTextureFns:l}=this.runScene.materialEx.parseData(r.type,{normal:r,texture:{data:s,load:this.runScene.optionsEx.options.texture.load},core:this,models:a,material:i});o&&(this.data.materialIns[(0,h.Ki)(i)].material=o,0<l.length&&this.lazyLoadFns.push(...l),a.map((e=>e.material=o)))}));return(t,r)=>Promise.all((0,n.mapObj)(t,((t,a)=>f(this,void 0,void 0,(function*(){var i=this.data.materialIns[t];if(i){const{material:t,models:s}=i;if(t){const{normal:o,textures:l}=a;o.type||(o.type=m.ZP.tools.type),"scene"===(null==(i=null==(i=r.asset)?void 0:i.ex)?void 0:i.type)&&r.asset.ex.sceneEx.materialId===t.userData.id&&(0,n.mapObj)(l,((e,r)=>{r=this.data.textureIns[r],j({material:t,type:e,texture:r})})),yield e({textures:l,models:s,material:t,normal:o}),t.needsUpdate=!0}}})))))})(),this.lazyLoadFns=[],this.loadTextures=(()=>{const e=e=>{e.callback("lazyLoadedTexture",""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n,a)=>{const i=this.lazyLoadFns[r];if(!i)return n(0),e(a);i(),setTimeout((()=>t(++r,n,a)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return e=>new Promise((r=>{this.runScene.optionsEx.options.texture.lazyLoad.open?t(0,r,e):(this.lazyLoadFns.map((e=>e())),r(0))}))})(),this.afterParse=e=>{const{data:t,core:r,json:n}=e;if("material"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){e=t.options.models;const[n]=e,a=[];n.material?(this.runScene.materialEx.add(n.material),a.push(n.material)):n.children.map((e=>{e.material&&(a.push(e.material),this.runScene.materialEx.add(e.material))})),r.models.push(...a)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new s.Z({loadedGltf:e=>{e.core.pending.push(this.done(e))},loadMaterial:this.load,loadTexture:this.loadTexture,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}getById(e){return this.data.materialIns[e]}parseSavedMap(e){e.map((e=>{e=this.data.materialIns[e],this.runScene.materialEx.add(e.material)}))}processInput(e,t){return f(this,void 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,"editor"===this.runScene.optionsEx.options.mode&&(e.userData.blob=t.userData.blob,e.userData.md5=t.userData.md5,e.userData.url=t.userData.url,e.userData.gm=t.userData.gm,(0,l.bindTextureBaseData)(e,this.runScene))):(this.runScene.textureEx.delete(e),(0,o.bv)(e,"cloneSourceId"),(0,l.disposeTexture)(e))}))}reset(){this.clonedTextures=[],this.data=this.getData(),this.pending=[],this.lazyLoadFns=[]}}var v=r(4098),b=r(7201);class y{constructor(e){this.resetItem=e=>{"material"===e.type&&e.datas.map((t=>{const r=t.data;let n=r.get("material");n||(n={},r.set("material",n)),e.targets.map((e=>{var t=(0,v.ee)(e);t&&v.Ws[t].tools.snapshot&&(t=(0,h.Ki)(e))&&(n[t]=this.getItem(e))}))}))},this.getDiff=()=>{let e={};return this.runScene.uniqueEx.material.getAll("values").map((t=>{t=t.material;var r=(0,v.ee)(t);r&&v.Ws[r].tools.snapshot&&(r=(0,h.Ki)(t))&&(e[r]=this.getItem(t))})),e},this.create=e=>{var t=this.getDiff();0!==(0,b.objLength)(t)&&e.data.set("material",t)},this.set=e=>{var t=e.snapshot.data.get("material");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.material.get(t))&&v.ZP.snapshot.set({material:t,data:r,runScene:this.runScene,map:e})}))},this.runScene=e,this.runScene.cb.snapshot.create.add("material",this.create),e.cb.snapshot.delUseless.add("material",(t=>{(0,n.mapObj)(t,((t,r)=>{const a=r.data.material;a&&((0,n.mapObj)(a,(t=>{e.uniqueEx.material.isUsed(t)||delete a[t]})),0===(0,b.objLength)(a)&&delete r.data.material)}))})),this.runScene.cb.snapshot.set.add("material",this.set),this.runScene.cb.snapshot.getLength.add("material",(e=>{var t=e.data.data.get("material");t&&(e.inputData.material=Object.keys(t).length)})),this.runScene.cb.snapshot.resetItem.add("material",this.resetItem)}getItem(e){return v.ZP.snapshot.getDiff(e)}}t=r(110);var x=r(272),w=r(8089),S=r(8609),M=r(6292),T=r(9457),_=r(4156),E=r(3263),D=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const O={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},P=["_listeners","version","userData","uniforms","onBeforeCompile","uuid","name","type","defines"],k=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest","fog"];class A{constructor(e){this.materialX={},this.clean=()=>{this.dispose()},this.defMaterial=C(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.getScreen=e=>{this.previewScene||(this.previewScene=this.getPreviewScene());const{scene:t,camera:r,render:n,model:a}=this.previewScene;return t.environment=this.runScene.assetsEx.scene.environment,a.material=e,n.render(t,r),new Promise((e=>{n.domElement.toBlob((t=>{e(t)}),"image/webp",1)}))},this.runScene=e,this.def=new v.ZP(e),this.snaphot=new y(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 g(e)}init(){var e={name:"material",loadCallBacks:this.import.getMap(),exportCallBacks:new s.Z};this.runScene.exporter.gltf.module.bind(e)}parse(e){v.Ws.LineBasicMaterial.tools.validType(e)&&v.Ws.LineBasicMaterial.tools.bind(e),this.setEnvStrength(e,this.runScene.sceneEx.envStrength)}add(e,t,r){K.is(e)||this.runScene.uniqueEx.material.add(e,t,r)}setEnvStrength(e,t,r=!1){void 0===e.envMapIntensity||e.envMapIntensity===t||!r&&e.envMapIntensity!==this.runScene.sceneEx.envStrength||(e.envMapIntensity=t,F(e))}create(e="BasicMaterial"){return e=v.ZP.create(e,this.runScene),this.add(e),e}toArray(){return(0,n.mapObj)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t=W(e);if(t){const r=v.ZP.copy(t,e,this.runScene);return r.userData.id=(0,n.getId)(),r}}clone(e){var t=W(e);if(t){const r=v.ZP.clone(t,e);return r.userData.id=(0,n.getId)(),r}}setNormals(e,t=!0){const{info:r,newVal:n,materials:a,oldval:i,cb:s}=e;let o=n;return o.isVector2&&(o=o.clone()),e=a.map((e=>new u({info:r,target:e,newVal:o,oldVal:i||e[r],runScene:this.runScene,cb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new u(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return D(this,void 0,void 0,(function*(){const{info:r,newVal:n,materials:a,oldVal:i}=e;if(e.newVal=yield this.runScene.textureEx.parse(n),(0,l.isCubeTexture)(e.newVal)&&"envMap"!==r)throw this.runScene.optionsEx.log("立方体纹理只适用于环境","base","info"),TypeError("类型错误");"envMap"!==r||(0,l.isCubeTexture)(e.newVal)||(0,l.setTextureMapping)(e.newVal);var s=a.map((t=>new u({info:r,target:t,newVal:e.newVal,oldVal:i||t[r],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(s),a[0][r]}))}setTexture(e,t=!0){return D(this,void 0,void 0,(function*(){const{type:r,newVal:a,material:i,cb:s,isEnv:o,getUndo:c}=e;null!==a&&(e.newVal=yield this.runScene.textureEx.parse(a,{isEnv:o}),"envMap"!==r||e.newVal.isCubeTexture||(0,l.setTextureMapping)(e.newVal));var u=v.ZP.getTexture({material:i,type:r});const d=v.ZP.setTexture({material:i,type:r,texture:e.newVal});if(d)return d.cb=(e,t)=>{const{target:r,typeList:a,val:i,oldVal:o}=t;t=(0,n.lastArrayEle)(a),this.runScene.cb.texture.setMaterial.cb({target:r,type:t,oldVal:o,val:i,targetType:"material"}),null!=s&&s(),r.needsUpdate=!0},null!=s&&s(),this.runScene.cb.texture.setMaterial.cb({target:i,type:r,val:e.newVal,oldVal:u,targetType:"material"}),t&&this.runScene.undoEx.addUndo(d),c?d:e.newVal}))}_resetMaterial(e){const{mate:t,models:r,model:n}=e;(e=n.material)&&J(e,t)&&r.add(n)}resetMaterial(e,t,r){const n=this,{addUndo:a,includeChild:i}=r=(0,p.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;E.F6.toArr(e).map((e=>{i?e.traverse((e=>{this._resetMaterial({model:e,mate:t,models:r})})):e.material&&this._resetMaterial({model:e,mate:t,models:r})}));const s=[];if(r.forEach((e=>{const r=e.material;s.push(new d.Z({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:r,executeCb(a){var{type:a,val:i}=a;e.material=i,"undo"===a?n.runScene.uniqueEx.material.addModel(e,r,t):n.runScene.uniqueEx.material.addModel(e,t,r)}}).execute())})),this.runScene.modelEx.select===e&&this.runScene.cb.setSelectMaterial.cb(t),a)return this.runScene.undoEx.addUndo(s),s}}toNromal(e){var t=W(e);if(t){const r=v.ZP.toNromal(t,e,this.runScene);return r.material.userData=Object.assign(Object.assign({},r.material.userData),e.userData),r}}setSelect(e){let t;t=Array.isArray(e)?e[0]:e,this.select=t,this.runScene.cb.setSelectMaterial.cb(t)}parseData(e,t){return v.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(),C()),this.runScene.cb.material.remove.cb(e))}getDefNromals(e){var t;return"BasicMaterial"!==(null==(t=e.userData)?void 0:t.type)?{}:(0,p.ad)(O,e)}parseNromals(e,t){(0,n.mapObj)(e,((e,r)=>{var n,a,i,s,o;void 0!==O[e]&&("object"==typeof r?(({x:i,y:s,z:o}=r),null!=(a=null==(n=t[e])?void 0:n.set)&&a.call(n,i,s,o)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&"BasicMaterial"===e.userData.type&&!e.userData.isTimeLineUsed&&m.ZP.isDefVal(e)}setByType(e,t){"SpriteMaterial"===e&&!t.isSprite||(e=this.create(e))&&(this.add(e),this.runScene.modelEx.setMaterial(t,e))}getPreviewScene(e){const t=new a.Scene,r=new a.PerspectiveCamera(50,1,1,10),n=(r.position.z=2,new a.WebGLRenderer),i=new M.z(r,n.domElement),s=(t.background=new a.Color("#202020"),n.setSize(150,150),i.minDistance=2,i.maxDistance=5,i.enablePan=!1,(i.enableZoom=!1,S.getSphere)()),o=(e&&(s.material=e),s.scale.set(.8,.8,.8),t.add(s),t.add(new a.HemisphereLight(11184810,4473924)),new a.DirectionalLight(16777215,.5));return o.position.set(1,1,1),t.add(o),{scene:t,camera:r,render:n,controls:i,model:s}}setTextureByName(e){const{name:t,texture:r,material:a}=e;return!(!(e=v.ZP.getTextureNames(a).find((e=>(0,n.lastArrayEle)((0,p.dx)(t).split("_"))===e.type)))||e.isCube&&!(0,l.isCubeTexture)(r)||(this.setTexture({material:a,type:e.type,newVal:r,isEnv:e.isEnv}),0))}get(e){return Array.isArray(e)?e[0]:e}afterLoader(e){"MeshPhongMaterial"===e.type?T.Z.afterload(e,this.runScene):"MeshStandardMaterial"===e.type?m.ZP.afterload(e,this.runScene):"MeshLambertMaterial"===e.type&&_.Z.afterload(e,this.runScene)}}const C=e=>{const t=new a.MeshStandardMaterial(e);return t.userData.id=(0,n.getId)(),m.ZP.tools.bind(t),t},L=(e,t)=>(k.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),R=e=>{e.dispose();const t=I(e);0!==t.length&&t.map((e=>{e=e.texture,(0,l.disposeTexture)(e)}))},I=e=>U(e),B=e=>v.ZP.getTextures(e)||U(e),U=e=>i.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),j=e=>{const{material:t,type:r,texture:n}=e;"envMap"!==r||(0,l.isCubeTexture)(n)||(0,l.setTextureMapping)(n),t[r]=n,t.needsUpdate=!0},N=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},z=e=>null==e?void 0:e.isColor,F=e=>{e.needsUpdate=!0},V=e=>null==e?void 0:e.isMaterial,G=e=>{},H=e=>(null==e?void 0:e.isMeshStandardMaterial)&&!e.isSpecialMaterial,Z={Sprite:t.Z},W=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.type)||"BasicMaterial",K={set(e,t){t?(0,o.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,o.is)(e,"ignore")},q=(e,t,r)=>{Object.keys(e).map((n=>{const a=new x.Z(P);r&&a.add(r);var i=e[n],s=t[n];!a.has(n)&&void 0!==s&&(0,w.ZE)(i,s)&&(0,w.Y6)({type:n,target:t,val:i})}))},X=e=>Array.isArray(e),Y=e=>Array.isArray(e)?e:[e],Q=(e,t)=>{e.userData.mateIds=t,e.userData.multiMaterial={groups:[...e.geometry.groups],mateIds:t}},J=(e,t)=>(e=v.ZP.getTypeByMaterial(e),t=v.ZP.getTypeByMaterial(t),!(!e||!t)&&("SpriteMaterial"==e?"SpriteMaterial"===t:"SpriteMaterial"!=t&&("LineBasicMaterial"==e?"LineBasicMaterial"===t:"LineBasicMaterial"!=t)))},4707:(e,t,r)=>{r.d(t,{ZP:()=>w,Gf:()=>x});var n=r(6001),a=r(8881),i=r(4330),s=r(3263),o=r(3736);const l="\n#define STANDARD\nuniform int uvCount;\n ",c="\nattribute vec2 uv2;\nvarying vec2 vUv2;\nuniform mat3 uv2Transform;\n ",u="\nvUv2 = (uv2Transform * vec3(uv2, 1)).xy;\n ",d="\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 ",p="\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 m,f=r(1398),g=r(3735),v=r(2233),b=r(135),y=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const x={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"},transparent:{type:"other",val:!1,shortKey:"trans"},opacity:{type:"number",val:1,shortKey:"opc",before:({target:e,end:t})=>{t<1&&!e.transparent&&(e.transparent=!0,(0,b.updateMaterial)(e))}},depthTest:{type:"other",val:!0,shortKey:"dt"},depthWrite:{type:"other",val:!0,shortKey:"dw"},fog:{type:"other",val:!0,shortKey:"fo"},wireframe:{type:"other",val:!1,shortKey:"wf"},alphaMap:{type:"texture",val:null,shortKey:"alpm"}};class w{constructor(e){this.init(e)}static afterload(e,t){return y(this,void 0,void 0,(function*(){this.tools.bind(e),this.tools.textureNames.map((({type:r})=>y(this,void 0,void 0,(function*(){const a=e[r];if(a){let i=(0,v.Ki)(a);if(i||(i=(0,n.getId)(),(0,v.x)(a,i)),a.image)yield t.textureEx.afterLoad(a),t.uniqueEx.texture.linkMaterial(a,{target:e,type:r,targetType:"material"});else{let n=t.textureEx.awaitLoader.get(i);n||(n=[],t.textureEx.awaitLoader.set(i,n)),n.push((()=>{t.uniqueEx.texture.linkMaterial(a,{target:e,type:r,targetType:"material"})}))}}}))))}))}init(e){e.cb.material.add.add("base-material",(e=>{(0,b.isBaseMaterial)(e)&&"MeshPhysicalMaterial"!==e.type&&(w.tools.bind(e),e.userData.uvCount||(e.userData.uvCount=new a.Uniform(1)),e.onBeforeCompile=t=>{t.uniforms.uvCount=e.userData.uvCount,t.vertexShader=t.vertexShader.replace(/#include <uv2_pars_vertex>/g,c),t.vertexShader=t.vertexShader.replace(/#include <uv2_vertex>/g,u),t.fragmentShader=t.fragmentShader.replace(/#define STANDARD/g,l),t.fragmentShader=t.fragmentShader.replace(/#include <uv2_pars_fragment>/g,d),t.fragmentShader=t.fragmentShader.replace(/#include <map_fragment>/g,h),t.fragmentShader=t.fragmentShader.replace(/#include <emissivemap_fragment>/g,p)})}))}static isDefVal(e){for(const t in this.defVal){const r=this.defVal[t],n=e[t];if(r instanceof a.Color){if(r.getHexString()!==n.getHexString())return!1}else if("object"==typeof r){if(n.x!==r.x)return!1}else if(n!==r)return!1}for(const t of i.zX)if(e[t])return!1;return!0}create(){return(0,b.createDefMaterial)()}}(m=w).tools={textureNames:[{type:"map"},{type:"metalnessMap"},{type:"roughnessMap"},{type:"normalMap"},{type:"aoMap"},{type:"emissiveMap"},{type:"alphaMap"},{type:"lightMap"},{type:"envMap",isEnv:!0},{type:"displacementMap"}],type:"BasicMaterial",bind(e){(0,o.M)(e,"type","BasicMaterial")},create:()=>{var e=new a.MeshStandardMaterial;return m.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:i,load:o}=t,l=[];return o&&l.push(...s.F6.filter(i.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.materialEx.setTexture({material:a,type:t,newVal:r},!1)}})))),n.runScene.materialEx.parseNromals(r,a),{material:a,setTextureFns:l}},toNormal:e=>{const t=e.clone();return t.side=e.side,{material:t,normal:{type:w.tools.type},textures:(0,b.getBaseTextures)(e)}},clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,b.getBaseTextures)(e),snapshot:{getDiff:e=>f.LV.getDiff(x,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;f.LV.set({def:x,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,b.updateMaterial)(r)}))}},validType:e=>"MeshStandardMaterial"===e.type,setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new g.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]}},w.defVal={color:new a.Color(16777215),emissive:new a.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new a.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1,fog:!0}},4156:(e,t,r)=>{r.d(t,{Z:()=>p});var n,a=r(6001),i=r(8881),s=r(3263),o=r(3736),l=r(1398),c=r(3735),u=r(2233),d=r(135),h=r(4707);class p extends h.ZP{static afterload(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.tools.bind(e),this.tools.textureNames.map((({type:r})=>{const n=e[r];if(n){let i=(0,u.Ki)(n);if(i||(i=(0,a.getId)(),(0,u.x)(n,i)),n.image)t.uniqueEx.texture.linkMaterial(n,{target:e,type:r,targetType:"material"});else{let a=t.textureEx.awaitLoader.get(i);a||(a=[],t.textureEx.awaitLoader.set(i,a)),a.push((()=>{t.uniqueEx.texture.linkMaterial(n,{target:e,type:r,targetType:"material"})}))}}}))}))}}(n=p).tools={textureNames:[{type:"map"},{type:"metalnessMap"},{type:"roughnessMap"},{type:"normalMap"},{type:"aoMap"},{type:"emissiveMap"},{type:"alphaMap"},{type:"envMap",isEnv:!0},{type:"lightMap"},{type:"displacementMap"}],type:"MeshLambertMaterial",bind:e=>{(0,o.M)(e,"type",p.tools.type)},create:()=>{var e=new i.MeshLambertMaterial;return n.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:a,material:i}=e,{data:o,load:l}=t;var c=r.normalX;const h=n.tools.create(e.core.runScene),p=((0,d.mergeMaterial)(i,h),h.name=i.name,h.side=i.side,(0,u.x)(h,(0,u.Ki)(i)),n.tools.bind(h),[]);return l&&p.push(...s.F6.filter(o.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{a.runScene.materialEx.setTexture({material:h,type:t,newVal:r},!1)}})))),void 0!==c&&h.normalScale.set(c,-1*c),a.runScene.materialEx.parseNromals(r,h),{material:h,setTextureFns:p}},toNormal:e=>({material:e.clone(),normal:{type:p.tools.type,normalX:e.normalScale.x},textures:(0,d.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,d.getBaseTextures)(e),snapshot:{getDiff:e=>l.LV.getDiff(h.Gf,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;l.LV.set({def:h.Gf,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,d.updateMaterial)(r)}))}},validType:e=>"MeshLambertMaterial"===e.type||"MeshLambertMaterial"===e.type,setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new c.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]}}},9457:(e,t,r)=>{r.d(t,{Z:()=>p});var n,a=r(6001),i=r(8881),s=r(3263),o=r(3736),l=r(1398),c=r(3735),u=r(2233),d=r(135),h=r(4707);class p extends h.ZP{static afterload(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.tools.bind(e),this.tools.textureNames.map((({type:r})=>{const n=e[r];if(n){let i=(0,u.Ki)(n);if(i||(i=(0,a.getId)(),(0,u.x)(n,i)),n.image)t.uniqueEx.texture.linkMaterial(n,{target:e,type:r,targetType:"material"});else{let a=t.textureEx.awaitLoader.get(i);a||(a=[],t.textureEx.awaitLoader.set(i,a)),a.push((()=>{t.uniqueEx.texture.linkMaterial(n,{target:e,type:r,targetType:"material"})}))}}}))}))}}(n=p).tools={textureNames:[{type:"map"},{type:"metalnessMap"},{type:"roughnessMap"},{type:"normalMap"},{type:"aoMap"},{type:"emissiveMap"},{type:"alphaMap"},{type:"lightMap"},{type:"displacementMap"}],type:"MyMeshPhongMaterial",bind:e=>{(0,o.M)(e,"type",p.tools.type)},create:()=>{var e=new i.MeshPhongMaterial;return n.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:a,material:i}=e,{data:o,load:l}=t,c=n.tools.create(e.core.runScene),h=((0,d.mergeMaterial)(i,c),c.name=i.name,c.side=i.side,(0,u.x)(c,(0,u.Ki)(i)),n.tools.bind(c),[]);return l&&h.push(...s.F6.filter(o.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{a.runScene.materialEx.setTexture({material:c,type:t,newVal:r},!1)}})))),a.runScene.materialEx.parseNromals(r,c),{material:c,setTextureFns:h}},toNormal:e=>({material:e.clone(),normal:{type:p.tools.type},textures:(0,d.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,d.getBaseTextures)(e),snapshot:{getDiff:e=>l.LV.getDiff(h.Gf,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;l.LV.set({def:h.Gf,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,d.updateMaterial)(r)}))}},validType:e=>"MyMeshPhongMaterial"===e.type||"MeshPhongMaterial"===e.type,setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new c.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]}}},110:(e,t,r)=>{r.d(t,{Z:()=>h});var n,a=r(8881),i=r(8609),s=r(3736),o=r(1398),l=r(2233),c=r(135),u=(t=r(4707),r(3735));const d={color:t.Gf.color,map:t.Gf.map,opacity:t.Gf.opacity};class h{constructor(e){this.modelParse={toNormal:e=>{e=e.model;const t=(0,i.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,this.merge(e,t),t},parse:e=>{var{model:e,normal:t}=e;const r=(0,i.createDefModel)("Sprite");var n=e.userData.layers;return(0,i.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),this.merge(e,r),r.material=e.material,r}},this.merge=(e,t)=>{t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.renderOrder=e.renderOrder,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,t.name=e.name,t.name=e.name,(0,s.M)(e,"name",e.name),(0,i.setLayers)(t,1===e.layers.mask?0:1)},this.type="Sprite",this.runScene=e;const{parse:t,toNormal:r}=this.modelParse;e.cb.inited.add("MySpriteMaterial",(()=>{e.modelEx.importAndExport.addParses(this.type,{parse:t,toNormal:r}),e.modelEx.importAndExport.addParses("MySpriteMaterial",{parse:t,toNormal:r})}))}}(n=h).tools={type:"SpriteMaterial",bind(e){(0,s.M)(e,"type","SpriteMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{var e=new a.SpriteMaterial;return n.tools.bind(e),e},setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new u.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,s=[],o=(0,c.mergeMaterial)(r,h.tools.create(t));(0,l.x)(o,(0,l.Ki)(r));var{depthWrite:e,depthTest:r,name:n,fog:u}=n;return!1===u&&(o.fog=!1),void 0!==e&&(o.depthWrite=e),void 0!==r&&(o.depthTest=r),n&&(o.name=n),i&&s.push(...a.map((e=>{const{type:r,texture:n}=e;return()=>{t.materialEx.setTexture({material:o,type:r,newVal:n},!1)}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,c.mergeMaterial)(e,(0,c.createDefMaterial)());var r=Object.assign({},t.userData);const n={type:h.tools.type,name:e.name};return e.fog||(n.fog=!1),e.depthWrite!==c.defBaseMaterialMap.depthWrite&&(n.depthWrite=e.depthWrite),e.depthTest!==c.defBaseMaterialMap.depthTest&&(n.depthTest=e.depthTest),t.userData=r,{normal:n,textures:h.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=h.tools.type,t},snapshot:{getDiff:e=>o.LV.getDiff(d,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;o.LV.set({def:d,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,c.updateMaterial)(r)}))}},textureNames:[{type:"map"},{type:"alphaMap"}]}},3801:(e,t,r)=>{r.d(t,{Ju:()=>i,t9:()=>a,zf:()=>s});var n=r(3736);const a={isDynamic:e=>e.userData.isDynamic},i={isDeleted(e,t=!1){var r;return!!e&&(!(null==(r=null==e?void 0:e.userData)||!r.isDeleted)||!!t&&i.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,n.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},s={setLock(e){(0,n.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var r=e.userData.lock;return t?!!r||s.isLock(e.parent,t):void 0!==r&&r}}},8609:(e,t,r)=>{r.r(t),r.d(t,{bindModelCloneId:()=>fe,closeModelEvent:()=>he,createDefModel:()=>F,createSpecialModel:()=>z,default:()=>N,delClonedModel:()=>te,deletedModel:()=>j.Ju,disposeModel:()=>V,dynamicModel:()=>j.t9,getClonedIdModel:()=>$,getDeepModels:()=>X,getIdMapByModel:()=>ue,getModelSize:()=>ie,getModelType:()=>me,getSphere:()=>pe,hasSkeleton:()=>Y,helperModel:()=>le,instanceModel:()=>G,isDynamicModel:()=>J,isGLowModel:()=>re,isGroup:()=>ae,isHelper:()=>K,isNormalModel:()=>ge,isSprite:()=>ne,lockModel:()=>j.zf,mergeModel:()=>H,normalModel:()=>oe,selectableModel:()=>se,setClonedModel:()=>ee,setDynamicModel:()=>Q,setHelper:()=>W,setLayers:()=>q,tempModel:()=>de,uselessGroup:()=>ce,withAnima:()=>Z});var n=r(6001),a=r(8881),i=r(4091),s=r(4230);const o=["Group","Box","Plane","Sphere","Sprite","Reflector","VerticesRain","Water","3DDom","3DSprite","2DDom","GroundProjected"];var l=r(3263),c=r(1794),u=r(272),d=r(6292),h=r(1269),p=r(4098),m=r(135),f=r(228),g=r(3736);class v extends r(4773).Z{constructor(e){super(e),this.type="添加模型",this.isUndoAdd=!0}_execute(e){return Promise.reject()}undo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}redo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene,isScene:this.isScene})}execute(){return this.redo(),this}}var b=r(3735),y=r(2510);class x extends r(4616).Z{constructor(e){super(),this.type="修改父元素",this.isUndoParent=!0,this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e,t){e.attach(this.target),this.runScene.cb.model.setParent.cb({model:this.target,parent:e}),(null==(e=this.runScene.modelEx.select)?void 0:e.userData.id)===t.userData.id&&this.runScene.modelEx.selectNull()}undo(){this._execute(this.oldParent,this.newParent)}redo(){this._execute(this.newParent,this.oldParent)}}const w=x;var S=r(7169),M=r(4380),T=r(2233),_=r(5317);class E{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var D=r(2353),O=r(110),P=r(7095);class k{constructor(e){this.data=this.getData(),this.parses=new c.Z,this.nodeType={MySpriteMaterial:O.Z,VerticesRain:P.Z},this.mount=e=>{e.core.module.set("model",this)},this.complete=()=>{this.data=this.getData()},this.awaitMateIds=new u.Z,this.loadNodeDef=e=>{let{node:t,nodeDef:r}=e;(0,n.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{var a=r[e];null!=a&&(t[e]=a)})),r.wireframe&&(t.material.wireframe=!0)},this.load=e=>{var{data:e,core:t}=e;return this.loadNodeDef(e),this.loadExtras(e,t),e.node},this.done=()=>{this.removeHelperModel()},this.parseMateIds=e=>{const t=e.module.get("material");t&&this.awaitMateIds.map((({model:e,multiMaterial:r})=>{e.material=l.F6.filter(r.mateIds.map((e=>null==(e=t.getById(e))?void 0:e.material))),e.geometry.groups=r.groups}))},this.afterParse=e=>{const{config:t,data:r,json:n,core:a}=e;if(this.parseMateIds(a),this.awaitMateIds.clear(),"model"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){if(null==(e=t.module)||!e.model)return[];let n=["glb_model"===(e=(e=r.options).models[0]).name&&(null==e?void 0:e.children[0])||e];var[e]=n;ce.is(e)&&(n=[...e.children]),a.models.push(...n),this.mergeClone()}},this.toNromal=e=>{var t=e.type;const r=this.parses.get(t);return r?r.toNormal(e):e.model},this.parse=e=>{var t=e.type;const r=this.parses.get(t);if(r)return r.parse(e)},this.runScene=e}getData(){return{map:new c.Z,clonedMap:{},instancedMap:{},helperModels:[]}}getMap(){return new c.Z({loadNode:this.load,loadedGltf:this.done,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}addParses(e,t){this.parses.set(e,t)}loadExtras(e,t){let{node:r,nodeDef:n}=e;if(n.extras){const{layers:o,normal:l,local:c,cloneId:u,id:d,animations:h,isDynamic:p,multiMaterial:m}=n.extras;var a,i=J(r,!0);if("running"===this.runScene.optionsEx.options.mode&&(null==(s=this.runScene.optionsEx.options.renderConfig)||!s.matrixAutoUpdate)){if(i)return;r.matrixAutoUpdate=!1}h&&(r.animations=D.B.parse(h)),p&&(r.userData.isDynamic=!0),!u||i||(this.data.instancedMap[u]||(this.data.instancedMap[u]=new Set),this.data.instancedMap[u].add(r)),c&&([s,i,a]=c.split(","),r.position.set(s,i,a)),o&&(r.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:r,val:1})),n.extras.isHelper&&this.data.helperModels.push(r),l&&([i,...a]=(s=this.parse({type:l.type,model:e.node,normal:l,runScene:this.runScene}))instanceof Array?s:[s],e.node=i,t.models.push(...a)),d&&this.data.map.set(d,e.node);var s=null==(a=null==(i=null==(s=e.node)?void 0:s.material)?void 0:i.userData)?void 0:a.id;if(s){const r=t.module.get("material").data.materialIns[s];r&&r.models.push(e.node)}m&&this.awaitMateIds.add({model:e.node,multiMaterial:m})}}removeHelperModel(){this.data.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}mergeClone(){var e;this.runScene.optionsEx.options.instanceClone&&"running"===this.runScene.optionsEx.options.mode&&(this.runScene.assetsEx.scene.updateMatrixWorld(),e=this.data.instancedMap,(0,n.mapObj)(e,((e,t)=>{var r,n=this.runScene.modelEx.getById(e);t.size<2||!n||!n.geometry||J(n,!0)||(r=G(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),re(n)&&this.runScene.modelEx.setGlow(r,!0),this.runScene.modelEx.remove(n,!1),t.forEach((e=>this.runScene.modelEx.remove(e,!1))),t.clear(),delete this.data.instancedMap[e])}))),this.data.instancedMap={}}mergeGeometry(){}}var A=r(8089);class C{constructor(e){this.copyData={name:"",data:void 0,modelId:""},this.useMap={name:"",model:void 0},this.onModelMove=e=>{var t;if(this.useMap.model&&0!==this.useMap.name.length&&this.get(e)&&(t=this.getLocalDataByName(e,this.useMap.name))){var{x:t,y:r,z:n,tx:i,ty:s,tz:o}=t.data;let u=e=(0,A.VU)(e,this.runScene.assetsEx.scene);var{x:e,y:l,z:c}=e;e={x:e+t,y:l+r,z:c+n},void 0!==i&&void 0!==s&&void 0!==o&&(u=new a.Vector3(e.x+i,e.y+s,e.z+o)),this.runScene.assetsEx.camera.position.set(e.x,e.y,e.z),this.runScene.assetsEx.camera.lookAt(u),this.runScene.assetsEx.controls.target.copy(u)}},(this.runScene=e).cb.model.setVector3.add("ModelExCamFlow",(({type:e,model:t})=>{"position"===e&&this.onModelMove(t)})),e.cb.inited.add("model-camFlow",(()=>{e.events.model.addOptions({name:"camFlow",map:{parse:e=>{var{model:e,childs:t}=e,[t]=t;return t?this.focus(e,t):Promise.resolve()}}})}))}teigger(){this.runScene.events.model.enable}link(e,t){var r=this.get(e);if(r&&(r=r[t])){let n=(0,T.Ki)(e);"id"===r.type&&(n=r.data),this.copyData={name:t,modelId:n,data:void 0}}}getDataById(e,t){return null==(e=null==(e=this.runScene.modelEx.getById(e))?void 0:e.userData[C.savedStr])?void 0:e[t]}copy(e,t){(e=this.getLocalDataByName(e,t))&&(this.copyData={name:t,data:e.data,modelId:""})}paste(e){const{name:t,modelId:r,data:n}=this.copyData;e.map((e=>{n?this.set({model:e,local:n,name:t,state:!0}):0<r.length&&this.set({model:e,modelId:r,name:t,state:!0})}))}set(e){var{model:e,local:t,name:r,state:n,modelId:a}=e;let i=this.get(e);if(i){if(!n)return void delete i[r]}else{if(!n)return;i={},(0,g.M)(e,C.savedStr,i)}n&&(a?a!==(0,T.Ki)(e)&&(i[r]={type:"id",data:a}):i[r]={type:"data",data:t||this.getBetween(e)})}use(e,t){this.useMap.model=e,this.useMap.name=t}clearUse(){this.useMap.model=void 0}get(e){return(0,g.is)(e,C.savedStr)}getBetween(e){var{x:e,y:t,z:r}=(0,A.VU)(e,this.runScene.assetsEx.scene),{x:n,y:a,z:i}=this.runScene.assetsEx.controls.target;return{x:this.runScene.assetsEx.camera.position.x-e,y:this.runScene.assetsEx.camera.position.y-t,z:this.runScene.assetsEx.camera.position.z-r,tx:n-this.runScene.assetsEx.camera.position.x,ty:a-this.runScene.assetsEx.camera.position.y,tz:i-this.runScene.assetsEx.camera.position.z}}used(e,t){return(0,T.Ki)(e)===(0,T.Ki)(this.useMap.model)&&t===this.useMap.name}getLocalDataByName(e,t){var r=this.get(e);if(r&&(r=r[t]))return"id"!==r.type?r:r.data!==(0,T.Ki)(e)?this.getDataById(r.data,t):void 0}getLocalByName(e,t){if(e=this.get(e))return e[t]}focus(e,t,r=.5){if(!(t=this.getLocalDataByName(e,t)))return Promise.resolve();var{x:n,y:i,z:s}=t.data,{x:o,y:l,z:c}=(0,A.VU)(e,this.runScene.assetsEx.scene);let u;return u=void 0!==t.data.tx&&void 0!==t.data.ty&&void 0!==t.data.tz?new a.Vector3(t.data.tx,t.data.ty,t.data.tz):(0,A.VU)(e,this.runScene.assetsEx.scene),t={x:o+n,y:l+i,z:c+s},this.runScene.cameraEx.anima({x:t.x,y:t.y,z:t.z,tx:t.x+u.x,ty:t.y+u.y,tz:t.z+u.z},{time:r}),new Promise((e=>{setTimeout(e,r)}))}}C.savedStr="camFLow";var L=r(4342),R=r(7201),I=r(1398);const B={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 U{constructor(e){this.resetItem=e=>{"model"===e.type&&e.datas.map((t=>{const r=t.data;let n=r.get("model");n||(n={},r.set("model",n));const a=new u.Z;if(e.targets.map((e=>{e.traverse((e=>{var t=(0,T.Ki)(e);t&&(e.material&&a.add(e.material),n[t]=this.getItem(e))}))})),0!==a.size){const t=new u.Z;a.map((e=>{const r=p.ZP.getTextures(e);0!==r.length&&t.add(r.map((e=>e.texture)))})),this.runScene.cb.snapshot.resetItem.cb({type:"texture",datas:e.datas,targets:t.toArray()}),this.runScene.cb.snapshot.resetItem.cb({type:"material",datas:e.datas,targets:a.toArray()})}}))},this.create=e=>{var t=this.getDiff(this.runScene.sceneEx.getClearModels());0!==(0,R.objLength)(t)&&e.data.set("model",t)},this.set=e=>{var t=e.snapshot.data.get("model");if(t){const r=e.data.completedCbs;this.runScene.pp.clearAllOutlineObj(),(0,n.mapObj)(t,((t,n)=>{const a=this.runScene.uniqueEx.model.get(t);a&&(I.LV.set({def:B,runScene:this.runScene,data:n,target:a,map:e}),t=n[B.visible.shortKey],a.visible=void 0===t,r.push((()=>{var e;this.runScene.modelEx.setGlow(a,!!n.isGLow),n.isOutline?this.runScene.modelEx.setOutline(a,!0):a.userData.outline&&(a.userData.outline=!1),this.runScene.cb.model.change.cb({model:a,type:"visible",val:a.visible}),n.materialId&&n.materialId!==(0,T.Ki)(a.material)&&(e=this.runScene.uniqueEx.material.get(n.materialId))&&this.runScene.materialEx.resetMaterial(a,e,{addUndo:!1,includeChild:!1})})))}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("model",this.create),e.cb.snapshot.delUseless.add("model",(t=>{(0,n.mapObj)(t,((t,r)=>{const a=r.data.model;a&&((0,n.mapObj)(a,(t=>{e.uniqueEx.model.has(t)||delete a[t]})),0===(0,R.objLength)(a)&&delete r.data.model)}))})),this.runScene.cb.snapshot.set.add("model",this.set),this.runScene.cb.snapshot.getLength.add("model",(e=>{var t=e.data.data.get("model");t&&(e.inputData.model=Object.keys(t).length)})),this.runScene.cb.snapshot.getByType.add("model",(({targets:e,type:t,data:r})=>{"model"===t&&this.resetItem({type:t,datas:[r],targets:e})})),this.runScene.cb.snapshot.delete.add("model",(({data:e})=>{(e=e.data.get("model"))&&(0,n.mapObj)(e,((e,t)=>{this.bindMaterialId(t.materialId,!1)}))})),this.runScene.cb.snapshot.parseJSON.add("model",(e=>{e.map(((e,t)=>{(t=t.data.get("model"))&&(0,n.mapObj)(t,((e,t)=>{this.bindMaterialId(t.materialId,!0)}))}))}))}bindMaterialId(e,t){e&&0!==e.length&&this.runScene.cb.assets.manager.set.cb({type:"material",id:e,isAdd:t})}getItem(e){const t=I.LV.getDiff(B,e);return re(e)&&(t.isGLow=!0),(0,f.S)(e)&&(t.isOutline=!0),e.material&&!(0,m.isMultiMaterial)(e.material)&&(t.materialId=(0,T.Ki)(e.material),this.bindMaterialId(t.materialId,!0)),t}getDiff(e){const t={};return e.map((e=>{e.traverse((e=>{var r=(0,T.Ki)(e);r&&(t[r]=this.getItem(e))}))})),t}getData(){}}var j=r(3801);class N{constructor(e){this._selectModel=void 0,this.geometryMap=new c.Z,this.clonedMap=new c.Z,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.clean=()=>{this.reset()},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,r,n)=>{var{addUndo:a,isClone:i,select:s,addToTree:o,isScene:l}=(0,_.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0,isScene:!1},n);return t instanceof Array?t.map((e=>this.add(e,r,Object.assign(Object.assign({},n),{isScene:!1})))):(e(t,i),this.setGeometryMap(t),this.setCloneMap(t),o=new v({model:t,parent:r||this.runScene.sceneEx.get(),isClone:i,addTree:o,runScene:this.runScene,isScene:void 0!==l&&l}).execute(),!0===a&&this.runScene.undoEx.addUndo(o),s&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:i}),o)}})(),this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.parseUnStandard=e=>{const t=[];e.map((e=>{const r=this.getModel(e);r&&t.push((()=>function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var e=this.runScene.exporter.obj.model(r);(e=yield this.runScene.fileEx.obj(e))&&([e]=e.result,e&&(r.geometry=e.geometry))}))))})),(0,n.eachTriggerArray)(t)},this.setClonedModels=(e,t)=>{const r=e.geometry;if(r){const n=[],i=this.getTruthPosition(e);t.map((t=>{if(t.geometry&&(0,T.Ki)(t)!==(0,T.Ki)(e)&&e.geometry.uuid!==t.geometry.uuid){var s=this.getTruthPosition(t);n.push(new y.Z({target:t,info:"geometry",newVal:r,runScene:this.runScene,oldVal:t.geometry,cb(r,n){"redo"===n?fe(e,t):delete t.userData.cloneId}}).execute());const o=new a.Vector3;o.subVectors(s,i),n.push(new M.Z({target:t,info:"position",newV3:o,runScene:this.runScene,oldV3:t.position.clone()}).execute())}})),this.runScene.undoEx.addUndo(n)}},this.runScene=e,this.clone=(e=>(t,r=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var a,i,s=Y(t),o=(e=>{const t={};return(0,_.getModelMap)(e,"id",(e=>{0<e.animations.length&&(t[(0,T.Ki)(e)]=e.animations)})),t})(t),l=(s=s?function(e){var t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(var a=0;a<t.children.length;a++)e(t.children[a],r.children[a],n)}(e,n,(function(e,n){t.set(n,e),r.set(e,n)})),n.traverse((function(e){var n,a;e.isSkinnedMesh&&(a=(n=t.get(e)).skeleton.bones,e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=a.map((function(e){return r.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),n}(t):t.clone(),fe(t,s),(0,g.is)(t,"isDynamic")&&Q(s,!0),(0,_.getModelMap)(s,"id"));c=s,(i=null==t?void 0:t.material)&&((0,m.isMultiMaterial)(i)?c.material=[...i]:(a=p.ZP.clone((0,p.ee)(i),i))&&a.uuid!==i.uuid&&(e.materialEx.resetMaterial(c,a,{addUndo:!0}),e.materialEx.add(a,t,i)));{var c={newModel:s,newModelMap:l,animaMap:o};const{animaMap:t,newModelMap:r}=c;(0,n.mapObj)(t,((t,a)=>{const i=r[t],s={};i&&(i.animations=[...a.map((e=>{const t=e.clone();return t.tracks.map((e=>{var[t]=e.name.split(".");s[t]||(s[t]=[]),s[t].push(e)})),t}))],(0,n.mapObj)(s,((t,r)=>{var a=i.getObjectByName(t);if(a){(0,g.M)(a,"id",(0,n.getId)());const i=e.uniqueEx.model.parseName(a);r.map((e=>{e.name=i+e.name.slice(t.length)}))}})))}))}return r&&e.uniqueEx.model.add(s,{hasReset:!0}),s})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new E(e),this.importAndExport=new k(e),this.snapsot=new U(e),this.def=new L.Z(e),this.camFlow=new C(e),this.runScene.cb.loaderer.gltf.getArrayBuffer.add("EngineModel",(()=>{this.selectNull()}))}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}set(e,t,r){this[t]=r,this.runScene.cb.model.change.cb({model:e,type:t,val:r})}init(){var e={name:"node",loadCallBacks:this.importAndExport.getMap(),exportCallBacks:new c.Z};this.runScene.exporter.gltf.module.bind(e),this.runScene.cb.unique.model.add.add("model",(({model:e})=>{(0,f.S)(e)&&this.setOutline(e,!0)}))}getSelectedModels(){return[this.select,...this.runScene.multipSelector.getSelectedList("value")].filter((e=>e))}setGeometryMap(e){if((0,_.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,T.Ki)(e))),this.setGeometryMap(e.children)}isSameGeo(e,t){var{normal:e,position:r,uv:n}=e.attributes,{normal:t,position:a,uv:i}=t.attributes;return e.array.length===t.array.length&&r.array.length===a.array.length&&n.array.length===i.array.length&&(e=(0,_.sameArr)([...e.array],[...t.array],20),t=(0,_.sameArr)([...r.array],[...a.array],20),r=(0,_.sameArr)([...n.array],[...i.array],20),e&&t&&r)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){const[r,n]=e;if(0!==n.size){var t=n.values()[0];if(!t)return;const e=this.runScene.uniqueEx.model.get(t);if(!e||!e.geometry)return;if(this.isSameGeo(e.geometry,e.geometry))return r}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,_.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=$(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new u.Z),this.clonedMap.get(t).add((0,T.Ki)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,T.Ki)(e))}replaceClonedGroup(e,t){t=$(t)||(0,T.Ki)(t);const r=this.clonedMap.get(t);r&&0!==r.size&&(e.userData.id=t,r.map((t=>{if(t=this.runScene.modelEx.getById(t)){var{position:r,rotation:n,scale:a,name:i,parent:s}=t;this.remove(t,!1);const o=this.runScene.modelEx.clone(e);o.userData.id=(0,T.Ki)(t),o.position.copy(r),o.rotation.copy(n),o.scale.copy(a),o.name=i,this.add(o,s,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const r=this.geometryMap.get(t);r&&0!==r.size&&(r.forEach((t=>{const r=this.runScene.uniqueEx.model.get(t);r&&(r.geometry=e,r.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,r))}setSelectByModel(e,t){this.runScene.optionsEx.log({model:e,userData:e.userData,material:e.material,textures:e.material?p.ZP.getTextures(e.material):{}},"detail");var{isDomTreeActive:t,isClone:r}=t||{};if(this.runScene.events.key.ctrl&&!r)return r=this.select,this.runScene.modelEx.selectNull(),r&&this.runScene.multipSelector.add(r),void this.runScene.multipSelector.add(e);if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),(this._selectModel=e).isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)))}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){let r=[];Array.isArray(e)?r.push(...e):r.push(e),e=r.map((e=>new S.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute())),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t){var{x:e,y:r,z:n}=e;return e===(t=t?1:0)&&r===t&&n===t}isNavieV2(e,t=0){var{x:e,y:r}=e;return e===t&&r===t}isUnless(e){return!e.userData.normal&&!e.material&&this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&0===e.children.length&&!Z(e)}isUnlessLevel(e){return!e.geometry&&this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&1===e.children.length&&!Z(e)}create(e="Box"){return e=(0,_.getModelByType)(e),p.ZP.parseNode(e),e}getById(e){return Array.isArray(e)?e.map((e=>this.runScene.uniqueEx.model.get(e))).filter((e=>e)):this.runScene.uniqueEx.model.get(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e=this._selectModel;e&&(this.runScene.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new w({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!r)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:r,newV3:n}=e;if(Array.isArray(t))return t.map((e=>{e[r].set(n.x,n.y,n.z),e.updateMatrix()}));t[r].set(n.x,n.y,n.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3(e,t=!0,r=!0){let{model:n,info:i,newV3:s,oldV3:o}=e;var l,c;if(s.isVector3||s.isEuler||(({x:u,y:l,z:c}=s),s=new a.Vector3(u,l,c)),(0,_.isRunning)(this.runScene))return this._setV3(e);var u=n instanceof Array?n.map((e=>new M.Z({target:e,info:i,runScene:this.runScene,oldV3:o||e[i].clone(),newV3:s}).execute(r))):new M.Z({target:n,info:i,oldV3:o||n[i].clone(),newV3:s,runScene:this.runScene}).execute(r);t&&this.runScene.undoEx.addUndo(u)}setNormal(e,t=!0){const{model:r,oldVal:n,info:a,val:i,executeCb:s}=e,o=new u.Z;return l.F6.toArr(r).map((e=>{"castShadow"!==a&&"receiveShadow"!==a||"group"===me(e)&&e.traverse((e=>{"group"!==me(e)&&o.add(e)})),o.add(e)})),e=o.map((e=>new y.Z({target:e,info:a,runScene:this.runScene,oldVal:n||e[a],newVal:i,executeCb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,r=!0){var n=new y.Z({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(this.def.create(e),void 0,{select:!0})}isModel(e){return!((0,h.RQ)(e)||(0,s.N)(s.N))}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),a=r===n?t:r;return e.parent.children.map(((e,t)=>t>a&&t<n&&e)).filter((e=>e))}}}setMultip(e){const{model:t,typeList:r,newVal:n,cb:a}=e;this.runScene.undoEx.addUndo(new b.Z({target:t,typeList:r,newVal:n,cb(e,t){null!=a&&a(t)}}).execute())}createGroup(e,t,r){const n=t||new a.Group,i=[];i.push(new v({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new w({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new w({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:n}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(n)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,n.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new w({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new S.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length,n=this.runScene.sceneEx.getClearModels(),a=[];n.map((n=>{n.traverse((n=>{r?!1===(0,_.deepFindParentByUuid)(n,t)&&n.uuid!==e.uuid&&a.push(n):n.uuid!==e.uuid&&a.push(n)}))}));var i=a.map((e=>new y.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(i),(0,_.setParentVisible)(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var r=t.map((e=>new y.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(r)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new S.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new a.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let n=new a.Raycaster,i=new a.Vector2,s=(i.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,i.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,n.setFromCamera(i,this.runScene.assetsEx.camera),n.intersectObjects(t,!0)),o={intersects:null,obj:null};if(0===s.length)return o;if(r){if(0===(e=s.filter((e=>(0,_.isVisible)(e.object)))).length)return o;o={intersects:e,obj:e[0].object}}else o={intersects:s,obj:s[0].object};return o}getCamLocal(){var{x:e,y:t,z:r}=this.runScene.assetsEx.camera.position,{x:n,y:a,z:i}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}}camAnima(e,t,r=1,n,a){return(0,_.anima)(e,t,r,(e=>{a&&a(e),this.runScene.assetsEx.camera.position.set(e.cx,e.cy,e.cz),this.runScene.assetsEx.controls.target.set(e.tx,e.ty,e.tz),this.runScene.assetsEx.camera.lookAt(this.runScene.assetsEx.controls.target)}),(e=>{n&&n()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:e,val:t})}setOutline(e,t=!0){e.userData.outline=t,this.runScene.pp.addOutlineObj(e,t),this.runScene.cb.model.setOutline.cb({model:e,val:t})}focus(e){const{scene:t,camera:r,renderer:n,controls:i}=this.runScene.assetsEx.get(),s=new a.Vector3,o=new a.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var l=n.domElement.getBoundingClientRect();let t=l.width/l.height;const i=new a.Vector3;l=e.geometry.attributes.position.array,i.set(Math.abs(l[0]-l[3]),Math.abs(l[1]-l[7]),Math.abs(l[2]-l[14])),o.x=.5*(l[0]+l[3]),o.y=.5*(l[1]+l[7]),o.z=.5*(l[2]+l[14]);let c=new a.Vector3;c.subVectors(r.position,o),c.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*r.fov*Math.PI/180),l=i.length()/t/l,s.addVectors(o,c.multiplyScalar(l))}else{t.updateMatrixWorld(!0),l=new a.Vector3,e.getWorldPosition(l),o.set(l.x,l.y,l.z);let n=new a.Vector3;n.subVectors(r.position,o),n.normalize(),s.addVectors(o,n.multiplyScalar(3))}(0,_.anima)({positionX:r.position.x,positionY:r.position.y,positionZ:r.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:s.x,positionY:s.y,positionZ:s.z,targetX:o.x,targetY:o.y,targetZ:o.z},.5,(e=>{r.position.set(e.positionX,e.positionY,e.positionZ),r.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}instance(e){this.runScene.assetsEx.scene.updateMatrixWorld();const t={},r=Array.isArray(e)?e:[e],a=[];r.map((e=>{e.traverse((e=>{var r;e.geometry&&!J(e)&&(r=$(e))&&(a.push(e),t[r]||(t[r]=new Set),t[r].add(e))}))})),(0,n.mapObj)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=G(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),re(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),a.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){const e=this.runScene.sceneEx.getClearModels();let t=[];e.map((e=>e.traverse((e=>t.push(e))))),t.map((e=>{V(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,r){const{getOriginData:n,ignoreMove:i}=(0,_.mergeObject)({ignoreMove:!1,getOriginData:!1},r);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(r=>{if(i||!this.runScene.events.mouse.isMove){const i=new a.Raycaster,u=new a.Vector2,{engineDom:d,camera:h}=this.runScene.assetsEx.get();var{top:s,left:o,width:l,height:c}=d.getBoundingClientRect(),o=r.pageX-o;r=r.pageY-s,u.x=o/l*2-1,u.y=-r/c*2+1,i.setFromCamera(u,h);const p=i.intersectObjects(e||[],!0);null!=t&&t(0===p.length?null:n?p:p.map((e=>e.object)))}}))}getSize(e){this.sizeBox||(this.sizeBox=new a.Box3),this.sizeBox.setFromObject(e);var{x:e,y:t,z:r}=this.sizeBox.getSize(new a.Vector3);return{x:e,y:t,z:r}}reCenter(e){const t=new d.Z.Vector3,r=new d.Z.Box3;r.setFromObject(e),r.getCenter(t),e.traverse((e=>{if(e instanceof d.Z.Mesh){const n=e.geometry;n.computeBoundingBox();var r=new d.Z.Vector3;n.boundingBox.getCenter(r);const a=n.vertices||n.attributes.position.array;for(let e=0;e<a.length;e++)a[e].sub(r).add(t);n.vertices?n.verticesNeedUpdate=!0:n.attributes.position.needsUpdate=!0}}))}getTruthPosition(e){const t=this.runScene.helperEx.boxHelper;if(this.runScene.helperEx.boxHelper.setFromObject(e),t.update(),t&&t.object){const r=new a.Vector3;e=t.geometry.attributes.position.array,r.set(Math.abs(e[0]-e[3]),Math.abs(e[1]-e[7]),Math.abs(e[2]-e[14]));const n=new a.Vector3;return n.x=.5*(e[0]+e[3]),n.y=.5*(e[1]+e[7]),n.z=.5*(e[2]+e[14]),n}}}const z=e=>{},F=e=>{if(o.includes(e))return e=(0,_.getModelByType)(e),p.ZP.parseNode(e),e;throw TypeError("")},V=(e,t)=>{t=(t||{}).remove;const{geometry:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&((0,m.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},G=(e,t)=>{var{material:r,geometry:n}=e;const a=new d.Z.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),a.setMatrixAt(t,e.matrixWorld)})),a.name=e.name,a},H=(e,t)=>{const r=[];if(t.map((e=>{e=e.geometry,r.push(e)})),t=i.qf(r))return new d.Z.Mesh(t,e)},Z=e=>0!==e.animations.length,W=e=>{e&&e.userData&&(e.userData.isHelper=!0)},K=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,q=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,g.M)(e,"layers",t))},X=e=>{const t=[];e.traverse((e=>{t.push(e)}))},Y=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},Q=(e,t)=>{t?(0,g.M)(e,"isDynamic",!0):delete e.userData.isDynamic},J=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&J(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,$=e=>e.userData.cloneId,ee=(e,t)=>{(0,g.M)(e,"cloneId",t)},te=e=>{delete e.userData.cloneId},re=e=>1===e.userData.layers,ne=e=>e.isSprite,ae=e=>{},ie=e=>{var t=new a.Vector3;return(new a.Box3).setFromObject(e).getSize(t),t},se={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},oe={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,s.N)(e)&&void 0===e.userData.unNormal,hasUnNormal:e=>void 0!==(null==(e=null==e?void 0:e.userData)?void 0:e.unNormal)},le={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}},ce={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.uselessGroup,set(e,t){t?e.userData.uselessGroup=!0:delete e.userData.uselessGroup}},ue=(e,t)=>{let r=[];Array.isArray(e)?r.push(...e):r.push(e);const n={};return r.map((e=>e.traverse((e=>{null!=t&&t(e),n[(0,T.Ki)(e)]=e})))),n},de={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.isTemp),set(e,t){t?e.userData.isTemp=t:delete e.userData.isTemp}},he={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.closeEvent),set(e,t){t?e.userData.closeEvent=t:delete e.userData.closeEvent}},pe=()=>{var e=new a.MeshBasicMaterial,t=new a.SphereGeometry(.7,300,300);return new a.Mesh(t,e)},me=e=>(0,s.N)(e)?"camera":(0,h.RQ)(e)?"light":K(e)||e.userData.isLightTarget?"helper":"Mesh"===e.type?"mesh":"Line"===e.type?"line":"Sprite"===e.type?"sprite":"Group"===e.type||"Object3D"===e.type?"group":void 0,fe=(e,t)=>{(0,g.M)(t,"cloneId",$(e)||e.userData.id)},ge=e=>!(0,s.N)(e)&&!(0,h.RQ)(e)},8990:(e,t,r)=>{r.d(t,{Z:()=>g});var n=r(8881),a=r(8609),i=r(2233),s=r(6001),o=r(135);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof 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 c(e,t){return(c=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)}class d extends(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&&c(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===l(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(a);function a(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=this,s=a;if(!(i instanceof s))throw new TypeError("Cannot call a class as a function");return i=[e.isCubeTexture?"#define ENVMAP_TYPE_CUBE":""].join("\n")+"\n\n varying vec3 vWorldPosition;\n\n uniform float radius;\n uniform float height;\n uniform float angle;\n\n #ifdef ENVMAP_TYPE_CUBE\n\n uniform samplerCube map;\n\n #else\n\n uniform sampler2D map;\n\n #endif\n\n // From: https://www.shadertoy.com/view/4tsBD7\n float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n {\n\n float d = dot ( rd, n );\n \n if( d > 0.0 ) { return 1e6; }\n \n vec3 o = ro - c;\n float t = - dot( n, o ) / d;\n vec3 q = o + rd * t;\n \n return ( dot( q, q ) < r * r ) ? t : 1e6;\n\n }\n\n // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) \n {\n\n vec3 oc = ro - ce;\n float b = dot( oc, rd );\n float c = dot( oc, oc ) - ra * ra;\n float h = b * b - c;\n \n if( h < 0.0 ) { return -1.0; }\n \n h = sqrt( h );\n \n return - b + h;\n\n }\n\n vec3 project() \n {\n\n vec3 p = normalize( vWorldPosition );\n vec3 camPos = cameraPosition;\n camPos.y -= height;\n\n float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n if( intersection > 0.0 ) {\n \n vec3 h = vec3( 0.0, - height, 0.0 );\n float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n p = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n\n } else {\n\n p = vec3( 0.0, 1.0, 0.0 );\n\n }\n\n return p;\n\n }\n\n #include <common>\n\n void main() \n {\n\n vec3 projectedWorldPosition = project();\n \n #ifdef ENVMAP_TYPE_CUBE\n\n vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n\n #else\n\n vec3 direction = normalize( projectedWorldPosition );\n vec2 uv = equirectUv( direction );\n vec3 outcolor = texture2D( map, uv ).rgb;\n\n #endif\n\n gl_FragColor = vec4( outcolor, 1.0 );\n\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n\n }\n ",s={map:{value:e},height:{value:t.height||15},radius:{value:t.radius||100}},e=new n.IcosahedronGeometry(1,16),t=new n.ShaderMaterial({uniforms:s,fragmentShader:i,vertexShader:"\n varying vec3 vWorldPosition;\n\n void main() \n {\n\n vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n vWorldPosition = worldPosition.xyz;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }\n ",side:n.DoubleSide}),r.call(this,e,t)}return t=a,(e=[{key:"radius",get:function(){return this.material.uniforms.radius.value},set:function(e){this.material.uniforms.radius.value=e}},{key:"height",get:function(){return this.material.uniforms.height.value},set:function(e){this.material.uniforms.height.value=e}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Mesh)){clone(){var e=this.material.uniforms.map.value;const t=new d(e);return t.name=this.name,t.visible=this.visible,t.position.copy(this.position),t.rotation.copy(this.rotation),t.scale.copy(this.scale),t.material.uniforms.height.value=this.material.uniforms.height.value,t.material.uniforms.radius.value=this.material.uniforms.radius.value,t.userData=Object.assign(Object.assign({},this.userData),{id:(0,s.getId)()}),t.material.userData=Object.assign(Object.assign({},this.material.userData),{id:(0,s.getId)()}),t}}var h,p=r(3735),m=r(3263),f=r(9667);class g{constructor(e){this.inited=()=>{this.runScene.modelEx.importAndExport.addParses(g.type,{toNormal:e=>this.process(e),parse:e=>{var{model:e,normal:t}=e;const r=this.create();var n=e.userData.layers;return(0,a.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),r.name=e.name,r.visible=e.visible,r.position.copy(e.position),r.rotation.copy(e.rotation),r.scale.copy(e.scale),r.material=e.material,r}})},this.process=e=>{if(e=e.model,!this.is(e))return e;const t=(0,a.createDefModel)("Box");return t.userData.normal=Object.assign({type:g.type},e.userData),t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.material=e.material,t.scale.copy(e.scale),t},this.runScene=e,this.runScene.cb.inited.add(g.type,this.inited)}setTexture(e,t){this.runScene.materialEx.setTexture({material:e.material,type:"map",newVal:t}),e.material.uniforms.map.value=t}is(e){return(null==(e=e.userData.normal)?void 0:e.type)===g.type}create(){var e=new n.Texture;f.helperTexture.set(e,!0);const t=new d(e);return t.userData.normal={type:g.type},t.scale.set(100,100,100),t.name="地面投影天空球",(0,i.x)(t,(0,s.getId)()),g.tools.bind(t.material),t}}(h=g).type="group-projected",g.tools={type:"group-projected-material",create:e=>e.modelEx.def.create("GroundProjected").material,parseData:(e,t)=>{const{texture:r,normal:n,core:a,material:i}=e;var{height:e,radius:s}=n;const o=h.tools.create(t),{data:l,load:c}=(o.userData.id=i.userData.id,o.uniforms.height.value=e,o.uniforms.radius.value=s,r),u=[];return c&&u.push(...m.F6.filter(l.map((e=>{const t=e.texture;if(t)return()=>{a.runScene.materialEx.setTexture({material:o,type:"map",newVal:t},!1)}})))),{material:o,setTextureFns:u}},toNormal:e=>{var t=e.uniforms.map.value;const r=(0,o.createDefMaterial)(),n=(t&&(r.map=t),r.userData=Object.assign({},e.userData),[]);return t&&n.push({type:"map",texture:t}),{material:r,normal:{type:h.tools.type,height:e.uniforms.height.value,radius:e.uniforms.radius.value},textures:n}},clone:e=>e,copy:e=>e.clone(),getTextures:e=>[{type:"map",texture:e.uniforms.map.value}],bind:e=>{e.userData={type:h.tools.type,normal:{type:h.tools.type},id:(0,s.getId)()}},setTexture:e=>{const{material:t,texture:r}=e;return e=new p.Z({target:t,typeList:["uniforms","map","value"],newVal:r}).execute(),r&&(r.mapping=303,r.needsUpdate=!0),t.needsUpdate=!0,e},getTexture:e=>e.material.uniforms.map.value,textureNames:[{type:"map"}]}},4342:(e,t,r)=>{r.d(t,{Z:()=>c});var n=r(4098),a=r(8089),i=r(7095);class s{constructor(e){this.runScene=e,this.rain=new i.Z(e)}}var o=r(1863),l=r(8990);class c{constructor(e){this.runScene=e,this.vertices=new s(e),this.water=new o.Z(e),this.groundProjected=new l.Z(e)}create(e,t){let r;return r="VerticesRain"===e?this.vertices.rain.create(t):"Water"===e?this.water.create():"2DDom"===e?this.runScene.renderEx.css2dDom.getDef():"3DDom"===e?this.runScene.renderEx.css3dDom.getDef():"3DSprite"===e?this.runScene.renderEx.css3dSprite.getDef():"GroundProjected"===e?this.groundProjected.create():(0,a.Py)(e,t),n.ZP.parseNode(r),r}static getType(e){var t;return(null==(t=null==(t=e.userData)?void 0:t.normal)?void 0:t.type)||(null==(t=e.userData)?void 0:t.type)||e.type}}},7095:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(6001),a=r(8881),i=r(1794),s=r(9106),o=r(3736),l=r(2233),c=r(8609);class u{constructor(e){this.definfo={speed:1,size:10,length:2e3},this.map=new i.Z,this.modelParse={toNormal:e=>{const{model:t,runScene:r}=e,n=(0,c.createDefModel)("Box");e=(0,l.Ki)(t);var a=r.modelEx.def.vertices.rain.map.get(e);if(n.material=t.material,!e||!a)throw TypeError("缺少属性");var{length:e,size:a,speed:i,fog:s}=a;return n.userData.normal={type:u.modelTools.type,length:e,size:a,speed:i,fog:s,materialId:(0,l.Ki)(t.material)},n},parse:e=>{const{runScene:t,normal:r,model:n}=e,a=t.modelEx.def.create(u.modelTools.type,r);return a.material=n.material,a.material.fog=r.fog,a.material.needsUpdate=!0,a.material.userData.id=r.materialId,a}},this.update=()=>{const e=this.runScene.assetsEx.get().camera;this.map.map(((t,r)=>{const{model:n,length:a,speed:i,del:s}=r;if(!s){n.position.set(e.position.x,e.position.y,e.position.z);for(let e=0;e<a;e++)n.geometry.attributes.position.setY(e,n.geometry.attributes.position.getY(e)-i),0<=i?n.geometry.attributes.position.getY(e)<=-1e3&&n.geometry.attributes.position.setY(e,1e3):1e3<=n.geometry.attributes.position.getY(e)&&n.geometry.attributes.position.setY(e,-1e3),n.geometry.attributes.position.needsUpdate=!0}}))},this.tools={type:"VerticesRain",merge:function(e,t){},toNormal:function(e){const t=(0,c.createDefModel)("Box");var r=(0,l.Ki)(e),n=this.map.get(r);if(t.material.map=e.material.map,r&&n)return t.userData.normal=Object.assign({type:this.tools.type},n),t;throw TypeError("缺少属性")},parseData:function(e,t){}},(this.runScene=e).cb.render.add("verticesRain",this.update),e.cb.model.add.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,l.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,l.Ki)(e));t&&(t.del=!0)}})),e.cb.clean.add("verticesRain",(()=>{this.map.clear()}));const{toNormal:t,parse:r}=this.modelParse;e.cb.inited.add("VerticesRain",(()=>{e.modelEx.importAndExport.addParses(u.modelTools.type,{toNormal:t,parse:r})}))}bindMaterial(e,t){(0,o.M)(e,"id",t||(0,n.getId)()),(0,o.M)(e,"type","MyPointsMaterial")}create(e){var t=(e=e||this.definfo).length;const r=new s.Sf.Points(this.createGeo(t),this.createMaterial(e));return r.name="雨雪",r.renderOrder=1,t=(0,n.getId)(),(0,o.M)(r,"id",t),this.bindMaterial(r.material),(0,o.M)(r,"type",this.tools.type),(0,o.M)(r,"normal",{type:this.tools.type}),this.map.set(t,{model:r,length:e.length,size:e.size,speed:e.speed,fog:r.material.fog,del:!1}),r}createGeo(e){let t=[];const r=new a.BufferGeometry;for(let r=0;r<e;r++){var n=2e3*Math.random()-1e3,i=2e3*Math.random()-1e3,s=2e3*Math.random()-1e3;t.push(n,i,s)}return r.setAttribute("position",new a.Float32BufferAttribute(t,3)),r}createMaterial(e){var{size:e,map:t}=e;return new s.Sf.PointsMaterial({blending:s.Sf.AdditiveBlending,depthTest:!1,transparent:!0,size:e,fog:!0,map:t})}setForModel(e){var{model:e,type:t,data:r}=e;(e=(0,l.Ki)(e))&&this.set(e,t,r)}set(e,t,r){const n=this.map.get(e);if(n){const{model:e,size:i}=n;switch(t){case"show":e.visible=r;break;case"length":e.geometry=this.createGeo(r),n[t]=r;break;case"size":var a=e.material;e.material=this.createMaterial({map:e.material.map,size:r}),this.bindMaterial(e.material,(0,l.Ki)(a)),n[t]=r;break;case"speed":n[t]=r;break;case"fog":e.material.fog=r,e.material.needsUpdate=!0,n[t]=r;break;case"texture":a=e.material,e.material=this.createMaterial({map:r,size:i}),this.bindMaterial(e.material,(0,l.Ki)(a))}}}}u.modelTools={type:"VerticesRain",parseData:function(e,t,r){const n=r.modelEx.def.create(u.modelTools.type,t);return n.material=e.material,n.material.userData.id=t.materialId,n},toNormal:(e,t,r)=>{const n=(0,c.createDefModel)("Box");var a=(0,l.Ki)(e);if(t=t.modelEx.def.vertices.rain.map.get(a),n.material=e.material,!a||!t)throw TypeError("缺少属性");var{length:a,size:t,speed:i}=t;return n.userData.normal={type:u.modelTools.type,length:a,size:t,speed:i,materialId:(0,l.Ki)(e.material)},n}}},1863:(e,t,r)=>{r.d(t,{Z:()=>y});var n=r(6001),a=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){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 c,u=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}(n);function n(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=this;if(!(i instanceof(l=n)))throw new TypeError("Cannot call a class as a function");(i=r.call(this,e)).isWater=!0;var s=o(i),l=void 0!==t.textureWidth?t.textureWidth:512,c=(e=void 0!==t.textureHeight?t.textureHeight:512,void 0!==t.clipBias?t.clipBias:0),u=void 0!==t.alpha?t.alpha:1,d=void 0!==t.time?t.time:0,h=void 0!==t.waterNormals?t.waterNormals:null,p=void 0!==t.sunDirection?t.sunDirection:new a.Vector3(.70707,.70707,0),m=new a.Color(void 0!==t.sunColor?t.sunColor:16777215),f=new a.Color(void 0!==t.waterColor?t.waterColor:8355711),g=void 0!==t.eye?t.eye:new a.Vector3(0,0,0),v=void 0!==t.distortionScale?t.distortionScale:20,b=void 0!==t.side?t.side:a.FrontSide,y=(t=void 0!==t.fog&&t.fog,new a.Plane),x=new a.Vector3,w=new a.Vector3,S=new a.Vector3,M=new a.Matrix4,T=new a.Vector3(0,0,-1),_=new a.Vector4,E=new a.Vector3,D=new a.Vector3,O=new a.Vector4,P=new a.Matrix4,k=new a.PerspectiveCamera,A=new a.WebGLRenderTarget(l,e);return l={uniforms:a.UniformsUtils.merge([a.UniformsLib.fog,a.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new a.Matrix4},sunColor:{value:new a.Color(8355711)},sunDirection:{value:new a.Vector3(.70707,.70707,0)},eye:{value:new a.Vector3},waterColor:{value:new a.Color(5592405)}}]),vertexShader:"\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tuniform float time;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <fog_pars_vertex>\n\t\t\t\t#include <shadowmap_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tmirrorCoord = modelMatrix * vec4( position, 1.0 );\n\t\t\t\t\tworldPosition = mirrorCoord.xyzw;\n\t\t\t\t\tmirrorCoord = textureMatrix * mirrorCoord;\n\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t#include <fog_vertex>\n\t\t\t\t#include <shadowmap_vertex>\n\t\t\t}",fragmentShader:"\n\t\t\t\tuniform sampler2D mirrorSampler;\n\t\t\t\tuniform float alpha;\n\t\t\t\tuniform float time;\n\t\t\t\tuniform float size;\n\t\t\t\tuniform float distortionScale;\n\t\t\t\tuniform sampler2D normalSampler;\n\t\t\t\tuniform vec3 sunColor;\n\t\t\t\tuniform vec3 sunDirection;\n\t\t\t\tuniform vec3 eye;\n\t\t\t\tuniform vec3 waterColor;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\tvec4 getNoise( vec2 uv ) {\n\t\t\t\t\tvec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);\n\t\t\t\t\tvec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );\n\t\t\t\t\tvec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );\n\t\t\t\t\tvec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );\n\t\t\t\t\tvec4 noise = texture2D( normalSampler, uv0 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv1 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv2 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv3 );\n\t\t\t\t\treturn noise * 0.5 - 1.0;\n\t\t\t\t}\n\n\t\t\t\tvoid sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {\n\t\t\t\t\tvec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );\n\t\t\t\t\tfloat direction = max( 0.0, dot( eyeDirection, reflection ) );\n\t\t\t\t\tspecularColor += pow( direction, shiny ) * sunColor * spec;\n\t\t\t\t\tdiffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <packing>\n\t\t\t\t#include <bsdfs>\n\t\t\t\t#include <fog_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <lights_pars_begin>\n\t\t\t\t#include <shadowmap_pars_fragment>\n\t\t\t\t#include <shadowmask_pars_fragment>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\tvec4 noise = getNoise( worldPosition.xz * size );\n\t\t\t\t\tvec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );\n\n\t\t\t\t\tvec3 diffuseLight = vec3(0.0);\n\t\t\t\t\tvec3 specularLight = vec3(0.0);\n\n\t\t\t\t\tvec3 worldToEye = eye-worldPosition.xyz;\n\t\t\t\t\tvec3 eyeDirection = normalize( worldToEye );\n\t\t\t\t\tsunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );\n\n\t\t\t\t\tfloat distance = length(worldToEye);\n\n\t\t\t\t\tvec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;\n\t\t\t\t\tvec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );\n\n\t\t\t\t\tfloat theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );\n\t\t\t\t\tfloat rf0 = 0.3;\n\t\t\t\t\tfloat reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );\n\t\t\t\t\tvec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;\n\t\t\t\t\tvec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);\n\t\t\t\t\tvec3 outgoingLight = albedo;\n\t\t\t\t\tgl_FragColor = vec4( outgoingLight, alpha );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <fog_fragment>\n\t\t\t\t}"},(e=new a.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:a.UniformsUtils.clone(l.uniforms),lights:!0,side:b,fog:t})).uniforms.mirrorSampler.value=A.texture,e.uniforms.textureMatrix.value=P,e.uniforms.alpha.value=u,e.uniforms.time.value=d,e.uniforms.normalSampler.value=h,e.uniforms.sunColor.value=m,e.uniforms.waterColor.value=f,e.uniforms.sunDirection.value=p,e.uniforms.distortionScale.value=v,e.uniforms.eye.value=g,s.material=e,s.onBeforeRender=function(e,t,r){var n,a,i;w.setFromMatrixPosition(s.matrixWorld),S.setFromMatrixPosition(r.matrixWorld),M.extractRotation(s.matrixWorld),x.set(0,0,1),x.applyMatrix4(M),E.subVectors(w,S),0<E.dot(x)||(E.reflect(x).negate(),E.add(w),M.extractRotation(r.matrixWorld),T.set(0,0,-1),T.applyMatrix4(M),T.add(S),D.subVectors(w,T),D.reflect(x).negate(),D.add(w),k.position.copy(E),k.up.set(0,1,0),k.up.applyMatrix4(M),k.up.reflect(x),k.lookAt(D),k.far=r.far,k.updateMatrixWorld(),k.projectionMatrix.copy(r.projectionMatrix),P.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),P.multiply(k.projectionMatrix),P.multiply(k.matrixWorldInverse),y.setFromNormalAndCoplanarPoint(x,w),y.applyMatrix4(k.matrixWorldInverse),_.set(y.normal.x,y.normal.y,y.normal.z,y.constant),n=k.projectionMatrix,O.x=(Math.sign(_.x)+n.elements[8])/n.elements[0],O.y=(Math.sign(_.y)+n.elements[9])/n.elements[5],O.z=-1,O.w=(1+n.elements[10])/n.elements[14],_.multiplyScalar(2/_.dot(O)),n.elements[2]=_.x,n.elements[6]=_.y,n.elements[10]=_.z+1-c,n.elements[14]=_.w,g.setFromMatrixPosition(r.matrixWorld),n=e.getRenderTarget(),a=e.xr.enabled,i=e.shadowMap.autoUpdate,s.visible=!1,e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(A),e.state.buffers.depth.setMask(!0),!1===e.autoClear&&e.clear(),e.render(t,k),s.visible=!0,e.xr.enabled=a,e.shadowMap.autoUpdate=i,e.setRenderTarget(n),void 0!==(t=r.viewport)&&e.state.viewport(t))},i}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(a.Mesh),d=r(1794),h=r(135),p=(t=r(4707),r(9106)),m=r(3736),f=r(2233),g=r(8089),v=r(8609),b=r(3735);t.Gf.fog;class y{constructor(e){this.catchModel=new d.Z,this.map=new d.Z,this.inited=()=>{this.runScene.cb.render.add(y.type,this.render),this.runScene.cb.model.add.add(y.type,this.onModelAdd),this.runScene.cb.model.remove.add(y.type,this.onModelDel),this.runScene.modelEx.importAndExport.addParses("Water",{toNormal:e=>this.process(e),parse:e=>{const t=this.create();return e=e.model,t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),this.catchModel.set(e.userData.normal.id,{model:t,material:t.material}),t.material=e.material,t.userData=Object.assign({},e.userData),t}}),this.runScene.cb.loaderer.gltf.complete.add("water-model",this.complete),this.runScene.cb.load.complete.add("water-model",this.complete)},this.complete=()=>{this.catchModel.map(((e,t)=>{const{model:r,material:n}=t;t=r.material,y.mergeMaterial(t,n),this.bindMaterialData(n),r.material=n})),this.catchModel.clear()},this.process=e=>{if(e=e.model,!this.is(e))return e;const t=(0,v.createDefModel)("Box");return t.userData.normal=Object.assign({type:"Water"},e.userData),t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.material=e.material,t},this.onModelAdd=e=>{var t;this.is(e.model)&&(e=e.model,(t=(0,f.Ki)(e))&&this.map.set(t,e))},this.onModelDel=e=>{this.is(e.model)&&(e=e.model,(e=(0,f.Ki)(e))&&this.map.delete(e))},this.render=()=>{0!==this.map.size&&this.map.map(((e,t)=>{t.material.uniforms.time.value+=t.material.userData.speed||1/60}))},this.runScene=e,this.runScene.cb.inited.add(y.type,this.inited)}create(){const e=new u(new a.PlaneGeometry(1e3,1e3),{textureWidth:512,textureHeight:512,sunDirection:new p.Sf.Vector3,sunColor:16711680,waterColor:16777215,distortionScale:3.7});return this.bindData(e),e.rotation.x=-Math.PI/2,e}static create(){const e=new u(new a.PlaneGeometry(1e3,1e3),{textureWidth:512,textureHeight:512,sunDirection:new p.Sf.Vector3,sunColor:16711680,waterColor:16777215,distortionScale:3.7});return e.rotation.x=-Math.PI/2,e}is(e){return"Water"===(null==(e=e.userData.normal)?void 0:e.type)}bindData(e){e.userData.normal={type:"Water"},e.name="water",this.bindMaterialData(e.material)}bindMaterialData(e){e.userData.type="Water",e.userData.id=e.userData.id||(0,n.getId)(),e.userData.tools=y.tools}set(e,t,r){e.material[t]=r}static mergeMaterial(e,t){var{fog:r,side:n}=e,{waterColor:a,distortionScale:i,normalSampler:s}=e.uniforms;t.fog=r,t.side=n,t.uniforms.normalSampler.value=s.value,t.uniforms.waterColor.value.copy(a.value),t.uniforms.distortionScale.value=i.value,t.userData=Object.assign({},e.userData)}}(c=y).type="water-model",y.tools={type:"Water",bind(e){(0,m.M)(e,"type","Water")},getTextures:e=>["normalSampler"].map((t=>{var r=e.uniforms[t].value;if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{const e=c.create();return e.material.type=c.tools.type,e.material.userData.tools=c.tools,e.material},parseData:(e,t)=>{const{texture:r,material:n,normal:a}=e,{data:i,load:s}=r,o=[],l=c.tools.create(t);var{side:e,fog:u,waterColor:d,distortionScale:h,speed:p}=a;return l.fog=void 0===u||u,e&&(l.side=e),d&&(l.uniforms.waterColor.value=(0,g.ZD)(d)),void 0!==h&&(l.uniforms.distortionScale.value=h),void 0!==p&&(n.userData.speed=p),s&&o.push(...i.map((e=>{const{type:r,texture:n}=e;return()=>{t.materialEx.setTexture({material:l,type:r,newVal:n},!1)}}))),l.userData=Object.assign({},n.userData),{material:l,setTextureFns:o}},setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new b.Z({target:t,typeList:["uniforms",r,"value"],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e.uniforms[t].value},toNormal:e=>{const t=(0,h.createDefMaterial)();var r={type:"Water",id:(0,f.Ki)(t)};const n={type:"Water"};return e.fog||(n.fog=!1),0!==e.side&&(n.side=e.side),e.userData.speed&&(n.speed=e.userData.speed),n.waterColor=e.uniforms.waterColor.value.getHexString(),n.distortionScale=e.uniforms.distortionScale.value,t.userData=r,{normal:n,textures:y.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=y.tools.type,t},textureNames:[{type:"normalSampler"}]}},228:(e,t,r)=>{r.d(t,{Q:()=>h,S:()=>p});var n=r(9106),a=r(8881),i=r(4819),s=r(6608);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=c(n);function n(e,t,o,l){var c;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(c=r.call(this)).renderScene=t,c.renderCamera=o,c.selectedObjects=void 0!==l?l:[],c.visibleEdgeColor=new a.Color(1,1,1),c.hiddenEdgeColor=new a.Color(.1,.04,.02),c.edgeGlow=0,c.usePatternTexture=!1,c.edgeThickness=1,c.edgeStrength=3,c.downSampleRatio=2,c.pulsePeriod=0,c._visibilityCache=new Map,c.resolution=void 0!==e?new a.Vector2(e.x,e.y):new a.Vector2(256,256),t=Math.round(c.resolution.x/c.downSampleRatio),o=Math.round(c.resolution.y/c.downSampleRatio),c.renderTargetMaskBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetMaskBuffer.texture.name="OutlinePass.mask",c.renderTargetMaskBuffer.texture.generateMipmaps=!1,c.depthMaterial=new a.MeshDepthMaterial,c.depthMaterial.side=a.DoubleSide,c.depthMaterial.depthPacking=a.RGBADepthPacking,c.depthMaterial.blending=a.NoBlending,c.prepareMaskMaterial=c.getPrepareMaskMaterial(),c.prepareMaskMaterial.side=a.DoubleSide,c.prepareMaskMaterial.fragmentShader=function(e,t){return t=t.isPerspectiveCamera?"perspective":"orthographic",e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(c.prepareMaskMaterial.fragmentShader,c.renderCamera),c.renderTargetDepthBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetDepthBuffer.texture.name="OutlinePass.depth",c.renderTargetDepthBuffer.texture.generateMipmaps=!1,c.renderTargetMaskDownSampleBuffer=new a.WebGLRenderTarget(t,o),c.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",c.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,c.renderTargetBlurBuffer1=new a.WebGLRenderTarget(t,o),c.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",c.renderTargetBlurBuffer1.texture.generateMipmaps=!1,c.renderTargetBlurBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),c.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",c.renderTargetBlurBuffer2.texture.generateMipmaps=!1,c.edgeDetectionMaterial=c.getEdgeDetectionMaterial(),c.renderTargetEdgeBuffer1=new a.WebGLRenderTarget(t,o),c.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",c.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,c.renderTargetEdgeBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),c.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",c.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,c.separableBlurMaterial1=c.getSeperableBlurMaterial(4),c.separableBlurMaterial1.uniforms.texSize.value.set(t,o),c.separableBlurMaterial1.uniforms.kernelRadius.value=1,c.separableBlurMaterial2=c.getSeperableBlurMaterial(4),c.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(t/2),Math.round(o/2)),c.separableBlurMaterial2.uniforms.kernelRadius.value=4,c.overlayMaterial=c.getOverlayMaterial(),l=s.C,c.copyUniforms=a.UniformsUtils.clone(l.uniforms),c.copyUniforms.opacity.value=1,c.materialCopy=new a.ShaderMaterial({uniforms:c.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:a.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),c.enabled=!0,c.needsSwap=!1,c._oldClearColor=new a.Color,c.oldClearAlpha=1,c.fsQuad=new i.T(null),c.tempPulseColor1=new a.Color,c.tempPulseColor2=new a.Color,c.textureMatrix=new a.Matrix4,c}return t=n,(e=[{key:"dispose",value:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose(),this.depthMaterial.dispose(),this.prepareMaskMaterial.dispose(),this.edgeDetectionMaterial.dispose(),this.separableBlurMaterial1.dispose(),this.separableBlurMaterial2.dispose(),this.overlayMaterial.dispose(),this.materialCopy.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t),e=Math.round(e/this.downSampleRatio),t=Math.round(t/this.downSampleRatio),this.renderTargetMaskDownSampleBuffer.setSize(e,t),this.renderTargetBlurBuffer1.setSize(e,t),this.renderTargetEdgeBuffer1.setSize(e,t),this.separableBlurMaterial1.uniforms.texSize.value.set(e,t),e=Math.round(e/2),t=Math.round(t/2),this.renderTargetBlurBuffer2.setSize(e,t),this.renderTargetEdgeBuffer2.setSize(e,t),this.separableBlurMaterial2.uniforms.texSize.value.set(e,t)}},{key:"changeVisibilityOfSelectedObjects",value:function(e){var t=this._visibilityCache;function r(r){r.isMesh&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}for(var n=0;n<this.selectedObjects.length;n++)this.selectedObjects[n].traverse(r)}},{key:"changeVisibilityOfNonSelectedObjects",value:function(e){var t=this._visibilityCache,r=[];function n(e){e.isMesh&&r.push(e)}for(var a=0;a<this.selectedObjects.length;a++)this.selectedObjects[a].traverse(n);this.renderScene.traverse((function(n){if(n.isMesh||n.isSprite){for(var a,i=!1,s=0;s<r.length;s++)if(r[s].id===n.id){i=!0;break}!1===i&&(a=n.visible,!1!==e&&!0!==t.get(n)||(n.visible=e),t.set(n,a))}else(n.isPoints||n.isLine)&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}))}},{key:"updateTextureMatrix",value:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}},{key:"render",value:function(e,t,r,a,i){var s,o;0<this.selectedObjects.length&&(e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha(),s=e.autoClear,e.autoClear=!1,i&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1),o=this.renderScene.background,this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=o,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),0<this.pulsePeriod&&(o=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2,this.tempPulseColor1.multiplyScalar(o),this.tempPulseColor2.multiplyScalar(o)),this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,i&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s),this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=r.texture,e.setRenderTarget(null),this.fsQuad.render(e))}},{key:"getPrepareMaskMaterial",value:function(){return new a.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new a.Vector2(.5,.5)},textureMatrix:{value:null}},vertexShader:"#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t\tvPosition = mvPosition;\n\n\t\t\t\t\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t\t\t\t\t#ifdef USE_INSTANCING\n\n\t\t\t\t\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t\t\t\t\t#endif\n\t\t\t\t\t\n\t\t\t\t\tworldPosition = modelMatrix * worldPosition;\n\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\n\t\t\t\t}",fragmentShader:"#include <packing>\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n\t\t\t\t}"})}},{key:"getEdgeDetectionMaterial",value:function(){return new a.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},visibleEdgeColor:{value:new a.Vector3(1,1,1)},hiddenEdgeColor:{value:new a.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}},{key:"getSeperableBlurMaterial",value:function(e){return new a.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},direction:{value:new a.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat sigma = kernelRadius/2.0;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, sigma);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = kernelRadius * float(i) / float(MAX_RADIUS);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, sigma);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}},{key:"getOverlayMaterial",value:function(){return new a.ShaderMaterial({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n\t\t\t\t}",blending:a.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.w);d.BlurDirectionX=new a.Vector2(1,0),d.BlurDirectionY=new a.Vector2(0,1);class h{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new d(this.mtuPP.rtSize,this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.outlinePass)}setOutlineData(e,t){this.outlinePass[e]="visibleEdgeColor"===e||"hiddenEdgeColor"===e?new n.Sf.Color(t):t}dispose(){this.outlinePass&&(this.outlinePass.dispose(),this.outlinePass=null)}addSelectedObject(e,t=!0){this.outlinePass&&e&&(this.outlinePass.selectedObjects||(this.outlinePass.selectedObjects=[]),t?this.isObjExist(e)||(e.userData.outline=!0,this.outlinePass.selectedObjects.push(e)):this.outlinePass.selectedObjects.map(((t,r)=>{t.uuid===e.uuid&&(e.userData.outline=!1,this.outlinePass.selectedObjects.splice(r,1))})))}clearAllOutlineObj(){this.outlinePass&&(this.outlinePass.selectedObjects=[])}isObjExist(e){if(!e||!this.outlinePass||!this.outlinePass.selectedObjects)return!1;let t=!1;return this.outlinePass.selectedObjects.forEach((r=>{e.uuid===r.uuid&&(t=!0)})),t}enablePass(e){this.outlinePass&&this.outlinePass.enabled!==e&&(this.outlinePass.enabled=e)}}const p=e=>e.userData.outline},9583:(e,t,r)=>{r.d(t,{ZP:()=>v,sH:()=>b});var n=r(8881),a=r(699),i=r(1794),s=r(8609),o=r(3736),l=r(2233);class c{constructor(e){this.calls={toNormal:e=>{const t=(0,s.createDefModel)("Box");var r=this.getSizeByModel(e.model);return t.userData=Object.assign(Object.assign({},e.model.userData),{name:e.model.name,size:r}),t.position.copy(e.model.position),t},parse:e=>{e=e.model;var{name:t,size:r,id:n,alpha:a}=e.userData;const i=this.getDef(t);return i.position.copy(e.position),i.name=t,this.setSizeForModel(i,r),a&&this.setAlpha(i,a),(0,o.M)(i,"id",n),i}},this.map=new i.Z,this.onModelAdd=e=>{e=e.model,this.is(e)&&(this.map.set((0,l.Ki)(e),!0),this.onMapSet())},this.onModelDel=e=>{e=e.model,this.is(e)&&(this.map.delete((0,l.Ki)(e)),this.onMapSet())},(this.runScene=e).cb.inited.add("cssRender",(()=>{this.initEvent()}))}initEvent(){this.runScene.cb.unique.model.add.add("cssRender",this.onModelAdd),this.runScene.cb.unique.model.remove.add("cssRender",this.onModelDel),this.runScene.modelEx.importAndExport.addParses(this.type,this.calls)}onMapSet(){this.setState(0!==this.map.size)}getDom(e,t){let r;if(!(r=t?document.querySelector("."+t):r)){const t=document.createElement("div");t.style.width="100px",t.style.height="70px",t.classList.add(this.prefix+"_model_"+e),t.style.backgroundColor="#fff",this.runScene.assetsEx.engineDom.appendChild(t),r=t}return r}getSizeByModel(e){var{width:t,height:r}=e.element.getBoundingClientRect();return{width:(null==(e=e.userData.size)?void 0:e.width)||t||100,height:(null==e?void 0:e.height)||r||70}}setSizeForModel(e,t){if(t&&"editor"===this.runScene.optionsEx.options.mode){var{width:t,height:r}=t;const n=e.element;n.style.width=t+"px",n.style.height=r+"px",e.userData.size||(e.userData.size={}),e.userData.size.width=t,e.userData.size.height=r}}setBgc(e){const{model:t,url:r}=e;t.userData.url=r,t.element.style.backgroundImage=`url(${r})`,t.element.style.backgroundSize="100% 100%"}setAlpha(e,t){e.userData.alpha=t,e.element.style.backgroundColor=t?"rgba(0,0,0,0)":"rgb(255,255,255)"}}var u=r(6001);class d extends c{constructor(){super(...arguments),this.type="Css2dDom",this.prefix="Css2dDom"}getDef(){var e=(0,u.getId)();const t=new a.j(this.getDom(e));return(0,o.M)(t,"id",e),(0,o.M)(t,"normal",{type:this.type}),t.name=this.type,t.element.addEventListener("pointerdown",(()=>{this.runScene.events.mouse.catchTrigger=t})),t}is(e){return(null==(e=(0,o.is)(e,"normal"))?void 0:e.type)===this.type}setState(e){this.runScene.globalConfig.setRender2(e)}}var h=r(3693),p=r(6272);class m extends c{constructor(){super(...arguments),this.type="Css3dDom",this.prefix="Css3dDom"}getDef(){var e=(0,u.getId)();const t=new h.cp(this.getDom(e));return(0,o.M)(t,"id",e),(0,o.M)(t,"normal",{type:this.type}),t.name=this.type,t.element.addEventListener("pointerdown",(()=>{this.runScene.events.mouse.catchTrigger=t})),t}is(e){var t;return(null==(t=(0,o.is)(e,"normal"))?void 0:t.type)===this.type||(null==(t=(0,o.is)(e,"normal"))?void 0:t.type)===this.runScene.renderEx.css3dSprite.type}setState(e){this.runScene.globalConfig.setRender3(e)}setBgc(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{model:t,url:r}=e;t.userData.url=r;var n=yield(0,p.o4)(r);t.element.appendChild(n)}))}}class f extends c{constructor(){super(...arguments),this.type="Css3dSprite",this.prefix="Css3dSprite"}getDef(e){var t=(0,u.getId)();const r=new h.P7(this.getDom(t,e));return(0,o.M)(r,"id",t),(0,o.M)(r,"normal",{type:this.type}),r.name=this.type,r.element.addEventListener("pointerdown",(()=>{this.runScene.events.mouse.catchTrigger=r})),r}is(e){var t;return(null==(t=(0,o.is)(e,"normal"))?void 0:t.type)===this.type||(null==(t=(0,o.is)(e,"normal"))?void 0:t.type)===this.runScene.renderEx.css3dDom.type}setState(e){this.runScene.globalConfig.setRender3(e)}}var g=r(6292);class v{constructor(e){this.pixelRatio=1,this.ratio=0,this.inited=()=>{this.runScene.exporter.gltf.options.addOption({type:"renderer",process:()=>{var{outputEncoding:e,toneMapping:t,toneMappingExposure:r}=this.runScene.assetsEx.renderer;const n={outputEncoding:e,toneMapping:t,toneMappingExposure:r};return 1!==this.pixelRatio&&(n.pixelRatio=this.pixelRatio),0!==this.ratio&&(n.ratio=this.ratio),JSON.stringify(n)},parse:e=>{var t,r,n,a;e&&(({outputEncoding:e,toneMapping:t,toneMappingExposure:r,pixelRatio:n,ratio:a}=JSON.parse(e)),this.setEncoding(3e3===e?"def":"srgb"),this.setToneMapping(Object.keys(y)[t]),this.setExposure(r),this.setRatio(a||0),void 0!==n&&this.setPixelRatio(n))}})},this.setSize=(e,t)=>{var{width:r,height:n}=this.getDomSize(),r=(e=e||r,t||n);this.runScene.setSize(e,r),this.runScene.cb.renderEx.setSize.cb({width:e,height:r})},this.runScene=e,this.css2dDom=new d(e),this.css3dDom=new m(e),this.css3dSprite=new f(e),this.runScene.cb.resize.add("render-ex-resize",(({width:e,height:t})=>{this.setSize(e,t)})),e.cb.inited.add("render",this.inited)}setRatio(e){this.ratio=e;const t=this.runScene.assetsEx.engineDom;if(t){var{width:r,height:n}=t.getBoundingClientRect();let a=r,i=n;(i=0!==e?a*e:i)>n&&(i=n,a=n/e),this.runScene.cb.resize.cb({width:a,height:i})}}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e||""}setPixelRatio(e){this.pixelRatio=e,this.runScene.assetsEx.renderer.setPixelRatio(e)}create(e){let t=new n.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance",precision:"highp"});return t.domElement.style.position="absolute",t.setPixelRatio(this.pixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=n.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}setEncoding(e){this.runScene.assetsEx.renderer.outputEncoding="def"===e?g.Z.LinearEncoding:g.Z.sRGBEncoding}setToneMapping(e){this.runScene.assetsEx.renderer.toneMapping=y[e]}setExposure(e){this.runScene.assetsEx.renderer.toneMappingExposure=e}getDomSize(){var{width:e,height:t}=this.runScene.assetsEx.get().engineDom.getBoundingClientRect();return{width:e,height:t}}}const b=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()},y={NoToneMapping:g.Z.NoToneMapping,LinearToneMapping:g.Z.LinearToneMapping,ReinhardToneMapping:g.Z.ReinhardToneMapping,CineonToneMapping:g.Z.CineonToneMapping,ACESFilmicToneMapping:g.Z.ACESFilmicToneMapping,CustomToneMapping:g.Z.CustomToneMapping}},9106:(e,t,r)=>{r.d(t,{Gc:()=>Ca,al:()=>bt,ch:()=>d,Az:()=>D,Sf:()=>La,cQ:()=>u,ZP:()=>Ra}),t={};var n=(r.r(t),r.d(t,{FBXLoader:()=>Cr}),r(3300)),a=r.n(n),i=r(6001),s=r(8881);class o{constructor(e){this.runScene=e}}var l=r(2353),c=r(6292),u=r(5317),d=r(8609);class h extends o{constructor(e){super(e),this.map={},this.clock=new s.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},this.clean=()=>{this.reset()},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)})),e.cb.model.remove.add("anima-parse",(({model:e})=>{this.onModelDelete(e)})),this.runScene.cb.clean.add("EngineHelper",this.clean)}onModelDelete(e){e.traverse((e=>{(0,d.withAnima)(e)&&e.animations.map((t=>{t.id&&(this.close(e,t.name),delete this.map[t.id])}))}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const r of e.animations)if(r.name===t)return r.id}parse(e,t){if(0!==e.animations.length||t){const a=e.animations.length?e.animations:l.B.parse(t),o=new s.AnimationMixer(e);for(const t of a){var r=(0,i.getId)(),n=(t.id=r,o.clipAction(t));const a={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>a.finished())),o.addEventListener("loop",(()=>a.loop())),this.map[r]={mixer:o,action:n,model:e,time:0,runState:"close",clip:t,eventMap:a}}a.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,r){e=this.findId(e,t);const n=this.map[e];if(n&&!this.playings.has(n)){t=(0,u.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:a,onBeforeEnd:i,onLoop:s,onFinished:o,lastFrame:l,loop:d,reset:h}=t,{action:p,clip:m,eventMap:f}=(this.map[e].options=t,n);p.stop(),r=h?0:n.time,p.time=r,this.setPlayState(n,!0),h&&p.reset(),p.play();let g=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,u.getProgress)(p.time,m.duration,!0);99<=e&&!g&&(i(),g=!0),a(e)})),d?(p.loop=c.Z.LoopRepeat,f.loop=s):(l&&(p.clampWhenFinished=!0),p.loop=c.Z.LoopOnce,f.finished=()=>{this.setPlayState(n,!1),a(100),o()})}}pause(e,t){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&(this.updateTime(r),this.setPlayState(r,!1),r.options.onPause(),r.runState="pause")}resume(e,t){var r=this.findId(e,t);const n=this.map[r];n&&this.playings.has(n)&&(n.options.onResume(),this.play(e,t,null==(r=this.map[t])?void 0:r.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e);const t=e.action;t.time=0,t.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((r=>{const{mixer:n,action:a}=this.map[r];a.play(),a.time=e,n.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,i.mapObj)(this.updates,((e,r)=>r(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){const{mixer:t,action:r}=e;r.reset(),r.stop(),t.time=0}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,r){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&n.options&&((t=(0,u.mergeObject)({resetAction:!0},r).resetAction)&&n.action.reset(),this.setPlayState(n,!1),this.updateTime(n,0),n.options.onClose(),n.options=null,n.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:r,nextName:n,duration:a}=e;e=this.findId(e,t);const i=this.map[e];i&&(t=this.findId(r,n),(e=this.map[t])&&i.action.crossFadeTo(e.action,a,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}var p=r(1794);class m{constructor(e){this.map={material:new p.Z,texture:new p.Z},this.onSet=e=>{var{type:e,id:t,isAdd:r}=e;r?(r=this.map[e].get(t)||0,this.map[e].set(t,++r)):this.map[e].get(t)&&(r=this.map[e].get(t),this.map[e].set(t,--r))},this.runScene=e,this.init()}init(){this.runScene.cb.assets.manager.set.add("AssetsManager",this.onSet)}isUsed(e,t){return void 0!==(e=this.map[e].get(t))&&0<e}}var f=r(3693),g=r(699);class v{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.clean=()=>{var e=this.get().camera;this.runScene.controlsEx.reset(),this.runScene.cameraEx.reset(e)},this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e,this.manager=new m(e),this.runScene.cb.clean.add("assets",this.clean)}initRender3(){const e=new f.lX;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.style.top=String(0),e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),this.runScene.cb.resize.add("render-3",(({width:t,height:r})=>{e.setSize(t,r)})),e}initRender2(){const e=new g.M;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.classList.add("css2dRenderer"),e.domElement.style.top="0px",e.domElement.style.left="0px",this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),this.runScene.cb.resize.add("render-2",(({width:t,height:r})=>{e.setSize(t,r)})),e}reset(){var e=this.get().camera;this.runScene.renderEx.setSize(),this.runScene.cameraEx.reset(e),this.runScene.controlsEx.reset()}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}setRender2(e){this.render2&&e||(e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null))}setRender3(e){this.render3&&e||(e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null))}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.pCam,n=this.runScene.renderEx.create(e),a=this.runScene.controlsEx.create(r,e),{render2:i,render3:s}=this.runScene.optionsEx.options;return this.camera=r,this.scene=t,this.renderer=n,this.controls=a,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(i),this.setRender3(s),{scene:t,camera:r,render:n,controls:a,engineDom:e}}get(){var{scene:e,renderer:t,controls:r,engineDom:n,render2:a,render3:i}=this;return{scene:e,camera:this.runScene.cameraEx.getCamera(),renderer:t,controls:r,engineDom:n,render2:a,render3:i}}}var b=r(3801),y=r(6272),x=r(7995);class w{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.window={pointerup:e=>{this.events.runScene.cb.events.window.pointer.up.cb({event:e})}},this.down=e=>{0!==e.button&&2!==e.button||(this.downPosition[e.button]={x:e.pageX,y:e.pageY}),this.isMove=!0},this.up=e=>{var t,r,n,a;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.pageX,r=e.pageY,({x:n,y:a}=this.downPosition[e.button]),(0,y.nx)(t,n,10)&&(0,y.nx)(r,a,10)&&(0===e.button&&this.trigger(e),2===e.button&&(!this.events.runScene.modelEx.select&&this.events.runScene.multipSelector.isEmpty()&&this.trigger(e),this.events.runScene.cb.events.pointer.rightTrigger.cb(e))))},this.selectable=!0,this.events=e}getEventLocal(e,t){var{top:e,left:r,width:n,height:a}=e.getBoundingClientRect();return{x:(t.pageX-r)/n*2-1,y:-(t.pageY-e)/a*2+1}}init(e){var t=this.events.runScene.optionsEx.options.event.base;let r=e;"dom"===t?r=e:"canvas"===t?r=this.events.runScene.assetsEx.renderer.domElement:"window"===t&&(r=window),this.events.addEvent({dom:r,name:"pointerdown",fn:this.down.bind(this)}),this.events.addEvent({dom:window,name:"pointerup",fn:this.up.bind(this)}),this.events.addEvent({dom:r,name:"pointerdown",fn:this.events.runScene.cb.events.pointer.down.cb}),this.events.addEvent({dom:r,name:"pointerup",fn:this.events.runScene.cb.events.pointer.up.cb}),this.events.addEvent({dom:r,name:"pointermove",fn:e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)}}),this.events.addEvent({dom:r,name:"mousemove",fn:this.events.runScene.cb.events.mouse.move.cb}),this.events.addEvent({dom:r,name:"mousedown",fn:this.events.runScene.cb.events.mouse.down.cb}),this.events.addEvent({dom:r,name:"mouseup",fn:this.events.runScene.cb.events.mouse.up.cb}),this.events.addEvent({dom:window,name:"pointerup",fn:this.window.pointerup})}getTriggerModels(e,t){const r=new s.Raycaster;var{camera:n,scene:a,renderer:i}=this.events.runScene.assetsEx.get(),{x:i,y:e}=this.getEventLocal(i.domElement,e),i=new s.Vector2(i,e);r.setFromCamera(i,n),e=(t||a.children).filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e}));const o=r.intersectObjects(e,!0);return this.events.runScene.cb.events.pointer.trigger.cb(o),o.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!b.zf.isLock(e,!0)&&d.selectableModel.is(e)))}set catchTrigger(e){this._catchTrigger=e}get catchTrigger(){var e=this._catchTrigger;return this._catchTrigger=void 0,e}trigger(e){let t=this.removeHideOrLockModel(this.getTriggerModels(e))||this.catchTrigger;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,e=this.events.runScene.modelEx.select,this.events.runScene.modelEx.selectNull(),e&&this.events.runScene.multipSelector.add(e),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,!0,!0)})):void 0}this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}}function S(){var e=0,t=document.createElement("div");function r(e){return t.appendChild(e.dom),e}function n(r){for(var n=0;n<t.children.length;n++)t.children[n].style.display=n===r?"block":"none";e=r}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(r){r.preventDefault(),n(++e%t.children.length)}),!1);var a,i=(performance||Date).now(),s=i,o=0,l=r(new S.Panel("FPS","#0ff","#002")),c=r(new S.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(a=r(new S.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){i=(performance||Date).now()},end:function(){o++;var e,t=(performance||Date).now();return c.update(t-i,200),s+1e3<=t&&(l.update(1e3*o/(t-s),100),s=t,o=0,a&&(e=performance.memory,a.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){i=this.end()},domElement:t,setMode:n}}w.getCallback=()=>({up:new x.Z}),S.Panel=function(e,t,r){var n=1/0,a=0,i=Math.round,s=i(window.devicePixelRatio||1),o=80*s,l=48*s,c=3*s,u=2*s,d=3*s,h=15*s,p=74*s,m=30*s,f=document.createElement("canvas"),g=(f.width=o,f.height=l,f.style.cssText="width:80px;height:48px",f.getContext("2d"));return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=r,g.fillRect(0,0,o,l),g.fillStyle=t,g.fillText(e,c,u),g.fillRect(d,h,p,m),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(d,h,p,m),{dom:f,update:function(l,v){n=Math.min(n,l),a=Math.max(a,l),g.fillStyle=r,g.globalAlpha=1,g.fillRect(0,0,o,h),g.fillStyle=t,g.fillText(i(l)+" "+e+" ("+i(n)+"-"+i(a)+")",c,u),g.drawImage(f,d+s,h,p-s,m,d,h,p-s,m),g.fillRect(d+p-s,h,s,m),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(d+p-s,h,s,i((1-l/v)*m))}}};const M=S;class T{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,stop:!1,event:{trigger:!0,ignores:[]}},event:{base:"dom"},texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1},pp:{open:!0,glow:{open:!1}}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,u.getTime)(7)},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:r,cb:n}=t;e&&clearTimeout(e),e=setTimeout((()=>{n(),e=null,clearTimeout(e)}),r)}})(),this.runScene=e,this.options=(0,u.deepMergeObject)(this.options,t||{})}init(e){this.options.showFps&&(this.addFps(e),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(e){this.stats=M(),this.stats.showPanel(0),e.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",r="success"){var n;null!=(n=null==(n=this.options)?void 0:n.msg)&&n.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:r}),console.log(e))}}const _=e=>e.optionsEx.options;class E{constructor(e){this.list=new p.Z,this.add=e=>{"editor"===_(this.runScene).mode&&(this.list.has(e.id)&&(this.list.delete(e.id),this.runScene.cb.msg.del.cb({id:e.id})),this.list.set(e.id,e))},this.del=e=>{"editor"===_(this.runScene).mode&&this.list.delete(e.id)},this.clean=()=>{this.list.clear()},(this.runScene=e).cb.msg.add.add("msg-add",this.add),e.cb.msg.del.add("msg-del",this.del),e.cb.clean.add("msg",this.clean)}static getCallbackMap(){return{add:new x.Z,del:new x.Z}}}var D=r(9667);class O{constructor(e){this.all=0,this.set=e=>{var{size:e,isAdd:t,type:r}=e;t?this.all+=e:this.all-=e,this.runScene.cb.msg.add.cb({tipType:"info",type:"size",id:"size",data:[{isAdd:t,now:e,all:this.all,subType:r}]})},(this.runScene=e).cb.unique.geometry.add.add("size-add",(({geometry:t})=>{this.set({size:e.uniqueEx.geometry.getSize(t),isAdd:!0,type:"geometry"})})),e.cb.texture.add.add("size-del",(e=>{this.set({size:(0,D.getTextureSize)(e),isAdd:!0,type:"texture"})})),e.cb.texture.remove.add("size-del",(e=>{this.set({size:(0,D.getTextureSize)(e),isAdd:!1,type:"texture"})}))}}O.getCallBack=()=>({add:new x.Z,del:new x.Z});var P=r(6006),k=r(1549);class A extends o{constructor(){super(...arguments),this.resize=new x.Z,this.renderEx={setSize:new x.Z},this.assets={manager:{set:new x.Z}},this.size=O.getCallBack(),this.onSizeChange=new x.Z,this.setSelectMaterial=new x.Z,this.setScene=new x.Z,this.reset=new x.Z,this.render=new x.Z,this.tick=new x.Z,this.controlsChange=new x.Z,this.baseLog=new x.Z,this.inited=new x.Z,this.texture={add:new x.Z,remove:new x.Z,setMaterial:new x.Z,set:new x.Z,setInfo:new x.Z,setAnima:new x.Z,resize:new x.Z,multip:P.Z.callBack},this.multipSelect={add:new x.Z},this.model={setVector3:new x.Z,multiSelect:{setEmpty:new x.Z},change:new x.Z,setSelect:new x.Z,click:new x.Z,add:new x.Z,remove:new x.Z,multipDrop:new x.Z,focus:new x.Z,unFocus:new x.Z,changeName:new x.Z,setOpen:new x.Z,setMainStatue:new x.Z,setVisible:new x.Z,setParent:new x.Z,setLayers:new x.Z,setOutline:new x.Z,clone:new x.Z,dispose:new x.Z},this.material={add:new x.Z,remove:new x.Z,dispose:new x.Z,setName:new x.Z},this.unique={model:{add:new x.Z,remove:new x.Z},material:{add:new x.Z,setTimecited:new x.Z},texture:{setTimecited:new x.Z},geometry:k.Z.getCallBack()},this.tranControls={changing:new x.Z},this.undo={undo:new x.Z,redo:new x.Z,addUndos:new x.Z,addRedus:new x.Z,removeUndos:new x.Z,undoByIndex:new x.Z,reset:new x.Z},this.scene={save:new x.Z,saveNet:new x.Z,setEnvStrength:new x.Z},this.timeLine={setProgress:new x.Z,playGroup:new x.Z,setGroupMap:new x.Z,reset:new x.Z,closeGroup:new x.Z},this.events={key:{down:new x.Z,up:new x.Z},mouse:{move:new x.Z,down:new x.Z,up:new x.Z},pointer:{rightTrigger:new x.Z,down:new x.Z,up:new x.Z,move:new x.Z,trigger:new x.Z},window:{pointer:w.getCallback()},model:{addOptions:new x.Z}},this.pp={glow:{setData:new x.Z,setStatus:new x.Z},outline:{setData:new x.Z,setStatus:new x.Z},ao:{setData:new x.Z,setStatus:new x.Z},vignette:{setData:new x.Z,setStatus:new x.Z}},this.load={getJSON:new x.Z,progress:new x.Z,complete:new x.Z,modelAdded:new x.Z,loaded:new x.Z},this.exporter={gltf:{options:{add:new x.Z},before:new x.Z,complete:new x.Z,sizeMap:new x.Z}},this.loaderer={gltf:{loadNode:new x.Z,lazyLoadedTexture:new x.Z,loaded:new x.Z,modelLoaded:new x.Z,progress:new x.Z,getJSON:new x.Z,getArrayBuffer:new x.Z,complete:new x.Z}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new x.Z),e[t])}),this.tags={parseJSON:new x.Z,clear:new x.Z},this.snapshot={create:new x.Z,set:new x.Z,resetItem:new x.Z,delete:new x.Z,getLength:new x.Z,getByType:new x.Z,parseJSON:new x.Z,setName:new x.Z,delUseless:new x.Z,beforeCreate:new x.Z},this.clean=new x.Z,this.objects={sky:{setState:new x.Z}},this.error=new x.Z,this.camera={set:new x.Z},this.msg=E.getCallbackMap()}}var C=r(4230);function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof 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("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&I(e,t)}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function B(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=j(e);if(r=t?(r=j(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===L(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return U(n)}}function U(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var N={type:"change"},z={type:"start"},F={type:"end"},V=function(){R(t,s.EventDispatcher);var e=B(t);function t(r,n,a){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),(i=e.call(this)).object=r,i.domElement=n,i.myOptions=a,i.domElement.style.touchAction="none",i.enabled=!0,i.target=new s.Vector3,i.minDistance=0,i.maxDistance=1/0,i.minZoom=0,i.maxZoom=1/0,i.minPolarAngle=0,i.maxPolarAngle=Math.PI,i.minAzimuthAngle=-1/0,i.maxAzimuthAngle=1/0,i.enableDamping=!1,i.dampingFactor=.05,i.enableZoom=!0,i.zoomSpeed=1,i.enableRotate=!0,i.rotateSpeed=1,i.enablePan=!0,i.panSpeed=1,i.screenSpacePanning=!0,i.keyPanSpeed=7,i.autoRotate=!1,i.autoRotateSpeed=2,i.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},i.mouseButtons={LEFT:s.MOUSE.ROTATE,MIDDLE:s.MOUSE.DOLLY,RIGHT:s.MOUSE.PAN},i.touches={ONE:s.TOUCH.ROTATE,TWO:s.TOUCH.DOLLY_PAN},i.target0=i.target.clone(),i.position0=i.object.position.clone(),i.zoom0=i.object.zoom,i._domElementKeyEvents=null,i.getPolarAngle=function(){return v.phi},i.getAzimuthalAngle=function(){return v.theta},i.getDistance=function(){return this.object.position.distanceTo(this.target)},i.listenToKeyEvents=function(e){e.addEventListener("keydown",oe),this._domElementKeyEvents=e},i.saveState=function(){p.target0.copy(p.target),p.position0.copy(p.object.position),p.zoom0=p.object.zoom},i.reset=function(){p.target.copy(p.target0),p.object.position.copy(p.position0),p.object.zoom=p.zoom0,p.object.updateProjectionMatrix(),p.dispatchEvent(N),p.update(),f=m.NONE},i.update=(o=new s.Vector3,l=(new s.Quaternion).setFromUnitVectors(r.up,new s.Vector3(0,1,0)),c=l.clone().invert(),u=new s.Vector3,d=new s.Quaternion,h=2*Math.PI,function(){var e=p.object.position,t=(o.copy(e).sub(p.target),o.applyQuaternion(l),v.setFromVector3(o),p.autoRotate&&f===m.NONE&&R(2*Math.PI/60/60*p.autoRotateSpeed),p.enableDamping?(v.theta+=b.theta*p.dampingFactor,v.phi+=b.phi*p.dampingFactor):(v.theta+=b.theta,v.phi+=b.phi),p.minAzimuthAngle),r=p.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=h:t>Math.PI&&(t-=h),r<-Math.PI?r+=h:r>Math.PI&&(r-=h),v.theta=t<=r?Math.max(t,Math.min(r,v.theta)):v.theta>(t+r)/2?Math.max(t,v.theta):Math.min(r,v.theta)),v.phi=Math.max(p.minPolarAngle,Math.min(p.maxPolarAngle,v.phi)),v.makeSafe(),v.radius*=y,v.radius=Math.max(p.minDistance,Math.min(p.maxDistance,v.radius)),!0===p.enableDamping?p.target.addScaledVector(x,p.dampingFactor):p.target.add(x),o.setFromSpherical(v),o.applyQuaternion(c),e.copy(p.target).add(o),p.object.lookAt(p.target),!0===p.enableDamping?(b.theta*=1-p.dampingFactor,b.phi*=1-p.dampingFactor,x.multiplyScalar(1-p.dampingFactor)):(b.set(0,0,0),x.set(0,0,0)),y=1,!(!(w||u.distanceToSquared(p.object.position)>g||8*(1-d.dot(p.object.quaternion))>g)||(p.dispatchEvent(N),u.copy(p.object.position),d.copy(p.object.quaternion),w=!1))}),i.dispose=function(){p.domElement.removeEventListener("contextmenu",le),p.domElement.removeEventListener("pointerdown",re),p.domElement.removeEventListener("pointercancel",ie),p.domElement.removeEventListener("wheel",se),p.domElement.removeEventListener("pointermove",ne),p.domElement.removeEventListener("pointerup",ae),null!==p._domElementKeyEvents&&p._domElementKeyEvents.removeEventListener("keydown",oe)};var i,o,l,c,u,d,h,p=U(i),m={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},f=m.NONE,g=1e-6,v=new s.Spherical,b=new s.Spherical,y=1,x=new s.Vector3,w=!1,S=new s.Vector2,M=new s.Vector2,T=new s.Vector2,_=new s.Vector2,E=new s.Vector2,D=new s.Vector2,O=new s.Vector2,P=new s.Vector2,k=new s.Vector2,A=[],C={};function L(){return Math.pow(.95,p.zoomSpeed)}function R(e){b.theta-=e}function I(e){b.phi-=e}B=new s.Vector3;var B,j,V,G=function(e,t){B.setFromMatrixColumn(t,0),B.multiplyScalar(-e),x.add(B)},H=(j=new s.Vector3,function(e,t){!0===p.screenSpacePanning?j.setFromMatrixColumn(t,1):(j.setFromMatrixColumn(t,0),j.crossVectors(p.object.up,j)),j.multiplyScalar(e),x.add(j)}),Z=(V=new s.Vector3,function(e,t){var r,n=p.domElement;p.object.isPerspectiveCamera?(r=p.object.position,V.copy(r).sub(p.target),r=V.length(),r*=Math.tan(p.object.fov/2*Math.PI/180),G(2*e*r/n.clientHeight,p.object.matrix),H(2*t*r/n.clientHeight,p.object.matrix)):p.object.isOrthographicCamera?(G(e*(p.object.right-p.object.left)/p.object.zoom/n.clientWidth,p.object.matrix),H(t*(p.object.top-p.object.bottom)/p.object.zoom/n.clientHeight,p.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),p.enablePan=!1)});function W(e){p.object.isPerspectiveCamera?y/=e:p.object.isOrthographicCamera?(p.object.zoom=Math.max(p.minZoom,Math.min(p.maxZoom,p.object.zoom*e)),p.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),p.enableZoom=!1)}function K(e){p.object.isPerspectiveCamera?y*=e:p.object.isOrthographicCamera?(p.object.zoom=Math.max(p.minZoom,Math.min(p.maxZoom,p.object.zoom/e)),p.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),p.enableZoom=!1)}function q(e){S.set(e.clientX,e.clientY)}function X(e){_.set(e.clientX,e.clientY)}function Y(){var e,t;1===A.length?S.set(A[0].pageX,A[0].pageY):(e=.5*(A[0].pageX+A[1].pageX),t=.5*(A[0].pageY+A[1].pageY),S.set(e,t))}function Q(){var e,t;1===A.length?_.set(A[0].pageX,A[0].pageY):(e=.5*(A[0].pageX+A[1].pageX),t=.5*(A[0].pageY+A[1].pageY),_.set(e,t))}function J(){var e=A[0].pageX-A[1].pageX,t=A[0].pageY-A[1].pageY;e=Math.sqrt(e*e+t*t),O.set(0,e)}function $(e){1==A.length?M.set(e.pageX,e.pageY):(r=de(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),M.set(t,e)),T.subVectors(M,S).multiplyScalar(p.rotateSpeed);var t,r=p.domElement;R(2*Math.PI*T.x/r.clientHeight),I(2*Math.PI*T.y/r.clientHeight),S.copy(M)}function ee(e){var t,r;1===A.length?E.set(e.pageX,e.pageY):(t=de(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),E.set(r,e)),D.subVectors(E,_).multiplyScalar(p.panSpeed),Z(D.x,D.y),_.copy(E)}function te(e){var t=de(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),P.set(0,t),k.set(0,Math.pow(P.y/O.y,p.zoomSpeed)),W(k.y),O.copy(P)}function re(e){if(!1!==p.enabled)if(0===A.length&&(p.domElement.setPointerCapture(e.pointerId),p.domElement.addEventListener("pointermove",ne),p.domElement.addEventListener("pointerup",ae)),A.push(e),"touch"===e.pointerType){switch(ue(e),A.length){case 1:switch(p.touches.ONE){case s.TOUCH.ROTATE:if(!1===p.enableRotate)return;Y(),f=m.TOUCH_ROTATE;break;case s.TOUCH.PAN:if(!1===p.enablePan)return;Q(),f=m.TOUCH_PAN;break;default:f=m.NONE}break;case 2:switch(p.touches.TWO){case s.TOUCH.DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;p.enableZoom&&J(),p.enablePan&&Q(),f=m.TOUCH_DOLLY_PAN;break;case s.TOUCH.DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;p.enableZoom&&J(),p.enableRotate&&Y(),f=m.TOUCH_DOLLY_ROTATE;break;default:f=m.NONE}break;default:f=m.NONE}f!==m.NONE&&p.dispatchEvent(z)}else{var t,r=e;switch(r.button){case 0:t=p.mouseButtons.LEFT;break;case 1:t=p.mouseButtons.MIDDLE;break;case 2:t=p.mouseButtons.RIGHT;break;default:t=-1}switch(t){case s.MOUSE.DOLLY:if(!1===p.enableZoom)return;!function(e){O.set(e.clientX,e.clientY)}(r),f=m.DOLLY;break;case s.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enablePan)return;X(r),f=m.PAN}else{if(!1===p.enableRotate)return;q(r),f=m.ROTATE}break;case s.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enableRotate)return;q(r),f=m.ROTATE}else{if(!1===p.enablePan)return;X(r),f=m.PAN}break;default:f=m.NONE}f!==m.NONE&&p.dispatchEvent(z)}}function ne(e){if(!1!==p.enabled)if("touch"===e.pointerType){var t=e;switch(ue(t),f){case m.TOUCH_ROTATE:if(!1===p.enableRotate)return;$(t),p.update();break;case m.TOUCH_PAN:if(!1===p.enablePan)return;ee(t),p.update();break;case m.TOUCH_DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;!function(e){p.enableZoom&&te(e),p.enablePan&&ee(e)}(t),p.update();break;case m.TOUCH_DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;!function(e){p.enableZoom&&te(e),p.enableRotate&&$(e)}(t),p.update();break;default:f=m.NONE}}else{var r=e;switch(f){case m.ROTATE:if(!1===p.enableRotate)return;!function(e){M.set(e.clientX,e.clientY),T.subVectors(M,S).multiplyScalar(p.rotateSpeed),e=p.domElement,R(2*Math.PI*T.x/e.clientHeight),I(2*Math.PI*T.y/e.clientHeight),S.copy(M),p.update()}(r);break;case m.DOLLY:if(!1===p.enableZoom)return;!function(e){P.set(e.clientX,e.clientY),k.subVectors(P,O),0<k.y?W(L()):k.y<0&&K(L()),O.copy(P),p.update()}(r);break;case m.PAN:if(!1===p.enablePan)return;!function(e){E.set(e.clientX,e.clientY),D.subVectors(E,_).multiplyScalar(p.panSpeed),Z(D.x,D.y),_.copy(E),p.update()}(r)}}}function ae(e){ce(e),0===A.length&&(p.domElement.releasePointerCapture(e.pointerId),p.domElement.removeEventListener("pointermove",ne),p.domElement.removeEventListener("pointerup",ae)),p.dispatchEvent(F),f=m.NONE}function ie(e){ce(e)}function se(e){var t;!1!==p.enabled&&!1!==p.enableZoom&&f===m.NONE&&(e.preventDefault(),p.dispatchEvent(z),e.deltaY<0?K(L()):0<e.deltaY&&W(L()),null!=p&&null!=(t=p.myOptions)&&t.onWheel(e),p.update(),p.dispatchEvent(F))}function oe(e){if(!1!==p.enabled&&!1!==p.enablePan){var t=e,r=!1;switch(t.code){case p.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?I(2*Math.PI*p.rotateSpeed/p.domElement.clientHeight):Z(0,p.keyPanSpeed),r=!0;break;case p.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?I(-2*Math.PI*p.rotateSpeed/p.domElement.clientHeight):Z(0,-p.keyPanSpeed),r=!0;break;case p.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?R(2*Math.PI*p.rotateSpeed/p.domElement.clientHeight):Z(p.keyPanSpeed,0),r=!0;break;case p.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?R(-2*Math.PI*p.rotateSpeed/p.domElement.clientHeight):Z(-p.keyPanSpeed,0),r=!0}r&&(t.preventDefault(),p.update())}}function le(e){!1!==p.enabled&&e.preventDefault()}function ce(e){delete C[e.pointerId];for(var t=0;t<A.length;t++)if(A[t].pointerId==e.pointerId)return void A.splice(t,1)}function ue(e){var t=C[e.pointerId];void 0===t&&(t=new s.Vector2,C[e.pointerId]=t),t.set(e.pageX,e.pageY)}function de(e){return e=e.pointerId===A[0].pointerId?A[1]:A[0],C[e.pointerId]}return p.domElement.addEventListener("contextmenu",le),p.domElement.addEventListener("pointerdown",re),p.domElement.addEventListener("pointercancel",ie),p.domElement.addEventListener("wheel",se,{passive:!1}),i.update(),i}return function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}(),G=r(3263),H=r(3736);const Z={autoRotate:!1,autoRotateSpeed:2,dampingFactor:.05,enableDamping:!1,enablePan:!0,enableRotate:!0,enableZoom:!0,maxAzimuthAngle:1/0,maxDistance:1/0,maxPolarAngle:Math.PI,minAzimuthAngle:-1/0,minDistance:0,minPolarAngle:0,panSpeed:1,rotateSpeed:1,screenSpacePanning:!0,zoomSpeed:1,target:{x:0,y:0,z:0}};class W{constructor(e){this.inited=()=>{const e=this.runScene.assetsEx.get().controls;e.addEventListener("change",this.change),e.addEventListener("start",(()=>{this.isStart=!0})),e.addEventListener("end",(()=>{this.isStart=!1,this.onEnd()})),this.runScene.exporter.gltf.options.addOption({type:"controls",process:()=>{const t=(0,u.getDiff)(Z,e);return t.autoDelay=this.getAutoDelay(),JSON.stringify(t)},parse:e=>{e&&this.parse(JSON.parse(e))}})},this.onWheel=e=>{},this.change=e=>{this.runScene.cb.controlsChange.cb(e)},this.parse=e=>{const t=this.runScene.assetsEx.get().controls;(0,i.mapObj)(e,((e,r)=>{"autoDelay"===e?this.setAutoDelay(r):void 0!==r&&(G.YD.is(r)?t[e].set(r.x,r.y,r.z):t[e]=r)})),t.update()},this.isStart=!1,this.autoDelay=0,this._autoDelayCallbackTimer=null,this.onEnd=()=>{0!==this.autoDelay&&(this.setAutoRotate(!1),this._autoDelayCallback())},(this.runScene=e).cb.inited.add("controls",this.inited)}reset(){this.parse(Z)}create(e,t){return new V(e,t,{onWheel:this.onWheel})}static toJSON(e){return e.target}static setTarget(e,t,r){var{x:n,y:a,z:i}=t,{x:r,y:s,z:o}=r||e.target;this.setTargetData.anima&&(this.setTargetData.anima.kill(),this.setTargetData.anima=null,this.setTarget(e,t,this.setTargetData.nowData)),this.setTargetData.anima=(0,u.anima)({x:r,y:s,z:o},{x:n,y:a,z:i},.5,(t=>{var{x:r,y:n,z:a}=t;e.target.set(r,n,a),e.update(),this.setTargetData.nowData=t}),(()=>{this.setTargetData.anima=null}))}setAutoDelay(e){this.setAutoRotate(!1);var t=this.runScene.assetsEx.get().camera;(0,H.M)(t,"autoDelay",e),this.autoDelay=e,this._autoDelayCallback()}setAutoRotate(e){this.runScene.assetsEx.get().controls.autoRotate=e}_autoDelayCallback(){const e=this.runScene.assetsEx.get().controls;e.autoRotate&&(this._autoDelayCallbackTimer&&clearTimeout(this._autoDelayCallbackTimer),this._autoDelayCallbackTimer=setTimeout((()=>{if(e.autoRotate)return this.isStart?this._autoDelayCallback():void this.setAutoRotate(!0)}),1e3*this.autoDelay))}getAutoDelay(){var e=this.runScene.assetsEx.get().camera;return(0,H.is)(e,"autoDelay")||0}}W.setTargetData={anima:null,nowData:null};class K{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new p.Z,this.specialKeyDebounce=()=>{this.ctrl=!1,this.shift=!1,this.alt=!1},this.fns={down:{s:e=>{this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene())},d:e=>{this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel())},alt:()=>{this.alt=!0},control:()=>{this.ctrl=!0},ctrl:()=>{this.ctrl=!0},shift:()=>{this.shift=!0},f11:()=>{this.events.runScene.cb.resize.cb(this.events.runScene.renderEx.getDomSize())},w:()=>{this.events.runScene.helperEx.transContro.changeMode("position")},e:()=>{this.events.runScene.helperEx.transContro.changeMode("rotation")},f:()=>{this.allFn.f_focusModel()},delete:()=>{this.events.runScene.helperEx.unfocus();var e=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||e),e&&this.events.runScene.multipSelector.delete()},z:e=>{this.ctrl&&this.allFn.z_undo(e)},y:e=>{this.ctrl&&this.allFn.y_redo(e)},r:()=>{this.events.runScene.helperEx.transContro.changeMode("scale")}},up:{s:()=>{this.ctrl},alt:()=>{this.alt=!1},control:()=>{this.ctrl=!1},ctrl:()=>{this.ctrl=!1},shift:()=>{this.shift=!1}}},this.allFn={s_saveScene:()=>function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.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.getSelectedModels()[0];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&&(this.events.addEvent({dom:document,name:"keydown",fn:this.keyDown.bind(this)}),this.events.addEvent({dom:document,name:"keyup",fn:this.keyUp.bind(this)}),this.events.runScene.cb.model.setSelect.add("reset-unexec",(()=>{this.unExec.delete("delete")})),this.events.addEvent({dom:window,name:"blur",fn:this.specialKeyDebounce}))}keyDown(e){var t,r;"INPUT"!==document.activeElement.nodeName&&(r=e.key.toLowerCase(),this.events.runScene.cb.events.key.down.cb({key:r,event:e}),this.unExec.get(r)||null!=(r=(t=this.fns.down)[r])&&r.call(t,e))}keyUp(e){var t,r;"INPUT"!==document.activeElement.nodeName&&(r=e.key.toLowerCase(),this.events.runScene.cb.events.key.up.cb({key:r,event:e}),null!=(r=(t=this.fns.up)[r])&&r.call(t,e))}}var q=r(272),X=r(2233);class Y{constructor(e){this.options=new p.Z,this.enable=!0,this.lockData=new p.Z,this.foucedModel=new q.Z,this.addOptions=e=>{var{name:e,map:t}=e;this.options.set(e,t)},this.hoverModel=new q.Z,this.map={click:new p.Z,hover:new p.Z,mouseLeave:new p.Z},this.onClick=e=>{var t,r;this.enable&&(t=(0,X.Ki)(e))&&(r=this.map.click.get(t))&&this.triggerEvent({model:e,method:"click",saved:r,id:t})},this.onHover=e=>{var t,r=(0,X.Ki)(e);r&&(t=this.map.hover.get(r))&&!this.foucedModel.has(r)&&(this.events.runScene.optionsEx.log([e,"移入"],"detail"),this.triggerEvent({model:e,saved:t,method:"hover",id:r}),this.onFouce(r))},this.onMouseLeave=()=>{this.events.runScene.modelEx.getById(this.foucedModel.toArray()).map((e=>{this.onMouseLeaveByModel(e)}))},this.events=e}setState(e){this.enable=e}copy(e){this.copyData=e}paste(e){this.copyData&&e.map((e=>{var{method:t,child:r,type:n}=this.copyData;this.set({model:e,type:n,method:t,child:r})}))}init(){this.events.runScene.cb.model.click.add("event-model",this.onClick),this.events.runScene.cb.events.model.addOptions.add("event-model",this.addOptions),this.events.runScene.cb.unique.model.add.add("event-model",(({model:e})=>{var t;null!=(t=e.userData.events)&&t.map((t=>{var[t,r,n]=t.split("-");this.set({model:e,method:t,child:n,type:r})}))})),this.events.runScene.cb.events.pointer.move.add("get-hover-from-models",(0,i.fnDebounce)((e=>{if(0!==this.hoverModel.size&&this.enable){const n=new s.Raycaster;var{camera:t,renderer:r}=this.events.runScene.assetsEx.get(),{x:r,y:e}=this.events.mouse.getEventLocal(r.domElement,e),r=new s.Vector2(r,e);n.setFromCamera(r,t);const a=n.intersectObjects(this.hoverModel.toArray(),!0);0===a.length?this.onMouseLeave():(e=a.map((e=>e.object)).filter((e=>e.visible)),this.onHover(e[0]))}}),10)),this.events.runScene.cb.snapshot.setName.add("event-model",(({oldName:e,name:t})=>{(0,i.mapObj)(this.map,((r,n)=>{n.map(((n,a)=>{const i=a.get("snapshot");(a=this.events.runScene.modelEx.getById(n))&&i&&i.has(e)&&(this.del({model:a,type:"snapshot",child:e,method:r}),this.set({model:a,type:"snapshot",child:t,method:r}))}))}))}))}del(e){const{model:t,type:r,child:n,method:a}=e;var i=(0,X.Ki)(t);if(i){let s=this.map[a].get(i);if(s){let i=s.get(r);i&&("hover"===a&&this.hoverModel.delete(this.hoverModel.find((e=>(0,X.Ki)(e)===(0,X.Ki)(t)))),i.remove(n),this.bindDataForModel(e,!1))}}}delAll(e){const{model:t,type:r,name:n}=e,a=(0,X.Ki)(t);if(a){const e=[];(0,i.mapObj)(this.map,((i,s)=>{s.map(((s,o)=>{if(s===a){const a=o.get(r);null!=a&&a.has(n)&&(a.delete(n),e.push({model:t,type:r,method:i,child:n}))}}))})),e.map((e=>this.bindDataForModel(e,!1)))}}set(e){const{model:t,type:r,child:n,method:a}=e;var i=(0,X.Ki)(t);if(i){let s=this.map[a],o=s.get(i),l=(o||(o=new p.Z,s.set(i,o)),o.get(r));l||(l=new q.Z,o.set(r,l)),"hover"!==a||this.hoverModel.find((e=>(0,X.Ki)(e)===(0,X.Ki)(t)))||this.hoverModel.add(t),l.add(n),this.bindDataForModel(e)}}bindDataForModel(e,t=!0){const{model:r,type:n,child:a,method:i}=e;let s=r.userData.events;s||(r.userData.events=s=[]);const o=i+"-"+n+"-"+a;-1===(e=s.findIndex((e=>e===o)))?t&&s.push(o):t||s.splice(e,1)}hasEvent(e){const{model:t,method:r,type:n,child:a}=e,i=[r,n,a].join("-");return!!t.userData.events&&-1!==t.userData.events.findIndex((e=>e===i))}validCanBeTrigger(e,t){return null==(e=this.lockData.get(e))||!e.has(t)}triggerEvent(e){const{model:t,id:r,saved:n}=e;d.closeModelEvent.is(t)||n.map(((e,n)=>{if(!this.validCanBeTrigger(r,e))return this.events.runScene.optionsEx.log("该目标正在执行中","base"),void this.setLock({id:r,type:e,isAdd:!1});const a=this.options.get(e);a&&(this.setLock({id:r,type:e,isAdd:!0}),a.parse({model:t,childs:n.toArray()}).then((()=>{this.setLock({id:r,type:e,isAdd:!1})})))}))}getModelIdsByDta(e,t){const r=new q.Z;return(0,i.mapObj)(this.map,((n,a)=>{a.map(((n,a)=>{const i=a.get(e);i&&i.has(t)&&r.add(n)}))})),r}hasLockByMethod(e){for(const t of Object.values(this.lockData.toArray("value")))if(t.has(e))return!0;return!1}setLock(e){var{id:e,type:t,isAdd:r}=e;let n=this.lockData.get(e);n||(n=new q.Z,this.lockData.set(e,n)),r?n.add(t):n.delete(t)}onFouceAfter(){this.foucedModel.map((e=>{this.getLockStatus({id:e,methods:"hover"})||this.onMouseLeaveByModel(this.events.runScene.modelEx.getById(e))}))}onFouce(e){this.getLockStatus({id:e,methods:"hover"})||(this.onFouceAfter(),this.foucedModel.add(e))}getLockStatus(e){var{id:e,methods:t}=e;const r=this.lockData.get(e);return null==r?void 0:r.has(t)}onMouseLeaveByModel(e){var t,r;!e||(t=(0,X.Ki)(e))&&(this.foucedModel.delete(t),(r=this.map.mouseLeave.get(t))&&(this.events.runScene.optionsEx.log([e,"移出"],"detail"),this.triggerEvent({model:e,method:"mouseLeave",saved:r,id:t})))}}function Q(e){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function J(){J=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var c={};function u(){}function d(){}function h(){}var p,m,f=(s(p={},n,(function(){return this})),(m=(m=Object.getPrototypeOf)&&m(m(w([]))))&&m!==t&&r.call(m,n)&&(p=m),h.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==Q(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(f,"constructor",d.prototype=h),s(h,"constructor",d),d.displayName=s(h,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(f),s(f,i,"Generator"),s(f,n,(function(){return this})),s(f,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(y),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function $(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function ee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function te(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function re(e,t,r){t&&te(e.prototype,t),r&&te(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var ne={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},ae=function(){function e(){ee(this,e),this.pluginCallbacks=[],this.register((function(e){return new De(e)})),this.register((function(e){return new Oe(e)})),this.register((function(e){return new Ae(e)})),this.register((function(e){return new Ce(e)})),this.register((function(e){return new Le(e)})),this.register((function(e){return new Re(e)})),this.register((function(e){return new Pe(e)})),this.register((function(e){return new ke(e)})),this.register((function(e){return new Ie(e)})),this.register((function(e){return new Be(e)}))}return re(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){for(var a=new Ee,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),ie=5120,se=5121,oe=5122,le=5123,ce=(n=9728,9729),ue=9984,de=9985,he=9986,pe=9987,me=33071,fe=33648,ge=10497,ve="KHR_mesh_quantization",be={},ye=(be[s.NearestFilter]=n,be[s.NearestMipmapNearestFilter]=ue,be[s.NearestMipmapLinearFilter]=he,be[s.LinearFilter]=ce,be[s.LinearMipmapNearestFilter]=de,be[s.LinearMipmapLinearFilter]=pe,be[s.ClampToEdgeWrapping]=me,be[s.RepeatWrapping]=ge,be[s.MirroredRepeatWrapping]=fe,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),xe=new s.Color;function we(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Se(e){return 4*Math.ceil(e/4)}function Me(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Se(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function Te(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function _e(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var Ee=function(){function e(){ee(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return re(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=J().mark((function e(t,r){var n,a,i,s,o,l,c,u,d,h=arguments;return J().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<h.length&&void 0!==h[2]?h[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:return i=(a=this).buffers,s=a.json,n=a.options,e.next=12,a.options.myOptions.helper.done(s);case 12:l=a.extensionsUsed,c=a.extensionsRequired,o=new Blob(i,{type:"application/octet-stream"}),l=Object.keys(l),c=Object.keys(c),0<l.length&&(s.extensionsUsed=l),0<c.length&&(s.extensionsRequired=c),s.buffers&&0<s.buffers.length&&(s.buffers[0].byteLength=o.size),!0===n.binary?((u=new FileReader).readAsArrayBuffer(o),u.onloadend=function(){var e=Me(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Me((n=JSON.stringify(s),(new TextEncoder).encode(n).buffer),32)),a=new DataView(new ArrayBuffer(8)),i=(a.setUint32(0,n.byteLength,!0),a.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((l=new DataView(i)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+a.byteLength+n.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,o,!0),new Blob([i,a,n,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){r(c.result)}}):s.buffers&&0<s.buffers.length?((d=new FileReader).readAsDataURL(o),d.onloadend=function(){var e=d.result;s.buffers[0].uri=e,r(s)}):r(s);case 21:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){$(i,n,a,s,o,"next",e)}function o(e){$(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=Te(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var d=r(e),h=c.getImageData(0,0,i,o).data,p=2;p<h.length;p+=4)u.data[p]=256*d(h[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var m=r(t),f=c.getImageData(0,0,i,o).data,g=1;g<f.length;g+=4)u.data[g]=256*m(f[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case ie:case se:i=1;break;case oe:case le:i=2;break;default:i=4}for(var l=Se(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,d=r;d<r+n;d++)for(var h=0;h<e.itemSize;h++){var p=void 0;4<e.itemSize?p=e.array[d*e.itemSize+h]:(0===h?p=e.getX(d):1===h?p=e.getY(d):2===h?p=e.getZ(d):3===h&&(p=e.getW(d)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===oe?c.setInt16(u,p,!0):t===le?c.setUint16(u,p,!0):t===ie?c.setInt8(u,p):t===se&&c.setUint8(u,p),u+=i}var m={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(m.target=a),34962===a&&(m.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(m),{id:o.bufferViews.length-1,byteLength:0,size:c.byteLength}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=Me(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n,a,i){var o=this.json;if(e.array.constructor===Float32Array)u=5126;else if(e.array.constructor===Int32Array)u=5124;else if(e.array.constructor===Uint32Array)u=5125;else if(e.array.constructor===Int16Array)u=oe;else if(e.array.constructor===Uint16Array)u=le;else if(e.array.constructor===Int8Array)u=ie;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");u=se}if(0===(n=void 0===n?e.count:n))return null;var l,c=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n),u=(r={bufferView:(void 0!==t&&(l=e===t.index?34963:34962),t=this.processBufferView(e,u,r,n,l)).id,byteOffset:t.byteOffset,componentType:u,count:n,max:c.max,min:c.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},null==a||null==(l=a.userData)?void 0:l.id);return u&&this.options.myOptions.helper.processGeometry({size:t.size,name:a.name,id:u,type:i}),!0===e.normalized&&(r.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r,n){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var i=this,o=i.cache,l=i.json,c=i.options,u=i.pending;if(void 0!==(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e))[r=a+":flipY/"+r.toString()])return o[r];l.images||(l.images=[]);var d={mimeType:a},h=Te(),p=(h.width=Math.min(e.width,c.maxTextureSize),h.height=Math.min(e.height,c.maxTextureSize),h.getContext("2d"));if(void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var m=new Uint8ClampedArray(e.height*e.width*4),f=0;f<m.length;f+=4)m[f+0]=e.data[f+0],m[f+1]=e.data[f+1],m[f+2]=e.data[f+2],m[f+3]=e.data[f+3];p.putImageData(new ImageData(m,e.width,e.height),0,0)}else p.drawImage(e,0,0,h.width,h.height);return!0===c.binary?(null==n||null==(t=n.userData)?void 0:t.blob)instanceof Blob?u.push(new Promise((function(e){i.processBufferViewImage(n.userData.blob).then((function(t){d.bufferView=t,e()}))}))):u.push(_e(h,a).then((function(e){return i.processBufferViewImage(e)})).then((function(e){d.bufferView=e}))):void 0!==h.toDataURL?d.uri=h.toDataURL(a):u.push(_e(h,a).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){d.uri=e}))),p=l.images.push(d)-1,o[r]=p}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:be[e.magFilter],minFilter:be[e.minFilter],wrapS:be[e.wrapS],wrapT:be[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]),e.userData||(e.userData={});var n=("image/webp"===(a=(null==(a=e.userData)?void 0:a.mimeType)||"image/png")&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e,a)}),a=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,a),this.options.myOptions.helper.parseTexture({texture:e,textureDef:n}),a}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}},a=(this.options.myOptions.helper.parseMaterial({material:e,materialDef:n,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(we(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,d=e.geometry,h=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},m={},f=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=d.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),d.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in d.attributes)"morph"!==c.slice(0,5)&&(l=d.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?m[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,d,void 0,void 0,e,c))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),m[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&d.setAttribute("normal",b),0===Object.keys(m).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},D=!1;for(_ in d.morphAttributes)if("position"!==_&&"normal"!==_)D||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),D=!0);else{var O=d.morphAttributes[_][T],P=_.toUpperCase(),k=d.attributes[_];if(t.attributes.has(this.getUID(O,!0)))E[P]=t.attributes.get(this.getUID(O,!0));else{var A=O.clone();if(!d.morphTargetsRelative)for(var C=0,L=O.count;C<L;C++)for(var R=0;R<O.itemSize;R++)0===R&&A.setX(C,O.getX(C)-k.getX(C)),1===R&&A.setY(C,O.getY(C)-k.getY(C)),2===R&&A.setZ(C,O.getZ(C)-k.getZ(C)),3===R&&A.setW(C,O.getW(C)-k.getW(C));E[P]=this.processAccessor(A,d),t.attributes.set(this.getUID(k,!0),E[P])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===d.groups.length)return null;for(var I=b?e.material:[e.material],B=b?d.groups:[{materialIndex:0,start:void 0,count:void 0}],U=0,j=B.length;U<j;U++){var N={mode:h,attributes:m},z=(this.serializeUserData(d,N),0<g.length&&(N.targets=g),null!==d.index&&(z=this.getUID(d.index),void 0===B[U].start&&void 0===B[U].count||(z+=":"+B[U].start+":"+B[U].count),t.attributes.has(z)?N.indices=t.attributes.get(z):(N.indices=this.processAccessor(d.index,d,B[U].start,B[U].count),t.attributes.set(z,N.indices)),null===N.indices&&delete N.indices),this.processMaterial(I[B[U].materialIndex]));null!==z&&(N.material=z),f.push(N)}return p.primitives=f,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[ve]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=ne[t])&&e.includes(r)&&(this.extensionsUsed[ve]=!0,this.extensionsRequired[ve]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=ae.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),d=s.PropertyBinding.findNode(t,u.nodeName),h=ye[u.propertyName];if(!(d="bones"===u.objectName?!0===d.isSkinnedMesh?d.skeleton.getBoneByName(u.objectIndex):void 0:d)||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(h===ye.morphTargetInfluences&&(u/=d.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(d),path:h}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u){var d=a.bones[u];d=this.options.myOptions.helper.getNodeMapValueWithBone(d,r),o.push(d),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(e=a.myOptions.helper.parseNode({object:e,nodeDef:s,options:this}),a.trs?(r=e.quaternion.toArray(),d=e.position.toArray(),t=e.scale.toArray(),we(r,[0,0,0,1])||(s.rotation=r),we(d,[0,0,0])||(s.translation=d),we(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===we(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];u.userData.isTemp||!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var d=n.nodes.push(s)-1;return i.set(e,d),d}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];o.userData.isTemp||!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,r,n=this.options,a=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),i=0;i<e.length;i++)e[i]instanceof s.Scene?this.processScene(e[i]):a.push(e[i]);1===a.length?(t=a[0],"model"===n.myOptions.helper.type&&((r=new s.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<a.length&&this.processObjects(a);for(var o=0;o<this.skins.length;++o)this.processSkin(this.skins[o]);for(var l=0;l<n.animations.length;++l)this.processAnimation(n.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),De=function(){function e(t){ee(this,e),this.writer=t,this.name="KHR_lights_punctual"}return re(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),Oe=function(){function e(t){ee(this,e),this.writer=t,this.name="KHR_materials_unlit"}return re(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}(),Pe=function(){function e(t){ee(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return re(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ke=function(){function e(t){ee(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return re(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ae=function(){function e(t){ee(this,e),this.writer=t,this.name="KHR_materials_transmission"}return re(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ce=function(){function e(t){ee(this,e),this.writer=t,this.name="KHR_materials_volume"}return re(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Le=function(){function e(t){ee(this,e),this.writer=t,this.name="KHR_materials_ior"}return re(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),Re=function(){function e(t){ee(this,e),this.writer=t,this.name="KHR_materials_specular"}return re(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(xe)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ie=function(){function e(t){ee(this,e),this.writer=t,this.name="KHR_materials_sheen"}return re(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Be=function(){function e(t){ee(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return re(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();function 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 je(){je=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var c={};function u(){}function d(){}function h(){}var p,m,f=(s(p={},n,(function(){return this})),(m=(m=Object.getPrototypeOf)&&m(m(w([]))))&&m!==t&&r.call(m,n)&&(p=m),h.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==Ue(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(f,"constructor",d.prototype=h),s(h,"constructor",d),d.displayName=s(h,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(f),s(f,i,"Generator"),s(f,n,(function(){return this})),s(f,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(y),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function Ne(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function ze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ve(e,t,r){t&&Fe(e.prototype,t),r&&Fe(e,r),Object.defineProperty(e,"prototype",{writable:!1})}ae.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,d=c.morphTargetDictionary[l.propertyIndex];if(void 0===d)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var h=void 0;if(void 0===n[c.uuid]){for(var p=new((h=o.clone()).ValueBufferType)(u*h.times.length),m=0;m<h.times.length;m++)p[m*u+d]=h.values[m];h.name=(l.nodeName||"")+".morphTargetInfluences",h.values=p,n[c.uuid]=h,r.push(h)}else{var f=o.createInterpolant(new o.ValueBufferType(1));h=n[c.uuid];for(var g=0;g<h.times.length;g++)h.values[g*u+d]=f.evaluate(h.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(h,o.times[v]);h.values[b*u+d]=o.values[v]}}}}return e.tracks=r,e}};var Ge={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},He=function(){function e(){ze(this,e),this.pluginCallbacks=[],this.register((function(e){return new it(e)})),this.register((function(e){return new st(e)})),this.register((function(e){return new ct(e)})),this.register((function(e){return new ut(e)})),this.register((function(e){return new dt(e)})),this.register((function(e){return new ht(e)})),this.register((function(e){return new ot(e)})),this.register((function(e){return new lt(e)})),this.register((function(e){return new pt(e)})),this.register((function(e){return new mt(e)}))}return Ve(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){for(var a=new at,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),Ze=5120,We=5121,Ke=5122,qe=5123,Xe=(n=9728,ue=9729,he=9984,ce=9985,de=9986,pe=9987,me=33071,ge=33648,fe=10497,"KHR_mesh_quantization"),Ye={},Qe=(Ye[s.NearestFilter]=n,Ye[s.NearestMipmapNearestFilter]=he,Ye[s.NearestMipmapLinearFilter]=de,Ye[s.LinearFilter]=ue,Ye[s.LinearMipmapNearestFilter]=ce,Ye[s.LinearMipmapLinearFilter]=pe,Ye[s.ClampToEdgeWrapping]=me,Ye[s.RepeatWrapping]=fe,Ye[s.MirroredRepeatWrapping]=ge,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),Je=new s.Color;function $e(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function et(e){return 4*Math.ceil(e/4)}function tt(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=et(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function rt(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function nt(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var at=function(){function e(){ze(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return Ve(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=je().mark((function e(t,r){var n,a,i,s,o,l,c,u=arguments;return je().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<u.length&&void 0!==u[2]?u[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:i=(o=this).buffers,a=o.json,n=o.options,s=o.extensionsUsed,o=o.extensionsRequired,i=new Blob(i,{type:"application/octet-stream"}),s=Object.keys(s),o=Object.keys(o),0<s.length&&(a.extensionsUsed=s),0<o.length&&(a.extensionsRequired=o),a.buffers&&0<a.buffers.length&&(a.buffers[0].byteLength=i.size),!0===n.binary?((l=new FileReader).readAsArrayBuffer(i),l.onloadend=function(){var e=tt(l.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),tt((n=JSON.stringify(a),(new TextEncoder).encode(n).buffer),32)),i=new DataView(new ArrayBuffer(8)),s=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((c=new DataView(s)).setUint32(0,1179937895,!0),c.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),c=(c.setUint32(8,o,!0),new Blob([s,i,n,t,e],{type:"application/octet-stream"})),u=new FileReader;u.readAsArrayBuffer(c),u.onloadend=function(){r(u.result)}}):a.buffers&&0<a.buffers.length?((c=new FileReader).readAsDataURL(i),c.onloadend=function(){var e=c.result;a.buffers[0].uri=e,r(a)}):r(a);case 19:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){Ne(i,n,a,s,o,"next",e)}function o(e){Ne(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=rt(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var d=r(e),h=c.getImageData(0,0,i,o).data,p=2;p<h.length;p+=4)u.data[p]=256*d(h[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var m=r(t),f=c.getImageData(0,0,i,o).data,g=1;g<f.length;g+=4)u.data[g]=256*m(f[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case Ze:case We:i=1;break;case Ke:case qe:i=2;break;default:i=4}for(var l=et(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,d=r;d<r+n;d++)for(var h=0;h<e.itemSize;h++){var p=void 0;4<e.itemSize?p=e.array[d*e.itemSize+h]:(0===h?p=e.getX(d):1===h?p=e.getY(d):2===h?p=e.getZ(d):3===h&&(p=e.getW(d)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===Ke?c.setInt16(u,p,!0):t===qe?c.setUint16(u,p,!0):t===Ze?c.setInt8(u,p):t===We&&c.setUint8(u,p),u+=i}var m={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(m.target=a),34962===a&&(m.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(m),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=tt(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var a,i=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=Ke;else if(e.array.constructor===Uint16Array)a=qe;else if(e.array.constructor===Int8Array)a=Ze;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=We}if(0===(n=void 0===n?e.count:n))return null;var o,l=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n);return r={bufferView:(void 0!==t&&(o=e===t.index?34963:34962),t=this.processBufferView(e,a,r,n,o)).id,byteOffset:t.byteOffset,componentType:a,count:n,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(r.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var a=this,i=a.cache,o=a.json,l=a.options,c=a.pending,u=(i.images.has(e)||i.images.set(e,{}),i=i.images.get(e),n+":flipY/"+r.toString());if(void 0!==i[u])return i[u];o.images||(o.images=[]);var d={mimeType:n},h=rt(),p=(h.width=Math.min(e.width,l.maxTextureSize),h.height=Math.min(e.height,l.maxTextureSize),h.getContext("2d"));if(!0===r&&(p.translate(0,h.height),p.scale(1,-1)),void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var m=new Uint8ClampedArray(e.height*e.width*4),f=0;f<m.length;f+=4)m[f+0]=e.data[f+0],m[f+1]=e.data[f+1],m[f+2]=e.data[f+2],m[f+3]=e.data[f+3];p.putImageData(new ImageData(m,e.width,e.height),0,0)}else p.drawImage(e,0,0,h.width,h.height);return!0===l.binary?c.push(nt(h,n).then((function(e){return a.processBufferViewImage(e)})).then((function(e){d.bufferView=e}))):void 0!==h.toDataURL?d.uri=h.toDataURL(n):c.push(nt(h,n).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){d.uri=e}))),r=o.images.push(d)-1,i[u]=r}},{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,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n=("image/webp"===(a=e.userData.mimeType)&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)}),a=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,a),a}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}},a=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=($e(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,d=e.geometry,h=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},m={},f=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=d.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),d.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in d.attributes)"morph"!==c.slice(0,5)&&(l=d.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?m[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,d))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),m[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&d.setAttribute("normal",b),0===Object.keys(m).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},D=!1;for(_ in d.morphAttributes)if("position"!==_&&"normal"!==_)D||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),D=!0);else{var O=d.morphAttributes[_][T],P=_.toUpperCase(),k=d.attributes[_];if(t.attributes.has(this.getUID(O,!0)))E[P]=t.attributes.get(this.getUID(O,!0));else{var A=O.clone();if(!d.morphTargetsRelative)for(var C=0,L=O.count;C<L;C++)for(var R=0;R<O.itemSize;R++)0===R&&A.setX(C,O.getX(C)-k.getX(C)),1===R&&A.setY(C,O.getY(C)-k.getY(C)),2===R&&A.setZ(C,O.getZ(C)-k.getZ(C)),3===R&&A.setW(C,O.getW(C)-k.getW(C));E[P]=this.processAccessor(A,d),t.attributes.set(this.getUID(k,!0),E[P])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===d.groups.length)return null;for(var I=b?e.material:[e.material],B=b?d.groups:[{materialIndex:0,start:void 0,count:void 0}],U=0,j=B.length;U<j;U++){var N={mode:h,attributes:m},z=(this.serializeUserData(d,N),0<g.length&&(N.targets=g),null!==d.index&&(z=this.getUID(d.index),void 0===B[U].start&&void 0===B[U].count||(z+=":"+B[U].start+":"+B[U].count),t.attributes.has(z)?N.indices=t.attributes.get(z):(N.indices=this.processAccessor(d.index,d,B[U].start,B[U].count),t.attributes.set(z,N.indices)),null===N.indices&&delete N.indices),this.processMaterial(I[B[U].materialIndex]));null!==z&&(N.material=z),f.push(N)}return p.primitives=f,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[Xe]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=Ge[t])&&e.includes(r)&&(this.extensionsUsed[Xe]=!0,this.extensionsRequired[Xe]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=He.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),d=s.PropertyBinding.findNode(t,u.nodeName),h=Qe[u.propertyName];if(!(d="bones"===u.objectName?!0===d.isSkinnedMesh?d.skeleton.getBoneByName(u.objectIndex):void 0:d)||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(h===Qe.morphTargetInfluences&&(u/=d.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(d),path:h}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u)o.push(r.get(a.bones[u])),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(a.trs?(r=e.quaternion.toArray(),d=e.position.toArray(),t=e.scale.toArray(),$e(r,[0,0,0,1])||(s.rotation=r),$e(d,[0,0,0])||(s.translation=d),$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!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var d=n.nodes.push(s)-1;return i.set(e,d),d}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,r=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),n=0;n<e.length;n++)e[n]instanceof s.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),it=function(){function e(t){ze(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Ve(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),st=function(){function e(t){ze(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Ve(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){ze(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Ve(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),lt=function(){function e(t){ze(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return Ve(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ct=function(){function e(t){ze(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Ve(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ut=function(){function e(t){ze(this,e),this.writer=t,this.name="KHR_materials_volume"}return Ve(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),dt=function(){function e(t){ze(this,e),this.writer=t,this.name="KHR_materials_ior"}return Ve(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),ht=function(){function e(t){ze(this,e),this.writer=t,this.name="KHR_materials_specular"}return Ve(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(Je)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),pt=function(){function e(t){ze(this,e),this.writer=t,this.name="KHR_materials_sheen"}return Ve(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),mt=function(){function e(t){ze(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return Ve(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();He.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,d=c.morphTargetDictionary[l.propertyIndex];if(void 0===d)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var h=void 0;if(void 0===n[c.uuid]){for(var p=new((h=o.clone()).ValueBufferType)(u*h.times.length),m=0;m<h.times.length;m++)p[m*u+d]=h.values[m];h.name=(l.nodeName||"")+".morphTargetInfluences",h.values=p,n[c.uuid]=h,r.push(h)}else{var f=o.createInterpolant(new o.ValueBufferType(1));h=n[c.uuid];for(var g=0;g<h.times.length;g++)h.values[g*u+d]=f.evaluate(h.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(h,o.times[v]);h.values[b*u+d]=o.values[v]}}}}return e.tracks=r,e}};class ft{constructor(e){this.map=new q.Z,this.loadMap=new p.Z,this.exportMap=new p.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let r=this.loadMap.get(e);r||(r=new q.Z,this.loadMap.set(e,r)),r.add(t)})),e.exportCallBacks.map(((e,t)=>{let r=this.exportMap.get(e);r||(r=new q.Z,this.exportMap.set(e,r)),r.add(t)}))}loadCallback(e){const{type:t,json:r,data:n,config:a,core:i}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:r,data:n,config:a,core:i})))}}const gt={};(0,i.mapObj)({Group:"空组",Box:"立方体",Plane:"片",Sphere:"球",Sprite:"精灵图",Reflector:"反射",VerticesRain:"雨雪粒子",Water:"水",BasicMaterial:"基础材质",FakeInterior:"假室内",Fresnel:"菲涅尔",Physical:"物理材质",Matcap:"材质捕获",TreeLeaf:"树材质",MixTexture:"多层贴图材质",AmbientLight:"环境光",RectAreaLight:"矩形光",DirectionalLight:"平行光",HemisphereLight:"半球光",PointLight:"点光源",SpotLight:"聚光灯",GroundProjected:"地面投影",NoToneMapping:"无色调映射",LinearToneMapping:"线性色调映射",ReinhardToneMapping:"Reinhard色调映射",CineonToneMapping:"cineon色调映射",ACESFilmicToneMapping:"ACES电影色调映射",CustomToneMapping:"自定义色调映射",def:"默认色彩空间",srgb:"标准色彩空间",SpriteMaterial:"精灵材质",SkyBox:"天空球材质","2DDom":"2D文档模型","3DSprite":"3D精灵模型","3DDom":"3D文档模型",MyMeshPhongMaterial:"光亮材质",MeshPhongMaterial:"光亮材质",MeshLambertMaterial:"Lambert材质",MyMeshLambertMaterial:"Lambert材质"},((e,t)=>{gt[t]=e}));var vt=r(4330),bt=r(135),yt=r(4342),xt=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class wt{constructor(e){this.materialMap={},this.textureMap={},this.savedMap={materialIds:new q.Z},this.parseScenePeding=[],this.materialMapToJsonPending=[],this.geoDefMaterialMap=new p.Z;var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){return xt(this,void 0,void 0,(function*(){var t=this.createTextureGroup(e);this.helperModel=t,"scene"===this.type&&this.parseScene(t),this.parseModel(e),this.materialMapToJson(),yield Promise.all(this.parseScenePeding),this.setMultipMaterial(t,Object.keys(this.textureMap))}))}createTextureGroup(e){const t=new s.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseUnDelAbleTexture(){(0,i.mapObj)(this.runScene.uniqueEx.texture.map,((e,t)=>{t=t.texture,(0,D.isInvalidTexture)(t)||D.unDelAbleTexture.is(t)&&!this.mergeSame(t)&&this.parseTexture(t)}))}parseScene(e){this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e)),this.parseUnUserMaterial(),this.parseUnDelAbleTexture(),this.helper.ex.savedMap=this.savedMap}parseUnUserMaterial(){this.runScene.uniqueEx.material.getUnUsers().map((({material:e,id:t})=>{if(this.runScene.assetsEx.manager.isUsed("material",t)){const r=(0,d.createDefModel)("Box");r.material=e,this.helperModel.add(r),this.savedMap.materialIds.add(t)}}))}_getBaseEx(e){var t=this.runScene.sceneEx.get(),r=this.runScene.optionsEx.exporterOptions.outTime,n=this.runScene.sceneEx.envStrength;return{version:{core:"0.0.96",editor:"0.0.2"},base64:(0,y.Ni)(String(r)),camera:C.Z.toJSON(this.runScene),sceneEx:Object.assign(Object.assign({},H.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),envStrength: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 r={},n=(0,bt.createDefMaterial)(),a=[];var i=n.userData.id;const s=(0,d.createDefModel)("Box");if(s.material=n,e.add(s),r.materialId=i,(0,D.isTexture)(t.background)||(0,D.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:e,environment:i}=t;this.runScene.pp.setUpdate(!0),(0,D.isTexture)(e)&&(e.userData.notCompress=!0,a.push({type:"map",texture:e}),303===(n.map=e).mapping&&(r.backgroundMapping=303)),(0,D.isTexture)(i)&&(i.userData.notCompress=!0,a.push({type:"envMap",texture:i}),n.envMap=i)}return"editor"===this.runScene.optionsEx.options.mode&&this.runScene.cameraEx.backgroudData&&(e=(0,D.createDefTexture)(),t=this.runScene.cameraEx.backgroudData,(0,D.bindTextureBaseData)(e,this.runScene,t),a.push({type:"normalMap",texture:e})),this.materialMap[i]={normalMaterial:n,models:[],normal:{},textures:a},r}compressLocal(e){var{x:t,y:r,z:n}=e.position;0===t&&0===r&&0===n||(e.position.set(0,0,0),e.userData.local=t+","+r+","+n)}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{this._processModelMaterial(e),this._processModel(e)}))}_processModel(e){(0,d.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,H.M)(e,"animations",t));var t=this.runScene.modelEx.importAndExport.toNromal({type:yt.Z.getType(e),model:e,runScene:this.runScene});t!==e&&(e.parent.add(t),e.parent.remove(e)),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(t)}_processModelMaterial(e){if(e.material)if((0,bt.isMultiMaterial)(e.material)){const t=[];(0,bt.getMaterials)(e.material).map((e=>{const r=this.runScene.modelEx.create("Box");var n=(0,X.Ki)(e);const a=this.materialMap[n];a&&(a.normalMaterial&&(r.material=a.normalMaterial),a.models.push(r)),t.push(n);var{material:i,normal:s,textures:o}=this.runScene.materialEx.isBaseMaterial(e)||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(r):this.runScene.materialEx.toNromal(e);r.material=i,e.userData.id=n,this.materialMap[n]={oldMaterial:e,normalMaterial:i,models:[r],normal:s,textures:o},this.helperModel.add(r)})),e.material=this.runScene.materialEx.defMaterial,(0,bt.setMaterialIds)(e,t)}else{const n=this.materialMap[e.material.userData.id];if(n)return n.normalMaterial&&(e.material=n.normalMaterial),void n.models.push(e);var t=this.runScene.materialEx.isBaseMaterial(e.material),r=e.material;const{material:a,normal:i,textures:s}=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material);e.material=a,t=r.userData.id,a.userData.id=t,this.materialMap[t]={oldMaterial:r,normalMaterial:a,models:[e],normal:i,textures:s}}}materialMapToJson(){(0,i.mapObj)(this.materialMap,((e,t)=>{var{normalMaterial:t,textures:r,normal:n}=t,a=t.userData.id;this.helper.ex.materialMap[a]||(this.helper.ex.materialMap[a]={normal:n,textures:{}},this.mergeAndRemoveTexture(r,t,this.materialMapToJsonPending))})),this.parseScenePeding.push((0,i.eachTriggerArray)(this.materialMapToJsonPending))}mergeSame(e){return xt(this,void 0,void 0,(function*(){if(e.userData||(e.userData={}),(0,D.isClonedTexture)(e))e=this.parseCloneTexture(e);else if((0,D.isCubeTexture)(e)){var t=this.textureMap[e.userData.id];e=t?t.texture:yield this.parseCubeTexture(e)}else{const t=e.userData;for(const i in this.textureMap){var r=this.textureMap[i],{md5:n,texture:a}=r;if(t.md5===n&&e.mapping===a.mapping&&!(0,D.isClonedTexture)(r.texture))return{isSame:!0,texture:e}}}const i=e.userData;return this.textureMap[e.userData.id]=Object.assign(Object.assign({},i),{texture:e}),{isSame:!1,texture:e}}))}parseTexture(e){var t,{format:r,repeat:n,center:a,rotation:i,offset:s}=e;const o={format:r};3e3!==e.encoding&&(o.encoding=3001),this.runScene.modelEx.isNavieV2(n,1)||(({x:r,y:t}=n),o.repeat=r===t?r:n),this.runScene.modelEx.isNavieV2(a,0)||(({x:t,y:r}=a),o.center=t===r?t:a),this.runScene.modelEx.isNavieV2(s,0)||(({x:n,y:r}=s),o.offset=n===r?n:s),0!==i&&(o.rotation=i),e.flipY&&(o.flipY=1),this.helper.ex.textureMap[e.userData.id]=o}parseCubeTexture(e){return new Promise((t=>xt(this,void 0,void 0,(function*(){let r=new s.Texture(new Image(1,1));var n=Object.keys(e.userData.blobMap).map(((t,r)=>xt(this,void 0,void 0,(function*(){var n=e.userData.blobMap[t],a=e.source.data[r];a=yield(0,D.parseImageBitMapByBlob)(a);const o=new s.Texture(a);o.needsUpdate=!0,a=(0,i.getId)(),(0,D.setMimeForTexture)(o,n.type),o.userData={id:a,blob:n,mimeType:n.type},e.userData.cubeMap||(e.userData.cubeMap={}),e.userData.cubeMap[t]=a,this.textureMap[a]=Object.assign(Object.assign({},o.userData),{texture:o}),this.helper.ex.textureMap[o.userData.id]={isHelper:!0,format:o.format}}))));yield Promise.all(n),e.userData.lightProbe&&(e.userData.lightProbeIntensity=e.userData.lightProbe.intensity),r.userData=Object.assign({},e.userData),t(r)}))))}mergeAndRemoveTexture(e,t,r){return xt(this,void 0,void 0,(function*(){e.map((e=>{r.push((()=>xt(this,void 0,void 0,(function*(){if(!(0,D.isInvalidTexture)(e.texture)){var{type:r,texture:n}=e;this.runScene.uniqueEx.texture.add(n),t[r]=null;const a=(yield this.mergeSame(n)).texture;this.helper.ex.textureMap[a.userData.id]||this.parseTexture(a),"normalMap"!==r||a.userData.isNormalMap||(a.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[r]=a.userData.id}}))))}))}))}parseCloneTexture(e){const t=e.clone();t.userData=Object.assign({},e.userData);var{width:e,height:r}=e.image;const n=document.createElement("canvas");return n.width=e,n.height=r,t.source=new s.Source(n),t.userData.blob=new Blob([new ArrayBuffer(1)]),t}setMultipMaterial(e,t){const r=this.runScene.modelEx.create("Box"),n=(0,bt.createDefMaterial)();r.material=n,e.add(r);for(const e of vt.sG){if(!t.length)return;var a=t.pop();if(!a)return;n[e]=this.textureMap[a].texture}t.length&&this.setMultipMaterial(e,t)}getMaterialFromModel(e){return e&&e.geometry?(e=e.geometry.uuid,this.geoDefMaterialMap.get(e)||this.geoDefMaterialMap.set(e,(0,bt.createDefMaterial)()),{material:this.geoDefMaterialMap.get(e),normal:{},textures:[]}):{material:this.runScene.materialEx.defMaterial,normal:{},textures:[]}}}class St{constructor(e){this.typeSize={},this.map={model:new p.Z,texture:new p.Z},this.allSize=0;var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}add(e){var{type:e,data:t,key:r,size:n}=e;const a=this.map[e].get(r);a?a.size+=n:(this.map[e].set(r,t),this.allSize+=n,this.typeSize[e]=(this.typeSize[e]||0)+n)}toJSON(){const{model:e,texture:t}=this.map,r=[],n={name:"模型",all:0,data:[]},a=(n.data=G.F6.filter(e.map(((e,{name:t,size:r})=>{if(n.all+=r,!(r<1024))return{name:t,size:r}}))).sort(((e,t)=>t.size-e.size)),{name:"贴图",all:0,data:[]});return a.data=G.F6.filter(t.map(((e,{id:t,url:r,size:n})=>{if(a.all+=n,!(n<1024))return{name:t,url:r,size:n}}))).sort(((e,t)=>t.size-e.size)),r.push(n,a),r}}class Mt extends o{constructor(){super(...arguments),this.savedMap=new p.Z,this.clonedMap=new p.Z}getSameNode(e){return this.savedMap.find(((t,r)=>r.materialUuid===e.material.uuid&&r.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,r=(0,X.Ki)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,d.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,d.getClonedIdModel)(e),r=(0,X.Ki)(e);this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set});const n=this.clonedMap.get(t);n&&(n.ids.add(r),n.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,X.Ki)(e),n.newId=t),n.newId&&(n.newId!==r?(0,d.setClonedModel)(e,n.newId):(0,d.delClonedModel)(e)))}parseNode(e){(0,d.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class Tt{constructor(){this.savedMap=new p.Z}getSameCount(e){return this.savedMap.filterData(((t,r)=>r.geometry.attributes.normal.count===e)).map((e=>e.val))}setSameNode(e,t){e.geometry=t}getSameGeo(e,t){var{normal:r,position:n,uv:a}=e.attributes;for(const e of t){var{normal:i,position:s,uv:o}=e.attributes;if(r.array.length===i.array.length&&n.array.length===s.array.length&&a.array.length===o.array.length&&(i=(0,y.F1)([...r.array],[...i.array],2e3<r.length?2e3:"fill"),s=(0,y.F1)([...n.array],[...s.array],2e3<n.length?2e3:"fill"),o=(0,y.F1)([...a.array],[...o.array],2e3<a.length?2e3:"fill"),i&&s&&o))return e}}parseNode(e){if(e&&e.geometry&&e.geometry.attributes&&e.geometry.attributes.normal&&e.geometry.attributes.position&&e.geometry.attributes.uv&&!this.savedMap.get(e.geometry.uuid)){var t=e.geometry,r=(r=t.attributes.normal).count;const a=this.getSameCount(r);if(a){var n=this.getSameGeo(t,a.map((e=>e.geometry)));if(n)return this.setSameNode(e,n)}this.savedMap.set(t.uuid,{count:r,geometry:t})}}}class _t{constructor(e){this.optionsConfigs={},this.addOption=e=>{var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e},(this.runScene=e).cb.exporter.gltf.options.add.add("ExporterGltfOptions",this.addOption)}getParse(e){return this.optionsConfigs[e]}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:r,type:n}=t;return{type:n,data:r(e)}}))}}class Et{constructor(e){this.helperModels=[],this.mergeSameGeo=new Tt,this.pending=[];var{type:e,runScene:t,model:r,msg:n}=e,n=(this.runScene=t,this.type=e,this.bindClondId=new Mt(t),this.ex={materialMap:{},textureMap:{},type:e,msg:n},{helper:this,type:e,runScene:t});this.before=new wt(n),this.size=new St(n),this.pending.push(this.before.parse(r))}parseNode(e){let{object:t,nodeDef:r}=e;return this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,i.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{t[e]!==n&&(r[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,r.wireframe=!0),t}parseMaterial(e){const{material:t,materialDef:r}=e;r.id=t.userData.id,this.ex.materialMap[t.userData.id]||(this.ex.materialMap[t.userData.id]={normal:{},textures:{}}),this.ex.materialMap[t.userData.id].normal=Object.assign(Object.assign({},this.ex.materialMap[t.userData.id].normal),this.runScene.materialEx.getDefNromals(t))}parseTexture(e){let{texture:t,textureDef:r}=e;(0,D.mergeDefUserData)(t.userData,r);var{blob:e,url:n,id:a}=t.userData,{width:a,height:n}=(e&&this.size.add({type:"texture",key:a,data:{id:a,url:n,size:e.size},size:e.size}),(0,D.isClonedTexture)(t)&&(r.cloneSourceId=(0,D.getCloneIdFromTexture)(t)),(0,D.getSizeByTexture)(t));r.size={w:a,h:n}}processGeometry(e){this.size.add({type:"model",data:e,key:e.id,size:e.size})}getNodeMapValueWithBone(e,t){for(const r of t.keys())if(r.userData.id===e.userData.id)return t.get(r)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"]),this.runScene.cb.exporter.gltf.complete.cb({json:e}),this.runScene.cb.exporter.gltf.sizeMap.cb(this.size.toJSON())}}var Dt=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class Ot extends o{constructor(e){super(e),this._gltf=new ae,this._originGltf=new He,this.options=new _t(e),this.module=new ft(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t,r){return Dt(this,void 0,void 0,(function*(){const n=new Et({type:t,runScene:this.runScene,model:e,msg:r});return yield Promise.all(n.pending),new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),(e=>{console.log(e,"e")}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:n,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return Dt(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 Dt(this,void 0,void 0,(function*(){const r=G.F6.toArr(e||this.runScene.modelEx.getSelectedModels());if(0!==r.length){var n=(n=r[0]).name||n.type;const e=new s.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,i.downloadFile)(new Blob([a]),n+".glb"),a}}))}material(e){var t;return Dt(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,d.createDefModel)("Group");let t=r;(t=r instanceof Array?t:[r]).map((t=>{const r=(0,d.createDefModel)("Box");r.material=t,e.add(r)}));var r=r.name||"material",n=yield this.getArrayBuffer(e,"material");(0,i.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0,t="scene"){return Dt(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var r=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t);return e&&(0,i.downloadFile)(new Blob([r]),"scene.glb"),r}))}originModel(e){return Dt(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,i.downloadFile)(new Blob([r]),t+".glb"))}))}}var Pt=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function")}var t,r;return t=e,(r=[{key:"parse",value:function(e){var t="",r=0,n=0,a=0,i=new s.Vector3,o=new s.Color,l=new s.Vector3,c=new s.Vector2,u=[];return e.traverse((function(e){if(!0===e.isMesh){var d=e,h=0,p=0,m=0,f=d.geometry,g=new s.Matrix3,v=f.getAttribute("position"),b=f.getAttribute("normal"),y=f.getAttribute("uv"),x=f.getIndex();if(t+="o "+d.name+"\n",d.material&&d.material.name&&(t+="usemtl "+d.material.name+"\n"),void 0!==v)for(var w=0,S=v.count;w<S;w++,h++)i.fromBufferAttribute(v,w),i.applyMatrix4(d.matrixWorld),t+="v "+i.x+" "+i.y+" "+i.z+"\n";if(void 0!==y)for(var M=0,T=y.count;M<T;M++,m++)c.fromBufferAttribute(y,M),t+="vt "+c.x+" "+c.y+"\n";if(void 0!==b){g.getNormalMatrix(d.matrixWorld);for(var _=0,E=b.count;_<E;_++,p++)l.fromBufferAttribute(b,_),l.applyMatrix3(g).normalize(),t+="vn "+l.x+" "+l.y+" "+l.z+"\n"}if(null!==x)for(var D=0,O=x.count;D<O;D+=3){for(var P=0;P<3;P++){var k=x.getX(D+P)+1;u[P]=r+k+(b||y?"/"+(y?n+k:"")+(b?"/"+(a+k):""):"")}t+="f "+u.join(" ")+"\n"}else for(var A=0,C=v.count;A<C;A+=3){for(var L=0;L<3;L++){var R=A+L+1;u[L]=r+R+(b||y?"/"+(y?n+R:"")+(b?"/"+(a+R):""):"")}t+="f "+u.join(" ")+"\n"}r+=h,n+=m,a+=p}if(!0===e.isLine){var I=e,B=0,U=(f=I.geometry,I.type),j=f.getAttribute("position");if(t+="o "+I.name+"\n",void 0!==j)for(var N=0,z=j.count;N<z;N++,B++)i.fromBufferAttribute(j,N),i.applyMatrix4(I.matrixWorld),t+="v "+i.x+" "+i.y+" "+i.z+"\n";if("Line"===U){t+="l ";for(var F=1,V=j.count;F<=V;F++)t+=r+F+" ";t+="\n"}if("LineSegments"===U)for(var G=1,H=G+1,Z=j.count;G<Z;H=(G+=2)+1)t+="l "+(r+G)+" "+(r+H)+"\n";r+=B}if(!0===e.isPoints){var W=e,K=0,q=(U=W.geometry).getAttribute("position"),X=U.getAttribute("color");if(t+="o "+W.name+"\n",void 0!==q){for(var Y=0,Q=q.count;Y<Q;Y++,K++)i.fromBufferAttribute(q,Y),i.applyMatrix4(W.matrixWorld),t+="v "+i.x+" "+i.y+" "+i.z,void 0!==X&&(o.fromBufferAttribute(X,Y).convertLinearToSRGB(),t+=" "+o.r+" "+o.g+" "+o.b),t+="\n";t+="p ";for(var J=1,$=q.count;J<=$;J++)t+=r+J+" ";t+="\n"}r+=K}})),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();class kt extends o{static getIns(){return this.ins||(this.ins=new Pt),this.ins}model(e){return kt.getIns().parse(e)}}class At extends o{constructor(e){super(e),this.gltf=new Ot(e),this.obj=new kt(e)}}function Ct(e){return(Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Lt(e,t){return(Lt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Rt(e){return(Rt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var It=/^[og]\s*(.+)?/,Bt=/^mtllib /,Ut=/^usemtl /,jt=/^usemap /,Nt=/\s+/,zt=new s.Vector3,Ft=new s.Vector3,Vt=new s.Vector3,Gt=new s.Vector3,Ht=new s.Vector3,Zt=new s.Color;function Wt(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);return r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==r?r:this).smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var r=this.materials.length-1;0<=r;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone&&((e=r.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,r){var n=this.vertices,a=this.object.geometry.vertices;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var n=this.normals,a=this.object.geometry.normals;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,a=this.object.geometry.normals;zt.fromArray(n,e),Ft.fromArray(n,t),Vt.fromArray(n,r),Ht.subVectors(Vt,Ft),Gt.subVectors(zt,Ft),Ht.cross(Gt),Ht.normalize(),a.push(Ht.x,Ht.y,Ht.z),a.push(Ht.x,Ht.y,Ht.z),a.push(Ht.x,Ht.y,Ht.z)},addColor:function(e,t,r){var n=this.colors,a=this.object.geometry.colors;void 0!==n[e]&&a.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&a.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&a.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,a=this.object.geometry.uvs;a.push(n[e+0],n[e+1]),a.push(n[t+0],n[t+1]),a.push(n[r+0],n[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,n,a,i,s,o,l){var c=this.vertices.length;e=this.parseVertexIndex(e,c),t=this.parseVertexIndex(t,c),r=this.parseVertexIndex(r,c),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==s&&""!==s?(c=this.normals.length,e=this.parseNormalIndex(s,c),t=this.parseNormalIndex(o,c),r=this.parseNormalIndex(l,c),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(s=this.uvs.length,e=this.parseUVIndex(n,s),t=this.parseUVIndex(a,s),r=this.parseUVIndex(i,s),this.addUV(e,t,r),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++){var a=this.parseVertexIndex(e[r],t);this.addVertexPoint(a),this.addColor(a)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,a=0,i=e.length;a<i;a++)this.addVertexLine(this.parseVertexIndex(e[a],r));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],n))}};return e.startObject("",!1),e}var Kt=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lt(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Rt(e);if(r=t?(r=Rt(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ct(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"load",value:function(e,t,r,n){var a=this,i=new s.FileLoader(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(function(r){try{t(a.parse(r))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t=new Wt,r=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),n=[],a=0,i=r.length;a<i;a++){var o=r[a].trimStart();if(0!==o.length){var l,c=o.charAt(0);if("#"!==c)if("v"===c){var u=o.split(Nt);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),7<=u.length?(Zt.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6])).convertSRGBToLinear(),t.colors.push(Zt.r,Zt.g,Zt.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]))}}else if("f"===c){for(var d=o.slice(1).trim().split(Nt),h=[],p=0,m=d.length;p<m;p++){var f=d[p];0<f.length&&(f=f.split("/"),h.push(f))}for(var g=h[0],v=1,b=h.length-1;v<b;v++){var y=h[v],x=h[v+1];t.addFace(g[0],y[0],x[0],g[1],y[1],x[1],g[2],y[2],x[2])}}else if("l"===c){var w=o.substring(1).trim().split(" "),S=[],M=[];if(-1===o.indexOf("/"))S=w;else for(var T=0,_=w.length;T<_;T++){var E=w[T].split("/");""!==E[0]&&S.push(E[0]),""!==E[1]&&M.push(E[1])}t.addLineGeometry(S,M)}else"p"===c?(l=o.slice(1).trim().split(" "),t.addPointGeometry(l)):null!==(n=It.exec(o))?(l=(" "+n[0].slice(1).trim()).slice(1),t.startObject(l)):Ut.test(o)?t.object.startMaterial(o.substring(7).trim(),t.materialLibraries):Bt.test(o)?t.materialLibraries.push(o.substring(7).trim()):jt.test(o)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===c?(1<(n=o.split(" ")).length?(c=n[1].trim().toLowerCase(),t.object.smooth="0"!==c&&"off"!==c):t.object.smooth=!0,(c=t.object.currentMaterial())&&(c.smooth=t.object.smooth)):"\0"!==o&&console.warn('THREE.OBJLoader: Unexpected line: "'+o+'"')}}t.finalize();var D,O=new s.Group;if(1==(O.materialLibraries=[].concat(t.materialLibraries),e=!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length)))for(var P=0,k=t.objects.length;P<k;P++){var A=t.objects[P],C=A.geometry,L=A.materials,R="Line"===C.type,I="Points"===C.type,B=!1;if(0!==C.vertices.length){for(var U=new s.BufferGeometry,j=(U.setAttribute("position",new s.Float32BufferAttribute(C.vertices,3)),0<C.normals.length&&U.setAttribute("normal",new s.Float32BufferAttribute(C.normals,3)),0<C.colors.length&&(B=!0,U.setAttribute("color",new s.Float32BufferAttribute(C.colors,3))),!0===C.hasUVIndices&&U.setAttribute("uv",new s.Float32BufferAttribute(C.uvs,2)),[]),N=0,z=L.length;N<z;N++){var F,V=L[N],G=V.name+"_"+V.smooth+"_"+B,H=t.materials[G];null!==this.materials&&(H=this.materials.create(V.name),!R||!H||H instanceof s.LineBasicMaterial?!I||!H||H instanceof s.PointsMaterial||(F=new s.PointsMaterial({size:10,sizeAttenuation:!1}),s.Material.prototype.copy.call(F,H),F.color.copy(H.color),F.map=H.map,H=F):(F=new s.LineBasicMaterial,s.Material.prototype.copy.call(F,H),F.color.copy(H.color),H=F)),void 0===H&&((H=R?new s.LineBasicMaterial:I?new s.PointsMaterial({size:1,sizeAttenuation:!1}):new s.MeshPhongMaterial).name=V.name,H.flatShading=!V.smooth,H.vertexColors=B,t.materials[G]=H),j.push(H)}if(C=void 0,1<j.length){for(var Z=0,W=L.length;Z<W;Z++){var K=L[Z];U.addGroup(K.groupStart,K.groupCount,Z)}C=new(R?s.LineSegments:I?s.Points:s.Mesh)(U,j)}else C=new(R?s.LineSegments:I?s.Points:s.Mesh)(U,j[0]);C.name=A.name,O.add(C)}}else 0<t.vertices.length&&(e=new s.PointsMaterial({size:1,sizeAttenuation:!1}),(D=new s.BufferGeometry).setAttribute("position",new s.Float32BufferAttribute(t.vertices,3)),0<t.colors.length&&void 0!==t.colors[0]&&(D.setAttribute("color",new s.Float32BufferAttribute(t.colors,3)),e.vertexColors=!0),D=new s.Points(D,e),O.add(D));return O}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Loader);n=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(n(""))}catch(r){n=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}for(var qt=Uint8Array,Xt=Uint16Array,Yt=Uint32Array,Qt=new qt([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]),Jt=new qt([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]),$t=new qt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),er=(he=function(e,t){for(var r=new Xt(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var a=new Yt(r[30]);for(n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return[r,a]},(de=he(Qt,2))[0]),tr=(ue=de[1],(er[28]=258,ue[258]=28,ce=he(Jt,0))[0]),rr=(ce[1],new Xt(32768)),nr=0;nr<32768;++nr){var ar=(43690&nr)>>>1|(21845&nr)<<1;rr[nr]=((65280&(ar=(61680&(ar=(52428&ar)>>>2|(13107&ar)<<2))>>>4|(3855&ar)<<4))>>>8|(255&ar)<<8)>>>1}var ir=function(e,t,r){for(var n=e.length,a=0,i=new Xt(t);a<n;++a)++i[e[a]-1];var s=new Xt(t);for(a=0;a<t;++a)s[a]=s[a-1]+i[a-1]<<1;if(r){var o=new Xt(1<<t),l=15-t;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],d=s[e[a]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)o[rr[d]>>>l]=c}else for(o=new Xt(n),a=0;a<n;++a)e[a]&&(o[a]=rr[s[e[a]-1]++]>>>15-e[a]);return o},sr=new qt(288);for(nr=0;nr<144;++nr)sr[nr]=8;for(nr=144;nr<256;++nr)sr[nr]=9;for(nr=256;nr<280;++nr)sr[nr]=7;for(nr=280;nr<288;++nr)sr[nr]=8;var or=new qt(32);for(nr=0;nr<32;++nr)or[nr]=5;var lr=ir(sr,9,1),cr=ir(or,5,1),ur=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},dr=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},hr=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},pr=function(e){return(e/8|0)+(7&e&&1)},mr=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof Xt?Xt:e instanceof Yt?Yt:qt)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n};pe=new qt(0),me="undefined"!=typeof TextDecoder&&new TextDecoder;try{me.decode(pe,{stream:!0})}catch(r){}function fr(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var a=e,i=n,s=Math.floor((a+i)/2);t<r[s]||t>=r[s+1];)t<r[s]?i=s:a=s,s=Math.floor((a+i)/2);return s}function gr(e,t,r,n){for(var a=[],i=[],s=[],o=a[0]=1;o<=r;++o){i[o]=t-n[e+1-o],s[o]=n[e+o]-t;for(var l=0,c=0;c<o;++c){var u=s[c+1],d=i[o-c],h=a[c]/(u+d);a[c]=l+u*h,l=d*h}a[o]=l}return a}function vr(e,t,r,n,a){for(var i=a<e?a:e,o=[],l=fr(e,n,t),c=function(e,t,r,n,a){for(var i=[],s=0;s<=r;++s)i[s]=0;for(var o=[],l=0;l<=n;++l)o[l]=i.slice(0);for(var c=[],u=0;u<=r;++u)c[u]=i.slice(0);c[0][0]=1;for(var d=i.slice(0),h=i.slice(0),p=1;p<=r;++p){d[p]=t-a[e+1-p],h[p]=a[e+p]-t;for(var m=0,f=0;f<p;++f){var g=h[f+1],v=d[p-f],b=(c[p][f]=g+v,c[f][p-1]/c[p][f]);c[f][p]=m+g*b,m=v*b}c[p][p]=m}for(var y=0;y<=r;++y)o[0][y]=c[y][r];for(var x=0;x<=r;++x){for(var w=0,S=1,M=[],T=0;T<=r;++T)M[T]=i.slice(0);for(var _=M[0][0]=1;_<=n;++_){var E=0,D=x-_,O=r-_;_<=x&&(M[S][0]=M[w][0]/c[1+O][D],E=M[S][0]*c[D][O]);for(var P=x-1<=O?_-1:r-x,k=-1<=D?1:-D;k<=P;++k)M[S][k]=(M[w][k]-M[w][k-1])/c[1+O][D+k],E+=M[S][k]*c[D+k][O];x<=O&&(M[S][_]=-M[w][_-1]/c[1+O][x],E+=M[S][_]*c[x][O]),o[_][x]=E;var A=w;w=S,S=A}}for(var C=r,L=1;L<=n;++L){for(var R=0;R<=r;++R)o[L][R]*=C;C*=r-L}return o}(l,n,e,i,t),u=[],d=0;d<r.length;++d){var h=r[d].clone(),p=h.w;h.x*=p,h.y*=p,h.z*=p,u[d]=h}for(var m=0;m<=i;++m){for(var f=u[l-e].clone().multiplyScalar(c[m][0]),g=1;g<=e;++g)f.add(u[l-e+g].clone().multiplyScalar(c[m][g]));o[m]=f}for(var v=i+1;v<=a+1;++v)o[v]=new s.Vector4(0,0,0);return o}function br(e){for(var t=e.length,r=[],n=[],a=0;a<t;++a){var i=e[a];r[a]=new s.Vector3(i.x,i.y,i.z),n[a]=i.w}for(var o=[],l=0;l<t;++l){for(var c=r[l].clone(),u=1;u<=l;++u)c.sub(o[l-u].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var a=1,i=2;i<=t;++i)a*=i;for(var s=2;s<=e-t;++s)a*=s;return r/a}(l,u)*n[u]));o[l]=c.divideScalar(n[0])}return o}function yr(e){return(yr="function"==typeof Symbol&&"symbol"==typeof 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 xr(e,t){return(xr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wr(e){return(wr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Sr,Mr,Tr,_r=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&xr(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=wr(e);if(r=t?(r=wr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===yr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(l=r.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=i||0,l.endKnot=o||l.knots.length-1;for(var c=0;c<a.length;++c){var u=a[c];l.controlPoints[c]=new s.Vector4(u.x,u.y,u.z,u.w)}return l}return t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,n){for(var a=fr(e,n,t),i=gr(a,n,e,t),o=new s.Vector4(0,0,0,0),l=0;l<=e;++l){var c=r[a-e+l],u=i[l],d=c.w*u;o.x+=c.x*d,o.y+=c.y*d,o.z+=c.z*d,o.w+=c.w*u}return o}(this.degree,this.knots,this.controlPoints,e),1!==e.w&&e.divideScalar(e.w),t.set(e.x,e.y,e.z)}},{key:"getTangent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),br(vr(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[1]).normalize(),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Curve);function Er(e){return(Er="function"==typeof Symbol&&"symbol"==typeof 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 Dr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Or(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Pr(e,t,r){t&&Or(e.prototype,t),r&&Or(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function kr(e,t){return(kr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ar(e){return(Ar=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Cr=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&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 r,n=Ar(e);if(r=t?(r=Ar(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Er(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){return Dr(this,n),r.call(this,e)}return Pr(n,[{key:"load",value:function(e,t,r,n){var a=this,i=""===a.path?s.LoaderUtils.extractUrlBase(e):a.path,o=new s.FileLoader(this.manager);o.setPath(a.path),o.setResponseType("arraybuffer"),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,(function(r){try{t(a.parse(r,i))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"parse",value:function(e,t,r){if(a="Kaydara FBX Binary \0",(n=e).byteLength>=a.length&&a===Xr(n,0,a.length))Sr=(new Ur).parse(e);else{if(!function(e){for(var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0,n=0;n<t.length;++n)if(function(t){var n=e[0];return e=e.slice(r+1),r++,n}()===t[n])return;return 1}(n=Xr(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(zr(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+zr(n));Sr=(new Br).parse(n)}var n,a=new s.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Lr(a,this.manager,r).parse(Sr)}}]),n}(s.Loader),Lr=function(){function e(t,r,n){Dr(this,e),this.textureLoader=t,this.manager=r,this.options=n}return Pr(e,[{key:"parse",value:function(){Mr=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new Rr).parse(t);return this.parseScene(t,r,e),Tr}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Sr&&Sr.Connections.connections.forEach((function(t){var r=t[0],n=t[1],a=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(a),e.has(n)||e.set(n,{parents:[],children:[]}),a={ID:r,relationship:t},e.get(n).children.push(a)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in Sr.Objects){var n,a=Sr.Objects.Video;for(n in a){var i,s,o=a[n];t[parseInt(n)]=o.RelativeFilename||o.Filename,"Content"in o&&(s=o.Content instanceof ArrayBuffer&&0<o.Content.byteLength,i="string"==typeof o.Content&&""!==o.Content,(s||i)&&(s=this.parseImage(a[n]),r[o.RelativeFilename||o.Filename]=s))}}for(e in t){var l=t[e];void 0!==r[l]?t[e]=r[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,a=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(a){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+a+'" is not supported.')}return"string"==typeof r?"data:"+t+";base64,"+r:(e=new Uint8Array(r),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Sr.Objects){var r,n=Sr.Objects.Texture;for(r in n){var a=this.parseTexture(n[r],e);t.set(parseInt(r),a)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),n=e.WrapModeV;return r=void 0!==r?r.value:0,n=void 0!==n?n.value:0,t.wrapS=0===r?s.RepeatWrapping:s.ClampToEdgeWrapping,t.wrapT=0===n?s.RepeatWrapping:s.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(n=e.Translation.value,t.offset.x=n[0],t.offset.y=n[1]),t}},{key:"loadTexture",value:function(e,t){var r,n=this.textureLoader.path,a=Mr.get(e.id).children;return a="tga"===(void 0!==a&&0<a.length&&void 0!==t[a[0].ID]&&(0!==(r=t[a[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0)),t=e.FileName.slice(-3).toLowerCase())?null===(a=this.manager.getHandler(".tga"))?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),new s.Texture):(a.setPath(this.textureLoader.path),a.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new s.Texture):this.textureLoader.load(r,this.options.onTextureLoaded),this.textureLoader.setPath(n),a}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Sr.Objects){var r,n=Sr.Objects.Material;for(r in n){var a=this.parseMaterial(n[r],e);null!==a&&t.set(parseInt(r),a)}}return t}},{key:"parseMaterial",value:function(e,t){var r,n=e.id,a=e.attrName,i=e.ShadingModel;if("object"===Er(i)&&(i=i.value),!Mr.has(n))return null;switch(e=this.parseParameters(e,t,n),i.toLowerCase()){case"phong":r=new s.MeshPhongMaterial;break;case"lambert":r=new s.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),r=new s.MeshPhongMaterial}return r.setValues(e),r.name=a,r}},{key:"parseParameters",value:function(e,t,r){var n={},a=(e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new s.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new s.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new s.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new s.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new s.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new s.Color).fromArray(e.SpecularColor.value)),this);return Mr.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":n.bumpMap=a.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=a.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=a.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=s.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=a.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=a.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=s.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=a.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=a.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=s.EquirectangularReflectionMapping,n.envMap.encoding=s.sRGBEncoding);break;case"SpecularColor":n.specularMap=a.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=s.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=a.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Sr.Objects&&t in Sr.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Mr.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Sr.Objects){var r,n=Sr.Objects.Deformer;for(r in n){var a,i=n[r],s=Mr.get(parseInt(r));"Skin"===i.attrType?((a=this.parseSkeleton(s,n)).ID=r,1<s.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=s.parents[0].ID,e[r]=a):"BlendShape"===i.attrType&&((a={id:r}).rawTargets=this.parseMorphTargets(s,n),a.id=r,1<s.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=a)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var n=t[e.ID];"Cluster"===n.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new s.Matrix4).fromArray(n.TransformLink.a)},"Indexes"in n&&(e.indices=n.Indexes.a,e.weights=n.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var a=e.children[n],i=t[a.ID],s={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if("BlendShapeChannel"!==i.attrType)return;s.geoID=Mr.get(parseInt(a.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(e,t,r){Tr=new s.Group;var n=this.parseModels(e.skeletons,t,r),a=Sr.Objects.Model,i=this;n.forEach((function(e){var t=a[e.ID];i.setLookAtProperties(e,t),Mr.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&Tr.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),Tr.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=Wr(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new Ir).parse(),1===Tr.children.length&&Tr.children[0].isGroup&&(Tr.children[0].animations=r,Tr=Tr.children[0]),Tr.animations=r}},{key:"parseModels",value:function(e,t,r){var n,a=new Map,i=Sr.Objects.Model;for(n in i){var o=parseInt(n),l=i[n],c=Mr.get(o),u=this.buildSkeleton(c,e,o,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(c);break;case"Light":u=this.createLight(c);break;case"Mesh":u=this.createMesh(c,t,r);break;case"NurbsCurve":u=this.createCurve(c,t);break;case"LimbNode":case"Root":u=new s.Bone;break;default:u=new s.Group}u.name=l.attrName?s.PropertyBinding.sanitizeNodeName(l.attrName):"",u.ID=o}this.getTransformData(u,l),a.set(o,u)}return a}},{key:"buildSkeleton",value:function(e,t,r,n){var a=null;return e.parents.forEach((function(e){for(var i in t)!function(i){var o=t[i];o.rawBones.forEach((function(t,i){var l;t.ID===e.ID&&(l=a,(a=new s.Bone).matrixWorld.copy(t.transformLink),a.name=n?s.PropertyBinding.sanitizeNodeName(n):"",a.ID=r,o.bones[i]=a,null!==l&&a.add(l))}))}(i)})),a}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Sr.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{var n=0,a=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1),1),i=(void 0!==r.NearPlane&&(a=r.NearPlane.value/1e3),1e3),o=(void 0!==r.FarPlane&&(i=r.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,c=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(o=r.AspectWidth.value,l=r.AspectHeight.value),o/l),u=45,d=(void 0!==r.FieldOfView&&(u=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(n){case 0:t=new s.PerspectiveCamera(u,c,a,i),null!==d&&t.setFocalLength(d);break;case 1:t=new s.OrthographicCamera(-o/2,o/2,l/2,-l/2,a,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new s.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Sr.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,a=(void 0!==r.Color&&(n=(new s.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),i=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0),0);switch(void 0!==r.FarAttenuationEnd&&(i=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new s.PointLight(n,a,i,1);break;case 1:t=new s.DirectionalLight(n,a);break;case 2:var o=Math.PI/3,l=(void 0!==r.InnerAngle&&(o=s.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(l=s.MathUtils.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new s.SpotLight(n,a,i,o,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new s.PointLight(n,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var n,a=null,i=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(a=t.get(e.ID)),r.has(e.ID)&&o.push(r.get(e.ID))})),1<o.length?i=o:0<o.length?i=o[0]:(i=new s.MeshPhongMaterial({color:13421772}),o.push(i)),"color"in a.attributes&&o.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(n=new s.SkinnedMesh(a,i)).normalizeSkinWeights():n=new s.Mesh(a,i),n}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,r){return t.has(r.ID)?t.get(r.ID):e}),null);var r=new s.LineBasicMaterial({color:3342591,linewidth:1});return new s.Line(e,r)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?Kr(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Mr.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Sr.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Tr.add(e.target)):e.lookAt((new s.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var n,a=this.parsePoseNodes();for(n in e)!function(n){var i=e[n];Mr.get(parseInt(i.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Mr.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new s.Skeleton(i.bones),a[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Sr.Objects){var t,r,n=Sr.Objects.Pose;for(t in n)"BindPose"===n[t].attrType&&0<n[t].NbPoseNodes&&(r=n[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new s.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new s.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in Sr&&"AmbientColor"in Sr.GlobalSettings&&(r=(t=Sr.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new s.Color(r,e,t),Tr.add(new s.AmbientLight(r,1))))}}]),e}(),Rr=function(){function e(){Dr(this,e),this.negativeMaterialIndices=!1}return Pr(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Sr.Objects){var r,n=Sr.Objects.Geometry;for(r in n){var a=Mr.get(parseInt(r));a=this.parseGeometry(a,n[r],e),t.set(parseInt(r),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var n,a=r.skeletons,i=[],s=e.parents.map((function(e){return Sr.Objects.Model[e.ID]}));if(0!==s.length)return n=e.children.reduce((function(e,t){return void 0!==a[t.ID]?a[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&i.push(r.morphTargets[e.ID])})),e=s[0],s={},"RotationOrder"in e&&(s.eulerOrder=Kr(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=Wr(s),this.genGeometry(t,n,i,e)}},{key:"genGeometry",value:function(e,t,r,n){var a,i,o=new s.BufferGeometry,l=(e.attrName&&(o.name=e.attrName),this.parseGeoNode(e,t)),c=this.genBuffers(l),u=new s.Float32BufferAttribute(c.vertex,3);return u.applyMatrix4(n),o.setAttribute("position",u),0<c.colors.length&&o.setAttribute("color",new s.Float32BufferAttribute(c.colors,3)),t&&(o.setAttribute("skinIndex",new s.Uint16BufferAttribute(c.weightsIndices,4)),o.setAttribute("skinWeight",new s.Float32BufferAttribute(c.vertexWeights,4)),o.FBX_Deformer=t),0<c.normal.length&&(u=(new s.Matrix3).getNormalMatrix(n),(t=new s.Float32BufferAttribute(c.normal,3)).applyNormalMatrix(u),o.setAttribute("normal",t)),c.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();o.setAttribute(r=0===t?"uv":r,new s.Float32BufferAttribute(c.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(a=c.materialIndex[0],i=0,c.materialIndex.forEach((function(e,t){e!==a&&(o.addGroup(i,t-i,a),a=e,i=t)})),0<o.groups.length&&(t=(u=o.groups[o.groups.length-1]).start+u.count)!==c.materialIndex.length&&o.addGroup(t,c.materialIndex.length-t,a),0===o.groups.length&&o.addGroup(0,c.materialIndex.length,c.materialIndex[0])),this.addMorphTargets(o,e,r,n),o}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var n=0;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return r.weightTable={},null!==t&&(r.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(n,a){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[a]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,a=!1,i=[],s=[],o=[],l=[],c=[],u=[],d=this;return e.vertexIndices.forEach((function(h,p){var m,f,g,v,b=!1,y=(h<0&&(h^=-1,b=!0),[]),x=[];if(i.push(3*h,3*h+1,3*h+2),e.color&&(v=Gr(p,r,h,e.color),o.push(v[0],v[1],v[2])),e.skeleton){for(void 0!==e.weightTable[h]&&e.weightTable[h].forEach((function(e){x.push(e.weight),y.push(e.id)})),4<x.length&&(a||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),a=!0),f=[0,0,0,0],g=[0,0,0,0],x.forEach((function(e,t){var r=e,n=y[t];g.forEach((function(e,t,a){e<r&&(a[t]=r,r=e,a=f[t],f[t]=n,n=a)}))})),y=f,x=g);x.length<4;)x.push(0),y.push(0);for(var w=0;w<4;++w)c.push(x[w]),u.push(y[w])}e.normal&&(v=Gr(p,r,h,e.normal),s.push(v[0],v[1],v[2])),e.material&&"AllSame"!==e.material.mappingType&&(m=Gr(p,r,h,e.material)[0])<0&&(d.negativeMaterialIndices=!0,m=0),e.uv&&e.uv.forEach((function(e,t){e=Gr(p,r,h,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,b&&(4<n&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),d.genFace(t,e,i,m,s,o,l,c,u,n),r++,n=0,i=[],s=[],o=[],l=[],c=[],u=[])})),t}},{key:"genFace",value:function(e,t,r,n,a,i,s,o,l,c){for(var u=2;u<c;u++)!function(c){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(c-1)]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+2]]),e.vertex.push(t.vertexPositions[r[3*c]]),e.vertex.push(t.vertexPositions[r[3*c+1]]),e.vertex.push(t.vertexPositions[r[3*c+2]]),t.skeleton&&(e.vertexWeights.push(o[0]),e.vertexWeights.push(o[1]),e.vertexWeights.push(o[2]),e.vertexWeights.push(o[3]),e.vertexWeights.push(o[4*(c-1)]),e.vertexWeights.push(o[4*(c-1)+1]),e.vertexWeights.push(o[4*(c-1)+2]),e.vertexWeights.push(o[4*(c-1)+3]),e.vertexWeights.push(o[4*c]),e.vertexWeights.push(o[4*c+1]),e.vertexWeights.push(o[4*c+2]),e.vertexWeights.push(o[4*c+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(c-1)]),e.weightsIndices.push(l[4*(c-1)+1]),e.weightsIndices.push(l[4*(c-1)+2]),e.weightsIndices.push(l[4*(c-1)+3]),e.weightsIndices.push(l[4*c]),e.weightsIndices.push(l[4*c+1]),e.weightsIndices.push(l[4*c+2]),e.weightsIndices.push(l[4*c+3])),t.color&&(e.colors.push(i[0]),e.colors.push(i[1]),e.colors.push(i[2]),e.colors.push(i[3*(c-1)]),e.colors.push(i[3*(c-1)+1]),e.colors.push(i[3*(c-1)+2]),e.colors.push(i[3*c]),e.colors.push(i[3*c+1]),e.colors.push(i[3*c+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(a[0]),e.normal.push(a[1]),e.normal.push(a[2]),e.normal.push(a[3*(c-1)]),e.normal.push(a[3*(c-1)+1]),e.normal.push(a[3*(c-1)+2]),e.normal.push(a[3*c]),e.normal.push(a[3*c+1]),e.normal.push(a[3*c+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(s[r][0]),e.uvs[r].push(s[r][1]),e.uvs[r].push(s[r][2*(c-1)]),e.uvs[r].push(s[r][2*(c-1)+1]),e.uvs[r].push(s[r][2*c]),e.uvs[r].push(s[r][2*c+1])}))}(u)}},{key:"addMorphTargets",value:function(e,t,r,n){var a;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],a=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var i=Sr.Objects.Geometry[r.geoID];void 0!==i&&a.genMorphGeometry(e,t,i,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,n,a){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var i=void 0!==r.Vertices?r.Vertices.a:[],o=void 0!==r.Indexes?r.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l),u=0;u<o.length;u++){var d=3*o[u];c[d]=i[3*u],c[1+d]=i[3*u+1],c[2+d]=i[3*u+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:c}),(t=new s.Float32BufferAttribute(l.vertex,3)).name=a||r.attrName,t.applyMatrix4(n),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,a=[];return"IndexToDirect"===r&&("NormalIndex"in e?a=e.NormalIndex.a:"NormalsIndex"in e&&(a=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:2,buffer:e.UV.a,indices:n="IndexToDirect"===r?e.UVIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:4,buffer:e.Colors.a,indices:n="IndexToDirect"===r?e.ColorIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,a=[],i=0;i<n.length;++i)a.push(i);return{dataSize:1,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new s.BufferGeometry;for(var r=t-1,n=(t=e.KnotVector.a,[]),a=e.Points.a,i=0,o=a.length;i<o;i+=4)n.push((new s.Vector4).fromArray(a,i));if("Closed"===e.Form)n.push(n[0]);else if("Periodic"===e.Form)for(var l=r,c=t.length-1-l,u=0;u<r;++u)n.push(n[u]);return e=new _r(r,t,n,l,c).getPoints(12*n.length),(new s.BufferGeometry).setFromPoints(e)}}]),e}(),Ir=function(){function e(){Dr(this,e)}return Pr(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t)r=t[r],r=this.addClip(r),e.push(r);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Sr.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Sr.Objects.AnimationCurveNode,r=new Map;for(e in t){var n=t[e];null!==n.attrName.match(/S|R|T|DeformPercent/)&&(n={id:n.id,attr:n.attrName,curves:{}},r.set(n.id,n))}return r}},{key:"parseAnimationCurves",value:function(e){var t,r=Sr.Objects.AnimationCurve;for(t in r){var n,a={id:r[t].id,times:r[t].KeyTime.a.map(Fr),values:r[t].KeyValueFloat.a},i=Mr.get(a.id);void 0!==i&&(n=i.parents[0].ID,(i=i.parents[0].relationship).match(/X/)?e.get(n).curves.x=a:i.match(/Y/)?e.get(n).curves.y=a:i.match(/Z/)?e.get(n).curves.z=a:i.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=a))}}},{key:"parseAnimationLayers",value:function(e){var t,r=Sr.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],a=Mr.get(parseInt(t));void 0!==a&&(a.children.forEach((function(t,n){if(e.has(t.ID)){var a=e.get(t.ID);if(void 0!==a.curves.x||void 0!==a.curves.y||void 0!==a.curves.z){if(void 0===r[n]){var i=Mr.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==i){var o=Sr.Objects.Model[i.toString()];if(void 0===o)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:o.attrName?s.PropertyBinding.sanitizeNodeName(o.attrName):"",ID:o.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Tr.traverse((function(e){e.ID===o.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new s.Matrix4),"PreRotation"in o&&(l.preRotation=o.PreRotation.value),"PostRotation"in o&&(l.postRotation=o.PostRotation.value),r[n]=l}}r[n]&&(r[n][a.attr]=a)}else void 0!==a.curves.morph&&(void 0===r[n]&&(i=Mr.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Mr.get(i).parents[0].ID,t=Mr.get(t).parents[0].ID,t=Mr.get(t).parents[0].ID,t={modelName:(t=Sr.Objects.Model[t]).attrName?s.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Sr.Objects.Deformer[i].attrName},r[n]=t),r[n][a.attr]=a)}})),n.set(parseInt(t),r))}(t);return n}},{key:"parseAnimStacks",value:function(e){var t,r=Sr.Objects.AnimationStack,n={};for(t in r){var a=(1<(a=Mr.get(parseInt(t)).children).length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."),e.get(a[0].ID));n[t]={name:r[t].attrName,layer:a}}return n}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new s.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new s.Vector3,n=new s.Quaternion,a=new s.Vector3;return e.transform&&e.transform.decompose(r,n,a),r=r.toArray(),n=(new s.Euler).setFromQuaternion(n,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.T.curves,r,"position"))&&t.push(r),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(r=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale"))&&t.push(n),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,n){var a=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(a,t,r),new s.VectorKeyframeTrack(e+"."+n,a,t)}},{key:"generateRotationTrack",value:function(e,t,r,n,a,i){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(s.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(s.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(s.MathUtils.degToRad));for(var o=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(o,t,r),c=(void 0!==n&&((n=n.map(s.MathUtils.degToRad)).push(i),n=(new s.Euler).fromArray(n),n=(new s.Quaternion).setFromEuler(n)),void 0!==a&&((a=a.map(s.MathUtils.degToRad)).push(i),a=(new s.Euler).fromArray(a),a=(new s.Quaternion).setFromEuler(a).invert()),new s.Quaternion),u=new s.Euler,d=[],h=0;h<l.length;h+=3)u.set(l[h],l[h+1],l[h+2],i),c.setFromEuler(u),void 0!==n&&c.premultiply(n),void 0!==a&&c.multiply(a),c.toArray(d,h/3*4);return new s.QuaternionKeyframeTrack(e+".quaternion",o,d)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),n=Tr.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new s.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,r)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var r=1,n=t[0],a=1;a<t.length;a++){var i=t[a];i!==n&&(n=t[r]=i,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,a=[],i=-1,s=-1,o=-1;return e.forEach((function(e){t.x&&(i=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(o=t.z.times.indexOf(e)),-1!==i?(e=t.x.values[i],a.push(e),n[0]=e):a.push(n[0]),-1!==s?(e=t.y.values[s],a.push(e),n[1]=e):a.push(n[1]),-1!==o?(e=t.z.values[o],a.push(e),n[2]=e):a.push(n[2])})),a}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],n=e.values[t]-r;if(180<=(a=Math.abs(n))){for(var a,i=n/(a/=180),s=r+i,o=(n=e.times[t-1],(e.times[t]-n)/a),l=n+o,c=[],u=[];l<e.times[t];)c.push(l),l+=o,u.push(s),s+=i;e.times=Yr(e.times,t,c),e.values=Yr(e.values,t,u)}}}}]),e}(),Br=function(){function e(){Dr(this,e)}return Pr(e,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),--this.currentIndent}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new Nr,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var a,i=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);i||s||(i=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),a=e.match("^\\t{"+(t.currentIndent-1)+"}}"),i?t.parseNodeBegin(e,i):s?t.parseNodeProperty(e,s,r[++n]):a?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:r}),a=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in a?("PoseNode"===r?a.PoseNode.push(n):void 0!==a[r].id&&(a[r]={},a[r][a[r].id]=a[r]),""!==t.id&&(a[r][t.id]=n)):"number"==typeof t.id?(a[r]={},a[r][t.id]=n):"Properties70"!==r&&(a[r]="PoseNode"===r?[n]:n),"number"==typeof t.id&&(n.id=t.id),""!==t.name&&(n.attrName=t.name),""!==t.type&&(n.attrType=t.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0],r=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),n="";return 1<e.length&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}}},{key:"parseNodeProperty",value:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===n&&","===t&&(t=r.replace(/"/g,"").replace(/,$/,"").trim()),r=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,n,t);else{if("C"===n){e=t.split(",").slice(1);for(var a=parseInt(e[0]),i=(e=parseInt(e[1]),(i=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),s=(n="connections",t=[a,e]),o=i,l=0,c=s.length,u=o.length;l<u;l++,c++)s[c]=o[l];void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=t),n in r&&Array.isArray(r[n])?r[n].push(t):"a"!==n?r[n]=t:r.a=t,this.setCurrentProp(r,n),"a"===n&&","!==t.slice(-1)&&(r.a=qr(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=qr(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){r=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var n=r[0],a=r[1],i=r[2],s=r[3],o=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":o=parseFloat(o);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":o=qr(o)}this.getPrevNode()[n]={type:a,type2:i,flag:s,value:o},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),Ur=function(){function e(){Dr(this,e)}return Pr(e,[{key:"parse",value:function(e){var t=new jr(e),r=(t.skip(23),t.getUint32());if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new Nr;!this.endOfContent(t);){var a=this.parseNode(t,r);null!==a&&n.add(a.name,a)}return n}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var r={},n=7500<=t?e.getUint64():e.getUint32(),a=7500<=t?e.getUint64():e.getUint32(),i=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),s=e.getString(i);if(0===n)return null;for(var o=[],l=0;l<a;l++)o.push(this.parseProperty(e));i=0<o.length?o[0]:"";var c=1<o.length?o[1]:"",u=2<o.length?o[2]:"";for(r.singleProperty=1===a&&e.getOffset()===n;n>e.getOffset();){var d=this.parseNode(e,t);null!==d&&this.parseSubNode(s,r,d)}return r.propertyList=o,"number"==typeof i&&(r.id=i),""!==c&&(r.attrName=c),""!==u&&(r.attrType=u),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(e,t,r){var n,a,i,s,o;!0===r.singleProperty?(a=r.propertyList[0],Array.isArray(a)?(t[r.name]=r).a=a:t[r.name]=a):"Connections"===e&&"C"===r.name?(n=[],r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)):"Properties70"===r.name?Object.keys(r).forEach((function(e){t[e]=r[e]})):"Properties70"===e&&"P"===r.name?(a=r.propertyList[0],e=r.propertyList[1],i=r.propertyList[2],s=r.propertyList[3],0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[a]={type:e,type2:i,flag:s,value:o}):void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{key:"parseProperty",value:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),n=e.getUint32(),a=e.getUint32();if(0===n)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}n=function(e,t){return function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new qt(0);function a(e){var r=t.length;r<e&&((r=new qt(Math.max(2*r,e))).set(t),t=r)}var i=!t||r,s=!r||r.i,o=(r=r||{},t=t||new qt(3*n),r.f||0),l=r.p||0,c=r.b||0,u=r.l,d=r.d,h=r.m,p=r.n,m=8*n;do{if(!u){r.f=o=dr(e,l,1);var f=dr(e,l+1,3);if(l+=3,!f){var g=e[(_=pr(l)+4)-4]|e[_-3]<<8;if(n<(S=_+g)){if(s)throw"unexpected EOF";break}i&&a(c+g),t.set(e.subarray(_,S),c),r.b=c+=g,r.p=l=8*S;continue}if(1==f)u=lr,d=cr,h=9,p=5;else{if(2!=f)throw"invalid block type";g=dr(e,l,31)+257;for(var v=dr(e,l+10,15)+4,b=g+dr(e,l+5,31)+1,y=(l+=14,new qt(b)),x=new qt(19),w=0;w<v;++w)x[$t[w]]=dr(e,l+3*w,7);l+=3*v;var S,M=(1<<(S=ur(x)))-1,T=ir(x,S,1);for(w=0;w<b;){var _,E=T[dr(e,l,M)];if(l+=15&E,(_=E>>>4)<16)y[w++]=_;else{var D=0,O=0;for(16==_?(O=3+dr(e,l,3),l+=2,D=y[w-1]):17==_?(O=3+dr(e,l,7),l+=3):18==_&&(O=11+dr(e,l,127),l+=7);O--;)y[w++]=D}}f=y.subarray(0,g);var P=y.subarray(g);h=ur(f),p=ur(P),u=ir(f,h,1),d=ir(P,p,1)}if(m<l){if(s)throw"unexpected EOF";break}}i&&a(c+131072);for(var k=(1<<h)-1,A=(1<<p)-1,C=l;;C=l){var L=(D=u[hr(e,l)&k])>>>4;if(m<(l+=15&D)){if(s)throw"unexpected EOF";break}if(!D)throw"invalid length/literal";if(L<256)t[c++]=L;else{if(256==L){C=l,u=null;break}var R,I=L-254,B=(264<L&&(R=Qt[w=L-257],I=dr(e,l,(1<<R)-1)+er[w],l+=R),(L=d[hr(e,l)&A])>>>4);if(!L)throw"invalid distance";if(l+=15&L,P=tr[B],3<B&&(R=Jt[B],P+=hr(e,l)&(1<<R)-1,l+=R),m<l){if(s)throw"unexpected EOF";break}i&&a(c+131072);for(var U=c+I;c<U;c+=4)t[c]=t[c-P],t[c+1]=t[c+1-P],t[c+2]=t[c+2-P],t[c+3]=t[c+3-P];c=U}}r.l=u,r.p=C,r.b=c,u&&(o=1,r.m=h,r.d=d,r.n=p)}while(!o);return c==t.length?t:mr(t,0,c)}((function(e){if(8!=(15&e[0])||7<e[0]>>>4||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}(new Uint8Array(e.getArrayBuffer(a)));var i=new jr(n.buffer);switch(t){case"b":case"c":return i.getBooleanArray(r);case"d":return i.getFloat64Array(r);case"f":return i.getFloat32Array(r);case"i":return i.getInt32Array(r);case"l":return i.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),jr=function(){function e(t,r){Dr(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r,this._textDecoder=new TextDecoder}return Pr(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){var t=this.offset,r=new Uint8Array(this.dv.buffer,t,e);return 0<=(this.skip(e),e=r.indexOf(0))&&(r=new Uint8Array(this.dv.buffer,t,e)),this._textDecoder.decode(r)}}]),e}(),Nr=function(){function e(){Dr(this,e)}return Pr(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function zr(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 Fr(e){return e/46186158e3}var Vr=[];function Gr(e,t,r,n){var a;switch(n.mappingType){case"ByPolygonVertex":a=e;break;case"ByPolygon":a=t;break;case"ByVertice":a=r;break;case"AllSame":a=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var i=(a="IndexToDirect"===n.referenceType?n.indices[a]:a)*n.dataSize,s=i+n.dataSize,o=Vr,l=n.buffer,c=s,u=i,d=0;u<c;u++,d++)o[d]=l[u];return o}var Hr=new s.Euler,Zr=new s.Vector3;function Wr(e){var t=new s.Matrix4,r=new s.Matrix4,n=new s.Matrix4,a=new s.Matrix4,i=new s.Matrix4,o=new s.Matrix4,l=new s.Matrix4,c=new s.Matrix4,u=new s.Matrix4,d=new s.Matrix4,h=new s.Matrix4,p=new s.Matrix4,m=e.inheritType||0,f=(e.translation&&t.setPosition(Zr.fromArray(e.translation)),e.preRotation&&((f=e.preRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),r.makeRotationFromEuler(Hr.fromArray(f))),e.rotation&&((f=e.rotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),n.makeRotationFromEuler(Hr.fromArray(f))),e.postRotation&&((f=e.postRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),a.makeRotationFromEuler(Hr.fromArray(f)),a.invert()),e.scale&&i.scale(Zr.fromArray(e.scale)),e.scalingOffset&&l.setPosition(Zr.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(Zr.fromArray(e.scalingPivot)),e.rotationOffset&&c.setPosition(Zr.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(Zr.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(h.copy(e.parentMatrix),d.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(a)),g=(((e=new s.Matrix4).extractRotation(d),g=new s.Matrix4).copyPosition(d),g.clone().invert().multiply(d)),v=(g=e.clone().invert().multiply(g),i),b=new s.Matrix4;return 0===m?b.copy(e).multiply(f).multiply(g).multiply(v):1===m?b.copy(e).multiply(g).multiply(f).multiply(v):(m=(new s.Matrix4).scale((new s.Vector3).setFromMatrixScale(h)).clone().invert(),h=g.clone().multiply(m),b.copy(e).multiply(f).multiply(h).multiply(v)),g=u.clone().invert(),m=o.clone().invert(),e=t.clone().multiply(c).multiply(u).multiply(r).multiply(n).multiply(a).multiply(g).multiply(l).multiply(o).multiply(i).multiply(m),f=(new s.Matrix4).copyPosition(e),h=d.clone().multiply(f),p.copyPosition(h),(e=p.clone().multiply(b)).premultiply(d.invert()),e}function Kr(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 qr(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Xr(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,r))}function Yr(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}var Qr=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const Jr=t.FBXLoader;class $r{constructor(e){this.parses={fbx:new Jr,obj:new Kt,object:new s.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return Qr(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);break;case"png":case"jpg":case"webp":case"hdr":t=this.img(e)}return t}))}img(e){return Qr(this,void 0,void 0,(function*(){return{type:"texture",result:yield this.runScene.textureEx.parse(e),file:e}}))}glb(e){return Qr(this,void 0,void 0,(function*(){var t=yield(0,i.parseFile)(e,"arrayBuffer");let r="model";return t=yield this.runScene.loaderer.gltf.parse(t,{triggerCb:!0,callBack:{beforeParse:e=>{"scene"===(e=(e.asset.ex||{}).type)&&this.runScene.clean()},getJSON(e){r=(null==(e=e.asset.ex)?void 0:e.type)||"model"}}}),{type:r,result:t}}))}fbx(e){return Qr(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,i.parseFile)(e,"arrayBuffer");this.runScene.materialEx.create();const r=this.parses.fbx.parse(t,"",{onTextureLoaded:e=>{this.runScene.textureEx.onLoaded(e)}});return r.traverse((e=>{e.material&&(0,bt.getMaterials)(e.material).map((t=>{"Line"!==e.type&&("MeshPhongMaterial"===t.type||"MeshLambertMaterial"===t.type?this.runScene.materialEx.afterLoader(t):e.material=t)}))})),{type:"model",result:[this.runScene.sceneEx.cleanUnlessLevel(r)]}}))}obj(e){return Qr(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e;const r=this.parses.obj.parse(t),n=this.runScene.materialEx.create();return r.traverse((e=>{e.material&&"Line"!==e.type&&(e.material=n)})),{type:"model",result:[this.runScene.sceneEx.cleanUnlessLevel(r)]}}))}json(e){return Qr(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e,r=JSON.parse(t);return"timeLine"===r.type?{type:"timeLine",result:r.data}:{type:"model",result:[this.runScene.loaderer.json.parse(t)]}}))}}class en extends o{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.loaderer.gltf.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.loaderer.gltf.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},r=()=>{const e=this.runScene.assetsEx.get().renderer;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&this.runScene.cb.controlsChange.delete("global-config")},n=e=>{var t=this.runScene.render;const r=this.runScene.assetsEx.get().renderer;"tick"===e?r.setAnimationLoop(t):"controlsChange"===e&&this.runScene.cb.controlsChange.add("global-config",t)};return e=>{this._lastRenderMode!==e&&(t(),r(),n(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.pp.params.glow.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}setState(e){const t=_(this.runScene);t.renderConfig.stop=!e,t.run=e,this.setEventState(e)}setEventState(e){_(this.runScene).renderConfig.event.trigger=e}}var tn=r(1269);class rn extends r(8624).Ys{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new s.Vector3,this.beginScale=new s.Vector3,this.posStart=new s.Vector2,this.posEnd=new s.Vector2,this.deleteRedundantParts()}deleteRedundantParts(){this.transGizmo.gizmo.translate.children.splice(1,1),this.transGizmo.gizmo.translate.children.splice(3,1),this.transGizmo.gizmo.translate.children.splice(5,1),this.transGizmo.gizmo.scale.children.splice(0,1),this.transGizmo.gizmo.scale.children.splice(2,1),this.transGizmo.gizmo.scale.children.splice(4,1)}pointerDown(e){void 0===this.object||null===this.axis||this.dragging||0!==e.button||(this.posStart.set(e.x,e.y),this.beginScale.set(this.object.scale.x,this.object.scale.y,this.object.scale.z),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(e),void 0!==this.object&&null!==this.axis&&this.dragging&&-1===e.button&&"scale"===this.mode&&-1!==this.axis.search("XYZ")){this.posEnd.set(e.x,e.y),e=(Math.abs(this.beginScale.x)+Math.abs(this.beginScale.y)+Math.abs(this.beginScale.z))/3;let t=12*this.pointStart.distanceTo(this.pointEnd)/e;this.posEnd.x>this.posStart.x&&(t*=-1),(t=-1.1<t&&t<1.1?1:t)<0&&(t=-1.1/t),this.scaleCoefficient.set(t,t,t),this.object.scale.copy(this._scaleStart).multiply(this.scaleCoefficient)}}}class nn extends s.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new s.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new s.Vector3,this.targetQuaternion=new s.Quaternion,this.q1=new s.Quaternion,this.q2=new s.Quaternion,this.radius=0,this.clock=new s.Clock,this.runScene=e,e=this.runScene.assetsEx.get().controls,this.controls=e,this.runScene.cb.render.add("view-helper",(()=>{this.update(this.clock.getDelta())}))}prepareAnimationData(e){const t=this.runScene.assetsEx.get().camera;var r=this.controls.target;switch(e){case"posX":this.targetPosition.set(1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new s.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new s.Euler(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}this.radius=t.position.distanceTo(r),this.targetPosition.multiplyScalar(this.radius).add(r),this.dummy.position.copy(r),this.dummy.lookAt(t.position),this.q1.copy(this.dummy.quaternion),this.dummy.lookAt(this.targetPosition),this.q2.copy(this.dummy.quaternion),this.animating=!0}update(e){if(this.animating){const r=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),r.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),r.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class an{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,t)=>(e=new s.BoxHelper(e,t),this.runScene.assetsEx.get().scene.add(e),this.setHelper(e,!0),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.enable=!0,this.modelNewVal=new c.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.inited=()=>{this.runScene.helperEx.setHelper(this.tansControls,!0),this.runScene.cb.multipSelect.add.add("transContro",(()=>{this.runScene.events.key.ctrl&&(this.close(),this.removeFocus())})),this.runScene.cb.events.key.up.add("transContro",(({key:e})=>{"ctrl"!==e&&"control"!==e||!1!==this.tansControls.enabled||(e=(0,i.lastArrayEle)(this.runScene.multipSelector.getSelectedList("value")||[]),this.open(),e&&this.addObject(e))}))},this.multipObj=null,this.speaceType="world",this.draggingChanged=e=>{var t,r,n;this.tansControls.enabled&&this.enable&&(t=this.runScene.assetsEx.get().controls,r=this.controlsMode,(n=this.runScene.modelEx.select||this.runScene.multipSelector.getLast())&&(this.runScene.multipSelector.draggingchanged(e),t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(n[r]),this.isDraggingChange=!0):(this.runScene.multipSelector.isEmpty()&&this.runScene.modelEx.setV3({model:n,info:r,newV3:this.runScene.modelEx.cloneV3(n[r]),oldV3:this.modelNewVal},!0,!1),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value))},(this.runScene=e).cb.inited.add("transContro",this.inited)}init(){const{camera:e,scene:t,engineDom:r}=this.runScene.assetsEx.get();this.tansControls=new rn(e,r),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",t.add(this.tansControls),this.tansControls.traverse((e=>e.isHelper=!0))}changeMode(e){this.controlsMode=e,this.tansControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.tansControls.setSize(e?this.tansControls.size+.1:Math.max(this.tansControls.size-.1,.1))}changeState(e){this.tansControls.enabled=e}addObject(e){this.removeFocus(),this.tansControls.attach(e)}removeFocus(){this.tansControls.detach()}changeSpaceState(){this.tansControls.setSpace("local"===this.tansControls.space?"world":"local"),this.tansControls.detach()}setSpeace(e){e=e||("world"===this.speaceType?"local":"world"),this.speaceType=e,this.tansControls.setSpace(e),this.addObject(this.runScene.modelEx.select)}transChangeFn(e){var t;this.tansControls.enabled&&this.enable&&((t=this.runScene.modelEx.select)&&(this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t),this.runScene.cb.model.setVector3.cb({type:"position",model: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 nn(e),this.grid=this.createGrid(),this.init(),this.setHelper(this.viewHelper,!0),this.setHelper(this.grid,!0),this.boxHelper=this.getBoxHelper(new s.Group))}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new c.Z.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,r){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,r&&r(e)})),e}focus(e){"running"===this.runScene.optionsEx.options.mode||(0,d.isHelper)(e)||((0,tn.RQ)(e)||(this.boxHelper.visible=!0,this.boxHelper.setFromObject(e)),this.transContro.addObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),this.boxHelper&&(this.boxHelper.visible=!1),this.focusModelId=void 0)}}var sn=r(2510),on=r(4380),ln=r(8089);class cn{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new p.Z,this.tempOldval=new c.Z.Vector3,this.runScene=e,this.runScene.cb.undo.undo.add("helperEx",(()=>{this.updateBoxHelper()})),this.runScene.cb.undo.redo.add("helperEx",(()=>{this.updateBoxHelper()}))}updateBoxHelper(){(0,i.mapObj)(this.boxHelperMap,((e,t)=>{t.parent&&t.update()}))}add(e,t=!1,r=!0,n){var a,o;if("array"===(0,i.getType)(e))return a=e.map((e=>this.add(e,t,r))),[o]=this.runScene.modelEx.getSelectedModels(),o&&this.add(o,!0,!0,!0),a;(0,d.isHelper)(e)||this.selectors[e.uuid]&&(this.remove(e),this.removeBoxHelper(e),!t)||(this.addBoxHelper(e,n&&new s.Color("0,127,0")),this.selectors[e.uuid]=e,this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!0}),r&&this.runScene.helperEx.focus(e),this.runScene.cb.multipSelect.add.cb({model:e,selectIds:this.selectors}))}clearAfterAdd(e,t=!1,r=!0,n){this.runScene.modelEx.selectNull(),this.setEmpty(),this.add(e,t,r,n)}setInfo(e,t,r,n,a,i){"position"!==t&&(a=n,i=r);const s=this.getSelectedList("value");var{x:a,y:o,z:l}=a;const c=a-i.x,u=o-i.y,d=l-i.z,h=[new on.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];s.map((r=>{if(r!==e){var{x:n,y:a,z:i}=r[t],n=n+=c,a=a+=u,i=i+=d;let e=r[t].clone();e.x=n,e.y=a,e.z=i,n=new on.Z({target:r,info:t,oldV3:this.runScene.modelEx.cloneV3(r[t]),newV3:e,runScene:this.runScene}).execute(),h.push(n),this.boxHelperMap[r.uuid].setFromObject(r)}})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(h)}draggingchanged(e){const t=this.runScene.assetsEx.get().controls;var r;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value?this.isEmpty()||(t.enabled=!1,e=this.getLast(),r=this.runScene.helperEx.transContro.controlsMode,this.tempOldval="position"===r?(0,ln.VU)(e,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(e[r]),this.saveV3(r)):t.enabled||this.isEmpty()||(this.runScene.events.mouse.enableUp=!1,this.useV3())}transChange(){if(!this.isEmpty()&&!this.runScene.assetsEx.controls.enabled){var e=this.runScene.helperEx.transContro.controlsMode,t=this.getLast();let r;this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),r="position"===e?(0,ln.VU)(t,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(t[e]),this.getInfo({model:t,type:e,newV3:r,oldV3:this.tempOldval}),this.tempOldval.copy(r)}}saveV3(e){this.getSelectedList("value").map((t=>{var r=(0,X.Ki)(t);this.savedV3.set(r,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:r,model:n})=>new on.Z({target:n,info:t,newV3:this.runScene.modelEx.cloneV3(n[t]),oldV3:r,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:r,newV3:n,oldV3:a}=e,i=this.getSelectedList("value");var{x:e,y:s,z:o}=n;const l=e-a.x,c=s-a.y,u=o-a.z;t[r].copy(n),i.map((e=>{if(e!==t){var{x:n,y:a,z:i}=e[r],n=n+=l,a=a+=c,i=i+=u;let t=e[r].clone();t.x=n,t.y=a,t.z=i,e[r].copy(t),this.boxHelperMap[e.uuid].setFromObject(e)}})),this.boxHelperMap[t.uuid].setFromObject(t)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e,t){t=this.runScene.helperEx.getBoxHelper(e,t),this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),delete this.boxHelperMap[e.uuid],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(){const e=this.runScene.assetsEx.get().scene;Object.values(this.boxHelperMap).map((t=>{e.remove(t)})),this.boxHelperMap={}}setEmpty(){this.isEmpty()||(Object.values(this.boxHelperMap).map((e=>{this.removeBoxHelper(e)})),this.getSelectedList("value").map((e=>{this.runScene.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={},this.runScene.cb.model.multiSelect.setEmpty.cb())}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new s.Group;const t=new s.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),(0,ln.qg)(e));t.position.copy(n),this.runScene.cb.model.multipDrop.cb({models:r,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new s.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:r,back:n,rmBackLength:a,fullName:i,step:s}=e,o=this.getSelectedList("value");0!==o.length&&(e=o.map(((e,o)=>{let l=e.name;if(0===i.length){if(0!==r){if(r>l.length)return;l=l.substring(r)}if(0!==a){if(a>l.length)return;l=l.substring(0,l.length-a)}0<t.length&&(l=t+l),0<n.length&&(l+=n)}else l=i+(o+1)*s;return new sn.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}align(e){const t=this.getSelectedList("value");if(0!==t.length){const[n]=t;var r=t.map((t=>{var r=t.position.clone();const a=("all"===e?n:t).position.clone();return"all"!==e&&(a[e]=n.position[e]),new on.Z({target:t,info:"position",oldV3:r,newV3:a,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(r)}}}function un(e){return(un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function dn(e,t){return(dn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function hn(e){return(hn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var pn=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&dn(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=hn(e);if(r=t?(r=hn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===un(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var e=n.SkyShader;return e=new s.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:s.UniformsUtils.clone(e.uniforms),side:s.BackSide,depthWrite:!1}),(e=r.call(this,new s.BoxGeometry(1,1,1),e)).isSky=!0,e}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(s.Mesh),mn=(pn.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new s.Vector3},up:{value:new s.Vector3(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\n\t\t}"},r(7585)),fn=r(6651);const gn={color:"#000000",intensity:1};class vn{diff(e,t){const r={};return(0,i.mapObj)(gn,(n=>{var a=e[n];(0,y.Xq)(a,t[n])&&(r[n]=a)})),r}setConfig(e,t){var{color:t,intensity:r,shadow:n}=t,{mapSize:n,camera:a}=n||{},{far:a,near:i,scale:s}=a||{};void 0!==s&&(e.shadow.camera.scale.x=s,e.shadow.camera.scale.y=s,e.shadow.camera.scale.z=s),void 0!==i&&(e.shadow.camera.near=i),void 0!==a&&(e.shadow.camera.far=a),void 0!==n&&(e.shadow.mapSize.x=n,e.shadow.mapSize.y=n),void 0!==r&&(e.intensity=r),void 0!==t&&(e.color=(0,ln.e9)(t)),e.shadow.camera.updateProjectionMatrix(),null!=(s=e.cameraHelper)&&s.update()}}class bn extends o{constructor(){super(...arguments),this.allState=["morning","noon","evening","night"],this.sun=new La.Vector3,this.light=new vn,this.sky=new pn,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.toJSON=()=>{var{currentState:e,effectController:t,isShow:r,lightConfig:n,size:a}=this.skyData,e={currentState:e,effectController:t,isShow:r,lightConfig:n,size:a};if(0!==G.YD.objLength((0,y.ad)(e,this.getData())))return e},this.parseJSON=e=>{var t,r,n;e&&(({isShow:t,currentState:r,size:n}=e),t&&(this.skyData.isShow=t,this.initLight(),this.parseLightConfig(e),this.inied||(this.init(),this.inied=!0),this.parseSkyConfig(r,n),this.setOpen(t)))},this.currentAnimas=[],this.awaitAnimas=[],this.animaInstance=null,this.animaIndex={begin:0,end:0},this.getNromalFn=()=>{this.playSky()},this.getSpecialFn=()=>{var e=this.allState[0];this.setSkyConfig(e),this.setLightSpecialConfig(e),this.lightAnima(e),0!==this.animaIndex.end&&(this.currentAnimas=this.getAnimasDataByState(this.allState[this.animaIndex.end],e),this.playSky())}}init(){this.addScene(),this.initSnapshot()}initSnapshot(){this.runScene.cb.snapshot.create.add("sky",(e=>{e.data.set("sky",{state:this.skyData.currentState})})),this.runScene.cb.snapshot.set.add("sky",(e=>{(e=e.snapshot.data.get("sky"))&&e.state!==this.skyData.currentState&&this.setState(e.state)}))}initLight(){if(!this.directionalLight){var e=new mn.Z(this.runScene).get();const[t]=e;this.runScene.lightEx.add(e,{addToTree:!1}),(this.directionalLight=t).name="skyLight"}}addScene(){this.initLight(),bt.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.directionalLight?(this.directionalLight.visible=e,t.toneMapping=e?4:0,this.sky.visible!==e&&(this.skyData.isShow=e,this.sky.visible=e)):this.addScene()}parseLightConfig(e){var t,{isShow:r,effectController:n,currentState:a,lightConfig:i,size:s}=e;e&&i&&(e=i.shadow,t=n[a].lightConfig,mn.Z.setConfig(this.directionalLight,Object.assign(Object.assign({shadow:e},t),this.baseLightConfig)),this.directionalLight.visible=r,this.skyData.lightConfig=i,this.skyData.isShow=r,this.skyData.effectController=n,this.skyData.currentState=a,this.skyData.size=s,this.sky.visible=r,this.setLightSpecialConfig(a),this.lightAnima(a))}parseSkyConfig(e,t){this.setSkyConfig(e),this.setSkyScale(t)}setState(e){var t=this.skyData.currentState;this.doAnimaByState(e,t),this.runScene.cb.objects.sky.setState.cb({state:e}),this.saveLastTimeState({oldState:t,state:e,index:this.allState.findIndex((t=>t===e))})}saveLastTimeState(e){var{oldState:e,state:t,index:r}=e;this.lastTime.name=e,this.lastTime.index=r,this.skyData.currentState=t}getLightDataByState(e){let t=new La.Vector3,r=new La.Vector3;switch(e){case"morning":t.x=0,t.y=0,t.z=-this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2;break;case"noon":t.x=0,t.y=this.skyData.size/2,t.z=0,r.x=0,r.y=-1*this.skyData.size,r.z=0;break;case"evening":case"night":t.x=0,t.y=0,t.z=this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2*-1}return{position:t,targetPosition:r}}getIdxByState(e){return this.allState.findIndex((t=>t===e))}setSkyConfig(e){const{renderer:t,scene:r,camera:n}=this.runScene.assetsEx.get();this.sky.material.uniforms.turbidity.value=this.skyData.effectController[e].turbidity,this.sky.material.uniforms.mieCoefficient.value=this.skyData.effectController[e].mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.skyData.effectController[e].mieDirectionalG,this.skyData.isShow&&(t.toneMappingExposure=this.skyData.effectController[e].exposure),t.render(r,n);var a=La.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=La.MathUtils.degToRad(this.skyData.effectController[e].azimuth),this.sun.setFromSphericalCoords(1,a,e),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}setSkyScale(e){this.sky.scale.setScalar(e),this.skyData.size=e}setSky(e){var{state:e,type:t,val:r}=e;this.skyData.effectController[e][t]=r,this.setSkyConfig(e)}setCurrentState(e){this.skyData.currentState=e}setStateTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}clean(){this.setOpen(!1),this.skyData=this.getData(),this.directionalLight&&this.runScene.modelEx.remove(this.directionalLight)}setLight(e,t){switch(e){case"mapSize":this.skyData.lightConfig.shadow.mapSize=t,this.directionalLight.shadow.mapSize.x=t,this.directionalLight.shadow.mapSize.y=t;break;case"near":this.skyData.lightConfig.shadow.camera.near=t,this.directionalLight.shadow.camera.near=t;break;case"far":this.skyData.lightConfig.shadow.camera.far=t,this.directionalLight.shadow.camera.far=t;break;case"scale":this.skyData.lightConfig.shadow.camera.scale=t,this.directionalLight.shadow.camera.scale.set(t,t,t);break;case"top":this.skyData.lightConfig.shadow.camera.top=t,this.skyData.lightConfig.shadow.camera.bottom=t,this.skyData.lightConfig.shadow.camera.left=t,this.skyData.lightConfig.shadow.camera.right=t,this.directionalLight.shadow.camera.top=t,this.directionalLight.shadow.camera.bottom=t,this.directionalLight.shadow.camera.left=t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.updateProjectionMatrix(),null!=(r=this.directionalLight.cameraHelper)&&r.update();break;case"color":this.skyData.effectController[this.skyData.currentState].lightConfig.color=t;var r=new La.Color(t);this.directionalLight.color=r;break;case"intensity":this.skyData.effectController[this.skyData.currentState].lightConfig.intensity=t,this.directionalLight.intensity=t}}setLightSpecialConfig(e){var t;this.directionalLight&&(({color:e,intensity:t}=this.skyData.effectController[e].lightConfig),this.directionalLight.color=(0,ln.e9)(e),this.directionalLight.intensity=t)}getAnimasDataByState(e,t){e=this.getIdxByState(e);const r=[];if((t=this.getIdxByState(t))<e){this.animaIndex={begin:e,end:t};var n=e-t;let l=t;for(let e=0;e<n;e++){var{color:a,intensity:i}=this.skyData.effectController[this.allState[l]].lightConfig,{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]),{color:a,intensity:i}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o})}),l++,this.skyData.effectController[this.allState[l]].lightConfig),{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]);r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o}),onDone:this.getNromalFn})}}else{var l=3-t;this.animaIndex={begin:t,end:e};let n=t;if(0==l)return r.push({onDone:this.getSpecialFn}),r;for(let e=0;e<l;e++){var{color:c,intensity:u}=this.skyData.effectController[this.allState[n]].lightConfig,{position:d,targetPosition:h}=this.getLightDataByState(this.allState[n]),{position:d,targetPosition:h}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:d,targetPosition:h})}),n++,this.getLightDataByState(this.allState[n]));r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:d,targetPosition:h}),onDone:3===n?this.getSpecialFn:this.getNromalFn})}}return r}playSky(){if(0!==this.currentAnimas.length){const t=this.currentAnimas.shift();var e=this.currentAnimas.shift();if(!e)return t.onDone();this.playAnima(t,e)}}playAnima(e,t){if(this.directionalLight){const r=this.runScene.assetsEx.get().renderer;this.animaInstance=u.anima(Object.assign(Object.assign({},e.data),{x:this.directionalLight.position.x,y:this.directionalLight.position.y,z:this.directionalLight.position.z,tx:this.directionalLight.target.position.x,ty:this.directionalLight.target.position.y,tz:this.directionalLight.target.position.z}),Object.assign(Object.assign({},t.data),{ease:"none"}),e.data.time,(e=>{var{r:n,g:a,b:i}=e,s=(this.onUpdated(e),this.sky.material.uniforms.turbidity.value=e.turbidity,this.sky.material.uniforms.mieCoefficient.value=e.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=e.mieDirectionalG,r.toneMappingExposure=e.exposure,La.MathUtils.degToRad(90-e.elevation)),o=La.MathUtils.degToRad(t.data.azimuth);this.sun.setFromSphericalCoords(1,s,o),this.sky.material.uniforms.sunPosition.value.copy(this.sun),s=new La.Color(n,a,i),this.directionalLight.color=s,this.directionalLight.intensity=e.intensity,this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(e.tx,e.ty,e.tz)}),(()=>{t.onDone(),this.animaInstance=null}))}}doAnimaByState(e,t){e=this.getAnimasDataByState(e,t),this.animaInstance?this.awaitAnimas=e:(this.currentAnimas=e,this.playSky())}onUpdated(e){var t;0!==this.awaitAnimas.length&&(this.animaInstance.kill(),this.animaInstance=null,[t]=this.awaitAnimas,this.currentAnimas=[...this.awaitAnimas],this.awaitAnimas=[],null!=t&&t.data&&(this.currentAnimas.unshift({data:t.data,onDone:this.getNromalFn}),this.currentAnimas.unshift({data:e})),this.playSky())}lightAnima(e){var t;this.directionalLight&&(({position:e,targetPosition:t}=this.getLightDataByState(e)),this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(t.x,t.y,t.z))}transDataToAnimaData(e){var{sky:e,color:t,position:r,targetPosition:n,intensity:a}=e,{x:r,y:i,z:s}=r,{x:n,y:o,z:l}=n,{r:t,g:c,b:u}=(0,y.fh)((0,y.I8)(t));return Object.assign(Object.assign({},e),{r:t,g:c,b:u,x:r,y:i,z:s,tx:n,ty:o,tz:l,intensity:a})}getData(){return{isShow:!1,size:5e3,lightConfig:{shadow:{mapSize:512,camera:{near:.5,far:500,scale:1,top:5,bottom:5,left:5,right:5}}},effectController:{morning:{turbidity:2,rayleigh:1,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:180,exposure:.3,lightConfig:Object.assign(Object.assign({},(0,fn.d9)(gn)),{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,fn.d9)(gn)),{color:"#FFFFFF"})},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Object.assign(Object.assign({},(0,fn.d9)(gn)),{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,fn.d9)(gn)),{color:"#B8A277"}),time:1}},currentState:"morning"}}}class yn{constructor(e){this.clean=()=>{this.sky.clean()},this.sky=new bn(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)}}class xn{constructor(e){this.outlineModelLength=new Set,this.modelMap=new p.Z,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{setLayers:e,add:t,remove:r,change:n}=this.runScene.cb.model;n.add("pp-set-glow",(e=>{const{model:t,type:r,val:n}=e;"visible"===r&&(t.traverse((e=>{(0,d.isGLowModel)(e)&&this.modelMap.set((0,X.Ki)(e),n)})),this.afterGLowModelSet())})),e.add("pp-set-glow",(e=>{var{model:e,val:t}=e;0===t&&0===this.modelMap.size||this[0===t?"glowRemove":"glowAdd"](e)})),t.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowAdd(e)})),r.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowRemove(e)}))}glowAdd(e){this.modelMap.set(e.userData.id,e.visible),this.afterGLowModelSet()}glowRemove(e){this.modelMap.delete(e.userData.id),this.afterGLowModelSet()}afterGLowModelSet(){var e=0<this.modelMap.size&&this.modelMap.find(((e,t)=>!0===t))||!1;this.runScene.pp.params.glow.isBloom!==e&&(this.runScene.cb.pp.glow.setStatus.cb(e),this.runScene.pp.params.glow.isBloom=e)}initOutline(){const{setOutline:e,add:t,remove:r}=this.runScene.cb.model;e.add("pp-set-outline",(e=>{var{model:e,val:t}=e;!t&&0===this.outlineModelLength.size||this[t?"outlineAdd":"outlineRemove"](e)})),t.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineAdd(e)})),r.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineRemove(e)}))}outlineAdd(e){this.outlineModelLength.add(e.userData.id),0<this.outlineModelLength.size&&(this.runScene.cb.pp.outline.setStatus.cb(!0),this.runScene.pp.params.outline.isOutline=!0)}outlineRemove(e){this.outlineModelLength.delete(e.userData.id),this.outlineModelLength.size<=0&&(this.runScene.cb.pp.outline.setStatus.cb(!1),this.runScene.pp.params.outline.isOutline=!1)}}var wn=r(6608),Sn=r(5180),Mn=r(4819),Tn={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new s.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};function _n(e){return(_n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function En(e,t){return(En=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Dn(e){return(Dn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var On=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&En(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Dn(e);if(r=t?(r=Dn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===_n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i){var o;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(o=r.call(this)).strength=void 0!==t?t:1,o.radius=a,o.threshold=i,o.resolution=void 0!==e?new s.Vector2(e.x,e.y):new s.Vector2(256,256),o.clearColor=new s.Color(0,0,0),o.renderTargetsHorizontal=[],o.renderTargetsVertical=[],o.nMips=5;var l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2);o.renderTargetBright=new s.WebGLRenderTarget(l,c),o.renderTargetBright.texture.name="UnrealBloomPass.bright",o.renderTargetBright.texture.generateMipmaps=!1;for(var u=0;u<o.nMips;u++){var d;((d=new s.WebGLRenderTarget(l,c)).texture.name="UnrealBloomPass.h"+u,d.texture.generateMipmaps=!1,o.renderTargetsHorizontal.push(d),d=new s.WebGLRenderTarget(l,c)).texture.name="UnrealBloomPass.v"+u,d.texture.generateMipmaps=!1,o.renderTargetsVertical.push(d),l=Math.round(l/2),c=Math.round(c/2)}a=Tn;for(var h=(o.highPassUniforms=s.UniformsUtils.clone(a.uniforms),o.highPassUniforms.luminosityThreshold.value=i,o.highPassUniforms.smoothWidth.value=.01,o.materialHighPassFilter=new s.ShaderMaterial({uniforms:o.highPassUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{}}),o.separableBlurMaterials=[],[3,5,7,9,11]),p=(l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2),0);p<o.nMips;p++)o.separableBlurMaterials.push(o.getSeperableBlurMaterial(h[p])),o.separableBlurMaterials[p].uniforms.texSize.value=new s.Vector2(l,c),l=Math.round(l/2),c=Math.round(c/2);return o.compositeMaterial=o.getCompositeMaterial(o.nMips),o.compositeMaterial.uniforms.blurTexture1.value=o.renderTargetsVertical[0].texture,o.compositeMaterial.uniforms.blurTexture2.value=o.renderTargetsVertical[1].texture,o.compositeMaterial.uniforms.blurTexture3.value=o.renderTargetsVertical[2].texture,o.compositeMaterial.uniforms.blurTexture4.value=o.renderTargetsVertical[3].texture,o.compositeMaterial.uniforms.blurTexture5.value=o.renderTargetsVertical[4].texture,o.compositeMaterial.uniforms.bloomStrength.value=t,o.compositeMaterial.uniforms.bloomRadius.value=.1,o.compositeMaterial.needsUpdate=!0,o.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],o.bloomTintColors=[new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1)],o.compositeMaterial.uniforms.bloomTintColors.value=o.bloomTintColors,e=wn.C,o.copyUniforms=s.UniformsUtils.clone(e.uniforms),o.copyUniforms.opacity.value=1,o.materialCopy=new s.ShaderMaterial({uniforms:o.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:s.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),o.enabled=!0,o.needsSwap=!1,o._oldClearColor=new s.Color,o.oldClearAlpha=1,o.basic=new s.MeshBasicMaterial,o.fsQuad=new Mn.T(null),o}return t=n,(e=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose();for(var r=0;r<this.separableBlurMaterials.length;r++)this.separableBlurMaterials[r].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){var r=Math.round(e/2),n=Math.round(t/2);this.renderTargetBright.setSize(r,n);for(var a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(r,n),this.renderTargetsVertical[a].setSize(r,n),this.separableBlurMaterials[a].uniforms.texSize.value=new s.Vector2(r,n),r=Math.round(r/2),n=Math.round(n/2)}},{key:"render",value:function(e,t,r,a,i){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var s=e.autoClear,o=(e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s}},{key:"getSeperableBlurMaterial",value:function(e){return new s.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new s.Vector2(.5,.5)},direction:{value:new s.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}},{key:"getCompositeMaterial",value:function(e){return new s.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(Mn.w);On.BlurDirectionX=new s.Vector2(1,0),On.BlurDirectionY=new s.Vector2(0,1);class Pn extends Mn.w{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof s.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=s.UniformsUtils.clone(e.uniforms),this.material=new s.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Mn.T(this.material)}render(e,t,r){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class kn extends Mn.w{constructor(e,t,r,n,a){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=n,this.clearAlpha=void 0!==a?a:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new s.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let a,i;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),a=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.scene.background=this.sceneBg,this.clearColor&&e.setClearColor(this.oldClearColor,a),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),this.scene.background=this.sceneBg,e.autoClear=n}}const An={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 Cn{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 kn(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 On(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 Pn(An,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new Sn.T(wn.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 Ln(e){return(Ln="function"==typeof Symbol&&"symbol"==typeof 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 Rn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function In(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Bn(e,t,r){t&&In(e.prototype,t),r&&In(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Un(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&&jn(e,t)}function jn(e,t){return(jn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Nn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=zn(e);if(r=t?(r=zn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ln(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function zn(e){return(zn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Fn=function(){Un(t,Mn.w);var e=Nn(t);function t(r,n){var a;return Rn(this,t),(a=e.call(this)).scene=r,a.camera=n,a.clear=!0,a.needsSwap=!1,a.inverse=!1,a}return Bn(t,[{key:"render",value:function(e,t,r){var n,a,i=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0),a=this.inverse?(n=0,1):(n=1,0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),s.buffers.stencil.setFunc(i.ALWAYS,n,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(i.EQUAL,1,4294967295),s.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),s.buffers.stencil.setLocked(!0)}}]),t}(),Vn=function(){Un(t,Mn.w);var e=Nn(t);function t(){var r;return Rn(this,t),(r=e.call(this)).needsSwap=!1,r}return Bn(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();var Gn=function(){function e(t,r){var n;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.renderer=t,void 0===r?(n=t.getSize(new s.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new s.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=r.width,this._height=r.height),this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Sn.T(wn.C),this.clock=new s.Clock}var t,r;return t=e,(r=[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),r=!1,n=0,a=this.passes.length;n<a;n++){var i,s,o=this.passes[n];!1!==o.enabled&&(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),o.needsSwap&&(r&&(i=this.renderer.getContext(),(s=this.renderer.state.buffers.stencil).setFunc(i.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),s.setFunc(i.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==Fn&&(o instanceof Fn?r=!0:o instanceof Vn&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new s.Vector2),this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var r=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(r,n),this.renderTarget2.setSize(r,n);for(var a=0;a<this.passes.length;a++)this.passes[a].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}},{key:"dispose",value:function(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const Hn="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",Zn="\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 Wn{constructor(e){this.mtuPP=e,this.bloomLayer=new La.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new La.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new La.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new On(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 Sn.T(new La.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:Hn,fragmentShader:Zn,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new La.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.params.pp.samples});this.finalComposer=new Gn(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 Kn=r(228);class qn extends s.ShaderMaterial{constructor(...e){super(...e),["opacity","map","emissiveMap","roughnessMap","metalnessMap"].forEach((e=>{Object.defineProperty(this,e,{get(){if(e in this.uniforms)return this.uniforms[e].value},set(t){e in this.uniforms&&(this.uniforms[e].value=t)}})}))}}class Xn extends qn{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const r=this.defines,n=this.modifiedDefines;null==t?e in r&&(e in n||(n[e]=r[e]),delete r[e]):r[e]!==t&&(e in n||(n[e]=e in r?r[e]:void 0),r[e]=t)}setTextureUniform(e,t){const r=this.uniforms,n=this.modifiedUniforms;e in n||(n[e]=r[e].value),r[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const r in e)void 0===e[r]?r in t&&(this.needsUpdate=!0):t[r]!==e[r]&&(this.needsUpdate=!0),delete e[r];const r=this.modifiedUniforms;var n=this.uniforms;for(const e in r)r[e]!==n[e].value&&(this.needsUpdate=!0),delete r[e]}}const Yn=new WeakMap;class Qn{constructor(e){this._replacementMaterial=new Xn(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,r=!0){const n=this;function a(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!i.has(e)){const t=n.createMaterial(e);i.set(e,t)}const t=i.get(e);if(null!==t){let a=e.material;r?s.set(e,a):a=s.get(e),a||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),n.updateUniforms(e,a,t),t.finalize&&t.finalize(),e.material=t}}}const i=this._replacementMaterials,s=Yn;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)e[t].traverse(a);else for(let t=0,r=e.length;t<r;t++)a(e[t]);else t?e.traverse(a):a(e)}reset(e,t){function r(e){e.isHelper||(n.has(e)?(e.material=n.get(e),n.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const n=Yn;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)r(e[t]);else for(let t=0,n=e.length;t<n;t++)e[t].traverse(r);else t?e.traverse(r):r(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,r){var n=this._replacementMaterial.defines,a=t.defines;const i=r.defines;if(r.side=t.side,r.flatShading=t.flatShading,r.skinning=t.skinning,a){for(const e in a)r.setDefine(e,a[e]);for(const e in i)e in a?r.setDefine(e,a[e]):r.setDefine(e,n[e])}const s=r.uniforms;if(t.isShaderMaterial){var o=t.uniforms;for(const e in s){var l=o[e];const t=s[e];l&&l.value!==t.value&&(t.value&&t.value.isTexture||l.value&&l.value.isTexture?r.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in s){const n=s[e];e in t&&t[e]!==n.value&&(n.value&&n.value.isTexture||t[e]&&t[e].isTexture?r.setTextureUniform(e,t[e]):n.value=t[e])}var{overrideDefines:c,overrideUniforms:u}=this;for(const e in c)null===c[e]||void 0===c[e]?delete i[e]:i[e]!==c[e]&&(i[e]=c[e],r.needsUpdate=!0);for(const e in u)e in s&&(s[e].value=u[e].value)}dispose(){}}class Jn extends Qn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:s.ShaderLib.normal.vertexShader,fragmentShader:"\n\t\t\t\t#define NORMAL\n\t\t\t\tuniform float opacity;\n\t\t\t\t#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#endif\n\t\t\t\t#ifndef FLAT_SHADED\n\t\t\t\t\tvarying vec3 vNormal;\n\t\t\t\t\t#ifdef USE_TANGENT\n\t\t\t\t\t\tvarying vec3 vTangent;\n\t\t\t\t\t\tvarying vec3 vBitangent;\n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#include <packing>\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\t#include <normal_fragment_begin>\n\t\t\t\t\t#include <normal_fragment_maps>\n\t\t\t\t\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t\t\t\t}\n\t\t\t"}),this.useNormalMaps=!1}createMaterial(...e){return super.createMaterial(...e)}updateUniforms(e,t,r){super.updateUniforms(e,t,r),r.setDefine("USE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("ALPHATEST",r.uniforms.alphaTest.value||void 0),r.setDefine("USE_ALPHAMAP",0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?"":void 0),r.setDefine("USE_MAP",0!==r.defines.ALPHATEST&&r.uniforms.map.value?"":void 0),r.setDefine("USE_UV","USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?"":void 0)}}class $n extends Qn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:"\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <common>\n\t\t\t\t#include <uv_pars_vertex>\n\t\t\t\t#include <displacementmap_pars_vertex>\n\t\t\t\t#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\t\t\t\t#include <clipping_planes_pars_vertex>\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include <uv_vertex>\n\t\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t\t#include <morphnormal_vertex>\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <displacementmap_vertex>\n\t\t\t\t\t#include <project_vertex>\n\t\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t\t#include <clipping_planes_vertex>\n\t\t\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\t\tuniform float opacity;\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\tgl_FragColor = vec4( vViewPosition.z );\n\t\t\t\t}\n\t\t\t"}),this.invertSide=!1}updateUniforms(e,t,r){super.updateUniforms(e,t,r),this.invertSide&&(r.side=r.side===s.FrontSide?s.BackSide:s.FrontSide),e=r.defines.ALPHATEST,0===r.uniforms.alphaTest.value?delete r.defines.ALPHATEST:r.defines.ALPHATEST=r.uniforms.alphaTest.value,e!==r.defines.ALPHATEST&&(r.needsUpdate=!0),e=r.defines.USE_ALPHAMAP,0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?r.defines.USE_ALPHAMAP="":delete r.defines.USE_ALPHAMAP,e!==r.defines.USE_ALPHAMAP&&(r.needsUpdate=!0),e=r.defines.USE_MAP,0!==r.defines.ALPHATEST&&r.uniforms.map.value?r.defines.USE_MAP="":delete r.defines.USE_MAP,e!==r.defines.USE_MAP&&(r.needsUpdate=!0),e=r.defines.USE_UV,"USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?r.defines.USE_UV="":delete r.defines.USE_UV,e!==r.defines.USE_UV&&(r.needsUpdate=!0)}}const ea={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"},ta={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"},ra={defines:{NUM_DIRECTIONS:32,NUM_STEPS:16,RADIUS:"2.0",ENABLE_FALLOFF:1,FALLOFF_START2:"0.16",FALLOFF_END2:"4.0",ENABLE_ROTATION_JITTER:1,ENABLE_RADIUS_JITTER:1,ENABLE_COLOR_BOUNCE:1,JITTER_TYPE:0},uniforms:{colorBuffer:{value:null},normalBuffer:{value:null},depthBuffer:{value:null},renderSize:{value:new s.Vector2},blueNoiseTex:{value:null},blueNoiseSize:{value:1},clipInfo:{value:new s.Vector4},projInfo:{value:new s.Vector4},params:{value:new s.Vector2},lightBounceIntensity:{value:1}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\t#define TWO_PI\t\t\t6.2831853071795864\n\t\t#define HALF_PI\t\t\t1.5707963267948966\n\t\t#define ONE_OVER_PI\t\t0.3183098861837906\n\n\t\t#include <common>\n\t\t#include <packing>\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D noiseTexture;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform vec2 renderSize;\n\n\t\tuniform vec4 projInfo;\n\t\tuniform vec4 clipInfo;\n\t\tuniform vec4 params;\n\t\tuniform float lightBounceIntensity;\n\n\t\t#if ENABLE_ROTATION_JITTER == 2 || ENABLE_RADIUS_JITTER == 2\n\t\tuniform float blueNoiseSize;\n\t\tuniform sampler2D blueNoiseTex;\n\t\t#endif\n\n\t\tfloat roundF(float f) {\n\t\t\treturn f < 0.5 ? floor(f) : ceil(f);\n\t\t}\n\n\t\tvec2 roundV2(vec2 v) {\n\t\t\tv.x = roundF(v.x);\n\t\t\tv.y = roundF(v.y);\n\t\t\treturn v;\n\t\t}\n\n\t\tvec3 UnpackNormal(vec4 d) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec4 GetViewPosition( vec2 uv ) {\n\n\t\t\tfloat near = clipInfo.x;\n\t\t\tfloat far = clipInfo.y;\n\n\t\t\tvec2 basesize = renderSize;\n\t\t\tvec2 coord = ( uv / basesize );\n\n\t\t\t// d is expected to be [ 0.0, 1.0 ]\n\t\t\tfloat d = texture2D( depthBuffer, coord ).r;\n\t\t\td = d == 0.0 ? far : d;\n\t\t\td = ( abs( d ) - near ) / ( far - near );\n\n\t\t\tvec4 ret = vec4( 0.0 );\n\t\t\tret.w = d;\n\t\t\tret.z = near + d * ( far - near );\n\t\t\tret.xy = ( uv * projInfo.xy + projInfo.zw ) * ret.z;\n\n\t\t\treturn ret;\n\n\t\t}\n\n\t\tfloat Falloff( float dist2 ) {\n\n\t\t\treturn 2.0 * clamp(\n\t\t\t\t( dist2 - FALLOFF_START2 ) / ( FALLOFF_END2 - FALLOFF_START2 ),\n\t\t\t\t0.0,\n\t\t\t\t1.0\n\t\t\t);\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec2 screenCoord = gl_FragCoord.xy;\n\t\t\tvec4 vpos = GetViewPosition( renderSize * vUv );\n\n\t\t\t// if it's the background\n\t\t\tif ( vpos.w == 1.0 ) {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0);\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tvec4 s;\n\t\t\tvec3 vnorm\t= UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tvec3 vdir\t= normalize( - vpos.xyz );\n\t\t\tvec3 dir, ws;\n\n\t\t\t// calculation uses left handed system\n\t\t\tvnorm.z = - vnorm.z;\n\n\t\t\tvec2 noises\t= vec2( 0.0 );\n\t\t\tvec2 offset;\n\t\t\tvec2 horizons = vec2( - 1.0, - 1.0 );\n\n\t\t\t// scale the search radius by the depth and camera FOV\n\t\t\tfloat radius = ( RADIUS * clipInfo.z ) / vpos.z;\n\t\t\tradius = max( float( NUM_STEPS ), radius );\n\n\t\t\tfloat stepSize\t= radius / float( NUM_STEPS );\n\t\t\tfloat phi\t\t= 0.0;\n\t\t\tfloat ao\t\t= 0.0;\n\t\t\tfloat division\t= noises.y * stepSize;\n\t\t\tfloat currStep\t= 1.0 + division + 0.25 * stepSize * params.y;\n\t\t\tfloat dist2, invdist, falloff, cosh;\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\t\t\tvec3 color = vec3( 0.0 );\n\t\t\t#endif\n\n\t\t\t#if ENABLE_ROTATION_JITTER == 1\n\n\t\t\t// Rotation jitter approach from\n\t\t\t// https://github.com/MaxwellGengYF/Unity-Ground-Truth-Ambient-Occlusion/blob/9cc30e0f31eb950a994c71866d79b2798d1c508e/Shaders/GTAO_Common.cginc#L152-L155\n\t\t\tfloat rotJitterOffset = PI * fract( 52.9829189 * fract( dot( screenCoord, vec2( 0.06711056, 0.00583715 ) ) ) );\n\n\t\t\t#elif ENABLE_ROTATION_JITTER == 2\n\n\t\t\tfloat rotJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).r;\n\n\t\t\t#endif\n\n\t\t\t#if ENABLE_RADIUS_JITTER == 1\n\n\t\t\tfloat jitterMod = ( gl_FragCoord.x + gl_FragCoord.y ) * 0.25;\n\t\t\tfloat radiusJitterOffset = mod( jitterMod, 1.0 ) * stepSize * 0.25;\n\n\t\t\t#elif ENABLE_RADIUS_JITTER == 2\n\n\t\t\tfloat radiusJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).g;\n\n\t\t\t#endif\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < NUM_DIRECTIONS; i ++ ) {\n\n\t\t\t\tphi = float( i ) * ( PI / float( NUM_DIRECTIONS ) ) + params.x * PI;\n\n\t\t\t\t#if ENABLE_ROTATION_JITTER != 0\n\n\t\t\t\tphi += rotJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tcurrStep = 1.0 + 0.25 * stepSize * params.y;\n\n\n\t\t\t\t#if ENABLE_RADIUS_JITTER != 0\n\n\t\t\t\tcurrStep += radiusJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tdir = vec3( cos( phi ), sin( phi ), 0.0 );\n\t\t\t\thorizons = vec2( - 1.0 );\n\n\t\t\t\t// calculate horizon angles\n\t\t\t\tfor ( int j = 0; j < NUM_STEPS; ++ j ) {\n\n\t\t\t\t\toffset = roundV2(dir.xy * currStep);\n\n\t\t\t\t\t// h1\n\t\t\t\t\ts = GetViewPosition( screenCoord + offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.x = max( horizons.x, cosh - falloff );\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tvec3 ptColor, ptDir;\n\t\t\t\t\tfloat alpha;\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord + offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\t// h2\n\t\t\t\t\ts = GetViewPosition( screenCoord - offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.y = max( horizons.y, cosh - falloff );\n\n\t\t\t\t\t// increment\n\t\t\t\t\tcurrStep += stepSize;\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord - offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t}\n\n\t\t\t\thorizons = acos( horizons );\n\n\t\t\t\t// calculate gamma\n\t\t\t\tvec3 bitangent\t= normalize( cross( dir, vdir ) );\n\t\t\t\tvec3 tangent\t= cross( vdir, bitangent );\n\t\t\t\tvec3 nx\t\t\t= vnorm - bitangent * dot( vnorm, bitangent );\n\n\t\t\t\tfloat nnx\t\t= length( nx );\n\t\t\t\tfloat invnnx\t= 1.0 / ( nnx + 1e-6 );\t\t\t// to avoid division with zero\n\t\t\t\tfloat cosxi\t\t= dot( nx, tangent ) * invnnx;\t// xi = gamma + HALF_PI\n\t\t\t\tfloat gamma\t\t= acos( cosxi ) - HALF_PI;\n\t\t\t\tfloat cosgamma\t= dot( nx, vdir ) * invnnx;\n\t\t\t\tfloat singamma2\t= - 2.0 * cosxi;\t\t\t\t\t// cos(x + HALF_PI) = -sin(x)\n\n\t\t\t\t// clamp to normal hemisphere\n\t\t\t\thorizons.x = gamma + max( - horizons.x - gamma, - HALF_PI );\n\t\t\t\thorizons.y = gamma + min( horizons.y - gamma, HALF_PI );\n\n\t\t\t\t// Riemann integral is additive\n\t\t\t\tao += nnx * 0.25 * (\n\t\t\t\t\t( horizons.x * singamma2 + cosgamma - cos( 2.0 * horizons.x - gamma ) ) +\n\t\t\t\t\t( horizons.y * singamma2 + cosgamma - cos( 2.0 * horizons.y - gamma ) ) );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// PDF = 1 / pi and must normalize with pi because of Lambert\n\t\t\tao = ao / float( NUM_DIRECTIONS );\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\tcolor /= float( NUM_STEPS * NUM_DIRECTIONS ) * 2.0 / lightBounceIntensity;\n\t\t\tgl_FragColor = vec4( color, ao );\n\n\t\t\t#else\n\n\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, ao );\n\n\t\t\t#endif\n\t\t}\n\t"},na={defines:{BLUR_ITERATIONS:5,BLUR_MODE:0,AO_ONLY:0,COLOR_ONLY:0,DEPTH_THRESHOLD:"5e-1"},uniforms:{fullSize:{value:new s.Vector2},aoSize:{value:new s.Vector2},normalBuffer:{value:null},depthBuffer:{value:null},colorBuffer:{value:null},gtaoBuffer:{value:null},intensity:{value:1},blurStride:{value:1},ambientColor:{value:new s.Color},ambientIntensity:{value:0}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform vec3 ambientColor;\n\t\tuniform float ambientIntensity;\n\t\tuniform vec2 aoSize;\n\t\tuniform vec2 fullSize;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D gtaoBuffer;\n\t\tuniform float intensity;\n\t\tuniform int blurStride;\n\n\t\tvec3 UnpackNormal( vec4 d ) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec3 MultiBounce( float ao, vec3 albedo ) {\n\t\t\tvec3 x = vec3( ao );\n\t\t\tvec3 a = 2.0404 * albedo - vec3( 0.3324 );\n\t\t\tvec3 b = -4.7951 * albedo + vec3( 0.6417 );\n\t\t\tvec3 c = 2.7552 * albedo + vec3( 0.6903 );\n\t\t\treturn max( x, ( ( x * a + b ) * x + c ) * x );\n\t\t}\n\n\t\tvoid main() {\n\t\t\tvec4 color = texture2D( colorBuffer, vUv );\n\t\t\t// NO_BLUR\n\t\t\t#if BLUR_MODE == 0\n\t\t\t\tvec4 accumSample = texture2D( gtaoBuffer, vUv );\n\t\t\t#else\n\t\t\tvec2 currTexel = vUv * fullSize;\n\t\t\tvec2 currAoTexel = vUv * aoSize;\n\n\t\t\t// aoPixels per full size ones. Should be 1/2 at\n\t\t\tvec2 texelRatio = aoSize / fullSize;\n\n\t\t\tvec3 currNormal = UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tfloat currDepth = texture2D( depthBuffer, vUv ).r;\n\n\t\t\t// TODO: pull this sampling out into a function\n\t\t\tvec4 accumSample = vec4( 0.0 );\n\t\t\tfloat totalWeight = 1e-10;\n\t\t\tfloat pixelOffset = - float( BLUR_ITERATIONS ) / 2.0;\n\t\t\tpixelOffset += mod( float( BLUR_ITERATIONS ), 2.0 ) == 0.0 ? 0.0 : 0.5;\n\t\t\tpixelOffset *= float( blurStride );\n\n\t\t\t// BOX_BLUR\n\t\t\t#if BLUR_MODE == 1\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int x = 0; x < BLUR_ITERATIONS; x ++ ) {\n\n\t\t\t\t#pragma unroll_loop_start\n\t\t\t\tfor ( int y = 0; y < BLUR_ITERATIONS; y ++ ) {\n\n\t\t\t\t\tvec2 step = vec2( float( x ), float( y ) ) * float( blurStride );\n\n\t\t\t\t\t// iterate over full res pixels\n\t\t\t\t\tvec2 offsetUv = currTexel + ( pixelOffset + step ) / texelRatio;\n\t\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\t\t// get the associated pixel in the AO buffer\n\t\t\t\t\tvec2 aoUv = currAoTexel + pixelOffset + step;\n\t\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t\t// if the pixels are close enough in space then blur them together\n\t\t\t\t\tfloat offsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\t\tif ( abs( offsetDepth - currDepth ) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\t\t// Weigh the sample based on normal similarity\n\t\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\t\tfloat weight = max( 0.0, dot( offsetNormal, currNormal ) );\n\n\t\t\t\t\t\t// square the weight to give pixels with a closer normal even higher priority\n\t\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\t\t// accumulate\n\t\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// CROSS_BLUR\n\t\t\t#elif BLUR_MODE == 2\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// DIAGONAL_BLUR\n\t\t\t#elif BLUR_MODE == 3\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t#endif\n\n\t\t\taccumSample /= totalWeight;\n\n\t\t\t#endif\n\n\t\t\tfloat gtao = accumSample.a;\n\n\t\t\t#if COLOR_ONLY\n\n\t\t\tgl_FragColor = vec4( accumSample.rgb, 1.0 );\n\n\t\t\t#elif AO_ONLY\n\n\t\t\tvec3 rgb = mix( vec3( 1.0 ), vec3( accumSample.a ), intensity );\n\t\t\tgl_FragColor = vec4( rgb, 1.0 );\n\n\t\t\t#else\n\n\t\t\tvec3 rgb = mix( color.rgb, color.rgb * MultiBounce( gtao, color.rgb ), intensity );\n\t\t\tvec3 delta = color.rgb - rgb;\n\t\t\tvec3 ambient = ambientColor * delta * ambientIntensity;\n\n\t\t\tfloat colorFade = ( 1.0 - pow( 1.0 - gtao, 2.0 ) );\n\t\t\tgl_FragColor = vec4( rgb + ambient + accumSample.rgb * ( 0.75 + colorFade * 0.25 ), color.a );\n\n\t\t\t#endif\n\n\t\t}\n\t\t"};class aa{constructor(e){this.count=0,this.size=-1,this.sigma=-1,this.radius=-1,this.lookupTable=null,this.score=null,this.binaryPattern=null,this.resize(e),this.setSigma(1.5)}findVoid(){var e,{score:t,binaryPattern:r}=this;let n=1/0,a=-1;for(let i=0,s=r.length;i<s;i++)0===r[i]&&(e=t[i])<n&&(n=e,a=i);return a}findCluster(){var e,{score:t,binaryPattern:r}=this;let n=-1/0,a=-1;for(let i=0,s=r.length;i<s;i++)1===r[i]&&(e=t[i])>n&&(n=e,a=i);return a}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),r=2*t+1;const s=new Float32Array(r*r);var n=e*e;for(let e=-t;e<=t;e++)for(let o=-t;o<=t;o++){var a=(t+o)*r+e+t,i=e*e+o*o;s[a]=Math.pow(Math.E,-i/(2*n))}this.lookupTable=s,this.sigma=e,this.radius=t}}resize(e){this.size!==e&&(this.size=e,this.score=new Float32Array(e*e),this.binaryPattern=new Uint8Array(e*e))}invert(){const{binaryPattern:e,score:t,size:r}=this;t.fill(0);for(let t=0,i=e.length;t<i;t++){var n,a;0===e[t]?(n=~~(t/r),a=t-n*r,this.updateScore(a,n,1),e[t]=1):e[t]=0}}updateScore(e,t,r){const{size:n,score:a,lookupTable:i}=this;var s=this.radius,o=2*s+1;for(let u=-s;u<=s;u++)for(let d=-s;d<=s;d++){var l=i[(s+d)*o+u+s];let h=e+u,p=(h=h<0?n+h:h%n,t+d);var c=(p=p<0?n+p:p%n)*n+h;a[c]+=r*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,-1),this.count--}copy(e){this.resize(e.size),this.score.set(e.score),this.binaryPattern.set(e.binaryPattern),this.setSigma(e.sigma),this.count=e.count}}class ia{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new aa(1),this.savedSamples=new aa(1)}generate(){const{samples:e,savedSamples:t,sigma:r,majorityPointsRatio:n,size:a}=this;e.resize(a),e.setSigma(r);var i=Math.floor(a*a*n),s=e.binaryPattern,o=s,l=i;o.fill(0);for(let e=0;e<l;e++)o[e]=1;var[c,u=Math.random]=[s,this.random];for(let e=c.length-1;0<e;e--){var d=~~((u()-1e-6)*e),h=c[e];c[e]=c[d],c[d]=h}for(let t=0,r=s.length;t<r;t++)1===s[t]&&e.addPointIndex(t);for(;;){var p=e.findCluster(),m=(e.removePointIndex(p),e.findVoid());if(p===m){e.addPointIndex(p);break}e.addPointIndex(m)}const f=new Uint32Array(a*a);let g;for(t.copy(e),g=e.count-1;0<=g;){var v=e.findCluster();e.removePointIndex(v),f[v]=g,g--}var b=a*a;for(g=t.count;g<b/2;){var y=t.findVoid();t.addPointIndex(y),f[y]=g,g++}for(t.invert();g<b;){var x=t.findCluster();t.removePointIndex(x),f[x]=g,g++}return{data:f,maxValue:b}}}class sa extends Mn.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:sa.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=sa.BOX_BLUR,this.blurIterations=4,this.blurStride=1,this.enableFalloff=!0,this.falloffStart=.4,this.falloffEnd=2,this.ambientColor=new s.Color,this.ambientIntensity=0,this.lightBounceIntensity=1,this._gtaoBuffer=new s.WebGLRenderTarget(1,1,{format:s.RGBAFormat}),this._depthBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat,type:s.HalfFloatType}),this._depthReplacement=new $n,this._normalBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat}),this._normalReplacement=new Jn,this.gtaoQuad=new Mn.T(new s.ShaderMaterial(ra)),this.debugPackedQuad=new Mn.T(new s.ShaderMaterial(ea)),this.debugDepthQuad=new Mn.T(new s.ShaderMaterial(ta)),this.compositeQuad=new Mn.T(new s.ShaderMaterial(na));const r=new ia,n=(r.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var a=r.generate(),i=a.data,o=a.maxValue;for(let t=0,r=i.length;t<r;t++)n[4*t+e]=i[t]/o*255}this.blueNoiseTex=new s.DataTexture(n,r.size,r.size,s.RGBAFormat),this.blueNoiseTex.wrapS=s.RepeatWrapping,this.blueNoiseTex.wrapT=s.RepeatWrapping,this.blueNoiseTex.minFilter=s.LinearFilter,this.blueNoiseTex.needsUpdate=!0}dispose(){}setSize(e,t){var r=this.renderTargetScale,n=Math.floor(e*r);r=Math.floor(t*r),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(n,r)}render(e,t,r){t=this.renderToScreen?null:t;const{scene:n,camera:a,debug:i,debugPackedQuad:o,debugDepthQuad:l,compositeQuad:c,gtaoQuad:u}=this,d=u.material;sa.RendererState.copy(e,n);var h=()=>{sa.RendererState.restore(e,n),m.reset(n,!0)},p=this._depthBuffer;const m=this._depthReplacement;if(n.background=null,m.replace(n,!0,!0),e.setRenderTarget(p),e.setClearColor(sa.BlackColor,0),e.clear(),e.render(n,a),i.display===sa.DEPTH)return e.setRenderTarget(t),l.material.uniforms.texture.value=p.texture,l.render(e),void h();const f=this._normalReplacement;var g=this._normalBuffer;if(f.replace(n,!0,!1),e.setRenderTarget(g),e.clear(),e.render(n,a),i.display===sa.NORMAL)return e.setRenderTarget(t),e.clear(),o.material.uniforms.displayRoughness.value=0,o.material.uniforms.texture.value=g.texture,o.render(e),void h();this.numSteps!==d.defines.NUM_STEPS&&(d.defines.NUM_STEPS=this.numSteps,d.needsUpdate=!0),this.numDirections!==d.defines.NUM_DIRECTIONS&&(d.defines.NUM_DIRECTIONS=this.numDirections,d.needsUpdate=!0),this.radius.toFixed(16)!==d.defines.RADIUS&&(d.defines.RADIUS=this.radius.toFixed(16),d.needsUpdate=!0),Math.pow(this.falloffStart,2).toFixed(16)===d.defines.FALLOFF_START2&&Math.pow(this.falloffEnd,2).toFixed(16)===d.defines.FALLOFF_END2&&this.enableFalloff===Boolean(d.defines.ENABLE_FALLOFF)||(d.defines.FALLOFF_START2=Math.pow(this.falloffStart,2).toFixed(16),d.defines.FALLOFF_END2=Math.pow(this.falloffEnd,2).toFixed(16),d.defines.ENABLE_FALLOFF=this.enableFalloff?1:0,d.needsUpdate=!0),this.rotationJitter!==d.defines.ENABLE_ROTATION_JITTER&&(d.defines.ENABLE_ROTATION_JITTER=this.rotationJitter,d.needsUpdate=!0),this.radiusJitter!==d.defines.ENABLE_RADIUS_JITTER&&(d.defines.ENABLE_RADIUS_JITTER=this.radiusJitter,d.needsUpdate=!0),0!==this.lightBounceIntensity!==Boolean(d.defines.ENABLE_COLOR_BOUNCE)&&(d.defines.ENABLE_COLOR_BOUNCE=0!==this.lightBounceIntensity?1:0,d.needsUpdate=!0);var v=this._gtaoBuffer,b=Math.floor(v.texture.image.width),y=Math.floor(v.texture.image.height),x=a.projectionMatrix,w=s.MathUtils.DEG2RAD*a.fov;d.uniforms.params.value.set(this.directionOffset,this.stepOffset),d.uniforms.projInfo.value.set(2/(b*x.elements[0]),2/(y*x.elements[5]),-1/x.elements[0],-1/x.elements[5]),d.uniforms.clipInfo.value.set(a.near,a.far,y/(2*Math.tan(.5*w))*.5,0),d.uniforms.normalBuffer.value=g.texture,d.uniforms.depthBuffer.value=p.texture,d.uniforms.colorBuffer.value=r.texture,d.uniforms.lightBounceIntensity.value=this.lightBounceIntensity,d.uniforms.renderSize.value.set(Math.floor(v.texture.image.width),Math.floor(v.texture.image.height)),d.uniforms.blueNoiseTex.value=this.blueNoiseTex,d.uniforms.blueNoiseSize.value=this.blueNoiseTex.image.width,e.setRenderTarget(v),e.clear(),u.render(e);const S=c.material;S.uniforms.depthBuffer.value=p.texture,S.uniforms.normalBuffer.value=g.texture,S.uniforms.colorBuffer.value=r.texture,S.uniforms.gtaoBuffer.value=v.texture,S.uniforms.intensity.value=this.intensity,S.uniforms.aoSize.value.set(v.width,v.height),S.uniforms.fullSize.value.set(r.width,r.height),S.uniforms.blurStride.value=this.blurStride,S.uniforms.ambientColor.value.copy(this.ambientColor),S.uniforms.ambientIntensity.value=this.ambientIntensity,this.blurIterations!==S.defines.BLUR_ITERATIONS&&(S.defines.BLUR_ITERATIONS=this.blurIterations,S.needsUpdate=!0),this.blurMode!==S.defines.BLUR_MODE&&(S.defines.BLUR_MODE=this.blurMode,S.needsUpdate=!0),i.display===sa.AO_SAMPLE?1!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=1,S.needsUpdate=!0):0!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=0,S.needsUpdate=!0),i.display===sa.COLOR_SAMPLE?1!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=1,S.needsUpdate=!0):0!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=0,S.needsUpdate=!0),e.setRenderTarget(t),e.clear(),c.render(e),h()}}sa.NO_JITTER=0,sa.RANDOM_JITTER=1,sa.BLUENOISE_JITTER=2,sa.DEFAULT=0,sa.DEPTH=1,sa.NORMAL=2,sa.AO_SAMPLE=3,sa.COLOR_SAMPLE=4,sa.NO_BLUR=0,sa.BOX_BLUR=1,sa.CROSS_BLUR=2,sa.DIAGONAL_BLUR=3,sa.BlackColor=new s.Color(0),sa.RendererState=new class{constructor(){this.clearAlpha=0,this.clearColor=new s.Color,this.renderTarget=null,this.outputEncoding=s.LinearEncoding,this.overrideMaterial=null,this.shadowsEnabled=!1,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.background=null,this.autoUpdate=!0}copy(e,t){e&&(this.clearAlpha=e.getClearAlpha(),this.clearColor=e.getClearColor(this.clearColor),this.renderTarget=e.getRenderTarget(),this.shadowsEnabled=e.shadowMap.enabled,this.outputEncoding=e.outputEncoding,this.autoClear=e.autoClear,this.autoClearColor=e.autoClearColor,this.autoClearDepth=e.autoClearDepth,this.autoClearStencil=e.autoClearStencil),t&&(this.overrideMaterial=t.overrideMaterial,this.background=t.background,this.autoUpdate=t.autoUpdate)}restore(e,t){e&&(e.setClearAlpha(this.clearAlpha),e.setClearColor(this.clearColor),e.setRenderTarget(this.renderTarget),e.shadowMap.enabled=this.shadowsEnabled,e.outputEncoding=this.outputEncoding,e.autoClear=this.autoClear,e.autoClearColor=this.autoClearColor,e.autoClearDepth=this.autoClearDepth,e.autoClearStencil=this.autoClearStencil),t&&(t.overrideMaterial=this.overrideMaterial,t.background=this.background,t.autoUpdate=this.autoUpdate),this.renderTarget=null,this.overrideMaterial=null}};class oa{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new sa(this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.gtaoPass)}setAOData(e,t){"rotationJitter"===e||"radiusJitter"===e?"NONE"===t?this.gtaoPass[e]=0:"RANDOM"===t?this.gtaoPass[e]=1:"BLUE_NOISE"===t&&(this.gtaoPass[e]=2):"blurMode"===e?"NO_BLUR"===t?this.gtaoPass[e]=0:"BOX_BLUR"===t?this.gtaoPass[e]=1:"CROSS_BLUR"===t?this.gtaoPass[e]=2:"DIAGONAL_BLUR"===t&&(this.gtaoPass[e]=3):this.gtaoPass[e]="ambientColor"===e?new La.Color(t):t}dispose(){this.gtaoPass&&(this.gtaoPass.dispose(),this.gtaoPass=null)}enablePass(e){this.gtaoPass&&this.gtaoPass.enabled!==e&&(this.gtaoPass.enabled=e)}}function la(e){return(la="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ca(e,t){return(ca=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ua(e){return(ua=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var da=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ca(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ua(e);if(r=t?(r=ua(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===la(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(this instanceof n)return(l=r.call(this)).scene=e,l.camera=t,l.overrideMaterial=a,l.clearColor=i,l.clearAlpha=void 0!==o?o:0,l.clear=!0,l.clearDepth=!1,l.needsSwap=!1,l._oldClearColor=new s.Color,l;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"render",value:function(e,t,r){var n,a,i=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),n=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,n),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=i}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(Mn.w),ha={uniforms:{tDiffuse:{value:null},resolution:{value:new s.Vector2(1/1024,1/512)}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\tprecision highp float;\n\n\tuniform sampler2D tDiffuse;\n\n\tuniform vec2 resolution;\n\n\tvarying vec2 vUv;\n\n\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t//----------------------------------------------------------------------------------\n\t// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t// SDK Version: v3.00\n\t// Email: gameworks@nvidia.com\n\t// Site: http://developer.nvidia.com/\n\t//\n\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t//\n\t// Redistribution and use in source and binary forms, with or without\n\t// modification, are permitted provided that the following conditions\n\t// are met:\n\t// * Redistributions of source code must retain the above copyright\n\t// notice, this list of conditions and the following disclaimer.\n\t// * Redistributions in binary form must reproduce the above copyright\n\t// notice, this list of conditions and the following disclaimer in the\n\t// documentation and/or other materials provided with the distribution.\n\t// * Neither the name of NVIDIA CORPORATION nor the names of its\n\t// contributors may be used to endorse or promote products derived\n\t// from this software without specific prior written permission.\n\t//\n\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t//\n\t//----------------------------------------------------------------------------------\n\n\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t// For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t#endif\n\n\t/*--------------------------------------------------------------------------*/\n\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t/*--------------------------------------------------------------------------*/\n\n\t#define NUM_SAMPLES 5\n\n\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t}\n\n\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t============================================================================*/\n\n\t/*--------------------------------------------------------------------------*/\n\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t\t// locate the edge\n\t\t\t\t\tvec2 dirToEdge;\n\t\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t\t// . 2 . . 1 .\n\t\t\t\t\t// 1 0 2 ~= 0 0 1\n\t\t\t\t\t// . 1 . . 0 .\n\n\t\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t\t// . 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 H\n\n\t\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t\t// V 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 .\n\n\t\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t\t\t// 1 1 .\n\t\t\t\t\t\t\t// 0 0 1\n\t\t\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t\t\t// do a simple blur\n\t\t\t\t\t\t\treturn mix(\n\t\t\t\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t\t\t\t.4\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 . 1\n\t\t\t// 1 0 1 -> 0\n\t\t\t// . 0 . 1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsed = 0;\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\t\t\t\t\titerationsUsed = i;\n\n\t\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\t\tif(!doneN) {\n\t\t\t\t\t\t\tnDist += increment;\n\t\t\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!doneP) {\n\t\t\t\t\t\t\tpDist += increment;\n\t\t\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\t\trgbaM,\n\t\t\t\t\trgbaN,\n\t\t\t\t\tdist * .5\n\t\t\t);\n\t}\n\n\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\t\tvUv,\n\t\t\t\t\ttDiffuse,\n\t\t\t\t\tresolution,\n\t\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t}\n\t"},pa={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 ma={radius:{type:"number",val:.6,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},strength:{type:"number",val:1.5,shortKey:"s",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},threshold:{type:"number",val:0,shortKey:"t",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}}},fa={edgeStrength:{type:"number",val:3,shortKey:"es",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeGlow:{type:"number",val:0,shortKey:"eg",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeThickness:{type:"number",val:1,shortKey:"et",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},pulsePeriod:{type:"number",val:0,shortKey:"pp",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},visibleEdgeColor:{type:"color_str",val:"#FFFFFF",shortKey:"vec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},hiddenEdgeColor:{type:"color_str",val:"#190A05",shortKey:"hec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}}},ga={directionOffset:{type:"number",val:0,shortKey:"do",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},stepOffset:{type:"number",val:0,shortKey:"so",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},rotationJitter:{type:"other",val:"NONE",shortKey:"roj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radiusJitter:{type:"other",val:"NONE",shortKey:"raj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numSteps:{type:"number",val:8,shortKey:"ns",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numDirections:{type:"number",val:1,shortKey:"nd",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},intensity:{type:"number",val:1,shortKey:"i",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radius:{type:"number",val:2,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},enableFalloff:{type:"other",val:!0,shortKey:"ef",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffStart:{type:"number",val:.4,shortKey:"fs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffEnd:{type:"number",val:2,shortKey:"fe",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},renderTargetScale:{type:"number",val:.5,shortKey:"rts",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurMode:{type:"other",val:"NO_BLUR",shortKey:"bm",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurIterations:{type:"number",val:5,shortKey:"bi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurStride:{type:"number",val:1,shortKey:"bs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientColor:{type:"color_str",val:"#FFFFFF",shortKey:"ac",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientIntensity:{type:"number",val:0,shortKey:"ai",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},lightBounceIntensity:{type:"number",val:0,shortKey:"lbi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}}};var va=r(1398);class ba{constructor(e){this.params=this.getDefaultParams(),this.clean=()=>{this.resetParams(),this.reset()},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new La.Color(0),this.runScene=e,this.info=new xn(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new La.Vector2,this.sceneFogColor=null,this.sceneBackground=null,this.isUpdate=!0,this.runScene.exporter.gltf.options.addOption({type:"post-processing",process:e=>this.toJSON(),parse:e=>{e=JSON.parse(e),this.fromJSON(e)}}),this.runScene.cb.clean.add("pp",this.clean),this.runScene.cb.setScene.add("post-processing",(({type:e,val:t})=>{"fog"===e&&t&&t.show&&(this.sceneFogColor?this.sceneFogColor.copy(t.color):this.sceneFogColor=new La.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,D.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:ma}),this.runScene.snapshot.bind({name:"outline",target:this.params.outline,def:fa}),this.runScene.snapshot.bind({name:"ao",target:this.params.ao,def:ga,set:e=>{const t=e.snapshot.data.get("ao");t&&(va.LV.set({def:ga,runScene:this.runScene,data:t,target:this.params.ao,map:e}),e.data.completedCbs.push((()=>{(0,i.mapObj)(ga,((e,r)=>{var{type:r,val:n,shortKey:a}=r;"other"===r&&this.setAOData(e,void 0!==t[a]?t[a]:n)}))})))}})}getDefaultParams(){return{pp:{samples:2},glow:{isBloom:!1,radius:.6,strength:1.5,threshold:0},outline:{isOutline:!1,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,visibleEdgeColor:"#FFFFFF",hiddenEdgeColor:"#190A05"},ao:{isAO:!1,directionOffset:0,stepOffset:0,rotationJitter:"NONE",radiusJitter:"NONE",numSteps:8,numDirections:1,intensity:1,radius:2,enableFalloff:!0,falloffStart:.4,falloffEnd:2,renderTargetScale:.5,blurMode:"NO_BLUR",blurIterations:5,blurStride:1,ambientColor:"#FFFFFF",ambientIntensity:0,lightBounceIntensity:0},vignette:{isVignette:!1,offset:1,darkness:1}}}resetParams(){(0,y.U)(this.params,this.getDefaultParams())}init(){try{var{camera:e,scene:t,renderer:r}=this.runScene.assetsEx.get();this.mainScene=t,this.mainCamera=e,this.renderer=r,this.renderer&&(this.renderer.getSize(this.rtSize),this.postProcessing())}catch(e){console.log("Error: ",e)}this.runScene.cb.loaderer.gltf.loadNode.add("outline-objects",(({node:e,nodeDef:t})=>{t.extras&&t.extras.outline&&this.mtOutline.addSelectedObject(e)}))}postProcessing(){this.effectComposer=new Gn(this.renderer,this.getNewRenderTarget(this.params.pp.samples)),this.renderPass=new da(this.mainScene,this.mainCamera),this.fxaaPass=new Sn.T(ha),this.fxaaPass.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight),this.vignettePass=new Sn.T(pa),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass)}getNewRenderTarget(e){const t=new La.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new La.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=La.UnsignedIntType,t.depthTexture.format=La.DepthFormat,t.texture.format=La.RGBAFormat,t.texture.encoding=La.sRGBEncoding,t}ppOutline(){this.mtOutline=new Kn.Q(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new Cn(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new Wn(this))}ppAO(){this.mtAO=new oa(this)}toJSON(){const e={};var{pp:t,glow:r,outline:n,ao:a,vignette:i}=this.params;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},r),e.outlineParams=Object.assign({},n),e.aoParams=Object.assign({},a),e.vignetteParams=Object.assign({},i),JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:r,aoParams:n,vignetteParams:a}=e;e&&(e=e.samples,this.params.pp.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))),t&&(this.params.glow.isBloom=t.isBloom,this.setGlowData("radius",t.radius),this.setGlowData("strength",t.strength),this.setGlowData("threshold",t.threshold),this.runScene.cb.pp.glow.setData.cb(this.params.glow)),r&&this.mtOutline&&(this.params.outline.isOutline=r.isOutline,this.setOutlineData("edgeStrength",r.edgeStrength),this.setOutlineData("edgeGlow",r.edgeGlow),this.setOutlineData("edgeThickness",r.edgeThickness),this.setOutlineData("pulsePeriod",r.pulsePeriod),this.setOutlineData("visibleEdgeColor",r.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",r.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.params.outline)),n&&this.mtAO&&(this.params.ao.isAO=n.isAO,this.setAOData("directionOffset",n.directionOffset),this.setAOData("stepOffset",n.stepOffset),this.setAOData("rotationJitter",n.rotationJitter),this.setAOData("radiusJitter",n.radiusJitter),this.setAOData("numSteps",n.numSteps),this.setAOData("numDirections",n.numDirections),this.setAOData("intensity",n.intensity),this.setAOData("radius",n.radius),this.setAOData("enableFalloff",n.enableFalloff),this.setAOData("falloffStart",n.falloffStart),this.setAOData("falloffEnd",n.falloffEnd),this.setAOData("renderTargetScale",n.renderTargetScale),this.setAOData("blurMode",n.blurMode),this.setAOData("blurIterations",n.blurIterations),this.setAOData("blurStride",n.blurStride),this.setAOData("ambientColor",n.ambientColor),this.setAOData("ambientIntensity",n.ambientIntensity),this.setAOData("lightBounceIntensity",n.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.params.ao)),a&&this.vignettePass&&(this.params.vignette.isVignette=a.isVignette,this.setVignetteData("offset",a.offset),this.setVignetteData("darkness",a.darkness),this.runScene.cb.pp.vignette.setData.cb(this.params.vignette))}setUpdate(e){this.isUpdate=e}clearAllOutlineObj(){this.mtOutline.clearAllOutlineObj()}update(){var e;this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&!0!==(null==(e=_(this.runScene).renderConfig)?void 0:e.stop)&&(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 ya=r(9583),xa=r(713);class wa extends o{constructor(e){super(e),this.map=new p.Z,this.playLimit=new y.cM,this.renderName="script-texture-render",this._clock=new s.Clock,this.bindEvent()}parse(e,t){var r=(0,X.Ki)(t);0===Object.keys(e||{}).length?this.map.has(r)&&this.map.delete(r):this.map.set(r,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}_playAll(){this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:a}=r;t.userData.scriptTextre||(t.userData.scriptTextre={offsetX:t.offset.x,offsetY:t.offset.y,rotation:t.rotation}),e&&(t.offset.x+=e),n&&(t.offset.y+=n),a&&(t.rotation+=a)}))}playAll(){const{scriptFrame:e,mode:t}=this.runScene.optionsEx.options.renderConfig;-1===e&&"tick"===t?this.runScene.cb.render.add(this.renderName,(()=>{this._playAll()})):this.runScene.cb.render.add(this.renderName,(()=>{this.playLimit.update({cb:()=>{this._playAll()},cbRate:1/e,now:this._clock.getDelta()})}))}closeAll(){this.map.forEach((e=>{const t=e.texture;let r=0,n=0,a=0;t.userData.scriptTextre&&(r=(e=t.userData.scriptTextre).offsetX,n=e.offsetY,a=e.rotation,delete t.userData.scriptTextre),t.offset.x=r,t.offset.y=n,t.rotation=a})),this.runScene.cb.render.delete(this.renderName)}has(e){return void 0!==e.userData.uvScript}get(e){return e.userData.uvScript}set(e,t){t.userData.uvScript=e}}class Sa{constructor(e){this.map=new p.Z,this.parse=e=>{const t=e.model;this.getState(t)?this.map.set((0,X.Ki)(t),{model:t,oldRotate:t.rotation.toArray()}):(this.close(t),this.map.delete((0,X.Ki)(t)))},this.render=()=>{var e=this.runScene.assetsEx.get().camera;const{x:t,y:r,z:n}=e.position;this.map.map(((e,{model:a})=>{a.lookAt(t,r,n)}))},this.runScene=e,this.bindEvent()}bindEvent(){this.runScene.cb.unique.model.add.add("script-lookat",this.parse),this.runScene.cb.render.add("script-lookat",this.render),this.runScene.cb.exporter.gltf.before.add("script-lookAt",(()=>{this.closeAll()}))}setState(e,t){t?(0,H.M)(e,"lookAt",!0):delete e.userData.lookAt,this.parse({model:e})}getState(e){return!0===(0,H.is)(e,"lookAt")}close(e){var t=this.map.get((0,X.Ki)(e));t&&e.rotation.fromArray(t.oldRotate)}closeAll(){this.map.map(((e,{model:t,oldRotate:r})=>{t.rotation.fromArray(r)}))}}class Ma{constructor(e){this.map=new p.Z,this.dataMap=new p.Z,this.parseModel=e=>{var t=(0,X.Ki)(e);if(t){const r=this.awaitMap.get(t);r&&(r.map((t=>{let r=this.dataMap.get(t);r&&r.models.push({model:e})})),this.awaitMap.delete(t))}},this.loadedComplete=()=>{this.parseModel(this.runScene.assetsEx.get().camera)},this.clean=()=>{this.map.clear(),this.awaitMap.clear(),this.dataMap.clear()},this.awaitMap=new p.Z,this.parseJSON=e=>{(0,i.mapObj)(e,((e,t)=>{t.locals=t.locals.map((e=>new s.Vector3(e.x,e.y,e.z)));const r=t.modelIds;t.modelIds=new q.Z,this.map.set(e,t),r.map((e=>{t.modelIds.add(e);let r=this.awaitMap.get(e);var n;r||(n=new q.Z,this.awaitMap.set(e,n),r=n),r.add(t.id)})),this.addDataByMap(t)}))},this.render=()=>{this.dataMap.map(((e,t)=>{const{models:r,curve:n,speed:a,delayed:i,progress:s,loop:o,run:l}=t;if(l&&i){if(1<=s)return o?(t.delayed=!1,void this.onPlayBefore(t)):void this.close(e);r.map((e=>{const{model:r,oldPostion:i}=e;var s;e=t.progress<1?n.getPointAt(t.progress):i,r.position.copy(e),e=t.progress+a<1?n.getPointAt(t.progress+a):i,(0,C.N)(r)?(s=this.runScene.modelEx.select,r.lookAt(s?(0,ln.VU)(s,this.runScene.assetsEx.scene):this.runScene.assetsEx.controls.target)):r.lookAt(e)})),t.progress+=a}}))},this.runScene=e,this.bindEvent()}bindEvent(){this.runScene.cb.unique.model.add.add("script-lineAnima",(({model:e})=>{this.parseModel(e)})),this.runScene.cb.render.add("script-lookat",this.render),this.runScene.cb.exporter.gltf.before.add("script-lookat",(()=>{this.closeAll()})),this.runScene.cb.clean.add("script-lookat",this.clean),this.runScene.cb.loaderer.gltf.complete.add("script-lookat",this.loadedComplete),this.runScene.cb.load.complete.add("script-lookat",this.loadedComplete)}addDataByMap(e){e.loadTrigger&&this.dataMap.set(e.id,this.getData(e))}add(e){this.map.set(e.id,e),this.addDataByMap(e)}toJSON(){return this.map}getData(e){return{models:[],curve:(0,ln.kG)(e.locals,{closed:e.closed}).curve,run:!1,timer:void 0,delay:e.delay,delayed:!1,speed:e.speed,loop:e.loop,progress:0}}getOldLocal(e){return{oldPostion:e.position.clone(),oldRotation:e.rotation.clone()}}del(e){this.map.delete(e)}set(e,t){const r=this.dataMap.get(e);var n,a,i,s,o;r&&(n=this.map.get(e),({speed:a,loop:i,delay:s,closed:o}=t),this.map.set(e,t),r.speed=a,r.loop=i,r.delay=s,o!==n.closed&&(r.curve=(0,ln.kG)(t.locals,{closed:o}).curve))}use(e,t){const r=this.map.get(e);if(r&&r.modelIds.size!==(r.modelIds.add((0,X.Ki)(t)),r.modelIds.size)){const r=this.dataMap.get(e);r&&r.models.push(Object.assign({model:t},this.getOldLocal(t)))}}unUse(e,t){const r=(0,X.Ki)(t);if(r){e.modelIds.delete(r);const n=this.dataMap.get(e.id);!n||-1!==(t=n.models.findIndex((e=>(0,X.Ki)(e.model)===r)))&&n.models.splice(t,1)}}playAll(){this.dataMap.map(((e,t)=>{this.playByData(t)}))}playByData(e){e.run=!0,e.progress=0,e.models.map((e=>{var t=e.model,{oldPostion:t,oldRotation:r}=this.getOldLocal(t);e.oldPostion=t,e.oldRotation=r})),this.onPlayBefore(e)}play(e){!this.map.get(e)||(e=this.dataMap.get(e))&&this.playByData(e)}onPlayBefore(e){var{delayed:t,delay:r}=e;t||(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((()=>{e.progress=0,e.delayed=!0}),1e3*r))}closeByData(e){const t=e.models;e.run&&(e.progress=0,e.run=!1,t.map((e=>{const{model:t,oldPostion:r,oldRotation:n}=e;void 0!==r&&t.position.copy(r),void 0!==n&&t.rotation.copy(n)})))}close(e){(e=this.dataMap.get(e))&&this.closeByData(e)}closeAll(){this.dataMap.map((e=>{this.close(e)}))}getLocalsByModels(e){const[t]=e;var r;return"Line"===t.type?(t.matrixWorldNeedsUpdate=!0,r=t.geometry.attributes.position.applyMatrix4(t.matrixWorld),(0,ln.F)(r.array)):e.map((e=>(0,ln.VU)(e,this.runScene.assetsEx.scene)))}}class Ta{constructor(e){this.map=new p.Z,this.allAnima=[],this.runScene=e}play(e,t){var r;0!==e.children.length&&(r=(0,X.Ki)(e))&&(this.map.set(r,{model:e}),this.bindChildMap(e),this.render(e,t))}bindChildMap(e){if(0!==e.children.length){var t=(0,X.Ki)(e);const r=this.map.get(t),n=(r.yMap={},new p.Z);r.childMap=n,e.children.map((e=>{var t,a=(0,X.Ki)(e);a&&(t=e.position.y,r.yMap||(r.yMap={}),r.yMap[t]||(r.yMap[t]=[]),r.yMap[t].push(e),n.set(a,{child:e,oldPosition:e.position.clone()}))}))}}render(e,t){e=(0,X.Ki)(e);const r=this.map.get(e),{size:n,time:a}=t;Object.keys(r.yMap).sort(((e,t)=>Number.parseInt(e)-Number.parseInt(t))).map(((e,t)=>{r.yMap[e].map((e=>{var{x:i,y:s,z:o}=(0,ln.VU)(e,this.runScene.assetsEx.scene),l=0<i?1:-1,c=0<o?1:-1,i=(l=Math.random()*n*l,c=Math.random()*n*c,e.position.set(i+l,s,o+c),{x:e.position.x,y:e.position.y,z:e.position.z}),s={x:(l=r.childMap.get((0,X.Ki)(e)).oldPosition).x,y:l.y,z:l.z},o=(0,y.gY)(i,Object.assign(Object.assign({},s),{delay:t*a,onStart:()=>{e.visible=!0}}),2,(t=>{var{x:t,y:r,z:n}=t;e.position.set(t,r,n)}));this.allAnima.push(o)}))}))}}class _a extends o{constructor(e){super(e),this.runAll=!1,this.inited=()=>{this.runScene.cb.exporter.gltf.before.add("script",(()=>{this.closeAll()})),this.runScene.exporter.gltf.options.addOption({type:"script",parse:e=>{e&&(e=JSON.parse(e).lineAnima,this.lineAnima.parseJSON(e))},process:()=>JSON.stringify({lineAnima:this.lineAnima.toJSON()})})},this.texture=new wa(e),this.lookAt=new Sa(e),this.lineAnima=new Ma(e),this.boom=new Ta(e),e.cb.inited.add("texture",this.inited)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll(),this.lineAnima.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll(),this.lineAnima.closeAll())}}class Ea{constructor(e){this.map=new p.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,X.Ki)(e);t&&this.map.map(((e,r)=>{r.delete(t)}))}))}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new q.Z)}rename(e,t){const r=this.get(e);r&&(this.addId(t,r.toArray()),this.remove(e))}addId(e,t){this.map.has(e)||this.add(e),this.map.get(e).add(t)}addModel(e,t){if(this.map.has(e)||this.add(e),(0,y.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,X.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,y.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,X.Ki)(t))}remove(e){this.map.delete(e)}clear(){this.map.clear(),this.runScene.cb.tags.clear.cb()}toJSON(){const e={};return this.map.map(((t,r)=>{e[t]=[...r.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,i.mapObj)(e,((e,r)=>{t[e]=new q.Z(r)})),this.map=p.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}class Da{constructor(e,t){this.showTransform=!1,this.data={},this.uuid="",this.usedIds=new q.Z,this.getAnimaByModelData=(()=>{const e=(e,t,r,n)=>{const a={},s={};if(e=Da.isNotNow(e)?this.getAllData():e,(0,i.mapObj)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(a[r]=t[r],s[r]=e[r]):"color"===n&&(0,i.mapObj)(e[r],((e,n)=>{var i=r+e;a[i]=t[r][e],s[i]=n})))})),!(0,i.emptyObj)(a))return{begin:a,end:s}};return(t,r,n,a=!1,s)=>{let o=a?n.time:0;const l=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));return l.map((l=>{var c=t[String(l)];l=.001*((l=a?o-l:l-o)<=0?.001:l)*n.speed;{var d=r,h=c,p=l,m=s;const t={color(e){const{animaData:t,defType:r}=e,n={};return(0,i.mapObj)(t,(e=>{var a;-1!==e.indexOf(r)&&r.includes(r)&&(a=e.substring(r.length),n[a]=t[e])})),n}};return()=>{let r;return{promise:new Promise((n=>{var a;if(!(a=e(h,d,0,m)))return n(0);var{begin:a,end:s}=a;return r=(0,u.anima)(a,s,p,(e=>{(0,i.mapObj)(m,((r,n)=>{n=n.type;var a,i=e[r];"number"===n?d[r]=i:"color"===n&&(i=t.color({animaData:e,defType:r}))&&(({r:n,g:i,b:a}=i),d[r].setRGB(n,i,a))}))}),n)})),anima:r}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t,copyId:r}=this;return r?{copyId:r,type:t}:{data:e,type:t}}addData(e,t,r=!1){return 1e3<Number(e)&&(e="1000.00"),r?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,r=!1){const n={};return(0,i.mapObj)(e,(a=>{n[a]=r?"notNow":Da.getValByType(t,a,e)})),n}static getValByType(e,t,r){var n,a;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:a}=e),{r:t,g:n,b:a}):"V3"===r?(0,u.v3ToMap)(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:a}=e;var i,s;"number"===t?a[n]=r:"color"===t&&(({r:e,g:i,b:s}=r),a[n].setRGB(e,i,s))}getAllData(e=!1){return Da.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return Da.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,r){Da.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,Aa[r])(e);return n.data=t,n}reset(){(0,i.mapObj)(this.defOptions,((e,t)=>{Da.SetTargetByData({baseType:t.type,data:Da.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){if(0!==this.usedIds.size){let e;this.usedIds.map((t=>{const r=this.runScene.timeLineEx.getInsByUuid(t);r&&(e?(r.copyId=e.uuid,e.usedIds.add(r.uuid)):delete(e=r).copyId)}))}delete this.target.userData.isTimeLineUsed}}Da.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,a,s)=>{(0,i.mapObj)(a,((a,i)=>{var o,l,c,u,d,h;i=i.type,void 0!==t[a]&&void 0!==r[a]&&Da.SetTargetByData({baseType:i,data:(o=t[a],l=r[a],c=n,"number"===i?e(o,l,c):"color"===i?(({r:i,g:o,b:u}=o),({r:l,g:d,b:h}=l),{r:e(i,l,c),g:e(o,d,c),b:e(u,h,c)}):void 0),defType:a,target:s})}))}})();const Oa=Da;fe=class extends Oa{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s,target:o}=t,{position:r,scale:l,rotation:c,target:u}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&l&&(({x:t,y:r,z:a}=e(i,l,n)),this.target.scale.set(t,r,a)),s&&c&&(({x:i,y:l,z:t}=e(s,c,n)),this.target.rotation.set(i,l,t)),o&&u&&(({x:r,y:a,z:s}=e(o,u,n)),this.controls.target.set(r,a,s))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s,target:o}=Oa.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{},o?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{},o?{tx:o.x,ty:o.y,tz:o.z}:{})}},t=(t,r,n,a)=>()=>{let i;return{promise:new Promise((s=>{var{begin:o,end:l}=e(r,t,a);return i=(0,u.anima)(o,l,n,(e=>{var{px:e,py:n,pz:a,sx:i,sy:s,sz:o,rx:l,ry:c,rz:u,tx:d,ty:h,tz:p}=e;r.position&&t.position.set(e,n,a),r.scale&&t.scale.set(i,s,o),r.rotation&&t.rotation.set(l,c,u),r.target&&this.controls.target.set(d,h,p)}),s)})),anima:u.anima}};return(e,r,n,a=!1)=>{let s=a?n.time:0;const o=Object.keys(e).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,i.lastArrayEle)(o),c=a?"0.00":String(n.time);return l!==c&&(e[c]=Object.assign({},l),o.push(c)),o.map((i=>{var o=e[String(i)],l=.001*((l=a?s-i:i-s)<=0?.001:l)*n.speed;return s=i,t(r,o,l,n)}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:r,rotation:n}=this.target;return{position:e?"notNow":(0,u.v3ToMap)(t),scale:e?"notNow":(0,u.v3ToMap)(r),rotation:e?"notNow":(0,u.v3ToMap)(n),target:e?"notNow":(0,u.v3ToMap)(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let a;if("position"===e)a=(0,u.v3ToMap)(t);else if("scale"===e)a=(0,u.v3ToMap)(r);else if("rotation"===e)a=(0,u.v3ToMap)(n);else{if("target"!==e)throw TypeError("输入值不存在");a=(0,u.v3ToMap)(this.controls.target)}return a}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r,target:n}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z),this.controls.target.set(n.x,n.y,n.z)}},ge=class extends Oa{constructor(e,t){super(e,t),this.type="material",this.defOptions={roughness:{type:"number"},metalness:{type:"number"},opacity:{type:"number"},emissive:{type:"color"},color:{type:"color"}},this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.material.get(e)}isRemoved(){return!0}getId(){return this.runScene.uniqueEx.getId(this.target)}},n=class extends Oa{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s}=t,{position:r,scale:o,rotation:l}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&o&&(({x:t,y:r,z:a}=e(i,o,n)),this.target.scale.set(t,r,a)),s&&l&&(({x:i,y:o,z:t}=e(s,l,n)),this.target.rotation.set(i,o,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s}=Oa.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{})}};return(t,r,n,a=!1)=>{let i=a?n.time:0;const s=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));return s.map((s=>{var o,l,c,d,h=t[String(s)],p=.001*((p=a?i-s:s-i)<=0?.001:p)*n.speed;return i=s,o=r,l=h,c=p,d=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:a}=e(l,o,d);return t=(0,u.anima)(n,a,c,(e=>{var{px:e,py:t,pz:r,sx:n,sy:a,sz:i,rx:s,ry:c,rz:u}=e;l.position&&o.position.set(e,t,r),l.scale&&o.scale.set(n,a,i),l.rotation&&o.rotation.set(s,c,u)}),r)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z)}};class Pa extends o{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:r}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&r.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new p.Z({complete:this.after,mountModule:this.mount}),exportCallBacks:new p.Z};this.runScene.exporter.gltf.module.bind(e)}}var ka=r(7201);const Aa={model:n,camera:fe,material:ge};class Ca{constructor(){this.list={},this.$emit=this.emit,this.$on=this.on}on(e,t){this.list[e]=t}emit(...e){if(void 0!==this.list[e[0]])return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)));console.log("请先挂载在使用")}off(e){this.list[e]&&delete this.list[e]}}const La=c.Z,Ra=class{constructor(e){this._clock=new s.Clock,this.cb=new A(this),this.script=new _a(this),this.uniqueEx=new X.ZP(this),this.fileEx=new $r(this),this.snapshot=new va.ZP(this),this.undoEx=new fn.ZP(this),this.textureEx=new D.default(this),this.controlsEx=new W(this),this.assetsEx=new v(this),this.renderEx=new ya.ZP(this),this.events=new class{constructor(e){this.key=new K(this),this.mouse=new w(this),this.model=new Y(this),this.addEvent=e=>{const{dom:t,name:r,fn:n}=e,a=_(this.runScene).renderConfig;t.addEventListener(r,(e=>{!a.event.trigger||a.event.ignores.includes(r)||n(e)}))},this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),this.model.init(),this.addEvent({dom:window,name:"resize",fn:()=>{this.runScene.cb.resize.cb(this.runScene.renderEx.getDomSize())}})}}(this),this.multipSelector=new cn(this),this.helperEx=null,this.materialEx=new bt.default(this),this.cameraEx=new C.Z(this),this.sceneEx=new H.ZP(this),this.modelEx=new d.default(this),this.loaderer=new l.Z(this),this.exporter=new At(this),this.lightEx=new tn.ZP(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.idMap=new p.Z,this.animaMap={},this.groupMap={},this.clean=()=>{this.reset()},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var r,n,a=((e,t)=>{let r=-1,n=1e3;const a=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==a.length&&(a.map(((e,a)=>{e=Number(e),0<(e=t-e)&&e<n&&(n=e,r=a)})),-1!==r)){var i=a[r],s=a[r+1],o=e[i];if(e=e[s],o&&e){var l=Object.values(o)[0],c=Object.values(e)[0];if("notNow"!==l&&"notNow"!==c)return{left:o,right:e,progress:(t-Number(i))/(Number(s)-Number(i))}}}})(e.data,t);a&&(({left:a,right:r,progress:n}=a),e.setTargetByBetween(a,r,n))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new Pa(e),this.initSnapshot()}initSnapshot(){const e="time-line";let t={};this.runScene.cb.snapshot.beforeCreate.add(e,(()=>{(0,i.mapObj)(this.groupMap,((e,r)=>{t[e]=r.run,r.run&&(this.closeGroup(e),this.toLeft(r))}))})),this.runScene.cb.snapshot.create.add(e,(r=>{0!==(0,ka.objLength)(t)&&((0,i.mapObj)(t,((e,t)=>{t&&this.playGroup(e)})),r.data.set(e,(0,y.d9)(t)))})),this.runScene.cb.snapshot.delUseless.add(e,(t=>{(0,i.mapObj)(t,((t,r)=>{const n=r.data[e];n&&((0,i.mapObj)(n,(e=>{this.groupMap[e]||delete n[e]})),0===(0,ka.objLength)(n)&&delete r.data[e])}))})),this.runScene.cb.snapshot.set.add(e,(t=>{const r=t.snapshot.data.get(e);r&&t.data.completedCbs.push((()=>{(0,i.mapObj)(r,((e,t)=>{this[t?"playGroup":"closeGroup"](e)}))}))})),this.runScene.cb.snapshot.getLength.add(e,(t=>{var r=t.data.data.get(e);r&&(t.inputData[e]=Object.keys(r).length)})),this.runScene.cb.snapshot.getByType.add(e,(({})=>{})),this.runScene.cb.snapshot.resetItem.add(e,(({targets:t,type:r,datas:n})=>{r===e&&t.map((t=>{const{run:r,name:a}=t;n.map((t=>{const n=t.data;let i=n.get(e);(i=i||{})[a]=r,n.set(e,i)}))}))})),this.runScene.cb.snapshot.parseJSON.add(e,(t=>{t.map(((t,r)=>r.data.get(e)))}))}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}pause(e){var t,r;if(this.groupMap[e]){this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1;const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.run=!1}))}}resume(e){const t=this.groupMap[e];if(t){this.groupMap[e].run=!0;const r=this.animaMap[e];r&&r.length&&r.map((r=>{const{controls:n,promise:a}=r;n.run=!0,a.then((()=>{if(t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}))}}closeGroup(e){var t,r;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1,this.runScene.cb.timeLine.closeGroup.cb(e);const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.clean=!0})),delete this.animaMap[e]}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,i.mapObj)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){const t=[];Object.keys(e).map((r=>{const n=e[r],a={};(0,i.mapObj)(n.data,((e,r)=>{var{type:r,data:n,copyId:i}=r;const s=Aa[r];if(r=s.getTarget(e,this.runScene)){const o=new s(r,this.runScene);o.data=n,a[e]=o,i&&t.push({ins:o,id:i}),this.idMap.set(e,o)}})),n.data=a,this.groupMap[r]=n,this.runScene.cb.timeLine.setGroupMap.cb({group:n,groupName:r})})),t.map((({ins:e,id:t})=>{const r=this.idMap.get(t);r&&(e.data=r.data,e.copyId=t,r.usedIds.add(e.uuid))}))}playGroup(e,t){const r=(0,y.Gm)({onlyReverse:!1},t).onlyReverse,n=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(n&&!n.run){n.run=!0;const s=Object.keys(n.data).map((e=>{const t=n.data[e];if(r)return t.getAnima(n,!0);const a=t.getAnima(n);return n.reverse&&(e=t.getAnima(n,!0),a.push(...e)),a}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=s.map((e=>(0,i.eachTriggerArrGetControls)(e)));let o=0;o=r?n.time*n.speed:n.time*n.speed*(n.reverse?2:1);const l=(new Date).valueOf(),c=o;var a=setInterval((()=>{var t=((new Date).valueOf()-l)/c;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);let u;const d=new Promise((e=>u=setTimeout(e,o)));return this.timerMap[e]={setProgressTime:a,awaitRuned:u},d.then((()=>{var r;if(clearInterval(this.timerMap[e].setProgressTime),n.run){if(n.run=!1,n.loop)return this.playGroup(e);null!=(r=null==t?void 0:t.onDone)&&r.call(t)}}))}}setInsForIdMap(e){this.idMap.set(e.uuid,e)}getInsByUuid(e){return this.idMap.get(e)}toLeft(e){Object.values(e.data).map((e=>{var t=Object.values(e.data);t[0]&&e.setTargetByBetween(t[0],t[1]||t[0],0)}))}toRight(e){Object.values(e.data).map((e=>{var t=Object.values(e.data).reverse();t[0]&&e.setTargetByBetween(t[0],t[1]||t[0],100)}))}}(this),this.anima=new h(this),this.tags=new Ea(this),this.globalConfig=new en(this),this.pp=new ba(this),this.objects=new yn(this),this.code=new xa.Z(this),this.custom={},this.msg=new E(this),this.size=new O(this),this.inited=!1,this._renderLimit=new y.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx.get(),{scene:r,camera:n,controls:a}=this.assetsEx.get();this.cb.render.cb(""),this.pp.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n),"tick"===this.optionsEx.options.renderConfig.mode&&a.update()},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const r=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){r()},cbRate:1/e,now:t})):this._render()}},this.optionsEx=new T(this,e)}initLibs(e){if(!this.inited){this.optionsEx.init(e),this.inited=!0,this.snapshot.init(),this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.loaderer.init(),this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new an(this);const{camera:t,controls:r}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),r.update(),this.pp.init(),this.cameraEx.reset(t),this.cb.inited.cb(0)}}init(e){return this.initLibs(e),this}load(e){const{path:t,dom:r,loadConfig:n}=e;return this.init(r),this.loadScene(t,n).then((e=>{var t,r;0!==(null==e?void 0:e.length)&&(this.modelEx.add(e,void 0,{isScene:!0}),this.cb.load.modelAdded.cb({models:e}),null!=(t=null==(r=null==n?void 0:n.callBack)?void 0:r.loaded)&&t.call(r),null!=(r=(t=this.cb.load.loaded).cb)&&r.call(t,{models:e}))})),this}loadScene(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:r,progress:n,complete:i}=this.cb.load;t=t||{};var s=Object.assign(Object.assign({},t),{callBack:{getJSON:e=>{var n,a;null!=(a=null==(n=null==t?void 0:t.callBack)?void 0:n.getJSON)&&a.call(n,e),r.cb(e)},progress:e=>{var r,a;null!=(a=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&a.call(r,e),n.cb(e)},complete:e=>{var r,n;null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.complete)&&n.call(r,e),i.cb(e),this.render()}},triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,s);this.optionsEx.log("正在拉取场景","base","info");var o=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let r=t/e;1<(r=r<0?0:r)&&(r=1),t=Number(r.toFixed(2)),e=Math.floor(100*t),this.optionsEx.log("下载场景进度:"+e,"detail"),this.cb.load.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return o?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(o,s)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,i.getId)(),t),this}setSize(e,t){const{render2:r,render3:n}=this.assetsEx.get(),a=this.assetsEx.get().renderer;this.cameraEx.setSize(),null!=n&&n.setSize(e,t),null!=r&&r.setSize(e,t),a.setSize(e,t,!0),a.setPixelRatio(this.renderEx.pixelRatio),this.pp.setSize(e,t)}clean(){this.cb.clean.cb(0)}}},3736:(e,t,r)=>{r.d(t,{ZP:()=>y,bv:()=>T,is:()=>M,UE:()=>S,M:()=>x});var n=r(6001),a=r(8881),i=r(135),s=r(8609),o=r(9583),l=r(1794),c=r(2233);class u{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,r,n,a,i,s,{json:e,config:o,core:l}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&(({camera:t,lights:e,options:r,controls:n,tags:a,envStrength:i,objects:s}=e.asset.ex),void 0!==i&&this.runScene.sceneEx.setEnvStrength(i),this.parse.camera(t,o),e&&this.parse.light(e,o,l),this.parse.controls(n,o),o.module.tags&&this.runScene.tags.parseJSON(a||{}),this.parse.options(r),s&&this.runScene.objects.parseJSON(s))},after:e=>{const{core:t,json:r,data:n,config:a}=e;if("scene"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){var{options:e,json:i}=n;if(e=e.models,!t.loadConfig.module.model)return[];const s=e[0];if(t.module.get("model").data.map.map(((e,t)=>{this.runScene.uniqueEx.model.add(t)})),e=s.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e)),1===e.length){const[t]=e;t.animations=[...t.animations,...i.animations]}t.callback("loaded",""),this.runScene.optionsEx.sceneOptions.loaded=!0,this.parse.scene(r,a,t),t.models.push(...e)}},controls:(e,t)=>{var r;t.module.controls&&e&&(({x:t,y:e,z:r}=e),this.runScene.assetsEx.controls.target.set(t,e,r),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){let u=e;e.temp&&(u=e.camera,this.runScene.cameraEx.temp=l.Z.formJSON(e.temp));var{position:t,far:e,near:r,fov:n,name:a,userData:i,rotation:s}=this.runScene.loaderer.object.parse(u);const d=this.runScene.assetsEx.get().camera;var o=(0,c.Ki)(d);d.position.copy(t),d.far=e,d.near=r,d.fov=n,d.name=a,d.updateProjectionMatrix(),d.userData.id=i.id,this.runScene.uniqueEx.model.add(d,{oldId:o}),d.rotation.copy(s),this.runScene.assetsEx.get().controls.update()}},light:(e,t,r)=>{if(t.module.light){const t=[];e.map((e=>{var r=e.type;t.push(...this.runScene.lightEx.lightExMap[r].parseJSON(e))})),r.models.push(...t)}},scene:(e,t,r)=>{if(t.module.sceneConfig){const c=this.runScene.sceneEx.get();t=r.module.get("material").data.materialIns;var{materialId:r,backgroundMapping:e,backgroundColor:n,fog:i,backgroundIntensity:s,backgroundBlurriness:o,cssBgc:l}=e.asset.ex.sceneEx;if(r&&(r=null==(t=t[r])?void 0:t.material)){const{map:t,envMap:n,normalMap:a}=r;a&&"editor"===this.runScene.optionsEx.options.mode&&this.runScene.cameraEx.setBackground(a.userData.blob),t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0,void 0!==o&&(c.backgroundIntensity=o),void 0!==s&&(c.backgroundIntensity=s)),n&&this.runScene.sceneEx.setEnv(n)}if(l&&this.runScene.sceneEx.setCssBgc(l),n&&this.runScene.sceneEx.setBackground(new a.Color("#"+n)),i){const{color:e,far:t,near:r,show:n}=i,s=new a.Fog(e.includes("#")?e:"#"+e,r,t);!1===n?this.runScene.sceneEx.oldFog=s:c.fog=s,s.show=n,this.runScene.cb.setScene.cb({scene:c,type:"fog",val:s})}this.runScene.cb.setScene.cb({scene:c,type:"any",val:"any"})}},options:e=>{e.map((e=>{var{type:e,data:t}=e;const r=this.runScene.exporter.gltf.options.getParse(e);null!=r&&r.parse(t)}))}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new l.Z({beforeParse:this.parse.before,afterParse:this.parse.after,mountModule:this.mount}),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e)}}var d=r(7201),h=r(9667),p=r(8089);class m{constructor(e){this.create=e=>{var t=this.getDiff();0!==(0,d.objLength)(t)&&e.data.set("scene",t)},this.set=e=>{const t=e.snapshot.data.get("scene");if(t){const{fog:c,bgc:u,env:d,bgcm:m,envS:f,tm:g,oe:v,tme:b}=t,{scene:y,renderer:x}=this.runScene.assetsEx.get(),{animas:w,completedCbs:M}=e.data;let T=y.background;if(this.runScene.sceneEx.setEnvStrength(void 0!==f?f:1),void 0!==g&&(x.toneMapping=g),void 0!==v&&(x.outputEncoding=v),void 0!==b&&(x.toneMappingExposure=b),u){const{type:t,data:r}=u;if("color"===t)(0,i.isColor)(T)||null===T?(e=null===T?"#000000":(0,p.J6)(T),null===T&&this.runScene.sceneEx.setBackground(new a.Color("#000000")),e!==u.data&&w.push({target:y,label:"background",type:"color",isUpdate:!0,begin:e,end:r})):(0,h.isTexture)(T)&&M.push((()=>{this.runScene.sceneEx.setBackground(new a.Color(r))}));else if("texture"===t){const e=this.runScene.uniqueEx.texture.get(u.data);e&&(0,h.setTextureMapping)(e,303===m?"repeat":"normal"),M.push((()=>{this.runScene.sceneEx.setBackground(e)}))}}else(0,i.isColor)(T)&&(T||(T=new a.Color,this.runScene.sceneEx.setBackground(T)),w.push({target:y,label:"background",type:"color",isUpdate:!0,begin:(0,p.J6)(T),end:"#000000"})),M.push((()=>{this.runScene.sceneEx.setBackground(null)}));var r,n,s,o,l;M.push((()=>{y.environment=this.runScene.uniqueEx.texture.get(null==d?void 0:d.data)})),y.fog&&c?(({color:e,near:r,far:n}=c),({color:l,near:s,far:o}=y.fog),e!==(l=(0,p.J6)(l))&&w.push({target:y,label:["fog","color"],begin:l,end:e,type:"color",isUpdate:!0}),s!==r&&w.push({target:y,label:["fog","near"],begin:s,end:r,type:"number",isUpdate:!0}),o!==n&&w.push({target:y,label:["fog","far"],begin:o,end:n,type:"number",isUpdate:!0})):M.push((()=>{y.fog=c?S(c):null})),M.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,r=((r=this.runScene.sceneEx.getJson("fog"))&&(e.fog=r),this.runScene.sceneEx.getJson("background")),{scene:n,renderer:t}=this.runScene.assetsEx.get();return void 0!==(e.tm=t.toneMapping,e.oe=t.outputEncoding,e.tme=t.toneMappingExposure,r&&"texture"===(e.bgc=r).type&&303===n.background.mapping&&(e.bgcm=303),(t=this.runScene.sceneEx.getJson("environment"))&&(e.env=t),r=this.runScene.sceneEx.getEnvStrength())&&1!==r&&(e.envS=r),e}}var f=r(3735),g=r(2510),v=r(7169),b=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class y{constructor(e){this.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.clearCssBgc()},this.envStrength=1,this.runScene=e,this.exportAndImport=new u(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 this.runScene.assetsEx.get().scene}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}getEnvStrength(){return this.envStrength}remove(e){if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:a,remove:i}=this.removeMap[r];if(a(e))return t.push(...(0,n.multiArrToArr)(i(e)))}t.push(new v.Z({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:r,remove:n}=this.removeMap[t];if(r(e))return n(e)}this.runScene.modelEx.remove(e),this.runScene.helperEx.unfocus()}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}searchModel(e){var t=e.slice(0,1);let r=[];if(":"!==t&&":"!==t)return this.runScene.uniqueEx.model.findModelWithName(e);{const[t,n]=e.slice(1).split("=");return t?this.runScene.uniqueEx.model.find((({model:e,type:r})=>"lock"===t?s.lockModel.isLock(e):"dynamic"===t?s.dynamicModel.isDynamic(e):"type"===t?n===r:void 0)):r}}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new a.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&s.normalModel.is(e))).map((e=>{const r=e.clone();(0,s.withAnima)(e)&&(r.animations=[...e.animations]),t.add(r)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){this.setBackground(null).then(),this.setEnv(null).then(),e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return b(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e));var r=this.get(),n=((0,h.isTexture)(e)&&(e.userData.isBackgroud=!0,this.runScene.cb.texture.setMaterial.cb({target:this.runScene.assetsEx.scene,targetType:"scene",type:"background",val:e,oldVal:(0,h.isTexture)(r.background)?r.background:null})),new g.Z({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{}}).execute());return t&&this.runScene.undoEx.addUndo(n),this.runScene.cb.setScene.cb({scene:r,type:"background",val:r.background}),e}))}isBackground(e){return e.userData.isBackgroud}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,o.sH)(e),t.dispose(),this.runScene.pp.dispose(),a.Cache.clear()}render(){}create(){var e=new a.Scene;return(0,c.x)(e,(0,n.getId)()),e}setEnv(e){return b(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.get().scene,r=t.environment;let n;return e instanceof String&&(n=yield this.runScene.textureEx.load(e,{isEnv:!0})),e instanceof File&&(n=yield this.runScene.textureEx.parse(e,{isEnv:!0})),null!=e&&e.isTexture&&(n=this.runScene.textureEx.getSameTexture(e.userData.md5,e)||this.runScene.textureEx.clone(e),this.runScene.cb.texture.setMaterial.cb({target:this.runScene.assetsEx.scene,targetType:"scene",type:"env",val:n,oldVal:r})),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:r,val:n}=e;e=new g.Z({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setRealReflection(){const{scene:e,renderer:t}=this.runScene.assetsEx.get();this.cubeRT||(this.cubeRT=new a.WebGLCubeRenderTarget(1024)),this.realReflectionCamera||(this.realReflectionCamera=new a.CubeCamera(.1,5e3,this.cubeRT),e.add(this.realReflectionCamera),this.runScene.cb.render.add("RealReflection-update",(()=>{this.realReflectionCamera.update(t,e)}))),this.isRealReflection?(this.preEnvMap=e.environment,this.setEnv(null).then(),this.setNormal({model:e,info:"environment",val:this.cubeRT.texture})):this.preEnvMap&&this.setEnv(this.preEnvMap).then(),this.testSphere||(this.testSphere=new a.Mesh(new a.SphereGeometry(15,32,16),new a.MeshStandardMaterial),e.add(this.testSphere),this.testSphere.scale.set(10,10,10),this.testSphere.position.set(0,600,0),this.testSphere.getWorldPosition(this.realReflectionCamera.position),this.testSphere.material.roughness=0,this.testSphere.material.metalness=1)}set(e,t){"background"===e?this.setBackground(t):"env"===e&&this.setEnv(t)}setFogShow(e){var t=this.runScene.assetsEx.get().scene,{show:e,color:r}=e;if(e){let e=this.oldFog||new a.Fog(r||"#ffffff");e.show=!0,this.setNormal({model:t,info:"fog",val:e})}else this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null}),this.oldFog.show=!1;this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.get().scene,{type:e,val:r,cb:n}=e;t=new f.Z({target:t,typeList:["fog",e],newVal:r,cb:n}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:r,height:a}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const i=this.runScene.assetsEx.get().renderer.domElement;return this.runScene.cb.resize.cb({width:e,height:t}),this.runScene.pp.update(),e=i.toDataURL("image/png",1),t=(0,n.base64ToFile)(e,"screenShot.png"),this.runScene.cb.resize.cb({width:r,height:a}),this.runScene.pp.update(),t}getJson(e){let t;var r=this.runScene.assetsEx.get().scene;if("fog"===e){var n=r.fog;n&&(t=w(n,null!==r.fog))}else if("background"===e){if(!r.background)return;t={type:(n=(0,i.isColor)(r.background))?"color":"texture",data:(n?p.J6:c.Ki)(r.background)}}else if("environment"===e){if(!r.environment)return;t={type:"texture",data:(0,c.Ki)(r.environment)}}return t}static toJSON(e,t){const r={};let n=!1,a=e.fog;return a?n=!0:a=t.sceneEx.oldFog,a&&(r.fog=w(a,n)),(0,i.isColor)(e.background)?r.backgroundColor=e.background.getHexString():(0,h.isTexture)(e.background)&&(e.backgroundIntensity&&(r.backgroundIntensity=e.backgroundIntensity),e.backgroundBlurriness&&(r.backgroundBlurriness=e.backgroundBlurriness)),t.sceneEx.cssBgc&&(r.cssBgc=t.sceneEx.cssBgc),r}setEnvStrength(e){this.runScene.cb.scene.setEnvStrength.cb({val:e}),this.runScene.uniqueEx.material.each((t=>this.runScene.materialEx.setEnvStrength(t,e))),this.envStrength=e}setCssBgc(e){this.setBackground(null);var{color1:e,color2:t,deg:r,percent:n}=e,a=`linear-gradient(${r}deg,${e}, ${n}%,${t} )`;this.cssBgc={color1:e,color2:t,percent:n,deg:r},this.runScene.assetsEx.renderer.domElement.style.background=a}clearCssBgc(){this.cssBgc=void 0,this.runScene.assetsEx.renderer.domElement.style.background=""}}const x=(e,t,r)=>{e.userData[t]=r},w=(e,t)=>{var{color:e,far:r,near:n}=e;return{color:(0,p.J6)(e),show:t,far:r,near:n}},S=e=>{var{color:e,far:t,near:r}=e;return new a.Fog(e,r,t)},M=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",T=(e,t)=>{delete e.userData[t]}},1398:(e,t,r)=>{r.d(t,{LV:()=>p,ZP:()=>h});var n=r(6001),a=r(3263),i=r(1794),s=r(7201),o=r(9667),l=r(2233),c=r(5317),u=r(8089);const d=["number","color","color_obj","color_str","v2","v3"];class h{constructor(e){this.map=new i.Z,this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"snapshot",map:{parse:e=>Promise.all(e.childs.map((e=>new Promise((t=>{this.set(e,{onDone:()=>{t(0)}})})))))}})},this.playing=new i.Z,this.unique={set:()=>{},get:()=>{}},this.toJSON=()=>{var e=JSON.stringify(this.map.toJSON());return e=JSON.parse(e),this.runScene.cb.snapshot.delUseless.cb(e),JSON.stringify(e)},this.parseJSON=e=>{const t=i.Z.formJSON(JSON.parse(e));t.map(((e,t)=>{t.data=i.Z.formJSON(t.data)})),this.map=t,this.runScene.cb.snapshot.parseJSON.cb(this.map)},this.clean=()=>{this.map.clear()},this.trans={set:(e,t)=>{var r,n,a,i,s,o=e.label instanceof Array?e.label.join("."):e.label;const l={begin:[],end:[]};return"color"===e.type||"color_obj"===e.type||"color_str"===e.type?(a=(0,u.sS)(e.begin),r=(0,u.sS)(e.end),i=o+"_"+t+"_r",s=o+"_"+t+"_g",n=o+"_"+t+"_b",l.begin.push({type:i,data:a.r}),l.begin.push({type:s,data:a.g}),l.begin.push({type:n,data:a.b}),l.end.push({type:i,data:r.r}),l.end.push({type:s,data:r.g}),l.end.push({type:n,data:r.b})):"number"===e.type?(l.begin.push({type:o+"_"+t,data:e.begin}),l.end.push({type:o+"_"+t,data:e.end})):"v2"!==e.type&&"v3"!==e.type||(a=o+"_"+t+"_x",i=o+"_"+t+"_y",s=o+"_"+t+"_z",l.begin.push({type:a,data:e.begin.x}),l.begin.push({type:i,data:e.begin.y}),"v3"===e.type&&(l.begin.push({type:s,data:e.begin.z}),l.end.push({type:s,data:e.end.z})),l.end.push({type:a,data:e.end.x}),l.end.push({type:i,data:e.end.y})),l},getKey(e){let t=[];var{unique:r,type:n}=e;return e=e.label instanceof Array?e.label.join("."):e.label,"v2"===n||"v3"===n?(t.push(e+"_"+r+"_x"),t.push(e+"_"+r+"_y"),t.push(e+"_"+r+"_z")):"color"===n||"color_obj"===n||"color_str"===n?(t.push(e+"_"+r+"_r"),t.push(e+"_"+r+"_g"),t.push(e+"_"+r+"_b")):"number"===n&&t.push(e+"_"+r),t},update:(e,t)=>{var r;const a=this.trans.getKey(e);let i=e.target,s=e.label,o=(e.label instanceof Array&&(s=(0,n.lastArrayEle)(e.label),i=(0,n.objLastMap)(e.target,e.label)),t[a[0]]),l=s;"color"===e.type||"color_obj"===e.type?(o={r:0,g:0,b:0},a.map((e=>{var[,,r]=e.split("_");e=t[e]/255,o[r]=e}))):"color_str"===e.type?o="#"+a.map((e=>Number(Number(t[e]).toFixed(0)).toString(16).padStart(2,"0"))).join(""):"v2"!==e.type&&"v3"!==e.type||(o={x:0,y:0,z:0},a.map((e=>{var[,,r]=e.split("_");o[r]=t[e]}))),null!=(r=e.onUpdate)&&r.call(e,{target:i,data:o,type:l,runScene:this.runScene})},exec:(e,t)=>{const r=this.trans.getKey(e);let a=e.target,i=e.label;e.label instanceof Array&&(i=(0,n.lastArrayEle)(e.label),a=(0,n.objLastMap)(e.target,e.label)),"color"===e.type||"color_str"===e.type||"color_obj"===e.type?r.map((e=>{var[,,r]=e.split("_");e=1<t[e]?t[e]/255:t[e],a[i][r]=e})):"number"===e.type?a[i]=t[r[0]]:"v2"!==e.type&&"v3"!==e.type||r.map((e=>{var[,,r]=e.split("_");a[i][r]=t[e]}))}},this.getLengthByName=e=>{var t;if(e=this.map.get(e))return t={},this.runScene.cb.snapshot.getLength.cb({data:e,inputData:t}),t},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),this.runScene.cb.inited.add("snapshot",this.onInited)}create(e){this.runScene.cb.snapshot.beforeCreate.cb();var{name:e,time:t}=e;return this.map.get(e)&&this.del(e),e={name:e,time:t,data:new i.Z},this.runScene.cb.snapshot.create.cb(e),e}resetItem(e){const{targets:t,names:r,type:n}=e;e=r.map((e=>this.map.get(e))).filter((e=>e)),this.runScene.cb.snapshot.resetItem.cb({targets:t,datas:e,type:n})}add(e){var t=this.create(e);return this.map.set(e.name,t),t}addByType(e){var{name:t,time:r,targets:n,type:a}=e,t={name:t,time:r,data:new i.Z};return this.runScene.cb.snapshot.getByType.cb({type:a,data:t,targets:n}),this.map.set(e.name,t),t}set(e,t){return new Promise((r=>{var n=this.map.get(e);const{animaTime:a,isLinear:i,onDone:s}=Object.assign({animaTime:-1},t);if(!n)return r();const o={animas:[],completedCbs:[]};if(this.runScene.cb.snapshot.set.cb({snapshot:n,data:o}),0===o.animas.length)return 0===o.completedCbs.length||o.completedCbs.map((e=>e())),r(null==s?void 0:s());this.anima(e,o,{animaTime:-1===a?n.time:a,isLinear:i,onDone:()=>{r(null==s?void 0:s())}})}))}del(e){var t=this.map.get(e);t&&this.runScene.cb.snapshot.delete.cb({name:e,data:t})}anima(e,t,r){var a;if(this.runScene.modelEx.selectNull(),null==(a=this.playing.get(e))||!a.animaIns){const a=new i.Z,s={},o={},{animaTime:l,isLinear:u,onDone:d}=r,h={data:t,animaIns:null};t.animas.map(((e,t)=>{t=String(t);const{begin:r,end:n}=this.trans.set(e,t);r.map((e=>s[e.type]=e.data)),n.map((e=>o[e.type]=e.data)),a.set(t,Object.assign({unique:t},e))})),h.animaIns=(0,c.anima)(s,Object.assign(Object.assign({},o),{ease:u?"none":"easeOut"}),l,(e=>{(0,n.mapObj)(e,(t=>{var[,t]=t.split("_");(t=a.get(t))&&(t.isUpdate?this.trans.exec(t,e):this.trans.update(t,e))}))}),(()=>{var e;null!=(e=h.animaIns)&&e.kill(),h.animaIns=null,h.data.completedCbs.map((e=>e())),null!=d&&d()})),this.playing.set(e,h)}}close(e){const t=this.playing.get(e);return!(!t||(null!=(e=t.animaIns)&&e.kill(),t.animaIns=null))}closeAll(){this.playing.map(((e,t)=>{var r;t&&null!=(r=t.animaIns)&&r.kill(),t.animaIns=null}))}parseNromal(e,t){const{animas:r,completedCbs:a}=t.data,{target:i,type:s,begin:o,end:l,set:u,label:h,onUpdate:p}=e;if((0,c.isDef)(o,l))if(d.includes(s))r.push({target:i,type:s,begin:o,end:l,label:h,isUpdate:void 0===p,onUpdate:p});else if(u)u({target:i,begin:o,end:l});else{let e=i,t=h;h instanceof Array&&(e=(0,n.objLastMap)(i,h),t=(0,n.lastArrayEle)(h)),"texture"===s?e[t]=l:a.push((()=>{e[t]=l}))}}bind(e){const{name:t,def:r,target:n,create:a,set:i}=e;this.runScene.cb.snapshot.create.add(t,a||(e=>{var a=p.getDiff(r,n);0!==(0,s.objLength)(a)&&e.data.set(t,a)})),this.runScene.cb.snapshot.set.add(t,i||(e=>{var a=e.snapshot.data.get(t);a&&p.set({def:r,runScene:this.runScene,data:a,target:n,map:e})}))}}const p={toNormal(e){var t,{type:e,val:r}=e;let n=r;return"color"===e?n=(0,u.Lv)(r):"color_obj"===e?n=r:"color_str"===e?n=(0,c.MyHextoRgb)(r,!0):"texture"===e?(0,o.isTexture)(r)&&(n=(0,l.Ki)(r)):"v3"!==e&&"v2"!==e||(({x:e,y:r,z:t}=r),n={x:e,y:r,z:t}),n},parse(e){const{type:t,val:r,runScene:n}=e;let i=r;return"color"===t?i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0):"color_obj"===t?i=r:"color_str"===t&&(i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0)),"texture"===t&&null!==r?n.uniqueEx.texture.get(r):i},getDiff(e,t){let r={};return(0,n.mapObj)(e,((e,a)=>{const{label:i,get:s}=a;let o=t[e];s?o=s(t):i&&(o=(0,n.objLastMap)(t,i)[(0,n.lastArrayEle)(i)]),r[e]=o})),(0,s.replaceKVForObj)((0,c.getDiff)((0,s.replaceValForObj)(e,((e,t)=>t.val)),r),((t,r)=>{var{shortKey:t,type:n}=e[t];return{k:t,v:p.toNormal({type:n,val:r})}}))},set(e){const{def:t,data:r,target:a,runScene:i,map:s}=e;(0,n.mapObj)(t,((e,t)=>{const{type:o,val:l,shortKey:u,before:d,label:h,onUpdate:m,get:f,set:g}=t;let v=a,b=e;h&&(v=(0,n.objLastMap)(a,h),b=(0,n.lastArrayEle)(h)),t=p.toNormal({type:o,val:f?f(v):v[b]}),e=p.parse({type:o,val:void 0!==r[u]?r[u]:l,runScene:i}),(0,c.isDef)(t,e)&&(null!=d&&d({target:v,begin:t,end:e}),i.snapshot.parseNromal({target:v,label:b,type:o,set:g,begin:t,end:e,onUpdate:m},s))}))}}},9667:(e,t,r)=>{r.r(t),r.d(t,{bindTextureBaseData:()=>I,createDefTexture:()=>ce,createImgBItMapForArrayBuffer:()=>he,createImgBItMapForBlob:()=>pe,createScreenForTexture:()=>fe,cubeTextureStrs:()=>ie,defExportTextureUserData:()=>T,default:()=>E,disposeTexture:()=>C,getBlobByTexture:()=>B,getCloneIdFromTexture:()=>K,getImageBitMapOptions:()=>z,getImageDomByUrl:()=>te,getMd5ForTexture:()=>ae,getMimeByTexture:()=>P,getSizeByTexture:()=>H,getTextureGm:()=>be,getTextureGmByRatio:()=>ve,getTextureGpuMemory:()=>A,getTextureMinFilter:()=>Q,getTextureSize:()=>ge,getTextureType:()=>oe,getTexturesGpuMemory:()=>k,getUrlByTexture:()=>V,helperTexture:()=>le,initTexture:()=>U,isClonedTexture:()=>W,isCubeTexture:()=>ne,isInvalidTexture:()=>re,isTexture:()=>Z,loadTexture:()=>F,mergeDefUserData:()=>_,parseImageBitMapByBlob:()=>N,setMimeForTexture:()=>O,setTextureBlob:()=>L,setTextureCloneId:()=>q,setTextureEncodeing:()=>se,setTextureImageForBase64:()=>de,setTextureImageForBlob:()=>me,setTextureMapping:()=>G,setTextureMinFilter:()=>Y,setTextureUrl:()=>R,textureNameMap:()=>D,textureToBase64:()=>ue,unDelAbleTexture:()=>ee,updateTexture:()=>X});var n=r(6001),a=r(8881);function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function")}var t,r;return t=e,r=[{key:"fromCubeTexture",value:function(e){for(var t=0,r=new a.Vector3,n=new a.Vector3,i=new a.Color,s=[0,0,0,0,0,0,0,0,0],l=new a.SphericalHarmonics3,c=l.coefficients,u=0;u<6;u++)for(var d,h,p=(h=e.image[u]).width,m=h.height,f=(((d=document.createElement("canvas")).width=p,d.height=m,d=d.getContext("2d")).drawImage(h,0,0,p,m),h=d.getImageData(0,0,p,m)).data,g=h.width,v=2/g,b=0,y=f.length;b<y;b+=4){i.setRGB(f[b]/255,f[b+1]/255,f[b+2]/255),o(i,e.encoding);var x=((S=b/4)%g+.5)*v-1,w=1-(Math.floor(S/g)+.5)*v;switch(u){case 0:r.set(-1,w,-x);break;case 1:r.set(1,w,x);break;case 2:r.set(-x,1,-w);break;case 3:r.set(-x,-1,w);break;case 4:r.set(-x,w,1);break;case 5:r.set(x,w,-1)}var S=r.lengthSq(),M=4/(Math.sqrt(S)*S);t+=M,n.copy(r).normalize(),a.SphericalHarmonics3.getBasisAt(n,s);for(var T=0;T<9;T++)c[T].x+=s[T]*i.r*M,c[T].y+=s[T]*i.g*M,c[T].z+=s[T]*i.b*M}for(var _=4*Math.PI/t,E=0;E<9;E++)c[E].x*=_,c[E].y*=_,c[E].z*=_;return new a.LightProbe(l)}},{key:"fromCubeRenderTarget",value:function(e,t){for(var r=0,n=new a.Vector3,i=new a.Vector3,s=new a.Color,l=[0,0,0,0,0,0,0,0,0],c=new a.SphericalHarmonics3,u=c.coefficients,d=0;d<6;d++)for(var h=t.width,p=new Uint8Array(h*h*4),m=(e.readRenderTargetPixels(t,0,0,h,h,p,d),2/h),f=0,g=p.length;f<g;f+=4){s.setRGB(p[f]/255,p[f+1]/255,p[f+2]/255),o(s,t.texture.encoding);var v=((y=f/4)%h+.5)*m-1,b=1-(Math.floor(y/h)+.5)*m;switch(d){case 0:n.set(1,b,-v);break;case 1:n.set(-1,b,v);break;case 2:n.set(v,1,-b);break;case 3:n.set(v,-1,b);break;case 4:n.set(v,b,1);break;case 5:n.set(-v,b,-1)}var y=n.lengthSq(),x=4/(Math.sqrt(y)*y);r+=x,i.copy(n).normalize(),a.SphericalHarmonics3.getBasisAt(i,l);for(var w=0;w<9;w++)u[w].x+=l[w]*s.r*x,u[w].y+=l[w]*s.g*x,u[w].z+=l[w]*s.b*x}for(var S=4*Math.PI/r,M=0;M<9;M++)u[M].x*=S,u[M].y*=S,u[M].z*=S;return new a.LightProbe(c)}}],r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function o(e,t){switch(t){case a.sRGBEncoding:e.convertSRGBToLinear();break;case a.LinearEncoding:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported encoding.")}}var l=r(6422),c=r(1794),u=r(6292),d=r(135),h=r(3736),p=r(9430),m=r(2233),f=r(5317),g=r(6006);class v{constructor(e){this.onDel=e=>{(e=(0,m.Ki)(e))&&this.runScene.cb.msg.del.cb({id:e})},this.onAdd=e=>{const t=(0,m.Ki)(e);if(t){const r=this.getEffectType(e);r&&this.runScene.cb.msg.add.cb({tipType:"info",type:"texture",id:t,data:r.map((e=>({subType:e,id:t})))})}},this.runScene=e,this.init()}init(){this.runScene.cb.texture.add.add("texture-msg",this.onAdd),this.runScene.cb.texture.remove.add("texture-msg",this.onDel)}getEffectType(e){let t=[];var{size:e,blob:r,gm:n}=e.userData;return r&&1024e3<r.size&&t.push("overSize"),e?(({width:r,height:e}=e),3686400<r*e&&t.push("overSolution")):14745600<n&&t.push("overSolution"),0<t.length?t:void 0}}var b=r(1398),y=r(7201);const x={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 w{constructor(e){this.onDeleteSnapshot=e=>{const{data:t,name:r}=e;(e=t.data.get("texture"))&&(0,n.mapObj)(e,(e=>{(e=this.runScene.uniqueEx.texture.get(e))&&this.setUnDel(e,!1,r)}))},this.resetItem=e=>{"texture"===e.type&&e.datas.map((t=>{const{data:r,name:n}=t;let a=r.get("texture");a||(a={},r.set("texture",a)),e.targets.map((e=>{var t=(0,m.Ki)(e);t&&(a[t]=this.getItem(e,n))}))}))},this.setUnDel=(e,t,r)=>{if(t){if(ee.is(e))return}else if(ee.getRef(e)!=="snapshot_"+r)return;ee.set(e,t,"snapshot_"+r)},this.getItem=(e,t)=>{this.setUnDel(e,!0,t);const r=b.LV.getDiff(x,e);return(t=this.runScene.script.texture.get(e))&&(r.uvScript=Object.assign({},t)),r},this.getDiff=e=>{let t={};return this.runScene.uniqueEx.texture.getAll().map((({texture:r})=>{var n=(0,m.Ki)(r);n&&(t[n]=this.getItem(r,e))})),t},this.create=e=>{var t=this.getDiff(e.name);0!==(0,y.objLength)(t)&&e.data.set("texture",t)},this.set=e=>{var t=e.snapshot.data.get("texture");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.texture.get(t))&&(b.LV.set({def:x,data:r,runScene:this.runScene,map:e,target:t}),this.runScene.script.texture.parse(r.uvScript,t),this.runScene.script.texture.set(r.uvScript,t))}))},this.runScene=e,this.runScene.cb.snapshot.create.add("texture",this.create),e.cb.snapshot.delUseless.add("texture",(t=>{(0,n.mapObj)(t,((t,r)=>{const a=r.data.texture;a&&((0,n.mapObj)(a,(t=>{0<e.uniqueEx.texture.getTimeCitedLength(t)||delete a[t]})),0===(0,y.objLength)(a)&&delete r.data.texture)}))})),this.runScene.cb.snapshot.set.add("texture",this.set),this.runScene.cb.snapshot.getLength.add("texture",(e=>{var t=e.data.data.get("texture");t&&(e.inputData.texture=Object.keys(t).length)})),this.runScene.cb.snapshot.delete.add("texture",this.onDeleteSnapshot),this.runScene.cb.snapshot.resetItem.add("texture",this.resetItem)}}var S=r(3263),M=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const T={md5:void 0,format:void 0,size:void 0,uvScript:void 0,unDelAble:void 0,unDelAbleRef:void 0,id:void 0,cloneSourceId:void 0,minFilter:void 0,isHdr:void 0,cubeMap:void 0,isHelper:void 0,blobMap:void 0,lightProbeIntensity:void 0},_=(e,t)=>{(0,n.mapObj)(T,((r,n)=>{var a=e[r];a!==n&&(t[r]=a)}))};class E{constructor(e){this.defEncoding=u.Z.LinearEncoding,this.allTextures=new Set,this.awaitLoader=new c.Z,this.rgbeLoader=new l.x,this.spcielBack=["hdr","pic"],this.inited=()=>{this.runScene.cb.exporter.gltf.options.add.cb({type:"texture",parse:e=>{e&&(e=JSON.parse(e),(0,n.mapObj)(e,((e,t)=>{this[e]=t})))},process:()=>{const e={};return this.defEncoding!==u.Z.LinearEncoding&&(e.defEncoding=this.defEncoding),JSON.stringify(e)}})},this.cubeLoader=new a.CubeTextureLoader,this.setAnima=e=>{const{texture:t,type:r,val:n}=e,a=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=a),0===n?delete a[r]:a[r]=n,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:a})},this.runScene=e,this.snapshot=new w(e),this.msg=new v(e),this.multip=new g.Z(e),this.runScene.cb.inited.add("texture",this.inited)}load(e,t){return M(this,void 0,void 0,(function*(){var r=yield(0,f.urlToBlob)(e);return this.parse(r,t)}))}onLoaded(e){return M(this,void 0,void 0,(function*(){var t=(0,m.Ki)(e);let r=this.awaitLoader.get(t);yield this.runScene.textureEx.afterLoad(e),r.map((e=>e()))}))}parse(e,t){return M(this,void 0,void 0,(function*(){var r=(t=(0,f.mergeObject)({flipY:!0,isEnv:!1},t)).isEnv;let n,a;if(Z(e))return e;if(e instanceof Array)if(6===e.length)n=yield this.praseCubeByFiles(e),a=yield(0,f.fileToBlob)(e[0]);else{const r=e[0],i=(a=yield(0,f.fileToBlob)(r),r.name.toLocaleLowerCase());this.spcielBack.includes(i.substring(i.lastIndexOf(".")+1))?(n=yield this.parseHdr(a)).userData.isHdr=!0:n=yield F(a,t)}else e instanceof File?(a=yield(0,f.fileToBlob)(e),this.spcielBack.includes(e.name.substring(e.name.lastIndexOf(".")+1))?(n=yield this.parseHdr(a)).userData.isHdr=!0:n=yield F(a,t)):n=n||(yield F(e,t));return r&&G(n),this.afterLoad(n,a)}))}praseCubeByFiles(e){return M(this,void 0,void 0,(function*(){const t={};if(6!==e.length)throw TypeError("立方体纹理加载时,必须包含六张贴图");const r=[];var n=e.map((e=>M(this,void 0,void 0,(function*(){var n=ie.findIndex((t=>e.name.includes(t)));if(-1===n)throw TypeError("立方体纹理加载时,文件名必须包含方位信息");var a=URL.createObjectURL(e);t[ie[n]]=yield(0,f.fileToBlob)(e),r[n]=a}))));yield Promise.all(n);const a=yield this.cubeLoader.loadAsync(r);return a.encoding=u.Z.sRGBEncoding,a.userData.blobMap=t,a}))}praseCubeByBlobMap(e){return M(this,void 0,void 0,(function*(){const t=yield this.cubeLoader.loadAsync(ie.map((t=>URL.createObjectURL(e[t]))));return t.encoding=u.Z.sRGBEncoding,t.userData.blobMap=e,t}))}createLightProbe(){}setLightProbeForCube(e,t,r){var n=e.userData.lightProbe;if(t){if(!n){const t=new a.LightProbe;return t.copy(s.fromCubeTexture(e)),void 0!==r&&(t.intensity=r),e.userData.lightProbe=t,this.runScene.helperEx.setHelper(t,!0),this.runScene.modelEx.add(t,void 0,{addToTree:!1,addUndo:!1,isClone:!1}),t}}else n&&(this.runScene.modelEx.remove(e.userData.lightProbe,!1),delete e.userData.lightProbe)}parseHdr(e){return M(this,void 0,void 0,(function*(){const t=yield this.rgbeLoader.loadAsync(URL.createObjectURL(e));return t.userData.md5=(0,f.getMd5)(t.source.data.data),t.encoding=u.Z.LinearEncoding,t}))}clone(e){const t=e.clone();return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,n.getId)(),cloneSourceId:(0,m.Ki)(e)}),(0,h.bv)(t,"minFilter"),I(t,this.runScene),this.getSameAndAddtoAll(t)}getDef(e){return e=new a.Texture(e),I(e,this.runScene),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))||(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return M(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield I(e,this.runScene,t))}))}getSameTexture(e,t){if(!W(t))for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e)return r.mapping===t.mapping?r:void 0}}initTextureAndAddtoAll(e){return M(this,void 0,void 0,(function*(){return U(e),I(e,this.runScene),this.addTextureToAll(e),e}))}addTextureToAll(e){var t=this.runScene.uniqueEx.texture.getLength();this.runScene.uniqueEx.texture.add(e),this.runScene.uniqueEx.texture.getLength()!==t&&this.runScene.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:(0,f.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t){return M(this,void 0,void 0,(function*(){let r;r=Z(t)?t:t?yield this.parse(t):null;var a=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(a){const e=[];yield Promise.all((0,n.mapObj)(a,((t,{datas:n,type:a})=>{if("scene"===a)n.map((e=>this.runScene.sceneEx.set(e,r)));else{const a=this.runScene.uniqueEx.material.get(t);if(a)return Promise.all(n.map((t=>M(this,void 0,void 0,(function*(){e.push(yield this.runScene.materialEx.setTexture({material:a,type:t,newVal:r,getUndo:!0},!1))})))))}}))),this.runScene.undoEx.addUndo(e)}}))}remove(e){return M(this,void 0,void 0,(function*(){const t=(0,m.Ki)(e);var r=this.runScene.uniqueEx.texture.map[t];if(r){const a=[];r=r.targets;const i=[],s=((0,n.mapObj)(r,((e,{datas:t})=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{i.push(this.runScene.materialEx.setTexture({material:r,type:e,newVal:null,getUndo:!0},!1))})),(0,d.updateMaterial)(r))})),yield Promise.all(i).then((e=>{a.push(...e)})),this.runScene.uniqueEx.texture.map[t]);a.push(new p.Z({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 p.Z({undo:()=>{this.runScene.uniqueEx.texture.map[t]=s},redo:()=>{delete this.runScene.uniqueEx.texture.map[t]}}).execute()),this.runScene.undoEx.addUndo(a)}}))}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),ne(e)&&this.setLightProbeForCube(e,!1),C(e)}reverseImageBitMapTexture(e){return M(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:r}=yield(0,f.reverseImageBitMap)(e.image);const i=new a.Texture(r);return i.needsUpdate=!0,r=this.runScene.uniqueEx.texture.map[e.userData.id],(0,n.mapObj)(r.targets,((t,{datas:r})=>{const n=this.runScene.uniqueEx.material.get(t);r.forEach((t=>{this.runScene.materialEx.setTexture({material:n,type:t,newVal:e},!1)}))})),U(i),yield I(i,this.runScene),this.runScene.cb.texture.add.cb(i),this.delete(e),(0,f.disposeCanvas)(t),i}))}setUnDelAble(e,t,r="custom",n){ee.set(e,t,r,n),this.runScene.cb.texture.set.cb({type:"unDelAble",texture:e,data:t})}getUsedModel(e,t=!0){if(e=(0,m.Ki)(e)){const r=[];if((e=this.runScene.uniqueEx.texture.map[e])&&((0,n.mapObj)(e.targets,(e=>{const t=this.runScene.uniqueEx.material.map[e];t&&r.push(...t.models.toArray())})),0!==r.length))return t&&this.runScene.multipSelector.add(r,!0),r}}getUsedMaterial(e){if((e=(0,m.Ki)(e))&&(e=this.runScene.uniqueEx.texture.map[e]))return(0,n.mapObj)(e.targets,(e=>null==(e=this.runScene.uniqueEx.material.map[e])?void 0:e.material)).filter((e=>e))}setMinFilter(e){this.runScene.uniqueEx.texture.getAll().map((({texture:t})=>{Y(t,e)}))}getSize(e){let t=0;return e.userData.blobMap?(0,n.mapObj)(e.userData.blobMap,((e,r)=>t+=r.size)):t+=e.userData.blob.size,t}setEncoding(e){const t="def"===e?u.Z.LinearEncoding:u.Z.sRGBEncoding;this.defEncoding=t,this.runScene.uniqueEx.texture.getAll().map((e=>{const r=e.texture;r.encoding=t,r.needsUpdate=!0}))}getAllBase64ByType(e){const t={};return this.runScene.uniqueEx.texture.getAll().map((({texture:e,base64:r})=>M(this,void 0,void 0,(function*(){var n,a=(0,m.Ki)(e);!a||(n=e.image)instanceof ImageBitmap&&(t[a]=r||(0,f.imgBitMapToBase64)(n))})))),t}createByImg(e,t){return e=new a.Texture(e),this.afterLoad(e,t)}bindDataForTexture(e,t){t.repeat.copy(e.repeat),t.offset.copy(e.offset),t.center.copy(e.center),t.rotation=e.rotation,(0,n.mapObj)(e.userData.uvScript||{},((e,r)=>{this.setAnima({texture:t,type:e,val:r})})),Y(t,Q(e)),t.encoding=e.encoding}}const D={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},O=(e,t)=>{let r="image/jpeg"===t?1022:1023;return e.format=r,e},P=e=>1023===e.format?"image/png":"image/jpeg",k=e=>{let t=0;return e.map((e=>t+=A(e))),t},A=e=>{if(e.userData.gm)return e.userData.gm;let t=0,r=e.source.data;return(r=e.source.data instanceof Array?r:[e.source.data]).map((e=>{var{width:e,height:r}=e||{width:0,height:0};t+=e*r*4*1.33})),t},C=e=>{var t,r;e&&(t=e.image,r=e.userData.url,t instanceof ImageBitmap?(0,f.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,f.disposeCanvas)(t),URL.revokeObjectURL(r),e.dispose())},L=(e,t)=>{e.userData.blob=t,e.userData.mimeType=t.type},R=(e,t)=>{e.userData.isHdr?e.userData.url=fe(e):e.userData.url=URL.createObjectURL(t)},I=(e,t,r)=>M(void 0,void 0,void 0,(function*(){if(e.userData.isHdr&&(e.flipY=!0),3e3===e.encoding&&(e.encoding=t.textureEx.defEncoding),"editor"!==t.optionsEx.options.mode)return e;var n=(0,f.isBlob)(e.userData.blob)?e.userData.blob:null,{md5:a,url:i}=(n=r||n||(yield B(e)),L(e,n),e.userData);return a||(e.userData.md5=yield ae(e)),i||R(e,n),e.userData.gm=A(e),e.needsUpdate=!0,e})),B=e=>(0,f.isBlob)(e.userData.blob)?e.userData.blob:(0,f.imgBitMapToBlob)(e.image),U=e=>{if(!e.userData.isHdr&&!e.isCubeTexture)return e.magFilter=1006,e.wrapS=u.Z.RepeatWrapping,e.wrapT=u.Z.RepeatWrapping,3001!==e.encoding&&(e.encoding=3e3),e.version=3,e.userData.flipY?e.flipY=!0:e.flipY=!1,e.flipY=!0,"nearest"!==Q(e)&&(e.minFilter=u.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e},j={resizeQuality:"pixelated"},N=(e,t)=>{const r=Object.assign({},j);return null!=t&&t.flipY&&(r.imageOrientation="flipY"),createImageBitmap(e,r)},z=e=>{const t={resizeQuality:"pixelated"};return null!=e&&e.flipY&&(t.imageOrientation="flipY"),t},F=(e,t)=>M(void 0,void 0,void 0,(function*(){var r=yield N(yield te(e instanceof Blob?URL.createObjectURL(e):e),t);const n=new a.Texture(r);return n.needsUpdate=!0,n})),V=e=>null==(e=e.userData)?void 0:e.url,G=(e,t="repeat")=>(e.mapping="repeat"===t?u.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),H=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},Z=e=>null==e?void 0:e.isTexture,W=e=>void 0!==e.userData.cloneSourceId,K=e=>e.userData.cloneSourceId,q=(e,t)=>{e.userData.cloneSourceId=t},X=e=>{e.needsUpdate=!0},Y=(e,t)=>{e.minFilter=u.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,h.M)(e,"minFilter",t),X(e)},Q=e=>(0,h.is)(e,"minFilter")||"linear",J="unDelAble",$="unDelAbleRef",ee={is:e=>(0,h.is)(e,J),getRef:e=>(0,h.is)(e,$),set(e,t,r="custom",n){if(t)(0,h.M)(e,J,t),(0,h.M)(e,$,r);else{let t=!1;(t=!(!n&&(0,h.is)(e,$)!==r)||t)&&(delete e.userData[J],delete e.userData[$])}}},te=e=>{const t=document.createElement("img");return t.src=e,new Promise((e=>{t.addEventListener("load",(()=>{e(t)}))}))},re=e=>{var t;return!!le.is(e)||0===(null==(t=e.userData.blob)?void 0:t.size)||void 0!==(null==(t=e.source)?void 0:t.data.width)&&(0===(null==(t=e.source)?void 0:t.data.width)||0===e.source.data.height)},ne=e=>e.isCubeTexture||!1,ae=e=>M(void 0,void 0,void 0,(function*(){var t;return ne(e)?(t=(yield Promise.all(ie.map((t=>M(void 0,void 0,void 0,(function*(){return(0,f.getMd5)(yield e.userData.blobMap[t].arrayBuffer())})))))).reduce(((e,t)=>e+t)),(0,f.getMd5)(t)):(0,f.getMd5)(yield e.userData.blob.arrayBuffer())})),ie=["px","nx","py","ny","pz","nz"],se=(e,t)=>{e.encoding="def"===t?u.Z.LinearEncoding:u.Z.sRGBEncoding,e.needsUpdate=!0},oe=e=>e.userData.isHdr?"hdr":e.isCubeTexture?"cube":"normal",le={is:e=>(0,h.is)(e,"isHelper"),set(e,t){t?(0,h.M)(e,"isHelper",!0):delete e.userData.isHelper}},ce=()=>new u.Z.Texture(new Image(1,1)),ue=e=>{if((e=e.image)instanceof ImageBitmap)return(0,f.imgBitMapToBase64)(e)},de=(e,t)=>M(void 0,void 0,void 0,(function*(){me(e,(0,f.base64ToBlob)(t))})),he=e=>pe(new Blob([e])),pe=e=>createImageBitmap(e,Object.assign(Object.assign({},j),{imageOrientation:"flipY"})),me=(e,t)=>M(void 0,void 0,void 0,(function*(){var r=yield createImageBitmap(t,Object.assign(Object.assign({},j),{imageOrientation:"flipY"}));e.image=r,L(e,t),R(e,t),e.needsUpdate=!0})),fe=(()=>{const e=new a.Scene,t=new a.PerspectiveCamera,r=new a.WebGLRenderer;return new u.z(t,r.domElement),e.add(t),n=>{var{width:a,height:i}=n.source.data;return r.setSize(a,i),e.background=n,r.render(e,t),r.domElement.toDataURL("image/webp")}})(),ge=e=>(null==(e=null==(e=e.userData)?void 0:e.blob)?void 0:e.size)||0,ve=(e,t)=>{var{width:e,height:r}=e.image;return e*t*r*t*4*1.33},be=(e,t)=>{let r=0;return S.F6.toArr(e).map((e=>{r+=ve(e,t||1)})),r}},6006:(e,t,r)=>{r.d(t,{Z:()=>s}),t=r(7995);var n=r(3263),a=r(1794),i=r(2233);class s{constructor(e){this.map=new a.Z,(this.runScene=e).cb.events.window.pointer.up.add("core-texture",(()=>{this.clear()}))}add(e,t){t&&this.clear(),n.F6.toArr(e).map((e=>{var t=(0,i.Ki)(e);if(t){if(this.map.has(t))return this.del(e);s.callBack.add.cb({texture:e}),this.map.set(t,e)}}))}del(e){var t=(0,i.Ki)(e);t&&(this.map.delete(t),s.callBack.del.cb({texture:e}))}clear(){this.map.clear(),s.callBack.clear.cb(0)}setSelect(e){this.runScene.events.key.ctrl?this.add(e):(this.clear(),this.selected=e,s.callBack.setSelect.cb({texture:e}))}}s.callBack={setSelect:new t.Z,add:new t.Z,del:new t.Z,clear:new t.Z}},6651:(e,t,r)=>{r.d(t,{ZP:()=>n,d9:()=>a});class n{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.clean=()=>{this.reset()},this.runScene=e,this.runScene.cb.clean.add("Undo",this.clean)}undo(){if(0!==this.undos.length){const e=this.removeUndos(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e),this.runScene.cb.undo.undo.cb({data: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),this.runScene.cb.undo.redo.cb({data:e}))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.cb.undo.reset.cb("")}}var a=function(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=a(e[t]),n[t]=r);return n}}},4773:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(1269);class a{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:a,runScene:i,isScene:s}=e;this.runScene=i,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===a&&(this.isClone=a),r&&(this.cb=r),this.isScene=s}remove(e){const{model:t,parent:r,addTree:n,runScene:a}=e;a.modelEx.select===t&&a.modelEx.selectNull(),r.remove(t),n&&a.uniqueEx.model.remove(t),n&&a.cb.model.remove.cb({model:t,parent:r}),this.cb(t,"remove"),a.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:r,addTree:a,isClone:i,runScene:s,isScene:o}=e;r.add(t),a&&s.uniqueEx.model.add(t),a&&s.cb.model.add.cb({model:t,parent:r,isClone:i,isScene:o}),this.cb(t,"add"),s.uniqueEx.material.addModel(t,t.material),(0,n.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)}))}}},4616:(e,t,r)=>{r.d(t,{Z:()=>n});class n{}},9430:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.info="函数修改",this.map=e}_execute(e,t){throw new Error("Method not implemented.")}execute(){return this.map.redo(),this}undo(){this.map.undo()}redo(){this.map.redo()}}const a=n},3735:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(6001);class a extends r(4616).Z{constructor(e){super(),this.type="多层级修改",this.isUndoMultipLevel=!0,this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,e.executeFn&&(this.executeFn=e.executeFn),this.old=(0,n.objLastMap)(e.target,this.typeList)[(0,n.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,n.objLastMap)(this.target,this.typeList);var r=t[(0,n.lastArrayEle)(this.typeList)];this.executeFn?this.executeFn({typeList:this.typeList,target:this.target,val:e,oldVal:r}):t[(0,n.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t,{typeList:this.typeList,target:this.target,val:e,oldVal:r})}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const i=a},2510:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=(e,t)=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:a,cb:i,executeCb:s}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,i&&(this.cb=i),s&&(this.executeCb=s)}_execute(e,t){var{target:r,info:n}=this;if(this.executeCb)return this.executeCb({target:r,info:n,val:e,type:t});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(r=this.runScene.uniqueEx.model.parseName(this.target),n=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=r||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,t)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,"undo")}redo(){this._execute(this.newVal,"redo")}}const a=n},7169:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends r(4773).Z{constructor(e){super(e),this.type="移除模型",this.isUndoRemove=!0}undo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}redo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}_execute(e){return Promise.reject()}execute(){return this.redo(),this}}},4380:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:a}=e;this.target=e,this.info=t,this.runScene=a,this.newV3=r,this.oldV3=n,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.cb.model.setSelect.cb(null),this.runScene.cb.model.setSelect.cb(this.target))}_execute(e){this.runScene.cb.model.setVector3.cb({type:this.info,model:this.target}),this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}}const a=n},2233:(e,t,r)=>{r.d(t,{ZP:()=>g,Ki:()=>v,x:()=>b});var n=r(6001),a=r(272),i=r(135),s=r(9457),o=r(3263);class l{constructor(e){this.map={},this.removes=[],this.getUnUsers=()=>o.F6.filter((0,n.mapObj)(this.map,((e,{material:t,models:r})=>0===r.size?{id:e,material:t}:null))),this.unique=e}add(e,t,r){(0,i.getMaterials)(e).map((e=>{if(null!=e&&e.userData&&!i.materialIgnore.is(e)){let i=e.userData.id;if(i||(i=(0,n.getId)(),e.userData.id=i),this.map[i]){if(this.map[i].material.name!==e.name){const t=(0,n.getId)();e.userData.id=t,this.map[t]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e)}}else this.map[i]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e),"MeshPhongMaterial"===e.type&&s.Z.afterload(e,this.unique.runScene);t?this.addModel(t,e,r):this.unique.runScene.cb.unique.material.setTimecited.cb({material:e,length:this.map[i].models.size})}}))}addModel(e,t,r){if(!r||!t||v(r)!==v(t)){if(null!=t&&t.userData){var n=v(t);const r=this.map[n];r&&(r.models.add(e),this.unique.runScene.cb.unique.material.setTimecited.cb({material:t,length:r.models.size}))}if(r){const t=this.map[v(r)];t&&((n=t.models.find((t=>v(t)===v(e))))&&t.models.delete(n),this.unique.runScene.cb.unique.material.setTimecited.cb({material:r,length:t.models.size}))}}}each(e){return this.getAll("values").map((({material:t})=>e(t)))}getAll(e){return Object[e](this.map)}get(e){return null==(e=this.map[e])?void 0:e.material}getModels(e){return null==(e=this.map[e])?void 0:e.models}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,n.mapObj)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}isUsed(e){return!!(e=this.map[e])&&0<e.models.size}clearUnUsed(){this.getUnUsers().map((({material:e})=>{this.unique.runScene.materialEx.remove(e)}))}}var c=r(1269),u=r(8609),d=r(158);class h extends r(8716).Z{constructor(){super(...arguments),this.nameMap={},this.map={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1===t?-1:(e=e.slice(t+1),n.type.isNumber(e)?Number.parseInt(e):-1)},t=(r,n)=>{var a=(t=>{if(-1===e(t))return t;var r=t.lastIndexOf("_");return-1===r?t:t.slice(0,r)})(r)+"_"+n++;return this.nameMap[a]?t(r,n):a},r=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),a=["PerspectiveCamera"];return n=>{if(a.includes(n.type))return n.name=n.type;let i=n.name;if(i=i||n.type,!this.nameMap[i])return s=this.unique.getId(n),(o=r(s))&&delete this.nameMap[o],void(this.nameMap[i]=s);var s,o=this.nameMap[i];return this.unique.model.get(o)!==n?(s=e(i),s=t(i,o=-1===s?0:s),this.nameMap[s]=this.unique.getId(n),n.name=s):void 0}})()}add(e,t){var{reset:r,hasReset:a,oldId:i}=t||{ignoreMaterial:!1};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e&&!(0,u.isHelper)(e)){i&&delete this.map[i];let s=e.userData.id;if(s&&!r||(s=(0,n.getId)(),e.userData.id=s),this.unique.runScene.cb.unique.model.add.cb({model:e}),this.map[s]){if(!(a||(0,d.An)(this.unique.runScene)&&(0,d.FW)(this.unique.runScene).coverSameId))return void(e.name!==this.map[s].model.name&&this.unique.runScene.optionsEx.log(`解析模型出错,${e.name} 与 ${this.map[s].model.name} 拥有相同的id,请选择任意一个模型导出并删除,并重新导入。`,"base","error"));s=(0,n.getId)(),e.userData.id=s}return this.map[s]={model:e,type:(0,u.getModelType)(e)},this.parseName(e),e.material&&(this.unique.runScene.materialEx.parse(e.material),this.unique.material.add(e.material,e)),!e.children.length||(0,c.RQ)(e)||(0,u.isHelper)(e)?s:this.add(e.children,t)}}get(e){return null==(e=this.map[e])?void 0:e.model}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=>{this.unique.runScene.cb.unique.model.remove.cb({model:e,parent:e.parent}),delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}findModelWithName(e){var t=Object.keys(this.nameMap).filter((t=>{const r=t.toLowerCase();return r===(t=e.toLowerCase())||-1!==r.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}getModelsByType(e){return o.F6.filter((0,n.mapObj)(this.map,((t,{model:r,type:n})=>n===e&&null!==r.parent?r:null)))}has(e){return!!this.map[e]}find(e){return o.F6.filter((0,n.mapObj)(this.map,((t,r)=>{if(e(r))return r.model})))}}var p=r(4098);class m{constructor(e){this.map={},this.onSetMaterial=e=>{var{target:e,type:t,oldVal:r,val:n,targetType:a}=e;r!==n&&(r&&(this.unlinkMaterial({target:e,type:t,texture:r}),this.unique.runScene.cb.unique.texture.setTimecited.cb({texture:r,length:Object.keys((null==(r=this.map[v(r)])?void 0:r.targets)||{}).length})),n&&(this.linkMaterial(n,{target:e,type:t,targetType:a}),this.unique.runScene.cb.unique.texture.setTimecited.cb({texture:n,length:Object.keys((null==(r=this.map[v(n)])?void 0:r.targets)||{}).length})))},this.setForSavedData=e=>{},this.unique=e,this.unique.runScene.cb.texture.setMaterial.add("unique-texture",this.onSetMaterial)}add(e){if(e&&e.userData){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,n.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,targets:{}},t)}}getLength(){return Object.keys(this.map).length}unlinkMaterial(e){var t,{target:e,type:r,texture:n}=e,n=n.userData.id||this.add(n);e=v(e);const a=null==(t=this.map[n].targets[e])?void 0:t.datas;a&&(a.delete(r),0===a.size&&delete this.map[n].targets[e])}linkMaterial(e,t){var r=e.userData.id||this.add(e),{target:t,type:n,targetType:i}=t;this.map[r]||(this.map[r]={targets:{},texture:e}),e=v(t),this.map[r].targets[e]||(this.map[r].targets[e]={type:i,datas:new a.Z});const s=this.map[r].targets[e].datas;s.add(n),"material"===i&&this.unique.runScene.cb.unique.material.setTimecited.cb({material:t,length:s.size})}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.targets}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));var t=this.map[e.userData.id];t&&((0,n.mapObj)(t.targets,((e,{datas:t,type:r})=>{if("scene"===r)t.map((e=>{this.unique.runScene.sceneEx.set(e,null)}));else{const r=this.unique.runScene.uniqueEx.material.get(e);r&&t.forEach((e=>{p.ZP.setTexture({material:r,type:e,texture:null})||(r[e]=null)}))}})),delete this.map[e.userData.id])}dispose(){(0,n.mapObj)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}getAll(e){return o.F6.filter((0,n.mapObj)(this.map,((t,r)=>void 0===e?r:(t=0<this.getTimeCitedLength(t),e?t&&r:!t&&r))))}clearUnUsed(){this.getAll(!1).map((({texture:e})=>{this.unique.runScene.textureEx.remove(e)}))}getTimeCitedLength(e){return(e=this.map[e])?Object.keys(e.targets).length:0}}var f=r(1549);class g{constructor(e){this.clean=()=>{this.dispose()},this.runScene=e,this.model=new h(this),this.material=new l(this),this.texture=new m(this),this.geometry=new f.Z(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 v=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||"",b=(e,t)=>{e.userData&&(e.userData.id=t)}},8716:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(6001);class a{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,n.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]=e,t)}get(e){return this.map[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}}},1549:(e,t,r)=>{r.d(t,{Z:()=>c});var n=r(6001),a=r(1794),i=r(272),s=r(2233),o=(t=r(8716),r(3263)),l=r(7995);class c extends t.Z{constructor(e){super(e),this.map=new a.Z,this.sameMap=new a.Z,this.onModelAdd=e=>{var t=(e=e.model).geometry;if(t){var r=this.getArr(t);if(r){var n=t.uuid,l=o.F6.toArr(e.material)[0],c=this.isSame({geometry:t,material:l});if(c){var u=c.geometry.uuid;let o=this.sameMap.get(u),d=(o||(o=new a.Z,this.sameMap.set(u,o)),o.get(n));d||(d={models:new i.Z,size:r.length,isSame:!0,geometry:t,material:l},o.set(n,d)),d.models.add((0,s.Ki)(e))}let d=this.map.get(n);return d||(d={models:new i.Z,size:r.length,isSame:void 0!==c,geometry:t,material:l},this.map.set(n,d),this.unique.runScene.cb.unique.geometry.add.cb({geometry:t})),d.models.add((0,s.Ki)(e)),n}}},this.clean=()=>{this.map.clear(),this.sameMap.clear()},this.init()}init(){this.unique.runScene.cb.unique.model.add.add("unique-geometry",this.onModelAdd),this.unique.runScene.cb.clean.add("unique-geometry",this.clean)}getArr(e){return null==(e=null==(e=e.attributes)?void 0:e.position)?void 0:e.array}isSame(e){const{geometry:t,material:r}=e;return this.map.toArray("value").find((e=>{if(t.uuid!==e.geometry.uuid&&!e.isSame&&(0,s.Ki)(r)===(0,s.Ki)(e.material)){e=this.getArr(e.geometry);var n=this.getArr(t);if(e&&n)return e.length===n.length}}))}getSize(e){let t=0;return(0,n.mapObj)(e.attributes,((e,r)=>{r=r.array,t+=(null==r?void 0:r.byteLength)||0})),t}getSameMapToMapModel(){const e={};return this.sameMap.map(((t,r)=>{const n=new i.Z,a=this.map.get(t);a&&n.add(a.models.toArray()),r.map(((e,{models:t})=>{n.add(t.toArray())})),n.size<2||(e[t]=n)})),e}processSame(e){e=e.stateMap;const t=[];(0,n.mapObj)(e,((e,{children:r})=>{let a={};const i=this.sameMap.get(e);if(i){(0,n.mapObj)(r,((e,{state:t,uuid:r})=>{void 0===a[r]&&(a[r]=t)}));const s=[],o=(i.map(((e,t)=>{!1===a[e]?this.map.set(e,t):s.push(...t.models.toArray())})),this.map.get(e));t.push({baseModels:this.unique.runScene.modelEx.getById(o.models.toArray()),mergeModels:this.unique.runScene.modelEx.getById(s)})}})),t.map((({baseModels:e,mergeModels:t})=>{e.length<1||0===t.length||this.unique.runScene.modelEx.setClonedModels(e[0],[...e,...t])}))}clearSame(){this.sameMap.clear()}}c.getCallBack=()=>({add:new l.Z,del:new l.Z})},5317:(e,t,r)=>{r.r(t),r.d(t,{HextoRgb:()=>a.I8,LimitCb:()=>a.cM,MyHextoRgb:()=>a.Dn,addElesFromIndexToArr:()=>a.Rn,angleToNum:()=>i.Zv,anima:()=>a.gY,arrayBufferToBase64:()=>a.sM,arrayBufferToBlobUr:()=>a.oo,arrayToVector3:()=>i.F,base64ToArrayBuffer:()=>a.RG,base64ToBlob:()=>a.Jr,bitMapToCanvas:()=>n.Rd,blobToFile:()=>a.hl,bufferToArrayBuffer:()=>a.cO,canvasToBlob:()=>a._c,changeModelOpc:()=>i.Hg,changeModelOpcs:()=>i.Z7,clone:()=>a.d9,closeNum:()=>a.nx,colorToRgb:()=>i.sS,compressImgToUrl:()=>n.jH,deepFindParentByUuid:()=>i.Q3,deepMergeObject:()=>a.U,disposeCanvas:()=>n.eZ,disposeImageBitMap:()=>n.oZ,domTo2Dui:()=>i.UZ,domTo3DSprite:()=>i.YG,domTo3Dui:()=>i.ol,fileAndBlobToCanvas:()=>a.OE,fileToBlob:()=>a.a_,filterFiles:()=>a.Rz,fromCode:()=>a.Ne,getArrIndexByItem:()=>a.B1,getBetweenByV3:()=>i.A2,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>i.Gm,getCenter:()=>i.qg,getClock:()=>i.aM,getColorByHex:()=>i.e9,getColorByHexStr:()=>i.ZD,getCurve:()=>i.kG,getDate:()=>a._3,getDefAndType:()=>i.ZE,getDiff:()=>a.ad,getDistance:()=>i.Sp,getDomChildrenByDom:()=>h,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>a.xl,getFilesFromFileList:()=>a.kk,getHexByColor:()=>i.J6,getIdxInParent:()=>o,getImg:()=>n.Pk,getImgByHdrTexture:()=>i.p1,getImgPixels:()=>n.BW,getImgPixels1:()=>n.Cm,getLine2:()=>i.SI,getMacro:()=>a.Ls,getMapByRgb:()=>a.fh,getMd5:()=>a.ZM,getModelByType:()=>i.Py,getModelMap:()=>i.yT,getNamesByNum:()=>a.nR,getOptions:()=>s.FW,getPointByProgress:()=>i.Mq,getProgress:()=>a.xC,getProxy:()=>a.Gy,getRGBByHex:()=>i.OR,getRandomColor:()=>a.mr,getRes:()=>a.sR,getResultFromCanvas:()=>n.xK,getThreeType:()=>i.ii,getTime:()=>a.hK,getTruthBase64:()=>a.Mh,getType:()=>a.oL,getTypeByBase64:()=>a.Op,getTypeFromGlb:()=>s.te,getVideoTexture:()=>i.hX,getWorldLocal:()=>i.VU,hslToRgb:()=>n.ve,imageToBlob:()=>n.$N,imgArrayBufferToBlobUrl:()=>n.lU,imgBitMapToBase64:()=>n.s4,imgBitMapToBlob:()=>n.gW,imgBitMapToBlobAndBase64:()=>n.v1,isBlob:()=>a.Lj,isDef:()=>a.Xq,isEditor:()=>s.hz,isEmpty:()=>a.xb,isRunning:()=>s.An,isVisible:()=>i.pn,longestCommonPrefix:()=>a.GG,mapDom:()=>d,mergeObject:()=>a.Gm,percentageStrToNum:()=>a.zz,removeLastDot:()=>a.dx,removeUnLess:()=>i.hs,resetCenter:()=>i.cm,reverseImageBitMap:()=>n.Fs,reverseImg:()=>n.rx,reverseTextureForImageBit:()=>i._r,rgbToHex:()=>i.vq,rgbToHsl:()=>n.lC,rgbToStr:()=>i.$W,rgbaToRgb:()=>i.Di,rmArrEle:()=>a.J9,rmPartOfString:()=>a.h3,sameArr:()=>a.F1,sameV3:()=>i.x$,setDisplayForDom:()=>p,setParentVisible:()=>i.FT,setVal:()=>i.Y6,strCompress:()=>a.Uf,strToNum:()=>a.LC,tColorToRgb:()=>i.Lv,textureToThreeD:()=>i.vp,theKey:()=>a.rv,toCode:()=>a.Ni,toInt:()=>a.Hq,toTimeString:()=>a.U9,transByte:()=>a.iM,typeAnima:()=>u,urlToBlob:()=>a.pX,urlToCanvas:()=>a.o4,v3ToMap:()=>i.ln,validType:()=>a.lG,vector:()=>i.xr});var n=r(5137),a=r(6272),i=r(8089),s=r(158);const o=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:r}=e;return[...e.children].slice(t,r+1)};var c=r(8881);const u=(e,t,r)=>{const{}=r||{},n={},i={};e.map(((e,t)=>{const{begin:r,end:s,type:o,label:l}=e,u="_"+o+"_"+l+"_"+String(t);if("color"===o&&r instanceof c.Color&&s instanceof c.Color){const e=(0,a.I8)("#"+r.getHexString(),!0),t=(0,a.I8)("#"+s.getHexString(),!0);["r","g","b"].map((r=>{var a=r+u;n[a]=e[r],i[a]=t[r]}))}"number"===o&&(n[e=l+u]=r,i[e]=s),"vector3"===o&&["x","y","z"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]})),"vector2"===o&&["x","y"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]}))}))},d=(u([{begin:new c.Color(.5,.5,.5),end:new c.Color(0,0,0),label:"color",type:"color"},{begin:1,end:2,label:"a",type:"number"},{begin:new c.Vector3(1,1,1),end:new c.Vector3(2,2,2),label:"b",type:"vector3"},{begin:new c.Vector2(1,1),end:new c.Vector2(2,2),label:"c",type:"vector2"}],1),(e,t)=>[...e.childNodes].map((e=>t(e)))),h=(e,t)=>t?[...e.childNodes]:[...e.children],p=(e,t)=>{var r;t=t?"block":"none",(null==(r=e.style)?void 0:r.display)!==t&&(e.style.display=t)}},5137:(e,t,r)=>{r.d(t,{$N:()=>c,BW:()=>f,Cm:()=>m,Fs:()=>w,Pk:()=>y,Rd:()=>g,eZ:()=>S,gW:()=>l,jH:()=>p,lC:()=>v,lU:()=>h,mH:()=>T,oZ:()=>M,rx:()=>u,s4:()=>o,v1:()=>d,ve:()=>b,xK:()=>x});var n=r(6292),a=r(9667),i=r(6272),s=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const o=e=>{const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),t.toDataURL()},l=e=>s(void 0,void 0,void 0,(function*(){if(!e)return new Blob([]);const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),c=e=>s(void 0,void 0,void 0,(function*(){const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),u=e=>{const t=document.createElement("canvas"),r=(t.width=e.width,t.height=e.height,t.getContext("2d"));r.translate(0,t.height),r.scale(1,-1),r.drawImage(e,0,0,t.width,t.height)},d=e=>s(void 0,void 0,void 0,(function*(){var t=e.image;const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d")),i=(0,a.getMimeByTexture)(e);return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(i)})}),i)}))})),h=(e,t)=>URL.createObjectURL(new Blob([e],t)),p=(e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d");return r.width=e.width,r.height=e.height,n.drawImage(e,0,0,e.width,e.height),new Promise((e=>{r.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},m=e=>s(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:a,canvas:s}=yield(0,i.OE)(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height});for(var o=a.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),l=0,c=o.data.length;l<c;l+=4){var u=(h=v(o.data[l],o.data[l+1],o.data[l+2]))[0]/100,d=h[1]/100,h=h[2]/100;u=b(u,d,h),o.data[l]=u[0],o.data[l+1]=u[1],o.data[l+2]=u[2]}return a.putImageData(o,0,0),new n.Z.Texture(s)})),f=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=g(e).ctx.getImageData(0,0,t,r).data,a=[],i=0;i<n/4;i+=1)a.push(n.slice(4*i,4*(i+1)))},g=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},v=(e,t,r)=>{e/=255,t/=255,r/=255;var n,a=Math.max(e,t,r),i=Math.min(e,t,r),s=(a+i)/2;if(a==i)n=l=0;else{var o=a-i,l=.5<s?o/(2-a-i):o/(a+i);switch(a){case e:n=(t-r)/o+(t<r?6:0);break;case t:n=(r-e)/o+2;break;case r:n=(e-t)/o+4}n/=6}return[100*n,100*l,100*s]},b=(e,t,r)=>{var n,a,i,s;return 0==t?a=i=s=r:(a=(n=function(e,t,r){return r<0&&(r+=1),1<r&&--r,r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e})(t=2*r-(r=r<.5?r*(1+t):r+t-r*t),r,e+1/3),i=n(t,r,e),s=n(t,r,e-1/3)),[255*a,255*i,255*s]},y=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))},x=(e,t,r)=>{const n=(0,i.Gm)({base64Type:"webp"},r).base64Type;return new Promise(((r,a)=>{"blob"===t?e.toBlob((e=>{(e?r:a)(e)})):"base64"===t&&r(e.toDataURL("image/"+n))}))},w=e=>s(void 0,void 0,void 0,(function*(){var{width:t,height:r}=e;const n=document.createElement("canvas"),a=(n.width=t,n.height=r,n.getContext("2d"));if(a)return a.translate(0,r),a.scale(1,-1),a.drawImage(e,0,0,t,r),{imageBitMap:yield createImageBitmap(a.getImageData(0,0,t,r)),canvas:n}})),S=e=>{e.remove()},M=e=>{e.close()},T=e=>{var{width:e,height:t}=e;const r=document.createElement("canvas");return(r.width=e,r.height=t,r.getContext("2d")).drawImage(new Image,0,0),r}},6272:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,Dn:()=>MyHextoRgb,F1:()=>sameArr,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,Gy:()=>getProxy,Hq:()=>toInt,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,Uf:()=>strCompress,Xq:()=>isDef,ZM:()=>getMd5,_3:()=>getDate,_c:()=>canvasToBlob,a_:()=>fileToBlob,ad:()=>getDiff,cM:()=>LimitCb,cO:()=>bufferToArrayBuffer,d9:()=>clone,dx:()=>removeLastDot,fh:()=>getMapByRgb,gY:()=>anima,h3:()=>rmPartOfString,hK:()=>getTime,hl:()=>blobToFile,iM:()=>transByte,kk:()=>getFilesFromFileList,lG:()=>validType,mr:()=>getRandomColor,nR:()=>getNamesByNum,nx:()=>closeNum,o4:()=>urlToCanvas,oL:()=>getType,oo:()=>arrayBufferToBlobUr,pX:()=>urlToBlob,rv:()=>theKey,sM:()=>arrayBufferToBase64,sR:()=>getRes,xC:()=>getProgress,xb:()=>isEmpty,xl:()=>getFilesByDataTransfer,zz:()=>percentageStrToNum});var _allex_md5__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1129),_allex_md5__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_allex_md5__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3300),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),js_funcs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6001),js_funcs__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_2__),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2958),_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(3263),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5137),__awaiter=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const anima=(e,t,r,n,a)=>{let i=Object.assign({},e),s=new _libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3(i,r,t).eventCallback("onUpdate",(e=>n&&n(i))).eventCallback("onComplete",(e=>{a&&a(),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3.killTweensOf(s)}));return s},base64ToArrayBuffer=e=>__awaiter(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=getTruthBase64(e));const t=window.atob(e);var r=t.length;const n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var r=new Uint8Array(e);for(let e=0,n=r.byteLength;e<n;e++)t+=String.fromCharCode(r[e]);return"data:image/jpg;base64,"+window.btoa(t)},urlToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return(yield axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:"blob"})).data})),base64ToBlob=e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=atob(t[1]),a=n.length,i=new Uint8Array(a);for(;a--;)i[a]=n.charCodeAt(a);return new Blob([i],{type:r})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.parseFile)(e,"base64"))})),blobToFile=(e,t)=>new File([e],t),getTypeByBase64=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),transByte=e=>{let t="";const r=t=e<102.4?e.toFixed(2)+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"M":(e/1073741824).toFixed(2)+"G";return e=r.indexOf("."),"00"==r.substr(e+1,2)?r.substring(0,e)+r.substr(e+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:r}=t;let n=new Image,a=(n.src=e,n.width=t,n.height=r,document.createElement("canvas")),i=(a.width=t,a.height=r,a.getContext("2d"));return new Promise((e=>{n.onload=function(){i.drawImage(n,0,0,a.width,a.height),e({canvas:a,ctx:i})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),canvasToBlob=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),getRes=(e,t)=>axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),mergeObject=(e,t)=>Object.assign(e,t||{}),getMacro=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},clone=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]=r);return n},getNamesByNum=(e,t,r=1,n)=>new Array(t).fill("").map(((t,a)=>e+(a+r)+(n||""))),getType=e=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((r,n)=>{let a=t[r];void 0!==a&&("Object"===getType(n)&&"Object"===getType(a)&&(a=deepMergeObject(n,a)),e[r]=a)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_5__.Pk)(e);const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d"));return n.drawImage(t,0,0),{img:t,canvas:r,ctx:n}})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},isEmpty=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0),isBlob=e=>e&&e instanceof Blob,getTime=e=>{const t=new Date;return t.setTime(t.getTime()+864e5*e),t.getTime()},theKey="gltf-version-2.0",toCode=e=>{for(var t,r,n=theKey.length,a=theKey.split(""),i="",s=0;s<e.length;s++)i+=a[((r=((r=e.charCodeAt(s))-(t=r%n))/n)-(r%=n))/n%n]+a[r]+a[t];return i},fromCode=str=>{for(var st=theKey.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=theKey.indexOf(str.charAt(d)),d++,b2=theKey.indexOf(str.charAt(d)),d++,b3=theKey.indexOf(str.charAt(d)),d++,s[i]=b1*st*st+b2*st+b3;return b=eval("String.fromCharCode("+s.join(",")+")"),b},getFilesFromFileList=e=>{const t=[];for(let n=0;n<e.length;n++){var r=e.item(n);t.push(r)}return t},filterFiles=(e,t)=>"any"===t?e:e.filter((e=>-1!==e.type.indexOf(t))),toTimeString=e=>{if(e)return e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()},rmPartOfString=(e,t)=>e.replace(new RegExp(t),""),rmArrEle=(e,t)=>{var r=e.findIndex((e=>e===t));if(-1!==r)return e.splice(r,1),r},addElesFromIndexToArr=(e,t,r)=>(t=Array.isArray(t)?t:[t],e.splice(r,0,...t)),sameArr=(e,t,r)=>{if("fill"===r){for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var n=e.length;const a=Math.floor(n/r),i=new Array(r).fill("").map(((e,t)=>(t+1)*a));i.push(0),i.push(n-1);for(const r of i)if(e[r]!==t[r])return!1;return!0};class LimitCb{constructor(){this.timer=0}update(e){const{cb:t,now:r,cbRate:n}=e;this.timer+=r,this.timer>n&&(t(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],r="",n=1;n<e.length;n++){for(var a=0;a<=e[n].length;a++){if(t[a]!=e[n][a]){t=r;break}r+=t[a]}r=""}return t},getRandomColor=()=>{let e=[];for(let t=0;t<3;++t){let t=Math.floor(256*Math.random()).toString(16);t=1==t.length?"0"+t:t,e.push(t)}return"#"+e.join("")},validType=(e,t)=>{var r;return"number"===t?(r=Number(e),!isNaN(r)):"array"===t?Array.isArray(e):void 0},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.F6.isDef(e,t):_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(e)&&_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(t)?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.isDef(e,t):e!==t,strToNum=e=>{if(e=e.replace(/[^\d]/g,""),e=Number(e),isNaN(e))throw TypeError("类型错误");return e},rgbArr=["r","g","b"],getMapByRgb=e=>{var t=e.split(",");const r={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var n=rgbArr[e],a=t[e];if(!a)return;a=strToNum(a),r[n]=a}return r};function HextoRgb(e,t){if(-1!==e.toLocaleLowerCase().indexOf("rgb"))return e;if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){if(4===e.length){for(var r="#",n=1;n<4;n+=1)r+=e.slice(n,n+1).concat(e.slice(n,n+1));e=r}var a,i,s=[];for(n=1;n<7;n+=2)s.push(parseInt("0x"+e.slice(n,n+2)));return t?([t,a,i]=s,{r:t,g:a,b:i}):"RGB("+s.join(",")+")"}return e}const getDiff=(e,t,r=0)=>{const n={};return t?((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,r)=>{var a=t[e];isDef(r,a)&&(n[e]=a)})),n):e};function MyHextoRgb(e,t){if(-1!==(e=e.toLocaleLowerCase().slice(1)).indexOf("rgb"))return e;var[e,r,n,a,i,s]=e.split(""),r=(e=parseInt("0x"+e+r),parseInt("0x"+n+a)),n=parseInt("0x"+i+s);return t?{r:e,g:r,b:n}:"RGB("+e+","+r+","+n+")"}const getDate=e=>{const t=new Date(e);return t.getFullYear()+"/"+String(t.getMonth()+1).padStart(2,"0")+"/"+String(t.getDate()).padStart(2,"0")},percentageStrToNum=e=>(e=Number(e.replace(/%/,"")),isNaN(e)?-1:.01*e),toInt=e=>parseInt(String(e)),closeNum=(e,t,r)=>e<t+r&&t-r<e,strCompress={encrypt:e=>{if(""==e)return"";let t=theKey;if(e=encodeURIComponent(e),""==(t=encodeURIComponent(t))||t.length<=0)return"";for(var r="",n=0,a=t.length;n<a;n+=1)r+=t.charCodeAt(n).toString();var i=Math.floor(r.length/5),s=parseInt(r.charAt(i)+r.charAt(2*i)+r.charAt(3*i)+r.charAt(4*i)+r.charAt(5*i)),o=Math.ceil(t.length/2),l=Math.pow(2,31)-1;if(s<2)return"";var c=Math.round(1e9*Math.random())%1e8;for(r+=c;10<r.length;)r=(parseInt(r.substring(0,10))+parseInt(r.substring(10,r.length))).toString();r=(s*r+o)%l;var u="",d="";for(n=0,a=e.length;n<a;n+=1)d+=(u=parseInt(String(e.charCodeAt(n)^Math.floor(r/l*255))))<16?"0"+u.toString(16):u.toString(16),r=(s*r+o)%l;for(c=c.toString(16);c.length<8;)c="0"+c;return d+c},decrypt:e=>{if(""==e)return"";let t=theKey;if(t=encodeURIComponent(t),null==e||e.length<8)return"";if(null==t||t.length<=0)return"";for(var r="",n=0,a=t.length;n<a;n+=1)r+=t.charCodeAt(n).toString();var i=Math.floor(r.length/5),s=parseInt(r.charAt(i)+r.charAt(2*i)+r.charAt(3*i)+r.charAt(4*i)+r.charAt(5*i)),o=Math.round(t.length/2),l=Math.pow(2,31)-1;for(i=parseInt(e.substring(e.length-8,e.length),16),e=e.substring(0,e.length-8),r+=i;10<r.length;)r=(parseInt(r.substring(0,10))+parseInt(r.substring(10,r.length))).toString();r=(s*r+o)%l;var c,u="";for(n=0,a=e.length;n<a;n+=2)c=parseInt(String(parseInt(e.substring(n,n+2),16)^Math.floor(r/l*255))),u+=String.fromCharCode(c),r=(s*r+o)%l;return decodeURIComponent(u)}},removeLastDot=e=>{const t=e.split(".");return 1<t.length&&t.pop(),t.join(".")},getProxy=e=>new Proxy(e,{set:(e,t,r)=>(e[t]=r,console.log(e,t,r,"a,b,c"),!0)})},158:(e,t,r)=>{r.d(t,{An:()=>i,FW:()=>s,hz:()=>a,te:()=>n});const n=e=>{},a=e=>"editor"===e.optionsEx.options.mode,i=e=>"running"===e.optionsEx.options.mode,s=e=>e.optionsEx.options},8089:(e,t,r)=>{r.d(t,{Zv:()=>pe,F:()=>de,Hg:()=>ie,Z7:()=>se,sS:()=>_e,Q3:()=>Ce,UZ:()=>ne,YG:()=>ae,ol:()=>re,A2:()=>ge,Gm:()=>fe,qg:()=>Pe,aM:()=>ve,e9:()=>be,ZD:()=>ye,kG:()=>ue,ZE:()=>Ve,Sp:()=>te,J6:()=>xe,p1:()=>Ne,SI:()=>he,Py:()=>Ae,yT:()=>me,Mq:()=>He,OR:()=>we,ii:()=>Fe,hX:()=>ce,VU:()=>$,pn:()=>Re,hs:()=>le,cm:()=>Ie,_r:()=>ze,vq:()=>De,$W:()=>Me,Di:()=>Ee,x$:()=>Se,FT:()=>Le,Y6:()=>Ge,Lv:()=>Te,vp:()=>oe,ln:()=>Oe,xr:()=>ee});var n=r(6001),a=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=new a.Box3,u=new a.Vector3,d=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(n);function n(){var e;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(e=r.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new a.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 a.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=n,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new a.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new a.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new a.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 a.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new a.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new a.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 a.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new a.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),c.setFromBufferAttribute(t),this.boundingBox.union(c))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new a.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var r=this.boundingSphere.center,n=(this.boundingBox.getCenter(r),0),i=0,s=e.count;i<s;i++)u.fromBufferAttribute(e,i),n=Math.max(n,r.distanceToSquared(u)),u.fromBufferAttribute(t,i),n=Math.max(n,r.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.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 p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(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)}a.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new a.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},a.ShaderLib.line={uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.fog,a.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 g=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(r=t?(r=f(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===h(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return m(n)}}(n);function n(e){var t;if(this instanceof n)return(t=r.call(this,{type:"LineMaterial",uniforms:a.UniformsUtils.clone(a.ShaderLib.line.uniforms),vertexShader:a.ShaderLib.line.vertexShader,fragmentShader:a.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(m(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=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(a.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 b(e,t){return(b=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)}var x,w,S=new a.Vector3,M=new a.Vector3,T=new a.Vector4,_=new a.Vector4,E=new a.Vector4,D=new a.Vector3,O=new a.Matrix4,P=new a.Line3,k=new a.Vector3,A=new a.Box3,C=new a.Sphere,L=new a.Vector4;function R(e,t,r){return L.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),L.multiplyScalar(1/L.w),L.x=w/r.width,L.y=w/r.height,L.applyMatrix4(e.projectionMatrixInverse),L.multiplyScalar(1/L.w),Math.abs(Math.max(L.x,L.y))}var I=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=y(e);if(r=t?(r=y(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new d,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new g({color:16777215*Math.random()}),a=this,i=n;if(a instanceof i)return(a=r.call(this,e,t)).isLineSegments2=!0,a.type="LineSegments2",a;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,n=new Float32Array(2*t.count),i=0,s=0,o=t.count;i<o;i++,s+=2)S.fromBufferAttribute(t,i),M.fromBufferAttribute(r,i),n[s]=0===s?0:n[s-1],n[s+1]=n[s]+S.distanceTo(M);var l=new a.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new a.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new a.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var r=this.material.worldUnits,n=e.camera,i=(null!==n||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),s=(x=e.ray,e=this.matrixWorld,this.geometry),o=this.material;if(w=o.linewidth+i,null===s.boundingSphere&&s.computeBoundingSphere(),C.copy(s.boundingSphere).applyMatrix4(e),i=r?.5*w:R(n,Math.max(n.near,C.distanceToPoint(x.origin)),o.resolution),C.radius+=i,!1!==x.intersectsSphere(C)&&(null===s.boundingBox&&s.computeBoundingBox(),A.copy(s.boundingBox).applyMatrix4(e),i=r?.5*w:R(n,Math.max(n.near,A.distanceToPoint(x.origin)),o.resolution),A.expandByScalar(i),!1!==x.intersectsBox(A)))if(r)for(var l=this,c=t,u=l.matrixWorld,d=(s=l.geometry).attributes.instanceStart,h=s.attributes.instanceEnd,p=0,m=Math.min(s.instanceCount,d.count);p<m;p++){P.start.fromBufferAttribute(d,p),P.end.fromBufferAttribute(h,p),P.applyMatrix4(u);var f=new a.Vector3,g=new a.Vector3;x.distanceSqToSegment(P.start,P.end,g,f),g.distanceTo(f)<.5*w&&c.push({point:g,pointOnLine:f,distance:x.origin.distanceTo(g),object:l,face:null,faceIndex:p,uv:null,uv2:null})}else{var v=this,b=t,y=(e=n).projectionMatrix,S=v.material.resolution,M=v.matrixWorld,L=(o=v.geometry).attributes.instanceStart,I=o.attributes.instanceEnd,B=(o=Math.min(o.instanceCount,L.count),-e.near);x.at(1,E),E.w=1,E.applyMatrix4(e.matrixWorldInverse),E.applyMatrix4(y),E.multiplyScalar(1/E.w),E.x*=S.x/2,E.y*=S.y/2,E.z=0,D.copy(E),O.multiplyMatrices(e.matrixWorldInverse,M);for(var U,j,N,z,F=0,V=o;F<V;F++)T.fromBufferAttribute(L,F),_.fromBufferAttribute(I,F),T.w=1,_.w=1,T.applyMatrix4(O),_.applyMatrix4(O),T.z>B&&_.z>B||(T.z>B?(U=T.z-_.z,U=(T.z-B)/U,T.lerp(_,U)):_.z>B&&(U=_.z-T.z,j=(_.z-B)/U,_.lerp(T,j)),T.applyMatrix4(y),_.applyMatrix4(y),T.multiplyScalar(1/T.w),_.multiplyScalar(1/_.w),T.x*=S.x/2,T.y*=S.y/2,_.x*=S.x/2,_.y*=S.y/2,P.start.copy(T),P.start.z=0,P.end.copy(_),P.end.z=0,j=P.closestPointToPointParameter(D,!0),P.at(j,k),N=-1<=(N=a.MathUtils.lerp(T.z,_.z,j))&&N<=1,z=D.distanceTo(k)<.5*w,N&&z&&(P.start.fromBufferAttribute(L,F),P.end.fromBufferAttribute(I,F),P.start.applyMatrix4(M),P.end.applyMatrix4(M),N=new a.Vector3,z=new a.Vector3,x.distanceSqToSegment(P.start,P.end,z,N),b.push({point:z,pointOnLine:N,distance:x.origin.distanceTo(z),object:v,face:null,faceIndex:F,uv:null,uv2:null})))}}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.Mesh);function B(e){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=N(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function j(e,t){return(j=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)}var z=function(){var e=n,t=d;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&&j(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=N(e);if(r=t?(r=N(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===B(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(this instanceof n)return(e=r.call(this)).isLineGeometry=!0,e.type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return U(N(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return U(N(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function 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 V(e,t){return(V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var H=function(){var e=n,t=I;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&&V(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=G(e);if(r=t?(r=G(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===F(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new z,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new g({color:16777215*Math.random()}),a=this,i=n;if(a instanceof i)return(a=r.call(this,e,t)).isLine2=!0,a.type="Line2",a;throw new TypeError("Cannot call a class as a function")}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),Z=r(699),W=r(3693),K=r(3263),q=(t=r(6292),r(135)),X=r(6272);const Y={uniforms:{uSeaFreq:{value:.16},uSeaHeight:{value:.6},uSeaChoppy:{value:4},uTime:{value:0},uCamPosition:{value:new a.Vector3(0,0,0)},uDirection:{value:null}},vertexShader:"\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n void main() {\n vec4 pos = vec4(position, 1.0);\n //模型空间坐标,z轴是高度,xy轴是平面\n vUv = pos.xy * 1.0;\n pos.z += getWave(vUv) * 1.0;\n vPosition = vec3(pos.x, pos.z, pos.y);\n vWorldPos = (modelMatrix * pos).xyz;\n \n gl_Position = projectionMatrix * modelViewMatrix * pos;\n }\n ",fragmentShader:"\n #define PI 3.14159265359\n #define invPI 0.3183098861837697\n #define invTWO_PI 0.15915494309\n \n const vec3 SEA_BASE = vec3(0.1, 0.19, 0.22);\n const vec3 SEA_WATER_COLOR = vec3(0.8, 0.9, 0.6);\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n uniform vec3 uCamPosition;\n uniform vec3 uDirection;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n // Math\n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n // Lighting\n float diffuse(vec3 n, vec3 l, float p) {\n return pow(dot(n, l) * 0.4 + 0.6, p);\n }\n float specular(vec3 n,vec3 l,vec3 e,float s) {\n float nrm = (s + 8.0) / (PI * 8.0);\n return pow(max(dot(reflect(e, n), l), 0.0), s) * nrm;\n }\n \n // Sky\n vec3 getSkyColor(vec3 e) {\n e.y = (max(e.y, 0.0) * 0.8 + 0.2) * 0.8;\n return vec3(pow(1.0 - e.y, 2.0), 1.0 - e.y, 0.6 + (1.0 - e.y) * 0.45) * 0.45;\n }\n \n // Sea\n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float map_detailed(vec3 p) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n vec2 uv = p.xz;\n uv.x *= 0.75;\n \n float d, h = 0.0;\n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n return p.y - h;\n }\n vec3 getSeaColor(vec3 p, vec3 n, vec3 l, vec3 eye, vec3 dist) {\n float fresnel = clamp(1.0 - dot(n, -eye), 0.0, 1.0);\n fresnel = pow(fresnel, 3.0) * 0.5;\n \n vec3 reflected = getSkyColor(reflect(eye, n));\n vec3 refracted = SEA_BASE + diffuse(n, l, 80.0) * SEA_WATER_COLOR * 0.12;\n \n vec3 color = mix(refracted, reflected, fresnel);\n \n float attenuation = max(1.0 - dot(dist, dist) * 0.001, 0.0);\n color += SEA_WATER_COLOR * (p.y - uSeaHeight) * 0.18 * attenuation;\n color += vec3(specular(n, l, eye, 60.0));\n \n return color;\n }\n \n // Sea Wave\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n // Tracing\n vec3 getNormal(vec3 p, float eps) {\n vec3 n;\n n.y = map_detailed(p);\n n.x = map_detailed(vec3(p.x + eps, p.y, p.z)) - n.y;\n n.z = map_detailed(vec3(p.x, p.y, p.z + eps)) - n.y;\n n.y = eps;\n return normalize(n);\n }\n \n void main() {\n vec3 light = normalize(vec3(0.0, 1.0, 0.8));\n vec3 dist = vWorldPos - uCamPosition;\n vec3 dir = normalize(dist);\n \n // 此数值控制生成水面法线的范围, 数值与范围成反比\n float EPSILON_NRM = 0.00003;\n vec3 N = getNormal(vWorldPos, dot(dist, dist) * EPSILON_NRM);\n vec3 color = getSeaColor(vWorldPos, N, light, dir, dist);\n \n // gl_FragColor = vec4(vPosition, 1.0);\n // gl_FragColor = vec4(vWorldPos, 1.0);\n // gl_FragColor = vec4(normalize(N), 1.0);\n gl_FragColor = vec4(pow(color, vec3(0.75)), 1.0);\n }\n "};var Q=r(2233);const J=t.Z,$=(e,t)=>(t.updateMatrixWorld(!0),t=new J.Vector3,e.getWorldPosition(t),t),ee={parse(e){var{x:e,y:t,z:r}=e;return void 0===r?new a.Vector2(e,t):new a.Vector3(e,t,r)},toJSON(e){var{x:e,y:t,z:r}=e;return null==r?{x:e,y:t}:{x:e,y:t,z:r}}},te=(e,t)=>e.distanceTo(t),re=e=>new W.cp(e),ne=e=>new Z.j(e),ae=e=>new W.P7(e),ie=(e,t=.5,r=!1)=>{if("Group"===e.type)throw TypeError("该模型为Group类型");if(!e.material)throw TypeError("该模型没有材质");if(void 0===e.material.oldOpc&&(e.material.oldOpc=e.material.opacity,e.material.oldTransparent=e.material.transparent),r)return e.material.opacity=e.material.oldOpc,void(e.material.transparent=e.material.oldTransparent);1===t?(e.material.transparent=!1,e.material.opacity=1):(e.material.transparent=!0,e.material.opacity=t)},se=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>se(e,t,r))):ie(e,t,r)},oe=e=>(e.mapping=a.EquirectangularReflectionMapping,e),le=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},ce=(e,t)=>{let r=document.createElement("video");return r.style="position:absolute;top:0;left:0;z-index:1000000;",r.src=e,r.loop="loop",r.muted="muted",r.play(),t.appendChild(r),new a.VideoTexture(r)},ue=(e,t)=>{let r=new a.CatmullRomCurve3(e,(null==t?void 0:t.closed)||!1),n=new a.BufferGeometry;e=r.getSpacedPoints(100),n.setFromPoints(e),e=new a.LineBasicMaterial({color:26214});let i=new a.Line(n,e);return i.visible=(null==t?void 0:t.showLine)||!1,{line:i,curve:r}},de=e=>{let t=0;const r=[],n={},i={0:"x",1:"y",2:"z"};return e.map((e=>{var s,o,l;3===t&&(t=0,({x:s,y:o,z:l}=n),r.push(new a.Vector3(s,o,l))),n[i[t]]=e,t++})),r},he=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:n}=e;const i=new z,s=(i.setPositions(e),t||new g({transparent:!0,side:a.DoubleSide,linewidth:r||5,vertexColors:!0})),o=(i.setColors(n||[1,1,1]),s.resolution.set(window.innerWidth,window.innerHeight),new H(i,s));return o.name="gw",o.computeLineDistances(),o},pe=e=>3.1415926*e/180,me=(e,t="name",r)=>{const n={};return e.traverse((e=>{"id"===t?n[e.userData.id]=e:n[e[t]]=e,null!=r&&r(e)})),n},fe=(e,t,r,n,a,i)=>({cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}),ge=(e,t)=>{var{x:e,y:r,z:n}=e,{x:t,y:a,z:i}=t;return{x:e-t,y:r-a,z:n-i}},ve=()=>new J.Clock,be=e=>{var{r:e,g:t,b:r}=(0,X.fh)((0,X.I8)(e.includes("#")?e:"#"+e));return new J.Color(e,t,r)},ye=e=>new J.Color(e.includes("#")?e:"#"+e),xe=e=>"#"+e.getHexString(),we=e=>e.r?e:(0,X.fh)((0,X.I8)(e.includes("#")?e:"#"+e)),Se=(e,t)=>e.x===t.x&&e.y===t.y&&e.z===t.z,Me=e=>{const{r:t,g:r,b:n}=e;return"rgb("+[t,r,n].map((e=>1<e?e:255*e)).join(",")+")"},Te=e=>{var{r:e,g:t,b:r}=e;return{r:e,g:t,b:r}},_e=e=>{let t=e;return(0,q.isColor)(e)?t=Te(e):K.YD.is(e)||(t=(0,X.I8)(e,!0)),t},Ee=e=>-1===e.toLocaleLowerCase().indexOf("rgba")?e:e.replace(/[a]/,"").split(",").slice(0,-1)+")",De=e=>{if(-1!==(e=e.toLocaleLowerCase()).indexOf("#"))return e;if(e=Ee(e),/^(rgb|RGB)/.test(e)){for(var t="#",r=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),n=0;n<r.length;n++){var a=Number(r[n]).toString(16);"0"===a&&(a+=a),t+=a}return t}return String(e)},Oe=e=>{var{x:e,y:t,z:r}=e;return{x:e,y:t,z:r}},Pe=e=>(new a.Box3).expandByObject(e).getCenter(e),ke={water(e){var t=new J.PlaneBufferGeometry(256,256,127,127);const r=new a.ShaderMaterial({name:"WaterMaterial",uniforms:Y.uniforms,vertexShader:Y.vertexShader,fragmentShader:Y.fragmentShader}),n=new a.Mesh(t,r),i=(n.rotateX(-.5*Math.PI),new a.Clock);return setInterval((()=>{r.uniforms.uTime.value+=i.getDelta(),r.uniforms.uCamPosition.value=e.position}),16.6),n}},Ae=(e,t)=>{let r,n;switch(e){case"Group":r=new J.Group;break;case"Box":n=new J.BoxBufferGeometry(1,1,1,1,1,1),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Circle":n=new J.CircleBufferGeometry(1,8,0,2*Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Cylinder":n=new J.CylinderBufferGeometry(1,1,1,8,1,!1,0,2*Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Dodecahedron":n=new J.DodecahedronBufferGeometry(1,0),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Icosahedron":n=new J.IcosahedronBufferGeometry(1,0),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Lathe":var i=[new J.Vector2(0,0),new J.Vector2(.4,0),new J.Vector2(.35,.05),new J.Vector2(.1,.075),new J.Vector2(.08,.1),new J.Vector2(.08,.4),new J.Vector2(.1,.42),new J.Vector2(.14,.48),new J.Vector2(.2,.5),new J.Vector2(.25,.54),new J.Vector2(.3,1.2)];n=new J.LatheBufferGeometry(i,12,0,2*Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial({side:J.DoubleSide}));break;case"Octahedron":n=new J.OctahedronBufferGeometry(1,0),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Plane":n=new J.PlaneBufferGeometry(1,1,1,1),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Ring":n=new J.RingBufferGeometry(.5,1,8,1,0,2*Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Sphere":n=new J.SphereBufferGeometry(1,8,6,0,2*Math.PI,0,Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Sprite":r=new J.Sprite(new J.SpriteMaterial);break;case"Tetrahedron":n=new J.TetrahedronBufferGeometry(1,0),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Torus":n=new J.TorusBufferGeometry(1,.4,8,6,2*Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"TorusKnot":n=new J.TorusKnotBufferGeometry(1,.4,64,8,2,3),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Tube":i=new J.CatmullRomCurve3([new J.Vector3(2,2,-2),new J.Vector3(2,-2,-.6666666666666667),new J.Vector3(-2,-2,.6666666666666667),new J.Vector3(-2,2,2)]),n=new J.TubeBufferGeometry(i,64,1,8,!1),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"water":r=ke.water(t?t.camera:{position:new a.Vector3})}if(r)return r.name=e,r},Ce=(()=>{const e=(t,r)=>!!(t=t.parent)&&"Scene"!==t.type&&(t.uuid===r?t:e(t,r));return(t,r)=>{if(t&&r)return e(t,r)}})(),Le=(()=>{const e=(t,r)=>t.parent&&"Scene"!==t.parent.type?(t.parent.visible!==r&&(t.parent.visible=r),e(t.parent,r)):null;return(t,r)=>t?e(t,r):null})(),Re=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&Re(e.parent),Ie=(e,t=!1)=>{var[r,n,i]=e.geometry.attributes.position.array,[s,o,l]=(e.geometry.center(),e.geometry.attributes.position.array),{x:c,y:u,z:d}=e.position,c=new a.Vector3(c-(s-r),u-(o-n),d-(l-i));return t&&e.position.copy(c),c};let Be,Ue,je;const Ne=e=>{void 0===Be&&((Be=new J.WebGLRenderer).outputEncoding=J.sRGBEncoding,Ue=new J.Scene,je=new J.OrthographicCamera(-1,1,1,-1,0,1));var t=e.image,r=new J.PlaneGeometry(2,2);return e=new J.MeshBasicMaterial({map:e}),r=new J.Mesh(r,e),Ue.add(r),Be.setSize(t.width,t.height,!1),Be.render(Ue,je),Be.domElement},ze=e=>function(e,t,r,n){return new(r=r||Promise)((function(e,t){function a(e){try{s(n.next(e))}catch(e){t(e)}}function i(e){try{s(n.throw(e))}catch(e){t(e)}}function s(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r((function(e){e(n)}))).then(a,i)}s((n=n.apply(undefined,[])).next())}))}(0,0,void 0,(function*(){})),Fe=e=>{var t=typeof e;let r="null";return null===e?"null":void 0===e?"undefined":(e.isColor?r="color":e.isTexture?r="texture":e.isVector2?r="vector2":e.isVector3?r="vector3":Array.isArray(e)?r="array":(0,n.isNumber)(e)?r="number":"string"==t?r="string":"boolean"==t?r="boolean":"object"==t&&(r=null===t?"null":Array.isArray(t)?"array":"object"),r)},Ve=(e,t)=>{var r,n,a,i,s,o,l=Fe(e);return"null"===l||"number"===l||"string"===l||"boolean"===l||"array"===l||"undefined"===l?(0,X.Xq)(e,t):"color"===l?e.getHexString()!==(null==t?void 0:t.getHexString()):"texture"===l?(0,Q.Ki)(e)!==(0,Q.Ki)(t):"vector2"===l||"vector3"===l?(({x:r,y:n,z:a}=e),({x:i,y:s,z:o}=t),r!==i||n!==s||a!==o):"object"===l?(0,X.Xq)(e,t):void 0},Ge=e=>{const{target:t,val:r,type:n}=e;"null"===(e=Fe(r))||"number"===e||"string"===e||"boolean"===e||"undefined"===e||"texture"===e?t[n]=r:"color"===e||"vector2"===e||"vector3"===e?t[n].copy(r):"object"===e?t[n]=Object.assign({},r):"array"===e&&(t[n]=[...r])},He=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r,z:e.z+(t.z-e.z)*r})},1129:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__1129__},3300:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__3300__},6001:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__6001__},8881:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__8881__},8624:(e,t,r)=>{r.d(t,{Ys:()=>M});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(r=t?(r=p(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return h(n)}}function h(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 m=new n.Raycaster,f=new n.Vector3,g=new n.Vector3,v=new n.Quaternion,b={X:new n.Vector3(1,0,0),Y:new n.Vector3(0,1,0),Z:new n.Vector3(0,0,1)},y={type:"change"},x={type:"mouseDown"},w={type:"mouseUp",mode:null},S={type:"objectChange"},M=function(){c(t,n.Object3D);var e=d(t);function t(r,a){i(this,t),s=e.call(this),void 0===a&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),a=document),s.isTransformControls=!0,s.visible=!1,s.domElement=a,s.domElement.style.touchAction="none";var s,o=new N,l=(s._gizmo=o,s.add(o),new z),c=(s._plane=l,s.add(l),h(s));function u(e,t){var r=t;Object.defineProperty(c,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,l[e]=t,o[e]=t,c.dispatchEvent({type:e+"-changed",value:t}),c.dispatchEvent(y))}}),c[e]=t,l[e]=t,o[e]=t}u("camera",r),u("object",void 0),u("enabled",!0),u("axis",null),u("mode","translate"),u("translationSnap",null),u("rotationSnap",null),u("scaleSnap",null),u("space","world"),u("size",1),u("dragging",!1),u("showX",!0),u("showY",!0),u("showZ",!0),a=new n.Vector3,r=new n.Vector3;var d=new n.Quaternion,p=new n.Quaternion,m=new n.Vector3,f=new n.Quaternion,g=new n.Vector3,v=new n.Vector3,b=new n.Vector3,x=new n.Vector3;return u("worldPosition",a),u("worldPositionStart",r),u("worldQuaternion",d),u("worldQuaternionStart",p),u("cameraPosition",m),u("cameraQuaternion",f),u("pointStart",g),u("pointEnd",v),u("rotationAxis",b),u("rotationAngle",0),u("eye",x),s._offset=new n.Vector3,s._startNorm=new n.Vector3,s._endNorm=new n.Vector3,s._cameraScale=new n.Vector3,s._parentPosition=new n.Vector3,s._parentQuaternion=new n.Quaternion,s._parentQuaternionInv=new n.Quaternion,s._parentScale=new n.Vector3,s._worldScaleStart=new n.Vector3,s._worldQuaternionInv=new n.Quaternion,s._worldScale=new n.Vector3,s._positionStart=new n.Vector3,s._quaternionStart=new n.Quaternion,s._scaleStart=new n.Vector3,s._getPointer=function(e){var t;return this.domElement.ownerDocument.pointerLockElement?{x:0,y:0,button:e.button}:(t=this.domElement.getBoundingClientRect(),{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button})}.bind(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 o(t,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),l(p(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(m.setFromCamera(e,this.camera),e=T(this._gizmo.picker[this.mode],m),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&&(m.setFromCamera(e,this.camera),(e=T(this._plane,m,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,x.mode=this.mode,this.dispatchEvent(x))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,a=this.space;"scale"===r?a="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(a="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(m.setFromCamera(e,this.camera),(e=T(this._plane,m,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===a&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===a&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===a&&(n.position.applyQuaternion(v.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===a&&(n.parent&&n.position.add(f.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(f.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),g.set(e,e,e)):(f.copy(this.pointStart),g.copy(this.pointEnd),f.applyQuaternion(this._worldQuaternionInv),g.applyQuaternion(this._worldQuaternionInv),g.divide(f),-1===t.search("X")&&(g.x=1),-1===t.search("Y")&&(g.y=1),-1===t.search("Z")&&(g.z=1)),n.scale.copy(this._scaleStart).multiply(g),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(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(b[t]),f.copy(b[t]),"local"===a&&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"===a&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(y),this.dispatchEvent(S)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(w.mode=this.mode,this.dispatchEvent(w)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(y),this.dispatchEvent(S),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return m}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}}]),t}();function T(e,t,r){for(var n=t.intersectObject(e,!0),a=0;a<n.length;a++)if(n[a].object.visible||r)return n[a];return!1}var _=new n.Euler,E=new n.Vector3(0,1,0),D=new n.Vector3(0,0,0),O=new n.Matrix4,P=new n.Quaternion,k=new n.Quaternion,A=new n.Vector3,C=new n.Matrix4,L=new n.Vector3(1,0,0),R=new n.Vector3(0,1,0),I=new n.Vector3(0,0,1),B=new n.Vector3,U=new n.Vector3,j=new n.Vector3,N=function(){c(t,n.Object3D);var e=d(t);function t(){i(this,t),(r=e.call(this)).isTransformControlsGizmo=!0,r.type="TransformControlsGizmo";var r,a=new n.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=new n.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=a.clone(),l=((((o.opacity=.15,s=s.clone()).opacity=.5,w=a.clone()).color.setHex(16711680),S=a.clone()).color.setHex(65280),a.clone()),c=(l.color.setHex(255),a.clone()),u=(c.color.setHex(16711680),c.opacity=.5,a.clone()),d=(u.color.setHex(65280),u.opacity=.5,a.clone()),h=(d.color.setHex(255),d.opacity=.5,a.clone());(h.opacity=.25,y=a.clone()).color.setHex(16776960),y.opacity=.25,a.clone().color.setHex(16776960);var p=(((a=a.clone()).color.setHex(7895160),g=new n.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new n.BoxGeometry(.08,.08,.08)),m=(p.translate(0,.04,0),new n.BufferGeometry);function f(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}(m.setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,0,0],3)),M=new n.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var g={X:[[new n.Mesh(g,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(g,w),[-.5,0,0],[0,0,Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new n.Mesh(g,S),[0,.5,0]],[new n.Mesh(g,S),[0,-.5,0],[Math.PI,0,0]],[new n.Mesh(M,S)]],Z:[[new n.Mesh(g,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(g,l),[0,0,-.5],[-Math.PI/2,0,0]],[new n.Mesh(M,l),null,[Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.1,0),h.clone()),[0,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),d.clone()),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.2,0),o)]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},b={START:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new n.Line(((b=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,1,1],3)),b),s),null,null,null,"helper"]],X:[[new n.Line(m,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(m,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(m,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},y=(a={XYZE:[[new n.Mesh(f(.5,1),a),null,[0,Math.PI/2,0]]],X:[[new n.Mesh(f(.5,.5),w)]],Y:[[new n.Mesh(f(.5,.5),S),null,[0,0,-Math.PI/2]]],Z:[[new n.Mesh(f(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new n.Mesh(f(.75,1),y),null,[0,Math.PI/2,0]]]},{AXIS:[[new n.Line(m,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new n.Mesh(new n.SphereGeometry(.25,10,8),o)]],X:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new n.Mesh(new n.TorusGeometry(.75,.1,2,24),o)]]},w={X:[[new n.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]],[new n.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(p,S),[0,.5,0]],[new n.Mesh(M,S)],[new n.Mesh(p,S),[0,-.5,0],[0,0,Math.PI]]],Z:[[new n.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(M,l),[0,0,0],[Math.PI/2,0,0]],[new n.Mesh(p,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),d),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.1,.1,.1),h.clone())]]},S={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},M={X:[[new n.Line(m,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(m,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(m,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function T(e){var t,r=new n.Object3D;for(t in e)for(var a=e[t].length;a--;){var i=e[t][a][0].clone(),s=e[t][a][1],o=e[t][a][2],l=e[t][a][3],c=e[t][a][4];(i.name=t,i.tag=c,s&&i.position.set(s[0],s[1],s[2]),o&&i.rotation.set(o[0],o[1],o[2]),l&&i.scale.set(l[0],l[1],l[2]),i.updateMatrix(),c=i.geometry.clone()).applyMatrix4(i.matrix),i.geometry=c,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),r.add(i)}return r}return r.gizmo={},r.picker={},r.helper={},r.add(r.gizmo.translate=T(g)),r.add(r.gizmo.rotate=T(a)),r.add(r.gizmo.scale=T(w)),r.add(r.picker.translate=T(v)),r.add(r.picker.rotate=T(x)),r.add(r.picker.scale=T(S)),r.add(r.helper.translate=T(b)),r.add(r.helper.rotate=T(y)),r.add(r.helper.scale=T(M)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:k,a=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);a=(a=(a=a.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var i=0;i<a.length;i++)!function(e){var t=a[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.visible=!!r.axis,"X"===r.axis&&(v.setFromEuler(_.set(0,0,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(v.setFromEuler(_.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),E.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(O.lookAt(D,E,R)),t.quaternion.multiply(v),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),f.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),f.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(f),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(P.copy(n),E.copy(r.eye).applyQuaternion(v.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(O.lookAt(r.eye,D,R)),"X"===t.name&&(v.setFromAxisAngle(L,Math.atan2(-E.y,E.z)),v.multiplyQuaternions(P,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(R,Math.atan2(E.x,E.z)),v.multiplyQuaternions(P,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(I,Math.atan2(E.y,E.x)),v.multiplyQuaternions(P,v),t.quaternion.copy(v))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(i);l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),z=function(){c(t,n.Mesh);var e=d(t);function t(){var r;return i(this,t),(r=e.call(this,new n.PlaneGeometry(1e5,1e5,2,2),new n.MeshBasicMaterial({visible:!1,wireframe:!0,side:n.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).isTransformControlsPlane=!0,r.type="TransformControlsPlane",r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),B.copy(L).applyQuaternion("local"===r?this.worldQuaternion:k),U.copy(R).applyQuaternion("local"===r?this.worldQuaternion:k),j.copy(I).applyQuaternion("local"===r?this.worldQuaternion:k),E.copy(U),this.mode){case"translate":case"scale":switch(this.axis){case"X":E.copy(this.eye).cross(B),A.copy(B).cross(E);break;case"Y":E.copy(this.eye).cross(U),A.copy(U).cross(E);break;case"Z":E.copy(this.eye).cross(j),A.copy(j).cross(E);break;case"XY":A.copy(j);break;case"YZ":A.copy(B);break;case"XZ":E.copy(j),A.copy(U);break;case"XYZ":case"E":A.set(0,0,0)}break;default:A.set(0,0,0)}0===A.length()?this.quaternion.copy(this.cameraQuaternion):(C.lookAt(f.set(0,0,0),A,E),this.quaternion.setFromRotationMatrix(C)),l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()},6422:(e,t,r)=>{r.d(t,{x:()=>c});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).type=n.HalfFloatType,e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"parse",value:function(e){var t,r,a,i,s,o,l,c,u,d,h=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},p=function(e,t,r){t=t||1024;for(var n=e.pos,a=-1,i=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));(a=o.indexOf("\n"))<0&&i<t&&n<e.byteLength;)s+=o,i+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));return-1<a&&(!1!==r&&(e.pos+=i+a+1),s+o.slice(0,a))},m=((e=new Uint8Array(e)).pos=0,function(e){var t,r,n=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,i=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(t=p(e)))return h(1,"no header found");if(!(r=t.match(/^#\?(\S+)/)))return h(3,"bad initial token");for(o.valid|=1,o.programtype=r[1],o.string+=t+"\n";!1!==(t=p(e));)if(o.string+=t+"\n","#"===t.charAt(0))o.comments+=t+"\n";else if((r=t.match(n))&&(o.gamma=parseFloat(r[1])),(r=t.match(a))&&(o.exposure=parseFloat(r[1])),(r=t.match(i))&&(o.valid|=2,o.format=r[1]),(r=t.match(s))&&(o.valid|=4,o.height=parseInt(r[1],10),o.width=parseInt(r[2],10)),2&o.valid&&4&o.valid)break;return 2&o.valid?4&o.valid?o:h(3,"missing image size specifier"):h(3,"missing format specifier")}(e));if(-1!==m){var f,g,v=m.width,b=m.height,y=function(e,t,r){var n=t;if(n<8||32767<n||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return h(3,"wrong scanline width");var a=new Uint8Array(4*t*r);if(!a.length)return h(4,"unable to allocate buffer space");for(var i=0,s=0,o=4*n,l=new Uint8Array(4),c=new Uint8Array(o),u=r;0<u&&s<e.byteLength;){if(s+4>e.byteLength)return h(1);if(l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=n)return h(3,"bad rgbe scanline format");for(var d=0,p=void 0;d<o&&s<e.byteLength;){var m=128<(p=e[s++]);if(m&&(p-=128),0===p||o<d+p)return h(3,"bad scanline data");if(m)for(var f=e[s++],g=0;g<p;g++)c[d++]=f;else c.set(e.subarray(s,s+p),d),d+=p,s+=p}for(var v=n,b=0;b<v;b++){var y=0;a[i]=c[b+0],y+=n,a[i+1]=c[b+y],y+=n,a[i+2]=c[b+y],y+=n,a[i+3]=c[b+y],i+=4}u--}return a}(e.subarray(e.pos),v,b);if(-1!==y){switch(this.type){case n.FloatType:for(var x=y.length/4,w=new Float32Array(4*x),S=0;S<x;S++)c=w,u=l=4*S,d=void 0,d=(o=y)[l+3],d=Math.pow(2,d-128)/255,c[u+0]=o[l+0]*d,c[u+1]=o[l+1]*d,c[u+2]=o[l+2]*d,c[u+3]=1;f=w,g=n.FloatType;break;case n.HalfFloatType:x=y.length/4;for(var M=new Uint16Array(4*x),T=0;T<x;T++)a=M,i=r=4*T,s=void 0,s=(t=y)[r+3],s=Math.pow(2,s-128)/255,a[i+0]=n.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[i+1]=n.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[i+2]=n.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504)),a[i+3]=n.DataUtils.toHalfFloat(1);f=M,g=n.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:v,height:b,data:f,header:m.string,gamma:m.gamma,exposure:m.exposure,type:g}}}return null}},{key:"setDataType",value:function(e){return this.type=e,this}},{key:"load",value:function(e,t,r,s){return i(l(a.prototype),"load",this).call(this,e,(function(e,r){switch(e.type){case n.FloatType:case n.HalfFloatType:e.encoding=n.LinearEncoding,e.minFilter=n.LinearFilter,e.magFilter=n.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.DataTextureLoader)},4819:(e,t,r)=>{r.d(t,{T:()=>u,w:()=>o});var n=r(8881);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var o=function(){function e(){a(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return s(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}},{key:"dispose",value:function(){}}]),e}(),l=new n.OrthographicCamera(-1,1,1,-1,0,1),c=new n.BufferGeometry,u=(c.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){a(this,e),this._mesh=new n.Mesh(c,t)}return s(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,l)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}())},5180:(e,t,r)=>{r.d(t,{T:()=>c});var n=r(8881),a=r(4819);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(i);function i(e,t){var s;if(this instanceof i)return(s=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof n.ShaderMaterial?(s.uniforms=e.uniforms,s.material=e):e&&(s.uniforms=n.UniformsUtils.clone(e.uniforms),s.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:s.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),s.fsQuad=new a.T(s.material),s;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}},{key:"dispose",value:function(){this.material.dispose(),this.fsQuad.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(a.w)},699:(e,t,r)=>{function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,{M:()=>g,j:()=>u});var u=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,a=c(e);if(r=t?(r=c(this).constructor,Reflect.construct(a,arguments,r)):a.apply(this,arguments),a=this,r&&("object"===n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==a)return a;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,i),(e=r.call(this)).isCSS2DObject=!0,e.element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return s(i,[{key:"copy",value:function(e,t){return o(c(i.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),i}((t=r(8881)).Object3D),d=new t.Vector3,h=new t.Matrix4,p=new t.Matrix4,m=new t.Vector3,f=new t.Vector3,g=s((function e(){var t,r,n,i,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(a(this,e),this),l={objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div");function u(e,t){return m.setFromMatrixPosition(e.matrixWorld),f.setFromMatrixPosition(t.matrixWorld),m.distanceToSquared(f)}c.style.overflow="hidden",this.domElement=c,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),h.copy(t.matrixWorldInverse),p.multiplyMatrices(t.projectionMatrix,h),function e(t,r,a){var s;t.isCSS2DObject&&(d.setFromMatrixPosition(t.matrixWorld),d.applyMatrix4(p),s=!0===t.visible&&-1<=d.z&&d.z<=1&&!0===t.layers.test(a.layers),t.element.style.display=1==s?"":"none",1==s&&(t.onBeforeRender(o,r,a),(s=t.element).style.transform="translate(-50%,-50%) translate("+(d.x*n+n)+"px,"+(-d.y*i+i)+"px)",s.parentNode!==c&&c.appendChild(s),t.onAfterRender(o,r,a)),s={distanceToCameraSquared:u(a,t)},l.objects.set(t,s));for(var h=0,m=t.children.length;h<m;h++)e(t.children[h],r,a)}(e,e,t);for(var r=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),a=r.length,s=0,m=r.length;s<m;s++)r[s].element.style.zIndex=a-s},this.setSize=function(e,a){n=(t=e)/2,i=(r=a)/2,c.style.width=e+"px",c.style.height=a+"px"}}))},3693:(e,t,r)=>{r.d(t,{P7:()=>v,cp:()=>g,lX:()=>x});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=h(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=h(e);if(r=t?(r=h(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new n.Vector3,m=new n.Quaternion,f=new n.Vector3,g=function(){c(t,n.Object3D);var e=d(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return i(this,t),(r=e.call(this)).isCSS3DObject=!0,r.element=n,r.element.style.position="absolute",r.element.style.pointerEvents="auto",r.element.style.userSelect="none",r.element.setAttribute("draggable",!1),r.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),r}return o(t,[{key:"copy",value:function(e,r){return l(h(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),v=function(){c(t,g);var e=d(t);function t(r){return i(this,t),(r=e.call(this,r)).isCSS3DSprite=!0,r.rotation2D=0,r}return o(t,[{key:"copy",value:function(e,r){return l(h(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}(),b=new n.Matrix4,y=new n.Matrix4,x=o((function e(){var t,r,n,a,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(i(this,e),this),l={camera:{fov:0,style:""},objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div"),u=(c.style.overflow="hidden",this.domElement=c,document.createElement("div"));function d(e){return Math.abs(e)<1e-10?0:e}function h(e){return"matrix3d("+d((e=e.elements)[0])+","+d(-e[1])+","+d(e[2])+","+d(e[3])+","+d(e[4])+","+d(-e[5])+","+d(e[6])+","+d(e[7])+","+d(e[8])+","+d(-e[9])+","+d(e[10])+","+d(e[11])+","+d(e[12])+","+d(-e[13])+","+d(e[14])+","+d(e[15])+")"}function g(e){return"translate(-50%,-50%)matrix3d("+d((e=e.elements)[0])+","+d(e[1])+","+d(e[2])+","+d(e[3])+","+d(-e[4])+","+d(-e[5])+","+d(-e[6])+","+d(-e[7])+","+d(e[8])+","+d(e[9])+","+d(e[10])+","+d(e[11])+","+d(e[12])+","+d(e[13])+","+d(e[14])+","+d(e[15])+")"}u.style.transformStyle="preserve-3d",u.style.pointerEvents="none",c.appendChild(u),this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){var r=t.projectionMatrix.elements[5]*a,i=(l.camera.fov!==r&&(c.style.perspective=t.isPerspectiveCamera?r+"px":"",l.camera.fov=r),!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),t.isOrthographicCamera&&(i=-(t.right+t.left)/2,s=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+d(i)+"px,"+d(s)+"px)"+h(t.matrixWorldInverse):"translateZ("+r+"px)"+h(t.matrixWorldInverse)),s=i+"translate("+n+"px,"+a+"px)";l.camera.style!==s&&(u.style.transform=s,l.camera.style=s),function e(t,r,n,a){var i,s,c;t.isCSS3DObject&&(i=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==i?"":"none",1==i&&(t.onBeforeRender(o,r,n),i=t.isCSS3DSprite?(b.copy(n.matrixWorldInverse),b.transpose(),0!==t.rotation2D&&b.multiply(y.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(p,m,f),b.setPosition(p),b.scale(f),b.elements[3]=0,b.elements[7]=0,b.elements[11]=0,b.elements[15]=1,g(b)):g(t.matrixWorld),s=t.element,void 0!==(c=l.objects.get(t))&&c.style===i||(c={style:s.style.transform=i},l.objects.set(t,c)),s.parentNode!==u&&u.appendChild(s),t.onAfterRender(o,r,n)));for(var d=0,h=t.children.length;d<h;d++)e(t.children[d],r,n,a)}(e,e,t,i)},this.setSize=function(e,i){n=(t=e)/2,a=(r=i)/2,c.style.width=e+"px",c.style.height=i+"px",u.style.width=e+"px",u.style.height=i+"px"}}))},6608:(e,t,r)=>{r.d(t,{C:()=>n});var n={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"}},4091:(e,t,r)=>{r.d(t,{Vs:()=>function(e,t){if(t===n.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==n.TriangleFanDrawMode&&t!==n.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;var r=e.getIndex();if(null===r){var a=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<i.count;s++)a.push(s);e.setIndex(a),r=e.getIndex()}var o=r.count-2,l=[];if(t===n.TriangleFanDrawMode)for(var c=1;c<=o;c++)l.push(r.getX(0)),l.push(r.getX(c)),l.push(r.getX(c+1));else for(var u=0;u<o;u++)u%2==0?(l.push(r.getX(u)),l.push(r.getX(u+1)),l.push(r.getX(u+2))):(l.push(r.getX(u+2)),l.push(r.getX(u+1)),l.push(r.getX(u)));return l.length/3!=o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t.clearGroups(),t},qf:()=>function(e){for(var t,r,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],s=null!==e[0].index,o=new Set(Object.keys(e[0].attributes)),l=new Set(Object.keys(e[0].morphAttributes)),c={},u={},d=e[0].morphTargetsRelative,h=new n.BufferGeometry,p=0,m=0;m<e.length;++m){var f,g,v=e[m],b=0;if(s!=(null!==v.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(f in v.attributes){if(!o.has(f))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+m+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;void 0===c[f]&&(c[f]=[]),c[f].push(v.attributes[f]),b++}if(b!==o.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!==v.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+m+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(g in v.morphAttributes){if(!l.has(g))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+m+". .morphAttributes must be consistent throughout all geometries."),null;void 0===u[g]&&(u[g]=[]),u[g].push(v.morphAttributes[g])}if(i){var y=void 0;if(s)y=v.index.count;else{if(void 0===v.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+m+". The geometry must have either an index or a position attribute"),null;y=v.attributes.position.count}h.addGroup(p,y,m),p+=y}}if(s){for(var x=0,w=[],S=0;S<e.length;++S){for(var M=e[S].index,T=0;T<M.count;++T)w.push(M.getX(T)+x);x+=e[S].attributes.position.count}h.setIndex(w)}for(t in c){var _=a(c[t]);if(!_)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;h.setAttribute(t,_)}for(r in u){var E=u[r][0].length;if(0===E)break;h.morphAttributes=h.morphAttributes||{},h.morphAttributes[r]=[];for(var D=0;D<E;++D){for(var O=[],P=0;P<u[r].length;++P)O.push(u[r][P][D]);var k=a(O);if(!k)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;h.morphAttributes[r].push(k)}}return h}});var n=r(8881);function a(e){for(var t,r,a,i=0,s=0;s<e.length;++s){var o=e[s];if(o.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if((t=void 0===t?o.array.constructor:t)!==o.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if((r=void 0===r?o.itemSize:r)!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((a=void 0===a?o.normalized:a)!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=o.array.length}for(var l=new t(i),c=0,u=0;u<e.length;++u)l.set(e[u].array,c),c+=e[u].array.length;return new n.BufferAttribute(l,r,a)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];return void 0!==t||(t=__webpack_module_cache__[e]={exports:{}},__webpack_modules__[e](t,t.exports,__webpack_require__)),t.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{__webpack_require__.d(__webpack_exports__,{default:()=>r});var e=__webpack_require__(8624),t=__webpack_require__(9106);const r={RunScene:t.ZP,Utils:t.cQ,ModelEx:t.ch,MaterialEx:t.al,TextureEx:t.Az,Three:t.Sf,ThreeEx:{TransformControls:e.Ys},Bus:t.Gc}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):"function"==typeof define&&define.amd?define(["axios","js-funcs","three","@allex/md5"],t):"object"==typeof exports?exports.RunScene=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):e.RunScene=t(e.axios,e["js-funcs"],e.three,e["@allex/md5"])}(self,((__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__6001__,__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__1129__)=>(()=>{"use strict";var __webpack_modules__={2958:(e,t,r)=>{function n(){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===m(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof 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 f(e){return void 0===e}function g(){return"undefined"!=typeof window}function v(e){return Ge(e)||Ve(e)}function b(e){return(nt=D(e,rt))&&Sr}function y(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(rt[e]=t)&&nt&&(nt[e]=t)||rt}function w(){return 0}function S(e,t,r){return(r=e[t])&&Ge(r)?e[t]():f(r)&&e.getAttribute&&e.getAttribute(t)||r}function M(e,t){(e=e.split(",")).forEach(t)}function T(e,t,r,n){st.length&>(),e.render(t,r,n),st.length&>()}function _(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:Ve(e)?e.trim():e}function E(e){return e}function D(e,t){for(var r in t)e[r]=t[r];return e}function O(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=Ze(t[r])?O(e[r]||(e[r]={}),t[r]):t[r]);return e}function k(e){var t,r=e.parent||le,n=e.keyframes?(t=qe(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):vt;if(We(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function P(e){return!e||e._ts&&P(e.parent)}function A(e){return e._repeat?C(e._tTime,e=e.duration()+e._rDelay)*e:0}function C(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function L(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function R(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=L(e.rawTime(),t),(!t._dur||H(0,t.totalDuration(),r)-t._tTime>Ie)&&t.render(r,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-Ie}}function I(e,t,r,n){return t.parent&&xt(t),t._start=ft((He(r)?r:r||e!==le?V(e,r,t):e._time)+t._delay),t._end=ft(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=4<arguments.length?arguments[4]:void 0,s=e[a];if(i)for(r=t[i];s&&s[i]>r;)s=s._prev;s?(t._next=s._next,s._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[a]=t,t._prev=s,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),N(t)||(e._recent=t),n||R(e,t),e}function B(e,t){(rt.ScrollTrigger||at("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function j(e,t,r,n){return Kt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==Ut.frame?(st.push(e),e._lazy=[t,n]):void 0:1}function U(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||U(e))}function N(e){return"isFromStart"===(e=e.data)||"isStart"===e}function z(e,t,r,n){var a=e._repeat,i=ft(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=i/e._dur),e._dur=i,e._tDur=a?a<0?1e10:ft(i*(a+1)+e._rDelay*a):i,0<t&&!n?Mt(e,e._tTime=e._tDur*t):e.parent&&St(e),r||wt(e.parent,e),e}function F(e){return e instanceof ir?wt(e):z(e,e._dur)}function V(e,t,r){var n,a,i,s=e.labels,o=e._recent||Tt,l=e.duration()>=Re?o.endTime(!1):e._dur;return Ve(t)&&(isNaN(t)||t in s)?(a=t.charAt(0),i="%"===t.substr(-1),n=t.indexOf("="),"<"===a||">"===a?(0<=n&&(t=t.replace(/=/,"")),("<"===a?o._start:o.endTime(0<=o._repeat))+(parseFloat(t.substr(1))||0)*(i?(n<0?o:r).totalDuration()/100:1)):n<0?(t in s||(s[t]=l),s[t]):(a=parseFloat(t.charAt(n-1)+t.substr(n+1)),i&&r&&(a=a/100*(qe(r)?r[0]:r).totalDuration()),1<n?V(e,t.substr(0,n-1),r)+a:l+a)):null==t?l:+t}function G(e,t,r){var n,a,i=He(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s];if(i&&(o.duration=t[1]),o.parent=r,e){for(n=o,a=r;a&&!("immediateRender"in n);)n=a.vars.defaults||{},a=We(a.vars.inherit)&&a.parent;o.immediateRender=We(n.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new dr(t[0],o,t[1+s])}function H(e,t,r){return r<e?e:t<r?t:r}function Z(e){if(Ge(e))return e;var t=Ze(e)?e:{each:e},r=Ht(t.ease),n=t.from||0,a=parseFloat(t.base)||0,i={},s=(e=0<n&&n<1,isNaN(n)||e),o=t.axis,l=n,c=n;return Ve(n)?l=c={center:.5,edges:.5,end:1}[n]||0:!e&&s&&(l=n[0],c=n[1]),function(e,u,d){var h,p,m,f,g,v,b,y,x=(d||t).length,w=i[x];if(!w){if(!(y="auto"===t.grid?0:(t.grid||[1,Re])[1])){for(v=-Re;v<(v=d[y++].getBoundingClientRect().left)&&y<x;);y--}for(w=i[x]=[],h=s?Math.min(y,x)*l-.5:n%y,p=y===Re?0:s?x*c/y-.5:n/y|0,b=Re,g=v=0;g<x;g++)f=g%y-h,m=p-(g/y|0),w[g]=f=o?Math.abs("y"===o?m:f):Ne(f*f+m*m),v<f&&(v=f),f<b&&(b=f);"random"===n&&Pt(w),w.max=v-b,w.min=b,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<y?x-1:o?"y"===o?x/y:y:Math.max(y,x/y))||0)*("edges"===n?-1:1),w.b=x<0?a-x:a,w.u=Et(t.amount||t.each)||0,r=r&&x<0?Gt(r):r}return x=(w[e]-w.min)/w.max||0,ft(w.b+(r?r(x):x)*w.v)+w.u}}function W(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+(He(r)?0:Et(r))}}function K(e,t){var r,n,a=qe(e);return!a&&Ze(e)&&(r=a=e.radius||Re,e.values?(e=kt(e.values),(n=!He(e[0]))&&(r*=r)):e=W(e.increment)),_t(t,a?Ge(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var a,i,s=parseFloat(n?t.x:t),o=parseFloat(n?t.y:0),l=Re,c=0,u=e.length;u--;)(a=n?(a=e[u].x-s)*a+(i=e[u].y-o)*i:Math.abs(e[u]-s))<l&&(l=a,c=u);return c=!r||l<=r?e[c]:t,n||c===t||He(t)?c:c+Et(t)}:W(e))}function q(e,t,r,n){return _t(qe(e)?!t:!0===r?!!(r=0):!n,(function(){return qe(e)?e[~~(Math.random()*e.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((e-r/2+Math.random()*(t-e+.99*r))/r)*r*n)/n}))}function X(e,t,r){return _t(r,(function(r){return e[~~t(r)]}))}function Y(e,t,r,n,a){var i=t-e,s=n-r;return _t(a,(function(t){return r+((t-e)/i*s||0)}))}function Q(e,t,r){var n,a,i,s=e.labels,o=Re;for(n in s)(a=s[n]-t)<0==!!r&&a&&o>(a=Math.abs(a))&&(i=n,o=a);return i}function J(e,t,r){var n=e.vars,a=n[t];a&&(t=n[t+"Params"],n=n.callbackScope||e,r&&st.length&>(),t?a.apply(n,t):a.call(n))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&J(e,"onInterrupt"),e}function ee(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*Ct+.5|0}function te(e,t,r){var n,a,i,s,o="",l=(e+o).match(Bt),c=t?"hsla(":"rgba(",u=0;if(!l)return e;if(l=l.map((function(e){return(e=Rt(e,t,1))&&c+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(i=It(e),(n=r.c).join(o)!==i.c.join(o)))for(s=(a=e.replace(Bt,"1").split(Qe)).length-1;u<s;u++)o+=a[u]+(~n.indexOf(u)?l.shift()||c+"0,0,0,0)":(i.length?i:l.length?l:r).shift());if(!a)for(s=(a=e.split(Bt)).length-1;u<s;u++)o+=a[u]+l[u];return o+a[s]}function re(e,t){for(var r,n=e._first;n;)n instanceof ir?re(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?re(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function ne(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},a={easeIn:t,easeOut:n,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};M(e,(function(e){for(var t in zt[e]=rt[e]=a,zt[r=e.toLowerCase()]=n,a)zt[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=zt[e+"."+t]=a[t]}))}function ae(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function ie(e,t,r){function n(e){return 1===e?1:a*Math.pow(2,-10*e)*Fe((e-i)*s)+1}var a=1<=t?t:1,i=(s=(r||(e?.3:.45))/(t<1?t:1))/Be*(Math.asin(1/a)||0),s=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ae(n),Be/s);return r.config=function(t,r){return ie(e,t,r)},r}function se(e){function t(e){return e?--e*e*((r+1)*e+r)+1:0}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,n="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ae(t);return n.config=function(t){return se(e,t)},n}r.d(t,{Q3:()=>dr});var oe,le,ce,ue,de,he,pe,me,fe,ge,ve,be,ye,xe,we,Se,Me,Te,_e,Ee,De,Oe,ke,Pe,Ae,Ce={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Le={duration:.5,overwrite:!1,delay:0},Re=1e8,Ie=1/Re,Be=2*Math.PI,je=Be/4,Ue=0,Ne=Math.sqrt,ze=Math.cos,Fe=Math.sin,Ve=function(e){return"string"==typeof e},Ge=function(e){return"function"==typeof e},He=function(e){return"number"==typeof e},Ze=function(e){return"object"==m(e)},We=function(e){return!1!==e},Ke="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},qe=Array.isArray,Xe=/(?:-?\.?\d|\.)+/gi,Ye=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Qe=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Je=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,$e=/[+-]=-?[.\d]+/,et=/[^,'"\[\]\s]+/gi,tt=/[\d.+\-=]+(?:e[-+]\d*)*/i,rt={},nt={},at=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},it={},st=[],ot={},lt={},ct={},ut=30,dt=[],ht="",pt=function(e){var t,r,n=e[0];if(Ze(n)||Ge(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=dt.length;r--&&!dt[r].targetTest(n););t=dt[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new nr(e[r],t)))||e.splice(r,1);return e},mt=function(e){return e._gsap||pt(kt(e))[0]._gsap},ft=function(e){return Math.round(1e7*e)/1e7||0},gt=function(){var e,t,r=st.length,n=st.slice(0);for(ot={},e=st.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},vt=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},bt=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},yt=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",a=t._prev,i=t._next;a?a._next=i:e[r]===t&&(e[r]=i),i?i._prev=a:e[n]===t&&(e[n]=a),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},St=function(e){return e._end=ft(e._start+(e._tDur/Math.abs(e._ts||e._rts||Ie)||0))},Mt=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=ft(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),St(e),r._dirty||wt(r,e)),e},Tt={_start:0,endTime:w,totalDuration:w},_t=function(e,t){return e||0===e?t(e):t},Et=function(e,t){return Ve(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},Dt=[].slice,Ot=function(e,t){return e&&Ze(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Ze(e[0]))&&!e.nodeType&&e!==ce},kt=function(e,t,r){return!Ve(e)||r||!ue&&Nt()?qe(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Ve(e)&&!t||Ot(e,1)?r.push.apply(r,h(kt(e))):r.push(e)}))||r}(e,r):Ot(e)?Dt.call(e,0):e?[e]:[]:Dt.call((t||de).querySelectorAll(e),0)},Pt=function(e){return e.sort((function(){return.5-Math.random()}))},At=function(e){for(var t,r,n,a,i=0,s="";~(t=e.indexOf("random(",i));)n=e.indexOf(")",t),a="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(a?et:Xe),s+=e.substr(i,t-i)+q(a?r:+r[0],a?0:+r[1],+r[2]||1e-5),i=n+1;return s+e.substr(i,e.length-i)},Ct=255,Lt={aqua:[0,Ct,Ct],lime:[0,Ct,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ct],navy:[0,0,128],white:[Ct,Ct,Ct],olive:[128,128,0],yellow:[Ct,Ct,0],orange:[Ct,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ct,0,0],pink:[Ct,192,203],cyan:[0,Ct,Ct],transparent:[Ct,Ct,Ct,0]},Rt=function(e,t,r){var n,a,i,s,o,l,c,u=e?He(e)?[e>>16,e>>8&Ct,e&Ct]:0:Lt.black;if(!u){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Lt[e])u=Lt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(a=e.charAt(2))+a+(i=e.charAt(3))+i+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(u=parseInt(e.substr(1,6),16))>>16,u>>8&Ct,u&Ct,parseInt(e.substr(7),16)/255];u=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ct,e&Ct]}else if("hsl"===e.substr(0,3))if(u=c=e.match(Xe),t){if(~e.indexOf("="))return u=e.match(Ye),r&&u.length<4&&(u[3]=1),u}else s=+u[0]%360/360,o=+u[1]/100,n=2*(l=+u[2]/100)-(a=l<=.5?l*(o+1):l+o-l*o),3<u.length&&(u[3]*=1),u[0]=ee(s+1/3,n,a),u[1]=ee(s,n,a),u[2]=ee(s-1/3,n,a);else u=e.match(Xe)||Lt.transparent;u=u.map(Number)}return t&&!c&&(n=u[0]/Ct,a=u[1]/Ct,i=u[2]/Ct,l=((e=Math.max(n,a,i))+(t=Math.min(n,a,i)))/2,e===t?s=o=0:(c=e-t,o=.5<l?c/(2-e-t):c/(e+t),s=e===n?(a-i)/c+(a<i?6:0):e===a?(i-n)/c+2:(n-a)/c+4,s*=60),u[0]=~~(s+.5),u[1]=~~(100*o+.5),u[2]=~~(100*l+.5)),r&&u.length<4&&(u[3]=1),u},It=function(e){var t=[],r=[],n=-1;return e.split(Bt).forEach((function(e){e=e.match(Qe)||[],t.push.apply(t,h(e)),r.push(n+=e.length+1)})),t.c=r,t},Bt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Lt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),jt=/hsl[a]?\(/,Ut=(we=Date.now,Se=500,Me=33,Te=we(),_e=Te,De=Ee=1e3/240,ke={time:0,frame:0,tick:function(){Zt(!0)},deltaRatio:function(e){return ye/(1e3/(e||60))},wake:function(){he&&(!ue&&g()&&(ce=ue=window,de=ce.document||{},rt.gsap=Sr,(ce.gsapVersions||(ce.gsapVersions=[])).push(Sr.version),b(nt||ce.GreenSockGlobals||!ce.gsap&&ce||{}),be=ce.requestAnimationFrame),ge&&ke.sleep(),ve=be||function(e){return setTimeout(e,De-1e3*ke.time+1|0)},fe=1,Zt(2))},sleep:function(){(be?ce.cancelAnimationFrame:clearTimeout)(ge),fe=0,ve=w},lagSmoothing:function(e,t){Se=e||1/Ie,Me=Math.min(t,Se,0)},fps:function(e){Ee=1e3/(e||240),De=1e3*ke.time+Ee},add:function(e){Oe.indexOf(e)<0&&Oe.push(e),Nt()},remove:function(e,t){~(t=Oe.indexOf(e))&&Oe.splice(t,1)&&t<=xe&&xe--},_listeners:Oe=[]}),Nt=function(){return!fe&&Ut.wake()},zt={},Ft=/^[\d.\-M][\d.\-,\s]/,Vt=/["']/g,Gt=function(e){return function(t){return 1-e(1-t)}},Ht=function(e,t){return e&&(Ge(e)?e:zt[e]||function(e){var t,r,n,a=(e+"").split("("),i=zt[a[0]];return i&&1<a.length&&i.config?i.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,a={},i=e.substr(1,e.length-3).split(":"),s=i[0],o=1,l=i.length;o<l;o++)r=i[o],t=o!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),a[s]=isNaN(n)?n.replace(Vt,"").trim():+n,s=r.substr(t+1).trim();return a}(a[1])]:(t=(a=e).indexOf("(")+1,r=a.indexOf(")"),n=a.indexOf("(",t),a.substring(t,~n&&n<r?a.indexOf(")",r+1):r).split(",").map(_))):zt._CE&&Ft.test(e)?zt._CE("",e):i}(e))||t};function Zt(e){var t,r,n,a=we()-_e,i=!0===e;if(Se<a&&(Te+=a-Me),(0<(a=(r=(_e+=a)-Te)-De)||i)&&(n=++ke.frame,ye=r-1e3*ke.time,ke.time=r/=1e3,De+=a+(Ee<=a?4:Ee-a),t=1),i||(ge=ve(Zt)),t)for(xe=0;xe<Oe.length;xe++)Oe[xe](r,ye,n,e)}function Wt(e){return e<Ae?Pe*e*e:e<.7272727272727273?Pe*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?Pe*(e-=2.25/2.75)*e+.9375:Pe*Math.pow(e-2.625/2.75,2)+.984375}function Kt(e,t){var r,n,a,i,s,o,l,c,u,d,h,p,m,f=e.vars,g=f.ease,v=f.startAt,b=f.immediateRender,y=f.lazy,x=f.onUpdate,w=f.onUpdateParams,S=f.callbackScope,M=f.runBackwards,T=f.yoyoEase,_=f.keyframes,E=f.autoRevert,D=e._dur,O=e._startAt,k=e._targets,P=e.parent,A=P&&"nested"===P.data?P.parent._targets:k,C="auto"===e._overwrite&&!oe,L=e.timeline;if(e._ease=Ht(g=!L||_&&g?g:"none",Le.ease),e._yEase=T?Gt(Ht(!0===T?g:T,Le.ease)):0,T&&e._yoyo&&!e._repeat&&(T=e._yEase,e._yEase=e._ease,e._ease=T),e._from=!L&&!!f.runBackwards,!L||_&&!f.stagger){if(p=(c=k[0]?mt(k[0]).harness:0)&&f[c.prop],r=bt(f,it),O&&xt(O.render(-1,!0)),v)if(xt(e._startAt=dr.set(k,vt({data:"isStart",overwrite:!1,parent:P,immediateRender:!0,lazy:We(y),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:S,stagger:0},v))),t<0&&!b&&!E&&e._startAt.render(-1,!0),b){if(0<t&&!E&&(e._startAt=0),D&&t<=0)return void(t&&(e._zTime=t))}else!1===E&&(e._startAt=0);else if(M&&D)if(O)E||(e._startAt=0);else if(a=vt({overwrite:!1,data:"isFromStart",lazy:(b=!t&&b)&&We(y),immediateRender:b,stagger:0,parent:P},r),p&&(a[c.prop]=p),xt(e._startAt=dr.set(k,a)),t<0&&e._startAt.render(-1,!0),e._zTime=t,b){if(!t)return}else Kt(e._startAt,Ie);for(e._pt=0,y=D&&We(y)||y&&!D,n=0;n<k.length;n++){if(l=(s=k[n])._gsap||pt(k)[n]._gsap,e._ptLookup[n]=d={},ot[l.id]&&st.length&>(),h=A===k?n:A.indexOf(s),c&&!1!==(u=new c).init(s,p||r,e,h,A)&&(e._pt=i=new yr(e._pt,s,u.name,0,1,u.render,u,0,u.priority),u._props.forEach((function(e){d[e]=i})),u.priority&&(o=1)),!c||p)for(a in r)lt[a]&&(u=lr(a,r,e,h,s,A))?u.priority&&(o=1):d[a]=i=or.call(e,s,a,"get",r[a],h,A,0,f.stringFilter);e._op&&e._op[n]&&e.kill(s,e._op[n]),C&&e._pt&&(rr=e,le.killTweensOf(s,d,e.globalTime(t)),m=!e.parent,rr=0),e._pt&&y&&(ot[l.id]=1)}o&&br(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!m,_&&t<=0&&L.render(Re,!0,!0)}function qt(e,t,r,n,a){return Ge(e)?e.call(t,r,n,a):Ve(e)&&~e.indexOf("random(")?At(e):e}function Xt(e,t,r){return e.setAttribute(t,r)}function Yt(e,t){var r=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*e):Math.round(1e4*(r.s+r.c*e))/1e4)+n,r=r._next;n+=t.c}t.set(t.t,t.p,n,t)}function Qt(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function Jt(e,t,r,n){for(var a,i=this._pt;i;)a=i._next,i.p===n&&i.modifier(e,t,r),i=a}function $t(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?yt(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function er(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function tr(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,a;if(Ve(r)&&(n={},M(r,(function(e){return n[e]=1})),r=n),t){for(a in n={},r)n[a]=t(r[a]);r=n}var i,s,o,l=e,c=r,u=l._targets;for(i in c)for(s=u.length;s--;)(o=(o=l._ptLookup[s][i])&&o.d)&&(o=o._pt?wr(o,i):o)&&o.modifier&&o.modifier(c[i],l,u[s],i)}}}}M("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;ne(e+",Power"+(r-1),t?function(e){return Math.pow(e,r)}:function(e){return e},(function(e){return 1-Math.pow(1-e,r)}),(function(e){return e<.5?Math.pow(2*e,r)/2:1-Math.pow(2*(1-e),r)/2}))})),zt.Linear.easeNone=zt.none=zt.Linear.easeIn,ne("Elastic",ie("in"),ie("out"),ie()),Pe=7.5625,Ae=1/2.75,ne("Bounce",(function(e){return 1-Wt(1-e)}),Wt),ne("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),ne("Circ",(function(e){return-(Ne(1-e*e)-1)})),ne("Sine",(function(e){return 1===e?1:1-ze(e*je)})),ne("Back",se("in"),se("out"),se()),zt.SteppedEase=zt.steps=rt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),a=t?1:0,i=1-Ie;return function(e){return((n*H(0,i,e)|0)+a)*r}}},Le.ease=zt["quad.out"],M("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return ht+=e+","+e+"Params,"}));var rr,nr=u((function e(t,r){d(this,e),this.id=Ue++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:S,this.set=r?r.getSetter:fr})),ar=function(){function e(t){d(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,z(this,+t.duration,1,1),this.data=t.data,fe||Ut.wake()}return u(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,z(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Nt(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(Mt(this,e),r._dp&&!r.parent&&R(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&I(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Ie||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),T(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+A(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)+A(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?C(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-Ie?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?L(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Ie?0:this._rts,e=this.totalTime(H(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return St(this),this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Nt(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Ie&&(this._tTime-=Ie)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||I(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(We(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?L(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,F(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,F(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(V(this,e),We(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,We(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-Ie:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Ie,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-Ie))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,Ge(a)&&(a=a(t))&&(a.then||a===t)&&(t.then=e),r(a),t.then=e}var a=Ge(e)?e:E;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){$(this)}}]),e}(),ir=(vt(ar.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Ie,_prom:0,_ps:!1,_rts:1}),function(){a(t,ar);var e=s(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=1<arguments.length?arguments[1]:void 0;return d(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=We(n.sortChildren),le&&I(n.parent||le,o(r),a),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&B(o(r),n.scrollTrigger),r}return u(t,[{key:"to",value:function(e,t,r){return G(0,arguments,this),this}},{key:"from",value:function(e,t,r){return G(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return G(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,k(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new dr(e,t,V(this,r),1),this}},{key:"call",value:function(e,t,r){return I(this,dr.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,a,i,s){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=i,r.onCompleteParams=s,r.parent=this,new dr(e,r,V(this,a)),this}},{key:"staggerFrom",value:function(e,t,r,n,a,i,s){return r.runBackwards=1,k(r).immediateRender=We(r.immediateRender),this.staggerTo(e,t,r,n,a,i,s)}},{key:"staggerFromTo",value:function(e,t,r,n,a,i,s,o){return n.startAt=r,k(n).immediateRender=We(n.immediateRender),this.staggerTo(e,t,n,a,i,s,o)}},{key:"render",value:function(e,t,r){var n,a,i,s,o,l,c,u,d,h,p=this._time,m=this._dirty?this.totalDuration():this._tDur,f=this._dur,g=e<=0?0:ft(e),v=this._zTime<0!=e<0&&(this._initted||!f);if((g=this!==le&&m<g&&0<=e?m:g)!==this._tTime||r||v){if(p!==this._time&&f&&(g+=this._time-p,e+=this._time-p),n=g,u=this._start,o=!(c=this._ts),v&&(f||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(v=this._yoyo,s=f+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*s+e,t,r);if(n=ft(g%s),g===m?(i=this._repeat,n=f):((i=~~(g/s))&&i===g/s&&(n=f,i--),f<n&&(n=f)),d=C(this._tTime,s),v&&1&i&&(n=f-n,h=1),i!==(d=!p&&this._tTime&&d!==i?i:d)&&!this._lock){var b=v&&1&d;if(v=b===(v&&1&i),p=(b=i<d?!b:b)?0:f,this._lock=1,this.render(p||(h?0:ft(i*s)),t,!f)._lock=0,this._tTime=g,!t&&this.parent&&J(this,"onRepeat"),this.vars.repeatRefresh&&!h&&(this.invalidate()._lock=1),p&&p!==this._time||o!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(f=this._dur,m=this._tDur,v&&(this._lock=2,this.render(p=b?f:-1e-4,!0),this.vars.repeatRefresh&&!h&&this.invalidate()),this._lock=0,!this._ts&&!o)return this;re(this,h)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,ft(p),ft(n)))&&(g-=n-(n=l._start)),this._tTime=g,this._time=n,this._act=!c,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&n&&!t&&(J(this,"onStart"),this._tTime!==g))return this;if(p<=n&&0<=e)for(y=this._first;y;){if(a=y._next,(y._act||n>=y._start)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(n-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(n-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=-Ie);break}}y=a}else for(var y=this._last,x=e<0?e:n;y;){if(a=y._prev,(y._act||x<=y._end)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(x-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(x-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=x?-Ie:Ie);break}}y=a}if(l&&!t&&(this.pause(),l.render(p<=n?0:-Ie)._zTime=p<=n?1:-1,this._ts))return this._start=u,St(this),this.render(e,t,r);this._onUpdate&&!t&&J(this,"onUpdate",!0),!(g===m&&m>=this.totalDuration()||!g&&p)||u!==this._start&&Math.abs(c)===Math.abs(this._ts)||this._lock||(!e&&f||!(g===m&&0<this._ts||!g&&this._ts<0)||xt(this,1),t||e<0&&!p||!g&&!p&&m||(J(this,g===m&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||g<m&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(He(t)||(t=V(this,t,e)),!(e instanceof ar)){if(qe(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Ve(e))return this.addLabel(e,t);if(!Ge(e))return this;e=dr.delayedCall(0,e)}return this!==e?I(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Re,a=[],i=this._first;i;)i._start>=n&&(i instanceof dr?t&&a.push(i):(r&&a.push(i),e&&a.push.apply(a,h(i.getChildren(!0,t,r))))),i=i._next;return a}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return Ve(e)?this.removeLabel(e):Ge(e)?this.killTweensOf(e):(yt(this,e),e===this._recent&&(this._recent=this._last),wt(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ft(Ut.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),n(l(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=V(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=dr.delayedCall(0,t||w,r)).data="isPause",this._hasPause=1,I(this,t,V(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=V(this,e);t;)t._start===e&&"isPause"===t.data&&xt(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),a=n.length;a--;)rr!==n[a]&&n[a].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],a=kt(e),i=this._first,s=He(t);i;)i instanceof dr?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(i._targets,a)&&(s?(!rr||i._initted&&i._ts)&&i.globalTime(0)<=t&&i.globalTime(i.totalDuration())>t:!t||i.isActive())&&n.push(i):(r=i.getTweensOf(a,t)).length&&n.push.apply(n,h(r)),i=i._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,a=V(n,e),i=(e=t).startAt,s=e.onStart,o=e.onStartParams,l=(e=e.immediateRender,dr.to(n,vt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale())||Ie,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale()),l._dur!==e&&z(l,e,0,1).render(l._time,!0,!0),r=1),s&&s.apply(l,o||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,vt({startAt:{time:V(this,e)}},r))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Q(this,V(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Q(this,V(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Ie)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,a=this._first,i=this.labels;a;)a._start>=n&&(a._start+=e,a._end+=e),a=a._next;if(t)for(r in i)i[r]>=n&&(i[r]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return n(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,r,n,a=0,i=this,s=i._last,o=Re;if(arguments.length)return i.timeScale((i._repeat<0?i.duration():i.totalDuration())/(i.reversed()?-e:e));if(i._dirty){for(n=i.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(r=s._start)>o&&i._sort&&s._ts&&!i._lock?(i._lock=1,I(i,s,r-s._delay,1)._lock=0):o=r,r<0&&s._ts&&(a-=r,(!n&&!i._dp||n&&n.smoothChildTiming)&&(i._start+=r/i._ts,i._time-=r,i._tTime-=r),i.shiftChildren(-r,!1,-1/0),o=0),s._end>a&&s._ts&&(a=s._end),s=t;z(i,i===le&&i._time>a?i._time:a,1,1),i._dirty=0}return i._tDur}}],[{key:"updateRoot",value:function(e){if(le._ts&&(T(le,L(e,le)),pe=Ut.frame),Ut.frame>=ut){ut+=Ce.autoSleep||120;var t=le._first;if((!t||!t._ts)&&Ce.autoSleep&&Ut._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Ut.sleep()}}}}]),t}()),sr=(vt(ir.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,a,i,s){var o,l,c,u,d,h=new yr(this._pt,e,t,0,1,Yt,null,a),p=0,m=0;for(h.b=r,h.e=n,r+="",(a=~(n+="").indexOf("random("))&&(n=At(n)),i&&(i(i=[r,n],e,t),r=i[0],n=i[1]),o=r.match(Je)||[];u=Je.exec(n);)c=u[0],u=n.substring(p,u.index),l?l=(l+1)%5:"rgba("===u.substr(-5)&&(l=1),c!==o[m++]&&(d=parseFloat(o[m-1])||0,h._pt={_next:h._pt,p:u||1===m?u:",",s:d,c:"="===c.charAt(1)?parseFloat(c.substr(2))*("-"===c.charAt(0)?-1:1):parseFloat(c)-d,m:l&&l<4?Math.round:0},p=Je.lastIndex);return h.c=p<n.length?n.substring(p,n.length):"",h.fp=s,($e.test(n)||a)&&(h.e=0),this._pt=h}),or=function(e,t,r,n,a,i,s,o,l){var c;if(Ge(n)&&(n=n(a||0,e,i)),a=e[t],i="get"!==r?r:Ge(a)?l?e[t.indexOf("set")||!Ge(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():a,r=Ge(a)?l?mr:pr:hr,Ve(n)&&"="===(n=~n.indexOf("random(")?At(n):n).charAt(1)&&(!(c=parseFloat(i)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Et(i)||0))&&0!==c||(n=c)),i!==n)return isNaN(i*n)||""===n?(a||t in e||at(t,n),sr.call(this,e,t,i,n,r,o||Ce.stringFilter,l)):(c=new yr(this._pt,e,t,+i||0,n-(i||0),"boolean"==typeof a?vr:gr,0,r),l&&(c.fp=l),s&&c.modifier(s,this,e),this._pt=c)},lr=function(e,t,r,n,a,i){var s,o,l,c;if(lt[e]&&!1!==(s=new lt[e]).init(a,s.rawVars?t[e]:function(e,t,r,n,a){if(Ge(e)&&(e=qt(e,a,t,r,n)),!Ze(e)||e.style&&e.nodeType||qe(e)||Ke(e))return Ve(e)?qt(e,a,t,r,n):e;var i,s={};for(i in e)s[i]=qt(e[i],a,t,r,n);return s}(t[e],n,a,i,r),r,n,i)&&(r._pt=o=new yr(r._pt,a,e,0,1,s.render,s,0,s.priority),r!==me))for(l=r._ptLookup[r._targets.indexOf(a)],c=s._props.length;c--;)l[s._props[c]]=o;return s},cr=ht+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",ur={},dr=(M(cr+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return ur[e]=1})),function(){a(t,ar);var e=s(t);function t(r,n,a,i){d(this,t),"number"==typeof n&&(a.duration=n,n=a,a=null);var s,l,c,u,h,p,m,f,g,b=(i=(s=e.call(this,i?n:k(n))).vars).duration,x=i.delay,w=i.immediateRender,S=i.stagger,M=i.overwrite,T=i.keyframes,_=i.defaults,E=i.scrollTrigger,O=i.yoyoEase,A=(i=n.parent||le,(qe(r)||Ke(r)?He(r[0]):"length"in n)?[r]:kt(r));if(s._targets=A.length?pt(A):y("GSAP target "+r+" not found. https://greensock.com",!Ce.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=M,T||S||v(b)||v(x)){if(n=s.vars,(l=s.timeline=new ir({data:"nested",defaults:_||{}})).kill(),l.parent=l._dp=o(s),l._start=0,S||v(b)||v(x)){if(h=A.length,f=S&&Z(S),Ze(S))for(p in S)~cr.indexOf(p)&&((g=g||{})[p]=S[p]);for(c=0;c<h;c++)(u=bt(n,ur)).stagger=0,O&&(u.yoyoEase=O),g&&D(u,g),m=A[c],u.duration=+qt(b,o(s),c,m,A),u.delay=(+qt(x,o(s),c,m,A)||0)-s._delay,!S&&1===h&&u.delay&&(s._delay=x=u.delay,s._start+=x,u.delay=0),l.to(m,u,f?f(c,m,A):0),l._ease=zt.none;l.duration()?b=x=0:s.timeline=0}else if(T){k(vt(l.vars.defaults,{ease:"none"})),l._ease=Ht(T.ease||n.ease||"none");var C,L,R,j=0;if(qe(T))T.forEach((function(e){return l.to(A,e,">")}));else{for(p in u={},T)"ease"!==p&&"easeEach"!==p&&function(e,t,r,n){var a,i,s=t.ease||n||"power1.inOut";if(qe(t))i=r[e]||(r[e]=[]),t.forEach((function(e,r){return i.push({t:r/(t.length-1)*100,v:e,e:s})}));else for(a in t)i=r[a]||(r[a]=[]),"ease"!==a&&i.push({t:parseFloat(e),v:t[a],e:s})}(p,T[p],u,T.easeEach);for(p in u)for(C=u[p].sort((function(e,t){return e.t-t.t})),c=j=0;c<C.length;c++)(R={ease:(L=C[c]).e,duration:(L.t-(c?C[c-1].t:0))/100*b})[p]=L.v,l.to(A,R,j),j+=R.duration;l.duration()<b&&l.to({},{duration:b-l.duration()})}}b||s.duration(b=l.duration())}else s.timeline=0;return!0!==M||oe||(rr=o(s),le.killTweensOf(A),rr=0),I(i,o(s),a),n.reversed&&s.reverse(),n.paused&&s.paused(!0),(w||!b&&!T&&s._start===ft(i._time)&&We(w)&&P(o(s))&&"nested"!==i.data)&&(s._tTime=-Ie,s.render(Math.max(0,-x))),E&&B(o(s),E),s}return u(t,[{key:"render",value:function(e,t,r){var n,a,i=this._time,s=this._tDur,o=this._dur,l=s-Ie<e&&0<=e?s:e<Ie?0:e;if(o){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(f=l,m=this.timeline,this._repeat){if(d=o+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*d+e,t,r);if(f=ft(l%d),l===s?(v=this._repeat,f=o):((v=~~(l/d))&&v===l/d&&(f=o,v--),o<f&&(f=o)),(p=this._yoyo&&1&v)&&(h=this._yEase,f=o-f),b=C(this._tTime,d),f===i&&!r&&this._initted)return this;v!==b&&(m&&this._yEase&&re(m,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(ft(d*v),!0).invalidate()._lock=0))}if(!this._initted){if(j(this,e<0?e:f,r,t))return this._tTime=0,this;if(o!==this._dur)return this.render(e,t,r)}if(this._tTime=l,this._time=f,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=a=(h||this._ease)(f/o),this._from&&(this.ratio=a=1-a),f&&!i&&!t&&(J(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(a,n.d),n=n._next;m&&m.render(e<0?e:!f&&p?-Ie:m._dur*m._ease(f/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),J(this,"onUpdate")),this._repeat&&v!==b&&this.vars.onRepeat&&!t&&this.parent&&J(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&o||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!i||!l&&!i||(J(this,l===s?"onComplete":"onReverseComplete",!0),!this._prom||l<s&&0<this.timeScale()||this._prom()))}}else{var c,u,d=this,h=e,p=t,m=r,f=d.ratio,g=h<0||!h&&(!d._start&&U(d)&&(d._initted||!N(d))||(d._ts<0||d._dp._ts<0)&&!N(d))?0:1,v=d._rDelay,b=0;if(v&&d._repeat&&(u=C(b=H(0,d._tDur,h),v),d._yoyo&&1&u&&(g=1-g),u!==C(d._tTime,v)&&(f=1-g,d.vars.repeatRefresh&&d._initted&&d.invalidate())),g!==f||m||d._zTime===Ie||!h&&d._zTime){if(d._initted||!j(d,h,m,p)){for(u=d._zTime,d._zTime=h||(p?Ie:0),p=p||h&&!u,d.ratio=g,d._from&&(g=1-g),d._time=0,d._tTime=b,c=d._pt;c;)c.r(g,c.d),c=c._next;d._startAt&&h<0&&d._startAt.render(h,!0,!0),d._onUpdate&&!p&&J(d,"onUpdate"),b&&d._repeat&&!p&&d.parent&&J(d,"onRepeat"),(h>=d._tDur||h<0)&&d.ratio===g&&(g&&xt(d,1),p||(J(d,g?"onComplete":"onReverseComplete",!0),d._prom&&d._prom()))}}else d._zTime||(d._zTime=h)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),n(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return h=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,rr&&!0!==rr.vars.overwrite)._first||$(this),this.parent&&h!==this.timeline.totalDuration()&&z(this,this._dur*this.timeline._tDur/h,0,1),this;var r,n,a,i,s,o,l,c=this._targets,u=e?kt(e):c,d=this._ptLookup,h=this._pt;if((!t||"all"===t)&&function(e,t){for(var r=e.length,n=r===t.length;n&&r--&&e[r]===t[r];);return r<0}(c,u))return"all"===t&&(this._pt=0),$(this);for(r=this._op=this._op||[],"all"!==t&&(Ve(t)&&(s={},M(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var r,n,a,i,s=(e=e[0]?mt(e[0]).harness:0)&&e.aliases;if(!s)return t;for(n in r=D({},t),s)if(n in r)for(a=(i=s[n].split(",")).length;a--;)r[i[a]]=r[n];return r}(c,t)),l=c.length;l--;)if(~u.indexOf(c[l]))for(s in n=d[l],"all"===t?(r[l]=t,i=n,a={}):(a=r[l]=r[l]||{},i=t),i)(o=n&&n[s])&&("kill"in o.d&&!0!==o.d.kill(s)||yt(this,o,"_pt"),delete n[s]),"all"!==a&&(a[s]=1);return this._initted&&!this._pt&&h&&$(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return G(1,arguments)}},{key:"delayedCall",value:function(e,r,n,a){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:a})}},{key:"fromTo",value:function(e,t,r){return G(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return le.killTweensOf(e,t,r)}}]),t}()),hr=(vt(dr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),M("staggerTo,staggerFrom,staggerFromTo",(function(e){dr[e]=function(){var t=new ir,r=Dt.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),pr=function(e,t,r){return e[t](r)},mr=function(e,t,r,n){return e[t](n.fp,r)},fr=function(e,t){return Ge(e[t])?pr:f(e[t])&&e.setAttribute?Xt:hr},gr=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},vr=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},br=function(e){for(var t,r,n,a,i=e._pt;i;){for(t=i._next,r=n;r&&r.pr>i.pr;)r=r._next;(i._prev=r?r._prev:a)?i._prev._next=i:n=i,(i._next=r)?r._prev=i:a=i,i=t}e._pt=n},yr=function(){function e(t,r,n,a,i,s,o,l,c){d(this,e),this.t=r,this.s=a,this.c=i,this.p=n,this.r=s||gr,this.d=o||this,this.set=l||hr,this.pr=c||0,(this._next=t)&&(t._prev=this)}return u(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=er,this.m=e,this.mt=r,this.tween=t}}]),e}(),xr=(M(ht+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return it[e]=1})),rt.TweenMax=rt.TweenLite=dr,rt.TimelineLite=rt.TimelineMax=ir,le=new ir({sortChildren:!1,defaults:Le,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ce.stringFilter=function(e){var t=e.join(" ");if(Bt.lastIndex=0,Bt.test(t))return t=jt.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,It(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=Ge(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:w,render:Qt,add:or,kill:$t,modifier:Jt,rawVars:0}),a={targetTest:0,get:0,getSetter:fr,aliases:{},register:0};if(Nt(),e!==r){if(lt[t])return;vt(r,vt(bt(e,n),a)),D(r.prototype,D(n,bt(e,a))),lt[r.prop=t]=r,e.targetTest&&(dt.push(r),it[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,r),e.register&&e.register(Sr,r,yr)}))},timeline:function(e){return new ir(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,r,n){Ve(e)&&(e=kt(e)[0]);var a=mt(e||{}).get,i=r?E:_;return"native"===r&&(r=""),e&&(t?i((lt[t]&<[t].get||a)(e,t,r,n)):function(t,r,n){return i((lt[t]&<[t].get||a)(e,t,r,n))})},quickSetter:function(e,t,r){var n,a;if(1<(e=kt(e)).length)return n=e.map((function(e){return Sr.quickSetter(e,t,r)})),a=n.length,function(e){for(var t=a;t--;)n[t](e)};e=e[0]||{};var i=lt[t],s=mt(e),o=s.harness&&(s.harness.aliases||{})[t]||t,l=i?function(t){var n=new i;me._pt=0,n.init(e,r?t+r:t,me,0,[e]),n.render(1,n),me._pt&&Qt(1,me)}:s.set(e,o);return i?l:function(t){return l(e,o,r?t+r:t,s,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Ht(e.ease,Le.ease)),O(Le,e||{})},config:function(e){return O(Ce,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,a=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!lt[e]&&!rt[e]&&y(t+" effect requires "+e+" plugin.")})),ct[t]=function(e,t,n){return r(kt(e),vt(t||{},a),n)},e&&(ir.prototype[t]=function(e,r,n){return this.add(ct[t](e,Ze(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){zt[e]=Ht(t)},parseEase:function(e,t){return arguments.length?Ht(e,t):zt},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,a=new ir(r);for(a.smoothChildTiming=We(r.smoothChildTiming),le.remove(a),a._dp=0,a._time=a._tTime=le._time,e=le._first;e;)t=e._next,!n&&!e._dur&&e instanceof dr&&e.vars.onComplete===e._targets[0]||I(a,e,e._start-e._delay),e=t;return I(le,a,0),a},utils:{wrap:function e(t,r,n){var a=r-t;return qe(t)?X(t,e(0,t.length),r):_t(n,(function(e){return(a+(e-t)%a)%a+t}))},wrapYoyo:function e(t,r,n){var a=r-t,i=2*a;return qe(t)?X(t,e(0,t.length-1),r):_t(n,(function(e){return t+(a<(e=(i+(e-t)%i)%i||0)?i-e:e)}))},distribute:Z,random:q,snap:K,normalize:function(e,t,r){return Y(e,t,0,1,r)},getUnit:Et,clamp:function(e,t,r){return _t(r,(function(r){return H(e,t,r)}))},splitColor:Rt,toArray:kt,selector:function(e){return e=kt(e)[0]||y("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return kt(t,r.querySelectorAll?r:r===e?y("Invalid scope")||de.createElement("div"):e)}},mapRange:Y,pipe:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(r){return e(parseFloat(r))+(t||Et(r))}},interpolate:function e(t,r,n,a){var i=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!i){var s,o,l,c,u,d=Ve(t),h={};if(!0===n&&(a=1)&&(n=null),d)t={p:t},r={p:r};else if(qe(t)&&!qe(r)){for(l=[],c=t.length,u=c-2,o=1;o<c;o++)l.push(e(t[o-1],t[o]));c--,i=function(e){e*=c;var t=Math.min(u,~~e);return l[t](e-t)},n=r}else a||(t=D(qe(t)?[]:{},t));if(!l){for(s in r)or.call(h,t,s,"get",r[s]);i=function(e){return Qt(e,h),d?t.p:t}}}return _t(n,i)},shuffle:Pt},install:b,effects:ct,ticker:Ut,updateRoot:ir.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:yr,globals:x,Tween:dr,Timeline:ir,Animation:ar,getCache:mt,_removeLinkedListItem:yt,suppressOverwrites:function(e){return oe=e}}}),wr=(M("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return xr[e]=dr[e]})),Ut.add(ir.updateRoot),me=xr.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),Sr=xr.registerPlugin({name:"attr",init:function(e,t,r,n,a){var i,s;for(i in t)(s=this.add(e,"setAttribute",(e.getAttribute(i)||0)+"",t[i],n,a,0,0,i))&&(s.op=i),this._props.push(i)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},tr("roundProps",W),tr("modifiers"),tr("snap",K))||xr;dr.version=ir.version=Sr.version="3.9.1",he=1,g()&&Nt(),zt.Power0,zt.Power1,zt.Power2,zt.Power3,zt.Power4,zt.Linear,zt.Quad,zt.Cubic,zt.Quart,zt.Quint,zt.Strong,zt.Elastic,zt.Back,zt.SteppedEase,zt.Bounce,zt.Sine,zt.Expo,zt.Circ},7995:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(6001);class a{constructor(){this.cbs=[],this.cb=e=>this.cbs.map((t=>{var r;return null==(r=t.fn)?void 0:r.call(t,e)})),this.emit=this.cb}add(e,t,r){if(!r||!this.get(e))return this.cbs.push({fn:t,name:e})}on(e,t){return this.add(t||"custom_"+(0,n.getId)(),e)}get(e){var t=this.cbs.findIndex((t=>t.name===e));if(-1!==t)return{data:this.cbs[t],index:t}}reset(e,t){return!!(e=this.get(e))&&(e.data.fn=t,!0)}remove(e){this.reset(e,null)}delete(e){void 0!==(e=(this.get(e)||{}).index)&&this.cbs.splice(e,1)}}},4230:(e,t,r)=>{r.d(t,{N:()=>l,Z:()=>o});var n=r(8881),a=r(1794),i=r(6272),s=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class o{constructor(e){this.mode="PerspectiveCamera",this.oCam=this.createOrthographic(),this.pCam=this.create(),this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"camera",map:{parse:e=>Promise.all(e.childs.map((e=>new Promise((t=>{this.setTemp(e,{time:.5,onComplete:()=>{t(0)}})})))))}})},this.clean=()=>{this.temp.clear()},this.backgroudDom=null,this.temp=new a.Z,this.pointerDown=()=>{this.closeAnima()},this.animaData={animaIns:null,onComplete:null},this.runScene=e,this.runScene.cb.events.pointer.down.add("camera",this.pointerDown),this.runScene.cb.clean.add("camera",this.clean),this.runScene.cb.inited.add("camera",this.onInited),this.runScene.cb.renderEx.setSize.add("camera",(({width:e,height:t})=>{const r=this.runScene.assetsEx.get().camera;r.aspect=e/t,r.updateProjectionMatrix(),this.setBackgroundSize(e,t)}))}setBackgroundUrl(e){return s(this,void 0,void 0,(function*(){return this.setBackground(yield(0,i.sR)(e,"blob"))}))}setBackgroundTexture(e){return s(this,void 0,void 0,(function*(){var t=e.userData.blob;return this.setBackground(t)}))}setBackground(e){this.backgroudData=e;const t=this.runScene.assetsEx.engineDom;var r,n;this.backgroudDom||(this.backgroudDom=document.createElement("div"),({width:r,height:n}=this.runScene.assetsEx.renderer.domElement.getBoundingClientRect()),this.backgroudDom.style.position="absolute",this.backgroudDom.style.left="50%",this.backgroudDom.style.top="50%",this.backgroudDom.style.transform="translate(-50%,-50%)",this.backgroudDom.style.width=r+"px",this.backgroudDom.style.height=n+"px",t.appendChild(this.backgroudDom)),this.runScene.cb.camera.set.cb({type:"background",data:e}),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+URL.createObjectURL(e)+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}setBackgroundSize(e,t){this.backgroudDom&&(this.backgroudDom.style.width=e+"px",this.backgroudDom.style.height=t+"px")}create(){return new n.PerspectiveCamera}createOrthographic(){return new n.OrthographicCamera}setMode(e){if(e!==this.mode){this.runScene.helperEx.transContro.reset(),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize();const t=this.runScene.assetsEx.get().controls;"OrthographicCamera"===e&&(t.enableRotate=!1,t.enablePan=!1)}}getCamera(){return"OrthographicCamera"===this.mode?this.oCam:this.pCam}reset(e){e.position.set(0,20,20),e.near=.1,e.far=1e3,e.fov=50,e.updateProjectionMatrix()}get(){return this.runScene.assetsEx.get().camera}setSize(){var{width:e,height:t}=this.runScene.renderEx.getDomSize();const r=this.getCamera();r.aspect=e/t,r.updateProjectionMatrix()}addTemp(e){var{name:e,data:t}=e;this.temp.set(e,{name:e,data:t})}delTemp(e){this.temp.delete(e)}getLocal(){var{camera:e,controls:t}=this.runScene.assetsEx.get(),{x:e,y:r,z:n}=e.position,{x:t,y:a,z:i}=t.target;return{x:e,y:r,z:n,tx:t,ty:a,tz:i}}closeAnima(){var e,t;null!=(e=this.animaData.animaIns)&&e.kill(),(this.animaData.animaIns=null)!=(t=(e=this.animaData).onComplete)&&t.call(e),this.animaData.onComplete=null}setTemp(e,t){return(e=this.temp.get(e))?this.anima(e.data,t):Promise.resolve()}anima(e,t){return new Promise((r=>{const{time:n,onComplete:a,onUpdate:s}=t||{},{camera:o,controls:l}=this.runScene.assetsEx.get();this.closeAnima(),this.animaData.onComplete=a,this.animaData.animaIns=(0,i.gY)(this.getLocal(),e,n||.5,(e=>{var{x:t,y:r,z:n,tx:a,ty:i,tz:c}=e;o.position.set(t,r,n),l.target.set(a,i,c),l.update(),null!=s&&s(e)}),(()=>{null!=a&&a(),r(0)}))}))}static toJSON(e){const t=e.assetsEx.get().camera;return{temp:e.cameraEx.temp.toJSON(),camera:t.toJSON()}}}const l=e=>null==e?void 0:e.isCamera},713:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>Code});var js_funcs__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6001),js_funcs__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_0__),_RunScene__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1715),_Libs_Three__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6292),_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(6272);class Code{constructor(e){this.inited=()=>{this.bindEvent()},this.str={const:"",code:"()=>{}"},(this.runScene=e).cb.inited.add("code",this.inited),e.cb.clean.add("code",(()=>{this.str={const:void 0,code:void 0}}))}set(e,t){this.str[e]=_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.encrypt(t)}get(e){return _Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.decrypt(this.str[e])}bindEvent(){this.runScene.exporter.gltf.options.addOption({type:"code",process:()=>JSON.stringify(this.str),parse:e=>{if(e)try{var t=JSON.parse(e);this.str=t}catch(e){}}})}copy(e){return this.mergeStr(this.get("code"),e)}mergeStr(e,t){let r=`(map)=>{\n const { \n camera,\n scene,\n controls,\n renderer,\n render2,\n render3,\n bus,\n runScene,\n getModel,\n core,\n Three,\n constant,\n Utils,\n } = map;\n /**\n *以下为内置环境变量 可直接使用 不可重复定义\n *camera,\n *scene,\n *controls,\n *renderer,\n *render2,\n *render3,\n *bus,\n *runScene,\n *getModel,\n *core:各导出模块挂载的根对象,\n *Three,\n *constant:常亮对象,\n *Utils,\n */\n ${e}\n };`;return t?`(runScene, inputData= {}, constant= {})=>{\n const fn = ${r}\n const modules = fn({\n runScene,\n getModel: runScene.modelEx.getModel.bind(runScene.modelEx),\n core: runScene.custom,\n ...runScene.assetsEx.get(),\n ...inputData,\n Three,\n constant,\n window:null,\n });\n if(!modules) return;\n modules.map((TheClass) => {\n const ins = new TheClass();\n if (!ins.name) throw TypeError("代码出错");\n runScene.custom[ins.name] = ins;\n return ins;\n }).map((ins)=>ins.mounted?.())\n }`:r}getParms(){return{base:{Three:_Libs_Three__WEBPACK_IMPORTED_MODULE_2__.Z,Utils:_RunScene__WEBPACK_IMPORTED_MODULE_1__.cQ,window:null},other:Object.assign(Object.assign({bus:new _RunScene__WEBPACK_IMPORTED_MODULE_1__.Gc},this.runScene.assetsEx.get()),{runScene:this.runScene,getModel:this.runScene.modelEx.getModel.bind(this.runScene.modelEx),core:this.runScene.custom})}}getAll(){return{code:_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.decrypt(this.str.code),const:_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.decrypt(this.str.const)}}createFunc(map){const tMap=map||this.getAll(),tStr=this.mergeStr(tMap.code||"()=>{}"),fn=eval(tStr),constFn=eval(" ()=>{"+tMap.const+"};"),baseData=this.getParms();return(e={})=>{e=Object.assign(Object.assign(Object.assign(Object.assign({},baseData.other),e),baseData.base),{constant:constFn()||{}});const t=fn(e);null!=t&&t.map((e=>{if(!(e=new e).name)throw TypeError("代码出错");this.runScene.custom[e.name]=e})),(0,js_funcs__WEBPACK_IMPORTED_MODULE_0__.mapObj)(this.runScene.custom,((e,t)=>{var r;return null==(r=t.mounted)?void 0:r.call(t)})),e.bus}}run(){this.createFunc()()}}},4330:(e,t,r)=>{r.d(t,{sG:()=>n,zX:()=>a});const n=["map","normalMap","aoMap"],a=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},3263:(e,t,r)=>{r.d(t,{F6:()=>n,YD:()=>p});var n={};r.r(n),r.d(n,{filter:()=>a,findMultiIndex:()=>d,findThenDel:()=>u,isDef:()=>l,isEmpty:()=>i,isTrues:()=>h,notEmpty:()=>s,random:()=>o,toArr:()=>c});const a=e=>e.filter((e=>e)),i=e=>0===e.length,s=e=>0!==e.length,o=e=>{var t=Math.random()*e.length;return e[Math.floor(t)]},l=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!0;return!1},c=e=>Array.isArray(e)?e:[e],u=(e,t)=>-1!==(t=e.findIndex(t))&&(e.splice(t,1),!0),d=(e,t)=>e.map(((e,r)=>t(e)?r:void 0)).filter((e=>void 0!==e)),h=e=>{for(const t of e)if(!t)return!1;return!0};r(1794),r(272);var p=r(7201)},1794:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(6001);class a extends Map{constructor(e){e?super((0,n.mapObj)(e,((e,t)=>[e,t]))):super()}toArray(e){let t=[];for(const r of this.entries())"key"==e?t.push(r[0]):t.push(r[1]);return t}map(e){return[...this.entries()].map((t=>{var[t,r]=t;return e(t,r)}))}toJSON(){const e={};return this.forEach(((t,r)=>{e[r]=t})),e}toString(){return JSON.stringify(this.map)}filterData(e){let t=[];for(var[r,n]of this.entries())e(r,n)&&t.push({key:r,val:n});return t}find(e){for(var[t,r]of this.entries())if(e(t,r))return r}static formJSON(e){return new a(e)}copy(e){e.map(((e,t)=>this.set(e,t)))}}},7201:(e,t,r)=>{r.r(t),r.d(t,{is:()=>i,isDef:()=>a,logObj:()=>u,objLength:()=>d,objToStr:()=>c,replaceKVForObj:()=>o,replaceKeyForObj:()=>l,replaceValForObj:()=>s});var n=r(6001);const a=(e,t)=>{if(!i(e))return!0;var r=Object.keys(e);for(let o=0;o<r.length;o++){var n=r[o],s=e[n];if(n=t[n],i(s))return!i(n)||a(s,n);if(s!==n)return!0}return!1},i=e=>(null==e?void 0:e.constructor)===Object,s=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[n]=t(n,i,a)})),r},o=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n],{k:n,v:i}=t(n,i,a);r[n]=i})),r},l=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[t(n,i,a)]=i})),r},c=e=>{let t="";return(0,n.mapObj)(e,((e,r)=>{t=(t+=e+":")+(i(r)?c(r):r)})),t},u=e=>{console.log(c(e))},d=e=>Object.keys(e).length},272:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends Set{constructor(e){super(),this.isSet=!0,null!=e&&e.map((e=>this.add(e)))}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const r=[];return this.forEach((n=>{if(n=e(n),!t)return r.push(n);n&&r.push(n)})),r}find(e){for(const t of this)if(e(t))return t}findThenDel(e){for(const t of this)if(e(t))return this.delete(t),!0}filter(e){const t=[];for(const r of this)e(r)&&t.push(r);return t}toJSON(){return this.toArray()}}},6292:(e,t,r)=>{r.d(t,{z:()=>d,Z:()=>h});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l={type:"change"},c={type:"start"},u={type:"end"},d=function(e){var t=d;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(r=t?(r=o(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return s(n)}}(d);function d(e,t){var a,i,o,h,p,m,f,g;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");(a=r.call(this)).object=e,a.domElement=t,a.domElement.style.touchAction="none",a.enabled=!0,a.target=new n.Vector3,a.minDistance=0,a.maxDistance=1/0,a.minZoom=0,a.maxZoom=1/0,a.minPolarAngle=0,a.maxPolarAngle=Math.PI,a.minAzimuthAngle=-1/0,a.maxAzimuthAngle=1/0,a.enableDamping=!1,a.dampingFactor=.05,a.enableZoom=!0,a.zoomSpeed=1,a.enableRotate=!0,a.rotateSpeed=1,a.enablePan=!0,a.panSpeed=1,a.screenSpacePanning=!0,a.keyPanSpeed=7,a.autoRotate=!1,a.autoRotateSpeed=2,a.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},a.mouseButtons={LEFT:n.MOUSE.ROTATE,MIDDLE:n.MOUSE.DOLLY,RIGHT:n.MOUSE.PAN},a.touches={ONE:n.TOUCH.ROTATE,TWO:n.TOUCH.DOLLY_PAN},a.target0=a.target.clone(),a.position0=a.object.position.clone(),a.zoom0=a.object.zoom,a._domElementKeyEvents=null,a.getPolarAngle=function(){return w.phi},a.getAzimuthalAngle=function(){return w.theta},a.getDistance=function(){return this.object.position.distanceTo(this.target)},a.listenToKeyEvents=function(e){e.addEventListener("keydown",se),this._domElementKeyEvents=e},a.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",se),this._domElementKeyEvents=null},a.saveState=function(){v.target0.copy(v.target),v.position0.copy(v.object.position),v.zoom0=v.object.zoom},a.reset=function(){v.target.copy(v.target0),v.object.position.copy(v.position0),v.object.zoom=v.zoom0,v.object.updateProjectionMatrix(),v.dispatchEvent(l),v.update(),y=b.NONE},a.update=(i=new n.Vector3,o=(new n.Quaternion).setFromUnitVectors(e.up,new n.Vector3(0,1,0)),h=o.clone().invert(),p=new n.Vector3,m=new n.Quaternion,f=new n.Vector3,g=2*Math.PI,function(){var e=v.object.position,t=(i.copy(e).sub(v.target),i.applyQuaternion(o),w.setFromVector3(i),v.autoRotate&&y===b.NONE&&U(2*Math.PI/60/60*v.autoRotateSpeed),v.enableDamping?(w.theta+=S.theta*v.dampingFactor,w.phi+=S.phi*v.dampingFactor):(w.theta+=S.theta,w.phi+=S.phi),v.minAzimuthAngle),r=v.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=g:t>Math.PI&&(t-=g),r<-Math.PI?r+=g:r>Math.PI&&(r-=g),w.theta=t<=r?Math.max(t,Math.min(r,w.theta)):w.theta>(t+r)/2?Math.max(t,w.theta):Math.min(r,w.theta)),w.phi=Math.max(v.minPolarAngle,Math.min(v.maxPolarAngle,w.phi)),w.makeSafe(),w.radius*=M,w.radius=Math.max(v.minDistance,Math.min(v.maxDistance,w.radius)),!0===v.enableDamping?v.target.addScaledVector(T,v.dampingFactor):v.target.add(T),i.setFromSpherical(w),i.applyQuaternion(h),e.copy(v.target).add(i),v.object.lookAt(v.target),!0===v.enableDamping?(S.theta*=1-v.dampingFactor,S.phi*=1-v.dampingFactor,T.multiplyScalar(1-v.dampingFactor)):(S.set(0,0,0),T.set(0,0,0)),M=1,!(!(_||p.distanceToSquared(v.object.position)>x||8*(1-m.dot(v.object.quaternion))>x||0<f.distanceToSquared(v.target))||(v.dispatchEvent(l),p.copy(v.object.position),m.copy(v.object.quaternion),f.copy(v.target),_=!1))}),a.dispose=function(){v.domElement.removeEventListener("contextmenu",oe),v.domElement.removeEventListener("pointerdown",re),v.domElement.removeEventListener("pointercancel",ae),v.domElement.removeEventListener("wheel",ie),v.domElement.removeEventListener("pointermove",ne),v.domElement.removeEventListener("pointerup",ae),null!==v._domElementKeyEvents&&(v._domElementKeyEvents.removeEventListener("keydown",se),v._domElementKeyEvents=null)};var v=s(a),b={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},y=b.NONE,x=1e-6,w=new n.Spherical,S=new n.Spherical,M=1,T=new n.Vector3,_=!1,E=new n.Vector2,D=new n.Vector2,O=new n.Vector2,k=new n.Vector2,P=new n.Vector2,A=new n.Vector2,C=new n.Vector2,L=new n.Vector2,R=new n.Vector2,I=[],B={};function j(){return Math.pow(.95,v.zoomSpeed)}function U(e){S.theta-=e}function N(e){S.phi-=e}z=new n.Vector3;var z,F,V,G=function(e,t){z.setFromMatrixColumn(t,0),z.multiplyScalar(-e),T.add(z)},H=(F=new n.Vector3,function(e,t){!0===v.screenSpacePanning?F.setFromMatrixColumn(t,1):(F.setFromMatrixColumn(t,0),F.crossVectors(v.object.up,F)),F.multiplyScalar(e),T.add(F)}),Z=(V=new n.Vector3,function(e,t){var r,n=v.domElement;v.object.isPerspectiveCamera?(r=v.object.position,V.copy(r).sub(v.target),r=V.length(),r*=Math.tan(v.object.fov/2*Math.PI/180),G(2*e*r/n.clientHeight,v.object.matrix),H(2*t*r/n.clientHeight,v.object.matrix)):v.object.isOrthographicCamera?(G(e*(v.object.right-v.object.left)/v.object.zoom/n.clientWidth,v.object.matrix),H(t*(v.object.top-v.object.bottom)/v.object.zoom/n.clientHeight,v.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),v.enablePan=!1)});function W(e){v.object.isPerspectiveCamera?M/=e:v.object.isOrthographicCamera?(v.object.zoom=Math.max(v.minZoom,Math.min(v.maxZoom,v.object.zoom*e)),v.object.updateProjectionMatrix(),_=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),v.enableZoom=!1)}function K(e){v.object.isPerspectiveCamera?M*=e:v.object.isOrthographicCamera?(v.object.zoom=Math.max(v.minZoom,Math.min(v.maxZoom,v.object.zoom/e)),v.object.updateProjectionMatrix(),_=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),v.enableZoom=!1)}function q(e){E.set(e.clientX,e.clientY)}function X(e){k.set(e.clientX,e.clientY)}function Y(){var e,t;1===I.length?E.set(I[0].pageX,I[0].pageY):(e=.5*(I[0].pageX+I[1].pageX),t=.5*(I[0].pageY+I[1].pageY),E.set(e,t))}function Q(){var e,t;1===I.length?k.set(I[0].pageX,I[0].pageY):(e=.5*(I[0].pageX+I[1].pageX),t=.5*(I[0].pageY+I[1].pageY),k.set(e,t))}function J(){var e=I[0].pageX-I[1].pageX,t=I[0].pageY-I[1].pageY;e=Math.sqrt(e*e+t*t),C.set(0,e)}function $(e){1==I.length?D.set(e.pageX,e.pageY):(r=ce(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),D.set(t,e)),O.subVectors(D,E).multiplyScalar(v.rotateSpeed);var t,r=v.domElement;U(2*Math.PI*O.x/r.clientHeight),N(2*Math.PI*O.y/r.clientHeight),E.copy(D)}function ee(e){var t,r;1===I.length?P.set(e.pageX,e.pageY):(t=ce(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),P.set(r,e)),A.subVectors(P,k).multiplyScalar(v.panSpeed),Z(A.x,A.y),k.copy(P)}function te(e){var t=ce(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),L.set(0,t),R.set(0,Math.pow(L.y/C.y,v.zoomSpeed)),W(R.y),C.copy(L)}function re(e){if(!1!==v.enabled)if(0===I.length&&(v.domElement.setPointerCapture(e.pointerId),v.domElement.addEventListener("pointermove",ne),v.domElement.addEventListener("pointerup",ae)),I.push(e),"touch"===e.pointerType){switch(le(e),I.length){case 1:switch(v.touches.ONE){case n.TOUCH.ROTATE:if(!1===v.enableRotate)return;Y(),y=b.TOUCH_ROTATE;break;case n.TOUCH.PAN:if(!1===v.enablePan)return;Q(),y=b.TOUCH_PAN;break;default:y=b.NONE}break;case 2:switch(v.touches.TWO){case n.TOUCH.DOLLY_PAN:if(!1===v.enableZoom&&!1===v.enablePan)return;v.enableZoom&&J(),v.enablePan&&Q(),y=b.TOUCH_DOLLY_PAN;break;case n.TOUCH.DOLLY_ROTATE:if(!1===v.enableZoom&&!1===v.enableRotate)return;v.enableZoom&&J(),v.enableRotate&&Y(),y=b.TOUCH_DOLLY_ROTATE;break;default:y=b.NONE}break;default:y=b.NONE}y!==b.NONE&&v.dispatchEvent(c)}else{var t,r=e;switch(r.button){case 0:t=v.mouseButtons.LEFT;break;case 1:t=v.mouseButtons.MIDDLE;break;case 2:t=v.mouseButtons.RIGHT;break;default:t=-1}switch(t){case n.MOUSE.DOLLY:if(!1===v.enableZoom)return;!function(e){C.set(e.clientX,e.clientY)}(r),y=b.DOLLY;break;case n.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===v.enablePan)return;X(r),y=b.PAN}else{if(!1===v.enableRotate)return;q(r),y=b.ROTATE}break;case n.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===v.enableRotate)return;q(r),y=b.ROTATE}else{if(!1===v.enablePan)return;X(r),y=b.PAN}break;default:y=b.NONE}y!==b.NONE&&v.dispatchEvent(c)}}function ne(e){if(!1!==v.enabled)if("touch"===e.pointerType){var t=e;switch(le(t),y){case b.TOUCH_ROTATE:if(!1===v.enableRotate)return;$(t),v.update();break;case b.TOUCH_PAN:if(!1===v.enablePan)return;ee(t),v.update();break;case b.TOUCH_DOLLY_PAN:if(!1===v.enableZoom&&!1===v.enablePan)return;!function(e){v.enableZoom&&te(e),v.enablePan&&ee(e)}(t),v.update();break;case b.TOUCH_DOLLY_ROTATE:if(!1===v.enableZoom&&!1===v.enableRotate)return;!function(e){v.enableZoom&&te(e),v.enableRotate&&$(e)}(t),v.update();break;default:y=b.NONE}}else{var r=e;switch(y){case b.ROTATE:if(!1===v.enableRotate)return;!function(e){D.set(e.clientX,e.clientY),O.subVectors(D,E).multiplyScalar(v.rotateSpeed),e=v.domElement,U(2*Math.PI*O.x/e.clientHeight),N(2*Math.PI*O.y/e.clientHeight),E.copy(D),v.update()}(r);break;case b.DOLLY:if(!1===v.enableZoom)return;!function(e){L.set(e.clientX,e.clientY),R.subVectors(L,C),0<R.y?W(j()):R.y<0&&K(j()),C.copy(L),v.update()}(r);break;case b.PAN:if(!1===v.enablePan)return;!function(e){P.set(e.clientX,e.clientY),A.subVectors(P,k).multiplyScalar(v.panSpeed),Z(A.x,A.y),k.copy(P),v.update()}(r)}}}function ae(e){!function(e){delete B[e.pointerId];for(var t=0;t<I.length;t++)if(I[t].pointerId==e.pointerId)return I.splice(t,1)}(e),0===I.length&&(v.domElement.releasePointerCapture(e.pointerId),v.domElement.removeEventListener("pointermove",ne),v.domElement.removeEventListener("pointerup",ae)),v.dispatchEvent(u),y=b.NONE}function ie(e){!1!==v.enabled&&!1!==v.enableZoom&&y===b.NONE&&(e.preventDefault(),v.dispatchEvent(c),e.deltaY<0?K(j()):0<e.deltaY&&W(j()),v.update(),v.dispatchEvent(u))}function se(e){if(!1!==v.enabled&&!1!==v.enablePan){var t=e,r=!1;switch(t.code){case v.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?N(2*Math.PI*v.rotateSpeed/v.domElement.clientHeight):Z(0,v.keyPanSpeed),r=!0;break;case v.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?N(-2*Math.PI*v.rotateSpeed/v.domElement.clientHeight):Z(0,-v.keyPanSpeed),r=!0;break;case v.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?U(2*Math.PI*v.rotateSpeed/v.domElement.clientHeight):Z(v.keyPanSpeed,0),r=!0;break;case v.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?U(-2*Math.PI*v.rotateSpeed/v.domElement.clientHeight):Z(-v.keyPanSpeed,0),r=!0}r&&(t.preventDefault(),v.update())}}function oe(e){!1!==v.enabled&&e.preventDefault()}function le(e){var t=B[e.pointerId];void 0===t&&(t=new n.Vector2,B[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ce(e){return e=e.pointerId===I[0].pointerId?I[1]:I[0],B[e.pointerId]}return v.domElement.addEventListener("contextmenu",oe),v.domElement.addEventListener("pointerdown",re),v.domElement.addEventListener("pointercancel",ae),v.domElement.addEventListener("wheel",ie,{passive:!1}),a.update(),a}return t=d,Object.defineProperty(t,"prototype",{writable:!1}),t}(n.EventDispatcher);const h=n},7625:(e,t,r)=>{r.d(t,{Z:()=>n});class n{constructor(e){this.snapshot={create:e=>({}),set(e){}},this.runScene=e}}},7585:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(8609),a=r(3736),i=r(1398),s=r(2233),o=r(5317);t=r(7625);const l={far:1e5,near:.5,mapSizeX:512,scaleX:1,targetPosition:{x:0,y:-10,z:0}},c={position:{type:"v3",val:{x:0,y:10,z:0},shortKey:"p"},intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class u extends t.Z{constructor(){super(...arguments),this.type="DirectionalLight",this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,n.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},u.toJSON(t)),e}}}static toJSON(e){const{intensity:t,name:r,type:n,position:a,visible:i,color:o,castShadow:l,shadow:c,rotation:u,target:d}=e;var{mapSize:h,camera:p}=c,{scale:p,near:m,far:f}=p;return{type:n,intensity:t,name:r,visible:i,color:o.getHexString(),castShadow:l,shadow:{mapSize:h.x,camera:{near:m,far:f,scale:p.x}},id:(0,s.Ki)(e),position:{x:a.x,y:a.y,z:a.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:d.position.x,y:d.position.y,z:d.position.z}}}parseJSON(e,t){t=this.runScene.lightEx.get("DirectionalLight",t);var[r]=t;return u.setConfig(r,e),(0,a.M)(r,"id",e.id),t}get(e){return this.runScene.lightEx.get("DirectionalLight",e)}static setConfig(e,t){var{intensity:t,position:r,rotation:n,targetPosition:a,name:i,visible:s,color:l,castShadow:c,shadow:u}=t,{mapSize:u,camera:d}=u,{scale:d,near:h,far:p}=d;e.intensity=t,e.name=i,e.visible=s,e.castShadow=c,e.color=(0,o.getColorByHexStr)(l),r&&e.position.set(r.x,r.y,r.z),n&&e.rotation.set(n.x,n.y,n.z),a&&e.target.position.set(a.x,a.y,a.z),e.add(e.target),e.shadow.mapSize.x=u,e.shadow.mapSize.y=u,e.shadow.camera.scale.x=d,e.shadow.camera.scale.y=d,e.shadow.camera.scale.z=d,e.shadow.camera.near=h,e.shadow.camera.far=p,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}setConfig(e,t){return u.setConfig(e,t)}}u.snapshot={create:e=>{const t=i.LV.getDiff(c,e);var r=e.shadow,{mapSize:r,camera:n}=r,{scale:n,near:a,far:s}=n,{x:e,y:u,z:d}=e.target.position;return(0,o.isDef)(r.x,l.mapSizeX)&&(t.m=r.x),(0,o.isDef)({x:e,y:u,z:d},l.targetPosition)&&(t.tp={x:e,y:u,z:d}),(0,o.isDef)(n.x,l.scaleX)&&(t.s=n.x),(0,o.isDef)(a,l.near)&&(t.n=a),(0,o.isDef)(s,l.far)&&(t.f=s),t},set:e=>{const{map:t,light:r,runScene:n,data:a}=e,{m:s,tp:o,s:u,n:d,f:h}=(i.LV.set({def:c,data:a,runScene:n,map:t,target:r}),a);t.data.completedCbs.push((()=>{var{far:e,near:t,mapSizeX:n,scaleX:a,targetPosition:i}=l,{x:i,y:c,z:p}=o||i,i=(r.target.position.set(i,c,p),s||n),c=(r.shadow.mapSize.x=i,r.shadow.mapSize.y=i,u||a);r.shadow.camera.scale.x=c,r.shadow.camera.scale.y=c,r.shadow.camera.scale.z=c,r.shadow.camera.near=d||t,r.shadow.camera.far=h||e,r.shadow.camera.updateProjectionMatrix(),null!=(p=r.cameraHelper)&&p.update()}))}}},1269:(e,t,r)=>{r.d(t,{ZP:()=>O,RQ:()=>k});var n=r(6001),a=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(n);function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var i=new a.BufferGeometry,s=(i.setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),new a.LineBasicMaterial({fog:!1}));return((i=r.call(this,i,s)).light=e,i.color=t,i.type="RectAreaLightHelper",s=new a.BufferGeometry).setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),i.add(new a.Mesh(s,new a.MeshBasicMaterial({side:a.BackSide,fog:!1}))),i}return t=n,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.Line),u=r(6292),d=r(3736),h=r(1398),p=r(2233),m=(t=r(7625),r(8609));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 g extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},g.toJSON(t)),e}},this.type="AmbientLight"}get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i}=e;return{type:t,intensity:r,name:n,visible:a,id:(0,p.Ki)(e),color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i}=t;return e.intensity=r,e.type=t,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e}parseJSON(e,t){t=this.runScene.lightEx.get("AmbientLight",t);var[r]=t,n=e.id;return this.setConfig(r,e),(0,d.M)(r,"id",n),t}}g.snapshot={create:e=>h.LV.getDiff(f,e),set:e=>{var{map:e,light:t,runScene:r,data:n}=e;h.LV.set({def:f,data:n,runScene:r,map:e,target:t})}};var v=r(7585);class b extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},b.toJSON(t)),e}},this.type="HemisphereLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,groundColor:s,position:o}=e;return{name:n,id:(0,p.Ki)(e),type:t,intensity:r,visible:a,position:{x:o.x,y:o.y,z:o.z},groundColor:s.getHexString(),color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i,groundColor:s,position:o}=t;e.type=t,e.intensity=r,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e.groundColor=new u.Z.Color("#"+s),e.position.set(o.x,o.y,o.z)}parseJSON(e,t){t=this.runScene.lightEx.get("HemisphereLight",t);var[r]=t,n=e.id;return this.setConfig(r,e),(0,d.M)(r,"id",n),t}}class y extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},y.toJSON(t)),e}},this.type="PointLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:a,decay:i,renderOrder:s,color:o,visible:l,castShadow:c,shadow:u,position:d}=e;var{mapSize:h,camera:m,bias:f,radius:g}=u,{scale:m,near:v,far:b}=m;return{name:t,type:r,intensity:n,visible:l,color:o.getHexString(),castShadow:c,id:(0,p.Ki)(e),distance:a,decay:i,renderOrder:s,shadow:{mapSize:h.x,camera:{near:v,far:b,scale:m.x},radius:g,bias:f},position:{x:d.x,y:d.y,z:d.z}}}setConfig(e,t){var{name:t,type:r,intensity:n,distance:a,decay:i,renderOrder:s,color:o,visible:l,castShadow:c,shadow:d,position:h}=t,{mapSize:d,camera:p,bias:m,radius:f}=d,{scale:p,near:g,far:v}=p;e.intensity=n,e.type=r,e.name=t,e.visible=l,e.castShadow=c,e.distance=a,e.renderOrder=s,e.color=new u.Z.Color("#"+o),e.position.set(h.x,h.y,h.z),e.shadow.mapSize.x=d,e.shadow.mapSize.y=d,e.shadow.bias=m,e.decay=i,e.shadow.radius=f,e.shadow.camera.scale.x=p,e.shadow.camera.scale.y=p,e.shadow.camera.scale.z=p,e.shadow.camera.near=g,e.shadow.camera.far=v,e.shadow.camera.updateProjectionMatrix()}parseJSON(e,t){t=this.runScene.lightEx.get("PointLight",t);var[r]=t,n=e.id;return this.setConfig(r,e),(0,d.M)(r,"id",n),t}}class x extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},x.toJSON(t)),e}},this.type="RectAreaLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,position:s}=e;return{name:n,type:t,intensity:r,id:(0,p.Ki)(e),visible:a,position:{x:s.x,y:s.y,z:s.z},color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i,position:s}=t;e.type=t,e.intensity=r,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e.position.set(s.x,s.y,s.z)}parseJSON(e,t){t=this.runScene.lightEx.get("RectAreaLight",t);var[r]=t,n=e.id;return this.setConfig(r,e),(0,d.M)(r,"id",n),t}}class w extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},w.toJSON(t)),e}},this.type="SpotLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,color:n,distance:a,decay:i,intensity:s,angle:o,penumbra:l,visible:c,castShadow:u,shadow:d,renderOrder:h,position:m,target:f}=e;var{bias:g,camera:v,normalBias:b,mapSize:y,radius:x}=d,v=v.near;return{type:r,intensity:s,name:t,visible:c,distance:a,angle:o,id:(0,p.Ki)(e),decay:i,penumbra:l,renderOrder:h,color:n.getHexString(),castShadow:u,shadow:{bias:g,normalBias:b,mapSize:y.x,camera:{near:v},radius:x},position:{x:m.x,y:m.y,z:m.z},targetPosition:{x:f.position.x,y:f.position.y,z:f.position.z}}}setConfig(e,t){var{name:t,type:r,color:n,distance:a,decay:i,intensity:s,angle:o,penumbra:l,visible:c,castShadow:d,shadow:h,renderOrder:p,position:m,targetPosition:f}=t,{bias:h,camera:g,normalBias:v,mapSize:b,radius:y}=h,g=g.near;return e.intensity=s,e.type=r,e.name=t,e.visible=c,e.distance=a,e.decay=i,e.angle=o,e.penumbra=l,e.renderOrder=p,e.castShadow=d,e.color=new u.Z.Color("#"+n),e.position.set(m.x,m.y,m.z),e.shadow.mapSize.x=b,e.shadow.mapSize.y=b,e.shadow.camera.near=g,e.target.position.set(f.x,f.y,f.z),e.shadow.bias=h,e.shadow.normalBias=v,e.shadow.radius=y,e.shadow.camera.updateProjectionMatrix(),e}parseJSON(e,t){t=this.runScene.lightEx.get("SpotLight",t);var[r]=t,n=e.id;return this.setConfig(r,e),(0,d.M)(r,"id",n),t}}var S=r(3735),M=r(2510),T=r(7169),_=r(5317),E=r(7201);const D={DirectionalLight:v.Z,PointLight:y,SpotLight:w,RectAreaLight:x,HemisphereLight:b,AmbientLight:g};class O{constructor(e){this.inited=()=>{(0,n.mapObj)(this.lightExMap,((e,t)=>{this.runScene.modelEx.importAndExport.addParses(t.type,{parse:t.parseNromalLight,toNormal:t.toNormalLight})}))},this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.snapshot={create:e=>{const t=this.runScene.uniqueEx.model.getModelsByType("light"),r={};t.map((e=>{var t=e.type,n=(0,p.Ki)(e),a=null==(a=null==(t=D[t].snapshot)?void 0:t.create)?void 0:a.call(t,e);a&&n&&(r[n]=a)})),0!==(0,E.objLength)(r)&&e.data.set("light",r)},set:e=>{var t=e.snapshot.data.get("light");t&&(0,n.mapObj)(t,((t,r)=>{var n,a=((t=this.runScene.modelEx.getById(t))||{}).type;a&&null!=(n=null==(a=D[a].snapshot)?void 0:a.set)&&n.call(a,{data:r,runScene:this.runScene,light:t,map:e})}))}},this.setAllHelpers=e=>{this.getAll().map((t=>{this.setHelperState(t,e)}))},this.runScene=e,this.lightExMap={DirectionalLight:new v.Z(e),PointLight:new y(e),SpotLight:new w(e),RectAreaLight:new x(e),HemisphereLight:new b(e),AmbientLight:new g(e)},e.cb.snapshot.create.add("light",this.snapshot.create),e.cb.snapshot.delUseless.add("light",(t=>{(0,n.mapObj)(t,((t,r)=>{const a=r.data.light;a&&((0,n.mapObj)(a,(t=>{e.uniqueEx.model.has(t)||delete a[t]})),0===(0,E.objLength)(a)&&delete r.data.light)}))})),e.cb.snapshot.set.add("light",this.snapshot.set),e.cb.snapshot.getLength.add("light",(e=>{var t=e.data.data.get("light");t&&(e.inputData.light=Object.keys(t).length)})),e.cb.inited.add("light",this.inited)}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:!!k(e)&&t.select,addUndo:!1})))),t.addUndo&&this.runScene.undoEx.addUndo(e)}get(e,t){t=(0,_.mergeObject)({id:(0,n.getId)()},t).id;let r=new u.Z[e],a=[r];return r.position.y=10,r.name=e,r.userData.id=t,this.shadowList.includes(e)&&(r.castShadow=!0),this.setLight(r),a.push(...this.setLightHelper(r)),null!=(t=null==r?void 0:r.lightHelper)&&t.update(),a}setNull(e){e.lightTarget&&this.setNull(e.lightTarget),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.lightTarget&&this.setSelect(e.lightTarget),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.lightTarget&&(e=e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(null!=(t=e.helper)&&t.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new T.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)):[e,e.helper].map((t=>{if(t)return new T.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&r&&this.runScene.undoEx.addUndo(r),r}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const r=(0,p.Ki)(t);let n,a=[];switch(e){case"RectAreaLight":n=new c(t,16773120);break;case"DirectionalLight":if(n=new u.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new u.Z.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.lightTarget=t).add(e)}t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();const e=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=r,e.userData.unClick=!0})),e.userData.id=r,e.userData.unClick=!0,e.visible=!1,t.cameraHelper=e,a.push(e);break;case"PointLight":n=new u.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new u.Z.SpotLightHelper(t);let i=new u.Z.Object3D;(t.target=i).name="helperModel",i.userData.isLightTarget=!0,i.lightTarget=t,i.position.y=-10,t.shadow.autoUpdate=!0,t.add(i);const s=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(s,!0,(e=>{e.userData.id=r})),s.userData.id=r,s.visible=!1,t.cameraHelper=s,a.push(s);break;case"HemisphereLight":n=new u.Z.HemisphereLightHelper(t,1,16773135)}return n.name="helperModel",this.runScene.helperEx.setHelper(n,!0,(e=>{e.userData.id=r})),n.userData.id=r,(n.light=t).helper=n,this.update(t),a.push(n),a}setLightHelper(e){return"editor"===this.runScene.optionsEx.options.mode&&this.helperList.includes(e.type)?this.getLightHelper(e.type,e):[]}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:r,val:n,cb:a}=e;return new M.Z({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:a}).execute()}setMultip(e,t,r=!0,n=!0){if(e instanceof Array)return a=e.map((e=>{var{model:e,typeList:n,newVal:a}=e;const i=new S.Z({target:e,typeList:n,newVal:a,cb:t});return r?i.execute():i})),n&&this.runScene.undoEx.addUndo(a),a;{var{model:a,typeList:e,newVal:i}=e;const s=new S.Z({target:a,typeList:e,newVal:i,cb:t});return n&&this.runScene.undoEx.addUndo(s),r?s.execute():s}}isLight(e){return null==(e=null==e?void 0:e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){var t=D[e.type].toJSON(e),r=this.get(e.type),[n]=r;return this.lightExMap[e.type].setConfig(n,t),r}toJSON(e){return e.filter((e=>!(0,m.isHelper)(e))).map((e=>D[e.type].toJSON(e)))}getAll(){return this.runScene.uniqueEx.model.find((e=>"light"===e.type))}setHelperState(e,t){this.helperList.includes(e.type)&&(e.helper.visible=t)}}const k=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},2353:(e,t,r)=>{r.d(t,{B:()=>Ie,Z:()=>Re});var n=r(8881),a=(t=r(3300),r.n(t));function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}r(6001);var s=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!==("undefined"==typeof WebAssembly?"undefined":i(WebAssembly)))return{supported:!1};var r,n=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",a=WebAssembly.instantiate(s(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));function s(e){for(var r=new Uint8Array(e.length),n=0;n<e.length;++n){var a=e.charCodeAt(n);r[n]=96<a?a-97:64<a?a-39:a+4}var i=0;for(n=0;n<e.length;++n)r[i++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,i)}function o(e,t,n,a,i,s){var o=r.exports.sbrk,l=n+3&-4,c=o(l*a),u=o(i.length),d=new Uint8Array(r.exports.memory.buffer);if(0==(d.set(i,u),e=e(c,n,a,u,i.length))&&s&&s(c,l,a),t.set(d.subarray(c,c+n*a)),o(c-o(0)),0!=e)throw new Error("Malformed buffer data: "+e)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},c={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],d=0;return{ready:a,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s(n))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+o.toString()+function(e){a.then((function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);o(r.exports[t.mode],n,t.count,t.size,t.source,r.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:n},[n.buffer])}catch(n){self.postMessage({id:t.id,count:t.count,action:"reject",value:n})}}))}.toString(),i=(t=new Blob([t],{type:"text/javascript"}),URL.createObjectURL(t)),l=0;l<e;++l)u[l]=function(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){e=e.data,t.pending-=e.count,t.requests[e.id][e.action](e.value),delete t.requests[e.id]},t}(i);URL.revokeObjectURL(i)}(e)},decodeVertexBuffer:function(e,t,n,a,i){o(r.exports.meshopt_decodeVertexBuffer,e,t,n,a,r.exports[l[i]])},decodeIndexBuffer:function(e,t,n,a){o(r.exports.meshopt_decodeIndexBuffer,e,t,n,a)},decodeIndexSequence:function(e,t,n,a){o(r.exports.meshopt_decodeIndexSequence,e,t,n,a)},decodeGltfBuffer:function(e,t,n,a,i,s){o(r.exports[c[i]],e,t,n,a,r.exports[l[s]])},decodeGltfBufferAsync:function(e,t,n,i,s){if(0<u.length){for(var h=e,p=t,m=n,f=c[i],g=l[s],v=u[0],b=1;b<u.length;++b)u[b].pending<v.pending&&(v=u[b]);return new Promise((function(e,t){var r=new Uint8Array(m),n=d++;v.pending+=h,v.requests[n]={resolve:e,reject:t},v.object.postMessage({id:n,count:h,size:p,source:r,mode:f,filter:g},[r.buffer])}))}return a.then((function(){var a=new Uint8Array(e*t);return o(r.exports[c[i]],a,e,t,n,r.exports[l[s]]),a}))}}}();function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=new WeakMap,h=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=c(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,r,a){var i=this,s=new n.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){i.parse(e,t,a)}),r,a)}},{key:"parse",value:function(e,t,r){this.decodeDracoFile(e,t,null,null,n.SRGBColorSpace).catch(r)}},{key:"decodeDracoFile",value:function(e,t,r,a){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:n.LinearSRGBColorSpace;return a={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:i},this.decodeGeometry(e,a).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,n=this,a=JSON.stringify(t);if(d.has(e)){if((s=d.get(e)).key===a)return s.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var i=this.workerNextTaskID++,s=e.byteLength;return s=this._getWorker(i,s).then((function(n){return r=n,new Promise((function(n,a){r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),s.catch((function(){return!0})).then((function(){r&&i&&n._releaseTask(r,i)})),d.set(e,{key:a,promise:s}),s}},{key:"_createGeometry",value:function(e){var t=new n.BufferGeometry;e.index&&t.setIndex(new n.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var a=e.attributes[r],i=a.name,s=a.array,o=a.itemSize;o=new n.BufferAttribute(s,o),"color"===i&&(this._assignVertexColorSpace(o,a.vertexColorSpace),o.normalized=s instanceof Float32Array==0),t.setAttribute(i,o)}return t}},{key:"_assignVertexColorSpace",value:function(e,t){if(t===n.SRGBColorSpace)for(var r=new n.Color,a=0,i=e.count;a<i;a++)r.fromBufferAttribute(e,a).convertSRGBToLinear(),e.setXYZ(a,r.r,r.g,r.b)}},{key:"_loadLibrary",value:function(e,t){var r=new n.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,n){r.load(e,t,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":o(WebAssembly))||"js"===this.decoderConfig.type,r=[];return t?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];t||(e.decoderConfig.wasmBinary=r[1]),r=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=n.buffer,i=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder;try{var r=function(e,t,r,n){var a,i=n.attributeIDs,s=n.attributeTypes,o=t.GetEncodedGeometryType(r);if(o===e.TRIANGULAR_MESH)a=new e.Mesh,g=t.DecodeArrayToMesh(r,r.byteLength,a);else{if(o!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,g=t.DecodeArrayToPointCloud(r,r.byteLength,a)}if(!g.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());var l,c,u,d,h,p,m,f,g,v,b,y,x={index:null,attributes:[]};for(l in i){var w=self[s[l]],S=void 0,M=void 0;if(n.useUniqueIDs)M=i[l],S=t.GetAttributeByUniqueId(a,M);else{if(-1===(M=t.GetAttributeId(a,e[i[l]])))continue;S=t.GetAttribute(a,M)}M=e,c=t,T=a,u=l,d=S.num_components(),p=(h=T.num_points()*d)*w.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,w),f=M._malloc(p),c.GetAttributeDataArrayForAllPoints(T,S,m,p,f),c=new w(M.HEAPF32.buffer,f,h).slice(),M._free(f);var T={name:u,array:c,itemSize:d};"color"===l&&(T.vertexColorSpace=n.vertexColorSpace),x.attributes.push(T)}return o===e.TRIANGULAR_MESH&&(x.index=(r=e,g=t,b=4*(v=3*(o=a).num_faces()),y=r._malloc(b),g.GetTrianglesUInt32Array(o,b,y),g=new Uint32Array(r.HEAPF32.buffer,y,v).slice(),r._free(y),{array:g,itemSize:1})),e.destroy(a),x}(e,t,new Int8Array(a),i),s=r.attributes.map((function(e){return e.array.buffer}));r.index&&s.push(r.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:r},s)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){r.workerPool.length<r.workerLimit?((n=new Worker(r.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(n)):r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n,a=r.workerPool[r.workerPool.length-1];return a._taskCosts[e]=t,a._taskLoad+=t,a}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Loader),p=r(4091),m={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};var f=new(function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var a=this,i=!1,s=0,o=0,l=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==a.onStart&&a.onStart(e,s,o),i=!0},this.itemEnd=function(e){s++,void 0!==a.onProgress&&a.onProgress(e,s,o),s===o&&(i=!1,void 0!==a.onLoad&&a.onLoad())},this.itemError=function(e){void 0!==a.onError&&a.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){return-1!==(e=c.indexOf(e))&&c.splice(e,2),this},this.getHandler=function(e){for(var t=0,r=c.length;t<r;t+=2){var n=c[t],a=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return a}return null}})));var g=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:f,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,r;return t=e,(r=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.load(e,n,t,a)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w=function(){var e=n,t=g;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=x(e);if(r=t?(r=x(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,r,n,a){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,s=m.get(e);if(void 0!==s)return i.manager.itemStart(e),setTimeout((function(){t&&t(s),i.manager.itemEnd(e)}),0),s;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var r=(n=i.options).textureQuality,n=n.reverseTexture,s=a.notCompress,o=a.size,l=0===e.size?new ImageData(1,1):e;t(o&&1!==r?(o=(t=a.size).w,t=t.h,s=s?1:r,createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY",resizeHeight:t*s,resizeWidth:o*s}))):createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(r){r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),2!==i.length);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e)||function(e,t){if(e){if("string"==typeof e)return b(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,2):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r);var n=r[0];r=r[1],m.add(e,n),t&&t(n,r),i.manager.itemEnd(e)})).catch((function(t){n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),S=r(5317),M=r(6422);function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e,t)||O(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(){return(E="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=B(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function D(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=O(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function O(e,t){if(e){if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,r){return t&&A(e.prototype,t),r&&A(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}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&&R(e,t)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=B(e);if(r=t?(r=B(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===_(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var j=function(){L(t,n.Loader);var e=I(t);function t(r){return P(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new G(e)})),r.register((function(e){return new Y(e)})),r.register((function(e){return new Q(e)})),r.register((function(e){return new Z(e)})),r.register((function(e){return new W(e)})),r.register((function(e){return new K(e)})),r.register((function(e){return new q(e)})),r.register((function(e){return new V(e)})),r.register((function(e){return new X(e)})),r.register((function(e){return new H(e)})),r.register((function(e){return new z(e)})),r.register((function(e){return new J(e)})),r.register((function(e){return new $(e)})),r}return C(t,[{key:"load",value:function(e,t,r,a){function i(t){a?a(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)}var s=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:n.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new n.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{s.parse(r,o,(function(r){t(r),s.manager.itemEnd(e)}),i)}catch(r){i(r)}}),r,i)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n,a){var i,s={},o={},l=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===ee){try{s[N.KHR_BINARY_GLTF]=new te(e)}catch(e){return void(n&&n(e))}i=JSON.parse(s[N.KHR_BINARY_GLTF].content)}else i=JSON.parse(l.decode(e));else i=e;if(void 0===i.asset||i.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else if(a.valid(i)){var c=new we(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,ex:a});c.fileLoader.setRequestHeader(this.requestHeader);for(var u=0;u<this.pluginCallbacks.length;u++){var d=this.pluginCallbacks[u](c);s[(o[d.name]=d).name]=!0}if(i.extensionsUsed)for(var h=0;h<i.extensionsUsed.length;++h){var p=i.extensionsUsed[h],m=i.extensionsRequired||[];switch(p){case N.KHR_MATERIALS_UNLIT:s[p]=new F;break;case N.KHR_DRACO_MESH_COMPRESSION:s[p]=new re(i,this.dracoLoader);break;case N.KHR_TEXTURE_TRANSFORM:s[p]=new ne;break;case N.KHR_MESH_QUANTIZATION:s[p]=new ae;break;default:0<=m.indexOf(p)&&void 0===o[p]&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(r,n)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,t,n,a)}))}}]),t}();function U(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var N={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},z=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return C(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var a=t[r];a.extensions&&a.extensions[this.name]&&void 0!==a.extensions[this.name].light&&e._addNodeRef(this.cache,a.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,r="light:"+e,a=t.cache.get(r);if(a)return a;var i,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new n.Color(16777215),c=(void 0!==o.color&&l.fromArray(o.color),void 0!==o.range?o.range:0);switch(o.type){case"directional":(i=new n.DirectionalLight(l)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new n.PointLight(l)).distance=c;break;case"spot":(i=new n.SpotLight(l)).distance=c,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,i.angle=o.spot.outerConeAngle,i.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return i.position.set(0,0,0),i.decay=2,ve(i,o),void 0!==o.intensity&&(i.intensity=o.intensity),i.name=t.createUniqueName(o.name||"light_"+e),a=Promise.resolve(i),t.cache.add(r,a),a}},{key:"getDependency",value:function(e,t){if("light"===e)return this._loadLight(t)}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,n=((e=r.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),F=function(){function e(){P(this,e),this.name=N.KHR_MATERIALS_UNLIT}return C(e,[{key:"getMaterialType",value:function(){return n.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var a,i=[];return e.color=new n.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(a=t.baseColorFactor,e.color.fromArray(a),e.opacity=a[3]),void 0!==t.baseColorTexture&&i.push(r.assignTexture(e,"map",t.baseColorTexture,n.sRGBEncoding))),Promise.all(i)}}]),e}(),V=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_EMISSIVE_STRENGTH}return C(e,[{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(void 0!==(e=e.extensions[this.name].emissiveStrength)&&(t.emissiveIntensity=e),Promise.resolve()):Promise.resolve()}}]),e}(),G=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_CLEARCOAT}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&a.push(r.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&a.push(r.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(a.push(r.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(r=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new n.Vector2(r,r))),Promise.all(a)}}]),e}(),H=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_IRIDESCENCE}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).iridescenceFactor&&(t.iridescence=e.iridescenceFactor),void 0!==e.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",e.iridescenceTexture)),void 0!==e.iridescenceIor&&(t.iridescenceIOR=e.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==e.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=e.iridescenceThicknessMinimum),void 0!==e.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=e.iridescenceThicknessMaximum),void 0!==e.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",e.iridescenceThicknessTexture)),Promise.all(n)}}]),e}(),Z=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_SHEEN}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[];return void 0!==(t.sheenColor=new n.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&a.push(r.assignTexture(t,"sheenColorMap",e.sheenColorTexture,n.sRGBEncoding)),void 0!==e.sheenRoughnessTexture&&a.push(r.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(a)}}]),e}(),W=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_TRANSMISSION}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(n)}}]),e}(),K=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_VOLUME}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(a=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[],a=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&r.push(a.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||1/0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new n.Color(a[0],a[1],a[2]),Promise.all(r)}}]),e}(),q=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_IOR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5,Promise.resolve()):Promise.resolve()}}]),e}(),X=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_SPECULAR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[],i=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&a.push(r.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new n.Color(i[0],i[1],i[2]),void 0!==e.specularColorTexture&&a.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture,n.sRGBEncoding)),Promise.all(a)}}]),e}(),Y=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_TEXTURE_BASISU}return C(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json;if(!(n=r.textures[e]).extensions||!n.extensions[this.name])return null;var n=n.extensions[this.name],a=t.options.ktx2Loader;if(a)return t.loadTextureImage(e,n.source,a);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),Q=function(){function e(t){P(this,e),this.parser=t,this.name=N.EXT_TEXTURE_WEBP,this.isSupported=null}return C(e,[{key:"loadTexture",value:function(e){var t=this.name,r=this.parser,n=r.json;if(!(i=n.textures[e]).extensions||!i.extensions[t])return null;var a=i.extensions[t],i=n.images[a.source],s=r.textureLoader;return i.uri&&null!==(i=r.options.manager.getHandler(i.uri))&&(s=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,a.source,s);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),J=function(){function e(t){P(this,e),this.name=N.EXT_MESHOPT_COMPRESSION,this.parser=t}return C(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var r=e.extensions[this.name],n=(e=this.parser.getDependency("buffer",r.buffer),this.parser.options.meshoptDecoder);if(n&&n.supported)return e.then((function(e){var t=r.byteOffset||0,a=r.byteLength||0,i=r.count,s=r.byteStride,o=new Uint8Array(e,t,a);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,s,o,r.mode,r.filter).then((function(e){return e.buffer})):n.ready.then((function(){var e=new ArrayBuffer(i*s);return n.decodeGltfBuffer(new Uint8Array(e),i,s,o,r.mode,r.filter),e}))}));if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return null}}]),e}(),$=function(){function e(t){P(this,e),this.name=N.EXT_MESH_GPU_INSTANCING,this.parser=t}return C(e,[{key:"createNodeMesh",value:function(e){var t=this,r=this.parser.json,a=r.nodes[e];if(!a.extensions||!a.extensions[this.name]||void 0===a.mesh)return null;var i,s=D(r.meshes[a.mesh].primitives);try{for(s.s();!(i=s.n()).done;){var o=i.value;if(o.mode!==le.TRIANGLES&&o.mode!==le.TRIANGLE_STRIP&&o.mode!==le.TRIANGLE_FAN&&void 0!==o.mode)return null}}catch(e){s.e(e)}finally{s.f()}var l,c=a.extensions[this.name].attributes,u=[],d={};for(l in c)!function(e){u.push(t.parser.getDependency("accessor",c[e]).then((function(t){return d[e]=t,d[e]})))}(l);return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then((function(e){var r,a=e.pop(),i=a.isGroup?a.children:[a],s=e[0].count,o=[],l=D(i);try{for(l.s();!(r=l.n()).done;){for(var c,u=r.value,h=new n.Matrix4,p=new n.Vector3,m=new n.Quaternion,f=new n.Vector3(1,1,1),g=new n.InstancedMesh(u.geometry,u.material,s),v=0;v<s;v++)d.TRANSLATION&&p.fromBufferAttribute(d.TRANSLATION,v),d.ROTATION&&m.fromBufferAttribute(d.ROTATION,v),d.SCALE&&f.fromBufferAttribute(d.SCALE,v),g.setMatrixAt(v,h.compose(p,m,f));for(c in d)"TRANSLATION"!==c&&"ROTATION"!==c&&"SCALE"!==c&&u.geometry.setAttribute(c,d[c]);n.Object3D.prototype.copy.call(g,u),g.frustumCulled=!1,t.parser.assignFinalMaterial(g),o.push(g)}}catch(e){l.e(e)}finally{l.f()}return a.isGroup?(a.clear(),a.add.apply(a,o),a):o[0]})))}}]),e}(),ee="glTF",te=C((function e(t){P(this,e),this.name=N.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==ee)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var a=this.header.length-12,i=new DataView(t,12),s=0;s<a;){var o,l=i.getUint32(s,!0),c=(s+=4,i.getUint32(s,!0));s+=4,1313821514===c?(o=new Uint8Array(t,12+s,l),this.content=n.decode(o)):5130562===c&&(this.body=t.slice(o=12+s,o+l)),s+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),re=function(){function e(t,r){if(P(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=N.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return C(e,[{key:"decodePrimitive",value:function(e,t){var r,n,a=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},c={},u={};for(r in o){var d=pe[r]||r.toLowerCase();l[d]=o[r]}for(n in e.attributes){var h,p,m=pe[n]||n.toLowerCase();void 0!==o[n]&&(h=a.accessors[e.attributes[n]],p=ce[h.componentType],u[m]=p.name,c[m]=!0===h.normalized)}return t.getDependency("bufferView",s).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=c[r])&&(n.normalized=r)}t(e)}),l,u)}))}))}}]),e}(),ne=function(){function e(){P(this,e),this.name=N.KHR_TEXTURE_TRANSFORM}return C(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),ae=C((function e(){P(this,e),this.name=N.KHR_MESH_QUANTIZATION})),ie=function(){L(t,n.Interpolant);var e=I(t);function t(r,n,a,i){return P(this,t),e.call(this,r,n,a,i)}return C(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,a=e*n*3+n,i=0;i!==n;i++)t[i]=r[a+i];return t}},{key:"interpolate_",value:function(e,t,r,n){for(var a=this.resultBuffer,i=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,c=n-t,u=e*l,d=u-l,h=-2*(t=(r=(n=(r-t)/c)*n)*n)+3*r,p=t-r,m=1-h,f=p-r+n,g=0;g!==s;g++){var v=i[d+g+s],b=i[d+g+o]*c,y=i[u+g+s],x=i[u+g]*c;a[g]=m*v+f*b+h*y+p*x}return a}}]),t}(),se=new n.Quaternion,oe=function(){L(t,ie);var e=I(t);function t(){return P(this,t),e.apply(this,arguments)}return C(t,[{key:"interpolate_",value:function(e,r,n,a){return e=E(B(t.prototype),"interpolate_",this).call(this,e,r,n,a),se.fromArray(e).normalize().toArray(e),e}}]),t}(),le={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ce={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:n.NearestFilter,9729:n.LinearFilter,9984:n.NearestMipmapNearestFilter,9985:n.LinearMipmapNearestFilter,9986:n.NearestMipmapLinearFilter,9987:n.LinearMipmapLinearFilter},de={33071:n.ClampToEdgeWrapping,33648:n.MirroredRepeatWrapping,10497:n.RepeatWrapping},he={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pe={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},me={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},fe={CUBICSPLINE:void 0,LINEAR:n.InterpolateLinear,STEP:n.InterpolateDiscrete};function ge(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function ve(e,t){void 0!==t.extras&&("object"===_(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function be(e){for(var t="",r=Object.keys(e).sort(),n=0,a=r.length;n<a;n++)t+=r[n]+":"+e[r[n]]+";";return t}function ye(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var xe=new n.Matrix4,we=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=(P(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new U,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},t=!(this.nodeNamesUsed={}),r=!1,-1);"undefined"!=typeof navigator&&(t=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),a=(r=-1<navigator.userAgent.indexOf("Firefox"))?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||t||r&&a<98?this.textureLoader=new n.TextureLoader(this.options.manager):this.textureLoader=new w(this.options.manager),this.options.ex.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new n.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.rgbeLoader=new M.x(this.options.manager),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return C(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,n=this.json,a=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var i={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};ge(a,i,n),ve(i,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(i)}))).then((function(){e(i)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,a=t.length;n<a;n++)for(var i=t[n].joints,s=0,o=i.length;s<o;s++)e[i[s]].isBone=!0;for(var l=0,c=e.length;l<c;l++){var u=e[l];void 0!==u.mesh&&(this._addNodeRef(this.meshCache,u.mesh),void 0!==u.skin&&(r[u.mesh].isSkinnedMesh=!0)),void 0!==u.camera&&this._addNodeRef(this.cameraCache,u.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,r){var n=this;if(e.refs[t]<=1)return r;var a=r.clone();return function e(t,r){var a,i=n.associations.get(t),s=(null!=i&&n.associations.set(r,i),D(t.children.entries()));try{for(s.s();!(a=s.n()).done;){var o=T(a.value,2),l=o[0];e(o[1],r.children[l])}}catch(e){s.e(e)}finally{s.f()}}(r,a),a.name+="_instance_"+e.uses[t]++,a}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var n=e(t[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),r=(t.unshift(this),[]),n=0;n<t.length;n++){var a=e(t[n]);a&&r.push(a)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":n=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":n=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})))break;throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(e){var t,r,n=this.cache.get(e);return n||(r=(t=this).json[e+("mesh"===e?"es":"s")]||[],n=Promise.all(r.map((function(r,n){return t.getDependency(e,n)}))),this.cache.add(e,n)),n}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[N.KHR_BINARY_GLTF].body);var a=this.options;return new Promise((function(e,i){r.load(n.LoaderUtils.resolveURL(t.uri,a.path),e,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))}},{key:"loadAccessor",value:function(e){var t,r=this,a=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse)return e=he[i.type],s=ce[i.componentType],t=!0===i.normalized,s=new s(i.count*e),Promise.resolve(new n.BufferAttribute(s,e,t));var s=[];return void 0!==i.bufferView?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),void 0!==i.sparse&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then((function(e){var t,s=e[0],o=he[i.type],l=ce[i.componentType],c=l.BYTES_PER_ELEMENT,u=i.byteOffset||0,d=void 0!==i.bufferView?a.bufferViews[i.bufferView].byteStride:void 0,h=!0===i.normalized,p=d&&d!==c*o?(m=Math.floor(u/d),f="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+m+":"+i.count,(g=r.cache.get(f))||(t=new l(s,m*d,i.count*d/c),g=new n.InterleavedBuffer(t,d/c),r.cache.add(f,g)),new n.InterleavedBufferAttribute(g,o,u%d/c,h)):(t=null===s?new l(i.count*o):new l(s,u,i.count*o),new n.BufferAttribute(t,o,h));if(void 0!==i.sparse){var m=ce[i.sparse.indices.componentType],f=i.sparse.indices.byteOffset||0,g=i.sparse.values.byteOffset||0,v=new m(e[1],f,i.sparse.count*he.SCALAR),b=new l(e[2],g,i.sparse.count*o);null!==s&&(p=new n.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var y=0,x=v.length;y<x;y++){var w=v[y];if(p.setX(w,b[y*o]),2<=o&&p.setY(w,b[y*o+1]),3<=o&&p.setZ(w,b[y*o+2]),4<=o&&p.setW(w,b[y*o+3]),5<=o)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,a=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(a=r),this.loadTextureImage(e,n,a)}},{key:"loadTextureImage",value:function(e,t,r){var a=this,i=this.json,s=i.textures[e],o=i.images[t],l=(o.uri||o.bufferView)+":"+s.sampler;return this.textureCache[l]?this.textureCache[l]:(t=this.loadImageSource(t,r,e).then((function(t){t.flipY=!1,t.name=s.name||o.name||"";var r=(i.samplers||{})[s.sampler]||{};return t.magFilter=ue[r.magFilter]||n.LinearFilter,t.minFilter=ue[r.minFilter]||n.LinearMipmapLinearFilter,t.wrapS=de[r.wrapS]||n.RepeatWrapping,t.wrapT=de[r.wrapT]||n.RepeatWrapping,a.associations.set(t,{textures:e}),a.options.ex.loadTexture({texture:t,textureDef:s}),t})).catch((function(){return null})),this.textureCache[l]=t)}},{key:"loadImageSource",value:function(e,t,r){var a=this,i=this.json,s=this.options,o=i.textures[r];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var l=i.images[e],c=self.URL||self.webkitURL,u=l.uri||"",d=!1;if(void 0!==l.bufferView)u=a.getDependency("bufferView",l.bufferView).then((function(e){d=!0;var t=new Blob([e],{type:l.mimeType});return{sourceURI:u=c.createObjectURL(t),blob:t,bufferView:e}}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return r=Promise.resolve(u).then((function(e){var r=e.sourceURI,i=e.blob;return new Promise((function(e,l){if(0===i.size)return c=new n.Texture,e({texture:c,blob:i});var c;o.isHdr?o.cloneSourceId?e({texture:new n.Texture(document.createElement("canvas")),blob:new Blob([new ArrayBuffer(1)])}):((c=new FileReader).readAsDataURL(i),c.addEventListener("load",(function(t){t=t.target.result,a.rgbeLoader.loadAsync(t).then((function(t){t.encoding=n.sRGBEncoding,t.needsUpdate=!0,e({texture:t,blob:i})}))}))):!0===t.isImageBitmapLoader?(c=function(t,r){(t=new n.Texture(t)).needsUpdate=!0,e({texture:t,blob:r})},o.cloneSourceId?e({texture:new n.Texture(document.createElement("canvas")),blob:new Blob([new ArrayBuffer(1)])}):t.load(n.LoaderUtils.resolveURL(r,s.path),c,void 0,l,o)):(s.ex.options.loadConfig.reverseTexture,t.load(n.LoaderUtils.resolveURL(r,s.path),(function(t){e({texture:t,blob:i})}),void 0,l))}))})).then((function(e){var t=e.texture;return e=e.blob,"editor"===s.ex.options.mode?o.isHdr||(t.userData.url=u):!0===d&&c.revokeObjectURL(u),t.userData.blob=e,t.userData.mimeType=l.mimeType||(0<(e=l.uri||"").search(/\.jpe?g($|\?)/i)||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":0<e.search(/\.webp($|\?)/i)||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't loadImageSource texture",u),e})),this.sourceCache[e]=r}},{key:"assignTexture",value:function(e,t,r,n){var a=this;return this.getDependency("texture",r.index).then((function(i){return i?(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),a.extensions[N.KHR_TEXTURE_TRANSFORM]&&(s=void 0!==r.extensions?r.extensions[N.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=a.associations.get(i),i=a.extensions[N.KHR_TEXTURE_TRANSFORM].extendTexture(i,s),a.associations.set(i,o)),void 0!==n&&(i.encoding=n),e[t]=i):null;var s,o}))}},{key:"assignFinalMaterial",value:function(e){var t,r,a=e.geometry,i=e.material,s=void 0===a.attributes.tangent,o=void 0!==a.attributes.color,l=void 0===a.attributes.normal;e.isPoints?(t="PointsMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.PointsMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,r.sizeAttenuation=!1,this.cache.add(t,r)),i=r):e.isLine&&(t="LineBasicMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.LineBasicMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),this.cache.add(t,r)),i=r),(s||o||l)&&(t="ClonedMaterial:"+i.uuid+":",s&&(t+="derivative-tangents:"),o&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(r=this.cache.get(t))||(r=i.clone(),o&&(r.vertexColors=!0),l&&(r.flatShading=!0),s&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(t,r),this.associations.set(r,this.associations.get(i)))),i.aoMap&&void 0===a.attributes.uv2&&void 0!==a.attributes.uv&&a.setAttribute("uv2",a.attributes.uv),this.options.ex.loadMaterial({material:i,materialDef:i.userData,model:e}),e.material=i}},{key:"getMaterialType",value:function(){return n.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,r,a=this,i=this.json,s=this.extensions,o=i.materials[e],l={},c=(i=[],(o.extensions||{})[N.KHR_MATERIALS_UNLIT]?(r=s[N.KHR_MATERIALS_UNLIT],t=r.getMaterialType(),i.push(r.extendParams(l,o,a))):(r=o.pbrMetallicRoughness||{},l.color=new n.Color(1,1,1),l.opacity=1,Array.isArray(r.baseColorFactor)&&(c=r.baseColorFactor,l.color.fromArray(c),l.opacity=c[3]),void 0!==r.baseColorTexture&&i.push(a.assignTexture(l,"map",r.baseColorTexture,n.sRGBEncoding)),l.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,l.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(i.push(a.assignTexture(l,"metalnessMap",r.metallicRoughnessTexture)),i.push(a.assignTexture(l,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),i.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))),!0===o.doubleSided&&(l.side=n.DoubleSide),o.alphaMode||"OPAQUE");return"BLEND"===c?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===c&&(l.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new n.Vector2(1,1),void 0!==o.normalTexture.scale&&(r=o.normalTexture.scale,l.normalScale.set(r,r))),void 0!==o.occlusionTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==n.MeshBasicMaterial&&(l.emissive=(new n.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==n.MeshBasicMaterial&&i.push(a.assignTexture(l,"emissiveMap",o.emissiveTexture,n.sRGBEncoding)),Promise.all(i).then((function(){var r=new t(l);return o.name&&(r.name=o.name),ve(r,o),a.associations.set(r,{materials:e}),o.extensions&&ge(s,r,o),r}))}},{key:"createUniqueName",value:function(e){for(var t=n.PropertyBinding.sanitizeNodeName(e||""),r=t,a=1;this.nodeNamesUsed[r];++a)r=t+"_"+a;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){for(var t=this,r=this.extensions,a=this.primitiveCache,i=[],s=0,o=e.length;s<o;s++){var l=e[s],c=(u=void 0,u=(u=(c=l).extensions&&c.extensions[N.KHR_DRACO_MESH_COMPRESSION])?"draco:"+u.bufferView+":"+u.indices+":"+be(u.attributes):c.indices+":"+be(c.attributes)+":"+c.mode),u=a[c];u?i.push(u.promise):(u=void 0,u=l.extensions&&l.extensions[N.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[N.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return Se(r,e,t)}))}(l):Se(new n.BufferGeometry,l,t),a[c]={primitive:l,promise:u},i.push(u))}return Promise.all(i)}},{key:"loadMesh",value:function(e){for(var t=this,r=this.json,a=this.extensions,i=r.meshes[e],s=i.primitives,o=[],l=0,c=s.length;l<c;l++){var u=void 0===s[l].material?(void 0===(u=this.cache).DefaultMaterial&&(u.DefaultMaterial=new n.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:n.FrontSide})),u.DefaultMaterial):this.getDependency("material",s[l].material);o.push(u)}return o.push(t.loadGeometries(s)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),l=r[r.length-1],c=[],u=0,d=l.length;u<d;u++){var h=l[u],m=s[u],f=void 0,g=o[u];if(m.mode===le.TRIANGLES||m.mode===le.TRIANGLE_STRIP||m.mode===le.TRIANGLE_FAN||void 0===m.mode)!0!==(f=new(!0===i.isSkinnedMesh?n.SkinnedMesh:n.Mesh)(h,g)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),m.mode===le.TRIANGLE_STRIP?f.geometry=(0,p.Vs)(f.geometry,n.TriangleStripDrawMode):m.mode===le.TRIANGLE_FAN&&(f.geometry=(0,p.Vs)(f.geometry,n.TriangleFanDrawMode));else if(m.mode===le.LINES)f=new n.LineSegments(h,g);else if(m.mode===le.LINE_STRIP)f=new n.Line(h,g);else if(m.mode===le.LINE_LOOP)f=new n.LineLoop(h,g);else{if(m.mode!==le.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);f=new n.Points(h,g)}if(0<Object.keys(f.geometry.morphAttributes).length){M=S=w=x=y=v=void 0;var v=f,b=i;if(v.updateMorphTargets(),void 0!==b.weights)for(var y=0,x=b.weights.length;y<x;y++)v.morphTargetInfluences[y]=b.weights[y];if(b.extras&&Array.isArray(b.extras.targetNames)){var w=b.extras.targetNames;if(v.morphTargetInfluences.length===w.length){v.morphTargetDictionary={};for(var S=0,M=w.length;S<M;S++)v.morphTargetDictionary[w[S]]=S}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}f.name=t.createUniqueName(i.name||"mesh_"+e),ve(f,i),m.extensions&&ge(a,f,m),t.assignFinalMaterial(f),c.push(f)}for(var T=0,_=c.length;T<_;T++)t.associations.set(c[T],{meshes:e,primitives:T});if(1===c.length)return c[0];var E=new n.Group;t.associations.set(E,{meshes:e});for(var D=0,O=c.length;D<O;D++)E.add(c[D]);return E}))}},{key:"loadCamera",value:function(e){var t,r=(e=this.json.cameras[e])[e.type];if(r)return"perspective"===e.type?t=new n.PerspectiveCamera(n.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new n.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),ve(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],r=[],a=0,i=t.joints.length;a<i;a++)r.push(this.getDependency("node",t.joints[a]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){for(var r=e.pop(),a=e,i=[],s=[],o=0,l=a.length;o<l;o++){var c=a[o];c?(i.push(c),c=new n.Matrix4,null!==r&&c.fromArray(r.array,16*o),s.push(c)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new n.Skeleton(i,s)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],r=[],a=[],i=[],s=[],o=[],l=0,c=t.channels.length;l<c;l++){var u=t.channels[l],d=t.samplers[u.sampler],h=(u=u.target).node,p=void 0!==t.parameters?t.parameters[d.input]:d.input,m=void 0!==t.parameters?t.parameters[d.output]:d.output;r.push(this.getDependency("node",h)),a.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",m)),s.push(d),o.push(u)}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(i),Promise.all(s),Promise.all(o)]).then((function(r){for(var a=r[0],i=r[1],s=r[2],o=r[3],l=r[4],c=[],u=0,d=a.length;u<d;u++)!function(e){var t=a[e],r=i[e],u=s[e],d=o[e],h=l[e];if(void 0!==t){t.updateMatrix();var p=void 0;switch(me[h.path]){case me.weights:p=n.NumberKeyframeTrack;break;case me.rotation:p=n.QuaternionKeyframeTrack;break;default:p=n.VectorKeyframeTrack}e=t.name||t.uuid;var m=void 0!==d.interpolation?fe[d.interpolation]:n.InterpolateLinear,f=[],g=(me[h.path]===me.weights?t.traverse((function(e){e.morphTargetInfluences&&f.push(e.name||e.uuid)})):f.push(e),u.array);if(u.normalized){for(var v=ye(g.constructor),b=new Float32Array(g.length),y=0,x=g.length;y<x;y++)b[y]=g[y]*v;g=b}for(var w=0,S=f.length;w<S;w++){var M=new p(f[w]+"."+me[h.path],r.array,g,m);"CUBICSPLINE"===d.interpolation&&(M.createInterpolant=function(e){return new(this instanceof n.QuaternionKeyframeTrack?oe:ie)(this.times,this.values,this.getValueSize()/3,e)},M.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(M)}}}(u);return r=t.name||"animation_"+e,new n.AnimationClip(r,void 0,c)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(e){return e=r._getNodeRef(r.meshCache,n.mesh,e),void 0!==n.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t=this.json,r=this.extensions,a=this,i=t.nodes[e],s=i.name?a.createUniqueName(i.name):"";return function(){for(var t=[],r=a._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})),n=(r&&t.push(r),void 0!==i.camera&&t.push(a.getDependency("camera",i.camera).then((function(e){return a._getNodeRef(a.cameraCache,i.camera,e)}))),a._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),[]),s=i.children||[],o=0,l=s.length;o<l;o++)n.push(a.getDependency("node",s[o]));return r=void 0===i.skin?Promise.resolve(null):a.getDependency("skin",i.skin),Promise.all([Promise.all(t),Promise.all(n),r])}().then((function(t){var o=t[0],l=t[1],c=t[2],u=!0===i.isBone?new n.Bone:1<o.length?new n.Group:1===o.length?o[0]:new n.Object3D;if(u!==o[0])for(var d=0,h=o.length;d<h;d++)u.add(o[d]);i.name&&(u.userData.name=i.name,u.name=s),ve(u,i),i.extensions&&ge(r,u,i),void 0!==i.matrix?((t=new n.Matrix4).fromArray(i.matrix),u.applyMatrix4(t)):(void 0!==i.translation&&u.position.fromArray(i.translation),void 0!==i.rotation&&u.quaternion.fromArray(i.rotation),void 0!==i.scale&&u.scale.fromArray(i.scale)),a.associations.has(u)||a.associations.set(u,{}),a.associations.get(u).nodes=e,null!==c&&u.traverse((function(e){e.isSkinnedMesh&&e.bind(c,xe)}));for(var p=0,m=l.length;p<m;p++)u.add(l[p]);return a.options.ex.loadNode({node:u,nodeDef:i})||u}))}},{key:"loadScene",value:function(e){for(var t=this.extensions,r=(e=this.json.scenes[e],this),a=new n.Group,i=(e.name&&(a.name=r.createUniqueName(e.name)),ve(a,e),e.extensions&&ge(t,a,e),e.nodes||[]),s=[],o=0,l=i.length;o<l;o++)s.push(r.getDependency("node",i[o]));return Promise.all(s).then((function(e){for(var t=0,i=e.length;t<i;t++)a.add(e[t]);return r.options.ex.loadScene(a),r.associations=function(e){var t,a=new Map,i=D(r.associations);try{for(i.s();!(t=i.n()).done;){var s=T(t.value,2),o=s[0],l=s[1];(o instanceof n.Material||o instanceof n.Texture)&&a.set(o,l)}}catch(e){i.e(e)}finally{i.f()}return e.traverse((function(e){var t=r.associations.get(e);null!=t&&a.set(e,t)})),a}(a),a}))}}]),e}();function Se(e,t,r){var a,i=t.attributes,s=[];for(a in i){var o=pe[a]||a.toLowerCase();o in e.attributes||s.push(function(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}(i[a],o))}void 0===t.indices||e.index||(l=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),s.push(l)),ve(e,t);var l=e,c=t,u=r,d=c.attributes,h=new n.Box3;if(void 0!==d.POSITION){var p=(d=u.json.accessors[d.POSITION]).min,m=d.max;if(void 0===p||void 0===m)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{h.set(new n.Vector3(p[0],p[1],p[2]),new n.Vector3(m[0],m[1],m[2])),d.normalized&&(p=ye(ce[d.componentType]),h.min.multiplyScalar(p),h.max.multiplyScalar(p));var f=c.targets;if(void 0!==f){for(var g=new n.Vector3,v=new n.Vector3,b=0,y=f.length;b<y;b++){var x,w,S=f[b];void 0!==S.POSITION&&(w=(S=u.json.accessors[S.POSITION]).min,x=S.max,void 0!==w&&void 0!==x?(v.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),v.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),v.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),S.normalized&&(w=ye(ce[S.componentType]),v.multiplyScalar(w)),g.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}h.expandByVector(g)}l.boundingBox=h,m=new n.Sphere,h.getCenter(m.center),m.radius=h.min.distanceTo(h.max)/2,l.boundingSphere=m}}return Promise.all(s).then((function(){if(void 0===t.targets)return e;for(var n=e,a=t.targets,i=r,s=!1,o=!1,l=!1,c=0,u=a.length;c<u;c++){var d=a[c];if(void 0!==d.POSITION&&(s=!0),void 0!==d.NORMAL&&(o=!0),void 0!==d.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(n);for(var h=[],p=[],m=[],f=0,g=a.length;f<g;f++){var v,b=a[f];s&&(v=void 0!==b.POSITION?i.getDependency("accessor",b.POSITION):n.attributes.position,h.push(v)),o&&(v=void 0!==b.NORMAL?i.getDependency("accessor",b.NORMAL):n.attributes.normal,p.push(v)),l&&(b=void 0!==b.COLOR_0?i.getDependency("accessor",b.COLOR_0):n.attributes.color,m.push(b))}return Promise.all([Promise.all(h),Promise.all(p),Promise.all(m)]).then((function(e){var t=e[0],r=e[1];return e=e[2],s&&(n.morphAttributes.position=t),o&&(n.morphAttributes.normal=r),l&&(n.morphAttributes.color=e),n.morphTargetsRelative=!0,n}))}))}var Me=r(1794),Te=r(6272);class _e{constructor(e,t){this.runScene=e,this.helper=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof w?(this.helper.isImageBitmapLoader=!0,e.setOptions({reverseTexture:this.helper.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})):this.helper.isImageBitmapLoader=!1}}class Ee{constructor(e,t){this.pending=[],this.models=[],this.module=new Me.Z,this.isImageBitmapLoader=!0,this.runScene=e,this.loadConfig=t,this.options=new _e(e,this),this.callback("mountModule",null)}beforeLoader(e){this.callback("getJSON",e),this.json=e;var t=this.processBase64(e);return"editor"===this.runScene.optionsEx.options.mode?(this.callback("beforeParse",e),!0):(t&&this.callback("beforeParse",e),t)}complete(e,t){this.parseSavedMap(t),this.callback("complete",{models:e,json:t})}clean(){}parseSavedMap(e){var t;(e=null==(e=null==(e=null==e?void 0:e.asset)?void 0:e.ex)?void 0:e.savedMap)&&null!=(t=this.module.get("material"))&&t.parseSavedMap(e.materialIds)}loadTexture(e){this.callback("loadTexture",e)}processBase64(e){if(null==(t=e.asset)||!t.ex)return!0;var t=e.asset.ex.base64;return!t||!!(e=(0,Te.Ne)(t))&&(t=Number(e),!isNaN(t)&&(new Date).getTime()<t)}callback(e,t){var r,n;return this.loadConfig.triggerCb&&null!=(r=null==(n=this.runScene.cb.loaderer.gltf[e])?void 0:n.cb)&&r.call(n,t),null!=(n=null==(r=this.loadConfig.callBack)?void 0:r[e])&&n.call(r,t),this.runScene.exporter.gltf.module.loadCallback({type:e,json:this.json,data:t,config:this.loadConfig,core:this})}loadMaterial(e){this.callback("loadMaterial",e)}loadNode(e){if(1===(e=this.callback("loadNode",e)).length)return e[0]}}class De{constructor(e,t){this.options=e,this.runScene=t}static getGltfLoader(e){let t=this._gltf;if(!t){t=this._gltf=new j;const r=new h;r.setDecoderPath(e),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(r)}return t}parse(e){const{arrayBuffer:t,onDone:r,onError:n}=e;De.getGltfLoader(this.runScene.optionsEx.options.decodePath).parse(t,"",r,(e=>{console.log(e,"e"),n(e)}),this)}valid(e){return this.options.core.beforeLoader(e)}loadTexture(e){return this.options.core.loadTexture(e)}loadMaterial(e){return this.options.core.loadMaterial(e)}loadNode(e){return this.options.core.loadNode(e)}setTextureLoader(e){this.options.core.options.setTextureLoader(e)}loadScene(e){this.scene=e,this.options.models.push(e)}onBuildNodeHierarchy(e){const{nodeId:t,parentObject:r,node:n,idMap:a,children:i}=e;a&&a.set(t,n);try{if(void 0!==i&&(null==i?void 0:i.length)===r.children.length){let e=!0;i.forEach((t=>{a.get(t)||(e=!1)})),e&&(r.children=[...a.entries()].sort(((e,t)=>e[0]-t[0])).map((e=>{var[,e]=e;return e})),a.clear())}}catch(e){console.log(e,"e")}}}var Oe=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class ke{constructor(e){this.dracoPath="./draco/",this._gltf=new j,this.runScene=e}init(){const e=new h;e.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(e)}load(e,t){return Oe(this,void 0,void 0,(function*(){var r=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var r,{total:e,loaded:n}=e;let a=n/e;1<(a=a<0?0:a)&&(a=1);var n=Number(a.toFixed(2));e=Math.floor(100*n),null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&r.call(n,e),this.runScene.optionsEx.log("下载场景进度:"+e,"detail"),null!=t&&t.triggerCb&&this.runScene.cb.loaderer.gltf.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.runScene.optionsEx.log("下载场景失败:",e)}));return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){const r=(0,S.deepMergeObject)({cleanJSON:!0,triggerCb:!1,reverseTexture:!1,callBack:{mountModule:void 0,getJSON:void 0,beforeParse:void 0,afterParse:void 0,lazyLoadedTexture:void 0,loaded:void 0,loadMaterial:void 0,loadNode:void 0,modelLoaded:void 0,progress:void 0,getArrayBuffer:void 0,complete:void 0,loadedGltf:void 0,loadTexture:void 0},module:{light:!0,model:!0,camera:!0,controls:!0,tags:!0,objects:!0,timeline:!0,sceneConfig:!0}},t||{}),n=new Ee(this.runScene,r);return n.callback("getArrayBuffer",e),new Promise((t=>{new De({rootModel:this.runScene.assetsEx.get().scene,models:[],core:n,runScene:this.runScene,loadConfig:r,mode:this.runScene.optionsEx.options.mode},this.runScene).parse({arrayBuffer:e,onDone:e=>Oe(this,void 0,void 0,(function*(){n.callback("loadedGltf",e);try{yield this.afterParse(e.parser.options.ex.options,e,r)}catch(e){this.runScene.cb.error.cb({tip:"加载glb出错",msg:e}),console.log(e,"e")}t(n.models)})),onError:e=>{console.log(e,"_a")}})}))}afterParse(e,t,r){var n;return Oe(this,void 0,void 0,(function*(){const a=e.core;yield Promise.all(a.pending),a.callback("afterParse",{options:e,json:t,loadConfig:r});var{cleanJSON:i,callBack:s}=r;if(!t.asset.ex){const{models:r,core:n}=e,a=this.runScene.sceneEx.cleanUnlessLevel(r[0]);a.traverse((e=>{e.material&&this.runScene.materialEx.afterLoader(e.material)})),n.models.push(a),0<t.animations.length&&(a.animations=[...t.animations])}this.runScene.optionsEx.log(t,"detail"),a.complete(e.models,t),null!=(n=null==s?void 0:s.getJSON)&&n.call(s,t),i&&this.disposeJSON(t),a.clean()}))}disposeJSON(e){}}var Pe=r(3736),Ae=r(110);class Ce{constructor(e){this._objectLoader=new n.ObjectLoader,this.runScene=e,this._parser=new Le(e)}parse(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class Le{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,Pe.M)(t,"type",Ae.Z.tools.type),this.runScene.uniqueEx.material.add(e.material)}afterParse(e){return e instanceof Array?e.map((e=>{e.traverse((e=>{this.parseModel(e)}))})):e.traverse((e=>{this.parseModel(e)})),e}}class Re{constructor(e){this.imgBitMap=new n.ImageBitmapLoader,this.object=new n.ObjectLoader,this.runScene=e,this.gltf=new ke(e),this.json=new Ce(e)}init(){this.gltf.init()}}const Ie=new class{constructor(){this.load=new n.AnimationLoader}parse(e){return this.load.parse(e)}}},8818:(e,t,r)=>{r.d(t,{Ws:()=>le,ZP:()=>ce,ee:()=>ue}),t=r(3447);var n,a,i=r(1863),s=r(6053),o=r(135),l=r(144),c=r(6001),u=r(8881),d=r(6651),h=r(3735),p=r(3736);class m{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;m.TextureNames.includes((0,c.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,c.lastArrayEle)(t),newVal:r}):this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}(n=m).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],m.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"],m.tools={type:"FakeInterior",textureNames:n.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new h.Z({target:t,typeList:["uniforms",r,"value"],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e.uniforms[t].value},getTextures:e=>{const t=[];return e.uniforms.ceilingTex.value&&t.push({type:"ceilingTex",texture:e.uniforms.ceilingTex.value}),e.uniforms.floorTex.value&&t.push({type:"floorTex",texture:e.uniforms.floorTex.value}),e.uniforms.sideWallTex.value&&t.push({type:"sideWallTex",texture:e.uniforms.sideWallTex.value}),e.uniforms.backWallTex.value&&t.push({type:"backWallTex",texture:e.uniforms.backWallTex.value}),t},create:(e,t)=>{var r=new u.ShaderMaterial({uniforms:(0,d.d9)(f.uniforms),vertexShader:f.vertexShader,fragmentShader:f.fragmentShader});return n.tools.bind(r),r},parseData:(e,t)=>{const{texture:r,normal:a,material:i}=e,{data:s,load:o}=r,l=new u.ShaderMaterial({uniforms:(0,d.d9)(f.uniforms),vertexShader:f.vertexShader,fragmentShader:f.fragmentShader}),c=[];return o&&c.push(...s.map((e=>()=>{t.materialEx.setTexture({material:l,type:e.type,newVal:e.texture})}))),Object.keys(a.uniforms).filter((e=>!m.TextureNames.includes(e))).map((e=>{var t=a.uniforms[e];l.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new u.Vector4(t.x,t.y,t.z,t.w):t})),l.name=a.name,l.userData.id=i.userData.id,n.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,o.createDefMaterial)(),r=(t.userData=Object.assign({},t.userData),{}),a=e.uniforms,i=f.uniforms;return Object.keys(a).filter((e=>!m.TextureNames.includes(e))).map((e=>{var t,n,s,o,l,c,d=a[e].value,h=i[e].value;d instanceof u.Vector4?(({x:t,y:n,z:s}=d),({x:o,y:l,z:c}=h),t===o&&n===l&&s===c||(r[e]=d)):d!==h&&(r[e]=d)})),{material:t,normal:{type:n.tools.type,uniforms:r,name:e.name},textures:n.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=n.tools.create(t);return Object.keys(r).filter((e=>!m.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,p.M)(e,"type",n.tools.type)},validType:e=>"FakeInterior"===e.userData.type};const f={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new u.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 u.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new u.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 g{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;g.TextureNames.includes((0,c.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,c.lastArrayEle)(t),newVal:r}).then():this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:[...t],newVal:r}).execute())}}(a=g).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],g.TextureNames=["envMap","displacementMap"],g.tools={type:"Fresnel",textureNames:a.TextureNames.map((e=>"envMap"===e?{type:e,isEnv:!0}:{type:e})),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new h.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),e.displacementMap&&t.push({type:"displacementMap",texture:e.displacementMap}),t},create:(e,t)=>{const r=new v(void 0,void 0,e);return r.insertFresnelShader(),a.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),r},parseData:(e,t)=>{const{texture:r,normal:n,material:i}=e,{data:s,load:l}=r,c=(0,o.mergeMaterial)(i,new v(void 0,void 0,t)),u=[];return l&&u.push(...s.map((e=>()=>{t.materialEx.setTexture({material:c,type:e.type,newVal:e.texture},!1)}))),Object.keys(n.uniforms).filter((e=>!g.TextureNames.includes(e))).map((e=>{c[e]=n.uniforms[e]})),c.insertFresnelShader(),c.name=n.name,c.userData.id=i.userData.id,a.tools.bind(c),{material:c,setTextureFns:u}},toNormal:e=>{const t=(0,o.mergeMaterial)(e,(0,o.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=b.uniforms;return Object.keys(n).filter((e=>!g.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),{material:t,normal:{type:a.tools.type,uniforms:r,name:e.name},textures:a.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=a.tools.create(t);return Object.keys(r).filter((e=>!g.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,p.M)(e,"type",a.tools.type)},validType:e=>"Fresnel"===e.userData.type};class v extends u.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new u.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,this.isSpecialMaterial=!0,t?(this.fresnelBias=new u.Uniform(t.fresnelBias),this.fresnelScale=new u.Uniform(t.fresnelScale),this.fresnelPower=new u.Uniform(t.fresnelPower)):(this.fresnelBias=new u.Uniform(b.uniforms.fresnelBias.value),this.fresnelScale=new u.Uniform(b.uniforms.fresnelScale.value),this.fresnelPower=new u.Uniform(b.uniforms.fresnelPower.value)),this.clock=new u.Clock,this.isSurge=new u.Uniform(!1),this.deltaTime=new u.Uniform(0),!this.cubeCamera){const e=new u.WebGLCubeRenderTarget(2048);e.texture.mapping=u.CubeRefractionMapping,this.cubeCamera=new u.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,b.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,b.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,b.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,b.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,b.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 b={uniforms:{depthTest:new u.Uniform(!0),depthWrite:new u.Uniform(!0),isSurge:new u.Uniform(!1),deltaTime:new u.Uniform(0),fresnelBias:new u.Uniform(0),fresnelScale:new u.Uniform(1),fresnelPower:new u.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "};var y,x,w=r(3263),S=r(1398);const M={color:l.Gf.color,opacity:l.Gf.opacity};class T{constructor(e){this.runScene=e}}(y=T).tools={type:"LineBasicMaterial",bind(e){(0,p.M)(e,"type","LineBasicMaterial")},create:()=>{var e=new u.LineBasicMaterial;return y.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:i,load:s}=t,o=[];return s&&o.push(...w.F6.filter(i.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.materialEx.setTexture({material:a,type:t,newVal:r},!1)}})))),n.runScene.materialEx.parseNromals(r,a),y.tools.bind(a),{material:a,setTextureFns:o}},toNormal:e=>({material:e.clone(),normal:{type:y.tools.type},textures:[]}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:()=>[],snapshot:{getDiff:e=>S.LV.getDiff(M,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;S.LV.set({def:M,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,o.updateMaterial)(r)}))}},validType:e=>e.type===y.tools.type,setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new h.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},textureNames:[]};class _{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;_.TextureNames.includes((0,c.lastArrayEle)(r))?this.runScene.materialEx.setTexture({material:t,type:(0,c.lastArrayEle)(r),newVal:n}).then():this.runScene.undoEx.addUndo(new h.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(x=_).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],_.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"],_.tools={type:"Matcap",textureNames:x.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new h.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return _.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new u.MeshMatcapMaterial;return x.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="Matcap-"+t.name),r},parseData:(e,t)=>{const{normal:r,texture:n,material:a}=e,{data:i,load:s}=n,l=(0,o.mergeMaterial)(a,new u.MeshMatcapMaterial),c=(delete l.emissive,[]);return s&&c.push(...i.map((e=>()=>{t.materialEx.setTexture({material:l,type:e.type,newVal:e.texture},!1)}))),Object.keys(r.uniforms).filter((e=>!_.IgnoredAttributes.includes(e))).map((e=>{l[e]="normalScale"===e?new u.Vector2(r.uniforms[e].x,r.uniforms[e].y):r.uniforms[e]})),l.name=r.name,l.userData.id=a.userData.id,x.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{var t=x.tools.getTextures(e);const r=(0,o.mergeMaterial)(e,(0,o.createDefMaterial)()),n=(r.userData=Object.assign({},r.userData),r.name=e.name,{}),a=new u.MeshMatcapMaterial;return Object.keys(e).filter((e=>!_.TextureNames.includes(e))).filter((e=>!_.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],i=a[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?r!==i&&(n[t]=r):"normalScale"!==t||r.x===i.x&&r.y===i.y||(n[t]=r)})),{material:r,normal:{type:x.tools.type,uniforms:n,name:e.name},textures:t}},clone:(e,t)=>e,copy:(e,t)=>{const r=x.tools.create(t);return Object.keys(r).filter((e=>!_.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,p.M)(e,"type",x.tools.type)},validType:e=>"Matcap"===e.userData.type};const E="\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 ",D="\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 ",O={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 u.Matrix3,new u.Matrix3,new u.Matrix3,new u.Matrix3,new u.Matrix3,new u.Matrix3]},maskUvTransArray:{value:[new u.Matrix3,new u.Matrix3,new u.Matrix3,new u.Matrix3,new u.Matrix3]},diffuse:{value:new u.Color(16777215)},uvTransform:{value:new u.Matrix3},shadowShade:{value:.6}},vertex:"\n#include <common>\n#include <uv_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 <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 <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#define MAX_TEX 6\nuniform mat3 mapUvTransArray[MAX_TEX];\nuniform mat3 maskUvTransArray[MAX_TEX - 1];\nuniform sampler2D mapArray[MAX_TEX];\nuniform sampler2D maskArray[MAX_TEX - 1];\nuniform float shadowShade;\n\n// Insert Noise2D\nfloat sum(vec3 v) {return v.x + v.y + v.z;}\nvec3 textureNoTile(sampler2D tex, vec2 tUv, float offsetScale) {\n // cheap (cache friendly) lookup\n float k = noise2D(0.25 * tUv);\n\n float l = k * 8.0;\n float f = fract(l);\n float ia = floor(l);\n float ib = ia + 1.0;\n\n // can replace with any other hash\n vec2 offa = sin(vec2(3.0, 7.0) * ia);\n vec2 offb = sin(vec2(3.0, 7.0) * ib);\n\n vec2 duvdx = dFdx(tUv);\n vec2 duvdy = dFdy(tUv);\n vec3 cola = textureGrad(tex, tUv + offsetScale * offa, duvdx, duvdy).xyz;\n vec3 colb = textureGrad(tex, tUv + offsetScale * offb, duvdx, duvdy).xyz;\n\n return mix(cola, colb, smoothstep(0.2, 0.8, f - 0.1 * sum(cola-colb)));\n}\nvec4 texSampler(sampler2D tex, vec2 tUv, float offsetScale) {\n return vec4(textureNoTile(tex, tUv, offsetScale), 1.0);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n \n // Custom UV Start\n #if MAX_TEX > 0\n vec2 vCustomMapUv[MAX_TEX];\n for (int i = 0; i < MAX_TEX; i++) {\n vCustomMapUv[i] = (mapUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n #if MAX_TEX > 1\n vec2 vCustomMaskUv[MAX_TEX - 1];\n for (int i = 0; i < MAX_TEX - 1; i++) {\n vCustomMaskUv[i] = (maskUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n // Custom UV End\n \n // Custom Texture Start\n float offsetScale = 1.2;\n vec4 maskColor = vec4(1.0);\n vec4 textureColor = vec4(1.0);\n #if MAX_TEX > 0\n textureColor = texSampler(mapArray[0], vCustomMapUv[0], offsetScale);\n #endif\n #if MAX_TEX > 1\n maskColor = texture2D(maskArray[0], vCustomMaskUv[0]);\n textureColor = mix(textureColor, texSampler(mapArray[1], vCustomMapUv[1], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 2\n maskColor = texture2D(maskArray[1], vCustomMaskUv[1]);\n textureColor = mix(textureColor, texSampler(mapArray[2], vCustomMapUv[2], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 3\n maskColor = texture2D(maskArray[2], vCustomMaskUv[2]);\n textureColor = mix(textureColor, texSampler(mapArray[3], vCustomMapUv[3], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 4\n maskColor = texture2D(maskArray[3], vCustomMaskUv[3]);\n textureColor = mix(textureColor, texSampler(mapArray[4], vCustomMapUv[4], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 5\n maskColor = texture2D(maskArray[4], vCustomMaskUv[4]);\n textureColor = mix(textureColor, texSampler(mapArray[5], vCustomMapUv[5], offsetScale), maskColor.r);\n #endif\n diffuseColor *= textureColor;\n // Custom Texture End\n \n // ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n // reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n // vec3 outgoingLight = reflectedLight.indirectDiffuse;\n vec3 outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n \n // gl_FragColor = vec4(diffuse, opacity * (1.0 - getShadowMask()));\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n "};var k,P=r(2233),A=r(9430);const C={diffuse:{type:"color",label:["uniforms","diffuse","value"],val:{r:1,g:1,b:1},shortKey:"df"},shadowShade:{type:"number",label:["uniforms","shadowShade","value"],val:.6,shortKey:"ss"},terrainMap0:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[0])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[0]=r},shortKey:"p0"},terrainMap1:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[1])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[1]=r},shortKey:"p1"},terrainMap2:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[2])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[2]=r},shortKey:"p2"},terrainMap3:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[3])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[3]=r},shortKey:"p3"},terrainMap4:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[4])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[4]=r},shortKey:"p4"},terrainMap5:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[5])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[5]=r},shortKey:"p5"},terrainMap6:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[6])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[6]=r},shortKey:"p6"},terrainMap7:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[7])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[7]=r},shortKey:"p7"},terrainMask0:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[0])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[0]=r},shortKey:"k0"},terrainMask1:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[1])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[1]=r},shortKey:"k1"},terrainMask2:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[2])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[2]=r},shortKey:"k2"},terrainMask3:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[3])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[3]=r},shortKey:"k3"},terrainMask4:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[4])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[4]=r},shortKey:"k4"},terrainMask5:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[5])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[5]=r},shortKey:"k5"},terrainMask6:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[6])?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[6]=r},shortKey:"k6"}};class L{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e,a=r[0],i=(0,c.lastArrayEle)(r),s=a+"-"+i;if(L.BaseTextureNames.includes(a)){const e=ce.getTexture({material:t,type:s});this.runScene.undoEx.addUndo(new A.Z({undo:()=>{t.uniforms[a].value[Number(i)]=e,this.runScene.cb.texture.setMaterial.cb({target:t,type:s,oldVal:n,val:e,targetType:"material"})},redo:()=>{t.uniforms[a].value[Number(i)]=n,this.runScene.cb.texture.setMaterial.cb({target:t,type:s,oldVal:e,val:n,targetType:"material"})}}).execute())}else this.runScene.undoEx.addUndo(new h.Z({target:t,typeList:["uniforms",...r],newVal:n}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=O.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=O.vertex,t.fragmentShader=O.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,E)})}mergeUniforms(e,t){if(e&&t)for(const r in e)t[r]=e[r]}onTexRepeatChange(e,t,r){e&&0<=t&&(r?(r=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)):(r=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)))}}(k=L).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],L.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"],L.BaseTextureNames=["maskArray","mapArray"],L.tools={type:"MixTexture",textureNames:k.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:r,texture:n}=e;var[e,a]=r.split("-");return e=new h.Z({target:t,typeList:["uniforms",e,"value",a+""],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){const{material:t,type:r}=e;var[e,n]=r.split("-");return t.uniforms[e].value[Number(n)]},getTextures:e=>{const t=[];return L.TextureNames.forEach((r=>{var n=parseInt(r.slice(-1));r.startsWith("terrainMap")?e.uniforms.mapArray.value[n]&&t.push({type:r,texture:e.uniforms.mapArray.value[n]}):r.startsWith("terrainMask")&&e.uniforms.maskArray.value[n]&&t.push({type:r,texture:e.uniforms.maskArray.value[n]})})),t},create:(e,t)=>{const r=new u.ShadowMaterial({color:0,opacity:1});return r.uniforms=u.UniformsUtils.clone(O.uniforms),e.materialEx.def.map.MixTexture.insertShader(r),k.tools.bind(r),r},parseData:(e,t)=>{const{texture:r,normal:n,material:a}=e,{data:i,load:s}=r,o=new u.ShadowMaterial({color:0,opacity:1}),l=(o.uniforms=u.UniformsUtils.clone(O.uniforms),t.materialEx.def.map.MixTexture.insertShader(o),[]);return s&&l.push(...i.map((e=>()=>{var r=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(o.uniforms.mapArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(o,r,!0),t.cb.texture.setMaterial.cb({target:o,type:"mapArray-"+r,oldVal:null,val:e.texture,targetType:"material"})):e.type.startsWith("terrainMask")&&(o.uniforms.maskArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(o,r,!1),t.cb.texture.setMaterial.cb({target:o,type:"maskArray-"+r,oldVal:null,val:e.texture,targetType:"material"}))}))),Object.keys(n.uniforms).filter((e=>!L.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];"diffuse"===e?o.uniforms[e].value=new u.Color(parseInt(t,16)):"uvTransform"!==e&&(o.uniforms[e].value=t)})),o.name=n.name,o.userData.id=a.userData.id,k.tools.bind(o),{material:o,setTextureFns:l}},toNormal:e=>{const t=(0,o.createDefMaterial)(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:k.tools.type,uniforms:{},name:e.name},textures:k.tools.getTextures(e)}),{}),n=e.uniforms,a=O.uniforms;return Object.keys(n).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=n[e].value,i=a[e].value;"diffuse"===e?t.getHexString()!==i.getHexString()&&(r[e]=t.getHexString()):"uvTransform"!==e&&t!==i&&(r[e]=t)})),{material:t,normal:{type:k.tools.type,uniforms:r,name:e.name},textures:k.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=k.tools.create(t);return Object.keys(r).filter((e=>!L.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,p.M)(e,"type",k.tools.type)},validType:e=>"MixTexture"===e.userData.type,snapshot:{getDiff:e=>S.LV.getDiff(C,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;S.LV.set({def:C,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,o.updateMaterial)(r)}))}}};var R,I=r(4156),B=r(9457);class j{constructor(e){this.runScene=e}}(R=j).tools={type:"MyPointsMaterial",bind(e){(0,p.M)(e,"type","MyPointsMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:(e,t)=>(t=t.modelEx.def.vertices.rain.createMaterial(e),R.tools.bind(t),t),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new h.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,s=[];var{name:e,size:n}=n;const l=j.tools.create({size:n},t);return(0,P.x)(l,(0,P.Ki)(r)),l.fog=r.fog,e&&(l.name=e),i&&s.push(...a.map((e=>{const{type:r,texture:n}=e;return()=>{t.materialEx.setTexture({material:l,type:r,newVal:n},!1),(0,o.updateMaterial)(l)}}))),{material:l,setTextureFns:s}},toNormal:e=>{const t=(0,o.createDefMaterial)();var r={type:j.tools.type,name:e.name,size:e.size};return t.map=e.map,t.userData=Object.assign({},t.userData),{normal:r,textures:j.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=j.tools.type,t},textureNames:[]};var U,N=r(110),z=r(6272),F=r(8089),V=r(6292);class G{constructor(e){this.runScene=e,this.runScene.cb.texture.setInfo.add("Physical",(({type:t,texture:r})=>{"repeat"===t&&(t=e.uniqueEx.texture.getMaterials((0,P.Ki)(r)))&&(0,c.mapObj)(t,(t=>{(t=e.uniqueEx.material.get(t))&&(ce.getTypeByMaterial(t),G.tools.type)}))}))}undo(e){var{material:e,list:t,val:r}=e;G.TextureNames.includes((0,c.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,c.lastArrayEle)(t),newVal:r}).then():this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:[...t],newVal:r}).execute())}}(U=G).IgnoredAttributes=["_listeners","version","userData","color","emissive","uuid","name","type","defines","onBeforeCompile"],G.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap","iridescenceMap","iridescenceThicknessMap"],G.tools={type:"Physical",textureNames:U.TextureNames.map((e=>"envMap"===e?{type:e,isEnv:!0}:{type:e})),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new h.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return G.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new V.Z.MeshPhysicalMaterial;return U.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="Physical-"+t.name),r},parseData:(e,t)=>{const{normal:r,texture:n,material:a}=e,{data:i,load:s}=n,l=(0,o.mergeMaterial)(a,new V.Z.MeshPhysicalMaterial),c=[];return s&&c.push(...i.map((e=>()=>{t.materialEx.setTexture({material:l,type:e.type,newVal:e.texture},!1).then()}))),Object.keys(r.uniforms).filter((e=>!G.IgnoredAttributes.includes(e))).map((e=>{var t=r.uniforms[e];"attenuationColor"===e||"sheenColor"===e||"specularColor"===e?l[e]=(0,F.ZD)(t):"clearcoatNormalScale"===e?l[e]=new V.Z.Vector2(t.x,t.y):"normalScale"===e?l[e].set(t,t):l[e]=t})),l.name=r.name,l.userData.id=a.userData.id,U.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,o.mergeMaterial)(e,(0,o.createDefMaterial)()),r=(t.name=e.name,{}),n=new V.Z.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!G.TextureNames.includes(e))).filter((e=>!G.IgnoredAttributes.includes(e))).map((t=>{let a=e[t];const i=n[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?a.getHexString()!==i.getHexString()&&(r[t]=a.getHexString()):"clearcoatNormalScale"===t?a.x===i.x&&a.y===i.y||(r[t]=a):"normalScale"===t?a.x===i.x&&a.y===i.y||(r[t]=a.x):(0,z.Xq)(i,a)&&(r[t]=a)})),{material:t,normal:{type:U.tools.type,uniforms:r,name:e.name},textures:U.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=U.tools.create(t);return Object.keys(r).filter((e=>!G.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r.color.copy(e.color),r.emissive.copy(e.emissive),r},bind:e=>{(0,p.M)(e,"type",U.tools.type)},validType:e=>"MeshPhysicalMaterial"===e.type};var H=r(5180);const Z={uniforms:{tDiffuse:new u.Uniform(null),h:new u.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}"},W={uniforms:{tDiffuse:new u.Uniform(null),v:new u.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 K;new u.Uniform(null),new u.Uniform(null),new u.Uniform(0),new u.Uniform(0),new u.Uniform(0),new u.Uniform(new u.Vector2),new u.Uniform(.1),new u.Uniform(1e3);class q{constructor(e){this.materials={},this.render=()=>{(0,c.mapObj)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.runScene=e,this.init(),this.runScene.cb.material.dispose.add("Reflector",this.dispose.bind(this))}init(){this.runScene.cb.render.add("Reflector-render",this.render),this.runScene.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){const t=e.material;var r=(0,c.getId)();t.userData.id=r,this.materials[r]=e}undo(e){var{material:e,list:t,val:r}=e;q.TextureNames.includes((0,c.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,c.lastArrayEle)(t),newVal:r}).then():this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}(K=q).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],q.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"],q.tools={type:"Reflector",textureNames:K.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new h.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>(0,o.getTexturesByMaterial)(e),create:(e,t)=>{const r=new X(void 0,void 0,e);return r.insertReflectorShader(),K.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),e.materialEx.def.map.Reflector.bindData({model:t,material:r}),r},parseData:(e,t)=>{const{texture:r,normal:n,models:a,material:i}=e,{data:s,load:l}=r,c=(0,o.mergeMaterial)(i,new X(void 0,void 0,t)),d=[];return l&&d.push(...s.map((e=>()=>{t.materialEx.setTexture({material:c,type:e.type,newVal:e.texture},!1)}))),Object.keys(n.uniforms).filter((e=>!q.TextureNames.includes(e))).map((e=>{c[e]="normalScale"===e?new u.Vector2(n.uniforms[e].x,n.uniforms[e].y):n.uniforms[e]})),c.setRTSize(c.resolution),c.setBlurPass(c.blurSize),c.insertReflectorShader(),t.materialEx.def.map.Reflector.bindData({model:a[0],material:c}),c.name=n.name,c.userData.id=i.userData.id,K.tools.bind(c),{material:c,setTextureFns:d}},toNormal:e=>{const t=(0,o.mergeMaterial)(e,(0,o.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=Y.uniforms;return Object.keys(n).filter((e=>!q.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),t.normalScale&&(r.normalScale=t.normalScale),{material:t,normal:{type:K.tools.type,uniforms:r,name:e.name},textures:K.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=K.tools.create(t);return Object.keys(r).filter((e=>!q.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,p.M)(e,"type",K.tools.type)},validType:e=>"Reflector"===e.userData.type};class X extends u.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=Y.uniforms.opacity.value,this.transparent=Y.uniforms.transparent.value,this.roughness=Y.uniforms.roughness.value,this.metalness=Y.uniforms.metalness.value),this.runScene=r,this.isSpecialMaterial=!0,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new u.Uniform(t.mirror),this.mixBlur=new u.Uniform(t.mixBlur),this.mixStrength=new u.Uniform(t.mixStrength),this.mixContrast=new u.Uniform(t.mixContrast)):(this.resolution=Y.uniforms.resolution.value,this.blurSize=Y.uniforms.blurSize.value,this.mirror=new u.Uniform(Y.uniforms.mirror.value),this.mixBlur=new u.Uniform(Y.uniforms.mixBlur.value),this.mixStrength=new u.Uniform(Y.uniforms.mixStrength.value),this.mixContrast=new u.Uniform(Y.uniforms.mixContrast.value)),this.textureMatrix=new u.Uniform(new u.Matrix4),this.reflectorWorldPosition=new u.Vector3,this.cameraWorldPosition=new u.Vector3,this.rotationMatrix=new u.Matrix4,this.normal=new u.Vector3,this.view=new u.Vector3,this.lookAtPosition=new u.Vector3,this.target=new u.Vector3,this.tempQuaternion=new u.Vector4,this.virtualCamera=new u.PerspectiveCamera,this.reflectorPlane=new u.Plane,this.clipPlane=new u.Vector4,e={minFilter:u.LinearFilter,magFilter:u.LinearFilter,type:u.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new u.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new u.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new u.Uniform(this.glRT1.texture),this.tDiffuseBlur=new u.Uniform(this.glRT2.texture),this.hBlurPass=new H.T(Z),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 H.T(W),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=Y.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",Y.vertexShader),e.fragmentShader=Y.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",Y.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 Y={uniforms:{opacity:new u.Uniform(1),transparent:new u.Uniform(!1),roughness:new u.Uniform(1),metalness:new u.Uniform(.6),resolution:new u.Uniform(1024),blurSize:new u.Uniform(1024),mirror:new u.Uniform(0),mixBlur:new u.Uniform(10),mixStrength:new u.Uniform(2),mixContrast:new u.Uniform(1),depthTest:new u.Uniform(!0),depthWrite:new u.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "};var Q,J,$=r(9667);const ee={opacity:{type:"number",label:["uniforms","opacity","value"],val:1,shortKey:"op"},tFlip:{type:"number",label:["uniforms","tFlip","value"],val:-1,shortKey:"tf"},tCube:{type:"texture",val:null,get:e=>(e=e.uniforms.tCube.value)?(0,P.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.tCube.value=r},shortKey:"tc"}};class te{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;te.TextureNames.includes(t[1])?this.runScene.materialEx.setTexture({material:e,type:t[1],newVal:r}).then():this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:[...t],newVal:r}).execute())}}(Q=te).TextureNames=["tCube"],te.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],te.tools={type:"SkyBox",textureNames:Q.TextureNames.map((e=>"tCube"===e?{type:e,isCube:!0}:{type:e})),setTexture:e=>{const{material:t,type:r,texture:n}=e;if(n&&!(0,$.isCubeTexture)(n))throw TypeError("SkyBox材质仅可使用立方体纹理");return e=new h.Z({target:t,typeList:["uniforms",r,"value"],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:e=>{var{material:e,type:t}=e;return e.uniforms[t].value},getTextures:e=>{const t=[];return te.TextureNames.forEach((r=>{var n;e[r]?t.push({type:r,texture:e[r]}):null!=(n=e.uniforms[r])&&n.value&&t.push({type:r,texture:e.uniforms[r].value})})),t},create:(e,t)=>{var r=V.Z.ShaderLib.cube;const n=new V.Z.ShaderMaterial({uniforms:(0,d.d9)(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,depthWrite:!1,side:V.Z.BackSide});return n.name="SkyBoxMaterial",Q.tools.bind(n),n},parseData:(e,t)=>{const{texture:r,normal:n,material:a}=e,{data:i,load:s}=r;e=V.Z.ShaderLib.cube;const o=new V.Z.ShaderMaterial({uniforms:(0,d.d9)(e.uniforms),vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,depthWrite:!1,side:V.Z.BackSide}),l=(o.name="SkyBoxMaterial",[]);return s&&l.push(...i.map((e=>()=>{o.uniforms[e.type].value=e.texture,t.materialEx.setTexture({material:o,type:e.type,newVal:e.texture},!1).then()}))),Object.keys(n.uniforms).filter((e=>!te.TextureNames.includes(e))).map((e=>{o.uniforms[e].value=n.uniforms[e]})),o.name=n.name,o.userData.id=a.userData.id,Q.tools.bind(o),{material:o,setTextureFns:l}},toNormal:e=>{const t=(0,o.createDefMaterial)(),r=(t.name=e.name,{}),n=e.uniforms;var a=V.Z.ShaderLib.cube;const i=new V.Z.ShaderMaterial({uniforms:(0,d.d9)(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,depthWrite:!1,side:V.Z.BackSide});return Object.keys(n).filter((e=>!te.TextureNames.includes(e))).map((e=>{var t=n[e].value,a=i.uniforms[e].value;(0,z.Xq)(a,t)&&(r[e]=t)})),{material:t,normal:{type:Q.tools.type,uniforms:r,name:e.name},textures:Q.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=Q.tools.create(t);return Object.keys(r).filter((e=>!te.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,p.M)(e,"type",Q.tools.type)},validType:e=>"SkyBox"===e.userData.type,snapshot:{getDiff:e=>S.LV.getDiff(ee,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;S.LV.set({def:ee,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,o.updateMaterial)(r)}))}}};const re="\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 <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 <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 ",ne="\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 <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, vMapUv).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 ",ae={emissive:l.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 ie{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;ie.TextureNames.includes((0,c.lastArrayEle)(r))?this.runScene.materialEx.setTexture({material:t,type:(0,c.lastArrayEle)(r),newVal:n}).then():this.runScene.undoEx.addUndo(new h.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(J=ie).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],ie.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],ie.tools={type:"TreeLeaf",textureNames:J.TextureNames.map((e=>"envMap"===e?{type:e,isEnv:!0}:{type:e})),setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new h.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return ie.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new oe(e);return J.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name,r.setSize(t),r.setWorldPos(t)),r},parseData:(e,t)=>{const{normal:r,texture:n,material:a,models:i}=e,{data:s,load:l}=n,c=(0,o.mergeMaterial)(a,new oe(t)),d=(c.setSize(i[0]),c.setWorldPos(i[0]),[]);return l&&d.push(...s.map((e=>()=>{t.materialEx.setTexture({material:c,type:e.type,newVal:e.texture},!1)}))),Object.keys(r.uniforms).filter((e=>!ie.IgnoredAttributes.includes(e))).map((e=>{var t=r.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?c[e]=new u.Vector2(t.x,t.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?c.uniforms[e]=new u.Uniform(t):"colorGradient"===e?c.uniforms[e]=new u.Uniform(new u.Color(parseInt(t,16))):c[e]=r.uniforms[e])})),c.name=r.name,c.userData.id=a.userData.id,J.tools.bind(c),{material:c,setTextureFns:d}},toNormal:(e,t)=>{var r=J.tools.getTextures(e);const n=(0,o.mergeMaterial)(e,(0,o.createDefMaterial)()),a=(n.name=e.name,{}),i=new oe(t);return Object.keys(e).filter((e=>!ie.TextureNames.includes(e))).filter((e=>!ie.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],n=i[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?r.x===n.x&&r.y===n.y||(a[t]=r):"uniforms"===t?Object.keys(r).map((t=>{const r=e.uniforms[t].value,n=i.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?r!==n&&(a[t]=r):"colorGradient"===t&&r.getHexString()!==n.getHexString()&&(a[t]=r.getHexString())})):r!==n&&(a[t]=r))})),{material:n,normal:{type:J.tools.type,uniforms:a,name:e.name},textures:r}},clone:(e,t)=>e,copy:(e,t)=>{const r=J.tools.create(t);return Object.keys(r).filter((e=>!ie.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,p.M)(e,"type",J.tools.type)},validType:e=>"TreeLeaf"===e.userData.type,snapshot:{getDiff:e=>S.LV.getDiff(ae,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;S.LV.set({def:ae,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,o.updateMaterial)(r)}))}}};const se=new u.Clock;class oe extends u.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new u.Uniform(0),windForce:new u.Uniform(.3),windSpeed:new u.Uniform(.5),windWaveScale:new u.Uniform(.25),colorGradient:new u.Uniform(new u.Color(65280)),colorLevel:new u.Uniform(-.5),colorFade:new u.Uniform(-.25),leavesCore:new u.Uniform(.3),leavesSize:new u.Uniform(new u.Vector3),leavesPos:new u.Uniform(new u.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=re,e.fragmentShader=ne,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,D)}}update(){this.uniforms.time.value=se.getElapsedTime()}setSize(e){var t=new u.Vector3;e.getWorldScale(t),t=new u.Vector3,(new u.Box3).setFromObject(e).getSize(t),this.uniforms.leavesSize.value=t}setWorldPos(e){var t=new u.Vector3;e.getWorldPosition(t),this.uniforms.leavesPos.value=t}}const le={SpriteMaterial:N.Z,FakeInterior:m,Fresnel:g,Matcap:_,MixTexture:L,Physical:G,MeshLambertMaterial:I.Z,MyMeshPhongMaterial:B.Z,MeshPhongMaterial:B.Z,Reflector:q,TreeLeaf:ie,SkyBox:te,BasicMaterial:l.ZP,LineBasicMaterial:T,MyPointsMaterial:j,Water:i.Z,MyMeshLambertMaterial:I.Z,[t.Z.tools.type]:t.Z};class ce{constructor(e){this.runScene=e,this.map={SpriteMaterial:new N.Z(e),FakeInterior:new m(e),Fresnel:new g(e),Matcap:new _(e),MixTexture:new L(e),Physical:new G(e),Reflector:new q(e),TreeLeaf:new ie(e),SkyBox:new te(e),BasicMaterial:new l.ZP(e)},e.cb.unique.material.add.add("def-material",(t=>{var r,n=ce.getTypeByMaterial(t);n&&null!=(n=null==(n=le[n])?void 0:(r=n.tools).onAdd)&&n.call(r,{material:t,runScene:e})}))}static create(e,t){return le[e].tools.create(t)}static copy(e,t,r){return le[e].tools.copy(t,r)}static clone(e,t){return le[e].tools.clone(t)}static setTexture(e){var t=e.material;if(t=this.getTypeByMaterial(t))return le[t].tools.setTexture(e)}static getTexture(e){var t=e.material;return(t=this.getTypeByMaterial(t))?le[t].tools.getTexture(e):null}static toNromal(e,t,r){return le[e].tools.toNormal(t,r)}static parseData(e,t,r){var n=t.material;let a=e;return le.LineBasicMaterial.tools.validType(n)&&(a=le.LineBasicMaterial.tools.type),(null==(e=le[a])?void 0:e.tools.parseData(t,r))||{material:(0,o.createDefMaterial)(),setTextureFns:[]}}static bind(e){e.material&&("MeshStandardMaterial"===e.material.type?l.ZP.tools.bind(e):"SpriteMaterial"===e.material.type&&N.Z.tools.bind(e))}static _getTextures(e){var t=ue(e);return t?le[t].tools.getTextures(e):[]}static getTextures(e){let t=[];return(Array.isArray(e)?e:[e]).map((e=>{t.push(...this._getTextures(e))})),t}static parseNode(e){e.material&&(e=e.material,(0,o.isBaseMaterial)(e)&&l.ZP.tools.bind(e),e.isSpriteMaterial&&N.Z.tools.bind(e))}static validType(e,t){return!le[e].tools.validType||le[e].tools.validType(t)}static getTypeByMaterial(e){var t=e.userData.type;if(this.validType(t,e))return t}static getTextureNames(e){var t=e.userData.type;return this.validType(t,e)?le[t].tools.textureNames:[]}}ce.snapshot={getDiff:e=>{var t=ue(e);if(!le[t])throw TypeError("该材质没有类型");const r=le[t].tools.snapshot.getDiff(e);return(t=s.Z.snapshot.getDiff(e))&&(r.clip=t),r},set:e=>{var t=e.material;if(t=ue(t),!le[t])throw TypeError("该材质没有类型");le[t].tools.snapshot.set(e),s.Z.snapshot.set(e)}};const ue=e=>{var t=e.userData.type;if(t)return ce.validType(t,e)?t:void 0}},6053:(e,t,r)=>{r.d(t,{Z:()=>d});var n,a=r(6001),i=r(8881),s=r(3736),o=r(1398),l=r(2233),c=r(135);const u={clip:{type:"v3",val:{x:-1,y:-1,z:-1},shortKey:"clip",get:e=>d.snapshot.getV3(e,!0),onUpdate:e=>{const{target:t,data:r,runScene:n}=e;(0,a.mapObj)(r,((e,r)=>{n.materialEx.clipping.setLocal({material:t,axis:e,local:r})}))}}};class d{constructor(e){this.parse=e=>{const t=e.material;(e=this.getClip(t))&&(0,a.mapObj)(e,((e,r)=>{(0,a.mapObj)(r,((r,n)=>{this.parseData({material:t,axis:e,type:r,val:n})}))}))},this.axisMap={x:new i.Plane(new i.Vector3(1,0,0),0),y:new i.Plane(new i.Vector3(0,-1,0),0),z:new i.Plane(new i.Vector3(0,0,-1),0)},this.setSavedHelper=e=>{const{material:t,axis:r,plane:n}=e,a=(t.clipHelper||(t.clipHelper={}),t.clipHelper);return a[r]||(a[r]=this.getHelper({model:n,axis:r})),a[r]},this.getSavedHelper=e=>{var{material:e,axis:t}=e;return null==(e=null==e?void 0:e.clipHelper)?void 0:e[t]},this.heleprColor={x:16711680,y:65280,z:255},this.getHelper=e=>{var{model:e,axis:t}=e;const r=new i.PlaneHelper(e,20,this.heleprColor[t]);return r.children[0].material.side=2,this.runScene.helperEx.setHelper(r,!0),(0,s.qh)(r),r.visible=!1,r},this.getHelperData=e=>{var t=e.type;if(e=this.getSavedHelper(e))return e[t]},(this.runScene=e).cb.loaderer.gltf.material.afterParseNromal.add("MaterialClipping",this.parse)}setState(e){const{material:t,axis:r,state:n}=e;if((0,c.isNormalMaterial)(t)){if(e=this.getPleanByAxis(r),!t.clippingPlanes){if(!n)return;t.clippingPlanes=[]}n?this.getSaved(t,r)||(t.clippingPlanes.push(e),this.save({material:t,axis:r,model:e}),this.bindData({material:t,axis:r,type:"local",val:0}),this.setHelperState({material:t,state:n,plane:e,axis:r})):this.delAxis({material:t,axis:r})}}getPleanByAxis(e){const t=this.axisMap[e].clone();return t.userData={},(0,s.qh)(t),t}getSaved(e,t){if(e=e.clip)return e[t]}save(e){const{material:t,axis:r,model:n}=e;t.clip||(t.clip={}),t.clip[r]=n}getModel(e,t){var r=this.getPleanByAxis(t);return this.save({material:e,axis:t,model:r}),r}setLocal(e){var t,{material:e,axis:r,local:n}=e;let a=null==(t=null==e?void 0:e.clip)?void 0:t[r];(a=a||this.getModel(e,r)).constant=n,this.bindData({material:e,axis:r,type:"local",val:n})}getLocal(e){var{material:e,axis:t}=e;return this.getData({material:e,axis:t,type:"local"})||0}bindData(e){const{material:t,axis:r,type:n,val:a}=e,i=(t.userData.clipping||(t.userData.clipping={}),t.userData.clipping);(i[r]||(i[r]={}),i[r])[n]=a}getData(e){var{material:e,axis:t,type:r}=e;return null==(e=null==(e=e.userData.clipping)?void 0:e[t])?void 0:e[r]}getClip(e){return e.userData.clipping}setData(e){var{material:e,axis:t,type:r,val:n}=e;"local"===r?this.setLocal({material:e,axis:t,local:n}):"helperSize"===r&&this.setHelperData({material:e,axis:t,type:"size",val:n})}parseData(e){var{material:t,axis:r}=e;this.setState({material:t,axis:r,state:!0}),this.setData(e)}setHelperState(e){var{material:e,axis:t,state:r,plane:n}=e,a=this.getSavedHelper({material:e,axis:t});if(!r)return a?void this.runScene.modelEx.remove(a,!1):void 0;a||(r=this.setSavedHelper({material:e,axis:t,plane:n}),this.runScene.modelEx.add(r,void 0,{addUndo:!1}))}setHelperData(e){let t=this.getSavedHelper(e);var{material:r,axis:n}=e;if(!t){var a=r.clip[n];if(!a)return;t=this.setSavedHelper({material:r,axis:n,plane:a})}var{type:r,val:n}=e;"size"===r?(t.size=n,this.bindData(Object.assign(Object.assign({},e),{type:"helperSize",val:n}))):t.visible=n}getHelperSize(e){return(null==(e=this.getSavedHelper(e))?void 0:e.size)||20}delAxis(e){var t;const{material:r,axis:n}=e,a=null==(t=r.clip)?void 0:t[n];a&&(void 0!==(t=null==(t=r.clippingPlanes)?void 0:t.findIndex((e=>(0,l.Ki)(e)===(0,l.Ki)(a))))&&-1!==t&&r.clippingPlanes.splice(t,1),null!=(t=r.clip)&&delete t[n],this.delHelper(e))}delHelper(e){var{material:e,axis:t}=e,r=this.getSavedHelper({material:e,axis:t});r&&(this.runScene.modelEx.remove(r,!1),null!=(r=null==e?void 0:e.clipHelper)&&delete r[t])}static get(e){return e.userData.clipping}}(n=d).snapshot={getDiff:e=>n.snapshot.getV3(e),set:e=>{var{material:e,map:t,runScene:r,data:n}=e;o.LV.set({def:u,data:n,runScene:r,map:t,target:e})},baseV3:{x:-1,y:-1,z:-1},getV3:(e,t)=>{const r=n.get(e);if(r||t){const e={};return(0,a.mapObj)(n.snapshot.baseV3,(t=>{var n=null==r?void 0:r[t].local;e[t]=void 0!==n?n:-1})),e}}}},135:(e,t,r)=>{r.r(t),r.d(t,{SpecialMaterial:()=>W,baseIgnoreTypes:()=>P,canSetMaterial:()=>$,createDefMaterial:()=>L,defAllMaterialMap:()=>A,defBaseMaterialMap:()=>k,default:()=>C,disposeMaterial:()=>I,getBaseTextures:()=>U,getMaterialMapNameByModel:()=>ee,getMaterialType:()=>K,getMaterials:()=>Q,getTextures:()=>j,getTexturesByMaterial:()=>B,initMaterial:()=>z,isBaseMaterial:()=>Z,isColor:()=>F,isMaterial:()=>G,isMultiMaterial:()=>Y,isNormalMaterial:()=>re,materialIgnore:()=>q,mergeMaterial:()=>R,mergeMaterialAll:()=>X,setDefMaterialForSameGeo:()=>H,setMaterialIds:()=>J,setMaterialTexture:()=>N,specialMaterials:()=>te,updateMaterial:()=>V});var n=r(6001),a=r(8881),i=r(4330),s=r(1794),o=r(3736),l=r(9667);class c extends r(4616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:a,cb:i}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,this.cb=i}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,i.zX.includes(this.info)){if(!e)return;this.runScene.materialEx.setTexture({material:this.target,type:this.info,newVal:e},!1)}"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 u=c;var d=r(2510),h=r(2233),p=r(6272),m=r(144),f=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class g{constructor(e){this.data=this.getData(),this.pending=[],this.clonedTextures=[],this.mount=e=>{e.core.module.set("material",this)},this.complete=()=>{this.reset()},this.load=e=>{e=e.data;let{materialDef:t,material:r,model:a}=e;z(r),t.id||(e=(0,n.getId)(),t.id=e,(0,h.x)(r,e)),this.data.materialIns[t.id]||(this.data.materialIns[t.id]={material:r,models:[]}),this.data.materialIns[t.id].models.push(a)},this.done=e=>f(this,void 0,void 0,(function*(){var{json:t,core:r}=e,{materialMap:n,textureMap:a}=(null==(n=t.asset)?void 0:n.ex)||{};yield this.processTextureMap(a||{}),this.processMaterialMap(n||{},t),this.processClonedTextures(),yield this.loadTextures(r)})),this.parser=null,this.loadTexture=e=>{var t=e.data;const{textureDef:r,texture:a}=t;(0,l.mergeDefUserData)(r,a.userData),r.id||(t=(0,n.getId)(),r.id=t,(0,h.x)(a,t),(0,l.bindTextureBaseData)(a,this.runScene)),e.core.isImageBitmapLoader||(a.userData.flipY=!0);let i=a;(t=(0,l.isClonedTexture)(a))?(i=a,this.clonedTextures.push(a)):i=this.runScene.textureEx.getSameTexture(r.md5,a)||a,this.data.textureIns[r.id]=i},this.processTextureMap=(()=>{const e=e=>{const{target:t,data:r}=e;var n;r&&(({x:e,y:n}="object"==typeof r?r:{x:r,y:r}),t.x=e,t.y=n)};return t=>Promise.all((0,n.mapObj)(t,((t,r)=>f(this,void 0,void 0,(function*(){var{format:a,center:i,rotation:s,offset:o,repeat:l,isHelper:c,encoding:u,flipY:d}=r;if(!c){let r=this.data.textureIns[t];if(r){if(r.userData.cubeMap){const e={};(0,n.mapObj)(r.userData.cubeMap,((t,r)=>{e[t]=this.data.textureIns[r].userData.blob}));var c=r.userData;(r=yield this.runScene.textureEx.praseCubeByBlobMap(e)).userData=Object.assign(Object.assign({},c),r.userData),void 0!==r.userData.lightProbeIntensity&&(c=this.runScene.textureEx.setLightProbeForCube(r,!0,r.userData.lightProbeIntensity),r.userData.lightProbe=c),r.userData.blob=e.px,this.data.textureIns[t]=r}r.encoding=u||3e3,r.format=a,e({target:r.repeat,data:l}),e({target:r.center,data:i}),e({target:r.offset,data:o}),s&&(r.rotation=s),void 0!==d&&(r.userData.flipY=1===d),this.runScene.textureEx.initTextureAndAddtoAll(r)}}})))))})(),this.processMaterialMap=(()=>{const e=e=>f(this,void 0,void 0,(function*(){const{textures:t,normal:r,models:a,material:i}=e;var s=(0,n.mapObj)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));const{material:o,setTextureFns:l}=this.runScene.materialEx.parseData(r.type,{normal:r,texture:{data:s,load:this.runScene.optionsEx.options.texture.load},core:this,models:a,material:i});this.runScene.cb.loaderer.gltf.material.afterParseNromal.cb({material:o||i}),o&&(this.data.materialIns[(0,h.Ki)(i)].material=o,0<l.length&&this.lazyLoadFns.push(...l),a.map((e=>e.material=o)))}));return(t,r)=>Promise.all((0,n.mapObj)(t,((t,a)=>f(this,void 0,void 0,(function*(){var i=this.data.materialIns[t];if(i){const{material:t,models:s}=i;if(t){const{normal:o,textures:l}=a;o.type||(o.type=m.ZP.tools.type),"scene"===(null==(i=null==(i=r.asset)?void 0:i.ex)?void 0:i.type)&&r.asset.ex.sceneEx.materialId===t.userData.id&&(0,n.mapObj)(l,((e,r)=>{r=this.data.textureIns[r],N({material:t,type:e,texture:r})})),yield e({textures:l,models:s,material:t,normal:o}),t.needsUpdate=!0}}})))))})(),this.lazyLoadFns=[],this.loadTextures=(()=>{const e=e=>{e.callback("lazyLoadedTexture",""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n,a)=>{const i=this.lazyLoadFns[r];if(!i)return n(0),e(a);i(),setTimeout((()=>t(++r,n,a)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return e=>new Promise((r=>{this.runScene.optionsEx.options.texture.lazyLoad.open?t(0,r,e):(this.lazyLoadFns.map((e=>e())),r(0))}))})(),this.afterParse=e=>{const{data:t,core:r,json:n}=e;if("material"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){e=t.options.models;const[n]=e,a=[];n.material?(this.runScene.materialEx.add(n.material),a.push(n.material)):n.children.map((e=>{e.material&&(a.push(e.material),this.runScene.materialEx.add(e.material))})),r.models.push(...a)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new s.Z({loadedGltf:e=>{e.core.pending.push(this.done(e))},loadMaterial:this.load,loadTexture:this.loadTexture,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}getById(e){return this.data.materialIns[e]}parseSavedMap(e){e.map((e=>{e=this.data.materialIns[e],this.runScene.materialEx.add(e.material)}))}processInput(e,t){return f(this,void 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,"editor"===this.runScene.optionsEx.options.mode&&(e.userData.blob=t.userData.blob,e.userData.md5=t.userData.md5,e.userData.url=t.userData.url,e.userData.gm=t.userData.gm,(0,l.bindTextureBaseData)(e,this.runScene))):(this.runScene.textureEx.delete(e),(0,o.bv)(e,"cloneSourceId"),(0,l.disposeTexture)(e))}))}reset(){this.clonedTextures=[],this.data=this.getData(),this.pending=[],this.lazyLoadFns=[]}}var v=r(8818),b=r(7201);class y{constructor(e){this.resetItem=e=>{"material"===e.type&&e.datas.map((t=>{const r=t.data;let n=r.get("material");n||(n={},r.set("material",n)),e.targets.map((e=>{var t=(0,v.ee)(e);t&&v.Ws[t].tools.snapshot&&(t=(0,h.Ki)(e))&&(n[t]=this.getItem(e))}))}))},this.getDiff=()=>{let e={};return this.runScene.uniqueEx.material.getAll("values").map((t=>{t=t.material;var r=(0,v.ee)(t);r&&v.Ws[r].tools.snapshot&&(r=(0,h.Ki)(t))&&(e[r]=this.getItem(t))})),e},this.create=e=>{var t=this.getDiff();0!==(0,b.objLength)(t)&&e.data.set("material",t)},this.set=e=>{var t=e.snapshot.data.get("material");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.material.get(t))&&v.ZP.snapshot.set({material:t,data:r,runScene:this.runScene,map:e})}))},this.runScene=e,this.runScene.cb.snapshot.create.add("material",this.create),e.cb.snapshot.delUseless.add("material",(t=>{(0,n.mapObj)(t,((t,r)=>{const a=r.data.material;a&&((0,n.mapObj)(a,(t=>{e.uniqueEx.material.isUsed(t)||delete a[t]})),0===(0,b.objLength)(a)&&delete r.data.material)}))})),this.runScene.cb.snapshot.set.add("material",this.set),this.runScene.cb.snapshot.getLength.add("material",(e=>{var t=e.data.data.get("material");t&&(e.inputData.material=Object.keys(t).length)})),this.runScene.cb.snapshot.resetItem.add("material",this.resetItem)}getItem(e){return v.ZP.snapshot.getDiff(e)}}var x=r(6053),w=(t=r(110),r(272)),S=r(8089),M=r(8609),T=r(6292),_=r(9457),E=r(4156),D=r(3263),O=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const k={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},P=["_listeners","version","userData","uniforms","onBeforeCompile","uuid","name","type","defines"],A=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest","fog"];class C{constructor(e){this.materialX={},this.clean=()=>{this.dispose()},this.defMaterial=L(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.getScreen=e=>{this.previewScene||(this.previewScene=this.getPreviewScene());const{scene:t,camera:r,render:n,model:a}=this.previewScene;return t.environment=this.runScene.assetsEx.scene.environment,a.material=e,n.render(t,r),new Promise((e=>{n.domElement.toBlob((t=>{e(t)}),"image/webp",1)}))},this.onSet=(e,t)=>{},this.runScene=e,this.def=new v.ZP(e),this.snaphot=new y(e),this.clipping=new x.Z(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 g(e)}init(){var e={name:"material",loadCallBacks:this.import.getMap(),exportCallBacks:new s.Z};this.runScene.exporter.gltf.module.bind(e)}parse(e){v.Ws.LineBasicMaterial.tools.validType(e)&&v.Ws.LineBasicMaterial.tools.bind(e),this.setEnvStrength(e,this.runScene.sceneEx.envStrength)}add(e,t,r){q.is(e)||this.runScene.uniqueEx.material.add(e,t,r)}setEnvStrength(e,t,r=!1){void 0===e.envMapIntensity||e.envMapIntensity===t||!r&&e.envMapIntensity!==this.runScene.sceneEx.envStrength||(e.envMapIntensity=t,V(e))}create(e="BasicMaterial"){return e=v.ZP.create(e,this.runScene),this.add(e),e}toArray(){return(0,n.mapObj)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t=K(e);if(t){const r=v.ZP.copy(t,e,this.runScene);return r.userData.id=(0,n.getId)(),r}}clone(e){var t=K(e);if(t){const r=v.ZP.clone(t,e);return r.userData.id=(0,n.getId)(),r}}setNormals(e,t=!0){const{info:r,newVal:n,materials:a,oldval:i,cb:s}=e;let o=n;return o.isVector2&&(o=o.clone()),e=a.map((e=>new u({info:r,target:e,newVal:o,oldVal:i||e[r],runScene:this.runScene,cb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new u(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return O(this,void 0,void 0,(function*(){const{info:r,newVal:n,materials:a,oldVal:i}=e;if(e.newVal=yield this.runScene.textureEx.parse(n),(0,l.isCubeTexture)(e.newVal)&&"envMap"!==r)throw this.runScene.optionsEx.log("立方体纹理只适用于环境","base","info"),TypeError("类型错误");"envMap"!==r||(0,l.isCubeTexture)(e.newVal)||(0,l.setTextureMapping)(e.newVal);var s=a.map((t=>new u({info:r,target:t,newVal:e.newVal,oldVal:i||t[r],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(s),a[0][r]}))}setTexture(e,t=!0){return O(this,void 0,void 0,(function*(){const{type:r,newVal:a,material:i,cb:s,isEnv:o,getUndo:c}=e;null!==a&&(e.newVal=yield this.runScene.textureEx.parse(a,{isEnv:o}),"envMap"!==r||e.newVal.isCubeTexture||(0,l.setTextureMapping)(e.newVal));var u=v.ZP.getTexture({material:i,type:r});const d=v.ZP.setTexture({material:i,type:r,texture:e.newVal});if(d)return d.cb=(e,t)=>{const{target:r,typeList:a,val:i,oldVal:o}=t;t=(0,n.lastArrayEle)(a),this.runScene.cb.texture.setMaterial.cb({target:r,type:t,oldVal:o,val:i,targetType:"material"}),null!=s&&s(),r.needsUpdate=!0},null!=s&&s(),this.runScene.cb.texture.setMaterial.cb({target:i,type:r,val:e.newVal,oldVal:u,targetType:"material"}),t&&this.runScene.undoEx.addUndo(d),c?d:e.newVal}))}_resetMaterial(e){const{mate:t,models:r,model:n}=e;(e=n.material)&&$(e,t)&&r.add(n)}resetMaterial(e,t,r){const n=this,{addUndo:a,includeChild:i}=r=(0,p.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;D.F6.toArr(e).map((e=>{i?e.traverse((e=>{this._resetMaterial({model:e,mate:t,models:r})})):e.material&&this._resetMaterial({model:e,mate:t,models:r})}));const s=[];if(r.forEach((e=>{const r=e.material;s.push(new d.Z({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:r,executeCb(a){var{type:a,val:i}=a;e.material=i,"undo"===a?n.runScene.uniqueEx.material.addModel(e,r,t):n.runScene.uniqueEx.material.addModel(e,t,r)}}).execute())})),this.runScene.modelEx.select===e&&this.runScene.cb.setSelectMaterial.cb(t),a)return this.runScene.undoEx.addUndo(s),s}}toNromal(e){var t=K(e);if(t){const r=v.ZP.toNromal(t,e,this.runScene);return r.material.userData=Object.assign(Object.assign({},r.material.userData),e.userData),r}}setSelect(e){let t;t=Array.isArray(e)?e[0]:e,this.select=t,this.runScene.cb.setSelectMaterial.cb(t)}parseData(e,t){return v.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(),L()),this.runScene.cb.material.remove.cb(e))}getDefNromals(e){var t;return"BasicMaterial"!==(null==(t=e.userData)?void 0:t.type)?{}:(0,p.ad)(k,e)}parseNromals(e,t){(0,n.mapObj)(e,((e,r)=>{var n,a,i,s,o;void 0!==k[e]&&("object"==typeof r?(({x:i,y:s,z:o}=r),null!=(a=null==(n=t[e])?void 0:n.set)&&a.call(n,i,s,o)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&"BasicMaterial"===e.userData.type&&!e.userData.isTimeLineUsed&&m.ZP.isDefVal(e)}setByType(e,t){"SpriteMaterial"===e&&!t.isSprite||(e=this.create(e))&&(this.add(e),this.runScene.modelEx.setMaterial(t,e))}getPreviewScene(e){const t=new a.Scene,r=new a.PerspectiveCamera(50,1,1,10),n=(r.position.z=2,new a.WebGLRenderer),i=new T.z(r,n.domElement),s=(t.background=new a.Color("#202020"),n.setSize(150,150),i.minDistance=2,i.maxDistance=5,i.enablePan=!1,(i.enableZoom=!1,M.getSphere)()),o=(e&&(s.material=e),s.scale.set(.8,.8,.8),t.add(s),t.add(new a.HemisphereLight(11184810,4473924)),new a.DirectionalLight(16777215,.5));return o.position.set(1,1,1),t.add(o),{scene:t,camera:r,render:n,controls:i,model:s}}setTextureByName(e){const{name:t,texture:r,material:a}=e;return!(!(e=v.ZP.getTextureNames(a).find((e=>(0,n.lastArrayEle)((0,p.dx)(t).split("_"))===e.type)))||e.isCube&&!(0,l.isCubeTexture)(r)||(this.setTexture({material:a,type:e.type,newVal:r,isEnv:e.isEnv}),0))}get(e){return Array.isArray(e)?e[0]:e}afterLoader(e){"MeshPhongMaterial"===e.type?_.Z.afterload(e,this.runScene):"MeshStandardMaterial"===e.type?m.ZP.afterload(e,this.runScene):"MeshLambertMaterial"===e.type&&E.Z.afterload(e,this.runScene)}}const L=e=>{const t=new a.MeshStandardMaterial(e);return t.userData.id=(0,n.getId)(),m.ZP.tools.bind(t),t},R=(e,t)=>(A.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),I=e=>{e.dispose();const t=B(e);0!==t.length&&t.map((e=>{e=e.texture,(0,l.disposeTexture)(e)}))},B=e=>U(e),j=e=>v.ZP.getTextures(e)||U(e),U=e=>i.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),N=e=>{const{material:t,type:r,texture:n}=e;"envMap"!==r||(0,l.isCubeTexture)(n)||(0,l.setTextureMapping)(n),t[r]=n,t.needsUpdate=!0},z=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},F=e=>null==e?void 0:e.isColor,V=e=>{e.needsUpdate=!0},G=e=>null==e?void 0:e.isMaterial,H=e=>{},Z=e=>(null==e?void 0:e.isMeshStandardMaterial)&&!e.isSpecialMaterial,W={Sprite:t.Z},K=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.type)||"BasicMaterial",q={set(e,t){t?(0,o.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,o.is)(e,"ignore")},X=(e,t,r)=>{Object.keys(e).map((n=>{const a=new w.Z(P);r&&a.add(r);var i=e[n],s=t[n];!a.has(n)&&void 0!==s&&(0,S.ZE)(i,s)&&(0,S.Y6)({type:n,target:t,val:i})}))},Y=e=>Array.isArray(e),Q=e=>Array.isArray(e)?e:[e],J=(e,t)=>{e.userData.mateIds=t,e.userData.multiMaterial={groups:[...e.geometry.groups],mateIds:t}},$=(e,t)=>(e=v.ZP.getTypeByMaterial(D.F6.toArr(e)[0]),t=v.ZP.getTypeByMaterial(D.F6.toArr(t)[0]),!(!e||!t)&&("SpriteMaterial"==e?"SpriteMaterial"===t:"SpriteMaterial"!=t&&("LineBasicMaterial"==e?"LineBasicMaterial"===t:"LineBasicMaterial"!=t))),ee=(e,t)=>{const r=new s.Z;return e.traverse((e=>{null!=t&&t(e),e.material&&!r.has(e.name)&&r.set(e.name,{material:e.material,model:e})})),r},te=["SpriteMaterial","Reflector","SkyBox","LineBasicMaterial"],re=e=>!!(e=v.ZP.getTypeByMaterial(e))&&!te.includes(e)},144:(e,t,r)=>{r.d(t,{Gf:()=>m,ZP:()=>f});var n,a=r(6001),i=r(8881),s=r(4330),o=r(3263),l=r(3736),c=r(1398),u=r(3735),d=r(2233),h=r(135),p=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const m={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"},transparent:{type:"other",val:!1,shortKey:"trans"},opacity:{type:"number",val:1,shortKey:"opc",before:({target:e,end:t})=>{t<1&&!e.transparent&&(e.transparent=!0,(0,h.updateMaterial)(e))}},depthTest:{type:"other",val:!0,shortKey:"dt"},depthWrite:{type:"other",val:!0,shortKey:"dw"},fog:{type:"other",val:!0,shortKey:"fo"},wireframe:{type:"other",val:!1,shortKey:"wf"},alphaMap:{type:"texture",val:null,shortKey:"alpm"}};class f{constructor(e){this.init(e)}static afterload(e,t){return p(this,void 0,void 0,(function*(){this.tools.bind(e),this.tools.textureNames.map((({type:r})=>p(this,void 0,void 0,(function*(){const n=e[r];if(n){let i=(0,d.Ki)(n);if(i||(i=(0,a.getId)(),(0,d.x)(n,i)),n.image)yield t.textureEx.afterLoad(n),t.uniqueEx.texture.linkMaterial(n,{target:e,type:r,targetType:"material"});else{let a=t.textureEx.awaitLoader.get(i);a||(a=[],t.textureEx.awaitLoader.set(i,a)),a.push((()=>{t.uniqueEx.texture.linkMaterial(n,{target:e,type:r,targetType:"material"})}))}}}))))}))}init(e){e.cb.material.add.add("base-material",(e=>{(0,h.isBaseMaterial)(e)&&"MeshPhysicalMaterial"!==e.type&&f.tools.bind(e)}))}static isDefVal(e){for(const t in this.defVal){const r=this.defVal[t],n=e[t];if(r instanceof i.Color){if(r.getHexString()!==n.getHexString())return!1}else if("object"==typeof r){if(n.x!==r.x)return!1}else if(n!==r)return!1}for(const t of s.zX)if(e[t])return!1;return!0}create(){return(0,h.createDefMaterial)()}}(n=f).tools={textureNames:[{type:"map"},{type:"metalnessMap"},{type:"roughnessMap"},{type:"normalMap"},{type:"aoMap"},{type:"emissiveMap"},{type:"alphaMap"},{type:"lightMap"},{type:"envMap",isEnv:!0},{type:"displacementMap"}],type:"BasicMaterial",bind(e){(0,l.M)(e,"type","BasicMaterial")},create:()=>{var e=new i.MeshStandardMaterial;return n.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:i,load:s}=t,l=[];return s&&l.push(...o.F6.filter(i.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.materialEx.setTexture({material:a,type:t,newVal:r},!1)}})))),n.runScene.materialEx.parseNromals(r,a),{material:a,setTextureFns:l}},toNormal:e=>{const t=e.clone();return t.side=e.side,{material:t,normal:{type:f.tools.type},textures:(0,h.getBaseTextures)(e)}},clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,h.getBaseTextures)(e),snapshot:{getDiff:e=>c.LV.getDiff(m,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;c.LV.set({def:m,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,h.updateMaterial)(r)}))}},validType:e=>"MeshStandardMaterial"===e.type,setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new u.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]}},f.defVal={color:new i.Color(16777215),emissive:new i.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new i.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1,fog:!0}},4156:(e,t,r)=>{r.d(t,{Z:()=>m});var n,a=r(6001),i=r(8881),s=r(3263),o=r(3736),l=r(1398),c=r(3735),u=r(2233),d=r(135),h=r(144),p=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class m extends h.ZP{static afterload(e,t){return p(this,void 0,void 0,(function*(){this.tools.bind(e),this.tools.textureNames.map((({type:r})=>{const n=e[r];if(n){let i=(0,u.Ki)(n);if(i||(i=(0,a.getId)(),(0,u.x)(n,i)),n.image)t.uniqueEx.texture.linkMaterial(n,{target:e,type:r,targetType:"material"});else{let a=t.textureEx.awaitLoader.get(i);a||(a=[],t.textureEx.awaitLoader.set(i,a)),a.push((()=>p(this,void 0,void 0,(function*(){(yield t.textureEx.toStandard(n)).valid?(e[r]=n,t.uniqueEx.texture.linkMaterial(n,{target:e,type:r,targetType:"material"})):delete e[r]}))))}}}))}))}}(n=m).tools={textureNames:[{type:"map"},{type:"metalnessMap"},{type:"roughnessMap"},{type:"normalMap"},{type:"aoMap"},{type:"emissiveMap"},{type:"alphaMap"},{type:"envMap",isEnv:!0},{type:"lightMap"},{type:"displacementMap"}],type:"MeshLambertMaterial",bind:e=>{(0,o.M)(e,"type",m.tools.type)},onAdd:e=>{const{material:t,runScene:r}=e;n.tools.textureNames.map((({type:e})=>p(void 0,void 0,void 0,(function*(){var n=t[e];n&&((yield r.textureEx.toStandard(n)).valid?r.uniqueEx.texture.linkMaterial(n,{target:t,type:e,targetType:"material"}):delete t[e])}))))},create:()=>{var e=new i.MeshLambertMaterial;return n.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:a,material:i}=e,{data:o,load:l}=t;var c=r.normalX;const h=n.tools.create(e.core.runScene),p=((0,d.mergeMaterial)(i,h),h.name=i.name,h.side=i.side,(0,u.x)(h,(0,u.Ki)(i)),n.tools.bind(h),[]);return l&&p.push(...s.F6.filter(o.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{a.runScene.materialEx.setTexture({material:h,type:t,newVal:r},!1)}})))),void 0!==c&&h.normalScale.set(c,-1*c),a.runScene.materialEx.parseNromals(r,h),{material:h,setTextureFns:p}},toNormal:e=>({material:e.clone(),normal:{type:m.tools.type,normalX:e.normalScale.x},textures:(0,d.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,d.getBaseTextures)(e),snapshot:{getDiff:e=>l.LV.getDiff(h.Gf,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;l.LV.set({def:h.Gf,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,d.updateMaterial)(r)}))}},validType:e=>"MeshLambertMaterial"===e.type||"MeshLambertMaterial"===e.type,setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new c.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]}}},9457:(e,t,r)=>{r.d(t,{Z:()=>m});var n,a=r(6001),i=r(8881),s=r(3263),o=r(3736),l=r(1398),c=r(3735),u=r(2233),d=r(135),h=r(144),p=(t=r(4156),function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))});class m extends h.ZP{static afterload(e,t){return p(this,void 0,void 0,(function*(){this.tools.bind(e),this.tools.textureNames.map((({type:r})=>{const n=e[r];if(n){let i=(0,u.Ki)(n);if(i||(i=(0,a.getId)(),(0,u.x)(n,i)),n.image)t.uniqueEx.texture.linkMaterial(n,{target:e,type:r,targetType:"material"});else{let a=t.textureEx.awaitLoader.get(i);a||(a=[],t.textureEx.awaitLoader.set(i,a)),a.push((()=>p(this,void 0,void 0,(function*(){(yield t.textureEx.toStandard(n)).valid?t.uniqueEx.texture.linkMaterial(n,{target:e,type:r,targetType:"material"}):delete e[r]}))))}}}))}))}}(n=m).tools={textureNames:[{type:"map"},{type:"metalnessMap"},{type:"roughnessMap"},{type:"normalMap"},{type:"aoMap"},{type:"emissiveMap"},{type:"alphaMap"},{type:"lightMap"},{type:"displacementMap"}],type:"MyMeshPhongMaterial",bind:e=>{(0,o.M)(e,"type",m.tools.type)},onAdd:t.Z.tools.onAdd,create:()=>{var e=new i.MeshPhongMaterial;return n.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:a,material:i}=e,{data:o,load:l}=t,c=n.tools.create(e.core.runScene),h=((0,d.mergeMaterial)(i,c),c.name=i.name,c.side=i.side,(0,u.x)(c,(0,u.Ki)(i)),n.tools.bind(c),[]);return l&&h.push(...s.F6.filter(o.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{a.runScene.materialEx.setTexture({material:c,type:t,newVal:r},!1)}})))),a.runScene.materialEx.parseNromals(r,c),{material:c,setTextureFns:h}},toNormal:e=>({material:e.clone(),normal:{type:m.tools.type},textures:(0,d.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,d.getBaseTextures)(e),snapshot:{getDiff:e=>l.LV.getDiff(h.Gf,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;l.LV.set({def:h.Gf,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,d.updateMaterial)(r)}))}},validType:e=>"MyMeshPhongMaterial"===e.type||"MeshPhongMaterial"===e.type,setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new c.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]}}},110:(e,t,r)=>{r.d(t,{Z:()=>h});var n,a=r(8881),i=r(8609),s=r(3736),o=r(1398),l=r(2233),c=r(135),u=(t=r(144),r(3735));const d={color:t.Gf.color,map:t.Gf.map,opacity:t.Gf.opacity};class h{constructor(e){this.modelParse={toNormal:e=>{e=e.model;const t=(0,i.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,this.merge(e,t),t},parse:e=>{var{model:e,normal:t}=e;const r=(0,i.createDefModel)("Sprite");var n=e.userData.layers;return(0,i.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),this.merge(e,r),r.material=e.material,r}},this.merge=(e,t)=>{t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.renderOrder=e.renderOrder,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,t.name=e.name,t.name=e.name,(0,s.M)(e,"name",e.name),(0,i.setLayers)(t,1===e.layers.mask?0:1)},this.type="Sprite",this.runScene=e;const{parse:t,toNormal:r}=this.modelParse;e.cb.inited.add("MySpriteMaterial",(()=>{e.modelEx.importAndExport.addParses(this.type,{parse:t,toNormal:r}),e.modelEx.importAndExport.addParses("MySpriteMaterial",{parse:t,toNormal:r})}))}}(n=h).tools={type:"SpriteMaterial",bind(e){(0,s.M)(e,"type","SpriteMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{const e=new a.SpriteMaterial;return e.alphaToCoverage=!0,e.toneMapped=!1,n.tools.bind(e),e},setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new u.Z({target:t,typeList:[r],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,s=[],o=(0,c.mergeMaterial)(r,h.tools.create(t));(0,l.x)(o,(0,l.Ki)(r));var{depthWrite:e,depthTest:r,name:n,fog:u}=n;return!1===u&&(o.fog=!1),void 0!==e&&(o.depthWrite=e),void 0!==r&&(o.depthTest=r),n&&(o.name=n),i&&s.push(...a.map((e=>{const{type:r,texture:n}=e;return()=>{t.materialEx.setTexture({material:o,type:r,newVal:n},!1)}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,c.mergeMaterial)(e,(0,c.createDefMaterial)());var r=Object.assign({},t.userData);const n={type:h.tools.type,name:e.name};return e.fog||(n.fog=!1),e.depthWrite!==c.defBaseMaterialMap.depthWrite&&(n.depthWrite=e.depthWrite),e.depthTest!==c.defBaseMaterialMap.depthTest&&(n.depthTest=e.depthTest),t.userData=r,{normal:n,textures:h.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=h.tools.type,t},snapshot:{getDiff:e=>o.LV.getDiff(d,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;o.LV.set({def:d,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,c.updateMaterial)(r)}))}},textureNames:[{type:"map"},{type:"alphaMap"}]}},3801:(e,t,r)=>{r.d(t,{Ju:()=>i,t9:()=>a,zf:()=>s});var n=r(3736);const a={isDynamic:e=>e.userData.isDynamic},i={isDeleted(e,t=!1){var r;return!!e&&(!(null==(r=null==e?void 0:e.userData)||!r.isDeleted)||!!t&&i.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,n.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},s={setLock(e){(0,n.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var r=e.userData.lock;return t?!!r||s.isLock(e.parent,t):void 0!==r&&r}}},8609:(e,t,r)=>{r.r(t),r.d(t,{bindModelCloneId:()=>fe,closeModelEvent:()=>he,createDefModel:()=>F,createSpecialModel:()=>z,default:()=>N,delClonedModel:()=>te,deletedModel:()=>U.Ju,disposeModel:()=>V,dynamicModel:()=>U.t9,getAnimaModelMap:()=>ve,getClonedIdModel:()=>$,getDeepModels:()=>X,getIdMapByModel:()=>ue,getModelMap:()=>be,getModelSize:()=>ie,getModelType:()=>me,getSphere:()=>pe,hasSkeleton:()=>Y,helperModel:()=>le,instanceModel:()=>G,isDynamicModel:()=>J,isGLowModel:()=>re,isGroup:()=>ae,isHelper:()=>K,isNormalModel:()=>ge,isSprite:()=>ne,lockModel:()=>U.zf,mergeModel:()=>H,normalModel:()=>oe,selectableModel:()=>se,setAnimaModelUniqueName:()=>ye,setClonedModel:()=>ee,setDynamicModel:()=>Q,setHelper:()=>W,setLayers:()=>q,tempModel:()=>de,uselessGroup:()=>ce,withAnima:()=>Z});var n=r(6001),a=r(8881),i=r(4091),s=r(4230);const o=["Group","Box","Plane","Sphere","Sprite","Reflector","VerticesRain","Water","3DDom","3DSprite","2DDom","GroundProjected"];var l=r(3263),c=r(1794),u=r(272),d=r(6292),h=r(1269),p=r(8818),m=r(135),f=r(228),g=r(3736);class v extends r(4773).Z{constructor(e){super(e),this.type="添加模型",this.isUndoAdd=!0}_execute(e){return Promise.reject()}undo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}redo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene,isScene:this.isScene})}execute(){return this.redo(),this}}var b=r(3735),y=r(2510);class x extends r(4616).Z{constructor(e){super(),this.type="修改父元素",this.isUndoParent=!0,this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e,t){e.attach(this.target),this.runScene.cb.model.setParent.cb({model:this.target,parent:e}),(null==(e=this.runScene.modelEx.select)?void 0:e.userData.id)===t.userData.id&&this.runScene.modelEx.selectNull()}undo(){this._execute(this.oldParent,this.newParent)}redo(){this._execute(this.newParent,this.oldParent)}}const w=x;var S=r(7169),M=r(4380),T=r(2233),_=r(5317);class E{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var D=r(2353),O=r(110),k=r(7095);class P{constructor(e){this.data=this.getData(),this.parses=new c.Z,this.nodeType={MySpriteMaterial:O.Z,VerticesRain:k.Z},this.mount=e=>{e.core.module.set("model",this)},this.complete=()=>{this.data=this.getData()},this.awaitMateIds=new u.Z,this.loadNodeDef=e=>{let{node:t,nodeDef:r}=e;(0,n.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{var a=r[e];null!=a&&(t[e]=a)})),r.wireframe&&(t.material.wireframe=!0)},this.load=e=>{var{data:e,core:t}=e;return this.loadNodeDef(e),this.loadExtras(e,t),e.node},this.done=()=>{this.removeHelperModel()},this.parseMateIds=e=>{const t=e.module.get("material");t&&this.awaitMateIds.map((({model:e,multiMaterial:r})=>{e.material=l.F6.filter(r.mateIds.map((e=>null==(e=t.getById(e))?void 0:e.material))),e.geometry.groups=r.groups}))},this.afterParse=e=>{const{config:t,data:r,json:n,core:a}=e;if(this.parseMateIds(a),this.awaitMateIds.clear(),"model"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){if(null==(e=t.module)||!e.model)return[];let n=["glb_model"===(e=(e=r.options).models[0]).name&&(null==e?void 0:e.children[0])||e];var[e]=n;ce.is(e)&&(n=[...e.children]),a.models.push(...n),this.mergeClone()}},this.toNromal=e=>{var t=e.type;const r=this.parses.get(t);return r?r.toNormal(e):e.model},this.parse=e=>{var t=e.type;const r=this.parses.get(t);if(r)return r.parse(e)},this.runScene=e}getData(){return{map:new c.Z,clonedMap:{},instancedMap:{},helperModels:[]}}getMap(){return new c.Z({loadNode:this.load,loadedGltf:this.done,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}addParses(e,t){this.parses.set(e,t)}loadExtras(e,t){let{node:r,nodeDef:n}=e;if(n.extras){const{layers:o,normal:l,local:c,cloneId:u,id:d,animations:h,isDynamic:p,multiMaterial:m}=n.extras;var a,i=J(r,!0);if("running"===this.runScene.optionsEx.options.mode&&(null==(s=this.runScene.optionsEx.options.renderConfig)||!s.matrixAutoUpdate)){if(i)return;r.matrixAutoUpdate=!1}h&&(r.animations=D.B.parse(h)),p&&(r.userData.isDynamic=!0),!u||i||(this.data.instancedMap[u]||(this.data.instancedMap[u]=new Set),this.data.instancedMap[u].add(r)),c&&([s,i,a]=c.split(","),r.position.set(s,i,a)),o&&(r.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:r,val:1})),n.extras.isHelper&&this.data.helperModels.push(r),l&&([i,...a]=(s=this.parse({type:l.type,model:e.node,normal:l,runScene:this.runScene}))instanceof Array?s:[s],e.node=i,t.models.push(...a)),d&&this.data.map.set(d,e.node);var s=null==(a=null==(i=null==(s=e.node)?void 0:s.material)?void 0:i.userData)?void 0:a.id;if(s){const r=t.module.get("material").data.materialIns[s];r&&r.models.push(e.node)}m&&this.awaitMateIds.add({model:e.node,multiMaterial:m})}}removeHelperModel(){this.data.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}mergeClone(){var e;this.runScene.optionsEx.options.instanceClone&&"running"===this.runScene.optionsEx.options.mode&&(this.runScene.assetsEx.scene.updateMatrixWorld(),e=this.data.instancedMap,(0,n.mapObj)(e,((e,t)=>{var r,n=this.runScene.modelEx.getById(e);t.size<2||!n||!n.geometry||J(n,!0)||(r=G(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),re(n)&&this.runScene.modelEx.setGlow(r,!0),this.runScene.modelEx.remove(n,!1),t.forEach((e=>this.runScene.modelEx.remove(e,!1))),t.clear(),delete this.data.instancedMap[e])}))),this.data.instancedMap={}}mergeGeometry(){}}var A=r(8089);class C{constructor(e){this.copyData={name:"",data:void 0,modelId:""},this.useMap={name:"",model:void 0},this.onModelMove=e=>{var t;if(this.useMap.model&&0!==this.useMap.name.length&&this.get(e)&&(t=this.getLocalDataByName(e,this.useMap.name))){var{x:t,y:r,z:n,tx:i,ty:s,tz:o}=t.data;let u=e=(0,A.VU)(e,this.runScene.assetsEx.scene);var{x:e,y:l,z:c}=e;e={x:e+t,y:l+r,z:c+n},void 0!==i&&void 0!==s&&void 0!==o&&(u=new a.Vector3(e.x+i,e.y+s,e.z+o)),this.runScene.assetsEx.camera.position.set(e.x,e.y,e.z),this.runScene.assetsEx.camera.lookAt(u),this.runScene.assetsEx.controls.target.copy(u)}},(this.runScene=e).cb.model.setVector3.add("ModelExCamFlow",(({type:e,model:t})=>{"position"===e&&this.onModelMove(t)})),e.cb.inited.add("model-camFlow",(()=>{e.events.model.addOptions({name:"camFlow",map:{parse:e=>{var{model:e,childs:t}=e,[t]=t;return t?this.focus(e,t):Promise.resolve()}}})}))}teigger(){this.runScene.events.model.enable}link(e,t){var r=this.get(e);if(r&&(r=r[t])){let n=(0,T.Ki)(e);"id"===r.type&&(n=r.data),this.copyData={name:t,modelId:n,data:void 0}}}getDataById(e,t){return null==(e=null==(e=this.runScene.modelEx.getById(e))?void 0:e.userData[C.savedStr])?void 0:e[t]}copy(e,t){(e=this.getLocalDataByName(e,t))&&(this.copyData={name:t,data:e.data,modelId:""})}paste(e){const{name:t,modelId:r,data:n}=this.copyData;e.map((e=>{n?this.set({model:e,local:n,name:t,state:!0}):0<r.length&&this.set({model:e,modelId:r,name:t,state:!0})}))}set(e){var{model:e,local:t,name:r,state:n,modelId:a}=e;let i=this.get(e);if(i){if(!n)return void delete i[r]}else{if(!n)return;i={},(0,g.M)(e,C.savedStr,i)}n&&(a?a!==(0,T.Ki)(e)&&(i[r]={type:"id",data:a}):i[r]={type:"data",data:t||this.getBetween(e)})}use(e,t){this.useMap.model=e,this.useMap.name=t}clearUse(){this.useMap.model=void 0}get(e){return(0,g.is)(e,C.savedStr)}getBetween(e){var{x:e,y:t,z:r}=(0,A.VU)(e,this.runScene.assetsEx.scene),{x:n,y:a,z:i}=this.runScene.assetsEx.controls.target;return{x:this.runScene.assetsEx.camera.position.x-e,y:this.runScene.assetsEx.camera.position.y-t,z:this.runScene.assetsEx.camera.position.z-r,tx:n-this.runScene.assetsEx.camera.position.x,ty:a-this.runScene.assetsEx.camera.position.y,tz:i-this.runScene.assetsEx.camera.position.z}}used(e,t){return(0,T.Ki)(e)===(0,T.Ki)(this.useMap.model)&&t===this.useMap.name}getLocalDataByName(e,t){var r=this.get(e);if(r&&(r=r[t]))return"id"!==r.type?r:r.data!==(0,T.Ki)(e)?this.getDataById(r.data,t):void 0}getLocalByName(e,t){if(e=this.get(e))return e[t]}focus(e,t,r=.5){if(!(t=this.getLocalDataByName(e,t)))return Promise.resolve();var{x:n,y:i,z:s}=t.data,{x:o,y:l,z:c}=(0,A.VU)(e,this.runScene.assetsEx.scene);let u;return u=void 0!==t.data.tx&&void 0!==t.data.ty&&void 0!==t.data.tz?new a.Vector3(t.data.tx,t.data.ty,t.data.tz):(0,A.VU)(e,this.runScene.assetsEx.scene),t={x:o+n,y:l+i,z:c+s},this.runScene.cameraEx.anima({x:t.x,y:t.y,z:t.z,tx:t.x+u.x,ty:t.y+u.y,tz:t.z+u.z},{time:r}),new Promise((e=>{setTimeout(e,r)}))}}C.savedStr="camFLow";var L=r(4342),R=r(7201),I=r(1398);const B={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 j{constructor(e){this.resetItem=e=>{"model"===e.type&&e.datas.map((t=>{const r=t.data;let n=r.get("model");n||(n={},r.set("model",n));const a=new u.Z;if(e.targets.map((e=>{e.traverse((e=>{var t=(0,T.Ki)(e);t&&(e.material&&a.add(e.material),n[t]=this.getItem(e))}))})),0!==a.size){const t=new u.Z;a.map((e=>{const r=p.ZP.getTextures(e);0!==r.length&&t.add(r.map((e=>e.texture)))})),this.runScene.cb.snapshot.resetItem.cb({type:"texture",datas:e.datas,targets:t.toArray()}),this.runScene.cb.snapshot.resetItem.cb({type:"material",datas:e.datas,targets:a.toArray()})}}))},this.create=e=>{var t=this.getDiff(this.runScene.sceneEx.getClearModels());0!==(0,R.objLength)(t)&&e.data.set("model",t)},this.set=e=>{var t=e.snapshot.data.get("model");if(t){const r=e.data.completedCbs;this.runScene.pp.clearAllOutlineObj(),(0,n.mapObj)(t,((t,n)=>{const a=this.runScene.uniqueEx.model.get(t);a&&(I.LV.set({def:B,runScene:this.runScene,data:n,target:a,map:e}),t=n[B.visible.shortKey],a.visible=void 0===t,r.push((()=>{var e;this.runScene.modelEx.setGlow(a,!!n.isGLow),n.isOutline?this.runScene.modelEx.setOutline(a,!0):a.userData.outline&&(a.userData.outline=!1),this.runScene.cb.model.change.cb({model:a,type:"visible",val:a.visible}),n.materialId&&n.materialId!==(0,T.Ki)(a.material)&&(e=this.runScene.uniqueEx.material.get(n.materialId))&&this.runScene.materialEx.resetMaterial(a,e,{addUndo:!1,includeChild:!1})})))}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("model",this.create),e.cb.snapshot.delUseless.add("model",(t=>{(0,n.mapObj)(t,((t,r)=>{const a=r.data.model;a&&((0,n.mapObj)(a,(t=>{e.uniqueEx.model.has(t)||delete a[t]})),0===(0,R.objLength)(a)&&delete r.data.model)}))})),this.runScene.cb.snapshot.set.add("model",this.set),this.runScene.cb.snapshot.getLength.add("model",(e=>{var t=e.data.data.get("model");t&&(e.inputData.model=Object.keys(t).length)})),this.runScene.cb.snapshot.resetItem.add("model",(({targets:e,type:t,datas:r})=>{"model"===t&&this.resetItem({type:t,datas:r,targets:e})})),this.runScene.cb.snapshot.getByType.add("model",(({targets:e,type:t,data:r})=>{"model"===t&&this.resetItem({type:t,datas:[r],targets:e})})),this.runScene.cb.snapshot.delete.add("model",(({data:e})=>{(e=e.data.get("model"))&&(0,n.mapObj)(e,((e,t)=>{this.bindMaterialId(t.materialId,!1)}))})),this.runScene.cb.snapshot.parseJSON.add("model",(e=>{e.map(((e,t)=>{(t=t.data.get("model"))&&(0,n.mapObj)(t,((e,t)=>{this.bindMaterialId(t.materialId,!0)}))}))}))}bindMaterialId(e,t){e&&0!==e.length&&this.runScene.cb.assets.manager.set.cb({type:"material",id:e,isAdd:t})}getItem(e){const t=I.LV.getDiff(B,e);return re(e)&&(t.isGLow=!0),(0,f.S)(e)&&(t.isOutline=!0),e.material&&!(0,m.isMultiMaterial)(e.material)&&(t.materialId=(0,T.Ki)(e.material),this.bindMaterialId(t.materialId,!0)),t}getDiff(e){const t={};return e.map((e=>{e.traverse((e=>{var r=(0,T.Ki)(e);r&&(t[r]=this.getItem(e))}))})),t}getData(){}}var U=r(3801);class N{constructor(e){this._selectModel=void 0,this.geometryMap=new c.Z,this.clonedMap=new c.Z,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.onAdd=e=>{e=e.model;var{material:t,geometry:r}=e;if(t&&r&&(0,m.isMultiMaterial)(t)&&r.groups&&0!==r.groups.length){let i=!1;if(!i)for(const e of r.groups){var a=e.materialIndex;if(!t[a]){i=!0;break}}i&&(this.runScene.optionsEx.log(e.name+"模型出现错误,顶点需要的材质少于当前有的材质","base","error"),this.runScene.msg.add({tipType:"danger",type:"model",id:(0,n.getId)(),data:[{subType:"lessMaterial",id:(0,T.Ki)(e),ids:[(0,T.Ki)(e)]}]}))}},this.clean=()=>{this.reset()},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,r,n)=>{var{addUndo:a,isClone:i,select:s,addToTree:o,isScene:l}=(0,_.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0,isScene:!1},n);return t instanceof Array?t.map((e=>this.add(e,r,Object.assign(Object.assign({},n),{isScene:!1})))):(e(t,i),this.setGeometryMap(t),this.setCloneMap(t),o=new v({model:t,parent:r||this.runScene.sceneEx.get(),isClone:i,addTree:o,runScene:this.runScene,isScene:void 0!==l&&l}).execute(),!0===a&&this.runScene.undoEx.addUndo(o),s&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:i}),o)}})(),this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.parseUnStandard=e=>{const t=[];e.map((e=>{const r=this.getModel(e);r&&t.push((()=>function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var e=this.runScene.exporter.obj.model(r);(e=yield this.runScene.fileEx.obj(e))&&([e]=e.result,e&&(r.geometry=e.geometry))}))))})),(0,n.eachTriggerArray)(t)},this.setClonedModels=(e,t)=>{const r=e.geometry;if(r){const n=[],i=this.getTruthPosition(e);t.map((t=>{if(t.geometry&&(0,T.Ki)(t)!==(0,T.Ki)(e)&&e.geometry.uuid!==t.geometry.uuid){var s=this.getTruthPosition(t);n.push(new y.Z({target:t,info:"geometry",newVal:r,runScene:this.runScene,oldVal:t.geometry,cb(r,n){"redo"===n?fe(e,t):delete t.userData.cloneId}}).execute());const o=new a.Vector3;o.subVectors(s,i),n.push(new M.Z({target:t,info:"position",newV3:o,runScene:this.runScene,oldV3:t.position.clone()}).execute())}})),this.runScene.undoEx.addUndo(n)}},this.runScene=e,this.clone=(e=>(t,r=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var n,a,i,s=Y(t),o=ve(t),l=(s=s?function(e){var t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(var a=0;a<t.children.length;a++)e(t.children[a],r.children[a],n)}(e,n,(function(e,n){t.set(n,e),r.set(e,n)})),n.traverse((function(e){var n,a;e.isSkinnedMesh&&(a=(n=t.get(e)).skeleton.bones,e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=a.map((function(e){return r.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),n}(t):t.clone(),fe(t,s),(0,g.is)(t,"isDynamic")&&Q(s,!0),(0,_.getModelMap)(s,"id"));return n=s,(i=null==t?void 0:t.material)&&((0,m.isMultiMaterial)(i)?n.material=[...i]:(a=p.ZP.clone((0,p.ee)(i),i))&&a.uuid!==i.uuid&&(e.materialEx.resetMaterial(n,a,{addUndo:!0}),e.materialEx.add(a,t,i))),ye(e,{newModel:s,newModelMap:l,animaMap:o}),r&&e.uniqueEx.model.add(s,{hasReset:!0}),s})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new E(e),this.importAndExport=new P(e),this.snapsot=new j(e),this.def=new L.Z(e),this.camFlow=new C(e),this.runScene.cb.loaderer.gltf.getArrayBuffer.add("EngineModel",(()=>{this.selectNull()})),e.cb.unique.model.add.add("model-ex",this.onAdd)}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}set(e,t,r){this[t]=r,this.runScene.cb.model.change.cb({model:e,type:t,val:r})}init(){var e={name:"node",loadCallBacks:this.importAndExport.getMap(),exportCallBacks:new c.Z};this.runScene.exporter.gltf.module.bind(e),this.runScene.cb.unique.model.add.add("model",(({model:e})=>{(0,f.S)(e)&&this.setOutline(e,!0)}))}getSelectedModels(){return[this.select,...this.runScene.multipSelector.getSelectedList("value")].filter((e=>e))}setGeometryMap(e){if((0,_.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,T.Ki)(e))),this.setGeometryMap(e.children)}isSameGeo(e,t){var{normal:e,position:r,uv:n}=e.attributes,{normal:t,position:a,uv:i}=t.attributes;return e.array.length===t.array.length&&r.array.length===a.array.length&&n.array.length===i.array.length&&(e=(0,_.sameArr)([...e.array],[...t.array],20),t=(0,_.sameArr)([...r.array],[...a.array],20),r=(0,_.sameArr)([...n.array],[...i.array],20),e&&t&&r)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){const[r,n]=e;if(0!==n.size){var t=n.values()[0];if(!t)return;const e=this.runScene.uniqueEx.model.get(t);if(!e||!e.geometry)return;if(this.isSameGeo(e.geometry,e.geometry))return r}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,_.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=$(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new u.Z),this.clonedMap.get(t).add((0,T.Ki)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,T.Ki)(e))}replaceClonedGroup(e,t){t=$(t)||(0,T.Ki)(t);const r=this.clonedMap.get(t);r&&0!==r.size&&(e.userData.id=t,r.map((t=>{if(t=this.runScene.modelEx.getById(t)){var{position:r,rotation:n,scale:a,name:i,parent:s}=t;this.remove(t,!1);const o=this.runScene.modelEx.clone(e);o.userData.id=(0,T.Ki)(t),o.position.copy(r),o.rotation.copy(n),o.scale.copy(a),o.name=i,this.add(o,s,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const r=this.geometryMap.get(t);r&&0!==r.size&&(r.forEach((t=>{const r=this.runScene.uniqueEx.model.get(t);r&&(r.geometry=e,r.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,r))}setSelectByModel(e,t){if(e){this.runScene.optionsEx.log({model:e,userData:e.userData,material:e.material,textures:e.material?p.ZP.getTextures(e.material):{}},"detail");var{isDomTreeActive:t,isClone:r}=t||{};if(this.runScene.events.key.ctrl&&!r)return r=this.select,this.runScene.modelEx.selectNull(),r&&this.runScene.multipSelector.add(r),void this.runScene.multipSelector.add(e);if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),(this._selectModel=e).isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)))}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){let r=[];Array.isArray(e)?r.push(...e):r.push(e),e=r.map((e=>new S.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute())),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t){var{x:e,y:r,z:n}=e;return e===(t=t?1:0)&&r===t&&n===t}isNavieV2(e,t=0){var{x:e,y:r}=e;return e===t&&r===t}isUnless(e){return!e.userData.normal&&!e.material&&this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&0===e.children.length&&!Z(e)}isUnlessLevel(e){return!e.geometry&&this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&1===e.children.length&&!Z(e)}create(e="Box"){return e=(0,_.getModelByType)(e),p.ZP.parseNode(e),e}getById(e){return Array.isArray(e)?e.map((e=>this.runScene.uniqueEx.model.get(e))).filter((e=>e)):this.runScene.uniqueEx.model.get(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e=this._selectModel;e&&(this.runScene.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new w({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!r)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:r,newV3:n}=e;if(Array.isArray(t))return t.map((e=>{e[r].set(n.x,n.y,n.z),e.updateMatrix()}));t[r].set(n.x,n.y,n.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3(e,t=!0,r=!0){let{model:n,info:i,newV3:s,oldV3:o}=e;var l,c;if(s.isVector3||s.isEuler||(({x:u,y:l,z:c}=s),s=new a.Vector3(u,l,c)),(0,_.isRunning)(this.runScene))return this._setV3(e);var u=n instanceof Array?n.map((e=>new M.Z({target:e,info:i,runScene:this.runScene,oldV3:o||e[i].clone(),newV3:s}).execute(r))):new M.Z({target:n,info:i,oldV3:o||n[i].clone(),newV3:s,runScene:this.runScene}).execute(r);t&&this.runScene.undoEx.addUndo(u)}setNormal(e,t=!0){const{model:r,oldVal:n,info:a,val:i,executeCb:s}=e,o=new u.Z;return l.F6.toArr(r).map((e=>{"castShadow"!==a&&"receiveShadow"!==a||"group"===me(e)&&e.traverse((e=>{"group"!==me(e)&&o.add(e)})),o.add(e)})),e=o.map((e=>new y.Z({target:e,info:a,runScene:this.runScene,oldVal:n||e[a],newVal:i,executeCb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,r=!0){var n=new y.Z({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(this.def.create(e),void 0,{select:!0})}isModel(e){return!((0,h.RQ)(e)||(0,s.N)(s.N))}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),a=r===n?t:r;return e.parent.children.map(((e,t)=>t>a&&t<n&&e)).filter((e=>e))}}}setMultip(e){const{model:t,typeList:r,newVal:n,cb:a}=e;this.runScene.undoEx.addUndo(new b.Z({target:t,typeList:r,newVal:n,cb(e,t){null!=a&&a(t)}}).execute())}createGroup(e,t,r){const n=t||new a.Group,i=[];i.push(new v({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new w({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new w({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:n}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(n)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,n.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new w({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new S.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length,n=this.runScene.sceneEx.getClearModels(),a=[];n.map((n=>{n.traverse((n=>{r?!1===(0,_.deepFindParentByUuid)(n,t)&&n.uuid!==e.uuid&&a.push(n):n.uuid!==e.uuid&&a.push(n)}))}));var i=a.map((e=>new y.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(i),(0,_.setParentVisible)(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var r=t.map((e=>new y.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(r)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new S.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new a.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let n=new a.Raycaster,i=new a.Vector2,s=(i.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,i.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,n.setFromCamera(i,this.runScene.assetsEx.camera),n.intersectObjects(t,!0)),o={intersects:null,obj:null};if(0===s.length)return o;if(r){if(0===(e=s.filter((e=>(0,_.isVisible)(e.object)))).length)return o;o={intersects:e,obj:e[0].object}}else o={intersects:s,obj:s[0].object};return o}getCamLocal(){var{x:e,y:t,z:r}=this.runScene.assetsEx.camera.position,{x:n,y:a,z:i}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}}camAnima(e,t,r=1,n,a){return(0,_.anima)(e,t,r,(e=>{a&&a(e),this.runScene.assetsEx.camera.position.set(e.cx,e.cy,e.cz),this.runScene.assetsEx.controls.target.set(e.tx,e.ty,e.tz),this.runScene.assetsEx.camera.lookAt(this.runScene.assetsEx.controls.target)}),(e=>{n&&n()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:e,val:t})}setOutline(e,t=!0){e.userData.outline=t,this.runScene.pp.addOutlineObj(e,t),this.runScene.cb.model.setOutline.cb({model:e,val:t})}focus(e){const{scene:t,camera:r,renderer:n,controls:i}=this.runScene.assetsEx.get(),s=new a.Vector3,o=new a.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var l=n.domElement.getBoundingClientRect();let t=l.width/l.height;const i=new a.Vector3;l=e.geometry.attributes.position.array,i.set(Math.abs(l[0]-l[3]),Math.abs(l[1]-l[7]),Math.abs(l[2]-l[14])),o.x=.5*(l[0]+l[3]),o.y=.5*(l[1]+l[7]),o.z=.5*(l[2]+l[14]);let c=new a.Vector3;c.subVectors(r.position,o),c.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*r.fov*Math.PI/180),l=i.length()/t/l,s.addVectors(o,c.multiplyScalar(l))}else{t.updateMatrixWorld(!0),l=new a.Vector3,e.getWorldPosition(l),o.set(l.x,l.y,l.z);let n=new a.Vector3;n.subVectors(r.position,o),n.normalize(),s.addVectors(o,n.multiplyScalar(3))}(0,_.anima)({positionX:r.position.x,positionY:r.position.y,positionZ:r.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:s.x,positionY:s.y,positionZ:s.z,targetX:o.x,targetY:o.y,targetZ:o.z},.5,(e=>{r.position.set(e.positionX,e.positionY,e.positionZ),r.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}instance(e){this.runScene.assetsEx.scene.updateMatrixWorld();const t={},r=Array.isArray(e)?e:[e],a=[];r.map((e=>{e.traverse((e=>{var r;e.geometry&&!J(e)&&(r=$(e))&&(a.push(e),t[r]||(t[r]=new Set),t[r].add(e))}))})),(0,n.mapObj)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=G(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),re(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),a.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){const e=this.runScene.sceneEx.getClearModels();let t=[];e.map((e=>e.traverse((e=>t.push(e))))),t.map((e=>{V(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,r){const{getOriginData:n,ignoreMove:i}=(0,_.mergeObject)({ignoreMove:!1,getOriginData:!1},r);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(r=>{if(i||!this.runScene.events.mouse.isMove){const i=new a.Raycaster,u=new a.Vector2,{engineDom:d,camera:h}=this.runScene.assetsEx.get();var{top:s,left:o,width:l,height:c}=d.getBoundingClientRect(),o=r.pageX-o;r=r.pageY-s,u.x=o/l*2-1,u.y=-r/c*2+1,i.setFromCamera(u,h);const p=i.intersectObjects(e||[],!0);null!=t&&t(0===p.length?null:n?p:p.map((e=>e.object)))}}))}getSize(e){this.sizeBox||(this.sizeBox=new a.Box3),this.sizeBox.setFromObject(e);var{x:e,y:t,z:r}=this.sizeBox.getSize(new a.Vector3);return{x:e,y:t,z:r}}reCenter(e){const t=new d.Z.Vector3,r=new d.Z.Box3;r.setFromObject(e),r.getCenter(t),e.traverse((e=>{if(e instanceof d.Z.Mesh){const n=e.geometry;n.computeBoundingBox();var r=new d.Z.Vector3;n.boundingBox.getCenter(r);const a=n.vertices||n.attributes.position.array;for(let e=0;e<a.length;e++)a[e].sub(r).add(t);n.vertices?n.verticesNeedUpdate=!0:n.attributes.position.needsUpdate=!0}}))}getTruthPosition(e){const t=this.runScene.helperEx.boxHelper;if(this.runScene.helperEx.boxHelper.setFromObject(e),t.update(),t&&t.object){const r=new a.Vector3;e=t.geometry.attributes.position.array,r.set(Math.abs(e[0]-e[3]),Math.abs(e[1]-e[7]),Math.abs(e[2]-e[14]));const n=new a.Vector3;return n.x=.5*(e[0]+e[3]),n.y=.5*(e[1]+e[7]),n.z=.5*(e[2]+e[14]),n}}}const z=e=>{},F=e=>{if(o.includes(e))return e=(0,_.getModelByType)(e),p.ZP.parseNode(e),e;throw TypeError("")},V=(e,t)=>{t=(t||{}).remove;const{geometry:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&((0,m.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},G=(e,t)=>{var{material:r,geometry:n}=e;const a=new d.Z.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),a.setMatrixAt(t,e.matrixWorld)})),a.name=e.name,a},H=(e,t)=>{const r=[];if(t.map((e=>{e=e.geometry,r.push(e)})),t=i.qf(r))return new d.Z.Mesh(t,e)},Z=e=>0!==e.animations.length,W=e=>{e&&e.userData&&(e.userData.isHelper=!0)},K=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,q=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,g.M)(e,"layers",t))},X=e=>{const t=[];e.traverse((e=>{t.push(e)}))},Y=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},Q=(e,t)=>{t?(0,g.M)(e,"isDynamic",!0):delete e.userData.isDynamic},J=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&J(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,$=e=>e.userData.cloneId,ee=(e,t)=>{(0,g.M)(e,"cloneId",t)},te=e=>{delete e.userData.cloneId},re=e=>1===e.userData.layers,ne=e=>e.isSprite,ae=e=>{},ie=e=>{var t=new a.Vector3;return(new a.Box3).setFromObject(e).getSize(t),t},se={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},oe={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,s.N)(e)&&void 0===e.userData.unNormal,hasUnNormal:e=>void 0!==(null==(e=null==e?void 0:e.userData)?void 0:e.unNormal)},le={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}},ce={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.uselessGroup,set(e,t){t?e.userData.uselessGroup=!0:delete e.userData.uselessGroup}},ue=(e,t)=>{let r=[];Array.isArray(e)?r.push(...e):r.push(e);const n={};return r.map((e=>e.traverse((e=>{null!=t&&t(e),n[(0,T.Ki)(e)]=e})))),n},de={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.isTemp),set(e,t){t?e.userData.isTemp=t:delete e.userData.isTemp}},he={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.closeEvent),set(e,t){t?e.userData.closeEvent=t:delete e.userData.closeEvent}},pe=()=>{var e=new a.MeshBasicMaterial,t=new a.SphereGeometry(.7,300,300);return new a.Mesh(t,e)},me=e=>(0,s.N)(e)?"camera":(0,h.RQ)(e)?"light":K(e)||e.userData.isLightTarget?"helper":"Mesh"===e.type?"mesh":"Line"===e.type?"line":"Sprite"===e.type?"sprite":"Group"===e.type||"Object3D"===e.type?"group":void 0,fe=(e,t)=>{(0,g.M)(t,"cloneId",$(e)||e.userData.id)},ge=e=>!(0,s.N)(e)&&!(0,h.RQ)(e),ve=e=>{const t={};return be(e,"id",(e=>{0<e.animations.length&&(t[(0,T.Ki)(e)]=e.animations)})),t},be=(e,t="name",r)=>{const n={};return e.traverse((e=>{"id"===t?n[e.userData.id]=e:n[e[t]]=e,null!=r&&r(e)})),n},ye=(e,t)=>{const{animaMap:r,newModelMap:a}=t;(0,n.mapObj)(r,((t,r)=>{const i=a[t],s={};i&&(i.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,n.mapObj)(s,((t,r)=>{var a=i.getObjectByName(t);if(a){(0,g.M)(a,"id",(0,n.getId)());const i=e.uniqueEx.model.parseName(a);r.map((e=>{e.name=i+e.name.slice(t.length)}))}})))}))}},3447:(e,t,r)=>{r.d(t,{Z:()=>g});var n=r(8881),a=r(8609),i=r(2233),s=r(6001),o=r(135);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof 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 c(e,t){return(c=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)}class d extends(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&&c(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===l(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(a);function a(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=this,s=a;if(!(i instanceof s))throw new TypeError("Cannot call a class as a function");return i=[e.isCubeTexture?"#define ENVMAP_TYPE_CUBE":""].join("\n")+"\n\n\t\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\t\tuniform float radius;\n\t\t\t\tuniform float height;\n\t\t\t\tuniform float angle;\n\n\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\tuniform samplerCube map;\n\n\t\t\t\t#else\n\n\t\t\t\t\tuniform sampler2D map;\n\n\t\t\t\t#endif\n\n\t\t\t\t// From: https://www.shadertoy.com/view/4tsBD7\n\t\t\t\tfloat diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n\t\t\t\t{\n\n\t\t\t\t\tfloat d = dot ( rd, n );\n\n\t\t\t\t\tif( d > 0.0 ) { return 1e6; }\n\n\t\t\t\t\tvec3 o = ro - c;\n\t\t\t\t\tfloat t = - dot( n, o ) / d;\n\t\t\t\t\tvec3 q = o + rd * t;\n\n\t\t\t\t\treturn ( dot( q, q ) < r * r ) ? t : 1e6;\n\n\t\t\t\t}\n\n\t\t\t\t// From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n\t\t\t\tfloat sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) {\n\n\t\t\t\t\tvec3 oc = ro - ce;\n\t\t\t\t\tfloat b = dot( oc, rd );\n\t\t\t\t\tfloat c = dot( oc, oc ) - ra * ra;\n\t\t\t\t\tfloat h = b * b - c;\n\n\t\t\t\t\tif( h < 0.0 ) { return -1.0; }\n\n\t\t\t\t\th = sqrt( h );\n\n\t\t\t\t\treturn - b + h;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 project() {\n\n\t\t\t\t\tvec3 p = normalize( vWorldPosition );\n\t\t\t\t\tvec3 camPos = cameraPosition;\n\t\t\t\t\tcamPos.y -= height;\n\n\t\t\t\t\tfloat intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n\t\t\t\t\tif( intersection > 0.0 ) {\n\n\t\t\t\t\t\tvec3 h = vec3( 0.0, - height, 0.0 );\n\t\t\t\t\t\tfloat intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n\t\t\t\t\t\tp = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tp = vec3( 0.0, 1.0, 0.0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn p;\n\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 projectedWorldPosition = project();\n\n\t\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\t\tvec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tvec3 direction = normalize( projectedWorldPosition );\n\t\t\t\t\t\tvec2 uv = equirectUv( direction );\n\t\t\t\t\t\tvec3 outcolor = texture2D( map, uv ).rgb;\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\tgl_FragColor = vec4( outcolor, 1.0 );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <encodings_fragment>\n\n\t\t\t\t}\n\t\t\t\t",s={map:{value:e},height:{value:t.height||15},radius:{value:t.radius||100}},e=new n.IcosahedronGeometry(1,16),t=new n.ShaderMaterial({uniforms:s,fragmentShader:i,vertexShader:"\n\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n\t\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t}\n\t\t\t",side:n.DoubleSide}),r.call(this,e,t)}return t=a,(e=[{key:"radius",get:function(){return this.material.uniforms.radius.value},set:function(e){this.material.uniforms.radius.value=e}},{key:"height",get:function(){return this.material.uniforms.height.value},set:function(e){this.material.uniforms.height.value=e}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Mesh)){clone(){var e=this.material.uniforms.map.value;const t=new d(e);return t.name=this.name,t.visible=this.visible,t.position.copy(this.position),t.rotation.copy(this.rotation),t.scale.copy(this.scale),t.material.uniforms.height.value=this.material.uniforms.height.value,t.material.uniforms.radius.value=this.material.uniforms.radius.value,t.userData=Object.assign(Object.assign({},this.userData),{id:(0,s.getId)()}),t.material.userData=Object.assign(Object.assign({},this.material.userData),{id:(0,s.getId)()}),t}}var h,p=r(3735),m=r(3263),f=r(9667);class g{constructor(e){this.inited=()=>{this.runScene.modelEx.importAndExport.addParses(g.type,{toNormal:e=>this.process(e),parse:e=>{var{model:e,normal:t}=e;const r=this.create();var n=e.userData.layers;return(0,a.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),r.name=e.name,r.visible=e.visible,r.position.copy(e.position),r.rotation.copy(e.rotation),r.scale.copy(e.scale),r.material=e.material,r}})},this.process=e=>{if(e=e.model,!this.is(e))return e;const t=(0,a.createDefModel)("Box");return t.userData.normal=Object.assign({type:g.type},e.userData),t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.material=e.material,t.scale.copy(e.scale),t},this.runScene=e,this.runScene.cb.inited.add(g.type,this.inited)}setTexture(e,t){this.runScene.materialEx.setTexture({material:e.material,type:"map",newVal:t}),e.material.uniforms.map.value=t}is(e){return(null==(e=e.userData.normal)?void 0:e.type)===g.type}create(){var e=new n.Texture;f.helperTexture.set(e,!0);const t=new d(e);return t.userData.normal={type:g.type},t.scale.set(100,100,100),t.name="地面投影天空球",(0,i.x)(t,(0,s.getId)()),g.tools.bind(t.material),t}}(h=g).type="group-projected",g.tools={type:"group-projected-material",create:e=>e.modelEx.def.create("GroundProjected").material,parseData:(e,t)=>{const{texture:r,normal:n,core:a,material:i}=e;var{height:e,radius:s}=n;const o=h.tools.create(t),{data:l,load:c}=(o.userData.id=i.userData.id,o.uniforms.height.value=e,o.uniforms.radius.value=s,r),u=[];return c&&u.push(...m.F6.filter(l.map((e=>{const t=e.texture;if(t)return()=>{a.runScene.materialEx.setTexture({material:o,type:"map",newVal:t},!1)}})))),{material:o,setTextureFns:u}},toNormal:e=>{var t=e.uniforms.map.value;const r=(0,o.createDefMaterial)(),n=(t&&(r.map=t),r.userData=Object.assign({},e.userData),[]);return t&&n.push({type:"map",texture:t}),{material:r,normal:{type:h.tools.type,height:e.uniforms.height.value,radius:e.uniforms.radius.value},textures:n}},clone:e=>e,copy:e=>e.clone(),getTextures:e=>[{type:"map",texture:e.uniforms.map.value}],bind:e=>{e.userData={type:h.tools.type,normal:{type:h.tools.type},id:(0,s.getId)()}},setTexture:e=>{const{material:t,texture:r}=e;return e=new p.Z({target:t,typeList:["uniforms","map","value"],newVal:r}).execute(),r&&(r.mapping=303,r.needsUpdate=!0),t.needsUpdate=!0,e},getTexture:e=>e.material.uniforms.map.value,textureNames:[{type:"map"}]}},4342:(e,t,r)=>{r.d(t,{Z:()=>c});var n=r(8818),a=r(8089),i=r(7095);class s{constructor(e){this.runScene=e,this.rain=new i.Z(e)}}var o=r(1863),l=r(3447);class c{constructor(e){this.runScene=e,this.vertices=new s(e),this.water=new o.Z(e),this.groundProjected=new l.Z(e)}create(e,t){let r;return r="VerticesRain"===e?this.vertices.rain.create(t):"Water"===e?this.water.create():"2DDom"===e?this.runScene.renderEx.css2dDom.getDef():"3DDom"===e?this.runScene.renderEx.css3dDom.getDef():"3DSprite"===e?this.runScene.renderEx.css3dSprite.getDef():"GroundProjected"===e?this.groundProjected.create():(0,a.Py)(e,t),n.ZP.parseNode(r),r}static getType(e){var t;return(null==(t=null==(t=e.userData)?void 0:t.normal)?void 0:t.type)||(null==(t=e.userData)?void 0:t.type)||e.type}}},7095:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(6001),a=r(8881),i=r(1794),s=r(1715),o=r(3736),l=r(2233),c=r(8609);class u{constructor(e){this.definfo={speed:1,size:10,length:2e3},this.map=new i.Z,this.modelParse={toNormal:e=>{const{model:t,runScene:r}=e,n=(0,c.createDefModel)("Box");e=(0,l.Ki)(t);var a=r.modelEx.def.vertices.rain.map.get(e);if(n.material=t.material,!e||!a)throw TypeError("缺少属性");var{length:e,size:a,speed:i,fog:s}=a;return n.userData.normal={type:u.modelTools.type,length:e,size:a,speed:i,fog:s,materialId:(0,l.Ki)(t.material)},n},parse:e=>{const{runScene:t,normal:r,model:n}=e,a=t.modelEx.def.create(u.modelTools.type,r);return a.material=n.material,a.material.fog=r.fog,a.material.needsUpdate=!0,a.material.userData.id=r.materialId,a}},this.update=()=>{const e=this.runScene.assetsEx.get().camera;this.map.map(((t,r)=>{const{model:n,length:a,speed:i,del:s}=r;if(!s){n.position.set(e.position.x,e.position.y,e.position.z);for(let e=0;e<a;e++)n.geometry.attributes.position.setY(e,n.geometry.attributes.position.getY(e)-i),0<=i?n.geometry.attributes.position.getY(e)<=-1e3&&n.geometry.attributes.position.setY(e,1e3):1e3<=n.geometry.attributes.position.getY(e)&&n.geometry.attributes.position.setY(e,-1e3),n.geometry.attributes.position.needsUpdate=!0}}))},this.tools={type:"VerticesRain",merge:function(e,t){},toNormal:function(e){const t=(0,c.createDefModel)("Box");var r=(0,l.Ki)(e),n=this.map.get(r);if(t.material.map=e.material.map,r&&n)return t.userData.normal=Object.assign({type:this.tools.type},n),t;throw TypeError("缺少属性")},parseData:function(e,t){}},(this.runScene=e).cb.render.add("verticesRain",this.update),e.cb.model.add.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,l.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,l.Ki)(e));t&&(t.del=!0)}})),e.cb.clean.add("verticesRain",(()=>{this.map.clear()}));const{toNormal:t,parse:r}=this.modelParse;e.cb.inited.add("VerticesRain",(()=>{e.modelEx.importAndExport.addParses(u.modelTools.type,{toNormal:t,parse:r})}))}bindMaterial(e,t){(0,o.M)(e,"id",t||(0,n.getId)()),(0,o.M)(e,"type","MyPointsMaterial")}create(e){var t=(e=e||this.definfo).length;const r=new s.Sf.Points(this.createGeo(t),this.createMaterial(e));return r.name="雨雪",r.renderOrder=1,t=(0,n.getId)(),(0,o.M)(r,"id",t),this.bindMaterial(r.material),(0,o.M)(r,"type",this.tools.type),(0,o.M)(r,"normal",{type:this.tools.type}),this.map.set(t,{model:r,length:e.length,size:e.size,speed:e.speed,fog:r.material.fog,del:!1}),r}createGeo(e){let t=[];const r=new a.BufferGeometry;for(let r=0;r<e;r++){var n=2e3*Math.random()-1e3,i=2e3*Math.random()-1e3,s=2e3*Math.random()-1e3;t.push(n,i,s)}return r.setAttribute("position",new a.Float32BufferAttribute(t,3)),r}createMaterial(e){var{size:e,map:t}=e;return new s.Sf.PointsMaterial({blending:s.Sf.AdditiveBlending,depthTest:!1,transparent:!0,size:e,fog:!0,map:t})}setForModel(e){var{model:e,type:t,data:r}=e;(e=(0,l.Ki)(e))&&this.set(e,t,r)}set(e,t,r){const n=this.map.get(e);if(n){const{model:e,size:i}=n;switch(t){case"show":e.visible=r;break;case"length":e.geometry=this.createGeo(r),n[t]=r;break;case"size":var a=e.material;e.material=this.createMaterial({map:e.material.map,size:r}),this.bindMaterial(e.material,(0,l.Ki)(a)),n[t]=r;break;case"speed":n[t]=r;break;case"fog":e.material.fog=r,e.material.needsUpdate=!0,n[t]=r;break;case"texture":a=e.material,e.material=this.createMaterial({map:r,size:i}),this.bindMaterial(e.material,(0,l.Ki)(a))}}}}u.modelTools={type:"VerticesRain",parseData:function(e,t,r){const n=r.modelEx.def.create(u.modelTools.type,t);return n.material=e.material,n.material.userData.id=t.materialId,n},toNormal:(e,t,r)=>{const n=(0,c.createDefModel)("Box");var a=(0,l.Ki)(e);if(t=t.modelEx.def.vertices.rain.map.get(a),n.material=e.material,!a||!t)throw TypeError("缺少属性");var{length:a,size:t,speed:i}=t;return n.userData.normal={type:u.modelTools.type,length:a,size:t,speed:i,materialId:(0,l.Ki)(e.material)},n}}},1863:(e,t,r)=>{r.d(t,{Z:()=>y});var n=r(6001),a=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){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 c,u=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}(n);function n(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=this;if(!(i instanceof(l=n)))throw new TypeError("Cannot call a class as a function");(i=r.call(this,e)).isWater=!0;var s=o(i),l=void 0!==t.textureWidth?t.textureWidth:512,c=(e=void 0!==t.textureHeight?t.textureHeight:512,void 0!==t.clipBias?t.clipBias:0),u=void 0!==t.alpha?t.alpha:1,d=void 0!==t.time?t.time:0,h=void 0!==t.waterNormals?t.waterNormals:null,p=void 0!==t.sunDirection?t.sunDirection:new a.Vector3(.70707,.70707,0),m=new a.Color(void 0!==t.sunColor?t.sunColor:16777215),f=new a.Color(void 0!==t.waterColor?t.waterColor:8355711),g=void 0!==t.eye?t.eye:new a.Vector3(0,0,0),v=void 0!==t.distortionScale?t.distortionScale:20,b=void 0!==t.side?t.side:a.FrontSide,y=(t=void 0!==t.fog&&t.fog,new a.Plane),x=new a.Vector3,w=new a.Vector3,S=new a.Vector3,M=new a.Matrix4,T=new a.Vector3(0,0,-1),_=new a.Vector4,E=new a.Vector3,D=new a.Vector3,O=new a.Vector4,k=new a.Matrix4,P=new a.PerspectiveCamera,A=new a.WebGLRenderTarget(l,e);return l={uniforms:a.UniformsUtils.merge([a.UniformsLib.fog,a.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new a.Matrix4},sunColor:{value:new a.Color(8355711)},sunDirection:{value:new a.Vector3(.70707,.70707,0)},eye:{value:new a.Vector3},waterColor:{value:new a.Color(5592405)}}]),vertexShader:"\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tuniform float time;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <fog_pars_vertex>\n\t\t\t\t#include <shadowmap_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tmirrorCoord = modelMatrix * vec4( position, 1.0 );\n\t\t\t\t\tworldPosition = mirrorCoord.xyzw;\n\t\t\t\t\tmirrorCoord = textureMatrix * mirrorCoord;\n\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t#include <fog_vertex>\n\t\t\t\t#include <shadowmap_vertex>\n\t\t\t}",fragmentShader:"\n\t\t\t\tuniform sampler2D mirrorSampler;\n\t\t\t\tuniform float alpha;\n\t\t\t\tuniform float time;\n\t\t\t\tuniform float size;\n\t\t\t\tuniform float distortionScale;\n\t\t\t\tuniform sampler2D normalSampler;\n\t\t\t\tuniform vec3 sunColor;\n\t\t\t\tuniform vec3 sunDirection;\n\t\t\t\tuniform vec3 eye;\n\t\t\t\tuniform vec3 waterColor;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\tvec4 getNoise( vec2 uv ) {\n\t\t\t\t\tvec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);\n\t\t\t\t\tvec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );\n\t\t\t\t\tvec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );\n\t\t\t\t\tvec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );\n\t\t\t\t\tvec4 noise = texture2D( normalSampler, uv0 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv1 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv2 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv3 );\n\t\t\t\t\treturn noise * 0.5 - 1.0;\n\t\t\t\t}\n\n\t\t\t\tvoid sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {\n\t\t\t\t\tvec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );\n\t\t\t\t\tfloat direction = max( 0.0, dot( eyeDirection, reflection ) );\n\t\t\t\t\tspecularColor += pow( direction, shiny ) * sunColor * spec;\n\t\t\t\t\tdiffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <packing>\n\t\t\t\t#include <bsdfs>\n\t\t\t\t#include <fog_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <lights_pars_begin>\n\t\t\t\t#include <shadowmap_pars_fragment>\n\t\t\t\t#include <shadowmask_pars_fragment>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\tvec4 noise = getNoise( worldPosition.xz * size );\n\t\t\t\t\tvec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );\n\n\t\t\t\t\tvec3 diffuseLight = vec3(0.0);\n\t\t\t\t\tvec3 specularLight = vec3(0.0);\n\n\t\t\t\t\tvec3 worldToEye = eye-worldPosition.xyz;\n\t\t\t\t\tvec3 eyeDirection = normalize( worldToEye );\n\t\t\t\t\tsunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );\n\n\t\t\t\t\tfloat distance = length(worldToEye);\n\n\t\t\t\t\tvec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;\n\t\t\t\t\tvec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );\n\n\t\t\t\t\tfloat theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );\n\t\t\t\t\tfloat rf0 = 0.3;\n\t\t\t\t\tfloat reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );\n\t\t\t\t\tvec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;\n\t\t\t\t\tvec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);\n\t\t\t\t\tvec3 outgoingLight = albedo;\n\t\t\t\t\tgl_FragColor = vec4( outgoingLight, alpha );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <encodings_fragment>\n\t\t\t\t\t#include <fog_fragment>\t\n\t\t\t\t}"},(e=new a.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:a.UniformsUtils.clone(l.uniforms),lights:!0,side:b,fog:t})).uniforms.mirrorSampler.value=A.texture,e.uniforms.textureMatrix.value=k,e.uniforms.alpha.value=u,e.uniforms.time.value=d,e.uniforms.normalSampler.value=h,e.uniforms.sunColor.value=m,e.uniforms.waterColor.value=f,e.uniforms.sunDirection.value=p,e.uniforms.distortionScale.value=v,e.uniforms.eye.value=g,s.material=e,s.onBeforeRender=function(e,t,r){var n,a,i;w.setFromMatrixPosition(s.matrixWorld),S.setFromMatrixPosition(r.matrixWorld),M.extractRotation(s.matrixWorld),x.set(0,0,1),x.applyMatrix4(M),E.subVectors(w,S),0<E.dot(x)||(E.reflect(x).negate(),E.add(w),M.extractRotation(r.matrixWorld),T.set(0,0,-1),T.applyMatrix4(M),T.add(S),D.subVectors(w,T),D.reflect(x).negate(),D.add(w),P.position.copy(E),P.up.set(0,1,0),P.up.applyMatrix4(M),P.up.reflect(x),P.lookAt(D),P.far=r.far,P.updateMatrixWorld(),P.projectionMatrix.copy(r.projectionMatrix),k.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),k.multiply(P.projectionMatrix),k.multiply(P.matrixWorldInverse),y.setFromNormalAndCoplanarPoint(x,w),y.applyMatrix4(P.matrixWorldInverse),_.set(y.normal.x,y.normal.y,y.normal.z,y.constant),n=P.projectionMatrix,O.x=(Math.sign(_.x)+n.elements[8])/n.elements[0],O.y=(Math.sign(_.y)+n.elements[9])/n.elements[5],O.z=-1,O.w=(1+n.elements[10])/n.elements[14],_.multiplyScalar(2/_.dot(O)),n.elements[2]=_.x,n.elements[6]=_.y,n.elements[10]=_.z+1-c,n.elements[14]=_.w,g.setFromMatrixPosition(r.matrixWorld),n=e.getRenderTarget(),a=e.xr.enabled,i=e.shadowMap.autoUpdate,s.visible=!1,e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(A),e.state.buffers.depth.setMask(!0),!1===e.autoClear&&e.clear(),e.render(t,P),s.visible=!0,e.xr.enabled=a,e.shadowMap.autoUpdate=i,e.setRenderTarget(n),void 0!==(t=r.viewport)&&e.state.viewport(t))},i}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(a.Mesh),d=r(1794),h=r(135),p=(t=r(144),r(1715)),m=r(3736),f=r(2233),g=r(8089),v=r(8609),b=r(3735);t.Gf.fog;class y{constructor(e){this.catchModel=new d.Z,this.map=new d.Z,this.inited=()=>{this.runScene.cb.render.add(y.type,this.render),this.runScene.cb.model.add.add(y.type,this.onModelAdd),this.runScene.cb.model.remove.add(y.type,this.onModelDel),this.runScene.modelEx.importAndExport.addParses("Water",{toNormal:e=>this.process(e),parse:e=>{const t=this.create();return e=e.model,t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),this.catchModel.set(e.userData.normal.id,{model:t,material:t.material}),t.material=e.material,t.userData=Object.assign({},e.userData),t}}),this.runScene.cb.loaderer.gltf.complete.add("water-model",this.complete),this.runScene.cb.load.complete.add("water-model",this.complete)},this.complete=()=>{this.catchModel.map(((e,t)=>{const{model:r,material:n}=t;t=r.material,y.mergeMaterial(t,n),this.bindMaterialData(n),r.material=n})),this.catchModel.clear()},this.process=e=>{if(e=e.model,!this.is(e))return e;const t=(0,v.createDefModel)("Box");return t.userData.normal=Object.assign({type:"Water"},e.userData),t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.material=e.material,t},this.onModelAdd=e=>{var t;this.is(e.model)&&(e=e.model,(t=(0,f.Ki)(e))&&this.map.set(t,e))},this.onModelDel=e=>{this.is(e.model)&&(e=e.model,(e=(0,f.Ki)(e))&&this.map.delete(e))},this.render=()=>{0!==this.map.size&&this.map.map(((e,t)=>{t.material.uniforms.time.value+=t.material.userData.speed||1/60}))},this.runScene=e,this.runScene.cb.inited.add(y.type,this.inited)}create(){const e=new u(new a.PlaneGeometry(1e3,1e3),{textureWidth:512,textureHeight:512,sunDirection:new p.Sf.Vector3,sunColor:16711680,waterColor:16777215,distortionScale:3.7});return this.bindData(e),e.rotation.x=-Math.PI/2,e}static create(){const e=new u(new a.PlaneGeometry(1e3,1e3),{textureWidth:512,textureHeight:512,sunDirection:new p.Sf.Vector3,sunColor:16711680,waterColor:16777215,distortionScale:3.7});return e.rotation.x=-Math.PI/2,e}is(e){return"Water"===(null==(e=e.userData.normal)?void 0:e.type)}bindData(e){e.userData.normal={type:"Water"},e.name="water",this.bindMaterialData(e.material)}bindMaterialData(e){e.userData.type="Water",e.userData.id=e.userData.id||(0,n.getId)(),e.userData.tools=y.tools}set(e,t,r){e.material[t]=r}static mergeMaterial(e,t){var{fog:r,side:n}=e,{waterColor:a,distortionScale:i,normalSampler:s}=e.uniforms;t.fog=r,t.side=n,t.uniforms.normalSampler.value=s.value,t.uniforms.waterColor.value.copy(a.value),t.uniforms.distortionScale.value=i.value,t.userData=Object.assign({},e.userData)}}(c=y).type="water-model",y.tools={type:"Water",bind(e){(0,m.M)(e,"type","Water")},getTextures:e=>["normalSampler"].map((t=>{var r=e.uniforms[t].value;if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{const e=c.create();return e.material.type=c.tools.type,e.material.userData.tools=c.tools,e.material},parseData:(e,t)=>{const{texture:r,material:n,normal:a}=e,{data:i,load:s}=r,o=[],l=c.tools.create(t);var{side:e,fog:u,waterColor:d,distortionScale:h,speed:p}=a;return l.fog=void 0===u||u,e&&(l.side=e),d&&(l.uniforms.waterColor.value=(0,g.ZD)(d)),void 0!==h&&(l.uniforms.distortionScale.value=h),void 0!==p&&(n.userData.speed=p),s&&o.push(...i.map((e=>{const{type:r,texture:n}=e;return()=>{t.materialEx.setTexture({material:l,type:r,newVal:n},!1)}}))),l.userData=Object.assign({},n.userData),{material:l,setTextureFns:o}},setTexture:e=>{const{material:t,type:r,texture:n}=e;return e=new b.Z({target:t,typeList:["uniforms",r,"value"],newVal:n}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e.uniforms[t].value},toNormal:e=>{const t=(0,h.createDefMaterial)();var r={type:"Water",id:(0,f.Ki)(t)};const n={type:"Water"};return e.fog||(n.fog=!1),0!==e.side&&(n.side=e.side),e.userData.speed&&(n.speed=e.userData.speed),n.waterColor=e.uniforms.waterColor.value.getHexString(),n.distortionScale=e.uniforms.distortionScale.value,t.userData=r,{normal:n,textures:y.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=y.tools.type,t},textureNames:[{type:"normalSampler"}]}},4464:(e,t,r)=>{function n(){var e=0,t=document.createElement("div");function r(e){return t.appendChild(e.dom),e}function a(r){for(var n=0;n<t.children.length;n++)t.children[n].style.display=n===r?"block":"none";e=r}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(r){r.preventDefault(),a(++e%t.children.length)}),!1);var i,s=(performance||Date).now(),o=s,l=0,c=r(new n.Panel("FPS","#0ff","#002")),u=r(new n.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new n.Panel("MB","#f08","#201"))),a(0),{REVISION:16,dom:t,addPanel:r,showPanel:a,begin:function(){s=(performance||Date).now()},end:function(){l++;var e,t=(performance||Date).now();return u.update(t-s,200),o+1e3<=t&&(c.update(1e3*l/(t-o),100),o=t,l=0,i&&(e=performance.memory,i.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){s=this.end()},domElement:t,setMode:a}}r.d(t,{Z:()=>s,F:()=>o}),n.Panel=function(e,t,r){var n=1/0,a=0,i=Math.round,s=i(window.devicePixelRatio||1),o=80*s,l=48*s,c=3*s,u=2*s,d=3*s,h=15*s,p=74*s,m=30*s,f=document.createElement("canvas"),g=(f.width=o,f.height=l,f.style.cssText="width:80px;height:48px",f.getContext("2d"));return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=r,g.fillRect(0,0,o,l),g.fillStyle=t,g.fillText(e,c,u),g.fillRect(d,h,p,m),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(d,h,p,m),{dom:f,update:function(l,v){n=Math.min(n,l),a=Math.max(a,l),g.fillStyle=r,g.globalAlpha=1,g.fillRect(0,0,o,h),g.fillStyle=t,g.fillText(i(l)+" "+e+" ("+i(n)+"-"+i(a)+")",c,u),g.drawImage(f,d+s,h,p-s,m,d,h,p-s,m),g.fillRect(d+p-s,h,s,m),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(d+p-s,h,s,i((1-l/v)*m))}}};const a=n;var i=r(5317);class s{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,stop:!1,event:{trigger:!0,ignores:[]},size:{width:0,height:0}},event:{base:"dom"},texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1},pp:{open:!0,glow:{open:!1}},camera:{showBackground:!1}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,i.getTime)(7)},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:r,cb:n}=t;e&&clearTimeout(e),e=setTimeout((()=>{n(),e=null,clearTimeout(e)}),r)}})(),this.runScene=e,this.options=(0,i.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=new a,this.stats.showPanel(0),e.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",r="success"){var n;null!=(n=null==(n=this.options)?void 0:n.msg)&&n.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:r}),console.log(e))}}const o=e=>e.optionsEx.options},228:(e,t,r)=>{r.d(t,{Q:()=>h,S:()=>p});var n=r(1715),a=r(8881),i=r(4819),s=r(6608);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=c(n);function n(e,t,o,l){var c;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(c=r.call(this)).renderScene=t,c.renderCamera=o,c.selectedObjects=void 0!==l?l:[],c.visibleEdgeColor=new a.Color(1,1,1),c.hiddenEdgeColor=new a.Color(.1,.04,.02),c.edgeGlow=0,c.usePatternTexture=!1,c.edgeThickness=1,c.edgeStrength=3,c.downSampleRatio=2,c.pulsePeriod=0,c._visibilityCache=new Map,c.resolution=void 0!==e?new a.Vector2(e.x,e.y):new a.Vector2(256,256),t=Math.round(c.resolution.x/c.downSampleRatio),o=Math.round(c.resolution.y/c.downSampleRatio),c.renderTargetMaskBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetMaskBuffer.texture.name="OutlinePass.mask",c.renderTargetMaskBuffer.texture.generateMipmaps=!1,c.depthMaterial=new a.MeshDepthMaterial,c.depthMaterial.side=a.DoubleSide,c.depthMaterial.depthPacking=a.RGBADepthPacking,c.depthMaterial.blending=a.NoBlending,c.prepareMaskMaterial=c.getPrepareMaskMaterial(),c.prepareMaskMaterial.side=a.DoubleSide,c.prepareMaskMaterial.fragmentShader=function(e,t){return t=t.isPerspectiveCamera?"perspective":"orthographic",e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(c.prepareMaskMaterial.fragmentShader,c.renderCamera),c.renderTargetDepthBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y,{type:a.HalfFloatType}),c.renderTargetDepthBuffer.texture.name="OutlinePass.depth",c.renderTargetDepthBuffer.texture.generateMipmaps=!1,c.renderTargetMaskDownSampleBuffer=new a.WebGLRenderTarget(t,o,{type:a.HalfFloatType}),c.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",c.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,c.renderTargetBlurBuffer1=new a.WebGLRenderTarget(t,o,{type:a.HalfFloatType}),c.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",c.renderTargetBlurBuffer1.texture.generateMipmaps=!1,c.renderTargetBlurBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2),{type:a.HalfFloatType}),c.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",c.renderTargetBlurBuffer2.texture.generateMipmaps=!1,c.edgeDetectionMaterial=c.getEdgeDetectionMaterial(),c.renderTargetEdgeBuffer1=new a.WebGLRenderTarget(t,o,{type:a.HalfFloatType}),c.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",c.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,c.renderTargetEdgeBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2),{type:a.HalfFloatType}),c.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",c.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,c.separableBlurMaterial1=c.getSeperableBlurMaterial(4),c.separableBlurMaterial1.uniforms.texSize.value.set(t,o),c.separableBlurMaterial1.uniforms.kernelRadius.value=1,c.separableBlurMaterial2=c.getSeperableBlurMaterial(4),c.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(t/2),Math.round(o/2)),c.separableBlurMaterial2.uniforms.kernelRadius.value=4,c.overlayMaterial=c.getOverlayMaterial(),l=s.C,c.copyUniforms=a.UniformsUtils.clone(l.uniforms),c.copyUniforms.opacity.value=1,c.materialCopy=new a.ShaderMaterial({uniforms:c.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:a.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),c.enabled=!0,c.needsSwap=!1,c._oldClearColor=new a.Color,c.oldClearAlpha=1,c.fsQuad=new i.T(null),c.tempPulseColor1=new a.Color,c.tempPulseColor2=new a.Color,c.textureMatrix=new a.Matrix4,c}return t=n,(e=[{key:"dispose",value:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose(),this.depthMaterial.dispose(),this.prepareMaskMaterial.dispose(),this.edgeDetectionMaterial.dispose(),this.separableBlurMaterial1.dispose(),this.separableBlurMaterial2.dispose(),this.overlayMaterial.dispose(),this.materialCopy.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t),e=Math.round(e/this.downSampleRatio),t=Math.round(t/this.downSampleRatio),this.renderTargetMaskDownSampleBuffer.setSize(e,t),this.renderTargetBlurBuffer1.setSize(e,t),this.renderTargetEdgeBuffer1.setSize(e,t),this.separableBlurMaterial1.uniforms.texSize.value.set(e,t),e=Math.round(e/2),t=Math.round(t/2),this.renderTargetBlurBuffer2.setSize(e,t),this.renderTargetEdgeBuffer2.setSize(e,t),this.separableBlurMaterial2.uniforms.texSize.value.set(e,t)}},{key:"changeVisibilityOfSelectedObjects",value:function(e){var t=this._visibilityCache;function r(r){r.isMesh&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}for(var n=0;n<this.selectedObjects.length;n++)this.selectedObjects[n].traverse(r)}},{key:"changeVisibilityOfNonSelectedObjects",value:function(e){var t=this._visibilityCache,r=[];function n(e){e.isMesh&&r.push(e)}for(var a=0;a<this.selectedObjects.length;a++)this.selectedObjects[a].traverse(n);this.renderScene.traverse((function(n){if(n.isMesh||n.isSprite){for(var a,i=!1,s=0;s<r.length;s++)if(r[s].id===n.id){i=!0;break}!1===i&&(a=n.visible,!1!==e&&!0!==t.get(n)||(n.visible=e),t.set(n,a))}else(n.isPoints||n.isLine)&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}))}},{key:"updateTextureMatrix",value:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}},{key:"render",value:function(e,t,r,a,i){var s,o;0<this.selectedObjects.length&&(e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha(),s=e.autoClear,e.autoClear=!1,i&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1),o=this.renderScene.background,this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=o,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),0<this.pulsePeriod&&(o=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2,this.tempPulseColor1.multiplyScalar(o),this.tempPulseColor2.multiplyScalar(o)),this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,i&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s),this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=r.texture,e.setRenderTarget(null),this.fsQuad.render(e))}},{key:"getPrepareMaskMaterial",value:function(){return new a.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new a.Vector2(.5,.5)},textureMatrix:{value:null}},vertexShader:"#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t\tvPosition = mvPosition;\n\n\t\t\t\t\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t\t\t\t\t#ifdef USE_INSTANCING\n\n\t\t\t\t\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t\t\t\t\t#endif\n\t\t\t\t\t\n\t\t\t\t\tworldPosition = modelMatrix * worldPosition;\n\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\n\t\t\t\t}",fragmentShader:"#include <packing>\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n\t\t\t\t}"})}},{key:"getEdgeDetectionMaterial",value:function(){return new a.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},visibleEdgeColor:{value:new a.Vector3(1,1,1)},hiddenEdgeColor:{value:new a.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}},{key:"getSeperableBlurMaterial",value:function(e){return new a.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},direction:{value:new a.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat sigma = kernelRadius/2.0;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, sigma);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = kernelRadius * float(i) / float(MAX_RADIUS);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, sigma);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}},{key:"getOverlayMaterial",value:function(){return new a.ShaderMaterial({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n\t\t\t\t}",blending:a.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.w);d.BlurDirectionX=new a.Vector2(1,0),d.BlurDirectionY=new a.Vector2(0,1);class h{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new d(this.mtuPP.rtSize,this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.outlinePass)}setOutlineData(e,t){this.outlinePass[e]="visibleEdgeColor"===e||"hiddenEdgeColor"===e?new n.Sf.Color(t):t}dispose(){this.outlinePass&&(this.outlinePass.dispose(),this.outlinePass=null)}addSelectedObject(e,t=!0){this.outlinePass&&e&&(this.outlinePass.selectedObjects||(this.outlinePass.selectedObjects=[]),t?this.isObjExist(e)||(e.userData.outline=!0,this.outlinePass.selectedObjects.push(e)):this.outlinePass.selectedObjects.map(((t,r)=>{t.uuid===e.uuid&&(e.userData.outline=!1,this.outlinePass.selectedObjects.splice(r,1))})))}clearAllOutlineObj(){this.outlinePass&&(this.outlinePass.selectedObjects=[])}isObjExist(e){if(!e||!this.outlinePass||!this.outlinePass.selectedObjects)return!1;let t=!1;return this.outlinePass.selectedObjects.forEach((r=>{e.uuid===r.uuid&&(t=!0)})),t}enablePass(e){this.outlinePass&&this.outlinePass.enabled!==e&&(this.outlinePass.enabled=e)}}const p=e=>e.userData.outline},9583:(e,t,r)=>{r.d(t,{ZP:()=>v,sH:()=>b});var n=r(8881),a=r(699),i=r(1794),s=r(8609),o=r(3736),l=r(2233);class c{constructor(e){this.calls={toNormal:e=>{const t=(0,s.createDefModel)("Box");var r=this.getSizeByModel(e.model);return t.userData=Object.assign(Object.assign({},e.model.userData),{name:e.model.name,size:r}),t.position.copy(e.model.position),t},parse:e=>{e=e.model;var{name:t,size:r,id:n,alpha:a}=e.userData;const i=this.getDef(t);return i.position.copy(e.position),i.name=t,this.setSizeForModel(i,r),a&&this.setAlpha(i,a),(0,o.M)(i,"id",n),i}},this.map=new i.Z,this.onModelAdd=e=>{e=e.model,this.is(e)&&(this.map.set((0,l.Ki)(e),!0),this.onMapSet())},this.onModelDel=e=>{e=e.model,this.is(e)&&(this.map.delete((0,l.Ki)(e)),this.onMapSet())},(this.runScene=e).cb.inited.add("cssRender",(()=>{this.initEvent()})),e.cb.undo.normal.valid.add("cssRender",(({info:e,val:t,target:r})=>!this.is(r)||"name"!==e||null===t[0].match(/\d+/)||(this.runScene.optionsEx.log("该模型首位字符不可为数字","base","error"),!1)))}initEvent(){this.runScene.cb.unique.model.add.add("cssRender",this.onModelAdd),this.runScene.cb.unique.model.remove.add("cssRender",this.onModelDel),this.runScene.modelEx.importAndExport.addParses(this.type,this.calls)}onMapSet(){this.setState(0!==this.map.size)}getDom(e,t){let r;if(!(r=t?document.querySelector("."+t):r)){const t=document.createElement("div");t.style.width="10px",t.style.height="7px",t.classList.add(this.prefix+"_model_"+e),t.style.backgroundColor="#fff",this.runScene.assetsEx.engineDom.appendChild(t),r=t}return r}getSizeByModel(e){var{width:t,height:r}=e.element.getBoundingClientRect();return{width:(null==(e=e.userData.size)?void 0:e.width)||t||10,height:(null==e?void 0:e.height)||r||7}}setSizeForModel(e,t){if(t&&"editor"===this.runScene.optionsEx.options.mode){var{width:t,height:r}=t;const n=e.element;n.style.width=t+"px",n.style.height=r+"px",e.userData.size||(e.userData.size={}),e.userData.size.width=t,e.userData.size.height=r}}setBgc(e){const{model:t,url:r}=e;t.userData.url=r,t.element.style.backgroundImage=`url(${r})`,t.element.style.backgroundSize="100% 100%"}setAlpha(e,t){e.userData.alpha=t,e.element.style.backgroundColor=t?"rgba(0,0,0,0)":"rgb(255,255,255)"}}var u=r(6001);class d extends c{constructor(){super(...arguments),this.type="Css2dDom",this.prefix="Css2dDom"}getDef(){var e=(0,u.getId)();const t=new a.j(this.getDom(e));return(0,o.M)(t,"id",e),(0,o.M)(t,"normal",{type:this.type}),t.name=this.type,t.element.addEventListener("pointerdown",(()=>{this.runScene.events.mouse.catchTrigger=t})),t}is(e){return(null==(e=(0,o.is)(e,"normal"))?void 0:e.type)===this.type}setState(e){this.runScene.globalConfig.setRender2(e)}}var h=r(3693),p=r(6272);class m extends c{constructor(){super(...arguments),this.type="Css3dDom",this.prefix="Css3dDom"}getDef(){var e=(0,u.getId)();const t=new h.cp(this.getDom(e));return(0,o.M)(t,"id",e),(0,o.M)(t,"normal",{type:this.type}),t.name=this.type,t.element.addEventListener("pointerdown",(()=>{this.runScene.events.mouse.catchTrigger=t})),t}is(e){var t;return(null==(t=(0,o.is)(e,"normal"))?void 0:t.type)===this.type||(null==(t=(0,o.is)(e,"normal"))?void 0:t.type)===this.runScene.renderEx.css3dSprite.type}setState(e){this.runScene.globalConfig.setRender3(e)}setBgc(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{model:t,url:r}=e;t.userData.url=r;var n=yield(0,p.o4)(r);t.element.appendChild(n)}))}}class f extends c{constructor(){super(...arguments),this.type="Css3dSprite",this.prefix="Css3dSprite"}getDef(e){var t=(0,u.getId)();const r=new h.P7(this.getDom(t,e));return(0,o.M)(r,"id",t),(0,o.M)(r,"normal",{type:this.type}),r.name=this.type,r.element.addEventListener("pointerdown",(()=>{this.runScene.events.mouse.catchTrigger=r})),r}is(e){var t;return(null==(t=(0,o.is)(e,"normal"))?void 0:t.type)===this.type||(null==(t=(0,o.is)(e,"normal"))?void 0:t.type)===this.runScene.renderEx.css3dDom.type}setState(e){this.runScene.globalConfig.setRender3(e)}}var g=r(6292);class v{constructor(e){this.pixelRatio=1,this.ratio=0,this.inited=()=>{this.runScene.exporter.gltf.options.addOption({type:"renderer",process:()=>{var{outputEncoding:e,toneMapping:t,toneMappingExposure:r}=this.runScene.assetsEx.renderer;const n={outputEncoding:e,toneMapping:t,toneMappingExposure:r};return 1!==this.pixelRatio&&(n.pixelRatio=this.pixelRatio),0!==this.ratio&&(n.ratio=this.ratio),JSON.stringify(n)},parse:e=>{var t,r,n,a;e&&(({outputEncoding:e,toneMapping:t,toneMappingExposure:r,pixelRatio:n,ratio:a}=JSON.parse(e)),this.setEncoding(3e3===e?"def":"srgb"),this.setToneMapping(Object.keys(y)[t]),this.setExposure(r),this.setRatio(a||0),void 0!==n&&this.setPixelRatio(n))}})},this.setSize=(e,t)=>{var{width:r,height:n}=this.getDomSize(),r=(e=e||r,t||n);this.runScene.setSize(e,r),this.runScene.cb.renderEx.setSize.cb({width:e,height:r})},this.runScene=e,this.css2dDom=new d(e),this.css3dDom=new m(e),this.css3dSprite=new f(e),this.runScene.cb.resize.add("render-ex-resize",(({width:e,height:t})=>{this.setSize(e,t)})),e.cb.inited.add("render",this.inited)}setRatio(e){this.ratio=e;const t=this.runScene.assetsEx.engineDom;if(t){var{width:r,height:n}=t.getBoundingClientRect();let a=r,i=n;(i=0!==e?a*e:i)>n&&(i=n,a=n/e),this.runScene.cb.resize.cb({width:a,height:i})}}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e||""}setPixelRatio(e){this.pixelRatio=e,this.runScene.assetsEx.renderer.setPixelRatio(e)}create(e){let t=new n.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance",precision:"highp"});return t.domElement.style.position="absolute",t.domElement.style.top="50%",t.domElement.style.left="50%",t.domElement.style.transform="translate(-50%,-50%)",t.setPixelRatio(this.pixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=n.PCFSoftShadowMap,t.useLegacyLights=!1,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}setEncoding(e){this.runScene.assetsEx.renderer.outputEncoding="def"===e?g.Z.LinearEncoding:g.Z.sRGBEncoding}setToneMapping(e){this.runScene.assetsEx.renderer.toneMapping=y[e]}setExposure(e){this.runScene.assetsEx.renderer.toneMappingExposure=e}getDomSize(){var{width:e,height:t}=this.runScene.assetsEx.get().engineDom.getBoundingClientRect();return{width:e,height:t}}}const b=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()},y={NoToneMapping:g.Z.NoToneMapping,LinearToneMapping:g.Z.LinearToneMapping,ReinhardToneMapping:g.Z.ReinhardToneMapping,CineonToneMapping:g.Z.CineonToneMapping,ACESFilmicToneMapping:g.Z.ACESFilmicToneMapping,CustomToneMapping:g.Z.CustomToneMapping}},1715:(e,t,r)=>{r.d(t,{Gc:()=>ka,al:()=>ft,ch:()=>d,Az:()=>T,Sf:()=>Pa,cQ:()=>u,ZP:()=>Aa}),t={};var n=(r.r(t),r.d(t,{FBXLoader:()=>kr}),r(3300)),a=r.n(n),i=r(6001),s=r(8881);class o{constructor(e){this.runScene=e}}var l=r(2353),c=r(6292),u=r(5317),d=r(8609);class h extends o{constructor(e){super(e),this.map={},this.clock=new s.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},this.clean=()=>{this.reset()},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)})),e.cb.model.remove.add("anima-parse",(({model:e})=>{this.onModelDelete(e)})),this.runScene.cb.clean.add("EngineHelper",this.clean)}onModelDelete(e){e.traverse((e=>{(0,d.withAnima)(e)&&e.animations.map((t=>{t.id&&(this.close(e,t.name),delete this.map[t.id])}))}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const r of e.animations)if(r.name===t)return r.id}parse(e,t){if(0!==e.animations.length||t){const a=e.animations.length?e.animations:l.B.parse(t),o=new s.AnimationMixer(e);for(const t of a){var r=(0,i.getId)(),n=(t.id=r,o.clipAction(t));const a={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>a.finished())),o.addEventListener("loop",(()=>a.loop())),this.map[r]={mixer:o,action:n,model:e,time:0,runState:"close",clip:t,eventMap:a}}a.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,r){e=this.findId(e,t);const n=this.map[e];if(n&&!this.playings.has(n)){t=(0,u.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:a,onBeforeEnd:i,onLoop:s,onFinished:o,lastFrame:l,loop:d,reset:h}=t,{action:p,clip:m,eventMap:f}=(this.map[e].options=t,n);p.stop(),r=h?0:n.time,p.time=r,this.setPlayState(n,!0),h&&p.reset(),p.play();let g=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,u.getProgress)(p.time,m.duration,!0);99<=e&&!g&&(i(),g=!0),a(e)})),d?(p.loop=c.Z.LoopRepeat,f.loop=s):(p.clampWhenFinished=l,p.loop=c.Z.LoopOnce,f.finished=()=>{this.setPlayState(n,!1),a(100),o()})}}pause(e,t){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&(this.updateTime(r),this.setPlayState(r,!1),r.options.onPause(),r.runState="pause")}resume(e,t){var r=this.findId(e,t);const n=this.map[r];n&&this.playings.has(n)&&(n.options.onResume(),this.play(e,t,null==(r=this.map[t])?void 0:r.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e);const t=e.action;t.time=0,t.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((r=>{const{mixer:n,action:a}=this.map[r];a.play(),a.time=e,n.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,i.mapObj)(this.updates,((e,r)=>r(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){const{mixer:t,action:r}=e;r.reset(),r.stop(),t.time=0}resetItemByName(e,t){if((e=this.findId(e,t))&&(t=this.map[e])){const{mixer:e,action:r}=t;r.reset(),r.stop(),e.time=0}}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,r){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&n.options&&((t=(0,u.mergeObject)({resetAction:!0},r).resetAction)&&n.action.reset(),this.setPlayState(n,!1),this.updateTime(n,0),n.options.onClose(),n.options=null,n.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:r,nextName:n,duration:a}=e;e=this.findId(e,t);const i=this.map[e];i&&(t=this.findId(r,n),(e=this.map[t])&&i.action.crossFadeTo(e.action,a,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}var p=r(1794);class m{constructor(e){this.map={material:new p.Z,texture:new p.Z},this.onSet=e=>{var{type:e,id:t,isAdd:r}=e;r?(r=this.map[e].get(t)||0,this.map[e].set(t,++r)):this.map[e].get(t)&&(r=this.map[e].get(t),this.map[e].set(t,--r))},this.runScene=e,this.init()}init(){this.runScene.cb.assets.manager.set.add("AssetsManager",this.onSet)}isUsed(e,t){return void 0!==(e=this.map[e].get(t))&&0<e}}var f=r(3693),g=r(699);class v{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.clean=()=>{var e=this.get().camera;this.runScene.controlsEx.reset(),this.runScene.cameraEx.reset(e)},this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e,this.manager=new m(e),this.runScene.cb.clean.add("assets",this.clean)}initRender3(){const e=new f.lX;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.style.top=String(0),e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),this.runScene.cb.resize.add("render-3",(({width:t,height:r})=>{e.setSize(t,r)})),e}initRender2(){const e=new g.M;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.classList.add("css2dRenderer"),e.domElement.style.top="0px",e.domElement.style.left="0px",this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),this.runScene.cb.resize.add("render-2",(({width:t,height:r})=>{e.setSize(t,r)})),e}reset(){var e=this.get().camera;this.runScene.renderEx.setSize(),this.runScene.cameraEx.reset(e),this.runScene.controlsEx.reset()}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}setRender2(e){this.render2&&e||(e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null))}setRender3(e){this.render3&&e||(e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null))}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.pCam,n=this.runScene.renderEx.create(e),a=this.runScene.controlsEx.create(r,e),{render2:i,render3:s}=this.runScene.optionsEx.options;return this.camera=r,this.scene=t,this.renderer=n,this.controls=a,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(i),this.setRender3(s),{scene:t,camera:r,render:n,controls:a,engineDom:e}}get(){var{scene:e,renderer:t,controls:r,engineDom:n,render2:a,render3:i}=this;return{scene:e,camera:this.runScene.cameraEx.getCamera(),renderer:t,controls:r,engineDom:n,render2:a,render3:i}}}var b=r(3801),y=r(6272),x=r(7995);class w{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.window={pointerup:e=>{this.events.runScene.cb.events.window.pointer.up.cb({event:e})}},this.down=e=>{0!==e.button&&2!==e.button||(this.downPosition[e.button]={x:e.pageX,y:e.pageY}),this.isMove=!0},this.up=e=>{var t,r,n,a;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.pageX,r=e.pageY,({x:n,y:a}=this.downPosition[e.button]),(0,y.nx)(t,n,10)&&(0,y.nx)(r,a,10)&&(0===e.button&&this.trigger(e),2===e.button&&(!this.events.runScene.modelEx.select&&this.events.runScene.multipSelector.isEmpty()&&this.trigger(e),this.events.runScene.cb.events.pointer.rightTrigger.cb(e))))},this.selectable=!0,this.events=e}getEventLocal(e,t){var{top:e,left:r,width:n,height:a}=e.getBoundingClientRect();return{x:(t.pageX-r)/n*2-1,y:-(t.pageY-e)/a*2+1}}init(e){var t=this.events.runScene.optionsEx.options.event.base;let r=e;"dom"===t?r=e:"canvas"===t?r=this.events.runScene.assetsEx.renderer.domElement:"window"===t&&(r=window),this.events.addEvent({dom:r,name:"pointerdown",fn:this.down.bind(this)}),this.events.addEvent({dom:window,name:"pointerup",fn:this.up.bind(this)}),this.events.addEvent({dom:r,name:"pointerdown",fn:this.events.runScene.cb.events.pointer.down.cb}),this.events.addEvent({dom:r,name:"pointerup",fn:this.events.runScene.cb.events.pointer.up.cb}),this.events.addEvent({dom:r,name:"pointermove",fn:e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)}}),this.events.addEvent({dom:r,name:"mousemove",fn:this.events.runScene.cb.events.mouse.move.cb}),this.events.addEvent({dom:r,name:"mousedown",fn:this.events.runScene.cb.events.mouse.down.cb}),this.events.addEvent({dom:r,name:"mouseup",fn:this.events.runScene.cb.events.mouse.up.cb}),this.events.addEvent({dom:window,name:"pointerup",fn:this.window.pointerup})}getTriggerModels(e,t){const r=new s.Raycaster;var{camera:n,scene:a,renderer:i}=this.events.runScene.assetsEx.get(),{x:i,y:e}=this.getEventLocal(i.domElement,e),i=new s.Vector2(i,e);r.setFromCamera(i,n),e=(t||a.children).filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e}));const o=r.intersectObjects(e,!0);return this.events.runScene.cb.events.pointer.trigger.cb(o),o.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!b.zf.isLock(e,!0)&&d.selectableModel.is(e)))}set catchTrigger(e){this._catchTrigger=e}get catchTrigger(){var e=this._catchTrigger;return this._catchTrigger=void 0,e}trigger(e){let t=this.removeHideOrLockModel(this.getTriggerModels(e))||this.catchTrigger;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,e=this.events.runScene.modelEx.select,this.events.runScene.modelEx.selectNull(),e&&this.events.runScene.multipSelector.add(e),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,!0,!0)})):void 0}this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}}w.getCallback=()=>({up:new x.Z});var S=r(4464);class M{constructor(e){this.list=new p.Z,this.add=e=>{"editor"===(0,S.F)(this.runScene).mode&&(this.list.has(e.id)&&(this.list.delete(e.id),this.runScene.cb.msg.del.cb({id:e.id})),this.list.set(e.id,e))},this.del=e=>{"editor"===(0,S.F)(this.runScene).mode&&this.list.delete(e.id)},this.clean=()=>{this.list.clear()},(this.runScene=e).cb.msg.add.add("msg-add",this.add),e.cb.msg.del.add("msg-del",this.del),e.cb.clean.add("msg",this.clean)}static getCallbackMap(){return{add:new x.Z,del:new x.Z}}}var T=r(9667);class _{constructor(e){this.all=0,this.set=e=>{var{size:e,isAdd:t,type:r}=e;t?this.all+=e:this.all-=e,this.runScene.cb.msg.add.cb({tipType:"info",type:"size",id:"size",data:[{isAdd:t,now:e,all:this.all,subType:r}]})},(this.runScene=e).cb.unique.geometry.add.add("size-add",(({geometry:t})=>{this.set({size:e.uniqueEx.geometry.getSize(t),isAdd:!0,type:"geometry"})})),e.cb.texture.add.add("size-del",(e=>{this.set({size:(0,T.getTextureSize)(e),isAdd:!0,type:"texture"})})),e.cb.texture.remove.add("size-del",(e=>{this.set({size:(0,T.getTextureSize)(e),isAdd:!1,type:"texture"})}))}}_.getCallBack=()=>({add:new x.Z,del:new x.Z});var E=r(6006),D=r(1549);class O extends o{constructor(){super(...arguments),this.resize=new x.Z,this.renderEx={setSize:new x.Z},this.assets={manager:{set:new x.Z}},this.size=_.getCallBack(),this.onSizeChange=new x.Z,this.setSelectMaterial=new x.Z,this.setScene=new x.Z,this.reset=new x.Z,this.render=new x.Z,this.tick=new x.Z,this.controls={change:new x.Z,autoRotate:{pause:new x.Z,resume:new x.Z}},this.baseLog=new x.Z,this.inited=new x.Z,this.texture={add:new x.Z,remove:new x.Z,setMaterial:new x.Z,set:new x.Z,setInfo:new x.Z,setAnima:new x.Z,resize:new x.Z,multip:E.Z.callBack},this.multipSelect={add:new x.Z},this.model={setVector3:new x.Z,multiSelect:{setEmpty:new x.Z},change:new x.Z,setSelect:new x.Z,click:new x.Z,add:new x.Z,remove:new x.Z,multipDrop:new x.Z,focus:new x.Z,unFocus:new x.Z,changeName:new x.Z,setOpen:new x.Z,setMainStatue:new x.Z,setVisible:new x.Z,setParent:new x.Z,setLayers:new x.Z,setOutline:new x.Z,clone:new x.Z,dispose:new x.Z},this.material={add:new x.Z,remove:new x.Z,dispose:new x.Z,setName:new x.Z},this.unique={model:{add:new x.Z,remove:new x.Z},material:{add:new x.Z,setTimecited:new x.Z},texture:{setTimecited:new x.Z},geometry:D.Z.getCallBack()},this.tranControls={changing:new x.Z},this.undo={undo:new x.Z,redo:new x.Z,addUndos:new x.Z,addRedus:new x.Z,removeUndos:new x.Z,undoByIndex:new x.Z,reset:new x.Z,normal:{valid:new x.Z}},this.scene={save:new x.Z,saveNet:new x.Z,setEnvStrength:new x.Z},this.timeLine={setProgress:new x.Z,playGroup:new x.Z,setGroupMap:new x.Z,reset:new x.Z,closeGroup:new x.Z},this.events={key:{down:new x.Z,up:new x.Z},mouse:{move:new x.Z,down:new x.Z,up:new x.Z},pointer:{rightTrigger:new x.Z,down:new x.Z,up:new x.Z,move:new x.Z,trigger:new x.Z},window:{pointer:w.getCallback()},model:{addOptions:new x.Z}},this.pp={glow:{setData:new x.Z,setStatus:new x.Z},outline:{setData:new x.Z,setStatus:new x.Z},ao:{setData:new x.Z,setStatus:new x.Z},vignette:{setData:new x.Z,setStatus:new x.Z}},this.load={getJSON:new x.Z,progress:new x.Z,complete:new x.Z,modelAdded:new x.Z,loaded:new x.Z},this.exporter={gltf:{options:{add:new x.Z},before:new x.Z,complete:new x.Z,sizeMap:new x.Z}},this.loaderer={gltf:{loadNode:new x.Z,lazyLoadedTexture:new x.Z,loaded:new x.Z,modelLoaded:new x.Z,progress:new x.Z,getJSON:new x.Z,getArrayBuffer:new x.Z,complete:new x.Z,material:{load:new x.Z,afterParseNromal:new x.Z}}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new x.Z),e[t])}),this.tags={parseJSON:new x.Z,clear:new x.Z},this.snapshot={create:new x.Z,set:new x.Z,resetItem:new x.Z,delete:new x.Z,getLength:new x.Z,getByType:new x.Z,parseJSON:new x.Z,setName:new x.Z,delUseless:new x.Z,beforeCreate:new x.Z},this.clean=new x.Z,this.objects={sky:{setState:new x.Z}},this.error=new x.Z,this.camera={set:new x.Z},this.msg=M.getCallbackMap()}}var k=r(4230);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function A(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&C(e,t)}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function L(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=I(e);if(r=t?(r=I(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===P(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return R(n)}}function R(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var B={type:"change"},j={type:"start"},U={type:"end"},N=function(){A(t,s.EventDispatcher);var e=L(t);function t(r,n,a){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),(i=e.call(this)).object=r,i.domElement=n,i.myOptions=a,i.domElement.style.touchAction="none",i.enabled=!0,i.target=new s.Vector3,i.minDistance=0,i.maxDistance=1/0,i.minZoom=0,i.maxZoom=1/0,i.minPolarAngle=0,i.maxPolarAngle=Math.PI,i.minAzimuthAngle=-1/0,i.maxAzimuthAngle=1/0,i.enableDamping=!1,i.dampingFactor=.05,i.enableZoom=!0,i.zoomSpeed=1,i.enableRotate=!0,i.rotateSpeed=1,i.enablePan=!0,i.panSpeed=1,i.screenSpacePanning=!0,i.keyPanSpeed=7,i.autoRotate=!1,i.autoRotateSpeed=2,i.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},i.mouseButtons={LEFT:s.MOUSE.ROTATE,MIDDLE:s.MOUSE.DOLLY,RIGHT:s.MOUSE.PAN},i.touches={ONE:s.TOUCH.ROTATE,TWO:s.TOUCH.DOLLY_PAN},i.target0=i.target.clone(),i.position0=i.object.position.clone(),i.zoom0=i.object.zoom,i._domElementKeyEvents=null,i.getPolarAngle=function(){return v.phi},i.getAzimuthalAngle=function(){return v.theta},i.getDistance=function(){return this.object.position.distanceTo(this.target)},i.listenToKeyEvents=function(e){e.addEventListener("keydown",oe),this._domElementKeyEvents=e},i.saveState=function(){p.target0.copy(p.target),p.position0.copy(p.object.position),p.zoom0=p.object.zoom},i.reset=function(){p.target.copy(p.target0),p.object.position.copy(p.position0),p.object.zoom=p.zoom0,p.object.updateProjectionMatrix(),p.dispatchEvent(B),p.update(),f=m.NONE},i.update=(o=new s.Vector3,l=(new s.Quaternion).setFromUnitVectors(r.up,new s.Vector3(0,1,0)),c=l.clone().invert(),u=new s.Vector3,d=new s.Quaternion,h=2*Math.PI,function(){var e=p.object.position,t=(o.copy(e).sub(p.target),o.applyQuaternion(l),v.setFromVector3(o),p.autoRotate&&f===m.NONE&&I(2*Math.PI/60/60*p.autoRotateSpeed),p.enableDamping?(v.theta+=b.theta*p.dampingFactor,v.phi+=b.phi*p.dampingFactor):(v.theta+=b.theta,v.phi+=b.phi),p.minAzimuthAngle),r=p.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=h:t>Math.PI&&(t-=h),r<-Math.PI?r+=h:r>Math.PI&&(r-=h),v.theta=t<=r?Math.max(t,Math.min(r,v.theta)):v.theta>(t+r)/2?Math.max(t,v.theta):Math.min(r,v.theta)),v.phi=Math.max(p.minPolarAngle,Math.min(p.maxPolarAngle,v.phi)),v.makeSafe(),v.radius*=y,v.radius=Math.max(p.minDistance,Math.min(p.maxDistance,v.radius)),!0===p.enableDamping?p.target.addScaledVector(x,p.dampingFactor):p.target.add(x),o.setFromSpherical(v),o.applyQuaternion(c),e.copy(p.target).add(o),p.object.lookAt(p.target),!0===p.enableDamping?(b.theta*=1-p.dampingFactor,b.phi*=1-p.dampingFactor,x.multiplyScalar(1-p.dampingFactor)):(b.set(0,0,0),x.set(0,0,0)),y=1,!(!(w||u.distanceToSquared(p.object.position)>g||8*(1-d.dot(p.object.quaternion))>g)||(p.dispatchEvent(B),u.copy(p.object.position),d.copy(p.object.quaternion),w=!1))}),i.dispose=function(){p.domElement.removeEventListener("contextmenu",le),p.domElement.removeEventListener("pointerdown",re),p.domElement.removeEventListener("pointercancel",ie),p.domElement.removeEventListener("wheel",se),p.domElement.removeEventListener("pointermove",ne),p.domElement.removeEventListener("pointerup",ae),null!==p._domElementKeyEvents&&p._domElementKeyEvents.removeEventListener("keydown",oe)};var i,o,l,c,u,d,h,p=R(i),m={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},f=m.NONE,g=1e-6,v=new s.Spherical,b=new s.Spherical,y=1,x=new s.Vector3,w=!1,S=new s.Vector2,M=new s.Vector2,T=new s.Vector2,_=new s.Vector2,E=new s.Vector2,D=new s.Vector2,O=new s.Vector2,k=new s.Vector2,P=new s.Vector2,A=[],C={};function L(){return Math.pow(.95,p.zoomSpeed)}function I(e){b.theta-=e}function N(e){b.phi-=e}z=new s.Vector3;var z,F,V,G=function(e,t){z.setFromMatrixColumn(t,0),z.multiplyScalar(-e),x.add(z)},H=(F=new s.Vector3,function(e,t){!0===p.screenSpacePanning?F.setFromMatrixColumn(t,1):(F.setFromMatrixColumn(t,0),F.crossVectors(p.object.up,F)),F.multiplyScalar(e),x.add(F)}),Z=(V=new s.Vector3,function(e,t){var r,n=p.domElement;p.object.isPerspectiveCamera?(r=p.object.position,V.copy(r).sub(p.target),r=V.length(),r*=Math.tan(p.object.fov/2*Math.PI/180),G(2*e*r/n.clientHeight,p.object.matrix),H(2*t*r/n.clientHeight,p.object.matrix)):p.object.isOrthographicCamera?(G(e*(p.object.right-p.object.left)/p.object.zoom/n.clientWidth,p.object.matrix),H(t*(p.object.top-p.object.bottom)/p.object.zoom/n.clientHeight,p.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),p.enablePan=!1)});function W(e){p.object.isPerspectiveCamera?y/=e:p.object.isOrthographicCamera?(p.object.zoom=Math.max(p.minZoom,Math.min(p.maxZoom,p.object.zoom*e)),p.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),p.enableZoom=!1)}function K(e){p.object.isPerspectiveCamera?y*=e:p.object.isOrthographicCamera?(p.object.zoom=Math.max(p.minZoom,Math.min(p.maxZoom,p.object.zoom/e)),p.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),p.enableZoom=!1)}function q(e){S.set(e.clientX,e.clientY)}function X(e){_.set(e.clientX,e.clientY)}function Y(){var e,t;1===A.length?S.set(A[0].pageX,A[0].pageY):(e=.5*(A[0].pageX+A[1].pageX),t=.5*(A[0].pageY+A[1].pageY),S.set(e,t))}function Q(){var e,t;1===A.length?_.set(A[0].pageX,A[0].pageY):(e=.5*(A[0].pageX+A[1].pageX),t=.5*(A[0].pageY+A[1].pageY),_.set(e,t))}function J(){var e=A[0].pageX-A[1].pageX,t=A[0].pageY-A[1].pageY;e=Math.sqrt(e*e+t*t),O.set(0,e)}function $(e){1==A.length?M.set(e.pageX,e.pageY):(r=de(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),M.set(t,e)),T.subVectors(M,S).multiplyScalar(p.rotateSpeed);var t,r=p.domElement;I(2*Math.PI*T.x/r.clientHeight),N(2*Math.PI*T.y/r.clientHeight),S.copy(M)}function ee(e){var t,r;1===A.length?E.set(e.pageX,e.pageY):(t=de(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),E.set(r,e)),D.subVectors(E,_).multiplyScalar(p.panSpeed),Z(D.x,D.y),_.copy(E)}function te(e){var t=de(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),k.set(0,t),P.set(0,Math.pow(k.y/O.y,p.zoomSpeed)),W(P.y),O.copy(k)}function re(e){if(!1!==p.enabled)if(0===A.length&&(p.domElement.setPointerCapture(e.pointerId),p.domElement.addEventListener("pointermove",ne),p.domElement.addEventListener("pointerup",ae)),A.push(e),"touch"===e.pointerType){switch(ue(e),A.length){case 1:switch(p.touches.ONE){case s.TOUCH.ROTATE:if(!1===p.enableRotate)return;Y(),f=m.TOUCH_ROTATE;break;case s.TOUCH.PAN:if(!1===p.enablePan)return;Q(),f=m.TOUCH_PAN;break;default:f=m.NONE}break;case 2:switch(p.touches.TWO){case s.TOUCH.DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;p.enableZoom&&J(),p.enablePan&&Q(),f=m.TOUCH_DOLLY_PAN;break;case s.TOUCH.DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;p.enableZoom&&J(),p.enableRotate&&Y(),f=m.TOUCH_DOLLY_ROTATE;break;default:f=m.NONE}break;default:f=m.NONE}f!==m.NONE&&p.dispatchEvent(j)}else{var t,r=e;switch(r.button){case 0:t=p.mouseButtons.LEFT;break;case 1:t=p.mouseButtons.MIDDLE;break;case 2:t=p.mouseButtons.RIGHT;break;default:t=-1}switch(t){case s.MOUSE.DOLLY:if(!1===p.enableZoom)return;!function(e){O.set(e.clientX,e.clientY)}(r),f=m.DOLLY;break;case s.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enablePan)return;X(r),f=m.PAN}else{if(!1===p.enableRotate)return;q(r),f=m.ROTATE}break;case s.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===p.enableRotate)return;q(r),f=m.ROTATE}else{if(!1===p.enablePan)return;X(r),f=m.PAN}break;default:f=m.NONE}f!==m.NONE&&p.dispatchEvent(j)}}function ne(e){if(!1!==p.enabled)if("touch"===e.pointerType){var t=e;switch(ue(t),f){case m.TOUCH_ROTATE:if(!1===p.enableRotate)return;$(t),p.update();break;case m.TOUCH_PAN:if(!1===p.enablePan)return;ee(t),p.update();break;case m.TOUCH_DOLLY_PAN:if(!1===p.enableZoom&&!1===p.enablePan)return;!function(e){p.enableZoom&&te(e),p.enablePan&&ee(e)}(t),p.update();break;case m.TOUCH_DOLLY_ROTATE:if(!1===p.enableZoom&&!1===p.enableRotate)return;!function(e){p.enableZoom&&te(e),p.enableRotate&&$(e)}(t),p.update();break;default:f=m.NONE}}else{var r=e;switch(f){case m.ROTATE:if(!1===p.enableRotate)return;!function(e){M.set(e.clientX,e.clientY),T.subVectors(M,S).multiplyScalar(p.rotateSpeed),e=p.domElement,I(2*Math.PI*T.x/e.clientHeight),N(2*Math.PI*T.y/e.clientHeight),S.copy(M),p.update()}(r);break;case m.DOLLY:if(!1===p.enableZoom)return;!function(e){k.set(e.clientX,e.clientY),P.subVectors(k,O),0<P.y?W(L()):P.y<0&&K(L()),O.copy(k),p.update()}(r);break;case m.PAN:if(!1===p.enablePan)return;!function(e){E.set(e.clientX,e.clientY),D.subVectors(E,_).multiplyScalar(p.panSpeed),Z(D.x,D.y),_.copy(E),p.update()}(r)}}}function ae(e){ce(e),0===A.length&&(p.domElement.releasePointerCapture(e.pointerId),p.domElement.removeEventListener("pointermove",ne),p.domElement.removeEventListener("pointerup",ae)),p.dispatchEvent(U),f=m.NONE}function ie(e){ce(e)}function se(e){var t;!1!==p.enabled&&!1!==p.enableZoom&&f===m.NONE&&(e.preventDefault(),p.dispatchEvent(j),e.deltaY<0?K(L()):0<e.deltaY&&W(L()),null!=p&&null!=(t=p.myOptions)&&t.onWheel(e),p.update(),p.dispatchEvent(U))}function oe(e){if(!1!==p.enabled&&!1!==p.enablePan){var t=e,r=!1;switch(t.code){case p.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?N(2*Math.PI*p.rotateSpeed/p.domElement.clientHeight):Z(0,p.keyPanSpeed),r=!0;break;case p.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?N(-2*Math.PI*p.rotateSpeed/p.domElement.clientHeight):Z(0,-p.keyPanSpeed),r=!0;break;case p.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?I(2*Math.PI*p.rotateSpeed/p.domElement.clientHeight):Z(p.keyPanSpeed,0),r=!0;break;case p.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?I(-2*Math.PI*p.rotateSpeed/p.domElement.clientHeight):Z(-p.keyPanSpeed,0),r=!0}r&&(t.preventDefault(),p.update())}}function le(e){!1!==p.enabled&&e.preventDefault()}function ce(e){delete C[e.pointerId];for(var t=0;t<A.length;t++)if(A[t].pointerId==e.pointerId)return void A.splice(t,1)}function ue(e){var t=C[e.pointerId];void 0===t&&(t=new s.Vector2,C[e.pointerId]=t),t.set(e.pageX,e.pageY)}function de(e){return e=e.pointerId===A[0].pointerId?A[1]:A[0],C[e.pointerId]}return p.domElement.addEventListener("contextmenu",le),p.domElement.addEventListener("pointerdown",re),p.domElement.addEventListener("pointercancel",ie),p.domElement.addEventListener("wheel",se,{passive:!1}),i.update(),i}return function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}(),z=r(3263),F=r(3736);const V={autoRotate:!1,autoRotateSpeed:2,dampingFactor:.05,enableDamping:!1,enablePan:!0,enableRotate:!0,enableZoom:!0,maxAzimuthAngle:1/0,maxDistance:1/0,maxPolarAngle:Math.PI,minAzimuthAngle:-1/0,minDistance:0,minPolarAngle:0,panSpeed:1,rotateSpeed:1,screenSpacePanning:!0,zoomSpeed:1,target:{x:0,y:0,z:0}};class G{constructor(e){this.inited=()=>{const e=this.runScene.assetsEx.get().controls;e.addEventListener("change",this.change),e.addEventListener("start",(()=>{this.runScene.cb.controls.autoRotate.pause.cb(0),this.isStart=!0})),e.addEventListener("end",(()=>{this.isStart=!1,this.onEnd()})),this.runScene.exporter.gltf.options.addOption({type:"controls",process:()=>{const t=(0,u.getDiff)(V,e);return t.autoDelay=this.getAutoDelay(),JSON.stringify(t)},parse:e=>{e&&this.parse(JSON.parse(e))}})},this.onWheel=e=>{},this.change=e=>{this.runScene.cb.controls.change.cb(e)},this.parse=e=>{const t=this.runScene.assetsEx.get().controls;(0,i.mapObj)(e,((e,r)=>{"autoDelay"===e?this.setAutoDelay(r):void 0!==r&&(z.YD.is(r)?t[e].set(r.x,r.y,r.z):t[e]=r)})),t.update()},this.isStart=!1,this.autoDelay=0,this._autoDelayCallbackTimer=null,this.onEnd=()=>{0!==this.autoDelay&&(this.runScene.assetsEx.get().controls.autoRotate=!1,this._autoDelayCallback())},(this.runScene=e).cb.inited.add("controls",this.inited)}reset(){this.parse(V)}create(e,t){return new N(e,t,{onWheel:this.onWheel})}static toJSON(e){return e.target}static setTarget(e,t,r){var{x:n,y:a,z:i}=t,{x:r,y:s,z:o}=r||e.target;this.setTargetData.anima&&(this.setTargetData.anima.kill(),this.setTargetData.anima=null,this.setTarget(e,t,this.setTargetData.nowData)),this.setTargetData.anima=(0,u.anima)({x:r,y:s,z:o},{x:n,y:a,z:i},.5,(t=>{var{x:r,y:n,z:a}=t;e.target.set(r,n,a),e.update(),this.setTargetData.nowData=t}),(()=>{this.setTargetData.anima=null}))}clearAutoDelay(){delete this.runScene.assetsEx.get().camera.userData.autoDelay,this.autoDelay=0,this.clearAutoDelayCallback()}setAutoDelay(e){var t;0===e?this.clearAutoDelay():(this.onEnd(),t=this.runScene.assetsEx.get().camera,(0,F.M)(t,"autoDelay",e),this.autoDelay=e,this._autoDelayCallback())}setAutoRotate(e){(this.runScene.assetsEx.get().controls.autoRotate=e)||this.clearAutoDelay()}clearAutoDelayCallback(){clearTimeout(this._autoDelayCallbackTimer)}_autoDelayCallback(){this._autoDelayCallbackTimer&&this.clearAutoDelayCallback(),this._autoDelayCallbackTimer=setTimeout((()=>{if(this.isStart)return this._autoDelayCallback();this.runScene.cb.controls.autoRotate.resume.cb(0),this.setAutoRotate(!0)}),1e3*this.autoDelay)}closeAutoRotate(){this.setAutoRotate(!1),this.autoDelay=0}getAutoDelay(){var e=this.runScene.assetsEx.get().camera;return(0,F.is)(e,"autoDelay")||0}}G.setTargetData={anima:null,nowData:null};class H{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new p.Z,this.specialKeyDebounce=()=>{this.ctrl=!1,this.shift=!1,this.alt=!1},this.fns={down:{s:e=>{this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene())},d:e=>{this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel())},alt:()=>{this.alt=!0},control:()=>{this.ctrl=!0},ctrl:()=>{this.ctrl=!0},shift:()=>{this.shift=!0},f11:()=>{this.events.runScene.cb.resize.cb(this.events.runScene.renderEx.getDomSize())},w:()=>{this.events.runScene.helperEx.transContro.changeMode("position")},e:()=>{this.events.runScene.helperEx.transContro.changeMode("rotation")},f:()=>{this.allFn.f_focusModel()},delete:()=>{this.events.runScene.helperEx.unfocus();var e=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||e),e&&this.events.runScene.multipSelector.delete()},z:e=>{this.ctrl&&this.allFn.z_undo(e)},y:e=>{this.ctrl&&this.allFn.y_redo(e)},r:()=>{this.events.runScene.helperEx.transContro.changeMode("scale")}},up:{s:()=>{this.ctrl},alt:()=>{this.alt=!1},control:()=>{this.ctrl=!1},ctrl:()=>{this.ctrl=!1},shift:()=>{this.shift=!1}}},this.allFn={s_saveScene:()=>function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.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.getSelectedModels()[0];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&&(this.events.addEvent({dom:document,name:"keydown",fn:this.keyDown.bind(this)}),this.events.addEvent({dom:document,name:"keyup",fn:this.keyUp.bind(this)}),this.events.runScene.cb.model.setSelect.add("reset-unexec",(()=>{this.unExec.delete("delete")})),this.events.addEvent({dom:window,name:"blur",fn:this.specialKeyDebounce}))}keyDown(e){var t,r;"INPUT"!==document.activeElement.nodeName&&(r=e.key.toLowerCase(),this.events.runScene.cb.events.key.down.cb({key:r,event:e}),this.unExec.get(r)||null!=(r=(t=this.fns.down)[r])&&r.call(t,e))}keyUp(e){var t,r;"INPUT"!==document.activeElement.nodeName&&(r=e.key.toLowerCase(),this.events.runScene.cb.events.key.up.cb({key:r,event:e}),null!=(r=(t=this.fns.up)[r])&&r.call(t,e))}}var Z=r(272),W=r(2233);class K{constructor(e){this.options=new p.Z,this.enable=!0,this.lockData=new p.Z,this.foucedModel=new Z.Z,this.addOptions=e=>{var{name:e,map:t}=e;this.options.set(e,t)},this.hoverModel=new Z.Z,this.map={click:new p.Z,hover:new p.Z,mouseLeave:new p.Z},this.onClick=e=>{var t,r;this.enable&&(t=(0,W.Ki)(e))&&(r=this.map.click.get(t))&&this.triggerEvent({model:e,method:"click",saved:r,id:t})},this.onHover=e=>{var t,r=(0,W.Ki)(e);r&&(t=this.map.hover.get(r))&&!this.foucedModel.has(r)&&(this.events.runScene.optionsEx.log([e,"移入"],"detail"),this.triggerEvent({model:e,saved:t,method:"hover",id:r}),this.onFouce(r))},this.onMouseLeave=()=>{this.events.runScene.modelEx.getById(this.foucedModel.toArray()).map((e=>{this.onMouseLeaveByModel(e)}))},this.events=e}setState(e){this.enable=e}copy(e){this.copyData=e}paste(e){this.copyData&&e.map((e=>{var{method:t,child:r,type:n}=this.copyData;this.set({model:e,type:n,method:t,child:r})}))}init(){this.events.runScene.cb.model.click.add("event-model",this.onClick),this.events.runScene.cb.events.model.addOptions.add("event-model",this.addOptions),this.events.runScene.cb.unique.model.add.add("event-model",(({model:e})=>{var t;null!=(t=e.userData.events)&&t.map((t=>{var[t,r,n]=t.split("-");this.set({model:e,method:t,child:n,type:r})}))})),this.events.runScene.cb.events.pointer.move.add("get-hover-from-models",(0,i.fnDebounce)((e=>{if(0!==this.hoverModel.size&&this.enable){const n=new s.Raycaster;var{camera:t,renderer:r}=this.events.runScene.assetsEx.get(),{x:r,y:e}=this.events.mouse.getEventLocal(r.domElement,e),r=new s.Vector2(r,e);n.setFromCamera(r,t);const a=n.intersectObjects(this.hoverModel.toArray(),!0);0===a.length?this.onMouseLeave():(e=a.map((e=>e.object)).filter((e=>e.visible)),this.onHover(e[0]))}}),10)),this.events.runScene.cb.snapshot.setName.add("event-model",(({oldName:e,name:t})=>{(0,i.mapObj)(this.map,((r,n)=>{n.map(((n,a)=>{const i=a.get("snapshot");(a=this.events.runScene.modelEx.getById(n))&&i&&i.has(e)&&(this.del({model:a,type:"snapshot",child:e,method:r}),this.set({model:a,type:"snapshot",child:t,method:r}))}))}))}))}del(e){const{model:t,type:r,child:n,method:a}=e;var i=(0,W.Ki)(t);if(i){let s=this.map[a].get(i);if(s){let i=s.get(r);i&&("hover"===a&&this.hoverModel.delete(this.hoverModel.find((e=>(0,W.Ki)(e)===(0,W.Ki)(t)))),i.remove(n),this.bindDataForModel(e,!1))}}}delAll(e){const{model:t,type:r,name:n}=e,a=(0,W.Ki)(t);if(a){const e=[];(0,i.mapObj)(this.map,((i,s)=>{s.map(((s,o)=>{if(s===a){const a=o.get(r);null!=a&&a.has(n)&&(a.delete(n),e.push({model:t,type:r,method:i,child:n}))}}))})),e.map((e=>this.bindDataForModel(e,!1)))}}set(e){const{model:t,type:r,child:n,method:a}=e;var i=(0,W.Ki)(t);if(i){let s=this.map[a],o=s.get(i),l=(o||(o=new p.Z,s.set(i,o)),o.get(r));l||(l=new Z.Z,o.set(r,l)),"hover"!==a||this.hoverModel.find((e=>(0,W.Ki)(e)===(0,W.Ki)(t)))||this.hoverModel.add(t),l.add(n),this.bindDataForModel(e)}}bindDataForModel(e,t=!0){const{model:r,type:n,child:a,method:i}=e;let s=r.userData.events;s||(r.userData.events=s=[]);const o=i+"-"+n+"-"+a;-1===(e=s.findIndex((e=>e===o)))?t&&s.push(o):t||s.splice(e,1)}hasEvent(e){const{model:t,method:r,type:n,child:a}=e,i=[r,n,a].join("-");return!!t.userData.events&&-1!==t.userData.events.findIndex((e=>e===i))}validCanBeTrigger(e,t){return null==(e=this.lockData.get(e))||!e.has(t)}triggerEvent(e){const{model:t,id:r,saved:n}=e;d.closeModelEvent.is(t)||n.map(((e,n)=>{if(!this.validCanBeTrigger(r,e))return this.events.runScene.optionsEx.log("该目标正在执行中","base"),void this.setLock({id:r,type:e,isAdd:!1});const a=this.options.get(e);a&&(this.setLock({id:r,type:e,isAdd:!0}),a.parse({model:t,childs:n.toArray()}).then((()=>{this.setLock({id:r,type:e,isAdd:!1})})))}))}getModelIdsByDta(e,t){const r=new Z.Z;return(0,i.mapObj)(this.map,((n,a)=>{a.map(((n,a)=>{const i=a.get(e);i&&i.has(t)&&r.add(n)}))})),r}hasLockByMethod(e){for(const t of Object.values(this.lockData.toArray("value")))if(t.has(e))return!0;return!1}setLock(e){var{id:e,type:t,isAdd:r}=e;let n=this.lockData.get(e);n||(n=new Z.Z,this.lockData.set(e,n)),r?n.add(t):n.delete(t)}onFouceAfter(){this.foucedModel.map((e=>{this.getLockStatus({id:e,methods:"hover"})||this.onMouseLeaveByModel(this.events.runScene.modelEx.getById(e))}))}onFouce(e){this.getLockStatus({id:e,methods:"hover"})||(this.onFouceAfter(),this.foucedModel.add(e))}getLockStatus(e){var{id:e,methods:t}=e;const r=this.lockData.get(e);return null==r?void 0:r.has(t)}onMouseLeaveByModel(e){var t,r;!e||(t=(0,W.Ki)(e))&&(this.foucedModel.delete(t),(r=this.map.mouseLeave.get(t))&&(this.events.runScene.optionsEx.log([e,"移出"],"detail"),this.triggerEvent({model:e,method:"mouseLeave",saved:r,id:t})))}}function q(e){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function X(){X=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var c={};function u(){}function d(){}function h(){}var p,m,f=(s(p={},n,(function(){return this})),(m=(m=Object.getPrototypeOf)&&m(m(w([]))))&&m!==t&&r.call(m,n)&&(p=m),h.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==q(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(f,"constructor",d.prototype=h),s(h,"constructor",d),d.displayName=s(h,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(f),s(f,i,"Generator"),s(f,n,(function(){return this})),s(f,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(y),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function Y(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function Q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function $(e,t,r){t&&J(e.prototype,t),r&&J(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var ee={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},te=function(){function e(){Q(this,e),this.pluginCallbacks=[],this.register((function(e){return new Te(e)})),this.register((function(e){return new _e(e)})),this.register((function(e){return new Oe(e)})),this.register((function(e){return new ke(e)})),this.register((function(e){return new Pe(e)})),this.register((function(e){return new Ae(e)})),this.register((function(e){return new Ee(e)})),this.register((function(e){return new De(e)})),this.register((function(e){return new Ce(e)})),this.register((function(e){return new Le(e)}))}return $(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){for(var a=new Me,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),re=5120,ne=5121,ae=5122,ie=5123,se=(n=9728,9729),oe=9984,le=9985,ce=9986,ue=9987,de=33071,he=33648,pe=10497,me="KHR_mesh_quantization",fe={},ge=(fe[s.NearestFilter]=n,fe[s.NearestMipmapNearestFilter]=oe,fe[s.NearestMipmapLinearFilter]=ce,fe[s.LinearFilter]=se,fe[s.LinearMipmapNearestFilter]=le,fe[s.LinearMipmapLinearFilter]=ue,fe[s.ClampToEdgeWrapping]=de,fe[s.RepeatWrapping]=pe,fe[s.MirroredRepeatWrapping]=he,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),ve=new s.Color;function be(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function ye(e){return 4*Math.ceil(e/4)}function xe(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=ye(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function we(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function Se(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var Me=function(){function e(){Q(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return $(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=X().mark((function e(t,r){var n,a,i,s,o,l,c,u,d,h=arguments;return X().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<h.length&&void 0!==h[2]?h[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:return i=(a=this).buffers,s=a.json,n=a.options,e.next=12,a.options.myOptions.helper.done(s);case 12:l=a.extensionsUsed,c=a.extensionsRequired,o=new Blob(i,{type:"application/octet-stream"}),l=Object.keys(l),c=Object.keys(c),0<l.length&&(s.extensionsUsed=l),0<c.length&&(s.extensionsRequired=c),s.buffers&&0<s.buffers.length&&(s.buffers[0].byteLength=o.size),!0===n.binary?((u=new FileReader).readAsArrayBuffer(o),u.onloadend=function(){var e=xe(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),xe((n=JSON.stringify(s),(new TextEncoder).encode(n).buffer),32)),a=new DataView(new ArrayBuffer(8)),i=(a.setUint32(0,n.byteLength,!0),a.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((l=new DataView(i)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+a.byteLength+n.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,o,!0),new Blob([i,a,n,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){r(c.result)}}):s.buffers&&0<s.buffers.length?((d=new FileReader).readAsDataURL(o),d.onloadend=function(){var e=d.result;s.buffers[0].uri=e,r(s)}):r(s);case 21:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){Y(i,n,a,s,o,"next",e)}function o(e){Y(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=we(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var d=r(e),h=c.getImageData(0,0,i,o).data,p=2;p<h.length;p+=4)u.data[p]=256*d(h[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var m=r(t),f=c.getImageData(0,0,i,o).data,g=1;g<f.length;g+=4)u.data[g]=256*m(f[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case re:case ne:i=1;break;case ae:case ie:i=2;break;default:i=4}for(var l=ye(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,d=r;d<r+n;d++)for(var h=0;h<e.itemSize;h++){var p=void 0;4<e.itemSize?p=e.array[d*e.itemSize+h]:(0===h?p=e.getX(d):1===h?p=e.getY(d):2===h?p=e.getZ(d):3===h&&(p=e.getW(d)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===ae?c.setInt16(u,p,!0):t===ie?c.setUint16(u,p,!0):t===re?c.setInt8(u,p):t===ne&&c.setUint8(u,p),u+=i}var m={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(m.target=a),34962===a&&(m.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(m),{id:o.bufferViews.length-1,byteLength:0,size:c.byteLength}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=xe(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n,a,i){var o=this.json;if(e.array.constructor===Float32Array)u=5126;else if(e.array.constructor===Int32Array)u=5124;else if(e.array.constructor===Uint32Array)u=5125;else if(e.array.constructor===Int16Array)u=ae;else if(e.array.constructor===Uint16Array)u=ie;else if(e.array.constructor===Int8Array)u=re;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");u=ne}if(0===(n=void 0===n?e.count:n))return null;var l,c=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n),u=(r={bufferView:(void 0!==t&&(l=e===t.index?34963:34962),t=this.processBufferView(e,u,r,n,l)).id,byteOffset:t.byteOffset,componentType:u,count:n,max:c.max,min:c.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},null==a||null==(l=a.userData)?void 0:l.id);return u&&this.options.myOptions.helper.processGeometry({size:t.size,name:a.name,id:u,type:i}),!0===e.normalized&&(r.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r,n){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var i=this,o=i.cache,l=i.json,c=i.options,u=i.pending;if(void 0!==(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e))[r=a+":flipY/"+r.toString()])return o[r];l.images||(l.images=[]);var d={mimeType:a},h=we(),p=(h.width=Math.min(e.width,c.maxTextureSize),h.height=Math.min(e.height,c.maxTextureSize),h.getContext("2d"));if(void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var m=new Uint8ClampedArray(e.height*e.width*4),f=0;f<m.length;f+=4)m[f+0]=e.data[f+0],m[f+1]=e.data[f+1],m[f+2]=e.data[f+2],m[f+3]=e.data[f+3];p.putImageData(new ImageData(m,e.width,e.height),0,0)}else p.drawImage(e,0,0,h.width,h.height);return!0===c.binary?(null==n||null==(t=n.userData)?void 0:t.blob)instanceof Blob?u.push(new Promise((function(e){i.processBufferViewImage(n.userData.blob).then((function(t){d.bufferView=t,e()}))}))):u.push(Se(h,a).then((function(e){return i.processBufferViewImage(e)})).then((function(e){d.bufferView=e}))):void 0!==h.toDataURL?d.uri=h.toDataURL(a):u.push(Se(h,a).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){d.uri=e}))),p=l.images.push(d)-1,o[r]=p}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:fe[e.magFilter],minFilter:fe[e.minFilter],wrapS:fe[e.wrapS],wrapT:fe[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]),e.userData||(e.userData={});var n=("image/webp"===(a=(null==(a=e.userData)?void 0:a.mimeType)||"image/png")&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e,a)}),a=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,a),this.options.myOptions.helper.parseTexture({texture:e,textureDef:n}),a}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}},a=(this.options.myOptions.helper.parseMaterial({material:e,materialDef:n,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(be(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,d=e.geometry,h=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},m={},f=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=d.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),d.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in d.attributes)"morph"!==c.slice(0,5)&&(l=d.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?m[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,d,void 0,void 0,e,c))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),m[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&d.setAttribute("normal",b),0===Object.keys(m).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},D=!1;for(_ in d.morphAttributes)if("position"!==_&&"normal"!==_)D||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),D=!0);else{var O=d.morphAttributes[_][T],k=_.toUpperCase(),P=d.attributes[_];if(t.attributes.has(this.getUID(O,!0)))E[k]=t.attributes.get(this.getUID(O,!0));else{var A=O.clone();if(!d.morphTargetsRelative)for(var C=0,L=O.count;C<L;C++)for(var R=0;R<O.itemSize;R++)0===R&&A.setX(C,O.getX(C)-P.getX(C)),1===R&&A.setY(C,O.getY(C)-P.getY(C)),2===R&&A.setZ(C,O.getZ(C)-P.getZ(C)),3===R&&A.setW(C,O.getW(C)-P.getW(C));E[k]=this.processAccessor(A,d),t.attributes.set(this.getUID(P,!0),E[k])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===d.groups.length)return null;for(var I=b?e.material:[e.material],B=b?d.groups:[{materialIndex:0,start:void 0,count:void 0}],j=0,U=B.length;j<U;j++){var N={mode:h,attributes:m},z=(this.serializeUserData(d,N),0<g.length&&(N.targets=g),null!==d.index&&(z=this.getUID(d.index),void 0===B[j].start&&void 0===B[j].count||(z+=":"+B[j].start+":"+B[j].count),t.attributes.has(z)?N.indices=t.attributes.get(z):(N.indices=this.processAccessor(d.index,d,B[j].start,B[j].count),t.attributes.set(z,N.indices)),null===N.indices&&delete N.indices),this.processMaterial(I[B[j].materialIndex]));null!==z&&(N.material=z),f.push(N)}return p.primitives=f,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[me]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=ee[t])&&e.includes(r)&&(this.extensionsUsed[me]=!0,this.extensionsRequired[me]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=te.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),d=s.PropertyBinding.findNode(t,u.nodeName),h=ge[u.propertyName];if(!(d="bones"===u.objectName?!0===d.isSkinnedMesh?d.skeleton.getBoneByName(u.objectIndex):void 0:d)||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(h===ge.morphTargetInfluences&&(u/=d.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(d),path:h}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u){var d=a.bones[u];d=this.options.myOptions.helper.getNodeMapValueWithBone(d,r),o.push(d),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(e=a.myOptions.helper.parseNode({object:e,nodeDef:s,options:this}),a.trs?(r=e.quaternion.toArray(),d=e.position.toArray(),t=e.scale.toArray(),be(r,[0,0,0,1])||(s.rotation=r),be(d,[0,0,0])||(s.translation=d),be(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===be(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];u.userData.isTemp||!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var d=n.nodes.push(s)-1;return i.set(e,d),d}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];o.userData.isTemp||!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,r,n=this.options,a=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),i=0;i<e.length;i++)e[i]instanceof s.Scene?this.processScene(e[i]):a.push(e[i]);1===a.length?(t=a[0],"model"===n.myOptions.helper.type&&((r=new s.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<a.length&&this.processObjects(a);for(var o=0;o<this.skins.length;++o)this.processSkin(this.skins[o]);for(var l=0;l<n.animations.length;++l)this.processAnimation(n.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),Te=function(){function e(t){Q(this,e),this.writer=t,this.name="KHR_lights_punctual"}return $(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),_e=function(){function e(t){Q(this,e),this.writer=t,this.name="KHR_materials_unlit"}return $(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}(),Ee=function(){function e(t){Q(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return $(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),De=function(){function e(t){Q(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return $(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Oe=function(){function e(t){Q(this,e),this.writer=t,this.name="KHR_materials_transmission"}return $(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ke=function(){function e(t){Q(this,e),this.writer=t,this.name="KHR_materials_volume"}return $(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Pe=function(){function e(t){Q(this,e),this.writer=t,this.name="KHR_materials_ior"}return $(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),Ae=function(){function e(t){Q(this,e),this.writer=t,this.name="KHR_materials_specular"}return $(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(ve)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ce=function(){function e(t){Q(this,e),this.writer=t,this.name="KHR_materials_sheen"}return $(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Le=function(){function e(t){Q(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return $(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();function Re(e){return(Re="function"==typeof Symbol&&"symbol"==typeof 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 Ie(){Ie=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var c={};function u(){}function d(){}function h(){}var p,m,f=(s(p={},n,(function(){return this})),(m=(m=Object.getPrototypeOf)&&m(m(w([]))))&&m!==t&&r.call(m,n)&&(p=m),h.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==Re(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(f,"constructor",d.prototype=h),s(h,"constructor",d),d.displayName=s(h,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(f),s(f,i,"Generator"),s(f,n,(function(){return this})),s(f,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(y),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function Be(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function je(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ne(e,t,r){t&&Ue(e.prototype,t),r&&Ue(e,r),Object.defineProperty(e,"prototype",{writable:!1})}te.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,d=c.morphTargetDictionary[l.propertyIndex];if(void 0===d)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var h=void 0;if(void 0===n[c.uuid]){for(var p=new((h=o.clone()).ValueBufferType)(u*h.times.length),m=0;m<h.times.length;m++)p[m*u+d]=h.values[m];h.name=(l.nodeName||"")+".morphTargetInfluences",h.values=p,n[c.uuid]=h,r.push(h)}else{var f=o.createInterpolant(new o.ValueBufferType(1));h=n[c.uuid];for(var g=0;g<h.times.length;g++)h.values[g*u+d]=f.evaluate(h.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(h,o.times[v]);h.values[b*u+d]=o.values[v]}}}}return e.tracks=r,e}};var ze={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},Fe=function(){function e(){je(this,e),this.pluginCallbacks=[],this.register((function(e){return new rt(e)})),this.register((function(e){return new nt(e)})),this.register((function(e){return new st(e)})),this.register((function(e){return new ot(e)})),this.register((function(e){return new lt(e)})),this.register((function(e){return new ct(e)})),this.register((function(e){return new at(e)})),this.register((function(e){return new it(e)})),this.register((function(e){return new ut(e)})),this.register((function(e){return new dt(e)}))}return Ne(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){for(var a=new tt,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),Ve=5120,Ge=5121,He=5122,Ze=5123,We=(n=9728,oe=9729,ce=9984,se=9985,le=9986,ue=9987,de=33071,pe=33648,he=10497,"KHR_mesh_quantization"),Ke={},qe=(Ke[s.NearestFilter]=n,Ke[s.NearestMipmapNearestFilter]=ce,Ke[s.NearestMipmapLinearFilter]=le,Ke[s.LinearFilter]=oe,Ke[s.LinearMipmapNearestFilter]=se,Ke[s.LinearMipmapLinearFilter]=ue,Ke[s.ClampToEdgeWrapping]=de,Ke[s.RepeatWrapping]=he,Ke[s.MirroredRepeatWrapping]=pe,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),Xe=new s.Color;function Ye(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Qe(e){return 4*Math.ceil(e/4)}function Je(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Qe(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function $e(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function et(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var tt=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.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return Ne(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Ie().mark((function e(t,r){var n,a,i,s,o,l,c,u=arguments;return Ie().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<u.length&&void 0!==u[2]?u[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:i=(o=this).buffers,a=o.json,n=o.options,s=o.extensionsUsed,o=o.extensionsRequired,i=new Blob(i,{type:"application/octet-stream"}),s=Object.keys(s),o=Object.keys(o),0<s.length&&(a.extensionsUsed=s),0<o.length&&(a.extensionsRequired=o),a.buffers&&0<a.buffers.length&&(a.buffers[0].byteLength=i.size),!0===n.binary?((l=new FileReader).readAsArrayBuffer(i),l.onloadend=function(){var e=Je(l.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Je((n=JSON.stringify(a),(new TextEncoder).encode(n).buffer),32)),i=new DataView(new ArrayBuffer(8)),s=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((c=new DataView(s)).setUint32(0,1179937895,!0),c.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),c=(c.setUint32(8,o,!0),new Blob([s,i,n,t,e],{type:"application/octet-stream"})),u=new FileReader;u.readAsArrayBuffer(c),u.onloadend=function(){r(u.result)}}):a.buffers&&0<a.buffers.length?((c=new FileReader).readAsDataURL(i),c.onloadend=function(){var e=c.result;a.buffers[0].uri=e,r(a)}):r(a);case 19:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){Be(i,n,a,s,o,"next",e)}function o(e){Be(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=$e(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var d=r(e),h=c.getImageData(0,0,i,o).data,p=2;p<h.length;p+=4)u.data[p]=256*d(h[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var m=r(t),f=c.getImageData(0,0,i,o).data,g=1;g<f.length;g+=4)u.data[g]=256*m(f[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case Ve:case Ge:i=1;break;case He:case Ze:i=2;break;default:i=4}for(var l=Qe(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,d=r;d<r+n;d++)for(var h=0;h<e.itemSize;h++){var p=void 0;4<e.itemSize?p=e.array[d*e.itemSize+h]:(0===h?p=e.getX(d):1===h?p=e.getY(d):2===h?p=e.getZ(d):3===h&&(p=e.getW(d)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===He?c.setInt16(u,p,!0):t===Ze?c.setUint16(u,p,!0):t===Ve?c.setInt8(u,p):t===Ge&&c.setUint8(u,p),u+=i}var m={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(m.target=a),34962===a&&(m.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(m),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=Je(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var a,i=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=He;else if(e.array.constructor===Uint16Array)a=Ze;else if(e.array.constructor===Int8Array)a=Ve;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=Ge}if(0===(n=void 0===n?e.count:n))return null;var o,l=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n);return r={bufferView:(void 0!==t&&(o=e===t.index?34963:34962),t=this.processBufferView(e,a,r,n,o)).id,byteOffset:t.byteOffset,componentType:a,count:n,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(r.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var a=this,i=a.cache,o=a.json,l=a.options,c=a.pending,u=(i.images.has(e)||i.images.set(e,{}),i=i.images.get(e),n+":flipY/"+r.toString());if(void 0!==i[u])return i[u];o.images||(o.images=[]);var d={mimeType:n},h=$e(),p=(h.width=Math.min(e.width,l.maxTextureSize),h.height=Math.min(e.height,l.maxTextureSize),h.getContext("2d"));if(!0===r&&(p.translate(0,h.height),p.scale(1,-1)),void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var m=new Uint8ClampedArray(e.height*e.width*4),f=0;f<m.length;f+=4)m[f+0]=e.data[f+0],m[f+1]=e.data[f+1],m[f+2]=e.data[f+2],m[f+3]=e.data[f+3];p.putImageData(new ImageData(m,e.width,e.height),0,0)}else p.drawImage(e,0,0,h.width,h.height);return!0===l.binary?c.push(et(h,n).then((function(e){return a.processBufferViewImage(e)})).then((function(e){d.bufferView=e}))):void 0!==h.toDataURL?d.uri=h.toDataURL(n):c.push(et(h,n).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){d.uri=e}))),r=o.images.push(d)-1,i[u]=r}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Ke[e.magFilter],minFilter:Ke[e.minFilter],wrapS:Ke[e.wrapS],wrapT:Ke[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n=("image/webp"===(a=e.userData.mimeType)&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)}),a=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,a),a}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}},a=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(Ye(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,d=e.geometry,h=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},m={},f=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=d.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),d.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in d.attributes)"morph"!==c.slice(0,5)&&(l=d.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?m[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,d))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),m[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&d.setAttribute("normal",b),0===Object.keys(m).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},D=!1;for(_ in d.morphAttributes)if("position"!==_&&"normal"!==_)D||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),D=!0);else{var O=d.morphAttributes[_][T],k=_.toUpperCase(),P=d.attributes[_];if(t.attributes.has(this.getUID(O,!0)))E[k]=t.attributes.get(this.getUID(O,!0));else{var A=O.clone();if(!d.morphTargetsRelative)for(var C=0,L=O.count;C<L;C++)for(var R=0;R<O.itemSize;R++)0===R&&A.setX(C,O.getX(C)-P.getX(C)),1===R&&A.setY(C,O.getY(C)-P.getY(C)),2===R&&A.setZ(C,O.getZ(C)-P.getZ(C)),3===R&&A.setW(C,O.getW(C)-P.getW(C));E[k]=this.processAccessor(A,d),t.attributes.set(this.getUID(P,!0),E[k])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===d.groups.length)return null;for(var I=b?e.material:[e.material],B=b?d.groups:[{materialIndex:0,start:void 0,count:void 0}],j=0,U=B.length;j<U;j++){var N={mode:h,attributes:m},z=(this.serializeUserData(d,N),0<g.length&&(N.targets=g),null!==d.index&&(z=this.getUID(d.index),void 0===B[j].start&&void 0===B[j].count||(z+=":"+B[j].start+":"+B[j].count),t.attributes.has(z)?N.indices=t.attributes.get(z):(N.indices=this.processAccessor(d.index,d,B[j].start,B[j].count),t.attributes.set(z,N.indices)),null===N.indices&&delete N.indices),this.processMaterial(I[B[j].materialIndex]));null!==z&&(N.material=z),f.push(N)}return p.primitives=f,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[We]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=ze[t])&&e.includes(r)&&(this.extensionsUsed[We]=!0,this.extensionsRequired[We]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=Fe.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),d=s.PropertyBinding.findNode(t,u.nodeName),h=qe[u.propertyName];if(!(d="bones"===u.objectName?!0===d.isSkinnedMesh?d.skeleton.getBoneByName(u.objectIndex):void 0:d)||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(h===qe.morphTargetInfluences&&(u/=d.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(d),path:h}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u)o.push(r.get(a.bones[u])),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(a.trs?(r=e.quaternion.toArray(),d=e.position.toArray(),t=e.scale.toArray(),Ye(r,[0,0,0,1])||(s.rotation=r),Ye(d,[0,0,0])||(s.translation=d),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!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var d=n.nodes.push(s)-1;return i.set(e,d),d}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,r=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),n=0;n<e.length;n++)e[n]instanceof s.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),rt=function(){function e(t){je(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Ne(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),nt=function(){function e(t){je(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Ne(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}(),at=function(){function e(t){je(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Ne(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),it=function(){function e(t){je(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return Ne(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),st=function(){function e(t){je(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Ne(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ot=function(){function e(t){je(this,e),this.writer=t,this.name="KHR_materials_volume"}return Ne(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),lt=function(){function e(t){je(this,e),this.writer=t,this.name="KHR_materials_ior"}return Ne(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),ct=function(){function e(t){je(this,e),this.writer=t,this.name="KHR_materials_specular"}return Ne(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(Xe)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ut=function(){function e(t){je(this,e),this.writer=t,this.name="KHR_materials_sheen"}return Ne(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),dt=function(){function e(t){je(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return Ne(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();Fe.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,d=c.morphTargetDictionary[l.propertyIndex];if(void 0===d)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var h=void 0;if(void 0===n[c.uuid]){for(var p=new((h=o.clone()).ValueBufferType)(u*h.times.length),m=0;m<h.times.length;m++)p[m*u+d]=h.values[m];h.name=(l.nodeName||"")+".morphTargetInfluences",h.values=p,n[c.uuid]=h,r.push(h)}else{var f=o.createInterpolant(new o.ValueBufferType(1));h=n[c.uuid];for(var g=0;g<h.times.length;g++)h.values[g*u+d]=f.evaluate(h.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(h,o.times[v]);h.values[b*u+d]=o.values[v]}}}}return e.tracks=r,e}};class ht{constructor(e){this.map=new Z.Z,this.loadMap=new p.Z,this.exportMap=new p.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let r=this.loadMap.get(e);r||(r=new Z.Z,this.loadMap.set(e,r)),r.add(t)})),e.exportCallBacks.map(((e,t)=>{let r=this.exportMap.get(e);r||(r=new Z.Z,this.exportMap.set(e,r)),r.add(t)}))}loadCallback(e){const{type:t,json:r,data:n,config:a,core:i}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:r,data:n,config:a,core:i})))}}const pt={};(0,i.mapObj)({Group:"空组",Box:"立方体",Plane:"片",Sphere:"球",Sprite:"精灵图",Reflector:"反射",VerticesRain:"雨雪粒子",Water:"水",BasicMaterial:"基础材质",FakeInterior:"假室内",Fresnel:"菲涅尔",Physical:"物理材质",Matcap:"材质捕获",TreeLeaf:"树材质",MixTexture:"多层贴图材质",AmbientLight:"环境光",RectAreaLight:"矩形光",DirectionalLight:"平行光",HemisphereLight:"半球光",PointLight:"点光源",SpotLight:"聚光灯",GroundProjected:"地面投影",NoToneMapping:"无色调映射",LinearToneMapping:"线性色调映射",ReinhardToneMapping:"Reinhard色调映射",CineonToneMapping:"cineon色调映射",ACESFilmicToneMapping:"ACES电影色调映射",CustomToneMapping:"自定义色调映射",def:"默认色彩空间",srgb:"标准色彩空间",SpriteMaterial:"精灵材质",SkyBox:"天空球材质","2DDom":"2D文档模型","3DSprite":"3D精灵模型","3DDom":"3D文档模型",MyMeshPhongMaterial:"光亮材质",MeshPhongMaterial:"光亮材质",MeshLambertMaterial:"Lambert材质",MyMeshLambertMaterial:"Lambert材质",camera:"摄像机",light:"灯光",model:"模型",line:"线",sprite:"精灵图",lock:"锁定",dynamic:"动态",mesh:"模型",group:"组"},((e,t)=>{pt[t]=e}));var mt=r(4330),ft=r(135),gt=r(4342),vt=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class bt{constructor(e){this.materialMap={},this.textureMap={},this.savedMap={materialIds:new Z.Z},this.parseScenePeding=[],this.materialMapToJsonPending=[],this.geoDefMaterialMap=new p.Z;var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){return vt(this,void 0,void 0,(function*(){var t=this.createTextureGroup(e);this.helperModel=t,"scene"===this.type&&this.parseScene(t),this.parseModel(e),this.materialMapToJson(),yield Promise.all(this.parseScenePeding),this.setMultipMaterial(t,Object.keys(this.textureMap))}))}createTextureGroup(e){const t=new s.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseUnDelAbleTexture(){(0,i.mapObj)(this.runScene.uniqueEx.texture.map,((e,t)=>{t=t.texture,(0,T.isInvalidTexture)(t)||T.unDelAbleTexture.is(t)&&!this.mergeSame(t)&&this.parseTexture(t)}))}parseScene(e){this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e)),this.parseUnUserMaterial(),this.parseUnDelAbleTexture(),this.helper.ex.savedMap=this.savedMap}parseUnUserMaterial(){this.runScene.uniqueEx.material.getUnUsers().map((({material:e,id:t})=>{if(this.runScene.assetsEx.manager.isUsed("material",t)){const r=(0,d.createDefModel)("Box");r.material=e,this.helperModel.add(r),this.savedMap.materialIds.add(t)}}))}_getBaseEx(e){var t=this.runScene.sceneEx.get(),r=this.runScene.optionsEx.exporterOptions.outTime,n=this.runScene.sceneEx.envStrength;return{version:{core:"0.0.98",editor:"0.0.2"},base64:(0,y.Ni)(String(r)),camera:k.Z.toJSON(this.runScene),sceneEx:Object.assign(Object.assign({},F.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),envStrength: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 r={},n=(0,ft.createDefMaterial)(),a=[];var i=n.userData.id;const s=(0,d.createDefModel)("Box");if(s.material=n,e.add(s),r.materialId=i,(0,T.isTexture)(t.background)||(0,T.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:e,environment:i}=t;this.runScene.pp.setUpdate(!0),(0,T.isTexture)(e)&&(e.userData.notCompress=!0,a.push({type:"map",texture:e}),303===(n.map=e).mapping&&(r.backgroundMapping=303)),(0,T.isTexture)(i)&&(i.userData.notCompress=!0,a.push({type:"envMap",texture:i}),n.envMap=i)}return"editor"===this.runScene.optionsEx.options.mode&&this.runScene.cameraEx.backgroudData&&(e=(0,T.createDefTexture)(),t=this.runScene.cameraEx.backgroudData,(0,T.bindTextureBaseData)(e,this.runScene,t),a.push({type:"normalMap",texture:e})),this.materialMap[i]={normalMaterial:n,models:[],normal:{},textures:a},r}compressLocal(e){var{x:t,y:r,z:n}=e.position;0===t&&0===r&&0===n||(e.position.set(0,0,0),e.userData.local=t+","+r+","+n)}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{this._processModelMaterial(e),this._processModel(e)}))}_processModel(e){(0,d.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,F.M)(e,"animations",t));var t=this.runScene.modelEx.importAndExport.toNromal({type:gt.Z.getType(e),model:e,runScene:this.runScene});t!==e&&(e.parent.add(t),e.parent.remove(e)),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(t)}_processModelMaterial(e){if(e.material)if((0,ft.isMultiMaterial)(e.material)){const t=[];(0,ft.getMaterials)(e.material).map((e=>{const r=this.runScene.modelEx.create("Box");var n=(0,W.Ki)(e);const a=this.materialMap[n];a&&(a.normalMaterial&&(r.material=a.normalMaterial),a.models.push(r)),t.push(n);var{material:i,normal:s,textures:o}=this.runScene.materialEx.isBaseMaterial(e)||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(r):this.runScene.materialEx.toNromal(e);r.material=i,e.userData.id=n,this.materialMap[n]={oldMaterial:e,normalMaterial:i,models:[r],normal:s,textures:o},this.helperModel.add(r)})),e.material=this.runScene.materialEx.defMaterial,(0,ft.setMaterialIds)(e,t)}else{const n=this.materialMap[e.material.userData.id];if(n)return n.normalMaterial&&(e.material=n.normalMaterial),void n.models.push(e);var t=this.runScene.materialEx.isBaseMaterial(e.material),r=e.material;const{material:a,normal:i,textures:s}=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material);e.material=a,t=r.userData.id,a.userData.id=t,this.materialMap[t]={oldMaterial:r,normalMaterial:a,models:[e],normal:i,textures:s}}}materialMapToJson(){(0,i.mapObj)(this.materialMap,((e,t)=>{var{normalMaterial:t,textures:r,normal:n}=t,a=t.userData.id;this.helper.ex.materialMap[a]||(this.helper.ex.materialMap[a]={normal:n,textures:{}},this.mergeAndRemoveTexture(r,t,this.materialMapToJsonPending))})),this.parseScenePeding.push((0,i.eachTriggerArray)(this.materialMapToJsonPending))}mergeSame(e){return vt(this,void 0,void 0,(function*(){if(e.userData||(e.userData={}),(0,T.isClonedTexture)(e))e=this.parseCloneTexture(e);else if((0,T.isCubeTexture)(e)){var t=this.textureMap[e.userData.id];e=t?t.texture:yield this.parseCubeTexture(e)}else{const t=e.userData;for(const i in this.textureMap){var r=this.textureMap[i],{md5:n,texture:a}=r;if(t.md5===n&&e.mapping===a.mapping&&!(0,T.isClonedTexture)(r.texture))return{isSame:!0,texture:e}}}const i=e.userData;return this.textureMap[e.userData.id]=Object.assign(Object.assign({},i),{texture:e}),{isSame:!1,texture:e}}))}parseTexture(e){var t,{format:r,repeat:n,center:a,rotation:i,offset:s}=e;const o={format:r};3e3!==e.encoding&&(o.encoding=3001),this.runScene.modelEx.isNavieV2(n,1)||(({x:r,y:t}=n),o.repeat=r===t?r:n),this.runScene.modelEx.isNavieV2(a,0)||(({x:t,y:r}=a),o.center=t===r?t:a),this.runScene.modelEx.isNavieV2(s,0)||(({x:n,y:r}=s),o.offset=n===r?n:s),0!==i&&(o.rotation=i),e.flipY&&(o.flipY=1),this.helper.ex.textureMap[e.userData.id]=o}parseCubeTexture(e){return new Promise((t=>vt(this,void 0,void 0,(function*(){let r=new s.Texture(new Image(1,1));var n=Object.keys(e.userData.blobMap).map(((t,r)=>vt(this,void 0,void 0,(function*(){var n=e.userData.blobMap[t],a=e.source.data[r];a=yield(0,T.parseImageBitMapByBlob)(a);const o=new s.Texture(a);o.needsUpdate=!0,a=(0,i.getId)(),(0,T.setMimeForTexture)(o,n.type),o.userData={id:a,blob:n,mimeType:n.type},e.userData.cubeMap||(e.userData.cubeMap={}),e.userData.cubeMap[t]=a,this.textureMap[a]=Object.assign(Object.assign({},o.userData),{texture:o}),this.helper.ex.textureMap[o.userData.id]={isHelper:!0,format:o.format}}))));yield Promise.all(n),e.userData.lightProbe&&(e.userData.lightProbeIntensity=e.userData.lightProbe.intensity),r.userData=Object.assign({},e.userData),t(r)}))))}mergeAndRemoveTexture(e,t,r){return vt(this,void 0,void 0,(function*(){e.map((e=>{r.push((()=>vt(this,void 0,void 0,(function*(){if(!(0,T.isInvalidTexture)(e.texture)){var{type:r,texture:n}=e;this.runScene.uniqueEx.texture.add(n),t[r]=null;const a=(yield this.mergeSame(n)).texture;this.helper.ex.textureMap[a.userData.id]||this.parseTexture(a),"normalMap"!==r||a.userData.isNormalMap||(a.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[r]=a.userData.id}}))))}))}))}parseCloneTexture(e){const t=e.clone();t.userData=Object.assign({},e.userData);var{width:e,height:r}=e.image;const n=document.createElement("canvas");return n.width=e,n.height=r,t.source=new s.Source(n),t.userData.blob=new Blob([new ArrayBuffer(1)]),t}setMultipMaterial(e,t){const r=this.runScene.modelEx.create("Box"),n=(0,ft.createDefMaterial)();r.material=n,e.add(r);for(const e of mt.sG){if(!t.length)return;var a=t.pop();if(!a)return;n[e]=this.textureMap[a].texture}t.length&&this.setMultipMaterial(e,t)}getMaterialFromModel(e){return e&&e.geometry?(e=e.geometry.uuid,this.geoDefMaterialMap.get(e)||this.geoDefMaterialMap.set(e,(0,ft.createDefMaterial)()),{material:this.geoDefMaterialMap.get(e),normal:{},textures:[]}):{material:this.runScene.materialEx.defMaterial,normal:{},textures:[]}}}class yt{constructor(e){this.typeSize={},this.map={model:new p.Z,texture:new p.Z},this.allSize=0;var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}add(e){var{type:e,data:t,key:r,size:n}=e;const a=this.map[e].get(r);a?a.size+=n:(this.map[e].set(r,t),this.allSize+=n,this.typeSize[e]=(this.typeSize[e]||0)+n)}toJSON(){const{model:e,texture:t}=this.map,r=[],n={name:"模型",all:0,data:[]},a=(n.data=z.F6.filter(e.map(((e,{name:t,size:r})=>{if(n.all+=r,!(r<1024))return{name:t,size:r}}))).sort(((e,t)=>t.size-e.size)),{name:"贴图",all:0,data:[]});return a.data=z.F6.filter(t.map(((e,{id:t,url:r,size:n})=>{if(a.all+=n,!(n<1024))return{name:t,url:r,size:n}}))).sort(((e,t)=>t.size-e.size)),r.push(n,a),r}}class xt extends o{constructor(){super(...arguments),this.savedMap=new p.Z,this.clonedMap=new p.Z}getSameNode(e){return this.savedMap.find(((t,r)=>r.materialUuid===e.material.uuid&&r.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,r=(0,W.Ki)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,d.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,d.getClonedIdModel)(e),r=(0,W.Ki)(e);this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set});const n=this.clonedMap.get(t);n&&(n.ids.add(r),n.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,W.Ki)(e),n.newId=t),n.newId&&(n.newId!==r?(0,d.setClonedModel)(e,n.newId):(0,d.delClonedModel)(e)))}parseNode(e){(0,d.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class wt{constructor(){this.savedMap=new p.Z}getSameCount(e){return this.savedMap.filterData(((t,r)=>r.geometry.attributes.normal.count===e)).map((e=>e.val))}setSameNode(e,t){e.geometry=t}getSameGeo(e,t){var{normal:r,position:n,uv:a}=e.attributes;for(const e of t){var{normal:i,position:s,uv:o}=e.attributes;if(r.array.length===i.array.length&&n.array.length===s.array.length&&a.array.length===o.array.length&&(i=(0,y.F1)([...r.array],[...i.array],2e3<r.length?2e3:"fill"),s=(0,y.F1)([...n.array],[...s.array],2e3<n.length?2e3:"fill"),o=(0,y.F1)([...a.array],[...o.array],2e3<a.length?2e3:"fill"),i&&s&&o))return e}}parseNode(e){if(e&&e.geometry&&e.geometry.attributes&&e.geometry.attributes.normal&&e.geometry.attributes.position&&e.geometry.attributes.uv&&!this.savedMap.get(e.geometry.uuid)){var t=e.geometry,r=(r=t.attributes.normal).count;const a=this.getSameCount(r);if(a){var n=this.getSameGeo(t,a.map((e=>e.geometry)));if(n)return this.setSameNode(e,n)}this.savedMap.set(t.uuid,{count:r,geometry:t})}}}class St{constructor(e){this.optionsConfigs={},this.addOption=e=>{var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e},(this.runScene=e).cb.exporter.gltf.options.add.add("ExporterGltfOptions",this.addOption)}getParse(e){return this.optionsConfigs[e]}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:r,type:n}=t;return{type:n,data:r(e)}}))}}class Mt{constructor(e){this.helperModels=[],this.mergeSameGeo=new wt,this.pending=[];var{type:e,runScene:t,model:r,msg:n}=e,n=(this.runScene=t,this.type=e,this.bindClondId=new xt(t),this.ex={materialMap:{},textureMap:{},type:e,msg:n},{helper:this,type:e,runScene:t});this.before=new bt(n),this.size=new yt(n),this.pending.push(this.before.parse(r))}parseNode(e){let{object:t,nodeDef:r}=e;return this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,i.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{t[e]!==n&&(r[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,r.wireframe=!0),t}parseMaterial(e){const{material:t,materialDef:r}=e;r.id=t.userData.id,this.ex.materialMap[t.userData.id]||(this.ex.materialMap[t.userData.id]={normal:{},textures:{}}),this.ex.materialMap[t.userData.id].normal=Object.assign(Object.assign({},this.ex.materialMap[t.userData.id].normal),this.runScene.materialEx.getDefNromals(t))}parseTexture(e){let{texture:t,textureDef:r}=e;(0,T.mergeDefUserData)(t.userData,r);var{blob:e,url:n,id:a}=t.userData,{width:a,height:n}=(e&&this.size.add({type:"texture",key:a,data:{id:a,url:n,size:e.size},size:e.size}),(0,T.isClonedTexture)(t)&&(r.cloneSourceId=(0,T.getCloneIdFromTexture)(t)),(0,T.getSizeByTexture)(t));r.size={w:a,h:n}}processGeometry(e){this.size.add({type:"model",data:e,key:e.id,size:e.size})}getNodeMapValueWithBone(e,t){for(const r of t.keys())if(r.userData.id===e.userData.id)return t.get(r)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"]),this.runScene.cb.exporter.gltf.complete.cb({json:e}),this.runScene.cb.exporter.gltf.sizeMap.cb(this.size.toJSON())}}var Tt=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class _t extends o{constructor(e){super(e),this._gltf=new te,this._originGltf=new Fe,this.options=new St(e),this.module=new ht(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t,r){return Tt(this,void 0,void 0,(function*(){const n=new Mt({type:t,runScene:this.runScene,model:e,msg:r});return yield Promise.all(n.pending),new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),(e=>{console.log(e,"e")}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:n,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return Tt(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 Tt(this,void 0,void 0,(function*(){const r=z.F6.toArr(e||this.runScene.modelEx.getSelectedModels());if(0!==r.length){var n=(n=r[0]).name||n.type;const e=new s.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,i.downloadFile)(new Blob([a]),n+".glb"),a}}))}material(e){var t;return Tt(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,d.createDefModel)("Group");let t=r;(t=r instanceof Array?t:[r]).map((t=>{const r=(0,d.createDefModel)("Box");r.material=t,e.add(r)}));var r=r.name||"material",n=yield this.getArrayBuffer(e,"material");(0,i.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0,t="scene"){return Tt(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var r=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t);return e&&(0,i.downloadFile)(new Blob([r]),"scene.glb"),r}))}originModel(e){return Tt(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,i.downloadFile)(new Blob([r]),t+".glb"))}))}}var Et=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function")}var t,r;return t=e,(r=[{key:"parse",value:function(e){var t="",r=0,n=0,a=0,i=new s.Vector3,o=new s.Color,l=new s.Vector3,c=new s.Vector2,u=[];return e.traverse((function(e){if(!0===e.isMesh){var d=e,h=0,p=0,m=0,f=d.geometry,g=new s.Matrix3,v=f.getAttribute("position"),b=f.getAttribute("normal"),y=f.getAttribute("uv"),x=f.getIndex();if(t+="o "+d.name+"\n",d.material&&d.material.name&&(t+="usemtl "+d.material.name+"\n"),void 0!==v)for(var w=0,S=v.count;w<S;w++,h++)i.fromBufferAttribute(v,w),i.applyMatrix4(d.matrixWorld),t+="v "+i.x+" "+i.y+" "+i.z+"\n";if(void 0!==y)for(var M=0,T=y.count;M<T;M++,m++)c.fromBufferAttribute(y,M),t+="vt "+c.x+" "+c.y+"\n";if(void 0!==b){g.getNormalMatrix(d.matrixWorld);for(var _=0,E=b.count;_<E;_++,p++)l.fromBufferAttribute(b,_),l.applyMatrix3(g).normalize(),t+="vn "+l.x+" "+l.y+" "+l.z+"\n"}if(null!==x)for(var D=0,O=x.count;D<O;D+=3){for(var k=0;k<3;k++){var P=x.getX(D+k)+1;u[k]=r+P+(b||y?"/"+(y?n+P:"")+(b?"/"+(a+P):""):"")}t+="f "+u.join(" ")+"\n"}else for(var A=0,C=v.count;A<C;A+=3){for(var L=0;L<3;L++){var R=A+L+1;u[L]=r+R+(b||y?"/"+(y?n+R:"")+(b?"/"+(a+R):""):"")}t+="f "+u.join(" ")+"\n"}r+=h,n+=m,a+=p}if(!0===e.isLine){var I=e,B=0,j=(f=I.geometry,I.type),U=f.getAttribute("position");if(t+="o "+I.name+"\n",void 0!==U)for(var N=0,z=U.count;N<z;N++,B++)i.fromBufferAttribute(U,N),i.applyMatrix4(I.matrixWorld),t+="v "+i.x+" "+i.y+" "+i.z+"\n";if("Line"===j){t+="l ";for(var F=1,V=U.count;F<=V;F++)t+=r+F+" ";t+="\n"}if("LineSegments"===j)for(var G=1,H=G+1,Z=U.count;G<Z;H=(G+=2)+1)t+="l "+(r+G)+" "+(r+H)+"\n";r+=B}if(!0===e.isPoints){var W=e,K=0,q=(j=W.geometry).getAttribute("position"),X=j.getAttribute("color");if(t+="o "+W.name+"\n",void 0!==q){for(var Y=0,Q=q.count;Y<Q;Y++,K++)i.fromBufferAttribute(q,Y),i.applyMatrix4(W.matrixWorld),t+="v "+i.x+" "+i.y+" "+i.z,void 0!==X&&(o.fromBufferAttribute(X,Y).convertLinearToSRGB(),t+=" "+o.r+" "+o.g+" "+o.b),t+="\n";t+="p ";for(var J=1,$=q.count;J<=$;J++)t+=r+J+" ";t+="\n"}r+=K}})),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();class Dt extends o{static getIns(){return this.ins||(this.ins=new Et),this.ins}model(e){return Dt.getIns().parse(e)}}class Ot extends o{constructor(e){super(e),this.gltf=new _t(e),this.obj=new Dt(e)}json(e){(0,i.downloadFile)(new File([JSON.stringify(e)],e.type+".json"),e.type+".json")}}function kt(e){return(kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pt(e,t){return(Pt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function At(e){return(At=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ct=/^[og]\s*(.+)?/,Lt=/^mtllib /,Rt=/^usemtl /,It=/^usemap /,Bt=/\s+/,jt=new s.Vector3,Ut=new s.Vector3,Nt=new s.Vector3,zt=new s.Vector3,Ft=new s.Vector3,Vt=new s.Color;function Gt(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);return r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==r?r:this).smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var r=this.materials.length-1;0<=r;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone&&((e=r.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,r){var n=this.vertices,a=this.object.geometry.vertices;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var n=this.normals,a=this.object.geometry.normals;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,a=this.object.geometry.normals;jt.fromArray(n,e),Ut.fromArray(n,t),Nt.fromArray(n,r),Ft.subVectors(Nt,Ut),zt.subVectors(jt,Ut),Ft.cross(zt),Ft.normalize(),a.push(Ft.x,Ft.y,Ft.z),a.push(Ft.x,Ft.y,Ft.z),a.push(Ft.x,Ft.y,Ft.z)},addColor:function(e,t,r){var n=this.colors,a=this.object.geometry.colors;void 0!==n[e]&&a.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&a.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&a.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,a=this.object.geometry.uvs;a.push(n[e+0],n[e+1]),a.push(n[t+0],n[t+1]),a.push(n[r+0],n[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,n,a,i,s,o,l){var c=this.vertices.length;e=this.parseVertexIndex(e,c),t=this.parseVertexIndex(t,c),r=this.parseVertexIndex(r,c),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==s&&""!==s?(c=this.normals.length,e=this.parseNormalIndex(s,c),t=this.parseNormalIndex(o,c),r=this.parseNormalIndex(l,c),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(s=this.uvs.length,e=this.parseUVIndex(n,s),t=this.parseUVIndex(a,s),r=this.parseUVIndex(i,s),this.addUV(e,t,r),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++){var a=this.parseVertexIndex(e[r],t);this.addVertexPoint(a),this.addColor(a)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,a=0,i=e.length;a<i;a++)this.addVertexLine(this.parseVertexIndex(e[a],r));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],n))}};return e.startObject("",!1),e}var Ht=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pt(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=At(e);if(r=t?(r=At(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===kt(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"load",value:function(e,t,r,n){var a=this,i=new s.FileLoader(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(function(r){try{t(a.parse(r))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t=new Gt,r=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),n=[],a=0,i=r.length;a<i;a++){var o=r[a].trimStart();if(0!==o.length){var l,c=o.charAt(0);if("#"!==c)if("v"===c){var u=o.split(Bt);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),7<=u.length?(Vt.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6])).convertSRGBToLinear(),t.colors.push(Vt.r,Vt.g,Vt.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]))}}else if("f"===c){for(var d=o.slice(1).trim().split(Bt),h=[],p=0,m=d.length;p<m;p++){var f=d[p];0<f.length&&(f=f.split("/"),h.push(f))}for(var g=h[0],v=1,b=h.length-1;v<b;v++){var y=h[v],x=h[v+1];t.addFace(g[0],y[0],x[0],g[1],y[1],x[1],g[2],y[2],x[2])}}else if("l"===c){var w=o.substring(1).trim().split(" "),S=[],M=[];if(-1===o.indexOf("/"))S=w;else for(var T=0,_=w.length;T<_;T++){var E=w[T].split("/");""!==E[0]&&S.push(E[0]),""!==E[1]&&M.push(E[1])}t.addLineGeometry(S,M)}else"p"===c?(l=o.slice(1).trim().split(" "),t.addPointGeometry(l)):null!==(n=Ct.exec(o))?(l=(" "+n[0].slice(1).trim()).slice(1),t.startObject(l)):Rt.test(o)?t.object.startMaterial(o.substring(7).trim(),t.materialLibraries):Lt.test(o)?t.materialLibraries.push(o.substring(7).trim()):It.test(o)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===c?(1<(n=o.split(" ")).length?(c=n[1].trim().toLowerCase(),t.object.smooth="0"!==c&&"off"!==c):t.object.smooth=!0,(c=t.object.currentMaterial())&&(c.smooth=t.object.smooth)):"\0"!==o&&console.warn('THREE.OBJLoader: Unexpected line: "'+o+'"')}}t.finalize();var D,O=new s.Group;if(1==(O.materialLibraries=[].concat(t.materialLibraries),e=!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length)))for(var k=0,P=t.objects.length;k<P;k++){var A=t.objects[k],C=A.geometry,L=A.materials,R="Line"===C.type,I="Points"===C.type,B=!1;if(0!==C.vertices.length){for(var j=new s.BufferGeometry,U=(j.setAttribute("position",new s.Float32BufferAttribute(C.vertices,3)),0<C.normals.length&&j.setAttribute("normal",new s.Float32BufferAttribute(C.normals,3)),0<C.colors.length&&(B=!0,j.setAttribute("color",new s.Float32BufferAttribute(C.colors,3))),!0===C.hasUVIndices&&j.setAttribute("uv",new s.Float32BufferAttribute(C.uvs,2)),[]),N=0,z=L.length;N<z;N++){var F,V=L[N],G=V.name+"_"+V.smooth+"_"+B,H=t.materials[G];null!==this.materials&&(H=this.materials.create(V.name),!R||!H||H instanceof s.LineBasicMaterial?!I||!H||H instanceof s.PointsMaterial||(F=new s.PointsMaterial({size:10,sizeAttenuation:!1}),s.Material.prototype.copy.call(F,H),F.color.copy(H.color),F.map=H.map,H=F):(F=new s.LineBasicMaterial,s.Material.prototype.copy.call(F,H),F.color.copy(H.color),H=F)),void 0===H&&((H=R?new s.LineBasicMaterial:I?new s.PointsMaterial({size:1,sizeAttenuation:!1}):new s.MeshPhongMaterial).name=V.name,H.flatShading=!V.smooth,H.vertexColors=B,t.materials[G]=H),U.push(H)}if(C=void 0,1<U.length){for(var Z=0,W=L.length;Z<W;Z++){var K=L[Z];j.addGroup(K.groupStart,K.groupCount,Z)}C=new(R?s.LineSegments:I?s.Points:s.Mesh)(j,U)}else C=new(R?s.LineSegments:I?s.Points:s.Mesh)(j,U[0]);C.name=A.name,O.add(C)}}else 0<t.vertices.length&&(e=new s.PointsMaterial({size:1,sizeAttenuation:!1}),(D=new s.BufferGeometry).setAttribute("position",new s.Float32BufferAttribute(t.vertices,3)),0<t.colors.length&&void 0!==t.colors[0]&&(D.setAttribute("color",new s.Float32BufferAttribute(t.colors,3)),e.vertexColors=!0),D=new s.Points(D,e),O.add(D));return O}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Loader);n=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(n(""))}catch(r){n=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}for(var Zt=Uint8Array,Wt=Uint16Array,Kt=Uint32Array,qt=new Zt([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]),Xt=new Zt([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]),Yt=new Zt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qt=(ce=function(e,t){for(var r=new Wt(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var a=new Kt(r[30]);for(n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return[r,a]},(le=ce(qt,2))[0]),Jt=(oe=le[1],(Qt[28]=258,oe[258]=28,se=ce(Xt,0))[0]),$t=(se[1],new Wt(32768)),er=0;er<32768;++er){var tr=(43690&er)>>>1|(21845&er)<<1;$t[er]=((65280&(tr=(61680&(tr=(52428&tr)>>>2|(13107&tr)<<2))>>>4|(3855&tr)<<4))>>>8|(255&tr)<<8)>>>1}var rr=function(e,t,r){for(var n=e.length,a=0,i=new Wt(t);a<n;++a)++i[e[a]-1];var s=new Wt(t);for(a=0;a<t;++a)s[a]=s[a-1]+i[a-1]<<1;if(r){var o=new Wt(1<<t),l=15-t;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],d=s[e[a]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)o[$t[d]>>>l]=c}else for(o=new Wt(n),a=0;a<n;++a)e[a]&&(o[a]=$t[s[e[a]-1]++]>>>15-e[a]);return o},nr=new Zt(288);for(er=0;er<144;++er)nr[er]=8;for(er=144;er<256;++er)nr[er]=9;for(er=256;er<280;++er)nr[er]=7;for(er=280;er<288;++er)nr[er]=8;var ar=new Zt(32);for(er=0;er<32;++er)ar[er]=5;var ir=rr(nr,9,1),sr=rr(ar,5,1),or=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},lr=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},cr=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},ur=function(e){return(e/8|0)+(7&e&&1)},dr=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof Wt?Wt:e instanceof Kt?Kt:Zt)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n};ue=new Zt(0),de="undefined"!=typeof TextDecoder&&new TextDecoder;try{de.decode(ue,{stream:!0})}catch(r){}function hr(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var a=e,i=n,s=Math.floor((a+i)/2);t<r[s]||t>=r[s+1];)t<r[s]?i=s:a=s,s=Math.floor((a+i)/2);return s}function pr(e,t,r,n){for(var a=[],i=[],s=[],o=a[0]=1;o<=r;++o){i[o]=t-n[e+1-o],s[o]=n[e+o]-t;for(var l=0,c=0;c<o;++c){var u=s[c+1],d=i[o-c],h=a[c]/(u+d);a[c]=l+u*h,l=d*h}a[o]=l}return a}function mr(e,t,r,n,a){for(var i=a<e?a:e,o=[],l=hr(e,n,t),c=function(e,t,r,n,a){for(var i=[],s=0;s<=r;++s)i[s]=0;for(var o=[],l=0;l<=n;++l)o[l]=i.slice(0);for(var c=[],u=0;u<=r;++u)c[u]=i.slice(0);c[0][0]=1;for(var d=i.slice(0),h=i.slice(0),p=1;p<=r;++p){d[p]=t-a[e+1-p],h[p]=a[e+p]-t;for(var m=0,f=0;f<p;++f){var g=h[f+1],v=d[p-f],b=(c[p][f]=g+v,c[f][p-1]/c[p][f]);c[f][p]=m+g*b,m=v*b}c[p][p]=m}for(var y=0;y<=r;++y)o[0][y]=c[y][r];for(var x=0;x<=r;++x){for(var w=0,S=1,M=[],T=0;T<=r;++T)M[T]=i.slice(0);for(var _=M[0][0]=1;_<=n;++_){var E=0,D=x-_,O=r-_;_<=x&&(M[S][0]=M[w][0]/c[1+O][D],E=M[S][0]*c[D][O]);for(var k=x-1<=O?_-1:r-x,P=-1<=D?1:-D;P<=k;++P)M[S][P]=(M[w][P]-M[w][P-1])/c[1+O][D+P],E+=M[S][P]*c[D+P][O];x<=O&&(M[S][_]=-M[w][_-1]/c[1+O][x],E+=M[S][_]*c[x][O]),o[_][x]=E;var A=w;w=S,S=A}}for(var C=r,L=1;L<=n;++L){for(var R=0;R<=r;++R)o[L][R]*=C;C*=r-L}return o}(l,n,e,i,t),u=[],d=0;d<r.length;++d){var h=r[d].clone(),p=h.w;h.x*=p,h.y*=p,h.z*=p,u[d]=h}for(var m=0;m<=i;++m){for(var f=u[l-e].clone().multiplyScalar(c[m][0]),g=1;g<=e;++g)f.add(u[l-e+g].clone().multiplyScalar(c[m][g]));o[m]=f}for(var v=i+1;v<=a+1;++v)o[v]=new s.Vector4(0,0,0);return o}function fr(e){for(var t=e.length,r=[],n=[],a=0;a<t;++a){var i=e[a];r[a]=new s.Vector3(i.x,i.y,i.z),n[a]=i.w}for(var o=[],l=0;l<t;++l){for(var c=r[l].clone(),u=1;u<=l;++u)c.sub(o[l-u].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var a=1,i=2;i<=t;++i)a*=i;for(var s=2;s<=e-t;++s)a*=s;return r/a}(l,u)*n[u]));o[l]=c.divideScalar(n[0])}return o}function 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 vr(e,t){return(vr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function br(e){return(br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var yr,xr,wr,Sr=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vr(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=br(e);if(r=t?(r=br(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===gr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(l=r.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=i||0,l.endKnot=o||l.knots.length-1;for(var c=0;c<a.length;++c){var u=a[c];l.controlPoints[c]=new s.Vector4(u.x,u.y,u.z,u.w)}return l}return t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,n){for(var a=hr(e,n,t),i=pr(a,n,e,t),o=new s.Vector4(0,0,0,0),l=0;l<=e;++l){var c=r[a-e+l],u=i[l],d=c.w*u;o.x+=c.x*d,o.y+=c.y*d,o.z+=c.z*d,o.w+=c.w*u}return o}(this.degree,this.knots,this.controlPoints,e),1!==e.w&&e.divideScalar(e.w),t.set(e.x,e.y,e.z)}},{key:"getTangent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),fr(mr(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[1]).normalize(),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Curve);function Mr(e){return(Mr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Tr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Er(e,t,r){t&&_r(e.prototype,t),r&&_r(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Dr(e,t){return(Dr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Or(e){return(Or=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var kr=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dr(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Or(e);if(r=t?(r=Or(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Mr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){return Tr(this,n),r.call(this,e)}return Er(n,[{key:"load",value:function(e,t,r,n){var a=this,i=""===a.path?s.LoaderUtils.extractUrlBase(e):a.path,o=new s.FileLoader(this.manager);o.setPath(a.path),o.setResponseType("arraybuffer"),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,(function(r){try{t(a.parse(r,i))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"parse",value:function(e,t,r){if(a="Kaydara FBX Binary \0",(n=e).byteLength>=a.length&&a===Wr(n,0,a.length))yr=(new Rr).parse(e);else{if(!function(e){for(var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0,n=0;n<t.length;++n)if(function(t){var n=e[0];return e=e.slice(r+1),r++,n}()===t[n])return;return 1}(n=Wr(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(jr(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+jr(n));yr=(new Lr).parse(n)}var n,a=new s.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Pr(a,this.manager,r).parse(yr)}}]),n}(s.Loader),Pr=function(){function e(t,r,n){Tr(this,e),this.textureLoader=t,this.manager=r,this.options=n}return Er(e,[{key:"parse",value:function(){xr=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new Ar).parse(t);return this.parseScene(t,r,e),wr}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in yr&&yr.Connections.connections.forEach((function(t){var r=t[0],n=t[1],a=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(a),e.has(n)||e.set(n,{parents:[],children:[]}),a={ID:r,relationship:t},e.get(n).children.push(a)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in yr.Objects){var n,a=yr.Objects.Video;for(n in a){var i,s,o=a[n];t[parseInt(n)]=o.RelativeFilename||o.Filename,"Content"in o&&(s=o.Content instanceof ArrayBuffer&&0<o.Content.byteLength,i="string"==typeof o.Content&&""!==o.Content,(s||i)&&(s=this.parseImage(a[n]),r[o.RelativeFilename||o.Filename]=s))}}for(e in t){var l=t[e];void 0!==r[l]?t[e]=r[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,a=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(a){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+a+'" is not supported.')}return"string"==typeof r?"data:"+t+";base64,"+r:(e=new Uint8Array(r),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in yr.Objects){var r,n=yr.Objects.Texture;for(r in n){var a=this.parseTexture(n[r],e);t.set(parseInt(r),a)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),n=e.WrapModeV;return r=void 0!==r?r.value:0,n=void 0!==n?n.value:0,t.wrapS=0===r?s.RepeatWrapping:s.ClampToEdgeWrapping,t.wrapT=0===n?s.RepeatWrapping:s.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(n=e.Translation.value,t.offset.x=n[0],t.offset.y=n[1]),t}},{key:"loadTexture",value:function(e,t){var r,n=this.textureLoader.path,a=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 s.Texture):(a.setPath(this.textureLoader.path),a.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new s.Texture):this.textureLoader.load(r,this.options.onTextureLoaded,(function(){}),this.options.onTextureLoadError),this.textureLoader.setPath(n),a}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in yr.Objects){var r,n=yr.Objects.Material;for(r in n){var a=this.parseMaterial(n[r],e);null!==a&&t.set(parseInt(r),a)}}return t}},{key:"parseMaterial",value:function(e,t){var r,n=e.id,a=e.attrName,i=e.ShadingModel;if("object"===Mr(i)&&(i=i.value),!xr.has(n))return null;switch(e=this.parseParameters(e,t,n),i.toLowerCase()){case"phong":r=new s.MeshPhongMaterial;break;case"lambert":r=new s.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),r=new s.MeshPhongMaterial}return r.setValues(e),r.name=a,r}},{key:"parseParameters",value:function(e,t,r){var n={},a=(e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new s.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new s.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new s.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new s.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new s.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new s.Color).fromArray(e.SpecularColor.value)),this);return xr.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":n.bumpMap=a.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=a.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=a.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=s.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=a.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=a.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=s.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=a.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=a.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=s.EquirectangularReflectionMapping,n.envMap.encoding=s.sRGBEncoding);break;case"SpecularColor":n.specularMap=a.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=s.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=a.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in yr.Objects&&t in yr.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 yr.Objects){var r,n=yr.Objects.Deformer;for(r in n){var a,i=n[r],s=xr.get(parseInt(r));"Skin"===i.attrType?((a=this.parseSkeleton(s,n)).ID=r,1<s.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=s.parents[0].ID,e[r]=a):"BlendShape"===i.attrType&&((a={id:r}).rawTargets=this.parseMorphTargets(s,n),a.id=r,1<s.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=a)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var n=t[e.ID];"Cluster"===n.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new s.Matrix4).fromArray(n.TransformLink.a)},"Indexes"in n&&(e.indices=n.Indexes.a,e.weights=n.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var a=e.children[n],i=t[a.ID],s={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if("BlendShapeChannel"!==i.attrType)return;s.geoID=xr.get(parseInt(a.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(e,t,r){wr=new s.Group;var n=this.parseModels(e.skeletons,t,r),a=yr.Objects.Model,i=this;n.forEach((function(e){var t=a[e.ID];i.setLookAtProperties(e,t),xr.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&wr.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),wr.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=Gr(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new Cr).parse(),1===wr.children.length&&wr.children[0].isGroup&&(wr.children[0].animations=r,wr=wr.children[0]),wr.animations=r}},{key:"parseModels",value:function(e,t,r){var n,a=new Map,i=yr.Objects.Model;for(n in i){var o=parseInt(n),l=i[n],c=xr.get(o),u=this.buildSkeleton(c,e,o,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(c);break;case"Light":u=this.createLight(c);break;case"Mesh":u=this.createMesh(c,t,r);break;case"NurbsCurve":u=this.createCurve(c,t);break;case"LimbNode":case"Root":u=new s.Bone;break;default:u=new s.Group}u.name=l.attrName?s.PropertyBinding.sanitizeNodeName(l.attrName):"",u.ID=o}this.getTransformData(u,l),a.set(o,u)}return a}},{key:"buildSkeleton",value:function(e,t,r,n){var a=null;return e.parents.forEach((function(e){for(var i in t)!function(i){var o=t[i];o.rawBones.forEach((function(t,i){var l;t.ID===e.ID&&(l=a,(a=new s.Bone).matrixWorld.copy(t.transformLink),a.name=n?s.PropertyBinding.sanitizeNodeName(n):"",a.ID=r,o.bones[i]=a,null!==l&&a.add(l))}))}(i)})),a}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=yr.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{var n=0,a=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1),1),i=(void 0!==r.NearPlane&&(a=r.NearPlane.value/1e3),1e3),o=(void 0!==r.FarPlane&&(i=r.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,c=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(o=r.AspectWidth.value,l=r.AspectHeight.value),o/l),u=45,d=(void 0!==r.FieldOfView&&(u=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(n){case 0:t=new s.PerspectiveCamera(u,c,a,i),null!==d&&t.setFocalLength(d);break;case 1:t=new s.OrthographicCamera(-o/2,o/2,l/2,-l/2,a,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new s.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=yr.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,a=(void 0!==r.Color&&(n=(new s.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),i=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0),0);switch(void 0!==r.FarAttenuationEnd&&(i=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new s.PointLight(n,a,i,1);break;case 1:t=new s.DirectionalLight(n,a);break;case 2:var o=Math.PI/3,l=(void 0!==r.InnerAngle&&(o=s.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(l=s.MathUtils.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new s.SpotLight(n,a,i,o,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new s.PointLight(n,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var n,a=null,i=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(a=t.get(e.ID)),r.has(e.ID)&&o.push(r.get(e.ID))})),1<o.length?i=o:0<o.length?i=o[0]:(i=new s.MeshPhongMaterial({color:13421772}),o.push(i)),"color"in a.attributes&&o.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(n=new s.SkinnedMesh(a,i)).normalizeSkinWeights():n=new s.Mesh(a,i),n}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,r){return t.has(r.ID)?t.get(r.ID):e}),null);var r=new s.LineBasicMaterial({color:3342591,linewidth:1});return new s.Line(e,r)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?Hr(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&xr.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=yr.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),wr.add(e.target)):e.lookAt((new s.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var n,a=this.parsePoseNodes();for(n in e)!function(n){var i=e[n];xr.get(parseInt(i.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 s.Skeleton(i.bones),a[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in yr.Objects){var t,r,n=yr.Objects.Pose;for(t in n)"BindPose"===n[t].attrType&&0<n[t].NbPoseNodes&&(r=n[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new s.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new s.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in yr&&"AmbientColor"in yr.GlobalSettings&&(r=(t=yr.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new s.Color(r,e,t),wr.add(new s.AmbientLight(r,1))))}}]),e}(),Ar=function(){function e(){Tr(this,e),this.negativeMaterialIndices=!1}return Er(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in yr.Objects){var r,n=yr.Objects.Geometry;for(r in n){var a=xr.get(parseInt(r));a=this.parseGeometry(a,n[r],e),t.set(parseInt(r),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var n,a=r.skeletons,i=[],s=e.parents.map((function(e){return yr.Objects.Model[e.ID]}));if(0!==s.length)return n=e.children.reduce((function(e,t){return void 0!==a[t.ID]?a[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&i.push(r.morphTargets[e.ID])})),e=s[0],s={},"RotationOrder"in e&&(s.eulerOrder=Hr(e.RotationOrder.value)),"InheritType"in e&&(s.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(s.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(s.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(s.scale=e.GeometricScaling.value),e=Gr(s),this.genGeometry(t,n,i,e)}},{key:"genGeometry",value:function(e,t,r,n){var a,i,o=new s.BufferGeometry,l=(e.attrName&&(o.name=e.attrName),this.parseGeoNode(e,t)),c=this.genBuffers(l),u=new s.Float32BufferAttribute(c.vertex,3);return u.applyMatrix4(n),o.setAttribute("position",u),0<c.colors.length&&o.setAttribute("color",new s.Float32BufferAttribute(c.colors,3)),t&&(o.setAttribute("skinIndex",new s.Uint16BufferAttribute(c.weightsIndices,4)),o.setAttribute("skinWeight",new s.Float32BufferAttribute(c.vertexWeights,4)),o.FBX_Deformer=t),0<c.normal.length&&(u=(new s.Matrix3).getNormalMatrix(n),(t=new s.Float32BufferAttribute(c.normal,3)).applyNormalMatrix(u),o.setAttribute("normal",t)),c.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();o.setAttribute(r=0===t?"uv":r,new s.Float32BufferAttribute(c.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(a=c.materialIndex[0],i=0,c.materialIndex.forEach((function(e,t){e!==a&&(o.addGroup(i,t-i,a),a=e,i=t)})),0<o.groups.length&&(t=(u=o.groups[o.groups.length-1]).start+u.count)!==c.materialIndex.length&&o.addGroup(t,c.materialIndex.length-t,a),0===o.groups.length&&o.addGroup(0,c.materialIndex.length,c.materialIndex[0])),this.addMorphTargets(o,e,r,n),o}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var n=0;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return r.weightTable={},null!==t&&(r.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(n,a){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[a]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,a=!1,i=[],s=[],o=[],l=[],c=[],u=[],d=this;return e.vertexIndices.forEach((function(h,p){var m,f,g,v,b=!1,y=(h<0&&(h^=-1,b=!0),[]),x=[];if(i.push(3*h,3*h+1,3*h+2),e.color&&(v=zr(p,r,h,e.color),o.push(v[0],v[1],v[2])),e.skeleton){for(void 0!==e.weightTable[h]&&e.weightTable[h].forEach((function(e){x.push(e.weight),y.push(e.id)})),4<x.length&&(a||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),a=!0),f=[0,0,0,0],g=[0,0,0,0],x.forEach((function(e,t){var r=e,n=y[t];g.forEach((function(e,t,a){e<r&&(a[t]=r,r=e,a=f[t],f[t]=n,n=a)}))})),y=f,x=g);x.length<4;)x.push(0),y.push(0);for(var w=0;w<4;++w)c.push(x[w]),u.push(y[w])}e.normal&&(v=zr(p,r,h,e.normal),s.push(v[0],v[1],v[2])),e.material&&"AllSame"!==e.material.mappingType&&(m=zr(p,r,h,e.material)[0])<0&&(d.negativeMaterialIndices=!0,m=0),e.uv&&e.uv.forEach((function(e,t){e=zr(p,r,h,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,b&&(4<n&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),d.genFace(t,e,i,m,s,o,l,c,u,n),r++,n=0,i=[],s=[],o=[],l=[],c=[],u=[])})),t}},{key:"genFace",value:function(e,t,r,n,a,i,s,o,l,c){for(var u=2;u<c;u++)!function(c){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(c-1)]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+2]]),e.vertex.push(t.vertexPositions[r[3*c]]),e.vertex.push(t.vertexPositions[r[3*c+1]]),e.vertex.push(t.vertexPositions[r[3*c+2]]),t.skeleton&&(e.vertexWeights.push(o[0]),e.vertexWeights.push(o[1]),e.vertexWeights.push(o[2]),e.vertexWeights.push(o[3]),e.vertexWeights.push(o[4*(c-1)]),e.vertexWeights.push(o[4*(c-1)+1]),e.vertexWeights.push(o[4*(c-1)+2]),e.vertexWeights.push(o[4*(c-1)+3]),e.vertexWeights.push(o[4*c]),e.vertexWeights.push(o[4*c+1]),e.vertexWeights.push(o[4*c+2]),e.vertexWeights.push(o[4*c+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(c-1)]),e.weightsIndices.push(l[4*(c-1)+1]),e.weightsIndices.push(l[4*(c-1)+2]),e.weightsIndices.push(l[4*(c-1)+3]),e.weightsIndices.push(l[4*c]),e.weightsIndices.push(l[4*c+1]),e.weightsIndices.push(l[4*c+2]),e.weightsIndices.push(l[4*c+3])),t.color&&(e.colors.push(i[0]),e.colors.push(i[1]),e.colors.push(i[2]),e.colors.push(i[3*(c-1)]),e.colors.push(i[3*(c-1)+1]),e.colors.push(i[3*(c-1)+2]),e.colors.push(i[3*c]),e.colors.push(i[3*c+1]),e.colors.push(i[3*c+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(a[0]),e.normal.push(a[1]),e.normal.push(a[2]),e.normal.push(a[3*(c-1)]),e.normal.push(a[3*(c-1)+1]),e.normal.push(a[3*(c-1)+2]),e.normal.push(a[3*c]),e.normal.push(a[3*c+1]),e.normal.push(a[3*c+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(s[r][0]),e.uvs[r].push(s[r][1]),e.uvs[r].push(s[r][2*(c-1)]),e.uvs[r].push(s[r][2*(c-1)+1]),e.uvs[r].push(s[r][2*c]),e.uvs[r].push(s[r][2*c+1])}))}(u)}},{key:"addMorphTargets",value:function(e,t,r,n){var a;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],a=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var i=yr.Objects.Geometry[r.geoID];void 0!==i&&a.genMorphGeometry(e,t,i,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,n,a){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var i=void 0!==r.Vertices?r.Vertices.a:[],o=void 0!==r.Indexes?r.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l),u=0;u<o.length;u++){var d=3*o[u];c[d]=i[3*u],c[1+d]=i[3*u+1],c[2+d]=i[3*u+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:c}),(t=new s.Float32BufferAttribute(l.vertex,3)).name=a||r.attrName,t.applyMatrix4(n),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,a=[];return"IndexToDirect"===r&&("NormalIndex"in e?a=e.NormalIndex.a:"NormalsIndex"in e&&(a=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:2,buffer:e.UV.a,indices:n="IndexToDirect"===r?e.UVIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:4,buffer:e.Colors.a,indices:n="IndexToDirect"===r?e.ColorIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,a=[],i=0;i<n.length;++i)a.push(i);return{dataSize:1,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new s.BufferGeometry;for(var r=t-1,n=(t=e.KnotVector.a,[]),a=e.Points.a,i=0,o=a.length;i<o;i+=4)n.push((new s.Vector4).fromArray(a,i));if("Closed"===e.Form)n.push(n[0]);else if("Periodic"===e.Form)for(var l=r,c=t.length-1-l,u=0;u<r;++u)n.push(n[u]);return e=new Sr(r,t,n,l,c).getPoints(12*n.length),(new s.BufferGeometry).setFromPoints(e)}}]),e}(),Cr=function(){function e(){Tr(this,e)}return Er(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t)r=t[r],r=this.addClip(r),e.push(r);return e}},{key:"parseClips",value:function(){var e;if(void 0!==yr.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=yr.Objects.AnimationCurveNode,r=new Map;for(e in t){var n=t[e];null!==n.attrName.match(/S|R|T|DeformPercent/)&&(n={id:n.id,attr:n.attrName,curves:{}},r.set(n.id,n))}return r}},{key:"parseAnimationCurves",value:function(e){var t,r=yr.Objects.AnimationCurve;for(t in r){var n,a={id:r[t].id,times:r[t].KeyTime.a.map(Ur),values:r[t].KeyValueFloat.a},i=xr.get(a.id);void 0!==i&&(n=i.parents[0].ID,(i=i.parents[0].relationship).match(/X/)?e.get(n).curves.x=a:i.match(/Y/)?e.get(n).curves.y=a:i.match(/Z/)?e.get(n).curves.z=a:i.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=a))}}},{key:"parseAnimationLayers",value:function(e){var t,r=yr.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],a=xr.get(parseInt(t));void 0!==a&&(a.children.forEach((function(t,n){if(e.has(t.ID)){var a=e.get(t.ID);if(void 0!==a.curves.x||void 0!==a.curves.y||void 0!==a.curves.z){if(void 0===r[n]){var i=xr.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==i){var o=yr.Objects.Model[i.toString()];if(void 0===o)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:o.attrName?s.PropertyBinding.sanitizeNodeName(o.attrName):"",ID:o.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};wr.traverse((function(e){e.ID===o.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new s.Matrix4),"PreRotation"in o&&(l.preRotation=o.PreRotation.value),"PostRotation"in o&&(l.postRotation=o.PostRotation.value),r[n]=l}}r[n]&&(r[n][a.attr]=a)}else void 0!==a.curves.morph&&(void 0===r[n]&&(i=xr.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=xr.get(i).parents[0].ID,t=xr.get(t).parents[0].ID,t=xr.get(t).parents[0].ID,t={modelName:(t=yr.Objects.Model[t]).attrName?s.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:yr.Objects.Deformer[i].attrName},r[n]=t),r[n][a.attr]=a)}})),n.set(parseInt(t),r))}(t);return n}},{key:"parseAnimStacks",value:function(e){var t,r=yr.Objects.AnimationStack,n={};for(t in r){var a=(1<(a=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(a[0].ID));n[t]={name:r[t].attrName,layer:a}}return n}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new s.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new s.Vector3,n=new s.Quaternion,a=new s.Vector3;return e.transform&&e.transform.decompose(r,n,a),r=r.toArray(),n=(new s.Euler).setFromQuaternion(n,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.T.curves,r,"position"))&&t.push(r),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(r=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale"))&&t.push(n),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,n){var a=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(a,t,r),new s.VectorKeyframeTrack(e+"."+n,a,t)}},{key:"generateRotationTrack",value:function(e,t,r,n,a,i){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(s.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(s.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(s.MathUtils.degToRad));for(var o=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(o,t,r),c=(void 0!==n&&((n=n.map(s.MathUtils.degToRad)).push(i),n=(new s.Euler).fromArray(n),n=(new s.Quaternion).setFromEuler(n)),void 0!==a&&((a=a.map(s.MathUtils.degToRad)).push(i),a=(new s.Euler).fromArray(a),a=(new s.Quaternion).setFromEuler(a).invert()),new s.Quaternion),u=new s.Euler,d=[],h=0;h<l.length;h+=3)u.set(l[h],l[h+1],l[h+2],i),c.setFromEuler(u),void 0!==n&&c.premultiply(n),void 0!==a&&c.multiply(a),c.toArray(d,h/3*4);return new s.QuaternionKeyframeTrack(e+".quaternion",o,d)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),n=wr.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new s.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,r)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var r=1,n=t[0],a=1;a<t.length;a++){var i=t[a];i!==n&&(n=t[r]=i,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,a=[],i=-1,s=-1,o=-1;return e.forEach((function(e){t.x&&(i=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(o=t.z.times.indexOf(e)),-1!==i?(e=t.x.values[i],a.push(e),n[0]=e):a.push(n[0]),-1!==s?(e=t.y.values[s],a.push(e),n[1]=e):a.push(n[1]),-1!==o?(e=t.z.values[o],a.push(e),n[2]=e):a.push(n[2])})),a}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],n=e.values[t]-r;if(180<=(a=Math.abs(n))){for(var a,i=n/(a/=180),s=r+i,o=(n=e.times[t-1],(e.times[t]-n)/a),l=n+o,c=[],u=[];l<e.times[t];)c.push(l),l+=o,u.push(s),s+=i;e.times=Kr(e.times,t,c),e.values=Kr(e.values,t,u)}}}}]),e}(),Lr=function(){function e(){Tr(this,e)}return Er(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 Br,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var a,i=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);i||s||(i=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),a=e.match("^\\t{"+(t.currentIndent-1)+"}}"),i?t.parseNodeBegin(e,i):s?t.parseNodeProperty(e,s,r[++n]):a?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:r}),a=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in a?("PoseNode"===r?a.PoseNode.push(n):void 0!==a[r].id&&(a[r]={},a[r][a[r].id]=a[r]),""!==t.id&&(a[r][t.id]=n)):"number"==typeof t.id?(a[r]={},a[r][t.id]=n):"Properties70"!==r&&(a[r]="PoseNode"===r?[n]:n),"number"==typeof t.id&&(n.id=t.id),""!==t.name&&(n.attrName=t.name),""!==t.type&&(n.attrType=t.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0],r=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),n="";return 1<e.length&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}}},{key:"parseNodeProperty",value:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===n&&","===t&&(t=r.replace(/"/g,"").replace(/,$/,"").trim()),r=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,n,t);else{if("C"===n){e=t.split(",").slice(1);for(var a=parseInt(e[0]),i=(e=parseInt(e[1]),(i=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),s=(n="connections",t=[a,e]),o=i,l=0,c=s.length,u=o.length;l<u;l++,c++)s[c]=o[l];void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=t),n in r&&Array.isArray(r[n])?r[n].push(t):"a"!==n?r[n]=t:r.a=t,this.setCurrentProp(r,n),"a"===n&&","!==t.slice(-1)&&(r.a=Zr(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Zr(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){r=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var n=r[0],a=r[1],i=r[2],s=r[3],o=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":o=parseFloat(o);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":o=Zr(o)}this.getPrevNode()[n]={type:a,type2:i,flag:s,value:o},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),Rr=function(){function e(){Tr(this,e)}return Er(e,[{key:"parse",value:function(e){var t=new Ir(e),r=(t.skip(23),t.getUint32());if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new Br;!this.endOfContent(t);){var a=this.parseNode(t,r);null!==a&&n.add(a.name,a)}return n}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var r={},n=7500<=t?e.getUint64():e.getUint32(),a=7500<=t?e.getUint64():e.getUint32(),i=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),s=e.getString(i);if(0===n)return null;for(var o=[],l=0;l<a;l++)o.push(this.parseProperty(e));i=0<o.length?o[0]:"";var c=1<o.length?o[1]:"",u=2<o.length?o[2]:"";for(r.singleProperty=1===a&&e.getOffset()===n;n>e.getOffset();){var d=this.parseNode(e,t);null!==d&&this.parseSubNode(s,r,d)}return r.propertyList=o,"number"==typeof i&&(r.id=i),""!==c&&(r.attrName=c),""!==u&&(r.attrType=u),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(e,t,r){var n,a,i,s,o;!0===r.singleProperty?(a=r.propertyList[0],Array.isArray(a)?(t[r.name]=r).a=a:t[r.name]=a):"Connections"===e&&"C"===r.name?(n=[],r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)):"Properties70"===r.name?Object.keys(r).forEach((function(e){t[e]=r[e]})):"Properties70"===e&&"P"===r.name?(a=r.propertyList[0],e=r.propertyList[1],i=r.propertyList[2],s=r.propertyList[3],0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[a]={type:e,type2:i,flag:s,value:o}):void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{key:"parseProperty",value:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),n=e.getUint32(),a=e.getUint32();if(0===n)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}n=function(e,t){return function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new Zt(0);function a(e){var r=t.length;r<e&&((r=new Zt(Math.max(2*r,e))).set(t),t=r)}var i=!t||r,s=!r||r.i,o=(r=r||{},t=t||new Zt(3*n),r.f||0),l=r.p||0,c=r.b||0,u=r.l,d=r.d,h=r.m,p=r.n,m=8*n;do{if(!u){r.f=o=lr(e,l,1);var f=lr(e,l+1,3);if(l+=3,!f){var g=e[(_=ur(l)+4)-4]|e[_-3]<<8;if(n<(S=_+g)){if(s)throw"unexpected EOF";break}i&&a(c+g),t.set(e.subarray(_,S),c),r.b=c+=g,r.p=l=8*S;continue}if(1==f)u=ir,d=sr,h=9,p=5;else{if(2!=f)throw"invalid block type";g=lr(e,l,31)+257;for(var v=lr(e,l+10,15)+4,b=g+lr(e,l+5,31)+1,y=(l+=14,new Zt(b)),x=new Zt(19),w=0;w<v;++w)x[Yt[w]]=lr(e,l+3*w,7);l+=3*v;var S,M=(1<<(S=or(x)))-1,T=rr(x,S,1);for(w=0;w<b;){var _,E=T[lr(e,l,M)];if(l+=15&E,(_=E>>>4)<16)y[w++]=_;else{var D=0,O=0;for(16==_?(O=3+lr(e,l,3),l+=2,D=y[w-1]):17==_?(O=3+lr(e,l,7),l+=3):18==_&&(O=11+lr(e,l,127),l+=7);O--;)y[w++]=D}}f=y.subarray(0,g);var k=y.subarray(g);h=or(f),p=or(k),u=rr(f,h,1),d=rr(k,p,1)}if(m<l){if(s)throw"unexpected EOF";break}}i&&a(c+131072);for(var P=(1<<h)-1,A=(1<<p)-1,C=l;;C=l){var L=(D=u[cr(e,l)&P])>>>4;if(m<(l+=15&D)){if(s)throw"unexpected EOF";break}if(!D)throw"invalid length/literal";if(L<256)t[c++]=L;else{if(256==L){C=l,u=null;break}var R,I=L-254,B=(264<L&&(R=qt[w=L-257],I=lr(e,l,(1<<R)-1)+Qt[w],l+=R),(L=d[cr(e,l)&A])>>>4);if(!L)throw"invalid distance";if(l+=15&L,k=Jt[B],3<B&&(R=Xt[B],k+=cr(e,l)&(1<<R)-1,l+=R),m<l){if(s)throw"unexpected EOF";break}i&&a(c+131072);for(var j=c+I;c<j;c+=4)t[c]=t[c-k],t[c+1]=t[c+1-k],t[c+2]=t[c+2-k],t[c+3]=t[c+3-k];c=j}}r.l=u,r.p=C,r.b=c,u&&(o=1,r.m=h,r.d=d,r.n=p)}while(!o);return c==t.length?t:dr(t,0,c)}((function(e){if(8!=(15&e[0])||7<e[0]>>>4||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}(new Uint8Array(e.getArrayBuffer(a)));var i=new Ir(n.buffer);switch(t){case"b":case"c":return i.getBooleanArray(r);case"d":return i.getFloat64Array(r);case"f":return i.getFloat32Array(r);case"i":return i.getInt32Array(r);case"l":return i.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),Ir=function(){function e(t,r){Tr(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r,this._textDecoder=new TextDecoder}return Er(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){var t=this.offset,r=new Uint8Array(this.dv.buffer,t,e);return 0<=(this.skip(e),e=r.indexOf(0))&&(r=new Uint8Array(this.dv.buffer,t,e)),this._textDecoder.decode(r)}}]),e}(),Br=function(){function e(){Tr(this,e)}return Er(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function jr(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 Ur(e){return e/46186158e3}var Nr=[];function zr(e,t,r,n){var a;switch(n.mappingType){case"ByPolygonVertex":a=e;break;case"ByPolygon":a=t;break;case"ByVertice":a=r;break;case"AllSame":a=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var i=(a="IndexToDirect"===n.referenceType?n.indices[a]:a)*n.dataSize,s=i+n.dataSize,o=Nr,l=n.buffer,c=s,u=i,d=0;u<c;u++,d++)o[d]=l[u];return o}var Fr=new s.Euler,Vr=new s.Vector3;function Gr(e){var t=new s.Matrix4,r=new s.Matrix4,n=new s.Matrix4,a=new s.Matrix4,i=new s.Matrix4,o=new s.Matrix4,l=new s.Matrix4,c=new s.Matrix4,u=new s.Matrix4,d=new s.Matrix4,h=new s.Matrix4,p=new s.Matrix4,m=e.inheritType||0,f=(e.translation&&t.setPosition(Vr.fromArray(e.translation)),e.preRotation&&((f=e.preRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),r.makeRotationFromEuler(Fr.fromArray(f))),e.rotation&&((f=e.rotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),n.makeRotationFromEuler(Fr.fromArray(f))),e.postRotation&&((f=e.postRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),a.makeRotationFromEuler(Fr.fromArray(f)),a.invert()),e.scale&&i.scale(Vr.fromArray(e.scale)),e.scalingOffset&&l.setPosition(Vr.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(Vr.fromArray(e.scalingPivot)),e.rotationOffset&&c.setPosition(Vr.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(Vr.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(h.copy(e.parentMatrix),d.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(a)),g=(((e=new s.Matrix4).extractRotation(d),g=new s.Matrix4).copyPosition(d),g.clone().invert().multiply(d)),v=(g=e.clone().invert().multiply(g),i),b=new s.Matrix4;return 0===m?b.copy(e).multiply(f).multiply(g).multiply(v):1===m?b.copy(e).multiply(g).multiply(f).multiply(v):(m=(new s.Matrix4).scale((new s.Vector3).setFromMatrixScale(h)).clone().invert(),h=g.clone().multiply(m),b.copy(e).multiply(f).multiply(h).multiply(v)),g=u.clone().invert(),m=o.clone().invert(),e=t.clone().multiply(c).multiply(u).multiply(r).multiply(n).multiply(a).multiply(g).multiply(l).multiply(o).multiply(i).multiply(m),f=(new s.Matrix4).copyPosition(e),h=d.clone().multiply(f),p.copyPosition(h),(e=p.clone().multiply(b)).premultiply(d.invert()),e}function Hr(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function Zr(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Wr(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,r))}function Kr(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}var qr=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const Xr=t.FBXLoader;class Yr{constructor(e){this.parses={fbx:new Xr,obj:new Ht,object:new s.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return qr(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);break;case"png":case"jpg":case"webp":case"hdr":t=this.img(e)}return t}))}img(e){return qr(this,void 0,void 0,(function*(){return{type:"texture",result:yield this.runScene.textureEx.parse(e),file:e}}))}glb(e){return qr(this,void 0,void 0,(function*(){var t=yield(0,i.parseFile)(e,"arrayBuffer");let r="model";return t=yield this.runScene.loaderer.gltf.parse(t,{triggerCb:!0,callBack:{beforeParse:e=>{"scene"===(e=(e.asset.ex||{}).type)&&this.runScene.clean()},getJSON(e){r=(null==(e=e.asset.ex)?void 0:e.type)||"model"}}}),{type:r,result:t}}))}fbx(e){return qr(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,i.parseFile)(e,"arrayBuffer");this.runScene.materialEx.create();const r=this.parses.fbx.parse(t,"",{onTextureLoaded:e=>{this.runScene.textureEx.onLoaded(e)},onTextureLoadError(e){}});return r.traverse((e=>{e.material&&(0,ft.getMaterials)(e.material).map((t=>{"Line"!==e.type&&("MeshPhongMaterial"===t.type||"MeshLambertMaterial"===t.type?this.runScene.materialEx.afterLoader(t):e.material=t)}))})),{type:"model",result:[this.runScene.sceneEx.cleanUnlessLevel(r)]}}))}obj(e){return qr(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e;const r=this.parses.obj.parse(t),n=this.runScene.materialEx.create();return r.traverse((e=>{e.material&&"Line"!==e.type&&(e.material=n)})),{type:"model",result:[this.runScene.sceneEx.cleanUnlessLevel(r)]}}))}json(e){return qr(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e,r=JSON.parse(t);return"timeLine"===r.type?{type:"timeLine",result:r.data}:"timeLineData"===r.type?{type:"timeLineData",result:r.data}:{type:"model",result:[this.runScene.loaderer.json.parse(t)]}}))}}class Qr extends o{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.loaderer.gltf.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.loaderer.gltf.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},r=()=>{const e=this.runScene.assetsEx.get().renderer;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&this.runScene.cb.controls.change.delete("global-config")},n=e=>{var t=this.runScene.render;const r=this.runScene.assetsEx.get().renderer;"tick"===e?r.setAnimationLoop(t):"controlsChange"===e&&this.runScene.cb.controls.change.add("global-config",t)};return e=>{this._lastRenderMode!==e&&(t(),r(),n(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.pp.params.glow.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}setState(e){const t=(0,S.F)(this.runScene);t.renderConfig.stop=!e,t.run=e,this.setEventState(e)}setEventState(e){(0,S.F)(this.runScene).renderConfig.event.trigger=e}}var Jr=r(1269);class $r extends r(8624).Ys{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new s.Vector3,this.beginScale=new s.Vector3,this.posStart=new s.Vector2,this.posEnd=new s.Vector2,this.deleteRedundantParts()}deleteRedundantParts(){this.transGizmo.gizmo.translate.children.splice(1,1),this.transGizmo.gizmo.translate.children.splice(3,1),this.transGizmo.gizmo.translate.children.splice(5,1),this.transGizmo.gizmo.scale.children.splice(0,1),this.transGizmo.gizmo.scale.children.splice(2,1),this.transGizmo.gizmo.scale.children.splice(4,1)}pointerDown(e){void 0===this.object||null===this.axis||this.dragging||0!==e.button||(this.posStart.set(e.x,e.y),this.beginScale.set(this.object.scale.x,this.object.scale.y,this.object.scale.z),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(e),void 0!==this.object&&null!==this.axis&&this.dragging&&-1===e.button&&"scale"===this.mode&&-1!==this.axis.search("XYZ")){this.posEnd.set(e.x,e.y),e=(Math.abs(this.beginScale.x)+Math.abs(this.beginScale.y)+Math.abs(this.beginScale.z))/3;let t=12*this.pointStart.distanceTo(this.pointEnd)/e;this.posEnd.x>this.posStart.x&&(t*=-1),(t=-1.1<t&&t<1.1?1:t)<0&&(t=-1.1/t),this.scaleCoefficient.set(t,t,t),this.object.scale.copy(this._scaleStart).multiply(this.scaleCoefficient)}}}class en extends s.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new s.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new s.Vector3,this.targetQuaternion=new s.Quaternion,this.q1=new s.Quaternion,this.q2=new s.Quaternion,this.radius=0,this.clock=new s.Clock,this.runScene=e,e=this.runScene.assetsEx.get().controls,this.controls=e,this.runScene.cb.render.add("view-helper",(()=>{this.update(this.clock.getDelta())}))}prepareAnimationData(e){const t=this.runScene.assetsEx.get().camera;var r=this.controls.target;switch(e){case"posX":this.targetPosition.set(1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new s.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new s.Euler(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}this.radius=t.position.distanceTo(r),this.targetPosition.multiplyScalar(this.radius).add(r),this.dummy.position.copy(r),this.dummy.lookAt(t.position),this.q1.copy(this.dummy.quaternion),this.dummy.lookAt(this.targetPosition),this.q2.copy(this.dummy.quaternion),this.animating=!0}update(e){if(this.animating){const r=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),r.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),r.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class tn{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,t)=>(e=new s.BoxHelper(e,t),this.runScene.assetsEx.get().scene.add(e),this.setHelper(e,!0),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.enable=!0,this.modelNewVal=new c.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.inited=()=>{this.runScene.helperEx.setHelper(this.tansControls,!0),this.runScene.cb.multipSelect.add.add("transContro",(()=>{this.runScene.events.key.ctrl&&(this.close(),this.removeFocus())})),this.runScene.cb.events.key.up.add("transContro",(({key:e})=>{"ctrl"!==e&&"control"!==e||!1!==this.tansControls.enabled||(e=(0,i.lastArrayEle)(this.runScene.multipSelector.getSelectedList("value")||[]),this.open(),e&&this.addObject(e))}))},this.multipObj=null,this.speaceType="world",this.draggingChanged=e=>{var t,r,n;this.tansControls.enabled&&this.enable&&(t=this.runScene.assetsEx.get().controls,r=this.controlsMode,(n=this.runScene.modelEx.select||this.runScene.multipSelector.getLast())&&(this.runScene.multipSelector.draggingchanged(e),t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(n[r]),this.isDraggingChange=!0):(this.runScene.multipSelector.isEmpty()&&this.runScene.modelEx.setV3({model:n,info:r,newV3:this.runScene.modelEx.cloneV3(n[r]),oldV3:this.modelNewVal},!0,!1),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value))},(this.runScene=e).cb.inited.add("transContro",this.inited)}init(){const{camera:e,scene:t,engineDom:r}=this.runScene.assetsEx.get();this.tansControls=new $r(e,r),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",t.add(this.tansControls),this.tansControls.traverse((e=>e.isHelper=!0))}changeMode(e){this.controlsMode=e,this.tansControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.tansControls.setSize(e?this.tansControls.size+.1:Math.max(this.tansControls.size-.1,.1))}changeState(e){this.tansControls.enabled=e}addObject(e){this.removeFocus(),this.tansControls.attach(e)}removeFocus(){this.tansControls.detach()}changeSpaceState(){this.tansControls.setSpace("local"===this.tansControls.space?"world":"local"),this.tansControls.detach()}setSpeace(e){e=e||("world"===this.speaceType?"local":"world"),this.speaceType=e,this.tansControls.setSpace(e),this.addObject(this.runScene.modelEx.select)}transChangeFn(e){var t;this.tansControls.enabled&&this.enable&&((t=this.runScene.modelEx.select)&&(this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t),this.runScene.cb.model.setVector3.cb({type:"position",model: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 en(e),this.grid=this.createGrid(),this.init(),this.setHelper(this.viewHelper,!0),this.setHelper(this.grid,!0),this.boxHelper=this.getBoxHelper(new s.Group))}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new c.Z.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,r){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,r&&r(e)})),e}focus(e){"running"===this.runScene.optionsEx.options.mode||(0,d.isHelper)(e)||((0,Jr.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)}setState(e){this.runScene.modelEx.selectNull(),this.runScene.lightEx.setAllHelpers(e),this.runScene.helperEx.grid.visible=e}}var rn=r(2510),nn=r(4380),an=r(8089);class sn{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new p.Z,this.tempOldval=new c.Z.Vector3,this.runScene=e,this.runScene.cb.undo.undo.add("helperEx",(()=>{this.updateBoxHelper()})),this.runScene.cb.undo.redo.add("helperEx",(()=>{this.updateBoxHelper()}))}updateBoxHelper(){(0,i.mapObj)(this.boxHelperMap,((e,t)=>{t.parent&&t.update()}))}add(e,t=!1,r=!0,n){var a,o;if("array"===(0,i.getType)(e))return a=e.map((e=>this.add(e,t,r))),[o]=this.runScene.modelEx.getSelectedModels(),o&&this.add(o,!0,!0,!0),a;(0,d.isHelper)(e)||this.selectors[e.uuid]&&(this.remove(e),this.removeBoxHelper(e),!t)||(this.addBoxHelper(e,n&&new s.Color("0,127,0")),this.selectors[e.uuid]=e,this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!0}),r&&this.runScene.helperEx.focus(e),this.runScene.cb.multipSelect.add.cb({model:e,selectIds:this.selectors}))}clearAfterAdd(e,t=!1,r=!0,n){this.runScene.modelEx.selectNull(),this.setEmpty(),this.add(e,t,r,n)}setInfo(e,t,r,n,a,i){"position"!==t&&(a=n,i=r);const s=this.getSelectedList("value");var{x:a,y:o,z:l}=a;const c=a-i.x,u=o-i.y,d=l-i.z,h=[new nn.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];s.map((r=>{if(r!==e){var{x:n,y:a,z:i}=r[t],n=n+=c,a=a+=u,i=i+=d;let e=r[t].clone();e.x=n,e.y=a,e.z=i,n=new nn.Z({target:r,info:t,oldV3:this.runScene.modelEx.cloneV3(r[t]),newV3:e,runScene:this.runScene}).execute(),h.push(n),this.boxHelperMap[r.uuid].setFromObject(r)}})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(h)}draggingchanged(e){const t=this.runScene.assetsEx.get().controls;var r;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value?this.isEmpty()||(t.enabled=!1,e=this.getLast(),r=this.runScene.helperEx.transContro.controlsMode,this.tempOldval="position"===r?(0,an.VU)(e,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(e[r]),this.saveV3(r)):t.enabled||this.isEmpty()||(this.runScene.events.mouse.enableUp=!1,this.useV3())}transChange(){if(!this.isEmpty()&&!this.runScene.assetsEx.controls.enabled){var e=this.runScene.helperEx.transContro.controlsMode,t=this.getLast();let r;this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),r="position"===e?(0,an.VU)(t,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(t[e]),this.getInfo({model:t,type:e,newV3:r,oldV3:this.tempOldval}),this.tempOldval.copy(r)}}saveV3(e){this.getSelectedList("value").map((t=>{var r=(0,W.Ki)(t);this.savedV3.set(r,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:r,model:n})=>new nn.Z({target:n,info:t,newV3:this.runScene.modelEx.cloneV3(n[t]),oldV3:r,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:r,newV3:n,oldV3:a}=e,i=this.getSelectedList("value");var{x:e,y:s,z:o}=n;const l=e-a.x,c=s-a.y,u=o-a.z;t[r].copy(n),i.map((e=>{if(e!==t){var{x:n,y:a,z:i}=e[r],n=n+=l,a=a+=c,i=i+=u;let t=e[r].clone();t.x=n,t.y=a,t.z=i,e[r].copy(t),this.boxHelperMap[e.uuid].setFromObject(e)}})),this.boxHelperMap[t.uuid].setFromObject(t)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e,t){t=this.runScene.helperEx.getBoxHelper(e,t),this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),delete this.boxHelperMap[e.uuid],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(){const e=this.runScene.assetsEx.get().scene;Object.values(this.boxHelperMap).map((t=>{e.remove(t)})),this.boxHelperMap={}}setEmpty(){this.isEmpty()||(Object.values(this.boxHelperMap).map((e=>{this.removeBoxHelper(e)})),this.getSelectedList("value").map((e=>{this.runScene.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={},this.runScene.cb.model.multiSelect.setEmpty.cb())}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new s.Group;const t=new s.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),(0,an.qg)(e));t.position.copy(n),this.runScene.cb.model.multipDrop.cb({models:r,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new s.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:r,back:n,rmBackLength:a,fullName:i,step:s}=e,o=this.getSelectedList("value");0!==o.length&&(e=o.map(((e,o)=>{let l=e.name;if(0===i.length){if(0!==r){if(r>l.length)return;l=l.substring(r)}if(0!==a){if(a>l.length)return;l=l.substring(0,l.length-a)}0<t.length&&(l=t+l),0<n.length&&(l+=n)}else l=i+(o+1)*s;return new rn.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}align(e){const t=this.getSelectedList("value");if(0!==t.length){const[n]=t;var r=t.map((t=>{var r=t.position.clone();const a=("all"===e?n:t).position.clone();return"all"!==e&&(a[e]=n.position[e]),new nn.Z({target:t,info:"position",oldV3:r,newV3:a,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(r)}}}function on(e){return(on="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ln(e,t){return(ln=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function cn(e){return(cn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var un=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ln(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cn(e);if(r=t?(r=cn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===on(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var e=n.SkyShader;return e=new s.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:s.UniformsUtils.clone(e.uniforms),side:s.BackSide,depthWrite:!1}),(e=r.call(this,new s.BoxGeometry(1,1,1),e)).isSky=!0,e}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(s.Mesh),dn=(un.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new s.Vector3},up:{value:new s.Vector3(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\n\t\t}"},r(7585)),hn=r(6651);const pn={color:"#000000",intensity:1};class mn{diff(e,t){const r={};return(0,i.mapObj)(pn,(n=>{var a=e[n];(0,y.Xq)(a,t[n])&&(r[n]=a)})),r}setConfig(e,t){var{color:t,intensity:r,shadow:n}=t,{mapSize:n,camera:a}=n||{},{far:a,near:i,scale:s}=a||{};void 0!==s&&(e.shadow.camera.scale.x=s,e.shadow.camera.scale.y=s,e.shadow.camera.scale.z=s),void 0!==i&&(e.shadow.camera.near=i),void 0!==a&&(e.shadow.camera.far=a),void 0!==n&&(e.shadow.mapSize.x=n,e.shadow.mapSize.y=n),void 0!==r&&(e.intensity=r),void 0!==t&&(e.color=(0,an.e9)(t)),e.shadow.camera.updateProjectionMatrix(),null!=(s=e.cameraHelper)&&s.update()}}class fn extends o{constructor(){super(...arguments),this.allState=["morning","noon","evening","night"],this.sun=new Pa.Vector3,this.light=new mn,this.sky=new un,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.toJSON=()=>{var{currentState:e,effectController:t,isShow:r,lightConfig:n,size:a}=this.skyData,e={currentState:e,effectController:t,isShow:r,lightConfig:n,size:a};if(0!==z.YD.objLength((0,y.ad)(e,this.getData())))return e},this.parseJSON=e=>{var t,r,n;e&&(({isShow:t,currentState:r,size:n}=e),t&&(this.skyData.isShow=t,this.initLight(),this.parseLightConfig(e),this.inied||(this.init(),this.inied=!0),this.parseSkyConfig(r,n),this.setOpen(t)))},this.currentAnimas=[],this.awaitAnimas=[],this.animaInstance=null,this.animaIndex={begin:0,end:0},this.getNromalFn=()=>{this.playSky()},this.getSpecialFn=()=>{var e=this.allState[0];this.setSkyConfig(e),this.setLightSpecialConfig(e),this.lightAnima(e),0!==this.animaIndex.end&&(this.currentAnimas=this.getAnimasDataByState(this.allState[this.animaIndex.end],e),this.playSky())}}init(){this.addScene(),this.initSnapshot()}initSnapshot(){this.runScene.cb.snapshot.create.add("sky",(e=>{e.data.set("sky",{state:this.skyData.currentState})})),this.runScene.cb.snapshot.set.add("sky",(e=>{(e=e.snapshot.data.get("sky"))&&e.state!==this.skyData.currentState&&this.setState(e.state)}))}initLight(){if(!this.directionalLight){var e=new dn.Z(this.runScene).get();const[t]=e;this.runScene.lightEx.add(e,{addToTree:!1}),(this.directionalLight=t).name="skyLight"}}addScene(){this.initLight(),ft.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.directionalLight?(this.directionalLight.visible=e,t.toneMapping=e?4:0,this.sky.visible!==e&&(this.skyData.isShow=e,this.sky.visible=e)):this.addScene()}parseLightConfig(e){var t,{isShow:r,effectController:n,currentState:a,lightConfig:i,size:s}=e;e&&i&&(e=i.shadow,t=n[a].lightConfig,dn.Z.setConfig(this.directionalLight,Object.assign(Object.assign({shadow:e},t),this.baseLightConfig)),this.directionalLight.visible=r,this.skyData.lightConfig=i,this.skyData.isShow=r,this.skyData.effectController=n,this.skyData.currentState=a,this.skyData.size=s,this.sky.visible=r,this.setLightSpecialConfig(a),this.lightAnima(a))}parseSkyConfig(e,t){this.setSkyConfig(e),this.setSkyScale(t)}setState(e){var t=this.skyData.currentState;this.doAnimaByState(e,t),this.runScene.cb.objects.sky.setState.cb({state:e}),this.saveLastTimeState({oldState:t,state:e,index:this.allState.findIndex((t=>t===e))})}saveLastTimeState(e){var{oldState:e,state:t,index:r}=e;this.lastTime.name=e,this.lastTime.index=r,this.skyData.currentState=t}getLightDataByState(e){let t=new Pa.Vector3,r=new Pa.Vector3;switch(e){case"morning":t.x=0,t.y=0,t.z=-this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2;break;case"noon":t.x=0,t.y=this.skyData.size/2,t.z=0,r.x=0,r.y=-1*this.skyData.size,r.z=0;break;case"evening":case"night":t.x=0,t.y=0,t.z=this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2*-1}return{position:t,targetPosition:r}}getIdxByState(e){return this.allState.findIndex((t=>t===e))}setSkyConfig(e){const{renderer:t,scene:r,camera:n}=this.runScene.assetsEx.get();this.sky.material.uniforms.turbidity.value=this.skyData.effectController[e].turbidity,this.sky.material.uniforms.mieCoefficient.value=this.skyData.effectController[e].mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.skyData.effectController[e].mieDirectionalG,this.skyData.isShow&&(t.toneMappingExposure=this.skyData.effectController[e].exposure),t.render(r,n);var a=Pa.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=Pa.MathUtils.degToRad(this.skyData.effectController[e].azimuth),this.sun.setFromSphericalCoords(1,a,e),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}setSkyScale(e){this.sky.scale.setScalar(e),this.skyData.size=e}setSky(e){var{state:e,type:t,val:r}=e;this.skyData.effectController[e][t]=r,this.setSkyConfig(e)}setCurrentState(e){this.skyData.currentState=e}setStateTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}clean(){this.setOpen(!1),this.skyData=this.getData(),this.directionalLight&&this.runScene.modelEx.remove(this.directionalLight)}setLight(e,t){switch(e){case"mapSize":this.skyData.lightConfig.shadow.mapSize=t,this.directionalLight.shadow.mapSize.x=t,this.directionalLight.shadow.mapSize.y=t;break;case"near":this.skyData.lightConfig.shadow.camera.near=t,this.directionalLight.shadow.camera.near=t;break;case"far":this.skyData.lightConfig.shadow.camera.far=t,this.directionalLight.shadow.camera.far=t;break;case"scale":this.skyData.lightConfig.shadow.camera.scale=t,this.directionalLight.shadow.camera.scale.set(t,t,t);break;case"top":this.skyData.lightConfig.shadow.camera.top=t,this.skyData.lightConfig.shadow.camera.bottom=t,this.skyData.lightConfig.shadow.camera.left=t,this.skyData.lightConfig.shadow.camera.right=t,this.directionalLight.shadow.camera.top=t,this.directionalLight.shadow.camera.bottom=t,this.directionalLight.shadow.camera.left=t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.updateProjectionMatrix(),null!=(r=this.directionalLight.cameraHelper)&&r.update();break;case"color":this.skyData.effectController[this.skyData.currentState].lightConfig.color=t;var r=new Pa.Color(t);this.directionalLight.color=r;break;case"intensity":this.skyData.effectController[this.skyData.currentState].lightConfig.intensity=t,this.directionalLight.intensity=t}}setLightSpecialConfig(e){var t;this.directionalLight&&(({color:e,intensity:t}=this.skyData.effectController[e].lightConfig),this.directionalLight.color=(0,an.e9)(e),this.directionalLight.intensity=t)}getAnimasDataByState(e,t){e=this.getIdxByState(e);const r=[];if((t=this.getIdxByState(t))<e){this.animaIndex={begin:e,end:t};var n=e-t;let l=t;for(let e=0;e<n;e++){var{color:a,intensity:i}=this.skyData.effectController[this.allState[l]].lightConfig,{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]),{color:a,intensity:i}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o})}),l++,this.skyData.effectController[this.allState[l]].lightConfig),{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]);r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o}),onDone:this.getNromalFn})}}else{var l=3-t;this.animaIndex={begin:t,end:e};let n=t;if(0==l)return r.push({onDone:this.getSpecialFn}),r;for(let e=0;e<l;e++){var{color:c,intensity:u}=this.skyData.effectController[this.allState[n]].lightConfig,{position:d,targetPosition:h}=this.getLightDataByState(this.allState[n]),{position:d,targetPosition:h}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:d,targetPosition:h})}),n++,this.getLightDataByState(this.allState[n]));r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:d,targetPosition:h}),onDone:3===n?this.getSpecialFn:this.getNromalFn})}}return r}playSky(){if(0!==this.currentAnimas.length){const t=this.currentAnimas.shift();var e=this.currentAnimas.shift();if(!e)return t.onDone();this.playAnima(t,e)}}playAnima(e,t){if(this.directionalLight){const r=this.runScene.assetsEx.get().renderer;this.animaInstance=u.anima(Object.assign(Object.assign({},e.data),{x:this.directionalLight.position.x,y:this.directionalLight.position.y,z:this.directionalLight.position.z,tx:this.directionalLight.target.position.x,ty:this.directionalLight.target.position.y,tz:this.directionalLight.target.position.z}),Object.assign(Object.assign({},t.data),{ease:"none"}),e.data.time,(e=>{var{r:n,g:a,b:i}=e,s=(this.onUpdated(e),this.sky.material.uniforms.turbidity.value=e.turbidity,this.sky.material.uniforms.mieCoefficient.value=e.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=e.mieDirectionalG,r.toneMappingExposure=e.exposure,Pa.MathUtils.degToRad(90-e.elevation)),o=Pa.MathUtils.degToRad(t.data.azimuth);this.sun.setFromSphericalCoords(1,s,o),this.sky.material.uniforms.sunPosition.value.copy(this.sun),s=new Pa.Color(n,a,i),this.directionalLight.color=s,this.directionalLight.intensity=e.intensity,this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(e.tx,e.ty,e.tz)}),(()=>{t.onDone(),this.animaInstance=null}))}}doAnimaByState(e,t){e=this.getAnimasDataByState(e,t),this.animaInstance?this.awaitAnimas=e:(this.currentAnimas=e,this.playSky())}onUpdated(e){var t;0!==this.awaitAnimas.length&&(this.animaInstance.kill(),this.animaInstance=null,[t]=this.awaitAnimas,this.currentAnimas=[...this.awaitAnimas],this.awaitAnimas=[],null!=t&&t.data&&(this.currentAnimas.unshift({data:t.data,onDone:this.getNromalFn}),this.currentAnimas.unshift({data:e})),this.playSky())}lightAnima(e){var t;this.directionalLight&&(({position:e,targetPosition:t}=this.getLightDataByState(e)),this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(t.x,t.y,t.z))}transDataToAnimaData(e){var{sky:e,color:t,position:r,targetPosition:n,intensity:a}=e,{x:r,y:i,z:s}=r,{x:n,y:o,z:l}=n,{r:t,g:c,b:u}=(0,y.fh)((0,y.I8)(t));return Object.assign(Object.assign({},e),{r:t,g:c,b:u,x:r,y:i,z:s,tx:n,ty:o,tz:l,intensity:a})}getData(){return{isShow:!1,size:5e3,lightConfig:{shadow:{mapSize:512,camera:{near:.5,far:500,scale:1,top:5,bottom:5,left:5,right:5}}},effectController:{morning:{turbidity:2,rayleigh:1,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:180,exposure:.3,lightConfig:Object.assign(Object.assign({},(0,hn.d9)(pn)),{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,hn.d9)(pn)),{color:"#FFFFFF"})},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Object.assign(Object.assign({},(0,hn.d9)(pn)),{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,hn.d9)(pn)),{color:"#B8A277"}),time:1}},currentState:"morning"}}}class gn{constructor(e){this.clean=()=>{this.sky.clean()},this.sky=new fn(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)}}class vn{constructor(e){this.outlineModelLength=new Set,this.modelMap=new p.Z,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{setLayers:e,add:t,remove:r,change:n}=this.runScene.cb.model;n.add("pp-set-glow",(e=>{const{model:t,type:r,val:n}=e;"visible"===r&&(t.traverse((e=>{(0,d.isGLowModel)(e)&&this.modelMap.set((0,W.Ki)(e),n)})),this.afterGLowModelSet())})),e.add("pp-set-glow",(e=>{var{model:e,val:t}=e;0===t&&0===this.modelMap.size||this[0===t?"glowRemove":"glowAdd"](e)})),t.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowAdd(e)})),r.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowRemove(e)}))}glowAdd(e){this.modelMap.set(e.userData.id,e.visible),this.afterGLowModelSet()}glowRemove(e){this.modelMap.delete(e.userData.id),this.afterGLowModelSet()}afterGLowModelSet(){var e=0<this.modelMap.size&&this.modelMap.find(((e,t)=>!0===t))||!1;this.runScene.pp.params.glow.isBloom!==e&&(this.runScene.cb.pp.glow.setStatus.cb(e),this.runScene.pp.params.glow.isBloom=e)}initOutline(){const{setOutline:e,add:t,remove:r}=this.runScene.cb.model;e.add("pp-set-outline",(e=>{var{model:e,val:t}=e;!t&&0===this.outlineModelLength.size||this[t?"outlineAdd":"outlineRemove"](e)})),t.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineAdd(e)})),r.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineRemove(e)}))}outlineAdd(e){this.outlineModelLength.add(e.userData.id),0<this.outlineModelLength.size&&(this.runScene.cb.pp.outline.setStatus.cb(!0),this.runScene.pp.params.outline.isOutline=!0)}outlineRemove(e){this.outlineModelLength.delete(e.userData.id),this.outlineModelLength.size<=0&&(this.runScene.cb.pp.outline.setStatus.cb(!1),this.runScene.pp.params.outline.isOutline=!1)}}var bn=r(6608),yn=r(5180),xn=r(4819),wn={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new s.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};function Sn(e){return(Sn="function"==typeof Symbol&&"symbol"==typeof 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 Mn(e,t){return(Mn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Tn(e){return(Tn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _n=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Mn(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Tn(e);if(r=t?(r=Tn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Sn(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i){var o;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(o=r.call(this)).strength=void 0!==t?t:1,o.radius=a,o.threshold=i,o.resolution=void 0!==e?new s.Vector2(e.x,e.y):new s.Vector2(256,256),o.clearColor=new s.Color(0,0,0),o.renderTargetsHorizontal=[],o.renderTargetsVertical=[],o.nMips=5;var l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2);o.renderTargetBright=new s.WebGLRenderTarget(l,c,{type:s.HalfFloatType}),o.renderTargetBright.texture.name="UnrealBloomPass.bright",o.renderTargetBright.texture.generateMipmaps=!1;for(var u=0;u<o.nMips;u++){var d;((d=new s.WebGLRenderTarget(l,c,{type:s.HalfFloatType})).texture.name="UnrealBloomPass.h"+u,d.texture.generateMipmaps=!1,o.renderTargetsHorizontal.push(d),d=new s.WebGLRenderTarget(l,c,{type:s.HalfFloatType})).texture.name="UnrealBloomPass.v"+u,d.texture.generateMipmaps=!1,o.renderTargetsVertical.push(d),l=Math.round(l/2),c=Math.round(c/2)}a=wn;for(var h=(o.highPassUniforms=s.UniformsUtils.clone(a.uniforms),o.highPassUniforms.luminosityThreshold.value=i,o.highPassUniforms.smoothWidth.value=.01,o.materialHighPassFilter=new s.ShaderMaterial({uniforms:o.highPassUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{}}),o.separableBlurMaterials=[],[3,5,7,9,11]),p=(l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2),0);p<o.nMips;p++)o.separableBlurMaterials.push(o.getSeperableBlurMaterial(h[p])),o.separableBlurMaterials[p].uniforms.texSize.value=new s.Vector2(l,c),l=Math.round(l/2),c=Math.round(c/2);return o.compositeMaterial=o.getCompositeMaterial(o.nMips),o.compositeMaterial.uniforms.blurTexture1.value=o.renderTargetsVertical[0].texture,o.compositeMaterial.uniforms.blurTexture2.value=o.renderTargetsVertical[1].texture,o.compositeMaterial.uniforms.blurTexture3.value=o.renderTargetsVertical[2].texture,o.compositeMaterial.uniforms.blurTexture4.value=o.renderTargetsVertical[3].texture,o.compositeMaterial.uniforms.blurTexture5.value=o.renderTargetsVertical[4].texture,o.compositeMaterial.uniforms.bloomStrength.value=t,o.compositeMaterial.uniforms.bloomRadius.value=.1,o.compositeMaterial.needsUpdate=!0,o.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],o.bloomTintColors=[new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1)],o.compositeMaterial.uniforms.bloomTintColors.value=o.bloomTintColors,e=bn.C,o.copyUniforms=s.UniformsUtils.clone(e.uniforms),o.copyUniforms.opacity.value=1,o.materialCopy=new s.ShaderMaterial({uniforms:o.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:s.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),o.enabled=!0,o.needsSwap=!1,o._oldClearColor=new s.Color,o.oldClearAlpha=1,o.basic=new s.MeshBasicMaterial,o.fsQuad=new xn.T(null),o}return t=n,(e=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose();for(var r=0;r<this.separableBlurMaterials.length;r++)this.separableBlurMaterials[r].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){var r=Math.round(e/2),n=Math.round(t/2);this.renderTargetBright.setSize(r,n);for(var a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(r,n),this.renderTargetsVertical[a].setSize(r,n),this.separableBlurMaterials[a].uniforms.texSize.value=new s.Vector2(r,n),r=Math.round(r/2),n=Math.round(n/2)}},{key:"render",value:function(e,t,r,a,i){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var s=e.autoClear,o=(e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s}},{key:"getSeperableBlurMaterial",value:function(e){return new s.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new s.Vector2(.5,.5)},direction:{value:new s.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}},{key:"getCompositeMaterial",value:function(e){return new s.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(xn.w);_n.BlurDirectionX=new s.Vector2(1,0),_n.BlurDirectionY=new s.Vector2(0,1);class En extends xn.w{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof s.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=s.UniformsUtils.clone(e.uniforms),this.material=new s.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new xn.T(this.material)}render(e,t,r){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class Dn extends xn.w{constructor(e,t,r,n,a){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=n,this.clearAlpha=void 0!==a?a:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new s.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let a,i;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),a=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.scene.background=this.sceneBg,this.clearColor&&e.setClearColor(this.oldClearColor,a),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),this.scene.background=this.sceneBg,e.autoClear=n}}const On={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 kn{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomRenderPass?(this.bloomRenderPass.scene=this.mtuPP.mainScene,this.bloomRenderPass.camera=this.mtuPP.mainCamera):(this.bloomRenderPass=new Dn(this.mtuPP.mainScene,this.mtuPP.mainCamera),this.bloomRenderPass.layerIndex=this.mtuPP.BLOOM_SCENE,this.bloomRenderPass.clearDepth=!1),this.bloomPass?this.bloomPass.setSize(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y):this.bloomPass=new _n(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 En(On,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new yn.T(bn.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 Pn(e){return(Pn="function"==typeof Symbol&&"symbol"==typeof 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 An(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ln(e,t,r){t&&Cn(e.prototype,t),r&&Cn(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Rn(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&&In(e,t)}function In(e,t){return(In=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Bn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=jn(e);if(r=t?(r=jn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Pn(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function jn(e){return(jn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Un=function(){Rn(t,xn.w);var e=Bn(t);function t(r,n){var a;return An(this,t),(a=e.call(this)).scene=r,a.camera=n,a.clear=!0,a.needsSwap=!1,a.inverse=!1,a}return Ln(t,[{key:"render",value:function(e,t,r){var n,a,i=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0),a=this.inverse?(n=0,1):(n=1,0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),s.buffers.stencil.setFunc(i.ALWAYS,n,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(i.EQUAL,1,4294967295),s.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),s.buffers.stencil.setLocked(!0)}}]),t}(),Nn=function(){Rn(t,xn.w);var e=Bn(t);function t(){var r;return An(this,t),(r=e.call(this)).needsSwap=!1,r}return Ln(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();var zn=function(){function e(t,r){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.renderer=t,this._pixelRatio=t.getPixelRatio(),void 0===r?(t=t.getSize(new s.Vector2),this._width=t.width,this._height=t.height,(r=new s.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:s.HalfFloatType})).texture.name="EffectComposer.rt1"):(this._width=r.width,this._height=r.height),this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new yn.T(bn.C),this.clock=new s.Clock}var t,r;return t=e,(r=[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),r=!1,n=0,a=this.passes.length;n<a;n++){var i,s,o=this.passes[n];!1!==o.enabled&&(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),o.needsSwap&&(r&&(i=this.renderer.getContext(),(s=this.renderer.state.buffers.stencil).setFunc(i.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),s.setFunc(i.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==Un&&(o instanceof Un?r=!0:o instanceof Nn&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new s.Vector2),this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var r=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(r,n),this.renderTarget2.setSize(r,n);for(var a=0;a<this.passes.length;a++)this.passes[a].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}},{key:"dispose",value:function(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const Fn="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",Vn="\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 Gn{constructor(e){this.mtuPP=e,this.bloomLayer=new Pa.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new Pa.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new Pa.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new _n(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 yn.T(new Pa.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:Fn,fragmentShader:Vn,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new Pa.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.params.pp.samples});this.finalComposer=new zn(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 Hn=r(228);class Zn extends s.ShaderMaterial{constructor(...e){super(...e),["opacity","map","emissiveMap","roughnessMap","metalnessMap"].forEach((e=>{Object.defineProperty(this,e,{get(){if(e in this.uniforms)return this.uniforms[e].value},set(t){e in this.uniforms&&(this.uniforms[e].value=t)}})}))}}class Wn extends Zn{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const r=this.defines,n=this.modifiedDefines;null==t?e in r&&(e in n||(n[e]=r[e]),delete r[e]):r[e]!==t&&(e in n||(n[e]=e in r?r[e]:void 0),r[e]=t)}setTextureUniform(e,t){const r=this.uniforms,n=this.modifiedUniforms;e in n||(n[e]=r[e].value),r[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const r in e)void 0===e[r]?r in t&&(this.needsUpdate=!0):t[r]!==e[r]&&(this.needsUpdate=!0),delete e[r];const r=this.modifiedUniforms;var n=this.uniforms;for(const e in r)r[e]!==n[e].value&&(this.needsUpdate=!0),delete r[e]}}const Kn=new WeakMap;class qn{constructor(e){this._replacementMaterial=new Wn(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,r=!0){const n=this;function a(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!i.has(e)){const t=n.createMaterial(e);i.set(e,t)}const t=i.get(e);if(null!==t){let a=e.material;r?s.set(e,a):a=s.get(e),a||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),n.updateUniforms(e,a,t),t.finalize&&t.finalize(),e.material=t}}}const i=this._replacementMaterials,s=Kn;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)e[t].traverse(a);else for(let t=0,r=e.length;t<r;t++)a(e[t]);else t?e.traverse(a):a(e)}reset(e,t){function r(e){e.isHelper||(n.has(e)?(e.material=n.get(e),n.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const n=Kn;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)r(e[t]);else for(let t=0,n=e.length;t<n;t++)e[t].traverse(r);else t?e.traverse(r):r(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,r){var n=this._replacementMaterial.defines,a=t.defines;const i=r.defines;if(r.side=t.side,r.flatShading=t.flatShading,r.skinning=t.skinning,a){for(const e in a)r.setDefine(e,a[e]);for(const e in i)e in a?r.setDefine(e,a[e]):r.setDefine(e,n[e])}const s=r.uniforms;if(t.isShaderMaterial){var o=t.uniforms;for(const e in s){var l=o[e];const t=s[e];l&&l.value!==t.value&&(t.value&&t.value.isTexture||l.value&&l.value.isTexture?r.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in s){const n=s[e];e in t&&t[e]!==n.value&&(n.value&&n.value.isTexture||t[e]&&t[e].isTexture?r.setTextureUniform(e,t[e]):n.value=t[e])}var{overrideDefines:c,overrideUniforms:u}=this;for(const e in c)null===c[e]||void 0===c[e]?delete i[e]:i[e]!==c[e]&&(i[e]=c[e],r.needsUpdate=!0);for(const e in u)e in s&&(s[e].value=u[e].value)}dispose(){}}class Xn extends qn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:s.ShaderLib.normal.vertexShader,fragmentShader:"\n\t\t\t\t#define NORMAL\n\t\t\t\tuniform float opacity;\n\t\t\t\t#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#endif\n\t\t\t\t#ifndef FLAT_SHADED\n\t\t\t\t\tvarying vec3 vNormal;\n\t\t\t\t\t#ifdef USE_TANGENT\n\t\t\t\t\t\tvarying vec3 vTangent;\n\t\t\t\t\t\tvarying vec3 vBitangent;\n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#include <packing>\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\t#include <normal_fragment_begin>\n\t\t\t\t\t#include <normal_fragment_maps>\n\t\t\t\t\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t\t\t\t}\n\t\t\t"}),this.useNormalMaps=!1}createMaterial(...e){return super.createMaterial(...e)}updateUniforms(e,t,r){super.updateUniforms(e,t,r),r.setDefine("USE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("ALPHATEST",r.uniforms.alphaTest.value||void 0),r.setDefine("USE_ALPHAMAP",0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?"":void 0),r.setDefine("USE_MAP",0!==r.defines.ALPHATEST&&r.uniforms.map.value?"":void 0),r.setDefine("USE_UV","USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?"":void 0)}}class Yn extends qn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:"\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <common>\n\t\t\t\t#include <uv_pars_vertex>\n\t\t\t\t#include <displacementmap_pars_vertex>\n\t\t\t\t#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\t\t\t\t#include <clipping_planes_pars_vertex>\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include <uv_vertex>\n\t\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t\t#include <morphnormal_vertex>\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <displacementmap_vertex>\n\t\t\t\t\t#include <project_vertex>\n\t\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t\t#include <clipping_planes_vertex>\n\t\t\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\t\tuniform float opacity;\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\tgl_FragColor = vec4( vViewPosition.z );\n\t\t\t\t}\n\t\t\t"}),this.invertSide=!1}updateUniforms(e,t,r){super.updateUniforms(e,t,r),this.invertSide&&(r.side=r.side===s.FrontSide?s.BackSide:s.FrontSide),e=r.defines.ALPHATEST,0===r.uniforms.alphaTest.value?delete r.defines.ALPHATEST:r.defines.ALPHATEST=r.uniforms.alphaTest.value,e!==r.defines.ALPHATEST&&(r.needsUpdate=!0),e=r.defines.USE_ALPHAMAP,0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?r.defines.USE_ALPHAMAP="":delete r.defines.USE_ALPHAMAP,e!==r.defines.USE_ALPHAMAP&&(r.needsUpdate=!0),e=r.defines.USE_MAP,0!==r.defines.ALPHATEST&&r.uniforms.map.value?r.defines.USE_MAP="":delete r.defines.USE_MAP,e!==r.defines.USE_MAP&&(r.needsUpdate=!0),e=r.defines.USE_UV,"USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?r.defines.USE_UV="":delete r.defines.USE_UV,e!==r.defines.USE_UV&&(r.needsUpdate=!0)}}const Qn={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"},Jn={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"},$n={defines:{NUM_DIRECTIONS:32,NUM_STEPS:16,RADIUS:"2.0",ENABLE_FALLOFF:1,FALLOFF_START2:"0.16",FALLOFF_END2:"4.0",ENABLE_ROTATION_JITTER:1,ENABLE_RADIUS_JITTER:1,ENABLE_COLOR_BOUNCE:1,JITTER_TYPE:0},uniforms:{colorBuffer:{value:null},normalBuffer:{value:null},depthBuffer:{value:null},renderSize:{value:new s.Vector2},blueNoiseTex:{value:null},blueNoiseSize:{value:1},clipInfo:{value:new s.Vector4},projInfo:{value:new s.Vector4},params:{value:new s.Vector2},lightBounceIntensity:{value:1}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\t#define TWO_PI\t\t\t6.2831853071795864\n\t\t#define HALF_PI\t\t\t1.5707963267948966\n\t\t#define ONE_OVER_PI\t\t0.3183098861837906\n\n\t\t#include <common>\n\t\t#include <packing>\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D noiseTexture;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform vec2 renderSize;\n\n\t\tuniform vec4 projInfo;\n\t\tuniform vec4 clipInfo;\n\t\tuniform vec4 params;\n\t\tuniform float lightBounceIntensity;\n\n\t\t#if ENABLE_ROTATION_JITTER == 2 || ENABLE_RADIUS_JITTER == 2\n\t\tuniform float blueNoiseSize;\n\t\tuniform sampler2D blueNoiseTex;\n\t\t#endif\n\n\t\tfloat roundF(float f) {\n\t\t\treturn f < 0.5 ? floor(f) : ceil(f);\n\t\t}\n\n\t\tvec2 roundV2(vec2 v) {\n\t\t\tv.x = roundF(v.x);\n\t\t\tv.y = roundF(v.y);\n\t\t\treturn v;\n\t\t}\n\n\t\tvec3 UnpackNormal(vec4 d) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec4 GetViewPosition( vec2 uv ) {\n\n\t\t\tfloat near = clipInfo.x;\n\t\t\tfloat far = clipInfo.y;\n\n\t\t\tvec2 basesize = renderSize;\n\t\t\tvec2 coord = ( uv / basesize );\n\n\t\t\t// d is expected to be [ 0.0, 1.0 ]\n\t\t\tfloat d = texture2D( depthBuffer, coord ).r;\n\t\t\td = d == 0.0 ? far : d;\n\t\t\td = ( abs( d ) - near ) / ( far - near );\n\n\t\t\tvec4 ret = vec4( 0.0 );\n\t\t\tret.w = d;\n\t\t\tret.z = near + d * ( far - near );\n\t\t\tret.xy = ( uv * projInfo.xy + projInfo.zw ) * ret.z;\n\n\t\t\treturn ret;\n\n\t\t}\n\n\t\tfloat Falloff( float dist2 ) {\n\n\t\t\treturn 2.0 * clamp(\n\t\t\t\t( dist2 - FALLOFF_START2 ) / ( FALLOFF_END2 - FALLOFF_START2 ),\n\t\t\t\t0.0,\n\t\t\t\t1.0\n\t\t\t);\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec2 screenCoord = gl_FragCoord.xy;\n\t\t\tvec4 vpos = GetViewPosition( renderSize * vUv );\n\n\t\t\t// if it's the background\n\t\t\tif ( vpos.w == 1.0 ) {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0);\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tvec4 s;\n\t\t\tvec3 vnorm\t= UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tvec3 vdir\t= normalize( - vpos.xyz );\n\t\t\tvec3 dir, ws;\n\n\t\t\t// calculation uses left handed system\n\t\t\tvnorm.z = - vnorm.z;\n\n\t\t\tvec2 noises\t= vec2( 0.0 );\n\t\t\tvec2 offset;\n\t\t\tvec2 horizons = vec2( - 1.0, - 1.0 );\n\n\t\t\t// scale the search radius by the depth and camera FOV\n\t\t\tfloat radius = ( RADIUS * clipInfo.z ) / vpos.z;\n\t\t\tradius = max( float( NUM_STEPS ), radius );\n\n\t\t\tfloat stepSize\t= radius / float( NUM_STEPS );\n\t\t\tfloat phi\t\t= 0.0;\n\t\t\tfloat ao\t\t= 0.0;\n\t\t\tfloat division\t= noises.y * stepSize;\n\t\t\tfloat currStep\t= 1.0 + division + 0.25 * stepSize * params.y;\n\t\t\tfloat dist2, invdist, falloff, cosh;\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\t\t\tvec3 color = vec3( 0.0 );\n\t\t\t#endif\n\n\t\t\t#if ENABLE_ROTATION_JITTER == 1\n\n\t\t\t// Rotation jitter approach from\n\t\t\t// https://github.com/MaxwellGengYF/Unity-Ground-Truth-Ambient-Occlusion/blob/9cc30e0f31eb950a994c71866d79b2798d1c508e/Shaders/GTAO_Common.cginc#L152-L155\n\t\t\tfloat rotJitterOffset = PI * fract( 52.9829189 * fract( dot( screenCoord, vec2( 0.06711056, 0.00583715 ) ) ) );\n\n\t\t\t#elif ENABLE_ROTATION_JITTER == 2\n\n\t\t\tfloat rotJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).r;\n\n\t\t\t#endif\n\n\t\t\t#if ENABLE_RADIUS_JITTER == 1\n\n\t\t\tfloat jitterMod = ( gl_FragCoord.x + gl_FragCoord.y ) * 0.25;\n\t\t\tfloat radiusJitterOffset = mod( jitterMod, 1.0 ) * stepSize * 0.25;\n\n\t\t\t#elif ENABLE_RADIUS_JITTER == 2\n\n\t\t\tfloat radiusJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).g;\n\n\t\t\t#endif\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < NUM_DIRECTIONS; i ++ ) {\n\n\t\t\t\tphi = float( i ) * ( PI / float( NUM_DIRECTIONS ) ) + params.x * PI;\n\n\t\t\t\t#if ENABLE_ROTATION_JITTER != 0\n\n\t\t\t\tphi += rotJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tcurrStep = 1.0 + 0.25 * stepSize * params.y;\n\n\n\t\t\t\t#if ENABLE_RADIUS_JITTER != 0\n\n\t\t\t\tcurrStep += radiusJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tdir = vec3( cos( phi ), sin( phi ), 0.0 );\n\t\t\t\thorizons = vec2( - 1.0 );\n\n\t\t\t\t// calculate horizon angles\n\t\t\t\tfor ( int j = 0; j < NUM_STEPS; ++ j ) {\n\n\t\t\t\t\toffset = roundV2(dir.xy * currStep);\n\n\t\t\t\t\t// h1\n\t\t\t\t\ts = GetViewPosition( screenCoord + offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.x = max( horizons.x, cosh - falloff );\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tvec3 ptColor, ptDir;\n\t\t\t\t\tfloat alpha;\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord + offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\t// h2\n\t\t\t\t\ts = GetViewPosition( screenCoord - offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.y = max( horizons.y, cosh - falloff );\n\n\t\t\t\t\t// increment\n\t\t\t\t\tcurrStep += stepSize;\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord - offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t}\n\n\t\t\t\thorizons = acos( horizons );\n\n\t\t\t\t// calculate gamma\n\t\t\t\tvec3 bitangent\t= normalize( cross( dir, vdir ) );\n\t\t\t\tvec3 tangent\t= cross( vdir, bitangent );\n\t\t\t\tvec3 nx\t\t\t= vnorm - bitangent * dot( vnorm, bitangent );\n\n\t\t\t\tfloat nnx\t\t= length( nx );\n\t\t\t\tfloat invnnx\t= 1.0 / ( nnx + 1e-6 );\t\t\t// to avoid division with zero\n\t\t\t\tfloat cosxi\t\t= dot( nx, tangent ) * invnnx;\t// xi = gamma + HALF_PI\n\t\t\t\tfloat gamma\t\t= acos( cosxi ) - HALF_PI;\n\t\t\t\tfloat cosgamma\t= dot( nx, vdir ) * invnnx;\n\t\t\t\tfloat singamma2\t= - 2.0 * cosxi;\t\t\t\t\t// cos(x + HALF_PI) = -sin(x)\n\n\t\t\t\t// clamp to normal hemisphere\n\t\t\t\thorizons.x = gamma + max( - horizons.x - gamma, - HALF_PI );\n\t\t\t\thorizons.y = gamma + min( horizons.y - gamma, HALF_PI );\n\n\t\t\t\t// Riemann integral is additive\n\t\t\t\tao += nnx * 0.25 * (\n\t\t\t\t\t( horizons.x * singamma2 + cosgamma - cos( 2.0 * horizons.x - gamma ) ) +\n\t\t\t\t\t( horizons.y * singamma2 + cosgamma - cos( 2.0 * horizons.y - gamma ) ) );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// PDF = 1 / pi and must normalize with pi because of Lambert\n\t\t\tao = ao / float( NUM_DIRECTIONS );\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\tcolor /= float( NUM_STEPS * NUM_DIRECTIONS ) * 2.0 / lightBounceIntensity;\n\t\t\tgl_FragColor = vec4( color, ao );\n\n\t\t\t#else\n\n\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, ao );\n\n\t\t\t#endif\n\t\t}\n\t"},ea={defines:{BLUR_ITERATIONS:5,BLUR_MODE:0,AO_ONLY:0,COLOR_ONLY:0,DEPTH_THRESHOLD:"5e-1"},uniforms:{fullSize:{value:new s.Vector2},aoSize:{value:new s.Vector2},normalBuffer:{value:null},depthBuffer:{value:null},colorBuffer:{value:null},gtaoBuffer:{value:null},intensity:{value:1},blurStride:{value:1},ambientColor:{value:new s.Color},ambientIntensity:{value:0}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform vec3 ambientColor;\n\t\tuniform float ambientIntensity;\n\t\tuniform vec2 aoSize;\n\t\tuniform vec2 fullSize;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D gtaoBuffer;\n\t\tuniform float intensity;\n\t\tuniform int blurStride;\n\n\t\tvec3 UnpackNormal( vec4 d ) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec3 MultiBounce( float ao, vec3 albedo ) {\n\t\t\tvec3 x = vec3( ao );\n\t\t\tvec3 a = 2.0404 * albedo - vec3( 0.3324 );\n\t\t\tvec3 b = -4.7951 * albedo + vec3( 0.6417 );\n\t\t\tvec3 c = 2.7552 * albedo + vec3( 0.6903 );\n\t\t\treturn max( x, ( ( x * a + b ) * x + c ) * x );\n\t\t}\n\n\t\tvoid main() {\n\t\t\tvec4 color = texture2D( colorBuffer, vUv );\n\t\t\t// NO_BLUR\n\t\t\t#if BLUR_MODE == 0\n\t\t\t\tvec4 accumSample = texture2D( gtaoBuffer, vUv );\n\t\t\t#else\n\t\t\tvec2 currTexel = vUv * fullSize;\n\t\t\tvec2 currAoTexel = vUv * aoSize;\n\n\t\t\t// aoPixels per full size ones. Should be 1/2 at\n\t\t\tvec2 texelRatio = aoSize / fullSize;\n\n\t\t\tvec3 currNormal = UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tfloat currDepth = texture2D( depthBuffer, vUv ).r;\n\n\t\t\t// TODO: pull this sampling out into a function\n\t\t\tvec4 accumSample = vec4( 0.0 );\n\t\t\tfloat totalWeight = 1e-10;\n\t\t\tfloat pixelOffset = - float( BLUR_ITERATIONS ) / 2.0;\n\t\t\tpixelOffset += mod( float( BLUR_ITERATIONS ), 2.0 ) == 0.0 ? 0.0 : 0.5;\n\t\t\tpixelOffset *= float( blurStride );\n\n\t\t\t// BOX_BLUR\n\t\t\t#if BLUR_MODE == 1\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int x = 0; x < BLUR_ITERATIONS; x ++ ) {\n\n\t\t\t\t#pragma unroll_loop_start\n\t\t\t\tfor ( int y = 0; y < BLUR_ITERATIONS; y ++ ) {\n\n\t\t\t\t\tvec2 step = vec2( float( x ), float( y ) ) * float( blurStride );\n\n\t\t\t\t\t// iterate over full res pixels\n\t\t\t\t\tvec2 offsetUv = currTexel + ( pixelOffset + step ) / texelRatio;\n\t\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\t\t// get the associated pixel in the AO buffer\n\t\t\t\t\tvec2 aoUv = currAoTexel + pixelOffset + step;\n\t\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t\t// if the pixels are close enough in space then blur them together\n\t\t\t\t\tfloat offsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\t\tif ( abs( offsetDepth - currDepth ) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\t\t// Weigh the sample based on normal similarity\n\t\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\t\tfloat weight = max( 0.0, dot( offsetNormal, currNormal ) );\n\n\t\t\t\t\t\t// square the weight to give pixels with a closer normal even higher priority\n\t\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\t\t// accumulate\n\t\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// CROSS_BLUR\n\t\t\t#elif BLUR_MODE == 2\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// DIAGONAL_BLUR\n\t\t\t#elif BLUR_MODE == 3\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t#endif\n\n\t\t\taccumSample /= totalWeight;\n\n\t\t\t#endif\n\n\t\t\tfloat gtao = accumSample.a;\n\n\t\t\t#if COLOR_ONLY\n\n\t\t\tgl_FragColor = vec4( accumSample.rgb, 1.0 );\n\n\t\t\t#elif AO_ONLY\n\n\t\t\tvec3 rgb = mix( vec3( 1.0 ), vec3( accumSample.a ), intensity );\n\t\t\tgl_FragColor = vec4( rgb, 1.0 );\n\n\t\t\t#else\n\n\t\t\tvec3 rgb = mix( color.rgb, color.rgb * MultiBounce( gtao, color.rgb ), intensity );\n\t\t\tvec3 delta = color.rgb - rgb;\n\t\t\tvec3 ambient = ambientColor * delta * ambientIntensity;\n\n\t\t\tfloat colorFade = ( 1.0 - pow( 1.0 - gtao, 2.0 ) );\n\t\t\tgl_FragColor = vec4( rgb + ambient + accumSample.rgb * ( 0.75 + colorFade * 0.25 ), color.a );\n\n\t\t\t#endif\n\n\t\t}\n\t\t"};class ta{constructor(e){this.count=0,this.size=-1,this.sigma=-1,this.radius=-1,this.lookupTable=null,this.score=null,this.binaryPattern=null,this.resize(e),this.setSigma(1.5)}findVoid(){var e,{score:t,binaryPattern:r}=this;let n=1/0,a=-1;for(let i=0,s=r.length;i<s;i++)0===r[i]&&(e=t[i])<n&&(n=e,a=i);return a}findCluster(){var e,{score:t,binaryPattern:r}=this;let n=-1/0,a=-1;for(let i=0,s=r.length;i<s;i++)1===r[i]&&(e=t[i])>n&&(n=e,a=i);return a}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),r=2*t+1;const s=new Float32Array(r*r);var n=e*e;for(let e=-t;e<=t;e++)for(let o=-t;o<=t;o++){var a=(t+o)*r+e+t,i=e*e+o*o;s[a]=Math.pow(Math.E,-i/(2*n))}this.lookupTable=s,this.sigma=e,this.radius=t}}resize(e){this.size!==e&&(this.size=e,this.score=new Float32Array(e*e),this.binaryPattern=new Uint8Array(e*e))}invert(){const{binaryPattern:e,score:t,size:r}=this;t.fill(0);for(let t=0,i=e.length;t<i;t++){var n,a;0===e[t]?(n=~~(t/r),a=t-n*r,this.updateScore(a,n,1),e[t]=1):e[t]=0}}updateScore(e,t,r){const{size:n,score:a,lookupTable:i}=this;var s=this.radius,o=2*s+1;for(let u=-s;u<=s;u++)for(let d=-s;d<=s;d++){var l=i[(s+d)*o+u+s];let h=e+u,p=(h=h<0?n+h:h%n,t+d);var c=(p=p<0?n+p:p%n)*n+h;a[c]+=r*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,-1),this.count--}copy(e){this.resize(e.size),this.score.set(e.score),this.binaryPattern.set(e.binaryPattern),this.setSigma(e.sigma),this.count=e.count}}class ra{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new ta(1),this.savedSamples=new ta(1)}generate(){const{samples:e,savedSamples:t,sigma:r,majorityPointsRatio:n,size:a}=this;e.resize(a),e.setSigma(r);var i=Math.floor(a*a*n),s=e.binaryPattern,o=s,l=i;o.fill(0);for(let e=0;e<l;e++)o[e]=1;var[c,u=Math.random]=[s,this.random];for(let e=c.length-1;0<e;e--){var d=~~((u()-1e-6)*e),h=c[e];c[e]=c[d],c[d]=h}for(let t=0,r=s.length;t<r;t++)1===s[t]&&e.addPointIndex(t);for(;;){var p=e.findCluster(),m=(e.removePointIndex(p),e.findVoid());if(p===m){e.addPointIndex(p);break}e.addPointIndex(m)}const f=new Uint32Array(a*a);let g;for(t.copy(e),g=e.count-1;0<=g;){var v=e.findCluster();e.removePointIndex(v),f[v]=g,g--}var b=a*a;for(g=t.count;g<b/2;){var y=t.findVoid();t.addPointIndex(y),f[y]=g,g++}for(t.invert();g<b;){var x=t.findCluster();t.removePointIndex(x),f[x]=g,g++}return{data:f,maxValue:b}}}class na extends xn.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:na.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=na.BOX_BLUR,this.blurIterations=4,this.blurStride=1,this.enableFalloff=!0,this.falloffStart=.4,this.falloffEnd=2,this.ambientColor=new s.Color,this.ambientIntensity=0,this.lightBounceIntensity=1,this._gtaoBuffer=new s.WebGLRenderTarget(1,1,{format:s.RGBAFormat}),this._depthBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat,type:s.HalfFloatType}),this._depthReplacement=new Yn,this._normalBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat}),this._normalReplacement=new Xn,this.gtaoQuad=new xn.T(new s.ShaderMaterial($n)),this.debugPackedQuad=new xn.T(new s.ShaderMaterial(Qn)),this.debugDepthQuad=new xn.T(new s.ShaderMaterial(Jn)),this.compositeQuad=new xn.T(new s.ShaderMaterial(ea));const r=new ra,n=(r.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var a=r.generate(),i=a.data,o=a.maxValue;for(let t=0,r=i.length;t<r;t++)n[4*t+e]=i[t]/o*255}this.blueNoiseTex=new s.DataTexture(n,r.size,r.size,s.RGBAFormat),this.blueNoiseTex.wrapS=s.RepeatWrapping,this.blueNoiseTex.wrapT=s.RepeatWrapping,this.blueNoiseTex.minFilter=s.LinearFilter,this.blueNoiseTex.needsUpdate=!0}dispose(){}setSize(e,t){var r=this.renderTargetScale,n=Math.floor(e*r);r=Math.floor(t*r),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(n,r)}render(e,t,r){t=this.renderToScreen?null:t;const{scene:n,camera:a,debug:i,debugPackedQuad:o,debugDepthQuad:l,compositeQuad:c,gtaoQuad:u}=this,d=u.material;na.RendererState.copy(e,n);var h=()=>{na.RendererState.restore(e,n),m.reset(n,!0)},p=this._depthBuffer;const m=this._depthReplacement;if(n.background=null,m.replace(n,!0,!0),e.setRenderTarget(p),e.setClearColor(na.BlackColor,0),e.clear(),e.render(n,a),i.display===na.DEPTH)return e.setRenderTarget(t),l.material.uniforms.texture.value=p.texture,l.render(e),void h();const f=this._normalReplacement;var g=this._normalBuffer;if(f.replace(n,!0,!1),e.setRenderTarget(g),e.clear(),e.render(n,a),i.display===na.NORMAL)return e.setRenderTarget(t),e.clear(),o.material.uniforms.displayRoughness.value=0,o.material.uniforms.texture.value=g.texture,o.render(e),void h();this.numSteps!==d.defines.NUM_STEPS&&(d.defines.NUM_STEPS=this.numSteps,d.needsUpdate=!0),this.numDirections!==d.defines.NUM_DIRECTIONS&&(d.defines.NUM_DIRECTIONS=this.numDirections,d.needsUpdate=!0),this.radius.toFixed(16)!==d.defines.RADIUS&&(d.defines.RADIUS=this.radius.toFixed(16),d.needsUpdate=!0),Math.pow(this.falloffStart,2).toFixed(16)===d.defines.FALLOFF_START2&&Math.pow(this.falloffEnd,2).toFixed(16)===d.defines.FALLOFF_END2&&this.enableFalloff===Boolean(d.defines.ENABLE_FALLOFF)||(d.defines.FALLOFF_START2=Math.pow(this.falloffStart,2).toFixed(16),d.defines.FALLOFF_END2=Math.pow(this.falloffEnd,2).toFixed(16),d.defines.ENABLE_FALLOFF=this.enableFalloff?1:0,d.needsUpdate=!0),this.rotationJitter!==d.defines.ENABLE_ROTATION_JITTER&&(d.defines.ENABLE_ROTATION_JITTER=this.rotationJitter,d.needsUpdate=!0),this.radiusJitter!==d.defines.ENABLE_RADIUS_JITTER&&(d.defines.ENABLE_RADIUS_JITTER=this.radiusJitter,d.needsUpdate=!0),0!==this.lightBounceIntensity!==Boolean(d.defines.ENABLE_COLOR_BOUNCE)&&(d.defines.ENABLE_COLOR_BOUNCE=0!==this.lightBounceIntensity?1:0,d.needsUpdate=!0);var v=this._gtaoBuffer,b=Math.floor(v.texture.image.width),y=Math.floor(v.texture.image.height),x=a.projectionMatrix,w=s.MathUtils.DEG2RAD*a.fov;d.uniforms.params.value.set(this.directionOffset,this.stepOffset),d.uniforms.projInfo.value.set(2/(b*x.elements[0]),2/(y*x.elements[5]),-1/x.elements[0],-1/x.elements[5]),d.uniforms.clipInfo.value.set(a.near,a.far,y/(2*Math.tan(.5*w))*.5,0),d.uniforms.normalBuffer.value=g.texture,d.uniforms.depthBuffer.value=p.texture,d.uniforms.colorBuffer.value=r.texture,d.uniforms.lightBounceIntensity.value=this.lightBounceIntensity,d.uniforms.renderSize.value.set(Math.floor(v.texture.image.width),Math.floor(v.texture.image.height)),d.uniforms.blueNoiseTex.value=this.blueNoiseTex,d.uniforms.blueNoiseSize.value=this.blueNoiseTex.image.width,e.setRenderTarget(v),e.clear(),u.render(e);const S=c.material;S.uniforms.depthBuffer.value=p.texture,S.uniforms.normalBuffer.value=g.texture,S.uniforms.colorBuffer.value=r.texture,S.uniforms.gtaoBuffer.value=v.texture,S.uniforms.intensity.value=this.intensity,S.uniforms.aoSize.value.set(v.width,v.height),S.uniforms.fullSize.value.set(r.width,r.height),S.uniforms.blurStride.value=this.blurStride,S.uniforms.ambientColor.value.copy(this.ambientColor),S.uniforms.ambientIntensity.value=this.ambientIntensity,this.blurIterations!==S.defines.BLUR_ITERATIONS&&(S.defines.BLUR_ITERATIONS=this.blurIterations,S.needsUpdate=!0),this.blurMode!==S.defines.BLUR_MODE&&(S.defines.BLUR_MODE=this.blurMode,S.needsUpdate=!0),i.display===na.AO_SAMPLE?1!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=1,S.needsUpdate=!0):0!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=0,S.needsUpdate=!0),i.display===na.COLOR_SAMPLE?1!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=1,S.needsUpdate=!0):0!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=0,S.needsUpdate=!0),e.setRenderTarget(t),e.clear(),c.render(e),h()}}na.NO_JITTER=0,na.RANDOM_JITTER=1,na.BLUENOISE_JITTER=2,na.DEFAULT=0,na.DEPTH=1,na.NORMAL=2,na.AO_SAMPLE=3,na.COLOR_SAMPLE=4,na.NO_BLUR=0,na.BOX_BLUR=1,na.CROSS_BLUR=2,na.DIAGONAL_BLUR=3,na.BlackColor=new s.Color(0),na.RendererState=new class{constructor(){this.clearAlpha=0,this.clearColor=new s.Color,this.renderTarget=null,this.outputEncoding=s.LinearEncoding,this.overrideMaterial=null,this.shadowsEnabled=!1,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.background=null}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)}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),this.renderTarget=null,this.overrideMaterial=null}};class aa{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new na(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 Pa.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 ia(e){return(ia="function"==typeof Symbol&&"symbol"==typeof 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 sa(e,t){return(sa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function oa(e){return(oa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var la=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&sa(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=oa(e);if(r=t?(r=oa(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ia(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(this instanceof n)return(l=r.call(this)).scene=e,l.camera=t,l.overrideMaterial=a,l.clearColor=i,l.clearAlpha=void 0!==o?o:0,l.clear=!0,l.clearDepth=!1,l.needsSwap=!1,l._oldClearColor=new s.Color,l;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"render",value:function(e,t,r){var n,a,i=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),n=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,n),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=i}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(xn.w),ca={uniforms:{tDiffuse:{value:null},resolution:{value:new s.Vector2(1/1024,1/512)}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\tprecision highp float;\n\n\tuniform sampler2D tDiffuse;\n\n\tuniform vec2 resolution;\n\n\tvarying vec2 vUv;\n\n\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t//----------------------------------------------------------------------------------\n\t// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t// SDK Version: v3.00\n\t// Email: gameworks@nvidia.com\n\t// Site: http://developer.nvidia.com/\n\t//\n\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t//\n\t// Redistribution and use in source and binary forms, with or without\n\t// modification, are permitted provided that the following conditions\n\t// are met:\n\t// * Redistributions of source code must retain the above copyright\n\t// notice, this list of conditions and the following disclaimer.\n\t// * Redistributions in binary form must reproduce the above copyright\n\t// notice, this list of conditions and the following disclaimer in the\n\t// documentation and/or other materials provided with the distribution.\n\t// * Neither the name of NVIDIA CORPORATION nor the names of its\n\t// contributors may be used to endorse or promote products derived\n\t// from this software without specific prior written permission.\n\t//\n\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t//\n\t//----------------------------------------------------------------------------------\n\n\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t// For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t#endif\n\n\t/*--------------------------------------------------------------------------*/\n\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t/*--------------------------------------------------------------------------*/\n\n\t#define NUM_SAMPLES 5\n\n\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t}\n\n\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t============================================================================*/\n\n\t/*--------------------------------------------------------------------------*/\n\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t\t// locate the edge\n\t\t\t\t\tvec2 dirToEdge;\n\t\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t\t// . 2 . . 1 .\n\t\t\t\t\t// 1 0 2 ~= 0 0 1\n\t\t\t\t\t// . 1 . . 0 .\n\n\t\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t\t// . 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 H\n\n\t\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t\t// V 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 .\n\n\t\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t\t\t// 1 1 .\n\t\t\t\t\t\t\t// 0 0 1\n\t\t\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t\t\t// do a simple blur\n\t\t\t\t\t\t\treturn mix(\n\t\t\t\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t\t\t\t.4\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 . 1\n\t\t\t// 1 0 1 -> 0\n\t\t\t// . 0 . 1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsed = 0;\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\t\t\t\t\titerationsUsed = i;\n\n\t\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\t\tif(!doneN) {\n\t\t\t\t\t\t\tnDist += increment;\n\t\t\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!doneP) {\n\t\t\t\t\t\t\tpDist += increment;\n\t\t\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\t\trgbaM,\n\t\t\t\t\trgbaN,\n\t\t\t\t\tdist * .5\n\t\t\t);\n\t}\n\n\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\t\tvUv,\n\t\t\t\t\ttDiffuse,\n\t\t\t\t\tresolution,\n\t\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t}\n\t"},ua={name:"VignetteShader",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 da={radius:{type:"number",val:.6,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},strength:{type:"number",val:1.5,shortKey:"s",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},threshold:{type:"number",val:0,shortKey:"t",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}}},ha={edgeStrength:{type:"number",val:3,shortKey:"es",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeGlow:{type:"number",val:0,shortKey:"eg",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeThickness:{type:"number",val:1,shortKey:"et",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},pulsePeriod:{type:"number",val:0,shortKey:"pp",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},visibleEdgeColor:{type:"color_str",val:"#FFFFFF",shortKey:"vec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},hiddenEdgeColor:{type:"color_str",val:"#190A05",shortKey:"hec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}}},pa={directionOffset:{type:"number",val:0,shortKey:"do",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},stepOffset:{type:"number",val:0,shortKey:"so",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},rotationJitter:{type:"other",val:"NONE",shortKey:"roj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radiusJitter:{type:"other",val:"NONE",shortKey:"raj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numSteps:{type:"number",val:8,shortKey:"ns",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numDirections:{type:"number",val:1,shortKey:"nd",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},intensity:{type:"number",val:1,shortKey:"i",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radius:{type:"number",val:2,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},enableFalloff:{type:"other",val:!0,shortKey:"ef",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffStart:{type:"number",val:.4,shortKey:"fs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffEnd:{type:"number",val:2,shortKey:"fe",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},renderTargetScale:{type:"number",val:.5,shortKey:"rts",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurMode:{type:"other",val:"NO_BLUR",shortKey:"bm",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurIterations:{type:"number",val:5,shortKey:"bi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurStride:{type:"number",val:1,shortKey:"bs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientColor:{type:"color_str",val:"#FFFFFF",shortKey:"ac",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientIntensity:{type:"number",val:0,shortKey:"ai",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},lightBounceIntensity:{type:"number",val:0,shortKey:"lbi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}}};var ma=r(1398);class fa{constructor(e){this.params=this.getDefaultParams(),this.clean=()=>{this.resetParams(),this.reset()},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new Pa.Color(0),this.runScene=e,this.info=new vn(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new Pa.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 Pa.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,T.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:da}),this.runScene.snapshot.bind({name:"outline",target:this.params.outline,def:ha}),this.runScene.snapshot.bind({name:"ao",target:this.params.ao,def:pa,set:e=>{const t=e.snapshot.data.get("ao");t&&(ma.LV.set({def:pa,runScene:this.runScene,data:t,target:this.params.ao,map:e}),e.data.completedCbs.push((()=>{(0,i.mapObj)(pa,((e,r)=>{var{type:r,val:n,shortKey:a}=r;"other"===r&&this.setAOData(e,void 0!==t[a]?t[a]:n)}))})))}})}getDefaultParams(){return{pp:{samples:2},glow:{isBloom:!1,radius:.6,strength:1.5,threshold:0},outline:{isOutline:!1,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,visibleEdgeColor:"#FFFFFF",hiddenEdgeColor:"#190A05"},ao:{isAO:!1,directionOffset:0,stepOffset:0,rotationJitter:"NONE",radiusJitter:"NONE",numSteps:8,numDirections:1,intensity:1,radius:2,enableFalloff:!0,falloffStart:.4,falloffEnd:2,renderTargetScale:.5,blurMode:"NO_BLUR",blurIterations:5,blurStride:1,ambientColor:"#FFFFFF",ambientIntensity:0,lightBounceIntensity:0},vignette:{isVignette:!1,offset:1,darkness:1}}}resetParams(){(0,y.U)(this.params,this.getDefaultParams())}init(){try{var{camera:e,scene:t,renderer:r}=this.runScene.assetsEx.get();this.mainScene=t,this.mainCamera=e,this.renderer=r,this.renderer&&(this.renderer.getSize(this.rtSize),this.postProcessing())}catch(e){console.log("Error: ",e)}this.runScene.cb.loaderer.gltf.loadNode.add("outline-objects",(({node:e,nodeDef:t})=>{t.extras&&t.extras.outline&&this.mtOutline.addSelectedObject(e)}))}postProcessing(){this.effectComposer=new zn(this.renderer,this.getNewRenderTarget(this.params.pp.samples)),this.renderPass=new la(this.mainScene,this.mainCamera),this.fxaaPass=new yn.T(ca),this.fxaaPass.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight),this.vignettePass=new yn.T(ua),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass)}getNewRenderTarget(e){const t=new Pa.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new Pa.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=Pa.UnsignedIntType,t.depthTexture.format=Pa.DepthFormat,t.texture.format=Pa.RGBAFormat,t.texture.encoding=Pa.sRGBEncoding,t}ppOutline(){this.mtOutline=new Hn.Q(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new kn(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new Gn(this))}ppAO(){this.mtAO=new aa(this)}toJSON(){const e={};var{pp:t,glow:r,outline:n,ao:a,vignette:i}=this.params;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},r),e.outlineParams=Object.assign({},n),e.aoParams=Object.assign({},a),e.vignetteParams=Object.assign({},i),JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:r,aoParams:n,vignetteParams:a}=e;e&&(e=e.samples,this.params.pp.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))),t&&(this.params.glow.isBloom=t.isBloom,this.setGlowData("radius",t.radius),this.setGlowData("strength",t.strength),this.setGlowData("threshold",t.threshold),this.runScene.cb.pp.glow.setData.cb(this.params.glow)),r&&this.mtOutline&&(this.params.outline.isOutline=r.isOutline,this.setOutlineData("edgeStrength",r.edgeStrength),this.setOutlineData("edgeGlow",r.edgeGlow),this.setOutlineData("edgeThickness",r.edgeThickness),this.setOutlineData("pulsePeriod",r.pulsePeriod),this.setOutlineData("visibleEdgeColor",r.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",r.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.params.outline)),n&&this.mtAO&&(this.params.ao.isAO=n.isAO,this.setAOData("directionOffset",n.directionOffset),this.setAOData("stepOffset",n.stepOffset),this.setAOData("rotationJitter",n.rotationJitter),this.setAOData("radiusJitter",n.radiusJitter),this.setAOData("numSteps",n.numSteps),this.setAOData("numDirections",n.numDirections),this.setAOData("intensity",n.intensity),this.setAOData("radius",n.radius),this.setAOData("enableFalloff",n.enableFalloff),this.setAOData("falloffStart",n.falloffStart),this.setAOData("falloffEnd",n.falloffEnd),this.setAOData("renderTargetScale",n.renderTargetScale),this.setAOData("blurMode",n.blurMode),this.setAOData("blurIterations",n.blurIterations),this.setAOData("blurStride",n.blurStride),this.setAOData("ambientColor",n.ambientColor),this.setAOData("ambientIntensity",n.ambientIntensity),this.setAOData("lightBounceIntensity",n.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.params.ao)),a&&this.vignettePass&&(this.params.vignette.isVignette=a.isVignette,this.setVignetteData("offset",a.offset),this.setVignetteData("darkness",a.darkness),this.runScene.cb.pp.vignette.setData.cb(this.params.vignette))}setUpdate(e){this.isUpdate=e}clearAllOutlineObj(){this.mtOutline.clearAllOutlineObj()}update(){var e;this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&!0!==(null==(e=(0,S.F)(this.runScene).renderConfig)?void 0:e.stop)&&(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 ga=r(9583),va=r(713);class ba extends o{constructor(e){super(e),this.map=new p.Z,this.playLimit=new y.cM,this.renderName="script-texture-render",this._clock=new s.Clock,this.bindEvent()}parse(e,t){var r=(0,W.Ki)(t);0===Object.keys(e||{}).length?this.map.has(r)&&this.map.delete(r):this.map.set(r,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}_playAll(){this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:a}=r;t.userData.scriptTextre||(t.userData.scriptTextre={offsetX:t.offset.x,offsetY:t.offset.y,rotation:t.rotation}),e&&(t.offset.x+=e),n&&(t.offset.y+=n),a&&(t.rotation+=a)}))}playAll(){const{scriptFrame:e,mode:t}=this.runScene.optionsEx.options.renderConfig;-1===e&&"tick"===t?this.runScene.cb.render.add(this.renderName,(()=>{this._playAll()})):this.runScene.cb.render.add(this.renderName,(()=>{this.playLimit.update({cb:()=>{this._playAll()},cbRate:1/e,now:this._clock.getDelta()})}))}closeAll(){this.map.forEach((e=>{const t=e.texture;let r=0,n=0,a=0;t.userData.scriptTextre&&(r=(e=t.userData.scriptTextre).offsetX,n=e.offsetY,a=e.rotation,delete t.userData.scriptTextre),t.offset.x=r,t.offset.y=n,t.rotation=a})),this.runScene.cb.render.delete(this.renderName)}has(e){return void 0!==e.userData.uvScript}get(e){return e.userData.uvScript}set(e,t){t.userData.uvScript=e}}class ya{constructor(e){this.map=new p.Z,this.parse=e=>{const t=e.model;this.getState(t)?this.map.set((0,W.Ki)(t),{model:t,oldRotate:t.rotation.toArray()}):(this.close(t),this.map.delete((0,W.Ki)(t)))},this.render=()=>{var e=this.runScene.assetsEx.get().camera;const{x:t,y:r,z:n}=e.position;this.map.map(((e,{model:a})=>{a.lookAt(t,r,n)}))},this.runScene=e,this.bindEvent()}bindEvent(){this.runScene.cb.unique.model.add.add("script-lookat",this.parse),this.runScene.cb.render.add("script-lookat",this.render),this.runScene.cb.exporter.gltf.before.add("script-lookAt",(()=>{this.closeAll()}))}setState(e,t){t?(0,F.M)(e,"lookAt",!0):delete e.userData.lookAt,this.parse({model:e})}getState(e){return!0===(0,F.is)(e,"lookAt")}close(e){var t=this.map.get((0,W.Ki)(e));t&&e.rotation.fromArray(t.oldRotate)}closeAll(){this.map.map(((e,{model:t,oldRotate:r})=>{t.rotation.fromArray(r)}))}}class xa{constructor(e){this.map=new p.Z,this.dataMap=new p.Z,this.parseModel=e=>{var t=(0,W.Ki)(e);if(t){const r=this.awaitMap.get(t);r&&(r.map((t=>{let r=this.dataMap.get(t);r&&r.models.push({model:e})})),this.awaitMap.delete(t))}},this.loadedComplete=()=>{this.parseModel(this.runScene.assetsEx.get().camera)},this.clean=()=>{this.map.clear(),this.awaitMap.clear(),this.dataMap.clear()},this.awaitMap=new p.Z,this.parseJSON=e=>{(0,i.mapObj)(e,((e,t)=>{t.locals=t.locals.map((e=>new s.Vector3(e.x,e.y,e.z)));const r=t.modelIds;t.modelIds=new Z.Z,this.map.set(e,t),r.map((e=>{t.modelIds.add(e);let r=this.awaitMap.get(e);var n;r||(n=new Z.Z,this.awaitMap.set(e,n),r=n),r.add(t.id)})),this.addDataByMap(t)}))},this.render=()=>{this.dataMap.map(((e,t)=>{const{models:r,curve:n,speed:a,delayed:i,progress:s,loop:o,run:l}=t;if(l&&i){if(1<=s)return o?(t.delayed=!1,void this.onPlayBefore(t)):void this.close(e);r.map((e=>{const{model:r,oldPostion:i}=e;var s;e=t.progress<1?n.getPointAt(t.progress):i,r.position.copy(e),e=t.progress+a<1?n.getPointAt(t.progress+a):i,(0,k.N)(r)?(s=this.runScene.modelEx.select,r.lookAt(s?(0,an.VU)(s,this.runScene.assetsEx.scene):this.runScene.assetsEx.controls.target)):r.lookAt(e)})),t.progress+=a}}))},this.runScene=e,this.bindEvent()}bindEvent(){this.runScene.cb.unique.model.add.add("script-lineAnima",(({model:e})=>{this.parseModel(e)})),this.runScene.cb.render.add("script-lookat",this.render),this.runScene.cb.exporter.gltf.before.add("script-lookat",(()=>{this.closeAll()})),this.runScene.cb.clean.add("script-lookat",this.clean),this.runScene.cb.loaderer.gltf.complete.add("script-lookat",this.loadedComplete),this.runScene.cb.load.complete.add("script-lookat",this.loadedComplete)}addDataByMap(e){e.loadTrigger&&this.dataMap.set(e.id,this.getData(e))}add(e){this.map.set(e.id,e),this.addDataByMap(e)}toJSON(){return this.map}getData(e){return{models:[],curve:(0,an.kG)(e.locals,{closed:e.closed}).curve,run:!1,timer:void 0,delay:e.delay,delayed:!1,speed:e.speed,loop:e.loop,progress:0}}getOldLocal(e){return{oldPostion:e.position.clone(),oldRotation:e.rotation.clone()}}del(e){this.map.delete(e)}set(e,t){const r=this.dataMap.get(e);var n,a,i,s,o;r&&(n=this.map.get(e),({speed:a,loop:i,delay:s,closed:o}=t),this.map.set(e,t),r.speed=a,r.loop=i,r.delay=s,o!==n.closed&&(r.curve=(0,an.kG)(t.locals,{closed:o}).curve))}use(e,t){const r=this.map.get(e);if(r&&r.modelIds.size!==(r.modelIds.add((0,W.Ki)(t)),r.modelIds.size)){const r=this.dataMap.get(e);r&&r.models.push(Object.assign({model:t},this.getOldLocal(t)))}}unUse(e,t){const r=(0,W.Ki)(t);if(r){e.modelIds.delete(r);const n=this.dataMap.get(e.id);!n||-1!==(t=n.models.findIndex((e=>(0,W.Ki)(e.model)===r)))&&n.models.splice(t,1)}}playAll(){this.dataMap.map(((e,t)=>{this.playByData(t)}))}playByData(e){e.run=!0,e.progress=0,e.models.map((e=>{var t=e.model,{oldPostion:t,oldRotation:r}=this.getOldLocal(t);e.oldPostion=t,e.oldRotation=r})),this.onPlayBefore(e)}play(e){!this.map.get(e)||(e=this.dataMap.get(e))&&this.playByData(e)}onPlayBefore(e){var{delayed:t,delay:r}=e;t||(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((()=>{e.progress=0,e.delayed=!0}),1e3*r))}closeByData(e){const t=e.models;e.run&&(e.progress=0,e.run=!1,t.map((e=>{const{model:t,oldPostion:r,oldRotation:n}=e;void 0!==r&&t.position.copy(r),void 0!==n&&t.rotation.copy(n)})))}close(e){(e=this.dataMap.get(e))&&this.closeByData(e)}closeAll(){this.dataMap.map((e=>{this.close(e)}))}getLocalsByModels(e){const[t]=e;var r;return"Line"===t.type?(t.matrixWorldNeedsUpdate=!0,r=t.geometry.attributes.position.applyMatrix4(t.matrixWorld),(0,an.F)(r.array)):e.map((e=>(0,an.VU)(e,this.runScene.assetsEx.scene)))}}class wa{constructor(e){this.map=new p.Z,this.allAnima=[],this.runScene=e}play(e,t){var r;0!==e.children.length&&(r=(0,W.Ki)(e))&&(this.map.set(r,{model:e}),this.bindChildMap(e),this.render(e,t))}bindChildMap(e){if(0!==e.children.length){var t=(0,W.Ki)(e);const r=this.map.get(t),n=(r.yMap={},new p.Z);r.childMap=n,e.children.map((e=>{var t,a=(0,W.Ki)(e);a&&(t=e.position.y,r.yMap||(r.yMap={}),r.yMap[t]||(r.yMap[t]=[]),r.yMap[t].push(e),n.set(a,{child:e,oldPosition:e.position.clone()}))}))}}render(e,t){e=(0,W.Ki)(e);const r=this.map.get(e),{size:n,time:a}=t;Object.keys(r.yMap).sort(((e,t)=>Number.parseInt(e)-Number.parseInt(t))).map(((e,t)=>{r.yMap[e].map((e=>{var{x:i,y:s,z:o}=(0,an.VU)(e,this.runScene.assetsEx.scene),l=0<i?1:-1,c=0<o?1:-1,i=(l=Math.random()*n*l,c=Math.random()*n*c,e.position.set(i+l,s,o+c),{x:e.position.x,y:e.position.y,z:e.position.z}),s={x:(l=r.childMap.get((0,W.Ki)(e)).oldPosition).x,y:l.y,z:l.z},o=(0,y.gY)(i,Object.assign(Object.assign({},s),{delay:t*a,onStart:()=>{e.visible=!0}}),2,(t=>{var{x:t,y:r,z:n}=t;e.position.set(t,r,n)}));this.allAnima.push(o)}))}))}}class Sa extends o{constructor(e){super(e),this.runAll=!1,this.inited=()=>{this.runScene.cb.exporter.gltf.before.add("script",(()=>{this.closeAll()})),this.runScene.exporter.gltf.options.addOption({type:"script",parse:e=>{e&&(e=JSON.parse(e).lineAnima,this.lineAnima.parseJSON(e))},process:()=>JSON.stringify({lineAnima:this.lineAnima.toJSON()})})},this.texture=new ba(e),this.lookAt=new ya(e),this.lineAnima=new xa(e),this.boom=new wa(e),e.cb.inited.add("texture",this.inited)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll(),this.lineAnima.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll(),this.lineAnima.closeAll())}}class Ma{constructor(e){this.map=new p.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,W.Ki)(e);t&&this.map.map(((e,r)=>{r.delete(t)}))}))}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new Z.Z)}rename(e,t){const r=this.get(e);r&&(this.addId(t,r.toArray()),this.remove(e))}addId(e,t){this.map.has(e)||this.add(e),this.map.get(e).add(t)}addModel(e,t){if(this.map.has(e)||this.add(e),(0,y.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,W.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,y.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,W.Ki)(t))}remove(e){this.map.delete(e)}clear(){this.map.clear(),this.runScene.cb.tags.clear.cb()}toJSON(){const e={};return this.map.map(((t,r)=>{e[t]=[...r.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,i.mapObj)(e,((e,r)=>{t[e]=new Z.Z(r)})),this.map=p.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}class Ta{constructor(e,t){this.showTransform=!1,this.data={},this.uuid="",this.usedIds=new Z.Z,this.getAnimaByModelData=(()=>{const e=(e,t,r,n)=>{const a={},s={};if(e=Ta.isNotNow(e)?this.getAllData():e,(0,i.mapObj)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(a[r]=t[r],s[r]=e[r]):"color"===n&&(0,i.mapObj)(e[r],((e,n)=>{var i=r+e;a[i]=t[r][e],s[i]=n})))})),!(0,i.emptyObj)(a))return{begin:a,end:s}};return(t,r,n,a=!1,s)=>{let o=a?n.time:0;const l=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));return l.map((l=>{var c=t[String(l)];l=.001*((l=a?o-l:l-o)<=0?.001:l)*n.speed;{var d=r,h=c,p=l,m=s;const t={color(e){const{animaData:t,defType:r}=e,n={};return(0,i.mapObj)(t,(e=>{var a;-1!==e.indexOf(r)&&r.includes(r)&&(a=e.substring(r.length),n[a]=t[e])})),n}};return()=>{let r;return{promise:new Promise((n=>{var a;if(!(a=e(h,d,0,m)))return n(0);var{begin:a,end:s}=a;return r=(0,u.anima)(a,s,p,(e=>{(0,i.mapObj)(m,((r,n)=>{n=n.type;var a,i=e[r];"number"===n?d[r]=i:"color"===n&&(i=t.color({animaData:e,defType:r}))&&(({r:n,g:i,b:a}=i),d[r].setRGB(n,i,a))}))}),n)})),anima:r}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t,copyId:r}=this;return r?{copyId:r,type:t}:{data:e,type:t}}addData(e,t,r=!1,n){return 1e3<Number(e)&&(e="1000.00"),n?this.data[e]=n:r?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,r=!1){const n={};return(0,i.mapObj)(e,(a=>{n[a]=r?"notNow":Ta.getValByType(t,a,e)})),n}static getValByType(e,t,r){var n,a;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:a}=e),{r:t,g:n,b:a}):"V3"===r?(0,u.v3ToMap)(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:a}=e;var i,s;"number"===t?a[n]=r:"color"===t&&(({r:e,g:i,b:s}=r),a[n].setRGB(e,i,s))}getAllData(e=!1){return Ta.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return Ta.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,r){Ta.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,Oa[r])(e);return n.data=t,n}reset(){(0,i.mapObj)(this.defOptions,((e,t)=>{Ta.SetTargetByData({baseType:t.type,data:Ta.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){if(0!==this.usedIds.size){let e;this.usedIds.map((t=>{const r=this.runScene.timeLineEx.getInsByUuid(t);r&&(e?(r.copyId=e.uuid,e.usedIds.add(r.uuid)):delete(e=r).copyId)}))}delete this.target.userData.isTimeLineUsed}}Ta.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,a,s)=>{(0,i.mapObj)(a,((a,i)=>{var o,l,c,u,d,h;i=i.type,void 0!==t[a]&&void 0!==r[a]&&Ta.SetTargetByData({baseType:i,data:(o=t[a],l=r[a],c=n,"number"===i?e(o,l,c):"color"===i?(({r:i,g:o,b:u}=o),({r:l,g:d,b:h}=l),{r:e(i,l,c),g:e(o,d,c),b:e(u,h,c)}):void 0),defType:a,target:s})}))}})();const _a=Ta;he=class extends _a{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s,target:o}=t,{position:r,scale:l,rotation:c,target:u}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&l&&(({x:t,y:r,z:a}=e(i,l,n)),this.target.scale.set(t,r,a)),s&&c&&(({x:i,y:l,z:t}=e(s,c,n)),this.target.rotation.set(i,l,t)),o&&u&&(({x:r,y:a,z:s}=e(o,u,n)),this.controls.target.set(r,a,s))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s,target:o}=_a.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{},o?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{},o?{tx:o.x,ty:o.y,tz:o.z}:{})}},t=(t,r,n,a)=>()=>{let i;return{promise:new Promise((s=>{var{begin:o,end:l}=e(r,t,a);return i=(0,u.anima)(o,l,n,(e=>{var{px:e,py:n,pz:a,sx:i,sy:s,sz:o,rx:l,ry:c,rz:u,tx:d,ty:h,tz:p}=e;r.position&&t.position.set(e,n,a),r.scale&&t.scale.set(i,s,o),r.rotation&&t.rotation.set(l,c,u),r.target&&this.controls.target.set(d,h,p)}),s)})),anima:u.anima}};return(e,r,n,a=!1)=>{let s=a?n.time:0;const o=Object.keys(e).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,i.lastArrayEle)(o),c=a?"0.00":String(n.time);return l!==c&&(e[c]=Object.assign({},l),o.push(c)),o.map((i=>{var o=e[String(i)],l=.001*((l=a?s-i:i-s)<=0?.001:l)*n.speed;return s=i,t(r,o,l,n)}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:r,rotation:n}=this.target;return{position:e?"notNow":(0,u.v3ToMap)(t),scale:e?"notNow":(0,u.v3ToMap)(r),rotation:e?"notNow":(0,u.v3ToMap)(n),target:e?"notNow":(0,u.v3ToMap)(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let a;if("position"===e)a=(0,u.v3ToMap)(t);else if("scale"===e)a=(0,u.v3ToMap)(r);else if("rotation"===e)a=(0,u.v3ToMap)(n);else{if("target"!==e)throw TypeError("输入值不存在");a=(0,u.v3ToMap)(this.controls.target)}return a}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r,target:n}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z),this.controls.target.set(n.x,n.y,n.z)}},pe=class extends _a{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=class extends _a{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s}=t,{position:r,scale:o,rotation:l}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a),this.runScene.cb.model.setVector3.cb({type:"position",model:this.target})),i&&o&&(({x:t,y:r,z:a}=e(i,o,n)),this.target.scale.set(t,r,a)),s&&l&&(({x:i,y:o,z:t}=e(s,l,n)),this.target.rotation.set(i,o,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s}=_a.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{})}},t=(t,r,n,a)=>()=>{let i;return{promise:new Promise((s=>{var{begin:o,end:l}=e(r,t,a);return i=(0,u.anima)(o,l,n,(e=>{var{px:e,py:n,pz:a,sx:i,sy:s,sz:o,rx:l,ry:c,rz:u}=e;r.position&&(t.position.set(e,n,a),this.runScene.cb.model.setVector3.cb({type:"position",model:this.target})),r.scale&&t.scale.set(i,s,o),r.rotation&&t.rotation.set(l,c,u)}),s)})),anima:i}};return(e,r,n,a=!1)=>{let i=a?n.time:0;const s=Object.keys(e).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));return s.map((s=>{var o=e[String(s)],l=.001*((l=a?i-s:s-i)<=0?.001:l)*n.speed;return i=s,t(r,o,l,n)}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.runScene.cb.model.setVector3.cb({type:"position",model:this.target}),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z)}};class Ea extends o{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:r}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&r.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new p.Z({complete:this.after,mountModule:this.mount}),exportCallBacks:new p.Z};this.runScene.exporter.gltf.module.bind(e)}}var Da=r(7201);const Oa={model:n,camera:he,material:pe};class ka{constructor(){this.list={},this.$emit=this.emit,this.$on=this.on}on(e,t){this.list[e]=t}emit(...e){if(void 0!==this.list[e[0]])return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)));console.log("请先挂载在使用")}off(e){this.list[e]&&delete this.list[e]}}const Pa=c.Z,Aa=class{constructor(e){this._clock=new s.Clock,this.cb=new O(this),this.script=new Sa(this),this.uniqueEx=new W.ZP(this),this.fileEx=new Yr(this),this.snapshot=new ma.ZP(this),this.undoEx=new hn.ZP(this),this.textureEx=new T.default(this),this.controlsEx=new G(this),this.assetsEx=new v(this),this.renderEx=new ga.ZP(this),this.events=new class{constructor(e){this.key=new H(this),this.mouse=new w(this),this.model=new K(this),this.addEvent=e=>{const{dom:t,name:r,fn:n}=e,a=(0,S.F)(this.runScene).renderConfig;t.addEventListener(r,(e=>{!a.event.trigger||a.event.ignores.includes(r)||n(e)}))},this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),this.model.init(),this.addEvent({dom:window,name:"resize",fn:()=>{this.runScene.cb.resize.cb(this.runScene.renderEx.getDomSize())}})}}(this),this.multipSelector=new sn(this),this.helperEx=null,this.materialEx=new ft.default(this),this.cameraEx=new k.Z(this),this.sceneEx=new F.ZP(this),this.modelEx=new d.default(this),this.loaderer=new l.Z(this),this.exporter=new Ot(this),this.lightEx=new Jr.ZP(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.idMap=new p.Z,this.animaMap={},this.groupMap={},this.clean=()=>{this.reset()},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var r,n,a=((e,t)=>{let r=-1,n=1e3;const a=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==a.length&&(a.map(((e,a)=>{e=Number(e),0<(e=t-e)&&e<n&&(n=e,r=a)})),-1!==r)){var i=a[r],s=a[r+1],o=e[i];if(e=e[s],o&&e){var l=Object.values(o)[0],c=Object.values(e)[0];if("notNow"!==l&&"notNow"!==c)return{left:o,right:e,progress:(t-Number(i))/(Number(s)-Number(i))}}}})(e.data,t);a&&(({left:a,right:r,progress:n}=a),e.setTargetByBetween(a,r,n))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new Ea(e),this.initSnapshot()}initSnapshot(){const e="time-line";let t={};this.runScene.cb.snapshot.beforeCreate.add(e,(()=>{(0,i.mapObj)(this.groupMap,((e,r)=>{t[e]=r.run,r.run&&(this.closeGroup(e),this.toLeft(r))}))})),this.runScene.cb.snapshot.create.add(e,(r=>{0!==(0,Da.objLength)(t)&&((0,i.mapObj)(t,((e,t)=>{t&&this.playGroup(e)})),r.data.set(e,(0,y.d9)(t)))})),this.runScene.cb.snapshot.delUseless.add(e,(t=>{(0,i.mapObj)(t,((t,r)=>{const n=r.data[e];n&&((0,i.mapObj)(n,(e=>{this.groupMap[e]||delete n[e]})),0===(0,Da.objLength)(n)&&delete r.data[e])}))})),this.runScene.cb.snapshot.set.add(e,(t=>{const r=t.snapshot.data.get(e);r&&t.data.completedCbs.push((()=>{(0,i.mapObj)(r,((e,t)=>{this[t?"playGroup":"closeGroup"](e)}))}))})),this.runScene.cb.snapshot.getLength.add(e,(t=>{var r=t.data.data.get(e);r&&(t.inputData[e]=Object.keys(r).length)})),this.runScene.cb.snapshot.getByType.add(e,(({})=>{})),this.runScene.cb.snapshot.resetItem.add(e,(({targets:t,type:r,datas:n})=>{r===e&&t.map((t=>{const{run:r,name:a}=t;n.map((t=>{const n=t.data;let i=n.get(e);(i=i||{})[a]=r,n.set(e,i)}))}))})),this.runScene.cb.snapshot.parseJSON.add(e,(t=>{t.map(((t,r)=>r.data.get(e)))}))}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}pause(e){var t,r;if(this.groupMap[e]){this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1;const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.run=!1}))}}resume(e){const t=this.groupMap[e];if(t){this.groupMap[e].run=!0;const r=this.animaMap[e];r&&r.length&&r.map((r=>{const{controls:n,promise:a}=r;n.run=!0,a.then((()=>{if(t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}))}}closeGroup(e){var t,r;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1,this.runScene.cb.timeLine.closeGroup.cb(e);const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.clean=!0})),delete this.animaMap[e]}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,i.mapObj)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){const t=[];Object.keys(e).map((r=>{const n=e[r],a={};(0,i.mapObj)(n.data,((e,r)=>{var{type:r,data:n,copyId:i}=r;const s=Oa[r];if(r=s.getTarget(e,this.runScene)){const o=new s(r,this.runScene);o.data=n,a[e]=o,i&&t.push({ins:o,id:i}),this.idMap.set(e,o)}})),n.data=a,this.groupMap[r]=n,this.runScene.cb.timeLine.setGroupMap.cb({group:n,groupName:r})})),t.map((({ins:e,id:t})=>{const r=this.idMap.get(t);r&&(e.data=r.data,e.copyId=t,r.usedIds.add(e.uuid))}))}playGroup(e,t){const r=(0,y.Gm)({onlyReverse:!1},t).onlyReverse,n=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(n&&!n.run){n.run=!0;const s=Object.keys(n.data).map((e=>{const t=n.data[e];if(r)return t.getAnima(n,!0);const a=t.getAnima(n);return n.reverse&&(e=t.getAnima(n,!0),a.push(...e)),a}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=s.map((e=>(0,i.eachTriggerArrGetControls)(e)));let o=0;o=r?n.time*n.speed:n.time*n.speed*(n.reverse?2:1);const l=(new Date).valueOf(),c=o;var a=setInterval((()=>{var t=((new Date).valueOf()-l)/c;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);let u;const d=new Promise((e=>u=setTimeout(e,o)));return this.timerMap[e]={setProgressTime:a,awaitRuned:u},d.then((()=>{var r;if(clearInterval(this.timerMap[e].setProgressTime),n.run){if(n.run=!1,n.loop)return this.playGroup(e);null!=(r=null==t?void 0:t.onDone)&&r.call(t)}}))}}setInsForIdMap(e){this.idMap.set(e.uuid,e)}getInsByUuid(e){return this.idMap.get(e)}toLeft(e){Object.values(e.data).map((e=>{var t=Object.values(e.data);t[0]&&e.setTargetByBetween(t[0],t[1]||t[0],0)}))}toRight(e){Object.values(e.data).map((e=>{var t=Object.values(e.data).reverse();t[0]&&e.setTargetByBetween(t[0],t[1]||t[0],100)}))}}(this),this.anima=new h(this),this.tags=new Ma(this),this.globalConfig=new Qr(this),this.pp=new fa(this),this.objects=new gn(this),this.code=new va.Z(this),this.custom={},this.msg=new M(this),this.size=new _(this),this.inited=!1,this._renderLimit=new y.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx.get(),{scene:r,camera:n,controls:a}=this.assetsEx.get();this.cb.render.cb(""),this.pp.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n),"tick"===this.optionsEx.options.renderConfig.mode&&a.update()},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const r=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){r()},cbRate:1/e,now:t})):this._render()}},this.optionsEx=new S.Z(this,e)}initLibs(e){if(!this.inited){this.optionsEx.init(e),this.inited=!0,this.snapshot.init(),this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.loaderer.init(),this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new tn(this);const{camera:t,controls:r}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),r.update(),this.pp.init(),this.cameraEx.reset(t),this.cb.inited.cb(0)}}init(e){return this.initLibs(e),this}load(e){const{path:t,dom:r,loadConfig:n}=e;return this.init(r),this.loadScene(t,n).then((e=>{var t,r;0!==(null==e?void 0:e.length)&&(this.modelEx.add(e,void 0,{isScene:!0}),this.cb.load.modelAdded.cb({models:e}),null!=(t=null==(r=null==n?void 0:n.callBack)?void 0:r.loaded)&&t.call(r),null!=(r=(t=this.cb.load.loaded).cb)&&r.call(t,{models:e}))})),this}loadScene(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:r,progress:n,complete:i}=this.cb.load;t=t||{};var s=Object.assign(Object.assign({},t),{callBack:{getJSON:e=>{var n,a;null!=(a=null==(n=null==t?void 0:t.callBack)?void 0:n.getJSON)&&a.call(n,e),r.cb(e)},progress:e=>{var r,a;null!=(a=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&a.call(r,e),n.cb(e)},complete:e=>{var r,n;null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.complete)&&n.call(r,e),i.cb(e),this.render()}},triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,s);this.optionsEx.log("正在拉取场景","base","info");var o=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let r=t/e;1<(r=r<0?0:r)&&(r=1),t=Number(r.toFixed(2)),e=Math.floor(100*t),this.optionsEx.log("下载场景进度:"+e,"detail"),this.cb.load.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return o?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(o,s)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,i.getId)(),t),this}setSize(e,t){const{render2:r,render3:n}=this.assetsEx.get(),a=this.assetsEx.get().renderer;this.cameraEx.setSize(),null!=n&&n.setSize(e,t),null!=r&&r.setSize(e,t),a.setSize(e,t,!0),a.setPixelRatio(this.renderEx.pixelRatio),this.pp.setSize(e,t)}clean(){this.cb.clean.cb(0)}}},3736:(e,t,r)=>{r.d(t,{ZP:()=>x,bv:()=>_,is:()=>T,UE:()=>M,qh:()=>E,M:()=>w});var n=r(6001),a=r(8881),i=r(135),s=r(8609),o=r(9583),l=r(1794),c=r(2233),u=r(4464);class d{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,r,n,a,i,s,{json:e,config:o,core:l}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&(({camera:t,lights:e,options:r,controls:n,tags:a,envStrength:i,objects:s}=e.asset.ex),void 0!==i&&this.runScene.sceneEx.setEnvStrength(i),this.parse.camera(t,o),e&&this.parse.light(e,o,l),this.parse.controls(n,o),o.module.tags&&this.runScene.tags.parseJSON(a||{}),this.parse.options(r),s&&this.runScene.objects.parseJSON(s))},after:e=>{const{core:t,json:r,data:n,config:a}=e;if("scene"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){var{options:e,json:i}=n;if(e=e.models,!t.loadConfig.module.model)return[];const s=e[0];if(t.module.get("model").data.map.map(((e,t)=>{this.runScene.uniqueEx.model.add(t)})),e=s.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e)),1===e.length){const[t]=e;t.animations=[...t.animations,...i.animations]}t.callback("loaded",""),this.runScene.optionsEx.sceneOptions.loaded=!0,this.parse.scene(r,a,t),t.models.push(...e)}},controls:(e,t)=>{var r;t.module.controls&&e&&(({x:t,y:e,z:r}=e),this.runScene.assetsEx.controls.target.set(t,e,r),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){let u=e;e.temp&&(u=e.camera,this.runScene.cameraEx.temp=l.Z.formJSON(e.temp));var{position:t,far:e,near:r,fov:n,name:a,userData:i,rotation:s}=this.runScene.loaderer.object.parse(u);const d=this.runScene.assetsEx.get().camera;var o=(0,c.Ki)(d);d.position.copy(t),d.far=e,d.near=r,d.fov=n,d.name=a,d.updateProjectionMatrix(),d.userData.id=i.id,this.runScene.uniqueEx.model.add(d,{oldId:o}),d.rotation.copy(s),this.runScene.assetsEx.get().controls.update()}},light:(e,t,r)=>{if(t.module.light){const t=[];e.map((e=>{var r=e.type;t.push(...this.runScene.lightEx.lightExMap[r].parseJSON(e))})),r.models.push(...t)}},scene:(e,t,r)=>{if(t.module.sceneConfig){const c=this.runScene.sceneEx.get();t=r.module.get("material").data.materialIns;var{materialId:r,backgroundMapping:e,backgroundColor:n,fog:i,backgroundIntensity:s,backgroundBlurriness:o,cssBgc:l}=e.asset.ex.sceneEx;if(r&&(r=null==(t=t[r])?void 0:t.material)){const{map:t,envMap:n,normalMap:a}=r;a&&(0,u.F)(this.runScene).camera.showBackground&&this.runScene.cameraEx.setBackgroundTexture(a),t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0,void 0!==o&&(c.backgroundIntensity=o),void 0!==s&&(c.backgroundIntensity=s)),n&&this.runScene.sceneEx.setEnv(n)}if(l&&this.runScene.sceneEx.setCssBgc(l),n&&this.runScene.sceneEx.setBackground(new a.Color("#"+n)),i){const{color:e,far:t,near:r,show:n}=i,s=new a.Fog(e.includes("#")?e:"#"+e,r,t);!1===n?this.runScene.sceneEx.oldFog=s:c.fog=s,s.show=n,this.runScene.cb.setScene.cb({scene:c,type:"fog",val:s})}this.runScene.cb.setScene.cb({scene:c,type:"any",val:"any"})}},options:e=>{e.map((e=>{var{type:e,data:t}=e;const r=this.runScene.exporter.gltf.options.getParse(e);null!=r&&r.parse(t)}))}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new l.Z({beforeParse:this.parse.before,afterParse:this.parse.after,mountModule:this.mount}),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e)}}var h=r(7201),p=r(9667),m=r(8089);class f{constructor(e){this.create=e=>{var t=this.getDiff();0!==(0,h.objLength)(t)&&e.data.set("scene",t)},this.set=e=>{const t=e.snapshot.data.get("scene");if(t){const{fog:c,bgc:u,env:d,bgcm:h,envS:f,tm:g,oe:v,tme:b}=t,{scene:y,renderer:x}=this.runScene.assetsEx.get(),{animas:w,completedCbs:S}=e.data;let T=y.background;if(this.runScene.sceneEx.setEnvStrength(void 0!==f?f:1),void 0!==g&&(x.toneMapping=g),void 0!==v&&(x.outputEncoding=v),void 0!==b&&(x.toneMappingExposure=b),u){const{type:t,data:r}=u;if("color"===t)(0,i.isColor)(T)||null===T?(e=null===T?"#000000":(0,m.J6)(T),null===T&&this.runScene.sceneEx.setBackground(new a.Color("#000000")),e!==u.data&&w.push({target:y,label:"background",type:"color",isUpdate:!0,begin:e,end:r})):(0,p.isTexture)(T)&&S.push((()=>{this.runScene.sceneEx.setBackground(new a.Color(r))}));else if("texture"===t){const e=this.runScene.uniqueEx.texture.get(u.data);e&&(0,p.setTextureMapping)(e,303===h?"repeat":"normal"),S.push((()=>{this.runScene.sceneEx.setBackground(e)}))}}else(0,i.isColor)(T)&&(T||(T=new a.Color,this.runScene.sceneEx.setBackground(T)),w.push({target:y,label:"background",type:"color",isUpdate:!0,begin:(0,m.J6)(T),end:"#000000"})),S.push((()=>{this.runScene.sceneEx.setBackground(null)}));var r,n,s,o,l;S.push((()=>{y.environment=this.runScene.uniqueEx.texture.get(null==d?void 0:d.data)})),y.fog&&c?(({color:e,near:r,far:n}=c),({color:l,near:s,far:o}=y.fog),e!==(l=(0,m.J6)(l))&&w.push({target:y,label:["fog","color"],begin:l,end:e,type:"color",isUpdate:!0}),s!==r&&w.push({target:y,label:["fog","near"],begin:s,end:r,type:"number",isUpdate:!0}),o!==n&&w.push({target:y,label:["fog","far"],begin:o,end:n,type:"number",isUpdate:!0})):S.push((()=>{y.fog=c?M(c):null})),S.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,r=((r=this.runScene.sceneEx.getJson("fog"))&&(e.fog=r),this.runScene.sceneEx.getJson("background")),{scene:n,renderer:t}=this.runScene.assetsEx.get();return void 0!==(e.tm=t.toneMapping,e.oe=t.outputEncoding,e.tme=t.toneMappingExposure,r&&"texture"===(e.bgc=r).type&&303===n.background.mapping&&(e.bgcm=303),(t=this.runScene.sceneEx.getJson("environment"))&&(e.env=t),r=this.runScene.sceneEx.getEnvStrength())&&1!==r&&(e.envS=r),e}}var g=r(3735),v=r(2510),b=r(7169),y=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class x{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.clearCssBgc()},this.envStrength=1,this.runScene=e,this.exportAndImport=new d(e),this.snapshot=new f(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 this.runScene.assetsEx.get().scene}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}getEnvStrength(){return this.envStrength}remove(e){if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:a,remove:i}=this.removeMap[r];if(a(e))return t.push(...(0,n.multiArrToArr)(i(e)))}t.push(new b.Z({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:r,remove:n}=this.removeMap[t];if(r(e))return n(e)}this.runScene.modelEx.remove(e),this.runScene.helperEx.unfocus()}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}searchModel(e){var t=e.slice(0,1);let r=[];if(":"!==t&&":"!==t)return this.runScene.uniqueEx.model.findModelWithName(e);{const[t,n]=e.slice(1).split("=");return t?this.runScene.uniqueEx.model.find((({model:e,type:r})=>"lock"===t?s.lockModel.isLock(e):"dynamic"===t?s.dynamicModel.isDynamic(e):"type"===t?n===r:void 0)):r}}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new a.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&s.normalModel.is(e))).map((e=>{const r=e.clone();(0,s.withAnima)(e)&&(r.animations=[...e.animations]),t.add(r)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){this.setBackground(null).then(),this.setEnv(null).then(),e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return y(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e));var r=this.get(),n=((0,p.isTexture)(e)&&(e.userData.isBackgroud=!0,this.runScene.cb.texture.setMaterial.cb({target:this.runScene.assetsEx.scene,targetType:"scene",type:"background",val:e,oldVal:(0,p.isTexture)(r.background)?r.background:null})),new v.Z({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{}}).execute());return t&&this.runScene.undoEx.addUndo(n),this.runScene.cb.setScene.cb({scene:r,type:"background",val:r.background}),e}))}isBackground(e){return e.userData.isBackgroud}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,o.sH)(e),t.dispose(),this.runScene.pp.dispose(),a.Cache.clear()}render(){}create(){var e=new a.Scene;return(0,c.x)(e,(0,n.getId)()),e}setEnv(e){return y(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.get().scene,r=t.environment;let n;return e instanceof String&&(n=yield this.runScene.textureEx.load(e,{isEnv:!0})),e instanceof File&&(n=yield this.runScene.textureEx.parse(e,{isEnv:!0})),null!=e&&e.isTexture&&(n=this.runScene.textureEx.getSameTexture(e.userData.md5,e)||this.runScene.textureEx.clone(e),this.runScene.cb.texture.setMaterial.cb({target:this.runScene.assetsEx.scene,targetType:"scene",type:"env",val:n,oldVal:r})),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:r,val:n}=e;e=new v.Z({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setRealReflection(){const{scene:e,renderer:t}=this.runScene.assetsEx.get();this.cubeRT||(this.cubeRT=new a.WebGLCubeRenderTarget(1024)),this.realReflectionCamera||(this.realReflectionCamera=new a.CubeCamera(.1,5e3,this.cubeRT),e.add(this.realReflectionCamera),this.runScene.cb.render.add("RealReflection-update",(()=>{this.realReflectionCamera.update(t,e)}))),this.isRealReflection?(this.preEnvMap=e.environment,this.setEnv(null).then(),this.setNormal({model:e,info:"environment",val:this.cubeRT.texture})):this.preEnvMap&&this.setEnv(this.preEnvMap).then(),this.testSphere||(this.testSphere=new a.Mesh(new a.SphereGeometry(15,32,16),new a.MeshStandardMaterial),e.add(this.testSphere),this.testSphere.scale.set(10,10,10),this.testSphere.position.set(0,600,0),this.testSphere.getWorldPosition(this.realReflectionCamera.position),this.testSphere.material.roughness=0,this.testSphere.material.metalness=1)}set(e,t){"background"===e?this.setBackground(t):"env"===e&&this.setEnv(t)}setFogShow(e){var t=this.runScene.assetsEx.get().scene,{show:e,color:r}=e;if(e){let e=this.oldFog||new a.Fog(r||"#ffffff");e.show=!0,this.setNormal({model:t,info:"fog",val:e})}else this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null}),this.oldFog.show=!1;this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.get().scene,{type:e,val:r,cb:n}=e;t=new g.Z({target:t,typeList:["fog",e],newVal:r,cb:n}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:r,height:a}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const i=this.runScene.assetsEx.get().renderer.domElement;return this.runScene.helperEx.setState(!1),this.runScene.cb.resize.cb({width:e,height:t}),this.runScene.pp.update(),e=i.toDataURL("image/png",1),t=(0,n.base64ToFile)(e,"screenShot.png"),this.runScene.helperEx.setState(!0),this.runScene.cb.resize.cb({width:r,height:a}),this.runScene.pp.update(),t}getJson(e){let t;var r=this.runScene.assetsEx.get().scene;if("fog"===e){var n=r.fog;n&&(t=S(n,null!==r.fog))}else if("background"===e){if(!r.background)return;t={type:(n=(0,i.isColor)(r.background))?"color":"texture",data:(n?m.J6:c.Ki)(r.background)}}else if("environment"===e){if(!r.environment)return;t={type:"texture",data:(0,c.Ki)(r.environment)}}return t}static toJSON(e,t){const r={};let n=!1,a=e.fog;return a?n=!0:a=t.sceneEx.oldFog,a&&(r.fog=S(a,n)),(0,i.isColor)(e.background)?r.backgroundColor=e.background.getHexString():(0,p.isTexture)(e.background)&&(e.backgroundIntensity&&(r.backgroundIntensity=e.backgroundIntensity),e.backgroundBlurriness&&(r.backgroundBlurriness=e.backgroundBlurriness)),t.sceneEx.cssBgc&&(r.cssBgc=t.sceneEx.cssBgc),r}setEnvStrength(e){this.runScene.cb.scene.setEnvStrength.cb({val:e}),this.runScene.uniqueEx.material.each((t=>this.runScene.materialEx.setEnvStrength(t,e))),this.envStrength=e}setCssBgc(e){this.setBackground(null);var{color1:e,color2:t,deg:r,percent:n}=e,a=`linear-gradient(${r}deg,${e}, ${n}%,${t} )`;this.cssBgc={color1:e,color2:t,percent:n,deg:r},this.runScene.assetsEx.renderer.domElement.style.background=a}clearCssBgc(){this.cssBgc=void 0,this.runScene.assetsEx.renderer.domElement.style.background=""}}const w=(e,t,r)=>{e.userData[t]=r},S=(e,t)=>{var{color:e,far:r,near:n}=e;return{color:(0,m.J6)(e),show:t,far:r,near:n}},M=e=>{var{color:e,far:t,near:r}=e;return new a.Fog(e,r,t)},T=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",_=(e,t)=>{delete e.userData[t]},E=e=>{w(e,"id",(0,n.getId)())}},1398:(e,t,r)=>{r.d(t,{LV:()=>p,ZP:()=>h});var n=r(6001),a=r(3263),i=r(1794),s=r(7201),o=r(9667),l=r(2233),c=r(5317),u=r(8089);const d=["number","color","color_obj","color_str","v2","v3"];class h{constructor(e){this.map=new i.Z,this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"snapshot",map:{parse:e=>Promise.all(e.childs.map((e=>new Promise((t=>{this.set(e,{onDone:()=>{t(0)}})})))))}})},this.playing=new i.Z,this.unique={set:()=>{},get:()=>{}},this.toJSON=()=>{var e=JSON.stringify(this.map.toJSON());return e=JSON.parse(e),this.runScene.cb.snapshot.delUseless.cb(e),JSON.stringify(e)},this.parseJSON=e=>{const t=i.Z.formJSON(JSON.parse(e));t.map(((e,t)=>{t.data=i.Z.formJSON(t.data)})),this.map=t,this.runScene.cb.snapshot.parseJSON.cb(this.map)},this.clean=()=>{this.map.clear()},this.trans={set:(e,t)=>{var r,n,a,i,s,o=e.label instanceof Array?e.label.join("."):e.label;const l={begin:[],end:[]};return"color"===e.type||"color_obj"===e.type||"color_str"===e.type?(a=(0,u.sS)(e.begin),r=(0,u.sS)(e.end),i=o+"_"+t+"_r",s=o+"_"+t+"_g",n=o+"_"+t+"_b",l.begin.push({type:i,data:a.r}),l.begin.push({type:s,data:a.g}),l.begin.push({type:n,data:a.b}),l.end.push({type:i,data:r.r}),l.end.push({type:s,data:r.g}),l.end.push({type:n,data:r.b})):"number"===e.type?(l.begin.push({type:o+"_"+t,data:e.begin}),l.end.push({type:o+"_"+t,data:e.end})):"v2"!==e.type&&"v3"!==e.type||(a=o+"_"+t+"_x",i=o+"_"+t+"_y",s=o+"_"+t+"_z",l.begin.push({type:a,data:e.begin.x}),l.begin.push({type:i,data:e.begin.y}),"v3"===e.type&&(l.begin.push({type:s,data:e.begin.z}),l.end.push({type:s,data:e.end.z})),l.end.push({type:a,data:e.end.x}),l.end.push({type:i,data:e.end.y})),l},getKey(e){let t=[];var{unique:r,type:n}=e;return e=e.label instanceof Array?e.label.join("."):e.label,"v2"===n||"v3"===n?(t.push(e+"_"+r+"_x"),t.push(e+"_"+r+"_y"),t.push(e+"_"+r+"_z")):"color"===n||"color_obj"===n||"color_str"===n?(t.push(e+"_"+r+"_r"),t.push(e+"_"+r+"_g"),t.push(e+"_"+r+"_b")):"number"===n&&t.push(e+"_"+r),t},update:(e,t)=>{var r;const a=this.trans.getKey(e);let i=e.target,s=e.label,o=(e.label instanceof Array&&(s=(0,n.lastArrayEle)(e.label),i=(0,n.objLastMap)(e.target,e.label)),t[a[0]]),l=s;"color"===e.type||"color_obj"===e.type?(o={r:0,g:0,b:0},a.map((e=>{var[,,r]=e.split("_");e=t[e]/255,o[r]=e}))):"color_str"===e.type?o="#"+a.map((e=>Number(Number(t[e]).toFixed(0)).toString(16).padStart(2,"0"))).join(""):"v2"!==e.type&&"v3"!==e.type||(o={x:0,y:0,z:0},a.map((e=>{var[,,r]=e.split("_");o[r]=t[e]}))),null!=(r=e.onUpdate)&&r.call(e,{target:i,data:o,type:l,runScene:this.runScene})},exec:(e,t)=>{const r=this.trans.getKey(e);let a=e.target,i=e.label;e.label instanceof Array&&(i=(0,n.lastArrayEle)(e.label),a=(0,n.objLastMap)(e.target,e.label)),"color"===e.type||"color_str"===e.type||"color_obj"===e.type?r.map((e=>{var[,,r]=e.split("_");e=1<t[e]?t[e]/255:t[e],a[i][r]=e})):"number"===e.type?a[i]=t[r[0]]:"v2"!==e.type&&"v3"!==e.type||r.map((e=>{var[,,r]=e.split("_");a[i][r]=t[e]}))}},this.getLengthByName=e=>{var t;if(e=this.map.get(e))return t={},this.runScene.cb.snapshot.getLength.cb({data:e,inputData:t}),t},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),this.runScene.cb.inited.add("snapshot",this.onInited)}create(e){this.runScene.cb.snapshot.beforeCreate.cb();var{name:e,time:t}=e;return this.map.get(e)&&this.del(e),e={name:e,time:t,data:new i.Z},this.runScene.cb.snapshot.create.cb(e),e}resetItem(e){const{targets:t,names:r,type:n}=e;e=r.map((e=>this.map.get(e))).filter((e=>e)),this.runScene.cb.snapshot.resetItem.cb({targets:t,datas:e,type:n})}add(e){var t=this.create(e);return this.map.set(e.name,t),t}addByType(e){var{name:t,time:r,targets:n,type:a}=e,t={name:t,time:r,data:new i.Z};return this.runScene.cb.snapshot.getByType.cb({type:a,data:t,targets:n}),this.map.set(e.name,t),t}set(e,t){return new Promise((r=>{var n=this.map.get(e);const{animaTime:a,isLinear:i,onDone:s}=Object.assign({animaTime:-1},t);if(!n)return r();const o={animas:[],completedCbs:[]};if(this.runScene.cb.snapshot.set.cb({snapshot:n,data:o}),0===o.animas.length)return 0===o.completedCbs.length||o.completedCbs.map((e=>e())),r(null==s?void 0:s());this.anima(e,o,{animaTime:-1===a?n.time:a,isLinear:i,onDone:()=>{r(null==s?void 0:s())}})}))}del(e){var t=this.map.get(e);t&&this.runScene.cb.snapshot.delete.cb({name:e,data:t})}anima(e,t,r){var a;if(this.runScene.modelEx.selectNull(),null==(a=this.playing.get(e))||!a.animaIns){const a=new i.Z,s={},o={},{animaTime:l,isLinear:u,onDone:d}=r,h={data:t,animaIns:null};t.animas.map(((e,t)=>{t=String(t);const{begin:r,end:n}=this.trans.set(e,t);r.map((e=>s[e.type]=e.data)),n.map((e=>o[e.type]=e.data)),a.set(t,Object.assign({unique:t},e))})),h.animaIns=(0,c.anima)(s,Object.assign(Object.assign({},o),{ease:u?"none":"easeOut"}),l,(e=>{(0,n.mapObj)(e,(t=>{var[,t]=t.split("_");(t=a.get(t))&&(t.isUpdate?this.trans.exec(t,e):this.trans.update(t,e))}))}),(()=>{var e;null!=(e=h.animaIns)&&e.kill(),h.animaIns=null,h.data.completedCbs.map((e=>e())),null!=d&&d()})),this.playing.set(e,h)}}close(e){const t=this.playing.get(e);return!(!t||(null!=(e=t.animaIns)&&e.kill(),t.animaIns=null))}closeAll(){this.playing.map(((e,t)=>{var r;t&&null!=(r=t.animaIns)&&r.kill(),t.animaIns=null}))}parseNromal(e,t){const{animas:r,completedCbs:a}=t.data,{target:i,type:s,begin:o,end:l,set:u,label:h,onUpdate:p}=e;if((0,c.isDef)(o,l))if(d.includes(s))r.push({target:i,type:s,begin:o,end:l,label:h,isUpdate:void 0===p,onUpdate:p});else if(u)u({target:i,begin:o,end:l});else{let e=i,t=h;h instanceof Array&&(e=(0,n.objLastMap)(i,h),t=(0,n.lastArrayEle)(h)),"texture"===s?e[t]=l:a.push((()=>{e[t]=l}))}}bind(e){const{name:t,def:r,target:n,create:a,set:i}=e;this.runScene.cb.snapshot.create.add(t,a||(e=>{var a=p.getDiff(r,n);0!==(0,s.objLength)(a)&&e.data.set(t,a)})),this.runScene.cb.snapshot.set.add(t,i||(e=>{var a=e.snapshot.data.get(t);a&&p.set({def:r,runScene:this.runScene,data:a,target:n,map:e})}))}}const p={toNormal(e){var t,{type:e,val:r}=e;let n=r;return"color"===e?n=(0,u.Lv)(r):"color_obj"===e?n=r:"color_str"===e?n=(0,c.MyHextoRgb)(r,!0):"texture"===e?(0,o.isTexture)(r)&&(n=(0,l.Ki)(r)):"v3"!==e&&"v2"!==e||(({x:e,y:r,z:t}=r),n={x:e,y:r,z:t}),n},parse(e){const{type:t,val:r,runScene:n}=e;let i=r;return"color"===t?i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0):"color_obj"===t?i=r:"color_str"===t&&(i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0)),"texture"===t&&null!==r?n.uniqueEx.texture.get(r):i},getDiff(e,t){let r={};return(0,n.mapObj)(e,((e,a)=>{const{label:i,get:s}=a;let o=t[e];s?o=s(t):i&&(o=(0,n.objLastMap)(t,i)[(0,n.lastArrayEle)(i)]),r[e]=o})),(0,s.replaceKVForObj)((0,c.getDiff)((0,s.replaceValForObj)(e,((e,t)=>t.val)),r),((t,r)=>{var{shortKey:t,type:n}=e[t];return{k:t,v:p.toNormal({type:n,val:r})}}))},set(e){const{def:t,data:r,target:a,runScene:i,map:s}=e;(0,n.mapObj)(t,((e,t)=>{const{type:o,val:l,shortKey:u,before:d,label:h,onUpdate:m,get:f,set:g}=t;let v=a,b=e;h&&(v=(0,n.objLastMap)(a,h),b=(0,n.lastArrayEle)(h)),t=p.toNormal({type:o,val:f?f(v):v[b]}),e=p.parse({type:o,val:void 0!==r[u]?r[u]:l,runScene:i}),(0,c.isDef)(t,e)&&(null!=d&&d({target:v,begin:t,end:e}),i.snapshot.parseNromal({target:v,label:b,type:o,set:g,begin:t,end:e,onUpdate:m},s))}))}}},9667:(e,t,r)=>{r.r(t),r.d(t,{bindTextureBaseData:()=>I,createDefTexture:()=>ce,createImgBItMapForArrayBuffer:()=>he,createImgBItMapForBlob:()=>pe,createScreenForTexture:()=>fe,cubeTextureStrs:()=>ie,defExportTextureUserData:()=>T,default:()=>E,disposeTexture:()=>C,getBlobByTexture:()=>B,getCloneIdFromTexture:()=>K,getImageBitMapOptions:()=>z,getImageDomByUrl:()=>te,getMd5ForTexture:()=>ae,getMimeByTexture:()=>k,getSizeByTexture:()=>H,getTextureGm:()=>be,getTextureGmByRatio:()=>ve,getTextureGpuMemory:()=>A,getTextureMinFilter:()=>Q,getTextureSize:()=>ge,getTextureType:()=>oe,getTextureUrl:()=>ye,getTexturesGpuMemory:()=>P,getUrlByTexture:()=>V,helperTexture:()=>le,initTexture:()=>j,isClonedTexture:()=>W,isCubeTexture:()=>ne,isInvalidTexture:()=>re,isTexture:()=>Z,loadTexture:()=>F,mergeDefUserData:()=>_,parseImageBitMapByBlob:()=>N,setMimeForTexture:()=>O,setTextureBlob:()=>L,setTextureCloneId:()=>q,setTextureEncodeing:()=>se,setTextureImageForBase64:()=>de,setTextureImageForBlob:()=>me,setTextureMapping:()=>G,setTextureMinFilter:()=>Y,setTextureUrl:()=>R,textureNameMap:()=>D,textureToBase64:()=>ue,unDelAbleTexture:()=>ee,updateTexture:()=>X});var n=r(6001),a=r(8881);function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function")}var t,r;return t=e,r=[{key:"fromCubeTexture",value:function(e){for(var t=0,r=new a.Vector3,n=new a.Vector3,i=new a.Color,s=[0,0,0,0,0,0,0,0,0],l=new a.SphericalHarmonics3,c=l.coefficients,u=0;u<6;u++)for(var d,h,p=(h=e.image[u]).width,m=h.height,f=(((d=document.createElement("canvas")).width=p,d.height=m,d=d.getContext("2d")).drawImage(h,0,0,p,m),h=d.getImageData(0,0,p,m)).data,g=h.width,v=2/g,b=0,y=f.length;b<y;b+=4){i.setRGB(f[b]/255,f[b+1]/255,f[b+2]/255),o(i,e.colorSpace);var x=((S=b/4)%g+.5)*v-1,w=1-(Math.floor(S/g)+.5)*v;switch(u){case 0:r.set(-1,w,-x);break;case 1:r.set(1,w,x);break;case 2:r.set(-x,1,-w);break;case 3:r.set(-x,-1,w);break;case 4:r.set(-x,w,1);break;case 5:r.set(x,w,-1)}var S=r.lengthSq(),M=4/(Math.sqrt(S)*S);t+=M,n.copy(r).normalize(),a.SphericalHarmonics3.getBasisAt(n,s);for(var T=0;T<9;T++)c[T].x+=s[T]*i.r*M,c[T].y+=s[T]*i.g*M,c[T].z+=s[T]*i.b*M}for(var _=4*Math.PI/t,E=0;E<9;E++)c[E].x*=_,c[E].y*=_,c[E].z*=_;return new a.LightProbe(l)}},{key:"fromCubeRenderTarget",value:function(e,t){for(var r=0,n=new a.Vector3,i=new a.Vector3,s=new a.Color,l=[0,0,0,0,0,0,0,0,0],c=new a.SphericalHarmonics3,u=c.coefficients,d=0;d<6;d++)for(var h=t.width,p=new Uint8Array(h*h*4),m=(e.readRenderTargetPixels(t,0,0,h,h,p,d),2/h),f=0,g=p.length;f<g;f+=4){s.setRGB(p[f]/255,p[f+1]/255,p[f+2]/255),o(s,t.texture.colorSpace);var v=((y=f/4)%h+.5)*m-1,b=1-(Math.floor(y/h)+.5)*m;switch(d){case 0:n.set(1,b,-v);break;case 1:n.set(-1,b,v);break;case 2:n.set(v,1,-b);break;case 3:n.set(v,-1,b);break;case 4:n.set(v,b,1);break;case 5:n.set(-v,b,-1)}var y=n.lengthSq(),x=4/(Math.sqrt(y)*y);r+=x,i.copy(n).normalize(),a.SphericalHarmonics3.getBasisAt(i,l);for(var w=0;w<9;w++)u[w].x+=l[w]*s.r*x,u[w].y+=l[w]*s.g*x,u[w].z+=l[w]*s.b*x}for(var S=4*Math.PI/r,M=0;M<9;M++)u[M].x*=S,u[M].y*=S,u[M].z*=S;return new a.LightProbe(c)}}],r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function o(e,t){switch(t){case a.SRGBColorSpace:e.convertSRGBToLinear();break;case a.LinearSRGBColorSpace:case a.NoColorSpace:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.")}}var l=r(6422),c=r(3263),u=r(1794),d=r(6292),h=r(135),p=r(3736),m=r(9430),f=r(2233),g=r(5317);class v{constructor(e){this.onDel=e=>{(e=(0,f.Ki)(e))&&this.runScene.cb.msg.del.cb({id:e})},this.onAdd=e=>{const t=(0,f.Ki)(e);if(t){const r=this.getEffectType(e);r&&this.runScene.cb.msg.add.cb({tipType:"info",type:"texture",id:t,data:r.map((e=>({subType:e,id:t})))})}},this.runScene=e,this.init()}init(){this.runScene.cb.texture.add.add("texture-msg",this.onAdd),this.runScene.cb.texture.remove.add("texture-msg",this.onDel)}getEffectType(e){let t=[];var{size:e,blob:r,gm:n}=e.userData;return r&&1024e3<r.size&&t.push("overSize"),e?(({width:r,height:e}=e),3686400<r*e&&t.push("overSolution")):14745600<n&&t.push("overSolution"),0<t.length?t:void 0}}var b=r(6006),y=r(1398),x=r(7201);const w={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 S{constructor(e){this.onDeleteSnapshot=e=>{const{data:t,name:r}=e;(e=t.data.get("texture"))&&(0,n.mapObj)(e,(e=>{(e=this.runScene.uniqueEx.texture.get(e))&&this.setUnDel(e,!1,r)}))},this.resetItem=e=>{"texture"===e.type&&e.datas.map((t=>{const{data:r,name:n}=t;let a=r.get("texture");a||(a={},r.set("texture",a)),e.targets.map((e=>{var t=(0,f.Ki)(e);t&&(a[t]=this.getItem(e,n))}))}))},this.setUnDel=(e,t,r)=>{if(t){if(ee.is(e))return}else if(ee.getRef(e)!=="snapshot_"+r)return;ee.set(e,t,"snapshot_"+r)},this.getItem=(e,t)=>{this.setUnDel(e,!0,t);const r=y.LV.getDiff(w,e);return(t=this.runScene.script.texture.get(e))&&(r.uvScript=Object.assign({},t)),r},this.getDiff=e=>{let t={};return this.runScene.uniqueEx.texture.getAll().map((({texture:r})=>{var n=(0,f.Ki)(r);n&&(t[n]=this.getItem(r,e))})),t},this.create=e=>{var t=this.getDiff(e.name);0!==(0,x.objLength)(t)&&e.data.set("texture",t)},this.set=e=>{var t=e.snapshot.data.get("texture");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.texture.get(t))&&(y.LV.set({def:w,data:r,runScene:this.runScene,map:e,target:t}),this.runScene.script.texture.parse(r.uvScript,t),this.runScene.script.texture.set(r.uvScript,t))}))},this.runScene=e,this.runScene.cb.snapshot.create.add("texture",this.create),e.cb.snapshot.delUseless.add("texture",(t=>{(0,n.mapObj)(t,((t,r)=>{const a=r.data.texture;a&&((0,n.mapObj)(a,(t=>{0<e.uniqueEx.texture.getTimeCitedLength(t)||delete a[t]})),0===(0,x.objLength)(a)&&delete r.data.texture)}))})),this.runScene.cb.snapshot.set.add("texture",this.set),this.runScene.cb.snapshot.getLength.add("texture",(e=>{var t=e.data.data.get("texture");t&&(e.inputData.texture=Object.keys(t).length)})),this.runScene.cb.snapshot.delete.add("texture",this.onDeleteSnapshot),this.runScene.cb.snapshot.resetItem.add("texture",this.resetItem)}}var M=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const T={md5:void 0,format:void 0,size:void 0,uvScript:void 0,unDelAble:void 0,unDelAbleRef:void 0,id:void 0,cloneSourceId:void 0,minFilter:void 0,isHdr:void 0,cubeMap:void 0,isHelper:void 0,blobMap:void 0,lightProbeIntensity:void 0},_=(e,t)=>{(0,n.mapObj)(T,((r,n)=>{var a=e[r];a!==n&&(t[r]=a)}))};class E{constructor(e){this.defEncoding=d.Z.LinearEncoding,this.allTextures=new Set,this.awaitLoader=new u.Z,this.rgbeLoader=new l.x,this.spcielBack=["hdr","pic"],this.inited=()=>{this.runScene.cb.exporter.gltf.options.add.cb({type:"texture",parse:e=>{e&&(e=JSON.parse(e),(0,n.mapObj)(e,((e,t)=>{this[e]=t})))},process:()=>{const e={};return this.defEncoding!==d.Z.LinearEncoding&&(e.defEncoding=this.defEncoding),JSON.stringify(e)}})},this.cubeLoader=new a.CubeTextureLoader,this.setAnima=e=>{const{texture:t,type:r,val:n}=e,a=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=a),0===n?delete a[r]:a[r]=n,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:a})},this.awaitOuterToImgBitMapMap=new u.Z,this.runScene=e,this.snapshot=new S(e),this.msg=new v(e),this.multip=new b.Z(e),this.runScene.cb.inited.add("texture",this.inited)}load(e,t){return M(this,void 0,void 0,(function*(){var r=yield(0,g.urlToBlob)(e);return this.parse(r,t)}))}onLoaded(e){return M(this,void 0,void 0,(function*(){var t=(0,f.Ki)(e);let r=this.awaitLoader.get(t);yield this.runScene.textureEx.afterLoad(e),r.map((e=>e()))}))}parse(e,t){return M(this,void 0,void 0,(function*(){var r=(t=(0,g.mergeObject)({flipY:!0,isEnv:!1},t)).isEnv;let n,a;if(Z(e))return e;if(e instanceof Array)if(6===e.length)n=yield this.praseCubeByFiles(e),a=yield(0,g.fileToBlob)(e[0]);else{const r=e[0],i=(a=yield(0,g.fileToBlob)(r),r.name.toLocaleLowerCase());this.spcielBack.includes(i.substring(i.lastIndexOf(".")+1))?(n=yield this.parseHdr(a)).userData.isHdr=!0:n=yield F(a,t)}else e instanceof File?(a=yield(0,g.fileToBlob)(e),this.spcielBack.includes(e.name.substring(e.name.lastIndexOf(".")+1))?(n=yield this.parseHdr(a)).userData.isHdr=!0:n=yield F(a,t)):n=n||(yield F(e,t));return r&&G(n),this.afterLoad(n,a)}))}praseCubeByFiles(e){return M(this,void 0,void 0,(function*(){const t={};if(6!==e.length)throw TypeError("立方体纹理加载时,必须包含六张贴图");const r=[];var n=e.map((e=>M(this,void 0,void 0,(function*(){var n=ie.findIndex((t=>e.name.includes(t)));if(-1===n)throw TypeError("立方体纹理加载时,文件名必须包含方位信息");var a=URL.createObjectURL(e);t[ie[n]]=yield(0,g.fileToBlob)(e),r[n]=a}))));yield Promise.all(n);const a=yield this.cubeLoader.loadAsync(r);return a.encoding=d.Z.sRGBEncoding,a.userData.blobMap=t,a}))}praseCubeByBlobMap(e){return M(this,void 0,void 0,(function*(){const t=yield this.cubeLoader.loadAsync(ie.map((t=>URL.createObjectURL(e[t]))));return t.encoding=d.Z.sRGBEncoding,t.userData.blobMap=e,t}))}createLightProbe(){}setLightProbeForCube(e,t,r){var n=e.userData.lightProbe;if(t){if(!n){const t=new a.LightProbe;return t.copy(s.fromCubeTexture(e)),void 0!==r&&(t.intensity=r),e.userData.lightProbe=t,this.runScene.helperEx.setHelper(t,!0),this.runScene.modelEx.add(t,void 0,{addToTree:!1,addUndo:!1,isClone:!1}),t}}else n&&(this.runScene.modelEx.remove(e.userData.lightProbe,!1),delete e.userData.lightProbe)}parseHdr(e){return M(this,void 0,void 0,(function*(){const t=yield this.rgbeLoader.loadAsync(URL.createObjectURL(e));return t.userData.md5=(0,g.getMd5)(t.source.data.data),t.encoding=d.Z.LinearEncoding,t}))}clone(e){const t=e.clone();return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,n.getId)(),cloneSourceId:(0,f.Ki)(e)}),(0,p.bv)(t,"minFilter"),I(t,this.runScene),this.getSameAndAddtoAll(t)}getDef(e){return e=new a.Texture(e),I(e,this.runScene),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))||(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return M(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield I(e,this.runScene,t))}))}getSameTexture(e,t){if(!W(t))for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e)return r.mapping===t.mapping?r:void 0}}initTextureAndAddtoAll(e){return M(this,void 0,void 0,(function*(){return j(e),I(e,this.runScene),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,g.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t,r){return M(this,void 0,void 0,(function*(){var a=(r||{}).addUndo;let i;i=Z(t)?t:t?yield this.parse(t):null;var s=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(s){const e=[];return yield Promise.all((0,n.mapObj)(s,((t,{datas:r,type:n})=>{if("scene"===n)r.map((e=>this.runScene.sceneEx.set(e,i)));else{const n=this.runScene.uniqueEx.material.get(t);if(n)return Promise.all(r.map((t=>M(this,void 0,void 0,(function*(){e.push(yield this.runScene.materialEx.setTexture({material:n,type:t,newVal:i,getUndo:!0},!1))})))))}}))),a&&this.runScene.undoEx.addUndo(e),e}}))}remove(e){return M(this,void 0,void 0,(function*(){const t=(0,f.Ki)(e);var r=this.runScene.uniqueEx.texture.map[t];if(r){const a=[];r=r.targets;const i=[],s=((0,n.mapObj)(r,((e,{datas:t})=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{i.push(this.runScene.materialEx.setTexture({material:r,type:e,newVal:null,getUndo:!0},!1))})),(0,h.updateMaterial)(r))})),yield Promise.all(i).then((e=>{a.push(...e)})),this.runScene.uniqueEx.texture.map[t]);a.push(new m.Z({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 m.Z({undo:()=>{this.runScene.uniqueEx.texture.map[t]=s},redo:()=>{delete this.runScene.uniqueEx.texture.map[t]}}).execute()),this.runScene.undoEx.addUndo(a)}}))}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),ne(e)&&this.setLightProbeForCube(e,!1),C(e)}reverseImageBitMapTexture(e){return M(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:r}=yield(0,g.reverseImageBitMap)(e.image);const i=new a.Texture(r);return i.needsUpdate=!0,r=this.runScene.uniqueEx.texture.map[e.userData.id],(0,n.mapObj)(r.targets,((t,{datas:r})=>{const n=this.runScene.uniqueEx.material.get(t);r.forEach((t=>{this.runScene.materialEx.setTexture({material:n,type:t,newVal:e},!1)}))})),j(i),yield I(i,this.runScene),this.runScene.cb.texture.add.cb(i),this.delete(e),(0,g.disposeCanvas)(t),i}))}setUnDelAble(e,t,r="custom",n){ee.set(e,t,r,n),this.runScene.cb.texture.set.cb({type:"unDelAble",texture:e,data:t})}getUsedModel(e,t=!0){if(e=(0,f.Ki)(e)){const r=[];if((e=this.runScene.uniqueEx.texture.map[e])&&((0,n.mapObj)(e.targets,(e=>{const t=this.runScene.uniqueEx.material.map[e];t&&r.push(...t.models.toArray())})),0!==r.length))return t&&this.runScene.multipSelector.add(r,!0),r}}getUsedMaterial(e){if((e=(0,f.Ki)(e))&&(e=this.runScene.uniqueEx.texture.map[e]))return(0,n.mapObj)(e.targets,(e=>null==(e=this.runScene.uniqueEx.material.map[e])?void 0:e.material)).filter((e=>e))}setMinFilter(e){this.runScene.uniqueEx.texture.getAll().map((({texture:t})=>{Y(t,e)}))}getSize(e){let t=0;return e.userData.blobMap?(0,n.mapObj)(e.userData.blobMap,((e,r)=>t+=r.size)):t+=e.userData.blob.size,t}setEncoding(e){const t="def"===e?d.Z.LinearEncoding:d.Z.sRGBEncoding;this.defEncoding=t,this.runScene.uniqueEx.texture.getAll().map((e=>{const r=e.texture;r.encoding=t,r.needsUpdate=!0}))}getAllBase64ByType(e){const t={};return this.runScene.uniqueEx.texture.getAll().map((({texture:e,base64:r})=>M(this,void 0,void 0,(function*(){var n,a=(0,f.Ki)(e);!a||(n=e.image)instanceof ImageBitmap&&(t[a]=r||(0,g.imgBitMapToBase64)(n))})))),t}createByImg(e,t){return e=new a.Texture(e),this.afterLoad(e,t)}bindDataForTexture(e,t){t.repeat.copy(e.repeat),t.offset.copy(e.offset),t.center.copy(e.center),t.rotation=e.rotation,(0,n.mapObj)(e.userData.uvScript||{},((e,r)=>{this.setAnima({texture:t,type:e,val:r})})),Y(t,Q(e)),t.encoding=e.encoding}toStandard(e){return M(this,void 0,void 0,(function*(){var t=e.source.data;return t?(t instanceof ImageBitmap||(yield this.otherToImgBitMap(e)),{valid:!0}):{valid:!1}}))}otherToImgBitMap(e){var t=(0,f.Ki)(e);return this.awaitOuterToImgBitMapMap.has(t)?e:(this.awaitOuterToImgBitMapMap.set(t,!0),this._imgToImgBitMap(e))}_imgToImgBitMap(e){return M(this,void 0,void 0,(function*(){var t=e.source.data;if(t.localName&&"img"===t.localName){if(!(t=t.src))return;if(!(t=yield(0,g.blobUrlToBlob)(t)))return;if(!(t=yield pe(t)))return;e.source.data=t}return e}))}}const D={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},O=(e,t)=>{let r="image/jpeg"===t?1022:1023;return e.format=r,e},k=e=>1023===e.format?"image/png":"image/jpeg",P=e=>{let t=0;return e.map((e=>t+=A(e))),t},A=e=>{if(e.userData.gm)return e.userData.gm;let t=0,r=e.source.data;return(r=e.source.data instanceof Array?r:[e.source.data]).map((e=>{var{width:e,height:r}=e||{width:0,height:0};t+=e*r*4*1.33})),t},C=e=>{var t,r;e&&(t=e.image,r=e.userData.url,t instanceof ImageBitmap?(0,g.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,g.disposeCanvas)(t),URL.revokeObjectURL(r),e.dispose())},L=(e,t)=>{e.userData.blob=t,e.userData.mimeType=t.type},R=(e,t)=>{e.userData.isHdr?e.userData.url=fe(e):e.userData.url=URL.createObjectURL(t)},I=(e,t,r)=>M(void 0,void 0,void 0,(function*(){e.userData.isHdr&&(e.flipY=!0),3e3===e.encoding&&(e.encoding=t.textureEx.defEncoding);var n=(0,g.isBlob)(e.userData.blob)?e.userData.blob:null,{md5:a,url:i}=(n=r||n||(yield B(e)),L(e,n),e.userData);return a||(e.userData.md5=yield ae(e)),i||R(e,n),e.userData.gm=A(e),e.needsUpdate=!0,e})),B=e=>(0,g.isBlob)(e.userData.blob)?e.userData.blob:(0,g.imgBitMapToBlob)(e.image),j=e=>{if(!e.userData.isHdr&&!e.isCubeTexture)return e.magFilter=1006,e.wrapS=d.Z.RepeatWrapping,e.wrapT=d.Z.RepeatWrapping,3001!==e.encoding&&(e.encoding=3e3),e.version=3,e.userData.flipY?e.flipY=!0:e.flipY=!1,e.flipY=!0,"nearest"!==Q(e)&&(e.minFilter=d.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e},U={resizeQuality:"pixelated"},N=(e,t)=>{const r=Object.assign({},U);return null!=t&&t.flipY&&(r.imageOrientation="flipY"),createImageBitmap(e,r)},z=e=>{const t={resizeQuality:"pixelated"};return null!=e&&e.flipY&&(t.imageOrientation="flipY"),t},F=(e,t)=>M(void 0,void 0,void 0,(function*(){var r=yield N(yield te(e instanceof Blob?URL.createObjectURL(e):e),t);const n=new a.Texture(r);return n.needsUpdate=!0,n})),V=e=>null==(e=e.userData)?void 0:e.url,G=(e,t="repeat")=>(e.mapping="repeat"===t?d.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),H=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},Z=e=>null==e?void 0:e.isTexture,W=e=>void 0!==e.userData.cloneSourceId,K=e=>e.userData.cloneSourceId,q=(e,t)=>{e.userData.cloneSourceId=t},X=e=>{e.needsUpdate=!0},Y=(e,t)=>{e.minFilter=d.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,p.M)(e,"minFilter",t),X(e)},Q=e=>(0,p.is)(e,"minFilter")||"linear",J="unDelAble",$="unDelAbleRef",ee={is:e=>(0,p.is)(e,J),getRef:e=>(0,p.is)(e,$),set(e,t,r="custom",n){if(t)(0,p.M)(e,J,t),(0,p.M)(e,$,r);else{let t=!1;(t=!(!n&&(0,p.is)(e,$)!==r)||t)&&(delete e.userData[J],delete e.userData[$])}}},te=e=>{const t=document.createElement("img");return t.src=e,new Promise((e=>{t.addEventListener("load",(()=>{e(t)}))}))},re=e=>{var t;return!!le.is(e)||0===(null==(t=e.userData.blob)?void 0:t.size)||void 0!==(null==(t=e.source)?void 0:t.data.width)&&(0===(null==(t=e.source)?void 0:t.data.width)||0===e.source.data.height)},ne=e=>e.isCubeTexture||!1,ae=e=>M(void 0,void 0,void 0,(function*(){var t;return ne(e)?(t=(yield Promise.all(ie.map((t=>M(void 0,void 0,void 0,(function*(){return(0,g.getMd5)(yield e.userData.blobMap[t].arrayBuffer())})))))).reduce(((e,t)=>e+t)),(0,g.getMd5)(t)):(0,g.getMd5)(yield e.userData.blob.arrayBuffer())})),ie=["px","nx","py","ny","pz","nz"],se=(e,t)=>{e.encoding="def"===t?d.Z.LinearEncoding:d.Z.sRGBEncoding,e.needsUpdate=!0},oe=e=>e.userData.isHdr?"hdr":e.isCubeTexture?"cube":"normal",le={is:e=>(0,p.is)(e,"isHelper"),set(e,t){t?(0,p.M)(e,"isHelper",!0):delete e.userData.isHelper}},ce=()=>new d.Z.Texture(new Image(1,1)),ue=e=>{if((e=e.image)instanceof ImageBitmap)return(0,g.imgBitMapToBase64)(e)},de=(e,t)=>M(void 0,void 0,void 0,(function*(){me(e,(0,g.base64ToBlob)(t))})),he=e=>pe(new Blob([e])),pe=e=>createImageBitmap(e,Object.assign(Object.assign({},U),{imageOrientation:"flipY"})),me=(e,t)=>M(void 0,void 0,void 0,(function*(){var r=yield createImageBitmap(t,Object.assign(Object.assign({},U),{imageOrientation:"flipY"}));e.image=r,L(e,t),R(e,t),e.needsUpdate=!0})),fe=(()=>{const e=new a.Scene,t=new a.PerspectiveCamera,r=new a.WebGLRenderer;return new d.z(t,r.domElement),e.add(t),n=>{var{width:a,height:i}=n.source.data;return r.setSize(a,i),e.background=n,r.render(e,t),r.domElement.toDataURL("image/webp")}})(),ge=e=>(null==(e=null==(e=e.userData)?void 0:e.blob)?void 0:e.size)||0,ve=(e,t)=>{var{width:e,height:r}=e.image;return e*t*r*t*4*1.33},be=(e,t)=>{let r=0;return c.F6.toArr(e).map((e=>{r+=ve(e,t||1)})),r},ye=e=>(0,p.is)(e,"url")},6006:(e,t,r)=>{r.d(t,{Z:()=>s}),t=r(7995);var n=r(3263),a=r(1794),i=r(2233);class s{constructor(e){this.map=new a.Z,(this.runScene=e).cb.events.window.pointer.up.add("core-texture",(()=>{this.clear()}))}add(e,t){t&&this.clear(),n.F6.toArr(e).map((e=>{var t=(0,i.Ki)(e);if(t){if(this.map.has(t))return this.del(e);s.callBack.add.cb({texture:e}),this.map.set(t,e)}}))}del(e){var t=(0,i.Ki)(e);t&&(this.map.delete(t),s.callBack.del.cb({texture:e}))}clear(){this.map.clear(),s.callBack.clear.cb(0)}setSelect(e){this.runScene.events.key.ctrl?this.add(e):(this.clear(),this.selected=e,s.callBack.setSelect.cb({texture:e}))}}s.callBack={setSelect:new t.Z,add:new t.Z,del:new t.Z,clear:new t.Z}},6651:(e,t,r)=>{r.d(t,{ZP:()=>n,d9:()=>a});class n{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.clean=()=>{this.reset()},this.runScene=e,this.runScene.cb.clean.add("Undo",this.clean)}undo(){if(0!==this.undos.length){const e=this.removeUndos(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e),this.runScene.cb.undo.undo.cb({data: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),this.runScene.cb.undo.redo.cb({data:e}))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.cb.undo.reset.cb("")}}var a=function(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=a(e[t]),n[t]=r);return n}}},4773:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(1269);class a{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:a,runScene:i,isScene:s}=e;this.runScene=i,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===a&&(this.isClone=a),r&&(this.cb=r),this.isScene=s}remove(e){const{model:t,parent:r,addTree:n,runScene:a}=e;a.modelEx.select===t&&a.modelEx.selectNull(),r.remove(t),n&&a.uniqueEx.model.remove(t),n&&a.cb.model.remove.cb({model:t,parent:r}),this.cb(t,"remove"),a.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:r,addTree:a,isClone:i,runScene:s,isScene:o}=e;r.add(t),a&&s.uniqueEx.model.add(t),a&&s.cb.model.add.cb({model:t,parent:r,isClone:i,isScene:o}),this.cb(t,"add"),s.uniqueEx.material.addModel(t,t.material),(0,n.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)}))}}},4616:(e,t,r)=>{r.d(t,{Z:()=>n});class n{}},9430:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.info="函数修改",this.map=e}_execute(e,t){throw new Error("Method not implemented.")}execute(){return this.map.redo(),this}undo(){this.map.undo()}redo(){this.map.redo()}}const a=n},3735:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(6001);class a extends r(4616).Z{constructor(e){super(),this.type="多层级修改",this.isUndoMultipLevel=!0,this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,e.executeFn&&(this.executeFn=e.executeFn),this.old=(0,n.objLastMap)(e.target,this.typeList)[(0,n.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,n.objLastMap)(this.target,this.typeList);var r=t[(0,n.lastArrayEle)(this.typeList)];this.executeFn?this.executeFn({typeList:this.typeList,target:this.target,val:e,oldVal:r}):t[(0,n.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t,{typeList:this.typeList,target:this.target,val:e,oldVal:r})}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const i=a},2510:(e,t,r)=>{r.d(t,{Z:()=>i}),t=r(4616);var n=r(3263);class a extends t.Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=(e,t,r,n)=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:a,cb:i,executeCb:s}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,i&&(this.cb=i),s&&(this.executeCb=s)}_execute(e,t){var{target:r,info:a}=this,r={target:r,info:a,val:e,type:t},i=this.runScene.cb.undo.normal.valid.cb(r);if(n.F6.isTrues(i)){if(this.executeCb)return this.executeCb(r);this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(i=this.runScene.uniqueEx.model.parseName(this.target),r=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=i||e,oldName:r})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.cb.model.setVisible.cb({model:this.target,visible:e}),this.runScene.cb.model.change.cb({type:this.info,model:this.target,val:e}),this.cb(this.target,t,e,a)}}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,"undo")}redo(){this._execute(this.newVal,"redo")}}const i=a},7169:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends r(4773).Z{constructor(e){super(e),this.type="移除模型",this.isUndoRemove=!0}undo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}redo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}_execute(e){return Promise.reject()}execute(){return this.redo(),this}}},4380:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";const{target:t,info:r,newV3:n,oldV3:a,runScene:i}=e;this.target=t,this.info=r,this.runScene=i,this.newV3=n,this.oldV3=a||t[r].clone(),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.runScene.cb.model.setVector3.cb({type:this.info,model:this.target}),this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}}const a=n},2233:(e,t,r)=>{r.d(t,{ZP:()=>g,Ki:()=>v,x:()=>b});var n=r(6001),a=r(272),i=r(135),s=r(9457),o=r(3263);class l{constructor(e){this.map={},this.removes=[],this.getUnUsers=()=>o.F6.filter((0,n.mapObj)(this.map,((e,{material:t,models:r})=>0===r.size?{id:e,material:t}:null))),this.unique=e}add(e,t,r){(0,i.getMaterials)(e).map((e=>{if(null!=e&&e.userData&&!i.materialIgnore.is(e)){let i=e.userData.id;if(i||(i=(0,n.getId)(),e.userData.id=i),this.map[i]){if(this.map[i].material.name!==e.name){const t=(0,n.getId)();e.userData.id=t,this.map[t]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e)}}else this.map[i]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e),"MeshPhongMaterial"===e.type&&s.Z.afterload(e,this.unique.runScene);t?this.addModel(t,e,r):this.unique.runScene.cb.unique.material.setTimecited.cb({material:e,length:this.map[i].models.size})}}))}addModel(e,t,r){if(!r||!t||v(r)!==v(t)){if(null!=t&&t.userData){var n=v(t);const r=this.map[n];r&&(r.models.add(e),this.unique.runScene.cb.unique.material.setTimecited.cb({material:t,length:r.models.size}))}if(r){const t=this.map[v(r)];t&&((n=t.models.find((t=>v(t)===v(e))))&&t.models.delete(n),this.unique.runScene.cb.unique.material.setTimecited.cb({material:r,length:t.models.size}))}}}each(e){return this.getAll("values").map((({material:t})=>e(t)))}getAll(e){return Object[e](this.map)}get(e){return null==(e=this.map[e])?void 0:e.material}getModels(e){return null==(e=this.map[e])?void 0:e.models}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,n.mapObj)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}isUsed(e){return!!(e=this.map[e])&&0<e.models.size}clearUnUsed(){this.getUnUsers().map((({material:e})=>{this.unique.runScene.materialEx.remove(e)}))}}var c=r(1269),u=r(8609),d=r(158);class h extends r(8716).Z{constructor(){super(...arguments),this.nameMap={},this.map={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1===t?-1:(e=e.slice(t+1),n.type.isNumber(e)?Number.parseInt(e):-1)},t=(r,n)=>{var a=(t=>{if(-1===e(t))return t;var r=t.lastIndexOf("_");return-1===r?t:t.slice(0,r)})(r)+"_"+n++;return this.nameMap[a]?t(r,n):a},r=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),a=["PerspectiveCamera"];return n=>{if(a.includes(n.type))return n.name=n.type;let i=n.name;if(i=i||n.type,!this.nameMap[i])return o=this.unique.getId(n),(s=r(o))&&delete this.nameMap[s],this.nameMap[i]=o,i;var s=this.nameMap[i];if(this.unique.model.get(s)===n)return i;var o=e(i);return o=t(i,s=-1===o?0:o),this.nameMap[o]=this.unique.getId(n),n.name=o}})(),this.getByFilterRules=e=>{const{type:t,func:r}=e;return this.find((({model:e,type:n})=>{if(t.includes(n)){for(const t of r){if("lock"===t)return u.lockModel.isLock(e,!1);if("dynamic"===t)return u.dynamicModel.isDynamic(e)}return!0}}))}}add(e,t){var{reset:r,hasReset:a,oldId:i}=t||{ignoreMaterial:!1};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e&&!(0,u.isHelper)(e)){i&&delete this.map[i];let s=e.userData.id;if(s&&!r||(s=(0,n.getId)(),e.userData.id=s),this.map[s]){if(!(a||(0,d.An)(this.unique.runScene)&&(0,d.FW)(this.unique.runScene).coverSameId))return void(e.name!==this.map[s].model.name&&this.unique.runScene.optionsEx.log(`解析模型出错,${e.name} 与 ${this.map[s].model.name} 拥有相同的id,请选择任意一个模型导出并删除,并重新导入。`,"base","error"));s=(0,n.getId)(),e.userData.id=s}return this.unique.runScene.cb.unique.model.add.cb({model:e}),this.map[s]={model:e,type:(0,u.getModelType)(e)},this.parseName(e),e.material&&(this.unique.runScene.materialEx.parse(e.material),this.unique.material.add(e.material,e)),!e.children.length||(0,c.RQ)(e)||(0,u.isHelper)(e)?s:this.add(e.children,t)}}get(e){return null==(e=this.map[e])?void 0:e.model}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=>{this.unique.runScene.cb.unique.model.remove.cb({model:e,parent:e.parent}),delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}findModelWithName(e){var t=Object.keys(this.nameMap).filter((t=>{const r=t.toLowerCase();return r===(t=e.toLowerCase())||-1!==r.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}getModelsByType(e){return o.F6.filter((0,n.mapObj)(this.map,((t,{model:r,type:n})=>n===e&&null!==r.parent?r:null)))}has(e){return!!this.map[e]}find(e){return o.F6.filter((0,n.mapObj)(this.map,((t,r)=>{if(e(r))return r.model})))}}var p=r(8818);class m{constructor(e){this.map={},this.onSetMaterial=e=>{var{target:e,type:t,oldVal:r,val:n,targetType:a}=e;r!==n&&(r&&(this.unlinkMaterial({target:e,type:t,texture:r}),this.unique.runScene.cb.unique.texture.setTimecited.cb({texture:r,length:Object.keys((null==(r=this.map[v(r)])?void 0:r.targets)||{}).length})),n&&(this.linkMaterial(n,{target:e,type:t,targetType:a}),this.unique.runScene.cb.unique.texture.setTimecited.cb({texture:n,length:Object.keys((null==(r=this.map[v(n)])?void 0:r.targets)||{}).length})))},this.setForSavedData=e=>{},this.unique=e,this.unique.runScene.cb.texture.setMaterial.add("unique-texture",this.onSetMaterial)}add(e){if(e&&e.userData){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,n.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,targets:{}},t)}}getLength(){return Object.keys(this.map).length}unlinkMaterial(e){var t,{target:e,type:r,texture:n}=e,n=n.userData.id||this.add(n);e=v(e);const a=null==(t=this.map[n].targets[e])?void 0:t.datas;a&&(a.delete(r),0===a.size&&delete this.map[n].targets[e])}linkMaterial(e,t){var r=e.userData.id||this.add(e),{target:t,type:n,targetType:i}=t;this.map[r]||(this.map[r]={targets:{},texture:e}),e=v(t),this.map[r].targets[e]||(this.map[r].targets[e]={type:i,datas:new a.Z});const s=this.map[r].targets[e].datas;s.add(n),"material"===i&&this.unique.runScene.cb.unique.material.setTimecited.cb({material:t,length:s.size})}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.targets}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));var t=this.map[e.userData.id];t&&((0,n.mapObj)(t.targets,((e,{datas:t,type:r})=>{if("scene"===r)t.map((e=>{this.unique.runScene.sceneEx.set(e,null)}));else{const r=this.unique.runScene.uniqueEx.material.get(e);r&&t.forEach((e=>{p.ZP.setTexture({material:r,type:e,texture:null})||(r[e]=null)}))}})),delete this.map[e.userData.id])}dispose(){(0,n.mapObj)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}getAll(e){return o.F6.filter((0,n.mapObj)(this.map,((t,r)=>void 0===e?r:(t=0<this.getTimeCitedLength(t),e?t&&r:!t&&r))))}clearUnUsed(){this.getAll(!1).map((({texture:e})=>{this.unique.runScene.textureEx.remove(e)}))}getTimeCitedLength(e){return(e=this.map[e])?Object.keys(e.targets).length:0}}var f=r(1549);class g{constructor(e){this.clean=()=>{this.dispose()},this.runScene=e,this.model=new h(this),this.material=new l(this),this.texture=new m(this),this.geometry=new f.Z(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 v=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||"",b=(e,t)=>{e.userData&&(e.userData.id=t||(0,n.getId)())}},8716:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(6001);class a{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,n.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]=e,t)}get(e){return this.map[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}}},1549:(e,t,r)=>{r.d(t,{Z:()=>c});var n=r(6001),a=r(1794),i=r(272),s=r(2233),o=(t=r(8716),r(3263)),l=r(7995);class c extends t.Z{constructor(e){super(e),this.map=new a.Z,this.sameMap=new a.Z,this.onModelAdd=e=>{var t=(e=e.model).geometry;if(t){var r=this.getArr(t);if(r){var n=t.uuid,l=o.F6.toArr(e.material)[0],c=this.isSame({geometry:t,material:l});if(c){var u=c.geometry.uuid;let o=this.sameMap.get(u),d=(o||(o=new a.Z,this.sameMap.set(u,o)),o.get(n));d||(d={models:new i.Z,size:r.length,isSame:!0,geometry:t,material:l},o.set(n,d)),d.models.add((0,s.Ki)(e))}let d=this.map.get(n);return d||(d={models:new i.Z,size:r.length,isSame:void 0!==c,geometry:t,material:l},this.map.set(n,d),this.unique.runScene.cb.unique.geometry.add.cb({geometry:t})),d.models.add((0,s.Ki)(e)),n}}},this.clean=()=>{this.map.clear(),this.sameMap.clear()},this.init()}init(){this.unique.runScene.cb.unique.model.add.add("unique-geometry",this.onModelAdd),this.unique.runScene.cb.clean.add("unique-geometry",this.clean)}getArr(e){return null==(e=null==(e=e.attributes)?void 0:e.position)?void 0:e.array}isSame(e){const{geometry:t,material:r}=e;return this.map.toArray("value").find((e=>{if(t.uuid!==e.geometry.uuid&&!e.isSame&&(0,s.Ki)(r)===(0,s.Ki)(e.material)){e=this.getArr(e.geometry);var n=this.getArr(t);if(e&&n)return e.length===n.length}}))}getSize(e){let t=0;return(0,n.mapObj)(e.attributes,((e,r)=>{r=r.array,t+=(null==r?void 0:r.byteLength)||0})),t}getSameMapToMapModel(){const e={};return this.sameMap.map(((t,r)=>{const n=new i.Z,a=this.map.get(t);a&&n.add(a.models.toArray()),r.map(((e,{models:t})=>{n.add(t.toArray())})),n.size<2||(e[t]=n)})),e}processSame(e){e=e.stateMap;const t=[];(0,n.mapObj)(e,((e,{children:r})=>{let a={};const i=this.sameMap.get(e);if(i){(0,n.mapObj)(r,((e,{state:t,uuid:r})=>{void 0===a[r]&&(a[r]=t)}));const s=[],o=(i.map(((e,t)=>{!1===a[e]?this.map.set(e,t):s.push(...t.models.toArray())})),this.map.get(e));t.push({baseModels:this.unique.runScene.modelEx.getById(o.models.toArray()),mergeModels:this.unique.runScene.modelEx.getById(s)})}})),t.map((({baseModels:e,mergeModels:t})=>{e.length<1||0===t.length||this.unique.runScene.modelEx.setClonedModels(e[0],[...e,...t])}))}clearSame(){this.sameMap.clear()}}c.getCallBack=()=>({add:new l.Z,del:new l.Z})},5317:(e,t,r)=>{r.r(t),r.d(t,{HextoRgb:()=>a.I8,LimitCb:()=>a.cM,MyHextoRgb:()=>a.Dn,addElesFromIndexToArr:()=>a.Rn,angleToNum:()=>i.Zv,anima:()=>a.gY,arrayBufferToBase64:()=>a.sM,arrayBufferToBlobUr:()=>a.oo,arrayToVector3:()=>i.F,base64ToArrayBuffer:()=>a.RG,base64ToBlob:()=>a.Jr,bitMapToCanvas:()=>n.Rd,blobToFile:()=>a.hl,blobUrlToBlob:()=>a.gi,bufferToArrayBuffer:()=>a.cO,canvasToBlob:()=>a._c,changeModelOpc:()=>i.Hg,changeModelOpcs:()=>i.Z7,clone:()=>a.d9,closeNum:()=>a.nx,colorToRgb:()=>i.sS,compressImgToUrl:()=>n.jH,deepFindParentByUuid:()=>i.Q3,deepMergeObject:()=>a.U,disposeCanvas:()=>n.eZ,disposeImageBitMap:()=>n.oZ,domTo2Dui:()=>i.UZ,domTo3DSprite:()=>i.YG,domTo3Dui:()=>i.ol,fileAndBlobToCanvas:()=>a.OE,fileToBlob:()=>a.a_,filterFiles:()=>a.Rz,fromCode:()=>a.Ne,getArrIndexByItem:()=>a.B1,getBetweenByV3:()=>i.A2,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>i.Gm,getCenter:()=>i.qg,getClock:()=>i.aM,getColorByHex:()=>i.e9,getColorByHexStr:()=>i.ZD,getCurve:()=>i.kG,getDate:()=>a._3,getDefAndType:()=>i.ZE,getDiff:()=>a.ad,getDistance:()=>i.Sp,getDomChildrenByDom:()=>h,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>a.xl,getFilesFromFileList:()=>a.kk,getHexByColor:()=>i.J6,getIdxInParent:()=>o,getImg:()=>n.Pk,getImgByHdrTexture:()=>i.p1,getImgPixels:()=>n.BW,getImgPixels1:()=>n.Cm,getLine2:()=>i.SI,getMacro:()=>a.Ls,getMapByRgb:()=>a.fh,getMd5:()=>a.ZM,getModelByType:()=>i.Py,getModelMap:()=>i.yT,getNamesByNum:()=>a.nR,getOptions:()=>s.FW,getPointByProgress:()=>i.Mq,getProgress:()=>a.xC,getProxy:()=>a.Gy,getRGBByHex:()=>i.OR,getRandomColor:()=>a.mr,getRes:()=>a.sR,getResultFromCanvas:()=>n.xK,getThreeType:()=>i.ii,getTime:()=>a.hK,getTruthBase64:()=>a.Mh,getType:()=>a.oL,getTypeByBase64:()=>a.Op,getTypeFromGlb:()=>s.te,getVideoTexture:()=>i.hX,getWorldLocal:()=>i.VU,hslToRgb:()=>n.ve,imageToBlob:()=>n.$N,imgArrayBufferToBlobUrl:()=>n.lU,imgBitMapToBase64:()=>n.s4,imgBitMapToBlob:()=>n.gW,imgBitMapToBlobAndBase64:()=>n.v1,isBlob:()=>a.Lj,isDef:()=>a.Xq,isEditor:()=>s.hz,isEmpty:()=>a.xb,isRunning:()=>s.An,isVisible:()=>i.pn,longestCommonPrefix:()=>a.GG,mapDom:()=>d,mergeObject:()=>a.Gm,percentageStrToNum:()=>a.zz,removeLastDot:()=>a.dx,removeUnLess:()=>i.hs,resetCenter:()=>i.cm,reverseImageBitMap:()=>n.Fs,reverseImg:()=>n.rx,reverseTextureForImageBit:()=>i._r,rgbToHex:()=>i.vq,rgbToHsl:()=>n.lC,rgbToStr:()=>i.$W,rgbaToRgb:()=>i.Di,rmArrEle:()=>a.J9,rmPartOfString:()=>a.h3,sameArr:()=>a.F1,sameV3:()=>i.x$,setDisplayForDom:()=>p,setParentVisible:()=>i.FT,setVal:()=>i.Y6,strCompress:()=>a.Uf,strToNum:()=>a.LC,tColorToRgb:()=>i.Lv,textureToThreeD:()=>i.vp,theKey:()=>a.rv,toCode:()=>a.Ni,toInt:()=>a.Hq,toTimeString:()=>a.U9,transByte:()=>a.iM,typeAnima:()=>u,urlToBlob:()=>a.pX,urlToCanvas:()=>a.o4,v3ToMap:()=>i.ln,validType:()=>a.lG,vector:()=>i.xr});var n=r(5137),a=r(6272),i=r(8089),s=r(158);const o=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:r}=e;return[...e.children].slice(t,r+1)};var c=r(8881);const u=(e,t,r)=>{const{}=r||{},n={},i={};e.map(((e,t)=>{const{begin:r,end:s,type:o,label:l}=e,u="_"+o+"_"+l+"_"+String(t);if("color"===o&&r instanceof c.Color&&s instanceof c.Color){const e=(0,a.I8)("#"+r.getHexString(),!0),t=(0,a.I8)("#"+s.getHexString(),!0);["r","g","b"].map((r=>{var a=r+u;n[a]=e[r],i[a]=t[r]}))}"number"===o&&(n[e=l+u]=r,i[e]=s),"vector3"===o&&["x","y","z"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]})),"vector2"===o&&["x","y"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]}))}))},d=(u([{begin:new c.Color(.5,.5,.5),end:new c.Color(0,0,0),label:"color",type:"color"},{begin:1,end:2,label:"a",type:"number"},{begin:new c.Vector3(1,1,1),end:new c.Vector3(2,2,2),label:"b",type:"vector3"},{begin:new c.Vector2(1,1),end:new c.Vector2(2,2),label:"c",type:"vector2"}],1),(e,t)=>[...e.childNodes].map((e=>t(e)))),h=(e,t)=>t?[...e.childNodes]:[...e.children],p=(e,t)=>{var r;t=t?"block":"none",(null==(r=e.style)?void 0:r.display)!==t&&(e.style.display=t)}},5137:(e,t,r)=>{r.d(t,{$N:()=>c,BW:()=>f,Cm:()=>m,Fs:()=>w,Pk:()=>y,Rd:()=>g,eZ:()=>S,gW:()=>l,jH:()=>p,lC:()=>v,lU:()=>h,mH:()=>T,oZ:()=>M,rx:()=>u,s4:()=>o,v1:()=>d,ve:()=>b,xK:()=>x});var n=r(6292),a=r(9667),i=r(6272),s=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const o=e=>{const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),t.toDataURL()},l=e=>s(void 0,void 0,void 0,(function*(){if(!e)return new Blob([]);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((r=>{e(r),t.remove()}))}))})),c=e=>s(void 0,void 0,void 0,(function*(){const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),u=e=>{const t=document.createElement("canvas"),r=(t.width=e.width,t.height=e.height,t.getContext("2d"));r.translate(0,t.height),r.scale(1,-1),r.drawImage(e,0,0,t.width,t.height)},d=e=>s(void 0,void 0,void 0,(function*(){var t=e.image;const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d")),i=(0,a.getMimeByTexture)(e);return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(i)})}),i)}))})),h=(e,t)=>URL.createObjectURL(new Blob([e],t)),p=(e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d");return r.width=e.width,r.height=e.height,n.drawImage(e,0,0,e.width,e.height),new Promise((e=>{r.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},m=e=>s(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:a,canvas:s}=yield(0,i.OE)(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height});for(var o=a.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),l=0,c=o.data.length;l<c;l+=4){var u=(h=v(o.data[l],o.data[l+1],o.data[l+2]))[0]/100,d=h[1]/100,h=h[2]/100;u=b(u,d,h),o.data[l]=u[0],o.data[l+1]=u[1],o.data[l+2]=u[2]}return a.putImageData(o,0,0),new n.Z.Texture(s)})),f=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=g(e).ctx.getImageData(0,0,t,r).data,a=[],i=0;i<n/4;i+=1)a.push(n.slice(4*i,4*(i+1)))},g=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},v=(e,t,r)=>{e/=255,t/=255,r/=255;var n,a=Math.max(e,t,r),i=Math.min(e,t,r),s=(a+i)/2;if(a==i)n=l=0;else{var o=a-i,l=.5<s?o/(2-a-i):o/(a+i);switch(a){case e:n=(t-r)/o+(t<r?6:0);break;case t:n=(r-e)/o+2;break;case r:n=(e-t)/o+4}n/=6}return[100*n,100*l,100*s]},b=(e,t,r)=>{var n,a,i,s;return 0==t?a=i=s=r:(a=(n=function(e,t,r){return r<0&&(r+=1),1<r&&--r,r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e})(t=2*r-(r=r<.5?r*(1+t):r+t-r*t),r,e+1/3),i=n(t,r,e),s=n(t,r,e-1/3)),[255*a,255*i,255*s]},y=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))},x=(e,t,r)=>{const n=(0,i.Gm)({base64Type:"webp"},r).base64Type;return new Promise(((r,a)=>{"blob"===t?e.toBlob((e=>{(e?r:a)(e)})):"base64"===t&&r(e.toDataURL("image/"+n))}))},w=e=>s(void 0,void 0,void 0,(function*(){var{width:t,height:r}=e;const n=document.createElement("canvas"),a=(n.width=t,n.height=r,n.getContext("2d"));if(a)return a.translate(0,r),a.scale(1,-1),a.drawImage(e,0,0,t,r),{imageBitMap:yield createImageBitmap(a.getImageData(0,0,t,r)),canvas:n}})),S=e=>{e.remove()},M=e=>{e.close()},T=e=>{var{width:e,height:t}=e;const r=document.createElement("canvas");return(r.width=e,r.height=t,r.getContext("2d")).drawImage(new Image,0,0),r}},6272:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,Dn:()=>MyHextoRgb,F1:()=>sameArr,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,Gy:()=>getProxy,Hq:()=>toInt,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,Uf:()=>strCompress,Xq:()=>isDef,ZM:()=>getMd5,_3:()=>getDate,_c:()=>canvasToBlob,a_:()=>fileToBlob,ad:()=>getDiff,cM:()=>LimitCb,cO:()=>bufferToArrayBuffer,d9:()=>clone,dx:()=>removeLastDot,fh:()=>getMapByRgb,gY:()=>anima,gi:()=>blobUrlToBlob,h3:()=>rmPartOfString,hK:()=>getTime,hl:()=>blobToFile,iM:()=>transByte,kk:()=>getFilesFromFileList,lG:()=>validType,mr:()=>getRandomColor,nR:()=>getNamesByNum,nx:()=>closeNum,o4:()=>urlToCanvas,oL:()=>getType,oo:()=>arrayBufferToBlobUr,pX:()=>urlToBlob,rv:()=>theKey,sM:()=>arrayBufferToBase64,sR:()=>getRes,xC:()=>getProgress,xb:()=>isEmpty,xl:()=>getFilesByDataTransfer,zz:()=>percentageStrToNum});var _allex_md5__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1129),_allex_md5__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_allex_md5__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3300),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),js_funcs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6001),js_funcs__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_2__),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2958),_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(3263),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5137),__awaiter=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const anima=(e,t,r,n,a)=>{let i=Object.assign({},e),s=new _libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3(i,r,t).eventCallback("onUpdate",(e=>n&&n(i))).eventCallback("onComplete",(e=>{a&&a(),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3.killTweensOf(s)}));return s},base64ToArrayBuffer=e=>__awaiter(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=getTruthBase64(e));const t=window.atob(e);var r=t.length;const n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var r=new Uint8Array(e);for(let e=0,n=r.byteLength;e<n;e++)t+=String.fromCharCode(r[e]);return"data:image/jpg;base64,"+window.btoa(t)},urlToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return(yield axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:"blob"})).data})),base64ToBlob=e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=atob(t[1]),a=n.length,i=new Uint8Array(a);for(;a--;)i[a]=n.charCodeAt(a);return new Blob([i],{type:r})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.parseFile)(e,"base64"))})),blobToFile=(e,t)=>new File([e],t),getTypeByBase64=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),transByte=e=>{let t="";const r=t=e<102.4?e.toFixed(2)+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"M":(e/1073741824).toFixed(2)+"G";return e=r.indexOf("."),"00"==r.substr(e+1,2)?r.substring(0,e)+r.substr(e+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:r}=t;let n=new Image,a=(n.src=e,n.width=t,n.height=r,document.createElement("canvas")),i=(a.width=t,a.height=r,a.getContext("2d"));return new Promise((e=>{n.onload=function(){i.drawImage(n,0,0,a.width,a.height),e({canvas:a,ctx:i})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),canvasToBlob=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),getRes=(e,t)=>axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),mergeObject=(e,t)=>Object.assign(e,t||{}),getMacro=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},clone=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]=r);return n},getNamesByNum=(e,t,r=1,n)=>new Array(t).fill("").map(((t,a)=>e+(a+r)+(n||""))),getType=e=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((r,n)=>{let a=t[r];void 0!==a&&("Object"===getType(n)&&"Object"===getType(a)&&(a=deepMergeObject(n,a)),e[r]=a)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_5__.Pk)(e);const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d"));return n.drawImage(t,0,0),{img:t,canvas:r,ctx:n}})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},isEmpty=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0),isBlob=e=>e&&e instanceof Blob,getTime=e=>{const t=new Date;return t.setTime(t.getTime()+864e5*e),t.getTime()},theKey="gltf-version-2.0",toCode=e=>{for(var t,r,n=theKey.length,a=theKey.split(""),i="",s=0;s<e.length;s++)i+=a[((r=((r=e.charCodeAt(s))-(t=r%n))/n)-(r%=n))/n%n]+a[r]+a[t];return i},fromCode=str=>{for(var st=theKey.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=theKey.indexOf(str.charAt(d)),d++,b2=theKey.indexOf(str.charAt(d)),d++,b3=theKey.indexOf(str.charAt(d)),d++,s[i]=b1*st*st+b2*st+b3;return b=eval("String.fromCharCode("+s.join(",")+")"),b},getFilesFromFileList=e=>{const t=[];for(let n=0;n<e.length;n++){var r=e.item(n);t.push(r)}return t},filterFiles=(e,t)=>"any"===t?e:e.filter((e=>-1!==e.type.indexOf(t))),toTimeString=e=>{if(e)return e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()},rmPartOfString=(e,t)=>e.replace(new RegExp(t),""),rmArrEle=(e,t)=>{var r=e.findIndex((e=>e===t));if(-1!==r)return e.splice(r,1),r},addElesFromIndexToArr=(e,t,r)=>(t=Array.isArray(t)?t:[t],e.splice(r,0,...t)),sameArr=(e,t,r)=>{if("fill"===r){for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var n=e.length;const a=Math.floor(n/r),i=new Array(r).fill("").map(((e,t)=>(t+1)*a));i.push(0),i.push(n-1);for(const r of i)if(e[r]!==t[r])return!1;return!0};class LimitCb{constructor(){this.timer=0}update(e){const{cb:t,now:r,cbRate:n}=e;this.timer+=r,this.timer>n&&(t(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],r="",n=1;n<e.length;n++){for(var a=0;a<=e[n].length;a++){if(t[a]!=e[n][a]){t=r;break}r+=t[a]}r=""}return t},getRandomColor=()=>{let e=[];for(let t=0;t<3;++t){let t=Math.floor(256*Math.random()).toString(16);t=1==t.length?"0"+t:t,e.push(t)}return"#"+e.join("")},validType=(e,t)=>{var r;return"number"===t?(r=Number(e),!isNaN(r)):"array"===t?Array.isArray(e):void 0},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.F6.isDef(e,t):_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(e)&&_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(t)?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.isDef(e,t):e!==t,strToNum=e=>{if(e=e.replace(/[^\d]/g,""),e=Number(e),isNaN(e))throw TypeError("类型错误");return e},rgbArr=["r","g","b"],getMapByRgb=e=>{var t=e.split(",");const r={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var n=rgbArr[e],a=t[e];if(!a)return;a=strToNum(a),r[n]=a}return r};function HextoRgb(e,t){if(-1!==e.toLocaleLowerCase().indexOf("rgb"))return e;if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){if(4===e.length){for(var r="#",n=1;n<4;n+=1)r+=e.slice(n,n+1).concat(e.slice(n,n+1));e=r}var a,i,s=[];for(n=1;n<7;n+=2)s.push(parseInt("0x"+e.slice(n,n+2)));return t?([t,a,i]=s,{r:t,g:a,b:i}):"RGB("+s.join(",")+")"}return e}const getDiff=(e,t,r=0)=>{const n={};return t?((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,r)=>{var a=t[e];isDef(r,a)&&(n[e]=a)})),n):e};function MyHextoRgb(e,t){if(-1!==(e=e.toLocaleLowerCase().slice(1)).indexOf("rgb"))return e;var[e,r,n,a,i,s]=e.split(""),r=(e=parseInt("0x"+e+r),parseInt("0x"+n+a)),n=parseInt("0x"+i+s);return t?{r:e,g:r,b:n}:"RGB("+e+","+r+","+n+")"}const getDate=e=>{const t=new Date(e);return t.getFullYear()+"/"+String(t.getMonth()+1).padStart(2,"0")+"/"+String(t.getDate()).padStart(2,"0")},percentageStrToNum=e=>(e=Number(e.replace(/%/,"")),isNaN(e)?-1:.01*e),toInt=e=>parseInt(String(e)),closeNum=(e,t,r)=>e<t+r&&t-r<e,strCompress={encrypt:e=>{if(""==e)return"";let t=theKey;if(e=encodeURIComponent(e),""==(t=encodeURIComponent(t))||t.length<=0)return"";for(var r="",n=0,a=t.length;n<a;n+=1)r+=t.charCodeAt(n).toString();var i=Math.floor(r.length/5),s=parseInt(r.charAt(i)+r.charAt(2*i)+r.charAt(3*i)+r.charAt(4*i)+r.charAt(5*i)),o=Math.ceil(t.length/2),l=Math.pow(2,31)-1;if(s<2)return"";var c=Math.round(1e9*Math.random())%1e8;for(r+=c;10<r.length;)r=(parseInt(r.substring(0,10))+parseInt(r.substring(10,r.length))).toString();r=(s*r+o)%l;var u="",d="";for(n=0,a=e.length;n<a;n+=1)d+=(u=parseInt(String(e.charCodeAt(n)^Math.floor(r/l*255))))<16?"0"+u.toString(16):u.toString(16),r=(s*r+o)%l;for(c=c.toString(16);c.length<8;)c="0"+c;return d+c},decrypt:e=>{if(""==e)return"";let t=theKey;if(t=encodeURIComponent(t),null==e||e.length<8)return"";if(null==t||t.length<=0)return"";for(var r="",n=0,a=t.length;n<a;n+=1)r+=t.charCodeAt(n).toString();var i=Math.floor(r.length/5),s=parseInt(r.charAt(i)+r.charAt(2*i)+r.charAt(3*i)+r.charAt(4*i)+r.charAt(5*i)),o=Math.round(t.length/2),l=Math.pow(2,31)-1;for(i=parseInt(e.substring(e.length-8,e.length),16),e=e.substring(0,e.length-8),r+=i;10<r.length;)r=(parseInt(r.substring(0,10))+parseInt(r.substring(10,r.length))).toString();r=(s*r+o)%l;var c,u="";for(n=0,a=e.length;n<a;n+=2)c=parseInt(String(parseInt(e.substring(n,n+2),16)^Math.floor(r/l*255))),u+=String.fromCharCode(c),r=(s*r+o)%l;return decodeURIComponent(u)}},removeLastDot=e=>{const t=e.split(".");return 1<t.length&&t.pop(),t.join(".")},getProxy=e=>new Proxy(e,{set:(e,t,r)=>(e[t]=r,console.log(e,t,r,"a,b,c"),!0)}),blobUrlToBlob=e=>new Promise(((t,r)=>{const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(){var e;200===this.status?(e=this.response,t(e)):r(this.status)},n.send()}))},158:(e,t,r)=>{r.d(t,{An:()=>i,FW:()=>s,hz:()=>a,te:()=>n});const n=e=>{},a=e=>"editor"===e.optionsEx.options.mode,i=e=>"running"===e.optionsEx.options.mode,s=e=>e.optionsEx.options},8089:(e,t,r)=>{r.d(t,{Zv:()=>pe,F:()=>de,Hg:()=>ie,Z7:()=>se,sS:()=>_e,Q3:()=>Ce,UZ:()=>ne,YG:()=>ae,ol:()=>re,A2:()=>ge,Gm:()=>fe,qg:()=>ke,aM:()=>ve,e9:()=>be,ZD:()=>ye,kG:()=>ue,ZE:()=>Ve,Sp:()=>te,J6:()=>xe,p1:()=>Ne,SI:()=>he,Py:()=>Ae,yT:()=>me,Mq:()=>He,OR:()=>we,ii:()=>Fe,hX:()=>ce,VU:()=>$,pn:()=>Re,hs:()=>le,cm:()=>Ie,_r:()=>ze,vq:()=>De,$W:()=>Me,Di:()=>Ee,x$:()=>Se,FT:()=>Le,Y6:()=>Ge,Lv:()=>Te,vp:()=>oe,ln:()=>Oe,xr:()=>ee});var n=r(6001),a=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=new a.Box3,u=new a.Vector3,d=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(n);function n(){var e;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(e=r.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new a.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 a.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=n,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new a.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new a.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new a.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 a.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new a.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new a.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 a.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new a.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),c.setFromBufferAttribute(t),this.boundingBox.union(c))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new a.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var r=this.boundingSphere.center,n=(this.boundingBox.getCenter(r),0),i=0,s=e.count;i<s;i++)u.fromBufferAttribute(e,i),n=Math.max(n,r.distanceToSquared(u)),u.fromBufferAttribute(t,i),n=Math.max(n,r.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.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 p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(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)}a.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new a.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},a.ShaderLib.line={uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.fog,a.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 g=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(r=t?(r=f(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===h(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return m(n)}}(n);function n(e){var t;if(this instanceof n)return(t=r.call(this,{type:"LineMaterial",uniforms:a.UniformsUtils.clone(a.ShaderLib.line.uniforms),vertexShader:a.ShaderLib.line.vertexShader,fragmentShader:a.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(m(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=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(a.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 b(e,t){return(b=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)}var x,w,S=new a.Vector3,M=new a.Vector3,T=new a.Vector4,_=new a.Vector4,E=new a.Vector4,D=new a.Vector3,O=new a.Matrix4,k=new a.Line3,P=new a.Vector3,A=new a.Box3,C=new a.Sphere,L=new a.Vector4;function R(e,t,r){return L.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),L.multiplyScalar(1/L.w),L.x=w/r.width,L.y=w/r.height,L.applyMatrix4(e.projectionMatrixInverse),L.multiplyScalar(1/L.w),Math.abs(Math.max(L.x,L.y))}var I=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=y(e);if(r=t?(r=y(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new d,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new g({color:16777215*Math.random()}),a=this,i=n;if(a instanceof i)return(a=r.call(this,e,t)).isLineSegments2=!0,a.type="LineSegments2",a;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,n=new Float32Array(2*t.count),i=0,s=0,o=t.count;i<o;i++,s+=2)S.fromBufferAttribute(t,i),M.fromBufferAttribute(r,i),n[s]=0===s?0:n[s-1],n[s+1]=n[s]+S.distanceTo(M);var l=new a.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new a.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new a.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var r=this.material.worldUnits,n=e.camera,i=(null!==n||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),s=(x=e.ray,e=this.matrixWorld,this.geometry),o=this.material;if(w=o.linewidth+i,null===s.boundingSphere&&s.computeBoundingSphere(),C.copy(s.boundingSphere).applyMatrix4(e),i=r?.5*w:R(n,Math.max(n.near,C.distanceToPoint(x.origin)),o.resolution),C.radius+=i,!1!==x.intersectsSphere(C)&&(null===s.boundingBox&&s.computeBoundingBox(),A.copy(s.boundingBox).applyMatrix4(e),i=r?.5*w:R(n,Math.max(n.near,A.distanceToPoint(x.origin)),o.resolution),A.expandByScalar(i),!1!==x.intersectsBox(A)))if(r)for(var l=this,c=t,u=l.matrixWorld,d=(s=l.geometry).attributes.instanceStart,h=s.attributes.instanceEnd,p=0,m=Math.min(s.instanceCount,d.count);p<m;p++){k.start.fromBufferAttribute(d,p),k.end.fromBufferAttribute(h,p),k.applyMatrix4(u);var f=new a.Vector3,g=new a.Vector3;x.distanceSqToSegment(k.start,k.end,g,f),g.distanceTo(f)<.5*w&&c.push({point:g,pointOnLine:f,distance:x.origin.distanceTo(g),object:l,face:null,faceIndex:p,uv:null,uv1:null})}else{var v=this,b=t,y=(e=n).projectionMatrix,S=v.material.resolution,M=v.matrixWorld,L=(o=v.geometry).attributes.instanceStart,I=o.attributes.instanceEnd,B=(o=Math.min(o.instanceCount,L.count),-e.near);x.at(1,E),E.w=1,E.applyMatrix4(e.matrixWorldInverse),E.applyMatrix4(y),E.multiplyScalar(1/E.w),E.x*=S.x/2,E.y*=S.y/2,E.z=0,D.copy(E),O.multiplyMatrices(e.matrixWorldInverse,M);for(var j,U,N,z,F=0,V=o;F<V;F++)T.fromBufferAttribute(L,F),_.fromBufferAttribute(I,F),T.w=1,_.w=1,T.applyMatrix4(O),_.applyMatrix4(O),T.z>B&&_.z>B||(T.z>B?(j=T.z-_.z,j=(T.z-B)/j,T.lerp(_,j)):_.z>B&&(j=_.z-T.z,U=(_.z-B)/j,_.lerp(T,U)),T.applyMatrix4(y),_.applyMatrix4(y),T.multiplyScalar(1/T.w),_.multiplyScalar(1/_.w),T.x*=S.x/2,T.y*=S.y/2,_.x*=S.x/2,_.y*=S.y/2,k.start.copy(T),k.start.z=0,k.end.copy(_),k.end.z=0,U=k.closestPointToPointParameter(D,!0),k.at(U,P),N=-1<=(N=a.MathUtils.lerp(T.z,_.z,U))&&N<=1,z=D.distanceTo(P)<.5*w,N&&z&&(k.start.fromBufferAttribute(L,F),k.end.fromBufferAttribute(I,F),k.start.applyMatrix4(M),k.end.applyMatrix4(M),N=new a.Vector3,z=new a.Vector3,x.distanceSqToSegment(k.start,k.end,z,N),b.push({point:z,pointOnLine:N,distance:x.origin.distanceTo(z),object:v,face:null,faceIndex:F,uv:null,uv1:null})))}}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.Mesh);function B(e){return(B="function"==typeof Symbol&&"symbol"==typeof 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 j(){return(j="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=N(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function U(e,t){return(U=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)}var z=function(){var e=n,t=d;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=N(e);if(r=t?(r=N(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===B(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(this instanceof n)return(e=r.call(this)).isLineGeometry=!0,e.type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return j(N(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return j(N(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function 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 V(e,t){return(V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e){return(G=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var H=function(){var e=n,t=I;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&&V(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=G(e);if(r=t?(r=G(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===F(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new z,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new g({color:16777215*Math.random()}),a=this,i=n;if(a instanceof i)return(a=r.call(this,e,t)).isLine2=!0,a.type="Line2",a;throw new TypeError("Cannot call a class as a function")}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),Z=r(699),W=r(3693),K=r(3263),q=(t=r(6292),r(135)),X=r(6272);const Y={uniforms:{uSeaFreq:{value:.16},uSeaHeight:{value:.6},uSeaChoppy:{value:4},uTime:{value:0},uCamPosition:{value:new a.Vector3(0,0,0)},uDirection:{value:null}},vertexShader:"\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n void main() {\n vec4 pos = vec4(position, 1.0);\n //模型空间坐标,z轴是高度,xy轴是平面\n vUv = pos.xy * 1.0;\n pos.z += getWave(vUv) * 1.0;\n vPosition = vec3(pos.x, pos.z, pos.y);\n vWorldPos = (modelMatrix * pos).xyz;\n \n gl_Position = projectionMatrix * modelViewMatrix * pos;\n }\n ",fragmentShader:"\n #define PI 3.14159265359\n #define invPI 0.3183098861837697\n #define invTWO_PI 0.15915494309\n \n const vec3 SEA_BASE = vec3(0.1, 0.19, 0.22);\n const vec3 SEA_WATER_COLOR = vec3(0.8, 0.9, 0.6);\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n uniform vec3 uCamPosition;\n uniform vec3 uDirection;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n // Math\n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n // Lighting\n float diffuse(vec3 n, vec3 l, float p) {\n return pow(dot(n, l) * 0.4 + 0.6, p);\n }\n float specular(vec3 n,vec3 l,vec3 e,float s) {\n float nrm = (s + 8.0) / (PI * 8.0);\n return pow(max(dot(reflect(e, n), l), 0.0), s) * nrm;\n }\n \n // Sky\n vec3 getSkyColor(vec3 e) {\n e.y = (max(e.y, 0.0) * 0.8 + 0.2) * 0.8;\n return vec3(pow(1.0 - e.y, 2.0), 1.0 - e.y, 0.6 + (1.0 - e.y) * 0.45) * 0.45;\n }\n \n // Sea\n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float map_detailed(vec3 p) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n vec2 uv = p.xz;\n uv.x *= 0.75;\n \n float d, h = 0.0;\n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n return p.y - h;\n }\n vec3 getSeaColor(vec3 p, vec3 n, vec3 l, vec3 eye, vec3 dist) {\n float fresnel = clamp(1.0 - dot(n, -eye), 0.0, 1.0);\n fresnel = pow(fresnel, 3.0) * 0.5;\n \n vec3 reflected = getSkyColor(reflect(eye, n));\n vec3 refracted = SEA_BASE + diffuse(n, l, 80.0) * SEA_WATER_COLOR * 0.12;\n \n vec3 color = mix(refracted, reflected, fresnel);\n \n float attenuation = max(1.0 - dot(dist, dist) * 0.001, 0.0);\n color += SEA_WATER_COLOR * (p.y - uSeaHeight) * 0.18 * attenuation;\n color += vec3(specular(n, l, eye, 60.0));\n \n return color;\n }\n \n // Sea Wave\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n // Tracing\n vec3 getNormal(vec3 p, float eps) {\n vec3 n;\n n.y = map_detailed(p);\n n.x = map_detailed(vec3(p.x + eps, p.y, p.z)) - n.y;\n n.z = map_detailed(vec3(p.x, p.y, p.z + eps)) - n.y;\n n.y = eps;\n return normalize(n);\n }\n \n void main() {\n vec3 light = normalize(vec3(0.0, 1.0, 0.8));\n vec3 dist = vWorldPos - uCamPosition;\n vec3 dir = normalize(dist);\n \n // 此数值控制生成水面法线的范围, 数值与范围成反比\n float EPSILON_NRM = 0.00003;\n vec3 N = getNormal(vWorldPos, dot(dist, dist) * EPSILON_NRM);\n vec3 color = getSeaColor(vWorldPos, N, light, dir, dist);\n \n // gl_FragColor = vec4(vPosition, 1.0);\n // gl_FragColor = vec4(vWorldPos, 1.0);\n // gl_FragColor = vec4(normalize(N), 1.0);\n gl_FragColor = vec4(pow(color, vec3(0.75)), 1.0);\n }\n "};var Q=r(2233);const J=t.Z,$=(e,t)=>(t.updateMatrixWorld(!0),t=new J.Vector3,e.getWorldPosition(t),t),ee={parse(e){var{x:e,y:t,z:r}=e;return void 0===r?new a.Vector2(e,t):new a.Vector3(e,t,r)},toJSON(e){var{x:e,y:t,z:r}=e;return null==r?{x:e,y:t}:{x:e,y:t,z:r}}},te=(e,t)=>e.distanceTo(t),re=e=>new W.cp(e),ne=e=>new Z.j(e),ae=e=>new W.P7(e),ie=(e,t=.5,r=!1)=>{if("Group"===e.type)throw TypeError("该模型为Group类型");if(!e.material)throw TypeError("该模型没有材质");if(void 0===e.material.oldOpc&&(e.material.oldOpc=e.material.opacity,e.material.oldTransparent=e.material.transparent),r)return e.material.opacity=e.material.oldOpc,void(e.material.transparent=e.material.oldTransparent);1===t?(e.material.transparent=!1,e.material.opacity=1):(e.material.transparent=!0,e.material.opacity=t)},se=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>se(e,t,r))):ie(e,t,r)},oe=e=>(e.mapping=a.EquirectangularReflectionMapping,e),le=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},ce=(e,t)=>{let r=document.createElement("video");return r.style="position:absolute;top:0;left:0;z-index:1000000;",r.src=e,r.loop="loop",r.muted="muted",r.play(),t.appendChild(r),new a.VideoTexture(r)},ue=(e,t)=>{let r=new a.CatmullRomCurve3(e,(null==t?void 0:t.closed)||!1),n=new a.BufferGeometry;e=r.getSpacedPoints(100),n.setFromPoints(e),e=new a.LineBasicMaterial({color:26214});let i=new a.Line(n,e);return i.visible=(null==t?void 0:t.showLine)||!1,{line:i,curve:r}},de=e=>{let t=0;const r=[],n={},i={0:"x",1:"y",2:"z"};return e.map((e=>{var s,o,l;3===t&&(t=0,({x:s,y:o,z:l}=n),r.push(new a.Vector3(s,o,l))),n[i[t]]=e,t++})),r},he=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:n}=e;const i=new z,s=(i.setPositions(e),t||new g({transparent:!0,side:a.DoubleSide,linewidth:r||5,vertexColors:!0})),o=(i.setColors(n||[1,1,1]),s.resolution.set(window.innerWidth,window.innerHeight),new H(i,s));return o.name="gw",o.computeLineDistances(),o},pe=e=>3.1415926*e/180,me=(e,t="name",r)=>{const n={};return e.traverse((e=>{"id"===t?n[e.userData.id]=e:n[e[t]]=e,null!=r&&r(e)})),n},fe=(e,t,r,n,a,i)=>({cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}),ge=(e,t)=>{var{x:e,y:r,z:n}=e,{x:t,y:a,z:i}=t;return{x:e-t,y:r-a,z:n-i}},ve=()=>new J.Clock,be=e=>{var{r:e,g:t,b:r}=(0,X.fh)((0,X.I8)(e.includes("#")?e:"#"+e));return new J.Color(e,t,r)},ye=e=>new J.Color(e.includes("#")?e:"#"+e),xe=e=>"#"+e.getHexString(),we=e=>e.r?e:(0,X.fh)((0,X.I8)(e.includes("#")?e:"#"+e)),Se=(e,t)=>e.x===t.x&&e.y===t.y&&e.z===t.z,Me=e=>{const{r:t,g:r,b:n}=e;return"rgb("+[t,r,n].map((e=>1<e?e:255*e)).join(",")+")"},Te=e=>{var{r:e,g:t,b:r}=e;return{r:e,g:t,b:r}},_e=e=>{let t=e;return(0,q.isColor)(e)?t=Te(e):K.YD.is(e)||(t=(0,X.I8)(e,!0)),t},Ee=e=>-1===e.toLocaleLowerCase().indexOf("rgba")?e:e.replace(/[a]/,"").split(",").slice(0,-1)+")",De=e=>{if(-1!==(e=e.toLocaleLowerCase()).indexOf("#"))return e;if(e=Ee(e),/^(rgb|RGB)/.test(e)){for(var t="#",r=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),n=0;n<r.length;n++){var a=Number(r[n]).toString(16);"0"===a&&(a+=a),t+=a}return t}return String(e)},Oe=e=>{var{x:e,y:t,z:r}=e;return{x:e,y:t,z:r}},ke=e=>(new a.Box3).expandByObject(e).getCenter(e),Pe={water(e){var t=new J.PlaneBufferGeometry(256,256,127,127);const r=new a.ShaderMaterial({name:"WaterMaterial",uniforms:Y.uniforms,vertexShader:Y.vertexShader,fragmentShader:Y.fragmentShader}),n=new a.Mesh(t,r),i=(n.rotateX(-.5*Math.PI),new a.Clock);return setInterval((()=>{r.uniforms.uTime.value+=i.getDelta(),r.uniforms.uCamPosition.value=e.position}),16.6),n}},Ae=(e,t)=>{let r,n;switch(e){case"Group":r=new J.Group;break;case"Box":n=new J.BoxBufferGeometry(1,1,1,1,1,1),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Circle":n=new J.CircleBufferGeometry(1,8,0,2*Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Cylinder":n=new J.CylinderBufferGeometry(1,1,1,8,1,!1,0,2*Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Dodecahedron":n=new J.DodecahedronBufferGeometry(1,0),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Icosahedron":n=new J.IcosahedronBufferGeometry(1,0),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Lathe":var i=[new J.Vector2(0,0),new J.Vector2(.4,0),new J.Vector2(.35,.05),new J.Vector2(.1,.075),new J.Vector2(.08,.1),new J.Vector2(.08,.4),new J.Vector2(.1,.42),new J.Vector2(.14,.48),new J.Vector2(.2,.5),new J.Vector2(.25,.54),new J.Vector2(.3,1.2)];n=new J.LatheBufferGeometry(i,12,0,2*Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial({side:J.DoubleSide}));break;case"Octahedron":n=new J.OctahedronBufferGeometry(1,0),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Plane":n=new J.PlaneBufferGeometry(1,1,1,1),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Ring":n=new J.RingBufferGeometry(.5,1,8,1,0,2*Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Sphere":n=new J.SphereBufferGeometry(1,8,6,0,2*Math.PI,0,Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Sprite":r=new J.Sprite(new J.SpriteMaterial);break;case"Tetrahedron":n=new J.TetrahedronBufferGeometry(1,0),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Torus":n=new J.TorusBufferGeometry(1,.4,8,6,2*Math.PI),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"TorusKnot":n=new J.TorusKnotBufferGeometry(1,.4,64,8,2,3),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"Tube":i=new J.CatmullRomCurve3([new J.Vector3(2,2,-2),new J.Vector3(2,-2,-.6666666666666667),new J.Vector3(-2,-2,.6666666666666667),new J.Vector3(-2,2,2)]),n=new J.TubeBufferGeometry(i,64,1,8,!1),r=new J.Mesh(n,new J.MeshStandardMaterial);break;case"water":r=Pe.water(t?t.camera:{position:new a.Vector3})}if(r)return r.name=e,r},Ce=(()=>{const e=(t,r)=>!!(t=t.parent)&&"Scene"!==t.type&&(t.uuid===r?t:e(t,r));return(t,r)=>{if(t&&r)return e(t,r)}})(),Le=(()=>{const e=(t,r)=>t.parent&&"Scene"!==t.parent.type?(t.parent.visible!==r&&(t.parent.visible=r),e(t.parent,r)):null;return(t,r)=>t?e(t,r):null})(),Re=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&Re(e.parent),Ie=(e,t=!1)=>{var[r,n,i]=e.geometry.attributes.position.array,[s,o,l]=(e.geometry.center(),e.geometry.attributes.position.array),{x:c,y:u,z:d}=e.position,c=new a.Vector3(c-(s-r),u-(o-n),d-(l-i));return t&&e.position.copy(c),c};let Be,je,Ue;const Ne=e=>{void 0===Be&&((Be=new J.WebGLRenderer).outputEncoding=J.sRGBEncoding,je=new J.Scene,Ue=new J.OrthographicCamera(-1,1,1,-1,0,1));var t=e.image,r=new J.PlaneGeometry(2,2);return e=new J.MeshBasicMaterial({map:e}),r=new J.Mesh(r,e),je.add(r),Be.setSize(t.width,t.height,!1),Be.render(je,Ue),Be.domElement},ze=e=>function(e,t,r,n){return new(r=r||Promise)((function(e,t){function a(e){try{s(n.next(e))}catch(e){t(e)}}function i(e){try{s(n.throw(e))}catch(e){t(e)}}function s(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r((function(e){e(n)}))).then(a,i)}s((n=n.apply(undefined,[])).next())}))}(0,0,void 0,(function*(){})),Fe=e=>{var t=typeof e;let r="null";return null===e?"null":void 0===e?"undefined":(e.isColor?r="color":e.isTexture?r="texture":e.isVector2?r="vector2":e.isVector3?r="vector3":Array.isArray(e)?r="array":(0,n.isNumber)(e)?r="number":"string"==t?r="string":"boolean"==t?r="boolean":"object"==t&&(r=null===t?"null":Array.isArray(t)?"array":"object"),r)},Ve=(e,t)=>{var r,n,a,i,s,o,l=Fe(e);return"null"===l||"number"===l||"string"===l||"boolean"===l||"array"===l||"undefined"===l?(0,X.Xq)(e,t):"color"===l?e.getHexString()!==(null==t?void 0:t.getHexString()):"texture"===l?(0,Q.Ki)(e)!==(0,Q.Ki)(t):"vector2"===l||"vector3"===l?(({x:r,y:n,z:a}=e),({x:i,y:s,z:o}=t),r!==i||n!==s||a!==o):"object"===l?(0,X.Xq)(e,t):void 0},Ge=e=>{const{target:t,val:r,type:n}=e;"null"===(e=Fe(r))||"number"===e||"string"===e||"boolean"===e||"undefined"===e||"texture"===e?t[n]=r:"color"===e||"vector2"===e||"vector3"===e?t[n].copy(r):"object"===e?t[n]=Object.assign({},r):"array"===e&&(t[n]=[...r])},He=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r,z:e.z+(t.z-e.z)*r})},1129:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__1129__},3300:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__3300__},6001:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__6001__},8881:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__8881__},8624:(e,t,r)=>{r.d(t,{Ys:()=>M});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(r=t?(r=p(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return h(n)}}function h(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 m=new n.Raycaster,f=new n.Vector3,g=new n.Vector3,v=new n.Quaternion,b={X:new n.Vector3(1,0,0),Y:new n.Vector3(0,1,0),Z:new n.Vector3(0,0,1)},y={type:"change"},x={type:"mouseDown"},w={type:"mouseUp",mode:null},S={type:"objectChange"},M=function(){c(t,n.Object3D);var e=d(t);function t(r,a){i(this,t),s=e.call(this),void 0===a&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),a=document),s.isTransformControls=!0,s.visible=!1,s.domElement=a,s.domElement.style.touchAction="none";var s,o=new N,l=(s._gizmo=o,s.add(o),new z),c=(s._plane=l,s.add(l),h(s));function u(e,t){var r=t;Object.defineProperty(c,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,l[e]=t,o[e]=t,c.dispatchEvent({type:e+"-changed",value:t}),c.dispatchEvent(y))}}),c[e]=t,l[e]=t,o[e]=t}u("camera",r),u("object",void 0),u("enabled",!0),u("axis",null),u("mode","translate"),u("translationSnap",null),u("rotationSnap",null),u("scaleSnap",null),u("space","world"),u("size",1),u("dragging",!1),u("showX",!0),u("showY",!0),u("showZ",!0),a=new n.Vector3,r=new n.Vector3;var d=new n.Quaternion,p=new n.Quaternion,m=new n.Vector3,f=new n.Quaternion,g=new n.Vector3,v=new n.Vector3,b=new n.Vector3,x=new n.Vector3;return u("worldPosition",a),u("worldPositionStart",r),u("worldQuaternion",d),u("worldQuaternionStart",p),u("cameraPosition",m),u("cameraQuaternion",f),u("pointStart",g),u("pointEnd",v),u("rotationAxis",b),u("rotationAngle",0),u("eye",x),s._offset=new n.Vector3,s._startNorm=new n.Vector3,s._endNorm=new n.Vector3,s._cameraScale=new n.Vector3,s._parentPosition=new n.Vector3,s._parentQuaternion=new n.Quaternion,s._parentQuaternionInv=new n.Quaternion,s._parentScale=new n.Vector3,s._worldScaleStart=new n.Vector3,s._worldQuaternionInv=new n.Quaternion,s._worldScale=new n.Vector3,s._positionStart=new n.Vector3,s._quaternionStart=new n.Quaternion,s._scaleStart=new n.Vector3,s._getPointer=function(e){var t;return this.domElement.ownerDocument.pointerLockElement?{x:0,y:0,button:e.button}:(t=this.domElement.getBoundingClientRect(),{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button})}.bind(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 o(t,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),l(p(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(m.setFromCamera(e,this.camera),e=T(this._gizmo.picker[this.mode],m),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&&(m.setFromCamera(e,this.camera),(e=T(this._plane,m,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,x.mode=this.mode,this.dispatchEvent(x))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,a=this.space;"scale"===r?a="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(a="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(m.setFromCamera(e,this.camera),(e=T(this._plane,m,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===a&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===a&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===a&&(n.position.applyQuaternion(v.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===a&&(n.parent&&n.position.add(f.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(f.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),g.set(e,e,e)):(f.copy(this.pointStart),g.copy(this.pointEnd),f.applyQuaternion(this._worldQuaternionInv),g.applyQuaternion(this._worldQuaternionInv),g.divide(f),-1===t.search("X")&&(g.x=1),-1===t.search("Y")&&(g.y=1),-1===t.search("Z")&&(g.z=1)),n.scale.copy(this._scaleStart).multiply(g),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(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(b[t]),f.copy(b[t]),"local"===a&&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"===a&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(y),this.dispatchEvent(S)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(w.mode=this.mode,this.dispatchEvent(w)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(y),this.dispatchEvent(S),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return m}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}}]),t}();function T(e,t,r){for(var n=t.intersectObject(e,!0),a=0;a<n.length;a++)if(n[a].object.visible||r)return n[a];return!1}var _=new n.Euler,E=new n.Vector3(0,1,0),D=new n.Vector3(0,0,0),O=new n.Matrix4,k=new n.Quaternion,P=new n.Quaternion,A=new n.Vector3,C=new n.Matrix4,L=new n.Vector3(1,0,0),R=new n.Vector3(0,1,0),I=new n.Vector3(0,0,1),B=new n.Vector3,j=new n.Vector3,U=new n.Vector3,N=function(){c(t,n.Object3D);var e=d(t);function t(){i(this,t),(r=e.call(this)).isTransformControlsGizmo=!0,r.type="TransformControlsGizmo";var r,a=new n.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=new n.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=a.clone(),l=((((o.opacity=.15,s=s.clone()).opacity=.5,w=a.clone()).color.setHex(16711680),S=a.clone()).color.setHex(65280),a.clone()),c=(l.color.setHex(255),a.clone()),u=(c.color.setHex(16711680),c.opacity=.5,a.clone()),d=(u.color.setHex(65280),u.opacity=.5,a.clone()),h=(d.color.setHex(255),d.opacity=.5,a.clone());(h.opacity=.25,y=a.clone()).color.setHex(16776960),y.opacity=.25,a.clone().color.setHex(16776960);var p=(((a=a.clone()).color.setHex(7895160),g=new n.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new n.BoxGeometry(.08,.08,.08)),m=(p.translate(0,.04,0),new n.BufferGeometry);function f(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}(m.setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,0,0],3)),M=new n.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var g={X:[[new n.Mesh(g,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(g,w),[-.5,0,0],[0,0,Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new n.Mesh(g,S),[0,.5,0]],[new n.Mesh(g,S),[0,-.5,0],[Math.PI,0,0]],[new n.Mesh(M,S)]],Z:[[new n.Mesh(g,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(g,l),[0,0,-.5],[-Math.PI/2,0,0]],[new n.Mesh(M,l),null,[Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.1,0),h.clone()),[0,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),d.clone()),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.2,0),o)]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},b={START:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new n.Line(((b=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,1,1],3)),b),s),null,null,null,"helper"]],X:[[new n.Line(m,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(m,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(m,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},y=(a={XYZE:[[new n.Mesh(f(.5,1),a),null,[0,Math.PI/2,0]]],X:[[new n.Mesh(f(.5,.5),w)]],Y:[[new n.Mesh(f(.5,.5),S),null,[0,0,-Math.PI/2]]],Z:[[new n.Mesh(f(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new n.Mesh(f(.75,1),y),null,[0,Math.PI/2,0]]]},{AXIS:[[new n.Line(m,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new n.Mesh(new n.SphereGeometry(.25,10,8),o)]],X:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new n.Mesh(new n.TorusGeometry(.75,.1,2,24),o)]]},w={X:[[new n.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]],[new n.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(p,S),[0,.5,0]],[new n.Mesh(M,S)],[new n.Mesh(p,S),[0,-.5,0],[0,0,Math.PI]]],Z:[[new n.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(M,l),[0,0,0],[Math.PI/2,0,0]],[new n.Mesh(p,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),d),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.1,.1,.1),h.clone())]]},S={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},M={X:[[new n.Line(m,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(m,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(m,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function T(e){var t,r=new n.Object3D;for(t in e)for(var a=e[t].length;a--;){var i=e[t][a][0].clone(),s=e[t][a][1],o=e[t][a][2],l=e[t][a][3],c=e[t][a][4];(i.name=t,i.tag=c,s&&i.position.set(s[0],s[1],s[2]),o&&i.rotation.set(o[0],o[1],o[2]),l&&i.scale.set(l[0],l[1],l[2]),i.updateMatrix(),c=i.geometry.clone()).applyMatrix4(i.matrix),i.geometry=c,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),r.add(i)}return r}return r.gizmo={},r.picker={},r.helper={},r.add(r.gizmo.translate=T(g)),r.add(r.gizmo.rotate=T(a)),r.add(r.gizmo.scale=T(w)),r.add(r.picker.translate=T(v)),r.add(r.picker.rotate=T(x)),r.add(r.picker.scale=T(S)),r.add(r.helper.translate=T(b)),r.add(r.helper.rotate=T(y)),r.add(r.helper.scale=T(M)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:P,a=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);a=(a=(a=a.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var i=0;i<a.length;i++)!function(e){var t=a[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.visible=!!r.axis,"X"===r.axis&&(v.setFromEuler(_.set(0,0,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(v.setFromEuler(_.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),E.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(O.lookAt(D,E,R)),t.quaternion.multiply(v),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),f.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),f.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(f),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(k.copy(n),E.copy(r.eye).applyQuaternion(v.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(O.lookAt(r.eye,D,R)),"X"===t.name&&(v.setFromAxisAngle(L,Math.atan2(-E.y,E.z)),v.multiplyQuaternions(k,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(R,Math.atan2(E.x,E.z)),v.multiplyQuaternions(k,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(I,Math.atan2(E.y,E.x)),v.multiplyQuaternions(k,v),t.quaternion.copy(v))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(i);l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),z=function(){c(t,n.Mesh);var e=d(t);function t(){var r;return i(this,t),(r=e.call(this,new n.PlaneGeometry(1e5,1e5,2,2),new n.MeshBasicMaterial({visible:!1,wireframe:!0,side:n.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).isTransformControlsPlane=!0,r.type="TransformControlsPlane",r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),B.copy(L).applyQuaternion("local"===r?this.worldQuaternion:P),j.copy(R).applyQuaternion("local"===r?this.worldQuaternion:P),U.copy(I).applyQuaternion("local"===r?this.worldQuaternion:P),E.copy(j),this.mode){case"translate":case"scale":switch(this.axis){case"X":E.copy(this.eye).cross(B),A.copy(B).cross(E);break;case"Y":E.copy(this.eye).cross(j),A.copy(j).cross(E);break;case"Z":E.copy(this.eye).cross(U),A.copy(U).cross(E);break;case"XY":A.copy(U);break;case"YZ":A.copy(B);break;case"XZ":E.copy(U),A.copy(j);break;case"XYZ":case"E":A.set(0,0,0)}break;default:A.set(0,0,0)}0===A.length()?this.quaternion.copy(this.cameraQuaternion):(C.lookAt(f.set(0,0,0),A,E),this.quaternion.setFromRotationMatrix(C)),l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()},6422:(e,t,r)=>{r.d(t,{x:()=>c});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).type=n.HalfFloatType,e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"parse",value:function(e){var t,r,a,i,s,o,l,c,u,d,h=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},p=function(e,t,r){t=t||1024;for(var n=e.pos,a=-1,i=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));(a=o.indexOf("\n"))<0&&i<t&&n<e.byteLength;)s+=o,i+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));return-1<a&&(!1!==r&&(e.pos+=i+a+1),s+o.slice(0,a))},m=((e=new Uint8Array(e)).pos=0,function(e){var t,r,n=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,i=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(t=p(e)))return h(1,"no header found");if(!(r=t.match(/^#\?(\S+)/)))return h(3,"bad initial token");for(o.valid|=1,o.programtype=r[1],o.string+=t+"\n";!1!==(t=p(e));)if(o.string+=t+"\n","#"===t.charAt(0))o.comments+=t+"\n";else if((r=t.match(n))&&(o.gamma=parseFloat(r[1])),(r=t.match(a))&&(o.exposure=parseFloat(r[1])),(r=t.match(i))&&(o.valid|=2,o.format=r[1]),(r=t.match(s))&&(o.valid|=4,o.height=parseInt(r[1],10),o.width=parseInt(r[2],10)),2&o.valid&&4&o.valid)break;return 2&o.valid?4&o.valid?o:h(3,"missing image size specifier"):h(3,"missing format specifier")}(e));if(-1!==m){var f,g,v=m.width,b=m.height,y=function(e,t,r){var n=t;if(n<8||32767<n||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return h(3,"wrong scanline width");var a=new Uint8Array(4*t*r);if(!a.length)return h(4,"unable to allocate buffer space");for(var i=0,s=0,o=4*n,l=new Uint8Array(4),c=new Uint8Array(o),u=r;0<u&&s<e.byteLength;){if(s+4>e.byteLength)return h(1);if(l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=n)return h(3,"bad rgbe scanline format");for(var d=0,p=void 0;d<o&&s<e.byteLength;){var m=128<(p=e[s++]);if(m&&(p-=128),0===p||o<d+p)return h(3,"bad scanline data");if(m)for(var f=e[s++],g=0;g<p;g++)c[d++]=f;else c.set(e.subarray(s,s+p),d),d+=p,s+=p}for(var v=n,b=0;b<v;b++){var y=0;a[i]=c[b+0],y+=n,a[i+1]=c[b+y],y+=n,a[i+2]=c[b+y],y+=n,a[i+3]=c[b+y],i+=4}u--}return a}(e.subarray(e.pos),v,b);if(-1!==y){switch(this.type){case n.FloatType:for(var x=y.length/4,w=new Float32Array(4*x),S=0;S<x;S++)c=w,u=l=4*S,d=void 0,d=(o=y)[l+3],d=Math.pow(2,d-128)/255,c[u+0]=o[l+0]*d,c[u+1]=o[l+1]*d,c[u+2]=o[l+2]*d,c[u+3]=1;f=w,g=n.FloatType;break;case n.HalfFloatType:x=y.length/4;for(var M=new Uint16Array(4*x),T=0;T<x;T++)a=M,i=r=4*T,s=void 0,s=(t=y)[r+3],s=Math.pow(2,s-128)/255,a[i+0]=n.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[i+1]=n.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[i+2]=n.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504)),a[i+3]=n.DataUtils.toHalfFloat(1);f=M,g=n.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:v,height:b,data:f,header:m.string,gamma:m.gamma,exposure:m.exposure,type:g}}}return null}},{key:"setDataType",value:function(e){return this.type=e,this}},{key:"load",value:function(e,t,r,s){return i(l(a.prototype),"load",this).call(this,e,(function(e,r){switch(e.type){case n.FloatType:case n.HalfFloatType:e.colorSpace=n.LinearSRGBColorSpace,e.minFilter=n.LinearFilter,e.magFilter=n.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.DataTextureLoader)},4819:(e,t,r)=>{r.d(t,{T:()=>u,w:()=>o});var n=r(8881);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var o=function(){function e(){a(this,e),this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return s(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}},{key:"dispose",value:function(){}}]),e}(),l=new n.OrthographicCamera(-1,1,1,-1,0,1),c=new n.BufferGeometry,u=(c.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){a(this,e),this._mesh=new n.Mesh(c,t)}return s(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,l)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}())},5180:(e,t,r)=>{r.d(t,{T:()=>c});var n=r(8881),a=r(4819);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(i);function i(e,t){var s;if(this instanceof i)return(s=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof n.ShaderMaterial?(s.uniforms=e.uniforms,s.material=e):e&&(s.uniforms=n.UniformsUtils.clone(e.uniforms),s.material=new n.ShaderMaterial({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:s.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),s.fsQuad=new a.T(s.material),s;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}},{key:"dispose",value:function(){this.material.dispose(),this.fsQuad.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(a.w)},699:(e,t,r)=>{r.d(t,{M:()=>v,j:()=>d});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(e,t){return(c=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)}var d=function(e){var t=s;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&&c(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(s);function s(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return i(this,s),(e=r.call(this)).isCSS2DObject=!0,e.element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.center=new n.Vector2(.5,.5),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return o(s,[{key:"copy",value:function(e,t){return l(u(s.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}]),s}(n.Object3D),h=new n.Vector3,p=new n.Matrix4,m=new n.Matrix4,f=new n.Vector3,g=new n.Vector3,v=o((function e(){var t,r,n,a,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(i(this,e),this),l={objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div");function u(e,t){return f.setFromMatrixPosition(e.matrixWorld),g.setFromMatrixPosition(t.matrixWorld),f.distanceToSquared(g)}c.style.overflow="hidden",this.domElement=c,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),p.copy(t.matrixWorldInverse),m.multiplyMatrices(t.projectionMatrix,p),function e(t,r,i){var s;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(m),s=!0===t.visible&&-1<=h.z&&h.z<=1&&!0===t.layers.test(i.layers),t.element.style.display=1==s?"":"none",1==s&&(t.onBeforeRender(o,r,i),(s=t.element).style.transform="translate("+-100*t.center.x+"%,"+-100*t.center.y+"%)translate("+(h.x*n+n)+"px,"+(-h.y*a+a)+"px)",s.parentNode!==c&&c.appendChild(s),t.onAfterRender(o,r,i)),s={distanceToCameraSquared:u(i,t)},l.objects.set(t,s));for(var d=0,p=t.children.length;d<p;d++)e(t.children[d],r,i)}(e,e,t);for(var r=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),i=r.length,s=0,d=r.length;s<d;s++)r[s].element.style.zIndex=i-s},this.setSize=function(e,i){n=(t=e)/2,a=(r=i)/2,c.style.width=e+"px",c.style.height=i+"px"}}))},3693:(e,t,r)=>{r.d(t,{P7:()=>v,cp:()=>g,lX:()=>x});var n=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=h(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=h(e);if(r=t?(r=h(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new n.Vector3,m=new n.Quaternion,f=new n.Vector3,g=function(){c(t,n.Object3D);var e=d(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return i(this,t),(r=e.call(this)).isCSS3DObject=!0,r.element=n,r.element.style.position="absolute",r.element.style.pointerEvents="auto",r.element.style.userSelect="none",r.element.setAttribute("draggable",!1),r.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),r}return o(t,[{key:"copy",value:function(e,r){return l(h(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),v=function(){c(t,g);var e=d(t);function t(r){return i(this,t),(r=e.call(this,r)).isCSS3DSprite=!0,r.rotation2D=0,r}return o(t,[{key:"copy",value:function(e,r){return l(h(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}(),b=new n.Matrix4,y=new n.Matrix4,x=o((function e(){var t,r,n,a,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(i(this,e),this),l={camera:{fov:0,style:""},objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div"),u=(c.style.overflow="hidden",this.domElement=c,document.createElement("div")),d=(u.style.transformOrigin="0 0",u.style.pointerEvents="none",c.appendChild(u),document.createElement("div"));function h(e){return Math.abs(e)<1e-10?0:e}function g(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])+")"}d.style.transformStyle="preserve-3d",u.appendChild(d),this.getSize=function(){return{width:t,height:r}},this.render=function(e,i){var s=i.projectionMatrix.elements[5]*a,c=(l.camera.fov!==s&&(u.style.perspective=i.isPerspectiveCamera?s+"px":"",l.camera.fov=s),i.view&&i.view.enabled?(u.style.transform="translate( ".concat(-i.view.offsetX*(t/i.view.width),"px, ").concat(-i.view.offsetY*(r/i.view.height),"px )"),u.style.transform+="scale( ".concat(i.view.fullWidth/i.view.width,", ").concat(i.view.fullHeight/i.view.height," )")):u.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===i.parent&&!0===i.matrixWorldAutoUpdate&&i.updateMatrixWorld(),i.isOrthographicCamera&&(x=-(i.right+i.left)/2,w=(i.top+i.bottom)/2),i.view&&i.view.enabled?i.view.height/i.view.fullHeight:1),x=i.isOrthographicCamera?"scale( ".concat(c," )")+"scale("+s+")translate("+h(x)+"px,"+h(w)+"px)"+g(i.matrixWorldInverse):"scale( ".concat(c," )")+"translateZ("+s+"px)"+g(i.matrixWorldInverse),w=x+"translate("+n+"px,"+a+"px)";l.camera.style!==w&&(d.style.transform=w,l.camera.style=w),function e(t,r,n,a){var i,s,c;t.isCSS3DObject&&(i=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==i?"":"none",1==i&&(t.onBeforeRender(o,r,n),i=t.isCSS3DSprite?(b.copy(n.matrixWorldInverse),b.transpose(),0!==t.rotation2D&&b.multiply(y.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(p,m,f),b.setPosition(p),b.scale(f),b.elements[3]=0,b.elements[7]=0,b.elements[11]=0,b.elements[15]=1,v(b)):v(t.matrixWorld),s=t.element,void 0!==(c=l.objects.get(t))&&c.style===i||(c={style:s.style.transform=i},l.objects.set(t,c)),s.parentNode!==d&&d.appendChild(s),t.onAfterRender(o,r,n)));for(var u=0,h=t.children.length;u<h;u++)e(t.children[u],r,n,a)}(e,e,i,x)},this.setSize=function(e,i){n=(t=e)/2,a=(r=i)/2,c.style.width=e+"px",c.style.height=i+"px",u.style.width=e+"px",u.style.height=i+"px",d.style.width=e+"px",d.style.height=i+"px"}}))},6608:(e,t,r)=>{r.d(t,{C:()=>n});var n={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"}},4091:(e,t,r)=>{r.d(t,{Vs:()=>function(e,t){if(t===n.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==n.TriangleFanDrawMode&&t!==n.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;var r=e.getIndex();if(null===r){var a=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<i.count;s++)a.push(s);e.setIndex(a),r=e.getIndex()}var o=r.count-2,l=[];if(t===n.TriangleFanDrawMode)for(var c=1;c<=o;c++)l.push(r.getX(0)),l.push(r.getX(c)),l.push(r.getX(c+1));else for(var u=0;u<o;u++)u%2==0?(l.push(r.getX(u)),l.push(r.getX(u+1)),l.push(r.getX(u+2))):(l.push(r.getX(u+2)),l.push(r.getX(u+1)),l.push(r.getX(u)));return l.length/3!=o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t.clearGroups(),t},qf:()=>function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return console.warn("THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries()."),function(e){for(var t,r,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],s=null!==e[0].index,o=new Set(Object.keys(e[0].attributes)),l=new Set(Object.keys(e[0].morphAttributes)),c={},u={},d=e[0].morphTargetsRelative,h=new n.BufferGeometry,p=0,m=0;m<e.length;++m){var f,g,v=e[m],b=0;if(s!=(null!==v.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() 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(f in v.attributes){if(!o.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;void 0===c[f]&&(c[f]=[]),c[f].push(v.attributes[f]),b++}if(b!==o.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". Make sure all geometries have the same number of attributes."),null;if(d!==v.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(g in v.morphAttributes){if(!l.has(g))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". .morphAttributes must be consistent throughout all geometries."),null;void 0===u[g]&&(u[g]=[]),u[g].push(v.morphAttributes[g])}if(i){var y=void 0;if(s)y=v.index.count;else{if(void 0===v.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+m+". The geometry must have either an index or a position attribute"),null;y=v.attributes.position.count}h.addGroup(p,y,m),p+=y}}if(s){for(var x=0,w=[],S=0;S<e.length;++S){for(var M=e[S].index,T=0;T<M.count;++T)w.push(M.getX(T)+x);x+=e[S].attributes.position.count}h.setIndex(w)}for(t in c){var _=a(c[t]);if(!_)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" attribute."),null;h.setAttribute(t,_)}for(r in u){var E=u[r][0].length;if(0===E)break;h.morphAttributes=h.morphAttributes||{},h.morphAttributes[r]=[];for(var D=0;D<E;++D){for(var O=[],k=0;k<u[r].length;++k)O.push(u[r][k][D]);var P=a(O);if(!P)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+r+" morphAttribute."),null;h.morphAttributes[r].push(P)}}return h}(e,t)}});var n=r(8881);function a(e){for(var t,r,a,i=-1,s=0,o=0;o<e.length;++o){var l=e[o];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. InterleavedBufferAttributes are not supported."),null;if((t=void 0===t?l.array.constructor:t)!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if((r=void 0===r?l.itemSize:r)!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((a=void 0===a?l.normalized:a)!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if((i=-1===i?l.gpuType:i)!==l.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=l.array.length}for(var c=new t(s),u=0,d=0;d<e.length;++d)c.set(e[d].array,u),u+=e[d].array.length;var h=new n.BufferAttribute(c,r,a);return void 0!==i&&(h.gpuType=i),h}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];return void 0!==t||(t=__webpack_module_cache__[e]={exports:{}},__webpack_modules__[e](t,t.exports,__webpack_require__)),t.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{__webpack_require__.d(__webpack_exports__,{default:()=>r});var e=__webpack_require__(8624),t=__webpack_require__(1715);const r={RunScene:t.ZP,Utils:t.cQ,ModelEx:t.ch,MaterialEx:t.al,TextureEx:t.Az,Three:t.Sf,ThreeEx:{TransformControls:e.Ys},Bus:t.Gc}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
|