@galacean/cli 2.0.0-alpha.26 → 2.0.0-alpha.28

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 (97) hide show
  1. package/dist/cli.bundle.cjs +55252 -18754
  2. package/dist/preview-client/_static/{Accordion-2cd014f1.js → Accordion-6f002a96.js} +1 -1
  3. package/dist/preview-client/_static/{AmbientLightAsset-be9e872c.js → AmbientLightAsset-57a59fc2.js} +2 -2
  4. package/dist/preview-client/_static/{AnimationClipAsset-d7b37af0.js → AnimationClipAsset-0a1f63eb.js} +1 -1
  5. package/dist/preview-client/_static/{AnimatorControllerAsset-2716497a.js → AnimatorControllerAsset-9192e596.js} +1 -1
  6. package/dist/preview-client/_static/{AnimatorStore-883a28ad.js → AnimatorStore-484b10cf.js} +1 -1
  7. package/dist/preview-client/_static/{AssetViewer-3847c058.js → AssetViewer-9f395efb.js} +1 -1
  8. package/dist/preview-client/_static/{AudioAsset-c28f33ab.js → AudioAsset-0ea4ba7b.js} +1 -1
  9. package/dist/preview-client/_static/{AudioComponent-3d6c73ce.js → AudioComponent-9bf5944c.js} +1 -1
  10. package/dist/preview-client/_static/{Callout-e2a89f6f.js → Callout-45631a14.js} +1 -1
  11. package/dist/preview-client/_static/{CameraComponent-3dc63451.js → CameraComponent-039457d1.js} +1 -1
  12. package/dist/preview-client/_static/{Component-0f881fc1.js → Component-c3c0c167.js} +1 -1
  13. package/dist/preview-client/_static/{DirectLight-96dbba47.js → DirectLight-7b1f4b9f.js} +1 -1
  14. package/dist/preview-client/_static/{FontAsset-d34b5378.js → FontAsset-10273d05.js} +2 -2
  15. package/dist/preview-client/_static/{FormItemArray-b8cda1d2.js → FormItemArray-9d4196d8.js} +2 -2
  16. package/dist/preview-client/_static/{GlTFAsset-5970e707.js → GlTFAsset-917bf1ee.js} +5 -5
  17. package/dist/preview-client/_static/{IconPlus-def01e2b.js → IconPlus-2bfc60da.js} +1 -1
  18. package/dist/preview-client/_static/{IconPointFilled-62d3c3b2.js → IconPointFilled-192e99c9.js} +1 -1
  19. package/dist/preview-client/_static/{LightBaseComponent-d651a276.js → LightBaseComponent-948d3192.js} +1 -1
  20. package/dist/preview-client/_static/{LottieAnimationComponent-f10dc558.js → LottieAnimationComponent-da226765.js} +1 -1
  21. package/dist/preview-client/_static/{MarkdownAsset-b2a3fad5.js → MarkdownAsset-602f93bf.js} +1 -1
  22. package/dist/preview-client/_static/MaterialAsset-aa93db51.js +1 -0
  23. package/dist/preview-client/_static/{MaterialInspector-8d466d59.js → MaterialInspector-45e208c7.js} +1 -1
  24. package/dist/preview-client/_static/Menu-beacc39d.js +17 -0
  25. package/dist/preview-client/_static/MeshAsset-585f4b18.js +1 -0
  26. package/dist/preview-client/_static/{MeshRendererBaseComponent-fde6b6a5.js → MeshRendererBaseComponent-0bc9f5b3.js} +1 -1
  27. package/dist/preview-client/_static/{MeshRendererComponent-430774ef.js → MeshRendererComponent-84208d23.js} +1 -1
  28. package/dist/preview-client/_static/{MeshThumbnail-07ffa076.js → MeshThumbnail-9bbe01dc.js} +1 -1
  29. package/dist/preview-client/_static/ParticleRendererComponent-f3ac8d1b.js +26 -0
  30. package/dist/preview-client/_static/{PhysicsMaterialAsset-a2f73b5c.js → PhysicsMaterialAsset-2dd013f8.js} +1 -1
  31. package/dist/preview-client/_static/{PhysicsStore-818c2f61.js → PhysicsStore-fcb01282.js} +1 -1
  32. package/dist/preview-client/_static/{PointLight-add790ea.js → PointLight-d9ace100.js} +1 -1
  33. package/dist/preview-client/_static/{PostProcessComponent-af270a77.js → PostProcessComponent-2b5255d9.js} +3 -3
  34. package/dist/preview-client/_static/PrefabAsset-8c923465.js +1 -0
  35. package/dist/preview-client/_static/{PrimitiveMesh-075dda8a.js → PrimitiveMesh-fde624a6.js} +1 -1
  36. package/dist/preview-client/_static/{ReferencedMaterial-d11151b5.js → ReferencedMaterial-890492a2.js} +1 -1
  37. package/dist/preview-client/_static/{RenderTargetAsset-b3cd1c49.js → RenderTargetAsset-bf38a725.js} +1 -1
  38. package/dist/preview-client/_static/SceneAsset-7a9dbdd8.js +1 -0
  39. package/dist/preview-client/_static/{ShaderAsset-a9d667f5.js → ShaderAsset-2f2c1e95.js} +12 -12
  40. package/dist/preview-client/_static/{ShaderChunkAsset-e43dde8a.js → ShaderChunkAsset-a3ff3959.js} +2 -2
  41. package/dist/preview-client/_static/{ShaderUIScriptAsset-e1cd0b8b.js → ShaderUIScriptAsset-d3a2d680.js} +1 -1
  42. package/dist/preview-client/_static/{SkinnedMeshRendererComponent-9756bd5f.js → SkinnedMeshRendererComponent-96740600.js} +1 -1
  43. package/dist/preview-client/_static/{SpineAnimationComponent-f3e0ff44.js → SpineAnimationComponent-3d4eec48.js} +1 -1
  44. package/dist/preview-client/_static/{SpineSkeletonDataAsset-43b731f1.js → SpineSkeletonDataAsset-a8598103.js} +1 -1
  45. package/dist/preview-client/_static/{SpotLight-649b0e21.js → SpotLight-680a6e17.js} +1 -1
  46. package/dist/preview-client/_static/{SpriteBaseComponent-d2a7ab4c.js → SpriteBaseComponent-96a500d7.js} +1 -1
  47. package/dist/preview-client/_static/{SpriteMaskComponent-2c1cef5e.js → SpriteMaskComponent-58c35ea2.js} +1 -1
  48. package/dist/preview-client/_static/{SpriteRendererComponent-33b71997.js → SpriteRendererComponent-5c89f7dd.js} +1 -1
  49. package/dist/preview-client/_static/{TextBaseComponent-9310e0c6.js → TextBaseComponent-248ea222.js} +3 -3
  50. package/dist/preview-client/_static/{TextRendererComponent-8dc0d7fb.js → TextRendererComponent-78458825.js} +1 -1
  51. package/dist/preview-client/_static/{TextureAsset-a7ff39b1.js → TextureAsset-bf69040b.js} +4 -4
  52. package/dist/preview-client/_static/Tooltip-0268ffac.js +1 -0
  53. package/dist/preview-client/_static/{TrailRendererComponent-c4635fab.js → TrailRendererComponent-838e0118.js} +1 -1
  54. package/dist/preview-client/_static/{TransformBaseComponent-1473deaa.js → TransformBaseComponent-c92aa259.js} +1 -1
  55. package/dist/preview-client/_static/{TransformComponent-e544f7ac.js → TransformComponent-d28b4035.js} +1 -1
  56. package/dist/preview-client/_static/{XRReferenceImageAsset-96f516ba.js → XRReferenceImageAsset-16071f5c.js} +1 -1
  57. package/dist/preview-client/_static/{audio-b5fbde34.js → audio-1d573775.js} +1 -1
  58. package/dist/preview-client/_static/{createOnModelChange-370b83da.js → createOnModelChange-38471bb6.js} +1 -1
  59. package/dist/preview-client/_static/{createReactComponent-58d9f0dd.js → createReactComponent-3e49f864.js} +1 -1
  60. package/dist/preview-client/_static/index-0a57ae09.js +1 -0
  61. package/dist/preview-client/_static/{index-74bcfad9.js → index-1d0ae2e4.js} +1 -1
  62. package/dist/preview-client/_static/{index-dd0763bf.js → index-1fa3ba70.js} +1 -1
  63. package/dist/preview-client/_static/index-2c567b8d.js +1 -0
  64. package/dist/preview-client/_static/{index-da16047f.js → index-2f54d4c9.js} +1 -1
  65. package/dist/preview-client/_static/{index-0dd5bb36.js → index-4084db44.js} +1 -1
  66. package/dist/preview-client/_static/index-5c27dafa.js +1 -0
  67. package/dist/preview-client/_static/{index-88650db7.js → index-65c6af4a.js} +3 -3
  68. package/dist/preview-client/_static/{index-05b76766.js → index-68806c86.js} +1 -1
  69. package/dist/preview-client/_static/{index-cdbb2f4d.js → index-8a22fe59.js} +1 -1
  70. package/dist/preview-client/_static/index-9e3daa94.js +1 -0
  71. package/dist/preview-client/_static/index-bdda02cf.js +1 -0
  72. package/dist/preview-client/_static/index-c88f78ce.js +1 -0
  73. package/dist/preview-client/_static/{index-ab8556cb.js → index-ce381b62.js} +3 -3
  74. package/dist/preview-client/_static/{index-c3dec278.js → index-d497fb6d.js} +214 -175
  75. package/dist/preview-client/_static/index-e4fb05d8.js +1 -0
  76. package/dist/preview-client/_static/{ktx2-encoder-db93524f.js → ktx2-encoder-772f6c33.js} +1 -1
  77. package/dist/preview-client/_static/{module-ec094ef6.js → module-136992e3.js} +1 -1
  78. package/dist/preview-client/_static/{module-ada3dced.js → module-1470d524.js} +1 -1
  79. package/dist/preview-client/_static/{module-de7ee724.js → module-77c2ea8c.js} +1 -1
  80. package/dist/preview-client/_static/{postmen-2853c0e6.js → postmen-0413c689.js} +2 -2
  81. package/dist/preview-client/_static/{shader-data-utils-f0e4f5a3.js → shader-data-utils-e38a959d.js} +1 -1
  82. package/dist/preview-client/index.html +1 -1
  83. package/package.json +29 -24
  84. package/dist/preview-client/_static/MaterialAsset-5353c4cb.js +0 -1
  85. package/dist/preview-client/_static/Menu-c8e6194b.js +0 -17
  86. package/dist/preview-client/_static/MeshAsset-c2bf60c5.js +0 -1
  87. package/dist/preview-client/_static/ParticleRendererComponent-e106bd8c.js +0 -26
  88. package/dist/preview-client/_static/PrefabAsset-59743dbb.js +0 -1
  89. package/dist/preview-client/_static/SceneAsset-08752701.js +0 -1
  90. package/dist/preview-client/_static/Tooltip-b5be390f.js +0 -1
  91. package/dist/preview-client/_static/index-29c59aff.js +0 -1
  92. package/dist/preview-client/_static/index-3680d0e0.js +0 -1
  93. package/dist/preview-client/_static/index-42aa3a49.js +0 -1
  94. package/dist/preview-client/_static/index-496f331d.js +0 -1
  95. package/dist/preview-client/_static/index-9f0122f0.js +0 -1
  96. package/dist/preview-client/_static/index-c6b7045c.js +0 -1
  97. package/dist/preview-client/_static/index-dddcae01.js +0 -1
