handler-playable-sdk 1.0.102 → 1.0.103
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/dist/{chunk-EMWR536B.js → chunk-NOMTJOWU.js} +15 -5
- package/dist/cli/brand-dna.mjs +1 -1
- package/dist/cli/canva-import.mjs +1 -1
- package/dist/cli/cleanup-assets.mjs +1 -1
- package/dist/cli/fix-scales.mjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/screen-helper.mjs +1 -1
- package/dist/cli/setup-library.mjs +1 -1
- package/dist/cli/student-helper/add-logic.mjs +1 -1
- package/dist/cli/student-helper/add-object.mjs +1 -1
- package/dist/cli/student-helper/arg-parsing.mjs +1 -1
- package/dist/cli/student-helper/asset-registry.mjs +1 -1
- package/dist/cli/student-helper/bullet-system.mjs +1 -1
- package/dist/cli/student-helper/collectable-system.mjs +1 -1
- package/dist/cli/student-helper/constants.mjs +1 -1
- package/dist/cli/student-helper/drag-snap-couples.mjs +1 -1
- package/dist/cli/student-helper/endgame-screen.mjs +1 -1
- package/dist/cli/student-helper/fs-io.mjs +1 -1
- package/dist/cli/student-helper/logic-defaults.mjs +1 -1
- package/dist/cli/student-helper/print-help.mjs +1 -1
- package/dist/cli/student-helper/prompts.mjs +1 -1
- package/dist/cli/student-helper/scratch-card.mjs +1 -1
- package/dist/cli/student-helper/screen-utils.mjs +1 -1
- package/dist/cli/student-helper/snippets.mjs +1 -1
- package/dist/cli/student-helper/start-screen.mjs +1 -1
- package/dist/cli/student-helper/swerve-collect.mjs +1 -1
- package/dist/cli/student-helper/tap-destroy.mjs +1 -1
- package/dist/cli/student-helper/template-packs.mjs +1 -1
- package/dist/cli/student-helper.mjs +1 -1
- package/dist/cli/sync-screens.mjs +1 -1
- package/dist/cli/validate-assets.mjs +1 -1
- package/dist/cli/validate.mjs +1 -1
- package/dist/index.cjs +15 -5
- package/dist/index.js +1 -1
- package/dist/pixi/index.cjs +1 -1
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +10 -10
- package/dist/three/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Xt,c as an,d as Te,e as sn}from"./chunk-I5OOVR5U.js";import{i as Qt}from"./chunk-FOTLNUIS.js";import{c as qe,d as Jt,e as Ze,g as Fa,h as rn,j as Ba,k as Ga,n as st,p as Zt,q as rt,r as Ua,s as on,t as qa}from"./chunk-2MR65LDX.js";import{a as Hr}from"./chunk-JXBG6UFL.js";import{Application as al}from"pixi.js";var Ve={};function ei(o,e,t=!1){Ve[o]||(Ve[o]=[]),Ve[o].push({fn:e,once:t})}function ln(o,e){if(Ve[o]){if(!e){delete Ve[o];return}Ve[o]=Ve[o].filter(t=>t.fn!==e)}}function ti(o,...e){let t=Ve[o];if(t)for(let i of[...t])i.fn(...e),i.once&&ln(o,i.fn)}function be(o,e){ei(o,e,!0)}var re=null,xe=[],ot=null;function Wa(o){re=o,xe=[],ot!==null&&(clearTimeout(ot),ot=null)}function Ka(){var o,e,t;return{endpoint:(re==null?void 0:re.endpoint)||"",transport:(re==null?void 0:re.transport)||"beacon",batchSize:(o=re==null?void 0:re.batchSize)!=null?o:10,flushIntervalMs:(e=re==null?void 0:re.flushIntervalMs)!=null?e:300,maxQueue:(t=re==null?void 0:re.maxQueue)!=null?t:200,debug:!!(re!=null&&re.debug)}}async function Va(o,e,t,i){let n=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(o,new Blob([n],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",a,e);return}catch(a){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(a){i&&console.warn("[handler.telemetry] fetch failed",a)}}function cn(o,e){let t=Ka();if(e&&t.endpoint){if(xe.push(o),xe.length>t.maxQueue&&(xe=xe.slice(xe.length-t.maxQueue)),xe.length>=t.batchSize){Ya();return}ot===null&&(ot=window.setTimeout(()=>{ot=null,Ya()},t.flushIntervalMs))}}async function Ya(){let o=Ka();if(!o.endpoint||xe.length===0)return;let e=xe.splice(0,o.batchSize);await Va(o.endpoint,{events:e},o.transport,o.debug),xe.length>0&&await Va(o.endpoint,{events:xe.splice(0,o.batchSize)},o.transport,o.debug)}function Xa(o){return Math.max(0,Math.min(1,o))}function Nr(o){let e=String(o!=null?o:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return n=>1+(i+1)*Math.pow(n-1,3)+i*Math.pow(n-1,2)}return t=>1-(1-t)*(1-t)}function Pt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Fr(o,e){let t=o==null?void 0:o[e];return typeof t=="number"?t:0}function Ja(o,e,t){try{o[e]=t}catch{}}function Br(o){let e=o==null?void 0:o.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function Za(o,e){let t=o==null?void 0:o.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function Qa(o,e){let t=Br(o);if(!t)return{from:null,to:null};let i=null,n=null;return typeof e.scale=="number"?(i=e.scale,n=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(n=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(n=e.scaleY),i===null&&n===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:n!=null?n:t.y}}}function es(){let o=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,r(),o.size>0&&i()})},n=d=>{var u;o.add(d);let p=(u=e.get(d.target))!=null?u:new Set;p.add(d),e.set(d.target,p),i()},a=d=>{o.delete(d);let p=e.get(d.target);p&&(p.delete(d),p.size===0&&e.delete(d.target))},s=d=>{d.killed||(d.killed=!0,a(d))},r=()=>{var p,u;let d=Pt();for(let g of Array.from(o)){if(g.killed||g.paused)continue;let h=d-g.startMs-g.delayMs;if(h<0)continue;let m=g.durationMs>0?h/g.durationMs:1,f=Xa(m),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(m),b-1):0;if(g.repeat>0&&m>=1){let T=m-y;f=Xa(T)}let w=g.ease(f);g.yoyo&&y%2===1&&(w=1-w);for(let T of g.props)Ja(g.target,T.key,T.from+(T.to-T.from)*w);g.scaleFrom&&g.scaleTo&&Za(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*w,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*w});try{(p=g.onUpdate)==null||p.call(g)}catch{}if(m>=b){s(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(d,p,u)=>{var T;let g=Math.max(0,(typeof p.duration=="number"?p.duration:.5)*1e3),h=Math.max(0,(typeof p.delay=="number"?p.delay:0)*1e3+((T=u==null?void 0:u.delayMsOverride)!=null?T:0)),m=Nr(p.ease),f=typeof p.repeat=="number"?Math.max(0,p.repeat|0):0,b=p.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),w=[];for(let P of Object.keys(p)){if(y.has(P))continue;let _=p[P];typeof _=="number"&&w.push({key:P,from:Fr(d,P),to:_})}let v=Qa(d,p);return{target:d,startMs:Pt(),delayMs:h,durationMs:g,ease:m,props:w,scaleFrom:v.from,scaleTo:v.to,repeat:f,yoyo:b,onUpdate:typeof p.onUpdate=="function"?p.onUpdate:void 0,onComplete:typeof p.onComplete=="function"?p.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,p){let u=l(d,p);return n(u),{kill:()=>s(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=Pt())},resume:()=>{var m;if(!u.paused)return;let g=(m=u.pauseAtMs)!=null?m:Pt(),h=Pt()-g;u.startMs+=h,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(d,p,u){return c.set(d,p),c.to(d,u)},set(d,p){if(!d||!p)return;for(let g of Object.keys(p)){let h=p[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof h=="number"&&Ja(d,g,h)}let u=Qa(d,p);u.to&&Za(d,u.to)},killTweensOf(d){let p=e.get(d);if(p)for(let u of Array.from(p))s(u)},timeline(d={}){let p=[],u=0,g=!1,h=[],m=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let w=typeof y=="string"?y.trim():"";return w.startsWith("+=")?u+Math.max(0,Number(w.slice(2))*1e3||0):w?Math.max(0,Number(w)*1e3||0):u},f=y=>{p.push(y);let w=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+w)},b={to(y,w,v){return f({kind:"to",target:y,vars:w,atMs:m(v)}),b},fromTo(y,w,v,T){return f({kind:"fromTo",target:y,vars:v,from:w,atMs:m(T)}),b},play(){var y,w;if(g)return b;g=!0,h=[];for(let v of p)v.kind==="fromTo"&&c.set(v.target,(y=v.from)!=null?y:{}),h.push(c.to(v.target,{...v.vars,delay:v.atMs/1e3+((w=v.vars.delay)!=null?w:0)}));return b},pause(){for(let y of h)y.pause();return b},kill(){for(let y of h)y.kill();h=[],g=!1}};return d.paused||b.play(),b}};return c}function ts(){if(typeof window=="undefined")return;let o=window;if(!o.gsap)try{o.gsap=es()}catch{}}var is={name:"handler-playable-sdk",version:"1.0.102",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && mkdir -p dist/cli/student-helper && cp src/cli/student-helper/*.mjs dist/cli/student-helper/ && chmod +x dist/cli/*.mjs dist/cli/student-helper/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs dist/cli/student-helper/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var ye=0,Ur=ye++,ns=ye++,as=ye++,ss=ye++,rs=ye++,os=ye++,ls=ye++,cs=ye++,ds=ye++,ps=ye++,us=ye++,gs=ye++,ne=Ur;function hs(){return ne===ns}function ms(){return ne===as}function fs(){return ne===ss}function bs(){return ne===rs}function lt(){return ne===os}function ct(){return ne===ls}function ys(){return ne===cs}function vs(){return ne===ds}function ws(){return ne===ps}function dn(){return ne===us}function pn(){return ne===gs}function xs(){let o=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(o==="mraid")try{mraid.getState(),ne=ns;return}catch{}else if(o==="dapi")try{dapi.isReady(),ne=as;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(ne=ss)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(ne=rs)}catch{}else if(e==="mintegral")window.gameReady&&(ne=os);else if(e==="tapjoy")window.TJ_API&&(ne=ls);else if(e==="tiktok")window.openAppStore&&(ne=cs);else if(e==="smadex")try{window.smxTracking&&(ne=ds)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(ne=ps)}catch{}else e==="vungle"?ne=us:(o==="nucleo"||e==="nucleo")&&(ne=gs)}import un from"lottie-web";var Ss=un;typeof window!="undefined"&&(window.lottie=un,window.__baseLottie=un);function oe(o,e){let t=(n,a)=>a===0?n:t(a,n%a),i=t(o,e);return`${o/i}:${e/i}`}var jl=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:oe(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:oe(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:oe(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:oe(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:oe(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:oe(360,780)}],_l=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:oe(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:oe(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:oe(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:oe(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:oe(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:oe(412,915)}],Rl=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:oe(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:oe(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:oe(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:oe(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:oe(800,1280)}],gn=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:oe(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:oe(768,1024),mraidScale:.7}];var Es=[...gn],As=[{category:"playable",label:"Playable Ad",devices:gn}],hn=gn[0];function dt(o){return Es.find(e=>e.id===o)||hn}function Ol(o){return Es.filter(e=>e.category===o)}var Pe=class{async updateProperty(e,t,i,n={}){var l,c,d,p,u,g,h,m,f,b,y,w;console.log("[PropertyUpdateManager] Updating:",e,t,i);let a=window.getEditableObjectConfig;if(typeof a!="function"){console.error("[PropertyUpdateManager] getEditableObjectConfig not available");return}let s=a(e);if(!s){console.error("[PropertyUpdateManager] Config not found for:",e);return}if(qe({objectId:e,path:t,value:i},{persist:!0}),t==="transform"||t.startsWith("transform.")){console.log("[DEBUG FALLBACK] PropertyUpdateManager SKIP applyEditableObjectConfig (transform path)",t,e);let v=s==null?void 0:s.motion;if(v&&typeof v=="object"&&v.enabled!==!1&&(((p=v==null?void 0:v.intro)==null?void 0:p.enabled)===!0||((u=v==null?void 0:v.pulse)==null?void 0:u.enabled)===!0||((g=v==null?void 0:v.swing)==null?void 0:g.enabled)===!0||((h=v==null?void 0:v.continuousMove)==null?void 0:h.enabled)===!0||((m=v==null?void 0:v.continuousRotate)==null?void 0:m.enabled)===!0||((f=v==null?void 0:v.orbit)==null?void 0:f.enabled)===!0)){let _=window.applyEditableObjectConfig;if(typeof _=="function"){let I=window.__editableConfig,j=(w=(y=(b=I==null?void 0:I.objects)==null?void 0:b.get)==null?void 0:y.call(b,e))!=null?w:s;await _(e,j),console.log("[PropertyUpdateManager] Applied config for motion object")}}n.refreshInspector||requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("config:changed",{detail:{objectId:e}}))})}else{let v=window.applyEditableObjectConfig;if(typeof v=="function"){let T=window.__editableConfig,P=(d=(c=(l=T==null?void 0:T.objects)==null?void 0:l.get)==null?void 0:c.call(l,e))!=null?d:s;await v(e,P),console.log("[PropertyUpdateManager] Applied config successfully")}else console.warn("[PropertyUpdateManager] applyEditableObjectConfig not available")}this.triggerRefresh(e),n.refreshInspector&&window.dispatchEvent(new CustomEvent("inspector:refresh"))}getNestedProperty(e,t){let i=t.split("."),n=e;for(let a of i)if(n&&typeof n=="object"&&a in n)n=n[a];else return;return n}triggerRefresh(e){let t=window.__refreshHierarchy;typeof t=="function"&&t(),window.dispatchEvent(new CustomEvent("inspector:property-updated",{detail:{objectId:e}}))}};function mn(o){let e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=async t=>{var a;let i=(a=t.target.files)==null?void 0:a[0];if(!i)return;let n=new FileReader;n.onload=async()=>{var g,h,m,f;let s=n.result;if(!s||typeof s!="string"){alert("Failed to read file: Invalid data URL"),console.error("[QuickActionsBar] Invalid data URL:",typeof s,s==null?void 0:s.substring(0,50));return}if(!s.startsWith("data:image/")){alert("Invalid file format: Not an image file"),console.error("[QuickActionsBar] Invalid data URL format:",s.substring(0,100));return}let r=s.match(/^data:image\/[^;]+;base64,(.+)$/);if(!r||!r[1]||r[1].length===0){alert("Failed to read file: Invalid base64 data"),console.error("[QuickActionsBar] Invalid base64 data in data URL");return}try{let b=r[1],y=atob(b.substring(0,Math.min(100,b.length)));if(!y||y.length===0)throw new Error("Base64 decode test failed");console.log("[QuickActionsBar] \u2705 Data URL validated, length:",s.length)}catch(b){alert("Failed to read file: Corrupted image data"),console.error("[QuickActionsBar] Base64 validation failed:",b);return}let l=o.category||"misc",c=(o.objectId||"new_asset").replace(/^json\./,"").replace(/[^a-zA-Z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),d=((g=i.name.toLowerCase().match(/\.(png|jpg|jpeg|gif|webp)$/))==null?void 0:g[1])||"png",p=d==="jpg"?"jpeg":d,u=`${c||"new_asset"}_uploaded_${Date.now()}.${p}`;console.log("[QuickActionsBar] Uploading file:",u,"to category:",l,"data URL length:",s.length);try{let y=await(await fetch("/api/library/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:l,filename:u,data:s,overwrite:!0})})).json();if(!(y!=null&&y.success)){alert(`Upload failed: ${(y==null?void 0:y.error)||"Unknown error"}`);return}await new Promise(S=>setTimeout(S,100));let w=window.addAssetToRegistry;typeof w=="function"&&(w(l,u),console.log("[QuickActionsBar] \u2705 Added to registry:",l,u));let v=window.getEditableAssets;if(typeof v=="function"){let S=v();S&&!S.categories&&(S.categories=[]),S!=null&&S.categories&&!S.categories.includes(l)&&(S.categories.push(l),console.log(`[QuickActionsBar] Added category ${l} to registry`))}let T=!1,P=0,_=10;for(;!T&&P<_;){P++,console.log(`[QuickActionsBar] Refresh attempt ${P}/${_}...`);try{(await fetch("/api/setup-library",{method:"POST",headers:{"Content-Type":"application/json"}})).ok&&console.log("[QuickActionsBar] \u2705 Registry rebuilt from disk")}catch{}await new Promise(A=>setTimeout(A,300));let S=window.refreshAssetLibrary;typeof S=="function"&&(console.log("[QuickActionsBar] Refreshing library panel..."),await S());let x=window.reRenderAssetLibrary;typeof x=="function"&&(console.log("[QuickActionsBar] Re-rendering library panel..."),x());let E=window.getEditableAssets;if(typeof E=="function"){let A=E(),C=((h=A==null?void 0:A.libraryAssets)==null?void 0:h[l])||[];C.some(R=>(R==null?void 0:R.filename)===u)?(console.log("[QuickActionsBar] \u2705 Asset found in registry!"),T=!0):(console.log(`[QuickActionsBar] Asset not found yet, retrying... (found ${C.length} assets in ${l})`),await new Promise(R=>setTimeout(R,500)))}else P>=2&&(T=!0)}T||console.warn("[QuickActionsBar] \u26A0\uFE0F Asset not found in registry after retries, proceeding anyway..."),setTimeout(()=>{try{window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"batch"}})),console.log("[QuickActionsBar] Dispatched config:changed event")}catch(S){console.warn("[QuickActionsBar] Failed to refresh textures:",S)}},300),console.log("[QuickActionsBar] Applying asset to object:",y.path);let I=!1,j=0,L=5;for(;!I&&j<L;){j++;try{await o.onApply(y.path),await new Promise(x=>setTimeout(x,200));let S=window.getEditableObjectConfig;if(typeof S=="function"){let x=S(o.objectId),E=((f=(m=x==null?void 0:x.render)==null?void 0:m.asset)==null?void 0:f.path)||"";E===y.path||E.includes(u)?(console.log("[QuickActionsBar] \u2705 Asset confirmed applied to object"),I=!0):(console.log(`[QuickActionsBar] Asset not applied yet (attempt ${j}), retrying...`),await new Promise(A=>setTimeout(A,300)))}else I=!0}catch(S){console.error(`[QuickActionsBar] Apply attempt ${j} failed:`,S),j<L&&await new Promise(x=>setTimeout(x,500))}}I?console.log("[QuickActionsBar] \u2705 Asset upload and apply complete!"):console.warn("[QuickActionsBar] \u26A0\uFE0F Asset may not have been applied, but upload succeeded")}catch(b){console.error("[QuickActionsBar] Upload error:",b),alert("Upload failed. Check console.")}},n.readAsDataURL(i)},e.click()}var ii=class{constructor(){this.updateManager=new Pe}async handleAction(e,t,i){console.log("[QuickActionsBar] Action:",e,t,i);let n=window.getEditableObjectConfig;if(typeof n!="function")return;let a=n(t);if(!a)return;let s=this.updateManager.getNestedProperty(a,i);if(e==="ai-convert"||e==="upload"||e==="library"){let r=i==="ui.text"||i==="render.asset.path",l=i==="render.asset.path";r&&(await this.prepareForImageConversion(t,a),e==="ai-convert"&&i!=="render.asset.path"&&(i="render.asset.path"))}switch(e){case"library":this.openLibrary(t,i,s);break;case"ai-edit":this.openAIEditor(t,i,s);break;case"upload":this.openUpload(t,i);break;case"reset":await this.resetToDefault(t,i);break;case"ai-convert":this.handleAiConvert(t,i,s);break;default:console.warn("[QuickActionsBar] Unknown action:",e)}}async prepareForImageConversion(e,t){var i,n;if(console.log("[QuickActionsBar] Preparing for image conversion:",e),t.render||(t.render={alpha:1,visible:!0}),(t.render.alpha===0||t.render.alpha===void 0)&&(t.render.alpha=1,await this.updateManager.updateProperty(e,"render.alpha",1)),(t.render.visible===!1||t.render.visible===void 0)&&(t.render.visible=!0,await this.updateManager.updateProperty(e,"render.visible",!0)),t.render.asset||(t.render.asset={type:"image",path:""}),t.render.asset.type!=="image"&&(t.render.asset.type="image",await this.updateManager.updateProperty(e,"render.asset",{type:"image",path:t.render.asset.path||""})),t.ui&&t.ui.renderMode!=="png"){await this.updateManager.updateProperty(e,"ui.renderMode","png",{refreshInspector:!0}),await this.updateManager.updateProperty(e,"render.tint","#ffffff");let s=((n=(i=t.transform)==null?void 0:i.scale)!=null?n:1)*.3;await this.updateManager.updateProperty(e,"transform.scale",s),console.log("[QuickActionsBar] Text to PNG conversion: set tint white, scale",s)}this.ensureSlotInRegistry(e,t)}ensureSlotInRegistry(e,t){var r,l,c;let i=window.getEditableAssets;if(typeof i!="function")return;let n=i();if(!n||!n.slots)return;let a=e.startsWith("json.")?e.replace("json.",""):e;if(!n.slots.some(d=>d.objectId===a||d.slotId===a)){let d=((r=t.identity)==null?void 0:r.category)||"ui";console.log("[QuickActionsBar] Adding new slot to registry for converted object:",a),n.slots.push({slotId:a,displayName:a.replace(/_/g," "),objectId:a,category:d,currentAsset:((c=(l=t.render)==null?void 0:l.asset)==null?void 0:c.path)||"",defaultAsset:"",libraryFolder:d,assetType:"image"}),n.categories&&!n.categories.includes(d)&&n.categories.push(d),n.libraryAssets&&!n.libraryAssets[d]&&(n.libraryAssets[d]=[]);let p=window.reRenderAssetLibrary;typeof p=="function"&&p()}}openLibrary(e,t,i){var a;let n=window.__debugContext;if(n){if(n.activeTab!=="library"){n.activeTab="library";let s=window.__updateWorkbenchTabs;typeof s=="function"&&s()}if(n.libraryPanel){let s=window.getEditableObjectConfig,r=s==null?void 0:s(e),l=(a=r==null?void 0:r.identity)==null?void 0:a.category;l||(l=t.split(".")[0]==="render"?"environment":"ui"),console.log("[QuickActionsBar] Highlighting library slot:",e,"category:",l),n.libraryPanel.highlightSlot(e,l)}}}openAIEditor(e,t,i){let n=window.__openAiEditor;if(typeof n=="function"){let a=t.split(".").pop()||t;n(a,`Edit ${a} for ${e}`,i,{objectId:e,path:t})}else console.warn("[QuickActionsBar] AI Editor not available")}openUpload(e,t){var s;let i=window.getEditableObjectConfig,n=i==null?void 0:i(e),a=((s=n==null?void 0:n.identity)==null?void 0:s.category)||(t.split(".")[0]==="render"?"environment":"ui");mn({objectId:e,category:a,onApply:async r=>{var g,h;console.log("[QuickActionsBar] Upload complete, applying asset:",r);let l=window.applyAssetToSlot,c=this.getFilenameFromPath(r),d=/render\.asset\.path/i.test(t)||/\.(png|jpg|jpeg|gif|webp)$/i.test(r);if(typeof l=="function"&&c&&d){console.log("[QuickActionsBar] Applying asset to slot:",e,c,a);try{await l(e,c,a),console.log("[QuickActionsBar] \u2705 Asset applied to slot")}catch(m){console.error("[QuickActionsBar] Failed to apply asset to slot:",m)}}console.log("[QuickActionsBar] Updating property:",e,t,r);try{await this.updateManager.updateProperty(e,t,r),console.log("[QuickActionsBar] \u2705 Property updated")}catch(m){console.error("[QuickActionsBar] Failed to update property:",m)}let p=window.__debugContext;(h=(g=p==null?void 0:p.options)==null?void 0:g.onPropertyChange)==null||h.call(g,e,t,r);let u=window.__highlightLibrarySlot;typeof u=="function"&&setTimeout(()=>{u(e,a)},1e3),window.dispatchEvent(new CustomEvent("inspector:refresh")),window.dispatchEvent(new CustomEvent("config:changed",{detail:{objectId:e,action:"update",path:t}})),console.log("[QuickActionsBar] \u2705 Upload and apply complete")}})}getFilenameFromPath(e){if(!e)return"";let t=e.split("?")[0].replace(/\\/g,"/");return t.split("/").pop()||t}async resetToDefault(e,t){console.log("[QuickActionsBar] Reset to default:",e,t);try{let i=await this.getDefaultValue(e,t);i!==void 0?(await this.updateManager.updateProperty(e,t,i),console.log("[QuickActionsBar] Reset to default value:",i)):alert("No default value found for this property.")}catch(i){console.error("[QuickActionsBar] Failed to reset to default:",i),alert("Failed to reset property. Check console for details.")}}async getDefaultValue(e,t){let i=t.split(".");if(i.length<2)return;let n=i[0],a=i.slice(1),s=window.__editableConfig;if(!(s!=null&&s.schemas))return;let r=null;if(s.schemas instanceof Map?r=s.schemas.get(n):typeof s.schemas=="object"&&(r=s.schemas[n]),!(r!=null&&r.defaults))return;let l=r.defaults;for(let c of a)if(l&&typeof l=="object")l=l[c];else return;return l}handleAiConvert(e,t,i){let n=window.__openAiEditor;if(typeof n=="function"){let s=`A single, high-quality, high-detail game UI icon/asset representing "${String(i||e.replace(/_/g," ").replace("json.",""))}". Modern stylized 3D rendered style, vibrant colors, soft lighting, isolated on solid magenta background, highly polished professional game art.`,r="render.asset.path";console.log("[QuickActionsBar] AI Convert for:",e,"from:",t,"to:",r),n(e,s,"",{objectId:e,path:r});let l=window.__debugContext;if(l){l.activeTab="ai";let c=window.__updateWorkbenchTabs;typeof c=="function"&&c()}}else console.warn("[QuickActionsBar] AI Editor not available")}};var qr=[{value:"loading",label:"Loading"},{value:"start",label:"Start"},{value:"gameplay",label:"Gameplay"},{value:"tutorial",label:"Tutorial"},{value:"endgame",label:"Endgame"}],Vr=["environment","ui","character","system","backgrounds"],Yr=["bg","world","ui"],Cs={SwerveMove:{speed:5,sensitivity:1,directionMode:"dominantAxis",axis:"both",bounds:{left:-400,right:400,top:-300,bottom:300}},DragToWin:{targetId:"",successDistance:80},DragSnap:{snapTargetId:"",snapDistance:40},JoystickMove:{speed:6,bounds:{left:-400,right:400,top:-300,bottom:300}}},ni=class{constructor(){this.modal=null;this.state=null}open(e){this.state=this.createInitialState(e),this.createModal(),document.body.appendChild(this.modal),this.attachEventListeners(),this.updateStepUI()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),window.__wizardAssetPicker=null,this.modal=null,this.state=null}createInitialState(e){return{step:1,objectType:"sprite",instanceId:"",displayName:"",category:"environment",screenId:e.screenId,layer:"world",positionMode:"static",anchorPreset:"center",anchorX:.5,anchorY:.5,positionX:0,positionY:0,offsetX:0,offsetY:0,scale:.2,rotation:0,zIndex:0,assetPath:"",tint:"",alpha:1,text:"",font:"brand.primary",fontSize:18,letterSpacing:0,align:"center",graphicsWidth:200,graphicsHeight:200,graphicsFill:"#FFFFFF",graphicsAlpha:1,interactionEnabled:!1,dragEnabled:!1,hoverEnabled:!1,clickEnabled:!1,logicId:"",logicPropsRaw:""}}createModal(){let e=document.createElement("div");e.className="wizard-modal",e.innerHTML=`
|
|
1
|
+
import{a as Xt,c as an,d as Te,e as sn}from"./chunk-I5OOVR5U.js";import{i as Qt}from"./chunk-FOTLNUIS.js";import{c as qe,d as Jt,e as Ze,g as Fa,h as rn,j as Ba,k as Ga,n as st,p as Zt,q as rt,r as Ua,s as on,t as qa}from"./chunk-2MR65LDX.js";import{a as Hr}from"./chunk-JXBG6UFL.js";import{Application as al}from"pixi.js";var Ve={};function ei(o,e,t=!1){Ve[o]||(Ve[o]=[]),Ve[o].push({fn:e,once:t})}function ln(o,e){if(Ve[o]){if(!e){delete Ve[o];return}Ve[o]=Ve[o].filter(t=>t.fn!==e)}}function ti(o,...e){let t=Ve[o];if(t)for(let i of[...t])i.fn(...e),i.once&&ln(o,i.fn)}function be(o,e){ei(o,e,!0)}var re=null,xe=[],ot=null;function Wa(o){re=o,xe=[],ot!==null&&(clearTimeout(ot),ot=null)}function Ka(){var o,e,t;return{endpoint:(re==null?void 0:re.endpoint)||"",transport:(re==null?void 0:re.transport)||"beacon",batchSize:(o=re==null?void 0:re.batchSize)!=null?o:10,flushIntervalMs:(e=re==null?void 0:re.flushIntervalMs)!=null?e:300,maxQueue:(t=re==null?void 0:re.maxQueue)!=null?t:200,debug:!!(re!=null&&re.debug)}}async function Va(o,e,t,i){let n=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(o,new Blob([n],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",a,e);return}catch(a){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(a){i&&console.warn("[handler.telemetry] fetch failed",a)}}function cn(o,e){let t=Ka();if(e&&t.endpoint){if(xe.push(o),xe.length>t.maxQueue&&(xe=xe.slice(xe.length-t.maxQueue)),xe.length>=t.batchSize){Ya();return}ot===null&&(ot=window.setTimeout(()=>{ot=null,Ya()},t.flushIntervalMs))}}async function Ya(){let o=Ka();if(!o.endpoint||xe.length===0)return;let e=xe.splice(0,o.batchSize);await Va(o.endpoint,{events:e},o.transport,o.debug),xe.length>0&&await Va(o.endpoint,{events:xe.splice(0,o.batchSize)},o.transport,o.debug)}function Xa(o){return Math.max(0,Math.min(1,o))}function Nr(o){let e=String(o!=null?o:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return n=>1+(i+1)*Math.pow(n-1,3)+i*Math.pow(n-1,2)}return t=>1-(1-t)*(1-t)}function Pt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Fr(o,e){let t=o==null?void 0:o[e];return typeof t=="number"?t:0}function Ja(o,e,t){try{o[e]=t}catch{}}function Br(o){let e=o==null?void 0:o.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function Za(o,e){let t=o==null?void 0:o.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function Qa(o,e){let t=Br(o);if(!t)return{from:null,to:null};let i=null,n=null;return typeof e.scale=="number"?(i=e.scale,n=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(n=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(n=e.scaleY),i===null&&n===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:n!=null?n:t.y}}}function es(){let o=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,r(),o.size>0&&i()})},n=d=>{var u;o.add(d);let p=(u=e.get(d.target))!=null?u:new Set;p.add(d),e.set(d.target,p),i()},a=d=>{o.delete(d);let p=e.get(d.target);p&&(p.delete(d),p.size===0&&e.delete(d.target))},s=d=>{d.killed||(d.killed=!0,a(d))},r=()=>{var p,u;let d=Pt();for(let g of Array.from(o)){if(g.killed||g.paused)continue;let h=d-g.startMs-g.delayMs;if(h<0)continue;let m=g.durationMs>0?h/g.durationMs:1,f=Xa(m),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(m),b-1):0;if(g.repeat>0&&m>=1){let T=m-y;f=Xa(T)}let w=g.ease(f);g.yoyo&&y%2===1&&(w=1-w);for(let T of g.props)Ja(g.target,T.key,T.from+(T.to-T.from)*w);g.scaleFrom&&g.scaleTo&&Za(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*w,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*w});try{(p=g.onUpdate)==null||p.call(g)}catch{}if(m>=b){s(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(d,p,u)=>{var T;let g=Math.max(0,(typeof p.duration=="number"?p.duration:.5)*1e3),h=Math.max(0,(typeof p.delay=="number"?p.delay:0)*1e3+((T=u==null?void 0:u.delayMsOverride)!=null?T:0)),m=Nr(p.ease),f=typeof p.repeat=="number"?Math.max(0,p.repeat|0):0,b=p.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),w=[];for(let P of Object.keys(p)){if(y.has(P))continue;let _=p[P];typeof _=="number"&&w.push({key:P,from:Fr(d,P),to:_})}let v=Qa(d,p);return{target:d,startMs:Pt(),delayMs:h,durationMs:g,ease:m,props:w,scaleFrom:v.from,scaleTo:v.to,repeat:f,yoyo:b,onUpdate:typeof p.onUpdate=="function"?p.onUpdate:void 0,onComplete:typeof p.onComplete=="function"?p.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,p){let u=l(d,p);return n(u),{kill:()=>s(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=Pt())},resume:()=>{var m;if(!u.paused)return;let g=(m=u.pauseAtMs)!=null?m:Pt(),h=Pt()-g;u.startMs+=h,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(d,p,u){return c.set(d,p),c.to(d,u)},set(d,p){if(!d||!p)return;for(let g of Object.keys(p)){let h=p[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof h=="number"&&Ja(d,g,h)}let u=Qa(d,p);u.to&&Za(d,u.to)},killTweensOf(d){let p=e.get(d);if(p)for(let u of Array.from(p))s(u)},timeline(d={}){let p=[],u=0,g=!1,h=[],m=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let w=typeof y=="string"?y.trim():"";return w.startsWith("+=")?u+Math.max(0,Number(w.slice(2))*1e3||0):w?Math.max(0,Number(w)*1e3||0):u},f=y=>{p.push(y);let w=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+w)},b={to(y,w,v){return f({kind:"to",target:y,vars:w,atMs:m(v)}),b},fromTo(y,w,v,T){return f({kind:"fromTo",target:y,vars:v,from:w,atMs:m(T)}),b},play(){var y,w;if(g)return b;g=!0,h=[];for(let v of p)v.kind==="fromTo"&&c.set(v.target,(y=v.from)!=null?y:{}),h.push(c.to(v.target,{...v.vars,delay:v.atMs/1e3+((w=v.vars.delay)!=null?w:0)}));return b},pause(){for(let y of h)y.pause();return b},kill(){for(let y of h)y.kill();h=[],g=!1}};return d.paused||b.play(),b}};return c}function ts(){if(typeof window=="undefined")return;let o=window;if(!o.gsap)try{o.gsap=es()}catch{}}var is={name:"handler-playable-sdk",version:"1.0.103",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && mkdir -p dist/cli/student-helper && cp src/cli/student-helper/*.mjs dist/cli/student-helper/ && chmod +x dist/cli/*.mjs dist/cli/student-helper/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs dist/cli/student-helper/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var ye=0,Ur=ye++,ns=ye++,as=ye++,ss=ye++,rs=ye++,os=ye++,ls=ye++,cs=ye++,ds=ye++,ps=ye++,us=ye++,gs=ye++,ne=Ur;function hs(){return ne===ns}function ms(){return ne===as}function fs(){return ne===ss}function bs(){return ne===rs}function lt(){return ne===os}function ct(){return ne===ls}function ys(){return ne===cs}function vs(){return ne===ds}function ws(){return ne===ps}function dn(){return ne===us}function pn(){return ne===gs}function xs(){let o=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(o==="mraid")try{mraid.getState(),ne=ns;return}catch{}else if(o==="dapi")try{dapi.isReady(),ne=as;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(ne=ss)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(ne=rs)}catch{}else if(e==="mintegral")window.gameReady&&(ne=os);else if(e==="tapjoy")window.TJ_API&&(ne=ls);else if(e==="tiktok")window.openAppStore&&(ne=cs);else if(e==="smadex")try{window.smxTracking&&(ne=ds)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(ne=ps)}catch{}else e==="vungle"?ne=us:(o==="nucleo"||e==="nucleo")&&(ne=gs)}import un from"lottie-web";var Ss=un;typeof window!="undefined"&&(window.lottie=un,window.__baseLottie=un);function oe(o,e){let t=(n,a)=>a===0?n:t(a,n%a),i=t(o,e);return`${o/i}:${e/i}`}var jl=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:oe(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:oe(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:oe(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:oe(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:oe(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:oe(360,780)}],_l=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:oe(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:oe(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:oe(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:oe(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:oe(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:oe(412,915)}],Rl=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:oe(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:oe(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:oe(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:oe(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:oe(800,1280)}],gn=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:oe(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:oe(768,1024),mraidScale:.7}];var Es=[...gn],As=[{category:"playable",label:"Playable Ad",devices:gn}],hn=gn[0];function dt(o){return Es.find(e=>e.id===o)||hn}function Ol(o){return Es.filter(e=>e.category===o)}var Pe=class{async updateProperty(e,t,i,n={}){var l,c,d,p,u,g,h,m,f,b,y,w;console.log("[PropertyUpdateManager] Updating:",e,t,i);let a=window.getEditableObjectConfig;if(typeof a!="function"){console.error("[PropertyUpdateManager] getEditableObjectConfig not available");return}let s=a(e);if(!s){console.error("[PropertyUpdateManager] Config not found for:",e);return}if(qe({objectId:e,path:t,value:i},{persist:!0}),t==="transform"||t.startsWith("transform.")){console.log("[DEBUG FALLBACK] PropertyUpdateManager SKIP applyEditableObjectConfig (transform path)",t,e);let v=s==null?void 0:s.motion;if(v&&typeof v=="object"&&v.enabled!==!1&&(((p=v==null?void 0:v.intro)==null?void 0:p.enabled)===!0||((u=v==null?void 0:v.pulse)==null?void 0:u.enabled)===!0||((g=v==null?void 0:v.swing)==null?void 0:g.enabled)===!0||((h=v==null?void 0:v.continuousMove)==null?void 0:h.enabled)===!0||((m=v==null?void 0:v.continuousRotate)==null?void 0:m.enabled)===!0||((f=v==null?void 0:v.orbit)==null?void 0:f.enabled)===!0)){let _=window.applyEditableObjectConfig;if(typeof _=="function"){let I=window.__editableConfig,j=(w=(y=(b=I==null?void 0:I.objects)==null?void 0:b.get)==null?void 0:y.call(b,e))!=null?w:s;await _(e,j),console.log("[PropertyUpdateManager] Applied config for motion object")}}n.refreshInspector||requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("config:changed",{detail:{objectId:e}}))})}else{let v=window.applyEditableObjectConfig;if(typeof v=="function"){let T=window.__editableConfig,P=(d=(c=(l=T==null?void 0:T.objects)==null?void 0:l.get)==null?void 0:c.call(l,e))!=null?d:s;await v(e,P),console.log("[PropertyUpdateManager] Applied config successfully")}else console.warn("[PropertyUpdateManager] applyEditableObjectConfig not available")}this.triggerRefresh(e),n.refreshInspector&&window.dispatchEvent(new CustomEvent("inspector:refresh"))}getNestedProperty(e,t){let i=t.split("."),n=e;for(let a of i)if(n&&typeof n=="object"&&a in n)n=n[a];else return;return n}triggerRefresh(e){let t=window.__refreshHierarchy;typeof t=="function"&&t(),window.dispatchEvent(new CustomEvent("inspector:property-updated",{detail:{objectId:e}}))}};function mn(o){let e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=async t=>{var a;let i=(a=t.target.files)==null?void 0:a[0];if(!i)return;let n=new FileReader;n.onload=async()=>{var g,h,m,f;let s=n.result;if(!s||typeof s!="string"){alert("Failed to read file: Invalid data URL"),console.error("[QuickActionsBar] Invalid data URL:",typeof s,s==null?void 0:s.substring(0,50));return}if(!s.startsWith("data:image/")){alert("Invalid file format: Not an image file"),console.error("[QuickActionsBar] Invalid data URL format:",s.substring(0,100));return}let r=s.match(/^data:image\/[^;]+;base64,(.+)$/);if(!r||!r[1]||r[1].length===0){alert("Failed to read file: Invalid base64 data"),console.error("[QuickActionsBar] Invalid base64 data in data URL");return}try{let b=r[1],y=atob(b.substring(0,Math.min(100,b.length)));if(!y||y.length===0)throw new Error("Base64 decode test failed");console.log("[QuickActionsBar] \u2705 Data URL validated, length:",s.length)}catch(b){alert("Failed to read file: Corrupted image data"),console.error("[QuickActionsBar] Base64 validation failed:",b);return}let l=o.category||"misc",c=(o.objectId||"new_asset").replace(/^json\./,"").replace(/[^a-zA-Z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),d=((g=i.name.toLowerCase().match(/\.(png|jpg|jpeg|gif|webp)$/))==null?void 0:g[1])||"png",p=d==="jpg"?"jpeg":d,u=`${c||"new_asset"}_uploaded_${Date.now()}.${p}`;console.log("[QuickActionsBar] Uploading file:",u,"to category:",l,"data URL length:",s.length);try{let y=await(await fetch("/api/library/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:l,filename:u,data:s,overwrite:!0})})).json();if(!(y!=null&&y.success)){alert(`Upload failed: ${(y==null?void 0:y.error)||"Unknown error"}`);return}await new Promise(S=>setTimeout(S,100));let w=window.addAssetToRegistry;typeof w=="function"&&(w(l,u),console.log("[QuickActionsBar] \u2705 Added to registry:",l,u));let v=window.getEditableAssets;if(typeof v=="function"){let S=v();S&&!S.categories&&(S.categories=[]),S!=null&&S.categories&&!S.categories.includes(l)&&(S.categories.push(l),console.log(`[QuickActionsBar] Added category ${l} to registry`))}let T=!1,P=0,_=10;for(;!T&&P<_;){P++,console.log(`[QuickActionsBar] Refresh attempt ${P}/${_}...`);try{(await fetch("/api/setup-library",{method:"POST",headers:{"Content-Type":"application/json"}})).ok&&console.log("[QuickActionsBar] \u2705 Registry rebuilt from disk")}catch{}await new Promise(A=>setTimeout(A,300));let S=window.refreshAssetLibrary;typeof S=="function"&&(console.log("[QuickActionsBar] Refreshing library panel..."),await S());let x=window.reRenderAssetLibrary;typeof x=="function"&&(console.log("[QuickActionsBar] Re-rendering library panel..."),x());let E=window.getEditableAssets;if(typeof E=="function"){let A=E(),C=((h=A==null?void 0:A.libraryAssets)==null?void 0:h[l])||[];C.some(R=>(R==null?void 0:R.filename)===u)?(console.log("[QuickActionsBar] \u2705 Asset found in registry!"),T=!0):(console.log(`[QuickActionsBar] Asset not found yet, retrying... (found ${C.length} assets in ${l})`),await new Promise(R=>setTimeout(R,500)))}else P>=2&&(T=!0)}T||console.warn("[QuickActionsBar] \u26A0\uFE0F Asset not found in registry after retries, proceeding anyway..."),setTimeout(()=>{try{window.dispatchEvent(new CustomEvent("config:changed",{detail:{action:"batch"}})),console.log("[QuickActionsBar] Dispatched config:changed event")}catch(S){console.warn("[QuickActionsBar] Failed to refresh textures:",S)}},300),console.log("[QuickActionsBar] Applying asset to object:",y.path);let I=!1,j=0,L=5;for(;!I&&j<L;){j++;try{await o.onApply(y.path),await new Promise(x=>setTimeout(x,200));let S=window.getEditableObjectConfig;if(typeof S=="function"){let x=S(o.objectId),E=((f=(m=x==null?void 0:x.render)==null?void 0:m.asset)==null?void 0:f.path)||"";E===y.path||E.includes(u)?(console.log("[QuickActionsBar] \u2705 Asset confirmed applied to object"),I=!0):(console.log(`[QuickActionsBar] Asset not applied yet (attempt ${j}), retrying...`),await new Promise(A=>setTimeout(A,300)))}else I=!0}catch(S){console.error(`[QuickActionsBar] Apply attempt ${j} failed:`,S),j<L&&await new Promise(x=>setTimeout(x,500))}}I?console.log("[QuickActionsBar] \u2705 Asset upload and apply complete!"):console.warn("[QuickActionsBar] \u26A0\uFE0F Asset may not have been applied, but upload succeeded")}catch(b){console.error("[QuickActionsBar] Upload error:",b),alert("Upload failed. Check console.")}},n.readAsDataURL(i)},e.click()}var ii=class{constructor(){this.updateManager=new Pe}async handleAction(e,t,i){console.log("[QuickActionsBar] Action:",e,t,i);let n=window.getEditableObjectConfig;if(typeof n!="function")return;let a=n(t);if(!a)return;let s=this.updateManager.getNestedProperty(a,i);if(e==="ai-convert"||e==="upload"||e==="library"){let r=i==="ui.text"||i==="render.asset.path",l=i==="render.asset.path";r&&(await this.prepareForImageConversion(t,a),e==="ai-convert"&&i!=="render.asset.path"&&(i="render.asset.path"))}switch(e){case"library":this.openLibrary(t,i,s);break;case"ai-edit":this.openAIEditor(t,i,s);break;case"upload":this.openUpload(t,i);break;case"reset":await this.resetToDefault(t,i);break;case"ai-convert":this.handleAiConvert(t,i,s);break;default:console.warn("[QuickActionsBar] Unknown action:",e)}}async prepareForImageConversion(e,t){var i,n;if(console.log("[QuickActionsBar] Preparing for image conversion:",e),t.render||(t.render={alpha:1,visible:!0}),(t.render.alpha===0||t.render.alpha===void 0)&&(t.render.alpha=1,await this.updateManager.updateProperty(e,"render.alpha",1)),(t.render.visible===!1||t.render.visible===void 0)&&(t.render.visible=!0,await this.updateManager.updateProperty(e,"render.visible",!0)),t.render.asset||(t.render.asset={type:"image",path:""}),t.render.asset.type!=="image"&&(t.render.asset.type="image",await this.updateManager.updateProperty(e,"render.asset",{type:"image",path:t.render.asset.path||""})),t.ui&&t.ui.renderMode!=="png"){await this.updateManager.updateProperty(e,"ui.renderMode","png",{refreshInspector:!0}),await this.updateManager.updateProperty(e,"render.tint","#ffffff");let s=((n=(i=t.transform)==null?void 0:i.scale)!=null?n:1)*.3;await this.updateManager.updateProperty(e,"transform.scale",s),console.log("[QuickActionsBar] Text to PNG conversion: set tint white, scale",s)}this.ensureSlotInRegistry(e,t)}ensureSlotInRegistry(e,t){var r,l,c;let i=window.getEditableAssets;if(typeof i!="function")return;let n=i();if(!n||!n.slots)return;let a=e.startsWith("json.")?e.replace("json.",""):e;if(!n.slots.some(d=>d.objectId===a||d.slotId===a)){let d=((r=t.identity)==null?void 0:r.category)||"ui";console.log("[QuickActionsBar] Adding new slot to registry for converted object:",a),n.slots.push({slotId:a,displayName:a.replace(/_/g," "),objectId:a,category:d,currentAsset:((c=(l=t.render)==null?void 0:l.asset)==null?void 0:c.path)||"",defaultAsset:"",libraryFolder:d,assetType:"image"}),n.categories&&!n.categories.includes(d)&&n.categories.push(d),n.libraryAssets&&!n.libraryAssets[d]&&(n.libraryAssets[d]=[]);let p=window.reRenderAssetLibrary;typeof p=="function"&&p()}}openLibrary(e,t,i){var a;let n=window.__debugContext;if(n){if(n.activeTab!=="library"){n.activeTab="library";let s=window.__updateWorkbenchTabs;typeof s=="function"&&s()}if(n.libraryPanel){let s=window.getEditableObjectConfig,r=s==null?void 0:s(e),l=(a=r==null?void 0:r.identity)==null?void 0:a.category;l||(l=t.split(".")[0]==="render"?"environment":"ui"),console.log("[QuickActionsBar] Highlighting library slot:",e,"category:",l),n.libraryPanel.highlightSlot(e,l)}}}openAIEditor(e,t,i){let n=window.__openAiEditor;if(typeof n=="function"){let a=t.split(".").pop()||t;n(a,`Edit ${a} for ${e}`,i,{objectId:e,path:t})}else console.warn("[QuickActionsBar] AI Editor not available")}openUpload(e,t){var s;let i=window.getEditableObjectConfig,n=i==null?void 0:i(e),a=((s=n==null?void 0:n.identity)==null?void 0:s.category)||(t.split(".")[0]==="render"?"environment":"ui");mn({objectId:e,category:a,onApply:async r=>{var g,h;console.log("[QuickActionsBar] Upload complete, applying asset:",r);let l=window.applyAssetToSlot,c=this.getFilenameFromPath(r),d=/render\.asset\.path/i.test(t)||/\.(png|jpg|jpeg|gif|webp)$/i.test(r);if(typeof l=="function"&&c&&d){console.log("[QuickActionsBar] Applying asset to slot:",e,c,a);try{await l(e,c,a),console.log("[QuickActionsBar] \u2705 Asset applied to slot")}catch(m){console.error("[QuickActionsBar] Failed to apply asset to slot:",m)}}console.log("[QuickActionsBar] Updating property:",e,t,r);try{await this.updateManager.updateProperty(e,t,r),console.log("[QuickActionsBar] \u2705 Property updated")}catch(m){console.error("[QuickActionsBar] Failed to update property:",m)}let p=window.__debugContext;(h=(g=p==null?void 0:p.options)==null?void 0:g.onPropertyChange)==null||h.call(g,e,t,r);let u=window.__highlightLibrarySlot;typeof u=="function"&&setTimeout(()=>{u(e,a)},1e3),window.dispatchEvent(new CustomEvent("inspector:refresh")),window.dispatchEvent(new CustomEvent("config:changed",{detail:{objectId:e,action:"update",path:t}})),console.log("[QuickActionsBar] \u2705 Upload and apply complete")}})}getFilenameFromPath(e){if(!e)return"";let t=e.split("?")[0].replace(/\\/g,"/");return t.split("/").pop()||t}async resetToDefault(e,t){console.log("[QuickActionsBar] Reset to default:",e,t);try{let i=await this.getDefaultValue(e,t);i!==void 0?(await this.updateManager.updateProperty(e,t,i),console.log("[QuickActionsBar] Reset to default value:",i)):alert("No default value found for this property.")}catch(i){console.error("[QuickActionsBar] Failed to reset to default:",i),alert("Failed to reset property. Check console for details.")}}async getDefaultValue(e,t){let i=t.split(".");if(i.length<2)return;let n=i[0],a=i.slice(1),s=window.__editableConfig;if(!(s!=null&&s.schemas))return;let r=null;if(s.schemas instanceof Map?r=s.schemas.get(n):typeof s.schemas=="object"&&(r=s.schemas[n]),!(r!=null&&r.defaults))return;let l=r.defaults;for(let c of a)if(l&&typeof l=="object")l=l[c];else return;return l}handleAiConvert(e,t,i){let n=window.__openAiEditor;if(typeof n=="function"){let s=`A single, high-quality, high-detail game UI icon/asset representing "${String(i||e.replace(/_/g," ").replace("json.",""))}". Modern stylized 3D rendered style, vibrant colors, soft lighting, isolated on solid magenta background, highly polished professional game art.`,r="render.asset.path";console.log("[QuickActionsBar] AI Convert for:",e,"from:",t,"to:",r),n(e,s,"",{objectId:e,path:r});let l=window.__debugContext;if(l){l.activeTab="ai";let c=window.__updateWorkbenchTabs;typeof c=="function"&&c()}}else console.warn("[QuickActionsBar] AI Editor not available")}};var qr=[{value:"loading",label:"Loading"},{value:"start",label:"Start"},{value:"gameplay",label:"Gameplay"},{value:"tutorial",label:"Tutorial"},{value:"endgame",label:"Endgame"}],Vr=["environment","ui","character","system","backgrounds"],Yr=["bg","world","ui"],Cs={SwerveMove:{speed:5,sensitivity:1,directionMode:"dominantAxis",axis:"both",bounds:{left:-400,right:400,top:-300,bottom:300}},DragToWin:{targetId:"",successDistance:80},DragSnap:{snapTargetId:"",snapDistance:40},JoystickMove:{speed:6,bounds:{left:-400,right:400,top:-300,bottom:300}}},ni=class{constructor(){this.modal=null;this.state=null}open(e){this.state=this.createInitialState(e),this.createModal(),document.body.appendChild(this.modal),this.attachEventListeners(),this.updateStepUI()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),window.__wizardAssetPicker=null,this.modal=null,this.state=null}createInitialState(e){return{step:1,objectType:"sprite",instanceId:"",displayName:"",category:"environment",screenId:e.screenId,layer:"world",positionMode:"static",anchorPreset:"center",anchorX:.5,anchorY:.5,positionX:0,positionY:0,offsetX:0,offsetY:0,scale:.2,rotation:0,zIndex:0,assetPath:"",tint:"",alpha:1,text:"",font:"brand.primary",fontSize:18,letterSpacing:0,align:"center",graphicsWidth:200,graphicsHeight:200,graphicsFill:"#FFFFFF",graphicsAlpha:1,interactionEnabled:!1,dragEnabled:!1,hoverEnabled:!1,clickEnabled:!1,logicId:"",logicPropsRaw:""}}createModal(){let e=document.createElement("div");e.className="wizard-modal",e.innerHTML=`
|
|
2
2
|
<div class="wizard-card">
|
|
3
3
|
<div class="wizard-header">
|
|
4
4
|
<div class="wizard-title">
|
|
@@ -818,7 +818,17 @@ ${r}`)}this.refreshObjects()}async syncScreens(){try{let e=this.getActiveScreenF
|
|
|
818
818
|
data-object-id="${e}"
|
|
819
819
|
step="any" />
|
|
820
820
|
</div>
|
|
821
|
-
`}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}};var ui=class{render(e,t,i,n){let a=String(i||"");return
|
|
821
|
+
`}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}};var ui=class{render(e,t,i,n){let a=String(i||"");return n.includes("html_component.html")||n.includes("html_component.css")?`
|
|
822
|
+
<div class="inspector-property inspector-property-text">
|
|
823
|
+
<label class="inspector-property-label">${this.formatLabel(t)}</label>
|
|
824
|
+
<div class="inspector-input-group">
|
|
825
|
+
<textarea class="inspector-input"
|
|
826
|
+
rows="8"
|
|
827
|
+
data-property-path="${n}"
|
|
828
|
+
data-object-id="${e}">${a}</textarea>
|
|
829
|
+
</div>
|
|
830
|
+
</div>
|
|
831
|
+
`:`
|
|
822
832
|
<div class="inspector-property inspector-property-text">
|
|
823
833
|
<label class="inspector-property-label">${this.formatLabel(t)}</label>
|
|
824
834
|
<div class="inspector-input-group">
|
|
@@ -918,7 +928,7 @@ ${r}`)}this.refreshObjects()}async syncScreens(){try{let e=this.getActiveScreenF
|
|
|
918
928
|
${a.join("")}
|
|
919
929
|
</div>
|
|
920
930
|
</div>
|
|
921
|
-
`}renderLogic(e,t,i,n){let a=[],s=typeof(i==null?void 0:i.id)=="string"?i.id:"",r={zone:["bottom-left","bottom-center","bottom-right","top-left","top-center","top-right"],directionMode:["dominantAxis","free"],axis:["both","x","y"],ease:["power2.out","linear","sine.inOut","back.out(1.8)"],direction:["any","horizontal","vertical"],spawnPattern:["continuous","onClick","wave","burst"],positionSource:["spawner","target","custom","random","points"],spawnPointMode:["cycle","random"],movementMode:["none","velocity"],particleEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],collectSound:["","click_4.wav","click_6.wav","success_4.wav"],hitEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],destroyEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],destroySound:["","click_4.wav","click_6.wav","success_4.wav"]},l=(()=>{let u=window,g=Array.isArray(u==null?void 0:u.__HANDLER_LOGIC_OPTIONS)?u.__HANDLER_LOGIC_OPTIONS:[],m=[...["DragToWin","SwerveMove","DragSnap","JoystickMove","DrawCanvas"],...g].map(f=>String(f)).filter(f=>f.trim().length>0);return Array.from(new Set(m)).sort((f,b)=>f.localeCompare(b))})(),c=s&&!l.includes(s)?[s,...l]:l;a.push(`
|
|
931
|
+
`}renderLogic(e,t,i,n){let a=[],s=typeof(i==null?void 0:i.id)=="string"?i.id:"",r={zone:["bottom-left","bottom-center","bottom-right","top-left","top-center","top-right"],directionMode:["dominantAxis","free"],axis:["both","x","y"],ease:["power2.out","linear","sine.inOut","back.out(1.8)"],direction:["any","horizontal","vertical"],spawnPattern:["continuous","onClick","wave","burst"],positionSource:["spawner","target","custom","random","points"],spawnPointMode:["cycle","random"],movementMode:["none","velocity"],particleEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],collectSound:["","click_4.wav","click_6.wav","success_4.wav"],hitEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],destroyEffect:["","sparkle","gem","fire","heart","stars","smoke","magic","coin"],destroySound:["","click_4.wav","click_6.wav","success_4.wav"]},l=(()=>{let u=window,g=Array.isArray(u==null?void 0:u.__HANDLER_LOGIC_OPTIONS)?u.__HANDLER_LOGIC_OPTIONS:[],m=[...["DragToWin","SwerveMove","DragSnap","JoystickMove","DrawCanvas","HtmlComponent"],...g].map(f=>String(f)).filter(f=>f.trim().length>0);return Array.from(new Set(m)).sort((f,b)=>f.localeCompare(b))})(),c=s&&!l.includes(s)?[s,...l]:l;a.push(`
|
|
922
932
|
<div class="inspector-property inspector-property-text">
|
|
923
933
|
<label class="inspector-property-label">Id</label>
|
|
924
934
|
<div class="inspector-input-group">
|
|
@@ -1069,7 +1079,7 @@ ${r}`)}this.refreshObjects()}async syncScreens(){try{let e=this.getActiveScreenF
|
|
|
1069
1079
|
</div>
|
|
1070
1080
|
</div>
|
|
1071
1081
|
</div>
|
|
1072
|
-
`}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}};import{Graphics as Wr}from"pixi.js";var ze={width:400,height:600,designWidth:400,scaleFactor:1},xi={scale:1,position:1},Si=[];function Kr(o,e,t,i,n,a,s){Si.push({element:o,originalScale:a,positionHelper:e,heightPercent:n}),e(o,t,i,n,a,s,!1)}function Xr(){Si.forEach(({element:o,originalScale:e,positionHelper:t,heightPercent:i})=>{let n=e*ze.scaleFactor;t(o,ze.width,ze.height,i,n,!0,!1)})}function Jr(){Si.length=0,console.log("[LAYOUT] Cleared all responsive elements")}function fn(o,e){console.log(`[SCREEN] updateScreenState called: ${o}x${e}`),ze.width=o,ze.height=e,ze.scaleFactor=Math.min(o/ze.designWidth,1.15),xi.scale=ze.scaleFactor,xi.position=1,console.log(`[SCREEN] Global multipliers - scale: ${xi.scale.toFixed(3)}`),Xr()}var ae={layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}};function Zr(o,e,t){let i=ae[o];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${o}.${e} = ${t}`))}function Qr(){return ae}var eo={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function wi(o,e){return typeof o=="number"&&Number.isFinite(o)?o:e}function $e(o,e={x:.5,y:.5}){var t;if(Array.isArray(o))return{x:wi(o[0],e.x),y:wi(o[1],e.y)};if(o&&typeof o=="object"){let i=o;return{x:wi(i.x,e.x),y:wi(i.y,e.y)}}if(typeof o=="string"){let i=o.trim().toLowerCase();return(t=eo[i])!=null?t:e}return e}function Se(o,e,t,i={}){var g,h,m,f,b,y;let n=$e(t),a=(g=i.inset)!=null?g:{},s=(h=i.padding)!=null?h:{x:0,y:0},r=((m=a.left)!=null?m:0)+s.x,l=((f=a.right)!=null?f:0)+s.x,c=((b=a.top)!=null?b:0)+s.y,d=((y=a.bottom)!=null?y:0)+s.y,p=Math.max(0,o-r-l),u=Math.max(0,e-c-d);return{x:r+p*n.x,y:c+u*n.y}}function De(o,e,t,i={}){var m,f,b,y,w,v;let n=(m=i.inset)!=null?m:{},a=(f=i.padding)!=null?f:{x:0,y:0},s=((b=n.left)!=null?b:0)+a.x,r=((y=n.right)!=null?y:0)+a.x,l=((w=n.top)!=null?w:0)+a.y,c=((v=n.bottom)!=null?v:0)+a.y,d=Math.max(0,o-s-r),p=Math.max(0,e-l-c),u=$e(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),h=Math.min(Math.max(u.y,0),1);return{x:s+d*g,y:l+p*h}}function bn(o,e,t,i={}){var d,p,u;if(!o)return;let n=i.positionRatio?De(e,t,i.positionRatio,{inset:i.inset,padding:i.screenPadding}):Se(e,t,i.anchor,{inset:i.inset,padding:i.screenPadding}),a=(d=i.offset)!=null?d:{x:0,y:0},s=n.x+a.x,r=n.y+a.y;o.anchor&&i.renderAnchor&&o.anchor.set(i.renderAnchor.x,i.renderAnchor.y),Ee(o,s,r);let l=(p=i.scale)!=null?p:1,c=(u=i.scaleMultiplier)!=null?u:1;(i.scale!==void 0||i.scaleMultiplier!==void 0)&&Ie(o,l*c)}if(typeof window!="undefined"){let o=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,n=window.innerHeight;(i!==o||n!==e)&&(o=i,e=n,fn(i,n))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),fn(window.innerWidth,window.innerHeight),window.updateDebugConfig=Zr,window.getDebugConfig=Qr,window.copyConfig=uo,window.applyConfig=jt,window.applyConfigForRatio=go,window.positionAtBottom=ks,window.positionAtTop=no,window.positionAtCenter=ao,window.positionAtLeft=so,window.positionAtRight=ro,window.positionAtBottomLeft=oo,window.positionAtBottomRight=lo,window.positionAtTopLeft=co,window.positionAtTopRight=po,window.applyPositionContract=io,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function Ei(o,e,t=0){return o*e+t}function Ai(o,e,t=0){return o*(1-e)+t}function Ci(o,e,t=0){return o*e+t}function Li(o,e,t=0){return o*(1-e)+t}function ve(o,e=0){return o/2+e}function to(o,e){return o*e}function io(o,e,t,i){var s,r,l,c,d,p,u,g,h,m,f,b,y,w,v,T,P,_,I,j;let n=0,a=0;switch(i.type){case"top":n=ve(e,(r=(s=i.offset)==null?void 0:s.x)!=null?r:0),a=Ei(t,i.percent,(c=(l=i.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":n=ve(e,(p=(d=i.offset)==null?void 0:d.x)!=null?p:0),a=Ai(t,i.percent,(g=(u=i.offset)==null?void 0:u.y)!=null?g:0);break;case"left":n=Ci(e,i.percent,(m=(h=i.offset)==null?void 0:h.x)!=null?m:0),a=ve(t,(b=(f=i.offset)==null?void 0:f.y)!=null?b:0);break;case"right":n=Li(e,i.percent,(w=(y=i.offset)==null?void 0:y.x)!=null?w:0),a=ve(t,(T=(v=i.offset)==null?void 0:v.y)!=null?T:0);break;case"center":n=ve(e,(_=(P=i.offset)==null?void 0:P.x)!=null?_:0),a=ve(t,(j=(I=i.offset)==null?void 0:I.y)!=null?j:0);break}o.position?o.position.set(n,a):(o.x=n,o.y=a),i.scale!==void 0&&i.scale!==1&&o.scale&&(typeof o.scale.set=="function"?o.scale.set(i.scale,i.scale):(o.scale.x=i.scale,o.scale.y=i.scale))}function ks(o,e,t,i=.2,n=1,a=!0,s=!1){let r=to(t,i),l=Ai(t,i/2);Ee(o,ve(e),l);let c=a?n*ze.scaleFactor:n;Ie(o,c),s&&!Si.find(d=>d.element===o)&&Kr(o,ks,e,t,i,n,a)}function no(o,e,t,i=.1,n=1){Ee(o,ve(e),Ei(t,i)),Ie(o,n)}function ao(o,e,t,i=0,n=0,a=1){Ee(o,ve(e,i),ve(t,n)),Ie(o,a)}function so(o,e,t,i=.1,n=1){Ee(o,Ci(e,i),ve(t)),Ie(o,n)}function ro(o,e,t,i=.1,n=1){Ee(o,Li(e,i),ve(t)),Ie(o,n)}function oo(o,e,t,i=.05,n=.05,a=1){Ee(o,Ci(e,n),Ai(t,i)),Ie(o,a)}function lo(o,e,t,i=.05,n=.05,a=1){Ee(o,Li(e,n),Ai(t,i)),Ie(o,a)}function co(o,e,t,i=.05,n=.05,a=1){Ee(o,Ci(e,n),Ei(t,i)),Ie(o,a)}function po(o,e,t,i=.05,n=.05,a=1){Ee(o,Li(e,n),Ei(t,i)),Ie(o,a)}function Ee(o,e,t){o&&o.position?typeof o.position.set=="function"?o.position.set(e,t):(o.position.x=e,o.position.y=t):o&&(o.x=e,o.y=t)}function Ie(o,e){e!==1&&o&&o.scale&&(typeof o.scale.set=="function"?o.scale.set(e,e):o.scale.x!==void 0&&o.scale.y!==void 0&&(o.scale.x=e,o.scale.y=e))}var Qe={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function uo(o){return o&&Qe[o]?JSON.parse(JSON.stringify(Qe[o])):JSON.parse(JSON.stringify(ae))}function jt(o){Object.keys(o).forEach(e=>{let t=e;ae[t]&&o[t]&&Object.assign(ae[t],o[t])}),console.log("Config applied:",o)}function go(o,e){let t=o/e;t>1.6?(jt(Qe.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(jt(Qe.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(jt(Qe.square),console.log("Applied SQUARE config for ratio:",t)):(jt(Qe.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let o=window;o.configPresets=Qe,o.resolveAnchorVec2=o.resolveAnchorVec2||$e,o.resolveScreenAnchorPoint=o.resolveScreenAnchorPoint||Se,o.resolveScreenRatioPoint=o.resolveScreenRatioPoint||De}var fe=null,Ls=new Map;function ho(o,e,t,i,n,a={}){var N,q,$,H,z,G,Y,V,F,Q,W,K,X,de,ee,we,J,le,ie,se,Ce,Re,Kt,ma,fa,ba,ya,va,wa,xa,Sa,Ea,Aa,Ca,La,ka,Ta,Pa,Ia,Ma,ja,_a,Ra,Oa,za,$a,Da,Ha,Na;let s=(N=a.enableDebugLogs)!=null?N:!1;s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== STARTING LAYOUT CALCULATION ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Screen dimensions:",{width:i.width,height:i.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Time:",t),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Options:",a));let{mainContainer:r,label:l,background:c,backgroundTexture:d,app:p}=o;if(!p||!p.renderer){s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] \u274C No app or renderer, skipping layout");return}s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] App renderer dimensions:",{width:p.renderer.width,height:p.renderer.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] App screen dimensions:",{width:p.screen.width,height:p.screen.height}));let u=i.width,g=i.height;s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Base dimensions:",{baseWidth:u,baseHeight:g});let h=u*ae.layout.screen_scale_x,m=g*ae.layout.screen_scale_y,f=u/2,b=e.engine.runtime||{},y=b.layout||{};s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug config:",{screen_scale_x:ae.layout.screen_scale_x,screen_scale_y:ae.layout.screen_scale_y}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Calculated dimensions:",{width:h,height:m,midX:f}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Engine runtime:",b),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Layout config:",y));let w=m>h,v=(q=y.design_width_portrait)!=null?q:w?400:600,T=($=y.design_height_portrait)!=null?$:w?600:400,P=Math.min(h/v,m/T);P=Math.min(P,1.15);let _=P*((H=ae.engine.scale)!=null?H:1),I=(z=a.skipMainContainerTransform)!=null?z:!1;!I&&r&&r.scale&&(typeof r.scale.set=="function"?r.scale.set(_):(r.scale.x=_,r.scale.y=_));let j=(G=y.main_container_anchor)!=null?G:"center",L=(Y=y.main_container_position_ratio)!=null?Y:{x:.5,y:.5},S=(V=y.main_container_offset)!=null?V:{x:0,y:0},x=y.main_container_position_ratio?De(u,g,L):Se(u,g,j),E=x.x+S.x+ae.layout.position_offset.x,A=x.y+S.y+ae.layout.position_offset.y;if(!I&&r&&r.position&&(typeof r.position.set=="function"?r.position.set(E,A):(r.position.x=E,r.position.y=A)),n&&(r!=null&&r.toLocal)){let ue=g>u,me=(F=y.design_width_portrait)!=null?F:ue?320:480,ce=(Q=y.design_height_portrait)!=null?Q:ue?480:320;for(let[Le,ke]of e.objects.entries()){let he=ke==null?void 0:ke.transform;if(!he||((W=he.position_mode)!=null?W:"static")!=="static")continue;let Z=(K=n.get)==null?void 0:K.call(n,Le),kt=((X=Z==null?void 0:Z.getDisplayObject)==null?void 0:X.call(Z))||(Z==null?void 0:Z.pixiObject)||Z;if(!kt||kt.parent!==r)continue;let Oe=(de=he.anchor)!=null?de:"bottom-left";Oe==="bottom-left"&&he.anchor==null&&console.log("[DEBUG FALLBACK] LayoutManager transform.anchor \u2192 bottom-left");let nt=he.position_ratio!=null?De(me,ce,he.position_ratio):Se(me,ce,Oe),at=(ee=he.position)!=null?ee:{x:0,y:0},Tt=nt.x-me/2+at.x,Je=nt.y-ce/2+at.y;typeof(Z==null?void 0:Z.setPosition)=="function"?Z.setPosition(Tt,Je):(Ee(kt,Tt,Je),(we=Z==null?void 0:Z.transform)!=null&&we.position&&(Z.transform.position.x=Tt,Z.transform.position.y=Je))}}let C=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,R=((C==null?void 0:C.buildMode)||(typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"dev"))==="dev";if(ae.layout.debug_rect_visible&&R){(!fe||fe.parent!==p.stage)&&(fe==null||fe.destroy(),fe=new Wr,fe.zIndex=9999,p.stage.addChild(fe)),fe.clear();let ue=ae.layout.debug_rect_scale_x,me=ae.layout.debug_rect_scale_y,ce=(u-4)*ue,Le=(g-4)*me,ke=(u-ce)/2,he=(g-Le)/2;s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== DEBUG RECT POSITIONING ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect calculations:",{baseWidth:u,baseHeight:g,rectW:ce,rectH:Le,offsetX:ke,offsetY:he}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect final position:",{x:2+ke,y:2+he,width:ce,height:Le})),fe.rect(2+ke,2+he,ce,Le).stroke({width:ae.layout.debug_rect_thickness,color:ae.layout.debug_rect_color})}else fe&&(fe.destroy(),fe=null);let M=((J=o.label)==null?void 0:J.config)||e.objects.get("label_1")||e.objects.get("ui_tutorial_1");if(l&&l.position&&M){let ue=(ie=(le=M==null?void 0:M.transform)==null?void 0:le.anchor)!=null?ie:"center",me=(se=M==null?void 0:M.transform)==null?void 0:se.position_ratio,ce=((Ce=M==null?void 0:M.transform)==null?void 0:Ce.offset)||{x:0,y:0};bn(l,u,g,{anchor:ue,positionRatio:me,offset:{x:ce.x*_,y:ce.y*_},renderAnchor:$e(ue)})}if(l&&l.alpha>0){let ue=1+Math.sin(t*ae.engine.label_pulse_speed)*ae.engine.label_pulse_intensity,me=(Kt=(Re=M==null?void 0:M.transform)==null?void 0:Re.scale)!=null?Kt:1,ce=ue*_*me;l.scale&&(typeof l.scale.set=="function"?l.scale.set(ce):(l.scale.x=ce,l.scale.y=ce))}s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== BACKGROUND POSITIONING =====");let O=c?e.objects.get("background_1"):null,D=!!O&&(c==null?void 0:c.parent)===r;if(c&&!D){s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background object exists:",!!c),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background type:",(ma=c.constructor)==null?void 0:ma.name)),c.alpha=((ba=(fa=b.background)==null?void 0:fa.alpha)!=null?ba:.98)*ae.engine.background_alpha,s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background alpha set to:",c.alpha),s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background config:",O);let ue=(O==null?void 0:O.transform)||{};s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background transform:",ue);let me=ue.offset||{x:0,y:0},ce=((va=(ya=b.background)==null?void 0:ya.offset_y)!=null?va:0)+ae.engine.background_offset_y,Le=(wa=ue.anchor)!=null?wa:"center",ke=ue.position_ratio;if(s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background positioning params:",{bgOffset:me,bgRuntimeOffsetY:ce,bgScreenAnchor:Le,bgPositionRatio:ke,baseWidth:u,baseHeight:g,finalScale:_}),bn(c,u,g,{anchor:Le,positionRatio:ke,offset:{x:me.x*_,y:me.y*_+ce},renderAnchor:$e(Le)}),s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background position after applyScreenAnchor:",{x:c.x,y:c.y,scaleX:(xa=c.scale)==null?void 0:xa.x,scaleY:(Sa=c.scale)==null?void 0:Sa.y,anchorX:(Ea=c.anchor)==null?void 0:Ea.x,anchorY:(Aa=c.anchor)==null?void 0:Aa.y,pivotX:(Ca=c.pivot)==null?void 0:Ca.x,pivotY:(La=c.pivot)==null?void 0:La.y,width:c.width,height:c.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background texture dimensions:",{textureWidth:d==null?void 0:d.width,textureHeight:d==null?void 0:d.height})),d){let nt=Math.max(h/d.width,m/d.height),at=(Ta=(ka=b.background)==null?void 0:ka.scale_multiplier)!=null?Ta:1.05,Tt=(Pa=ue.scale)!=null?Pa:1,Je=nt*at*ae.engine.background_scale*Tt;c.scale&&(typeof c.scale.set=="function"?c.scale.set(Je):(c.scale.x=Je,c.scale.y=Je))}else c&&typeof c.clear=="function"&&(c.clear(),c.rect(-h/2,-m/2,h,m).fill({color:1444375}));let he=`${u}x${g}`,te=Ls.get(he),Z={x:Number((Ia=c.x)!=null?Ia:0),y:Number((Ma=c.y)!=null?Ma:0),scaleX:Number((_a=(ja=c.scale)==null?void 0:ja.x)!=null?_a:1),scaleY:Number((Oa=(Ra=c.scale)==null?void 0:Ra.y)!=null?Oa:1),rotation:Number.isFinite(c.rotation)?c.rotation:void 0,anchorX:Number.isFinite((za=c.anchor)==null?void 0:za.x)?c.anchor.x:void 0,anchorY:Number.isFinite(($a=c.anchor)==null?void 0:$a.y)?c.anchor.y:void 0,pivotX:Number.isFinite((Da=c.pivot)==null?void 0:Da.x)?c.pivot.x:void 0,pivotY:Number.isFinite((Ha=c.pivot)==null?void 0:Ha.y)?c.pivot.y:void 0},kt=Number.isFinite(Z.x)&&Number.isFinite(Z.y)&&Number.isFinite(Z.scaleX)&&Number.isFinite(Z.scaleY),Oe=Z;if(te){let nt=Math.hypot(Z.x-te.x,Z.y-te.y),at=Math.max(u,g)*.5;(!kt||nt>at)&&((Na=c.position)!=null&&Na.set?c.position.set(te.x,te.y):(c.x=te.x,c.y=te.y),c.scale&&(typeof c.scale.set=="function"?c.scale.set(te.scaleX,te.scaleY):(c.scale.x=te.scaleX,c.scale.y=te.scaleY)),Number.isFinite(te.rotation)&&typeof c.rotation=="number"&&(c.rotation=te.rotation),c.anchor&&Number.isFinite(te.anchorX)&&Number.isFinite(te.anchorY)&&c.anchor.set(te.anchorX,te.anchorY),c.pivot&&Number.isFinite(te.pivotX)&&Number.isFinite(te.pivotY)&&c.pivot.set(te.pivotX,te.pivotY),Oe=te)}Number.isFinite(Oe.x)&&Number.isFinite(Oe.y)&&Number.isFinite(Oe.scaleX)&&Number.isFinite(Oe.scaleY)&&Ls.set(he,Oe)}}var ki=class{constructor(){this.typeDetector=new li,this.imageRenderer=new ci,this.colorRenderer=new di,this.numberRenderer=new pi,this.textRenderer=new ui,this.booleanRenderer=new gi,this.arrayRenderer=new hi(this),this.objectRenderer=new mi(this),this.selectRenderer=new fi,this.jsonRenderer=new bi,this.spawnPointsRenderer=new yi,this.spawnTemplatesRenderer=new vi(this)}getObjectIds(){try{let e=window,t=e==null?void 0:e.__editableConfig;if(!(t!=null&&t.objects))return[];let i=[];if(t.objects instanceof Map)for(let n of t.objects.keys())i.push(n);else typeof t.objects=="object"&&i.push(...Object.keys(t.objects));return i.sort()}catch{return[]}}getEnumOptionsFromSchemas(e){var t;try{let i=window,n=i==null?void 0:i.__editableConfig,a=n==null?void 0:n.schemas;if(!a)return null;let s=String(e||"").split(".").filter(Boolean);if(s.length<2)return null;let r=s[0],l=s.slice(1).join("."),c=a instanceof Map?a.get(r):a==null?void 0:a[r];if(!c)return null;let d=(t=c==null?void 0:c.types)==null?void 0:t[l];if(typeof d!="string"||!d.startsWith("enum:"))return null;let u=d.slice(5).split("|").map(g=>g.trim()).filter(Boolean);return u.length?u:null}catch{return null}}getLogicOptions(){try{let e=window,t=Array.isArray(e==null?void 0:e.__HANDLER_LOGIC_OPTIONS)?e.__HANDLER_LOGIC_OPTIONS:[],n=[...["DragToWin","SwerveMove","DragSnap","JoystickMove","DrawCanvas"],...t].map(a=>String(a)).filter(a=>a.trim().length>0);return Array.from(new Set(n)).sort((a,s)=>a.localeCompare(s))}catch{return[]}}renderProperty(e,t,i,n){let a=t.toLowerCase(),s=a==="logic"||a==="logic_id"||a==="logicid",r=a==="id"&&n.toLowerCase().includes("logic");if((s||r)&&typeof i=="string"){let h=this.getLogicOptions(),m=this.selectRenderer.render(e,t,i,n,h);return s?`
|
|
1082
|
+
`}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}};import{Graphics as Wr}from"pixi.js";var ze={width:400,height:600,designWidth:400,scaleFactor:1},xi={scale:1,position:1},Si=[];function Kr(o,e,t,i,n,a,s){Si.push({element:o,originalScale:a,positionHelper:e,heightPercent:n}),e(o,t,i,n,a,s,!1)}function Xr(){Si.forEach(({element:o,originalScale:e,positionHelper:t,heightPercent:i})=>{let n=e*ze.scaleFactor;t(o,ze.width,ze.height,i,n,!0,!1)})}function Jr(){Si.length=0,console.log("[LAYOUT] Cleared all responsive elements")}function fn(o,e){console.log(`[SCREEN] updateScreenState called: ${o}x${e}`),ze.width=o,ze.height=e,ze.scaleFactor=Math.min(o/ze.designWidth,1.15),xi.scale=ze.scaleFactor,xi.position=1,console.log(`[SCREEN] Global multipliers - scale: ${xi.scale.toFixed(3)}`),Xr()}var ae={layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}};function Zr(o,e,t){let i=ae[o];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${o}.${e} = ${t}`))}function Qr(){return ae}var eo={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function wi(o,e){return typeof o=="number"&&Number.isFinite(o)?o:e}function $e(o,e={x:.5,y:.5}){var t;if(Array.isArray(o))return{x:wi(o[0],e.x),y:wi(o[1],e.y)};if(o&&typeof o=="object"){let i=o;return{x:wi(i.x,e.x),y:wi(i.y,e.y)}}if(typeof o=="string"){let i=o.trim().toLowerCase();return(t=eo[i])!=null?t:e}return e}function Se(o,e,t,i={}){var g,h,m,f,b,y;let n=$e(t),a=(g=i.inset)!=null?g:{},s=(h=i.padding)!=null?h:{x:0,y:0},r=((m=a.left)!=null?m:0)+s.x,l=((f=a.right)!=null?f:0)+s.x,c=((b=a.top)!=null?b:0)+s.y,d=((y=a.bottom)!=null?y:0)+s.y,p=Math.max(0,o-r-l),u=Math.max(0,e-c-d);return{x:r+p*n.x,y:c+u*n.y}}function De(o,e,t,i={}){var m,f,b,y,w,v;let n=(m=i.inset)!=null?m:{},a=(f=i.padding)!=null?f:{x:0,y:0},s=((b=n.left)!=null?b:0)+a.x,r=((y=n.right)!=null?y:0)+a.x,l=((w=n.top)!=null?w:0)+a.y,c=((v=n.bottom)!=null?v:0)+a.y,d=Math.max(0,o-s-r),p=Math.max(0,e-l-c),u=$e(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),h=Math.min(Math.max(u.y,0),1);return{x:s+d*g,y:l+p*h}}function bn(o,e,t,i={}){var d,p,u;if(!o)return;let n=i.positionRatio?De(e,t,i.positionRatio,{inset:i.inset,padding:i.screenPadding}):Se(e,t,i.anchor,{inset:i.inset,padding:i.screenPadding}),a=(d=i.offset)!=null?d:{x:0,y:0},s=n.x+a.x,r=n.y+a.y;o.anchor&&i.renderAnchor&&o.anchor.set(i.renderAnchor.x,i.renderAnchor.y),Ee(o,s,r);let l=(p=i.scale)!=null?p:1,c=(u=i.scaleMultiplier)!=null?u:1;(i.scale!==void 0||i.scaleMultiplier!==void 0)&&Ie(o,l*c)}if(typeof window!="undefined"){let o=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,n=window.innerHeight;(i!==o||n!==e)&&(o=i,e=n,fn(i,n))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),fn(window.innerWidth,window.innerHeight),window.updateDebugConfig=Zr,window.getDebugConfig=Qr,window.copyConfig=uo,window.applyConfig=jt,window.applyConfigForRatio=go,window.positionAtBottom=ks,window.positionAtTop=no,window.positionAtCenter=ao,window.positionAtLeft=so,window.positionAtRight=ro,window.positionAtBottomLeft=oo,window.positionAtBottomRight=lo,window.positionAtTopLeft=co,window.positionAtTopRight=po,window.applyPositionContract=io,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function Ei(o,e,t=0){return o*e+t}function Ai(o,e,t=0){return o*(1-e)+t}function Ci(o,e,t=0){return o*e+t}function Li(o,e,t=0){return o*(1-e)+t}function ve(o,e=0){return o/2+e}function to(o,e){return o*e}function io(o,e,t,i){var s,r,l,c,d,p,u,g,h,m,f,b,y,w,v,T,P,_,I,j;let n=0,a=0;switch(i.type){case"top":n=ve(e,(r=(s=i.offset)==null?void 0:s.x)!=null?r:0),a=Ei(t,i.percent,(c=(l=i.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":n=ve(e,(p=(d=i.offset)==null?void 0:d.x)!=null?p:0),a=Ai(t,i.percent,(g=(u=i.offset)==null?void 0:u.y)!=null?g:0);break;case"left":n=Ci(e,i.percent,(m=(h=i.offset)==null?void 0:h.x)!=null?m:0),a=ve(t,(b=(f=i.offset)==null?void 0:f.y)!=null?b:0);break;case"right":n=Li(e,i.percent,(w=(y=i.offset)==null?void 0:y.x)!=null?w:0),a=ve(t,(T=(v=i.offset)==null?void 0:v.y)!=null?T:0);break;case"center":n=ve(e,(_=(P=i.offset)==null?void 0:P.x)!=null?_:0),a=ve(t,(j=(I=i.offset)==null?void 0:I.y)!=null?j:0);break}o.position?o.position.set(n,a):(o.x=n,o.y=a),i.scale!==void 0&&i.scale!==1&&o.scale&&(typeof o.scale.set=="function"?o.scale.set(i.scale,i.scale):(o.scale.x=i.scale,o.scale.y=i.scale))}function ks(o,e,t,i=.2,n=1,a=!0,s=!1){let r=to(t,i),l=Ai(t,i/2);Ee(o,ve(e),l);let c=a?n*ze.scaleFactor:n;Ie(o,c),s&&!Si.find(d=>d.element===o)&&Kr(o,ks,e,t,i,n,a)}function no(o,e,t,i=.1,n=1){Ee(o,ve(e),Ei(t,i)),Ie(o,n)}function ao(o,e,t,i=0,n=0,a=1){Ee(o,ve(e,i),ve(t,n)),Ie(o,a)}function so(o,e,t,i=.1,n=1){Ee(o,Ci(e,i),ve(t)),Ie(o,n)}function ro(o,e,t,i=.1,n=1){Ee(o,Li(e,i),ve(t)),Ie(o,n)}function oo(o,e,t,i=.05,n=.05,a=1){Ee(o,Ci(e,n),Ai(t,i)),Ie(o,a)}function lo(o,e,t,i=.05,n=.05,a=1){Ee(o,Li(e,n),Ai(t,i)),Ie(o,a)}function co(o,e,t,i=.05,n=.05,a=1){Ee(o,Ci(e,n),Ei(t,i)),Ie(o,a)}function po(o,e,t,i=.05,n=.05,a=1){Ee(o,Li(e,n),Ei(t,i)),Ie(o,a)}function Ee(o,e,t){o&&o.position?typeof o.position.set=="function"?o.position.set(e,t):(o.position.x=e,o.position.y=t):o&&(o.x=e,o.y=t)}function Ie(o,e){e!==1&&o&&o.scale&&(typeof o.scale.set=="function"?o.scale.set(e,e):o.scale.x!==void 0&&o.scale.y!==void 0&&(o.scale.x=e,o.scale.y=e))}var Qe={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function uo(o){return o&&Qe[o]?JSON.parse(JSON.stringify(Qe[o])):JSON.parse(JSON.stringify(ae))}function jt(o){Object.keys(o).forEach(e=>{let t=e;ae[t]&&o[t]&&Object.assign(ae[t],o[t])}),console.log("Config applied:",o)}function go(o,e){let t=o/e;t>1.6?(jt(Qe.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(jt(Qe.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(jt(Qe.square),console.log("Applied SQUARE config for ratio:",t)):(jt(Qe.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let o=window;o.configPresets=Qe,o.resolveAnchorVec2=o.resolveAnchorVec2||$e,o.resolveScreenAnchorPoint=o.resolveScreenAnchorPoint||Se,o.resolveScreenRatioPoint=o.resolveScreenRatioPoint||De}var fe=null,Ls=new Map;function ho(o,e,t,i,n,a={}){var N,q,$,H,z,G,Y,V,F,Q,W,K,X,de,ee,we,J,le,ie,se,Ce,Re,Kt,ma,fa,ba,ya,va,wa,xa,Sa,Ea,Aa,Ca,La,ka,Ta,Pa,Ia,Ma,ja,_a,Ra,Oa,za,$a,Da,Ha,Na;let s=(N=a.enableDebugLogs)!=null?N:!1;s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== STARTING LAYOUT CALCULATION ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Screen dimensions:",{width:i.width,height:i.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Time:",t),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Options:",a));let{mainContainer:r,label:l,background:c,backgroundTexture:d,app:p}=o;if(!p||!p.renderer){s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] \u274C No app or renderer, skipping layout");return}s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] App renderer dimensions:",{width:p.renderer.width,height:p.renderer.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] App screen dimensions:",{width:p.screen.width,height:p.screen.height}));let u=i.width,g=i.height;s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Base dimensions:",{baseWidth:u,baseHeight:g});let h=u*ae.layout.screen_scale_x,m=g*ae.layout.screen_scale_y,f=u/2,b=e.engine.runtime||{},y=b.layout||{};s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug config:",{screen_scale_x:ae.layout.screen_scale_x,screen_scale_y:ae.layout.screen_scale_y}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Calculated dimensions:",{width:h,height:m,midX:f}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Engine runtime:",b),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Layout config:",y));let w=m>h,v=(q=y.design_width_portrait)!=null?q:w?400:600,T=($=y.design_height_portrait)!=null?$:w?600:400,P=Math.min(h/v,m/T);P=Math.min(P,1.15);let _=P*((H=ae.engine.scale)!=null?H:1),I=(z=a.skipMainContainerTransform)!=null?z:!1;!I&&r&&r.scale&&(typeof r.scale.set=="function"?r.scale.set(_):(r.scale.x=_,r.scale.y=_));let j=(G=y.main_container_anchor)!=null?G:"center",L=(Y=y.main_container_position_ratio)!=null?Y:{x:.5,y:.5},S=(V=y.main_container_offset)!=null?V:{x:0,y:0},x=y.main_container_position_ratio?De(u,g,L):Se(u,g,j),E=x.x+S.x+ae.layout.position_offset.x,A=x.y+S.y+ae.layout.position_offset.y;if(!I&&r&&r.position&&(typeof r.position.set=="function"?r.position.set(E,A):(r.position.x=E,r.position.y=A)),n&&(r!=null&&r.toLocal)){let ue=g>u,me=(F=y.design_width_portrait)!=null?F:ue?320:480,ce=(Q=y.design_height_portrait)!=null?Q:ue?480:320;for(let[Le,ke]of e.objects.entries()){let he=ke==null?void 0:ke.transform;if(!he||((W=he.position_mode)!=null?W:"static")!=="static")continue;let Z=(K=n.get)==null?void 0:K.call(n,Le),kt=((X=Z==null?void 0:Z.getDisplayObject)==null?void 0:X.call(Z))||(Z==null?void 0:Z.pixiObject)||Z;if(!kt||kt.parent!==r)continue;let Oe=(de=he.anchor)!=null?de:"bottom-left";Oe==="bottom-left"&&he.anchor==null&&console.log("[DEBUG FALLBACK] LayoutManager transform.anchor \u2192 bottom-left");let nt=he.position_ratio!=null?De(me,ce,he.position_ratio):Se(me,ce,Oe),at=(ee=he.position)!=null?ee:{x:0,y:0},Tt=nt.x-me/2+at.x,Je=nt.y-ce/2+at.y;typeof(Z==null?void 0:Z.setPosition)=="function"?Z.setPosition(Tt,Je):(Ee(kt,Tt,Je),(we=Z==null?void 0:Z.transform)!=null&&we.position&&(Z.transform.position.x=Tt,Z.transform.position.y=Je))}}let C=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,R=((C==null?void 0:C.buildMode)||(typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"dev"))==="dev";if(ae.layout.debug_rect_visible&&R){(!fe||fe.parent!==p.stage)&&(fe==null||fe.destroy(),fe=new Wr,fe.zIndex=9999,p.stage.addChild(fe)),fe.clear();let ue=ae.layout.debug_rect_scale_x,me=ae.layout.debug_rect_scale_y,ce=(u-4)*ue,Le=(g-4)*me,ke=(u-ce)/2,he=(g-Le)/2;s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== DEBUG RECT POSITIONING ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect calculations:",{baseWidth:u,baseHeight:g,rectW:ce,rectH:Le,offsetX:ke,offsetY:he}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect final position:",{x:2+ke,y:2+he,width:ce,height:Le})),fe.rect(2+ke,2+he,ce,Le).stroke({width:ae.layout.debug_rect_thickness,color:ae.layout.debug_rect_color})}else fe&&(fe.destroy(),fe=null);let M=((J=o.label)==null?void 0:J.config)||e.objects.get("label_1")||e.objects.get("ui_tutorial_1");if(l&&l.position&&M){let ue=(ie=(le=M==null?void 0:M.transform)==null?void 0:le.anchor)!=null?ie:"center",me=(se=M==null?void 0:M.transform)==null?void 0:se.position_ratio,ce=((Ce=M==null?void 0:M.transform)==null?void 0:Ce.offset)||{x:0,y:0};bn(l,u,g,{anchor:ue,positionRatio:me,offset:{x:ce.x*_,y:ce.y*_},renderAnchor:$e(ue)})}if(l&&l.alpha>0){let ue=1+Math.sin(t*ae.engine.label_pulse_speed)*ae.engine.label_pulse_intensity,me=(Kt=(Re=M==null?void 0:M.transform)==null?void 0:Re.scale)!=null?Kt:1,ce=ue*_*me;l.scale&&(typeof l.scale.set=="function"?l.scale.set(ce):(l.scale.x=ce,l.scale.y=ce))}s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== BACKGROUND POSITIONING =====");let O=c?e.objects.get("background_1"):null,D=!!O&&(c==null?void 0:c.parent)===r;if(c&&!D){s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background object exists:",!!c),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background type:",(ma=c.constructor)==null?void 0:ma.name)),c.alpha=((ba=(fa=b.background)==null?void 0:fa.alpha)!=null?ba:.98)*ae.engine.background_alpha,s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background alpha set to:",c.alpha),s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background config:",O);let ue=(O==null?void 0:O.transform)||{};s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background transform:",ue);let me=ue.offset||{x:0,y:0},ce=((va=(ya=b.background)==null?void 0:ya.offset_y)!=null?va:0)+ae.engine.background_offset_y,Le=(wa=ue.anchor)!=null?wa:"center",ke=ue.position_ratio;if(s&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background positioning params:",{bgOffset:me,bgRuntimeOffsetY:ce,bgScreenAnchor:Le,bgPositionRatio:ke,baseWidth:u,baseHeight:g,finalScale:_}),bn(c,u,g,{anchor:Le,positionRatio:ke,offset:{x:me.x*_,y:me.y*_+ce},renderAnchor:$e(Le)}),s&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background position after applyScreenAnchor:",{x:c.x,y:c.y,scaleX:(xa=c.scale)==null?void 0:xa.x,scaleY:(Sa=c.scale)==null?void 0:Sa.y,anchorX:(Ea=c.anchor)==null?void 0:Ea.x,anchorY:(Aa=c.anchor)==null?void 0:Aa.y,pivotX:(Ca=c.pivot)==null?void 0:Ca.x,pivotY:(La=c.pivot)==null?void 0:La.y,width:c.width,height:c.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background texture dimensions:",{textureWidth:d==null?void 0:d.width,textureHeight:d==null?void 0:d.height})),d){let nt=Math.max(h/d.width,m/d.height),at=(Ta=(ka=b.background)==null?void 0:ka.scale_multiplier)!=null?Ta:1.05,Tt=(Pa=ue.scale)!=null?Pa:1,Je=nt*at*ae.engine.background_scale*Tt;c.scale&&(typeof c.scale.set=="function"?c.scale.set(Je):(c.scale.x=Je,c.scale.y=Je))}else c&&typeof c.clear=="function"&&(c.clear(),c.rect(-h/2,-m/2,h,m).fill({color:1444375}));let he=`${u}x${g}`,te=Ls.get(he),Z={x:Number((Ia=c.x)!=null?Ia:0),y:Number((Ma=c.y)!=null?Ma:0),scaleX:Number((_a=(ja=c.scale)==null?void 0:ja.x)!=null?_a:1),scaleY:Number((Oa=(Ra=c.scale)==null?void 0:Ra.y)!=null?Oa:1),rotation:Number.isFinite(c.rotation)?c.rotation:void 0,anchorX:Number.isFinite((za=c.anchor)==null?void 0:za.x)?c.anchor.x:void 0,anchorY:Number.isFinite(($a=c.anchor)==null?void 0:$a.y)?c.anchor.y:void 0,pivotX:Number.isFinite((Da=c.pivot)==null?void 0:Da.x)?c.pivot.x:void 0,pivotY:Number.isFinite((Ha=c.pivot)==null?void 0:Ha.y)?c.pivot.y:void 0},kt=Number.isFinite(Z.x)&&Number.isFinite(Z.y)&&Number.isFinite(Z.scaleX)&&Number.isFinite(Z.scaleY),Oe=Z;if(te){let nt=Math.hypot(Z.x-te.x,Z.y-te.y),at=Math.max(u,g)*.5;(!kt||nt>at)&&((Na=c.position)!=null&&Na.set?c.position.set(te.x,te.y):(c.x=te.x,c.y=te.y),c.scale&&(typeof c.scale.set=="function"?c.scale.set(te.scaleX,te.scaleY):(c.scale.x=te.scaleX,c.scale.y=te.scaleY)),Number.isFinite(te.rotation)&&typeof c.rotation=="number"&&(c.rotation=te.rotation),c.anchor&&Number.isFinite(te.anchorX)&&Number.isFinite(te.anchorY)&&c.anchor.set(te.anchorX,te.anchorY),c.pivot&&Number.isFinite(te.pivotX)&&Number.isFinite(te.pivotY)&&c.pivot.set(te.pivotX,te.pivotY),Oe=te)}Number.isFinite(Oe.x)&&Number.isFinite(Oe.y)&&Number.isFinite(Oe.scaleX)&&Number.isFinite(Oe.scaleY)&&Ls.set(he,Oe)}}var ki=class{constructor(){this.typeDetector=new li,this.imageRenderer=new ci,this.colorRenderer=new di,this.numberRenderer=new pi,this.textRenderer=new ui,this.booleanRenderer=new gi,this.arrayRenderer=new hi(this),this.objectRenderer=new mi(this),this.selectRenderer=new fi,this.jsonRenderer=new bi,this.spawnPointsRenderer=new yi,this.spawnTemplatesRenderer=new vi(this)}getObjectIds(){try{let e=window,t=e==null?void 0:e.__editableConfig;if(!(t!=null&&t.objects))return[];let i=[];if(t.objects instanceof Map)for(let n of t.objects.keys())i.push(n);else typeof t.objects=="object"&&i.push(...Object.keys(t.objects));return i.sort()}catch{return[]}}getEnumOptionsFromSchemas(e){var t;try{let i=window,n=i==null?void 0:i.__editableConfig,a=n==null?void 0:n.schemas;if(!a)return null;let s=String(e||"").split(".").filter(Boolean);if(s.length<2)return null;let r=s[0],l=s.slice(1).join("."),c=a instanceof Map?a.get(r):a==null?void 0:a[r];if(!c)return null;let d=(t=c==null?void 0:c.types)==null?void 0:t[l];if(typeof d!="string"||!d.startsWith("enum:"))return null;let u=d.slice(5).split("|").map(g=>g.trim()).filter(Boolean);return u.length?u:null}catch{return null}}getLogicOptions(){try{let e=window,t=Array.isArray(e==null?void 0:e.__HANDLER_LOGIC_OPTIONS)?e.__HANDLER_LOGIC_OPTIONS:[],n=[...["DragToWin","SwerveMove","DragSnap","JoystickMove","DrawCanvas","HtmlComponent"],...t].map(a=>String(a)).filter(a=>a.trim().length>0);return Array.from(new Set(n)).sort((a,s)=>a.localeCompare(s))}catch{return[]}}renderProperty(e,t,i,n){let a=t.toLowerCase(),s=a==="logic"||a==="logic_id"||a==="logicid",r=a==="id"&&n.toLowerCase().includes("logic");if((s||r)&&typeof i=="string"){let h=this.getLogicOptions(),m=this.selectRenderer.render(e,t,i,n,h);return s?`
|
|
1073
1083
|
${m}
|
|
1074
1084
|
<div class="inspector-array-actions">
|
|
1075
1085
|
<button class="inspector-button"
|
|
@@ -1206,7 +1216,7 @@ ${m}
|
|
|
1206
1216
|
<span class="inspector-empty-icon">\u26A0\uFE0F</span>
|
|
1207
1217
|
<span class="inspector-empty-text">${e}</span>
|
|
1208
1218
|
</div>
|
|
1209
|
-
`)}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}getDefaultLogicId(){try{let e=window,t=Array.isArray(e==null?void 0:e.__HANDLER_LOGIC_OPTIONS)?e.__HANDLER_LOGIC_OPTIONS:[],i=["SwerveMove","DragSnap","JoystickMove","DragToWin","DrawCanvas"],n=[...t,...i].map(a=>String(a)).filter(a=>a.trim().length>0);return n.length?n[0]:"SwerveMove"}catch{return"SwerveMove"}}getDefaultPropsForLogic(e,t){return{DragToWin:{targetDrags:3},DragSnap:{targetId:"",snapRadius:100,snapDuration:.5,returnOnMiss:!0,returnDuration:.3,ease:"power2.out"},SwerveMove:{speed:5,sensitivity:1,directionMode:"dominantAxis",axis:"both",bounds:{left:-400,right:400,top:-300,bottom:300}},JoystickMove:{speed:200,zone:"bottom-center",offsetX:0,offsetY:-50,inputId:""},Tap:{maxTapDuration:300,maxTapDistance:10,tapCount:1,tapTimeout:500},TapDestroy:{maxTapDuration:300,maxTapDistance:10,particleEffect:"sparkle",particleScale:1,particleColor:"",destroySound:"",autoDestroy:!0,animate:!0,animationDurationMs:180,ease:"power2.out"},ScratchCard:{revealId:"",maskTextureSize:512,brushRadius:18,brushSpacing:8,completionThreshold:.65,progressGridSize:32,completeOnce:!0,autoDisableOnComplete:!0,autoHideCoverOnComplete:!0,progressEvent:"logic:scratch-progress",completeEvent:"logic:scratch-complete",scratchParticleEffect:"",scratchParticleIntervalMs:45,scratchParticleScale:1,completeParticleEffect:"",completeParticleBurstCount:14,completeParticleBurstRadius:60,completeParticleScale:1,completeSound:"",completePunchScale:1.08,completePunchDurationMs:240},DrawCanvas:{textureSize:512,canvasWidth:200,canvasHeight:200,lineWidth:8,lineSpacing:4,lineColor:"#000000",lineAlpha:1,backgroundColor:null,backgroundAlpha:1,clearOnStart:!0,enabled:!0},HandHint:{targetId:"",offset:{x:44,y:44},clickOffset:{x:-8,y:-8},clickScale:.92,clickDurationMs:160,delayMs:700,repeatDelayMs:1200,easing:"power2.out",enabled:!0},Swipe:{inputId:"",direction:"any",minDistance:50,maxDuration:1e3},Hold:{holdDuration:500,visualFeedback:!0,feedbackColor:16777215},Collectable:{targetId:"",collectRadius:50,particleEffect:"",particleScale:1,particleColor:"",autoDestroy:!0,collectSound:"",animateOnCollect:!1,collectAnimDurationMs:160,collectAnimScaleTo:.2,collectAnimAlphaTo:0,collectAnimEase:"power2.out"},ScoreHud:{prefix:"Score: ",initialScore:0,maxScore:null,events:[{name:"logic:collect",delta:1},{name:"logic:tap-destroy",delta:1}]},Spawner:{templateId:"",spawnPattern:"continuous",spawnRate:1e3,poolSize:20,returnOnInvisible:!1,positionSource:"spawner",targetId:"",targetOffset:{x:0,y:0},customPosition:{x:0,y:0},randomBounds:{x:[-100,100],y:[-100,100]},spawnPoints:[],spawnPointMode:"cycle",movementMode:"velocity",velocity:{x:0,y:-300},velocityRange:{x:null,y:null},lifetime:2e3,waveSize:5,waveDelay:2e3,burstCount:5},Damageable:{hitTemplateId:"",hitRadius:50,hp:1,invulnMs:150,flashAlpha:.3,flashDurationMs:100,hitScale:1,hitScaleDurationMs:120,knockback:{x:0,y:0},hpLabelId:"",autoDestroy:!0,hitEffect:"",destroyEffect:"",particleScale:1,particleColor:"",destroySound:"",hitEvent:"",destroyEvent:"",hitPopupText:"",hitPopupColor:"#ffffff",hitPopupFontSize:20,hitPopupDurationMs:600,hitPopupOffset:{x:0,y:-20},hitPopupRise:30,hitPopupTemplateId:""}}[e]||{}}getSectionIcon(e){return{identity:"\u{1F194}",transform:"\u{1F4D0}",render:"\u{1F3A8}",ui:"\u{1F4AC}",logic:"\u{1F3AE}",gameplay:"\u{1F3AE}",interaction:"\u{1F446}",audio:"\u{1F50A}",effects:"\u2728",motion:"\u{1F3AC}"}[e]||"\u{1F4E6}"}clear(){this.selectedObjectId=null,this.contentContainer&&(this.contentContainer.innerHTML=`
|
|
1219
|
+
`)}formatLabel(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase())}getDefaultLogicId(){try{let e=window,t=Array.isArray(e==null?void 0:e.__HANDLER_LOGIC_OPTIONS)?e.__HANDLER_LOGIC_OPTIONS:[],i=["SwerveMove","DragSnap","JoystickMove","DragToWin","DrawCanvas","HtmlComponent"],n=[...t,...i].map(a=>String(a)).filter(a=>a.trim().length>0);return n.length?n[0]:"SwerveMove"}catch{return"SwerveMove"}}getDefaultPropsForLogic(e,t){return{DragToWin:{targetDrags:3},DragSnap:{targetId:"",snapRadius:100,snapDuration:.5,returnOnMiss:!0,returnDuration:.3,ease:"power2.out"},SwerveMove:{speed:5,sensitivity:1,directionMode:"dominantAxis",axis:"both",bounds:{left:-400,right:400,top:-300,bottom:300}},JoystickMove:{speed:200,zone:"bottom-center",offsetX:0,offsetY:-50,inputId:""},Tap:{maxTapDuration:300,maxTapDistance:10,tapCount:1,tapTimeout:500},TapDestroy:{maxTapDuration:300,maxTapDistance:10,particleEffect:"sparkle",particleScale:1,particleColor:"",destroySound:"",autoDestroy:!0,animate:!0,animationDurationMs:180,ease:"power2.out"},ScratchCard:{revealId:"",maskTextureSize:512,brushRadius:18,brushSpacing:8,completionThreshold:.65,progressGridSize:32,completeOnce:!0,autoDisableOnComplete:!0,autoHideCoverOnComplete:!0,progressEvent:"logic:scratch-progress",completeEvent:"logic:scratch-complete",scratchParticleEffect:"",scratchParticleIntervalMs:45,scratchParticleScale:1,completeParticleEffect:"",completeParticleBurstCount:14,completeParticleBurstRadius:60,completeParticleScale:1,completeSound:"",completePunchScale:1.08,completePunchDurationMs:240},DrawCanvas:{textureSize:512,canvasWidth:200,canvasHeight:200,lineWidth:8,lineSpacing:4,lineColor:"#000000",lineAlpha:1,backgroundColor:null,backgroundAlpha:1,clearOnStart:!0,enabled:!0},HtmlComponent:{enabled:!0},HandHint:{targetId:"",offset:{x:44,y:44},clickOffset:{x:-8,y:-8},clickScale:.92,clickDurationMs:160,delayMs:700,repeatDelayMs:1200,easing:"power2.out",enabled:!0},Swipe:{inputId:"",direction:"any",minDistance:50,maxDuration:1e3},Hold:{holdDuration:500,visualFeedback:!0,feedbackColor:16777215},Collectable:{targetId:"",collectRadius:50,particleEffect:"",particleScale:1,particleColor:"",autoDestroy:!0,collectSound:"",animateOnCollect:!1,collectAnimDurationMs:160,collectAnimScaleTo:.2,collectAnimAlphaTo:0,collectAnimEase:"power2.out"},ScoreHud:{prefix:"Score: ",initialScore:0,maxScore:null,events:[{name:"logic:collect",delta:1},{name:"logic:tap-destroy",delta:1}]},Spawner:{templateId:"",spawnPattern:"continuous",spawnRate:1e3,poolSize:20,returnOnInvisible:!1,positionSource:"spawner",targetId:"",targetOffset:{x:0,y:0},customPosition:{x:0,y:0},randomBounds:{x:[-100,100],y:[-100,100]},spawnPoints:[],spawnPointMode:"cycle",movementMode:"velocity",velocity:{x:0,y:-300},velocityRange:{x:null,y:null},lifetime:2e3,waveSize:5,waveDelay:2e3,burstCount:5},Damageable:{hitTemplateId:"",hitRadius:50,hp:1,invulnMs:150,flashAlpha:.3,flashDurationMs:100,hitScale:1,hitScaleDurationMs:120,knockback:{x:0,y:0},hpLabelId:"",autoDestroy:!0,hitEffect:"",destroyEffect:"",particleScale:1,particleColor:"",destroySound:"",hitEvent:"",destroyEvent:"",hitPopupText:"",hitPopupColor:"#ffffff",hitPopupFontSize:20,hitPopupDurationMs:600,hitPopupOffset:{x:0,y:-20},hitPopupRise:30,hitPopupTemplateId:""}}[e]||{}}getSectionIcon(e){return{identity:"\u{1F194}",transform:"\u{1F4D0}",render:"\u{1F3A8}",ui:"\u{1F4AC}",logic:"\u{1F3AE}",gameplay:"\u{1F3AE}",interaction:"\u{1F446}",audio:"\u{1F50A}",effects:"\u2728",motion:"\u{1F3AC}"}[e]||"\u{1F4E6}"}clear(){this.selectedObjectId=null,this.contentContainer&&(this.contentContainer.innerHTML=`
|
|
1210
1220
|
<div class="inspector-empty">
|
|
1211
1221
|
<span class="inspector-empty-icon">\u{1F3AF}</span>
|
|
1212
1222
|
<span class="inspector-empty-text">Select an object to inspect</span>
|