System.register(["./instantiated-443542f0.js"],(function(t){"use strict";var e,i,n,r,s,a,o,h,l,u,c,d,_,f,p,g,m,v,y,T,S,E,A,C,R,b,x,w,M,I,B,P,D,O,F,L,N,k,U,G,V,H,z,X,W,Y,j,K,q,Z,Q,J,$,tt,et,it,nt,rt,st,at,ot,ht,lt,ut,ct,dt,_t,ft,pt,gt,mt,vt,yt,Tt,St,Et,At,Ct,Rt,bt,xt,wt,Mt,It,Bt,Pt,Dt,Ot,Ft,Lt,Nt,kt,Ut,Gt,Vt,Ht,zt,Xt,Wt,Yt,jt,Kt,qt,Zt,Qt,Jt,$t,te,ee,ie,ne,re,se,ae,oe,he,le,ue,ce,de,_e,fe,pe,ge,me,ve,ye,Te,Se,Ee,Ae,Ce,Re,be,xe,we,Me,Ie,Be,Pe,De,Oe,Fe,Le,Ne,ke,Ue,Ge,Ve,He,ze,Xe,We,Ye,je,Ke,qe,Ze,Qe,Je,$e,ti,ei,ii,ni,ri,si,ai,oi,hi,li,ui,ci,di,_i,fi,pi,gi,mi,vi,yi,Ti,Si,Ei,Ai,Ci,Ri,bi,xi,wi,Mi,Ii,Bi,Pi,Di,Oi,Fi,Li,Ni,ki,Ui,Gi,Vi,Hi,zi,Xi,Wi,Yi,ji,Ki,qi,Zi,Qi,Ji,$i,tn,en,nn,rn,sn,an,on,hn,ln,un,cn,dn,_n,fn,pn,gn,mn,vn,yn,Tn,Sn,En,An,Cn,Rn,bn,xn,wn,Mn,In,Bn,Pn,Dn,On,Fn,Ln,Nn,kn,Un,Gn,Vn,Hn,zn,Xn,Wn,Yn,jn,Kn,qn,Zn,Qn,Jn,$n,tr,er,ir,nr,rr,sr,ar,or,hr,lr,ur,cr,dr,_r,fr,pr,gr,mr,vr,yr,Tr,Sr,Er,Ar,Cr,Rr,br,xr,wr,Mr,Ir,Br,Pr,Dr,Or,Fr,Lr,Nr,kr,Ur,Gr,Vr,Hr,zr,Xr,Wr,Yr,jr,Kr,qr,Zr,Qr,Jr,$r,ts,es,is,ns,rs,ss,as,os,hs,ls,us,cs,ds,_s,fs,ps,gs,ms,vs,ys,Ts,Ss,Es,As,Cs,Rs,bs,xs,ws,Ms,Is,Bs,Ps,Ds,Os,Fs,Ls,Ns,ks,Us,Gs,Vs,Hs,zs,Xs,Ws,Ys,js,Ks,qs,Zs,Qs,Js,$s,ta,ea,ia,na,ra,sa,aa,oa,ha,la,ua,ca,da,_a,fa,pa,ga,ma,va,ya,Ta,Sa,Ea,Aa,Ca,Ra,ba,xa,wa,Ma,Ia,Ba,Pa,Da,Oa,Fa,La,Na,ka,Ua,Ga,Va,Ha,za;return{setters:[function(Xa){e=Xa.P,i=Xa.R,n=Xa.C,r=Xa.a,s=Xa.D,a=Xa.B,o=Xa.b,h=Xa.O,l=Xa.S,u=Xa.A,c=Xa.c,d=Xa.F,_=Xa.d,f=Xa.e,p=Xa.T,g=Xa.f,m=Xa.g,v=Xa.M,y=Xa.h,T=Xa.i,S=Xa.j,E=Xa.k,A=Xa.l,C=Xa.m,R=Xa.V,b=Xa.n,x=Xa.o,w=Xa.p,M=Xa.q,I=Xa.r,B=Xa.s,P=Xa.t,D=Xa.u,O=Xa.L,F=Xa.v,L=Xa.w,N=Xa.x,k=Xa.y,U=Xa.z,G=Xa.E,V=Xa.G,H=Xa.H,z=Xa.I,X=Xa.J,W=Xa.K,Y=Xa.Q,j=Xa.N,K=Xa.U,q=Xa.W,Z=Xa.X,Q=Xa.Y,J=Xa.Z,$=Xa._,tt=Xa.$,et=Xa.a0,it=Xa.a1,nt=Xa.a2,rt=Xa.a3,st=Xa.a4,at=Xa.a5,ot=Xa.a6,ht=Xa.a7,lt=Xa.a8,ut=Xa.a9,ct=Xa.aa,dt=Xa.ab,_t=Xa.ac,ft=Xa.ad,pt=Xa.ae,gt=Xa.af,mt=Xa.ag,vt=Xa.ah,yt=Xa.ai,Tt=Xa.aj,St=Xa.ak,Et=Xa.al,At=Xa.am,Ct=Xa.an,Rt=Xa.ao,bt=Xa.ap,xt=Xa.aq,wt=Xa.ar,Mt=Xa.as,It=Xa.at,Bt=Xa.au,Pt=Xa.av,Dt=Xa.aw,Ot=Xa.ax,Ft=Xa.ay,Lt=Xa.az,Nt=Xa.aA,kt=Xa.aB,Ut=Xa.aC,Gt=Xa.aD,Vt=Xa.aE,Ht=Xa.aF,zt=Xa.aG,Xt=Xa.aH,Wt=Xa.aI,Yt=Xa.aJ,jt=Xa.aK,Kt=Xa.aL,qt=Xa.aM,Zt=Xa.aN,Qt=Xa.aO,Jt=Xa.aP,$t=Xa.aQ,te=Xa.aR,ee=Xa.aS,ie=Xa.aT,ne=Xa.aU,re=Xa.aV,se=Xa.aW,ae=Xa.aX,oe=Xa.aY,he=Xa.aZ,le=Xa.a_,ue=Xa.a$,ce=Xa.b0,de=Xa.b1,_e=Xa.b2,fe=Xa.b3,pe=Xa.b4,ge=Xa.b5,me=Xa.b6,ve=Xa.b7,ye=Xa.b8,Te=Xa.b9,Se=Xa.ba,Ee=Xa.bb,Ae=Xa.bc,Ce=Xa.bd,Re=Xa.be,be=Xa.bf,xe=Xa.bg,we=Xa.bh,Me=Xa.bi,Ie=Xa.bj,Be=Xa.bk,Pe=Xa.bl,De=Xa.bm,Oe=Xa.bn,Fe=Xa.bo,Le=Xa.bp,Ne=Xa.bq,ke=Xa.br,Ue=Xa.bs,Ge=Xa.bt,Ve=Xa.bu,He=Xa.bv,ze=Xa.bw,Xe=Xa.bx,We=Xa.by,Ye=Xa.bz,je=Xa.bA,Ke=Xa.bB,qe=Xa.bC,Ze=Xa.bD,Qe=Xa.bE,Je=Xa.bF,$e=Xa.bG,ti=Xa.bH,ei=Xa.bI,ii=Xa.bJ,ni=Xa.bK,ri=Xa.bL,si=Xa.bM,ai=Xa.bN,oi=Xa.bO,hi=Xa.bP,li=Xa.bQ,ui=Xa.bR,ci=Xa.bS,di=Xa.bT,_i=Xa.bU,fi=Xa.bV,pi=Xa.bW,gi=Xa.bX,mi=Xa.bY,vi=Xa.bZ,yi=Xa.b_,Ti=Xa.b$,Si=Xa.c0,Ei=Xa.c1,Ai=Xa.c2,Ci=Xa.c3,Ri=Xa.c4,bi=Xa.c5,xi=Xa.c6,wi=Xa.c7,Mi=Xa.c8,Ii=Xa.c9,Bi=Xa.ca,Pi=Xa.cb,Di=Xa.cc,Oi=Xa.cd,Fi=Xa.ce,Li=Xa.cf,Ni=Xa.cg,ki=Xa.ch,Ui=Xa.ci,Gi=Xa.cj,Vi=Xa.ck,Hi=Xa.cl,zi=Xa.cm,Xi=Xa.cn,Wi=Xa.co,Yi=Xa.cp,ji=Xa.cq,Ki=Xa.cr,qi=Xa.cs,Zi=Xa.ct,Qi=Xa.cu,Ji=Xa.cv,$i=Xa.cw,tn=Xa.cx,en=Xa.cy,nn=Xa.cz,rn=Xa.cA,sn=Xa.cB,an=Xa.cC,on=Xa.cD,hn=Xa.cE,ln=Xa.cF,un=Xa.cG,cn=Xa.cH,dn=Xa.cI,_n=Xa.cJ,fn=Xa.cK,pn=Xa.cL,gn=Xa.cM,mn=Xa.cN,vn=Xa.cO,yn=Xa.cP,Tn=Xa.cQ,Sn=Xa.cR,En=Xa.cS,An=Xa.cT,Cn=Xa.cU,Rn=Xa.cV,bn=Xa.cW,xn=Xa.cX,wn=Xa.cY,Mn=Xa.cZ,In=Xa.c_,Bn=Xa.c$,Pn=Xa.d0,Dn=Xa.d1,On=Xa.d2,Fn=Xa.d3,Ln=Xa.d4,Nn=Xa.d5,kn=Xa.d6,Un=Xa.d7,Gn=Xa.d8,Vn=Xa.d9,Hn=Xa.da,zn=Xa.db,Xn=Xa.dc,Wn=Xa.dd,Yn=Xa.de,jn=Xa.df,Kn=Xa.dg,qn=Xa.dh,Zn=Xa.di,Qn=Xa.dj,Jn=Xa.dk,$n=Xa.dl,tr=Xa.dm,er=Xa.dn,ir=Xa.dp,nr=Xa.dq,rr=Xa.dr,sr=Xa.ds,ar=Xa.dt,or=Xa.du,hr=Xa.dv,lr=Xa.dw,ur=Xa.dx,cr=Xa.dy,dr=Xa.dz,_r=Xa.dA,fr=Xa.dB,pr=Xa.dC,gr=Xa.dD,mr=Xa.dE,vr=Xa.dF,yr=Xa.dG,Tr=Xa.dH,Sr=Xa.dI,Er=Xa.dJ,Ar=Xa.dK,Cr=Xa.dL,Rr=Xa.dM,br=Xa.dN,xr=Xa.dO,wr=Xa.dP,Mr=Xa.dQ,Ir=Xa.dR,Br=Xa.dS,Pr=Xa.dT,Dr=Xa.dU,Or=Xa.dV,Fr=Xa.dW,Lr=Xa.dX,Nr=Xa.dY,kr=Xa.dZ,Ur=Xa.d_,Gr=Xa.d$,Vr=Xa.e0,Hr=Xa.e1,zr=Xa.e2,Xr=Xa.e3,Wr=Xa.e4,Yr=Xa.e5,jr=Xa.e6,Kr=Xa.e7,qr=Xa.e8,Zr=Xa.e9,Qr=Xa.ea,Jr=Xa.eb,$r=Xa.ec,ts=Xa.ed,es=Xa.ee,is=Xa.ef,ns=Xa.eg,rs=Xa.eh,ss=Xa.ei,as=Xa.ej,os=Xa.ek,hs=Xa.el,ls=Xa.em,us=Xa.en,cs=Xa.eo,ds=Xa.ep,_s=Xa.eq,fs=Xa.er,ps=Xa.es,gs=Xa.et,ms=Xa.eu,vs=Xa.ev,ys=Xa.ew,Ts=Xa.ex,Ss=Xa.ey,Es=Xa.ez,As=Xa.eA,Cs=Xa.eB,Rs=Xa.eC,bs=Xa.eD,xs=Xa.eE,ws=Xa.eF,Ms=Xa.eG,Is=Xa.eH,Bs=Xa.eI,Ps=Xa.eJ,Ds=Xa.eK,Os=Xa.eL,Fs=Xa.eM,Ls=Xa.eN,Ns=Xa.eO,ks=Xa.eP,Us=Xa.eQ,Gs=Xa.eR,Vs=Xa.eS,Hs=Xa.eT,zs=Xa.eU,Xs=Xa.eV,Ws=Xa.eW,Ys=Xa.eX,js=Xa.eY,Ks=Xa.eZ,qs=Xa.e_,Zs=Xa.e$,Qs=Xa.f0,Js=Xa.f1,$s=Xa.f2,ta=Xa.f3,ea=Xa.f4,ia=Xa.f5,na=Xa.f6,ra=Xa.f7,sa=Xa.f8,aa=Xa.f9,oa=Xa.fa,ha=Xa.fb,la=Xa.fc,ua=Xa.fd,ca=Xa.fe,da=Xa.ff,_a=Xa.fg,fa=Xa.fh,pa=Xa.fi,ga=Xa.fj,ma=Xa.fk,va=Xa.fl,ya=Xa.fm,Ta=Xa.fn,Sa=Xa.fo,Ea=Xa.fp,Aa=Xa.fq,Ca=Xa.fr,Ra=Xa.fs,ba=Xa.ft,xa=Xa.fu,wa=Xa.fv,Ma=Xa.fw,Ia=Xa.fx,Ba=Xa.fy,Pa=Xa.fz,Da=Xa.fA,Oa=Xa.fB,Fa=Xa.fC,La=Xa.fD,Na=Xa.fE,ka=Xa.fF,Ua=Xa.fG,Ga=Xa.fH,Va=Xa.fI,Ha=Xa.fJ,za=Xa.fK;var Wa={};Wa.Acceleration=Xa.hI,Wa.AffineTransform=Xa.fU,Wa.AmbientInfo=Xa.ha,Wa.Asset=Xa.cw,Wa.AssetLibrary=Xa.hB,Wa.AssetManager=Xa.hx,Wa.AsyncDelegate=Xa.gk,Wa.BITMASK_TAG=Xa.gE,Wa.BaseNode=Xa.dT,Wa.BitMask=Xa.g4,Wa.BloomStage=Xa.gY,Wa.BufferAsset=Xa.ho,Wa.CCBoolean=Xa.eb,Wa.CCClass=Xa.fd,Wa.CCFloat=Xa.ec,Wa.CCInteger=Xa.ea,Wa.CCLoader=Xa.hz,Wa.CCObject=Xa.dU,Wa.CCString=Xa.eg,Wa.CachedArray=Xa.C,Wa.CallbacksInvoker=Xa.gG,Wa.Color=Xa.bu,Wa.CompactValueTypeArray=Xa.gf,Wa.Component=Xa.d0,Wa.DEFAULT_OCTREE_DEPTH=Xa.hg,Wa.DEFAULT_WORLD_MAX_POS=Xa.hf,Wa.DEFAULT_WORLD_MIN_POS=Xa.he,Wa.DebugMode=Xa.gn,Wa.DebugView=Xa.h4,Wa.DeferredPipeline=Xa.gU,Wa.Details=Xa.hn,Wa.Director=Xa.cT,Wa.ENUM_TAG=Xa.gD,Wa.EPSILON=Xa.cZ,Wa.EasingMethod=Xa.eD,Wa.EditorExtendable=Xa.eo,Wa.EffectAsset=Xa.ht,Wa.Enum=Xa.dB,Wa.Event=Xa.fy,Wa.EventAcceleration=Xa.hD,Wa.EventGamepad=Xa.fH,Wa.EventHMD=Xa.hG,Wa.EventHandheld=Xa.hH,Wa.EventHandle=Xa.fI,Wa.EventHandler=Xa.fz,Wa.EventKeyboard=Xa.hE,Wa.EventMouse=Xa.hF,Wa.EventTarget=Xa.ee,Wa.EventTouch=Xa.fF,Wa.Eventify=Xa.dL,Wa.ExtrapolationMode=Xa.gp,Wa.FogInfo=Xa.hc,Wa.ForwardFlow=Xa.gS,Wa.ForwardPipeline=Xa.gR,Wa.ForwardStage=Xa.gT,Wa.GCObject=Xa.gC,Wa.Game=Xa.e9,Wa.GbufferStage=Xa.gW,Wa.HALF_PI=Xa.fY,Wa.ImageAsset=Xa.ci,Wa.Input=Xa.d_,Wa.InstancedBuffer=Xa.h0,Wa.JavaScript=Xa.hv,Wa.JsonAsset=Xa.hr,Wa.KeyCode=Xa.fB,Wa.Layers=Xa.dc,Wa.LightProbeInfo=Xa.hi,Wa.LightingStage=Xa.gX,Wa.MATH_FLOAT_ARRAY=Xa.g2,Wa.MainFlow=Xa.gV,Wa.Mat3=Xa.fb,Wa.Mat4=Xa.bs,Wa.Material=Xa.d1,Wa.MathBase=Xa.g3,Wa.MissingScript=Xa.hl,Wa.MobilityMode=Xa.ed,Wa.Node=Xa.dT,Wa.NodeActivator=Xa.h8,Wa.NodeEventType=Xa.cX,Wa.NodeSpace=Xa.h9,Wa.ObjectCurve=Xa.ex,Wa.OctreeInfo=Xa.hh,Wa.PipelineEventProcessor=Xa.h2,Wa.PipelineEventType=Xa.h3,Wa.PipelineSceneData=Xa.gQ,Wa.PipelineStateManager=Xa.h1,Wa.Pool=Xa.P,Wa.PostProcessStage=Xa.gZ,Wa.Prefab=Xa.dR,Wa.PrivateNode=Xa.hk,Wa.Quat=Xa.cv,Wa.QuatCurve=Xa.ew,Wa.QuatInterpolationMode=Xa.eG,Wa.RealCurve=Xa.et,Wa.RealInterpolationMode=Xa.eE,Wa.Rect=Xa.cG,Wa.RecyclePool=Xa.R,Wa.ReflectionProbeFlow=Xa.h5,Wa.ReflectionProbeStage=Xa.h6,Wa.RenderFlow=Xa.gO,Wa.RenderPipeline=Xa.gN,Wa.RenderStage=Xa.gP,Wa.RenderTexture=Xa.dx,Wa.RenderingSubMesh=Xa.cs,Wa.Root=Xa.fL,Wa.Scene=Xa.fK,Wa.SceneAsset=Xa.hp,Wa.SceneGlobals=Xa.hj,Wa.Scheduler=Xa.go,Wa.Script=Xa.hu,Wa.Settings=Xa.dI,Wa.ShadowFlow=Xa.g_,Wa.ShadowStage=Xa.g$,Wa.ShadowsInfo=Xa.hd,Wa.Size=Xa.cI,Wa.SkyboxInfo=Xa.hb,Wa.System=Xa.cd,Wa.SystemEvent=Xa.hL,Wa.SystemEventType=Xa.fG,Wa.TWO_PI=Xa.fZ,Wa.TangentWeightMode=Xa.eF,Wa.TextAsset=Xa.hq,Wa.Texture2D=Xa.bx,Wa.TextureCube=Xa.hs,Wa.Touch=Xa.hJ,Wa.TransformBit=Xa.dC,Wa.TypeScript=Xa.hw,Wa.VERSION=Xa.fx,Wa.ValueType=Xa.eC,Wa.Vec2=Xa.cH,Wa.Vec3=Xa.cq,Wa.Vec4=Xa.cJ,Wa.WorldNode3DToLocalNodeUI=Xa.gb,Wa.WorldNode3DToWorldNodeUI=Xa.gc,Wa.__checkObsoleteInNamespace__=Xa.ga,Wa.__checkObsolete__=Xa.g9,Wa._decorator=Xa.ge,Wa._resetDebugSetting=Xa.gH,Wa.absMax=Xa.fs,Wa.absMaxComponent=Xa.fv,Wa.approx=Xa.cY,Wa.assert=Xa.eQ,Wa.assertID=Xa.cV,Wa.assertIsNonNullable=Xa.cm,Wa.assertIsTrue=Xa.cg,Wa.assertsArrayIndex=Xa.a,Wa.assetManager=Xa.fq,Wa.bezier=Xa.gq,Wa.bezierByTime=Xa.ez,Wa.binarySearch=Xa.gI,Wa.binarySearchBy=Xa.gJ,Wa.binarySearchEpsilon=Xa.eA,Wa.bits=Xa.fO,Wa.builtinResMgr=Xa.d5,Wa.ccenum=Xa.d3,Wa.cclegacy=Xa.by,Wa.clamp=Xa.bt,Wa.clamp01=Xa.eI,Wa.color=Xa.fX,Wa.convertUtils=Xa.gd,Wa.createDefaultPipeline=Xa.gM,Wa.debug=Xa.d8,Wa.deprecateModuleExportedName=Xa.dA,Wa.deserialize=Xa.hm,Wa.deserializeTag=Xa.gh,Wa.director=Xa.cc,Wa.disallowAnimation=Xa.gA,Wa.displayName=Xa.gv,Wa.displayOrder=Xa.gw,Wa.easing=Xa.ey,Wa.editable=Xa.gs,Wa.editorExtrasTag=Xa.gg,Wa.enumerableProps=Xa.g1,Wa.equals=Xa.fp,Wa.error=Xa.eP,Wa.errorID=Xa.cE,Wa.find=Xa.cC,Wa.flattenCodeArray=Xa.gK,Wa.formerlySerializedAs=Xa.ef,Wa.game=Xa.e8,Wa.garbageCollectionManager=Xa.gB,Wa.geometry=Xa.fN,Wa.getError=Xa.cU,Wa.getPhaseID=Xa.h7,Wa.getSerializationMetadata=Xa.gj,Wa.input=Xa.e0,Wa.inverseLerp=Xa.g0,Wa.isCCClassOrFastDefined=Xa.f7,Wa.isCCObject=Xa.f5,Wa.isDisplayStats=Xa.gl,Wa.isValid=Xa.gF,Wa.js=Xa.g5,Wa.jsbUtils=Xa.gr,Wa.lerp=Xa.eB,Wa.loader=Xa.hA,Wa.log=Xa.eO,Wa.logID=Xa.dZ,Wa.macro=Xa.c8,Wa.markAsWarning=Xa.dM,Wa.mat4=Xa.fT,Wa.math=Xa.fM,Wa.misc=Xa.g6,Wa.murmurhash2_32_gc=Xa.cz,Wa.nextPow2=Xa.ck,Wa.override=Xa.cN,Wa.path=Xa.g7,Wa.pingPong=Xa.fm,Wa.pipeline=Xa.gL,Wa.preTransforms=Xa.fw,Wa.pseudoRandom=Xa.fl,Wa.pseudoRandomRange=Xa.f_,Wa.pseudoRandomRangeInt=Xa.f$,Wa.quat=Xa.fS,Wa.random=Xa.fh,Wa.randomRange=Xa.fi,Wa.randomRangeInt=Xa.fj,Wa.range=Xa.gx,Wa.rangeStep=Xa.gy,Wa.rect=Xa.fW,Wa.removeProperty=Xa.d9,Wa.repeat=Xa.fg,Wa.replaceProperty=Xa.db,Wa.resources=Xa.hy,Wa.screen=Xa.dK,Wa.serializable=Xa.cy,Wa.serializeTag=Xa.gi,Wa.setDefaultLogTimes=Xa.g8,Wa.setDisplayStats=Xa.gm,Wa.settings=Xa.dH,Wa.size=Xa.fV,Wa.slide=Xa.gz,Wa.sys=Xa.cA,Wa.systemEvent=Xa.hK,Wa.toDegree=Xa.fc,Wa.toRadian=Xa.dE,Wa.tooltip=Xa.gt,Wa.url=Xa.hC,Wa.v2=Xa.fP,Wa.v3=Xa.fQ,Wa.v4=Xa.fR,Wa.visible=Xa.gu,Wa.visibleRect=Xa.c$,Wa.warn=Xa.cj,Wa.warnID=Xa.ct,t(Wa)}],execute:function(){t({CacheMode:void 0,EAxisDirection:void 0,ERigidBodyType:void 0,HorizontalTextAlignment:void 0,InstanceMaterialType:void 0,Overflow:void 0,ReflectionProbeType:void 0,VerticalTextAlignment:void 0,applyMixins:function(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){"constructor"!==i&&Object.defineProperty(t.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i))}))}))},computeRatioByType:Hb,earcut:Zp,fragmentText:Eh,getBaselineOffset:function(){return 0},getEnglishWordPartAtFirst:Th,getEnglishWordPartAtLast:Sh,getPathFromRoot:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},getWorldTransformUntilRoot:AE,instantiate:rI,isEnglishWordPartAtFirst:function(t){return ph.test(t)},isEnglishWordPartAtLast:function(t){return fh.test(t)},isUnicodeCJK:gh,isUnicodeSpace:mh,safeMeasureText:vh,sampleAnimationCurve:Vb,shift:function(t,e,i){if(r(t,e),r(t,i),e===i)return t;var n=t[e];if(ethis._width&&(this._x=2,this._y=this._nexty),this._y+o+2>this._nexty&&(this._nexty=this._y+o+2),this._nexty>this._height)return null;We.internal.dynamicAtlasManager.textureBleeding&&((a<=8||o<=8)&&(this._texture.drawTextureAt(i.image,this._x-1,this._y-1),this._texture.drawTextureAt(i.image,this._x-1,this._y+1),this._texture.drawTextureAt(i.image,this._x+1,this._y-1),this._texture.drawTextureAt(i.image,this._x+1,this._y+1)),this._texture.drawTextureAt(i.image,this._x-1,this._y),this._texture.drawTextureAt(i.image,this._x+1,this._y),this._texture.drawTextureAt(i.image,this._x,this._y-1),this._texture.drawTextureAt(i.image,this._x,this._y+1)),this._texture.drawTextureAt(i.image,this._x,this._y),this._innerTextureInfos[i.getId()]={x:this._x,y:this._y,texture:i},this._count++,r+=this._x,s+=this._y,this._x+=a+2}var h={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),h},e.deleteInnerTexture=function(t){t&&this._innerTextureInfos[t.getId()]&&(delete this._innerTextureInfos[t.getId()],this._count--)},e.isEmpty=function(){return this._count<=0},e.reset=function(){this._x=2,this._y=2,this._nexty=2;for(var t=this._innerSpriteFrames,e=0,i=t.length;e=0;i--)e=this._atlases[i],Bi(e._innerSpriteFrames,t);var n=t._original._texture;this.deleteAtlasTexture(n)}},i.deleteAtlasTexture=function(t){if(t)for(var e=this._atlases.length-1;e>=0;e--)this._atlases[e].deleteInnerTexture(t),this._atlases[e].isEmpty()&&(this._atlases[e].destroy(),this._atlases.splice(e,1),this._atlasIndex--)},i.packToDynamicAtlas=function(t,e){if(this._enabled&&e&&!e._original&&e.packable&&e.texture&&e.texture.width>0&&e.texture.height>0){var i=this.insertSpriteFrame(e);i&&e._setDynamicAtlasFrame(i)}},Pi(e,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(t?(this.reset(),We.director.on(We.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)):(this.reset(),We.director.off(We.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)),this._enabled=t)}},{key:"maxAtlasCount",get:function(){return this._maxAtlasCount},set:function(t){this._maxAtlasCount=t}},{key:"atlasCount",get:function(){return this._atlases.length}},{key:"textureBleeding",get:function(){return this._textureBleeding},set:function(t){this._textureBleeding=t}},{key:"textureSize",get:function(){return this._textureSize},set:function(t){this._textureSize=t}},{key:"maxFrameSize",get:function(){return this._maxFrameSize},set:function(t){this._maxFrameSize=t}}]),e}(Oi);Za.instance=void 0;var Qa,Ja=t("dynamicAtlasManager",Za.instance=new Za);Di.registerSystem("dynamicAtlasManager",Ja,0),We.internal.dynamicAtlasManager=Ja,function(t){t[t.positions=ie.ATTR_POSITION]="positions",t[t.normals=ie.ATTR_NORMAL]="normals",t[t.uvs=ie.ATTR_TEX_COORD]="uvs",t[t.colors=ie.ATTR_COLOR]="colors"}(Qa||(Qa={}));var $a,to,eo,io,no,ro=function(){function t(){this._arrayBufferOrPaddings=[],this._length=0}var e=t.prototype;return e.setNextAlignment=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;this._arrayBufferOrPaddings.push(i),this._length+=i}}},e.addBuffer=function(t){var e=this._length;return this._arrayBufferOrPaddings.push(t),this._length+=t.byteLength,e},e.getLength=function(){return this._length},e.getCombined=function(){var t=new Uint8Array(this._length),e=0;return this._arrayBufferOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i),e),e+=i.byteLength)})),t.buffer},t}(),so=function(){function t(t,e){if(this._mesh=void 0,this._subMeshRenderings=[],this._mesh=t,this._mesh.struct.morph){var i=this._mesh.struct.primitives.length;this._subMeshRenderings=new Array(i).fill(null);for(var n=0;nki.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new oo(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new ao(this._mesh,n,this._mesh.struct.morph,e))}}}return t.prototype.createInstance=function(){for(var t=this,e=this._mesh.struct.primitives.length,i=new Array(e),n=0;n>1;return{width:1<<(1&i?n+1:n),height:1<=65536){Zi(10001,_,65536);continue}u>>=1,c>>=1}o=i.createBuffer(new ft(g.INDEX,y.DEVICE,c,u)),h=new(_o(l.stride))(e,l.offset,l.count),l.stride!==u&&(h=_o(u).from(h)),o.update(h)}var f=a.vertexBundelIndices.map((function(t){return n[t]})),p=[];if(a.vertexBundelIndices.length>0)for(var m=a.vertexBundelIndices[0],v=t._struct.vertexBundles[m].attributes,T=0;T=this._struct.primitives.length)Zi(14201);else{var i=[];if(e.positions.length>0&&i.push(e.positions),e.normals&&e.normals.length>0&&i.push(e.normals),e.uvs&&e.uvs.length>0&&i.push(e.uvs),e.tangents&&e.tangents.length>0&&i.push(e.tangents),e.colors&&e.colors.length>0&&i.push(e.colors),e.customAttributes)for(var n=0;n0&&(p.set(g),m.update(g,f)),c.view.count=_,h.vertexCount=_}if(a.indexView){var v=a.indexView,y=v.stride,T=2===y?e.indices16.length:e.indices32.length,S=T*y,E=new Uint8Array(this._data.buffer,v.offset,S),A=2===y?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,S):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,S),C=o.indexBuffer;Ni(T<=s.maxSubMeshIndices),S>0&&(E.set(A),C.update(A,S)),v.count=T,h.indexCount=T}if(e.minPos&&e.maxPos){var R=new ji(e.minPos.x,e.minPos.y,e.minPos.z),b=new ji(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new Qi),Qi.fromPoints(r.bounds[t],R,b);for(var x,w=new ji,M=new ji,I=Fi(r.bounds);!(x=I()).done;){var B=x.value;B&&(B.getBoundary(w,M),ji.min(R,w,R),ji.max(b,M,b))}this._struct.minPosition=new ji(R.x,R.y,R.z),this._struct.maxPosition=new ji(b.x,b.y,b.z)}o.invalidateGeometricInfo()}else Zi(14200)},i.destroy=function(){return this.destroyRenderingMesh(),t.prototype.destroy.call(this)},i.destroyRenderingMesh=function(){if(this._renderingSubMeshes){for(var t=0;t=n.length)){ji.transformMat4(po,fo,n[f]),i[f]=!0;var p=e[f];ji.min(p.center,p.center,po),ji.max(p.halfExtents,p.halfExtents,po)}}}}for(var g=0;g=this._struct.primitives.length)return null;var e=this._struct.primitives[t];if(!e.indexView)return null;var i=e.indexView.stride;return new(1===i?Uint8Array:2===i?Uint16Array:Uint32Array)(this._data.buffer,e.indexView.offset,e.indexView.count)},i.copyIndices=function(t,e){if(t>=this._struct.primitives.length)return!1;var i=this._struct.primitives[t];if(!i.indexView)return!1;for(var n=i.indexView.count,r=1===i.indexView.stride?_.R8UI:2===i.indexView.stride?_.R16UI:_.R32UI,s=So(new DataView(this._data.buffer),r),a=0;a=this._struct.primitives.length))for(var n,r=this._struct.primitives[t],s=Fi(r.vertexBundelIndices);!(n=s()).done;){var a=n.value,o=this._struct.vertexBundles[a],h=o.attributes.findIndex((function(t){return t.name===e}));if(!(h<0)){i(o,h);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new ft(g.VERTEX,y.DEVICE,i.view.length,i.view.stride)),r=new Uint8Array(e,i.view.offset,i.view.length);return n.update(r),n}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.reset({struct:{vertexBundles:[],primitives:[]},data:go})},i.releaseData=function(){this._data=go},Pi(e,[{key:"_nativeAsset",get:function(){return this._data.buffer},set:function(t){this._data=new Uint8Array(t)}},{key:"subMeshCount",get:function(){var t=this.renderingSubMeshes;return t?t.length:0}},{key:"minPosition",get:function(){return this.struct.minPosition}},{key:"maxPosition",get:function(){return this.struct.maxPosition}},{key:"struct",get:function(){return this._struct}},{key:"data",get:function(){return this._data}},{key:"hash",get:function(){return this._hash||(this._hash=nn(this._data,666)),this._hash}},{key:"jointBufferIndices",get:function(){return this._jointBufferIndices?this._jointBufferIndices:this._jointBufferIndices=this._struct.primitives.map((function(t){return t.jointMapIndex||0}))}},{key:"renderingSubMeshes",get:function(){return this.initialize(),this._renderingSubMeshes}},{key:"allowDataAccess",get:function(){return this._allowDataAccess},set:function(t){this._allowDataAccess=t,this._isMeshDataUploaded&&!this._allowDataAccess&&this.releaseData()}}]),e}($i),eo=tn(to.prototype,"_struct",[en],(function(){return{vertexBundles:[],primitives:[]}})),io=tn(to.prototype,"_hash",[en],(function(){return 0})),no=tn(to.prototype,"_allowDataAccess",[en],(function(){return!0})),$a=to))||$a);function vo(t,e){for(var i=0,n=0;n0){if(n=null,t.attributes)for(var l,u=Fi(t.attributes);!(l=u()).done;){var c=l.value;if(c.name===ie.ATTR_POSITION){n=c;break}}n||(n=Ao[0]),r.push(n);var d=ne[n.format];o=Math.max(o,Math.floor(h.length/d.count)),a.push({offset:s,data:h,attribute:n}),s+=d.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var f,p=Fi(t.attributes);!(f=p()).done;){var g=f.value;if(g.name===ie.ATTR_NORMAL){n=g;break}}n||(n=Ao[1]);var m=ne[n.format];r.push(n),o=Math.max(o,Math.floor(t.normals.length/m.count)),a.push({offset:s,data:t.normals,attribute:n}),s+=m.size}if(t.uvs&&t.uvs.length>0){if(n=null,t.attributes)for(var v,y=Fi(t.attributes);!(v=y()).done;){var T=v.value;if(T.name===ie.ATTR_TEX_COORD){n=T;break}}n||(n=Ao[2]);var S=ne[n.format];r.push(n),o=Math.max(o,Math.floor(t.uvs.length/S.count)),a.push({offset:s,data:t.uvs,attribute:n}),s+=S.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var E,A=Fi(t.attributes);!(E=A()).done;){var C=E.value;if(C.name===ie.ATTR_TANGENT){n=C;break}}n||(n=Ao[3]);var R=ne[n.format];r.push(n),o=Math.max(o,Math.floor(t.tangents.length/R.count)),a.push({offset:s,data:t.tangents,attribute:n}),s+=R.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var b,x=Fi(t.attributes);!(b=x()).done;){var w=b.value;if(w.name===ie.ATTR_COLOR){n=w;break}}n||(n=Ao[4]);var M=ne[n.format];r.push(n),o=Math.max(o,Math.floor(t.colors.length/M.count)),a.push({offset:s,data:t.colors,attribute:n}),s+=M.size}if(t.customAttributes)for(var I=0;I0){var i=t%e;if(0!==i)return e-i}return 0}var xo,wo,Mo,Io=function(){function t(){}return t.createMesh=function(t,e,i){return Ro(t,e,i)},t.createDynamicMesh=function(t,e,i,n){return function(t,e,i,n){n=n||{maxSubMeshes:1,maxSubMeshVertices:1024,maxSubMeshIndices:1024};var r=[],s=0;if(e.positions.length>0&&r.push(new Bt(ie.ATTR_POSITION,_.RGB32F,!1,s++,!1,0)),e.normals&&e.normals.length>0&&r.push(new Bt(ie.ATTR_NORMAL,_.RGB32F,!1,s++,!1,0)),e.uvs&&e.uvs.length>0&&r.push(new Bt(ie.ATTR_TEX_COORD,_.RG32F,!1,s++,!1,0)),e.tangents&&e.tangents.length>0&&r.push(new Bt(ie.ATTR_TANGENT,_.RGBA32F,!1,s++,!1,0)),e.colors&&e.colors.length>0&&r.push(new Bt(ie.ATTR_COLOR,_.RGBA32F,!1,s++,!1,0)),e.customAttributes)for(var a=0;a0?E=2:e.indices32&&e.indices32.length>0&&(E=4),E>0){c+=bo(c,E);var A=n.maxSubMeshIndices*E,C={offset:c,length:A,count:0,stride:E};p.indexView=C,c+=A}u.push(p)}var R={info:{maxSubMeshes:n.maxSubMeshes,maxSubMeshVertices:n.maxSubMeshVertices,maxSubMeshIndices:n.maxSubMeshIndices},bounds:[]};R.bounds.length=n.maxSubMeshes;var b={struct:{vertexBundles:l,primitives:u,dynamic:R},data:new Uint8Array(c)};return i||(i=new mo),i.reset(b),i.initialize(),i.updateSubMesh(t,e),i}(t,e,i,n)},t}(),Bo=Object.freeze({__proto__:null,find:an,toPPM:function(t,e,i){return"P3 "+e+" "+i+" 255\n"+t.filter((function(t,e){return e%4<3})).toString()+"\n"},readMesh:function(t,e){void 0===e&&(e=0);for(var i,n={positions:[]},r=new DataView(t.data.buffer,t.data.byteOffset,t.data.byteLength),s=t.struct,a=s.primitives[e],o=Fi(a.vertexBundelIndices);!(i=o()).done;)for(var h,l=i.value,u=s.vertexBundles[l],c=u.view.offset,d=u.view,f=d.length,p=d.stride,g=Fi(u.attributes);!(h=g()).done;){var m=h.value,v=Qa[m.name];v&&(n[v]=(n[v]||[]).concat(Li(r,m.format,c,f,p))),c+=ne[m.format].size}var y=a.indexView;return n.indices=Li(r,_["R"+8*y.stride+"UI"],y.offset,y.length),n},createMesh:Ro,MeshUtils:Io,readBuffer:Li,writeBuffer:sn,mapBuffer:on});t("utils",Bo);var Po,Do=new ji,Oo=new Ue;!function(t){t[t.RECT=0]="RECT",t[t.POLYGON=1]="POLYGON"}(Po||(Po={}));var Fo,Lo,No,ko=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],Uo=t("SpriteFrame",Ki("cc.SpriteFrame")((Mo=wo=function(t){function e(){var e;return(e=t.call(this)||this).vertices=null,e.uv=[],e.unbiasUV=[],e.uvSliced=[],e._rect=new un,e._trimmedBorder=new _n,e._offset=new cn,e._originalSize=new dn,e._rotated=!1,e._capInsets=[0,0,0,0],e._atlasUuid="",e._texture=void 0,e._isFlipUVY=!1,e._isFlipUVX=!1,e._original=null,e._packable=!0,e._pixelsToUnit=100,e._pivot=new cn(.5,.5),e._meshType=Po.RECT,e._extrude=0,e._customOutLine=[],e._minPos=new ji,e._maxPos=new ji,e}He(e,t),e.createWithImage=function(t){var i=t instanceof Ui?t:new Ui(t),n=new Xe;n.image=i;var r=new e;return r.texture=n,r};var i=e.prototype;return i.textureLoaded=function(){return!!this.texture},i.isRotated=function(){return this._rotated},i.setRotated=function(t){this.rotated=t},i.getRect=function(t){return t?(t.set(this._rect),t):this._rect.clone()},i.setRect=function(t){this.rect=t},i.getOriginalSize=function(t){return t?(t.set(this._originalSize),t):this._originalSize.clone()},i.setOriginalSize=function(t){this.originalSize=t},i.getOffset=function(t){return t?(t.set(this._offset),t):this._offset.clone()},i.setOffset=function(t){this.offset=t},i.getGFXTexture=function(){return this._texture.getGFXTexture()},i.getGFXSampler=function(){return this._texture.getGFXSampler()},i.getHash=function(){return this._texture.getHash()},i.getSamplerInfo=function(){return this._texture.getSamplerInfo()},i.reset=function(t,e){void 0===e&&(e=!1);var i=!1;e&&(this._originalSize.set(0,0),this._rect.set(0,0,0,0),this._offset.set(0,0),this._capInsets=[0,0,0,0],this._rotated=!1,i=!0),t&&(t.texture&&(this._rect.x=this._rect.y=0,this._rect.width=t.texture.width,this._rect.height=t.texture.height,this._refreshTexture(t.texture),this.checkRect(this._texture)),t.originalSize&&this._originalSize.set(t.originalSize),t.rect&&this._rect.set(t.rect),t.offset&&this._offset.set(t.offset),void 0!==t.borderTop&&(this._capInsets[1]=t.borderTop),void 0!==t.borderBottom&&(this._capInsets[3]=t.borderBottom),void 0!==t.borderLeft&&(this._capInsets[0]=t.borderLeft),void 0!==t.borderRight&&(this._capInsets[2]=t.borderRight),void 0!==t.isRotate&&(this._rotated=!!t.isRotate),void 0!==t.isFlipUv&&(this._isFlipUVY=!!t.isFlipUv),i=!0),i&&this.texture&&this._calculateUV(),this._calcTrimmedBorder()},i.checkRect=function(t){var e=this._rect,i=e.x,n=e.y;return this._rotated?(i+=e.height,n+=e.width):(i+=e.width,n+=e.height),i>t.width?(hn(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(hn(3301,this.name+"/"+t.name,n,t.height),1))},i._calcTrimmedBorder=function(){var t=this._originalSize.width,e=this._originalSize.height,i=.5*(t-this._rect.width),n=.5*(e-this._rect.height);this._trimmedBorder.x=this._offset.x+i,this._trimmedBorder.y=this._offset.x-i,this._trimmedBorder.z=this._offset.y+n,this._trimmedBorder.w=this._offset.y-n},i.ensureMeshData=function(){this._mesh||(this._initVertices(),this._createMesh())},i.destroy=function(){return this._packable&&Ja&&Ja.deleteAtlasSpriteFrame(this),t.prototype.destroy.call(this)},i._calculateSlicedUV=function(){var t=this._rect,i=this.texture,n=i.width,r=i.height,s=this._capInsets[0],a=this._capInsets[2],o=t.width-s-a,h=this._capInsets[1],l=this._capInsets[3],u=t.height-h-l,c=this.uvSliced;if(c.length=0,this._rotated){ko[0].u=t.x/n,ko[1].u=(t.x+l)/n,ko[2].u=(t.x+l+u)/n,ko[3].u=(t.x+t.height)/n,ko[3].v=t.y/r,ko[2].v=(t.y+s)/r,ko[1].v=(t.y+s+o)/r,ko[0].v=(t.y+t.width)/r;for(var d=0;d<4;++d)for(var _=ko[d],f=0;f<4;++f){var p=ko[3-f];c.push({u:_.u,v:p.v})}}else{ko[0].u=t.x/n,ko[1].u=(t.x+s)/n,ko[2].u=(t.x+s+o)/n,ko[3].u=(t.x+t.width)/n,ko[3].v=t.y/r,ko[2].v=(t.y+h)/r,ko[1].v=(t.y+h+u)/r,ko[0].v=(t.y+t.height)/r;for(var g=0;g<4;++g)for(var m=ko[g],v=0;v<4;++v){var y=ko[v];c.push({u:y.u,v:m.v})}}this.emit(e.EVENT_UV_UPDATED,this)},i._calculateUV=function(){var t=this._rect,e=this.uv,i=this.unbiasUV,n=this.texture,r=n.width,s=n.height;if(this._rotated){var a=0===r?0:t.x/r,o=0===r?1:(t.x+t.height)/r,h=0===s?0:t.y/s,l=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=o,e[1]=l,e[2]=o,e[3]=h,e[4]=a,e[5]=l,e[6]=a,e[7]=h):this._isFlipUVX?(e[0]=o,e[1]=h,e[2]=o,e[3]=l,e[4]=a,e[5]=h,e[6]=a,e[7]=l):this._isFlipUVY?(e[0]=a,e[1]=l,e[2]=a,e[3]=h,e[4]=o,e[5]=l,e[6]=o,e[7]=h):(e[0]=a,e[1]=h,e[2]=a,e[3]=l,e[4]=o,e[5]=h,e[6]=o,e[7]=l);var u=0===r?0:t.x/r,c=0===r?1:(t.x+t.height)/r,d=0===s?0:t.y/s,_=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=c,i[1]=_,i[2]=c,i[3]=d,i[4]=u,i[5]=_,i[6]=u,i[7]=d):this._isFlipUVX?(i[0]=c,i[1]=d,i[2]=c,i[3]=_,i[4]=u,i[5]=d,i[6]=u,i[7]=_):this._isFlipUVY?(i[0]=u,i[1]=_,i[2]=u,i[3]=d,i[4]=c,i[5]=_,i[6]=c,i[7]=d):(i[0]=u,i[1]=d,i[2]=u,i[3]=_,i[4]=c,i[5]=d,i[6]=c,i[7]=_)}else{var f=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,g=0===s?1:(t.y+t.height)/s,m=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=m,e[2]=f,e[3]=m,e[4]=p,e[5]=g,e[6]=f,e[7]=g):this._isFlipUVX?(e[0]=p,e[1]=g,e[2]=f,e[3]=g,e[4]=p,e[5]=m,e[6]=f,e[7]=m):this._isFlipUVY?(e[0]=f,e[1]=m,e[2]=p,e[3]=m,e[4]=f,e[5]=g,e[6]=p,e[7]=g):(e[0]=f,e[1]=g,e[2]=p,e[3]=g,e[4]=f,e[5]=m,e[6]=p,e[7]=m);var v=0===r?0:t.x/r,y=0===r?1:(t.x+t.width)/r,T=0===s?1:(t.y+t.height)/s,S=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=y,i[1]=S,i[2]=v,i[3]=S,i[4]=y,i[5]=T,i[6]=v,i[7]=T):this._isFlipUVX?(i[0]=y,i[1]=T,i[2]=v,i[3]=T,i[4]=y,i[5]=S,i[6]=v,i[7]=S):this._isFlipUVY?(i[0]=v,i[1]=S,i[2]=y,i[3]=S,i[4]=v,i[5]=T,i[6]=y,i[7]=T):(i[0]=v,i[1]=T,i[2]=y,i[3]=T,i[4]=v,i[5]=S,i[6]=y,i[7]=S)}this._calculateSlicedUV()},i._setDynamicAtlasFrame=function(t){t&&(this._original={_texture:this._texture,_x:this._rect.x,_y:this._rect.y},this._texture=t.texture,this._rect.x=t.x,this._rect.y=t.y,this._calculateUV())},i._resetDynamicAtlasFrame=function(){this._original&&(this._rect.x=this._original._x,this._rect.y=this._original._y,this._texture=this._original._texture,this._original=null,this._calculateUV())},i._checkPackable=function(){var t=Ja;if(t){var e=this._texture;if(e instanceof Xe&&!e.isCompressed){var i=this.width,n=this.height;if(!e.image||i>t.maxFrameSize||n>t.maxFrameSize)this._packable=!1;else{var r=ln.HTMLCanvasElement;e.image&&e.image instanceof r&&(this._packable=!0)}}else this._packable=!1}},i._serialize=function(){return null},i._deserialize=function(t){var e=t,i=e.rect;i&&(this._rect=new un(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=new cn(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=new dn(r.width,r.height)),this._rotated=!!e.rotated,this._name=e.name,this._packable=!!e.packable,this._pixelsToUnit=e.pixelsToUnit;var s=e.pivot;s&&(this._pivot=new cn(s.x,s.y)),this._meshType=e.meshType;var a=e.capInsets;a&&(this._capInsets[0]=a[0],this._capInsets[1]=a[1],this._capInsets[2]=a[2],this._capInsets[3]=a[3]);var o=e.vertices;if(o){this.vertices||(this.vertices={rawPosition:[],positions:[],indexes:o.indexes,uv:o.uv,nuv:o.nuv,minPos:new ji(o.minPos.x,o.minPos.y,o.minPos.z),maxPos:new ji(o.maxPos.x,o.maxPos.y,o.maxPos.z)}),this.vertices.rawPosition.length=0;for(var h=o.rawPosition,l=0;l0){var e=this.spriteFrames[t[0]];return e&&e.texture}return null},i.getSpriteFrame=function(t){var e=this.spriteFrames[t];return e?(e.name||(e.name=t),e):null},i.getSpriteFrames=function(){for(var t=[],e=this.spriteFrames,i=0,n=Object.keys(e);i=this.limit){var n=this.tail;delete this.datas[n.key],this.count--,this.tail=n.prev,this.tail.next=null,n.prev=null,n.next=null,hh.put(n)}this.moveToHead(i)},e.remove=function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.datas[t.key],this.count--},e.get=function(t){var e=this.datas[t];return e?(this.remove(e),this.moveToHead(e),e.value):null},e.clear=function(){this.count=0,this.datas={},this.head=null,this.tail=null},e.has=function(t){return!!this.datas[t]},e.delete=function(t){var e=this.datas[t];this.remove(e)},t}())(100),ch=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,dh=/^[!,.:;'}\]%\?>、‘“》?。,!]/,_h=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,fh=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,ph=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function gh(t){return/^[\u4E00-\u9FFF\u3400-\u4DFF]+$/.test(t)||/[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g.test(t)||/^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/.test(t)}function mh(t){var e=t.charCodeAt(0);return e>=9&&e<=13||32===e||133===e||160===e||5760===e||e>=8192&&e<=8202||8232===e||8233===e||8239===e||8287===e||12288===e}function vh(t,e,i){var n=(i||t.font)+"🎮"+e,r=uh.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return uh.put(n,a),a}function yh(t,e,i){var n=e,r=i,s=t[e];if(s>="\udc00"&&s<="\udfff"&&n--,void 0!==i)if(i-1!==e){var a=t[i-1];a>="\ud800"&&a<="\udbff"&&r--}else s>="\ud800"&&s<="\udbff"&&r++;return t.substring(n,r)}function Th(t){return ph.exec(t)}function Sh(t){return fh.exec(t)}function Eh(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var a=s.length*(i/e)|0,o=yh(s,a),h=e-n(o),l=o,u=0,c=0;h>i&&c++<100;)a*=i/h,h=e-n(o=yh(s,a|=0));for(c=0;o&&h<=i&&c++<100;){var d=ch.exec(o);l=o,h=e-n(o=yh(s,a+=u=d?d[0].length:1))}0==(a-=u)?(a=1,l=yh(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,l=yh(s,2));var _=yh(s,0,a),f=void 0;dh.test(l||o)&&(0==(a-=(f=_h.exec(_))?f[0].length:0)&&(a=1),l=yh(s,a),_=yh(s,0,a)),ph.test(l)&&(f=fh.exec(_))&&_!==f[0]&&(l=yh(s,a-=f[0].length),_=yh(s,0,a)),(0===r.length||(_=_.trim()).length>0)&&r.push(_),e=n(s=l||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var Ah,Ch=t("CanvasPool",function(){function t(){this.pool=[]}t.getInstance=function(){return lh||(lh=new t),lh};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=ln.document.createElement("canvas"),i=e.getContext("2d");t={canvas:e,context:i}}return t},e.put=function(t){this.pool.length>=Mi.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}()),Rh=Ve.WHITE.clone(),bh=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.texture=null,this.offsetX=0,this.offsetY=0,this.valid=!1,this.xAdvance=0},xh="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",wh=function(){function t(t,e){this.image=null,this.labelInfo=void 0,this.char=void 0,this.data=null,this.canvas=null,this.context=null,this.width=0,this.height=0,this.offsetY=0,this.hash=void 0,this.char=t,this.labelInfo=e,this.hash=""+t.charCodeAt(0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,Ch.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=Ch.getInstance().get(),this.canvas=this.data.canvas,this.context=this.data.context,this.context){this.context.font=this.labelInfo.fontDesc;var t=vh(this.context,this.char,this.labelInfo.fontDesc),e=2*this.labelInfo.margin+2;this.width=parseFloat(t.toFixed(2))+e,this.height=(1+ah)*this.labelInfo.fontSize+e,this.offsetY=-this.labelInfo.fontSize*ah/2}this.canvas.width!==this.width&&(this.canvas.width=this.width),this.canvas.height!==this.height&&(this.canvas.height=this.height),this.image||(this.image=new Ui),this.image.reset(this.canvas)},e._updateTexture=function(){if(this.context&&this.canvas){var t=this.context,e=this.labelInfo,i=this.canvas.width,n=this.canvas.height;t.textAlign="center",t.textBaseline="alphabetic",t.clearRect(0,0,i,n),t.fillStyle=xh,t.fillRect(0,0,i,n),t.font=e.fontDesc;var r=e.fontSize,s=i/2,a=n/2+r*oh+0*r,o=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+o.r+", "+o.g+", "+o.b+", 1)",e.isOutlined){var h=e.out||Rh;t.strokeStyle="rgba("+h.r+", "+h.g+", "+h.b+", "+h.a/255+")",t.lineWidth=2*e.margin,t.strokeText(this.char,s,a)}t.fillText(this.char,s,a)}},t}(),Mh=function(t){function e(){return t.apply(this,arguments)||this}He(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=ze.RGBA8888),this.reset({width:t,height:e,format:i})},i.drawTextureAt=function(t,e,i){var n=this.getGFXTexture();if(t&&n){var r=this._getGFXDevice();if(r){var s=new ht;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else console.warn("Unable to get device")}},e}(Xe),Ih=function(){function t(t,e){this._x=0,this._y=0,this._nextY=0,this._width=0,this._height=0,this._halfBleed=0,this._dirty=!1;var i=new Mh;i.initWithSize(t,e),this.fontDefDictionary=new nh(i),this._halfBleed=1,this._width=t,this._height=e,Di.on(An.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=Di.root.device;if(!e||!this.fontDefDictionary||!i)return null;var n=e.width,r=e.height;if(this._x+n+0>this._width&&(this._x=0,this._y=this._nextY),this._y+r>this._nextY&&(this._nextY=this._y+r+0),this._nextY>this._height)return Zi(12100),null;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new bh;return s.u=this._x+this._halfBleed,s.v=this._y+this._halfBleed,s.texture=this.fontDefDictionary.texture,s.valid=!0,s.w=t.width-2,s.h=t.height-2,s.xAdvance=s.w,s.offsetY=t.offsetY,this._x+=n+0,this.fontDefDictionary.addLetterDefinitions(t.hash,s),s},e.update=function(){this._dirty&&(this._dirty=!1)},e.reset=function(){this._x=0,this._y=0,this._nextY=0,this.fontDefDictionary.clear()},e.destroy=function(){this.reset(),this.fontDefDictionary&&(this.fontDefDictionary.texture.destroy(),this.fontDefDictionary.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new Mh;t.initWithSize(this._width,this._height),this.fontDefDictionary.texture=t},e.getLetter=function(t){return this.fontDefDictionary.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t,e){var i=t.charCodeAt(0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new wh(t,e);r.updateRenderData(),n=this.insertLetterTexture(r),r.destroy()}return n},Pi(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(),Bh={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:Ve.WHITE.clone(),isOutlined:!1,out:Ve.WHITE.clone(),margin:0},Ph=[new Bt(ie.ATTR_POSITION,_.RGB32F)],Dh=[new Bt(ie.ATTR_POSITION,_.RGB32F),new Bt(ie.ATTR_COLOR,_.RGBA32F)],Oh=[new Bt(ie.ATTR_POSITION,_.RGB32F),new Bt(ie.ATTR_TEX_COORD,_.RG32F),new Bt(ie.ATTR_COLOR,_.RGBA32F)],Fh=[new Bt(ie.ATTR_POSITION,_.RGB32F),new Bt(ie.ATTR_TEX_COORD,_.RG32F),new Bt(ie.ATTR_COLOR,_.RGBA8,!0)],Lh=[new Bt(ie.ATTR_POSITION,_.RGB32F),new Bt(ie.ATTR_TEX_COORD,_.RG32F),new Bt(ie.ATTR_COLOR,_.RGBA32F),new Bt(ie.ATTR_COLOR2,_.RGBA32F)],Nh=[new Bt(ie.ATTR_POSITION,_.RGB32F),new Bt(ie.ATTR_TEX_COORD,_.RG32F),new Bt(ie.ATTR_COLOR,_.RGBA8,!0),new Bt(ie.ATTR_COLOR2,_.RGBA8,!0)];function kh(t){for(var e=0,i=0;i>2,Ni(this._initVDataCount/this._floatsPerVertex<65536,Cn(9005)),this.vData&&this.iData||(this.vData=new Float32Array(this._initVDataCount),this.iData=new Uint16Array(this._initIDataCount)),this._iaPool.push(this.createNewIA(t))},t.reset=function(){this._nextFreeIAHandle=0,this.dirty=!1},t.destroy=function(){this.reset(),this._attributes=null,this._iaInfo=null,this.vData=null,this.iData=null;for(var t=0;tthis._initVDataCount||n>this._initIDataCount)},t.uploadBuffers=function(){if(0!==this.byteOffset&&this._dirty){for(var t=rn.__isWebIOS14OrIPadOS14Env?this._nextFreeIAHandle:1,e=this.byteOffset,i=this.indexOffset,n=0;n>2),a=new Uint16Array(this.iData.buffer,0,i),o=r.vertexBuffers[0];e>o.size&&o.resize(e),o.update(s),2*i>r.indexBuffer.size&&r.indexBuffer.resize(2*i),r.indexBuffer.update(a)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(rn.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,a=t.createBuffer(new ft(g.VERTEX|g.TRANSFER_DST,y.HOST|y.DEVICE,r,r));n=t.createBuffer(new ft(g.INDEX|g.TRANSFER_DST,y.HOST|y.DEVICE,s,s)),i=[a],this._iaInfo=new Dt(this._attributes,i,n),e=t.createInputAssembler(this._iaInfo)}else e=t.createInputAssembler(this._iaInfo),i=this._iaInfo.vertexBuffers,n=this._iaInfo.indexBuffer;return{ia:e,vertexBuffers:i,indexBuffer:n}},Pi(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"byteOffset",get:function(){return this._byteOffset},set:function(t){this._byteOffset=t}},{key:"vertexOffset",get:function(){return this._vertexOffset},set:function(t){this._vertexOffset=t}},{key:"indexOffset",get:function(){return this._indexOffset},set:function(t){this._indexOffset=t}},{key:"dirty",get:function(){return this._dirty},set:function(t){this._dirty=t}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex},set:function(t){this._floatsPerVertex=t}},{key:"vData",get:function(){return this._vData},set:function(t){this._vData=t}},{key:"iData",get:function(){return this._iData},set:function(t){this._iData=t}},{key:"nativeObj",get:function(){return this._nativeObj}},{key:"sharedBuffer",get:function(){return this._sharedBuffer}}]),e}()),Wh=function(){function t(t,e){this._device=null,this._attributes=null,this._vertexFormatBytes=void 0,this._floatsPerVertex=void 0,this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=Uh(e)>>2,this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT}var e=t.prototype;return e.initialize=function(){},e.reset=function(){},e.request=function(){},e.appendBuffers=function(){},e.uploadBuffers=function(){},e.destroy=function(){this._attributes.length=0},Pi(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex}}]),t}(),Yh=new e((function(){return{offset:0,length:0}}),32),jh=function(){function t(t,e,i,n,r,s){this._ib=void 0,this.vertexAccessor=t,this.bufferId=e,this.meshBuffer=i,this.vertexOffset=n,this.vb=r,this.indexCount=s,this._ib=new Uint16Array(s),Ni(i===t.getMeshBuffer(e))}return t.prototype.setIndexBuffer=function(){},Pi(t,[{key:"ib",get:function(){return this._ib}}]),t}(),Kh=function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this)._freeLists=[],a._vCount=0,a._iCount=0,a._id=0,a._vCount=r||Math.floor(1024*Mi.BATCHER2D_MEM_INCREMENT/a._vertexFormatBytes),a._iCount=s||a._vCount*e.IB_SCALE,a._id=e.generateID(),a._allocateBuffer(),a}He(e,t);var i=e.prototype;return i.destroy=function(){for(var e=0;e=n){o=i[l],s=h,a=l;break}if(o)break}if(o||(s=this._allocateBuffer(),(r=this._buffers[s])&&r.checkCapacity(t,e)&&(a=0,o=this._freeLists[s][a])),o){var u=o.offset/this.vertexFormatBytes,c=new Float32Array(r.vData.buffer,o.offset,n>>2).fill(0);return this._allocateChunkFromEntry(s,a,o,n),new jh(this,s,r,u,c,e)}return hn(9004,n),null},i.recycleChunk=function(t){var e=this._freeLists[t.bufferId],i=this._buffers[t.bufferId],n=t.vertexOffset*this.vertexFormatBytes,r=t.vb.byteLength;if(0!==r){for(var s=!1,a=0,o=null,h=e[a];h&&h.offset=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),Yh.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){Rn(this._buffers.length===this._freeLists.length,9003);var t=new Xh,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=Yh.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),Di.root.batcher2D.syncMeshBuffersToNative(this.id,this._buffers),this._buffers.length-1},e.generateID=function(){return e.ID_COUNT++},Pi(e,[{key:"id",get:function(){return this._id}}]),e}(Wh);Kh.IB_SCALE=4,Kh.ID_COUNT=0,function(t){t[t.DrawInfoType=0]="DrawInfoType",t[t.VertDirty=1]="VertDirty",t[t.IsMeshBuffer=2]="IsMeshBuffer",t[t.Stride=3]="Stride",t[t.Count=4]="Count"}(Gh||(Gh={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(Vh||(Vh={})),function(t){t[t.VertexOffset=0]="VertexOffset",t[t.IndexOffset=1]="IndexOffset",t[t.VBCount=2]="VBCount",t[t.IBCount=3]="IBCount",t[t.DataHash=4]="DataHash",t[t.Count=5]="Count"}(Hh||(Hh={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(zh||(zh={}));var qh,Zh,Qh=function(){function t(t){this._accId=-1,this._bufferId=-1,this._vertexOffset=0,this._indexOffset=0,this._vb=null,this._ib=null,this._vData=null,this._iData=null,this._vertDirty=!1,this._vbCount=0,this._ibCount=0,this._dataHash=0,this._isMeshBuffer=!1,this._material=null,this._texture=null,this._sampler=null,this._stride=0,this._useLocal=!1,this._model=null,this._drawInfoType=zh.COMP,this._subNode=null,this._uint8SharedBuffer=void 0,this._uint16SharedBuffer=void 0,this._uint32SharedBuffer=void 0,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,Gh.Count),i+=Gh.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,Vh.Count),i+=Vh.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,Hh.Count)}var e=t.prototype;return e.init=function(){},e.clear=function(){this._bufferId=0,this._vertexOffset=0,this._indexOffset=0,this._vertDirty=!1},e.setAccId=function(t){this._accId=t},e.setBufferId=function(t){this._bufferId=t},e.setAccAndBuffer=function(t,e){this._bufferId=e,this._accId=t},e.setVertexOffset=function(t){this._vertexOffset=t},e.setIndexOffset=function(t){this._indexOffset=t},e.setVB=function(){},e.setIB=function(){},e.setVData=function(){},e.setIData=function(){},e.setVBCount=function(t){this._vbCount=t},e.setIBCount=function(){},e.setVertDirty=function(t){this._vertDirty=t},e.setDataHash=function(t){this._dataHash=t},e.setIsMeshBuffer=function(t){this._isMeshBuffer=t},e.setMaterial=function(t){this._material=t},e.setTexture=function(t){this._texture=t},e.setSampler=function(t){this._sampler=t},e.setModel=function(){},e.setDrawInfoType=function(t){this._drawInfoType=t},e.setSubNode=function(t){this._subNode=t},e.setStride=function(t){this._stride=t},e.initRender2dBuffer=function(){},e.fillRender2dBuffer=function(){},Pi(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"render2dBuffer",get:function(){return this._render2dBuffer}}]),t}();!function(t){t[t.DISABLED=0]="DISABLED",t[t.CLEAR=1]="CLEAR",t[t.ENTER_LEVEL=2]="ENTER_LEVEL",t[t.ENABLED=3]="ENABLED",t[t.EXIT_LEVEL=4]="EXIT_LEVEL",t[t.CLEAR_INVERTED=5]="CLEAR_INVERTED",t[t.ENTER_LEVEL_INVERTED=6]="ENTER_LEVEL_INVERTED"}(qh||(qh={})),function(t){t[t.stencilTest=0]="stencilTest",t[t.func=1]="func",t[t.stencilMask=2]="stencilMask",t[t.writeMask=3]="writeMask",t[t.failOp=4]="failOp",t[t.zFailOp=5]="zFailOp",t[t.passOp=6]="passOp",t[t.ref=7]="ref",t[t.count=8]="count"}(Zh||(Zh={}));var Jh,$h,tl,el,il,nl=t("StencilManager",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:w.ALWAYS,stencilMask:65535,writeMask:65535,failOp:M.KEEP,zFailOp:M.KEEP,passOp:M.KEEP,ref:1},this._stage=qh.DISABLED,this.stencilStateMap=new Map,this.stencilStateMapWithDepth=new Map}var e=t.prototype;return e.pushMask=function(t){this._maskStack.push(t)},e.clear=function(t){return t.stencilStage!==qh.ENTER_LEVEL?qh.CLEAR_INVERTED:qh.CLEAR},e.enableMask=function(){this.stage=qh.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=qh.DISABLED:this.stage=qh.ENABLED)},e.getWriteMask=function(){return 1<>2,yl=new e((function(){return{x:0,y:0,z:0,u:0,v:0,color:Ve.WHITE.clone()}}),128),Tl=t("BaseRenderData",function(){function t(t){void 0===t&&(t=Oh),this.chunk=null,this._renderDrawInfo=null,this._material=null,this._dataHash=0,this._isMeshBuffer=!1,this._vc=0,this._ic=0,this._floatStride=0,this._vertexFormat=Oh,this._drawInfoType=zh.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===Oh?vl:Uh(t)>>2,this._vertexFormat=t}var e=t.prototype;return e.isValid=function(){return this._ic>0&&this.chunk.vertexAccessor},e.initRenderDrawInfo=function(t,e){void 0===e&&(e=zh.COMP)},e.removeRenderDrawInfo=function(){},e.setRenderDrawInfoAttributes=function(){},Pi(t,[{key:"vertexCount",get:function(){return this._vc}},{key:"indexCount",get:function(){return this._ic}},{key:"stride",get:function(){return this._floatStride<<2}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vertexFormat",get:function(){return this._vertexFormat}},{key:"drawInfoType",get:function(){return this._drawInfoType},set:function(t){this._drawInfoType=t,this._renderDrawInfo&&this._renderDrawInfo.setDrawInfoType(t)}},{key:"renderDrawInfo",get:function(){return this._renderDrawInfo}},{key:"material",get:function(){return this._material},set:function(t){this._material=t,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(t)}},{key:"dataHash",get:function(){return this._dataHash},set:function(t){this._dataHash=t,this._renderDrawInfo&&this._renderDrawInfo.setDataHash(t)}},{key:"multiOwner",get:function(){return this._multiOwner},set:function(t){this._multiOwner=t}},{key:"batcher",get:function(){return this._batcher||(this._batcher=Di.root.batcher2D),this._batcher}}]),t}()),Sl=t("RenderData",function(t){function e(e,i){var n;return void 0===e&&(e=Oh),(n=t.call(this,e)||this)._vertDirty=!0,n._textureHash=0,n.indices=null,n.layer=0,n.nodeDirty=!0,n.passDirty=!0,n.textureDirty=!0,n.hashDirty=!0,n._data=[],n._pivotX=0,n._pivotY=0,n._width=0,n._height=0,n._frame=null,n._accessor=null,n.vertexRow=1,n.vertexCol=1,i||(i=n.batcher.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n}He(e,t),e.add=function(t,i){void 0===t&&(t=Oh);var n=new e(t,i);return i||(i=Di.root.batcher2D.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n},e.remove=function(t){t.clear(),t._accessor=null};var i=e.prototype;return i.resize=function(t,e){t===this._vc&&e===this._ic&&this.chunk||(this._vc=t,this._ic=e,this.chunk&&(this._accessor.recycleChunk(this.chunk),this.chunk=null),this.chunk=this._accessor.allocateChunk(t,e),this.updateHash())},i.setRenderDrawInfoAttributes=function(){},i.fillDrawInfoAttributes=function(){},i.syncRender2dBuffer=function(){},i.resizeAndCopy=function(t,e){if(t!==this._vc||e!==this._ic||!this.chunk){this._vc=t,this._ic=e;var i=this.chunk;this.chunk=this._accessor.allocateChunk(t,e),i&&(this.chunk.vb.set(i.vb),this._accessor.recycleChunk(i)),this.updateHash()}},i.getMeshBuffer=function(){return this.chunk&&this._accessor?this._accessor.getMeshBuffer(this.chunk.bufferId):null},i.updateNode=function(t){this.layer=t.node.layer,this.nodeDirty=!1,this.hashDirty=!0},i.updatePass=function(t){this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0},i.updateTexture=function(t){this.frame=t,this.textureHash=t.getHash(),this.textureDirty=!1,this.hashDirty=!0},i.updateHash=function(){var t=""+(this.chunk?this.chunk.bufferId:-1)+this.layer+" "+this.textureHash;this.dataHash=nn(t,666),this.hashDirty=!1},i.updateRenderData=function(t,e){if(this.passDirty&&(this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(this.material)),this.nodeDirty){var i=t.node.scene?t._getRenderScene():null;this.layer=t.node.layer,null!==i&&(this.nodeDirty=!1),this.hashDirty=!0}this.textureDirty&&(this.frame=e,this.textureHash=e.getHash(),this.textureDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&(this._renderDrawInfo.setTexture(this.frame?this.frame.getGFXTexture():null),this._renderDrawInfo.setSampler(this.frame?this.frame.getGFXSampler():null))),this.hashDirty&&(this.updateHash(),this._renderDrawInfo&&this._renderDrawInfo.setDataHash(this.dataHash))},i.updateSizeNPivot=function(t,e,i,n){t===this._width&&e===this._height&&i===this._pivotX&&n===this._pivotY||(this._width=t,this._height=e,this._pivotX=i,this._pivotY=n,this.vertDirty=!0)},i.clear=function(){this.resize(0,0),this._data.length=0,this._pivotX=0,this._pivotY=0,this._width=0,this._height=0,this.indices=null,this.vertDirty=!0,this.material=null,this.nodeDirty=!0,this.passDirty=!0,this.textureDirty=!0,this.hashDirty=!0,this.layer=0,this.frame=null,this.textureHash=0,this.dataHash=0},e.createStaticVBAccessor=function(t,e,i){var n=Di.root.device;return new Kh(n,t,e,i)},Pi(e,[{key:"dataLength",get:function(){return this._data.length},set:function(t){var e=this._data;if(e.length!==t){var i=e.length,n=0;for(n=t;n>2,i._vertexFormat=t,i},e.remove=function(t){t.clear()};var n=e.prototype;return n.request=function(t,e){var i=this._byteLength+t*this.stride;return!!this.reserve(t,e)&&(this._vc+=t,this._ic+=e,this._byteLength=i,this.vertexRange=this._vc,this.indexRange=this._ic,!0)},n.reserve=function(t,e){var i=this._byteLength+t*this.stride,n=this.indexCount+e;if(t+this.vertexCount>65535)return!1;var r=this.vData.byteLength,s=this.iData.length,a=this.vData.length,o=this.iData.length;if(i>r||n>s){for(;r=0&&e>=0&&i<=this.vData.byteLength&&e<=this.iData.length),this._vc=t,this._ic=e,this._byteLength=i,this.updateRange(0,t,0,e)},n.updateRange=function(t,e,i,n){Ni(e>=0&&n>=0&&e<=this._vc&&n<=this._ic),this.vertexStart=t,this.indexStart=i,this.vertexRange=e,this.indexRange=n},n.requestIA=function(t){this._initIAInfo(t);var e=this._iaPool.add();return e.firstIndex=this.indexStart,e.indexCount=this.indexRange,e},n.uploadBuffers=function(){if(0!==this._byteLength&&this._vertexBuffers[0]&&this._indexBuffer){var t=this._ic,e=new Float32Array(this.vData.buffer,0,this._byteLength>>2),i=new Uint16Array(this.iData.buffer,0,t),n=this._vertexBuffers[0];this._byteLength>n.size&&n.resize(this._byteLength),n.update(e);var r=t<<1;r>this._indexBuffer.size&&this._indexBuffer.resize(r),this._indexBuffer.update(i)}},n.freeIAPool=function(){this._iaPool&&this._iaPool.reset()},n.reset=function(){this._vc=0,this._ic=0,this._byteLength=0,this.vertexStart=0,this.vertexRange=0,this.indexStart=0,this.indexRange=0,this.lastFilledIndex=0,this.lastFilledVertex=0,this.material=null,this.freeIAPool()},n.clear=function(){this.reset(),this._iaPool&&this._iaPool.destroy(),this._vertexBuffers[0]&&(this._vertexBuffers[0].destroy(),this._vertexBuffers=[]),this._iaInfo=null,this.vData=new Float32Array(256*this.stride),this.iData=new Uint16Array(1536)},n._initIAInfo=function(t){var e=this;if(!this._iaInfo){var n=this.stride,r=this._vertexBuffers;r.length||r.push(t.createBuffer(new ft(g.VERTEX|g.TRANSFER_DST,y.DEVICE,n,n)));var s=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new ft(g.INDEX|g.TRANSFER_DST,y.DEVICE,s,s))),this._iaInfo=new Dt(this._vertexFormat,r,this._indexBuffer),this._iaPool=new i((function(){return t.createInputAssembler(e._iaInfo)}),1,(function(t){t.destroy()}))}},n._reallocBuffer=function(t,e){var i=this.vData;this.vData=new Float32Array(t),i&&this.vData.set(i,0);var n=this.iData;this.iData=new Uint16Array(e),n&&this.iData.set(n,0)},n.setRenderDrawInfoAttributes=function(){},n.particleInitRenderDrawInfo=function(){},Pi(e,[{key:"formatByte",get:function(){return this.stride},set:function(){}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vDataOffset",get:function(){return this._byteLength>>>2}}]),e}(Tl)),Al=(new i((function(){return new El}),32),new cn),Cl=new cn,Rl=new ji,bl=new Ue,xl=new Ue,wl=new Ue,Ml=new Ue(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Il=new un,Bl=(ul=Ki("cc.UITransform")(rl=In(110)(rl=bn((ll=hl=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&r.y>=0&&r.x<=e&&r.y<=i&&(c=this._maskTest(n)),c)return!0}}}return!1},i.hitTest=function(t,e){void 0===e&&(e=0);for(var i=this._contentSize.width,n=this._contentSize.height,r=Rl,s=Al,a=Cl,o=this._getRenderScene().cameras,h=0;h=0&&a.y>=0&&a.x<=i&&a.y<=n&&(u=this._maskTest(s)),u)return!0}}return!1},i._maskTest=function(t){var e,i,n=null===(e=this.node)||void 0===e||null===(i=e.eventProcessor)||void 0===i?void 0:i.maskList;if(n)for(var r=this.node,s=n.length,a=0,o=0;r&&oh.index){n.length=o;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(wl),Ue.invert(bl,wl),e||(e=new ji),ji.transformMat4(e,t,bl)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(wl),e||(e=new ji),ji.transformMat4(e,t,wl)},i.getBoundingBox=function(){Ue.fromRTS(xl,this.node.getRotation(),this.node.getPosition(),this.node.getScale());var t=this._contentSize.width,e=this._contentSize.height,i=new un(-this._anchorPoint.x*t,-this._anchorPoint.y*e,t,e);return i.transformMat4(xl),i},i.getBoundingBoxToWorld=function(){if(this.node.parent){var t=this.node.parent.getWorldMatrix();return this.getBoundingBoxTo(t)}return this.getBoundingBox()},i.getBoundingBoxTo=function(t){Ue.fromRTS(xl,this.node.getRotation(),this.node.getPosition(),this.node.getScale());var i=this._contentSize.width,n=this._contentSize.height,r=new un(-this._anchorPoint.x*i,-this._anchorPoint.y*n,i,n);if(Ue.multiply(wl,t,xl),r.transformMat4(wl),!this.node.children||0===this.node.children.length)return r;for(var s,a=this.node.children,o=Fi(a);!(s=o()).done;){var h=s.value;if(h&&h.active){var l=h.getComponent(e);if(l){var u=l.getBoundingBoxTo(t);u&&un.union(r,r,u)}}}return r},i.getComputeAABB=function(t){var e=this._contentSize.width,i=this._contentSize.height;Il.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),Il.transformMat4(this.node.worldMatrix);var n=Il.x+.5*Il.width,r=Il.y+.5*Il.height,s=this.node.worldPosition.z,a=Il.width/2,o=Il.height/2;return null!=t?(Qi.set(t,n,r,s,a,o,.001),t):new Qi(n,r,s,a,o,.001)},i._parentChanged=function(){this.node.getComponent("cc.RenderRoot2D")||this.node.parent&&e.insertChangeMap(this.node.parent)},i._markRenderDataDirty=function(){var t=this.node._uiProps.uiComp;t&&t.markForUpdateRenderData()},e.insertChangeMap=function(t){var i=t.uuid;e.priorityChangeNodeMap.has(i)||e.priorityChangeNodeMap.set(i,t)},e._sortChildrenSibling=function(t){var e=t.children;e&&e.sort((function(t,e){var i=t._uiProps.uiTransformComp,n=e._uiProps.uiTransformComp,r=(i?i._priority:0)-(n?n._priority:0);return 0===r?t.getSiblingIndex()-e.getSiblingIndex():r}))},e._sortSiblings=function(){e.priorityChangeNodeMap.forEach((function(t){e._sortChildrenSibling(t),t._updateSiblingIndex(),t.emit("childrenSiblingOrderChanged")})),e.priorityChangeNodeMap.clear()},e._cleanChangeMap=function(){e.priorityChangeNodeMap.clear()},Pi(e,[{key:"contentSize",get:function(){return this._contentSize},set:function(t){this._contentSize.equals(t)||(this._contentSize.set(t),this.node.emit(xn.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"width",get:function(){return this._contentSize.width},set:function(t){this._contentSize.width!==t&&(this._contentSize.width=t,this.node.emit(xn.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"height",get:function(){return this._contentSize.height},set:function(t){this.contentSize.height!==t&&(this._contentSize.height=t,this.node.emit(xn.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"anchorPoint",get:function(){return this._anchorPoint},set:function(t){this._anchorPoint.equals(t)||(this._anchorPoint.set(t),this.node.emit(xn.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"anchorX",get:function(){return this._anchorPoint.x},set:function(t){this._anchorPoint.x!==t&&(this._anchorPoint.x=t,this.node.emit(xn.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"anchorY",get:function(){return this._anchorPoint.y},set:function(t){this._anchorPoint.y!==t&&(this._anchorPoint.y=t,this.node.emit(xn.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority!==t&&(this.node.getComponent("cc.RenderRoot2D")?Zi(6706):(this._priority=t,this.node.parent&&e.insertChangeMap(this.node.parent)))}},{key:"visibility",get:function(){var t=Di.root.batcher2D.getFirstRenderCamera(this.node);return t?t.visibility:0}},{key:"cameraPriority",get:function(){var t=Di.root.batcher2D.getFirstRenderCamera(this.node);return t?t.priority:0}}]),e}(Pn),hl.EventType=xn,hl.priorityChangeNodeMap=new Map,al=tn((sl=ll).prototype,"_contentSize",[en],(function(){return new dn(100,100)})),ol=tn(sl.prototype,"_anchorPoint",[en],(function(){return new cn(.5,.5)})),rl=sl))||rl)||rl)||rl,t({UITransform:ul,UITransformComponent:ul}),ul);Di.on(An.EVENT_AFTER_UPDATE,Bl._sortSiblings),Di.on(An.EVENT_BEFORE_SCENE_LAUNCH,Bl._cleanChangeMap);var Pl,Dl,Ol,Fl,Ll,Nl,kl,Ul,Gl,Vl,Hl,zl,Xl,Wl,Yl={parent:null,owner:null,subModelIdx:0},jl=bn,Kl=Tn,ql=t("Renderer",(cl=Ki("cc.Renderer"),dl=Kl(Dn),_l=Kl([Dn]),cl(fl=jl((pl=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._materials.length?null:this._materials[t]},i.setMaterial=function(t,e){t&&t instanceof On&&console.error("Can't set a material instance to a sharedMaterial slot"),this._materials[e]=t;var i=this._materialInstances[e];i&&(i.destroy(),this._materialInstances[e]=null),this._onMaterialModified(e,this._materials[e])},i.getMaterialInstance=function(t){if(!this._materials[t])return null;if(!this._materialInstances[t]){Yl.parent=this._materials[t],Yl.owner=this,Yl.subModelIdx=t;var e=new On(Yl);Yl.parent=null,Yl.owner=null,Yl.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){Zi(12007);var i=t;t=e,e=i}var n=this._materialInstances[e];t&&t.parent?t!==n&&(this._materialInstances[e]=t,this._onMaterialModified(e,t)):(t!==this._materials[e]||n)&&this.setMaterial(t,e)},i.getRenderMaterial=function(t){return this._materialInstances[t]||this._materials[t]},i._onMaterialModified=function(){},i._onRebuildPSO=function(){},i._clearMaterials=function(){},Pi(e,[{key:"sharedMaterial",get:function(){return this.getMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e0},i._postCanRender=function(){},i.updateMaterial=function(){if(this._customMaterial)this.getMaterial(0)!==this._customMaterial&&this.setMaterial(this._customMaterial,0);else{var t=this._updateBuiltinMaterial();this.setMaterial(t,0),this.stencilStage!==qh.ENTER_LEVEL&&this.stencilStage!==qh.ENTER_LEVEL_INVERTED||this.getMaterialInstance(0).recompileShaders({USE_ALPHA_TEST:!0}),this._updateBlendFunc()}},i._updateColor=function(){this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0),this.setEntityColor(this._color),this.setEntityOpacity(this.node._uiProps.localOpacity),this._assembler&&(this._assembler.updateColor(this),this._renderFlag=this._canRender(),this.setEntityEnabled(this._renderFlag))},e.setEntityColorDirtyRecursively=function(t,i){var n=t._uiProps.uiComp;n&&n.color&&(n._renderEntity.colorDirty=i);for(var r=0;r>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function Fu(t,e){return Math.ceil(t/e)*e}!function(t){t[t.OPAQUE=0]="OPAQUE",t[t.TRANSPARENT=1]="TRANSPARENT",t[t.OVERLAY=2]="OVERLAY"}(Iu||(Iu={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(Bu||(Bu={}));var Lu,Nu,ku,Uu,Gu,Vu,Hu,zu,Xu,Wu=function(){function t(t){this._device=void 0,this._format=_.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new ht,this._region1=new ht,this._region2=new ht,this._roundUpFn=null,this._bufferViewCtor=Uint8Array,this._channels=4,this._alignment=1,this._device=t}var e=t.prototype;return e.initialize=function(t){var e=ne[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=de(e),this._roundUpFn=t.roundUpFn||null,this._alignment=t.alignment||1,t.inOrderFree&&(this.alloc=this._McDonaldAlloc)},e.destroy=function(){for(var t=0;t=0));++r);if(n>=0){var s=this._chunks[i];s.start+=t;var a={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(a),a}var o=Math.sqrt(t/this._formatSize),h=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,Ou(o)),l=this._chunks[this.createChunk(h)];l.start+=t;var u={chunkIdx:this._chunkCount-1,start:0,end:t,texture:l.texture};return this._handles.push(u),u},e.free=function(t){for(var e=0;e0&&(this._region0.texOffset.x=a,this._region0.texOffset.y=o,this._region0.texExtent.width=h,this._region0.texExtent.height=1,i.push(new this._bufferViewCtor(e,l*this._formatSize,h*this._channels)),n.push(this._region0),a=0,o+=1,s-=h,l+=h),s>0&&(this._region1.texOffset.x=a,this._region1.texOffset.y=o,s>t.texture.width?(this._region1.texExtent.width=t.texture.width,this._region1.texExtent.height=Math.floor(s/t.texture.width),h=this._region1.texExtent.width*this._region1.texExtent.height):(h=s,this._region1.texExtent.width=h,this._region1.texExtent.height=1),i.push(new this._bufferViewCtor(e,l*this._formatSize,h*this._channels)),n.push(this._region1),a=0,o+=this._region1.texExtent.height,s-=h,l+=h),s>0&&(this._region2.texOffset.x=a,this._region2.texOffset.y=o,this._region2.texExtent.width=s,this._region2.texExtent.height=1,i.push(new this._bufferViewCtor(e,l*this._formatSize,s*this._channels)),n.push(this._region2)),this._device.copyBuffersToTexture(i,t.texture,n)},e._findAvailableSpace=function(t,e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.size)n=!0;else{r=0;for(var s=this._handles.filter((function(t){return t.chunkIdx===e})).sort((function(t,e){return t.start-e.start})),a=0;ai.end?r+t<=i.size?n=!0:t<=i.end&&(i.start=r=0,n=!0):r===i.end&&(i.start=r=0,i.end=i.size,t<=i.end&&(n=!0)),n){i.start+=t;var s={chunkIdx:e,start:r,end:r+t,texture:i.texture};return this._handles.push(s),s}}var a=Math.sqrt(t/this._formatSize),o=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,Ou(a)),h=this._chunks[this.createChunk(o)];h.start+=t;var l={chunkIdx:this._chunkCount,start:0,end:t,texture:h.texture};return this._handles.push(l),l},t}(),Yu=function(){function t(t,e,i){this._arrayBuffers=[],this._chunkSize=void 0,this._chunkSize=i*(1<>this._entryBits,i=this._entryMask&t;return(this._hasFloat32?this._float32BufferViews:this._uint32BufferViews)[e][i]},e.getTypedArray=function(t,e){var i=(this._chunkMask&t)>>this._entryBits,n=this._entryMask&t,r=e,s=(this._dataType[e]===Xu.UINT32?this._uint32BufferViews:this._float32BufferViews)[i][n],a=this._dataMembers[e];return s.subarray(r,r+a)},e.free=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;(this._hasUint32?this._uint32BufferViews:this._float32BufferViews)[e][i].fill(0),this._freeLists[e].push(i)},t}();!function(t){t[t.NODE=0]="NODE",t[t.PASS=1]="PASS",t[t.AABB=2]="AABB",t[t.RENDER2D=3]="RENDER2D"}(ju||(ju={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(Ku||(Ku={}));var Zu,Qu=((Lu={})[Ku.POSITION]=Xu.FLOAT32,Lu[Ku.UV]=Xu.FLOAT32,Lu[Ku.COLOR]=Xu.UINT32,Lu[Ku.COUNT]=Xu.NEVER,Lu),Ju=((Nu={})[Ku.POSITION]=Ku.UV-Ku.POSITION,Nu[Ku.UV]=Ku.COLOR-Ku.UV,Nu[Ku.COLOR]=Ku.COUNT-Ku.COLOR,Nu[Ku.COUNT]=1,Nu),$u=new qu(ju.RENDER2D,Qu,Ju,Ku);!function(t){t[t.DIRTY_FLAG=0]="DIRTY_FLAG",t[t.LAYER=1]="LAYER",t[t.WORLD_SCALE=2]="WORLD_SCALE",t[t.WORLD_POSITION=5]="WORLD_POSITION",t[t.WORLD_ROTATION=8]="WORLD_ROTATION",t[t.WORLD_MATRIX=12]="WORLD_MATRIX",t[t.LOCAL_SCALE=28]="LOCAL_SCALE",t[t.LOCAL_POSITION=31]="LOCAL_POSITION",t[t.LOCAL_ROTATION=34]="LOCAL_ROTATION",t[t.COUNT=38]="COUNT"}(Zu||(Zu={}));var tc,ec=((ku={})[Zu.DIRTY_FLAG]=Xu.UINT32,ku[Zu.LAYER]=Xu.UINT32,ku[Zu.WORLD_SCALE]=Xu.FLOAT32,ku[Zu.WORLD_POSITION]=Xu.FLOAT32,ku[Zu.WORLD_ROTATION]=Xu.FLOAT32,ku[Zu.WORLD_MATRIX]=Xu.FLOAT32,ku[Zu.LOCAL_SCALE]=Xu.FLOAT32,ku[Zu.LOCAL_POSITION]=Xu.FLOAT32,ku[Zu.LOCAL_ROTATION]=Xu.FLOAT32,ku[Zu.COUNT]=Xu.NEVER,ku),ic=((Uu={})[Zu.DIRTY_FLAG]=Zu.LAYER-Zu.DIRTY_FLAG,Uu[Zu.LAYER]=Zu.WORLD_SCALE-Zu.LAYER,Uu[Zu.WORLD_SCALE]=Zu.WORLD_POSITION-Zu.WORLD_SCALE,Uu[Zu.WORLD_POSITION]=Zu.WORLD_ROTATION-Zu.WORLD_POSITION,Uu[Zu.WORLD_ROTATION]=Zu.WORLD_MATRIX-Zu.WORLD_ROTATION,Uu[Zu.WORLD_MATRIX]=Zu.LOCAL_SCALE-Zu.WORLD_MATRIX,Uu[Zu.LOCAL_SCALE]=Zu.LOCAL_POSITION-Zu.LOCAL_SCALE,Uu[Zu.LOCAL_POSITION]=Zu.LOCAL_ROTATION-Zu.LOCAL_POSITION,Uu[Zu.LOCAL_ROTATION]=Zu.COUNT-Zu.LOCAL_ROTATION,Uu[Zu.COUNT]=1,Uu),nc=new qu(ju.NODE,ec,ic,Zu);!function(t){t[t.PRIORITY=0]="PRIORITY",t[t.STAGE=1]="STAGE",t[t.PHASE=2]="PHASE",t[t.PRIMITIVE=3]="PRIMITIVE",t[t.BATCHING_SCHEME=4]="BATCHING_SCHEME",t[t.DYNAMIC_STATE=5]="DYNAMIC_STATE",t[t.HASH=6]="HASH",t[t.COUNT=7]="COUNT"}(tc||(tc={}));var rc,sc=((Gu={})[tc.PRIORITY]=Xu.UINT32,Gu[tc.STAGE]=Xu.UINT32,Gu[tc.PHASE]=Xu.UINT32,Gu[tc.PRIMITIVE]=Xu.UINT32,Gu[tc.BATCHING_SCHEME]=Xu.UINT32,Gu[tc.DYNAMIC_STATE]=Xu.UINT32,Gu[tc.HASH]=Xu.UINT32,Gu[tc.COUNT]=Xu.NEVER,Gu),ac=((Vu={})[tc.PRIORITY]=tc.STAGE-tc.PRIORITY,Vu[tc.STAGE]=tc.PHASE-tc.STAGE,Vu[tc.PHASE]=tc.PRIMITIVE-tc.PHASE,Vu[tc.PRIMITIVE]=tc.BATCHING_SCHEME-tc.PRIMITIVE,Vu[tc.BATCHING_SCHEME]=tc.DYNAMIC_STATE-tc.BATCHING_SCHEME,Vu[tc.DYNAMIC_STATE]=tc.HASH-tc.DYNAMIC_STATE,Vu[tc.HASH]=tc.COUNT-tc.HASH,Vu[tc.COUNT]=1,Vu),oc=new qu(ju.PASS,sc,ac,tc);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(rc||(rc={}));var hc=((Hu={})[rc.CENTER]=Xu.FLOAT32,Hu[rc.HALFEXTENTS]=Xu.FLOAT32,Hu[rc.COUNT]=Xu.NEVER,Hu),lc=((zu={})[rc.CENTER]=rc.HALFEXTENTS-rc.CENTER,zu[rc.HALFEXTENTS]=rc.COUNT-rc.HALFEXTENTS,zu[rc.COUNT]=1,zu),uc=new qu(ju.AABB,hc,lc,rc);Vn(Hn.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),Vn(Hn.prototype,"RenderScene.prototype",[{name:"raycastAll",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllModels",suggest:"using intersect.rayModel in geometry"},{name:"raycastSingleModel",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllCanvas",suggest:"using intersect.rayAABB in geometry"},{name:"rayResultCanvas"},{name:"rayResultModels"},{name:"rayResultAll"},{name:"rayResultSingleModel"}]),Vn(ni.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var cc={};Vn(cc,"CameraVisFlags",[{name:"GENERAL"}]),zn(cc,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:Xn.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Xn.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Xn.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Xn.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Xn.BitMask,targetName:"UI_2D"}]),We.CameraVisFlags=cc;var dc={};Vn(dc,"VisibilityFlags",[{name:"GENERAL"}]),zn(dc,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:Xn.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:Xn.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Xn.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Xn.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Xn.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Xn.Enum,targetName:"UI_2D"}]),We.VisibilityFlags=dc,zn(Wn.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),Vn(ei.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),Vn(_i.prototype,"Shadows.prototype",[{name:"aspect"},{name:"selfShadow"},{name:"linear"},{name:"packing"},{name:"autoAdapt"},{name:"fixedArea"},{name:"pcf"},{name:"bias"},{name:"normalBias"},{name:"near"},{name:"far"},{name:"shadowDistance"},{name:"invisibleOcclusionRange"},{name:"orthoSize"},{name:"saturation"}]),Vn(Ai.prototype,"SpotLight.prototype",[{name:"aspect"}]),zn(ri.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),Vn(ri.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var _c,fc,pc,gc=function(t){if(void 0===Du[t]){var e=1<10||(p=.5*(s+o),g=.5*(a+h),m=.5*((c=.5*(e+n))+(_=.5*(n+s))),v=.5*((d=.5*(i+r))+(f=.5*(r+a))),((R=Ac((n-o)*(C=h-i)-(r-h)*(A=o-e)))+(b=Ac((s-o)*C-(a-h)*A)))*(R+b)=2*vc)u=2*vc;else for(;u<0;)u+=2*vc;else if(Ac(u)>=2*vc)u=2*-vc;else for(;u>0;)u-=2*vc;for(h=0|Tc(1,yc(Ac(u)/(.5*vc)+.5,5)),c=Ac(4/3*(1-Sc(o=u/h/2))/Ec(o)),a||(c=-c),E=0;E<=h;E++)f=e+(d=Sc(l=r+u*(E/h)))*n,p=i+(_=Ec(l))*n,g=-_*n*c,m=d*n*c,0===E?t.moveTo(f,p):t.bezierCurveTo(v+T,y+S,f-g,p-m,f,p),v=f,y=p,T=g,S=m}(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){bc(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){bc(this,t,e,i,i),this._curPath.complex=!1},e.rect=function(t,e,i,n){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+n),this.lineTo(t,e+n),this.close(),this._curPath.complex=!1},e.roundRect=function(t,e,i,n,r){!function(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var a=yc(s,.5*Ac(n))*Cc(n),o=yc(s,.5*Ac(r))*Cc(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-Rc),e+a*(1-Rc),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-Rc),i+r,e+n,i+r-o*(1-Rc),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-Rc),e+n-a*(1-Rc),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-Rc),i,e,i+o*(1-Rc),e,i+o),t.close()}}(this,t,e,i,n,r),this._curPath.complex=!1},e.clear=function(){this.pathLength=0,this.pathOffset=0,this.pointsOffset=0,this.dataOffset=0,this._curPath=null,this.paths.length=0,this._points.length=0;for(var t=this._renderDataList,e=0,i=t.length;e0){for(var i=0;ii)for(var n=i;n=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(this.type===Pd.GRAPHICS_ELLIPSE){var h=n/2,l=r/2,u=s.x-.5*n,c=s.y-.5*r;o=u*u/(h*h)+c*c/(l*l)<1}return this._inverted&&(o=!o),o},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){this._type!==Pd.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(Bd);if(!t){var e=this.node;t=this._sprite=e.addComponent(Bd)}t.color=Ve.WHITE.clone(),t.sizeMode=0}this._sprite.stencilStage=this.inverted?qh.ENTER_LEVEL_INVERTED:qh.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(yd);if(!t){var e=this.node;t=this._graphics=e.addComponent(yd)}t.lineWidth=1;var i=Ve.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?qh.ENTER_LEVEL_INVERTED:qh.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===Pd.GRAPHICS_RECT||this._type===Pd.GRAPHICS_ELLIPSE)){var t=this.node._uiProps.uiTransformComp,e=this._graphics;e.clear();var i=t.contentSize,n=i.width,r=i.height,s=t.anchorPoint,a=-n*s.x,o=-r*s.y;if(this._type===Pd.GRAPHICS_RECT)e.rect(a,o,n,r);else if(this._type===Pd.GRAPHICS_ELLIPSE){for(var h=function(t,e,i){Ld.length=0;for(var n=2*Math.PI/i,r=0;r"]),this._specialSymbolArray.push([/&/g,"&"]),this._specialSymbolArray.push([/"/g,'"']),this._specialSymbolArray.push([/'/g,"'"])}var e=t.prototype;return e.parse=function(t){this._resultObjectArray.length=0,this._stack.length=0;for(var e=0,i=t.length;e",e),r=-1;if(n>=0&&(r=t.lastIndexOf("<",n))",r+1)),r<0)this._stack.pop(),this._processResult(t.substring(e)),e=i;else{var s=t.substring(e,r),a=t.substring(r+1,n);""===a&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(a),e=n+1}}return this._resultObjectArray},e._attributeToObject=function(t){t=t.trim();var e={},i=/^(color|size)(\s)*=/.exec(t),n="",r=0,s="";if(i){if(n=i[0],""===(t=t.substring(n.length).trim()))return e;switch(r=t.indexOf(" "),n[0]){case"c":e.color=r>-1?t.substring(0,r).trim():t;break;case"s":e.size=parseInt(t)}return r>-1&&(s=t.substring(r+1).trim(),e.event=this._processEventHandler(s)),e}if((i=/^(br(\s)*\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("br")&&"/"===n[n.length-1])return e.isNewLine=!0,this._resultObjectArray.push({text:"",style:{isNewLine:!0}}),e;var a="",o=-1;if((i=/^(img(\s)*src(\s)*=[^>]+\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("img")&&"/"===n[n.length-1]){var h;i=E_.exec(t);for(var l=!1;i;){var u=(n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length)).length;if(n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),a=t.substring(u).trim(),o="src"===n?this.getRightQuotationIndex(a):-1,h=(r=a.indexOf(" ",o+1>=a.length?-1:o+1))>-1?a.substr(0,r):a,t=a.substring(r).trim(),h.endsWith("/")&&(h=h.slice(0,-1)),"src"===n){switch(h.charCodeAt(0)){case 34:case 39:l=!0,h=h.slice(1,-1)}e.isImage=!0,e.src=h}else if("height"===n)e.imageHeight=parseInt(h);else if("width"===n)e.imageWidth=parseInt(h);else if("align"===n){switch(h.charCodeAt(0)){case 34:case 39:h=h.slice(1,-1)}e.imageAlign=h.toLowerCase()}else"offset"===n?e.imageOffset=h:"click"===n&&(e.event=this._processEventHandler(n+"="+h));e.event&&"param"===n&&(e.event[n]=h.replace(/^"|"$/g,"")),i=E_.exec(t)}return l&&e.isImage&&this._resultObjectArray.push({text:"",style:e}),{}}if(i=/^(outline(\s)*[^>]*)/.exec(t)){var c={color:"#ffffff",width:1};if(t=i[0].substring("outline".length).trim()){var d,_=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=_.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length),d=(r=(a=t.substring(n.length).trim()).indexOf(" "))>-1?a.substr(0,r):a,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=a.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+d):"color"===n?c.color=d:"width"===n&&(c.width=parseInt(d)),e.event&&"param"===n&&(e.event[n]=d.replace(/^"|"$/g,"")),i=_.exec(t)}e.outline=c}if((i=/^(on|u|b|i)(\s)*/.exec(t))&&i[0].length>0){switch(n=i[0],t=t.substring(n.length).trim(),n[0]){case"u":e.underline=!0;break;case"i":e.italic=!0;break;case"b":e.bold=!0}if(""===t)return e;e.event=this._processEventHandler(t)}return e},e.getRightQuotationIndex=function(t){var e=-1,i=-1,n=t.indexOf("'"),r=t.indexOf('"'),s=r>-1&&(r-1&&(n=t.length?-1:e+1)):s&&(e=r,i=t.indexOf('"',e+1>=t.length?-1:e+1)),i},e._processEventHandler=function(t){for(var e={},i=0,n=!1,r=S_.exec(t);r;){var s=r[0],a="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else{var o=/(\S)+/.exec(t);i=(a=o?o[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=a),t=t.substring(i).trim(),r=S_.exec(t)}return e},e._addToStack=function(t){var e=this._attributeToObject(t);if(0===this._stack.length)this._stack.push(e);else{if(e.isNewLine||e.isImage)return;var i=this._stack[this._stack.length-1];for(var n in i)e[n]||(e[n]=i[n]);this._stack.push(e)}},e._processResult=function(t){0!==t.length&&(t=this._escapeSpecialSymbol(t),this._stack.length>0?this._resultObjectArray.push({text:t,style:this._stack[this._stack.length-1]}):this._resultObjectArray.push({text:t}))},e._escapeSpecialSymbol=function(t){for(var e,i=Fi(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),C_=function(e){return t({LabelOutline:e,LabelOutlineComponent:e}),e}(Ki("cc.LabelOutline")(kd=In(110)(kd=kn(Mu)((Ud=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&e>0){this._updateResolutionPolicy(i);var n=this._resolutionPolicy;n&&n.preApply(this),this._designResolutionSize.width=t,this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var s=this._viewportRect,a=this._visibleRect,o=r.viewport;s.x=o.x,s.y=o.y,s.width=o.width,s.height=o.height,a.x=0,a.y=0,a.width=o.width/this._scaleX,a.height=o.height/this._scaleY}n.postApply(this),O_.width=this._visibleRect.width,O_.height=this._visibleRect.height,Bn&&Bn.init(this._visibleRect),this.emit("design-resolution-changed")}else hn(2200)},i.getDesignResolutionSize=function(){return new dn(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){document.documentElement.style.width=t+"px",document.body.style.width=t+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(t,e,i)},i.getViewportRect=function(){return this._viewportRect},i.getScaleX=function(){return this._scaleX},i.getScaleY=function(){return this._scaleY},i.getDevicePixelRatio=function(){return Er.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new cn);var r=Er.devicePixelRatio*(t-i.left),s=Er.devicePixelRatio*(i.top+i.height-e);return Er.isFrameRotated?(n.x=Ar.windowSize.width-s,n.y=r):(n.x=r,n.y=s),n},i._convertToUISpace=function(t){var e=this._viewportRect;t.x=(t.x-e.x)/this._scaleX,t.y=(t.y-e.y)/this._scaleY},i._updateAdaptResult=function(t,e,i){var n;We.director.root.resize(t,e,void 0===i?1:i);var r=this._designResolutionSize.width,s=this._designResolutionSize.height;t>0&&this.setDesignResolutionSize(r,s,this._resolutionPolicy),this.emit("canvas-resize"),null===(n=this._resizeCallback)||void 0===n||n.call(this)},e}(Cr(Oi)));L_.instance=void 0;var N_=function(){function t(){this.name="ContainerStrategy"}var e=t.prototype;return e.preApply=function(){},e.apply=function(){},e.postApply=function(){},e._setupCanvas=function(){var t=We.game.canvas;if(t){var e=Ar.windowSize;t.width=e.width,t.height=e.height}},t}();N_.EQUAL_TO_FRAME=void 0,N_.PROPORTION_TO_FRAME=void 0;var k_=function(){function t(){this.name="ContentStrategy",this._result=void 0,this._result={scale:[1,1],viewport:null}}var e=t.prototype;return e.preApply=function(){},e.apply=function(){return{scale:[1,1]}},e.postApply=function(){},e._buildResult=function(t,e,i,n,r,s){Math.abs(t-i)<2&&(i=t),Math.abs(e-n)<2&&(n=e);var a=new un(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=a,this._result},t}();k_.EXACT_FIT=void 0,k_.SHOW_ALL=void 0,k_.NO_BORDER=void 0,k_.FIXED_HEIGHT=void 0,k_.FIXED_WIDTH=void 0,function(){var t=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rp?0:f>0?f:p}Vn(ef.prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),Vn(wu.prototype,"Renderable2D.prototype",[{name:"srcBlendFactor"},{name:"dstBlendFactor"}]),zn(tf.prototype,"Canvas.prototype",[{name:"camera",newName:"cameraComponent.camera",customGetter:function(){return this._cameraComponent.camera}},{name:"clearFlag",newName:"cameraComponent.clearFlags",customGetter:function(){return this._cameraComponent?this._cameraComponent.clearFlags:0},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.clearFlags=t)}},{name:"color",newName:"cameraComponent.clearColor",customGetter:function(){return this._cameraComponent?this._cameraComponent.clearColor:Ve.BLACK},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.clearColor=t)}},{name:"priority",newName:"cameraComponent.priority",customGetter:function(){return this._cameraComponent?this._cameraComponent.priority:0},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.priority=t)}},{name:"targetTexture",newName:"cameraComponent.targetTexture",customGetter:function(){return this._cameraComponent?this._cameraComponent.targetTexture:null},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.targetTexture=t)}},{name:"visibility",newName:"cameraComponent.visibility",customGetter:function(){return this._cameraComponent?this._cameraComponent.visibility:0}}]),Rr(Bl.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),We.UITransformComponent=Bl,br(Bl,"cc.UITransformComponent"),br(wu,"cc.RenderComponent"),We.CanvasComponent=tf,br(tf,"cc.CanvasComponent"),We.internal.Renderable2D=wu,br(wu,"cc.Renderable2D");var rf,sf,af,of,hf,lf,uf,cf=(rf=xr.create(),sf={distance:1/0,doubleSided:!1,mode:wr.ANY},af=0,of=function(t,e,i,n,r,s){t===wr.CLOSEST?(af>e||0===af)&&(af=e,s&&(0===s.length?s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}):(s[0].distance=e,s[0].vertexIndex0=i/3,s[0].vertexIndex1=n/3,s[0].vertexIndex2=r/3))):(af=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(af=0,0===e.geometricInfo.positions.length)return af;var n=void 0===i?sf:i;if(nf(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===U.TRIANGLE_LIST)for(var s=e.length,a=0;ar.distance)&&(of(r.mode,u,o,h,l,r.result),r.mode===wr.ANY))return u}else if(i===U.TRIANGLE_STRIP)for(var c=e.length-2,d=0,_=0;_r.distance)&&(of(r.mode,m,f,p,g,r.result),r.mode===wr.ANY))return m}else if(i===U.TRIANGLE_FAN){var v=e.length-1,y=3*e[0];ji.set(rf.a,t[y],t[y+1],t[y+2]);for(var T=1;Tr.distance)&&(of(r.mode,A,y,S,E,r.result),r.mode===wr.ANY))return A}}}(s.positions,s.indices,r,t,n)}return af}),df=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:wr.ANY};return function(i,n,r){t=0;var s=void 0===r?e:r,a=n.renderingSubMeshes.length,o=n.struct.minPosition,h=n.struct.maxPosition;if(o&&h&&!nf(i,o,h))return t;for(var l=0;lc)&&(t=c,s.subIndices&&(s.subIndices[0]=l));else if(t=c,s.subIndices&&s.subIndices.push(l),s.mode===wr.ANY)return c}return t&&s.mode===wr.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),_f=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:wr.ANY},i=new gr,n=new Ue;return function(r,s,a){t=0;var o=void 0===a?e:a,h=s.worldBounds;if(h&&!Mr.rayAABB(r,h))return t;gr.copy(i,r),s.node&&(Ue.invert(n,s.node.getWorldMatrix(n)),ji.transformMat4(i.o,r.o,n),ji.transformMat4Normal(i.d,r.d,n));for(var l=s.subModels,u=0;ud)&&(t=d,o.subIndices&&(o.subIndices[0]=u));else if(t=d,o.subIndices&&o.subIndices.push(u),o.mode===wr.ANY)return d}return t&&o.mode===wr.CLOSEST&&(o.result&&(o.result[0].distance=t,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),t}}();Mr.rayModel=_f,Mr.raySubMesh=cf,Mr.rayMesh=df;var ff,pf,gf,mf,vf,yf,Tf,Sf,Ef,Af,Cf,Rf,bf,xf,wf,Mf,If,Bf=function(e){return t({ModelRenderer:e,RenderableComponent:e}),e}(Ki("cc.ModelRenderer")((lf=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0)for(var t=0;tl;){if((s/=2)<1){s*=2;break}a=a.substring(r,s),o=n.substring(s),h=this._calculateSize(e,a)}for(var u=1e3,c=1;u&&r0&&(c=d[0].length),s+=c,a=n.substring(r,s),o=n.substring(s),h=this._calculateSize(e,a),u--}for(;u&&a.length>=2&&h.x>l;)s-=c,a=n.substring(r,s),h=this._calculateSize(e,a),c=1,u--;if(a.length>=2){var _=Sh(a);_&&_.length>0&&a!==_[0]&&(s-=_[0].length,a=n.substring(r,s))}if(i.push(a),r=s,s+=a.length,a=n.substring(r,s),o=n.substring(s),u--,this._calculateSize(e,o).x<2048){r=t.length,s=t.length,a=o,i.push(a);break}h=this._calculateSize(e,a)}return i},i._measureText=function(t,e){var i=this,n=function(e){return i._calculateSize(t,e).width};return e?n(e):n},i._calculateSize=function(t,e){var i;return 0===this._labelSegmentsCache.length?(i=this._createFontLabel(e),this._labelSegmentsCache.push(i)):(i=this._labelSegmentsCache[0]).node.getComponent(Mu).string=e,i.styleIndex=t,this._applyTextAttribute(i),i.node._uiProps.uiTransformComp.contentSize},i._onTouchEnded=function(t){for(var e,i=this,n=this.node.getComponents(Pn),r=function(){var r=e.value,s=r.clickHandler,a=r.clickParam;s&&i._containsTouchLocation(r,t.touch.getUILocation())&&(n.forEach((function(e){var i=e[s];e.enabledInHierarchy&&i&&i.call(e,t,a)})),t.propagationStopped=!0)},s=Fi(this._segments);!(e=s()).done;)r()},i._containsTouchLocation=function(t,e){var i=t.node.getComponent(Bl);return!!i&&i.getBoundingBoxToWorld().contains(e)},i._resetState=function(){for(var t=this.node.children,e=t.length-1;e>=0;e--){var i=t[e];if(i.name===sp||i.name===ap){i.parent=null;var n=lp(i.name);n.node=i,i.name===sp?(n.comp=i.getComponent(Mu),op.put(n)):(n.comp=i.getComponent(Bd),hp.put(n)),this._labelChildrenNum--}}this._segments.length=0,this._labelSegmentsCache.length=0,this._linesWidth.length=0,this._lineOffsetX=0,this._lineCount=1,this._labelWidth=0,this._labelHeight=0,this._layoutDirty=!0},i._activateChildren=function(t){for(var e=this.node.children.length-1;e>=0;e--){var i=this.node.children[e];i.name!==sp&&i.name!==ap||(i.active=t)}},i._addLabelSegment=function(t,e){var i;if(0===this._labelSegmentsCache.length)i=this._createFontLabel(t);else{var n=(i=this._labelSegmentsCache.pop()).node.getComponent(Mu);n&&(n.string=t)}var r=i.comp;return r.verticalAlign!==this._verticalAlign&&(r.verticalAlign=this._verticalAlign),i.styleIndex=e,i.lineCount=this._lineCount,i.node._uiProps.uiTransformComp.setAnchorPoint(0,0),i.node.layer=this.node.layer,this.node.insertChild(i.node,this._labelChildrenNum++),this._applyTextAttribute(i),this._segments.push(i),i},i._updateRichTextWithMaxWidth=function(t,e,i){var n=e;if(this._lineOffsetX>0&&n+this._lineOffsetX>this._maxWidth)for(var r=0;this._lineOffsetX<=this._maxWidth;){var s=this._getFirstWordLen(t,r,t.length),a=t.substr(r,s),o=this._measureText(i,a);if(!(this._lineOffsetX+o<=this._maxWidth)){if(r>0){var h=t.substr(0,r);this._addLabelSegment(h,i),t=t.substr(r,t.length),n=this._measureText(i,t)}this._updateLineInfo();break}this._lineOffsetX+=o,r+=s}if(n>this._maxWidth)for(var l=Eh(t,n,this._maxWidth,this._measureText(i)),u=0;u1&&u0?(o*=a=u/h,h*=a):(o*=a=this._lineHeight/h,h*=a),l>0&&(o=l),this._maxWidth>0?(this._lineOffsetX+o>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=o):(this._lineOffsetX+=o,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._uiProps.uiTransformComp.setContentSize(o,h),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var c=e.event;c&&(r.clickHandler=c.click,r.clickParam=c.param)}else Zi(4400)}},i._updateRichText=function(){if(this.enabledInHierarchy){var t=rp.parse(this._string);if(!this._needsUpdateTextLayout(t))return this._textArray=t.slice(),void this._updateLabelSegmentTextAttributes();this._textArray=t.slice(),this._resetState();for(var e,i=!1,n=0;n0){var l=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,l,n),a.length>1&&othis._labelWidth&&(this._labelWidth=this._lineOffsetX),a.length>1&&o0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+ah)*this._lineHeight,this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=t.charAt(e);if(gh(n)||mh(n))return 1;for(var r=1,s=e+1;se&&(t=0,e=h);var l=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case Cu.LEFT:break;case Cu.CENTER:l-=this._linesWidth[h-1]/2;break;case Cu.RIGHT:l-=this._linesWidth[h-1]}var u=o.node.position;if(o.node.setPosition(t+l,this._lineHeight*(i-h)-this._labelHeight*s,u.z),h===e&&(t+=o.node._uiProps.uiTransformComp.width),o.node.getComponent(Bd)){var c=o.node.position.clone(),d=this._lineHeight,_=this._lineHeight*(1+ah);switch(o.node._uiProps.uiTransformComp.anchorY){case 1:c.y+=d+(_-d)/2;break;case.5:c.y+=_/2;break;default:c.y+=(_-d)/2}if(o.imageOffset){var f=o.imageOffset.split(",");if(1===f.length&&f[0]){var p=parseFloat(f[0]);Number.isInteger(p)&&(c.y+=p)}else if(2===f.length){var g=parseFloat(f[0]),m=parseFloat(f[1]);Number.isInteger(g)&&(c.x+=g),Number.isInteger(m)&&(c.y+=m)}}o.node.position=c}var v=o.node.getComponent(C_);if(v){var y=o.node.position.clone();y.y-=v.width,o.node.position=y}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return Ve[e]?Ve[e]:(new Ve).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(Mu);if(e){this._resetLabelState(e);var i,n=t.styleIndex;if(this._textArray[n]&&(i=this._textArray[n].style),i){if(e.color=this._convertLiteralColorValue(i.color||"white"),e.isBold=!!i.bold,e.isItalic=!!i.italic,e.isUnderline=!!i.underline,i.outline){var r=t.node.getComponent(C_);r||(r=t.node.addComponent(C_)),r.color=this._convertLiteralColorValue(i.outline.color),r.width=i.outline.width}e.fontSize=i.size||this._fontSize,t.clickHandler="",t.clickParam="";var s=i.event;s&&(t.clickHandler=s.click||"",t.clickParam=s.param||"")}e.cacheMode=this._cacheMode,this._font instanceof Wo&&!this._isSystemFontUsed?e.font=this._font:e.fontFamily=this._fontFamily,e.useSystemFont=this._isSystemFontUsed,e.lineHeight=this._lineHeight,e.updateRenderData(!0)}},i._applyLayer=function(){for(var t,e=Fi(this._segments);!(t=e()).done;)t.value.node.layer=this.node.layer},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=Ve.WHITE,t.isBold=!1,t.isItalic=!1,t.isUnderline=!1},Pi(e,[{key:"string",get:function(){return this._string},set:function(t){this._string!==t&&(this._string=t,this._updateRichTextStatus())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this.horizontalAlign!==t&&(this._horizontalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._font=t,this._layoutDirty=!0,this._font?(this.useSystemFont=!1,this._onTTFLoaded()):this.useSystemFont=!0,this._updateRichTextStatus())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this._isSystemFontUsed=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode!==t&&(this._cacheMode=t,this._updateRichTextStatus())}},{key:"maxWidth",get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"imageAtlas",get:function(){return this._imageAtlas},set:function(t){this._imageAtlas!==t&&(this._imageAtlas=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"handleTouchEvent",get:function(){return this._handleTouchEvent},set:function(t){this._handleTouchEvent!==t&&(this._handleTouchEvent=t,this.enabledInHierarchy&&(this.handleTouchEvent?this._addEventListeners():this._removeEventListeners()))}}]),e}(Pn),ip.HorizontalAlign=Cu,ip.VerticalAlign=Ru,gn((Hf=np).prototype,"horizontalAlign",[Lf],Object.getOwnPropertyDescriptor(Hf.prototype,"horizontalAlign"),Hf.prototype),gn(Hf.prototype,"verticalAlign",[Nf],Object.getOwnPropertyDescriptor(Hf.prototype,"verticalAlign"),Hf.prototype),gn(Hf.prototype,"font",[kf],Object.getOwnPropertyDescriptor(Hf.prototype,"font"),Hf.prototype),gn(Hf.prototype,"cacheMode",[Uf],Object.getOwnPropertyDescriptor(Hf.prototype,"cacheMode"),Hf.prototype),gn(Hf.prototype,"imageAtlas",[Gf],Object.getOwnPropertyDescriptor(Hf.prototype,"imageAtlas"),Hf.prototype),zf=tn(Hf.prototype,"_lineHeight",[en],(function(){return 40})),Xf=tn(Hf.prototype,"_string",[en],(function(){return"RichText"})),Wf=tn(Hf.prototype,"_horizontalAlign",[en],(function(){return Cu.LEFT})),Yf=tn(Hf.prototype,"_verticalAlign",[en],(function(){return Ru.TOP})),jf=tn(Hf.prototype,"_fontSize",[en],(function(){return 40})),Kf=tn(Hf.prototype,"_maxWidth",[en],(function(){return 0})),qf=tn(Hf.prototype,"_fontFamily",[en],(function(){return"Arial"})),Zf=tn(Hf.prototype,"_font",[en],(function(){return null})),Qf=tn(Hf.prototype,"_isSystemFontUsed",[en],(function(){return!0})),Jf=tn(Hf.prototype,"_userDefinedFont",[en],(function(){return null})),$f=tn(Hf.prototype,"_cacheMode",[en],(function(){return xu.NONE})),tp=tn(Hf.prototype,"_imageAtlas",[en],(function(){return null})),ep=tn(Hf.prototype,"_handleTouchEvent",[en],(function(){return!0})),Vf=Hf))||Vf)||Vf));We.RichText=dp;var _p=function(e){return t({UIMeshRenderer:e,UIModelComponent:e}),e}(Ki("cc.UIMeshRenderer")(cp=In(110)(cp=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=qh.DISABLED,e._renderData=null,e._renderEntity=new ml(Jh.DYNAMIC),e}He(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){Ln.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){Ln.removeRenderer(this),this.renderEntity.enabled=this._canRender()},i.onLoad=function(){this.node._uiProps.uiTransformComp||this.node.addComponent("cc.UITransform"),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent?this.renderEntity.setNode(this.node):console.warn("node '"+(this.node&&this.node.name)+"' doesn't have any renderable component")},i.onDestroy=function(){this.renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent&&(this._modelComponent._sceneGetter=null)},i._render=function(t){if(this._modelComponent){var e=this._modelComponent._collectModels();this._modelComponent._detachFromScene();for(var i=0;i0)for(s=e;s=e;s-=n)a=Kp(s,t[s],t[s+1],a);return a&&Xp(a,a.next)&&(qp(a),a=a.next),a}function Bp(t,e){if(void 0===e&&(e=null),!t)return t;e||(e=t);var i=t,n=!1;do{if(n=!1,i.steiner||!Xp(i,i.next)&&0!==zp(i.prev,i,i.next))i=i.next;else{if(qp(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function Pp(t,e,i,n,r,s,a){if(void 0===a&&(a=0),t){!a&&s&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=Up(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e=0,i=null,n=null,r=null,s=null,a=0,o=0,h=0,l=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e0||h>0&&n;)0===o?(r=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,h--):(r=i,i=i.nextZ,o--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,l*=2}while(a>1)}(r)}(t,n,r,s);for(var o=t,h=null,l=null;t.prev!==t.next;)if(h=t.prev,l=t.next,s?Op(t,n,r,s):Dp(t))e.push(h.i/i),e.push(t.i/i),e.push(l.i/i),qp(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?Pp(t=Fp(t,e,i),e,i,n,r,s,2):2===a&&Lp(t,e,i,n,r,s):Pp(Bp(t),e,i,n,r,s,1);break}}}function Dp(t){var e=t.prev,i=t,n=t.next;if(zp(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(Vp(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&zp(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Op(t,e,i,n){var r=t.prev,s=t,a=t.next;if(zp(r,s,a)>=0)return!1;for(var o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,u=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,c=Up(o,h,e,i,n),d=Up(l,u,e,i,n),_=t.nextZ;_&&_.z<=d;){if(_!==t.prev&&_!==t.next&&Vp(r.x,r.y,s.x,s.y,a.x,a.y,_.x,_.y)&&zp(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(_=t.prevZ;_&&_.z>=c;){if(_!==t.prev&&_!==t.next&&Vp(r.x,r.y,s.x,s.y,a.x,a.y,_.x,_.y)&&zp(_.prev,_,_.next)>=0)return!1;_=_.prevZ}return!0}function Fp(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!Xp(r,s)&&Wp(r,n,n.next,s)&&Yp(r,s)&&Yp(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),qp(n),qp(n.next),n=t=s),n=n.next}while(n!==t);return n}function Lp(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Hp(a,o)){var h=jp(a,o);return a=Bp(a,a.next),h=Bp(h,h.next),Pp(a,e,i,n,r,s),void Pp(h,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function Np(t,e){return t.x-e.x}function kp(t,e){if(e=function(t,e){var i=e,n=t.x,r=t.y,s=-1/0,a=null;do{if(r<=i.y&&r>=i.next.y){var o=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>s){if(s=o,o===n){if(r===i.y)return i;if(r===i.next.y)return i.next}a=i.x=i.x&&i.x>=u&&Vp(ra.x)&&Yp(i,t)&&(a=i,d=h),i=i.next;return a}(t,e)){var i=jp(e,t);Bp(i,i.next)}}function Up(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Gp(t){var e=t,i=t;do{e.x=0&&(t-a)*(n-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(r-a)*(n-o)>=0}function Hp(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Wp(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&Yp(t,e)&&Yp(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function zp(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Xp(t,e){return t.x===e.x&&t.y===e.y}function Wp(t,e,i,n){return!!(Xp(t,e)&&Xp(i,n)||Xp(t,n)&&Xp(i,e))||zp(t,e,i)>0!=zp(t,e,n)>0&&zp(i,n,t)>0!=zp(i,n,e)>0}function Yp(t,e){return zp(t.prev,t,t.next)<0?zp(t,e,t.next)>=0&&zp(t,t.prev,e)>=0:zp(t,e,t.prev)<0||zp(t,t.next,e)<0}function jp(t,e){var i=new Mp(t.i,t.x,t.y),n=new Mp(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function Kp(t,e,i,n){var r=new Mp(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function qp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Zp(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=Ip(t,0,r,i,!0),a=[];if(!s)return a;var o=0,h=0,l=0,u=0,c=0,d=0,_=0;if(n&&(s=function(t,e,i,n){var r,s=[],a=0,o=null;for(a=0,r=e.length;a80*i){o=l=t[0],h=u=t[1];for(var f=i;fl&&(l=c),d>u&&(u=d);_=Math.max(l-o,u-h)}return Pp(s,a,i,o,h,_),a}for(var Qp=Math.PI,Jp=Math.min,$p=Math.max,tg=Math.ceil,eg=Math.acos,ig=Math.cos,ng=Math.sin,rg=Math.atan2,sg=null,ag=null,og=new Ve,hg=[],lg=0;lg<4;lg++)hg.push(new ji);function ug(t,e,i){return ti?i:t}var cg={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!ag)return null;var i=ag.getRenderDataList(),n=i[ag.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++ag.dataOffset,ag.dataOffset0&&(r=1/e);for(var s=t.paths,a=t.pathOffset,o=t.pathLength;a1e-6){var T=1/f;T>600&&(T=600),d.dmx*=T,d.dmy*=T}d.dx*c.dy-c.dx*d.dy>0&&(d.flags|=pc.PT_LEFT),f*(p=$p(11,Jp(c.len,d.len)*r))*p<1&&(d.flags|=pc.PT_INNERBEVEL),d.flags&pc.PT_CORNER&&(f*n*n<1||i===fc.BEVEL||i===fc.ROUND)&&(d.flags|=pc.PT_BEVEL),0!=(d.flags&(pc.PT_BEVEL|pc.PT_INNERBEVEL))&&h.bevel++,c=d,d=l[_+1]}}},_flattenPaths:function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var h=0,l=s.length;hg&&(m-=2*Qp),this._vSet(d,_,1),this._vSet(l-s*n,e.y-a*n,-1);for(var v=ug(tg((g-m)/Qp)*r,2,r),y=0;y0&&n>0&&T+l.w*Dg>Yg&&!mh(c)){Eg.push(a),a=0,i++,n=0,r-=Vg*this._getFontScale()+0,m=!0;break}bg.x=T,bg.y=r-l.offsetY*Dg,this._recordLetterInfo(bg,c,y,i),y+1bg.y-l.h*Dg&&(f=bg.y-l.h*Dg)}else this._recordPlaceholderInfo(y,c),console.log("Can't find letter definition in texture atlas "+xg.atlasName+" for letter:"+c);else this._recordPlaceholderInfo(y,c)}m||(n=g,o<_&&(o=_),h>f&&(h=f),s<(a=p)&&(s=a),u+=d)}else Eg.push(a),a=0,i++,n=0,r-=Vg*this._getFontScale()+0,this._recordPlaceholderInfo(u,c),u++}return Eg.push(a),Mg=(wg=i+1)*Vg*this._getFontScale(),wg>1&&(Mg+=0*(wg-1)),Rg.width=Xg,Rg.height=Wg,Xg<=0&&(Rg.width=parseFloat(s.toFixed(2))+2*Bh.margin),Wg<=0&&(Rg.height=parseFloat(Mg.toFixed(2))+2*Bh.margin),Bg=Rg.height,Pg=0,o>0&&(Bg=Rg.height+o),h<-Mg&&(Pg=Mg+h),!0},_getFirstCharLen:function(){return 1},_getFontScale:function(){return Hg===bu.SHRINK?Dg:1},_getFirstWordLen:function(t,e,i){var n=t.charAt(e);if(gh(n)||"\n"===n||mh(n))return 1;var r=1,s=Bh.fontAtlas.getLetterDefinitionForChar(n,Bh);if(!s)return r;for(var a=s.xAdvance*Dg+Gg,o=e+1;oYg&&!mh(n)&&Yg>0)return r;if(a+=s.xAdvance*Dg+Gg,"\n"===n||mh(n)||gh(n))break;r++}return r},_multilineTextWrapByWord:function(){return this._multilineTextWrap(this._getFirstWordLen)},_multilineTextWrapByChar:function(){return this._multilineTextWrap(this._getFirstCharLen)},_recordPlaceholderInfo:function(t,e){if(t>=Sg.length){var i=new fg;Sg.push(i)}Sg[t].char=e,Sg[t].hash=""+e.charCodeAt(0)+Bh.hash,Sg[t].valid=!1},_recordLetterInfo:function(t,e,i,n){if(i>=Sg.length){var r=new fg;Sg.push(r)}var s=""+e.charCodeAt(0)+Bh.hash;Sg[i].line=n,Sg[i].char=e,Sg[i].hash=s,Sg[i].valid=Bh.fontAtlas.getLetter(s).valid,Sg[i].x=t.x,Sg[i].y=t.y},_alignText:function(){Mg=0,Eg.length=0,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),Hg===bu.SHRINK&&Lg>0&&this._isVerticalClamp()&&this._shrinkLabelToContentSize(this._isVerticalClamp),this._updateQuads()||Hg===bu.SHRINK&&this._shrinkLabelToContentSize(this._isHorizontalClamp)},_scaleFontSizeDown:function(t){var e=!0;t||(t=.1,e=!1),Lg=t,e&&this._updateContent()},_shrinkLabelToContentSize:function(t){for(var e=0,i=0|Lg,n=0;e>1;if(r<=0)break;Dg=r/Ng,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),t()?i=n-1:e=n}e>=0&&this._scaleFontSizeDown(e)},_isVerticalClamp:function(){return Mg>Rg.height},_isHorizontalClamp:function(){for(var t=!1,e=0,i=Fg.length;e0)if(zg){if(Eg[a]>Rg.width&&(s>Rg.width||s<0)){t=!0;break}}else if(s>Rg.width){t=!0;break}}}return t},_isHorizontalClamped:function(t,e){var i=Eg[e],n=t>Rg.width||t<0;return zg?i>Rg.width&&n:n},_updateQuads:function(){if(!vg)return!1;var t=Og?Og.texture:Bh.fontAtlas.getTexture(),e=vg.renderData;e.dataLength=0,e.resize(0,0);for(var i=yg.anchorPoint,n=Rg,r=i.x*n.width,s=i.y*n.height,a=!0,o=0,h=Fg.length;o0){if(c>Bg){var d=c-Bg;pg.y+=d,pg.height-=d,c-=d}c-pg.height*Dg0&&this._isHorizontalClamped(f,_))if(Hg===bu.CLAMP)pg.width=0;else if(Hg===bu.SHRINK){if(Rg.width>u.w){a=!1;break}pg.width=0}if(pg.height>0&&pg.width>0){var p=this._determineRect(),g=l.x+Ag[l.line];this.appendQuad(vg,t,pg,p,g-r,c-s,Dg)}}else console.warn("Can't find letter in this bitmap-font")}}var m=e.indexCount;return this.createQuadIndices(m),e.chunk.setIndexBuffer(_g),a},createQuadIndices:function(t){if(t%6==0){var e=t/6;_g=null,_g=new Uint16Array(t);for(var i=0,n=0;n0&&(n=n+e.margin+e.out.toHEX()),""+e.fontSize+e.fontFamily+i+n)},_getFontDesc:function(){return Bh.fontSize.toString()+"px "+Bh.fontFamily},_computeHorizontalKerningForText:function(){},_determineRect:function(){return!1}}),Jg=new Ve(255,255,255,255),$g={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){if(t.renderData){var e=t.node;Jg.a=255*e._uiProps.opacity,Wa(e,0,t.renderData,Jg)}},appendQuad:qg.appendQuad};Lr($g,Qg);var tm=Mu.Overflow,em=(1/255).toFixed(3),im=null,nm=null,rm=null,sm="",am="",om=0,hm=0,lm=[],um=new dn,cm=0,dm=0,_m=0,fm=new Ve,pm="",gm=tm.NONE,mm=!1,vm=null,ym=Ve.BLACK.clone(),Tm=null,Sm=Ve.BLACK.clone(),Em=new un,Am=dn.ZERO.clone(),Cm=dn.ZERO.clone(),Rm=cn.ZERO.clone(),bm=cn.ZERO.clone(),xm=0,wm=0,Mm=!1,Im=!1,Bm=!1,Pm=["left","center","right"],Dm={getAssemblerData:function(){var t=Mu._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&Mu._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp;this._updateFontFamily(t),this._updateProperties(t,e),this._calculateLabelFont(),this._updateLabelDimensions(),this._updateTexture(t),this._calDynamicAtlas(t),t.actualFontSize=om,e.setContentSize(um),this.updateVertexData(t),this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=Cm.width,im=null,nm=null,rm=null}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},updateVertexData:function(){},updateUVs:function(){},_updateFontFamily:function(t){pm=t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},_updateProperties:function(t,e){var i=t.assemblerData;i&&(im=i.context,nm=i.canvas,rm=t.spriteFrame,am=t.string.toString(),om=t.fontSize,hm=om,gm=t.overflow,Cm.width=um.width=e.width,Cm.height=um.height=e.height,wm=t.underlineHeight,cm=t.lineHeight,dm=t.horizontalAlign,_m=t.verticalAlign,fm=t.color,t.node._uiProps.opacity,Mm=t.isBold,Im=t.isItalic,Bm=t.isUnderline,mm=gm!==tm.NONE&&(gm===tm.RESIZE_HEIGHT||t.enableWrapText),(vm=(vm=C_&&t.getComponent(C_))&&vm.enabled&&vm.width>0?vm:null)&&ym.set(vm.color),(Tm=(Tm=xp&&t.getComponent(xp))&&Tm.enabled?Tm:null)&&Sm.set(Tm.color),this._updatePaddingRect())},_updatePaddingRect:function(){var t=0,e=0,i=0,n=0,r=0;if(Am.width=Am.height=0,vm&&(t=e=i=n=r=vm.width,Am.width=Am.height=2*r),Tm){var s=Tm.blur+r,a=Tm.offset.x,o=Tm.offset.y;i=Math.max(i,-a+s),n=Math.max(n,a+s),t=Math.max(t,o+s),e=Math.max(e,-o+s)}if(Im){var h=hm*Math.tan(.20943951);n+=h,Am.width+=h}Em.x=i,Em.y=t,Em.width=i+n,Em.height=t+e},_calculateFillTextStartPosition:function(){var t=0;dm===Cu.RIGHT?t=um.width-Em.width:dm===Cu.CENTER&&(t=(um.width-Em.width)/2);var e=this._getLineHeight()*(lm.length-1),i=om*(1-ah/2);if(_m!==Ru.TOP){var n=e+Em.height+om-um.height;_m===Ru.BOTTOM?i-=n+=ah/2*om:i-=n/2}i+=0*om,Rm.set(t+Em.x,i+Em.y)},_updateTexture:function(t){if(im&&nm){im.clearRect(0,0,nm.width,nm.height),im.font=sm,this._calculateFillTextStartPosition();var e=this._getLineHeight();im.lineJoin="round",vm?(im.fillStyle="rgba("+ym.r+", "+ym.g+", "+ym.b+", "+em+")",im.fillRect(0,0,nm.width,nm.height)):t._srcBlendFactor===I.SRC_ALPHA&&(im.fillStyle="rgba("+fm.r+", "+fm.g+", "+fm.b+", "+em+")",im.fillRect(0,0,nm.width,nm.height)),im.fillStyle="rgb("+fm.r+", "+fm.g+", "+fm.b+")";var i=Rm.x,n=0;this._drawTextEffect(Rm,e);for(var r=0;r1&&Tm,n=this._measureText(im,sm),r=0,s=0;Tm&&this._setupShadow(),vm&&this._setupOutline();for(var a=0;a>1)<=0){kr(4003);break}om=l,sm=this._getFontDesc(),im.font=sm;var u=this._getLineHeight();for(n=0,i=0;ia?h=l-1:o=l}0===o?kr(4003):(om=o,sm=this._getFontDesc(),im.font=sm)}else{for(n=t.length*this._getLineHeight(),i=0;ir?e:r}i=(lm.length+ah)*this._getLineHeight();var s=parseFloat(e.toFixed(2)),a=parseFloat(i.toFixed(2));um.width=s+Em.width,um.height=a+Em.height,Cm.width=s+Am.width,Cm.height=a+Am.height;break;case tm.SHRINK:this._calculateShrinkFont(t),this._calculateWrapText(t);break;case tm.CLAMP:this._calculateWrapText(t);break;case tm.RESIZE_HEIGHT:this._calculateWrapText(t);var o=(lm.length+ah)*this._getLineHeight();um.height=o+Em.height,Cm.height=o+Am.height}}}},Om=Ve.WHITE.clone(),Fm=Uint16Array.from([0,1,2,1,3,2]),Lm={createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6);var i=e.chunk.vb;i[3]=i[21]=i[22]=i[31]=0,i[4]=i[12]=i[13]=i[30]=1;for(var n=5,r=0;r<4;r++)Ve.toArray(i,Om,n),n+=9;return e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(Fm),e},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,a=r.worldMatrix,o=e.floatStride,h=0,l=n.length,u=0;u1?1:r)<0?0:r;var s=(n=(n=n>1?1:n)<0?0:n)+(r=(r-=n)<0?0:r);s=s>1?1:s,this.updateUVs(t,n,s),this.updateVertexData(t,n,s),i.updateRenderData(t,e)}},updateUVs:function(t,e,i){var n=t.spriteFrame,r=t.renderData.chunk.vb,s=n.width,a=n.height,o=n.rect,h=0,l=0,u=0,c=0,d=0,_=0,f=0,p=0,g=0,m=0;switch(n.isRotated()?(h=o.x/s,l=(o.y+o.width)/a,u=d=h,f=g=(o.x+o.height)/s,_=m=l,c=p=o.y/a):(h=o.x/s,l=(o.y+o.height)/a,u=f=h,d=g=(o.x+o.width)/s,c=_=l,p=m=o.y/a),t.fillType){case Um.HORIZONTAL:r[3]=u+(d-u)*e,r[4]=c+(_-c)*e,r[12]=u+(d-u)*i,r[13]=c+(_-c)*i,r[21]=f+(g-f)*e,r[22]=p+(m-p)*e,r[30]=f+(g-f)*i,r[31]=p+(m-p)*i;break;case Um.VERTICAL:r[3]=u+(f-u)*e,r[4]=c+(p-c)*e,r[12]=d+(g-d)*e,r[13]=_+(m-_)*e,r[21]=u+(f-u)*i,r[22]=c+(p-c)*i,r[30]=d+(g-d)*i,r[31]=_+(m-_)*i;break;default:hn(2626)}},updateVertexData:function(t,e,i){var n=t.renderData.data,r=t.node._uiProps.uiTransformComp,s=r.width,a=r.height,o=r.anchorX*s,h=r.anchorY*a,l=-o,u=-h,c=s-o,d=a-h,_=0;switch(t.fillType){case Um.HORIZONTAL:_=l+(c-l)*i,l+=(c-l)*e,c=_;break;case Um.VERTICAL:_=u+(d-u)*i,u+=(d-u)*e,d=_;break;default:hn(2626)}n[0].x=l,n[0].y=u,n[1].x=c,n[1].y=u,n[2].x=l,n[2].y=d,n[3].x=c,n[3].y=d},createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(Vm);for(var i,n=e.data,r=Fi(n);!(i=r()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(Gm);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,a=0;a<4;a++){var o=n[a],h=o.x,l=o.y,u=Gm.m03*h+Gm.m07*l+Gm.m15;u=u?Math.abs(1/u):1,r[s=a*i]=(Gm.m00*h+Gm.m04*l+Gm.m12)*u,r[s+1]=(Gm.m01*h+Gm.m05*l+Gm.m13)*u,r[s+2]=(Gm.m02*h+Gm.m06*l+Gm.m14)*u}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t.node.hasChangedFlags||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1),i.bufferId;var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset;s[a++]=n,s[a++]=n+1,s[a++]=n+2,s[a++]=n+2,s[a++]=n+1,s[a++]=n+3,r.indexOffset+=6},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,h=s.b/255,l=t.node._uiProps.opacity,u=0;u<4;u++)i[r]=a,i[r+1]=o,i[r+2]=h,i[r+3]=l,r+=n}},zm=2*Math.PI,Xm=1e-6,Wm=new Ue,Ym=[new cn,new cn,new cn,new cn],jm=new Array(4),Km=new Array(8),qm=[new cn,new cn,new cn,new cn],Zm=[new cn,new cn,new cn,new cn],Qm=new cn,Jm=[new cn,new cn,new cn,new cn];function $m(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>Xm?o:0;var h=Math.cos(s),l=0,u=0;if(0!==(h=Math.abs(h)>Xm?h:0)){if(l=o/h,(t-r.x)*h>0){var c=r.y+l*(t-r.x);a[0].x=t,a[0].y=c}if((e-r.x)*h>0){var d=r.y+l*(e-r.x);a[2].x=e,a[2].y=d}}if(0!==o){if(u=h/o,(n-r.y)*o>0){var _=r.x+u*(n-r.y);a[3].x=_,a[3].y=n}if((i-r.y)*o>0){var f=r.x+u*(i-r.y);a[1].x=f,a[1].y=i}}}function tv(t,e){var i=e.x-t.x,n=e.y-t.y;if(0===i&&0===n)return 0;if(0===i)return n>0?.5*Math.PI:1.5*Math.PI;var r=Math.atan(n/i);return i<0&&(r+=Math.PI),r}function ev(t,e,i,n,r){var s=jm,a=s[0],o=s[1],h=s[2],l=s[3];t[e].x=i.x,t[e].y=i.y,t[e+1].x=n.x,t[e+1].y=n.y,t[e+2].x=r.x,t[e+2].y=r.y,iv((i.x-a)/(h-a),(i.y-o)/(l-o),t,e),iv((n.x-a)/(h-a),(n.y-o)/(l-o),t,e+1),iv((r.x-a)/(h-a),(r.y-o)/(l-o),t,e+2)}function iv(t,e,i,n){var r=Km,s=r[0]+(r[2]-r[0])*t,a=r[4]+(r[6]-r[4])*t,o=r[1]+(r[3]-r[1])*t,h=r[5]+(r[7]-r[5])*t,l=i[n];l.u=s+(a-s)*e,l.v=o+(h-o)*e}for(var nv={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;Ja.packToDynamicAtlas(t,e),this.updateUVs(t);var i,n,r,s,a,o,h,l,u,c=t.renderData;if(c&&e){if(!c.vertDirty)return;var d=c.data,_=t.fillStart,f=t.fillRange;for(f<0&&(_+=f,f=-f);_>=1;)_-=1;for(;_<0;)_+=1;var p=(_*=zm)+(f*=zm);!function(t){var e=t.node._uiProps.uiTransformComp,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,a=-r,o=-s,h=i-r,l=n-s,u=jm;u[0]=a,u[1]=o,u[2]=h,u[3]=l;var c=t.fillCenter,d=Qm.x=Math.min(Math.max(0,c.x),1)*(h-a)+a,_=Qm.y=Math.min(Math.max(0,c.y),1)*(l-o)+o;Ym[0].x=Ym[3].x=a,Ym[1].x=Ym[2].x=h,Ym[0].y=Ym[1].y=o,Ym[2].y=Ym[3].y=l;for(var f,p=Fi(Jm);!(f=p()).done;){var g=f.value;cn.set(g,0,0)}d!==u[0]&&cn.set(Jm[0],3,0),d!==u[2]&&cn.set(Jm[2],1,2),_!==u[1]&&cn.set(Jm[1],0,1),_!==u[3]&&cn.set(Jm[3],2,3)}(t),n=(i=e).width,r=i.height,s=i.getRect(),a=0,o=0,h=0,l=0,u=Km,i.isRotated()?(a=s.x/n,o=(s.x+s.height)/n,h=s.y/r,l=(s.y+s.width)/r,u[0]=u[2]=a,u[4]=u[6]=o,u[3]=u[7]=l,u[1]=u[5]=h):(a=s.x/n,o=(s.x+s.width)/n,h=s.y/r,l=(s.y+s.height)/r,u[0]=u[4]=a,u[2]=u[6]=o,u[1]=u[3]=l,u[5]=u[7]=h),$m(jm[0],jm[2],jm[1],jm[3],Qm,_,qm),$m(jm[0],jm[2],jm[1],jm[3],Qm,_+f,Zm);for(var g=0,m=0;m<4;++m){var v=Jm[m];if(v)if(f>=zm)c.dataLength=g+3,ev(d,g,Qm,Ym[v.x],Ym[v.y]),g+=3;else{var y=tv(Qm,Ym[v.x]),T=tv(Qm,Ym[v.y]);T=p||(y>=_?(c.dataLength=g+3,ev(d,g,Qm,Ym[v.x],T>=p?Zm[m]:Ym[v.y]),g+=3):T>_&&(T<=p?(c.dataLength=g+3,ev(d,g,Qm,qm[m],Ym[v.y]),g+=3):(c.dataLength=g+3,ev(d,g,Qm,qm[m],Zm[m]),g+=3))),y+=zm,T+=zm}}0===g&&(c.dataLength=0),c.resize(g,g),c.updateRenderData(t,e)}},createQuadIndices:function(t){km=null,km=new Uint16Array(t);for(var e=0,i=0;i1?1:p,g=Number.isNaN(g)||g>1?1:g,_=_<0?0:_,f=f<0?0:f,ov[0].x=-a,ov[0].y=-o,ov[1].x=l*p-a,ov[1].y=d*g-o,ov[2].x=ov[1].x+_,ov[2].y=ov[1].y+f,ov[3].x=r-a,ov[3].y=s-o;for(var m=0;m0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var Ev={createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.renderData,i=t.spriteFrame;if(i&&e&&e.vertDirty){var n=t.node._uiProps.uiTransformComp,r=Math.abs(n.width),s=Math.abs(n.height),a=i.getRect(),o=i.insetLeft,h=i.insetRight,l=a.width-o-h,u=i.insetTop,c=i.insetBottom,d=a.height-u-c,_=r-o-h,f=s-u-c;_=_>0?_:0,f=f>0?f:0;var p=0===l?_:_/l,g=0===d?f:f/d,m=Sv(i),v=Math.ceil(g+m),y=Math.ceil(p+m);e.dataLength=4*v*y,this.updateVerts(t,_,f,v,y),e.vertexCount!==v*y*4&&(t.renderEntity.colorDirty=!0),e.resize(v*y*4,v*y*6),e.updateRenderData(t,i)}},createQuadIndices:function(t){if(t%6==0){var e=t/6;gv=null,gv=new Uint16Array(t);for(var i=0,n=0;n1?1:o.width/(p+g),E=o.height/(v+y)>1?1:o.height/(v+y);s=m>0?Math.floor(1e3*e)/1e3%m==0?m:e%m:e,a=T>0?Math.floor(1e3*i)/1e3%T==0?T:i%T:i,yv=Math.max(n+1,r+1);for(var A=0;A=r?c-_:R*m-_,Tv[R].y=R>=n?d-f:R*T-f;else for(var b=0;b1&&b0?p*S-_+m*(b-1):p+e-_:b===r-1?Tv[b].x=p*S-_+s+m*(b-2):b>=r&&(Tv[b].x=Math.min(p+e+g,c)-_),0===b?Tv[b].y=-f:1===b?Tv[b].y=y*E-f:b>1&&b0?y*E-f+T*(b-1):y+i-f:b===n-1?Tv[b].y=y*E-f+a+T*(b-2):b>=n&&(Tv[b].y=Math.min(y+i+v,d)-f);for(var x=0,w=0,M=0,I=0,B=0;BT?i>=(C>0?H:H+1)*T?1:U%1:U;for(var z=0;zm?e>=(C>0?z:z+1)*m?1:k%1:k,O?(0===C?(G[0]=_v.u,G[1]=_v.u,G[2]=_v.u+(fv.u-_v.u)*N,V[0]=uv.v,V[1]=uv.v+(cv.v-uv.v)*L,V[2]=uv.v):(0===H?(G[0]=lv.u,G[1]=lv.u,G[2]=_v.u):H0){var o=a.claimedTouchIdList.indexOf(n.getID());if(-1!==o){if(a._handleEventTouch(t),t.type!==Xr.TOUCH_END&&t.type!==Xr.TOUCH_CANCEL||Wr(a.claimedTouchIdList,o),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._updatePointerEventProcessorList=function(){for(var t=this._processorListToAdd,e=t.length,i=0;ie)for(;e0&&(this._meshDataArray.forEach((function(t){t.uploadBuffers()})),this._bufferAccessors.forEach((function(t){t.uploadBuffers(),t.reset()})),this._descriptorSetCache.update())},i.reset=function(){for(var t=0;t0){!function(t,e){for(var i,n,r,s=t.vertexFormat,a=t.chunk.vb,o=0,h=0;h>>0;else if(n.size/n.count==4)for(var c=o+3;c>2}}(r.renderData,a);var h=r.renderData.getMeshBuffer();h&&h.setDirty()}if(i.length>0&&!t._static)for(var l=0;l0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),nl.sharedManager.exitMask())),e+=1}},i._screenSort=function(t,e){return t.node.getSiblingIndex()-e.node.getSiblingIndex()},i._releaseDescriptorSetCache=function(t){this._descriptorSetCache.releaseDescriptorSetCache(t)},i._createClearModel=function(){if(!this._maskClearModel){this._maskClearMtl=Nn.get("default-clear-stencil"),this._maskClearModel=We.director.root.createModel(ni);var t=Uh(Ph),e=ke.gfxDevice,i=e.createBuffer(new ft(g.VERTEX|g.TRANSFER_DST,y.DEVICE,4*t,t)),n=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]);i.update(n);var r=e.createBuffer(new ft(g.INDEX|g.TRANSFER_DST,y.DEVICE,6*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),s=new Uint16Array([0,1,2,2,1,3]);r.update(s),this._maskModelMesh=new qi([i],Ph,U.TRIANGLE_LIST,r),this._maskModelMesh.subMeshIdx=0,this._maskClearModel.initSubModel(0,this._maskModelMesh,this._maskClearMtl)}},i._insertMaskBatch=function(t){this.autoMergeBatches(this._currComponent),this.resetRenderStates(),this._createClearModel(),this._maskClearModel.node=this._maskClearModel.transform=t.node;var e=nl.sharedManager;e.pushMask(1);var i,n=e.clear(t),r=0,s=this._maskClearMtl;s&&(i=e.getStencilStage(n,s),r=e.getStencilHash(n));var a=this._maskClearModel,o=We.director.getTotalFrames();a&&(a.updateTransform(o),a.updateUBOs(o));for(var h=0;h=0;i--)t.splice(e[i],1)},i.reset=function(){var t=this;this._localDescriptorSetCache.forEach((function(e){t._localCachePool.free(e)})),this._localDescriptorSetCache.length=0},i.releaseDescriptorSetCache=function(t){var e=this._dsCacheHashByTexture.get(t);e&&this._descriptorSetCache.has(e)&&(this._descriptorSetCache.get(e).destroy(),this._descriptorSetCache.delete(e),this._dsCacheHashByTexture.delete(t))},i.destroy=function(){this._descriptorSetCache.forEach((function(t){t.destroy()})),this._descriptorSetCache.clear(),this._dsCacheHashByTexture.clear(),this._localDescriptorSetCache.length=0,this._localCachePool.destroy()},t}();We.internal.Batcher2D=Iv,t("UIDrawBatch",function(t){function e(){return t.apply(this,arguments)||this}return He(e,t),e}(Rp)),Rr(Xh.prototype,"MeshBuffer",["byteStart","vertexStart","indicesStart","request"].map((function(t){return{name:t,suggest:"please use meshBuffer.accessor."+t+" instead"}}))),zn(Xh.prototype,"MeshBuffer",[{name:"indicesOffset",newName:"indexOffset"}]),Vn(Xh.prototype,"MeshBuffer",[{name:"vertexBuffers"},{name:"indexBuffer"}]),zn(Iv.prototype,"Batcher2D",[{name:"currBufferBatch",newName:"currBufferAccessor"},{name:"acquireBufferBatch",newName:"switchBufferAccessor"}]),Vn(El.prototype,"MeshRenderData",[{name:"formatByte"},{name:"byteStart"},{name:"byteCount"}]),zn(El.prototype,"MeshRenderData",[{name:"indicesStart",newName:"indexStart"}]),t("QuadRenderData",function(t){function e(e){var i;return i=t.call(this,e)||this,Zi(9006),i}return He(e,t),e}(El));var Dv,Ov=ln.document,Fv=null,Lv=-1,Nv="BES bswy:->@123丁ぁᄁ",kv=Object.create(null),Uv=[],Gv=3e3;function Vv(){for(var t=!0,e=Date.now(),i=Uv.length-1;i>=0;i--){var n=Uv[i],r=n.fontFamilyName;if(e-n.startTime>Gv)Zi(4933,r),n.onComplete(null,r),Uv.splice(i,1);else{var s=n.refWidth,a="40px "+r;Fv.font=a,s!==vh(Fv,Nv,a)?(Uv.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(Lv),Lv=-1)}function Hv(t,e,i){var n=function(t){var e=t.lastIndexOf(".ttf");if(-1===e)return t;var i,n=t.lastIndexOf("/");return-1!==(i=-1===n?t.substring(0,e)+"_LABEL":t.substring(n+1,e)+"_LABEL").indexOf(" ")&&(i='"'+i+'"'),i}(t);if(kv[n])i(null,n);else{if(!Fv){var r=Ov.createElement("canvas");r.width=100,r.height=100,Fv=r.getContext("2d")}var s=vh(Fv,Nv,"40px "+n),a=Ov.createElement("style");a.type="text/css";var o="";Number.isNaN(n)?o+="@font-face { font-family:"+n+"; src:":o+='@font-face { font-family:"'+n+'"; src:',o+='url("'+t+'");',a.textContent=o+"}",Ov.body.appendChild(a);var h,l,u,c,d,_,f=Ov.createElement("div"),p=f.style;if(p.fontFamily=n,f.innerHTML=".",p.position="absolute",p.left="-100px",p.top="-100px",Ov.body.appendChild(f),function(){if(void 0===Dv)if("FontFace"in ln){var t=/Gecko.*Firefox\/(\d+)/.exec(ln.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(ln.navigator.userAgent)&&/Apple/.exec(ln.navigator.vendor);Dv=t?parseInt(t[1],10)>42:!e}else Dv=!1;return Dv}())h=Date.now(),l=n,u=i,c=new Promise((function(t,e){!function i(){Date.now()-h>=Gv?e():Ov.fonts.load("40px "+l).then((function(e){e.length>=1?t():setTimeout(i,100)}),(function(){e()}))}()})),d=null,_=new Promise((function(t,e){d=setTimeout(e,Gv)})),Promise.race([_,c]).then((function(){d&&(clearTimeout(d),d=null),u(null,l)}),(function(){Zi(4933,l),u(null,l)}));else{var g={fontFamilyName:n,refWidth:s,onComplete:i,startTime:Date.now()};Uv.push(g),-1===Lv&&(Lv=setInterval(Vv,100))}kv[n]=a}}function zv(t,e,i,n){var r=new th;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}jr.register({".font":Hv,".eot":Hv,".ttf":Hv,".woff":Hv,".svg":Hv,".ttc":Hv}),Kr.register({".font":zv,".eot":zv,".ttf":zv,".woff":zv,".svg":zv,".ttc":zv}),We.UI={MeshBuffer:Xh,spriteAssembler:Rv,graphicsAssembler:dg,labelAssembler:Nm,RenderData:Sl,MeshRenderData:El},qr.on(Zr.EVENT_POST_SUBSYSTEM_INIT,(function(){Zv.init()}));var Xv,Wv,Yv,jv,Kv,qv,Zv=t("SortingLayers",function(){function t(){}return t.getSortingPriority=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),(t+32768<<16|e+32768)>>>0},t.getLayerIndex=function(t){void 0===t&&(t=0);var e=0;return this.indexMap.has(t)?e=this.indexMap.get(t):hn(2105),e},t.getLayerIndexByName=function(t){var e=this.getLayerByName(t);return this.getLayerIndex(e)},t.getLayerName=function(t){void 0===t&&(t=0);var e="";return this.nameMap.has(t)?e=this.nameMap.get(t):hn(2105),e},t.getLayerByName=function(t){for(var e=this.nameMap.size,i=this.nameMap.keys(),n=0,r=0;r=i.length||i[e].length===t.length&&(i[e]=t.slice(0),this._uploadSubMeshShapesWeights(e))},i.setWeight=function(t,e,i){var n=this._subMeshShapesWeights;if(!(e>=n.length)){var r=n[e];i>=r.length||(r[i]=t,this._uploadSubMeshShapesWeights(e))}},i.setInstancedAttribute=function(t,e){if(this.model)for(var i=this.model.subModels,n=0;n0&&this.bindposes.length>0},Pi(e,[{key:"joints",get:function(){return this._joints},set:function(t){this._joints=t}},{key:"bindposes",get:function(){return this._bindposes},set:function(t){this._bindposes=t}},{key:"inverseBindposes",get:function(){if(!this._invBindposes){this._invBindposes=[];for(var t=0;tci.LEVEL_1},set:function(t){this._csmLevel=t?ci.LEVEL_4:ci.LEVEL_1,this._light&&(this._light.csmLevel=this._csmLevel,this._light.csmNeedUpdate=!0)}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t,this._light&&(this._light.csmLayerLambda=this._csmLayerLambda,this._light.csmNeedUpdate=!0)}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t,this._light&&(this._light.csmOptimizationMode=this._csmOptimizationMode)}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this._light&&(this._light.shadowFixedArea=this._shadowFixedArea)}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t,this._light&&(this._light.shadowNear=this._shadowNear)}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,_i.MAX_FAR),this._light&&(this._light.shadowFar=this._shadowFar)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t,this._light&&(this._light.shadowOrthoSize=this._shadowOrthoSize)}},{key:"csmAdvancedOptions",get:function(){return this._csmAdvancedOptions},set:function(t){this._csmAdvancedOptions=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this._light&&(this._light.csmLayersTransition=t)}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t,this._light&&(this._light.csmTransitionRange=t)}}]),e}(hE),oS=tn(aS.prototype,"_illuminanceHDR",[lE,ET],(function(){return 65e3})),hS=tn(aS.prototype,"_illuminanceLDR",[uE],(function(){return 65e3*ei.standardExposureValue})),lS=tn(aS.prototype,"_shadowEnabled",[uE],(function(){return!1})),uS=tn(aS.prototype,"_shadowPcf",[uE],(function(){return ui.HARD})),cS=tn(aS.prototype,"_shadowBias",[uE],(function(){return 1e-5})),dS=tn(aS.prototype,"_shadowNormalBias",[uE],(function(){return 0})),_S=tn(aS.prototype,"_shadowSaturation",[uE],(function(){return 1})),fS=tn(aS.prototype,"_shadowDistance",[uE],(function(){return 50})),pS=tn(aS.prototype,"_shadowInvisibleOcclusionRange",[uE],(function(){return 200})),gS=tn(aS.prototype,"_csmLevel",[uE],(function(){return ci.LEVEL_4})),mS=tn(aS.prototype,"_csmLayerLambda",[uE],(function(){return.75})),vS=tn(aS.prototype,"_csmOptimizationMode",[uE],(function(){return di.RemoveDuplicates})),yS=tn(aS.prototype,"_csmAdvancedOptions",[uE],(function(){return!1})),TS=tn(aS.prototype,"_csmLayersTransition",[uE],(function(){return!1})),SS=tn(aS.prototype,"_csmTransitionRange",[uE],(function(){return.05})),ES=tn(aS.prototype,"_shadowFixedArea",[uE],(function(){return!1})),AS=tn(aS.prototype,"_shadowNear",[uE],(function(){return.1})),CS=tn(aS.prototype,"_shadowFar",[uE],(function(){return 10})),RS=tn(aS.prototype,"_shadowOrthoSize",[uE],(function(){return 5})),gn(aS.prototype,"visibility",[mn],Object.getOwnPropertyDescriptor(aS.prototype,"visibility"),aS.prototype),gn(aS.prototype,"shadowEnabled",[AT,CT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowEnabled"),aS.prototype),gn(aS.prototype,"shadowPcf",[RT,bT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowPcf"),aS.prototype),gn(aS.prototype,"shadowBias",[xT,wT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowBias"),aS.prototype),gn(aS.prototype,"shadowNormalBias",[MT,IT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowNormalBias"),aS.prototype),gn(aS.prototype,"shadowSaturation",[BT,PT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowSaturation"),aS.prototype),gn(aS.prototype,"shadowDistance",[DT,OT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowDistance"),aS.prototype),gn(aS.prototype,"shadowInvisibleOcclusionRange",[FT,LT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowInvisibleOcclusionRange"),aS.prototype),gn(aS.prototype,"csmLevel",[NT,kT],Object.getOwnPropertyDescriptor(aS.prototype,"csmLevel"),aS.prototype),gn(aS.prototype,"enableCSM",[UT,GT],Object.getOwnPropertyDescriptor(aS.prototype,"enableCSM"),aS.prototype),gn(aS.prototype,"csmLayerLambda",[VT,HT],Object.getOwnPropertyDescriptor(aS.prototype,"csmLayerLambda"),aS.prototype),gn(aS.prototype,"csmOptimizationMode",[zT,XT],Object.getOwnPropertyDescriptor(aS.prototype,"csmOptimizationMode"),aS.prototype),gn(aS.prototype,"shadowFixedArea",[WT,YT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowFixedArea"),aS.prototype),gn(aS.prototype,"shadowNear",[jT,KT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowNear"),aS.prototype),gn(aS.prototype,"shadowFar",[qT,ZT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowFar"),aS.prototype),gn(aS.prototype,"shadowOrthoSize",[QT,JT],Object.getOwnPropertyDescriptor(aS.prototype,"shadowOrthoSize"),aS.prototype),gn(aS.prototype,"csmAdvancedOptions",[$T,tS],Object.getOwnPropertyDescriptor(aS.prototype,"csmAdvancedOptions"),aS.prototype),gn(aS.prototype,"csmLayersTransition",[eS,iS],Object.getOwnPropertyDescriptor(aS.prototype,"csmLayersTransition"),aS.prototype),gn(aS.prototype,"csmTransitionRange",[nS,rS],Object.getOwnPropertyDescriptor(aS.prototype,"csmTransitionRange"),aS.prototype),sS=aS))||sS)),fE=function(e){return t({SphereLight:e,SphereLightComponent:e}),e}((bS=Ki("cc.SphereLight"),xS=is("_luminance"),wS=Tn(aE),bS((IS=function(t){function e(){var e;return(e=t.call(this)||this)._size=BS&&BS(),e._luminanceHDR=PS&&PS(),e._luminanceLDR=DS&&DS(),e._term=OS&&OS(),e._range=FS&&FS(),e._type=vi.SPHERE,e._light=null,e._lightType=Ei,e}return He(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this.size=this._size,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},Pi(e,[{key:"luminousFlux",get:function(){return We.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*yi(this._size):this._luminanceLDR},set:function(t){var e=0;We.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/yi(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return We.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){We.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(hE),BS=tn(IS.prototype,"_size",[en],(function(){return.15})),PS=tn(IS.prototype,"_luminanceHDR",[en,xS],(function(){return 1700/yi(.15)})),DS=tn(IS.prototype,"_luminanceLDR",[en],(function(){return 1700/yi(.15)*ei.standardExposureValue*ei.standardLightMeterScale})),OS=tn(IS.prototype,"_term",[en],(function(){return aE.LUMINOUS_FLUX})),FS=tn(IS.prototype,"_range",[en],(function(){return 1})),gn(IS.prototype,"term",[wS],Object.getOwnPropertyDescriptor(IS.prototype,"term"),IS.prototype),MS=IS))||MS)),pE=Tn,gE=en,mE=is,vE=rs,yE=function(e){return t({SpotLight:e,SpotLightComponent:e}),e}((LS=Ki("cc.SpotLight"),NS=mE("_luminance"),kS=pE(aE),US=vE({group:{name:"DynamicShadowSettings",displayOrder:1}}),GS=pE(Jr),VS=vE({group:{name:"DynamicShadowSettings",displayOrder:2}}),HS=pE(ui),zS=vE({group:{name:"DynamicShadowSettings",displayOrder:3}}),XS=pE($r),WS=vE({group:{name:"DynamicShadowSettings",displayOrder:4}}),YS=pE($r),LS((KS=function(t){function e(){var e;return(e=t.call(this)||this)._size=qS&&qS(),e._luminanceHDR=ZS&&ZS(),e._luminanceLDR=QS&&QS(),e._term=JS&&JS(),e._range=$S&&$S(),e._spotAngle=tE&&tE(),e._shadowEnabled=eE&&eE(),e._shadowPcf=iE&&iE(),e._shadowBias=nE&&nE(),e._shadowNormalBias=rE&&rE(),e._type=vi.SPOT,e._light=null,e._lightType=Ai,e}return He(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this.size=this._size,this.range=this._range,this.spotAngle=this._spotAngle,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR,this._light.shadowEnabled=this._shadowEnabled,this._light.shadowPcf=this._shadowPcf,this._light.shadowBias=this._shadowBias,this._light.shadowNormalBias=this._shadowNormalBias)},Pi(e,[{key:"luminousFlux",get:function(){return We.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*yi(this._size):this._luminanceLDR},set:function(t){var e=0;We.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/yi(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return We.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){We.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._spotAngle=t,this._light&&(this._light.spotAngle=mr(t))}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this._light&&(this._light.shadowEnabled=t)}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this._light&&(this._light.shadowPcf=t)}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._light&&(this._light.shadowBias=t)}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._light&&(this._light.shadowNormalBias=t)}}]),e}(hE),qS=tn(KS.prototype,"_size",[gE],(function(){return.15})),ZS=tn(KS.prototype,"_luminanceHDR",[gE,NS],(function(){return 1700/yi(.15)})),QS=tn(KS.prototype,"_luminanceLDR",[gE],(function(){return 1700/yi(.15)*ei.standardExposureValue*ei.standardLightMeterScale})),JS=tn(KS.prototype,"_term",[gE],(function(){return aE.LUMINOUS_FLUX})),$S=tn(KS.prototype,"_range",[gE],(function(){return 1})),tE=tn(KS.prototype,"_spotAngle",[gE],(function(){return 60})),eE=tn(KS.prototype,"_shadowEnabled",[gE],(function(){return!1})),iE=tn(KS.prototype,"_shadowPcf",[gE],(function(){return ui.HARD})),nE=tn(KS.prototype,"_shadowBias",[gE],(function(){return 1e-5})),rE=tn(KS.prototype,"_shadowNormalBias",[gE],(function(){return 0})),gn(KS.prototype,"term",[kS],Object.getOwnPropertyDescriptor(KS.prototype,"term"),KS.prototype),gn(KS.prototype,"shadowEnabled",[US,GS],Object.getOwnPropertyDescriptor(KS.prototype,"shadowEnabled"),KS.prototype),gn(KS.prototype,"shadowPcf",[VS,HS],Object.getOwnPropertyDescriptor(KS.prototype,"shadowPcf"),KS.prototype),gn(KS.prototype,"shadowBias",[zS,XS],Object.getOwnPropertyDescriptor(KS.prototype,"shadowBias"),KS.prototype),gn(KS.prototype,"shadowNormalBias",[WS,YS],Object.getOwnPropertyDescriptor(KS.prototype,"shadowNormalBias"),KS.prototype),jS=KS))||jS));We.LightComponent=hE,br(hE,"cc.LightComponent"),We.DirectionalLightComponent=_E,br(_E,"cc.DirectionalLightComponent"),We.SphereLightComponent=fE,br(fE,"cc.SphereLightComponent"),We.SpotLightComponent=yE,br(yE,"cc.SpotLightComponent"),zn(yE.prototype,"SpotLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),zn(fE.prototype,"SphereLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),zn(hE.PhotometricTerm,"Light.PhotometricTerm",[{name:"LUMINOUS_POWER",newName:"LUMINOUS_FLUX"}]);var TE=Symbol("BakeNodeCurves"),SE=function(){function t(){}return t.getOrExtract=function(e){var i=t.pool.get(e);if(!i||i.samples!==e.sample){i&&We.director.root.dataPoolManager.releaseAnimationClip(e);var n=Math.ceil(e.sample*e.duration)+1,r=e.sample;i=e[TE](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}();SE.pool=new Map;var EE=new Ue;function AE(t,e,i){for(Ue.identity(i);t!==e;)Ue.fromRTS(EE,t.rotation,t.position,t.scale),Ue.multiply(i,EE,i),t=t.parent;return i}var CE=new St(b.POINT,b.POINT,b.NONE,x.CLAMP,x.CLAMP,x.CLAMP),RE=function(t,e,i){t[e+0]=i.m00,t[e+1]=i.m01,t[e+2]=i.m02,t[e+3]=i.m12,t[e+4]=i.m04,t[e+5]=i.m05,t[e+6]=i.m06,t[e+7]=i.m13,t[e+8]=i.m08,t[e+9]=i.m09,t[e+10]=i.m10,t[e+11]=i.m14};function bE(t,e){var i=4/Math.sqrt(e);return 12*Math.ceil(Math.max(480*i,t)/12)}new Ji,new Ji,new ji,new Ji,new ji;var xE=new ji,wE=new ji,ME=new ji,IE=new ji,BE=new Ue,PE=new Ue,DE=new Qi,OE=Number.MAX_SAFE_INTEGER,FE=(function(){function t(t){this._device=void 0,this._pool=void 0,this._textureBuffers=new Map,this._formatSize=void 0,this._pixelsPerJoint=void 0,this._customPool=void 0,this._chunkIdxMap=new Map,this._device=t;var e=function(t){return t.getFormatFeatures(_.RGBA32F)&A.SAMPLED_TEXTURE?_.RGBA32F:_.RGBA8}(this._device);this._formatSize=ne[e].size,this._pixelsPerJoint=48/this._formatSize,this._pool=new Wu(t),this._pool.initialize({format:e,roundUpFn:bE}),this._customPool=new Wu(t),this._customPool.initialize({format:e,roundUpFn:bE})}var e=t.prototype;e.clear=function(){this._pool.destroy(),this._textureBuffers.clear()},e.registerCustomTextureLayouts=function(t){for(var e=0;e0&&t.refCount--,!t.refCount&&t.readyToBeDeleted){var e=t.skeletonHash^t.clipHash;(void 0!==this._chunkIdxMap.get(e)?this._customPool:this._pool).free(t.handle),this._textureBuffers.get(e)===t&&this._textureBuffers.delete(e)}},e.releaseSkeleton=function(t){for(var e=this._textureBuffers.values(),i=e.next();!i.done;){var n=i.value;n.skeletonHash===t.hash&&(n.readyToBeDeleted=!0,n.refCount?this._textureBuffers.delete(n.skeletonHash^n.clipHash):this.releaseHandle(n)),i=e.next()}},e.releaseAnimationClip=function(t){for(var e=this._textureBuffers.values(),i=e.next();!i.done;){var n=i.value;n.clipHash===t.hash&&(n.readyToBeDeleted=!0,n.refCount?this._textureBuffers.delete(n.skeletonHash^n.clipHash):this.releaseHandle(n)),i=e.next()}},e._createAnimInfos=function(t,e,i){for(var n=[],r=t.joints,s=t.bindposes,a=r.length,o=SE.getOrExtract(e),h=0;h0;){t=FE[--i],FE[i]=null;var r=t.node;Ue.fromRTS(t.local,r.rotation,r.position,r.scale),n=Ue.multiply(t.world,n,t.local)}return n}function kE(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(LE.has(s)){n=LE.get(s);break}n={node:t,local:new Ue,world:new Ue,stamp:-1,parent:null},LE.set(s,n),FE[r++]=n,t=t.parent,n=null}for(;r>0;)i=FE[--r],FE[r]=null,i.parent=n,n=i;return n}function UE(t){for(var e=LE.get(t.uuid)||null;e;)LE.delete(e.node.uuid),e=e.parent}var GE=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!1}],VE=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!0}];function HE(t,e,i,n){for(var r=0;r=0&&(e.push(r),t.push(a))}}var zE=new ji,XE=new ji,WE=new ji,YE=new ji,jE=new Ue,KE=new Qi,qE=function(){this._format=ze.RGBA32F,this._textures=[],this._buffers=[]};qE.WIDTH=256,qE.HEIGHT=3;var ZE,QE,JE,$E,tA,eA,iA,nA,rA,sA,aA,oA,hA,lA,uA,cA,dA,_A,fA,pA,gA,mA,vA,yA,TA,SA,EA,AA,CA,RA,bA,xA,wA,MA,IA,BA,PA,DA,OA,FA,LA,NA,kA,UA,GA,VA,HA,zA,XA,WA=function(t){function e(){var e;return(e=t.call(this)||this)._buffers=[],e._dataArray=[],e._joints=[],e._bufferIndices=null,e._realTimeJointTexture=new qE,e._realTimeTextureMode=!1,e.type=ii.SKINNING,e}He(e,t);var i=e.prototype;return i.destroy=function(){if(this.bindSkeleton(),this._buffers.length){for(var e=0;e=0?a.instancedAttributeBlock.views[r][0]=i.data[0]:n=!0}return n&&i.dirty&&(i.buffer.update(i.data),i.dirty=!1),!0},i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e);return i?i.concat(YA):YA},i.uploadAnimation=function(t){if(this._skeleton&&this._mesh&&this.uploadedAnim!==t){this.uploadedAnim=t;var e=this._dataPoolManager,i=null;t?(i=e.jointTexturePool.getSequencePoseTexture(this._skeleton,t,this._mesh,this.transform),this._jointsMedium.boundsInfo=i&&i.bounds.get(this._mesh.hash),this._modelBounds=null):(i=e.jointTexturePool.getDefaultPoseTexture(this._skeleton,this._mesh,this.transform),this._jointsMedium.boundsInfo=null,this._modelBounds=i&&i.bounds.get(this._mesh.hash)[0]),this._applyJointTexture(i)}},i._applyJointTexture=function(t){void 0===t&&(t=null);var e=this._jointsMedium.texture;if(e&&e!==t&&this._dataPoolManager.jointTexturePool.releaseHandle(e),this._jointsMedium.texture=t,t){var i=this._jointsMedium,n=i.buffer,r=i.jointTextureInfo;r[0]=t.handle.texture.width,r[1]=this._skeleton.joints.length,r[2]=t.pixelOffset+.1,r[3]=1/r[0],this.updateInstancedJointTextureInfo(),n&&n.update(r);for(var s=t.handle.texture,a=0;a=0&&s.length>0){var a=s[n];a[0]=i.data[0],a[1]=e[1],a[2]=e[2]}}},e}(ky),KA=function(e){return t({SkinnedMeshRenderer:e,SkinningModelComponent:e}),e}((ZE=Ki("cc.SkinnedMeshRenderer"),QE=In(100),JE=Tn(TT),$E=Tn(Pr),tA=Tn(TT),eA=Tn(Pr),ZE(iA=QE((nA=function(t){function e(){var e;return(e=t.call(this)||this)._skeleton=rA&&rA(),e._skinningRoot=sA&&sA(),e._clip=null,e.associatedAnimation=null,e._modelType=jA,e}He(e,t);var i=e.prototype;return i.onLoad=function(){t.prototype.onLoad.call(this),this._tryBindAnimation()},i.onDestroy=function(){this.associatedAnimation&&(this.associatedAnimation.notifySkinnedMeshRemoved(this),Ni(null===this.associatedAnimation)),t.prototype.onDestroy.call(this)},i.uploadAnimation=function(t){this._clip=t,this.model&&this.model.uploadAnimation&&this.model.uploadAnimation(t)},i.setUseBakedAnimation=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!1);var i=t?jA:WA;(e||this._modelType!==i)&&(this._modelType=i,this._model&&(We.director.root.destroyModel(this._model),this._model=null,this._models.length=0,this._updateModels(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateUseLightProbe(),this.enabledInHierarchy&&this._attachToScene()))},i.setMaterial=function(e,i){t.prototype.setMaterial.call(this,e,i),this._modelType===WA&&this.getMaterialInstance(i)},i._updateModelParams=function(){this._update(),t.prototype._updateModelParams.call(this)},i._tryBindAnimation=function(){var t=this._skinningRoot;if(t){for(var e=!1,i=this.node;i;i=i.parent)if(i===t){e=!0;break}if(e){var n=t.getComponent("cc.SkeletalAnimation");n?n.notifySkinnedMeshAdded(this):this.setUseBakedAnimation(!1)}}},i._update=function(){this.model&&(this.model.bindSkeleton(this._skeleton,this._skinningRoot,this._mesh),this.model.uploadAnimation&&this.model.uploadAnimation(this._clip))},Pi(e,[{key:"skeleton",get:function(){return this._skeleton},set:function(t){t!==this._skeleton&&(this._skeleton=t,this._update())}},{key:"skinningRoot",get:function(){return this._skinningRoot},set:function(t){this._skinningRoot=t,this._tryBindAnimation(),t!==this._skinningRoot&&this._update()}},{key:"model",get:function(){return this._model}}]),e}(eT),rA=tn(nA.prototype,"_skeleton",[JE],(function(){return null})),sA=tn(nA.prototype,"_skinningRoot",[$E],(function(){return null})),gn(nA.prototype,"skeleton",[tA],Object.getOwnPropertyDescriptor(nA.prototype,"skeleton"),nA.prototype),gn(nA.prototype,"skinningRoot",[eA],Object.getOwnPropertyDescriptor(nA.prototype,"skinningRoot"),nA.prototype),iA=nA))||iA)||iA)),qA=new Bt(ie.ATTR_BATCH_ID,_.R32F),ZA=new Bt(ie.ATTR_BATCH_UV,_.RG32F),QA=ne[qA.format].size+ne[ZA.format].size,JA=function(e){return t({SkinnedMeshUnit:e,SkinningModelUnit:e}),e}((aA=Ki("cc.SkinnedMeshUnit"),oA=Tn(mo),hA=Tn(TT),lA=Tn(Dn),uA=Tn(KA),aA((dA=function(){function t(){this.mesh=_A&&_A(),this.skeleton=fA&&fA(),this.material=pA&&pA(),this._localTransform=gA&&gA(),this._offset=mA&&mA(),this._size=vA&&vA()}return Pi(t,[{key:"offset",get:function(){return this._offset},set:function(t){cn.copy(this._offset,t)}},{key:"size",get:function(){return this._size},set:function(t){cn.copy(this._size,t)}},{key:"copyFrom",get:function(){return null},set:function(t){t&&(this.mesh=t.mesh,this.skeleton=t.skeleton,this.material=t.getMaterial(0),t.skinningRoot&&AE(t.node,t.skinningRoot,this._localTransform))}}]),t}(),_A=tn(dA.prototype,"mesh",[oA],(function(){return null})),fA=tn(dA.prototype,"skeleton",[hA],(function(){return null})),pA=tn(dA.prototype,"material",[lA],(function(){return null})),gA=tn(dA.prototype,"_localTransform",[en],(function(){return new Ue})),mA=tn(dA.prototype,"_offset",[en],(function(){return new cn(0,0)})),vA=tn(dA.prototype,"_size",[en],(function(){return new cn(1,1)})),gn(dA.prototype,"copyFrom",[uA],Object.getOwnPropertyDescriptor(dA.prototype,"copyFrom"),dA.prototype),cA=dA))||cA)),$A=new Ue,tC=(new Ue,new ji),eC=function(e){return t({SkinnedMeshBatchRenderer:e,BatchedSkinningModelComponent:e}),e}((yA=Ki("cc.SkinnedMeshBatchRenderer"),TA=In(100),SA=Tn([ns]),EA=Tn([JA]),yA(AA=TA((CA=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=p.SAMPLER1D){var s=null;t.batchableTextureNames.find((function(t){return t===i}))?((s=t._textures[i])||(s=t.createTexture(i)),t.cookTextures(s,i,n)):t.units.some((function(t){return s=t.material&&t.material.getProperty(i,n)})),s&&e.setProperty(i,s,n)}else{for(var a=[],o=0;o=0)return"continue";t.push(n),e.push(Ue.multiply(new Ue,r.bindposes[i]||Ue.IDENTITY,$A))},a=0;at[i]?1:t[e]0&&_.copyBuffersToTexture(s,d,a),n.length>0&&_.copyTexImagesToTexture(n,d,r)},i.createTexture=function(t){var e=new Xe;return e.setFilters(Ii.LINEAR,Ii.LINEAR),e.setMipFilter(Ii.NEAREST),e.reset({width:this.atlasSize,height:this.atlasSize,format:ze.RGBA8888}),this._textures[t]=e,e},i.resizeAtlases=function(){for(var t in this._textures)this._textures[t].reset({width:this.atlasSize,height:this.atlasSize,format:ze.RGBA8888})},i._createUnitMesh=function(t,e){for(var i=JSON.parse(JSON.stringify(e.struct)),n={},r=0;rthis._renderers.length)&&(t=this._renderers.length),this._renderers.splice(t,0,e);var i=!1;return e.model&&(i=!0,this._LODData.addModel(e.model)),this._modelAddedCallback&&i&&this._modelAddedCallback(),e},e.deleteRenderer=function(t){var e,i=this._renderers.splice(t,1),n=i.length>0?null===(e=i[0])||void 0===e?void 0:e.model:null;return n&&this._LODData.eraseModel(n),i[0]},e.getRenderer=function(t){return this._renderers[t]||null},e.setRenderer=function(t,e){t<0||t>=this.rendererCount?console.error("setRenderer to LOD error, index out of range"):(this.deleteRenderer(t),this.insertRenderer(t,e))},Pi(t,[{key:"screenUsagePercentage",get:function(){return this._screenUsagePercentage},set:function(t){this._screenUsagePercentage=t,this._LODData.screenUsagePercentage=t}},{key:"renderers",get:function(){return this._renderers},set:function(t){if(t!==this._renderers){var e=!1;this._renderers.length=0,this._LODData.clearModels();for(var i=0;ithis.lodCount)&&(t=this.lodCount),i||(i=new RC),i.modelAddedCallback=this.onLodModelAddedCallback.bind(this),!e){var n=this.getLOD(t-1),r=this.getLOD(t);if(n&&r)e=(n.screenUsagePercentage+r.screenUsagePercentage)/2;else if(n&&!r)(e=n.screenUsagePercentage/2)>.01&&(e=.01);else if(r&&!n){e=r.screenUsagePercentage;var s=this.getLOD(t+1);r.screenUsagePercentage=(e+(s?s.screenUsagePercentage:0))/2}else e=CC[0]}return i.screenUsagePercentage=e,this._LODs.splice(t,0,i),this._lodGroup.insertLOD(t,i.lodData),this._updateDataToScene(),this.node&&this._emitChangeNode(this.node),i},i.eraseLOD=function(t){if(t<0||t>=this.lodCount)return console.warn("eraseLOD error, index out of range"),null;var e=this._LODs[t];return e?(this._LODs.splice(t,1),this._lodGroup.eraseLOD(t),this._updateDataToScene(),this._emitChangeNode(this.node),e):(console.warn("eraseLOD error, LOD not exist at specified index."),null)},i.getLOD=function(t){return t<0||t>=this.lodCount?(console.warn("getLOD error, index out of range"),null):this._LODs[t]},i.setLOD=function(t,e){t<0||t>=this.lodCount?console.warn("setLOD error, index out of range"):(this._LODs[t]=e,e.modelAddedCallback=this.onLodModelAddedCallback.bind(this),this.lodGroup.updateLOD(t,e.lodData),this._updateDataToScene())},i.recalculateBounds=function(){for(var t=new ji,e=new ji,i=null,n=new ji,r=0;r0&&this._lodGroup.lodCount<1&&this._LODs.forEach((function(e,i){e.lodData.screenUsagePercentage=e.screenUsagePercentage;var n=e.renderers;if(null!==n&&n.length>0)for(var r=0;r0&&(this._delayTime-=t,this._delayTime>0)||(this._currentFramePlayed?this.time+=t*this._speed:this._currentFramePlayed=!0,this._process())},i.sample=function(){var t=this.getWrappedInfo(this.time,this._wrappedInfo);return this._sampleCurves(t.time),this._sampleEvents(t),this._sampleEmbeddedPlayers(t),t},i.onPlay=function(){var t;this.setTime(this._getPlaybackStart()),this._delayTime=this._delay,this._onReplayOrResume(),this.emit(kC.PLAY,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit(kC.STOP,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit(kC.RESUME,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit(kC.PAUSE,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPause(this.current)},i._sampleCurves=function(t){var e=this._poseOutput,i=this._clipEval;e&&(e.weight=this.weight),i&&i.evaluate(t)},i._process=function(){this._useSimpleProcess?this.simpleProcess():this.process()},i.process=function(){var t,e=this.sample();this._allowLastFrame&&(t=this._lastWrapInfo?this._lastWrapInfo:this._lastWrapInfo=new UC(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit(kC.LASTFRAME,this),t.set(e)),e.stopped&&(this.stop(),this.emit(kC.FINISHED,this))},i.simpleProcess=function(){var t=this._playbackRange.min,e=this._playbackDuration,i=0,n=0;if(0!==e&&((i=this.time%e)<0&&(i+=e),n=(t+i)*this._invDuration),this._sampleCurves(t+i),this._clipEventEval||this._clipEmbeddedPlayerEval){var r=this.getWrappedInfo(this.time,this._wrappedInfo);this._sampleEvents(r),this._sampleEmbeddedPlayers(r)}this._allowLastFrame&&(Number.isNaN(this._lastIterations)&&(this._lastIterations=n),(this.time>0&&this._lastIterations>n||this.time<0&&this._lastIterations0&&(t-=1),1&t&&(i=!i)),(e&ds.Reverse)===ds.Reverse&&(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new UC;var i=this._playbackRange.min,n=this._playbackDuration,r=this.repeatCount;if(0===n)return e.time=0,e.ratio=0,e.direction=1,e.stopped=!!Number.isFinite(r),e.iterations=0,e;var s=!1,a=(t-=i)>0?t/n:-t/n;if(a>=r){a=r,s=!0;var o=r-(0|r);0===o&&(o=1),t=o*n*(t>0?1:-1)}if(t>n){var h=t%n;t=0===h?n:h}else t<0&&0!=(t%=n)&&(t+=n);var l=!1,u=this._wrapMode&ds.ShouldWrap;u&&(l=this._needReverse(a));var c=l?-1:1;return this.speed<0&&(c*=-1),u&&l&&(t=n-t),e.time=i+t,e.ratio=e.time/this.duration,e.direction=c,e.stopped=s,e.iterations=a,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null===(e=this._clipEventEval)||void 0===e||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.evaluate(t.time,Math.trunc(t.iterations))},i._emit=function(t,e){this._target&&this._target.isValid&&this._target.emit(t,t,e)},i._onReplayOrResume=function(){VC().addAnimation(this)},i._onPauseOrStop=function(){VC().removeAnimation(this)},Pi(e,[{key:"clip",get:function(){return this._clip}},{key:"name",get:function(){return this._name}},{key:"length",get:function(){return this.duration}},{key:"wrapMode",get:function(){return this._wrapMode},set:function(t){var e;this._wrapMode=t,this.time=0,t&ds.Loop?this.repeatCount=1/0:this.repeatCount=1,null===(e=this._clipEventEval)||void 0===e||e.setWrapMode(t)}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t;var e=this._wrapMode&ds.ShouldWrap,i=(this.wrapMode&ds.Reverse)===ds.Reverse;this._useSimpleProcess=t===1/0&&!e&&!i}},{key:"delay",get:function(){return this._delay},set:function(t){this._delayTime=this._delay=t}},{key:"playbackRange",get:function(){return this._playbackRange},set:function(t){Ni(t.max>=t.min),this._playbackRange.min=Math.max(t.min,0),this._playbackRange.max=Math.min(t.max,this.duration),this._playbackDuration=this._playbackRange.max-this._playbackRange.min,this.setTime(0)}},{key:"speed",get:function(){return this._speed},set:function(t){var e;this._speed=t,null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.notifyHostSpeedChanged(t)}},{key:"current",get:function(){return this.getWrappedInfo(this.time).time}},{key:"ratio",get:function(){return 0===this.duration?0:this.current/this.duration}},{key:"weight",get:function(){return this._weight},set:function(t){this._weight=t,this._poseOutput&&(this._poseOutput.weight=t)}},{key:"curveLoaded",get:function(){return this._curveLoaded}}]),e}(NC));We.AnimationState=WC,Ki("cc.animation.EmbeddedAnimationClipPlayable")((HC=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;re){var i;(i=this._channels).push.apply(i,Array.from({length:t-e},(function(){return new qR(new gs)})))}}}]),e}(KR),ER=tn(SR.prototype,"_channels",[JR],(function(){return[]})),SR)),function(){function t(t){this._curves=t,this._result=new Array(t.length).fill(0)}return t.prototype.evaluate=function(t){for(var e=this._result,i=e.length,n=0;n1}return!1}(e,this.uniformName)?{set:function(t){e.setUniformArray(n,t)}}:{set:function(t){e.setUniform(n,t)}}}var r=Wn.getBindingFromHandle(i),s=e.properties[this.uniformName],a=s&&s.value?""+s.value+ir(s.type):er(s.type),o=Nn.get(a);return o||(Gi("Illegal texture default value: "+a+"."),o=Nn.get("default-texture")),{set:function(t){t||(t=o);var i=t.getGFXTexture();i&&i.width&&i.height&&(e.bindTexture(r,i),t instanceof Un&&e.bindSampler(r,ke.gfxDevice.getSampler(t.getSamplerInfo())))}}},t}(),RR=tn(CR.prototype,"passIndex",[en],(function(){return 0})),bR=tn(CR.prototype,"uniformName",[en],(function(){return""})),xR=gn(CR.prototype,"channelIndex",[vs],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),AR=CR))||AR,eb=Ki("cc.animation.MorphWeightValueProxy")((MR=function(){function t(){this.subMeshIndex=IR&&IR(),this.shapeIndex=BR&&BR()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),IR=tn(MR.prototype,"subMeshIndex",[en],(function(){return 0})),BR=tn(MR.prototype,"shapeIndex",[en],(function(){return 0})),wR=MR))||wR,ib=Ki("cc.animation.MorphWeightsValueProxy")((DR=function(){function t(){this.subMeshIndex=OR&&OR()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),OR=tn(DR.prototype,"subMeshIndex",[en],(function(){return 0})),PR=DR))||PR,nb=Ki("cc.animation.MorphWeightsAllValueProxy")(FR=function(){function t(){}return t.prototype.forTarget=function(t){return{set:function(e){for(var i,n,r=null!==(i=null===(n=t.mesh)||void 0===n?void 0:n.struct.primitives.length)&&void 0!==i?i:0,s=0;s1e-6){n=!1;break}this._findRatio=n?zb:As}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());We.RatioSampler=Ub;var Gb=t("AnimCurve",function(){function t(e,i){this.types=void 0,this.type=null,this._values=[],this._lerp=void 0,this._duration=void 0,this._array=void 0,this._duration=i,this._values=e.values;var n=function(e){return"string"==typeof e?e:Array.isArray(e)?e[0]===e[1]&&e[2]===e[3]?t.Linear:t.Bezier(e):t.Linear};if(void 0!==e.easingMethod)this.type=n(e.easingMethod);else if(Array.isArray(e.easingMethods))this.types=e.easingMethods.map(n);else if(void 0!==e.easingMethods){this.types=new Array(this._values.length).fill(null);for(var r=0,s=Object.keys(e.easingMethods);r=e.ratios.length))return t.valueBetween(i,n-1,e.ratios[n-1],n,e.ratios[n]);n=e.ratios.length-1}return t.valueAt(n)}function Hb(t,e){if("string"==typeof e){var i=Ss[e];i?t=i(t):hn(3906,e)}else Array.isArray(e)&&(t=Es(e,t));return t}function zb(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(er)return i;var s=(e=(e-n)/(r-n))/(1/i),a=0|s,o=1e-6;return s-a=0)i=r;else{var s=~r,a=s-1;i=a;var o=t[s],h=t[a];n=(e-h)/(o-h)}return{index:i,ratio:n}}!function(){function t(){this._reset()}var e=t.prototype;e.transformTime=function(t){return t-this._timeOffset},e.calculate=function(t,e,i){this._reset();var n=t.length;if(n){var r=t[0],s=t[n-1],a=Ge(e,r,s),o=Ge(i,r,s);this._timeOffset=a;var h=function(t,e,i){var n=t.length;Ni(i>=e&&e>=t[0]&&i<=t[n-1]);var r=Ux(t,e),s=r.index,a=r.ratio,o=Ux(t,i);return{fromIndex:s,fromRatio:a,toIndex:o.index,toRatio:o.ratio}}(t,a,o),l=h.fromIndex,u=h.fromRatio,c=h.toIndex,d=h.toRatio,_=!u,f=!d;l!==c||u!==d?(_||(this.preLerpIndex=l,this.preLerpRatio=u),this.directKeyframesBegin=_?l:l+1,this.directKeyframesEnd=c+1,f||(this.postLerpIndex=c,this.postLerpRatio=d)):_?(this.directKeyframesBegin=l,this.directKeyframesEnd=l+1):(this.preLerpIndex=l,this.preLerpRatio=u)}},e._reset=function(){this.preLerpIndex=-1,this.preLerpRatio=0,this.directKeyframesBegin=0,this.directKeyframesEnd=0,this.postLerpIndex=-1,this.postLerpRatio=0,this._timeOffset=0},Pi(t,[{key:"keyframesCount",get:function(){var t=this.preLerpIndex,e=this.directKeyframesBegin;return 0+(t<0?0:1)+(this.directKeyframesEnd-e)+(this.postLerpIndex<0?0:1)}}])}();var Gx,Vx=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluator(e)}))}return t.prototype.evaluate=function(t){this._nodeEvaluations.forEach((function(e){e.evaluate(t)}))},t}(),Hx=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=hw(e.times,e.values,ji,t,"position",r)),i&&(this._rotation=hw(i.times,i.values,Ji,t,"rotation",r)),n&&(this._scale=hw(n.times,n.values,ji,t,"scale",r))}return t.prototype.evaluate=function(t){if(this._position){var e=this._position.evaluator.evaluate(t);this._position.runtimeBinding.setValue(e)}if(this._rotation){var i=this._rotation.evaluator.evaluate(t);this._rotation.runtimeBinding.setValue(i)}if(this._scale){var n=this._scale.evaluator.evaluate(t);this._scale.runtimeBinding.setValue(n)}},t}(),zx=function(){function t(t,e,i){this._times=void 0,this._inputSampleResultCache={just:!1,index:-1,nextIndex:-1,ratio:0},this._values=void 0,this._prevValue=void 0,this._nextValue=void 0,this._resultValue=void 0,this._times=t,this._values=e,this._prevValue=new i,this._nextValue=new i,this._resultValue=new i}return t.prototype.evaluate=function(t){var e=this._times,i=this._values,n=this._resultValue;if(0===e.length)return n;var r=function(t,e,i){var n=t.length,r=t[0],s=t[n-1];if(es)i.just=!0,i.index=n-1;else{var a=As(t,e);if(a>=0)i.just=!0,i.index=a;else{var o=~a,h=o-1,l=t[h],u=t[o],c=(e-t[h])/(u-l);i.just=!1,i.index=h,i.nextIndex=o,i.ratio=c}}return i}(e,t,this._inputSampleResultCache);return r.just?i.get(r.index,n):i.lerp(r.index,r.nextIndex,r.ratio,this._prevValue,this._nextValue,n),n},t}(),Xx={uint8:Uint8Array,uint16:Uint16Array};function Wx(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return Gx.FLOAT_32;case 8:return Gx.FLOAT_64}}!function(t){t[t.FLOAT_32=0]="FLOAT_32",t[t.FLOAT_64=1]="FLOAT_64"}(Gx||(Gx={}));var Yx,jx,Kx,qx,Zx,Qx,Jx,$x,tw,ew,iw,nw,rw,sw,aw=Mx("cc.animation.QuantizedFloatArray")((Ax=function(){function t(t,e,i,n){void 0===n&&(n=0),this.originalPrecision=Cx&&Cx(),this.min=Rx&&Rx(),this.extent=bx&&bx(),this.values=xx&&xx(),this.originalPrecision=t,this.values=e,this.extent=i,this.min=n}return t.prototype.toHashString=function(){var t=this.originalPrecision,e=this.min,i=this.extent,n=this.values;return t+" "+Dx(e)+" "+Dx(i)+" "+n.join(" ")},Pi(t,[{key:"quantizationType",get:function(){switch(this.values.BYTES_PER_ELEMENT){default:case 1:return"uint8";case 2:return"uint16"}}}]),t}(),Cx=tn(Ax.prototype,"originalPrecision",[Ix],null),Rx=tn(Ax.prototype,"min",[Ix],null),bx=tn(Ax.prototype,"extent",[Ix],null),xx=tn(Ax.prototype,"values",[Ix],null),Ex=Ax))||Ex;function ow(t,e){return t.values[e]/(1<=0){var d=l.substring(0,c),_=h[d];_&&(u.parent=_)}}for(var f=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=h[e.node];if(i)return bw(i,e.property)}}),void 0),p=0;p=0&&this._embeddedPlayers.splice(e,1)},i[mw]=function(){this._embeddedPlayers.length=0},i._createEvalWithBinder=function(t,e,i){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData());var n,r=[];i&&(n=this._createRootMotionEvaluation(t,i,r));for(var s,a=[],o=this._tracks,h=o.length,l=0;l=c&&t<=d?o?e!==l&&(h.stop(),h.play(),a.entered=!0):(h.play(),a.entered=!0):o&&(h.stop(),a.entered=!1),a.lastIterations=e,a.entered){var _=t-c;a.instantiatedPlayer.setTime(_)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r0?((s&ds.PingPong)===ds.PingPong?e*=-1:h=n,o++):1===e&&h===n-1&&ra)break}h+=e,this._doFire(h,!0)}while(h!==r&&h>-1&&h=e.length||this._ignoreIndex===t))for(var i=e[t],n=this._targetNode.components,r=i.events.length,s=0;s0||delete e[t])},e.apply=function(t){var e,i,n,r=this._transformApplyFlags,s=this._properties,a=s.position,o=s.scale,h=s.rotation,l=s.eulerAngles;r&&(a&&r&Iw.POSITION&&(e=a.result),o&&r&Iw.SCALE&&(i=o.result),l&&r&Iw.EULER_ANGLES&&(n=l.result),h&&r&Iw.ROTATION&&(n=h.result),(n||e||i)&&t.setRTS(n,e,i),this._transformApplyFlags=0)},Pi(t,[{key:"empty",get:function(){var t=this._properties;return!(t.position||t.rotation||t.eulerAngles||t.scale)}}]),t}(),Gw=function(t){function e(){return t.apply(this,arguments)||this}He(e,t);var i=e.prototype;return i.apply=function(e){var i=this._properties,n=i.position,r=i.scale,s=i.rotation,a=i.eulerAngles;n&&n.accumulatedWeight&&(this._transformApplyFlags|=Iw.POSITION,n.accumulatedWeight<1&&n.blend(e.position,1-n.accumulatedWeight)),r&&r.accumulatedWeight&&(this._transformApplyFlags|=Iw.SCALE,r.accumulatedWeight<1&&r.blend(e.scale,1-r.accumulatedWeight)),a&&a.accumulatedWeight&&(this._transformApplyFlags|=Iw.EULER_ANGLES,a.accumulatedWeight<1&&a.blend(e.eulerAngles,1-a.accumulatedWeight)),s&&s.accumulatedWeight&&(this._transformApplyFlags|=Iw.ROTATION,s.accumulatedWeight<1&&s.blend(e.rotation,1-s.accumulatedWeight)),t.prototype.apply.call(this,e),null==n||n.reset(),null==r||r.reset(),null==s||s.reset(),null==a||a.reset()},i._createVec3BlendState=function(){return new Nw},i._createQuatBlendState=function(){return new kw},e}(Uw),Vw=function(t){function e(){return t.apply(this,arguments)||this}return He(e,t),e.prototype.createNodeBlendState=function(){return new Gw},e}(Bw),Hw=function(){function t(t){this.refCount=0,this.result=new ji,this._defaultValue=new ji,this._clipBlendResult=new ji,this._accumulatedWeight=0,ji.copy(this._defaultValue,t),ji.copy(this.result,t)}var e=t.prototype;return e.blend=function(t,e){this._accumulatedWeight=Ww(this._clipBlendResult,this._clipBlendResult,this._accumulatedWeight,t,e)},e.commitLayerChange=function(t){var e=this.result,i=this._clipBlendResult,n=this._accumulatedWeight;n<1&&this.blend(this._defaultValue,1-n),ji.lerp(e,e,i,t),ji.zero(this._clipBlendResult),this._accumulatedWeight=0},e.reset=function(){ji.copy(this.result,this._defaultValue)},t}(),zw=function(){function t(t){this.refCount=0,this.result=new Ji,this._defaultValue=new Ji,this._clipBlendResult=new Ji,this._accumulatedWeight=0,Ji.copy(this._defaultValue,t),Ji.copy(this.result,t)}var e=t.prototype;return e.blend=function(t,e){this._accumulatedWeight=Yw(this._clipBlendResult,this._clipBlendResult,this._accumulatedWeight,t,e)},e.commitLayerChange=function(t){var e=this.result,i=this._clipBlendResult,n=this._accumulatedWeight;n<1&&this.blend(this._defaultValue,1-n),Ji.slerp(e,e,i,t),Ji.identity(this._clipBlendResult),this._accumulatedWeight=0},e.reset=function(){Ji.copy(this.result,this._defaultValue)},t}(),Xw=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r>>0,e}He(e,t);var i=e.prototype;return i.setLayerMask=function(t){this._layerMask&=~(1<=0?this._crossFades.fastRemoveAt(e):hn(3907)},i.update=function(t){var e=this._delayEvents,i=this._crossFades,n=this._sockets,r=i.array;for(i.i=0;i.i=0?this._anims.fastRemoveAt(e):hn(3907)},i.pushDelayEvent=function(t,e,i){this._delayEvents.push({fn:t,thisArg:e,args:i})},i.addSockets=function(t,e){for(var i=this,n=function(n){var r=e[n];if(i._sockets.find((function(t){return t.target===r.target})))return"continue";var s=t.getChildByPath(r.path),a=r.target&&s&&kE(s,t);a&&i._sockets.push({target:r.target,transform:a})},r=0;r=h.easeDuration){a=o+1,h.easeTime=h.easeDuration;break}}if(a!==i.length){for(var c=a;c=0||(this._clips.push(t),this.createState(t)))}}]),e}(Cr(Pn)),rM.EventType=kC,gn((tM=sM).prototype,"clips",[Zw],Object.getOwnPropertyDescriptor(tM.prototype,"clips"),tM.prototype),gn(tM.prototype,"defaultClip",[Qw],Object.getOwnPropertyDescriptor(tM.prototype,"defaultClip"),tM.prototype),eM=tn(tM.prototype,"playOnLoad",[en],(function(){return!1})),iM=tn(tM.prototype,"_clips",[Jw],(function(){return[]})),nM=tn(tM.prototype,"_defaultClip",[en],(function(){return null})),$w=tM))||$w)||$w));function cM(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}We.Animation=uM,We.AnimationComponent=uM,br(uM,"cc.AnimationComponent"),function(t){t.PLAYED="play",t.PAUSED="pause",t.STOPPED="stop",t.SEEKED="seeked",t.ENDED="ended",t.INTERRUPTION_BEGIN="interruptionBegin",t.INTERRUPTION_END="interruptionEnd",t.USER_GESTURE="on_gesture"}(aM||(aM={})),function(t){t[t.DOM_AUDIO=0]="DOM_AUDIO",t[t.WEB_AUDIO=1]="WEB_AUDIO",t[t.MINIGAME_AUDIO=2]="MINIGAME_AUDIO",t[t.NATIVE_AUDIO=3]="NATIVE_AUDIO",t[t.UNKNOWN_AUDIO=4]="UNKNOWN_AUDIO"}(oM||(oM={})),function(t){t[t.INIT=0]="INIT",t[t.PLAYING=1]="PLAYING",t[t.PAUSED=2]="PAUSED",t[t.STOPPED=3]="STOPPED",t[t.INTERRUPTED=4]="INTERRUPTED"}(hM||(hM={}));var dM,_M=t("AudioPCMDataView",function(){function t(){if(this._bufferView=void 0,this._normalizeFactor=1,2===arguments.length)this._bufferView=arguments.length<=0?void 0:arguments[0],this._normalizeFactor=arguments.length<=1?void 0:arguments[1];else{var t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],i=arguments.length<=2?void 0:arguments[2];this._bufferView=new e(t),this._normalizeFactor=i}}return t.prototype.getData=function(t){return this._bufferView[t]*this._normalizeFactor},Pi(t,[{key:"length",get:function(){return this._bufferView.length}}]),t}()),fM=0;function pM(t,e){var i;e.invoking||(e.invoking=!0,(i=e.func).call.apply(i,[t].concat(e.args)).then((function(){e.invoking=!1,t._operationQueue.shift(),t._eventTarget.emit(e.id.toString());var i=t._operationQueue[0];i&&pM(t,i)})).catch((function(){})))}function gM(t,e,i){var n=i.value;i.value=function(){for(var t=this,e=arguments.length,i=new Array(e),r=0;r=this.duration&&(this._startTime=this._now(),this._startOffset=0),e%this.duration},e.start=function(){this._isPaused=!1,this._startTime=this._now()},e.pause=function(){this._isPaused||(this._isPaused=!0,this._startOffset=this._calculateCurrentTime())},e.stop=function(){this._isPaused=!0,this._startOffset=0},e.seek=function(t){this._startTime=this._now(),this._startOffset=Ge(t,0,this.duration)},Pi(t,[{key:"duration",get:function(){return this._nativeAudio.duration}},{key:"currentTime",get:function(){return this._isPaused?this._startOffset:this._calculateCurrentTime()}}]),t}(),AM=new(function(){function t(){this._audioBufferDataMap={}}var e=t.prototype;return e.addCache=function(t,e){this._audioBufferDataMap[t]?console.warn("Audio buffer "+t+" has been cached"):this._audioBufferDataMap[t]={usedCount:1,audioBuffer:e}},e.retainCache=function(t){var e=this._audioBufferDataMap[t];e?e.usedCount++:console.warn("Audio buffer cache "+t+" has not been added.")},e.getCache=function(t){var e=this._audioBufferDataMap[t];return null==e?void 0:e.audioBuffer},e.tryReleasingCache=function(t){var e=this._audioBufferDataMap[t];e?--e.usedCount<=0&&delete this._audioBufferDataMap[t]:console.warn("Audio buffer cache "+t+" has not been added.")},t}()),CM=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,RM="on-context-running",bM=function(){function t(){var t=this;this._eventTarget=void 0,this._context=void 0,this._isRunning=!1,this._context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),this._eventTarget=new es,this._context.onstatechange=function(){"running"===t._context.state?(t._isRunning=!0,t._eventTarget.emit(RM)):t._isRunning=!1}}var e=t.prototype;return e.onceRunning=function(t,e){this._eventTarget.once(RM,t,e)},e.offRunning=function(t,e){this._eventTarget.off(RM,t,e)},e.decodeAudioData=function(t){var e=this;return new Promise((function(i){var n=e._context.decodeAudioData(t,(function(t){i(t)}),(function(t){console.error("failed to load Web Audio",t)}));null==n||n.catch((function(){}))}))},e.runContext=function(){var t=this;return new Promise((function(e){if(t.isRunning)e();else{var i=t._context;if(i.resume)if(i.resume().catch((function(){})),"running"!==i.state){var n=document.getElementById("GameCanvas"),r=function t(){i.resume().then((function(){null==n||n.removeEventListener("touchend",t,{capture:!0}),null==n||n.removeEventListener("mouseup",t,{capture:!0}),e()})).catch((function(){}))};null==n||n.addEventListener("touchend",r,{capture:!0}),null==n||n.addEventListener("mouseup",r,{capture:!0})}else e();else e()}}))},e.createBufferSource=function(t,e){var i=this._context.createBufferSource();return void 0!==t&&(i.buffer=t),void 0!==e&&(i.loop=e),i},e.createGain=function(t){void 0===t&&(t=1);var e=this._context.createGain();return this.setGainValue(e,t),e},e.setGainValue=function(t,e){if(t.gain.setTargetAtTime)try{t.gain.setTargetAtTime(e,this._context.currentTime,0)}catch(i){t.gain.setTargetAtTime(e,this._context.currentTime,.01)}else t.gain.value=e},e.connectContext=function(t){this._context&&t.connect(this._context.destination)},Pi(t,[{key:"isRunning",get:function(){return this._isRunning}},{key:"currentTime",get:function(){return this._context.currentTime}}]),t}();bM.support=!!CM,bM.support&&(yM=new bM);var xM,wM,MM,IM,BM,PM=function(){function t(t,e,i){this._duration=void 0,this._bufferSourceNode=void 0,this._onPlayCb=void 0,this._currentTimer=0,this._url=void 0,this._onEndCb=void 0,this._duration=t.duration,this._url=i,this._bufferSourceNode=yM.createBufferSource(t,!1);var n=yM.createGain(e);this._bufferSourceNode.connect(n),yM.connectContext(n)}var e=t.prototype;return e.play=function(){var t=this;this._bufferSourceNode.start(),yM.runContext().then((function(){var e;null===(e=t.onPlay)||void 0===e||e.call(t),t._currentTimer=window.setTimeout((function(){var e;AM.tryReleasingCache(t._url),null===(e=t.onEnd)||void 0===e||e.call(t)}),1e3*t._duration)})).catch((function(){}))},e.stop=function(){clearTimeout(this._currentTimer),AM.tryReleasingCache(this._url),this._bufferSourceNode.stop(),this._bufferSourceNode.buffer=null},Pi(t,[{key:"onPlay",get:function(){return this._onPlayCb},set:function(t){this._onPlayCb=t}},{key:"onEnd",get:function(){return this._onEndCb},set:function(t){this._onEndCb=t}}]),t}(),DM=(vM=function(){function t(t,e){this._src=void 0,this._audioBuffer=void 0,this._sourceNode=void 0,this._gainNode=void 0,this._currentTimer=0,this._volume=1,this._loop=!1,this._state=hM.INIT,this._audioTimer=void 0,this._eventTarget=new es,this._operationQueue=[],this._audioBuffer=t,this._audioTimer=new EM(t),this._gainNode=yM.createGain(),yM.connectContext(this._gainNode),this._src=e,qr.on(Zr.EVENT_PAUSE,this._onInterruptedBegin,this),qr.on(Zr.EVENT_RESUME,this._onInterruptedEnd,this)}var e=t.prototype;return e.destroy=function(){this._audioTimer.destroy(),this._audioBuffer&&(this._audioBuffer=null),AM.tryReleasingCache(this._src),qr.off(Zr.EVENT_PAUSE,this._onInterruptedBegin,this),qr.off(Zr.EVENT_RESUME,this._onInterruptedEnd,this)},t.load=function(e){return new Promise((function(i){t.loadNative(e).then((function(n){i(new t(n,e))})).catch((function(){}))}))},t.loadNative=function(t){return new Promise((function(e,i){var n=AM.getCache(t);if(n)return AM.retainCache(t),void e(n);var r=new XMLHttpRequest,s="load audio failed: "+t+", status: ";r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200===r.status||0===r.status?yM.decodeAudioData(r.response).then((function(i){AM.addCache(t,i),e(i)})).catch((function(){})):i(new Error(""+s+r.status+"(no response)"))},r.onerror=function(){i(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){i(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){i(new Error(""+s+r.status+"(abort)"))},r.send(null)}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var r=new PM(t,i,e);n(r)})).catch(r)}))},e.getPCMData=function(t){return new _M(this._audioBuffer.getChannelData(t),1)},e._onInterruptedBegin=function(){var t=this;this._state===hM.PLAYING&&this.pause().then((function(){t._state=hM.INTERRUPTED,t._eventTarget.emit(aM.INTERRUPTION_BEGIN)})).catch((function(){}))},e._onInterruptedEnd=function(){var t=this;this._state===hM.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(aM.INTERRUPTION_END)})).catch((function(){}))},e.seek=function(t){var e=this;return new Promise((function(i){yM.offRunning(),e._audioTimer.seek(t),e._state===hM.PLAYING?e._doPlay().then(i).catch((function(){})):i()}))},e.play=function(){return yM.offRunning(),this._doPlay()},e._doPlay=function(){var t=this;return new Promise((function(e){yM.isRunning?(t._startSourceNode(),e()):(yM.onceRunning((function(){t._startSourceNode(),e()})),yM.runContext().catch((function(){})))}))},e._startSourceNode=function(){var t=this;this._stopSourceNode(),this._sourceNode=yM.createBufferSource(this._audioBuffer,this.loop),this._sourceNode.connect(this._gainNode),this._sourceNode.start(0,this._audioTimer.currentTime),this._state=hM.PLAYING,this._audioTimer.start(),window.clearTimeout(this._currentTimer),this._currentTimer=window.setTimeout((function e(){t.loop?t._currentTimer=window.setTimeout(e,1e3*t._audioBuffer.duration):(t._audioTimer.stop(),t._eventTarget.emit(aM.ENDED),t._state=hM.INIT)}),1e3*(this._audioBuffer.duration-this._audioTimer.currentTime))},e._stopSourceNode=function(){try{this._sourceNode&&(this._sourceNode.stop(),this._sourceNode.buffer=null)}catch(t){}},e.pause=function(){return yM.offRunning(),this._state===hM.PLAYING&&this._sourceNode?(this._audioTimer.pause(),this._state=hM.PAUSED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.stop=function(){return yM.offRunning(),this._sourceNode?(this._audioTimer.stop(),this._state=hM.STOPPED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.onInterruptionBegin=function(t){this._eventTarget.on(aM.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(aM.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(aM.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(aM.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(aM.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(aM.ENDED,t)},Pi(t,[{key:"sampleRate",get:function(){return this._audioBuffer.sampleRate}},{key:"src",get:function(){return this._src}},{key:"type",get:function(){return oM.WEB_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._sourceNode&&(this._sourceNode.loop=t)}},{key:"volume",get:function(){return this._volume},set:function(t){t=Bs(t),this._volume=t,yM.setGainValue(this._gainNode,t)}},{key:"duration",get:function(){return this._audioBuffer.duration}},{key:"currentTime",get:function(){return this._audioTimer.currentTime}}]),t}(),gn(vM.prototype,"seek",[gM],Object.getOwnPropertyDescriptor(vM.prototype,"seek"),vM.prototype),gn(vM.prototype,"play",[gM],Object.getOwnPropertyDescriptor(vM.prototype,"play"),vM.prototype),gn(vM.prototype,"pause",[gM],Object.getOwnPropertyDescriptor(vM.prototype,"pause"),vM.prototype),gn(vM.prototype,"stop",[gM],Object.getOwnPropertyDescriptor(vM.prototype,"stop"),vM.prototype),vM),OM=function(){function t(t){this._audio=void 0,this._audio=t}var e=t.prototype;return e.play=function(){this._audio.play()},e.stop=function(){this._audio.stop()},Pi(t,[{key:"onPlay",get:function(){return this._audio.onPlay},set:function(t){this._audio.onPlay=t}},{key:"onEnd",get:function(){return this._audio.onEnd},set:function(t){this._audio.onEnd=t}}]),t}(),FM=function(){function t(t){this._player=void 0,this._player=t}t.load=function(e,i){return new Promise((function(n){(null==i?void 0:i.audioLoadMode)!==oM.DOM_AUDIO&&bM.support?DM.load(e).then((function(e){n(new t(e))})).catch((function(){})):(bM.support||Zi(5201),SM.load(e).then((function(e){n(new t(e))})).catch((function(){})))}))};var e=t.prototype;return e.destroy=function(){this._player.destroy()},t.loadNative=function(t,e){return(null==e?void 0:e.audioLoadMode)!==oM.DOM_AUDIO&&bM.support?DM.loadNative(t):(bM.support||Zi(5201),SM.loadNative(t))},t.loadOneShotAudio=function(t,e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==oM.DOM_AUDIO&&bM.support?DM.loadOneShotAudio(t,e).then((function(t){n(new OM(t))})).catch(r):(bM.support||Zi(5201),SM.loadOneShotAudio(t,e).then((function(t){n(new OM(t))})).catch(r))}))},e.getPCMData=function(t){return this._player.getPCMData(t)},e.seek=function(t){return this._player.seek(t)},e.play=function(){return this._player.play()},e.pause=function(){return this._player.pause()},e.stop=function(){return this._player.stop()},e.onInterruptionBegin=function(t){this._player.onInterruptionBegin(t)},e.offInterruptionBegin=function(t){this._player.offInterruptionBegin(t)},e.onInterruptionEnd=function(t){this._player.onInterruptionEnd(t)},e.offInterruptionEnd=function(t){this._player.offInterruptionEnd(t)},e.onEnded=function(t){this._player.onEnded(t)},e.offEnded=function(t){this._player.offEnded(t)},Pi(t,[{key:"src",get:function(){return this._player.src}},{key:"type",get:function(){return this._player.type}},{key:"state",get:function(){return this._player.state}},{key:"loop",get:function(){return this._player.loop},set:function(t){this._player.loop=t}},{key:"volume",get:function(){return this._player.volume},set:function(t){this._player.volume=t}},{key:"duration",get:function(){return this._player.duration}},{key:"currentTime",get:function(){return this._player.currentTime}},{key:"sampleRate",get:function(){return this._player.sampleRate}}]),t}();FM.maxAudioChannel=24;var LM=t("AudioClip",Ki("cc.AudioClip")((BM=IM=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r-1?(t[i].playTime=performance.now(),!1):(t.push({audio:e,playTime:performance.now()}),!0)},e.addPlaying=function(t){t instanceof FM?this._tryAddPlaying(this._audioPlayerInfoList,t):this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(Ls(t,i),!0)},e.removePlaying=function(t){t instanceof FM?this._tryRemovePlaying(this._audioPlayerInfoList,t):this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length0?this._oneShotAudioInfoList.forEach((function(e){(!t||e.playTime0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),VI.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer),i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null))}else if(e.usage&g.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),VI.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else e.usage&g.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&g.INDIRECT||e.usage&g.TRANSFER_DST||e.usage&g.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}function FI(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),VI.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),VI.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function LI(t,e,i,n,r){if(e.usage&g.UNIFORM)ArrayBuffer.isView(i)?e.vf32.set(i,n/Float32Array.BYTES_PER_ELEMENT):e.vf32.set(new Float32Array(i),n/Float32Array.BYTES_PER_ELEMENT);else if(e.usage&g.INDIRECT){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;a0){e.glBlocks=new Array(e.blocks.length);for(var T=0;T0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var I=0;I=0&&C.gpuDescriptors[R],x=null,w=0;if(b&&b.gpuBuffer){var M=b.gpuBuffer,I=S[A.set],B=I&&I[A.binding];B>=0&&(w=r[B]),"vf32"in M?x=M.vf32:(w+=M.offset,x=M.gpuBuffer.vf32),w>>=2}if(x)for(var D=A.glActiveUniforms.length,O=0;O=0&&Bt.gpuDescriptors[Pt],Ot=It.units.length,Ft=0;Ft0){var Nt=Dt.gpuTexture,kt=u.glTexUnits[Lt];kt.glTexture!==Nt.glTexture&&(u.texUnit!==Lt&&(l.activeTexture(l.TEXTURE0+Lt),u.texUnit=Lt),Nt.glTexture?l.bindTexture(Nt.glTarget,Nt.glTexture):l.bindTexture(Nt.glTarget,t.nullTex2D.gpuTexture.glTexture),kt.glTexture=Nt.glTexture);var Ut=Dt.gpuSampler;Nt.isPowerOf2?(a=Ut.glWrapS,o=Ut.glWrapT):(a=l.CLAMP_TO_EDGE,o=l.CLAMP_TO_EDGE),h=Nt.isPowerOf2?Nt.mipLevel<=1&&(Ut.glMinFilter===l.LINEAR_MIPMAP_NEAREST||Ut.glMinFilter===l.LINEAR_MIPMAP_LINEAR)?l.LINEAR:Ut.glMinFilter:Ut.glMinFilter===l.LINEAR||Ut.glMinFilter===l.LINEAR_MIPMAP_NEAREST||Ut.glMinFilter===l.LINEAR_MIPMAP_LINEAR?l.LINEAR:l.NEAREST,Nt.glWrapS!==a&&(u.texUnit!==Lt&&(l.activeTexture(l.TEXTURE0+Lt),u.texUnit=Lt),l.texParameteri(Nt.glTarget,l.TEXTURE_WRAP_S,a),Nt.glWrapS=a),Nt.glWrapT!==o&&(u.texUnit!==Lt&&(l.activeTexture(l.TEXTURE0+Lt),u.texUnit=Lt),l.texParameteri(Nt.glTarget,l.TEXTURE_WRAP_T,o),Nt.glWrapT=o),Nt.glMinFilter!==h&&(u.texUnit!==Lt&&(l.activeTexture(l.TEXTURE0+Lt),u.texUnit=Lt),l.texParameteri(Nt.glTarget,l.TEXTURE_MIN_FILTER,h),Nt.glMinFilter=h),Nt.glMagFilter!==Ut.glMagFilter&&(u.texUnit!==Lt&&(l.activeTexture(l.TEXTURE0+Lt),u.texUnit=Lt),l.texParameteri(Nt.glTarget,l.TEXTURE_MAG_FILTER,Ut.glMagFilter),Nt.glMagFilter=Ut.glMagFilter)}Dt=Bt.gpuDescriptors[++Pt]}else ks("Sampler binding '"+It.name+"' at set "+It.set+" binding "+It.binding+" index "+Ft+" is not bounded")}}if(i&&c&&(d||VI.gpuInputAssembler!==i)){VI.gpuInputAssembler=i;var Gt=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var Vt=t.extensions.OES_vertex_array_object,Ht=i.glVAOs.get(c.glProgram);if(!Ht){var zt;Ht=Vt.createVertexArrayOES(),i.glVAOs.set(c.glProgram,Ht),Vt.bindVertexArrayOES(Ht),l.bindBuffer(l.ARRAY_BUFFER,null),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,null),u.glArrayBuffer=null,u.glElementArrayBuffer=null;for(var Xt=c.glInputs.length,Wt=0;Wt=0&&(l.enableVertexAttribArray(le),u.glEnabledAttribLocs[le]=!0),u.glCurrentAttribLocs[le]=!0,l.vertexAttribPointer(le,re.count,re.glType,re.isNormalized,re.stride,ue),Gt&&Gt.vertexAttribDivisorANGLE(le,re.isInstanced?1:0)}}}var ce=i.gpuIndexBuffer;ce&&u.glElementArrayBuffer!==ce.glBuffer&&(l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,ce.glBuffer),u.glElementArrayBuffer=ce.glBuffer);for(var de=0;de0){var _=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(o,e.indexCount,a.glIndexType,_,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(o,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var f=e.firstIndex*h.stride;i.drawElements(o,e.indexCount,a.glIndexType,f)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}var YI=new Array(SI.COUNT);function jI(t,e){YI.fill(0);for(var i=0;i0?g.buffStride:d.width,f.height=g.buffTexHeight>0?g.buffTexHeight:d.height;var v,y=g.texExtent.width+_.x===i.width>>m?g.texExtent.width:d.width,T=g.texExtent.height+_.y===i.height>>m?g.texExtent.height:d.height,S=e[a++];v=f.width===d.width&&f.height===d.height?new l(S.buffer,S.byteOffset+g.buffOffset):qI(S,i.format,g.buffOffset,f,d),u?i.glInternalFmt===dI.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,m,i.glInternalFmt,y,T,0,v):r.compressedTexSubImage2D(r.TEXTURE_2D,m,_.x,_.y,y,T,i.glFormat,v):r.texSubImage2D(r.TEXTURE_2D,m,_.x,_.y,y,T,i.glFormat,i.glType,v)}break;case r.TEXTURE_CUBE_MAP:for(var A=0;A0?C.buffStride:d.width,f.height=C.buffTexHeight>0?C.buffTexHeight:d.height;var b=C.texExtent.width+_.x===i.width>>R?C.texExtent.width:d.width,x=C.texExtent.height+_.y===i.height>>R?C.texExtent.height:d.height,w=C.texSubres.baseArrayLayer+C.texSubres.layerCount;for(o=C.texSubres.baseArrayLayer;o0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=Vi(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),$I=function(){function t(){this._gpuShader=null,this._gpuDescriptorSetLayout=null,this._gpuPipelineLayout=null,this._gpuPipelineState=null,this._gpuVertexBuffer=null,this._gpuInputAssembler=null,this._gpuPointSampler=null,this._gpuLinearSampler=null,this._gpuDescriptorSet=null,this._gpuUniformBuffer=null,this._drawInfo=null,this._glFramebuffer=null,this._uniformBuffer=null;var t=fI.instance.gl,e=fI.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new At(0,0,"BlitParams",[new Et("tilingOffsetSrc",p.FLOAT4,1),new Et("tilingOffsetDst",p.FLOAT4,1)],1)],samplerTextures:[new Ct(0,e,"textureSrc",p.SAMPLER2D,1)],subpassInputs:[],gpuStages:[{type:D.VERTEX,source:"\n precision mediump float;\n\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n \n uniform vec4 tilingOffsetSrc;\n uniform vec4 tilingOffsetDst;\n \n varying vec2 v_texCoord;\n \n void main() {\n v_texCoord = a_texCoord * tilingOffsetSrc.xy + tilingOffsetSrc.zw;\n gl_Position = vec4((a_position + 1.0) * tilingOffsetDst.xy - 1.0 + tilingOffsetDst.zw * 2.0, 0, 1);\n }",glShader:null},{type:D.FRAGMENT,source:"\n precision mediump float;\n uniform sampler2D textureSrc;\n\n varying vec2 v_texCoord;\n \n void main() {\n gl_FragColor = texture2D(textureSrc, v_texCoord);\n }",glShader:null}],glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]},NI(fI.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new zt(0,W.UNIFORM_BUFFER,1,D.VERTEX),new zt(e,W.SAMPLER_TEXTURE,1,D.FRAGMENT)],dynamicBindings:[],descriptorIndices:[],descriptorCount:e+1};for(var i=0;i0&&(this._uniformBuffer=new Uint8Array(this._size)),this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,vf32:null,indirects:new JI,glTarget:0,glBuffer:null},this._usage&g.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),OI(fI.instance,this._gpuBuffer),fI.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(FI(fI.instance,this._gpuBuffer),fI.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e,i,n,r,s,a=this._size;a!==t&&(this._size=t,this._count=this._size/this._stride,this._uniformBuffer&&(this._uniformBuffer=new Uint8Array(t)),this._gpuBuffer&&(this._uniformBuffer&&(this._gpuBuffer.buffer=this._uniformBuffer),this._gpuBuffer.size=t,t>0&&(e=fI.instance,i=this._gpuBuffer,n=e.gl,r=e.stateCache,s=i.memUsage&y.HOST?n.DYNAMIC_DRAW:n.STATIC_DRAW,i.usage&g.VERTEX?(e.extensions.useVAO&&r.glVAO&&(e.extensions.OES_vertex_array_object.bindVertexArrayOES(null),r.glVAO=null),VI.gpuInputAssembler=null,e.stateCache.glArrayBuffer!==i.glBuffer&&n.bindBuffer(n.ARRAY_BUFFER,i.glBuffer),i.buffer?n.bufferData(n.ARRAY_BUFFER,i.buffer,s):n.bufferData(n.ARRAY_BUFFER,i.size,s),n.bindBuffer(n.ARRAY_BUFFER,null),e.stateCache.glArrayBuffer=null):i.usage&g.INDEX?(e.extensions.useVAO&&r.glVAO&&(e.extensions.OES_vertex_array_object.bindVertexArrayOES(null),r.glVAO=null),VI.gpuInputAssembler=null,e.stateCache.glElementArrayBuffer!==i.glBuffer&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,i.glBuffer),i.buffer?n.bufferData(n.ELEMENT_ARRAY_BUFFER,i.buffer,s):n.bufferData(n.ELEMENT_ARRAY_BUFFER,i.size,s),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,null),e.stateCache.glElementArrayBuffer=null):i.usage&g.UNIFORM?i.buffer&&(i.vf32=new Float32Array(i.buffer.buffer)):(i.usage&g.INDIRECT||i.usage&g.TRANSFER_DST||i.usage&g.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),i.glTarget=n.NONE),fI.instance.memoryStatus.bufferSize-=a,fI.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&g.INDIRECT?0:t.byteLength,LI(fI.instance,this._gpuBuffer,t,0,i))},Pi(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(a),eB=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new n(e);for(var i=0;ii&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;ot.capabilities.maxTextureSize&&hn(9100,s,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!ne[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),ne[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else for(var u=0;u>1),r=Math.max(1,r>>1);e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}}else e.glInternalFmt=function(t,e){switch(t){case _.R5G6B5:return e.RGB565;case _.RGB5A1:return e.RGB5_A1;case _.RGBA4:return e.RGBA4;case _.RGBA16F:return dI.RGBA16F_EXT;case _.RGBA32F:return dI.RGBA32F_EXT;case _.SRGB8_A8:return dI.SRGB8_ALPHA8_EXT;case _.DEPTH:return e.DEPTH_COMPONENT16;case _.DEPTH_STENCIL:return e.DEPTH_STENCIL;default:return console.error("Unsupported Format, convert to WebGL internal format failed."),e.RGBA}}(e.format,i),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r));break;case T.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);if(c>t.capabilities.maxCubeMapTextureSize&&hn(9100,c,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var d=t.stateCache.glTexUnits[t.stateCache.texUnit];if(d.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),d.glTexture=e.glTexture),ne[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var p=0;p>1),r=Math.max(1,r>>1)}}else for(var v=0;v<6;++v){n=e.width,r=e.height;for(var y=0;y>1),r=Math.max(1,r>>1)}e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=T.TEX2D,e.glTarget=i.TEXTURE_2D}}(fI.instance,this._gpuTexture),fI.instance.memoryStatus.textureSize+=this._size),this._viewInfo.texture=this,this._viewInfo.type=t.type,this._viewInfo.format=t.format,this._viewInfo.baseLevel=0,this._viewInfo.levelCount=t.levelCount,this._viewInfo.baseLayer=0,this._viewInfo.layerCount=t.layerCount)},i.destroy=function(){!this._isTextureView&&this._gpuTexture&&(function(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=ue(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,this._gpuTexture.isSwapchainTexture||(function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case T.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&hn(9100,s,t.capabilities.maxTextureSize),e.glRenderbuffer)t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r);else if(e.glTexture){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),ne[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else for(var u=0;u>1),r=Math.max(1,r>>1)}break;case T.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);c>t.capabilities.maxCubeMapTextureSize&&hn(9100,c,t.capabilities.maxTextureSize);var d=t.stateCache.glTexUnits[t.stateCache.texUnit];if(d.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),d.glTexture=e.glTexture),ne[e.format].isCompressed)for(var _=0;_<6;++_){n=e.width,r=e.height;for(var f=0;f>1),r=Math.max(1,r>>1)}}else for(var m=0;m<6;++m){n=e.width,r=e.height;for(var v=0;v>1),r=Math.max(1,r>>1)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=T.TEX2D,e.glTarget=i.TEXTURE_2D}}}(fI.instance,this._gpuTexture),fI.instance.memoryStatus.textureSize-=n,fI.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new yt;e.format=t.format,e.usage=ne[t.format].hasDepth?S.DEPTH_STENCIL_ATTACHMENT:S.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},Pi(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"lodLevel",get:function(){return this._lodLevel}}]),e}(Pe),vB="webglcontextlost";function yB(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;nt.capabilities.maxTextureSize&&hn(9100,o,t.capabilities.maxTextureSize),e.samples===C.ONE){if(e.glTexture=i.createTexture(),e.size>0){var h=t.stateCache.glTexUnits[t.stateCache.texUnit];if(h.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),h.glTexture=e.glTexture),ne[e.format].isCompressed)for(var l=0;l>1),r=Math.max(1,r>>1)}else i.texStorage2D(i.TEXTURE_2D,e.mipLevel,e.glInternalFmt,n,r)}}else e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case T.TEX2D_ARRAY:e.glTarget=i.TEXTURE_2D_ARRAY;var d=Math.max(n,r);if(d>t.capabilities.maxTextureSize&&hn(9100,d,t.capabilities.maxTextureSize),a>t.capabilities.maxArrayTextureLayers&&hn(9100,a,t.capabilities.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var f=t.stateCache.glTexUnits[t.stateCache.texUnit];if(f.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D_ARRAY,e.glTexture),f.glTexture=e.glTexture),ne[e.format].isCompressed)for(var p=0;p>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_2D_ARRAY,e.mipLevel,e.glInternalFmt,n,r,a)}break;case T.TEX3D:e.glTarget=i.TEXTURE_3D;var v=Math.max(Math.max(n,r),s);if(v>t.capabilities.max3DTextureSize&&hn(9100,v,t.capabilities.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var y=t.stateCache.glTexUnits[t.stateCache.texUnit];if(y.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_3D,e.glTexture),y.glTexture=e.glTexture),ne[e.format].isCompressed)for(var S=0;S>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_3D,e.mipLevel,e.glInternalFmt,n,r,s)}break;case T.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var R=Math.max(n,r);if(R>t.capabilities.maxCubeMapTextureSize&&hn(9100,R,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var b=t.stateCache.glTexUnits[t.stateCache.texUnit];if(b.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),b.glTexture=e.glTexture),ne[e.format].isCompressed)for(var x=0;x>1),r=Math.max(1,r>>1)}else i.texStorage2D(i.TEXTURE_CUBE_MAP,e.mipLevel,e.glInternalFmt,n,r)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=T.TEX2D,e.glTarget=i.TEXTURE_2D}}function KB(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s=0&&S.gpuDescriptors[E];if(A&&A.gpuBuffer){var C=v[T.set],R=C&&C[T.binding],b=A.gpuBuffer.glOffset;R>=0&&(b+=r[R]),o.glBindUBOs[T.glBinding]===A.gpuBuffer.glBuffer&&o.glBindUBOOffsets[T.glBinding]===b||(b?a.bindBufferRange(a.UNIFORM_BUFFER,T.glBinding,A.gpuBuffer.glBuffer,b,A.gpuBuffer.size):a.bindBufferBase(a.UNIFORM_BUFFER,T.glBinding,A.gpuBuffer.glBuffer),o.glUniformBuffer=o.glBindUBOs[T.glBinding]=A.gpuBuffer.glBuffer,o.glBindUBOOffsets[T.glBinding]=b)}else ks("Buffer binding '"+T.name+"' at set "+T.set+" binding "+T.binding+" is not bounded")}for(var x=h.glSamplerTextures.length,w=0;w=0&&I.gpuDescriptors[B],O=0;O0){L.glTexture!==k.glTexture&&(o.texUnit!==F&&(a.activeTexture(a.TEXTURE0+F),o.texUnit=F),k.glTexture?a.bindTexture(k.glTarget,k.glTexture):a.bindTexture(k.glTarget,t.nullTex2D.gpuTexture.glTexture),L.glTexture=k.glTexture);var V=D.gpuSampler.getGLSampler(t,U,G);o.glSamplerUnits[F]!==V&&(a.bindSampler(F,V),o.glSamplerUnits[F]=V)}D=I.gpuDescriptors[++B]}else ks("Sampler binding '"+M.name+"' at set "+M.set+" binding "+M.binding+" index "+O+" is not bounded")}}if(i&&h&&(l||qB.gpuInputAssembler!==i))if(qB.gpuInputAssembler=i,t.extensions.useVAO){var X=i.glVAOs.get(h.glProgram);if(!X){var W;X=a.createVertexArray(),i.glVAOs.set(h.glProgram,X),a.bindVertexArray(X),a.bindBuffer(a.ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),o.glArrayBuffer=null,o.glElementArrayBuffer=null;for(var Y=0;Y=0&&(a.enableVertexAttribArray(ot),o.glEnabledAttribLocs[ot]=!0),o.glCurrentAttribLocs[ot]=!0,a.vertexAttribPointer(ot,nt.count,nt.glType,nt.isNormalized,nt.stride,ht),a.vertexAttribDivisor(ot,nt.isInstanced?1:0)}}}var lt=i.gpuIndexBuffer;lt&&o.glElementArrayBuffer!==lt.glBuffer&&(a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,lt.glBuffer),o.glElementArrayBuffer=lt.glBuffer);for(var ut=0;ut0){var c=e.firstIndex*a.stride;i.drawElementsInstanced(r,e.indexCount,n.glIndexType,c,e.instanceCount)}}else e.vertexCount>0&&i.drawArraysInstanced(r,e.firstVertex,e.vertexCount,e.instanceCount);else if(a){if(e.indexCount>0){var d=e.firstIndex*a.stride;i.drawElements(r,e.indexCount,n.glIndexType,d)}}else e.vertexCount>0&&i.drawArrays(r,e.firstVertex,e.vertexCount)}}var $B=new Array(DB.COUNT);function tP(t,e){$B.fill(0);for(var i=0;i0?g.buffStride:d.width,f.height=g.buffTexHeight>0?g.buffTexHeight:d.height;var v,y=g.texExtent.width+_.x===i.width>>m?g.texExtent.width:d.width,T=g.texExtent.height+_.y===i.height>>m?g.texExtent.height:d.height,S=e[a++];v=f.width===d.width&&f.height===d.height?new l(S.buffer,S.byteOffset+g.buffOffset):iP(S,i.format,g.buffOffset,f,d),u?i.glInternalFmt!==AB.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage2D(r.TEXTURE_2D,m,_.x,_.y,y,T,i.glFormat,v):r.compressedTexImage2D(r.TEXTURE_2D,m,i.glInternalFmt,y,T,0,v):r.texSubImage2D(r.TEXTURE_2D,m,_.x,_.y,y,T,i.glFormat,i.glType,v)}break;case r.TEXTURE_2D_ARRAY:for(var A=0;A0?C.buffStride:d.width,f.height=C.buffTexHeight>0?C.buffTexHeight:d.height;var b=C.texExtent.width+_.x===i.width>>R?C.texExtent.width:d.width,x=C.texExtent.height+_.y===i.height>>R?C.texExtent.height:d.height,w=C.texSubres.baseArrayLayer+C.texSubres.layerCount;for(o=C.texSubres.baseArrayLayer;o0?P.buffStride:d.width,f.height=P.buffTexHeight>0?P.buffTexHeight:d.height;var O,F=P.texExtent.width+_.x===i.width>>D?P.texExtent.width:d.width,L=P.texExtent.height+_.y===i.height>>D?P.texExtent.height:d.height,N=e[a++];O=f.width===d.width&&f.height===d.height?new l(N.buffer,N.byteOffset+P.buffOffset):iP(N,i.format,P.buffOffset,f,d),u?i.glInternalFmt!==AB.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,D,_.x,_.y,_.z,F,L,d.depth,i.glFormat,O):r.compressedTexImage3D(r.TEXTURE_2D_ARRAY,D,i.glInternalFmt,F,L,d.depth,0,O):r.texSubImage3D(r.TEXTURE_2D_ARRAY,D,_.x,_.y,_.z,F,L,d.depth,i.glFormat,i.glType,O)}break;case r.TEXTURE_CUBE_MAP:for(var k=0;k0?U.buffStride:d.width,f.height=U.buffTexHeight>0?U.buffTexHeight:d.height;var V=U.texExtent.width+_.x===i.width>>G?U.texExtent.width:d.width,H=U.texExtent.height+_.y===i.height>>G?U.texExtent.height:d.height,z=U.texSubres.baseArrayLayer+U.texSubres.layerCount;for(o=U.texSubres.baseArrayLayer;o0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=Vi(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),aP=function(){function t(){this._srcFramebuffer=void 0,this._dstFramebuffer=void 0;var t=RB.instance.gl;this._srcFramebuffer=t.createFramebuffer(),this._dstFramebuffer=t.createFramebuffer()}return t.prototype.destroy=function(){var t=RB.instance.gl;t.deleteFramebuffer(this._srcFramebuffer),t.deleteFramebuffer(this._dstFramebuffer)},Pi(t,[{key:"srcFramebuffer",get:function(){return this._srcFramebuffer}},{key:"dstFramebuffer",get:function(){return this._dstFramebuffer}}]),t}(),oP=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),qB.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer),i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null))}else if(e.usage&g.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),qB.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else if(e.usage&g.UNIFORM){e.glTarget=i.UNIFORM_BUFFER;var o=i.createBuffer();o&&e.size>0&&(e.glBuffer=o,t.stateCache.glUniformBuffer!==e.glBuffer&&(i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),t.stateCache.glUniformBuffer=e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null)}else e.usage&g.INDIRECT||e.usage&g.TRANSFER_DST||e.usage&g.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE}(RB.instance,this._gpuBuffer),RB.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(this._isBufferView||(function(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),qB.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),qB.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null;break;case i.UNIFORM_BUFFER:i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}(RB.instance,this._gpuBuffer),RB.instance.memoryStatus.bufferSize-=this._size),this._gpuBuffer=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e,i,n,r,s,a=this._size;a!==t&&(this._size=t,this._count=this._size/this._stride,this._gpuBuffer&&(this._gpuBuffer.size=t,t>0&&(e=RB.instance,i=this._gpuBuffer,n=e.gl,r=e.stateCache,s=i.memUsage&y.HOST?n.DYNAMIC_DRAW:n.STATIC_DRAW,i.usage&g.VERTEX?(e.extensions.useVAO&&r.glVAO&&(n.bindVertexArray(null),r.glVAO=null),qB.gpuInputAssembler=null,r.glArrayBuffer!==i.glBuffer&&n.bindBuffer(n.ARRAY_BUFFER,i.glBuffer),i.buffer?n.bufferData(n.ARRAY_BUFFER,i.buffer,s):n.bufferData(n.ARRAY_BUFFER,i.size,s),n.bindBuffer(n.ARRAY_BUFFER,null),r.glArrayBuffer=null):i.usage&g.INDEX?(e.extensions.useVAO&&r.glVAO&&(n.bindVertexArray(null),r.glVAO=null),qB.gpuInputAssembler=null,e.stateCache.glElementArrayBuffer!==i.glBuffer&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,i.glBuffer),i.buffer?n.bufferData(n.ELEMENT_ARRAY_BUFFER,i.buffer,s):n.bufferData(n.ELEMENT_ARRAY_BUFFER,i.size,s),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,null),e.stateCache.glElementArrayBuffer=null):i.usage&g.UNIFORM?(e.stateCache.glUniformBuffer!==i.glBuffer&&n.bindBuffer(n.UNIFORM_BUFFER,i.glBuffer),n.bufferData(n.UNIFORM_BUFFER,i.size,s),n.bindBuffer(n.UNIFORM_BUFFER,null),e.stateCache.glUniformBuffer=null):(i.usage&g.INDIRECT||i.usage&g.TRANSFER_DST||i.usage&g.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),i.glTarget=n.NONE),RB.instance.memoryStatus.bufferSize-=a,RB.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&g.INDIRECT?0:t.byteLength,YB(RB.instance,this._gpuBuffer,t,0,i))},Pi(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}}]),e}(a),hP=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new n(e);for(var i=0;i0?this.gpuColorViews[0].gpuTexture.width:this.gpuDepthStencilView.gpuTexture.width},set width(t){s=t},get height(){return this.isOffscreen?s:this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.height:this.gpuDepthStencilView.gpuTexture.height},set height(t){}},function(t,e){for(var i=0;i>o.baseLevel),e.height=Math.min(e.height,h.height>>o.baseLevel))}var l=e.gpuDepthStencilView;if(l){var u=l.gpuTexture,c=ne[u.format].hasStencil?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;u.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,c,u.glTarget,u.glTexture,e.gpuDepthStencilView.baseLevel):n.framebufferRenderbuffer(n.FRAMEBUFFER,c,n.RENDERBUFFER,u.glRenderbuffer),e.width=Math.min(e.width,u.width>>l.baseLevel),e.height=Math.min(e.height,u.height>>l.baseLevel)}n.drawBuffers(r);var d=n.checkFramebufferStatus(n.FRAMEBUFFER);if(d!==n.FRAMEBUFFER_COMPLETE)switch(d){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case n.FRAMEBUFFER_UNSUPPORTED:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED")}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(RB.instance,this._gpuFramebuffer)},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=RB.instance,(e=this._gpuFramebuffer).glFramebuffer&&(t.gl.deleteFramebuffer(e.glFramebuffer),t.stateCache.glFramebuffer===e.glFramebuffer&&(t.gl.bindFramebuffer(t.gl.FRAMEBUFFER,null),t.stateCache.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null)},Pi(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}}]),e}(ve),dP=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ri&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var P=0;P1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=ue(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,this._gpuTexture.isSwapchainTexture||(function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height,s=e.depth,a=e.arrayLayer;switch(e.type){case T.TEX2D:e.glTarget=i.TEXTURE_2D;var o=Math.max(n,r);if(o>t.capabilities.maxTextureSize&&hn(9100,o,t.capabilities.maxTextureSize),e.samples===C.ONE){var h=t.stateCache.glTexUnits[t.stateCache.texUnit];if(h.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),h.glTexture=e.glTexture),ne[e.format].isCompressed)for(var l=0;l>1),r=Math.max(1,r>>1)}else KB(t,e),jB(t,e)}else e.glRenderbuffer&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case T.TEX2D_ARRAY:e.glTarget=i.TEXTURE_2D_ARRAY;var d=Math.max(n,r);if(d>t.capabilities.maxTextureSize&&hn(9100,d,t.capabilities.maxTextureSize),a>t.capabilities.maxArrayTextureLayers&&hn(9100,a,t.capabilities.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D_ARRAY,e.glTexture),_.glTexture=e.glTexture),ne[e.format].isCompressed)for(var f=0;f>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_2D_ARRAY,e.mipLevel,e.glInternalFmt,n,r,a)}break;case T.TEX3D:e.glTarget=i.TEXTURE_3D;var m=Math.max(Math.max(n,r),s);if(m>t.capabilities.max3DTextureSize&&hn(9100,m,t.capabilities.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var v=t.stateCache.glTexUnits[t.stateCache.texUnit];if(v.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_3D,e.glTexture),v.glTexture=e.glTexture),ne[e.format].isCompressed)for(var y=0;y>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_3D,e.mipLevel,e.glInternalFmt,n,r,s)}break;case T.CUBE:e.type=T.CUBE,e.glTarget=i.TEXTURE_CUBE_MAP;var A=Math.max(n,r);A>t.capabilities.maxCubeMapTextureSize&&hn(9100,A,t.capabilities.maxTextureSize);var R=t.stateCache.glTexUnits[t.stateCache.texUnit];if(R.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),R.glTexture=e.glTexture),ne[e.format].isCompressed)for(var b=0;b<6;++b){n=e.width,r=e.height;for(var x=0;x>1),r=Math.max(1,r>>1)}}else KB(t,e),jB(t,e);break;default:console.error("Unsupported TextureType, create texture failed."),e.type=T.TEX2D,e.glTarget=i.TEXTURE_2D}}}(RB.instance,this._gpuTexture),RB.instance.memoryStatus.textureSize-=n,RB.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new yt;e.format=t.format,e.usage=ne[t.format].hasDepth?S.DEPTH_STENCIL_ATTACHMENT:S.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},Pi(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"gpuTextureView",get:function(){return this._gpuTextureView}}]),e}(Pe),CP="webglcontextlost";function RP(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n=0){var s=t._probes,a=s[this.vertex0].position,o=s[this.vertex1].position,h=s[this.vertex2].position,l=s[this.vertex3].position;this.sphere.init(a,o,h,l)}}var e=t.prototype;return e.isInCircumSphere=function(t){return ji.squaredDistance(t,this.sphere.center)=0},e.isOuterCell=function(){return this.vertex3<0},t}(),tD=tn($P.prototype,"invalid",[dD],(function(){return!1})),eD=tn($P.prototype,"vertex0",[dD],(function(){return-1})),iD=tn($P.prototype,"vertex1",[dD],(function(){return-1})),nD=tn($P.prototype,"vertex2",[dD],(function(){return-1})),rD=tn($P.prototype,"vertex3",[dD],(function(){return-1})),sD=tn($P.prototype,"neighbours",[dD],(function(){return[-1,-1,-1,-1]})),aD=tn($P.prototype,"matrix",[dD],(function(){return new ha})),oD=tn($P.prototype,"offset",[dD],(function(){return new ji(0,0,0)})),hD=tn($P.prototype,"sphere",[dD],(function(){return new CD})),JP=$P))||JP),bD=t("Delaunay",function(){function t(t){this._probes=[],this._tetrahedrons=[],this._triangles=[],this._edges=[],this._probes=t}var e=t.prototype;return e.build=function(){return this.reset(),this.tetrahedralize(),this.computeAdjacency(),this.computeMatrices(),this._tetrahedrons},e.reset=function(){this._tetrahedrons.length=0,this._triangles.length=0,this._edges.length=0},e.tetrahedralize=function(){for(var t=this._probes.length,e=this.initTetrahedron(),i=0;i0&&ji.negate(t,t),ji.add(u.normal,u.normal,t),ji.add(c.normal,c.normal,t),ji.add(d.normal,d.normal,t);var p=this._triangles[h].vertex0,g=f>0?this._triangles[h].vertex2:this._triangles[h].vertex1,m=f>0?this._triangles[h].vertex1:this._triangles[h].vertex2,v=new RD(this,p,g,m);v.neighbours[3]=this._triangles[h].tetrahedron,this._tetrahedrons[this._triangles[h].tetrahedron].neighbours[this._triangles[h].index]=this._tetrahedrons.length,this._tetrahedrons.push(v)}}for(var y=0,T=r;T=0?this.computeTetrahedronMatrix(e):this.computeOuterCellMatrix(e)}},e.computeTetrahedronMatrix=function(t){var e=this._probes[t.vertex0].position,i=this._probes[t.vertex1].position,n=this._probes[t.vertex2].position,r=this._probes[t.vertex3].position;t.matrix.set(e.x-r.x,i.x-r.x,n.x-r.x,e.y-r.y,i.y-r.y,n.y-r.y,e.z-r.z,i.z-r.z,n.z-r.z),t.matrix.invert(),t.matrix.transpose()},e.computeOuterCellMatrix=function(t){var e=[],i=[];e[0]=this._probes[t.vertex0].normal,e[1]=this._probes[t.vertex1].normal,e[2]=this._probes[t.vertex2].normal,i[0]=this._probes[t.vertex0].position,i[1]=this._probes[t.vertex1].position,i[2]=this._probes[t.vertex2].position,ji.subtract(pD,i[0],i[2]),ji.subtract(gD,e[0],e[2]),ji.subtract(mD,i[1],i[2]),ji.subtract(vD,e[1],e[2]),yD.set(i[2]),ji.negate(TD,e[2]);var n=[];n[0]=gD.y*vD.z-gD.z*vD.y,n[3]=-gD.x*vD.z+gD.z*vD.x,n[6]=gD.x*vD.y-gD.y*vD.x,n[9]=pD.x*vD.y*TD.z-pD.y*vD.x*TD.z+gD.x*mD.y*TD.z-gD.y*mD.x*TD.z+pD.z*vD.x*TD.y-pD.z*vD.y*TD.x+gD.z*mD.x*TD.y-gD.z*mD.y*TD.x-pD.x*vD.z*TD.y+pD.y*vD.z*TD.x-gD.x*mD.z*TD.y+gD.y*mD.z*TD.x,n[9]-=yD.x*n[0]+yD.y*n[3]+yD.z*n[6],n[1]=gD.y*mD.z+pD.y*vD.z-gD.z*mD.y-pD.z*vD.y,n[4]=-pD.x*vD.z-gD.x*mD.z+pD.z*vD.x+gD.z*mD.x,n[7]=pD.x*vD.y-pD.y*vD.x+gD.x*mD.y-gD.y*mD.x,n[10]=pD.x*mD.y*TD.z-pD.y*mD.x*TD.z-pD.x*mD.z*TD.y+pD.y*mD.z*TD.x+pD.z*mD.x*TD.y-pD.z*mD.y*TD.x,n[10]-=yD.x*n[1]+yD.y*n[4]+yD.z*n[7],n[2]=-pD.z*mD.y+pD.y*mD.z,n[5]=-pD.x*mD.z+pD.z*mD.x,n[8]=pD.x*mD.y-pD.y*mD.x,n[11]=0,n[11]-=yD.x*n[2]+yD.y*n[5]+yD.z*n[8];var r=gD.x*vD.y*TD.z-gD.y*vD.x*TD.z+gD.z*vD.x*TD.y-gD.z*vD.y*TD.x+gD.y*vD.z*TD.x-gD.x*vD.z*TD.y;if(Math.abs(r)>Mn)for(var s=0;s<12;s++)n[s]/=r;else t.vertex3=-2;t.matrix.set(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8]),t.offset.set(n[9],n[10],n[11])},t}()),xD=t("LightProbeSampler",function(){function t(){}return t.uniformSampleSphere=function(t,e){var i=1-2*t,n=Math.sqrt(Math.max(0,1-i*i)),r=2*Math.PI*e,s=n*Math.cos(r),a=n*Math.sin(r);return new ji(s,a,i)},t.uniformSampleSphereAll=function(t){for(var e=Math.floor(Math.sqrt(t)),i=e,n=[],r=1/e,s=1/i,a=0;a0&&t.length===e.length);for(var i=this.getBasisCount(),n=t.length,r=1/(xD.uniformSpherePdf()*n),s=[],a=0;a0){var h=Math.sqrt(o);n.push(Math.cbrt(-a+h)+Math.cbrt(-a-h))}else if(o<0){var l=Math.acos(-a*Math.sqrt(-s)/(s*s))/3;n.push(2*Math.sqrt(-s)*Math.cos(l)),n.push(2*Math.sqrt(-s)*Math.cos(l+2*Math.PI/3)),n.push(2*Math.sqrt(-s)*Math.cos(l+4*Math.PI/3))}else if(0===a)n.push(0);else{var u=Math.cbrt(a);n.push(u),n.push(-2*u)}for(var c=0;c=0)return n[c]+r;return 0},t}(),ND=new ji(0,0,0),kD=new ji(0,0,0),UD=new ji(0,0,0),GD=new ji(0,0,0),VD=new ji(0,0,0),HD=new ji(0,0,0),zD=new ji(0,0,0),XD=new ji(0,0,0),WD=new ji(0,0,0),YD=new ji(0,0,0),jD=new ji(0,0,0),KD=new ji(0,0,0),qD=new ji(0,0,0),ZD=new ji(0,0,0),QD=new ji(0,0,0),JD=t("LightProbesData",(MD=Ki("cc.LightProbesData"),ID=Tn([SD]),BD=Tn([RD]),MD((DD=function(){function t(){this._probes=OD&&OD(),this._tetrahedrons=FD&&FD()}var e=t.prototype;return e.empty=function(){return 0===this._probes.length||0===this._tetrahedrons.length},e.reset=function(){this._probes.length=0,this._tetrahedrons.length=0},e.updateProbes=function(t){this._probes.length=0;for(var e=t.length,i=0;i=0)for(var h=this._probes[r.vertex3].coefficients,l=0;l=n)&&(e=0);for(var r=-1,s=-1,a=0;a=0&&i.y>=0&&i.z>=0&&i.w>=0)break;if(r===(s=i.x=0?this.getTetrahedronBarycentricCoord(t,e,i):this.getOuterCellBarycentricCoord(t,e,i)},e.getTetrahedronBarycentricCoord=function(t,e,i){var n=new ji(0,0,0);ji.subtract(n,t,this._probes[e.vertex3].position),ji.transformMat3(n,n,e.matrix),i.set(n.x,n.y,n.z,1-n.x-n.y-n.z)},e.getOuterCellBarycentricCoord=function(e,i,n){var r=this._probes[i.vertex0].position,s=this._probes[i.vertex1].position,a=this._probes[i.vertex2].position;ji.subtract(YD,s,r),ji.subtract(jD,a,r),ji.cross(WD,YD,jD),ji.subtract(KD,e,r);var o=ji.dot(KD,WD);if(o<0)n.set(0,0,0,-1);else{var h=new ji(0,0,0);ji.transformMat3(h,e,i.matrix),ji.add(h,h,i.offset),o=-1===i.vertex3?LD.getCubicUniqueRoot(h.x,h.y,h.z):LD.getQuadraticUniqueRoot(h.x,h.y,h.z),ji.scaleAndAdd(qD,r,this._probes[i.vertex0].normal,o),ji.scaleAndAdd(ZD,s,this._probes[i.vertex1].normal,o),ji.scaleAndAdd(QD,a,this._probes[i.vertex2].normal,o);var l=t.getTriangleBarycentricCoord(qD,ZD,QD,e);n.set(l.x,l.y,l.z,0)}},Pi(t,[{key:"probes",get:function(){return this._probes}},{key:"tetrahedrons",get:function(){return this._tetrahedrons}}]),t}(),OD=tn(DD.prototype,"_probes",[en,ID],(function(){return[]})),FD=tn(DD.prototype,"_tetrahedrons",[en,BD],(function(){return[]})),PD=DD))||PD));We.internal.LightProbesData=JD;var $D,tO,eO,iO,nO,rO,sO,aO,oO,hO,lO,uO,cO,dO,_O,fO=t("LightProbes",function(){function t(){this._giScale=1,this._giSamples=1024,this._bounces=2,this._reduceRinging=0,this._showProbe=!0,this._showWireframe=!0,this._showConvex=!1,this._data=null}var e=t.prototype;return e.initialize=function(t){this._giScale=t.giScale,this._giSamples=t.giSamples,this._bounces=t.bounces,this._reduceRinging=t.reduceRinging,this._showProbe=t.showProbe,this._showWireframe=t.showWireframe,this._showConvex=t.showConvex,this._data=t.data},e.empty=function(){return!this._data||this._data.empty()},Pi(t,[{key:"giScale",get:function(){return this._giScale},set:function(t){this._giScale=t}},{key:"giSamples",get:function(){return this._giSamples},set:function(t){this._giSamples=t}},{key:"bounces",get:function(){return this._bounces},set:function(t){this._bounces=t}},{key:"reduceRinging",get:function(){return this._reduceRinging},set:function(t){this._reduceRinging=t}},{key:"showProbe",get:function(){return this._showProbe},set:function(t){this._showProbe=t}},{key:"showWireframe",get:function(){return this._showWireframe},set:function(t){this._showWireframe=t}},{key:"showConvex",get:function(){return this._showConvex},set:function(t){this._showConvex=t}},{key:"data",get:function(){return this._data},set:function(t){this._data=t}}]),t}());We.internal.LightProbes=fO,t("LightProbeGroup",($D=Ki("cc.LightProbeGroup"),tO=Tn([ji]),eO=Tn(lD),iO=Tn(Qr),nO=Tn(Qr),rO=Tn(Qr),$D(sO=bn((aO=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r1){var n=0;ji.subtract(MO,t[1],t[0]),this._vdataF32[n++]=t[0].x,this._vdataF32[n++]=t[0].y,this._vdataF32[n++]=t[0].z,this._vdataF32[n++]=0,this._vdataF32[n++]=e.evaluate(0,1),this._vdataF32[n++]=0,this._vdataF32[n++]=0,this._vdataF32[n++]=MO.x,this._vdataF32[n++]=MO.y,this._vdataF32[n++]=MO.z,this._vdataUint32[n++]=i.evaluate(0,1)._val,this._vdataF32[n++]=t[0].x,this._vdataF32[n++]=t[0].y,this._vdataF32[n++]=t[0].z,this._vdataF32[n++]=1,this._vdataF32[n++]=e.evaluate(0,1),this._vdataF32[n++]=0,this._vdataF32[n++]=1,this._vdataF32[n++]=MO.x,this._vdataF32[n++]=MO.y,this._vdataF32[n++]=MO.z,this._vdataUint32[n++]=i.evaluate(0,1)._val;for(var r=1;r1&&this.colorKeys.sort((function(t,e){return t.time-e.time})),this.alphaKeys.length>1&&this.alphaKeys.sort((function(t,e){return t.time-e.time}))},e.evaluate=function(t){return this.getRGB(t),this._color._set_a_unsafe(this.getAlpha(t)),this._color},e.randomColor=function(){var t=this.colorKeys[Math.trunc(Math.random()*this.colorKeys.length)],e=this.alphaKeys[Math.trunc(Math.random()*this.alphaKeys.length)];return this._color.set(t.color),this._color._set_a_unsafe(e.alpha),this._color},e.getRGB=function(t){if(this.colorKeys.length>1){t=_a(t,1);for(var e=1;e=i&&tthis.colorKeys[s].time&&Ve.lerp(this._color,this.colorKeys[s].color,Ve.BLACK,(t-this.colorKeys[s].time)/(1-this.colorKeys[s].time)),this._color}return 1===this.colorKeys.length?(this._color.set(this.colorKeys[0].color),this._color):(this._color.set(Ve.WHITE),this._color)},e.getAlpha=function(t){if(this.alphaKeys.length>1){t=_a(t,1);for(var e=1;e=i&&tthis.alphaKeys[s].time?Cs(this.alphaKeys[s].alpha,0,(t-this.alphaKeys[s].time)/(1-this.alphaKeys[s].time)):255}return 1===this.alphaKeys.length?this.alphaKeys[0].alpha:255},t}());aF.Mode=GO,ua.fastDefine("cc.Gradient",aF,{colorKeys:[],alphaKeys:[],mode:GO.Blend}),ua.Attr.setClassAttr(aF,"colorKeys","visible",!0),ua.Attr.setClassAttr(aF,"alphaKeys","visible",!0),ua.Attr.setClassAttr(aF,"mode","visible",!0);var oF,hF,lF,uF,cF,dF,_F,fF,pF,gF,mF,vF,yF,TF,SF,EF,AF,CF,RF,bF,xF,wF,MF=aa,IF=fr({Color:0,Gradient:1,TwoColors:2,TwoGradients:3,RandomColor:4}),BF=t("GradientRange",(zO=Ki("cc.GradientRange"),XO=Tn(IF),WO=Tn(aF),YO=Tn(aF),jO=Tn(aF),KO=Tn(IF),zO((sF=rF=function(){function t(){this.color=QO&&QO(),this.colorMin=JO&&JO(),this.colorMax=$O&&$O(),this.gradient=tF&&tF(),this.gradientMin=eF&&eF(),this.gradientMax=iF&&iF(),this._mode=nF&&nF(),this._color=Ve.WHITE.clone()}var e=t.prototype;return e.evaluate=function(t,e){switch(this._mode){case IF.Color:return this.color;case IF.TwoColors:return Ve.lerp(this._color,this.colorMin,this.colorMax,e),this._color;case IF.RandomColor:return this.gradient.randomColor();case IF.Gradient:return this.gradient.evaluate(t);case IF.TwoGradients:return Ve.lerp(this._color,this.gradientMin.evaluate(t),this.gradientMax.evaluate(t),e),this._color;default:return this.color}},e._onBeforeSerialize=function(){return MF[this._mode]},Pi(t,[{key:"mode",get:function(){return this._mode},set:function(t){this._mode=t}}]),t}(),rF.Mode=IF,gn((ZO=sF).prototype,"mode",[XO],Object.getOwnPropertyDescriptor(ZO.prototype,"mode"),ZO.prototype),QO=tn(ZO.prototype,"color",[en],(function(){return Ve.WHITE.clone()})),JO=tn(ZO.prototype,"colorMin",[en],(function(){return Ve.WHITE.clone()})),$O=tn(ZO.prototype,"colorMax",[en],(function(){return Ve.WHITE.clone()})),tF=tn(ZO.prototype,"gradient",[WO],(function(){return new aF})),eF=tn(ZO.prototype,"gradientMin",[YO],(function(){return new aF})),iF=tn(ZO.prototype,"gradientMax",[jO],(function(){return new aF})),nF=tn(ZO.prototype,"_mode",[KO],(function(){return IF.Color})),qO=ZO))||qO));function PF(t,e,i){switch(t.mode){case IF.Color:return t.color;case IF.TwoColors:return 0===i?t.colorMin:t.colorMax;case IF.RandomColor:return t.gradient.randomColor();case IF.Gradient:return t.gradient.evaluate(e);case IF.TwoGradients:return 0===i?t.gradientMin.evaluate(e):t.gradientMax.evaluate(e);default:return t.color}}var DF={parent:null,owner:null,subModelIdx:0},OF={CC_USE_WORLD_SPACE:!1},FF=function(e){return t({Line:e,LineComponent:e}),e}((oF=Ki("cc.Line"),hF=Tn(Xe),lF=Tn(Xe),uF=Tn(Dn),cF=Tn([ji]),dF=Tn([ji]),_F=Tn(FO),fF=Tn(FO),pF=Tn(cn),gF=Tn(cn),mF=Tn(BF),vF=Tn(BF),oF((TF=function(t){function e(){var e;return(e=t.call(this)||this)._texture=SF&&SF(),e._material=EF&&EF(),e._materialInstance=null,e._worldSpace=AF&&AF(),e._positions=CF&&CF(),e._width=RF&&RF(),e._tile=bF&&bF(),e._offset=xF&&xF(),e._color=wF&&wF(),e._model=null,e._tile_offset=new _n,e}He(e,t);var i=e.prototype;return i.onLoad=function(){var t=this._model=We.director.root.createModel(BO);t.node=t.transform=this.node,null===this._material&&(this._material=new Dn,this._material.copy(Nn.get("default-trail-material"))),this._material&&(OF.CC_USE_WORLD_SPACE=this.worldSpace,DF.parent=this._material,DF.subModelIdx=0,this._materialInstance=new On(DF),DF.parent=null,DF.subModelIdx=0,this._materialInstance.recompileShaders(OF)),t.updateMaterial(this._materialInstance),t.setCapacity(100)},i.onEnable=function(){this._model&&(this._attachToScene(),this.texture=this._texture,this.tile=this._tile,this.offset=this._offset,this._model.addLineVertexData(this._positions,this._width,this._color))},i.onDisable=function(){this._model&&this._detachFromScene()},i._attachToScene=function(){this._model&&this.node&&this.node.scene&&(this._model.scene&&this._detachFromScene(),this._getRenderScene().addModel(this._model))},i._detachFromScene=function(){this._model&&this._model.scene&&this._model.scene.removeModel(this._model)},Pi(e,[{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this._materialInstance&&this._materialInstance.setProperty("mainTexture",t)}},{key:"material",get:function(){return this._material},set:function(t){this._material=t}},{key:"worldSpace",get:function(){return this._worldSpace},set:function(t){this._worldSpace=t,this._materialInstance&&(OF.CC_USE_WORLD_SPACE=this.worldSpace,this._materialInstance.recompileShaders(OF),this._model&&this._model.setSubModelMaterial(0,this._materialInstance))}},{key:"positions",get:function(){return this._positions},set:function(t){this._positions=t,this._model&&this._model.addLineVertexData(this._positions,this._width,this._color)}},{key:"width",get:function(){return this._width},set:function(t){this._width=t,this._model&&this._model.addLineVertexData(this._positions,this._width,this._color)}},{key:"tile",get:function(){return this._tile},set:function(t){this._tile.set(t),this._materialInstance&&(this._tile_offset.x=this._tile.x,this._tile_offset.y=this._tile.y,this._materialInstance.setProperty("mainTiling_Offset",this._tile_offset))}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset.set(t),this._materialInstance&&(this._tile_offset.z=this._offset.x,this._tile_offset.w=this._offset.y,this._materialInstance.setProperty("mainTiling_Offset",this._tile_offset))}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._model&&this._model.addLineVertexData(this._positions,this._width,this._color)}}]),e}(Pn),SF=tn(TF.prototype,"_texture",[hF],(function(){return null})),gn(TF.prototype,"texture",[lF],Object.getOwnPropertyDescriptor(TF.prototype,"texture"),TF.prototype),EF=tn(TF.prototype,"_material",[en],(function(){return null})),gn(TF.prototype,"material",[uF],Object.getOwnPropertyDescriptor(TF.prototype,"material"),TF.prototype),AF=tn(TF.prototype,"_worldSpace",[en],(function(){return!1})),CF=tn(TF.prototype,"_positions",[cF],(function(){return[]})),gn(TF.prototype,"positions",[dF],Object.getOwnPropertyDescriptor(TF.prototype,"positions"),TF.prototype),RF=tn(TF.prototype,"_width",[_F],(function(){return new FO})),gn(TF.prototype,"width",[fF],Object.getOwnPropertyDescriptor(TF.prototype,"width"),TF.prototype),bF=tn(TF.prototype,"_tile",[en],(function(){return new cn(1,1)})),gn(TF.prototype,"tile",[pF],Object.getOwnPropertyDescriptor(TF.prototype,"tile"),TF.prototype),xF=tn(TF.prototype,"_offset",[en],(function(){return new cn(0,0)})),gn(TF.prototype,"offset",[gF],Object.getOwnPropertyDescriptor(TF.prototype,"offset"),TF.prototype),wF=tn(TF.prototype,"_color",[mF],(function(){return new BF})),gn(TF.prototype,"color",[vF],Object.getOwnPropertyDescriptor(TF.prototype,"color"),TF.prototype),yF=TF))||yF)),LF=function(){function t(t){this.particleSystem=void 0,this.position=void 0,this.velocity=void 0,this.animatedVelocity=void 0,this.ultimateVelocity=void 0,this.angularVelocity=void 0,this.axisOfRotation=void 0,this.rotation=void 0,this.startEuler=void 0,this.startRotation=void 0,this.startRotated=void 0,this.deltaQuat=void 0,this.deltaMat=void 0,this.localMat=void 0,this.startSize=void 0,this.size=void 0,this.startColor=void 0,this.color=void 0,this.randomSeed=void 0,this.remainingLifetime=void 0,this.loopCount=void 0,this.lastLoop=void 0,this.trailDelay=void 0,this.startLifetime=void 0,this.emitAccumulator0=void 0,this.emitAccumulator1=void 0,this.frameIndex=void 0,this.startRow=void 0,this.particleSystem=t,this.position=new ji(0,0,0),this.velocity=new ji(0,0,0),this.animatedVelocity=new ji(0,0,0),this.ultimateVelocity=new ji(0,0,0),this.angularVelocity=new ji(0,0,0),this.axisOfRotation=new ji(0,0,0),this.rotation=new ji(0,0,0),this.startEuler=new ji(0,0,0),this.startRotation=new Ji,this.startRotated=!1,this.deltaQuat=new Ji,this.deltaMat=new Ue,this.localMat=new Ue,this.startSize=new ji(0,0,0),this.size=new ji(0,0,0),this.startColor=Ve.WHITE.clone(),this.color=Ve.WHITE.clone(),this.randomSeed=0,this.remainingLifetime=0,this.loopCount=0,this.lastLoop=0,this.trailDelay=0,this.startLifetime=0,this.emitAccumulator0=0,this.emitAccumulator1=0,this.frameIndex=0,this.startRow=0}return t.prototype.reset=function(){this.rotation.set(0,0,0),this.startEuler.set(0,0,0),this.startRotation.set(0,0,0,1),this.startRotated=!1,this.deltaQuat.set(0,0,0,1),this.deltaMat.identity(),this.localMat.identity()},t}();LF.INDENTIFY_NEG_QUAT=10,LF.R2D=180/Math.PI;var NF,kF,UF,GF,VF,HF,zF="colorModule",XF="rotationModule",WF="sizeModule",YF="textureModule",jF="noiseModule",KF=["sizeModule","colorModule","forceModule","velocityModule","limitModule","rotationModule","textureModule","noiseModule"],qF=["_colorOverLifetimeModule","_shapeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule","_noiseModule","_trailModule"],ZF=function(){function t(){this.target=null,this.needUpdate=!1,this.needAnimate=!0,this.name=void 0}var e=t.prototype;return e.bindTarget=function(t){this.target=t},e.update=function(){},t}(),QF=fr({World:0,Local:1,Custom:2}),JF=fr({Pause:0,PauseAndCatchup:1,AlwaysSimulate:2}),$F=fr({World:0,Local:1,View:2}),tL=fr({Billboard:0,StrecthedBillboard:1,HorizontalBillboard:2,VerticalBillboard:3,Mesh:4}),eL=fr({Box:0,Circle:1,Cone:2,Sphere:3,Hemisphere:4}),iL=fr({Base:0,Edge:1,Shell:2,Volume:3}),nL=fr({Random:0,Loop:1,PingPong:2}),rL=fr({Particles:0}),sL=fr({Stretch:0}),aL=new ji(0,0,-1);function oL(t,e,i,n){return e!==t?(t===QF.World||Ue.invert(i,i),Ue.getRotation(n,i),!0):(Ji.set(n,0,0,0,1),!1)}function hL(t,e){cn.set(t,Math.cos(e),Math.sin(e))}function lL(t){var e=pa(-1,1),i=pa(0,2*Math.PI),n=Math.sqrt(1-e*e),r=n*Math.cos(i),s=n*Math.sin(i);ji.set(t,r,s,e)}function uL(t,e,i){lL(t),ji.multiplyScalar(t,t,e+(i-e)*fa())}function cL(t,e,i,n){hL(t,n),t.z=0,ji.multiplyScalar(t,t,e+(i-e)*fa())}function dL(t){for(var e=0;ee){var s=r-r*i;r=s>e?s:e}return r*n}var lN,uN,cN,dN,_N,fN,pN,gN,mN,vN,yN,TN,SN,EN,AN,CN,RN,bN,xN,wN,MN,IN,BN,PN,DN,ON,FN,LN,NN,kN,UN,GN,VN,HN,zN,XN,WN,YN,jN,KN,qN,ZN,QN,JN,$N,tk,ek,ik,nk,rk,sk,ak,ok,hk,lk,uk,ck,dk,_k,fk,pk,gk,mk,vk,yk,Tk,Sk,Ek,Ak,Ck,Rk,bk,xk,wk,Mk,Ik,Bk,Pk,Dk,Ok,Fk,Lk,Nk,kk,Uk,Gk,Vk=125292,Hk=(zL=Ki("cc.RotationOvertimeModule"),XL=Tn(FO),WL=Tn(FO),YL=Tn(FO),zL((KL=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0){var i=_a(t._time-t.startDelay.evaluate(0,1),t.duration)-e;i=i>0?i:0;var n=_a(t.time-t.startDelay.evaluate(0,1),t.duration);this._curTime>=i&&this._curTime0&&(n.z*=-1),ji.normalize(r,n);break;case iL.Shell:lL(n),ji.multiplyScalar(n,n,e),n.z>0&&(n.z*=-1),ji.normalize(r,n);break;default:console.warn(t+" is not supported for hemisphere emitter.")}}(this.emitFrom,this.radius,this.radiusThickness,t.position,t.velocity);break;default:console.warn(this.shapeType+" shapeType is not supported by ShapeModule.")}var e,i,n,r,s;if(this.randomPositionAmount>0&&(t.position.x+=pa(-this.randomPositionAmount,this.randomPositionAmount),t.position.y+=pa(-this.randomPositionAmount,this.randomPositionAmount),t.position.z+=pa(-this.randomPositionAmount,this.randomPositionAmount)),ji.transformQuat(t.velocity,t.velocity,this.quat),ji.transformMat4(t.position,t.position,this.mat),this.sphericalDirectionAmount>0){var a=ji.normalize(Jk,t.position);ji.lerp(t.velocity,t.velocity,a,this.sphericalDirectionAmount)}this.lastTime=this.particleSystem._time},e.constructMat=function(){Ji.fromEuler(this.quat,this._rotation.x,this._rotation.y,this._rotation.z),Ue.fromRTS(this.mat,this.quat,this._position,this._scale)},e.generateArcAngle=function(){if(this.arcMode===nL.Random)return pa(0,this._arc);var t=this.totalAngle+2*Math.PI*this.arcSpeed.evaluate(this.particleSystem._time,1)*(this.particleSystem._time-this.lastTime);switch(this.totalAngle=t,0!==this.arcSpread&&(t=Math.floor(t/(this._arc*this.arcSpread))*this._arc*this.arcSpread),this.arcMode){case nL.Loop:return _a(t,this._arc);case nL.PingPong:return ya(t,this._arc);default:return _a(t,this._arc)}},Pi(t,[{key:"position",get:function(){return this._position},set:function(t){this._position=t,this.constructMat()}},{key:"rotation",get:function(){return this._rotation},set:function(t){this._rotation=t,this.constructMat()}},{key:"scale",get:function(){return this._scale},set:function(t){this._scale=t,this.constructMat()}},{key:"arc",get:function(){return la(this._arc)},set:function(t){this._arc=mr(t)}},{key:"angle",get:function(){return Math.round(100*la(this._angle))/100},set:function(t){this._angle=mr(t)}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"shapeType",get:function(){return this._shapeType},set:function(t){switch(this._shapeType=t,this._shapeType){case eL.Box:this.emitFrom===iL.Base&&(this.emitFrom=iL.Volume);break;case eL.Cone:this.emitFrom===iL.Edge&&(this.emitFrom=iL.Base);break;case eL.Sphere:case eL.Hemisphere:this.emitFrom!==iL.Base&&this.emitFrom!==iL.Edge||(this.emitFrom=iL.Volume)}}}]),t}(),Ek=tn(Sk.prototype,"_enable",[en],(function(){return!1})),Ak=tn(Sk.prototype,"_shapeType",[fk,pk],(function(){return eL.Cone})),gn(Sk.prototype,"shapeType",[gk],Object.getOwnPropertyDescriptor(Sk.prototype,"shapeType"),Sk.prototype),Ck=tn(Sk.prototype,"emitFrom",[mk,en],(function(){return iL.Volume})),Rk=tn(Sk.prototype,"alignToDirection",[en],(function(){return!1})),bk=tn(Sk.prototype,"randomDirectionAmount",[en],(function(){return 0})),xk=tn(Sk.prototype,"sphericalDirectionAmount",[en],(function(){return 0})),wk=tn(Sk.prototype,"randomPositionAmount",[en],(function(){return 0})),Mk=tn(Sk.prototype,"radius",[en],(function(){return 1})),Ik=tn(Sk.prototype,"radiusThickness",[en],(function(){return 1})),Bk=tn(Sk.prototype,"arcMode",[vk,en],(function(){return nL.Random})),Pk=tn(Sk.prototype,"arcSpread",[en],(function(){return 0})),Dk=tn(Sk.prototype,"arcSpeed",[yk,en],(function(){return new FO})),Ok=tn(Sk.prototype,"length",[en],(function(){return 5})),Fk=tn(Sk.prototype,"boxThickness",[en],(function(){return new ji(0,0,0)})),Lk=tn(Sk.prototype,"_position",[en],(function(){return new ji(0,0,0)})),Nk=tn(Sk.prototype,"_rotation",[en],(function(){return new ji(0,0,0)})),kk=tn(Sk.prototype,"_scale",[en],(function(){return new ji(1,1,1)})),Uk=tn(Sk.prototype,"_arc",[en],(function(){return mr(360)})),Gk=tn(Sk.prototype,"_angle",[en],(function(){return mr(25)})),Tk=Sk))||Tk);function iU(t,e){e.x>0&&(t[0]+=.5*pa(-e.x,e.x),t[0]=Ge(t[0],-.5,.5)),e.y>0&&(t[1]+=.5*pa(-e.y,e.y),t[1]=Ge(t[1],-.5,.5)),e.z>0&&(t[2]+=.5*pa(-e.z,e.z),t[2]=Ge(t[2],-.5,.5))}var nU,rU,sU,aU,oU,hU,lU,uU,cU,dU,_U,fU,pU,gU,mU,vU,yU,TU,SU,EU,AU,CU,RU=[0,0,1,0,0,1,1,1],bU=[0,0,0,1,0,0,0,1,0,1,1,0],xU=function(t){function e(){var e;return(e=t.call(this)||this)._capacity=void 0,e._vertAttrs=void 0,e._vertAttribSize=void 0,e._vBuffer=void 0,e._vertAttrsFloatCount=void 0,e._vdataF32=void 0,e._vdataUint32=void 0,e._iaInfo=void 0,e._iaInfoBuffer=void 0,e._subMeshData=void 0,e._mesh=void 0,e._vertCount=0,e._indexCount=0,e._startTimeOffset=0,e._lifeTimeOffset=0,e._material=null,e._vertAttribSizeStatic=void 0,e._vertStaticAttrsFloatCount=void 0,e._insBuffers=void 0,e._insIndices=void 0,e._useInstance=void 0,e.type=ii.PARTICLE_BATCH,e._capacity=0,e._vertAttrs=null,e._vertAttribSize=0,e._vBuffer=null,e._vertAttrsFloatCount=0,e._vdataF32=null,e._vdataUint32=null,e._vertAttribSizeStatic=0,e._vertStaticAttrsFloatCount=0,e._insBuffers=[],e._insIndices=null,ke.gfxDevice.hasFeature(d.INSTANCED_ARRAYS)?e._useInstance=!0:e._useInstance=!1,e._iaInfo=new vt([new gt]),e._iaInfoBuffer=e._device.createBuffer(new ft(g.INDIRECT,y.HOST|y.DEVICE,oe,oe)),e._subMeshData=null,e._mesh=null,e}He(e,t);var i=e.prototype;return i.setCapacity=function(t){var e=this._capacity!==t;this._capacity=t,this._subMeshData&&e&&this.rebuild()},i.setVertexAttributes=function(t,e){if(this._useInstance)this.setVertexAttributesIns(t,e);else{if(this._mesh===t&&this._vertAttrs===e)return;this._mesh=t,this._vertAttrs=e,this._vertAttribSize=0;for(var i,n=Fi(this._vertAttrs);!(i=n()).done;){var r=i.value;r.offset=this._vertAttribSize,this._vertAttribSize+=ne[r.format].size}this._vertAttrsFloatCount=this._vertAttribSize/4,this.rebuild()}},i.setVertexAttributesIns=function(t,e){if(this._mesh!==t||this._vertAttrs!==e){this._mesh=t,this._vertAttrs=e,this._vertAttribSize=0,this._vertAttribSizeStatic=0;for(var i,n=Fi(this._vertAttrs);!(i=n()).done;){var r=i.value;0===r.stream?(r.offset=this._vertAttribSize,this._vertAttribSize+=ne[r.format].size):1===r.stream&&(r.offset=this._vertAttribSizeStatic,this._vertAttribSizeStatic+=ne[r.format].size)}this._vertAttrsFloatCount=this._vertAttribSize/4,this._vertStaticAttrsFloatCount=this._vertAttribSizeStatic/4,this.rebuild()}},i.createSubMeshData=function(){this.destroySubMeshData(),this._vertCount=4,this._indexCount=6,this._mesh&&(this._vertCount=this._mesh.struct.vertexBundles[this._mesh.struct.primitives[0].vertexBundelIndices[0]].view.count,this._indexCount=this._mesh.struct.primitives[0].indexView.count);var t=this._device.createBuffer(new ft(g.VERTEX|g.TRANSFER_DST,y.HOST|y.DEVICE,this._vertAttribSize*this._capacity*this._vertCount,this._vertAttribSize)),e=new ArrayBuffer(this._vertAttribSize*this._capacity*this._vertCount);if(this._mesh&&this._capacity>0){var i=this._vertAttrs[this._vertAttrs.findIndex((function(t){return t.name===ie.ATTR_TEX_COORD}))].offset;this._mesh.copyAttribute(0,ie.ATTR_TEX_COORD,e,this._vertAttribSize,i);var n=this._vertAttrs.findIndex((function(t){return t.name===ie.ATTR_TEX_COORD3}));if(i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,ie.ATTR_POSITION,e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,ie.ATTR_NORMAL,e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,!this._mesh.copyAttribute(0,ie.ATTR_COLOR,e,this._vertAttribSize,i))for(var r=new Uint32Array(e),s=0;s0){this._mesh.copyIndices(0,h);for(var l=1;l=this._particleSystem.capacity?null:this._particles.add()},n.getDefaultTrailMaterial=function(){return this._defaultTrailMat},n.setNewParticle=function(){},n._initModuleList=function(){var t=this;OU.forEach((function(e){var i=t._particleSystem[e];i&&i.enable&&(i.needUpdate&&(t._updateList[i.name]=i),i.needAnimate&&(t._animateList[i.name]=i))})),this._runAnimateList.length=0;for(var e=0,i=KF.length;e0,this._particles.length},n.getNoisePreview=function(t,e,i){var n=this;this._runAnimateList.forEach((function(r){r.name===jF&&r.getNoisePreview(t,n._particleSystem,e,i)}))},n.updateRenderData=function(){for(var t=0,e=0;e=this._particleSystem._capacity?null:this._tempParticle},i.setNewParticle=function(t){this._model.addGPUParticleVertexData(t,this._particleNum,this._particleSystem._time),this._particleNum++},i.getDefaultMaterial=function(){return this._defaultMat},i.updateRotation=function(t){t&&this.doUpdateRotation(t)},i.doUpdateRotation=function(t){if(this._renderInfo.renderMode===tL.Mesh||this._alignSpace!==$F.View){if(this._alignSpace===$F.Local)this._particleSystem.node.getRotation(jU);else if(this._alignSpace===$F.World)this._particleSystem.node.getWorldRotation(jU);else if(this._alignSpace===$F.View){var e;jU.set(0,0,0,1);var i=null===(e=this._particleSystem.node.scene.renderScene)||void 0===e?void 0:e.cameras;if(void 0!==i)for(var n=0;n<(null==i?void 0:i.length);++n){var r=i[n];if((r.visibility&this._particleSystem.node.layer)===this._particleSystem.node.layer){Ji.fromViewUp(jU,r.forward);break}}}else jU.set(0,0,0,1);t.setUniform(this._uNodeRotHandle,jU)}},i.updateScale=function(t){t&&this.doUpdateScale(t)},i.doUpdateScale=function(t){switch(this._particleSystem.scaleSpace){case QF.Local:this._particleSystem.node.getScale(this._node_scale);break;case QF.World:this._particleSystem.node.getWorldScale(this._node_scale)}t.setUniform(t.getHandle("scale"),this._node_scale)},i.updateParticles=function(t){return this._particleNum=this._model.updateGPUParticles(this._particleNum,this._particleSystem._time,t),this.updateShaderUniform(t),this._model.enabled=this._particleNum>0,this._particleNum},i.updateRenderData=function(){},i.beforeRender=function(){this._model.updateIA(this._particleNum)},i.updateAlignSpace=function(t){this._alignSpace=t},i.updateShaderUniform=function(t){var e=this._particleSystem.getMaterialInstance(0)||this._defaultMat;if(e){var i=e.passes[0];WU.x=this._particleSystem._time,WU.y=t,i.setUniform(this._uTimeHandle,WU),this._particleSystem.node.getWorldRotation(YU),i.setUniform(this._uRotHandle,YU),this.doUpdateRotation(i)}},i.initShaderUniform=function(t){var e=t.passes[0];this._uTimeHandle=e.getHandle("u_timeDelta"),this._uRotHandle=e.getHandle("u_worldRot"),this._uNodeRotHandle=e.getHandle("nodeRotation"),this.doUpdateScale(e),e.setUniform(e.getHandle("frameTile_velLenScale"),this._unifrom_velLenScale),WU.x=KU,WU.y=.03125,e.setUniform(e.getHandle("u_sampleInfo"),WU);var i=!1,n=this._particleSystem._forceOvertimeModule;if(i=!!n&&n.enable,this._defines.FORCE_OVER_TIME_MODULE_ENABLE=i,i){var r=UO(this._forceTexture,this._forceData,KU,n.x,n.y,n.z);this._forceTexture=r.texture,this._forceData=r.texdata;var s=e.getHandle("force_over_time_tex0"),a=Wn.getBindingFromHandle(s);e.bindSampler(a,this._forceTexture.getGFXSampler()),e.bindTexture(a,this._forceTexture.getGFXTexture());var o=e.getHandle("u_force_space");e.setUniform(o,n.space);var h=e.getHandle("u_force_mode");e.setUniform(h,this._forceTexture.height)}var l=this._particleSystem._velocityOvertimeModule;if(i=!!l&&l.enable,this._defines.VELOCITY_OVER_TIME_MODULE_ENABLE=i,i){var c=function(t,e,i,n,r,s,a){var o=Math.max(NO(n),NO(r),NO(s),NO(a)),h=i*o*4;null!==e&&e.length===h||(e=new Float32Array(i*o*4));for(var l=[n,r,s,a],u=1/(i-1),c=0;c=8&&t.getFormatFeatures(_.RGBA32F)&(A.RENDER_TARGET|A.SAMPLED_TEXTURE))||(We.warn("Maybe the device has restrictions on vertex textures or does not support float textures."),!1)}var uG,cG,dG,_G,fG,pG,gG,mG,vG,yG,TG,SG,EG,AG,CG,RG,bG,xG,wG,MG,IG,BG,PG,DG,OG,FG,LG,NG,kG,UG,GG,VG,HG,zG,XG,WG,YG,jG,KG,qG,ZG,QG,JG,$G,tV,eV,iV,nV,rV,sV,aV,oV,hV,lV,uV,cV,dV,_V,fV,pV,gV,mV,vV,yV,TV,SV,EV,AV,CV,RV,bV,xV,wV,MV,IV,BV,PV,DV,OV,FV,LV,NV,kV,UV,GV,VV,HV,zV,XV,WV,YV,jV,KV,qV,ZV,QV,JV,$V,tH,eH,iH,nH,rH,sH,aH,oH,hH,lH,uH,cH,dH,_H,fH,pH,gH,mH,vH,yH,TH,SH,EH,AH,CH,RH,bH,xH,wH,MH,IH,BH,PH,DH,OH,FH,LH,NH,kH,UH,GH,VH,HH,zH,XH,WH,YH,jH,KH,qH,ZH,QH,JH,$H,tz,ez,iz=(nU=Ki("cc.ParticleSystemRenderer"),rU=Tn(tL),sU=Tn(tL),aU=Tn(mo),oU=Tn(Dn),hU=Tn(Dn),lU=Tn(Dn),uU=Tn(Dn),cU=Tn($F),nU((CU=AU=function(){function t(){this._renderMode=fU&&fU(),this._velocityScale=pU&&pU(),this._lengthScale=gU&&gU(),this._mesh=mU&&mU(),this._cpuMaterial=vU&&vU(),this._gpuMaterial=yU&&yU(),this._mainTexture=TU&&TU(),this._useGPU=SU&&SU(),this._alignSpace=EU&&EU(),this._particleSystem=null}var e=t.prototype;return e.create=function(t){null===this._particleSystem?this._particleSystem=t:this._particleSystem!==t&&hn(6033)},e.onInit=function(t){this.create(t);var e=this._useGPU&&lG();this._particleSystem.processor?hn(6034):(this._particleSystem.processor=e?new hG(this):new zU(this),this._particleSystem.processor.updateAlignSpace(this.alignSpace),this._particleSystem.processor.onInit(t)),e?this.gpuMaterial=this.particleMaterial:(this.particleMaterial&&-1!==this.particleMaterial.effectName.indexOf("particle-gpu")&&(this.particleMaterial=null,Zi(6035)),this.cpuMaterial=this.particleMaterial)},e._switchProcessor=function(){if(this._particleSystem){this._particleSystem.processor&&(this._particleSystem.processor.detachFromScene(),this._particleSystem.processor.clear(),this._particleSystem.processor=null);var t=this._useGPU&&lG();!t&&this.cpuMaterial&&(this.particleMaterial=this.cpuMaterial),t&&this.gpuMaterial&&(this.particleMaterial=this.gpuMaterial),this._particleSystem.processor=t?new hG(this):new zU(this),this._particleSystem.processor.updateAlignSpace(this.alignSpace),this._particleSystem.processor.onInit(this._particleSystem),this._particleSystem.processor.onEnable(),this._particleSystem.bindModule()}},Pi(t,[{key:"renderMode",get:function(){return this._renderMode},set:function(t){this._renderMode!==t&&(this._renderMode=t,this._particleSystem&&this._particleSystem.processor.updateRenderMode())}},{key:"velocityScale",get:function(){return this._velocityScale},set:function(t){this._velocityScale=t,this._particleSystem&&this._particleSystem.processor.updateMaterialParams()}},{key:"lengthScale",get:function(){return this._lengthScale},set:function(t){this._lengthScale=t,this._particleSystem&&this._particleSystem.processor.updateMaterialParams()}},{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh=t,this._particleSystem&&this._particleSystem.processor.setVertexAttributes()}},{key:"particleMaterial",get:function(){return this._particleSystem?this._particleSystem.getMaterial(0):null},set:function(t){this._particleSystem&&this._particleSystem.setMaterial(t,0)}},{key:"cpuMaterial",get:function(){return this._cpuMaterial},set:function(t){if(null!==t){var e=t.effectName;-1!==e.indexOf("particle")&&-1===e.indexOf("particle-gpu")?(this._cpuMaterial=t,this.particleMaterial=this._cpuMaterial):Zi(6035)}}},{key:"gpuMaterial",get:function(){return this._gpuMaterial},set:function(t){null!==t&&(-1!==t.effectName.indexOf("particle-gpu")?(this._gpuMaterial=t,this.particleMaterial=this._gpuMaterial):Zi(6035))}},{key:"trailMaterial",get:function(){return this._particleSystem?this._particleSystem.getMaterial(1):null},set:function(t){this._particleSystem&&this._particleSystem.setMaterial(t,1)}},{key:"mainTexture",get:function(){return this._mainTexture},set:function(t){this._mainTexture=t}},{key:"useGPU",get:function(){return this._useGPU},set:function(t){this._useGPU!==t&&(lG()?this._useGPU=t:this._useGPU=!1,this._switchProcessor())}},{key:"alignSpace",get:function(){return this._alignSpace},set:function(t){this._alignSpace=t,this._particleSystem.processor.updateAlignSpace(this._alignSpace)}}]),t}(),AU.AlignmentSpace=$F,gn((_U=CU).prototype,"renderMode",[rU],Object.getOwnPropertyDescriptor(_U.prototype,"renderMode"),_U.prototype),fU=tn(_U.prototype,"_renderMode",[sU,en],(function(){return tL.Billboard})),pU=tn(_U.prototype,"_velocityScale",[en],(function(){return 1})),gU=tn(_U.prototype,"_lengthScale",[en],(function(){return 1})),mU=tn(_U.prototype,"_mesh",[en],(function(){return null})),gn(_U.prototype,"mesh",[aU],Object.getOwnPropertyDescriptor(_U.prototype,"mesh"),_U.prototype),gn(_U.prototype,"particleMaterial",[oU],Object.getOwnPropertyDescriptor(_U.prototype,"particleMaterial"),_U.prototype),gn(_U.prototype,"cpuMaterial",[hU],Object.getOwnPropertyDescriptor(_U.prototype,"cpuMaterial"),_U.prototype),vU=tn(_U.prototype,"_cpuMaterial",[en],(function(){return null})),gn(_U.prototype,"gpuMaterial",[lU],Object.getOwnPropertyDescriptor(_U.prototype,"gpuMaterial"),_U.prototype),yU=tn(_U.prototype,"_gpuMaterial",[en],(function(){return null})),gn(_U.prototype,"trailMaterial",[uU],Object.getOwnPropertyDescriptor(_U.prototype,"trailMaterial"),_U.prototype),TU=tn(_U.prototype,"_mainTexture",[en],(function(){return null})),SU=tn(_U.prototype,"_useGPU",[en],(function(){return!1})),gn(_U.prototype,"alignSpace",[cU],Object.getOwnPropertyDescriptor(_U.prototype,"alignSpace"),_U.prototype),EU=tn(_U.prototype,"_alignSpace",[en],(function(){return $F.View})),dU=_U))||dU),nz=Math.cos(mr(100)),rz={position:new ji,velocity:new ji},sz=new Ji,az=new Ue,oz=new ji,hz=new ji,lz=new Ve,uz=function(){function t(t){for(this.start=void 0,this.end=void 0,this.trailElements=void 0,this.start=-1,this.end=-1,this.trailElements=[];t--;)this.trailElements.push({position:new ji,lifetime:0,width:0,velocity:new ji,direction:0,color:new Ve})}var e=t.prototype;return e.getElement=function(t){return-1===this.start?null:(t<0&&(t=(t+this.trailElements.length)%this.trailElements.length),t>=this.trailElements.length&&(t%=this.trailElements.length),this.trailElements[t])},e.addElement=function(){if(0===this.trailElements.length)return null;if(-1===this.start)return this.start=0,this.end=1,this.trailElements[0];this.start===this.end&&(this.trailElements.splice(this.end,0,{position:new ji,lifetime:0,width:0,velocity:new ji,direction:0,color:new Ve}),this.start++,this.start%=this.trailElements.length);var t=this.end++;return this.end%=this.trailElements.length,this.trailElements[t]},e.iterateElement=function(t,e,i,n){for(var r=this.start>=this.end?this.end+this.trailElements.length:this.end,s=this.start;st.lastLoop)t.trailDelay>1?(t.lastLoop=t.loopCount,t.trailDelay=0):t.trailDelay++;else{var i=this._particleTrail.get(t);if(!i)return i=this._trailSegments.alloc(),void this._particleTrail.set(t,i);var n=i.getElement(i.end-1);if(this._needTransform?ji.transformMat4(oz,t.position,az):ji.copy(oz,t.position),!(n&&(i.iterateElement(this,this._updateTrailElement,t,e),ji.squaredDistance(n.position,oz)2){var a=i.getElement(i.end-2),o=i.getElement(i.end-3);ji.subtract(oz,o.position,a.position),ji.subtract(hz,n.position,a.position),ji.subtract(a.velocity,hz,oz),ji.equals(ji.ZERO,a.velocity)&&ji.copy(a.velocity,oz),ji.normalize(a.velocity,a.velocity),this._checkDirectionReverse(a,o)}this.colorFromParticle?n.color.set(t.color):n.color.set(this.colorOvertime.evaluate(0,1))}}},t.removeParticle=function(t){var e=this._particleTrail.get(t);e&&this._trailSegments&&(e.clear(),this._trailSegments.free(e),this._particleTrail.delete(t))},t.updateRenderData=function(){this.vbOffset=0,this.ibOffset=0;for(var t,e=Fi(this._particleTrail.keys());!(t=e()).done;){var i=t.value,n=this._particleTrail.get(i);if(-1!==n.start){var r=4*this.vbOffset/this._vertSize,s=n.start>=n.end?n.end+n.trailElements.length:n.end,a=s-n.start,o=1/a,h=n.trailElements[n.start];this._fillVertexBuffer(h,this.colorOverTrail.evaluate(1,1),r,1,0,4);for(var l=n.start+1;l2){var f=n.getElement(n.end-1),p=n.getElement(n.end-2);ji.subtract(oz,p.position,f.position),ji.subtract(hz,rz.position,f.position),ji.normalize(oz,oz),ji.normalize(hz,hz),ji.subtract(f.velocity,hz,oz),ji.normalize(f.velocity,f.velocity),this._checkDirectionReverse(f,p),this.vbOffset-=this._vertSize/4*2,this.ibOffset-=6,this._fillVertexBuffer(f,this.colorOverTrail.evaluate(o,1),r,o,a-1,5),ji.subtract(rz.velocity,rz.position,f.position),ji.normalize(rz.velocity,rz.velocity),this._checkDirectionReverse(rz,f)}this.widthFromParticle?rz.width=i.size.x*this.widthRatio.evaluate(0,1):rz.width=this.widthRatio.evaluate(0,1),rz.color=i.color,ji.equals(rz.velocity,ji.ZERO)?this.ibOffset-=3:this._fillVertexBuffer(rz,this.colorOverTrail.evaluate(0,1),r,0,a,1)}}this._trailModel&&(this._trailModel.enabled=this.ibOffset>0)},t.updateIA=function(t){var e=this._trailModel&&this._trailModel.subModels;if(e&&e.length>0){var i=e[0];i.inputAssembler.vertexBuffers[0].update(this._vbF32),i.inputAssembler.indexBuffer.update(this._iBuffer),this._iaInfo.drawInfos[0].firstIndex=0,this._iaInfo.drawInfos[0].indexCount=t,this._iaInfoBuffer.update(this._iaInfo)}},t.beforeRender=function(){this.updateIA(this.ibOffset)},t._createModel=function(){this._trailModel||(this._trailModel=We.director.root.createModel(ni))},t.rebuild=function(){var t=Di.root.device,e=t.createBuffer(new ft(g.VERTEX|g.TRANSFER_DST,y.HOST|y.DEVICE,this._vertSize*(this._trailNum+1)*2,this._vertSize)),i=new ArrayBuffer(this._vertSize*(this._trailNum+1)*2);this._vbF32=new Float32Array(i),this._vbUint32=new Uint32Array(i),e.update(i);var n=t.createBuffer(new ft(g.INDEX|g.TRANSFER_DST,y.HOST|y.DEVICE,6*Math.max(1,this._trailNum)*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT));this._iBuffer=new Uint16Array(6*Math.max(1,this._trailNum)),n.update(this._iBuffer),this._iaInfoBuffer=t.createBuffer(new ft(g.INDIRECT,y.HOST|y.DEVICE,oe,oe)),this._iaInfo.drawInfos[0].vertexCount=2*(this._trailNum+1),this._iaInfo.drawInfos[0].indexCount=6*this._trailNum,this._iaInfoBuffer.update(this._iaInfo),this._subMeshData=new qi([e],this._vertAttrs,U.TRIANGLE_LIST,n,this._iaInfoBuffer);var r=this._trailModel;r&&this._material&&(r.node=r.transform=this._particleSystem.node,r.visFlags=this._particleSystem.visibility,r.initSubModel(0,this._subMeshData,this._material),r.enabled=!0)},t._updateTrailElement=function(t,e,i,n){return e.lifetime+=n,t.colorFromParticle?(e.color.set(i.color),e.color.multiply(t.colorOvertime.evaluate(1-i.remainingLifetime/i.startLifetime,1))):e.color.set(t.colorOvertime.evaluate(1-i.remainingLifetime/i.startLifetime,1)),t.widthFromParticle?e.width=i.size.x*t.widthRatio.evaluate(e.lifetime/t._trailLifetime,1):e.width=t.widthRatio.evaluate(e.lifetime/t._trailLifetime,1),e.lifetime>t._trailLifetime},t._fillVertexBuffer=function(t,e,i,n,r,s){this._vbF32[this.vbOffset++]=t.position.x,this._vbF32[this.vbOffset++]=t.position.y,this._vbF32[this.vbOffset++]=t.position.z,this._vbF32[this.vbOffset++]=t.direction,this._vbF32[this.vbOffset++]=t.width,this._vbF32[this.vbOffset++]=n,this._vbF32[this.vbOffset++]=0,this._vbF32[this.vbOffset++]=t.velocity.x,this._vbF32[this.vbOffset++]=t.velocity.y,this._vbF32[this.vbOffset++]=t.velocity.z,lz.set(t.color),lz.multiply(e),this._vbUint32[this.vbOffset++]=lz._val,this._vbF32[this.vbOffset++]=t.position.x,this._vbF32[this.vbOffset++]=t.position.y,this._vbF32[this.vbOffset++]=t.position.z,this._vbF32[this.vbOffset++]=1-t.direction,this._vbF32[this.vbOffset++]=t.width,this._vbF32[this.vbOffset++]=n,this._vbF32[this.vbOffset++]=1,this._vbF32[this.vbOffset++]=t.velocity.x,this._vbF32[this.vbOffset++]=t.velocity.y,this._vbF32[this.vbOffset++]=t.velocity.z,this._vbUint32[this.vbOffset++]=lz._val,1&s&&(this._iBuffer[this.ibOffset++]=i+2*r,this._iBuffer[this.ibOffset++]=i+2*r-1,this._iBuffer[this.ibOffset++]=i+2*r+1),4&s&&(this._iBuffer[this.ibOffset++]=i+2*r,this._iBuffer[this.ibOffset++]=i+2*r+1,this._iBuffer[this.ibOffset++]=i+2*r+2)},t._checkDirectionReverse=function(t,e){ji.dot(t.velocity,e.velocity)0&&!this._isCulled)&&(null!==(e=this.processor.getModel())&&void 0!==e&&e.scene||this.processor.attachToScene(),this._trailModule&&this._trailModule.enable&&(null!==(i=this._trailModule.getModel())&&void 0!==i&&i.scene||this._trailModule._attachToScene()),this._needAttach=!1);!this.renderer.useGPU&&this._trailModule&&this._trailModule.enable&&(this._trailModule._inited||(this._trailModule.clear(),this._trailModule.destroy(),this._trailModule.onInit(this),this._trailModule.enable=!1,this._trailModule.enable=!0))},i.beforeRender=function(){var t,e;this.getParticleCount()<=0?null!==(e=this.processor.getModel())&&void 0!==e&&e.scene&&(this.processor.detachFromScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene(),this._needAttach=!1):null!==(t=this.processor.getModel())&&void 0!==t&&t.scene||(this._needAttach=!0),this._isPlaying&&(this.processor.beforeRender(),this._trailModule&&this._trailModule.enable&&this._trailModule.beforeRender())},i._onVisibilityChange=function(t){this.processor._model&&(this.processor._model.visFlags=t)},i.emit=function(t,e){var i=this._time%this.duration/this.duration;this._needRefresh&&(this.node.invalidateChildren(pr.POSITION),this._needRefresh=!1),this._simulationSpace===QF.World&&(this.node.getWorldMatrix(Sz),this.node.getWorldRotation(Ez));for(var n=0;ne){if(this._time>this.duration+e&&(this.loop||(this._isEmitting=!1)),!this._isEmitting)return;if(this._emitRateTimeCounter+=this.rateOverTime.evaluate(this._time/this.duration,1)*t,this._emitRateTimeCounter>1){var i=Math.floor(this._emitRateTimeCounter);this._emitRateTimeCounter-=i,this.emit(i,t)}var n=this.rateOverDistance.evaluate(this._time/this.duration,1);if(n>0){ji.copy(this._oldWPos,this._curWPos),this.node.getWorldPosition(this._curWPos);var r=ji.distance(this._curWPos,this._oldWPos);this._emitRateDistanceCounter+=r*n}if(this._emitRateDistanceCounter>1){var s=Math.floor(this._emitRateDistanceCounter);this._emitRateDistanceCounter-=s,this.emit(s,t)}for(var a,o=Fi(this.bursts);!(a=o()).done;)a.value.update(this,t)}},i._resetPosition=function(){this.node.getWorldPosition(this._oldWPos),ji.copy(this._curWPos,this._oldWPos)},i.addSubEmitter=function(t){this._subEmitters.push(t)},i.removeSubEmitter=function(t){this._subEmitters.splice(this._subEmitters.indexOf(t),1)},i.addBurst=function(t){this.bursts.push(t)},i.removeBurst=function(t){this.bursts.splice(this.bursts.indexOf(t),1)},i.getBoundingX=function(){return this._aabbHalfX},i.getBoundingY=function(){return this._aabbHalfY},i.getBoundingZ=function(){return this._aabbHalfZ},i.setBoundingX=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.x=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfX=t)},i.setBoundingY=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.y=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfY=t)},i.setBoundingZ=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.z=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfZ=t)},i._onBeforeSerialize=function(t){var e=this;return this.dataCulling?t.filter((function(t){return!qF.includes(t)||e[t]&&e[t].enable})):t},i.getNoisePreview=function(t,e){var i=[];return this.processor&&this.processor.getNoisePreview(i,t,e),i},Pi(e,[{key:"capacity",get:function(){return this._capacity},set:function(t){this._capacity=Math.floor(t>0?t:0),this.processor&&this.processor._model&&this.processor._model.setCapacity(this._capacity)}},{key:"prewarm",get:function(){return this._prewarm},set:function(t){!0===t&&this.loop,this._prewarm=t}},{key:"simulationSpace",get:function(){return this._simulationSpace},set:function(t){t!==this._simulationSpace&&(this._simulationSpace=t,this.processor&&(this.processor.updateMaterialParams(),this.processor.updateTrailMaterial()))}},{key:"renderCulling",get:function(){return this._renderCulling},set:function(t){this._renderCulling=t,t&&(this._boundingBox||(this._boundingBox=new Qi,this._calculateBounding(!1)))}},{key:"cullingMode",get:function(){return this._cullingMode},set:function(t){this._cullingMode=t}},{key:"aabbHalfX",get:function(){return this.getBoundingX()||0},set:function(t){this.setBoundingX(t)}},{key:"aabbHalfY",get:function(){return this.getBoundingY()||0},set:function(t){this.setBoundingY(t)}},{key:"aabbHalfZ",get:function(){return this.getBoundingZ()||0},set:function(t){this.setBoundingZ(t)}},{key:"dataCulling",get:function(){return this._dataCulling},set:function(t){this._dataCulling=t}},{key:"sharedMaterials",get:function(){return Az.get.call(this)},set:function(t){Az.set.call(this,t)}},{key:"colorOverLifetimeModule",get:function(){return this._colorOverLifetimeModule},set:function(t){t&&(this._colorOverLifetimeModule=t)}},{key:"shapeModule",get:function(){return this._shapeModule},set:function(t){t&&(this._shapeModule=t)}},{key:"sizeOvertimeModule",get:function(){return this._sizeOvertimeModule},set:function(t){t&&(this._sizeOvertimeModule=t)}},{key:"velocityOvertimeModule",get:function(){return this._velocityOvertimeModule},set:function(t){t&&(this._velocityOvertimeModule=t)}},{key:"forceOvertimeModule",get:function(){return this._forceOvertimeModule},set:function(t){t&&(this._forceOvertimeModule=t)}},{key:"limitVelocityOvertimeModule",get:function(){return this._limitVelocityOvertimeModule},set:function(t){t&&(this._limitVelocityOvertimeModule=t)}},{key:"rotationOvertimeModule",get:function(){return this._rotationOvertimeModule},set:function(t){t&&(this._rotationOvertimeModule=t)}},{key:"textureAnimationModule",get:function(){return this._textureAnimationModule},set:function(t){t&&(this._textureAnimationModule=t)}},{key:"noiseModule",get:function(){return this._noiseModule},set:function(t){t&&(this._noiseModule=t)}},{key:"trailModule",get:function(){return this._trailModule},set:function(t){t&&(this._trailModule=t)}},{key:"isPlaying",get:function(){return this._isPlaying}},{key:"isPaused",get:function(){return this._isPaused}},{key:"isStopped",get:function(){return this._isStopped}},{key:"isEmitting",get:function(){return this._isEmitting}},{key:"time",get:function(){return this._time}}]),e}(Bf),jH.CullingMode=JF,aH=tn((sH=KH).prototype,"startColor",[dV,en],(function(){return new BF})),oH=tn(sH.prototype,"scaleSpace",[_V,en],(function(){return QF.Local})),hH=tn(sH.prototype,"startSize3D",[en],(function(){return!1})),lH=tn(sH.prototype,"startSizeX",[fV,pV],(function(){return new FO})),uH=tn(sH.prototype,"startSizeY",[gV,en],(function(){return new FO})),cH=tn(sH.prototype,"startSizeZ",[mV,en],(function(){return new FO})),dH=tn(sH.prototype,"startSpeed",[vV,en],(function(){return new FO})),_H=tn(sH.prototype,"startRotation3D",[en],(function(){return!1})),fH=tn(sH.prototype,"startRotationX",[yV,en],(function(){return new FO})),pH=tn(sH.prototype,"startRotationY",[TV,en],(function(){return new FO})),gH=tn(sH.prototype,"startRotationZ",[SV,EV],(function(){return new FO})),mH=tn(sH.prototype,"startDelay",[AV,en],(function(){return new FO})),vH=tn(sH.prototype,"startLifetime",[CV,en],(function(){return new FO})),yH=tn(sH.prototype,"duration",[en],(function(){return 5})),TH=tn(sH.prototype,"loop",[en],(function(){return!0})),gn(sH.prototype,"simulationSpace",[RV,en],Object.getOwnPropertyDescriptor(sH.prototype,"simulationSpace"),sH.prototype),SH=tn(sH.prototype,"simulationSpeed",[en],(function(){return 1})),EH=tn(sH.prototype,"playOnAwake",[en],(function(){return!0})),AH=tn(sH.prototype,"gravityModifier",[bV,en],(function(){return new FO})),CH=tn(sH.prototype,"rateOverTime",[xV,en],(function(){return new FO})),RH=tn(sH.prototype,"rateOverDistance",[wV,en],(function(){return new FO})),bH=tn(sH.prototype,"bursts",[MV,en],(function(){return[]})),gn(sH.prototype,"renderCulling",[IV],Object.getOwnPropertyDescriptor(sH.prototype,"renderCulling"),sH.prototype),xH=tn(sH.prototype,"_renderCulling",[en],(function(){return!1})),gn(sH.prototype,"cullingMode",[BV],Object.getOwnPropertyDescriptor(sH.prototype,"cullingMode"),sH.prototype),wH=tn(sH.prototype,"_cullingMode",[en],(function(){return JF.Pause})),gn(sH.prototype,"aabbHalfX",[PV],Object.getOwnPropertyDescriptor(sH.prototype,"aabbHalfX"),sH.prototype),MH=tn(sH.prototype,"_aabbHalfX",[en],(function(){return 0})),gn(sH.prototype,"aabbHalfY",[DV],Object.getOwnPropertyDescriptor(sH.prototype,"aabbHalfY"),sH.prototype),IH=tn(sH.prototype,"_aabbHalfY",[en],(function(){return 0})),gn(sH.prototype,"aabbHalfZ",[OV],Object.getOwnPropertyDescriptor(sH.prototype,"aabbHalfZ"),sH.prototype),BH=tn(sH.prototype,"_aabbHalfZ",[en],(function(){return 0})),PH=tn(sH.prototype,"_dataCulling",[en,FV],(function(){return!1})),gn(sH.prototype,"sharedMaterials",[mn,LV,en],Object.getOwnPropertyDescriptor(sH.prototype,"sharedMaterials"),sH.prototype),DH=tn(sH.prototype,"_colorOverLifetimeModule",[NV],(function(){return null})),gn(sH.prototype,"colorOverLifetimeModule",[kV],Object.getOwnPropertyDescriptor(sH.prototype,"colorOverLifetimeModule"),sH.prototype),OH=tn(sH.prototype,"_shapeModule",[UV],(function(){return null})),gn(sH.prototype,"shapeModule",[GV],Object.getOwnPropertyDescriptor(sH.prototype,"shapeModule"),sH.prototype),FH=tn(sH.prototype,"_sizeOvertimeModule",[VV],(function(){return null})),gn(sH.prototype,"sizeOvertimeModule",[HV],Object.getOwnPropertyDescriptor(sH.prototype,"sizeOvertimeModule"),sH.prototype),LH=tn(sH.prototype,"_velocityOvertimeModule",[zV],(function(){return null})),gn(sH.prototype,"velocityOvertimeModule",[XV],Object.getOwnPropertyDescriptor(sH.prototype,"velocityOvertimeModule"),sH.prototype),NH=tn(sH.prototype,"_forceOvertimeModule",[WV],(function(){return null})),gn(sH.prototype,"forceOvertimeModule",[YV],Object.getOwnPropertyDescriptor(sH.prototype,"forceOvertimeModule"),sH.prototype),kH=tn(sH.prototype,"_limitVelocityOvertimeModule",[jV],(function(){return null})),gn(sH.prototype,"limitVelocityOvertimeModule",[KV],Object.getOwnPropertyDescriptor(sH.prototype,"limitVelocityOvertimeModule"),sH.prototype),UH=tn(sH.prototype,"_rotationOvertimeModule",[qV],(function(){return null})),gn(sH.prototype,"rotationOvertimeModule",[ZV],Object.getOwnPropertyDescriptor(sH.prototype,"rotationOvertimeModule"),sH.prototype),GH=tn(sH.prototype,"_textureAnimationModule",[QV],(function(){return null})),gn(sH.prototype,"textureAnimationModule",[JV],Object.getOwnPropertyDescriptor(sH.prototype,"textureAnimationModule"),sH.prototype),VH=tn(sH.prototype,"_noiseModule",[$V],(function(){return null})),gn(sH.prototype,"noiseModule",[tH],Object.getOwnPropertyDescriptor(sH.prototype,"noiseModule"),sH.prototype),HH=tn(sH.prototype,"_trailModule",[eH],(function(){return null})),gn(sH.prototype,"trailModule",[iH],Object.getOwnPropertyDescriptor(sH.prototype,"trailModule"),sH.prototype),zH=tn(sH.prototype,"renderer",[nH,en],(function(){return new iz})),XH=tn(sH.prototype,"_prewarm",[en],(function(){return!1})),WH=tn(sH.prototype,"_capacity",[en],(function(){return 100})),YH=tn(sH.prototype,"_simulationSpace",[en],(function(){return QF.Local})),rH=sH))||rH)||rH)),Rz=t("ParticleUtils",function(){function t(){}return t.instantiate=function(t){return this.registeredSceneEvent||(Di.on(An.EVENT_BEFORE_SCENE_LAUNCH,this.onSceneUnload,this),this.registeredSceneEvent=!0),this.particleSystemPool.has(t._uuid)||this.particleSystemPool.set(t._uuid,new e((function(){return rI(t)||new Pr}),1,(function(t){return t.destroy()}))),this.particleSystemPool.get(t._uuid).alloc()},t.destroy=function(t){this.particleSystemPool.has(t._prefab.asset._uuid)&&(this.stop(t),this.particleSystemPool.get(t._prefab.asset._uuid).free(t))},t.play=function(t){for(var e,i=Fi(t.getComponentsInChildren(Cz));!(e=i()).done;)e.value.play()},t.stop=function(t){for(var e,i=Fi(t.getComponentsInChildren(Cz));!(e=i()).done;)e.value.stop()},t.onSceneUnload=function(){this.particleSystemPool.forEach((function(t){return t.destroy()})),this.particleSystemPool.clear()},t}());function bz(t){We._global.CC_PHYSICS_BUILTIN="builtin"===t,We._global.CC_PHYSICS_CANNON="cannon.js"===t,We._global.CC_PHYSICS_AMMO="bullet"===t}Rz.particleSystemPool=new Map,Rz.registeredSceneEvent=!1,Vn(Qk.prototype,"Burst.prototype",[{name:"minCount"},{name:"maxCount"}]),zn(Cz.prototype,"ParticleSystem.prototype",[{name:"enableCulling",newName:"dataCulling"}]),We.ParticleSystemComponent=Cz,br(Cz,"cc.ParticleSystemComponent"),We.BillboardComponent=xO,br(xO,"cc.BillboardComponent"),We.LineComponent=FF,br(FF,"cc.LineComponent"),We.ParticleUtils=Rz,function(t){t[t.DYNAMIC=1]="DYNAMIC",t[t.STATIC=2]="STATIC",t[t.KINEMATIC=4]="KINEMATIC"}(qH||(qH=t("ERigidBodyType",{}))),fr(qH),function(t){t[t.X_AXIS=0]="X_AXIS",t[t.Y_AXIS=1]="Y_AXIS",t[t.Z_AXIS=2]="Z_AXIS"}(ZH||(ZH=t("EAxisDirection",{}))),fr(ZH),function(t){t[t.VERTEX=1]="VERTEX",t[t.LINE=2]="LINE",t[t.TRIANGLE=3]="TRIANGLE",t[t.TETRAHEDRON=4]="TETRAHEDRON"}(QH||(QH={})),fr(QH),function(t){t[t.BOX=0]="BOX",t[t.SPHERE=1]="SPHERE",t[t.CAPSULE=2]="CAPSULE",t[t.CYLINDER=3]="CYLINDER",t[t.CONE=4]="CONE",t[t.MESH=5]="MESH",t[t.PLANE=6]="PLANE",t[t.SIMPLEX=7]="SIMPLEX",t[t.TERRAIN=8]="TERRAIN"}(JH||(JH={})),fr(JH),function(t){t[t.POINT_TO_POINT=0]="POINT_TO_POINT",t[t.HINGE=1]="HINGE",t[t.CONE_TWIST=2]="CONE_TWIST",t[t.FIXED=3]="FIXED"}($H||($H={})),fr($H),function(t){t[t.DEFAULT=1]="DEFAULT"}(tz||(tz={})),fr(tz);var xz,wz={id:"",switchTo:function(t){if(wz.runInEditor){var e=wz;if(wz.physicsWorld&&t!==wz.id&&null!=wz.backend[t]?(wz.physicsWorld.destroy(),console.info("[PHYSICS]: switch from "+wz.id+" to "+t+"."),bz(t),e.id=t,e.wrapper=wz.backend[t],e.physicsWorld=Pz()):(console.info("[PHYSICS]: using "+t+"."),e.physicsWorld=Pz()),ez){var i=e.physicsWorld;i.setGravity(ez.gravity),i.setAllowSleep(ez.allowSleep)}}},register:function(t,e){if(console.info("[PHYSICS]: register "+t+"."),wz.backend[t]=e,!wz.physicsWorld||wz.id===t){bz(t);var i=wz;i.id=t,i.wrapper=e}},wrapper:{},backend:{},physicsWorld:null,runInEditor:!aa},Mz=function(){return 0},Iz={impl:null,setGravity:Mz,setAllowSleep:Mz,setDefaultMaterial:Mz,step:Mz,syncAfterEvents:Mz,syncSceneToPhysics:Mz,raycast:Mz,raycastClosest:Mz,emitEvents:Mz,destroy:Mz};function Bz(t,e){return null==t&&(wz.id?Gi(wz.id+" physics does not support "+xz[e]):hn(9600),!0)}function Pz(){return Bz(wz.wrapper.PhysicsWorld,xz.World)?Iz:new wz.wrapper.PhysicsWorld}!function(t){t[t.World=0]="World",t[t.RigidBody=1]="RigidBody",t[t.BoxCollider=2]="BoxCollider",t[t.SphereCollider=3]="SphereCollider",t[t.CapsuleCollider=4]="CapsuleCollider",t[t.MeshCollider=5]="MeshCollider",t[t.CylinderCollider=6]="CylinderCollider",t[t.ConeCollider=7]="ConeCollider",t[t.TerrainCollider=8]="TerrainCollider",t[t.SimplexCollider=9]="SimplexCollider",t[t.PlaneCollider=10]="PlaneCollider",t[t.PointToPointConstraint=11]="PointToPointConstraint",t[t.HingeConstraint=12]="HingeConstraint",t[t.ConeTwistConstraint=13]="ConeTwistConstraint",t[t.FixedConstraint=14]="FixedConstraint"}(xz||(xz={}));var Dz={impl:null,rigidBody:null,isAwake:!1,isSleepy:!1,isSleeping:!1,initialize:Mz,onEnable:Mz,onDisable:Mz,onDestroy:Mz,setType:Mz,setMass:Mz,setLinearDamping:Mz,setAngularDamping:Mz,useGravity:Mz,setLinearFactor:Mz,setAngularFactor:Mz,setAllowSleep:Mz,wakeUp:Mz,sleep:Mz,clearState:Mz,clearForces:Mz,clearVelocity:Mz,setSleepThreshold:Mz,getSleepThreshold:Mz,getLinearVelocity:Mz,setLinearVelocity:Mz,getAngularVelocity:Mz,setAngularVelocity:Mz,applyForce:Mz,applyLocalForce:Mz,applyImpulse:Mz,applyLocalImpulse:Mz,applyTorque:Mz,applyLocalTorque:Mz,setGroup:Mz,getGroup:Mz,addGroup:Mz,removeGroup:Mz,setMask:Mz,getMask:Mz,addMask:Mz,removeMask:Mz,isUsingCCD:Mz,useCCD:Mz},Oz={INITED:!1},Fz={impl:null,collider:null,attachedRigidBody:null,initialize:Mz,onLoad:Mz,onEnable:Mz,onDisable:Mz,onDestroy:Mz,setGroup:Mz,getGroup:Mz,addGroup:Mz,removeGroup:Mz,setMask:Mz,getMask:Mz,addMask:Mz,removeMask:Mz,setMaterial:Mz,setAsTrigger:Mz,setCenter:Mz,getAABB:Mz,getBoundingSphere:Mz,updateSize:Mz,updateRadius:Mz,setRadius:Mz,setCylinderHeight:Mz,setDirection:Mz,setHeight:Mz,setShapeType:Mz,setVertices:Mz,setMesh:Mz,setTerrain:Mz,setNormal:Mz,setConstant:Mz,updateEventListener:Mz};var Lz={INITED:!1},Nz={impl:null,initialize:Mz,onLoad:Mz,onEnable:Mz,onDisable:Mz,onDestroy:Mz,setEnableCollision:Mz,setConnectedBody:Mz,setPivotA:Mz,setPivotB:Mz,setAxis:Mz,setBreakForce:Mz,setBreakTorque:Mz};var kz={type:"onTriggerEnter",selfCollider:null,otherCollider:null,impl:null},Uz={type:"onCollisionEnter",selfCollider:null,otherCollider:null,contacts:[],impl:null},Gz=function(){function t(){this.BT_TRANSFORM_0=Sa.Transform_new(),this.BT_TRANSFORM_1=Sa.Transform_new(),this.BT_V3_0=Sa.Vec3_new(0,0,0),this.BT_V3_1=Sa.Vec3_new(0,0,0),this.BT_V3_2=Sa.Vec3_new(0,0,0),this.BT_QUAT_0=Sa.Quat_new(0,0,0,1)}return t.setWrapper=function(t,e,i){this.ROOT[e]||(this.ROOT[e]={}),this.ROOT[e][t]=i},t.delWrapper=function(t,e){delete this.ROOT[e][t]},t.getWrapper=function(t,e){return this.ROOT[e][t]},t.isNotEmptyShape=function(t){return t!==Sa.EmptyShape_static()},Pi(t,null,[{key:"instance",get:function(){return null==t._instance&&(t._instance=new t),t._instance}}]),t}();Gz._instance=void 0,Gz.ROOT={};var Vz,Hz,zz,Xz,Wz,Yz,jz,Kz,qz=new ji,Zz=new ji,Qz=new Ji,Jz=new Ue;function $z(t,e){return Sa.Vec3_set(t,e.x,e.y,e.z),t}function tX(t,e){return t.x=Sa.Vec3_x(e),t.y=Sa.Vec3_y(e),t.z=Sa.Vec3_z(e),t}function eX(t,e){return Sa.Quat_set(t,e.x,e.y,e.z,e.w),t}function iX(t,e){return t.x=Sa.Quat_x(e),t.y=Sa.Quat_y(e),t.z=Sa.Quat_z(e),t.w=Sa.Quat_w(e),t}function nX(t,e){for(var i=e.renderingSubMeshes.length,n=0;n=0&&e.allMaterials.splice(i,1),!0}return!1},i.setValues=function(t,i,n,r){var s=this._friction!==t||this._rollingFriction!==i||this._spinningFriction!==n||this._restitution!==r;this._friction=t,this._rollingFriction=i,this._spinningFriction=n,this._restitution=r,s&&this.emit(e.EVENT_UPDATE)},Pi(e,[{key:"friction",get:function(){return this._friction},set:function(t){Ea(this._friction,t)||(this._friction=t,this.emit(e.EVENT_UPDATE))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){Ea(this._rollingFriction,t)||(this._rollingFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"spinningFriction",get:function(){return this._spinningFriction},set:function(t){Ea(this._spinningFriction,t)||(this._spinningFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"restitution",get:function(){return this._restitution},set:function(t){Ea(this._restitution,t)||(this._restitution=t,this.emit(e.EVENT_UPDATE))}}]),e}($i),jz.allMaterials=[],jz.EVENT_UPDATE="event_update",jz._idCounter=0,zz=tn((Hz=Kz).prototype,"_friction",[en],(function(){return.6})),Xz=tn(Hz.prototype,"_rollingFriction",[en],(function(){return 0})),Wz=tn(Hz.prototype,"_spinningFriction",[en],(function(){return 0})),Yz=tn(Hz.prototype,"_restitution",[en],(function(){return 0})),Vz=Hz))||Vz),sX=t("PhysicsRayResult",function(){function t(){this._hitPoint=new ji,this._hitNormal=new ji,this._distance=0,this._collider=null}var e=t.prototype;return e._assign=function(t,e,i,n){ji.copy(this._hitPoint,t),ji.copy(this._hitNormal,n),this._distance=e,this._collider=i},e.clone=function(){var e=new t;return ji.copy(e._hitPoint,this._hitPoint),ji.copy(e._hitNormal,this._hitNormal),e._distance=this._distance,e._collider=this._collider,e},Pi(t,[{key:"hitPoint",get:function(){return this._hitPoint}},{key:"distance",get:function(){return this._distance}},{key:"collider",get:function(){return this._collider}},{key:"hitNormal",get:function(){return this._hitNormal}}]),t}()),aX=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._fixedTimeStep)){this.physicsWorld.syncSceneToPhysics();break}this.physicsWorld.syncSceneToPhysics(),this.physicsWorld.step(this._fixedTimeStep),this.physicsWorld.emitEvents(),this.physicsWorld.syncAfterEvents(),this._accumulator-=this._fixedTimeStep,this._subStepCount++}Di.emit(An.EVENT_AFTER_PHYSICS)}}else this.physicsWorld.syncSceneToPhysics()},e.resetConfiguration=function(t){var e=t?t.allowSleep:Tr.querySettings(Sr.Category.PHYSICS,"allowSleep");"boolean"==typeof e&&(this._allowSleep=e);var i=t?t.fixedTimeStep:Tr.querySettings(Sr.Category.PHYSICS,"fixedTimeStep");"number"==typeof i&&(this._fixedTimeStep=i);var n=t?t.maxSubSteps:Tr.querySettings(Sr.Category.PHYSICS,"maxSubSteps");"number"==typeof n&&(this._maxSubSteps=n);var r=t?t.sleepThreshold:Tr.querySettings(Sr.Category.PHYSICS,"sleepThreshold");"number"==typeof r&&(this._sleepThreshold=r);var s=t?t.autoSimulation:Tr.querySettings(Sr.Category.PHYSICS,"autoSimulation");"boolean"==typeof s&&(this.autoSimulation=s);var a=t?t.gravity:Tr.querySettings(Sr.Category.PHYSICS,"gravity");a&&ji.copy(this._gravity,a);var o=t?t.collisionMatrix:Tr.querySettings(Sr.Category.PHYSICS,"collisionMatrix");if(o)for(var h in o)this.collisionMatrix[""+(1<>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycast(t,this.raycastOptions,this.raycastResultPool,this.raycastResults))},e.raycastClosest=function(t,e,i,n){return void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),!!this.physicsWorld&&(this.raycastOptions.mask=e>>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycastClosest(t,this.raycastOptions,this.raycastClosestResult))},e.lineStripCast=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;this.lineStripCastResults=[];for(var r=0,s=new gr,a=1;ai);++a){var o=t[a-1],h=t[a],l=new ji;ji.subtract(l,h,o);var u=ji.len(l);if(r+=u,ji.multiplyScalar(l,l,1/u),s.d=l,s.o=o,this.raycast(s,e,u,n))for(var c=0;c0},e.lineStripCastClosest=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;for(var r=0,s=new gr,a=!1,o=1;oi);++o){var h=t[o-1],l=t[o],u=new ji;ji.subtract(u,l,h);var c=ji.len(u);if(r+=c,ji.multiplyScalar(u,u,1/c),s.d=u,s.o=h,a=this.raycastClosest(s,e,c,n)){var d=this.raycastClosestResult,_=new aX;_._assign(d.hitPoint,d.distance,d.collider,d.hitNormal,o-1),this.lineStripCastClosestResult=_;break}}return a},e._updateMaterial=function(){this.physicsWorld&&this.physicsWorld.setDefaultMaterial(this._material)},n.constructAndRegister=function(){var t;if((null===(t=Tr.querySettings(Sr.Category.PHYSICS,"enabled"))||void 0===t||t)&&!n._instance){var e=new n;e.resetConfiguration(),function(t){if(ez||(ez=t),wz.runInEditor&&!wz.physicsWorld){console.info("[PHYSICS]: using "+wz.id+".");var e=wz.physicsWorld=Pz();e.setGravity(ez.gravity),e.setAllowSleep(ez.allowSleep)}}(e),n._instance=e,Di.registerSystem(n.ID,e,e.priority),qr.onPostProjectInitDelegate.add(e.initDefaultMaterial.bind(e))}},Pi(n,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"allowSleep",get:function(){return this._allowSleep},set:function(t){this._allowSleep=t,this.physicsWorld&&this.physicsWorld.setAllowSleep(t)}},{key:"maxSubSteps",get:function(){return this._maxSubSteps},set:function(t){this._maxSubSteps=t}},{key:"fixedTimeStep",get:function(){return this._fixedTimeStep},set:function(t){this._fixedTimeStep=t}},{key:"gravity",get:function(){return this._gravity},set:function(t){this._gravity.set(t),this.physicsWorld&&this.physicsWorld.setGravity(t)}},{key:"sleepThreshold",get:function(){return this._sleepThreshold},set:function(t){this._sleepThreshold=t}},{key:"autoSimulation",get:function(){return this._autoSimulation},set:function(t){this._autoSimulation=t}},{key:"defaultMaterial",get:function(){return this._material}},{key:"physicsWorld",get:function(){return wz.physicsWorld}}],[{key:"PHYSICS_NONE",get:function(){return!wz.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===wz.id}},{key:"PHYSICS_CANNON",get:function(){return"cannon.js"===wz.id}},{key:"PHYSICS_BULLET",get:function(){return"bullet"===wz.id}},{key:"PHYSICS_PHYSX",get:function(){return"physx"===wz.id}},{key:"PhysicsGroup",get:function(){return tz}},{key:"instance",get:function(){return n._instance}}]),n}(Oi));RX.ID="PHYSICS",RX._instance=null,Di.once(An.EVENT_INIT,(function(){RX.constructAndRegister()}));var bX,xX,wX,MX,IX,BX,PX,DX,OX,FX,LX,NX,kX=function(e){return t({RigidBody:e,RigidBodyComponent:e}),e}((hX=Ki("cc.RigidBody"),lX=In(-1),uX=Tn(RX.PhysicsGroup),cX=Tn(qH),hX(dX=bn(dX=lX((CX=AX=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&l++,e>0&&l++);var u=(s+1)*(a+1);o&&(u+=(s+1)*l+s*l);var c=s*a*6;o&&(c+=s*l*3);var d=new Array(c),_=new Array(3*u),f=new Array(3*u),p=new Array(2*u),g=Math.max(t,e),m=new ji(-g,-r,-g),v=new ji(g,r,g),y=Math.sqrt(g*g+r*r),T=0,S=0;return function(){for(var n=[],o=t-e,l=o*o/i*Math.sign(o),u=0;u<=a;u++){for(var c=[],g=u/a,m=g*o+e,v=0;v<=s;++v){var y=v/s,E=y*h,A=Math.sin(E),C=Math.cos(E);_[3*T]=m*A,_[3*T+1]=g*i-r,_[3*T+2]=m*C,ji.normalize($X,ji.set(tW,A,-l,C)),f[3*T]=$X.x,f[3*T+1]=$X.y,f[3*T+2]=$X.z,p[2*T]=2*(1-y)%1,p[2*T+1]=g,c.push(T),++T}n.push(c)}for(var R=0;R0&&E(!1),t>0&&E(!0)),{positions:_,normals:f,uvs:p,indices:d,minPos:m,maxPos:v,boundingRadius:y};function E(i){for(var n=i?t:e,a=i?1:-1,o=T,l=1;l<=s;++l)_[3*T]=0,_[3*T+1]=r*a,_[3*T+2]=0,f[3*T]=0,f[3*T+1]=a,f[3*T+2]=0,p[2*T]=.5,p[2*T+1]=.5,++T;for(var u=T,c=0;c<=s;++c){var g=c/s*h,m=Math.cos(g),v=Math.sin(g);_[3*T]=n*v,_[3*T+1]=r*a,_[3*T+2]=n*m,f[3*T]=0,f[3*T+1]=a,f[3*T+2]=0,p[2*T]=.5-.5*v*a,p[2*T+1]=.5+.5*m,++T}for(var y=0;y0&&(n[n.length-1]=1),{positions:i,indices:n,minPos:{x:1,y:1,z:0},maxPos:{x:-1,y:-1,z:0},boundingRadius:1,primitiveMode:U.TRIANGLE_FAN}},translate:function(t,e){for(var i=e.x||0,n=e.y||0,r=e.z||0,s=Math.floor(t.positions.length/3),a=0;ah?h<<16|o:o<<16|h;void 0===r[l]&&(r[l]=0,n.push(o,h))}return t.indices=n,t.primitiveMode=U.LINE_LIST,t},wireframe:function(t){for(var e=[[0,1],[1,2],[2,0]],i=[],n={},r=0;ro?o<<16|a:a<<16|o;void 0===n[h]&&(n[h]=0,i.push(a,o))}return i},invWinding:function(t){for(var e=[],i=0;i=3){e[0]=t[0],e[1]=t[1],e[2]=t[2];for(var i=t.length,n=3;nZH.Z_AXIS||this._direction!==t&&(this._direction=t,this._shape&&this.shape.setDirection(t))}},{key:"height",get:function(){return 2*this._radius+this._cylinderHeight},set:function(t){var e=t-2*this._radius;e<0&&(e=0),this.cylinderHeight=e}},{key:"worldHeight",get:function(){return 2*this._radius*this._getRadiusScale()+this._cylinderHeight*this._getHeightScale()}},{key:"shape",get:function(){return this._shape}}]),e}(UX),gn(RW.prototype,"direction",[AW],Object.getOwnPropertyDescriptor(RW.prototype,"direction"),RW.prototype),bW=tn(RW.prototype,"_radius",[en],(function(){return.5})),xW=tn(RW.prototype,"_cylinderHeight",[en],(function(){return 1})),wW=tn(RW.prototype,"_direction",[en],(function(){return ZH.Y_AXIS})),CW=RW))||CW)),FY=function(e){return t({CylinderCollider:e,CylinderColliderComponent:e}),e}((MW=Ki("cc.CylinderCollider"),IW=Tn(ZH),MW((PW=function(t){function e(){var e;return(e=t.call(this,JH.CYLINDER)||this)._radius=DW&&DW(),e._height=OW&&OW(),e._direction=FW&&FW(),e}return He(e,t),Pi(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(this._height=Math.abs(t),this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(tZH.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(UX),gn(PW.prototype,"direction",[IW],Object.getOwnPropertyDescriptor(PW.prototype,"direction"),PW.prototype),DW=tn(PW.prototype,"_radius",[en],(function(){return.5})),OW=tn(PW.prototype,"_height",[en],(function(){return 2})),FW=tn(PW.prototype,"_direction",[en],(function(){return ZH.Y_AXIS})),BW=PW))||BW)),LY=t("ConeCollider",(LW=Ki("cc.ConeCollider"),NW=Tn(ZH),LW((UW=function(t){function e(){var e;return(e=t.call(this,JH.CONE)||this)._radius=GW&&GW(),e._height=VW&&VW(),e._direction=HW&&HW(),e}return He(e,t),Pi(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(t<0&&(t=0),this._height=t,this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(tZH.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(UX),gn(UW.prototype,"direction",[NW],Object.getOwnPropertyDescriptor(UW.prototype,"direction"),UW.prototype),GW=tn(UW.prototype,"_radius",[en],(function(){return.5})),VW=tn(UW.prototype,"_height",[en],(function(){return 1})),HW=tn(UW.prototype,"_direction",[en],(function(){return ZH.Y_AXIS})),kW=UW))||kW)),NY=function(e){return t({MeshCollider:e,MeshColliderComponent:e}),e}((zW=Ki("cc.MeshCollider"),XW=Tn(mo),zW((YW=function(t){function e(){var e;return(e=t.call(this,JH.MESH)||this)._mesh=jW&&jW(),e._convex=KW&&KW(),e}return He(e,t),Pi(e,[{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh=t,this._shape&&this.shape.setMesh(this._mesh))}},{key:"convex",get:function(){return this._convex},set:function(t){this._convex!==t&&(this._convex=t,this._shape&&this._mesh&&this.shape.setMesh(this._mesh))}},{key:"shape",get:function(){return this._shape}}]),e}(UX),gn(YW.prototype,"mesh",[XW],Object.getOwnPropertyDescriptor(YW.prototype,"mesh"),YW.prototype),jW=tn(YW.prototype,"_mesh",[en],(function(){return null})),KW=tn(YW.prototype,"_convex",[en],(function(){return!1})),WW=YW))||WW)),kY=t("ConstantForce",Ki("cc.ConstantForce")(qW=kn(kX)(qW=bn((ZW=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rt)){for(var e=this.buffer.byteLength;e=zY?this.tileSize=e.readDouble():this.tileSize=e.readFloat(),this.tileSize=Math.floor(100*this.tileSize)/100,e.readIntArray(this._blockCount),this.weightMapSize=e.readInt16(),this.lightMapSize=e.readInt16();var i=e.readInt();this.heights=new Uint16Array(i);for(var n=0;n=HY){var r=e.readInt();this.normals=new Float32Array(r);for(var s=0;s=UY){var h=e.readInt();this.layerBuffer=new Array(h);for(var l=0;l=GY){var u=e.readInt();this._layerBinaryInfos=new Array(u);for(var c=0;c=zY?this._layerBinaryInfos[c].tileSize=e.readDouble():this._layerBinaryInfos[c].tileSize=e.readFloat(),this._layerBinaryInfos[c].detailMapId=e.readString(),this._version>=VY&&(this._layerBinaryInfos[c].normalMapId=e.readString(),this._version>=zY?(this._layerBinaryInfos[c].roughness=e.readDouble(),this._layerBinaryInfos[c].metallic=e.readDouble()):(this._layerBinaryInfos[c].roughness=e.readFloat(),this._layerBinaryInfos[c].metallic=e.readFloat()))}return!0},i._exportNativeData=function(){var t=new WY;t.writeInt32(zY),t.writeDouble(this.tileSize),t.writeIntArray(this._blockCount),t.writeInt16(this.weightMapSize),t.writeInt16(this.lightMapSize),t.writeInt32(this.heights.length);for(var e=0;e=0&&(Ls(this.ghostStruct.wrappedShapes,i),t.setCompound(0),this.ghostEnabled=!1)}else{var n=this.bodyStruct.wrappedShapes.indexOf(t);n>=0&&(this.bodyStruct.useCompound?t.setCompound(0):Sa.CollisionObject_setCollisionShape(this.body,Sa.EmptyShape_static()),Sa.CollisionObject_activate(this.body,!0),this.dirty|=Gj.BODY_RE_ADD,Ls(this.bodyStruct.wrappedShapes,n),this.bodyEnabled=!1)}},e.addJoint=function(t,e){e?this.wrappedJoints1.indexOf(t)<0&&this.wrappedJoints1.push(t):this.wrappedJoints0.indexOf(t)<0&&this.wrappedJoints0.push(t)},e.removeJoint=function(t,e){if(e){var i=this.wrappedJoints1.indexOf(t);i>=0&&Ls(this.wrappedJoints1,i)}else{var n=this.wrappedJoints0.indexOf(t);n>=0&&Ls(this.wrappedJoints0,n)}},e.updateDirty=function(){this.dirty&&(this.bodyIndex>=0&&this.dirty&Gj.BODY_RE_ADD&&this.updateBodyByReAdd(),this.ghostIndex>=0&&this.dirty&Gj.GHOST_RE_ADD&&this.updateGhostByReAdd(),this.dirty=0)},e.syncSceneToPhysics=function(){if(this.node.hasChangedFlags){var t=Gz.instance.BT_QUAT_0,e=Sa.CollisionObject_getWorldTransform(this.body);if(eX(t,this.node.worldRotation),$z(Sa.Transform_getOrigin(e),this.node.worldPosition),Sa.Transform_setRotation(e,t),this.node.hasChangedFlags&pr.SCALE&&this.syncBodyScale(),Sa.CollisionObject_isKinematicObject(this.body)){var i=Sa.RigidBody_getMotionState(this.body);i&&Sa.MotionState_setWorldTransform(i,e)}else this.isBodySleeping()&&Sa.CollisionObject_activate(this.body)}},e.syncPhysicsToScene=function(){Sa.CollisionObject_isStaticOrKinematicObject(this.body)||this.syncPhysicsToGraphics()},e.syncPhysicsToGraphics=function(){if(!this.isBodySleeping()){var t=Gz.instance.BT_QUAT_0,e=Gz.instance.BT_TRANSFORM_0;if(Sa.MotionState_getWorldTransform(Sa.RigidBody_getMotionState(this.body),e),Sa.Transform_getRotation(e,t),this.node.worldRotation=iX(Zj,t),this.node.worldPosition=tX(qj,Sa.Transform_getOrigin(e)),this._ghostStruct){var i=Sa.CollisionObject_getWorldTransform(this.ghost);$z(Sa.Transform_getOrigin(i),this.node.worldPosition),eX(t,this.node.worldRotation),Sa.Transform_setRotation(i,t)}}},e.syncSceneToGhost=function(){if(this.node.hasChangedFlags){var t=Gz.instance.BT_QUAT_0,e=Sa.CollisionObject_getWorldTransform(this.ghost);$z(Sa.Transform_getOrigin(e),this.node.worldPosition),eX(t,this.node.worldRotation),Sa.Transform_setRotation(e,t),this.node.hasChangedFlags&pr.SCALE&&this.syncGhostScale(),Sa.CollisionObject_activate(this.ghost)}},e.syncInitialBody=function(){var t=Gz.instance.BT_QUAT_0,e=Sa.CollisionObject_getWorldTransform(this.body);$z(Sa.Transform_getOrigin(e),this.node.worldPosition),eX(t,this.node.worldRotation),Sa.Transform_setRotation(e,t),this.syncBodyScale(),Sa.CollisionObject_activate(this.body)},e.syncInitialGhost=function(){var t=Gz.instance.BT_QUAT_0,e=Sa.CollisionObject_getWorldTransform(this.ghost);$z(Sa.Transform_getOrigin(e),this.node.worldPosition),eX(t,this.node.worldRotation),Sa.Transform_setRotation(e,t),this.syncGhostScale(),Sa.CollisionObject_activate(this.body)},e.syncBodyScale=function(){for(var t=0;t=0&&(this.wrappedWorld.removeSharedBody(this),this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this))},e.updateGhostByReAdd=function(){this.ghostIndex>=0&&(this.wrappedWorld.removeGhostObject(this),this.ghostIndex=this.wrappedWorld.ghosts.length,this.wrappedWorld.addGhostObject(this))},e.destroy=function(){if(t.sharedBodesMap.delete(this.node.uuid),this.node=null,this.wrappedWorld=null,this._bodyStruct){var e=this._bodyStruct;Gz.delWrapper(e.body,Sa.BODY_CACHE_NAME),Sa._safe_delete(e.motionState,ba.EBulletTypeMotionState),Sa._safe_delete(e.compound,ba.EBulletTypeCollisionShape),Sa._safe_delete(e.body,ba.EBulletTypeCollisionObject),this._bodyStruct=null}if(this._ghostStruct){var i=this._ghostStruct;Sa._safe_delete(i.compound,ba.EBulletTypeCollisionShape),Sa._safe_delete(i.ghost,ba.EBulletTypeCollisionObject),this._ghostStruct=null}},e.isBodySleeping=function(){return Sa.CollisionObject_getActivationState(this.body)===zj.ISLAND_SLEEPING},Pi(t,[{key:"wrappedBody",get:function(){return this._wrappedBody}},{key:"bodyCompoundShape",get:function(){return this.bodyStruct.compound}},{key:"ghostCompoundShape",get:function(){return this.ghostStruct.compound}},{key:"body",get:function(){return this.bodyStruct.body}},{key:"ghost",get:function(){return this.ghostStruct.ghost}},{key:"collisionFilterGroup",get:function(){return this._collisionFilterGroup},set:function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this.dirty|=Gj.BODY_RE_ADD,this.dirty|=Gj.GHOST_RE_ADD)}},{key:"collisionFilterMask",get:function(){return this._collisionFilterMask},set:function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this.dirty|=Gj.BODY_RE_ADD,this.dirty|=Gj.GHOST_RE_ADD)}},{key:"bodyStruct",get:function(){return this._instantiateBodyStruct(),this._bodyStruct}},{key:"ghostStruct",get:function(){return this._instantiateGhostStruct(),this._ghostStruct}},{key:"bodyEnabled",set:function(t){if(t){if(this.bodyIndex<0){if(0===this.bodyStruct.wrappedShapes.length){if(!this.wrappedBody)return;if(!this.wrappedBody.rigidBody.isDynamic)return}this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this),this.syncInitialBody()}}else this.bodyIndex>=0&&(0===this.bodyStruct.wrappedShapes.length&&null==this.wrappedBody||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.isEnabled||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.rigidBody.enabledInHierarchy)&&(Sa.RigidBody_clearState(this.body),this.bodyIndex=-1,this.wrappedWorld.removeSharedBody(this))}},{key:"ghostEnabled",set:function(t){t?this.ghostIndex<0&&this.ghostStruct.wrappedShapes.length>0&&(this.ghostIndex=1,this.wrappedWorld.addGhostObject(this),this.syncInitialGhost()):this.ghostIndex>=0&&0===this.ghostStruct.wrappedShapes.length&&this.ghost&&(this.ghostIndex=-1,this.wrappedWorld.removeGhostObject(this))}},{key:"reference",set:function(t){t?this.ref++:this.ref--,0===this.ref&&this.destroy()}}]),t}();Jj.idCounter=0,Jj.sharedBodesMap=new Map;var $j=qz,tK={},eK=function(){function t(){this.id=t.idCounter++,this._isEnabled=!1,this._isTrigger=!1,this._isInitialized=!1,this._impl=0,this._compound=0,this.quat=Sa.Quat_new(0,0,0,1),this.transform=Sa.Transform_new()}var e=t.prototype;return e.updateEventListener=function(){this._sharedBody.wrappedWorld.updateNeedEmitEvents(this.collider.needCollisionEvent||this.collider.needTriggerEvent)},e.setMaterial=function(t){var e=null==t?RX.instance.defaultMaterial:t;if(!this._isTrigger&&this._isEnabled)if(this._compound){tK[e._uuid]||(tK[e._uuid]=Sa.ccMaterial_new());var i=tK[e._uuid];Sa.ccMaterial_set(i,e.restitution,e.friction,e.rollingFriction,e.spinningFriction),Sa.CollisionShape_setMaterial(this._impl,i)}else Sa.CollisionObject_setMaterial(this._sharedBody.body,e.restitution,e.friction,e.rollingFriction,e.spinningFriction)},e.setCenter=function(t){ji.copy($j,t),$j.multiply(this._collider.node.worldScale),$z(Sa.Transform_getOrigin(this.transform),$j),this.updateCompoundTransform()},e.setAsTrigger=function(t){this._isTrigger!==t&&(this._isEnabled&&(this._sharedBody.removeShape(this,!t),this._sharedBody.addShape(this,t)),this._isTrigger=t)},e.getAABB=function(t){var e=Gz.instance.BT_TRANSFORM_0;Sa.Transform_setIdentity(e),Sa.Transform_setRotation(e,eX(Gz.instance.BT_QUAT_0,this._collider.node.worldRotation));var i=Gz.instance.BT_V3_0,n=Gz.instance.BT_V3_1;Sa.CollisionShape_getAabb(this._impl,e,i,n),t.halfExtents.x=(Sa.Vec3_x(n)-Sa.Vec3_x(i))/2,t.halfExtents.y=(Sa.Vec3_y(n)-Sa.Vec3_y(i))/2,t.halfExtents.z=(Sa.Vec3_z(n)-Sa.Vec3_z(i))/2,ji.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.getBoundingSphere=function(t){t.radius=Sa.CollisionShape_getLocalBoundingSphere(this._impl),ji.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.initialize=function(t){this._collider=t,this._isInitialized=!0,this._sharedBody=RX.instance.physicsWorld.getSharedBody(this._collider.node),this._sharedBody.reference=!0,this.onComponentSet(),this.setWrapper()},e.setWrapper=function(){Gz.isNotEmptyShape(this._impl)&&(Sa.CollisionShape_setUserPointer(this._impl,this._impl),Gz.setWrapper(this._impl,t.TYPE,this))},e.onLoad=function(){this.setCenter(this._collider.center),this.setAsTrigger(this._collider.isTrigger)},e.onEnable=function(){this._isEnabled=!0,this._sharedBody.addShape(this,this._isTrigger),this.setMaterial(this.collider.sharedMaterial)},e.onDisable=function(){this._isEnabled=!1,this._sharedBody.removeShape(this,this._isTrigger)},e.onDestroy=function(){this._sharedBody.reference=!1,this._collider=null,Sa._safe_delete(this.quat,ba.EBulletTypeQuat),Sa._safe_delete(this.transform,ba.EBulletTypeTransform),this._compound&&Sa._safe_delete(this._compound,ba.EBulletTypeCollisionShape),Gz.isNotEmptyShape(this._impl)&&(Sa._safe_delete(this._impl,ba.EBulletTypeCollisionShape),Gz.delWrapper(this._impl,t.TYPE))},e.updateByReAdd=function(){this._isEnabled&&(this._sharedBody.removeShape(this,this._isTrigger),this._sharedBody.addShape(this,this._isTrigger))},e.getGroup=function(){return this._sharedBody.collisionFilterGroup},e.setGroup=function(t){this._sharedBody.collisionFilterGroup=t},e.addGroup=function(t){this._sharedBody.collisionFilterGroup|=t},e.removeGroup=function(t){this._sharedBody.collisionFilterGroup&=~t},e.getMask=function(){return this._sharedBody.collisionFilterMask},e.setMask=function(t){this._sharedBody.collisionFilterMask=t},e.addMask=function(t){this._sharedBody.collisionFilterMask|=t},e.removeMask=function(t){this._sharedBody.collisionFilterMask&=~t},e.setCompound=function(t){this._compound&&Sa.CompoundShape_removeChildShape(this._compound,this._impl),t&&Sa.CompoundShape_addChildShape(t,this.transform,this._impl),this._compound=t},e.updateScale=function(){this.setCenter(this._collider.center)},e.updateCompoundTransform=function(){this._compound?Sa.CompoundShape_updateChildTransform(this._compound,this._impl,this.transform,!0):this._isEnabled&&!this._isTrigger&&this._sharedBody&&!this._sharedBody.bodyStruct.useCompound&&(this._sharedBody.dirty|=Gj.BODY_RE_ADD)},e.needCompound=function(){return this._collider.type===JH.TERRAIN||!this._collider.center.equals(ji.ZERO)},Pi(t,[{key:"attachedRigidBody",get:function(){return this._sharedBody.wrappedBody?this._sharedBody.wrappedBody.rigidBody:null}},{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}},{key:"sharedBody",get:function(){return this._sharedBody}}]),t}();eK.TYPE="shape",eK.idCounter=0;var iK=function(){function t(){this.matrix=[]}var e=t.prototype;return e.get=function(t,e){if(e>t){var i=e;e=t,t=i}return this.matrix[(t*(t+1)>>1)+e-1]},e.set=function(t,e,i){if(e>t){var n=e;e=t,t=n}this.matrix[(t*(t+1)>>1)+e-1]=i?1:0},e.reset=function(){this.matrix.length=0},e.setNumObjects=function(t){this.matrix.length=t*(t-1)>>1},t}(),nK=function(){function t(){this.data=void 0,this.data={keys:[]}}var e=t.prototype;return e.get=function(t,e){if(t>e){var i=e;e=t,t=i}return this.data[t+"-"+e]},e.set=function(t,e,i){if(t>e){var n=e;e=t,t=n}var r=t+"-"+e;if(null==i){var s=this.data.keys.indexOf(r);if(-1!==s)return this.data.keys.splice(s,1),delete this.data[r],i}return this.get(t,e)||this.data.keys.push(r),this.data[r]=i,this.data[r]},e.reset=function(){this.data={keys:[]}},e.getLength=function(){return this.data.keys.length},e.getKeyByIndex=function(t){return this.data.keys[t]},e.getDataByKey=function(t){return this.data[t]},t}(),rK=function(){function t(t){this.impl=0,this.event=void 0,this.event=t}var e=t.prototype;return e.getLocalPointOnA=function(t){this.impl&&tX(t,Sa.ManifoldPoint_get_m_localPointA(this.impl))},e.getLocalPointOnB=function(t){this.impl&&tX(t,Sa.ManifoldPoint_get_m_localPointB(this.impl))},e.getWorldPointOnA=function(t){this.impl&&tX(t,Sa.ManifoldPoint_get_m_positionWorldOnA(this.impl))},e.getWorldPointOnB=function(t){this.impl&&tX(t,Sa.ManifoldPoint_get_m_positionWorldOnB(this.impl))},e.getLocalNormalOnA=function(t){if(this.impl){var e=Gz.instance.BT_QUAT_0,i=Sa.PersistentManifold_getBody0(this.event.impl),n=Sa.CollisionObject_getWorldTransform(i);Sa.Transform_getRotation(n,e);var r=Qz;iX(r,e),Ji.conjugate(r,r),tX(t,Sa.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||ji.negate(t,t),ji.transformQuat(t,t,r)}},e.getLocalNormalOnB=function(t){if(this.impl){var e=Gz.instance.BT_QUAT_0,i=Sa.PersistentManifold_getBody1(this.event.impl),n=Sa.CollisionObject_getWorldTransform(i);Sa.Transform_getRotation(n,e);var r=Qz;iX(r,e),Ji.conjugate(r,r),tX(t,Sa.ManifoldPoint_get_m_normalWorldOnB(this.impl)),ji.transformQuat(t,t,r)}},e.getWorldNormalOnA=function(t){this.impl&&(tX(t,Sa.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||ji.negate(t,t))},e.getWorldNormalOnB=function(t){this.impl&&tX(t,Sa.ManifoldPoint_get_m_normalWorldOnB(this.impl))},Pi(t,[{key:"isBodyA",get:function(){return this.event.selfCollider.shape.sharedBody.body===Sa.PersistentManifold_getBody0(this.event.impl)}}]),t}(),sK=[],aK=qz,oK=Zz,hK=function(){var t=e.prototype;function e(){this._world=void 0,this._broadphase=void 0,this._solver=void 0,this._dispatcher=void 0,this._needEmitEvents=!1,this._needSyncAfterEvents=!1,this.bodies=[],this.ghosts=[],this.constraints=[],this.triggerArrayMat=new iK,this.collisionArrayMat=new iK,this.contactsDic=new nK,this.oldContactsDic=new nK,this._broadphase=Sa.DbvtBroadphase_new(),this._dispatcher=Sa.CollisionDispatcher_new(),this._solver=Sa.SequentialImpulseConstraintSolver_new(),this._world=Sa.ccDiscreteDynamicsWorld_new(this._dispatcher,this._broadphase,this._solver)}return t.setDefaultMaterial=function(){},t.setAllowSleep=function(t){Sa.ccDiscreteDynamicsWorld_setAllowSleep(this._world,t)},t.setGravity=function(t){Sa.DynamicsWorld_setGravity(this._world,$z(Gz.instance.BT_V3_0,t))},t.updateNeedEmitEvents=function(t){if(this.ghosts)if(t)this._needEmitEvents=!0;else{this._needEmitEvents=!1;for(var e=0;e=0;t--){var e=this.ghosts[t];e.updateDirty(),e.syncSceneToGhost()}for(var i=this.bodies.length-1;i>=0;i--){var n=this.bodies[i];n.updateDirty(),n.syncSceneToPhysics()}},t.syncAfterEvents=function(){this._needSyncAfterEvents&&this.syncSceneToPhysics()},t.raycast=function(t,e,i,n){t.computeHit(aK,e.maxDistance);var r=$z(Gz.instance.BT_V3_0,aK),s=$z(Gz.instance.BT_V3_1,t.o),a=Sa.ccAllRayCallback_static();if(Sa.ccAllRayCallback_reset(a,s,r,e.mask,e.queryTrigger),Sa.ccAllRayCallback_setFlags(a,xa.UseSubSimplexConvexCastRaytest),Sa.CollisionWorld_rayTest(this._world,s,r,a),Sa.RayCallback_hasHit(a)){for(var o=Sa.ccAllRayCallback_getHitPointWorld(a),h=Sa.ccAllRayCallback_getHitNormalWorld(a),l=Sa.ccAllRayCallback_getCollisionShapePtrs(a),u=0,c=Sa.int_array_size(l);u=0&&(Ls(this.bodies,e),Sa.DynamicsWorld_removeRigidBody(this._world,t.body))},t.addGhostObject=function(t){this.ghosts.indexOf(t)<0&&(this.ghosts.push(t),Sa.CollisionWorld_addCollisionObject(this._world,t.ghost,t.collisionFilterGroup,t.collisionFilterMask))},t.removeGhostObject=function(t){var e=this.ghosts.indexOf(t);e>=0&&(Ls(this.ghosts,e),Sa.CollisionWorld_removeCollisionObject(this._world,t.ghost))},t.addConstraint=function(t){var e=this.constraints.indexOf(t);e<0&&(this.constraints.push(t),Sa.DynamicsWorld_addConstraint(this.impl,t.impl,!t.constraint.enableCollision),t.index=e)},t.removeConstraint=function(t){var e=this.constraints.indexOf(t);e>=0&&(this.constraints.splice(e,1),Sa.DynamicsWorld_removeConstraint(this.impl,t.impl),t.index=-1)},t.emitEvents=function(){if(this._needSyncAfterEvents=!1,this._needEmitEvents){this.gatherConatactData();for(var t=this.contactsDic.getLength();t--;){sK.push.apply(sK,Uz.contacts),Uz.contacts.length=0;var e=this.contactsDic.getKeyByIndex(t),i=this.contactsDic.getDataByKey(e),n=i.shape0,r=i.shape1;this.oldContactsDic.set(n.id,r.id,i);var s=n.collider,a=r.collider;if(s&&a){if(s.isTrigger||a.isTrigger)this.triggerArrayMat.get(n.id,r.id)?kz.type="onTriggerStay":(kz.type="onTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),kz.impl=i.impl,kz.selfCollider=s,kz.otherCollider=a,s.emit(kz.type,kz),kz.selfCollider=a,kz.otherCollider=s,a.emit(kz.type,kz),this._needSyncAfterEvents=!0;else{var o=s.attachedRigidBody,h=a.attachedRigidBody;if(o&&h){if(o.isSleeping&&h.isSleeping)continue}else if(!o&&h){if(h.isSleeping)continue}else if(!h&&o&&o.isSleeping)continue;this.collisionArrayMat.get(n.id,r.id)?Uz.type="onCollisionStay":(Uz.type="onCollisionEnter",this.collisionArrayMat.set(n.id,r.id,!0));for(var l=0;l0){var c=sK.pop();c.impl=u,Uz.contacts.push(c)}else{var d=new rK(Uz);d.impl=u,Uz.contacts.push(d)}}Uz.impl=i.impl,Uz.selfCollider=s,Uz.otherCollider=a,s.emit(Uz.type,Uz),Uz.selfCollider=a,Uz.otherCollider=s,a.emit(Uz.type,Uz),this._needSyncAfterEvents=!0}null==this.oldContactsDic.get(n.id,r.id)&&this.oldContactsDic.set(n.id,r.id,i)}}for(var _=this.oldContactsDic.getLength();_--;){var f=this.oldContactsDic.getKeyByIndex(_),p=this.oldContactsDic.getDataByKey(f),g=p.shape0,m=p.shape1,v=g.collider,y=m.collider;if(v&&y){var T=v.isTrigger||y.isTrigger;null==this.contactsDic.getDataByKey(f)&&(T?this.triggerArrayMat.get(g.id,m.id)&&(kz.type="onTriggerExit",kz.selfCollider=v,kz.otherCollider=y,v.emit(kz.type,kz),kz.selfCollider=y,kz.otherCollider=v,y.emit(kz.type,kz),this.triggerArrayMat.set(g.id,m.id,!1),this.oldContactsDic.set(g.id,m.id,null),this._needSyncAfterEvents=!0):this.collisionArrayMat.get(g.id,m.id)&&(sK.push.apply(sK,Uz.contacts),Uz.contacts.length=0,Uz.type="onCollisionExit",Uz.selfCollider=v,Uz.otherCollider=y,v.emit(Uz.type,Uz),Uz.selfCollider=y,Uz.otherCollider=v,y.emit(Uz.type,Uz),this.collisionArrayMat.set(g.id,m.id,!1),this.oldContactsDic.set(g.id,m.id,null),this._needSyncAfterEvents=!0))}}this.contactsDic.reset()}},t.gatherConatactData=function(){for(var t=Sa.Dispatcher_getNumManifolds(this._dispatcher),e=0;e0){if(this.collider.convex){var i=this._getBtTriangleMesh(e);this._impl=Sa.ConvexTriangleMeshShape_new(i)}else this.btBVHMeshShape=dK.getBulletBvhTriangleMeshShape(e.hash,e),this._impl=Sa.ScaledBvhTriangleMeshShape_new(this.btBVHMeshShape.bulletBvhTriangleMeshShapePtr,1,1,1);var n=Gz.instance.BT_V3_0;$z(n,this._collider.node.worldScale),Sa.CollisionShape_setLocalScaling(this._impl,n),Sa.CollisionShape_setMargin(this._impl,.01),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=Sa.EmptyShape_static()}},i.onComponentSet=function(){this.setMesh(this.collider.mesh)},i.onDestroy=function(){this.collider.convex?this.refBtTriangleMesh&&Sa._safe_delete(this.refBtTriangleMesh,ba.EBulletTypeTriangleMesh):this.btBVHMeshShape&&(this.btBVHMeshShape.reference=!1),t.prototype.onDestroy.call(this)},i.updateScale=function(){t.prototype.updateScale.call(this);var e=Gz.instance.BT_V3_0;$z(e,this._collider.node.worldScale),Sa.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i._getBtTriangleMesh=function(t){return this.refBtTriangleMesh=Sa.TriangleMesh_new(),nX(this.refBtTriangleMesh,t),this.refBtTriangleMesh},Pi(e,[{key:"collider",get:function(){return this._collider}}]),e}(eK),AK=function(t){function e(){return t.apply(this,arguments)||this}He(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){var t=Gz.instance.BT_V3_0;Sa.Vec3_set(t,.5,1,.5),this._impl=Sa.CylinderShape_new(t),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,a=n,o=i;1===o?(s=e*Math.abs(a.y),r=t*Math.abs(Ra(a.x,a.z))):0===o?(s=e*Math.abs(a.x),r=t*Math.abs(Ra(a.y,a.z))):(s=e*Math.abs(a.z),r=t*Math.abs(Ra(a.x,a.y))),Sa.CylinderShape_updateProp(this._impl,r,s/2,o),this.updateCompoundTransform()},Pi(e,[{key:"collider",get:function(){return this._collider}}]),e}(eK),CK=function(t){function e(){return t.apply(this,arguments)||this}He(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){this._impl=Sa.ConeShape_new(.5,1),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,a=n,o=i;1===o?(s=e*Math.abs(a.y),r=t*Math.abs(Ra(a.x,a.z))):0===o?(s=e*Math.abs(a.x),r=t*Math.abs(Ra(a.y,a.z))):(s=e*Math.abs(a.z),r=t*Math.abs(Ra(a.x,a.y))),Sa.ConeShape_setRadius(this._impl,r),Sa.ConeShape_setHeight(this._impl,s),Sa.ConeShape_setConeUpIndex(this._impl,o);var h=Gz.instance.BT_V3_0;Sa.Vec3_set(h,1,1,1),Sa.CollisionShape_setLocalScaling(this._impl,h),this.updateCompoundTransform()},Pi(e,[{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}}]),e}(eK),RK=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rl&&(s=l),l>a&&(a=l),r+=4}a+=.01,s-=.01,this._localOffset.set((i-1)/2*this._tileSize,(a+s)/2,(n-1)/2*this._tileSize),this._impl=Sa.TerrainShape_new(i,n,this._bufPtr,1,s,a);var u=Gz.instance.BT_V3_0;Sa.Vec3_set(u,this._tileSize,1,this._tileSize),Sa.CollisionShape_setLocalScaling(this._impl,u),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=Sa.EmptyShape_static()}},i.onComponentSet=function(){this.setTerrain(this.collider.terrain)},i.onDestroy=function(){this._bufPtr&&Sa._free(this._bufPtr),t.prototype.onDestroy.call(this)},i.setCenter=function(t){ji.copy(qz,t),qz.add(this._localOffset),$z(Sa.Transform_getOrigin(this.transform),qz),this.updateCompoundTransform()},Pi(e,[{key:"collider",get:function(){return this._collider}}]),e}(eK),bK=function(t){function e(){return t.apply(this,arguments)||this}He(e,t);var i=e.prototype;return i.setShapeType=function(){},i.setVertices=function(){},i.onComponentSet=function(){this._impl=Sa.SimplexShape_new();for(var t=this.collider.shapeType,e=this.collider.vertices,i=Gz.instance.BT_V3_0,n=0;n=0){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.wrappedWorld.addConstraint(this)}},e.initialize=function(t){this._com=t,this._rigidBody=t.attachedBody,this._collided=t.enableCollision,this.onComponentSet()},e.onEnable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.addConstraint(this),t.addJoint(this,0);var e=this.constraint.connectedBody;e&&e.body.sharedBody.addJoint(this,1)},e.onDisable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.removeJoint(this,0);var e=this.constraint.connectedBody;e&&e.body.sharedBody.removeJoint(this,1)},e.onDestroy=function(){Sa._safe_delete(this._impl,ba.EBulletTypeTypedConstraint),this._com=null,this._rigidBody=null},Pi(t,[{key:"impl",get:function(){return this._impl}},{key:"constraint",get:function(){return this._com}}]),t}(),MK=function(t){function e(){return t.apply(this,arguments)||this}He(e,t);var i=e.prototype;return i.setPivotA=function(){var t=this.constraint,e=Gz.instance.BT_V3_0;ji.multiply(qz,t.node.worldScale,t.pivotA),$z(e,qz),Sa.P2PConstraint_setPivotA(this._impl,e),t.connectedBody||this.setPivotB(t.pivotB)},i.setPivotB=function(){var t=this.constraint,e=this._rigidBody.node,i=Gz.instance.BT_V3_0,n=t.connectedBody;n?(ji.multiply(qz,n.node.worldScale,t.pivotB),$z(i,qz)):(ji.multiply(qz,e.worldScale,t.pivotA),ji.add(qz,qz,e.worldPosition),ji.add(qz,qz,t.pivotB),$z(i,qz)),Sa.P2PConstraint_setPivotB(this._impl,i)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:Sa.TypedConstraint_getFixedBody(),n=Gz.instance.BT_V3_0,r=Gz.instance.BT_V3_1;this._impl=Sa.P2PConstraint_new(e,i,n,r),this.setPivotA(this.constraint.pivotA),this.setPivotB(this.constraint.pivotB)},i.updateScale0=function(){this.setPivotA(this.constraint.pivotA)},i.updateScale1=function(){this.setPivotB(this.constraint.pivotB)},Pi(e,[{key:"constraint",get:function(){return this._com}}]),e}(wK),IK=function(t){function e(){return t.apply(this,arguments)||this}He(e,t);var i=e.prototype;return i.setBreakForce=function(t){Sa.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.sharedBody,i=t?t.body.sharedBody:RX.instance.physicsWorld.getSharedBody(e.node),n=Gz.instance.BT_TRANSFORM_0,r=Gz.instance.BT_TRANSFORM_1;this._impl=Sa.FixedConstraint_new(e.body,i.body,n,r),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames()},i.updateFrames=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.sharedBody,i=t?t.body.sharedBody:RX.instance.physicsWorld.getSharedBody(e.node),n=qz,r=Qz,s=Gz.instance.BT_TRANSFORM_0,a=Gz.instance.BT_TRANSFORM_1,o=Gz.instance.BT_QUAT_0,h=Jz;Ue.fromRT(h,e.node.worldRotation,e.node.worldPosition),Ue.invert(h,h),Ue.getRotation(r,h),Ue.getTranslation(n,h),$z(Sa.Transform_getOrigin(s),n),eX(o,r),Sa.Transform_setRotation(s,o),Ue.fromRT(h,i.node.worldRotation,i.node.worldPosition),Ue.invert(h,h),Ue.getRotation(r,h),Ue.getTranslation(n,h),$z(Sa.Transform_getOrigin(a),n),eX(o,r),Sa.Transform_setRotation(a,o),Sa.FixedConstraint_setFrames(this._impl,s,a)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},Pi(e,[{key:"constraint",get:function(){return this._com}}]),e}(wK),BK=function(t){function e(){return t.apply(this,arguments)||this}He(e,t);var i=e.prototype;return i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:Sa.TypedConstraint_getFixedBody(),n=Gz.instance.BT_TRANSFORM_0,r=Gz.instance.BT_TRANSFORM_1;this._impl=Sa.HingeConstraint_new(e,i,n,r),this.updateFrames()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=qz,n=Qz,r=Gz.instance.BT_TRANSFORM_0;ji.multiply(i,e.worldScale,t.pivotA),$z(Sa.Transform_getOrigin(r),i);var s=Gz.instance.BT_QUAT_0;Ji.rotationTo(n,ji.UNIT_Z,t.axis),eX(s,n),Sa.Transform_setRotation(r,s);var a=Gz.instance.BT_TRANSFORM_1,o=this.constraint.connectedBody;o?ji.multiply(i,o.node.worldScale,t.pivotB):(ji.multiply(i,e.worldScale,t.pivotA),ji.add(i,i,e.worldPosition),ji.add(i,i,t.pivotB),Ji.multiply(n,n,e.worldRotation)),$z(Sa.Transform_getOrigin(a),i),eX(s,n),Sa.Transform_setRotation(a,s),Sa.HingeConstraint_setFrames(this._impl,r,a)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},Pi(e,[{key:"constraint",get:function(){return this._com}}]),e}(wK);qr.once(Zr.EVENT_PRE_SUBSYSTEM_INIT,(function(){wz.register("bullet",{PhysicsWorld:hK,RigidBody:Kj,BoxShape:lK,SphereShape:uK,CapsuleShape:cK,TrimeshShape:EK,CylinderShape:AK,ConeShape:CK,TerrainShape:RK,SimplexShape:bK,PlaneShape:xK,PointToPointConstraint:MK,HingeConstraint:BK,FixedConstraint:IK})})),function(t){t[t.BOX=0]="BOX",t[t.SPHERE=1]="SPHERE",t[t.CYLINDER=2]="CYLINDER",t[t.CONE=3]="CONE",t[t.CAPSULE=4]="CAPSULE",t[t.TORUS=5]="TORUS",t[t.PLANE=6]="PLANE",t[t.QUAD=7]="QUAD"}(SK||(SK={})),Fn(SK);var PK=t("Primitive",(_K=Ki("cc.Primitive"),fK=Tn(SK),_K((TK=yK=function(t){function e(e){var i;return void 0===e&&(e=SK.BOX),(i=t.call(this)||this).type=mK&&mK(),i.info=vK&&vK(),i.type=e,i}return He(e,t),e.prototype.onLoaded=function(){Ro(cW[SK[this.type].toLowerCase()](this.info),this)},e}(mo),yK.PrimitiveType=SK,mK=tn((gK=TK).prototype,"type",[fK],(function(){return SK.BOX})),vK=tn(gK.prototype,"info",[en],(function(){return{}})),pK=gK))||pK));We.Primitive=PK,We.primitives=cW;var DK,OK=function(){function t(t,e,i){this._opts=void 0,this._total=0,this._value=0,this._averageValue=0,this._accumValue=0,this._accumSamples=0,this._id=t,this._opts=e,this._accumStart=i}var e=t.prototype;return e.sample=function(t){this._average(this._value,t)},e.human=function(){var t=this._opts,e=t.average,i=t.isInteger,n=e?this._averageValue:this._value;return i?Math.round(n):Math.round(100*n)/100},e.alarm=function(){return this._opts.below&&this._valuethis._opts.over},e._average=function(t,e){if(void 0===e&&(e=0),this._opts.average){this._accumValue+=t,++this._accumSamples;var i=e;i-this._accumStart>=this._opts.average&&(this._averageValue=this._accumValue/this._accumSamples,this._accumValue=0,this._accumStart=i,this._accumSamples=0)}},Pi(t,[{key:"value",get:function(){return this._value},set:function(t){this._value=t}}]),t}(),FK=Ki("cc.PerfCounter")(DK=function(t){function e(e,i,n){var r;return(r=t.call(this,e,i,n)||this)._time=n,r}He(e,t);var i=e.prototype;return i.start=function(t){void 0===t&&(t=0),this._time=t},i.end=function(t){void 0===t&&(t=0),this._value=t-this._time,this._average(this._value)},i.tick=function(){this.end(),this.start()},i.frame=function(t){var e=t,i=e-this._time;this._total++,i>(this._opts.average||1e3)&&(this._value=1e3*this._total/i,this._total=0,this._time=e,this._average(this._value))},e}(OK))||DK,LK="0123456789. ",NK=500,kK={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},UK={fps:{desc:"Framerate (FPS)",below:30,average:NK,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:NK},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:NK,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:NK},render:{desc:"Renderer (ms)",min:0,max:50,average:NK,color:"#f90"},present:{desc:"Present (ms)",min:0,max:50,average:NK,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},GK=t("Profiler",function(t){function e(){var e;return(e=t.call(this)||this)._stats=null,e._showFPS=!1,e._rootNode=null,e._device=null,e._swapchain=null,e._meshRenderer=null,e._canvas=null,e._ctx=null,e._texture=null,e._region=new ht,e._canvasArr=[],e._regionArr=[e._region],e.digitsData=null,e.offsetData=null,e.pass=null,e._canvasDone=!1,e._statsDone=!1,e._inited=!1,e._lineHeight=280/(Object.keys(UK).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=ln.document.createElement("canvas"),e._ctx=e._canvas.getContext("2d"),e._canvasArr.push(e._canvas),e}He(e,t);var i=e.prototype;return i.init=function(){Tr.querySettings(Sr.Category.PROFILING,"showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),We.director.off(We.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),We.director.off(We.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),We.director.off(We.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),We.director.off(We.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),We.director.off(We.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),We.director.off(We.Director.EVENT_AFTER_RENDER,this.afterRender,this),We.director.off(We.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!1,Di.root.pipeline.profiler=null,We.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=We.director.root;this._device=ke.gfxDevice,this._swapchain=t.mainWindow.swapchain}this.generateCanvas(),this.generateStats(),We.game.once(We.Game.EVENT_ENGINE_INITED,this.generateNode,this),We.game.on(We.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),We.director.on(We.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),We.director.on(We.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),We.director.on(We.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),We.director.on(We.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),We.director.on(We.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),We.director.on(We.Director.EVENT_AFTER_RENDER,this.afterRender,this),We.director.on(We.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,We.game.config.showFPS=!0}},i.generateCanvas=function(){if(!this._canvasDone){this._ctx&&this._canvas&&(this._canvas.width=280,this._canvas.height=280,this._canvas.style.width=""+this._canvas.width,this._canvas.style.height=""+this._canvas.height,this._ctx.font="23px Arial",this._ctx.textBaseline="top",this._ctx.fillStyle="#fff",this._texture=this._device.createTexture(new yt(T.TEX2D,S.SAMPLED|S.TRANSFER_DST,_.RGBA8,280,280)),this._region.texExtent.width=280,this._region.texExtent.height=280)}},i.generateStats=function(){if(!this._statsDone&&this._ctx&&this._canvas){this._stats=null;var t=performance.now();this._ctx.textAlign="left";var e=0;for(var i in UK){var n=UK[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new FK(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r=0;o--){var h=8*i+o,l=a[a.length-(8-o)],u=kK[l];void 0===u&&(u=11),n[h]=u}i++}}}},e}(Oi)),VK=t("profiler",new GK);Di.registerSystem("profiler",VK,0),We.profiler=VK;var HK,zK,XK,WK=(HK=function(t,e){return(HK=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}HK(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),YK=void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:window;!function(t){var e,i,n,r=function(){function t(t,e,i){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(var n=0;n0&&(e%=this.duration));for(var h=this.timelines,l=0,u=h.length;l>>1;;){if(t[(s+1)*i]<=e?n=s+1:r=s,n==r)return(n+1)*i;s=n+r>>>1}},t.linearSearch=function(t,e,i){for(var n=0,r=t.length-i;n<=r;n+=i)if(t[n]>e)return n;return-1},t}();t.Animation=r,function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(e=t.MixBlend||(t.MixBlend={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(i=t.MixDirection||(t.MixDirection={})),function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"}(n=t.TimelineType||(t.TimelineType={}));var s=function(){function e(i){if(i<=0)throw new Error("frameCount must be > 0: "+i);this.curves=t.Utils.newFloatArray((i-1)*e.BEZIER_SIZE)}return e.prototype.getFrameCount=function(){return this.curves.length/e.BEZIER_SIZE+1},e.prototype.setLinear=function(t){this.curves[t*e.BEZIER_SIZE]=e.LINEAR},e.prototype.setStepped=function(t){this.curves[t*e.BEZIER_SIZE]=e.STEPPED},e.prototype.getCurveType=function(t){var i=t*e.BEZIER_SIZE;if(i==this.curves.length)return e.LINEAR;var n=this.curves[i];return n==e.LINEAR?e.LINEAR:n==e.STEPPED?e.STEPPED:e.BEZIER},e.prototype.setCurve=function(t,i,n,r,s){var a=.03*(2*-i+r),o=.03*(2*-n+s),h=.006*(3*(i-r)+1),l=.006*(3*(n-s)+1),u=2*a+h,c=2*o+l,d=.3*i+a+.16666667*h,_=.3*n+o+.16666667*l,f=t*e.BEZIER_SIZE,p=this.curves;p[f++]=e.BEZIER;for(var g=d,m=_,v=f+e.BEZIER_SIZE-1;f=n){var u=void 0,c=void 0;return s==h?(u=0,c=0):(u=r[s-2],c=r[s-1]),c+(r[s+1]-c)*(n-u)/(o-u)}var d=r[s-1];return d+(1-d)*(n-o)/(1-o)},e.LINEAR=0,e.STEPPED=1,e.BEZIER=2,e.BEZIER_SIZE=19,e}();t.CurveTimeline=s;var a=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e<<1),n}return WK(s,i),s.prototype.getPropertyId=function(){return(n.rotate<<24)+this.boneIndex},s.prototype.setFrame=function(t,e,i){t<<=1,this.frames[t]=e,this.frames[t+s.ROTATION]=i},s.prototype.apply=function(t,i,n,a,o,h){var l=this.frames,u=t.bones[this.boneIndex];if(u.active)if(n=l[l.length-s.ENTRIES]){var d=l[l.length+s.PREV_ROTATION];switch(h){case e.setup:u.rotation=u.data.rotation+d*o;break;case e.first:case e.replace:d+=u.data.rotation-u.rotation,d-=360*(16384-(16384.499999999996-d/360|0));case e.add:u.rotation+=d*o}}else{var _=r.binarySearch(l,n,s.ENTRIES),f=l[_+s.PREV_ROTATION],p=l[_],g=this.getCurvePercent((_>>1)-1,1-(n-p)/(l[_+s.PREV_TIME]-p)),m=l[_+s.ROTATION]-f;switch(m=f+(m-360*(16384-(16384.499999999996-m/360|0)))*g,h){case e.setup:u.rotation=u.data.rotation+(m-360*(16384-(16384.499999999996-m/360|0)))*o;break;case e.first:case e.replace:m+=u.data.rotation-u.rotation;case e.add:u.rotation+=(m-360*(16384-(16384.499999999996-m/360|0)))*o}}},s.ENTRIES=2,s.PREV_TIME=-2,s.PREV_ROTATION=-1,s.ROTATION=1,s}(s);t.RotateTimeline=a;var o=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return WK(s,i),s.prototype.getPropertyId=function(){return(n.translate<<24)+this.boneIndex},s.prototype.setFrame=function(t,e,i,n){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.X]=i,this.frames[t+s.Y]=n},s.prototype.apply=function(t,i,n,a,o,h){var l=this.frames,u=t.bones[this.boneIndex];if(u.active)if(n=l[l.length-s.ENTRIES])c=l[l.length+s.PREV_X],d=l[l.length+s.PREV_Y];else{var _=r.binarySearch(l,n,s.ENTRIES);c=l[_+s.PREV_X],d=l[_+s.PREV_Y];var f=l[_],p=this.getCurvePercent(_/s.ENTRIES-1,1-(n-f)/(l[_+s.PREV_TIME]-f));c+=(l[_+s.X]-c)*p,d+=(l[_+s.Y]-d)*p}switch(h){case e.setup:u.x=u.data.x+c*o,u.y=u.data.y+d*o;break;case e.first:case e.replace:u.x+=(u.data.x+c-u.x)*o,u.y+=(u.data.y+d-u.y)*o;break;case e.add:u.x+=c*o,u.y+=d*o}}},s.ENTRIES=3,s.PREV_TIME=-3,s.PREV_X=-2,s.PREV_Y=-1,s.X=1,s.Y=2,s}(s);t.TranslateTimeline=o;var h=function(s){function a(t){return s.call(this,t)||this}return WK(a,s),a.prototype.getPropertyId=function(){return(n.scale<<24)+this.boneIndex},a.prototype.apply=function(n,s,o,h,l,u,c){var d=this.frames,_=n.bones[this.boneIndex];if(_.active)if(o=d[d.length-a.ENTRIES])f=d[d.length+a.PREV_X]*_.data.scaleX,p=d[d.length+a.PREV_Y]*_.data.scaleY;else{var g=r.binarySearch(d,o,a.ENTRIES);f=d[g+a.PREV_X],p=d[g+a.PREV_Y];var m=d[g],v=this.getCurvePercent(g/a.ENTRIES-1,1-(o-m)/(d[g+a.PREV_TIME]-m));f=(f+(d[g+a.X]-f)*v)*_.data.scaleX,p=(p+(d[g+a.Y]-p)*v)*_.data.scaleY}if(1==l)u==e.add?(_.scaleX+=f-_.data.scaleX,_.scaleY+=p-_.data.scaleY):(_.scaleX=f,_.scaleY=p);else{var y=0,T=0;if(c==i.mixOut)switch(u){case e.setup:y=_.data.scaleX,T=_.data.scaleY,_.scaleX=y+(Math.abs(f)*t.MathUtils.signum(y)-y)*l,_.scaleY=T+(Math.abs(p)*t.MathUtils.signum(T)-T)*l;break;case e.first:case e.replace:y=_.scaleX,T=_.scaleY,_.scaleX=y+(Math.abs(f)*t.MathUtils.signum(y)-y)*l,_.scaleY=T+(Math.abs(p)*t.MathUtils.signum(T)-T)*l;break;case e.add:y=_.scaleX,T=_.scaleY,_.scaleX=y+(Math.abs(f)*t.MathUtils.signum(y)-_.data.scaleX)*l,_.scaleY=T+(Math.abs(p)*t.MathUtils.signum(T)-_.data.scaleY)*l}else switch(u){case e.setup:y=Math.abs(_.data.scaleX)*t.MathUtils.signum(f),T=Math.abs(_.data.scaleY)*t.MathUtils.signum(p),_.scaleX=y+(f-y)*l,_.scaleY=T+(p-T)*l;break;case e.first:case e.replace:y=Math.abs(_.scaleX)*t.MathUtils.signum(f),T=Math.abs(_.scaleY)*t.MathUtils.signum(p),_.scaleX=y+(f-y)*l,_.scaleY=T+(p-T)*l;break;case e.add:y=t.MathUtils.signum(f),T=t.MathUtils.signum(p),_.scaleX=Math.abs(_.scaleX)*y+(f-Math.abs(_.data.scaleX)*y)*l,_.scaleY=Math.abs(_.scaleY)*T+(p-Math.abs(_.data.scaleY)*T)*l}}}},a}(o);t.ScaleTimeline=h;var l=function(t){function i(e){return t.call(this,e)||this}return WK(i,t),i.prototype.getPropertyId=function(){return(n.shear<<24)+this.boneIndex},i.prototype.apply=function(t,n,s,a,o,h){var l=this.frames,u=t.bones[this.boneIndex];if(u.active)if(s=l[l.length-i.ENTRIES])c=l[l.length+i.PREV_X],d=l[l.length+i.PREV_Y];else{var _=r.binarySearch(l,s,i.ENTRIES);c=l[_+i.PREV_X],d=l[_+i.PREV_Y];var f=l[_],p=this.getCurvePercent(_/i.ENTRIES-1,1-(s-f)/(l[_+i.PREV_TIME]-f));c+=(l[_+i.X]-c)*p,d+=(l[_+i.Y]-d)*p}switch(h){case e.setup:u.shearX=u.data.shearX+c*o,u.shearY=u.data.shearY+d*o;break;case e.first:case e.replace:u.shearX+=(u.data.shearX+c-u.shearX)*o,u.shearY+=(u.data.shearY+d-u.shearY)*o;break;case e.add:u.shearX+=c*o,u.shearY+=d*o}}},i}(o);t.ShearTimeline=l;var u=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return WK(s,i),s.prototype.getPropertyId=function(){return(n.color<<24)+this.slotIndex},s.prototype.setFrame=function(t,e,i,n,r,a){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.R]=i,this.frames[t+s.G]=n,this.frames[t+s.B]=r,this.frames[t+s.A]=a},s.prototype.apply=function(t,i,n,a,o,h){var l=t.slots[this.slotIndex];if(l.bone.active){var u=this.frames;if(n=u[u.length-s.ENTRIES]){var m=u.length;_=u[m+s.PREV_R],f=u[m+s.PREV_G],p=u[m+s.PREV_B],g=u[m+s.PREV_A]}else{var v=r.binarySearch(u,n,s.ENTRIES);_=u[v+s.PREV_R],f=u[v+s.PREV_G],p=u[v+s.PREV_B],g=u[v+s.PREV_A];var y=u[v],T=this.getCurvePercent(v/s.ENTRIES-1,1-(n-y)/(u[v+s.PREV_TIME]-y));_+=(u[v+s.R]-_)*T,f+=(u[v+s.G]-f)*T,p+=(u[v+s.B]-p)*T,g+=(u[v+s.A]-g)*T}1==o?l.color.set(_,f,p,g):(c=l.color,h==e.setup&&c.setFromColor(l.data.color),c.add((_-c.r)*o,(f-c.g)*o,(p-c.b)*o,(g-c.a)*o))}}},s.ENTRIES=5,s.PREV_TIME=-5,s.PREV_R=-4,s.PREV_G=-3,s.PREV_B=-2,s.PREV_A=-1,s.R=1,s.G=2,s.B=3,s.A=4,s}(s);t.ColorTimeline=u;var c=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return WK(s,i),s.prototype.getPropertyId=function(){return(n.twoColor<<24)+this.slotIndex},s.prototype.setFrame=function(t,e,i,n,r,a,o,h,l){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.R]=i,this.frames[t+s.G]=n,this.frames[t+s.B]=r,this.frames[t+s.A]=a,this.frames[t+s.R2]=o,this.frames[t+s.G2]=h,this.frames[t+s.B2]=l},s.prototype.apply=function(t,i,n,a,o,h){var l=t.slots[this.slotIndex];if(l.bone.active){var u=this.frames;if(n=u[u.length-s.ENTRIES]){var E=u.length;p=u[E+s.PREV_R],g=u[E+s.PREV_G],m=u[E+s.PREV_B],v=u[E+s.PREV_A],y=u[E+s.PREV_R2],T=u[E+s.PREV_G2],S=u[E+s.PREV_B2]}else{var A=r.binarySearch(u,n,s.ENTRIES);p=u[A+s.PREV_R],g=u[A+s.PREV_G],m=u[A+s.PREV_B],v=u[A+s.PREV_A],y=u[A+s.PREV_R2],T=u[A+s.PREV_G2],S=u[A+s.PREV_B2];var C=u[A],R=this.getCurvePercent(A/s.ENTRIES-1,1-(n-C)/(u[A+s.PREV_TIME]-C));p+=(u[A+s.R]-p)*R,g+=(u[A+s.G]-g)*R,m+=(u[A+s.B]-m)*R,v+=(u[A+s.A]-v)*R,y+=(u[A+s.R2]-y)*R,T+=(u[A+s.G2]-T)*R,S+=(u[A+s.B2]-S)*R}1==o?(l.color.set(p,g,m,v),l.darkColor.set(y,T,S,1)):(c=l.color,d=l.darkColor,h==e.setup&&(c.setFromColor(l.data.color),d.setFromColor(l.data.darkColor)),c.add((p-c.r)*o,(g-c.g)*o,(m-c.b)*o,(v-c.a)*o),d.add((y-d.r)*o,(T-d.g)*o,(S-d.b)*o,0))}}},s.ENTRIES=8,s.PREV_TIME=-8,s.PREV_R=-7,s.PREV_G=-6,s.PREV_B=-5,s.PREV_A=-4,s.PREV_R2=-3,s.PREV_G2=-2,s.PREV_B2=-1,s.R=1,s.G=2,s.B=3,s.A=4,s.R2=5,s.G2=6,s.B2=7,s}(s);t.TwoColorTimeline=c;var d=function(){function s(e){this.frames=t.Utils.newFloatArray(e),this.attachmentNames=new Array(e)}return s.prototype.getPropertyId=function(){return(n.attachment<<24)+this.slotIndex},s.prototype.getFrameCount=function(){return this.frames.length},s.prototype.setFrame=function(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i},s.prototype.apply=function(t,n,s,a,o,h,l){var u=t.slots[this.slotIndex];if(u.bone.active)if(l!=i.mixOut||h!=e.setup){var c=this.frames;if(s=c[c.length-1]?c.length-1:r.binarySearch(c,s,1)-1;var f=this.attachmentNames[_];t.slots[this.slotIndex].setAttachment(null==f?null:t.getAttachment(this.slotIndex,f))}}else{var p=u.data.attachmentName;u.setAttachment(null==p?null:t.getAttachment(this.slotIndex,p))}},s}();t.AttachmentTimeline=d;var _=null,f=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e),n.frameVertices=new Array(e),null==_&&(_=t.Utils.newFloatArray(64)),n}return WK(s,i),s.prototype.getPropertyId=function(){return(n.deform<<27)+ +this.attachment.id+this.slotIndex},s.prototype.setFrame=function(t,e,i){this.frames[t]=e,this.frameVertices[t]=i},s.prototype.apply=function(i,n,s,a,o,h){var l=i.slots[this.slotIndex];if(l.bone.active){var u=l.getAttachment();if(u instanceof t.VertexAttachment&&u.deformAttachment==this.attachment){var c=l.deform;0==c.length&&(h=e.setup);var d=this.frameVertices,_=d[0].length,f=this.frames;if(s=f[f.length-1]){var T=d[f.length-1];if(1==o)if(h==e.add)if(null==(p=u).bones){m=p.vertices;for(var S=0;S<_;S++)y[S]+=T[S]-m[S]}else for(var E=0;E<_;E++)y[E]+=T[E];else t.Utils.arrayCopy(T,0,y,0,_);else switch(h){case e.setup:var A=u;if(null==A.bones){m=A.vertices;for(var C=0;C<_;C++){var R=m[C];y[C]=R+(T[C]-R)*o}}else for(var b=0;b<_;b++)y[b]=T[b]*o;break;case e.first:case e.replace:for(var x=0;x<_;x++)y[x]+=(T[x]-y[x])*o;case e.add:if(null==(p=u).bones){m=p.vertices;for(var w=0;w<_;w++)y[w]+=(T[w]-m[w])*o}else for(var M=0;M<_;M++)y[M]+=T[M]*o}}else{var I=r.binarySearch(f,s),B=d[I-1],P=d[I],D=f[I],O=this.getCurvePercent(I-1,1-(s-D)/(f[I-1]-D));if(1==o)if(h==e.add)if(null==(p=u).bones){m=p.vertices;for(var F=0;F<_;F++){var L=B[F];y[F]+=L+(P[F]-L)*O-m[F]}}else for(var N=0;N<_;N++)L=B[N],y[N]+=L+(P[N]-L)*O;else for(var k=0;k<_;k++)L=B[k],y[k]=L+(P[k]-L)*O;else switch(h){case e.setup:var U=u;if(null==U.bones){m=U.vertices;for(var G=0;G<_;G++)L=B[G],R=m[G],y[G]=R+(L+(P[G]-L)*O-R)*o}else for(var V=0;V<_;V++)L=B[V],y[V]=(L+(P[V]-L)*O)*o;break;case e.first:case e.replace:for(var H=0;H<_;H++)L=B[H],y[H]+=(L+(P[H]-L)*O-y[H])*o;break;case e.add:if(null==(p=u).bones){m=p.vertices;for(var z=0;z<_;z++)L=B[z],y[z]+=(L+(P[z]-L)*O-m[z])*o}else for(var X=0;X<_;X++)L=B[X],y[X]+=(L+(P[X]-L)*O)*o}}}}}},s}(s);t.DeformTimeline=f;var p=function(){function e(e){this.frames=t.Utils.newFloatArray(e),this.events=new Array(e)}return e.prototype.getPropertyId=function(){return n.event<<24},e.prototype.getFrameCount=function(){return this.frames.length},e.prototype.setFrame=function(t,e){this.frames[t]=e.time,this.events[t]=e},e.prototype.apply=function(t,e,i,n,s,a,o){if(null!=n){var h=this.frames,l=this.frames.length;if(e>i)this.apply(t,e,Number.MAX_VALUE,n,s,a,o),e=-1;else if(e>=h[l-1])return;if(!(i0&&h[u-1]==c;)u--;for(;u=h[u];u++)n.push(this.events[u])}}},e}();t.EventTimeline=p;var g=function(){function s(e){this.frames=t.Utils.newFloatArray(e),this.drawOrders=new Array(e)}return s.prototype.getPropertyId=function(){return n.drawOrder<<24},s.prototype.getFrameCount=function(){return this.frames.length},s.prototype.setFrame=function(t,e,i){this.frames[t]=e,this.drawOrders[t]=i},s.prototype.apply=function(n,s,a,o,h,l,u){var c=n.drawOrder,d=n.slots;if(u!=i.mixOut||l!=e.setup){var _=this.frames;if(a<_[0])l!=e.setup&&l!=e.first||t.Utils.arrayCopy(n.slots,0,n.drawOrder,0,n.slots.length);else{var f;f=a>=_[_.length-1]?_.length-1:r.binarySearch(_,a)-1;var p=this.drawOrders[f];if(null==p)t.Utils.arrayCopy(d,0,c,0,d.length);else for(var g=0,m=p.length;g=c[c.length-a.ENTRIES])l==e.setup?(d.mix=d.data.mix+(c[c.length+a.PREV_MIX]-d.data.mix)*h,d.softness=d.data.softness+(c[c.length+a.PREV_SOFTNESS]-d.data.softness)*h,u==i.mixOut?(d.bendDirection=d.data.bendDirection,d.compress=d.data.compress,d.stretch=d.data.stretch):(d.bendDirection=c[c.length+a.PREV_BEND_DIRECTION],d.compress=0!=c[c.length+a.PREV_COMPRESS],d.stretch=0!=c[c.length+a.PREV_STRETCH])):(d.mix+=(c[c.length+a.PREV_MIX]-d.mix)*h,d.softness+=(c[c.length+a.PREV_SOFTNESS]-d.softness)*h,u==i.mixIn&&(d.bendDirection=c[c.length+a.PREV_BEND_DIRECTION],d.compress=0!=c[c.length+a.PREV_COMPRESS],d.stretch=0!=c[c.length+a.PREV_STRETCH]));else{var _=r.binarySearch(c,s,a.ENTRIES),f=c[_+a.PREV_MIX],p=c[_+a.PREV_SOFTNESS],g=c[_],m=this.getCurvePercent(_/a.ENTRIES-1,1-(s-g)/(c[_+a.PREV_TIME]-g));l==e.setup?(d.mix=d.data.mix+(f+(c[_+a.MIX]-f)*m-d.data.mix)*h,d.softness=d.data.softness+(p+(c[_+a.SOFTNESS]-p)*m-d.data.softness)*h,u==i.mixOut?(d.bendDirection=d.data.bendDirection,d.compress=d.data.compress,d.stretch=d.data.stretch):(d.bendDirection=c[_+a.PREV_BEND_DIRECTION],d.compress=0!=c[_+a.PREV_COMPRESS],d.stretch=0!=c[_+a.PREV_STRETCH])):(d.mix+=(f+(c[_+a.MIX]-f)*m-d.mix)*h,d.softness+=(p+(c[_+a.SOFTNESS]-p)*m-d.softness)*h,u==i.mixIn&&(d.bendDirection=c[_+a.PREV_BEND_DIRECTION],d.compress=0!=c[_+a.PREV_COMPRESS],d.stretch=0!=c[_+a.PREV_STRETCH]))}},a.ENTRIES=6,a.PREV_TIME=-6,a.PREV_MIX=-5,a.PREV_SOFTNESS=-4,a.PREV_BEND_DIRECTION=-3,a.PREV_COMPRESS=-2,a.PREV_STRETCH=-1,a.MIX=1,a.SOFTNESS=2,a.BEND_DIRECTION=3,a.COMPRESS=4,a.STRETCH=5,a}(s);t.IkConstraintTimeline=m;var v=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return WK(s,i),s.prototype.getPropertyId=function(){return(n.transformConstraint<<24)+this.transformConstraintIndex},s.prototype.setFrame=function(t,e,i,n,r,a){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.ROTATE]=i,this.frames[t+s.TRANSLATE]=n,this.frames[t+s.SCALE]=r,this.frames[t+s.SHEAR]=a},s.prototype.apply=function(t,i,n,a,o,h){var l=this.frames,u=t.transformConstraints[this.transformConstraintIndex];if(u.active)if(n=l[l.length-s.ENTRIES]){var g=l.length;d=l[g+s.PREV_ROTATE],_=l[g+s.PREV_TRANSLATE],f=l[g+s.PREV_SCALE],p=l[g+s.PREV_SHEAR]}else{var m=r.binarySearch(l,n,s.ENTRIES);d=l[m+s.PREV_ROTATE],_=l[m+s.PREV_TRANSLATE],f=l[m+s.PREV_SCALE],p=l[m+s.PREV_SHEAR];var v=l[m],y=this.getCurvePercent(m/s.ENTRIES-1,1-(n-v)/(l[m+s.PREV_TIME]-v));d+=(l[m+s.ROTATE]-d)*y,_+=(l[m+s.TRANSLATE]-_)*y,f+=(l[m+s.SCALE]-f)*y,p+=(l[m+s.SHEAR]-p)*y}h==e.setup?(c=u.data,u.rotateMix=c.rotateMix+(d-c.rotateMix)*o,u.translateMix=c.translateMix+(_-c.translateMix)*o,u.scaleMix=c.scaleMix+(f-c.scaleMix)*o,u.shearMix=c.shearMix+(p-c.shearMix)*o):(u.rotateMix+=(d-u.rotateMix)*o,u.translateMix+=(_-u.translateMix)*o,u.scaleMix+=(f-u.scaleMix)*o,u.shearMix+=(p-u.shearMix)*o)}},s.ENTRIES=5,s.PREV_TIME=-5,s.PREV_ROTATE=-4,s.PREV_TRANSLATE=-3,s.PREV_SCALE=-2,s.PREV_SHEAR=-1,s.ROTATE=1,s.TRANSLATE=2,s.SCALE=3,s.SHEAR=4,s}(s);t.TransformConstraintTimeline=v;var y=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return WK(s,i),s.prototype.getPropertyId=function(){return(n.pathConstraintPosition<<24)+this.pathConstraintIndex},s.prototype.setFrame=function(t,e,i){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.VALUE]=i},s.prototype.apply=function(t,i,n,a,o,h){var l=this.frames,u=t.pathConstraints[this.pathConstraintIndex];if(u.active)if(n=l[l.length-s.ENTRIES])c=l[l.length+s.PREV_VALUE];else{var d=r.binarySearch(l,n,s.ENTRIES);c=l[d+s.PREV_VALUE];var _=l[d],f=this.getCurvePercent(d/s.ENTRIES-1,1-(n-_)/(l[d+s.PREV_TIME]-_));c+=(l[d+s.VALUE]-c)*f}h==e.setup?u.position=u.data.position+(c-u.data.position)*o:u.position+=(c-u.position)*o}},s.ENTRIES=2,s.PREV_TIME=-2,s.PREV_VALUE=-1,s.VALUE=1,s}(s);t.PathConstraintPositionTimeline=y;var T=function(t){function i(e){return t.call(this,e)||this}return WK(i,t),i.prototype.getPropertyId=function(){return(n.pathConstraintSpacing<<24)+this.pathConstraintIndex},i.prototype.apply=function(t,n,s,a,o,h){var l=this.frames,u=t.pathConstraints[this.pathConstraintIndex];if(u.active)if(s=l[l.length-i.ENTRIES])c=l[l.length+i.PREV_VALUE];else{var d=r.binarySearch(l,s,i.ENTRIES);c=l[d+i.PREV_VALUE];var _=l[d],f=this.getCurvePercent(d/i.ENTRIES-1,1-(s-_)/(l[d+i.PREV_TIME]-_));c+=(l[d+i.VALUE]-c)*f}h==e.setup?u.spacing=u.data.spacing+(c-u.data.spacing)*o:u.spacing+=(c-u.spacing)*o}},i}(y);t.PathConstraintSpacingTimeline=T;var S=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return WK(s,i),s.prototype.getPropertyId=function(){return(n.pathConstraintMix<<24)+this.pathConstraintIndex},s.prototype.setFrame=function(t,e,i,n){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.ROTATE]=i,this.frames[t+s.TRANSLATE]=n},s.prototype.apply=function(t,i,n,a,o,h){var l=this.frames,u=t.pathConstraints[this.pathConstraintIndex];if(u.active)if(n=l[l.length-s.ENTRIES])c=l[l.length+s.PREV_ROTATE],d=l[l.length+s.PREV_TRANSLATE];else{var _=r.binarySearch(l,n,s.ENTRIES);c=l[_+s.PREV_ROTATE],d=l[_+s.PREV_TRANSLATE];var f=l[_],p=this.getCurvePercent(_/s.ENTRIES-1,1-(n-f)/(l[_+s.PREV_TIME]-f));c+=(l[_+s.ROTATE]-c)*p,d+=(l[_+s.TRANSLATE]-d)*p}h==e.setup?(u.rotateMix=u.data.rotateMix+(c-u.data.rotateMix)*o,u.translateMix=u.data.translateMix+(d-u.data.translateMix)*o):(u.rotateMix+=(c-u.rotateMix)*o,u.translateMix+=(d-u.translateMix)*o)}},s.ENTRIES=3,s.PREV_TIME=-3,s.PREV_ROTATE=-2,s.PREV_TRANSLATE=-1,s.ROTATE=1,s.TRANSLATE=2,s}(s);t.PathConstraintMixTimeline=S}(XK||(XK={})),function(t){var e=function(){function e(e){this.tracks=new Array,this.timeScale=1,this.events=new Array,this.listeners=new Array,this.queue=new r(this),this.propertyIDs=new t.IntSet,this.animationsChanged=!1,this.trackEntryPool=new t.Pool((function(){return new i})),this.data=e}return e.prototype.update=function(t){t*=this.timeScale;for(var e=this.tracks,i=0,n=e.length;i0){if(r.delay-=s,r.delay>0)continue;s=-r.delay,r.delay=0}var a=r.next;if(null!=a){var o=r.trackLast-a.delay;if(o>=0){for(a.delay=0,a.trackTime+=0==r.timeScale?0:(o/r.timeScale+t)*a.timeScale,r.trackTime+=s,this.setCurrent(i,a,!0);null!=a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&null==r.mixingFrom){e[i]=null,this.queue.end(r),this.disposeNext(r);continue}if(null!=r.mixingFrom&&this.updateMixingFrom(r,t)){var h=r.mixingFrom;for(r.mixingFrom=null,null!=h&&(h.mixingTo=null);null!=h;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=s}}this.queue.drain()},e.prototype.updateMixingFrom=function(t,e){var i=t.mixingFrom;if(null==i)return!0;var n=this.updateMixingFrom(i,e);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=i.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=i.mixingFrom,null!=i.mixingFrom&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),n):(i.trackTime+=e*i.timeScale,t.mixTime+=e,!1)},e.prototype.apply=function(i){if(null==i)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var n=this.events,r=this.tracks,s=!1,a=0,o=r.length;a0)){s=!0;var l=0==a?t.MixBlend.first:h.mixBlend,u=h.alpha;null!=h.mixingFrom?u*=this.applyMixingFrom(h,i,l):h.trackTime>=h.trackEnd&&null==h.next&&(u=0);var c=h.animationLast,d=h.getAnimationTime(),_=h.animation.timelines.length,f=h.animation.timelines;if(0==a&&1==u||l==t.MixBlend.add)for(var p=0;p<_;p++)t.Utils.webkit602BugfixHelper(u,l),f[p].apply(i,c,d,n,u,l,t.MixDirection.mixIn);else{var g=h.timelineMode,m=0==h.timelinesRotation.length;m&&t.Utils.setArraySize(h.timelinesRotation,_<<1,null);var v=h.timelinesRotation;for(p=0;p<_;p++){var y=f[p],T=(g[p]&e.NOT_LAST-1)==e.SUBSEQUENT?l:t.MixBlend.setup;y instanceof t.RotateTimeline?this.applyRotateTimeline(y,i,d,u,T,v,p<<1,m):(t.Utils.webkit602BugfixHelper(u,l),y.apply(i,c,d,n,u,T,t.MixDirection.mixIn))}}this.queueEvents(h,d),n.length=0,h.nextAnimationLast=d,h.nextTrackLast=h.trackTime}}return this.queue.drain(),s},e.prototype.applyMixingFrom=function(i,n,r){var s=i.mixingFrom;null!=s.mixingFrom&&this.applyMixingFrom(s,n,r);var a=0;0==i.mixDuration?(a=1,r==t.MixBlend.first&&(r=t.MixBlend.setup)):((a=i.mixTime/i.mixDuration)>1&&(a=1),r!=t.MixBlend.first&&(r=s.mixBlend));var o=a0&&this.queueEvents(s,c),this.events.length=0,s.nextAnimationLast=c,s.nextTrackLast=s.trackTime,a},e.prototype.applyRotateTimeline=function(e,i,n,r,s,a,o,h){if(h&&(a[o]=0),1!=r){var l=e,u=l.frames,c=i.bones[l.boneIndex];if(c.active){var d=0,_=0;if(n=u[u.length-t.RotateTimeline.ENTRIES])_=c.data.rotation+u[u.length+t.RotateTimeline.PREV_ROTATION];else{var f=t.Animation.binarySearch(u,n,t.RotateTimeline.ENTRIES),p=u[f+t.RotateTimeline.PREV_ROTATION],g=u[f],m=l.getCurvePercent((f>>1)-1,1-(n-g)/(u[f+t.RotateTimeline.PREV_TIME]-g));_=u[f+t.RotateTimeline.ROTATION]-p,_=p+(_-=360*(16384-(16384.499999999996-_/360|0)))*m+c.data.rotation,_-=360*(16384-(16384.499999999996-_/360|0))}var v=0,y=_-d;if(0==(y-=360*(16384-(16384.499999999996-y/360|0))))v=a[o];else{var T=0,S=0;h?(T=0,S=y):(T=a[o],S=a[o+1]);var E=y>0,A=T>=0;t.MathUtils.signum(S)!=t.MathUtils.signum(y)&&Math.abs(S)<=90&&(Math.abs(T)>180&&(T+=360*t.MathUtils.signum(T)),A=E),v=y+T-T%360,A!=E&&(v+=360*t.MathUtils.signum(T)),a[o]=v}a[o+1]=y,d+=v*r,c.rotation=d-360*(16384-(16384.499999999996-d/360|0))}}else e.apply(i,0,n,null,1,s,t.MixDirection.mixIn)},e.prototype.queueEvents=function(t,e){for(var i=t.animationStart,n=t.animationEnd,r=n-i,s=t.trackLast%r,a=this.events,o=0,h=a.length;on||this.queue.event(t,l)}for((t.loop?0==r||s>t.trackTime%r:e>=n&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var i=e;;){var n=i.mixingFrom;if(null==n)break;this.queue.end(n),i.mixingFrom=null,i.mixingTo=null,i=n}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.prototype.setCurrent=function(t,e,i){var n=this.expandToIndex(t);this.tracks[t]=e,null!=n&&(i&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,null!=n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)},e.prototype.setAnimation=function(t,e,i){var n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,i)},e.prototype.setAnimationWith=function(t,e,i){if(null==e)throw new Error("animation cannot be null.");var n=!0,r=this.expandToIndex(t);null!=r&&(-1==r.nextTrackLast?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,n=!1):this.disposeNext(r));var s=this.trackEntry(t,e,i,r);return this.setCurrent(t,s,n),this.queue.drain(),s},e.prototype.addAnimation=function(t,e,i,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,r,i,n)},e.prototype.addAnimationWith=function(t,e,i,n){if(null==e)throw new Error("animation cannot be null.");var r=this.expandToIndex(t);if(null!=r)for(;null!=r.next;)r=r.next;var s=this.trackEntry(t,e,i,r);if(null==r)this.setCurrent(t,s,!0),this.queue.drain();else if(r.next=s,n<=0){var a=r.animationEnd-r.animationStart;0!=a?(r.loop?n+=a*(1+(r.trackTime/a|0)):n+=Math.max(a,r.trackTime),n-=this.data.getMix(r.animation,e)):n=r.trackTime}return s.delay=n,s},e.prototype.setEmptyAnimation=function(t,i){var n=this.setAnimationWith(t,e.emptyAnimation,!1);return n.mixDuration=i,n.trackEnd=i,n},e.prototype.addEmptyAnimation=function(t,i,n){n<=0&&(n-=i);var r=this.addAnimationWith(t,e.emptyAnimation,!1,n);return r.mixDuration=i,r.trackEnd=i,r},e.prototype.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var i=0,n=this.tracks.length;i=0;e--)for(var n=this.tracks[e];null!=n;)this.computeNotLast(n),n=n.mixingFrom},e.prototype.computeHold=function(i){var n=i.mixingTo,r=i.animation.timelines,s=i.animation.timelines.length,a=t.Utils.setArraySize(i.timelineMode,s);i.timelineHoldMix.length=0;var o=t.Utils.setArraySize(i.timelineHoldMix,s),h=this.propertyIDs;if(null!=n&&n.holdPrevious)for(var l=0;l0){a[l]=e.HOLD_MIX,o[l]=d;continue t}break}a[l]=e.HOLD}else a[l]=e.SUBSEQUENT}},e.prototype.computeNotLast=function(i){for(var n=i.animation.timelines,r=i.animation.timelines.length,s=i.timelineMode,a=this.propertyIDs,o=0;o=this.tracks.length?null:this.tracks[t]},e.prototype.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.prototype.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.prototype.clearListeners=function(){this.listeners.length=0},e.prototype.clearListenerNotifications=function(){this.queue.clear()},e.emptyAnimation=new t.Animation("",[],0),e.SUBSEQUENT=0,e.FIRST=1,e.HOLD=2,e.HOLD_MIX=3,e.NOT_LAST=4,e}();t.AnimationState=e;var i=function(){function e(){this.mixBlend=t.MixBlend.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}return e.prototype.reset=function(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0},e.prototype.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.prototype.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.prototype.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0},e}();t.TrackEntry=i;var n,r=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}return t.prototype.start=function(t){this.objects.push(n.start),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.interrupt=function(t){this.objects.push(n.interrupt),this.objects.push(t)},t.prototype.end=function(t){this.objects.push(n.end),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.dispose=function(t){this.objects.push(n.dispose),this.objects.push(t)},t.prototype.complete=function(t){this.objects.push(n.complete),this.objects.push(t)},t.prototype.event=function(t,e){this.objects.push(n.event),this.objects.push(t),this.objects.push(e)},t.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,i=0;i=0?i.substring(0,i.lastIndexOf("/")):"";i=this.pathPrefix+i,this.toLoad++,e.downloadText(i,(function(e){var o={count:0},h=new Array;try{new t.TextureAtlas(e,(function(e){h.push(a+"/"+e);var i=new YK.Image;return i.width=16,i.height=16,new t.FakeTexture(i)}))}catch(t){var l=t;return s.errors[i]="Couldn't load texture atlas "+i+": "+l.message,r&&r(i,"Couldn't load texture atlas "+i+": "+l.message),s.toLoad--,void s.loaded++}for(var u=function(l){var u=!1;s.loadTexture(l,(function(l){if(o.count++,o.count==h.length)if(u)s.errors[i]="Couldn't load texture atlas page "+l+"} of atlas "+i,r&&r(i,"Couldn't load texture atlas page "+l+" of atlas "+i),s.toLoad--,s.loaded++;else try{var c=new t.TextureAtlas(e,(function(t){return s.get(a+"/"+t)}));s.assets[i]=c,n&&n(i,c),s.toLoad--,s.loaded++}catch(t){var d=t;s.errors[i]="Couldn't load texture atlas "+i+": "+d.message,r&&r(i,"Couldn't load texture atlas "+i+": "+d.message),s.toLoad--,s.loaded++}}),(function(t){u=!0,o.count++,o.count==h.length&&(s.errors[i]="Couldn't load texture atlas page "+t+"} of atlas "+i,r&&r(i,"Couldn't load texture atlas page "+t+" of atlas "+i),s.toLoad--,s.loaded++)}))},c=0,d=h;c0},e.prototype.getErrors=function(){return this.errors},e}();t.AssetManager=e}(XK||(XK={})),function(t){var e=function(){function e(t){this.atlas=t}return e.prototype.newRegionAttachment=function(e,i,n){var r=this.atlas.findRegion(n);if(null==r)return null;r.renderObject=r;var s=new t.RegionAttachment(i);return s.setRegion(r),s},e.prototype.newMeshAttachment=function(e,i,n){var r=this.atlas.findRegion(n);if(null==r)return null;r.renderObject=r;var s=new t.MeshAttachment(i);return s.region=r,s},e.prototype.newBoundingBoxAttachment=function(e,i){return new t.BoundingBoxAttachment(i)},e.prototype.newPathAttachment=function(e,i){return new t.PathAttachment(i)},e.prototype.newPointAttachment=function(e,i){return new t.PointAttachment(i)},e.prototype.newClippingAttachment=function(e,i){return new t.ClippingAttachment(i)},e}();t.AtlasAttachmentLoader=e}(XK||(XK={})),function(t){var e;(e=t.BlendMode||(t.BlendMode={}))[e.Normal=0]="Normal",e[e.Additive=1]="Additive",e[e.Multiply=2]="Multiply",e[e.Screen=3]="Screen"}(XK||(XK={})),function(t){var e=function(){function e(t,e,i){if(this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=i,this.setToSetupPose()}return e.prototype.isActive=function(){return this.active},e.prototype.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransformWith=function(e,i,n,r,s,a,o){this.ax=e,this.ay=i,this.arotation=n,this.ascaleX=r,this.ascaleY=s,this.ashearX=a,this.ashearY=o,this.appliedValid=!0;var h=this.parent;if(null==h){var l=this.skeleton,u=n+90+o,c=l.scaleX,d=l.scaleY;return this.a=t.MathUtils.cosDeg(n+a)*r*c,this.b=t.MathUtils.cosDeg(u)*s*c,this.c=t.MathUtils.sinDeg(n+a)*r*d,this.d=t.MathUtils.sinDeg(u)*s*d,this.worldX=e*c+l.x,void(this.worldY=i*d+l.y)}var _=h.a,f=h.b,p=h.c,g=h.d;switch(this.worldX=_*e+f*i+h.worldX,this.worldY=p*e+g*i+h.worldY,this.data.transformMode){case t.TransformMode.Normal:u=n+90+o;var m=t.MathUtils.cosDeg(n+a)*r,v=t.MathUtils.cosDeg(u)*s,y=t.MathUtils.sinDeg(n+a)*r,T=t.MathUtils.sinDeg(u)*s;return this.a=_*m+f*y,this.b=_*v+f*T,this.c=p*m+g*y,void(this.d=p*v+g*T);case t.TransformMode.OnlyTranslation:u=n+90+o,this.a=t.MathUtils.cosDeg(n+a)*r,this.b=t.MathUtils.cosDeg(u)*s,this.c=t.MathUtils.sinDeg(n+a)*r,this.d=t.MathUtils.sinDeg(u)*s;break;case t.TransformMode.NoRotationOrReflection:var S=0;(C=_*_+p*p)>1e-4?(f=p*(C=Math.abs(_*g-f*p)/C),g=_*C,S=Math.atan2(p,_)*t.MathUtils.radDeg):(_=0,p=0,S=90-Math.atan2(g,f)*t.MathUtils.radDeg);var E=n+a-S,A=n+o-S+90;m=t.MathUtils.cosDeg(E)*r,v=t.MathUtils.cosDeg(A)*s,y=t.MathUtils.sinDeg(E)*r,T=t.MathUtils.sinDeg(A)*s,this.a=_*m-f*y,this.b=_*v-f*T,this.c=p*m+g*y,this.d=p*v+g*T;break;case t.TransformMode.NoScale:case t.TransformMode.NoScaleOrReflection:var C,R=t.MathUtils.cosDeg(n),b=t.MathUtils.sinDeg(n),x=(_*R+f*b)/this.skeleton.scaleX,w=(p*R+g*b)/this.skeleton.scaleY;(C=Math.sqrt(x*x+w*w))>1e-5&&(C=1/C),x*=C,w*=C,C=Math.sqrt(x*x+w*w),this.data.transformMode==t.TransformMode.NoScale&&_*g-f*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(C=-C);var M=Math.PI/2+Math.atan2(w,x),I=Math.cos(M)*C,B=Math.sin(M)*C;m=t.MathUtils.cosDeg(a)*r,v=t.MathUtils.cosDeg(90+o)*s,y=t.MathUtils.sinDeg(a)*r,T=t.MathUtils.sinDeg(90+o)*s,this.a=x*m+I*y,this.b=x*v+I*T,this.c=w*m+B*y,this.d=w*v+B*T}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.prototype.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY},e.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*t.MathUtils.radDeg},e.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*t.MathUtils.radDeg},e.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var e=this.parent;if(null==e)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*t.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*t.MathUtils.radDeg);var i=e.a,n=e.b,r=e.c,s=e.d,a=1/(i*s-n*r),o=this.worldX-e.worldX,h=this.worldY-e.worldY;this.ax=o*s*a-h*n*a,this.ay=h*i*a-o*r*a;var l=a*s,u=a*i,c=a*n,d=a*r,_=l*this.a-c*this.c,f=l*this.b-c*this.d,p=u*this.c-d*this.a,g=u*this.d-d*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(_*_+p*p),this.ascaleX>1e-4){var m=_*g-f*p;this.ascaleY=m/this.ascaleX,this.ashearY=Math.atan2(_*f+p*g,m)*t.MathUtils.radDeg,this.arotation=Math.atan2(p,_)*t.MathUtils.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(f*f+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,f)*t.MathUtils.radDeg},e.prototype.worldToLocal=function(t){var e=this.a,i=this.b,n=this.c,r=this.d,s=1/(e*r-i*n),a=t.x-this.worldX,o=t.y-this.worldY;return t.x=a*r*s-o*i*s,t.y=o*e*s-a*n*s,t},e.prototype.localToWorld=function(t){var e=t.x,i=t.y;return t.x=e*this.a+i*this.b+this.worldX,t.y=e*this.c+i*this.d+this.worldY,t},e.prototype.worldToLocalRotation=function(e){var i=t.MathUtils.sinDeg(e),n=t.MathUtils.cosDeg(e);return Math.atan2(this.a*i-this.c*n,this.d*n-this.b*i)*t.MathUtils.radDeg+this.rotation-this.shearX},e.prototype.localToWorldRotation=function(e){e-=this.rotation-this.shearX;var i=t.MathUtils.sinDeg(e),n=t.MathUtils.cosDeg(e);return Math.atan2(n*this.c+i*this.d,n*this.a+i*this.b)*t.MathUtils.radDeg},e.prototype.rotateWorld=function(e){var i=this.a,n=this.b,r=this.c,s=this.d,a=t.MathUtils.cosDeg(e),o=t.MathUtils.sinDeg(e);this.a=a*i-o*r,this.b=a*n-o*s,this.c=o*i+a*r,this.d=o*n+a*s,this.appliedValid=!1},e}();t.Bone=e}(XK||(XK={})),function(t){var e;t.BoneData=function(i,n,r){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=e.Normal,this.skinRequired=!1,this.color=new t.Color,i<0)throw new Error("index must be >= 0.");if(null==n)throw new Error("name cannot be null.");this.index=i,this.name=n,this.parent=r},function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"}(e=t.TransformMode||(t.TransformMode={}))}(XK||(XK={})),function(t){t.ConstraintData=function(t,e,i){this.name=t,this.order=e,this.skinRequired=i}}(XK||(XK={})),function(t){t.Event=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e}}(XK||(XK={})),function(t){t.EventData=function(t){this.name=t}}(XK||(XK={})),function(t){var e=function(){function e(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var i=0;i180?f-=360:f<-180&&(f+=360);var p=e.ascaleX,g=e.ascaleY;if(r||s){var m=e.data.length*p,v=Math.sqrt(d*d+_*_);if(r&&vm&&m>1e-4){var y=(v/m-1)*o+1;p*=y,a&&(g*=y)}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*o,p,g,e.ashearX,e.ashearY)},e.prototype.apply2=function(e,i,n,r,s,a,o,h){if(0!=h){e.appliedValid||e.updateAppliedTransform(),i.appliedValid||i.updateAppliedTransform();var l=e.ax,u=e.ay,c=e.ascaleX,d=c,_=e.ascaleY,f=i.ascaleX,p=0,g=0,m=0;c<0?(c=-c,p=180,m=-1):(p=0,m=1),_<0&&(_=-_,m=-m),f<0?(f=-f,g=180):g=0;var v=i.ax,y=0,T=0,S=0,E=e.a,A=e.b,C=e.c,R=e.d,b=Math.abs(c-_)<=1e-4;b?(T=E*v+A*(y=i.ay)+e.worldX,S=C*v+R*y+e.worldY):(y=0,T=E*v+e.worldX,S=C*v+e.worldY);var x=e.parent;E=x.a,A=x.b,C=x.c;var w,M,I=1/(E*(R=x.d)-A*C),B=T-x.worldX,P=S-x.worldY,D=(B*R-P*A)*I-l,O=(P*E-B*C)*I-u,F=Math.sqrt(D*D+O*O),L=i.data.length*f;if(F<1e-4)return this.apply1(e,n,r,!1,a,!1,h),void i.updateWorldTransformWith(v,y,0,i.ascaleX,i.ascaleY,i.ashearX,i.ashearY);var N=((B=n-x.worldX)*R-(P=r-x.worldY)*A)*I-l,k=(P*E-B*C)*I-u,U=N*N+k*k;if(0!=o){o*=c*(f+1)/2;var G=Math.sqrt(U),V=G-F-L*c+o;if(V>0){var H=Math.min(1,V/(2*o))-1;U=(N-=(H=(V-o*(1-H*H))/G)*N)*N+(k-=H*k)*k}}t:if(b){var z=(U-F*F-(L*=c)*L)/(2*F*L);z<-1?z=-1:z>1&&(z=1,a&&(d*=(Math.sqrt(U)/(F+L)-1)*h+1)),M=Math.acos(z)*s,E=F+L*z,A=L*Math.sin(M),w=Math.atan2(k*E-N*A,N*E+k*A)}else{var X=(E=c*L)*E,W=(A=_*L)*A,Y=Math.atan2(k,N),j=-2*W*F,K=W-X;if((R=j*j-4*K*(C=W*F*F+X*U-X*W))>=0){var q=Math.sqrt(R);j<0&&(q=-q);var Z=(q=-(j+q)/2)/K,Q=C/q,J=Math.abs(Z)=-1&&C<=1&&(C=Math.acos(C),(R=(B=E*Math.cos(C)+F)*B+(P=A*Math.sin(C))*P)st&&(nt=C,st=R,rt=B,at=P)),U<=(et+st)/2?(w=Y-Math.atan2(it*s,tt),M=$*s):(w=Y-Math.atan2(at*s,rt),M=nt*s)}var ot=Math.atan2(y,v)*m,ht=e.arotation;(w=(w-ot)*t.MathUtils.radDeg+p-ht)>180?w-=360:w<-180&&(w+=360),e.updateWorldTransformWith(l,u,ht+w*h,d,e.ascaleY,0,0),ht=i.arotation,(M=((M+ot)*t.MathUtils.radDeg-i.ashearX)*m+g-ht)>180?M-=360:M<-180&&(M+=360),i.updateWorldTransformWith(v,y,ht+M*h,i.ascaleX,i.ascaleY,i.ashearX,i.ashearY)}else i.updateWorldTransform()},e}();t.IkConstraint=e}(XK||(XK={})),function(t){var e=function(t){function e(e){var i=t.call(this,e,0,!1)||this;return i.bones=new Array,i.bendDirection=1,i.compress=!1,i.stretch=!1,i.uniform=!1,i.mix=1,i.softness=0,i}return WK(e,t),e}(t.ConstraintData);t.IkConstraintData=e}(XK||(XK={})),function(t){var e=function(){function e(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var i=0,n=t.bones.length;i0;if(r>0||s){var a=this.data,o=a.spacingMode==t.SpacingMode.Percent,h=a.rotateMode,l=h==t.RotateMode.Tangent,u=h==t.RotateMode.ChainScale,c=this.bones.length,d=l?c:c+1,_=this.bones,f=t.Utils.setArraySize(this.spaces,d),p=null,g=this.spacing;if(u||!o){u&&(p=t.Utils.setArraySize(this.lengths,c));for(var m=a.spacingMode==t.SpacingMode.Length,v=0,y=d-1;v0?t.MathUtils.degRad:-t.MathUtils.degRad),v=0;for(var I=3;vt.MathUtils.PI?G-=t.MathUtils.PI2:G<-t.MathUtils.PI&&(G+=t.MathUtils.PI2),G*=n,V=Math.cos(G),H=Math.sin(G),B.a=V*L-H*k,B.b=V*N-H*U,B.c=H*L+V*k,B.d=H*N+V*U}B.appliedValid=!1}}}},e.prototype.computeWorldPositions=function(i,n,r,s,a){var o=this.target,h=this.position,l=this.spaces,u=t.Utils.setArraySize(this.positions,3*n+2),c=null,d=i.closed,_=i.worldVerticesLength,f=_/6,p=e.NONE;if(!i.constantSpeed){var g=i.lengths,m=g[f-=d?1:2];if(s&&(h*=m),a)for(var v=1;vm){p!=e.AFTER&&(p=e.AFTER,i.computeWorldVertices(o,_-6,4,c,0,2)),this.addAfterPosition(S-m,c,0,u,y);continue}}for(;;T++){var E=g[T];if(!(S>E)){0==T?S/=E:S=(S-(q=g[T-1]))/(E-q);break}}T!=p&&(p=T,d&&T==f?(i.computeWorldVertices(o,_-4,4,c,0,2),i.computeWorldVertices(o,0,4,c,4,2)):i.computeWorldVertices(o,6*T+2,8,c,0,2)),this.addCurvePosition(S,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],u,y,r||v>0&&0==W)}return u}d?(_+=2,c=t.Utils.setArraySize(this.world,_),i.computeWorldVertices(o,2,_-4,c,0,2),i.computeWorldVertices(o,0,2,c,_-4,2),c[_-2]=c[0],c[_-1]=c[1]):(f--,_-=4,c=t.Utils.setArraySize(this.world,_),i.computeWorldVertices(o,2,_,c,0,2));for(var A=t.Utils.setArraySize(this.curves,f),C=0,R=c[0],b=c[1],x=0,w=0,M=0,I=0,B=0,P=0,D=0,O=0,F=0,L=0,N=0,k=0,U=0,G=0,V=(v=0,2);vC){this.addAfterPosition(S-C,c,_-4,u,y);continue}}for(;;T++){var Y=A[T];if(!(S>Y)){0==T?S/=Y:S=(S-(q=A[T-1]))/(Y-q);break}}if(T!=p){p=T;var j=6*T;for(R=c[j],b=c[j+1],x=c[j+2],w=c[j+3],M=c[j+4],I=c[j+5],N=2*(D=.03*(R-2*x+M))+(F=.006*(3*(x-M)-R+(B=c[j+6]))),k=2*(O=.03*(b-2*w+I))+(L=.006*(3*(w-I)-b+(P=c[j+7]))),U=.3*(x-R)+D+.16666667*F,G=.3*(w-b)+O+.16666667*L,z=Math.sqrt(U*U+G*G),H[0]=z,j=1;j<8;j++)U+=N,G+=k,N+=F,k+=L,z+=Math.sqrt(U*U+G*G),H[j]=z;U+=N,G+=k,z+=Math.sqrt(U*U+G*G),H[8]=z,U+=N+F,G+=k+L,z+=Math.sqrt(U*U+G*G),H[9]=z,X=0}for(S*=z;;X++){var K=H[X];if(!(S>K)){var q;0==X?S/=K:S=X+(S-(q=H[X-1]))/(K-q);break}}this.addCurvePosition(.1*S,R,b,x,w,M,I,B,P,u,y,r||v>0&&0==W)}return u},e.prototype.addBeforePosition=function(t,e,i,n,r){var s=e[i],a=e[i+1],o=e[i+2]-s,h=e[i+3]-a,l=Math.atan2(h,o);n[r]=s+t*Math.cos(l),n[r+1]=a+t*Math.sin(l),n[r+2]=l},e.prototype.addAfterPosition=function(t,e,i,n,r){var s=e[i+2],a=e[i+3],o=s-e[i],h=a-e[i+1],l=Math.atan2(h,o);n[r]=s+t*Math.cos(l),n[r+1]=a+t*Math.sin(l),n[r+2]=l},e.prototype.addCurvePosition=function(t,e,i,n,r,s,a,o,h,l,u,c){if(0==t||isNaN(t))return l[u]=e,l[u+1]=i,void(l[u+2]=Math.atan2(r-i,n-e));var d=t*t,_=d*t,f=1-t,p=f*f,g=p*f,m=f*t,v=3*m,y=f*v,T=v*t,S=e*g+n*y+s*T+o*_,E=i*g+r*y+a*T+h*_;l[u]=S,l[u+1]=E,c&&(l[u+2]=t<.001?Math.atan2(r-i,n-e):Math.atan2(E-(i*p+r*m*2+a*d),S-(e*p+n*m*2+s*d)))},e.NONE=-1,e.BEFORE=-2,e.AFTER=-3,e.epsilon=1e-5,e}();t.PathConstraint=e}(XK||(XK={})),function(t){var e,i,n,r=function(t){function e(e){var i=t.call(this,e,0,!1)||this;return i.bones=new Array,i}return WK(e,t),e}(t.ConstraintData);t.PathConstraintData=r,(n=t.PositionMode||(t.PositionMode={}))[n.Fixed=0]="Fixed",n[n.Percent=1]="Percent",(i=t.SpacingMode||(t.SpacingMode={}))[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",(e=t.RotateMode||(t.RotateMode={}))[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale"}(XK||(XK={})),function(t){var e=function(){function t(t){this.toLoad=new Array,this.assets={},this.clientId=t}return t.prototype.loaded=function(){var t=0;for(var e in this.assets)t++;return t},t}(),i=function(){function t(t){void 0===t&&(t=""),this.clientAssets={},this.queuedAssets={},this.rawAssets={},this.errors={},this.pathPrefix=t}return t.prototype.queueAsset=function(t,i,n){var r=this.clientAssets[t];return null==r&&(r=new e(t),this.clientAssets[t]=r),null!==i&&(r.textureLoader=i),r.toLoad.push(n),this.queuedAssets[n]!==n&&(this.queuedAssets[n]=n,!0)},t.prototype.loadText=function(t,e){var i=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&(n.status>=200&&n.status<300?i.rawAssets[e]=n.responseText:i.errors[e]="Couldn't load text "+e+": status "+n.status+", "+n.responseText)},n.open("GET",e,!0),n.send()}},t.prototype.loadJson=function(t,e){var i=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&(n.status>=200&&n.status<300?i.rawAssets[e]=JSON.parse(n.responseText):i.errors[e]="Couldn't load text "+e+": status "+n.status+", "+n.responseText)},n.open("GET",e,!0),n.send()}},t.prototype.loadTexture=function(t,e,i){var n=this;if(i=this.pathPrefix+i,this.queueAsset(t,e,i)){var r=new YK.Image;r.src=i,r.crossOrigin="anonymous",r.onload=function(){n.rawAssets[i]=r},r.onerror=function(){n.errors[i]="Couldn't load image "+i}}},t.prototype.get=function(t,e){e=this.pathPrefix+e;var i=this.clientAssets[t];return null==i||i.assets[e]},t.prototype.updateClientAssets=function(t){for(var e=0;e0},t.prototype.getErrors=function(){return this.errors},t}();t.SharedAssetManager=i}(XK||(XK={})),function(t){var e=function(){function e(e){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(var i=0;i1){var s=n[n.length-1];this._updateCache.indexOf(s)>-1||this.updateCacheReset.push(s)}this._updateCache.push(e),this.sortReset(r.children),n[n.length-1].sorted=!0}},e.prototype.sortPathConstraint=function(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||null!=this.skin&&t.Utils.contains(this.skin.constraints,e.data,!0)),e.active){var i=e.target,n=i.data.index,r=i.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,n,r),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,r);for(var s=0,a=this.data.skins.length;s-1||this.updateCacheReset.push(s)}else for(r=0;r0){T=new t.DrawOrderTimeline(L);var N=r.slots.length;for(u=0;u=0;_--)U[_]=-1;var G=t.Utils.newArray(N-k,0),V=0,H=0;for(_=0;_=0;_--)-1==U[_]&&(U[_]=G[--H]);T.setFrame(u,v,U)}s.push(T),o=Math.max(o,T.frames[L-1])}var z=i.readInt(!0);if(z>0){for(T=new t.EventTimeline(z),u=0;u>>1^-(1&i)},t.prototype.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},t.prototype.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",i=0;i>4){case 12:case 13:e+=String.fromCharCode((31&n)<<6|63&this.readByte()),i+=2;break;case 14:e+=String.fromCharCode((15&n)<<12|(63&this.readByte())<<6|63&this.readByte()),i+=3;break;default:e+=String.fromCharCode(n),i++}}return e},t.prototype.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},t.prototype.readBoolean=function(){return 0!=this.readByte()},t}(),n=function(t,e,i,n,r){this.mesh=t,this.skin=e,this.slotIndex=i,this.parent=n,this.inheritDeform=r},r=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e}}(XK||(XK={})),function(t){var e=function(){function e(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new t.Pool((function(){return t.Utils.newFloatArray(16)}))}return e.prototype.update=function(e,i){if(null==e)throw new Error("skeleton cannot be null.");var n=this.boundingBoxes,r=this.polygons,s=this.polygonPool,a=e.slots,o=a.length;n.length=0,s.freeAll(r),r.length=0;for(var h=0;h=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},e.prototype.aabbIntersectsSegment=function(t,e,i,n){var r=this.minX,s=this.minY,a=this.maxX,o=this.maxY;if(t<=r&&i<=r||e<=s&&n<=s||t>=a&&i>=a||e>=o&&n>=o)return!1;var h=(n-e)/(i-t),l=h*(r-t)+e;if(l>s&&ls&&lr&&ur&&ut.minX&&this.minYt.minY},e.prototype.containsPoint=function(t,e){for(var i=this.polygons,n=0,r=i.length;n=i||l=i){var u=n[o];u+(i-h)/(l-h)*(n[s]-u)=u&&y<=_||y>=_&&y<=u)&&(y>=e&&y<=n||y>=n&&y<=e)){var T=(l*m-h*p)/v;if((T>=c&&T<=f||T>=f&&T<=c)&&(T>=i&&T<=r||T>=r&&T<=i))return!0}u=_,c=f}return!1},e.prototype.getPolygon=function(t){if(null==t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},e.prototype.getWidth=function(){return this.maxX-this.minX},e.prototype.getHeight=function(){return this.maxY-this.minY},e}();t.SkeletonBounds=e}(XK||(XK={})),function(t){var e=function(){function e(){this.triangulator=new t.Triangulator,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}return e.prototype.clipStart=function(i,n){if(null!=this.clipAttachment)return 0;this.clipAttachment=n;var r=n.worldVerticesLength,s=t.Utils.setArraySize(this.clippingPolygon,r);n.computeWorldVertices(i,0,r,s,0,2);var a=this.clippingPolygon;e.makeClockwise(a);for(var o=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a)),h=0,l=o.length;h>1,H=this.clipOutput,z=t.Utils.setArraySize(_,O+V*m),X=0;X=2?(u=o,o=this.scratch):u=this.scratch,u.length=0,u.push(t),u.push(e),u.push(i),u.push(n),u.push(r),u.push(s),u.push(t),u.push(e),o.length=0;for(var c=a,d=a.length-4,_=0;;_+=2){for(var f=c[_],p=c[_+1],g=c[_+2],m=c[_+3],v=f-g,y=p-m,T=u,S=u.length-2,E=o.length,A=0;A0;if(v*(R-m)-y*(C-g)>0){if(w){o.push(b),o.push(x);continue}var M=(B=x-R)*(g-f)-(P=b-C)*(m-p);if(Math.abs(M)>1e-6){var I=(P*(p-R)-B*(f-C))/M;o.push(f+(g-f)*I),o.push(p+(m-p)*I)}else o.push(f),o.push(p)}else if(w){var B,P;M=(B=x-R)*(g-f)-(P=b-C)*(m-p),Math.abs(M)>1e-6?(I=(P*(p-R)-B*(f-C))/M,o.push(f+(g-f)*I),o.push(p+(m-p)*I)):(o.push(f),o.push(p)),o.push(b),o.push(x)}l=!0}if(E==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),_==d)break;var D=o;(o=u).length=0,u=D}if(h!=o){h.length=0,_=0;for(var O=o.length-2;_>1;o=0;d--)-1==Y[d]&&(Y[d]=K[--Z])}T.setFrame(c++,this.getValue(W,"time",0),Y)}s.push(T),a=Math.max(a,T.frames[T.getFrameCount()-1])}if(e.events){for(T=new t.EventTimeline(e.events.length),c=0,d=0;d=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=i},i.prototype.addSkin=function(t){for(var e=0;e= 0.");if(null==i)throw new Error("name cannot be null.");if(null==n)throw new Error("boneData cannot be null.");this.index=e,this.name=i,this.boneData=n}}(XK||(XK={})),function(t){var e,i,n=function(){function t(t){this._image=t}return t.prototype.getImage=function(){return this._image},t.filterFromString=function(t){switch(t.toLowerCase()){case"nearest":return e.Nearest;case"linear":return e.Linear;case"mipmap":return e.MipMap;case"mipmapnearestnearest":return e.MipMapNearestNearest;case"mipmaplinearnearest":return e.MipMapLinearNearest;case"mipmapnearestlinear":return e.MipMapNearestLinear;case"mipmaplinearlinear":return e.MipMapLinearLinear;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return i.MirroredRepeat;case"clamptoedge":return i.ClampToEdge;case"repeat":return i.Repeat;default:throw new Error("Unknown texture wrap "+t)}},t}();t.Texture=n,function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"}(e=t.TextureFilter||(t.TextureFilter={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(i=t.TextureWrap||(t.TextureWrap={}));t.TextureRegion=function(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.rotate=!1,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0};var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return WK(e,t),e.prototype.setFilters=function(){},e.prototype.setWraps=function(){},e.prototype.dispose=function(){},e}(n);t.FakeTexture=r}(XK||(XK={})),function(t){var e=function(){function e(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}return e.prototype.load=function(e,s){if(null==s)throw new Error("textureLoader cannot be null.");for(var a=new i(e),o=new Array(4),h=null;;){var l=a.readLine();if(null==l)break;if(0==(l=l.trim()).length)h=null;else if(h){var u=new r;u.name=l,u.page=h;var c=a.readValue();"true"==c.toLocaleLowerCase()?u.degrees=90:"false"==c.toLocaleLowerCase()?u.degrees=0:u.degrees=parseFloat(c),u.rotate=90==u.degrees,a.readTuple(o);var d=parseInt(o[0]),_=parseInt(o[1]);a.readTuple(o);var f=parseInt(o[0]),p=parseInt(o[1]);u.u=d/h.width,u.v=_/h.height,u.rotate?(u.u2=(d+p)/h.width,u.v2=(_+f)/h.height):(u.u2=(d+f)/h.width,u.v2=(_+p)/h.height),u.x=d,u.y=_,u.width=Math.abs(f),u.height=Math.abs(p),4==a.readTuple(o)&&4==a.readTuple(o)&&a.readTuple(o),u.originalWidth=parseInt(o[0]),u.originalHeight=parseInt(o[1]),a.readTuple(o),u.offsetX=parseInt(o[0]),u.offsetY=parseInt(o[1]),u.index=parseInt(a.readValue()),u.texture=h.texture,this.regions.push(u)}else{(h=new n).name=l,2==a.readTuple(o)&&(h.width=parseInt(o[0]),h.height=parseInt(o[1]),a.readTuple(o)),a.readTuple(o),h.minFilter=t.Texture.filterFromString(o[0]),h.magFilter=t.Texture.filterFromString(o[1]);var g=a.readValue();h.uWrap=t.TextureWrap.ClampToEdge,h.vWrap=t.TextureWrap.ClampToEdge,"x"==g?h.uWrap=t.TextureWrap.Repeat:"y"==g?h.vWrap=t.TextureWrap.Repeat:"xy"==g&&(h.uWrap=h.vWrap=t.TextureWrap.Repeat),h.texture=s(l),h.texture.setFilters(h.minFilter,h.magFilter),h.texture.setWraps(h.uWrap,h.vWrap),h.width=h.texture.getImage().width,h.height=h.texture.getImage().height,this.pages.push(h)}}},e.prototype.findRegion=function(t){for(var e=0;e=this.lines.length?null:this.lines[this.index++]},t.prototype.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},t.prototype.readTuple=function(t){var e=this.readLine(),i=e.indexOf(":");if(-1==i)throw new Error("Invalid line: "+e);for(var n=0,r=i+1;n<3;n++){var s=e.indexOf(",",r);if(-1==s)break;t[n]=e.substr(r,s-r).trim(),r=s+1}return t[n]=e.substring(r).trim(),n+1},t}(),n=function(){};t.TextureAtlasPage=n;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return WK(e,t),e}(t.TextureRegion);t.TextureAtlasRegion=r}(XK||(XK={})),function(t){var e=function(){function e(e,i){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new t.Vector2,this.active=!1,null==e)throw new Error("data cannot be null.");if(null==i)throw new Error("skeleton cannot be null.");this.data=e,this.rotateMix=e.rotateMix,this.translateMix=e.translateMix,this.scaleMix=e.scaleMix,this.shearMix=e.shearMix,this.bones=new Array;for(var n=0;n0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*u,d=this.data.offsetShearY*u,_=this.bones,f=0,p=_.length;ft.MathUtils.PI?x-=t.MathUtils.PI2:x<-t.MathUtils.PI&&(x+=t.MathUtils.PI2),x*=e;var E=Math.cos(x),A=Math.sin(x);g.a=E*v-A*T,g.b=E*y-A*S,g.c=A*v+E*T,g.d=A*y+E*S,m=!0}if(0!=i){var C=this.temp;s.localToWorld(C.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(C.x-g.worldX)*i,g.worldY+=(C.y-g.worldY)*i,m=!0}if(n>0){var R=Math.sqrt(g.a*g.a+g.c*g.c),b=Math.sqrt(a*a+h*h);R>1e-5&&(R=(R+(b-R+this.data.offsetScaleX)*n)/R),g.a*=R,g.c*=R,R=Math.sqrt(g.b*g.b+g.d*g.d),b=Math.sqrt(o*o+l*l),R>1e-5&&(R=(R+(b-R+this.data.offsetScaleY)*n)/R),g.b*=R,g.d*=R,m=!0}if(r>0){y=g.b,S=g.d;var x,w=Math.atan2(S,y);(x=Math.atan2(l,o)-Math.atan2(h,a)-(w-Math.atan2(g.c,g.a)))>t.MathUtils.PI?x-=t.MathUtils.PI2:x<-t.MathUtils.PI&&(x+=t.MathUtils.PI2),x=w+(x+d)*r,R=Math.sqrt(y*y+S*S),g.b=Math.cos(x)*R,g.d=Math.sin(x)*R,m=!0}m&&(g.appliedValid=!1)}},e.prototype.applyRelativeWorld=function(){for(var e=this.rotateMix,i=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target,a=s.a,o=s.b,h=s.c,l=s.d,u=a*l-o*h>0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*u,d=this.data.offsetShearY*u,_=this.bones,f=0,p=_.length;ft.MathUtils.PI?g-=t.MathUtils.PI2:g<-t.MathUtils.PI&&(g+=t.MathUtils.PI2),g*=e;var A=Math.cos(g),C=Math.sin(g);m.a=A*y-C*S,m.b=A*T-C*E,m.c=C*y+A*S,m.d=C*T+A*E,v=!0}if(0!=i){var R=this.temp;s.localToWorld(R.set(this.data.offsetX,this.data.offsetY)),m.worldX+=R.x*i,m.worldY+=R.y*i,v=!0}if(n>0){var b=(Math.sqrt(a*a+h*h)-1+this.data.offsetScaleX)*n+1;m.a*=b,m.c*=b,b=(Math.sqrt(o*o+l*l)-1+this.data.offsetScaleY)*n+1,m.b*=b,m.d*=b,v=!0}if(r>0)(g=Math.atan2(l,o)-Math.atan2(h,a))>t.MathUtils.PI?g-=t.MathUtils.PI2:g<-t.MathUtils.PI&&(g+=t.MathUtils.PI2),T=m.b,E=m.d,g=Math.atan2(E,T)+(g-t.MathUtils.PI/2+d)*r,b=Math.sqrt(T*T+E*E),m.b=Math.cos(g)*b,m.d=Math.sin(g)*b,v=!0;v&&(m.appliedValid=!1)}},e.prototype.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,i=this.scaleMix,n=this.shearMix,r=this.target;r.appliedValid||r.updateAppliedTransform();for(var s=this.bones,a=0,o=s.length;a1e-5&&(_=(_+(r.ascaleX-_+this.data.offsetScaleX)*i)/_),f>1e-5&&(f=(f+(r.ascaleY-f+this.data.offsetScaleY)*i)/f));var p=h.ashearY;0!=n&&(u=r.ashearY-p+this.data.offsetShearY,u-=360*(16384-(16384.499999999996-u/360|0)),h.shearY+=u*n),h.updateWorldTransformWith(c,d,l,_,f,h.ashearX,p)}},e.prototype.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,i=this.scaleMix,n=this.shearMix,r=this.target;r.appliedValid||r.updateAppliedTransform();for(var s=this.bones,a=0,o=s.length;a1e-5&&(d*=(r.ascaleX-1+this.data.offsetScaleX)*i+1),_>1e-5&&(_*=(r.ascaleY-1+this.data.offsetScaleY)*i+1));var f=h.ashearY;0!=n&&(f+=(r.ashearY+this.data.offsetShearY)*n),h.updateWorldTransformWith(u,c,l,d,_,h.ashearX,f)}},e}();t.TransformConstraint=e}(XK||(XK={})),function(t){var e=function(t){function e(e){var i=t.call(this,e,0,!1)||this;return i.bones=new Array,i.rotateMix=0,i.translateMix=0,i.scaleMix=0,i.shearMix=0,i.offsetRotation=0,i.offsetX=0,i.offsetY=0,i.offsetScaleX=0,i.offsetScaleY=0,i.offsetShearY=0,i.relative=!1,i.local=!1,i}return WK(e,t),e}(t.ConstraintData);t.TransformConstraintData=e}(XK||(XK={})),function(t){var e=function(){function e(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new t.Pool((function(){return new Array})),this.polygonIndicesPool=new t.Pool((function(){return new Array}))}return e.prototype.triangulate=function(t){var i=t,n=t.length>>1,r=this.indicesArray;r.length=0;for(var s=0;s3;){for(var l=n-1,u=(s=0,1);;){t:if(!a[s]){for(var c=r[l]<<1,d=r[s]<<1,_=r[u]<<1,f=i[c],p=i[c+1],g=i[d],m=i[d+1],v=i[_],y=i[_+1],T=(u+1)%n;T!=l;T=(T+1)%n)if(a[T]){var S=r[T]<<1,E=i[S],A=i[S+1];if(e.positiveArea(v,y,f,p,E,A)&&e.positiveArea(f,p,g,m,E,A)&&e.positiveArea(g,m,v,y,E,A))break t}break}if(0==u){do{if(!a[s])break;s--}while(s>0);break}l=s,s=u,u=(u+1)%n}h.push(r[(n+s-1)%n]),h.push(r[s]),h.push(r[(s+1)%n]),r.splice(s,1),a.splice(s,1);var C=(--n+s-1)%n,R=s==n?0:s;a[C]=e.isConcave(C,n,i,r),a[R]=e.isConcave(R,n,i,r)}return 3==n&&(h.push(r[2]),h.push(r[0]),h.push(r[1])),h},e.prototype.decompose=function(t,i){var n=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;var s=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(s),s.length=0;var a=this.polygonIndicesPool.obtain();a.length=0;var o=this.polygonPool.obtain();o.length=0;for(var h=-1,l=0,u=0,c=i.length;u0?(r.push(o),s.push(a)):(this.polygonPool.free(o),this.polygonIndicesPool.free(a)),(o=this.polygonPool.obtain()).length=0,o.push(p),o.push(g),o.push(m),o.push(v),o.push(y),o.push(T),(a=this.polygonIndicesPool.obtain()).length=0,a.push(d),a.push(_),a.push(f),l=e.winding(p,g,m,v,y,T),h=d)}for(o.length>0&&(r.push(o),s.push(a)),u=0,c=r.length;u=0;u--)0==(o=r[u]).length&&(r.splice(u,1),this.polygonPool.free(o),a=s[u],s.splice(u,1),this.polygonIndicesPool.free(a));return r},e.isConcave=function(t,e,i,n){var r=n[(e+t-1)%e]<<1,s=n[t]<<1,a=n[(t+1)%e]<<1;return!this.positiveArea(i[r],i[r+1],i[s],i[s+1],i[a],i[a+1])},e.positiveArea=function(t,e,i,n,r,s){return t*(s-n)+i*(e-s)+r*(n-e)>=0},e.winding=function(t,e,i,n,r,s){var a=i-t,o=n-e;return r*o-s*a+a*e-t*o>=0?1:-1},e}();t.Triangulator=e}(XK||(XK={})),function(t){var e=function(){function t(){this.array=new Array}return t.prototype.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},t.prototype.contains=function(t){return null!=this.array[0|t]},t.prototype.remove=function(t){this.array[0|t]=void 0},t.prototype.clear=function(){this.array.length=0},t}();t.IntSet=e;var i=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.r=t,this.g=e,this.b=i,this.a=n}return t.prototype.set=function(t,e,i,n){return this.r=t,this.g=e,this.b=i,this.a=n,this.clamp(),this},t.prototype.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.setFromString=function(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=(8!=t.length?255:parseInt(t.substr(6,2),16))/255,this},t.prototype.add=function(t,e,i,n){return this.r+=t,this.g+=e,this.b+=i,this.a+=n,this.clamp(),this},t.prototype.clamp=function(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this},t.rgba8888ToColor=function(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t.WHITE=new t(1,1,1,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.MAGENTA=new t(1,0,1,1),t}();t.Color=i;var n=function(){function t(){}return t.clamp=function(t,e,i){return ti?i:t},t.cosDeg=function(e){return Math.cos(e*t.degRad)},t.sinDeg=function(e){return Math.sin(e*t.degRad)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,i){return t.randomTriangularWith(e,i,.5*(e+i))},t.randomTriangularWith=function(t,e,i){var n=Math.random(),r=e-t;return n<=(i-t)/r?t+Math.sqrt(n*r*(i-t)):e-Math.sqrt((1-n)*r*(e-i))},t.PI=3.1415927,t.PI2=2*t.PI,t.radiansToDegrees=180/t.PI,t.radDeg=t.radiansToDegrees,t.degreesToRadians=t.PI/180,t.degRad=t.degreesToRadians,t}();t.MathUtils=n;var r=function(){function t(){}return t.prototype.apply=function(t,e,i){return t+(e-t)*this.applyInternal(i)},t}();t.Interpolation=r;var s=function(t){function e(e){var i=t.call(this)||this;return i.power=2,i.power=e,i}return WK(e,t),e.prototype.applyInternal=function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1},e}(r);t.Pow=s;var a=function(t){function e(e){return t.call(this,e)||this}return WK(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e}(s);t.PowOut=a;var o=function(){function t(){}return t.arrayCopy=function(t,e,i,n,r){for(var s=e,a=n;s=i?e:t.setArraySize(e,i,n)},t.newArray=function(t,e){for(var i=new Array(t),n=0;n0?this.items.pop():this.instantiator()},t.prototype.free=function(t){t.reset&&t.reset(),this.items.push(t)},t.prototype.freeAll=function(t){for(var e=0;ethis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)},t}();t.TimeKeeper=c;var d=function(){function t(t){void 0===t&&(t=32),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}return t.prototype.hasEnoughData=function(){return this.addedValues>=this.values.length},t.prototype.addValue=function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0},t.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*s;var a=t.bone.skeleton,o=t.deform,h=this.vertices,l=this.bones;if(null!=l){for(var u=0,c=0,d=0;d0&&(h=o);for(var T,S=(T=t.bone).worldX,E=T.worldY,A=T.a,C=T.b,R=T.c,b=T.d,x=e,w=r;w>>0)+(mq.b<<16)+(mq.g<<8)+mq.r,JK=(vq.a<<24>>>0)+(vq.b<<16)+(vq.g<<8)+vq.r,_q!==QK||fq!==JK){var s=this._tempColors;_q=QK,fq=JK,dq>0&&(s[dq-1].vfOffset=aq),s[dq++]={fr:mq.r,fg:mq.g,fb:mq.b,fa:mq.a,dr:vq.r,dg:vq.g,db:vq.b,da:vq.a,vfOffset:0}}if(n.isClipping()){var a=nq.slice(sq,nq.length);n.clipTriangles(iq,pq,a,gq,iq,mq,vq,!0,6,aq,aq+2);var o=n.clippedVertices,h=n.clippedTriangles;gq=h.length,pq=o.length/12*6;for(var l=0,u=sq,c=h.length;l0&&(s[dq-1].vfOffset=aq),s.length=dq,a.length=rq;var o=cq-1;if(o>=0)if(uq>0){var h=r[o];h.indexCount=uq,h.vfCount=7*lq,h.vertexCount=lq,r.length=cq}else r.length=cq-1;if(0!==r.length){var l=n.vertices,u=aq/6,c=7*u;(!l||l.lengththis.maxVertexCount?u:this.maxVertexCount,this.maxIndexCount=p.length>this.maxIndexCount?p.length:this.maxIndexCount}},e.needToUpdate=function(t){return!this.isCompleted&&this.totalTime<30&&(void 0===t||this._frameIdx=0&&(uq>0?((c=f[u]).indexCount=uq,c.vertexCount=lq,c.vfCount=7*lq):cq--),f[cq]={tex:l,blendMode:d,indexCount:0,vertexCount:0,vfCount:0},cq++,uq=0,lq=0),o)a=yq,pq=24,gq=6,i.computeWorldVertices(_.bone,iq,aq,6);else if(h){var C=i;a=C.triangles,pq=6*(C.worldVerticesLength>>1),gq=a.length,C.computeWorldVertices(_,0,C.worldVerticesLength,iq,aq,6)}if(0!==pq&&0!==gq){for(var R=0,b=sq,x=a.length;R0){for(var B=sq,P=sq+gq;B0)&&this.textureNames&&this.textureNames.length>0)return t||console.error(this.name+" no textures found!"),null;var e=this._getAtlas(t);if(!e)return null;var i=new $K.AtlasAttachmentLoader(e),n=null,r=null;return this.skeletonJson?(r=new $K.SkeletonJson(i),n=this.skeletonJson):(r=new $K.SkeletonBinary(i),n=new Uint8Array(this._nativeAsset)),r.scale=this.scale,this._skeletonCache=r.readSkeletonData(n),e.dispose(),this._skeletonCache},i.getSkinsEnum=function(){if(this._skinsEnum)return this._skinsEnum;var t=this.getRuntimeData(!0);if(t){for(var e=t.skins,i={},n=0;n1)return this._animsEnum;var t=this.getRuntimeData(!0);if(t){for(var e={"":0},i=t.animations,n=0;n"]=0]=""}(mZ||(mZ={})),Fn(mZ),function(t){t[t.REALTIME=0]="REALTIME",t[t.SHARED_CACHE=1]="SHARED_CACHE",t[t.PRIVATE_CACHE=2]="PRIVATE_CACHE"}(vZ||(vZ={})),Fn(vZ),function(t){t[t.COLORED_TEXTURED=0]="COLORED_TEXTURED",t[t.TWO_COLORED=1]="TWO_COLORED"}(yZ||(yZ={}));var EZ=(kq=Ki("sp.Skeleton.SpineSocket"),Uq=Tn(Pr),kq((Vq=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=Hq&&Hq(),this.target=zq&&zq(),this.path=t,this.target=e},Hq=tn(Vq.prototype,"path",[en],(function(){return""})),zq=tn(Vq.prototype,"target",[Uq,en],(function(){return null})),Gq=Vq))||Gq);br(EZ,"sp.Skeleton.SpineSocket");var AZ=(Xq=Ki("sp.Skeleton"),Wq=Tn(Dn),Yq=Tn(Nq),jq=Tn(gZ),Kq=Tn(mZ),qq=Tn(vZ),Zq=Tn([EZ]),Xq((pZ=fZ=function(t){He(n,t);var e=n.prototype;function n(){var e;return(e=t.call(this)||this).loop=$q&&$q(),e._frameCache=null,e._curFrame=null,e._effectDelegate=null,e._skeleton=void 0,e._clipper=void 0,e._debugRenderer=void 0,e._startSlotIndex=void 0,e._endSlotIndex=void 0,e._startEntry=void 0,e._endEntry=void 0,e.attachUtil=void 0,e.maxVertexCount=0,e.maxIndexCount=0,e._materialCache={},e._enumSkins=fr({}),e._enumAnimations=fr({}),e._playTimes=0,e._timeScale=tZ&&tZ(),e._paused=!1,e._accTime=0,e._playCount=0,e._skeletonCache=null,e._animationName="",e._animationQueue=[],e._headAniInfo=null,e._isAniComplete=!0,e._needUpdateSkeltonData=!0,e._useTint=eZ&&eZ(),e._preCacheMode=iZ&&iZ(),e._cacheMode=nZ&&nZ(),e._defaultCacheMode=rZ&&rZ(),e._debugBones=sZ&&sZ(),e._debugSlots=aZ&&aZ(),e._skeletonData=oZ&&oZ(),e._premultipliedAlpha=hZ&&hZ(),e.defaultSkin=lZ&&lZ(),e.defaultAnimation=uZ&&uZ(),e._enableBatch=cZ&&cZ(),e._sockets=dZ&&dZ(),e._drawIdx=0,e._drawList=new i((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e._debugMesh=_Z&&_Z(),e._rootBone=void 0,e._state=void 0,e._listener=void 0,e._socketNodes=new Map,e._cachedSockets=new Map,e._drawInfoList=[],e._effectDelegate=null,e._skeleton=null,e._rootBone=null,e._listener=null,e._debugRenderer=null,e._startSlotIndex=-1,e._endSlotIndex=-1,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e.attachUtil=new Dq,SZ(lr(e),"_defaultSkinIndex",e._enumSkins),SZ(lr(e),"_animationIndex",e._enumAnimations),e._useVertexOpacity=!0,e}return e._updateBuiltinMaterial=function(){return Nn.get("default-spine-material")},e.updateMaterial=function(){var t;t=this._customMaterial?this._customMaterial:this._updateBuiltinMaterial(),this.setMaterial(t,0),this._cleanMaterialCache()},e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new Qh),this._drawInfoList[t]},e.setSkeletonData=function(t){var e=this.node._uiProps.uiTransformComp;if(null!=t.width&&null!=t.height&&e.setContentSize(t.width,t.height),this._cacheMode===vZ.SHARED_CACHE?this._skeletonCache=Sq.sharedCache:this._cacheMode===vZ.PRIVATE_CACHE&&(this._skeletonCache=new Sq,this._skeletonCache.enablePrivateMode()),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&Gi("Debug bones or slots is invalid in cached mode");var i=this._skeletonCache.getSkeletonCache(this.skeletonData._uuid,t);this._skeleton=i.skeleton,this._clipper=i.clipper,this._rootBone=this._skeleton.getRootBone()}else this._skeleton=new $K.Skeleton(t),this._clipper=new $K.SkeletonClipping,this._rootBone=this._skeleton.getRootBone();this._flushAssembler()},e.setSlotsRange=function(t,e){this.isAnimationCached()?Gi("Slots visible range can not be modified in cached mode."):(this._startSlotIndex=t,this._endSlotIndex=e)},e.setAnimationStateData=function(t){if(this.isAnimationCached())Gi("'setAnimationStateData' interface can not be invoked in cached mode.");else{var e=new $K.AnimationState(t);this._listener&&(this._state&&this._state.removeListener(this._listener),e.addListener(this._listener)),this._state=e}},e.__preload=function(){t.prototype.__preload.call(this);for(var e=this.node.children,i=0,n=e.length;ithis._headAniInfo.delay){var n=this._headAniInfo;this._headAniInfo=null,this.setAnimation(0,n.animationName,n.loop)}return}this._updateCache(t)}else this._updateRealtime(t)},e.setVertexEffectDelegate=function(t){this._effectDelegate=t},e.setToSetupPose=function(){this._skeleton&&this._skeleton.setToSetupPose()},e.setBonesToSetupPose=function(){this._skeleton&&this._skeleton.setBonesToSetupPose()},e.setSlotsToSetupPose=function(){this._skeleton&&this._skeleton.setSlotsToSetupPose()},e.updateAnimationCache=function(t){if(this.isAnimationCached()){var e=this._skeletonData._uuid;this._skeletonCache&&this._skeletonCache.updateAnimationCache(e,t)}},e.invalidAnimationCache=function(){this.isAnimationCached()&&this._skeletonCache&&this._skeletonCache.invalidAnimationCache(this._skeletonData._uuid)},e.findBone=function(t){return this._skeleton?this._skeleton.findBone(t):null},e.findSlot=function(t){return this._skeleton?this._skeleton.findSlot(t):null},e.setSkin=function(t){this._skeleton&&(this._skeleton.setSkinByName(t),this._skeleton.setSlotsToSetupPose()),this.invalidAnimationCache()},e.getAttachment=function(t,e){return this._skeleton?this._skeleton.getAttachmentByName(t,e):null},e.setAttachment=function(t,e){this._skeleton&&this._skeleton.setAttachment(t,e),this.invalidAnimationCache()},e.getTextureAtlas=function(t){return t.region},e.setMix=function(t,e,i){this._state&&this._state.data.setMix(t,e,i)},e.setAnimation=function(t,e,i){if(this._playTimes=i?0:1,this._animationName=e,this.isAnimationCached()){if(0!==t&&Gi("Track index can not greater than 0 in cached mode."),!this._skeletonCache)return null;var n=this._skeletonCache.getAnimationCache(this._skeletonData._uuid,e);n||(n=this._skeletonCache.initAnimationCache(this._skeletonData._uuid,e)),n&&(this._isAniComplete=!1,this._accTime=0,this._playCount=0,this._frameCache=n,this._socketNodes.size>0&&this._frameCache.enableCacheAttachedInfo(),this._frameCache.updateToFrame(0),this._curFrame=this._frameCache.frames[0])}else if(this._skeleton){var r=this._skeleton.data.findAnimation(e);if(!r)return kr(7509,e),null;var s=this._state.setAnimationWith(t,r,i);return this._state.apply(this._skeleton),s}return null},e.addAnimation=function(t,e,i,n){if(n=n||0,this.isAnimationCached())0!==t&&Gi("Track index can not greater than 0 in cached mode."),this._animationQueue.push({animationName:e,loop:i,delay:n});else if(this._skeleton){var r,s=this._skeleton.data.findAnimation(e);return s?null===(r=this._state)||void 0===r?void 0:r.addAnimationWith(t,s,i,n):(kr(7510,e),null)}return null},e.findAnimation=function(t){return this._skeleton?this._skeleton.data.findAnimation(t):null},e.getCurrent=function(t){if(this.isAnimationCached())Gi("'getCurrent' interface can not be invoked in cached mode.");else if(this._state)return this._state.getCurrent(t);return null},e.clearTracks=function(){this.isAnimationCached()?Gi("'clearTracks' interface can not be invoked in cached mode."):this._state&&(this._state.clearTracks(),this.setToSetupPose())},e.clearTrack=function(t){this.isAnimationCached()?Gi("'clearTrack' interface can not be invoked in cached mode."):this._state&&this._state.clearTrack(t)},e.setStartListener=function(t){this._ensureListener(),this._listener.start=t},e.setInterruptListener=function(t){this._ensureListener(),this._listener.interrupt=t},e.setEndListener=function(t){this._ensureListener(),this._listener.end=t},e.setDisposeListener=function(t){this._ensureListener(),this._listener.dispose=t},e.setCompleteListener=function(t){this._ensureListener(),this._listener.complete=t},e.setEventListener=function(t){this._ensureListener(),this._listener.event=t},e.setTrackStartListener=function(t,e){tq.getListeners(t).start=e},e.setTrackInterruptListener=function(t,e){tq.getListeners(t).interrupt=e},e.setTrackEndListener=function(t,e){tq.getListeners(t).end=e},e.setTrackDisposeListener=function(t,e){tq.getListeners(t).dispose=e},e.setTrackCompleteListener=function(t,e){tq.getListeners(t).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);e(t,i)}},e.setTrackEventListener=function(t,e){tq.getListeners(t).event=e},e.getState=function(){return this._state},e.onEnable=function(){t.prototype.onEnable.call(this),this._flushAssembler(),TZ.getInstance().add(this)},e.onDisable=function(){t.prototype.onDisable.call(this),TZ.getInstance().remove(this)},e.onDestroy=function(){this._cleanMaterialCache(),this._drawList.destroy(),t.prototype.onDestroy.call(this)},e.destroyRenderData=function(){this._drawList.reset(),t.prototype.destroyRenderData.call(this)},e.getMaterialTemplate=function(){return null!==this.customMaterial?this.customMaterial:(this.material||this.updateMaterial(),this.material)},e.getMaterialForBlendAndTint=function(t,e,i){var n=i+"/"+t+"/"+e,r=this._materialCache[n];if(r)return r;var s=this.getMaterialTemplate();r=new On({parent:s,subModelIdx:0,owner:this}),this._materialCache[n]=r,r.overridePipelineStates({blendState:{blendColor:Ve.WHITE,targets:[{blendEq:B.ADD,blendAlphaEq:B.ADD,blendSrc:t,blendDst:e,blendSrcAlpha:t,blendDstAlpha:e}]}});var a=!1;i===yZ.TWO_COLORED&&(a=!0);var o=!this._enableBatch;return r.recompileShaders({TWO_COLORED:a,USE_LOCAL:o}),r},e.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},e.querySockets=function(){return this._skeleton?(0===this._cachedSockets.size&&this._indexBoneSockets(),this._cachedSockets.size>0?Array.from(this._cachedSockets.keys()).sort():[]):[]},e._requestDrawData=function(t,e,i,n){var r=this._drawList.add();return r.material=t,r.texture=e,r.indexOffset=i,r.indexCount=n,r},e._render=function(t){var e=0;if(this.renderData&&this._drawList){for(var i=this.renderData,n=i.chunk,r=n.vertexAccessor,s=i.getMeshBuffer(),a=s.indexOffset,o=0;othis.maxVertexCount?e.maxVertexCount:this.maxVertexCount,this.maxIndexCount=e.maxIndexCount>this.maxIndexCount?e.maxIndexCount:this.maxIndexCount,this.renderData.resize(this.maxVertexCount,this.maxIndexCount),(!this.renderData.indices||this.maxIndexCount>this.renderData.indices.length)&&(this.renderData.indices=new Uint16Array(this.maxIndexCount)))),e.isCompleted&&r>=i.length){if(this._playCount++,this._playTimes>0&&this._playCount>=this._playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playCount=0,this._isAniComplete=!0,void this._emitCacheCompleteEvent();this._accTime=0,r=0,this._emitCacheCompleteEvent()}this._curFrame=i[r]}},e._updateRealtime=function(t){var e=this._skeleton,i=this._state;e&&(e.update(t),i&&(i.update(t),i.apply(e)))},e._indexBoneSockets=function(){if(this._skeleton){this._cachedSockets.clear();for(var t=this._skeleton.bones,e=function e(i){return null==i.parent?i.data.name||"":e(t[i.parent.data.index])+"/"+i.data.name},i=0,n=t.length;i>>0)+(ZZ<<16)+(qZ<<8)+KZ,JZ=t.dr*WZ,$Z=t.dg*YZ,tQ=t.db*jZ,NZ=((CZ?255:0)<<24>>>0)+(tQ<<16)+($Z<<8)+JZ}function BQ(t){return(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r}function PQ(t,e,i,n){return(n<<24>>>0)+(i<<16)+(e<<8)+t}var DQ=null,OQ=null,FQ={vCount:32767,ensureAccessor:function(t){var e=t?OQ:DQ;if(!e){var i=Di.root.device,n=Di.root.batcher2D,r=t?Nh:Fh;t?(e=OQ=new Kh(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),OQ)):(e=DQ=new Kh(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),DQ))}return e},createData:function(t){var e=t.renderData;if(!e){for(var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i),r=t._skeleton.data.skins,s=0,a=0,o=0;o>1,a+=d.triangles.length)}}(e=Sl.add(i?Nh:Fh,n)).resize(s,a),e.indices&&a===e.indices.length||(e.indices=new Uint16Array(a)),t.maxVertexCount=s,t.maxIndexCount=a}return e},updateRenderData:function(t){eQ=t;var e=t._skeleton;!t.isAnimationCached()&&e&&e.updateWorldTransform(),e&&function(t){if(t._skeleton){var e=t.color;PZ=e.r/255,DZ=e.g/255,OZ=e.b/255,FZ=t.node._uiProps.opacity,wZ=t.useTint||t.isAnimationCached(),kZ=Uh(wZ?Nh:Fh)>>2,t.drawList.reset(),eQ=t,iQ=t.renderData,xQ=null,XZ=!0,CZ=t.premultipliedAlpha,RZ=1,aQ=!1,bQ=t._effectDelegate&&t._effectDelegate._vertexEffect,(4294967295!==e._val||CZ)&&(aQ=!0);var i=null;t.enableBatch&&(i=t.node.worldMatrix),t.isAnimationCached()?function(t){var e=eQ._curFrame;if(e){var i=e.segments;if(0!==i.length){UZ=12,TQ=0,SQ=0,yQ=0,EQ=0;var n=null,r=e.vertices,s=e.indices,a=0,o=0,h=0,l=0,u=e.colors,c=0,d=u[c++],_=d.vfOffset;IQ(d);var f=0,p=iQ,g=p.chunk.vb;sQ=new Uint32Array(g.buffer,g.byteOffset,g.length);for(var m=p.indices,v=0,y=i.length;v0&&(eQ._requestDrawData(xQ,wQ,f,S),f=EQ),xQ=n,wQ=T.tex}vQ=T.vertexCount,SQ=T.indexCount,a=p.chunk.vertexOffset;for(var E=EQ,A=EQ+SQ;E=_&&(IQ(d=u[c++]),_=d.vfOffset),sQ[x+5]=LZ,sQ[x+6]=NZ;o+=l,yQ+=vQ,EQ+=SQ,vQ=0,SQ=0}}var M=EQ-f;wQ&&M>0&&eQ._requestDrawData(xQ,wQ,f,M)}}}(i):(bQ&&bQ.begin(t._skeleton),function(t){var e=iQ;rQ=e.chunk.vb,sQ=new Uint32Array(rQ.buffer,rQ.byteOffset,rQ.length),nQ=e.indices,AQ=eQ.maxVertexCount,CQ=eQ.maxIndexCount;var i,n,r,s,a,o,h=eQ._skeleton,l=h.color,u=eQ._debugRenderer,c=eQ._clipper,d=null;bZ=eQ._startSlotIndex,xZ=eQ._endSlotIndex,zZ=!1,-1===bZ&&(zZ=!0),MZ=eQ.debugSlots,IZ=eQ.debugBones,BZ=eQ.debugMesh,u&&(IZ||MZ||BZ)&&(u.clear(),u.lineWidth=5),UZ=12,mQ=0,yQ=0,TQ=0,SQ=0,EQ=0;for(var _=0,f=0,p=h.drawOrder.length;f=0&&bZ===o.data.index&&(zZ=!0),zZ)if(xZ>=0&&xZ===o.data.index&&(zZ=!1),mQ=0,SQ=0,i=o.getAttachment())if(s=i instanceof $K.RegionAttachment,a=i instanceof $K.MeshAttachment,i instanceof $K.ClippingAttachment)c.clipStart(o,i);else if(s||a){var g=i.region.texture.getRealTexture();if(d=MQ(o.data.blendMode)){if(xQ||(xQ=d),XZ||d.hash!==xQ.hash||g&&wQ!==g){XZ=!1;var m=EQ-_;m>0&&(eQ._requestDrawData(xQ,wQ,_,m),_=EQ),wQ=g,xQ=d}if(s){if(r=hQ,mQ=(vQ=4)*kZ,SQ=6,i.computeWorldVertices(o.bone,rQ,TQ,kZ),u&&MZ){u.strokeColor=lQ,u.moveTo(rQ[TQ],rQ[TQ+1]);for(var v=TQ+kZ,y=TQ+mQ;v>1,mQ=vQ*kZ,SQ=r.length,T.computeWorldVertices(o,0,T.worldVerticesLength,rQ,TQ,kZ),u&&BZ){u.strokeColor=dQ;for(var S=0,E=r.length;S0){for(var I=e.chunk.vertexOffset,B=EQ,P=EQ+SQ;B0&&eQ._requestDrawData(xQ,wQ,_,F),c.clipEnd(),u&&IZ){var L;u.strokeColor=uQ,u.fillColor=lQ;for(var N=0,k=h.bones.length;Nr.vertexCount&&(r.resizeAndCopy(AQ,CQ>r.indexCount?CQ:r.indexCount),rQ=r.chunk.vb,sQ=new Uint32Array(rQ.buffer,rQ.byteOffset,rQ.length),o=!0),CQ>nQ.length&&(nQ=r.indices=new Uint16Array(CQ),o=!0),o)for(var h=r.chunk.vertexOffset-a,l=0;l0&&nQ.set(h,EQ),bQ)for(var l=0,u=o.length,c=TQ;l0&&nQ.set(E,EQ),bQ)for(var A=0,C=S.length,R=TQ;A=n&&i.actionIndex--;break}}},e._removeActionByTag=function(t,e,i){for(var n=0,r=e.actions.length;n=0;--n){var r=e.actions[n];if(r&&r.getTag()===t){if(i&&r.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e)}}},e.removeActionByTag=function(t,e){var i=this;t===VQ.TAG_INVALID&&kr(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeActionByTag(t,r,e)}else n.forEach((function(e){i._removeActionByTag(t,e)}))},e.removeAllActionsByTag=function(t,e){var i=this;t===VQ.TAG_INVALID&&kr(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeAllActionsByTag(t,r,e)}else n.forEach((function(e){i._removeAllActionsByTag(t,e)}))},e.getActionByTag=function(t,e){t===VQ.TAG_INVALID&&kr(1004);var i=this._hashTargets.get(e);if(i){if(null!=i.actions)for(var n=0;n=t&&e.actionIndex--,0===e.actions.length&&this._deleteHashElement(e)},e._deleteHashElement=function(t){var e=!1;if(t&&!t.lock&&this._hashTargets.get(t.target)){this._hashTargets.delete(t.target);for(var i=this._arrayTargets,n=0,r=i.length;n=this._duration},i._cloneDecoration=function(t){t._repeatForever=this._repeatForever,t._speed=this._speed,t._timesForRepeat=this._timesForRepeat,t._easeList=this._easeList,t._speedMethod=this._speedMethod,t._repeatMethod=this._repeatMethod},i._reverseEaseList=function(t){if(this._easeList){t._easeList=[];for(var e=0;e1.192092896e-7?this._duration:1.192092896e-7);e=e<1?e:1,this.update(e>0?e:0),this._repeatMethod&&this._timesForRepeat>1&&this.isDone()&&(this._repeatForever||this._timesForRepeat--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},i.startWithTarget=function(t){VQ.prototype.startWithTarget.call(this,t),this._elapsed=0,this._firstTick=!0},i.reverse=function(){return kr(1010),this},i.setAmplitudeRate=function(){kr(1011)},i.getAmplitudeRate=function(){return kr(1012),0},i.speed=function(t){return t<=0?(kr(1013),this):(this._speedMethod=!0,this._speed*=t,this)},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){return this._speed=t,this},i.repeat=function(t){return t=Math.round(t),isNaN(t)||t<1?(kr(1014),this):(this._repeatMethod=!0,this._timesForRepeat*=t,this)},i.repeatForever=function(){return this._repeatMethod=!0,this._timesForRepeat=this.MAX_VALUE,this._repeatForever=!0,this},e}(HQ),$Q=function(t){function e(i){var n;(n=t.call(this)||this)._actions=[],n._split=0,n._last=0,n._reversed=!1;var r=i instanceof Array?i:arguments;if(1===r.length)return hn(1019),lr(n);var s=r.length-1;if(s>=0&&null==r[s]&&kr(1015),s>=0){for(var a,o=r[0],h=1;h1?e%1:e),this._last=n)},i.reverse=function(){var t=e._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t._reversed=!0,t},e}(JQ);function tJ(t){var e=t instanceof Array?t:arguments;if(1===e.length)return hn(1019),null;var i=e.length-1;i>=0&&null==e[i]&&kr(1015);var n=null;if(i>=0){n=e[0];for(var r=1;r<=i;r++)e[r]&&(n=$Q._actionOneTwo(n,e[r]))}return n}$Q._actionOneTwo=function(t,e){var i=new $Q;return i.initWithTwoActions(t,e),i};var eJ=function(t){function e(e,i){var n;return(n=t.call(this)||this)._times=0,n._total=0,n._nextDt=0,n._actionInstant=!1,n._innerAction=null,void 0!==i&&n.initWithAction(e,i),n}He(e,t);var i=e.prototype;return i.initWithAction=function(t,e){var i=t._duration*e;return!!this.initWithDuration(i)&&(this._times=e,this._innerAction=t,t instanceof jQ&&(this._actionInstant=!0,this._times-=1),this._total=0,!0)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone(),this._times),t},i.startWithTarget=function(t){this._total=0,this._nextDt=this._innerAction._duration/this._duration,JQ.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.stop=function(){this._innerAction.stop(),VQ.prototype.stop.call(this)},i.update=function(t){t=this._computeEaseTime(t);var e=this._innerAction,i=this._duration,n=this._times,r=this._nextDt;if(t>=r){for(;t>r&&this._total1?1:r;t>=1&&this._total=0&&null==r[s]&&kr(1015),s>=0){for(var a,o=r[0],h=1;hr?this._two=$Q._actionOneTwo(e,aJ(n-r)):n0&&null==e[e.length-1]&&kr(1015);for(var i=e[0],n=1;n0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===WJ.COLOR){var n=e._uiProps.uiComp;Ve.lerp(KJ,this._fromColor,this._toColor,i),n&&(n.color=KJ)}else this.transition===WJ.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=Cs(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Cs(this._fromScale.y,this._toScale.y,i),e.setScale(this._targetScale));1===i&&(this._transitionFinished=!0)}},i._resizeNodeToTargetNode=function(){this.target&&this.target._uiProps.uiTransformComp},i._resetState=function(){this._pressed=!1,this._hovered=!1;var t=this.target;if(t){var e=this._transition;if(e===WJ.COLOR&&this._interactable){var i=t.getComponent(wu);i&&(i.color=this._normalColor)}else e===WJ.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(xn.TOUCH_START,this._onTouchBegan,this),this.node.on(xn.TOUCH_MOVE,this._onTouchMove,this),this.node.on(xn.TOUCH_END,this._onTouchEnded,this),this.node.on(xn.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(xn.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(xn.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(hJ.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(hJ.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(hJ.XRUI_CLICK,this._xrClick,this),this.node.on(hJ.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(xn.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(xn.TOUCH_START,this._onTouchBegan,this),this.node.off(xn.TOUCH_MOVE,this._onTouchMove,this),this.node.off(xn.TOUCH_END,this._onTouchEnded,this),this.node.off(xn.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(xn.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(xn.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(hJ.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(hJ.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(hJ.XRUI_CLICK,this._xrClick,this),this.node.off(hJ.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(xn.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(Bd)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new ji),ji.copy(this._originalScale,this.target.getScale()),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===WJ.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case YJ.NORMAL:this._normalSprite=t;break;case YJ.HOVER:this._hoverSprite=t;break;case YJ.PRESSED:this._pressedSprite=t;break;case YJ.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===WJ.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case YJ.NORMAL:this._normalColor=t;break;case YJ.HOVER:this._hoverColor=t;break;case YJ.PRESSED:this._pressedColor=t;break;case YJ.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&pr.SCALE&&this._originalScale&&this._transition===WJ.SCALE&&this._transitionFinished&&ji.copy(this._originalScale,this.target.getScale())},i._onTouchBegan=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchMove=function(t){if(this._interactable&&this.enabledInHierarchy&&this._pressed&&t){var e=t.touch;if(e){var i,n=this.node._uiProps.uiTransformComp.hitTest(e.getLocation());this._transition===WJ.SCALE&&this.target&&this._originalScale?n?(ji.copy(this._fromScale,this._originalScale),ji.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?YJ.PRESSED:YJ.NORMAL,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Pa.emitEvents(this.clickEvents,t),this.node.emit(jJ.CLICK,this)),this._pressed=!1,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchCancel=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!1,this._updateState())},i._onMouseMoveIn=function(){!this._pressed&&this.interactable&&this.enabledInHierarchy&&(this._transition!==WJ.SPRITE||this._hoverSprite)&&(this._hovered||(this._hovered=!0,this._updateState()))},i._onMouseMoveOut=function(){this._hovered&&(this._hovered=!1,this._updateState())},i._updateState=function(){var t=this._getButtonState();this._applyTransition(t)},i._getButtonState=function(){var t=YJ.NORMAL;return this._interactable?this._pressed?t=YJ.PRESSED:this._hovered&&(t=YJ.HOVER):t=YJ.DISABLED,t.toString()},i._updateColorTransition=function(t){var e,i=this[t+"Color"],n=null===(e=this.target)||void 0===e?void 0:e.getComponent(wu);n&&(t===YJ.DISABLED?n.color=i:(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this[t+"Sprite"];this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(t===YJ.PRESSED?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(ji.copy(this._fromScale,this._originalScale),ji.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(ji.copy(this._fromScale,this.target.getScale()),ji.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===WJ.COLOR?this._updateColorTransition(t):e===WJ.SPRITE?this._updateSpriteTransition(t):e===WJ.SCALE&&this._updateScaleTransition(t)},i._xrHoverEnter=function(){this._onMouseMoveIn(),this._updateState()},i._xrHoverExit=function(){this._onMouseMoveOut(),this._pressed&&(this._pressed=!1,this._updateState())},i._xrClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState())},i._xrUnClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Pa.emitEvents(this.clickEvents,this),this.node.emit(jJ.CLICK,this)),this._pressed=!1,this._updateState())},Pi(e,[{key:"target",get:function(){return this._target||this.node},set:function(t){this._target!==t&&(this._target&&this._unregisterTargetEvent(this._target),this._target=t,this._applyTarget())}},{key:"interactable",get:function(){return this._interactable},set:function(t){this._interactable!==t&&(this._interactable=t,this._updateState(),this._interactable||this._resetState())}},{key:"_resizeToTarget",set:function(t){t&&this._resizeNodeToTargetNode()}},{key:"transition",get:function(){return this._transition},set:function(t){this._transition!==t&&(this._transition===WJ.COLOR?this._updateColorTransition(YJ.NORMAL):this._transition===WJ.SPRITE&&this._updateSpriteTransition(YJ.NORMAL),this._transition=t,this._updateState())}},{key:"normalColor",get:function(){return this._normalColor},set:function(t){this._normalColor!==t&&(this._normalColor.set(t),this._updateState())}},{key:"pressedColor",get:function(){return this._pressedColor},set:function(t){this._pressedColor!==t&&this._pressedColor.set(t)}},{key:"hoverColor",get:function(){return this._hoverColor},set:function(t){this._hoverColor!==t&&this._hoverColor.set(t)}},{key:"disabledColor",get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor.set(t),this._updateState())}},{key:"duration",get:function(){return this._duration},set:function(t){this._duration!==t&&(this._duration=t)}},{key:"zoomScale",get:function(){return this._zoomScale},set:function(t){this._zoomScale!==t&&(this._zoomScale=t)}},{key:"normalSprite",get:function(){return this._normalSprite},set:function(t){if(this._normalSprite!==t){this._normalSprite=t;var e=this.node.getComponent(Bd);e&&(e.spriteFrame=t),this._updateState()}}},{key:"pressedSprite",get:function(){return this._pressedSprite},set:function(t){this._pressedSprite!==t&&(this._pressedSprite=t,this._updateState())}},{key:"hoverSprite",get:function(){return this._hoverSprite},set:function(t){this._hoverSprite!==t&&(this._hoverSprite=t,this._updateState())}},{key:"disabledSprite",get:function(){return this._disabledSprite},set:function(t){this._disabledSprite!==t&&(this._disabledSprite=t,this._updateState())}}]),e}(Pn),zJ.Transition=WJ,zJ.EventType=jJ,gn((wJ=XJ).prototype,"target",[TJ],Object.getOwnPropertyDescriptor(wJ.prototype,"target"),wJ.prototype),gn(wJ.prototype,"transition",[SJ],Object.getOwnPropertyDescriptor(wJ.prototype,"transition"),wJ.prototype),gn(wJ.prototype,"normalSprite",[EJ],Object.getOwnPropertyDescriptor(wJ.prototype,"normalSprite"),wJ.prototype),gn(wJ.prototype,"pressedSprite",[AJ],Object.getOwnPropertyDescriptor(wJ.prototype,"pressedSprite"),wJ.prototype),gn(wJ.prototype,"hoverSprite",[CJ],Object.getOwnPropertyDescriptor(wJ.prototype,"hoverSprite"),wJ.prototype),gn(wJ.prototype,"disabledSprite",[RJ],Object.getOwnPropertyDescriptor(wJ.prototype,"disabledSprite"),wJ.prototype),MJ=tn(wJ.prototype,"clickEvents",[bJ,en],(function(){return[]})),IJ=tn(wJ.prototype,"_interactable",[en],(function(){return!0})),BJ=tn(wJ.prototype,"_transition",[en],(function(){return WJ.NONE})),PJ=tn(wJ.prototype,"_normalColor",[en],(function(){return Ve.WHITE.clone()})),DJ=tn(wJ.prototype,"_hoverColor",[en],(function(){return new Ve(211,211,211,255)})),OJ=tn(wJ.prototype,"_pressedColor",[en],(function(){return Ve.WHITE.clone()})),FJ=tn(wJ.prototype,"_disabledColor",[en],(function(){return new Ve(124,124,124,255)})),LJ=tn(wJ.prototype,"_normalSprite",[en],(function(){return null})),NJ=tn(wJ.prototype,"_hoverSprite",[en],(function(){return null})),kJ=tn(wJ.prototype,"_pressedSprite",[en],(function(){return null})),UJ=tn(wJ.prototype,"_disabledSprite",[en],(function(){return null})),GJ=tn(wJ.prototype,"_duration",[en],(function(){return.1})),VJ=tn(wJ.prototype,"_zoomScale",[en],(function(){return 1.2})),HJ=tn(wJ.prototype,"_target",[en],(function(){return null})),xJ=wJ))||xJ)||xJ)||xJ));We.Button=qJ;var ZJ,QJ,JJ,$J=function(){function t(){}return t.add=function(t){var e=this._tabIndexList;-1===e.indexOf(t)&&e.push(t)},t.remove=function(t){var e=this._tabIndexList,i=e.indexOf(t);-1!==i&&e.splice(i,1)},t.resort=function(){this._tabIndexList.sort((function(t,e){return t._delegate.tabIndex-e._delegate.tabIndex}))},t.next=function(t){var e=this._tabIndexList,i=e.indexOf(t);if(t.setFocus(!1),-1!==i){var n=e[i+1];n&&n._delegate.tabIndex>=0&&n.setFocus(!0)}},t}();$J._tabIndexList=[],function(t){t[t.DEFAULT=0]="DEFAULT",t[t.DONE=1]="DONE",t[t.SEND=2]="SEND",t[t.SEARCH=3]="SEARCH",t[t.GO=4]="GO",t[t.NEXT=5]="NEXT"}(ZJ||(ZJ={})),fr(ZJ),function(t){t[t.ANY=0]="ANY",t[t.EMAIL_ADDR=1]="EMAIL_ADDR",t[t.NUMERIC=2]="NUMERIC",t[t.PHONE_NUMBER=3]="PHONE_NUMBER",t[t.URL=4]="URL",t[t.DECIMAL=5]="DECIMAL",t[t.SINGLE_LINE=6]="SINGLE_LINE"}(QJ||(QJ={})),fr(QJ),function(t){t[t.PASSWORD=0]="PASSWORD",t[t.SENSITIVE=1]="SENSITIVE",t[t.INITIAL_CAPS_WORD=2]="INITIAL_CAPS_WORD",t[t.INITIAL_CAPS_SENTENCE=3]="INITIAL_CAPS_SENTENCE",t[t.INITIAL_CAPS_ALL_CHARACTERS=4]="INITIAL_CAPS_ALL_CHARACTERS",t[t.DEFAULT=5]="DEFAULT"}(JJ||(JJ={})),fr(JJ);var t$,e$,i$,n$,r$,s$,a$,o$,h$,l$,u$,c$,d$,_$,f$,p$,g$,m$,v$,y$,T$,S$,E$,A$,C$,R$,b$,x$,w$,M$,I$,B$=function(){function t(){this._editing=!1,this._delegate=null}var e=t.prototype;return e.init=function(){},e.onEnable=function(){},e.update=function(){},e.onDisable=function(){this._editing&&this.endEditing()},e.clear=function(){this._delegate=null},e.setTabIndex=function(){},e.setSize=function(){},e.setFocus=function(t){t?this.beginEditing():this.endEditing()},e.isFocused=function(){return this._editing},e.beginEditing=function(){},e.endEditing=function(){},t}(),P$=ln.document,D$=new Ue,O$=new Ue,F$=new ji,L$=null,N$=0,k$=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&(e.value=e.value.slice(0,r)),n._editBoxTextChanged(e.value)}},n.onClick=function(){t._editing&&rn.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===Oa.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===Oa.TAB&&(i.propagationStopped=!0,i.preventDefault(),$J.next(t))},n.onBlur=function(){rn.isMobile&&i&&n.compositionEnd(),t._editing=!1,L$=null,t._hideDom(),t._delegate._editBoxEditingDidEnded()},e.addEventListener("compositionstart",n.compositionStart),e.addEventListener("compositionend",n.compositionEnd),e.addEventListener("input",n.onInput),e.addEventListener("keydown",n.onKeydown),e.addEventListener("blur",n.onBlur),e.addEventListener("touchstart",n.onClick)}},i._removeEventListeners=function(){if(this._edTxt){var t=this._edTxt,e=this.__eventListeners;t.removeEventListener("compositionstart",e.compositionStart),t.removeEventListener("compositionend",e.compositionEnd),t.removeEventListener("input",e.onInput),t.removeEventListener("keydown",e.onKeydown),t.removeEventListener("blur",e.onBlur),t.removeEventListener("touchstart",e.onClick),e.compositionStart=null,e.compositionEnd=null,e.onInput=null,e.onKeydown=null,e.onBlur=null,e.onClick=null}},e}(B$);!function(t){t.EDITING_DID_BEGAN="editing-did-began",t.EDITING_DID_ENDED="editing-did-ended",t.TEXT_CHANGED="text-changed",t.EDITING_RETURN="editing-return",t.XR_EDITING_DID_BEGAN="xr-editing-did-began",t.XR_EDITING_DID_ENDED="xr-editing-did-ended"}(I$||(I$={}));var U$,G$,V$,H$,z$,X$,W$,Y$,j$,K$,q$,Z$,Q$,J$,$$,t0,e0,i0,n0,r0,s0,a0,o0,h0,l0,u0,c0,d0,_0,f0,p0,g0,m0,v0,y0,T0=function(e){return t({EditBox:e,EditBoxComponent:e}),e}((t$=Ki("cc.EditBox"),e$=In(110),i$=kn(Bl),n$=Tn(Mu),r$=Tn(Mu),s$=Tn(Uo),a$=Tn(JJ),o$=Tn(QJ),h$=Tn(ZJ),l$=Tn([Pa]),u$=Tn([Pa]),c$=Tn([Pa]),d$=Tn([Pa]),t$(_$=e$(_$=i$((M$=w$=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&t.length>=this._maxLength&&(t=t.slice(0,this._maxLength)),this._string!==t&&(this._string=t,this._updateString(t))}},{key:"placeholder",get:function(){return this._placeholderLabel?this._placeholderLabel.string:""},set:function(t){this._placeholderLabel&&(this._placeholderLabel.string=t)}},{key:"textLabel",get:function(){return this._textLabel},set:function(t){this._textLabel!==t&&(this._textLabel=t,this._textLabel&&(this._updateTextLabel(),this._updateLabels()))}},{key:"placeholderLabel",get:function(){return this._placeholderLabel},set:function(t){this._placeholderLabel!==t&&(this._placeholderLabel=t,this._placeholderLabel&&(this._updatePlaceholderLabel(),this._updateLabels()))}},{key:"backgroundImage",get:function(){return this._backgroundImage},set:function(t){this._backgroundImage!==t&&(this._backgroundImage=t,this._ensureBackgroundSprite(),this._background.spriteFrame=t)}},{key:"inputFlag",get:function(){return this._inputFlag},set:function(t){this._inputFlag!==t&&(this._inputFlag=t,this._updateString(this._string))}},{key:"inputMode",get:function(){return this._inputMode},set:function(t){this._inputMode!==t&&(this._inputMode=t,this._updateTextLabel(),this._updatePlaceholderLabel())}},{key:"returnType",get:function(){return this._returnType},set:function(t){this._returnType=t}},{key:"maxLength",get:function(){return this._maxLength},set:function(t){this._maxLength=t}},{key:"tabIndex",get:function(){return this._tabIndex},set:function(t){this._tabIndex!==t&&(this._tabIndex=t,this._impl&&this._impl.setTabIndex(t))}}]),e}(Pn),w$._EditBoxImpl=B$,w$.KeyboardReturnType=ZJ,w$.InputFlag=JJ,w$.InputMode=QJ,w$.EventType=I$,gn((f$=M$).prototype,"textLabel",[n$],Object.getOwnPropertyDescriptor(f$.prototype,"textLabel"),f$.prototype),gn(f$.prototype,"placeholderLabel",[r$],Object.getOwnPropertyDescriptor(f$.prototype,"placeholderLabel"),f$.prototype),gn(f$.prototype,"backgroundImage",[s$],Object.getOwnPropertyDescriptor(f$.prototype,"backgroundImage"),f$.prototype),gn(f$.prototype,"inputFlag",[a$],Object.getOwnPropertyDescriptor(f$.prototype,"inputFlag"),f$.prototype),gn(f$.prototype,"inputMode",[o$],Object.getOwnPropertyDescriptor(f$.prototype,"inputMode"),f$.prototype),gn(f$.prototype,"returnType",[h$],Object.getOwnPropertyDescriptor(f$.prototype,"returnType"),f$.prototype),p$=tn(f$.prototype,"editingDidBegan",[l$,en],(function(){return[]})),g$=tn(f$.prototype,"textChanged",[u$,en],(function(){return[]})),m$=tn(f$.prototype,"editingDidEnded",[c$,en],(function(){return[]})),v$=tn(f$.prototype,"editingReturn",[d$,en],(function(){return[]})),y$=tn(f$.prototype,"_textLabel",[en],(function(){return null})),T$=tn(f$.prototype,"_placeholderLabel",[en],(function(){return null})),S$=tn(f$.prototype,"_returnType",[en],(function(){return ZJ.DEFAULT})),E$=tn(f$.prototype,"_string",[en],(function(){return""})),A$=tn(f$.prototype,"_tabIndex",[en],(function(){return 0})),C$=tn(f$.prototype,"_backgroundImage",[en],(function(){return null})),R$=tn(f$.prototype,"_inputFlag",[en],(function(){return JJ.DEFAULT})),b$=tn(f$.prototype,"_inputMode",[en],(function(){return QJ.ANY})),x$=tn(f$.prototype,"_maxLength",[en],(function(){return 20})),_$=f$))||_$)||_$)||_$));"object"!=typeof window||"object"!=typeof document||Fa||La||Na||(T0._EditBoxImpl=k$),We.internal.EditBox=T0,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(f0||(f0={})),Fn(f0),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(p0||(p0={})),Fn(p0),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(g0||(g0={})),Fn(g0),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(m0||(m0={})),Fn(m0),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(v0||(v0={})),Fn(v0),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(y0||(y0={})),Fn(y0);var S0,E0,A0,C0,R0,b0,x0,w0,M0,I0,B0,P0,D0,O0,F0,L0=new ji,N0=function(e){return t({Layout:e,LayoutComponent:e}),e}((U$=Ki("cc.Layout"),G$=In(110),V$=kn(Bl),H$=Tn(f0),z$=Tn(p0),X$=Tn(g0),W$=Tn(m0),Y$=Tn(v0),j$=Tn(y0),U$(K$=G$(K$=V$((_0=d0=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rd&&(_=Math.max(d,_),c=d||x,d=x),l+=a*(R*b+this._spacingX);var w=a*(1-R)*b;if(e){if(s>0)(f=y/s>0&&y%s==0)&&(c=d>x?d:c);else if(b>t-m)l>h+a*R*b&&(f=!0);else{var M=(1-this._horizontalDirection-r.x)*t,I=l+w+a*(a>0?this._paddingRight:this._paddingLeft);f=Math.abs(I)>Math.abs(M)}f&&(l=h+a*R*b,x!==d&&(c=d),u+=c+this._spacingY,c=d=x)}var B=i(S,T,u);n&&S.setPosition(l,B),l+=w}return c=Math.max(c,d),Math.max(_,u+c)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingBottom;this._verticalDirection===m0.TOP_TO_BOTTOM&&(a=-1,o=this._paddingTop);var h=(this._verticalDirection-r.y)*t+a*o,l=h-a*this._spacingY,u=0,c=0,d=0,_=0,f=!1,p=this._usefulLayoutObj.length,g=this._cellSize.height,m=this._getPaddingV();this._layoutType!==f0.GRID&&this._resizeMode===p0.CHILDREN&&(g=(t-m-(p-1)*this._spacingY)/p);for(var v=this._usefulLayoutObj,y=0;yu&&(c=Math.max(u,c),d=u||b,u=b),l+=a*(R*x+this._spacingY);var w=a*(1-R)*x;if(e){if(s>0)(f=y/s>0&&y%s==0)&&(d=u>x?u:d);else if(x>t-m)l>h+a*R*x&&(f=!0);else{var M=(1-this._verticalDirection-r.y)*t,I=l+w+a*(a>0?this._paddingTop:this._paddingBottom);f=Math.abs(I)>Math.abs(M)}f&&(l=h+a*R*x,b!==u&&(d=u),_+=d+this._spacingX,d=u=b)}var B=i(S,T,_);n&&(S.getPosition(L0),S.setPosition(B,l,L0.z)),l+=w}return d=Math.max(d,u),Math.max(c,_+d)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,a=this._paddingBottom;this._verticalDirection===m0.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*e.height,a=this._paddingTop);var o=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+a)},h=0;this._resizeMode===p0.CONTAINER&&(h=this._doLayoutHorizontally(n,!0,o,!1),s=-t.y*h,this._verticalDirection===m0.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,o,!0),this._resizeMode===p0.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(n,h)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,a=this._paddingLeft;this._horizontalDirection===v0.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*e.width,a=this._paddingRight);var o=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+a)},h=0;this._resizeMode===p0.CONTAINER&&(h=this._doLayoutVertically(n,!0,o,!1),s=-t.x*h,this._horizontalDirection===v0.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,o,!0),this._resizeMode===p0.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(h,n)},i._doLayoutGrid=function(){var t=this.node._uiProps.uiTransformComp,e=t.anchorPoint,i=t.contentSize;this.startAxis===g0.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===g0.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===p0.CONTAINER){for(var n=0;n0?n:-n)),i*(e/r)},i._calculatePosition=function(t,e,i,n,r,s,a){var o=e-i;s&&(o+=Math.abs(s));var h=0;o&&(h=Bs(h=r/o));var l=(n-a)*h;this._direction===$0.VERTICAL?t.set(0,l):t.set(l,0)},i._updateLength=function(t){if(this._handle){var e=this._handle.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint;n.x===n1.x&&n.y===n1.y||e.setAnchorPoint(n1),this._direction===$0.HORIZONTAL?e.setContentSize(t,i.height):e.setContentSize(i.width,t)}},i._processAutoHide=function(t){if(this._enableAutoHide&&!(this._autoHideRemainingTime<=0)&&!this._touching&&(this._autoHideRemainingTime-=t,this._autoHideRemainingTime<=this._autoHideTime)){this._autoHideRemainingTime=Math.max(0,this._autoHideRemainingTime);var e=this._opacity*(this._autoHideRemainingTime/this._autoHideTime);this._setOpacity(e)}},Pi(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t,this.onScroll(cn.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(cn.ZERO))}},{key:"enableAutoHide",get:function(){return this._enableAutoHide},set:function(t){this._enableAutoHide!==t&&(this._enableAutoHide=t,this._enableAutoHide&&this._setOpacity(0))}},{key:"autoHideTime",get:function(){return this._autoHideTime},set:function(t){this._autoHideTime!==t&&(this._autoHideTime=t)}}]),e}(Pn),Z0.Direction=$0,gn((X0=Q0).prototype,"handle",[V0],Object.getOwnPropertyDescriptor(X0.prototype,"handle"),X0.prototype),gn(X0.prototype,"direction",[H0],Object.getOwnPropertyDescriptor(X0.prototype,"direction"),X0.prototype),W0=tn(X0.prototype,"_scrollView",[en],(function(){return null})),Y0=tn(X0.prototype,"_handle",[en],(function(){return null})),j0=tn(X0.prototype,"_direction",[en],(function(){return $0.HORIZONTAL})),K0=tn(X0.prototype,"_enableAutoHide",[en],(function(){return!1})),q0=tn(X0.prototype,"_autoHideTime",[en],(function(){return 1})),z0=X0))||z0)||z0)||z0));We.ScrollBar=o1;var h1,l1,u1,c1,d1,_1,f1,p1,g1,m1,v1,y1,T1,S1,E1,A1,C1,R1,b1,x1,w1,M1,I1=t("ViewGroup",Ki("cc.ViewGroup")(a1=In(110)(a1=function(t){function e(){return t.apply(this,arguments)||this}return He(e,t),e}(Pn))||a1)||a1);We.ViewGroup=I1;var B1,P1,D1=1e-4,O1=new ji,F1=new ji,L1=new cn,N1=new cn,k1=function(){return(new Date).getMilliseconds()},U1={"scroll-to-top":0,"scroll-to-bottom":1,"scroll-to-left":2,"scroll-to-right":3,scrolling:4,"bounce-bottom":6,"bounce-left":7,"bounce-right":8,"bounce-top":5,"scroll-ended":9,"touch-up":10,"scroll-ended-with-threshold":11,"scroll-began":12};!function(t){t.SCROLL_TO_TOP="scroll-to-top",t.SCROLL_TO_BOTTOM="scroll-to-bottom",t.SCROLL_TO_LEFT="scroll-to-left",t.SCROLL_TO_RIGHT="scroll-to-right",t.SCROLL_BEGAN="scroll-began",t.SCROLL_ENDED="scroll-ended",t.BOUNCE_TOP="bounce-top",t.BOUNCE_BOTTOM="bounce-bottom",t.BOUNCE_LEFT="bounce-left",t.BOUNCE_RIGHT="bounce-right",t.SCROLLING="scrolling",t.SCROLL_ENG_WITH_THRESHOLD="scroll-ended-with-threshold",t.TOUCH_UP="touch-up"}(B1||(B1={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(P1||(P1={}));var G1,V1,H1,z1,X1,W1,Y1,j1,K1,q1,Z1,Q1,J1,$1,t2=function(e){return t({ScrollView:e,ScrollViewComponent:e}),e}((h1=Ki("cc.ScrollView"),l1=In(110),u1=kn(Bl),c1=Tn(Pr),d1=Tn(o1),_1=Tn(o1),f1=Tn([Pa]),h1(p1=l1(p1=u1((M1=w1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new cn(t,0),applyToHorizontal:!0,applyToVertical:!1});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},i.scrollTo=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new cn(t),applyToHorizontal:!0,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.scrollToPercentVertical=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new cn(0,t),applyToHorizontal:!1,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.stopAutoScroll=function(){this._autoScrolling=!1,this._autoScrollAccumulatedTime=this._autoScrollTotalTime},i.setContentPosition=function(t){this._setContentPosition(t)},i._setContentPosition=function(t){if(this._content){var e=this._getContentPosition();Math.abs(t.x-e.x)7&&!this._touchMoved&&t.target!==this.node){var r=new ka(t.getTouches(),t.bubbles,Ua.TOUCH_CANCEL);r.touch=t.touch,r.simulate=!0,t.target.dispatchEvent(r),this._touchMoved=!0}this._stopPropagationIfTargetIsMe(t)}}},i._onTouchEnded=function(t,e){if(this.enabledInHierarchy&&this._content&&t&&!this._hasNestedViewGroup(t,e)){this._dispatchEvent(B1.TOUCH_UP);var i=t.touch;this._handleReleaseLogic(i),this._touchMoved?t.propagationStopped=!0:this._stopPropagationIfTargetIsMe(t)}},i._onTouchCancelled=function(t,e){if(this.enabledInHierarchy&&this._content&&!this._hasNestedViewGroup(t,e)){if(t&&!t.simulate){var i=t.touch;this._handleReleaseLogic(i)}this._stopPropagationIfTargetIsMe(t)}},i._calculateBoundary=function(){if(this._content&&this.view){var t=this._content.getComponent(N0);t&&t.enabledInHierarchy&&t.updateLayout();var e=this.view,i=e.width*e.anchorX,n=e.height*e.anchorY;this._leftBoundary=-i,this._bottomBoundary=-n,this._rightBoundary=this._leftBoundary+e.width,this._topBoundary=this._bottomBoundary+e.height,this._moveContentToTopLeft(e.contentSize)}},i._hasNestedViewGroup=function(t,e){if(!t||t.eventPhase!==Ba.CAPTURING_PHASE)return!1;if(e)for(var i,n=Fi(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(I1));if(r.getComponent(I1))return!0}return!1},i._startInertiaScroll=function(t){var e=new ji(t);e.multiplyScalar(.7),this._startAttenuatingAutoScroll(e,t)},i._calculateAttenuatedFactor=function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},i._startAttenuatingAutoScroll=function(t,e){var i=t.clone();if(i.normalize(),this._content&&this.view){var n=this._content._uiProps.uiTransformComp.contentSize,r=this.view.contentSize,s=n.width-r.width,a=n.height-r.height,o=this._calculateAttenuatedFactor(s),h=this._calculateAttenuatedFactor(a);i.x=i.x*s*(1-this.brake)*o,i.y=i.y*a*h*(1-this.brake),i.z=0}var l=t.length(),u=i.length()/l;if(i.add(t),this.brake>0&&u>7){u=Math.sqrt(u);var c=t.clone();c.multiplyScalar(u),i.set(c),i.add(t)}var d=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&u>3&&(d*=u=3),0===this.brake&&u>1&&(d*=u),this._startAutoScroll(i,d,!0)},i._calculateAutoScrollTimeByInitialSpeed=function(t){return Math.sqrt(Math.sqrt(t/5))},i._startAutoScroll=function(t,e,i){void 0===i&&(i=!1);var n=this._flattenVectorByDirection(t);this._autoScrolling=!0,this._autoScrollTargetDelta=n,this._autoScrollAttenuate=i,ji.copy(this._autoScrollStartPosition,this._getContentPosition()),this._autoScrollTotalTime=e,this._autoScrollAccumulatedTime=0,this._autoScrollBraking=!1,this._isScrollEndedWithThresholdEventFired=!1,this._autoScrollBrakingStartPosition.set(0,0,0),this._getHowMuchOutOfBoundary().equals(ji.ZERO,D1)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new ji,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(ji.ZERO);else{var i=new ji;i=this._touchMoveDisplacements.reduce((function(t,e){return t.add(e),t}),i),t.set(i.x*(1-this.brake)/e,i.y*(1-this.brake)/e,i.z)}return t},i._flattenVectorByDirection=function(t){var e=t;return e.x=this.horizontal?e.x:0,e.y=this.vertical?e.y:0,e},i._moveContent=function(t,e){var i=this._flattenVectorByDirection(t);O1.set(this._getContentPosition()),O1.add(i),O1.set(Math.round(1e4*O1.x)*D1,Math.round(1e4*O1.y)*D1,O1.z),this._setContentPosition(O1);var n=this._getHowMuchOutOfBoundary();L1.set(n.x,n.y),this._updateScrollBar(L1),this.elastic&&e&&this._startBounceBackIfNeeded()},i._getContentLeftBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.x-e.anchorX*e.width},i._getContentRightBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentLeftBoundary()+t.width},i._getContentTopBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentBottomBoundary()+t.height},i._getContentBottomBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.y-e.anchorY*e.height},i._getHowMuchOutOfBoundary=function(t){if((t=t||new ji).equals(ji.ZERO,D1)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new ji,i=this._getContentLeftBoundary(),n=this._getContentRightBoundary();i+t.x>this._leftBoundary?e.x=this._leftBoundary-(i+t.x):n+t.xthis._bottomBoundary&&(e.y=this._bottomBoundary-(s+t.y)),t.equals(ji.ZERO,D1)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),this._clampDelta(e),e},i._updateScrollBar=function(t){this._horizontalScrollBar&&this._horizontalScrollBar.onScroll(t),this.verticalScrollBar&&this.verticalScrollBar.onScroll(t)},i._onScrollBarTouchBegan=function(){this._horizontalScrollBar&&this._horizontalScrollBar.onTouchBegan(),this.verticalScrollBar&&this.verticalScrollBar.onTouchBegan()},i._onScrollBarTouchEnded=function(){this._horizontalScrollBar&&this._horizontalScrollBar.onTouchEnded(),this.verticalScrollBar&&this.verticalScrollBar.onTouchEnded()},i._dispatchEvent=function(t){if(t===B1.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===B1.SCROLL_TO_TOP||t===B1.SCROLL_TO_BOTTOM||t===B1.SCROLL_TO_LEFT||t===B1.SCROLL_TO_RIGHT){var e=1<0?u.y-o*l+i.y>=this._bottomBoundary&&(n=B1.SCROLL_TO_BOTTOM):i.y<0&&u.y-o*l+l+i.y<=this._topBoundary&&(n=B1.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?u.x-a*h+h+i.x<=this._rightBoundary&&(r=B1.SCROLL_TO_RIGHT):i.x>0&&u.x-a*h+i.x>=this._leftBoundary&&(r=B1.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(B1.SCROLL_BEGAN)),this._dispatchEvent(B1.SCROLLING)),""!==n&&this._dispatchEvent(n),""!==r&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(B1.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=k1(),this._touchMoveDisplacements.length=0,this._touchMoveTimeDeltas.length=0,this._onScrollBarTouchBegan()},i._clampDelta=function(t){if(this._content&&this.view){var e=this.view.contentSize,i=this._content._uiProps.uiTransformComp;i.width=5;)this._touchMoveDisplacements.shift(),this._touchMoveTimeDeltas.shift();this._touchMoveDisplacements.push(e);var i=k1();this._touchMoveTimeDeltas.push((i-this._touchMovePreviousTimestamp)/1e3),this._touchMovePreviousTimestamp=i},i._startBounceBackIfNeeded=function(){if(!this.elastic)return!1;var t=this._getHowMuchOutOfBoundary();if(this._clampDelta(t),t.equals(ji.ZERO,D1))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(B1.BOUNCE_TOP),t.y<0&&this._dispatchEvent(B1.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(B1.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(B1.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(O1,D1)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(ji.ZERO,D1)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,ji.copy(this._autoScrollBrakingStartPosition,this._getContentPosition()),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},i._processAutoScrolling=function(t){var e=this._isNecessaryAutoScrollBrake(),i=e?.05:1;this._autoScrollAccumulatedTime+=t*(1/i);var n,r=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(n=r,r=(n-=1)*n*n*n*n+1);var s=this._autoScrollTargetDelta.clone();s.multiplyScalar(r);var a=this._autoScrollStartPosition.clone();a.add(s);var o=Math.abs(r-1)<=D1;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(B1.SCROLL_ENG_WITH_THRESHOLD),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var h=a.clone();h.subtract(this._autoScrollBrakingStartPosition),e&&h.multiplyScalar(i),a.set(this._autoScrollBrakingStartPosition),a.add(h)}else{var l=a.clone();l.subtract(this.getContentPosition());var u=this._getHowMuchOutOfBoundary(l);u.equals(ji.ZERO,D1)||(a.add(u),o=!0)}o&&(this._autoScrolling=!1);var c=a.clone();c.subtract(this._getContentPosition()),this._clampDelta(c),this._moveContent(c,o),this._dispatchEvent(B1.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(B1.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(ji.ZERO,D1))return this._processInertiaScroll(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(B1.SCROLL_ENDED),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(B1.SCROLL_ENDED),this._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e.clampf(cn.ZERO,cn.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var a=new ji;if(this._content&&this.view){var o=0,h=this._content._uiProps.uiTransformComp.contentSize,l=this.view.contentSize;i&&(o=h.width-l.width,a.x=s-o*e.x),n&&(o=h.height-l.height,a.y=r-o*e.y)}return a},i._moveContentToTopLeft=function(t){var e=this._getContentBottomBoundary()-this._bottomBoundary;e=-e;var i=new ji,n=0,r=this._getContentLeftBoundary()-this._leftBoundary;if(r=-r,this._content){var s=this._content._uiProps.uiTransformComp.contentSize;s.height1)for(var n=i[0],r=0;r0){var i=this.node.parent&&this.node.parent._uiProps,n=i&&i.uiTransformComp,r=n?n.contentSize:Bn;this.isAlignLeft&&t===e3.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===e3.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===e3.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===e3.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===e3.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===e3.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(Bl)&&(t.on(xn.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(xn.SIZE_CHANGED,this._setDirtyByMode,this),t.on(xn.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(xn.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(xn.SIZE_CHANGED,this._setDirtyByMode,this),t.off(xn.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(xn.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(xn.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){(this.alignMode===t3.ALWAYS||aa)&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&y3)>0,n=this.node._uiProps.uiTransformComp;e?(this._alignFlags|=t,i?(this.isAlignHorizontalCenter=!1,this.isStretchWidth&&(this._originalWidth=n.width)):(this.isAlignVerticalCenter=!1,this.isStretchHeight&&(this._originalHeight=n.height))):(i?this.isStretchWidth&&(n.width=this._originalWidth):this.isStretchHeight&&(n.height=this._originalHeight),this._alignFlags&=~t)}},i._recursiveDirty=function(){this._dirty||(this._dirty=!0)},Pi(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._unregisterTargetEvents(),this._target=t,this._registerTargetEvents(),this._validateTargetInDEV(),this._recursiveDirty())}},{key:"isAlignTop",get:function(){return(this._alignFlags&e3.TOP)>0},set:function(t){this._setAlign(e3.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&e3.BOT)>0},set:function(t){this._setAlign(e3.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&e3.LEFT)>0},set:function(t){this._setAlign(e3.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&e3.RIGHT)>0},set:function(t){this._setAlign(e3.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&e3.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=e3.MID):this._alignFlags&=~e3.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&e3.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=e3.CENTER):this._alignFlags&=~e3.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&y3)===y3}},{key:"isStretchHeight",get:function(){return(this._alignFlags&v3)===v3}},{key:"top",get:function(){return this._top},set:function(t){this._top=t,this._recursiveDirty()}},{key:"editorTop",get:function(){return this._isAbsTop?this._top:100*this._top},set:function(t){this._top=this._isAbsTop?t:t/100,this._recursiveDirty()}},{key:"bottom",get:function(){return this._bottom},set:function(t){this._bottom=t,this._recursiveDirty()}},{key:"editorBottom",get:function(){return this._isAbsBottom?this._bottom:100*this._bottom},set:function(t){this._bottom=this._isAbsBottom?t:t/100,this._recursiveDirty()}},{key:"left",get:function(){return this._left},set:function(t){this._left=t,this._recursiveDirty()}},{key:"editorLeft",get:function(){return this._isAbsLeft?this._left:100*this._left},set:function(t){this._left=this._isAbsLeft?t:t/100,this._recursiveDirty()}},{key:"right",get:function(){return this._right},set:function(t){this._right=t,this._recursiveDirty()}},{key:"editorRight",get:function(){return this._isAbsRight?this._right:100*this._right},set:function(t){this._right=this._isAbsRight?t:t/100,this._recursiveDirty()}},{key:"horizontalCenter",get:function(){return this._horizontalCenter},set:function(t){this._horizontalCenter=t,this._recursiveDirty()}},{key:"editorHorizontalCenter",get:function(){return this._isAbsHorizontalCenter?this._horizontalCenter:100*this._horizontalCenter},set:function(t){this._horizontalCenter=this._isAbsHorizontalCenter?t:t/100,this._recursiveDirty()}},{key:"verticalCenter",get:function(){return this._verticalCenter},set:function(t){this._verticalCenter=t,this._recursiveDirty()}},{key:"editorVerticalCenter",get:function(){return this._isAbsVerticalCenter?this._verticalCenter:100*this._verticalCenter},set:function(t){this._verticalCenter=this._isAbsVerticalCenter?t:t/100,this._recursiveDirty()}},{key:"isAbsoluteTop",get:function(){return this._isAbsTop},set:function(t){this._isAbsTop!==t&&(this._isAbsTop=t,this._autoChangedValue(e3.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(e3.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(e3.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(e3.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(e3.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(e3.MID,this._isAbsVerticalCenter))}},{key:"alignMode",get:function(){return this._alignMode},set:function(t){this._alignMode=t,this._recursiveDirty()}},{key:"alignFlags",get:function(){return this._alignFlags},set:function(t){this._alignFlags!==t&&(this._alignFlags=t,this._recursiveDirty())}}]),e}(Pn),Q2.AlignMode=t3,gn((P2=J2).prototype,"target",[M2],Object.getOwnPropertyDescriptor(P2.prototype,"target"),P2.prototype),gn(P2.prototype,"alignMode",[I2],Object.getOwnPropertyDescriptor(P2.prototype,"alignMode"),P2.prototype),D2=tn(P2.prototype,"_alignFlags",[en],(function(){return 0})),O2=tn(P2.prototype,"_target",[en],(function(){return null})),F2=tn(P2.prototype,"_left",[en],(function(){return 0})),L2=tn(P2.prototype,"_right",[en],(function(){return 0})),N2=tn(P2.prototype,"_top",[en],(function(){return 0})),k2=tn(P2.prototype,"_bottom",[en],(function(){return 0})),U2=tn(P2.prototype,"_horizontalCenter",[en],(function(){return 0})),G2=tn(P2.prototype,"_verticalCenter",[en],(function(){return 0})),V2=tn(P2.prototype,"_isAbsLeft",[en],(function(){return!0})),H2=tn(P2.prototype,"_isAbsRight",[en],(function(){return!0})),z2=tn(P2.prototype,"_isAbsTop",[en],(function(){return!0})),X2=tn(P2.prototype,"_isAbsBottom",[en],(function(){return!0})),W2=tn(P2.prototype,"_isAbsHorizontalCenter",[en],(function(){return!0})),Y2=tn(P2.prototype,"_isAbsVerticalCenter",[en],(function(){return!0})),j2=tn(P2.prototype,"_originalWidth",[en],(function(){return 0})),K2=tn(P2.prototype,"_originalHeight",[en],(function(){return 0})),q2=tn(P2.prototype,"_alignMode",[en],(function(){return t3.ON_WINDOW_RESIZE})),Z2=tn(P2.prototype,"_lockFlags",[en,Ha],(function(){return 0})),B2=P2))||B2)||B2)||B2));We.internal.computeInverseTransForTarget=r3,We.internal.getReadonlyNodeSize=n3,We.Widget=T3;var S3,E3=new Ve;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(S3||(S3={})),Fn(S3);var A3,C3,R3,b3,x3,w3,M3,I3,B3,P3,D3,O3,F3,L3,N3,k3,U3,G3,V3,H3,z3,X3,W3,Y3,j3,K3=function(e){return t({PageViewIndicator:e,PageViewIndicatorComponent:e}),e}((s3=Ki("cc.PageViewIndicator"),a3=In(110),o3=Tn(Uo),h3=Tn(S3),l3=Tn(dn),s3(u3=a3((m3=g3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=t.length)){for(var i=0;it.length)for(i=0;i0;--i){var n=t[i-1];this.node.removeChild(n),t.splice(i-1,1)}this._layout&&this._layout.enabledInHierarchy&&this._layout.updateLayout(),this._changedState()}}},Pi(e,[{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._spriteFrame!==t&&(this._spriteFrame=t)}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t)}},{key:"cellSize",get:function(){return this._cellSize},set:function(t){this._cellSize!==t&&(this._cellSize=t)}}]),e}(Pn),g3.Direction=S3,gn((c3=m3).prototype,"spriteFrame",[o3],Object.getOwnPropertyDescriptor(c3.prototype,"spriteFrame"),c3.prototype),gn(c3.prototype,"direction",[h3],Object.getOwnPropertyDescriptor(c3.prototype,"direction"),c3.prototype),gn(c3.prototype,"cellSize",[l3],Object.getOwnPropertyDescriptor(c3.prototype,"cellSize"),c3.prototype),d3=tn(c3.prototype,"spacing",[en],(function(){return 0})),_3=tn(c3.prototype,"_spriteFrame",[en],(function(){return null})),f3=tn(c3.prototype,"_direction",[en],(function(){return S3.HORIZONTAL})),p3=tn(c3.prototype,"_cellSize",[en],(function(){return new dn(20,20)})),u3=c3))||u3)||u3));We.PageViewIndicator=K3;var q3,Z3,Q3,J3=new cn;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(q3||(q3={})),Fn(q3),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(Z3||(Z3={})),Fn(Z3),function(t){t.PAGE_TURNING="page-turning"}(Q3||(Q3={}));var $3=function(e){return t({PageView:e,PageViewComponent:e}),e}((A3=Ki("cc.PageView"),C3=In(110),R3=Tn(q3),b3=Tn(Z3),x3=Tn(K3),w3=Tn(o1),M3=Tn(o1),I3=Tn([Pa]),B3=Tn([Pa]),A3(P3=C3((j3=Y3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._pages.length)this.addPage(t);else{if(!t._uiProps.uiTransformComp)return void kr(4301);this._pages.splice(e,0,t),this.content.insertChild(t,e),this._updatePageView()}},i.removePage=function(t){if(t&&this.content){var e=this._pages.indexOf(t);-1!==e?this.removePageAtIndex(e):Zi(4300,t.name)}},i.removePageAtIndex=function(t){var e=this._pages;if(!(t<0||t>=e.length)){var i=e[t];i&&this.content&&(this.content.removeChild(i),e.splice(t,1),this._updatePageView())}},i.removeAllPages=function(){if(this.content){for(var t=this._pages,e=0,i=t.length;e=this._pages.length||(this._curPageIdx=t,this.scrollToOffset(this._moveOffsetValue(t),e,!0),this.indicator&&this.indicator._changedState())},i.getScrollEndedEventTiming=function(){return this.pageTurningEventTiming},i._updatePageView=function(){if(this.content){var t=this.content.getComponent(N0);t&&t.enabled&&t.updateLayout();var e=this._pages.length;this._curPageIdx>=e&&(this._curPageIdx=0===e?0:e-1,this._lastPageIdx=this._curPageIdx);for(var i=this._initContentPos,n=0;n0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;this.direction===Z3.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===Z3.Vertical&&(e.paddingTop=(t.height-i.height)/2,e.paddingBottom=(t.height-n.height)/2)}e.updateLayout()}}},i._initPages=function(){if(this.content){this._initContentPos=this.content.position;for(var t=this.content.children,e=0;e=0||this._pages.push(i)}this._syncScrollDirection(),this._syncSizeMode(),this._updatePageView()}},i._dispatchPageTurningEvent=function(){this._lastPageIdx!==this._curPageIdx&&(this._lastPageIdx=this._curPageIdx,Pa.emitEvents(this.pageEvents,this,Q3.PAGE_TURNING),this.node.emit(Q3.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===Z3.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===Z3.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new cn;if(this._sizeMode===q3.Free)this.direction===Z3.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===Z3.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===Z3.Horizontal?e.x=t*i.width:this.direction===Z3.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===Z3.Horizontal?0===t.x?0:t.x>0?1:-1:0===t.y?0:t.y<0?1:-1},i._isScrollable=function(t,e,i){if(this._sizeMode===q3.Free){var n=0,r=0;if(this.direction===Z3.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===Z3.Vertical)return n=this._scrollCenterOffsetY[e],r=this._scrollCenterOffsetY[i],Math.abs(t.y)>=Math.abs(n-r)*this.scrollThreshold}else{var s=this.view;if(!s)return!1;if(this.direction===Z3.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===Z3.Vertical)return Math.abs(t.y)>=s.height*this.scrollThreshold}return!1},i._autoScrollToPage=function(){if(this._startBounceBackIfNeeded()){var t=this._getHowMuchOutOfBoundary();this._clampDelta(t),(t.x>0||t.y<0)&&(this._curPageIdx=0===this._pages.length?0:this._pages.length-1),(t.x<0||t.y>0)&&(this._curPageIdx=0),this.indicator&&this.indicator._changedState()}else{var e=new cn;cn.subtract(e,this._touchBeganPosition,this._touchEndPosition);var i=this._curPageIdx,n=i+this._getDragDirection(e),r=this.pageTurningSpeed*Math.abs(i-n);if(n1e-10?e:t}var n=t.node,r=n.parent;if(r){var s=r8;s.set(0,0);var a=s8;if(a.set(1,1),t.target&&r3(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._uiProps.uiTransformComp,h=o?o.anchorPoint:e8,l=n._uiProps.uiTransformComp,u=n3(r),c=l.anchorPoint,d=n.getPosition(),_=e3,f=n.getScale(),p=0;if(e&_.LEFT){var g=-h.x*u.width;g+=s.x,g*=a.x,p=d.x-c.x*l.width*Math.abs(f.x)-g,t.isAbsoluteLeft||(p/=u.width),p/=a.x,t.left=i(t.left,p)}if(e&_.RIGHT){var m=(1-h.x)*u.width;m+=s.x,p=(m*=a.x)-(d.x+(1-c.x)*l.width*Math.abs(f.x)),t.isAbsoluteRight||(p/=u.width),p/=a.x,t.right=i(t.right,p)}if(e&_.TOP){var v=(1-h.y)*u.height;v+=s.y,p=(v*=a.y)-(d.y+(1-c.y)*l.height*Math.abs(f.y)),t.isAbsoluteTop||(p/=u.height),p/=a.y,t.top=i(t.top,p)}if(e&_.BOT){var y=-h.y*u.height;y+=s.y,y*=a.y,p=d.y-c.y*l.height*Math.abs(f.y)-y,t.isAbsoluteBottom||(p/=u.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&Pr.isNode(i)&&t(i);var n=e.getComponent(T3);n&&i&&a8(e,n)},AlignMode:t3,AlignFlags:e3});Di.on(An.EVENT_INIT,(function(){c8.init()}));var d8,_8,f8,p8,g8,m8,v8,y8,T8,S8,E8,A8,C8=function(e){return t({SafeArea:e,SafeAreaComponent:e}),e}(Ki("cc.SafeArea")(l8=In(110)(l8=kn(T3)(l8=function(t){function e(){return t.apply(this,arguments)||this}He(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),Er.on("window-resize",this.updateArea,this),Er.on("orientation-change",this.updateArea,this)},i.onDisable=function(){Er.off("window-resize",this.updateArea,this),Er.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(T3),e=this.node.getComponent(Bl);if(t&&e){t.updateAlignment();var i=this.node.position.clone(),n=e.anchorPoint.clone();t.isAlignTop=t.isAlignBottom=t.isAlignLeft=t.isAlignRight=!0;var r=V_.getVisibleSize(),s=r.width,a=r.height,o=rn.getSafeAreaRect();t.top=a-o.y-o.height,t.bottom=o.y,t.left=o.x,t.right=s-o.x-o.width,t.updateAlignment();var h=this.node.position.clone(),l=n.x-(h.x-i.x)/e.width,u=n.y-(h.y-i.y)/e.height;e.setAnchorPoint(l,u),c8.add(t)}},e}(Pn))||l8)||l8)||l8);We.SafeArea=C8;var R8,b8=function(e){return t({UICoordinateTracker:e,UICoordinateTrackerComponent:e}),e}((d8=Ki("cc.UICoordinateTracker"),_8=In(110),f8=Tn(Pr),p8=Tn(D_),g8=Tn([Pa]),d8(m8=_8((v8=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0)){var i=this._distance/Math.abs(this._viewPos.z);Pa.emitEvents(this.syncEvents,this._transformPos,i)}},i._checkCanMove=function(){this._canMove=!(!this._camera||!this._target)},Pi(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._target=t,this._checkCanMove())}},{key:"camera",get:function(){return this._camera},set:function(t){this._camera!==t&&(this._camera=t,this._checkCanMove())}},{key:"useScale",get:function(){return this._useScale},set:function(t){this._useScale!==t&&(this._useScale=t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance!==t&&(this._distance=t)}}]),e}(Pn),gn(v8.prototype,"target",[f8],Object.getOwnPropertyDescriptor(v8.prototype,"target"),v8.prototype),gn(v8.prototype,"camera",[p8],Object.getOwnPropertyDescriptor(v8.prototype,"camera"),v8.prototype),y8=tn(v8.prototype,"syncEvents",[g8,en],(function(){return[]})),T8=tn(v8.prototype,"_target",[en],(function(){return null})),S8=tn(v8.prototype,"_camera",[en],(function(){return null})),E8=tn(v8.prototype,"_useScale",[en],(function(){return!0})),A8=tn(v8.prototype,"_distance",[en],(function(){return 1})),m8=v8))||m8)||m8)),x8=[xn.TOUCH_START,xn.TOUCH_END,xn.TOUCH_MOVE,xn.MOUSE_DOWN,xn.MOUSE_MOVE,xn.MOUSE_UP,xn.MOUSE_ENTER,xn.MOUSE_LEAVE,xn.MOUSE_WHEEL];function w8(t){t.propagationStopped=!0}var M8,I8,B8,P8,D8,O8=function(e){return t({BlockInputEvents:e,BlockInputEventsComponent:e}),e}(Ki("cc.BlockInputEvents")(R8=function(t){function e(){return t.apply(this,arguments)||this}He(e,t);var i=e.prototype;return i.onEnable=function(){for(var t=0;tn?n:i;e.width*=r,e.height*=r;var s=V_.getViewportRect(),a=e.getBoundingBoxToWorld(),o=V_.getVisibleSize(),h=Er.devicePixelRatio,l=(s.width*(a.x/o.width)+s.x)/h,u=(s.height*(a.y/o.height)+s.y)/h,c=s.width*(a.width/o.width)/h,d=s.height*(a.height/o.height)/h;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:l,y:u,width:c,height:d})}},i._updateSubContextTexture=function(){var t=this._imageAsset;if(t&&this._openDataContext&&!(t.width<=0||t.height<=0)){var e=this._openDataContext.canvas;t.reset(e),(e.width>t.width||e.height>t.height)&&this._texture.create(e.width,e.height),this._texture.uploadData(e)}},i._registerNodeEvent=function(){this.node.on(xn.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(xn.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(xn.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(xn.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(xn.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(xn.LAYER_CHANGED,this._updateContentLayer,this)},i._updateContentLayer=function(){this._content.layer=this.node.layer},i.update=function(t){void 0===t?this._updateSubContextTexture():performance.now()-this._updatedTime>=this._updateInterval&&(this._updatedTime+=this._updateInterval,this._updateSubContextTexture())},i.onDestroy=function(){this._content.destroy(),this._texture.destroy(),this._sprite&&this._sprite.destroy(),this._imageAsset.destroy(),this._openDataContext=null},Pi(e,[{key:"designResolutionSize",get:function(){return this._designResolutionSize},set:function(){}},{key:"fps",get:function(){return this._fps},set:function(t){this._fps!==t&&(this._fps=t,this._updateInterval=1e3/t)}}]),e}(Pn),B8=tn(I8.prototype,"_fps",[en],(function(){return 60})),P8=tn(I8.prototype,"_designResolutionSize",[en],(function(){return new dn(640,960)})),M8=I8))||M8)||M8)||M8);We.SubContextView=F8,_r({ButtonComponent:{newName:"Button",since:"1.2.0",removed:!1},EditBoxComponent:{newName:"EditBox",since:"1.2.0",removed:!1},LayoutComponent:{newName:"Layout",since:"1.2.0",removed:!1},ProgressBarComponent:{newName:"ProgressBar",since:"1.2.0",removed:!1},ScrollViewComponent:{newName:"ScrollView",since:"1.2.0",removed:!1},ScrollBarComponent:{newName:"ScrollBar",since:"1.2.0",removed:!1},SliderComponent:{newName:"Slider",since:"1.2.0",removed:!1},ToggleComponent:{newName:"Toggle",since:"1.2.0",removed:!1},ToggleContainerComponent:{newName:"ToggleContainer",since:"1.2.0",removed:!1},WidgetComponent:{newName:"Widget",since:"1.2.0",removed:!1},PageViewComponent:{newName:"PageView",since:"1.2.0",removed:!1},PageViewIndicatorComponent:{newName:"PageViewIndicator",since:"1.2.0",removed:!1},SafeAreaComponent:{newName:"SafeArea",since:"1.2.0",removed:!1},UICoordinateTrackerComponent:{newName:"UICoordinateTracker",since:"1.2.0",removed:!1},BlockInputEventsComponent:{newName:"BlockInputEvents",since:"1.2.0",removed:!1}});var L8=t("UIReorderComponent",Ki("cc.UIReorderComponent")(D8=function(){Zi(1408,"UIReorderComponent")})||D8);We.UIReorderComponent=L8,We.ButtonComponent=qJ,br(qJ,"cc.ButtonComponent"),We.EditBoxComponent=T0,br(T0,"cc.EditBoxComponent"),We.LayoutComponent=N0,br(N0,"cc.LayoutComponent"),We.ProgressBarComponent=J0,br(J0,"cc.ProgressBarComponent"),We.ScrollViewComponent=t2,br(t2,"cc.ScrollViewComponent"),We.ScrollBarComponent=o1,br(o1,"cc.ScrollBarComponent"),We.SliderComponent=g2,br(g2,"cc.SliderComponent"),We.ToggleComponent=R2,br(R2,"cc.ToggleComponent"),We.ToggleContainerComponent=$2,br($2,"cc.ToggleContainerComponent"),We.WidgetComponent=T3,br(T3,"cc.WidgetComponent"),We.PageViewComponent=$3,br($3,"cc.PageViewComponent"),We.PageViewIndicatorComponent=K3,br(K3,"cc.PageViewIndicatorComponent"),We.SafeAreaComponent=C8,br(C8,"cc.SafeAreaComponent"),br(b8,"cc.UICoordinateTrackerComponent"),We.BlockInputEventsComponent=O8,br(O8,"cc.BlockInputEventsComponent"),Vn(L_.prototype,"View.prototype",[{name:"isAntiAliasEnabled",suggest:"The API of Texture2d have been largely modified, no alternative"},{name:"enableAntiAlias",suggest:"The API of Texture2d have been largely modified, no alternative"}]),Rr(L_.prototype,"View.prototype",[{name:"adjustViewportMeta"},{name:"enableAutoFullScreen",suggest:"use screen.requestFullScreen() instead."},{name:"isAutoFullScreenEnabled"},{name:"setCanvasSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getCanvasSize",suggest:"please use screen.windowSize instead."},{name:"getFrameSize",suggest:"getting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"setFrameSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getDevicePixelRatio",suggest:"use screen.devicePixelRatio instead."},{name:"convertToLocationInView"},{name:"enableRetina"},{name:"isRetinaEnabled"},{name:"setRealPixelResolution"}])}}}));