@@ -1 +0,0 @@
1
- var Le=Object.defineProperty;var qe=(o,e,t)=>e in o?Le(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var C=(o,e,t)=>(qe(o,typeof e!="symbol"?e+"":e,t),t);import{d_ as Ue,d$ as be,e0 as Je,aJ as Ie,aK as Ge,av as M,bA as We,q as he,aN as Qe,aw as He,e1 as Xe,C as Ye,bE as Ze,e2 as ge,e3 as W,e4 as et,e5 as tt,bX as nt,e as J,e6 as Ee,e7 as st,e8 as rt,e9 as ot,ea as it,eb as ct,ec as at,ed as dt,ee as ut,ef as ft,eg as lt,eh as ht,ei as pt,ej as mt,ek as we,el as yt,bV as Pe,em as ne,en as _e,eo as St,ep as bt,eq as It,er as gt,K as Ce,m as Et,aT as wt,x as Pt,aC as ke,n as _t,dL as Ct,es as Rt}from"./index-c3dec278.js";import{T as $t}from"./TaskQueue-05c94a4d.js";import{u as Re,I as vt}from"./index-cdbb2f4d.js";import"./postmen-2853c0e6.js";import{A as At}from"./AssetViewer-3847c058.js";function Tt(o,e,t){const n=[];function s(r){if(!(r==null||typeof r!="object")){if(Array.isArray(r)){for(const i of r)s(i);return}for(const i of Object.keys(r)){const c=r[i];if(e.includes(i)&&typeof c=="string"&&n.push(c),t){const a=t(i,c);a!==null&&n.push(a)}s(c)}}}return s(o),n}function A(o){return structuredClone(o)}function Q(o,e){const t=o.entities.findIndex(n=>n.id===e);if(t<0)throw new Error(`Prefab source entity "${e}" not found`);return t}function je(o,e){const t=o.components.findIndex(n=>n.id===e);if(t<0)throw new Error(`Prefab source component "${e}" not found`);return t}function oe(o,e,t){if(!t)return;const n=e==="scale"?[1,1,1]:[0,0,0],s=o[e]??n;o[e]=[t.x??s[0],t.y??s[1],t.z??s[2]]}function $e(o,e,t){const n=new Set(e),s=new Set;for(const r of t){if(s.has(r))throw new Error(`Prefab source ${o} id "${r}" is duplicated in the added source tree`);if(n.has(r))throw new Error(`Prefab source ${o} id "${r}" already exists`);s.add(r)}}function xt(o){return o.entities.map(e=>e.id)}function Be(o){return o.components.map(e=>e.id)}function Mt(o){const e=new Set(o.entityIds),t=new Set(o.componentIds);return o.entities.map((n,s)=>{var c,a;const r=o.entityIds[s],i=structuredClone(n);return i.id=r,(c=i.children)!=null&&c.length&&(i.children=i.children.map(d=>{const u=typeof d=="number"?o.entityIds[d]:d;if(!e.has(u))throw new Error(`Prefab added source entity "${r}" child "${String(d)}" is outside added entity tree`);return u})),(a=i.components)!=null&&a.length&&(i.components=i.components.map(d=>{const u=typeof d=="number"?o.componentIds[d]:d;if(!t.has(u))throw new Error(`Prefab added source entity "${r}" component "${String(d)}" is outside added component list`);return u})),i})}function Ot(o){return o.components.map((e,t)=>({...structuredClone(e),id:o.componentIds[t]}))}function Dt(o,e){const t=new Map(o.entities.map(r=>[r.id,r])),n=new Set,s=r=>{if(n.has(r))return;n.add(r);const i=t.get(r);for(const c of(i==null?void 0:i.children)??[])s(c)};return s(e),n}function Ft(o,e,t){var r,i,c;if(!t)return A(o);const n=A(o),s=n.entities[Q(n,e)];return t.name!==void 0&&(s.name=t.name),t.isActive!==void 0&&(t.isActive?delete s.isActive:s.isActive=!1),t.layer!==void 0&&(t.layer===0?delete s.layer:s.layer=t.layer),t.isLocked!==void 0&&(t.isLocked?s.isLocked=!0:delete s.isLocked),oe(s,"position",(r=t.transform)==null?void 0:r.position),oe(s,"rotation",(i=t.transform)==null?void 0:i.rotation),oe(s,"scale",(c=t.transform)==null?void 0:c.scale),n}function kt(o,e,t){if(!t||Object.keys(t).length===0)return A(o);const n=A(o),s=n.components[je(n,e)];return s.props=Ue(s.props??{},t),n}function jt(o,e){if(e.entities.length===0||e.entities.length!==e.entityIds.length)throw new Error("Prefab added entity tree must include matching entities and entityIds");if(e.components.length!==e.componentIds.length)throw new Error("Prefab added entity tree must include matching components and componentIds");$e("entity",xt(o),e.entityIds),$e("component",Be(o),e.componentIds);const t=A(o),n=t.entities[Q(t,e.parentSourceEntityId)],s=Mt(e),r=Ot(e),i=e.entityIds[0];t.entities.push(...s),t.components.push(...r);const c=[...n.children??[]],a=Math.min(Math.max(e.index,0),c.length);return c.splice(a,0,i),n.children=c,t}function Bt(o,e){var p;const t=A(o),n=t.entities[Q(t,e.instanceSourceEntityId)];if(!n.instance)throw new Error(`Prefab source entity "${e.instanceSourceEntityId}" is not an instance entity`);const s=(p=n.instance).overrides??(p.overrides={}),r=[...s.addedEntities??[]],i=Math.max(0,e.index);let c=0,a=r.length;for(let y=0;y<r.length;y+=1)if(r[y].parent===e.parentSourceEntityId){if(c===i){a=y;break}c+=1,a=y+1}const d=structuredClone(e.entity),u=d.id??`${e.instanceSourceEntityId}:added:${r.length}`;return d.id=u,r.splice(a,0,{id:u,parent:e.parentSourceEntityId,entity:d}),s.addedEntities=r,t}function zt(o,e){if(o.root===e)throw new Error("Cannot remove prefab root entity from source");Q(o,e);const t=Dt(o,e),n=new Set;for(const r of o.entities)if(t.has(r.id))for(const i of r.components??[])n.add(i);const s=A(o);return s.entities=s.entities.filter(r=>!t.has(r.id)).map(r=>{const i=structuredClone(r),c=(i.children??[]).filter(d=>!t.has(d)),a=(i.components??[]).filter(d=>!n.has(d));return c.length?i.children=c:delete i.children,a.length?i.components=a:delete i.components,i}),s.components=s.components.filter(r=>!n.has(r.id)),s}function Nt(o,e,t,n){if(Be(o).includes(t))throw new Error(`Prefab source component id "${t}" already exists`);const s=A(o),r=s.entities[Q(s,e)];return s.components.push({...structuredClone(n),id:t}),r.components=[...r.components??[],t],s}function Vt(o,e){je(o,e);const t=A(o);return t.components=t.components.filter(n=>n.id!==e),t.entities=t.entities.map(n=>{const s=structuredClone(n),r=(s.components??[]).filter(i=>i!==e);return r.length?s.components=r:delete s.components,s}),t}function Kt(o){switch(o.kind){case"add-source-entity":if(o.sourceEntityIds.length===0)throw new Error("Prefab source edit add-source-entity requires at least one source entity id");return;case"remove-source-entity":if(!o.sourceEntityId)throw new Error("Prefab source edit remove-source-entity requires a source entity id");return;case"add-source-component":if(!o.sourceComponentId)throw new Error("Prefab source edit add-source-component requires a source component id");return;case"remove-source-component":if(!o.sourceComponentId)throw new Error("Prefab source edit remove-source-component requires a source component id");return;case"add-nested-instance-entity":if(!o.instanceSourceEntityId)throw new Error("Prefab source edit add-nested-instance-entity requires an instance source entity id");if(!o.parentSourceEntityId)throw new Error("Prefab source edit add-nested-instance-entity requires a parent source entity id");return}}function ve(o,e){return o.length===e.length&&o.every((t,n)=>t===e[n])}function G(o,e,t){const n=new Set(e);for(const s of t)if(!n.has(s))throw new Error(`Prefab source edit expected ${o} id "${s}" to exist`)}function se(o,e,t){const n=new Set(e);for(const s of t)if(n.has(s))throw new Error(`Prefab source edit expected ${o} id "${s}" to be removed`)}function D(o){return o.entities.map(e=>e.id)}function z(o){return o.components.map(e=>e.id)}function ze(o,e){const t=o.entities.findIndex(n=>n.id===e);if(t<0)throw new Error(`Prefab source edit expected entity id "${e}" to exist`);return t}function Lt(o,e){var n;const t=ze(o,e);if(!((n=o.entities[t])!=null&&n.instance))throw new Error(`Prefab source edit expected entity id "${e}" to be an instance entity`)}function Ae(o,e,t){var s,r,i;const n=ze(o,e);return(((i=(r=(s=o.entities[n])==null?void 0:s.instance)==null?void 0:r.overrides)==null?void 0:i.addedEntities)??[]).filter(c=>c.parent===t).length}function F(o,e,t,n,s){if(o!=null){if(Array.isArray(o)){o.forEach((r,i)=>F(r,e,t,`${n}[${i}]`,s));return}if(Je(o)){o.$component===e&&s.push({entityId:t,propPath:n});for(const[r,i]of Object.entries(o))F(i,e,t,`${n}.${r}`,s)}}}function Ne(o,e,t,n,s){var r;F(o.props,e,t,`${n}.props`,s),(r=o.calls)==null||r.forEach((i,c)=>F(i,e,t,`${n}.calls[${c}]`,s))}function Ve(o,e,t,n,s){var r,i,c;(r=o.components)==null||r.forEach((a,d)=>Ne(a,e,t,`${n}.components[${d}]`,s)),(i=o.children)==null||i.forEach((a,d)=>Ve(a,e,t,`${n}.children[${d}]`,s)),Ke((c=o.instance)==null?void 0:c.overrides,e,t,`${n}.instance.overrides`,s)}function Ke(o,e,t,n,s){var r,i,c;(r=o==null?void 0:o.componentProps)==null||r.forEach((a,d)=>F(a.props,e,t,`${n}.componentProps[${d}].props`,s)),(i=o==null?void 0:o.addedComponents)==null||i.forEach((a,d)=>Ne(a.component,e,t,`${n}.addedComponents[${d}].component`,s)),(c=o==null?void 0:o.addedEntities)==null||c.forEach((a,d)=>Ve(a.entity,e,t,`${n}.addedEntities[${d}].entity`,s))}function qt(o,e){var s,r;const t=[],n=new Map;for(const i of o.entities)for(const c of i.components??[])n.set(c,i.id);for(const i of o.components){if(i.id===e)continue;const c=n.get(i.id)??"<unowned>";F(i.props,e,c,`components.${i.id}.props`,t),(s=i.calls)==null||s.forEach((a,d)=>F(a,e,c,`components.${i.id}.calls[${d}]`,t))}for(const i of o.entities)Ke((r=i.instance)==null?void 0:r.overrides,e,i.id,`entities.${i.id}.instance.overrides`,t);return t}function Ut(o,e){const t=qt(o,e);if(t.length!==0)throw new Error(`Cannot remove component "${e}": it is referenced by $component bindings in ${t.map(n=>`entity "${n.entityId}" prop "${n.propPath}"`).join(", ")}. Remove the bindings first.`)}function Jt(o,e){switch(e.kind){case"add-source-entity":se("entity",D(o),e.sourceEntityIds);return;case"remove-source-entity":G("entity",D(o),[e.sourceEntityId]);return;case"add-source-component":se("component",z(o),[e.sourceComponentId]);return;case"remove-source-component":G("component",z(o),[e.sourceComponentId]),Ut(o,e.sourceComponentId);return;case"add-nested-instance-entity":G("entity",D(o),[e.instanceSourceEntityId]),Lt(o,e.instanceSourceEntityId);return}}function Gt(o,e,t){switch(t.kind){case"add-source-entity":G("entity",D(e),t.sourceEntityIds);return;case"remove-source-entity":se("entity",D(e),[t.sourceEntityId]);return;case"add-source-component":G("component",z(e),[t.sourceComponentId]);return;case"remove-source-component":se("component",z(e),[t.sourceComponentId]);return;case"add-nested-instance-entity":{if(!ve(D(o),D(e))||!ve(z(o),z(e)))throw new Error("Prefab source edit add-nested-instance-entity must not change source entity or component ids");const n=Ae(o,t.instanceSourceEntityId,t.parentSourceEntityId);if(Ae(e,t.instanceSourceEntityId,t.parentSourceEntityId)!==n+1)throw new Error(`Prefab source edit expected nested added entity count under "${t.parentSourceEntityId}" to increase by 1`);return}}}function H(o){Kt(o.intent),be(o.prefabFile),Jt(o.prefabFile,o.intent);const e=o.mutation(o.prefabFile);return be(e),Gt(o.prefabFile,e,o.intent),e}function Wt(o,e){return H({prefabFile:o,intent:{kind:"add-source-entity",sourceEntityIds:e.entityIds},mutation:t=>jt(t,e)})}function Qt(o,e){return H({prefabFile:o,intent:{kind:"add-nested-instance-entity",instanceSourceEntityId:e.instanceSourceEntityId,parentSourceEntityId:e.parentSourceEntityId},mutation:t=>Bt(t,e)})}function Ht(o,e){return H({prefabFile:o,intent:{kind:"remove-source-entity",sourceEntityId:e},mutation:t=>zt(t,e)})}function Xt(o,e){return H({prefabFile:o,intent:{kind:"add-source-component",sourceComponentId:e.sourceComponentId},mutation:t=>Nt(t,e.sourceEntityId,e.sourceComponentId,e.component)})}function Yt(o,e){return H({prefabFile:o,intent:{kind:"remove-source-component",sourceComponentId:e},mutation:t=>Vt(t,e)})}class ae{static update(e,t){!this.entity&&(this.entity=e.createChild("prefab"));const n=this.tempCloneEntity=t.instantiateEngineObject();this.entity.addChild(n)}static clear(){var e;(e=this.entity)==null||e.clearChildren(),this.tempCloneEntity&&this.tempCloneEntity.destroy(),this.tempCloneEntity=null}}C(ae,"entity"),C(ae,"tempCloneEntity");const Zt=Ie(({asset:o})=>{const{dependentAssets:e}=o,{configDataStore:t}=Re(),{t:n}=Ge(),s=Ie(({dependentAssetInfo:r})=>{const{assetStore:i}=Re(),c=Object.values(i.assets).filter(u=>{const p=u.getMetaConfig().type,y=u.id===r.id,l=u.id===o.id,f=!y&&!l&&!u.isSubAsset;return r.type==="glTF"||r.type==="Prefab"?p==="glTF"||p==="Prefab"&&f:u.getMetaConfig().type===r.type&&f}),a=i.assets[r.id],d=a==null?void 0:a.name;return M.jsx(We,{dropLayer:he.Asset,placeholder:n("prefab.inspector.missed"),assets:c,onSelect:u=>{o.replaceDependentAsset(r,u)},onLocate:()=>{i.selectAsset(r.id)},value:d,asset:a})});return M.jsxs(M.Fragment,{children:[M.jsx(Qe,{title:n("prefab.inspector.basic-info"),defaultOpen:!0,children:t.isBuc&&M.jsx(He,{label:n("prefab.inspector.url")})}),M.jsx(Xe,{label:n("prefab.inspector.dependent-assets"),children:e.map((r,i)=>M.jsx(s,{dependentAssetInfo:r},`${r.id}-${i}`))})]})}),en={asset:{version:"2.0"},root:"defaultPrefab",entities:[{id:"defaultPrefab",name:"prefab"}],components:[]};class tn extends At{constructor(){super(...arguments);C(this,"_animators",[]);C(this,"_particles",[])}setViewAsset(t,n){const s=t.entityManager.rootEntities[0];this._entity=s.engineObject,n.addChild(this._entity),s.getComponentsIncludeChildren("Animator",this._animators).forEach(c=>{c.applyBoundPathChange("enabled",Ye.Toggle,c.enabled)}),this._entity.getComponentsIncludeChildren(Ze,this._particles).forEach(c=>{c.generator.stop(!1,ge.StopEmittingAndClear),c.generator.main.simulationSpeed=1,c.generator.play()})}stopViewAsset(){super.stopViewAsset(),this._particles.forEach(t=>{t.generator.stop(!1,ge.StopEmittingAndClear)})}}function de(o,e,t){if(Array.isArray(o))return o.map(r=>de(r,e,t));if(!o||typeof o!="object")return o;const n=o,s={};for(const[r,i]of Object.entries(n))s[r]=r==="$ref"&&i===e?t:de(i,e,t);return s}function Te(o,e,t){return de(o,e,t)}function nn(o,e,t,n){const s=e.ref??n(e.id);if(typeof s!="string"||s.length===0)throw new Error(`[SceneV2] Unable to replace prefab asset ref "${e.id}": missing old virtualPath`);const r=n(t);if(typeof r!="string"||r.length===0)throw new Error(`[SceneV2] Unable to replace prefab asset ref "${t}": missing new virtualPath`);let i=Te(o,s,r);return s!==e.id&&(i=Te(i,e.id,r)),i}function sn(o,e){const t=e.entities.findIndex(n=>n.id===e.root);if(!e.entities[t])throw new Error(`Prefab asset "${o}" source root "${e.root}" was not found.`);return t}function k(o,e,t){const n=e.entities[t];if(!n)throw new Error(`Prefab asset "${o}" source entity at index "${t}" was not found.`);return n}function N(o,e,t){var s;const n=(s=e.entities[t])==null?void 0:s.id;if(!n)throw new Error(`Prefab asset "${o}" source entity at index "${t}" is missing a stable source id.`);return n}function rn(o,e,t){var s;const n=(s=e.components[t])==null?void 0:s.id;if(!n)throw new Error(`Prefab asset "${o}" source component at index "${t}" is missing a stable source id.`);return n}function xe(o,e,t){const n=k(o,e,t);if(W(n))return[];const s=(n.children??[]).map(r=>e.entities.findIndex(i=>i.id===r));for(const r of s)if(!e.entities[r])throw new Error(`Prefab asset "${o}" source child index "${r}" on entity "${t}" was not found.`);return s}function Me(o,e,t){const n=k(o,e,t);return W(n)?[]:(n.components??[]).map(s=>{const r=e.components.findIndex(c=>c.id===s),i=e.components[r];if(!i)throw new Error(`Prefab asset "${o}" source component "${s}" was not found.`);return{key:rn(o,e,r),type:i.type,schema:i}})}function Oe(o,e,t,n,s){var a,d;const r=N(o,e,t),i=n.find(u=>u.id===r&&!s.has(u.id));if(i)return i;const c=k(o,e,t);if(!W(c)&&!((d=(a=c.instance)==null?void 0:a.asset)!=null&&d.$ref))throw new Error(`Prefab source child "${r}" cannot be matched to a loaded source entity.`)}function on(o,e,t,n){const s=r=>!t.type||r.type===t.type;if(n){const r=o.find(i=>i.key===n&&!e.has(i.key)&&s(i));if(r)return r}if(t.id){const r=o.find(i=>i.key===t.id&&!e.has(i.key)&&s(i));if(r)return r}}function cn(o,e,t,n){const s=(e==null?void 0:e.components)??[],r=t==null?void 0:t.get(o.key);if(r){const c=s.find(a=>(a==null?void 0:a.id)===r&&!a.ignoreToJSON);if(c)return c}const i=s.find(c=>{var d;return!(c!=null&&c.id)||n.has(c.id)||c.ignoreToJSON||((d=c.instance)==null?void 0:d.sourceComponentKey)!==o.key?!1:!c.type||c.type===o.type});if(i)return i}function an(o){var a,d,u,p,y,l,f,h;const e=k(o.assetId,o.prefabFile,o.sourceIndex),t=N(o.assetId,o.prefabFile,o.sourceIndex),n=(d=(a=e==null?void 0:e.instance)==null?void 0:a.asset)==null?void 0:d.$ref;if(!n||!W(e))return!1;const s=((y=(p=(u=o.normalized)==null?void 0:u.entities)==null?void 0:p[o.sceneChild.id])==null?void 0:y.instance)??o.sceneChild.instance,r=s==null?void 0:s.bindingId,i=r?(h=(f=(l=o.normalized)==null?void 0:l.prefab)==null?void 0:f.bindings)==null?void 0:h[r]:void 0,c=o.resolveInstanceAsset(n,t);return c?i?i.instanceRootEntityId===o.sceneChild.id&&i.assetId===c.id&&i.assetKind===c.kind:(s==null?void 0:s.assetId)===c.id&&(s==null?void 0:s.assetKind)===c.kind&&(!(s!=null&&s.role)||s.role==="root"):!1}function dn(o){var s,r;const t=(r=(s=k(o.assetId,o.prefabFile,o.sourceIndex).instance)==null?void 0:s.asset)==null?void 0:r.$ref;if(typeof t!="string")return;const n=o.resolveInstanceAsset(t,o.sourceEntityId);if(!n)throw new Error(`Prefab source entity "${o.sourceEntityId}" references missing instance asset "${t}".`);if(n.kind!=="Prefab"&&n.kind!=="glTF")throw new Error(`Prefab source entity "${o.sourceEntityId}" references unsupported instance asset "${t}" of type "${String(n.kind)}".`);return n}function un(o,e){var r,i,c,a;if(!(o!=null&&o.id))return;const t=((i=(r=e==null?void 0:e.entities)==null?void 0:r[o.id])==null?void 0:i.instance)??o.instance,n=t==null?void 0:t.bindingId,s=n?(a=(c=e==null?void 0:e.prefab)==null?void 0:c.bindings)==null?void 0:a[n]:void 0;return typeof(s==null?void 0:s.sourceRootEntityId)=="string"?s.sourceRootEntityId:void 0}function ie(o,e){return{x:Number((o==null?void 0:o.x)??e.x),y:Number((o==null?void 0:o.y)??e.y),z:Number((o==null?void 0:o.z)??e.z)}}function fn(o,e){const t=o==null?void 0:o.transform;return{position:t!=null&&t.position?ie(t.position,{x:0,y:0,z:0}):e.position,rotation:t!=null&&t.rotation?ie(t.rotation,{x:0,y:0,z:0}):e.rotation,scale:t!=null&&t.scale?ie(t.scale,{x:1,y:1,z:1}):e.scale}}function ln(o,e,t){const n=o==null?void 0:o.layer;return Array.isArray(n)?t?t(n):e:typeof n=="number"?n:e}function hn(o){var c,a,d,u,p,y,l;const e=(c=o.normalized)==null?void 0:c.components,t=(o.sceneComponentId?e==null?void 0:e[o.sceneComponentId]:void 0)??((a=o.component)!=null&&a.id?e==null?void 0:e[o.component.id]:void 0),n={},s=(t==null?void 0:t.refId)??(typeof((d=o.schema.script)==null?void 0:d.$ref)=="string"?o.resolveSourceAssetRefToDomainId(o.schema.script.$ref,`component "${((u=o.component)==null?void 0:u.id)??o.schema.type}" script`):void 0);s&&(n.refId=s);const r=(t==null?void 0:t.scriptKey)??((p=o.schema.script)==null?void 0:p.key);r&&(n.scriptKey=r);const i=(y=t==null?void 0:t.calls)!=null&&y.length?structuredClone(t.calls):(l=o.schema.calls)!=null&&l.length?o.convertSourceRefsToDomainRefs(structuredClone(o.schema.calls)):void 0;return i!=null&&i.length&&(n.calls=i),n}function pn(o){var e,t;return o.sceneEntityIdBySource.has(o.sourceEntityId)?((t=(e=o.allowMissingSceneComponentSourceKeys)==null?void 0:e.get(o.sourceEntityId))==null?void 0:t.has(o.sourceComponentKey))===!0:!0}function mn(o){const{assetId:e,prefabFile:t,sourceRoot:n,sceneRoot:s,normalized:r}=o,i=[],c=[],a=new Map,d=new Map,u=sn(e,t),p=h=>{var E,P;const m=((P=(E=r==null?void 0:r.entities)==null?void 0:E[h.id])==null?void 0:P.instance)??h.instance;return(m==null?void 0:m.role)==="added"},y=(h,m,E,P)=>{var q,ee,te,U;if(p(E))return;const _=N(e,t,h),g=k(e,t,h),T=W(g);i.push({sceneEntityId:E.id,sourceEntityId:_,role:P}),a.set(_,E.id);const V=Me(e,t,h),Y=E.components??[],R=new Set;for(const b of Y){if(!(b!=null&&b.id)||b.ignoreToJSON)continue;const S=((ee=(q=r==null?void 0:r.components)==null?void 0:q[b.id])==null?void 0:ee.instance)??b.instance;if((S==null?void 0:S.role)==="added")continue;const w=((te=o.sceneSourceComponentKeys)==null?void 0:te.get(b.id))??(S==null?void 0:S.sourceComponentKey),I=on(V,R,b,w);if(!I){if(!T)throw new Error(`Prefab asset "${e}" live scene component "${b.id}" on source entity "${_}" cannot be matched to a prefab source component.`);continue}R.add(I.key),c.push({sceneEntityId:E.id,sceneComponentId:b.id,sourceComponentKey:I.key});const $=d.get(_)??new Map;$.set(I.key,b.id),d.set(_,$)}const B=xe(e,t,h),Z=(m==null?void 0:m.children)??[],x=E.children??[],K=new Set,L=new Set;for(let b=0;b<B.length;b++){const S=B[b],w=N(e,t,S),I=Oe(e,t,S,Z,K);I!=null&&I.id&&K.add(I.id);const $=x.find(v=>{var me,ye,Se;if(L.has(v.id)||p(v))return!1;if(v.id===w||I!=null&&I.id&&v.id===I.id||an({assetId:e,prefabFile:t,sourceIndex:S,sceneChild:v,normalized:r,resolveInstanceAsset:o.resolveInstanceAsset}))return!0;const re=((ye=(me=r==null?void 0:r.entities)==null?void 0:me[v.id])==null?void 0:ye.instance)??v.instance,pe=((Se=o.sceneSourceEntityIds)==null?void 0:Se.get(v.id))??(re==null?void 0:re.sourceEntityId)??v.instanceSourceEntityId;return pe===w||(I==null?void 0:I.id)&&pe===I.id});if(!$){if((U=o.allowMissingSceneChildSourceIds)!=null&&U.has(w))continue;throw new Error(`Prefab asset "${e}" source child "${w}" cannot be matched to live scene child under source entity "${_}".`)}L.add($.id),y(S,I,$,"linked")}},l={},f=(h,m,E,P)=>{const _=k(e,t,h),g=N(e,t,h),T={},V=Me(e,t,h),Y=new Set;V.forEach(b=>{var $;const S=cn(b,m,d.get(g),Y);if(S!=null&&S.ignoreToJSON)return;S!=null&&S.id&&Y.add(S.id);const w=typeof(S==null?void 0:S.toJSON)=="function"?S.toJSON():b.schema,I=($=d.get(g))==null?void 0:$.get(b.key);if(!I&&!pn({sourceEntityId:g,sourceComponentKey:b.key,sceneEntityIdBySource:a,allowMissingSceneComponentSourceKeys:o.allowMissingSceneComponentSourceKeys}))throw new Error(`Prefab asset "${e}" source component "${b.key}" on source entity "${g}" cannot be matched to live scene component.`);T[b.key]={sceneComponentId:I,type:w.type??(S==null?void 0:S.type),...hn({component:S,schema:w,sceneComponentId:I,normalized:r,resolveSourceAssetRefToDomainId:o.resolveSourceAssetRefToDomainId,convertSourceRefsToDomainRefs:o.convertSourceRefsToDomainRefs}),props:o.collectComponentProps(S,w)}});const R=dn({assetId:e,prefabFile:t,sourceIndex:h,sourceEntityId:g,resolveInstanceAsset:o.resolveInstanceAsset}),B=R==null?void 0:R.kind,Z=et({sourceEntity:_,fallbackSourceEntityId:g,instanceAssetKind:B,bindingSourceRootEntityId:un(m,r)??(R==null?void 0:R.sourceRootEntityId)}),x=tt(_,g,{...typeof Z=="string"?{rootOverrideTarget:Z}:{}}),K=ln(m,x.layer,o.combineLayers),L=(m==null?void 0:m.isLocked)??x.isLocked,q=xe(e,t,h),ee=q.map(b=>N(e,t,b));l[g]={sceneEntityId:a.get(g),parentSourceEntityId:E,childSourceEntityIds:ee,childIndex:P,...B?{instanceAssetKind:B}:{},name:(m==null?void 0:m.name)??x.name,isActive:(m==null?void 0:m.isActive)??x.isActive,...K!==void 0?{layer:K}:{},...L!==void 0?{isLocked:L}:{},transform:fn(m,x.transform),components:T};const te=(m==null?void 0:m.children)??[],U=new Set;q.forEach((b,S)=>{const w=Oe(e,t,b,te,U);w!=null&&w.id&&U.add(w.id),f(b,w,g,S)})};return y(u,n,s,"root"),f(u,n,null,0),{entityMappings:i,componentMappings:c,sourceEntitySnapshots:l}}class yn{constructor(e){this.host=e}async apply(e,t){const n=this.host.readSourceFile(),s=e(n);try{if(this.host.writeSourceFile(s),this.host.syncDependentAssets(),this.host.updateCreateByAddResumeSnapshot(),(t==null?void 0:t.refresh)===!1)return;await this.host.refreshContent((t==null?void 0:t.structuralDeltaMode)==="domain-source-replace"?{structuralDeltaMode:"domain-source-replace"}:void 0)}catch(r){throw this.host.writeSourceFile(n),this.host.syncDependentAssets(),this.host.updateCreateByAddResumeSnapshot(),r}}}var Sn=Object.defineProperty,bn=Object.getOwnPropertyDescriptor,X=(o,e,t,n)=>{for(var s=n>1?void 0:n?bn(e,t):e,r=o.length-1,i;r>=0;r--)(i=o[r])&&(s=(n?i(e,t,s):i(s))||s);return n&&s&&Sn(e,t,s),s};const O=Ct("PrefabAsset"),De=new Rt("PrefabAsset"),ue=[0,0,0],fe=[0,0,0],le=[1,1,1];function Fe(o){const e=new Map;for(const[t,n]of o)e.set(n,t);return e}function ce(o,e,t){const n=o??e;return[(t==null?void 0:t.x)??n[0],(t==null?void 0:t.y)??n[1],(t==null?void 0:t.z)??n[2]]}function In(o,e){e&&Object.assign(o,{...e.position?{position:ce(o.position,ue,e.position)}:{},...e.rotation?{rotation:ce(o.rotation,fe,e.rotation)}:{},...e.scale?{scale:ce(o.scale,le,e.scale)}:{}})}let j=class extends vt{constructor(e){super(e);C(this,"acceptDragLayer",he.Entity);C(this,"_entityManager");C(this,"_contentQueue",new $t);C(this,"prefabFile",null);C(this,"dependentAssets",[]);C(this,"_skipInitUpdateContent",!1);this._entityManager=new ot(e)}static async createByEntity(e){var t,n,s;if(e.isPrefabSubEntity||e.isGLTFSubEntity){nt.error(J("prefab.error.create-from-sub"));return}Ee()&&st();try{De.info("createByEntity START",{entityName:e.name,entityId:e.id,isGLTFWrap:e.isGLTFWrapEntity,childCount:(t=e.children)==null?void 0:t.length,childNames:(n=e.children)==null?void 0:n.map(i=>i.name),hasGLTFChild:(s=e.children)==null?void 0:s.some(i=>i.isGLTFRefEntity)});const{assetFacade:r}=e.root;await e.root.runInUndoGroup("asset.create",async()=>{const i=await r.createAssetByAdd({assetType:"Prefab",name:e.name});await i.updateByEntity(e,!1,{undoable:!0,replaceInstances:!1}),i.addInstance(e,{undoable:!0}),i._bindInstantiatedEntity(e,{undoable:!0})})}finally{Ee()&&rt()}}get entityManager(){return this._entityManager}get entities(){var e;return((e=this.prefabFile)==null?void 0:e.entities)??[]}async initByMain(e,t){const{dependentAssets:n}=this.meta;if(this.url=t,this.prefabFile=it(await e.text()),this.dependentAssets=n,this._skipInitUpdateContent){this._skipInitUpdateContent=!1;return}await this._updateContent()}async initByCreation(){return this.prefabFile=en,this._skipInitUpdateContent=!0,this.getMainData()}getMainData(){return ct(this._requirePrefabSourceFile("serializing prefab main data"))}async updateByEntity(e,t=!1,n){De.info("updateByEntity START",{entityName:e.name,entityId:e.id,isGLTFWrap:e.isGLTFWrapEntity,updateInstanceFrom:t});const s=this._serializeRootEntityTreeForSource(e),r=s.entities;if(r[0]){delete r[0].position;const i=r[0].instance?this._resolveNestedInstanceRootOverrideTarget(e):void 0;at(r[0],i)}this.prefabFile={asset:{version:"2.0"},root:s.entityIds[0],entities:r,components:s.components},this._syncDependentAssetsFromPrefabFile(),this._updateCreateByAddResumeSnapshot(),t&&this.addInstance(e),await this._updateContent({...n!=null&&n.undoable?{undoable:!0}:{},...(n==null?void 0:n.replaceInstances)===!1?{replaceInstances:!1}:{}})}async refreshFromData(e){await this._updateContent(e)}async _editPrefabSource(e,t){await new yn({readSourceFile:()=>this.prefabFile,writeSourceFile:n=>{this.prefabFile=n},syncDependentAssets:()=>this._syncDependentAssetsFromPrefabFile(),updateCreateByAddResumeSnapshot:()=>this._updateCreateByAddResumeSnapshot(),refreshContent:n=>this._updateContent(n)}).apply(e,t)}async applyEntityPropsOverride(e,t,n){await this._editPrefabSource(s=>Ft(s,e,t),n)}async applyComponentPropsOverride(e,t,n){const s=t?this._componentPropsOverrideToSourcePatch(e,t):void 0;await this._editPrefabSource(r=>kt(r,e,s),n)}async applyAddedEntityOverride(e,t,n,s){const r=this._serializeEntityTreeForSource(n),i=this._resolveSourceChildInsertionIndex(e,t,n);await this._editPrefabSource(c=>Wt(c,{parentSourceEntityId:e,index:i,entities:r.entities,entityIds:r.entityIds,components:r.components,componentIds:r.componentIds}),{...s,structuralDeltaMode:"domain-source-replace"})}async applyNestedInstanceAddedEntityOverride(e,t,n,s,r){const i=this._serializeEntityInlineForSource(s);await this._editPrefabSource(c=>Qt(c,{instanceSourceEntityId:e,parentSourceEntityId:t,index:n,entity:i}),{...r,structuralDeltaMode:"domain-source-replace"})}async applyRemovedEntityOverride(e,t){await this._editPrefabSource(n=>Ht(n,e),{...t,structuralDeltaMode:"domain-source-replace"})}async applyAddedComponentOverride(e,t,n,s){await this._editPrefabSource(r=>Xt(r,{sourceEntityId:e,sourceComponentId:t,component:this._componentSchemaToSourceRefs(n)}),{...s,structuralDeltaMode:"domain-source-replace"})}async applyRemovedComponentOverride(e,t){await this._editPrefabSource(n=>Yt(n,e),{...t,structuralDeltaMode:"domain-source-replace"})}replaceDependentAsset(e,t){const n=this.root.assetStore;this.prefabFile=nn(this.prefabFile,e,t.id,s=>{var r;return(r=n.getAssetVirtualPath)==null?void 0:r.call(n,s)}),e.id=t.id,e.name=t.name,e.type=t.getMetaConfig().type,e.ref=this._createSourceRefCodec().domainToSource(t.id,"replace prefab asset"),this._updateContent()}_createSourceSerializeContext(e=[]){var s,r;const t=this.root.assetStore,n=(r=(s=this.root.domainStore)==null?void 0:s.getNormalizedState)==null?void 0:r.call(s);return new dt(e,i=>{var c;return(c=t.getAssetVirtualPath)==null?void 0:c.call(t,i)},i=>{var a;const c=(a=n==null?void 0:n.components)==null?void 0:a[i];if(c)return{refId:c.refId,scriptKey:c.scriptKey,calls:c.calls}})}_createSourceRefCodec(){const e=this.root.assetStore;return ut({resolveAssetRef:t=>{var n;return(n=e.getAssetVirtualPath)==null?void 0:n.call(e,t)},resolveSourceRef:t=>{var n,s;return(s=(n=e.getAssetByVirtualPath)==null?void 0:n.call(e,t))==null?void 0:s.id},resolveAssetKind:t=>{var s,r,i,c;const n=(c=(i=(r=(s=e.getAssetByVirtualPath)==null?void 0:s.call(e,t))==null?void 0:r.getMetaConfig)==null?void 0:i.call(r))==null?void 0:c.type;return n==="Prefab"||n==="glTF"?n:void 0}})}_convertDomainRefsToSourceRefs(e){return this._createSourceSerializeContext().convertRefs(e)}_convertSourceRefsToDomainRefs(e){const t=this._createSourceRefCodec();return ft(e,n=>t.sourceToDomain(n,"prefab source"))}_componentSchemaToSourceRefs(e){var s,r;const t=this._createSourceSerializeContext(),n=structuredClone(e);return(s=n.script)!=null&&s.$ref&&(n.script={$ref:this._componentScriptRefToSourceRef(n.script.$ref),...n.script.key?{key:n.script.key}:{}}),n.props&&(n.props=t.convertRefs(n.props)),(r=n.calls)!=null&&r.length&&(n.calls=t.convertRefs(n.calls)),n}_componentScriptRefToSourceRef(e){var n,s,r;const t=this._createSourceRefCodec();return(r=(s=(n=this.root.assetStore).getAssetByVirtualPath)==null?void 0:s.call(n,e))!=null&&r.id?(lt(e,"prefab script"),e):t.domainToSource(e,"prefab script")}_findSourceComponentModel(e){var n,s;const t=[...((n=this._entityManager)==null?void 0:n.rootEntities)??[]];for(;t.length>0;){const r=t.pop(),i=(s=r==null?void 0:r.components)==null?void 0:s.find(c=>(c==null?void 0:c.id)===e);if(i)return i;t.push(...(r==null?void 0:r.children)??[])}}_componentPropsOverrideToSourcePatch(e,t){const n=this._findSourceComponentModel(e);if(!n||typeof n.toJSON!="function")return this._convertDomainRefsToSourceRefs(t);const s=c=>this._componentSchemaToSourceRefs(c.toJSON()),r=ht(n,s),i=pt(n,t,s);return mt(r,i)}_serializeEntityTreeForSource(e,t={}){const n=t.materializeRootPrefabInstance?null:this._serializeNestedInstanceRootEntityForSource(e);if(n)return{entities:[n],entityIds:[e.id],components:[],componentIds:[]};const s=this._collectEntitySubtree(e,{materializeRootPrefabInstance:t.materializeRootPrefabInstance}),r=s.map(c=>c.id),i=this._createSourceSerializeContext(r);return{entities:s.map((c,a)=>a===0&&t.materializeRootPrefabInstance?c.toV2(i,!0):this._serializeNestedInstanceRootEntityForSource(c)??c.toV2(i,!0)),entityIds:i.entityIds,components:i.components,componentIds:i.componentIds}}_serializeRootEntityTreeForSource(e){const t=this._serializeNestedInstanceRootInlineForSource(e);return t?{entities:[t],entityIds:[e.id],components:[],componentIds:[]}:this._serializeEntityTreeForSource(e)}_sourceEntityTreeToInlineEntity(e,t=0){const n=e.entities[t];if(!n)throw new Error(`Prefab source added entity tree is missing entity index ${t}`);const{children:s,components:r,...i}=n,c=structuredClone(i),a=new Map(e.components.map(u=>[u.id,u]));r!=null&&r.length&&(c.components=r.map(u=>{const p=a.get(u);if(!p)throw new Error(`Prefab source added entity tree is missing component "${String(u)}"`);return structuredClone(p)}));const d=new Map(e.entities.map((u,p)=>[u.id,p]));return s!=null&&s.length&&(c.children=s.map(u=>{const p=d.get(u);if(p===void 0)throw new Error(`Prefab source added entity tree is missing child "${String(u)}"`);return this._sourceEntityTreeToInlineEntity(e,p)})),c}_serializeEntityInlineForSource(e){const t=this._serializeNestedInstanceRootInlineForSource(e);return t||this._sourceEntityTreeToInlineEntity(this._serializeEntityTreeForSource(e))}_serializeNestedInstanceRootEntityForSource(e){const t=this._resolveNestedInstanceAssetRef(e);if(!t)return null;const n=this._serializeNestedInstanceRootFromEntityModel(e,t);if(n)return n;const s={id:e.id,instance:{asset:t}};return this._mergeEntitySourcePropsIntoInstanceOverrides(s,e),s}_serializeNestedInstanceRootInlineForSource(e){const t=this._serializeNestedInstanceRootEntityForSource(e);if(!t)return null;const{children:n,components:s,...r}=t;return r}_serializeNestedInstanceRootFromEntityModel(e,t){if(typeof e.toV2!="function")return null;const n=this._createSourceSerializeContext([e.id]),s=e.toV2(n,!1);if(!s.instance)return null;const{children:r,components:i,...c}=structuredClone(s);return c.instance={...c.instance,asset:{...c.instance.asset??{},$ref:t.$ref}},this._mergeEntitySourcePropsIntoInstanceOverrides(c,e),c}_mergeEntitySourcePropsIntoInstanceOverrides(e,t){if(!e.instance)return;const n={};if(this._writeEntitySourceProps(n,t),Object.keys(n).length===0)return;const s=e.instance.overrides??{},r=[...s.entityProps??[]],i=this._resolveNestedInstanceRootOverrideTarget(t),c=r.findIndex(a=>a.target===i);if(c>=0){const a=r[c];r[c]={...n,...a,target:i}}else r.unshift({target:i,...n});e.instance.overrides={...s,entityProps:r}}_resolveNestedInstanceRootOverrideTarget(e){var s,r;const t=this._findInstanceRootBinding(e.id);if(t!=null&&t.sourceRootEntityId)return t.sourceRootEntityId;if(((t==null?void 0:t.assetKind)??((r=(s=this._resolveNestedInstanceAsset(e))==null?void 0:s.getMetaConfig)==null?void 0:r.call(s).type))==="glTF")return"root";throw new Error(`Cannot serialize nested instance "${e.id}": missing source root entity id for instance overrides.`)}_resolveNestedInstanceAssetRef(e){var r;if(!this._isNestedInstanceRootForSource(e))return null;const t=this._resolveNestedInstanceAsset(e);if(!t)throw new Error(`Cannot serialize nested instance "${e.id}": source asset is not registered.`);const n=(r=t.getMetaConfig)==null?void 0:r.call(t).type;if(n!=="Prefab"&&n!=="glTF")throw new Error(`Cannot serialize nested instance "${e.id}": asset "${t.id}" is type "${n}".`);return{$ref:this._createSourceRefCodec().domainToSource(t.id,`nested instance "${e.id}"`)}}_isNestedInstanceRootForSource(e){var n;const t=this._findInstanceRootBinding(e.id);return(t==null?void 0:t.assetKind)==="Prefab"||(t==null?void 0:t.assetKind)==="glTF"?!0:!!(e.isGLTFRefEntity&&!((n=e.parentEntity)!=null&&n.isGLTFRefEntity))}_findInstanceRootBinding(e){var t,n,s;return Object.values(((s=(n=(t=this.root.domainStore)==null?void 0:t.state)==null?void 0:n.prefab)==null?void 0:s.bindings)??{}).find(r=>r.instanceRootEntityId===e)}_resolveNestedInstanceAsset(e){var s,r;const t=this._findInstanceRootBinding(e.id);if((t==null?void 0:t.assetKind)==="Prefab"||(t==null?void 0:t.assetKind)==="glTF")return(s=this.root.assetStore.assets)==null?void 0:s[t.assetId];const n=(r=e.engineObject)==null?void 0:r._templateResource;if(n)return this.root.assetStore.engineObjectToAssetMap.get(n)}_writeEntitySourceProps(e,t){t.name&&(e.name=t.name),t.isActive===!1&&(e.isActive=!1),t.isLocked&&(e.isLocked=!0);const n=t.layer,s=Array.isArray(n)?we(n):typeof n=="number"?n:0;s!==0&&(e.layer=s),this._writeEntityTransformTuples(e,t)}_writeEntityTransformTuples(e,t){const n=t.transform;if(!n)return;const s=(d,u)=>[Number((d==null?void 0:d.x)??u[0]),Number((d==null?void 0:d.y)??u[1]),Number((d==null?void 0:d.z)??u[2])],r=(d,u)=>d[0]===u[0]&&d[1]===u[1]&&d[2]===u[2],i=s(n.position,ue);r(i,ue)||(e.position=i);const c=s(n.rotation,fe);r(c,fe)||(e.rotation=c);const a=s(n.scale,le);r(a,le)||(e.scale=a)}destroy(){super.destroy(),this.engineObject&&(this.engineObject._root.destroy(),this.engineObject.destroy())}unpackAllInstances(){var n;const e=this.root.sceneStore,t=this._queryInstanceEntityIdsFromDomain();for(const s of t){const r=(n=e.getEntityModel)==null?void 0:n.call(e,s);r==null||r.unpackPrefab()}super.unpackAllInstances()}async instantiate(e,t,n){var l;const s=structuredClone(this.prefabFile),r=yt(s);if(typeof s.root!="string")throw new Error(`Prefab asset "${this.id}" source root must be a stable source entity id.`);const i=r.entityIndexById.get(s.root);if(i===void 0)throw new Error(`Prefab asset "${this.id}" source root "${s.root}" was not indexed.`);const c=s.entities[i];c&&In(c,t);const a=this._assignSceneInstanceIds(s,i,n==null?void 0:n.expectedRootId),d=f=>{var h,m;return(m=(h=this.root.assetStore).getAssetByVirtualPath)==null?void 0:m.call(h,f)},u=await e.hydrateSourceV2LocalEntities(s,{resolveSourceRef:f=>{var m;const h=(m=d(f))==null?void 0:m.id;if(typeof h!="string"||h.length===0)throw new Error(`[SceneV2] Unable to resolve asset ref "${f}" while instantiating prefab "${this.id}". Source-v2 $ref must be a virtualPath, not an editor asset id.`);return h},resolveAssetKind:f=>{var m,E,P;const h=(P=(E=(m=d(f))==null?void 0:m.getMetaConfig)==null?void 0:E.call(m))==null?void 0:P.type;return h==="Prefab"||h==="glTF"?h:void 0},resolvePrefabSourceFile:f=>{var m,E,P,_;const h=(E=(m=this.root.assetStore).getAsset)==null?void 0:E.call(m,f);return((_=(P=h==null?void 0:h.getMetaConfig)==null?void 0:P.call(h))==null?void 0:_.type)==="Prefab"?h.prefabFile:void 0},clearExisting:!1,registerDomain:(n==null?void 0:n.deferDomainBinding)!==!0,deferredInstanceBindings:(n==null?void 0:n.deferredInstanceBindings)??[]}),p=(l=s.entities[i])==null?void 0:l.id,y=(p?e.entities.get(p):void 0)??u[0];if(await this._ensureSourceEntityManagerReady(),y.convertToPrefabRefEntity(),(n==null?void 0:n.deferDomainBinding)!==!0&&e.isDomainScoped&&!this.root.domainStore.state.entities[y.id]&&e.registerEntityTreeInDomain(y,null),this.addInstance(y,n),n!=null&&n.deferDomainBinding){if(!n.deferredInstanceBindings)throw new Error(`PrefabAsset "${this.id}" cannot defer domain binding without a deferred binding queue.`);return n.deferredInstanceBindings.push(()=>this._bindInstantiatedEntity(y,{...n,...a})),y}return this._bindInstantiatedEntity(y,{...n,...a}),y}_assignSceneInstanceIds(e,t,n){const s=new Map;e.entities.forEach((i,c)=>{s.set(i.id,n&&c===t?n:Pe())});const r=new Map;return e.components.forEach(i=>{r.set(i.id,Pe())}),this._remapLocalHydrationIds(e,s,r),{sourceEntityIdBySceneId:Fe(s),sourceComponentKeyBySceneComponentId:Fe(r)}}_remapLocalHydrationIds(e,t,n){const s=r=>{if(Array.isArray(r))return r.map(a=>s(a));if(!r||typeof r!="object")return r;const i=r;if(typeof i.$entity=="string")return{$entity:t.get(i.$entity)??i.$entity};if(typeof i.$component=="string")return{$component:n.get(i.$component)??i.$component};const c={};for(const[a,d]of Object.entries(i))c[a]=s(d);return c};e.root=t.get(e.root)??e.root,e.entities=e.entities.map(r=>{var a,d;const i=r.id,c=structuredClone(r);return c.id=t.get(i)??i,(a=c.children)!=null&&a.length&&(c.children=c.children.map(u=>t.get(u)??u)),(d=c.components)!=null&&d.length&&(c.components=c.components.map(u=>n.get(u)??u)),c}),e.components=e.components.map(r=>{var c;const i=structuredClone(r);return i.id=n.get(r.id)??r.id,i.props&&(i.props=s(i.props)),(c=i.calls)!=null&&c.length&&(i.calls=s(i.calls)),i})}async _ensureSourceEntityManagerReady(){if(!this._entityManager.rootEntities[0]&&(await this._entityManager.init(this),!this._entityManager.rootEntities[0]))throw new Error(`PrefabAsset "${this.id}" has no source root entity after source initialization.`)}_updateCreateByAddResumeSnapshot(){const e=this.getMainData(),t=this.getMetaData(),n=this.name??"Prefab";if(typeof e!="string"||e.length===0)throw new Error(`[PrefabAsset] ${n} (${this.id}) cannot update create-by-add resume snapshot without serialized main data.`);const s=new Blob([e],{type:"application/json"});this.root.assetStore.updateCreateByAddResumeSnapshot(this.id,{assetName:n,serializedMeta:JSON.stringify(t),mainBlob:s})}_bindInstantiatedEntity(e,t){if(e.entityManager&&!e.entityManager.isDomainScoped)return;const n=this._entityManager.rootEntities[0];if(!n)return;const{prefab:s}=this.root.domainStore.state,r=s.byAssetId[this.id]??[],i=r.map(l=>s.bindings[l]).find(l=>(l==null?void 0:l.instanceRootEntityId)===e.id||(t==null?void 0:t.expectedBindingId)===(l==null?void 0:l.id)),c=i?new Set(Object.keys(i.overrides.removedEntities??{})):void 0,a=i?new Map(Object.entries(i.overrides.removedComponents??{}).map(([l,f])=>[l,new Set(Object.keys(f??{}))])):void 0,{entityMappings:d,componentMappings:u,sourceEntitySnapshots:p}=this._collectInstanceMappings(n,e,c!=null&&c.size||a!=null&&a.size?{...t,...c!=null&&c.size?{allowMissingSceneChildSourceIds:c}:{},...a!=null&&a.size?{allowMissingSceneComponentSourceKeys:a}:{}}:t);if(!d.length)return;for(const l of r){const f=s.bindings[l];if((f==null?void 0:f.instanceRootEntityId)===e.id||(t==null?void 0:t.expectedBindingId)===l){t!=null&&t.syncPreservedInstanceState&&this._syncPreservedInstanceStateFromSource(f,p),this.root.prefabFacade.updateBindingSourceBaseline({assetId:this.id,bindingId:l,instanceRootEntityId:e.id,sourceRevision:f.sourceRevision,entityMappings:d,componentMappings:u,sourceEntitySnapshots:p});return}}let y=1;for(const l of r){const f=s.bindings[l];f&&f.sourceRevision>y&&(y=f.sourceRevision)}this.root.prefabFacade.bindExistingInstance({assetId:this.id,instanceRootEntityId:e.id,sourceRevision:y,entityMappings:d,componentMappings:u,sourceEntitySnapshots:p,undoable:(t==null?void 0:t.undoable)===!0})}_syncPreservedInstanceStateFromSource(e,t){const n=this.root.domainStore.getNormalizedState(),s=[];for(const[r,i]of Object.entries(t)){const c=i.sceneEntityId??e.sourceToSceneEntity[r];if(!c)continue;const a=n.entities[c];if(!a)continue;const d=`/entities/${ne(c)}`,u=e.overrides.entityProps[r];(u==null?void 0:u.name)===void 0&&i.name!==void 0&&a.name!==i.name&&s.push({op:"replace",path:`${d}/name`,value:i.name}),(u==null?void 0:u.isActive)===void 0&&i.isActive!==void 0&&a.isActive!==i.isActive&&s.push({op:"replace",path:`${d}/isActive`,value:i.isActive}),(u==null?void 0:u.layer)===void 0&&(i.layer===void 0?a.layer!==void 0&&s.push({op:"remove",path:`${d}/layer`}):a.layer!==i.layer&&s.push({op:a.layer===void 0?"add":"replace",path:`${d}/layer`,value:i.layer}));const p=u==null?void 0:u.transform;for(const l of["position","rotation","scale"]){if((p==null?void 0:p[l])!==void 0)continue;const f=i.transform[l];_e(a.transform[l],f)||s.push({op:"replace",path:`${d}/transform/${l}`,value:f})}const y=e.overrides.componentProps[r]??{};for(const[l,f]of Object.entries(i.components)){const h=f.sceneComponentId;if(!h)continue;const m=n.components[h];if(!m)continue;const E=`${d}/components/${ne(h)}`,P=y[l]??{},_=f.props??{};for(const[g,T]of Object.entries(_)){if(Object.prototype.hasOwnProperty.call(P,g))continue;const V=`${E}/props/${ne(g)}`;_e(m.props[g],T)||s.push({op:Object.prototype.hasOwnProperty.call(m.props,g)?"replace":"add",path:V,value:T})}for(const g of Object.keys(m.props))Object.prototype.hasOwnProperty.call(_,g)||Object.prototype.hasOwnProperty.call(P,g)||s.push({op:"remove",path:`${E}/props/${ne(g)}`})}}this.root.domainStore.applySystem(s)}_collectInstanceMappings(e,t,n){var s,r,i;return mn({assetId:this.id,prefabFile:this._requirePrefabSourceFile(),sourceRoot:e,sceneRoot:t,normalized:(i=(r=(s=this.root)==null?void 0:s.domainStore)==null?void 0:r.getNormalizedState)==null?void 0:i.call(r),sceneSourceEntityIds:n==null?void 0:n.sourceEntityIdBySceneId,sceneSourceComponentKeys:n==null?void 0:n.sourceComponentKeyBySceneComponentId,allowMissingSceneChildSourceIds:n==null?void 0:n.allowMissingSceneChildSourceIds,allowMissingSceneComponentSourceKeys:n==null?void 0:n.allowMissingSceneComponentSourceKeys,resolveInstanceAsset:(c,a)=>{var y,l,f,h;const d=(l=(y=this.root.assetStore).getAssetByVirtualPath)==null?void 0:l.call(y,c);if(!d)throw new Error(`Prefab source entity "${a}" references missing instance asset "${c}".`);const u=(h=(f=d.getMetaConfig)==null?void 0:f.call(d))==null?void 0:h.type;if(u!=="Prefab"&&u!=="glTF")throw new Error(`Prefab source entity "${a}" references unsupported instance asset "${c}" of type "${String(u)}".`);const p=d.prefabFile;return{id:d.id,kind:u,...u==="Prefab"&&typeof(p==null?void 0:p.root)=="string"?{sourceRootEntityId:p.root}:{}}},resolveSourceAssetRefToDomainId:(c,a)=>this._createSourceRefCodec().sourceToDomain(c,a),convertSourceRefsToDomainRefs:c=>this._convertSourceRefsToDomainRefs(c),collectComponentProps:(c,a)=>this._collectSnapshotComponentProps(c,a),combineLayers:c=>we(c)})}_requirePrefabSourceFile(e="using prefab source file"){const t=this.prefabFile;if(!t)throw new Error(`Prefab asset "${this.id}" has no source file while ${e}.`);if(!Array.isArray(t.entities))throw new Error(`Prefab asset "${this.id}" source file is missing entity anchors.`);return t}_resolveSourceChildInsertionIndex(e,t,n){var p,y,l;const s=this._requirePrefabSourceFile(),r=s.entities.findIndex(f=>f.id===e);if(r<0)return t;const i=new Set(((p=s.entities[r])==null?void 0:p.children)??[]);if(i.size===0)return 0;const c=((y=n.parentEntity)==null?void 0:y.children)??[],a=c.findIndex(f=>f.id===n.id),d=a>=0?a:Math.min(Math.max(t,0),c.length);let u=0;for(let f=0;f<d;f+=1){const h=(l=c[f])==null?void 0:l.instanceSourceEntityId;h&&i.has(h)&&(u+=1)}return Math.min(Math.max(u,0),i.size)}_collectSnapshotComponentProps(e,t){return e&&Reflect.ownKeys(St(e)).length>0?this._convertSourceRefsToDomainRefs(bt(e)):this._convertSourceRefsToDomainRefs(structuredClone(t.props??{}))}async replaceInstance(e,t,n){var d,u,p;const s=t.entities.get(e);if(!s)return null;const r=(d=s==null?void 0:s.engineObject)==null?void 0:d.transform,i=r?{position:{x:r.position.x,y:r.position.y,z:r.position.z},rotation:{x:r.rotation.x,y:r.rotation.y,z:r.rotation.z},scale:{x:r.scale.x,y:r.scale.y,z:r.scale.z}}:void 0,c=(p=(u=s.root.domainStore.getNormalizedState().entities[e])==null?void 0:u.instance)==null?void 0:p.bindingId,a=await this.instantiate(t,n!=null&&n.resetRootTransform?void 0:i,{...n!=null&&n.undoable?{undoable:!0}:{},expectedBindingId:c});return a.convertToPrefabRefEntity(),n!=null&&n.structuralDeltaMode?t.replaceEntity(e,a,{structuralDeltaMode:n.structuralDeltaMode}):t.replaceEntity(e,a),a}_refreshTrackedInstanceBindings(e){var s;const t=this.root.sceneStore,n=this._queryInstanceEntityIdsFromDomain();for(const r of n){const i=(s=t.getEntityModel)==null?void 0:s.call(t,r);i&&this._bindInstantiatedEntity(i,e)}}_instantiateEngineObject(){return this.engineObject.instantiate()}_onDrop(e,t){if(!t||t.id===this.id)return;this.dropping=!1;const{sceneStore:n,sceneUIStore:s}=this.root,r=Array.from(s.selectedKeys);if(r.length>1)for(let i=0;i<r.length;i++)j.createByEntity(n.getEntityModel(r[i]));else It({title:J("prefab.replace.title").toString(),description:J("prefab.replace.description",{name:this.name}).toString(),confirmText:J("prefab.replace.confirm").toString(),onConfirm:()=>{const i=n.getEntityModel(r[0]);this.updateByEntity(i,!0)}})}_rebaseInstanceRevisions(){const{prefabFacade:e,domainStore:t}=this.root,n=t.state.prefab.byAssetId[this.id];if(!n||n.length===0)return;let s=0;for(const r of n){const i=t.state.prefab.bindings[r];i&&i.sourceRevision>s&&(s=i.sourceRevision)}e.updatePrefabContent(this.id,s+1)}_collectEntitySubtree(e,t={}){const n=[],s=(r,i=!1)=>{if(n.push(r),!(this._isNestedInstanceRootForSource(r)&&!(i&&t.materializeRootPrefabInstance)))for(const a of r.children)a.prefabEntityRemoved||s(a)};return s(e,!0),n}_collectDependentAssetsFromPrefabFile(){var n;const e=new Set,t=this.root.assetStore;for(const s of Tt(this.prefabFile,["$ref"])){if(typeof s!="string"||s===this.id)continue;const r=(n=t.getAssetByVirtualPath)==null?void 0:n.call(t,s);if(!r)throw new Error(`[SceneV2] Unable to resolve prefab asset ref "${s}" while collecting dependencies`);r.id!==this.id&&e.add(r)}return e}_syncDependentAssetsFromPrefabFile(){const e=this.root.assetStore;this.dependentAssets=Array.from(this._collectDependentAssetsFromPrefabFile(),t=>({id:t.id,name:t.name,type:t.getMetaConfig().type,ref:(()=>{var s;const n=(s=e.getAssetVirtualPath)==null?void 0:s.call(e,t.id);if(typeof n!="string"||n.length===0)throw new Error(`[SceneV2] Unable to serialize prefab dependency ref "${t.id}": missing virtualPath`);return n})()}))}_updateContent(e){return this._contentQueue.enqueue(async()=>{try{await this._updateContentInternal(e)}catch(t){if(t instanceof Error&&t.message==="cancelled")return;throw O.error("_updateContent failed:",t),t}})}async _updateContentInternal(e){const{url:t,dependentAssets:n}=this,s=(e==null?void 0:e.persist)!==!1;await Promise.all(n.map(a=>this.root.assetStore.getAssetByRef({refId:a.id}))),await this._entityManager.init(this);const r=this.engineObject;if(r){this.root.assetStore.engineObjectToAssetMap.delete(r);try{r.destroy()}catch(a){O.warn("failed to destroy oldEngineObject:",a)}}const i=new gt(this.engine,t);this.bindEngineObject(i),this.root.assetStore.engineObjectToAssetMap.set(i,this);let c=this._entityManager.rootEntities[0];if(c||(c=this._entityManager.createEntity("prefab","defaultPrefab"),c.bindEngineObject(new Ce(this.engine,"prefab")),O.error(`The prefab which id is ${this.id} is broken, use default prefab instead.`)),c.engineObject||(O.warn("rootEntity engineObject is null, binding new Entity"),c.bindEngineObject(new Ce(this.engine,"prefab"))),this._markAsTemplate(c),i._root=c.engineObject,c.once("delete",()=>{O.error(`The prefab which id is ${this.id} is broken.`),this._updateContent().catch(a=>{O.error(`Failed to rebuild broken prefab which id is ${this.id}.`,a)})}),this._updateDragTempEntity(),this.updateThumbnail(),s&&(this.root.assetFacade.persistAssetMeta(this.id),this.root.assetFacade.persistAssetMain(this.id)),(e==null?void 0:e.replaceInstances)!==!1){const a=new Set((e==null?void 0:e.resetRootTransformBindingIds)??[]),d=e!=null&&e.undoable?{undoable:!0}:void 0,u=this.root.sceneStore,p=this._queryInstanceEntityIdsFromDomain();await Promise.all(p.map(y=>{var f,h;const l=(h=(f=this.root.domainStore.getNormalizedState().entities[y])==null?void 0:f.instance)==null?void 0:h.bindingId;return this.replaceInstance(y,u,{...d??{},resetRootTransform:l!==void 0&&a.has(l),...e!=null&&e.structuralDeltaMode?{structuralDeltaMode:e.structuralDeltaMode}:{}})}))}else{const a={...e!=null&&e.undoable?{undoable:!0}:{},syncPreservedInstanceState:!0};this._refreshTrackedInstanceBindings(a)}this._rebaseInstanceRevisions()}_markAsTemplate(e){const t=e.engineObject;if(!t){O.warn("_markAsTemplate: engineObject is null",{prefabId:this.id,entityModelId:e.id});return}const n=t;n._templateResource||n._markAsTemplate(this.engineObject),e.selfChildren.forEach(s=>{this._markAsTemplate(s)})}};X([Et()],j.prototype,"prefabFile",2);X([wt(),Pt],j.prototype,"dependentAssets",2);X([ke],j.prototype,"replaceDependentAsset",1);X([ke],j.prototype,"_onDrop",1);j=X([_t({type:"Prefab",label:J("asset.prefab.title"),extname:"prefab",dragLayer:he.Prefab,customInspector:Zt,viewer:tn,thumbnail:ae,async bundle(o){return{content:new Blob([o.content],{type:"application/json"})}}})],j);export{j as PrefabAsset};
@@ -1 +0,0 @@
1
- var p=Object.defineProperty;var l=(t,e,s)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var o=(t,e,s)=>(l(t,typeof e!="symbol"?e+"":e,s),s);import{j as m,u as h,aW as u,aX as d,aY as f,aZ as y,n as D,e as S,o as v}from"./index-c3dec278.js";import"./index-cdbb2f4d.js";import"./postmen-2853c0e6.js";function b(t){const e={asset:{version:"2.0",generator:"Galacean Editor"},scene:{rootEntities:["1000000","1000001"],background:{mode:0,color:{r:.0157,g:.0157,b:.0157,a:1}},ambient:{},shadow:{},fog:{}},entities:[{id:"1000000",name:"Camera",position:[0,0,10],components:["1000100"]},{id:"1000001",name:"DirectLight",position:[0,3,0],rotation:[-45,-45,0],components:["1000101"]}],components:[{id:"1000100",type:"Camera",props:{isOrthographic:!1,nearClipPlane:.1,farClipPlane:100,viewport:{x:0,y:0,z:1,w:1}}},{id:"1000101",type:"DirectLight",props:{enabled:!0,intensity:.6,color:{r:1,g:1,b:1,a:1}}}]};return t!==void 0&&(e.scene.name=t),e}var g=Object.defineProperty,w=Object.getOwnPropertyDescriptor,C=(t,e,s,a)=>{for(var n=a>1?void 0:a?w(e,s):e,i=t.length-1,r;i>=0;i--)(r=t[i])&&(n=(a?r(e,s,n):r(n))||n);return a&&n&&g(e,s,n),n};let c=class extends m{constructor(e){super(e);o(this,"sceneData",null);h(this)}async initByMain(e,s){this.sceneData=u(await e.text())}getMainData(){return d(this.sceneData)}async rename(e){await super.rename(e),await this.root.assetFacade.persistAssetMain(this.id)}saveMainImmediately(){var s;const e=this.root.sceneStore;if(this.id===e.refId){if(e.destroyed){f(this.root.projectStore.id,this.serverId);return}const a=y(this.root,this.id);return this.sceneData=a,this.sceneData.scene&&(this.sceneData.scene.name=this.name),super.saveMainImmediately()}else if((s=this.sceneData)!=null&&s.scene&&this.sceneData.scene.name!==this.name)return this.sceneData.scene.name=this.name,super.saveMainImmediately()}async initByCreation(e,s,a){return this.sceneData=b(this._name)}onDoubleClick(){this.root.projectStore.switchScene({scene:this.id})}};c=C([D({type:"Scene",label:S("asset.scene.title"),defaultName:"Scene",extname:"scene",importMenuConfig:{type:v.Add},async bundle(t){return{content:new Blob([t.content],{type:"application/json"})}}})],c);export{c as SceneAsset};
@@ -1 +0,0 @@
1
- import{aM as s,b9 as _,d2 as le,av as f,bc as D,bb as g,d3 as G,d4 as ce,d5 as ue,d6 as de,d7 as fe,b5 as pe,d8 as Y,d9 as ve,da as z,db as he,dc as ye,bd as xe,b8 as Ee,dd as be,bh as me,aH as Ce}from"./index-c3dec278.js";var ge="DismissableLayer",I="dismissableLayer.update",Te="dismissableLayer.pointerDownOutside",Pe="dismissableLayer.focusOutside",V,X=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),q=s.forwardRef((e,n)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:u,...c}=e,d=s.useContext(X),[l,h]=s.useState(null),v=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=s.useState({}),x=_(n,p=>h(p)),E=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),C=E.indexOf(b),m=l?E.indexOf(l):-1,P=d.layersWithOutsidePointerEventsDisabled.size>0,T=m>=C,w=Oe(p=>{const A=p.target,$=[...d.branches].some(k=>k.contains(A));!T||$||(o==null||o(p),i==null||i(p),p.defaultPrevented||u==null||u())},v),O=De(p=>{const A=p.target;[...d.branches].some(k=>k.contains(A))||(a==null||a(p),i==null||i(p),p.defaultPrevented||u==null||u())},v);return le(p=>{m===d.layers.size-1&&(r==null||r(p),!p.defaultPrevented&&u&&(p.preventDefault(),u()))},v),s.useEffect(()=>{if(l)return t&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(V=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(l)),d.layers.add(l),U(),()=>{t&&d.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=V)}},[l,v,t,d]),s.useEffect(()=>()=>{l&&(d.layers.delete(l),d.layersWithOutsidePointerEventsDisabled.delete(l),U())},[l,d]),s.useEffect(()=>{const p=()=>y({});return document.addEventListener(I,p),()=>document.removeEventListener(I,p)},[]),f.jsx(D.div,{...c,ref:x,style:{pointerEvents:P?T?"auto":"none":void 0,...e.style},onFocusCapture:g(e.onFocusCapture,O.onFocusCapture),onBlurCapture:g(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:g(e.onPointerDownCapture,w.onPointerDownCapture)})});q.displayName=ge;var we="DismissableLayerBranch",Re=s.forwardRef((e,n)=>{const t=s.useContext(X),r=s.useRef(null),o=_(n,r);return s.useEffect(()=>{const a=r.current;if(a)return t.branches.add(a),()=>{t.branches.delete(a)}},[t.branches]),f.jsx(D.div,{...e,ref:o})});Re.displayName=we;function Oe(e,n=globalThis==null?void 0:globalThis.document){const t=G(e),r=s.useRef(!1),o=s.useRef(()=>{});return s.useEffect(()=>{const a=u=>{if(u.target&&!r.current){let c=function(){K(Te,t,d,{discrete:!0})};const d={originalEvent:u};u.pointerType==="touch"?(n.removeEventListener("click",o.current),o.current=c,n.addEventListener("click",o.current,{once:!0})):c()}else n.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{n.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),n.removeEventListener("pointerdown",a),n.removeEventListener("click",o.current)}},[n,t]),{onPointerDownCapture:()=>r.current=!0}}function De(e,n=globalThis==null?void 0:globalThis.document){const t=G(e),r=s.useRef(!1);return s.useEffect(()=>{const o=a=>{a.target&&!r.current&&K(Pe,t,{originalEvent:a},{discrete:!1})};return n.addEventListener("focusin",o),()=>n.removeEventListener("focusin",o)},[n,t]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function U(){const e=new CustomEvent(I);document.dispatchEvent(e)}function K(e,n,t,{discrete:r}){const o=t.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:t});n&&o.addEventListener(e,n,{once:!0}),r?ce(o,a):o.dispatchEvent(a)}var Le="Portal",Z=s.forwardRef((e,n)=>{var u;const{container:t,...r}=e,[o,a]=s.useState(!1);ue(()=>a(!0),[]);const i=t||o&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return i?de.createPortal(f.jsx(D.div,{...r,ref:n}),i):null});Z.displayName=Le;var Ae=s.forwardRef((e,n)=>{const{children:t,...r}=e,o=s.Children.toArray(t),a=o.find(_e);if(a){const i=a.props.children,u=o.map(c=>c===a?s.Children.count(i)>1?s.Children.only(null):s.isValidElement(i)?i.props.children:null:c);return f.jsx(M,{...r,ref:n,children:s.isValidElement(i)?s.cloneElement(i,void 0,u):null})}return f.jsx(M,{...r,ref:n,children:t})});Ae.displayName="Slot";var M=s.forwardRef((e,n)=>{const{children:t,...r}=e;if(s.isValidElement(t)){const o=Se(t);return s.cloneElement(t,{...je(r,t.props),ref:n?fe(n,o):o})}return s.Children.count(t)>1?s.Children.only(null):null});M.displayName="SlotClone";var J=({children:e})=>f.jsx(f.Fragment,{children:e});function _e(e){return s.isValidElement(e)&&e.type===J}function je(e,n){const t={...n};for(const r in n){const o=e[r],a=n[r];/^on[A-Z]/.test(r)?o&&a?t[r]=(...u)=>{a(...u),o(...u)}:o&&(t[r]=o):r==="style"?t[r]={...o,...a}:r==="className"&&(t[r]=[o,a].filter(Boolean).join(" "))}return{...e,...t}}function Se(e){var r,o;let n=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var Ne="VisuallyHidden",Q=s.forwardRef((e,n)=>f.jsx(D.span,{...e,ref:n,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Q.displayName=Ne;var ke=Q,[j,ot]=pe("Tooltip",[Y]),S=Y(),ee="TooltipProvider",Ie=700,H="tooltip.open",[Me,W]=j(ee),te=e=>{const{__scopeTooltip:n,delayDuration:t=Ie,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:a}=e,[i,u]=s.useState(!0),c=s.useRef(!1),d=s.useRef(0);return s.useEffect(()=>{const l=d.current;return()=>window.clearTimeout(l)},[]),f.jsx(Me,{scope:n,isOpenDelayed:i,delayDuration:t,onOpen:s.useCallback(()=>{window.clearTimeout(d.current),u(!1)},[]),onClose:s.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>u(!0),r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:s.useCallback(l=>{c.current=l},[]),disableHoverableContent:o,children:a})};te.displayName=ee;var N="Tooltip",[He,L]=j(N),ne=e=>{const{__scopeTooltip:n,children:t,open:r,defaultOpen:o=!1,onOpenChange:a,disableHoverableContent:i,delayDuration:u}=e,c=W(N,e.__scopeTooltip),d=S(n),[l,h]=s.useState(null),v=xe(),y=s.useRef(0),x=i??c.disableHoverableContent,E=u??c.delayDuration,b=s.useRef(!1),[C=!1,m]=Ee({prop:r,defaultProp:o,onChange:p=>{p?(c.onOpen(),document.dispatchEvent(new CustomEvent(H))):c.onClose(),a==null||a(p)}}),P=s.useMemo(()=>C?b.current?"delayed-open":"instant-open":"closed",[C]),T=s.useCallback(()=>{window.clearTimeout(y.current),b.current=!1,m(!0)},[m]),w=s.useCallback(()=>{window.clearTimeout(y.current),m(!1)},[m]),O=s.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{b.current=!0,m(!0)},E)},[E,m]);return s.useEffect(()=>()=>window.clearTimeout(y.current),[]),f.jsx(be,{...d,children:f.jsx(He,{scope:n,contentId:v,open:C,stateAttribute:P,trigger:l,onTriggerChange:h,onTriggerEnter:s.useCallback(()=>{c.isOpenDelayed?O():T()},[c.isOpenDelayed,O,T]),onTriggerLeave:s.useCallback(()=>{x?w():window.clearTimeout(y.current)},[w,x]),onOpen:T,onClose:w,disableHoverableContent:x,children:t})})};ne.displayName=N;var B="TooltipTrigger",re=s.forwardRef((e,n)=>{const{__scopeTooltip:t,...r}=e,o=L(B,t),a=W(B,t),i=S(t),u=s.useRef(null),c=_(n,u,o.onTriggerChange),d=s.useRef(!1),l=s.useRef(!1),h=s.useCallback(()=>d.current=!1,[]);return s.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),f.jsx(ve,{asChild:!0,...i,children:f.jsx(D.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:g(e.onPointerMove,v=>{v.pointerType!=="touch"&&!l.current&&!a.isPointerInTransitRef.current&&(o.onTriggerEnter(),l.current=!0)}),onPointerLeave:g(e.onPointerLeave,()=>{o.onTriggerLeave(),l.current=!1}),onPointerDown:g(e.onPointerDown,()=>{d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:g(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:g(e.onBlur,o.onClose),onClick:g(e.onClick,o.onClose)})})});re.displayName=B;var F="TooltipPortal",[Be,We]=j(F,{forceMount:void 0}),oe=e=>{const{__scopeTooltip:n,forceMount:t,children:r,container:o}=e,a=L(F,n);return f.jsx(Be,{scope:n,forceMount:t,children:f.jsx(z,{present:t||a.open,children:f.jsx(Z,{asChild:!0,container:o,children:r})})})};oe.displayName=F;var R="TooltipContent",se=s.forwardRef((e,n)=>{const t=We(R,e.__scopeTooltip),{forceMount:r=t.forceMount,side:o="top",...a}=e,i=L(R,e.__scopeTooltip);return f.jsx(z,{present:r||i.open,children:i.disableHoverableContent?f.jsx(ae,{side:o,...a,ref:n}):f.jsx(Fe,{side:o,...a,ref:n})})}),Fe=s.forwardRef((e,n)=>{const t=L(R,e.__scopeTooltip),r=W(R,e.__scopeTooltip),o=s.useRef(null),a=_(n,o),[i,u]=s.useState(null),{trigger:c,onClose:d}=t,l=o.current,{onPointerInTransitChange:h}=r,v=s.useCallback(()=>{u(null),h(!1)},[h]),y=s.useCallback((x,E)=>{const b=x.currentTarget,C={x:x.clientX,y:x.clientY},m=Ge(C,b.getBoundingClientRect()),P=Ye(C,m),T=ze(E.getBoundingClientRect()),w=qe([...P,...T]);u(w),h(!0)},[h]);return s.useEffect(()=>()=>v(),[v]),s.useEffect(()=>{if(c&&l){const x=b=>y(b,l),E=b=>y(b,c);return c.addEventListener("pointerleave",x),l.addEventListener("pointerleave",E),()=>{c.removeEventListener("pointerleave",x),l.removeEventListener("pointerleave",E)}}},[c,l,y,v]),s.useEffect(()=>{if(i){const x=E=>{const b=E.target,C={x:E.clientX,y:E.clientY},m=(c==null?void 0:c.contains(b))||(l==null?void 0:l.contains(b)),P=!Xe(C,i);m?v():P&&(v(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,l,i,d,v]),f.jsx(ae,{...e,ref:a})}),[$e,Ve]=j(N,{isInside:!1}),ae=s.forwardRef((e,n)=>{const{__scopeTooltip:t,children:r,"aria-label":o,onEscapeKeyDown:a,onPointerDownOutside:i,...u}=e,c=L(R,t),d=S(t),{onClose:l}=c;return s.useEffect(()=>(document.addEventListener(H,l),()=>document.removeEventListener(H,l)),[l]),s.useEffect(()=>{if(c.trigger){const h=v=>{const y=v.target;y!=null&&y.contains(c.trigger)&&l()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,l]),f.jsx(q,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:l,children:f.jsxs(he,{"data-state":c.stateAttribute,...d,...u,ref:n,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(J,{children:r}),f.jsx($e,{scope:t,isInside:!0,children:f.jsx(ke,{id:c.contentId,role:"tooltip",children:o||r})})]})})});se.displayName=R;var ie="TooltipArrow",Ue=s.forwardRef((e,n)=>{const{__scopeTooltip:t,...r}=e,o=S(t);return Ve(ie,t).isInside?null:f.jsx(ye,{...o,...r,ref:n})});Ue.displayName=ie;function Ge(e,n){const t=Math.abs(n.top-e.y),r=Math.abs(n.bottom-e.y),o=Math.abs(n.right-e.x),a=Math.abs(n.left-e.x);switch(Math.min(t,r,o,a)){case a:return"left";case o:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Ye(e,n,t=5){const r=[];switch(n){case"top":r.push({x:e.x-t,y:e.y+t},{x:e.x+t,y:e.y+t});break;case"bottom":r.push({x:e.x-t,y:e.y-t},{x:e.x+t,y:e.y-t});break;case"left":r.push({x:e.x+t,y:e.y-t},{x:e.x+t,y:e.y+t});break;case"right":r.push({x:e.x-t,y:e.y-t},{x:e.x-t,y:e.y+t});break}return r}function ze(e){const{top:n,right:t,bottom:r,left:o}=e;return[{x:o,y:n},{x:t,y:n},{x:t,y:r},{x:o,y:r}]}function Xe(e,n){const{x:t,y:r}=e;let o=!1;for(let a=0,i=n.length-1;a<n.length;i=a++){const u=n[a].x,c=n[a].y,d=n[i].x,l=n[i].y;c>r!=l>r&&t<(d-u)*(r-c)/(l-c)+u&&(o=!o)}return o}function qe(e){const n=e.slice();return n.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),Ke(n)}function Ke(e){if(e.length<=1)return e.slice();const n=[];for(let r=0;r<e.length;r++){const o=e[r];for(;n.length>=2;){const a=n[n.length-1],i=n[n.length-2];if((a.x-i.x)*(o.y-i.y)>=(a.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}n.pop();const t=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;t.length>=2;){const a=t[t.length-1],i=t[t.length-2];if((a.x-i.x)*(o.y-i.y)>=(a.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}return t.pop(),n.length===1&&t.length===1&&n[0].x===t[0].x&&n[0].y===t[0].y?n:n.concat(t)}var Ze=ne,Je=re,Qe=oe,et=se;const tt=me({"0%":{opacity:0,transform:"scale(0) translateY(-4px)"},"100%":{opacity:1,transform:"scale(1) translateY(0px)"}}),nt=Ce(et,{display:"flex",alignItems:"center",fontSize:"13px",padding:"$2 $3",backgroundColor:"$gray2",borderRadius:"$4",color:"$gray12",boxShadow:"inset 0 0 0 1px $colors$grayA4",transformOrigin:"var(--radix-tooltip-content-transform-origin)",animation:`${tt} 0.2s ease forwards`});function st(e){const{children:n,content:t,side:r="bottom",sideOffset:o=6,delayDuration:a=0,...i}=e;return f.jsx(te,{children:f.jsxs(Ze,{delayDuration:a,...i,children:[f.jsx(Je,{asChild:!0,children:n}),f.jsx(Qe,{children:f.jsx(nt,{sideOffset:o,side:r,children:t})})]})})}export{st as T};
@@ -1 +0,0 @@
1
- var E=Object.defineProperty;var O=(r,t,e)=>t in r?E(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var m=(r,t,e)=>(O(r,typeof t!="symbol"?t+"":t,e),e);import{aJ as v,aK as x,aM as _,av as y,c4 as V,aO as j,E as I,C as h,c5 as S,c6 as B,x as C,p as b,e as w,bM as R,c7 as T}from"./index-c3dec278.js";import{r as g}from"./index-cdbb2f4d.js";import{c as A}from"./Component-0f881fc1.js";import"./postmen-2853c0e6.js";import{c as F}from"./create-script-property-context-model-0fe0258f.js";import"./TextureAsset-a7ff39b1.js";import"./GlTFAsset-5970e707.js";import"./MaterialAsset-5353c4cb.js";import"./MeshAsset-c2bf60c5.js";import"./AnimatorControllerAsset-2716497a.js";import"./AnimationClipAsset-d7b37af0.js";import"./ShaderChunkAsset-e43dde8a.js";import"./AmbientLightAsset-be9e872c.js";import"./SpineSkeletonDataAsset-43b731f1.js";import"./FontAsset-d34b5378.js";import"./SceneAsset-08752701.js";import"./ShaderAsset-a9d667f5.js";import"./PrimitiveMesh-075dda8a.js";import"./XRReferenceImageAsset-96f516ba.js";import"./PrefabAsset-59743dbb.js";import"./PhysicsMaterialAsset-a2f73b5c.js";import"./RenderTargetAsset-b3cd1c49.js";import"./AudioAsset-c28f33ab.js";import"./index-da16047f.js";import"./MarkdownAsset-b2a3fad5.js";import{E as k}from"./ShaderUIScriptAsset-e1cd0b8b.js";import"./ktx2-encoder-db93524f.js";import"./TaskQueue-05c94a4d.js";import"./ktx-parse.modern-6c9f771f.js";import"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import"./Tooltip-b5be390f.js";import"./createReactComponent-58d9f0dd.js";import"./AssetViewer-3847c058.js";import"./glTFIO-45ff9a17.js";import"./MaterialInspector-8d466d59.js";import"./IconPointFilled-62d3c3b2.js";import"./shader-data-utils-f0e4f5a3.js";import"./index-05b76766.js";import"./MeshThumbnail-07ffa076.js";import"./bundlers-9b0d37fc.js";import"./module-ec094ef6.js";import"./module-ada3dced.js";import"./IconPlus-def01e2b.js";import"./FormItemArray-b8cda1d2.js";import"./Accordion-2cd014f1.js";import"./module-de7ee724.js";const $=["Input","Boolean","Switch","Toggle","Slider","Number","Vector2","Vector3","Vector4","Rect","Color","Select","AssetPicker","Textarea","SegmentControl"];function N(r){r=r.replace(/\/\/.*$/gm,"").replace(/,\s*}/gm,"}");const t=/@inspect\(['"](\w+)['"],?\s?(\{[\s\S]*?\})?\)\s*(?:public|private|static)?\s*(\w+)[:\s\w]+?\s*=\s*(?:['"]([^'"]*?)['"]|(-?[\w.]+));?/g,e=[];let p;for(;(p=t.exec(r))!==null;){let[,o,s,i,a,c]=p,l=a??c;if($.indexOf(o)===-1){console.warn(`Unsupported property type: ${o}`);continue}let n={property:i.toString(),label:i.toString(),type:o};if(s){s=s.trim().replace(/\s+/g," ").replace(/'/g,'"').replace(/(\w+):/g,'"$1":');try{n=JSON.parse(s),n.type=o,n.label=n.label||i,n.property=n.property||i}catch{console.warn(`Failed to parse property options: ${s}`)}}["Number","Slider"].includes(o)&&(l=parseFloat(l)),e.push({propertyType:o,propertyOptions:n,propertyName:i,propertyValue:l})}return e}async function P(r){const t=N(r.code),e={success:!1,model:{},config:[]};for(let p=0;p<t.length;p++){const o=t[p];e.model[o.propertyName]=o.propertyValue,e.config.push(o.propertyOptions)}return e.success=!0,e}function M(r){return r!=null&&r.$ref?{refId:r.$ref,...r.key?{key:r.key}:{}}:null}function J(r,t){if(!r)return;const e=t(r.refId);if(typeof e!="string"||e.length===0)throw new Error(`[SceneV2] Unable to serialize script asset ref "${r.refId}": missing virtualPath`);return{$ref:e,...r.key?{key:r.key}:{}}}var z=Object.defineProperty,D=Object.getOwnPropertyDescriptor,u=(r,t,e,p)=>{for(var o=p>1?void 0:p?D(t,e):t,s=r.length-1,i;s>=0;s--)(i=r[s])&&(o=(p?i(t,e,o):i(o))||o);return p&&o&&z(t,e,o),o};const q=new BroadcastChannel("Galacean_Editor_Channel"),L=v(function(t){const{model:e}=t,{t:p}=x(),o=F(e.properties,e.root),s=a=>{Object.keys(a.properties).forEach(c=>{R(a,c,{getActualEditorValue:()=>S(a.properties[c]),setActualEditorValue:(l,n,d)=>{l.properties[n]=d}})})};async function i(){e.parsed=!1;const a=e.root.assetStore.getAsset(e.script.refId),c=await T.assets.getAssetInfo(a.serverId),l=await fetch(c.data.url).then(d=>d.text());await g.assetFacade.applyRemoteCodeChange(a.id,l,c.data.url);const n=await P(a);n.success&&(e.parsed=!0,e.propertiesConfig=n.config,e.properties=n.model,s(e))}return _.useEffect(()=>{e!=null&&e.properties&&s(e)},[e.properties]),e.script?y.jsxs(y.Fragment,{children:[y.jsx(V,{label:" ",async:i,children:p("component.script.parse-properties")}),e.parsed&&e.properties&&y.jsx(j.List,{model:o,configs:e.propertiesConfig,onModelChange:(a,c)=>{q.postMessage({type:"script-inspector-value-change",payload:{instanceId:e.id,property:a,value:c}}),g.inspectorFacade.componentChange(e.id,a,c)}})]}):null});let f=class extends I{constructor(){super(...arguments);m(this,"parsed",!1);m(this,"propertiesConfig",[]);m(this,"isScript",!0);m(this,"script",null);m(this,"properties",{})}onInitComplete(){this._attachEditorScriptBridge()}async _attachEditorScriptBridge(){if(this.script)try{const t=await this.root.assetStore.getAssetByRef(this.script);if(!t)throw new Error(`Cannot find file ${JSON.stringify(this.script)}`);await this.applyBoundPathChange("_scriptRef",h.AssetPicker,this.script);const e=await P(t);this.propertiesConfig=e.config;for(const[p,o]of Object.entries(e.model))this.properties[p]=this.properties[p]??o;this.parsed=!0}catch(t){console.warn(t)}}rebindEngineObject(t){super.rebindEngineObject(t),this._attachEditorScriptBridge()}async applyBoundPathChange(t,e,p){if(t==="_scriptRef"){this.setBoundPathValue(t,h.Input,p);return}await super.applyBoundPathChange(t,e,p)}deserialize(t){if(super.deserialize(t),this.script=M(t.script),t.props)for(const[e,p]of Object.entries(t.props))e!=="enabled"&&(this.properties[e]=p)}toJSON(){const t=super.toJSON();if(delete t.props.script,this.properties){const p=S(this.properties);for(const[o,s]of Object.entries(p)){if(o==="root")continue;const i=B(s);i!==void 0&&(t.props[o]=i)}}const e=J(this.script,p=>{var o,s;return(s=(o=this.root.assetStore).getAssetVirtualPath)==null?void 0:s.call(o,p)});return e&&(t.script=e),t}};u([C],f.prototype,"parsed",2);u([C.ref],f.prototype,"propertiesConfig",2);u([b({label:w("component.script.script-label"),type:h.AssetPicker,assetType:"script",bindPath:"_scriptRef",customFilter:r=>r.subType===k.Default,onLocate:r=>{r.onDoubleClick()}})],f.prototype,"script",2);u([b({label:w("component.script.properties-label"),customComponent:L})],f.prototype,"properties",2);f=u([A({type:"Script",componentsMenu:{label:"component.script.title"}})],f);export{f as ScriptComponent};
@@ -1 +0,0 @@
1
- import{P as a}from"./PostProcessComponent-af270a77.js";import"./index-c3dec278.js";import"./index-cdbb2f4d.js";import"./Component-0f881fc1.js";import"./postmen-2853c0e6.js";import"./IconPlus-def01e2b.js";import"./createReactComponent-58d9f0dd.js";import"./Menu-c8e6194b.js";import"./Accordion-2cd014f1.js";export{a as PostProcessComponent};
@@ -1 +0,0 @@
1
- import{K as E,b as w,T as I,a as R}from"./TextureAsset-a7ff39b1.js";import{G as F,a as G}from"./GlTFAsset-5970e707.js";import{M as U,a as V}from"./MaterialAsset-5353c4cb.js";import{MeshAsset as X}from"./MeshAsset-c2bf60c5.js";import{AnimatorControllerAsset as D}from"./AnimatorControllerAsset-2716497a.js";import{A as j,a as q,b as z}from"./AnimationClipAsset-d7b37af0.js";import{L as H,c as J,b as N,S as Q,a as W}from"./ShaderChunkAsset-e43dde8a.js";import{AmbientLightAsset as Z}from"./AmbientLightAsset-be9e872c.js";import{S as $}from"./SpineSkeletonDataAsset-43b731f1.js";import{FontAsset as te}from"./FontAsset-d34b5378.js";import{SceneAsset as se}from"./SceneAsset-08752701.js";import{E as pe,c as ae,b as ie,a as me,S as Ae}from"./ShaderAsset-a9d667f5.js";import{E as fe,a as ne,S as xe,b as he,t as le}from"./ShaderUIScriptAsset-e1cd0b8b.js";import{PrimitiveMesh as ce}from"./PrimitiveMesh-075dda8a.js";import{XRReferenceImageAsset as ye}from"./XRReferenceImageAsset-96f516ba.js";import{PrefabAsset as Me}from"./PrefabAsset-59743dbb.js";import{PhysicsMaterialAsset as Ce}from"./PhysicsMaterialAsset-a2f73b5c.js";import{RenderTargetAsset as ge}from"./RenderTargetAsset-b3cd1c49.js";import{AudioAsset as we}from"./AudioAsset-c28f33ab.js";import{StateMachineScript as Re}from"./index-da16047f.js";import{MarkdownAsset as Fe}from"./MarkdownAsset-b2a3fad5.js";import"./index-c3dec278.js";import"./ktx2-encoder-db93524f.js";import"./TaskQueue-05c94a4d.js";import"./ktx-parse.modern-6c9f771f.js";import"./index-cdbb2f4d.js";import"./postmen-2853c0e6.js";import"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import"./Tooltip-b5be390f.js";import"./createReactComponent-58d9f0dd.js";import"./AssetViewer-3847c058.js";import"./glTFIO-45ff9a17.js";import"./MaterialInspector-8d466d59.js";import"./IconPointFilled-62d3c3b2.js";import"./shader-data-utils-f0e4f5a3.js";import"./index-05b76766.js";import"./MeshThumbnail-07ffa076.js";import"./bundlers-9b0d37fc.js";import"./module-ec094ef6.js";import"./module-ada3dced.js";import"./IconPlus-def01e2b.js";import"./FormItemArray-b8cda1d2.js";import"./Accordion-2cd014f1.js";import"./module-de7ee724.js";export{Z as AmbientLightAsset,j as AnimationClipAsset,q as AnimationClipInspector,z as AnimationClipViewer,D as AnimatorControllerAsset,we as AudioAsset,fe as EScriptSubType,pe as EShaderPropertyType,te as FontAsset,F as GlTFAsset,G as GlTFViewer,E as KTX2Options,H as LottieAsset,Fe as MarkdownAsset,U as MaterialAsset,V as MaterialViewer,X as MeshAsset,Ce as PhysicsMaterialAsset,Me as PrefabAsset,ce as PrimitiveMesh,ge as RenderTargetAsset,se as SceneAsset,ne as ScriptAsset,ae as ShaderAsset,J as ShaderChunkAsset,ie as ShaderPropertyEnumType,me as ShaderPropertyRangeType,Ae as ShaderTemplateConfigs,xe as ShaderUIScript,he as ShaderUIScriptAsset,N as SpineAtlasAsset,$ as SpineSkeletonDataAsset,Q as SpriteAsset,W as SpriteAtlasAsset,Re as StateMachineScript,w as TextureAsset,I as TextureShape,R as TextureUseType,ye as XRReferenceImageAsset,le as scriptTemplates};
@@ -1 +0,0 @@
1
- import{A as a,a as n}from"./AnimatorStore-883a28ad.js";import"./index-c3dec278.js";import"./index-cdbb2f4d.js";import"./Component-0f881fc1.js";import"./postmen-2853c0e6.js";export{a as AnimatorComponent,n as AnimatorStore};
@@ -1 +0,0 @@
1
- import{A,a as l,b as C}from"./AnimationClipAsset-d7b37af0.js";import"./index-c3dec278.js";import"./index-cdbb2f4d.js";import"./postmen-2853c0e6.js";import"./AssetViewer-3847c058.js";import"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import"./module-ec094ef6.js";import"./module-ada3dced.js";export{A as AnimationClipAsset,l as AnimationClipInspector,C as AnimationClipViewer};
@@ -1 +0,0 @@
1
- import{C as a,D as C,F as s,H as l,P as c,a as S,S as d}from"./PhysicsStore-818c2f61.js";import"./index-c3dec278.js";import"./index-cdbb2f4d.js";import"./Component-0f881fc1.js";import"./postmen-2853c0e6.js";import"./FormItemArray-b8cda1d2.js";import"./Accordion-2cd014f1.js";export{a as CharacterControllerComponent,C as DynamicColliderComponent,s as FixedJointComponent,l as HingeJointComponent,c as PhysicsStore,S as SpringJointComponent,d as StaticColliderComponent};
@@ -1 +0,0 @@
1
- import{E as d,c as h,b as y,a as T,S as f}from"./ShaderAsset-a9d667f5.js";import{S as E}from"./ShaderUIScriptAsset-e1cd0b8b.js";import"./index-c3dec278.js";import"./index-cdbb2f4d.js";import"./postmen-2853c0e6.js";import"./meshopt_simplifier.module-cd99529d.js";import"./shader-data-utils-f0e4f5a3.js";import"./IconPointFilled-62d3c3b2.js";import"./createReactComponent-58d9f0dd.js";import"./index-05b76766.js";export{d as EShaderPropertyType,h as ShaderAsset,y as ShaderPropertyEnumType,T as ShaderPropertyRangeType,f as ShaderTemplateConfigs,E as ShaderUIScript};