@fps-games/editor-deployment 0.2.3-beta.5 → 0.2.3-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/fps-editor-agent.mjs +5 -0
- package/bin/fps-editor-prepare.mjs +3 -3
- package/bin/fps-editor-project.mjs +14 -14
- package/bin/fps-editor-server.mjs +1 -1
- package/licenses/THIRD_PARTY_NOTICES.txt +2 -2
- package/manifest.json +225 -219
- package/npm-shrinkwrap.json +4 -3
- package/package.json +7 -6
- package/public/assets/animation-BJ8XM1EP.js.gz +0 -0
- package/public/assets/animationGroup-nIU37qTl.js.gz +0 -0
- package/public/assets/arcRotateCamera-Bpb6_-jM.js.gz +0 -0
- package/public/assets/babylon-core-B6Ot-GOK.js.gz +0 -0
- package/public/assets/babylon-core-DBdQTkWG.js.gz +0 -0
- package/public/assets/basisTextureLoader-xaH1TU2T.js.gz +0 -0
- package/public/assets/bumpVertex-CydMViY3.js.gz +0 -0
- package/public/assets/bumpVertex-bM0VcD-v.js.gz +0 -0
- package/public/assets/chromaticAberration.fragment-2LQpSY6n.js.gz +0 -0
- package/public/assets/chromaticAberration.fragment-CPC2jGBk.js.gz +0 -0
- package/public/assets/circleOfConfusion.fragment-DWehhKOk.js.gz +0 -0
- package/public/assets/circleOfConfusion.fragment-WIeIzKLd.js.gz +0 -0
- package/public/assets/clipPlaneFragment-BQiHvjzo.js.gz +0 -0
- package/public/assets/clipPlaneVertex-D5EB-X5S.js.gz +0 -0
- package/public/assets/color.fragment-0xZe_dSa.js.gz +0 -0
- package/public/assets/color.fragment-BQNpLnxa.js.gz +0 -0
- package/public/assets/color.vertex-0geH1BI8.js.gz +0 -0
- package/public/assets/color.vertex-qtb2-mc5.js.gz +0 -0
- package/public/assets/dds-IzbrFkh8.js.gz +0 -0
- package/public/assets/ddsTextureLoader-D3ROWbwv.js.gz +0 -0
- package/public/assets/default.fragment-BAHNlmD5.js.gz +0 -0
- package/public/assets/default.fragment-D3MA9CRV.js.gz +0 -0
- package/public/assets/default.vertex-B1KwtIUb.js.gz +0 -0
- package/public/assets/default.vertex-Mne8Sq_G.js.gz +0 -0
- package/public/assets/defaultUboDeclaration-00t3po2f.js.gz +0 -0
- package/public/assets/defaultUboDeclaration-DAuovVEA.js.gz +0 -0
- package/public/assets/depth.fragment-Da86gbwP.js.gz +0 -0
- package/public/assets/depth.vertex-DPT_V_9f.js.gz +0 -0
- package/public/assets/depthBoxBlur.fragment-tYNfbhdh.js.gz +0 -0
- package/public/assets/depthBoxBlur.fragment-zrJ9DLe5.js.gz +0 -0
- package/public/assets/depthOfFieldMerge.fragment-Car-ami-.js.gz +0 -0
- package/public/assets/depthOfFieldMerge.fragment-eO7Ot6AR.js.gz +0 -0
- package/public/assets/easing-BdugUZqW.js.gz +0 -0
- package/public/assets/editor-core-plugin-host-c2002442.js.gz +0 -0
- package/public/assets/exrTextureLoader-DYq9r93V.js.gz +0 -0
- package/public/assets/flowGraphArrayIndexBlock-C3zDMjuo.js.gz +0 -0
- package/public/assets/flowGraphBezierCurveEasingBlock-DDoK8_8l.js.gz +0 -0
- package/public/assets/flowGraphBinaryOperationBlock-BKlR9DS-.js.gz +0 -0
- package/public/assets/flowGraphBranchBlock-Bup839Qd.js.gz +0 -0
- package/public/assets/flowGraphCachedOperationBlock-DnmbMTY7.js.gz +0 -0
- package/public/assets/flowGraphCancelDelayBlock-B9MfNdwj.js.gz +0 -0
- package/public/assets/flowGraphCodeExecutionBlock-auEOflkO.js.gz +0 -0
- package/public/assets/flowGraphConditionalDataBlock-BAia9WED.js.gz +0 -0
- package/public/assets/flowGraphConsoleLogBlock--6MvrOCG.js.gz +0 -0
- package/public/assets/flowGraphConstantBlock-FOfDeLIf.js.gz +0 -0
- package/public/assets/flowGraphContextBlock-BP5dmyKZ.js.gz +0 -0
- package/public/assets/flowGraphCounterBlock-DjKMvUGB.js.gz +0 -0
- package/public/assets/flowGraphDataSwitchBlock-gSJm410f.js.gz +0 -0
- package/public/assets/flowGraphDebounceBlock-CO5ptvWG.js.gz +0 -0
- package/public/assets/flowGraphDoNBlock-Bf26kum1.js.gz +0 -0
- package/public/assets/flowGraphEasingBlock-DtnL-aP_.js.gz +0 -0
- package/public/assets/flowGraphFlipFlopBlock-Bh_IN41P.js.gz +0 -0
- package/public/assets/flowGraphForLoopBlock-C3CLz9Iv.js.gz +0 -0
- package/public/assets/flowGraphFunctionReferenceBlock-Bz40tn10.js.gz +0 -0
- package/public/assets/flowGraphGetAssetBlock-DYP1H9Hj.js.gz +0 -0
- package/public/assets/flowGraphGetPropertyBlock-B6XVNxDR.js.gz +0 -0
- package/public/assets/flowGraphGetVariableBlock-BvaNDTu7.js.gz +0 -0
- package/public/assets/flowGraphIndexOfBlock-qm1Ab3oN.js.gz +0 -0
- package/public/assets/flowGraphInterpolationBlock-CmG25tSZ.js.gz +0 -0
- package/public/assets/flowGraphJsonPointerParserBlock-C8rfhc4j.js.gz +0 -0
- package/public/assets/flowGraphMathBlocks-BdiMH3MQ.js.gz +0 -0
- package/public/assets/flowGraphMathCombineExtractBlocks-CXvPWL3b.js.gz +0 -0
- package/public/assets/flowGraphMatrixMathBlocks-Cal7WQ7i.js.gz +0 -0
- package/public/assets/flowGraphMeshPickEventBlock-B8EU7KmL.js.gz +0 -0
- package/public/assets/flowGraphMultiGateBlock-GMcU5jv7.js.gz +0 -0
- package/public/assets/flowGraphPauseAnimationBlock-BKUeGFEQ.js.gz +0 -0
- package/public/assets/flowGraphPlayAnimationBlock-vvCkTY_Z.js.gz +0 -0
- package/public/assets/flowGraphPointerOutEventBlock-EEJ78HAF.js.gz +0 -0
- package/public/assets/flowGraphPointerOverEventBlock-QMzEzISN.js.gz +0 -0
- package/public/assets/flowGraphReceiveCustomEventBlock-B5jEx7xE.js.gz +0 -0
- package/public/assets/flowGraphSceneReadyEventBlock-MjViOZsL.js.gz +0 -0
- package/public/assets/flowGraphSceneTickEventBlock-lyjGPNYo.js.gz +0 -0
- package/public/assets/flowGraphSendCustomEventBlock-M0LLhV7D.js.gz +0 -0
- package/public/assets/flowGraphSequenceBlock-DocFLI4M.js.gz +0 -0
- package/public/assets/flowGraphSetDelayBlock-BDoJj0I_.js.gz +0 -0
- package/public/assets/flowGraphSetPropertyBlock-9jao3AHa.js.gz +0 -0
- package/public/assets/flowGraphSetVariableBlock-buwJMv9v.js.gz +0 -0
- package/public/assets/flowGraphStopAnimationBlock-CDWhmsC8.js.gz +0 -0
- package/public/assets/flowGraphSwitchBlock-DG5ReWET.js.gz +0 -0
- package/public/assets/flowGraphThrottleBlock-Bgyx9UOo.js.gz +0 -0
- package/public/assets/flowGraphTransformCoordinatesSystemBlock-CUUmRj2j.js.gz +0 -0
- package/public/assets/flowGraphTypeToTypeBlocks-D7N8ZT_V.js.gz +0 -0
- package/public/assets/flowGraphUnaryOperationBlock-Bu73VxMC.js.gz +0 -0
- package/public/assets/flowGraphVectorMathBlocks-CqVzbdAw.js.gz +0 -0
- package/public/assets/flowGraphWaitAllBlock-xmBmiluG.js.gz +0 -0
- package/public/assets/flowGraphWhileLoopBlock-Ct2rHXgO.js.gz +0 -0
- package/public/assets/fogFragmentDeclaration-C-9jZMBi.js.gz +0 -0
- package/public/assets/fogFragmentDeclaration-CpAbKvc3.js.gz +0 -0
- package/public/assets/glowBlurPostProcess.fragment-C77x1kl1.js.gz +0 -0
- package/public/assets/glowBlurPostProcess.fragment-C7miknry.js.gz +0 -0
- package/public/assets/glowMapGeneration.fragment-BAqrUGS4.js.gz +0 -0
- package/public/assets/glowMapGeneration.fragment-CMvy-ILZ.js.gz +0 -0
- package/public/assets/glowMapGeneration.vertex-BThT8Jce.js.gz +0 -0
- package/public/assets/glowMapGeneration.vertex-mq9WR5EZ.js.gz +0 -0
- package/public/assets/glowMapMerge.fragment-BtMIQDli.js.gz +0 -0
- package/public/assets/glowMapMerge.fragment-CYj1SIfc.js.gz +0 -0
- package/public/assets/glowMapMerge.vertex-BilMgMCX.js.gz +0 -0
- package/public/assets/glowMapMerge.vertex-ChJNqQPz.js.gz +0 -0
- package/public/assets/grain.fragment-D6WdAOpZ.js.gz +0 -0
- package/public/assets/grain.fragment-DCpxKIZw.js.gz +0 -0
- package/public/assets/harmonicsFunctions-B5nauyTb.js.gz +0 -0
- package/public/assets/harmonicsFunctions-DVIRrUZs.js.gz +0 -0
- package/public/assets/hdrTextureLoader-Dfs_Fv5B.js.gz +0 -0
- package/public/assets/hemisphericLight-BkYyeXbK.js.gz +0 -0
- package/public/assets/iesTextureLoader-I2E-BXCc.js.gz +0 -0
- package/public/assets/index-CzHwtW4R.js.gz +0 -0
- package/public/assets/index-Dk6-vu7X.js +1 -0
- package/public/assets/index-Dk6-vu7X.js.br +0 -0
- package/public/assets/index-Dk6-vu7X.js.gz +0 -0
- package/public/assets/instancesDeclaration-DcwHJpHY.js.gz +0 -0
- package/public/assets/ktxTextureLoader-zpgT--10.js.gz +0 -0
- package/public/assets/lazy-CI-V5lCV.js.gz +0 -0
- package/public/assets/lod.fragment-B28SQFUx.js.gz +0 -0
- package/public/assets/lod.fragment-DOjU_E37.js.gz +0 -0
- package/public/assets/lodCube.fragment-B_ALsGmh.js.gz +0 -0
- package/public/assets/lodCube.fragment-CzeVIOa3.js.gz +0 -0
- package/public/assets/logDepthFragment-BaJ2YjZ0.js.gz +0 -0
- package/public/assets/logDepthVertex-B8jNoEwN.js.gz +0 -0
- package/public/assets/logDepthVertex-xgQTn7wg.js.gz +0 -0
- package/public/assets/mesh.vertexData.functions-BXkNVxNr.js.gz +0 -0
- package/public/assets/meshUboDeclaration-C5p-TivH.js.gz +0 -0
- package/public/assets/meshUboDeclaration-DKldQKni.js.gz +0 -0
- package/public/assets/morphTargetsVertex-BDbfSote.js.gz +0 -0
- package/public/assets/oitFinalSimpleBlend.fragment-DtE63qrD.js.gz +0 -0
- package/public/assets/oitFinalSimpleBlend.fragment-ZwpH3v_v.js.gz +0 -0
- package/public/assets/oitFragment-B8hFhX-8.js.gz +0 -0
- package/public/assets/oitFragment-B_HlWcYZ.js.gz +0 -0
- package/public/assets/openpbrMaterial-t_lYoXh4.js.gz +0 -0
- package/public/assets/outline.fragment-DEsg98mo.js.gz +0 -0
- package/public/assets/outline.fragment-WqsugjI-.js.gz +0 -0
- package/public/assets/outline.vertex-CVL3AfNh.js.gz +0 -0
- package/public/assets/outline.vertex-CtQ-HC3X.js.gz +0 -0
- package/public/assets/passCube.fragment-CHI4OPgd.js.gz +0 -0
- package/public/assets/passCube.fragment-DLbzh6pI.js.gz +0 -0
- package/public/assets/pbr.fragment-DHPEcGrm.js.gz +0 -0
- package/public/assets/pbr.fragment-KiX_RvyZ.js.gz +0 -0
- package/public/assets/pbr.vertex-CVSRg4tx.js.gz +0 -0
- package/public/assets/pbr.vertex-Dp30Rtkl.js.gz +0 -0
- package/public/assets/playable-sdk-Cz5ms1M8.js +8 -0
- package/public/assets/playable-sdk-Cz5ms1M8.js.br +0 -0
- package/public/assets/playable-sdk-Cz5ms1M8.js.gz +0 -0
- package/public/assets/playable-standard-project-CgBNJ6kY.js +5070 -0
- package/public/assets/playable-standard-project-CgBNJ6kY.js.br +0 -0
- package/public/assets/playable-standard-project-CgBNJ6kY.js.gz +0 -0
- package/public/assets/rgbdDecode.fragment-CU4ChTYE.js.gz +0 -0
- package/public/assets/rgbdDecode.fragment-DhrCd3U4.js.gz +0 -0
- package/public/assets/rgbdEncode.fragment-Bt1zaovT.js.gz +0 -0
- package/public/assets/rgbdEncode.fragment-CfKDkRU3.js.gz +0 -0
- package/public/assets/sceneLoader-DS5g2vTC.js.gz +0 -0
- package/public/assets/screenSpaceCurvature.fragment-Od67z-rQ.js.gz +0 -0
- package/public/assets/selection.fragment-CRMhdE35.js.gz +0 -0
- package/public/assets/selection.fragment-cSqXB6nx.js.gz +0 -0
- package/public/assets/selection.vertex-B5sPJWi2.js.gz +0 -0
- package/public/assets/selection.vertex-Dp4qd1GF.js.gz +0 -0
- package/public/assets/selectionOutline.fragment-CaYdhbIY.js.gz +0 -0
- package/public/assets/selectionOutline.fragment-RBpUe89m.js.gz +0 -0
- package/public/assets/shadowMap.fragment-BecpzSny.js.gz +0 -0
- package/public/assets/shadowMap.fragment-BhrOFpmK.js.gz +0 -0
- package/public/assets/shadowMap.vertex-DV4Ec23Y.js.gz +0 -0
- package/public/assets/shadowMap.vertex-Dpx2-6XS.js.gz +0 -0
- package/public/assets/shadowMapFragmentSoftTransparentShadow-BHumE7-J.js.gz +0 -0
- package/public/assets/shadowMapFragmentSoftTransparentShadow-CrPC6Hns.js.gz +0 -0
- package/public/assets/sharpen.fragment-CPdQPlDe.js.gz +0 -0
- package/public/assets/textureMerger.fragment-BNxx2w1v.js.gz +0 -0
- package/public/assets/textureMerger.fragment-CPq4n9w5.js.gz +0 -0
- package/public/assets/tgaTextureLoader-B7dlONGx.js.gz +0 -0
- package/public/assets/vertexColorMixing-BUQkJeP0.js.gz +0 -0
- package/public/assets/vertexColorMixing-Co5x3WYA.js.gz +0 -0
- package/public/assets/volumetricLightingBlendVolume.fragment-D01l1w1u.js.gz +0 -0
- package/public/assets/volumetricLightingBlendVolume.fragment-Dq5kceRW.js.gz +0 -0
- package/public/assets/volumetricLightingRenderVolume.fragment-BCxtzv0C.js.gz +0 -0
- package/public/assets/volumetricLightingRenderVolume.fragment-DwEKCs2S.js.gz +0 -0
- package/public/assets/volumetricLightingRenderVolume.vertex-CNPaSIo7.js.gz +0 -0
- package/public/assets/volumetricLightingRenderVolume.vertex-EiQlWi_X.js.gz +0 -0
- package/public/assets/webAudioBus-DYpSKoOA.js.gz +0 -0
- package/public/assets/webAudioMainBus-CP3f56US.js.gz +0 -0
- package/public/assets/workerPool-H9Ji3mCo.js.gz +0 -0
- package/public/index.html +3 -3
- package/public/index.html.br +0 -0
- package/public/index.html.gz +0 -0
- package/runtime/editor-control-plane.mjs +3 -3
- package/worker/editor-service-worker.mjs +23 -23
- package/public/assets/index-ZnhNI5EO.js +0 -1
- package/public/assets/index-ZnhNI5EO.js.br +0 -0
- package/public/assets/index-ZnhNI5EO.js.gz +0 -0
- package/public/assets/playable-sdk-D6RL-8B7.js +0 -135
- package/public/assets/playable-sdk-D6RL-8B7.js.br +0 -0
- package/public/assets/playable-sdk-D6RL-8B7.js.gz +0 -0
- package/public/assets/playable-standard-project-CkKWpnr-.js +0 -4943
- package/public/assets/playable-standard-project-CkKWpnr-.js.br +0 -0
- package/public/assets/playable-standard-project-CkKWpnr-.js.gz +0 -0
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import{mg as on,lZ as Qo,l_ as es,nd as ts,m0 as rs,g$ as _a,a6 as _n,a5 as ns,kg as Te,b4 as We,m2 as Le,mh as ce,m7 as tr,ke as as,m8 as le,mx as os,mn as ss,me as Ue,mk as is,mm as Xe,lb as Y,mv as yr,kf as ls,n$ as On,L as cs,M as ds,lh as Hr,lv as us,li as Nn,cC as ms,gx as fs,jY as ps,h$ as hs,kK as gs,ju as bs,kD as Ss,mi as Ge,mu as he,jo as ys,ao as jn,gB as Es,kp as ws,au as pt,mb as xt,aw as ke,l4 as Ps,gj as Is,gu as As,d2 as Cs,bE as xs,mO as vs,ot as Ms,k4 as Rs,hO as Ts,gH as re,cL as Ln,dp as ks,ou as Ds,ka as _s,ik as Os,kE as Ns,kd as js,gJ as Ls,hC as Bs,eF as zs,cM as Gs,dt as Fs,gb as Bn,ds as $s,dw as Us,ch as Vs,dk as Hs,cd as qs,cf as Ys,ci as Ws,cg as Ks,cj as Js,ck as Xs,w as Zs,p as O,ld as Qs,o7 as ei,ce as ti,o6 as ri,o8 as ni,hT as ai,n as oi,o as si,r as ii,E as zn,s as li,lz as Oa,bF as Na,bC as ci,n1 as di,lF as ui,hd as mi,h1 as fi,h0 as pi,k8 as hi,oq as gi,h2 as bi,D as Si,dn as yi,ly as Ei,lW as wi,a8 as Pi,b5 as Ii,nK as ja,oy as Ai,js as La,hM as Ci,jR as xi,mR as vi,jq as Mi,jr as Ri,jp as Ti,mp as ki,be as rt,fL as Di,q as _i,t as Oi,u as Ni,nq as ji,ky as Li,fQ as Ba,ah as Bi,aV as St,nE as zi,gR as Oe,bP as Gi,bO as Fi,g5 as $i,cr as Ui,c2 as Vi,ff as Hi,bH as qi,b_ as Yi,b$ as Wi,g2 as za,g1 as Ki,eH as Ji,dm as Xi,eT as Ga,mN as Zi,nt as qr,fV as Qi,g3 as el,g4 as tl,fU as Fa,ht as rl,am as Gn,nv as nl,ak as al}from"./playable-standard-project-CkKWpnr-.js";import{C as Hp,a as qp,b as Yp,c as Wp,d as Kp,e as Jp,f as Xp,g as Zp,h as Qp,i as eh,j as th,k as rh,l as nh,m as ah,v as oh,x as sh,y as ih,z as lh,A as ch,B as dh,F as uh,G as mh,H as fh,I as ph,J as hh,K as gh,N as bh,O as Sh,P as yh,Q as Eh,R as wh,S as Ph,T as Ih,U as Ah,V as Ch,W as xh,X as vh,Y as Mh,Z as Rh,_ as Th,$ as kh,a0 as Dh,a1 as _h,a2 as Oh,a3 as Nh,a4 as jh,a7 as Lh,a9 as Bh,aa as zh,ab as Gh,ac as Fh,ad as $h,ae as Uh,af as Vh,ag as Hh,ai as qh,aj as Yh,al as Wh,an as Kh,ap as Jh,aq as Xh,ar as Zh,as as Qh,at as eg,av as tg,ax as rg,ay as ng,az as ag,aA as og,aB as sg,aC as ig,aD as lg,aE as cg,aF as dg,aG as ug,aH as mg,aI as fg,aJ as pg,aK as hg,aL as gg,aM as bg,aN as Sg,aO as yg,aP as Eg,aQ as wg,aR as Pg,aS as Ig,aT as Ag,aU as Cg,aW as xg,aX as vg,aY as Mg,aZ as Rg,a_ as Tg,a$ as kg,b0 as Dg,b1 as _g,b2 as Og,b3 as Ng,b6 as jg,b7 as Lg,b8 as Bg,b9 as zg,ba as Gg,bb as Fg,bc as $g,bd as Ug,bf as Vg,bg as Hg,bh as qg,bi as Yg,bj as Wg,bk as Kg,bl as Jg,bm as Xg,bn as Zg,bo as Qg,bp as eb,bq as tb,br as rb,bs as nb,bt as ab,bu as ob,bv as sb,bw as ib,bx as lb,by as cb,bz as db,bA as ub,bB as mb,bD as fb,bG as pb,bI as hb,bJ as gb,bK as bb,bL as Sb,bM as yb,bN as Eb,bQ as wb,bR as Pb,bS as Ib,bT as Ab,bU as Cb,bV as xb,bW as vb,bX as Mb,bY as Rb,bZ as Tb,c0 as kb,c1 as Db,c3 as _b,c4 as Ob,c5 as Nb,c6 as jb,c7 as Lb,c8 as Bb,c9 as zb,ca as Gb,cb as Fb,cc as $b,cl as Ub,cm as Vb,cn as Hb,co as qb,cp as Yb,cq as Wb,cs as Kb,ct as Jb,cu as Xb,cv as Zb,cw as Qb,cx as eS,cy as tS,cz as rS,cA as nS,cB as aS,cD as oS,cE as sS,cF as iS,cG as lS,cH as cS,cI as dS,cJ as uS,cK as mS,cN as fS,cO as pS,cP as hS,cQ as gS,cR as bS,cS as SS,cT as yS,cU as ES,cV as wS,cW as PS,cX as IS,cY as AS,cZ as CS,c_ as xS,c$ as vS,d0 as MS,d1 as RS,d3 as TS,d4 as kS,d5 as DS,d6 as _S,d7 as OS,d8 as NS,d9 as jS,da as LS,db as BS,dc as zS,dd as GS,de as FS,df as $S,dg as US,dh as VS,di as HS,dj as qS,dl as YS,dq as WS,dr as KS,du as JS,dv as XS,dx as ZS,dy as QS,dz as ey,dA as ty,dB as ry,dC as ny,dD as ay,dE as oy,dF as sy,dG as iy,dH as ly,dI as cy,dJ as dy,dK as uy,dL as my,dM as fy,dN as py,dO as hy,dP as gy,dQ as by,dR as Sy,dS as yy,dT as Ey,dU as wy,dV as Py,dW as Iy,dX as Ay,dY as Cy,dZ as xy,d_ as vy,d$ as My,e0 as Ry,e1 as Ty,e2 as ky,e3 as Dy,e4 as _y,e5 as Oy,e6 as Ny,e7 as jy,e8 as Ly,e9 as By,ea as zy,eb as Gy,ec as Fy,ed as $y,ee as Uy,ef as Vy,eg as Hy,eh as qy,ei as Yy,ej as Wy,ek as Ky,el as Jy,em as Xy,en as Zy,eo as Qy,ep as eE,eq as tE,er as rE,es as nE,et as aE,eu as oE,ev as sE,ew as iE,ex as lE,ey as cE,ez as dE,eA as uE,eB as mE,eC as fE,eD as pE,eE as hE,eG as gE,eI as bE,eJ as SE,eK as yE,eL as EE,eM as wE,eN as PE,eO as IE,eP as AE,eQ as CE,eR as xE,eS as vE,eU as ME,eV as RE,eW as TE,eX as kE,eY as DE,eZ as _E,e_ as OE,e$ as NE,f0 as jE,f1 as LE,f2 as BE,f3 as zE,f4 as GE,f5 as FE,f6 as $E,f7 as UE,f8 as VE,f9 as HE,fa as qE,fb as YE,fc as WE,fd as KE,fe as JE,fg as XE,fh as ZE,fi as QE,fj as ew,fk as tw,fl as rw,fm as nw,fn as aw,fo as ow,fp as sw,fq as iw,fr as lw,fs as cw,ft as dw,fu as uw,fv as mw,fw,fx as pw,fy as hw,fz as gw,fA as bw,fB as Sw,fC as yw,fD as Ew,fE as ww,fF as Pw,fG as Iw,fH as Aw,fI as Cw,fJ as xw,fK as vw,fM as Mw,fN as Rw,fO as Tw,fP as kw,fR as Dw,fS as _w,fT as Ow,fW as Nw,fX as jw,fY as Lw,fZ as Bw,f_ as zw,f$ as Gw,g0 as Fw,g6 as $w,g7 as Uw,g8 as Vw,g9 as Hw,ga as qw,gc as Yw,gd as Ww,ge as Kw,gf as Jw,gi as Xw,gk as Zw,gl as Qw,gm as eP,gn as tP,go as rP,gp as nP,gq as aP,gr as oP,gs as sP,gt as iP,gv as lP,gw as cP,gy as dP,gz as uP,gA as mP,gC as fP,gD as pP,gE as hP,gF as gP,gG as bP,gI as SP,gK as yP,gL as EP,gM as wP,gN as PP,gO as IP,gP as AP,gQ as CP,gS as xP,gT as vP,gU as MP,gV as RP,gW as TP,gX as kP,gY as DP,gZ as _P,g_ as OP,h3 as NP,h4 as jP,h5 as LP,h6 as BP,h7 as zP,h8 as GP,h9 as FP,ha as $P,hb as UP,hc as VP,he as HP,hf as qP,hg as YP,hh as WP,hi as KP,hj as JP,hk as XP,hl as ZP,hm as QP,hn as eI,ho as tI,hp as rI,hs as nI,hq as aI,hr as oI,hu as sI,hv as iI,hw as lI,hx as cI,hy as dI,hz as uI,hA as mI,hB as fI,hD as pI,hE as hI,hF as gI,hG as bI,hH as SI,hI as yI,hJ as EI,hK as wI,hL as PI,hN as II,hP as AI,hQ as CI,hR as xI,hS as vI,hU as MI,hV as RI,hW as TI,hX as kI,hY as DI,hZ as _I,h_ as OI,i0 as NI,i1 as jI,i2 as LI,i3 as BI,i4 as zI,i5 as GI,i6 as FI,i7 as $I,i8 as UI,i9 as VI,ia as HI,ib as qI,ic as YI,id as WI,ie as KI,ig as JI,ih as XI,ii as ZI,ij as QI,il as eA,im as tA,io as rA,ip as nA,iq as aA,ir as oA,is as sA,it as iA,iu as lA,iv as cA,iw as dA,ix as uA,iy as mA,iz as fA,iA as pA,iB as hA,iC as gA,iD as bA,iE as SA,iF as yA,iG as EA,iH as wA,iI as PA,iJ as IA,iK as AA,iL as CA,iM as xA,iN as vA,iP as MA,iQ as RA,iR as TA,iS as kA,iT as DA,iO as _A,iU as OA,iV as NA,iW as jA,iX as LA,iY as BA,iZ as zA,i_ as GA,i$ as FA,j0 as $A,j1 as UA,j2 as VA,j3 as HA,j4 as qA,j5 as YA,j6 as WA,j7 as KA,j8 as JA,j9 as XA,ja as ZA,jb as QA,jc as eC,jd as tC,je as rC,jf as nC,jg as aC,jh as oC,ji as sC,jj as iC,jk as lC,jl as cC,jm as dC,jn as uC,jt as mC,jv as fC,jw as pC,jx as hC,jy as gC,jz as bC,jA as SC,jB as yC,jC as EC,jD as wC,jE as PC,jF as IC,jG as AC,jH as CC,jI as xC,jJ as vC,jK as MC,jL as RC,jM as TC,jN as kC,jO as DC,jP as _C,jQ as OC,jS as NC,jT as jC,jU as LC,jV as BC,jW as zC,jX as GC,jZ as FC,j_ as $C,j$ as UC,k0 as VC,k1 as HC,k2 as qC,k3 as YC,k5 as WC,k6 as KC,k7 as JC,k9 as XC,kb as ZC,kc as QC,kh as ex,ki as tx,kj as rx,kk as nx,kl as ax,km as ox,kn as sx,ko as ix,kq as lx,kr as cx,ks as dx,kt as ux,ku as mx,kv as fx,kw as px,kx as hx,kz as gx,kA as bx,kB as Sx,kC as yx,kF as Ex,kG as wx,kH as Px,kI as Ix,kJ as Ax,kL as Cx,kM as xx,kN as vx,kO as Mx,kP as Rx,kQ as Tx,kR as kx,kS as Dx,kT as _x,kU as Ox,kV as Nx,kW as jx,kX as Lx,kY as Bx,kZ as zx,k_ as Gx,k$ as Fx,l0 as $x,l1 as Ux,l2 as Vx,l3 as Hx,l5 as qx,l6 as Yx,l7 as Wx,l8 as Kx,l9 as Jx,la as Xx,lc as Zx,le as Qx,lf as ev,lg as tv,lj as rv,lk as nv,ll as av,lm as ov,ln as sv,lo as iv,lp as lv,lq as cv,lr as dv,ls as uv,lt as mv,lu as fv,lw as pv,lx as hv,lA as gv,lB as bv,lC as Sv,lD as yv,lE as Ev,lG as wv,lH as Pv,lI as Iv,lJ as Av,lK as Cv,lL as xv,lM as vv,lN as Mv,lO as Rv,lP as Tv,lQ as kv,lR as Dv,lS as _v,lT as Ov,lU as Nv,lV as jv,lX as Lv,lY as Bv,l$ as zv,m1 as Gv,m3 as Fv,m4 as $v,m5 as Uv,m6 as Vv,m9 as Hv,ma as qv,mc as Yv,md as Wv,mf as Kv,mj as Jv,ml as Xv,mo as Zv,mq as Qv,mr as eM,ms as tM,mt as rM,mw as nM,my as aM,mz as oM,mA as sM,mB as iM,mC as lM,mD as cM,mE as dM,mF as uM,mG as mM,mH as fM,mI as pM,mJ as hM,mK as gM,mL as bM,mM as SM,mP as yM,mQ as EM,mS as wM,mT as PM,mU as IM,mV as AM,mW as CM,mX as xM,mY as vM,mZ as MM,m_ as RM,m$ as TM,n0 as kM,n2 as DM,n3 as _M,n4 as OM,n5 as NM,n6 as jM,n7 as LM,n8 as BM,n9 as zM,na as GM,nb as FM,nc as $M,ne as UM,nf as VM,ng as HM,nh as qM,ni as YM,nj as WM,nk as KM,nl as JM,nm as XM,nn as ZM,no as QM,np as eR,nr as tR,ns as rR,nu as nR,nw as aR,nx as oR,ny as sR,nz as iR,nA as lR,nB as cR,nC as dR,nD as uR,nF as mR,nG as fR,nH as pR,nI as hR,nJ as gR,nL as bR,nM as SR,nN as yR,nO as ER,nP as wR,nQ as PR,nR as IR,nS as AR,nT as CR,nU as xR,nV as vR,nW as MR,nX as RR,nY as TR,nZ as kR,n_ as DR,o0 as _R,o1 as OR,o2 as NR,o3 as jR,o4 as LR,o5 as BR,o9 as zR,oa as GR,ob as FR,oc as $R,od as UR,oe as VR,of as HR,og as qR,oh as YR,oi as WR,oj as KR,ok as JR,ol as XR,om as ZR,on as QR,oo as eT,op as tT,or as rT,os as nT,ov as aT,ow as oT,ox as sT,oz as iT,oA as lT,oB as cT,oC as dT}from"./playable-standard-project-CkKWpnr-.js";import{du as $a,U as Lt,fr as Fn,gD as F,Q as Ua}from"./hemisphericLight-BkYyeXbK.js";import"@fps-games/editor-core/plugin-host";const jf=!1,Lf=!1,Yr=["opacity","softness","bias","normalBias","maxDistance","resolution","cascadeCount","bakeSamples","blurKernel"];function ol(e){const t=on(e);if(!t||typeof t.casterId!="string"||!t.casterId.trim()||!Array.isArray(t.receiverIds)||!t.receiverIds.every(n=>typeof n=="string")||!hl(t.backend)||!gl(t.mode)||!bl(t.quality))return null;const r=fl(t.params);return!r||!Array.isArray(t.diagnostics)?null:{casterId:t.casterId,receiverIds:qa(t.receiverIds),...typeof t.lightId=="string"&&t.lightId.trim()?{lightId:t.lightId.trim()}:{},backend:t.backend,mode:t.mode,quality:t.quality,params:r,...typeof t.stale=="boolean"?{stale:t.stale}:{},diagnostics:t.diagnostics.filter(pl)}}function Bf(e){const t=e.targets.filter(s=>typeof s.id=="string"&&s.id.trim()),r=dl(t),n=[],a=[],o=new Map;for(const s of t){if(!Wr(s))continue;const i=ol(s.shadowPlan)??cl(s,e.fallbackMode,e.fallbackQuality);if(!i||i.backend==="none"||i.mode==="none")continue;const d=il({caster:s,plan:i,targets:t,targetIndex:r}),l=d.flatMap(h=>h.diagnostics),u=d.filter(h=>h.targetId),c=sl(i.backend),m=[...i.diagnostics,...l,...ul(i,c)],f={target:s,targetId:s.id,plan:i,backend:i.backend,mode:i.mode,quality:i.quality,params:i.params,receiverTargetIds:u.filter(h=>h.receiveShadows).map(h=>h.targetId),receivers:u,paramsUsage:c,diagnostics:m};a.push(f),n.push(...m);for(const h of u){const g=o.get(h.targetId);(!g||dt(h.source)>dt(g.source))&&o.set(h.targetId,h)}}return{targets:t,casters:a,receivers:[...o.values()].sort((s,i)=>s.targetId.localeCompare(i.targetId)),diagnostics:n}}function sl(e){const t=new Set;if(e==="dynamic-map")for(const r of["opacity","bias","normalBias","maxDistance","resolution","cascadeCount"])t.add(r);else if(e==="blob")for(const r of["opacity","softness","maxDistance"])t.add(r);else if(e==="projected")for(const r of["opacity","softness","maxDistance","blurKernel"])t.add(r);else if(e==="static-baked")for(const r of["opacity","softness","maxDistance","resolution","bakeSamples","blurKernel"])t.add(r);return{consumed:Yr.filter(r=>t.has(r)),ignored:Yr.filter(r=>!t.has(r))}}function il(e){const t=new Map;if(e.plan.receiverIds.length>0)for(const r of e.plan.receiverIds){const n=e.targetIndex.get(r)??[];if(n.length===0){t.set(`missing:${r}`,ll(e.caster.id,r));continue}for(const a of n)a.id===e.caster.id||!Wr(a)||wr(t,Er({target:a,casterId:e.caster.id,backend:e.plan.backend,source:"plan"}))}for(const r of e.targets){if(r.id===e.caster.id||!Wr(r))continue;const n=Va(r);if(n?.receive==="none"){t.has(r.id)&&wr(t,Er({target:r,casterId:e.caster.id,backend:e.plan.backend,source:"explicit",forcedReceive:!1}));continue}if(n?.receive==="enabled"||n?.receive==="auto"){wr(t,Er({target:r,casterId:e.caster.id,backend:e.plan.backend,source:n.receive==="enabled"?"explicit":"auto"}));continue}}return[...t.values()].sort((r,n)=>dt(n.source)-dt(r.source)||r.targetId.localeCompare(n.targetId))}function Er(e){const t=e.target.materialLightingModel??"unknown",r=e.forcedReceive??!0,n=e.backend==="dynamic-map"&&r&&(t==="unlit"||e.target.receiveDynamicShadows===!1),a=[];return e.forcedReceive===!1&&a.push({code:"shadow.receiverNotFound",severity:"warning",message:`Runtime shadow receiver "${e.target.id}" is disabled by shadow.receive none.`,casterId:e.casterId,receiverId:e.target.id,details:{source:e.source,reason:"receive-none"}}),n&&a.push({code:"shadow.materialUnsupported",severity:"warning",message:`Runtime shadow receiver "${e.target.id}" uses an unlit material, so dynamic-map shadows cannot affect it.`,casterId:e.casterId,receiverId:e.target.id,details:{backend:e.backend,materialLightingModel:t}}),{target:e.target,targetId:e.target.id,nodeIds:Ha(e.target),source:e.source,receiveShadows:r&&!n,receiveDynamicShadows:e.backend==="dynamic-map"&&r&&!n,materialLightingModel:t,diagnostics:a}}function ll(e,t){return{target:{id:""},targetId:"",nodeIds:[],source:"plan",receiveShadows:!1,receiveDynamicShadows:!1,materialLightingModel:"unknown",diagnostics:[{code:"shadow.receiverNotFound",severity:"warning",message:`Runtime shadow receiver "${t}" was not found.`,casterId:e,receiverId:t,details:{source:"plan"}}]}}function wr(e,t){const r=t.targetId||`missing:${t.diagnostics[0]?.receiverId??e.size}`,n=e.get(r);(!n||dt(t.source)>=dt(n.source))&&e.set(r,t)}function cl(e,t,r){const n=Va(e);if(n?.cast==="none")return null;const a=Qo(n,t??"none");if(a==="none")return null;const o=es(n,r??"medium");return{casterId:e.id,receiverIds:[],backend:ml(a),mode:a,quality:o,params:ts(o,n?.params),diagnostics:[]}}function Va(e){return rs(e.shadow).shadow}function dl(e){const t=new Map;for(const r of e)for(const n of Ha(r)){const a=t.get(n)??[];a.push(r),t.set(n,a)}return t}function Ha(e){return qa([e.id,...e.nodeIds??[],...e.rootNodeId?[e.rootNodeId]:[]])}function ul(e,t){return e.backend==="none"||t.ignored.length===0?[]:[{code:"shadow.paramsIgnored",severity:"info",message:`Runtime shadow backend "${e.backend}" ignores params: ${t.ignored.join(", ")}.`,casterId:e.casterId,details:{backend:e.backend,ignoredParams:t.ignored,consumedParams:t.consumed}}]}function ml(e){return e==="dynamic"?"dynamic-map":e==="static"?"static-baked":e==="blob"?"blob":e==="projected"?"projected":"none"}function Wr(e){return e.active!==!1&&e.visible!==!1}function dt(e){return e==="explicit"?120:e==="plan"?100:40}function qa(e){const t=new Set,r=[];for(const n of e){const a=typeof n=="string"?n.trim():"";!a||t.has(a)||(t.add(a),r.push(a))}return r}function fl(e){const t=on(e);if(!t)return null;const r={};for(const n of Yr){const a=t[n];if(typeof a!="number"||!Number.isFinite(a))return null;r[n]=a}return!Sl(r.resolution)||!yl(r.cascadeCount)?null:r}function pl(e){const t=on(e);return!!t&&typeof t.code=="string"&&(t.severity==="info"||t.severity==="warning"||t.severity==="error")&&typeof t.message=="string"}function hl(e){return e==="none"||e==="dynamic-map"||e==="static-baked"||e==="blob"||e==="projected"}function gl(e){return e==="none"||e==="dynamic"||e==="static"||e==="blob"||e==="projected"}function bl(e){return e==="low"||e==="medium"||e==="high"||e==="ultra"}function Sl(e){return e===512||e===1024||e===2048||e===4096}function yl(e){return e===1||e===2||e===4}function zf(e,t){const r=_a(e),n=El(t),a=r.revision??null;if(!n)return{detected:!0,sourceId:r.sourceId,sourceType:r.sourceType,sourceRevision:a,generatedRevision:null,reason:"missing-generated-from"};const o=typeof n.revision=="number"?n.revision:null;return n.sourceId!==r.sourceId||n.sourceType!==r.sourceType?{detected:!0,sourceId:r.sourceId,sourceType:r.sourceType,sourceRevision:a,generatedRevision:o,reason:"source-mismatch"}:a!==o?{detected:!0,sourceId:r.sourceId,sourceType:r.sourceType,sourceRevision:a,generatedRevision:o,reason:"revision-mismatch"}:{detected:!1,sourceId:r.sourceId,sourceType:r.sourceType,sourceRevision:a,generatedRevision:o}}function El(e){if(!e||typeof e!="object")return null;const t=e.meta;if(!t||typeof t!="object")return null;const r=t.generatedFrom;if(!r||typeof r!="object")return null;const n=r.sourceId,a=r.sourceType;return typeof n!="string"||typeof a!="string"?null:{sourceId:n,sourceType:a,revision:typeof r.revision=="number"?r.revision:void 0}}function wl(e){const{document:t,runtimePatch:r}=e,n=e.getSourceRef?.(t)??_a(t),a=r.sourceBinding;if(!r.applyable||!a||r.applyTarget!==_n||a.sourceId!==ns||a.sourceType!==_n||a.sourceId!==n.sourceId||a.sourceType!==n.sourceType)return null;const o=a.objectId;if(!o||!e.findGameObject(t,o)||e.isRootGameObjectId?.(o))return null;const s=r.after;return Pl(s)?{label:r.label??`Apply runtime transform ${o}`,patch:e.createPatch(o,s)}:null}function Gf(e,t){return wl({document:e,runtimePatch:t,findGameObject:(r,n)=>r.scene.gameObjects.find(a=>a.id===n)??null,isRootGameObjectId:r=>r==="root",createPatch:(r,n)=>({kind:"game-object.transform",targetId:r,transform:n})})}function Pl(e){if(!e||typeof e!="object")return!1;const t=e;return Pr(t.position)&&Pr(t.rotation)&&Pr(t.scale)}function Pr(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.x=="number"&&Number.isFinite(t.x)&&typeof t.y=="number"&&Number.isFinite(t.y)&&typeof t.z=="number"&&Number.isFinite(t.z)}const Ya=["globalVolume.enabled","globalVolume.hdr","globalVolume.environment.texture.textureAssetId","globalVolume.environment.texture.url","globalVolume.environment.iblIntensity","globalVolume.environment.rotationY","globalVolume.imageProcessing.exposure","globalVolume.imageProcessing.contrast","globalVolume.toneMapping.enabled","globalVolume.toneMapping.type","globalVolume.antialiasing.samples","globalVolume.postProcessing.bloom.enabled","globalVolume.postProcessing.bloom.threshold","globalVolume.postProcessing.bloom.weight","globalVolume.postProcessing.bloom.kernel","globalVolume.postProcessing.bloom.scale","shadows.defaultMode","shadows.blob.enabled","shadows.blob.appearance.color","shadows.blob.appearance.color.a","shadows.blob.appearance.edgeSoftness","shadows.blob.plane.height","shadows.blob.plane.yOffset","shadows.blob.size.sizeMultiplier","shadows.blob.size.minSize","shadows.blob.size.maxSize","shadows.staticProjected.enabled","shadows.staticProjected.appearance.color","shadows.staticProjected.appearance.color.a","shadows.staticProjected.plane.height","shadows.staticProjected.plane.yOffset","shadows.staticProjected.bake.padding","shadows.staticProjected.bake.blur","shadows.staticProjected.bake.texelsPerMeter","shadows.staticProjected.bake.atlasSize","shadows.staticProjected.bake.maxAtlasPages","shadows.staticProjected.bake.sdfRadiusPx","shadows.staticProjected.bake.spatialChunkSize","shadows.staticProjected.bake.targetChunkCount","shadows.planar.enabled","shadows.planar.appearance.color","shadows.planar.appearance.color.a","shadows.planar.plane.height","shadows.planar.plane.bias","shadows.planar.projection.footprintScale","shadows.planar.stencil.enabled","shadows.planar.casters.excludePatterns","shadows.planar.casters.rootBoundaryPatterns","shadows.planar.receivers.patterns"];function Il(e,t){We(e);const r=Ka(e),n=[];vl(r,t,n);for(const[a,o]of Object.entries(t))Al(a)&&(Ml(a)||Rl(r,a)||(Wa(r,a,o),n.push(a)));return We(r),{config:r,changedPaths:Tl(n),normalized:Te(r)}}function Al(e){return Ya.includes(e)||Ja(e)!=null||sn(e)!=null}function Cl(e,t){const r=Ka(e),n=[],a=Ol(t.renderingGroupId);if(a==null)return{config:r,changedPaths:n,normalized:Te(r)};if(t.actionId==="rendering-alpha-preset.add"){const o=Dl(r,a);n.push(`renderingGroups.slots.${a}.alphaIndexPresets.${o}`)}else if(t.actionId==="rendering-alpha-preset.delete"){const o=Nl(t.presetIndex);o!=null&&_l(r,a,o)&&n.push(`renderingGroups.slots.${a}.alphaIndexPresets.${o}`)}return{config:r,changedPaths:n,normalized:Te(r)}}function xl(e){const t=e.change?.path;if(!t||!e.changedPaths.includes(t))return null;const r=sn(t);if(!r||r.field!=="alphaIndex")return null;const n=Le(e.change?.value,Number.NaN);if(!Number.isFinite(n))return null;const a=e.previousProfile.renderingGroups.slots.find(o=>o.renderingGroupId===r.renderingGroupId)?.alphaIndexPresets[r.presetIndex];return!a||!Number.isFinite(a.alphaIndex)||a.alphaIndex===n?null:{renderingGroupId:r.renderingGroupId,fromAlphaIndex:a.alphaIndex,toAlphaIndex:n}}function Wa(e,t,r){const n=Ja(t);if(n){const u=rr(e,n.renderingGroupId);u.name=tr(r,u.name);return}const a=sn(t);if(a){const u=rr(e,a.renderingGroupId),c=u.alphaIndexPresets[a.presetIndex];if(!c)return;a.field==="name"?c.name=tr(r,c.name):(c.alphaIndex=Le(r,c.alphaIndex),u.alphaIndexPresets=as(u.alphaIndexPresets,[]));return}const o=C(e,"globalVolume");if(t==="globalVolume.enabled"){o.enabled=r===!0;return}if(t==="globalVolume.hdr"){o.hdr=r===!0;return}if(t==="globalVolume.environment.texture.textureAssetId"){const u=typeof r=="string"?r.trim():"",c=C(o,"environment");if(!u){c.texture=null,$n(c);return}const m=C(c,"texture");m.textureAssetId=u,delete m.url;return}if(t==="globalVolume.environment.texture.url"){const u=typeof r=="string"?r.trim():"",c=C(o,"environment");if(!u){c.texture=null,$n(c);return}const m=C(c,"texture");m.url=u,delete m.textureAssetId;return}if(t==="globalVolume.environment.iblIntensity"){C(o,"environment").iblIntensity=le(r,1);return}if(t==="globalVolume.environment.rotationY"){C(o,"environment").rotationY=Le(r,0);return}if(t==="globalVolume.imageProcessing.exposure"){C(o,"imageProcessing").exposure=Le(r,1);return}if(t==="globalVolume.imageProcessing.contrast"){C(o,"imageProcessing").contrast=Le(r,1);return}if(t==="globalVolume.toneMapping.enabled"){C(o,"toneMapping").enabled=r===!0;return}if(t==="globalVolume.toneMapping.type"){C(o,"toneMapping").type=os(r,"aces");return}if(t==="globalVolume.antialiasing.samples"){C(o,"antialiasing").samples=ss(r,4);return}if(t==="globalVolume.postProcessing.bloom.enabled"){C(C(o,"postProcessing"),"bloom").enabled=r===!0;return}if(t==="globalVolume.postProcessing.bloom.threshold"){C(C(o,"postProcessing"),"bloom").threshold=le(r,.9);return}if(t==="globalVolume.postProcessing.bloom.weight"){C(C(o,"postProcessing"),"bloom").weight=le(r,.2);return}if(t==="globalVolume.postProcessing.bloom.kernel"){C(C(o,"postProcessing"),"bloom").kernel=le(r,64);return}if(t==="globalVolume.postProcessing.bloom.scale"){C(C(o,"postProcessing"),"bloom").scale=Ue(r,.5);return}const s=C(e,"shadows");if(t==="shadows.defaultMode"){s.defaultMode=is(r,"none");return}const i=C(s,"blob");if(t==="shadows.blob.enabled"){i.enabled=r===!0;return}if(t==="shadows.blob.appearance.color"){const u=C(i,"appearance"),c=Xe(ce(u.color),{r:0,g:0,b:0,a:.35}),m=ce(r);u.color={r:Y(m.r,c.r,0,1),g:Y(m.g,c.g,0,1),b:Y(m.b,c.b,0,1),a:Y(m.a,c.a,0,1)};return}if(t==="shadows.blob.appearance.color.a"){const u=C(i,"appearance"),c=Xe(ce(u.color),{r:0,g:0,b:0,a:.35});u.color={...c,a:Y(r,c.a,0,1)};return}if(t==="shadows.blob.appearance.edgeSoftness"){C(i,"appearance").edgeSoftness=Y(r,.55,0,.98);return}if(t==="shadows.blob.plane.height"){C(i,"plane").height=Le(r,0);return}if(t==="shadows.blob.plane.yOffset"){C(i,"plane").yOffset=le(r,.08);return}if(t==="shadows.blob.size.sizeMultiplier"){C(i,"size").sizeMultiplier=le(r,1.25);return}if(t==="shadows.blob.size.minSize"){C(i,"size").minSize=le(r,.25);return}if(t==="shadows.blob.size.maxSize"){C(i,"size").maxSize=Ue(r,20);return}const d=C(s,"staticProjected");if(t==="shadows.staticProjected.enabled"){d.enabled=r===!0;return}if(t==="shadows.staticProjected.appearance.color"){const u=C(d,"appearance"),c=Xe(ce(u.color),{r:0,g:0,b:0,a:.35}),m=ce(r);u.color={r:Y(m.r,c.r,0,1),g:Y(m.g,c.g,0,1),b:Y(m.b,c.b,0,1),a:Y(m.a,c.a,0,1)};return}if(t==="shadows.staticProjected.appearance.color.a"){const u=C(d,"appearance"),c=Xe(ce(u.color),{r:0,g:0,b:0,a:.35});u.color={...c,a:Y(r,c.a,0,1)};return}if(t==="shadows.staticProjected.plane.height"){C(d,"plane").height=Le(r,0);return}if(t==="shadows.staticProjected.plane.yOffset"){C(d,"plane").yOffset=le(r,.08);return}if(t==="shadows.staticProjected.bake.padding"){C(d,"bake").padding=le(r,.15);return}if(t==="shadows.staticProjected.bake.blur"){C(d,"bake").blur=le(r,0);return}if(t==="shadows.staticProjected.bake.texelsPerMeter"){C(d,"bake").texelsPerMeter=Ue(r,256);return}if(t==="shadows.staticProjected.bake.atlasSize"){C(d,"bake").atlasSize=Ue(r,4096);return}if(t==="shadows.staticProjected.bake.maxAtlasPages"){C(d,"bake").maxAtlasPages=Ue(r,8);return}if(t==="shadows.staticProjected.bake.sdfRadiusPx"){C(d,"bake").sdfRadiusPx=le(r,8);return}if(t==="shadows.staticProjected.bake.spatialChunkSize"){C(d,"bake").spatialChunkSize=Ue(r,16);return}if(t==="shadows.staticProjected.bake.targetChunkCount"){C(d,"bake").targetChunkCount=Ue(r,64);return}const l=C(s,"planar");if(t==="shadows.planar.enabled"){l.enabled=r===!0;return}if(t==="shadows.planar.appearance.color"){const u=C(l,"appearance"),c=Xe(ce(u.color),{r:0,g:0,b:0,a:.35}),m=ce(r);u.color={r:Y(m.r,c.r,0,1),g:Y(m.g,c.g,0,1),b:Y(m.b,c.b,0,1),a:Y(m.a,c.a,0,1)};return}if(t==="shadows.planar.appearance.color.a"){const u=C(l,"appearance"),c=Xe(ce(u.color),{r:0,g:0,b:0,a:.35});u.color={...c,a:Y(r,c.a,0,1)};return}if(t==="shadows.planar.plane.height"){C(l,"plane").height=Le(r,0);return}if(t==="shadows.planar.plane.bias"){C(l,"plane").bias=le(r,.4);return}if(t==="shadows.planar.projection.footprintScale"){C(l,"projection").footprintScale=Y(r,1,0,2);return}if(t==="shadows.planar.stencil.enabled"){C(l,"stencil").enabled=r===!0;return}if(t==="shadows.planar.casters.excludePatterns"){C(l,"casters").excludePatterns=yr(r);return}if(t==="shadows.planar.casters.rootBoundaryPatterns"){C(l,"casters").rootBoundaryPatterns=yr(r);return}t==="shadows.planar.receivers.patterns"&&(C(l,"receivers").patterns=yr(r))}function vl(e,t,r){const n="globalVolume.environment.texture.textureAssetId",a="globalVolume.environment.texture.url",o=Object.prototype.hasOwnProperty.call(t,n),s=Object.prototype.hasOwnProperty.call(t,a);if(!o&&!s)return;const i=o&&typeof t[n]=="string"?t[n].trim():"",d=s&&typeof t[a]=="string"?t[a].trim():"",l=i?n:d?a:o?n:a;Wa(e,l,l===n?i:d),r.push(l)}function Ml(e){return e==="globalVolume.environment.texture.textureAssetId"||e==="globalVolume.environment.texture.url"}function Rl(e,t){if(t!=="globalVolume.environment.iblIntensity"&&t!=="globalVolume.environment.rotationY")return!1;const r=ce(e.globalVolume),n=ce(r.environment),a=ce(n.texture);return!tr(a.textureAssetId,"")&&!tr(a.url,"")}function $n(e){delete e.iblIntensity,delete e.rotationY}function Tl(e){const t=new Map(Ya.map((r,n)=>[r,n]));return e.map((r,n)=>({path:r,index:n})).sort((r,n)=>{const a=t.get(r.path),o=t.get(n.path);return a!==void 0&&o!==void 0?a-o:a!==void 0?-1:o!==void 0?1:r.index-n.index}).map(r=>r.path)}function Ka(e){return!e||typeof e!="object"||Array.isArray(e)?{}:JSON.parse(JSON.stringify(e))}function C(e,t){const r=e[t];if(!r||typeof r!="object"||Array.isArray(r)){const n={};return e[t]=n,n}return r}function kl(e){const t=ls(e.renderingGroups),r=JSON.parse(JSON.stringify(t));return e.renderingGroups=r,r}function rr(e,t){const r=kl(e);return r.slots.find(n=>n.renderingGroupId===t)??r.slots[t]}function Dl(e,t){const r=rr(e,t);let n=r.alphaIndexPresets.length>0?Math.max(...r.alphaIndexPresets.map(o=>o.alphaIndex))+100:0;const a=new Set(r.alphaIndexPresets.map(o=>o.alphaIndex));for(;a.has(n);)n+=100;return r.alphaIndexPresets.push({name:`新顺序 ${r.alphaIndexPresets.length+1}`,alphaIndex:n}),r.alphaIndexPresets.length-1}function _l(e,t,r){const n=rr(e,t);return r<0||r>=n.alphaIndexPresets.length?!1:(n.alphaIndexPresets.splice(r,1),!0)}function Ja(e){const t=e.match(/^renderingGroups\.slots\.(0|1|2|3)\.name$/);return t?{renderingGroupId:Number(t[1])}:null}function sn(e){const t=e.match(/^renderingGroups\.slots\.(0|1|2|3)\.alphaIndexPresets\.(\d+)\.(name|alphaIndex)$/);return t?{renderingGroupId:Number(t[1]),presetIndex:Number(t[2]),field:t[3]}:null}function Ol(e){return e===0||e===1||e===2||e===3?e:null}function Nl(e){const t=typeof e=="number"&&Number.isInteger(e)?e:null;return t!=null&&t>=0?t:null}const jl={id:"shadow-group-moving-object",label:"Moving Object Shadows",summary:"Blob: lightweight for moving objects and project-default fallback."},Ll={id:"shadow-group-static-scene",label:"Static Scene Shadows",summary:"Consumes baked artifacts; update during authoring/build, runtime only displays results."},Bl={id:"shadow-group-directional-planar",label:"Directional Planar Shadows",summary:"Real-time planar projection following the directional light."},zl={id:"shadow-group-realtime-map",label:"Realtime Shadow Maps",summary:"One scene-level quality profile owns map resolution, filtering, and bias."},Gl={id:"shadow-group-compatibility",label:"Advanced Shadows",summary:"CSM read-only runtime status."};function Fl(e,t={},r={}){const n=e.shadows.blob,a=e.shadows.staticProjected,o=e.shadows.planar,s=e.environment,i=s.texture!==null,d=e.postProcess,l=t.dirty===!0,u=t.lastError??null,c=r.language??"en",m=$l(t.staticShadowBake,a.enabled),f=Vl(m,c),h=m.status==="baking",g={title:"Rendering",summary:"Project-level rendering settings shared by editor preview and runtime.",dirty:l,status:u??(l?"Rendering changes are not saved yet.":void 0),statusTone:u?"error":l?"warning":void 0,actions:[{id:"revert-rendering",label:"Revert",icon:"undo",disabled:!l,tooltip:l?"Revert rendering settings to the last saved rendering settings.":"Rendering settings already match the last saved rendering settings."}],sections:[ec(e.renderingGroups.slots),{id:"environment",title:"Environment / IBL",summary:"World environment texture and reflection lighting shared by editor preview and runtime.",systems:[{id:"environment-global",label:"Environment Texture",kind:"environment",active:!!s.texture,summary:s.texture?.textureAssetId??s.texture?.url??"No IBL texture",properties:[{path:"globalVolume.environment.texture.textureAssetId",label:"IBL Texture",valueType:"asset",control:"asset-picker-card",value:s.texture?.textureAssetId??"",tooltip:"Select a project texture asset for Babylon scene.environmentTexture. Prefer prefiltered .env environment textures.",commitMode:"immediate",controlOptions:tc({textureAssets:r.textureAssets,currentTextureAssetId:s.texture?.textureAssetId??"",fallbackUrl:s.texture?.url??"",language:r.language??"en"})},...i?[{path:"globalVolume.environment.iblIntensity",label:"IBL Intensity",valueType:"number",control:"number",value:s.iblIntensity,min:0,step:.05,tooltip:"Environment reflection intensity for PBR materials.",commitMode:"live"},{path:"globalVolume.environment.rotationY",label:"IBL Rotation",valueType:"number",control:"number",value:s.rotationY,step:.01,tooltip:"Y-axis rotation applied to the environment texture.",commitMode:"live"}]:[]]}]},{id:"post-process",title:"Post Process Volume",summary:"Global Babylon Default post-process profile shared by editor preview and runtime.",systems:[{id:"post-process-global",label:"Global",kind:"custom",active:d.enabled,summary:"Babylon Default",properties:[{path:"globalVolume.enabled",label:"Enabled",valueType:"boolean",control:"boolean",value:d.enabled,tooltip:"Enable the shared post-process pipeline.",commitMode:"immediate"},{path:"globalVolume.hdr",label:"HDR",valueType:"boolean",control:"boolean",value:d.hdr,tooltip:"Use HDR render targets for the default post-process pipeline.",commitMode:"immediate"},{path:"globalVolume.imageProcessing.exposure",label:"Exposure",valueType:"number",control:"number",value:d.imageProcessing.exposure,min:0,step:.01,tooltip:"Image processing exposure multiplier.",commitMode:"live"},{path:"globalVolume.imageProcessing.contrast",label:"Contrast",valueType:"number",control:"number",value:d.imageProcessing.contrast,min:0,step:.01,tooltip:"Image processing contrast multiplier.",commitMode:"live"},{path:"globalVolume.toneMapping.enabled",label:"ToneMapping",valueType:"boolean",control:"boolean",value:d.toneMapping.enabled,tooltip:"Enable tone mapping in the default post-process pipeline.",commitMode:"immediate"},{path:"globalVolume.toneMapping.type",label:"Tone Type",valueType:"enum",control:"enum",value:d.toneMapping.type,options:[{label:"ACES",value:"aces"},{label:"Standard",value:"standard"},{label:"KHR PBR Neutral",value:"khr-pbr-neutral"}],tooltip:"Tone mapping curve used by the default post-process pipeline.",commitMode:"immediate"},{path:"globalVolume.antialiasing.samples",label:"MSAA Samples",valueType:"enum",control:"enum",value:d.antialiasing.samples,options:[{label:"1",value:1},{label:"2",value:2},{label:"4",value:4},{label:"8",value:8}],tooltip:"MSAA sample count for the default post-process pipeline.",commitMode:"immediate"},{path:"globalVolume.postProcessing.bloom.enabled",label:"Bloom",valueType:"boolean",control:"boolean",value:d.bloom.enabled,tooltip:"Enable bloom in the shared default post-process pipeline.",commitMode:"immediate"},{path:"globalVolume.postProcessing.bloom.threshold",label:"Bloom Threshold",valueType:"number",control:"number",value:d.bloom.threshold,min:0,step:.01,tooltip:"Brightness threshold before pixels contribute to bloom.",commitMode:"live"},{path:"globalVolume.postProcessing.bloom.weight",label:"Bloom Weight",valueType:"number",control:"number",value:d.bloom.weight,min:0,step:.01,tooltip:"Bloom contribution weight.",commitMode:"live"},{path:"globalVolume.postProcessing.bloom.kernel",label:"Bloom Kernel",valueType:"number",control:"number",value:d.bloom.kernel,min:0,step:1,tooltip:"Bloom blur kernel size.",commitMode:"live"},{path:"globalVolume.postProcessing.bloom.scale",label:"Bloom Scale",valueType:"number",control:"number",value:d.bloom.scale,min:.01,step:.01,tooltip:"Bloom render scale.",commitMode:"live"}]}]},{id:"shadows",title:"Shadows",summary:"Global shadow systems for editor preview and runtime.",layout:"list",systemsCollapsible:!0,systems:[...t.shadowMapExperiment?[{id:"shadow-map-experiment",label:"Realtime Shadow Map",kind:"custom",group:{...zl},active:t.shadowMapExperiment.enabled,summary:Ql(t.shadowMapExperiment,c),properties:[{path:"shadowMapExperiment.qualityProfile",label:"Quality Profile",valueType:"enum",control:"enum",value:t.shadowMapExperiment.qualityProfileId??"",options:t.shadowMapExperiment.qualityProfileIds.map(p=>({value:p,label:Xa(p,c)})),disabled:!t.shadowMapExperiment.configured||t.shadowMapExperiment.qualityProfileIds.length===0,disabledReason:t.shadowMapExperiment.configured?void 0:c==="zh"?"当前项目未配置实时阴影贴图。":"Shadow Map Experiment is not configured for this project.",tooltip:"Scene-level quality owner shared by editor preview and runtime. Object Inspector does not override map resolution or filtering.",commitMode:"immediate"},ye("shadowMapExperiment.maps.staticResolution","Static Map",Cr(t.shadowMapExperiment.maps?.staticResolution)),ye("shadowMapExperiment.maps.dynamicResolution","Dynamic Map",Cr(t.shadowMapExperiment.maps?.dynamicResolution)),ye("shadowMapExperiment.maps.compositeResolution","Composite Map",Cr(t.shadowMapExperiment.maps?.compositeResolution)),ye("shadowMapExperiment.filter","Filter",t.shadowMapExperiment.filter??"—"),{path:"shadowMapExperiment.strength",label:"Shadow Strength",valueType:"number",control:"slider",value:t.shadowMapExperiment.strength??0,min:0,max:1,step:.01,disabled:!t.shadowMapExperiment.configured||t.shadowMapExperiment.strength===null,tooltip:"Visible shadow strength. Internally mapped to the compatible Babylon darkness value.",commitMode:"live"},{path:"shadowMapExperiment.softness",label:"Edge Softness",valueType:"number",control:"slider",value:t.shadowMapExperiment.softness??0,min:0,max:1,step:.005,disabled:!t.shadowMapExperiment.configured||t.shadowMapExperiment.softness===null,tooltip:"Normalized receiver-edge softness. Zero produces a hard edge.",commitMode:"live"},ye("shadowMapExperiment.bias","Bias",t.shadowMapExperiment.bias??"—"),ye("shadowMapExperiment.normalBias","Normal Bias",t.shadowMapExperiment.normalBias??"—")]}]:[],{id:"blob-shadow",label:"Blob Shadow",kind:"blob-shadow",group:{...jl},active:n.enabled,summary:"Default object shadow",properties:[{path:"shadows.defaultMode",label:"Default Mode",valueType:"enum",control:"enum",value:e.shadows.defaultMode,options:rc(r.language??"en"),tooltip:"Default shadow mode for GameObjects that use the project default.",commitMode:"immediate"},{path:"shadows.blob.enabled",label:"Enabled",valueType:"boolean",control:"boolean",value:n.enabled,tooltip:"Enable the shared blob shadow system.",commitMode:"immediate"},{path:"shadows.blob.appearance.color",label:"Color",valueType:"color",control:"color",value:n.appearance.color,tooltip:"Blob shadow RGB color. Opacity is edited separately.",commitMode:"immediate"},{path:"shadows.blob.appearance.color.a",label:"Opacity",valueType:"number",control:"number",value:n.appearance.color.a,min:0,max:1,step:.01,tooltip:"Blob shadow opacity, clamped between 0 and 1.",commitMode:"live"},{path:"shadows.blob.appearance.edgeSoftness",label:"Soft Edge",valueType:"number",control:"number",value:n.appearance.edgeSoftness,min:0,max:.98,step:.01,tooltip:"Blob shadow soft edge start. Higher values keep the center denser before fading out.",commitMode:"live"},{path:"shadows.blob.plane.height",label:"Height",valueType:"number",control:"number",value:n.plane.height,step:.01,unit:"m",tooltip:"Ground plane height used by blob shadows.",commitMode:"live"},{path:"shadows.blob.plane.yOffset",label:"Y Offset",valueType:"number",control:"number",value:n.plane.yOffset,min:0,step:.01,unit:"m",tooltip:"Vertical offset above the blob shadow plane to reduce z-fighting.",commitMode:"live"},{path:"shadows.blob.size.sizeMultiplier",label:"Size Multiplier",valueType:"number",control:"number",value:n.size.sizeMultiplier,min:0,step:.01,tooltip:"Scale blob shadow size from each caster bounds.",commitMode:"live"},{path:"shadows.blob.size.minSize",label:"Min Size",valueType:"number",control:"number",value:n.size.minSize,min:0,step:.01,unit:"m",tooltip:"Minimum blob shadow size for tiny objects.",commitMode:"live"},{path:"shadows.blob.size.maxSize",label:"Max Size",valueType:"number",control:"number",value:n.size.maxSize,min:.01,step:.01,unit:"m",tooltip:"Maximum blob shadow size for large objects.",commitMode:"live"}]},{id:"static-projected-shadow",label:"Static Baked Shadow",kind:"static-projected-shadow",group:{...Ll},active:a.enabled,summary:f.summary,status:f.status,details:Yl(m,c),progress:f.progress,actions:[{id:"bake-static-shadows",label:"Bake Static Shadows",icon:"save",disabled:!a.enabled||h,tooltip:h?"Static shadow bake is already running.":a.enabled?"Bake static shadow chunks for objects authored as Static Baked Shadow.":"Enable Static Baked Shadow before baking."}],properties:[{path:"shadows.staticProjected.enabled",label:"Enabled",valueType:"boolean",control:"boolean",value:a.enabled,tooltip:"Enable the shared static projected shadow system.",commitMode:"immediate"},{path:"shadows.staticProjected.appearance.color",label:"Color",valueType:"color",control:"color",value:a.appearance.color,tooltip:"Static shadow RGB color. Opacity is edited separately.",commitMode:"immediate"},{path:"shadows.staticProjected.appearance.color.a",label:"Opacity",valueType:"number",control:"number",value:a.appearance.color.a,min:0,max:1,step:.01,tooltip:"Static shadow opacity, clamped between 0 and 1.",commitMode:"live"},{path:"shadows.staticProjected.plane.height",label:"Height",valueType:"number",control:"number",value:a.plane.height,step:.01,unit:"m",tooltip:"Ground plane height used by static projected shadows.",commitMode:"live"},{path:"shadows.staticProjected.plane.yOffset",label:"Y Offset",valueType:"number",control:"number",value:a.plane.yOffset,min:0,step:.01,unit:"m",tooltip:"Vertical offset above the static shadow plane to reduce z-fighting.",commitMode:"live"},{path:"shadows.staticProjected.bake.texelsPerMeter",label:"Texels per Meter",valueType:"number",control:"number",value:a.bake.texelsPerMeter,min:1,step:1,tooltip:"Target SDF atlas texel density for baked static shadows.",commitMode:"blur"},{path:"shadows.staticProjected.bake.atlasSize",label:"Atlas Size",valueType:"number",control:"number",value:a.bake.atlasSize,min:16,step:1,tooltip:"Maximum width and height for each static shadow atlas page.",commitMode:"blur"},{path:"shadows.staticProjected.bake.maxAtlasPages",label:"Page Budget",valueType:"number",control:"number",value:a.bake.maxAtlasPages,min:1,step:1,tooltip:"Maximum atlas pages allowed before bake lowers the effective texel density.",commitMode:"blur"},{path:"shadows.staticProjected.bake.sdfRadiusPx",label:"SDF Radius",valueType:"number",control:"number",value:a.bake.sdfRadiusPx,min:0,step:1,tooltip:"Signed-distance radius in pixels used to preserve crisp controllable edges.",commitMode:"blur"},{path:"shadows.staticProjected.bake.padding",label:"Padding",valueType:"number",control:"number",value:a.bake.padding,min:0,step:.01,tooltip:"Extra projected bounds padding before baking the static shadow.",commitMode:"live"},{path:"shadows.staticProjected.bake.blur",label:"Blur",valueType:"number",control:"number",value:a.bake.blur,min:0,step:.5,tooltip:"Reserved blur radius for static shadow bake softness.",commitMode:"live"},{path:"shadows.staticProjected.bake.spatialChunkSize",label:"Spatial Chunk Size",valueType:"number",control:"number",value:a.bake.spatialChunkSize,min:.01,step:.01,unit:"m",tooltip:"World size of each spatial bake chunk before atlas packing.",commitMode:"live"},{path:"shadows.staticProjected.bake.targetChunkCount",label:"Target Chunks",valueType:"number",control:"number",value:a.bake.targetChunkCount,min:1,step:1,tooltip:"Soft chunk-count budget. Large scenes automatically enlarge spatial chunks to stay near this target.",commitMode:"blur"}]},{id:"planar-main",label:"Planar Main",kind:"planar-shadow",group:{...Bl},active:o.enabled,summary:"Follow Directional Light",properties:[{path:"shadows.planar.enabled",label:"Enabled",valueType:"boolean",control:"boolean",value:o.enabled,tooltip:"Enable the shared planar shadow system.",commitMode:"immediate"},{path:"shadows.planar.appearance.color",label:"Color",valueType:"color",control:"color",value:o.appearance.color,tooltip:"Planar shadow RGB color. Opacity is edited separately.",commitMode:"immediate"},{path:"shadows.planar.appearance.color.a",label:"Opacity",valueType:"number",control:"number",value:o.appearance.color.a,min:0,max:1,step:.01,tooltip:"Planar shadow opacity, clamped between 0 and 1.",commitMode:"live"},{path:"shadows.planar.plane.heightMode",label:"Height Source",valueType:"string",control:"readonly",value:o.plane.heightMode==="receiver"?"Auto from Receivers":"Fixed Height",readOnly:!0,tooltip:"Planar shadow receiver height is resolved from matched receiver meshes when available."},{path:"shadows.planar.plane.height",label:"Fallback Height",valueType:"number",control:"number",value:o.plane.height,step:.01,unit:"m",tooltip:"Fallback receiver plane height, used only when no receiver mesh can be resolved.",commitMode:"live"},{path:"shadows.planar.plane.bias",label:"Bias",valueType:"number",control:"number",value:o.plane.bias,min:0,step:.01,tooltip:"Projection bias used to keep the planar shadow stable.",commitMode:"live"},{path:"shadows.planar.projection.footprintScale",label:"Footprint Scale",valueType:"number",control:"number",value:o.projection.footprintScale,min:0,max:2,step:.01,tooltip:"Scale the projected footprint around the caster center; lower values reduce hard-edged mesh projection artifacts.",commitMode:"live"},{path:"shadows.planar.stencil.enabled",label:"Stencil",valueType:"boolean",control:"boolean",value:o.stencil.enabled,tooltip:"Use stencil routing so shadows affect only receivers.",commitMode:"immediate"},{path:"shadows.planar.casters.excludePatterns",label:"Caster Excludes",valueType:"string-list",control:"string-list",value:o.casters.excludePatterns,placeholder:"One pattern per line",tooltip:"Meshes matching these patterns will not cast planar shadows.",commitMode:"blur"},{path:"shadows.planar.casters.rootBoundaryPatterns",label:"Caster Roots",valueType:"string-list",control:"string-list",value:o.casters.rootBoundaryPatterns,placeholder:"One pattern per line",tooltip:"Optional root boundary patterns for caster auto-detection.",commitMode:"blur"},{path:"shadows.planar.receivers.patterns",label:"Receivers",valueType:"string-list",control:"string-list",value:o.receivers.patterns,placeholder:"One pattern per line",tooltip:"Meshes matching these patterns can receive planar shadows.",commitMode:"blur"},{path:"shadows.planar.direction",label:"Direction",valueType:"string",control:"readonly",value:"Follow Directional Light",readOnly:!0,tooltip:"Shadow direction is derived from the protected Directional Light."}]},{id:"csm-shadow",label:"CSM",kind:"csm-shadow",group:{...Gl},active:e.shadows.enabled&&e.shadows.useCsm&&!o.enabled,readOnly:!0,summary:e.shadows.useCsm?"Compatibility path":"Disabled",properties:[ye("shadows.useCsm","Enabled",e.shadows.useCsm),ye("shadows.csm.numCascades","Cascades",e.shadows.csm.numCascades),ye("shadows.csm.lambda","Lambda",e.shadows.csm.lambda)]}]}]};return sc(Ul(g),c,l)}function $l(e,t){return t?e??{status:"missing",chunkCount:0}:{status:"disabled",chunkCount:0}}function Ul(e){return{...e,sections:e.sections.map(t=>({...t,systems:t.systems.filter(r=>r.id!=="static-projected-shadow")}))}}function Vl(e,t){const r=Math.max(0,Math.trunc(e.chunkCount??0)),n=t==="zh"?`${r} 个分块`:`${r} chunk${r===1?"":"s"}`;if(e.status==="baking"){const o=e.progress??{label:t==="zh"?"正在烘焙静态阴影":"Baking static shadows",indeterminate:!0};return{summary:t==="zh"?"正在烘焙":"Baking",status:t==="zh"?Hl(e):e.reason??"Baking static shadow artifact.",progress:{...o,label:t==="zh"?ql(e):o.label}}}if(e.status==="disabled")return{summary:t==="zh"?"已禁用":"Disabled",status:Ve(e.reason,"Static Baked Shadow is disabled.","静态烘焙阴影已禁用。",t)};if(e.status==="missing")return{summary:t==="zh"?"缺少烘焙":"Missing bake",status:Ve(e.reason,"No static shadow bake artifact is available.","当前没有可用的静态阴影烘焙数据。",t)};if(e.status==="preview-unsaved")return{summary:t==="zh"?`预览未保存 · ${n}`:`Preview unsaved · ${n}`,status:Ve(e.reason,"Static shadow preview has not been saved yet.","静态阴影预览尚未保存。",t)};if(e.status==="out-of-date")return{summary:t==="zh"?`已过期 · ${n}`:`Out of date · ${n}`,status:Ve(e.reason,"Static shadow bake is out of date.","静态阴影烘焙已过期。",t)};if(e.status==="invalid")return{summary:t==="zh"?"烘焙无效":"Invalid bake",status:Ve(e.reason,"Static shadow bake artifact is invalid.","静态阴影烘焙数据无效。",t)};const a="Static shadow bake artifact is up to date.";return r===0?{summary:t==="zh"?"无静态投射物":"No static casters",status:Ve(e.reason,a,"没有物体被显式设置为静态烘焙阴影。",t)}:{summary:t==="zh"?`最新 · ${n}`:`Up to date · ${n}`,status:Ve(e.reason,a,"静态阴影烘焙数据已是最新。",t)}}function Ve(e,t,r,n){return n!=="zh"?e??t:!e||e===t?r:e}function Hl(e){const t=e.stats??null,r=t?.phase,n=t?.attemptedChunkCount??0,a=t?.chunkCount??0,o=t?.pageCount??t?.textureCount??0,s=t?.textureCount??0;return r==="collect"?(t?.sourceRootCount??0)>0?`已收集 ${t?.sourceRootCount??0} 个静态投射物,正在准备空间分块。`:"正在收集静态阴影投射物。":r==="sdf"?n>0?`正在生成静态阴影 SDF ${Math.min(a+1,n)} / ${n}。`:"正在生成静态阴影 SDF。":r==="pack"?`正在将 ${a} 个静态阴影分块打包到 ${o} 张 Atlas。`:r==="encode"?`正在编码静态阴影 Atlas ${Math.min(s+1,o||s+1)} / ${o||s+1}。`:r==="complete"?"正在写入静态阴影烘焙数据。":n>0?`正在烘焙静态阴影分块 ${Math.min(a+1,n)} / ${n}。`:(t?.sourceRootCount??0)>0?`已收集 ${t?.sourceRootCount??0} 个静态投射物,正在准备分块。`:"正在收集静态阴影投射物。"}function ql(e){const t=e.stats??null,r=t?.phase,n=t?.attemptedChunkCount??0,a=t?.chunkCount??0;if(r==="collect")return"收集静态投射物";if(r==="pack")return"打包静态阴影 Atlas";if(r==="encode"){const o=t?.pageCount??t?.textureCount??0,s=t?.textureCount??0;return`静态阴影 Atlas ${Math.min(s,o)} / ${o}`}return n>0?`静态阴影烘焙 ${Math.min(a,n)} / ${n}`:"正在烘焙静态阴影"}function Yl(e,t){const r=e.stats??null,n=[],a=(i,d,l,u)=>{l==null||l===""||n.push({label:t==="zh"?d:i,value:String(l),...u?{tone:u}:{}})},o=r?.chunkCount??e.chunkCount,s=Wl(r,o);if(a("Static casters","静态投射物",Q(r?.sourceRootCount)),a("Bake meshes","参与 Mesh",Q(r?.sourceMeshCount)),a("Chunks","分块",Q(o),o===0?"warning":void 0),a("Atlas pages","Atlas 页",Q(r?.pageCount??r?.textureCount??o)),a("Texture memory","贴图显存",s.textureMemoryText,s.textureMemoryTone),a("Texture pixels","贴图像素",s.atlasPixelsText),a("Atlas occupancy","Atlas 利用率",s.atlasOccupancyText,s.atlasOccupancyTone),a("Atlas used","Atlas 已用",s.atlasUsedPixelsText),a("Atlas allocated","Atlas 分配",s.atlasAllocatedPixelsText),a("Runtime draws","运行时 Draw",s.drawCallsText),a("Shadow mesh","阴影 Mesh",s.meshText),a("Triangles","三角形",s.triangleText),a("Vertices","顶点",s.vertexText),a("Effective texels / m","实际每米像素",Be(r?.effectiveTexelsPerMeter??r?.texelsPerMeter)),r?.effectiveTexelsPerMeter!=null&&r?.texelsPerMeter!=null&&Math.abs(r.effectiveTexelsPerMeter-r.texelsPerMeter)>.001&&a("Target texels / m","目标每米像素",Be(r.texelsPerMeter),"warning"),a("Atlas size","Atlas 尺寸",r?.atlasSize?`${r.atlasSize}px`:null),a("Page budget","页预算",Q(r?.maxAtlasPages)),a("SDF radius","SDF 半径",r?.sdfRadiusPx!=null?`${r.sdfRadiusPx}px`:null),a("Spatial chunk","空间分块",r?.spatialChunkSize?Ar(r.spatialChunkSize):null),r?.effectiveSpatialChunkSize!=null&&r?.spatialChunkSize!=null&&Math.abs(r.effectiveSpatialChunkSize-r.spatialChunkSize)>.001&&a("Effective chunk","实际分块",Ar(r.effectiveSpatialChunkSize),"warning"),a("Target chunks","目标分块",Q(r?.targetChunkCount)),a("Baked chunks","重烘分块",Q(r?.bakedChunkCount)),a("Reused chunks","复用分块",Q(r?.reusedChunkCount),r?.reusedChunkCount?"success":void 0),a("Resolution","贴图尺寸",r?.resolution?`${r.resolution}px`:null),a("Chunk size","分块尺寸",r?.chunkSize?Ar(r.chunkSize):null),a("Duration","耗时",Zl(r?.durationMs,t)),e.status==="baking"){a("Current chunk","当前分块",r?.currentChunkId);const i=r?.attemptedChunkCount,d=r?.chunkCount;r?.phase&&a("Stage","阶段",Kl(r.phase,t)),i!=null&&d!=null&&a("Progress","进度",t==="zh"?`${d} / ${i} 个分块`:`${d} / ${i} chunks`)}else a("Skipped chunks","跳过分块",Q(r?.skippedChunkCount),r?.skippedChunkCount?"warning":void 0);return n}function Wl(e,t){if(!e)return{textureMemoryText:null,atlasPixelsText:null,atlasUsedPixelsText:null,atlasAllocatedPixelsText:null,atlasOccupancyText:null,drawCallsText:null,meshText:null,triangleText:null,vertexText:null};const r=Math.max(0,Math.trunc(e.chunkCount??t??0)),n=e.pageCount!=null||e.atlasSize!=null||e.effectiveTexelsPerMeter!=null,a=Math.max(0,Math.trunc(n?e.pageCount??e.textureCount??0:e.textureCount??r)),o=n?e.atlasSize:e.resolution,s=a>0&&o!=null&&Number.isFinite(o)&&o>0?a*o*o*4:null,i=n?e.atlasAllocatedPixels??(s!=null?s/4:null):s!=null?s/4:null,d=n?e.atlasUsedPixels??null:null,l=i!=null?i*4:null,u=n?e.atlasOccupancy??(i!=null&&i>0&&d!=null?d/i:null):null,c=a>0?a:null,m=n?c:r||null,f=r>0?r*2:null,h=r>0?r*4:null;return{textureMemoryText:Xl(l),textureMemoryTone:l!=null&&l>=256*1024*1024?"warning":void 0,atlasPixelsText:Ir(i),atlasUsedPixelsText:Ir(d),atlasAllocatedPixelsText:Ir(i),atlasOccupancyText:Jl(u),atlasOccupancyTone:u!=null&&u<.35?"warning":void 0,drawCallsText:Q(c),meshText:Q(m),triangleText:Q(f),vertexText:Q(h)}}function Kl(e,t){if(t!=="zh")return e;switch(e){case"collect":return"收集";case"reuse":return"复用已有分块";case"chunk":return"烘焙分块";case"sdf":return"生成 SDF";case"pack":return"打包 Atlas";case"encode":return"编码 Atlas";case"complete":return"写入结果";default:return e}}function Q(e){return e==null||!Number.isFinite(e)?null:String(Math.max(0,Math.trunc(e)))}function Be(e){return e==null||!Number.isFinite(e)?null:Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function Ir(e){if(e==null||!Number.isFinite(e))return null;const t=Math.max(0,e);return t>=1e6?`${Be(t/1e6)} MP`:t>=1e3?`${Be(t/1e3)} KP`:Q(t)}function Jl(e){return e==null||!Number.isFinite(e)?null:`${Be(Math.max(0,Math.min(1,e))*100)}%`}function Xl(e){if(e==null||!Number.isFinite(e))return null;const t=Math.max(0,e);return t>=1024*1024*1024?`${Be(t/(1024*1024*1024))} GiB`:t>=1024*1024?`${Be(t/(1024*1024))} MiB`:t>=1024?`${Be(t/1024)} KiB`:`${Q(t)} B`}function Ar(e){return`${Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")} m`}function Zl(e,t){if(e==null||!Number.isFinite(e))return null;const r=Math.max(0,e);if(r<1e3)return`${Math.round(r)} ms`;const n=r/1e3,a=n<10?n.toFixed(1):String(Math.round(n));return t==="zh"?`${a} 秒`:`${a}s`}function Ql(e,t){if(!e.configured)return t==="zh"?"未配置":"Not configured";if(!e.enabled)return t==="zh"?"已关闭":"Disabled";const r=e.maps?.compositeResolution;return[e.qualityProfileId?Xa(e.qualityProfileId,t):t==="zh"?"默认":"Default",r?`${r}px`:null,e.filter].filter(a=>typeof a=="string"&&a.length>0).join(" · ")}function Xa(e,t){const r=e.trim().toLowerCase();if(t==="zh"){if(r==="balanced")return"平衡";if(r==="high")return"高质量";if(r==="ultra")return"超高质量";if(r==="performance"||r==="low")return"高性能"}return r==="balanced"?"Balanced":r==="high"?"High":r==="ultra"?"Ultra":r==="performance"||r==="low"?"Performance":e}function Cr(e){return e!=null&&Number.isFinite(e)?`${Math.max(0,Math.trunc(e))} px`:"—"}function ec(e){return{id:"rendering-groups",title:"Rendering Groups / Order Presets",summary:"Named Babylon rendering groups and alphaIndex presets used by object Inspector dropdowns.",layout:"list",systems:e.map(t=>({id:`rendering-group-${t.renderingGroupId}`,label:t.name,kind:"rendering-group",active:!0,summary:`Babylon group ${t.renderingGroupId}`,actions:[{id:"rendering-alpha-preset.add",label:"Add Order Preset",icon:"plus",tooltip:"Add a named alphaIndex preset for this rendering group.",params:{renderingGroupId:t.renderingGroupId}}],properties:[ye(`renderingGroups.slots.${t.renderingGroupId}.renderingGroupId`,"Group ID",t.renderingGroupId),{path:`renderingGroups.slots.${t.renderingGroupId}.name`,label:"Group Name",valueType:"string",control:"string",value:t.name,tooltip:"Display name for this fixed Babylon rendering group id.",commitMode:"blur"},...t.alphaIndexPresets.flatMap((r,n)=>[{path:`renderingGroups.slots.${t.renderingGroupId}.alphaIndexPresets.${n}.name`,label:`Preset ${n+1} Name`,valueType:"string",control:"string",value:r.name,tooltip:"User-facing name shown in object Inspector dropdowns.",commitMode:"blur",actions:[{id:"rendering-alpha-preset.delete",label:"Delete",icon:"trash",tooltip:"Delete this alphaIndex preset. Existing objects keep their numeric alphaIndex.",params:{renderingGroupId:t.renderingGroupId,presetIndex:n}}]},{path:`renderingGroups.slots.${t.renderingGroupId}.alphaIndexPresets.${n}.alphaIndex`,label:`Preset ${n+1} Value`,valueType:"number",control:"number",value:r.alphaIndex,step:1,tooltip:"Babylon alphaIndex value stored on objects that use this preset.",commitMode:"blur"}])]}))}}function ye(e,t,r){return{path:e,label:t,valueType:typeof r=="boolean"?"boolean":typeof r=="number"?"number":"string",control:"readonly",value:r,readOnly:!0}}function tc(e){const t=e.language==="zh"?{pickerTitle:"选择 IBL 贴图",replace:"替换",none:"无",noneMeta:"未设置环境贴图"}:{pickerTitle:"Select IBL Texture",replace:"Replace",none:"None",noneMeta:"No environment texture"},r=e.textureAssets?.find(i=>i.id===e.currentTextureAssetId)??null,n=(e.textureAssets??[]).filter(nc),a=r?.label??(e.currentTextureAssetId||e.fallbackUrl||t.none),o=r?.meta??(e.currentTextureAssetId||e.fallbackUrl||t.noneMeta),s=r?Un(r):void 0;return{pickerKind:"texture",pickerTitle:t.pickerTitle,actionLabel:t.replace,placeholder:t.none,currentLabel:a,currentMeta:o,...s?{currentPreview:s}:{},candidates:[{label:t.none,value:"",meta:t.noneMeta},...n.map(i=>{const d=Un(i);return{label:i.label,value:i.id,meta:i.meta??i.id,kind:"texture",...d?{preview:d}:{}}})]}}function rc(e){return e==="zh"?[{label:"无阴影",value:"none"},{label:"Blob 阴影",value:"blob"},{label:"主平面阴影",value:"planar"}]:[{label:"None",value:"none"},{label:"Blob",value:"blob"},{label:"Planar",value:"planar"}]}function nc(e){return e.capabilities?.environmentTexture===!0?!0:e.capabilities?.environmentTexture===!1?!1:e.usage==="environment"?!0:ac(e.resource.format)}function ac(e){return/^\.(env|hdr|dds|ktx|ktx2)$/i.test(e)}function Un(e){const t=e.previewUrl??(oc(e.resource.format)?e.resource.url:void 0);if(t)return{kind:"image",url:t,alt:e.label,fit:"contain"}}function oc(e){return/^\.(png|jpe?g|webp)$/i.test(e)}const nt={en:{title:"Rendering",summary:"Project-level rendering settings shared by editor preview and runtime.",dirtyStatus:"Rendering changes are not saved yet.",revert:"Revert",revertDirty:"Revert rendering settings to the last saved rendering settings.",revertClean:"Rendering settings already match the last saved rendering settings.",bakeStatic:"Bake Static Shadows",bakeStaticReady:"Bake static shadow chunks for objects authored as Static Baked Shadow.",bakeStaticDisabled:"Enable Static Baked Shadow before baking.",bakeStaticRunning:"Static shadow bake is already running.",sections:{"rendering-groups":{title:"Rendering Groups / Order Presets",summary:"Named Babylon rendering groups and alphaIndex presets used by object Inspector dropdowns."},environment:{title:"Environment / IBL",summary:"World environment texture and reflection lighting shared by editor preview and runtime."},"post-process":{title:"Post Process Volume",summary:"Global Babylon Default post-process profile shared by editor preview and runtime."},shadows:{title:"Shadows",summary:"Global shadow systems for editor preview and runtime."}},groups:{"shadow-group-moving-object":{label:"Moving Object Shadows",summary:"Blob: lightweight for moving objects and project-default fallback."},"shadow-group-static-scene":{label:"Static Scene Shadows",summary:"Consumes baked artifacts; update during authoring/build, runtime only displays results."},"shadow-group-directional-planar":{label:"Directional Planar Shadows",summary:"Real-time planar projection following the directional light."},"shadow-group-realtime-map":{label:"Realtime Shadow Maps",summary:"One scene-level quality profile owns map resolution, filtering, and bias."},"shadow-group-compatibility":{label:"Advanced Shadows",summary:"CSM read-only runtime status."}},systems:{"environment-global":{label:"Environment Texture"},"post-process-global":{label:"Global",summary:"Babylon Default"},"planar-main":{label:"Planar Main",summary:"Follow Directional Light"},"shadow-map-experiment":{label:"Realtime Shadow Map"},"blob-shadow":{label:"Blob Shadow",summary:"Default object shadow"},"static-projected-shadow":{label:"Static Baked Shadow",summary:"Baked object shape"},"csm-shadow":{label:"CSM",disabled:"Disabled",compatibility:"Compatibility path"}},properties:{"shadowMapExperiment.qualityProfile":{label:"Quality Profile",tooltip:"Scene-level quality owner shared by editor preview and runtime. Object Inspector does not override map resolution or filtering."},"shadowMapExperiment.maps.staticResolution":{label:"Static Map"},"shadowMapExperiment.maps.dynamicResolution":{label:"Dynamic Map"},"shadowMapExperiment.maps.compositeResolution":{label:"Composite Map"},"shadowMapExperiment.filter":{label:"Filter"},"shadowMapExperiment.strength":{label:"Shadow Strength",tooltip:"Visible shadow strength. Internally mapped to the compatible Babylon darkness value."},"shadowMapExperiment.softness":{label:"Edge Softness",tooltip:"Normalized receiver-edge softness. Zero produces a hard edge."},"shadowMapExperiment.bias":{label:"Bias"},"shadowMapExperiment.normalBias":{label:"Normal Bias"},"globalVolume.environment.texture.textureAssetId":{label:"IBL Texture",tooltip:"Select a project texture asset for Babylon scene.environmentTexture. Prefer prefiltered .env environment textures."},"globalVolume.environment.iblIntensity":{label:"IBL Intensity",tooltip:"Environment reflection intensity for PBR materials."},"globalVolume.environment.rotationY":{label:"IBL Rotation",tooltip:"Y-axis rotation applied to the environment texture."},"shadows.defaultMode":{label:"Default Mode",tooltip:"Default shadow mode for GameObjects that use the project default."},"shadows.blob.enabled":{label:"Enabled",tooltip:"Enable the shared blob shadow system."},"shadows.blob.appearance.color":{label:"Color",tooltip:"Blob shadow RGB color. Opacity is edited separately."},"shadows.blob.appearance.color.a":{label:"Opacity",tooltip:"Blob shadow opacity, clamped between 0 and 1."},"shadows.blob.appearance.edgeSoftness":{label:"Soft Edge",tooltip:"Blob shadow soft edge start. Higher values keep the center denser before fading out."},"shadows.blob.plane.height":{label:"Height",tooltip:"Ground plane height used by blob shadows."},"shadows.blob.plane.yOffset":{label:"Y Offset",tooltip:"Vertical offset above the blob shadow plane to reduce z-fighting."},"shadows.blob.size.sizeMultiplier":{label:"Size Multiplier",tooltip:"Scale blob shadow size from each caster bounds."},"shadows.blob.size.minSize":{label:"Min Size",tooltip:"Minimum blob shadow size for tiny objects."},"shadows.blob.size.maxSize":{label:"Max Size",tooltip:"Maximum blob shadow size for large objects."},"shadows.staticProjected.enabled":{label:"Enabled",tooltip:"Enable the shared static projected shadow system."},"shadows.staticProjected.appearance.color":{label:"Color",tooltip:"Static shadow RGB color. Opacity is edited separately."},"shadows.staticProjected.appearance.color.a":{label:"Opacity",tooltip:"Static shadow opacity, clamped between 0 and 1."},"shadows.staticProjected.plane.height":{label:"Height",tooltip:"Ground plane height used by static projected shadows."},"shadows.staticProjected.plane.yOffset":{label:"Y Offset",tooltip:"Vertical offset above the static shadow plane to reduce z-fighting."},"shadows.staticProjected.bake.padding":{label:"Padding",tooltip:"Extra projected bounds padding before baking the static shadow."},"shadows.staticProjected.bake.blur":{label:"Blur",tooltip:"Reserved blur radius for static shadow bake softness."},"shadows.staticProjected.bake.texelsPerMeter":{label:"Texels per Meter",tooltip:"Target SDF atlas texel density for baked static shadows."},"shadows.staticProjected.bake.atlasSize":{label:"Atlas Size",tooltip:"Maximum width and height for each static shadow atlas page."},"shadows.staticProjected.bake.maxAtlasPages":{label:"Page Budget",tooltip:"Maximum atlas pages before bake lowers the effective texel density."},"shadows.staticProjected.bake.sdfRadiusPx":{label:"SDF Radius",tooltip:"Signed-distance radius in pixels used for crisp controllable edges."},"shadows.staticProjected.bake.spatialChunkSize":{label:"Spatial Chunk Size",tooltip:"World size of each spatial bake chunk before atlas packing."},"shadows.staticProjected.bake.targetChunkCount":{label:"Target Chunks",tooltip:"Soft chunk-count budget. Large scenes automatically enlarge spatial chunks to stay near this target."}}},zh:{title:"渲染",summary:"项目级渲染设置。编辑器预览和运行时共用同一套渲染管线。",dirtyStatus:"渲染设置尚未保存。",revert:"还原",revertDirty:"还原到上一次保存的渲染设置。",revertClean:"当前渲染设置已经和上一次保存状态一致。",bakeStatic:"烘焙静态阴影",bakeStaticReady:"为标记为静态烘焙阴影的物体生成分块阴影。",bakeStaticDisabled:"请先启用静态烘焙阴影。",bakeStaticRunning:"静态阴影正在烘焙中。",sections:{"rendering-groups":{title:"渲染分组 / 顺序预设",summary:"项目级 Babylon rendering group 名称和 alphaIndex 预设,用于物体 Inspector 下拉选择。"},environment:{title:"环境 / IBL",summary:"世界环境贴图与 PBR 环境反射,编辑器预览和运行时共用。"},"post-process":{title:"后处理 Volume",summary:"全局 Babylon Default 后处理参数,编辑器预览和运行时共用。"},shadows:{title:"阴影",summary:"项目级阴影系统,编辑器预览和运行时共用。"}},groups:{"shadow-group-moving-object":{label:"移动物体阴影",summary:"Blob:低成本,适合移动物体,也可作为项目默认阴影。"},"shadow-group-static-scene":{label:"静态场景阴影",summary:"只显示已烘焙 artifact;编辑器/构建期更新,运行时消费结果。"},"shadow-group-directional-planar":{label:"主平面实时阴影",summary:"跟随直射光动态投影,适合需要方向感的物体。"},"shadow-group-realtime-map":{label:"实时阴影贴图",summary:"由唯一的场景级质量档统一决定分辨率、过滤和偏移。"},"shadow-group-compatibility":{label:"兼容阴影",summary:"旧 ShadowGenerator / CSM 只读兼容路径。"}},systems:{"environment-global":{label:"环境贴图"},"post-process-global":{label:"全局",summary:"Babylon Default"},"planar-main":{label:"主平面阴影",summary:"跟随直射光"},"shadow-map-experiment":{label:"实时阴影贴图"},"blob-shadow":{label:"Blob 阴影",summary:"默认物体阴影"},"static-projected-shadow":{label:"静态烘焙阴影",summary:"烘焙物体轮廓"},"csm-shadow":{label:"级联阴影",disabled:"已禁用",compatibility:"兼容路径"}},properties:{"shadowMapExperiment.qualityProfile":{label:"质量档",tooltip:"场景级质量档是编辑器预览和运行时共享的唯一质量来源;物体检查器不会覆盖贴图分辨率或过滤方式。"},"shadowMapExperiment.maps.staticResolution":{label:"静态贴图"},"shadowMapExperiment.maps.dynamicResolution":{label:"动态贴图"},"shadowMapExperiment.maps.compositeResolution":{label:"合成贴图"},"shadowMapExperiment.filter":{label:"过滤"},"shadowMapExperiment.strength":{label:"阴影强度",tooltip:"控制阴影的可见深浅,内部会转换为兼容的 Babylon darkness 参数。"},"shadowMapExperiment.softness":{label:"轮廓柔和度",tooltip:"控制阴影接收边缘的柔和程度;0 表示硬边。"},"shadowMapExperiment.bias":{label:"偏移"},"shadowMapExperiment.normalBias":{label:"法线偏移"},"globalVolume.enabled":{label:"启用",tooltip:"启用项目共用的默认后处理管线。关闭后会销毁运行时和编辑器预览中的 DefaultRenderingPipeline。"},"globalVolume.hdr":{label:"HDR",tooltip:"使用 HDR 渲染目标。通常建议开启,以保留高亮、Bloom 和 ToneMapping 的动态范围。"},"globalVolume.environment.texture.textureAssetId":{label:"IBL 贴图",tooltip:"从项目贴图资产中选择 Babylon scene.environmentTexture。建议使用预过滤的 .env 环境贴图。"},"globalVolume.environment.iblIntensity":{label:"IBL 强度",tooltip:"PBR 材质的环境反射强度。需要先配置 IBL 贴图才会有明显效果。"},"globalVolume.environment.rotationY":{label:"IBL 旋转",tooltip:"环境贴图绕 Y 轴旋转,用于调整反射方向。"},"globalVolume.imageProcessing.exposure":{label:"曝光",tooltip:"图像处理曝光倍率。1 表示保持原始亮度;数值越高画面越亮。"},"globalVolume.imageProcessing.contrast":{label:"对比度",tooltip:"图像处理对比度倍率。1 表示默认对比;提高会增强明暗差异。"},"globalVolume.toneMapping.enabled":{label:"ToneMapping",tooltip:"启用色调映射,把 HDR 颜色压缩到屏幕可显示范围。"},"globalVolume.toneMapping.type":{label:"Tone 类型",tooltip:"ToneMapping 曲线类型。ACES 更接近影视感;Standard 更直接;KHR PBR Neutral 更适合 PBR 中性预览。"},"globalVolume.antialiasing.samples":{label:"MSAA 采样",tooltip:"默认后处理管线的 MSAA 采样数。数值越高边缘越平滑,但性能成本也更高。"},"globalVolume.postProcessing.bloom.enabled":{label:"Bloom",tooltip:"启用泛光效果,让高亮区域向外扩散发光。"},"globalVolume.postProcessing.bloom.threshold":{label:"Bloom 阈值",tooltip:"参与 Bloom 的亮度阈值。数值越低,更多区域会发光。"},"globalVolume.postProcessing.bloom.weight":{label:"Bloom 强度",tooltip:"Bloom 对最终画面的贡献权重。"},"globalVolume.postProcessing.bloom.kernel":{label:"Bloom 核大小",tooltip:"Bloom 模糊核大小。数值越高,光晕扩散范围越大。"},"globalVolume.postProcessing.bloom.scale":{label:"Bloom 缩放",tooltip:"Bloom 渲染缩放比例。较低数值更省性能,较高数值细节更稳定。"},"shadows.defaultMode":{label:"默认模式",tooltip:"使用项目默认阴影的 GameObject 会采用这个模式。"},"shadows.blob.enabled":{label:"启用",tooltip:"启用共用的 Blob 阴影系统。"},"shadows.blob.appearance.color":{label:"颜色",tooltip:"Blob 阴影颜色。透明度单独编辑。"},"shadows.blob.appearance.color.a":{label:"不透明度",tooltip:"Blob 阴影不透明度,范围 0 到 1。"},"shadows.blob.appearance.edgeSoftness":{label:"柔边",tooltip:"Blob 阴影柔边起点。数值越高,中心区域越实,边缘再逐渐淡出。"},"shadows.blob.plane.height":{label:"高度",tooltip:"Blob 阴影所在的地面高度。"},"shadows.blob.plane.yOffset":{label:"Y 偏移",tooltip:"Blob 阴影相对地面的垂直偏移,用于避免 z-fighting。"},"shadows.blob.size.sizeMultiplier":{label:"尺寸倍率",tooltip:"根据投射物包围盒计算 Blob 阴影尺寸时使用的倍率。"},"shadows.blob.size.minSize":{label:"最小尺寸",tooltip:"很小物体使用的最小 Blob 阴影尺寸。"},"shadows.blob.size.maxSize":{label:"最大尺寸",tooltip:"大型物体使用的最大 Blob 阴影尺寸。"},"shadows.staticProjected.enabled":{label:"启用",tooltip:"启用共用的静态烘焙阴影系统。"},"shadows.staticProjected.appearance.color":{label:"颜色",tooltip:"静态烘焙阴影颜色。透明度单独编辑。"},"shadows.staticProjected.appearance.color.a":{label:"不透明度",tooltip:"静态烘焙阴影不透明度,范围 0 到 1。"},"shadows.staticProjected.plane.height":{label:"高度",tooltip:"静态烘焙阴影所在的地面高度。"},"shadows.staticProjected.plane.yOffset":{label:"Y 偏移",tooltip:"静态烘焙阴影相对地面的垂直偏移,用于避免 z-fighting。"},"shadows.staticProjected.bake.padding":{label:"留白",tooltip:"烘焙静态阴影前给投影范围增加的留白。"},"shadows.staticProjected.bake.blur":{label:"模糊",tooltip:"静态阴影烘焙柔化预留半径。"},"shadows.staticProjected.bake.texelsPerMeter":{label:"每米像素",tooltip:"静态阴影 SDF atlas 的目标像素密度。"},"shadows.staticProjected.bake.atlasSize":{label:"Atlas 尺寸",tooltip:"每张静态阴影 atlas 页的最大宽高。"},"shadows.staticProjected.bake.maxAtlasPages":{label:"页预算",tooltip:"超过该 atlas 页数时,烘焙会降低实际每米像素以保护运行时成本。"},"shadows.staticProjected.bake.sdfRadiusPx":{label:"SDF 半径",tooltip:"用于重建清晰可控边缘的有符号距离半径,单位像素。"},"shadows.staticProjected.bake.spatialChunkSize":{label:"空间分块尺寸",tooltip:"进入 atlas packing 前,每个空间烘焙分块覆盖的世界尺寸。"},"shadows.staticProjected.bake.targetChunkCount":{label:"目标分块数",tooltip:"分块数量软预算。大场景会自动放大空间分块,尽量接近该数量。"},"shadows.planar.enabled":{label:"启用",tooltip:"启用共用的平面阴影系统。运行时和编辑器预览会使用同一套参数。"},"shadows.planar.appearance.color":{label:"颜色",tooltip:"平面阴影颜色。透明度单独编辑。"},"shadows.planar.appearance.color.a":{label:"不透明度",tooltip:"平面阴影不透明度,范围 0 到 1。"},"shadows.planar.plane.heightMode":{label:"高度来源",tooltip:"平面阴影接收高度。Auto 会优先从匹配的接收物体计算。",readonlyValue:{"Auto from Receivers":"自动从接收物体计算","Fixed Height":"固定高度"}},"shadows.planar.plane.height":{label:"备用高度",tooltip:"没有可用接收物体时使用的备用平面高度。"},"shadows.planar.plane.bias":{label:"偏移",tooltip:"投影偏移量,用来避免阴影和接收平面出现闪烁或重叠伪影。"},"shadows.planar.projection.footprintScale":{label:"投影缩放",tooltip:"围绕投射物中心缩放阴影轮廓。降低数值可减少硬边几何投影伪影。"},"shadows.planar.stencil.enabled":{label:"Stencil",tooltip:"使用模板缓冲,让阴影只绘制在匹配的接收物体上。"},"shadows.planar.casters.excludePatterns":{label:"排除投射物",placeholder:"每行一个匹配规则",tooltip:"名称匹配这些规则的 Mesh 不会投射平面阴影。"},"shadows.planar.casters.rootBoundaryPatterns":{label:"投射根节点",placeholder:"每行一个匹配规则",tooltip:"投射物自动检测的可选根节点边界规则。"},"shadows.planar.receivers.patterns":{label:"接收物体",placeholder:"每行一个匹配规则",tooltip:"名称匹配这些规则的 Mesh 可以接收平面阴影。"},"shadows.planar.direction":{label:"方向",tooltip:"阴影方向来自受保护的直射光。",readonlyValue:{"Follow Directional Light":"跟随直射光"}},"shadows.enabled":{label:"启用"},"shadows.settings.mapSize":{label:"贴图尺寸"},"shadows.settings.darkness":{label:"暗度"},"shadows.useCsm":{label:"启用"},"shadows.csm.numCascades":{label:"级联数量"},"shadows.csm.lambda":{label:"Lambda"}}}};function sc(e,t,r){const n=nt[t]??nt.en;e.title=n.title,e.summary=n.summary,e.status===nt.en.dirtyStatus&&(e.status=n.dirtyStatus);for(const a of e.actions??[])Vn(a,n,r);for(const a of e.sections){const o=n.sections[a.id];o?.title&&(a.title=o.title),o?.summary&&(a.summary=o.summary);for(const s of a.systems){const i=n.systems[s.id];if(s.group){const d=n.groups[s.group.id];d?.label&&(s.group.label=d.label),d?.summary&&(s.group.summary=d.summary)}i?.label&&(s.label=i.label),i?.summary&&!(s.id==="static-projected-shadow"&&s.status)&&(s.summary=i.summary),t==="zh"&&s.id==="environment-global"&&s.summary==="No IBL texture"&&(s.summary="未设置 IBL 贴图"),i?.disabled&&s.summary===nt.en.systems[s.id]?.disabled&&(s.summary=i.disabled),i?.compatibility&&s.summary===nt.en.systems[s.id]?.compatibility&&(s.summary=i.compatibility);for(const d of s.actions??[])Vn(d,n,r);for(const d of s.properties)ic(d,n)}}return e}function Vn(e,t,r){e.id==="revert-rendering"&&(e.label=t.revert,e.tooltip=r?t.revertDirty:t.revertClean),e.id==="bake-static-shadows"&&(e.label=t.bakeStatic,e.tooltip=e.disabled?e.tooltip===nt.en.bakeStaticRunning?t.bakeStaticRunning:t.bakeStaticDisabled:t.bakeStaticReady)}function ic(e,t){const r=t.properties[e.path];r&&(r.label&&(e.label=r.label),r.tooltip&&(e.tooltip=r.tooltip),r.placeholder&&(e.placeholder=r.placeholder),r.readonlyValue&&typeof e.value=="string"&&(e.value=r.readonlyValue[e.value]??e.value))}function lc(e={}){const t=ut(e);return{savedConfig:t,draftConfig:ut(t),dirty:!1,lastError:null}}function Hn(e,t){return e.draftConfig=ut(t),e.dirty=ln(e),e.lastError=null,e}function cc(e,t=e.draftConfig){return e.savedConfig=ut(t),e.draftConfig=ut(e.savedConfig),e.dirty=!1,e.lastError=null,e}function qn(e){return e.draftConfig=ut(e.savedConfig),e.dirty=!1,e.lastError=null,e}function dc(e,t){return e.lastError=t instanceof Error?t.message:String(t),e.dirty=ln(e),e}function ln(e){return!uc(e.savedConfig,e.draftConfig)}function ut(e){return!e||typeof e!="object"||Array.isArray(e)?{}:JSON.parse(JSON.stringify(e))}function uc(e,t){return JSON.stringify(e??{})===JSON.stringify(t??{})}function H(e,t){return{statusCode:e,body:t}}function Za(e){return{statusCode:e,body:null}}function mc(e){return typeof e=="string"?e:`${JSON.stringify(e??{},null,2)}
|
|
2
|
-
`}async function Ff(e,t){const r=String(e.method??"GET").toUpperCase();if(r==="OPTIONS")return Za(204);try{if(r==="GET"){const d=gc(await t.loadConfig?.()),l=d.renderingConfig;We(l);const u=Te(l);return H(200,{ok:!0,...d.response,renderingConfig:hc(l),normalized:u,summary:On(u)})}if(r!=="POST")return H(405,{ok:!1,error:"method_not_allowed"});const n=e.body??await t.readBody?.(e)??{},a=Pt(n.renderingConfig);if(!a)return H(400,{ok:!1,error:"missing_rendering_config"});We(a);const o=Te(a),s=On(o),i=await t.saveConfig?.({body:n,renderingConfig:a,normalized:o,summary:s});return H(200,{ok:!0,...i??{},renderingConfig:a,normalized:o,summary:s})}catch(n){const a=fc(n),o=pc(n);return H(a?.startsWith("schema.")?400:500,{ok:!1,error:a??(n instanceof Error?n.message:String(n)),...o?{path:o}:{},details:Pt(n?.details)})}}function fc(e){const t=e?.code;return typeof t=="string"&&t?t:null}function pc(e){const t=e?.path;return typeof t=="string"&&t?t:null}function Pt(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function hc(e){return Pt(e)??{}}function gc(e){const t=Pt(e);return t&&Object.prototype.hasOwnProperty.call(t,"renderingConfig")?{renderingConfig:t.renderingConfig,response:Pt(t.response)??{}}:{renderingConfig:e??{},response:{}}}const Qa="fps-editor.lighting-debug.open",eo="fps-editor.lighting-debug.language",bc=[{field:"environmentIntensity",textKey:"intensity",tooltipKey:"environmentIntensity",step:.01,min:0},{field:"iblIntensity",textKey:"iblIntensity",tooltipKey:"iblIntensity",step:.01,min:0,max:4},{field:"iblRotationY",textKey:"iblRotationY",tooltipKey:"iblRotationY",step:.01},{field:"directionalIntensity",textKey:"intensity",tooltipKey:"directionalIntensity",step:.01,min:0},{field:"directionalHorizontalAngle",textKey:"horizontalAngle",tooltipKey:"horizontalAngle",step:.01,min:-180,max:180},{field:"directionalElevationAngle",textKey:"elevationAngle",tooltipKey:"elevationAngle",step:.01,min:ds,max:cs},{field:"shadowStrength",textKey:"shadowStrength",tooltipKey:"shadowStrength",step:.01,min:0,max:1},{field:"shadowSoftness",textKey:"shadowSoftness",tooltipKey:"shadowSoftness",step:.005,min:0,max:1}];function Ne(e){const t=bc.find(r=>r.field===e);if(!t)throw new Error(`Missing lighting number field config: ${e}`);return t}function xr(e){const t=e.trim();if(!t||/^[+-]$/.test(t)||t.endsWith(".")||/[eE][+-]?$/.test(t))return null;const r=Number(t);return Number.isFinite(r)?r:null}const Yn={zh:{title:"光照调试",runtime:"运行时",languageButton:"EN",toggleTitle:"打开光照调试面板",environmentSection:"环境光",environmentTextureSection:"环境贴图 IBL",directionalSection:"直射光",shadowSection:"阴影外观",enabled:"启用",intensity:"强度",iblIntensity:"IBL 强度",iblRotationY:"IBL 旋转",skyLightColor:"天空光颜色",groundColor:"地面颜色",horizontalAngle:"水平角",elevationAngle:"高度角",lightColor:"光照颜色",rawDirection:"原始方向",shadowReadout:"阴影",shadowStrength:"阴影强度",shadowSoftness:"轮廓柔和度",shadowMap:"Shadow Map",shadowPlanarFollow:"Planar / 跟随直射光",shadowDynamic:"动态阴影",shadowBlob:"Blob 阴影",shadowStatic:"静态烘焙阴影",shadowNone:"Off",shadowUnknown:"Unknown",reset:"重置参数",save:"保存参数",resetStatus:"已重置为初始运行时光照。",savingStatus:"正在保存光照、IBL 和阴影参数...",savedStatus:"已保存光照、IBL 和阴影参数。",saveFailed:"保存失败",missingBindingStatus:"缺少光源绑定,只能临时预览,不能保存。"},en:{title:"Lighting Debug",runtime:"Runtime",languageButton:"中文",toggleTitle:"Toggle lighting debug panel",environmentSection:"Environment Light",environmentTextureSection:"Environment Texture IBL",directionalSection:"Directional Light",shadowSection:"Shadow Appearance",enabled:"Enabled",intensity:"Intensity",iblIntensity:"IBL Intensity",iblRotationY:"IBL Rotation",skyLightColor:"Sky Light Color",groundColor:"Ground Color",horizontalAngle:"Horizontal Angle",elevationAngle:"Elevation Angle",lightColor:"Light Color",rawDirection:"Raw Direction",shadowReadout:"Shadow",shadowStrength:"Shadow Strength",shadowSoftness:"Edge Softness",shadowMap:"Shadow Map",shadowPlanarFollow:"Planar / Follow Directional Light",shadowDynamic:"Dynamic Shadow",shadowBlob:"Blob Shadow",shadowStatic:"Static Baked Shadow",shadowNone:"Off",shadowUnknown:"Unknown",reset:"Reset",save:"Save Parameters",resetStatus:"Reset to initial runtime lighting.",savingStatus:"Saving lighting, IBL and shadows...",savedStatus:"Saved lighting, IBL and shadows.",saveFailed:"Save failed",missingBindingStatus:"Light binding missing; preview only, saving disabled."}},Wn={zh:{languageButton:"切换光照调试面板的显示语言。",toggleTitle:"打开或关闭运行时光照调试面板。",enabled:"启用或禁用对应的运行时光源,保存后写回编辑器场景。",environmentIntensity:"环境光强度,对应运行时环境光 intensity。",iblIntensity:"环境贴图对 PBR 材质的光照贡献强度;实时预览不会重新加载贴图。",iblRotationY:"环境贴图绕 Y 轴的旋转弧度,用于调整环境反射和高光方向。",directionalIntensity:"直射光强度,对应运行时直射光 intensity。",skyLightColor:"环境光来自天空方向的漫反射颜色。",groundColor:"环境光来自地面反射方向的颜色。",horizontalAngle:"直射光在 XZ 平面内的朝向角度,会转换为运行时方向向量。",elevationAngle:"直射光相对地平线的高度角;90 度表示从正上方照下。",lightColor:"直射光漫反射颜色。",rawDirection:"只读方向向量,用于排查运行时转换结果。",shadowReadout:"只读阴影状态;支持宿主提供的运行时阴影模式摘要。",shadowStrength:"控制阴影的可见深浅;1 最深,0 不显示阴影。",shadowSoftness:"控制阴影接收边缘的柔和程度;0 表示硬边。",reset:"恢复为打开运行时时读取到的初始光照、IBL 和阴影参数。",save:"通过编辑器保存链路写回环境光、直射光、IBL 和 Shadow Map 外观参数。"},en:{languageButton:"Switch the lighting debug panel language.",toggleTitle:"Open or close the runtime lighting debug panel.",enabled:"Enable or disable the runtime light and save it back to the editor scene.",environmentIntensity:"Environment intensity. Maps to the runtime environment light intensity.",iblIntensity:"Environment texture contribution to PBR lighting. Live preview does not reload the texture.",iblRotationY:"Environment texture rotation around the Y axis in radians, affecting reflections and highlights.",directionalIntensity:"Directional intensity. Maps to the runtime directional light intensity.",skyLightColor:"Diffuse sky color for the environment light.",groundColor:"Ground bounce color for the environment light.",horizontalAngle:"Directional heading in the XZ plane, converted to a runtime direction vector.",elevationAngle:"Directional elevation above the horizon; 90 degrees points straight down.",lightColor:"Directional diffuse color.",rawDirection:"Read-only direction vector for checking runtime conversion.",shadowReadout:"Read-only shadow status supplied by the host runtime.",shadowStrength:"Visible shadow strength. One is darkest; zero hides the shadow.",shadowSoftness:"Receiver-edge softness. Zero produces a hard edge.",reset:"Restore the lighting, IBL and shadows captured when runtime opened.",save:"Save lighting, IBL and Shadow Map appearance through the editor authoring pipeline."}};function Sc(e){return Yn[e]??Yn.zh}function yc(e){return Wn[e]??Wn.zh}function Ec(e,t){return e==="shadow-map"?t.shadowMap:e==="planar"?t.shadowPlanarFollow:e==="dynamic"?t.shadowDynamic:e==="blob"?t.shadowBlob:e==="static"?t.shadowStatic:e==="none"?t.shadowNone:t.shadowUnknown}function wc(e){try{return e?.localStorage?.getItem(Qa)==="true"}catch{return!1}}function Pc(e,t){try{e?.localStorage?.setItem(Qa,String(t))}catch{}}function Ic(e){try{return e?.localStorage?.getItem(eo)==="en"?"en":"zh"}catch{return"zh"}}function Ac(e,t){try{e?.localStorage?.setItem(eo,t)}catch{}}function $f(e,t){const r=Kn(Kn(e)?.__fpsEditor),n=Ee(r?.sourceId),a=Ee(r?.objectGuid),o=Ee(r?.objectId),s=Ee(r?.propertyPath),i=Ee(r?.lightType);return!n||s!=="light"||!a&&!o||t&&i&&i!==t?null:{sourceId:n,propertyPath:"light",...t?{lightType:t}:i?{lightType:i}:{},...a?{objectGuid:a}:{},...o?{objectId:o}:{}}}function Cc(e){const t=Ee(e.sourceId),r=Ee(e.propertyPath),n=Ee(e.objectGuid),a=Ee(e.objectId),o=Ee(e.lightType);if(!t)throw new Error("Runtime light binding is missing sourceId.");if(r!=="light")throw new Error(`Runtime light binding is not for light: ${r??"missing"}`);if(!n&&!a)throw new Error("Runtime light binding is missing objectGuid/objectId.");return{sourceId:t,propertyPath:r,...n?{objectGuid:n}:{},...a?{objectId:a}:{},...o?{lightType:o}:{}}}function Kn(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Ee(e){return typeof e=="string"&&e.trim()?e.trim():null}function ze(e){return{environment:{enabled:e.environment.enabled,binding:e.environment.binding?{...e.environment.binding}:null,light:{type:"hemispheric",intensity:e.environment.light.intensity,...e.environment.light.diffuseColor?{diffuseColor:{...e.environment.light.diffuseColor}}:{},...e.environment.light.groundColor?{groundColor:{...e.environment.light.groundColor}}:{}}},...e.environmentTexture?{environmentTexture:{...e.environmentTexture}}:{},directional:{enabled:e.directional.enabled,binding:e.directional.binding?{...e.directional.binding}:null,light:{type:"directional",intensity:e.directional.light.intensity,direction:{...e.directional.light.direction},...e.directional.light.diffuseColor?{diffuseColor:{...e.directional.light.diffuseColor}}:{}}},shadow:{...e.shadow,...e.shadow.shadowMap?{shadowMap:{...e.shadow.shadowMap,lastRefreshReasons:[...e.shadow.shadowMap.lastRefreshReasons],...e.shadow.shadowMap.appearance?{appearance:{...e.shadow.shadowMap.appearance}}:{}}}:{}}}}function Qt(e){return!!e.environment.binding&&!!e.directional.binding}function Uf(e){return Qt(e)?[{binding:e.environment.binding,enabled:e.environment.enabled,light:e.environment.light},{binding:e.directional.binding,enabled:e.directional.enabled,light:e.directional.light}]:[]}function ht(e,t){switch(t){case"environmentIntensity":return e.environment.light.intensity;case"iblIntensity":return e.environmentTexture?.iblIntensity??0;case"iblRotationY":return e.environmentTexture?.iblRotationY??0;case"directionalIntensity":return e.directional.light.intensity;case"directionalHorizontalAngle":return Hr(e.directional.light.direction).horizontalAngleDeg;case"directionalElevationAngle":return Hr(e.directional.light.direction).elevationAngleDeg;case"shadowStrength":return e.shadow.shadowMap?.appearance?.strength??0;case"shadowSoftness":return e.shadow.shadowMap?.appearance?.softness??0}}function Jn(e,t){switch(t){case"environmentDiffuseColor":return e.environment.light.diffuseColor??{r:1,g:1,b:1};case"environmentGroundColor":return e.environment.light.groundColor??{r:.48,g:.52,b:.62};case"directionalDiffuseColor":return e.directional.light.diffuseColor??{r:1,g:1,b:1}}}function xc(e,t,r){if(!Number.isFinite(r))return ze(e);const n=ze(e);switch(t){case"environmentIntensity":return n.environment.light.intensity=r,n;case"iblIntensity":return n.environmentTexture&&(n.environmentTexture.iblIntensity=r),n;case"iblRotationY":return n.environmentTexture&&(n.environmentTexture.iblRotationY=r),n;case"directionalIntensity":return n.directional.light.intensity=r,n;case"directionalHorizontalAngle":{const a=Nn(e.directional.light.direction);return Xn(n,r,a.elevationAngleDeg)}case"directionalElevationAngle":{const a=Nn(e.directional.light.direction);return Xn(n,a.horizontalAngleDeg,r)}case"shadowStrength":{const a=n.shadow.shadowMap?.appearance;return a&&(a.strength=r,a.darkness=1-r),n}case"shadowSoftness":return n.shadow.shadowMap?.appearance&&(n.shadow.shadowMap.appearance.softness=r),n}}function vc(e,t,r){const n=ze(e);switch(t){case"environmentDiffuseColor":return n.environment.light.diffuseColor={...r},n;case"environmentGroundColor":return n.environment.light.groundColor={...r},n;case"directionalDiffuseColor":return n.directional.light.diffuseColor={...r},n}}function Mc(e,t,r){const n=ze(e);return n[t].enabled=r,n}function Xn(e,t,r){const n=ms(t,r);return Rc(e,n)}function Rc(e,t){const r=ze(e);return r.directional.light.direction={...t},r.shadow.projectedLengthMultiplier=us(t),r}function Tc(e,t,r,n={}){const a=new Set(e.map(i=>i.id)),o=Dc(n.normalizeBaseName?.(t)??t)||r;if(!a.has(o))return o;let s=2;for(;a.has(`${o}_${s}`);)s+=1;return`${o}_${s}`}function kc(e){return{id:e.nodeId,name:e.displayName,kind:"instance",instance:{assetId:e.assetId},transform:{position:e.position,rotation:{x:0,y:0,z:0},...e.instanceScale?{scale:e.instanceScale}:{}}}}function Vf(e,t){const r=e.trim();return{assetId:r,nodeIds:t.filter(n=>n.kind==="instance"&&n.instance?.assetId===r||n.kind==="image"&&n.image?.assetId===r).map(n=>n.id)}}function Dc(e){return String(e??"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}async function Hf(e,t,r,n){const a=e.assetId?.trim()??"";try{const o=r.assetFacade.resolveAssetReference({assets:t.catalogReader.getAssets()},e),s=Tc(t.documentWriter.getNodes(),o.displayName,o.assetId,{normalizeBaseName:r.normalizeNodeIdBaseName}),i=t.runtimePlacement.resolveDropPosition(e,n),d=kc({nodeId:s,assetId:o.assetId,displayName:o.displayName,position:i,instanceScale:r.readScale?.(e.instanceScale)});await t.runtimePlacement.prepareRuntimeAsset(o.asset,e.assetUrl,n);const l=t.documentWriter.addAssetNode({asset:o.asset,node:d},n);return{...e.requestId?{requestId:e.requestId}:{},ok:!0,guid:o.guid,assetId:o.assetId,nodeId:l.node.id,rootNode:l.rootNode??null}}catch(o){const s=r.readErrorCode?.(o);return{...e.requestId?{requestId:e.requestId}:{},ok:!1,...e.guid?{guid:e.guid}:{},assetId:a,...s?{code:s}:{},error:o instanceof Error?o.message:String(o)}}}function qf(e,t,r,n){const a=t.removeSceneNode(e,n);return{ok:!!a,assetId:"",nodeId:e,...a?{}:{code:r.nodeNotFoundCode,error:r.nodeNotFoundCode}}}function Yf(e,t,r={}){const n=to(e);let a=fs(e);const o=[];for(const s of t){const i=Oc(s),d=Cc(i.binding);if(r.expectedSourceId&&d.sourceId!==r.expectedSourceId)throw new Error(`Runtime light binding source mismatch: ${d.sourceId} !== ${r.expectedSourceId}`);const l=_c(a,d,n);if(!l)throw new Error("Runtime light binding did not match an editor light object.");Lc(l,i.light.type,d),a=gt(a,l.id,"enabled",i.enabled,r),a=gt(a,l.id,"light.intensity",i.light.intensity,r),i.light.diffuseColor&&(a=gt(a,l.id,"light.diffuseColor",i.light.diffuseColor,r)),i.light.type==="hemispheric"?i.light.groundColor&&(a=gt(a,l.id,"light.groundColor",i.light.groundColor,r)):a=gt(a,l.id,"light.direction",i.light.direction,r),o.push({id:l.id,...l.guid?{objectGuid:l.guid}:{},lightType:i.light.type})}return{document:a,targets:o}}function _c(e,t,r=to(e)){if(t.objectGuid){const o=e.scene.gameObjects.find(s=>s.guid===t.objectGuid)??null;if(o){if(t.objectId&&o.id!==t.objectId)throw new Error(`Runtime light binding guid/id conflict: ${t.objectGuid} belongs to ${o.id}, not ${t.objectId}.`);return o}}if(!t.objectId)return null;const n=e.scene.gameObjects.find(o=>o.id===t.objectId)??null;if(!n)return null;const a=r.get(n.id);if(t.objectGuid&&a&&a!==t.objectGuid)throw new Error(`Runtime light binding guid conflict for ${n.id}.`);return n}function Oc(e){const t=Bc(e.enabled,"enabled");return e.light.type==="hemispheric"?{binding:e.binding,enabled:t,light:Nc(e.light)}:{binding:e.binding,enabled:t,light:jc(e.light)}}function Nc(e){if(e.type!=="hemispheric")throw new Error("Runtime light patch must be hemispheric.");return{type:"hemispheric",intensity:ro(e.intensity,"hemispheric.intensity"),...e.diffuseColor?{diffuseColor:Kr(e.diffuseColor,"hemispheric.diffuseColor")}:{},...e.groundColor?{groundColor:Kr(e.groundColor,"hemispheric.groundColor")}:{}}}function jc(e){if(e.type!=="directional")throw new Error("Runtime light patch must be directional.");return{type:"directional",intensity:ro(e.intensity,"directional.intensity"),direction:ps(zc(e.direction,"directional.direction")),...e.diffuseColor?{diffuseColor:Kr(e.diffuseColor,"directional.diffuseColor")}:{}}}function gt(e,t,r,n,a){return a.patchLightField?a.patchLightField(e,t,r,n):gs(e,t,r,n,a.fieldMutation)}function Lc(e,t,r){if(!hs(e))throw new Error(`Runtime light binding target is not a light object: ${e.id}`);if(!e.light)throw new Error(`Runtime light binding target is missing light config: ${e.id}`);if(e.light.type!==t)throw new Error(`Runtime light binding type mismatch for ${e.id}: ${e.light.type} !== ${t}`);if(r.lightType&&r.lightType!==t)throw new Error(`Runtime light binding metadata type mismatch: ${r.lightType} !== ${t}`)}function to(e){const t=new Map;for(const r of e.scene.gameObjects){const n=Gc(r.guid);n&&t.set(r.id,n)}return t}function Bc(e,t){if(typeof e!="boolean")throw new Error(`Runtime light ${t} must be a boolean.`);return e}function ro(e,t){if(typeof e!="number"||!Number.isFinite(e)||e<0)throw new Error(`Runtime light ${t} must be a non-negative finite number.`);return e}function Kr(e,t){return{r:st(e.r,`${t}.r`),g:st(e.g,`${t}.g`),b:st(e.b,`${t}.b`)}}function zc(e,t){return{x:st(e.x,`${t}.x`),y:st(e.y,`${t}.y`),z:st(e.z,`${t}.z`)}}function st(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Error(`Runtime light ${t} must be a finite number.`);return e}function Gc(e){return typeof e=="string"&&e.trim()?e.trim():null}function no(e,t){const r=typeof t?.materialAssetId=="string"?t.materialAssetId.trim():"",n=r?e.scene.materialAssets?.find(o=>o.id===r)??null:null,a=bs(n?.properties,t?.override);return{materialAsset:n,...n?{materialAssetShaderId:n.shaderId}:{},profile:a,...r&&!n?{missingMaterialAssetId:r}:{}}}function Wf(e,t){const r=no(e,t.overrides?.materialBinding),n={},a=Ss(r.materialAssetShaderId);return a&&(Object.keys(r.profile).length>0?(n.artistMaterialShaderId=a,n.artistMaterialProfile=r.profile):n.artistMaterialShaderId=a),n}function Kf(e,t){const r={},n=t.overrides?.materialSlotBindings??{};for(const[a,o]of Object.entries(n)){if(!a||!o)continue;const s=no(e,o);Object.keys(s.profile).length!==0&&(r[a]=s.profile)}return r}function Jf(e,t){const r=Fc(t),n=[];for(const a of e.inspector.fields){if(a.control!=="color"||a.updateClass!=="uniform")continue;const o=$c(e,a.schemaPath??a.path);if(o?.kind!=="color")continue;const s=o.channels===4?"vec4":"vec3",i=r.get(a.binding);if(!i){n.push({code:"material.shaderColorBindingMissing",path:a.path,binding:a.binding,expectedType:s,message:`GLSL uniform ${a.binding} is missing; expected ${s}.`});continue}i!==s&&n.push({code:"material.shaderColorBindingTypeMismatch",path:a.path,binding:a.binding,expectedType:s,actualType:i,message:`GLSL uniform ${a.binding} uses ${i}; Shader Definition expects ${s}.`})}return n}function Fc(e){const t=e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,""),r=new Map,n=/\buniform\s+(?:(?:lowp|mediump|highp)\s+)?([A-Za-z_]\w*)\s+([A-Za-z_]\w*)\s*(?:\[[^\]]+\])?\s*;/g;for(const a of t.matchAll(n))r.set(a[2],a[1]);return r}function $c(e,t){const r=t.replace(/^properties\./,"").split(".").filter(Boolean);let n=e.propertiesSchema;for(const a of r){if(n.kind!=="object")return null;const o=n.properties[a];if(!o)return null;n=o}return n}const Xf=["model","texture","image","sound"],cn=[".glb",".gltf"],ao=[".png",".jpg",".jpeg",".webp"],Uc=[".env",".hdr",".dds",".ktx",".ktx2"],dn=[...ao,...Uc],un=[".mp3",".wav",".ogg",".flac",".aac",".m4a"],Vc=[...cn,...dn,...un];function Hc(e){return e.randomUUID?e.randomUUID():Kc(e)}function oo(e){return String(e??"").trim().toLowerCase().replace(/-/g,"")}function qc(e,t){const r=oo(t);return`${e==="model"?"asset":e==="texture"?"texture":e==="sound"?"sound":"image"}_${r}`}function Zf(e){const a=String(e??"").trim().split(/[^a-zA-Z0-9_$]+/).filter(Boolean).map((o,s)=>s===0?o:`${o.charAt(0).toUpperCase()}${o.slice(1)}`).join("").replace(/[^a-zA-Z0-9_$]/g,"")||"assetUrl";return/^[a-zA-Z_$]/.test(a)?a:`asset${a}`}function Yc(e,t=""){const r=String(e??"").trim().toLowerCase();if(r==="glb"||r==="gltf"||r==="model")return"model";if(r==="groundtexture"||r==="ground-texture"||r==="texture")return"texture";if(r==="ui"||r==="image"||r==="img")return"image";if(r==="audio"||r==="sound")return"sound";const n=Wc(t);return cn.includes(n)?"model":un.includes(n)?"sound":dn.includes(n)?"texture":null}function Wc(e){const t=e.split(/[?#]/,1)[0]??"",r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),n=t.slice(r+1),a=n.lastIndexOf(".");return a>=0?n.slice(a).toLowerCase():""}function Kc(e){const t=new Uint8Array(16);if(!e.fillRandomBytes)throw new Error("Asset GUID random source must provide randomUUID or fillRandomBytes.");if(e.fillRandomBytes(t),t.every(n=>n===0))throw new Error("Asset GUID random source returned no entropy.");t[6]=t[6]&15|64,t[8]=t[8]&63|128;const r=[...t].map(n=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function mn(e){let t=String(e??"").trim();const r=t.toLowerCase();for(const n of[...Vc].sort((a,o)=>o.length-a.length))if(r.endsWith(n)){t=t.slice(0,-n.length);break}return t}function Qf(e,t){return String(e??"").trim()||mn(t)||"Asset"}function ep(e,t){return mn(e||t).trim().toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/_{2,}/g,"_")||null}function tp(e){return e==="model"?cn:e==="sound"?un:e==="texture"?dn:e==="image"?ao:[]}function so(e){const t=typeof e=="string"&&e.trim()?e.trim():void 0;if(!t)return;if(t.includes("\0"))throw new Error("external_asset_path_must_be_portable");const r=t.replace(/\\/g,"/");if(r.startsWith("/")||/^[a-z]:\//i.test(r)||/^[a-z][a-z0-9+.-]*:/i.test(r))throw new Error("external_asset_path_must_be_portable");const n=[];for(const a of r.split("/"))if(!(!a||a===".")){if(a==="..")throw new Error("external_asset_path_must_be_portable");n.push(a)}if(n.length===0)throw new Error("external_asset_path_must_be_portable");return n.join("/")}function Fe(e){return io(e)[0]??null}function io(e){return Array.isArray(e.assets)?e.assets.filter(t=>!!t&&typeof t=="object"&&!Array.isArray(t)):[]}function fn(e){const t=Fe(e),r=_(e.assetType)??_(t?.assetType)??_(t?.type)??_(t?.kind);if(r&&/^(texture|image|png|jpg|jpeg|webp)$/i.test(r)||(_(e.mimeType)??_(t?.mimeType))?.toLowerCase().startsWith("image/"))return"texture";const a=lo(e)??Jr(mr(e)??"")??Jr(It(e)??"");return a&&td(a)?"texture":"model"}function mr(e){const t=Fe(e),r=_(e.assetPath)??_(t?.assetPath)??_(e.path)??_(t?.path);if(r)return Zn(r);const n=It(e);return n?.startsWith("/@fs/")?Zn(n.slice(4)):null}function It(e){const t=Fe(e);return _(e.assetUrl)??_(t?.assetUrl)??_(t?.url)??null}function lo(e){const t=Fe(e);return _(e.assetName)??_(t?.assetName)??_(t?.name)??null}function pn(e){const t=Fe(e);return _(e.platformAssetId)??_(t?.platformAssetId)??_(e.assetId)??_(t?.assetId)??_(t?.id)??null}function Ke(e){const t=Qn(e.external),r=Fe(e),n=Qn(r?.external),a=_(t.platformAssetId)??_(n.platformAssetId)??pn(e),o=Object.prototype.hasOwnProperty.call(t,"assetPath")||Object.prototype.hasOwnProperty.call(n,"assetPath"),s=Object.prototype.hasOwnProperty.call(t,"assetPath")?t.assetPath:Object.prototype.hasOwnProperty.call(n,"assetPath")?n.assetPath:void 0;if(o&&s===void 0)throw new Error("external_asset_path_must_be_portable");const i=_(t.assetUrl)??It(e)??void 0;return Qc({platformAssetId:a,assetPath:s,assetUrl:i})}function Jc(e,t={}){const r=Bt(e.position),n=r?null:hn(e),a=n?t.projectDropPoint?.(n)??null:null;if(!r&&n&&!a)throw new Error("platform_asset_drop_point_projection_failed");const o=r??a;if(o)return{position:o,rotation:Bt(e.rotation)??{x:0,y:0,z:0},scale:Bt(e.scale)??Bt(e.instanceScale)??{x:1,y:1,z:1}}}function Xc(e,t={}){const r=mr(e);if(!r)throw new Error("assetPath is required to register a new project asset");const n=fn(e),a=_(e.projectAssetId),o=pn(e),s=lo(e),i=_(e.displayName),d=s??Jr(r)??`asset${n==="texture"?".png":".glb"}`,l=t.now?.()??Date.now(),u=t.payloadPath??t.createPayloadPath?.({platformAssetId:o,projectAssetId:a,now:l})??`/tmp/playable-editor-asset-${o??a??l.toString(36)}-${l.toString(36)}.json`,c={sourcePath:r,assetPath:r,assetType:n,...It(e)?{assetUrl:It(e)}:{},..._(e.guid)?{guid:_(e.guid)}:{},...a?{projectAssetId:a}:{},...o?{platformAssetId:o}:{},external:Ke(e),...!t.preserveExistingPresentation||s?{assetName:d}:{},...!t.preserveExistingPresentation||i?{displayName:i??Zc(d)}:{},..._(e.codeKey)?{codeKey:_(e.codeKey)}:{},..._(e.category)?{category:_(e.category)}:{},...e.defaultScale!=null?{defaultScale:e.defaultScale}:{},...e.scale!=null?{scale:e.scale}:{},...e.metadata&&typeof e.metadata=="object"&&!Array.isArray(e.metadata)?{metadata:e.metadata}:{}};return{payloadPath:u,content:c,assetName:d,assetType:n,...a?{projectAssetId:a}:{},...o?{platformAssetId:o}:{}}}function Zc(e){return e.replace(/\.(glb|gltf|png|jpe?g|webp)$/i,"")}function Zn(e){return e.startsWith("/@fs/")?e.slice(4):e}function hn(e){const t=e.point;if(!t||typeof t!="object")return null;const r=t,n=typeof r.x=="number"&&Number.isFinite(r.x)?r.x:null,a=typeof r.y=="number"&&Number.isFinite(r.y)?r.y:null;if(n==null||a==null)throw new Error("platform_asset_drop_point_invalid_coordinates");if(r.space==="iframe-client-css-px")return{space:r.space,x:n,y:a};if(r.space==="scene-view-normalized"){if(n<0||n>1||a<0||a>1)throw new Error("platform_asset_drop_point_normalized_out_of_range");return{space:r.space,x:n,y:a}}throw new Error("platform_asset_drop_point_space_required")}function Qc(e){const t=_(e.platformAssetId),r=ed(e.assetPath),n=_(e.assetUrl);if(!(!t&&!r&&!n))return{...t?{platformAssetId:t}:{},...r?{assetPath:r}:{},...n?{assetUrl:n}:{}}}function ed(e){if(e===void 0)return;const t=so(e);if(!t)throw new Error("external_asset_path_must_be_portable");return t}function Bt(e){if(!e||typeof e!="object")return null;const t=e,r=typeof t.x=="number"&&Number.isFinite(t.x)?t.x:null,n=typeof t.y=="number"&&Number.isFinite(t.y)?t.y:null,a=typeof t.z=="number"&&Number.isFinite(t.z)?t.z:null;return r==null||n==null||a==null?null:{x:r,y:n,z:a}}function td(e){return/\.(png|jpe?g|webp)$/i.test(rd(e))}function Jr(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).pop()??null}function rd(e){return e.split("?")[0]??e}function _(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function Qn(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function rp(e={}){const t=e.ttlMs??3e4,r=e.now??(()=>Date.now()),n=new Map;return{remember(a){const o=hn(a);for(const s of io(a)){const i=ea(s);if(i.length===0)continue;const d={point:o??void 0,asset:s,timestamp:r()};for(const l of i)n.set(l,d)}vr(n,t,r())},normalize(a){vr(n,t,r());const o=Fe(a);if(!o)return a;const s=ea(o),i=s.map(d=>n.get(d)).find(d=>!!d)??null;for(const d of s)n.delete(d);return nd(a,i)},clearExpired(){vr(n,t,r())}}}function nd(e,t){const r=Fe(e);if(!r)return e;const n=t?.asset??{},a={...n,...r,...e},o=V(e.assetName)??V(r.assetName)??V(r.name)??V(n.assetName)??V(n.name),s=V(e.assetPath)??V(r.assetPath)??V(r.path)??V(n.assetPath)??V(n.path),i=V(e.assetUrl)??V(r.assetUrl)??V(r.url)??V(n.assetUrl)??V(n.url);return{...a,...o?{assetName:o}:{},...s?{assetPath:s}:{},...i?{assetUrl:i}:{},...t?.point&&!hn(a)?{point:t.point}:{}}}function vr(e,t,r){for(const[n,a]of e)r-a.timestamp>t&&e.delete(n)}function ea(e){return[V(e.id),V(e.platformAssetId),V(e.assetId)].filter((t,r,n)=>!!t&&n.indexOf(t)===r)}function V(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function ad(e){const t=Ge(e);return Ge(t?.result)??t??{}}function co(e){const t=ad(e.result),r=e.fallback??{},n=Ge(t.external),a=n?Ke({external:n}):void 0;return{...he(t.guid)??r.guid?{guid:he(t.guid)??r.guid}:{},assetId:he(t.assetId)??r.assetId??"",...he(t.contentHash)??r.contentHash?{contentHash:he(t.contentHash)??r.contentHash}:{},...he(t.assetUrl)??r.assetUrl?{assetUrl:he(t.assetUrl)??r.assetUrl}:{},...a??r.external?{external:a??r.external}:{}}}function od(e,t){const r=Xc(e,t);return{registration:r,transportPlan:{writes:[{path:r.payloadPath,content:r.content}],commands:[sd(r.payloadPath,t)]}}}function sd(e,t){if(typeof t.command=="string")return{cmd:`${t.command} -- --payload ${e}`,...t.cwd?{cwd:t.cwd}:{}};if(t.command)return{...t.command,cmd:t.command.cmd.includes("--payload")?t.command.cmd:`${t.command.cmd} -- --payload ${e}`};if(!t.commandName)throw new Error("asset registration commandName or command is required");return{cmd:`${t.commandName} -- --payload ${e}`,cwd:t.cwd??"."}}async function id(e,t){const r=await t.findExistingAsset?.(e);return r||uo(e,t)}async function uo(e,t){const r=mr(e),n=he(e.projectAssetId);if(!r&&n)return{assetId:n,...Ke(e)?{external:Ke(e)}:{}};if(!r)throw new Error("assetPath is required to register a new project asset");const{registration:a,transportPlan:o}=od(e,{...t,preserveExistingPresentation:!0});for(const i of o.writes)await t.writeFile(i.path,i.content);let s={};for(const i of o.commands)s=await t.runCommand(i);return co({result:s,fallback:{assetId:n??"",external:Ke(e),assetUrl:he(a.content.assetUrl)}})}function np(e={}){return{postJson(t,r){return gn(t,r,e)},writeFile(t,r){return nr(t,r,e)},runCommand(t){return ar(t,e)},executeTransportPlan(t){return mo(t,e)}}}async function gn(e,t,r){const n=ld(r);return n.fetchJson(ys(n.endpointBase,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function nr(e,t,r){return gn("/file",{path:e,content:t},r)}async function ar(e,t){return gn("/exec",{cmd:e.cmd,...e.cwd?{cwd:e.cwd}:{}},t)}async function mo(e,t){for(const n of e.writes)await nr(n.path,n.content,t);let r={};for(const n of e.commands){const a=await ar(n,t),o=Ge(a.result);r=o&&Object.keys(o).length>0?o:a}return r}function ld(e){return typeof e=="function"?{endpointBase:jn,fetchJson:e}:{endpointBase:e?.endpointBase??jn,fetchJson:e?.fetchJson??Es}}function cd(e={}){let t=Promise.resolve(),r=Promise.resolve();return async n=>{const a=ws(n.name);if(a===pt.ASSET_LIBRARY_REFRESH){await ud(n,e);return}if(a===pt.ASSET_IMPORT||a===pt.ASSETS_LOADED){const o=t.then(()=>md(n,e));t=o.catch(()=>{}),await o;return}if(a===pt.ASSET_UPDATE){const o=r.then(()=>dd(n,e));r=o.catch(()=>{}),await o;return}a===pt.EDITOR_ASSET_PLACE&&await fd(n,e)}}async function dd(e,t){const r=xt(e.payload),n=bn(e.payload,t);try{await e.ensureEditorMode(),await e.harness.runExclusiveDocumentOperation(()=>e.runWithAssetLoadingOverlay(async()=>{if(!t.registerAsset)throw new Error("asset update registration is unavailable");const a=await t.registerAsset(n);if(!a.contentHash)throw new Error("asset_update_registration_missing_content_hash");const o=await e.harness.refreshUpdatedAsset({assetId:a.assetId,expectedContentHash:a.contentHash});e.postEvent(ke.ASSET_UPDATE_RESULT,{...r?{requestId:r}:{},ok:o.ok,guid:a.guid,assetId:a.assetId,contentHash:a.contentHash,external:a.external,assetCount:o.assetCount,reconciledBindingCount:o.reconciledBindingCount,warnings:o.warnings,status:o.status,...o.error?{error:o.error}:{}})}))}catch(a){const o=fo(e.payload);e.postEvent(ke.ASSET_UPDATE_RESULT,{...r?{requestId:r}:{},ok:!1,assetId:vt(n.projectAssetId)??"",...o?{external:o}:{},reconciledBindingCount:0,warnings:[],error:fr(a)})}}async function ud(e,t){const r=xt(e.payload);try{await e.ensureEditorMode(),await e.harness.runExclusiveDocumentOperation(()=>e.runWithAssetLoadingOverlay(async()=>{const n=await e.harness.reloadAssets();e.postEvent(ke.ASSET_LIBRARY_REFRESHED,{...r?{requestId:r}:{},...n})}))}catch(n){e.postEvent(ke.ASSET_LIBRARY_REFRESHED,{...r?{requestId:r}:{},ok:!1,assetCount:0,status:t.refreshFailedStatus??"Asset reload failed",error:fr(n)})}}async function md(e,t){const r=xt(e.payload),n=bn(e.payload,t);try{await e.ensureEditorMode();const a=await e.harness.runExclusiveDocumentOperation(()=>e.runWithAssetLoadingOverlay(async()=>{const o=await pd(n,t),s=await e.harness.reloadAssets();if(!s.ok)throw new Error(s.error??s.status);const i=await po(e.harness,o.assetId,{placement:ho(n,t,e.harness)}),d=fn(n);return{...r?{requestId:r}:{},ok:i.ok,guid:o.guid,assetId:o.assetId,kind:d==="texture"?"texture":"model",external:o.external,nodeId:i.createdId??void 0,assetCount:s.assetCount,status:i.status,...i.error?{error:i.error}:{}}}));await e.harness.waitForDocumentOperationIdle?.({timeoutMs:5e3}),e.postEvent(ke.ASSET_IMPORT_RESULT,a)}catch(a){const o=fo(e.payload);e.postEvent(ke.ASSET_IMPORT_RESULT,{...r?{requestId:r}:{},ok:!1,assetId:vt(n.projectAssetId)??"",...o?{external:o}:{},error:fr(a)})}}function fo(e){try{return Ke(e)}catch{return}}async function fd(e,t){const r=xt(e.payload),n=bn(e.payload,t);let a=vt(n.projectAssetId)??"";try{await e.ensureEditorMode(),await e.harness.runExclusiveDocumentOperation(()=>e.runWithAssetLoadingOverlay(async()=>{a=await hd(n,t);const o=await po(e.harness,a,{placement:ho(n,t,e.harness)});e.postEvent(ke.EDITOR_ASSET_PLACE_RESULT,{...r?{requestId:r}:{},ok:o.ok,assetId:a,nodeId:o.createdId??void 0,status:o.status,...o.error?{error:o.error}:{}})}))}catch(o){e.postEvent(ke.EDITOR_ASSET_PLACE_RESULT,{...r?{requestId:r}:{},ok:!1,assetId:a,error:fr(o)})}}function po(e,t,r){return e.createAssetFromAssetIdAsync?e.createAssetFromAssetIdAsync(t,r):Promise.resolve(e.createAssetFromAssetId(t,r))}function bn(e,t){return t.normalizePayload?.(e)??e}async function pd(e,t){if(t.registerAssetIfNeeded)return t.registerAssetIfNeeded(e);const r=vt(e.projectAssetId);if(!r)throw new Error("projectAssetId is required when registerAssetIfNeeded is not provided");return{assetId:r,external:Ke(e)}}async function hd(e,t){if(t.resolveAssetId)return t.resolveAssetId(e);const r=vt(e.projectAssetId);if(!r)throw new Error("projectAssetId is required to place an editor asset");return r}function ho(e,t,r){if(t.readPlacement)return t.readPlacement(e);const n=t.placement?.projectDropPoint;return Jc(e,{projectDropPoint:n?a=>n(a):a=>r.projectAssetDropPoint?.(a)??null})}function fr(e){return e instanceof Error?e.message:String(e)}function vt(e){return typeof e=="string"&&e.trim()?e.trim():void 0}class Ze extends Error{constructor(t){super(t),this.name="PlayableEditorEntryReloadRequiredError"}}function gd(e){const t=e.now??(()=>Date.now()),r=new AbortController,n=new Set;let a=ta({phase:"idle",attempt:0,phaseStartedAtMs:t(),phaseDurationsMs:{},failure:null}),o=null,s=null,i=null,d=!1;const l=p=>{try{e.reportListenerError?.(p)}catch{}},u=(p,S={})=>{const P=t(),I={...a.phaseDurationsMs,[a.phase]:Math.max(0,P-a.phaseStartedAtMs)};a=ta({phase:p,attempt:S.attempt??a.attempt,phaseStartedAtMs:P,phaseDurationsMs:I,failure:S.failure===void 0?null:S.failure});for(const D of[...n])try{D(a)}catch(z){l(z)}return a},c=(p,S,P)=>{try{e.reportFailure?.(Object.freeze({failure:p,cause:S,rollbackCause:P}))}catch(I){l(I)}},m=()=>{if(d||r.signal.aborted)throw Xr()},f=p=>{if(d||a.phase==="disposed")return Promise.reject(Xr());if(a.phase==="ready"||a.phase==="preparing"||a.phase==="committing"||a.phase==="editing"||a.phase==="failed"&&a.failure?.phase!=="warmup")return Promise.resolve();if(o)return o;const S=Promise.resolve().then(async()=>{try{u("warming",p===void 0?{}:{attempt:p}),m(),await e.backend.warmup?.(r.signal),m(),u("ready")}catch(P){if(d||r.signal.aborted)throw P;const I=yt("warmup-failed","warmup",P,!0);throw u("failed",{failure:I}),c(I,P),P}});return o=S,S.finally(()=>{o===S&&(o=null)}).catch(()=>{}),S},h=async()=>{if(d||a.phase==="disposed")return Qe(a.attempt);if(a.phase==="editing")return Object.freeze({ok:!0,attempt:a.attempt});if(a.phase==="failed"&&a.failure&&!a.failure.recoverable)return Object.freeze({ok:!1,attempt:a.attempt,failure:a.failure});const p=a.attempt+1;try{await f(p)}catch(P){if(d||r.signal.aborted)return Qe(p);const I=a.failure??yt("warmup-failed","warmup",P,!0);return Object.freeze({ok:!1,attempt:p,failure:I})}if(d)return Qe(p);u("preparing",{attempt:p});let S;try{S=await e.backend.prepare({signal:r.signal}),m()}catch(P){if(d||r.signal.aborted)return Qe(p);const I=yt("prepare-failed","prepare",P,!0);return u("failed",{attempt:p,failure:I}),c(I,P),Object.freeze({ok:!1,attempt:p,failure:I})}u("committing",{attempt:p});try{return await e.backend.commit(S,{signal:r.signal}),m(),u("editing",{attempt:p}),Object.freeze({ok:!0,attempt:p})}catch(P){u("rolling-back",{attempt:p});try{await e.backend.rollback(S,P)}catch(D){if(d&&ra(P)&&ra(D))return Qe(p);const z=or("commit-failed","commit",P),j=or("rollback-failed","rollback",D),J=sr({...j,recoverable:!1,primary:z,rollback:j});return d||u("failed",{attempt:p,failure:J}),c(J,P,D),Object.freeze({ok:!1,attempt:p,failure:J})}if(d||r.signal.aborted)return Qe(p);const I=yt("commit-failed","commit",P,!0);return u("failed",{attempt:p,failure:I}),c(I,P),Object.freeze({ok:!1,attempt:p,failure:I})}},g=()=>{if(s)return s;const p=h();return s=p,p.finally(()=>{s===p&&(s=null)}).catch(()=>{}),p};return Object.freeze({start:()=>f(),enter:g,retry(){const p=a.failure;return a.phase!=="failed"||!p||p.recoverable?g():Promise.resolve(Object.freeze({ok:!1,attempt:a.attempt,failure:p}))},reset(){if(d||a.phase==="disposed")throw new Error("Disposed editor entry controller cannot be reset.");if(o||s)throw new Error("Editor entry controller cannot be reset during an active operation.");if(a.phase==="failed"&&a.failure&&!a.failure.recoverable)throw new Error("Non-recoverable editor entry failure cannot be reset. Refresh the page.");(a.phase!=="idle"||a.attempt!==0||a.failure)&&u("idle",{attempt:0})},getState:()=>a,subscribe(p){if(d)return()=>{};n.add(p);try{p(a)}catch(S){l(S)}return()=>{n.delete(p)}},dispose(){if(i)return i;d=!0,r.abort();const p=(async()=>{const S=[s,o].filter((P,I,D)=>P!==null&&D.indexOf(P)===I);await Promise.allSettled(S);try{await e.backend.dispose()}finally{a.phase!=="disposed"&&u("disposed"),n.clear()}})();return i=p,p.catch(()=>{i===p&&(i=null)}),p}})}function yt(e,t,r,n){return bd(r)?sr({...or("reload-required","runtime",r),recoverable:!1}):sr({...or(e,t,r),recoverable:n})}function bd(e){return e instanceof Error&&e.name==="PlayableEditorEntryReloadRequiredError"}function or(e,t,r){return Object.freeze({code:e,phase:t,message:Sd(r)})}function sr(e){return Object.freeze({...e,primary:e.primary?Object.freeze({...e.primary}):void 0,rollback:e.rollback?Object.freeze({...e.rollback}):void 0})}function ta(e){return Object.freeze({...e,phaseDurationsMs:Object.freeze({...e.phaseDurationsMs}),failure:e.failure?sr(e.failure):null})}function Sd(e){return e instanceof Error&&e.message.trim()?e.message:typeof e=="string"&&e.trim()?e:"Unknown editor entry failure."}function ra(e){return e instanceof Error&&e.name==="AbortError"}function Xr(){const e=new Error("Editor entry was disposed.");return e.name="AbortError",e}function Qe(e){return Object.freeze({ok:!1,attempt:e,failure:yt("disposed","dispose",Xr(),!1)})}function ap(e){let t=null;const r=wd(),n=e.enrichDocument??r.enrichDocument,a=e.dehydrateDocument??r.dehydrateDocument,s=cd({normalizePayload:i=>i,registerAssetIfNeeded:i=>id(i,{commandName:e.registerCommandName??"npm run asset:register",cwd:".",findExistingAsset:e.findExistingAsset,writeFile:nr,runCommand:ar}),registerAsset:i=>uo(i,{commandName:e.registerCommandName??"npm run asset:register",cwd:".",findExistingAsset:e.findExistingAsset,writeFile:nr,runCommand:ar}),resolveAssetId:async i=>{const d=go(i.projectAssetId);if(d)return d;const l=await e.findExistingAsset(i);if(l)return l.assetId;throw new Error("project assetId was not found for platform asset")},placement:{projectDropPoint:e.projectDropPoint}});return{hydrateDocumentAssets:n,prepareProjectServiceDocument:a,summarize:i=>`editorScene assets=${i.assets?.length??0}, gameObjects=${i.scene?.gameObjects?.length??0}`,handleProjectAssetCommand:i=>s(i),async exportDocument(i,d,l,u=(m,f)=>{Ps(window,m,f)},c){return i.runExclusiveDocumentOperation(async()=>{zt(c);const m=i.getDocumentRevision();await na(i,"export"),zt(c),Mr(i,m,"export");const f=await i.reloadAssets();if(zt(c),!f.ok){const P=new Error(f.error??"asset_freshness_check_failed");throw Object.assign(P,{code:"asset_freshness_check_failed",details:f}),P}const h=i.getDocumentRevision();await na(i,"export"),Mr(i,h,"export");const g=await i.prepareProjectServiceDocumentExport?.(c)??null;if(c&&!g){const P=new Error("Forge Play document export requires the Project Editor Service persistence owner.");throw Object.assign(P,{code:"project_editor_service_unavailable"}),P}const p=g??await(async()=>{const P=i.getWorkingDocument();if(!P)throw new Error("editor_document_unavailable");return yd(P,e.sceneSource,t)})();if(zt(c),!g){const P=Sn(p.document);P!==null&&(t=P)}Mr(i,h,"export");const S=typeof p.sceneJsonText=="string"&&p.sceneJsonText.trim()?p.sceneJsonText:`${JSON.stringify(p.compiledArtifact?.data??p.document,null,2)}
|
|
3
|
-
`;return l.preparedRevision+=1,l.committedRevision=0,u(ke.DOCUMENT_EXPORTED,{requestId:xt(d),persistedByEditor:!0,sceneJsonText:S,localRevision:h,...typeof p.expectedVersion=="number"?{expectedVersion:p.expectedVersion}:{},...typeof p.version=="number"?{version:p.version,sceneVersion:p.version}:{},...typeof p.sceneUrl=="string"?{sceneUrl:p.sceneUrl}:{},...typeof p.updatedAt=="string"?{updatedAt:p.updatedAt}:{}}),{documentRevision:h,preparedAuthoringSource:{...g?{serviceTransactionId:g.transactionId,serviceDocumentRevision:g.documentRevision}:{document:p.document,...p.source?{source:p.source}:{}},...typeof p.version=="number"?{version:p.version}:{},...typeof p.updatedAt=="string"?{updatedAt:p.updatedAt}:{},...typeof p.sceneUrl=="string"?{sceneUrl:p.sceneUrl}:{}},...typeof p.expectedVersion=="number"?{expectedVersion:p.expectedVersion}:{},...typeof p.version=="number"?{version:p.version,sceneVersion:p.version}:{},...typeof p.sceneUrl=="string"?{sceneUrl:p.sceneUrl}:{},...typeof p.updatedAt=="string"?{updatedAt:p.updatedAt}:{}}})}}}async function yd(e,t,r){const n=Sn(e),a=r??n,o=Ed(e,a);return t.save(o,{mode:"local-commit-save",...a===null?{}:{expectedAuthoringSourceRevision:a}})}function zt(e){if(!e||!e.signal.aborted&&Date.now()<e.deadlineAt)return;const t=new Error("Document export lifecycle deadline elapsed before persistence completed.");throw Object.assign(t,{code:"document_export_timeout"}),t}function Sn(e){const t=it(it(it(e)?.meta)?.authoringSource);return typeof t?.revision=="number"&&Number.isFinite(t.revision)?t.revision:null}function Ed(e,t){const r=Sn(e);if(t===null||r===null||r===t)return e;const n=structuredClone(e),a=it(n),o=it(a?.meta),s=it(o?.authoringSource);return!a||!o||!s?e:(s.revision=t,n)}function wd(){return{enrichDocument:(e,t)=>As(e,t),dehydrateDocument:(e,t)=>Is(e,t)}}async function na(e,t){if(await e.validateOperationSettledForCurrentDocument(t))return;const r=new Error(`${t}_blocked_by_validation`);throw Object.assign(r,{code:"editor_validation_failed",details:{phase:t}}),r}function Mr(e,t,r){const n=e.getDocumentRevision();if(n===t)return;const a=new Error(`${r}_canceled_document_changed`);throw Object.assign(a,{code:"editor_validation_failed",details:{phase:r,expectedDocumentRevision:t,receivedDocumentRevision:n}}),a}function go(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function it(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function op(e){return{projectAssetId:go(e.projectAssetId),platformAssetId:pn(e)??void 0,kind:fn(e)==="texture"?"texture":"model",assetPath:mr(e)??void 0}}function sp(e,t){const r=t?.(e);if(r)return r;const n=Cs(e,{createDuplicatedMaterialAssetCopy:Ln,findMaterialAsset:re,isReadonlyMaterialAsset:Ts,normalizeMaterialAssetValue:Rs,validateMaterialAssetFieldValue:Ms,resolveMaterialAssetDeleteState:vs,collectMaterialAssetBindingIds:xs});return n||ks(e,{createSourceAssetFromActionInput:zs,createPrefabDefinitionFromAsset:(a,o)=>$s(o,{id:Bn(a,`${o.id}_prefab`),guid:Us()}),createPrefabDefinitionFromGameObject:(a,o)=>Fs(a,o,{id:Bn(a,`${o}-prefab`),metadata:{sourceGameObjectId:o}}),createDuplicatedPrefabDefinition:(a,o)=>Gs(a,o,{metadata:{sourcePrefabAssetId:o}}),hasPrefabForSourceAsset:Bs,findPrefabAsset:Ls,normalizePrimitiveShape:js,parseDuplicateMaterialAssetValue:Ns,isPrefabMaterialAssetIdOverridePath:Os,findMaterialAsset:re,createDuplicatedMaterialAssetCopy:Ln,normalizePrefabAssetFieldValue:_s,validatePrefabAssetFieldValue:Ds})}function ip(e){const t=[],r=Vs(),n=Hs(),a=qs(),o=Ys(),s=Ws(),i=Ks(),d=Js(),l=Xs(),u=e.materialShaderDefinitions??Zs;try{t.push(e.host.registerCommand({manifest:N(O.HIERARCHY_SCOPE_GET),handler:async(c,m)=>{const f=e.sceneAssembly.getHierarchyItems(G(m)),h={scopeKey:"scene",scopeType:"scene",revision:m.session.getState({cloneDocuments:!1}).documentRevision,title:"Scene",readonly:!1,nodes:f.map(p=>({id:p.id,label:p.label,parentId:p.parentId??null,selectable:!0,canHaveChildren:!0,renamable:!0,deletable:!0,draggable:!0})),selectedIds:m.session.getSelection().selectedIds,activeId:m.session.getSelection().activeId,capabilities:{},totalCount:f.length,returnedCount:f.length},g=await r(h,c);return g.ok?{ok:!0,output:g.output}:{ok:!1,diagnostics:[{severity:"error",source:"hierarchy",code:g.code,message:g.message}]}}})),t.push(e.host.registerCommand({manifest:N(O.SCENE_OBJECTS_LIST),handler:async(c,m)=>{const f=m.session.getState({cloneDocuments:!1}),h=f.workingDocument,g=En(h),p=await n(h.scene.gameObjects.map(S=>Et(S,h,g)),c,f.documentRevision);return p.ok?{ok:!0,output:{objects:p.items,totalCount:p.totalCount,returnedCount:p.returnedCount,...p.nextCursor?{nextCursor:p.nextCursor}:{}}}:je(p)}})),t.push(e.host.registerCommand({manifest:N(O.OBJECT_RESOLVE,{activeId:"objectId"}),handler:(c,m)=>Ld(G(m),c)})),t.push(e.host.registerCommand({manifest:N(O.OBJECT_PROPERTIES_GET),handler:(c,m)=>{const f=m.session.getState({cloneDocuments:!1}),h=Qs(f.workingDocument,c,f.documentRevision,e.sceneAssembly.getInspectorObject);return h.ok?h:je(h)}})),t.push(e.host.registerCommand({manifest:N(O.OBJECT_REFERENCES_LIST),handler:async(c,m)=>{const f=m.session.getState({cloneDocuments:!1}),h=await s(f.workingDocument,c,f.documentRevision);return h.ok?h:je(h)}})),t.push(e.host.registerCommand({manifest:N(O.ASSET_LIBRARY_LIST),handler:async(c,m)=>{const f=m.session.getState({cloneDocuments:!1}),h=[...await e.listAssets(f.workingDocument)].map(ei),g=await a(h,c,ti(f.documentRevision,h));return g.ok?{ok:!0,output:{assets:g.items,totalCount:g.totalCount,returnedCount:g.returnedCount,...g.nextCursor?{nextCursor:g.nextCursor}:{}}}:je(g)}})),t.push(e.host.registerCommand({manifest:N(O.ASSET_INFO_GET),handler:async(c,m)=>{const f=c.assetId.trim(),h=[...await e.listAssets(G(m))].find(g=>g.assetId===f||g.id===f);return h?{ok:!0,output:{asset:ri(h)}}:R("asset.notFound",`Asset was not found: ${f}`)}})),t.push(e.host.registerCommand({manifest:N(O.ASSET_REFERENCES_LIST),handler:async(c,m)=>{const f=m.session.getState({cloneDocuments:!1}),h=await o(f.workingDocument,c,f.documentRevision);return h.ok?h:je(h)}})),t.push(e.host.registerCommand({manifest:N(O.AUTHORING_VALIDATION_LIST),handler:async(c,m)=>{const f=m.session.getState({cloneDocuments:!1}),h=await i(f.workingDocument,c,f.documentRevision);return h.ok?h:je(h)}})),t.push(e.host.registerCommand({manifest:N(O.PREFAB_RESOLVE),handler:async(c,m)=>{const f=m.session.getState({cloneDocuments:!1}),h=f.workingDocument.assets.filter(p=>!!p.prefab).map(ni),g=await d(h,c,f.documentRevision);return g.ok?{ok:!0,output:{prefabs:g.items,resolvedPrefab:g.totalCount===1?g.items[0]??null:null,ambiguous:g.totalCount>1,currentStage:null,totalCount:g.totalCount,returnedCount:g.returnedCount,...g.nextCursor?{nextCursor:g.nextCursor}:{}}}:je(g)}})),t.push(e.host.registerCommand({manifest:N(O.PREFAB_SCENE_GET),handler:async(c,m)=>{const f=m.session.getState({cloneDocuments:!1}),h=await l(f.workingDocument,c,f.documentRevision,{dirty:f.dirty});return h.ok?h:je(h)}})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_ASSETS_LIST),handler:(c,m)=>({ok:!0,output:Pd(G(m),c)})})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_ASSET_GET),handler:(c,m)=>Cd(G(m),c.materialAssetId)})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_ASSET_CREATE),handler:(c,m)=>xd(m,e.sceneAssembly,c,u)})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_ASSET_RENAME),handler:(c,m)=>vd(m,e.sceneAssembly,c)})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_ASSET_SET_SHADER),handler:(c,m)=>Md(m,e.sceneAssembly,c,u)})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_SHADER_DEFINITIONS_LIST),handler:c=>({ok:!0,output:Id(u,c)})})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_SHADER_DEFINITION_GET),handler:c=>Ad(u,c.shaderId)})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_REFERENCES_LIST),handler:(c,m)=>Rd(G(m),c)})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_BINDINGS_LIST),handler:(c,m)=>({ok:!0,output:pr(Zr(G(m),c),c.cursor,c.limit)})})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_BINDING_SET),handler:(c,m)=>oa(m,e.sceneAssembly,c.targets,c.materialAssetId)})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_BINDING_CLEAR),handler:(c,m)=>oa(m,e.sceneAssembly,c.targets,null)})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_PROPERTIES_GET),handler:(c,m)=>Td(G(m),c.materialAssetId,c.includeSchema===!0,u)})),t.push(e.host.registerCommand({manifest:N(O.MATERIAL_PROPERTIES_PATCH),handler:(c,m)=>kd(m,e.sceneAssembly,c,u)})),t.push(e.host.registerCommand({manifest:N(O.OBJECT_CREATE_PRIMITIVE),handler:(c,m)=>ia(m,e.sceneAssembly.createCreatePrimitivePatch(G(m),c),f=>({createdId:f.createdId,object:Et(G(m).scene.gameObjects.find(h=>h.id===f.createdId),G(m)),selection:m.session.getSelection()}))})),t.push(e.host.registerCommand({manifest:N(O.OBJECT_DELETE,{selectedIds:"objectIds"}),handler:(c,m)=>ia(m,e.sceneAssembly.createDeleteSubtreePatch(G(m),{ids:c.objectIds??(c.objectId?[c.objectId]:[])}),f=>({deletedIds:f.deletedIds??f.changedIds??[],fallbackSelectionId:m.session.getSelection().activeId,selection:m.session.getSelection()}))})),t.push(e.host.registerCommand({manifest:N(O.OBJECT_PROPERTIES_PATCH_MANY),handler:(c,m)=>Gd(m,e.sceneAssembly,c)})),t.push(e.host.registerCommand({manifest:N(O.TRANSFORM_MOVE,{activeId:"objectId"}),handler:(c,m)=>{const f=Gt(G(m),c.objectId);if(!f)return R("object.notFound",`Scene object was not found: ${c.objectId}`);const h=c.position??(c.offset?{x:f.position.x+c.offset.x,y:f.position.y+c.offset.y,z:f.position.z+c.offset.z}:null);if(!h)return R("transform.invalidInput","Transform move requires position or offset.");const g=e.sceneAssembly.patchGameObjectField(G(m),c.objectId,"transform.position",h),p=Gt(g,c.objectId);return!p||JSON.stringify(p)===JSON.stringify(f)?R("transform.unchanged",`Transform did not change: ${c.objectId}`):(m.dispatch({type:"document.replace",document:g,label:`Move ${c.objectId}`,projectionImpact:{type:"incremental",syncTransformIds:[c.objectId]}}),{ok:!0,output:{objectId:c.objectId,before:f,after:p,selection:m.session.getSelection()}})}})),t.push(e.host.registerCommand({manifest:N(O.TRANSFORM_SET,{activeId:"objectId"}),handler:(c,m)=>{const f=G(m),h=Gt(f,c.objectId);if(!h)return R("object.notFound",`Scene object was not found: ${c.objectId}`);const g=["position","rotation","scale"].flatMap(P=>c[P]?[{path:`transform.${P}`,value:c[P]}]:[]),p=e.sceneAssembly.patchGameObjectPropertiesMany(f,[{objectId:c.objectId,changes:g}]),S=Gt(p,c.objectId);return!S||JSON.stringify(S)===JSON.stringify(h)?R("transform.unchanged",`Transform did not change: ${c.objectId}`):(m.dispatch({type:"document.replace",document:p,label:`Set transform on ${c.objectId}`,projectionImpact:{type:"incremental",syncTransformIds:[c.objectId]}}),{ok:!0,output:{objectId:c.objectId,before:h,after:S,selection:m.session.getSelection()}})}})),t.push(e.host.registerCommand({manifest:N(O.OBJECT_CREATE_FROM_ASSET),handler:async(c,m)=>{const f=G(m),h=[...await e.listAssets(f)].find(p=>p.assetId===c.assetId);if(!h)return R("asset.notFound",`Asset was not found: ${c.assetId}`);if(!ai(h))return R("asset.unplaceable",`Asset is not placeable: ${c.assetId}`);const g=e.sceneAssembly.addAssetLibraryItemToDocument(f,h,Nd(c));return m.dispatch({type:"document.replace",document:g.document,label:`Create ${g.gameObject.name??g.gameObject.id}`}),{ok:!0,output:{assetId:c.assetId,createdId:g.gameObject.id,object:Et(g.gameObject,g.document),selection:m.session.getSelection(),focused:!1,status:`Created ${g.gameObject.name??g.gameObject.id}`}}}}))}catch(c){for(const m of t.splice(0).reverse())m();throw c}return()=>{for(const c of t.splice(0).reverse())c()}}function Pd(e,t){const r=t.query?.trim().toLowerCase()??"",n=t.path?.trim().toLowerCase()??"",a=t.shaderId?.trim()??"",o=(e.scene.materialAssets??[]).map(s=>({id:s.id,name:s.name?.trim()||s.id,shaderId:s.shaderId,properties:structuredClone(s.properties),...s.origin?{origin:structuredClone(s.origin)}:{}})).filter(s=>!a||s.shaderId===a).filter(s=>!r||`${s.name}
|
|
4
|
-
${s.id}`.toLowerCase().includes(r)).filter(s=>!n||JSON.stringify(s.origin??{}).toLowerCase().includes(n)).sort((s,i)=>s.name.localeCompare(i.name)||s.id.localeCompare(i.id));return pr(o,t.cursor,t.limit)}function Id(e,t){const r=t.query?.trim().toLowerCase()??"",n=e.list().map(bo).filter(a=>t.builtin===void 0||a.builtin===t.builtin).filter(a=>!r||`${a.displayName}
|
|
5
|
-
${a.shaderId}
|
|
6
|
-
${a.runtimeKind}`.toLowerCase().includes(r)).sort((a,o)=>a.displayName.localeCompare(o.displayName)||a.shaderId.localeCompare(o.shaderId));return pr(n,t.cursor,t.limit)}function Ad(e,t){const r=t?.trim(),n=e.get(r);return n?{ok:!0,output:{definition:{...bo(n),propertiesSchema:structuredClone(n.propertiesSchema),defaultProperties:structuredClone(n.defaultProperties),inspector:structuredClone(n.inspector)}}}:R("material.shaderDefinitionNotFound",`Shader Definition was not found: ${r}`)}function bo(e){return{shaderId:e.shaderId,version:e.version,runtimeKind:e.runtimeKind,displayName:e.displayName,builtin:bi(e.shaderId)!==null,...e.sourceFile?{sourceFile:e.sourceFile}:{},sectionCount:e.inspector.sections.length,fieldCount:e.inspector.fields.length}}function Cd(e,t){const r=t?.trim(),n=re(e,r);return n?{ok:!0,output:{asset:{id:n.id,name:n.name?.trim()||n.id,shaderId:n.shaderId,properties:structuredClone(n.properties),...n.origin?{origin:structuredClone(n.origin)}:{}},referenceCount:Na(e).filter(a=>a.materialAssetId===r).length}}:R("material.assetNotFound",`Material asset was not found: ${r}`)}function xd(e,t,r,n){const a=r.shaderId?.trim(),o=n.get(a);if(!o)return R("material.shaderDefinitionNotFound",`Shader Definition was not found: ${a}`);const s=r.name?.trim();if(r.name!==void 0&&!s)return R("material.invalidName","Material name must not be empty.");const i=t.createMaterialAssetCreatePatch({document:e.session.getWorkingDocument(),definition:o,...s?{name:s}:{}});if(!i?.createdId)return R("material.assetMutationUnavailable","Material Asset creation is unavailable.");const d=e.session.getState({cloneDocuments:!1}).documentRevision;yn(e,i);const l=re(e.session.getWorkingDocument(),i.createdId);return{ok:!0,output:{asset:At(l),changed:e.session.getState({cloneDocuments:!1}).documentRevision!==d,revision:e.session.getState({cloneDocuments:!1}).documentRevision}}}function vd(e,t,r){const n=e.session.getWorkingDocument(),a=r.materialAssetId?.trim(),o=re(n,a);if(!o)return R("material.assetNotFound",`Material asset was not found: ${a}`);const s=r.name?.trim();if(!s)return R("material.invalidName","Material name must not be empty.");const i=(n.scene.materialAssets??[]).find(c=>c.id!==a&&c.name?.trim().toLocaleLowerCase()===s.toLocaleLowerCase());if(i)return R("material.nameConflict",`A Material Asset named "${s}" already exists.`,{materialAssetId:a,conflictingMaterialAssetId:i.id,name:s});if(o.name===s)return{ok:!0,output:{asset:At(o),changed:!1,revision:e.session.getState({cloneDocuments:!1}).documentRevision}};const d=t.createMaterialAssetRenamePatch({document:n,materialAssetId:a,name:s});if(!d)return R("material.assetReadonly",`Material asset is read-only: ${a}`);const l=e.session.getState({cloneDocuments:!1}).documentRevision;yn(e,d);const u=re(e.session.getWorkingDocument(),a);return{ok:!0,output:{asset:At(u),changed:e.session.getState({cloneDocuments:!1}).documentRevision!==l,revision:e.session.getState({cloneDocuments:!1}).documentRevision}}}function Md(e,t,r,n){const a=e.session.getWorkingDocument(),o=r.materialAssetId?.trim(),s=re(a,o);if(!s)return R("material.assetNotFound",`Material asset was not found: ${o}`);const i=r.shaderId?.trim(),d=n.get(i);if(!d)return R("material.shaderDefinitionNotFound",`Shader Definition was not found: ${i}`);if(s.shaderId===i)return{ok:!0,output:{asset:At(s),previousShaderId:s.shaderId,changed:!1,revision:e.session.getState({cloneDocuments:!1}).documentRevision,preservedPaths:[],resetPaths:[]}};const l=t.createMaterialAssetSetShaderPatch({document:a,materialAssetId:o,definition:d});if(!l)return R("material.assetReadonly",`Material asset is read-only: ${o}`);if((l.resetPaths?.length??0)>0&&r.allowReset!==!0)return R("material.shaderChangeRequiresConfirmation",`Changing to ${d.displayName} resets ${l.resetPaths.length} incompatible material properties.`,{materialAssetId:o,previousShaderId:s.shaderId,shaderId:i,preservedPaths:l.preservedPaths??[],resetPaths:l.resetPaths??[]});const u=e.session.getState({cloneDocuments:!1}).documentRevision;yn(e,l);const c=re(e.session.getWorkingDocument(),o);return{ok:!0,output:{asset:At(c),previousShaderId:s.shaderId,changed:e.session.getState({cloneDocuments:!1}).documentRevision!==u,revision:e.session.getState({cloneDocuments:!1}).documentRevision,preservedPaths:l.preservedPaths??[],resetPaths:l.resetPaths??[]}}}function yn(e,t){e.dispatch({type:"document.patch",patch:t.patch,label:t.label,...t.reprojectIds?.length?{projectionImpact:{type:"incremental",reprojectIds:t.reprojectIds}}:{},...t.presentationImpact?{presentationImpact:t.presentationImpact}:{}})}function At(e){return{id:e.id,name:e.name?.trim()||e.id,shaderId:e.shaderId,properties:structuredClone(e.properties),...e.origin?{origin:structuredClone(e.origin)}:{}}}function Rd(e,t){const r=t.materialAssetId?.trim();if(!re(e,r))return R("material.assetNotFound",`Material asset was not found: ${r}`);const n=Na(e).filter(a=>a.materialAssetId===r).filter(a=>!t.scope||a.scope===t.scope).map(a=>({scope:a.scope,kind:a.kind,materialAssetId:a.materialAssetId,...a.scope==="scene"?{objectId:a.gameObjectId}:{},...a.gameObjectName?{objectName:a.gameObjectName}:{},...a.prefabAssetId?{prefabAssetId:a.prefabAssetId}:{},...a.prefabNodeId?{nodeId:a.prefabNodeId}:{},...a.slotId?{slotId:a.slotId}:{},bindingPath:a.bindingPath,label:a.label})).sort((a,o)=>Re(a).localeCompare(Re(o)));return{ok:!0,output:{materialAssetId:r,...pr(n,t.cursor,t.limit)}}}function Zr(e,t){const r=t.scope==="prefab"?[]:e.scene.gameObjects.filter(a=>!t.objectId||a.id===t.objectId).flatMap(a=>{const o=ci(e,a),s=di(e,a.id)??a.overrides;return o.length===0?[ir({scope:"scene",objectId:a.id},a.overrides?.materialBinding,s?.materialBinding,s!==a.overrides?"prefab-root":"default","overrides.materialBinding.materialAssetId")]:o.map(i=>ir({scope:"scene",objectId:a.id,slotId:i.slotId},a.overrides?.materialSlotBindings?.[i.slotId],s?.materialSlotBindings?.[i.slotId],s!==a.overrides?"prefab-root":"default",`overrides.materialSlotBindings.${i.slotId}.materialAssetId`))}),n=t.scope==="scene"?[]:e.assets.filter(a=>a.type==="prefab"&&!!a.prefab).filter(a=>!t.prefabAssetId||a.id===t.prefabAssetId).flatMap(a=>{const o=t.nodeId?[]:aa(e,a,null,a.prefab.overrides,void 0),s=ui(a),i=(a.prefab?.nodes??[]).filter(d=>d.id!==s).filter(d=>!t.nodeId||d.id===t.nodeId).flatMap(d=>aa(e,a,d,d.overrides,a.prefab.overrides));return[...o,...i]});return[...r,...n].sort((a,o)=>Re(a.target).localeCompare(Re(o.target)))}function aa(e,t,r,n,a){const o=_d(e,t,r),s={scope:"prefab",prefabAssetId:t.id,...r?{nodeId:r.id}:{}};return o.length===0?[ir(s,n?.materialBinding,n?.materialBinding??a?.materialBinding,a?.materialBinding?"prefab-root":"default","overrides.materialBinding.materialAssetId")]:o.map(i=>ir({...s,slotId:i},n?.materialSlotBindings?.[i],n?.materialSlotBindings?.[i]??a?.materialSlotBindings?.[i],a?.materialSlotBindings?.[i]?"prefab-root":"default",`overrides.materialSlotBindings.${i}.materialAssetId`))}function ir(e,t,r,n,a){const o=sa(t?.materialAssetId);return{target:e,kind:e.slotId?"slot":"root",bindingPath:a,authoredMaterialAssetId:o,effectiveMaterialAssetId:sa(r?.materialAssetId)??Si,resolvedSource:o?"authored":n}}function oa(e,t,r,n){const a=G(e),o=n?.trim()||null;if(o&&!re(a,o))return R("material.assetNotFound",`Material asset was not found: ${o}`);const s=Dd(r);if(!s.ok)return s.failure;const i=new Map(Zr(a,{}).map(g=>[Re(g.target),g])),d=s.targets.map(g=>i.get(Re(g)));if(d.some(g=>!g))return R("material.invalidTarget","One or more material binding targets do not exist or require a logical slotId.");const l=d,c=s.targets[0].scope==="scene"?t.createSceneMaterialBindingPatch({document:a,materialAssetId:o,targets:d.map(g=>({objectId:g.target.objectId,path:g.bindingPath}))}):t.createPrefabMaterialBindingPatch({document:a,materialAssetId:o,targets:d.map(g=>({prefabAssetId:g.target.prefabAssetId,...g.target.nodeId?{nodeId:g.target.nodeId}:{},path:g.bindingPath}))});if(!c)return R("material.patchUnavailable","Material binding preflight rejected the atomic patch.");e.dispatch({type:"document.patch",patch:c.patch,label:c.label,...c.reprojectIds?.length?{projectionImpact:{type:"incremental",reprojectIds:c.reprojectIds}}:{},...c.presentationImpact?{presentationImpact:c.presentationImpact}:{}});const m=G(e),f=new Map(Zr(m,{}).map(g=>[Re(g.target),g])),h=s.targets.map(g=>f.get(Re(g)));return{ok:!0,output:{changed:h.some((g,p)=>JSON.stringify(g)!==JSON.stringify(l[p])),changedCount:h.filter((g,p)=>JSON.stringify(g)!==JSON.stringify(l[p])).length,revision:e.session.getState({cloneDocuments:!1}).documentRevision,bindings:h}}}function Td(e,t,r,n){const a=t?.trim(),o=re(e,a),s=o?mi(o.shaderId,n):null;return o?s?{ok:!0,output:{materialAssetId:a,shaderId:o.shaderId,properties:structuredClone(o.properties),defaults:structuredClone(s.defaultProperties),...r?{schema:structuredClone(s.propertiesSchema)}:{}}}:R("material.shaderUnsupported",`Unsupported material shader: ${o.shaderId}`):R("material.assetNotFound",`Material asset was not found: ${a}`)}function kd(e,t,r,n){const a=G(e),o=r.materialAssetId?.trim(),s=re(a,o);if(!s)return R("material.assetNotFound",`Material asset was not found: ${o}`);const i=new Set,d=[];for(const c of r.changes??[]){const m=Od(c.path),f=fi(s.shaderId,m,n),h=Object.prototype.hasOwnProperty.call(c,"value"),g=c.reset===!0;if(!m||i.has(m)||!f||f.kind==="object"||h===g)return R("material.invalidPropertyPatch",`Invalid material property change: ${c.path}`);const p=g?pi(s.shaderId,m,n):{found:!0,value:c.value};if(!p.found)return R("material.invalidPropertyPatch",`Material property cannot be reset: ${m}`);i.add(m),d.push({path:m,value:p.value})}const l=t.createMaterialPropertiesPatch({document:a,materialAssetId:o,changes:d});if(!l)return R("material.invalidPropertyPatch","Material property preflight rejected the atomic patch.");e.dispatch({type:"document.patch",patch:l.patch,label:l.label,...l.reprojectIds?.length?{projectionImpact:{type:"incremental",reprojectIds:l.reprojectIds}}:{}});const u=re(G(e),o);return{ok:!0,output:{materialAssetId:o,shaderId:u.shaderId,changed:JSON.stringify(s.properties)!==JSON.stringify(u.properties),changedPaths:JSON.stringify(s.properties)!==JSON.stringify(u.properties)?[...i]:[],revision:e.session.getState({cloneDocuments:!1}).documentRevision,properties:structuredClone(u.properties)}}}function Dd(e){if(!Array.isArray(e)||e.length===0)return{ok:!1,failure:R("material.invalidTarget","At least one material target is required.")};const t=new Set,r=[];for(const n of e){const a=n.scope,o=n.objectId?.trim(),s=n.prefabAssetId?.trim(),i=n.nodeId?.trim(),d=n.slotId?.trim();if(a==="scene"&&(!o||s||i)||a==="prefab"&&(!s||o)||a!=="scene"&&a!=="prefab")return{ok:!1,failure:R("material.invalidTarget","Material target identity is invalid.")};const l={scope:a,...o?{objectId:o}:{},...s?{prefabAssetId:s}:{},...i?{nodeId:i}:{},...d?{slotId:d}:{}},u=Re(l);if(t.has(u))return{ok:!1,failure:R("material.invalidTarget","Duplicate material target.")};t.add(u),r.push(l)}return new Set(r.map(n=>n.scope)).size!==1?{ok:!1,failure:R("material.invalidTarget","Scene and Prefab targets cannot be mixed.")}:r[0].scope==="prefab"&&new Set(r.map(n=>n.prefabAssetId)).size!==1?{ok:!1,failure:R("material.invalidTarget","One atomic command must target one Prefab asset.")}:{ok:!0,targets:r}}function _d(e,t,r){const n=r?.sourceAssetId??t.prefab?.sourceAssetId,a=e.assets.find(s=>s.id===n);return(Array.isArray(a?.metadata?.materialSlots)?a.metadata.materialSlots:[]).map(Ei).filter(s=>!!s?.slotId).map(s=>s.slotId)}function pr(e,t,r){const n=t?/^offset:(\d+)$/.exec(t.trim()):null,a=n?Number(n[1]):0,o=Number.isSafeInteger(r)?Math.max(1,Math.min(200,Number(r))):50,s=e.slice(a,a+o),i=a+s.length;return{items:s,total:e.length,...i<e.length?{nextCursor:`offset:${i}`}:{}}}function Re(e){return[e.scope??"",e.objectId??"",e.prefabAssetId??"",e.nodeId??"",e.slotId??""].join("\0")}function Od(e){const t=typeof e=="string"?e.trim():"";return t&&!t.startsWith("properties.")?`properties.${t}`:t}function sa(e){return typeof e=="string"&&e.trim()?e.trim():null}function Nd(e){if(!(!e.position&&!e.rotation&&!e.scale))return{position:e.position??{x:0,y:0,z:0},rotation:e.rotation??{x:0,y:0,z:0},scale:e.scale??{x:1,y:1,z:1}}}function ia(e,t,r){if(!t)return R("command.unavailable","The requested scene mutation is unavailable.");const n=jd(t);return e.dispatch({type:"document.patch",patch:t.patch,label:t.label,...n?{projectionImpact:n}:{}}),{ok:!0,output:r?r(t):{changedIds:t.changedIds??t.deletedIds??[],...t.createdId?{createdId:t.createdId}:{},...t.selectId?{selectId:t.selectId}:{}}}}function jd(e){const t=e.createdId?[e.createdId]:[],r=e.deletedIds??[];let n=[];if(e.reprojectIds?.length){const a=new Set([...t,...r]);n=e.reprojectIds.filter(o=>!a.has(o))}if(!(t.length===0&&r.length===0&&n.length===0))return{type:"incremental",...t.length?{createdNodeIds:t}:{},...r.length?{deletedNodeIds:r}:{},...n.length?{reprojectIds:n}:{}}}function Ld(e,t){const r=t.objectId??t.name??t.path??t.query??"",n=r.trim().toLocaleLowerCase(),a=e.scene.gameObjects.find(i=>i.id===r),o=a?[a]:e.scene.gameObjects.filter(i=>i.name?.trim().toLocaleLowerCase()===n||i.id.toLocaleLowerCase().includes(n)),s=En(e);return{ok:!0,output:{objects:o.map(i=>Et(i,e,s)),resolvedObject:o.length===1?Et(o[0],e,s):null,ambiguous:o.length>1}}}function Et(e,t,r=En(t)){const n=Bd(e);return{id:e.id,label:e.name??e.id,name:e.name??e.id,type:Oa(e),...n?{sourceAssetId:n}:{},path:zd(r,e),parentId:e.parentId??null,selectable:!0,locked:!1}}function Bd(e){return e.components.find(r=>r.type==="ModelRenderer"||r.type==="ImageRenderer")?.assetId||e.prefab?.sourceAssetId||e.prefab?.prefabId}function En(e){return new Map(e.scene.gameObjects.map(t=>[t.id,t]))}function zd(e,t){const r=[],n=new Set;let a=t;for(;a&&!n.has(a.id);)n.add(a.id),r.push(a.name??a.id),a=a.parentId?e.get(a.parentId):void 0;return r.reverse().join("/")}function Gd(e,t,r){const n=G(e),a=new Map(n.scene.gameObjects.map(f=>[f.id,f])),o=new Map,s=new Set,i=yi({hasMaterialAsset:(f,h)=>!!re(f,h),isMarkerGameObject:f=>!!f.marker});let d=0;for(const f of r.targets){const h=f.objectId.trim(),g=a.get(h);if(!g)return R("object.notFound",`Scene object was not found: ${h}`);const p=o.get(h)??[];for(const S of f.changes){const P=S.path.trim(),I=`${h}\0${P}`;if(s.has(I))return R("object.properties.duplicateField",`Object property is duplicated: ${h}.${P}`);s.add(I);const D=hi(P,S.value),z=gi({document:n,path:P,nodeKind:Oa(g),value:D,extraValidators:[i]});if(!z.ok)return R("object.properties.invalid",`${z.message??`Invalid object property: ${P}.`} Target: ${h}.`);p.push({path:P,value:D}),d+=1}o.set(h,p)}const l=[...o].map(([f,h])=>({objectId:f,changes:h})),u=t.patchGameObjectPropertiesMany(n,l),c=new Map(u.scene.gameObjects.map(f=>[f.id,f])),m=l.map(f=>f.objectId).filter(f=>c.get(f)!==a.get(f));if(u!==n){const f=[],h=[],g=[],p=[];for(const S of m){const P=o.get(S)??[],I=new Set(P.map(D=>Fd(D.path)));if(I.has("reproject")){p.push(S);continue}I.has("transform")&&f.push(S),I.has("metadata")&&h.push(S),I.has("appearance")&&g.push(S)}e.dispatch({type:"document.replace",document:u,label:`Patch ${d} properties on ${l.length} objects`,...m.length>0?{projectionImpact:{type:"incremental",...f.length>0?{syncTransformIds:f}:{},...h.length>0?{syncMetadataIds:h}:{},...g.length>0?{syncAppearanceIds:g}:{},...p.length>0?{reprojectIds:p}:{}}}:{}})}return{ok:!0,output:{requestedObjectCount:l.length,validatedPropertyCount:d,changedObjectCount:m.length,sampleChangedObjectIds:m.slice(0,20)}}}function Fd(e){return e==="transform.position"||e.startsWith("transform.position.")||e==="transform.rotation"||e.startsWith("transform.rotation.")||e==="transform.scale"||e.startsWith("transform.scale.")?"transform":e==="name"||e.startsWith("metadata.")?"metadata":e==="active"||e==="enabled"||e.startsWith("shadow.")||e.startsWith("rendering.")||e.startsWith("overrides.material")||e.startsWith("overrides.outline")||e.startsWith("material.")?"appearance":"reproject"}function G(e){return e.session.getState({cloneDocuments:!1}).workingDocument}function N(e,t){const r=oi[e],n=ii[e],a=si[e];if(!r)throw new Error(`Built-in Editor command metadata is missing: ${e}`);return{schemaVersion:li,id:e,version:1,title:r.title,...zn[e]?{description:zn[e]}:{},target:r.target,access:r.access,stability:r.stability,inputSchema:n.inputSchema,outputSchema:n.outputSchema,effects:{persistence:r.access==="write"?"authoring":"none",undoable:r.access==="write",idempotent:r.access==="read"},...r.target==="authoring"&&r.access==="write"?{transaction:{compatible:!0,sideEffects:"authoring",phase:"mutation"}}:{},presentation:{category:r.category,inputMode:$d(n.inputSchema)?"schema-form":"none",...a?.aliases?{aliases:a.aliases}:{},...a?.keywords?{keywords:a.keywords}:{},...a?.examples?{examples:a.examples}:{},...a?.shortcut?{shortcut:a.shortcut}:{},...a?.menu?{menu:a.menu}:{},...t?{selectionBinding:t}:{}}}}function Gt(e,t){const r=e.scene.gameObjects.find(a=>a.id===t),n=r?.components.find(a=>a.type==="Transform")??r?.transform;return!n||"mode"in n&&n.mode==="matrix"?null:{position:{...n.position},rotation:{...n.rotation},scale:{...n.scale??{x:1,y:1,z:1}}}}function $d(e){const t=e.properties;return!!t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length>0}function R(e,t,r){return{ok:!1,diagnostics:[{severity:"error",source:"command",code:e,message:t,...r?{details:r}:{}}]}}function je(e){return R(e.code,e.message)}function lp(e){return{...e,paths:{...e.paths},supportedExtensions:e.supportedExtensions?[...e.supportedExtensions]:void 0,commands:e.commands?{...e.commands}:void 0}}class Ye extends Error{constructor(t,r){super(r),this.code=t,this.name="PlayableEditorManagedAssetError"}}function Ud(){const e=globalThis.crypto;return Hc({...typeof e?.randomUUID=="function"?{randomUUID:()=>e.randomUUID()}:{},fillRandomBytes(t){if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r+=1)t[r]=Math.floor(Math.random()*256)}})}function cp(e){return oo(e)}function Vd(e,t){return qc(e,t)}function la(e){return mn(e).trim()}function So(e,t,r){const n=Wd(t.kind,t.assetPath??t.assetName),a=Pe(t.guid),o=Pe(t.assetId),s=yo(t),i=Kd(e,t);if(i&&a&&i.guid&&i.guid!==a)throw new Ye(r.errorCodes.assetIdConflict,`Requested guid "${a}" does not match existing asset guid "${i.guid}"`);const d=i?.guid??a??Ud(),l=Vd(n,d);if(i?.id&&i.id!==l)throw new Ye(r.errorCodes.assetIdConflict,`Asset id "${i.id}" does not match guid "${d}" (expected "${l}")`);if(o&&o!==l)throw new Ye(r.errorCodes.assetIdConflict,`Project asset id "${o}" does not match guid "${d}" (expected "${l}")`);const u=e.assets.find(c=>c.id===l&&c.guid&&c.guid!==d);if(u)throw new Ye(r.errorCodes.assetIdConflict,`Asset id "${l}" already points to guid "${u.guid}"`);return{guid:d,assetId:l,kind:n,...s?{external:s}:i?.external?{external:i.external}:{}}}function Hd(e){if(typeof e=="number"&&Number.isFinite(e)&&e>0)return e;if(!e||typeof e!="object")return;const t=e,r=Rr(t.x),n=Rr(t.y),a=Rr(t.z);if(!(r==null||n==null||a==null||r<=0||n<=0||a<=0))return{x:r,y:n,z:a}}function Qr(e,t,r){const n=So(e,t,r),a=t.displayName?.trim()||la(t.assetName)||la(t.assetPath?.split("/").pop())||"Imported Asset",o=t.category?.trim(),s=Jd(t.materialMode),i=Xd(t.warmupCount),d=Hd(t.defaultScale??t.scale),l=Zd(t.metadata);return{...n,displayName:a,...o?{category:o}:{},...s?{materialMode:s}:{},...i!=null?{warmupCount:i}:{},...typeof t.singleton=="boolean"?{singleton:t.singleton}:{},...d?{scale:d}:{},...l?{metadata:l}:{}}}function en(e,t){if(e.kind==="model")return{id:e.assetId,guid:e.guid,type:"glb",displayName:e.displayName,...e.category?{category:e.category}:{},...e.materialMode?{materialMode:e.materialMode}:{},...e.warmupCount!=null?{warmupCount:e.warmupCount}:{},...typeof e.singleton=="boolean"?{singleton:e.singleton}:{},...e.scale?{defaults:{transform:{scale:e.scale}}}:{},...e.external?{external:e.external}:{},metadata:{...e.metadata??{},[t.metadata.key]:t.metadata.value}}}function qd(e,t,r){const n=t.assetName||t.assetPath?.split("/").pop()||"imported_asset.glb",a=Qr(e,{...t,assetName:n},r),o=t.requestId,s=t.payloadPath??t.createPayloadPath?.({...o?{requestId:o}:{},guid:a.guid,assetId:a.assetId,kind:a.kind})??`/tmp/playable-editor-asset-${o??a.assetId}.json`,i=en(a,r),d=t.registerCommand??"npm run asset:register",l={...t.assetPath?{sourcePath:t.assetPath,assetPath:t.assetPath}:{},...t.assetUrl?{assetUrl:t.assetUrl}:{},guid:a.guid,projectAssetId:a.assetId,assetType:a.kind,assetName:n,displayName:a.displayName,...a.category?{category:a.category}:{},...a.materialMode?{materialMode:a.materialMode}:{},...a.warmupCount!=null?{warmupCount:a.warmupCount}:{},...typeof a.singleton=="boolean"?{singleton:a.singleton}:{},...a.scale?{scale:a.scale}:{},...a.metadata?{metadata:a.metadata}:{},...a.external?{external:a.external}:{},...a.external?.platformAssetId?{platformAssetId:a.external.platformAssetId}:{}},u=`${d} -- --payload ${s}`;return{...o?{requestId:o}:{},guid:a.guid,assetId:a.assetId,kind:a.kind,displayName:a.displayName,...a.external?{external:a.external}:{},transportPlan:{writes:[{path:s,contentType:"application/json",content:l}],commands:[{cmd:u,cwd:".",timeoutMs:6e4}]},...i?{sceneAsset:i}:{}}}function Yd(e,t){const r=Pe(e.assetId),n=Pe(e.guid);if(!r&&!n)throw new Ye(t.errorCodes.missingAssetId??"missing_asset_id","Missing assetId or guid for asset unregistration");const a=e.requestId,o=e.payloadPath??e.createPayloadPath?.({...a?{requestId:a}:{},...r?{assetId:r}:{},...n?{guid:n}:{}})??`/tmp/playable-editor-asset-unregister-${a??r??n}.json`,s=e.deleteFile!==!1,i=e.unregisterCommand??"npm run asset:unregister",d={...r?{assetId:r}:{},...n?{guid:n}:{},deleteFile:s},l=`${i} -- --payload ${o}`;return{...a?{requestId:a}:{},...n?{guid:n}:{},assetId:r??"",transportPlan:{writes:[{path:o,contentType:"application/json",content:d}],commands:[{cmd:l,cwd:".",timeoutMs:6e4}]}}}function Pe(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function Wd(e,t){return Yc(e,t)??"model"}function yo(e){const t=e.external&&typeof e.external=="object"?e.external:{},r=Pe(t.platformAssetId)??Pe(e.platformAssetId);let n;if(Object.prototype.hasOwnProperty.call(t,"assetPath")){try{n=so(t.assetPath)}catch{throw new Ye("external_asset_path_must_be_portable","Explicit external.assetPath must be a non-empty portable relative path")}if(!n)throw new Ye("external_asset_path_must_be_portable","Explicit external.assetPath must be a non-empty portable relative path")}const a=Pe(t.assetUrl)??Pe(e.assetUrl);if(!(!r&&!n&&!a))return{...r?{platformAssetId:r}:{},...n?{assetPath:n}:{},...a?{assetUrl:a}:{}}}function Kd(e,t){const r=Pe(t.guid),n=Pe(t.assetId),a=yo(t);return e.assets.find(o=>!!(r&&o.guid===r||n&&o.id===n||a?.platformAssetId&&o.external?.platformAssetId===a.platformAssetId||a?.assetPath&&o.external?.assetPath===a.assetPath))}function Rr(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Jd(e){return e==="shared"||e==="instance"?e:void 0}function Xd(e){return Number.isInteger(e)&&e>=0?e:void 0}function Zd(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return JSON.parse(JSON.stringify(e))}function Qd(e){return{resolveAssetIdentity:(t,r,n=e.rules)=>bt(e,()=>So(t,r,n)),buildAssetArgs:(t,r,n=e.rules)=>bt(e,()=>Qr(t,r,n)),createSceneAsset:(t,r=e.rules)=>en(t,r),planAssetRegistrationCore:(t,r,n=e.rules)=>bt(e,()=>qd(t,eu(r,e),n)),planAssetUnregistrationCore:(t,r=e.rules)=>bt(e,()=>Yd(tu(t,e),r)),resolveAssetReference:(t,r,n=e.rules)=>{const a=bt(e,()=>Qr(t,r,n)),o=en(a,n);if(!o)throw new Error(`Asset "${a.assetId}" is not a placeable model asset`);return{guid:a.guid,assetId:a.assetId,displayName:a.displayName,asset:o}}}}function eu(e,t){return{...e,kind:e.kind??e.assetType,createPayloadPath:e.createPayloadPath??(e.payloadPath?void 0:t.createRegistrationPayloadPath)}}function tu(e,t){return{...e,createPayloadPath:e.createPayloadPath??(e.payloadPath?void 0:t.createUnregistrationPayloadPath)}}function bt(e,t){try{return t()}catch(r){throw e.wrapError&&e.wrapError(r),r}}function dp(e){const t=Qd(e);return{facade:t,planAssetRegistration(r,n){return t.planAssetRegistrationCore(ca(n),r)},planAssetRegistrationWithAssets(r,n){return t.planAssetRegistrationCore({assets:r},n)},planAssetUnregistration(r){return t.planAssetUnregistrationCore(r)},resolveAssetReference(r,n){return t.resolveAssetReference(ca(n),r)}}}function ca(e){return{assets:e.getAssets()}}function Eo(e=null){let t=er(e,"$.initialStaticShadowArtifact"),r=t,n=Ft(t);return{get:()=>r,set:a=>(r=er(a,"$.staticShadowArtifact"),r),markSaved:(a=r)=>(t=er(a,"$.staticShadowArtifact"),r=t,n=Ft(t),r),reset:()=>(r=t,r),isDirty:()=>Ft(r)!==n,serialize:(a=r)=>Ft(a)}}function Ft(e){const t=er(e,"$.staticShadowArtifact");return t?JSON.stringify(t):""}function er(e,t){return e==null?null:Ii(e,t)}function wn(e,t={}){if(e==null)return{status:"missing",reason:"Static shadow artifact is missing.",...$t(null,0,0),sourceHash:t.sourceHash??null,lightHash:t.lightHash??null,profileHash:t.profileHash??null};const r=wi(e);if(!r)return{status:"invalid",reason:"Static shadow artifact is invalid.",...$t(null,0,0),sourceHash:t.sourceHash??null,lightHash:t.lightHash??null,profileHash:t.profileHash??null};const n=nu(r);if(n)return{status:"invalid",reason:`Static shadow artifact chunk hash mismatch: ${n}.`,...$t(null,0,0),sourceHash:r.sourceHash,lightHash:r.lightHash,profileHash:r.profileHash};const a=[t.sourceHash&&t.sourceHash!==r.sourceHash?"source":null,t.lightHash&&t.lightHash!==r.lightHash?"light":null,t.profileHash&&t.profileHash!==r.profileHash?"profile":null].filter(o=>!!o);return{status:a.length>0?"out-of-date":"up-to-date",reason:a.length>0?`Static shadow artifact hash mismatch: ${a.join(", ")}.`:null,...$t(r,r.chunks.length),sourceHash:r.sourceHash,lightHash:r.lightHash,profileHash:r.profileHash}}function $t(e,t,r){const n=e?.stats??null,a=e?.version===Pi,o=n?.pageCount??(a?e.pages.length:null),s=Math.max(0,Math.trunc(t)),i=r??n?.sourceRootCount??(e?ru(e).length:0);return{chunkCount:s,sourceRootCount:Math.max(0,Math.trunc(i)),sourceMeshCount:n?.sourceMeshCount??null,attemptedChunkCount:n?.attemptedChunkCount??null,textureCount:n?.textureCount??o??s,skippedChunkCount:n?.skippedChunkCount??null,pageCount:o,resolution:n?.resolution??null,chunkSize:n?.chunkSize??null,atlasSize:n?.atlasSize??null,atlasUsedPixels:n?.atlasUsedPixels??null,atlasAllocatedPixels:n?.atlasAllocatedPixels??null,atlasOccupancy:n?.atlasOccupancy??null,texelsPerMeter:n?.texelsPerMeter??null,effectiveTexelsPerMeter:n?.effectiveTexelsPerMeter??null,maxAtlasPages:n?.maxAtlasPages??null,sdfRadiusPx:n?.sdfRadiusPx??null,spatialChunkSize:n?.spatialChunkSize??null,effectiveSpatialChunkSize:n?.effectiveSpatialChunkSize??null,targetChunkCount:n?.targetChunkCount??null,bakedChunkCount:n?.bakedChunkCount??null,reusedChunkCount:n?.reusedChunkCount??null,durationMs:n?.durationMs??null,stats:n}}function ru(e){return[...new Set(e.chunks.flatMap(t=>t.sourceNodeIds))]}function nu(e){for(const t of e.chunks){const r=wo(t.id)??"(unknown)";if(au(t.sourceNodeIds)!==t.sourceHash)return`${r}: source`;if(t.lightHash!==e.lightHash)return`${r}: light`;if(t.profileHash!==e.profileHash)return`${r}: profile`}return null}function wo(e){return typeof e=="string"&&e.trim()?e.trim():null}function au(e){const t=Array.isArray(e)?[...new Set(e.map(wo).filter(r=>!!r))]:[];return ou(t)}function ou(e){const t=tn(e);let r=2166136261;for(let n=0;n<t.length;n+=1)r^=t.charCodeAt(n),r=Math.imul(r,16777619);return`fnv1a:${(r>>>0).toString(16).padStart(8,"0")}`}function tn(e){return e==null||typeof e!="object"?JSON.stringify(e):Array.isArray(e)?`[${e.map(tn).join(",")}]`:`{${Object.entries(e).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>`${JSON.stringify(r)}:${tn(n)}`).join(",")}}`}const su="/__fps_editor/editor-reload-state";function Po(e={}){let t=null,r=Promise.resolve();const n=a=>{const o=r.then(a,a);return r=o.then(()=>{},()=>{}),o};return{sourceType:"scene",async load(){const a=await n(()=>e.prepareLoad?.()),o=await La(e);return await n(()=>e.afterLoad?.({loaded:o,context:a})),{source:o.source,document:o.document,summary:o.summary,diagnostics:o.drift?.detected?[du(o.source,o.drift)]:[]}},validate({source:a,document:o}){return Ai(o,a)},async save({source:a,document:o}){const s=await n(()=>lu(e,{source:a,document:o})),i=cu(e,s.saveOptions);try{const d=await ja(o,i),l=d.compiledArtifact??null,u={source:a,document:o,saved:d,context:s.context};return await n(async()=>{Tr(e,u)&&(await da(e,{phase:"save",source:d.source,document:d.document,artifact:l}),Tr(e,u)&&(await e.afterSave?.(u),Tr(e,u)&&(t=l)))}),iu(d)}catch(d){throw await n(()=>e.onSaveError?.({source:a,document:o,error:d,context:s.context})),d}},async compile({source:a,document:o}){return n(async()=>{if(t&&Ci(t,a)){const i=t;return t=null,[i]}const s=xi(await e.compile?.({source:a,document:o}));for(const i of s)await da(e,{phase:"compile",source:a,document:o,artifact:i});return s})}}}function Tr(e,t){return e.isSaveCurrent?.(t)??!0}function iu(e){return{source:e.source,document:e.document,summary:e.summary}}Object.defineProperty(Po,"sceneMainSourceDriverLifecycleHooks",{value:!0});async function lu(e,t){const r=await e.prepareSave?.(t);return r?"saveOptions"in r||"context"in r?r:{saveOptions:r}:{}}function cu(e,t){return{endpointBase:e.endpointBase,fetchJson:e.fetchJson,...t}}async function da(e,t){!t.artifact||t.artifact.artifactType!=="runtime-scene"||await e.onRuntimeSceneArtifact?.({phase:t.phase,source:t.source,document:t.document,artifact:t.artifact})}function du(e,t){return{severity:"warning",message:`runtime input drift detected (${t.reason??"unknown"})`,source:e.ref,code:"runtime_input_drift"}}function up(e){let t=0;const r=(l,u)=>Di({source:l,data:e.compileRuntimeScene(u),artifactId:e.artifactId??"scene.json",fallbackCompilerId:e.compilerId,fallbackCompilerVersion:e.compilerVersion}),n=()=>{const l=e.renderingDraft?.isDirty()?xe(e.renderingDraft.get()):null,u=e.staticShadowDraft?.isDirty()??!1,c=u?xe(e.staticShadowDraft?.get()??null):null,m=e.shadowMapExperimentConfigSnapshot?.isDirty?.()?xe(e.shadowMapExperimentConfigSnapshot.get()):null,f={epoch:++t,rendering:l,staticShadowDirty:u,staticShadows:c,shadowMapExperimentConfig:m};return{saveOptions:l||u||m?{...m?{shadowMapExperimentConfig:m}:{},companionConfigs:{...l?{rendering:l}:{},...u?{staticShadows:c}:{}}}:void 0,context:f}},a=(l,u)=>{!u||u.epoch!==t||(u.rendering&&Ut(e.renderingDraft,u.rendering)&&e.renderingDraft?.setError?.(l),u.staticShadowDirty&&Ut(e.staticShadowDraft,u.staticShadows)&&e.staticShadowDraft?.setError?.(l),u.shadowMapExperimentConfig&&ua(e.shadowMapExperimentConfigSnapshot,u.shadowMapExperimentConfig)&&e.shadowMapExperimentConfigSnapshot?.setError?.(l))},o=(l,u)=>{if(!(!u||u.epoch!==t)){if(u?.rendering){if(Ut(e.renderingDraft,u.rendering)){const c=l.renderingConfig??u.rendering;e.renderingDraft?.markSaved(c),e.onRenderingConfig?.(xe(c))}e.renderingDraft?.clearError?.()}u?.staticShadowDirty&&(Ut(e.staticShadowDraft,u.staticShadows)&&e.staticShadowDraft?.markSaved(l.companionConfigs?.staticShadows??u.staticShadows),e.staticShadowDraft?.clearError?.()),u.shadowMapExperimentConfig&&(ua(e.shadowMapExperimentConfigSnapshot,u.shadowMapExperimentConfig)&&e.shadowMapExperimentConfigSnapshot?.markSaved?.(l.shadowMapExperimentConfig??u.shadowMapExperimentConfig),e.shadowMapExperimentConfigSnapshot?.clearError?.()),!u.shadowMapExperimentConfig&&!(e.shadowMapExperimentConfigSnapshot?.isDirty?.()??!1)&&Object.prototype.hasOwnProperty.call(l,"shadowMapExperimentConfig")&&e.shadowMapExperimentConfigSnapshot?.replace(l.shadowMapExperimentConfig??null)}},s=()=>++t,i=(l,u,c={})=>{if(u!==t)return!1;const m=c.preserveDirty===!0&&(e.renderingDraft?.isDirty()??!1),f=c.preserveDirty===!0&&(e.staticShadowDraft?.isDirty()??!1),h=c.preserveDirty===!0&&(e.shadowMapExperimentConfigSnapshot?.isDirty?.()??!1),g=Object.prototype.hasOwnProperty.call(l,"renderingConfig"),p=Object.prototype.hasOwnProperty.call(l.companionConfigs??{},"rendering");if((g||p)&&!m){const P=(g?l.renderingConfig:l.companionConfigs?.rendering)??{};e.renderingDraft?.markSaved(P),e.renderingDraft?.clearError?.(),e.onRenderingConfig?.(xe(P))}return f||(e.staticShadowDraft?.markSaved(l.companionConfigs?.staticShadows??null),e.staticShadowDraft?.clearError?.()),h||(e.shadowMapExperimentConfigSnapshot?.replace(l.shadowMapExperimentConfig??null),e.shadowMapExperimentConfigSnapshot?.clearError?.()),!0};return{createDriver:(l={})=>Po({...l,prepareLoad:s,afterLoad({loaded:u,context:c}){i(u,c)},prepareSave:n,isSaveCurrent({context:u}){const c=u;return!!c&&c.epoch===t},onSaveError({error:u,context:c}){a(u,c)},afterSave({saved:u,context:c}){o(u,c)},compile:({source:u,document:c})=>[r(u,c)],onRuntimeSceneArtifact({artifact:u}){e.isRuntimeScene(u.data)&&e.onRuntimeScene(u.data)}}),async load(l){const u=s(),c=await La(l?{fetchJson:l}:void 0),{assets:m,...f}=c,h=m?e.castAssets?e.castAssets(m):m:void 0;return i(c,u),{...f,...h?{assets:h}:{}}},async save(l,u){const c=n(),m=uu(u,c.saveOptions);try{const f=await ja(l,m);return o(f,c.context),f}catch(f){throw a(f,c.context),f}},prepareProjectServiceSave(){const l=n();return{...l.saveOptions?{body:xe(l.saveOptions)}:{},complete(u){o(kr(u),l.context)},fail(u){a(u,l.context)}}},prepareProjectServiceLoad(l={}){const u=t;return{complete(c){return i(kr(c),u,l)}}},completeProjectServiceLoad(l,u={}){const c=u.preserveDirty===!0?t:s();i(kr(l),c,u)},createRunGameContext(){const l={...e.renderingDraft?{rendering:xe(e.renderingDraft.get())}:{},...e.staticShadowDraft?{staticShadows:xe(e.staticShadowDraft.get())}:{}},u=e.shadowMapExperimentConfigSnapshot?.get()??null;return{...Object.keys(l).length>0?{companionConfigs:l}:{},...u?{shadowMapExperimentConfig:xe(u)}:{}}},async loadAssets(l){const u=await Ti(l?{fetchJson:l}:void 0);return e.castAssets?e.castAssets(u):u},loadProjectFiles(l){return Ri(l?{fetchJson:l}:void 0)},loadProjectFile(l,u){return Mi(l,u?{fetchJson:u}:void 0)},resolveProjectMedia(l){return vi(l)}}}function kr(e){const t=ki(e),n=Object.prototype.hasOwnProperty.call(t,"rendering")&&t.rendering!==null?t.rendering:void 0,a=Object.prototype.hasOwnProperty.call(e,"shadowMapExperimentConfig");let o;return a&&(e.shadowMapExperimentConfig==null?o=null:(rt(e.shadowMapExperimentConfig),o=structuredClone(e.shadowMapExperimentConfig))),{...Object.keys(t).length>0?{companionConfigs:t}:{},...n?{renderingConfig:n}:{},...a?{shadowMapExperimentConfig:o}:{}}}function Ut(e,t){return e?JSON.stringify(e.get())===JSON.stringify(t):!1}function ua(e,t){return e?JSON.stringify(e.get())===JSON.stringify(t):!1}function xe(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function uu(e,t){const r=e?.companionConfigs||t?.companionConfigs?{...e?.companionConfigs??{},...t?.companionConfigs??{}}:void 0;return{...e??{},...t??{},...r?{companionConfigs:r}:{}}}const mu="/__fps_runtime/debug-authoring";function mp(e={}){const t=e.endpoint?.trim()||mu,r=e.fetch??globalThis.fetch,n=Math.max(1,e.operationTimeoutMs??3e4);if(typeof r!="function")throw new Error("runtime_debug_authoring_fetch_unavailable");const a=async d=>{const l=await r(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(d)}),u=await l.json().catch(()=>null);if(!u)throw new Error(Dr(u,`runtime_debug_authoring_http_${l.status}`));if(!u.ok)throw new Error(Dr(u,`runtime_debug_authoring_http_${l.status}`));if(!l.ok)throw new Error(`runtime_debug_authoring_http_${l.status}`);return u},o=async d=>{const l=await a({kind:"command.invoke",invocation:d,timeoutMs:Math.min(n,1e4)});if(l.kind!=="operation"||!l.operation)throw new Error("runtime_debug_authoring_operation_missing");let u=l.operation;const c=Date.now()+n;for(;u.status==="accepted"||u.status==="running";){if(Date.now()>=c)throw new Error("runtime_debug_authoring_operation_timeout");await fu(25);const m=await a({kind:"operation.get",operationId:u.operationId});if(m.kind!=="operation"||!m.operation)throw new Error("runtime_debug_authoring_operation_missing");u=m.operation}if(u.status!=="completed")throw new Error(Dr({ok:!1,diagnostics:u.diagnostics??[]},`runtime_debug_authoring_operation_${u.status}`));return u};return Object.freeze({load:async()=>{const d=await a({kind:"authoring.snapshot"});if(d.kind!=="authoring.snapshot"||d.result.kind!=="snapshot-required")throw new Error("runtime_debug_authoring_snapshot_missing");const l=d.result.snapshot,u=fa("companion"),c=await o({commandId:"document.companionState.get",input:{},requestId:u,idempotencyKey:u,expectedRevision:{serviceInstanceId:l.serviceInstanceId,document:l.documentRevision},principal:{type:"human"},source:"runtime-debug-panel",surface:"runtime-debug-panel"});return{snapshot:l,companionState:ma(c)}},async commitAndSave(d){const l=fa("commit"),u=await o({commandId:"runtimeDebug.commitAndSave",intentCommandId:d.commandId,input:{commandId:d.commandId,inputFingerprint:d.inputFingerprint,document:d.document,...d.companionConfigs?{companionConfigs:d.companionConfigs}:{},...d.shadowMapExperimentConfig?{shadowMapExperimentConfig:d.shadowMapExperimentConfig}:{}},requestId:l,idempotencyKey:l,expectedRevision:{serviceInstanceId:d.serviceInstanceId,document:d.expectedDocumentRevision},principal:{type:"human"},source:"runtime-debug-panel",surface:"runtime-debug-panel"});return ma(u)}})}function ma(e){const t=e.output;if(!t||typeof t!="object"||Array.isArray(t))throw new Error("runtime_debug_authoring_output_invalid");return t}function Dr(e,t){return e&&!e.ok&&e.diagnostics.length>0?e.diagnostics.map(r=>`${r.code}: ${r.message}`).join("; "):t}function fa(e){const t=globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`;return`runtime-debug-${e}-${t}`}function fu(e){return new Promise(t=>setTimeout(t,e))}const pu=["/__fps_editor_authoring"],hu=[["manifest","/manifest"],["commit","/commit"],["editor-scene","/editor-scene"],["editor-asset-library","/editor-asset-library"],["project-files","/project-files"],["project-media","/project-media"],["project-file","/project-file"],["save-editor-scene","/save-editor-scene"],["file","/file"],["exec","/exec"]];function gu(e,t={}){const r=new URL(e??"","http://localhost").pathname,n=t.prefixes??pu,a=bu(r,n);if(!a)return null;const o=r.slice(a.length)||"/",s=Su(o);return s?{route:o,routeName:s,prefix:a}:null}function bu(e,t){return t.find(r=>e.startsWith(r))??null}function Su(e){return hu.find(([,t])=>e.startsWith(t))?.[0]??null}function yu(e){const r=e.match(/(?:^|\s)--payload(?:=|\s+)("[^"]+"|'[^']+'|\S+)/)?.[1]??"";return r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'")?r.slice(1,-1):r}async function fp(e,t){const r=gu(e.url);if(!r)return null;const n=(e.method??"GET").toUpperCase();if(n==="OPTIONS")return Za(204);try{if(Eu(r.routeName)){if(n!=="GET")return H(405,{ok:!1,error:"method_not_allowed"});if(r.routeName==="project-file"){const o=new URL(e.url??"","http://localhost").searchParams.get("path")?.trim()??"";if(!o)return H(400,{ok:!1,error:"missing_file_path"});const s=await t.loadProjectFile?.({path:o,route:r});return H(200,s??{ok:!1,error:"not_found"})}return H(200,await wu(r,t))}if(n!=="POST")return H(405,{ok:!1,error:"method_not_allowed"});const a=e.body??await t.readBody?.(e,r)??{};return await Pu(r,a,t)}catch(a){return H(500,{ok:!1,error:a instanceof Error?a.message:String(a),code:typeof a?.code=="string"?a.code:"authoring_request_failed",details:Ge(a?.details)})}}function Eu(e){return e==="manifest"||e==="editor-scene"||e==="editor-asset-library"||e==="project-files"||e==="project-file"||e==="project-media"}async function wu(e,t){return e.routeName==="manifest"&&t.loadManifest?t.loadManifest(e):e.routeName==="editor-scene"&&t.loadEditorScene?t.loadEditorScene(e):e.routeName==="editor-asset-library"&&t.loadEditorAssetLibrary?t.loadEditorAssetLibrary(e):e.routeName==="project-files"&&t.loadProjectFiles?t.loadProjectFiles(e):{ok:!1,error:"not_found"}}async function Pu(e,t,r){return e.routeName==="file"?Iu(e,t,r):e.routeName==="exec"?Au(e,t,r):e.routeName==="save-editor-scene"?Cu(e,t,r):e.routeName==="commit"?H(410,await xu(e,t,r)):H(404,{ok:!1,error:"not_found"})}async function Iu(e,t,r){const n=String(t.path??""),a=r.normalizeTransportPath?.(n)??n;if(!a)return H(400,{ok:!1,error:"missing_file_path"});const o=t.content,s=mc(o),i=await r.writeFile?.({body:t,path:a,rawPath:n,content:o,text:s,route:e});return H(200,i??{ok:!0,path:a})}async function Au(e,t,r){const n=String(t.cmd??""),a=yu(n);if(!a)return H(400,{ok:!1,error:"missing_payload_arg",cmd:n});const o=r.normalizeTransportPath?.(a)??a,s=await r.runCommand?.({body:t,cmd:n,payloadPath:o,rawPayloadPath:a,route:e});return H(200,s??{ok:!0,cmd:n})}async function Cu(e,t,r){const n=t.mode==="prepare-platform-save"?"prepare-platform-save":"local-commit-save",a=await r.saveEditorScene?.({body:t,mode:n,rawEditorScene:t.editorScene,route:e});return H(200,a??{ok:!1,error:"not_found"})}async function xu(e,t,r){return r.commit?.({body:t,route:e})??{ok:!1,error:"platform_commit_route_disabled",message:"Save through /__fps_editor_authoring/save-editor-scene so scene.main remains the authoring source of truth."}}const He=_i,pe=Oi,pp=Ni;function Mt(e){return L(e.requestId)}function Io(e){return{requestId:Mt(e),assetName:L(e.assetName),assetPath:L(e.assetPath),assetUrl:L(e.assetUrl),guid:L(e.guid),assetId:L(e.projectAssetId),kind:L(e.assetType)??L(e.kind),platformAssetId:L(e.platformAssetId)??L(e.assetId),displayName:L(e.displayName),category:L(e.category),materialMode:e.materialMode,scale:e.scale,defaultScale:e.defaultScale,metadata:Ge(e.metadata),payloadPath:L(e.payloadPath)}}function vu(e){return{requestId:Mt(e),guid:L(e.guid),assetId:L(e.projectAssetId)??L(e.assetId),payloadPath:L(e.payloadPath),deleteFile:typeof e.deleteFile=="boolean"?e.deleteFile:void 0}}function Mu(e){const t=L(e.assetName)??"",r=L(e.assetPath);return{...Io(e),kind:L(e.assetType)??L(e.kind)??"model",rawAssetName:t,inferredAssetPath:r,inferredAssetUrl:L(e.assetUrl)??(r?`/@fs${r}`:""),instanceScale:e.instanceScale,dropSurfaceName:L(e.dropSurfaceName),clientX:typeof e.clientX=="number"&&Number.isFinite(e.clientX)?e.clientX:void 0,clientY:typeof e.clientY=="number"&&Number.isFinite(e.clientY)?e.clientY:void 0,position:e.position}}function Ru(e){const t=ku(e);return{requestId:Mt(e),id:L(e.id),name:L(e.name),kind:e.kind,parentId:L(e.parentId),enabled:typeof e.enabled=="boolean"?e.enabled:void 0,transform:e.transform,instance:e.instance,primitive:e.primitive,transformType:e.transformType,...t?{customTransformData:t}:{},camera:e.camera,light:e.light}}function Tu(e){return{requestId:Mt(e),nodeId:L(e.nodeId)??"",patches:Array.isArray(e.patches)?e.patches:L(e.path)?[{path:e.path,value:e.value}]:[]}}function pa(e){return{requestId:Mt(e),nodeId:L(e.nodeId)}}function L(e){if(typeof e!="string")return;const t=e.trim();return t||void 0}function ku(e){const t=new Set(["requestId","id","name","kind","parentId","enabled","transform","instance","primitive","transformType","customTransformData","camera","light"]),r=Ge(e.customTransformData),n=r?{...r}:{};for(const[a,o]of Object.entries(e))t.has(a)||(n[a]=o);return Object.keys(n).length>0?n:void 0}function Du(e,t,r={}){const n=r.readProjectError?.(e);if(n)return n;const a=e,o=he(a?.code)??t,s=e instanceof Error?e.message:he(a?.message)??String(e),i=Ge(a?.details);return{code:o,error:s,...i?{details:i}:{}}}function _u(e,t={}){const r=new Set(t.omitKeys??["rootNode"]),n={...e};for(const a of r)delete n[a];return n}function Ou(e){return{async handleCommand(t,r,n){const a=n;if(t===He.ASSET_REGISTRATION_PLAN){const o=Io(r);return await Vt({eventName:pe.ASSET_REGISTRATION_PLANNED,failedEventName:pe.ASSET_REGISTRATION_FAILED,requestId:o.requestId,fallbackCode:e.errorCodes.assetRegistrationPlanFailed,emitEvent:e.emitEvent,createCommandError:e.handlers.createCommandError,run:()=>e.handlers.assetRegistrationPlan(o,a)}),!0}if(t===He.ASSET_UNREGISTRATION_PLAN){const o=vu(r);return await Vt({eventName:pe.ASSET_UNREGISTRATION_PLANNED,failedEventName:pe.ASSET_UNREGISTRATION_FAILED,requestId:o.requestId,fallbackCode:e.errorCodes.assetUnregistrationPlanFailed,emitEvent:e.emitEvent,createCommandError:e.handlers.createCommandError,run:()=>e.handlers.assetUnregistrationPlan(o,a)}),!0}if(t===He.ASSET_IMPORT){const o=Mu(r),s=await e.handlers.assetImport(o,a);return s&&e.emitEvent(pe.ASSET_IMPORT_RESULT,s),!0}if(t===He.ASSET_REMOVE){const o=pa(r),s=await e.handlers.assetRemove(o,a);return s&&e.emitEvent(pe.ASSET_REMOVE_RESULT,s),!0}if(t===He.SCENE_NODE_CREATE){const o=Ru(r);return await Vt({eventName:pe.SCENE_NODE_CREATE_RESULT,failedEventName:pe.SCENE_NODE_CREATE_RESULT,requestId:o.requestId,fallbackCode:e.errorCodes.sceneNodeCreateFailed,emitEvent:e.emitEvent,createCommandError:e.handlers.createCommandError,run:()=>e.handlers.sceneNodeCreate(o,a)}),!0}if(t===He.SCENE_NODE_PATCH){const o=Tu(r);return await Vt({eventName:pe.SCENE_NODE_PATCH_RESULT,failedEventName:pe.SCENE_NODE_PATCH_RESULT,requestId:o.requestId,fallbackCode:e.errorCodes.sceneNodePatchFailed,failureExtra:{nodeId:o.nodeId},emitEvent:e.emitEvent,createCommandError:e.handlers.createCommandError,run:()=>e.handlers.sceneNodePatch(o,a)}),!0}if(t===He.SCENE_NODE_REMOVE){const o=pa(r),s=await e.handlers.sceneNodeRemove(o,a);return s&&e.emitEvent(pe.SCENE_NODE_REMOVE_RESULT,s),!0}return!1}}}async function Vt(e){try{const t=await e.run();t&&e.emitEvent(e.eventName,t)}catch(t){e.emitEvent(e.failedEventName,{requestId:e.requestId,ok:!1,...e.failureExtra,...e.createCommandError(t,e.fallbackCode)})}}function hp(e){const t=e.notifyDocumentStatus??(()=>{}),r=e.createCommandError??((n,a)=>Du(n,a));return Ou({emitEvent:e.emitEvent,errorCodes:e.errorCodes,handlers:{createCommandError:r,assetRegistrationPlan:(n,a)=>e.planAssetRegistration(n,a),assetUnregistrationPlan:(n,a)=>e.planAssetUnregistration(n,a),assetImport:(n,a)=>Nu(n,a,e,t),assetRemove:(n,a)=>ju(n,a,e,t),sceneNodeCreate:async(n,a)=>{e.ensureDocumentLoaded();const o=await e.sceneNodeCreate(n,a);return o.rootNode&&e.selectRuntimeNode?.(o.rootNode),t(),{requestId:n.requestId,ok:!0,nodeId:o.node.id,node:o.node}},sceneNodePatch:async(n,a)=>{e.ensureDocumentLoaded();const o=await e.sceneNodePatch(n,a);return o.rootNode&&e.selectRuntimeNode?.(o.rootNode),t(),{requestId:n.requestId,ok:!0,nodeId:o.node.id,node:o.node}},sceneNodeRemove:async(n,a)=>{e.ensureDocumentLoaded();const o=await e.sceneNodeRemove(n,a);return o&&(e.selectRuntimeNode?.(null),t()),{requestId:n.requestId,ok:!!o,nodeId:n.nodeId,...o?{removedNodeId:o.node.id}:{code:e.errorCodes.nodeNotFound,error:e.errorCodes.nodeNotFound}}}}})}async function Nu(e,t,r,n){if(r.isBridgeActive?.())return null;r.ensureDocumentLoaded();const a=r.executeTransportPlan??(c=>mo(c)),o=Lu(e.inferredAssetUrl)||(e.inferredAssetPath?`/@fs${e.inferredAssetPath}`:""),s=await r.planAssetRegistration({...e,assetName:e.rawAssetName||void 0,assetPath:e.inferredAssetPath,assetUrl:o},t),i=s.transportPlan;if(e.inferredAssetPath&&!i)throw new Error("Asset registration transportPlan is required before placing an inferred project asset.");let d=null;e.inferredAssetPath&&(d=await a(i,t));const l=co({result:d,fallback:{guid:s.guid,assetId:s.assetId,assetUrl:o,external:s.external}}),u=await r.createAssetInstance({requestId:e.requestId,guid:l.guid,assetId:l.assetId,external:l.external,assetUrl:l.assetUrl,assetName:e.rawAssetName||void 0,displayName:e.displayName,category:e.category,materialMode:e.materialMode,scale:e.scale,defaultScale:e.defaultScale,instanceScale:e.instanceScale,metadata:e.metadata,dropSurfaceName:e.dropSurfaceName,clientX:e.clientX,clientY:e.clientY,position:e.position},t);return u.ok&&(u.rootNode&&r.selectRuntimeNode?.(u.rootNode),n()),_u(u)}async function ju(e,t,r,n){r.ensureDocumentLoaded();const a=e.nodeId?await r.removeAssetInstance(e,t):{ok:!1,assetId:"",code:r.errorCodes.missingNodeId,error:r.errorCodes.missingNodeId};return a.ok&&(r.selectRuntimeNode?.(null),n()),{requestId:e.requestId,...a}}function Lu(e){return typeof e=="string"&&e.trim()?e.trim():void 0}const qe="public-export",A="bundled-alias",_r="external-peer",Se="default",x="exclude",at="prebundle",Bu=[["@fps-games/editor","packages/editor/src/index.ts",null,qe,Se],["@fps-games/editor/vite","packages/editor/src/vite.ts",null,qe,Se],["@fps-games/babylon-renderer","packages/babylon-renderer/src/index.ts","@fps-games/babylon-renderer/dist/index.js",A,at],["@fps-games/babylon-renderer/config","packages/babylon-renderer/src/reference.ts","@fps-games/babylon-renderer/dist/reference.js",A,x],["@fps-games/babylon-renderer/renderer","packages/babylon-renderer/src/plugin.ts","@fps-games/babylon-renderer/dist/plugin.js",A,x],["@fps-games/editor-tooling","packages/editor-tooling/src/index.ts","@fps-games/editor-tooling/dist/index.js",A,x],["@fps-games/editor-tooling/node","packages/editor-tooling/src/package-metadata-node.ts","@fps-games/editor-tooling/dist/package-metadata-node.js",A,x],["@fps-games/editor-tooling/vite","packages/editor-tooling/src/vite.ts","@fps-games/editor-tooling/dist/vite.js",A,x],["@fps-games/plugin-sdk",null,null,_r,Se],["@fps-games/plugin-sdk/host",null,null,_r,Se],["@fps-games/plugin-sdk/runtime",null,null,_r,Se],["@fps-games/plugin-hierarchy","packages/plugin-hierarchy/src/reference.ts","@fps-games/plugin-hierarchy/dist/reference.js",A,at],["@fps-games/plugin-hierarchy/kernel","packages/plugin-hierarchy/src/kernel.ts","@fps-games/plugin-hierarchy/dist/kernel.js",A,x],["@fps-games/plugin-hierarchy/integration","packages/plugin-hierarchy/src/integration.ts","@fps-games/plugin-hierarchy/dist/integration.js",A,x],["@fps-games/plugin-hierarchy/editor","packages/plugin-hierarchy/src/editor.ts","@fps-games/plugin-hierarchy/dist/editor.js",A,at],["@fps-games/plugin-assets","packages/plugin-assets/src/reference.ts","@fps-games/plugin-assets/dist/reference.js",A,x],["@fps-games/plugin-assets/runtime","packages/plugin-assets/src/runtime.ts","@fps-games/plugin-assets/dist/runtime.js",A,x],["@fps-games/plugin-assets/resources","packages/plugin-assets/src/resources.ts","@fps-games/plugin-assets/dist/resources.js",A,x],["@fps-games/plugin-materials","packages/plugin-materials/src/reference.ts","@fps-games/plugin-materials/dist/reference.js",A,x],["@fps-games/plugin-materials/runtime","packages/plugin-materials/src/runtime.ts","@fps-games/plugin-materials/dist/runtime.js",A,x],["@fps-games/plugin-markers","packages/plugin-markers/src/reference.ts","@fps-games/plugin-markers/dist/reference.js",A,x],["@fps-games/plugin-markers/runtime","packages/plugin-markers/src/runtime.ts","@fps-games/plugin-markers/dist/runtime.js",A,x],["@fps-games/plugin-rendering","packages/plugin-rendering/src/reference.ts","@fps-games/plugin-rendering/dist/reference.js",A,x],["@fps-games/plugin-rendering/runtime","packages/plugin-rendering/src/runtime.ts","@fps-games/plugin-rendering/dist/runtime.js",A,x],["@fps-games/plugin-shadows","packages/plugin-shadows/src/reference.ts","@fps-games/plugin-shadows/dist/reference.js",A,x],["@fps-games/plugin-shadows/runtime","packages/plugin-shadows/src/runtime.ts","@fps-games/plugin-shadows/dist/runtime.js",A,x],["@fps-games/plugin-shadow-map-experiment","packages/plugin-shadow-map-experiment/src/reference.ts","@fps-games/plugin-shadow-map-experiment/dist/reference.js",A,x],["@fps-games/plugin-shadow-map-experiment/runtime","packages/plugin-shadow-map-experiment/src/runtime.ts","@fps-games/plugin-shadow-map-experiment/dist/runtime.js",A,x],["@fps-games/plugin-scene","packages/plugin-scene/src/reference.ts","@fps-games/plugin-scene/dist/reference.js",A,x],["@fps-games/plugin-scene/runtime","packages/plugin-scene/src/runtime.ts","@fps-games/plugin-scene/dist/runtime.js",A,x],["@fps-games/playable-assets","packages/playable-assets/src/index.ts","@fps-games/playable-assets/dist/index.js",A,x],["@fps-games/playable-contracts","packages/playable-contracts/src/index.ts","@fps-games/playable-contracts/dist/index.js",A,x],["@fps-games/playable-rendering","packages/playable-rendering/src/index.ts","@fps-games/playable-rendering/dist/index.js",A,x],["@fps-games/playable-rendering/runtime","packages/playable-rendering/src/runtime.ts","@fps-games/playable-rendering/dist/runtime.js",A,x],["@fps-games/playable-runtime","packages/playable-runtime/src/index.ts","@fps-games/playable-runtime/dist/index.js",A,x],["@fps-games/playable-runtime-data","packages/playable-runtime-data/src/index.ts","@fps-games/playable-runtime-data/dist/index.js",A,x],["@fps-games/playable-scene","packages/playable-scene/src/index.ts","@fps-games/playable-scene/dist/index.js",A,x],["@fps-games/editor/playable-runtime","packages/editor/src/playable-runtime.ts",null,qe,Se],["@fps-games/editor/playable-runtime/babylon","packages/editor/src/playable-runtime-babylon.ts",null,qe,Se],["@fps-games/editor/playable-sdk","packages/editor/src/playable-sdk.ts",null,qe,Se],["@fps-games/editor/playable-sdk/upgrade-doctor","packages/editor/src/playable-sdk-upgrade-doctor.ts",null,qe,Se],["@fps-games/editor/playable-sdk/vite","packages/editor/src/playable-sdk-vite.ts",null,qe,Se],["@fps-games/editor-playable-sdk","packages/editor-playable-sdk/src/index.ts","@fps-games/editor-playable-sdk/dist/index.js",A,x],["@fps-games/editor-playable-sdk/internal/authoring-queries","packages/editor-playable-sdk/src/internal/authoring-queries.ts","@fps-games/editor-playable-sdk/dist/internal/authoring-queries.js",A,x],["@fps-games/editor-playable-sdk/internal/local-harness","packages/editor-playable-sdk/src/internal/local-harness.ts","@fps-games/editor-playable-sdk/dist/internal/local-harness.js",A,x],["@fps-games/editor-playable-sdk/upgrade-doctor","packages/editor-playable-sdk/src/upgrade-doctor/index.ts","@fps-games/editor-playable-sdk/dist/upgrade-doctor/index.js",A,x],["@fps-games/editor-playable-sdk/vite","packages/editor-playable-sdk/src/vite/index.ts","@fps-games/editor-playable-sdk/dist/vite/index.js",A,x],["@fps-games/editor-babylon","packages/editor-babylon/src/index.ts","@fps-games/editor-babylon/dist/index.js",A,x],["@fps-games/editor-browser","packages/editor-browser/src/index.ts","@fps-games/editor-browser/dist/index.js",A,x],["@fps-games/editor-browser/plugin-contributions","packages/editor-browser/src/plugin-contributions.ts","@fps-games/editor-browser/dist/plugin-contributions.js",A,x],["@fps-games/editor-browser/runtime-debug","packages/editor-browser/src/runtime-debug.ts","@fps-games/editor-browser/dist/runtime-debug.js",A,x],["@fps-games/editor-core","packages/editor-core/src/index.ts","@fps-games/editor-core/dist/index.js",A,x],["@fps-games/editor-core/plugin-host","packages/editor-core/src/editor-plugin-host.ts","@fps-games/editor-core/dist/editor-plugin-host.js",A,x],["@fps-games/editor-core/lifecycle","packages/editor-core/src/lifecycle.ts","@fps-games/editor-core/dist/lifecycle.js",A,x],["@fps-games/editor-core/events","packages/editor-core/src/events.ts","@fps-games/editor-core/dist/events.js",A,x],["@fps-games/editor-core/document-adapter","packages/editor-core/src/document-adapter.ts","@fps-games/editor-core/dist/document-adapter.js",A,x],["@fps-games/editor-core/diagnostics","packages/editor-core/src/editor-diagnostic-store.ts","@fps-games/editor-core/dist/editor-diagnostic-store.js",A,x],["@fps-games/editor-core/tools","packages/editor-core/src/editor-tools.ts","@fps-games/editor-core/dist/editor-tools.js",A,x],["@fps-games/editor-forge-play","packages/editor-forge-play/src/index.ts","@fps-games/editor-forge-play/dist/index.js",A,x],["@fps-games/editor-protocol","packages/editor-protocol/src/index.ts","@fps-games/editor-protocol/dist/index.js",A,x],["@fps-games/editor-ui","packages/editor-ui/src/index.ts","@fps-games/editor-ui/dist/index.js",A,x],["@babel/parser",null,"@babel/parser/lib/index.js",A,at],["@playcanvas/observer",null,"@playcanvas/observer/dist/index.mjs",A,x],["@playcanvas/pcui",null,"@playcanvas/pcui/dist/module/src/index.mjs",A,x],["@playcanvas/pcui/styles",null,"@playcanvas/pcui/styles/dist/index.mjs",A,x],["semver",null,"semver/index.js",A,at]],Rt=Object.freeze(Bu.map(([e,t,r,n,a])=>Object.freeze({packageId:e,...t?{sourceFile:t}:{},...r?{bundledFile:r,bundledRoot:"editor-node-modules"}:{},resolution:n,optimizer:a,projectAllowlist:!0}))),gp=Object.freeze(Rt.filter(e=>e.projectAllowlist).map(e=>e.packageId)),bp=Object.freeze(Rt.filter(e=>e.resolution===A).map(e=>e.packageId)),Sp=Object.freeze(Rt.filter(e=>e.optimizer===at).map(e=>e.packageId));function zu(e,t={}){const r=t.resolvePath??Pn;return{entries:Rt.filter(n=>typeof n.sourceFile=="string").map(n=>({packageId:n.packageId,file:r(e,...n.sourceFile.split("/"))}))}}function yp(e,t={}){const r=zu(e,{resolvePath:t.resolvePath}),n=t.relativePath??Fu,a={};for(const o of r.entries){if(o.packageId==="semver")continue;const s=t.pathOverrides?.[o.packageId];a[o.packageId]=s?Gu(s):[t.projectRoot?mt(n(t.projectRoot,o.file)):mt(o.file)]}return{paths:a}}function Ep(e,t={}){const r=t.resolvePath??Pn,n=r(e,"node_modules","@fps-games","editor");return{editorPackageRoot:n,bundledEditorPackagesRoot:r(n,"node_modules","@fps-games"),bundledEditorNodeModulesRoot:r(n,"node_modules"),directBabylonRendererPackageRoot:r(e,"node_modules","@fps-games","babylon-renderer"),editorPackageJsonPath:r(n,"package.json")}}function wp(e){const t=e.resolvePath??Pn,r=e.bundledEditorNodeModulesRoot??ha(e.bundledEditorPackagesRoot),n=e.editorPackageRoot??ha(r);return{entries:Rt.filter(o=>o.resolution===A&&typeof o.bundledFile=="string").map(o=>({packageId:o.packageId,file:t(o.bundledRoot==="editor-package"?n:r,...o.bundledFile.split("/"))}))}}function Pp(e,t){return e.entries.filter(r=>!t(r.file)).map(r=>({packageId:r.packageId,file:r.file}))}function Ip(e,t="The @fps-games editor package aliases point to missing files."){return[t,...e.map(r=>`- ${r.packageId}: ${r.file}`)].join(`
|
|
7
|
-
`)}function Pn(...e){return e.filter(t=>t.length>0).join("/").replace(/\/+/g,"/")}function mt(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}function ha(e){const t=mt(e).replace(/\/$/,""),r=t.lastIndexOf("/");return r>0?t.slice(0,r):"."}function Gu(e){return(Array.isArray(e)?e:[e]).map(mt)}function Fu(e,t){const r=mt(e).replace(/\/$/,""),n=mt(t).replace(/\/$/,""),a=r.split("/").filter(Boolean),o=n.split("/").filter(Boolean);let s=0;for(;s<a.length&&s<o.length&&a[s]===o[s];)s+=1;const i=a.slice(s).map(()=>".."),d=o.slice(s);return[...i,...d].join("/")||"."}const $u=new Set(["leftToRight","rightToLeft","bottomToTop","topToBottom"]);function Ap(e){const t=ji(e),r={uiKind:e.uiKind,size:{width:e.size.width,depth:e.size.depth},layers:e.layers.map((n,a)=>Uu(n,a)),rendering:{textureWidth:t.width,textureHeight:t.height}};return e.aspectSourceLayerId&&(r.aspectSourceLayerId=e.aspectSourceLayerId),typeof e.lockAspectToBorder=="boolean"&&(r.lockAspectToBorder=e.lockAspectToBorder),e.mask&&(r.mask={...typeof e.mask.enabled=="boolean"?{enabled:e.mask.enabled}:{},...e.mask.source==="roundedRect"||e.mask.source==="borderAlpha"||e.mask.source==="texture"?{source:e.mask.source}:{},...e.mask.textureId?{textureId:e.mask.textureId}:{},...typeof e.mask.cornerRadius=="number"&&Number.isFinite(e.mask.cornerRadius)?{cornerRadius:e.mask.cornerRadius}:{},...typeof e.mask.padding=="number"&&Number.isFinite(e.mask.padding)?{padding:e.mask.padding}:{}}),e.rendering&&(r.rendering={...r.rendering,...typeof e.rendering.alphaIndex=="number"&&Number.isFinite(e.rendering.alphaIndex)?{alphaIndex:e.rendering.alphaIndex}:{},...typeof e.rendering.diffuseTextureLevel=="number"&&Number.isFinite(e.rendering.diffuseTextureLevel)?{diffuseTextureLevel:e.rendering.diffuseTextureLevel}:{},...typeof e.rendering.emissiveTextureLevel=="number"&&Number.isFinite(e.rendering.emissiveTextureLevel)?{emissiveTextureLevel:e.rendering.emissiveTextureLevel}:{}}),r}function Uu(e,t){const r=Li(e.rotationDeg??0)??0,n={id:e.id,role:e.role,zOrder:typeof e.zOrder=="number"&&Number.isFinite(e.zOrder)?e.zOrder:t,rect:Vu(e.rect),...r!==0?{rotationDeg:r}:{},...typeof e.enabled=="boolean"?{enabled:e.enabled}:{},...typeof e.opacity=="number"&&Number.isFinite(e.opacity)?{opacity:e.opacity}:{}};return e.kind==="texture"?{...n,kind:"texture",...e.textureId?{textureId:e.textureId}:{},...e.tint?{tint:et(e.tint)}:{},...e.imageFit?{imageFit:e.imageFit}:{}}:e.kind==="textureProgress"?{...n,kind:"textureProgress",...e.textureId?{textureId:e.textureId}:{},value:ba(e.value),...e.tint?{tint:et(e.tint)}:{},...e.imageFit?{imageFit:e.imageFit}:{},...ga(e.direction)?{direction:e.direction}:{}}:e.kind==="color"?{...n,kind:"color",color:et(e.color)}:e.kind==="progress"?{...n,kind:"progress",value:ba(e.value??0),color:et(e.color),...ga(e.direction)?{direction:e.direction}:{}}:{...n,kind:"text",text:{value:e.text.value,color:et(e.text.color),...e.text.fontFamily?{fontFamily:e.text.fontFamily}:{},...typeof e.text.fontSize=="number"&&Number.isFinite(e.text.fontSize)?{fontSize:e.text.fontSize}:{},...e.text.fontWeight!=null?{fontWeight:String(e.text.fontWeight)}:{},...e.text.strokeColor?{strokeColor:et(e.text.strokeColor)}:{},...typeof e.text.strokeWidth=="number"&&Number.isFinite(e.text.strokeWidth)?{strokeWidth:e.text.strokeWidth}:{},...e.text.align==="left"||e.text.align==="center"||e.text.align==="right"?{align:e.text.align}:{},...e.text.baseline==="top"||e.text.baseline==="middle"||e.text.baseline==="bottom"?{baseline:e.text.baseline}:{}}}}function Vu(e){return{x:e.x,z:e.z,width:e.width,depth:e.depth}}function et(e){return{r:e.r,g:e.g,b:e.b,...typeof e.a=="number"?{a:e.a}:{}}}function ga(e){return typeof e=="string"&&$u.has(e)}function ba(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):0}const Hu=Object.freeze({performance:Object.freeze({resolution:512,filter:"hard",bias:.001,normalBias:.02,darkness:.25}),balanced:Object.freeze({resolution:512,filter:"low-pcf",bias:.001,normalBias:.02,darkness:.25}),quality:Object.freeze({resolution:1024,filter:"low-pcf",bias:5e-4,normalBias:.015,darkness:.2})});function Cp(e){Yu(e.settings,"$.settings");const t=e.settings,r=Hu[t.quality],n=t.advanced?.resolution??r.resolution,a=`legacy-${t.quality}`,o={default:{cast:"disabled",receive:"enabled",updateClass:"auto"}},s=Object.create(null),i=new Map;for(const[l,u]of Object.entries(e.objects??{}).sort(([c],[m])=>c.localeCompare(m))){Ao(l,"$.objects key"),Wu(u,`$.objects.${l}`);const c=e.inheritedBehaviorByObject&&Object.prototype.hasOwnProperty.call(e.inheritedBehaviorByObject,l)?e.inheritedBehaviorByObject[l]:void 0,m=c===void 0?o.default:qu(c,`$.inheritedBehaviorByObject.${l}`),f={cast:u.cast&&u.cast!=="inherit"?u.cast:m.cast,receive:u.receive&&u.receive!=="inherit"?u.receive:m.receive,updateClass:u.updateClass&&u.updateClass!=="inherit"?u.updateClass:m.updateClass},h=JSON.stringify(f);let g=i.get(h);g||(g=`legacy-object-${i.size+1}`,i.set(h,g),o[g]=f),s[l]=Object.freeze({behaviorProfile:g})}const d=Ba({schemaVersion:Bi,enabled:t.enabled,lightRef:t.lightRef,defaultQualityProfile:a,defaultBehaviorProfile:"default",qualityProfiles:{[a]:{maps:{staticResolution:n,dynamicResolution:n,compositeResolution:n},receiverFilter:t.advanced?.filter??r.filter,bias:t.advanced?.bias??r.bias,normalBias:t.advanced?.normalBias??r.normalBias,darkness:t.advanced?.darkness??r.darkness,bounds:t.bounds,backend:{mode:"auto",fallback:"single-map"},culling:{enabled:!0,guardBandRatio:.25},diagnostics:{staticCasterCountWarning:128,dynamicCasterCountWarning:32,renderableCountWarning:512}}},behaviorProfiles:o});return Object.freeze({config:d,scene:Object.freeze({qualityProfile:a,behaviorProfile:"default"}),objects:Object.freeze(s)})}function qu(e,t){const r=Tt(e,t);return kt(r,["cast","receive","updateClass"],t),r.cast!=="enabled"&&r.cast!=="disabled"&&$(`${t}.cast`,"expected enabled or disabled"),r.receive!=="enabled"&&r.receive!=="disabled"&&$(`${t}.receive`,"expected enabled or disabled"),["auto","static","dynamic","skinned"].includes(String(r.updateClass))||$(`${t}.updateClass`,"expected auto, static, dynamic, or skinned"),r}function Yu(e,t){const r=Tt(e,t);kt(r,["schemaVersion","enabled","quality","lightRef","bounds","advanced"],t),r.schemaVersion!==1&&$(`${t}.schemaVersion`,"expected 1"),typeof r.enabled!="boolean"&&$(`${t}.enabled`,"expected boolean"),["performance","balanced","quality"].includes(String(r.quality))||$(`${t}.quality`,"unknown legacy quality"),Ao(r.lightRef,`${t}.lightRef`),Ku(r.bounds,`${t}.bounds`),r.advanced!==void 0&&Ju(r.advanced,`${t}.advanced`)}function Wu(e,t){const r=Tt(e,t);kt(r,["cast","receive","updateClass"],t),r.cast!==void 0&&!["inherit","enabled","disabled"].includes(String(r.cast))&&$(`${t}.cast`,"invalid legacy cast"),r.receive!==void 0&&!["inherit","enabled","disabled"].includes(String(r.receive))&&$(`${t}.receive`,"invalid legacy receive"),r.updateClass!==void 0&&!["inherit","static","dynamic","skinned"].includes(String(r.updateClass))&&$(`${t}.updateClass`,"invalid legacy updateClass")}function Ku(e,t){const r=Tt(e,t);kt(r,["mode","center","extent","near","far"],t),r.mode!=="fixed"&&$(`${t}.mode`,"expected fixed");const n=Sa(r.center,`${t}.center`),a=Sa(r.extent,`${t}.extent`);(n.length!==3||a.some(i=>i<=0))&&$(t,"invalid fixed bounds");const o=lr(r.near,`${t}.near`),s=lr(r.far,`${t}.far`);(o<0||s<=o)&&$(t,"expected 0 <= near < far")}function Ju(e,t){const r=Tt(e,t);kt(r,["resolution","filter","bias","normalBias","darkness"],t),r.resolution!==void 0&&r.resolution!==512&&r.resolution!==1024&&$(`${t}.resolution`,"expected 512 or 1024"),r.filter!==void 0&&r.filter!=="hard"&&r.filter!=="low-pcf"&&$(`${t}.filter`,"expected hard or low-pcf"),r.bias!==void 0&&Or(r.bias,`${t}.bias`,0,.1),r.normalBias!==void 0&&Or(r.normalBias,`${t}.normalBias`,0,1),r.darkness!==void 0&&Or(r.darkness,`${t}.darkness`,0,1)}function Sa(e,t){return(!Array.isArray(e)||e.length!==3)&&$(t,"expected three numbers"),e.map((r,n)=>lr(r,`${t}[${n}]`))}function Tt(e,t){(!e||typeof e!="object"||Array.isArray(e))&&$(t,"expected object");const r=Object.getPrototypeOf(e);return r!==Object.prototype&&r!==null&&$(t,"expected plain object"),e}function kt(e,t,r){const n=new Set(t);for(const a of Object.keys(e))n.has(a)||$(`${r}.${a}`,"unknown field")}function Ao(e,t){return(typeof e!="string"||!e.trim()||e!==e.trim())&&$(t,"expected trimmed non-empty string"),e}function lr(e,t){return(typeof e!="number"||!Number.isFinite(e))&&$(t,"expected finite number"),e}function Or(e,t,r,n){const a=lr(e,t);(a<r||a>n)&&$(t,`expected ${r}..${n}`)}function $(e,t){throw new Error(`shadow_map_experiment_legacy_invalid:${e}:${t}`)}const cr="|fps-editor-fresh-reload:v1|";function ya(e){const t=typeof e.name=="string"?e.name:"";t.includes(cr)||(e.name=t+cr)}function xp(e){const t=typeof e.name=="string"?e.name:"";return t.includes(cr)?(e.name=t.split(cr).join(""),!0):!1}function vp(e){const t=e.fetch??globalThis.fetch,r=e.reloadStatePath??su,n=e.startedAtMs??Xu()??Date.now();let a=!1,o=!1,s=null;const i=()=>{ya(e.window),Ea(e.window)},d=async()=>{if(!(a||o)){o=!0;try{const c=await t(r,{cache:"no-store"});if(!c.ok)return;const m=await c.json();if(m.schemaVersion!==1||typeof m.version!="number")return;if(s==null){s=m.version;const f=typeof m.updatedAt=="string"?Date.parse(m.updatedAt):Number.NaN;Number.isFinite(f)&&f>=n&&i();return}if(m.version===s)return;s=m.version,i()}catch{}finally{o=!1}}},l=c=>{ya(e.window),c?.reason!=="vite-restart"&&Ea(e.window)},u=setInterval(()=>void d(),e.pollIntervalMs??500);return e.hot?.on(e.editorEventName,l),d(),()=>{a||(a=!0,clearInterval(u),e.hot?.off(e.editorEventName,l))}}function Xu(){const e=globalThis.performance?.timeOrigin;return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Ea(e){try{const t=e.frameElement;if(t&&typeof t.srcdoc=="string"&&t.srcdoc.length>0)return t.srcdoc=t.srcdoc,"srcdoc"}catch{}return e.location.reload(),"location"}const Co=1,Zu="/__fps_editor/entry-manifest.json",Qu="no-cache",em="public, max-age=31536000, immutable";function tm(e){return am({schemaVersion:Co,build:{packageName:Ie(e.packageName,"packageName"),version:Ie(e.version,"version"),buildId:Ie(e.buildId,"buildId"),distHash:Ie(e.distHash,"distHash")},entry:{kind:"module",url:xo(e.entryUrl),cache:e.entryCache??"revalidate"},cacheControl:{manifest:Qu,immutableResource:em}})}function rm(e){if(!Nr(e))throw new Error("Editor entry manifest must be an object.");if(e.schemaVersion!==Co)throw new Error(`Unsupported Editor entry manifest schemaVersion: ${String(e.schemaVersion)}.`);if(!Nr(e.build))throw new Error("Editor entry manifest build must be an object.");if(!Nr(e.entry))throw new Error("Editor entry manifest entry must be an object.");if(e.entry.kind!=="module")throw new Error("Editor entry manifest entry.kind must be module.");if(e.entry.cache!=="revalidate"&&e.entry.cache!=="immutable")throw new Error("Editor entry manifest entry.cache must be revalidate or immutable.");return tm({packageName:Ie(e.build.packageName,"build.packageName"),version:Ie(e.build.version,"build.version"),buildId:Ie(e.build.buildId,"build.buildId"),distHash:Ie(e.build.distHash,"build.distHash"),entryUrl:xo(e.entry.url),entryCache:e.entry.cache})}function nm(e,t){const r=new URL(e.entry.url,Ie(t.baseUrl,"baseUrl"));r.searchParams.set("fps-editor-build",e.build.buildId);const n=t.retryAttempt??1;if(!Number.isInteger(n)||n<1)throw new Error("Editor entry retryAttempt must be a positive integer.");return n>1?r.searchParams.set("fps-editor-entry-retry",String(n)):r.searchParams.delete("fps-editor-entry-retry"),r.href}function am(e){return Object.freeze({...e,build:Object.freeze({...e.build}),entry:Object.freeze({...e.entry}),cacheControl:Object.freeze({...e.cacheControl})})}function xo(e){const t=Ie(e,"entry.url");let r;try{r=new URL(t,"https://fps-editor.invalid/")}catch{throw new Error(`Editor entry manifest entry.url is invalid: ${t}.`)}if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Error(`Editor entry manifest entry.url must use HTTP(S): ${t}.`);return t}function Ie(e,t){if(typeof e!="string"||!e.trim())throw new Error(`Editor entry manifest ${t} must be a non-empty string.`);return e.trim()}function Nr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function om(e){const t=new URL(e.manifestUrl??Zu,e.baseUrl).href,r=e.fetchManifest??im();let n=null,a,o=!1,s=0,i=null;return Object.freeze({load:l=>{if(o)return Promise.resolve(a);if(i)return i;const u=(async()=>{jr(l);const c=n??await sm({fetchManifest:r,manifestUrl:t,signal:l});jr(l),n=c;const m=s+1,f=nm(c,{baseUrl:e.baseUrl,retryAttempt:m});s=m;const h=await e.importModule(f);return jr(l),a=h,o=!0,h})();return i=u,u.finally(()=>{i===u&&(i=null)}).catch(()=>{}),u},getManifest:()=>n,getImportAttempt:()=>s})}async function sm(e){const t=await e.fetchManifest(e.manifestUrl,{cache:"no-cache",headers:Object.freeze({accept:"application/json"}),...e.signal?{signal:e.signal}:{}});if(!t.ok)throw new Error(`Editor entry manifest request failed with HTTP ${t.status}.`);return rm(await t.json())}function im(){const e=globalThis.fetch;if(typeof e!="function")throw new Error("Editor entry module loader requires fetchManifest outside a browser.");return e.bind(globalThis)}function jr(e){if(!e?.aborted)return;const t=new Error("Editor entry module load was aborted.");throw t.name="AbortError",t}function lm(e={}){const t=e.performance??mm(),r=e.maxResourceDetails??100,n=e.resourceTimingBufferSize??2e3;if(!Number.isInteger(r)||r<0)throw new Error("Editor entry maxResourceDetails must be a non-negative integer.");if(!Number.isInteger(n)||n<1)throw new Error("Editor entry resourceTimingBufferSize must be a positive integer.");return t.setResourceTimingBufferSize?.(n),Object.freeze({mark(){return Object.freeze({startedAtMs:t.now(),resourceIndex:t.getEntriesByType("resource").length})},measure(a){const o=t.getEntriesByType("resource").slice(a.resourceIndex).flatMap(um).filter(d=>e.includeResource?.(d)??!0).map(cm),s={network:0,revalidated:0,cache:0,unknown:0};for(const d of o)s[d.cacheStatus]+=1;const i=o.slice(0,r);return Object.freeze({durationMs:Math.max(0,t.now()-a.startedAtMs),resourceCount:o.length,transferSize:Lr(o,d=>d.transferSize),encodedBodySize:Lr(o,d=>d.encodedBodySize),decodedBodySize:Lr(o,d=>d.decodedBodySize),cacheCounts:Object.freeze(s),resources:Object.freeze(i),truncatedResourceCount:o.length-i.length})}})}function cm(e){const t=lt(e.transferSize),r=lt(e.encodedBodySize),n=lt(e.decodedBodySize);return Object.freeze({name:e.name,initiatorType:e.initiatorType??"",startTimeMs:e.startTime,durationMs:e.duration,transferSize:t,encodedBodySize:r,decodedBodySize:n,cacheStatus:dm({transferSize:t,encodedBodySize:r,decodedBodySize:n})})}function dm(e){return e.transferSize===0?e.encodedBodySize>0||e.decodedBodySize>0?"cache":"unknown":e.encodedBodySize>0&&e.transferSize<e.encodedBodySize?"revalidated":"network"}function um(e){if(!e||typeof e!="object"||Array.isArray(e))return[];const t=e;return typeof t.name!="string"||!t.name?[]:!Number.isFinite(t.startTime)||!Number.isFinite(t.duration)?[]:[{name:t.name,initiatorType:typeof t.initiatorType=="string"?t.initiatorType:"",startTime:t.startTime,duration:t.duration,transferSize:lt(t.transferSize),encodedBodySize:lt(t.encodedBodySize),decodedBodySize:lt(t.decodedBodySize)}]}function mm(){const e=globalThis.performance;if(!e||typeof e!="object")throw new Error("Editor entry performance tracker requires a performance adapter.");const t=e;if(typeof t.now!="function"||typeof t.getEntriesByType!="function")throw new Error("Editor entry performance tracker requires now() and getEntriesByType().");return t}function lt(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:0}function Lr(e,t){return e.reduce((r,n)=>r+t(n),0)}function dr(e){if(Ct(e)==="InstancedMesh"){for(const t of["outlineColor","outlineWidth"])if(Object.prototype.hasOwnProperty.call(e,t))try{Reflect.deleteProperty(e,t)}catch{}}}function vo(e){const t=e;if(!t)return{target:null,shared:!1};const r=Ct(t);if(r==="InstancedMesh")return dr(t),{target:t.sourceMesh??null,shared:!0};if(r==="Mesh"&&ur(t))return{target:t,shared:!1};const n=typeof t.getChildMeshes=="function"?t.getChildMeshes(!1):[];for(const a of n){const o=Ct(a);if(o==="InstancedMesh")return dr(a),{target:a.sourceMesh??null,shared:!0};if(o==="Mesh"&&ur(a))return{target:a,shared:!1}}return r==="Mesh"?{target:t,shared:!1}:{target:null,shared:!1}}function Mp(e){if(!e)return{ownerNode:null,shared:!1};const t=Ct(e);if(t==="InstancedMesh")return dr(e),{ownerNode:e,shared:!0};if(t==="Mesh"&&ur(e))return{ownerNode:e,shared:!1};const r=typeof e.getChildMeshes=="function"?e.getChildMeshes(!1):[];for(const n of r){const a=Ct(n);if(a==="InstancedMesh")return dr(n),{ownerNode:n,shared:!0};if(a==="Mesh"&&ur(n))return{ownerNode:n,shared:!1}}return t==="Mesh"?{ownerNode:e,shared:!1}:{ownerNode:null,shared:!1}}function Rp(e,t){if(!t)return{applied:!1,strategy:null,target:null,shared:!1};const r=vo(e);if(!r.target)return{applied:!1,strategy:rn(t),target:null,shared:r.shared};const n=fm(r.target,t);return{applied:n,strategy:n?rn(t):null,target:r.target,shared:r.shared}}function fm(e,t){if(!t||rn(t)!=="babylon-default")return!1;const r=pm(t);return Object.keys(r).length>0&&St(e,r)}function Ct(e){const t=e,r=t?.getClassName?.()??t?.constructor?.name;return typeof r=="string"?r:""}function ur(e){const t=e;if(typeof t?.getTotalVertices!="function")return!1;const r=t.getTotalVertices();return typeof r=="number"&&Number.isFinite(r)&&r>0}function rn(e){return typeof e?.strategy=="string"&&e.strategy.trim()?e.strategy:"babylon-default"}function pm(e){const t={};return typeof e.renderOutline=="boolean"&&(t.enabled=e.renderOutline),typeof e.outlineWidth=="number"&&Number.isFinite(e.outlineWidth)&&(t.width=e.outlineWidth),hm(e.outlineColor)&&(t.color=e.outlineColor),t}function hm(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.r=="number"&&typeof t.g=="number"&&typeof t.b=="number"&&Number.isFinite(t.r)&&Number.isFinite(t.g)&&Number.isFinite(t.b)}function Tp(e){const t=gm(e.input.position);if(t)return t;const r=wt(e.input.clientX),n=wt(e.input.clientY),a=e.scene??null;if(a&&r!=null&&n!=null){const o=bm(a,r,n),s=a.pick?.(o.x,o.y,l=>Sm(l,e.input));if(s?.hit&&s.pickedPoint)return{x:s.pickedPoint.x,y:s.pickedPoint.y,z:s.pickedPoint.z};const i=a.activeCamera??a.cameraToUseForPointers??null,d=i?a.createPickingRay?.(o.x,o.y,$a.Identity(),i):null;if(d&&Math.abs(d.direction.y)>1e-5){const l=-d.origin.y/d.direction.y,u=d.origin.add(d.direction.scale(l));return{x:u.x,y:0,z:u.z}}}return e.fallback??{x:0,y:0,z:0}}function gm(e){if(!e||typeof e!="object")return null;const t=e,r=wt(t.x),n=wt(t.y),a=wt(t.z);return r==null||n==null||a==null?null:{x:r,y:n,z:a}}function bm(e,t,r){const a=(e?.getEngine?.()?.getRenderingCanvas?.()??null)?.getBoundingClientRect?.();return a?{x:t-a.left,y:r-a.top}:{x:t,y:r}}function Sm(e,t){if(!e)return!1;const r=e.metadata??{};if(r.nonPlaceable===!0||r.editorOnly===!0)return!1;if(t.dropSurfaceName)return e.name===t.dropSurfaceName||e.id===t.dropSurfaceName;if(r.placeable===!0||r.dropSurface===!0)return!0;const n=String(e.name??e.id??"").toLowerCase();return n.includes("ground")||n.includes("floor")||n.includes("plane")||n.includes("diban")||n.includes("surface")}function wt(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function ym(e,t){if(!Mo(e))return nn;const r=Pm(t?.renderingGroupId),n=Im(t?.alphaIndex);if(r==null&&n==null)return nn;const a=e.renderingGroupId,o=e.alphaIndex;return r!=null&&(e.renderingGroupId=r),n!=null&&(e.alphaIndex=n),()=>{e.renderingGroupId=a,e.alphaIndex=o}}function Em(e,t){const r=[],n=new Set,a=o=>{if(!o||n.has(o))return;n.add(o),Mo(o)&&r.push(o);const s=wm(o)?o.getChildMeshes?.(!1):[];if(Array.isArray(s))for(const i of s)a(i)};return a(e),t&&t!==e&&a(t),r}function kp(e,t,r){const n=Em(e,r).map(a=>ym(a,t));return n.length===0?nn:()=>{for(const a of n.reverse())a()}}function wm(e){return!!e&&typeof e=="object"&&typeof e.getChildMeshes=="function"}function Mo(e){return!!e&&typeof e=="object"&&typeof e.getTotalVertices=="function"&&typeof e.renderingGroupId=="number"&&typeof e.alphaIndex=="number"}function Pm(e){return e===0||e===1||e===2||e===3?e:null}function Im(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function nn(){}const Am={opacity:.42,softness:.4,bias:.001,normalBias:.01,maxDistance:48,resolution:1024,cascadeCount:2,blurKernel:4};function Dp(e,t,r={}){return new Cm(e,t,r)}class Cm{scene;directionalLight;options;shadowGenerator=null;casters=new Set;receivers=new Map;receiverStates=new Map;renderObserver=null;initialized=!1;diagnostics;previousSceneShadowsEnabled=null;previousLightShadowEnabled=null;previousLightAutoUpdateExtends=null;previousLightFrustum=null;useCsmExplicit=!1;constructor(t,r,n){this.scene=t,this.directionalLight=r,this.useCsmExplicit=Pa(n),this.options=wa(n),this.diagnostics=this.createDiagnostics(null,[])}initialize(){this.initialized||!this.options.enabled||(this.previousSceneShadowsEnabled=this.scene.shadowsEnabled,this.previousLightShadowEnabled=this.directionalLight.shadowEnabled,this.previousLightAutoUpdateExtends=this.directionalLight.autoUpdateExtends,this.previousLightFrustum={left:this.directionalLight.orthoLeft,right:this.directionalLight.orthoRight,top:this.directionalLight.orthoTop,bottom:this.directionalLight.orthoBottom,minZ:this.directionalLight.shadowMinZ,maxZ:this.directionalLight.shadowMaxZ},this.scene.shadowsEnabled=!0,this.directionalLight.shadowEnabled=!0,this.directionalLight.autoUpdateExtends=!1,this.ensureShadowGenerator(),this.renderObserver=this.scene.onBeforeRenderObservable.add(()=>this.refresh()),this.initialized=!0,this.refresh())}addCaster(t){return ot(t)?!1:(this.casters.add(t),!this.options.enabled||!this.initialized||(this.shadowGenerator?.addShadowCaster(t,!0),this.refresh()),!0)}removeCaster(t){this.casters.delete(t),this.shadowGenerator?.removeShadowCaster(t,!0),this.refresh()}addReceiver(t){ot(t)||(this.receivers.has(t)||this.receivers.set(t,vm(t,this.receiverStates)),!(!this.options.enabled||!this.initialized)&&(Ia(this.receivers.get(t)),this.refresh()))}removeReceiver(t){const r=this.receivers.get(t);r&&Br(r,this.receiverStates),this.receivers.delete(t),this.refresh()}setCamera(t){this.options={...this.options,camera:t},this.shadowGenerator&&(this.shadowGenerator.camera=t),this.refresh()}setOptions(t){const r=this.options;if(Pa(t)&&(this.useCsmExplicit=!0),this.options=wa(t,this.options,this.useCsmExplicit),r.enabled&&!this.options.enabled){this.dispose();return}(r.params.resolution!==this.options.params.resolution||r.params.cascadeCount!==this.options.params.cascadeCount||r.useCsm!==this.options.useCsm)&&this.initialized?this.recreateShadowGenerator():this.shadowGenerator&&(this.shadowGenerator.camera=this.options.camera??null),!r.enabled&&this.options.enabled?this.initialize():this.refresh()}refresh(){if(!this.options.enabled||!this.initialized)return;if(this.pruneDisposedEntries(),!this.ensureShadowGenerator()){this.diagnostics=this.createDiagnostics(null,["shadow generator unavailable"]);return}this.applyGeneratorParams(this.options.params),this.syncShadowMapRenderList();for(const n of this.receivers.values())Ia(n);const r=this.fitDirectionalLightBounds();this.diagnostics=this.createDiagnostics(r,[])}getShadowGenerator(){return this.shadowGenerator}getDiagnostics(){return Nm(this.diagnostics)}dispose(){this.renderObserver&&(this.scene.onBeforeRenderObservable.remove(this.renderObserver),this.renderObserver=null);for(const t of this.receivers.values())Br(t,this.receiverStates);this.receiverStates.clear(),this.receivers.clear(),this.casters.clear(),this.shadowGenerator?.dispose(),this.shadowGenerator=null,this.previousSceneShadowsEnabled!==null&&(this.scene.shadowsEnabled=this.previousSceneShadowsEnabled,this.previousSceneShadowsEnabled=null),this.previousLightShadowEnabled!==null&&(this.directionalLight.shadowEnabled=this.previousLightShadowEnabled,this.previousLightShadowEnabled=null),this.previousLightAutoUpdateExtends!==null&&(this.directionalLight.autoUpdateExtends=this.previousLightAutoUpdateExtends,this.previousLightAutoUpdateExtends=null),this.previousLightFrustum&&(this.directionalLight.orthoLeft=this.previousLightFrustum.left,this.directionalLight.orthoRight=this.previousLightFrustum.right,this.directionalLight.orthoTop=this.previousLightFrustum.top,this.directionalLight.orthoBottom=this.previousLightFrustum.bottom,this.directionalLight.shadowMinZ=this.previousLightFrustum.minZ,this.directionalLight.shadowMaxZ=this.previousLightFrustum.maxZ,this.previousLightFrustum=null),this.initialized=!1,this.diagnostics=this.createDiagnostics(null,[])}ensureShadowGenerator(){if(this.shadowGenerator)return this.shadowGenerator;const t=this.options.params;if(this.options.useCsm&&t.cascadeCount>1&&Lt.IsSupported){const r=new Lt(t.resolution,this.directionalLight,void 0,this.options.camera??void 0);r.numCascades=t.cascadeCount,r.stabilizeCascades=!0,this.shadowGenerator=r}else this.shadowGenerator=new Fn(t.resolution,this.directionalLight,void 0,this.options.camera??void 0);return this.applyGeneratorParams(t),this.shadowGenerator}recreateShadowGenerator(){const t=[...this.casters];this.shadowGenerator?.dispose(),this.shadowGenerator=null;const r=this.ensureShadowGenerator();for(const n of t)r?.addShadowCaster(n,!0)}applyGeneratorParams(t){const r=this.shadowGenerator;r&&(r.useBlurExponentialShadowMap=!1,r.useKernelBlur=!1,r.usePercentageCloserFiltering=!0,r.filteringQuality=Fn.QUALITY_HIGH,r.setDarkness(an(1-t.opacity)),r.bias=t.bias,r.normalBias=t.normalBias,r instanceof Lt&&(r.numCascades=t.cascadeCount,r.shadowMaxZ=t.maxDistance))}syncShadowMapRenderList(){const t=this.shadowGenerator?.getShadowMap?.()?.renderList;if(t){t.length=0;for(const r of this.casters)ot(r)||this.shadowGenerator?.addShadowCaster(r,!0)}}fitDirectionalLightBounds(){const t=this.options.params,r=this.collectCoveragePoints(t);if(r.length===0)return null;const n=Aa(r),a=km(this.directionalLight),o=r.map(p=>F.TransformCoordinates(p,a)),s=Aa(o),i=ct(this.options.boundsPadding,Math.max(.5,t.maxDistance*.025)),d=s.min.x-i,l=s.max.x+i,u=s.min.y-i,c=s.max.y+i,m=Math.max(1e-4,l-d),f=Math.max(1e-4,c-u),h=Math.max(m,f)/t.resolution,g=this.options.stableSnapping===!1||h<=0?{left:d,right:l,bottom:u,top:c,minZ:s.min.z-i,maxZ:s.max.z+i}:{left:Math.floor(d/h)*h,right:Math.ceil(l/h)*h,bottom:Math.floor(u/h)*h,top:Math.ceil(c/h)*h,minZ:Math.floor((s.min.z-i)/h)*h,maxZ:Math.ceil((s.max.z+i)/h)*h};return this.directionalLight.orthoLeft=g.left,this.directionalLight.orthoRight=g.right,this.directionalLight.orthoBottom=g.bottom,this.directionalLight.orthoTop=g.top,this.directionalLight.shadowMinZ=g.minZ,this.directionalLight.shadowMaxZ=Math.max(this.directionalLight.shadowMinZ+1,g.maxZ),{world:{min:Ca(n.min),max:Ca(n.max)},lightOrtho:{left:g.left,right:g.right,bottom:g.bottom,top:g.top,minZ:this.directionalLight.shadowMinZ,maxZ:this.directionalLight.shadowMaxZ},texelSize:h,cameraProjection:_m(this.options.camera)}}collectCoveragePoints(t){const r=[],a=Ro(this.directionalLight.getShadowDirection(0)).scale(t.maxDistance);for(const o of this.casters){r.push(...zr(o));for(const s of zr(o))r.push(s.add(a))}for(const o of this.receivers.keys())r.push(...zr(o));return r.push(...Tm(this.options.camera,this.scene,t.maxDistance)),r.filter(o=>Number.isFinite(o.x)&&Number.isFinite(o.y)&&Number.isFinite(o.z))}pruneDisposedEntries(){for(const t of[...this.casters])ot(t)&&this.casters.delete(t);for(const[t,r]of[...this.receivers])ot(t)&&(Br(r,this.receiverStates),this.receivers.delete(t))}createDiagnostics(t,r){const n=this.shadowGenerator,a=n?.getShadowMap?.()?.renderList??[];return{enabled:this.options.enabled,casterCount:this.casters.size,receiverCount:this.receivers.size,generator:n?{className:n.getClassName?.()??null,mapSize:n.getShadowMap?.()?.getSize?.()??null,darkness:n.getDarkness?.()??null,bias:n.bias??null,normalBias:n.normalBias??null,blurKernel:n.blurKernel??null,renderListCount:a.length,useCsm:n instanceof Lt}:null,params:{...this.options.params},bounds:t,fallbackReasons:r}}}function wa(e,t,r=!1){const n=xm(e.params,t?.params);return{enabled:e.enabled??t?.enabled??!0,camera:e.camera??t?.camera??null,params:n,useCsm:e.useCsm??(r?t?.useCsm:void 0)??n.cascadeCount>1,boundsPadding:ct(e.boundsPadding,t?.boundsPadding??Math.max(.5,n.maxDistance*.025)),stableSnapping:e.stableSnapping??t?.stableSnapping??!0,debug:e.debug??t?.debug??!1}}function Pa(e){return Object.prototype.hasOwnProperty.call(e,"useCsm")&&typeof e.useCsm=="boolean"}function xm(e,t=Am){return{opacity:an(we(e?.opacity,t.opacity)),softness:an(we(e?.softness,t.softness)),bias:we(e?.bias,t.bias),normalBias:we(e?.normalBias,t.normalBias),maxDistance:ct(e?.maxDistance,t.maxDistance),resolution:jm(e?.resolution,t.resolution),cascadeCount:Lm(e?.cascadeCount,t.cascadeCount),blurKernel:Math.max(0,Math.round(we(e?.blurKernel,t.blurKernel)))}}function vm(e,t){const r=[e],n=e.sourceMesh;n&&n!==e&&r.push(n);for(const a of r)Mm(a,t);return{mesh:e,trackedMeshes:r}}function Ia(e){if(e)for(const t of e.trackedMeshes)t.receiveShadows=!0}function Mm(e,t){const r=t.get(e);if(r){r.refCount+=1;return}t.set(e,{mesh:e,previousReceiveShadows:e.receiveShadows,refCount:1})}function Br(e,t){for(const r of e.trackedMeshes)Rm(r,t)}function Rm(e,t){const r=t.get(e);r&&(r.refCount-=1,!(r.refCount>0)&&(r.mesh.receiveShadows=r.previousReceiveShadows,t.delete(e)))}function zr(e){if(ot(e))return[];e.computeWorldMatrix(!0);const t=e.getHierarchyBoundingVectors(!0);return Dm(t.min,t.max)}function Tm(e,t,r){if(!e)return[];const n=e.globalPosition??e.position;if(!n)return[];const a=Gr(e,F.Forward(),new F(0,0,1)),o=Gr(e,F.Right(),new F(1,0,0)),s=Gr(e,F.Up(),new F(0,1,0)),i=Math.max(1,Math.min(r,ct(e.maxZ,r))),d=Math.max(.1,Math.min(i,ct(e.minZ,.1))),l=Om(t);if(e.mode===Ua.ORTHOGRAPHIC_CAMERA){const g=Math.max(.5,Math.abs(we(e.orthoTop,1)-we(e.orthoBottom,-1))*.5),p=Math.max(.5,Math.abs(we(e.orthoRight,l)-we(e.orthoLeft,-l))*.5);return[...Ht(n.add(a.scale(d)),o,s,p,g),...Ht(n.add(a.scale(i)),o,s,p,g)]}const u=ct(e.fov,.8),c=Math.tan(u*.5)*i,m=c*l,f=Math.tan(u*.5)*d,h=f*l;return[...Ht(n.add(a.scale(d)),o,s,h,f),...Ht(n.add(a.scale(i)),o,s,m,c)]}function Ht(e,t,r,n,a){return[e.add(t.scale(-n)).add(r.scale(-a)),e.add(t.scale(n)).add(r.scale(-a)),e.add(t.scale(n)).add(r.scale(a)),e.add(t.scale(-n)).add(r.scale(a))]}function km(e){let t=e.position;e.computeTransformedInformation()&&(t=e.transformedPosition);const r=Ro(e.getShadowDirection(0));return Math.abs(F.Dot(r,F.Up()))===1&&(r.z=1e-13),$a.LookAtLH(t,t.add(r),F.Up())}function Aa(e){const t=new F(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new F(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of e)t.minimizeInPlace(n),r.maximizeInPlace(n);return{min:t,max:r}}function Dm(e,t){return[new F(e.x,e.y,e.z),new F(t.x,e.y,e.z),new F(t.x,t.y,e.z),new F(e.x,t.y,e.z),new F(e.x,e.y,t.z),new F(t.x,e.y,t.z),new F(t.x,t.y,t.z),new F(e.x,t.y,t.z)]}function Gr(e,t,r){try{const n=e.getDirection(t);if(To(n)&&n.lengthSquared()>1e-8)return n.normalize()}catch{}return r.clone()}function Ro(e){return To(e)&&e.lengthSquared()>1e-8?e.clone().normalize():new F(-.3,-1,-.2).normalize()}function _m(e){return e?e.mode===Ua.ORTHOGRAPHIC_CAMERA?"orthographic":"perspective":"none"}function Om(e){const t=e.getEngine(),r=Math.max(1,t.getRenderWidth()),n=Math.max(1,t.getRenderHeight());return r/n}function Nm(e){return{...e,generator:e.generator?{...e.generator}:null,params:{...e.params},bounds:e.bounds?{world:{min:{...e.bounds.world.min},max:{...e.bounds.world.max}},lightOrtho:{...e.bounds.lightOrtho},texelSize:e.bounds.texelSize,cameraProjection:e.bounds.cameraProjection}:null,fallbackReasons:[...e.fallbackReasons]}}function Ca(e){return{x:e.x,y:e.y,z:e.z}}function To(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function ot(e){return typeof e.isDisposed=="function"&&e.isDisposed()}function we(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function ct(e,t){const r=we(e,t);return r>0?r:t}function an(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function jm(e,t){return e===512||e===1024||e===2048||e===4096?e:t}function Lm(e,t){return e===1||e===2||e===4?e:t}function Bm(e){const t=e.root??document.body,r=t.ownerDocument,n=e.tooltipDataAttribute??"editorRuntimeDebugTooltip",a=e.tooltipDelayMs??160;let o=e.initialOpen===!0,s=e.language,i=0,d=null,l=0;const u=e.panelMode==="managed",c=r.createElement("div");c.style.cssText=u?["position:relative","display:none","width:100%","max-width:100%","flex-direction:column","align-items:stretch",'font-family:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',"color:#edf2ff","pointer-events:none"].join(";"):["position:fixed",`right:${$r(e.placement?.right??16)}`,`bottom:${$r(e.placement?.bottom??16)}`,`z-index:${e.placement?.zIndex??2147482600}`,"display:none","flex-direction:column","align-items:flex-end",'font-family:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',"color:#edf2ff","pointer-events:none"].join(";");const m=r.createElement("button");m.type="button",m.textContent=e.toggleLabel,m.style.cssText=["pointer-events:auto",u?"align-self:flex-end":"","height:34px","padding:0 12px","border:1px solid rgba(148, 163, 184, 0.36)","border-radius:7px","background:rgba(15, 23, 42, 0.88)","color:#f8fafc",'font:600 12px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',"box-shadow:0 10px 26px rgba(0,0,0,0.28)","cursor:pointer"].join(";");const f=r.createElement("section");f.style.cssText=["pointer-events:auto",`width:${u?"100%":$r(e.placement?.width??320)}`,"max-height:min(70vh, 720px)","overflow:auto","box-sizing:border-box","margin-bottom:8px","padding:12px","border:1px solid rgba(148, 163, 184, 0.28)","border-radius:8px","background:rgba(13, 18, 28, 0.94)","box-shadow:0 18px 44px rgba(0,0,0,0.34)","backdrop-filter:blur(8px)","display:none"].join(";");const h=r.createElement("div");h.style.cssText="display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px;";const g=r.createElement("div");g.style.cssText="font-size:13px;font-weight:700;line-height:1.2;";const p=r.createElement("div");p.style.cssText="display:flex;align-items:center;gap:8px;";const S=r.createElement("div");S.style.cssText="font-size:11px;color:#93c5fd;line-height:1.2;";const P=r.createElement("button");P.type="button",P.style.cssText=["height:24px","padding:0 8px","border:1px solid rgba(148, 163, 184, 0.3)","border-radius:6px","background:rgba(30, 41, 59, 0.8)","color:#dbeafe",'font:700 11px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',"cursor:pointer"].join(";"),p.append(S,P),h.append(g,p);const I=r.createElement("div"),D=r.createElement("div");D.style.cssText="display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px;";const z=r.createElement("div");z.style.cssText="min-height:16px;margin-top:8px;font-size:11px;color:#94a3b8;",f.append(h,I,D,z),c.append(f,m),t.append(c);const j=r.createElement("div");j.style.cssText=["position:fixed","z-index:2147483601","display:none","max-width:min(280px, calc(100vw - 16px))","box-sizing:border-box","padding:5px 7px","border:1px solid rgba(148, 163, 184, 0.32)","border-radius:5px","background:rgba(15, 23, 42, 0.94)","box-shadow:0 10px 26px rgba(0, 0, 0, 0.3)","color:#dbeafe",'font:700 11px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',"line-height:1.35","white-space:normal","pointer-events:none"].join(";"),t.append(j);const J={root:t,ownerDocument:r,container:c,panel:f,title:g,modeLabel:S,languageButton:P,toggleButton:m,content:I,actions:D,status:z,get open(){return o},get language(){return s},setOpen(M){o=M,de(),e.onOpenChange?.(o)},setLanguageChrome(M){s=M.language,g.textContent=M.title,S.textContent=M.modeLabel,P.textContent=M.languageButtonLabel,J.setTooltip(P,M.languageTooltip??""),J.setTooltip(m,M.toggleTooltip??""),M.toggleTooltip&&m.setAttribute("aria-label",M.toggleTooltip)},setToggleActive(M){m.style.background=M?"rgba(29, 78, 216, 0.9)":"rgba(15, 23, 42, 0.88)"},setStatus(M,B={}){z.textContent=M,z.style.color=B.tone==="error"?"#fca5a5":"#94a3b8",i&&r.defaultView?.clearTimeout(i),i=0,!B.sticky&&(i=r.defaultView?.setTimeout(()=>{z.textContent===M&&(z.textContent=""),i=0},1800)??0)},setTooltip(M,B){const K=B.trim();if(!K){delete M.dataset[n],M.removeAttribute("title");return}M.dataset[n]=K,M.removeAttribute("title")},hideTooltip:X,dispose(){i&&r.defaultView?.clearTimeout(i),_e(),c.removeEventListener("pointerover",W),c.removeEventListener("pointerout",Ae),c.removeEventListener("focusin",De),c.removeEventListener("focusout",X),c.removeEventListener("click",X),c.remove(),j.remove()}};return m.addEventListener("click",()=>J.setOpen(!o)),c.addEventListener("pointerover",W),c.addEventListener("pointerout",Ae),c.addEventListener("focusin",De),c.addEventListener("focusout",X),c.addEventListener("click",X),J.setLanguageChrome({title:e.title,modeLabel:e.modeLabel,languageButtonLabel:e.languageButtonLabel,toggleTooltip:e.toggleTooltip,languageTooltip:e.languageTooltip,language:s}),de(),J;function de(){c.style.display="flex",f.style.display=o?"block":"none",J.setToggleActive(o),o||X()}function W(M){const B=ne(M.target);!B||B===d||Ce(B)}function Ae(M){if(!d)return;const B=M.relatedTarget instanceof Node?M.relatedTarget:null;B&&d.contains(B)||X()}function De(M){const B=ne(M.target);B&&Ce(B)}function ne(M){return M instanceof HTMLElement?M.closest(`[data-${Gm(n)}]`):null}function Ce(M){const B=M.dataset[n]?.trim();if(!B){X();return}_e(),d=M,l=r.defaultView?.setTimeout(()=>{l=0,d===M&&$e(M,B)},a)??0}function $e(M,B){j.textContent=B,j.style.display="",j.style.left="0px",j.style.top="0px";const K=M.getBoundingClientRect(),ue=j.getBoundingClientRect(),oe=r.defaultView?.innerWidth??r.documentElement.clientWidth,se=r.defaultView?.innerHeight??r.documentElement.clientHeight,ee=Math.max(8,Math.min(K.left+(K.width-ue.width)/2,oe-ue.width-8)),E=K.bottom+7,w=K.top-ue.height-7,T=E+ue.height<=se-8?E:Math.max(8,w);j.style.left=`${ee}px`,j.style.top=`${T}px`}function X(){_e(),d=null,j.style.display="none",j.textContent=""}function _e(){l&&(r.defaultView?.clearTimeout(l),l=0)}}function xa(e){const t=e.createElement("button");return t.type="button",t.style.cssText=["height:28px","border:1px solid rgba(148, 163, 184, 0.32)","border-radius:6px","background:rgba(30, 41, 59, 0.86)","color:#f8fafc",'font:600 11px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',"cursor:pointer"].join(";"),t}function Z(e){const t=e.createElement("label");return t.style.cssText="font-size:11px;color:#cbd5e1;",t}function qt(e){const t=e.createElement("div");return t.style.cssText="display:grid;grid-template-columns:1fr 108px;gap:7px 8px;align-items:center;",t}function Yt(e){const t=e.createElement("div");return t.style.cssText="display:flex;flex-direction:column;gap:7px;",t}function Wt(e){const t=e.createElement("div");return t.style.cssText="font-size:11px;font-weight:800;color:#e2e8f0;letter-spacing:0;text-transform:none;",t}function tt(e,t={}){const r=e.createElement("input");return r.type="number",t.step!=null&&(r.step=String(t.step)),t.min!=null&&(r.min=String(t.min)),t.max!=null&&(r.max=String(t.max)),r.inputMode="decimal",r.style.cssText=ko(),r}function zm(e,t={}){const r=e.createElement("input");return r.type="range",t.step!=null&&(r.step=String(t.step)),t.min!=null&&(r.min=String(t.min)),t.max!=null&&(r.max=String(t.max)),r.style.cssText="width:100%;min-width:0;height:18px;margin:0;accent-color:#3b82f6;cursor:pointer;",r}function Fr(e){const t=e.createElement("input");return t.type="color",t.style.cssText=[ko(),"padding:2px 4px"].join(";"),t}function va(e){const t=e.createElement("input");return t.type="checkbox",t.style.cssText="justify-self:start;width:16px;height:16px;accent-color:#3b82f6;",t}function Ma(e){const t=e.createElement("div");return t.style.cssText=["min-height:26px","box-sizing:border-box","padding:5px 6px","border:1px solid rgba(148, 163, 184, 0.2)","border-radius:6px","background:rgba(15, 23, 42, 0.58)","color:#dbeafe","font:11px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace","line-height:1.35","white-space:normal"].join(";"),t}function ko(e="12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"){return["width:108px","height:26px","min-width:0","box-sizing:border-box","border:1px solid rgba(148, 163, 184, 0.34)","border-radius:6px","background:rgba(15, 23, 42, 0.84)","color:#f8fafc","padding:0 6px",`font:${e}`].join(";")}function $r(e){return typeof e=="number"?`${e}px`:e}function Gm(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function _p(e){const t=e.root??document.body,r=t.ownerDocument;let n=Ic(r.defaultView),a=!1,o=!1,s=0,i=null,d=null;const l=Bm({root:t,toggleLabel:"Light",title:fe().title,modeLabel:fe().runtime,languageButtonLabel:fe().languageButton,toggleTooltip:Sr().toggleTitle,languageTooltip:Sr().languageButton,tooltipDataAttribute:"lightingDebugTooltip",initialOpen:wc(r.defaultView),language:n,panelMode:e.panelMode,placement:{right:100,width:330,...e.placement},onOpenChange:b=>{Pc(r.defaultView,b),b&&ft(0)}}),u=Yt(r),c=Wt(r),m=qt(r),f=va(r),h=tt(r,Ne("environmentIntensity")),g=Fr(r),p=Fr(r);m.append(Z(r),f,Z(r),h,Z(r),g,Z(r),p),u.append(c,m);const S=Yt(r),P=Wt(r),I=qt(r),D=tt(r,Ne("iblIntensity")),z=tt(r,Ne("iblRotationY"));I.append(Z(r),D,Z(r),z),S.append(P,I);const j=Yt(r),J=Wt(r),de=qt(r),W=va(r),Ae=tt(r,Ne("directionalIntensity")),De=tt(r,Ne("directionalHorizontalAngle")),ne=tt(r,Ne("directionalElevationAngle")),Ce=Fr(r),$e=Ma(r),X=Ma(r);de.append(Z(r),W,Z(r),Ae,Z(r),De,Z(r),ne,Z(r),Ce,Z(r),$e,Z(r),X),j.append(J,de);const _e=Yt(r),M=Wt(r),B=qt(r),K=b=>{const y=r.createElement("div");y.style.cssText="display:grid;grid-template-columns:minmax(54px,1fr) 36px;align-items:center;gap:6px;min-width:0;";const v=zm(r,Ne(b)),k=r.createElement("output");return k.style.cssText="font:11px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;color:#dbeafe;text-align:right;font-variant-numeric:tabular-nums;",v.dataset.lightingDebugOutputId=b,k.dataset.lightingDebugOutput=b,v.addEventListener("input",()=>{k.value=Oe(Number(v.value))}),y.append(v,k),{input:v,wrapper:y}},ue=K("shadowStrength"),oe=K("shadowSoftness");B.append(Z(r),ue.wrapper,Z(r),oe.wrapper),_e.append(M,B),l.content.style.cssText="display:flex;flex-direction:column;gap:10px;",l.content.append(u,S,j,_e);const se=xa(r),ee=xa(r);l.actions.append(se,ee);const E=de.children,w={environmentEnabled:m.children[0],environmentIntensity:m.children[2],environmentDiffuseColor:m.children[4],environmentGroundColor:m.children[6],iblIntensity:I.children[0],iblRotationY:I.children[2],directionalEnabled:E[0],directionalIntensity:E[2],directionalHorizontalAngle:E[4],directionalElevationAngle:E[6],directionalDiffuseColor:E[8],rawDirection:E[10],shadowReadout:E[12],shadowStrength:B.children[0],shadowSoftness:B.children[2]},T=new Map([["environmentIntensity",h],["iblIntensity",D],["iblRotationY",z],["directionalIntensity",Ae],["directionalHorizontalAngle",De],["directionalElevationAngle",ne],["shadowStrength",ue.input],["shadowSoftness",oe.input]]),q=new Map([["environmentDiffuseColor",g],["environmentGroundColor",p],["directionalDiffuseColor",Ce]]),ie=[f,W];f.addEventListener("change",()=>{Je({kind:"enabled",target:"environment"})}),W.addEventListener("change",()=>{Je({kind:"enabled",target:"directional"})});for(const[b,y]of T)y.addEventListener("input",()=>{y.type==="number"&&xr(y.value)===null||Je({kind:"number",field:b})}),y.type==="number"&&(y.addEventListener("blur",()=>Tn(b)),y.addEventListener("keydown",v=>{v.key==="Enter"?(v.preventDefault(),Tn(b),y.blur()):v.key==="Escape"&&(v.preventDefault(),kn(b),y.blur())}));for(const[b,y]of q)y.addEventListener("input",()=>Je({kind:"color",field:b}));return l.languageButton.addEventListener("click",()=>{n=n==="zh"?"en":"zh",Ac(r.defaultView,n),Dn()}),se.addEventListener("click",()=>{!i||a||(Mn(i),gr(i),l.setStatus(fe().resetStatus))}),ee.addEventListener("click",()=>{const b=d??e.readSnapshot();if(!b||a||!Qt(b)){l.setStatus(fe().missingBindingStatus,{tone:"error"});return}a=!0,be(b),l.setStatus(fe().savingStatus,{sticky:!0}),Promise.resolve(e.saveSnapshot(b)).then(()=>{l.setStatus(fe().savedStatus,{sticky:!0}),e.reloadAfterSave!==!1&&r.defaultView?.location.reload()}).catch(y=>{console.error("[EditorRuntimeLightingDebugPanel] Save lighting failed",y),a=!1,l.setStatus(Fm(y,fe().saveFailed),{sticky:!0,tone:"error"}),be(d)})}),Dn(),_t(),{dispose(){o=!0,s&&r.defaultView?.clearTimeout(s),l.dispose()}};function _t(){if(o)return;s=0;const b=e.readSnapshot();b?(i||(i=ze(b)),d=ze(b)):(i=null,d=null),be(b),ft(l.open?250:1e3)}function ft(b){o||(s&&r.defaultView?.clearTimeout(s),s=r.defaultView?.setTimeout(_t,b)??0)}function be(b){if(l.container.style.display=b?"flex":"none",!b){l.hideTooltip();return}for(const v of[...T.values(),...q.values(),...ie])v.disabled=a;const y=!!b.shadow.shadowMap?.appearance;S.style.display=b.environmentTexture?"flex":"none",_e.style.display=y?"flex":"none",ue.input.disabled=a||!y,oe.input.disabled=a||!y,se.disabled=!i||a,ee.disabled=a||!Qt(b),ee.style.opacity=ee.disabled?"0.68":"1",ee.style.cursor=ee.disabled?"not-allowed":"pointer",Xo()||Mn(b),br(b),!Qt(b)&&!a&&l.setStatus(fe().missingBindingStatus,{tone:"error"})}function Je(b){if(a)return;const y=d??e.readSnapshot();if(!y)return;const v=Rn(y,b);gr(v),Wo(v)}function gr(b){e.applySnapshot(b),d=ze(b),br(b)}function Mn(b){f.checked=b.environment.enabled,W.checked=b.directional.enabled,me("environmentIntensity",b.environment.light.intensity),Ot("environmentDiffuseColor",b.environment.light.diffuseColor??{r:1,g:1,b:1}),Ot("environmentGroundColor",b.environment.light.groundColor??{r:.48,g:.52,b:.62}),b.environmentTexture&&(me("iblIntensity",b.environmentTexture.iblIntensity),me("iblRotationY",b.environmentTexture.iblRotationY));const y=Hr(b.directional.light.direction);me("directionalIntensity",b.directional.light.intensity),me("directionalHorizontalAngle",y.horizontalAngleDeg),me("directionalElevationAngle",y.elevationAngleDeg),Ot("directionalDiffuseColor",b.directional.light.diffuseColor??{r:1,g:1,b:1}),b.shadow.shadowMap?.appearance&&(me("shadowStrength",b.shadow.shadowMap.appearance.strength),me("shadowSoftness",b.shadow.shadowMap.appearance.softness))}function Wo(b){const y=r.activeElement;y!==f&&(f.checked=b.environment.enabled),y!==W&&(W.checked=b.directional.enabled);for(const v of T.keys()){const k=T.get(v);!k||y===k||me(v,ht(b,v))}for(const v of q.keys()){const k=q.get(v);!k||y===k||Ot(v,Jn(b,v))}}function Rn(b,y){if(y.kind==="enabled"){const k=y.target==="environment"?f.checked:W.checked;return Mc(b,y.target,k)}if(y.kind==="color"){const k=Jn(b,y.field);return vc(b,y.field,Jo(y.field,k))}const v=ht(b,y.field);return xc(b,y.field,Ko(y.field,v))}function me(b,y){const v=T.get(b);if(!v)return;v.value=String(zi(y));const k=l.container.querySelector(`output[data-lighting-debug-output="${b}"]`);k&&(k.value=Oe(y))}function Ko(b,y){const v=T.get(b);if(!v)return y;const k=xr(v.value);if(k===null)return y;const Nt=Ne(b),jt=Nt.min??Number.NEGATIVE_INFINITY,Zo=Nt.max??Number.POSITIVE_INFINITY;return Math.min(Zo,Math.max(jt,k))}function Tn(b){if(a)return;const y=d??e.readSnapshot();if(!y)return;const v=T.get(b);if(!v||xr(v.value)===null){kn(b);return}const k=Rn(y,{kind:"number",field:b}),Nt=ht(y,b),jt=ht(k,b);Math.abs(jt-Nt)>1e-6&&gr(k),me(b,jt)}function kn(b){const y=d??e.readSnapshot();y&&me(b,ht(y,b))}function Ot(b,y){const v=q.get(b);v&&(v.value=Gi(y))}function Jo(b,y){const v=q.get(b);return v?Fi(v.value,y):y}function br(b){const y=b.directional.light.direction;$e.textContent=`x ${Oe(y.x)} y ${Oe(y.y)} z ${Oe(y.z)}`;const v=Ec(b.shadow.mode,fe()),k=b.shadow.shadowMap;X.textContent=b.shadow.mode==="shadow-map"&&k?[`${v} / ${k.backend??"pending"}`,...k.appearance?[`strength ${Oe(k.appearance.strength)} softness ${Oe(k.appearance.softness)}`]:[],`depth S ${k.staticRefreshCount??"-"} D ${k.dynamicRefreshCount??"-"} C ${k.compositeRefreshCount??"-"}`,k.lastRefreshReasons[k.lastRefreshReasons.length-1]??"ready"].join(`
|
|
8
|
-
`):`${v}
|
|
9
|
-
shadow length x${Oe(b.shadow.projectedLengthMultiplier)}`}function Dn(){const b=fe(),y=Sr();l.setLanguageChrome({title:b.title,modeLabel:b.runtime,languageButtonLabel:b.languageButton,toggleTooltip:y.toggleTitle,languageTooltip:y.languageButton,language:n}),c.textContent=b.environmentSection,P.textContent=b.environmentTextureSection,J.textContent=b.directionalSection,M.textContent=b.shadowSection,w.environmentEnabled.textContent=b.enabled,w.environmentIntensity.textContent=b.intensity,w.environmentDiffuseColor.textContent=b.skyLightColor,w.environmentGroundColor.textContent=b.groundColor,w.iblIntensity.textContent=b.iblIntensity,w.iblRotationY.textContent=b.iblRotationY,w.directionalEnabled.textContent=b.enabled,w.directionalIntensity.textContent=b.intensity,w.directionalHorizontalAngle.textContent=b.horizontalAngle,w.directionalElevationAngle.textContent=b.elevationAngle,w.directionalDiffuseColor.textContent=b.lightColor,w.rawDirection.textContent=b.rawDirection,w.shadowReadout.textContent=b.shadowReadout,w.shadowStrength.textContent=b.shadowStrength,w.shadowSoftness.textContent=b.shadowSoftness;for(const[v,k]of T)k.setAttribute("aria-label",w[v].textContent??v);l.setTooltip(f,y.enabled),l.setTooltip(w.environmentEnabled,y.enabled),l.setTooltip(w.environmentIntensity,y.environmentIntensity),l.setTooltip(h,y.environmentIntensity),l.setTooltip(w.environmentDiffuseColor,y.skyLightColor),l.setTooltip(g,y.skyLightColor),l.setTooltip(w.environmentGroundColor,y.groundColor),l.setTooltip(p,y.groundColor),l.setTooltip(w.iblIntensity,y.iblIntensity),l.setTooltip(D,y.iblIntensity),l.setTooltip(w.iblRotationY,y.iblRotationY),l.setTooltip(z,y.iblRotationY),l.setTooltip(W,y.enabled),l.setTooltip(w.directionalEnabled,y.enabled),l.setTooltip(w.directionalIntensity,y.directionalIntensity),l.setTooltip(Ae,y.directionalIntensity),l.setTooltip(w.directionalHorizontalAngle,y.horizontalAngle),l.setTooltip(De,y.horizontalAngle),l.setTooltip(w.directionalElevationAngle,y.elevationAngle),l.setTooltip(ne,y.elevationAngle),l.setTooltip(w.directionalDiffuseColor,y.lightColor),l.setTooltip(Ce,y.lightColor),l.setTooltip(w.rawDirection,y.rawDirection),l.setTooltip($e,y.rawDirection),l.setTooltip(w.shadowReadout,y.shadowReadout),l.setTooltip(X,y.shadowReadout),l.setTooltip(w.shadowStrength,y.shadowStrength),l.setTooltip(ue.input,y.shadowStrength),l.setTooltip(w.shadowSoftness,y.shadowSoftness),l.setTooltip(oe.input,y.shadowSoftness),se.textContent=b.reset,l.setTooltip(se,y.reset),ee.textContent=b.save,l.setTooltip(ee,y.save),d&&br(d)}function Xo(){const b=r.activeElement;return b===l.languageButton||b===f||b===W||[...T.values()].includes(b)||[...q.values()].includes(b)}function fe(){return Sc(n)}function Sr(){return yc(n)}}function Fm(e,t){const r=e instanceof Error?e.message:String(e??"");return r?`${t}: ${r}`:t}function Op(e,t,r,n={}){const{target:a}=vo(e),o=a;if(!o)return!1;switch(t){case"outline.renderOutline":return typeof r!="boolean"?!1:St(o,{enabled:r});case"outline.outlineWidth":return r!=null&&(typeof r!="number"||!Number.isFinite(r))?!1:St(o,{width:r});case"outline.outlineColor":return r==null?St(o,{color:null}):!r||typeof r!="object"?!1:St(o,{color:r});default:return!1}}function $m(){const e=globalThis.Worker,t=globalThis.Blob,r=globalThis.URL;if(!e||!t||!r?.createObjectURL)return null;let n=null,a=null;try{const d=new t([Vm],{type:"text/javascript"});n=r.createObjectURL(d),a=new e(n,{name:"StaticShadowBakeWorker"})}catch{return n&&r.revokeObjectURL&&r.revokeObjectURL(n),null}let o=1;const s=new Map;a.onmessage=d=>{const l=d.data,u=typeof l?.id=="number"?l.id:0,c=s.get(u);if(!c)return;if(s.delete(u),l?.error){c.reject(new Error(l.error));return}const m=l?.result;c.resolve(m?{sdfAlpha:new Uint8ClampedArray(m.sdfAlpha),width:m.width,height:m.height,hasCoverage:m.hasCoverage}:null)},a.onerror=d=>{const l=new Error(d.message||"Static shadow worker failed.");for(const u of s.values())u.reject(l);s.clear()};const i=d=>$i(d.pixels,d.width,d.height,d.sdfRadiusPx);return{processSdfTile:async d=>{if(!a)return i(d);const l=o;o+=1;const u=Um(d.pixels);try{return await new Promise((m,f)=>{s.set(l,{resolve:m,reject:f}),a?.postMessage({id:l,type:"sdf-tile",pixels:u.buffer,width:d.width,height:d.height,sdfRadiusPx:d.sdfRadiusPx},[u.buffer])})??i(d)}catch{return s.delete(l),i(d)}},dispose:()=>{for(const d of s.values())d.resolve(null);s.clear(),a?.terminate(),a=null,n&&r.revokeObjectURL&&r.revokeObjectURL(n),n=null}}}function Um(e){const t=e instanceof Uint8Array||e instanceof Uint8ClampedArray?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return new Uint8Array(t)}const Vm=`
|
|
10
|
-
self.onmessage = function(event) {
|
|
11
|
-
const data = event.data || {};
|
|
12
|
-
if (data.type !== 'sdf-tile') return;
|
|
13
|
-
try {
|
|
14
|
-
const width = Math.max(0, Math.floor(data.width || 0));
|
|
15
|
-
const height = Math.max(0, Math.floor(data.height || 0));
|
|
16
|
-
const pixels = new Uint8Array(data.pixels);
|
|
17
|
-
const result = createSdfTile(pixels, width, height, Number(data.sdfRadiusPx || 0));
|
|
18
|
-
self.postMessage({
|
|
19
|
-
id: data.id,
|
|
20
|
-
result: {
|
|
21
|
-
sdfAlpha: result.sdfAlpha.buffer,
|
|
22
|
-
width: result.width,
|
|
23
|
-
height: result.height,
|
|
24
|
-
hasCoverage: result.hasCoverage
|
|
25
|
-
}
|
|
26
|
-
}, [result.sdfAlpha.buffer]);
|
|
27
|
-
} catch (error) {
|
|
28
|
-
self.postMessage({ id: data.id, error: error && error.message ? error.message : String(error) });
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
function createSdfTile(pixels, width, height, radiusPx) {
|
|
33
|
-
const pixelCount = Math.max(0, width * height);
|
|
34
|
-
const alpha = new Uint8ClampedArray(pixelCount);
|
|
35
|
-
for (let index = 0; index < pixelCount; index += 1) alpha[index] = pixels[index * 4 + 3] || 0;
|
|
36
|
-
if (!hasCoverage(alpha)) {
|
|
37
|
-
return { sdfAlpha: new Uint8ClampedArray(pixelCount), width, height, hasCoverage: false };
|
|
38
|
-
}
|
|
39
|
-
return { sdfAlpha: createSdfAlpha(alpha, width, height, radiusPx), width, height, hasCoverage: true };
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function hasCoverage(alpha) {
|
|
43
|
-
for (let index = 0; index < alpha.length; index += 1) if ((alpha[index] || 0) > 0) return true;
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function createSdfAlpha(maskAlpha, width, height, radiusPx) {
|
|
48
|
-
const pixelCount = Math.max(0, width * height);
|
|
49
|
-
const output = new Uint8ClampedArray(pixelCount);
|
|
50
|
-
if (pixelCount === 0) return output;
|
|
51
|
-
const binary = new Uint8Array(pixelCount);
|
|
52
|
-
let insideCount = 0;
|
|
53
|
-
for (let index = 0; index < pixelCount; index += 1) {
|
|
54
|
-
if ((maskAlpha[index] || 0) > 0) {
|
|
55
|
-
binary[index] = 1;
|
|
56
|
-
insideCount += 1;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (insideCount === 0) return output;
|
|
60
|
-
if (insideCount === pixelCount) {
|
|
61
|
-
output.fill(255);
|
|
62
|
-
return output;
|
|
63
|
-
}
|
|
64
|
-
const radius = Math.max(0, Number.isFinite(radiusPx) ? radiusPx : 0);
|
|
65
|
-
if (radius <= 0) {
|
|
66
|
-
for (let index = 0; index < pixelCount; index += 1) output[index] = binary[index] ? 255 : 0;
|
|
67
|
-
return output;
|
|
68
|
-
}
|
|
69
|
-
const distToInside = createDistanceTransform(binary, width, height, 1);
|
|
70
|
-
const distToOutside = createDistanceTransform(binary, width, height, 0);
|
|
71
|
-
for (let index = 0; index < pixelCount; index += 1) {
|
|
72
|
-
if (binary[index]) {
|
|
73
|
-
const distance = Math.min(radius, Math.sqrt(distToOutside[index] || 0));
|
|
74
|
-
output[index] = Math.round((0.5 + 0.5 * (distance / radius)) * 255);
|
|
75
|
-
} else {
|
|
76
|
-
const distance = Math.min(radius, Math.sqrt(distToInside[index] || 0));
|
|
77
|
-
output[index] = Math.round((0.5 - 0.5 * (distance / radius)) * 255);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return output;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function createDistanceTransform(binary, width, height, featureValue) {
|
|
84
|
-
const pixelCount = width * height;
|
|
85
|
-
const temp = new Float64Array(pixelCount);
|
|
86
|
-
const output = new Float64Array(pixelCount);
|
|
87
|
-
const rowInput = new Float64Array(width);
|
|
88
|
-
const rowOutput = new Float64Array(width);
|
|
89
|
-
for (let y = 0; y < height; y += 1) {
|
|
90
|
-
const rowOffset = y * width;
|
|
91
|
-
for (let x = 0; x < width; x += 1) rowInput[x] = binary[rowOffset + x] === featureValue ? 0 : 1e20;
|
|
92
|
-
distanceTransform1d(rowInput, rowOutput, width);
|
|
93
|
-
for (let x = 0; x < width; x += 1) temp[rowOffset + x] = rowOutput[x] || 1e20;
|
|
94
|
-
}
|
|
95
|
-
const columnInput = new Float64Array(height);
|
|
96
|
-
const columnOutput = new Float64Array(height);
|
|
97
|
-
for (let x = 0; x < width; x += 1) {
|
|
98
|
-
for (let y = 0; y < height; y += 1) columnInput[y] = temp[y * width + x] || 1e20;
|
|
99
|
-
distanceTransform1d(columnInput, columnOutput, height);
|
|
100
|
-
for (let y = 0; y < height; y += 1) output[y * width + x] = columnOutput[y] || 1e20;
|
|
101
|
-
}
|
|
102
|
-
return output;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function distanceTransform1d(input, output, length) {
|
|
106
|
-
if (length <= 0) return;
|
|
107
|
-
const v = new Int32Array(length);
|
|
108
|
-
const z = new Float64Array(length + 1);
|
|
109
|
-
let k = 0;
|
|
110
|
-
v[0] = 0;
|
|
111
|
-
z[0] = -Infinity;
|
|
112
|
-
z[1] = Infinity;
|
|
113
|
-
for (let q = 1; q < length; q += 1) {
|
|
114
|
-
let s = intersection(input, q, v[k]);
|
|
115
|
-
while (s <= z[k]) {
|
|
116
|
-
k -= 1;
|
|
117
|
-
s = intersection(input, q, v[k]);
|
|
118
|
-
}
|
|
119
|
-
k += 1;
|
|
120
|
-
v[k] = q;
|
|
121
|
-
z[k] = s;
|
|
122
|
-
z[k + 1] = Infinity;
|
|
123
|
-
}
|
|
124
|
-
k = 0;
|
|
125
|
-
for (let q = 0; q < length; q += 1) {
|
|
126
|
-
while (z[k + 1] < q) k += 1;
|
|
127
|
-
const distance = q - v[k];
|
|
128
|
-
output[q] = distance * distance + input[v[k]];
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function intersection(input, q, p) {
|
|
133
|
-
return ((input[q] + q * q) - (input[p] + p * p)) / (2 * q - 2 * p);
|
|
134
|
-
}
|
|
135
|
-
`,Hm=new Set(["rendering-groups","environment","post-process","shadows"]),qm=/\.(env|hdr|dds|ktx|ktx2)(?:[?#].*)?$/i;function Do(e){return{getWorldRendering(t){return Ym(t,e)},getRenderingPanelState(t,r){return Qm(t,e,r)},async onRenderingAction(t){return mf(t,e)},async applyRenderingPropertyGesture(t){return lf(t,e)},getShadowMapExperimentConfig:e.getShadowMapExperimentConfig,getShadowMapExperimentPlan:e.getShadowMapExperimentPlan,createShadowMapExperimentProfilesPatch:e.createShadowMapExperimentProfilesPatch}}function Np(e){const t=Eo(e.initialStaticShadowArtifact);return{capability:Do({getConfig:()=>e.getConfig(),setConfig:r=>{const n=Te(e.getConfig());e.setConfig(r.config);const a=_o(r,n,e);return a?{documentPatch:a}:void 0},resetConfig:()=>e.resetConfig(),isDirty:()=>e.isConfigDirty()||t.isDirty(),getPanelState:()=>e.getPanelState(),getTextureAssets:e.getTextureAssets,getLanguage:e.getLanguage,getStaticShadowArtifact:()=>t.get(),setStaticShadowArtifact:({artifact:r})=>{t.set(r)},shadowPreview:{directionalLightNodeId:e.directionalLightNodeId,enabled:e.isDirectionalLightActive}}),resetDraft(){e.resetConfig(),t.reset()},hasDraftChanges:()=>e.isConfigDirty()||t.isDirty(),getActiveStaticShadowArtifact:()=>t.get(),setActiveStaticShadowArtifact:r=>{t.set(r)},markActiveStaticShadowArtifactSaved:(r=t.get())=>{t.markSaved(r)},isStaticShadowArtifactDirty:()=>t.isDirty()}}function _o(e,t,r){if(e.action)return null;const n=xl({changedPaths:e.changedPaths,previousProfile:t,change:e.change});if(!n)return null;const a=qi(r.getAlphaIndexMigrationGameObjects(e.document),{renderingGroupId:n.renderingGroupId,fromAlphaIndex:n.fromAlphaIndex});return a.length===0?null:{label:`Migrate rendering alphaIndex ${n.fromAlphaIndex} to ${n.toAlphaIndex}`,patch:r.createAlphaIndexMigrationPatch({targetIds:a,...n}),changedIds:a,reprojectIds:a}}function Ym(e,t,r={}){const n=hr(e,t),a=zo(n,t);return{environment:Lo(n.profile,t.getTextureAssets?.({document:e})??[]),postProcess:a.profile,shadowPreview:Go(n,t,r)}}function jp(e,t,r={}){const n=hr(e,t),a=t.getTextureAssets?.({document:e})??[],o=zo(n,t),s=Go(n,t,r);return{config:n.config,profile:n.profile,worldRendering:{environment:Lo(n.profile,a),postProcess:o.profile,shadowPreview:s},environmentTexture:of(n.profile.environment.texture,a),staticShadowArtifact:nf(n,t,r),postProcess:o,shadowPreview:s}}async function Lp(e){let t=e.initialRendering??null;const r=Yi(e.scene,e.cameras,t?.postProcess??null,e.postProcess);let n=null;try{n=Wi(e.scene,{createTexture:e.createEnvironmentTexture}),await n.applyProfile(t?.environment??null)}catch(o){const s=n,i=Km([...s?[()=>s.dispose()]:[],()=>r.dispose()]),d=i();throw d.length>0?Wm(o,d,()=>Jm(i())):o}const a=n;return{environment:a,postProcess:r,getWorldRendering(){return t},async setWorldRendering(o){const s=o??null;await a.applyProfile(s?.environment??null),r.setProfile(s?.postProcess??null),t=s},dispose(){const o=[];try{a.dispose()}catch(s){o.push(s)}try{r.dispose()}catch(s){o.push(s)}if(o.length===0&&(t=null),o.length===1)throw o[0];if(o.length>1)throw Object.assign(new Error("Playable Babylon rendering controller cleanup failed."),{cleanupErrors:Object.freeze(o)})}}}function Wm(e,t,r){const n={cleanupErrors:Object.freeze([...t]),retryCleanup:r};if(e&&(typeof e=="object"||typeof e=="function"))try{if(Object.assign(e,n),e.retryCleanup===r)return e}catch{}return Object.assign(new Error(e instanceof Error?e.message:"Playable Babylon rendering construction failed."),{cause:e,...n})}function Km(e){let t=[...e];return()=>{const r=[],n=[];for(const a of t)try{a()}catch(o){r.push(o),n.push(a)}return t=n,Object.freeze(r)}}function Jm(e){if(e.length!==0)throw e.length===1?e[0]:Object.assign(new Error("Playable Babylon rendering construction cleanup failed."),{cleanupErrors:Object.freeze([...e])})}function Bp(e={}){return{resolve(t,r){return In(t,Kt(e,r))},createEditorShadowPreview(t,r){return Oo(t,Kt(e,r))},createRuntimePlanarOptions(t,r){return No(t,Kt(e,r))},createRuntimePlanarShadowSystem(t,r,n,a){return Zm(t,r,n,Kt(e,a))}}}function In(e,t={}){const r=Xm(e,t),n=Xi(e,r);return{planarInput:r,planarOptions:n,editorShadowPreview:{planar:{...n,...t.directionalLightNodeId===void 0?{}:{directionalLightNodeId:t.directionalLightNodeId}}}}}function Xm(e,t={}){const r=t.includeProfileShadowMeshes!==!1,n=e.shadowMeshes;return{...t.enabled===void 0?{}:{enabled:t.enabled},...t.autoDetectAllCasters===void 0?{}:{autoDetectAllCasters:t.autoDetectAllCasters},additionalCasterIncludePatterns:te(...r?n.shadowCasters:[],...t.additionalCasterIncludePatterns??[]),additionalExcludePatterns:te(...r?n.excludeFromShadow:[],...t.additionalExcludePatterns??[]),additionalReceiverPatterns:te(...r?n.shadowReceivers:[],...t.additionalReceiverPatterns??[]),additionalRootBoundaryPatterns:te(...t.additionalRootBoundaryPatterns??[])}}function Oo(e,t={}){return In(e,t).editorShadowPreview}function No(e,t={}){return In(e,t).planarOptions}function Zm(e,t,r,n={}){return Hi(e,t,No(r,n))}function jo(e,t={}){const r=t.includeProfileShadowMeshes!==!1,n=e.shadowMeshes;return Ui(e,{...t,additionalCasterIncludePatterns:te(...r?n.shadowCasters:[],...t.additionalCasterIncludePatterns??[]),additionalExcludePatterns:te(...r?n.excludeFromShadow:[],...t.additionalExcludePatterns??[]),additionalRootBoundaryPatterns:te(...t.additionalRootBoundaryPatterns??[])})}function Dt(e,t={}){const r=t.includeProfileShadowMeshes!==!1,n=e.shadowMeshes;return{...Ji(e,{...t,additionalCasterIncludePatterns:te(...r?n.shadowCasters:[],...t.additionalCasterIncludePatterns??[]),additionalExcludePatterns:te(...r?n.excludeFromShadow:[],...t.additionalExcludePatterns??[]),additionalRootBoundaryPatterns:te(...t.additionalRootBoundaryPatterns??[])}),...t.artifact===void 0?{}:{artifact:t.artifact},...t.expectedHashes===void 0?{}:{expectedHashes:t.expectedHashes}}}function zp(e,t,r,n={}){const a=Dt(r,n),o=a.expectedHashes??za({scene:e,directionalLight:t,options:a});return Ki(e,a.artifact??null,{enabled:a.enabled,appearance:a.appearance,bake:{blur:a.bake?.blur},expectedHashes:o,debug:a.debug})}function Gp(e,t,r={}){return Vi(e,jo(t,r))}function Qm(e,t,r={}){const n=hr(e,t),a=t.getPanelState?.({document:e})??{},o=a.dirty??t.isDirty?.({document:e}),s=t.getLanguage?.({document:e})??"en",i=wf(r.renderingAction),d=i?.actionId==="bake-static-shadows"?ef(i,s):a.staticShadowBake??tf(n,t,o===!0,r),l=cf(t.getShadowMapExperimentConfig?.(),t.getShadowMapExperimentPlan?.(e))??a.shadowMapExperiment??null;return Fl(n.profile,{...a,...o===void 0?{}:{dirty:o},staticShadowBake:d,shadowMapExperiment:l},{language:s,textureAssets:t.getTextureAssets?.({document:e})??[]})}function ef(e,t){const r=If(e.details),n=e.label??(t==="zh"?"正在烘焙静态阴影":"Baking static shadows");return{status:"baking",chunkCount:r?.chunkCount??0,reason:e.status??n,stats:r,progress:{label:n,...typeof e.value=="number"&&Number.isFinite(e.value)?{value:Math.max(0,Math.min(1,e.value))}:{},indeterminate:e.indeterminate!==!1&&typeof e.value!="number"}}}function tf(e,t,r,n){const a=Dt(e.profile,ge(t.shadowPreview===!1?void 0:t.shadowPreview?.staticProjected,e)??{});if(!a.enabled)return{status:"disabled",chunkCount:0,reason:"Static Baked Shadow is disabled."};const o=t.getStaticShadowArtifact?.({document:e.document})??null;if(!o)return{status:"missing",chunkCount:0,reason:"No static shadow bake artifact is available."};const s=wn(o,An(e,t,a,n));return s.status==="invalid"?{status:"invalid",chunkCount:0,reason:s.reason}:s.status==="out-of-date"?{status:"out-of-date",chunkCount:s.chunkCount,reason:s.reason,generatedAt:o.generatedAt??null,stats:Ur(o)}:r?{status:"preview-unsaved",chunkCount:s.chunkCount,reason:"Static shadow preview has not been saved yet.",generatedAt:o.generatedAt??null,stats:Ur(o)}:{status:"up-to-date",chunkCount:s.chunkCount,reason:null,generatedAt:o.generatedAt??null,stats:Ur(o)}}function Ur(e){const r=e.version===2?e.pages.length:void 0;return{sourceRootCount:e.stats?.sourceRootCount??rf(e).length,sourceMeshCount:e.stats?.sourceMeshCount,attemptedChunkCount:e.stats?.attemptedChunkCount??e.chunks.length,chunkCount:e.stats?.chunkCount??e.chunks.length,textureCount:e.stats?.textureCount??r??e.chunks.length,skippedChunkCount:e.stats?.skippedChunkCount,pageCount:e.stats?.pageCount??r,resolution:e.stats?.resolution,chunkSize:e.stats?.chunkSize,atlasSize:e.stats?.atlasSize,atlasUsedPixels:e.stats?.atlasUsedPixels,atlasAllocatedPixels:e.stats?.atlasAllocatedPixels,atlasOccupancy:e.stats?.atlasOccupancy,texelsPerMeter:e.stats?.texelsPerMeter,effectiveTexelsPerMeter:e.stats?.effectiveTexelsPerMeter,maxAtlasPages:e.stats?.maxAtlasPages,sdfRadiusPx:e.stats?.sdfRadiusPx,spatialChunkSize:e.stats?.spatialChunkSize,effectiveSpatialChunkSize:e.stats?.effectiveSpatialChunkSize,targetChunkCount:e.stats?.targetChunkCount,bakedChunkCount:e.stats?.bakedChunkCount,reusedChunkCount:e.stats?.reusedChunkCount,durationMs:e.stats?.durationMs}}function rf(e){return[...new Set(e.chunks.flatMap(t=>t.sourceNodeIds))]}function nf(e,t,r){const n=t.getStaticShadowArtifact?.({document:e.document})??null,a=Dt(e.profile,ge(t.shadowPreview===!1?void 0:t.shadowPreview?.staticProjected,e)??{});return wn(n,An(e,t,a,r))}function An(e,t,r,n){if(r.expectedHashes)return r.expectedHashes;const a=vn(n.scene),o=t.shadowPreview===!1?{}:t.shadowPreview??{},s=ge(o.directionalLightNodeId,e);return a?za({scene:a,directionalLight:Ho(n.projection,s??null),options:r}):{profileHash:tl(r)}}function Lo(e,t=[]){return{texture:af(e.environment.texture,t),intensity:e.environment.iblIntensity,rotationY:e.environment.rotationY}}function af(e,t=[]){if(!e)return null;const r=typeof e.textureAssetId=="string"?e.textureAssetId.trim():"";if(r){const o=t.find(s=>s.id===r);return o&&Bo(o)?o.resource:null}const n=typeof e.url=="string"?e.url.trim():"",a=Ga({}).resolve({url:n});return a.ok&&Cn(a.resource)?a.resource:null}function of(e,t=[]){if(!e)return{status:"none",textureAssetId:null,resource:null,resolutionDiagnostic:null,asset:null,reason:"No environment texture is configured."};const r=typeof e.textureAssetId=="string"?e.textureAssetId.trim():"";if(r){const o=t.find(s=>s.id===r)??null;return o?Bo(o)?{status:"resolved-asset",textureAssetId:r,resource:o.resource,resolutionDiagnostic:null,asset:o,reason:null}:{status:"unsupported-asset",textureAssetId:r,resource:null,resolutionDiagnostic:{code:"asset.resource.format-unsupported",assetId:r,format:o.resource.format,transport:o.resource.transport,urlSummary:Ra(o.resource)},asset:o,reason:`Texture asset is not marked as an environment texture: ${r}.`}:{status:"missing-asset",textureAssetId:r,resource:null,resolutionDiagnostic:{code:"asset.resource.not-found",assetId:r,format:null,transport:null,urlSummary:null},asset:null,reason:`Environment texture asset not found: ${r}.`}}const n=typeof e.url=="string"?e.url.trim():"";if(!n)return{status:"none",textureAssetId:null,resource:null,resolutionDiagnostic:null,asset:null,reason:"No environment texture URL is configured."};const a=Ga({}).resolve({url:n});return a.ok?Cn(a.resource)?{status:"resolved-external",textureAssetId:null,resource:a.resource,resolutionDiagnostic:null,asset:null,reason:null}:{status:"format-unsupported",textureAssetId:null,resource:null,resolutionDiagnostic:{code:"asset.resource.format-unsupported",assetId:null,format:a.resource.format,transport:a.resource.transport,urlSummary:Ra(a.resource)},asset:null,reason:"Environment texture resource must use .env, .hdr, .dds, .ktx, or .ktx2."}:{status:a.diagnostic.code==="asset.resource.format-missing"?"format-missing":"format-unsupported",textureAssetId:null,resource:null,resolutionDiagnostic:a.diagnostic,asset:null,reason:a.diagnostic.code==="asset.resource.format-missing"?"Environment texture resource format is missing.":"Environment texture resource format is unsupported."}}function Bo(e){return e.capabilities?.environmentTexture===!0?!0:e.capabilities?.environmentTexture===!1?!1:e.usage==="environment"?!0:Cn(e.resource)}function Cn(e){return qm.test(e.format)}function Ra(e){return e.transport==="data-url"?"data:<redacted>":e.transport==="blob-url"?"blob:<redacted>":e.url.length<=160?e.url:`${e.url.slice(0,157)}...`}function hr(e,t){const r=t.getConfig({document:e});return{document:e,config:r,profile:Te(r)}}function zo(e,t){return Zi(e.config,t.getPostProcessResolveInput?.(e))}function Go(e,t,r={}){if(t.shadowPreview===!1)return null;const n=t.shadowPreview??{},a=ge(n.blob,e)??{},o=ge(n.staticProjected,e)??{},s=ge(n.planar,e)??{},i=ge(n.shadowMapExperiment,e),d=o.artifact===void 0?t.getStaticShadowArtifact?.({document:e.document})??null:o.artifact,l=ge(n.enabled,e),u=ge(n.directionalLightNodeId,e),c=Oo(e.profile,{...s,...l===void 0?{}:{enabled:l},...u===void 0?{}:{directionalLightNodeId:u}}),m=jo(e.profile,{...a,...l===void 0?{}:{enabled:l}}),f=Dt(e.profile,{...o,artifact:d,...l===void 0?{}:{enabled:l}}),h=An(e,t,f,r),g=sf(f.artifact??null,h);return{defaultMode:e.profile.shadows.defaultMode,blob:m,staticProjected:{...f,artifact:g,...vn(r.scene)?{expectedHashes:h}:{},...u===void 0?{}:{directionalLightNodeId:u}},planar:c.planar??null,shadowMapExperiment:i??null}}function sf(e,t){return e&&wn(e,t).status==="up-to-date"?e:null}async function lf(e,t){const r=typeof e.sectionId=="string"?e.sectionId:"";if(!Hm.has(r))return U(!1,{status:`Unsupported rendering section: ${r||"(unknown)"}`,statusTone:"warning"});const n=typeof e.path=="string"?e.path:"";if(n==="shadowMapExperiment.qualityProfile")return uf(e,t);if(n==="shadowMapExperiment.strength"||n==="shadowMapExperiment.softness")return df(e,t);const a=t.getConfig({document:e.document}),o=Il(a,{[n]:e.value});if(o.changedPaths.length===0)return U(!1,{status:`Unsupported rendering field: ${n||"(unknown)"}`,statusTone:"warning"});const s=await t.setConfig({document:e.document,config:o.config,changedPaths:o.changedPaths,profile:o.normalized,change:{path:n,value:e.value}}),i=t.isDirty?.({document:e.document});return U(!0,{dirty:i,status:`Rendering draft updated: ${o.changedPaths.join(", ")}`,statusTone:i===!1?"success":"warning",previewImpact:Uo(o.changedPaths),documentPatch:Vo(s)})}function cf(e,t){const r=xn(e),n=Fo(t);return!r&&!n?null:{configured:!!r,enabled:n?.enabled??r?.enabled??!1,qualityProfileId:n?.qualityProfileId??r?.defaultQualityProfile??null,qualityProfileIds:r?Object.keys(r.qualityProfiles).sort():[],maps:n?{...n.generator.maps}:null,filter:n?.generator.filter??null,bias:n?.generator.bias??null,normalBias:n?.generator.normalBias??null,darkness:n?.generator.darkness??null,strength:n?qr(n.generator).strength:null,softness:n?qr(n.generator).softness:null}}async function df(e,t){const r=t.getLanguage?.({document:e.document})??"en",n=e.path,a=typeof e.value=="number"?e.value:Number(e.value),o=xn(t.getShadowMapExperimentConfig?.()),i=Fo(t.getShadowMapExperimentPlan?.(e.document))?.qualityProfileId??o?.defaultQualityProfile??"",d=o?.qualityProfiles[i];if(!o||!d||!Number.isFinite(a)||a<0||a>1)return U(!1,{status:r==="zh"?"阴影外观参数无效。":"Invalid Shadow Map appearance value.",statusTone:"warning"});if(!t.setShadowMapExperimentConfig)return U(!1,{status:r==="zh"?"当前项目的阴影外观配置为只读。":"Shadow Map appearance is read-only for this project.",statusTone:"warning"});const l=qr(d),u=Qi(o,i,{strength:n==="shadowMapExperiment.strength"?a:l.strength,softness:n==="shadowMapExperiment.softness"?a:l.softness});await t.setShadowMapExperimentConfig({document:e.document,config:u,qualityProfileId:i});const c=t.isDirty?.({document:e.document});return U(!0,{dirty:c,status:r==="zh"?`阴影${n.endsWith("strength")?"强度":"柔和度"}:${a.toFixed(2)}`:`Shadow ${n.endsWith("strength")?"strength":"softness"}: ${a.toFixed(2)}`,statusTone:c===!1?"success":"warning"})}function xn(e){try{return Ba(e)}catch{return null}}function Fo(e){try{return Fa(e)}catch{return null}}function uf(e,t){const r=t.getLanguage?.({document:e.document})??"en",n=typeof e.value=="string"?e.value.trim():"",a=xn(t.getShadowMapExperimentConfig?.());if(!n||!a||!Object.prototype.hasOwnProperty.call(a.qualityProfiles,n))return U(!1,{status:r==="zh"?`未知的实时阴影质量档:${n||"(空)"}`:`Unknown Shadow Map quality profile: ${n||"(empty)"}`,statusTone:"warning"});const o=t.createShadowMapExperimentProfilesPatch?.({document:e.document,qualityProfile:n});return o?U(!0,{status:r==="zh"?`实时阴影质量档:${n}`:`Shadow Map quality profile: ${n}`,statusTone:"success",documentPatch:o}):U(!1,{status:r==="zh"?"当前项目的场景阴影质量档为只读。":"Scene Shadow Map quality profile is read-only for this project.",statusTone:"warning"})}async function mf(e,t){const r=typeof e.actionId=="string"?e.actionId:"";if(r==="bake-static-shadows")return ff(e,t);if(r==="rendering-alpha-preset.add"||r==="rendering-alpha-preset.delete"){const n=yf(r,e),a=t.getConfig({document:e.document}),o=Cl(a,n);if(o.changedPaths.length===0)return U(!1,{status:`Unsupported rendering action: ${r}`,statusTone:"warning"});const s=await t.setConfig({document:e.document,config:o.config,changedPaths:o.changedPaths,profile:o.normalized,action:n}),i=t.isDirty?.({document:e.document});return U(!0,{dirty:i,status:`Rendering draft updated: ${o.changedPaths.join(", ")}`,statusTone:i===!1?"success":"warning",previewImpact:Uo(o.changedPaths),documentPatch:Vo(s)})}return r!=="revert-rendering"?U(!1,{status:`Unsupported rendering action: ${r||"(unknown)"}`,statusTone:"warning"}):t.resetConfig?t.isDirty?.({document:e.document})===!1?U(!1,{status:"Rendering already matches saved settings.",statusTone:"default"}):(await t.resetConfig({document:e.document}),U(!0,{dirty:t.isDirty?.({document:e.document})??!1,status:"Rendering draft reverted to saved settings.",statusTone:"success"})):U(!1,{status:"Rendering reset is not available for this project.",statusTone:"warning"})}async function ff(e,t){if(!t.setStaticShadowArtifact)return U(!1,{status:"Static shadow artifact storage is not available for this project.",statusTone:"warning"});const r=vn(e.scene);if(!r)return U(!1,{status:"Static shadow bake requires the active Babylon scene.",statusTone:"warning"});const n=hr(e.document,t),a=t.shadowPreview===!1?{}:t.shadowPreview??{},o=ge(a.staticProjected,n)??{},s=ge(a.directionalLightNodeId,n),i=Dt(n.profile,{...o,...o.enabled===void 0?{}:{enabled:o.enabled}});if(!i.enabled)return U(!1,{status:"Static Baked Shadow is disabled.",statusTone:"warning"});const d=pf(e.reportProgress),l=t.getStaticShadowArtifact?.({document:e.document})??null,u=t.processStaticShadowSdfTile?null:$m();let c;try{c=await el({scene:r,directionalLight:Ho(e.projection,s??null),options:i,previousArtifact:l,readMaskTexturePixels:t.readStaticShadowMaskTexturePixels,processSdfTile:t.processStaticShadowSdfTile??u?.processSdfTile,encodeAtlasTexture:t.encodeStaticShadowAtlasTexture,yieldToMainThread:async f=>{await d?.(Ta(f,i))},onProgress:async f=>{await d?.(Ta(f,i))}}).bake()}finally{u?.dispose()}await d?.({actionId:"bake-static-shadows",label:"Writing static shadow artifact",status:"Writing static shadow artifact...",value:.98,indeterminate:!1,details:$o(c)}),await t.setStaticShadowArtifact({document:e.document,artifact:c,profile:n.profile});const m=gf(c);return U(!0,{dirty:t.isDirty?.({document:e.document}),status:`Baked ${c.chunks.length} static shadow chunk${c.chunks.length===1?"":"s"} from ${c.stats?.sourceRootCount??0} static caster${c.stats?.sourceRootCount===1?"":"s"}.`,statusTone:"success",statusDetails:m,details:hf(c)})}function pf(e){return typeof e=="function"?e:null}function Ta(e,t){const r=Math.max(0,e.totalChunkCount),n=Math.max(0,e.completedChunkCount),a=r>0?n/r:1,o=Math.max(0,e.atlasPageCount??0),s=Math.max(0,e.encodedTextureCount),i=e.phase==="collect"?.08:e.phase==="pack"?.92:e.phase==="encode"?.92+(o>0?Math.min(s/o,1)*.05:.03):e.phase==="complete"?.96:.12+a*.78,d=e.phase==="collect"?`Collecting ${e.sourceRootCount} static shadow casters...`:e.phase==="reuse"?`Reusing ${e.reusedChunkCount??0} unchanged static shadow chunks...`:e.phase==="sdf"?`Generating static shadow SDF ${Math.min(n+1,r)} of ${r}...`:e.phase==="pack"?`Packing ${e.encodedTextureCount} static shadow chunks into ${o} atlas page${o===1?"":"s"}...`:e.phase==="encode"?`Encoding static shadow atlas page ${Math.min(s+1,o||s+1)} of ${o||s+1}...`:e.phase==="complete"?`Finishing ${s} static shadow atlas page${s===1?"":"s"}...`:`Baking static shadow chunk ${Math.min(n+1,r)} of ${r}...`;return{actionId:"bake-static-shadows",label:r>0?`Static shadow bake ${Math.min(n,r)} / ${r}`:"Static shadow bake",status:d,value:i,indeterminate:r===0&&e.phase!=="complete",details:{phase:e.phase,sourceRootCount:e.sourceRootCount,sourceMeshCount:e.sourceMeshCount,attemptedChunkCount:e.totalChunkCount,chunkCount:e.completedChunkCount,textureCount:e.encodedTextureCount,pageCount:e.atlasPageCount,resolution:t.bake?.resolution,chunkSize:t.bake?.spatialChunkSize,atlasSize:t.bake?.atlasSize,texelsPerMeter:t.bake?.texelsPerMeter,effectiveTexelsPerMeter:e.effectiveTexelsPerMeter,maxAtlasPages:t.bake?.maxAtlasPages,sdfRadiusPx:t.bake?.sdfRadiusPx,spatialChunkSize:t.bake?.spatialChunkSize,effectiveSpatialChunkSize:e.effectiveSpatialChunkSize,targetChunkCount:t.bake?.targetChunkCount,bakedChunkCount:e.bakedChunkCount,reusedChunkCount:e.reusedChunkCount,...e.currentChunkId?{currentChunkId:e.currentChunkId}:{}}}}function $o(e){const r=e.version===2?e.pages.length:void 0;return{phase:"complete",sourceRootCount:e.stats?.sourceRootCount??0,sourceMeshCount:e.stats?.sourceMeshCount??0,attemptedChunkCount:e.stats?.attemptedChunkCount??e.chunks.length,chunkCount:e.stats?.chunkCount??e.chunks.length,textureCount:e.stats?.textureCount??r??e.chunks.length,skippedChunkCount:e.stats?.skippedChunkCount??0,pageCount:e.stats?.pageCount??r,resolution:e.stats?.resolution,chunkSize:e.stats?.chunkSize,atlasSize:e.stats?.atlasSize,atlasUsedPixels:e.stats?.atlasUsedPixels,atlasAllocatedPixels:e.stats?.atlasAllocatedPixels,atlasOccupancy:e.stats?.atlasOccupancy,texelsPerMeter:e.stats?.texelsPerMeter,effectiveTexelsPerMeter:e.stats?.effectiveTexelsPerMeter,maxAtlasPages:e.stats?.maxAtlasPages,sdfRadiusPx:e.stats?.sdfRadiusPx,spatialChunkSize:e.stats?.spatialChunkSize,effectiveSpatialChunkSize:e.stats?.effectiveSpatialChunkSize,targetChunkCount:e.stats?.targetChunkCount,bakedChunkCount:e.stats?.bakedChunkCount,reusedChunkCount:e.stats?.reusedChunkCount,durationMs:e.stats?.durationMs}}function hf(e){const t=bf(e.chunks.flatMap(r=>Array.isArray(r.sourceNodeIds)?r.sourceNodeIds:[]));return{...$o(e),sourceNodeIds:t}}function gf(e){const t=e.stats,r=t?.sourceRootCount??0,n=t?.sourceMeshCount??0,a=t?.chunkCount??e.chunks.length,o=t?.pageCount??(e.version===2?e.pages.length:t?.textureCount??e.chunks.length),s=t?.effectiveTexelsPerMeter,i=t?.atlasSize,d=t?.atlasOccupancy,l=t?.sdfRadiusPx,u=typeof t?.durationMs=="number"?`, ${Math.round(t.durationMs)}ms`:"",c=[`Static casters: ${r}`,`Bake meshes: ${n}`,`Chunks: ${a}`,`Atlas pages: ${o}${u}`];return typeof s=="number"&&c.push(`Effective texels/m: ${Vr(s)}`),typeof i=="number"&&c.push(`Atlas: ${i}px`),typeof d=="number"&&c.push(`Atlas occupancy: ${Vr(Math.max(0,Math.min(1,d))*100)}%`),typeof l=="number"&&c.push(`SDF radius: ${Vr(l)}px`),(typeof t?.bakedChunkCount=="number"||typeof t?.reusedChunkCount=="number")&&c.push(`Baked/reused: ${t?.bakedChunkCount??0}/${t?.reusedChunkCount??0}`),c.join(" · ")}function bf(e){const t=new Set,r=[];for(const n of e)typeof n!="string"||n.length===0||t.has(n)||(t.add(n),r.push(n));return r}function Vr(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function U(e,t){return{changed:e,...e?{previewImpact:t.previewImpact??"settled-frame"}:{},...t.dirty===void 0?{}:{dirty:t.dirty},status:t.status,statusTone:t.statusTone,...t.statusDetails?{statusDetails:t.statusDetails}:{},...t.details?{details:t.details}:{},...t.documentPatch===void 0?{}:{documentPatch:t.documentPatch}}}const Sf=new Set(["globalVolume.environment.iblIntensity","globalVolume.environment.rotationY","globalVolume.imageProcessing.exposure","globalVolume.imageProcessing.contrast","globalVolume.postProcessing.bloom.threshold","globalVolume.postProcessing.bloom.weight","globalVolume.postProcessing.bloom.kernel","globalVolume.postProcessing.bloom.scale"]);function Uo(e){return e.length>0&&e.every(t=>Sf.has(t))?"frame":"settled-frame"}function yf(e,t){const r=Ef(t.params);return{actionId:e,renderingGroupId:r.renderingGroupId??t.renderingGroupId,presetIndex:r.presetIndex??t.presetIndex}}function Vo(e){return e&&typeof e=="object"?e.documentPatch:void 0}function Ef(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function ge(e,t){return typeof e=="function"?e(t):e}function wf(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{...typeof t.actionId=="string"?{actionId:t.actionId}:{},...typeof t.label=="string"?{label:t.label}:{},...typeof t.status=="string"?{status:t.status}:{},...Pf(t.statusTone)?{statusTone:t.statusTone}:{},...typeof t.statusDetails=="string"?{statusDetails:t.statusDetails}:{},...typeof t.value=="number"&&Number.isFinite(t.value)?{value:t.value}:{},...typeof t.indeterminate=="boolean"?{indeterminate:t.indeterminate}:{},...t.details&&typeof t.details=="object"&&!Array.isArray(t.details)?{details:t.details}:{}}}function Pf(e){return e==="default"||e==="success"||e==="warning"||e==="error"}function If(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,r={};return typeof t.phase=="string"&&t.phase.trim()&&(r.phase=t.phase.trim()),ae(r,"sourceRootCount",t.sourceRootCount),ae(r,"sourceMeshCount",t.sourceMeshCount),ae(r,"attemptedChunkCount",t.attemptedChunkCount),ae(r,"chunkCount",t.chunkCount),ae(r,"textureCount",t.textureCount),ae(r,"skippedChunkCount",t.skippedChunkCount),ae(r,"pageCount",t.pageCount),ve(r,"resolution",t.resolution),ve(r,"chunkSize",t.chunkSize),ve(r,"atlasSize",t.atlasSize),ae(r,"atlasUsedPixels",t.atlasUsedPixels),ae(r,"atlasAllocatedPixels",t.atlasAllocatedPixels),Af(r,"atlasOccupancy",t.atlasOccupancy),ve(r,"texelsPerMeter",t.texelsPerMeter),ve(r,"effectiveTexelsPerMeter",t.effectiveTexelsPerMeter),ve(r,"maxAtlasPages",t.maxAtlasPages),ae(r,"sdfRadiusPx",t.sdfRadiusPx),ve(r,"spatialChunkSize",t.spatialChunkSize),ve(r,"effectiveSpatialChunkSize",t.effectiveSpatialChunkSize),ve(r,"targetChunkCount",t.targetChunkCount),ae(r,"bakedChunkCount",t.bakedChunkCount),ae(r,"reusedChunkCount",t.reusedChunkCount),ae(r,"durationMs",t.durationMs),typeof t.currentChunkId=="string"&&t.currentChunkId.trim()&&(r.currentChunkId=t.currentChunkId.trim()),Object.keys(r).length>0?r:null}function ae(e,t,r){typeof r=="number"&&Number.isFinite(r)&&r>=0&&(e[t]=r)}function ve(e,t,r){typeof r=="number"&&Number.isFinite(r)&&r>0&&(e[t]=r)}function Af(e,t,r){typeof r=="number"&&Number.isFinite(r)&&r>=0&&r<=1&&(e[t]=r)}function vn(e){return e&&typeof e=="object"&&Array.isArray(e.meshes)?e:null}function Ho(e,t){if(!t)return null;const n=e?.getProjectedNode?.(t),a=[n?.root,...Array.isArray(n?.runtimeObjects)?n.runtimeObjects:[]];for(const o of a)if(o&&typeof o=="object"&&o.getClassName?.()==="DirectionalLight")return o;return null}function Kt(e,t){const r={additionalCasterIncludePatterns:te(...e.additionalCasterIncludePatterns??[],...t?.additionalCasterIncludePatterns??[]),additionalExcludePatterns:te(...e.additionalExcludePatterns??[],...t?.additionalExcludePatterns??[]),additionalReceiverPatterns:te(...e.additionalReceiverPatterns??[],...t?.additionalReceiverPatterns??[]),additionalRootBoundaryPatterns:te(...e.additionalRootBoundaryPatterns??[],...t?.additionalRootBoundaryPatterns??[])},n=t?.enabled??e.enabled;n!==void 0&&(r.enabled=n);const a=t?.autoDetectAllCasters??e.autoDetectAllCasters;a!==void 0&&(r.autoDetectAllCasters=a);const o=t?.includeProfileShadowMeshes??e.includeProfileShadowMeshes;o!==void 0&&(r.includeProfileShadowMeshes=o);const s=t&&"directionalLightNodeId"in t?t.directionalLightNodeId:e.directionalLightNodeId;return s!==void 0&&(r.directionalLightNodeId=s),r}function te(...e){const t=new Set,r=[];for(const n of e){const a=typeof n=="string"?n.trim():"";!a||t.has(a)||(t.add(a),r.push(a))}return r}const Cf=Object.freeze({preparingEditor:"正在准备编辑器…",enterEditor:"进入编辑场景",checkingEditor:"正在检查编辑环境…",enteringEditor:"正在进入编辑界面…",restoringPlayMode:"正在恢复游戏…",retryEditor:"重试进入编辑器",reloadPage:"刷新页面恢复"});function Fp(e){const t=e.browser?.window??window,r=e.browser?.document??t.document,n=e.browser?.canvasId??"renderCanvas",a=e.initialMode??"play",o=e.initialModeIntent??"fresh",s=Object.freeze({...Cf,...e.browser?.entryContent}),i=(E,w)=>{e.reportError?e.reportError(E,w):console.error(`[FpsGameEditor] ${E}`,w)};rl({scope:t,reportError:E=>i("Browser Command Host failed",E)});const d=om({baseUrl:e.editorModule.baseUrl,...e.editorModule.manifestUrl?{manifestUrl:e.editorModule.manifestUrl}:{},importModule:e.editorModule.importModule}),l=lm({performance:t.performance}),u=new Set,c=new Set,m=new WeakMap;let f=null,h=null,g=Jt(),p=null,S=null,P=!1,I=null,D=!1,z=null,j;const J=()=>I,de=()=>{if(D)return;const E=t;E.__FPS_EDITOR_ENTRY_DIAGNOSTICS__=g},W=()=>Object.freeze({entry:I??j.getState()}),Ae=()=>{if(D)return;const E=W();for(const w of[...u])try{w(E)}catch(T){i("editor entry listener failed",T)}},De=E=>{if(E.phase==="preparing"){p=l.mark(),g=Jt({...g,enter:null}),de();return}if(!(E.phase==="editing"||E.phase==="failed"&&E.failure?.phase!=="warmup")||!p)return;const T=p;p=null,g=Jt({...g,enter:l.measure(T)}),de()},ne=E=>{const w=m.get(E);if(w)return w;const T=Promise.resolve().then(()=>E.switcher.dispose());return m.set(E,T),T.finally(()=>{m.get(E)===T&&m.delete(E)}).catch(()=>{}),T},Ce=async()=>{const E=[];for(const w of[...c])try{await ne(w),c.delete(w)}catch(T){E.push(T)}Xt(E,"Retired Local Editor entry cleanup failed.")},$e=E=>{f===E&&(f=null),c.add(E),S!==null&&t.clearTimeout(S),S=t.setTimeout(()=>{if(S=null,!(D||I)){try{j.reset()}catch(w){i("editor entry reset after play-mode return failed",w);return}j.start().catch(w=>i("editor warmup after play-mode return failed",w))}},0)},X=E=>{if(I)return Promise.reject(new Ze(I.failure?.message??s.reloadPage));if(D||E.aborted)return Promise.reject(Zt());if(f)return Promise.resolve(f);if(h)return h;const w=Ce().then(async()=>{const T=l.mark();let q;try{q=await d.load(E)}catch(be){throw vf(be)?new Ze("开发服务已更新,当前预览已失效,请刷新页面。"):be}finally{g=Jt({build:d.getManifest()?.build??null,editorModuleImportAttempt:d.getImportAttempt(),editorModuleWarmup:l.measure(T),enter:g.enter}),de()}if(I)throw new Ze(I.failure?.message??s.reloadPage);if(D||E.aborted)throw Zt();const ie={switcher:void 0,editorModeEntryAttempted:!1,playModeEntryCompleted:!1},_t=await e.editorModule.mount(q,{projectMode:{async enterEditorMode(be){ee(),ie.editorModeEntryAttempted=!0;const Je=Rf(r,n);try{await e.projectMode.enterEditorMode(be)}finally{Tf(r,Je)}},async enterPlayMode(be){ee(),await e.projectMode.enterPlayMode(be),ie.playModeEntryCompleted=!0,$e(ie)}},getCanvas:()=>qo(r,n)},E);ie.switcher=_t;const ft=J();if(ft)throw await ne(ie),new Ze(ft.failure?.message??s.reloadPage);if(D||E.aborted)throw await ne(ie),Zt();return f=ie,ie});return h=w,w.finally(()=>{h===w&&(h=null)}).catch(()=>{}),w};j=gd({backend:{warmup:E=>X(E).then(()=>{}),prepare:E=>X(E.signal),async commit(E,w){if(E!==f)throw new Error("Prepared Local Editor switcher is no longer current.");if(await E.switcher.enterEditor(),w.signal.aborted)throw Zt()},async rollback(E){const w=[];try{await ne(E),c.delete(E),f===E&&(f=null)}catch(T){w.push(T)}if(E.editorModeEntryAttempted&&!E.playModeEntryCompleted)try{await e.projectMode.enterPlayMode({reason:"editor-entry-rollback"}),E.playModeEntryCompleted=!0}catch(T){w.push(T)}Xt(w,"Local Editor entry rollback failed.")},async dispose(){const E=h;await Promise.allSettled(E?[E]:[]);const w=[];if(f){const T=f;try{await ne(T),f===T&&(f=null)}catch(q){w.push(q)}}try{await Ce()}catch(T){w.push(T)}Xt(w,"Local Editor entry cleanup failed.")}},reportFailure:({failure:E,cause:w,rollbackCause:T})=>{i(`editor entry ${E.code}`,T===void 0?w:Yo(E.message,[w,T]))},reportListenerError:E=>i("editor entry listener failed",E)});const M=j.subscribe(E=>{De(E),Ae()});de();const B=E=>{if(D||I)return;const w=xf(E),T=j.getState();I=Object.freeze({...T,phase:"failed",phaseStartedAtMs:Date.now(),failure:Object.freeze({code:"reload-required",phase:"runtime",message:w.message,recoverable:!1})}),Ae();const q=f;q&&(f=null,c.add(q),ne(q).then(()=>{c.delete(q)}).catch(ie=>i("stale local editor cleanup failed",ie)))};t.addEventListener(Gn,B);const K={start:()=>I?Promise.reject(new Ze(I.failure?.message??s.reloadPage)):j.start(),enterEditor:()=>I?Promise.resolve(ka(I)):j.enter(),retryEditorEntry:()=>I?Promise.resolve(ka(I)):j.retry(),getEntryState:W,getDiagnostics:()=>g,subscribe(E){return D?()=>{}:(u.add(E),E(W()),()=>u.delete(E))},dispose(){if(z)return z;D=!0;const E=(async()=>{t.removeEventListener("beforeunload",se),t.removeEventListener("pagehide",se),t.removeEventListener(Gn,B),r.removeEventListener("DOMContentLoaded",oe),S!==null&&(t.clearTimeout(S),S=null),ue(),M(),u.clear(),delete t.__FPS_EDITOR_ENTRY_DIAGNOSTICS__;const w=[];try{await j.dispose()}catch(T){w.push(T)}w.push(...await nl()),Xt(w,"Local Editor Entry cleanup failed.")})();return z=E,E.catch(()=>{z===E&&(z=null)}),E}},ue=e.browser?.showEntryButton===!1?()=>{}:Mf(K,t,r,e.browser?.root,s,i),oe=()=>{if(D||P)return;P=!0,r.removeEventListener("DOMContentLoaded",oe),(a==="edit"&&o==="fresh"?K.enterEditor():K.start()).catch(w=>i("local editor entry start failed",w))},se=()=>{K.dispose().catch(E=>i("local editor entry dispose failed",E))};return t.addEventListener("beforeunload",se),t.addEventListener("pagehide",se),e.browser?.autoStart!==!1&&(r.readyState==="loading"?(r.addEventListener("DOMContentLoaded",oe,{once:!0}),t.queueMicrotask(oe)):oe()),K;function ee(){if(I)throw new Ze(I.failure?.message??s.reloadPage)}}function xf(e){const t=e.detail;return t&&typeof t=="object"&&(t.code==="authentication-invalidated"||t.code==="service-instance-changed")&&typeof t.message=="string"&&t.message.trim()?Object.freeze({code:t.code,message:t.message}):Object.freeze({code:"service-instance-changed",message:"开发服务已更新,当前预览已失效,请刷新页面。"})}function ka(e){return Object.freeze({ok:!1,attempt:e.attempt,failure:e.failure})}function vf(e){const t=e instanceof Error?e.message:String(e);return/failed to fetch dynamically imported module|error loading dynamically imported module|importing a module script failed/i.test(t)}function Mf(e,t,r,n,a,o){r.getElementById("fps-game-editor-entry-surface")?.remove(),r.getElementById("fps-game-editor-entry")?.remove();const s=r.createElement("div");s.id="fps-game-editor-entry-surface";const i=r.createElement("p");i.style.cssText=["margin:0 0 14px","color:var(--fps-editor-panel-fg,#edf0f2)",'font:500 14px/1.6 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif'].join(";");const d=r.createElement("button");d.id="fps-game-editor-entry",d.type="button";const l=["position:fixed","top:14px","right:16px","z-index:2147482604","height:32px","min-width:104px","padding:0 12px","border:1px solid #aee7c2","border-radius:999px","background:#e1f8e8","color:#2f6f52",'font:800 12px system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif',"box-shadow:0 8px 20px rgba(15,23,42,.18)","white-space:nowrap","user-select:none"].join(";"),u=["position:static","height:36px","min-width:132px","padding:0 14px","border:1px solid var(--fps-editor-border-strong,#59656d)","border-radius:4px","background:var(--fps-editor-field-bg,#252b2f)","color:var(--fps-editor-panel-fg,#f4f6f7)",'font:700 13px system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif',"box-shadow:none","white-space:nowrap","user-select:none"].join(";");d.style.cssText=l,s.append(i,d);let c=Da(e.getEntryState(),a);const m=g=>{c=Da(g,a);const p=c.action==="reload";d.disabled=c.disabled,d.textContent=c.label,d.title=c.title,d.style.cssText=p?u:l,d.style.opacity=c.disabled?".72":"1",d.style.cursor=c.disabled?"default":"pointer",i.hidden=!p||n!==void 0,i.textContent=g.entry.failure?.message??a.reloadPage,s.setAttribute("role",p?"alert":"presentation"),s.style.cssText=p&&n===void 0?["position:fixed","left:50%","top:50%","transform:translate(-50%,-50%)","z-index:2147482604","width:min(420px,calc(100vw - 32px))","padding:20px","border:1px solid var(--fps-editor-danger-border,#714040)","border-radius:6px","background:var(--fps-editor-panel-bg,#171b1e)","box-shadow:0 18px 50px rgba(0,0,0,.42)"].join(";"):"",c.hidden?s.remove():s.isConnected||(n??r.body)?.append(s)},f=e.subscribe(m),h=()=>{(c.action==="enter"?e.enterEditor():c.action==="retry"?e.retryEditorEntry():c.action==="reload"?Promise.resolve(t.location.reload()):Promise.resolve()).catch(p=>o("editor entry action failed",p))};return d.addEventListener("click",h),()=>{f(),d.removeEventListener("click",h),s.remove()}}function Da(e,t){switch(e.entry.phase){case"idle":case"warming":return Me("none",!0,!1,t.preparingEditor);case"ready":return Me("enter",!1,!1,t.enterEditor);case"preparing":return Me("none",!0,!1,t.checkingEditor);case"committing":return Me("none",!0,!1,t.enteringEditor);case"rolling-back":return Me("none",!0,!1,t.restoringPlayMode);case"failed":return e.entry.failure?.recoverable?Me("retry",!1,!1,t.retryEditor,e.entry.failure.message):Me("reload",!1,!1,t.reloadPage,e.entry.failure?.message);case"editing":case"disposed":return Me("none",!0,!0,t.enterEditor)}return Me("none",!0,!0,t.enterEditor)}function Me(e,t,r,n,a=n){return Object.freeze({action:e,disabled:t,hidden:r,label:n,title:a})}function Jt(e={}){return Object.freeze({build:e.build??null,editorModuleImportAttempt:e.editorModuleImportAttempt??0,editorModuleWarmup:e.editorModuleWarmup??null,enter:e.enter??null})}function Rf(e,t){const r=qo(e,t);return r?.parentNode?{canvas:r,parent:r.parentNode,nextSibling:r.nextSibling}:null}function Tf(e,t){if(!t||t.canvas.isConnected)return;const r=t.parent.isConnected?t.parent:e.body,n=t.nextSibling?.parentNode===r?t.nextSibling:null;r.insertBefore(t.canvas,n)}function qo(e,t){const r=e.getElementById(t),n=e.defaultView?.HTMLCanvasElement;return n?r instanceof n?r:null:r?.tagName==="CANVAS"?r:null}function Yo(e,t){return Object.assign(new Error(e),{errors:[...t]})}function Xt(e,t){if(e.length===1)throw e[0];if(e.length>1)throw Yo(t,e)}function Zt(){return Object.assign(new Error("Local Editor Entry was disposed."),{name:"AbortError"})}function $p(e){We(e.initialConfig),e.shadowMapExperiment?.initialConfig&&rt(e.shadowMapExperiment.initialConfig);let t=e.shadowMapExperiment?.initialConfig?structuredClone(e.shadowMapExperiment.initialConfig):null,r=t?structuredClone(t):null,n=0,a,o=-1,s=null,i=!1,d=lc(e.initialConfig);const l=Eo(e.initialStaticShadowArtifact),u={isDirty:()=>ln(d),get:()=>d.draftConfig,markSaved(S=d.draftConfig){d=cc(d,S)},setError(S){d=dc(d,S)},clearError(){d.lastError=null}},c=S=>{const P=r,I=e.shadowMapExperiment?.compileRuntimeScene;if(!P||!I)return null;if(i&&Object.is(a,S)&&o===n)return s;const D=kf(I(S,structuredClone(P)));return a=S,o=n,s=D,i=!0,D},m=()=>{n+=1,a=void 0,o=-1,s=null,i=!1},f=()=>JSON.stringify(r)!==JSON.stringify(t),h=e.shadowMapExperiment?S=>({patch:{kind:"scene.shadow-map-experiment.profiles",...Object.prototype.hasOwnProperty.call(S,"qualityProfile")?{qualityProfile:S.qualityProfile}:{},...Object.prototype.hasOwnProperty.call(S,"behaviorProfile")?{behaviorProfile:S.behaviorProfile}:{}},label:(e.resolveLanguage?.(S.document)??"zh")==="zh"?"设置场景阴影档位":"Set scene Shadow Map profiles",reprojectIds:e.getGameObjects(S.document).map(P=>Df(P)).filter(P=>P!==null)}):void 0,g=Do({getConfig:u.get,setConfig(S){We(S.config);const P=Te(d.draftConfig);d=Hn(d,S.config);const I=_o(S,P,{getAlphaIndexMigrationGameObjects:e.getGameObjects,createAlphaIndexMigrationPatch:e.createAlphaIndexMigrationPatch});return I?{documentPatch:I}:void 0},resetConfig(){d=qn(d)},isDirty:()=>u.isDirty()||l.isDirty()||f(),getPanelState:()=>d,getTextureAssets:()=>e.getTextureAssets?.()??[],getLanguage:({document:S})=>e.resolveLanguage?.(S)??"zh",getStaticShadowArtifact:l.get,setStaticShadowArtifact:({artifact:S})=>{l.set(S)},shadowPreview:{directionalLightNodeId:e.directionalLightNodeId??"sun_light",enabled:({document:S})=>e.isDirectionalLightEnabled?.(S)??!0,shadowMapExperiment:({document:S})=>c(S)},getShadowMapExperimentConfig:()=>r?structuredClone(r):null,setShadowMapExperimentConfig:({config:S})=>{rt(S),r=structuredClone(S),m()},getShadowMapExperimentPlan:c,createShadowMapExperimentProfilesPatch:h}),p={get:()=>r?structuredClone(r):null,isDirty:f,set(S){rt(S),r=structuredClone(S),m()},replace(S){S&&rt(S),t=S?structuredClone(S):null,r=S?structuredClone(S):null,m()},markSaved(S=r){S&&rt(S),t=S?structuredClone(S):null,r=S?structuredClone(S):null,m()},reset(){r=t?structuredClone(t):null,m()}};return{capability:g,profileDraft:u,staticShadowDraft:{isDirty:l.isDirty,get:l.get,markSaved:l.markSaved,setError:u.setError,clearError:u.clearError},shadowMapExperimentConfigSnapshot:p,shadowMapExperimentDraft:p,getShadowMapExperimentConfig:p.get,getShadowMapExperimentPlan:c,getProfile:()=>Te(d.draftConfig),getState:()=>d,setConfig(S){We(S),d=Hn(d,S)},reset(){d=qn(d),l.reset(),p.reset()},isDirty:()=>u.isDirty()||l.isDirty()||p.isDirty()}}function kf(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.plugins;if(!Array.isArray(t))return null;const r=t.find(n=>n&&typeof n=="object"&&!Array.isArray(n)&&n.pluginId===al);return!r||typeof r!="object"||Array.isArray(r)?null:Fa(r.data)}function Df(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.id;return typeof t=="string"&&t.trim()?t:null}export{Hp as CAMERA_LANGUAGE_OPTIONS,Si as DEFAULT_EDITOR_SCENE_ARTIST_MATERIAL_ASSET_ID,qp as DEFAULT_EDITOR_SCENE_CAMERA,Yp as DEFAULT_EDITOR_SCENE_CREATED_MATERIAL_NAME,Wp as DEFAULT_EDITOR_SCENE_CREATED_MATERIAL_PROFILE,Kp as DEFAULT_EDITOR_SCENE_ENVIRONMENT_LIGHT,Jp as DEFAULT_EDITOR_SCENE_SUN_LIGHT,Xp as DEFAULT_PBR_EDITOR_SCENE_MATERIAL_ASSET,Zp as DEFAULT_PBR_EDITOR_SCENE_MATERIAL_ASSET_GUID,Qp as DEFAULT_PBR_EDITOR_SCENE_MATERIAL_ASSET_ID,eh as DEFAULT_READONLY_EDITOR_SCENE_MATERIAL_ASSET_IDS,th as DEFAULT_SHADOW_MAP_EXPERIMENT_SOFTNESS,rh as DEFAULT_STANDARD_EDITOR_SCENE_MATERIAL_ASSET,nh as DEFAULT_STANDARD_EDITOR_SCENE_MATERIAL_ASSET_GUID,ah as DEFAULT_STANDARD_EDITOR_SCENE_MATERIAL_ASSET_ID,oh as EDITOR_SCENE_BUILTIN_MATERIAL_SHADER_DEFINITIONS,Zs as EDITOR_SCENE_BUILTIN_MATERIAL_SHADER_DEFINITION_REGISTRY,sh as EDITOR_SCENE_DEFAULT_BLOB_SHADOW_EXCLUDE_PATTERNS,ih as EDITOR_SCENE_DEFAULT_DIRECTIONAL_LIGHT_DIRECTION,lh as EDITOR_SCENE_DEFAULT_PLANAR_SHADOW_EXCLUDE_PATTERNS,ch as EDITOR_SCENE_DEFAULT_PLANAR_SHADOW_RECEIVER_PATTERNS,dh as EDITOR_SCENE_DEFAULT_RENDERING_GROUPS,uh as EDITOR_SCENE_DEFAULT_STATIC_PROJECTED_SHADOW_EXCLUDE_PATTERNS,mh as EDITOR_SCENE_DUPLICATE_MATERIAL_ASSET_VALUE_PREFIX,fh as EDITOR_SCENE_ENVIRONMENT_LIGHT_ID,ph as EDITOR_SCENE_FIELD_SCHEMA,hh as EDITOR_SCENE_LARGE_SELECTION_LIGHTWEIGHT_INSPECTOR_THRESHOLD,eo as EDITOR_SCENE_LIGHTING_DEBUG_LANGUAGE_STORAGE_KEY,bc as EDITOR_SCENE_LIGHTING_DEBUG_NUMBER_FIELDS,Qa as EDITOR_SCENE_LIGHTING_DEBUG_STORAGE_KEY,Yn as EDITOR_SCENE_LIGHTING_DEBUG_TEXT,Wn as EDITOR_SCENE_LIGHTING_DEBUG_TOOLTIPS,gh as EDITOR_SCENE_LIGHT_DIRECTION_ELEVATION_ANGLE_PATH,cs as EDITOR_SCENE_LIGHT_DIRECTION_ELEVATION_MAX_DEG,ds as EDITOR_SCENE_LIGHT_DIRECTION_ELEVATION_MIN_DEG,bh as EDITOR_SCENE_LIGHT_DIRECTION_HORIZONTAL_ANGLE_PATH,Sh as EDITOR_SCENE_LIGHT_DIRECTION_HORIZONTAL_MAX_DEG,yh as EDITOR_SCENE_LIGHT_DIRECTION_HORIZONTAL_MIN_DEG,Eh as EDITOR_SCENE_LIGHT_INSPECTOR_LANGUAGE_OPTIONS,wh as EDITOR_SCENE_MAIN_CAMERA_ID,Ph as EDITOR_SCENE_MATERIAL_ASSET_FIELD_PATH_PREFIX,Ih as EDITOR_SCENE_MATERIAL_ASSET_ID_PREFIX,Ah as EDITOR_SCENE_PREFAB_COMPOSITION_VERSION,Ch as EDITOR_SCENE_PREFAB_DEFAULT_MODEL_NODE_ID,xh as EDITOR_SCENE_PREFAB_DEFAULT_ROOT_NODE_ID,vh as EDITOR_SCENE_RENDERING_GROUP_IDS,Ya as EDITOR_SCENE_RENDERING_PROFILE_ALLOWED_PATCH_PATHS,Mh as EDITOR_SCENE_ROOT_ID,Rh as EDITOR_SCENE_ROOT_TRANSFORM,Th as EDITOR_SCENE_RUNTIME_COLOR_SLOTS,kh as EDITOR_SCENE_RUNTIME_INTENSITY_SLOTS,Dh as EDITOR_SCENE_RUNTIME_METALLIC_ROUGHNESS_SLOTS,_h as EDITOR_SCENE_RUNTIME_TEXTURE_SLOTS,Oh as EDITOR_SCENE_SCHEMA_VERSION,Nh as EDITOR_SCENE_SHADOW_INSPECTOR_LANGUAGE_OPTIONS,jh as EDITOR_SCENE_SHADOW_INSPECTOR_LANGUAGE_PATH,ns as EDITOR_SCENE_SOURCE_ID,_n as EDITOR_SCENE_SOURCE_TYPE,Lh as EDITOR_SCENE_STATIC_SHADOWS_COMPANION_CONFIG_KEY,Pi as EDITOR_SCENE_STATIC_SHADOW_ARTIFACT_VERSION,Bh as EDITOR_SCENE_STATIC_SHADOW_BAKE_ACTION_ID,zh as EDITOR_SCENE_STATIC_SHADOW_BAKE_ACTION_PATH,Gh as EDITOR_SCENE_SUN_LIGHT_ID,Fh as EDITOR_SHADOW_DEFAULT_QUALITY,Lf as EDITOR_SHADOW_OBJECT_ADVANCED_PARAMS_ENABLED,$h as EDITOR_SHADOW_QUALITY_PRESETS,jf as EDITOR_SHADOW_STATIC_AUTHORING_ENABLED,Uh as FPS_GAME_EDITOR_GROUND_DECAL_FEATURE_ID,Vh as FPS_GAME_EDITOR_GROUND_DECAL_PLUGIN_ID,Hh as FPS_GAME_EDITOR_GROUND_DECAL_PLUGIN_PACKAGE,su as FPS_GAME_EDITOR_RELOAD_STATE_PATH,mu as FPS_GAME_EDITOR_RUNTIME_DEBUG_AUTHORING_PATH,Bi as FPS_SHADOW_MAP_EXPERIMENT_CONFIG_SCHEMA_VERSION,qh as FPS_SHADOW_MAP_EXPERIMENT_PLAN_SCHEMA_VERSION,Yh as FPS_SHADOW_MAP_EXPERIMENT_PLAN_SCHEMA_VERSION_V2,al as FPS_SHADOW_MAP_EXPERIMENT_PLUGIN_ID,Wh as FPS_SHADOW_MAP_EXPERIMENT_SCHEMA_VERSION,Kh as MATERIAL_LANGUAGE_OPTIONS,jn as PLAYABLE_AUTHORING_API_BASE,Jh as PLAYABLE_BABYLON_DEFAULT_OUTLINE_OVERRIDE,Xf as PLAYABLE_EDITOR_ASSET_CATALOG_KINDS,bp as PLAYABLE_EDITOR_BUNDLED_ALIAS_PACKAGE_IDS,He as PLAYABLE_EDITOR_COMMAND_NAME,Vc as PLAYABLE_EDITOR_DEFAULT_EXTENSIONS,em as PLAYABLE_EDITOR_ENTRY_IMMUTABLE_CACHE_CONTROL,Qu as PLAYABLE_EDITOR_ENTRY_MANIFEST_CACHE_CONTROL,Zu as PLAYABLE_EDITOR_ENTRY_MANIFEST_PATH,Co as PLAYABLE_EDITOR_ENTRY_MANIFEST_SCHEMA_VERSION,Uc as PLAYABLE_EDITOR_ENVIRONMENT_TEXTURE_EXTENSIONS,pe as PLAYABLE_EDITOR_EVENT_NAME,ao as PLAYABLE_EDITOR_IMAGE_EXTENSIONS,cn as PLAYABLE_EDITOR_MODEL_EXTENSIONS,gp as PLAYABLE_EDITOR_PACKAGE_IDS,Rt as PLAYABLE_EDITOR_PACKAGE_RESOLUTION_CONTRACT,pp as PLAYABLE_EDITOR_POST_MESSAGE,Sp as PLAYABLE_EDITOR_PREBUNDLE_PACKAGE_IDS,Xh as PLAYABLE_EDITOR_SCENE_COMPILER_ID,Zh as PLAYABLE_EDITOR_SCENE_COMPILER_VERSION,Qh as PLAYABLE_EDITOR_SCENE_OUTLINE_DEFAULT_DISABLED_REASON,un as PLAYABLE_EDITOR_SOUND_EXTENSIONS,dn as PLAYABLE_EDITOR_TEXTURE_EXTENSIONS,eg as PLAYABLE_FORGE_PLAY_BRIDGE_SOURCE,pt as PLAYABLE_FORGE_PLAY_COMMAND,tg as PLAYABLE_FORGE_PLAY_COMMAND_ALIASES,ke as PLAYABLE_FORGE_PLAY_EVENT,rg as PLAYABLE_FORGE_PLAY_EVENT_ALIASES,ng as PLAYABLE_FORGE_PLAY_HISTORY_COMMANDS,ag as PLAYABLE_FORGE_PLAY_POST_MESSAGE,og as PLAYABLE_FORGE_PLAY_PROJECT_ASSET_COMMANDS,sg as PLAYABLE_GROUND_DECAL_TEXTURE_TINT,ig as PLAYABLE_LOCAL_EDITOR_HOST_MANIFEST_VERSION,lg as PLAYABLE_LOCAL_EDITOR_HOST_REQUIRED_CONTRACT,cg as PLAYABLE_LOCAL_EDITOR_SAVE_CANCELLATION_CODE,Ze as PlayableEditorEntryReloadRequiredError,Ye as PlayableEditorManagedAssetError,dg as SCENE_MAIN_SOURCE_RENDERING_COMPANION_CONFIG_KEY,ug as SCENE_MAIN_SOURCE_STATIC_SHADOWS_COMPANION_CONFIG_KEY,mg as SPATIAL_MARKER_GRAPH_SCHEMA_VERSION,fg as addAssetLibraryItemToEditorSceneDocument,pg as addEditorSceneLightingPreviewColors,hg as addEditorSceneMaterialAsset,gg as addEditorSceneMaterialAssetAndBind,bg as addEditorSceneMaterialAssetAndBindPrefabOverride,Sg as addEditorScenePrefabAsset,yg as addVec3,Eg as appendEditorSceneReadonlyInspectorProperty,wg as appendEditorSceneRuntimeColorProperties,Pg as appendEditorSceneRuntimeInspectorProperty,Ig as appendEditorSceneRuntimeTextureProperties,Ag as appendEditorSceneRuntimeVector3Properties,Cg as applyArtistMaterialProfileToRuntimeMaterial,St as applyBabylonDefaultOutline,ym as applyBabylonRenderingToMesh,kp as applyBabylonRenderingToNodeTree,xg as applyEditorSceneDocumentMutationPatch,vg as applyEditorSceneJsonFieldPatch,Cl as applyEditorSceneRenderingProfileAction,Il as applyEditorSceneRenderingProfilePatch,Mg as applyEditorSceneSerializedPropertyPatch,Rg as applyMaterialValueToRuntimeMaterial,Tg as applyMaterialValueToRuntimeNode,Op as applyOutlineValueToRuntimeNode,Rp as applyPlayableBabylonOutlineOverrideToRuntimeNode,fm as applyPlayableBabylonOutlineOverrideToRuntimeTarget,kg as areMarkerGraphsEqual,Dg as assertEditorSceneDocumentAssetCatalogCompleteness,_g as assertEditorSceneMarkerConfigContract,Og as assertEditorSceneMaterialAssetIntegrity,Ng as assertEditorScenePrefabMarkerNodeContract,We as assertEditorSceneRenderingProfileContract,Ii as assertEditorSceneStaticShadowArtifactContract,jg as assertEditorSceneTransformComponentContract,Lg as assertEditorShadowMapExperimentObjectOverride,Bg as assertEditorShadowMapExperimentSettings,zg as assertEditorShadowResolvedPlanContract,Gg as assertEditorShadowSettingsContract,Fg as assertPlayableEditorRuntimeSceneConfig,$g as assertPlayableEditorSceneDocumentContract,Ug as assertPlayableEditorScenePersistedSourceContract,rt as assertShadowMapExperimentConfig,Vg as bindDefaultEditorSceneSlotMaterial,Qr as buildPlayableEditorManagedAssetArgs,Hg as bumpEditorSceneAuthoringSourceRevision,qg as callEditorSceneRuntimeMethod,Yg as canEditEditorSceneShadowSettings,Wg as canEditorSceneGameObjectHaveChildren,Kg as canPatchPlayableEditorSceneGroundDecalMultiField,Jg as canPatchPlayableGroundDecalLayerField,Qt as canSaveEditorSceneLightingDebugSnapshot,Xg as canonicalizePlayableJsonNumbers,Zg as clampEditorSceneLightingPreview01,Qg as clampEditorSceneLightingPreviewNumber,eb as clampEditorSceneMaterialPreview01,tb as cleanupEditorSceneGameObjectOverrides,rb as cleanupEditorScenePrefabDefaultShadow,nb as cloneBuiltInMarkerTypeDefinition,ab as cloneEditorSceneDocument,ze as cloneEditorSceneLightingDebugSnapshot,ob as cloneEditorTransformMatrix,sb as cloneEditorTransformSnapshot,ib as cloneMarker,lb as cloneMarkerGraphCommand,cb as cloneMarkerTypeDefinition,db as cloneRelation,ub as cloneVec3,mb as collectBabylonMaterialOwnerCandidates,ci as collectEditorSceneChildMaterialSlots,fb as collectEditorSceneGameObjectSubtreeIds,xs as collectEditorSceneMaterialAssetBindingIds,Na as collectEditorSceneMaterialAssetReferences,pb as collectEditorSceneMaterialAssetUsages,qi as collectEditorSceneRenderingAlphaIndexMigrationTargetIds,hb as collectEditorSceneRuntimeChildNodes,gb as collectEditorSceneRuntimeMeshes,bb as collectEditorSceneSlotSourceMaterialIndices,Sb as collectEditorSceneSubtreeIdList,yb as collectEditorSceneSubtreeIds,Eb as collectEditorShadowReceiverCandidates,Pp as collectMissingPlayableEditorPackageAliasFiles,Em as collectRenderableBabylonMeshes,Fi as colorFromEditorSceneLightingHex,Gi as colorToEditorSceneLightingHex,wb as combineEditorTransforms,Pb as compareEditorSceneAssetLibraryItems,Ib as compileEditorSceneDocumentToSceneConfig,Ap as compilePlayableGroundDecalRuntimeConfig,Ab as composeEditorTransformMatrix,xp as consumeFpsGameEditorFreshReload,Cb as containPlayableGroundDecalImageRect,xb as createArtistMaterialAssetInspectorProperties,vb as createArtistMaterialBindingSummary,Mb as createArtistMaterialInspectorSections,Rb as createAuthoredMarkerTypeDefinition,Tb as createBabylonAssetContainerProjectionImporter,Yi as createBabylonDefaultPostProcessPipelineController,Wi as createBabylonEnvironmentTextureController,kb as createBabylonImageNode,Db as createBabylonPrimitiveProjectionInstancingController,Vi as createBlobShadowSystem,_b as createBoundsCenter,Ob as createCameraInspectorProperties,Nb as createChildMaterialBindingInspectorProperties,jb as createChildMaterialBindingSummary,Lb as createDefaultEditorSceneCameraGameObject,Bb as createDefaultEditorSceneEnvironmentLightGameObject,zb as createDefaultEditorSceneSunLightGameObject,Gf as createDefaultEditorSceneTransformPatchFromRuntimePatch,Gb as createDefaultMarkerScaleForKind,Fb as createDefaultPbrEditorSceneMaterialAsset,$b as createDefaultStandardEditorSceneMaterialAsset,Dp as createDynamicShadowSystem,Ub as createEditorSceneAssetFromLibraryItem,Vb as createEditorSceneAssetHydrationCatalog,Hb as createEditorSceneAssetLibrary,qb as createEditorSceneAssetLibraryItem,Yb as createEditorSceneAssetPlacementPatch,Wb as createEditorSceneAuthoringSourceDescriptor,Ui as createEditorSceneBlobShadowPreviewSettings,Kb as createEditorSceneCameraInspectorSection,Jb as createEditorSceneCommonInspectorProperties,Xb as createEditorSceneCommonInspectorSection,Zb as createEditorSceneComponentsInspectorProperties,Qb as createEditorSceneComponentsInspectorSection,eS as createEditorSceneComponentsInspectorSummary,tS as createEditorSceneCreateGroupPatch,rS as createEditorSceneCreatePrimitivePatch,nS as createEditorSceneCreatedMaterialAsset,aS as createEditorSceneDeleteSubtreePatch,ms as createEditorSceneDirectionalLightDirectionFromAngles,oS as createEditorSceneDirectionalLightDirectionFromTransformRotation,sS as createEditorSceneDirectionalLightShadowSummaryInspectorSection,iS as createEditorSceneDocumentInspectorProperty,lS as createEditorSceneDocumentInspectorSections,cS as createEditorSceneDuplicateMaterialAssetForBindingPatch,dS as createEditorSceneDuplicateMaterialAssetValue,uS as createEditorSceneDuplicateSelectionPatch,mS as createEditorSceneDuplicatedMaterialAsset,Ln as createEditorSceneDuplicatedMaterialAssetCopy,Gs as createEditorSceneDuplicatedPrefabDefinition,fS as createEditorSceneFieldInspectorValidator,pS as createEditorSceneGameObjectFieldPatch,hS as createEditorSceneGameObjectGuid,gS as createEditorSceneGameObjectsFieldPatch,bS as createEditorSceneGroupSelectionPatch,SS as createEditorSceneHierarchyMovePatch,yS as createEditorSceneHierarchySourceInspectorProperties,ES as createEditorSceneHierarchySourceInspectorSection,wS as createEditorSceneHierarchySourceInspectorSummary,PS as createEditorSceneIdentityTransformComponent,IS as createEditorSceneInspectorActionProperty,AS as createEditorSceneLightInspectorProperties,CS as createEditorSceneLightInspectorSections,xS as createEditorSceneMarkerConfig,vS as createEditorSceneMarkerGameObjectDocument,MS as createEditorSceneMarkerGeometry,RS as createEditorSceneMarkerGraphPatchLabel,Cs as createEditorSceneMaterialActionPatch,TS as createEditorSceneMaterialAssetFieldInspectorPropertyInput,kS as createEditorSceneMaterialAssetFromShaderDefinition,DS as createEditorSceneMaterialAssetGuid,_S as createEditorSceneMaterialAssetId,OS as createEditorSceneMaterialAssetInspectorObject,NS as createEditorSceneMaterialAssetMeta,jS as createEditorSceneMaterialAssetOwnershipView,LS as createEditorSceneMaterialAssetPreview,BS as createEditorSceneMaterialAssetSelectionId,zS as createEditorSceneMaterialBindingSummary,GS as createEditorSceneMaterialBrowserAssetItems,FS as createEditorSceneMaterialPickerControlOptions,$S as createEditorSceneMaterialShaderDefinitionRegistry,US as createEditorSceneMetadataInspectorProperties,VS as createEditorSceneMetadataInspectorSection,HS as createEditorSceneMetadataInspectorSummary,qS as createEditorSceneModelGameObjectForAsset,YS as createEditorScenePlacementWorldTransform,Xi as createEditorScenePlanarShadowPreviewSettings,yi as createEditorScenePlayableFieldInspectorExtraValidator,ks as createEditorScenePrefabActionPatch,WS as createEditorScenePrefabAgentSummary,KS as createEditorScenePrefabBrowserAssetItems,$s as createEditorScenePrefabDefinitionFromAsset,Fs as createEditorScenePrefabDefinitionFromGameObject,JS as createEditorScenePrefabGameObjectForAsset,XS as createEditorScenePrefabGroupNode,Us as createEditorScenePrefabGuid,ZS as createEditorScenePrefabInstanceGameObject,QS as createEditorScenePrefabInstanceScopedNodeId,ey as createEditorScenePrefabMarkerNode,ty as createEditorScenePrefabMaterialOverrideInspectorSection,ry as createEditorScenePrefabNodeFromAsset,ny as createEditorScenePrefabPrimitiveNode,ay as createEditorScenePrefabSourceStructureInspectorSection,oy as createEditorScenePrefabStageCompositionProjectionNodes,sy as createEditorScenePrefabStageContextLightProjectionNodes,iy as createEditorScenePrefabStageInspectorObject,ly as createEditorScenePrefabStageMaterialSlotGroup,cy as createEditorScenePrefabStageMaterialSlotItems,dy as createEditorScenePrefabStageModelProjectionNode,uy as createEditorScenePrefabStageNodeFallbackLabel,my as createEditorScenePrefabStageNodeTransform,fy as createEditorScenePrefabStageNodeTreeItem,py as createEditorScenePrefabStageProjectionKind,hy as createEditorScenePrefabStageProjectionNodeFromCompositionNode,gy as createEditorScenePrefabStageProjectionNodeId,by as createEditorScenePrefabStageRuntimeGroups,Sy as createEditorScenePrefabStageRuntimeLeaf,yy as createEditorScenePrefabStageRuntimeNodeTree,Ey as createEditorScenePrefabStageSourceItem,wy as createEditorScenePrefabStageStableId,Py as createEditorScenePrimitiveInspectorProperties,Iy as createEditorScenePrimitiveInspectorSection,Ay as createEditorSceneReadonlyDocumentInspectorProperty,Cy as createEditorSceneReadonlyInspectorProperty,xy as createEditorSceneReadonlyInspectorSection,vy as createEditorSceneReadonlyVector3Properties,My as createEditorSceneRenamePatch,Ry as createEditorSceneRendererInspectorProperties,Ty as createEditorSceneRendererInspectorSection,ky as createEditorSceneRendererInspectorSummary,Dy as createEditorSceneRenderingInspectorSection,Fl as createEditorSceneRenderingPanelState,lc as createEditorSceneRenderingProfileDraftState,_y as createEditorSceneReparentPatch,Oy as createEditorSceneRootTransformComponent,Ny as createEditorSceneRuntimeAnimationSkeletonSection,jy as createEditorSceneRuntimeBindingSection,Ly as createEditorSceneRuntimeCollisionsSection,By as createEditorSceneRuntimeGeometryBoxSection,zy as createEditorSceneRuntimeInspectorSection,Gy as createEditorSceneRuntimeInspectorSections,Fy as createEditorSceneRuntimeInspectorSectionsForDocument,$y as createEditorSceneRuntimeInspectorSnapshot,Uy as createEditorSceneRuntimeIntensityPropertiesSection,Vy as createEditorSceneRuntimeMaterialColorsSection,Hy as createEditorSceneRuntimeMaterialSection,qy as createEditorSceneRuntimeMaterialTexturesSection,Yy as createEditorSceneRuntimeMetallicRoughnessSection,Wy as createEditorSceneRuntimePhysicsSection,Ky as createEditorSceneRuntimePreviewImageImportPlan,Jy as createEditorSceneRuntimePreviewImportPlan,Xy as createEditorSceneRuntimePreviewMainCameraRig,Zy as createEditorSceneRuntimePreviewMissingAssetUrlDiagnostic,Qy as createEditorSceneRuntimePreviewModelImportPlan,eE as createEditorSceneRuntimePreviewNode,tE as createEditorSceneRuntimePreviewNodes,rE as createEditorSceneRuntimeRawMiscSection,nE as createEditorSceneRuntimeRenderingSection,aE as createEditorSceneRuntimeShadowsSection,oE as createEditorSceneSerializedMultiInspectorObject,sE as createEditorSceneSerializedMultiInspectorSections,iE as createEditorSceneSerializedMultiObject,lE as createEditorSceneSerializedMultiTransformPatch,cE as createEditorSceneSerializedObject,dE as createEditorSceneSerializedPropertyDescriptors,uE as createEditorSceneShadowCastOptions,mE as createEditorSceneShadowLightOptions,fE as createEditorSceneShadowPolicyOptions,pE as createEditorSceneShadowQualityOptions,hE as createEditorSceneShadowReceiveOptions,zs as createEditorSceneSourceAssetFromActionInput,gE as createEditorSceneStandardPrefabAssetFieldServices,Ji as createEditorSceneStaticProjectedShadowPreviewSettings,wn as createEditorSceneStaticShadowArtifactDiagnostic,Eo as createEditorSceneStaticShadowArtifactDraftStore,bE as createEditorSceneStaticShadowBakeActionProperty,SE as createEditorSceneTextureAssetPreview,yE as createEditorSceneTexturePickerControlOptions,EE as createEditorSceneTransformBatchPatch,wE as createEditorSceneTransformFromSerializedPath,PE as createEditorSceneTransformInspectorProperties,IE as createEditorSceneTransformInspectorSection,AE as createEditorSceneTransformInspectorSummary,CE as createEditorSceneTransformPatch,wl as createEditorSceneTransformPatchFromRuntimePatch,xE as createEditorSceneTransformRotationFromDirectionalLightDirection,vE as createEditorTransformMatrixSnapshot,ME as createFpsGameEditorAdapter,RE as createFpsGameEditorConfiguredGroundDecalSceneFeature,TE as createFpsGameEditorDeclarativeGroundDecalSceneFeature,kE as createFpsGameEditorGroundDecalSceneFeature,DE as createFpsGameEditorLocalEditorHost,_E as createFpsGameEditorLocalEditorHostManifest,dp as createFpsGameEditorManagedAssetServices,OE as createFpsGameEditorPlayableProjectHostAssembly,NE as createFpsGameEditorProductHostAssembly,ap as createFpsGameEditorProductProjectHostServices,jE as createFpsGameEditorProductProjectionPreview,$p as createFpsGameEditorProductRenderingRuntime,LE as createFpsGameEditorProductSceneHostOptions,mp as createFpsGameEditorRuntimeDebugAuthoringClient,up as createFpsGameEditorSceneSourceServices,sp as createFpsGameEditorStandardAssetActionPatch,BE as createFpsGameEditorStandardProjectRuntime,zE as createFpsGameEditorStandardSceneAssembly,GE as createIdentityEditorTransform,FE as createImportedEditorSceneMaterialAsset,$E as createMarkerGameObjectFromSpatialMarker,UE as createMarkerSemanticFrameFromTransform,VE as createMarkerType,HE as createMaterialAlphaModeOptions,qE as createMaterialAssetPickerControlOptions,YE as createMaterialAssetSelectorInspectorProperty,WE as createMaterialLightingModelOptions,KE as createMaterialSlotOwnerPathMatchKey,JE as createObjectBoundSemanticFrame,Hi as createPlanarShadowSystem,Ga as createPlayableAssetResourceResolver,np as createPlayableAuthoringClient,Za as createPlayableAuthoringEmptyResponse,H as createPlayableAuthoringJsonResponse,jo as createPlayableBabylonBlobShadowOptions,Gp as createPlayableBabylonBlobShadowSystem,XE as createPlayableBabylonEditorGrid,Lo as createPlayableBabylonEnvironmentTextureProfile,ZE as createPlayableBabylonOutlineInspectorSection,QE as createPlayableBabylonOutlineInspectorSeedPatchValue,No as createPlayableBabylonPlanarShadowOptions,Bp as createPlayableBabylonPlanarShadowPolicy,Xm as createPlayableBabylonPlanarShadowPolicyInput,Oo as createPlayableBabylonPlanarShadowPreviewOptions,Zm as createPlayableBabylonPlanarShadowSystem,_o as createPlayableBabylonRenderingAlphaIndexMigrationPatch,Do as createPlayableBabylonRenderingCapability,Np as createPlayableBabylonRenderingCapabilityFacade,jp as createPlayableBabylonRenderingDiagnostics,Qm as createPlayableBabylonRenderingPanelState,Lp as createPlayableBabylonRuntimeRenderingControllers,zp as createPlayableBabylonStaticProjectedShadowArtifactSystem,Dt as createPlayableBabylonStaticProjectedShadowOptions,Ym as createPlayableBabylonWorldRendering,Ou as createPlayableBridgeCommandAssetAdapter,_u as createPlayableBridgeEventPayload,Hc as createPlayableEditorAssetGuid,qc as createPlayableEditorAssetId,wp as createPlayableEditorBundledPackageAliasPlan,Ep as createPlayableEditorBundledPackageRoots,ew as createPlayableEditorDoctorReport,gd as createPlayableEditorEntryController,tm as createPlayableEditorEntryManifest,om as createPlayableEditorEntryModuleLoader,nm as createPlayableEditorEntryModuleUrl,lm as createPlayableEditorEntryPerformanceTracker,Qd as createPlayableEditorManagedAssetFacade,Ud as createPlayableEditorManagedAssetGuid,Vd as createPlayableEditorManagedAssetId,Hf as createPlayableEditorManagedRuntimeAssetInstance,en as createPlayableEditorManagedSceneAsset,kc as createPlayableEditorRuntimeAssetInstanceNode,tw as createPlayableEditorSceneFieldMutationOptions,rw as createPlayableEditorSceneHierarchyFacade,nw as createPlayableEditorSceneInspectorMultiObject,aw as createPlayableEditorSceneInspectorObject,ow as createPlayableEditorSceneInspectorPropertyPatch,sw as createPlayableEditorSceneInspectorSections,iw as createPlayableEditorSceneMarkerGraphFacade,lw as createPlayableEditorSceneMarkerInspectorSection,cw as createPlayableEditorSceneObjectCommandFacade,dw as createPlayableEditorSceneOutlineInspectorSection,uw as createPlayableEditorSceneSessionFacade,zu as createPlayableEditorSourcePackageAliasPlan,yp as createPlayableEditorSourceTsconfigPathsPlan,mw as createPlayableForgePlaySaveState,fw as createPlayableGroundDecalDocumentBridge,pw as createPlayableGroundDecalDocumentServices,hw as createPlayableGroundDecalInspectorProperties,gw as createPlayableGroundDecalInspectorSection,bw as createPlayableGroundDecalInspectorServices,Sw as createPlayableGroundDecalLayerLabel,yw as createPlayableGroundDecalMultiInspectorSection,Ew as createPlayableLocalEditorHost,ww as createPlayableLocalEditorLoadingOverlay,rp as createPlayablePlatformAssetDropCache,Xc as createPlayablePlatformAssetRegistrationPayload,od as createPlayablePlatformAssetRegistrationTransportPlan,hp as createPlayableProjectAssetBridgeAdapter,cd as createPlayableProjectAssetCommandHandler,Pw as createPrefabInstanceInspectorSection,Iw as createPrefabMaterialBindingPresentationImpact,Aw as createPrefabStageEditableProperty,Cw as createPrefabStageShadowDefaultProperties,xw as createPrefabStageShadowResolvedDefaultProperties,vw as createReadonlyMaterialSlotListInspectorProperties,Di as createRuntimeSceneCompiledArtifact,Po as createSceneMainSourceDriver,Mw as createSceneMainSourceSaveCompanionConfigPayload,Rw as createSceneMaterialBindingPresentationImpact,Tw as createSceneObjectMarkerTargetRef,kw as createShadowMapExperimentActivityScheduler,Ba as createShadowMapExperimentConfigSnapshot,Dw as createShadowMapExperimentDepthRefreshScheduler,_w as createShadowMapExperimentInfluenceCullingState,Ow as createShadowMapExperimentPlanFingerprint,Fa as createShadowMapExperimentPlanSnapshot,Qi as createShadowMapExperimentQualityProfileAppearanceSnapshot,Nw as createShadowMapExperimentRegistry,jw as createSpatialMarkerFromGameObject,Lw as createSpatialMarkerGeometryForPresentation,Bw as createSpatialMarkerGeometryForTargetPatch,zw as createSpatialMarkerGeometryFromGameObject,Gw as createSpatialMarkersFromGameObjects,Fw as createStableEditorSceneMaterialAssetGuid,Ki as createStaticProjectedShadowArtifactSystem,za as createStaticProjectedShadowBakeHashes,tl as createStaticProjectedShadowProfileHash,$w as createTexturePickerControlOptions,Uw as createUniqueEditorSceneGameObjectDisplayName,Vw as createUniqueEditorSceneGameObjectId,Hw as createUniqueEditorSceneId,qw as createUniqueEditorSceneMaterialAssetId,Bn as createUniqueEditorScenePrefabAssetId,Yw as createUniqueMarkerGameObjectId,Tc as createUniquePlayableEditorRuntimeAssetNodeId,Ww as createVec3,Kw as defineFpsGameEditorFeature,Jw as defineFpsGameEditorProject,lp as definePlayableEditorAssetDatabaseConfig,Xw as degreesToEditorSceneRadians,Is as dehydrateEditorSceneDocumentAssets,Zw as deleteDefaultEditorSceneMaterialAsset,Qw as deleteEditorSceneMarkerGameObject,eP as deleteEditorSceneMaterialAsset,tP as deleteEditorScenePrefabNode,rP as deleteMarkerType,nP as describeEditorSceneRuntimeObject,aP as detectEditorSceneDirectionalLightOrientationDrift,zf as detectEditorSceneRuntimeInputDrift,oP as diffShadowMapExperimentPlans,sP as editorSceneGuidToStableToken,iP as encodeEditorScenePrefabInstanceIdentitySegment,As as enrichEditorSceneDocumentAssets,lP as ensureDefaultEditorSceneMaterialAssets,cP as ensureEditorSceneAuthoringSource,fs as ensureEditorSceneGameObjectGuids,dP as ensureEditorScenePrefabComposition,uP as ensureImportedEditorSceneMaterialDefaults,mP as ensurePlayableEditorSceneEnvironmentDefaultsCore,mo as executePlayableAssetTransportPlan,fP as findEditorSceneGameObject,pP as findEditorSceneImageRenderer,hP as findEditorSceneInspectorTextureAsset,gP as findEditorSceneInspectorTextureAssetFromContext,Ne as findEditorSceneLightingDebugNumberFieldConfig,bP as findEditorSceneLightingPreviewLightObject,re as findEditorSceneMaterialAsset,SP as findEditorSceneModelRenderer,Ls as findEditorScenePrefabAsset,yP as findEditorScenePrefabNode,EP as findEditorScenePrefabStageInspectorItem,wP as findEditorScenePrefabStageStructureItem,_c as findEditorSceneRuntimeLightTarget,PP as findEditorSceneTransform,Vf as findPlayableEditorRuntimeSceneAssetUsageByAssetId,IP as fitPlayableGroundDecalTextureSizeToAspect,AP as flattenEditorScenePrefabStageStructureItems,CP as formatEditorSceneBoundsSummary,Oe as formatEditorSceneLightingNumber,Ec as formatEditorSceneLightingShadowMode,xP as formatEditorSceneMaterialPreviewNumber,vP as formatEditorSceneMaterialSlotLabel,MP as formatEditorScenePrefabStageMaterialSlotSummary,RP as formatPlayableEditorDoctorReport,Ip as formatPlayableEditorPackageAliasPlanError,TP as formatPlayableLocalEditorHostCompatibilityReport,kP as getArtistMaterialInspectorText,DP as getBuiltInMarkerType,_P as getCameraInspectorText,OP as getDefaultEditorSceneMaterialPreset,_a as getEditorSceneAuthoringSourceRef,NP as getEditorSceneGameObjectWorldTransform,jP as getEditorSceneGameObjectWorldTrsTransform,LP as getEditorSceneHierarchyItems,BP as getEditorSceneLightInspectorLanguage,zP as getEditorSceneLightInspectorText,GP as getEditorSceneMarkerGraphPatchSelection,FP as getEditorSceneMarkerTypeCatalogFromGraph,$P as getEditorSceneMaterialAssetDefaultPreset,UP as getEditorSceneMaterialAssetDisplayMeta,VP as getEditorSceneMaterialAssetDisplayName,mi as getEditorSceneMaterialShaderDefinition,HP as getEditorSceneMaterialSlotPrimaryOwnerPath,qP as getEditorScenePrefabStageDescriptor,YP as getEditorScenePrefabStageProjectionNodeIdForNode,WP as getEditorScenePrefabStageProjectionNodes,KP as getEditorScenePrefabStageStructure,JP as getEditorSceneRelationTypeCatalog,XP as getEditorSceneShadowInspectorText,ZP as getEditorSceneSlotMaterialBinding,QP as getEditorSceneSlotMaterialBindingPath,eI as getEditorSceneSlotSelectionKey,tI as getEditorSceneSlotSourceMaterialName,rI as getEditorSceneSlotSourceMaterialProfile,nI as getNextEditorSceneAssetPlacementPosition,aI as getPlayableAssetFormat,oI as getPlayableAssetResourceTransport,tp as getPlayableEditorAssetKindExtensions,sI as getPlayableForgePlayHistoryResultEventName,iI as getTopLevelSceneGraphNodeIds,lI as groundDecalFeature,oo as guidToPlayableEditorAssetStableToken,cp as guidToPlayableEditorManagedAssetStableToken,Ff as handleEditorSceneRenderingProfileAuthoringRequest,fp as handlePlayableAuthoringServerRequest,cI as hasDetectedModelMaterialSlots,dI as hasEditorSceneAncestorDescendantPair,uI as hasEditorSceneCamera,mI as hasEditorSceneDescendants,fI as hasEditorSceneMaterialAsset,Bs as hasEditorScenePrefabForSourceAsset,pI as hasEditorScenePrefabStageRuntimeStructure,hI as hasInvalidEditorSceneCameraRelationships,gI as hasReadonlyEditorSceneMaterialSlotReimportIssues,bI as hslToEditorSceneMaterialPreviewRgb,SI as inspectPlayableEditorHostCompatibilityReport,yI as inspectPlayableLocalEditorHostManifest,vp as installFpsGameEditorFreshReloadMonitor,EI as installPlayableForgePlayModeBridge,Sm as isBabylonRuntimeDropSurfaceMesh,wI as isBlockedPlayableEditorSceneSystemFieldPatch,PI as isBuiltInMarkerType,Ci as isCompiledArtifactForSource,II as isDefaultEditorSceneMaterialAsset,Ts as isDefaultReadonlyEditorSceneMaterialAsset,AI as isDeletedRelationEndpoint,CI as isEditorProjectFilePreviewable,xI as isEditorProjectMediaPreviewable,vI as isEditorSceneArtistMaterialPatchPath,ai as isEditorSceneAssetPlaceable,MI as isEditorSceneCameraGameObject,RI as isEditorSceneCameraProjection,TI as isEditorSceneColor,kI as isEditorSceneDuplicateMaterialAssetPickerValue,DI as isEditorSceneFiniteNumber,_I as isEditorSceneGroupLikeGameObject,OI as isEditorSceneLightDirectionAnglePath,hs as isEditorSceneLightGameObject,NI as isEditorSceneLightType,jI as isEditorSceneMarkerGameObject,LI as isEditorSceneMarkerGraphCommandSupported,BI as isEditorSceneMaterialAssetReadonlyForInspector,zI as isEditorSceneMaterialBindingNullableStringPath,GI as isEditorSceneMaterialBindingPath,FI as isEditorSceneMaterialColorRgb,$I as isEditorSceneMaterialColorRgba,UI as isEditorSceneMatrixTransformComponent,VI as isEditorSceneNonNegativeFiniteNumber,HI as isEditorSceneOptionalBoolean,qI as isEditorSceneOptionalNonEmptyString,YI as isEditorSceneOptionalString,WI as isEditorScenePositiveFiniteNumber,KI as isEditorScenePositiveSize,JI as isEditorScenePrefabAsset,XI as isEditorScenePrefabCoreMaterialOverridePath,ZI as isEditorScenePrefabDefaultShadowPath,QI as isEditorScenePrefabInstance,Os as isEditorScenePrefabMaterialAssetIdOverridePath,eA as isEditorScenePrefabOverridePath,tA as isEditorSceneProtectedSystemGameObject,rA as isEditorSceneProtectedSystemGameObjectId,ln as isEditorSceneRenderingProfileDraftDirty,Al as isEditorSceneRenderingProfilePatchPath,nA as isEditorSceneRootGameObject,aA as isEditorSceneRootGameObjectId,oA as isEditorSceneRootTransformPath,sA as isEditorSceneRuntimeMeshLike,iA as isEditorSceneScale,lA as isEditorSceneSelectableHierarchyId,cA as isEditorSceneShadowCastMode,dA as isEditorSceneShadowLightMode,uA as isEditorSceneShadowPolicyMode,mA as isEditorSceneShadowQuality,fA as isEditorSceneShadowReceiveMode,pA as isEditorSceneStringArray,hA as isEditorSceneTextureAsset,gA as isEditorSceneTransformLike,bA as isEditorSceneTrsTransformComponent,SA as isEditorSceneUnitRangeNumber,yA as isEditorSceneVec2,EA as isEditorSceneVec3,wA as isEditorShadowCastMode,PA as isEditorShadowLightMode,IA as isEditorShadowMode,AA as isEditorShadowQuality,CA as isEditorShadowReceiveMode,xA as isEditorTransformMatrixSnapshot,vA as isEditorTransformTrsSnapshot,MA as isMarkerEndpoint,RA as isMarkerTypeDefinitionValid,TA as isMaterialOwnerResolutionPointerVerified,kA as isMaterialSlotOwnerPathMatch,DA as isObjectMarkerKind,_A as isPlayableAssetFormatSupported,OA as isPlayableBabylonOutlineInspectorPatchPath,Bo as isPlayableBabylonRenderingEnvironmentTextureAsset,Cn as isPlayableBabylonRenderingEnvironmentTextureResource,NA as isPlayableEditorSceneGroundDecalProjectionPath,jA as isPlayableGroundDecalEditableColorLayer,LA as isPlayableGroundDecalEditableTextLayer,BA as isPlayableGroundDecalEditableTextureLayer,zA as isPlayableGroundDecalInspectorPatchPath,GA as isPlayableGroundDecalLayerColorAlphaPath,FA as isPlayableGroundDecalLayerColorPath,$A as isPlayableGroundDecalLayerProgressPreviewPercentPath,UA as isPlayableGroundDecalLayerRectPath,VA as isPlayableGroundDecalLayerRotationPath,HA as isPlayableGroundDecalLayerTextColorAlphaPath,qA as isPlayableGroundDecalLayerTextColorPath,YA as isPlayableGroundDecalLayerTextFontSizePath,WA as isPlayableGroundDecalLayerTextValuePath,KA as isPlayableGroundDecalLayerTexturePath,JA as isPlayableGroundDecalLayerTextureTintAlphaPath,XA as isPlayableGroundDecalLayerTextureTintPath,ZA as isPlayableGroundDecalLayoutEditableLayer,QA as isPlayableGroundDecalLayoutPatchCompatibleWithDecal,eC as isPlayableGroundDecalProjectEditableLayer,tC as isPlayableGroundDecalRenderingTextureDimensionPath,rC as isPlayableGroundDecalRotationEditableLayer,nC as isPlayableGroundDecalSerializedMultiFieldPath,aC as isPlayableLocalEditorSaveCancellation,oC as isReadonlyEditorSceneMaterialAsset,sC as isRegionMarkerKind,iC as isRelationEndpointValid,lC as isTargetRefValid,cC as isValidEditorAffineTransformMatrix,dC as isVec3ApproximatelyEqual,uC as isVec3Like,Ti as loadEditorAssetLibrary,Mi as loadEditorProjectFile,Ri as loadEditorProjectFiles,sm as loadPlayableEditorEntryManifest,La as loadSceneMainSource,mC as markEditorSceneInspectorPropertiesEffect,cc as markEditorSceneRenderingProfileDraftSaved,ya as markFpsGameEditorFreshReload,gu as matchPlayableAuthoringRoute,fC as mergeEditorSceneAssetWithLibraryItem,pC as mergeEditorSceneCameraDefaults,hC as mergeEditorSceneImportedMaterialProfile,gC as mergeEditorSceneLightDefaults,bC as mergeEditorSceneMaterialBindingOverrides,SC as mergeEditorScenePrefabOverrides,yC as mergeEditorShadowSettings,EC as mergeMarkerTypeDefinition,wC as mergePlayableEditorDoctorReports,PC as mergePlayableGroundDecalDefaults,IC as migrateEditorSceneDocumentRenderingAlphaIndex,AC as migrateEditorSceneGameObjectsRenderingAlphaIndex,CC as migrateEditorSceneMarkerGraphMarkersToGameObjects,xC as migrateEditorSceneMaterialAssetShader,Cp as migrateLegacyShadowMapExperimentAuthoring,vC as mixEditorSceneLightingPreviewColor,Bm as mountEditorRuntimeDebugPanelShell,_p as mountEditorRuntimeLightingDebugPanel,Fp as mountFpsGameEditorLocalEditorEntry,MC as mountFpsGameEditorProductLocalEditor,RC as mountFpsGameEditorProductLocalEditorFromEnvironmentModule,TC as mountFpsGameEditorStandardLocalEditorFromEnvironmentModule,kC as mountFpsGameEditorStandardProject,DC as normalizeBabylonDefaultPostProcessProfile,_C as normalizeBabylonDefaultPostProcessVolumeStack,OC as normalizeBabylonEnvironmentTextureProfile,bm as normalizeBabylonPointerCoordinates,xi as normalizeCompiledArtifacts,NC as normalizeEditorSceneCameraAfterFieldPatch,jC as normalizeEditorSceneCameraGameObject,LC as normalizeEditorSceneFieldInspectorValue,BC as normalizeEditorSceneGameObjectDisplayName,zC as normalizeEditorSceneHierarchyDocument,GC as normalizeEditorSceneLightDirectionAngleValue,ps as normalizeEditorSceneLightDirectionVector,FC as normalizeEditorSceneLightingAngleDegrees,$C as normalizeEditorSceneLightingPreviewVec3,UC as normalizeEditorSceneMarkerGameObject,VC as normalizeEditorSceneMarkerGameObjects,HC as normalizeEditorSceneMarkerGraph,qC as normalizeEditorSceneMarkerGraphCommand,YC as normalizeEditorSceneMarkerPresentation,Rs as normalizeEditorSceneMaterialAssetValue,WC as normalizeEditorSceneMaterialPreviewHue,KC as normalizeEditorSceneMaterialSlotOwnerPath,JC as normalizeEditorScenePlainTransformGameObject,hi as normalizeEditorScenePlayableInspectorValue,XC as normalizeEditorScenePrefabAssetComposition,_s as normalizeEditorScenePrefabAssetFieldValue,ZC as normalizeEditorScenePrefabIdentifierPart,QC as normalizeEditorScenePrefabStageOwnerNodePath,js as normalizeEditorScenePrimitiveShape,as as normalizeEditorSceneRenderingAlphaIndexPresets,ls as normalizeEditorSceneRenderingGroupsProfile,Te as normalizeEditorSceneRenderingProfile,ex as normalizeEditorSceneRootGameObject,tx as normalizeEditorSceneRootTransformDocument,Cc as normalizeEditorSceneRuntimeLightBinding,rx as normalizeEditorSceneRuntimePreviewProjectUrlPath,nx as normalizeEditorSceneSystemLightGameObject,ax as normalizeMarkerBoxSize,ox as normalizeMarkerNodeKind,sx as normalizeMaterialSlotOwnerPath,ep as normalizePlayableEditorAssetCodeKey,Qf as normalizePlayableEditorAssetDisplayName,Yc as normalizePlayableEditorAssetKind,ix as normalizePlayableEditorSceneGroundDecalGameObject,ws as normalizePlayableForgePlayCommandName,Zn as normalizePlayableFsPath,lx as normalizePlayableGroundDecalAlphaValue,cx as normalizePlayableGroundDecalColorValue,dx as normalizePlayableGroundDecalFontSizeValue,ux as normalizePlayableGroundDecalInspectorFieldValue,mx as normalizePlayableGroundDecalLayoutLayerPatch,fx as normalizePlayableGroundDecalLayoutPatchValue,px as normalizePlayableGroundDecalLayoutRect,hx as normalizePlayableGroundDecalProgressPreviewPercentValue,Li as normalizePlayableGroundDecalRotationDegrees,gx as normalizePlayableGroundDecalTextureDimension,bx as normalizePlayableGroundDecalUiScaleAfterFieldPatch,Sx as normalizePlayableGroundDecalUiScales,yx as normalizePlayableGroundDecalUiScalesForCommand,nd as normalizePlayablePlatformAssetPayload,Ns as parseEditorSceneDuplicateMaterialAssetValue,xr as parseEditorSceneLightingDebugNumberDraft,Ex as parseEditorSceneMaterialAssetFieldPath,wx as parseEditorSceneMaterialAssetSelectionId,rm as parsePlayableEditorEntryManifest,Px as parsePlayableGroundDecalLayerPatchPath,Ix as patchEditorSceneDirectionalLightOrientationAngles,Ax as patchEditorSceneGameObjectByField,gs as patchEditorSceneGameObjectField,Cx as patchEditorSceneGameObjectFieldsMany,xx as patchEditorSceneGameObjectMaterialBinding,vx as patchEditorSceneGameObjectTransform,Mx as patchEditorSceneGameObjectsField,Rx as patchEditorSceneMaterialAsset,Tx as patchEditorSceneMaterialAssetField,kx as patchEditorScenePrefabAsset,Dx as patchEditorScenePrefabAssetField,_x as patchEditorScenePrefabOverride,Yf as patchEditorSceneRuntimeLights,Ox as patchMarkerGameObjectFromSpatialMarker,Nx as patchMarkerGameObjectTransformComponents,jx as patchPlayableEditorSceneDirectionalLightAngleField,Lx as patchPlayableEditorSceneGameObjectFieldWithServices,Bx as patchPlayableEditorSceneGameObjectsFieldWithServices,zx as patchPlayableEditorSceneGroundDecalInspectorField,Gx as patchPlayableEditorSceneGroundDecalKind,Fx as patchPlayableEditorSceneGroundDecalLayout,$x as patchPlayableEditorSceneGroundDecalRenderingDimension,Ux as patchPlayableGroundDecalLayer,qd as planPlayableEditorAssetRegistrationCore,Yd as planPlayableEditorAssetUnregistrationCore,Vx as playableGroundDecalColorsEqual,Hx as playableGroundDecalRectsEqual,gn as postPlayableAuthoringJson,Ps as postPlayableForgePlayEvent,qx as pruneEditorSceneArtistMaterialProfile,Yx as radiansToEditorSceneDegrees,Wx as readArtistMaterialInspectorLanguage,Kx as readArtistMaterialTexturePickerValue,Jx as readBabylonGltfPointers,gm as readBabylonRuntimeDropPosition,Xx as readBoolean,Y as readClampedNumber,Zx as readCompiledRuntimeSceneArtifact,Qx as readEditorProjectFileContent,ev as readEditorProjectFileSnapshot,tv as readEditorSceneAssetMaterialSlots,Hr as readEditorSceneDirectionalLightAngles,Nn as readEditorSceneDirectionalLightAnglesExact,rv as readEditorSceneDirectionalLightOrientation,nv as readEditorSceneGameObjectAlphaIndex,av as readEditorSceneGameObjectLocalTransform,ov as readEditorSceneGameObjectRenderingGroupId,sv as readEditorSceneInspectorColor,iv as readEditorSceneInspectorShadowSettings,lv as readEditorSceneInspectorVec3,cv as readEditorSceneLightType,Jn as readEditorSceneLightingDebugColorSnapshotField,ht as readEditorSceneLightingDebugNumberSnapshotField,Sc as readEditorSceneLightingDebugText,yc as readEditorSceneLightingDebugTooltipText,dv as readEditorSceneLightingPreviewColor,uv as readEditorSceneLightingPreviewDirectionalLight,mv as readEditorSceneLightingPreviewFiniteNumber,fv as readEditorSceneLightingPreviewHemisphericLight,us as readEditorSceneLightingProjectedLengthMultiplier,pv as readEditorSceneMaterialBindingConfig,hv as readEditorSceneMaterialSlotBindingSlotId,Ei as readEditorSceneMaterialSlotDescriptor,Oa as readEditorSceneNodeKind,gv as readEditorScenePhysicsParam,bv as readEditorScenePrefabMaterialOverrideBinding,Sv as readEditorScenePrefabNodeChildren,yv as readEditorScenePrefabNodes,Ev as readEditorScenePrefabOverrideMaterialPath,ui as readEditorScenePrefabRootNodeId,wv as readEditorScenePrefabStageMaterialSlot,Pv as readEditorSceneRuntimeArrayLength,Iv as readEditorSceneRuntimeArrayLengthFromMethod,Av as readEditorSceneRuntimeBoolean,Cv as readEditorSceneRuntimeBounds,xv as readEditorSceneRuntimeClassName,vv as readEditorSceneRuntimeIsEnabled,$f as readEditorSceneRuntimeLightBinding,Mv as readEditorSceneRuntimeNumber,Rv as readEditorSceneRuntimePreviewAssetId,Tv as readEditorSceneRuntimePreviewAssetKind,kv as readEditorSceneRuntimePreviewAssetMetadata,Dv as readEditorSceneRuntimeProjectionAssetId,_v as readEditorSceneRuntimeProjectionAssetMetadata,Ov as readEditorSceneRuntimeString,Nv as readEditorSceneRuntimeValue,jv as readEditorSceneShadowInspectorLanguage,wi as readEditorSceneStaticShadowArtifact,Lv as readEditorSceneTextureUrl,Bv as readEditorSceneTransformVector,Qo as readEditorShadowResolvedMode,es as readEditorShadowResolvedQuality,ol as readEditorShadowRuntimePlan,zv as readEditorShadowSettings,rs as readEditorShadowSettingsResult,Gv as readEditorTransformPosition,Le as readFiniteNumber,op as readFpsGameEditorPlatformAssetLookup,Fv as readMarkerConfigTarget,$v as readMarkerGameObjectScale,Uv as readMarkerTypeDefinition,Vv as readMarkerTypeOverrides,tr as readNonEmptyString,le as readNonNegativeNumber,Hv as readPlaneHeightMode,Mu as readPlayableAssetImportInput,Io as readPlayableAssetRegistrationPlanInput,ad as readPlayableAssetRegistrationResultRecord,vu as readPlayableAssetUnregistrationPlanInput,yu as readPlayableAuthoringPayloadPathFromCommand,Mt as readPlayableBridgeRequestId,Hd as readPlayableEditorManagedAssetScale,qv as readPlayableForgePlayHistoryOperationOptions,xt as readPlayableForgePlayRequestId,Yv as readPlayableGroundDecalFiniteNumber,Wv as readPlayableGroundDecalPositiveFiniteNumber,hn as readPlayablePlatformAssetDropPoint,Ke as readPlayablePlatformAssetExternal,fn as readPlayablePlatformAssetKind,lo as readPlayablePlatformAssetName,mr as readPlayablePlatformAssetPath,Jc as readPlayablePlatformAssetPlacement,Fe as readPlayablePlatformAssetRecord,io as readPlayablePlatformAssetRecords,It as readPlayablePlatformAssetUrl,pn as readPlayablePlatformRawAssetId,Ru as readPlayableSceneNodeCreateInput,Tu as readPlayableSceneNodePatchInput,pa as readPlayableSceneNodeRemoveInput,Ue as readPositiveNumber,Kv as readRawEditorSceneGameObjectLocalTransform,ce as readRecord,Jv as readRenderingGroupId,is as readResolvedShadowMode,Xv as readRgb,Xe as readRgba,ss as readSamples,Zv as readSceneMainSourceRenderingConfig,ki as readSceneMainSourceSaveCompanionConfigs,Qv as readSceneMainSourceStaticShadowsArtifact,eM as readSpatialMarkerTransformPosition,tM as readSpatialMarkerTransformRotation,rM as readSpatialMarkerTransformScale,Ic as readStoredEditorSceneLightingDebugLanguage,wc as readStoredEditorSceneLightingDebugOpen,yr as readStringList,nM as readStringOrNull,os as readToneMappingType,aM as readVec3,oM as rebaseEditorScenePrefabMarkerConfig,sM as rebaseEditorScenePrefabMarkerTarget,iM as reconcileEditorSceneMaterialSlotReimportBindings,lM as reconcileImportedEditorSceneMaterialTextureRefs,cM as reduceEditorSceneDocumentMutation,dM as reduceEditorSceneMarkerGameObjectCommand,uM as reduceEditorSceneMarkerGraph,mM as reducePlayableEditorSceneDocumentCore,ip as registerFpsGameEditorStandardAuthoringCommands,uo as registerPlayablePlatformAsset,id as registerPlayablePlatformAssetIfNeeded,Ea as reloadFpsGameEditorBrowsingContext,qf as removePlayableEditorManagedRuntimeAssetInstance,fM as renameEditorScenePrefabAsset,pM as renameEditorScenePrefabNode,hM as reparentEditorScenePrefabNode,gM as replaceEditorSceneMaterialAsset,bM as replaceEditorScenePrefabAsset,SM as replacePlayableEditorSceneGroundDecalUi,qn as resetEditorSceneRenderingProfileDraft,Zi as resolveBabylonDefaultPostProcessVolumeStack,Tp as resolveBabylonRuntimeDropPosition,vs as resolveDefaultEditorSceneMaterialAssetDeleteState,yM as resolveEditorProjectFileExtension,EM as resolveEditorProjectFileLanguage,vi as resolveEditorProjectMediaSource,wM as resolveEditorProjectMediaSupport,no as resolveEditorSceneArtistMaterialBinding,Wf as resolveEditorSceneArtistMaterialRuntimePreview,Kf as resolveEditorSceneArtistMaterialSlotProfiles,PM as resolveEditorSceneAssetLibraryItemRelativePath,IM as resolveEditorSceneFieldSchema,AM as resolveEditorSceneGameObjectRendering,CM as resolveEditorSceneGameObjectRuntimeEntityIds,xM as resolveEditorSceneGameObjectShadowSettings,vM as resolveEditorSceneLightingPreviewProfile,MM as resolveEditorSceneMaterialAssetDeleteState,RM as resolveEditorSceneMaterialAssetIntegrity,TM as resolveEditorSceneMaterialRuntimeKind,kM as resolveEditorSceneMaterialSlotReimportDiff,di as resolveEditorScenePrefabInstanceEffectiveOverrides,DM as resolveEditorScenePrefabInstanceMarkers,_M as resolveEditorScenePrefabInstanceRelation,OM as resolveEditorScenePrefabSourceAssetId,NM as resolveEditorScenePrefabStageMarkers,jM as resolveEditorScenePrefabStageMaterialDropTarget,LM as resolveEditorScenePrefabStageMaterialOverrideTarget,BM as resolveEditorScenePrefabStagePreviewTarget,zM as resolveEditorSceneProjectedMaterialRuntimeKind,xl as resolveEditorSceneRenderingAlphaIndexPresetValueMigration,GM as resolveEditorSceneRootContainerId,FM as resolveEditorSceneRuntimePreviewAssetUrl,$M as resolveEditorSceneRuntimePreviewAssetUrlCandidate,ts as resolveEditorShadowParams,UM as resolveEditorShadowPlan,sl as resolveEditorShadowRuntimeParamsUsage,Bf as resolveEditorShadowRuntimeState,VM as resolveEditorTransformPreserveWorldPolicy,HM as resolveFpsGameEditorFeatureSceneContribution,qM as resolveFpsGameEditorStaticProject,YM as resolveMarkerGeometryKindForPresentation,WM as resolveMarkerNodeKindForType,KM as resolveMaterialOwner,JM as resolveMaterialOwnerNode,XM as resolveMaterialRuntimeKind,ZM as resolveMaterialSlotOwnerNodes,Mp as resolveOutlineOwnerNode,vo as resolveOutlineTarget,In as resolvePlayableBabylonPlanarShadowPolicy,of as resolvePlayableBabylonRenderingEnvironmentTextureDiagnostic,af as resolvePlayableBabylonRenderingEnvironmentTextureResource,So as resolvePlayableEditorAssetIdentity,QM as resolvePlayableGroundDecalImageRect,eR as resolvePlayableGroundDecalMultiInspectorTargetIds,ji as resolvePlayableGroundDecalRenderTextureSize,tR as resolvePlayableGroundDecalUiInspectorScale,rR as resolvePlayableGroundDecalUniformScaleFromVec3,co as resolvePlayablePlatformAssetRegistrationResult,qr as resolveShadowMapExperimentAppearance,nR as resolveShadowMapExperimentPlan,aR as rewriteMarkerRelationEndpoint,oR as rewriteMarkerRelationIds,sR as rewriteMarkerTargetRef,iR as rewriteSpatialMarkerGeometryTargetRefs,lR as rewriteSpatialMarkerTargetRefs,cR as rgbToEditorSceneMaterialPreviewHsl,dR as rotateVec3ByEuler,uR as roundEditorSceneInspectorNumber,zi as roundEditorSceneLightingNumber,mR as roundPlayableGroundDecalFieldValue,ar as runPlayableAuthoringCommand,fR as sanitizeEditorSceneGameObjectId,pR as sanitizeEditorSceneId,hR as sanitizeEditorSceneMaterialAssetIdPart,jc as sanitizeEditorSceneRuntimeDirectionalLight,Nc as sanitizeEditorSceneRuntimeHemisphericLight,Oc as sanitizeEditorSceneRuntimeLightingPatch,gR as sanitizeMarkerGameObjectId,la as sanitizePlayableEditorManagedAssetName,ja as saveSceneMainSource,bR as scaleEditorSceneLightingPreviewColor,SR as selectEditorScenePrefabNode,Ft as serializeEditorSceneStaticShadowArtifact,mc as serializePlayableAuthoringFileContent,yR as setEditorScenePrefabNodeMarker,ER as setEditorScenePrefabNodeShadow,wR as setEditorScenePrefabNodeShadowMapExperiment,PR as setEditorScenePrefabNodeTransform,Hn as setEditorSceneRenderingProfileDraftConfig,dc as setEditorSceneRenderingProfileDraftError,IR as shadowMapExperimentDarknessFromStrength,AR as shadowMapExperimentDepthLayerForUpdateClass,CR as shadowMapExperimentStrengthFromDarkness,xR as shallowEditorSceneGameObjectsEqual,vR as shouldApplyMarkerDefaultScaleForKind,MR as shouldApplyMarkerDefaultScaleOnPresentationChange,RR as shouldPreserveTransformForMarkerGeometry,TR as splitEditorSceneFieldPath,kR as splitMaterialSlotBindingFieldPath,Zc as stripKnownPlayableAssetExtension,mn as stripKnownPlayableEditorAssetExtension,DR as sumEditorSceneRuntimeMeshNumbers,On as summarizeEditorSceneRenderingProfile,_R as summarizeSaveResult,OR as syncEditorSceneDirectionalLightOrientationAfterTransformPatch,NR as syncEditorSceneDirectionalLightTransformRotationAfterDirectionPatch,jR as syncEditorSceneMarkerGraph,LR as syncEditorSceneMarkerGraphDocument,BR as syncEditorScenePrefabRootNodeFields,zR as toEditorLocalTransformFromWorld,GR as toEditorSceneInspectorLabel,FR as toEditorSceneInspectorSafeValue,$R as toEditorSceneLocalTransformForParent,UR as toEditorSceneLocalTransformFromWorld,VR as toEditorSceneLocalTrsTransformForParent,HR as toEditorScenePreserveWorldLocalTransformForParent,Uf as toEditorSceneRuntimeLightingPatches,qR as toEditorSceneTransformComponent,YR as toEditorSceneTransformSnapshot,Du as toPlayableBridgeCommandError,Zf as toPlayableEditorAssetImportName,WR as toneMapEditorSceneLightingPreviewColor,KR as toneMapEditorSceneLightingPreviewNumber,JR as transformEditorSceneMaterialPreviewBaseColor,XR as tryCreateEditorSceneTransformComponent,ZR as tryCreateEditorSceneTransformSnapshot,vc as updateEditorSceneLightingDebugSnapshotColorField,Rc as updateEditorSceneLightingDebugSnapshotDirection,Mc as updateEditorSceneLightingDebugSnapshotEnabled,Xn as updateEditorSceneLightingDebugSnapshotFromAngles,xc as updateEditorSceneLightingDebugSnapshotNumberField,QR as updateEditorSceneMarkerGameObject,eT as updateMarkerType,tT as validateAndNormalizeEditorSceneMaterialAssetField,gi as validateEditorSceneFieldInspectorValue,rT as validateEditorSceneGroupSelection,nT as validateEditorSceneHierarchyMove,Ms as validateEditorSceneMaterialAssetFieldValue,Jf as validateEditorSceneMaterialGlslColorBindings,Ds as validateEditorScenePrefabAssetFieldValue,aT as validateEditorSceneReparent,oT as validatePlayableEditorRuntimeSceneConfig,sT as validatePlayableGroundDecalInspectorField,Ai as validateSceneMainDocument,iT as waitForPlayableLocalEditorPaint,lT as waitForPlayableMilliseconds,cT as withEditorSceneMarkerGraph,dT as writeMarkerTypeOverrides,nr as writePlayableAuthoringFile,Ac as writeStoredEditorSceneLightingDebugLanguage,Pc as writeStoredEditorSceneLightingDebugOpen};
|