@galacean/cli 2.0.0-alpha.12 → 2.0.0-alpha.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/cli.bundle.cjs +154 -140
  2. package/dist/viewport-client/_static/Accordion-930aedee.js +1 -0
  3. package/dist/viewport-client/_static/{AmbientLightAsset-f70b95f1.js → AmbientLightAsset-f9c1eb91.js} +2 -2
  4. package/dist/viewport-client/_static/AnimationClipAsset-61699477.js +1 -0
  5. package/dist/viewport-client/_static/AnimatorControllerAsset-1c05f4db.js +1 -0
  6. package/dist/viewport-client/_static/AnimatorStore-6a3679e5.js +1 -0
  7. package/dist/viewport-client/_static/{AssetViewer-bc198e16.js → AssetViewer-0ce46fa1.js} +1 -1
  8. package/dist/viewport-client/_static/AudioAsset-5127eeec.js +1 -0
  9. package/dist/viewport-client/_static/AudioComponent-18a3e59f.js +1 -0
  10. package/dist/viewport-client/_static/{Callout-cb4a55ff.js → Callout-b6ac1af7.js} +1 -1
  11. package/dist/viewport-client/_static/CameraComponent-0a115258.js +1 -0
  12. package/dist/viewport-client/_static/{Component-f923abb1.js → Component-746be670.js} +1 -1
  13. package/dist/viewport-client/_static/DirectLight-4c53e9f6.js +1 -0
  14. package/dist/viewport-client/_static/FontAsset-a3a92f7d.js +5 -0
  15. package/dist/viewport-client/_static/FormItemArray-a2f72cf1.js +6 -0
  16. package/dist/viewport-client/_static/{GlTFAsset-9c68f862.js → GlTFAsset-5f37feef.js} +9 -9
  17. package/dist/viewport-client/_static/IconEdit-2c768a0a.js +6 -0
  18. package/dist/viewport-client/_static/{IconPointFilled-a304fd34.js → IconPointFilled-209638e2.js} +1 -1
  19. package/dist/viewport-client/_static/LightBaseComponent-51d498ea.js +1 -0
  20. package/dist/viewport-client/_static/LottieAnimationComponent-bff0244b.js +1 -0
  21. package/dist/viewport-client/_static/LottieAsset-9d3ef507.js +6 -0
  22. package/dist/viewport-client/_static/MarkdownAsset-a17933fb.js +1 -0
  23. package/dist/viewport-client/_static/MaterialAsset-3b56ac00.js +1 -0
  24. package/dist/viewport-client/_static/MaterialInspector-a36197f2.js +1 -0
  25. package/dist/viewport-client/_static/Menu-0a7dbec0.js +17 -0
  26. package/dist/viewport-client/_static/MeshAsset-2cf47eb2.js +1 -0
  27. package/dist/viewport-client/_static/MeshRendererBaseComponent-4a3af376.js +1 -0
  28. package/dist/viewport-client/_static/MeshRendererComponent-ac4c3954.js +1 -0
  29. package/dist/viewport-client/_static/{MeshThumbnail-49273f71.js → MeshThumbnail-25cd4a13.js} +1 -1
  30. package/dist/viewport-client/_static/ParticleRendererComponent-0a470dee.js +26 -0
  31. package/dist/viewport-client/_static/PhysicsMaterialAsset-d87d35aa.js +1 -0
  32. package/dist/viewport-client/_static/PhysicsStore-c283b2be.js +1 -0
  33. package/dist/viewport-client/_static/PointLight-b7de209f.js +1 -0
  34. package/dist/viewport-client/_static/PostProcessComponent-d4c9ef58.js +6 -0
  35. package/dist/viewport-client/_static/PrefabAsset-d0c0cd25.js +1 -0
  36. package/dist/viewport-client/_static/PrimitiveMesh-35092ad0.js +1 -0
  37. package/dist/viewport-client/_static/ProxyConfigs-ad92ebc7.js +1 -0
  38. package/dist/viewport-client/_static/{ReferencedMaterial-a87818f3.js → ReferencedMaterial-800a1955.js} +1 -1
  39. package/dist/viewport-client/_static/RenderTargetAsset-a003f9f5.js +1 -0
  40. package/dist/viewport-client/_static/SceneAsset-87f2ea92.js +1 -0
  41. package/dist/viewport-client/_static/{ShaderAsset-cb3ff628.js → ShaderAsset-98ce1f70.js} +6 -6
  42. package/dist/viewport-client/_static/ShaderChunkAsset-e9072307.js +5 -0
  43. package/dist/viewport-client/_static/{ShaderUIScriptAsset-d13fa4e2.js → ShaderUIScriptAsset-ac824e68.js} +5 -5
  44. package/dist/viewport-client/_static/SkinnedMeshRendererComponent-5f34bf46.js +1 -0
  45. package/dist/viewport-client/_static/SpineAnimationComponent-7c5db747.js +1 -0
  46. package/dist/viewport-client/_static/SpineSkeletonDataAsset-5b202ba0.js +1 -0
  47. package/dist/viewport-client/_static/SpotLight-2b4e593e.js +1 -0
  48. package/dist/viewport-client/_static/SpriteAsset-4e895da5.js +6 -0
  49. package/dist/viewport-client/_static/SpriteAtlasAsset-c2894c12.js +1 -0
  50. package/dist/viewport-client/_static/SpriteBaseComponent-a75e84c1.js +1 -0
  51. package/dist/viewport-client/_static/SpriteMaskComponent-a31f3384.js +1 -0
  52. package/dist/viewport-client/_static/SpriteRendererComponent-c2123918.js +1 -0
  53. package/dist/viewport-client/_static/{TextBaseComponent-69233798.js → TextBaseComponent-95846acf.js} +2 -2
  54. package/dist/viewport-client/_static/TextRendererComponent-429cf17b.js +1 -0
  55. package/dist/viewport-client/_static/TextureAsset-93475ade.js +36 -0
  56. package/dist/viewport-client/_static/Tooltip-dfde37c6.js +1 -0
  57. package/dist/viewport-client/_static/TrailRendererComponent-112b1618.js +1 -0
  58. package/dist/viewport-client/_static/TransformBaseComponent-a8050787.js +1 -0
  59. package/dist/viewport-client/_static/TransformComponent-c95e25c2.js +1 -0
  60. package/dist/viewport-client/_static/XRReferenceImageAsset-dbf129aa.js +1 -0
  61. package/dist/viewport-client/_static/audio-10589bb4.js +1 -0
  62. package/dist/viewport-client/_static/glTFIO-79bbca27.js +1 -0
  63. package/dist/viewport-client/_static/index-010da0b3.js +1 -0
  64. package/dist/viewport-client/_static/index-07bbf729.js +31 -0
  65. package/dist/viewport-client/_static/index-1e23212d.js +11487 -0
  66. package/dist/viewport-client/_static/index-2cdbb69f.js +1 -0
  67. package/dist/viewport-client/_static/index-31b7a6d3.js +1 -0
  68. package/dist/viewport-client/_static/index-3439012b.js +1 -0
  69. package/dist/viewport-client/_static/index-48760ac4.js +2 -0
  70. package/dist/viewport-client/_static/index-65a103b6.js +1 -0
  71. package/dist/viewport-client/_static/{index-e46ec5b1.js → index-77b1de5c.js} +7 -7
  72. package/dist/viewport-client/_static/index-92830754.js +1 -0
  73. package/dist/viewport-client/_static/{index-237c84cd.js → index-93eab932.js} +3 -3
  74. package/dist/viewport-client/_static/index-b259cf2e.js +1 -0
  75. package/dist/viewport-client/_static/{index-98982ce2.js → index-b2e1cba4.js} +1 -1
  76. package/dist/viewport-client/_static/index-b7bf2586.js +1 -0
  77. package/dist/viewport-client/_static/index-c20fc198.js +1 -0
  78. package/dist/viewport-client/_static/index-dc62ba4b.js +1 -0
  79. package/dist/viewport-client/_static/index-ea9ea505.js +1 -0
  80. package/dist/viewport-client/_static/ktx2-encoder-075abd75.js +1 -0
  81. package/dist/viewport-client/_static/{module-6406b050.js → module-251ecc50.js} +1 -1
  82. package/dist/viewport-client/_static/{module-107b7430.js → module-498119f3.js} +1 -1
  83. package/dist/viewport-client/_static/{module-5c85b07e.js → module-c6e2d190.js} +1 -1
  84. package/dist/viewport-client/_static/postmen-9e1e15bd.js +1 -0
  85. package/dist/viewport-client/index.html +2 -2
  86. package/package.json +1 -1
  87. package/dist/viewport-client/_static/Accordion-4897319b.js +0 -6
  88. package/dist/viewport-client/_static/AnimationClipAsset-01f3deb6.js +0 -1
  89. package/dist/viewport-client/_static/AnimatorControllerAsset-b7424e9c.js +0 -1
  90. package/dist/viewport-client/_static/AnimatorStore-fd98c00e.js +0 -1
  91. package/dist/viewport-client/_static/AssetPreviewer-24e31d97.js +0 -6
  92. package/dist/viewport-client/_static/AudioAsset-eae03324.js +0 -1
  93. package/dist/viewport-client/_static/AudioComponent-44070c2c.js +0 -1
  94. package/dist/viewport-client/_static/CameraComponent-907ac745.js +0 -1
  95. package/dist/viewport-client/_static/CanvasRenderer-9dd98cb3.js +0 -1
  96. package/dist/viewport-client/_static/DirectLight-58f5fe9e.js +0 -1
  97. package/dist/viewport-client/_static/FontAsset-abfb9a8a.js +0 -5
  98. package/dist/viewport-client/_static/FormItemArray-66be8701.js +0 -1
  99. package/dist/viewport-client/_static/IconPlayerPlayFilled-b058c98f.js +0 -6
  100. package/dist/viewport-client/_static/InstanceEditorAsset-a70e73fe.js +0 -1
  101. package/dist/viewport-client/_static/LightBaseComponent-fbc3ae49.js +0 -1
  102. package/dist/viewport-client/_static/LottieAnimationComponent-1c3e02a5.js +0 -1
  103. package/dist/viewport-client/_static/LottieAsset-377c1419.js +0 -1
  104. package/dist/viewport-client/_static/MarkdownAsset-7ea387a9.js +0 -1
  105. package/dist/viewport-client/_static/MaterialAsset-74a15124.js +0 -1
  106. package/dist/viewport-client/_static/MaterialInspector-aec1248b.js +0 -1
  107. package/dist/viewport-client/_static/Menu-cd3be298.js +0 -17
  108. package/dist/viewport-client/_static/MeshAsset-73e2cc8e.js +0 -1
  109. package/dist/viewport-client/_static/MeshRendererBaseComponent-3a0e09ed.js +0 -1
  110. package/dist/viewport-client/_static/MeshRendererComponent-5385d30f.js +0 -1
  111. package/dist/viewport-client/_static/ParticleRendererComponent-5a7b57d9.js +0 -21
  112. package/dist/viewport-client/_static/PhysicsMaterialAsset-a5ac9f82.js +0 -1
  113. package/dist/viewport-client/_static/PhysicsStore-0729e76d.js +0 -1
  114. package/dist/viewport-client/_static/PointLight-0e1d1546.js +0 -1
  115. package/dist/viewport-client/_static/PostProcessComponent-8276d33c.js +0 -1
  116. package/dist/viewport-client/_static/PrefabAsset-1a7edfbd.js +0 -1
  117. package/dist/viewport-client/_static/PrimitiveMesh-3ce6fa2f.js +0 -1
  118. package/dist/viewport-client/_static/ProxyConfigs-4de3304c.js +0 -1
  119. package/dist/viewport-client/_static/RenderTargetAsset-33c0d9e7.js +0 -1
  120. package/dist/viewport-client/_static/SceneAsset-8917c210.js +0 -1
  121. package/dist/viewport-client/_static/ShaderChunkAsset-83f923f4.js +0 -5
  122. package/dist/viewport-client/_static/SkinnedMeshRendererComponent-2a8323bf.js +0 -1
  123. package/dist/viewport-client/_static/SpineAnimationComponent-e733d50f.js +0 -1
  124. package/dist/viewport-client/_static/SpineSkeletonDataAsset-b64a3ee3.js +0 -1
  125. package/dist/viewport-client/_static/SpotLight-ca6c0c3b.js +0 -1
  126. package/dist/viewport-client/_static/SpriteAsset-9a31ec24.js +0 -1
  127. package/dist/viewport-client/_static/SpriteAtlasAsset-a862db46.js +0 -1
  128. package/dist/viewport-client/_static/SpriteBaseComponent-f6f1731f.js +0 -1
  129. package/dist/viewport-client/_static/SpriteMaskComponent-778be04f.js +0 -1
  130. package/dist/viewport-client/_static/SpriteRendererComponent-2b4d153b.js +0 -1
  131. package/dist/viewport-client/_static/TextRendererComponent-130b4e99.js +0 -1
  132. package/dist/viewport-client/_static/TextureAsset-28fedf2a.js +0 -36
  133. package/dist/viewport-client/_static/ThumbnailMixin-35997457.js +0 -1
  134. package/dist/viewport-client/_static/ThumbnailRegistry-495c18c9.js +0 -1
  135. package/dist/viewport-client/_static/Tooltip-33f770ba.js +0 -1
  136. package/dist/viewport-client/_static/TrailRendererComponent-148550b5.js +0 -1
  137. package/dist/viewport-client/_static/TransformBaseComponent-02318c5a.js +0 -1
  138. package/dist/viewport-client/_static/TransformComponent-96106065.js +0 -1
  139. package/dist/viewport-client/_static/ViewerManager-202b570a.js +0 -1
  140. package/dist/viewport-client/_static/XRReferenceImageAsset-6a6adb3b.js +0 -1
  141. package/dist/viewport-client/_static/audio-244358e2.js +0 -1
  142. package/dist/viewport-client/_static/glTFIO-45ff9a17.js +0 -1
  143. package/dist/viewport-client/_static/index-0a8702e2.js +0 -11217
  144. package/dist/viewport-client/_static/index-37c74ae9.js +0 -26
  145. package/dist/viewport-client/_static/index-4cca0201.js +0 -1
  146. package/dist/viewport-client/_static/index-59732f86.js +0 -1
  147. package/dist/viewport-client/_static/index-6c8198f6.js +0 -2
  148. package/dist/viewport-client/_static/index-6f827618.js +0 -1
  149. package/dist/viewport-client/_static/index-803ca489.js +0 -1
  150. package/dist/viewport-client/_static/index-85a6cf6a.js +0 -1
  151. package/dist/viewport-client/_static/index-b3d51f87.js +0 -1
  152. package/dist/viewport-client/_static/index-be6bc38a.js +0 -177
  153. package/dist/viewport-client/_static/index-c403cbcd.js +0 -1
  154. package/dist/viewport-client/_static/index-e73966ae.js +0 -1
  155. package/dist/viewport-client/_static/index-e95b4498.js +0 -1
  156. package/dist/viewport-client/_static/index-f5a67a46.js +0 -1
  157. package/dist/viewport-client/_static/ktx-parse.modern-6c9f771f.js +0 -1
  158. package/dist/viewport-client/_static/ktx2-encoder-1e63c1eb.js +0 -1
  159. package/dist/viewport-client/_static/postmen-45d4c238.js +0 -1
  160. package/dist/viewport-client/_static/utilities-e09052e3.js +0 -11
