@dcl-regenesislabs/web-editor 0.3.20-41119187044.commit-1080f6a → 0.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/editor.js +1 -1
- package/package.json +2 -3
package/editor.js
CHANGED
|
@@ -35866,4 +35866,4 @@ ${n}
|
|
|
35866
35866
|
${r}`));return"w"+Array.from(new Uint8Array(a).slice(0,16),s=>s.toString(16).padStart(2,"0")).join("")}function Hkr(t){return`${t.file===void 0?"":`${t.file}:${t.line??1}:${t.column??0}: `}${t.severity==="error"?"ERROR":"WARNING"}: ${t.message}`}function Jkr(t){return t.length<=3?t.join(", "):`${t.slice(0,3).join(", ")} and ${t.length-3} more`}function Qkr(t,n){const r=Ib(t.get("package.json"));for(const a of[r==null?void 0:r.devDependencies,r==null?void 0:r.dependencies]){const s=typeof a=="object"&&a!==null?a["@dcl/sdk"]:void 0;if(typeof s=="string"&&s!==n)return`⚠ This project asks for @dcl/sdk ${s}; the editor builds it with ${n}.`}return null}function Ykr(t){const{emit:n,log:r}=t;let a=null,s=!1,l=null,f=Promise.resolve();const m=C=>{const N=f.then(C,C);return f=N.catch(()=>{}),N};async function _(){if(s)throw new Error("The editor was closed");a===null&&(l=null);const C=a??vwr(t.urls);a=C;try{const N=await C.ready;return{builder:C,sdkVersion:N.sdkVersion,info:N}}catch(N){throw C.dispose(),a===C&&(a=null),N}}async function x(C,N,F){const{builder:B,info:H}=await _();let X=!1;const K=await Wkr(N,t.packages,H.snapshot,pe=>{t.onPackages(C,pe),F&&!X&&r("Downloading packages from npm…"),X=!0});K.lockFile!==void 0&&(N.set(F3,K.lockFile),await t.saveLock(C,K.lockFile));const te=K.lock===null?"":RWt(K.lock);if(te!==l)try{await B.setPackages(K.lock,t.packages),l=te}catch(pe){F&&r(`⚠ ${oPt(pe)}`),await B.setPackages(null),l=""}if(t.onPackages(C,K.status),!(!F||K.status===null)){if(K.status.state==="error")r(`✖ ${K.status.message??"The packages could not be installed"}`);else if(K.downloaded>0){const pe=Object.entries(K.status.installed).map(([fe,Y])=>`${fe} ${Y}`);r(`✔ Packages frozen into the scene: ${pe.join(", ")} (${K.status.total} in all)`)}for(const pe of K.status.warnings)r(`⚠ ${pe}`)}}function T(C,N,F=C){const B=GWe(t.pageDir,F),H=new Set;let X=null,K=null,te=!0,pe=!1,fe=!1,Y=null;const he=xt=>(n({type:"failed",message:xt}),r(`✖ Build failed: ${xt.split(`
|
|
35867
35867
|
`)[0]}`),!1);async function Ee(xt){const lt=performance.now();n({type:"buildStarted",changed:xt}),r(xt.length===0?"Building the scene…":`Rebuilding: ${Jkr(xt)}`);try{const{builder:St,sdkVersion:ht}=await _(),$e=xt.length===0?Qkr(N,ht):null;$e!==null&&r($e);const Wt=xt.length===0||xt.includes("package.json")||xt.includes(F3),{snapshot:Ue,result:Me}=await m(async()=>{(Wt||l!==Y)&&(await x(C,N,!0),Y=l);const wt=new Map(N);return{snapshot:wt,result:await St.build(wt)}});if(fe)return!1;const Ut=Me.diagnostics.filter(wt=>wt.severity==="error"||wt.file===void 0||Ue.has(wt.file));n({type:"diagnostics",diagnostics:Ut.map(({severity:wt,message:dt,file:Nt,line:$t,column:qt})=>({severity:wt,message:dt,file:Nt,line:$t,column:qt}))});for(const wt of Ut)r(Hkr(wt));if(!Me.ok){const wt=Me.events.find(dt=>dt.type==="failed");return he((wt==null?void 0:wt.type)==="failed"?wt.message:"The build produced no bundle")}const vt=Ib(Ue.get("scene.json"));return vt===null?he("scene.json is missing or is not valid JSON"):(await OSr({realmUrl:B,projectId:F,files:Ue,buildOutputs:Me.outputs,sceneJson:vt,sdkVersion:ht,machineId:await t.machineId(F)}),fe?!1:(n({type:"bundleSaved"}),r(`✔ Built in ${Math.round(performance.now()-lt)} ms`),!0))}catch(St){return fe?!1:he(oPt(St))}}function qe(){return fe?Promise.resolve(!1):(K!==null||(K=(async()=>{for(;(te||H.size>0)&&!fe;){const xt=te?[]:[...H];te=!1,H.clear(),pe=await Ee(xt)}return pe&&!fe})().finally(()=>{K=null})),K)}return{id:C,files:N,start:qe,flush(){return X!==null&&clearTimeout(X),X=null,qe()},async published(){const xt=await(await caches.open(Uxe)).match(HWe(B)),lt=await(xt==null?void 0:xt.json().catch(()=>{})),St=lt==null?void 0:lt.entity;return(St==null?void 0:St.id)===sZe(F,await t.machineId(F))},changed(xt){fe||(H.add(xt),X!==null&&clearTimeout(X),X=setTimeout(()=>{X=null,qe()},qkr))},stop(){fe=!0,X!==null&&clearTimeout(X)}}}return{realmUrl:C=>GWe(t.pageDir,C),open:T,async build(C,N,F){const{builder:B,sdkVersion:H}=await _();return m(async()=>(await x(C,N,!1),{...await B.build(N,F),sdkVersion:H}))},install:(C,N)=>m(()=>x(C,N,!1)),dispose(){s=!0,a==null||a.dispose(),a=null}}}const lPt=64*1024*1024,Xkr=4*1024*1024;function Zkr(t,n){return t.length>8192?!1:n==="POST"?t==="/content/entities/active":n!=="GET"&&n!=="HEAD"?!1:t==="/about"||t==="/scene.json"||/^\/content\/contents\/(?:b64-[A-Za-z0-9+/=]+|[A-Za-z0-9]+)$/.test(decodeURIComponent(t))}function Kkr(t,n,r){const a=t===null?null:new URL(t).origin;let s="",l=null,f="",m="",_=new AbortController,x=0,T=0;const C=(B,H=[])=>{l!==null&&a!==null&&l.postMessage({...B,session:n,instance:s},a,H)},N=async B=>{var he;if(typeof B.requestId!="string"||B.requestId.length>128||typeof B.path!="string")return;const H=B.requestId;if(x>=64){C({type:"realm-response",requestId:H,error:"Too many preview resource requests"});return}const X=_,K=l,te=new AbortController,pe=setTimeout(()=>te.abort(new Error("Preview resource timed out")),3e4);let fe=0,Y;x++;try{const Ee=new URL(f+B.path);if(!Ee.href.startsWith(f+"/")||!Zkr(B.path,B.method))throw new Error("Invalid preview resource");if(B.body!==void 0&&(!(B.body instanceof ArrayBuffer)||B.body.byteLength>1024*1024))throw new Error("Invalid preview request body");const qe=await fetch(Ee,{method:String(B.method),credentials:"omit",redirect:"error",signal:AbortSignal.any([X.signal,te.signal]),headers:{"Content-Type":"application/json"},body:B.method==="POST"?B.body:void 0}),xt=qe.headers.get("Content-Type")??"application/octet-stream",lt=xt.includes("application/json")?Xkr:lPt;if(Y=(he=qe.body)==null?void 0:he.getReader(),Number(qe.headers.get("Content-Length"))>lt)throw new Error("Preview resource exceeds the memory limit");const St=[];if(Y!==void 0)for(;;){const{done:Ue,value:Me}=await Y.read();if(Ue)break;if(fe+=Me.byteLength,T+=Me.byteLength,fe>lt||T>lPt)throw new Error("Preview resource exceeds the memory limit");St.push(Me)}const ht=new Uint8Array(fe);let $e=0;for(const Ue of St)ht.set(Ue,$e),$e+=Ue.byteLength;St.length=0;let Wt=ht.buffer;if(B.method!=="HEAD"&&Wt.byteLength>0&&xt.includes("application/json")){const Ue=JSON.parse(new TextDecoder().decode(Wt)),Me=Ut=>typeof Ut=="string"?Ut.startsWith(f+"/")||Ut===f?m+Ut.slice(f.length):Ut:Array.isArray(Ut)?Ut.map(Me):Zc(Ut)?Object.fromEntries(Object.entries(Ut).map(([vt,wt])=>[vt,Me(wt)])):Ut;Wt=new TextEncoder().encode(JSON.stringify(Me(Ue))).buffer}!X.signal.aborted&&K===l&&C({type:"realm-response",requestId:H,status:qe.status,headers:{"Content-Type":xt},body:Wt},[Wt])}catch(Ee){!X.signal.aborted&&K===l&&C({type:"realm-response",requestId:H,error:Ee instanceof Error?Ee.message:String(Ee)})}finally{clearTimeout(pe),te.abort(),Y!==void 0&&Y.cancel().catch(Ee=>{Ee instanceof Error&&Ee.name==="AbortError"||console.warn("Preview stream cleanup:",Ee)}),T-=fe,x--}},F=B=>{const H=B.data;B.origin!==a||!Zc(H)||H.session!==n||H.instance!==s||s===""||(H.type==="connect"&&l===null&&B.source!==null&&"postMessage"in B.source&&(l=B.source),!(B.source!==l||l===null)&&(H.type==="realm-request"?N(H):r(H)))};return window.addEventListener("message",F),{send:C,reset:(B="",H="",X="")=>{_.abort(),_=new AbortController,l=null,s=B,f=H,m=X},dispose:()=>{_.abort(),window.removeEventListener("message",F)}}}const uPt=["localhost","127.0.0.1","[::1]"];function e2r(t,n,r=""){if(uPt.includes(new URL(t).hostname)){const a=new URLSearchParams(r).get("editor-mobile");return`${a!==null&&URL.canParse(a)&&uPt.includes(new URL(a).hostname)?new URL(a).origin:"http://127.0.0.1:8788"}/mobile-preview/index.html`}return n===null?null:new URL("mobile-preview/index.html",n.replace(/\/$/,"")+"/").href}function t2r(t){if(t===null)return null;const n=new URL(t).hostname;return n==="decentraland.zone"||n.endsWith(".decentraland.zone")?"zone":null}function n2r(t,n,r,a=null){const s=crypto.randomUUID(),l=Kkr(t,s,fe=>pe(fe)),f=new Set,m=new Map;let _={mode:"closed",url:null,ready:!1},x=null,T="",C="",N=0,F=null,B=!1,H=null;const X=fe=>{_=fe;for(const Y of f)Y()},K=()=>{C!==""&&l.send({type:"stop",session:s,instance:C}),l.reset(),H==null||H.close(),H=null,C="";for(const fe of m.values())fe.reject(new Error("The mobile preview was closed."));m.clear(),X({mode:"closed",url:null,ready:!1})},te=()=>{N++,x=null,K()};window.addEventListener("pagehide",te);const pe=fe=>{if(!Zc(fe)||fe.session!==s||fe.instance!==C||(fe.type==="ready"&&(X({..._,ready:!0}),l.send({type:"visibility",session:s,instance:C,visible:_.mode!=="minimized"})),fe.type==="closed"&&te(),fe.type!=="capture"||typeof fe.requestId!="string"))return;const Y=m.get(fe.requestId);Y!==void 0&&(typeof fe.error=="string"?Y.reject(new Error(fe.error)):typeof fe.image=="string"&&fe.image.length<=4e6&&typeof fe.width=="number"&&fe.width>0&&fe.width<=1024&&typeof fe.height=="number"&&fe.height>0&&fe.height<=1024?Y.resolve({mimeType:"image/jpeg",image:fe.image,width:fe.width,height:fe.height}):Y.reject(new Error("The mobile preview sent an invalid picture.")))};return{state:()=>_,status:()=>({mode:_.mode,ready:_.ready}),subscribe:fe=>(f.add(fe),()=>f.delete(fe)),open:async(fe,Y,he="embedded")=>{if(B||t===null)return{ok:!1,reason:"unavailable"};const Ee=fe.replace(/\/$/,"");if(_.mode===he&&x===Ee)return N++,{ok:!0};if((he==="embedded"||he==="minimized")&&(_.mode==="embedded"||_.mode==="minimized")&&x===Ee){if(N++,X({..._,mode:he}),l.send({type:"visibility",session:s,instance:C,visible:he!=="minimized"}),he==="minimized")for(const Wt of m.values())Wt.reject(new Error("Restore the mobile preview before taking a picture."));return{ok:!0}}if(he==="minimized")return{ok:!1,reason:"unavailable"};const qe=he==="tab"?window.open("about:blank",`dcl-phone-preview-${crypto.randomUUID()}`):null;if(he==="tab"&&qe===null)return{ok:!1,reason:"unavailable"};const xt=++N;if(!await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(5e3)}).then(Wt=>Wt.ok,()=>!1)||xt!==N||B||qe!=null&&qe.closed)return qe==null||qe.close(),{ok:!1,reason:"unavailable"};if(K(),await new Promise(Wt=>setTimeout(Wt,100)),xt!==N||B||qe!=null&&qe.closed)return qe==null||qe.close(),{ok:!1,reason:"unavailable"};C=crypto.randomUUID();const St=new URL(t);St.searchParams.set("previewSession",s),St.searchParams.set("previewInstance",C),St.searchParams.set("editorOrigin",window.location.origin),he==="tab"&&St.searchParams.set("previewDetached","1"),St.searchParams.set("maxpixels",String(1600*720)),T=new URL(`realm/${s}/${C}`,t).href,l.reset(C,Ee,T);const ht=new URL("decentraland://open");ht.searchParams.set("preview",T),ht.searchParams.set("position",Y);const $e=["--local-editor-preview","--skip-lobby","--guest-profile","--fake-deeplink",ht.href];return a!==null&&$e.push("--dclenv",a),St.searchParams.set("args",$e.join(" ")),x=Ee,X({mode:he,url:St.href,ready:!1}),H=qe,qe!==null&&r2r(qe,St.href),{ok:!0}},close:te,capture:async fe=>{if(fe.throwIfAborted(),_.mode==="closed"||!_.ready)throw new Error("Open the mobile preview and wait for it to load before taking a picture.");_.mode==="minimized"&&(F=N,X({..._,mode:"embedded"}),l.send({type:"visibility",session:s,instance:C,visible:!0}));const Y=crypto.randomUUID();try{return await new Promise((he,Ee)=>{const qe=()=>{clearTimeout(lt),fe.removeEventListener("abort",xt),m.delete(Y)},xt=()=>{qe(),Ee(fe.reason)},lt=setTimeout(()=>{qe(),Ee(new Error("The mobile preview did not answer. Bring its tab to the foreground and retry."))},1e4);m.set(Y,{resolve:St=>{qe(),he(St)},reject:St=>{qe(),Ee(St)}}),fe.addEventListener("abort",xt,{once:!0}),l.send({type:"capture",session:s,instance:C,requestId:Y})})}finally{m.size===0&&(F===N&&_.mode==="embedded"&&(X({..._,mode:"minimized"}),l.send({type:"visibility",session:s,instance:C,visible:!1})),F=null)}},built:async fe=>{if(x===null)return;const Y=x,he=await n(fe),Ee=sZe(he,await r(he));!B&&Y===x&&l.send({type:"scene-updated",session:s,instance:C,realm:T,entityId:Ee})},dispose:()=>{te(),B=!0,window.removeEventListener("pagehide",te),l.dispose(),f.clear()}}}function r2r(t,n){const r=t.document;r.title="Mobile scene preview",r.body.style.cssText="margin:0;background:#19191c;overflow:hidden";const a=r.createElement("iframe");a.title="Mobile scene preview",a.allow="autoplay; fullscreen; gamepad; cross-origin-isolated",a.style.cssText="width:100vw;height:100vh;border:0;display:block",a.src=n,r.body.replaceChildren(a)}const i2r=200,a2r=2e3,s2r=/^\((?:no logs|\+\d+ older entries not retained)\)$/;function o2r(t,n){for(let r=Math.min(t.length,n.length);r>0;r--){const a=t.length-r;if(n.slice(0,r).every((s,l)=>s===t[a+l]))return n.slice(r)}return[...n]}function c2r(t,n){let r=[],a=!1,s;const l=async()=>{try{const f=await t(`scene_logs ${i2r} --server`);if(a)return;const m=f.split(`
|
|
35868
35868
|
`).filter(_=>_.trim()!==""&&!s2r.test(_.trim()));for(const _ of o2r(r,m))n(_);r=m}catch{}a||(s=setTimeout(()=>void l(),a2r))};return l(),()=>{a=!0,clearTimeout(s)}}function l2r(t,n,r){r.throwIfAborted();const a=nt.scene,s=[...t].sort().join(";");return new Promise((l,f)=>{const m=()=>{clearTimeout(N),T(),r.removeEventListener("abort",C)},_=F=>{m(),f(F)},x=()=>{var B;nt.scene===a||nt.status!=="ready"||!nt.frozen||((B=nt.scene)==null?void 0:B.parcels.map(H=>`${H.x},${H.y}`).sort().join(";"))!==s||(m(),l())},T=lqe(x),C=()=>_(r.reason),N=setTimeout(()=>_(new Error("The preview has not loaded the new parcels. Retry sceneSettings before building outside the current layout.")),9e4);r.addEventListener("abort",C,{once:!0});try{n(),x()}catch(F){_(F)}})}const u2r=new Set(["node_modules",".git","bin","dist"]),d2r=300*1024,f2r=56,p2r=5;function m2r(t){const n=t.origin,r=typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null;return r!==null&&(r.source==="import"||r.source==="github")?r:{...r??{},source:"user"}}function h2r(t,n){const r=new Map;let a=new Map;function s(m,_){if(_.size>d2r)return t.blob(m,_.hash);let x=r.get(_.hash);return x===void 0&&(x=t.blob(m,_.hash),r.set(_.hash,x),x.catch(()=>r.delete(_.hash))),x}const l={async folders(){const m=await t.list();return a=new Map(m.map(x=>[x.name,x])),(await Promise.all(m.map(async x=>{const T=x.files["data.json"];if(T===void 0)return null;const C=await s(x.name,T).then(F=>new TextDecoder().decode(F),()=>null);if(C===null)return null;const N=Object.fromEntries(Object.entries(x.files).map(([F,B])=>[F,B.size]));return{name:x.name,data:C,files:N}}))).filter(x=>x!==null)},async read(m,_){var T;const x=(T=a.get(m.name))==null?void 0:T.files[_];if(x===void 0)throw new Error(`${m.name}/${_} is not in your library`);return s(m.name,x)}};async function f(m,_){const x={},T=new Map;for(const[N,F]of _){const B=await n(F);x[N]={hash:B,size:F.length},T.set(B,F)}const C=[...T].map(([N,F])=>({hash:N,size:F.length}));for(const N of await t.uploads(m,C)){const F=T.get(N.hash);F!==void 0&&await t.putBlob(N,F)}await t.put(m,x)}return{tree:l,async copyOut(m,_){const[x,T,C]=_.split("/");if(x!=="custom"||T===void 0||C!==void 0||!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(T))throw new Error(`not a prefab folder: ${_}`);const N=`${_}/`,F=new Map;for(const[Y,he]of m.files()){const Ee=Y.slice(N.length);Y.startsWith(N)&&!Ee.split("/").some(qe=>u2r.has(qe))&&F.set(Ee,he)}const B=F.get("data.json"),H=B===void 0?null:Uq(new TextDecoder().decode(B));if(H===null)throw new Error(`${_} has no readable data.json`);const X={...H,id:typeof H.id=="string"?H.id:crypto.randomUUID(),origin:m2r(H)},K=`${JSON.stringify(X,null,2)}
|
|
35869
|
-
`;F.set("data.json",new TextEncoder().encode(K));const te=iqe(cqt(H,T)).slice(0,f2r).replace(/_+$/,"")||"prefab",pe=new Set((await t.list()).map(Y=>Y.name));let fe=1;for(let Y=0;Y<p2r;Y++){let he=te;for(;pe.has(he);)he=`${te}_${++fe}`;try{return await f(he,F),{ref:`user:${he}`,scope:"user",data:K}}catch(Ee){if(!(Ee instanceof YWt))throw Ee;pe.add(he)}}throw new Error("could not find a free name in your library — try again")},remove:m=>t.remove(m)}}const dPt=new WeakMap;function _2r(t){let n=dPt.get(t);return n===void 0&&(n=crypto.subtle.digest("SHA-256",new Uint8Array(t)).then(r=>[...new Uint8Array(r)].map(a=>a.toString(16).padStart(2,"0")).join("")),dPt.set(t,n)),n}async function g2r(t){const n=t.get(".dclignore"),r=cZe(t.keys(),n===void 0?void 0:new TextDecoder().decode(n)).filter(l=>l!==F3),a=new Map;let s=0;for(const l of r){const f=t.get(l);f!==void 0&&(a.set(await _2r(f),f.byteLength),s++)}return{bytes:[...a.values()].reduce((l,f)=>l+f,0),files:s}}const fPt=4e3,y2r=4e6,v2r=APt*24*60*60*1e3,b2r="assets/images",x2r=3e3,w2r=100,S2r="Sign in to keep prefabs in your own library. The built-in prefabs work without it.",T2r=t=>t instanceof Error?t.message:String(t);function x9e(t,n){var r,a,s;return{realm:n.replace(/\/$/,""),systemScene:"",position:((r=t.scene)==null?void 0:r.base)??((s=(a=t.scene)==null?void 0:a.parcels)==null?void 0:s[0])??"0,0",spawn:WSr(t),spawnPoints:JSON.stringify(Array.isArray(t.spawnPoints)?t.spawnPoints:[])}}const k2r=({host:t,sceneCompiler:n})=>{const r=new PTr(TTr()),a=Ck(t),s=a===null||a.services.projects===null?null:QWt(a.services.projects,(Xn,Lr)=>a.signedFetch(Xn,Lr)),l=()=>{const{address:Xn,isGuest:Lr}=t.identity();return Lr||Xn===null?null:Xn.toLowerCase()},f=[],m=[],_=[],x=[],T=[],C=Xn=>{f.push(Xn),f.length>fPt&&f.splice(0,f.length-fPt);for(const Lr of m)Lr(Xn)},N=n2r(e2r(t.pageDir,(a==null?void 0:a.services.projects)??null,location.search),he,async Xn=>cPt(await X,l()??"guest",Xn),t2r((a==null?void 0:a.services.worldsContent)??null)),F=Xn=>{for(const Lr of _)Lr(Xn);Xn.type==="bundleSaved"&&pe!==null&&N.built(pe.id).catch(Lr=>console.error("[editor] mobile preview reload failed",Lr))},B=new Map,H=new Set,X=gRt.then(Gkr),K=Ykr({pageDir:t.pageDir,urls:n,machineId:async Xn=>cPt(await X,l()??"guest",Xn),emit:F,log:C,packages:r.packages,saveLock:async(Xn,Lr)=>{await r.write(Xn,F3,Lr),wt.touched(Xn,F3),(pe==null?void 0:pe.id)===Xn&&pe.files.set(F3,Lr)},onPackages:(Xn,Lr)=>{if(Lr===null){B.delete(Xn);return}B.set(Xn,Lr);for(const ti of H)ti(Xn,Lr)}});let te=null,pe=null,fe=null,Y=null;async function he(Xn){var Ga;const Lr=(Ga=(await r.list()).find(Za=>Za.id===Xn))==null?void 0:Ga.previewId;if(Lr!==void 0)return Lr;const ti="p"+Array.from(crypto.getRandomValues(new Uint8Array(16)),Za=>Za.toString(16).padStart(2,"0")).join("");return await r.patch(Xn,{previewId:ti}),ti}async function Ee(Xn){const Lr=new URL("preview/",t.pageDir).href,ti=await caches.open(Uxe);for(const Ga of await ti.keys())Ga.url.startsWith(Lr)&&(Xn===null||!Ga.url.startsWith(Xn))&&await ti.delete(Ga)}let qe=0,xt=Promise.resolve(),lt=Promise.resolve();const St=DSr({service:(a==null?void 0:a.services.projects)??null,fetch:(Xn,Lr)=>a===null?Promise.reject(new Error("The assistant service is not configured.")):a.signedFetch(Xn,Lr),wallet:l,mobilePreview:N.status,memory:{read:async(Xn,Lr)=>{const ti=await r.assistantMemory(Xn,Lr);return Zc(ti)&&typeof ti.id=="string"&&typeof ti.key=="string"?{id:ti.id,key:ti.key}:null},write:(Xn,Lr,ti)=>r.setAssistantMemory(Xn,Lr,ti)},project:()=>{const Xn=Tt();return{id:Xn.id,tools:{files:()=>Xn.files,write:(Lr,ti,Ga,Za)=>Wt(Xn.id,Lr,ti,{expected:Ga,signal:Za}),assets:GUt({files:()=>Xn.files}),scene:(Lr,ti)=>vTe(Lr,ti,async Ga=>{var ii,yl,ja;const Za=ss=>{var Ts,Zs;return JSON.stringify([(Ts=ss==null?void 0:ss.scene)==null?void 0:Ts.parcels,(Zs=ss==null?void 0:ss.scene)==null?void 0:Zs.base])};await VE();const el=Za(Ib(await $e(Xn.id,"scene.json")));await tn(Xn.id,ss=>JSr(ss,Ga));const uu=Ib(await $e(Xn.id,"scene.json")),lr=Za(uu)!==el,Pl=((ii=uu==null?void 0:uu.scene)==null?void 0:ii.parcels)??[],fm=(yl=nt.scene)==null?void 0:yl.parcels.map(ss=>`${ss.x},${ss.y}`).sort().join(";");if(lr||fm!==[...Pl].sort().join(";")){if(!await Xn.flush())throw new Error("The scene did not build. Fix the code and retry sceneSettings to load the new parcels.");ti.throwIfAborted();const ss=await he(Xn.id);te=x9e(uu??{},K.realmUrl(ss)),await l2r(Pl,()=>{for(const Ts of x)Ts(te)},ti)}else if(te!==null){const ss=x9e(uu??{},te.realm);(ss.spawn!==te.spawn||ss.spawnPoints!==te.spawnPoints)&&(te={...te,spawn:ss.spawn,spawnPoints:ss.spawnPoints},fdr(ss.spawn,ss.spawnPoints))}return{requiredPermissions:(uu==null?void 0:uu.requiredPermissions)??[],spawnPoints:(uu==null?void 0:uu.spawnPoints)??[],parcels:Pl,base:((ja=uu==null?void 0:uu.scene)==null?void 0:ja.base)??null,previewReady:!0}}),written:QUt,view:(Lr,ti)=>bTe(Lr,ti),playtest:$Xe,uiLayout:xWe,turnEnded:Wzt,build:async Lr=>{Lr.throwIfAborted(),await lt;const ti=await K.build(Xn.id,new Map(Xn.files));if(Lr.throwIfAborted(),!ti.ok)return{ok:!1,diagnostics:ti.diagnostics,mobilePreview:N.status()};const Ga=await qUt();return Lr.throwIfAborted(),{ok:!0,diagnostics:ti.diagnostics,run:Ga,mobilePreview:N.status()}}}}}});function ht(){St.reset(),Y==null||Y(),Y=null,pe!==null&&(pe.stop(),r.close(pe.id),wt.flush(pe.id),pe=null,fe=null)}async function $e(Xn,Lr){return(pe==null?void 0:pe.id)===Xn?pe.files.get(Lr):r.read(Xn,Lr).catch(ti=>{if(!yI(ti))throw ti})}function Wt(Xn,Lr,ti,Ga){const Za=lt.then(async()=>{if(Ga==null||Ga.signal.throwIfAborted(),Ga!==void 0&&((pe==null?void 0:pe.id)!==Xn||!XUt(pe.files.get(Lr),Ga.expected)))throw new Error("This file changed. Read it again before writing.");await r.write(Xn,Lr,ti),wt.touched(Xn,Lr),(pe==null?void 0:pe.id)===Xn&&(pe.files.set(Lr,ti),pe.changed(Lr))});return lt=Za.catch(el=>console.error("[editor] file write failed",el)),Za}function Ue(Xn,Lr){const ti=lt.then(async()=>{const Ga=await r.remove(Xn,Lr);return Ga&&wt.touched(Xn,Lr),Ga&&(pe==null?void 0:pe.id)===Xn&&pe.files.delete(Lr)&&pe.changed(Lr),Ga});return lt=ti.catch(Ga=>console.error("[editor] file removal failed",Ga)),ti}function Me(Xn){const Lr=Tt();if(Lr.id!==Xn)throw new Error("that scene is not the one open");return{files:()=>Lr.files,write:(ti,Ga)=>Wt(Xn,ti,Ga),remove:async ti=>{await Ue(Xn,ti)}}}async function Ut(Xn){var Ga;const Lr=Ib(await $e(Xn,"scene.json").catch(()=>{})),ti=(((Ga=Lr==null?void 0:Lr.display)==null?void 0:Ga.title)??"").replace(/[\x00-\x1f\x7f]/g,"").replace(new RegExp(JWt.source,"g"),"").trim().slice(0,w2r);return ti===""?Xn:ti}async function vt(Xn,Lr){const ti=(await r.list()).find(Za=>Za.id===Xn);if(ti===void 0)return null;const Ga=await r.duplicate(Xn,`${ti.name} ${Lr}`,wt.remoteIds());return await tn(Ga.id,Za=>{var el;return{...Za,display:{...Za.display??{},title:`${((el=Za.display)==null?void 0:el.title)||ti.name} ${Lr}`}}}),Ga.id}const wt=FTr({store:r,session:()=>{const Xn=l();return s===null||Xn===null?null:{api:s,wallet:Xn}},account:()=>s===null?"unavailable":l()===null?"guest":"on",hash:jxe,title:Ut,duplicate:async Xn=>{const Lr=await vt(Xn,CPt(new Date));if(Lr===null)throw new Error("The scene is no longer on this device");return Lr}});let dt=!1,Nt=0;async function $t(){const Xn=++Nt,Lr=l()!==null&&(await St.shell.aiProviders()).some(ti=>ti.available);Xn!==Nt||Lr===dt||(dt=Lr,J0())}$t();let qt=l();const Re=setInterval(()=>{const Xn=l();Xn!==qt&&(qt=Xn,St.reset(),J0(),$t(),wt.refresh(!0),Ee(fe).catch(Lr=>console.warn("[editor] could not clear the previews",Lr)))},x2r),Ke=()=>{document.visibilityState==="hidden"&&wt.flush()};document.addEventListener("visibilitychange",Ke);const st=new Set;async function tn(Xn,Lr){const ti=Ib(await $e(Xn,"scene.json"));if(ti===null)throw new Error("scene.json is missing or is not valid JSON");await Wt(Xn,"scene.json",IOt(Lr(ti)))}async function An(Xn,Lr){if(Lr==null||Lr==="")return null;const ti=await $e(Xn,Lr).catch(()=>{});return ti===void 0||ti.length>y2r?null:NOt(Lr,ti)}async function un(Xn,Lr=wt.status().projects){var Ga,Za,el,uu;const ti=Ib(await $e(Xn.id,"scene.json").catch(()=>{}));return{sync:Lr[Xn.id],path:Xn.id,name:Xn.name,title:((Ga=ti==null?void 0:ti.display)==null?void 0:Ga.title)||Xn.name,world:((Za=ti==null?void 0:ti.worldConfiguration)==null?void 0:Za.name)||null,parcels:Array.isArray((el=ti==null?void 0:ti.scene)==null?void 0:el.parcels)?ti.scene.parcels.length:0,thumbnail:await An(Xn.id,(uu=ti==null?void 0:ti.display)==null?void 0:uu.navmapThumbnail),favourite:Xn.favourite,lastOpened:Xn.lastOpened,published:Xn.published,deletedAt:Xn.deletedAt??void 0}}async function Tn(Xn,Lr){var Ga,Za;ht(),f.length=0,F({type:"sessionStarted"});const ti=el=>{if(ht(),Lr===qe){C(`✖ ${el}`);for(const uu of T)uu(el)}};try{if(await wt.prepareOpen(Xn,(ii,yl)=>C(`Downloading from your account… ${ii}/${yl}`)),Lr!==qe)return;if(!await r.open(Xn)){ti("This scene is open in another tab. Close it there to edit it here.");return}const el=await r.readAll(Xn).then(async ii=>{for(const[yl,ja]of Twr(ii))await Wt(Xn,yl,ja),ii.set(yl,ja);return ii}).catch(ii=>{throw r.close(Xn),ii});if(Lr!==qe){r.close(Xn);return}const uu=await he(Xn);if(Lr!==qe){r.close(Xn);return}const lr=K.open(Xn,el,uu);pe=lr;const Pl=K.realmUrl(uu);if(fe=Pl,C(`▶ Opening ${((Za=(Ga=Ib(lr.files.get("scene.json")))==null?void 0:Ga.display)==null?void 0:Za.title)||Xn}`),!await lr.start()&&!await lr.published()){if(Lr!==qe)return;C("✖ The scene did not build.");for(const ii of T)ii("The scene did not build.");return}if(await r.patch(Xn,{lastOpened:Date.now()}),Lr!==qe){ht();return}const fm=Ib(lr.files.get("scene.json"))??{};te=x9e(fm,Pl),Y=c2r(ii=>t.engineConsole(ii),C);for(const ii of x)ii(te)}catch(el){ti(T2r(el))}}function fi(Xn){N.close(),te=null;const Lr=++qe,ti=St.reset(),Ga=xt.then(async()=>{await ti,await lt,Lr===qe&&await Xn(Lr)});return xt=Ga.catch(Za=>console.error("[editor] project transition failed",Za)),Ga}function Tt(){if(pe===null)throw new Error("no project is open");return pe}const Wi={saveFile:async({path:Xn,content:Lr})=>Wt(Tt().id,Xn,Lr),getFile:async({path:Xn})=>{const Lr=Tt().files.get(Xn)??Nkr(Xn);if(Lr===void 0)throw new Error(`no such file: ${Xn}`);return{content:Lr}},removeFiles:async({filePaths:Xn})=>{const Lr=Tt(),ti=[],Ga=[];for(const Za of Xn)(await Ue(Lr.id,Za).catch(()=>!1)?ti:Ga).push(Za);return{success:ti,failed:Ga}},getFilesSizes:async({path:Xn,ignore:Lr})=>{const ti=Xn===""?"":`${Xn.replace(/\/+$/,"")}/`;return{files:[...Tt().files.keys()].filter(Za=>Za.startsWith(ti)&&!Za.split("/").some(el=>Lr.includes(el))).sort().map(Za=>({path:Za}))}}},Er={async find(Xn){return(await r.list()).some(Lr=>Lr.id===Xn)?!0:(await wt.refresh(!0),wt.remoteOnly().some(Lr=>Lr.id===Xn))},files:async Xn=>(pe==null?void 0:pe.id)===Xn?new Map(pe.files):r.readAll(Xn),manifest:Xn=>wt.manifest(Xn),build:async(Xn,Lr)=>K.build(Xn,await Er.files(Xn),Lr),dependencies:async Xn=>qWt(await $e(Xn,"package.json")),onImported:Xn=>(st.add(Xn),()=>st.delete(Xn))},to=a===null?null:STr({host:a,setWorld:async(Xn,Lr)=>{var Ga,Za;((Za=(Ga=Ib(await $e(Xn,"scene.json")))==null?void 0:Ga.worldConfiguration)==null?void 0:Za.name)!==Lr&&await tn(Xn,el=>({...el,worldConfiguration:{...el.worldConfiguration??{},name:Lr}}))},files:Xn=>Er.files(Xn),build:(Xn,Lr)=>K.build(Xn,Lr,{production:!0}),published:(Xn,Lr)=>r.patch(Xn,{published:Lr})}),Ba=(a==null?void 0:a.services.projects)==null?null:h2r(DTr(a.services.projects,(Xn,Lr)=>a.signedFetch(Xn,Lr)),jxe);Yfr(FSr(t.editorBase)),jSr(t.editorBase),ZUt({material:BSr,sound:$Sr}),Cpr(async()=>g2r(await Er.files(Tt().id)));const Vo=Ukr({builtin:ZTr(t.editorBase,wB("prefabs/catalog.json"),ATe),user:()=>Ba!==null&&l()!==null?Ba.tree:null}),Kc={...(a==null?void 0:a.services.projects)==null?{}:{...St.shell,aiOffered:()=>dt,aiTranscript:()=>{const Xn=qt;if(Xn===null||pe===null)return null;const Lr=pe.id;return{owner:`${Lr}@${Xn.toLowerCase()}`,load:()=>r.transcript(Lr,Xn),save:ti=>r.setTranscript(Lr,Xn,ti)}}},pickProject:async()=>{},openProject:Xn=>fi(Lr=>Tn(Xn,Lr)),relaunchProject:Xn=>fi(Lr=>Tn(Xn,Lr)),closeProject:()=>fi(async()=>{ht(),F({type:"sessionStarted"}),C("■ Scene closed"),await Ee(null).catch(Xn=>console.warn("[editor] could not clear the previews",Xn))}),getState:async()=>{const Xn=await r.list(),Lr=wt.status().projects,ti=wt.remoteOnly().map(Ga=>({path:Ga.id,name:Ga.name,title:Ga.name,world:null,parcels:0,thumbnail:null,remoteOnly:!0}));return{recentProjects:[...Xn].sort((Ga,Za)=>Za.lastOpened-Ga.lastOpened).map(Ga=>Ga.id),projects:[...await Promise.all(Xn.map(Ga=>un(Ga,Lr))),...ti],logs:[...f],bevyWebDir:"",editorSceneDir:"",webPort:0,scenePort:0,editorScenePort:0,favourites:Xn.filter(Ga=>Ga.favourite).map(Ga=>Ga.id)}},onStackLog:Xn=>{m.push(Xn)},onBuildEvent:Xn=>{_.push(Xn)},onServersReady:Xn=>{x.push(Xn)},requestReady:async()=>te,phonePreview:async Xn=>te===null?{ok:!1,reason:"no-scene"}:N.open(te.realm,te.position,Xn),phonePreviewState:N.state,onPhonePreviewState:N.subscribe,closePhonePreview:N.close,capturePhonePreview:N.capture,onServersError:Xn=>{T.push(Xn)},toggleFavourite:async Xn=>{const Lr=(await r.list()).find(ti=>ti.id===Xn);Lr!==void 0&&await r.patch(Xn,{favourite:!Lr.favourite})},deleteProject:async Xn=>{const Lr=await r.trash(Xn);return Lr&&wt.trashed(Xn),Lr},trashedProjects:async()=>Promise.all((await r.trashed()).map(Xn=>un(Xn))),restoreProject:async Xn=>{const Lr=await r.restore(Xn);return Lr&&wt.restored(Xn),Lr},syncStatus:async()=>(wt.refresh(),wt.status()),onSyncStatus:Xn=>wt.subscribe(Xn),resolveSyncConflict:(Xn,Lr)=>wt.resolve(Xn,Lr),exportProject:async Xn=>QTr(await Ut(Xn),await Er.files(Xn)),importProject:async Xn=>{const Lr=await XTr(Xn,async(ti,Ga)=>{const Za=await r.create(ti,Ga,{taken:wt.remoteIds()});return wt.touched(Za.id,"scene.json"),Za.id});if((Lr==null?void 0:Lr.ok)===!0){const{id:ti,needsPackages:Ga}=Lr.report;Object.keys(Ga).length>0&&r.readAll(ti).then(Za=>K.install(ti,Za)).catch(Za=>console.warn("[editor] could not install the packages of",ti,Za));for(const Za of st)Za(Lr.report)}return Lr},projectPackages:async Xn=>B.get(Xn)??null,onProjectPackages:Xn=>(H.add(Xn),()=>H.delete(Xn)),...to===null||a===null?{}:{publishScene:(Xn,Lr,ti)=>to.publish(Xn,Lr,ti),...to.publishShared===void 0?{}:{publishShared:to.publishShared},publishStop:async()=>to.stop(),publishWorlds:async()=>xTr(l(),a.services.worldsContent)},canImportFolder:JTr(),renameProject:(Xn,Lr)=>tn(Xn,ti=>({...ti,display:{...ti.display??{},title:Lr.trim()}})),duplicateProject:Xn=>vt(Xn,"copy"),sceneTemplates:async()=>Okr(),createScene:async(Xn,Lr,ti)=>{const Ga=sqt(ti),Za=Ib(Ga.get("scene.json"));if(Za===null)throw new Error(`template not found: ${ti}`);Ga.set("scene.json",IOt({...Za,display:{...Za.display??{},title:Lr.trim()}}));const el=await r.create(Lr,Ga,{taken:wt.remoteIds()});return wt.touched(el.id,"scene.json"),el.id},openExternal:async Xn=>{/^https?:$/.test(new URL(Xn).protocol)&&window.open(Xn,"_blank","noopener,noreferrer")},compositeEntityIds:async Xn=>{for(const Lr of qSr){const ti=await $e(Xn,Lr);if(ti!==void 0)return GSr(new TextDecoder().decode(ti))}return[]},sceneSettings:async Xn=>{const Lr=Ib(await $e(Xn,"scene.json"));if(Lr===null)throw new Error("scene.json is missing or is not valid JSON");const ti=USr(Lr);return{...ti,thumbnail:await An(Xn,ti.thumbnailPath)}},saveSceneSettings:async(Xn,Lr)=>{const ti=zSr(Lr);return ti!==null?ti:(await tn(Xn,Ga=>VSr(Ga,Lr)),null)},pickSceneThumbnail:async Xn=>{const Lr=await aqt(Object.values(QWe).join(","));if(Lr===null)return null;const ti=VWt(Lr.name);if(QWe[ti]===void 0)throw new Error("not a supported image (png, jpg, gif, webp)");const Ga=`${b2r}/scene-thumbnail${ti}`,Za=new Uint8Array(await Lr.arrayBuffer());return await Wt(Xn,Ga,Za),{path:Ga,dataUrl:NOt(Ga,Za)}},appVersion:async()=>PSr,prefabLibraryList:()=>Vo.list(),prefabLibraryCopyIn:async(Xn,Lr)=>Vo.copyIn(Xn,Me(Lr)),prefabLibraryUpdateCopy:async(Xn,Lr)=>Vo.updateCopy(Xn,Me(Lr)),prefabUserLibrary:()=>Ba===null?"unavailable":l()===null?"guest":"on",...Ba===null?{}:{prefabLibraryCopyOut:async(Xn,Lr)=>{if(l()===null)throw new Error(S2r);return Ba.copyOut(Me(Xn),Lr)},prefabLibraryDelete:async Xn=>{const Lr=oqt(Xn);return(Lr==null?void 0:Lr.scope)==="user"&&l()!==null?Ba.remove(Lr.name):!1}}};async function Hl(){const Xn=new Set;for(const Lr of[...await r.list(),...await r.trashed()]){const ti=DWt(await $e(Lr.id,F3).catch(()=>{}));for(const Ga of Object.keys((ti==null?void 0:ti.packages)??{}))Xn.add(Ga);for(const[Ga,Za]of Object.entries((ti==null?void 0:ti.dependencies)??{}))Xn.add(Yj(Ga,Za))}for(const Lr of await r.packages.keys())Xn.has(Lr)||await r.packages.remove(Lr)}return r.purge(Date.now()-v2r).then(async Xn=>{const Lr=await caches.open(Uxe),ti=Xn.map(({id:Za,previewId:el})=>K.realmUrl(el??Za));for(const Za of await Lr.keys())ti.some(el=>Za.url.startsWith(el))&&await Lr.delete(Za);const Ga=await caches.open(ASr);for(const Za of ti)await Ga.delete(`${Za}__storage`);Xn.length>0&&await Hl()}).catch(Xn=>console.warn("[editor] could not empty the trash",Xn)),{shell:Kc,projects:Er,dataLayer:Wi,dispose:()=>{N.dispose(),St.dispose(),qe++,ht(),K.dispose(),clearInterval(Re),document.removeEventListener("visibilitychange",Ke),wt.flush().finally(()=>wt.dispose())}}};let Xj=null,TG=null,ire=null,pPt=!1;function E2r(){if(Xj!==null)return Xj;const t=window.__dclEditorHost;if(t===void 0||t.version!==0&&t.version!==1)return console.error("[editor] window.__dclEditorHost (contract v0 or v1) is missing: nothing to mount into"),null;console.log("[editor] web build 2026-10-30T19:56:14.515Z"),IPt(t),_Nt(a=>t.engineConsole(a)),kRt(()=>t.identity()),gHn.needed=!1;const n=k2r({host:t,sceneCompiler:LSr(t.editorBase)});window.editorShell=C2r(n.shell,t),qDt(n.dataLayer??null),nHe();const r=document.createElement("link");return r.rel="stylesheet",r.href=new URL("editor.css",t.editorBase).href,r.integrity=wB("editor.css"),r.crossOrigin="anonymous",r.onerror=()=>console.error("[editor] editor.css did not load or does not match the hash this editor was published with: its fonts are not applied"),document.head.appendChild(r),IE.project=null,IE.notice=null,Xj={host:t,web:n,fonts:r},Xj}function qxe(){const t=TG;TG=null,t==null||t.unmount()}function C2r(t,n){const{createScene:r,importProject:a,duplicateProject:s}=t;return{...t,...r===void 0?{}:{createScene:async(l,f,m)=>{const _=await r(l,f,m);return _!==null&&Kx("project_created",{project_id:_,source:"template",template:m}),_}},...a===void 0?{}:{importProject:async l=>{const f=await a(l);return(f==null?void 0:f.ok)===!0&&Kx("project_created",{project_id:f.report.id,source:"import",import_kind:l}),f}},...s===void 0?{}:{duplicateProject:async l=>{const f=await s(l);return f!==null&&Kx("project_created",{project_id:f,source:"duplicate",from_project_id:l}),f}},openProject:async l=>{const f=TG;qxe(),f==null||f.api.close(),ire??(ire=Sjt(n.container,A.jsx(owr,{}))),n.setMode("edit"),IE.project=l,IE.opens++,await t.openProject(l),Kx("project_opened")}}}function A2r(t,n){var m;const r=E2r();if(r===null)return()=>{};qxe();const a=document.createElement("div");a.style.cssText="position:relative;width:100%;height:100%",XGn(a),t.appendChild(a);const s=Sjt(a,A.jsx(eHn,{}),"eui-create-root"),l={api:n,unmount:()=>{s(),a.remove()}};TG=l;const f=pPt?null:((m=Ck(r.host))==null?void 0:m.openProject)??null;return pPt=!0,Kx("editor_opened",{deep_link:f!==null}),f!==null&&r.web.projects.find(f).catch(()=>!1).then(_=>{var x;TG===l&&(_?(x=window.editorShell)==null||x.openProject(f):IE.notice=`“${f}” is not on this device or on your account. Here are your scenes.`)}),()=>{TG===l&&qxe()}}function O2r(){qxe();const t=Xj;if(t===null)return;Xj=null;const n=VE();ire==null||ire(),ire=null,t.fonts.remove(),IE.project=null,delete window.editorShell,kRt(null),_Nt(null),IPt(null),t.host.setMode("off"),n.finally(()=>{var r,a;(a=(r=t.web).dispose)==null||a.call(r),Xj===null&&qDt(null)})}window.__dclEditor={mountHome:A2r,unmount:O2r};
|
|
35869
|
+
`;F.set("data.json",new TextEncoder().encode(K));const te=iqe(cqt(H,T)).slice(0,f2r).replace(/_+$/,"")||"prefab",pe=new Set((await t.list()).map(Y=>Y.name));let fe=1;for(let Y=0;Y<p2r;Y++){let he=te;for(;pe.has(he);)he=`${te}_${++fe}`;try{return await f(he,F),{ref:`user:${he}`,scope:"user",data:K}}catch(Ee){if(!(Ee instanceof YWt))throw Ee;pe.add(he)}}throw new Error("could not find a free name in your library — try again")},remove:m=>t.remove(m)}}const dPt=new WeakMap;function _2r(t){let n=dPt.get(t);return n===void 0&&(n=crypto.subtle.digest("SHA-256",new Uint8Array(t)).then(r=>[...new Uint8Array(r)].map(a=>a.toString(16).padStart(2,"0")).join("")),dPt.set(t,n)),n}async function g2r(t){const n=t.get(".dclignore"),r=cZe(t.keys(),n===void 0?void 0:new TextDecoder().decode(n)).filter(l=>l!==F3),a=new Map;let s=0;for(const l of r){const f=t.get(l);f!==void 0&&(a.set(await _2r(f),f.byteLength),s++)}return{bytes:[...a.values()].reduce((l,f)=>l+f,0),files:s}}const fPt=4e3,y2r=4e6,v2r=APt*24*60*60*1e3,b2r="assets/images",x2r=3e3,w2r=100,S2r="Sign in to keep prefabs in your own library. The built-in prefabs work without it.",T2r=t=>t instanceof Error?t.message:String(t);function x9e(t,n){var r,a,s;return{realm:n.replace(/\/$/,""),systemScene:"",position:((r=t.scene)==null?void 0:r.base)??((s=(a=t.scene)==null?void 0:a.parcels)==null?void 0:s[0])??"0,0",spawn:WSr(t),spawnPoints:JSON.stringify(Array.isArray(t.spawnPoints)?t.spawnPoints:[])}}const k2r=({host:t,sceneCompiler:n})=>{const r=new PTr(TTr()),a=Ck(t),s=a===null||a.services.projects===null?null:QWt(a.services.projects,(Xn,Lr)=>a.signedFetch(Xn,Lr)),l=()=>{const{address:Xn,isGuest:Lr}=t.identity();return Lr||Xn===null?null:Xn.toLowerCase()},f=[],m=[],_=[],x=[],T=[],C=Xn=>{f.push(Xn),f.length>fPt&&f.splice(0,f.length-fPt);for(const Lr of m)Lr(Xn)},N=n2r(e2r(t.pageDir,(a==null?void 0:a.services.projects)??null,location.search),he,async Xn=>cPt(await X,l()??"guest",Xn),t2r((a==null?void 0:a.services.worldsContent)??null)),F=Xn=>{for(const Lr of _)Lr(Xn);Xn.type==="bundleSaved"&&pe!==null&&N.built(pe.id).catch(Lr=>console.error("[editor] mobile preview reload failed",Lr))},B=new Map,H=new Set,X=gRt.then(Gkr),K=Ykr({pageDir:t.pageDir,urls:n,machineId:async Xn=>cPt(await X,l()??"guest",Xn),emit:F,log:C,packages:r.packages,saveLock:async(Xn,Lr)=>{await r.write(Xn,F3,Lr),wt.touched(Xn,F3),(pe==null?void 0:pe.id)===Xn&&pe.files.set(F3,Lr)},onPackages:(Xn,Lr)=>{if(Lr===null){B.delete(Xn);return}B.set(Xn,Lr);for(const ti of H)ti(Xn,Lr)}});let te=null,pe=null,fe=null,Y=null;async function he(Xn){var Ga;const Lr=(Ga=(await r.list()).find(Za=>Za.id===Xn))==null?void 0:Ga.previewId;if(Lr!==void 0)return Lr;const ti="p"+Array.from(crypto.getRandomValues(new Uint8Array(16)),Za=>Za.toString(16).padStart(2,"0")).join("");return await r.patch(Xn,{previewId:ti}),ti}async function Ee(Xn){const Lr=new URL("preview/",t.pageDir).href,ti=await caches.open(Uxe);for(const Ga of await ti.keys())Ga.url.startsWith(Lr)&&(Xn===null||!Ga.url.startsWith(Xn))&&await ti.delete(Ga)}let qe=0,xt=Promise.resolve(),lt=Promise.resolve();const St=DSr({service:(a==null?void 0:a.services.projects)??null,fetch:(Xn,Lr)=>a===null?Promise.reject(new Error("The assistant service is not configured.")):a.signedFetch(Xn,Lr),wallet:l,mobilePreview:N.status,memory:{read:async(Xn,Lr)=>{const ti=await r.assistantMemory(Xn,Lr);return Zc(ti)&&typeof ti.id=="string"&&typeof ti.key=="string"?{id:ti.id,key:ti.key}:null},write:(Xn,Lr,ti)=>r.setAssistantMemory(Xn,Lr,ti)},project:()=>{const Xn=Tt();return{id:Xn.id,tools:{files:()=>Xn.files,write:(Lr,ti,Ga,Za)=>Wt(Xn.id,Lr,ti,{expected:Ga,signal:Za}),assets:GUt({files:()=>Xn.files}),scene:(Lr,ti)=>vTe(Lr,ti,async Ga=>{var ii,yl,ja;const Za=ss=>{var Ts,Zs;return JSON.stringify([(Ts=ss==null?void 0:ss.scene)==null?void 0:Ts.parcels,(Zs=ss==null?void 0:ss.scene)==null?void 0:Zs.base])};await VE();const el=Za(Ib(await $e(Xn.id,"scene.json")));await tn(Xn.id,ss=>JSr(ss,Ga));const uu=Ib(await $e(Xn.id,"scene.json")),lr=Za(uu)!==el,Pl=((ii=uu==null?void 0:uu.scene)==null?void 0:ii.parcels)??[],fm=(yl=nt.scene)==null?void 0:yl.parcels.map(ss=>`${ss.x},${ss.y}`).sort().join(";");if(lr||fm!==[...Pl].sort().join(";")){if(!await Xn.flush())throw new Error("The scene did not build. Fix the code and retry sceneSettings to load the new parcels.");ti.throwIfAborted();const ss=await he(Xn.id);te=x9e(uu??{},K.realmUrl(ss)),await l2r(Pl,()=>{for(const Ts of x)Ts(te)},ti)}else if(te!==null){const ss=x9e(uu??{},te.realm);(ss.spawn!==te.spawn||ss.spawnPoints!==te.spawnPoints)&&(te={...te,spawn:ss.spawn,spawnPoints:ss.spawnPoints},fdr(ss.spawn,ss.spawnPoints))}return{requiredPermissions:(uu==null?void 0:uu.requiredPermissions)??[],spawnPoints:(uu==null?void 0:uu.spawnPoints)??[],parcels:Pl,base:((ja=uu==null?void 0:uu.scene)==null?void 0:ja.base)??null,previewReady:!0}}),written:QUt,view:(Lr,ti)=>bTe(Lr,ti),playtest:$Xe,uiLayout:xWe,turnEnded:Wzt,build:async Lr=>{Lr.throwIfAborted(),await lt;const ti=await K.build(Xn.id,new Map(Xn.files));if(Lr.throwIfAborted(),!ti.ok)return{ok:!1,diagnostics:ti.diagnostics,mobilePreview:N.status()};const Ga=await qUt();return Lr.throwIfAborted(),{ok:!0,diagnostics:ti.diagnostics,run:Ga,mobilePreview:N.status()}}}}}});function ht(){St.reset(),Y==null||Y(),Y=null,pe!==null&&(pe.stop(),r.close(pe.id),wt.flush(pe.id),pe=null,fe=null)}async function $e(Xn,Lr){return(pe==null?void 0:pe.id)===Xn?pe.files.get(Lr):r.read(Xn,Lr).catch(ti=>{if(!yI(ti))throw ti})}function Wt(Xn,Lr,ti,Ga){const Za=lt.then(async()=>{if(Ga==null||Ga.signal.throwIfAborted(),Ga!==void 0&&((pe==null?void 0:pe.id)!==Xn||!XUt(pe.files.get(Lr),Ga.expected)))throw new Error("This file changed. Read it again before writing.");await r.write(Xn,Lr,ti),wt.touched(Xn,Lr),(pe==null?void 0:pe.id)===Xn&&(pe.files.set(Lr,ti),pe.changed(Lr))});return lt=Za.catch(el=>console.error("[editor] file write failed",el)),Za}function Ue(Xn,Lr){const ti=lt.then(async()=>{const Ga=await r.remove(Xn,Lr);return Ga&&wt.touched(Xn,Lr),Ga&&(pe==null?void 0:pe.id)===Xn&&pe.files.delete(Lr)&&pe.changed(Lr),Ga});return lt=ti.catch(Ga=>console.error("[editor] file removal failed",Ga)),ti}function Me(Xn){const Lr=Tt();if(Lr.id!==Xn)throw new Error("that scene is not the one open");return{files:()=>Lr.files,write:(ti,Ga)=>Wt(Xn,ti,Ga),remove:async ti=>{await Ue(Xn,ti)}}}async function Ut(Xn){var Ga;const Lr=Ib(await $e(Xn,"scene.json").catch(()=>{})),ti=(((Ga=Lr==null?void 0:Lr.display)==null?void 0:Ga.title)??"").replace(/[\x00-\x1f\x7f]/g,"").replace(new RegExp(JWt.source,"g"),"").trim().slice(0,w2r);return ti===""?Xn:ti}async function vt(Xn,Lr){const ti=(await r.list()).find(Za=>Za.id===Xn);if(ti===void 0)return null;const Ga=await r.duplicate(Xn,`${ti.name} ${Lr}`,wt.remoteIds());return await tn(Ga.id,Za=>{var el;return{...Za,display:{...Za.display??{},title:`${((el=Za.display)==null?void 0:el.title)||ti.name} ${Lr}`}}}),Ga.id}const wt=FTr({store:r,session:()=>{const Xn=l();return s===null||Xn===null?null:{api:s,wallet:Xn}},account:()=>s===null?"unavailable":l()===null?"guest":"on",hash:jxe,title:Ut,duplicate:async Xn=>{const Lr=await vt(Xn,CPt(new Date));if(Lr===null)throw new Error("The scene is no longer on this device");return Lr}});let dt=!1,Nt=0;async function $t(){const Xn=++Nt,Lr=l()!==null&&(await St.shell.aiProviders()).some(ti=>ti.available);Xn!==Nt||Lr===dt||(dt=Lr,J0())}$t();let qt=l();const Re=setInterval(()=>{const Xn=l();Xn!==qt&&(qt=Xn,St.reset(),J0(),$t(),wt.refresh(!0),Ee(fe).catch(Lr=>console.warn("[editor] could not clear the previews",Lr)))},x2r),Ke=()=>{document.visibilityState==="hidden"&&wt.flush()};document.addEventListener("visibilitychange",Ke);const st=new Set;async function tn(Xn,Lr){const ti=Ib(await $e(Xn,"scene.json"));if(ti===null)throw new Error("scene.json is missing or is not valid JSON");await Wt(Xn,"scene.json",IOt(Lr(ti)))}async function An(Xn,Lr){if(Lr==null||Lr==="")return null;const ti=await $e(Xn,Lr).catch(()=>{});return ti===void 0||ti.length>y2r?null:NOt(Lr,ti)}async function un(Xn,Lr=wt.status().projects){var Ga,Za,el,uu;const ti=Ib(await $e(Xn.id,"scene.json").catch(()=>{}));return{sync:Lr[Xn.id],path:Xn.id,name:Xn.name,title:((Ga=ti==null?void 0:ti.display)==null?void 0:Ga.title)||Xn.name,world:((Za=ti==null?void 0:ti.worldConfiguration)==null?void 0:Za.name)||null,parcels:Array.isArray((el=ti==null?void 0:ti.scene)==null?void 0:el.parcels)?ti.scene.parcels.length:0,thumbnail:await An(Xn.id,(uu=ti==null?void 0:ti.display)==null?void 0:uu.navmapThumbnail),favourite:Xn.favourite,lastOpened:Xn.lastOpened,published:Xn.published,deletedAt:Xn.deletedAt??void 0}}async function Tn(Xn,Lr){var Ga,Za;ht(),f.length=0,F({type:"sessionStarted"});const ti=el=>{if(ht(),Lr===qe){C(`✖ ${el}`);for(const uu of T)uu(el)}};try{if(await wt.prepareOpen(Xn,(ii,yl)=>C(`Downloading from your account… ${ii}/${yl}`)),Lr!==qe)return;if(!await r.open(Xn)){ti("This scene is open in another tab. Close it there to edit it here.");return}const el=await r.readAll(Xn).then(async ii=>{for(const[yl,ja]of Twr(ii))await Wt(Xn,yl,ja),ii.set(yl,ja);return ii}).catch(ii=>{throw r.close(Xn),ii});if(Lr!==qe){r.close(Xn);return}const uu=await he(Xn);if(Lr!==qe){r.close(Xn);return}const lr=K.open(Xn,el,uu);pe=lr;const Pl=K.realmUrl(uu);if(fe=Pl,C(`▶ Opening ${((Za=(Ga=Ib(lr.files.get("scene.json")))==null?void 0:Ga.display)==null?void 0:Za.title)||Xn}`),!await lr.start()&&!await lr.published()){if(Lr!==qe)return;C("✖ The scene did not build.");for(const ii of T)ii("The scene did not build.");return}if(await r.patch(Xn,{lastOpened:Date.now()}),Lr!==qe){ht();return}const fm=Ib(lr.files.get("scene.json"))??{};te=x9e(fm,Pl),Y=c2r(ii=>t.engineConsole(ii),C);for(const ii of x)ii(te)}catch(el){ti(T2r(el))}}function fi(Xn){N.close(),te=null;const Lr=++qe,ti=St.reset(),Ga=xt.then(async()=>{await ti,await lt,Lr===qe&&await Xn(Lr)});return xt=Ga.catch(Za=>console.error("[editor] project transition failed",Za)),Ga}function Tt(){if(pe===null)throw new Error("no project is open");return pe}const Wi={saveFile:async({path:Xn,content:Lr})=>Wt(Tt().id,Xn,Lr),getFile:async({path:Xn})=>{const Lr=Tt().files.get(Xn)??Nkr(Xn);if(Lr===void 0)throw new Error(`no such file: ${Xn}`);return{content:Lr}},removeFiles:async({filePaths:Xn})=>{const Lr=Tt(),ti=[],Ga=[];for(const Za of Xn)(await Ue(Lr.id,Za).catch(()=>!1)?ti:Ga).push(Za);return{success:ti,failed:Ga}},getFilesSizes:async({path:Xn,ignore:Lr})=>{const ti=Xn===""?"":`${Xn.replace(/\/+$/,"")}/`;return{files:[...Tt().files.keys()].filter(Za=>Za.startsWith(ti)&&!Za.split("/").some(el=>Lr.includes(el))).sort().map(Za=>({path:Za}))}}},Er={async find(Xn){return(await r.list()).some(Lr=>Lr.id===Xn)?!0:(await wt.refresh(!0),wt.remoteOnly().some(Lr=>Lr.id===Xn))},files:async Xn=>(pe==null?void 0:pe.id)===Xn?new Map(pe.files):r.readAll(Xn),manifest:Xn=>wt.manifest(Xn),build:async(Xn,Lr)=>K.build(Xn,await Er.files(Xn),Lr),dependencies:async Xn=>qWt(await $e(Xn,"package.json")),onImported:Xn=>(st.add(Xn),()=>st.delete(Xn))},to=a===null?null:STr({host:a,setWorld:async(Xn,Lr)=>{var Ga,Za;((Za=(Ga=Ib(await $e(Xn,"scene.json")))==null?void 0:Ga.worldConfiguration)==null?void 0:Za.name)!==Lr&&await tn(Xn,el=>({...el,worldConfiguration:{...el.worldConfiguration??{},name:Lr}}))},files:Xn=>Er.files(Xn),build:(Xn,Lr)=>K.build(Xn,Lr,{production:!0}),published:(Xn,Lr)=>r.patch(Xn,{published:Lr})}),Ba=(a==null?void 0:a.services.projects)==null?null:h2r(DTr(a.services.projects,(Xn,Lr)=>a.signedFetch(Xn,Lr)),jxe);Yfr(FSr(t.editorBase)),jSr(t.editorBase),ZUt({material:BSr,sound:$Sr}),Cpr(async()=>g2r(await Er.files(Tt().id)));const Vo=Ukr({builtin:ZTr(t.editorBase,wB("prefabs/catalog.json"),ATe),user:()=>Ba!==null&&l()!==null?Ba.tree:null}),Kc={...(a==null?void 0:a.services.projects)==null?{}:{...St.shell,aiOffered:()=>dt,aiTranscript:()=>{const Xn=qt;if(Xn===null||pe===null)return null;const Lr=pe.id;return{owner:`${Lr}@${Xn.toLowerCase()}`,load:()=>r.transcript(Lr,Xn),save:ti=>r.setTranscript(Lr,Xn,ti)}}},pickProject:async()=>{},openProject:Xn=>fi(Lr=>Tn(Xn,Lr)),relaunchProject:Xn=>fi(Lr=>Tn(Xn,Lr)),closeProject:()=>fi(async()=>{ht(),F({type:"sessionStarted"}),C("■ Scene closed"),await Ee(null).catch(Xn=>console.warn("[editor] could not clear the previews",Xn))}),getState:async()=>{const Xn=await r.list(),Lr=wt.status().projects,ti=wt.remoteOnly().map(Ga=>({path:Ga.id,name:Ga.name,title:Ga.name,world:null,parcels:0,thumbnail:null,remoteOnly:!0}));return{recentProjects:[...Xn].sort((Ga,Za)=>Za.lastOpened-Ga.lastOpened).map(Ga=>Ga.id),projects:[...await Promise.all(Xn.map(Ga=>un(Ga,Lr))),...ti],logs:[...f],bevyWebDir:"",editorSceneDir:"",webPort:0,scenePort:0,editorScenePort:0,favourites:Xn.filter(Ga=>Ga.favourite).map(Ga=>Ga.id)}},onStackLog:Xn=>{m.push(Xn)},onBuildEvent:Xn=>{_.push(Xn)},onServersReady:Xn=>{x.push(Xn)},requestReady:async()=>te,phonePreview:async Xn=>te===null?{ok:!1,reason:"no-scene"}:N.open(te.realm,te.position,Xn),phonePreviewState:N.state,onPhonePreviewState:N.subscribe,closePhonePreview:N.close,capturePhonePreview:N.capture,onServersError:Xn=>{T.push(Xn)},toggleFavourite:async Xn=>{const Lr=(await r.list()).find(ti=>ti.id===Xn);Lr!==void 0&&await r.patch(Xn,{favourite:!Lr.favourite})},deleteProject:async Xn=>{const Lr=await r.trash(Xn);return Lr&&wt.trashed(Xn),Lr},trashedProjects:async()=>Promise.all((await r.trashed()).map(Xn=>un(Xn))),restoreProject:async Xn=>{const Lr=await r.restore(Xn);return Lr&&wt.restored(Xn),Lr},syncStatus:async()=>(wt.refresh(),wt.status()),onSyncStatus:Xn=>wt.subscribe(Xn),resolveSyncConflict:(Xn,Lr)=>wt.resolve(Xn,Lr),exportProject:async Xn=>QTr(await Ut(Xn),await Er.files(Xn)),importProject:async Xn=>{const Lr=await XTr(Xn,async(ti,Ga)=>{const Za=await r.create(ti,Ga,{taken:wt.remoteIds()});return wt.touched(Za.id,"scene.json"),Za.id});if((Lr==null?void 0:Lr.ok)===!0){const{id:ti,needsPackages:Ga}=Lr.report;Object.keys(Ga).length>0&&r.readAll(ti).then(Za=>K.install(ti,Za)).catch(Za=>console.warn("[editor] could not install the packages of",ti,Za));for(const Za of st)Za(Lr.report)}return Lr},projectPackages:async Xn=>B.get(Xn)??null,onProjectPackages:Xn=>(H.add(Xn),()=>H.delete(Xn)),...to===null||a===null?{}:{publishScene:(Xn,Lr,ti)=>to.publish(Xn,Lr,ti),...to.publishShared===void 0?{}:{publishShared:to.publishShared},publishStop:async()=>to.stop(),publishWorlds:async()=>xTr(l(),a.services.worldsContent)},canImportFolder:JTr(),renameProject:(Xn,Lr)=>tn(Xn,ti=>({...ti,display:{...ti.display??{},title:Lr.trim()}})),duplicateProject:Xn=>vt(Xn,"copy"),sceneTemplates:async()=>Okr(),createScene:async(Xn,Lr,ti)=>{const Ga=sqt(ti),Za=Ib(Ga.get("scene.json"));if(Za===null)throw new Error(`template not found: ${ti}`);Ga.set("scene.json",IOt({...Za,display:{...Za.display??{},title:Lr.trim()}}));const el=await r.create(Lr,Ga,{taken:wt.remoteIds()});return wt.touched(el.id,"scene.json"),el.id},openExternal:async Xn=>{/^https?:$/.test(new URL(Xn).protocol)&&window.open(Xn,"_blank","noopener,noreferrer")},compositeEntityIds:async Xn=>{for(const Lr of qSr){const ti=await $e(Xn,Lr);if(ti!==void 0)return GSr(new TextDecoder().decode(ti))}return[]},sceneSettings:async Xn=>{const Lr=Ib(await $e(Xn,"scene.json"));if(Lr===null)throw new Error("scene.json is missing or is not valid JSON");const ti=USr(Lr);return{...ti,thumbnail:await An(Xn,ti.thumbnailPath)}},saveSceneSettings:async(Xn,Lr)=>{const ti=zSr(Lr);return ti!==null?ti:(await tn(Xn,Ga=>VSr(Ga,Lr)),null)},pickSceneThumbnail:async Xn=>{const Lr=await aqt(Object.values(QWe).join(","));if(Lr===null)return null;const ti=VWt(Lr.name);if(QWe[ti]===void 0)throw new Error("not a supported image (png, jpg, gif, webp)");const Ga=`${b2r}/scene-thumbnail${ti}`,Za=new Uint8Array(await Lr.arrayBuffer());return await Wt(Xn,Ga,Za),{path:Ga,dataUrl:NOt(Ga,Za)}},appVersion:async()=>PSr,prefabLibraryList:()=>Vo.list(),prefabLibraryCopyIn:async(Xn,Lr)=>Vo.copyIn(Xn,Me(Lr)),prefabLibraryUpdateCopy:async(Xn,Lr)=>Vo.updateCopy(Xn,Me(Lr)),prefabUserLibrary:()=>Ba===null?"unavailable":l()===null?"guest":"on",...Ba===null?{}:{prefabLibraryCopyOut:async(Xn,Lr)=>{if(l()===null)throw new Error(S2r);return Ba.copyOut(Me(Xn),Lr)},prefabLibraryDelete:async Xn=>{const Lr=oqt(Xn);return(Lr==null?void 0:Lr.scope)==="user"&&l()!==null?Ba.remove(Lr.name):!1}}};async function Hl(){const Xn=new Set;for(const Lr of[...await r.list(),...await r.trashed()]){const ti=DWt(await $e(Lr.id,F3).catch(()=>{}));for(const Ga of Object.keys((ti==null?void 0:ti.packages)??{}))Xn.add(Ga);for(const[Ga,Za]of Object.entries((ti==null?void 0:ti.dependencies)??{}))Xn.add(Yj(Ga,Za))}for(const Lr of await r.packages.keys())Xn.has(Lr)||await r.packages.remove(Lr)}return r.purge(Date.now()-v2r).then(async Xn=>{const Lr=await caches.open(Uxe),ti=Xn.map(({id:Za,previewId:el})=>K.realmUrl(el??Za));for(const Za of await Lr.keys())ti.some(el=>Za.url.startsWith(el))&&await Lr.delete(Za);const Ga=await caches.open(ASr);for(const Za of ti)await Ga.delete(`${Za}__storage`);Xn.length>0&&await Hl()}).catch(Xn=>console.warn("[editor] could not empty the trash",Xn)),{shell:Kc,projects:Er,dataLayer:Wi,dispose:()=>{N.dispose(),St.dispose(),qe++,ht(),K.dispose(),clearInterval(Re),document.removeEventListener("visibilitychange",Ke),wt.flush().finally(()=>wt.dispose())}}};let Xj=null,TG=null,ire=null,pPt=!1;function E2r(){if(Xj!==null)return Xj;const t=window.__dclEditorHost;if(t===void 0||t.version!==0&&t.version!==1)return console.error("[editor] window.__dclEditorHost (contract v0 or v1) is missing: nothing to mount into"),null;console.log("[editor] web build 2026-10-30T19:56:25.106Z"),IPt(t),_Nt(a=>t.engineConsole(a)),kRt(()=>t.identity()),gHn.needed=!1;const n=k2r({host:t,sceneCompiler:LSr(t.editorBase)});window.editorShell=C2r(n.shell,t),qDt(n.dataLayer??null),nHe();const r=document.createElement("link");return r.rel="stylesheet",r.href=new URL("editor.css",t.editorBase).href,r.integrity=wB("editor.css"),r.crossOrigin="anonymous",r.onerror=()=>console.error("[editor] editor.css did not load or does not match the hash this editor was published with: its fonts are not applied"),document.head.appendChild(r),IE.project=null,IE.notice=null,Xj={host:t,web:n,fonts:r},Xj}function qxe(){const t=TG;TG=null,t==null||t.unmount()}function C2r(t,n){const{createScene:r,importProject:a,duplicateProject:s}=t;return{...t,...r===void 0?{}:{createScene:async(l,f,m)=>{const _=await r(l,f,m);return _!==null&&Kx("project_created",{project_id:_,source:"template",template:m}),_}},...a===void 0?{}:{importProject:async l=>{const f=await a(l);return(f==null?void 0:f.ok)===!0&&Kx("project_created",{project_id:f.report.id,source:"import",import_kind:l}),f}},...s===void 0?{}:{duplicateProject:async l=>{const f=await s(l);return f!==null&&Kx("project_created",{project_id:f,source:"duplicate",from_project_id:l}),f}},openProject:async l=>{const f=TG;qxe(),f==null||f.api.close(),ire??(ire=Sjt(n.container,A.jsx(owr,{}))),n.setMode("edit"),IE.project=l,IE.opens++,await t.openProject(l),Kx("project_opened")}}}function A2r(t,n){var m;const r=E2r();if(r===null)return()=>{};qxe();const a=document.createElement("div");a.style.cssText="position:relative;width:100%;height:100%",XGn(a),t.appendChild(a);const s=Sjt(a,A.jsx(eHn,{}),"eui-create-root"),l={api:n,unmount:()=>{s(),a.remove()}};TG=l;const f=pPt?null:((m=Ck(r.host))==null?void 0:m.openProject)??null;return pPt=!0,Kx("editor_opened",{deep_link:f!==null}),f!==null&&r.web.projects.find(f).catch(()=>!1).then(_=>{var x;TG===l&&(_?(x=window.editorShell)==null||x.openProject(f):IE.notice=`“${f}” is not on this device or on your account. Here are your scenes.`)}),()=>{TG===l&&qxe()}}function O2r(){qxe();const t=Xj;if(t===null)return;Xj=null;const n=VE();ire==null||ire(),ire=null,t.fonts.remove(),IE.project=null,delete window.editorShell,kRt(null),_Nt(null),IPt(null),t.host.setMode("off"),n.finally(()=>{var r,a;(a=(r=t.web).dispose)==null||a.call(r),Xj===null&&qDt(null)})}window.__dclEditor={mountHome:A2r,unmount:O2r};
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl-regenesislabs/web-editor",
|
|
3
|
-
"version": "0.3.20
|
|
3
|
+
"version": "0.3.20",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "The Decentraland scene editor for the web explorer: editor.js plus the files it loads beside it. Served by version, not installed.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/dcl-regenesislabs/web-editor.git",
|
|
9
9
|
"directory": "packages/web"
|
|
10
|
-
}
|
|
11
|
-
"commit": "1080f6a88dd0734f13a3ab9b4beacb0e67a08ec5"
|
|
10
|
+
}
|
|
12
11
|
}
|