handler-playable-sdk 0.3.8 → 0.3.9
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/README.md +19 -1
- package/dist/AssetTextures-TB4XIUX6.js +1 -0
- package/dist/{ConfigOverride-DFTDUTRQ.js → ConfigOverride-QGV5TX37.js} +1 -1
- package/dist/chunk-ES3S33UP.js +1 -0
- package/dist/chunk-OPT6F3HO.js +1398 -0
- package/dist/chunk-RXI7YH7M.js +1 -0
- package/dist/{chunk-J2CL6VOZ.js → chunk-V636YM4S.js} +1 -1
- package/dist/{config-7DI6U2YD.js → config-3INFO7FK.js} +1 -1
- package/dist/index.cjs +125 -52
- package/dist/index.d.cts +28 -5
- package/dist/index.d.ts +28 -5
- package/dist/index.js +1 -1
- package/dist/{loader-object-centric-Ce6MVkQw.d.cts → loader-object-centric-BeVsUAXI.d.cts} +4 -0
- package/dist/{loader-object-centric-Ce6MVkQw.d.ts → loader-object-centric-BeVsUAXI.d.ts} +4 -0
- package/dist/pixi/index.cjs +17 -17
- package/dist/pixi/index.d.cts +30 -2
- package/dist/pixi/index.d.ts +30 -2
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +17 -17
- package/dist/three/index.js +1 -1
- package/package.json +1 -1
- package/dist/AssetTextures-NWHSMZNV.js +0 -1
- package/dist/chunk-BC5GBAMY.js +0 -1325
- package/dist/chunk-DHSGG7NF.js +0 -1
- package/dist/chunk-PWGHKK3J.js +0 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Contract-aligned Handler Playable SDK v0.1. Surface is fixed: `init`, `getRoot`,
|
|
|
4
4
|
|
|
5
5
|
## API (v0.1)
|
|
6
6
|
|
|
7
|
-
- `Handler.init({ root?, ids, profile, consent })`: creates or adopts a single root. `ids` must include mechanic_id, variant_id, deployment_id, export_id, profile_id, instance_id (instance default
|
|
7
|
+
- `Handler.init({ root?, ids, profile, consent })`: creates or adopts a single root. `ids` must include mechanic_id, variant_id, deployment_id, export_id, profile_id, instance_id (instance default "default" only allowed in dev). Consent/telemetry pulled from export profile.
|
|
8
8
|
- `Handler.getRoot()`: returns the sandbox root element.
|
|
9
9
|
- `Handler.on(name, cb)`, `Handler.off(name, cb)`: subscribe/unsubscribe to canonical events or custom namespaced ones.
|
|
10
10
|
- `Handler.start()`, `Handler.finish()`: lifecycle markers.
|
|
@@ -13,6 +13,24 @@ Contract-aligned Handler Playable SDK v0.1. Surface is fixed: `init`, `getRoot`,
|
|
|
13
13
|
|
|
14
14
|
Canonical event mapping from Smoud: `interaction -> engagement`, `finish -> complete`, `install -> cta_click (+conversion policy)`, `pause/resume/resize/volume` mapped 1:1 inside the envelope. Custom events must use `custom.<mechanic_id>.<event>`.
|
|
15
15
|
|
|
16
|
+
## Vite Configuration (Required)
|
|
17
|
+
|
|
18
|
+
When using this SDK with Vite, you **must** exclude it from dependency pre-bundling. The SDK uses code protection that is incompatible with Vite's optimization process.
|
|
19
|
+
|
|
20
|
+
Add this to your `vite.config.ts`:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
// ... your other config
|
|
25
|
+
optimizeDeps: {
|
|
26
|
+
include: ['pixi.js', 'lottie-web'],
|
|
27
|
+
exclude: ['handler-playable-sdk'] // Required!
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> ⚠️ **Important:** Without this configuration, the page may hang or fail to load. This is because Vite's pre-bundling modifies the code structure, which triggers the SDK's anti-tampering protection.
|
|
33
|
+
|
|
16
34
|
## Build
|
|
17
35
|
|
|
18
36
|
```bash
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as a,e as b}from"./chunk-V636YM4S.js";import"./chunk-Q7FPWOA3.js";export{a as AssetTextures,b as initAssetTextures};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk-RXI7YH7M.js";import"./chunk-Q7FPWOA3.js";export{c as applyConfigOverride,d as applyConfigOverrides,m as applyConfigsToDisk,e as clearConfigOverrides,f as clearConfigOverridesForObject,i as configOverrideManager,j as deepClone,k as exportConfigsAsJSON,h as getConfigOverrides,l as getConfigStateSummary,a as getOverrideMode,g as removeConfigOverride,n as resetToApplied,o as resetToOriginal,b as setOverrideMode};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as X,d as K,h as Q}from"./chunk-RXI7YH7M.js";var Y=null,d="dev";if(typeof window!="undefined"){let n=window.__BUILD_SETTINGS__;if(n!=null&&n.buildMode)Y=n,d=n.buildMode,console.log("[CONFIG] Loaded inline build settings:",n,"buildMode:",d);else try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);Y=t,d=t.buildMode||"dev",console.log("[CONFIG] Loaded build settings:",t,"buildMode:",d)}else console.log("[CONFIG] No build-settings.json found, using default buildMode:",d)}catch(e){console.log("[CONFIG] Failed to load build-settings.json:",e instanceof Error?e.message:String(e))}}console.log("[CONFIG] Final buildMode:",d);var G=new Map,L=d==="dev"||typeof window!="undefined"&&window.location.search.includes("hot-reload");function ie(n,e){try{if(typeof n=="object"&&n!==null)return n;if(typeof n!="string")return null;if(n.startsWith("data:")){let o=n.indexOf(",");if(o===-1)return null;let s=n.slice(0,o);if(!s.includes("application/json")&&!s.includes("text/plain"))return null;let i=n.slice(o+1),a=s.includes("base64")?typeof atob=="function"?atob(i):i:decodeURIComponent(i);return JSON.parse(a)}let t=n.trim();return t.startsWith("{")||t.startsWith("[")?JSON.parse(n):null}catch{return null}}function ae(n){if(typeof window=="undefined"||!window.INLINE_ASSETS)return null;let e=window.INLINE_ASSETS,t=n.replace(/^\.\/+/,""),o=t.split("/").pop()||t,s=[t,o,t.replace(/\.json$/,""),o.replace(/\.json$/,"")];for(let i of s){let a=e[i];if(a){let l=ie(a,i);if(l!==null)return l}}return null}async function A(n){if(G.has(n)&&!L)return console.log(`[CONFIG] Using cached config for: "${n}"`),G.get(n);if(console.log(`[CONFIG] loadConfigFile called with: "${n}", MODE: ${d.toUpperCase()}, CACHE: ${L?"DISABLED":"ENABLED"}`),d==="publish"){let o=ae(n);return o?(console.log(`[CONFIG] \u2713 Loaded ${n} via INLINE_ASSETS`),o):(console.log(`[CONFIG] \u2139\uFE0F Optional config ${n} not in INLINE_ASSETS, skipping fetch in publish mode`),{})}d==="brand"||console.log(`[CONFIG] DEV MODE: Trying nested paths first, then flattened for "${n}"`);let e;d==="brand"?e=[`./${n.split("/").pop()||n}`,`./${n}`,`./${n.replace(/^configs\//,"")}`,`./${n.replace(/^configs\//,"").replace(/\//g,".")}`]:e=[`./${n}`,`./${n.replace(/^configs\//,"")}`,`./${n.replace(/^configs\//,"").replace(/\//g,".")}`],e=Array.from(new Set(e.flatMap(o=>o.startsWith("./")?[o,`/${o.slice(2)}`]:o.startsWith("/")?[o]:[o,`/${o}`]))),console.log("[CONFIG] Will try candidates:",e);let t=(async()=>{let o=L?"no-store":"force-cache";for(let s of e)try{let i=await fetch(s,{cache:o});if(!i.ok)continue;let a=await i.json();return console.log(`[CONFIG] \u2713 Loaded ${n} via ${s}`,a),a}catch(i){console.warn(`[CONFIG] \u2717 Failed to load ${s} (mode: ${d}):`,i)}return console.warn(`[CONFIG] \u2717 All attempts failed for ${n}; using defaults`),{}})();return G.set(n,t),t}async function ee(){console.log("[CONFIG] Loading component schemas...");let n=["components/identity.schema.json","components/transform.schema.json","components/render.schema.json","components/motion.schema.json","components/effects.schema.json","components/interaction.schema.json","components/gameplay.rules.schema.json","components/gameplay.tuning.schema.json","components/visibility.schema.json","components/audio.schema.json","components/physics.schema.json","components/ui.schema.json"],e=new Map;for(let t of n)try{let o=d==="publish"||d==="brand"?t.split("/").pop()||t:`configs/${t}`,s=await A(o);s.component&&(e.set(s.component,s),console.log(`[CONFIG] \u2713 Schema loaded: ${s.component} ${d==="publish"||d==="brand"?"(flattened)":"(nested)"}`))}catch(o){console.warn(`[CONFIG] \u2717 Failed to load schema ${t}:`,o)}return console.log(`[CONFIG] Loaded ${e.size} component schemas`),e}async function N(n){console.log(`[CONFIG] Loading object config: ${n}`);let e=d==="publish"||d==="brand"?`${n}.json`:`configs/objects/${n}.json`;return await A(e)}async function ne(n){let e=new Map;if(n.objects&&Array.isArray(n.objects)){for(let t of n.objects)if(t.enabled&&t.object_config)try{let o=t.instance_id;/^(json\.|ui\.|effects\.|engine\.)/.test(o)||(o=`json.${o}`);let s=await N(o);(!s||Object.keys(s).length===0)&&o!==t.instance_id&&(s=await N(t.instance_id)),!s||Object.keys(s).length===0?(console.log(`[CONFIG] No instance snapshot for ${t.instance_id}, using template ${t.object_config}`),s=await N(t.object_config)):console.log(`[CONFIG] \u2713 Loaded instance snapshot for ${t.instance_id}`),e.set(t.instance_id,{...s,instance_id:t.instance_id,object_config:t.object_config})}catch(o){console.warn(`Failed to load object ${t.object_config}:`,o)}}return e}async function te(){console.log("[CONFIG] Loading engine configs...");let n=["runtime","assets","splash","loading","start","tutorial","endgame"],e=await Promise.all(n.map(o=>{let s=`engine.${o}.json`,i=d==="publish"||d==="brand"?s:`configs/engine/${s}`;return A(i)})),t=Object.fromEntries(n.map((o,s)=>[o,e[s]]));return console.log("[CONFIG] Engine configs loaded:",Object.fromEntries(n.map(o=>{var a;let s=(a=t[o])!=null?a:{},i=Object.keys(s);return[o,i.length>0?i:"empty"]}))),t}async function re(){return await A(d==="publish"||d==="brand"?"game.prompt.json":"configs/engine/game.prompt.json")}async function oe(n="scene.main"){console.log(`[CONFIG] Loading scene config: ${n}`);let e=d==="publish"||d==="brand"?`${n}.json`:`configs/scenes/${n}.json`;return await A(e)}function k(n,e){let t=[];if(!n.identity)return t.push("Missing required identity component"),{valid:!1,errors:t};let o=e.get("identity");if(o)for(let s of o.required||[])n.identity[s]||t.push(`Missing required identity field: ${s}`);for(let[s,i]of Object.entries(n)){if(s==="identity")continue;let a=e.get(s);if(a&&i&&typeof i=="object"){let l=i;for(let f of a.required||[])l[f]===void 0&&t.push(`Missing required field in ${s}: ${f}`);if(a.constraints&&typeof a.constraints=="object")for(let[f,u]of Object.entries(a.constraints)){let p=l[f];if(p!==void 0&&u&&typeof u=="object"){let b=u;typeof p=="number"&&(b.min!==void 0&&p<b.min&&t.push(`${s}.${f} value ${p} is below minimum ${b.min}`),b.max!==void 0&&p>b.max&&t.push(`${s}.${f} value ${p} is above maximum ${b.max}`))}}}}return{valid:t.length===0,errors:t}}function F(n,e){let t={...n},o=["identity","transform","render"];for(let[s,i]of e.entries())i.defaults&&Object.keys(i.defaults).length>0&&(o.includes(s)||t[s])&&(t[s]||(t[s]={}),t[s]={...i.defaults,...t[s]});return t}function C(n,e,t,o){return typeof n!="number"||!Number.isFinite(n)?e:Math.min(Math.max(n,t),o)}function Z(n,e){if(Array.isArray(n))return{x:C(n[0],e.x,-2e3,2e3),y:C(n[1],e.y,-2e3,2e3)};if(!n||typeof n!="object")return e;let{x:t,y:o}=n;return{x:C(t,e.x,-2e3,2e3),y:C(o,e.y,-2e3,2e3)}}function ce(n,e){if(Array.isArray(n))return{x:C(n[0],e.x,0,1),y:C(n[1],e.y,0,1)};if(!n||typeof n!="object")return e;let{x:t,y:o}=n;return{x:C(t,e.x,0,1),y:C(o,e.y,0,1)}}function le(n){if(Array.isArray(n))return{x:C(n[0],.5,-10,10),y:C(n[1],.5,-10,10)};if(n&&typeof n=="object"){let{x:e,y:t}=n;return{x:C(e,.5,-10,10),y:C(t,.5,-10,10)}}return typeof n=="string"?n:null}async function H(n="scene.main",e){var f,u,p,b,$,O,g,r,y,j,_,h,x,E;console.log("[CONFIG] ===== Starting Object-Centric Config Load =====");let t=await ee(),o=Q();o.length>0&&console.log(`[CONFIG] Applying ${o.length} active overrides`);let s=await oe(n);console.log(`[CONFIG] Scene config loaded: ${((f=s.objects)==null?void 0:f.length)||0} objects`);let i=await te();console.log("[CONFIG] Loading object configs...");let a=await ne(s);console.log(`[CONFIG] Loaded ${a.size} object configs:`,Array.from(a.keys()));for(let[v,I]of a.entries()){let m=F(I,t),S=k(m,t);S.valid||console.warn(`Object ${v} validation errors:`,S.errors),(u=m.transform)!=null&&u.position&&(m.transform.position=Z(m.transform.position,{x:0,y:0})),(p=m.transform)!=null&&p.offset&&(m.transform.offset=Z(m.transform.offset,{x:0,y:0})),((b=m.transform)==null?void 0:b.anchor)!==void 0&&(m.transform.anchor=le(m.transform.anchor)),(($=m.transform)==null?void 0:$.position_ratio)!==void 0&&m.transform.position_ratio!==null&&(m.transform.position_ratio=ce(m.transform.position_ratio,{x:.5,y:.5})),a.set(v,m)}if(e){if(e.objects)for(let[v,I]of e.objects.entries())a.set(v,I);e.engine&&(i.runtime={...i.runtime,...e.engine.runtime},i.assets={...i.assets,...e.engine.assets},i.splash={...(O=i.splash)!=null?O:{},...(g=e.engine.splash)!=null?g:{}})}let l={objects:a,engine:i,scene:s,schemas:t,theme:{background_color:"#ffffff",text_color:"#000000",square_color:"#cccccc",cta_background:"#007bff",cta_text:"#ffffff"},gameplay:{}};return typeof window!="undefined"&&(window.__editableConfig=l,window.__editableConfigBaseline||(window.__editableConfigBaseline=F(l,t))),o.length>0&&X()&&K(o,{silent:!0,persist:!1}),console.log("[CONFIG] ===== Object-Centric Config Load Complete ====="),console.log("[CONFIG] Summary:",{schemas:Array.from(t.keys()),objects:Array.from(a.keys()),engine:{runtime:Object.keys((r=i.runtime)!=null?r:{}),assets:Object.keys((y=i.assets)!=null?y:{}),splash:Object.keys((j=i.splash)!=null?j:{}),loading:Object.keys((_=i.loading)!=null?_:{}),start:Object.keys((h=i.start)!=null?h:{}),tutorial:Object.keys((x=i.tutorial)!=null?x:{}),endgame:Object.keys((E=i.endgame)!=null?E:{})},scene:s.scene_id||"unknown"}),l}function fe(n){var t,o,s,i,a,l,f,u,p,b,$,O,g,r,y,j,_,h,x,E,v,I,m,S,T,z,W,D,B,q,U,J,V;let e={gameplay:{},ui:{},theme:{},assets:{}};for(let[se,c]of n.objects.entries()){let w=((t=c.identity)==null?void 0:t.id)||se;w.includes("character")&&(e.gameplay.character_pos=((o=c.transform)==null?void 0:o.position)||{x:0,y:0},e.gameplay.character_scale=((s=c.transform)==null?void 0:s.scale)||1,e.gameplay.character_anim_speed=((a=(i=c.gameplay)==null?void 0:i.tuning)==null?void 0:a.anim_speed)||.003,e.gameplay.character_relief_scale=((f=(l=c.gameplay)==null?void 0:l.tuning)==null?void 0:f.relief_scale)||1.22,e.gameplay.character_relief_speed=((p=(u=c.gameplay)==null?void 0:u.tuning)==null?void 0:p.relief_speed)||.22),(w.includes("gun")||w.includes("flame"))&&(e.gameplay.gun=c.gun||{},e.gameplay.gunmuzzle=((b=c.effects)==null?void 0:b.gunmuzzle)||{},e.gameplay.muzzle_levels=(($=c.effects)==null?void 0:$.muzzle_levels)||{},e.gameplay.flame=((O=c.effects)==null?void 0:O.flame)||{}),w.includes("diamond")&&(e.gameplay.diamond=c),w.includes("ice")&&(e.gameplay.melt=c.melt||{},e.gameplay.melt_anchor=((g=c.transform)==null?void 0:g.melt_anchor)||{x:0,y:0},e.gameplay.melt_pos=((r=c.transform)==null?void 0:r.position)||{x:0,y:0},e.gameplay.hybrid_melting=((y=c.effects)==null?void 0:y.hybrid_melting)||{},e.gameplay.physics_chunks=((j=c.effects)==null?void 0:j.physics_chunks)||{},e.gameplay.melting_particles=((_=c.effects)==null?void 0:_.melting_particles)||{},e.gameplay.hard_ice=c.hard_ice||{}),w.includes("water")&&(e.gameplay.water_drops=c),w.includes("crack")&&(e.gameplay.crack=c),w.includes("hand")&&(e.gameplay.hand=((h=c.gameplay)==null?void 0:h.tuning)||{},e.gameplay.brush_start_pos=((x=c.transform)==null?void 0:x.brush_start_pos)||{x:0,y:-120},e.gameplay.hand_scale=((E=c.transform)==null?void 0:E.scale)||1.5),w.includes("hazard")&&(e.gameplay.hazard=((v=c.gameplay)==null?void 0:v.tuning)||{},e.gameplay.danger_pos=((I=c.transform)==null?void 0:I.danger_pos)||{x:0,y:235},e.gameplay.danger_pulse=((S=(m=c.gameplay)==null?void 0:m.tuning)==null?void 0:S.danger_pulse)||{},e.gameplay.hazard_height=((z=(T=c.gameplay)==null?void 0:T.tuning)==null?void 0:z.hazard_height)||140)}return e.gameplay.timeline=((W=n.engine.runtime)==null?void 0:W.timeline)||{},e.gameplay.drag_surface=((D=n.engine.runtime)==null?void 0:D.drag_surface)||{},e.gameplay.background=((B=n.engine.runtime)==null?void 0:B.background)||{},e.gameplay.ui_styles=((q=n.engine.runtime)==null?void 0:q.ui_styles)||{},e.gameplay.label_pulse=((U=n.engine.runtime)==null?void 0:U.label_pulse)||{},e.ui=((J=n.engine.runtime)==null?void 0:J.ui)||{},e.theme=((V=n.engine.runtime)==null?void 0:V.theme)||{},e.assets=n.engine.assets||{},e}var P=class{shouldFullReload(e){return e.type==="component"||e.type==="scene"}getAffectedObjects(e){return e.type==="object"&&e.objectId?[e.objectId]:[]}},M=class{constructor(e=1e3){this.pollingInterval=null;this.fileHashes=new Map;this.callbacks=new Map;this.intervalMs=e}watch(e,t){this.callbacks.set(e,t),this.pollingInterval===null&&(this.pollingInterval=window.setInterval(()=>{this.checkAllFiles()},this.intervalMs))}async checkAllFiles(){for(let[e,t]of this.callbacks.entries())try{let o=`${e}?t=${Date.now()}&r=${Math.random()}`,s=await fetch(o,{cache:"no-cache",headers:{"Cache-Control":"no-cache"}});if(s.ok){let i=await s.text(),a=this.hashString(i),l=this.fileHashes.get(e);if(l&&l!==a&&console.log(`[HOT-RELOAD] File changed: ${e}`),l&&l!==a){console.log(`[HOT-RELOAD] File changed: ${e}`);let f=this.determineEventType(e);t(f),this.fileHashes.set(e,a)}else l||this.fileHashes.set(e,a)}}catch(o){console.warn(`Failed to check ${e}:`,o)}}determineEventType(e){var t,o;return e.includes("/components/")?{type:"component",path:e,componentName:(t=e.split("/").pop())==null?void 0:t.replace(".schema.json","")}:e.includes("/engine/")?{type:"engine",path:e}:e.includes("/scenes/")?{type:"scene",path:e}:e.includes("/objects/")?{type:"object",path:e,objectId:(o=e.split("/").pop())==null?void 0:o.replace(".json","")}:{type:"object",path:e}}hashString(e){let t=0;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);t=(t<<5)-t+s,t=t&t}return t.toString()}unwatch(e){this.callbacks.delete(e),this.fileHashes.delete(e)}stop(){this.pollingInterval!==null&&(clearInterval(this.pollingInterval),this.pollingInterval=null),this.callbacks.clear(),this.fileHashes.clear()}};function de(n,e){let t=[];function o(s,i,a=""){if(s!==i){if(typeof s!=typeof i){t.push(`${a}: type changed`);return}if(typeof s=="object"&&s!==null&&i!==null){let l=new Set([...Object.keys(s),...Object.keys(i)]);for(let f of l){let u=a?`${a}.${f}`:f;f in s?f in i?o(s[f],i[f],u):t.push(`${u}: removed`):t.push(`${u}: added`)}}else t.push(`${a}: changed`)}}return o(n,e),t}function ge(n,e,t,o){let s={...t};for(let[i,a]of o.entries())s[i]&&a.defaults&&(s[i]={...a.defaults,...s[i]});return s}var R={};function ue(n){if(typeof window=="undefined")return;let e=typeof R!="undefined"&&!!R.hot,t=window.location.search.includes("hot-reload");if(!(e||t))return;let s=null,i=!1,a=null;if(t){a=new M;let g=window.__configWatcher;g!=null&&g.stop&&g.stop(),window.__configWatcher=a}let l=new Set,f=g=>{var j,_;if(!a)return;let r=new Set;r.add("configs/engine/engine.runtime.json"),r.add("configs/engine/engine.assets.json"),r.add("configs/engine/engine.splash.json"),r.add("configs/scenes/scene.main.json");let y=(_=(j=g.scene)==null?void 0:j.objects)!=null?_:[];for(let h of y)h!=null&&h.object_config&&r.add(`configs/objects/${h.object_config}.json`);for(let h of l)r.has(h)||a.unwatch(h);for(let h of r)l.has(h)||a.watch(h,x=>O(x));l=r},u=new Set,p=!1,b=async g=>{let r=await N(g),y=F(r,n.activeConfig.schemas),j=k(y,n.activeConfig.schemas);j.valid||console.warn(`[HOT-RELOAD] ${g} validation errors:`,j.errors),await n.liveEditBridge.applyObjectConfig(g,y)};async function $(g){if(!i){i=!0;try{if(p||u.size===0){n.audioSystem.destroy();let r=await H("scene.main");n.setActiveConfig(r),n.gameObjectManager.updateConfig(r),n.CustomAssets.updateConfig(r),await n.CustomAssets.ready();let y=n.createAudioSystem(r);n.setAudioSystem(y),window.__audioSystem=y,await y.start(),n.liveEditBridge.rebuildIndexes(),f(r),console.log(`[GAME] Hot-reload complete (${g})`)}else{let r=Array.from(u);u.clear();for(let y of r)await b(y);console.log(`[GAME] Hot-reload updated objects: ${r.join(", ")}`)}}catch(r){console.warn("[GAME] Hot-reload failed:",r)}finally{i=!1,p=!1,u.clear()}}}function O(g){g.type==="object"&&g.objectId?u.add(g.objectId):p=!0,s&&window.clearTimeout(s),s=window.setTimeout(()=>{$(g.type)},120)}e&&R.hot.on("config-change",()=>{O({type:"hmr"})}),t&&(f(n.activeConfig),console.log(`[GAME] Hot-reload watcher enabled (${l.size} files)`))}export{ee as a,N as b,ne as c,te as d,re as e,oe as f,k as g,F as h,H as i,fe as j,P as k,M as l,de as m,ge as n,ue as o};
|