@@ -0,0 +1 @@
1
+ import{b5 as oe,b6 as te,b7 as T,b8 as c,aC as r,b9 as D,ba as re,bb as ne,bc as ie,bd as O,be as ae,bf as ce,bg as se,bh as de,bi as V,aO as b,bj as le}from"./index-1e23212d.js";var u="Accordion",pe=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[P,ue,fe]=oe(u),[C,Ee]=te(u,[fe,T]),H=T(),M=c.forwardRef((o,i)=>{const{type:e,...n}=o,a=n,t=n;return r.jsx(P.Provider,{scope:o.__scopeAccordion,children:e==="multiple"?r.jsx(me,{...t,ref:i}):r.jsx(be,{...a,ref:i})})});M.displayName=u;var[B,ge]=C(u),[L,he]=C(u,{collapsible:!1}),be=c.forwardRef((o,i)=>{const{value:e,defaultValue:n,onValueChange:a=()=>{},collapsible:t=!1,...s}=o,[d,l]=D({prop:e,defaultProp:n,onChange:a});return r.jsx(B,{scope:o.__scopeAccordion,value:d?[d]:[],onItemOpen:l,onItemClose:c.useCallback(()=>t&&l(""),[t,l]),children:r.jsx(L,{scope:o.__scopeAccordion,collapsible:t,children:r.jsx(K,{...s,ref:i})})})}),me=c.forwardRef((o,i)=>{const{value:e,defaultValue:n,onValueChange:a=()=>{},...t}=o,[s=[],d]=D({prop:e,defaultProp:n,onChange:a}),l=c.useCallback(h=>d((f=[])=>[...f,h]),[d]),g=c.useCallback(h=>d((f=[])=>f.filter($=>$!==h)),[d]);return r.jsx(B,{scope:o.__scopeAccordion,value:s,onItemOpen:l,onItemClose:g,children:r.jsx(L,{scope:o.__scopeAccordion,collapsible:!0,children:r.jsx(K,{...t,ref:i})})})}),[xe,A]=C(u),K=c.forwardRef((o,i)=>{const{__scopeAccordion:e,disabled:n,dir:a,orientation:t="vertical",...s}=o,d=c.useRef(null),l=re(d,i),g=ue(e),f=ne(a)==="ltr",$=ie(o.onKeyDown,m=>{var E;if(!pe.includes(m.key))return;const Z=m.target,S=g().filter(R=>{var N;return!((N=R.ref.current)!=null&&N.disabled)}),x=S.findIndex(R=>R.ref.current===Z),z=S.length;if(x===-1)return;m.preventDefault();let p=x;const I=0,w=z-1,y=()=>{p=x+1,p>w&&(p=I)},j=()=>{p=x-1,p<I&&(p=w)};switch(m.key){case"Home":p=I;break;case"End":p=w;break;case"ArrowRight":t==="horizontal"&&(f?y():j());break;case"ArrowDown":t==="vertical"&&y();break;case"ArrowLeft":t==="horizontal"&&(f?j():y());break;case"ArrowUp":t==="vertical"&&j();break}const ee=p%z;(E=S[ee].ref.current)==null||E.focus()});return r.jsx(xe,{scope:e,disabled:n,direction:a,orientation:t,children:r.jsx(P.Slot,{scope:e,children:r.jsx(O.div,{...s,"data-orientation":t,ref:l,onKeyDown:n?void 0:$})})})}),v="AccordionItem",[ve,k]=C(v),U=c.forwardRef((o,i)=>{const{__scopeAccordion:e,value:n,...a}=o,t=A(v,e),s=ge(v,e),d=H(e),l=ae(),g=n&&s.value.includes(n)||!1,h=t.disabled||o.disabled;return r.jsx(ve,{scope:e,open:g,disabled:h,triggerId:l,children:r.jsx(ce,{"data-orientation":t.orientation,"data-state":J(g),...d,...a,ref:i,disabled:h,open:g,onOpenChange:f=>{f?s.onItemOpen(n):s.onItemClose(n)}})})});U.displayName=v;var G="AccordionHeader",W=c.forwardRef((o,i)=>{const{__scopeAccordion:e,...n}=o,a=A(u,e),t=k(G,e);return r.jsx(O.h3,{"data-orientation":a.orientation,"data-state":J(t.open),"data-disabled":t.disabled?"":void 0,...n,ref:i})});W.displayName=G;var _="AccordionTrigger",Y=c.forwardRef((o,i)=>{const{__scopeAccordion:e,...n}=o,a=A(u,e),t=k(_,e),s=he(_,e),d=H(e);return r.jsx(P.ItemSlot,{scope:e,children:r.jsx(se,{"aria-disabled":t.open&&!s.collapsible||void 0,"data-orientation":a.orientation,id:t.triggerId,...d,...n,ref:i})})});Y.displayName=_;var q="AccordionContent",F=c.forwardRef((o,i)=>{const{__scopeAccordion:e,...n}=o,a=A(u,e),t=k(q,e),s=H(e);return r.jsx(de,{role:"region","aria-labelledby":t.triggerId,"data-orientation":a.orientation,...s,...n,ref:i,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...o.style}})});F.displayName=q;function J(o){return o?"open":"closed"}var Ce=M,Ae=U,$e=W,Se=Y,Ie=F;const we=V({from:{height:0,opacity:0},to:{height:"var(--radix-accordion-content-height)",opacity:1}}),ye=V({from:{height:"var(--radix-accordion-content-height)",opacity:1},to:{height:0,opacity:0}}),Q=c.createContext({size:"sm"}),je=b(Ce,{width:"100%",display:"flex",flexDirection:"column"}),Re=b(Ae,{position:"relative",boxSizing:"border-box",width:"100%",backgroundColor:"$surface",border:"1px solid $border",borderBottom:"none",overflow:"hidden","&:first-child":{borderTopLeftRadius:"$sm",borderTopRightRadius:"$sm"},"&:last-child":{borderBottomLeftRadius:"$sm",borderBottomRightRadius:"$sm",borderBottom:"1px solid $border"},"&[data-state=open]":{borderColor:"$borderStrong","&:not(:first-child)":{borderTopColor:"$borderStrong"},"& + &":{borderTopColor:"$borderStrong"}},"&:has(+ [data-state=open])":{borderBottomColor:"$borderStrong"}}),X=b(le,{width:"$iconSm",height:"$iconSm",color:"currentColor",flexShrink:0,transform:"rotate(0deg)",transition:"transform .2s ease, color .2s ease"}),_e=b($e,{all:"unset",display:"block"}),Pe=b(Se,{all:"unset",display:"flex",width:"100%",minHeight:"30px",padding:"0 $3",alignItems:"center",justifyContent:"space-between",gap:"$2",fontSize:"$2",lineHeight:"$lineHeights$2",fontWeight:500,color:"$text",overflow:"hidden",boxSizing:"border-box",userSelect:"none",backgroundColor:"$grayA2",transition:"$backgroundColor, $borderColor, $color","& > span":{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'&[data-state="open"]':{[`& ${X}`]:{transform:"rotate(90deg)"}},"&:hover":{backgroundColor:"$grayA3",color:"$textStrong"},"&:focus-visible":{outline:"none",boxShadow:"$focus"},variants:{size:{sm:{minHeight:"27px",padding:"0 $2",fontSize:"$1",lineHeight:"$lineHeights$1"},md:{minHeight:"30px",padding:"0 $3",fontSize:"$2",lineHeight:"$lineHeights$2"}}},defaultVariants:{size:"sm"}}),He=b(Ie,{overflow:"hidden",fontSize:"$1",color:"$text",backgroundColor:"$grayA2",'&[data-state="open"]':{animation:`${we} 200ms cubic-bezier(0.16, 1, 0.3, 1)`},'&[data-state="closed"]':{animation:`${ye} 180ms cubic-bezier(0.16, 1, 0.3, 1)`},"@media (prefers-reduced-motion: reduce)":{'&[data-state="open"], &[data-state="closed"]':{animation:"none"}}}),ke=b("div",{color:"$text",borderTop:"1px solid $border",variants:{size:{sm:{padding:"$2",fontSize:"$1",lineHeight:"$lineHeights$1"},md:{padding:"$3",fontSize:"$1",lineHeight:"$lineHeights$2"}}},defaultVariants:{size:"sm"}}),Ne=function(i){const{size:e="sm",...n}=i;return r.jsx(Q.Provider,{value:{size:e},children:r.jsx(je,{...n})})};function Te(o){const{size:i}=c.useContext(Q),{children:e,title:n,arrow:a=!0,...t}=o;return r.jsxs(Re,{...t,children:[r.jsx(_e,{children:r.jsxs(Pe,{size:i,children:[r.jsx("span",{children:n}),a&&r.jsx(X,{"aria-hidden":!0})]})}),r.jsx(He,{children:r.jsx(ke,{size:i,children:e})})]})}export{Ne as A,Te as a};
@@ -1,5 +1,5 @@
1
- var nt=Object.defineProperty;var st=(r,t,n)=>t in r?nt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n;var k=(r,t,n)=>(st(r,typeof t!="symbol"?t+"":t,n),n);import{b_ as R,O as rt,b$ as ot,Q as it,j as at,c0 as E,c1 as Q,c2 as ct,c3 as ut,c4 as ht,c5 as lt,c6 as ft,a7 as mt,e as bt,c7 as dt,c8 as gt}from"./index-0a8702e2.js";import{H as yt}from"./enum-58295f88.js";import{a as pt}from"./InstanceEditorAsset-a70e73fe.js";import"./AssetPreviewer-24e31d97.js";import{k as wt}from"./ktx2-encoder-1e63c1eb.js";import"./ThumbnailRegistry-495c18c9.js";import"./IconPlayerPlayFilled-b058c98f.js";import"./TaskQueue-05c94a4d.js";import"./ktx-parse.modern-6c9f771f.js";class D{static getWorker(t){const n=this.getWorkerCodeByFunctionList(t);if(this._workerCache[n])return this._workerCache[n];const e=this.getWorkerURLByCode(n),s=new Worker(e);return this._workerCache[n]=s,this.registerWorkerEvent(s),s}static registerWorkerEvent(t){t.onmessage=n=>{const e=n.data,{type:s,taskID:i}=e;switch(s){case"calculateSHFromTextureCube":const a=this._callbacks[i],o=e.result;a.resolve(o);break}}}static getURLByWorker(t){for(let n in this._workerCache)if(this._workerCache[n]===t)return n}static getWorkerCodeByFunctionList(t){const n=kt.toString(),e=n.substring(n.indexOf("{")+1,n.lastIndexOf("}"));return`
1
+ var nt=Object.defineProperty;var st=(r,t,n)=>t in r?nt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n;var k=(r,t,n)=>(st(r,typeof t!="symbol"?t+"":t,n),n);import{bW as R,O as rt,bX as ot,Q as it,j as at,bY as z,bZ as Q,b_ as ct,b$ as ut,c0 as ht,c1 as lt,c2 as ft,a7 as mt,n as bt,e as dt,c3 as gt,c4 as yt}from"./index-1e23212d.js";import{H as pt}from"./enum-58295f88.js";import"./index-92830754.js";import{k as wt}from"./ktx2-encoder-075abd75.js";import"./TaskQueue-05c94a4d.js";class D{static getWorker(t){const n=this.getWorkerCodeByFunctionList(t);if(this._workerCache[n])return this._workerCache[n];const e=this.getWorkerURLByCode(n),s=new Worker(e);return this._workerCache[n]=s,this.registerWorkerEvent(s),s}static registerWorkerEvent(t){t.onmessage=n=>{const e=n.data,{type:s,taskID:i}=e;switch(s){case"calculateSHFromTextureCube":const a=this._callbacks[i],o=e.result;a.resolve(o);break}}}static getURLByWorker(t){for(let n in this._workerCache)if(this._workerCache[n]===t)return n}static getWorkerCodeByFunctionList(t){const n=kt.toString(),e=n.substring(n.indexOf("{")+1,n.lastIndexOf("}"));return`
2
2
  ${t.map(i=>i.toString()).join(`
3
3
  `)}
4
4
  ${e}
5
- `}static getWorkerURLByCode(t){return URL.createObjectURL(new Blob([t],{type:"application/javascript"}))}static calculateSHFromTextureCube(t,n,e,s,i,a,o){return new Promise(h=>{const l=this._taskID++,f=this.getWorker([j,F,Y,Z,V,A]);this._callbacks[l]={resolve:h},f.postMessage({type:"calculateSHFromTextureCube",taskID:l,textureSize:o,dataPX:t,dataNX:n,dataPY:e,dataNY:s,dataPZ:i,dataNZ:a})})}}k(D,"_callbacks",{}),k(D,"_workerCache",{}),k(D,"_taskID",0);function kt(){self.onmessage=function(t){const n=t.data,{type:e,taskID:s}=n;switch(e){case"calculateSHFromTextureCube":const{textureSize:i,dataPX:a,dataNX:o,dataPY:h,dataNY:l,dataPZ:f,dataNZ:b}=n,u=new Float32Array(27);let c=0;c=A(a,0,i,c,u),c=A(o,1,i,c,u),c=A(h,2,i,c,u),c=A(l,3,i,c,u),c=A(f,4,i,c,u),c=A(b,5,i,c,u),V(u,4*Math.PI/c),self.postMessage({type:"calculateSHFromTextureCube",taskID:s,result:u});break}}}class St{static async fromTextureCube(t,n){const s=t.width,i=new Uint16Array(s*s*4),a=new Uint16Array(s*s*4),o=new Uint16Array(s*s*4),h=new Uint16Array(s*s*4),l=new Uint16Array(s*s*4),f=new Uint16Array(s*s*4);t.getPixelBuffer(R.PositiveX,0,0,s,s,0,i),t.getPixelBuffer(R.NegativeX,0,0,s,s,0,a),t.getPixelBuffer(R.PositiveY,0,0,s,s,0,o),t.getPixelBuffer(R.NegativeY,0,0,s,s,0,h),t.getPixelBuffer(R.PositiveZ,0,0,s,s,0,l),t.getPixelBuffer(R.NegativeZ,0,0,s,s,0,f);const b=await D.calculateSHFromTextureCube(i,a,o,h,l,f,s),u=new Float32Array(b);return Tt(u),n.copyFromArray(u),n}}function j(r){const t=r&32768?-1:1,n=r>>10&31,e=r&1023;return n===31?e===0?t*(1/0):NaN:n===0?t*2**-14*(e/1024):t*2**(n-15)*(1+e/1024)}function Z(r,t,n,e){const s=r[0],i=r[1],a=r[2],o=t[0]*n,h=t[1]*n,l=t[2]*n,f=.282095,b=-.488603*i,u=.488603*a,c=-.488603*s,m=1.092548*(s*i),d=-1.092548*(i*a),g=.315392*(3*a*a-1),w=-1.092548*(s*a),S=.546274*(s*s-i*i);e[0]+=o*f,e[1]+=h*f,e[2]+=l*f,e[3]+=o*b,e[4]+=h*b,e[5]+=l*b,e[6]+=o*u,e[7]+=h*u,e[8]+=l*u,e[9]+=o*c,e[10]+=h*c,e[11]+=l*c,e[12]+=o*m,e[13]+=h*m,e[14]+=l*m,e[15]+=o*d,e[16]+=h*d,e[17]+=l*d,e[18]+=o*g,e[19]+=h*g,e[20]+=l*g,e[21]+=o*w,e[22]+=h*w,e[23]+=l*w,e[24]+=o*S,e[25]+=h*S,e[26]+=l*S}function F(r,t){return Math.atan2(r*t,Math.sqrt(r*r+t*t+1))}function Y(r,t,n){const e=1/r,s=(t+.5)*2*e-1,i=(n+.5)*2*e-1,a=s-e,o=i-e,h=s+e,l=i+e;return F(a,o)-F(a,l)-F(h,o)+F(h,l)}function I(r,t){return t*(t+1)+r}function K(r,t){if(r===0)return 1;if(r>=t)return 0;let n=Math.PI*r/t;return n=Math.sin(n)/n,Math.pow(n,4)}function _t(r,t){const n=-r[1],e=r[2],s=-r[0],i=-t[0][1]*n+t[0][2]*e+-t[0][0]*s,a=-t[1][1]*n+t[1][2]*e+-t[1][0]*s,o=-t[2][1]*n+t[2][2]*e+-t[2][0]*s;return[i,a,o]}function Lt(r,t){const n=1.7320508076,e=Math.SQRT1_2;function s(u,c,m){return[c*u,-(c*m),1/(2*n)*(3*m*m-1),-(m*u),.5*(u*u-c*c)]}const i=t[0],a=t[1],o=t[2],h=[s(i[0],i[1],i[2]),s(o[0],o[1],o[2]),s(e*(i[0]+a[0]),e*(i[1]+a[1]),e*(i[2]+a[2])),s(e*(i[0]+o[0]),e*(i[1]+o[1]),e*(i[2]+o[2])),s(e*(a[0]+o[0]),e*(a[1]+o[1]),e*(a[2]+o[2]))],l=[[0,1,2,0,0],[-1,0,0,0,-2],[0,n,0,0,0],[1,1,0,-2,0],[2,1,0,0,0]],f=[0,0,0,0,0];for(let u=0;u<5;u++)for(let c=0;c<5;c++)f[u]+=l[u][c]*r[c];const b=[0,0,0,0,0];for(let u=0;u<5;u++)for(let c=0;c<5;c++)b[u]+=h[u][c]*f[c];return b}function Bt(r){const t=1.7724538509,n=1.7320508076,e=2.2360679775,s=3.8729833462,i=[1/(2*t),-n/(2*t),n/(2*t),-n/(2*t),s/(2*t),-s/(2*t),e/(4*t),-s/(2*t),s/(4*t)],a=Math.sqrt(r[3]*r[3]+r[1]*r[1]+r[2]*r[2]);if(a<1e-8)return i[0]*r[0];const o=-r[3]/a,h=-r[1]/a,l=r[2]/a,f=-o,b=-h,u=-l;let c=u,m=0,d=-f;const g=Math.sqrt(c*c+d*d);g<1e-8?(c=1,m=0,d=0):(c/=g,d/=g);const w=m*u-d*b,S=d*f-c*u,O=c*b-m*f,x=[[c,w,-f],[m,S,-b],[d,O,-u]],_=_t([r[1],r[2],r[3]],x),L=Lt([r[4],r[5],r[6],r[7],r[8]],x),y=[r[0],_[0],_[1],_[2],L[0],L[1],L[2],L[3],L[4]],X=i[8]*Math.sqrt(y[8]*y[8]+y[4]*y[4]),B=3*i[6]*y[6]+X,T=i[2]*y[2],H=i[0]*y[0]-i[6]*y[6]-X,C=-T/(2*B),$=B*C*C+T*C+H,G=Math.min(B+T+H,B-T+H),J=B>0&&C>=-1&&C<=1?$:G,v=i[4]*Math.sqrt(y[5]*y[5]+y[7]*y[7]);let U=J-.5*v;if(U<0){const W=p=>B*p*p+T*p+H+v*p*Math.sqrt(1-p*p),tt=p=>{const P=p*p,et=Math.sqrt(1-P);return(P-1)*(v-2*v*P+(T+2*B*p)*et)/(3*v*p-2*v*P*p-2*B*Math.pow(1-P,1.5))};let M=-Math.SQRT1_2,q;do U=W(M),q=tt(M),M=M-q;while(Math.abs(M)<=1&&Math.abs(q)>1e-5);Math.abs(M)>1&&(U=Math.min(W(1),W(-1)))}return U}function At(r,t){const e=r.slice();for(let s=0;s<3;s++){const i=K(s,t);e[I(0,s)]*=i;for(let a=1;a<=s;a++)e[I(-a,s)]*=i,e[I(a,s)]*=i}return e}function Tt(r){let n=13;for(let e=0;e<3;e++){const s=[];for(let o=0;o<9;o++)s[o]=r[o*3+e];let i=3,a=n;for(let o=0;o<16&&i+.1<a;o++){const h=.5*(i+a),l=At(s,h);Bt(l)<0?a=h:i=h}n=Math.min(n,i)}for(let e=0;e<3;e++){const s=K(e,n);for(let i=-e;i<=e;i++){const a=I(i,e);r[a*3]*=s,r[a*3+1]*=s,r[a*3+2]*=s}}}function V(r,t){const n=r;n[0]*=t,n[1]*=t,n[2]*=t,n[3]*=t,n[4]*=t,n[5]*=t,n[6]*=t,n[7]*=t,n[8]*=t,n[9]*=t,n[10]*=t,n[11]*=t,n[12]*=t,n[13]*=t,n[14]*=t,n[15]*=t,n[16]*=t,n[17]*=t,n[18]*=t,n[19]*=t,n[20]*=t,n[21]*=t,n[22]*=t,n[23]*=t,n[24]*=t,n[25]*=t,n[26]*=t}function A(r,t,n,e,s){const a=[],o=[];let h=e;for(let l=0;l<n;l++)for(let f=0;f<n;f++){const b=l*n*4+f*4;a[0]=j(r[b]),a[1]=j(r[b+1]),a[2]=j(r[b+2]);const u=1/n,c=(f+.5)*2*u-1,m=(l+.5)*2*u-1;switch(t){case 0:o[0]=1,o[1]=-m,o[2]=-c;break;case 1:o[0]=-1,o[1]=-m,o[2]=c;break;case 2:o[0]=c,o[1]=1,o[2]=m;break;case 3:o[0]=c,o[1]=-1,o[2]=-m;break;case 4:o[0]=c,o[1]=-m,o[2]=1;break;case 5:o[0]=-c,o[1]=-m,o[2]=-1;break}const d=o[0]*o[0]+o[1]*o[1]+o[2]*o[2],g=Math.sqrt(d);o[0]/=g,o[1]/=g,o[2]/=g;const w=Y(n,f,l);h+=w,Z(o,a,w,s)}return h}class N{static update(t,n){this.entity?this.entity.isActive=!0:this.initScene(t);const e=t.scene;e&&(this._scene=e,this.preAmbientLight=e.ambientLight,e.ambientLight=n.engineObject)}static clear(){this.entity.isActive=!1,this._scene&&(this._scene.ambientLight=this.preAmbientLight,this._scene=null)}static initScene(t){const{engine:n}=t,s=(this.entity=t.createChild("material")).addComponent(rt);s.mesh=ot.createSphere(n,2,64,!0);const i=new it(n);i.roughness=.5,i.metallic=.5,s.setMaterial(i)}}k(N,"entity",null),k(N,"preAmbientLight"),k(N,"_scene");var vt=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,Rt=(r,t,n,e)=>{for(var s=e>1?void 0:e?Mt(t,n):t,i=r.length-1,a;i>=0;i--)(a=r[i])&&(s=(e?a(t,n,s):a(s))||s);return e&&s&&vt(t,n,s),s};const xt=1;let z=class extends at{constructor(t){super(t);k(this,"_sh",new E);k(this,"_bakerData")}async bakeFromScene(t){const n=this.root.sceneStore.engineObject,e=Q.fromScene(n,this.root.sceneStore.bakerResolution);await this._applyBakeResult(t,e,e)}async bakeFromTexture(t){const n=Q.fromTextureCubeMap(t,this.root.sceneStore.bakerResolution,ct.Linear);await this._applyBakeResult(t.engine,n,t)}async _applyBakeResult(t,n,e){const s=this._sh;if(await St.fromTextureCube(e,s),this._bakerData=ut(n,s),!this.engineObject){const a=new ht(t);a.diffuseMode=lt.SphericalHarmonics,this.bindEngineObject(a)}const i=this.engineObject;i.specularTexture=n,i.diffuseSphericalHarmonics=s}async initByCreation(t,n,e){return(e==null?void 0:e.from)==="Scene"?await this.bakeFromScene(this.engine):(e==null?void 0:e.from)==="Texture"&&await this.bakeFromTexture(e.srcTexture),this.getMainData()}async initByMain(t,n){const e=await t.arrayBuffer();if(!ft(e,xt)){this.root.sceneStore.bake();return}const s=await this.engine.resourceManager.load({url:n,type:mt.AmbientLight});this.bindEngineObject(s),this._bakerData=e}getMainData(){return this._bakerData}};z=Rt([pt({type:"AmbientLight",label:bt("asset.ambient-light.title"),loaderType:"AmbientLight",defaultName:"ambient_light.ambLight",extname:"ambLight",thumbnail:N,async bundle({content:r},t){if(t.assetOptions.textureOptions.textureType==="ktx2")try{const e=await r.arrayBuffer(),i=dt.decode(e).headerLength,a=27*4,o=i+a,h=new Uint8Array(e,o,4);if(h[0]===171&&h[1]===75&&h[2]===84&&h[3]===88)return{content:r};const l=new E;l.copyFromArray(new Float32Array(e,i,27));const f=new Uint16Array(e,o,1)[0],b=Math.floor(Math.log2(f))+1;let u=o+2;const c=[];for(let g=0;g<b;g++){const w=f>>g,S=[];for(let O=0;O<6;O++){const x=w*w*4,_=new Uint16Array(e,u,x);u+=x*2;const L=new Uint8Array(_.byteLength);L.set(new Uint8Array(_.buffer,_.byteOffset,_.byteLength)),S.push(L.buffer)}c.push(S)}const m=await wt.encode(c,{isUASTC:!0,isHDR:!0,imageType:yt.RGBAHalfFloat,width:f,height:f,generateMipmap:!1,isPerceptual:!1,isSetKTX2SRGBTransferFunc:!1,needSupercompression:!0}),d=gt(l,m);return{content:new Blob([d])}}catch(e){console.error("AmbientLight KTX2 encoding failed, fallback to raw:",e)}return{content:r}}})],z);export{z as AmbientLightAsset};
5
+ `}static getWorkerURLByCode(t){return URL.createObjectURL(new Blob([t],{type:"application/javascript"}))}static calculateSHFromTextureCube(t,n,e,s,i,a,o){return new Promise(h=>{const l=this._taskID++,f=this.getWorker([j,F,Y,E,V,A]);this._callbacks[l]={resolve:h},f.postMessage({type:"calculateSHFromTextureCube",taskID:l,textureSize:o,dataPX:t,dataNX:n,dataPY:e,dataNY:s,dataPZ:i,dataNZ:a})})}}k(D,"_callbacks",{}),k(D,"_workerCache",{}),k(D,"_taskID",0);function kt(){self.onmessage=function(t){const n=t.data,{type:e,taskID:s}=n;switch(e){case"calculateSHFromTextureCube":const{textureSize:i,dataPX:a,dataNX:o,dataPY:h,dataNY:l,dataPZ:f,dataNZ:b}=n,u=new Float32Array(27);let c=0;c=A(a,0,i,c,u),c=A(o,1,i,c,u),c=A(h,2,i,c,u),c=A(l,3,i,c,u),c=A(f,4,i,c,u),c=A(b,5,i,c,u),V(u,4*Math.PI/c),self.postMessage({type:"calculateSHFromTextureCube",taskID:s,result:u});break}}}class St{static async fromTextureCube(t,n){const s=t.width,i=new Uint16Array(s*s*4),a=new Uint16Array(s*s*4),o=new Uint16Array(s*s*4),h=new Uint16Array(s*s*4),l=new Uint16Array(s*s*4),f=new Uint16Array(s*s*4);t.getPixelBuffer(R.PositiveX,0,0,s,s,0,i),t.getPixelBuffer(R.NegativeX,0,0,s,s,0,a),t.getPixelBuffer(R.PositiveY,0,0,s,s,0,o),t.getPixelBuffer(R.NegativeY,0,0,s,s,0,h),t.getPixelBuffer(R.PositiveZ,0,0,s,s,0,l),t.getPixelBuffer(R.NegativeZ,0,0,s,s,0,f);const b=await D.calculateSHFromTextureCube(i,a,o,h,l,f,s),u=new Float32Array(b);return Tt(u),n.copyFromArray(u),n}}function j(r){const t=r&32768?-1:1,n=r>>10&31,e=r&1023;return n===31?e===0?t*(1/0):NaN:n===0?t*2**-14*(e/1024):t*2**(n-15)*(1+e/1024)}function E(r,t,n,e){const s=r[0],i=r[1],a=r[2],o=t[0]*n,h=t[1]*n,l=t[2]*n,f=.282095,b=-.488603*i,u=.488603*a,c=-.488603*s,m=1.092548*(s*i),d=-1.092548*(i*a),g=.315392*(3*a*a-1),w=-1.092548*(s*a),S=.546274*(s*s-i*i);e[0]+=o*f,e[1]+=h*f,e[2]+=l*f,e[3]+=o*b,e[4]+=h*b,e[5]+=l*b,e[6]+=o*u,e[7]+=h*u,e[8]+=l*u,e[9]+=o*c,e[10]+=h*c,e[11]+=l*c,e[12]+=o*m,e[13]+=h*m,e[14]+=l*m,e[15]+=o*d,e[16]+=h*d,e[17]+=l*d,e[18]+=o*g,e[19]+=h*g,e[20]+=l*g,e[21]+=o*w,e[22]+=h*w,e[23]+=l*w,e[24]+=o*S,e[25]+=h*S,e[26]+=l*S}function F(r,t){return Math.atan2(r*t,Math.sqrt(r*r+t*t+1))}function Y(r,t,n){const e=1/r,s=(t+.5)*2*e-1,i=(n+.5)*2*e-1,a=s-e,o=i-e,h=s+e,l=i+e;return F(a,o)-F(a,l)-F(h,o)+F(h,l)}function I(r,t){return t*(t+1)+r}function K(r,t){if(r===0)return 1;if(r>=t)return 0;let n=Math.PI*r/t;return n=Math.sin(n)/n,Math.pow(n,4)}function _t(r,t){const n=-r[1],e=r[2],s=-r[0],i=-t[0][1]*n+t[0][2]*e+-t[0][0]*s,a=-t[1][1]*n+t[1][2]*e+-t[1][0]*s,o=-t[2][1]*n+t[2][2]*e+-t[2][0]*s;return[i,a,o]}function Lt(r,t){const n=1.7320508076,e=Math.SQRT1_2;function s(u,c,m){return[c*u,-(c*m),1/(2*n)*(3*m*m-1),-(m*u),.5*(u*u-c*c)]}const i=t[0],a=t[1],o=t[2],h=[s(i[0],i[1],i[2]),s(o[0],o[1],o[2]),s(e*(i[0]+a[0]),e*(i[1]+a[1]),e*(i[2]+a[2])),s(e*(i[0]+o[0]),e*(i[1]+o[1]),e*(i[2]+o[2])),s(e*(a[0]+o[0]),e*(a[1]+o[1]),e*(a[2]+o[2]))],l=[[0,1,2,0,0],[-1,0,0,0,-2],[0,n,0,0,0],[1,1,0,-2,0],[2,1,0,0,0]],f=[0,0,0,0,0];for(let u=0;u<5;u++)for(let c=0;c<5;c++)f[u]+=l[u][c]*r[c];const b=[0,0,0,0,0];for(let u=0;u<5;u++)for(let c=0;c<5;c++)b[u]+=h[u][c]*f[c];return b}function Bt(r){const t=1.7724538509,n=1.7320508076,e=2.2360679775,s=3.8729833462,i=[1/(2*t),-n/(2*t),n/(2*t),-n/(2*t),s/(2*t),-s/(2*t),e/(4*t),-s/(2*t),s/(4*t)],a=Math.sqrt(r[3]*r[3]+r[1]*r[1]+r[2]*r[2]);if(a<1e-8)return i[0]*r[0];const o=-r[3]/a,h=-r[1]/a,l=r[2]/a,f=-o,b=-h,u=-l;let c=u,m=0,d=-f;const g=Math.sqrt(c*c+d*d);g<1e-8?(c=1,m=0,d=0):(c/=g,d/=g);const w=m*u-d*b,S=d*f-c*u,O=c*b-m*f,x=[[c,w,-f],[m,S,-b],[d,O,-u]],_=_t([r[1],r[2],r[3]],x),L=Lt([r[4],r[5],r[6],r[7],r[8]],x),y=[r[0],_[0],_[1],_[2],L[0],L[1],L[2],L[3],L[4]],q=i[8]*Math.sqrt(y[8]*y[8]+y[4]*y[4]),B=3*i[6]*y[6]+q,T=i[2]*y[2],H=i[0]*y[0]-i[6]*y[6]-q,C=-T/(2*B),$=B*C*C+T*C+H,G=Math.min(B+T+H,B-T+H),J=B>0&&C>=-1&&C<=1?$:G,v=i[4]*Math.sqrt(y[5]*y[5]+y[7]*y[7]);let U=J-.5*v;if(U<0){const W=p=>B*p*p+T*p+H+v*p*Math.sqrt(1-p*p),tt=p=>{const P=p*p,et=Math.sqrt(1-P);return(P-1)*(v-2*v*P+(T+2*B*p)*et)/(3*v*p-2*v*P*p-2*B*Math.pow(1-P,1.5))};let M=-Math.SQRT1_2,X;do U=W(M),X=tt(M),M=M-X;while(Math.abs(M)<=1&&Math.abs(X)>1e-5);Math.abs(M)>1&&(U=Math.min(W(1),W(-1)))}return U}function At(r,t){const e=r.slice();for(let s=0;s<3;s++){const i=K(s,t);e[I(0,s)]*=i;for(let a=1;a<=s;a++)e[I(-a,s)]*=i,e[I(a,s)]*=i}return e}function Tt(r){let n=13;for(let e=0;e<3;e++){const s=[];for(let o=0;o<9;o++)s[o]=r[o*3+e];let i=3,a=n;for(let o=0;o<16&&i+.1<a;o++){const h=.5*(i+a),l=At(s,h);Bt(l)<0?a=h:i=h}n=Math.min(n,i)}for(let e=0;e<3;e++){const s=K(e,n);for(let i=-e;i<=e;i++){const a=I(i,e);r[a*3]*=s,r[a*3+1]*=s,r[a*3+2]*=s}}}function V(r,t){const n=r;n[0]*=t,n[1]*=t,n[2]*=t,n[3]*=t,n[4]*=t,n[5]*=t,n[6]*=t,n[7]*=t,n[8]*=t,n[9]*=t,n[10]*=t,n[11]*=t,n[12]*=t,n[13]*=t,n[14]*=t,n[15]*=t,n[16]*=t,n[17]*=t,n[18]*=t,n[19]*=t,n[20]*=t,n[21]*=t,n[22]*=t,n[23]*=t,n[24]*=t,n[25]*=t,n[26]*=t}function A(r,t,n,e,s){const a=[],o=[];let h=e;for(let l=0;l<n;l++)for(let f=0;f<n;f++){const b=l*n*4+f*4;a[0]=j(r[b]),a[1]=j(r[b+1]),a[2]=j(r[b+2]);const u=1/n,c=(f+.5)*2*u-1,m=(l+.5)*2*u-1;switch(t){case 0:o[0]=1,o[1]=-m,o[2]=-c;break;case 1:o[0]=-1,o[1]=-m,o[2]=c;break;case 2:o[0]=c,o[1]=1,o[2]=m;break;case 3:o[0]=c,o[1]=-1,o[2]=-m;break;case 4:o[0]=c,o[1]=-m,o[2]=1;break;case 5:o[0]=-c,o[1]=-m,o[2]=-1;break}const d=o[0]*o[0]+o[1]*o[1]+o[2]*o[2],g=Math.sqrt(d);o[0]/=g,o[1]/=g,o[2]/=g;const w=Y(n,f,l);h+=w,E(o,a,w,s)}return h}class N{static update(t,n){this.entity?this.entity.isActive=!0:this.initScene(t);const e=t.scene;e&&(this._scene=e,this.preAmbientLight=e.ambientLight,e.ambientLight=n.engineObject)}static clear(){this.entity.isActive=!1,this._scene&&(this._scene.ambientLight=this.preAmbientLight,this._scene=null)}static initScene(t){const{engine:n}=t,s=(this.entity=t.createChild("material")).addComponent(rt);s.mesh=ot.createSphere(n,2,64,!0);const i=new it(n);i.roughness=.5,i.metallic=.5,s.setMaterial(i)}}k(N,"entity",null),k(N,"preAmbientLight"),k(N,"_scene");var vt=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,Rt=(r,t,n,e)=>{for(var s=e>1?void 0:e?Mt(t,n):t,i=r.length-1,a;i>=0;i--)(a=r[i])&&(s=(e?a(t,n,s):a(s))||s);return e&&s&&vt(t,n,s),s};const xt=1;let Z=class extends at{constructor(t){super(t);k(this,"_sh",new z);k(this,"_bakerData")}async bakeFromScene(t){const n=this.root.sceneStore.engineObject,e=Q.fromScene(n,this.root.sceneStore.bakerResolution);await this._applyBakeResult(t,e,e)}async bakeFromTexture(t){const n=Q.fromTextureCubeMap(t,this.root.sceneStore.bakerResolution,ct.Linear);await this._applyBakeResult(t.engine,n,t)}async _applyBakeResult(t,n,e){const s=this._sh;if(await St.fromTextureCube(e,s),this._bakerData=ut(n,s),!this.engineObject){const a=new ht(t);a.diffuseMode=lt.SphericalHarmonics,this.bindEngineObject(a)}const i=this.engineObject;i.specularTexture=n,i.diffuseSphericalHarmonics=s}async initByCreation(t,n,e){return(e==null?void 0:e.from)==="Scene"?await this.bakeFromScene(this.engine):(e==null?void 0:e.from)==="Texture"&&await this.bakeFromTexture(e.srcTexture),this.getMainData()}async initByMain(t,n){const e=await t.arrayBuffer();if(!ft(e,xt)){this.root.sceneStore.bake();return}const s=await this.engine.resourceManager.load({url:n,type:mt.AmbientLight});this.bindEngineObject(s),this._bakerData=e}getMainData(){return this._bakerData}};Z=Rt([bt({type:"AmbientLight",label:dt("asset.ambient-light.title"),loaderType:"AmbientLight",defaultName:"ambient_light.ambLight",extname:"ambLight",thumbnail:N,async bundle({content:r},t){if(t.assetOptions.textureOptions.textureType==="ktx2")try{const e=await r.arrayBuffer(),i=gt.decode(e).headerLength,a=27*4,o=i+a,h=new Uint8Array(e,o,4);if(h[0]===171&&h[1]===75&&h[2]===84&&h[3]===88)return{content:r};const l=new z;l.copyFromArray(new Float32Array(e,i,27));const f=new Uint16Array(e,o,1)[0],b=Math.floor(Math.log2(f))+1;let u=o+2;const c=[];for(let g=0;g<b;g++){const w=f>>g,S=[];for(let O=0;O<6;O++){const x=w*w*4,_=new Uint16Array(e,u,x);u+=x*2;const L=new Uint8Array(_.byteLength);L.set(new Uint8Array(_.buffer,_.byteOffset,_.byteLength)),S.push(L.buffer)}c.push(S)}const m=await wt.encode(c,{isUASTC:!0,isHDR:!0,imageType:pt.RGBAHalfFloat,width:f,height:f,generateMipmap:!1,isPerceptual:!1,isSetKTX2SRGBTransferFunc:!1,needSupercompression:!0}),d=yt(l,m);return{content:new Blob([d])}}catch(e){console.error("AmbientLight KTX2 encoding failed, fallback to raw:",e)}return{content:r}}})],Z);export{Z as AmbientLightAsset};
@@ -0,0 +1 @@
1
+ var ht=Object.defineProperty;var ut=(_,t,n)=>t in _?ht(_,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):_[t]=n;var g=(_,t,n)=>(ut(_,typeof t!="symbol"?t+"":t,n),n);import{aQ as X,aS as V,bl as yt,e as j,cB as et,cC as dt,aV as mt,aO as ft,aP as gt,u as st,S as ot,c8 as Pt,x as D,aL as E,bo as _t,br as vt,cD as bt,cE as Ct,O as Tt,cF as wt,ct as Et,cG as At,cH as St,cI as xt,$ as Mt,a1 as Vt,cJ as It,cK as Ot,cL as jt,cM as Bt,cN as Rt,cO as Ft,cP as Dt,cQ as Lt,cR as $t,cS as Kt,cT as Nt,cU as kt,cV as zt,cW as Ut,z as y,cX as Gt,cr as I,cY as Ht,cZ as Qt,c_ as Jt,c$ as Wt,d0 as Yt,d1 as qt,d2 as Xt,d3 as Zt,d4 as te,d5 as ee,d6 as re,j as ne,d7 as O,by as W,d8 as G,bP as Y,d9 as x,cb as q,da as ae,db as rt,aw as se,dc as oe,am as nt,dd as F,K as at,de as ie,X as pe,df as ce,aA as le,aB as he,V as ue,N as ye,B as de,dg as H,cu as me,m as fe,a$ as ge,bD as Pe,n as _e,o as ve,dh as be}from"./index-1e23212d.js";import{a as it}from"./index-92830754.js";import"./postmen-9e1e15bd.js";import{A as Ce}from"./AssetViewer-0ce46fa1.js";import{o as Te}from"./assetEditorActions-c4e5962f.js";import{e as pt}from"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import{L as we}from"./module-251ecc50.js";import{a as Ee}from"./module-498119f3.js";const Ae=X(()=>{const _=it("animationClipStore"),{selectedEvent:t}=_,{paramType:n}=t;return V.jsxs("div",{children:[V.jsx(yt,{label:j("animation.clip.param-type.title"),options:[{value:"string",label:String(j("animation.clip.param-type.string"))},{value:"number",label:String(j("animation.clip.param-type.number"))},{value:"null",label:String(j("animation.clip.param-type.null"))}],value:n||"null",onChange:r=>{t.paramType=r,_.updateEvents([t])}}),V.jsx(et,{label:j("animation.clip.function-name"),value:t.functionName,onChange:r=>{t.functionName=r,_.updateEvents([t])}}),n==="number"&&V.jsx(dt,{label:j("animation.clip.number"),value:t.number,onChange:r=>{t.number=r,_.updateEvents([t])}}),n==="string"&&V.jsx(et,{label:j("animation.clip.string"),value:t.string,onChange:r=>{t.string=r,_.updateEvents([t])}})]})}),Se=X(function(){const t=it("animationClipStore"),{selectedEvent:n}=t;return n?V.jsx(mt,{title:j("animation.clip.event"),defaultOpen:!0,children:V.jsx(V.Fragment,{children:V.jsx(Ae,{})})}):null});var xe=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,N=(_,t,n,r)=>{for(var e=r>1?void 0:r?Me(t,n):t,a=_.length-1,o;a>=0;a--)(o=_[a])&&(e=(r?o(t,n,e):o(e))||e);return r&&e&&xe(t,n,e),e};const Ve=ft(gt,{position:"absolute",top:0,left:0,margin:"auto",width:"100%",height:228,alignItems:"center",justifyContent:"center"});class $ extends Ce{constructor(){super();g(this,"frameTime",0);g(this,"duration",0);g(this,"playing",!1);g(this,"_clip");g(this,"_updateComponent");g(this,"animationNames");g(this,"overridePreviewer",X(({asset:n,viewer:r})=>V.jsx(V.Fragment,{children:n.isSubAsset||n.root.sceneUIStore.lastSelectedId?V.jsx(Pt,{asset:n,viewer:r}):V.jsx(Ve,{children:V.jsx(V.Fragment,{children:j("animation.clip.select-entity-preview")})})})));st(this)}selectAnimation(n){}async setViewAsset(n,r){var o,s;let e;if(n.isSubAsset){const i=await n.root.assetStore.getAssetByRef({refId:n.mainId}),{defaultSceneRoot:c}=i.engineObject;e=((o=n.root.sceneStore.lastSelectedEntity)==null?void 0:o.engineObject)||c}else e=(s=n.root.sceneStore.lastSelectedEntity)==null?void 0:s.engineObject;if(!e)return;this._clip=n.engineObject,this.animationNames=[n.name],this._entity=e.clone(),r.addChild(this._entity);const a=this;this._updateComponent=this._entity.addComponent(class extends ot{onUpdate(i){a._onUpdate(100/3)}}),this.frameTime=0,this.duration=this._clip.length}stopViewAsset(){var n;super.stopViewAsset(),this.frameTime=0,this.pauseAnimation(),(n=this._updateComponent)==null||n.destroy()}setFrameTime(n){this.frameTime=n,this._sampleAnimation()}playAnimation(){this._clip&&(this.playing=!0)}pauseAnimation(){this.playing=!1}_onUpdate(n){!this.playing||!this._clip||!this.duration||(this.frameTime+=n/1e3,this.frameTime>this.duration&&(this.frameTime%=this.duration),this._sampleAnimation())}_sampleAnimation(){try{this._clip._sampleAnimation(this._entity,this.frameTime)}catch(n){console.warn(n)}}}N([D],$.prototype,"frameTime",2);N([D],$.prototype,"duration",2);N([D],$.prototype,"playing",2);N([E],$.prototype,"setViewAsset",1);N([E],$.prototype,"setFrameTime",1);N([E],$.prototype,"playAnimation",1);N([E],$.prototype,"pauseAnimation",1);N([E],$.prototype,"_onUpdate",1);const K=new Map([[_t,"Transform"],[vt,"Animator"],[bt,"DirectLight"],[Ct,"Camera"],[Tt,"MeshRenderer"],[wt,"SkinnedMeshRenderer"],[Et,"ParticleRenderer"],[At,"PointLight"],[St,"SpotLight"],[ot,"Script"],[xt,"SpriteMask"],[Mt,"SpriteRenderer"],[Vt,"TextRenderer"],[It,"UITransform"],[Ot,"UICanvas"],[jt,"UIGroup"],[Bt,"Button"],[Rt,"Image"],[Ft,"Text"],[Dt,"DynamicCollider"],[Lt,"StaticCollider"],[$t,"CharacterController"],[Kt,"SpringJoint"],[Nt,"FixedJoint"],[kt,"HingeJoint"],[zt,"AudioSource"],[Ut,"PostProcess"],[Ee,"SpineAnimationRenderer"],[we,"LottieAnimation"]]);var Ie=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,T=(_,t,n,r)=>{for(var e=r>1?void 0:r?Oe(t,n):t,a=_.length-1,o;a>=0;a--)(o=_[a])&&(e=(r?o(t,n,e):o(e))||e);return r&&e&&Ie(t,n,e),e};const Z=new Map([[y.Float,{curveClass:Gt,name:"AnimationFloatCurve",defaultInterpolation:I.Hermite}],[y.FloatArray,{curveClass:Ht,name:"AnimationFloatArrayCurve",defaultInterpolation:I.Hermite}],[y.Vector2,{curveClass:Qt,name:"AnimationVector2Curve",defaultInterpolation:I.Hermite}],[y.Vector3,{curveClass:Jt,name:"AnimationVector3Curve",defaultInterpolation:I.Hermite}],[y.Vector4,{curveClass:Wt,name:"AnimationVector4Curve",defaultInterpolation:I.Hermite}],[y.Quaternion,{curveClass:Yt,name:"AnimationQuaternionCurve",defaultInterpolation:I.Hermite}],[y.Color,{curveClass:qt,name:"AnimationColorCurve",defaultInterpolation:I.Hermite}],[y.ReferResource,{curveClass:Xt,name:"AnimationRefCurve",defaultInterpolation:I.Step}],[y.Rect,{curveClass:Zt,name:"AnimationRectCurve",defaultInterpolation:I.Step}],[y.Boolean,{curveClass:te,name:"AnimationBoolCurve",defaultInterpolation:I.Step}],[y.String,{curveClass:ee,name:"AnimationStringCurve",defaultInterpolation:I.Step}],[y.Array,{curveClass:re,name:"AnimationArrayCurve",defaultInterpolation:I.Hermite}]]),ct=new Map;Z.forEach((_,t)=>{ct.set(_.curveClass,t)});const lt=new Map;Z.forEach(_=>{lt.set(_.curveClass,_.name)});let C=class extends ne{constructor(t){super(t);g(this,"samples",60);g(this,"properties",[]);g(this,"pathPropertyMap",new Map);g(this,"keyframeDataList",[]);g(this,"events",{});g(this,"data");g(this,"selectedEventId");g(this,"rootEntityId");g(this,"showEditor");g(this,"readOnly",!1);g(this,"_propertyCurveMap",{});g(this,"_originValueStore",new Map);g(this,"_initKeyframeDataPromise");g(this,"_parseKeyframeValuePromise");g(this,"_colorList",["#3477FA","#67FEBB","#C201BF","#F6ED17","#FE6C02","#FD86C2","#A2B44B","#68D8F0","#008225","#A56A02"]);g(this,"_colorIndex",0);g(this,"_openIndex",0);g(this,"_componentsChangedListenerDisposer");g(this,"_propertyPathCache",new Map);g(this,"_propertyLabelMap",new Map);g(this,"_editorPathCache",new Map);st(this),this.onDoubleClick=this.onDoubleClick.bind(this)}get rootEntity(){return this.root.sceneStore.entities.get(this.rootEntityId)}get addedPropertiesTreeData(){return this.properties.map(t=>this._convertPropertyToTreeItem(t))}persistMainViaFacade(){this.root.assetFacade.persistAssetMain(this.id)}persistMetaViaFacade(){this.root.assetFacade.persistAssetMeta(this.id)}addProperty(t){const{type:n,parentProperty:r}=t,e=F(t),a=this.pathPropertyMap.get(e),o=this.properties;let s;if(a)W.error(j("animation.clip.error.property-existed"));else{if(n===O.Property)s=this._addPropertyToList(o,t,null);else{const i=o.find(c=>c.propertyPath===r.propertyPath&&c.relativePath===r.relativePath&&c.componentType===r.componentType);if(i)i.properties.find(p=>p.path===e)?W.error(j("animation.clip.error.sub-property-existed")):s=this._addPropertyToList(i.properties,t,i);else{const c=this._addPropertyToList(o,r,null,!1);s=this._addPropertyToList(c.properties,t,c)}}return this._sortProperties(),this.properties=o.slice(0),this._updateCurveBindings(),this.persistMetaViaFacade(),this.persistMainViaFacade(),s}}delProperty(t){const n=new Set;t.forEach(r=>{if(n.add(r.path),this.pathPropertyMap.delete(r.path),r.type===O.Property)r.properties.forEach(e=>{n.add(e.path),this.pathPropertyMap.delete(e.path)}),this._delPropertyFromList(this.properties,r);else{const e=this.properties.find(a=>a.path===r.parentPath);e&&(this._delPropertyFromList(e.properties,r),e.hasSubProperty&&!e.properties.length&&this._delPropertyFromList(this.properties,e))}}),this._sortProperties(),this.properties=this.properties.slice(0),this._removeCurveBindings(n),this._updateCurveBindings(),this.updateKeyframes(this.keyframeDataList.filter(r=>!n.has(r.path))),this.persistMetaViaFacade(),this.persistMainViaFacade()}async addKeyframe(t,n){const{rootEntity:r}=this,e=this.pathPropertyMap.get(n),{type:a,path:o,parentPath:s,properties:i,supported:c}=e;if(!c){W.error(j("animation.clip.error.property-not-supported"));return}const p=a===O.SubProperty?this.pathPropertyMap.get(s):null,{editorReference:h,editorPropertyPath:u,propertyPos:d}=await this._getReferenceAndActualPropertyPath(r,e),l=u[d],m=G(h)[l];let f=h[l];m!=null&&m.getActualEditorValue&&(f=m.getActualEditorValue(f));let A=e.valueType;a===O.Property&&(m!=null&&m.valueType)&&(A=m.valueType),a===O.SubProperty&&(f=f[u[d+1]]);const P=Y(f);if(i.length)i.forEach(b=>{const{path:v}=b,w=P[b.name],S=this.keyframeDataList.find(M=>M.path===v&&M.frame===t);if(S)S.value=w,S.inTangentMode=x.Linear,S.outTangentMode=x.Linear;else{const M=this._createKeyframeData(t,w,b.valueType,void 0,void 0,b,e);this.keyframeDataList.push(M)}});else{const b=this.keyframeDataList.find(v=>v.path===o&&v.frame===t);if(b)b.value=P,b.inTangent=void 0,b.outTangent=void 0;else{const v=this._createKeyframeData(t,P,A,void 0,void 0,e,a===O.SubProperty?p:null);this.keyframeDataList.push(v)}}this.updateKeyframes(this.keyframeDataList)}addKeyframeByRecording(t,n){const r=this._ensurePropertyExists(n);r&&this.addKeyframe(t,r.path)}deleteKeyframes(t){t.forEach(n=>{const r=this.keyframeDataList.indexOf(n);r>-1&&this.keyframeDataList.splice(r,1)}),this.updateKeyframes(this.keyframeDataList)}updateKeyframes(t,n=!0){const r={};t.length&&t.sort((e,a)=>e.frame-a.frame),t.forEach(e=>{const a=e.path;r[a]??(r[a]=[]),r[a].push(e),r[a].sort((o,s)=>o.frame-s.frame)});for(const e in r)for(let a=0,o=r[e].length;a<o;++a){const s=r[e][a];if(s.interpolationType===I.Step)continue;const i=r[e][a-1],c=r[e][a+1];s.isFirst=a===0,s.isLast=a===o-1,a>0&&(s.frame-i.frame===0?s.linearInTangent=0:s.linearInTangent=(s.value-i.value)/((s.frame-i.frame)/this.samples),s.inTangent=s.inTangentMode===x.Linear?s.linearInTangent:s.inTangent,isNaN(s.inTangent)&&(s.inTangent=-1/0)),a<o-1&&(c.frame-s.frame===0?s.linearOutTangent=0:s.linearOutTangent=(c.value-s.value)/((c.frame-s.frame)/this.samples),s.outTangent=s.outTangentMode===x.Linear?s.linearOutTangent:s.outTangent,isNaN(s.outTangent)&&(s.outTangent=-1/0))}this.keyframeDataList=t.slice(0),this.isSubAsset||(this._generateEngineKeyframes(t),n&&this.persistMainViaFacade())}addEvent(t){const n={id:q(),time:t/this.samples,functionName:"onEvent"};this.events[n.id]=n,this.updateEvents(this.events)}deleteEvent(t){delete this.events[t.id],this.updateEvents(this.events)}updateEvents(t,n=!0){const r=this.engineObject;if(this.events={...t},r.clearEvents(),Object.values(this.events).map(e=>{const a=e.paramType==="string"?e.string:e.number;r.addEvent(e.functionName,e.time,a)}),this.data.events=Object.values(this.events).map(e=>({time:e.time,functionName:e.functionName,parameter:e.paramType==="string"?e.string:e.number})),n){const{isSubAsset:e}=this;if(e){const{assets:a}=this.root.assetStore,o=a[this.mainId];if(o){const s=o.engineObject.animations.indexOf(this._engineObject);o.updateAnimationEvents(s,this.data.events)}}this.persistMainViaFacade()}}updateSamples(t){this.samples=+t.toFixed(0)}updateRootEntity(t){if(!(!t||t.id===this.rootEntityId)){if(this.rootEntityId=t.id,this.engineObject){this._clearPropertyMappings();const n=this._init().then(async()=>{await this._generateKeyframeDataList(),await this._updateCurveBindings(),this.showEditor&&(await this.saveEditorOriginValue(),await this.sampleAnimation(this.root.animationClipStore.currentFrame))}).catch(r=>{console.warn("AnimationClipAsset:updateRootEntity rebuild failed",this.name,r)});this._initKeyframeDataPromise=n}this._listenRootEntityChanged(),this.persistMetaViaFacade()}}setTangentMode(t,n,r){t.forEach(e=>{if(n===ae.In)switch(e.inTangentMode=r,r){case x.Linear:e.inTangent=e.linearInTangent;break;case x.Constant:e.inTangent=-1/0;break;case x.Free:break}else switch(e.outTangentMode=r,r){case x.Linear:e.outTangent=e.linearOutTangent;break;case x.Constant:e.outTangent=-1/0;break;case x.Free:break}}),this.persistMetaViaFacade(),this.updateKeyframes(this.keyframeDataList)}async checkPropertiesSupport(t){const{properties:n}=this;let r=!1;const e=n.map(async a=>{const o=!!a.supported,{editorReference:s}=await this._getReferenceAndActualPropertyPath(t,a);s?a.supported=!0:a.supported=!1,!o&&a.supported&&(r=!0)});await Promise.all(e),r&&(this.properties=this.properties.slice(0),await this._generateKeyframeDataList(),this.updateKeyframes(this.keyframeDataList,!1),await this.saveEditorOriginValue(),await this.sampleAnimation(this.root.animationClipStore.currentFrame))}updateSelectedEvent(t){this.selectedEventId=t}async openEditor(t){if(t&&!this.showEditor){this._initKeyframeDataPromise||(this._initKeyframeDataPromise=this._generateKeyframeDataList()),this.showEditor=t,this.root.projectStore.animationEditing=t;const n=++this._openIndex;if(await this._initKeyframeDataPromise,n!==this._openIndex)return;this.saveEditorOriginValue(),this.sampleAnimation(this.root.animationClipStore.currentFrame),rt()}!t&&this.showEditor&&(this.showEditor=t,this.root.projectStore.animationEditing=t,this.revertValue())}async sampleAnimation(t){const n=this.rootEntity;if(n){const r=n.engineObject;try{await this._parseKeyframeValuePromise,this.engineObject._sampleAnimation(r,t/this.samples),this._syncToEditor()}catch(e){console.warn(e)}}}async saveEditorOriginValue(){const{_originValueStore:t}=this,{curveBindings:n}=this.engineObject,r=n.map(async e=>{const{relativePath:a,type:o,property:s}=e,i=K.get(o),{editorReference:c,editorPropertyPath:p,propertyPos:h}=await this._getReferenceAndActualPropertyPath(this.rootEntity,{relativePath:a,componentType:i,propertyPath:s});if(!c)return;const u=p[h];if(!t.has(e)){let d=u;u==="rotationQuaternion"&&(d="rotation"),t.set(e,Y(c[d]))}});await Promise.all(r)}async revertValue(){const{_originValueStore:t}=this,n=Array.from(t).map(async([r,e])=>{const{relativePath:a,type:o,property:s}=r,i=K.get(o),{editorReference:c,editorPropertyPath:p,propertyPos:h}=await this._getReferenceAndActualPropertyPath(this.rootEntity,{relativePath:a,componentType:i,propertyPath:s});if(!c)return;const u=p[h];let d=u;u==="rotationQuaternion"&&(d="rotation"),this._setEditorValue(c,d,e)});await Promise.all(n),t.clear()}async initByMain(t){const{engine:n,meta:r}=this;r.rootEntityId&&(this.rootEntityId=r.rootEntityId),this._listenRootEntityChanged();try{const e=JSON.parse(await t.text()),a=pt(e,{type:"AnimationClip",name:e.name}),o=await se(a,n);this.bindEngineObject(o),await this._init()}catch(e){console.error(`[AnimationClipAsset] Failed to load "${this.name}"`,e)}}async initByEngineObject(t){this.bindEngineObject(t),this._name=t.name,await this._init()}async initByCreation(t,n){this.setNameByIncrease(n||"AnimationClip");const r=new oe(this.name);return this.bindEngineObject(r),this.data={name:this.name,curveBindings:r.curveBindings,events:[]},await this._init(),this.getMainData()}_clearPropertyMappings(){this.pathPropertyMap.clear(),this._propertyCurveMap={},this._propertyPathCache.clear(),this._propertyLabelMap.clear(),this._editorPathCache.clear(),this.properties.length=0,this._colorIndex=0,this._originValueStore.clear()}_sortProperties(){this.properties.sort((t,n)=>(t.level??0)-(n.level??0))}async _init(){const t=this.engineObject;this._clearPropertyMappings();const r=(await this._groupCurveBindingsByParent(t.curveBindings)).map(async a=>{if(await this._generatePropertiesFromBindingGroup(a),this.isSubAsset)return Promise.resolve();const o=a.bindings.flatMap(s=>{const{curve:i}=s;return i.keys.map(c=>this._editorValueToEngineValue(c.value,this._getValueTypeByCurve(i)).then(p=>{c.value=p}))});return Promise.all(o)});if(!this.isSubAsset){const{properties:a,pathPropertyMap:o}=this;a.forEach(s=>{s.properties.length||this._colorIndex++,o.set(s.path,s),s.properties.forEach(i=>{this._colorIndex++,o.set(i.path,i)})})}await Promise.all(r),this._sortProperties();const e={};t.events.forEach(a=>{const o=q(),s=a.parameter?typeof a.parameter:"null";e[o]={id:o,time:a.time,functionName:a.functionName,paramType:s,string:s==="string"?a.parameter:void 0,number:s==="number"?a.parameter:void 0}}),this.data={name:t.name,curveBindings:t.curveBindings,events:[]},this.updateEvents(e,!1)}async onDoubleClick(){Te(this.root,"AnimationClip",{afterOpen:()=>{rt()}})}getMainData(){const t=this.data,n={...t,curveBindings:t.curveBindings.map(r=>{const{curve:e}=r,a=lt.get(e.constructor);return{...r,type:K.get(r.type)||r.type,curveType:a,curve:{interpolation:e.interpolation,keys:e.keys.map(o=>{const s=o.value,i=s instanceof nt?this.root.assetStore.engineObjectToAssetMap.get(s).getCurrentRef():s;return{...o,value:Y(i)}})}}})};return JSON.stringify(n)}async _syncToEditor(){const t=this.rootEntity,{curveBindings:n}=this.engineObject,r=n.map(async e=>{const{relativePath:a,type:o,property:s,getProperty:i}=e,c=K.get(o);if(!e.curve.keys.length)return;const p=await this._getActualPropertyPath(i??s,a,c),{editorReference:h,engineGetReference:u,editorPropertyPath:d,enginePropertyGetPath:l,propertyPos:m}=await this._getReferenceAndActualPropertyPath(t,{relativePath:a,componentType:c,propertyPath:p});if(!u||!h)return;const f=F({relativePath:a,componentType:c,propertyPath:d.slice(0,m+1).join(".")}),A=this.pathPropertyMap.get(f);let P=d[m],b=this._getEngineValue(u,l[m]),v=A.valueType;P==="rotationQuaternion"&&(P="rotation",b=b.toEuler(new at).scale(180/Math.PI),v=y.Vector3);const w=this._engineValueToEditorValue(b,v,!1);this._setEditorValue(h,P,w)});await Promise.all(r)}async _setEditorValue(t,n,r){var o,s;const e=(o=ie(t))==null?void 0:o[n],a=(s=G(t))==null?void 0:s[n];if(a!=null&&a.getEditorValue&&(r=a.getEditorValue(r)),a!=null&&a.setActualEditorValue?a==null||a.setActualEditorValue(t,n,r):t[n]=r,e!=null&&e.onChange){const i=r!=null&&r.refId?await t.root.assetStore.getAssetByRef(r):r;await e.onChange(t,n,i)}}_removeCurveBindings(t){const n=this.engineObject;if(!n)return;const r=new Set;for(const e of t){const a=this._propertyCurveMap[e];a&&(r.add(a),delete this._propertyCurveMap[e])}if(r.size>0){const e=n.curveBindings;for(let a=e.length-1;a>=0;a--){const o=e[a];r.has(o.curve)&&(e.splice(a,1),this._originValueStore.delete(o))}}}async _updateCurveBindings(){var n;const t=this.rootEntity;if(t)for(const r of this.properties)try{const{relativePath:e,componentType:a,valueType:o,properties:s,interpolationType:i}=r,c=F(r),p=await this._getReferenceAndActualPropertyPath(t,r),{editorReference:h,enginePropertySetPath:u,enginePropertyGetPath:d,editorPropertyPath:l,propertyPos:m}=p||{};if(!h||!u||!d||m===void 0)continue;const f=l[m],A=(n=G(h))==null?void 0:n[f],P=u.join("."),b=d.join(".");if(s.length)for(const v of s){const w=F(v),S=this._createCurve(w,v.valueType,v.interpolationType),M=v.name;await this._addCurveBinding(e,a,`${P}.${M}`,`${b}.${M}`,S),this._propertyCurveMap[w]=S}else{let v=o;A!=null&&A.valueType&&(v=A.valueType);const w=this._createCurve(c,v,i);await this._addCurveBinding(e,a,P,b,w),this._propertyCurveMap[c]=w}}catch(e){console.warn("updateCurveBindings skipped property (unresolved):",r==null?void 0:r.propertyPath,e);continue}}_createCurve(t,n,r){let e=this._propertyCurveMap[t];if(!e){const a=Z.get(n);a?(e=new a.curveClass,e.interpolation=r??a.defaultInterpolation):console.warn(`Unsupported curve value type: ${n}`)}return e}async _addCurveBinding(t,n,r,e,a){const o=pe.getClass(n),s=this.engineObject;let i=!0;for(let c=0,p=s.curveBindings.length;c<p;++c){const h=s.curveBindings[c];h.relativePath===t&&h.type===o&&h.property===r&&h.getProperty===e&&(h.curve=a,i=!1)}i&&(s.addCurveBinding(t,o,r,e,a),await this.saveEditorOriginValue())}_addPropertyToList(t,n,r,e=!0){var i;const a=this._covertToPropertyData(n,r),o=t.push(a),s=t[o-1];return this.pathPropertyMap.set(s.path,s),e&&((i=n.children)!=null&&i.length)&&n.children.forEach(c=>{this._addPropertyToList(s.properties,c,s,e)}),s}_delPropertyFromList(t,n){const r=t.findIndex(e=>e.path===n.path);r>-1&&(t.splice(r,1),this.pathPropertyMap.delete(n.path))}_covertToPropertyData(t,n){const{name:r,label:e,relativePath:a,componentType:o,propertyPath:s,type:i,valueType:c,interpolationType:p,children:h}=t,u=F(t),d=F(n),l=a.split("/").length-1;return{name:e||r,level:l,path:u,type:i,valueType:c,interpolationType:p,propertyPath:s,componentType:o,relativePath:a,hasSubProperty:h.length>0,curveColor:c===y.Float?this._getRandomColor():null,supported:!0,properties:[],parentPath:d}}async _getReferenceAndActualPropertyPath(t,n){if(!t)return{};const{relativePath:r,componentType:e,propertyPath:a}=n,o=t.findByPath(r);if(!o)return{};const s=o.getComponentByTypeName(e);if(!s)return{};const i=[],c=[],p=[],h=a.split("."),u=h.length-1;let d=-1,l=s;for(let P=0,b=u;P<=b;++P){const v=h[P];if(!l)return{};const w=G(l);let S="",M=v,k=v,z=v,R=P;for(let B=P,Q=u;B<=Q;++B){S+=h[B];const J=(w==null?void 0:w[S])||{},{getPath:U,setPath:L,editorKey:tt}=J;L&&(k=L,R=B),(U||L)&&(B===u&&L?k=L:k=U??L,z=U??L,R=B),tt&&(M=tt,R=B),B<u&&(S+=".")}P=R,c.push(k),p.push(z),i.push(M),ce(l,M)&&(d=i.length-1),P<u&&(l=l[M],l!=null&&l.refId&&(l=await this.root.assetStore.getAssetByRef(l)))}const m=d>-1?d-1:i.length-1;l=s;for(let P=0,b=m;P<b;++P)l=l[i[P]],l!=null&&l.refId&&(l=await this.root.assetStore.getAssetByRef(l));const f=this._getEngineValue(s.engineObject,c.slice(0,m).join(".")),A=this._getEngineValue(s.engineObject,p.slice(0,m).join("."));return{editorReference:l,engineSetReference:f,engineGetReference:A,enginePropertySetPath:c,enginePropertyGetPath:p,editorPropertyPath:i,propertyPos:m,subPropertyPos:d}}_getEngineValue(t,n){if(!n)return t;let r=t;const e=n.split(".");for(let a=0,o=e.length;a<o;a++){const s=e[a];if(s.indexOf("[")>-1){const i=s.indexOf("[");r=r[s.slice(0,i)],r=r[parseInt(s.slice(i+1,-1))]}else if(s.endsWith(")")){const i=s.slice(0,s.indexOf("(")),c=s.match(/\w+\(([^)]*)\)/)[1].split(",").map(p=>p.trim().replace(/['"]+/g,"")).filter(p=>p!=="");r=r[i](...c)}else r=r[s]}return r}async _generateKeyframeDataList(){const t=this.engineObject,n=[],r=this.pathPropertyMap,e=t.curveBindings.map(async a=>{const{relativePath:o,type:s,getProperty:i,property:c,curve:p}=a,h=K.get(s),u=i??c,d=await this._convertPropertyProxyPath(u,h,o),m=F({relativePath:o,componentType:h,propertyPath:d||u});d||console.warn(`无法转换引擎路径到编辑器路径: ${u},使用原路径`);const f=r.get(m);if(!f){d&&console.warn(`转换后的路径仍未找到属性定义: ${m}, 原引擎路径: ${u}`);return}this._propertyCurveMap[m]=p;const A=f.valueType;p.keys.forEach(P=>{const{time:b,value:v,inTangent:w,outTangent:S}=P,M=Math.floor(b*this.samples),k=this._engineValueToEditorValue(v,A,!0),z=this._getSubProperties(A,p);if(z)z.forEach(R=>{const B=`${m}.${R}`,Q=r.get(B),J=w&&w[R],U=S&&S[R],L=this._createKeyframeData(M,k[R],y.Float,J,U,Q,f);n.push(L)});else{const R=r.get(f.parentPath),B=this._createKeyframeData(M,k,A,w,S,f,R);n.push(B)}})});await Promise.all(e),this.updateKeyframes(n,!1)}_createKeyframeData(t,n,r,e,a,o,s){const{path:i,curveColor:c}=o,{path:p=""}=s||{};return{id:q(),frame:t,path:i,value:n,isActive:!0,valueType:r??y.Float,curveColor:c,parentPath:p,inTangent:e,outTangent:a,interpolationType:o.interpolationType,inTangentMode:e===void 0?x.Linear:e===-1/0?x.Constant:x.Free,outTangentMode:a===void 0?x.Linear:a===-1/0?x.Constant:x.Free}}_generateEngineKeyframes(t){const{_propertyCurveMap:n,samples:r,engineObject:e}=this,a=this._groupKeyframesByPath(t),s=this._collectPathsToSync(n,a).map(i=>this._syncCurveForPath(i,n[i],a.get(i)||[],r,e));this._parseKeyframeValuePromise=Promise.all(s)}_groupKeyframesByPath(t){return t.reduce((n,r)=>{const e=n.get(r.path)||[];return e.push(r),n.set(r.path,e),n},new Map)}_collectPathsToSync(t,n){const r=new Set;return Object.keys(t).forEach(e=>r.add(e)),n.forEach((e,a)=>r.add(a)),Array.from(r)}async _syncCurveForPath(t,n,r,e,a){if(!n)return;const o=await this._convertToEngineKeyframes(r,e);this._removeObsoleteKeyframes(n,o),this._addOrUpdateKeyframes(n,o,a)}async _convertToEngineKeyframes(t,n){const r=new Map;for(const e of t){const a=e.frame/n,o=await this._editorValueToEngineValue(e.value,e.valueType);o===void 0&&e.valueType===y.ReferResource||r.set(a,{value:o,inTangent:e.inTangent,outTangent:e.outTangent})}return r}_removeObsoleteKeyframes(t,n){const r=new Set(n.keys());for(let e=t.keys.length-1;e>=0;e--){const a=t.keys[e];r.has(a.time)||t.keys.splice(e,1)}}_addOrUpdateKeyframes(t,n,r){const e=new Map;t.keys.forEach(a=>{e.set(a.time,a)});for(const[a,{value:o,inTangent:s,outTangent:i}]of n){const c=e.get(a);if(c)c.value=o,c.inTangent=s,c.outTangent=i;else{const p=new be;p.time=a,p.value=o,p.inTangent=s,p.outTangent=i,t.addKey(p)}a>r._length&&(r._length=a)}}async _editorValueToEngineValue(t,n){var r;switch(n){case y.ReferResource:return t!=null&&t.refId?(r=await this.root.assetStore.getAssetByRef(t))==null?void 0:r.engineObject:t;case y.Color:return new de(t.r,t.g,t.b,t.a);case y.Vector2:return new ye(t.x,t.y);case y.Vector3:return new at(t.x,t.y,t.z);case y.Vector4:return new ue(t.x,t.y,t.z,t.w);case y.Quaternion:return new he(t.x,t.y,t.z,t.w);case y.Rect:return new le(t.x,t.y,t.width,t.height);case y.Float:return t;default:return t}}_engineValueToEditorValue(t,n,r){var a,o,s;let e;switch(n){case y.MethodParam:{if(e=[],r)for(let i=0,c=t.length;i<c;i++){const p=t[i];e[i]??(e[i]=[]);for(let h=0,u=p.length;h<u;h++){const d=p[h];e[i][h]=((a=this.root.assetStore.engineObjectToAssetMap.get(d))==null?void 0:a.getCurrentRef())??d}}else t&&t instanceof nt?e=[[((o=this.root.assetStore.engineObjectToAssetMap.get(t))==null?void 0:o.getCurrentRef())??t]]:t instanceof Array?e=t:e=[[t]];break}case y.ReferResource:{e=(s=this.root.assetStore.engineObjectToAssetMap.get(t))==null?void 0:s.getCurrentRef();break}case y.Color:{e={r:t.r,g:t.g,b:t.b,a:t.a},["r","g","b","a"].forEach(i=>{e[i]=Math.round(e[i]*1e3)/1e3});break}case y.Vector2:{e={x:t.x,y:t.y},["x","y"].forEach(i=>{e[i]=Math.round(e[i]*1e3)/1e3});break}case y.Vector3:{e={x:t.x,y:t.y,z:t.z},["x","y","z"].forEach(i=>{e[i]=Math.round(e[i]*1e3)/1e3});break}case y.Vector4:case y.Quaternion:{e={x:t.x,y:t.y,z:t.z,w:t.w},["x","y","z","w"].forEach(i=>{e[i]=Math.round(e[i]*1e3)/1e3});break}case y.Rect:{e={x:t.x,y:t.y,width:t.width,height:t.height},["x","y","width","height"].forEach(i=>{e[i]=Math.round(e[i]*1e3)/1e3});break}case y.Float:{e=Math.round(t*1e3)/1e3;break}default:e=t}return e}_getValueTypeByCurve(t){return ct.get(t.constructor)}_parsePropertyPath(t){const n=this._propertyPathCache.get(t);if(n)return n;const r=t.lastIndexOf("."),e=r===-1?{parentPath:t,subProperty:null}:{parentPath:t.substring(0,r),subProperty:t.substring(r+1)};return this._propertyPathCache.set(t,e),e}_isSubPropertyName(t){return/^([xyzw]|[rgba]|width|height)$/.test(t)}async _convertPropertyProxyPath(t,n,r){try{const e=this._resolveProxyHost(n,r,t);if(!e)return null;const a=`${r}|${n}|${t}`;if(this._editorPathCache.has(a))return this._editorPathCache.get(a);const o=await this._recursiveConvert(t,e,0);return o&&o!==t&&await this._buildLabelMappingsForPath(o,r,n,e),this._editorPathCache.set(a,o??null),o}catch{const a=`${r}|${n}|${t}`;return this._editorPathCache.set(a,null),null}}async _buildLabelMappingsForPath(t,n,r,e){try{const a=await this._getReferenceAndActualPropertyPath(this.rootEntity,{relativePath:n,componentType:r,propertyPath:t}),o=(a==null?void 0:a.editorPropertyPath)||t.split("."),s=typeof(a==null?void 0:a.propertyPos)=="number"?a.propertyPos:o.length-1;for(let i=0;i<=s;i++){const c=o.slice(0,i+1).join("."),p=F({relativePath:n,componentType:r,propertyPath:c});if(!this._propertyLabelMap.has(p)){const h=await this._extractLabelForPartialPath(c,e);h&&this._propertyLabelMap.set(p,h)}}}catch(a){console.warn("建立标签映射失败:",a)}}async _extractLabelForPartialPath(t,n){try{const r=t.split("."),e=r[r.length-1];let a=n,o=null;for(let s=0;s<r.length;s++){const i=r[s],c=a==null?void 0:a[H];if(c&&c[i]){const p=c[i];p.label&&(o=p.label),s<r.length-1&&(a=await this._getNextObject(a,i))}else break}return o||e}catch{return t.split(".").pop()||t}}async _recursiveConvert(t,n,r){if(r>6)return t;const e=n[H];if(!e)return t;for(const[a,o]of Object.entries(e)){if(!this._isPathMatch(t,o))continue;const s=o.getPath||o.setPath;if(s){if(s.endsWith("()")&&t.startsWith(s+".")){const i=t.substring(s.length+1),c=await this._getNextObject(n,a);if(!c)return`${a}.${i}`;const p=await this._recursiveConvert(i,c,r+1);return p?`${a}.${p}`:`${a}.${i}`}return this._buildEditorPath(a,t,o)}}return t}async _getNextObject(t,n){var r;try{let e=t[n];if(!e){const a=`get${n.charAt(0).toUpperCase()+n.slice(1)}`;typeof t[a]=="function"&&(e=t[a]())}if(e!=null&&e.refId&&((r=this.root)!=null&&r.assetStore)){let a=this.root.assetStore.engineObjectToAssetMap.get(e);if(!a)try{a=await this.root.assetStore.getAssetByRef(e)}catch{return e}if(a)return a}return e}catch{return null}}_resolveProxyHost(t,n,r){try{if(!this.rootEntity)return null;const e=n?this.rootEntity.findByPath(n):this.rootEntity;if(!e)return null;const a=e.getComponentByTypeName(t);return a?r?this._resolvePropertyProxyHolder(a,r):a:null}catch(e){return console.warn(`获取代理宿主失败: ${t}, ${n}`,r,e),null}}_resolvePropertyProxyHolder(t,n){try{const r=[t];this._addRelatedObjectCandidates(t,r);for(const e of r)if(this._hasMatchingProxyConfig(e,n))return e;return t}catch(r){return console.warn(`解析 PropertyProxy 持有者失败: ${n}`,r),t}}_addRelatedObjectCandidates(t,n){try{const r=t[H];if(!r)return;const e=new Set;for(const a of Object.values(r)){const o=this._extractObjectPathFromConfig(a);o&&e.add(o)}for(const a of e){const o=this._getEngineValue(t.engineObject,a);if(o){const s=this.root.assetStore.engineObjectToAssetMap.get(o);s&&!n.includes(s)&&n.push(s)}}}catch{}}_extractObjectPathFromConfig(t){const n=t.getPath||t.setPath;if(!n)return null;const r=n.match(/^([^.]+\([^)]*\))/);return r?r[1]:null}_hasMatchingProxyConfig(t,n){const r=t[H];if(!r)return!1;for(const e of Object.values(r))if(this._isPathMatch(n,e))return!0;return!1}_isPathMatch(t,n){return n?n.getPath&&this._isExactPathMatch(t,n.getPath)||n.setPath&&this._isExactPathMatch(t,n.setPath)||n.engineKey&&t.includes(n.engineKey):!1}_isExactPathMatch(t,n){if(!n)return!1;const r=p=>p.replace(/['"`\s]/g,""),e=p=>{let h="";for(let u=0;u<p.length;u++){const d=p[u];if(d==="("){for(;u<p.length&&p[u]!==")";)u++;h+="()"}else h+=d}return h},a=p=>e(r(p).replace(/\$value/g,"value")),o=a(t),s=a(n);if(o===s||((p,h)=>p.startsWith(h+".")||p.startsWith(h+"["))(o,s))return!0;if(!n.includes(".")&&!n.includes("(")&&!n.includes("[")){const p=o.split(".");for(const h of p){const u=h.indexOf("[");if((u>=0?h.slice(0,u):h)===s)return!0}}return!1}_buildEditorPath(t,n,r){if(!r)return t;const e=r.getPath||r.setPath;if(!e)return t;if(e.endsWith("()")&&n.startsWith(e+".")){const s=n.substring(e.length+1);return`${t}.${s}`}const a=n.replace(/['"`]/g,"").replace(/\$value/g,"value"),o=e.replace(/['"`]/g,"").replace(/\$value/g,"value");if(a.includes(o))return a.replace(o,t);if(!e.includes(".")&&!e.includes("(")){const s=n.match(/\.([a-zA-Z_]\w*)$/);if(s){const i=s[1];if(i!==e)return`${t}.${i}`}}return t}_validateCurveBinding(t){const{relativePath:n,type:r,getProperty:e,property:a}=t;return K.get(r)?e??a?!0:(console.warn(`绑定缺少属性路径: ${n}`),!1):(console.warn(`未知组件类型: ${r},跳过绑定`),!1)}async _groupCurveBindingsByParent(t){const n=new Map;return await Promise.all(t.map(async r=>{if(!this._validateCurveBinding(r))return;const{relativePath:e,type:a,getProperty:o,property:s}=r,i=K.get(a),c=o??s,h=await this._convertPropertyProxyPath(c,i,e)||c,u=this._parsePropertyPath(h),d=u.subProperty&&this._isSubPropertyName(u.subProperty);let l,m;d&&u.subProperty?(m=u.parentPath,l=`${e}.${i}.${m}`):(m=h,l=`${e}.${i}.${h}`),n.has(l)||n.set(l,{parentPath:m,relativePath:e,componentType:i,bindings:[]}),n.get(l).bindings.push(r)})),Array.from(n.values())}_validateAndGetParentValueType(t){if(t.length===1){const l=t[0],m=l.getProperty??l.property,{subProperty:f}=this._parsePropertyPath(m);return!f||!this._isSubPropertyName(f)?null:y.Float}if(!t.every(l=>this._getValueTypeByCurve(l.curve)===y.Float)){const l=t.map(m=>this._getValueTypeByCurve(m.curve));return console.warn(`分组中的绑定类型不一致: ${l.join(", ")},无法创建父属性`),null}const r=t.map(l=>l.curve.interpolation),e=r[0];r.every(l=>l===e)||console.warn(`子属性插值类型不一致: ${r.join(", ")}`);const o=t.map(l=>{const m=l.getProperty??l.property,f=m.lastIndexOf(".");return f===-1?null:m.substring(f+1)}).filter(Boolean).sort(),s=o.join(",");switch(s){case"x,y":return y.Vector2;case"x,y,z":return y.Vector3;case"w,x,y,z":return y.Vector4;case"a,b,g,r":return y.Color;case"height,width,x,y":return y.Rect}const i=new Set(["x","y","z","w"]),c=new Set(["r","g","b","a"]),p=new Set(["x","y","width","height"]),h=o.every(l=>i.has(l)),u=o.every(l=>c.has(l)),d=o.every(l=>p.has(l));return h?o.some(l=>l==="w")?y.Vector4:o.some(l=>l==="z")?y.Vector3:y.Vector2:u?y.Color:d?y.Rect:(console.warn(`无法识别的子属性组合: ${s}`),null)}_validateBindingGroup(t){const{bindings:n}=t;return n.every(r=>this._validateCurveBinding(r))&&this._validateAndGetParentValueType(n)!==null}_createParentProperty(t,n){const{parentPath:r,relativePath:e,componentType:a}=t,o=F({relativePath:e,componentType:a,propertyPath:r}),s=I.Linear,i=this._propertyLabelMap.get(o),c=r.split(".").pop()||r;return{name:i||c,level:e.split("/").length-1,path:o,type:O.Property,valueType:n,interpolationType:s,componentType:a,relativePath:e,hasSubProperty:!0,curveColor:null,supported:!0,properties:[],propertyPath:r}}async _createSubPropertiesFromBindings(t,n,r,e){return Promise.all(t.map(async a=>{const{getProperty:o,property:s,curve:i}=a,c=o??s,p=await this._convertPropertyProxyPath(c,e,r)||c,h=p.lastIndexOf("."),u=h===-1?p:p.substring(h+1),d=`${n}.${u}`,l={name:u,level:r.split("/").length,path:d,type:O.SubProperty,valueType:y.Float,interpolationType:i.interpolation,componentType:e,relativePath:r,hasSubProperty:!1,curveColor:this._getRandomColor(),supported:!0,properties:[],propertyPath:p,parentPath:n};return this.pathPropertyMap.set(d,l),l}))}_registerPropertyGroup(t,n){t.properties=n,this.pathPropertyMap.has(t.path)&&console.warn(`覆盖已存在的属性路径: ${t.path}`),this.pathPropertyMap.set(t.path,t),this.properties.push(t)}async _generatePropertiesFromBindingGroup(t){const{parentPath:n,relativePath:r,componentType:e,bindings:a}=t;if(!this.rootEntity){await Promise.all(a.map(p=>this._generatePropertyByEngineObject(p)));return}const o=await this._convertPropertyProxyPath(n,e,r)||n;if(!this._validateBindingGroup(t)){this.rootEntity&&a.length>1&&console.debug("AnimationClipAsset: grouping skipped",this.name,e,r,n),await Promise.all(a.map(p=>this._generatePropertyByEngineObject(p)));return}const s=this._validateAndGetParentValueType(a);if(s===null){console.error("验证通过但获取不到父属性类型"),await Promise.all(a.map(p=>this._generatePropertyByEngineObject(p)));return}const i=this._createParentProperty({...t,parentPath:o},s),c=await this._createSubPropertiesFromBindings(a,i.path,r,e);this._registerPropertyGroup(i,c)}async _generatePropertyByEngineObject(t){const{pathPropertyMap:n}=this,{relativePath:r,type:e,curve:a,getProperty:o,property:s}=t,i=K.get(e),c=o??s,p=await this._convertPropertyProxyPath(c,i,r)??c,h=this._getValueTypeByCurve(a),u=F({relativePath:r,componentType:i,propertyPath:p}),d=this._propertyLabelMap.get(u),l=p.lastIndexOf("."),m=l===-1?p:p.substring(l+1),f={name:d||m,level:r.split("/").length-1,path:u,type:O.Property,valueType:h,interpolationType:a.interpolation,componentType:i,relativePath:r,hasSubProperty:!1,curveColor:this._getRandomColor(),supported:!0,properties:[],propertyPath:p},A=this._getSubProperties(h,a);A&&(f.curveColor=null,f.hasSubProperty=!0,f.properties=A.map(P=>{const b=`${u}.${P}`,v={name:P,level:r.split("/").length,path:b,type:O.SubProperty,valueType:y.Float,interpolationType:a.interpolation,componentType:i,relativePath:r,hasSubProperty:!1,curveColor:this._getRandomColor(),supported:!0,properties:[],propertyPath:`${p}.${P}`};return n.set(b,v),v})),n.set(u,f),this.properties.push(f)}async _getActualPropertyPath(t,n,r){if(!this.isSubAsset){const{editorPropertyPath:e=[]}=await this._getReferenceAndActualPropertyPath(this.rootEntity,{relativePath:n,componentType:r,propertyPath:t});t=e.join(".")}return t}_getRandomColor(){const{_colorList:t}=this,n=(e,a)=>{const o=parseInt(e.slice(1),16),s=parseInt(a.slice(1),16);return`#${parseInt(`${(o+s)/2}`).toString(16).toUpperCase()}`},r=()=>{const e=[];for(let o=0,s=t.length-1;o<s;o++){const i=n(t[o],t[o+1]);e.push(i)}const a=t.slice(0,t.length-1);for(let o=0,s=a.length+e.length;o<s;o++)t[o]=o%2===0?a[o/2]:e[(o-1)/2]};for(;this._colorIndex>=t.length;)r();return t[this._colorIndex++]}_getSubProperties(t,n){let r;switch(t){case y.Vector2:{r=["x","y"];break}case y.Vector3:{r=["x","y","z"];break}case y.Vector4:{r=["x","y","z","w"];break}case y.Quaternion:{r=["x","y","z","w"];break}case y.Color:{r=["r","g","b","a"];break}case y.Array:case y.FloatArray:n.keys[0]&&(r=Array.from(n.keys[0].value).map((e,a)=>a))}return r}_listenRootEntityChanged(){var n;const t=this.rootEntity;t&&(this.showEditor&&(this.openEditor(!1),this.openEditor(!0)),(n=this._componentsChangedListenerDisposer)==null||n.call(this),this._componentsChangedListenerDisposer=me(()=>t.components.length,()=>{this.checkPropertiesSupport(t),this.engineObject.curveBindings.forEach(r=>{r._tempCurveOwner={}})}))}_convertPropertyToTreeItem(t){var m;const{name:n,label:r,properties:e=[],relativePath:a,componentType:o,path:s,type:i,curveColor:c,supported:p,level:h}=t,u=((m=this.rootEntity.findByPath(a))==null?void 0:m.name)||a.split("/").pop(),d=r||n;return{name:i===O.Property?`${u}:${o}.${d}`:d,id:s,canAddKeyframe:i===O.Property||i===O.SubProperty,curveColor:c,supported:p,level:h,children:e.map(f=>this._convertPropertyToTreeItem(f))}}_ensurePropertyExists(t){const n=F(t);let r=this.pathPropertyMap.get(n);return r||(r=this.addProperty(t)),t.children&&t.children.length&&t.children.forEach(e=>{this._ensurePropertyExists(e)}),r}destroy(){var t;super.destroy(),(t=this._componentsChangedListenerDisposer)==null||t.call(this),this._propertyPathCache.clear(),this.pathPropertyMap.clear(),this._propertyCurveMap={},this._propertyLabelMap.clear(),this._editorPathCache.clear(),this._originValueStore.clear()}};T([D],C.prototype,"samples",2);T([D],C.prototype,"properties",2);T([D],C.prototype,"keyframeDataList",2);T([D],C.prototype,"events",2);T([fe()],C.prototype,"data",2);T([D],C.prototype,"selectedEventId",2);T([D,ge()],C.prototype,"rootEntityId",2);T([D],C.prototype,"readOnly",2);T([Pe],C.prototype,"addedPropertiesTreeData",1);T([E],C.prototype,"addProperty",1);T([E],C.prototype,"delProperty",1);T([E],C.prototype,"addKeyframe",1);T([E],C.prototype,"deleteKeyframes",1);T([E],C.prototype,"updateKeyframes",1);T([E],C.prototype,"addEvent",1);T([E],C.prototype,"deleteEvent",1);T([E],C.prototype,"updateEvents",1);T([E],C.prototype,"updateSamples",1);T([E],C.prototype,"updateRootEntity",1);T([E],C.prototype,"setTangentMode",1);T([E],C.prototype,"checkPropertiesSupport",1);T([E],C.prototype,"updateSelectedEvent",1);T([E],C.prototype,"openEditor",1);C=T([_e({type:"AnimationClip",label:j("asset.animation-clip.title"),icon:"animate-clip",extname:"anim",importMenuConfig:{type:ve.Add},customInspector:Se,viewer:$,async bundle({content:_},t,n){var a;const r=JSON.parse(await _.text());for(const o of r.curveBindings)if(o.curveType==="AnimationRefCurve"){for(const s of o.curve.keys)if((a=s.value)!=null&&a.refId){const i=n.resolveRef(s.value.refId);i&&(s.value=i)}}const e=pt(r,{type:"AnimationClip",name:r.name});return{content:new Blob([e])}}})],C);export{C as A,Se as a,$ as b};
@@ -0,0 +1 @@
1
+ var D=Object.defineProperty;var O=(r,t,a)=>t in r?D(r,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[t]=a;var c=(r,t,a)=>(O(r,typeof t!="symbol"?t+"":t,a),a);import{aQ as x,aR as v,aU as N,aS as _,aP as B,aX as I,j as L,aY as U,aZ as z,a_ as F,x as M,a$ as R,m as A,b0 as V,n as $,e as q,o as J,q as Q,b1 as W}from"./index-1e23212d.js";import{u as X}from"./index-92830754.js";import"./postmen-9e1e15bd.js";import"./meshopt_simplifier.module-cd99529d.js";import{b as Y}from"./bundlers-9b0d37fc.js";import{o as Z}from"./assetEditorActions-c4e5962f.js";const k=x(function(){const{layoutStore:t}=X(),{t:a}=v(),e=N.useCallback(()=>{t.toggleTabVisibility("AnimatorController")},[]);return _.jsx(B,{align:"both",css:{padding:"$1"},fullWidth:!0,children:_.jsx(I,{size:"sm",onClick:e,children:a("animation.animator-controller.editor.open")})})});var G=Object.defineProperty,H=Object.getOwnPropertyDescriptor,y=(r,t,a,e)=>{for(var s=e>1?void 0:e?H(t,a):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(e?n(t,a,s):n(s))||s);return e&&s&&G(t,a,s),s};let d=class extends L{constructor(t){super(t);c(this,"statesNameMap",{});c(this,"internalDataUpdated",!1);c(this,"layers",[]);c(this,"parameters",[]);c(this,"_syncing");c(this,"_syncingPromise");this.onDoubleClick=this.onDoubleClick.bind(this)}applyPropertyFromDomain(t,a){super.applyPropertyFromDomain(t,a),(t==="layers"||t==="parameters")&&this.applyControllerData().catch(e=>{console.error("[AnimatorControllerAsset] applyControllerData failed:",e)})}initByEngineObject(t){return this.setNameByIncrease("AnimatorController"),this.bindEngineObject(t),this.layers=t.layers.map(a=>{const e=a.stateMachine,o={states:e.states.map(n=>({name:n.name,speed:n.speed,wrapMode:n.wrapMode,clipStartNormalizedTime:n.clipStartTime,clipEndNormalizedTime:n.clipEndTime,clip:this.root.assetStore.engineObjectToAssetMap.get(n.clip).getCurrentRef(),transitions:[],scripts:[],isEntryState:n===e.defaultState,isExitState:!1,isAnyState:!1})),transitions:[],entryTransitions:[],anyTransitions:[]};return{name:a.name,blendingMode:a.blendingMode,weight:a.weight,stateMachine:o}}),this.internalDataUpdated=!0,this.getMainData()}async initByMain(t){const{internalDataUpdated:a}=this.meta;a&&(this.internalDataUpdated=!0);const e=JSON.parse(await t.text()),s=new U(this.engine);this.bindEngineObject(s),this.layers=e.layers||[],this.parameters=e.parameters||[],await this.applyControllerData()}async applyControllerData(){this._syncing&&await this._syncingPromise,this._syncing=!0;try{this.statesNameMap={};const t=this.engineObject;t.clearLayers(),t._parameters.length=0,t._parametersMap={};const{layers:a,parameters:e}=this;this._syncingPromise=Promise.all(a.map((s,o)=>{const{name:n,blendingMode:m,weight:u}=s,l=new z(n);return t.addLayer(l),l.blendingMode=m,l.weight=u,this._applyStateMachineData(o)})),e.forEach(s=>{const{isTrigger:o,name:n,defaultValue:m}=s;o?t.addTriggerParameter(n):t.addParameter(n,m)}),await this._syncingPromise}finally{this._syncing=!1}}async initByCreation(){return this.layers=[{name:"Base",weight:1,blendingMode:F.Override,stateMachine:{states:[],transitions:[],entryTransitions:[],anyTransitions:[]}}],this.getMainData()}onDoubleClick(){Z(this.root,"AnimatorController",{clearSceneSelection:!0})}async _applyStateMachineData(t){const a=this.engineObject.layers[t],{stateMachine:e}=this.layers[t],s=a.stateMachine;if(e){const{states:o=[],transitions:n=[],entryTransitions:m=[],anyTransitions:u=[]}=e,l={},T={},w=o.map(async i=>{var S,E;const{id:h,name:f,speed:b,wrapMode:g,clipStartNormalizedTime:P,clipEndNormalizedTime:j,clip:C}=i;(S=this.statesNameMap)[t]||(S[t]={}),this.statesNameMap[t][i.name]=i;const p=s.addState(f);p.speed=b,p.wrapMode=g,p.clipStartTime=P,p.clipEndTime=j,l[h]=p,C&&(p.clip=(E=await this.root.assetStore.getAssetByRef(C))==null?void 0:E.engineObject)});n.forEach(i=>{const h=this._createTransition(i,l[i.destinationStateId]);T[i.id]=h}),o.forEach(i=>{const{id:h,transitions:f}=i;f.forEach(b=>{const g=T[b];g&&l[h].addTransition(g)})}),m.forEach(i=>{s.addEntryStateTransition(this._createTransition(i,l[i.destinationStateId]))}),u.forEach(i=>{s.addAnyStateTransition(this._createTransition(i,l[i.destinationStateId]))}),await Promise.all(w),this.engineObject._updateFlagManager.dispatch()}}_createTransition(t,a){const e=new W;return e.duration=t.duration,e.offset=t.offset,e.exitTime=t.exitTime,e.solo=t.solo,e.mute=t.mute,e.hasExitTime=t.hasExitTime,e._isExit=t.isExit,e.destinationState=a,t.conditions.forEach(s=>{e.addCondition(s.parameterName,s.mode,s.threshold)}),e}};y([M,R()],d.prototype,"internalDataUpdated",2);y([A(),M],d.prototype,"layers",2);y([A(),M],d.prototype,"parameters",2);y([V],d.prototype,"applyPropertyFromDomain",1);d=y([$({type:"AnimatorController",label:q("asset.animator-controller.title"),icon:"animate-controller",extname:"animCtrl",importMenuConfig:{type:J.Add},dragLayer:Q.AnimationController,customInspector:k,async bundle({content:r}){return{content:new Blob([Y(await r.text())])}}})],d);export{d as AnimatorControllerAsset};
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var P=(n,o,t)=>o in n?f(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t;var i=(n,o,t)=>(P(n,typeof o!="symbol"?o+"":o,t),t);import{E as y,bp as d,s as c,p as m,C as u,t as h,e as C,bq as _,br as v,u as S,bs as g,bt as O}from"./index-1e23212d.js";import"./index-92830754.js";import{c as A}from"./Component-746be670.js";import"./postmen-9e1e15bd.js";var w=Object.defineProperty,E=Object.getOwnPropertyDescriptor,p=(n,o,t,r)=>{for(var e=r>1?void 0:r?E(o,t):o,a=n.length-1,l;a>=0;a--)(l=n[a])&&(e=(r?l(o,t,e):l(e))||e);return r&&e&&w(o,t,e),e};let s=class extends y{constructor(o,t){super(o,t);i(this,"animatorController",null);i(this,"cullingMode",d.None);i(this,"speed",1)}async bindEngineObject(o){await super.bindEngineObject(o),o.enabled=!1}};p([c(),m({type:u.AssetPicker,assetType:"AnimatorController",label:"animation.animator-controller.controller.title",info:"animation.animator-controller.controller.info",bindPath:"animatorController"})],s.prototype,"animatorController",2);p([c(),m({type:u.Select,label:"animation.animator-controller.culling-mode.title",info:"animation.animator-controller.culling-mode.info",options:h(d,void 0,n=>C(`animation.animator-controller.culling-mode.${n.toLowerCase()}`)),bindPath:"cullingMode"})],s.prototype,"cullingMode",2);p([c(),m({type:u.Number,label:"animation.animator-controller.speed.title",info:"animation.animator-controller.speed.info",bindPath:"speed"})],s.prototype,"speed",2);s=p([A({type:"Animator",componentsMenu:{label:"component.animator.title"},unique:!0})],s);class M extends _{constructor(){super(...arguments);i(this,"_animatorComponents",[]);i(this,"onScriptPlay")}init(t){this.onScriptPlay=t.onScriptPlay}onPlay(t){this.engine.sceneManager.scenes[0].rootEntities.forEach(e=>{e.getComponentsIncludeChildren(v,this._animatorComponents)}),this._animatorComponents.forEach(e=>{e.enabled=t,t||e._reset()}),this.onScriptPlay&&this.onScriptPlay(t)}}var j=Object.defineProperty,D=Object.getOwnPropertyDescriptor,$=(n,o,t,r)=>{for(var e=r>1?void 0:r?D(o,t):o,a=n.length-1,l;a>=0;a--)(l=n[a])&&(e=(r?l(o,t,e):l(e))||e);return r&&e&&j(o,t,e),e};let b=class{constructor(n){i(this,"script");i(this,"root");S(this),this.root=n}init(){this.script=g.addScript(M),this.script.init({onScriptPlay:n=>{var o;(o=this.root.animatorControllerStore)==null||o.updateGlobalPlayState(n)}})}};b=$([O({type:"animatorStore"})],b);export{s as A,b as a};
@@ -1 +1 @@
1
- var r=Object.defineProperty;var n=(t,e,s)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var i=(t,e,s)=>(n(t,typeof e!="symbol"?e+"":e,s),s);import{U as o}from"./index-0a8702e2.js";class _{constructor(){i(this,"overridePreviewer");i(this,"_entity");i(this,"_requestResetCamera");i(this,"_boundingBox",new o)}stopViewAsset(){this._entity&&(this._entity=null)}getDescription(e){return""}}export{_ as A};
1
+ var r=Object.defineProperty;var n=(t,e,s)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var i=(t,e,s)=>(n(t,typeof e!="symbol"?e+"":e,s),s);import{U as o}from"./index-1e23212d.js";class _{constructor(){i(this,"overridePreviewer");i(this,"_entity");i(this,"_requestResetCamera");i(this,"_boundingBox",new o)}stopViewAsset(){this._entity&&(this._entity=null)}getDescription(e){return""}}export{_ as A};
@@ -0,0 +1 @@
1
+ var b=Object.defineProperty;var y=(t,e,r)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>(y(t,typeof e!="symbol"?e+"":e,r),r);import{aO as O,aQ as c,aS as n,u as f,x as d,j,a7 as A,n as w,e as m,o as P}from"./index-1e23212d.js";import"./index-92830754.js";import"./postmen-9e1e15bd.js";import{A as _}from"./AssetViewer-0ce46fa1.js";var g=Object.defineProperty,x=Object.getOwnPropertyDescriptor,v=(t,e,r,o)=>{for(var s=o>1?void 0:o?x(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(s=(o?i(e,r,s):i(s))||s);return o&&s&&g(e,r,s),s};const h=O("div",{position:"absolute",top:"100px",backgroundColor:"$panelBg",variants:{sticky:{true:{position:"absolute",top:0}}}}),R=c(({asset:t})=>n.jsx(h,{children:n.jsx("audio",{src:t.url,controls:!0,children:"Your browser does not support the audio element."})}));class l extends _{constructor(){super();p(this,"duration",0);p(this,"playing",!1);p(this,"audioName");p(this,"overridePreviewer",c(({asset:r})=>n.jsx(R,{asset:r})));f(this)}setViewAsset(r,o){}}v([d],l.prototype,"duration",2);v([d],l.prototype,"playing",2);var U=Object.defineProperty,C=Object.getOwnPropertyDescriptor,D=(t,e,r,o)=>{for(var s=o>1?void 0:o?C(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(s=(o?i(e,r,s):i(s))||s);return o&&s&&U(e,r,s),s};let u=class extends j{constructor(e){super(e);p(this,"urlObj")}async initByMain(e){this.urlObj=e;const r=URL.createObjectURL(e);try{const o=await this.engine.resourceManager.load({url:r,type:A.Audio});this.bindEngineObject(o)}finally{URL.revokeObjectURL(r)}}};u=D([w({type:"Audio",label:m("asset.audio.title"),loaderType:"Audio",importMenuConfig:{type:P.Upload,tooltip:"请上传音频文件(支持 OGG, WAV, MP3)",accept:".ogg,.wav,.mp3"},viewer:l,bundle({content:t}){return{content:t}}})],u);export{u as AudioAsset};
@@ -0,0 +1 @@
1
+ var b=Object.defineProperty;var d=(p,e,o)=>e in p?b(p,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):p[e]=o;var n=(p,e,o)=>(d(p,typeof e!="symbol"?e+"":e,o),o);import{E as f,p as r,C as a,s as u}from"./index-1e23212d.js";import"./index-92830754.js";import{c}from"./Component-746be670.js";import"./postmen-9e1e15bd.js";var P=Object.defineProperty,v=Object.getOwnPropertyDescriptor,i=(p,e,o,s)=>{for(var t=s>1?void 0:s?v(e,o):e,m=p.length-1,y;m>=0;m--)(y=p[m])&&(t=(s?y(e,o,t):y(t))||t);return s&&t&&P(e,o,t),t};let l=class extends f{constructor(e,o){super(e,o);n(this,"clip",null);n(this,"playOnEnabled",!0);n(this,"loop",!0);n(this,"volume",0);n(this,"mute",!1)}};i([r({label:"Audio resource",info:"Audio resource info",type:a.AssetPicker,assetType:"Audio",bindPath:"clip"}),u()],l.prototype,"clip",2);i([r({label:"playOnEnabled",info:"playOnEnabled info",type:a.Toggle,bindPath:"playOnEnabled"}),u()],l.prototype,"playOnEnabled",2);i([r({label:"IsLooping",info:"IsLooping info",type:a.Toggle,bindPath:"loop"}),u()],l.prototype,"loop",2);i([r({label:"Volume",info:"Volume info",type:a.Slider,min:0,max:1,bindPath:"volume"}),u()],l.prototype,"volume",2);i([r({label:"Mute",info:"Mute info",type:a.Toggle,bindPath:"mute"}),u()],l.prototype,"mute",2);l=i([c({type:"AudioSource",componentsMenu:{label:"component.audio.title"}})],l);export{l as AudioComponent};
@@ -1 +1 @@
1
- import{aH as o,aK as r}from"./index-0a8702e2.js";const a=o(r,{borderRadius:"$2",fontSize:"$1",padding:"$1 $2",userSelect:"none",fontWeight:500,variants:{type:{info:{backgroundColor:"$blue3",color:"$blueA11"},warning:{backgroundColor:"$amber3",color:"$amber11"},error:{backgroundColor:"$red3",color:"$red11"},success:{backgroundColor:"$green3",color:"$green11"}}}});export{a as S};
1
+ import{aO as o,aP as r}from"./index-1e23212d.js";const a=o(r,{borderRadius:"$2",fontSize:"$1",padding:"$1 $2",userSelect:"none",fontWeight:500,variants:{type:{info:{backgroundColor:"$blue3",color:"$blueA11"},warning:{backgroundColor:"$amber3",color:"$amber11"},error:{backgroundColor:"$red3",color:"$red11"},success:{backgroundColor:"$green3",color:"$green11"}}}});export{a as S};
@@ -0,0 +1 @@
1
+ var _=Object.defineProperty;var q=(e,l,a)=>l in e?_(e,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[l]=a;var t=(e,l,a)=>(q(e,typeof l!="symbol"?l+"":l,a),a);import{L as m,a as f,E as k,V as L,b as w,d as P,D as C,c as x,A as O,M as A,C as s,s as o,p as i,t as g,e as b,l as R,g as S,f as M,h as E,r as D,S as F}from"./index-1e23212d.js";import"./index-92830754.js";import{c as z}from"./Component-746be670.js";var V=Object.defineProperty,j=Object.getOwnPropertyDescriptor,n=(e,l,a,p)=>{for(var c=p>1?void 0:p?j(l,a):l,u=e.length-1,h;u>=0;u--)(h=e[u])&&(c=(p?h(l,a,c):h(c))||c);return p&&c&&V(l,a,c),c};const d=[...Object.values(m),f.Nothing,f.Everything];class T extends F{constructor(){super(...arguments);t(this,"_originalMask");t(this,"_onEndRenderOnce",null)}onBeginRender(a){this._originalMask=a.cullingMask,a.cullingMask&=~(m.Viewport|m.Outline|m.NavigationGizmo|m.Gizmo)}onEndRender(a){if(a.cullingMask=this._originalMask,this._onEndRenderOnce){const p=this._onEndRenderOnce;this._onEndRenderOnce=null,p(a)}}executeAfterRender(a){this._onEndRenderOnce=a}}let r=class extends k{constructor(){super(...arguments);t(this,"_lastRTAsset",null);t(this,"isOrthographic",!1);t(this,"nearClipPlane",.1);t(this,"farClipPlane",100);t(this,"fieldOfView",45);t(this,"orthographicSize",10);t(this,"viewport",new L(0,0,1,1));t(this,"priority",0);t(this,"enableFrustumCulling",!0);t(this,"clearFlags",w.All);t(this,"cullingMask",P(f.Everything,d));t(this,"postProcessMask",P(f.Everything,d));t(this,"depthTextureMode",C.None);t(this,"opaqueTextureEnabled",!1);t(this,"opaqueTextureDownsampling",x.TwoX);t(this,"antiAliasing",O.None);t(this,"msaaSamples",A.FourX);t(this,"enableHDR",!1);t(this,"enablePostProcess",!0);t(this,"isAlphaOutputRequired",!1);t(this,"renderTarget",null)}onEnabled(){this.applyBoundPathChange("enabled",s.Toggle,!1)}onInitComplete(){if(this.engineObject.entity.addComponent(T),this.renderTarget){const l=this.root.assetStore.assets[this.renderTarget.refId];if(l){this._lastRTAsset=l;const a=this.engineObject.entity.getComponent(T);a&&a.executeAfterRender(()=>{var p;l.updateThumbnail(),(p=l.subAssets)==null||p.forEach(c=>c.updateThumbnail())})}}else this.applyBoundPathChange("enabled",s.Toggle,!1)}};n([o(),i({label:"camera.is-orthographic",bindPath:"isOrthographic"})],r.prototype,"isOrthographic",2);n([o(),i({label:"camera.near-clip-plane",bindPath:"nearClipPlane"})],r.prototype,"nearClipPlane",2);n([o(),i({label:"camera.far-clip-plane",bindPath:"farClipPlane"})],r.prototype,"farClipPlane",2);n([o(),i({label:"camera.field-of-view",bindPath:"fieldOfView",when:e=>!e.isOrthographic})],r.prototype,"fieldOfView",2);n([o(),i({label:"camera.orthographic-size",bindPath:"orthographicSize",when:e=>e.isOrthographic})],r.prototype,"orthographicSize",2);n([o(),i({type:s.Vector4,min:0,max:1,label:"camera.viewport.title",bindPath:"viewport"})],r.prototype,"viewport",2);n([o(),i({label:"camera.priority.title",bindPath:"priority"})],r.prototype,"priority",2);n([o(),i({label:"camera.enable-frustum-culling",bindPath:"enableFrustumCulling"})],r.prototype,"enableFrustumCulling",2);n([o(),i({label:"camera.clear-flags.title",bindPath:"clearFlags",type:s.Select,options:g(w,void 0,e=>b(`camera.clear-flags.${e.toLocaleLowerCase()}`))})],r.prototype,"clearFlags",2);n([o(R(d)),i({label:"camera.culling-mask",bindPath:"cullingMask",type:s.Select,...S(d)}),M(E(d))],r.prototype,"cullingMask",2);n([o(R(d)),i({label:"camera.post-process-mask",bindPath:"postProcessMask",type:s.Select,...S(d)}),M(E(d))],r.prototype,"postProcessMask",2);n([o(),i({label:"camera.depth-texture-mode.title",info:"camera.depth-texture-mode.info",bindPath:"depthTextureMode",type:s.Select,options:g(C,void 0,e=>b(`camera.depth-texture-mode.${e.toLowerCase()}`))})],r.prototype,"depthTextureMode",2);n([o(),i({label:"camera.opaque-texture-enabled.title",info:"camera.opaque-texture-enabled.info",bindPath:"opaqueTextureEnabled",type:s.Toggle})],r.prototype,"opaqueTextureEnabled",2);n([o(),i({label:"camera.opaque-texture-down-sampling.title",info:"camera.opaque-texture-down-sampling.info",bindPath:"opaqueTextureDownsampling",type:s.Select,options:g(x,void 0,e=>b(`camera.opaque-texture-down-sampling.${e.toLowerCase()}`)),when:e=>e.opaqueTextureEnabled})],r.prototype,"opaqueTextureDownsampling",2);n([o(),i({label:"camera.anti-aliasing.title",info:"camera.anti-aliasing.info",bindPath:"antiAliasing",type:s.Select,options:g(O,void 0,e=>b(`camera.anti-aliasing.${e.toLowerCase()}`))})],r.prototype,"antiAliasing",2);n([o(),i({label:"camera.msaa-samples.title",info:"camera.msaa-samples.info",bindPath:"msaaSamples",type:s.Select,options:g(A,void 0,e=>b(`camera.msaa-samples.${e.toLowerCase()}`))})],r.prototype,"msaaSamples",2);n([o(),i({label:"camera.enable-hdr.title",info:"camera.enable-hdr.info",bindPath:"enableHDR",type:s.Toggle})],r.prototype,"enableHDR",2);n([o(),i({label:"camera.enable-post-process.title",info:"camera.enable-post-process.info",bindPath:"enablePostProcess",type:s.Toggle})],r.prototype,"enablePostProcess",2);n([o(),i({label:"camera.is-alpha-output-required.title",info:"camera.is-alpha-output-required.info",bindPath:"isAlphaOutputRequired",type:s.Toggle})],r.prototype,"isAlphaOutputRequired",2);n([i({label:"camera.render-target.title",type:s.AssetPicker,assetType:"RenderTarget",onChange:async(e,l,a)=>{var h;const p=e._lastRTAsset;p&&!a&&D(()=>{var y;p.thumbnailUrl="",(y=p.subAssets)==null||y.forEach(v=>{v.thumbnailUrl=""})}),e._lastRTAsset=a??null,e.renderTarget=a?a.getCurrentRef():null,await e.applyBoundPathChange("renderTarget",s.AssetPicker,e.renderTarget);const c=e.root.projectStore.currentViewport.previewManager;c.hasUserRT=!!a;const u=e.engineObject;a?(u.enabled=!0,a.updateThumbnail(),(h=a.subAssets)==null||h.forEach(y=>y.updateThumbnail())):c.isPreviewOn||(u.enabled=!1)}}),o()],r.prototype,"renderTarget",2);r=n([z({type:"Camera",componentsMenu:{label:"component.camera.title"}})],r);export{r as CameraComponent};
@@ -1 +1 @@
1
- import{E as r}from"./index-0a8702e2.js";function a(e){return function(n){e.class=n,e.componentsMenu={label:e.type,...e.componentsMenu},e.refMap=new Set,e.external=e.external??!1,r.registerComponent(e.type,e)}}export{a as c};
1
+ import{E as r}from"./index-1e23212d.js";function a(e){return function(n){e.class=n,e.componentsMenu={label:e.type,...e.componentsMenu},e.refMap=new Set,e.external=e.external??!1,r.registerComponent(e.type,e)}}export{a as c};
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var y=(e,a,o)=>a in e?m(e,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[a]=o;var r=(e,a,o)=>(y(e,typeof a!="symbol"?a+"":a,o),o);import{i as f,e as g,p,C as i,t as b,s as l,v as c}from"./index-1e23212d.js";import"./index-92830754.js";import{c as P}from"./Component-746be670.js";import{L as N}from"./LightBaseComponent-51d498ea.js";var u=Object.defineProperty,S=Object.getOwnPropertyDescriptor,h=(e,a,o,n)=>{for(var t=n>1?void 0:n?S(a,o):a,d=e.length-1,w;d>=0;d--)(w=e[d])&&(t=(n?w(a,o,t):w(t))||t);return n&&t&&u(a,o,t),t};let s=class extends N{constructor(a,o){super(a,o);r(this,"shadowType",f.None);r(this,"shadowBias",1);r(this,"shadowNormalBias",1);r(this,"shadowNearPlaneOffset",.1);r(this,"shadowStrength",1);this.formSchema.addGroup(g("light.shadow.title"),["shadowType","shadowBias","shadowNormalBias","shadowNearPlaneOffset","shadowStrength"],{collapsible:!1})}};h([p({type:i.Select,options:b(f,void 0,e=>g(`light.shadow.type.${e.toLowerCase()}`)),bindPath:"shadowType",property:"shadowType",label:"light.shadow.type.label",info:"light.shadow.type.info"}),l(),c()],s.prototype,"shadowType",2);h([p({type:i.Number,bindPath:"shadowBias",property:"shadowBias",dragStep:.01,label:"light.shadow.bias.label",info:"light.shadow.bias.info"}),l()],s.prototype,"shadowBias",2);h([p({type:i.Number,bindPath:"shadowNormalBias",property:"shadowNormalBias",dragStep:.01,label:"light.shadow.normal-bias.label",info:"light.shadow.normal-bias.info"}),l()],s.prototype,"shadowNormalBias",2);h([p({type:i.Number,bindPath:"shadowNearPlaneOffset",property:"shadowNearPlaneOffset",dragStep:.01,label:"light.shadow.near-plane-offset.label",info:"light.shadow.near-plane-offset.info"}),l()],s.prototype,"shadowNearPlaneOffset",2);h([p({type:i.Slider,bindPath:"shadowStrength",property:"shadowStrength",min:0,max:1,dragStep:.01,label:"light.shadow.strength.label",info:"light.shadow.strength.info"}),l()],s.prototype,"shadowStrength",2);s=h([P({type:"DirectLight",componentsMenu:{group:"light",label:"component.light.direct.title"}})],s);export{s as DirectLightComponent};
@@ -0,0 +1,5 @@
1
+ var d=Object.defineProperty;var u=(s,e,t)=>e in s?d(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var a=(s,e,t)=>(u(s,typeof e!="symbol"?e+"":e,t),t);import{c7 as m,cc as y,cd as h,ce as b,by as w,aQ as v,aS as x,c8 as j,a1 as f,j as F,a7 as O,n as U,e as A,o as R}from"./index-1e23212d.js";import"./index-92830754.js";import"./postmen-9e1e15bd.js";import{A as g}from"./AssetViewer-0ce46fa1.js";async function C(s){const e={uploadFiles:[],errors:[]};for(const t in s){const n=s[t],r=n.name.toLocaleLowerCase();(r.endsWith(".ttf")||r.endsWith(".otf")||r.endsWith(".woff"))&&e.uploadFiles.push({main:n})}return e}async function L(s){const e=m(s.main,"font.ttf");try{const t=e.name,n=y(t),r=h(t,n),o=await b.uploadBlob(`${t}.json`,e),i={fontName:r,fontUrl:encodeURI(o.url).replace(/\(/g,"%28").replace(/\)/g,"%29")};return new File([JSON.stringify(i)],r)}catch(t){console.error(t),w.error(`parse font file fail ${t}`)}return e}class p extends g{constructor(){super()}setViewAsset(e,t){const n=t.createChild("font_entity"),r=n.addComponent(f);r.font=e.engineObject,r.text=`ABCDEFGHIJKLM
2
+ NOPQRSTUVWXYZ
3
+ abcdefghijklm
4
+ nopqrstuvwxyz
5
+ 1234567890`,this._entity=n}}const P=v(({asset:s})=>x.jsx(j,{asset:s}));p.previewer=P;class c{static update(e,t){this.entity?this.entity.isActive=!0:this.initScene(e),this.textRenderer.font=t.engineObject}static clear(){this.entity.isActive=!1}static initScene(e){const t=this.entity=e.createChild("font"),n=this.textRenderer=t.addComponent(f);n.text="Aa",n.fontSize=60}}a(c,"entity"),a(c,"textRenderer");var _=Object.defineProperty,S=Object.getOwnPropertyDescriptor,T=(s,e,t,n)=>{for(var r=n>1?void 0:n?S(e,t):e,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&_(e,t,r),r};let l=class extends F{constructor(e){super(e);a(this,"urlObj")}async initByMain(e){this.urlObj=e;const t=URL.createObjectURL(e),n=await this.engine.resourceManager.load({url:t,type:O.Font});URL.revokeObjectURL(t),this.bindEngineObject(n)}};l=T([U({type:"Font",label:A("asset.font.title"),loaderType:"Font",extname:"font",viewer:p,thumbnail:c,importMenuConfig:{type:R.Upload,tooltip:"请上传字体文件(支持 TTF, OTF, WOFF)",accept:".ttf,.otf,.woff"},filterUploadFiles:C,preUpload:L})],l);export{l as FontAsset};
@@ -0,0 +1,6 @@
1
+ import{aH as x,aO as h,aX as m,b3 as v,aC as e,aD as f,aE as b,aP as i,b4 as j,aT as l}from"./index-1e23212d.js";import{A as I,a as g}from"./Accordion-930aedee.js";import{I as y}from"./IconEdit-2c768a0a.js";/**
2
+ * @license @tabler/icons-react v3.17.0 - MIT
3
+ *
4
+ * This source code is licensed under the MIT license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */var A=x("outline","trash","IconTrash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]]);const k=h(m,{width:"100%",border:"none",position:"relative",borderRadius:0,"& > svg":{marginRight:"$1"},"&::after":{content:"''",position:"absolute",top:0,left:0,width:"100%",borderTop:"1px solid $grayA2"}});function D(r){const{renameable:n,onDelete:s,removable:o}=r;return e.jsxs(i,{align:"v",css:{flex:1,justifyContent:"space-between"},children:[e.jsx("span",{children:r.title}),e.jsxs(i,{gap:"xxs",children:[n&&e.jsx(l,{as:"div",variant:"subtle","aria-hidden":!0,tabIndex:-1,size:"xs",onClick:t=>{t.preventDefault(),t.stopPropagation(),s&&s()},children:e.jsx(y,{size:"14px"})}),o&&e.jsx(l,{as:"div",variant:"subtle","aria-hidden":!0,tabIndex:-1,size:"xs",onClick:t=>{t.preventDefault(),t.stopPropagation(),s&&s()},children:e.jsx(A,{size:"14px"})})]})]})}function T(r){const{items:n=[],onAdd:s,onDelete:o,addItemText:t="Add Item",defaultValue:d,addable:c=!1}=r,u=a=>()=>{o&&o(a)},p=v.useMemo(()=>n.length?n.map(a=>`${a.id}`):[],[n]);return e.jsx(f,{...b(r),direction:"column",children:e.jsxs(I,{type:"multiple",defaultValue:d??p,children:[n.map(a=>e.jsx(g,{value:`${a.id}`,title:e.jsx(D,{title:a.name,onDelete:u(a),removable:a.removable,renameable:a.renameable}),arrow:!!a.children,children:a.children&&e.jsx(i,{direction:"column",children:a.children})},a.id)),c&&e.jsxs(k,{size:"sm",variant:"soft",onClick:s,children:[e.jsx(j,{size:"12px"})," ",t]})]})})}export{T as F};