handler-playable-sdk 0.3.38 → 0.3.40
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-RWZ2NPID.js → chunk-6OPDY4ZF.js} +6 -6
- 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.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 +6 -6
- package/dist/index.js +1 -1
- package/dist/pixi/index.cjs +2 -2
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +1 -1
- package/dist/three/index.js +1 -1
- package/package.json +2 -2
package/dist/pixi/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Fs={};Xn(Fs,{AssetCache:()=>ee,AssetLoader:()=>fe,AssetSystem:()=>Rt,AssetTextures:()=>he,Assets:()=>fa,BaseSystem:()=>ze,GameEngine:()=>It,GameObject:()=>lt,GameObjectManager:()=>De,ObjectFactory:()=>me,Renderer:()=>ot,RuntimeObjectRegistry:()=>Ne,Transform:()=>rt,applyScreenAnchor:()=>$t,basePixi:()=>da,clearResponsiveElements:()=>ma,createPixiBase:()=>kt,getRegisteredFontIds:()=>ra,globalResponsiveMultipliers:()=>dt,initAssetTextures:()=>St,initAssets:()=>ha,layout:()=>ya,playLottieOverlay:()=>la,registerFont:()=>sa,registerType:()=>Et,resolveAnchorVec2:()=>pt,resolveFont:()=>ia,resolveFontWeight:()=>aa,resolveScreenAnchorPoint:()=>He,resolveScreenRatioPoint:()=>Be,runInitSequence:()=>va,setLottieInstance:()=>Ct,spawnSceneFromConfig:()=>ua,updateScreenState:()=>Dt});module.exports=Ca(Fs);var na=require("pixi.js");var pe={};function bt(n,e,t=!1){pe[n]||(pe[n]=[]),pe[n].push({fn:e,once:t})}function Ut(n,e){if(pe[n]){if(!e){delete pe[n];return}pe[n]=pe[n].filter(t=>t.fn!==e)}}function yt(n,...e){let t=pe[n];if(t)for(let i of[...t])i.fn(...e),i.once&&Ut(n,i.fn)}function q(n,e){bt(n,e,!0)}var D=null,K=[],Ce=null;function ei(n){D=n,K=[],Ce!==null&&(clearTimeout(Ce),Ce=null)}function ti(){var n,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(n=D==null?void 0:D.batchSize)!=null?n:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Zn(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function qt(n,e){let t=ti();if(e&&t.endpoint){if(K.push(n),K.length>t.maxQueue&&(K=K.slice(K.length-t.maxQueue)),K.length>=t.batchSize){Qn();return}Ce===null&&(Ce=window.setTimeout(()=>{Ce=null,Qn()},t.flushIntervalMs))}}async function Qn(){let n=ti();if(!n.endpoint||K.length===0)return;let e=K.splice(0,n.batchSize);await Zn(n.endpoint,{events:e},n.transport,n.debug),K.length>0&&await Zn(n.endpoint,{events:K.splice(0,n.batchSize)},n.transport,n.debug)}function ni(n){return Math.max(0,Math.min(1,n))}function La(n){let e=String(n!=null?n:"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 a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Xe(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ta(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function ii(n,e,t){try{n[e]=t}catch{}}function _a(n){let e=n==null?void 0:n.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 ai(n,e){let t=n==null?void 0:n.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 si(n,e){let t=_a(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function ri(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),n.size>0&&i()})},a=u=>{var p;n.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),i()},s=u=>{n.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},r=u=>{u.killed||(u.killed=!0,s(u))},o=()=>{var l,p;let u=Xe();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,A=ni(h),b=g.repeat>=0?g.repeat+1:1,f=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let y=h-f;A=ni(y)}let x=g.ease(A);g.yoyo&&f%2===1&&(x=1-x);for(let y of g.props)ii(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&ai(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(h>=b){r(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),h=La(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,f=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let O of Object.keys(l)){if(f.has(O))continue;let j=l[O];typeof j=="number"&&x.push({key:O,from:Ta(u,O),to:j})}let w=si(u,l);return{target:u,startMs:Xe(),delayMs:m,durationMs:g,ease:h,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>r(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Xe())},resume:()=>{var h;if(!p.paused)return;let g=(h=p.pauseAtMs)!=null?h:Xe(),m=Xe()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&ii(u,g,m)}let p=si(u,l);p.to&&ai(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))r(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],h=f=>{if(typeof f=="number")return Math.max(0,f*1e3);let x=typeof f=="string"?f.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=f=>{l.push(f);let x=Math.max(0,(typeof f.vars.duration=="number"?f.vars.duration:.5)*1e3);p=Math.max(p,f.atMs+x)},b={to(f,x,w){return A({kind:"to",target:f,vars:x,atMs:h(w)}),b},fromTo(f,x,w,y){return A({kind:"fromTo",target:f,vars:w,from:x,atMs:h(y)}),b},play(){var f,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(f=w.from)!=null?f:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let f of m)f.pause();return b},kill(){for(let f of m)f.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function oi(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=ri()}catch{}}var li={name:"handler-playable-sdk",version:"0.3.38",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 && 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/ && chmod +x dist/cli/*.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 && 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; 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 V=0,Ma=V++,ci=V++,di=V++,pi=V++,ui=V++,gi=V++,fi=V++,hi=V++,mi=V++,bi=V++,yi=V++,vi=V++,M=Ma;function xi(){return M===ci}function wi(){return M===di}function Ei(){return M===pi}function Ai(){return M===ui}function Le(){return M===gi}function Te(){return M===fi}function Si(){return M===hi}function Ci(){return M===mi}function Li(){return M===bi}function Vt(){return M===yi}function Wt(){return M===vi}function Ti(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),M=ci;return}catch{}else if(n==="dapi")try{dapi.isReady(),M=di;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(M=pi)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(M=ui)}catch{}else if(e==="mintegral")window.gameReady&&(M=gi);else if(e==="tapjoy")window.TJ_API&&(M=fi);else if(e==="tiktok")window.openAppStore&&(M=hi);else if(e==="smadex")try{window.smxTracking&&(M=mi)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(M=bi)}catch{}else e==="vungle"?M=yi:(n==="nucleo"||e==="nucleo")&&(M=vi)}var vt=mt(require("lottie-web"),1),_i=vt.default;typeof window!="undefined"&&(window.lottie=vt.default,window.__baseLottie=vt.default);Xt();function $(n,e){let t=(a,s)=>s===0?a:t(s,a%s),i=t(n,e);return`${n/i}:${e/i}`}var wr=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],Er=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],Ar=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],Oi=[{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:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var Sr=[...Oi];var za=Oi[0];ue();var qa=mt(require("jszip"),1);function Fa(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Ga(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function Ua(n){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=n})}async function Jt(n){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",n);let i=await fetch(n);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,n),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await Fa(a),r=await Ua(s),o=Ga(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(t=r==null?void 0:r.height)!=null?t:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function xt(n,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=n}),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),n;a.drawImage(t,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(l=>({r:r[l.offset],g:r[l.offset+1],b:r[l.offset+2]})),c=0;for(let l=0;l<r.length;l+=4){let p=r[l],g=r[l+1],m=r[l+2],h=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){h=!0;break}h&&(r[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),n}}var Ii=require("@google/genai");async function Zt(n,e,t=[],i={}){var a,s,r,o,d,c,u;try{if(!(n!=null&&n.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let f=t[b];if(!f.base64||!f.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(f.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!f.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${f.mimeType}`)}let l=new Ii.GoogleGenAI({apiKey:n}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,f)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${f+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),h="",A=(r=(s=(a=m.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(A)for(let b of A)b.text&&(h+=b.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(l){throw console.error("[Gemini] API error:",l),(o=l.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(d=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var Ri=require("@google/genai");async function wt(n,e,t=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ri.GoogleGenAI({apiKey:n}),s=[{text:e}];t.length>0&&t.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let d=o.inlineData.data,c=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Ja=require("pixi.js");Je();ue();var Hi=require("pixi.js");var Za=require("pixi.js");ue();function ss(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function rs(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function os(n){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Fs={};Xn(Fs,{AssetCache:()=>ee,AssetLoader:()=>fe,AssetSystem:()=>Rt,AssetTextures:()=>he,Assets:()=>fa,BaseSystem:()=>ze,GameEngine:()=>It,GameObject:()=>lt,GameObjectManager:()=>De,ObjectFactory:()=>me,Renderer:()=>ot,RuntimeObjectRegistry:()=>Ne,Transform:()=>rt,applyScreenAnchor:()=>$t,basePixi:()=>da,clearResponsiveElements:()=>ma,createPixiBase:()=>kt,getRegisteredFontIds:()=>ra,globalResponsiveMultipliers:()=>dt,initAssetTextures:()=>St,initAssets:()=>ha,layout:()=>ya,playLottieOverlay:()=>la,registerFont:()=>sa,registerType:()=>Et,resolveAnchorVec2:()=>pt,resolveFont:()=>ia,resolveFontWeight:()=>aa,resolveScreenAnchorPoint:()=>He,resolveScreenRatioPoint:()=>Be,runInitSequence:()=>va,setLottieInstance:()=>Ct,spawnSceneFromConfig:()=>ua,updateScreenState:()=>Dt});module.exports=Ca(Fs);var na=require("pixi.js");var pe={};function bt(n,e,t=!1){pe[n]||(pe[n]=[]),pe[n].push({fn:e,once:t})}function Ut(n,e){if(pe[n]){if(!e){delete pe[n];return}pe[n]=pe[n].filter(t=>t.fn!==e)}}function yt(n,...e){let t=pe[n];if(t)for(let i of[...t])i.fn(...e),i.once&&Ut(n,i.fn)}function q(n,e){bt(n,e,!0)}var D=null,K=[],Ce=null;function ei(n){D=n,K=[],Ce!==null&&(clearTimeout(Ce),Ce=null)}function ti(){var n,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(n=D==null?void 0:D.batchSize)!=null?n:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Zn(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function qt(n,e){let t=ti();if(e&&t.endpoint){if(K.push(n),K.length>t.maxQueue&&(K=K.slice(K.length-t.maxQueue)),K.length>=t.batchSize){Qn();return}Ce===null&&(Ce=window.setTimeout(()=>{Ce=null,Qn()},t.flushIntervalMs))}}async function Qn(){let n=ti();if(!n.endpoint||K.length===0)return;let e=K.splice(0,n.batchSize);await Zn(n.endpoint,{events:e},n.transport,n.debug),K.length>0&&await Zn(n.endpoint,{events:K.splice(0,n.batchSize)},n.transport,n.debug)}function ni(n){return Math.max(0,Math.min(1,n))}function La(n){let e=String(n!=null?n:"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 a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Xe(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ta(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function ii(n,e,t){try{n[e]=t}catch{}}function _a(n){let e=n==null?void 0:n.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 ai(n,e){let t=n==null?void 0:n.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 si(n,e){let t=_a(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function ri(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),n.size>0&&i()})},a=u=>{var p;n.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),i()},s=u=>{n.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},r=u=>{u.killed||(u.killed=!0,s(u))},o=()=>{var l,p;let u=Xe();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,A=ni(h),b=g.repeat>=0?g.repeat+1:1,f=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let y=h-f;A=ni(y)}let x=g.ease(A);g.yoyo&&f%2===1&&(x=1-x);for(let y of g.props)ii(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&ai(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(h>=b){r(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),h=La(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,f=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let O of Object.keys(l)){if(f.has(O))continue;let j=l[O];typeof j=="number"&&x.push({key:O,from:Ta(u,O),to:j})}let w=si(u,l);return{target:u,startMs:Xe(),delayMs:m,durationMs:g,ease:h,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>r(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Xe())},resume:()=>{var h;if(!p.paused)return;let g=(h=p.pauseAtMs)!=null?h:Xe(),m=Xe()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&ii(u,g,m)}let p=si(u,l);p.to&&ai(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))r(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],h=f=>{if(typeof f=="number")return Math.max(0,f*1e3);let x=typeof f=="string"?f.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=f=>{l.push(f);let x=Math.max(0,(typeof f.vars.duration=="number"?f.vars.duration:.5)*1e3);p=Math.max(p,f.atMs+x)},b={to(f,x,w){return A({kind:"to",target:f,vars:x,atMs:h(w)}),b},fromTo(f,x,w,y){return A({kind:"fromTo",target:f,vars:w,from:x,atMs:h(y)}),b},play(){var f,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(f=w.from)!=null?f:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let f of m)f.pause();return b},kill(){for(let f of m)f.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function oi(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=ri()}catch{}}var li={name:"handler-playable-sdk",version:"0.3.40",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 && 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/ && chmod +x dist/cli/*.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 && 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; 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 V=0,Ma=V++,ci=V++,di=V++,pi=V++,ui=V++,gi=V++,fi=V++,hi=V++,mi=V++,bi=V++,yi=V++,vi=V++,M=Ma;function xi(){return M===ci}function wi(){return M===di}function Ei(){return M===pi}function Ai(){return M===ui}function Le(){return M===gi}function Te(){return M===fi}function Si(){return M===hi}function Ci(){return M===mi}function Li(){return M===bi}function Vt(){return M===yi}function Wt(){return M===vi}function Ti(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),M=ci;return}catch{}else if(n==="dapi")try{dapi.isReady(),M=di;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(M=pi)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(M=ui)}catch{}else if(e==="mintegral")window.gameReady&&(M=gi);else if(e==="tapjoy")window.TJ_API&&(M=fi);else if(e==="tiktok")window.openAppStore&&(M=hi);else if(e==="smadex")try{window.smxTracking&&(M=mi)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(M=bi)}catch{}else e==="vungle"?M=yi:(n==="nucleo"||e==="nucleo")&&(M=vi)}var vt=mt(require("lottie-web"),1),_i=vt.default;typeof window!="undefined"&&(window.lottie=vt.default,window.__baseLottie=vt.default);Xt();function $(n,e){let t=(a,s)=>s===0?a:t(s,a%s),i=t(n,e);return`${n/i}:${e/i}`}var wr=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],Er=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],Ar=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],Oi=[{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:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var Sr=[...Oi];var za=Oi[0];ue();var qa=mt(require("jszip"),1);function Fa(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Ga(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function Ua(n){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=n})}async function Jt(n){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",n);let i=await fetch(n);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,n),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await Fa(a),r=await Ua(s),o=Ga(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(t=r==null?void 0:r.height)!=null?t:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function xt(n,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=n}),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),n;a.drawImage(t,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(l=>({r:r[l.offset],g:r[l.offset+1],b:r[l.offset+2]})),c=0;for(let l=0;l<r.length;l+=4){let p=r[l],g=r[l+1],m=r[l+2],h=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){h=!0;break}h&&(r[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),n}}var Ii=require("@google/genai");async function Zt(n,e,t=[],i={}){var a,s,r,o,d,c,u;try{if(!(n!=null&&n.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let f=t[b];if(!f.base64||!f.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(f.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!f.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${f.mimeType}`)}let l=new Ii.GoogleGenAI({apiKey:n}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,f)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${f+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),h="",A=(r=(s=(a=m.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(A)for(let b of A)b.text&&(h+=b.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(l){throw console.error("[Gemini] API error:",l),(o=l.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(d=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var Ri=require("@google/genai");async function wt(n,e,t=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ri.GoogleGenAI({apiKey:n}),s=[{text:e}];t.length>0&&t.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let d=o.inlineData.data,c=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Ja=require("pixi.js");Je();ue();var Hi=require("pixi.js");var Za=require("pixi.js");ue();function ss(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function rs(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function os(n){return`
|
|
47
47
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
48
48
|
|
|
49
49
|
Provide a concise summary (2-3 sentences) covering:
|
|
@@ -226,7 +226,7 @@ Style guidelines: ${i.summary}`;this.promptInput.value=a,this.currentPrompt=a}}c
|
|
|
226
226
|
<button class="asset-crop-apply primary" data-action="apply">Apply Crop</button>
|
|
227
227
|
</div>
|
|
228
228
|
</div>
|
|
229
|
-
`,this.modal=e,this.attachEventListeners(),this.initializeCanvas()}initializeCanvas(){this.modal&&(this.canvas=this.modal.querySelector(".asset-crop-canvas"),this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.canvas.width=400,this.canvas.height=300))}loadImage(){this.options&&(this.image=new Image,this.image.crossOrigin="anonymous",this.image.onload=()=>{this.initializeCrop(),this.render()},this.image.src=this.options.imageSrc)}initializeCrop(){var i;if(!this.image||!this.canvas)return;let e=this.image.width/this.image.height,t=this.canvas.width/this.canvas.height;e>t?(this.cropHeight=this.image.height,this.cropWidth=this.cropHeight*t,this.cropX=(this.image.width-this.cropWidth)/2,this.cropY=0):(this.cropWidth=this.image.width,this.cropHeight=this.cropWidth/t,this.cropX=0,this.cropY=(this.image.height-this.cropHeight)/2),(i=this.options)!=null&&i.aspectRatio&&this.applyAspectRatio(this.options.aspectRatio),this.fitToCanvas()}applyAspectRatio(e){if(!this.image)return;let t=this.image.width/this.image.height,i=this.cropX+this.cropWidth/2,a=this.cropY+this.cropHeight/2;e>t?(this.cropWidth=Math.min(this.image.width,this.cropHeight*e),this.cropHeight=this.cropWidth/e):(this.cropHeight=Math.min(this.image.height,this.cropWidth/e),this.cropWidth=this.cropHeight*e),this.cropX=Math.max(0,Math.min(this.image.width-this.cropWidth,i-this.cropWidth/2)),this.cropY=Math.max(0,Math.min(this.image.height-this.cropHeight,a-this.cropHeight/2))}fitToCanvas(){if(!this.image||!this.canvas)return;let e=this.canvas.width/this.cropWidth,t=this.canvas.height/this.cropHeight;this.scale=Math.min(e,t)*.9,this.panX=(this.canvas.width-this.cropWidth*this.scale)/2,this.panY=(this.canvas.height-this.cropHeight*this.scale)/2}render(){!this.ctx||!this.image||!this.canvas||(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.save(),this.ctx.translate(this.panX,this.panY),this.ctx.scale(this.scale,this.scale),this.ctx.drawImage(this.image,-this.cropX,-this.cropY,this.image.width,this.image.height),this.ctx.restore(),this.drawCropOverlay(),this.updatePreview())}drawCropOverlay(){if(!this.ctx||!this.canvas)return;let e=this.panX,t=this.panY,i=this.cropWidth*this.scale,a=this.cropHeight*this.scale;this.ctx.fillStyle="rgba(0, 0, 0, 0.5)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.clearRect(e,t,i,a),this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2,this.ctx.strokeRect(e,t,i,a),this.ctx.fillStyle="#ffffff";let s=8;[[e,t],[e+i-s,t],[e,t+a-s],[e+i-s,t+a-s]].forEach(([o,d])=>{var c;(c=this.ctx)==null||c.fillRect(o,d,s,s)})}updatePreview(){if(!this.modal||!this.image)return;let e=this.modal.querySelector(".asset-crop-preview-canvas");if(!e)return;let t=e.getContext("2d");if(!t)return;let i=150;e.width=i,e.height=i;let a=i/this.cropWidth,s=i/this.cropHeight,r=Math.min(a,s),o=this.cropWidth*r,d=this.cropHeight*r,c=(i-o)/2,u=(i-d)/2;t.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,c,u,o,d)}attachEventListeners(){if(!this.modal||!this.canvas)return;this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),this.canvas.addEventListener("wheel",this.handleWheel.bind(this)),this.canvas.addEventListener("touchstart",this.handleTouchStart.bind(this)),this.canvas.addEventListener("touchmove",this.handleTouchMove.bind(this)),this.canvas.addEventListener("touchend",this.handleTouchEnd.bind(this));let e=this.modal.querySelector(".asset-crop-zoom-slider");e==null||e.addEventListener("input",i=>{let a=parseFloat(i.target.value);this.setZoom(a)});let t=this.modal.querySelector(".asset-crop-aspect-select");t==null||t.addEventListener("change",i=>{let a=i.target.value;this.setAspectRatio(a)}),this.modal.addEventListener("click",i=>{switch(i.target.dataset.action){case"reset":this.reset();break;case"apply":this.applyCrop();break;case"cancel":case"close":this.close();break}}),this.modal.addEventListener("click",i=>{i.target===this.modal&&this.close()})}handleMouseDown(e){this.isDragging=!0,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.lastPanX=this.panX,this.lastPanY=this.panY,this.canvas.style.cursor="grabbing"}handleMouseMove(e){if(!this.isDragging)return;let t=e.clientX-this.dragStartX,i=e.clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+i,this.constrainPan(),this.render()}handleMouseUp(){this.isDragging=!1,this.canvas.style.cursor="grab"}handleWheel(e){e.preventDefault();let t=e.deltaY>0?.9:1.1;this.setZoom(this.scale*t)}handleTouchStart(e){e.touches.length===1&&(this.isDragging=!0,this.dragStartX=e.touches[0].clientX,this.dragStartY=e.touches[0].clientY,this.lastPanX=this.panX,this.lastPanY=this.panY)}handleTouchMove(e){if(!this.isDragging||e.touches.length!==1)return;e.preventDefault();let t=e.touches[0].clientX-this.dragStartX,i=e.touches[0].clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+i,this.constrainPan(),this.render()}handleTouchEnd(){this.isDragging=!1}setZoom(e){this.scale=Math.max(.1,Math.min(3,e)),this.updateZoomUI(),this.constrainPan(),this.render()}setAspectRatio(e){let t;switch(e){case"1:1":t=1;break;case"4:3":t=4/3;break;case"16:9":t=16/9;break;case"3:2":t=3/2;break;default:t=void 0}t&&this.applyAspectRatio(t),this.fitToCanvas(),this.render()}updateZoomUI(){if(!this.modal)return;let e=this.modal.querySelector(".asset-crop-zoom-value"),t=this.modal.querySelector(".asset-crop-zoom-slider");e&&(e.textContent=`${this.scale.toFixed(1)}x`),t&&(t.value=this.scale.toString())}constrainPan(){if(!this.canvas)return;let e=this.cropWidth*this.scale,t=this.cropHeight*this.scale;this.panX=Math.max(this.canvas.width-e,Math.min(0,this.panX)),this.panY=Math.max(this.canvas.height-t,Math.min(0,this.panY))}reset(){this.initializeCrop(),this.render()}applyCrop(){var a;if(!this.image||!((a=this.options)!=null&&a.onCrop))return;let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;e.width=this.cropWidth,e.height=this.cropHeight,t.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.cropWidth,this.cropHeight);let i=e.toDataURL("image/png");this.options.onCrop(i),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal);let e=this.options;this.modal=null,this.canvas=null,this.ctx=null,this.image=null,this.options=null,e!=null&&e.onCancel&&e.onCancel()}};window.openAssetCrop=function(n){new pn().open(n)};ue();var Ze=require("pixi.js");At();var cs=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",un=cs;if(typeof window!="undefined")try{let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);e!=null&&e.buildMode&&(un=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${un}`))}}catch{}var me=class{static async create(e,t,i){var d,c,u,l,p,g,m;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${un}`);let a=(d=t==null?void 0:t.render)==null?void 0:d.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ze.Container;return this.applyTransform(h,t==null?void 0:t.transform,t),h}let s=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await fe.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(u=r==null?void 0:r.constructor)==null?void 0:u.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ze.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(l=o==null?void 0:o.constructor)==null?void 0:l.name),this.applyTransform(o,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(p=r==null?void 0:r.constructor)==null?void 0:p.name,r),r&&(((g=r.constructor)==null?void 0:g.name)==="Container"||r instanceof Ze.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],A=!1;for(let b of h)try{let f=await fetch(b);if(f.ok){o=await f.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=o==null?void 0:o.constructor)==null?void 0:m.name),A=!0;break}}catch{continue}A||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,t==null?void 0:t.transform,t);return o}static applyTransform(e,t,i){var a,s,r,o,d;if(!(!t||!e)){if(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(s=t.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=t.position.x)!=null?r:0,(o=t.position.y)!=null?o:0)),t.scale!==void 0){let c=(d=i==null?void 0:i.identity)==null?void 0:d.category,u=c==="ui"||c==="environment"?.2:1,l=t.scale*u;"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(l):e.scale=l)}t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor&&Array.isArray(t.anchor)&&("set"in e.anchor?e.anchor.set(t.anchor[0],t.anchor[1]):(e.anchor.x=t.anchor[0],e.anchor.y=t.anchor[1]))}}};ue();var Gi=mt(require("lottie-web"),1);Ct(_i);typeof window!="undefined"&&!window.lottie&&(window.lottie=Gi.default);Xt();ue();var gn=li.version,ps=new Set(["init","boot","view","ready","start","pause","resume","complete","error","engagement","first_interaction","retry","cta_show","cta_click","cta_dismiss","clickout","conversion","session_time","level_time","load_time","level_start","level_complete","level_fail","checkpoint","reward","tutorial_start","tutorial_complete","tutorial_skip","ab_assign","fps","memory","asset_load_start","asset_load_complete"]);oi();var Xi={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},Ji=Math.random().toString(36).slice(2),ke=null,Pe={...Xi},Zi="web_embed",bn={},tt,fn=!1,et=!1,it=!1,Qi=!1,wn=1,Tt=0,Mt=!1,oe=!1,Me="",Oe=Math.floor(window.innerWidth),Ie=Math.floor(window.innerHeight),yn=Oe>Ie,le=!1,nt=!1,Ui=!1,qi=!1,hn=!1,_t=null,Ae=null,vn=!1,xn=!1,Lt=new Map;function ea(){if(!Ae)return null;let n=Date.now()-Ae;return!Number.isFinite(n)||n<0?null:n}function mn(n){if(vn)return;let e=ea();e!==null&&(vn=!0,v("session_time",{duration_ms:e,reason:n}))}function Vi(){if(ke)return ke;let n=document.createElement("div");return n.id="handler-root",n.setAttribute("data-handler-root","true"),document.body.appendChild(n),ke=n,n}function Pt(n){switch(n){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return n}}function ta(n,e){return{event_name:n,ts:Date.now(),session_id:Ji,deployment_id:Pe.deployment_id,variant_id:Pe.variant_id,export_profile_id:Pe.profile_id,instance_id:Pe.instance_id||"default",env:Zi==="mraid"?"mraid":"web",attribution:tt,payload:e}}function v(n,e){let t=Pt(n),i=ta(t,e);qt(i,!!bn.analytics),yt(t,i),t!==n&&yt(n,i)}function at(){_t&&(_t(Oe,Ie),_t=null)}function Re(n){wn=n,v("volume",n)}function je(n){n&&(Qi=!0),!it&&(it=!0,v("pause"),Re(0))}function st(n){!n&&Qi||it&&(it=!1,v("resume"),Re(wn))}function be(n,e){Oe=Math.floor(n||window.innerWidth),Ie=Math.floor(e||window.innerHeight),yn=Oe>Ie,v("resize",{width:Oe,height:Ie})}function us(){if(xi())try{let n=mraid.getMaxSize();be(n.width,n.height);let e=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?st():je()};if(mraid.addEventListener("viewableChange",e),mraid.addEventListener("stateChange",e),mraid.addEventListener("sizeChange",()=>{let t=mraid.getMaxSize();be(t.width,t.height)}),mraid.getAudioVolume){let t=mraid.getAudioVolume();Re(t?1:0)}if(mraid.addEventListener("audioVolumeChange",t=>{t!==null&&Re(t>0?1:0)}),mraid.addEventListener("error",(t,i)=>{console.warn("mraid error:",t,"action:",i)}),Mt=!0,mraid.isViewable()&&mraid.getState()!=="hidden")le=!0,v("boot"),v("view"),v("ready"),oe=!0,at();else{let t=()=>{le=!0,v("boot"),v("view"),v("ready"),oe=!0,at()};mraid.addEventListener("ready",t)}}catch(n){console.warn("MRAID hook skipped",n)}}function gs(){if(wi())try{let n=dapi.getScreenSize();be(n.width,n.height),dapi.addEventListener("viewableChange",t=>{t.isViewable?st():je()}),dapi.addEventListener("adResized",t=>{let i=dapi.getScreenSize();be(t.width||i.width,t.height||i.height)});let e=dapi.getAudioVolume();if(Re(e?1:0),dapi.addEventListener("audioVolumeChange",t=>Re(t?1:0)),Mt=!0,dapi.isViewable())le=!0,v("boot"),v("view"),v("ready"),oe=!0,at();else{let t=()=>{le=!0,v("boot"),v("view"),v("ready"),oe=!0,at()};dapi.addEventListener("ready",t)}}catch(n){console.warn("DAPI hook skipped",n)}}function Wi(){let n=()=>{le||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(le=!0,v("boot"),v("view"),v("ready"),oe=!0,at(),nt&&(nt=!1,ne.start()))};window.addEventListener("resize",()=>be()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(st(),n()):je()}),document.readyState==="complete"||document.readyState==="interactive"?n():window.addEventListener("load",n),Mt=!0}function fs(){let n=e=>{typeof TouchEvent!="undefined"&&e instanceof TouchEvent&&(Ui=!0),!(Ui&&e instanceof MouseEvent)&&(Tt+=1,xn||(xn=!0,v("first_interaction",{count:Tt})),v("interaction",Tt))};document.addEventListener("mousedown",n),document.addEventListener("touchstart",n)}function Yi(n){var i,a,s,r,o,d,c,u,l,p,g,m;let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(e==="mraid"&&typeof mraid!="undefined")mraid.open(n||"");else if(e==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(Te())(s=(a=window.TJ_API)==null?void 0:a.click)==null||s.call(a);else if(Ei())(o=(r=window.FbPlayableAd)==null?void 0:r.onCTAClick)==null||o.call(r);else if(Li())(c=(d=window.ScPlayableAd)==null?void 0:d.onCTAClick)==null||c.call(d);else if(Ci())try{(l=(u=window.smxTracking)==null?void 0:u.redirect)==null||l.call(u)}catch(h){console.warn("Smadex redirect failed",h)}else if(Ai()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(n||Me||""):n&&window.open(n)}else Le()?(p=window.install)==null||p.call(window):Si()?(g=window.openAppStore)==null||g.call(window):Vt()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):n&&window.open(n)}function hs(){let n=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",e=t=>{if(!t)return;let i=new Image;i.src=t};if(n==="bigabid"){let t=window.BIGABID_BIDTIMEMACROS;if(!t)return;q("view",()=>e(t.mraid_viewable)),q("start",()=>e(t.game_viewable)),q("engagement",()=>e(t.engagement));let i=()=>e(t.complete);q("complete",i),bt("engagement",a=>{var s;((s=a==null?void 0:a.payload)==null?void 0:s.count)>3&&i()}),q("cta_click",()=>e(t.click))}else if(n==="inmobi"){let t=window.INMOBI_DSPMACROS;if(!t)return;q("view",()=>e(t.Ad_Load_Start)),q("start",()=>e(t.Ad_Viewable)),q("engagement",()=>e(t.First_Engagement)),q("complete",()=>e(t.Gameplay_Complete)),q("cta_click",()=>e(t.DSP_Click)),q("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>e(t[`Spent_${i}_Seconds`]),i*1e3))})}}function ms(){if(!Te())return;let n=window.TJ_API;n&&n.setPlayableAPI&&n.setPlayableAPI({skipAd:()=>{try{ne.finish()}catch(e){console.warn("Tapjoy skip failed",e)}}})}function Ki(){var e,t,i;let n=window.TJ_API;(e=n==null?void 0:n.objectiveComplete)==null||e.call(n),(t=n==null?void 0:n.playableFinished)==null||t.call(n),(i=n==null?void 0:n.gameplayFinished)==null||i.call(n)}function bs(){Le()&&(window.mintGameStart=()=>{st(!0),be()},window.mintGameClose=()=>{je(!0)})}function ys(){if(!Wt())return;let n=window.NUC;!n||!n.trigger||(ne.on("cta_click",()=>{var e,t;return(t=(e=n.trigger).convert)==null?void 0:t.call(e,Me)}),ne.on("complete",()=>{var e,t;return(t=(e=n.trigger).tryAgain)==null?void 0:t.call(e)}))}var ne={init(n={},e){var t;if(Zi=n.profile||"web_embed",bn=n.consent||{},Pe={...Xi,...n.ids||{}},ke=n.rootEl||ke,tt=void 0,ei((t=n.telemetry)!=null&&t.endpoint?n.telemetry:null),Ae=null,vn=!1,xn=!1,Lt.clear(),Me=n.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),e&&(_t=e),v("init"),document.body.oncontextmenu=()=>!1,Vi(),xs(ke),Ti(),us(),gs(),!Mt){if(document.readyState==="complete")Wi();else if(!qi){qi=!0;let i=()=>{Wi(),window.removeEventListener("load",i),document.removeEventListener("DOMContentLoaded",i)};window.addEventListener("load",i),document.addEventListener("DOMContentLoaded",i)}}fs(),hs(),ms(),bs(),ys(),console.log(`%c @handler/playable-sdk %c v${gn} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),le&&!oe&&(v("boot"),v("view"),v("ready"),nt&&(nt=!1,ne.start()),oe=!0),oe=le},getRoot(){return Vi()},get version(){return gn},get maxWidth(){return Oe},get maxHeight(){return Ie},get isLandscape(){return yn},get isReady(){return oe},get isStarted(){return fn},get isPaused(){return it},get isFinished(){return et},get volume(){return wn},get interactions(){return Tt},on(n,e){bt(Pt(n),e)},off(n,e){Ut(Pt(n),e)},start(){var n,e;if(!fn){if(!le){nt=!0;return}if(fn=!0,Ae||(Ae=Date.now()),v("start"),be(),Le())je(),(n=window.gameReady)==null||n.call(window);else if(Te()){let t=window.TJ_API;(e=t==null?void 0:t.setPlayableBuild)==null||e.call(t,{orientation:yn?"landscape":"portrait",buildID:gn})}}},finish(){var n,e;et||(et=!0,v("complete"),mn("complete"),Le()?(n=window.gameEnd)==null||n.call(window):Vt()?(e=parent==null?void 0:parent.postMessage)==null||e.call(parent,"complete","*"):Te()&&Ki())},install(n){if(!et){et=!0,Te()?(Ki(),setTimeout(()=>ne.install(n),300)):(v("complete"),setTimeout(()=>ne.install(n),0));return}hn||(hn=!0,setTimeout(()=>hn=!1,500),v("cta_click"),v("conversion"),mn("cta"),Yi(n||Me))},emit(n,e){let t=Pt(n);if(!ps.has(t)&&t!=="resize"&&t!=="volume"&&!t.startsWith("custom."))throw new Error(`Event ${n} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let i=ta(t,e);qt(i,!!bn.analytics),yt(t,i)},gameStart(){ne.start()},gameEnd(){ne.finish()},ctaClick(n,e){v("cta_click",{url:n||Me,manual:!0}),(e==null?void 0:e.open)!==!1&&Yi(n||Me)},ctaShow(n){v("cta_show",n)},ctaDismiss(n){v("cta_dismiss",n)},getGameTimeMs(){return ea()},endSession(n="manual"){mn(n)},setAttribution(n){tt=n},abTest(n,e){if(!n)throw new Error("abTest requires experimentId");if(!Array.isArray(e)||e.length<2)throw new Error("abTest requires at least 2 variants");let t=Math.abs(vs(`${Ji}:${n}`))%e.length,i=e[t];return tt={...tt||{},experiment_id:n},Pe.variant_id=i,v("ab_assign",{experiment_id:n,variant_id:i}),i},levelStart(n,e){Ae||(Ae=Date.now()),v("level_start",{level_id:n,...e})},levelComplete(n,e){v("level_complete",{level_id:n,...e})},levelFail(n,e){v("level_fail",{level_id:n,...e})},checkpoint(n,e){v("checkpoint",{checkpoint_id:n,...e})},reward(n,e){v("reward",{reward_id:n,...e})},tutorialStart(n,e){v("tutorial_start",{step_id:n,...e})},tutorialComplete(n,e){v("tutorial_complete",{step_id:n,...e})},tutorialSkip(n,e){v("tutorial_skip",{step_id:n,...e})},timerStart(n){n&&Lt.set(n,Date.now())},timerEnd(n,e="custom",t){if(!n)return;let i=Lt.get(n);if(!i)return;Lt.delete(n);let a=Date.now()-i;if(!(!Number.isFinite(a)||a<0)){if(e==="custom"){v("engagement",{action:"timer",key:n,duration_ms:a,...t});return}v(e,{key:n,duration_ms:a,...t})}},fps(n,e){v("fps",{value:n,...e})},memory(n,e){v("memory",{bytes:n,...e})},assetLoadStart(n,e){v("asset_load_start",{asset_id:n,...e})},assetLoadComplete(n,e){v("asset_load_complete",{asset_id:n,...e})},reportError(n,e,t){v("error",{code:n,message:e,...t})},retry(){var n,e,t;if(Le())(n=window.gameRetry)==null||n.call(window);else if(Wt()){let i=window.NUC;(t=(e=i==null?void 0:i.trigger)==null?void 0:e.tryAgain)==null||t.call(e)}v("engagement",{action:"retry"})},pause(){je(!0)},resume(){st(!0)},resize(n,e){be(n,e)}},Qe=ne;function vs(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e|0}function xs(n){let e=document.createElement("script");e.type="text/javascript",e.textContent=`
|
|
229
|
+
`,this.modal=e,this.attachEventListeners(),this.initializeCanvas()}initializeCanvas(){this.modal&&(this.canvas=this.modal.querySelector(".asset-crop-canvas"),this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.canvas.width=400,this.canvas.height=300))}loadImage(){this.options&&(this.image=new Image,this.image.crossOrigin="anonymous",this.image.onload=()=>{this.initializeCrop(),this.render()},this.image.src=this.options.imageSrc)}initializeCrop(){var i;if(!this.image||!this.canvas)return;let e=this.image.width/this.image.height,t=this.canvas.width/this.canvas.height;e>t?(this.cropHeight=this.image.height,this.cropWidth=this.cropHeight*t,this.cropX=(this.image.width-this.cropWidth)/2,this.cropY=0):(this.cropWidth=this.image.width,this.cropHeight=this.cropWidth/t,this.cropX=0,this.cropY=(this.image.height-this.cropHeight)/2),(i=this.options)!=null&&i.aspectRatio&&this.applyAspectRatio(this.options.aspectRatio),this.fitToCanvas()}applyAspectRatio(e){if(!this.image)return;let t=this.image.width/this.image.height,i=this.cropX+this.cropWidth/2,a=this.cropY+this.cropHeight/2;e>t?(this.cropWidth=Math.min(this.image.width,this.cropHeight*e),this.cropHeight=this.cropWidth/e):(this.cropHeight=Math.min(this.image.height,this.cropWidth/e),this.cropWidth=this.cropHeight*e),this.cropX=Math.max(0,Math.min(this.image.width-this.cropWidth,i-this.cropWidth/2)),this.cropY=Math.max(0,Math.min(this.image.height-this.cropHeight,a-this.cropHeight/2))}fitToCanvas(){if(!this.image||!this.canvas)return;let e=this.canvas.width/this.cropWidth,t=this.canvas.height/this.cropHeight;this.scale=Math.min(e,t)*.9,this.panX=(this.canvas.width-this.cropWidth*this.scale)/2,this.panY=(this.canvas.height-this.cropHeight*this.scale)/2}render(){!this.ctx||!this.image||!this.canvas||(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.save(),this.ctx.translate(this.panX,this.panY),this.ctx.scale(this.scale,this.scale),this.ctx.drawImage(this.image,-this.cropX,-this.cropY,this.image.width,this.image.height),this.ctx.restore(),this.drawCropOverlay(),this.updatePreview())}drawCropOverlay(){if(!this.ctx||!this.canvas)return;let e=this.panX,t=this.panY,i=this.cropWidth*this.scale,a=this.cropHeight*this.scale;this.ctx.fillStyle="rgba(0, 0, 0, 0.5)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.ctx.clearRect(e,t,i,a),this.ctx.strokeStyle="#ffffff",this.ctx.lineWidth=2,this.ctx.strokeRect(e,t,i,a),this.ctx.fillStyle="#ffffff";let s=8;[[e,t],[e+i-s,t],[e,t+a-s],[e+i-s,t+a-s]].forEach(([o,d])=>{var c;(c=this.ctx)==null||c.fillRect(o,d,s,s)})}updatePreview(){if(!this.modal||!this.image)return;let e=this.modal.querySelector(".asset-crop-preview-canvas");if(!e)return;let t=e.getContext("2d");if(!t)return;let i=150;e.width=i,e.height=i;let a=i/this.cropWidth,s=i/this.cropHeight,r=Math.min(a,s),o=this.cropWidth*r,d=this.cropHeight*r,c=(i-o)/2,u=(i-d)/2;t.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,c,u,o,d)}attachEventListeners(){if(!this.modal||!this.canvas)return;this.canvas.addEventListener("mousedown",this.handleMouseDown.bind(this)),this.canvas.addEventListener("mousemove",this.handleMouseMove.bind(this)),this.canvas.addEventListener("mouseup",this.handleMouseUp.bind(this)),this.canvas.addEventListener("wheel",this.handleWheel.bind(this)),this.canvas.addEventListener("touchstart",this.handleTouchStart.bind(this)),this.canvas.addEventListener("touchmove",this.handleTouchMove.bind(this)),this.canvas.addEventListener("touchend",this.handleTouchEnd.bind(this));let e=this.modal.querySelector(".asset-crop-zoom-slider");e==null||e.addEventListener("input",i=>{let a=parseFloat(i.target.value);this.setZoom(a)});let t=this.modal.querySelector(".asset-crop-aspect-select");t==null||t.addEventListener("change",i=>{let a=i.target.value;this.setAspectRatio(a)}),this.modal.addEventListener("click",i=>{switch(i.target.dataset.action){case"reset":this.reset();break;case"apply":this.applyCrop();break;case"cancel":case"close":this.close();break}}),this.modal.addEventListener("click",i=>{i.target===this.modal&&this.close()})}handleMouseDown(e){this.isDragging=!0,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.lastPanX=this.panX,this.lastPanY=this.panY,this.canvas.style.cursor="grabbing"}handleMouseMove(e){if(!this.isDragging)return;let t=e.clientX-this.dragStartX,i=e.clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+i,this.constrainPan(),this.render()}handleMouseUp(){this.isDragging=!1,this.canvas.style.cursor="grab"}handleWheel(e){e.preventDefault();let t=e.deltaY>0?.9:1.1;this.setZoom(this.scale*t)}handleTouchStart(e){e.touches.length===1&&(this.isDragging=!0,this.dragStartX=e.touches[0].clientX,this.dragStartY=e.touches[0].clientY,this.lastPanX=this.panX,this.lastPanY=this.panY)}handleTouchMove(e){if(!this.isDragging||e.touches.length!==1)return;e.preventDefault();let t=e.touches[0].clientX-this.dragStartX,i=e.touches[0].clientY-this.dragStartY;this.panX=this.lastPanX+t,this.panY=this.lastPanY+i,this.constrainPan(),this.render()}handleTouchEnd(){this.isDragging=!1}setZoom(e){this.scale=Math.max(.1,Math.min(3,e)),this.updateZoomUI(),this.constrainPan(),this.render()}setAspectRatio(e){let t;switch(e){case"1:1":t=1;break;case"4:3":t=4/3;break;case"16:9":t=16/9;break;case"3:2":t=3/2;break;default:t=void 0}t&&this.applyAspectRatio(t),this.fitToCanvas(),this.render()}updateZoomUI(){if(!this.modal)return;let e=this.modal.querySelector(".asset-crop-zoom-value"),t=this.modal.querySelector(".asset-crop-zoom-slider");e&&(e.textContent=`${this.scale.toFixed(1)}x`),t&&(t.value=this.scale.toString())}constrainPan(){if(!this.canvas)return;let e=this.cropWidth*this.scale,t=this.cropHeight*this.scale;this.panX=Math.max(this.canvas.width-e,Math.min(0,this.panX)),this.panY=Math.max(this.canvas.height-t,Math.min(0,this.panY))}reset(){this.initializeCrop(),this.render()}applyCrop(){var a;if(!this.image||!((a=this.options)!=null&&a.onCrop))return;let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return;e.width=this.cropWidth,e.height=this.cropHeight,t.drawImage(this.image,this.cropX,this.cropY,this.cropWidth,this.cropHeight,0,0,this.cropWidth,this.cropHeight);let i=e.toDataURL("image/png");this.options.onCrop(i),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal);let e=this.options;this.modal=null,this.canvas=null,this.ctx=null,this.image=null,this.options=null,e!=null&&e.onCancel&&e.onCancel()}};window.openAssetCrop=function(n){new pn().open(n)};ue();var Ze=require("pixi.js");At();var cs=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",un=cs;if(typeof window!="undefined")try{let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);e!=null&&e.buildMode&&(un=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${un}`))}}catch{}var me=class{static async create(e,t,i){var d,c,u,l,p,g,m;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${un}`);let a=(d=t==null?void 0:t.render)==null?void 0:d.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ze.Container;return this.applyTransform(h,t==null?void 0:t.transform,t),h}let s=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await fe.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(u=r==null?void 0:r.constructor)==null?void 0:u.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ze.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(l=o==null?void 0:o.constructor)==null?void 0:l.name),this.applyTransform(o,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(p=r==null?void 0:r.constructor)==null?void 0:p.name,r),r&&(((g=r.constructor)==null?void 0:g.name)==="Container"||r instanceof Ze.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],A=!1;for(let b of h)try{let f=await fetch(b);if(f.ok){o=await f.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=o==null?void 0:o.constructor)==null?void 0:m.name),A=!0;break}}catch{continue}A||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,t==null?void 0:t.transform,t);return o}static applyTransform(e,t,i){var a,s,r,o;!t||!e||(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(s=t.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=t.position.x)!=null?r:0,(o=t.position.y)!=null?o:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor&&Array.isArray(t.anchor)&&("set"in e.anchor?e.anchor.set(t.anchor[0],t.anchor[1]):(e.anchor.x=t.anchor[0],e.anchor.y=t.anchor[1])))}};ue();var Gi=mt(require("lottie-web"),1);Ct(_i);typeof window!="undefined"&&!window.lottie&&(window.lottie=Gi.default);Xt();ue();var gn=li.version,ps=new Set(["init","boot","view","ready","start","pause","resume","complete","error","engagement","first_interaction","retry","cta_show","cta_click","cta_dismiss","clickout","conversion","session_time","level_time","load_time","level_start","level_complete","level_fail","checkpoint","reward","tutorial_start","tutorial_complete","tutorial_skip","ab_assign","fps","memory","asset_load_start","asset_load_complete"]);oi();var Xi={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},Ji=Math.random().toString(36).slice(2),ke=null,Pe={...Xi},Zi="web_embed",bn={},tt,fn=!1,et=!1,it=!1,Qi=!1,wn=1,Tt=0,Mt=!1,oe=!1,Me="",Oe=Math.floor(window.innerWidth),Ie=Math.floor(window.innerHeight),yn=Oe>Ie,le=!1,nt=!1,Ui=!1,qi=!1,hn=!1,_t=null,Ae=null,vn=!1,xn=!1,Lt=new Map;function ea(){if(!Ae)return null;let n=Date.now()-Ae;return!Number.isFinite(n)||n<0?null:n}function mn(n){if(vn)return;let e=ea();e!==null&&(vn=!0,v("session_time",{duration_ms:e,reason:n}))}function Vi(){if(ke)return ke;let n=document.createElement("div");return n.id="handler-root",n.setAttribute("data-handler-root","true"),document.body.appendChild(n),ke=n,n}function Pt(n){switch(n){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return n}}function ta(n,e){return{event_name:n,ts:Date.now(),session_id:Ji,deployment_id:Pe.deployment_id,variant_id:Pe.variant_id,export_profile_id:Pe.profile_id,instance_id:Pe.instance_id||"default",env:Zi==="mraid"?"mraid":"web",attribution:tt,payload:e}}function v(n,e){let t=Pt(n),i=ta(t,e);qt(i,!!bn.analytics),yt(t,i),t!==n&&yt(n,i)}function at(){_t&&(_t(Oe,Ie),_t=null)}function Re(n){wn=n,v("volume",n)}function je(n){n&&(Qi=!0),!it&&(it=!0,v("pause"),Re(0))}function st(n){!n&&Qi||it&&(it=!1,v("resume"),Re(wn))}function be(n,e){Oe=Math.floor(n||window.innerWidth),Ie=Math.floor(e||window.innerHeight),yn=Oe>Ie,v("resize",{width:Oe,height:Ie})}function us(){if(xi())try{let n=mraid.getMaxSize();be(n.width,n.height);let e=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?st():je()};if(mraid.addEventListener("viewableChange",e),mraid.addEventListener("stateChange",e),mraid.addEventListener("sizeChange",()=>{let t=mraid.getMaxSize();be(t.width,t.height)}),mraid.getAudioVolume){let t=mraid.getAudioVolume();Re(t?1:0)}if(mraid.addEventListener("audioVolumeChange",t=>{t!==null&&Re(t>0?1:0)}),mraid.addEventListener("error",(t,i)=>{console.warn("mraid error:",t,"action:",i)}),Mt=!0,mraid.isViewable()&&mraid.getState()!=="hidden")le=!0,v("boot"),v("view"),v("ready"),oe=!0,at();else{let t=()=>{le=!0,v("boot"),v("view"),v("ready"),oe=!0,at()};mraid.addEventListener("ready",t)}}catch(n){console.warn("MRAID hook skipped",n)}}function gs(){if(wi())try{let n=dapi.getScreenSize();be(n.width,n.height),dapi.addEventListener("viewableChange",t=>{t.isViewable?st():je()}),dapi.addEventListener("adResized",t=>{let i=dapi.getScreenSize();be(t.width||i.width,t.height||i.height)});let e=dapi.getAudioVolume();if(Re(e?1:0),dapi.addEventListener("audioVolumeChange",t=>Re(t?1:0)),Mt=!0,dapi.isViewable())le=!0,v("boot"),v("view"),v("ready"),oe=!0,at();else{let t=()=>{le=!0,v("boot"),v("view"),v("ready"),oe=!0,at()};dapi.addEventListener("ready",t)}}catch(n){console.warn("DAPI hook skipped",n)}}function Wi(){let n=()=>{le||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(le=!0,v("boot"),v("view"),v("ready"),oe=!0,at(),nt&&(nt=!1,ne.start()))};window.addEventListener("resize",()=>be()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(st(),n()):je()}),document.readyState==="complete"||document.readyState==="interactive"?n():window.addEventListener("load",n),Mt=!0}function fs(){let n=e=>{typeof TouchEvent!="undefined"&&e instanceof TouchEvent&&(Ui=!0),!(Ui&&e instanceof MouseEvent)&&(Tt+=1,xn||(xn=!0,v("first_interaction",{count:Tt})),v("interaction",Tt))};document.addEventListener("mousedown",n),document.addEventListener("touchstart",n)}function Yi(n){var i,a,s,r,o,d,c,u,l,p,g,m;let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(e==="mraid"&&typeof mraid!="undefined")mraid.open(n||"");else if(e==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(Te())(s=(a=window.TJ_API)==null?void 0:a.click)==null||s.call(a);else if(Ei())(o=(r=window.FbPlayableAd)==null?void 0:r.onCTAClick)==null||o.call(r);else if(Li())(c=(d=window.ScPlayableAd)==null?void 0:d.onCTAClick)==null||c.call(d);else if(Ci())try{(l=(u=window.smxTracking)==null?void 0:u.redirect)==null||l.call(u)}catch(h){console.warn("Smadex redirect failed",h)}else if(Ai()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(n||Me||""):n&&window.open(n)}else Le()?(p=window.install)==null||p.call(window):Si()?(g=window.openAppStore)==null||g.call(window):Vt()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):n&&window.open(n)}function hs(){let n=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",e=t=>{if(!t)return;let i=new Image;i.src=t};if(n==="bigabid"){let t=window.BIGABID_BIDTIMEMACROS;if(!t)return;q("view",()=>e(t.mraid_viewable)),q("start",()=>e(t.game_viewable)),q("engagement",()=>e(t.engagement));let i=()=>e(t.complete);q("complete",i),bt("engagement",a=>{var s;((s=a==null?void 0:a.payload)==null?void 0:s.count)>3&&i()}),q("cta_click",()=>e(t.click))}else if(n==="inmobi"){let t=window.INMOBI_DSPMACROS;if(!t)return;q("view",()=>e(t.Ad_Load_Start)),q("start",()=>e(t.Ad_Viewable)),q("engagement",()=>e(t.First_Engagement)),q("complete",()=>e(t.Gameplay_Complete)),q("cta_click",()=>e(t.DSP_Click)),q("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>e(t[`Spent_${i}_Seconds`]),i*1e3))})}}function ms(){if(!Te())return;let n=window.TJ_API;n&&n.setPlayableAPI&&n.setPlayableAPI({skipAd:()=>{try{ne.finish()}catch(e){console.warn("Tapjoy skip failed",e)}}})}function Ki(){var e,t,i;let n=window.TJ_API;(e=n==null?void 0:n.objectiveComplete)==null||e.call(n),(t=n==null?void 0:n.playableFinished)==null||t.call(n),(i=n==null?void 0:n.gameplayFinished)==null||i.call(n)}function bs(){Le()&&(window.mintGameStart=()=>{st(!0),be()},window.mintGameClose=()=>{je(!0)})}function ys(){if(!Wt())return;let n=window.NUC;!n||!n.trigger||(ne.on("cta_click",()=>{var e,t;return(t=(e=n.trigger).convert)==null?void 0:t.call(e,Me)}),ne.on("complete",()=>{var e,t;return(t=(e=n.trigger).tryAgain)==null?void 0:t.call(e)}))}var ne={init(n={},e){var t;if(Zi=n.profile||"web_embed",bn=n.consent||{},Pe={...Xi,...n.ids||{}},ke=n.rootEl||ke,tt=void 0,ei((t=n.telemetry)!=null&&t.endpoint?n.telemetry:null),Ae=null,vn=!1,xn=!1,Lt.clear(),Me=n.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),e&&(_t=e),v("init"),document.body.oncontextmenu=()=>!1,Vi(),xs(ke),Ti(),us(),gs(),!Mt){if(document.readyState==="complete")Wi();else if(!qi){qi=!0;let i=()=>{Wi(),window.removeEventListener("load",i),document.removeEventListener("DOMContentLoaded",i)};window.addEventListener("load",i),document.addEventListener("DOMContentLoaded",i)}}fs(),hs(),ms(),bs(),ys(),console.log(`%c @handler/playable-sdk %c v${gn} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),le&&!oe&&(v("boot"),v("view"),v("ready"),nt&&(nt=!1,ne.start()),oe=!0),oe=le},getRoot(){return Vi()},get version(){return gn},get maxWidth(){return Oe},get maxHeight(){return Ie},get isLandscape(){return yn},get isReady(){return oe},get isStarted(){return fn},get isPaused(){return it},get isFinished(){return et},get volume(){return wn},get interactions(){return Tt},on(n,e){bt(Pt(n),e)},off(n,e){Ut(Pt(n),e)},start(){var n,e;if(!fn){if(!le){nt=!0;return}if(fn=!0,Ae||(Ae=Date.now()),v("start"),be(),Le())je(),(n=window.gameReady)==null||n.call(window);else if(Te()){let t=window.TJ_API;(e=t==null?void 0:t.setPlayableBuild)==null||e.call(t,{orientation:yn?"landscape":"portrait",buildID:gn})}}},finish(){var n,e;et||(et=!0,v("complete"),mn("complete"),Le()?(n=window.gameEnd)==null||n.call(window):Vt()?(e=parent==null?void 0:parent.postMessage)==null||e.call(parent,"complete","*"):Te()&&Ki())},install(n){if(!et){et=!0,Te()?(Ki(),setTimeout(()=>ne.install(n),300)):(v("complete"),setTimeout(()=>ne.install(n),0));return}hn||(hn=!0,setTimeout(()=>hn=!1,500),v("cta_click"),v("conversion"),mn("cta"),Yi(n||Me))},emit(n,e){let t=Pt(n);if(!ps.has(t)&&t!=="resize"&&t!=="volume"&&!t.startsWith("custom."))throw new Error(`Event ${n} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let i=ta(t,e);qt(i,!!bn.analytics),yt(t,i)},gameStart(){ne.start()},gameEnd(){ne.finish()},ctaClick(n,e){v("cta_click",{url:n||Me,manual:!0}),(e==null?void 0:e.open)!==!1&&Yi(n||Me)},ctaShow(n){v("cta_show",n)},ctaDismiss(n){v("cta_dismiss",n)},getGameTimeMs(){return ea()},endSession(n="manual"){mn(n)},setAttribution(n){tt=n},abTest(n,e){if(!n)throw new Error("abTest requires experimentId");if(!Array.isArray(e)||e.length<2)throw new Error("abTest requires at least 2 variants");let t=Math.abs(vs(`${Ji}:${n}`))%e.length,i=e[t];return tt={...tt||{},experiment_id:n},Pe.variant_id=i,v("ab_assign",{experiment_id:n,variant_id:i}),i},levelStart(n,e){Ae||(Ae=Date.now()),v("level_start",{level_id:n,...e})},levelComplete(n,e){v("level_complete",{level_id:n,...e})},levelFail(n,e){v("level_fail",{level_id:n,...e})},checkpoint(n,e){v("checkpoint",{checkpoint_id:n,...e})},reward(n,e){v("reward",{reward_id:n,...e})},tutorialStart(n,e){v("tutorial_start",{step_id:n,...e})},tutorialComplete(n,e){v("tutorial_complete",{step_id:n,...e})},tutorialSkip(n,e){v("tutorial_skip",{step_id:n,...e})},timerStart(n){n&&Lt.set(n,Date.now())},timerEnd(n,e="custom",t){if(!n)return;let i=Lt.get(n);if(!i)return;Lt.delete(n);let a=Date.now()-i;if(!(!Number.isFinite(a)||a<0)){if(e==="custom"){v("engagement",{action:"timer",key:n,duration_ms:a,...t});return}v(e,{key:n,duration_ms:a,...t})}},fps(n,e){v("fps",{value:n,...e})},memory(n,e){v("memory",{bytes:n,...e})},assetLoadStart(n,e){v("asset_load_start",{asset_id:n,...e})},assetLoadComplete(n,e){v("asset_load_complete",{asset_id:n,...e})},reportError(n,e,t){v("error",{code:n,message:e,...t})},retry(){var n,e,t;if(Le())(n=window.gameRetry)==null||n.call(window);else if(Wt()){let i=window.NUC;(t=(e=i==null?void 0:i.trigger)==null?void 0:e.tryAgain)==null||t.call(e)}v("engagement",{action:"retry"})},pause(){je(!0)},resume(){st(!0)},resize(n,e){be(n,e)}},Qe=ne;function vs(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e|0}function xs(n){let e=document.createElement("script");e.type="text/javascript",e.textContent=`
|
|
230
230
|
(function(){
|
|
231
231
|
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
232
232
|
function unlock(){
|
package/dist/pixi/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x5a11bb,_0x33a703){var a0_0x38556a={_0x3d6ed8:0x226,_0x3a82dd:'5^[3',_0x4222a2:0x23d,_0x14cb12:0x231,_0x405db9:0x2f3,_0x95bb56:0x2ed,_0x475253:'aOlM',_0x189b64:0x2f0,_0x5f5785:0x22c,_0x5f1d36:'V[uB',_0x5e9f73:0x227,_0x17d614:0x2cd,_0x5770c9:0x2da,_0x51d823:0x353,_0x1319c2:0x368,_0x88c846:'$nk)',_0x3d3cef:0x2d8,_0x570626:0x2e3,_0x431118:0x2df,_0x139ab9:0x239,_0x359dab:0x238,_0x49ad78:0x22e,_0x5b4e75:0x237,_0x2f96ab:0x2c8,_0x1c4146:0x2d1,_0x2e4870:'CDNn',_0x317df2:0x2c9,_0x3a5477:0x2e0,_0x404daa:0x2e6,_0x3f40a9:0x2e3,_0x28ad09:0x222,_0x15152d:'TcRx',_0x4ce1a1:0x223,_0x3193b1:0x228,_0x3f2168:0x225},a0_0x874890={_0x5580f3:0x1fc},a0_0x5260aa={_0x3083db:0x30a},a0_0x2af2f0={_0x30a915:0x285};function _0x5881cf(_0x2553c6,_0x163b0e,_0x33441c,_0x504087,_0x3a9d6b){return a0_0x4f8c(_0x163b0e-a0_0x2af2f0._0x30a915,_0x3a9d6b);}function _0x10faed(_0x5c0ccd,_0x4020eb,_0x4e3209,_0xc8182,_0x4d939d){return a0_0x4f8c(_0xc8182- -a0_0x5260aa._0x3083db,_0x4020eb);}var _0x1ac63c=_0x5a11bb();function _0x34ba65(_0x51e290,_0x2912ec,_0x16ae7c,_0xa523ca,_0x48c611){return a0_0x4f8c(_0x2912ec-a0_0x874890._0x5580f3,_0x16ae7c);}while(!![]){try{var _0x45e7f8=-parseInt(_0x10faed(-a0_0x38556a._0x3d6ed8,a0_0x38556a._0x3a82dd,-a0_0x38556a._0x4222a2,-a0_0x38556a._0x14cb12,-0x23d))/(0x3*0xb8b+-0xbdd+-0x16c3)+-parseInt(_0x34ba65(a0_0x38556a._0x405db9,a0_0x38556a._0x95bb56,a0_0x38556a._0x475253,0x2fb,a0_0x38556a._0x189b64))/(-0x7*0x4e5+-0x1f1f*-0x1+0x3e*0xd)*(-parseInt(_0x10faed(-a0_0x38556a._0x5f5785,a0_0x38556a._0x5f1d36,-0x21b,-0x222,-a0_0x38556a._0x5e9f73))/(0x1*0x1909+-0x33*-0x7b+-0x199*0x1f))+-parseInt(_0x34ba65(a0_0x38556a._0x17d614,a0_0x38556a._0x5770c9,'wx4M',a0_0x38556a._0x17d614,0x2e0))/(0x1c5d+-0x15a7+0x6b2*-0x1)*(-parseInt(_0x5881cf(0x34d,0x35c,a0_0x38556a._0x51d823,a0_0x38556a._0x1319c2,a0_0x38556a._0x88c846))/(-0x17*-0x5e+0x6be+-0xf2b))+-parseInt(_0x34ba65(a0_0x38556a._0x3d3cef,a0_0x38556a._0x570626,'m1sO',0x2df,a0_0x38556a._0x431118))/(-0x1ff9+0x1550+-0x1*-0xaaf)+-parseInt(_0x10faed(-a0_0x38556a._0x139ab9,']PS%',-a0_0x38556a._0x359dab,-a0_0x38556a._0x49ad78,-a0_0x38556a._0x5b4e75))/(-0x527+-0xdeb+0x1319)+parseInt(_0x34ba65(a0_0x38556a._0x2f96ab,a0_0x38556a._0x1c4146,a0_0x38556a._0x2e4870,0x2c4,a0_0x38556a._0x317df2))/(-0x1bbf*0x1+-0x1158+0x2d1f)+parseInt(_0x34ba65(0x2e9,a0_0x38556a._0x3a5477,'7Et!',a0_0x38556a._0x404daa,a0_0x38556a._0x3f40a9))/(0x499+0x17*-0x106+-0x15b*-0xe)*(parseInt(_0x10faed(-a0_0x38556a._0x28ad09,a0_0x38556a._0x15152d,-a0_0x38556a._0x4ce1a1,-a0_0x38556a._0x3193b1,-a0_0x38556a._0x3f2168))/(-0x1133+-0x25bc+0x36f9));if(_0x45e7f8===_0x33a703)break;else _0x1ac63c['push'](_0x1ac63c['shift']());}catch(_0x332f58){_0x1ac63c['push'](_0x1ac63c['shift']());}}}(a0_0x399a,-0x1*-0xd3587+0x4*0xd6c0+-0x8954b*0x1));var a0_0x305ea0=(function(){var _0x1c19fd=!![];return function(_0x2e13e0,_0x4301cb){var a0_0x108919={_0x2b2503:0x72,_0x1fa1bf:'R8p#',_0x2f9c71:0x70},a0_0x209aa9={_0x542d72:0x164},_0x48fd6d=_0x1c19fd?function(){function _0x527db6(_0x5d73ca,_0x3ea916,_0x87a368,_0x49ba59,_0xc3d03c){return a0_0x4f8c(_0xc3d03c- -a0_0x209aa9._0x542d72,_0x3ea916);}if(_0x4301cb){var _0x23785f=_0x4301cb[_0x527db6(-a0_0x108919._0x2b2503,a0_0x108919._0x1fa1bf,-a0_0x108919._0x2f9c71,-0x80,-0x7e)](_0x2e13e0,arguments);return _0x4301cb=null,_0x23785f;}}:function(){};return _0x1c19fd=![],_0x48fd6d;};}()),a0_0x264459=a0_0x305ea0(this,function(){var a0_0xcf7abd={_0x57965c:0xeb,_0xa4f620:0xf9,_0x3df66a:0xf0,_0x1bb1ed:0x156,_0x4090c7:0x152,_0x53a8a1:0x14e,_0x1841ae:0x14f,_0x52e299:0x15d,_0x595323:0x155,_0x5aa11c:'$nk)',_0x514cb9:0x151,_0x14a323:0x167,_0x182311:0x169,_0x45dec6:'m1sO',_0x4483ed:0xeb,_0xbd88f8:0xf4,_0x3f4d14:0xf8,_0x188de1:0x13a,_0x246cc5:0x151,_0x20cb0d:'p9UW',_0x47d3ff:0x149,_0x301971:0x157,_0x3557e9:0xe3,_0x1feff1:0xee,_0x3e8ce7:0xef,_0x19d602:0x106,_0x203b72:0xfb,_0x514f20:0xf3,_0x4e86a4:0xfe,_0x34f36b:0x25b,_0x53e99b:0x255,_0x569754:0x25a,_0xe220be:']PS%',_0x4af3b4:0xf4,_0x40ad36:0xf1,_0x54fccd:0x14d,_0x2f2884:0x144,_0x27e0aa:0x13f},a0_0x2a603d={_0xe1d121:0x347},_0x57b17b={};function _0x3d5304(_0x4d6d9c,_0x59bdad,_0x5f10c6,_0x16bbc9,_0x48e181){return a0_0x4f8c(_0x16bbc9-0x6e,_0x5f10c6);}_0x57b17b[_0x3438d7('JdJq',a0_0xcf7abd._0x57965c,a0_0xcf7abd._0xa4f620,a0_0xcf7abd._0x3df66a,0x104)]=_0x3d5304(a0_0xcf7abd._0x1bb1ed,a0_0xcf7abd._0x4090c7,'$h1M',a0_0xcf7abd._0x53a8a1,a0_0xcf7abd._0x1841ae)+_0x3d5304(a0_0xcf7abd._0x52e299,a0_0xcf7abd._0x595323,a0_0xcf7abd._0x5aa11c,a0_0xcf7abd._0x514cb9,a0_0xcf7abd._0x1841ae)+'+$';function _0x3438d7(_0x293196,_0x1c3b8f,_0xdbbd99,_0x4b0664,_0x2167d5){return a0_0x4f8c(_0xdbbd99-0xb,_0x293196);}var _0x3a3a70=_0x57b17b;function _0x30b204(_0x5a2895,_0x5d51b2,_0x54f803,_0x14f29d,_0x13588d){return a0_0x4f8c(_0x14f29d- -a0_0x2a603d._0xe1d121,_0x13588d);}return a0_0x264459['toStr'+_0x3d5304(a0_0xcf7abd._0x14a323,0x15b,'JWKV',0x15d,a0_0xcf7abd._0x182311)]()[_0x3438d7(a0_0xcf7abd._0x45dec6,a0_0xcf7abd._0x4483ed,a0_0xcf7abd._0xbd88f8,a0_0xcf7abd._0x3f4d14,0xf3)+'h'](_0x3d5304(a0_0xcf7abd._0x188de1,a0_0xcf7abd._0x246cc5,a0_0xcf7abd._0x20cb0d,a0_0xcf7abd._0x47d3ff,a0_0xcf7abd._0x301971)+')+)+)'+'+$')[_0x3438d7('bTqP',a0_0xcf7abd._0x3557e9,0xe8,a0_0xcf7abd._0x1feff1,a0_0xcf7abd._0x3e8ce7)+'ing']()[_0x3438d7('CDNn',a0_0xcf7abd._0x19d602,a0_0xcf7abd._0x203b72,a0_0xcf7abd._0x514f20,a0_0xcf7abd._0x4e86a4)+_0x30b204(-a0_0xcf7abd._0x34f36b,-a0_0xcf7abd._0x53e99b,-0x265,-a0_0xcf7abd._0x569754,'xF$A')+'r'](a0_0x264459)[_0x3438d7(a0_0xcf7abd._0xe220be,0xf4,0xea,a0_0xcf7abd._0x4af3b4,a0_0xcf7abd._0x40ad36)+'h'](_0x3a3a70[_0x3d5304(a0_0xcf7abd._0x54fccd,a0_0xcf7abd._0x4090c7,'7Et!',a0_0xcf7abd._0x2f2884,a0_0xcf7abd._0x27e0aa)]);});a0_0x264459();import{A as a0_0x40695b,B as a0_0x399634,C as a0_0xeeeadb,D as a0_0x575fae,b as a0_0x51973a,c as a0_0x1fd16f,d as a0_0x3314e1,e as a0_0x5d1581,f as a0_0x2e965c,g as a0_0x3006f0,h as a0_0x373f20,i as a0_0x103363,j as a0_0x46735b,k as a0_0x171657,l as a0_0x5c7e0b,m as a0_0xe874e5,n as a0_0x168503,o as a0_0x33c890,p as a0_0x290652,q as a0_0x2d7a70,r as a0_0x94986e,s as a0_0x5e9e38,t as a0_0xd86bcb,u as a0_0x2c41c0,v as a0_0xfac603,w as a0_0x343cdd,x as a0_0xb6f949,y as a0_0x5235b4,z as a0_0x5f48e8}from'../chunk-RWZ2NPID.js';function a0_0x399a(){var _0x563418=['W5ldN8ombt7cRSo3','p8k0W65SWOO','W6DyjN3cVSkhbqBcQSkxWOL4gq','W4XaW5K1W6NcHSoHW7zQWQdcQtq','WQClCdJdQW','W4rmcCo+W4HtW6VdNSk/W7S','mCkWi8oXWQpdGCoyBq','EuzgWQjZWQxcJLS9Fbu','uCkFW4NdLSkQ','m8kUqCkjW5a','BmoMea','W7P/peNdRG','gLWUWPJdQCoSdq','WQ4OyGJcRehdGmommJZdR8oy','mvbCud0','emovCMBdQSoSqmoZWOXzqqO','WQOMzq3cRehcRSoYcbldTCotW68','WPxdVqL8h8o1WPRdHMRdMmkrW5K','W60SWQeOvculWQddKaldIM0','qGlcLSkfma','rCocCgeXm1TTW53dSfNdU8k6','W6O1W4XXWRu','W7ZdRSowWRJdKH1GzG','b8krjIDL','WRNdOYWFWPe','fCoAEwhdQmoUACoSWOfNrtO','E8odW7/cQXdcNmoMqhHBW4i','cmojAx7dTq','FZihmGmAmHhdLXW'];a0_0x399a=function(){return _0x563418;};return a0_0x399a();}import{a as a0_0x3c26e1,b as a0_0x50f603,c as a0_0x5bd459,d as a0_0x4292dd,e as a0_0x2c40a0}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';function a0_0x4f8c(_0x42b396,_0x517031){_0x42b396=_0x42b396-(0x11+0xd6f+0x3*-0x439);var _0x8a9d8c=a0_0x399a();var _0x49b377=_0x8a9d8c[_0x42b396];if(a0_0x4f8c['GdCxUJ']===undefined){var _0x124994=function(_0x1eb3ac){var _0x1f67c7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0xb4fd7='',_0x2339ed='',_0xdd304c=_0xb4fd7+_0x124994;for(var _0x1a8504=-0x1a1b*-0x1+0x1*0x232c+-0xbd*0x53,_0x4150c2,_0x796bbe,_0x248cd7=-0x2e*0x95+0x1*0x2615+-0xb4f;_0x796bbe=_0x1eb3ac['charAt'](_0x248cd7++);~_0x796bbe&&(_0x4150c2=_0x1a8504%(-0xa3*-0x1d+0x8b*-0xc+0x1*-0xbef)?_0x4150c2*(-0x9*-0x19d+-0x25c9+0x1784)+_0x796bbe:_0x796bbe,_0x1a8504++%(0x106f+-0x245f*-0x1+-0x34ca))?_0xb4fd7+=_0xdd304c['charCodeAt'](_0x248cd7+(-0x100f+0x530+0xae9))-(0x1506+-0x3b*0x5f+0xe9)!==-0x1cb7*-0x1+-0x407+-0x18b0?String['fromCharCode'](0x91b+0x1*-0x1c8d+0x1471*0x1&_0x4150c2>>(-(-0xb7b*-0x2+-0x25bd*-0x1+-0x3cb1)*_0x1a8504&-0x1*-0xf46+-0x2499+0x1*0x1559)):_0x1a8504:-0xb6f*-0x3+0x1*-0x2119+-0x16*0xe){_0x796bbe=_0x1f67c7['indexOf'](_0x796bbe);}for(var _0x14140d=0xad0+-0x63*-0xb+0xf11*-0x1,_0x354c80=_0xb4fd7['length'];_0x14140d<_0x354c80;_0x14140d++){_0x2339ed+='%'+('00'+_0xb4fd7['charCodeAt'](_0x14140d)['toString'](-0x14c1+-0xa3*-0x37+-0x12f*0xc))['slice'](-(-0x55d*-0x7+-0xdb4*-0x1+-0x333d));}return decodeURIComponent(_0x2339ed);};var _0x296624=function(_0x12f555,_0x1b510b){var _0x42e5f5=[],_0x3f5753=0x2c8+0x3*0xc66+-0x27fa,_0x5e3ea9,_0x151f81='';_0x12f555=_0x124994(_0x12f555);var _0x1ab1b1;for(_0x1ab1b1=-0x155*-0xe+-0x25e4+-0x2*-0x99f;_0x1ab1b1<-0x125f*0x2+-0x1f77+0x4535;_0x1ab1b1++){_0x42e5f5[_0x1ab1b1]=_0x1ab1b1;}for(_0x1ab1b1=0x2466*-0x1+0xeda*-0x2+0x2*0x210d;_0x1ab1b1<-0x2d1+0x4f*-0x34+0x13dd;_0x1ab1b1++){_0x3f5753=(_0x3f5753+_0x42e5f5[_0x1ab1b1]+_0x1b510b['charCodeAt'](_0x1ab1b1%_0x1b510b['length']))%(-0x2295+0x8a3+0x2*0xd79),_0x5e3ea9=_0x42e5f5[_0x1ab1b1],_0x42e5f5[_0x1ab1b1]=_0x42e5f5[_0x3f5753],_0x42e5f5[_0x3f5753]=_0x5e3ea9;}_0x1ab1b1=-0x1*0x16e3+-0x1*0x8ef+-0x2*-0xfe9,_0x3f5753=-0x20a1+0x1e*-0x146+-0x46d5*-0x1;for(var _0x1a2415=0x514+0x942*0x1+-0x2*0x72b;_0x1a2415<_0x12f555['length'];_0x1a2415++){_0x1ab1b1=(_0x1ab1b1+(0x11*0x1c9+-0x4*0x7ce+-0x7*-0x20))%(0x1*-0x84f+0x1d69+-0x141a),_0x3f5753=(_0x3f5753+_0x42e5f5[_0x1ab1b1])%(-0x1*-0x59f+-0x207e+0x1bdf),_0x5e3ea9=_0x42e5f5[_0x1ab1b1],_0x42e5f5[_0x1ab1b1]=_0x42e5f5[_0x3f5753],_0x42e5f5[_0x3f5753]=_0x5e3ea9,_0x151f81+=String['fromCharCode'](_0x12f555['charCodeAt'](_0x1a2415)^_0x42e5f5[(_0x42e5f5[_0x1ab1b1]+_0x42e5f5[_0x3f5753])%(0x703+0x1c4b+0x2*-0x1127)]);}return _0x151f81;};a0_0x4f8c['IkvJHB']=_0x296624,a0_0x4f8c['ZcOhjw']={},a0_0x4f8c['GdCxUJ']=!![];}var _0x2663e5=_0x8a9d8c[0x170f*-0x1+0x1*-0x1a2f+0x313e],_0x3c01dd=_0x42b396+_0x2663e5,_0x248ee4=a0_0x4f8c['ZcOhjw'][_0x3c01dd];if(!_0x248ee4){if(a0_0x4f8c['JEWFdn']===undefined){var _0x4bd7e=function(_0x1651da){this['RQNIod']=_0x1651da,this['hdSpFS']=[0x1*0x22bb+0x1*-0x13e7+-0xb*0x159,0x2*0x6f7+-0x47d+0x1*-0x971,-0x2284+-0x3*-0x66e+0x1*0xf3a],this['cLVDSZ']=function(){return'newState';},this['QvUdJQ']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['Bnfiqk']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x4bd7e['prototype']['UyNBMM']=function(){var _0xaacf7a=new RegExp(this['QvUdJQ']+this['Bnfiqk']),_0x57247b=_0xaacf7a['test'](this['cLVDSZ']['toString']())?--this['hdSpFS'][-0x1a5e+0x9*-0x1a7+0x293e]:--this['hdSpFS'][0x394*0x8+0x351*-0xb+0x1*0x7db];return this['EPudgz'](_0x57247b);},_0x4bd7e['prototype']['EPudgz']=function(_0x39b5fc){if(!Boolean(~_0x39b5fc))return _0x39b5fc;return this['LtglyS'](this['RQNIod']);},_0x4bd7e['prototype']['LtglyS']=function(_0x44e9a4){for(var _0x2b4c92=-0x23b*-0xa+-0x8f*0x1f+-0x4fd,_0x336473=this['hdSpFS']['length'];_0x2b4c92<_0x336473;_0x2b4c92++){this['hdSpFS']['push'](Math['round'](Math['random']())),_0x336473=this['hdSpFS']['length'];}return _0x44e9a4(this['hdSpFS'][0x9*-0x3eb+0x30c*0x3+0x1a1f]);},new _0x4bd7e(a0_0x4f8c)['UyNBMM'](),a0_0x4f8c['JEWFdn']=!![];}_0x49b377=a0_0x4f8c['IkvJHB'](_0x49b377,_0x517031),a0_0x4f8c['ZcOhjw'][_0x3c01dd]=_0x49b377;}else _0x49b377=_0x248ee4;return _0x49b377;}import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x3c26e1 as AssetCache,a0_0x5bd459 as AssetLoader,a0_0x2c41c0 as AssetSystem,a0_0x4292dd as AssetTextures,a0_0x5e9e38 as Assets,a0_0x33c890 as BaseSystem,a0_0x168503 as GameEngine,a0_0x5d1581 as GameObject,a0_0x2e965c as GameObjectManager,a0_0xe874e5 as ObjectFactory,a0_0x3314e1 as Renderer,a0_0x290652 as RuntimeObjectRegistry,a0_0x1fd16f as Transform,a0_0x399634 as applyScreenAnchor,a0_0x2d7a70 as basePixi,a0_0x343cdd as clearResponsiveElements,a0_0x51973a as createPixiBase,a0_0x46735b as getRegisteredFontIds,a0_0xfac603 as globalResponsiveMultipliers,a0_0x2c40a0 as initAssetTextures,a0_0xd86bcb as initAssets,a0_0xeeeadb as layout,a0_0x5c7e0b as playLottieOverlay,a0_0x103363 as registerFont,a0_0x50f603 as registerType,a0_0x5235b4 as resolveAnchorVec2,a0_0x3006f0 as resolveFont,a0_0x373f20 as resolveFontWeight,a0_0x5f48e8 as resolveScreenAnchorPoint,a0_0x40695b as resolveScreenRatioPoint,a0_0x575fae as runInitSequence,a0_0x171657 as setLottieInstance,a0_0x94986e as spawnSceneFromConfig,a0_0xb6f949 as updateScreenState};
|
|
1
|
+
(function(_0x8295c6,_0x1a942d){var a0_0x300e1e={_0x4456fa:0x2f,_0x2db948:'Ix*f',_0x3b9981:0x29,_0x23ec73:'9Qfr',_0x12319e:0xca,_0x50b555:0xd1,_0xffa1d6:0x2e,_0x433a14:0x20,_0x12b1be:0x39,_0x196bdc:0xbb,_0x5d76df:'jZ)m',_0x33c94a:0xc4,_0x5757ac:0xc5,_0xde859c:0xcc,_0x25565d:0x17,_0x411f33:0x1d,_0x2af6e0:'iCgl',_0xfb0c06:0x10,_0x3ebcd7:0x2c,_0x46806e:'dh4#',_0x1b1e38:0x35,_0x36b609:0x256,_0x1e7e42:0x250,_0x131447:0x247,_0x17beea:0x250,_0x1406e5:'uUo&',_0x1c9862:0xc2,_0xb22e9e:'&N#@',_0xa02a9f:0xd0,_0x48e509:0xc6,_0x80afcf:0xba,_0x5c1ca3:0x26b,_0x1d9484:0x25d,_0x419037:0x261,_0x51ef21:0x255,_0x321f70:'IK@i',_0x5b674a:0xc1,_0x276d14:'KiNu',_0x44edb0:0xbc},a0_0x520aff={_0x4345da:0x199},a0_0x2a5498={_0xc8c4eb:0x183};function _0x469cea(_0x57d7f5,_0x2c6be2,_0x577ccf,_0x550d9f,_0x213696){return a0_0x2b90(_0x550d9f- -a0_0x2a5498._0xc8c4eb,_0x2c6be2);}var _0x5ecf3d=_0x8295c6();function _0x21e9ce(_0x1990da,_0x2bd051,_0x2509a6,_0x45cf39,_0x14d13f){return a0_0x2b90(_0x1990da- -0x9f,_0x2509a6);}function _0x48d819(_0x60b60f,_0x115000,_0x1852e6,_0x49a596,_0x594cb8){return a0_0x2b90(_0x115000-a0_0x520aff._0x4345da,_0x594cb8);}while(!![]){try{var _0x449371=-parseInt(_0x21e9ce(a0_0x300e1e._0x4456fa,0x38,a0_0x300e1e._0x2db948,a0_0x300e1e._0x3b9981,0x38))/(-0x16ec+0xe37*-0x2+-0x335b*-0x1)+parseInt(_0x469cea(-0xca,a0_0x300e1e._0x23ec73,-0xc9,-a0_0x300e1e._0x12319e,-a0_0x300e1e._0x50b555))/(0x49f+-0x37f*0x8+0x1*0x175b)*(parseInt(_0x21e9ce(a0_0x300e1e._0xffa1d6,a0_0x300e1e._0x433a14,'IK@i',a0_0x300e1e._0x12b1be,0x25))/(-0x245f+-0x10*0xb6+0x17e1*0x2))+parseInt(_0x469cea(-a0_0x300e1e._0x196bdc,a0_0x300e1e._0x5d76df,-a0_0x300e1e._0x33c94a,-a0_0x300e1e._0x5757ac,-a0_0x300e1e._0xde859c))/(0x7dd+0x5*-0x5d9+0x25*0x94)+parseInt(_0x21e9ce(a0_0x300e1e._0x25565d,a0_0x300e1e._0x411f33,a0_0x300e1e._0x2af6e0,0xc,a0_0x300e1e._0xfb0c06))/(0x293*0x7+0xe27+-0x2027)*(parseInt(_0x21e9ce(a0_0x300e1e._0x3ebcd7,0x36,a0_0x300e1e._0x46806e,a0_0x300e1e._0x1b1e38,0x29))/(0x1*-0xa57+0x14e*0xc+0x10f*-0x5))+parseInt(_0x48d819(a0_0x300e1e._0x36b609,a0_0x300e1e._0x1e7e42,a0_0x300e1e._0x131447,a0_0x300e1e._0x17beea,a0_0x300e1e._0x1406e5))/(-0x1494+-0xac3+0x1f5e)+parseInt(_0x469cea(-a0_0x300e1e._0x1c9862,a0_0x300e1e._0xb22e9e,-a0_0x300e1e._0xa02a9f,-a0_0x300e1e._0x48e509,-a0_0x300e1e._0x80afcf))/(-0x5a*-0xe+-0x1cb1+0x17cd)*(-parseInt(_0x48d819(a0_0x300e1e._0x5c1ca3,a0_0x300e1e._0x1d9484,a0_0x300e1e._0x419037,a0_0x300e1e._0x51ef21,a0_0x300e1e._0x321f70))/(0x17dd+-0xe5*-0x1c+0xc38*-0x4))+-parseInt(_0x469cea(-a0_0x300e1e._0x5b674a,a0_0x300e1e._0x276d14,-0xb1,-0xbc,-a0_0x300e1e._0x44edb0))/(-0x1bd0+-0xa3a*-0x1+-0x234*-0x8);if(_0x449371===_0x1a942d)break;else _0x5ecf3d['push'](_0x5ecf3d['shift']());}catch(_0x21f5cd){_0x5ecf3d['push'](_0x5ecf3d['shift']());}}}(a0_0x3d93,0x3f59c+-0xaeb94+0xdc3ad));var a0_0x512287=(function(){var _0x34d09a=!![];return function(_0x1e6c30,_0x15228d){var a0_0x344da8={_0x1b430f:'FWfL',_0x21f503:0x13e,_0x441f2e:0x12f},_0x392d25=_0x34d09a?function(){var a0_0x3bd1ee={_0x6ad542:0x1ec};function _0x5c957d(_0x1e3c8e,_0x2b3e73,_0x2af008,_0x123161,_0x2c2db0){return a0_0x2b90(_0x2c2db0- -a0_0x3bd1ee._0x6ad542,_0x1e3c8e);}if(_0x15228d){var _0x50fef6=_0x15228d[_0x5c957d(a0_0x344da8._0x1b430f,-a0_0x344da8._0x21f503,-0x137,-a0_0x344da8._0x441f2e,-0x131)](_0x1e6c30,arguments);return _0x15228d=null,_0x50fef6;}}:function(){};return _0x34d09a=![],_0x392d25;};}()),a0_0x28345b=a0_0x512287(this,function(){var a0_0x1dd9dc={_0x5aca6c:0x3c3,_0x51af2b:'honh',_0x41134c:0x3ca,_0x4d7b12:0x3ca,_0x40fa73:0x3c8,_0x951fea:0x3bb,_0x8706c3:0x3b2,_0x4f4763:0xb2,_0x2393c9:'x*)J',_0x2b7458:0xbb,_0x505a03:0xb7,_0x1d8581:0x3ab,_0x2609cb:0x3b5,_0x599519:0x3b4,_0x1b6fdd:0x3c3,_0x3cf4f4:'3DAz',_0x48b0af:0x219,_0x58a2d5:0x215,_0xa01024:0x21f,_0x386672:0xb2,_0x3d20fe:0xb8,_0xce0e03:0x3b4,_0x5cbdae:0x3c2,_0x52f32a:'@BJz',_0x40068a:0xae,_0x8f55f7:0xb0,_0x1b543f:'uUo&',_0x3d96ec:0xc8,_0x4d4711:0xbe,_0x25bd82:0xaa,_0x3d14fc:0xab,_0x7b30a5:0x9f,_0x135de9:'JYjB',_0x6f5b97:0x211,_0x577477:0x201,_0x15bacb:0x20a},a0_0x3b2b65={_0x4b0b75:0x2d9},a0_0x5ca43d={_0x18e2b0:0x170},_0x3bcebb={};function _0x51ff6d(_0x3b5bd9,_0x18933a,_0x3a6d47,_0x4870f9,_0x5a3366){return a0_0x2b90(_0x3a6d47- -a0_0x5ca43d._0x18e2b0,_0x18933a);}function _0x3e061e(_0x365ead,_0x20a0c6,_0x4f4d1f,_0x466e3e,_0x5848dc){return a0_0x2b90(_0x5848dc- -a0_0x3b2b65._0x4b0b75,_0x365ead);}_0x3bcebb['sWhDk']=_0x282c4f(a0_0x1dd9dc._0x5aca6c,0x3be,a0_0x1dd9dc._0x51af2b,a0_0x1dd9dc._0x41134c,a0_0x1dd9dc._0x4d7b12)+_0x282c4f(a0_0x1dd9dc._0x40fa73,0x3bb,'tiqv',a0_0x1dd9dc._0x951fea,a0_0x1dd9dc._0x8706c3)+'+$';var _0x1aa928=_0x3bcebb;function _0x282c4f(_0x1aaf5f,_0x43b2fa,_0x1b1d39,_0xb5e3ab,_0x4a14f6){return a0_0x2b90(_0x43b2fa-0x2f6,_0x1b1d39);}return a0_0x28345b[_0x51ff6d(-a0_0x1dd9dc._0x4f4763,a0_0x1dd9dc._0x2393c9,-a0_0x1dd9dc._0x2b7458,-a0_0x1dd9dc._0x505a03,-a0_0x1dd9dc._0x505a03)+_0x282c4f(a0_0x1dd9dc._0x1d8581,a0_0x1dd9dc._0x2609cb,')gjo',a0_0x1dd9dc._0x599519,a0_0x1dd9dc._0x1b6fdd)]()[_0x3e061e(a0_0x1dd9dc._0x3cf4f4,-0x21c,-a0_0x1dd9dc._0x48b0af,-a0_0x1dd9dc._0x58a2d5,-a0_0x1dd9dc._0xa01024)+'h'](_0x1aa928[_0x51ff6d(-a0_0x1dd9dc._0x386672,'W37]',-a0_0x1dd9dc._0x3d20fe,-a0_0x1dd9dc._0x4f4763,-0xb2)])[_0x282c4f(a0_0x1dd9dc._0xce0e03,a0_0x1dd9dc._0x5cbdae,a0_0x1dd9dc._0x52f32a,0x3c7,0x3b6)+_0x51ff6d(-a0_0x1dd9dc._0x40068a,'Ida@',-a0_0x1dd9dc._0x8f55f7,-a0_0x1dd9dc._0x4f4763,-a0_0x1dd9dc._0x40068a)]()[_0x51ff6d(-0xc0,a0_0x1dd9dc._0x1b543f,-0xbc,-a0_0x1dd9dc._0x3d96ec,-a0_0x1dd9dc._0x4d4711)+_0x51ff6d(-a0_0x1dd9dc._0x25bd82,'B^Cg',-0xa7,-a0_0x1dd9dc._0x3d14fc,-a0_0x1dd9dc._0x7b30a5)+'r'](a0_0x28345b)[_0x3e061e(a0_0x1dd9dc._0x135de9,-0x20b,-a0_0x1dd9dc._0x6f5b97,-a0_0x1dd9dc._0x577477,-a0_0x1dd9dc._0x15bacb)+'h'](_0x1aa928['sWhDk']);});a0_0x28345b();import{A as a0_0x59fc1f,B as a0_0x2e0348,C as a0_0x3eb3e7,D as a0_0x4feeba,b as a0_0x1710f6,c as a0_0x2df5c9,d as a0_0x3c5d79,e as a0_0x77bad0,f as a0_0x2c08d1,g as a0_0x368899,h as a0_0x41bff1,i as a0_0x13c51f,j as a0_0x4003ed,k as a0_0x280fb8,l as a0_0x1bbf46,m as a0_0x382cca,n as a0_0x283791,o as a0_0x36bf1b,p as a0_0x4b2ed8,q as a0_0x4d170e,r as a0_0x3cb6e6,s as a0_0x9d8815,t as a0_0xe21e1b,u as a0_0x237aed,v as a0_0x1ae667,w as a0_0x3921d2,x as a0_0x524991,y as a0_0x5c2462,z as a0_0x316c9e}from'../chunk-6OPDY4ZF.js';function a0_0x3d93(){var _0x567dd1=['WOOUfv3dPCo/DrFdSGZcPM7cTG','WQ94W5dcLSkFWO/cLv7cNSkNW53cHrW','W4xcTxhcQSoJ','Eg8gyca','WQpcNK0NW7VcMXTgeh7cVM0','W7lcL8kecSkXWRi2sW','W4RdMmkEWP3dSq','W4dcOSo0tCopW7NcSq','WOGQgLZdOSo9nXRdUb7cQgK','W6KUWPBdQ8od','W5RcJrxcRCoO','W7VdHxhcPmoB','WOuyBmocEeWLpmkSW785Aq','WOVdLuNdP8kUW4b2W73cKmoEFt5+','W5j2WRldMMy','WPpcN8k/hCowWQdcUSkoWPToW64lW5u','bsjIW7VdTq','W41bw8kBW4u','r3i1WRNcOwxcIIxcTrZcSCoi','WQBcNKWIW7RcLv9QdupcTLmd','bGebWPfGW7BdSColFqOkW41s','W7VdNmkn','WQmgWOW','WO80pe0+WQrd','W5JdUeJdUCorWPxdQmk0','AJSSWQJdKCkLu8kJW6VcLmknb3K','W4RcJ8oHvmofW7pcPW','WPhcTvHGpa'];a0_0x3d93=function(){return _0x567dd1;};return a0_0x3d93();}import{a as a0_0x396713,b as a0_0x8184b0,c as a0_0x4319dd,d as a0_0x2a07fd,e as a0_0x212dec}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';function a0_0x2b90(_0x3042b4,_0x3eea43){_0x3042b4=_0x3042b4-(-0x1*0x1cbb+0x2*0xa9f+0x831);var _0x337c6d=a0_0x3d93();var _0x430e1a=_0x337c6d[_0x3042b4];if(a0_0x2b90['hNGnpP']===undefined){var _0x45ae1a=function(_0x2281a8){var _0x2310f8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x42cc12='',_0x4a7fb9='',_0x3e5b64=_0x42cc12+_0x45ae1a;for(var _0x2fdde1=-0x1*0xb32+-0x1736+-0x3*-0xb78,_0x4b4698,_0x396f19,_0x50da9f=-0xe5*-0xd+0x1cfb+0x1*-0x289c;_0x396f19=_0x2281a8['charAt'](_0x50da9f++);~_0x396f19&&(_0x4b4698=_0x2fdde1%(0x1631*0x1+0x174e*-0x1+0x121)?_0x4b4698*(0xac*0x34+-0x22be*-0x1+-0x456e)+_0x396f19:_0x396f19,_0x2fdde1++%(0x674+0x2*-0xe96+-0x1e5*-0xc))?_0x42cc12+=_0x3e5b64['charCodeAt'](_0x50da9f+(0x2462+0x623+-0x57*0x7d))-(-0x9ca+-0x1*-0x883+0x151)!==0xa05*0x3+-0x3ea+-0x1*0x1a25?String['fromCharCode'](0x16e1*-0x1+-0x3f5*0x2+-0xfe5*-0x2&_0x4b4698>>(-(0x10*-0x209+0x32*-0xc5+0x470c)*_0x2fdde1&0xede+0x4*-0x4a0+0x24*0x1a)):_0x2fdde1:-0x223c+-0xd3c+-0x188*-0x1f){_0x396f19=_0x2310f8['indexOf'](_0x396f19);}for(var _0x1691ff=-0x1a2f*-0x1+-0xe92+-0x3*0x3df,_0x228e1b=_0x42cc12['length'];_0x1691ff<_0x228e1b;_0x1691ff++){_0x4a7fb9+='%'+('00'+_0x42cc12['charCodeAt'](_0x1691ff)['toString'](-0x6ad*-0x5+0x1c09*-0x1+-0x152*0x4))['slice'](-(0x8aa*0x4+-0x15f+-0x2147));}return decodeURIComponent(_0x4a7fb9);};var _0x80e21c=function(_0x2065aa,_0x2729c2){var _0x10304e=[],_0x35b1c3=0xa63+0x9*-0x3a9+0x168e,_0xcabb6c,_0x493d82='';_0x2065aa=_0x45ae1a(_0x2065aa);var _0xe24c15;for(_0xe24c15=-0x23cb+-0x5*0x140+0xe5*0x2f;_0xe24c15<0x1817+0xaac+-0x21c3;_0xe24c15++){_0x10304e[_0xe24c15]=_0xe24c15;}for(_0xe24c15=0x884*-0x2+0x1*0x7bd+0x94b;_0xe24c15<0xfe8+-0x4a3*0x1+-0xa45;_0xe24c15++){_0x35b1c3=(_0x35b1c3+_0x10304e[_0xe24c15]+_0x2729c2['charCodeAt'](_0xe24c15%_0x2729c2['length']))%(-0xa*-0xc7+0x1b4a+-0x2210),_0xcabb6c=_0x10304e[_0xe24c15],_0x10304e[_0xe24c15]=_0x10304e[_0x35b1c3],_0x10304e[_0x35b1c3]=_0xcabb6c;}_0xe24c15=0xd*0x281+0x197d+-0x3a0a,_0x35b1c3=0x176a+0x179*0x1a+-0x3db4;for(var _0x2ee2d6=0x1cb6+0x2236+-0x3eec;_0x2ee2d6<_0x2065aa['length'];_0x2ee2d6++){_0xe24c15=(_0xe24c15+(0x99d*0x1+0x2621+0xb*-0x457))%(0x2224+-0x8cd*-0x3+0x1*-0x3b8b),_0x35b1c3=(_0x35b1c3+_0x10304e[_0xe24c15])%(-0x262e+0x39*-0x61+0x3cc7*0x1),_0xcabb6c=_0x10304e[_0xe24c15],_0x10304e[_0xe24c15]=_0x10304e[_0x35b1c3],_0x10304e[_0x35b1c3]=_0xcabb6c,_0x493d82+=String['fromCharCode'](_0x2065aa['charCodeAt'](_0x2ee2d6)^_0x10304e[(_0x10304e[_0xe24c15]+_0x10304e[_0x35b1c3])%(-0x1d40+0xc97*-0x1+-0x3e5*-0xb)]);}return _0x493d82;};a0_0x2b90['OXMTce']=_0x80e21c,a0_0x2b90['WLHetH']={},a0_0x2b90['hNGnpP']=!![];}var _0x40f5ff=_0x337c6d[0xc2*0x2f+-0x1*0xf1a+-0x1484],_0x51016c=_0x3042b4+_0x40f5ff,_0x49b965=a0_0x2b90['WLHetH'][_0x51016c];if(!_0x49b965){if(a0_0x2b90['NqwAHB']===undefined){var _0x25548d=function(_0x4cd026){this['XIguoH']=_0x4cd026,this['VAZZQG']=[-0x165*-0xe+0x216e*-0x1+-0x4a3*-0x3,-0x607*-0x4+-0x17f3+0x1*-0x29,0x144*-0x12+-0xdc+-0x11*-0x164],this['piaxFR']=function(){return'newState';},this['rTylVY']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['KlRtIB']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x25548d['prototype']['OcuoUm']=function(){var _0x4e4265=new RegExp(this['rTylVY']+this['KlRtIB']),_0x684b20=_0x4e4265['test'](this['piaxFR']['toString']())?--this['VAZZQG'][0x2520+-0x16ec+0xe33*-0x1]:--this['VAZZQG'][-0x1e4*-0x10+-0x1a2e+-0x209*0x2];return this['QLTOIi'](_0x684b20);},_0x25548d['prototype']['QLTOIi']=function(_0x41e1c6){if(!Boolean(~_0x41e1c6))return _0x41e1c6;return this['tSuAgS'](this['XIguoH']);},_0x25548d['prototype']['tSuAgS']=function(_0x14c88e){for(var _0x5055f0=0x186f+0x3ba+-0x1c29,_0x5980dd=this['VAZZQG']['length'];_0x5055f0<_0x5980dd;_0x5055f0++){this['VAZZQG']['push'](Math['round'](Math['random']())),_0x5980dd=this['VAZZQG']['length'];}return _0x14c88e(this['VAZZQG'][0x67*0x5b+-0x255*0x5+-0x18f4]);},new _0x25548d(a0_0x2b90)['OcuoUm'](),a0_0x2b90['NqwAHB']=!![];}_0x430e1a=a0_0x2b90['OXMTce'](_0x430e1a,_0x3eea43),a0_0x2b90['WLHetH'][_0x51016c]=_0x430e1a;}else _0x430e1a=_0x49b965;return _0x430e1a;}export{a0_0x396713 as AssetCache,a0_0x4319dd as AssetLoader,a0_0x237aed as AssetSystem,a0_0x2a07fd as AssetTextures,a0_0x9d8815 as Assets,a0_0x36bf1b as BaseSystem,a0_0x283791 as GameEngine,a0_0x77bad0 as GameObject,a0_0x2c08d1 as GameObjectManager,a0_0x382cca as ObjectFactory,a0_0x3c5d79 as Renderer,a0_0x4b2ed8 as RuntimeObjectRegistry,a0_0x2df5c9 as Transform,a0_0x2e0348 as applyScreenAnchor,a0_0x4d170e as basePixi,a0_0x3921d2 as clearResponsiveElements,a0_0x1710f6 as createPixiBase,a0_0x4003ed as getRegisteredFontIds,a0_0x1ae667 as globalResponsiveMultipliers,a0_0x212dec as initAssetTextures,a0_0xe21e1b as initAssets,a0_0x3eb3e7 as layout,a0_0x1bbf46 as playLottieOverlay,a0_0x13c51f as registerFont,a0_0x8184b0 as registerType,a0_0x5c2462 as resolveAnchorVec2,a0_0x368899 as resolveFont,a0_0x41bff1 as resolveFontWeight,a0_0x316c9e as resolveScreenAnchorPoint,a0_0x59fc1f as resolveScreenRatioPoint,a0_0x4feeba as runInitSequence,a0_0x280fb8 as setLottieInstance,a0_0x3cb6e6 as spawnSceneFromConfig,a0_0x524991 as updateScreenState};
|
package/dist/three/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Xo={};ra(Xo,{AspectClass:()=>In,GameObject:()=>ot,GameObjectManager:()=>$t,Renderer:()=>rt,ResponsiveUISystem:()=>Ge,Transform:()=>st,animateHandClick:()=>xs,animatePanelEntrance:()=>vs,createBrushTexture:()=>_s,createEndGamePanel:()=>ys,createHandTutorial:()=>ws,createThreeBase:()=>fs,createTutorialLabel:()=>Es,getAspectClass:()=>Dt,getRegisteredFontIds:()=>bs,loadAsset:()=>$n,loadCharacterFrames:()=>Ts,registerFont:()=>ms,resolveFont:()=>Z,resolveFontWeight:()=>Q,updateHandAnimation:()=>Ss});module.exports=xr(Xo);var V=ae(require("three"),1);var ge={};function mt(t,e,n=!1){ge[t]||(ge[t]=[]),ge[t].push({fn:e,once:n})}function Xt(t,e){if(ge[t]){if(!e){delete ge[t];return}ge[t]=ge[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=ge[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Xt(t,i.fn)}function B(t,e){mt(t,e,!0)}var P=null,W=[],ke=null;function da(t){P=t,W=[],ke!==null&&(clearTimeout(ke),ke=null)}function pa(){var t,e,n;return{endpoint:(P==null?void 0:P.endpoint)||"",transport:(P==null?void 0:P.transport)||"beacon",batchSize:(t=P==null?void 0:P.batchSize)!=null?t:10,flushIntervalMs:(e=P==null?void 0:P.flushIntervalMs)!=null?e:300,maxQueue:(n=P==null?void 0:P.maxQueue)!=null?n:200,debug:!!(P!=null&&P.debug)}}async function la(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(W.push(t),W.length>n.maxQueue&&(W=W.slice(W.length-n.maxQueue)),W.length>=n.batchSize){ca();return}ke===null&&(ke=window.setTimeout(()=>{ke=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||W.length===0)return;let e=W.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),W.length>0&&await la(t.endpoint,{events:W.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function wr(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Ve(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Er(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function ga(t,e,n){try{t[e]=n}catch{}}function Sr(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ha(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function fa(t,e){let n=Sr(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function ma(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,o(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},s=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var c,g;let p=Ve();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,x=ua(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;x=ua(E)}let f=u.ease(x);u.yoyo&&y%2===1&&(f=1-f);for(let E of u.props)ga(u.target,E.key,E.from+(E.to-E.from)*f);u.scaleFrom&&u.scaleTo&&ha(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*f,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*f});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){r(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=wr(c.ease),x=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),f=[];for(let S of Object.keys(c)){if(y.has(S))continue;let A=c[S];typeof A=="number"&&f.push({key:S,from:Er(p,S),to:A})}let m=fa(p,c);return{target:p,startMs:Ve(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:x,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>r(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Ve())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ve(),b=Ve()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&ga(p,u,b)}let g=fa(p,c);g.to&&ha(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))r(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let f=typeof y=="string"?y.trim():"";return f.startsWith("+=")?g+Math.max(0,Number(f.slice(2))*1e3||0):f?Math.max(0,Number(f)*1e3||0):g},x=y=>{c.push(y);let f=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+f)},v={to(y,f,m){return x({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return x({kind:"fromTo",target:y,vars:m,from:f,atMs:h(E)}),v},play(){var y,f;if(u)return v;u=!0,b=[];for(let m of c)m.kind==="fromTo"&&d.set(m.target,(y=m.from)!=null?y:{}),b.push(d.to(m.target,{...m.vars,delay:m.atMs/1e3+((f=m.vars.delay)!=null?f:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function ba(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=ma()}catch{}}var ya={name:"handler-playable-sdk",version:"0.3.38",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 && 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/ && chmod +x dist/cli/*.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 && 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; 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 G=0,Cr=G++,va=G++,xa=G++,wa=G++,Ea=G++,Sa=G++,Aa=G++,Ca=G++,Ta=G++,_a=G++,La=G++,Ma=G++,T=Cr;function Pa(){return T===va}function ka(){return T===xa}function Ra(){return T===wa}function Oa(){return T===Ea}function Re(){return T===Sa}function Oe(){return T===Aa}function Ia(){return T===Ca}function ja(){return T===Ta}function Da(){return T===_a}function Zt(){return T===La}function Qt(){return T===Ma}function $a(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=va;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=xa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=wa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ea)}catch{}else if(e==="mintegral")window.gameReady&&(T=Sa);else if(e==="tapjoy")window.TJ_API&&(T=Aa);else if(e==="tiktok")window.openAppStore&&(T=Ca);else if(e==="smadex")try{window.smxTracking&&(T=Ta)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=_a)}catch{}else e==="vungle"?T=La:(t==="nucleo"||e==="nucleo")&&(T=Ma)}var yt=ae(require("lottie-web"),1),Ha=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var Tr=require("pixi.js");var en=require("pixi.js");var _r=null;function tn(t){_r=t}vt();nn();var Ye=require("pixi.js");vt();var Or=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",on=Or;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(on=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${on}`))}}catch{}var Ae=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${on}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ye.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let s=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Se.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ye.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(c=o==null?void 0:o.constructor)==null?void 0:c.name),this.applyTransform(o,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=r==null?void 0:r.constructor)==null?void 0:g.name,r),r&&(((u=r.constructor)==null?void 0:u.name)==="Container"||r instanceof Ye.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],x=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=o==null?void 0:o.constructor)==null?void 0:b.name),x=!0;break}}catch{continue}x||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform,n);return o}static applyTransform(e,n,i){var a,s,r,o,l;if(!(!n||!e)){if(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=n.position.x)!=null?r:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0){let d=(l=i==null?void 0:i.identity)==null?void 0:l.category,p=d==="ui"||d==="environment"?.2:1,c=n.scale*p;"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(c):e.scale=c)}n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor&&Array.isArray(n.anchor)&&("set"in e.anchor?e.anchor.set(n.anchor[0],n.anchor[1]):(e.anchor.x=n.anchor[0],e.anchor.y=n.anchor[1]))}}};var Ke=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var Dr=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Dr);Xe();var wt=require("pixi.js");Xe();var cn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await Ae.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ae.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},Hr=new cn,zr=new Proxy(Hr,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Xe();var Ba=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},pn=[];function Br(t,e,n,i,a,s,r){pn.push({element:t,originalScale:s,positionHelper:e,heightPercent:a}),e(t,n,i,a,s,r,!1)}function Gr(){pn.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function dn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),St.scale=le.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),Gr()}var Ze={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 Ur(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function qr(){return Ze}var Wr={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 Et(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function At(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Et(t[0],e.x),y:Et(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Et(i.x,e.x),y:Et(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Wr[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,x,v,y;let a=At(n),s=(u=i.inset)!=null?u:{},r=(b=i.padding)!=null?b:{x:0,y:0},o=((h=s.left)!=null?h:0)+r.x,l=((x=s.right)!=null?x:0)+r.x,d=((v=s.top)!=null?v:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,c=Math.max(0,t-o-l),g=Math.max(0,e-d-p);return{x:o+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,x,v,y,f,m;let a=(h=i.inset)!=null?h:{},s=(x=i.padding)!=null?x:{x:0,y:0},r=((v=a.left)!=null?v:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((f=a.top)!=null?f:0)+s.y,d=((m=a.bottom)!=null?m:0)+s.y,p=Math.max(0,t-r-o),c=Math.max(0,e-l-d),g=At(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:r+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,dn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),dn(window.innerWidth,window.innerHeight),window.updateDebugConfig=Ur,window.getDebugConfig=qr,window.copyConfig=io,window.applyConfig=Je,window.applyConfigForRatio=ao,window.positionAtBottom=qa,window.positionAtTop=Kr,window.positionAtCenter=Xr,window.positionAtLeft=Jr,window.positionAtRight=Zr,window.positionAtBottomLeft=Qr,window.positionAtBottomRight=eo,window.positionAtTopLeft=to,window.positionAtTopRight=no,window.applyPositionContract=Yr,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 Ct(t,e,n=0){return t*e+n}function Tt(t,e,n=0){return t*(1-e)+n}function _t(t,e,n=0){return t*e+n}function Lt(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Vr(t,e){return t*e}function Yr(t,e,n,i){var r,o,l,d,p,c,g,u,b,h,x,v,y,f,m,E,S,A,M,R;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=Ct(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),s=Tt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=_t(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),s=U(n,(v=(x=i.offset)==null?void 0:x.y)!=null?v:0);break;case"right":a=Lt(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),s=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(A=(S=i.offset)==null?void 0:S.x)!=null?A:0),s=U(n,(R=(M=i.offset)==null?void 0:M.y)!=null?R:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function qa(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Vr(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=s?a*le.scaleFactor:a;de(t,d),r&&!pn.find(p=>p.element===t)&&Br(t,qa,e,n,i,a,s)}function Kr(t,e,n,i=.1,a=1){ce(t,U(e),Ct(n,i)),de(t,a)}function Xr(t,e,n,i=0,a=0,s=1){ce(t,U(e,i),U(n,a)),de(t,s)}function Jr(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function Zr(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function Qr(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Tt(n,i)),de(t,s)}function eo(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Tt(n,i)),de(t,s)}function to(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Ct(n,i)),de(t,s)}function no(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Ct(n,i)),de(t,s)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ce={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 io(t){return t&&Ce[t]?JSON.parse(JSON.stringify(Ce[t])):JSON.parse(JSON.stringify(Ze))}function Je(t){Object.keys(t).forEach(e=>{let n=e;Ze[n]&&t[n]&&Object.assign(Ze[n],t[n])}),console.log("Config applied:",t)}function ao(t,e){let n=t/e;n>1.6?(Je(Ce.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ce.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ce.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ce.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ce,t.resolveAnchorVec2=t.resolveAnchorVec2||At,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function k(t,e){let n=(a,s)=>s===0?a:n(s,a%s),i=n(t,e);return`${t/i}:${e/i}`}var Bc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:k(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:k(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:k(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:k(360,780)}],Gc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:k(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:k(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:k(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:k(412,915)}],Uc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:k(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:k(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:k(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:k(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:k(800,1280)}],Ka=[{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:k(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:k(768,1024),mraidScale:.7}];var qc=[...Ka];var go=Ka[0];fe();var xo=ae(require("jszip"),1);function bo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function yo(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function vo(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function fn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await bo(a),r=await vo(s),o=yo(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(n=r==null?void 0:r.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Mt(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],b=r[c+2],h=!1;for(let x of l)if(Math.sqrt(Math.pow(g-x.r,2)+Math.pow(u-x.g,2)+Math.pow(b-x.b,2))<e){h=!0;break}h&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Xa=require("@google/genai");async function mn(t,e,n=[],i={}){var a,s,r,o,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Xa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",x=(r=(s=(a=b.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(x)for(let v of x)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var Ja=require("@google/genai");async function Pt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ja.GoogleGenAI({apiKey:t}),s=[{text:e}];n.length>0&&n.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var wo=require("pixi.js");Xe();fe();var Qa=require("pixi.js");var Eo=require("pixi.js");fe();function Mo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Po(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function ko(t){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Xo={};ra(Xo,{AspectClass:()=>In,GameObject:()=>ot,GameObjectManager:()=>$t,Renderer:()=>rt,ResponsiveUISystem:()=>Ge,Transform:()=>st,animateHandClick:()=>xs,animatePanelEntrance:()=>vs,createBrushTexture:()=>_s,createEndGamePanel:()=>ys,createHandTutorial:()=>ws,createThreeBase:()=>fs,createTutorialLabel:()=>Es,getAspectClass:()=>Dt,getRegisteredFontIds:()=>bs,loadAsset:()=>$n,loadCharacterFrames:()=>Ts,registerFont:()=>ms,resolveFont:()=>Z,resolveFontWeight:()=>Q,updateHandAnimation:()=>Ss});module.exports=xr(Xo);var V=ae(require("three"),1);var ge={};function mt(t,e,n=!1){ge[t]||(ge[t]=[]),ge[t].push({fn:e,once:n})}function Xt(t,e){if(ge[t]){if(!e){delete ge[t];return}ge[t]=ge[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=ge[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Xt(t,i.fn)}function B(t,e){mt(t,e,!0)}var P=null,W=[],ke=null;function da(t){P=t,W=[],ke!==null&&(clearTimeout(ke),ke=null)}function pa(){var t,e,n;return{endpoint:(P==null?void 0:P.endpoint)||"",transport:(P==null?void 0:P.transport)||"beacon",batchSize:(t=P==null?void 0:P.batchSize)!=null?t:10,flushIntervalMs:(e=P==null?void 0:P.flushIntervalMs)!=null?e:300,maxQueue:(n=P==null?void 0:P.maxQueue)!=null?n:200,debug:!!(P!=null&&P.debug)}}async function la(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(W.push(t),W.length>n.maxQueue&&(W=W.slice(W.length-n.maxQueue)),W.length>=n.batchSize){ca();return}ke===null&&(ke=window.setTimeout(()=>{ke=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||W.length===0)return;let e=W.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),W.length>0&&await la(t.endpoint,{events:W.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function wr(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Ve(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Er(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function ga(t,e,n){try{t[e]=n}catch{}}function Sr(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ha(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function fa(t,e){let n=Sr(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function ma(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,o(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},s=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var c,g;let p=Ve();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,x=ua(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;x=ua(E)}let f=u.ease(x);u.yoyo&&y%2===1&&(f=1-f);for(let E of u.props)ga(u.target,E.key,E.from+(E.to-E.from)*f);u.scaleFrom&&u.scaleTo&&ha(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*f,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*f});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){r(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=wr(c.ease),x=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),f=[];for(let S of Object.keys(c)){if(y.has(S))continue;let A=c[S];typeof A=="number"&&f.push({key:S,from:Er(p,S),to:A})}let m=fa(p,c);return{target:p,startMs:Ve(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:x,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>r(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Ve())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ve(),b=Ve()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&ga(p,u,b)}let g=fa(p,c);g.to&&ha(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))r(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let f=typeof y=="string"?y.trim():"";return f.startsWith("+=")?g+Math.max(0,Number(f.slice(2))*1e3||0):f?Math.max(0,Number(f)*1e3||0):g},x=y=>{c.push(y);let f=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+f)},v={to(y,f,m){return x({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return x({kind:"fromTo",target:y,vars:m,from:f,atMs:h(E)}),v},play(){var y,f;if(u)return v;u=!0,b=[];for(let m of c)m.kind==="fromTo"&&d.set(m.target,(y=m.from)!=null?y:{}),b.push(d.to(m.target,{...m.vars,delay:m.atMs/1e3+((f=m.vars.delay)!=null?f:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function ba(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=ma()}catch{}}var ya={name:"handler-playable-sdk",version:"0.3.40",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 && 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/ && chmod +x dist/cli/*.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 && 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; 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 G=0,Cr=G++,va=G++,xa=G++,wa=G++,Ea=G++,Sa=G++,Aa=G++,Ca=G++,Ta=G++,_a=G++,La=G++,Ma=G++,T=Cr;function Pa(){return T===va}function ka(){return T===xa}function Ra(){return T===wa}function Oa(){return T===Ea}function Re(){return T===Sa}function Oe(){return T===Aa}function Ia(){return T===Ca}function ja(){return T===Ta}function Da(){return T===_a}function Zt(){return T===La}function Qt(){return T===Ma}function $a(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=va;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=xa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=wa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ea)}catch{}else if(e==="mintegral")window.gameReady&&(T=Sa);else if(e==="tapjoy")window.TJ_API&&(T=Aa);else if(e==="tiktok")window.openAppStore&&(T=Ca);else if(e==="smadex")try{window.smxTracking&&(T=Ta)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=_a)}catch{}else e==="vungle"?T=La:(t==="nucleo"||e==="nucleo")&&(T=Ma)}var yt=ae(require("lottie-web"),1),Ha=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var Tr=require("pixi.js");var en=require("pixi.js");var _r=null;function tn(t){_r=t}vt();nn();var Ye=require("pixi.js");vt();var Or=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",on=Or;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(on=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${on}`))}}catch{}var Ae=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${on}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ye.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let s=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Se.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ye.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(c=o==null?void 0:o.constructor)==null?void 0:c.name),this.applyTransform(o,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=r==null?void 0:r.constructor)==null?void 0:g.name,r),r&&(((u=r.constructor)==null?void 0:u.name)==="Container"||r instanceof Ye.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],x=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=o==null?void 0:o.constructor)==null?void 0:b.name),x=!0;break}}catch{continue}x||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform,n);return o}static applyTransform(e,n,i){var a,s,r,o;!n||!e||(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=n.position.x)!=null?r:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor&&Array.isArray(n.anchor)&&("set"in e.anchor?e.anchor.set(n.anchor[0],n.anchor[1]):(e.anchor.x=n.anchor[0],e.anchor.y=n.anchor[1])))}};var Ke=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var Dr=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Dr);Xe();var wt=require("pixi.js");Xe();var cn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await Ae.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ae.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},Hr=new cn,zr=new Proxy(Hr,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Xe();var Ba=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},pn=[];function Br(t,e,n,i,a,s,r){pn.push({element:t,originalScale:s,positionHelper:e,heightPercent:a}),e(t,n,i,a,s,r,!1)}function Gr(){pn.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function dn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),St.scale=le.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),Gr()}var Ze={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 Ur(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function qr(){return Ze}var Wr={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 Et(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function At(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Et(t[0],e.x),y:Et(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Et(i.x,e.x),y:Et(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Wr[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,x,v,y;let a=At(n),s=(u=i.inset)!=null?u:{},r=(b=i.padding)!=null?b:{x:0,y:0},o=((h=s.left)!=null?h:0)+r.x,l=((x=s.right)!=null?x:0)+r.x,d=((v=s.top)!=null?v:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,c=Math.max(0,t-o-l),g=Math.max(0,e-d-p);return{x:o+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,x,v,y,f,m;let a=(h=i.inset)!=null?h:{},s=(x=i.padding)!=null?x:{x:0,y:0},r=((v=a.left)!=null?v:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((f=a.top)!=null?f:0)+s.y,d=((m=a.bottom)!=null?m:0)+s.y,p=Math.max(0,t-r-o),c=Math.max(0,e-l-d),g=At(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:r+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,dn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),dn(window.innerWidth,window.innerHeight),window.updateDebugConfig=Ur,window.getDebugConfig=qr,window.copyConfig=io,window.applyConfig=Je,window.applyConfigForRatio=ao,window.positionAtBottom=qa,window.positionAtTop=Kr,window.positionAtCenter=Xr,window.positionAtLeft=Jr,window.positionAtRight=Zr,window.positionAtBottomLeft=Qr,window.positionAtBottomRight=eo,window.positionAtTopLeft=to,window.positionAtTopRight=no,window.applyPositionContract=Yr,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 Ct(t,e,n=0){return t*e+n}function Tt(t,e,n=0){return t*(1-e)+n}function _t(t,e,n=0){return t*e+n}function Lt(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Vr(t,e){return t*e}function Yr(t,e,n,i){var r,o,l,d,p,c,g,u,b,h,x,v,y,f,m,E,S,A,M,R;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=Ct(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),s=Tt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=_t(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),s=U(n,(v=(x=i.offset)==null?void 0:x.y)!=null?v:0);break;case"right":a=Lt(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),s=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(A=(S=i.offset)==null?void 0:S.x)!=null?A:0),s=U(n,(R=(M=i.offset)==null?void 0:M.y)!=null?R:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function qa(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Vr(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=s?a*le.scaleFactor:a;de(t,d),r&&!pn.find(p=>p.element===t)&&Br(t,qa,e,n,i,a,s)}function Kr(t,e,n,i=.1,a=1){ce(t,U(e),Ct(n,i)),de(t,a)}function Xr(t,e,n,i=0,a=0,s=1){ce(t,U(e,i),U(n,a)),de(t,s)}function Jr(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function Zr(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function Qr(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Tt(n,i)),de(t,s)}function eo(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Tt(n,i)),de(t,s)}function to(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Ct(n,i)),de(t,s)}function no(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Ct(n,i)),de(t,s)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ce={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 io(t){return t&&Ce[t]?JSON.parse(JSON.stringify(Ce[t])):JSON.parse(JSON.stringify(Ze))}function Je(t){Object.keys(t).forEach(e=>{let n=e;Ze[n]&&t[n]&&Object.assign(Ze[n],t[n])}),console.log("Config applied:",t)}function ao(t,e){let n=t/e;n>1.6?(Je(Ce.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ce.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ce.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ce.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ce,t.resolveAnchorVec2=t.resolveAnchorVec2||At,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function k(t,e){let n=(a,s)=>s===0?a:n(s,a%s),i=n(t,e);return`${t/i}:${e/i}`}var Bc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:k(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:k(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:k(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:k(360,780)}],Gc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:k(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:k(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:k(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:k(412,915)}],Uc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:k(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:k(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:k(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:k(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:k(800,1280)}],Ka=[{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:k(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:k(768,1024),mraidScale:.7}];var qc=[...Ka];var go=Ka[0];fe();var xo=ae(require("jszip"),1);function bo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function yo(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function vo(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function fn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await bo(a),r=await vo(s),o=yo(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(n=r==null?void 0:r.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Mt(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],b=r[c+2],h=!1;for(let x of l)if(Math.sqrt(Math.pow(g-x.r,2)+Math.pow(u-x.g,2)+Math.pow(b-x.b,2))<e){h=!0;break}h&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Xa=require("@google/genai");async function mn(t,e,n=[],i={}){var a,s,r,o,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Xa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",x=(r=(s=(a=b.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(x)for(let v of x)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var Ja=require("@google/genai");async function Pt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ja.GoogleGenAI({apiKey:t}),s=[{text:e}];n.length>0&&n.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var wo=require("pixi.js");Xe();fe();var Qa=require("pixi.js");var Eo=require("pixi.js");fe();function Mo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Po(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function ko(t){return`
|
|
47
47
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
48
48
|
|
|
49
49
|
Provide a concise summary (2-3 sentences) covering:
|