@galacean/effects-threejs 0.0.1-alpha.0

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.
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Name: @galacean/effects-threejs
3
+ * Description: Galacean Effects runtime threejs plugin for the web
4
+ * Author: Ant Group CO., Ltd.
5
+ * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
+ * Version: v0.0.1-alpha.0
7
+ */
8
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.three={}),e.THREE)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=r(t),n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o=function(e){return e&&e.Math===Math&&e},a=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof n&&n)||function(){return this}()||n||Function("return this")(),s={},u=function(e){try{return!!e()}catch(e){return!0}},c=!u((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),l=!u((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),f=l,h=Function.prototype.call,p=f?h.bind(h):function(){return h.apply(h,arguments)},d={},m={}.propertyIsEnumerable,v=Object.getOwnPropertyDescriptor,y=v&&!m.call({1:2},1);d.f=y?function(e){var t=v(this,e);return!!t&&t.enumerable}:m;var g,x,T=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},E=l,_=Function.prototype,S=_.call,A=E&&_.bind.bind(S,S),R=E?A:function(e){return function(){return S.apply(e,arguments)}},C=R,b=C({}.toString),O=C("".slice),L=function(e){return O(b(e),8,-1)},I=u,w=L,P=Object,M=R("".split),V=I((function(){return!P("z").propertyIsEnumerable(0)}))?function(e){return"String"===w(e)?M(e,""):P(e)}:P,N=function(e){return null==e},F=N,D=TypeError,U=function(e){if(F(e))throw D("Can't call method on "+e);return e},B=V,k=U,z=function(e){return B(k(e))},G="object"==typeof document&&document.all,j={all:G,IS_HTMLDDA:void 0===G&&void 0!==G},X=j.all,W=j.IS_HTMLDDA?function(e){return"function"==typeof e||e===X}:function(e){return"function"==typeof e},H=W,Y=j.all,Z=j.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:H(e)||e===Y}:function(e){return"object"==typeof e?null!==e:H(e)},q=a,K=W,Q=function(e,t){return arguments.length<2?(r=q[e],K(r)?r:void 0):q[e]&&q[e][t];var r},J=R({}.isPrototypeOf),$="undefined"!=typeof navigator&&String(navigator.userAgent)||"",ee=a,te=$,re=ee.process,ie=ee.Deno,ne=re&&re.versions||ie&&ie.version,oe=ne&&ne.v8;oe&&(x=(g=oe.split("."))[0]>0&&g[0]<4?1:+(g[0]+g[1])),!x&&te&&(!(g=te.match(/Edge\/(\d+)/))||g[1]>=74)&&(g=te.match(/Chrome\/(\d+)/))&&(x=+g[1]);var ae=x,se=ae,ue=u,ce=a.String,le=!!Object.getOwnPropertySymbols&&!ue((function(){var e=Symbol("symbol detection");return!ce(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&se&&se<41})),fe=le&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,he=Q,pe=W,de=J,me=Object,ve=fe?function(e){return"symbol"==typeof e}:function(e){var t=he("Symbol");return pe(t)&&de(t.prototype,me(e))},ye=String,ge=function(e){try{return ye(e)}catch(e){return"Object"}},xe=W,Te=ge,Ee=TypeError,_e=function(e){if(xe(e))return e;throw Ee(Te(e)+" is not a function")},Se=_e,Ae=N,Re=function(e,t){var r=e[t];return Ae(r)?void 0:Se(r)},Ce=p,be=W,Oe=Z,Le=TypeError,Ie={exports:{}},we=a,Pe=Object.defineProperty,Me=function(e,t){try{Pe(we,e,{value:t,configurable:!0,writable:!0})}catch(r){we[e]=t}return t},Ve=Me,Ne="__core-js_shared__",Fe=a[Ne]||Ve(Ne,{}),De=Fe;(Ie.exports=function(e,t){return De[e]||(De[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.32.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Ue=U,Be=Object,ke=function(e){return Be(Ue(e))},ze=ke,Ge=R({}.hasOwnProperty),je=Object.hasOwn||function(e,t){return Ge(ze(e),t)},Xe=R,We=0,He=Math.random(),Ye=Xe(1..toString),Ze=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ye(++We+He,36)},qe=a,Ke=Ie.exports,Qe=je,Je=Ze,$e=le,et=fe,tt=qe.Symbol,rt=Ke("wks"),it=et?tt.for||tt:tt&&tt.withoutSetter||Je,nt=function(e){return Qe(rt,e)||(rt[e]=$e&&Qe(tt,e)?tt[e]:it("Symbol."+e)),rt[e]},ot=p,at=Z,st=ve,ut=Re,ct=function(e,t){var r,i;if("string"===t&&be(r=e.toString)&&!Oe(i=Ce(r,e)))return i;if(be(r=e.valueOf)&&!Oe(i=Ce(r,e)))return i;if("string"!==t&&be(r=e.toString)&&!Oe(i=Ce(r,e)))return i;throw Le("Can't convert object to primitive value")},lt=TypeError,ft=nt("toPrimitive"),ht=function(e,t){if(!at(e)||st(e))return e;var r,i=ut(e,ft);if(i){if(void 0===t&&(t="default"),r=ot(i,e,t),!at(r)||st(r))return r;throw lt("Can't convert object to primitive value")}return void 0===t&&(t="number"),ct(e,t)},pt=ht,dt=ve,mt=function(e){var t=pt(e,"string");return dt(t)?t:t+""},vt=Z,yt=a.document,gt=vt(yt)&&vt(yt.createElement),xt=function(e){return gt?yt.createElement(e):{}},Tt=xt,Et=!c&&!u((function(){return 7!==Object.defineProperty(Tt("div"),"a",{get:function(){return 7}}).a})),_t=c,St=p,At=d,Rt=T,Ct=z,bt=mt,Ot=je,Lt=Et,It=Object.getOwnPropertyDescriptor;s.f=_t?It:function(e,t){if(e=Ct(e),t=bt(t),Lt)try{return It(e,t)}catch(e){}if(Ot(e,t))return Rt(!St(At.f,e,t),e[t])};var wt={},Pt=c&&u((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Mt=Z,Vt=String,Nt=TypeError,Ft=function(e){if(Mt(e))return e;throw Nt(Vt(e)+" is not an object")},Dt=c,Ut=Et,Bt=Pt,kt=Ft,zt=mt,Gt=TypeError,jt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,Wt="enumerable",Ht="configurable",Yt="writable";wt.f=Dt?Bt?function(e,t,r){if(kt(e),t=zt(t),kt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Yt in r&&!r[Yt]){var i=Xt(e,t);i&&i[Yt]&&(e[t]=r.value,r={configurable:Ht in r?r[Ht]:i[Ht],enumerable:Wt in r?r[Wt]:i[Wt],writable:!1})}return jt(e,t,r)}:jt:function(e,t,r){if(kt(e),t=zt(t),kt(r),Ut)try{return jt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Gt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Zt=wt,qt=T,Kt=c?function(e,t,r){return Zt.f(e,t,qt(1,r))}:function(e,t,r){return e[t]=r,e},Qt={exports:{}},Jt=c,$t=je,er=Function.prototype,tr=Jt&&Object.getOwnPropertyDescriptor,rr=$t(er,"name"),ir={EXISTS:rr,PROPER:rr&&"something"===function(){}.name,CONFIGURABLE:rr&&(!Jt||Jt&&tr(er,"name").configurable)},nr=W,or=Fe,ar=R(Function.toString);nr(or.inspectSource)||(or.inspectSource=function(e){return ar(e)});var sr,ur,cr,lr=or.inspectSource,fr=W,hr=a.WeakMap,pr=fr(hr)&&/native code/.test(String(hr)),dr=Ie.exports,mr=Ze,vr=dr("keys"),yr=function(e){return vr[e]||(vr[e]=mr(e))},gr={},xr=pr,Tr=a,Er=Z,_r=Kt,Sr=je,Ar=Fe,Rr=yr,Cr=gr,br="Object already initialized",Or=Tr.TypeError,Lr=Tr.WeakMap;if(xr||Ar.state){var Ir=Ar.state||(Ar.state=new Lr);Ir.get=Ir.get,Ir.has=Ir.has,Ir.set=Ir.set,sr=function(e,t){if(Ir.has(e))throw Or(br);return t.facade=e,Ir.set(e,t),t},ur=function(e){return Ir.get(e)||{}},cr=function(e){return Ir.has(e)}}else{var wr=Rr("state");Cr[wr]=!0,sr=function(e,t){if(Sr(e,wr))throw Or(br);return t.facade=e,_r(e,wr,t),t},ur=function(e){return Sr(e,wr)?e[wr]:{}},cr=function(e){return Sr(e,wr)}}var Pr={set:sr,get:ur,has:cr,enforce:function(e){return cr(e)?ur(e):sr(e,{})},getterFor:function(e){return function(t){var r;if(!Er(t)||(r=ur(t)).type!==e)throw Or("Incompatible receiver, "+e+" required");return r}}},Mr=R,Vr=u,Nr=W,Fr=je,Dr=c,Ur=ir.CONFIGURABLE,Br=lr,kr=Pr.enforce,zr=Pr.get,Gr=String,jr=Object.defineProperty,Xr=Mr("".slice),Wr=Mr("".replace),Hr=Mr([].join),Yr=Dr&&!Vr((function(){return 8!==jr((function(){}),"length",{value:8}).length})),Zr=String(String).split("String"),qr=Qt.exports=function(e,t,r){"Symbol("===Xr(Gr(t),0,7)&&(t="["+Wr(Gr(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!Fr(e,"name")||Ur&&e.name!==t)&&(Dr?jr(e,"name",{value:t,configurable:!0}):e.name=t),Yr&&r&&Fr(r,"arity")&&e.length!==r.arity&&jr(e,"length",{value:r.arity});try{r&&Fr(r,"constructor")&&r.constructor?Dr&&jr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var i=kr(e);return Fr(i,"source")||(i.source=Hr(Zr,"string"==typeof t?t:"")),e};Function.prototype.toString=qr((function(){return Nr(this)&&zr(this).source||Br(this)}),"toString");var Kr=W,Qr=wt,Jr=Qt.exports,$r=Me,ei=function(e,t,r,i){i||(i={});var n=i.enumerable,o=void 0!==i.name?i.name:t;if(Kr(r)&&Jr(r,o,i),i.global)n?e[t]=r:$r(t,r);else{try{i.unsafe?e[t]&&(n=!0):delete e[t]}catch(e){}n?e[t]=r:Qr.f(e,t,{value:r,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return e},ti={},ri=Math.ceil,ii=Math.floor,ni=Math.trunc||function(e){var t=+e;return(t>0?ii:ri)(t)},oi=ni,ai=function(e){var t=+e;return t!=t||0===t?0:oi(t)},si=ai,ui=Math.max,ci=Math.min,li=function(e,t){var r=si(e);return r<0?ui(r+t,0):ci(r,t)},fi=ai,hi=Math.min,pi=function(e){return e>0?hi(fi(e),9007199254740991):0},di=pi,mi=function(e){return di(e.length)},vi=z,yi=li,gi=mi,xi=function(e){return function(t,r,i){var n,o=vi(t),a=gi(o),s=yi(i,a);if(e&&r!=r){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},Ti={includes:xi(!0),indexOf:xi(!1)},Ei=je,_i=z,Si=Ti.indexOf,Ai=gr,Ri=R([].push),Ci=function(e,t){var r,i=_i(e),n=0,o=[];for(r in i)!Ei(Ai,r)&&Ei(i,r)&&Ri(o,r);for(;t.length>n;)Ei(i,r=t[n++])&&(~Si(o,r)||Ri(o,r));return o},bi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Oi=Ci,Li=bi.concat("length","prototype");ti.f=Object.getOwnPropertyNames||function(e){return Oi(e,Li)};var Ii={};Ii.f=Object.getOwnPropertySymbols;var wi=Q,Pi=ti,Mi=Ii,Vi=Ft,Ni=R([].concat),Fi=wi("Reflect","ownKeys")||function(e){var t=Pi.f(Vi(e)),r=Mi.f;return r?Ni(t,r(e)):t},Di=je,Ui=Fi,Bi=s,ki=wt,zi=u,Gi=W,ji=/#|\.prototype\./,Xi=function(e,t){var r=Hi[Wi(e)];return r===Zi||r!==Yi&&(Gi(t)?zi(t):!!t)},Wi=Xi.normalize=function(e){return String(e).replace(ji,".").toLowerCase()},Hi=Xi.data={},Yi=Xi.NATIVE="N",Zi=Xi.POLYFILL="P",qi=Xi,Ki=a,Qi=s.f,Ji=Kt,$i=ei,en=Me,tn=function(e,t,r){for(var i=Ui(t),n=ki.f,o=Bi.f,a=0;a<i.length;a++){var s=i[a];Di(e,s)||r&&Di(r,s)||n(e,s,o(t,s))}},rn=qi,nn=function(e,t){var r,i,n,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?Ki:c?Ki[s]||en(s,{}):(Ki[s]||{}).prototype)for(i in t){if(o=t[i],n=e.dontCallGetSet?(a=Qi(r,i))&&a.value:r[i],!rn(u?i:s+(c?".":"#")+i,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;tn(o,n)}(e.sham||n&&n.sham)&&Ji(o,"sham",!0),$i(r,i,o,e)}},on={},an=Ci,sn=bi,un=Object.keys||function(e){return an(e,sn)},cn=c,ln=Pt,fn=wt,hn=Ft,pn=z,dn=un;on.f=cn&&!ln?Object.defineProperties:function(e,t){hn(e);for(var r,i=pn(t),n=dn(t),o=n.length,a=0;o>a;)fn.f(e,r=n[a++],i[r]);return e};var mn,vn=Q("document","documentElement"),yn=Ft,gn=on,xn=bi,Tn=gr,En=vn,_n=xt,Sn="prototype",An="script",Rn=yr("IE_PROTO"),Cn=function(){},bn=function(e){return"<"+An+">"+e+"</"+An+">"},On=function(e){e.write(bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ln=function(){try{mn=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Ln="undefined"!=typeof document?document.domain&&mn?On(mn):(t=_n("iframe"),r="java"+An+":",t.style.display="none",En.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(bn("document.F=Object")),e.close(),e.F):On(mn);for(var i=xn.length;i--;)delete Ln[Sn][xn[i]];return Ln()};Tn[Rn]=!0;var In=Object.create||function(e,t){var r;return null!==e?(Cn[Sn]=yn(e),r=new Cn,Cn[Sn]=null,r[Rn]=e):r=Ln(),void 0===t?r:gn.f(r,t)},wn=nt,Pn=In,Mn=wt.f,Vn=wn("unscopables"),Nn=Array.prototype;void 0===Nn[Vn]&&Mn(Nn,Vn,{configurable:!0,value:Pn(null)});var Fn=function(e){Nn[Vn][e]=!0},Dn=Ti.includes,Un=Fn;nn({target:"Array",proto:!0,forced:u((function(){return!Array(1).includes()}))},{includes:function(e){return Dn(this,e,arguments.length>1?arguments[1]:void 0)}}),Un("includes");var Bn=a,kn=R;(function(e,t){kn(Bn[e].prototype[t])})("Array","includes");var zn=!u((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Gn=je,jn=W,Xn=ke,Wn=zn,Hn=yr("IE_PROTO"),Yn=Object,Zn=Yn.prototype,qn=Wn?Yn.getPrototypeOf:function(e){var t=Xn(e);if(Gn(t,Hn))return t[Hn];var r=t.constructor;return jn(r)&&t instanceof r?r.prototype:t instanceof Yn?Zn:null},Kn=c,Qn=u,Jn=R,$n=qn,eo=un,to=z,ro=Jn(d.f),io=Jn([].push),no=Kn&&Qn((function(){var e=Object.create(null);return e[2]=2,!ro(e,2)})),oo=function(e){return function(t){for(var r,i=to(t),n=eo(i),o=no&&null===$n(i),a=n.length,s=0,u=[];a>s;)r=n[s++],Kn&&!(o?r in i:ro(i,r))||io(u,e?[r,i[r]]:i[r]);return u}},ao={entries:oo(!0),values:oo(!1)},so=ao.values;nn({target:"Object",stat:!0},{values:function(e){return so(e)}});var uo=a;uo.Object.values;var co=ao.entries;nn({target:"Object",stat:!0},{entries:function(e){return co(e)}}),uo.Object.entries;var lo={exports:{}},fo=nt("iterator"),ho=!1;try{var po=0,mo={next:function(){return{done:!!po++}},return:function(){ho=!0}};mo[fo]=function(){return this},Array.from(mo,(function(){throw 2}))}catch(e){}var vo=function(e,t){if(!t&&!ho)return!1;var r=!1;try{var i={};i[fo]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},yo="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,go={};go[nt("toStringTag")]="z";var xo,To,Eo,_o="[object z]"===String(go),So=_o,Ao=W,Ro=L,Co=nt("toStringTag"),bo=Object,Oo="Arguments"===Ro(function(){return arguments}()),Lo=So?Ro:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=bo(e),Co))?r:Oo?Ro(t):"Object"===(i=Ro(t))&&Ao(t.callee)?"Arguments":i},Io=Qt.exports,wo=wt,Po=function(e,t,r){return r.get&&Io(r.get,t,{getter:!0}),r.set&&Io(r.set,t,{setter:!0}),wo.f(e,t,r)},Mo=R,Vo=_e,No=W,Fo=String,Do=TypeError,Uo=function(e,t,r){try{return Mo(Vo(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},Bo=Ft,ko=function(e){if("object"==typeof e||No(e))return e;throw Do("Can't set "+Fo(e)+" as a prototype")},zo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Uo(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return Bo(r),ko(i),t?e(r,i):r.__proto__=i,r}}():void 0),Go=yo,jo=c,Xo=a,Wo=W,Ho=Z,Yo=je,Zo=Lo,qo=ge,Ko=Kt,Qo=ei,Jo=Po,$o=J,ea=qn,ta=zo,ra=nt,ia=Ze,na=Pr.enforce,oa=Pr.get,aa=Xo.Int8Array,sa=aa&&aa.prototype,ua=Xo.Uint8ClampedArray,ca=ua&&ua.prototype,la=aa&&ea(aa),fa=sa&&ea(sa),ha=Object.prototype,pa=Xo.TypeError,da=ra("toStringTag"),ma=ia("TYPED_ARRAY_TAG"),va="TypedArrayConstructor",ya=Go&&!!ta&&"Opera"!==Zo(Xo.opera),ga=!1,xa={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Ta={BigInt64Array:8,BigUint64Array:8},Ea=function(e){var t=ea(e);if(Ho(t)){var r=oa(t);return r&&Yo(r,va)?r[va]:Ea(t)}},_a=function(e){if(!Ho(e))return!1;var t=Zo(e);return Yo(xa,t)||Yo(Ta,t)};for(xo in xa)(Eo=(To=Xo[xo])&&To.prototype)?na(Eo)[va]=To:ya=!1;for(xo in Ta)(Eo=(To=Xo[xo])&&To.prototype)&&(na(Eo)[va]=To);if((!ya||!Wo(la)||la===Function.prototype)&&(la=function(){throw pa("Incorrect invocation")},ya))for(xo in xa)Xo[xo]&&ta(Xo[xo],la);if((!ya||!fa||fa===ha)&&(fa=la.prototype,ya))for(xo in xa)Xo[xo]&&ta(Xo[xo].prototype,fa);if(ya&&ea(ca)!==fa&&ta(ca,fa),jo&&!Yo(fa,da))for(xo in ga=!0,Jo(fa,da,{configurable:!0,get:function(){return Ho(this)?this[ma]:void 0}}),xa)Xo[xo]&&Ko(Xo[xo],ma,xo);var Sa={NATIVE_ARRAY_BUFFER_VIEWS:ya,TYPED_ARRAY_TAG:ga&&ma,aTypedArray:function(e){if(_a(e))return e;throw pa("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Wo(e)&&(!ta||$o(la,e)))return e;throw pa(qo(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,i){if(jo){if(r)for(var n in xa){var o=Xo[n];if(o&&Yo(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}fa[e]&&!r||Qo(fa,e,r?t:ya&&sa[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,r){var i,n;if(jo){if(ta){if(r)for(i in xa)if((n=Xo[i])&&Yo(n,e))try{delete n[e]}catch(e){}if(la[e]&&!r)return;try{return Qo(la,e,r?t:ya&&la[e]||t)}catch(e){}}for(i in xa)!(n=Xo[i])||n[e]&&!r||Qo(n,e,t)}},getTypedArrayConstructor:Ea,isView:function(e){if(!Ho(e))return!1;var t=Zo(e);return"DataView"===t||Yo(xa,t)||Yo(Ta,t)},isTypedArray:_a,TypedArray:la,TypedArrayPrototype:fa},Aa=a,Ra=u,Ca=vo,ba=Sa.NATIVE_ARRAY_BUFFER_VIEWS,Oa=Aa.ArrayBuffer,La=Aa.Int8Array,Ia=!ba||!Ra((function(){La(1)}))||!Ra((function(){new La(-1)}))||!Ca((function(e){new La,new La(null),new La(1.5),new La(e)}),!0)||Ra((function(){return 1!==new La(new Oa(2),1,void 0).length})),wa=ei,Pa=function(e,t,r){for(var i in t)wa(e,i,t[i],r);return e},Ma=J,Va=TypeError,Na=function(e,t){if(Ma(t,e))return e;throw Va("Incorrect invocation")},Fa=ai,Da=pi,Ua=RangeError,Ba=function(e){if(void 0===e)return 0;var t=Fa(e),r=Da(t);if(t!==r)throw Ua("Wrong length or index");return r},ka=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1},za=ni,Ga=Array,ja=Math.abs,Xa=Math.pow,Wa=Math.floor,Ha=Math.log,Ya=Math.LN2,Za=function(e){var t=za(e),r=ja(e-t);return r>.5||.5===r&&t%2!=0?t+ka(e):t},qa={pack:function(e,t,r){var i,n,o,a=Ga(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,l=23===t?Xa(2,-24)-Xa(2,-77):0,f=e<0||0===e&&1/e<0?1:0,h=0;for((e=ja(e))!=e||e===1/0?(n=e!=e?1:0,i=u):(i=Wa(Ha(e)/Ya),e*(o=Xa(2,-i))<1&&(i--,o*=2),(e+=i+c>=1?l/o:l*Xa(2,1-c))*o>=2&&(i++,o/=2),i+c>=u?(n=0,i=u):i+c>=1?(n=Za((e*o-1)*Xa(2,t)),i+=c):(n=Za(e*Xa(2,c-1)*Xa(2,t)),i=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(i=i<<t|n,s+=t;s>0;)a[h++]=255&i,i/=256,s-=8;return a[--h]|=128*f,a},unpack:function(e,t){var r,i=e.length,n=8*i-t-1,o=(1<<n)-1,a=o>>1,s=n-7,u=i-1,c=e[u--],l=127&c;for(c>>=7;s>0;)l=256*l+e[u--],s-=8;for(r=l&(1<<-s)-1,l>>=-s,s+=t;s>0;)r=256*r+e[u--],s-=8;if(0===l)l=1-a;else{if(l===o)return r?NaN:c?-1/0:1/0;r+=Xa(2,t),l-=a}return(c?-1:1)*r*Xa(2,l-t)}},Ka=ke,Qa=li,Ja=mi,$a=function(e){for(var t=Ka(this),r=Ja(t),i=arguments.length,n=Qa(i>1?arguments[1]:void 0,r),o=i>2?arguments[2]:void 0,a=void 0===o?r:Qa(o,r);a>n;)t[n++]=e;return t},es=mt,ts=wt,rs=T,is=li,ns=mi,os=function(e,t,r){var i=es(t);i in e?ts.f(e,i,rs(0,r)):e[i]=r},as=Array,ss=Math.max,us=function(e,t,r){for(var i=ns(e),n=is(t,i),o=is(void 0===r?i:r,i),a=as(ss(o-n,0)),s=0;n<o;n++,s++)os(a,s,e[n]);return a.length=s,a},cs=wt.f,ls=je,fs=nt("toStringTag"),hs=function(e,t,r){e&&!r&&(e=e.prototype),e&&!ls(e,fs)&&cs(e,fs,{configurable:!0,value:t})},ps=a,ds=R,ms=c,vs=yo,ys=ir,gs=Kt,xs=Po,Ts=Pa,Es=u,_s=Na,Ss=ai,As=pi,Rs=Ba,Cs=qa,bs=qn,Os=zo,Ls=ti.f,Is=$a,ws=us,Ps=hs,Ms=Pr,Vs=ys.PROPER,Ns=ys.CONFIGURABLE,Fs="ArrayBuffer",Ds="DataView",Us="prototype",Bs="Wrong index",ks=Ms.getterFor(Fs),zs=Ms.getterFor(Ds),Gs=Ms.set,js=ps[Fs],Xs=js,Ws=Xs&&Xs[Us],Hs=ps[Ds],Ys=Hs&&Hs[Us],Zs=Object.prototype,qs=ps.Array,Ks=ps.RangeError,Qs=ds(Is),Js=ds([].reverse),$s=Cs.pack,eu=Cs.unpack,tu=function(e){return[255&e]},ru=function(e){return[255&e,e>>8&255]},iu=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},nu=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},ou=function(e){return $s(e,23,4)},au=function(e){return $s(e,52,8)},su=function(e,t,r){xs(e[Us],t,{configurable:!0,get:function(){return r(this)[t]}})},uu=function(e,t,r,i){var n=zs(e),o=Rs(r),a=!!i;if(o+t>n.byteLength)throw Ks(Bs);var s=n.bytes,u=o+n.byteOffset,c=ws(s,u,u+t);return a?c:Js(c)},cu=function(e,t,r,i,n,o){var a=zs(e),s=Rs(r),u=i(+n),c=!!o;if(s+t>a.byteLength)throw Ks(Bs);for(var l=a.bytes,f=s+a.byteOffset,h=0;h<t;h++)l[f+h]=u[c?h:t-h-1]};if(vs){var lu=Vs&&js.name!==Fs;if(Es((function(){js(1)}))&&Es((function(){new js(-1)}))&&!Es((function(){return new js,new js(1.5),new js(NaN),1!==js.length||lu&&!Ns})))lu&&Ns&&gs(js,"name",Fs);else{(Xs=function(e){return _s(this,Ws),new js(Rs(e))})[Us]=Ws;for(var fu,hu=Ls(js),pu=0;hu.length>pu;)(fu=hu[pu++])in Xs||gs(Xs,fu,js[fu]);Ws.constructor=Xs}Os&&bs(Ys)!==Zs&&Os(Ys,Zs);var du=new Hs(new Xs(2)),mu=ds(Ys.setInt8);du.setInt8(0,2147483648),du.setInt8(1,2147483649),!du.getInt8(0)&&du.getInt8(1)||Ts(Ys,{setInt8:function(e,t){mu(this,e,t<<24>>24)},setUint8:function(e,t){mu(this,e,t<<24>>24)}},{unsafe:!0})}else Ws=(Xs=function(e){_s(this,Ws);var t=Rs(e);Gs(this,{type:Fs,bytes:Qs(qs(t),0),byteLength:t}),ms||(this.byteLength=t,this.detached=!1)})[Us],Ys=(Hs=function(e,t,r){_s(this,Ys),_s(e,Ws);var i=ks(e),n=i.byteLength,o=Ss(t);if(o<0||o>n)throw Ks("Wrong offset");if(o+(r=void 0===r?n-o:As(r))>n)throw Ks("Wrong length");Gs(this,{type:Ds,buffer:e,byteLength:r,byteOffset:o,bytes:i.bytes}),ms||(this.buffer=e,this.byteLength=r,this.byteOffset=o)})[Us],ms&&(su(Xs,"byteLength",ks),su(Hs,"buffer",zs),su(Hs,"byteLength",zs),su(Hs,"byteOffset",zs)),Ts(Ys,{getInt8:function(e){return uu(this,1,e)[0]<<24>>24},getUint8:function(e){return uu(this,1,e)[0]},getInt16:function(e){var t=uu(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=uu(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return nu(uu(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return nu(uu(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return eu(uu(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return eu(uu(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){cu(this,1,e,tu,t)},setUint8:function(e,t){cu(this,1,e,tu,t)},setInt16:function(e,t){cu(this,2,e,ru,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){cu(this,2,e,ru,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){cu(this,4,e,iu,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){cu(this,4,e,iu,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){cu(this,4,e,ou,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){cu(this,8,e,au,t,arguments.length>2&&arguments[2])}});Ps(Xs,Fs),Ps(Hs,Ds);var vu={ArrayBuffer:Xs,DataView:Hs},yu=Z,gu=Math.floor,xu=Number.isInteger||function(e){return!yu(e)&&isFinite(e)&&gu(e)===e},Tu=ai,Eu=RangeError,_u=function(e){var t=Tu(e);if(t<0)throw Eu("The argument can't be less than 0");return t},Su=RangeError,Au=function(e,t){var r=_u(e);if(r%t)throw Su("Wrong offset");return r},Ru=Math.round,Cu=L,bu=R,Ou=function(e){if("Function"===Cu(e))return bu(e)},Lu=_e,Iu=l,wu=Ou(Ou.bind),Pu=function(e,t){return Lu(e),void 0===t?e:Iu?wu(e,t):function(){return e.apply(t,arguments)}},Mu=R,Vu=u,Nu=W,Fu=Lo,Du=lr,Uu=function(){},Bu=[],ku=Q("Reflect","construct"),zu=/^\s*(?:class|function)\b/,Gu=Mu(zu.exec),ju=!zu.exec(Uu),Xu=function(e){if(!Nu(e))return!1;try{return ku(Uu,Bu,e),!0}catch(e){return!1}},Wu=function(e){if(!Nu(e))return!1;switch(Fu(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ju||!!Gu(zu,Du(e))}catch(e){return!0}};Wu.sham=!0;var Hu=!ku||Vu((function(){var e;return Xu(Xu.call)||!Xu(Object)||!Xu((function(){e=!0}))||e}))?Wu:Xu,Yu=Hu,Zu=ge,qu=TypeError,Ku=function(e){if(Yu(e))return e;throw qu(Zu(e)+" is not a constructor")},Qu={},Ju=Lo,$u=Re,ec=N,tc=Qu,rc=nt("iterator"),ic=function(e){if(!ec(e))return $u(e,rc)||$u(e,"@@iterator")||tc[Ju(e)]},nc=p,oc=_e,ac=Ft,sc=ge,uc=ic,cc=TypeError,lc=function(e,t){var r=arguments.length<2?uc(e):t;if(oc(r))return ac(nc(r,e));throw cc(sc(e)+" is not iterable")},fc=Qu,hc=nt("iterator"),pc=Array.prototype,dc=function(e){return void 0!==e&&(fc.Array===e||pc[hc]===e)},mc=Lo,vc=function(e){var t=mc(e);return"BigInt64Array"===t||"BigUint64Array"===t},yc=ht,gc=TypeError,xc=function(e){var t=yc(e,"number");if("number"==typeof t)throw gc("Can't convert number to bigint");return BigInt(t)},Tc=Pu,Ec=p,_c=Ku,Sc=ke,Ac=mi,Rc=lc,Cc=ic,bc=dc,Oc=vc,Lc=Sa.aTypedArrayConstructor,Ic=xc,wc=function(e){var t,r,i,n,o,a,s,u,c=_c(this),l=Sc(e),f=arguments.length,h=f>1?arguments[1]:void 0,p=void 0!==h,d=Cc(l);if(d&&!bc(d))for(u=(s=Rc(l,d)).next,l=[];!(a=Ec(u,s)).done;)l.push(a.value);for(p&&f>2&&(h=Tc(h,arguments[2])),r=Ac(l),i=new(Lc(c))(r),n=Oc(i),t=0;r>t;t++)o=p?h(l[t],t):l[t],i[t]=n?Ic(o):+o;return i},Pc=L,Mc=Array.isArray||function(e){return"Array"===Pc(e)},Vc=Hu,Nc=Z,Fc=nt("species"),Dc=Array,Uc=function(e){var t;return Mc(e)&&(t=e.constructor,(Vc(t)&&(t===Dc||Mc(t.prototype))||Nc(t)&&null===(t=t[Fc]))&&(t=void 0)),void 0===t?Dc:t},Bc=Pu,kc=V,zc=ke,Gc=mi,jc=function(e,t){return new(Uc(e))(0===t?0:t)},Xc=R([].push),Wc=function(e){var t=1===e,r=2===e,i=3===e,n=4===e,o=6===e,a=7===e,s=5===e||o;return function(u,c,l,f){for(var h,p,d=zc(u),m=kc(d),v=Bc(c,l),y=Gc(m),g=0,x=f||jc,T=t?x(u,y):r||a?x(u,0):void 0;y>g;g++)if((s||g in m)&&(p=v(h=m[g],g,d),e))if(t)T[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:Xc(T,h)}else switch(e){case 4:return!1;case 7:Xc(T,h)}return o?-1:i||n?n:T}},Hc={forEach:Wc(0),map:Wc(1),filter:Wc(2),some:Wc(3),every:Wc(4),find:Wc(5),findIndex:Wc(6),filterReject:Wc(7)},Yc=Q,Zc=Po,qc=c,Kc=nt("species"),Qc=function(e){var t=Yc(e);qc&&t&&!t[Kc]&&Zc(t,Kc,{configurable:!0,get:function(){return this}})},Jc=W,$c=Z,el=zo,tl=function(e,t,r){var i,n;return el&&Jc(i=t.constructor)&&i!==r&&$c(n=i.prototype)&&n!==r.prototype&&el(e,n),e},rl=nn,il=a,nl=p,ol=c,al=Ia,sl=Sa,ul=vu,cl=Na,ll=T,fl=Kt,hl=xu,pl=pi,dl=Ba,ml=Au,vl=function(e){var t=Ru(e);return t<0?0:t>255?255:255&t},yl=mt,gl=je,xl=Lo,Tl=Z,El=ve,_l=In,Sl=J,Al=zo,Rl=ti.f,Cl=wc,bl=Hc.forEach,Ol=Qc,Ll=Po,Il=wt,wl=s,Pl=tl,Ml=Pr.get,Vl=Pr.set,Nl=Pr.enforce,Fl=Il.f,Dl=wl.f,Ul=il.RangeError,Bl=ul.ArrayBuffer,kl=Bl.prototype,zl=ul.DataView,Gl=sl.NATIVE_ARRAY_BUFFER_VIEWS,jl=sl.TYPED_ARRAY_TAG,Xl=sl.TypedArray,Wl=sl.TypedArrayPrototype,Hl=sl.aTypedArrayConstructor,Yl=sl.isTypedArray,Zl="BYTES_PER_ELEMENT",ql="Wrong length",Kl=function(e,t){Hl(e);for(var r=0,i=t.length,n=new e(i);i>r;)n[r]=t[r++];return n},Ql=function(e,t){Ll(e,t,{configurable:!0,get:function(){return Ml(this)[t]}})},Jl=function(e){var t;return Sl(kl,e)||"ArrayBuffer"===(t=xl(e))||"SharedArrayBuffer"===t},$l=function(e,t){return Yl(e)&&!El(t)&&t in e&&hl(+t)&&t>=0},ef=function(e,t){return t=yl(t),$l(e,t)?ll(2,e[t]):Dl(e,t)},tf=function(e,t,r){return t=yl(t),!($l(e,t)&&Tl(r)&&gl(r,"value"))||gl(r,"get")||gl(r,"set")||r.configurable||gl(r,"writable")&&!r.writable||gl(r,"enumerable")&&!r.enumerable?Fl(e,t,r):(e[t]=r.value,e)};ol?(Gl||(wl.f=ef,Il.f=tf,Ql(Wl,"buffer"),Ql(Wl,"byteOffset"),Ql(Wl,"byteLength"),Ql(Wl,"length")),rl({target:"Object",stat:!0,forced:!Gl},{getOwnPropertyDescriptor:ef,defineProperty:tf}),lo.exports=function(e,t,r){var i=e.match(/\d+/)[0]/8,n=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=il[n],u=s,c=u&&u.prototype,l={},f=function(e,t){Fl(e,t,{get:function(){return function(e,t){var r=Ml(e);return r.view[o](t*i+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=Ml(e);o.view[a](t*i+o.byteOffset,r?vl(n):n,!0)}(this,t,e)},enumerable:!0})};Gl?al&&(u=t((function(e,t,r,n){return cl(e,c),Pl(Tl(t)?Jl(t)?void 0!==n?new s(t,ml(r,i),n):void 0!==r?new s(t,ml(r,i)):new s(t):Yl(t)?Kl(u,t):nl(Cl,u,t):new s(dl(t)),e,u)})),Al&&Al(u,Xl),bl(Rl(s),(function(e){e in u||fl(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,n){cl(e,c);var o,a,s,l=0,h=0;if(Tl(t)){if(!Jl(t))return Yl(t)?Kl(u,t):nl(Cl,u,t);o=t,h=ml(r,i);var p=t.byteLength;if(void 0===n){if(p%i)throw Ul(ql);if((a=p-h)<0)throw Ul(ql)}else if((a=pl(n)*i)+h>p)throw Ul(ql);s=a/i}else s=dl(t),o=new Bl(a=s*i);for(Vl(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new zl(o)});l<s;)f(e,l++)})),Al&&Al(u,Xl),c=u.prototype=_l(Wl)),c.constructor!==u&&fl(c,"constructor",u),Nl(c).TypedArrayConstructor=u,jl&&fl(c,jl,n);var h=u!==s;l[n]=u,rl({global:!0,constructor:!0,forced:h,sham:!Gl},l),Zl in u||fl(u,Zl,i),Zl in c||fl(c,Zl,i),Ol(n)}):lo.exports=function(){},(0,lo.exports)("Int8",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}}),!0),(0,lo.exports)("Int16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Uint16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Int32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Uint32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Float32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Float64",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var rf=Lo,nf=_o?{}.toString:function(){return"[object "+rf(this)+"]"};_o||ei(Object.prototype,"toString",nf,{unsafe:!0});var of,af,sf,uf=Lo,cf=String,lf=function(e){if("Symbol"===uf(e))throw TypeError("Cannot convert a Symbol value to a string");return cf(e)},ff=R,hf=ai,pf=lf,df=U,mf=ff("".charAt),vf=ff("".charCodeAt),yf=ff("".slice),gf=function(e){return function(t,r){var i,n,o=pf(df(t)),a=hf(r),s=o.length;return a<0||a>=s?e?"":void 0:(i=vf(o,a))<55296||i>56319||a+1===s||(n=vf(o,a+1))<56320||n>57343?e?mf(o,a):i:e?yf(o,a,a+2):n-56320+(i-55296<<10)+65536}},xf={codeAt:gf(!1),charAt:gf(!0)},Tf=u,Ef=W,_f=Z,Sf=qn,Af=ei,Rf=nt("iterator"),Cf=!1;[].keys&&("next"in(sf=[].keys())?(af=Sf(Sf(sf)))!==Object.prototype&&(of=af):Cf=!0);var bf=!_f(of)||Tf((function(){var e={};return of[Rf].call(e)!==e}));bf&&(of={}),Ef(of[Rf])||Af(of,Rf,(function(){return this}));var Of={IteratorPrototype:of,BUGGY_SAFARI_ITERATORS:Cf},Lf=Of.IteratorPrototype,If=In,wf=T,Pf=hs,Mf=Qu,Vf=function(){return this},Nf=nn,Ff=p,Df=W,Uf=function(e,t,r,i){var n=t+" Iterator";return e.prototype=If(Lf,{next:wf(+!i,r)}),Pf(e,n,!1),Mf[n]=Vf,e},Bf=qn,kf=zo,zf=hs,Gf=Kt,jf=ei,Xf=Qu,Wf=ir.PROPER,Hf=ir.CONFIGURABLE,Yf=Of.IteratorPrototype,Zf=Of.BUGGY_SAFARI_ITERATORS,qf=nt("iterator"),Kf="keys",Qf="values",Jf="entries",$f=function(){return this},eh=function(e,t,r,i,n,o,a){Uf(r,t,i);var s,u,c,l=function(e){if(e===n&&m)return m;if(!Zf&&e in p)return p[e];switch(e){case Kf:case Qf:case Jf:return function(){return new r(this,e)}}return function(){return new r(this)}},f=t+" Iterator",h=!1,p=e.prototype,d=p[qf]||p["@@iterator"]||n&&p[n],m=!Zf&&d||l(n),v="Array"===t&&p.entries||d;if(v&&(s=Bf(v.call(new e)))!==Object.prototype&&s.next&&(Bf(s)!==Yf&&(kf?kf(s,Yf):Df(s[qf])||jf(s,qf,$f)),zf(s,f,!0)),Wf&&n===Qf&&d&&d.name!==Qf&&(Hf?Gf(p,"name",Qf):(h=!0,m=function(){return Ff(d,this)})),n)if(u={values:l(Qf),keys:o?m:l(Kf),entries:l(Jf)},a)for(c in u)(Zf||h||!(c in p))&&jf(p,c,u[c]);else Nf({target:t,proto:!0,forced:Zf||h},u);return p[qf]!==m&&jf(p,qf,m,{name:n}),Xf[t]=m,u},th=function(e,t){return{value:e,done:t}},rh=xf.charAt,ih=lf,nh=Pr,oh=eh,ah=th,sh="String Iterator",uh=nh.set,ch=nh.getterFor(sh);oh(String,"String",(function(e){uh(this,{type:sh,string:ih(e),index:0})}),(function(){var e,t=ch(this),r=t.string,i=t.index;return i>=r.length?ah(void 0,!0):(e=rh(r,i),t.index+=e.length,ah(e,!1))})),(0,Sa.exportTypedArrayStaticMethod)("from",wc,Ia);var lh=Sa.aTypedArrayConstructor;(0,Sa.exportTypedArrayStaticMethod)("of",(function(){for(var e=0,t=arguments.length,r=new(lh(this))(t);t>e;)r[e]=arguments[e++];return r}),Ia);var fh=mi,hh=ai,ph=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("at",(function(e){var t=ph(this),r=fh(t),i=hh(e),n=i>=0?i:r+i;return n<0||n>=r?void 0:t[n]}));var dh=ge,mh=TypeError,vh=ke,yh=li,gh=mi,xh=function(e,t){if(!delete e[t])throw mh("Cannot delete property "+dh(t)+" of "+dh(e))},Th=Math.min,Eh=[].copyWithin||function(e,t){var r=vh(this),i=gh(r),n=yh(e,i),o=yh(t,i),a=arguments.length>2?arguments[2]:void 0,s=Th((void 0===a?i:yh(a,i))-o,i-n),u=1;for(o<n&&n<o+s&&(u=-1,o+=s-1,n+=s-1);s-- >0;)o in r?r[n]=r[o]:xh(r,n),n+=u,o+=u;return r},_h=Sa,Sh=R(Eh),Ah=_h.aTypedArray;(0,_h.exportTypedArrayMethod)("copyWithin",(function(e,t){return Sh(Ah(this),e,t,arguments.length>2?arguments[2]:void 0)}));var Rh=Hc.every,Ch=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("every",(function(e){return Rh(Ch(this),e,arguments.length>1?arguments[1]:void 0)}));var bh=$a,Oh=xc,Lh=Lo,Ih=p,wh=u,Ph=Sa.aTypedArray,Mh=Sa.exportTypedArrayMethod,Vh=R("".slice);Mh("fill",(function(e){var t=arguments.length;Ph(this);var r="Big"===Vh(Lh(this),0,3)?Oh(e):+e;return Ih(bh,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),wh((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})));var Nh=mi,Fh=function(e,t){for(var r=0,i=Nh(t),n=new e(i);i>r;)n[r]=t[r++];return n},Dh=Ft,Uh=Ku,Bh=N,kh=nt("species"),zh=function(e,t){var r,i=Dh(e).constructor;return void 0===i||Bh(r=Dh(i)[kh])?t:Uh(r)},Gh=zh,jh=Sa.aTypedArrayConstructor,Xh=Sa.getTypedArrayConstructor,Wh=function(e){return jh(Gh(e,Xh(e)))},Hh=Fh,Yh=Wh,Zh=function(e,t){return Hh(Yh(e),t)},qh=Hc.filter,Kh=Zh,Qh=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("filter",(function(e){var t=qh(Qh(this),e,arguments.length>1?arguments[1]:void 0);return Kh(this,t)}));var Jh=Hc.find,$h=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("find",(function(e){return Jh($h(this),e,arguments.length>1?arguments[1]:void 0)}));var ep=Hc.findIndex,tp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("findIndex",(function(e){return ep(tp(this),e,arguments.length>1?arguments[1]:void 0)}));var rp=Pu,ip=V,np=ke,op=mi,ap=function(e){var t=1===e;return function(r,i,n){for(var o,a=np(r),s=ip(a),u=rp(i,n),c=op(s);c-- >0;)if(u(o=s[c],c,a))switch(e){case 0:return o;case 1:return c}return t?-1:void 0}},sp={findLast:ap(0),findLastIndex:ap(1)},up=sp.findLast,cp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("findLast",(function(e){return up(cp(this),e,arguments.length>1?arguments[1]:void 0)}));var lp=sp.findLastIndex,fp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("findLastIndex",(function(e){return lp(fp(this),e,arguments.length>1?arguments[1]:void 0)}));var hp=Hc.forEach,pp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("forEach",(function(e){hp(pp(this),e,arguments.length>1?arguments[1]:void 0)}));var dp=Ti.includes,mp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("includes",(function(e){return dp(mp(this),e,arguments.length>1?arguments[1]:void 0)}));var vp=Ti.indexOf,yp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("indexOf",(function(e){return vp(yp(this),e,arguments.length>1?arguments[1]:void 0)}));var gp=Sa.aTypedArray,xp=Sa.exportTypedArrayMethod,Tp=R([].join);xp("join",(function(e){return Tp(gp(this),e)}));var Ep=l,_p=Function.prototype,Sp=_p.apply,Ap=_p.call,Rp="object"==typeof Reflect&&Reflect.apply||(Ep?Ap.bind(Sp):function(){return Ap.apply(Sp,arguments)}),Cp=u,bp=Rp,Op=z,Lp=ai,Ip=mi,wp=function(e,t){var r=[][e];return!!r&&Cp((function(){r.call(null,t||function(){return 1},1)}))},Pp=Math.min,Mp=[].lastIndexOf,Vp=!!Mp&&1/[1].lastIndexOf(1,-0)<0,Np=wp("lastIndexOf"),Fp=Vp||!Np?function(e){if(Vp)return bp(Mp,this,arguments)||0;var t=Op(this),r=Ip(t),i=r-1;for(arguments.length>1&&(i=Pp(i,Lp(arguments[1]))),i<0&&(i=r+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:Mp,Dp=Rp,Up=Fp,Bp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Dp(Up,Bp(this),t>1?[e,arguments[1]]:[e])}));var kp=Hc.map,zp=Wh,Gp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("map",(function(e){return kp(Gp(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(zp(e))(t)}))}));var jp=_e,Xp=ke,Wp=V,Hp=mi,Yp=TypeError,Zp=function(e){return function(t,r,i,n){jp(r);var o=Xp(t),a=Wp(o),s=Hp(o),u=e?s-1:0,c=e?-1:1;if(i<2)for(;;){if(u in a){n=a[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw Yp("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in a&&(n=r(n,a[u],u,o));return n}},qp={left:Zp(!1),right:Zp(!0)},Kp=qp.left,Qp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return Kp(Qp(this),e,t,t>1?arguments[1]:void 0)}));var Jp=qp.right,$p=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return Jp($p(this),e,t,t>1?arguments[1]:void 0)}));var ed=Sa.aTypedArray,td=Sa.exportTypedArrayMethod,rd=Math.floor;td("reverse",(function(){for(var e,t=this,r=ed(t).length,i=rd(r/2),n=0;n<i;)e=t[n],t[n++]=t[--r],t[r]=e;return t}));var id=a,nd=p,od=Sa,ad=mi,sd=Au,ud=ke,cd=u,ld=id.RangeError,fd=id.Int8Array,hd=fd&&fd.prototype,pd=hd&&hd.set,dd=od.aTypedArray,md=od.exportTypedArrayMethod,vd=!cd((function(){var e=new Uint8ClampedArray(2);return nd(pd,e,{length:1,0:3},1),3!==e[1]})),yd=vd&&od.NATIVE_ARRAY_BUFFER_VIEWS&&cd((function(){var e=new fd(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));md("set",(function(e){dd(this);var t=sd(arguments.length>1?arguments[1]:void 0,1),r=ud(e);if(vd)return nd(pd,this,r,t);var i=this.length,n=ad(r),o=0;if(n+t>i)throw ld("Wrong length");for(;o<n;)this[t+o]=r[o++]}),!vd||yd);var gd=R([].slice),xd=Wh,Td=gd,Ed=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("slice",(function(e,t){for(var r=Td(Ed(this),e,t),i=xd(this),n=0,o=r.length,a=new i(o);o>n;)a[n]=r[n++];return a}),u((function(){new Int8Array(1).slice()})));var _d=Hc.some,Sd=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("some",(function(e){return _d(Sd(this),e,arguments.length>1?arguments[1]:void 0)}));var Ad=us,Rd=Math.floor,Cd=function(e,t){var r=e.length,i=Rd(r/2);return r<8?bd(e,t):Od(e,Cd(Ad(e,0,i),t),Cd(Ad(e,i),t),t)},bd=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},Od=function(e,t,r,i){for(var n=t.length,o=r.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?i(t[a],r[s])<=0?t[a++]:r[s++]:a<n?t[a++]:r[s++];return e},Ld=Cd,Id=$.match(/firefox\/(\d+)/i),wd=!!Id&&+Id[1],Pd=/MSIE|Trident/.test($),Md=$.match(/AppleWebKit\/(\d+)\./),Vd=!!Md&&+Md[1],Nd=Ou,Fd=u,Dd=_e,Ud=Ld,Bd=wd,kd=Pd,zd=ae,Gd=Vd,jd=Sa.aTypedArray,Xd=Sa.exportTypedArrayMethod,Wd=a.Uint16Array,Hd=Wd&&Nd(Wd.prototype.sort),Yd=!(!Hd||Fd((function(){Hd(new Wd(2),null)}))&&Fd((function(){Hd(new Wd(2),{})}))),Zd=!!Hd&&!Fd((function(){if(zd)return zd<74;if(Bd)return Bd<67;if(kd)return!0;if(Gd)return Gd<602;var e,t,r=new Wd(516),i=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,i[e]=e-2*t+3;for(Hd(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==i[e])return!0}));Xd("sort",(function(e){return void 0!==e&&Dd(e),Zd?Hd(this,e):Ud(jd(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!Zd||Yd);var qd=pi,Kd=li,Qd=Wh,Jd=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("subarray",(function(e,t){var r=Jd(this),i=r.length,n=Kd(e,i);return new(Qd(r))(r.buffer,r.byteOffset+n*r.BYTES_PER_ELEMENT,qd((void 0===t?i:Kd(t,i))-n))}));var $d=Rp,em=Sa,tm=u,rm=gd,im=a.Int8Array,nm=em.aTypedArray,om=em.exportTypedArrayMethod,am=[].toLocaleString,sm=!!im&&tm((function(){am.call(new im(1))}));om("toLocaleString",(function(){return $d(am,sm?rm(nm(this)):nm(this),rm(arguments))}),tm((function(){return[1,2].toLocaleString()!==new im([1,2]).toLocaleString()}))||!tm((function(){im.prototype.toLocaleString.call([1,2])})));var um=Sa.exportTypedArrayMethod,cm=u,lm=R,fm=a.Uint8Array,hm=fm&&fm.prototype||{},pm=[].toString,dm=lm([].join);cm((function(){pm.call({})}))&&(pm=function(){return dm(this)});var mm=hm.toString!==pm;um("toString",pm,mm);var vm=mi,ym=function(e,t){for(var r=vm(e),i=new t(r),n=0;n<r;n++)i[n]=e[r-n-1];return i},gm=Sa.aTypedArray,xm=Sa.getTypedArrayConstructor;(0,Sa.exportTypedArrayMethod)("toReversed",(function(){return ym(gm(this),xm(this))}));var Tm=_e,Em=Fh,_m=Sa.aTypedArray,Sm=Sa.getTypedArrayConstructor,Am=Sa.exportTypedArrayMethod,Rm=R(Sa.TypedArrayPrototype.sort);Am("toSorted",(function(e){void 0!==e&&Tm(e);var t=_m(this),r=Em(Sm(t),t);return Rm(r,e)}));var Cm=mi,bm=ai,Om=RangeError,Lm=function(e,t,r,i){var n=Cm(e),o=bm(r),a=o<0?n+o:o;if(a>=n||a<0)throw Om("Incorrect index");for(var s=new t(n),u=0;u<n;u++)s[u]=u===a?i:e[u];return s},Im=vc,wm=ai,Pm=xc,Mm=Sa.aTypedArray,Vm=Sa.getTypedArrayConstructor,Nm=Sa.exportTypedArrayMethod,Fm=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}();Nm("with",{with:function(e,t){var r=Mm(this),i=wm(e),n=Im(r)?Pm(t):+t;return Lm(r,Vm(r),i,n)}}.with,!Fm);var Dm=z,Um=Fn,Bm=Qu,km=Pr,zm=wt.f,Gm=eh,jm=th,Xm=c,Wm="Array Iterator",Hm=km.set,Ym=km.getterFor(Wm),Zm=Gm(Array,"Array",(function(e,t){Hm(this,{type:Wm,target:Dm(e),index:0,kind:t})}),(function(){var e=Ym(this),t=e.target,r=e.kind,i=e.index++;if(!t||i>=t.length)return e.target=void 0,jm(void 0,!0);switch(r){case"keys":return jm(i,!1);case"values":return jm(t[i],!1)}return jm([i,t[i]],!1)}),"values"),qm=Bm.Arguments=Bm.Array;if(Um("keys"),Um("values"),Um("entries"),Xm&&"values"!==qm.name)try{zm(qm,"name",{value:"values"})}catch(e){}var Km=a,Qm=u,Jm=R,$m=Sa,ev=Zm,tv=nt("iterator"),rv=Km.Uint8Array,iv=Jm(ev.values),nv=Jm(ev.keys),ov=Jm(ev.entries),av=$m.aTypedArray,sv=$m.exportTypedArrayMethod,uv=rv&&rv.prototype,cv=!Qm((function(){uv[tv].call([1])})),lv=!!uv&&uv.values&&uv[tv]===uv.values&&"values"===uv.values.name,fv=function(){return iv(av(this))};sv("entries",(function(){return ov(av(this))}),cv),sv("keys",(function(){return nv(av(this))}),cv),sv("values",fv,cv||!lv,{name:"values"}),sv(tv,fv,cv||!lv,{name:"values"});var hv=mi,pv=vc,dv=li,mv=xc,vv=ai,yv=u,gv=Sa.aTypedArray,xv=Sa.getTypedArrayConstructor,Tv=Sa.exportTypedArrayMethod,Ev=Math.max,_v=Math.min;Tv("toSpliced",(function(e,t){var r,i,n,o,a,s,u,c=gv(this),l=xv(c),f=hv(c),h=dv(e,f),p=arguments.length,d=0;if(0===p)r=i=0;else if(1===p)r=0,i=f-h;else if(i=_v(Ev(vv(t),0),f-h),r=p-2){o=new l(r),n=pv(o);for(var m=2;m<p;m++)a=arguments[m],o[m-2]=n?mv(a):+a}for(u=new l(s=f+r-i);d<h;d++)u[d]=c[d];for(;d<h+r;d++)u[d]=o[d-h];for(;d<s;d++)u[d]=c[d+i-r];return u}),!!yv((function(){var e=new Int8Array([1]),t=e.toSpliced(1,0,{valueOf:function(){return e[0]=2,3}});return 2!==t[0]||3!==t[1]})));var Sv={exports:{}},Av={},Rv=L,Cv=z,bv=ti.f,Ov=us,Lv="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Av.f=function(e){return Lv&&"Window"===Rv(e)?function(e){try{return bv(e)}catch(e){return Ov(Lv)}}(e):bv(Cv(e))};var Iv=u((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),wv=u,Pv=Z,Mv=L,Vv=Iv,Nv=Object.isExtensible,Fv=wv((function(){Nv(1)}))||Vv?function(e){return!!Pv(e)&&((!Vv||"ArrayBuffer"!==Mv(e))&&(!Nv||Nv(e)))}:Nv,Dv=!u((function(){return Object.isExtensible(Object.preventExtensions({}))})),Uv=nn,Bv=R,kv=gr,zv=Z,Gv=je,jv=wt.f,Xv=ti,Wv=Av,Hv=Fv,Yv=Dv,Zv=!1,qv=Ze("meta"),Kv=0,Qv=function(e){jv(e,qv,{value:{objectID:"O"+Kv++,weakData:{}}})},Jv=Sv.exports={enable:function(){Jv.enable=function(){},Zv=!0;var e=Xv.f,t=Bv([].splice),r={};r[qv]=1,e(r).length&&(Xv.f=function(r){for(var i=e(r),n=0,o=i.length;n<o;n++)if(i[n]===qv){t(i,n,1);break}return i},Uv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Wv.f}))},fastKey:function(e,t){if(!zv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Gv(e,qv)){if(!Hv(e))return"F";if(!t)return"E";Qv(e)}return e[qv].objectID},getWeakData:function(e,t){if(!Gv(e,qv)){if(!Hv(e))return!0;if(!t)return!1;Qv(e)}return e[qv].weakData},onFreeze:function(e){return Yv&&Zv&&Hv(e)&&!Gv(e,qv)&&Qv(e),e}};kv[qv]=!0;var $v=p,ey=Ft,ty=Re,ry=Pu,iy=p,ny=Ft,oy=ge,ay=dc,sy=mi,uy=J,cy=lc,ly=ic,fy=function(e,t,r){var i,n;ey(e);try{if(!(i=ty(e,"return"))){if("throw"===t)throw r;return r}i=$v(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return ey(i),r},hy=TypeError,py=function(e,t){this.stopped=e,this.result=t},dy=py.prototype,my=function(e,t,r){var i,n,o,a,s,u,c,l=r&&r.that,f=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),d=!(!r||!r.INTERRUPTED),m=ry(t,l),v=function(e){return i&&fy(i,"normal",e),new py(!0,e)},y=function(e){return f?(ny(e),d?m(e[0],e[1],v):m(e[0],e[1])):d?m(e,v):m(e)};if(h)i=e.iterator;else if(p)i=e;else{if(!(n=ly(e)))throw hy(oy(e)+" is not iterable");if(ay(n)){for(o=0,a=sy(e);a>o;o++)if((s=y(e[o]))&&uy(dy,s))return s;return new py(!1)}i=cy(e,n)}for(u=h?e.next:i.next;!(c=iy(u,i)).done;){try{s=y(c.value)}catch(e){fy(i,"throw",e)}if("object"==typeof s&&s&&uy(dy,s))return s}return new py(!1)},vy=nn,yy=a,gy=R,xy=qi,Ty=ei,Ey=Sv.exports,_y=my,Sy=Na,Ay=W,Ry=N,Cy=Z,by=u,Oy=vo,Ly=hs,Iy=tl,wy=In,Py=Po,My=Pa,Vy=Pu,Ny=Na,Fy=N,Dy=my,Uy=eh,By=th,ky=Qc,zy=c,Gy=Sv.exports.fastKey,jy=Pr.set,Xy=Pr.getterFor,Wy={getConstructor:function(e,t,r,i){var n=e((function(e,n){Ny(e,o),jy(e,{type:t,index:wy(null),first:void 0,last:void 0,size:0}),zy||(e.size=0),Fy(n)||Dy(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=Xy(t),s=function(e,t,r){var i,n,o=a(e),s=u(e,t);return s?s.value=r:(o.last=s={index:n=Gy(t,!0),key:t,value:r,previous:i=o.last,next:void 0,removed:!1},o.first||(o.first=s),i&&(i.next=s),zy?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},u=function(e,t){var r,i=a(e),n=Gy(t);if("F"!==n)return i.index[n];for(r=i.first;r;r=r.next)if(r.key===t)return r};return My(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,zy?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),i=u(t,e);if(i){var n=i.next,o=i.previous;delete r.index[i.index],i.removed=!0,o&&(o.next=n),n&&(n.previous=o),r.first===i&&(r.first=n),r.last===i&&(r.last=o),zy?r.size--:t.size--}return!!i},forEach:function(e){for(var t,r=a(this),i=Vy(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(i(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),My(o,r?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),zy&&Py(o,"size",{configurable:!0,get:function(){return a(this).size}}),n},setStrong:function(e,t,r){var i=t+" Iterator",n=Xy(t),o=Xy(i);Uy(e,t,(function(e,t){jy(this,{type:i,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?By("keys"===t?r.key:"values"===t?r.value:[r.key,r.value],!1):(e.target=void 0,By(void 0,!0))}),r?"entries":"values",!r,!0),ky(t)}},Hy=function(e,t,r){var i=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=i?"set":"add",a=yy[e],s=a&&a.prototype,u=a,c={},l=function(e){var t=gy(s[e]);Ty(s,e,"add"===e?function(e){return t(this,0===e?0:e),this}:"delete"===e?function(e){return!(n&&!Cy(e))&&t(this,0===e?0:e)}:"get"===e?function(e){return n&&!Cy(e)?void 0:t(this,0===e?0:e)}:"has"===e?function(e){return!(n&&!Cy(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(xy(e,!Ay(a)||!(n||s.forEach&&!by((function(){(new a).entries().next()})))))u=r.getConstructor(t,e,i,o),Ey.enable();else if(xy(e,!0)){var f=new u,h=f[o](n?{}:-0,1)!==f,p=by((function(){f.has(1)})),d=Oy((function(e){new a(e)})),m=!n&&by((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));d||((u=t((function(e,t){Sy(e,s);var r=Iy(new a,e,u);return Ry(t)||_y(t,r[o],{that:r,AS_ENTRIES:i}),r}))).prototype=s,s.constructor=u),(p||m)&&(l("delete"),l("has"),i&&l("get")),(m||h)&&l(o),n&&s.clear&&delete s.clear}return c[e]=u,vy({global:!0,constructor:!0,forced:u!==a},c),Ly(u,e),n||r.setStrong(u,e,i),u};Hy("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Wy);var Yy,Zy,qy,Ky,Qy="process"===L(a.process),Jy=TypeError,$y=/(?:ipad|iphone|ipod).*applewebkit/i.test($),eg=a,tg=Rp,rg=Pu,ig=W,ng=je,og=u,ag=vn,sg=gd,ug=xt,cg=function(e,t){if(e<t)throw Jy("Not enough arguments");return e},lg=$y,fg=Qy,hg=eg.setImmediate,pg=eg.clearImmediate,dg=eg.process,mg=eg.Dispatch,vg=eg.Function,yg=eg.MessageChannel,gg=eg.String,xg=0,Tg={},Eg="onreadystatechange";og((function(){Yy=eg.location}));var _g=function(e){if(ng(Tg,e)){var t=Tg[e];delete Tg[e],t()}},Sg=function(e){return function(){_g(e)}},Ag=function(e){_g(e.data)},Rg=function(e){eg.postMessage(gg(e),Yy.protocol+"//"+Yy.host)};hg&&pg||(hg=function(e){cg(arguments.length,1);var t=ig(e)?e:vg(e),r=sg(arguments,1);return Tg[++xg]=function(){tg(t,void 0,r)},Zy(xg),xg},pg=function(e){delete Tg[e]},fg?Zy=function(e){dg.nextTick(Sg(e))}:mg&&mg.now?Zy=function(e){mg.now(Sg(e))}:yg&&!lg?(Ky=(qy=new yg).port2,qy.port1.onmessage=Ag,Zy=rg(Ky.postMessage,Ky)):eg.addEventListener&&ig(eg.postMessage)&&!eg.importScripts&&Yy&&"file:"!==Yy.protocol&&!og(Rg)?(Zy=Rg,eg.addEventListener("message",Ag,!1)):Zy=Eg in ug("script")?function(e){ag.appendChild(ug("script"))[Eg]=function(){ag.removeChild(this),_g(e)}}:function(e){setTimeout(Sg(e),0)});var Cg={set:hg,clear:pg},bg=function(){this.head=null,this.tail=null};bg.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var Og,Lg,Ig,wg,Pg,Mg=bg,Vg=/ipad|iphone|ipod/i.test($)&&"undefined"!=typeof Pebble,Ng=/web0s(?!.*chrome)/i.test($),Fg=a,Dg=Pu,Ug=s.f,Bg=Cg.set,kg=Mg,zg=$y,Gg=Vg,jg=Ng,Xg=Qy,Wg=Fg.MutationObserver||Fg.WebKitMutationObserver,Hg=Fg.document,Yg=Fg.process,Zg=Fg.Promise,qg=Ug(Fg,"queueMicrotask"),Kg=qg&&qg.value;if(!Kg){var Qg=new kg,Jg=function(){var e,t;for(Xg&&(e=Yg.domain)&&e.exit();t=Qg.get();)try{t()}catch(e){throw Qg.head&&Og(),e}e&&e.enter()};zg||Xg||jg||!Wg||!Hg?!Gg&&Zg&&Zg.resolve?((wg=Zg.resolve(void 0)).constructor=Zg,Pg=Dg(wg.then,wg),Og=function(){Pg(Jg)}):Xg?Og=function(){Yg.nextTick(Jg)}:(Bg=Dg(Bg,Fg),Og=function(){Bg(Jg)}):(Lg=!0,Ig=Hg.createTextNode(""),new Wg(Jg).observe(Ig,{characterData:!0}),Og=function(){Ig.data=Lg=!Lg}),Kg=function(e){Qg.head||Og(),Qg.add(e)}}var $g=Kg,ex=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},tx=a.Promise,rx="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,ix=!rx&&!Qy&&"object"==typeof window&&"object"==typeof document,nx=a,ox=tx,ax=W,sx=qi,ux=lr,cx=nt,lx=ix,fx=rx,hx=ae;ox&&ox.prototype;var px=cx("species"),dx=!1,mx=ax(nx.PromiseRejectionEvent),vx=sx("Promise",(function(){var e=ux(ox),t=e!==String(ox);if(!t&&66===hx)return!0;if(!hx||hx<51||!/native code/.test(e)){var r=new ox((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[px]=i,!(dx=r.then((function(){}))instanceof i))return!0}return!t&&(lx||fx)&&!mx})),yx={CONSTRUCTOR:vx,REJECTION_EVENT:mx,SUBCLASSING:dx},gx={},xx=_e,Tx=TypeError,Ex=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw Tx("Bad Promise constructor");t=e,r=i})),this.resolve=xx(t),this.reject=xx(r)};gx.f=function(e){return new Ex(e)};var _x,Sx,Ax,Rx=nn,Cx=Qy,bx=a,Ox=p,Lx=ei,Ix=zo,wx=hs,Px=Qc,Mx=_e,Vx=W,Nx=Z,Fx=Na,Dx=zh,Ux=Cg.set,Bx=$g,kx=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},zx=ex,Gx=Mg,jx=Pr,Xx=tx,Wx=gx,Hx="Promise",Yx=yx.CONSTRUCTOR,Zx=yx.REJECTION_EVENT,qx=yx.SUBCLASSING,Kx=jx.getterFor(Hx),Qx=jx.set,Jx=Xx&&Xx.prototype,$x=Xx,eT=Jx,tT=bx.TypeError,rT=bx.document,iT=bx.process,nT=Wx.f,oT=nT,aT=!!(rT&&rT.createEvent&&bx.dispatchEvent),sT="unhandledrejection",uT=function(e){var t;return!(!Nx(e)||!Vx(t=e.then))&&t},cT=function(e,t){var r,i,n,o=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(a||(2===t.rejection&&dT(t),t.rejection=1),!0===s?r=o:(l&&l.enter(),r=s(o),l&&(l.exit(),n=!0)),r===e.promise?c(tT("Promise-chain cycle")):(i=uT(r))?Ox(i,r,u,c):u(r)):c(o)}catch(e){l&&!n&&l.exit(),c(e)}},lT=function(e,t){e.notified||(e.notified=!0,Bx((function(){for(var r,i=e.reactions;r=i.get();)cT(r,e);e.notified=!1,t&&!e.rejection&&hT(e)})))},fT=function(e,t,r){var i,n;aT?((i=rT.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),bx.dispatchEvent(i)):i={promise:t,reason:r},!Zx&&(n=bx["on"+e])?n(i):e===sT&&kx("Unhandled promise rejection",r)},hT=function(e){Ox(Ux,bx,(function(){var t,r=e.facade,i=e.value;if(pT(e)&&(t=zx((function(){Cx?iT.emit("unhandledRejection",i,r):fT(sT,r,i)})),e.rejection=Cx||pT(e)?2:1,t.error))throw t.value}))},pT=function(e){return 1!==e.rejection&&!e.parent},dT=function(e){Ox(Ux,bx,(function(){var t=e.facade;Cx?iT.emit("rejectionHandled",t):fT("rejectionhandled",t,e.value)}))},mT=function(e,t,r){return function(i){e(t,i,r)}},vT=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,lT(e,!0))},yT=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw tT("Promise can't be resolved itself");var i=uT(t);i?Bx((function(){var r={done:!1};try{Ox(i,t,mT(yT,r,e),mT(vT,r,e))}catch(t){vT(r,t,e)}})):(e.value=t,e.state=1,lT(e,!1))}catch(t){vT({done:!1},t,e)}}};if(Yx&&(eT=($x=function(e){Fx(this,eT),Mx(e),Ox(_x,this);var t=Kx(this);try{e(mT(yT,t),mT(vT,t))}catch(e){vT(t,e)}}).prototype,(_x=function(e){Qx(this,{type:Hx,done:!1,notified:!1,parent:!1,reactions:new Gx,rejection:!1,state:0,value:void 0})}).prototype=Lx(eT,"then",(function(e,t){var r=Kx(this),i=nT(Dx(this,$x));return r.parent=!0,i.ok=!Vx(e)||e,i.fail=Vx(t)&&t,i.domain=Cx?iT.domain:void 0,0===r.state?r.reactions.add(i):Bx((function(){cT(i,r)})),i.promise})),Sx=function(){var e=new _x,t=Kx(e);this.promise=e,this.resolve=mT(yT,t),this.reject=mT(vT,t)},Wx.f=nT=function(e){return e===$x||undefined===e?new Sx(e):oT(e)},Vx(Xx)&&Jx!==Object.prototype)){Ax=Jx.then,qx||Lx(Jx,"then",(function(e,t){var r=this;return new $x((function(e,t){Ox(Ax,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete Jx.constructor}catch(e){}Ix&&Ix(Jx,eT)}Rx({global:!0,constructor:!0,wrap:!0,forced:Yx},{Promise:$x}),wx($x,Hx,!1),Px(Hx);var gT=tx,xT=yx.CONSTRUCTOR||!vo((function(e){gT.all(e).then(void 0,(function(){}))})),TT=p,ET=_e,_T=gx,ST=ex,AT=my;nn({target:"Promise",stat:!0,forced:xT},{all:function(e){var t=this,r=_T.f(t),i=r.resolve,n=r.reject,o=ST((function(){var r=ET(t.resolve),o=[],a=0,s=1;AT(e,(function(e){var u=a++,c=!1;s++,TT(r,t,e).then((function(e){c||(c=!0,o[u]=e,--s||i(o))}),n)})),--s||i(o)}));return o.error&&n(o.value),r.promise}});var RT=nn,CT=yx.CONSTRUCTOR,bT=tx,OT=Q,LT=W,IT=ei,wT=bT&&bT.prototype;if(RT({target:"Promise",proto:!0,forced:CT,real:!0},{catch:function(e){return this.then(void 0,e)}}),LT(bT)){var PT=OT("Promise").prototype.catch;wT.catch!==PT&&IT(wT,"catch",PT,{unsafe:!0})}var MT=p,VT=_e,NT=gx,FT=ex,DT=my;nn({target:"Promise",stat:!0,forced:xT},{race:function(e){var t=this,r=NT.f(t),i=r.reject,n=FT((function(){var n=VT(t.resolve);DT(e,(function(e){MT(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var UT=p,BT=gx;nn({target:"Promise",stat:!0,forced:yx.CONSTRUCTOR},{reject:function(e){var t=BT.f(this);return UT(t.reject,void 0,e),t.promise}});var kT=Ft,zT=Z,GT=gx,jT=nn,XT=yx.CONSTRUCTOR,WT=function(e,t){if(kT(e),zT(t)&&t.constructor===e)return t;var r=GT.f(e);return(0,r.resolve)(t),r.promise};Q("Promise"),jT({target:"Promise",stat:!0,forced:XT},{resolve:function(e){return WT(this,e)}});var HT,YT,ZT=a,qT=Fe,KT=W,QT=qn,JT=ei,$T="USE_FUNCTION_CONSTRUCTOR",eE=nt("asyncIterator"),tE=ZT.AsyncIterator,rE=qT.AsyncIteratorPrototype;if(rE)HT=rE;else if(KT(tE))HT=tE.prototype;else if(qT[$T]||ZT[$T])try{YT=QT(QT(QT(Function("return async function*(){}()")()))),QT(YT)===Object.prototype&&(HT=YT)}catch(e){}HT||(HT={}),KT(HT[eE])||JT(HT,eE,(function(){return this}));var iE=p,nE=Ft,oE=In,aE=Re,sE=Pa,uE=Pr,cE=HT,lE=th,fE=Q("Promise"),hE="AsyncFromSyncIterator",pE=uE.set,dE=uE.getterFor(hE),mE=function(e,t,r){var i=e.done;fE.resolve(e.value).then((function(e){t(lE(e,i))}),r)},vE=function(e){e.type=hE,pE(this,e)};vE.prototype=sE(oE(cE),{next:function(){var e=dE(this);return new fE((function(t,r){var i=nE(iE(e.next,e.iterator));mE(i,t,r)}))},return:function(){var e=dE(this).iterator;return new fE((function(t,r){var i=aE(e,"return");if(void 0===i)return t(lE(void 0,!0));var n=nE(iE(i,e));mE(n,t,r)}))}});var yE=vE,gE=function(e){return{iterator:e,next:e.next,done:!1}},xE=p,TE=yE,EE=Ft,_E=lc,SE=gE,AE=Re,RE=nt("asyncIterator"),CE=a,bE=TypeError,OE=p,LE=Q,IE=Re,wE=p,PE=_e,ME=Ft,VE=Z,NE=function(e){if(e>9007199254740991)throw bE("Maximum allowed index exceeded");return e},FE=Q,DE=gE,UE=function(e,t,r,i){try{var n=IE(e,"return");if(n)return LE("Promise").resolve(OE(n,e)).then((function(){t(r)}),(function(e){i(e)}))}catch(e){return i(e)}t(r)},BE=function(e){var t=0===e,r=1===e,i=2===e,n=3===e;return function(e,o,a){ME(e);var s=void 0!==o;!s&&t||PE(o);var u=DE(e),c=FE("Promise"),l=u.iterator,f=u.next,h=0;return new c((function(e,u){var p=function(e){UE(l,u,e,u)},d=function(){try{if(s)try{NE(h)}catch(e){p(e)}c.resolve(ME(wE(f,l))).then((function(f){try{if(ME(f).done)t?(a.length=h,e(a)):e(!n&&(i||void 0));else{var m=f.value;try{if(s){var v=o(m,h),y=function(o){if(r)d();else if(i)o?d():UE(l,e,!1,u);else if(t)try{a[h++]=o,d()}catch(e){p(e)}else o?UE(l,e,n||m,u):d()};VE(v)?c.resolve(v).then(y,p):y(v)}else a[h++]=m,d()}catch(e){p(e)}}}catch(e){u(e)}}),u)}catch(e){u(e)}};d()}))}},kE={toArray:BE(0),forEach:BE(1),every:BE(2),some:BE(3),find:BE(4)},zE=Pu,GE=R,jE=ke,XE=Hu,WE=function(e,t){var r=arguments.length<2?AE(e,RE):t;return r?EE(xE(r,e)):new TE(SE(_E(e)))},HE=lc,YE=gE,ZE=ic,qE=Re,KE=function(e){return CE[e].prototype},QE=Q,JE=yE,$E=kE.toArray,e_=nt("asyncIterator"),t_=GE(KE("Array").values),r_=GE(t_([]).next),i_=function(){return new n_(this)},n_=function(e){this.iterator=t_(e)};n_.prototype.next=function(){return r_(this.iterator)};var o_=Q,a_=Ku,s_=function(e){var t=this,r=arguments.length,i=r>1?arguments[1]:void 0,n=r>2?arguments[2]:void 0;return new(QE("Promise"))((function(r){var o=jE(e);void 0!==i&&(i=zE(i,n));var a=qE(o,e_),s=a?void 0:ZE(o)||i_,u=XE(t)?new t:[],c=a?WE(o,a):new JE(YE(HE(o,s)));r($E(c,i,u))}))},u_=Fh,c_=Sa.aTypedArrayConstructor;(0,Sa.exportTypedArrayStaticMethod)("fromAsync",(function(e){var t=this,r=arguments.length,i=r>1?arguments[1]:void 0,n=r>2?arguments[2]:void 0;return new(o_("Promise"))((function(r){a_(t),r(s_(e,i,n))})).then((function(e){return u_(c_(t),e)}))}),!0);var l_=Hc.filterReject,f_=Zh,h_=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("filterOut",(function(e){var t=l_(h_(this),e,arguments.length>1?arguments[1]:void 0);return f_(this,t)}),!0);var p_=Hc.filterReject,d_=Zh,m_=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("filterReject",(function(e){var t=p_(m_(this),e,arguments.length>1?arguments[1]:void 0);return d_(this,t)}),!0);var v_=Pu,y_=V,g_=ke,x_=mt,T_=mi,E_=In,__=Fh,S_=Array,A_=R([].push),R_=function(e,t,r,i){for(var n,o,a,s=g_(e),u=y_(s),c=v_(t,r),l=E_(null),f=T_(u),h=0;f>h;h++)a=u[h],(o=x_(c(a,h,s)))in l?A_(l[o],a):l[o]=[a];if(i&&(n=i(s))!==S_)for(o in l)l[o]=__(n,l[o]);return l},C_=Wh,b_=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("groupBy",(function(e){var t=arguments.length>1?arguments[1]:void 0;return R_(b_(this),e,t,C_)}),!0);var O_=R,L_=Map.prototype,I_={Map:Map,set:O_(L_.set),get:O_(L_.get),has:O_(L_.has),remove:O_(L_.delete),proto:L_},w_=p,P_=R,M_=function(e,t,r){for(var i,n,o=r?e:e.iterator,a=e.next;!(i=w_(a,o)).done;)if(void 0!==(n=t(i.value)))return n},V_=I_.Map,N_=I_.proto,F_=P_(N_.forEach),D_=P_(N_.entries),U_=D_(new V_).next,B_=_e,k_=N,z_=mi,G_=ke,j_=function(e,t,r){return r?M_({iterator:D_(e),next:U_},(function(e){return t(e[1],e[0])})):F_(e,t)},X_=I_.Map,W_=I_.has,H_=I_.set,Y_=R([].push),Z_=Fh,q_=function(e){var t,r,i,n=G_(this),o=z_(n),a=[],s=new X_,u=k_(e)?function(e){return e}:B_(e);for(t=0;t<o;t++)i=u(r=n[t]),W_(s,i)||H_(s,i,r);return j_(s,(function(e){Y_(a,e)})),a},K_=Sa.aTypedArray,Q_=Sa.getTypedArrayConstructor,J_=Sa.exportTypedArrayMethod,$_=R(q_);J_("uniqueBy",(function(e){return K_(this),Z_(Q_(this),$_(this,e))}),!0);var eS=function(e,t){return eS=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},eS(e,t)};function tS(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}eS(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var rS=function(){return rS=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},rS.apply(this,arguments)};function iS(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){e.done?n(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}u((i=i.apply(e,t||[])).next())}))}function nS(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function oS(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function aS(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function sS(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var uS=6,cS="tree",lS="PRE_COLOR_0",fS="PRE_COLOR_SIZE_0",hS="PRE_MAIN_COLOR_0",pS="PRE_MAIN_COLOR_SIZE_0",dS="editor",mS="none",vS=.017453292519943295,yS={"Filter not imported":"https://yuque.antfin.com/huoxing/knaszl/qtnsf2g9ofigggor#n4Y1K","Item duration can't be less than 0":"https://yuque.antfin.com/huoxing/knaszl/wozlz0#vFPqF"};var gS=[],xS={};function TS(){"function"==typeof WebGL2RenderingContext?ES(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(ES(WebGLRenderingContext),ES(WebGLRenderingContext.prototype)):gS.push("iOS16 lockdown mode, WebGL Constants not in global"),gS.length||"HALF_FLOAT"in xS||(xS.HALF_FLOAT=5131)}function ES(e){for(var t in e)/^[A-Z_]/.test(t)&&(xS[t]=e[t])}gS.length||TS();var _S,SS,AS,RS,CS,bS,OS,LS,IS,wS,PS,MS,VS={},NS={};function FS(e,t,r){e in VS&&console.error("Filter ".concat(e," registered twice.")),VS[e]=t,NS[e]=r}function DS(e){Object.keys(e).forEach((function(t){var r=aS(e[t],2);FS(t,r[0],r[1])}))}function US(e){var t=NS[e.name];if(!t)throw Error("Filter ".concat(e.name," not imported, see ").concat(yS["Filter not imported"]));return t(e)}function BS(e,t){var r=VS[e.name];if(!r)throw Error("Filter ".concat(e.name," not imported, see ").concat(yS["Filter not imported"]));var i=r(e,t);return i.passSplitOptions||(i.passSplitOptions={attachments:[{texture:{format:xS.RGBA}}]}),i}function kS(e,t){return e.includes(t)||e.push(t),e}function zS(e,t){var r=e.indexOf(t);return r>-1&&e.splice(r,1),e}function GS(e,t,r,i){if(void 0===i&&(i=!1),!e.includes(t)&&(e.push(t),1!==e.length)){var n=e.length-1;if(n){var o=e[n];if(i)for(;e[n-1][r]<o[r]&&(e[n]=e[n-1],0!=--n););else for(;e[n-1][r]>o[r]&&(e[n]=e[n-1],0!=--n););e[n]=o}}}function jS(e,t,r,i){if(void 0===r&&(r=1),e.buffer.byteLength<e.BYTES_PER_ELEMENT*t){var n=Math.ceil(t*r);isNaN(i)||(n=Math.min(n,i));var o=new ArrayBuffer(e.BYTES_PER_ELEMENT*n),a=new e.constructor(o);return a.set(e),a}return e}function XS(e,t){var r=[0,0,0,0];if(lC(e)){e=e.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(e);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(e)?r=[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else e instanceof Array&&(r=[e[0],e[1],e[2],isNaN(e[3])?255:e[3]]);if(t)for(var o=0;o<4;o++)r[o]/=255;return r}function WS(e,t,r){if(e.length){for(var i=void 0,n=1;n<=e.length-1;n++){var o=e[n-1],a=e[n];if(o.stop<=t&&t<=a.stop){i=YS(o.color,a.color,(t-o.stop)/(a.stop-o.stop));break}}return i||(i=e[e.length-1].color),r?i.map((function(e){return e/255})):i}return[0,0,0,0]}function HS(e){var t=[];if(e instanceof Array?e.forEach((function(e){var r=aS(e,5),i=r[0],n=r[1],o=r[2],a=r[3],s=r[4];t.push({stop:ZS(i),color:[n,o,a,s]})})):Object.keys(e).forEach((function(r){var i=XS(e[r]);t.push({stop:ZS(r),color:i})})),(t=t.sort((function(e,t){return e.stop-t.stop}))).length){0!==t[0].stop&&t.unshift({stop:0,color:t[0].color.slice()});var r=t[t.length-1];1!==r.stop&&t.push({stop:1,color:r.color.slice()})}return t}function YS(e,t,r,i){var n=[],o=1-r;if(i)for(var a=0;a<4;a++)n[a]=e[a]*o+t[a]*r;else{for(a=0;a<3;a++)n[a]=Math.round(Math.sqrt(e[a]*e[a]*o+t[a]*t[a]*r));n[3]=Math.round(e[3]*o+t[3]*r)}return n}function ZS(e){var t=/^(-)?([\d+.]+)%$/.exec(e);return t?+t[2]/100*(t[1]?-1:1):+e}function qS(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function KS(){return qS()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function QS(e){var t=128,r={width:t,height:1,data:new Uint8Array(512)},i=r.data,n=HS(e);if(n.length){i.set(n[0].color,0);for(var o=1;o<127;o++){for(var a=o/t,s=void 0,u=void 0,c=0;c<n.length&&(s=n[c],u=n[c+1],!(s.stop<=a&&u.stop>a));c++);var l=YS(s.color,u.color,(a-s.stop)/(u.stop-s.stop));i.set(l,4*o)}i.set(n[n.length-1].color,508)}return r}function JS(t,r){void 0===r&&(r=e.OrderType.ascending);var i=t.length;if(i<=1||r===e.OrderType.none)return t;if(i<=30){for(var n=1;n<i;n++)eA(t,n,r);return t}return tA(t,r)}function $S(t,r,i){return void 0===i&&(i=e.OrderType.ascending),t.includes(r)?t:(t.push(r),1===t.length||i!==e.OrderType.none&&eA(t,t.length-1,i),t)}function eA(t,r,i){var n=t[r];if(i!==e.OrderType.ascending)for(;r>=1&&t[r-1].priority<n.priority&&(t[r]=t[r-1],0!=--r););else for(;r>=1&&t[r-1].priority>n.priority&&(t[r]=t[r-1],0!=--r););t[r]=n}function tA(t,r,i,n){var o,a;if(void 0===i&&(i=0),void 0===n&&(n=t.length-1),i>=n)return t;for(var s=t[i],u=i,c=n;u<c;){if(r===e.OrderType.ascending){for(;t[c].priority>s.priority&&c>=u;)c--;for(;t[u].priority<=s.priority&&u<c;)u++}else{for(;t[c].priority<s.priority&&c>=u;)c--;for(;t[u].priority>=s.priority&&u<c;)u++}o=aS([t[c],t[u]],2),t[u]=o[0],t[c]=o[1]}return a=aS([t[u],t[i]],2),t[i]=a[0],t[u]=a[1],tA(t,r,i,u-1),tA(t,r,c+1,n),t}function rA(e,t){if(void 0===t&&(t="item doesn't exist"),null==e)throw new Error(t)}e.OrderType=void 0,(_S=e.OrderType||(e.OrderType={}))[_S.none=1]="none",_S[_S.ascending=2]="ascending",_S[_S.descending=3]="descending",function(e){e.S="S",e.APlus="A+",e.A="A",e.BPlus="B+",e.B="B"}(SS||(SS={})),function(e){e[e.ALPHA=0]="ALPHA",e[e.ADD=1]="ADD",e[e.MULTIPLY=2]="MULTIPLY",e[e.BRIGHTNESS=3]="BRIGHTNESS",e[e.SUBTRACTION=4]="SUBTRACTION",e[e.STRONG_LIGHT=5]="STRONG_LIGHT",e[e.WEAK_LIGHT=6]="WEAK_LIGHT",e[e.SUPERPOSITION=7]="SUPERPOSITION"}(AS||(AS={})),function(e){e[e.DOUBLE=1032]="DOUBLE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK"}(RS||(RS={})),function(e){e[e.NONE=0]="NONE",e[e.MASK=1]="MASK",e[e.OBSCURED=2]="OBSCURED",e[e.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(CS||(CS={})),function(e){e[e.NONE=0]="NONE",e[e.SPHERE=1]="SPHERE",e[e.CONE=2]="CONE",e[e.HEMISPHERE=3]="HEMISPHERE",e[e.CIRCLE=4]="CIRCLE",e[e.DONUT=5]="DONUT",e[e.RECTANGLE=6]="RECTANGLE",e[e.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",e[e.EDGE=8]="EDGE",e[e.TEXTURE=9]="TEXTURE"}(bS||(bS={})),function(e){e[e.GYROSCOPE=0]="GYROSCOPE",e[e.SPINE=1]="SPINE"}(OS||(OS={})),function(e){e[e.CLICK=0]="CLICK",e[e.MESSAGE=1]="MESSAGE",e[e.DRAG=2]="DRAG"}(LS||(LS={})),function(e){e[e.NONE=0]="NONE",e[e.NOTIFY=1]="NOTIFY",e[e.RESUME_PLAYER=2]="RESUME_PLAYER",e[e.REMOVE=3]="REMOVE",e[e.PAUSE=4]="PAUSE"}(IS||(IS={})),function(e){e.base="0",e.sprite="1",e.particle="2",e.null="3",e.interact="4",e.plugin="5",e.camera="6",e.composition="7",e.filter="8",e.spine="spine",e.mesh="mesh",e.tree="tree",e.text="text",e.light="light",e.skybox="skybox"}(wS||(wS={})),function(e){e[e.BILLBOARD=0]="BILLBOARD",e[e.MESH=1]="MESH",e[e.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",e[e.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(PS||(PS={})),function(e){e[e.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",e[e.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",e[e.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",e[e.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",e[e.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",e[e.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",e[e.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",e[e.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",e[e.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(MS||(MS={}));var iA,nA,oA,aA,sA,uA,cA,lA;!function(e){e[e.portrait=1]="portrait",e[e.landscape=0]="landscape"}(iA||(iA={})),function(e){e[e.destroy=0]="destroy",e[e.pause=1]="pause",e[e.restart=5]="restart",e[e.forward=2]="forward",e[e.pause_destroy=3]="pause_destroy"}(nA||(nA={})),function(e){e[e.CONSTANT=0]="CONSTANT",e[e.CONSTANT_VEC2=1]="CONSTANT_VEC2",e[e.CONSTANT_VEC3=2]="CONSTANT_VEC3",e[e.CONSTANT_VEC4=3]="CONSTANT_VEC4",e[e.RANDOM=4]="RANDOM",e[e.LINE=5]="LINE",e[e.CURVE=6]="CURVE",e[e.BEZIER_PATH=7]="BEZIER_PATH",e[e.RGBA_COLOR=8]="RGBA_COLOR",e[e.GRADIENT_COLOR=9]="GRADIENT_COLOR",e[e.SHAPE_POINTS=10]="SHAPE_POINTS",e[e.SHAPE_SPLITS=11]="SHAPE_SPLITS",e[e.LINEAR_PATH=12]="LINEAR_PATH",e[e.COLORS=13]="COLORS",e[e.BINARY=20]="BINARY",e[e.BEZIER_CURVE=21]="BEZIER_CURVE",e[e.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH"}(oA||(oA={})),function(e){e[e.AUTO=0]="AUTO",e[e.EASE=1]="EASE",e[e.EASE_IN=2]="EASE_IN",e[e.EASE_OUT=3]="EASE_OUT",e[e.LINE=4]="LINE",e[e.HOLD=5]="HOLD",e[e.LINE_OUT=6]="LINE_OUT"}(aA||(aA={})),function(e){e[e.destroy=0]="destroy",e[e.loop=5]="loop",e[e.forward=4]="forward"}(sA||(sA={})),function(e){e[e.destroyChildren=6]="destroyChildren"}(uA||(uA={})),function(e){e[e.none=0]="none",e[e.removeParticle=1]="removeParticle"}(cA||(cA={})),function(e){e[e.RANDOM=0]="RANDOM",e[e.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",e[e.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",e[e.UNIFORM_BURST=3]="UNIFORM_BURST"}(lA||(lA={}));var fA,hA,pA,dA,mA,vA,yA,gA,xA;!function(e){e[e.box=2]="box",e[e.sphere=3]="sphere"}(fA||(fA={})),function(e){e.unlit="unlit",e.pbr="pbr",e.hair="hair"}(hA||(hA={})),function(e){e[e.opaque=100]="opaque",e[e.masked=101]="masked",e[e.translucent=102]="translucent",e[e.additive=103]="additive"}(pA||(pA={})),function(e){e.none="none",e.uv="uv",e.normal="normal",e.basecolor="basecolor",e.alpha="alpha",e.metallic="metallic",e.roughness="roughness",e.ao="ao",e.emissive="emissive"}(dA||(dA={})),function(e){e[e.display=0]="display",e[e.clip=1]="clip",e[e.ellipsis=2]="ellipsis"}(mA||(mA={})),function(e){e[e.top=0]="top",e[e.middle=1]="middle",e[e.bottom=2]="bottom"}(vA||(vA={})),function(e){e[e.left=0]="left",e[e.middle=1]="middle",e[e.right=2]="right"}(yA||(yA={})),function(e){e.normal="normal",e.bold="bold",e.lighter="lighter"}(gA||(gA={})),function(e){e.normal="normal",e.italic="italic",e.oblique="oblique"}(xA||(xA={}));var TA,EA=Object.freeze({__proto__:null,get BezierKeyframeType(){return aA},get BlendingMode(){return AS},BloomFilterThresholdAvgColor:0,CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return iA},get CompositionEndBehavior(){return nA},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_DESTROY_CHILDREN:6,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_RESTART:5,get FontStyle(){return xA},get InteractBehavior(){return IS},get InteractType(){return LS},get ItemEndBehavior(){return sA},get ItemType(){return wS},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return CS},get MaterialBlending(){return pA},get MaterialType(){return hA},get ModelBoundingType(){return fA},get ParentItemEndBehavior(){return uA},get ParticleInteractionBehavior(){return cA},get ParticleOrigin(){return MS},get PluginType(){return OS},get RenderLevel(){return SS},get RenderMode(){return PS},get RenderMode3D(){return dA},get ShapeArcMode(){return lA},get ShapeType(){return bS},get SideMode(){return RS},get TextAlignment(){return yA},get TextBaseline(){return vA},get TextOverflow(){return mA},get TextWeight(){return gA},get ValueType(){return oA}}),_A=((TA={})[MS.PARTICLE_ORIGIN_CENTER]=[0,0],TA[MS.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],TA[MS.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],TA[MS.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],TA[MS.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],TA[MS.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],TA[MS.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],TA[MS.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],TA[MS.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],TA);function SA(e,t,r){return e>r?r:e<t?t:e}function AA(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function RA(e,t){return e?[e[0]-.5,.5-e[1]]:t?_A[t]:[0,0]}var CA,bA,OA=(CA=new Float32Array(1),bA=new Int32Array(CA.buffer),function(e){CA[0]=e;var t=bA[0],r=t>>16&32768,i=t>>12&2047,n=t>>23&255;return n<103?r:n>142?(r|=31744,r|=(255==n?0:1)&&8388607&t):n<113?r|=((i|=2048)>>114-n)+(i>>113-n&1):(r|=n-112<<10|i>>1,r+=1&i)}),LA=function(){function e(e){if(Number.isInteger(e))this.data=new Uint16Array(e);else if(e&&"object"==typeof e&&Number.isInteger(e.length))for(var t=this.data=new Uint16Array(e.length),r=0;r<t.length;r++)t[r]=OA(e[r])}return e.prototype.set=function(e,t){for(var r=0;r<e.length;r++)this.data[r+t]=OA(e[r])},e}(),IA=Math.PI/180;function wA(e,t){var r=aS(t,4),i=r[0],n=r[1],o=r[2],a=r[3],s=i+i,u=n+n,c=o+o,l=i*s,f=n*s,h=n*u,p=o*s,d=o*u,m=o*c,v=a*s,y=a*u,g=a*c;return e[0]=1-h-m,e[3]=f-g,e[6]=p+y,e[1]=f+g,e[4]=1-l-m,e[7]=d-v,e[2]=p-y,e[5]=d+v,e[8]=1-l-h,e}function PA(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function MA(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}function VA(e){return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}function NA(e,t,r,i,n){var o=n?-n[0]:0,a=n?-n[1]:0,s=n?-n[2]:0,u=t[0],c=t[1],l=t[2],f=t[3],h=u+u,p=c+c,d=l+l,m=u*h,v=u*p,y=u*d,g=c*p,x=c*d,T=l*d,E=f*h,_=f*p,S=f*d,A=i[0],R=i[1],C=i[2],b=(1-(g+T))*A,O=(v+S)*A,L=(y-_)*A,I=(v-S)*R,w=(1-(m+T))*R,P=(x+E)*R,M=(y+_)*C,V=(x-E)*C,N=(1-(m+g))*C;return e[0]=b,e[1]=O,e[2]=L,e[3]=0,e[4]=I,e[5]=w,e[6]=P,e[7]=0,e[8]=M,e[9]=V,e[10]=N,e[11]=0,e[12]=o*b+a*I+s*M-o+r[0],e[13]=o*O+a*w+s*V-a+r[1],e[14]=o*L+a*P+s*N-s+r[2],e[15]=1,e}function FA(e,t){if(VA(t))return XA(e,t);var r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=t[9],h=t[10],p=t[11],d=t[12],m=t[13],v=t[14],y=t[15],g=r*s-i*a,x=r*u-n*a,T=r*c-o*a,E=i*u-n*s,_=i*c-o*s,S=n*c-o*u,A=l*m-f*d,R=l*v-h*d,C=l*y-p*d,b=f*v-h*m,O=f*y-p*m,L=h*y-p*v,I=g*L-x*O+T*b+E*C-_*R+S*A;if(!I){for(var w=0;w<16;w++)e[w]=NaN;return e}return I=1/I,e[0]=(s*L-u*O+c*b)*I,e[1]=(n*O-i*L-o*b)*I,e[2]=(m*S-v*_+y*E)*I,e[3]=(h*_-f*S-p*E)*I,e[4]=(u*C-a*L-c*R)*I,e[5]=(r*L-n*C+o*R)*I,e[6]=(v*T-d*S-y*x)*I,e[7]=(l*S-h*T+p*x)*I,e[8]=(a*O-s*C+c*A)*I,e[9]=(i*C-r*O-o*A)*I,e[10]=(d*_-m*T+y*g)*I,e[11]=(f*T-l*_-p*g)*I,e[12]=(s*R-a*b-u*A)*I,e[13]=(r*b-i*R+n*A)*I,e[14]=(m*x-d*E-v*g)*I,e[15]=(l*E-f*x+h*g)*I,e}function DA(e,t,r){if(VA(t))return XA(e,r),e;if(VA(r))return XA(e,t),e;var i=t[0],n=t[1],o=t[2],a=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],h=t[9],p=t[10],d=t[11],m=t[12],v=t[13],y=t[14],g=t[15],x=r[0],T=r[1],E=r[2],_=r[3];return e[0]=x*i+T*s+E*f+_*m,e[1]=x*n+T*u+E*h+_*v,e[2]=x*o+T*c+E*p+_*y,e[3]=x*a+T*l+E*d+_*g,x=r[4],T=r[5],E=r[6],_=r[7],e[4]=x*i+T*s+E*f+_*m,e[5]=x*n+T*u+E*h+_*v,e[6]=x*o+T*c+E*p+_*y,e[7]=x*a+T*l+E*d+_*g,x=r[8],T=r[9],E=r[10],_=r[11],e[8]=x*i+T*s+E*f+_*m,e[9]=x*n+T*u+E*h+_*v,e[10]=x*o+T*c+E*p+_*y,e[11]=x*a+T*l+E*d+_*g,x=r[12],T=r[13],E=r[14],_=r[15],e[12]=x*i+T*s+E*f+_*m,e[13]=x*n+T*u+E*h+_*v,e[14]=x*o+T*c+E*p+_*y,e[15]=x*a+T*l+E*d+_*g,e}function UA(e,t,r,i,n,o){var a,s=1/Math.tan(t*IA/2);e[0]=o?s:s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o?s*r:s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(a=1/(i-n),e[10]=(n+i)*a,e[14]=2*n*i*a):(e[10]=-1,e[14]=-2*i)}var BA=new Float32Array(9),kA=[0,0,0,1];function zA(e){var t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],f=e[10],h=e[11],p=e[12],d=e[13],m=e[14],v=e[15];return(t*a-r*o)*(f*v-h*m)-(t*s-i*o)*(l*v-h*d)+(t*u-n*o)*(l*m-f*d)+(r*s-i*a)*(c*v-h*p)-(r*u-n*a)*(c*m-f*p)+(i*u-n*s)*(c*d-l*p)}function GA(e,t,r,i){var n=e[0],o=e[1],a=e[2],s=e[4],u=e[5],c=e[6],l=e[8],f=e[9],h=e[10];if(t[0]=e[12],t[1]=e[13],t[2]=e[14],r){var p=1/i[0],d=1/i[1],m=1/i[2];BA[0]=n*p,BA[1]=o*p,BA[2]=a*p,BA[3]=s*d,BA[4]=u*d,BA[5]=c*d,BA[6]=l*m,BA[7]=f*m,BA[8]=h*m;var v=BA[0]+BA[4]+BA[8],y=void 0;if(v>0)y=Math.sqrt(v+1),kA[3]=.5*y,y=.5/y,kA[0]=(BA[5]-BA[7])*y,kA[1]=(BA[6]-BA[2])*y,kA[2]=(BA[1]-BA[3])*y;else{var g=0;BA[4]>BA[0]&&(g=1),BA[8]>BA[3*g+g]&&(g=2);var x=(g+1)%3,T=(g+2)%3;y=Math.sqrt(BA[3*g+g]-BA[3*x+x]-BA[3*T+T]+1),kA[g]=.5*y,y=.5/y,kA[3]=(BA[3*x+T]-BA[3*T+x])*y,kA[x]=(BA[3*x+g]+BA[3*g+x])*y,kA[T]=(BA[3*T+g]+BA[3*g+T])*y}r[0]=kA[0],r[1]=kA[1],r[2]=kA[2],r[3]=kA[3]}}function jA(e,t,r,i){return i[0]=Math.hypot(e[0],e[1],e[2]),i[1]=Math.hypot(e[4],e[5],e[6]),i[2]=Math.hypot(e[8],e[9],e[10]),zA(e)<0&&(i[0]=-i[0]),GA(e,t,r,i)}function XA(e,t){for(var r=0;r<16;r++)e[r]=t[r];return e}var WA=Math.PI/180,HA=180/Math.PI,YA=Math.cos,ZA=Math.sin;function qA(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]+r[i];return e}function KA(e,t){for(var r=0,i=e.length;r<i;r++)e[r]=t;return e}var QA=Number.EPSILON||Math.pow(2,-32);function JA(e){for(var t=0,r=e.length;t<r;t++)if(Math.abs(e[t])>QA)return!1;return!0}function $A(e){return fC(e)?[e[0],e[1],e[2]]:[0,0,0]}function eR(e,t,r){var i=t[0],n=t[1],o=t[2];return e[0]=i*r[0]+n*r[3]+o*r[6],e[1]=i*r[1]+n*r[4]+o*r[7],e[2]=i*r[2]+n*r[5]+o*r[8],e}function tR(e,t,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)e[n]=t[n+i];return e}function rR(e,t,r){if(t&&r)for(var i=0,n=t.length;i<n;i++)e[i]=t[i]*r[i];else if(t){if(e!==t)for(i=0;i<t.length;i++)e[i]=t[i]}else if(r&&e!==r)for(i=0;i<r.length;i++)e[i]=r[i];return e}function iR(e,t){1===arguments.length&&(t=e,e=[]);var r=t,i=Math.hypot.apply(Math,sS([],aS(r),!1));if(0===i)return tR(e,r,r.length);for(var n=0;n<r.length;n++)e[n]=r[n]/i;return e}function nR(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]*r;return e}function oR(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]-r[i];return e}function aR(e,t){for(var r=0,i=0,n=e.length;i<n;i++){var o=e[i]-t[i];r+=o*o}return r}function sR(e,t,r){if(isNaN(r)){for(var i=0,n=0,o=t.length;n<o;n++)i+=e[n]*t[n];return i}for(n=0,o=t.length;n<o;n++)e[n]=t[n]*r;return e}function uR(e,t,r){var i=t[0],n=t[1],o=t[2],a=r[0],s=r[1],u=r[2];return e[0]=n*u-o*s,e[1]=o*a-i*u,e[2]=i*s-n*a,e}function cR(e,t,r){var i=t[0],n=t[1],o=t[2],a=r[3]*i+r[7]*n+r[11]*o+r[15];return a=a||1,e[0]=(r[0]*i+r[4]*n+r[8]*o+r[12])/a,e[1]=(r[1]*i+r[5]*n+r[9]*o+r[13])/a,e[2]=(r[2]*i+r[6]*n+r[10]*o+r[14])/a,e}function lR(e,t,r){var i=t[0],n=t[1],o=t[2],a=r[3]*i+r[7]*n+r[11]*o+r[15]||1;return e[0]=(r[0]*i+r[4]*n+r[8]*o)/a,e[1]=(r[1]*i+r[5]*n+r[9]*o)/a,e[2]=(r[2]*i+r[6]*n+r[10]*o)/a,e}var fR=[0,0,0,0,0,0,0,0,0];function hR(e,t){e||(e=fR);var r=ZA(t),i=YA(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function pR(e,t){return function(e,t,r,i){var n=YA(t*WA),o=YA(r*WA),a=YA(i*WA),s=ZA(t*WA),u=ZA(r*WA),c=ZA(i*WA);return e[0]=o*a,e[1]=o*c,e[2]=-u,e[3]=-n*c+s*u*a,e[4]=n*a+s*u*c,e[5]=s*o,e[6]=c*s+n*u*a,e[7]=-s*a+n*u*c,e[8]=n*o,e}(e,-t[0],-t[1],-t[2])}function dR(e,t){return function(e,t){var r=t,i=r[0],n=r[3];r[6];var o=r[1],a=r[4];r[7];var s=r[2],u=r[5],c=r[8];e[1]=Math.asin(SA(-s,-1,1))*HA,Math.abs(s)<.9999999?(e[0]=Math.atan2(u,c)*HA,e[2]=Math.atan2(o,i)*HA):(e[0]=0,e[2]=Math.atan2(-n,a)*HA)}(e,t),e}var mR=Math.PI/180,vR=Math.cos,yR=Math.sin;function gR(e,t,r){var i=t[0],n=t[1],o=t[2],a=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=i*l+a*s+n*c-o*u,e[1]=n*l+a*u+o*s-i*c,e[2]=o*l+a*c+i*u-n*s,e[3]=a*l-i*s-n*u-o*c,e}function xR(e,t,r,i){var n=vR(t*mR/2),o=vR(r*mR/2),a=vR(i*mR/2),s=yR(t*mR/2),u=yR(r*mR/2),c=yR(i*mR/2);e[0]=s*o*a-n*u*c,e[1]=n*u*a+s*o*c,e[2]=n*o*c-s*u*a,e[3]=n*o*a+s*u*c}function TR(e,t){var r=t[0],i=t[1],n=t[2],o=t[3];e[0]=-r,e[1]=-i,e[2]=-n,e[3]=o}var ER=[0,0,0];function _R(e,t,r){var i,n=null!==(i=r.position)&&void 0!==i?i:[0,0,0],o=[0,0,0];return cR(o,[e,t,0],r.getInverseViewProjectionMatrix()),oR(o,o,n),{center:n,direction:iR([],o)}}function SR(e,t,r,i,n){oR(ER,i,t);var o=sR(r,ER);if(o<0)return null;nR(ER,r,o),qA(ER,t,ER);var a=aR(i,ER),s=n*n;return a>s?null:(nR(e,r,o-Math.sqrt(s-a)),qA(e,e,t))}function AR(e,t,r,i,n){var o,a,s,u,c,l,f=aS(r,3),h=f[0],p=f[1],d=f[2],m=aS(t,3),v=m[0],y=m[1],g=m[2],x=i[0]-n[0]/2,T=i[0]+n[0]/2,E=i[1]-n[1]/2,_=i[1]+n[1]/2,S=i[2]-n[2]/2,A=i[2]+n[2]/2,R=1/h,C=1/p,b=1/d;return R>=0?(o=(x-v)*R,a=(T-v)*R):(o=(T-v)*R,a=(x-v)*R),C>=0?(s=(E-y)*C,u=(_-y)*C):(s=(_-y)*C,u=(E-y)*C),o>u||s>a?null:((s>o||o!=o)&&(o=s),(u<a||a!=a)&&(a=u),(s>o||o!=o)&&(o=s),(u<a||a!=a)&&(a=u),b>=0?(c=(S-g)*b,l=(A-g)*b):(c=(A-g)*b,l=(S-g)*b),o>l||c>a?null:((c>o||o!=o)&&(o=c),(l<a||a!=a)&&(a=l),a<0?null:(nR(e,t,o>=0?o:a),qA(e,e,t))))}var RR=[0,0,0],CR=[0,0,0],bR=[0,0,0],OR=[0,0,0];function LR(e,t,r){var i=aS(e,3),n=i[0],o=i[1],a=i[2],s=[n-t,o+r,a],u=[n+t,o-r,a],c=[n+t,o+r,a];return[[s,[n-t,o-r,a],u],[s.slice(),u.slice(),c]]}function IR(e,t,r,i,n){var o,a,s,u,c,l=r;if(oR(RR,i[1],i[0]),oR(CR,i[2],i[0]),oR(OR,t,i[0]),uR(bR,RR,CR),(a=sR(l,bR))>0){if(n)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}return uR(CR,OR,CR),s=sR(l=r,CR),(s*=o)<0?null:(uR(RR,RR,OR),u=sR(l=r,RR),(u*=o)<0||s+u>a?null:(c=sR(OR,bR),(c*=-o)<0?null:(nR(e,r,c/a),qA(e,e,t))))}var wR=[0,0],PR=[0,0],MR=[0,0];var VR,NR=[];function FR(e,t,r,i,n,o,a,s,u){var c=e,l=i/n,f=i,h=t.speedOverLifetime;h&&(f=h.getIntegrateValue(0,i,n));var p=t.gravityModifier?t.gravityModifier.getIntegrateByTime(0,i):0;s=s||0,u=u||0;for(var d=0;d<3;d++)c[d]=o[s+d]+a[u+d]*f+r[d]*p;var m=t.linearVelOverLifetime||{},v=t.orbitalVelOverLifetime||{},y=["x","y","z"];if(v.enabled){var g=v.center||[0,0,0],x=[c[0]-g[0],c[1]-g[1],c[2]-g[2]],T=v.asRotation,E=eR(x,x,pR(NR,y.map((function(e){var t=v[e];return t?T?t.getValue(l):t.getIntegrateValue(0,i,n):0}))));c=qA(c,g,E)}if(m.enabled){var _=m.asMovement;for(d=0;d<3;d++){var S=m[y[d]];S&&(c[d]+=_?S.getValue(l):S.getIntegrateValue(0,i,n))}}return c}var DR="not_implement",UR=function(){function e(e){this.onCreate(e)}return e.prototype.onCreate=function(e){throw Error(DR)},e.prototype.getIntegrateValue=function(e,t,r){throw Error(DR)},e.prototype.getIntegrateByTime=function(e,t){throw Error(DR)},e.prototype.getValue=function(e){throw Error(DR)},e.prototype.toUniform=function(e){throw Error(DR)},e.prototype.map=function(e){throw Error(DR)},e.prototype.scaleXCoord=function(e){return this},e}(),BR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.value=e},t.prototype.getIntegrateValue=function(e,t,r){return this.value*(t-e)},t.prototype.getIntegrateByTime=function(e,t){return.5*this.value*(t*t-e*e)},t.prototype.getValue=function(e){return this.value},t.prototype.toUniform=function(){return new Float32Array([0,this.value,0,0])},t.prototype.map=function(e){var t=this.value;return this.value=e(t),this},t}(UR),kR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.items=e},t.prototype.getValue=function(e){var t=this.items;return t[Math.floor(Math.random()*t.length)]},t.prototype.map=function(e){return this.items=this.items.map(e),this},t}(UR),zR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.min=e[0],this.max=e[1]},t.prototype.getValue=function(e){return mC(this.min,this.max)},t.prototype.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},t.prototype.map=function(e){return this.min=e(this.min),this.max=e(this.max),this},t}(UR),GR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.min=e[0],this.max=e[1]},t.prototype.getValue=function(e){for(var t=this.min,r=this.max,i=[],n=0;n<t.length;n++){var o=Math.random();i[n]=t[n]*(1-o)+r[n]*o}return i},t.prototype.map=function(e){return this.min=this.min.map(e),this.max=this.max.map(e),this},t}(UR),jR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.min=e[0],this.max=e[1],this.xCoord=1},t.prototype.getValue=function(e){return e/=this.xCoord,this.min*(1-e)+this.max*e},t.prototype.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},t.prototype.getIntegrateValue=function(e,t,r){void 0===r&&(r=1);var i=this.min,n=this.max,o=this.xCoord*r;return((i+t/o*(n-i)+i)*t-(i+e/o*(n-i)+i)*e)/2},t.prototype.getIntegrateByTime=function(e,t){return JR(t,0,this.xCoord,this.min,this.max)-JR(e,0,this.xCoord,this.min,this.max)},t.prototype.map=function(e){return this.min=e(this.min),this.max=e(this.max),this},t.prototype.scaleXCoord=function(e){return this.xCoord=e,this},t}(UR),XR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.stops=HS(e)},t.prototype.getStops=function(){return this.stops},t.prototype.getValue=function(e){for(var t=this.stops,r=t.length-1,i=0;i<r;i++){var n=t[i],o=t[i+1];if(n.stop<=e&&o.stop>e){var a=(e-n.stop)/(o.stop-n.stop);return YS(n.color,o.color,a,!0)}}return t[r].color.slice()},t}(UR),WR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.getAllData=function(e,t){for(var r=new(t?LA:Float32Array)(4*e.index),i=0,n=0,o=e.curves;i<o.length;i++){var a=o[i].toData();r.set(a,n),n+=a.length}return t?r.data:r},t.prototype.onCreate=function(e){var t=1/0,r=-1/0;if(Number.isFinite(e[0])&&Number.isFinite(e[1])){for(var i=[],n=2;n<e.length;n++)i.push(e[n].slice(0,4));this.keys=i,this.min=e[0],this.dist=e[1]-e[0]}else{i=e.map((function(e){if(fC(e))return t=Math.min(t,e[1]),r=Math.max(r,e[1]),e.slice(0,4);if("object"==typeof e&&e){var i=e,n=i.time,o=i.value,a=i.inTangent,s=void 0===a?0:a,u=i.outTangent,c=void 0===u?0:u;return t=Math.min(t,o),r=Math.max(r,o),[n,o,s,c]}throw new Error("invalid keyframe")}));var o=r-t;if(this.keys=i,0!==o)for(n=0;n<i.length;n++){var a=i[n];a[1]=(a[1]-t)/o}var s=i[0];s[0]>0&&(s[2]=0,i.unshift([0,s[1],0,0]));var u=i[i.length-1];u[0]<1&&(u[3]=0,i.push([1,u[1],0,0])),this.min=t,this.dist=o}this.isCurveValue=!0},t.prototype.getValue=function(e){var t=this,r=t.keys,i=t.min,n=t.dist,o=r;if(e<=o[0][0])return o[0][1]*n+i;for(var a=o.length-1,s=0;s<a;s++){var u=o[s],c=o[s+1];if(e>u[0]&&e<=c[0])return $R(e,u,c)*n+i}return o[a][1]*n+i},t.prototype.getIntegrateByTime=function(e,t){var r=this.integrate(t,!0)-this.integrate(e,!0);return.5*this.min*(t-e)*(t-e)+r*this.dist},t.prototype.getIntegrateValue=function(e,t,r){r=r||1;var i=(this.integrate(t/r,!1)-this.integrate(e/r,!1))*r,n=(t-e)/r;return this.min*n+i*this.dist},t.prototype.integrate=function(e,t){var r=this.keys;if(e<=r[0][0])return 0;for(var i=0,n=r.length-1,o=t?tC:eC,a=0;a<n;a++){var s=r[a],u=r[a+1],c=s[0],l=u[0];if(e>c&&e<=l)return i+o(e,s,u);i+=o(l,s,u)}return i},t.prototype.toData=function(){for(var e=this.keys,t=new Float32Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4)t.set(e[r],i);return t},t.prototype.toUniform=function(e){var t=e.index,r=this.keys;return e.curves.push(this),e.index+=r.length,e.max=Math.max(e.max,r.length),e.curveCount+=r.length,new Float32Array([2,t+1/r.length,this.min,this.dist])},t.prototype.map=function(e){return this.keys.forEach((function(t){t[1]=e(t[1])})),this},t.prototype.scaleXCoord=function(e){return this.keys.forEach((function(t){return t[0]=e*t[0]})),this},t}(UR),HR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.keys=e.map((function(e){return e.slice?e.slice(0,2):[e.time,e.value]})).sort((function(e,t){return e[0]-t[0]}));var t=this.keys[this.keys.length-1];t[0]<1&&this.keys.push([1,t[1]]);var r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},t.prototype.getValue=function(e){var t=this.keys;if(e<t[0][0])return t[0][1];for(var r=t.length-1,i=0;i<r;i++){var n=t[i],o=t[i+1],a=n[0],s=o[0];if(e>=a&&e<=s){var u=(e-a)/(s-a),c=n[1];return c+u*(o[1]-c)}}return t[r][1]},t.prototype.getIntegrateValue=function(e,t,r){return void 0===r&&(r=1),(this.integrate(t,!1)-this.integrate(e,!1))*r},t.prototype.getIntegrateByTime=function(e,t){return this.integrate(t,!0)-this.integrate(e,!0)},t.prototype.integrate=function(e,t){var r=this.keys;if(e<=r[0][0])return 0;for(var i=0,n=r.length-1,o=t?JR:QR,a=0;a<n;a++){var s=r[a],u=r[a+1],c=s[0],l=u[0];if(e>c&&e<=l)return i+o(e,c,l,s[1],u[1]);i+=o(l,c,l,s[1],u[1])}return i},t.prototype.toData=function(){for(var e=this.keys,t=new Float32Array(4*Math.ceil(e.length/2)),r=0,i=0;r<e.length;r++,i+=2)t.set(e[r],i);return t.set(e[e.length-1],t.length-2),t},t.prototype.toUniform=function(e){var t=e.index,r=this.keys,i=Math.ceil(r.length/2);return e.lineSegCount+=i,e.curves.push(this),e.index+=i,e.max=Math.max(e.max,i),new Float32Array([3,t,i,0])},t.prototype.map=function(e){return this.keys.forEach((function(t){return t[1]=e(t[1])})),this},t.prototype.scaleXCoord=function(e){return this.keys.forEach((function(t){return t[0]=e*t[0]})),this},t}(UR),YR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.keys=e[0],this.values=e[1]},t.prototype.getValue=function(e){for(var t=this.keys,r=this.values,i=0;i<t.length-1;i++){var n=t[i],o=t[i+1];if(n[0]<=e&&o[0]>=e){var a=o[1]-n[1],s=void 0;if(0===a)s=(e-n[0])/(o[0]-n[0]);else s=($R(e,n,o)-n[1])/a;return this.calculateVec(i,s)}}return e<=t[0][0]?r[0].slice():r[r.length-1].slice()},t.prototype.calculateVec=function(e,t){for(var r=this.values[e],i=this.values[e+1],n=[0,0,0],o=0;o<r.length;o++)n[o]=r[o]*(1-t)+i[o]*t;return n},t}(UR),ZR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(t){e.prototype.onCreate.call(this,t),this.cps=t[2]},t.prototype.calculateVec=function(e,t){for(var r=this.values[e],i=this.values[e+1],n=this.cps[e+e],o=this.cps[e+e+1],a=[0,0,0],s=1-t,u=s*s*s,c=3*t*s*s,l=3*t*t*s,f=t*t*t,h=0;h<r.length;h++)a[h]=u*r[h]+c*n[h]+l*o[h]+f*i[h];return a},t}(YR),qR=((VR={})[oA.RANDOM]=function(e){return e[0]instanceof Array?new GR(e):new zR(e)},VR[oA.CONSTANT]=function(e){return new BR(e)},VR[oA.CONSTANT_VEC2]=function(e){return new BR(e)},VR[oA.CONSTANT_VEC3]=function(e){return new BR(e)},VR[oA.CONSTANT_VEC4]=function(e){return new BR(e)},VR[oA.CURVE]=function(e){return new WR(e)},VR[oA.RGBA_COLOR]=function(e){return new BR(e)},VR[oA.COLORS]=function(e){return new kR(e.map((function(e){return XS(e,!1)})))},VR[oA.LINE]=function(e){return 2===e.length&&0===e[0][0]&&1===e[1][0]?new jR([e[0][1],e[1][1]]):new HR(e)},VR[oA.GRADIENT_COLOR]=function(e){return new XR(e)},VR[oA.LINEAR_PATH]=function(e){return new YR(e)},VR[oA.BEZIER_PATH]=function(e){return new ZR(e)},VR);function KR(e){if(!e||!isNaN(+e))return new BR(e||0);if(e instanceof UR)return e;if(hC(qR[e[0]]))return qR[e[0]](e[1]);throw new Error("ValueType: ".concat(e[0]," is not support"))}function QR(e,t,r,i,n){var o=e-t;return(i+i+(n-i)*o/(r-t))*o/2}function JR(e,t,r,i,n){var o=e*e,a=t*t;return(2*(o*e)*(i-n)+3*o*(t*n-r*i)-a*t*(2*i+n)+3*a*r*i)/(6*(t-r))}function $R(e,t,r){var i=r[0]-t[0],n=t[3]*i,o=r[2]*i,a=(e-t[0])/i,s=a*a,u=s*a,c=u-2*s+a,l=u-s,f=-2*u+3*s;return(2*u-3*s+1)*t[1]+c*n+l*o+f*r[1]}function eC(e,t,r){var i=r[0]-t[0],n=t[3]*i,o=r[2]*i,a=t[0],s=t[1],u=r[1],c=a-e,l=c*c,f=l*c;return(n+o+2*s-2*u)*f*c/(4*i*i*i)+(2*n+o+3*s-3*u)*f/(3*i*i)+n*l/2/i-s*c}function tC(e,t,r){var i=r[0]-t[0],n=t[3]*i,o=r[2]*i,a=t[0],s=t[1],u=r[1],c=a-e,l=c*c,f=l*c,h=i*i,p=h*i;return(-30*p*s*(a+e)*c+10*h*n*(a+2*e)*l+5*i*(a+3*e)*(2*n+o+3*s-3*u)*f+3*(a+4*e)*(n+o+2*s-2*u)*f*c)/60/p}function rC(e,t){if(t){var r=t[0],i=t[1];if(r===oA.CURVE){e.curves.push(i);var n=i.length;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++,e.index+=n,e.max=Math.max(e.max,n),e.curveCount+=n}else if(r===oA.LINE){if(2===(n=i.length)&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++;var o=Math.ceil(n/2);e.lineSegCount+=o,e.curves.push(i),e.index+=o,e.max=Math.max(e.max,o)}}}function iC(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var nC,oC=[0,0,0],aC=[1,1,1],sC=[0,0,0],uC=function(){function e(e,t){var r,i=e.positionOverLifetime,n=void 0===i?{}:i,o=t.transform,a=t.duration,s=t.endBehavior,u=o.scale;this.transform=o,this.basicTransform={position:sS([],aS(o.position),!1),rotation:sS([],aS(o.getRotation()),!1),scale:[u[0],u[1],u[2]]},n.path&&(this.basicTransform.path=KR(n.path)),this.positionOverLifetime=n,this.options={startSpeed:n.startSpeed||0,startSize:u&&u[0]||1,sizeAspect:u&&u[0]/(u[1]||1)||1,startColor:[1,1,1,1],duration:a||0,looping:s&&s===sA.loop,gravity:$A(n.gravity),gravityModifier:KR(null!==(r=n.gravityOverLifetime)&&void 0!==r?r:0),direction:n.direction?iR([],n.direction):$A(),endBehavior:s||0};var c=e.sizeOverLifetime;c&&(c.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=KR(c.x||1),this.sizeYOverLifetime=KR(c.y||1),this.sizeZOverLifetime=KR(c.z||1)):this.sizeXOverLifetime=KR(c.size||1));var l=n.linearX||n.linearY||n.linearZ;l&&(this.linearVelOverLifetime={x:n.linearX&&KR(n.linearX),y:n.linearY&&KR(n.linearY),z:n.linearZ&&KR(n.linearZ),asMovement:n.asMovement,enabled:!!l});var f=n.orbitalX||n.orbitalY||n.orbitalZ;f&&(this.orbitalVelOverLifetime={x:n.orbitalX&&KR(n.orbitalX),y:n.orbitalY&&KR(n.orbitalY),z:n.orbitalZ&&KR(n.orbitalZ),center:$A(n.orbCenter),asRotation:n.asRotation,enabled:!!f}),this.speedOverLifetime=n.speedOverLifetime&&KR(n.speedOverLifetime);var h=e.rotationOverLifetime;if(h&&(this.rotationOverLifetime={asRotation:h.asRotation,separateAxes:h.separateAxes,z:KR(h.z||0)},h.separateAxes)){var p=this.rotationOverLifetime;p.x=KR(h.x||0),p.y=KR(h.y||0)}this.gravityModifier=this.options.gravityModifier}return e.prototype.getVelocity=function(){return this.velocity||(this.velocity=nR([],this.options.direction,this.options.startSpeed)),this.velocity},e.prototype.willTranslate=function(){return!!(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled||this.orbitalVelOverLifetime&&this.orbitalVelOverLifetime.enabled||this.options.gravityModifier&&!JA(this.options.gravity)||this.options.startSpeed&&!JA(this.options.direction))},e.prototype.updatePosition=function(e,t,r){this.basicTransform.position=[e,t,r]},e.prototype.getRenderData=function(e,t){var r,i,n=this.options,o=KA(aC,1),a=KA(oC,0),s=e<0?e:Math.max(e,0),u=n.duration,c=s/u,l={life:c,transform:this.transform,startSize:this.basicTransform.scale},f=this.basicTransform;c=c<0?0:c>1?1:c,this.sizeXOverLifetime&&(o[0]=this.sizeXOverLifetime.getValue(c),this.sizeSeparateAxes?(o[1]=this.sizeYOverLifetime.getValue(c),o[2]=this.sizeZOverLifetime.getValue(c)):o[2]=o[1]=o[0],r=!0),(r||t)&&l.transform.setScale(o[0],o[1],o[2]);var h,p=this.rotationOverLifetime;if(p){var d=function(e){return p.asRotation?e.getValue(c):e.getIntegrateValue(0,c,u)},m=d(p.z),v=p.separateAxes;a[0]=v?d(p.x):0,a[1]=v?d(p.y):0,a[2]=m,i=!0}if(i||t){var y=qA(oC,f.rotation,a);l.transform.setRotation(y[0],y[1],y[2])}(this.willTranslate()||t)&&(h=FR(KA(aC,0),this,n.gravity,s,u,f.position,this.getVelocity()));if(f.path&&(h||(h=tR(sC,f.position,3)),qA(h,h,f.path.getValue(c))),h&&l.transform.setPosition(h[0],h[1],h[2]),l.startSize){var g=l.transform.scale;l.transform.setScale(g[0]*l.startSize[0],g[1]*l.startSize[1],g[2]*l.startSize[2])}return l},e}();function cC(){}function lC(e){return"string"==typeof e}e.DestroyOptions=void 0,(nC=e.DestroyOptions||(e.DestroyOptions={}))[nC.destroy=0]="destroy",nC[nC.keep=1]="keep",nC[nC.force=0]="force";var fC=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function hC(e){return"[object Function]"===Object.prototype.toString.call(e)}function pC(e){return"[object Object]"===Object.prototype.toString.call(e)}function dC(e){if(fC(e))return e.map(dC);if(e&&"object"==typeof e){if(ArrayBuffer.isView(e))return e.slice();for(var t={},r=Object.keys(e),i=0;i<r.length;i++){var n=r[i];t[n]=dC(e[n])}return t}return e}function mC(e,t){return e+Math.random()*(t-e)}function vC(){throw Error("destroyed item cannot be used again")}var yC=new Array(9).fill(0),gC=new Array(4).fill(0),xC=1,TC=function(){function e(e,t){void 0===e&&(e={}),this.position=[0,0,0],this.quat=[0,0,0,1],this.rotation=[0,0,0],this.scale=[1,1,1],this.anchor=[0,0,0],this.children=[],this.worldMatrix=PA(),this.localMatrix=PA(),this.valid=!1,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:[0,0,0],quat:[0,0,0,1],scale:[1,1,1]},this.name="transform_".concat(xC++),e&&this.setTransform(e),t&&(this.parentTransform=t),void 0!==e.valid&&this.setValid(e.valid)}return e.getRotation=function(e,t){return TR(gC,t),dR(e,wA(yC,gC))},Object.defineProperty(e.prototype,"parentTransform",{get:function(){return this.parent},set:function(e){e&&this.parent!==e&&this!==e&&(this.parent&&this.parent.removeChild(this),e.addChild(this),this.parent=e,this.parentMatrixDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentMatrixDirty",{get:function(){return this.dirtyFlags.parentMatrix},set:function(e){this.dirtyFlags.parentMatrix!==e&&(this.dirtyFlags.parentMatrix=e,this.dispatchValueChange())},enumerable:!1,configurable:!0}),e.prototype.setPosition=function(e,t,r){this.position[0]===e&&this.position[1]===t&&this.position[2]===r||(this.position[0]=e,this.position[1]=t,this.position[2]=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.translate=function(e,t,r){0===e&&0===t&&0===r||(this.position[0]+=e,this.position[1]+=t,this.position[2]+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.setRotation=function(e,t,r){this.rotation[0]===e&&this.rotation[1]===t&&this.rotation[2]===r||(this.rotation[0]=e,this.rotation[1]=t,this.rotation[2]=r,xR(this.quat,e,t,r),TR(this.quat,this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.setQuaternion=function(e,t,r,i){this.quat[0]===e&&this.quat[1]===t&&this.quat[2]===r&&this.quat[3]===i||(this.quat[0]=e,this.quat[1]=t,this.quat[2]=r,this.quat[3]=i,dR(this.rotation,wA(yC,[e,t,r,i])),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.setScale=function(e,t,r){this.scale[0]===e&&this.scale[1]===t&&this.scale[2]===r||(this.scale[0]=e,this.scale[1]=t,this.scale[2]=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.rotateByQuat=function(e){gR(this.quat,this.quat,e),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.prototype.scaleBy=function(e,t,r){this.scale[0]*=e,this.scale[1]*=t,this.scale[2]*=r,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.prototype.setAnchor=function(e,t,r){this.anchor[0]===e&&this.anchor[1]===t&&this.anchor[2]===r||(this.anchor[0]=e,this.anchor[1]=t,this.anchor[2]=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.setTransform=function(e,t){var r,i=e.position,n=e.rotation,o=e.scale,a=e.quat,s=e.name,u=e.anchor;if(s&&(this.name=s),i&&this.setPosition(i[0],i[1],i[2]),a)this.setQuaternion(a[0],a[1],a[2],a[3]);else if(n){var c=t?-1:1;this.setRotation(n[0]*c,n[1]*c,n[2]*c)}o&&this.setScale(o[0],o[1],o[2]),u&&this.setAnchor(u[0],u[1],null!==(r=u[2])&&void 0!==r?r:0)},e.prototype.addChild=function(e){kS(this.children,e)},e.prototype.removeChild=function(e){zS(this.children,e)},e.prototype.getRotation=function(){return e.getRotation([0,0,0],this.quat)},e.prototype.getQuaternion=function(){return this.quat},e.prototype.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(NA(this.localMatrix,this.quat,this.position,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):VA(this.localMatrix)||(MA(this.localMatrix),this.dirtyFlags.localMatrix=!0)},e.prototype.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.prototype.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.prototype.getWorldMatrix=function(){var e=this.getMatrix(),t=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(t?DA(this.worldMatrix,t,e):XA(this.worldMatrix,e),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.prototype.getWorldScale=function(){var e=this.worldTRSCache;return this.dirtyFlags.worldMatrix&&(jA(this.getWorldMatrix(),e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1),sS([],aS(this.worldTRSCache.scale),!1)},e.prototype.getWorldPosition=function(){return this.updateTRSCache(),sS([],aS(this.worldTRSCache.position),!1)},e.prototype.getWorldRotation=function(){this.updateTRSCache();var t=[0,0,0];return e.getRotation(t,this.worldTRSCache.quat),t},e.prototype.assignWorldTRS=function(e,t,r){this.updateTRSCache(),e&&tR(e,this.worldTRSCache.position,3),t&&tR(t,this.worldTRSCache.quat,4),r&&tR(r,this.worldTRSCache.scale,3)},e.prototype.cloneFromMatrix=function(e,t){t?(GA(e,this.position,this.quat,t),tR(this.scale,t,3)):jA(e,this.position,this.quat,this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.prototype.setValid=function(e){this.valid!==e&&(this.valid=e,e?this.dirtyFlags.localData=!0:(MA(this.localMatrix),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.prototype.getValid=function(){return this.valid},e.prototype.dispose=function(){},e.prototype.updateTRSCache=function(){var e=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var t=this.worldTRSCache;jA(e,t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1}},e.prototype.dispatchValueChange=function(){this.children.forEach((function(e){e.parentMatrixDirty=!0}))},e}(),EC=function(){function e(e,t){this._v_priority=0,this.visible=!0,this._contentVisible=!1,this.timeInms=0,this.time=0,this._frozen=!1;var r=e.id,i=e.name,n=e.delay,o=e.parentId,a=e.endBehavior,s=e.transform,u=e.listIndex,c=void 0===u?0:u,l=e.duration,f=void 0===l?0:l,h=t.rootTransform;if(this.composition=t,this.id=r,this.name=i,this.delay=n,this.transform=new TC(rS({name:this.name},s),h),this.parentId=o,this.duration=f,this.delayInms=1e3*(n||0),this.durInms=1e3*this.duration,this.endBehavior=a,this.lifetime=-this.delayInms/this.durInms,this.listIndex=c,this.onConstructed(e),f<=0)throw Error("Item duration can't be less than 0, see ".concat(yS["Item duration can't be less than 0"]))}return Object.defineProperty(e.prototype,"contentVisible",{get:function(){return this._contentVisible&&this.visible},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"reusable",{get:function(){var e,t;return null!==(t=null===(e=this.composition)||void 0===e?void 0:e.reusable)&&void 0!==t&&t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return wS.base},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frozen",{get:function(){return this._frozen},set:function(e){this.handleFrozenChanged(this._frozen=!!e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lifetimeStarted",{get:function(){return this.started&&!this.delaying},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.started&&!this.ended||(this.started=!0,this.delaying=!0,this.timeInms=0,this.time=0,this.callEnd=!1,this.ended=!1)},e.prototype.stop=function(){this.doStop(),this.started=!1},e.prototype.doStop=function(){this._content&&this._content.stop&&this._content.stop()},e.prototype.createContent=function(){return this._content||(this._content=this.doCreateContent(this.composition)),this._content},e.prototype.doCreateContent=function(e){},e.prototype.onConstructed=function(e){},e.prototype.onUpdate=function(e){var t,r;if(this.started&&!this.frozen&&this.composition){var i=this.timeInms+=e;this.time+=e/1e3;var n=i-this.delayInms;if(this.delaying&&n>=0&&(this.delaying=!1,this.transform.setValid(!0),this.createContent(),this.onLifetimeBegin(this.composition,this.content),this.composition.itemLifetimeEvent(this,!0)),!this.delaying){var o=this.endBehavior,a=n/this.durInms,s=this.isEnded(n),u=!0;if(this.transform.setValid(!0),s)if(u=!1,this.callEnd||(this.callEnd=!0,this.composition.itemLifetimeEvent(this,!1),this.onEnd()),2!==o&&5!==o){if(this.ended=!0,this.transform.setValid(!1),1===o||3===o?null===(r=(t=this.composition).handlePlayerPause)||void 0===r||r.call(t,this):4===o&&(this.transform.setValid(!0),u=!0,a=1),this.reusable)0===o&&this.setVisible(!1);else{if(0===o||3===o||6===o)return this.dispose();1===o&&(this.endBehavior=2)}a=Math.min(a,1)}else u=!0,5===o&&(this.ended=!0,a%=1);else this.callEnd&&this.reusable&&(this.setVisible(!0),this.callEnd=!1);this.lifetime=a,u&&this.onItemUpdate(e,a)}}},e.prototype.onItemRemoved=function(e,t){},e.prototype.onItemUpdate=function(e,t){},e.prototype.onLifetimeBegin=function(e,t){},e.prototype.onEnd=function(){},e.prototype.getVisible=function(){return this.visible},e.prototype.setVisible=function(e){this.visible!==e&&(this.visible=!!e,this.handleVisibleChanged(this.visible))},e.prototype.handleVisibleChanged=function(e){},e.prototype.handleFrozenChanged=function(e){},e.prototype.getWorldTransform=function(e){var t=null!=e?e:new TC({valid:!0});return t.cloneFromMatrix(this.transform.getWorldMatrix()),t},e.prototype.getNodeTransform=function(e){return this.transform},e.prototype.getBoundingBox=function(){},e.prototype.getHitTestParams=function(e){},e.prototype.getRenderData=function(){return{transform:this.transform,life:0,visible:this.visible}},e.prototype.getCurrentPosition=function(){var e=[0,0,0];return this.transform.assignWorldTRS(e),e},e.prototype.isEnded=function(e){return e-this.durInms>.001},e.prototype.reset=function(){this.composition&&(this.onItemRemoved(this.composition,this._content),this._content=void 0),this.started=!1},e.prototype.dispose=function(){this.composition&&(this.composition.destroyItem(this),this.reset(),this.onUpdate=function(){return-1},this.composition=null,this.transform.setValid(!1))},e}();function _C(e,t){var r=e.type,i=e.pluginName;if(!i)switch(r){case wS.null:case wS.base:i="cal";break;case wS.sprite:i="sprite";break;case wS.particle:i="particle";break;case wS.interact:i="interact";break;case wS.camera:i="camera";break;case wS.filter:i="filter";break;case wS.text:i="text";break;case cS:i=cS;break;default:throw new Error("invalid vfx item type")}return t.pluginSystem.createPluginItem(i,e,t)}var SC={},AC=[],RC={};function CC(e,t,r,i){RC[e]=r,SC[e]=t,i&&kS(AC,e)}var bC,OC=function(){function e(e){var t={},r=[],i=function(e){var i=SC[e];r.includes(i)||(r.push(i),t[e]=i)};AC.forEach(i),e.forEach(i),this.plugins=Object.keys(t).map((function(e){var t=SC[e];if(!t)throw new Error("plugin '".concat(e,"' not found"));var r=new t;return r.name=e,r})).sort((function(e,t){return e.order-t.order}))}return e.prototype.initializeComposition=function(e,t){this.plugins.forEach((function(r){return r.onCompositionConstructed(e,t)}))},e.prototype.destroyComposition=function(e){this.plugins.forEach((function(t){return t.onCompositionDestroyed(e)}))},e.prototype.resetComposition=function(e,t){this.plugins.forEach((function(r){return r.onCompositionReset(e,t)}))},e.prototype.createPluginItem=function(e,t,r){var i=RC[e];if(!i)throw new Error("plugin ".concat(e," no registered constructor"));var n=new i(t,r);if(!(n instanceof EC))throw new Error("plugin ".concat(e," invalid constructor type"));return n},e.prototype.processRawJSON=function(e,t){return iS(this,void 0,void 0,(function(){return nS(this,(function(r){return[2,this.callStatic("processRawJSON",e,t)]}))}))},e.prototype.callStatic=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return iS(this,void 0,void 0,(function(){var r,i,n,o,a;return nS(this,(function(s){for(r=[],i=this.plugins,n=0;n<i.length;n++)o=i[n],a=SC[o.name],e in a&&r.push(Promise.resolve(a[e].apply(a,sS([],aS(t),!1))));return[2,Promise.all(r)]}))}))},e.prototype.precompile=function(e,t,r){return iS(this,void 0,void 0,(function(){return nS(this,(function(i){return[2,this.callStatic("precompile",e,t,r)]}))}))},e.prototype.loadResources=function(e,t){return iS(this,void 0,void 0,(function(){return nS(this,(function(r){return[2,this.callStatic("prepareResource",e,t)]}))}))},e}(),LC=function(){function e(){this.order=100,this.name=""}return e.precompile=function(e,t){return Promise.resolve()},e.prototype.onCompositionConstructed=function(e,t){},e.prototype.onCompositionItemLifeBegin=function(e,t){},e.prototype.onCompositionItemLifeEnd=function(e,t){},e.prototype.onCompositionItemRemoved=function(e,t){},e.prototype.onCompositionReset=function(e,t){},e.prototype.onCompositionWillReset=function(e,t){},e.prototype.onCompositionDestroyed=function(e){},e.prototype.onCompositionUpdate=function(e,t){},e.prototype.prepareRenderFrame=function(e,t){return!1},e.prototype.postProcessFrame=function(e,t){},e}(),IC=function(){function e(e,t){this.transform=e;var r=e.position,i=void 0===r?[0,0,0]:r,n=e.getRotation(),o=t.options,a=o.near,s=o.far,u=o.fov,c=o.clipMode;if(this.clipMode=c,this.options={position:tR([0,0,0],i,3),rotation:tR([0,0,0],n,3),near:KR(a),far:KR(s),fov:KR(u)},t.positionOverLifetime){var l=t.positionOverLifetime,f=l.path,h=l.linearX,p=void 0===h?0:h,d=l.linearY,m=void 0===d?0:d,v=l.linearZ,y=void 0===v?0:v;this.translateOverLifetime={path:f&&KR(f),x:KR(p),y:KR(m),z:KR(y)}}if(t.rotationOverLifetime){var g=t.rotationOverLifetime,x=g.separateAxes,T=g.x,E=void 0===T?0:T,_=g.y,S=void 0===_?0:_,A=g.z,R=void 0===A?0:A;this.rotationOverLifetime={separateAxes:x,x:KR(E),y:KR(S),z:KR(R)}}}return e.prototype.update=function(e){var t=[0,0,0,1],r=[0,0,0],i=[0,0,0];tR(r,this.options.position,3),tR(i,this.options.rotation,3);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(e=SA(e,0,1),n&&(r[0]+=n.x.getValue(e),r[1]+=n.y.getValue(e),r[2]+=n.z.getValue(e),n.path&&qA(r,r,n.path.getValue(e))),o){var a=o.z.getValue(e);i[2]+=a,o.separateAxes?(i[0]+=o.x.getValue(e),i[1]+=o.y.getValue(e)):(i[0]+=a,i[1]+=a)}this.far=this.options.far.getValue(e),this.near=this.options.near.getValue(e),this.fov=this.options.fov.getValue(e),this.transform.setPosition(r[0],r[1],r[2]),this.transform.setRotation(i[0],i[1],i[2]),this.transform.assignWorldTRS(r,t),this.position=r,this.rotation=TC.getRotation(i,t)},e}(),wC=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t}(LC),PC=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return wS.camera},enumerable:!1,configurable:!0}),t.prototype.onConstructed=function(e){this.model=e.content},t.prototype.onItemUpdate=function(e,t){var r;null===(r=this.controller)||void 0===r||r.update(t),this.updateCamera()},t.prototype.updateCamera=function(){if(this.controller&&this.composition){var e=this.composition.camera;e.near=this.controller.near,e.far=this.controller.far,e.fov=this.controller.fov,e.clipMode=this.controller.clipMode,e.position=this.controller.position,e.rotation=this.controller.rotation}},t.prototype.getCurrentPosition=function(){return this.controller.position},t.prototype.doCreateContent=function(){return this.controller||(this.controller=new IC(this.transform,this.model)),this.controller},t}(EC);e.HitTestType=void 0,(bC=e.HitTestType||(e.HitTestType={}))[bC.triangle=1]="triangle",bC[bC.box=2]="box",bC[bC.sphere=3]="sphere",bC[bC.custom=4]="custom";var MC,VC,NC="click",FC="touchstart",DC="touchmove",UC="touchend",BC=IS,kC=function(){function e(e,t){void 0===t&&(t=!1),this.target=e,this.allowPropagation=t,this.enabled=!0,this.handlers={},this.nativeHandlers={}}return e.prototype.bindListeners=function(){var e,t,r,i,n,o,a=this;o=function(e){return e};var s="mousedown",u="mousemove",c="mouseup",l=function(e,t,r,i,o){void 0===i&&(i=0),void 0===o&&(o=0);var s=a.target,u=s.width,c=s.height,l=performance.now(),f=0,h=0;if(n){var p=l-n.ts;f=(i-n.dx)/p||0,h=(o-n.dy)/p||0,n={dx:i,dy:o,ts:l}}return{x:t,y:r,vx:f,vy:h,dx:i,dy:o,ts:l,width:u,height:c,origin:e}};KS()&&(o=function(e){var t=e,r=t.touches,i=t.changedTouches;return r[0]||i[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((e={})[s]=function(e){if(a.enabled){var s=o(e),u=zC(s);t=u.x,r=u.y,n=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:r},a.dispatchEvent(FC,l(e,t,r))}},e[u]=function(e){if(i&&a.enabled){var n=zC(o(e));t=n.x,r=n.y,a.dispatchEvent(DC,l(e,t,r,t-i.x,r-i.y))}},e[c]=function(e){if(i&&a.enabled){!a.allowPropagation&&e.cancelable&&(e.preventDefault(),e.stopPropagation());var n=o(e),s=zC(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);t=s.x,r=s.y,u<4&&a.dispatchEvent(NC,l(e,t,r)),a.dispatchEvent(UC,l(e,t,r,t-i.x,r-i.y))}i=0},e),Object.keys(this.nativeHandlers).forEach((function(e){var t;null===(t=a.target)||void 0===t||t.addEventListener(String(e),a.nativeHandlers[e])}))},e.prototype.dispatchEvent=function(e,t){var r=this.handlers[e];null==r||r.forEach((function(e){return e(t)}))},e.prototype.addEventListener=function(e,t){var r=this.handlers[e];return r||(r=this.handlers[e]=[]),kS(r,t),function(){zS(r,t)}},e.prototype.removeEventListener=function(e,t){var r=this.handlers[e];r&&zS(r,t)},e.prototype.dispose=function(){var e=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(t){var r;null===(r=e.target)||void 0===r||r.removeEventListener(String(t),e.nativeHandlers[t])})),this.nativeHandlers={},this.target=null)},e}();function zC(e){var t=e.target,r=e.clientX,i=e.clientY,n=t.getBoundingClientRect(),o=n.left,a=n.top;return{x:(r-o)/n.width*2-1,y:1-(i-a)/n.height*2}}function GC(e){switch(e){case AS.ALPHA:case AS.ADD:case AS.SUBTRACTION:case AS.STRONG_LIGHT:case AS.WEAK_LIGHT:return 1;case AS.SUPERPOSITION:return 2;case AS.BRIGHTNESS:return 3;case AS.MULTIPLY:return 0;default:return 1}}e.ShaderType=void 0,(MC=e.ShaderType||(e.ShaderType={}))[MC.vertex=0]="vertex",MC[MC.fragment=1]="fragment";var jC,XC,WC=((VC={})[e.ShaderType.vertex]={in:"attribute",out:"varying"},VC[e.ShaderType.fragment]={in:"varying"},VC);function HC(e,t,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),e&&(e.forEach((function(e){var t=aS(e,2),r=t[0],i=t[1];!0===i?n.push("#define ".concat(r)):Number.isFinite(i)&&n.push("#define ".concat(r," ").concat(i))})),o=n.length?n.join("\n")+"\n":"");var a="WEBGL".concat(i),s=(o+="\n#ifndef ".concat(a,"\n#define ").concat(a,"\n#endif"))+"\n"+t,u=s.match(/#version\s+\b\d{3}\b\s*(es)?/),c=u?u[0]:"";if(c&&c.includes("300")){var l=new RegExp("".concat(c),"g");1===i&&(s=s.replace(/\b(in|out)\b/g,(function(e){var t;return null!==(t=WC[r][e])&&void 0!==t?t:e}))),s=s.replace(l,"\n")}return s}function YC(e,t){switch(t){case void 0:case AS.ALPHA:e.blendFunction=[xS.ONE,xS.ONE_MINUS_SRC_ALPHA,xS.ONE,xS.ONE_MINUS_SRC_ALPHA];break;case AS.ADD:e.blendFunction=[xS.ONE,xS.ONE,xS.ONE,xS.ONE];break;case AS.SUBTRACTION:e.blendFunction=[xS.ONE,xS.ONE,xS.ZERO,xS.ONE],e.blendEquation=[xS.FUNC_REVERSE_SUBTRACT,xS.FUNC_REVERSE_SUBTRACT];break;case AS.SUPERPOSITION:e.blendFunction=[xS.ONE,xS.ONE,xS.ONE,xS.ONE];break;case AS.MULTIPLY:e.blendFunction=[xS.DST_COLOR,xS.ONE_MINUS_SRC_ALPHA,xS.DST_COLOR,xS.ONE_MINUS_SRC_ALPHA];break;case AS.BRIGHTNESS:e.blendFunction=[xS.ONE,xS.ONE_MINUS_SRC_ALPHA,xS.ONE,xS.ONE_MINUS_SRC_ALPHA];break;case AS.STRONG_LIGHT:e.blendFunction=[xS.DST_COLOR,xS.DST_ALPHA,xS.ZERO,xS.ONE];break;case AS.WEAK_LIGHT:e.blendFunction=[xS.DST_COLOR,xS.ZERO,xS.ZERO,xS.ONE];break;default:console.warn("blendMode ".concat(t," not in specification, please set blend params separately"))}}function ZC(e,t){t===RS.DOUBLE?e.culling=!1:(e.culling=!0,e.frontFace=xS.CW,e.cullFace=t===RS.BACK?xS.BACK:xS.FRONT)}function qC(e,t){switch(t){case void 0:e.stencilTest=!1;break;case CS.MASK:e.stencilTest=!0,e.stencilFunc=[xS.ALWAYS,xS.ALWAYS],e.stencilOpZPass=[xS.REPLACE,xS.REPLACE];break;case CS.OBSCURED:e.stencilTest=!0,e.stencilFunc=[xS.EQUAL,xS.EQUAL];break;case CS.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[xS.NOTEQUAL,xS.NOTEQUAL];break;case CS.NONE:e.stencilTest=!1;break;default:console.warn("maskMode ".concat(t," not in specification, please set stencil params seperately"))}}e.TextureLoadAction=void 0,(jC=e.TextureLoadAction||(e.TextureLoadAction={}))[jC.whatever=0]="whatever",jC[jC.clear=2]="clear",e.TextureSourceType=void 0,(XC=e.TextureSourceType||(e.TextureSourceType={}))[XC.none=0]="none",XC[XC.data=1]="data",XC[XC.image=2]="image",XC[XC.compressed=3]="compressed",XC[XC.video=4]="video",XC[XC.canvas=5]="canvas",XC[XC.framebuffer=6]="framebuffer",XC[XC.mipmaps=7]="mipmaps";var KC=function(){function e(){this.callbacks={}}return e.prototype.downloadJSON=function(e,t,r){this.download(e,"json",t,r)},e.prototype.downloadBinary=function(e,t,r){this.download(e,"arraybuffer",t,r)},e.prototype.downloadBlob=function(e,t,r){this.download(e,"blob",t,r)},e.prototype.download=function(e,t,r,i){var n=this;if(void 0===t&&(t="json"),!this.start(e,r,i)){var o=new XMLHttpRequest,a=function(){n.finish(e,o.status,o.response)};o.responseType=t,o.addEventListener("load",(function(){200==o.status||0==o.status?n.finish(e,200,o.response):a()})),o.addEventListener("error",a),o.open("GET",e,!0),o.send()}},e.prototype.start=function(e,t,r){var i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,r)}},e.prototype.finish=function(e,t,r){var i=this.callbacks[e];delete this.callbacks[e];for(var n=200==t||0==t?[r]:[t,r],o=n.length-1,a=i.length;o<a;o+=2)i[o].apply(null,n)},e}(),QC=!1;function JC(e,t){return iS(this,void 0,void 0,(function(){return nS(this,(function(r){switch(r.label){case 0:return!QC&&t?[3,2]:[4,$C(e)];case 1:case 5:return[2,{image:r.sent(),url:e}];case 2:return r.trys.push([2,4,,6]),[4,$C(t)];case 3:return[2,{image:r.sent(),url:t}];case 4:return r.sent(),QC=!0,[4,$C(e)];case 6:return[2]}}))}))}function $C(e){return iS(this,void 0,void 0,(function(){var t,r;return nS(this,(function(i){if(t="",e instanceof HTMLImageElement){if(e.complete)return[2,e];t=e.src}else e instanceof Blob?(t=URL.createObjectURL(e),r=!0):"string"==typeof e&&(t=e);if(!t)throw new Error("Invalid url type: ".concat(e));return[2,new Promise((function(e,i){var n=new Image;/^data:/.test(t)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,r&&URL.revokeObjectURL(t),e(n)},n.onerror=function(e){return n.onerror=null,r&&URL.revokeObjectURL(t),i("Load image fail: ".concat(e))},n.src=t}))]}))}))}function eb(e){return iS(this,void 0,void 0,(function(){return nS(this,(function(t){return[2,new Promise((function(t,r){(new KC).downloadBinary(e,t,(function(t,i){r("Couldn't load bins ".concat(e,": status ").concat(t,", ").concat(i))}))}))]}))}))}function tb(e,t){return void 0===t&&(t={}),iS(this,void 0,void 0,(function(){var r;return nS(this,(function(i){return r=document.createElement("video"),"string"==typeof e?r.src=e:r.srcObject=e,r.crossOrigin="anonymous",r.muted=!0,t.loop&&r.addEventListener("ended",(function(){return r.play()})),qS()&&r.setAttribute("renderer","standard"),r.setAttribute("playsinline","playsinline"),[2,new Promise((function(e,t){var i=r.play();i?i.then((function(){return e(r)})):r.addEventListener("loadeddata",(function t(){e(r),r.removeEventListener("loadeddata",t)}),!0),r.addEventListener("error",(function(e){t(e)}))}))]}))}))}function rb(t,r,i){return void 0===i&&(i=[]),iS(this,void 0,void 0,(function(){var n,o,a,s,u,c,l;return nS(this,(function(f){switch(f.label){case 0:return 34067!==t.target?[3,2]:(a=(n=t).mipmaps,s=n.target,u=a.map((function(e){return Promise.all(e.map((function(e){return ib(e,r)})))})),[4,Promise.all(u)]);case 1:return c=f.sent(),l=i[a[0][0][1][0]].url,[2,rS(rS({keepImageSource:!1},t),{mipmaps:c,sourceFrom:{target:s,bin:l,type:e.TextureSourceType.mipmaps,mipmaps:a.map((function(e){return e.map((function(e){return[e[1][1],e[1][2]]}))}))}})];case 2:return a=(o=t).mipmaps,s=o.target,u=a.map((function(e){return ib(e,r)})),[4,Promise.all(u)];case 3:return c=f.sent(),l=i[a[0][1][0]].url,[2,rS(rS({keepImageSource:!1},t),{mipmaps:c,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{target:s,bin:l,type:e.TextureSourceType.mipmaps,mipmaps:a.map((function(e){return[e[1][1],e[1][2]]}))}})]}}))}))}function ib(e,t){return iS(this,void 0,void 0,(function(){var r,i,n,o,a;return nS(this,(function(s){if(r=aS(e[1],3),i=r[0],n=r[1],o=r[2],!(a=t[i]))throw new Error("invalid bin pointer: ".concat(JSON.stringify(e)));return[2,$C(new Blob([new Uint8Array(a,n,o)]))]}))}))}var nb=1,ob=function(){function t(){this.destroyed=!1,this.id="Tex"+nb++}return Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.getWidth=function(){return this.width||0},t.prototype.getHeight=function(){return this.height||0},t.prototype.uploadCurrentVideoFrame=function(){},t.prototype.offloadData=function(){},t.prototype.reloadData=function(){},t.prototype.initialize=function(){},t.prototype.assembleOptions=function(t){var r=t.target,i=void 0===r?xS.TEXTURE_2D:r,n=t.format,o=void 0===n?xS.RGBA:n;return t.sourceType||(t.sourceType="image"in t?e.TextureSourceType.image:"data"in t?e.TextureSourceType.data:"video"in t?e.TextureSourceType.video:0),rS({minFilter:xS.NEAREST,magFilter:xS.NEAREST,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE,target:i,format:xS.RGBA,internalFormat:o,type:xS.UNSIGNED_BYTE},t)},t}();function ab(e,t,r,i){var n,o,a=t.length/r/i;return o=n=4===a||0===a?xS.RGBA:3===a?xS.RGB:2===a?xS.LUMINANCE_ALPHA:xS.LUMINANCE,ob.createWithData(e,{data:t,width:r,height:i},{type:xS.HALF_FLOAT,format:n,internalFormat:o,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE})}var sb=function(){function e(e,t,r){void 0===r&&(r=0),this.arrayBuffer=e,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[11])throw Error("texture missing KTX identifier");var n=Uint32Array.BYTES_PER_ELEMENT,o=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===o.getUint32(0,!0);this.glType=o.getUint32(1*n,a),this.glTypeSize=o.getUint32(2*n,a),this.glFormat=o.getUint32(3*n,a),this.glInternalFormat=o.getUint32(4*n,a),this.glBaseInternalFormat=o.getUint32(5*n,a),this.pixelWidth=o.getUint32(6*n,a),this.pixelHeight=o.getUint32(7*n,a),this.pixelDepth=o.getUint32(8*n,a),this.numberOfArrayElements=o.getUint32(9*n,a),this.numberOfFaces=o.getUint32(10*n,a),this.numberOfMipmapLevels=o.getUint32(11*n,a),this.bytesOfKeyValueData=o.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===t?0===this.glType?this.loadType=0:this.loadType=2:console.warn("number of faces expected"+t+", but found "+this.numberOfFaces):console.warn("texture arrays not currently supported"):console.warn("only 2D textures currently supported")}return e.prototype.mipmaps=function(e){for(var t=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,o=e?this.numberOfMipmapLevels:1,a=0;a<o;a++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,s);t.push({data:c,width:i,height:n}),r+=s+4,r+=3-(s+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return t},e}();function ub(t){var r=new sb(t,1),i=r.numberOfMipmapLevels,n=r.pixelWidth,o=r.pixelHeight,a=r.glType,s=r.numberOfFaces,u=r.glInternalFormat,c=r.glFormat,l=i>=Math.floor(Math.log2(Math.max(n,o))+1);return{sourceType:e.TextureSourceType.compressed,type:a,target:6===s?xS.TEXTURE_CUBE_MAP:xS.TEXTURE_2D,internalFormat:u,format:c,mipmaps:r.mipmaps(l)}}var cb,lb=function(){function t(){this.reloadPending={}}return t.prototype.reload=function(e){return iS(this,void 0,void 0,(function(){var t,r;return nS(this,(function(i){switch(i.label){case 0:return t=e.id,this.reloadPending[t]?[2]:e.sourceFrom?(this.reloadPending[t]=!0,[4,this.loadSource(e.sourceFrom)]):[3,2];case 1:return r=i.sent(),e.updateSource(r),this.reloadPending[t]=!1,[3,3];case 2:throw new Error("No source from");case 3:return[2]}}))}))},t.prototype.canOffloadTexture=function(t){if(t){var r=t.type;if(r===e.TextureSourceType.compressed||r===e.TextureSourceType.image){var i=t,n=i.target,o=i.map,a=t.url;return n===xS.TEXTURE_CUBE_MAP?"object"==typeof o&&!!o:lC(a)&&a.length>0}if(r===e.TextureSourceType.mipmaps){var s=t,u=s.bin,c=s.mipmaps,l=t,f=(n=l.target,l.maps),h=t.urls;return u?c.length>0:n===xS.TEXTURE_CUBE_MAP?f.every((function(e){return"object"==typeof e&&e})):h.every((function(e){return lC(e)&&e.length>0}))}}return!1},t.prototype.loadSource=function(t,r){return iS(this,void 0,void 0,(function(){var i,n,o,a,s,u,c,l,f,h,p,d,m,v,y,g,x,T=this;return nS(this,(function(E){switch(E.label){case 0:return i=t.type,n=t.target,o=t.map,a=t.url,u=(s=t).bin,c=s.mipmaps,l=t.urls,f=t.maps,n!==xS.TEXTURE_CUBE_MAP||i===e.TextureSourceType.mipmaps?[3,2]:[4,this.loadCubeMap(o)];case 1:return h=E.sent(),[2,rS(rS({},r),{cube:h,target:xS.TEXTURE_CUBE_MAP,sourceType:e.TextureSourceType.image,sourceFrom:{type:e.TextureSourceType.image,map:rS({},o),target:xS.TEXTURE_CUBE_MAP}})];case 2:return i!==e.TextureSourceType.image?[3,4]:[4,$C(a)];case 3:return p=E.sent(),[2,rS(rS({},r),{image:p,sourceType:e.TextureSourceType.image,sourceFrom:{type:i,url:a,target:xS.TEXTURE_2D}})];case 4:return i!==e.TextureSourceType.video?[3,6]:[4,tb(a)];case 5:return d=E.sent(),[2,rS(rS({},r),{video:d,sourceType:e.TextureSourceType.video})];case 6:return i!==e.TextureSourceType.compressed?[3,8]:[4,eb(a)];case 7:return m=E.sent(),[2,rS(rS(rS({},ub(m)),r),{sourceFrom:{url:a,type:e.TextureSourceType.compressed}})];case 8:return i!==e.TextureSourceType.mipmaps?[3,17]:u?[4,eb(u)]:[3,13];case 9:return v=E.sent(),y=null!=n?n:xS.TEXTURE_2D,g=y===xS.TEXTURE_2D?c.slice():c.map((function(e){return e.slice()})),x=void 0,n!==xS.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(c.map((function(e){return T.loadMipmapImages(e,v)})))];case 10:return x=E.sent(),[3,12];case 11:x=this.loadMipmapImages(c,v),E.label=12;case 12:return[2,rS(rS({},r),{mipmaps:x,target:y,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:e.TextureSourceType.mipmaps}})];case 13:return n!==xS.TEXTURE_2D&&n?[3,15]:[4,Promise.all(l.map((function(e){return $C(e)})))];case 14:return x=E.sent(),[2,rS(rS({},r),{mipmaps:x,target:xS.TEXTURE_2D,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:l.slice(),target:xS.TEXTURE_2D}})];case 15:return n!==xS.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(f.map((function(e){return T.loadCubeMap(e)})))];case 16:return x=E.sent(),[2,rS(rS({},r),{mipmaps:x,target:xS.TEXTURE_CUBE_MAP,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:f.map((function(e){return rS({},e)})),target:xS.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: ".concat(i))}}))}))},t.prototype.loadMipmapImages=function(e,t){return iS(this,void 0,void 0,(function(){return nS(this,(function(r){return[2,Promise.all(e.map((function(e){return $C(new Blob([new Uint8Array(t,e[0],e[1])]))})))]}))}))},t.prototype.loadCubeMap=function(e){return iS(this,void 0,void 0,(function(){return nS(this,(function(t){return[2,Promise.all(e.map((function(e){return $C(e)})))]}))}))},t}();var fb,hb=function(){function e(e){this.destroyed=!1;var t=e.name,r=void 0===t?"defaultDataBlock":t;this.name=r}return e.prototype.setUniformValues=function(e){var t=this;Object.keys(e).forEach((function(r){t.setUniformValue(r,e[r])}))},e.prototype.invalidAllFlags=function(){},e.prototype.updateUniformSubData=function(e,t,r){},e}();function pb(e){return"object"==typeof e&&e&&void 0===e.length&&e instanceof ob}e.MaterialRenderType=void 0,(fb=e.MaterialRenderType||(e.MaterialRenderType={}))[fb.normal=0]="normal",fb[fb.transformFeedback=1]="transformFeedback";var db,mb,vb=1,yb=function(){function t(t){this.props=t,this.destroyed=!1,this.initialized=!1;var r=t.name,i=void 0===r?"Material"+vb++:r,n=t.renderType,o=void 0===n?e.MaterialRenderType.normal:n,a=t.shader,s=t.uniformSemantics;this.name=i,this.renderType=o,this.shaderSource=a,this.uniformSemantics=rS({},s)}return Object.defineProperty(t.prototype,"blending",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendFunction",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendEquation",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthTest",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthMask",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilTest",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilRef",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilFunc",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilOpZPass",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"culling",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"frontFace",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cullFace",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendColor",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthRange",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthFunc",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polygonOffsetFill",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polygonOffset",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sampleAlphaToCoverage",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorMask",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilMask",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilOpFail",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilOpZFail",{set:function(e){},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){},t.prototype.use=function(e,t){},t}(),gb="uniform vec2 uFilterSourceSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));return mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}";e.ShaderCompileResultStatus=void 0,(db=e.ShaderCompileResultStatus||(e.ShaderCompileResultStatus={}))[db.noShader=0]="noShader",db[db.success=1]="success",db[db.fail=2]="fail",db[db.compiling=3]="compiling",e.GLSLVersion=void 0,(mb=e.GLSLVersion||(e.GLSLVersion={})).GLSL1="100",mb.GLSL3="300 es";var xb=function(e){this.source=e},Tb="effects-internal-copy",Eb="effects-internal-copy-mesh",_b="\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",Sb="precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\n".concat(gb,"\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n fragColor = filterMain(vTex,uFilterSource);\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n");function Ab(t,r){var i=2===t,n=i?"#version 300 es":"";return{name:Tb,vertex:HC([],n+"\n"+_b,e.ShaderType.vertex,t),fragment:HC([],n+"\n"+Sb,e.ShaderType.fragment,t),glslVersion:i?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:Eb+ +r}}var Rb,Cb={format:xS.RGBA,type:xS.UNSIGNED_BYTE,minFilter:xS.LINEAR,magFilter:xS.LINEAR,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE},bb=Symbol("dispose"),Ob=function(){function t(e){this.textureCache={},this.textureRef={},this.engine=e}return t.prototype.requestColorAttachmentTexture=function(t){var r=this,i=t.width,n=t.height,o=t.name,a={sourceType:e.TextureSourceType.framebuffer,data:{width:i,height:n},name:o},s=[o];Object.getOwnPropertyNames(Cb).forEach((function(e){var r,i=null!==(r=t[e])&&void 0!==r?r:Cb[e];a[e]=i,s.push(e,i)}));var u=s.join(":"),c=this.textureCache[u];if(c)this.textureRef[u]++;else{var l=this.engine;rA(l),c=ob.create(l,a),this.textureCache[u]=c,this.textureRef[u]=1,c[bb]=c.dispose,c.dispose=function(){return r.removeTexture(u)}}return c},t.prototype.removeTexture=function(e){var t=this.textureRef[e];if(t<=1){t<0&&console.error("ref count < 0");var r=this.textureCache[e];r&&(r[bb](),r.dispose=r[bb]),delete this.textureCache[e],delete this.textureRef[e]}else this.textureRef[e]=t-1},t.prototype.dispose=function(){Object.values(this.textureCache).forEach((function(e){e[bb](),e.dispose=e[bb]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),Lb=function(){function e(e){void 0===e&&(e={}),this.semantics=rS({},e)}return e.prototype.toObject=function(){return rS({},this.semantics)},e.prototype.setSemantic=function(e,t){void 0===t?delete this.semantics[e]:this.semantics[e]=t},e.prototype.getSemanticValue=function(e,t){var r=this.semantics[e];return hC(r)?r(t):r},e.prototype.hasSemanticValue=function(e){return e in this.semantics},e.prototype.dispose=function(){var e=this;Object.keys(this.semantics).forEach((function(t){delete e.semantics[t]}))},e}(),Ib=((Rb={})[xS.FLOAT]=Float32Array.BYTES_PER_ELEMENT,Rb[xS.INT]=Int32Array.BYTES_PER_ELEMENT,Rb[xS.SHORT]=Int16Array.BYTES_PER_ELEMENT,Rb[xS.BYTE]=Int8Array.BYTES_PER_ELEMENT,Rb),wb=function(){function e(e){this.name=e}return e.prototype.initialize=function(){},e.prototype.flush=function(){},e}();function Pb(e){return e===xS.INT?new Int32Array(0):e===xS.SHORT?new Int16Array(0):new Float32Array(0)}var Mb="lookup_texture",Vb="offscreen_canvas",Nb={};function Fb(e){return Nb[e]}var Db,Ub,Bb=1,kb=function(){function t(e,t){this.engine=e,this.destroyed=!1,this.visible=!1;var r=t.material,i=t.geometry,n=t.name,o=void 0===n?"<unnamed>":n,a=t.priority,s=void 0===a?0:a,u=t.worldMatrix,c=void 0===u?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:u;this.id="Mesh"+Bb++,this.name=o,this.geometry=i,this.material=r,this.priority=s,this.worldMatrix=c}return Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},set:function(e){this._priority=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.setVisible=function(e){this.visible=e},t.prototype.render=function(e){var t=e.renderingData,r=this.material;t.currentFrame.globalUniforms&&(t.currentCamera&&(e.setGlobalMatrix("effects_MatrixInvV",t.currentCamera.getInverseViewMatrix()),e.setGlobalMatrix("effects_MatrixV",t.currentCamera.getViewMatrix()),e.setGlobalMatrix("effects_MatrixVP",t.currentCamera.getViewProjectionMatrix()),e.setGlobalMatrix("_MatrixP",t.currentCamera.getProjectionMatrix())),e.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix)),t.currentFrame.editorTransform&&r.setVector4("uEditorTransform",t.currentFrame.editorTransform),r.use(e,t.currentFrame.globalUniforms);var i=this.geometry;i.flush(),e.drawGeometry(i,r)},t.prototype.getVisible=function(){return this.visible},t.prototype.firstGeometry=function(){return this.geometry},t.prototype.setMaterial=function(t,r){r!==e.DestroyOptions.keep&&this.material.dispose(r),this.material=t},t.prototype.restore=function(){},t.prototype.dispose=function(t){if(!this.destroyed){(null==t?void 0:t.geometries)!==e.DestroyOptions.keep&&this.geometry.dispose();var r=null==t?void 0:t.material;r!==e.DestroyOptions.keep&&this.material.dispose(r),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},t}(),zb=1e3;e.RenderPassAttachmentStorageType=void 0,(Db=e.RenderPassAttachmentStorageType||(e.RenderPassAttachmentStorageType={}))[Db.none=0]="none",Db[Db.color=1]="color",Db[Db.stencil_8_opaque=2]="stencil_8_opaque",Db[Db.depth_16_opaque=3]="depth_16_opaque",Db[Db.depth_stencil_opaque=4]="depth_stencil_opaque",Db[Db.depth_16_texture=5]="depth_16_texture",Db[Db.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",e.TextureStoreAction=void 0,(Ub=e.TextureStoreAction||(e.TextureStoreAction={}))[Ub.store=0]="store",Ub[Ub.clear=2]="clear";var Gb,jb=function(){function t(t,r){if(this.destroyed=!1,r){var i=r.texture,n=r.size;if(i instanceof ob)this.texture=i,this.externalTexture=!0;else if(i){var o=i.wrapT,a=i.wrapS,s=i.minFilter,u=i.magFilter,c=i.internalFormat,l=i.format,f=void 0===l?xS.RGBA:l,h=i.type,p=void 0===h?xS.UNSIGNED_BYTE:h;this.externalTexture=!1,this.textureOptions={size:n,format:f,type:p,internalFormat:c||f,wrapT:o,wrapS:a,minFilter:s,magFilter:u,name:r.name},this.texture=ob.create(t,rS(rS({},this.textureOptions),{sourceType:e.TextureSourceType.framebuffer,data:{width:n[0],height:n[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"storageType",{get:function(){return e.RenderPassAttachmentStorageType.color},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=this.texture;return e?[e.getWidth(),e.getHeight()]:[0,0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.texture.getWidth()||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.texture.getHeight()||0},enumerable:!1,configurable:!0}),t}();e.RenderPassDestroyAttachmentType=void 0,(Gb=e.RenderPassDestroyAttachmentType||(e.RenderPassDestroyAttachmentType={}))[Gb.force=0]="force",Gb[Gb.keep=1]="keep",Gb[Gb.keepExternal=2]="keepExternal",Gb[Gb.destroy=0]="destroy";var Xb=1,Wb=function(){function t(t,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+Xb++:i,o=r.clearAction,a=r.semantics,s=r.depthStencilAttachment,u=r.storeAction,c=r.priority,l=void 0===c?0:c,f=r.meshOrder,h=void 0===f?e.OrderType.ascending:f,p=r.meshes,d=void 0===p?[]:p,m=r.delegate,v=void 0===m?{}:m;this.name=n,this.renderer=t,this.priority=l,this.meshOrder=h,this.meshes=JS(d.slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||e.RenderPassAttachmentStorageType.none,this.clearAction=rS({},o),this.storeAction=rS({colorAction:e.TextureStoreAction.store,depthAction:e.TextureStoreAction.store,stencilAction:e.TextureStoreAction.store},u),this.semantics=new Lb(a),this.options=r,this.delegate=v,this.setViewportOptions(r)}return Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewport",{get:function(){return this.getViewport()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilAttachment",{get:function(){return this.getStencilAttachment()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthAttachment",{get:function(){return this.getDepthAttachment()},enumerable:!1,configurable:!0}),t.prototype.addMesh=function(e){$S(this.meshes,e,this.meshOrder)},t.prototype.removeMesh=function(e){zS(this.meshes,e)},t.prototype.setMeshes=function(e){var t;return this.meshes.length=0,(t=this.meshes).splice.apply(t,sS([0,0],aS(e),!1)),JS(this.meshes,this.meshOrder),this.meshes},t.prototype.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},t.prototype.configure=function(e){if(this.frameBuffer)e.setFrameBuffer(this.frameBuffer);else{var t=aS(this.getViewport(),4),r=t[0],i=t[1],n=t[2],o=t[3];e.setViewport(r,i,n,o)}},t.prototype.execute=function(e){e.clear(this.clearAction),e.renderMeshes(this.meshes),e.clear(this.storeAction)},t.prototype.frameCleanup=function(e){},t.prototype.resetColorAttachments=function(t){var r=this;if(t.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=t.map((function(t){return t.updateSource({sourceType:e.TextureSourceType.framebuffer}),new jb(r.renderer.engine,{texture:t})}));this.attachments.forEach((function(e){return!e.externalTexture&&e.dispose()})),this.attachments=i,this.frameBuffer&&(this.frameBuffer.bind(),this.frameBuffer.resetColorTextures(t.map((function(e){return e}))))}else this.resetAttachments({attachments:t.map((function(e){return{texture:e}}))})},t.prototype.resetAttachments=function(e){this.options=e,this.setViewportOptions(e),this.renderer&&this._resetAttachments()},t.prototype.setViewportOptions=function(e){if(e.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=e.viewport.slice(0,4),this.frameBuffer){var t=this.customViewport;this.frameBuffer.isCustomViewport=!1,this.frameBuffer.resize(t[0],t[1],t[2],t[3])}}else this.isCustomViewport=!1,this.viewportScale=e.viewportScale||1,this.frameBuffer&&(this.frameBuffer.isCustomViewport=!0,this.frameBuffer.viewportScale=this.viewportScale)},t.prototype._resetAttachments=function(){var t,r,i=this,n=this.renderer,o=this.options;this.attachments.length&&(this.attachments.forEach((function(e){return!e.externalTexture&&e.dispose()})),this.attachments.length=0,null===(t=this.frameBuffer)||void 0===t||t.dispose({depthStencilAttachment:e.RenderPassDestroyAttachmentType.keepExternal}),this.frameBuffer=null);var a=this.viewportScale,s=this.isCustomViewport?this.customViewport:[0,0,n.getWidth()*a,n.getHeight()*a],u=[s[2],s[3]],c=this.name;if(null===(r=o.attachments)||void 0===r?void 0:r.length){var l=o.attachments.map((function(e,t){var r;return new jb(i.renderer.engine,rS({size:u,name:(null===(r=e.texture)||void 0===r?void 0:r.name)||"".concat(c,"##color_").concat(t)},e))}));this.attachments=l;var f=wO.create({storeAction:this.storeAction,name:c,viewport:s,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:l.map((function(e){return e.texture})),depthStencilAttachment:o.depthStencilAttachment||{storageType:e.RenderPassAttachmentStorageType.none}},n);f.bind(),f.unbind(),this.frameBuffer=f}else this.attachments.length=0},t.prototype.getViewport=function(){var e,t=(null===(e=this.frameBuffer)||void 0===e?void 0:e.viewport)||this.customViewport;if(t)return t;var r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},t.prototype.getDepthAttachment=function(){var e=this.frameBuffer;if(e)return{storageType:e.depthStencilStorageType,storage:e.depthStorage,texture:e.getDepthTexture()?this.getDepthTexture(e.getDepthTexture(),e.externalStorage):void 0}},t.prototype.getStencilAttachment=function(){var e=this.frameBuffer;if(e)return{storageType:e.depthStencilStorageType,storage:e.stencilStorage,texture:e.getStencilTexture()?this.getStencilTexture(e.getStencilTexture(),e.externalStorage):void 0}},t.prototype.getDepthTexture=function(e,t){var r;if(!this.depthTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=e===i?i:e;return t||(this.depthTexture=n),n}return this.depthTexture},t.prototype.getStencilTexture=function(e,t){var r;if(!this.stencilTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=e===i?i:e;return t||(this.stencilTexture=n),n}return this.stencilTexture},t.prototype.initialize=function(e){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},t.prototype.dispose=function(t){var r,i;if(!this.destroyed){var n=(null==t?void 0:t.meshes)||void 0;n!==e.DestroyOptions.keep&&this.meshes.forEach((function(e){e.dispose(n)})),this.meshes.length=0;var o=(null==t?void 0:t.colorAttachment)?t.colorAttachment:e.RenderPassDestroyAttachmentType.force;this.attachments.forEach((function(t){t.externalTexture&&o===e.RenderPassDestroyAttachmentType.keepExternal||o===e.RenderPassDestroyAttachmentType.keep||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==e.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var a=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:e.RenderPassDestroyAttachmentType.force,s=this.frameBuffer;if(s)s.dispose({depthStencilAttachment:a}),s.externalStorage&&a===e.RenderPassDestroyAttachmentType.keepExternal||a===e.RenderPassDestroyAttachmentType.keep||(null===(r=this.stencilTexture)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose());this.options=this.renderer=null,this.initialize=vC}},t}(),Hb="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}",Yb="#version 300 es\nprecision highp float;\n#define SHADER_VERTEX 1\n#define SPRITE_SHADER 1\nin vec4 aPoint;in vec2 aIndex;uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixInvV;uniform mat4 effects_MatrixVP;out vec4 vColor;out vec4 vTexCoord;\n#ifdef ADJUST_LAYER\nout vec2 vFeatherCoord;\n#endif\nout highp vec3 vParams;const float d2r=3.141592653589793/180.;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec4 filterMain(float t,vec4 position);\n#pragma FILTER_VERT\nvec3 rotateByQuat(vec3 a,vec4 quat){vec3 qvec=quat.xyz;vec3 uv=cross(qvec,a);vec3 uuv=cross(qvec,uv)*2.;return a+(uv*2.*quat.w+uuv);}void main(){int index=int(aIndex.x);vec4 texParams=uTexParams[index];mat4 mainData=uMainData[index];float life=mainData[1].z;if(life<0.||life>1.){gl_Position=vec4(3.,3.,3.,1.);}else{vec4 _pos=mainData[0];vec2 size=mainData[1].xy;vec3 point=rotateByQuat(vec3(aPoint.xy*size,0.),mainData[2]);vec4 pos=vec4(_pos.xyz,1.0);float renderMode=texParams.z;if(renderMode==0.){pos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixInvV[0].xyz*point.x+effects_MatrixInvV[1].xyz*point.y;}else if(renderMode==1.){pos.xyz+=point;pos=effects_ObjectToWorld*pos;}else if(renderMode==2.){pos=effects_ObjectToWorld*pos;pos.xy+=point.xy;}else if(renderMode==3.){pos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixInvV[0].xyz*point.x+effects_MatrixInvV[2].xyz*point.y;}gl_Position=effects_MatrixVP*pos;\n#ifdef ADJUST_LAYER\nvec4 filter_Position=filterMain(life,pos);\n#endif\ngl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#ifdef ADJUST_LAYER\nfilter_Position=vec4(filter_Position.xy*uEditorTransform.xy+uEditorTransform.zw*filter_Position.w,filter_Position.zw);\n#endif\n#endif\n#ifdef ADJUST_LAYER\nvTexCoord=vec4(filter_Position.xy/filter_Position.w+1.,gl_Position.xy/gl_Position.w+1.)/2.;vFeatherCoord=aPoint.zw;\n#else\nvec4 texOffset=uTexOffset[index];vTexCoord=vec4(aPoint.zw*texOffset.zw+texOffset.xy,texParams.xy);\n#endif\nvColor=mainData[3];vParams=vec3(aIndex.y,texParams.y,texParams.x);}}",Zb="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define SPRITE_SHADER 1\nin vec4 vColor;in vec4 vTexCoord;in highp vec3 vParams;\n#ifdef ADJUST_LAYER\nuniform sampler2D uSamplerPre;vec4 filterMain(vec2 coord,sampler2D tex);in vec2 vFeatherCoord;uniform sampler2D uFeatherSampler;\n#endif\nuniform sampler2D uSampler0;uniform sampler2D uSampler1;uniform sampler2D uSampler2;uniform sampler2D uSampler3;uniform sampler2D uSampler4;uniform sampler2D uSampler5;uniform sampler2D uSampler6;uniform sampler2D uSampler7;\n#if MAX_FRAG_TEX == 16\nuniform sampler2D uSampler8;uniform sampler2D uSampler9;uniform sampler2D uSampler10;uniform sampler2D uSampler11;uniform sampler2D uSampler12;uniform sampler2D uSampler13;uniform sampler2D uSampler14;uniform sampler2D uSampler15;\n#endif\nvec4 texture2DbyIndex(float index,vec2 coord);\n#pragma FILTER_FRAG\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\nvoid main(){vec4 color=vec4(0.);\n#ifdef ADJUST_LAYER\nvec2 featherCoord=abs(vFeatherCoord-vec2(0.5))/0.5;float cc=sqrt(max(featherCoord.x,featherCoord.y));float blend=vColor.a*texture2D(uFeatherSampler,vec2(cc,0.)).r;if(blend>=1.){color=filterMain(vTexCoord.xy,uSamplerPre);}else if(blend<=0.){color=texture2D(uSamplerPre,vTexCoord.zw);}else{color=mix(texture2D(uSamplerPre,vTexCoord.zw),filterMain(vTexCoord.xy,uSamplerPre),blend);}\n#else\nvec4 texColor=texture2DbyIndex(round(vParams.x),vTexCoord.xy);color=blendColor(texColor,vColor,round(vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);fragColor=color;}vec4 texture2DbyIndex(float index,vec2 coord){\n#ifndef ADJUST_LAYER\nif(index==0.){return texture2D(uSampler0,coord);}if(index==1.){return texture2D(uSampler1,coord);}if(index==2.){return texture2D(uSampler2,coord);}if(index==3.){return texture2D(uSampler3,coord);}if(index==4.){return texture2D(uSampler4,coord);}if(index==5.){return texture2D(uSampler5,coord);}if(index==6.){return texture2D(uSampler6,coord);}if(index==7.){return texture2D(uSampler7,coord);}\n#if MAX_FRAG_TEX == 16\nif(index==8.){return texture2D(uSampler8,coord);}if(index==9.){return texture2D(uSampler9,coord);}if(index==10.){return texture2D(uSampler10,coord);}if(index==11.){return texture2D(uSampler11,coord);}if(index==12.){return texture2D(uSampler12,coord);}if(index==13.){return texture2D(uSampler13,coord);}if(index==14.){return texture2D(uSampler14,coord);}if(index==15.){return texture2D(uSampler15,coord);}\n#endif\nreturn texture2D(uSampler0,coord);\n#else\nreturn vec4(0.);\n#endif\n}",qb="#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nin float vLife;in vec2 vTexCoord;in vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nin vec4 vTexCoordBlend;\n#ifdef USE_FILTER\nuniform vec4 uFSprite;\n#endif\n#endif\nin float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){fragColor=uPreviewColor;}\n#else\n#pragma FILTER_FRAG\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}\n#ifdef USE_FILTER\n#ifdef USE_SPRITE\ntexOffset=uTexOffset/uFSprite.xy;\n#endif\ncolor=filterMain(vTexCoord,uMaskTex);\n#else\nif(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#endif\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);fragColor=color;}\n#endif\n",Kb="#version 300 es\nprecision highp float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).y;}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;float r=dot(vec4(2.*t*t*t,3.*t*t,-t0*t0*t0,3.*t0*t0),vec4(y0-y1,t0*y1-t1*y0,2.*y0+y1,t1*y0));return r/(t0-t1)/6.;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#pragma EDITOR_VERT_DEFINE\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out vec2 vTexCoord;\n#ifdef USE_FILTER\n#pragma FILTER_VERT\n#endif\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef USE_FILTER\nfilterMain(life);\n#endif\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n#pragma EDITOR_VERT_TRANSFORM\n}}",Qb="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).y;}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}in vec4 aPos;in vec3 aDir;in vec3 aInfo;in vec4 aColor;in float aTime;\n#ifdef ATTR_TRAIL_START\nin float aTrailStart;\n#else\nuniform float uTrailStart[64];in float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nout float vLife;out vec2 vTexCoord;out vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",Jb="uniform vec4 uTexRange;uniform vec2 uFilterSourceSize;\n#define INTERPOLATION 0\nvec4 filterMain(vec2 texCoord,sampler2D source){float x=uTexRange.x+texCoord.x*uTexRange.y;\n#if INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));vec4 color=mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nvec4 color=texture2D(source,vec2(x,texCoord.y));\n#endif\nx=uTexRange.z+texCoord.x*uTexRange.w;vec4 opacity=texture2D(source,vec2(x,texCoord.y));return vec4(color.rgb,opacity.r);}",$b="uniform sampler2D uAlphaXSample;uniform sampler2D uAlphaYSample;vec4 filterMain(vec2 texCoord,sampler2D source){vec4 color=texture2D(source,texCoord);float x=texture2D(uAlphaXSample,vec2(vFeatherCoord.x,0.)).r;float y=texture2D(uAlphaYSample,vec2(vFeatherCoord.y,0.)).r;return vec4(color.rgb,color.a*min(x,y));}",eO="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",tO="uniform sampler2D uLastSource;uniform vec4 uParams;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);if(uParams.x<1.){return c1;}vec4 c2=texture2D(uLastSource,coord);return mix(c1,c2,uParams.y);}",rO="uniform vec4 uWaveParams;\n#ifdef PATICLE_SHADER\nin vec4 vWaveParams;\n#else\nuniform vec4 vWaveParams;\n#endif\nvec4 filterMain(vec2 texCoord,sampler2D tex){vec2 vp=texCoord-uWaveParams.xy;float xx=dot(vp,uWaveParams.zw);float d=sin(vWaveParams.x*xx+vWaveParams.y)*vWaveParams.z;vec2 up=vec2(-uWaveParams.w,uWaveParams.z)*d;return texture2D(tex,clamp(texCoord+up,0.,1.));}",iO="uniform vec4 uMovementValue;uniform vec4 uStrengthValue;uniform vec4 uPeriodValue;out vec4 vWaveParams;void filterMain(float lifetime){const float pi2=3.14159265;vWaveParams=vec4(getValueFromTime(lifetime,uPeriodValue)*pi2,getValueFromTime(lifetime,uMovementValue)*pi2,getValueFromTime(lifetime,uStrengthValue),0.);}",nO="uniform sampler2D uBloomBlur;uniform vec4 uBloomParams;vec4 filterMain(vec2 coord,sampler2D tex){const vec3 gamma=vec3(1./2.2);vec4 c1=texture2D(tex,coord);vec4 bloomColor=texture2D(uBloomBlur,coord);float alpha=max(c1.a,bloomColor.a);vec3 color=max(c1.rgb*c1.a,bloomColor.rgb*bloomColor.a)/alpha*uBloomParams.y+bloomColor.rgb*uBloomParams.x;return vec4(color,alpha);}",oO="uniform vec4 uColorThreshold;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);vec3 color=c1.rgb*c1.a;vec3 s=step(uColorThreshold.xyz,color);float m=min(s.r+s.g+s.b,1.);return c1*m;}",aO="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",sO="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=ACESToneMapping(finalColor);}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",uO="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussH(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[9];offsets[0]=-4.0;offsets[1]=-3.0;offsets[2]=-2.0;offsets[3]=-1.0;offsets[4]=0.0;offsets[5]=1.0;offsets[6]=2.0;offsets[7]=3.0;offsets[8]=4.0;float weights[9];weights[0]=0.01621622;weights[1]=0.05405405;weights[2]=0.12162162;weights[3]=0.19459459;weights[4]=0.22702703;weights[5]=0.19459459;weights[6]=0.12162162;weights[7]=0.05405405;weights[8]=0.01621622;for(int i=0;i<9;i++){vec2 offset=vec2(offsets[i]*2.0*(1.0/_TextureSize.x),0);color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussH(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",cO="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussV(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[5];offsets[0]=-3.23076923;offsets[1]=-1.38461538;offsets[2]=0.0;offsets[3]=1.38461538;offsets[4]=3.23076923;float weights[5];weights[0]=0.07027027;weights[1]=0.31621622;weights[2]=0.22702703;weights[3]=0.31621622;weights[4]=0.07027027;for(int i=0;i<5;i++){vec2 offset=vec2(0,offsets[i]*(1.0/_TextureSize.y));color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussV(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",lO="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform sampler2D _GaussianDownTex;uniform vec2 _GaussianDownTextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=1;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec3 lowResColor=GaussNxN(_MainTex,uv,0.5/_GaussianDownTextureSize,1.0);vec3 highResColor=GaussNxN(_GaussianDownTex,uv,1.0/_GaussianDownTextureSize,1.0);vec3 color=mix(highResColor,lowResColor,0.7);gl_FragColor=vec4(color,1.0);}",fO="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainColor=texture2D(_MainTex,uv);mainColor.rgb=pow(mainColor.rgb,vec3(2.2));float brightness=max(mainColor.r,max(mainColor.g,mainColor.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainColor.rgb*=w;gl_FragColor=vec4(mainColor.rgb,1.0);}",hO=function(t){function r(r,i){var n=t.call(this,r,i)||this,o=n.renderer.engine,a=wb.create(o,{mode:xS.TRIANGLE_STRIP,attributes:{aPos:{type:xS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=yb.create(o,{shader:{vertex:aO,fragment:fO,glslVersion:e.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=kb.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}return tS(r,t),r.prototype.configure=function(e){this.mainTexture=e.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,e.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(t){t.clear({colorAction:e.TextureStoreAction.clear,depthAction:e.TextureStoreAction.clear,stencilAction:e.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var r=t.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",r),t.renderMeshes([this.screenMesh])},r}(Wb),pO=function(t){function r(r,i,n){var o=t.call(this,r,n)||this;o.type=i;var a=o.renderer.engine,s="PostProcess",u=wb.create(a,{name:s,mode:xS.TRIANGLE_STRIP,attributes:{aPos:{type:xS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:aO,fragment:"H"==i?uO:cO,glslVersion:e.GLSLVersion.GLSL1},l=yb.create(a,{name:s,shader:c});return l.blending=!1,l.depthTest=!1,l.culling=!1,o.screenMesh=kb.create(a,{name:s,geometry:u,material:l,priority:0}),o.priority=5e3,o}return tS(r,t),r.prototype.configure=function(e){this.mainTexture=e.getFrameBuffer().getColorTextures()[0],e.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(t){t.clear({colorAction:e.TextureStoreAction.clear,depthAction:e.TextureStoreAction.clear,stencilAction:e.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",TO(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFrameBuffer().getColorTextures()[0])},r}(Wb),dO=function(t){function r(e,r){var i=t.call(this,e,r)||this,n="PostProcess",o=i.renderer.engine,a=wb.create(o,{name:n,mode:xS.TRIANGLE_STRIP,attributes:{aPos:{type:xS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s={vertex:aO,fragment:lO},u=yb.create(o,{name:n,shader:s});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=kb.create(o,{name:n,geometry:a,material:u,priority:0}),i.priority=5e3,i}return tS(r,t),r.prototype.configure=function(e){this.mainTexture=e.getFrameBuffer().getColorTextures()[0],e.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(t){t.clear({colorAction:e.TextureStoreAction.clear,depthAction:e.TextureStoreAction.clear,stencilAction:e.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",TO(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},r}(Wb),mO=function(t){function r(r,i){var n=t.call(this,r,{})||this,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new jb(a);var s=wb.create(a,{name:o,mode:xS.TRIANGLE_STRIP,attributes:{aPos:{type:xS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=yb.create(a,{name:o,shader:{vertex:aO,fragment:sO,glslVersion:e.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=kb.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}return tS(r,t),r.prototype.configure=function(e){this.mainTexture=e.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),e.setFrameBuffer(null)},r.prototype.execute=function(t){t.clear({colorAction:e.TextureStoreAction.clear,depthAction:e.TextureStoreAction.clear,stencilAction:e.TextureStoreAction.clear});var r=t.renderingData.currentFrame.globalVolume,i=r.bloomIntensity,n=r.brightness,o=r.saturation,a=r.contrast,s=r.useBloom,u=r.useToneMapping;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",n),this.screenMesh.material.setFloat("_Saturation",o),this.screenMesh.material.setFloat("_Contrast",a),this.screenMesh.material.setInt("_UseBloom",s),s&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i)),this.screenMesh.material.setInt("_UseToneMapping",u),t.renderMeshes([this.screenMesh])},r}(Wb),vO={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,useToneMapping:1},yO="_effects_default_",gO=1,xO=function(){function t(t){var r;this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=t.camera,n=t.keepColorBuffer,o=t.renderer,a=t.editorTransform,s=void 0===a?[1,1,0,0]:a,u=t.globalVolume,c=t.clearAction,l=void 0===c?{colorAction:e.TextureLoadAction.whatever,stencilAction:e.TextureLoadAction.clear,depthAction:e.TextureLoadAction.whatever}:c,f=o.engine;u&&(this.globalVolume=rS(rS({},vO),u)),this.globalUniforms=new _O;var h,p=[],d={};if(this.renderer=o,this.globalVolume){var m=this.globalVolume.useHDR?xS.HALF_FLOAT:xS.UNSIGNED_BYTE;p=[{texture:{format:xS.RGBA,type:m,magFilter:xS.LINEAR,minFilter:xS.LINEAR}}],h={storageType:e.RenderPassAttachmentStorageType.depth_stencil_opaque},d={colorAction:e.TextureLoadAction.clear,stencilAction:e.TextureLoadAction.clear,depthAction:e.TextureLoadAction.clear}}var v=[new Wb(o,{name:yO,priority:zb,meshOrder:e.OrderType.ascending,depthStencilAttachment:h,attachments:p,clearAction:d})];if(this.setRenderPasses(v),this.globalVolume){var y=this.globalVolume.useBloom,g=new jb(f);if(y){var x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],T=new Array(7),E=(m=this.globalVolume.useHDR?xS.HALF_FLOAT:xS.UNSIGNED_BYTE,new hO(o,{name:"BloomThresholdPass",attachments:[{texture:{format:xS.RGBA,type:m,minFilter:xS.LINEAR,magFilter:xS.LINEAR}}]}));E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){T[_]=new jb(f);var S=new pO(o,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:xS.RGBA,type:m,minFilter:xS.LINEAR,magFilter:xS.LINEAR}}]}),A=new pO(o,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:xS.RGBA,type:m,minFilter:xS.LINEAR,magFilter:xS.LINEAR}}]});A.gaussianResult=T[_],this.addRenderPass(S),this.addRenderPass(A),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(_=0;_<6;_++){var R=new dO(o,{name:"GaussianUpPass"+_,viewport:x,attachments:[{texture:{format:xS.RGBA,type:m,minFilter:xS.LINEAR,magFilter:xS.LINEAR}}]});R.gaussianDownSampleResult=T[5-_],this.addRenderPass(R),x[2]*=2,x[3]*=2}}var C=void 0;C=y?new mO(o,g):new mO(o),this.addRenderPass(C)}this.semantics=new Lb(t.semantics),this.clearAction=l,this.name="RenderFrame".concat(gO++);var b=v[0],O={type:xS.UNSIGNED_BYTE,format:xS.RGBA,internalFormat:xS.RGBA,wrapS:xS.MIRRORED_REPEAT,wrapT:xS.MIRRORED_REPEAT,minFilter:xS.NEAREST,magFilter:xS.NEAREST};this.emptyTexture=ob.create(f,rS({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:e.TextureSourceType.data},O)),this.transparentTexture=ob.create(f,rS({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:e.TextureSourceType.data},O)),this.camera=i,this.keepColorBuffer=n,this.renderPassInfoMap.set(b,{listStart:0,listEnd:0,renderPass:b,intermedia:!1}),this.editorTransform=s,t.clearAction||this.resetClearActions(),this.passTextureCache=new Ob(f);var L=f.gpuCapability,I=L.detail,w=Ab(L.level,I.readableDepthStencilTextures&&I.writableFragDepth);null===(r=this.renderer.getShaderLibrary())||void 0===r||r.addShader(w)}return Object.defineProperty(t.prototype,"editorTransform",{get:function(){return this._editorTransform},set:function(e){this._editorTransform=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderPasses",{get:function(){return this._renderPasses.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.addMeshToDefaultRenderPass=function(e){for(var t=this.renderPasses,r=this.renderPassInfoMap,i=e.priority,n=1;n<t.length;n++){var o=t[n-1],a=r.get(t[n]),s=r.get(o);if(a&&s&&(a.listStart>i&&(i>s.listEnd||1===n)))return this.addToRenderPass(o,e)}for(var u=t.length-1,c=t[u];u>=0&&!c.name.includes(yO);)c=t[--u];return this.addToRenderPass(c,e)},t.prototype.removeMeshFromDefaultRenderPass=function(t){for(var r,i,n,o=this,a=this.renderPasses,s=this.renderPassInfoMap,u=a.length-1;u>=0;u--){var c=a[u],l=s.get(c);if(l&&(l.listStart<=t.priority&&l.listEnd>=t.priority)){var f=c.meshes.indexOf(t);if(-1===f)return;var h=1===f&&c.meshes[0].name===Tb;if(c.removeMesh(t),h){var p=a[u+1],d=c.meshes;l.intermedia||null===(r=l.preRenderPass)||void 0===r||r.resetColorAttachments([]);for(var m=1;m<d.length;m++)null===(i=l.preRenderPass)||void 0===i||i.addMesh(d[m]);var v=null===(n=c.attachments[0])||void 0===n?void 0:n.texture,y=v===this.resource.color_a||v===this.resource.color_b;c.dispose({meshes:e.DestroyOptions.keep,colorAttachment:y?e.RenderPassDestroyAttachmentType.keep:e.RenderPassDestroyAttachmentType.destroy,depthStencilAttachment:e.RenderPassDestroyAttachmentType.keep}),zS(a,c),this.removeRenderPass(c),s.delete(c),p&&this.updateRenderInfo(p),l.preRenderPass&&this.updateRenderInfo(l.preRenderPass),l.prePasses&&l.prePasses.forEach((function(t){if(o.removeRenderPass(t.pass),!1!==(null==t?void 0:t.destroyOptions)){t.pass.attachments.forEach((function(e){e.texture===o.resource.color_b&&e.texture===o.resource.color_a||e.texture.dispose()}));var r=rS(rS({},(null==t?void 0:t.destroyOptions)?t.destroyOptions:{}),{depthStencilAttachment:e.RenderPassDestroyAttachmentType.keep});t.pass.dispose(r)}})),this.resetRenderPassDefaultAttachment(a,Math.max(u-1,0)),1===a.length&&(a[0].resetColorAttachments([]),this.removeRenderPass(this.resource.finalCopyRP))}return this.resetClearActions()}}},t.prototype.splitDefaultRenderPassByMesh=function(t,r){var i,n,o,a=this.findMeshRenderPassIndex(t),s=this.renderPasses[a];this.createResource();var u=s.meshes.indexOf(t),c=s.meshes.slice(0,u),l=s.meshes.slice(u),f=this.renderPassInfoMap;if(!(null===(i=r.attachments)||void 0===i?void 0:i.length))throw Error("should include at least one color attachment");var h=this.renderPasses,p=h.indexOf(s);h[p-1],zS(h,s);var d=f.get(s);f.delete(s);var m=2===this.renderer.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,v=new Wb(this.renderer,{name:yO+p,priority:s.priority,attachments:[{texture:{sourceType:e.TextureSourceType.framebuffer,format:xS.RGBA,name:"frame_a",minFilter:m,magFilter:m}}],clearAction:s.clearAction||{colorAction:e.TextureLoadAction.clear},storeAction:s.storeAction,depthStencilAttachment:this.resource.depthStencil,meshes:c,meshOrder:e.OrderType.ascending});l.unshift(this.createCopyMesh());var y=this.renderPasses;y[a]=v;var g=[],x=l.slice();r.prePasses&&(r.prePasses.forEach((function(e,t){e.priority=s.priority+1+t,e.setMeshes(l),g.push(e)})),y.splice.apply(y,sS([a+1,0],aS(g),!1)),x.splice(0,2));var T=this.resource.finalCopyRP;y.includes(T)||y.push(T);var E=g[g.length-1];E.initialize(this.renderer);var _=new Wb(this.renderer,{name:yO+(p+1),priority:s.priority+1+((null===(n=r.prePasses)||void 0===n?void 0:n.length)||0),meshes:x,meshOrder:e.OrderType.ascending,depthStencilAttachment:this.resource.depthStencil,storeAction:r.storeAction,clearAction:{depthAction:e.TextureLoadAction.whatever,stencilAction:e.TextureLoadAction.whatever,colorAction:e.TextureLoadAction.whatever}});return y.splice(a+1+((null===(o=r.prePasses)||void 0===o?void 0:o.length)||0),0,_),this.setRenderPasses(y),this.updateRenderInfo(E),this.updateRenderInfo(v),this.updateRenderInfo(_),f.get(v).prePasses=d.prePasses,g.pop(),f.get(E).prePasses=g.map((function(e,t){return{pass:e,destroyOptions:!1}})),this.resetClearActions(),E},t.prototype.dispose=function(t){var r,i;(null==t?void 0:t.semantics)!==e.DestroyOptions.keep&&this.semantics.dispose();var n=(null==t?void 0:t.passes)?t.passes:void 0;n!==e.DestroyOptions.keep&&this._renderPasses.forEach((function(e){e.dispose(n)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null===(i=null===(r=this.resource.depthStencil)||void 0===r?void 0:r.texture)||void 0===i||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},t.prototype.resetRenderPassDefaultAttachment=function(e,t){for(var r,i,n,o=this.resource,a=o.color_a,s=o.color_b,u=t;u<e.length;u++){var c=e[u],l=null===(r=c.attachments[0])||void 0===r?void 0:r.texture;if(l&&n===l){var f=l===a?s:a;c.resetColorAttachments([f])}(l=null===(i=c.attachments[0])||void 0===i?void 0:i.texture)&&(n=l)}},t.prototype.findMeshRenderPassIndex=function(e){var t=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(yO)||!r.meshes.includes(e)||(t=i,!1)})),t},t.prototype.addToRenderPass=function(e,t){var r=this.renderPassInfoMap.get(e),i=t.priority;0===e.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),e.addMesh(t)},t.prototype.getRPAttachments=function(e,t){var r;if(1===(null==e?void 0:e.length)){var i=e[0],n=i.texture,o=i.persistent,a=n.format,s=null!==(r=null==t?void 0:t.getInitAttachments())&&void 0!==r?r:[];if(a===xS.RGBA&&!o){var u=this.resource.color_a;return 0===s.length?[{texture:u}]:[{texture:s[0].texture===u?this.resource.color_b:u}]}}return e},t.prototype.resetClearActions=function(){var t=this.renderPasses.length>1?e.TextureLoadAction.clear:e.TextureLoadAction.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=e.TextureLoadAction.whatever)},t.prototype.updateRenderInfo=function(t){var r,i=this,n=this.renderPassInfoMap,o=this.renderPasses;n.has(t)?r=n.get(t):(r={intermedia:!1,renderPass:t,listStart:0,listEnd:0},n.set(t,r)),r.intermedia=t.attachments.length>0;var a=t.meshes;a[0]?(r.listStart=(a[0].name===Tb?a[1]:a[0]).priority,r.listEnd=a[a.length-1].priority):(r.listStart=0,r.listEnd=0);var s=o.indexOf(t),u=0===s?e.TextureLoadAction.clear:e.TextureLoadAction.whatever;return 0===s&&(t.clearAction.colorAction=e.TextureLoadAction.clear),t.clearAction.depthAction=u,t.clearAction.stencilAction=u,s>-1?t.semantics.setSemantic("EDITOR_TRANSFORM",(function(){return i.editorTransform})):t.semantics.setSemantic("EDITOR_TRANSFORM",void 0),r.preRenderPass=o[s-1],r},t.prototype.setRenderPasses=function(e){var t=this;void 0!==this.renderer&&e.forEach((function(e){return e.initialize(t.renderer)})),this._renderPasses=e.slice()},t.prototype.addRenderPass=function(e){void 0!==this.renderer&&e.initialize(this.renderer),this._renderPasses.push(e)},t.prototype.createResource=function(){var t,r=this.renderer.engine;if(!this.resource){var i=r.gpuCapability,n=i.detail,o=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?xS.LINEAR:xS.NEAREST,c=ob.create(r,{sourceType:e.TextureSourceType.framebuffer,format:xS.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=ob.create(r,{sourceType:e.TextureSourceType.framebuffer,format:xS.RGBA,data:{width:a,height:s},minFilter:u,magFilter:u,name:"frame_b"}),f=n.readableDepthStencilTextures&&n.writableFragDepth?e.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:e.RenderPassAttachmentStorageType.depth_stencil_opaque,h=new Wb(this.renderer,{depthStencilAttachment:{storageType:f},attachments:[{texture:c}]}).initialize(this.renderer),p=new EO(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:e.TextureLoadAction.clear,stencilAction:e.TextureLoadAction.clear,colorAction:e.TextureLoadAction.clear},meshOrder:e.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null===(t=h.getDepthAttachment())||void 0===t?void 0:t.texture})]});this.resource={color_a:h.attachments[0].texture,color_b:l,finalCopyRP:p,depthStencil:h.depthAttachment,resRP:h}}},t.prototype.createCopyMesh=function(e){var t=Tb,r=this.renderer.engine,i=wb.create(r,{name:t,mode:xS.TRIANGLE_STRIP,attributes:{aPos:{type:xS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=Ab(r.gpuCapability.level,!!(null==e?void 0:e.depthTexture));this.renderer.getShaderLibrary().addShader(n);var o=yb.create(r,{uniformValues:{uDepth:null==e?void 0:e.depthTexture},name:t,shader:n});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==e?void 0:e.blend)&&(o.blending=!0,o.blendFunction=[xS.SRC_ALPHA,xS.ONE_MINUS_SRC_ALPHA,xS.SRC_ALPHA,xS.ONE_MINUS_SRC_ALPHA]),kb.create(r,{name:t,geometry:i,material:o,priority:0})},t.prototype.removeRenderPass=function(e){zS(this._renderPasses,e)},t}();function TO(e){return e?[e.getWidth(),e.getHeight()]:[0,0]}var EO=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],e.setFrameBuffer(null)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",TO(this.prePassTexture)),e.renderMeshes(this.meshes),this.storeAction&&e.clear(this.storeAction)},t}(Wb),_O=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},SO=function(){function e(e){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var t=e.storageType,r=e.format,i=e.attachment;this.storageType=t,this.format=r,this.attachment=i}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e}(),AO="function"==typeof WebGL2RenderingContext,RO=function(){function e(e){this.setupCapability(e)}return e.prototype.setupCapability=function(e){var t,r=AO&&e instanceof WebGL2RenderingContext?2:1,i=2===r,n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=e.getExtension("WEBGL_depth_texture"),a=!!e.getExtension("OES_texture_half_float_linear"),s=!!e.getExtension("OES_texture_float_linear");this.level=r,this.type=i?"webgl2":"webgl",this.vaoExt=e.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=e.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=e.UNSIGNED_INT_24_8,this.drawBufferExtension=e.getExtension("WEBGL_draw_buffers"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),i&&!a&&(a=CO(e,e.HALF_FLOAT)),i&&!s&&(s=CO(e,e.FLOAT)),this.internalFormatDepth16=i?e.DEPTH_COMPONENT16:e.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=i?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL;var u=i||e.getExtension("OES_texture_float")?e.FLOAT:0,c=i?WebGL2RenderingContext.HALF_FLOAT:(null===(t=e.getExtension("OES_texture_half_float"))||void 0===t?void 0:t.HALF_FLOAT_OES)||0,l={floatTexture:u,halfFloatTexture:c,maxSample:i?e.getParameter(e.MAX_SAMPLES):1,maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:i?!!e.getExtension("EXT_color_buffer_float"):u>0&&!!e.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:i?!!e.getExtension("EXT_color_buffer_float"):c>0&&!!e.getExtension("EXT_color_buffer_half_float"),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxShaderTexCount:e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:IO(e),halfFloatLinear:a,floatLinear:s,maxTextureAnisotropy:n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:i||!!e.getExtension("EXT_shader_texture_lod"),instanceDraw:i||!!e.getExtension("ANGLE_instanced_arrays"),drawBuffers:i||!!this.drawBufferExtension,asyncShaderCompile:!!e.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!e.getExtension("OES_element_index_uint"),standardDerivatives:i||!!e.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:i||!!o,writableFragDepth:i||!!e.getExtension("EXT_frag_depth")};this.detail=l,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.prototype.framebufferTexture2D=function(e,t,r,i,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&r>0)throw new Error("draw multiple color buffers not available");var a=o?o["COLOR_ATTACHMENT".concat(r,"_WEBGL")]:e["COLOR_ATTACHMENT".concat(r)];a?e.framebufferTexture2D(t,a,i,n,0):console.error("invalid color attachment index: "+r)},e.prototype.drawBuffers=function(e,t){var r=this.drawBufferExtension;if(1!==this.level||r){var i=t.map((function(t,i){return t?r?r["COLOR_ATTACHMENT".concat(i,"_WEBGL")]:e["COLOR_ATTACHMENT".concat(i)]:e.NONE}));r?r.drawBuffersWEBGL(i):e.drawBuffers(i)}else if(t.length>1)throw Error("draw buffers not available")},e.prototype.setTextureAnisotropic=function(e,t,r){var i=this.detail.maxTextureAnisotropy;i&&e.texParameterf(t,this.textureMaxAnisotropyExt,Math.min(i,r||4))},e}();function CO(e,t){var r=e.createTexture(),i=!1;return e.getError(),e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.R16F,1,1,0,e.RED,t,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.getError()||(i=!0),e.deleteTexture(r),i}var bO,OO,LO={NONE:0,PVRTC:1,ASTC:2};function IO(e){return e.getExtension("WEBGL_compressed_texture_astc")?LO.ASTC:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?LO.PVRTC:LO.NONE}e.FilterMode=void 0,(bO=e.FilterMode||(e.FilterMode={}))[bO.Nearest=0]="Nearest",bO[bO.Linear=1]="Linear",e.RenderTextureFormat=void 0,(OO=e.RenderTextureFormat||(e.RenderTextureFormat={}))[OO.RGBA32=0]="RGBA32",OO[OO.RGBAHalf=1]="RGBAHalf";var wO=function(){function e(){}return e.prototype.resize=function(e,t,r,i){},e.prototype.resetColorTextures=function(e){},e.prototype.unbind=function(){},e.prototype.bind=function(){},Object.defineProperty(e.prototype,"stencilStorage",{get:function(){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthStorage",{get:function(){},enumerable:!1,configurable:!0}),e.prototype.getDepthTexture=function(){},e.prototype.getStencilTexture=function(){},e.prototype.getColorTextures=function(){return[]},e.prototype.dispose=function(e){},e}(),PO=function(){function e(){}return e.prototype.setGlobalFloat=function(e,t){},e.prototype.setGlobalInt=function(e,t){},e.prototype.setGlobalMatrix=function(e,t){},e.prototype.getFrameBuffer=function(){return null},e.prototype.setFrameBuffer=function(e){},e.prototype.setViewport=function(e,t,r,i){},e.prototype.resize=function(e,t){},e.prototype.clear=function(e){},e.prototype.getWidth=function(){return 0},e.prototype.getHeight=function(){return 0},e.prototype.addLostHandler=function(e){},e.prototype.addRestoreHandler=function(e){},e.prototype.lost=function(e){},e.prototype.restore=function(){},e.prototype.getShaderLibrary=function(){},e.prototype.renderRenderFrame=function(e){},e.prototype.renderMeshes=function(e){},e.prototype.drawGeometry=function(e,t){},e.prototype.getTemporaryRT=function(e,t,r,i,n,o){return null},e.prototype.dispose=function(e){},e}(),MO=1,VO=function(){function t(e,t,r,i){this.transform=r,this.engine=i,this.color=e.options.previewColor;var n=this.createMaterial(t),o=this.createGeometry();this.mesh=this.createMesh(o,n),this.updateMesh()}return t.prototype.updateMesh=function(){var e=this.mesh.material,t=e.getVector2("uSize").slice(),r=e.getVector4("uPos").slice(),i=e.getVector4("uQuat").slice(),n=sS([],aS(this.transform.scale),!1);this.transform.assignWorldTRS(r,i,n),t[0]=n[0],t[1]=n[1],e.setVector2("uSize",t),e.setVector4("uPos",r),e.setVector4("uQuat",i)},t.prototype.createMaterial=function(t){var r,i=[["ENV_EDITOR",(null===(r=this.engine.renderer)||void 0===r?void 0:r.env)===dS]],n=KR(this.color).getValue(0),o=this.engine.gpuCapability.level,a={shader:{vertex:HC(i,"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",e.ShaderType.vertex,o),fragment:HC(i,"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n",e.ShaderType.fragment,o),glslVersion:e.GLSLVersion.GLSL1,cacheId:"".concat(t.cachePrefix,"_effects_interact")},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},s=yb.create(this.engine,a);return s.depthTest=!1,s.setVector4("uPos",[0,0,0,0]),s.setVector2("uSize",[1,1]),s.setVector4("uColor",[n[0]/255,n[1]/255,n[2]/255,n[3]]),s.setVector4("uQuat",[0,0,0,0]),s},t.prototype.createGeometry=function(){var e=new Uint8Array([0,1,1,2,2,3,3,0]);return wb.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:e.length,indices:{data:e},mode:xS.LINES,maxVertex:4})},t.prototype.createMesh=function(e,t){return kb.create(this.engine,{name:"Interact_preview"+MO++,priority:0,worldMatrix:PA(),geometry:e,material:t})},t}(),NO=function(t){function r(e,r){var i,n=t.call(this,e,r)||this;return n.engine=null===(i=n.composition)||void 0===i?void 0:i.getEngine(),n}return tS(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return wS.interact},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(e){this.ui=e.content},r.prototype.onLifetimeBegin=function(e){var t,r,i,n=this.ui.options,o=(null!==(r=null===(t=this.engine)||void 0===t?void 0:t.renderer)&&void 0!==r?r:{}).env;null===(i=this.composition)||void 0===i||i.addInteractiveItem(this,n.type),n.type===LS.DRAG&&(o!==dS||n.enableInEditor)&&e.event&&this.beginDragTarget(n,e.event)},r.prototype.onItemUpdate=function(){var e;if(null===(e=this.previewContent)||void 0===e||e.updateMesh(),this.dragEvent&&this.bouncingArg){this.bouncingArg.vx*=.95,this.bouncingArg.vy*=.95,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,FO(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg)}},r.prototype.onItemRemoved=function(e){var t;e.removeInteractiveItem(this,this.ui.options.type),this.clickable=!1,null===(t=this.previewContent)||void 0===t||t.mesh.dispose(),this.endDragTarget()},r.prototype.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),r=LR([0,0,0],.5,.5);return r.forEach((function(e){e.forEach((function(e){cR(e,e,t)}))})),{type:e.HitTestType.triangle,area:r}},r.prototype.getHitTestParams=function(){if(this.clickable){var e=this.ui.options.behavior,t=this.getBoundingBox();return t?{type:t.type,triangles:t.area,behavior:e}:void 0}},r.prototype.doCreateContent=function(e){var t,r=this.ui.options,i=r.type,n=r.showPreview,o=this.engine,a=(null!==(t=null==o?void 0:o.renderer)&&void 0!==t?t:{}).env;if(rA(o),i===LS.CLICK&&(this.clickable=!0,n&&a===dS)){var s=e.getRendererOptions();this.previewContent=new VO(this.ui,s,this.transform,o)}return{}},r.prototype.beginDragTarget=function(e,t){var r=this;if("camera"===e.target){var i,n={touchstart:function(e){var t;r.dragEvent=null,r.bouncingArg=null;var n=null===(t=r.composition)||void 0===t?void 0:t.camera;i={x:e.x,y:e.y,cameraParam:{position:(null==n?void 0:n.position)||[0,0,8],fov:(null==n?void 0:n.fov)||60}}},touchmove:function(e){r.handleDragMove(i,e),r.bouncingArg=e},touchend:function(e){var t=r.bouncingArg;if(!FO(t,3)&&t){t.vx*=5,t.vy*=5,r.dragEvent=rS({},i)}i=null}};Object.keys(n).forEach((function(e){t.addEventListener(e,n[e])})),n.touchmove({dx:0,dy:0,width:1,height:1}),this.endDragTarget=function(){Object.keys(n).forEach((function(e){t.removeEventListener(e,n[e])}))}}},r.prototype.endDragTarget=function(){},r.prototype.handleDragMove=function(e,t){var r,i;if(e&&e.cameraParam&&this.composition){var n=this.ui.options,o=e.cameraParam,a=o.position,s=o.fov,u=t.dy,c=t.dx*t.width/t.height,l=a[2],f=Math.tan(s*Math.PI/180/2)*Math.abs(l),h=u*f,p=c*f,d=a[0]-p,m=a[1]-h;if(n.dxRange){var v=aS(n.dxRange,2);(d=SA(d,y=v[0],g=v[1]))!==y&&d!==g&&y!==g&&(null===(r=t.origin)||void 0===r||r.preventDefault())}if(n.dyRange){var y,g,x=aS(n.dyRange,2);(m=SA(m,y=x[0],g=x[1]))!==y&&m!==g&&y!==g&&(null===(i=t.origin)||void 0===i||i.preventDefault())}this.composition.camera.position=[d,m,l]}},r}(EC);function FO(e,t){var r=1e-5*(t||1);return e&&Math.abs(e.vx||0)<r&&Math.abs(e.vy||0)<r}var DO=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.mesh=[],t}return tS(t,e),t.prototype.onCompositionItemLifeBegin=function(e,t){t instanceof NO&&t.previewContent&&this.addMesh(t.previewContent.mesh)},t.prototype.onCompositionItemRemoved=function(e,t){t instanceof NO&&t.previewContent&&this.removeMesh(t.previewContent.mesh,e.renderFrame)},t.prototype.prepareRenderFrame=function(e,t){return this.mesh&&this.mesh.forEach((function(e){return t.addMeshToDefaultRenderPass(e)})),this.mesh=[],!1},t.prototype.addMesh=function(e){this.mesh.push(e)},t.prototype.removeMesh=function(e,t){t.removeMeshFromDefaultRenderPass(e)},t}(LC),UO=function(){};e.maxSpriteMeshItemCount=8,e.maxSpriteTextureCount=8;var BO=1,kO=function(){function t(e,t,r){this.engine=e,this.composition=r,this.items=[],this.dirty=!1;var i=t.wireframe,n=this.createGeometry(i?xS.LINES:xS.TRIANGLES),o=this.createMaterial(t,2);this.wireframe=i,this.mesh=kb.create(e,{name:"MSprite"+BO++,priority:0,worldMatrix:PA(),geometry:n,material:o})}return t.prototype.setItems=function(t){var r,i,n,o,a=[],s=[],u=2,c=0,l=0,f=0;if(!t.length)return this.mesh.setVisible(!0),!0;this.items=t.slice(),t.length>2&&(u=e.maxSpriteMeshItemCount);var h=t[0].renderInfo;this.mtlSlotCount!==u&&this.mesh.setMaterial(this.createMaterial(h,u),{textures:e.DestroyOptions.keep});var p=null!==(o=null===(n=null===(i=null===(r=null==h?void 0:h.filter)||void 0===r?void 0:r.passSplitOptions)||void 0===i?void 0:i.attachments)||void 0===n?void 0:n.length)&&void 0!==o?o:0;this.splitLayer=p>0;for(var d=0;d<t.length;d++){(R=null==(m=t[d])?void 0:m.renderer.texture)&&kS(s,R),m.mesh=this}for(d=0;d<t.length;d++){var m,v=(R=null==(m=t[d])?void 0:m.renderer.texture)?s.indexOf(R):-1,y=this.getItemInitData(m,d,f,v);c+=y.aPoint.length,l+=y.index.length,a.push(y),f+=y.aPoint.length/6,this.updateItem(m,!0)}var g={aPoint:new Float32Array(c),index:new Uint16Array(l)},x={aPoint:0,index:0},T=function(e){var t=a[e];Object.keys(g).forEach((function(e){var r=g[e],i=t[e];r.set(i,x[e]),x[e]+=i.length}))};for(d=0;d<a.length;d++)T(d);var E=this.mesh,_=E.material,S=E.geometry,A=g.index;S.setIndexData(A),S.setAttributeData("aPoint",g.aPoint),S.setDrawCount(l),this.mesh.setVisible(!S.getDrawCount()),this.mesh.priority=t[0].listIndex;for(d=0;d<s.length;d++){var R=s[d];_.setTexture("uSampler"+d,R)}for(var C=t[0].emptyTexture,b=s.length;b<e.maxSpriteMeshItemCount;b++)_.setTexture("uSampler"+b,C);if(this.splitLayer){var O=function(e,t){var r;if(t){for(var i=128,n=new Uint8Array(i),o=0,a=i-1;o<i;o++){var s=o/a,u=t.getValue(s);n[o]=Math.round(255*u)}r=ob.createWithData(e,{width:i,height:1,data:n},{name:"feather",format:xS.LUMINANCE,minFilter:xS.LINEAR,magFilter:xS.LINEAR,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE})}else r=ob.createWithData(e);return r}(this.engine,t[0].feather);_.setTexture("uFeatherSampler",O)}},t.prototype.updateItem=function(e,t){var r=this.items.indexOf(e);if(!(r<=-1)){var i=this.mesh.material.getVector4Array("uTexParams"),n=4*r,o=e.getRenderData(e.time,t),a=this.mesh.material.getMatrixArray("uMainData"),s=16*r,u=s,c=s+4,l=s+8,f=s+12;if(o.visible){var h=[0,0,0,0],p=[1,1,1,0],d=[0,0,1,1],m=o.color||[a[f],a[f+1],a[f+2],a[f+3]];o.transform.assignWorldTRS(h,d,p);for(var v=0;v<4;v++)a[u+v]=h[v],a[l+v]=d[v],a[c+v]=p[v],a[f+v]=m[v];if(p[2]=o.life,a[c+2]=o.life,t){var y=e.renderer;i[n]=y.occlusion?+y.transparentOcclusion:1,i[n+2]=y.renderMode,i[n+1]=+this.preMultiAlpha}if(o.texOffset){var g=this.mesh.material.getVector4Array("uTexOffset");for(v=0;v<4;v++)g[4*r+v]=o.texOffset[v]}}else a[c+2]=-1}},t.prototype.applyChange=function(){this.dirty&&(this.setItems(this.items),this.dirty=!1)},t.prototype.getItemInitData=function(e,t,r,i){var n=e.geoData;this.lineMode?n=this.getItemGeometryData(e,t):n||(n=e.geoData=this.getItemGeometryData(e,t));var o=n.aPoint;if(o[4]!==t||o[5]!==i)for(var a=0;a<o.length;a+=6)o[a+4]=t,o[a+5]=i;var s=n.index,u=s.length,c=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new s.constructor(u);if(!this.wireframe)for(a=0;a<u;a++)c[a]=r+s[a];return{aPoint:n.aPoint,index:c}},t.prototype.getItemRegionData=function(e){var t=this.items.indexOf(e);if(t>-1){var r=this.mesh.material.getMatrixArray("uMainData"),i=16*t;if(null===r)return;return{position:[r[i]||0,r[i+1]||0,r[i+2]||0],size:[r[i+4],r[i+5]],quat:[r[i+8],r[i+9],r[i+10],r[i+11]],color:[r[i+12],r[i+13],r[i+14],r[i+15]]}}},t.prototype.invalidMaterial=function(){this.mtlSlotCount=0},t.prototype.createGeometry=function(t){var r=Float32Array.BYTES_PER_ELEMENT;return wb.create(this.engine,{attributes:{aPoint:{size:4,offset:0,stride:uS*r,releasable:!0,type:xS.FLOAT,data:new Float32Array(0)},aIndex:{size:2,offset:4*r,stride:uS*r,dataSource:"aPoint",type:xS.FLOAT}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:4*e.maxSpriteMeshItemCount})},t.prototype.createMaterial=function(e,t){var r,i,n,o=e.filter,a=e.side,s=e.occlusion,u=e.blending,c=e.maskMode,l=e.mask,f=(null==o?void 0:o.mesh)||{},h=this.engine,p={shader:XO(e,t,h.gpuCapability.level,null===(n=h.renderer)||void 0===n?void 0:n.env)};this.preMultiAlpha=GC(u),this.mtlSlotCount=t;var d=yb.create(h,p),m=rS({side:a,blending:!0,blendMode:u,mask:l,maskMode:c,depthTest:!0,depthMask:s},f.materialStates);d.blending=m.blending,d.stencilRef=void 0!==m.mask?[m.mask,m.mask]:void 0,d.depthTest=m.depthTest,d.depthMask=m.depthMask,m.blending&&YC(d,m.blendMode),d.blendFunction=m.blendFunction,qC(d,m.maskMode),ZC(d,m.side);var v=f.uniformValues;if(v)try{for(var y=oS(Object.keys(v)),g=y.next();!g.done;g=y.next()){var x=g.value,T=v[x];T instanceof ob?d.setTexture(x,T):"number"==typeof T?d.setFloat(x,T):2===T.length?d.setVector2(x,T):4===T.length?d.setVector4(x,T):d.setMatrix(x,T)}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}for(var E=[],_=[],S=[],A=0;A<t;A++)E.push(PA()),_.push([0,0,0,0]),S.push([0,0,0,0]);return d.hasUniform("uMainData")||d.setMatrixArray("uMainData",E),d.hasUniform("uTexParams")||d.setVector4Array("uTexParams",_),d.hasUniform("uTexOffset")||d.setVector4Array("uTexOffset",S),d},t.prototype.getItemGeometryData=function(e,t){var r=e.splits,i=e.renderer,n=e.textureSheetAnimation,o=aS(e.startSize,2),a=o[0],s=o[1];if(i.shape){for(var u=i.shape,c=u.index,l=u.aPoint,f=new Float32Array(l),h=0;h<f.length;h+=6)f[h]*=a,f[h+1]*=s;return{index:c,aPoint:Array.from(f)}}var p=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],d=[],m=[],v=2,y=2;1===r.length&&(v=1,y=1);for(var g=0;g<v;g++)for(var x=0;x<y;x++){var T=4*(2*x+g),E=n?[0,0,1,1,r[0][4]]:r[2*x+g],_=E[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],S=((g+g+1)/v-1)/2,A=((x+x+1)/y-1)/2,R=E[0],C=E[1],b=E[4]?E[3]:E[2],O=E[4]?E[2]:E[3],L=[p[0]/v+S,p[1]/y+A,p[2]/v+S,p[3]/y+A,p[4]/v+S,p[5]/y+A,p[6]/v+S,p[7]/y+A];d.push(L[0]*a,L[1]*s,_[0]*b+R,_[1]*O+C,t,0,L[2]*a,L[3]*s,_[2]*b+R,_[3]*O+C,t,0,L[4]*a,L[5]*s,_[4]*b+R,_[5]*O+C,t,0,L[6]*a,L[7]*s,_[6]*b+R,_[7]*O+C,t,0),this.lineMode?m.push(T,1+T,1+T,3+T,3+T,2+T,2+T,T):m.push(T,1+T,2+T,2+T,1+T,3+T)}return{index:m,aPoint:d}},t}();function zO(e){var t,r=e.renderer,i=e.filter,n=r.blending,o=r.side,a=r.occlusion,s=r.mask,u=r.maskMode,c=r.order,l=+n,f=e.cachePrefix||"-",h=(null===(t=null==i?void 0:i.mesh)||void 0===t?void 0:t.shaderCacheId)||"$F$";return{side:o,occlusion:a,blending:n,mask:s,maskMode:u,cachePrefix:f,filter:i,cacheId:"".concat(f,".").concat(h,".").concat(+o,"+").concat(+a,"+").concat(l,"+").concat(c,"+").concat(u,".").concat(s)}}function GO(t,r,i){var n=null!=i?i:{},o=n.count,a=void 0===o?2:o,s=n.env,u=void 0===s?"":s,c=n.ignoreBlend,l=n.wireframe,f=[["MAX_ITEM_COUNT",a],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",u===dS],["ADJUST_LAYER",!!r],["USE_BLEND",!c],["MAX_FRAG_TEX",e.maxSpriteTextureCount>=16?16:8]],h=l?Hb:Zb.replace(/#pragma\s+FILTER_FRAG/,(null==r?void 0:r.fragment)||""),p=Yb.replace(/#pragma\s+FILTER_VERT/,(null==r?void 0:r.vertex)||"vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}");return{fragment:HC(f,h,e.ShaderType.fragment,t),vertex:HC(f,p,e.ShaderType.vertex,t),glslVersion:1===t?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,marcos:f,shared:!0}}function jO(e,t){return e.filter?"".concat(e.filter.mesh.shaderCacheId,"_effects_filter"):"".concat(e.cachePrefix,"_effects_sprite_").concat(t)}function XO(e,t,r,i){var n=e.filter,o=e.wireframe,a=GO(r,null==n?void 0:n.mesh,{count:t,wireframe:o,env:i});return a.shared=!0,o||(a.cacheId=jO(e,t)),a}function WO(t){e.maxSpriteMeshItemCount=t}var HO="listIndex",YO=function(){function t(e){this.composition=e,this.meshSplits=[],this.items=[],this.meshes=[],this.time=0,this.itemsToRemove=[],this.itemsToAdd=[],this.engine=e.getEngine()}return t.prototype.resetMeshSplits=function(){this.meshSplits.length=0,this.meshes.length=0,this.items.length=0,this.itemsToAdd.length=0,this.itemsToRemove.length=0},t.prototype.diffMeshSplits=function(){for(var t,r,i,n,o,a,s=this.meshSplits,u=this.itemsToRemove,c=this.itemsToAdd,l=[],f=[],h=[],p=[],d=this.items,m={layerToAdd:[]},v=[],y=0;y<u.length;y++){if(ZO(T=u[y]))l.push.apply(l,sS([],aS(this.removeMeshSplitsItem(d,T,s,u)),!1)),this.check();else{var g=d.indexOf(T);g>-1&&(d.splice(g,1),v.length=0,g>0&&(v=this.combineSplits(d,g-1,s),l.push.apply(l,sS([],aS(v),!1))),!v.length&&g<=d.length-1&&(v=this.combineSplits(d,g,s),l.push.apply(l,sS([],aS(v),!1))),this.check())}}var x=!1;for(y=0;y<c.length;y++)for(var T=c[y],E=this.addMeshSplitsItem(d,T,s),_=0;_<E.length;_++){var S=E[_];if(S.spriteMesh)throw new Error("no sprite mesh in neo split");var A=S.spriteMesh=new kO(this.engine,S.renderInfo,this.composition);f.push(A.mesh),A.setItems(S.items.map((function(e){return e.content}))),A.applyChange(),A.splitLayer&&(null===(t=m.layerToAdd)||void 0===t||t.push(A)),S.dirty=!1,this.check(),x=!0}if(x){var R,C=function(t){var u=s[t],c=s[t+1];if(c.cacheId===u.cacheId&&!(null===(r=c.spriteMesh)||void 0===r?void 0:r.splitLayer)&&!(null===(i=u.spriteMesh)||void 0===i?void 0:i.splitLayer)&&u.items.length+c.items.length<=e.maxSpriteMeshItemCount){var l=u.items[0],p=c.items[c.items.length-1],m=b.getMeshSplits(d,d.indexOf(l),d.indexOf(p));if(1===m.length){Object.keys(m[0]).forEach((function(e){u[e]=m[0][e]})),null===(n=u.spriteMesh)||void 0===n||n.setItems(u.items.map((function(e){return e.content}))),null===(o=u.spriteMesh)||void 0===o||o.applyChange();var v=null===(a=c.spriteMesh)||void 0===a?void 0:a.mesh;u.spriteMesh&&u.spriteMesh.mesh&&(u.spriteMesh.mesh.priority=c.indexEnd),f.includes(v)?zS(f,v):kS(h,v),s.splice(t+1,1),t--}}R=t},b=this;for(y=0;y<s.length-1;y++)C(y),y=R}u.length=0;for(y=0;y<s.length;y++){var O=(I=s[y]).spriteMesh;if(0===I.items.length)throw new Error("split not combined");if(I.dirty){var L=I.indexStart;O.mesh.priority!==L&&(O.mesh.priority=L,p.push(O.mesh)),O.setItems(I.items.map((function(e){return e.content})))}O.applyChange(),I.dirty=!1}if(l.length)for(y=0;y<l.length;y++){var I,w=(A=(I=l[y]).spriteMesh).mesh;w.dispose({material:{textures:e.DestroyOptions.keep}}),h.push(w)}if(this.itemsToRemove.length=0,this.itemsToAdd.length=0,f.length+h.length+p.length){var P=this.meshes;return this.meshSplits.forEach((function(e,t){return P[t]=e.spriteMesh.mesh})),P.length=this.meshSplits.length,{add:f.length?f:void 0,remove:h.length?h:void 0,modify:p.length?p:void 0,layer:m.layerToAdd.length>0?m:void 0}}},t.prototype.addItem=function(e){this.items.includes(e)?zS(this.itemsToRemove,e):kS(this.itemsToAdd,e)},t.prototype.removeItem=function(e){this.items.includes(e)?ZO(e)?this.itemsToRemove.unshift(e):this.itemsToRemove.push(e):zS(this.itemsToAdd,e)},t.prototype.getSpriteMesh=function(e){for(var t=this.meshSplits,r=0;r<t.length;r++){var i=t[r].spriteMesh;if(i.items.indexOf(e)>-1)return i}},t.prototype.onUpdate=function(e){for(var t=this.meshSplits,r=0;r<t.length;r++){for(var i=t[r].spriteMesh,n=i.items,o=0;o<n.length;o++){var a=n[o];a.ended||i.updateItem(a)}i.applyChange()}},t.prototype.dispose=function(){this.meshSplits.forEach((function(e){var t;null===(t=e.spriteMesh)||void 0===t||t.mesh.dispose()}))},t.prototype.check=function(){},t.prototype.addMeshSplitsItem=function(e,t,r){if(-1!==e.indexOf(t))throw Error("item has been added");if(!r[0]){if(GS(e,t,HO),ZO(t)){var i=t.createContent(),n={indexStart:t.listIndex,indexEnd:t.listIndex,items:[t],renderInfo:i.renderInfo,cacheId:i.renderInfo.cacheId,textures:[t.content.renderer.texture]};return r.unshift(n),[n]}return[]}for(var o=function(i){var n=r[i],o=t.listIndex;if(ZO(t)){if(o<=n.indexEnd){GS(e,t,HO);var s=e.indexOf(t),u=Math.min(s,e.indexOf(n.items[0])),c=Math.max(s,e.indexOf(n.items[n.items.length-1])),l=a.getMeshSplits(e,u,c),f=l.findIndex((function(e){return e.items.includes(t)}));if(2===l.length)return r.splice(i+f,0,l[f]),Object.keys(l[1-f]).forEach((function(e){n[e]=l[1-f][e]})),{value:[l[f]]};if(3===l.length){if(Object.keys(l[0]).forEach((function(e){n[e]=l[0][e]})),r.splice(i+1,0,l[1],l[2]),1!==f)throw Error("neo split not in middle");return{value:[l[1],l[2]]}}if(1!==l.length)throw Error("invalid splits 1");return Object.keys(l[0]).forEach((function(e){n[e]=l[0][e]})),{value:[]}}}else{if(o<n.indexStart||o===n.indexEnd)return GS(e,t,HO),{value:[]};if(o<n.indexEnd){GS(e,t,HO);var h=n.items[n.items.length-1],p=e.indexOf(h),d=a.getMeshSplits(e,e.indexOf(n.items[0]),p);if(Object.keys(d[0]).forEach((function(e){n[e]=d[0][e]})),2===d.length)return r.splice(i+1,0,d[1]),{value:[d[1]]};if(1!==d.length)throw Error("invalid splits 2")}}},a=this,s=0;s<r.length;s++){var u=o(s);if("object"==typeof u)return u.value}if(GS(e,t,HO),ZO(t)){var c=r[r.length-1],l=this.getMeshSplits(e,e.indexOf(c.items[0]),e.indexOf(t));if(Object.keys(l[0]).forEach((function(e){c[e]=l[0][e]})),2===l.length)return r.push(l[1]),[l[1]];if(1!==l.length)throw Error("invalid splits 3")}return[]},t.prototype.removeMeshSplitsItem=function(e,t,r,i){for(var n,o,a=null,s=-1,u=[],c=0;c<r.length;c++){var l=r[c];if(l.indexStart<=t.listIndex&&l.indexEnd>=t.listIndex){a=l,s=c;break}}if(a){var f=a.items.indexOf(t);if(f<0){if(null==i?void 0:i.includes(t))return[];throw Error("item not found")}if(a.items.splice(f,1),a.dirty=!0,zS(e,t),0===a.items.length){if(zS(r,a),u.push(a),a=r[s-=1],!r.length||s<0)return u}else a.indexEnd=a.items[a.items.length-1].listIndex,a.indexStart=a.items[0].listIndex;if(0===s||s===r.length-2){var h=r[s],p=r[s+1];if(h&&p){var d=h.items[0],m=p.items[p.items.length-1];1===(v=this.getMeshSplits(e,e.indexOf(d),e.indexOf(m))).length&&(v[0].spriteMesh=r[s].spriteMesh,null===(n=v[0].spriteMesh)||void 0===n||n.invalidMaterial(),r[s]=v[0],u.push(r.splice(s+1,1)[0]))}}else if(s===r.length-1)if(0===a.items.length)u.push(r.splice(s,1)[0]);else{h=r[s-1],p=r[s],d=h.items[0],m=p.items[p.items.length-1];1===(v=this.getMeshSplits(e,e.indexOf(d),e.indexOf(m))).length&&(v[0].spriteMesh=r[s-1].spriteMesh,null===(o=v[0].spriteMesh)||void 0===o||o.invalidMaterial(),r[s-1]=v[0],u.push(r.splice(s,1)[0]))}else{var v;h=r[s-1],p=r[s+1],d=h.items[0],m=p.items[p.items.length-1];2===(v=this.getMeshSplits(e,e.indexOf(d),e.indexOf(m))).length&&(v[0].spriteMesh=r[s].spriteMesh,v[1].spriteMesh=r[s+1].spriteMesh,r[s]=v[0],r[s+1]=v[1],u.push(r.splice(s-1,1)[0]))}}return u},t.prototype.combineSplits=function(e,t,r){var i=e[t],n=[];if(ZO(i)&&i.composition){for(var o=void 0,a=0;a<r.length;a++){if(r[a].items.includes(i)){o=a;break}}var s=void 0,u=void 0;if(0===o?(s=r[o],u=r[o+1]):(s=r[o-1],u=r[o]),s&&u){var c=e.indexOf(s.items[0]),l=e.indexOf(u.items[u.items.length-1]);if(Number.isInteger(c)&&Number.isInteger(l)){var f=this.getMeshSplits(e,c,l);1===f.length&&(f[0].spriteMesh=r[o].spriteMesh,0===o?(r[0]=f[0],n.push(r.splice(1,1)[0])):(n.push(r.splice(o-1,1)[0]),r[o-1]=f[0]))}}}return n},t.prototype.getMeshSplits=function(t,r,i,n){void 0===r&&(r=0),void 0===i&&(i=t.length-1);for(var o=null,a=[],s=r;s<=i;s++){var u=t[s];if(n||u.contentVisible&&!(u.lifetime<0))if(ZO(u)){var c=u.createContent().renderInfo.cacheId,l=u.content.renderer.texture,f=!0;if(o){var h=o.textures.includes(l)?0:1;o.cacheId===c&&u.type===wS.sprite&&o.items.length<e.maxSpriteMeshItemCount&&h+o.textures.length<=e.maxSpriteTextureCount?(GS(o.items,u,HO),kS(o.textures,l),f=!1):a.push(o)}f&&(o={indexStart:u.listIndex,cacheId:c,renderInfo:u.content.renderInfo,items:[u],textures:[l]})}else{if(n&&!u.contentVisible)continue;o&&(a.push(o),o=null)}}return o&&a.push(o),a.forEach((function(e){e.indexEnd=e.items[e.items.length-1].listIndex,e.dirty=!0})),a},t}();function ZO(e){var t=e.type;return t===wS.sprite||t===wS.filter}var qO={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},KO=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="sprite",e}return tS(r,t),r.precompile=function(t,r,i){var n,o=r.getShaderLibrary(),a=r.engine.gpuCapability,s=a.level,u=a.detail,c=(null!=i?i:{}).env;if(!o.shaderResults[jO(qO,2)]){o.addShader(XO(qO,2,s,c)),o.addShader(XO(qO,e.maxSpriteMeshItemCount,s,c));var l=!1;null===(n=t[0])||void 0===n||n.items.forEach((function(e){e.type===wS.filter&&e.content.filter&&(l=!0,US(e.content.filter).forEach((function(e){if(!e.isParticle){var t=GO(s,e,e);e.shaderCacheId&&(t.cacheId="".concat(e.shaderCacheId,"_effects_filter")),o.addShader(t)}})))})),l&&o.addShader(Ab(s,!1)),u.writableFragDepth&&o.addShader(Ab(s,!0))}return Promise.resolve()},r.prototype.onCompositionDestroyed=function(e){e.loaderData.spriteGroup.dispose()},r.prototype.onCompositionReset=function(e,t){var r=new YO(e);e.loaderData.spriteGroup=r,r.resetMeshSplits()},r.prototype.onCompositionItemLifeBegin=function(e,t){var r=e.loaderData.spriteGroup;t.type!==wS.composition&&r.addItem(t)},r.prototype.onCompositionItemRemoved=function(e,t){e.loaderData.spriteGroup.removeItem(t)},r.prototype.onCompositionUpdate=function(e,t){e.loaderData.spriteGroup.onUpdate(t)},r.prototype.prepareRenderFrame=function(e,t){var r,i,n,o=e.loaderData.spriteGroup.diffMeshSplits();return!!o&&(null===(r=o.remove)||void 0===r||r.forEach((function(e){return t.removeMeshFromDefaultRenderPass(e)})),null===(i=o.add)||void 0===i||i.forEach((function(e){return t.addMeshToDefaultRenderPass(e)})),null===(n=o.modify)||void 0===n||n.forEach((function(e){t.removeMeshFromDefaultRenderPass(e),t.addMeshToDefaultRenderPass(e)})),!!(this.layerInfo=o.layer))},r.prototype.postProcessFrame=function(e,t){var r,i;null===(i=null===(r=this.layerInfo)||void 0===r?void 0:r.layerToAdd)||void 0===i||i.forEach((function(e){var r=e.items[0].filter;if(void 0!==r){var i=r.passSplitOptions,n=t.splitDefaultRenderPassByMesh(e.mesh,i);r.renderPassDelegate&&(n.delegate=r.renderPassDelegate),r.onRenderPassCreated&&r.onRenderPassCreated(n,t)}})),this.layerInfo=void 0},r}(LC),QO=[0,0,0],JO=[1,1,1],$O=[0,0,0],eL=function(){function e(e,t){var r;this.active=!1,this.transform=t.transform;var i=this.transform.scale;this.basicTransform={position:sS([],aS(this.transform.position),!1),rotation:sS([],aS(this.transform.getRotation()),!1),scale:[i[0],i[1],i[0]]};var n=e.rotationOverLifetime,o=e.sizeOverLifetime,a=e.positionOverLifetime,s=void 0===a?{}:a;if(s){s.path&&(this.basicTransform.path=KR(s.path));var u=s.linearX||s.linearY||s.linearZ;u&&(this.linearVelOverLifetime={x:s.linearX&&KR(s.linearX),y:s.linearY&&KR(s.linearY),z:s.linearZ&&KR(s.linearZ),asMovement:s.asMovement,enabled:!!u});var c=s.orbitalX||s.orbitalY||s.orbitalZ;c&&(this.orbitalVelOverLifetime={x:s.orbitalX&&KR(s.orbitalX),y:s.orbitalY&&KR(s.orbitalY),z:s.orbitalZ&&KR(s.orbitalZ),center:$A(s.orbCenter),asRotation:s.asRotation,enabled:!!c}),this.speedOverLifetime=s.speedOverLifetime&&KR(s.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=KR(o.x||1),this.sizeYOverLifetime=KR(o.y||1),this.sizeZOverLifetime=KR(o.z||1)):this.sizeXOverLifetime=KR(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:KR(n.z||0)},n.separateAxes)){var l=this.rotationOverLifetime;l.x=KR(n.x||0),l.y=KR(n.y||0)}this.options={reusable:!!t.reusable,delay:t.delay||0,startSpeed:s.startSpeed||0,startSize:i&&i[0]||1,sizeAspect:i&&i[0]/(i[1]||1)||1,duration:t.duration||0,looping:t.endBehavior&&t.endBehavior===sA.loop,endBehavior:t.endBehavior||0,gravity:$A(s.gravity),gravityModifier:KR(null!==(r=s.gravityOverLifetime)&&void 0!==r?r:0),direction:s.direction?iR([],s.direction):$A()},this.id=t.id,this.time=0,this.name=t.name,this.visible=t.getVisible()}return Object.defineProperty(e.prototype,"ended",{get:function(){return this.time>this.options.duration&&!this.options.looping&&!this.options.reusable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startSize",{get:function(){return this.basicTransform.scale},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"velocity",{get:function(){return this._velocity||(this._velocity=nR([],this.options.direction,this.options.startSpeed)),this._velocity},enumerable:!1,configurable:!0}),e.prototype.getWillTranslate=function(){return!!(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled||this.orbitalVelOverLifetime&&this.orbitalVelOverLifetime.enabled||this.options.gravityModifier&&!JA(this.options.gravity)||this.options.startSpeed&&!JA(this.options.direction))},e.prototype.updateTime=function(e){var t=e-this.options.delay,r=this.options.duration;if(t>=r&&this.options.looping){for(var i=t-r;i>r;)i-=r;this.time=i}else{var n=4===this.options.endBehavior;this.time=n?Math.min(r,t):t}},e.prototype.getRenderData=function(e,t){var r=this.options,i=KA(JO,1),n=KA(QO,0),o=!1,a=!1,s=e<0?e:Math.max(e,0),u=r.duration,c=s/u,l={life:c,transform:this.transform};c=c<0?0:c>1?1:c,this.sizeXOverLifetime&&(i[0]=this.sizeXOverLifetime.getValue(c),this.sizeSeparateAxes?(i[1]=this.sizeYOverLifetime.getValue(c),i[2]=this.sizeZOverLifetime.getValue(c)):i[2]=i[1]=i[0],o=!0),this.calculateScaling(o,i,t);var f,h=this.rotationOverLifetime;if(h){var p=function(e){return h.asRotation?e.getValue(c):e.getIntegrateValue(0,c,u)},d=p(h.z),m=h.separateAxes;n[0]=m?p(h.x):0,n[1]=m?p(h.y):0,n[2]=d,a=!0}if(a||t){var v=qA(QO,this.basicTransform.rotation,n);l.transform.setRotation(v[0],v[1],v[2])}return(this.getWillTranslate()||t)&&FR(f=[0,0,0],this,this.options.gravity,s,u,this.basicTransform.position,this.velocity),this.basicTransform.path&&(f||(f=tR($O,this.basicTransform.position,3)),qA(f,f,this.basicTransform.path.getValue(c))),f&&this.transform.setPosition(f[0],f[1],f[2]),l.active=this.active,l},e.prototype.calculateScaling=function(e,t,r){this.transform.setScale(t[0]*this.startSize[0],t[1]*this.startSize[1],t[2]*this.startSize[2])},e}(),tL=[[0,0,1,1,void 0]],rL=[1,1,1,1],iL=function(e){function t(t,r,i){var n,o,a,s,u,c,l,f,h=e.call(this,t,i)||this;h.startColor=[1,1,1,1];var p=t.interaction,d=t.renderer,m=t.options,v=t.listIndex,y=void 0===v?0:v,g=r.emptyTexture,x=i.transform.scale;h.options=rS(rS({},h.options),{startColor:m.startColor||[1,1,1,1]}),h.interaction=p,h.renderer={renderMode:null!==(n=d.renderMode)&&void 0!==n?n:PS.BILLBOARD,blending:null!==(o=d.blending)&&void 0!==o?o:AS.ALPHA,texture:h.initTexture(d.texture,g),occlusion:!!d.occlusion,transparentOcclusion:!!d.transparentOcclusion||d.maskMode===CS.MASK,side:null!==(a=d.side)&&void 0!==a?a:RS.DOUBLE,shape:d.shape,mask:null!==(s=d.mask)&&void 0!==s?s:0,maskMode:null!==(u=d.maskMode)&&void 0!==u?u:CS.NONE,order:y};var T=RA(d.anchor,d.particleOrigin);d.anchor||void 0===d.particleOrigin||qA(h.basicTransform.position,h.basicTransform.position,[-T[0]*x[0],-T[1]*x[1],0]),h.transform.setAnchor(T[0]*x[0],T[1]*x[1],0);var E=t.colorOverLifetime;return E&&(h.opacityOverLifetime=KR(null!==(c=E.opacity)&&void 0!==c?c:1),E.color&&E.color[0]===oA.GRADIENT_COLOR&&(h.colorOverLifetime=HS(E.color[1]))),(null===(l=t.filter)||void 0===l?void 0:l.feather)&&1!==(null===(f=t.filter)||void 0===f?void 0:f.feather)&&(h.feather=KR(t.filter.feather)),h.emptyTexture=g,h.splits=t.splits||tL,h.listIndex=i.listIndex||0,h.textureSheetAnimation=t.textureSheetAnimation,h.cachePrefix="-",h.parentId=i.parentId,h.reusable=i.reusable,h._renderInfo=zO(h),h}return tS(t,e),Object.defineProperty(t.prototype,"filter",{get:function(){return this._filter},set:function(e){this._filter=e,this._renderInfo.filter=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderInfo",{get:function(){return this._renderInfo},enumerable:!1,configurable:!0}),t.prototype.initTexture=function(e,t){return null!=e?e:t},t.prototype.getTextures=function(){var e=[],t=this.renderer.texture;return t&&e.push(t),e},t.prototype.getRenderData=function(t,r){var i,n=e.prototype.getRenderData.call(this,t,r),o=KA(rL,1),a=t<0?t:Math.max(t,0),s=this.options.duration,u=a/s<0?0:a/s>1?1:a/s,c=this.opacityOverLifetime,l=this.colorOverLifetime;l&&(o=WS(l,u,!0),i=!0),c&&(o[3]*=c.getValue(u),i=!0),(i||r)&&(n.color=rR(this.startColor,o,this.options.startColor));var f=this.textureSheetAnimation;if(f){var h=f.total||f.row*f.col,p=0,d=0,m=1,v=1,y=void 0;if(this.splits){var g=this.splits[0];y=g[4],p=g[0],d=g[1],y?(m=g[3],v=g[2]):(m=g[2],v=g[3])}var x=void 0,T=void 0;y?(x=1/f.row*m,T=1/f.col*v):(x=1/f.col*m,T=1/f.row*v);var E=void 0;if(f.animate){var _=Math.round(u*(h-1)),S=Math.floor(_/f.col),A=_-S*f.col;E=y?[x*S,T*(f.col-A)]:[x*A,T*(1+S)]}else E=[0,T];n.texOffset=[p+E[0],v+d-E[1],x,T]}else r&&(n.texOffset=[0,0,1,1]);return n.visible=this.visible,n.startSize=this.startSize,n},t.prototype.calculateScaling=function(e,t,r){(e||r)&&this.transform.setScale(t[0],t[1],t[2])},t}(eL),nL=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return tS(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return wS.sprite},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(e){this.sprite=e.content},r.prototype.onLifetimeBegin=function(e,t){this._contentVisible=!0,t.active=!0},r.prototype.onItemRemoved=function(e,t){this._contentVisible=!1,t&&(delete t.mesh,e.destroyTextures(t.getTextures()))},r.prototype.handleVisibleChanged=function(e){this.content&&(this.content.visible=e)},r.prototype.onItemUpdate=function(e,t){var r;null===(r=this.content)||void 0===r||r.updateTime(this.time)},r.prototype.getCurrentPosition=function(){var e=[0,0,0];return this.transform.assignWorldTRS(e),e},r.prototype.getBoundingBox=function(){var t=this.content;if(t&&this.transform){var r=this.transform.getWorldMatrix(),i=t.startSize,n=LR([0,0,0],i[0]/2,i[1]/2);return n.forEach((function(e){e.forEach((function(e){cR(e,e,r)}))})),{type:e.HitTestType.triangle,area:n}}},r.prototype.getHitTestParams=function(e){var t,r,i=this.content,n=null===(t=this.composition)||void 0===t?void 0:t.loaderData.spriteGroup,o=i&&i.interaction;if((e||o)&&n&&i){var a=this.getBoundingBox();if(a)return{behavior:(null===(r=i.interaction)||void 0===r?void 0:r.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===RS.FRONT}}},r.prototype.getRenderData=function(){return this.content.getRenderData(this.content.time)},r.prototype.doCreateContent=function(e){var t=e.getRendererOptions().emptyTexture;return new iL(this.sprite,{emptyTexture:t},this)},r.prototype.createWireframeMesh=function(e,t){var r=new kO(this.composition.getEngine(),rS({wireframe:!0},e.renderInfo),this.composition);return r.setItems([e]),r.mesh.material.setVector3("uFrameColor",[t[0],t[1],t[2]]),r.mesh.priority=999,r},r}(EC),oL=1,aL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return wS.filter},enumerable:!1,configurable:!0}),t.prototype.onConstructed=function(t){e.prototype.onConstructed.call(this,t),this.filterOptions=t.content.filter,this.cachePrefix="filter:"+oL++,this.sprite.renderer.texture=this.composition.renderFrame.transparentTexture},t.prototype.onItemUpdate=function(t,r){var i,n,o,a,s;e.prototype.onItemUpdate.call(this,t,r);var u=null===(o=this._content)||void 0===o?void 0:o.mesh;if(u){var c=this.filter.mesh.variables;if(c){var l=u.mesh.material;try{for(var f=oS(Object.keys(c)),h=f.next();!h.done;h=f.next()){var p=h.value,d=c[p](r);d.length>4?l.setMatrix(p,d):l.setVector4(p,d)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(i)throw i.error}}}}null===(s=(a=this.filter).onItemUpdate)||void 0===s||s.call(a,t,this)},t.prototype.onItemRemoved=function(t,r){var i,n;null===(n=(i=this.filter).onItemRemoved)||void 0===n||n.call(i,this),e.prototype.onItemRemoved.call(this,t,r)},t.prototype.doCreateContent=function(t){var r,i=e.prototype.doCreateContent.call(this,t),n=BS(this.filterOptions,t);this.filter=n,i.renderInfo.filter=n,i.filter=n,i.renderInfo.cacheId=i.renderInfo.cacheId.replace("$F$",null!==(r=n.mesh.shaderCacheId)&&void 0!==r?r:"");var o=n.mesh.variables;return n.mesh.uniformValues||(n.mesh.uniformValues={}),o&&Object.keys(o).forEach((function(e){var t=o[e];n.mesh.uniformValues[e]=t(0)})),i},t}(nL),sL=function(){function t(t,r){var i,n,o,a;this.particleCount=0;var s=r.composition.getEngine(),u=(null!==(i=s.renderer)&&void 0!==i?i:{}).env,c=t.speedOverLifetime,l=t.colorOverLifetime,f=t.linearVelOverLifetime,h=t.orbitalVelOverLifetime,p=t.sizeOverLifetime,d=t.rotationOverLifetime,m=t.sprite,v=t.gravityModifier,y=t.maxCount,g=t.duration,x=t.textureFlip,T=t.useSprite,E=t.name,_=t.filter,S=t.gravity,A=t.forceTarget,R=t.side,C=t.occlusion,b=t.anchor,O=t.blending,L=t.maskMode,I=t.mask,w=t.transparentOcclusion,P=t.listIndex,M=t.meshSlots,V=t.renderMode,N=void 0===V?0:V;t.matrix;var F,D,U=t.diffuse,B=void 0===U?ob.createWithData(s):U,k=s.gpuCapability.detail,z=k.halfFloatTexture,G=k.maxVertexUniforms,j=[["RENDER_MODE",+N],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",u===dS]],X=s.gpuCapability.level,W={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},H={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},Y=G>0,Z={},q=0,K=0;if(this.useSprite=T,Y&&j.push(["ENABLE_VERTEX_TEXTURE",!0]),c&&(j.push(["SPEED_OVER_LIFETIME",!0]),K|=2,Z.uSpeedLifetimeValue=c.toUniform(W)),(null==m?void 0:m.animate)&&(j.push(["USE_SPRITE",!0]),K|=4,Z.uFSprite=Z.uSprite=new Float32Array([m.col,m.row,m.total,m.blend?1:0]),this.useSprite=!0),_&&_.name!==mS){j.push(["USE_FILTER",!0]),K|=8;var Q=BS(_,r.composition);if(!Q.particle)throw new Error("particle filter ".concat(_.name," not implement"));F=Q.particle,Object.keys(null!==(n=F.uniforms)&&void 0!==n?n:{}).forEach((function(e){var t,r=null===(t=F.uniforms)||void 0===t?void 0:t[e];if(Z[e])throw new Error("conflict uniform name:"+e);Z[e]=null==r?void 0:r.toUniform(W)})),Object.keys(null!==(o=F.uniformValues)&&void 0!==o?o:{}).forEach((function(e){var t,r=null===(t=F.uniformValues)||void 0===t?void 0:t[e];if(Z[e])throw new Error("conflict uniform name:"+e);Z[e]=r}))}(null==l?void 0:l.color)&&(j.push(["COLOR_OVER_LIFETIME",!0]),K|=16,Z.uColorOverLifetime=l.color instanceof ob?l.color:ob.createWithData(s,QS(l.color))),(null==l?void 0:l.opacity)?Z.uOpacityOverLifetimeValue=l.opacity.toUniform(W):Z.uOpacityOverLifetimeValue=KR(1).toUniform(W),["x","y","z"].forEach((function(e,t){var r=0,i=0;(null==f?void 0:f[e])&&(Z["uLinear".concat(e.toUpperCase(),"ByLifetimeValue")]=f[e].toUniform(W),r=1,K|=1<<7+t,f.enabled=!0),j.push(["LINEAR_VEL_".concat(e.toUpperCase()),r]),(null==h?void 0:h[e])&&(Z["uOrb".concat(e.toUpperCase(),"ByLifetimeValue")]=h[e].toUniform(W),i=1,K|=1<<10+t,D=!0,h.enabled=!0),j.push(["ORB_VEL_".concat(e.toUpperCase()),i])})),(null==f?void 0:f.asMovement)&&(j.push(["AS_LINEAR_MOVEMENT",!0]),K|=32),D&&((null==h?void 0:h.asRotation)&&(j.push(["AS_ORBITAL_MOVEMENT",!0]),K|=64),Z.uOrbCenter=new Float32Array((null==h?void 0:h.center)||[0,0,0])),Z.uSizeByLifetimeValue=null==p?void 0:p.x.toUniform(W),(null==p?void 0:p.separateAxes)&&(j.push(["SIZE_Y_BY_LIFE",1]),K|=16384,Z.uSizeYByLifetimeValue=null===(a=null==p?void 0:p.y)||void 0===a?void 0:a.toUniform(W)),(null==d?void 0:d.z)&&(Z.uRZByLifeTimeValue=d.z.toUniform(W),K|=32768,j.push(["ROT_Z_LIFETIME",1])),(null==d?void 0:d.x)&&(Z.uRXByLifeTimeValue=d.x.toUniform(W),K|=65536,j.push(["ROT_X_LIFETIME",1])),(null==d?void 0:d.y)&&(Z.uRYByLifeTimeValue=d.y.toUniform(W),K|=1<<17,j.push(["ROT_Y_LIFETIME",1])),(null==d?void 0:d.asRotation)&&(j.push(["ROT_LIFETIME_AS_MOVEMENT",1]),K|=1<<18),Z.uGravityModifierValue=v.toUniform(W),A&&(j.push(["FINAL_TARGET",!0]),K|=1<<19,Z.uFinalTarget=new Float32Array(A.target||[0,0,0]),Z.uForceCurve=A.curve.toUniform(W)),z&&H.max?(K|=1<<20,Z.uFCurveValueTexture=ab(s,WR.getAllData(H,!0),H.index,1)):Z.uFCurveValues=WR.getAllData(H);var J=W.max+W.curves.length-32>G;if(2===X&&(W.max=-1,W.index=M?M[0]:cL(W.index),H.index>0&&(H.max=-1,H.index=M?M[1]:cL(H.index))),J&&z&&Y){var $=ab(s,WR.getAllData(W,!0),W.index,1);Z.uVCurveValueTexture=$,q=1}else Z.uVCurveValues=WR.getAllData(W);var ee=["-p:",N,K,W.index,W.max,H.index,H.max].join("+");j.push(["VERT_CURVE_VALUE_COUNT",W.index],["FRAG_CURVE_VALUE_COUNT",H.index],["VERT_MAX_KEY_FRAME_COUNT",W.max],["FRAG_MAX_KEY_FRAME_COUNT",H.max]);var te=_?qb.replace(/#pragma\s+FILTER_FRAG/,F.fragment):qb,re="#define LOOKUP_TEXTURE_CURVE ".concat(q,"\n").concat(Kb),ie=_?re.replace(/#pragma\s+FILTER_VERT/,F.vertex||"void filterMain(float t){}\n"):re,ne={fragment:HC(j,te,e.ShaderType.fragment,X),vertex:HC(j,ie,e.ShaderType.vertex,X),glslVersion:1===X?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,shared:!0,cacheId:ee,marcos:j,name:"particle#".concat(E)};_&&(ne.cacheId+=_.name);var oe={shader:ne,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},ae=GC(O);Z.uTexOffset=new Float32Array(B?[1/B.getWidth(),1/B.getHeight()]:[0,0]),Z.uMaskTex=B,Z.uColorParams=new Float32Array([B?1:0,+ae,0,+(!!C&&!w)]),Z.uParams=[0,g,0,0],Z.uAcceleration=[(null==S?void 0:S[0])||0,(null==S?void 0:S[1])||0,(null==S?void 0:S[2])||0,0];var se=yb.create(s,oe);se.blending=!0,se.depthTest=!0,se.depthMask=!!C,se.stencilRef=I?[I,I]:void 0,qC(se,L),YC(se,O),ZC(se,R);var ue={uSprite:"vec4",uParams:"vec4",uAcceleration:"vec4",uGravityModifierValue:"vec4",uOpacityOverLifetimeValue:"vec4",uRXByLifeTimeValue:"vec4",uRYByLifeTimeValue:"vec4",uRZByLifeTimeValue:"vec4",uLinearXByLifetimeValue:"vec4",uLinearYByLifetimeValue:"vec4",uLinearZByLifetimeValue:"vec4",uSpeedLifetimeValue:"vec4",uOrbXByLifetimeValue:"vec4",uOrbYByLifetimeValue:"vec4",uOrbZByLifetimeValue:"vec4",uSizeByLifetimeValue:"vec4",uSizeYByLifetimeValue:"vec4",uColorParams:"vec4",uFSprite:"vec4",uPreviewColor:"vec4",uVCurveValues:"vec4Array",uFCurveValues:"vec4",uFinalTarget:"vec3",uForceCurve:"vec4",uOrbCenter:"vec3",uTexOffset:"vec2",uPeriodValue:"vec4",uMovementValue:"vec4",uStrengthValue:"vec4",uWaveParams:"vec4"};Object.keys(Z).map((function(e){var t=Z[e];if(t instanceof ob)se.setTexture(e,t);else{var r=[];switch(ue[e]){case"vec4":se.setVector4(e,t);break;case"vec3":se.setVector3(e,t);break;case"vec2":se.setVector2(e,t);break;case"vec4Array":for(var i=0;i<t.length;i+=4){var n=[t[i],t[i+1],t[i+2],t[i+3]];r.push(n)}se.setVector4Array(e,r),r.length=0;break;default:console.warn("uniform ".concat(e,"'s type not in typeMap"))}}})),se.setVector3("emissionColor",[0,0,0]),se.setFloat("emissionIntensity",0);var ce=wb.create(s,function(e,t,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,o={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*i,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*i,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*i,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*i,data:new Float32Array(0)},aSeed:{size:1,offset:3*i,stride:8*i,dataSource:"aRot"},aColor:{size:4,offset:4*i,stride:8*i,dataSource:"aRot"},aOffset:{size:4,stride:4*i,data:new Float32Array(0)}};t&&(o.aSprite={size:3,data:new Float32Array(0)});return{attributes:o,indices:{data:new Uint16Array(0)},name:r,maxVertex:e}}(4*y,this.useSprite,"particle#".concat(E))),le=kb.create(s,{name:"MParticle_".concat(E),priority:P,material:se,geometry:ce});this.anchor=b,this.mesh=le,this.geometry=le.firstGeometry(),this.forceTarget=A,this.sizeOverLifetime=p,this.speedOverLifetime=c,this.linearVelOverLifetime=f,this.orbitalVelOverLifetime=h,this.orbitalVelOverLifetime=h,this.gravityModifier=v,this.maxCount=y,this.duration=g,this.textureOffsets=x?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0]}return Object.defineProperty(t.prototype,"time",{get:function(){return this.mesh.material.getVector4("uParams")[0]},set:function(e){this.mesh.material.setVector4("uParams",[+e,this.duration,0,0])},enumerable:!1,configurable:!0}),t.prototype.getPointColor=function(e){var t=this.geometry.getAttributeData("aRot"),r=32*e+4;return[t[r],t[r+1],t[r+2],t[r+3]]},t.prototype.getPointPosition=function(e){var t=this.geometry,r=48*e,i=t.getAttributeData("aPos"),n=t.getAttributeData("aOffset"),o=this.time-n[16*e+2],a=n[16*e+3],s=this.mesh.material,u=FR([0,0,0],this,s.getVector4("uAcceleration").slice(0,3),o,a,i,i,r,r+3);if(this.forceTarget){var c=s.getVector3("uFinalTarget"),l=this.forceTarget.curve.getValue(o/a),f=1-l;u[0]=u[0]*f+c[0]*l,u[1]=u[1]*f+c[1]*l,u[2]=u[2]*f+c[2]*l}return u},t.prototype.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},t.prototype.resetGeometryData=function(e){for(var t=e.getAttributeNames(),r=e.getIndexData(),i=0;i<t.length;i++){var n=t[i],o=e.getAttributeData(n);o&&e.setAttributeData(n,new o.constructor(0))}e.setIndexData(new r.constructor(0))},t.prototype.minusTime=function(e){for(var t=this.geometry.getAttributeData("aOffset"),r=0;r<t.length;r+=4)t[r+2]-=e;this.geometry.setAttributeData("aOffset",t),this.time-=e},t.prototype.removePoint=function(e){e<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*e,new Float32Array(16))},t.prototype.setPoint=function(e,t){var r=this.maxCount;if(t<r){var i=t+1,n=4*i,o=this.geometry,a=i>this.maxParticleBufferCount,s=1;this.particleCount>300?s=(this.particleCount+100)/this.particleCount:this.particleCount>100?s=1.4:this.particleCount>0&&(s=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},c=this.useSprite;c&&(u.aSprite=new Float32Array(12));var l=[0,0,0],f=[0,0,0],h=[0,0,0,1],p=[1,1,1];e.transform.assignWorldTRS(l,h,p),TC.getRotation(f,h);var d=this.textureOffsets,m=[0,0,e.delay,e.lifetime],v=[0,0,1,1],y=e.vel,g=e.color,x=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],T=Math.random(),E=void 0;c&&(E=e.sprite);for(var _=0;_<4;_++){var S=2*_,A=3*_,R=4*_,C=12*_,b=8*_;u.aPos.set(l,C),u.aPos.set(y,C+3),u.aRot.set(f,b),u.aRot[b+3]=T,u.aRot.set(g,b+4),c&&u.aSprite.set(E,A);var O=e.uv||v;if(O){var L=c?1-d[S+1]:d[S+1];m[0]=O[0]+d[S]*O[2],m[1]=O[1]+L*O[3]}u.aOffset.set(m,R);for(var I=_+_,w=(x[I]-this.anchor[0])*p[0],P=(x[I+1]-this.anchor[1])*p[1],M=0;M<3;M++)u.aPos[C+6+M]=e.dirX[M]*w,u.aPos[C+9+M]=e.dirY[M]*P}var V=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(a){var N=jS(o.getIndexData(),6*i,s,6*r);N.set(V,6*t),o.setIndexData(N),this.maxParticleBufferCount=N.length/6}else o.setIndexSubData(6*t,V);Object.keys(u).forEach((function(e){var i=u[e],c=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(a){var l=jS(o.getAttributeData(e),n*c,s,4*r*c);l.set(i,i.length*t),o.setAttributeData(e,l)}else o.setAttributeSubData(e,i.length*t,i)})),this.particleCount=Math.max(i,this.particleCount),o.setDrawCount(6*this.particleCount)}},t}(),uL=[10,32,64,160];function cL(e){for(var t=0;t<uL.length;t++){var r=uL[t];if(r>e)return r}return e||uL[0]}function lL(e,t,r){var i,n,o,a,s;void 0===t&&(t="");var u=e.content,c=+((null===(i=u.renderer)||void 0===i?void 0:i.renderMode)||0),l=[["RENDER_MODE",c],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",t===dS]],f=r.level,h=r.detail,p={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},d={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},m=h.maxVertexUniforms>0,v=(null!==(n=u.positionOverLifetime)&&void 0!==n?n:{}).speedOverLifetime,y=0,g=0;m&&l.push(["ENABLE_VERTEX_TEXTURE",!0]),v&&(l.push(["SPEED_OVER_LIFETIME",!0]),g|=2,rC(p,v));var x=u.textureSheetAnimation;x&&x.animate&&(l.push(["USE_SPRITE",!0]),g|=4);var T=void 0;if(u.filter&&u.filter.name!==mS){l.push(["USE_FILTER",!0]),g|=8;var E=US(u.filter).find((function(e){return e.isParticle}));if(!E)throw Error("particle filter ".concat(u.filter.name," not implement"));T=E,null===(o=E.uniforms)||void 0===o||o.forEach((function(e){return rC(p,e)}))}var _=u.colorOverLifetime;_&&_.color&&(l.push(["COLOR_OVER_LIFETIME",!0]),g|=16);var S=_&&_.opacity;S&&rC(p,S);var A,R=u.positionOverLifetime;["x","y","z"].forEach((function(e,t){var r=0,i="linear"+e.toUpperCase(),n="orbital"+e.toUpperCase();(null==R?void 0:R[i])&&(rC(p,R[i]),r=1,g|=1<<7+t),l.push(["LINEAR_VEL_".concat(e.toUpperCase()),r]);var o=0;(null==R?void 0:R[n])&&(rC(p,R[n]),o=1,g|=1<<10+t,A=!0),l.push(["ORB_VEL_".concat(e.toUpperCase()),o])})),(null==R?void 0:R.asMovement)&&(l.push(["AS_LINEAR_MOVEMENT",!0]),g|=32),A&&(null==R?void 0:R.asRotation)&&(l.push(["AS_ORBITAL_MOVEMENT",!0]),g|=64);var C=u.sizeOverLifetime;rC(p,null==C?void 0:C.x),(null==C?void 0:C.separateAxes)&&(l.push(["SIZE_Y_BY_LIFE",1]),g|=16384,rC(p,null==C?void 0:C.y));var b=u.rotationOverLifetime;(null==b?void 0:b.z)&&(rC(p,null==b?void 0:b.z),g|=32768,l.push(["ROT_Z_LIFETIME",1])),(null==b?void 0:b.separateAxes)&&(b.x&&(rC(p,b.x),g|=65536,l.push(["ROT_X_LIFETIME",1])),b.y&&(rC(p,b.y),g|=1<<17,l.push(["ROT_Y_LIFETIME",1]))),(null==b?void 0:b.asRotation)&&(l.push(["ROT_LIFETIME_AS_MOVEMENT",1]),g|=1<<18),rC(p,null==R?void 0:R.gravityOverLifetime),(null==R?void 0:R.forceTarget)&&(l.push(["FINAL_TARGET",!0]),g|=1<<19,rC(p,R.forceCurve));var O=h.halfFloatTexture;O&&d.max&&(g|=1<<20);var L=h.maxVertexUniforms,I=p.max+p.curves.length-32>L;Fb(Mb)&&(I=!0),2===f&&(p.max=-1,d.index>0&&(d.max=-1)),I&&O&&m&&(y=1);var w=["-p:",c,g,p.index,p.max,d.index,d.max].join("+"),P={fragment:qb,vertex:"#define LOOKUP_TEXTURE_CURVE ".concat(y,"\n").concat(Kb),shared:!0,cacheId:w,marcos:l,name:"particle#".concat(e.name)};return T&&(P.fragment=P.fragment.replace(/#pragma\s+FILTER_FRAG/,null!==(a=T.fragment)&&void 0!==a?a:""),P.vertex=P.vertex.replace(/#pragma\s+FILTER_VERT/,T.vertex||"void filterMain(float t){}\n"),P.cacheId+="+"+(null===(s=u.filter)||void 0===s?void 0:s.name)),l.push(["VERT_CURVE_VALUE_COUNT",p.index],["FRAG_CURVE_VALUE_COUNT",d.index],["VERT_MAX_KEY_FRAME_COUNT",p.max],["FRAG_MAX_KEY_FRAME_COUNT",d.max]),{shader:P,vertex:p.index,fragment:d.index}}function fL(e,t,r){var i,n=null===(i=e.cacheId)||void 0===i?void 0:i.split("+");if(n[3]=t,n[5]=r,e.cacheId=n.join("+"),e.marcos)for(var o=0;o<e.marcos.length;o++){var a=e.marcos[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=t;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}}var hL=function(e){this.content=e},pL=function(){function e(e){this.sort=e,this.length=0}return e.prototype.findNodeByContent=function(e){var t=this.first;if(t)do{if(e(t.content))return t}while(t=t.next)},e.prototype.insertNode=function(e,t){var r=e.next;e.next=t,t.pre=e,t.next=r,r&&(r.pre=t)},e.prototype.shiftNode=function(e){var t=new hL(e);if(this.length++,1===this.length)return this.first=this.last=t;for(var r=this.first;r;){if(!(this.sort(r.content,t.content)<=0))return r.pre?this.insertNode(r.pre,t):(this.first=t,t.next=r,r.pre=t),t;if(!r.next)return this.insertNode(r,t),this.last=t;r=r.next}},e.prototype.pushNode=function(e){var t=new hL(e);if(this.length++,1===this.length)return this.last=this.first=t;for(var r=this.last;r;){if(!(this.sort(t.content,r.content)<=0))return this.insertNode(r,t),r===this.last&&(this.last=t),t;if(this.first===r)return r.pre=t,t.next=r,this.first=t;r=r.pre}},e.prototype.removeNode=function(e){var t=this.first;if(this.length--,t===e)(r=this.first=t.next)&&(r.pre=null);else if((t=this.last)===e){var r;(r=this.last=t.pre)&&(r.next=null)}else if(e){var i=e.pre,n=e.next;i.next=n,n&&(n.pre=i)}e.pre=null,e.next=null},e.prototype.forEach=function(e,t){var r=this.first,i=0;if(r)do{e.call(t||this,r.content,i++)}while(r=r.next)},e.prototype.forEachReverse=function(e,t){var r=this.last,i=this.length-1;if(r)do{e.call(t||this,r.content,i--)}while(r=r.pre)},e}(),dL=function(){function e(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}return e.prototype.generate=function(e){var t=mL(this.arc,this.arcMode,e)*vS,r=[Math.cos(t)*this.radius,Math.sin(t)*this.radius,0],i=sR([],r,Math.tan(this.angle*vS));return i[2]+=1,{position:sR(r,r,mC(0,1)),direction:iR(i,i)}},e}();function mL(e,t,r){if(t===lA.RANDOM)e=mC(0,e);else if(t===lA.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);e=e/r.total*i}else if(t===lA.BIDIRECTIONAL_CYCLE){var n=(i=r.index/(r.total+1))-Math.floor(i);e*=Math.floor(i)%2?1-n:n}else t===lA.UNIFORM_BURST&&(e=e*r.burstIndex/r.burstCount);return e}var vL,yL=function(){function e(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}return e.prototype.generate=function(e){var t=mL(this.arc,this.arcMode,e)*vS,r=[Math.cos(t),Math.sin(t),0],i=this.radius;return{direction:r,position:r.map((function(e){return e*i}))}},e}(),gL=function(){function e(e){this._d=(e.width||1)/2,this._h=(e.height||1)/2}return e.prototype.generate=function(e){return{direction:[0,0,1],position:[mC(-this._d,this._d),mC(-this._h,this._h),0]}},e}(),xL=function(){function e(e){this._d=(e.width||1)/2,this._h=(e.height||1)/2,this.arcMode=e.arcMode,this.arc=e.arc}return e.prototype.generate=function(e){var t=mL(this.arc,this.arcMode,e)*vS,r=[Math.cos(t),Math.sin(t),0],i=this._d,n=this._h,o=Math.atan2(n,i),a=Math.tan(t);return{direction:r,position:t<o?[i,i*a,0]:t>=o&&t<Math.PI-o?[n/a,n,0]:t<Math.PI+o?[-i,-i*a,0]:t<2*Math.PI-o?[-n/a,-n,0]:[i,i*a,0]}},e}(),TL=function(){function e(e){this._d=e.width||1,this.arcMode=e.arcMode}return e.prototype.generate=function(e){var t=this.arcMode===lA.UNIFORM_BURST?e.burstIndex%e.burstCount/(e.burstCount-1):mC(0,1);return{direction:[0,1,0],position:[this._d*(t-.5),0,0]}},e}(),EL=[],_L=function(){function e(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}return e.prototype.generate=function(e){var t=this.donutRadius,r=this.radius-t,i=mC(0,2*Math.PI),n=mL(this.arc,this.arcMode,e)*vS,o=hR(EL,n),a=[Math.cos(i),Math.sin(i),0],s=[r+Math.cos(i)*t,0,Math.sin(i)*t];return{direction:eR(a,a,o),position:eR(s,s,o)}},e}(),SL=[],AL=function(){function e(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}return e.prototype.getHorizontalAngle=function(){return mC(-90,90)},e.prototype.generate=function(e){var t=mL(this.arc,this.arcMode,e)*vS,r=this.getHorizontalAngle()*vS,i=this.radius,n=[Math.cos(r),0,Math.sin(r)],o=eR(n,n,hR(SL,t));return{position:o.map((function(e){return e*i})),direction:o}},e}(),RL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.getHorizontalAngle=function(){return mC(0,90)},t}(AL),CL=function(){function e(e){var t=e.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(t.anchors),this.width=e.width||1,this.height=e.height||1,this.block=t.block,this.arcMode=e.arcMode,this.random=SA(e.random||0,0,1)}return e.prototype.generate=function(e){var t=this.anchors,r=t.length/2-1,i=Math.floor(mL(r,this.arcMode,e)),n=(t[2*i]+this.block[0]*this.random*Math.random())%1-.5,o=(t[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=[n,o,0];return{position:[n*this.width,o*this.height,0],direction:iR(a,a)}},e}(),bL=function(){function e(){}return e.prototype.generate=function(){return{position:[0,0,0],direction:[0,0,0]}},e}(),OL=((vL={})[bS.NONE]=bL,vL[bS.CONE]=dL,vL[bS.SPHERE]=AL,vL[bS.HEMISPHERE]=RL,vL[bS.CIRCLE]=yL,vL[bS.DONUT]=_L,vL[bS.RECTANGLE]=gL,vL[bS.EDGE]=TL,vL[bS.RECTANGLE_EDGE]=xL,vL[bS.TEXTURE]=CL,vL);function LL(e){if(!e)return new bL;var t=rS({radius:1,arc:360,angle:0,arcMode:lA.RANDOM},e),r=e.type,i=OL[r];if(!i)throw Error("invalid shape:"+r);var n=new i(t);if(r!==bS.NONE){var o=e,a=o.alignSpeedDirection,s=o.upDirection,u=void 0===s?[0,0,1]:s;n.alignSpeedDirection=a,n.upDirection=iR(u)}return n}function IL(e,t,r,i,n){var o,a;if(n===function(e,t,r,i){for(var n=0,o=t,a=r-i;o<r;o+=i)n+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return n}(e,t,r,i)>0)for(o=t;o<r;o+=i)a=ZL(o,e[o],e[o+1],a);else for(o=r-i;o>=t;o-=i)a=ZL(o,e[o],e[o+1],a);return a&&GL(a,a.next)&&(qL(a),a=a.next),a}function wL(e,t){if(!e)return e;t||(t=e);var r,i=e;do{if(r=!1,i.steiner||!GL(i,i.next)&&0!==zL(i.prev,i,i.next))i=i.next;else{if(qL(i),(i=t=i.prev)===i.next)break;r=!0}}while(r||i!==t);return t}function PL(e){var t=e.prev,r=e,i=e.next;if(zL(t,r,i)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(BL(t.x,t.y,r.x,r.y,i.x,i.y,n.x,n.y)&&zL(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function ML(e,t,r,i){var n=e.prev,o=e,a=e.next;if(zL(n,o,a)>=0)return!1;for(var s=n.x<o.x?n.x<a.x?n.x:a.x:o.x<a.x?o.x:a.x,u=n.y<o.y?n.y<a.y?n.y:a.y:o.y<a.y?o.y:a.y,c=n.x>o.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,l=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,f=DL(s,u,t,r,i),h=DL(c,l,t,r,i),p=e.prevZ,d=e.nextZ;p&&p.z>=f&&d&&d.z<=h;){if(p!==e.prev&&p!==e.next&&BL(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&zL(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==e.prev&&d!==e.next&&BL(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&zL(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=f;){if(p!==e.prev&&p!==e.next&&BL(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&zL(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=h;){if(d!==e.prev&&d!==e.next&&BL(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&zL(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function VL(e,t){return e.x-t.x}function NL(e,t){if(t=function(e,t){var r,i=t,n=e.x,o=e.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>a){if(a=s,s===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!r)return null;if(n===a)return r;var u,c=r,l=r.x,f=r.y,h=1/0;i=r;do{n>=i.x&&i.x>=l&&n!==i.x&&BL(o<f?n:a,o,l,f,o<f?a:n,o,i.x,i.y)&&(u=Math.abs(o-i.y)/(n-i.x),HL(i,e)&&(u<h||u===h&&(i.x>r.x||i.x===r.x&&FL(r,i)))&&(r=i,h=u)),i=i.next}while(i!==c);return r}(e,t),t){var r=YL(t,e);wL(t,t.next),wL(r,r.next)}}function FL(e,t){return zL(e.prev,e,t.prev)<0&&zL(t.next,e,e.next)<0}function DL(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function UL(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function BL(e,t,r,i,n,o,a,s){return(n-a)*(t-s)-(e-a)*(o-s)>=0&&(e-a)*(i-s)-(r-a)*(t-s)>=0&&(r-a)*(o-s)-(n-a)*(i-s)>=0}function kL(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&jL(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(HL(e,t)&&HL(t,e)&&function(e,t){var r=e,i=!1,n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}(e,t)&&(zL(e.prev,e,t.prev)||zL(e,t.prev,t))||GL(e,t)&&zL(e.prev,e,e.next)>0&&zL(t.prev,t,t.next)>0)}function zL(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function GL(e,t){return e.x===t.x&&e.y===t.y}function jL(e,t,r,i){var n=WL(zL(e,t,r)),o=WL(zL(e,t,i)),a=WL(zL(r,i,e)),s=WL(zL(r,i,t));return n!==o&&a!==s||(!(0!==n||!XL(e,r,t))||(!(0!==o||!XL(e,i,t))||(!(0!==a||!XL(r,e,i))||!(0!==s||!XL(r,t,i)))))}function XL(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function WL(e){return e>0?1:e<0?-1:0}function HL(e,t){return zL(e.prev,e,e.next)<0?zL(e,t,e.next)>=0&&zL(e,e.prev,t)>=0:zL(e,t,e.prev)<0||zL(e,e.next,t)<0}function YL(e,t){var r=new KL(e.i,e.x,e.y),i=new KL(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function ZL(e,t,r,i){var n=new KL(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function qL(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function KL(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var QL=0;function JL(e,t,r,i){r=r||2,QL=i||0;var n,o,a,s,u,c,l,f=t&&t.length,h=f?t[0]*r:e.length,p=IL(e,0,h,r,!0),d=[];if(!p||p.next===p.prev)return d;if(f&&(p=function(e,t,r,i){var n,o,a,s=[];for(n=0,o=t.length;n<o;n++)(a=IL(e,t[n]*i,n<o-1?t[n+1]*i:e.length,i,!1))===a.next&&(a.steiner=!0),s.push(UL(a));for(s.sort(VL),n=0;n<s.length;n++)NL(s[n],r),r=wL(r,r.next);return r}(e,t,p,r)),e.length>80*r){n=a=e[0],o=s=e[1];for(var m=r;m<h;m+=r)(u=e[m])<n&&(n=u),(c=e[m+1])<o&&(o=c),u>a&&(a=u),c>s&&(s=c);l=0!==(l=Math.max(a-n,s-o))?1/l:0}return $L(p,d,r,n,o,l),d}function $L(e,t,r,i,n,o,a){if(e){!a&&o&&function(e,t,r,i){var n=e;do{null===n.z&&(n.z=DL(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,r,i,n,o,a,s,u,c=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,i=r,s=0,t=0;t<c&&(s++,i=i.nextZ);t++);for(u=c;s>0||u>0&&i;)0!==s&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,u--),o?o.nextZ=n:e=n,n.prevZ=o,o=n;r=i}o.nextZ=null,c*=2}while(a>1)}(n)}(e,i,n,o);for(var s,u,c=e;e.prev!==e.next;)if(s=e.prev,u=e.next,o?ML(e,i,n,o):PL(e))t.push(s.i/r+QL),t.push(e.i/r+QL),t.push(u.i/r+QL),qL(e),e=u.next,c=u.next;else if((e=u)===c){a?1===a?$L(e=eI(wL(e),t,r),t,r,i,n,o,2):2===a&&tI(e,t,r,i,n,o):$L(wL(e),t,r,i,n,o,1);break}}}function eI(e,t,r){var i=e;do{var n=i.prev,o=i.next.next;!GL(n,o)&&jL(n,i,i.next,o)&&HL(n,o)&&HL(o,n)&&(t.push(n.i/r+QL),t.push(i.i/r+QL),t.push(o.i/r+QL),qL(i),qL(i.next),i=e=o),i=i.next}while(i!==e);return wL(i)}function tI(e,t,r,i,n,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&kL(a,s)){var u=YL(a,s);return a=wL(a,a.next),u=wL(u,u.next),$L(a,t,r,i,n,o),void $L(u,t,r,i,n,o)}s=s.next}a=a.next}while(a!==e)}var rI=2;function iI(e,t){for(var r=e.s,i=e.p,n=r[1],o=i[1],a=0,s=0;s<n.length;s++){a+=(T=n[s]).length-1}var u,c=new Float32Array(a*uS),l=t.indexBase,f=void 0===l?0:l,h=t.uvTransform,p=0,d=0,m=0,v=1,y=1;h&&(d=h[0],m=h[1],u=h[4],v=u?h[3]:h[2],y=u?h[2]:h[3]);var g=[0,0],x=0===u?0:-Math.PI/2;for(s=0;s<n.length;s++)for(var T=n[s],E=o[s],_=o[s+1]||o[0],S=T,A=[0,0],R=0;R<S.length-1;R++){aI(A,S[R],E,_,E[4],E[5],_[2],_[3]),b(A[0],A[1])}var C=JL(Array.from(c),null,uS,f);return{aPoint:c,index:new Uint16Array(C)};function b(e,t){c[p++]=e/2,c[p++]=t/2,h?(g[0]=e,g[1]=t,oI(g,g,x),c[p++]=d+(g[0]+1)/2*v,c[p++]=m+(g[1]+1)/2*y):(c[p++]=(e+1)/2,c[p++]=(t+1)/2),p+=rI}}function nI(e,t){for(var r=[],i=function(e){var t=[];return e.gs?e.gs.forEach((function(e){t.push({p:[oA.SHAPE_POINTS,e.p],s:[oA.SHAPE_SPLITS,e.s]})})):e.g?t.push({p:[oA.SHAPE_POINTS,e.g.p],s:[oA.SHAPE_SPLITS,e.g.s]}):t.push(e),t}(e),n=0,o=0,a=0,s=0;s<i.length;s++){n+=(h=iI(i[s],{indexBase:n,uvTransform:t})).aPoint.length/5,r.push(h),o+=h.aPoint.length,a+=h.index.length}if(1===r.length)return r[0];for(var u=new Float32Array(o),c=new Uint16Array(a),l=(s=0,0),f=0;s<r[s];s++){var h=r[s];u.set(h.aPoint,l),l+=h.aPoint.length,c.set(h.index,f),f+=h.index.length}return{aPoint:u,index:c}}function oI(e,t,r){var i=Math.cos(r),n=Math.sin(r),o=t[0],a=t[1];return e[0]=i*o+n*a,e[1]=-n*o+i*a,e}function aI(e,t,r,i,n,o,a,s){var u=1-t,c=u*u*u,l=3*t*u*u,f=3*t*t*u,h=t*t*t;return e[0]=c*r[0]+l*n+f*a+h*i[0],e[1]=c*r[1]+l*o+f*s+h*i[1],e}var sI=function(){function e(e){var t=e.time,r=e.interval,i=e.count,n=e.cycles,o=e.probability;this.time=+t||0,this.interval=+r||1,this.count=i instanceof UR?i:KR(i),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}return e.prototype.getGeneratorOptions=function(e,t){if(e-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(t),cycleIndex:this.cycles-this.internalCycles-1}:null},e.prototype.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.prototype.clone=function(){return new e(this)},e}(),uI=[0,0,0],cI=[0,0,0],lI=function(){function t(t,r){var i;this.pointStart=[];var n=t.colorOverLifetime,o=t.colorOverTrail,a=t.maxTrailCount,s=t.opacityOverLifetime,u=void 0===s?KR(1):s,c=t.widthOverTrail,l=t.name,f=t.occlusion,h=t.blending,p=t.maskMode,d=t.order,m=t.textureMap,v=void 0===m?[0,0,1,1]:m,y=t.texture,g=t.transparentOcclusion,x=t.minimumVertexDistance,T=t.lifetime,E=t.matrix,_=r.gpuCapability,S=_.detail,A=_.level,R=Math.max(t.pointCountPerTrail,2),C={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},b=S.maxVertexTextures>0,O=(null!==(i=r.renderer)&&void 0!==i?i:{}).env,L={},I=[["ENABLE_VERTEX_TEXTURE",b],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",O===dS]],w=a>64,P=0;n&&(I.push(["COLOR_OVER_LIFETIME",!0]),P|=1,L.uColorOverLifetime=ob.createWithData(r,QS(n))),o&&(I.push(["COLOR_OVER_TRAIL",!0]),P|=4,L.uColorOverTrail=ob.createWithData(r,QS(o))),w?(I.push(["ATTR_TRAIL_START",1]),P|=8):L.uTrailStart=new Float32Array(a),L.uOpacityOverLifetimeValue=u.toUniform(C);var M=c.toUniform(C);I.push(["VERT_CURVE_VALUE_COUNT",C.index],["VERT_MAX_KEY_FRAME_COUNT",C.max]),L.uVCurveValues=WR.getAllData(C);var V={shader:{vertex:HC(I,Qb,e.ShaderType.vertex,A),fragment:HC(I,qb,e.ShaderType.fragment,A),marcos:I,glslVersion:1===A?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,shared:!0,name:"trail#".concat(l),cacheId:"-t:+".concat(P,"+").concat(C.index,"+").concat(C.max)},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},N=R*a*2,F=(R-1)*a,D=Float32Array.BYTES_PER_ELEMENT,U=12*D,B={attributes:{aColor:{size:4,stride:U,data:new Float32Array(12*N)},aSeed:{size:1,stride:U,offset:4*D,dataSource:"aColor"},aInfo:{size:3,stride:U,offset:5*D,dataSource:"aColor"},aPos:{size:4,stride:U,offset:8*D,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(N)},aDir:{size:3,data:new Float32Array(3*N)}},indices:{data:new Uint16Array(6*N)},drawCount:6*F,name:"trail#".concat(l),bufferUsage:xS.DYNAMIC_DRAW};if(w)B.attributes.aTrailStart={size:1,data:new Float32Array(N)};else{var k=new Float32Array(N);B.attributes.aTrailStartIndex={size:1,data:k};for(var z=0;z<a;z++)for(var G=2*R,j=z*G,X=0;X<G;X++)k[j+X]=z}var W=GC(h),H=yb.create(r,V);H.blending=!0,H.depthMask=f,H.depthTest=!0,qC(H,p),YC(H,h);var Y=this.mesh=kb.create(r,{name:"MTrail_".concat(l),material:H,geometry:wb.create(r,B),priority:d}),Z=null!=y?y:ob.createWithData(r);Object.keys(L).map((function(e){var t=L[e];if(t instanceof ob)H.setTexture(e,t);else if("uTrailStart"===e)H.setFloats("uTrailStart",t);else if("uVCurveValues"===e){var r=[];r.push([t[0],t[1],t[2],t[3]]),r.push([t[4],t[5],t[6],t[7]]),H.setVector4Array(e,r)}else H.setVector4(e,t)})),H.setFloat("uTime",0),H.setVector4("uWidthOverTrail",M),H.setVector2("uTexOffset",[0,0]),H.setVector4("uTextureMap",v),H.setVector4("uParams",[0,R-1,0,0]),H.setTexture("uMaskTex",Z),H.setVector4("uColorParams",[y?1:0,+W,0,+(f&&!g)]),this.maxTrailCount=a,this.pointCountPerTrail=R,this.checkVertexDistance=x>0,this.minimumVertexDistance=Math.pow(x||.001,2),this.useAttributeTrailStart=w,this.lifetime=T,E&&(this.mesh.worldMatrix=E),this.geometry=Y.firstGeometry(),this.trailCursors=new Uint16Array(a)}return Object.defineProperty(t.prototype,"time",{get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(e){this.mesh.material.setFloat("uTime",null!=e?e:0)},enumerable:!1,configurable:!0}),t.prototype.addPoint=function(e,t,r){r=r||{};var i=this.trailCursors[e],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=i%n,u=(i-1)%n,c=(i-2)%n,l=this.getTrailPosition(e,u,uI);if(!(l&&this.checkVertexDistance&&aR(l,t)<this.minimumVertexDistance)){var f=e*n+s,h=dI(l,t),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,v=6*f,y=new Float32Array(6);y.set(h,0),y.set(h,3),o.setAttributeSubData("aDir",v,y),o.setAttributeSubData("aTime",2*f,new Float32Array([p,p]));var g=r.color||[1,1,1,1],x=new Float32Array(24);if(x.set(g,0),x.set(d,4),x[7]=0,x.set(t,8),x[11]=.5*m,x.set(g,12),x.set(d,16),x[19]=1,x.set(t,20),x[23]=-.5*m,o.setAttributeSubData("aColor",24*f,x),u>=0){var T=this.getTrailPosition(e,c,cI),E=new Float32Array(dI(T,l,t)),_=6*(e*n+u);o.setAttributeSubData("aDir",_,E),o.setAttributeSubData("aDir",_+3,E);var S=e*n*2,A=new Uint16Array([2*u+S,2*u+1+S,2*s+S,2*s+S,2*u+1+S,2*s+1+S]),R=6*(e*a+(i-1)%a);o.setIndexSubData(R,A)}i=++this.trailCursors[e];var C=this.mesh.material,b=C.getVector4("uParams"),O=d[2];if(this.useAttributeTrailStart){for(var L=2*n,I=new Float32Array(L),w=0;w<L;w++)I[w]=O;o.setAttributeSubData("aTrailStart",e*I.length,I)}else{var P=C.getFloats("uTrailStart");null!=P&&(P[e]=O,C.setFloats("uTrailStart",P))}b&&(b[1]=Math.max(b[1],i-1)-Math.max(0,i-n),C.setVector4("uParams",b))}},t.prototype.getTrailPosition=function(e,t,r){var i=this.pointCountPerTrail;if(t>=0&&t<i){var n=24*(e*i+t)+8,o=this.geometry.getAttributeData("aColor");return r[0]=o[n],r[1]=o[1+n],r[2]=o[2+n],r}},t.prototype.clearAllTrails=function(){var e=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),e.setIndexData(new Uint16Array(e.getIndexData().length))},t.prototype.minusTime=function(e){for(var t=this.geometry.getAttributeData("aTime"),r=0;r<t.length;r++)t[r]-=e;this.geometry.setAttributeData("aTime",t),this.time-=e},t.prototype.clearTrail=function(e){if(0!==this.trailCursors[e]){var t=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();null==r||r.set(new Uint16Array(t),e*t),this.geometry.setIndexData(r),this.trailCursors[e]=0}},t.prototype.getPointStartPos=function(e){return this.pointStart[e]},t.prototype.setPointStartPos=function(e,t){this.pointStart[e]=t},t.prototype.onUpdate=function(e){},t}(),fI=[0,0,0],hI=[0,0,0],pI=[0,0,0];function dI(e,t,r){var i=fI;return e||r?(e?r?(iR(hI,oR(hI,t,e)),iR(pI,oR(hI,r,t)),qA(i,hI,pI)):oR(i,t,e):oR(i,r,t),iR(i,i)):[0,0,0]}var mI=function(){function e(e,t,r){var i,n,o,a,s,u,c=r.composition,l=r.endBehavior,f=r.name;if(c){var h,p=c.getEngine(),d=t.cachePrefix,m=void 0===d?"":d,v=e.options,y=e.positionOverLifetime,g=e.shape,x=r.duration||1,T=y.gravityOverLifetime,E=$A(y.gravity),_=e.textureSheetAnimation,S=_?{animationDelay:KR(_.animationDelay||0),animationDuration:KR(_.animationDuration||1),cycles:KR(_.cycles||1),animate:_.animate,col:_.col,row:_.row,total:_.total||_.col*_.row}:void 0,A=PA(),R=!!(g&&g.turbulenceX||g.turbulenceY||g.turbulenceZ);R&&(h=[KR(null!==(i=g.turbulenceX)&&void 0!==i?i:0),KR(null!==(n=g.turbulenceY)&&void 0!==n?n:0),KR(null!==(o=g.turbulenceZ)&&void 0!==o?o:0)]),this.name=f,this.shape=LL(g),this.emission={rateOverTime:KR(e.emission.rateOverTime),burstOffsets:AI(null!==(a=e.emission.burstOffsets)&&void 0!==a?a:[]),bursts:(e.emission.bursts||[]).map((function(e){return new sI(e)}))},this.textureSheetAnimation=S;var C,b=e.renderer||{},O={},L=e.rotationOverLifetime;L&&(O.asRotation=!!L.asRotation,O.z=L.z?KR(L.z):KR(0),L.separateAxes&&(O.x=L.x&&KR(L.x),O.y=L.y&&KR(L.y))),y.forceTarget&&(C={target:y.target||[0,0,0],curve:KR(y.forceCurve||[oA.LINE,[[0,0],[1,1]]])});var I={x:y.linearX&&KR(y.linearX||0),y:y.linearY&&KR(y.linearY||0),z:y.linearZ&&KR(y.linearZ||0),asMovement:y.asMovement},w={x:y.orbitalX&&KR(y.orbitalX),y:y.orbitalY&&KR(y.orbitalY),z:y.orbitalZ&&KR(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},P=e.sizeOverLifetime||{},M=e.colorOverLifetime,V=r.listIndex,N=m,F=(null==P?void 0:P.separateAxes)?{separateAxes:!0,x:KR(P.x),y:KR(P.y)}:{separateAxes:!1,x:KR(("size"in P?P.size:P.x)||1)},D=RA(b.anchor,b.particleOrigin);this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:KR(v.startLifetime),startDelay:KR(v.startDelay||0),startSpeed:KR(y.startSpeed||0),startColor:KR(v.startColor),endBehavior:l,duration:x,looping:l===sA.loop,maxCount:null!==(s=v.maxCount)&&void 0!==s?s:0,gravityModifier:KR(T||0).scaleXCoord(x),gravity:E,start3DSize:!!v.start3DSize,startTurbulence:R,turbulence:h,speedOverLifetime:y.speedOverLifetime&&KR(y.speedOverLifetime),linearVelOverLifetime:I,orbitalVelOverLifetime:w,forceTarget:C},v.startRotationZ&&(this.options.startRotation=KR(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=KR(v.startRotationX||0),this.options.startRotationY=KR(v.startRotationY||0),this.options.startRotationZ=KR(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=KR(v.startSizeX),this.options.startSizeY=KR(v.startSizeY)):(this.options.startSize=KR(v.startSize),this.options.sizeAspect=KR(v.sizeAspect||1));var U={listIndex:V,meshSlots:v.meshSlots,name:f,matrix:A,filter:e.filter,shaderCachePrefix:N,renderMode:b.renderMode||PS.BILLBOARD,side:b.side||RS.DOUBLE,gravity:E,duration:r.duration,blending:b.blending||AS.ALPHA,rotationOverLifetime:O,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:S,occlusion:!!b.occlusion,transparentOcclusion:!!b.transparentOcclusion,maxCount:v.maxCount,mask:b.mask,maskMode:null!==(u=b.maskMode)&&void 0!==u?u:CS.NONE,forceTarget:C,diffuse:b.texture,sizeOverLifetime:F,anchor:D};if(M){var B=M.color,k=M.opacity;U.colorOverLifetime={},k&&(U.colorOverLifetime.opacity=KR(M.opacity)),B&&(B[0]===oA.GRADIENT_COLOR?U.colorOverLifetime.color=M.color[1]:B[0]===oA.RGBA_COLOR?U.colorOverLifetime.color=ob.createWithData(p,{data:new Uint8Array(B[1]),width:1,height:1}):B instanceof ob&&(U.colorOverLifetime.color=B))}var z,G=[],j=[0,0,1,1];if(e.splits){var X=e.splits[0];j=(z=X[4])?[X[0],X[1],X[3],X[2]]:[X[0],X[1],X[2],X[3]]}if(S&&!S.animate)for(var W=z?S.row:S.col,H=z?S.col:S.row,Y=S.total||W*H,Z=0,q=0;q<W;q++)for(var K=0;K<H&&Z<Y;K++,Z++)G.push([q*j[2]/W+j[0],K*j[3]/H+j[1],j[2]/W,j[3]/H]);else G.push(j);U.textureFlip=z,this.uvs=G,this.particleMesh=new sL(U,{composition:c});var Q=e.trails;if(Q){this.trails={lifetime:KR(Q.lifetime),dieWithParticles:!1!==Q.dieWithParticles,sizeAffectsWidth:!!Q.sizeAffectsWidth,sizeAffectsLifetime:!!Q.sizeAffectsLifetime,inheritParticleColor:!!Q.inheritParticleColor,parentAffectsPosition:!!Q.parentAffectsPosition};var J={name:r.name+"_trail",matrix:A,minimumVertexDistance:Q.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(Q.maxPointPerTrail)||32,blending:Q.blending,texture:Q.texture,opacityOverLifetime:KR(Q.opacityOverLifetime||1),widthOverTrail:KR(Q.widthOverTrail||1),order:V+(Q.orderOffset||0),shaderCachePrefix:N,lifetime:this.trails.lifetime,occlusion:!!Q.occlusion,transparentOcclusion:!!Q.transparentOcclusion,textureMap:Q.textureMap,mask:b.mask,maskMode:b.maskMode};Q.colorOverLifetime&&Q.colorOverLifetime[0]===oA.GRADIENT_COLOR&&(J.colorOverLifetime=Q.colorOverLifetime[1]),Q.colorOverTrail&&Q.colorOverTrail[0]===oA.GRADIENT_COLOR&&(J.colorOverTrail=Q.colorOverTrail[1]),this.trailMesh=new lI(J,p)}this.transform=r.transform;var $,ee=sS([],aS(this.transform.position),!1),te=sS([],aS(this.transform.rotation),!1),re=e.emitterTransform&&e.emitterTransform.path;re&&(re[0]===oA.CONSTANT_VEC3?qA(ee,ee,re[1]):$=KR(re)),this.basicTransform={position:ee,rotation:te,path:$},this.updateEmitterTransform(0);var ie=[this.particleMesh.mesh];this.trailMesh&&ie.push(this.trailMesh.mesh),this.meshes=ie,this.reusable=r.reusable,this.setVisible(r.getVisible());var ne=e.interaction;ne&&(this.interaction={multiple:ne.multiple,radius:ne.radius,behavior:ne.behavior})}}return Object.defineProperty(e.prototype,"timePassed",{get:function(){return this.lastUpdate-this.loopStartTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lifetime",{get:function(){return this.timePassed/this.options.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"particleCount",{get:function(){return this.particleLink.length},enumerable:!1,configurable:!0}),e.prototype.updateEmitterTransform=function(e){var t=this.parentTransform,r=this.basicTransform,i=r.path,n=sS([],aS(r.position),!1);if(i){var o=this.options.duration;qA(n,n,i.getValue(e/o))}if(this.transform.setPosition(n[0],n[1],n[2]),this.options.particleFollowParent&&t){var a=t.getWorldMatrix();this.particleMesh.mesh.worldMatrix=a,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=a)}},e.prototype.addParticle=function(e,t){var r,i=this.particleLink,n=[e.delay+e.lifetime,0,e.delay,e];if(i.length<t)r=n[1]=i.length;else{var o=i.first;i.removeNode(o),r=n[1]=o.content[1]}i.pushNode(n),this.particleMesh.setPoint(e,r),this.clearPointTrail(r),this.parentTransform&&this.trailMesh&&this.trailMesh.setPointStartPos(r,this.parentTransform.position)},e.prototype.setVisible=function(e){this.particleMesh.mesh.setVisible(e),this.trailMesh&&this.trailMesh.mesh.setVisible(e)},e.prototype.setParentTransform=function(e){this.parentTransform=e},e.prototype.getTextures=function(){var e,t,r,i,n=[];try{for(var o=oS(Object.values(this.particleMesh.mesh.material.textures)),a=o.next();!a.done;a=o.next()){var s=a.value;n.push(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}if(this.trailMesh)try{for(var u=oS(Object.values(this.trailMesh.mesh.material.textures)),c=u.next();!c.done;c=u.next()){s=c.value;n.push(s)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return n},e.prototype.start=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},e.prototype.stop=function(){this.ended=!0,this.started=!1},e.prototype.reset=function(){var e;this.particleMesh.clearPoints(),null===(e=this.trailMesh)||void 0===e||e.clearAllTrails(),this.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new pL((function(e,t){return e[0]-t[0]})),this.emission.bursts.forEach((function(e){return e.reset()})),this.frozen=!1},e.prototype.onUpdate=function(e){var t,r=this;if(this.started&&!this.frozen){var i=this.lastUpdate+e/1e3,n=this.particleMesh,o=this.trailMesh,a=this.options,s=this.loopStartTime,u=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,n.time=i,o&&(o.time=i,o.onUpdate(e));var c=this.particleLink,l=(i-s)/a.duration,f=this.timePassed,h=!1,p=function(){r.trails&&!h&&(h=!0,c.forEach((function(e){var t=aS(e,4),i=t[0],n=t[1],o=t[2],a=t[3];i<f?r.clearPointTrail(n):f>o&&r.updatePointTrail(n,l,a,o)})))};if(this.ended){if(!a.looping)if(this.reusable);else if(0===a.endBehavior){var d=c.last;d&&d.content[0]-s<f&&(this.onUpdate=function(){return r.onDestroy()})}}else{var m=a.duration,v=this.lifetime;if(f<m){var y=1/u.rateOverTime.getValue(v),g=Math.floor((f-this.lastEmitTime)/y),x=g,T=y/g,E=i,_=a.maxCount;this.updateEmitterTransform(f);for(var S=function(){var e=c.first;return r.emissionStopped||c.length===_&&e&&e.content[0]-s>f},A=0;A<x&&A<_&&!S();A++){(P=this.createPoint(v)).delay+=E+A*T,this.addParticle(P,_),this.lastEmitTime=f}for(var R=u.bursts,C=(null==R?void 0:R.length)-1,b=0;C>=0&&b<_&&!S();C--){var O=R[C],L=!O.disabled&&O.getGeneratorOptions(f,v);if(L){var I=u.burstOffsets[C],w=I&&I[L.cycleIndex]||[0,0,0];O.once&&this.removeBurst(C);for(A=0;A<L.count&&b<_&&!S();A++){var P;(P=this.initPoint(this.shape.generate({total:L.total,index:L.index,burstIndex:A,burstCount:L.count}))).delay+=E,b++,(t=P.transform).translate.apply(t,sS([],aS(w),!1)),this.addParticle(P,_)}}}}else if(a.looping)p(),this.loopStartTime=i-m,this.lastEmitTime-=m,this.lastUpdate-=m,u.bursts.forEach((function(e){return e.reset()})),this.particleLink.forEach((function(e){e[0]-=m,e[2]-=m,e[3].delay-=m})),n.minusTime(m),o&&o.minusTime(m),this.onIterate(this);else{this.ended=!0,this.onEnd(this),4===a.endBehavior&&(this.frozen=!0)}}p()}},e.prototype.onDestroy=function(){},e.prototype.getParticleBoxes=function(){var e=this.particleLink,t=this.particleMesh,r=[],i=this.particleCount,n=0;if(!e||!t)return r;for(var o=e.last,a=!1;!a;){var s=o.content[0],u=o.content[3];if(s>this.timePassed){var c=this.getPointPosition(u);r.push({center:c,size:u.transform.scale}),o.pre?o=o.pre:a=!0}++n>i&&(a=!0)}return r},e.prototype.raycast=function(e){var t=this.particleLink,r=this.particleMesh;if(t&&r){var i=t.last,n=[],o=[0,0,0],a=!1;if(i&&i.content)do{var s=aS(i.content,4),u=s[0],c=s[1];s[2];var l=s[3];if(!(u>this.timePassed))break;var f=this.getPointPosition(l),h=e.ray,p=!1;h&&(p=!!SR(o,h.center,h.direction,f,e.radius)),p&&(e.removeParticle&&(r.removePoint(c),this.clearPointTrail(c),t.removeNode(i),i.content=[0]),n.push(f),e.multiple||(a=!0))}while((i=i.pre)&&!a);return n}},e.prototype.clearPointTrail=function(e){var t;this.trails&&this.trails.dieWithParticles&&(null===(t=this.trailMesh)||void 0===t||t.clearTrail(e))},e.prototype.updatePointTrail=function(e,t,r,i){if(this.trailMesh){var n=this.trails,o=this.particleMesh,a=this.getPointPosition(r),s=n.inheritParticleColor?o.getPointColor(e):[1,1,1,1],u=r.transform.getWorldScale(),c=1,l=n.lifetime.getValue(t);if(n.sizeAffectsWidth&&(c*=u[0]),n.sizeAffectsLifetime&&(l*=u[0]),n.parentAffectsPosition&&this.parentTransform){qA(a,a,this.parentTransform.position);var f=this.trailMesh.getPointStartPos(e);f&&oR(a,a,f)}this.trailMesh.addPoint(e,a,{color:s,lifetime:l,size:c,time:i})}},e.prototype.getPointPosition=function(e){var t=e.transform,r=e.vel,i=e.lifetime,n=e.delay,o=e.gravity,a=void 0===o?[0,0,0]:o,s=this.options.forceTarget,u=[0,0,0],c=this.lastUpdate-n;t.assignWorldTRS(u);var l=FR([0,0,0],this.options,a,c,i,u,r);if(s){var f=s.target||[0,0,0],h=s.curve.getValue(c/i),p=1-h;l[0]=l[0]*p+f[0]*h,l[1]=l[1]*p+f[1]*h,l[2]=l[2]*p+f[2]*h}return l},e.prototype.onEnd=function(e){},e.prototype.onIterate=function(e){},e.prototype.initPoint=function(e){var t,r=this.options,i=this.lifetime,n=this.shape,o=r.startSpeed.getValue(i),a=r.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),s=cR([],e.position,a),u=new TC({position:s,valid:!0}),c=e.direction;if(c=iR(vI,lR(vI,c,a)),r.startTurbulence&&r.turbulence){for(var l=0;l<3;l++)EI[l]=r.turbulence[l].getValue(i);var f=pR(SI,EI);c=iR(vI,eR(c,c,f))}var h,p=xI,d=TI;n.alignSpeedDirection?(tR(d,c,3),this.upDirectionWorld||(this.upDirectionWorld=lR([],null!==(t=n.upDirection)&&void 0!==t?t:[0,0,1],a)),p=iR(p,uR(p,d,this.upDirectionWorld))):(p[0]=1,p[1]=p[2]=0,d[1]=1,d[0]=d[2]=0);var m=this.textureSheetAnimation;m&&m.animate&&((h=_I)[0]=m.animationDelay.getValue(i),h[1]=m.animationDuration.getValue(i),h[2]=m.cycles.getValue(i));var v=gI;r.start3DRotation?v=[r.startRotationX.getValue(i),r.startRotationY.getValue(i),r.startRotationZ.getValue(i)]:r.startRotation&&(v=[0,0,r.startRotation.getValue(i)]),u.setRotation.apply(u,sS([],aS(v),!1));var y=r.startColor.getValue(i);3===y.length&&(y[3]=1);var g=yI;if(r.start3DSize)g[0]=r.startSizeX.getValue(i),g[1]=r.startSizeY.getValue(i);else{var x=r.startSize.getValue(i),T=r.sizeAspect.getValue(i);g[0]=x,g[1]=0===T?0:x/T}var E=[0,0,0];return sR(E,c,o),r.particleFollowParent||(this.transform.assignWorldTRS([],[],EI),rR(g,g,EI)),u.setScale(g[0],g[1],1),{size:g,vel:E,color:y,delay:r.startDelay.getValue(i),lifetime:r.startLifetime.getValue(i),uv:RI(this.uvs,!0),gravity:r.gravity,sprite:h,dirY:d,dirX:p,transform:u}},e.prototype.addBurst=function(e,t){var r=!1;if(this.emission.bursts.includes(e)||(this.emission.bursts.push(e),r=!0),r&&t instanceof Array){var i=this.emission.bursts.indexOf(e);return this.emission.burstOffsets[i]=t,i}return-1},e.prototype.removeBurst=function(e){e<this.emission.bursts.length&&(this.emission.burstOffsets[e]=null,this.emission.bursts.splice(e,1))},e.prototype.createPoint=function(e){var t={total:this.emission.rateOverTime.getValue(e),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(t))},e}(),vI=[0,0,0],yI=[0,0],gI=[0,0,0],xI=[0,0,0],TI=[0,0,0],EI=[0,0,0],_I=[0,0,0],SI=[];function AI(e){var t={};return Array.isArray(e)&&e.forEach((function(e){var r=e instanceof Array,i=r?e[0]:e.index,n=t[i];n||(n=t[i]=[]),r?n.push(e.slice(1,4)):n.push([+e.x,+e.y,+e.z])})),t}function RI(e,t){var r=Math.floor(Math.random()*e.length),i=e[r];return t||e.splice(r,1),i}var CI=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return tS(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return wS.particle},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"contentVisible",{get:function(){return!this.destroyed},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(e){this.particle=e.content},r.prototype.onLifetimeBegin=function(e,t){var r=this;return t&&(t.name=this.name,t.start(),t.onDestroy=function(){r.destroyed=!0}),t},r.prototype.onItemUpdate=function(e,t){var r;if(this.content){var i=!this.visible,n=this.parentId&&(null===(r=this.composition)||void 0===r?void 0:r.getItemByID(this.parentId));if(!i&&n){var o=n.getRenderData();o&&(this.content.setParentTransform(o.transform),o.visible||(i=!1))}i?this.content.setVisible(!0):(this.content.setVisible(!1),this.content.onUpdate(e))}},r.prototype.onItemRemoved=function(t,r){r&&(t.destroyTextures(r.getTextures()),r.meshes.forEach((function(t){return t.dispose({material:{textures:e.DestroyOptions.keep}})})))},r.prototype.stopParticleEmission=function(){this.content&&(this.content.emissionStopped=!0)},r.prototype.resumeParticleEmission=function(){this.content&&(this.content.emissionStopped=!1)},r.prototype.doCreateContent=function(e){return rA(this.particle),new mI(this.particle,e.getRendererOptions(),this)},r.prototype.isEnded=function(e){return t.prototype.isEnded.call(this,e)&&this.destroyed},r.prototype.getBoundingBox=function(){var t=this.content;if(t){var r=t.getParticleBoxes();return{type:e.HitTestType.sphere,area:r}}},r.prototype.getHitTestParams=function(t){var r,i=this,n=null===(r=this.content)||void 0===r?void 0:r.interaction;if(t||n)return{type:e.HitTestType.custom,collect:function(e){var t;return null===(t=i.content)||void 0===t?void 0:t.raycast({radius:(null==n?void 0:n.radius)||.4,multiple:!!(null==n?void 0:n.multiple),removeParticle:(null==n?void 0:n.behavior)===cA.removeParticle,ray:e})}}},r}(EC),bI=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.meshes=[],e}return tS(r,t),r.precompile=function(t,r,i){var n=t[0],o={rotationOverLifetime:{x:!1,y:!1,z:!1},positionOverLifetime:{speedOverLifetime:!1,linearX:!1,linearY:!1,linearZ:!1,orbitalX:!1,orbitalY:!1,orbitalZ:!1,forceCurve:!1},colorOverLifetime:{opacity:!1,color:!1},sizeOverLifetime:{x:!1,y:!1}},a={colorOverLifetime:{opacity:1,color:[oA.RGBA_COLOR,[255,255,255,255]]},positionOverLifetime:{speedOverLifetime:1},sizeOverLifetime:{x:1,y:1}},s=r.engine.gpuCapability,u=s.level,c=(null!=i?i:{}).env,l=r.getShaderLibrary(),f=[],h=[],p=[],d=0,m=0;return n.items.forEach((function(e){e.type===wS.particle&&(h.push(e),function(e){if(e.type===wS.particle){var t=e.content;t.rotationOverLifetime||(t.rotationOverLifetime={});var r=t.rotationOverLifetime;r.z||(r.z=[oA.CONSTANT,0]),r.separateAxes||(delete r.y,delete r.x),t.sizeOverLifetime||(t.sizeOverLifetime={});var i=t.sizeOverLifetime;i.separateAxes||delete i.y,i.size&&(i.x=i.size,delete i.size),i.x||(i.x=[oA.CONSTANT,1])}}(e),2===u&&Object.keys(o).forEach((function(t){var r=o[t],i=e.content[t];i&&Object.keys(r).forEach((function(e){i[e]&&(r[e]=!0,kS(f,t))}))})))})),h.forEach((function(t){var r,i,n=t.content;2===u&&(f.forEach((function(e){var t=o[e],r=n[e]||(n[e]={});Object.keys(t).forEach((function(i){if(t[i]&&!r[i]){var n=a[e]&&a[e][i]||0;r[i]=isNaN(n)?n:[oA.CONSTANT,n]}}))})),o.positionOverLifetime.forceCurve&&(n.positionOverLifetime.forceTarget=!0),(o.rotationOverLifetime.x||o.rotationOverLifetime.y)&&(n.rotationOverLifetime.separateAxes=!0),o.sizeOverLifetime.y&&(n.sizeOverLifetime.separateAxes=!0));var h=lL(t,c,s),v=h.shader,y=h.fragment,g=h.vertex;if(p.push(v),d=Math.max(d,y),m=Math.max(m,g),t.content.trails){var x=function(e,t,r,i,n){void 0===i&&(i="");var o=0,a=Fb(Mb)?1:0,s=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",a],["ENV_EDITOR",i===dS]],u={curves:[],index:0,max:0,lineSegCount:0,curveCount:0};return e.colorOverLifetime&&(s.push(["COLOR_OVER_LIFETIME",!0]),o|=1),e.colorOverTrail&&(s.push(["COLOR_OVER_TRAIL",!0]),o|=4),t>64&&(s.push(["ATTR_TRAIL_START",1]),o|=8),rC(u,e.opacityOverLifetime),rC(u,e.widthOverTrail),s.push(["VERT_CURVE_VALUE_COUNT",u.index],["VERT_MAX_KEY_FRAME_COUNT",u.max]),{vertex:Qb,fragment:qb,marcos:s,shared:!0,name:"trail#"+r,cacheId:"-t:+".concat(o,"+").concat(u.index,"+").concat(u.max)}}(t.content.trails,t.content.options.maxCount,t.name,c,s);x.vertex=HC(null!==(r=x.marcos)&&void 0!==r?r:[],x.vertex,e.ShaderType.vertex,u),x.fragment=HC(null!==(i=x.marcos)&&void 0!==i?i:[],x.fragment,e.ShaderType.fragment,u),x.glslVersion=2===u?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1,l.addShader(x)}})),p.forEach((function(t){var r,i;2===u?(fL(t,m,d),t.glslVersion=e.GLSLVersion.GLSL3):t.glslVersion=e.GLSLVersion.GLSL1,t.vertex=HC(null!==(r=t.marcos)&&void 0!==r?r:[],t.vertex,e.ShaderType.vertex,u),t.fragment=HC(null!==(i=t.marcos)&&void 0!==i?i:[],t.fragment,e.ShaderType.fragment,u),l.addShader(t)})),2===u&&h.forEach((function(e){e.content.options.meshSlots=[m,d]})),Promise.resolve()},r.prototype.onCompositionItemLifeBegin=function(e,t){t instanceof CI&&this.add(t.content)},r.prototype.onCompositionItemRemoved=function(e,t){t instanceof CI&&t.content&&this.remove(t.content,e.renderFrame)},r.prototype.prepareRenderFrame=function(e,t){return this.meshes.forEach((function(e){return t.addMeshToDefaultRenderPass(e)})),this.meshes.length=0,!1},r.prototype.add=function(e){var t=this;e.meshes.forEach((function(e){return kS(t.meshes,e)}))},r.prototype.remove=function(e,t){var r=this;e.meshes.forEach((function(e){zS(r.meshes,e),t.removeMeshFromDefaultRenderPass(e)}))},r}(LC);var OI,LI=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t}(LC),II=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._v_priority=1,t.childrenVisible=!0,t}return tS(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return wS.null},enumerable:!1,configurable:!0}),t.prototype.onConstructed=function(e){this.cal=e.content,this.relative=e.relative},t.prototype.onLifetimeBegin=function(e,t){t.active=!0},t.prototype.onItemRemoved=function(e,t){},t.prototype.onItemUpdate=function(e,t){this.content&&(this.content.updateTime(this.time),this.renderData=this.content.getRenderData(this.content.time))},t.prototype.getHitTestParams=function(e){},t.prototype.getRenderData=function(){return this.renderData},t.prototype.getChildrenVisible=function(){return this.childrenVisible},t.prototype.setChildrenVisible=function(e){this.childrenVisible!==e&&(this.childrenVisible=!!e,this.handleVisibleChanged(this.visible))},t.prototype.doCreateContent=function(e){var t=new eL(this.cal,this);return t.renderData=t.getRenderData(0,!0),t},t.prototype.handleVisibleChanged=function(e){this.content&&(this.content.visible=e||this.childrenVisible)},t}(EC),wI=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.getItemGeometryData=function(e,t){var r=e,i=r.splits,n=r.renderer,o=r.textureSheetAnimation,a=r.startSize;r.textLayout;var s=aS(a,2),u=s[0],c=s[1];if(n.shape){for(var l=n.shape,f=l.index,h=l.aPoint,p=new Float32Array(h),d=0;d<p.length;d+=6)p[d]*=u,p[d+1]*=c;return{index:f,aPoint:Array.from(p)}}var m=.5,v=.5,y=[-m,v,-m,-v,m,v,m,-v],g=[],x=[],T=2,E=2;1===i.length&&(T=1,E=1);for(var _=0;_<T;_++)for(var S=0;S<E;S++){var A=4*(2*S+_),R=o?[0,0,1,1,i[0][4]]:i[2*S+_],C=R[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],b=((_+_+1)/T-1)/2,O=((S+S+1)/E-1)/2,L=R[0],I=R[1],w=R[4]?R[3]:R[2],P=R[4]?R[2]:R[3],M=[y[0]/T+b,y[1]/E+O,y[2]/T+b,y[3]/E+O,y[4]/T+b,y[5]/E+O,y[6]/T+b,y[7]/E+O];g.push(M[0]*u,M[1]*c,C[0]*w+L,C[1]*P+I,t,0,M[2]*u,M[3]*c,C[2]*w+L,C[3]*P+I,t,0,M[4]*u,M[5]*c,C[4]*w+L,C[5]*P+I,t,0,M[6]*u,M[7]*c,C[6]*w+L,C[7]*P+I,t,0),this.lineMode?x.push(A,1+A,1+A,3+A,3+A,2+A,2+A,A):x.push(A,1+A,2+A,2+A,1+A,3+A)}return{index:x,aPoint:g}},t}(kO),PI=function(e){var t,r,i,n,o,a;this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var s=e.textColor,u=void 0===s?[1,1,1,1]:s,c=e.fontSize,l=void 0===c?40:c,f=e.outline,h=e.shadow,p=e.fontWeight,d=void 0===p?"normal":p,m=e.fontStyle,v=void 0===m?"normal":m,y=e.fontFamily,g=void 0===y?"sans-serif":y;this.textColor=u,this.textWeight=d,this.fontStyle=v,this.fontFamily=g,this.fontSize=l,f&&(this.isOutlined=!0,this.outlineColor=null!==(t=f.outlineColor)&&void 0!==t?t:[1,1,1,1],this.outlineWidth=null!==(r=f.outlineWidth)&&void 0!==r?r:1,this.fontOffset+=this.outlineWidth),h&&(this.hasShadow=!0,this.shadowBlur=null!==(i=h.shadowBlur)&&void 0!==i?i:2,this.shadowColor=null!==(n=h.shadowColor)&&void 0!==n?n:[0,0,0,1],this.shadowOffsetX=null!==(o=h.shadowOffsetX)&&void 0!==o?o:0,this.shadowOffsetY=null!==(a=h.shadowOffsetY)&&void 0!==a?a:0),this.fontStyle!==xA.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},MI=function(){function e(){}return e.measureFont=function(t){if(e._fonts[t])return e._fonts[t];var r={ascent:0,descent:0,fontSize:0},i=e._canvas,n=i.getContext("2d",{willReadFrequently:!0});n.font=t;var o=e.METRICS_STRING+e.BASELINE_SYMBOL,a=Math.ceil(n.measureText(o).width),s=Math.ceil(n.measureText(e.BASELINE_SYMBOL).width),u=Math.ceil(e.HEIGHT_MULTIPLIER*s);s=s*e.BASELINE_MULTIPLIER|0,i.width=a,i.height=u,n.fillStyle="#f00",n.fillRect(0,0,a,u),n.font=t,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,s);var c=n.getImageData(0,0,a,u).data,l=c.length,f=4*a,h=0,p=0,d=!1;for(h=0;h<s;++h){for(var m=0;m<f;m+=4)if(255!==c[p+m]){d=!0;break}if(d)break;p+=f}for(r.ascent=s-h,p=l-f,d=!1,h=u;h>s;--h){for(m=0;m<f;m+=4)if(255!==c[p+m]){d=!0;break}if(d)break;p-=f}return r.descent=h-s,r.fontSize=r.ascent+r.descent,e._fonts[t]=r,r},Object.defineProperty(e,"_canvas",{get:function(){var t;return Fb(Vb)?(t=window._createOffscreenCanvas(10,10),e.__canvas=t):e.__canvas||((t=document.createElement("canvas")).width=t.height=10,e.__canvas=t),e.__canvas},enumerable:!1,configurable:!0}),e._fonts={},e.METRICS_STRING="|ÉqÅ",e.BASELINE_SYMBOL="M",e.BASELINE_MULTIPLIER=1.4,e.HEIGHT_MULTIPLIER=2,e}(),VI=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];e.QTextWrapMode=void 0,(OI=e.QTextWrapMode||(e.QTextWrapMode={}))[OI.Default=0]="Default",OI[OI.Clip=1]="Clip",OI[OI.Ellipsis=2]="Ellipsis";var NI=function(){function t(t,r){var i,n,o,a,s,u,c,l,f,h;this.left=0,this.top=0,this.fontSize=48,this.fontFamily="Arial",this.color="black",this.letterSpacing=0,this.maxLineWidth=0,this.wrap=e.QTextWrapMode.Clip,this.scaleX=1,this.scaleY=1,this.angle=0,this.active=!0,this.padding=0,this.borderColor="#ffffffff",this.borderWidth=1,this.fontProperties={ascent:0,descent:0,fontSize:0},this.fontVariant="normal",this.originX="left",this.originY="top",this.ellipsis="…",this.text=t,this.left=null!==(i=r.left)&&void 0!==i?i:0,this.top=null!==(n=r.top)&&void 0!==n?n:0,this.maxLineWidth=null!==(o=r.maxWidth)&&void 0!==o?o:0,this.letterSpacing=null!==(a=r.letterSpacing)&&void 0!==a?a:0,this.originX="left",this.originY="top",this.color=null!==(s=r.color)&&void 0!==s?s:"black",this.fontFamily=null!==(u=r.fontFamily)&&void 0!==u?u:"Arial",this.fontSize=null!==(c=r.fontSize)&&void 0!==c?c:48,this.wrap=null!==(l=r.wrap)&&void 0!==l?l:e.QTextWrapMode.Clip,this.fontStyle=null!==(f=r.fontStyle)&&void 0!==f?f:"normal",this.textAlign="left",this.textBaseline="alphabetic",this.fontWeight="normal",this.angle=null!==(h=r.angle)&&void 0!==h?h:0,this.name=r.name||""}return t.prototype.update=function(){this.updateDimension()},t.prototype.render=function(){if(void 0!==this.viewer){var e=this.viewer.renderContext;void 0!==e&&(e.save(),this.setRenderTransform(e),this.renderText(e),this.active&&this.drawBorders(e),e.restore())}},t.prototype.init=function(e){this.viewer=e,this.updateDimension()},t.prototype.getLayout=function(){var e=this.viewer.scaleX,t=this.viewer.scaleY;return{x:this.left*e,y:this.top*t,width:this.width*e,height:this.height*t}},t.prototype.updateDimension=function(){var e=this.viewer.renderContext;this.configTextStyle(e),this.configTextLayout(e);var t=this.getFontDesc();this.fontProperties=MI.measureFont(t),0===this.fontProperties.fontSize&&(this.fontProperties.fontSize=this.fontSize,this.fontProperties.ascent=this.fontSize);var r=this.createCharsFromText(e,this.text),i=0;if(r.length>0){var n=r[r.length-1];i=n.left+n.width}this.chars=r,this.maxLineWidth=i,void 0===this.height&&(this.height=this.fontProperties.fontSize),void 0===this.width&&(this.width=this.maxLineWidth)},t.prototype.configTextStyle=function(e){e.font=this.getFontDesc(),e.fillStyle=this.color},t.prototype.getFontDesc=function(){for(var e="number"==typeof this.fontSize?"".concat(this.fontSize,"px"):this.fontSize,t=this.fontFamily.split(","),r=t.length-1;r>=0;r--){var i=t[r].trim();/([\"\'])[^\'\"]+\1/.test(i)||VI.includes(i)||(i='"'.concat(i,'"')),t[r]=i}return t.push("Arial, Helvetica, sans-serif"),"".concat(this.fontStyle," ").concat(this.fontVariant," ").concat(this.fontWeight," ").concat(e," ").concat(t.join(","))},t.prototype.configTextLayout=function(e){e.textBaseline=this.textBaseline,e.textAlign=this.textAlign},t.prototype.setRenderTransform=function(e){e.scale(this.scaleX,this.scaleY),e.translate(this.left,this.top)},t.prototype.renderText=function(e){this.drawCharsInTextBox(e,{min:[0,0],max:[0+this.width,0+this.height]})},t.prototype.drawCharsInTextBox=function(t,r){var i=this.chars,n=0;if(i.length>0){var o=i[i.length-1];n=o.left+o.width}var a=r.max[0]-r.min[0],s=0;"left"===this.textAlign?s=0:"center"===this.textAlign?s=.5*(a-n):"right"===this.textAlign&&(s=a-n),this.addOffsetToChars(i,s);var u=this.cloneChars(this.clipCharsWithTextBox(i,r)),c=u;this.wrap===e.QTextWrapMode.Ellipsis&&0===(c=this.replaceCharWithEllipsis(t,u,r)).length&&0!==i.length&&this.addEllipsisToChars(t,c,r),this.drawCharsFromLeft(t,c)},t.prototype.addEllipsisToChars=function(e,t,r){var i,n,o,a=e.measureText(this.ellipsis).width;if("left"===this.textAlign)t.push({char:this.ellipsis,left:r.min[0],top:0,width:a,heigh:null!==(i=this.height)&&void 0!==i?i:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else if("right"===this.textAlign)t.push({char:this.ellipsis,left:r.max[0]-a,top:0,width:a,heigh:null!==(n=this.height)&&void 0!==n?n:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else{var s=.5*(r.max[0]+r.min[0]);t.push({char:this.ellipsis,left:s-.5*a,top:0,width:a,heigh:null!==(o=this.height)&&void 0!==o?o:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0})}},t.prototype.createCharsFromText=function(e,t){var r=t.split(""),i=0,n=0;"top"===this.textBaseline?n=0:"middle"===this.textBaseline?n+=.5*this.fontProperties.ascent:"alphabetic"===this.textBaseline&&(n+=this.fontProperties.ascent);for(var o=[],a=0;a<r.length;++a){var s=r[a],u=Math.floor(e.measureText(s).width),c={left:i,top:n,width:u,heigh:this.fontSize,char:s,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!1,scale:1,index:a};o.push(c),i+=u+this.letterSpacing}return o},t.prototype.addOffsetToChars=function(e,t){return e.forEach((function(e){e.left+=t})),e},t.prototype.clipCharsWithTextBox=function(e,t){for(var r=[],i=0;i<e.length;++i){var n=e[i];n.left>=t.min[0]&&n.left+n.width<t.max[0]+.5&&r.push(n)}return r},t.prototype.cloneChars=function(e){return e.map((function(e){return rS({},e)}))},t.prototype.replaceCharWithEllipsis=function(e,t,r){var i=e.measureText(this.ellipsis).width;if(t.length>0){if(0!==t[0].index)(n=rS({},t[0])).char=this.ellipsis,n.isEllipsis=!0,n.width=i,t=this.findEllipsisPositionAndReplaceCharsFromLeft(t,n,r);var n,o=t.length-1,a=this.chars.length;if(t[o].index!==a-1)(n=rS({},t[0])).char=this.ellipsis,n.isEllipsis=!0,n.width=i,t=this.findEllipsisPositionAndReplaceCharsFromRight(t,n,r)}return t},t.prototype.findEllipsisPositionAndReplaceCharsFromLeft=function(e,t,r){for(var i=0,n=0;n<e.length;++n){var o=e[n];if(i=n,o.left+o.width-t.width>=r.min[0])break}var a=e[i];t.left=a.left+a.width-t.width;for(n=0;n<i+1;++n)e.shift();return[t].concat(e)},t.prototype.findEllipsisPositionAndReplaceCharsFromRight=function(e,t,r){for(var i=e.length-1,n=i;n>=0;--n){if(i=n,e[n].left+t.width<=r.max[0])break}t.left=e[i].left;for(n=e.length-1;n>=i;--n)e.pop();return e.concat([t])},t.prototype.drawCharsFromLeft=function(e,t){var r=e.textAlign||"left";e.textAlign="left";for(var i=0;i<t.length;++i){var n=t[i];e.fillText(n.char,n.left,n.top)}e.textAlign=r},t.prototype.drawBorders=function(e){this.padding;var t=this.borderWidth;e.strokeStyle=this.borderColor,e.lineWidth=t;var r=this.width,i=this.height,n=0,o=0;"center"===this.originX?n-=this.width/2:"right"===this.originX&&(n-=this.width),"center"===this.originY?o-=this.height/2:"bottom"===this.originY&&(o-=this.height),e.strokeRect(n+t/2,o+t/2,r-t,i-t)},t}(),FI=function(){function e(e,t,r,i,n,o){var a;this.textList=[],a="string"==typeof e?document.getElementById(e):e,this.scaleX=null!=i?i:1,this.scaleY=null!=n?n:1,this.flipY=null!=o&&o,this.width=t,this.height=r,a.style.width="".concat(t*this.scaleX,"px"),a.style.height="".concat(r*this.scaleY,"px");this.devicePixelRatio=1,a.width=1*t*this.scaleX,a.height=1*r*this.scaleY,a.className="lower-canvas",this.renderCanvas=a,this.renderContext=this.renderCanvas.getContext("2d"),this.renderContext.scale(1*this.scaleX,1*this.scaleY)}return e.prototype.initDimension=function(e,t,r,i){this.width=e,this.height=t,this.scaleX=null!=r?r:1,this.scaleY=null!=i?i:1,this.renderCanvas.style.width="".concat(e*this.scaleX,"px"),this.renderCanvas.style.height="".concat(t*this.scaleY,"px");var n=this.devicePixelRatio;this.renderCanvas.width=n*e*this.scaleX,this.renderCanvas.height=n*t*this.scaleY,this.flipY&&(this.renderContext.translate(0,this.height),this.renderContext.scale(1,-1)),this.renderContext.scale(n*this.scaleX,n*this.scaleY)},e.prototype.clearText=function(){this.textList=[]},e.prototype.clearCanvasWithContext=function(e){e.clearRect(0,0,this.width,this.height)},e.prototype.clearCanvas=function(){this.clearCanvasWithContext(this.renderContext)},e.prototype.addObject=function(e){e.init(this),this.textList.push(e)},e.prototype.render=function(){this.clearCanvasWithContext(this.renderContext),this.renderContext.fillStyle="rgba(255, 255, 255, 0.0039)",this.renderContext.fillRect(0,0,this.width,this.height);var e=this.background;e&&void 0!==e.width&&void 0!==e.height&&this.renderContext.drawImage(e,0,0,e.width,e.height,0,0,this.width,this.height);for(var t=0;t<this.textList.length;++t){this.renderContext.save();var r=this.textList[t];r.update(),r.render(),this.renderContext.restore()}},e}();function DI(e,t){return t=t||{},new Promise((function(r,i){var n=new XMLHttpRequest;n.responseType=(null==t?void 0:t.responseType)||"json",n.addEventListener("load",(function(){return r(n.response)})),n.addEventListener("error",(function(){return i(Error("load ".concat(e," fail")))})),n.open((null==t?void 0:t.method)||"get",e),n.send(null==t?void 0:t.data)}))}function UI(e,t,r,i,n){return iS(this,void 0,void 0,(function(){var o,a,s,u,c,l,f,h,p,d;return nS(this,(function(m){switch(m.label){case 0:return o={},a=[],i=i||{},r=r||{},t.asImage?(s=t.content.replace(/\$/g,""),u=r[s]||t.variables[s],c=function(e){var r=(null==i?void 0:i.canvas)||document.createElement("canvas"),o=r.width=t.backgroundWidth,a=r.height=t.backgroundHeight,s=r.getContext("2d");return null==s||s.clearRect(0,0,o,a),n&&(null==s||s.translate(0,a),null==s||s.scale(1,-1)),null==s||s.drawImage(e,0,0,e.width,e.height,0,0,o,a),r},u?[2,$C(u).then(c)]:[2,BI(e).then(c)]):(l=i.templateScale||1,Object.keys(t.variables).forEach((function(e){var i=t.variables[e];if(r.hasOwnProperty(e)&&(i=r[e]),/^image_/.test(e)){var n=i instanceof Array,s=n?i[0]:i;a.push(function(e,t){return r(e,(function(i){return t?r(t,(function(){return e})):e}));function r(e,t){return/^(https?:)?\/\//.test(e)?DI(e,{responseType:"blob"}).then(kI,t):Promise.resolve(e)}}(s,n&&i[1]).then((function(t){return o[e]=t})))}else o[e]=i})),[4,Promise.all(a)]);case 1:return m.sent(),[4,$C(e)];case 2:return f=m.sent(),h=t.content.replace(/\$([\w_]+)\$/g,(function(e,t){return o[t]})).replace('width="'.concat(t.width,'px"'),'width="'.concat(t.width*l,'px"')).replace('height="'.concat(t.height,'px"'),'height="'.concat(t.height*l,'px"')),[4,$C("data:image/svg+xml,".concat(encodeURIComponent(h)))];case 3:return p=m.sent(),(d=(null==i?void 0:i.canvas)||document.createElement("canvas")).width=f.width*l,d.height=f.height*l,[2,new Promise((function(e,r){var i=d.getContext("2d");i.clearRect(0,0,d.width,d.height),n&&(i.translate(0,d.height),i.scale(1,-1)),i.drawImage(f,0,0,f.width,f.height,0,0,d.width,d.height),i.drawImage(p,0,0,p.width,p.height,(t.x||0)*l,(t.y||0)*l,t.width*l/t.backgroundWidth*f.width,t.height*l/t.backgroundHeight*f.height),e(d)}))]}}))}))}function BI(e){return lC(e)?$C(e):Promise.resolve(e)}function kI(e){return new Promise((function(t,r){var i=new FileReader;i.readAsDataURL(e),i.onload=function(){t(i.result)},i.onerror=r}))}var zI=["serif","sans-serif","monospace","courier"],GI=800,jI=600,XI=new Map,WI=new(function(){function e(){this.elements=[]}return e.prototype.dispose=function(){this.elements.forEach((function(e){return e.remove()})),this.elements=[]},e.prototype.getCanvas=function(){if(this.elements.length)return this.elements.shift();if(Fb(Vb))return window._createOffscreenCanvas(10,10);var e=document.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},e.prototype.saveCanvas=function(e){e.width=e.height=1,this.elements.length<3?kS(this.elements,e):e.remove()},e}());function HI(e,t){var r,i,n;if(null===(r=null==e?void 0:e.background)||void 0===r?void 0:r.name){var o=e.background.name;t&&t[o]?n=t[o]:(null===(i=e.background)||void 0===i?void 0:i.url)&&(n=e.background.url)}return n}function YI(t,r,i,n,o){var a;return iS(this,void 0,void 0,(function(){var s,u,c,l,f,h,p,d,m,v,y;return nS(this,(function(g){switch(g.label){case 0:if(!r)throw Error("image not provided");return s=(null==o?void 0:o.templateScale)||1,u=s,c=s,l=r,f=r.width,h=r.height,i?(f=i.width,h=i.height,r.width===f&&r.height===h||(u*=r.width/i.width,c*=r.height/i.height),(p=HI(i,n))&&p!==r.src?lC(p)?[4,$C(p)]:[3,2]:[3,4]):[3,5];case 1:return d=g.sent(),[3,3];case 2:d=p,g.label=3;case 3:l=d,g.label=4;case 4:(m=i.content)&&(v=function(t,r,i){var n=t.fonts,o=[];return t.texts.forEach((function(a){var s,u=a.t,c=a.x,l=a.y,f={weight:400,family:"serif",size:48,style:xA.normal};void 0!==a.f&&(f=n[a.f]);var h=a.n;h&&r&&r.hasOwnProperty(h)&&(u="".concat(r[h]));var p=new NI(u,{left:c,top:l,fontSize:f.size,fontFamily:f.family,fontWeight:"".concat(f.weight),fontStyle:"normal",name:h});if(void 0!==a.r&&(p.angle=a.r*Math.PI/180),p.active=null!==(s=null==i?void 0:i.debug)&&void 0!==s&&s,void 0!==a.w&&(p.width=a.w),void 0!==f.letterSpace&&(p.letterSpacing=f.letterSpace),a.of===mA.display?p.wrap=e.QTextWrapMode.Default:a.of===mA.clip?p.wrap=e.QTextWrapMode.Clip:a.of===mA.ellipsis&&(p.wrap=e.QTextWrapMode.Ellipsis),void 0!==a.c){var d=t.colors[a.c][1],m=1;void 0!==d[3]&&(m=d[3]/255),p.color="rgba(".concat(d[0],", ").concat(d[1],", ").concat(d[2],", ").concat(m,")")}a.a===yA.left?p.textAlign="left":a.a===yA.middle?p.textAlign="center":a.a===yA.right&&(p.textAlign="right"),f.style===xA.normal?p.fontStyle="normal":f.style===xA.italic?p.fontStyle="italic":f.style===xA.oblique&&(p.fontStyle="oblique"),void 0!==f.weight&&(p.fontWeight=String(f.weight)),(null==i?void 0:i.borderColor)&&(p.borderColor=i.borderColor),void 0!==(null==i?void 0:i.borderWidth)&&(p.borderWidth=i.borderWidth),o.push(p)})),o}(m,n,rS(rS({},o),{scaleX:u,scaleY:c})),v.forEach((function(e){t.addObject(e)}))),g.label=5;case 5:return t.flipY=null!==(a=null==o?void 0:o.flipY)&&void 0!==a&&a,t.initDimension(f,h,u,c),t.background=l,t.render(),(y=null==o?void 0:o.textLayouts)&&(y.length=0,t.textList.forEach((function(e){var t=e.getLayout(),r={x:t.x,y:t.y,width:t.width,height:t.height};y.push(r)}))),[2]}}))}))}function ZI(e){return iS(this,void 0,void 0,(function(){var t,r,i;return nS(this,(function(n){switch(n.label){case 0:if(!e.content||!e.content.fonts)return[3,4];t=e.content.fonts,r=function(e){var r,i,n,o,a;return nS(this,(function(s){switch(s.label){case 0:return r=t[e].family,i=t[e].url,n=!1,zI.includes(r)?n=!0:void 0!==document.fonts&&document.fonts.forEach((function(e){e.family===r&&(n=!0)})),n||void 0===i||""===i?[3,2]:(o="url(".concat(i,")"),void 0===document.fonts?[3,2]:[4,(a=new FontFace("".concat(r),o)).load()]);case 1:s.sent(),document.fonts.add(a),s.label=2;case 2:return[2]}}))},i=0,n.label=1;case 1:return i<t.length?[5,r(i)]:[3,4];case 2:n.sent(),n.label=3;case 3:return++i,[3,1];case 4:return[2]}}))}))}function qI(e,t,r,i,n){return iS(this,void 0,void 0,(function(){var o,a,s;return nS(this,(function(u){switch(u.label){case 0:return o=rS(rS({},i),{flipY:n}),a=function(e,t,r){var i,n=(null==r?void 0:r.templateScale)||1,o=(null==r?void 0:r.flipY)||!1;if(null==r?void 0:r.canvas){if(!(i=XI.get(r.canvas))){var a=new FI(r.canvas,e,t,n,n,o);XI.set(r.canvas,a),i=a}}else{var s=WI.getCanvas();i=new FI(s,GI,jI,n,n,o)}return i}(GI,GI,o),void 0===t?[3,2]:[4,ZI(t)];case 1:u.sent(),u.label=2;case 2:return a.clearText(),"string"!=typeof e?[3,5]:[4,$C(e)];case 3:return s=u.sent(),[4,YI(a,s,t,r,o)];case 4:return u.sent(),[2,a.renderCanvas];case 5:return[4,YI(a,e,t,r,o)];case 6:return u.sent(),[2,a.renderCanvas]}}))}))}function KI(e,t,r,i,n){return iS(this,void 0,void 0,(function(){return nS(this,(function(o){return 2===t.v?[2,qI(e,t,r,{templateScale:null==i?void 0:i.templateScale,toData:!0},n)]:[2,UI(e,t,r,i,n)]}))}))}var QI=function(){function e(e,t){this.width=0,this.height=0;var r=e.textHeight,i=void 0===r?100:r,n=e.textWidth,o=void 0===n?100:n,a=e.textOverflow,s=void 0===a?mA.display:a,u=e.textBaseline,c=void 0===u?vA.top:u,l=e.textAlign,f=void 0===l?yA.left:l,h=e.text,p=e.letterSpace,d=void 0===p?0:p,m=e.autoWidth,v=void 0!==m&&m,y=e.fontSize,g=e.lineHeight,x=void 0===g?y:g,T=y+d;this.autoWidth=v,this.maxTextWidth=h.length*T,this.width=o,this.height=i,this.letterSpace=d,this.overFlow=s,this.textBaseline=c,this.textAlign=f,this.lineHeight=x}return e.prototype.getOffsetY=function(e){var t=0,r=(e.fontSize+e.outlineWidth)*e.fontScale;switch(this.textBaseline){case 0:t=r;break;case 1:t=(this.height+r)/2;break;case 2:t=this.height-r/2}return t},e.prototype.getOffsetX=function(e,t){var r=0;switch(this.textAlign){case 0:r=e.outlineWidth*e.fontScale;break;case 1:r=(this.width*e.fontScale-t)/2;break;case 2:r=this.width*e.fontScale-t}return r},e.prototype.setSize=function(e,t){this.width=e,this.height=t},e}(),JI=function(e){function t(t,r,i){var n=e.call(this,t,r,i)||this;n.isDirty=!0;var o=t.options,a=n.basicTransform.scale;return n.canvas=WI.getCanvas(),WI.saveCanvas(n.canvas),n.context=n.canvas.getContext("2d",{willReadFrequently:!0}),n.engine=i.composition.getEngine(),n.textStyle=new PI(o),n.textLayout=new QI(o,a),n.text=o.text,n.mesh=new wI(n.engine,n.renderInfo,i.composition),n.mesh.setItems([n]),n.updateTexture(),n}return tS(t,e),t.prototype.setFontSize=function(e){this.textStyle.fontSize!==e&&(this.textStyle.fontSize=e,this.textLayout.lineHeight=1.5175*this.textStyle.fontSize,this.isDirty=!0)},t.prototype.setFontWeight=function(e){this.textStyle.textWeight!==e&&(this.textStyle.textWeight=e,this.isDirty=!0)},t.prototype.setFontStyle=function(e){this.textStyle.fontStyle!==e&&(this.textStyle.fontStyle=e,this.isDirty=!0)},t.prototype.setText=function(e){this.text!==e&&(this.text=e,this.isDirty=!0)},t.prototype.setTextAlign=function(e){this.textLayout.textAlign!==e&&(this.textLayout.textAlign=e,this.isDirty=!0)},t.prototype.setTextBaseline=function(e){this.textLayout.textBaseline!==e&&(this.textLayout.textBaseline=e,this.isDirty=!0)},t.prototype.setTextColor=function(e){this.textStyle.textColor!==e&&(this.textStyle.textColor=e,this.isDirty=!0)},t.prototype.setFontFamily=function(e){this.textStyle.fontFamily!==e&&(this.textStyle.fontFamily=e,this.isDirty=!0)},t.prototype.setOutlineColor=function(e){this.textStyle.outlineColor!==e&&(this.textStyle.outlineColor=e,this.isDirty=!0)},t.prototype.setOutlineWidth=function(e){this.textStyle.outlineWidth!==e&&(this.textStyle.outlineWidth=e,this.isDirty=!0)},t.prototype.setShadowBlur=function(e){this.textStyle.shadowBlur!==e&&(this.textStyle.shadowBlur=e,this.isDirty=!0)},t.prototype.setShadowColor=function(e){this.textStyle.shadowColor!==e&&(this.textStyle.shadowColor=e,this.isDirty=!0)},t.prototype.setShadowOffsetX=function(e){this.textStyle.shadowOffsetX!==e&&(this.textStyle.shadowOffsetX=e,this.isDirty=!0)},t.prototype.setShadowOffsetY=function(e){this.textStyle.shadowOffsetY!==e&&(this.textStyle.shadowOffsetY=e,this.isDirty=!0)},t.prototype.setFontScale=function(e){this.textStyle.fontScale!==e&&(this.textStyle.fontScale=e,this.isDirty=!0)},t.prototype.updateTexture=function(){var e;if(this.isDirty&&this.context&&this.canvas){var t=this.context,r=this.textStyle,i=this.textLayout,n=r.fontScale,o=(i.width+r.fontOffset)*n,a=r.fontSize*n,s=i.lineHeight*n;this.char=this.text.split(""),this.canvas.width=o,this.canvas.height=i.height*n,t.clearRect(0,0,o,this.canvas.height),t.fillStyle="rgba(255, 255, 255, 0.0039)",t.fillRect(0,0,o,this.canvas.height),r.fontDesc=this.getFontDesc(),t.font=r.fontDesc,r.hasShadow&&this.setupShadow(),r.isOutlined&&this.setupOutline(),t.fillStyle="rgba(".concat(r.textColor[0],", ").concat(r.textColor[1],", ").concat(r.textColor[2],", ").concat(r.textColor[3],")");for(var u=[],c=(s-a)/3,l=0,f=i.getOffsetY(r)+c,h=[],p=[],d=0;d<this.char.length;d++){var m=this.char[d],v=t.measureText(m);((l+=i.letterSpace*n)+v.width>o&&d>0||"\n"===m)&&(u.push({y:f,width:l,chars:h,charOffsetX:p}),l=0,f+=s,h=[],p=[]),"\n"!==m&&(h.push(m),p.push(l),l+=v.width)}u.push({y:f,width:l,chars:h,charOffsetX:p}),u.forEach((function(e){var n=i.getOffsetX(r,e.width);e.chars.forEach((function(i,o){r.isOutlined&&t.strokeText(i,n+e.charOffsetX[o],e.y),t.fillText(i,n+e.charOffsetX[o],e.y)}))})),r.hasShadow&&(t.shadowColor="transparent");var y=t.getImageData(0,0,this.canvas.width,this.canvas.height);null===(e=this.mesh)||void 0===e||e.mesh.material.setTexture("uSampler0",ob.createWithData(this.engine,y,{flipY:!0,magFilter:xS.LINEAR,minFilter:xS.LINEAR,wrapS:xS.REPEAT,wrapT:xS.REPEAT})),this.isDirty=!1}},t.prototype.getFontDesc=function(){var e=this.textStyle,t="".concat((e.fontSize*e.fontScale).toString(),"px ");return zI.includes(e.fontFamily)?t+=e.fontFamily:t+='"'.concat(e.fontFamily,'"'),e.textWeight!==gA.normal&&(t="".concat(e.textWeight," ").concat(t)),e.fontStyle!==xA.normal&&(t="".concat(e.fontStyle," ").concat(t)),t},t.prototype.setupOutline=function(){var e=this.context,t=this.textStyle;e.strokeStyle="rgba(".concat(255*t.outlineColor[0],", ").concat(255*t.outlineColor[1],", ").concat(255*t.outlineColor[2],", ").concat(t.outlineColor[3],")"),e.lineWidth=2*t.outlineWidth},t.prototype.setupShadow=function(){var e=this.context,t=this.textStyle;e.shadowColor="rgba(".concat(255*t.shadowColor[0],", ").concat(255*t.shadowColor[1],", ").concat(255*t.shadowColor[2],", ").concat(t.shadowColor[3],")"),e.shadowBlur=t.shadowBlur,e.shadowOffsetX=t.shadowOffsetX,e.shadowOffsetY=-t.shadowOffsetY},t}(iL),$I=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return tS(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return wS.text},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(e){this.textContext=e.content},r.prototype.onLifetimeBegin=function(e,t){this._contentVisible=!0,t.active=!0},r.prototype.onItemRemoved=function(e,t){this._contentVisible=!1,t&&(delete t.mesh,e.destroyTextures(t.getTextures()))},r.prototype.handleVisibleChanged=function(e){this.content&&(this.content.visible=e)},r.prototype.onItemUpdate=function(e,t){var r;null===(r=this.content)||void 0===r||r.updateTime(this.time)},r.prototype.getCurrentPosition=function(){var e=[0,0,0];return this.transform.assignWorldTRS(e),e},r.prototype.getBoundingBox=function(){var t=this.content;if(t&&this.transform){var r=this.transform.getWorldMatrix(),i=t.startSize,n=LR([0,0,0],i[0]/2,i[1]/2);return n.forEach((function(e){e.forEach((function(e){cR(e,e,r)}))})),{type:e.HitTestType.triangle,area:n}}},r.prototype.getHitTestParams=function(e){var t,r,i=this.content,n=i&&i.interaction;if((e||n)&&(null===(t=i.mesh)||void 0===t?void 0:t.mesh)&&i){var o=this.getBoundingBox();if(o)return{behavior:(null===(r=i.interaction)||void 0===r?void 0:r.behavior)||0,type:o.type,triangles:o.area,backfaceCulling:i.renderer.side===RS.FRONT}}},r.prototype.getRenderData=function(){return this.content.getRenderData(this.content.time)},r.prototype.doCreateContent=function(e){var t=e.getRendererOptions().emptyTexture;return new JI(this.textContext,{emptyTexture:t},this)},r.prototype.createWireframeMesh=function(e,t){var r=new wI(this.composition.getEngine(),rS({wireframe:!0},e.renderInfo),this.composition);return r.setItems([e]),r.mesh.material.setVector3("uFrameColor",[t[0],t[1],t[2]]),r.mesh.priority=999,r},r}(EC),ew=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="text",e.addItems=[],e.removeItems=[],e.meshes=[],e}return tS(r,t),r.prototype.onCompositionDestroyed=function(t){t.reusable||t.keepResource?this.addItems.forEach((function(t){var r;null===(r=t.content.mesh)||void 0===r||r.mesh.dispose({material:{textures:e.DestroyOptions.keep}})})):this.addItems.forEach((function(e){var t;null===(t=e.content.mesh)||void 0===t||t.mesh.dispose()}))},r.prototype.onCompositionUpdate=function(e,t){this.addItems.forEach((function(e){var t;e.content.updateTexture(),!e.content.ended&&e.content.mesh&&e.content.mesh.updateItem(e.content),null===(t=e.content.mesh)||void 0===t||t.applyChange()}))},r.prototype.onCompositionItemLifeBegin=function(e,t){var r;t instanceof $I&&t.content&&(this.addItems.includes(t)||(kS(this.addItems,t),!t.content.ended&&t.content.mesh&&t.content.mesh.updateItem(t.content),null===(r=t.content.mesh)||void 0===r||r.applyChange()))},r.prototype.onCompositionReset=function(e,t){},r.prototype.onCompositionItemRemoved=function(t,r){var i;r instanceof $I&&r&&(kS(this.removeItems,r),this.addItems.includes(r)&&(null===(i=r.content)||void 0===i?void 0:i.mesh)&&(zS(this.addItems,r),r.content.mesh.mesh.dispose({material:{textures:e.DestroyOptions.keep}}),r.dispose()))},r.prototype.prepareRenderFrame=function(t,r){var i=this;return this.removeItems.map((function(t){var n,o;(null===(n=t.content)||void 0===n?void 0:n.mesh)&&(r.removeMeshFromDefaultRenderPass(null===(o=t.content.mesh)||void 0===o?void 0:o.mesh),zS(i.addItems,t),t.content.mesh.mesh.dispose({material:{textures:e.DestroyOptions.keep}}),t.dispose())})),this.addItems.forEach((function(e){var t;e.content.mesh&&r.addMeshToDefaultRenderPass(null===(t=e.content.mesh)||void 0===t?void 0:t.mesh)})),this.removeItems.length=0,!1},r}(LC);function tw(e,t,r){return function(e,t,r){var i=rS(rS({},t.material.props),{shader:r}),n=t.material.clone(i);return n.blending=!1,n.depthTest=!1,n.culling=!1,kb.create(e,{geometry:t.geometry,material:n})}(e,t,GO(e.gpuCapability.level,{fragment:r.fragment},{ignoreBlend:!0}))}var rw=function(t){function r(e,r,i,n,o,a){var s=t.call(this,e,a)||this;return s.uTexStep=i,s.pluginSystem=n,s.fragShader=o,s.type=r,s}return tS(r,t),r.prototype.configure=function(t){if(this.prePassTexture=t.getFrameBuffer().getColorTextures()[0]?t.getFrameBuffer().getColorTextures()[0]:t.renderingData.currentFrame.transparentTexture,"H"===this.type&&(this.preDefaultPassAttachment.texture=this.prePassTexture),this.preDefaultPassTexture=this.preDefaultPassAttachment.texture,!this.mframeBuffer){var r=ob.create(t.engine,{sourceType:e.TextureSourceType.framebuffer,minFilter:xS.LINEAR,magFilter:xS.LINEAR,name:this.type,internalFormat:xS.RGBA,format:xS.RGBA,type:xS.UNSIGNED_BYTE});this.mframeBuffer=wO.create({name:this.type,storeAction:{},viewport:this.viewport,viewportScale:1,isCustomViewport:!0,attachments:[r],depthStencilAttachment:{storageType:e.RenderPassAttachmentStorageType.none}},t)}t.setFrameBuffer(this.mframeBuffer)},r.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",TO(this.preDefaultPassTexture)),this.meshes[1].material.setVector2("uTexStep",this.uTexStep),this.meshes[1].material.setTexture("uBlurSource",this.uBlurSource?this.uBlurSource:this.prePassTexture),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",TO(this.prePassTexture));var t=[this.meshes[0],tw(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},r.prototype.dispose=function(e){t.prototype.dispose.call(this,e);var r=this.mframeBuffer;r&&r.dispose(e)},r}(Wb),iw=function(e){function t(t,r,i){var n=e.call(this,t,r)||this;return i&&(n.preDefaultPassAttachment=i),n}return tS(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],this.preDefaultPassAttachment||(this.preDefaultPassAttachment=new jb(e.engine,{}),this.preDefaultPassAttachment.texture=this.prePassTexture),e.setFrameBuffer(this.frameBuffer)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassAttachment.texture),this.meshes[0].material.setVector2("uFilterSourceSize",TO(this.preDefaultPassAttachment.texture)),this.meshes[1].material.setTexture("uFrameSource",this.prePassTexture),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uFilterSourceSize",TO(this.prePassTexture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(Wb);function nw(e){for(var t=e.radius<=3?1:2,r=e.radius/t,i=e.maxStep||4;r>10&&t<i;)t*=2,r=e.radius/t;for(var n=1+e.radius%t/t/t,o=function(e){for(var t=(e+1)/3.329,r=[],i=-e;i<=e;i++)r.push(ow(i,t));return r}(r=Math.floor(r)),a=[],s=-r;s<=r;s++){var u=o[s+r];a.push("color += texture2D(uBlurSource,getTexCoord(".concat(s.toFixed(1),")) * ").concat(u,";"))}return{shader:"\n uniform sampler2D uBlurSource;\n uniform vec2 uTexSize;\n uniform vec2 uTexStep;\n #define getTexCoord(i) coord + uTexStep/uTexSize * i\n vec4 filterMain(vec2 coord,sampler2D tex){\n vec4 color = vec4(0.);\n vec2 texCoord;\n ".concat(a.join("\n"),"\n\n return color;\n }\n "),step:n,downSample:t,radius:r}}function ow(e,t){return Math.exp(-e*e/(2*t*t))/Math.sqrt(2*Math.PI)/t}var aw=function(e){function t(t,r){return e.call(this,t,r)||this}return tS(t,e),t.prototype.configure=function(e){var t=e.getFrameBuffer();this.preDefaultPassAttachment.texture=t?t.getColorTextures()[0]:e.renderingData.currentFrame.transparentTexture,e.setFrameBuffer(this.frameBuffer)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uTexSize",TO(this.preDefaultPassAttachment.texture));var t=[tw(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},t}(Wb),sw=function(e){function t(t,r,i,n,o,a,s){var u=e.call(this,t,a)||this;return u.uTexStep=i,u.pluginSystem=n,u.fragShader=o,u.type=r,s&&(u.uBlurSource=s),u}return tS(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],this.preDefaultPassTexture=this.preDefaultPassAttachment.texture,e.setFrameBuffer(this.frameBuffer),this.uBlurSource||(this.uBlurSource=this.prePassTexture)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[1].material.setVector2("uTexStep",this.uTexStep),this.meshes[1].material.setTexture("uBlurSource",this.uBlurSource),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",TO(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",TO(this.uBlurSource));var t=[tw(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},t}(Wb),uw=function(e){function t(t,r,i){var n=e.call(this,t,r)||this;return n.preDefaultPassAttachment=i,n}return tS(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],e.setFrameBuffer(this.frameBuffer)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassAttachment.texture),this.meshes[0].material.setVector2("uFilterSourceSize",TO(this.preDefaultPassAttachment.texture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uFilterSourceSize",TO(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",TO(this.preDefaultPassAttachment.texture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(Wb),cw=function(e){function t(t,r){return e.call(this,t,r)||this}return tS(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],e.setFrameBuffer(this.frameBuffer)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",TO(this.prePassTexture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.prePassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",TO(this.prePassTexture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(Wb);function lw(e,t,r){for(var i=KR(t||1),n=t?256:1,o=new Uint8Array(n),a=0;a<n;a++){var s=a/(n-1);o[a]=Math.round(255*i.getValue(r?1-s:s))}return ob.createWithData(e,{width:n,height:1,data:o},{format:xS.LUMINANCE})}var fw=[1,1,1],hw=function(){function e(e,t){void 0===t&&(t={}),this.name=e,this.viewMatrix=PA(),this.projectionMatrix=PA(),this.viewProjectionMatrix=PA(),this.inverseViewMatrix=PA(),this.dirty=!0;var r=t.near,i=void 0===r?.1:r,n=t.far,o=void 0===n?20:n,a=t.fov,s=void 0===a?60:a,u=t.aspect,c=void 0===u?1:u,l=t.clipMode,f=void 0===l?iA.portrait:l,h=t.position,p=void 0===h?[0,0,8]:h,d=t.rotation,m=void 0===d?[0,0,0]:d;this.options={near:i,far:o,fov:s,aspect:c,clipMode:f,position:p,rotation:m},this.dirty=!0,this.updateMatrix()}return Object.defineProperty(e.prototype,"near",{get:function(){return this.options.near},set:function(e){this.options.near!==e&&(this.options.near=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"far",{get:function(){return this.options.far},set:function(e){this.options.far!==e&&(this.options.far=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fov",{get:function(){return this.options.fov},set:function(e){this.options.fov!==e&&(this.options.fov=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aspect",{get:function(){return this.options.aspect},set:function(e){this.options.aspect!==e&&(this.options.aspect=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clipMode",{get:function(){return this.options.clipMode},set:function(e){void 0!==e&&this.options.clipMode!==e&&(this.options.clipMode=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return sS([],aS(this.options.position),!1)},set:function(e){var t=this;e.map((function(e,r){t.options.position[r]!==e&&(t.options.position[r]=e,t.dirty=!0)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return sS([],aS(this.options.rotation),!1)},set:function(e){var t=this;e.map((function(e,r){t.options.rotation[r]!==e&&(t.options.rotation[r]=e,t.dirty=!0,t.options.quat=void 0)}))},enumerable:!1,configurable:!0}),e.prototype.getViewMatrix=function(){return this.updateMatrix(),dC(this.viewMatrix)},e.prototype.getInverseViewMatrix=function(){return this.updateMatrix(),dC(this.inverseViewMatrix)},e.prototype.getProjectionMatrix=function(){return this.updateMatrix(),dC(this.projectionMatrix)},e.prototype.getInverseProjectionMatrix=function(){return this.updateMatrix(),dC(this.inverseProjectionMatrix)},e.prototype.getViewProjectionMatrix=function(){return this.updateMatrix(),dC(this.viewProjectionMatrix)},e.prototype.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=FA([],this.viewProjectionMatrix)),dC(this.inverseViewProjectionMatrix)},e.prototype.getModelViewProjection=function(e,t){return DA(e,this.viewProjectionMatrix,t)},e.prototype.setQuat=function(e){var t=this;if(void 0===this.options.quat)this.options.quat=e,this.dirty=!0;else{var r=this.options.quat;e.map((function(e,i){r[i]!==e&&(r[i]=e,t.dirty=!0)}))}this.dirty&&this.setRotationByQuat(e)},e.prototype.getQuat=function(){var e=this.options.quat;if(void 0===e){e=[0,0,0,1];var t=this.options.rotation;t&&xR(e,t[0],t[1],t[2]),this.options.quat=e}return e},e.prototype.getOptions=function(){return this.options},e.prototype.copy=function(e){var t=e.near,r=e.far,i=e.fov,n=e.clipMode,o=e.aspect,a=e.position,s=e.rotation;this.near=t,this.far=r,this.fov=i,this.clipMode=n,this.aspect=o,this.position=a,this.rotation=s,this.updateMatrix()},e.prototype.updateMatrix=function(){if(this.dirty){var e=this.options,t=e.fov,r=e.aspect,i=e.near,n=e.far,o=e.clipMode,a=e.position;UA(this.projectionMatrix,t,r,i,n,o===iA.portrait),NA(this.inverseViewMatrix,this.getQuat(),a,fw),FA(this.viewMatrix,this.inverseViewMatrix),DA(this.viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.prototype.setRotationByQuat=function(e){this.options.rotation=TC.getRotation([],e)},e}();var pw,dw,mw,vw,yw,gw,xw,Tw,Ew,_w,Sw,Aw={lum:[function(t,r){var i=r.renderer,n=2===i.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,o=new iw(i,{name:"lumCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:n,magFilter:n}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:gb,uniformValues:{uFilterParams:[1,0,0,0]},materialStates:{blending:!1,depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}]},prePasses:[o],renderPassDelegate:{}}},function(){return[{fragment:gb}]}],alphaFrame:[function(t,r){var i=t,n=i.colorRange,o=void 0===n?[.5,1]:n,a=i.alphaRange,s=void 0===a?[0,.5]:a,u=[s[0],s[1]-s[0],o[0],o[1]-o[0]],c=r.renderer,l=2===c.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,f=new iw(c,{name:"alphaFrameCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{particle:{fragment:Jb,uniformValues:{uTexRange:u}},mesh:{fragment:Jb,shaderCacheId:"alpha-frame",materialStates:{blending:!1},uniformValues:{uTexRange:u}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[f]}}},function(){return[{fragment:Jb,shaderCacheId:"alpha-frame"},{fragment:Jb,isParticle:!0}]}],cameraMove:[function(t,r){var i=t.position,n=void 0===i?[0,0,0]:i,o=n;Number.isFinite(n[0])&&Number.isFinite(n[1])&&(o=[oA.CONSTANT_VEC3,n]);var a=KR(o),s=new hw("camera_move"),u=[0,0,0],c=r.renderer,l=2===c.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,f=new iw(c,{name:"cameraCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{vertex:eO,fragment:gb,shaderCacheId:"camera-move",materialStates:{blending:!1,depthTest:!1,culling:!1},variables:{uMoveCameraViewPro:function(e){s.copy(r.camera);var t=a.getValue(e);return qA(u,r.camera.position,[-t[0],-t[1],-t[2]]),s.position=u,s.getViewProjectionMatrix()}}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[f]}}},function(){return[{vertex:eO,fragment:gb,shaderCacheId:"camera-move"}]}],alphaMask:[function(t,r){var i=t,n=i.xOpacity,o=i.yOpacity,a=r.renderer.engine,s=r.renderer,u=lw(a,n),c=lw(a,o,!0),l=2===a.gpuCapability.level?xS.LINEAR:xS.NEAREST,f=new iw(s,{name:"alphaMaskCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:$b,shaderCacheId:"alpha-mask",materialStates:{blending:!1,depthTest:!1,culling:!1},uniformValues:{uAlphaXSample:u,uAlphaYSample:c}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[f]}}},function(){return[{fragment:$b,shaderCacheId:"alpha-mask"}]}],distortion:[function(t,r){var i=t,n=i.center,o=void 0===n?[.5,.5]:n,a=i.direction,s=void 0===a?[1,0]:a,u=i.period,c=i.waveMovement,l=i.strength,f=iR(s),h=[o[0],o[1],f[0],f[1]],p=KR(u),d=KR(c),m=KR(l),v=2*Math.PI,y=r.renderer,g=2===y.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,x=new iw(y,{name:"distortionCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:g,magFilter:g}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{particle:{fragment:rO,vertex:iO,uniforms:{uPeriodValue:p,uMovementValue:d,uStrengthValue:m},uniformValues:{uWaveParams:h}},mesh:{shaderCacheId:"distortion",fragment:rO,materialStates:{blending:!1,culling:!1},variables:{vWaveParams:function(e){return[p.getValue(e)*v,d.getValue(e)*v,m.getValue(e),0]}},uniformValues:{uWaveParams:h}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[x]}}},function(e){var t=e,r=t.period,i=t.waveMovement,n=t.strength;return[{fragment:rO,shaderCacheId:"distortion"},{fragment:rO,vertex:iO,isParticle:!0,uniforms:[r,i,n]}]}],bloom:[function(t,r){var i=t,n=i.radius,o=void 0===n?30:n,a=i.bloomAddon,s=void 0===a?.4:a,u=i.colorAddon,c=void 0===u?1:u,l=i.colorThreshold,f=void 0===l?[255,255,255]:l,h=r.getEngine().gpuCapability.level,p=nw({radius:o}),d=r.renderer.engine,m=r.renderer,v=Math.round(r.width/p.downSample),y=Math.round(r.width/p.downSample);1===h&&(v=AA(v),y=AA(y));var g=[0,0,v,y],x=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:xS.RGBA,magFilter:xS.LINEAR,minFilter:xS.LINEAR,name:"gaussianV",width:v,height:y}),T=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:xS.RGBA,magFilter:xS.LINEAR,minFilter:xS.LINEAR,name:"gaussianH",width:v,height:y}),E=KR(s),_=KR(c),S=new jb(d),A=new aw(m,{name:"threshold",attachments:[{texture:x}],viewport:g,clearAction:{colorAction:e.TextureLoadAction.clear}});A.pluginSystem=r.pluginSystem,A.fragShader=oO,A.preDefaultPassAttachment=S;var R=new sw(m,"H",[p.step,0],r.pluginSystem,p.shader,{name:"gaussianH",viewport:g,attachments:[{texture:T}],clearAction:{colorAction:e.TextureLoadAction.clear}},x);R.preDefaultPassAttachment=S;var C=new sw(m,"V",[0,p.step],r.pluginSystem,p.shader,{name:"gaussianV",viewport:g,attachments:[{texture:x}]},T);C.preDefaultPassAttachment=S;var b=2===h?xS.LINEAR:xS.NEAREST,O=new uw(m,{name:"bloomCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:b,magFilter:b}}],clearAction:{colorAction:e.TextureLoadAction.clear}},S);return{mesh:{name:"bloom-".concat(p.step),fragment:nO,shaderCacheId:"bloom-".concat(p.step),variables:{uBloomParams:function(e){return[E.getValue(e),_.getValue(e),0,1]}},uniformValues:{uColorThreshold:[f[0]/255||1.1,f[1]/255||1.1,f[2]/255||1.1,0],uBloomBlur:x},materialStates:{blending:!1,culling:!1}},onItemRemoved:function(){x.dispose(),T.dispose()},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[A,R,C,O]}}},function(e){var t=e.radius,r=nw({radius:void 0===t?30:t});return[{fragment:nO,shaderCacheId:"bloom-".concat(r.step)},{fragment:oO,ignoreBlend:!0},{fragment:r.shader,ignoreBlend:!0}]}],gaussian:[function(t,r){var i=t.radius,n=r.getEngine().gpuCapability.level,o=r.renderer.engine,a=r.renderer,s=nw({radius:i}),u=s.downSample,c=s.step,l=s.shader,f=Math.round(r.width/u),h=Math.round(r.height/u);1===n&&(h=AA(h),f=AA(f));var p=[0,0,f,h],d=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:xS.LINEAR,magFilter:xS.LINEAR,name:"gaussianV",width:f,height:h}),m=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:xS.LINEAR,magFilter:xS.LINEAR,name:"gaussianH",width:f,height:h}),v=new jb(o,{}),y=new rw(a,"H",[0,c],r.pluginSystem,l,{name:"gaussianH",viewport:p,attachments:[{texture:m}],clearAction:{colorAction:e.TextureLoadAction.clear}});y.preDefaultPassAttachment=v;var g=new rw(a,"V",[c,0],r.pluginSystem,l,{name:"gaussianV",viewport:p,attachments:[{texture:d}],clearAction:{colorAction:e.TextureLoadAction.clear}});g.preDefaultPassAttachment=v;var x=2===n?xS.LINEAR:xS.NEAREST,T=new iw(a,{name:"gaussianCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:x,magFilter:x}}],clearAction:{colorAction:e.TextureLoadAction.clear}},v);return T.preDefaultPassAttachment=v,{mesh:{fragment:gb,shaderCacheId:"gaussian-".concat(c),uniformValues:{uTexSize:[f,h]},materialStates:{blending:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[y,g,T]}}},function(e){var t=nw({radius:e.radius});return[{fragment:gb,shaderCacheId:"gaussian-".concat(t.step)},{fragment:t.shader,ignoreBlend:!0}]}],delay:[function(t,r){var i=r.renderer,n=ob.create(i.engine,{sourceType:e.TextureSourceType.framebuffer}),o=[0,.96,0,0],a=2===i.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,s=new cw(i,{name:"delayCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:a,magFilter:a}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:tO,shaderCacheId:"delay",uniformValues:{uLastSource:n},variables:{uParams:function(){return o}},materialStates:{blending:!0,blendFunction:[xS.SRC_ALPHA,xS.ONE_MINUS_SRC_ALPHA,xS.SRC_ALPHA,xS.ONE_MINUS_SRC_ALPHA],depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[s]},onItemRemoved:function(){n.dispose()},renderPassDelegate:{didEndRenderPass:function(e){i.extension.copyTexture(e.attachments[0].texture,n),o[0]=2}}}},function(){return[{fragment:tO,shaderCacheId:"delay"}]}]};
9
+ /*!
10
+ * Name: @galacean/effects-specification
11
+ * Description: Galacean Effects JSON Specification
12
+ * Author: Ant Group CO., Ltd.
13
+ * Version: v0.0.1
14
+ */!function(e){e.S="S",e.APlus="A+",e.A="A",e.BPlus="B+",e.B="B"}(pw||(pw={})),function(e){e[e.ALPHA=0]="ALPHA",e[e.ADD=1]="ADD",e[e.MULTIPLY=2]="MULTIPLY",e[e.BRIGHTNESS=3]="BRIGHTNESS",e[e.SUBTRACTION=4]="SUBTRACTION",e[e.STRONG_LIGHT=5]="STRONG_LIGHT",e[e.WEAK_LIGHT=6]="WEAK_LIGHT",e[e.SUPERPOSITION=7]="SUPERPOSITION"}(dw||(dw={})),function(e){e[e.DOUBLE=1032]="DOUBLE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK"}(mw||(mw={})),function(e){e[e.NONE=0]="NONE",e[e.MASK=1]="MASK",e[e.OBSCURED=2]="OBSCURED",e[e.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(vw||(vw={})),function(e){e[e.NONE=0]="NONE",e[e.SPHERE=1]="SPHERE",e[e.CONE=2]="CONE",e[e.HEMISPHERE=3]="HEMISPHERE",e[e.CIRCLE=4]="CIRCLE",e[e.DONUT=5]="DONUT",e[e.RECTANGLE=6]="RECTANGLE",e[e.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",e[e.EDGE=8]="EDGE",e[e.TEXTURE=9]="TEXTURE"}(yw||(yw={})),function(e){e[e.GYROSCOPE=0]="GYROSCOPE",e[e.SPINE=1]="SPINE"}(gw||(gw={})),function(e){e[e.CLICK=0]="CLICK",e[e.MESSAGE=1]="MESSAGE",e[e.DRAG=2]="DRAG"}(xw||(xw={})),function(e){e[e.NONE=0]="NONE",e[e.NOTIFY=1]="NOTIFY",e[e.RESUME_PLAYER=2]="RESUME_PLAYER",e[e.REMOVE=3]="REMOVE",e[e.PAUSE=4]="PAUSE"}(Tw||(Tw={})),function(e){e.base="0",e.sprite="1",e.particle="2",e.null="3",e.interact="4",e.plugin="5",e.camera="6",e.composition="7",e.filter="8",e.spine="spine",e.mesh="mesh",e.tree="tree",e.text="text",e.light="light",e.skybox="skybox"}(Ew||(Ew={})),function(e){e[e.BILLBOARD=0]="BILLBOARD",e[e.MESH=1]="MESH",e[e.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",e[e.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(_w||(_w={})),function(e){e[e.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",e[e.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",e[e.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",e[e.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",e[e.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",e[e.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",e[e.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",e[e.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",e[e.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(Sw||(Sw={}));var Rw,Cw,bw,Ow,Lw,Iw,ww,Pw,Mw,Vw,Nw,Fw,Dw,Uw,Bw,kw,zw,Gw=0;!function(e){e[e.portrait=1]="portrait",e[e.landscape=Gw]="landscape"}(Rw||(Rw={})),function(e){e[e.destroy=0]="destroy",e[e.pause=1]="pause",e[e.restart=5]="restart",e[e.forward=2]="forward",e[e.pause_destroy=3]="pause_destroy"}(Cw||(Cw={})),function(e){e[e.CONSTANT=0]="CONSTANT",e[e.CONSTANT_VEC2=1]="CONSTANT_VEC2",e[e.CONSTANT_VEC3=2]="CONSTANT_VEC3",e[e.CONSTANT_VEC4=3]="CONSTANT_VEC4",e[e.RANDOM=4]="RANDOM",e[e.LINE=5]="LINE",e[e.CURVE=6]="CURVE",e[e.BEZIER_PATH=7]="BEZIER_PATH",e[e.RGBA_COLOR=8]="RGBA_COLOR",e[e.GRADIENT_COLOR=9]="GRADIENT_COLOR",e[e.SHAPE_POINTS=10]="SHAPE_POINTS",e[e.SHAPE_SPLITS=11]="SHAPE_SPLITS",e[e.LINEAR_PATH=12]="LINEAR_PATH",e[e.COLORS=13]="COLORS",e[e.BINARY=20]="BINARY",e[e.BEZIER_CURVE=21]="BEZIER_CURVE",e[e.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH"}(bw||(bw={})),function(e){e[e.AUTO=0]="AUTO",e[e.EASE=1]="EASE",e[e.EASE_IN=2]="EASE_IN",e[e.EASE_OUT=3]="EASE_OUT",e[e.LINE=4]="LINE",e[e.HOLD=5]="HOLD",e[e.LINE_OUT=6]="LINE_OUT"}(Ow||(Ow={})),function(e){e[e.destroy=0]="destroy",e[e.loop=5]="loop",e[e.forward=4]="forward"}(Lw||(Lw={})),function(e){e[e.destroyChildren=6]="destroyChildren"}(Iw||(Iw={})),function(e){e[e.none=0]="none",e[e.removeParticle=1]="removeParticle"}(ww||(ww={})),function(e){e[e.RANDOM=0]="RANDOM",e[e.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",e[e.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",e[e.UNIFORM_BURST=3]="UNIFORM_BURST"}(Pw||(Pw={})),function(e){e[e.box=2]="box",e[e.sphere=3]="sphere"}(Mw||(Mw={})),function(e){e.unlit="unlit",e.pbr="pbr",e.hair="hair"}(Vw||(Vw={})),function(e){e[e.opaque=100]="opaque",e[e.masked=101]="masked",e[e.translucent=102]="translucent",e[e.additive=103]="additive"}(Nw||(Nw={})),function(e){e.none="none",e.uv="uv",e.normal="normal",e.basecolor="basecolor",e.alpha="alpha",e.metallic="metallic",e.roughness="roughness",e.ao="ao",e.emissive="emissive"}(Fw||(Fw={})),function(e){e[e.display=0]="display",e[e.clip=1]="clip",e[e.ellipsis=2]="ellipsis"}(Dw||(Dw={})),function(e){e[e.top=0]="top",e[e.middle=1]="middle",e[e.bottom=2]="bottom"}(Uw||(Uw={})),function(e){e[e.left=0]="left",e[e.middle=1]="middle",e[e.right=2]="right"}(Bw||(Bw={})),function(e){e.normal="normal",e.bold="bold",e.lighter="lighter"}(kw||(kw={})),function(e){e.normal="normal",e.italic="italic",e.oblique="oblique"}(zw||(zw={}));var jw=function(){return jw=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},jw.apply(this,arguments)};function Xw(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ww(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function Hw(e,t){if(!e.includes(t))return e.push(t),!0}function Yw(e,t,r){if(e)for(var i in e)Object.hasOwnProperty.call(e,i)&&t.call(r,e[i],i);return e}function Zw(e){if(Number.isFinite(e))return[bw.CONSTANT,e];if(e){if("lines"===e[0])return[bw.LINE,e[1]];if("curve"===e[0])return[bw.CURVE,e[1]];if("static"===e[0])return[bw.CONSTANT,e[1]]}}function qw(e,t){return Array.isArray(e)&&"random"===e[0]?[bw.CONSTANT,e[1][t]]:Zw(e)}function Kw(e){return e&&"color"===e[0]?eP(e[1],!0):[1,1,1,1]}function Qw(e,t){if(e){if("colors"===e[0])return[bw.COLORS,e[1].map((function(e){return eP(e,t)}))];if("gradient"===e[0])return $w(e[1],t);if("color"===e[0])return[bw.RGBA_COLOR,eP(e[1],t)]}}function Jw(e){return e&&"random"===e[0]?[bw.RANDOM,e[1]]:Zw(e)}function $w(e,t){if(e){var r=[];return Object.getOwnPropertyNames(e).forEach((function(i){var n=function(e){var t=/^(-)?([\d+.]+)%$/.exec(e);if(t)return+t[2]/100*(t[1]?-1:1);return+e}(i),o=eP(e[i],t);r.push([n,o[0],o[1],o[2],o[3]])})),r=r.sort((function(e,t){return e[0]-t[0]})),[bw.GRADIENT_COLOR,r]}}function eP(e,t){var r;if("string"==typeof e){e=e.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(e);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(e)?r=[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else e instanceof Array&&(r=[e[0],e[1],e[2],isNaN(e[3])?255:Math.round(255*e[3])]);return t&&(r=function(e){if(Array.isArray(e))return e.map((function(e){return Number.isFinite(e/255)?Number((e/255).toFixed(6)):0}))}(r)),r}function tP(e,t){return Array.isArray(e)?("gradient"===e[0]||"color"===e[0])&&$w(e[1],t):$w(e,t)}function rP(e){if(e){if(3===e.length)return[bw.CONSTANT_VEC3,e];if("path"===e[0])return[bw.LINEAR_PATH,e[1]];if("bezier"===e[0])return[bw.BEZIER_PATH,e[1]]}}function iP(e){var t,r;try{for(var i=Xw(Object.entries(e)),n=i.next();!n.done;n=i.next()){var o=Ww(n.value,2),a=o[0],s=o[1];e[a]=Number(s)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return e}function nP(e){var t,r;try{for(var i=Xw(Object.keys(e)),n=i.next();!n.done;n=i.next()){var o=n.value;void 0===e[o]&&delete e[o]}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return e}var oP=Math.cos,aP=Math.sin,sP=Math.PI/180,uP=180/Math.PI;function cP(e){var t,r=e.options,i=e.transform,n={type:yw.NONE};if(e.shape){var o=null===(t=e.shape.shape)||void 0===t?void 0:t.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(n=jw(jw({},e.shape),{type:yw[o]}),e.shape.upDirection){var a=Ww(e.shape.upDirection,3),s=a[0],u=a[1],c=a[2];0===s&&0===u&&0===c&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=Jw(r.turbulenceX),n.turbulenceY=Jw(r.turbulenceY),n.turbulenceZ=Jw(r.turbulenceZ));var l=e.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(e){return iP(e)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(e){return iP(e)}))),l.rateOverTime&&(l.rateOverTime=Jw(l.rateOverTime));var f={renderer:e.renderer,shape:n,splits:e.splits,emission:l,options:{startLifetime:Jw(r.startLifetime),start3DSize:!!r.start3DSize,startSize:Jw(r.startSize),startSizeX:Jw(r.startSizeX),startSizeY:Jw(r.startSizeY),sizeAspect:Jw(r.sizeAspect),maxCount:r.maxCount,startDelay:Jw(r.startDelay),startColor:Qw(r.startColor,!0),startRotationZ:Jw(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(f.options.startRotationX=Jw(r.startRotationX),f.options.startRotationY=Jw(r.startRotationY)),e.filter){var h={};Yw(e.filter,(function(e,t){var r;h[t]=(r=e,Array.isArray(r)&&"string"==typeof r[0]&&(Jw(r)||rP(r)||Qw(r))||r)})),f.filter=h}i&&i.path&&(f.emitterTransform={path:rP(i.path)});var p=e.sizeOverLifetime;p&&(p.separateAxes?f.sizeOverLifetime={separateAxes:!0,x:Jw(p.x),y:Jw(p.y)}:f.sizeOverLifetime={size:Jw(p.size)});var d=e.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?Zw(m):void 0,f.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:Zw(r.gravityModifier),startSpeed:Jw(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:Jw(d.linearX),linearY:Jw(d.linearY),linearZ:Jw(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Jw(d.orbitalX),orbitalY:Jw(d.orbitalY),orbitalZ:Jw(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Zw(d.forceCurve)},nP(f.positionOverLifetime);var v=e.rotationOverLifetime;v&&(f.rotationOverLifetime={separateAxes:v.separateAxes,asRotation:v.asRotation,z:Jw(v.separateAxes?v.z:v.angularVelocity)},v.separateAxes&&(f.rotationOverLifetime.y=Zw(v.y),f.rotationOverLifetime.x=Zw(v.x)));var y=e.colorOverLifetime;if(y){var g=f.colorOverLifetime={opacity:Zw(y.opacity)};y.color&&(g.color=tP(y.color))}var x=e.textureSheetAnimation;x&&(f.textureSheetAnimation={row:x.row,col:x.col,total:x.total,animate:x.animate,cycles:Zw(x.cycles),animationDelay:qw(x.animationDelay,0),animationDuration:qw(x.animationDuration,0)});var T=e.trails;T&&(f.trails={lifetime:Jw(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:Zw(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&tP(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&tP(T.colorOverLifetime,!1),inheritParticleColor:T.inheritParticleColor,occlusion:T.occlusion,transparentOcclusion:T.transparentOcclusion,orderOffset:T.orderOffset,sizeAffectsLifetime:T.sizeAffectsLifetime,sizeAffectsWidth:T.sizeAffectsWidth,texture:T.texture,parentAffectsPosition:T.parentAffectsPosition,opacityOverLifetime:Jw(T.opacityOverLifetime)}),f.trails&&nP(f.trails);var E=e.interaction;return E&&(f.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),f}function lP(e,t){var r,i=e.options,n=e.velocityOverLifetime||{},o={path:rP(null===(r=e.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:Zw(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:Zw(n.linearX),linearY:Zw(n.linearY),linearZ:Zw(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Zw(n.orbitalX),orbitalY:Zw(n.orbitalY),orbitalZ:Zw(n.orbitalZ),speedOverLifetime:Zw(n.speedOverLifetime)};nP(o);var a={options:{startColor:Kw(i.startColor)},positionOverLifetime:o};i.startSize&&(t.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(t.rotation?t.rotation[2]+=i.startRotation:t.rotation=[0,0,i.startRotation]);var s=e.rotationOverLifetime;if(s){var u=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=Zw(s.x),u.y=Zw(s.y),u.z=Zw(s.z)):u.z=Zw(s.angularVelocity)}var c=e.colorOverLifetime;if(c){var l=a.colorOverLifetime={opacity:Zw(c.opacity)};c.color&&(l.color=tP(c.color))}var f=e.sizeOverLifetime;return f&&(a.sizeOverLifetime={separateAxes:f.separateAxes,size:Zw(f.size),x:Zw(f.x),y:Zw(f.y),z:Zw(f.z)}),a}function fP(e,t){var r=lP(e,t),i=e.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=e.renderer,e.splits&&(r.splits=e.splits),e.interaction&&(r.interaction=e.interaction),r}var hP=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],pP=["path","position"];function dP(e){return e.compositions.forEach((function(e){e.items.forEach((function(e){e.type===Ew.null&&e.endBehavior===Lw.destroy&&(e.endBehavior=Lw.forward)}))})),e.version="2.1",e}var mP=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,vP=/^(\d+)\.(\d+)$/,yP=!1;function gP(e){var t,r;if(!e||"object"!=typeof e)throw Error("expect a json object");if(mP.test(e.version))return yP="0"===(null===(t=/^(\d+)/.exec(e.version))||void 0===t?void 0:t[0]),dP(function(e){var t,r;xP="1.0";var i=e.plugins||[];(null===(t=e.bins)||void 0===t?void 0:t.length)&&(xP="1.3");var n=(e.requires||[]).slice(),o=e.images.map((function(t,r){return TP(t,r,e.imageTags||[])})),a=e.textures||o.map((function(e,t){return{source:t,flipY:!0}})),s={plugins:i,shapes:e.shapes||[],type:"ge",version:xP,playerVersion:null!==(r=e.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map((function(e){return EP(e,{plugins:i,requires:n})})),images:o,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:a,bins:(e.bins||[]).slice()};e._textures&&(s._textures=e._textures);return s}(e));var i=null===(r=vP.exec(e.version))||void 0===r?void 0:r[1];if(i)return Number(i)<2?dP(e):e;throw Error("invalid json version "+e.version)}var xP="1.0";function TP(e,t,r){var i=r[t],n=e.oriY;if("string"==typeof e)return{renderLevel:i,url:e,oriY:n};if(e.template)return{url:e.url,template:e.template,webp:e.webp,renderLevel:i,oriY:n};if(e.compressed)return{url:e.url,oriY:n,compressed:{astc:e.compressed.android,pvrtc:e.compressed.iOS},webp:e.webp,renderLevel:i};if(e.url)return{url:e.url,type:e.type,webp:e.webp,renderLevel:i,oriY:n,loop:e.loop};if(e&&e.sourceType)return e;throw Error("invalid image type")}function EP(e,t){var r;void 0===t&&(t={});var i={id:e.id+"",camera:Object.assign({clipMode:Gw},e.camera),duration:e.duration,endBehavior:e.endBehavior,items:e.items.map((function(e){return RP(e,t)})),name:e.name},n=e.startTime||e.st;n&&(i.startTime=n);var o=null===(r=e.meta)||void 0===r?void 0:r.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(i.previewSize=o),i}var _P,SP=[0,0,0,1],AP=.5;function RP(e,t){var r,i,n;void 0===t&&(t={});var o,a,s,u,c,l,f=Ew.base,h=e.endBehavior,p=NaN;if(e.content?(f=e.type||Ew.plugin,l=e.pn,c=e.pluginName,s=e.content,a=e.content,isNaN(l)&&!c&&(c=s.options.type),e.duration&&(p=e.duration),o=e.transform||y(a.transform),f===Ew.filter&&(xP<"1.1"&&(xP="1.1"),(s=fP(a,o)).filter=function(e){var t={};return Yw(e,(function(e,r){hP.includes(r)?t[r]=Zw(e):pP.includes(r)?t[r]=rP(e):t[r]=e})),t}(a.filter))):e.particle?(f=Ew.particle,o=y((a=e.particle).transform,yP,!0),s=cP(a)):e.sprite?(f=Ew.sprite,s=fP(a=e.sprite,o=y(a.transform,!1,!0))):e.cal?(f=Ew.null,s=lP(a=e.cal,o=y(a.transform,!1,!0))):e.ui?(f=Ew.interact,o=y((a=e.ui).transform),s=function(e){var t,r=e.options;switch(r.type){case"click":t={type:xw.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&Kw(r.previewColor),behavior:r.behavior||Tw.NOTIFY};break;case"drag":t={type:xw.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":t={type:xw.MESSAGE}}return{options:t}}(a),o.scale=[a.options.width||1,a.options.height||1,1]):e.model&&(a=e.model,1===e.model.options.type&&(f=Ew.camera,o=y(a.transform),s=function(e){var t,r,i=e.options,n={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},o=e.velocityOverLifetime;if(o||(null===(t=e.transform)||void 0===t?void 0:t.path)){var a={path:rP(null===(r=e.transform)||void 0===r?void 0:r.path),linearX:Zw(null==o?void 0:o.translateX),linearY:Zw(null==o?void 0:o.translateY),linearZ:Zw(null==o?void 0:o.translateZ)};nP(a),n.positionOverLifetime=a}var s=e.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:Zw(null==s?void 0:s.rotateX),y:Zw(null==s?void 0:s.rotateY),z:s.separateAxes?Zw(null==s?void 0:s.rotateZ):Zw(s.rotation)};nP(u),n.rotationOverLifetime=u}return n}(a))),null===(r=s.renderer)||void 0===r?void 0:r.anchor){var d=new Float32Array(s.renderer.anchor);d[0]==AP&&d[1]==AP?delete s.renderer.anchor:t.requires&&Hw(t.requires,"anchor")}if(a){var m=null===(i=a.options)||void 0===i?void 0:i.looping;h=m?Array.isArray(m)?m[1]?Lw.loop:Lw.destroy:Lw.loop:h||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||Lw.destroy,a.options.renderLevel&&(u=a.options.renderLevel),isNaN(p)&&(p=a.options.duration)}var v={type:f,name:e.name,delay:e.delay,duration:p,id:e.id+"",transform:o,endBehavior:h,renderLevel:u,content:s};return c?t.plugins?(Hw(t.plugins,c),v.pn=t.plugins.indexOf(c)):v.pluginName=c:Number.isInteger(l)&&(v.pn=l),e.parentId&&(v.parentId=e.parentId+""),v;function y(e,t,r){if(e){var i={},n=e.rotation;if(n&&(i.rotation=t?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var o=(a=SP,s=i.rotation[0],u=i.rotation[1],c=i.rotation[2],l=oP(s*sP/2),f=oP(u*sP/2),h=oP(c*sP/2),p=aP(s*sP/2),d=aP(u*sP/2),m=aP(c*sP/2),a[0]=p*f*h+l*d*m,a[1]=l*d*h-p*f*m,a[2]=l*f*m+p*d*h,a[3]=l*f*h-p*d*m,a);i.rotation=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],a=r+r,s=i+i,u=n+n,c=r*a,l=i*a,f=i*s,h=n*u,p=o*u,d=1-f-h,m=l-p,v=l+p,y=1-c-h,g=n*a-o*s,x=n*s+o*a,T=1-c-f;return e[1]=Math.asin(function(e,t,r){return e>r?r:e<t?t:e}(-g,-1,1))*uP,Math.abs(g)<.9999999?(e[0]=Math.atan2(x,T)*uP,e[2]=Math.atan2(v,d)*uP):(e[0]=0,e[2]=Math.atan2(-m,y)*uP),e}([],o)}return e.position&&(i.position=e.position),Array.isArray(e.scale)&&(i.scale=[e.scale[0]||1,e.scale[1]||1,e.scale[2]||1]),i}var a,s,u,c,l,f,h,p,d,m;return{}}}var CP=((_P={})[SS.S]=[SS.S,SS.BPlus,SS.APlus],_P[SS.A]=[SS.A,SS.BPlus,SS.APlus],_P[SS.B]=[SS.B,SS.BPlus],_P);function bP(e,t){if(!e||!t)return!0;var r=CP[t];return!!r&&r.includes(e)}var OP=0,LP=function(){function e(e,t){var r=e.jsonScene,i=e.renderLevel,n=e.textureOptions,o=e.pluginSystem,a=e.totalTime,s=r.compositions,u=r.imgUsage,c=r.compositionId;if(!n)throw new Error("scene.textures expected");var l=n.map((function(e){return e&&(e instanceof ob?e:ob.create(t,e))}));e.textureOptions=l;var f=s.find((function(e){return e.id===c}));if(null==l||l.forEach((function(e){return null==e?void 0:e.initialize()})),!f)throw new Error("Invalid composition id: "+c);OP=0,this.composition=f,this.jsonScene=r,this.renderLevel=i,this.pluginSystem=o,this.totalTime=null!=a?a:0,this.imgUsage=null!=u?u:{},this.textures=l,this.mask=0,this.textureOptions=n,this.sourceContent=this.getContent()}return e.prototype.getContent=function(){var e=this.composition,t=e.id,r=e.duration,i=e.name,n=e.endBehavior,o=e.camera,a=e.globalVolume,s=e.startTime,u=void 0===s?0:s,c=this.assembleItems();return{id:t,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:c,camera:o,startTime:u,globalVolume:a}},e.prototype.assembleItems=function(){var e,t=this,r=[],i=this.mask;return isNaN(i)&&(i=0),null===(e=this.composition)||void 0===e||e.items.forEach((function(e){var n,o={},a=e.visible,s=e.renderLevel,u=e.type;if(!1!==a){var c=rS({},e.content);if(c&&(o.content=rS({},c),bP(s,t.renderLevel))){var l=o.content;if(o.type=u,l.renderer){if(l.renderer=t.changeTex(l.renderer),!l.renderer.mask){var f=l.renderer.maskMode;f===CS.MASK?l.renderer.mask=++i:f!==CS.OBSCURED&&f!==CS.REVERSE_OBSCURED||(l.renderer.mask=i)}var h=l.splits&&!l.textureSheetAnimation&&l.splits[0];Number.isInteger(l.renderer.shape)?l.renderer.shape=nI(null===(n=t.jsonScene)||void 0===n?void 0:n.shapes[l.renderer.shape],h):l.renderer.shape&&pC(l.renderer.shape)&&(l.renderer.shape=nI(l.renderer.shape,h))}else o.content.renderer={order:0};l.trails&&(l.trails=t.changeTex(l.trails)),l.filter&&(l.filter=rS({},l.filter));var p=e.name,d=e.delay,m=void 0===d?0:d,v=e.id,y=e.parentId,g=e.duration,x=e.endBehavior,T=e.pluginName,E=e.pn,_=e.transform,S=e.refCount,A=t.jsonScene.plugins,R=void 0===A?[]:A;o.name=p,o.delay=m,o.id=v,y&&(o.parentId=y),o.refCount=S,o.duration=g,o.listIndex=OP++,o.endBehavior=x,T?o.pluginName=T:void 0!==E&&Number.isInteger(E)&&(o.pluginName=R[E]),_&&(o.transform=_),r.push(o)}}})),r},e.prototype.changeTex=function(e){var t=e.texture,r=rS({},e);return void 0!==t&&(r.texture=this.addTextureUsage(t)||t),r},e.prototype.addTextureUsage=function(e){var t,r;if(Number.isInteger(e)){var i=null===(t=this.textures)||void 0===t?void 0:t[e],n=null==i?void 0:i.id,o=null!==(r=this.imgUsage)&&void 0!==r?r:{};if(n&&o)return o.hasOwnProperty(n)||(o[n]=0),o[n]++,i}},e.prototype.dispose=function(){this.textureOptions=[],this.textures=[],this.composition=void 0,this.jsonScene=void 0,this.totalTime=0,this.pluginSystem=void 0,this.sourceContent=void 0},e}();var IP=1,wP=function(){function t(e,t){void 0===e&&(e={}),void 0===t&&(t=new KC),this.options=e,this.downloader=t,this.assets={},this.id=IP++,this.updateOptions(e)}return t.prototype.updateOptions=function(e){void 0===e&&(e={}),this.options=e,e.pluginData||(e.pluginData={});var t=e.timeout,r=void 0===t?10:t;this.timeout=r},t.prototype.loadScene=function(e,t,r){var i,n;return iS(this,void 0,void 0,(function(){var o,a,s,u,c,l,f,h,p,d,m,v=this;return nS(this,(function(y){return a="Load asset: ".concat(lC(e)?e:this.id),s=performance.now(),u=[],c=null==t?void 0:t.engine.gpuCapability,l=null!==(n=null===(i=null==c?void 0:c.detail)||void 0===i?void 0:i.asyncShaderCompile)&&void 0!==n&&n,h=!1,p=new Promise((function(t,r){return f=window.setTimeout((function(){h=!0,r("Load time out: ".concat(e))}),1e3*v.timeout)})),d=function(e,t){return iS(v,void 0,void 0,(function(){var r,i;return nS(this,(function(n){switch(n.label){case 0:return h?[3,2]:(r=performance.now(),[4,t()]);case 1:return i=n.sent(),u.push("[".concat(e,": ").concat((performance.now()-r).toFixed(2),"]")),[2,i];case 2:throw new Error("load canceled.")}}))}))},m=function(){return iS(v,void 0,void 0,(function(){var i,n,h,p,m,v,y,g,x,T,E,_,S,A,R=this;return nS(this,(function(C){switch(C.label){case 0:return pC(e)?(o=e,this.baseUrl=location.href,[3,3]):[3,1];case 1:return e=new URL(e,location.href).href,this.baseUrl=e,[4,d("loadJSON",(function(){return R.loadJSON(e)}))];case 2:o=C.sent(),C.label=3;case 3:return[4,d("processJSON",(function(){return R.processJSON(o)}))];case 4:return i=C.sent(),n=i.usedImages,h=i.jsonScene,p=h.bins,m=void 0===p?[]:p,v=h.images,y=h.compositions,g=h.fonts,[4,Promise.all([d("processBins",(function(){return R.processBins(m)})),d("processImages",(function(){var e;return R.processImages(v,n,null!==(e=null==c?void 0:c.detail.compressedTexture)&&void 0!==e?e:0)})),d("".concat(l?"async":"sync"," compile"),(function(){return R.precompile(y,t,r)}))])];case 5:return x=aS.apply(void 0,[C.sent(),2]),T=x[0],E=x[1],[4,d("processFontURL",(function(){return R.processFontURL(g)}))];case 6:return C.sent(),[4,d("processTextures",(function(){return R.processTextures(E,T,h)}))];case 7:return _=C.sent(),S={jsonScene:h,images:E,textureOptions:_,bins:T,storage:{},pluginSystem:this.pluginSystem,renderLevel:this.options.renderLevel,totalTime:0,startTime:0,url:e},[4,d("processPlugins",(function(){return R.pluginSystem.loadResources(S,R.options)}))];case 8:return C.sent(),A=performance.now()-s,console.debug("".concat(a,": ").concat(A.toFixed(4),"ms, ").concat(u.join(" "))),window.clearTimeout(f),S.totalTime=A,S.startTime=s,[2,S]}}))}))},[2,Promise.race([p,m()])]}))}))},t.prototype.precompile=function(e,t,r){return iS(this,void 0,void 0,(function(){var i;return nS(this,(function(n){switch(n.label){case 0:return t&&t.getShaderLibrary()?(i=null==t?void 0:t.getShaderLibrary(),[4,this.pluginSystem.precompile(e,t,r)]):[2];case 1:return n.sent(),[4,new Promise((function(e){i.compileAllShaders((function(){e(null)}))}))];case 2:return n.sent(),[2]}}))}))},t.prototype.processJSON=function(e){return iS(this,void 0,void 0,(function(){var t,r,i,n,o,a,s,u;return nS(this,(function(c){switch(c.label){case 0:return t=gP(e),e.compositions.forEach((function(e,r){e.globalVolume&&(t.compositions[r].globalVolume=e.globalVolume)})),r=t.plugins,i=void 0===r?[]:r,n=t.compositions,o=t.imgUsage,a=t.images,this.pluginSystem=new OC(i),[4,this.pluginSystem.processRawJSON(t,this.options)];case 1:return c.sent(),s=this.options.renderLevel,u={},o?function(e,t,r,i,n){for(var o=0;o<t.length;o++){var a=r[t[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];bP(i[u].renderLevel,n)&&(e[u]=!0)}}}(u,n,o,a,s):null==a||a.forEach((function(e,t){u[t]=!0})),[2,{usedImages:u,jsonScene:t}]}}))}))},t.prototype.processBins=function(e){return iS(this,void 0,void 0,(function(){var t,r,i=this;return nS(this,(function(n){return t=this.options.renderLevel,r=e.map((function(r){if(r instanceof ArrayBuffer)return r;if(bP(r.renderLevel,t))return i.loadBins(r.url);throw new Error("Invalid bins source: ".concat(e))})),[2,Promise.all(r)]}))}))},t.prototype.processFontURL=function(e){return iS(this,void 0,void 0,(function(){var r,i=this;return nS(this,(function(n){return e?(r=e.map((function(e){return iS(i,void 0,void 0,(function(){var r,i;return nS(this,(function(n){switch(n.label){case 0:if(!e.fontURL||t.fonts.has(e.fontFamily))return[3,4];r=new FontFace(null!==(i=e.fontFamily)&&void 0!==i?i:"","url("+e.fontURL+")"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r.load()];case 2:return n.sent(),document.fonts.add(r),t.fonts.add(e.fontFamily),[3,4];case 3:return n.sent(),console.warn("Invalid fonts source: ".concat(e.fontURL)),[3,4];case 4:return[2]}}))}))})),[2,Promise.all(r)]):[2]}))}))},t.prototype.processImages=function(t,r,i){return iS(this,void 0,void 0,(function(){var n,o,a,s,u,c=this;return nS(this,(function(l){return n=this.options,o=n.useCompressedTexture,a=n.variables,s=this.baseUrl,u=t.map((function(t,n){return iS(c,void 0,void 0,(function(){var u,c,l,f,h,p,d,m,v,y,g,x,T,E,_,S,A,R,C;return nS(this,(function(b){switch(b.label){case 0:if(!r[n])return[3,19];if(u=t.url,c=t.webp,l=new URL(u,s).href,f=c&&new URL(c,s).href,!("template"in t))return[3,16];if(h=t.template,p=void 0,!("v"in h)||2!==h.v||!h.background)return[3,9];if(!((d=HI(h,a))instanceof Array))return[3,6];m=h.background.name,b.label=1;case 1:return b.trys.push([1,3,,5]),A={},[4,$C(d[0])];case 2:return A.image=b.sent(),A.url=d[0],p=A,[3,5];case 3:return b.sent(),R={},[4,$C(d[1])];case 4:return R.image=b.sent(),R.url=d[1],p=R,[3,5];case 5:return a&&(a[m]=p.url),[3,8];case 6:return"string"!=typeof d?[3,8]:(C={},[4,$C(d)]);case 7:C.image=b.sent(),C.url=d,p=C,b.label=8;case 8:return[3,11];case 9:return[4,JC(l,f)];case 10:p=b.sent(),b.label=11;case 11:v=void 0,b.label=12;case 12:return b.trys.push([12,14,,15]),[4,KI(p.image,h,a,this.options,-1===t.oriY)];case 13:return v=b.sent(),[3,15];case 14:throw b.sent(),new Error("image template fail: ".concat(l));case 15:return[2,v];case 16:if("type"in t&&"video"===t.type)return y=t.loop,[2,tb(t.url,{loop:y})];if("compressed"in t&&o&&i){if(g=t.compressed,x=void 0,i===LO.ASTC?x=g.astc:i===LO.PVRTC&&(x=g.pvrtc),x)return T=new URL(x,s).href,this.assets[n]={url:T,type:e.TextureSourceType.compressed},[2,this.loadBins(T)]}else{if("sourceType"in t)return[2,t];if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ob)return[2,t]}b.label=17;case 17:return[4,JC(l,f)];case 18:return E=b.sent(),_=E.url,S=E.image,this.assets[n]={url:_,type:e.TextureSourceType.image},[2,S];case 19:return[2,void 0]}}))}))})),[2,Promise.all(u)]}))}))},t.prototype.processTextures=function(t,r,i){var n;return iS(this,void 0,void 0,(function(){var o,a,s=this;return nS(this,(function(u){return o=null!==(n=i.textures)&&void 0!==n?n:t.map((function(e,t){return{source:t}})),a=o.map((function(n,o){if(n instanceof ob)return n;if("mipmaps"in n)try{return rb(n,r,i.bins)}catch(e){throw new Error("load texture ".concat(o," fails, error message: ").concat(e))}var a=n.source,u=t[a];if(u){var c=function(t,r){if(t instanceof ob)return t.source;if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)return{image:t,sourceType:e.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:xS.LINEAR,magFilter:xS.LINEAR};if(t instanceof HTMLVideoElement)return{sourceType:e.TextureSourceType.video,video:t,minFilter:xS.LINEAR,magFilter:xS.LINEAR};if(t instanceof ArrayBuffer)return rS(rS({},ub(t)),{sourceFrom:r});if("width"in t&&"height"in t&&"data"in t)return{sourceType:e.TextureSourceType.data,data:t,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE,minFilter:xS.NEAREST,magFilter:xS.NEAREST};throw new Error("Invalid texture options")}(u,s.assets[o]);return c.sourceType===e.TextureSourceType.compressed?c:rS(rS({},c),n)}throw new Error("Invalid texture source: ".concat(a))})),[2,Promise.all(a)]}))}))},t.prototype.loadJSON=function(e){return iS(this,void 0,void 0,(function(){var t=this;return nS(this,(function(r){return[2,new Promise((function(r,i){t.downloader.downloadJSON(e,r,(function(t,r){i("Couldn't load JSON ".concat(e,": status ").concat(t,", ").concat(r))}))}))]}))}))},t.prototype.loadBins=function(e){return iS(this,void 0,void 0,(function(){var t=this;return nS(this,(function(r){return[2,new Promise((function(r,i){t.downloader.downloadBinary(e,r,(function(t,r){i("Couldn't load bins ".concat(e,": status ").concat(t,", ").concat(r))}))}))]}))}))},t.prototype.dispose=function(){var e;for(var t in this.assets){var r=this.assets[t];null===(e=null==r?void 0:r.dispose)||void 0===e||e.call(r)}this.assets={}},t.fonts=new Set,t}();var PP=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.items=[],t.itemTree=[],t.itemCacheMap=new Map,t.itemsToRemove=[],t.tempQueue=[],t}return tS(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return wS.composition},enumerable:!1,configurable:!0}),t.prototype.onConstructed=function(e){var t=e.items,r=void 0===t?[]:t,i=e.startTime,n=void 0===i?0:i;this.itemProps=r;var o=this.endBehavior;5!==o&&1!==o&&3!==o||(this.freezeOnEnd=!0),this.startTime=n,this.startTimeInms=Math.round(1e3*this.startTime)},t.prototype.createContent=function(){if(!this.items.length&&this.composition)for(var e=0;e<this.itemProps.length;e++){var t=_C(this.itemProps[e],this.composition);"extra-camera"===t.id&&"extra-camera"===t.name&&(this.extraCamera=t),this.items.push(t),this.tempQueue.push(t)}},t.prototype.onLifetimeBegin=function(){var e;null===(e=this.items)||void 0===e||e.forEach((function(e){e.start(),e.createContent()})),this.buildItemTree()},t.prototype.doStop=function(){this.items&&this.items.forEach((function(e){return e.stop()}))},t.prototype.onItemUpdate=function(e,t){var r,i=this;if(this.items){null===(r=this.composition)||void 0===r||r.updatePluginLoaders(e);var n=[];this.itemsToRemove.length&&(this.itemsToRemove.forEach((function(e){var t,r,n=i.itemCacheMap.get(e.id);if(n){var o=n.children;if(n.parentId){var a=i.itemCacheMap.get(n.parentId);a?(a.children.splice(a.children.indexOf(n),1),o.forEach((function(e){return i.setItemParent(e.item,a.item)}))):(o.forEach((function(e){return i.setItemParent(e.item,void 0)})),(t=i.itemTree).push.apply(t,sS([],aS(o),!1)))}else(r=i.itemTree).splice.apply(r,sS([i.itemTree.indexOf(n),1],aS(o),!1)),o.forEach((function(e){return i.setItemParent(e.item,void 0)}));i.itemCacheMap.delete(e.id),i.items.splice(i.items.indexOf(e),1)}})),this.itemsToRemove.length=0);for(var o=0;o<this.itemTree.length;o++){(a=this.itemTree[o])&&a.item&&(a.item.onUpdate(e),n.push.apply(n,sS([],aS(a.children),!1)))}for(;n.length;){var a;if((a=n.shift())&&a.item){var s=a.item;s.onUpdate(e),n.push.apply(n,sS([],aS(a.children),!1)),s.composition||kS(this.itemsToRemove,s)}}this.extraCamera&&this.extraCamera.onUpdate(e)}},t.prototype.onItemRemoved=function(e){this.items&&(this.items.forEach((function(e){return e.dispose()})),this.items.length=0,this.itemTree.length=0,this.itemCacheMap.clear())},t.prototype.reset=function(){e.prototype.reset.call(this),this.itemTree=[],this.itemCacheMap.clear(),this.tempQueue.length=0,this.itemsToRemove.length=0},t.prototype.getUpdateTime=function(e){var t=this.startTimeInms,r=this.timeInms;if(e<0&&r+e<t)return t-r;if(this.freezeOnEnd){var i=this.durInms-r;if(i<e)return i}return e},t.prototype.removeItem=function(e){var t,r=this;if(this.items.indexOf(e)>-1){if(kS(this.itemsToRemove,e),e.type===cS||e.type===wS.null){var i=6===e.endBehavior,n=e.type===wS.null&&!!this.itemCacheMap.get(e.id);((null===(t=this.itemCacheMap.get(e.id))||void 0===t?void 0:t.children)||[]).forEach((function(e){n||r.setItemParent(e.item,void 0),i&&r.removeItem(e.item)}))}return!0}return!1},t.prototype.setItemParent=function(e,t){var r=this.itemCacheMap.get(e.id);if(r)if(t){var i=this.itemCacheMap.get(t.id);if(r.parentId){var n=this.itemCacheMap.get(r.parentId);n.children.splice(n.children.indexOf(r),1)}e.parent=t,r.parentId=t.id,i.children.push(r),e.transform.parentTransform=t.transform}else r.parentId=void 0,e.parent=void 0,e.transform.parentTransform=this.transform;else console.error("item has been remove, please set item's parent in valid lifetime")},t.prototype.getItemCurrentParent=function(e){var t=e.id,r=this.itemCacheMap.get(t);if(r){var i=r.parentId;if(i){var n=this.itemCacheMap.get(i);return i&&n?n.item:void 0}}},t.prototype.isEnded=function(e){return e>=this.durInms},t.prototype.buildItemTree=function(){if(!this.itemTree.length&&this.composition){this.itemTree=[];for(var e=this.itemCacheMap,t=this.tempQueue,r=function(){var r=t.shift();if(void 0===r.parentId){var n={id:r.id,item:r,children:[]};i.itemTree.push(n),e.set(r.id,n)}else{var o=i.getParentIdWithoutSuffix(r.parentId),a=e.get(o);if(a){n={id:r.id,parentId:o,item:r,children:[]};r.parent=a.item,r.transform.parentTransform=a.item.getNodeTransform(r.parentId),a.children.push(n),e.set(r.id,n)}else{if(-1===i.items.findIndex((function(e){return e.id===o})))throw Error("元素引用了不存在的元素,请检查数据");t.push(r)}}},i=this;t.length;)r()}},t.prototype.getParentIdWithoutSuffix=function(e){var t=e.lastIndexOf("^");return t>-1?e.substring(0,t):e},t}(EC),MP=1,VP=function(){function t(e,t){var r;this.speed=1,this.loaderData={},this.assigned=!1,this.destroyed=!1,this.paused=!1,this.lastVideoUpdateTime=0,this.postLoaders=[];var i=e.keepResource,n=e.reusable,o=void 0!==n&&n,a=e.baseRenderOrder,s=void 0===a?0:a,u=e.renderer,c=e.handlePlayerPause,l=e.handleMessageItem,f=e.handleEnd,h=e.event,p=e.width,d=e.height;this.compositionSourceManager=new LP(t,u.engine),t.jsonScene.imgUsage=void 0,i||(t.textures=void 0,t.consumed=!0);var m=this.compositionSourceManager,v=m.sourceContent,y=m.pluginSystem,g=m.imgUsage,x=m.totalTime,T=m.renderLevel;rA(v);var E=new PP(v,this),_=!o&&g;this.globalVolume=v.globalVolume,this.width=p,this.height=d,this.renderOrder=s,this.id=MP++,this.renderer=u,this.texInfo=null!=_?_:{},this.event=h,this.statistic={loadTime:null!=x?x:0,loadStart:null!==(r=t.startTime)&&void 0!==r?r:0,firstFrameTime:0},this.reusable=o,this.renderLevel=T,this.handlePlayerPause=c,this.handleMessageItem=l,this.handleEnd=f,this.rootTransform=new TC,E.transform=this.rootTransform,this.autoRefTex=!i&&_&&5!==E.endBehavior,this.content=E,this.name=E.name,this.rootTransform.name=this.name,this.pluginSystem=y,this.pluginSystem.initializeComposition(this,t),this.camera=new hw(this.name,rS(rS({},null==v?void 0:v.camera),{aspect:p/d})),this.url=t.url,this.assigned=!0,this.createRenderFrame(),this.reset()}return Object.defineProperty(t.prototype,"textures",{get:function(){return this.compositionSourceManager.textures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return this.content.items},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startTime",{get:function(){var e;return null!==(e=this.content.startTime)&&void 0!==e?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return this.content.timeInms/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.restart=function(){this.content.reset(),this.prepareRender(),this.reset(),this.rootTransform.setValid(!0),this.content.start(),this.forwardTime(this.startTime),this.content.onUpdate(0),this.loaderData.spriteGroup.onUpdate(0)},t.prototype.setIndex=function(e){this.renderOrder=e},t.prototype.getIndex=function(){return this.renderOrder},t.prototype.play=function(){this.paused&&this.resume(),this.content.start()},t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.gotoAndPlay=function(e){},t.prototype.gotoAndPause=function(e){},t.prototype.start=function(){this.content.start()},t.prototype.createRenderFrame=function(){this.renderFrame=new xO({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},t.prototype.setTime=function(e){},t.prototype.forwardTime=function(e){var t=Math.round(1e3*e);if(t){for(var r=t<0,i=Math.abs(t),n=r?-15:15;i>15;i-=15)this.update(n);if(i>0){n=r?-i:i;this.update(n)}}},t.prototype.reset=function(){var e=this;this.rendererOptions=null,this.pluginSystem.plugins.forEach((function(t){return t.onCompositionWillReset(e,e.renderFrame)})),this.content.createContent(),this.content.onEnd=function(){window.setTimeout((function(){var t;null===(t=e.handleEnd)||void 0===t||t.call(e,e)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)},t.prototype.prepareRender=function(){var e=this,t=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(r){r.prepareRenderFrame(e,t)&&e.postLoaders.push(r)})),this.postLoaders.forEach((function(r){return r.postProcessFrame(e,t)}))},t.prototype.shouldRestart=function(){var e=this.content,t=e.ended,r=e.endBehavior;return t&&5===r},t.prototype.shouldDispose=function(){var e=this.content,t=e.ended,r=e.endBehavior;return t&&(!r||3===r)},t.prototype.update=function(e){if(this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var t=this.content.getUpdateTime(e*this.speed);this.updateVideo(),this.content.onUpdate(t),this.loaderData.spriteGroup.onUpdate(t),this.updateCamera(),this.shouldDispose()?this.dispose():this.prepareRender()}},t.prototype.updateVideo=function(){var e,t=performance.now();t-this.lastVideoUpdateTime>33&&((null!==(e=this.textures)&&void 0!==e?e:[]).forEach((function(e){return null==e?void 0:e.uploadCurrentVideoFrame()})),this.lastVideoUpdateTime=t)},t.prototype.updateCamera=function(){this.camera.updateMatrix()},t.prototype.updatePluginLoaders=function(e){var t=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(t,e)}))},t.prototype.getItemByName=function(e,t){var r=this.content&&this.content.items;if(r)return r.find((function(r){return r.name===e&&(!t||t===r.type)}))},t.prototype.getItemByID=function(e){return this.content&&this.content.items&&this.content.itemCacheMap.has(e)?this.content.itemCacheMap.get(e).item:null},t.prototype.getItemCurrentParent=function(e){return this.content.getItemCurrentParent(e)},t.prototype.itemLifetimeEvent=function(e,t){var r=this,i=t?function(t){return t.onCompositionItemLifeBegin(r,e)}:function(t){return t.onCompositionItemLifeEnd(r,e)};this.pluginSystem.plugins.forEach(i)},t.prototype.getHitTestRay=function(e,t){var r=aS(this.renderFrame.editorTransform,4),i=r[0],n=r[1];return _R((e-r[2])/i,(t-r[3])/n,this.camera)},t.prototype.getEngine=function(){var e;return null===(e=this.renderer)||void 0===e?void 0:e.engine},t.prototype.hitTest=function(t,r,i,n){if(this.isDestroyed)return[];for(var o=[],a=[],s=aS(this.renderFrame.editorTransform,4),u=s[0],c=s[1],l=_R((t-s[2])/u,(r-s[3])/c,this.camera),f=(null==n?void 0:n.stop)||cC,h=(null==n?void 0:n.skip)||cC,p=(null==n?void 0:n.maxCount)||this.items.length,d=0;d<this.items.length&&a.length<p;d++){var m=this.items[d];if(m.lifetime>=0&&m.lifetime<=1&&!h(m)){var v=m.getHitTestParams(i);if(v){var y=!1,g=[];if(v.type===e.HitTestType.triangle)for(var x=v.triangles,T=v.backfaceCulling,E=0;E<x.length;E++){var _=x[E];if(IR(g,l.center,l.direction,_,T),g.length){y=!0,o.push(g);break}}else if(v.type===e.HitTestType.box){var S=v.center,A=v.size;AR(g,l.center,l.direction,S,A),g.length&&(y=!0,o.push(g))}else if(v.type===e.HitTestType.sphere){S=v.center;var R=v.radius;SR(g,l.center,l.direction,S,R),g.length&&(y=!0,o.push(g))}else if(v.type===e.HitTestType.custom){var C=v.collect(l,[t,r]);C&&C.length>0&&(o.push.apply(o,sS([],aS(C),!1)),y=!0)}if(y){var b={id:m.id,name:m.name,position:o[o.length-1],parentId:m.parentId,hitPositions:o,behavior:v.behavior};if(a.push(b),f(b))return a}}}}return a},t.prototype.addInteractiveItem=function(e,t){var r;if(t===LS.MESSAGE)return null===(r=this.handleMessageItem)||void 0===r||r.call(this,{name:e.name,phrase:2,id:e.id,compositionId:this.id}),e.id},t.prototype.removeInteractiveItem=function(e,t){var r;t===LS.MESSAGE&&(null===(r=this.handleMessageItem)||void 0===r||r.call(this,{name:e.name,phrase:1,id:e.id,compositionId:this.id}))},t.prototype.destroyTextures=function(t){for(var r,i=0;i<t.length;i++){var n=t[i];if(n)if(n.sourceType!==e.TextureSourceType.data||this.texInfo[n.id]){if(this.autoRefTex)--this.texInfo[n.id]||n.dispose()}else n!==(null===(r=this.rendererOptions)||void 0===r?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n.dispose()}},t.prototype.destroyItem=function(e){var t=this;this.content.removeItem(e)&&this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(t,e)}))},t.prototype.lost=function(e){this.videoState=this.textures.map((function(e){if("video"in e.source)return e.source.video.pause(),e.source.video.currentTime})),this.textures.map((function(e){return e.dispose()})),this.dispose()},t.prototype.dispose=function(){var e,t,r=this;if(!this.destroyed){this.destroyed=!0;var i={},n=this.textures;n&&(this.keepResource?n.forEach((function(e){(null==e?void 0:e.dispose)&&(i[e.id]=e.dispose,e.dispose=cC)})):n.forEach((function(e){return e&&e.dispose()}))),this.content.dispose(),this.renderFrame.dispose(),null===(e=this.rendererOptions)||void 0===e||e.emptyTexture.dispose(),null===(t=this.pluginSystem)||void 0===t||t.destroyComposition(this),this.update=function(){console.error("Update disposed composition: ".concat(r.name,"."))},this.handlePlayerPause=cC,this.dispose=cC,n&&this.keepResource&&n.forEach((function(e){return e.dispose=i[e.id]})),this.compositionSourceManager.dispose()}},t.prototype.setEditorTransform=function(e,t,r){this.renderFrame.editorTransform=[e,e,t,r]},t.prototype.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(e){return e&&e.offloadData()})),this.textureOffloaded=!0)},t.prototype.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},t.prototype.reloadTexture=function(){return iS(this,void 0,void 0,(function(){return nS(this,(function(e){switch(e.label){case 0:return this.textureOffloaded?[4,Promise.all(this.textures.map((function(e){return null==e?void 0:e.reloadData()})))]:[3,2];case 1:e.sent(),this.textureOffloaded=!1,e.label=2;case 2:return[2]}}))}))},t}();var NP,FP,DP,UP,BP=function(){function e(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[]}return e.prototype.addTexture=function(e){this.destroyed||kS(this.textures,e)},e.prototype.removeTexture=function(e){this.destroyed||zS(this.textures,e)},e.prototype.addMaterial=function(e){this.destroyed||kS(this.materials,e)},e.prototype.removeMaterial=function(e){this.destroyed||zS(this.materials,e)},e.prototype.addGeometry=function(e){this.destroyed||kS(this.geometries,e)},e.prototype.removeGeometry=function(e){this.destroyed||zS(this.geometries,e)},e.prototype.addMesh=function(e){this.destroyed||kS(this.meshes,e)},e.prototype.removeMesh=function(e){this.destroyed||zS(this.meshes,e)},e.prototype.addRenderPass=function(e){this.destroyed||kS(this.renderPasses,e)},e.prototype.removeRenderPass=function(e){this.destroyed||zS(this.renderPasses,e)},Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.prototype.dispose=function(){if(!this.destroyed){this.destroyed=!0;var e=[];this.renderPasses.length>0&&e.push("Pass ".concat(this.renderPasses.length)),this.meshes.length>0&&e.push("Mesh ".concat(this.meshes.length)),this.geometries.length>0&&e.push("Geom ".concat(this.geometries.length)),this.textures.length>0&&e.push("Tex ".concat(this.textures.length)),e.length>0&&console.warn("Release GPU memory: ".concat(e.join(", "))),this.renderPasses.forEach((function(e){e.dispose()})),this.meshes.forEach((function(e){e.dispose()})),this.geometries.forEach((function(e){e.dispose()})),this.materials.forEach((function(e){e.dispose()})),this.textures.forEach((function(e){e.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},e}(),kP=function(){function e(e){void 0===e&&(e=60),this.paused=!0,this.lastTime=0,this.setFPS(e),this.tickers=[]}return e.prototype.getFPS=function(){return this.targetFPS},e.prototype.setFPS=function(e){this.targetFPS=SA(e,1,120),this.interval=Math.floor(1e3/e)-1},e.prototype.getPaused=function(){return this.paused},e.prototype.start=function(){var e=this;if(this.paused=!1,!this.intervalId){this.lastTime=performance.now();var t=requestAnimationFrame||function(e){return window.setTimeout(e,16.7)},r=function(){e.intervalId=t(r),e.paused||e.tick()};r()}},e.prototype.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.tickers=[]},e.prototype.pause=function(){this.paused=!0},e.prototype.resume=function(){this.paused=!1},e.prototype.tick=function(){if(!this.paused){var e=performance.now(),t=e-this.lastTime;if(t>=this.interval){this.lastTime=e,this.resetTickers&&(this.tickers=this.tickers.filter((function(e){return e})),this.resetTickers=!1);for(var r=0,i=this.tickers.length;r<i;r++){(0,this.tickers[r])(t)}}}},e.prototype.add=function(e){if("function"!=typeof e)throw new Error("Ticker: The tick object must implement the tick method.");this.tickers.push(e)},e}();CC("camera",wC,PC,!0),CC("sprite",KO,nL,!0),CC("particle",bI,CI,!0),CC("cal",LI,II,!0),CC("interact",DO,NO,!0),CC("filter",KO,aL,!0),CC("text",ew,$I,!0),DS(Aw);var zP=((NP={})[xS.ONE]=i.OneFactor,NP[xS.ZERO]=i.ZeroFactor,NP[xS.SRC_COLOR]=i.SrcColorFactor,NP[xS.SRC_ALPHA]=i.SrcAlphaFactor,NP[xS.ONE_MINUS_SRC_COLOR]=i.OneMinusSrcColorFactor,NP[xS.ONE_MINUS_SRC_ALPHA]=i.OneMinusSrcAlphaFactor,NP[xS.DST_COLOR]=i.DstColorFactor,NP[xS.DST_ALPHA]=i.DstAlphaFactor,NP[xS.ONE_MINUS_DST_COLOR]=i.OneMinusDstColorFactor,NP[xS.ONE_MINUS_DST_ALPHA]=i.OneMinusDstAlphaFactor,NP),GP=((FP={})[xS.NEVER]=i.NeverStencilFunc,FP[xS.EQUAL]=i.EqualStencilFunc,FP[xS.LESS]=i.LessStencilFunc,FP[xS.LEQUAL]=i.LessEqualStencilFunc,FP[xS.ALWAYS]=i.AlwaysStencilFunc,FP[xS.NOTEQUAL]=i.NotEqualStencilFunc,FP[xS.GREATER]=i.GreaterStencilFunc,FP[xS.GEQUAL]=i.GreaterEqualStencilFunc,FP),jP=((DP={})[xS.KEEP]=i.KeepStencilOp,DP[xS.ZERO]=i.ZeroStencilOp,DP[xS.REPLACE]=i.ReplaceStencilOp,DP[xS.INCR]=i.IncrementStencilOp,DP[xS.DECR]=i.DecrementStencilOp,DP[xS.INCR_WRAP]=i.IncrementWrapStencilOp,DP[xS.DECR_WRAP]=i.IncrementWrapStencilOp,DP[xS.INVERT]=i.InvertStencilOp,DP),XP=((UP={})[xS.NEVER]=i.NeverDepth,UP[xS.ALWAYS]=i.AlwaysDepth,UP[xS.EQUAL]=i.EqualDepth,UP[xS.LESS]=i.LessDepth,UP[xS.LEQUAL]=i.LessEqualDepth,UP[xS.GREATER]=i.GreaterDepth,UP[xS.GEQUAL]=i.GreaterEqualDepth,UP[xS.NOTEQUAL]=i.NotEqualDepth,UP);function WP(e,t,r){e[t]?e[t].value=r:e[t]=new i.Uniform(r)}var HP=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],YP=function(t){function r(r,n){var o=t.call(this,n)||this;o.textures={},o.material=new i.RawShaderMaterial,o.uniforms={};for(var a=n.shader,s=r.gpuCapability.level,u=0;u<e.maxSpriteMeshItemCount;u++)o.uniforms["uSampler".concat(u)]=new i.Uniform(null);return o.uniforms.uEditorTransform=new i.Uniform([1,1,0,0]),o.uniforms.effects_ObjectToWorld=new i.Uniform((new i.Matrix4).identity()),o.uniforms.effects_MatrixInvV=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),o.uniforms.effects_MatrixVP=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),o.uniforms.effects_MatrixV=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),o.material=new i.RawShaderMaterial({vertexShader:a.vertex,fragmentShader:a.fragment,alphaToCoverage:!1,depthFunc:i.LessDepth,polygonOffsetFactor:i.ZeroFactor,polygonOffsetUnits:i.ZeroFactor,polygonOffset:!1,uniforms:o.uniforms}),o.material.glslVersion=1===s?i.GLSL1:i.GLSL3,o}return tS(r,t),r.prototype.onSetUniformValue=function(e,t){var r;HP.includes(e)&&(r=t.texture),this.material.uniforms[e]?this.material.uniforms[e].value=r||t:this.material.uniforms[e]=new i.Uniform(r||t)},r.prototype.onRemoveUniformValue=function(e){this.material.uniforms[e]&&(this.material.uniforms[e].value=null)},Object.defineProperty(r.prototype,"blending",{get:function(){return this.material.blending!==i.NoBlending},set:function(e){this.material.blending=e?i.CustomBlending:i.NoBlending},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendFunction",{get:function(){var e=this.material,t=e.blendSrc,r=e.blendDst;return[t,r,e.blendSrcAlpha||t,e.blendDstAlpha||r]},set:function(e){if(e){var t=aS(e,4),r=t[0],i=t[1],n=t[2],o=t[3];this.material.blendSrc=zP[r],this.material.blendDst=zP[i],this.material.blendSrcAlpha=zP[n],this.material.blendDstAlpha=zP[o]}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendEquation",{get:function(){var e=this.material,t=e.blendEquation;return[t,e.blendEquationAlpha||t]},set:function(e){if(e){var t=aS(e,2),r=t[0],i=t[1];this.material.blendEquation=r,this.material.blendEquationAlpha=i}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return this.material.depthTest},set:function(e){this.material.depthTest=!!e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return this.material.depthWrite},set:function(e){this.material.depthWrite=!!e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthFunc",{get:function(){return this.material.depthFunc},set:function(e){void 0!==e&&(this.material.depthFunc=XP[e])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffsetFill",{get:function(){return this.material.polygonOffset},set:function(e){this.material.polygonOffset=!!e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(e){if(e){var t=aS(e,2),r=t[0],i=t[1];this.material.polygonOffsetFactor=r,this.material.polygonOffsetUnits=i}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sampleAlphaToCoverage",{get:function(){return this.material.alphaToCoverage},set:function(e){this.material.alphaToCoverage=!!e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilTest",{get:function(){return this.material.stencilWrite},set:function(e){this.material.stencilWrite=!!e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilMask",{get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(e){e&&(this.material.stencilWriteMask=e[0])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilRef",{get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(e){e&&(this.material.stencilRef=e[0])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilFunc",{get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(e){e&&(this.material.stencilFunc=GP[e[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpFail",{get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(e){e&&(this.material.stencilFail=jP[e[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZFail",{get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(e){e&&(this.material.stencilZFail=jP[e[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZPass",{get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(e){e&&(this.material.stencilZPass=jP[e[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return this.material.side!==i.DoubleSide},set:function(e){this.material.side=e?i.FrontSide:i.DoubleSide},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cullFace",{get:function(){return this.material.side},set:function(e){e===RS.FRONT?this.material.side=i.FrontSide:e===RS.BACK&&(this.material.side=i.BackSide)},enumerable:!1,configurable:!0}),r.prototype.getTexture=function(e){return this.textures[e]},r.prototype.setTexture=function(e,t){this.setUniform(e,t.texture),this.textures[e]=t},r.prototype.getVector4Array=function(e){return this.uniforms[e].value},r.prototype.setVector4Array=function(e,t){var r,i,n=[];try{for(var o=oS(t),a=o.next();!a.done;a=o.next()){var s=a.value;n=n.concat(s)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.setUniform(e,n)},r.prototype.getMatrixArray=function(e){return this.uniforms[e].value},r.prototype.setMatrixArray=function(e,t){var r,i,n=[];try{for(var o=oS(t),a=o.next();!a.done;a=o.next()){var s=a.value;n=n.concat(s)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.setUniform(e,n)},r.prototype.setMatrixNumberArray=function(e,t){this.setUniform(e,t)},r.prototype.getMatrix=function(e){return this.uniforms[e].value},r.prototype.setMatrix=function(e,t){this.setUniform(e,t)},r.prototype.setMatrix3=function(e,t){this.setUniform(e,t)},r.prototype.getVector2=function(e){return this.uniforms[e].value},r.prototype.setVector2=function(e,t){this.setUniform(e,t)},r.prototype.getVector3=function(e){return this.uniforms[e].value},r.prototype.setVector3=function(e,t){this.setUniform(e,t)},r.prototype.getVector4=function(e){return this.uniforms[e].value},r.prototype.setVector4=function(e,t){this.setUniform(e,t)},r.prototype.getFloat=function(e){return this.uniforms[e].value},r.prototype.setFloat=function(e,t){this.setUniform(e,t)},r.prototype.getFloats=function(e){return this.uniforms[e].value},r.prototype.setFloats=function(e,t){this.setUniform(e,t)},r.prototype.getInt=function(e){return this.uniforms[e].value},r.prototype.setInt=function(e,t){this.setUniform(e,t)},r.prototype.hasUniform=function(e){return!!this.uniforms[e]},r.prototype.setUniform=function(e,t){var r=new i.Uniform(t);this.uniforms[e]=this.material.uniforms[e]=r},r.prototype.enableKeyword=function(e){throw new Error("Method not implemented.")},r.prototype.disableKeyword=function(e){throw new Error("Method not implemented.")},r.prototype.isKeywordEnabled=function(e){throw new Error("Method not implemented.")},r.prototype.clone=function(e){throw new Error("Method not implemented.")},r.prototype.cloneUniforms=function(e){throw new Error("Method not implemented.")},r.prototype.dispose=function(e){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},r}(yb),ZP=function(e){function t(t){var r=e.call(this,t)||this;return r.semantics.setSemantic(lS),r.semantics.setSemantic(fS),r.semantics.setSemantic(hS),r.semantics.setSemantic(pS),r}return tS(t,e),t.prototype.setRenderPasses=function(e){this._renderPasses=JS(e.slice())},t.prototype.addRenderPass=function(e){$S(this._renderPasses,e)},t.prototype.createResource=function(){this.resource={}},t.prototype.createCopyMesh=function(e){},t.prototype.addMeshToDefaultRenderPass=function(e){var t,r=e.material.material,n=r.uniforms,o=e.material.uniformSemantics;if(this.threeCamera){var a=this.threeCamera,s=(new i.Matrix4).multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse);t={effects_ObjectToWorld:e.mesh.matrixWorld,effects_MatrixV:a.matrixWorldInverse,effects_MatrixVP:s,effects_MatrixInvV:a.matrixWorld}}else{a=this.camera;t={effects_MatrixV:a.getViewMatrix(),effects_MatrixVP:a.getViewProjectionMatrix(),effects_MatrixInvV:a.getInverseViewMatrix()}}Object.keys(o).forEach((function(e){t[e]&&WP(n,e,t[e])})),r.uniformsNeedUpdate=!0,this.group.add(e.mesh)},t.prototype.removeMeshFromDefaultRenderPass=function(e){this.group.remove(e.mesh)},t.prototype.updateMatrix=function(){var e=this.group,t=this.threeCamera;t&&e.children.forEach((function(e){var r=e.material,n=r.uniforms,o=(new i.Matrix4).multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);WP(n,"effects_ObjectToWorld",e.matrixWorld),WP(n,"effects_MatrixVP",o),r.uniformsNeedUpdate=!0}))},t.prototype.updateUniform=function(){var e=this.group,t=this.camera;e.children.forEach((function(e){var r=e.material;WP(r.uniforms,"effects_MatrixInvV",t.getInverseViewMatrix()),WP(r.uniforms,"effects_MatrixVP",t.getViewProjectionMatrix()),WP(r.uniforms,"effects_MatrixV",t.getViewMatrix()),r.uniformsNeedUpdate=!0}))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.group&&this.group.clear()},t}(xO),qP=function(t){function r(r,i){void 0===i&&(i={});var n=t.call(this)||this;if(r){var o=r.width,a=void 0===o?1:o,s=r.height,u=void 0===s?1:s;n.texture=n.createTextureByType(rS(rS({},i),{sourceType:e.TextureSourceType.data,data:r})),n.width=a,n.height=u}else n.texture=n.createTextureByType(i);return n.texture.needsUpdate=!0,n}return tS(r,t),r.toThreeJsTextureFilter=function(e){return e===xS.LINEAR?i.LinearFilter:i.NearestFilter},r.toThreeJsTextureWrap=function(e){switch(e){case xS.MIRRORED_REPEAT:return i.MirroredRepeatWrapping;case xS.REPEAT:return i.RepeatWrapping;default:return i.ClampToEdgeWrapping}},r.prototype.updateSource=function(e){this.texture.dispose(),this.texture=this.createTextureByType(e),this.texture.needsUpdate=!0},r.prototype.startVideo=function(){return iS(this,void 0,void 0,(function(){var t;return nS(this,(function(r){switch(r.label){case 0:return this.sourceType!==e.TextureSourceType.video?[3,2]:(t=this.texture.source.data).paused?[4,t.play()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r.prototype.assembleOptions=function(t){var n=t.target,o=void 0===n?xS.TEXTURE_2D:n;return t.sourceType||(t.sourceType="image"in t?e.TextureSourceType.image:"data"in t?e.TextureSourceType.data:"video"in t?e.TextureSourceType.video:e.TextureSourceType.none),rS(rS({target:o,format:i.RGBAFormat,type:i.UnsignedByteType},t),{minFilter:r.toThreeJsTextureFilter(t.minFilter),magFilter:r.toThreeJsTextureFilter(t.magFilter),wrapS:r.toThreeJsTextureWrap(t.wrapS),wrapT:r.toThreeJsTextureWrap(t.wrapT)})},r.prototype.dispose=function(){this.texture.dispose()},r.prototype.createTextureByType=function(t){var r,n,o=this.assembleOptions(t),a=o.flipY,s=o.type,u=o.wrapS,c=o.wrapT,l=o.minFilter,f=o.magFilter,h=o.sourceType,p=i.UVMapping,d=o.format,m=void 0;if(this.sourceType=h,h===e.TextureSourceType.data){var v=t.data;m=new i.DataTexture(v.data,v.width,v.height,d,s,p,u,c,f,l),this.width=v.width,this.height=v.height}else if(h===e.TextureSourceType.image){var y=t.image;m=new i.Texture(y,p,u,c,f,l,d,s),this.width=y.width,this.height=y.height}else if(h===e.TextureSourceType.compressed){var g=0,x=0,T=t.mipmaps.map((function(e){var t=e.data,r=e.width,i=e.height;return g=g<r?r:g,x=x<i?i:x,{data:t,width:r,height:i,colorSpace:"srgb"}}));d=i.RGBA_ASTC_4x4_Format,m=new i.CompressedTexture(T,g,x,d,s,p,u,c,f,l),this.width=g,this.height=x}else if(h===e.TextureSourceType.video)m=new i.VideoTexture(t.video,p,u,c,f,l,d,s);else if(h===e.TextureSourceType.framebuffer){if(v=t.data){var E=null!==(r=v.width)&&void 0!==r?r:0,_=null!==(n=v.height)&&void 0!==n?n:0;m=new i.FramebufferTexture(E,_,d),this.width=E,this.height=_}}else h===e.TextureSourceType.none&&((m=new i.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=i.MirroredRepeatWrapping,m.wrapT=i.MirroredRepeatWrapping,this.width=this.height=1);if(m)return m.flipY=!!a,m;throw new Error("使用未知的数据类型创建纹理")},r}(ob),KP=function(e){function t(r,i){var n,o=e.call(this,r,i)||this;return null===(n=o.compositionSourceManager.sourceContent)||void 0===n||n.items.forEach((function(e){var r=e.content.renderer.shape;r&&Object.keys(r).forEach((function(e){var i=r[e];t.shape[e]||(t.shape[e]=0),t.shape[e]+=i.length}))})),o.content.start(),o}return tS(t,e),t.prototype.createRenderFrame=function(){this.renderFrame=new ZP({camera:this.camera,keepColorBuffer:this.keepColorBuffer,renderer:this.renderer})},t.prototype.updateVideo=function(){this.textures.map((function(e){return e.startVideo()}))},t.prototype.updateCamera=function(){var e=this.renderFrame;e.threeCamera?e.updateMatrix():e.updateUniform()},t.prototype.getRendererOptions=function(){var e=qP.createWithData(this.renderer.engine,{data:new Uint8Array(4).fill(255),width:1,height:1});return e.texture.needsUpdate=!0,this.rendererOptions||(this.rendererOptions={emptyTexture:e,cachePrefix:"-"}),this.rendererOptions},t.shape={},t}(VP),QP=1,JP=function(e){function t(t,r){var n=this,o=r.drawStart,a=void 0===o?0:o,s=r.drawCount,u=r.indices,c=r.mode,l=r.name,f=void 0===l?"effectsGeometry:".concat(QP++):l;(n=e.call(this,f)||this).attributes={},n.destroyed=!1,n.attributesName=[],n.mode=null!=c?c:xS.TRIANGLES;var h=[],p={},d=new i.BufferGeometry;return Object.keys(r.attributes).forEach((function(e){var t=r.attributes[e];if("dataSource"in t){var o=t.dataSource;if(o){void 0===p[o]&&n.setAttributeType(o,t,d,p,r.maxVertex);var a=t.size,s=t.offset,u=t.normalize,c=p[o],l=c.buffer,f=c.dataLength,m=new i.InterleavedBufferAttribute(l,a,(null!=s?s:0)/f,u);d.setAttribute(e,m),p[e]={buffer:l,attribute:m,type:c.type,dataLength:f}}}else n.setAttributeType(e,t,d,p,r.maxVertex);h.push(e)})),u&&u.data&&d.setIndex(new i.BufferAttribute(u.data,1)),n.geometry=d,n.attributes=p,n.attributesName=h,n.drawStart=a,n.drawCount=null!=s?s:0,n}return tS(t,e),Object.defineProperty(t.prototype,"drawCount",{get:function(){return this.geometry.drawRange.count},set:function(e){this.geometry.drawRange.count=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawStart",{get:function(){return this.geometry.drawRange.start},set:function(e){this.geometry.drawRange.start=e},enumerable:!1,configurable:!0}),t.prototype.getAttributeData=function(e){if(null!=this.attributes[e])return this.attributes[e].buffer.array},t.prototype.setAttributeData=function(e,t){if(null!=this.attributes[e]){var r=this.attributes[e].buffer;r.updateRange.count=t.length,r.updateRange.offset=0,r.set(t,0),this.geometry.attributes[e].needsUpdate=!0}},t.prototype.setAttributeSubData=function(e,t,r){null!=this.attributes[e]&&(this.attributes[e].buffer.set(r,t),this.geometry.attributes[e].needsUpdate=!0)},t.prototype.getAttributeStride=function(e){var t=this.attributes[e];return t.buffer.stride*Ib[t.type]},t.prototype.getAttributeNames=function(){return this.attributesName},t.prototype.getIndexData=function(){var e=this.geometry.getIndex();return null===e?void 0:e.array},t.prototype.setIndexData=function(e){e&&(this.geometry.setIndex(new i.BufferAttribute(e,1)),this.geometry.index.needsUpdate=!0)},t.prototype.setIndexSubData=function(e,t){var r=this.geometry.getIndex();if(null!==r){var i=e,n=e+t.length;if(r.count<n){var o=new t.constructor(end);o.set(r.array),r.array=o}r.array.set(t,i),this.geometry.index.needsUpdate=!0}},t.prototype.setDrawStart=function(e){this.drawStart=e},t.prototype.getDrawStart=function(){return this.drawStart},t.prototype.setDrawCount=function(e){this.drawCount=e},t.prototype.getDrawCount=function(){return this.drawCount},t.prototype.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},t.prototype.setAttributeType=function(e,t,r,n,o){var a,s=t,u=s.size,c=s.offset,l=s.normalize,f=s.type,h=void 0===f?xS.FLOAT:f,p=t,d=p.stride,m=p.data;if(h&&!m&&(m=Pb(h)),m){d="aSprite"===e?12:null!=d?d:0;var v=m instanceof Float32Array?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,y=d/v;if(o){var g=o*d+(null!==(a=KP.shape[e])&&void 0!==a?a:0);0===m.length&&(m=m instanceof Float32Array?new Float32Array(g):new Uint16Array(g))}var x=new i.InterleavedBuffer(m,y),T=new i.InterleavedBufferAttribute(x,u,(null!=c?c:0)/v,l);r.setAttribute(e,T),n[e]={buffer:x,attribute:T,type:h,dataLength:v}}},t}(wb),$P=function(t){function r(e,r){var n=this,o=r.material,a=r.geometry,s=r.priority,u=void 0===s?0:s;return(n=t.call(this,e,r)||this).geometry=a,n.material=o,a.mode===xS.LINES?n.mesh=new i.LineSegments(a.geometry,o.material):n.mesh=new i.Mesh(a.geometry,o.material),n.worldMatrix=n.mesh.matrixWorld,n.priority=u,n}return tS(r,t),Object.defineProperty(r.prototype,"priority",{get:function(){return this.mesh.renderOrder},set:function(e){this.mesh&&(this.mesh.renderOrder=e)},enumerable:!1,configurable:!0}),r.prototype.setVisible=function(e){this.mesh.visible=!e},r.prototype.getVisible=function(){return!this.mesh.visible},r.prototype.firstGeometry=function(){return this.geometry},r.prototype.setMaterial=function(t,r){r!==e.DestroyOptions.keep&&this.material.dispose(r),this.material=t,this.mesh.material=t.material},r.prototype.restore=function(){},r.prototype.dispose=function(e){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},r}(kb),eM=function(e){function t(t){var r=e.call(this)||this;return r.gpuCapability=new RO(t),r}return tS(t,e),t}(BP),tM=function(e){function t(t){var r=e.call(this)||this;return r.engine=new eM(t),r}return tS(t,e),t}(PO),rM=function(e){function t(t,r){var i=e.call(this)||this,n=r.width,o=r.height,a=r.camera;return i.renderer=new tM(t),i.width=n,i.height=o,i.camera=a,i}return tS(t,e),Object.defineProperty(t.prototype,"currentComposition",{get:function(){return this.compositions[0]},enumerable:!1,configurable:!0}),t.prototype.loadScene=function(e,t){return iS(this,void 0,void 0,(function(){var t,r;return nS(this,(function(i){switch(i.label){case 0:return[4,new wP({}).loadScene(e)];case 1:return t=i.sent(),(r=new KP({renderer:this.renderer,width:this.width,height:this.height},t)).renderFrame.group=this,r.renderFrame.threeCamera=this.camera,this.compositions=[r],[2]}}))}))},t.prototype.update=function(e){this.compositions.forEach((function(t){t.update(e)}))},t}(i.Group);WO(8),ob.create=function(e,t){return new qP(void 0,t)},ob.createWithData=function(e,t,r){return new qP(t,r)},yb.create=function(e,t){return new YP(e,t)},wb.create=function(e,t){return new JP(e,t)},kb.create=function(e,t){return new $P(e,t)};console.info("[Galacean Effects THREEJS] version: 0.0.1-alpha.0"),e.AbstractPlugin=LC,e.AssetManager=wP,e.BYTES_TYPE_MAP=Ib,e.BezierSegments=ZR,e.COMPRESSED_TEXTURE=LO,e.CONSTANT_MAP_BLEND=zP,e.CONSTANT_MAP_DEPTH=XP,e.CONSTANT_MAP_STENCIL_FUNC=GP,e.CONSTANT_MAP_STENCIL_OP=jP,e.COPY_FRAGMENT_SHADER=Sb,e.COPY_MESH_SHADER_ID=Eb,e.COPY_VERTEX_SHADER=_b,e.CalculateItem=eL,e.CalculateLoader=LI,e.CalculateVFXItem=II,e.Camera=hw,e.CameraController=IC,e.CameraVFXItem=PC,e.CameraVFXItemLoader=wC,e.Composition=VP,e.CompositionSourceManager=LP,e.CurveValue=WR,e.DEFAULT_FONTS=zI,e.DEG2RAD=vS,e.Downloader=KC,e.EFFECTS_COPY_MESH_NAME=Tb,e.EVENT_TYPE_CLICK=NC,e.EVENT_TYPE_TOUCH_END=UC,e.EVENT_TYPE_TOUCH_MOVE=DC,e.EVENT_TYPE_TOUCH_START=FC,e.Engine=BP,e.EventSystem=kC,e.FILTER_NAME_NONE=mS,e.FilterSpriteVFXItem=aL,e.Float16ArrayWrapper=LA,e.FrameBuffer=wO,e.GPUCapability=RO,e.Geometry=wb,e.GlobalUniforms=_O,e.GradientValue=XR,e.HELP_LINK=yS,e.InteractBehavior=BC,e.InteractItem=UO,e.InteractLoader=DO,e.InteractMesh=VO,e.InteractVFXItem=NO,e.KTXTexture=sb,e.LineSegments=HR,e.LinearValue=jR,e.Material=yb,e.MaterialDataBlock=hb,e.Mesh=kb,e.NumberEpsilon=QA,e.PLAYER_OPTIONS_ENV_EDITOR=dS,e.POST_PROCESS_SETTINGS="post_process_settings",e.ParticleLoader=bI,e.ParticleMesh=sL,e.ParticleSystem=mI,e.ParticleVFXItem=CI,e.PassTextureCache=Ob,e.PathSegments=YR,e.PluginSystem=OC,e.QCanvasViewer=FI,e.QText=NI,e.RENDER_PASS_NAME_PREFIX=yO,e.RENDER_PREFER_LOOKUP_TEXTURE=Mb,e.RUNTIME_ENV="runtime_env",e.RandomSetValue=kR,e.RandomValue=zR,e.RandomVectorValue=GR,e.RenderBuffer=SO,e.RenderFrame=xO,e.RenderPass=Wb,e.RenderPassPriorityNormal=zb,e.RenderPassPriorityPostprocess=3e3,e.RenderPassPriorityPrepare=0,e.RenderTargetHandle=jb,e.Renderer=PO,e.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0=hS,e.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0=pS,e.SEMANTIC_PRE_COLOR_ATTACHMENT_0=lS,e.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0=fS,e.SPRITE_VERTEX_STRIDE=uS,e.SemanticMap=Lb,e.Shader=xb,e.SpriteItem=iL,e.SpriteLoader=KO,e.SpriteMesh=kO,e.SpriteVFXItem=nL,e.StaticValue=BR,e.TEMPLATE_USE_OFFSCREEN_CANVAS=Vb,e.TEXTURE_UNIFORM_MAP=HP,e.TextItem=JI,e.TextLoader=ew,e.TextMesh=wI,e.TextVFXItem=$I,e.Texture=ob,e.TextureFactory=lb,e.ThreeComposition=KP,e.ThreeDisplayObject=rM,e.ThreeMaterial=YP,e.ThreeTexture=qP,e.Ticker=kP,e.TimelineComponent=uC,e.Transform=TC,e.VFXItem=EC,e.VFX_ITEM_TYPE_TREE=cS,e.ValueGetter=UR,e.addByOrder=$S,e.addItem=kS,e.addItemWithOrder=GS,e.alphaFrameFrag=Jb,e.alphaMaskFrag=$b,e.assertExist=rA,e.asserts=function(e,t){if(void 0===t&&(t="asserts failed"),!e)throw new Error(t)}
15
+ /*!
16
+ * Name: @galacean/effects-specification
17
+ * Description: Galacean Effects JSON Specification
18
+ * Author: Ant Group CO., Ltd.
19
+ * Version: v0.0.1
20
+ */,e.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",e.bloomMixVert=nO,e.bloomThresholdVert=oO,e.calculateTranslation=FR,e.cameraMoveFrag="uniform vec2 uMoveTexSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uMoveTexSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uMoveTexSize,(coordMin+vec2(1.))/uMoveTexSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));vec4 cB=mix(cLB,cRB,pp.x);vec4 cT=mix(cLT,cRT,pp.x);return mix(cB,cT,pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}",e.cameraMoveVert=eO,e.canvasPool=WI,e.clamp=SA,e.colorGradingFrag=sO,e.colorStopsFromGradient=HS,e.colorToArr=XS,e.combineImageTemplate=KI,e.combineImageTemplate1=UI,e.combineImageTemplate1Async=function(e,t,r,i,n){return iS(this,void 0,void 0,(function(){return nS(this,(function(o){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,UI(e,t,r,i,n)]}))}))},e.combineImageTemplate2=qI,e.combineImageTemplate2Async=function(e,t,r,i,n){return iS(this,void 0,void 0,(function(){return nS(this,(function(o){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,qI(e,t,r,i,n)]}))}))},e.combineImageTemplateAsync=function(e,t,r,i,n){return iS(this,void 0,void 0,(function(){return nS(this,(function(o){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,KI(e,t,r,i,n)]}))}))},e.compatibleFrag="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n",e.compatibleVert="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n",e.convertAnchor=RA,e.copyFrag=gb,e.createCopyShader=Ab,e.createFilter=BS,e.createFilterShaders=US,e.createGLContext=function(e,t,r){var i;if(void 0===t&&(t="webgl"),"webgl2"===t&&((i=e.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),i&&"webgl"!==t||(i=e.getContext("webgl",r)),!i)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i},e.createKeyFrameMeta=iC,e.createShaderWithMarcos=HC,e.createShape=LL,e.createVFXItem=_C,e.createValueGetter=KR,e.deepClone=dC,e.defaultGlobalVolume=vO,e.defaultPlugins=AC,e.delayFrag=tO,e.deserializeMipmapTexture=rb,e.distortionFrag=rO,e.distortionVert=iO,e.dotInTriangle=function(e,t,r){var i=aS(r,3),n=i[0],o=i[1],a=i[2],s=[n[0],n[1]],u=[o[0],o[1]],c=[a[0],a[1]];oR(wR,c,s),oR(PR,u,s),oR(MR,t,s);var l=sR(wR,wR),f=sR(wR,PR),h=sR(wR,MR),p=sR(PR,PR),d=sR(PR,MR),m=l*p-f*f;if(0===m)return!1;var v=1/m,y=(p*h-f*d)*v,g=(l*d-f*h)*v;return 1-y-g>=0&&g>=0&&1-y<=1},e.earcut=JL,e.enlargeBuffer=jS,e.ensureVec3=$A,e.filters=Aw,e.findPreviousRenderPass=function(e,t){var r=e.indexOf(t);return e[r-1]},e.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",e.gaussianDownHFrag=uO,e.gaussianDownVFrag=cO,e.gaussianUpFrag=lO,e.generateEmptyTypedArray=Pb,e.generateHalfFloatTexture=ab,e.getBackgroundImage=HI,e.getColorFromGradientStops=WS,e.getComposition=function(e,t){return e.find((function(e){return e.id===t}))},e.getConfig=Fb,e.getDefaultTemplateCanvasPool=function(){return WI},e.getDefaultTextureFactory=function(){return cb||(cb=new lb),cb},e.getGeometryByShape=nI,e.getGeometryTriangles=iI,e.getImageItemRenderInfo=zO,e.getKTXTextureOptions=ub,e.getKeyFrameMetaByRawValue=rC,e.getMat4TR=GA,e.getMat4TRS=jA,e.getParticleMeshShader=lL,e.getPixelRatio=function(){if("object"==typeof screen&&"object"==typeof document){var e=Math.max(document.documentElement.clientWidth,window.innerWidth||0),t=screen.width/e;return Math.min(2*t,2)}return 1},e.getPreMultiAlpha=GC,e.getStandardComposition=EP,e.getStandardImage=TP,e.getStandardItem=RP,e.getStandardJSON=gP,e.getTextureSize=TO,e.glContext=xS,e.gpuTimer=function(e){var t=this,r=e.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var i=e.createQuery(),n=function(){return iS(t,void 0,void 0,(function(){return nS(this,(function(t){return[2,new Promise((function(t,o){if(i){var a=e.getQueryParameter(i,e.QUERY_RESULT_AVAILABLE),s=e.getParameter(r.GPU_DISJOINT_EXT);if(a&&!s){var u=e.getQueryParameter(i,e.QUERY_RESULT);t(u/1e3/1e3)}(a||s)&&(e.deleteQuery(i),i=null),null!==a&&i&&window.setTimeout((function(){n().then(t).catch}),1)}}))]}))}))};if(!i)return;return{begin:function(){i&&e.beginQuery(r.TIME_ELAPSED_EXT,i)},end:function(){e.endQuery(r.TIME_ELAPSED_EXT)},getTime:n}}},e.imageDataFromColor=function(e){lC(e)&&(e=XS(e));for(var t=e,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=t[n];return r},e.imageDataFromGradient=QS,e.initErrors=gS,e.initGLContext=TS,e.integrate="float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;float r=dot(vec4(2.*t*t*t,3.*t*t,-t0*t0*t0,3.*t0*t0),vec4(y0-y1,t0*y1-t1*y0,2.*y0+y1,t1*y0));return r/(t0-t1)/6.;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}return 0.;}",e.interpolateColor=YS,e.intersectRayBox=AR,e.intersectRaySphere=SR,e.intersectRayTriangle=IR,e.isAndroid=qS,e.isArray=fC,e.isFunction=hC,e.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},e.isIdentityMatrix=VA,e.isObject=pC,e.isScene=function(e){return pC(e)&&"jsonScene"in e},e.isSimulatorCellPhone=KS,e.isString=lC,e.isUniformStruct=pb,e.isUniformStructArray=function(e){return e&&void 0!==e.length&&pb(e[0])},e.isWebGL2=function(e){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name},e.isZeroVec=JA,e.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",e.itemFrag=Zb,e.itemFrameFrag=Hb,e.itemVert=Yb,e.loadBinary=eb,e.loadBlob=function(e){return iS(this,void 0,void 0,(function(){return nS(this,(function(t){return[2,new Promise((function(t,r){(new KC).downloadBlob(e,t,(function(t,i){r("Couldn't load blob ".concat(e,": status ").concat(t,", ").concat(i))}))}))]}))}))},e.loadImage=$C,e.loadVideo=tb,e.loadWebPOptional=JC,e.mat3FromQuat=wA,e.mat3FromRotation=pR,e.mat3FromRotationZ=hR,e.mat4Clone=XA,e.mat4Determinate=zA,e.mat4ToIdentityMatrix=MA,e.mat4create=PA,e.mat4fromRotationTranslationScale=NA,e.mat4invert=FA,e.mat4multiply=DA,e.mat4perspective=UA,e.modifyMaxKeyframeShader=fL,e.nearestPowerOfTwo=AA,e.noop=cC,e.parsePercent=ZS,e.particleFrag=qb,e.particleOriginTranslateMap=_A,e.particleVert=Kb,e.pluginLoaderMap=SC,e.quatFromRotation=xR,e.quatMultiply=gR,e.quatStar=TR,e.random=mC,e.registerFilter=FS,e.registerFilters=DS,e.registerPlugin=CC,e.removeItem=zS,e.requestAsync=DI,e.rotateByQuat=function(e,t,r){var i=r[0],n=r[1],o=r[2],a=r[3],s=[i,n,o],u=uR([],s,t),c=uR([],s,u);sR(c,c,2),sR(u,u,2*a),qA(c,c,u),qA(e,t,c)},e.rotateVec2=oI,e.rotationFromMat3=dR,e.screenMeshVert=aO,e.setBlendMode=YC,e.setConfig=function(e,t){return Nb[e]=t},e.setDefaultTextureFactory=function(e){cb=e},e.setMaskMode=qC,e.setMaxSpriteMeshItemCount=WO,e.setRayFromCamera=_R,e.setSideMode=ZC,e.setSpriteMeshMaxFragmentTextures=function(t){e.maxSpriteTextureCount=t},e.setSpriteMeshMaxItemCountByGPU=function(t){return e.maxSpriteTextureCount=Math.min(t.maxFragmentTextures,16),t.maxVertexUniforms>=256?e.maxSpriteMeshItemCount=32:t.maxVertexUniforms>=128?e.maxSpriteMeshItemCount=16:void(e.maxSpriteTextureCount=8)},e.setUniformValue=WP,e.sortByOrder=JS,e.spec=EA,e.spriteMeshShaderFromFilter=GO,e.spriteMeshShaderFromRenderInfo=XO,e.spriteMeshShaderIdFromRenderInfo=jO,e.thresholdFrag=fO,e.throwDestroyedError=vC,e.trailVert=Qb,e.translatePoint=function(e,t){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=e,r[i+1]+=t;return r},e.trianglesFromRect=LR,e.unregisterPlugin=function(e){delete RC[e],delete SC[e],zS(AC,e)},e.valIfUndefined=function(e,t){return null==e?t:e},e.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).y;}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}",e.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",e.vec3Cross=uR,e.vec3MulMat3=eR,e.vec3MulMat4=cR,e.vec3RotateByMat4=lR,e.vecAdd=qA,e.vecAssign=tR,e.vecDot=sR,e.vecFill=KA,e.vecMinus=oR,e.vecMulCombine=rR,e.vecMulScalar=nR,e.vecNormalize=iR,e.vecSquareDistance=aR,e.version="0.0.1-alpha.0",Object.defineProperty(e,"__esModule",{value:!0})}));
21
+ //# sourceMappingURL=index.min.js.map