var l=Object.defineProperty;var p=(s,e,t)=>e in s?l(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var o=(s,e,t)=>(p(s,typeof e!="symbol"?e+"":e,t),t);import{j as m,u as h,b2 as d,n as u,e as y,o as f}from"./index-a76b28be.js";import"./index-4d966268.js";import"./postmen-a4b10828.js";const D={entities:[{id:"1000000",name:"Camera",isActive:!0,position:{x:0,y:0,z:10},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},children:[],isClone:!1,components:[{id:"1000100",class:"Camera",props:{isOrthographic:!1,nearClipPlane:.1,farClipPlane:100,viewport:{x:0,y:0,z:1,w:1}},methods:{}}]},{id:"1000001",name:"DirectLight",isActive:!0,position:{x:0,y:3,z:0},rotation:{x:-45,y:-45,z:0},scale:{x:1,y:1,z:1},children:[],isClone:!1,components:[{id:"1000101",class:"DirectLight",props:{enabled:!0,intensity:.6,color:{r:1,g:1,b:1,a:1}},methods:{}}]}],scene:{background:{mode:0,color:{r:.0157,g:.0157,b:.0157,a:1}},ambient:{},shadow:{},fog:{}}};var v=Object.defineProperty,b=Object.getOwnPropertyDescriptor,S=(s,e,t,n)=>{for(var a=n>1?void 0:n?b(e,t):e,i=s.length-1,r;i>=0;i--)(r=s[i])&&(a=(n?r(e,t,a):r(a))||a);return n&&a&&v(e,t,a),a};let c=class extends m{constructor(e){super(e);o(this,"sceneData",null);h(this)}async initByMain(e,t){this.sceneData=JSON.parse(await e.text())}getMainData(){return JSON.stringify(this.sceneData)}async rename(e){await super.rename(e),await this.root.assetFacade.persistAssetMain(this.id)}saveMainImmediately(){const e=this.root.sceneStore;if(this.id===e.refId){if(e.destroyed){d(this.root.projectStore.id,this.serverId);return}return this.sceneData=e.toJSON(),this.sceneData.name=this.name,super.saveMainImmediately()}else{const t=this.sceneData;if(t&&t.name!==this.name)return t.name=this.name,super.saveMainImmediately()}}async initByCreation(e,t,n){return this.sceneData={name:this._name,...D}}onDoubleClick(){this.root.projectStore.switchScene({scene:this.id})}};c=S([u({type:"Scene",label:y("asset.scene.title"),defaultName:"Scene",extname:"scene",importMenuConfig:{type:f.Add},async bundle(s){return{content:new Blob([s.content],{type:"application/json"})}}})],c);export{c as SceneAsset};
