beyond-simulator-web 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/dist/public/app.js +18 -3
- package/dist/public/editor.js +34 -12
- package/dist/public/index.html +1 -1
- package/dist/public/play-renderer.js +108 -107
- package/dist/public/play.js +2 -2
- package/dist/public/styles.css +3 -2
- package/dist/server.js +21 -18
- package/dist/worker.js +12 -9
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{spawn as Bh}from"node:child_process";import{createServer as Yh}from"node:http";import{readFileSync as Lh,realpathSync as ic}from"node:fs";import{extname as jh,resolve as nc}from"node:path";import{fileURLToPath as oc}from"node:url";import{createHash as Hh,timingSafeEqual as Uh}from"node:crypto";import{statSync as xh}from"node:fs";var ui={name:"beyond-simulator-web",version:"0.5.0",description:"Self-hosted editor, preview and play surface for Qianxing simulator saves",type:"module",main:"dist/server.js",bin:{"beyond-simulator-web":"dist/server.js"},files:["dist","README.md"],scripts:{build:"node ../scripts/build.mjs web",pretest:"node ../scripts/build.mjs web",prepack:"node ../scripts/build.mjs web",start:"node dist/server.js",dev:"node ../scripts/build.mjs web && node server.js",test:"node --test test/*.test.mjs"},engines:{node:">=20"},dependencies:{"@napi-rs/canvas":"0.1.100",fengari:"0.1.5",protobufjs:"8.7.2"},devDependencies:{react:"19.1.1","react-dom":"19.1.1","qxqy-editor-ui":"workspace:*","qxqy-studio":"workspace:*"},license:"GPL-3.0-only",repository:{type:"git",url:"git+https://github.com/1475505/miliastra-beyond-simulator.git",directory:"web"}};var $o="https://oss.070077.xyz/prefabs/",fi="prefab-v1",Ac=[[10003004,10003004],[10005001,10005142],[10006001,10006002],[10007002,10007002],[10008001,10008001],[10009001,10009011],[20001001,20001074],[20001076,20001121],[20001123,20001156],[20001158,20001302],[20001304,20001568],[20001570,20001999],[20002001,20002755],[20002757,20002999],[20003001,20003455],[30001001,30001016],[30002001,30002017],[30003001,30003011],[30004001,30004001],[30005001,30005020],[30006001,30006026],[30007001,30007013],[30008001,30008011]];function ji(e){return!Number.isSafeInteger(e)||!Ac.some(([t,i])=>e>=t&&e<=i)?null:e===10003004||e===10008001?128:256}var Hi="https://oss.070077.xyz/images/",Jr="sprite-v1",Ui="/qxqy-assets/",_c=[[100001,100006],[100101,100213],[101001,101018],[101020,101028],[101030,101046],[101048,101048],[101050,101054],[101056,101080],[102001,102052],[103001,103148],[104001,104010],[105001,105140],[105142,105219],[105221,105317],[106001,106047],[106049,106096],[107001,107007],[107010,107020],[107031,107092],[107094,107180],[107183,107201],[107203,107205],[107207,107228],[107231,107278],[107280,107402],[108001,108017],[108019,108020],[109001,109031],[109033,109034],[109036,109075],[110001,110053],[111001,111139],[112001,112042]];function ke(e){return e==null||e===""?"StaticReference":typeof e=="string"?e:typeof e.Name=="string"?e.Name:"Unknown"}function Xi(e,t){return`${ke(t)}:${e}`}function Go(e,t){return ke(t)==="StaticReference"&&it(e,t)}function it(e,t){let i=ke(t);return i==="Prefab"?ji(e)!==null:i==="StaticReference"&&Number.isSafeInteger(e)&&e>100006&&_c.some(([r,n])=>e>=r&&e<=n)}var Wi="7.1.0",ue=Object.freeze(["KEYBOARD","TOUCHSCREEN","CONTROLLER_CONSOLE","CONTROLLER_MOBILE"]),K=Object.freeze({"pc-16-9":{id:"pc-16-9",device:"pc",platform:"KEYBOARD",width:1600,height:900,ratio:"16:9",luaDevice:"KeyboardAndMouse",label:"PC 1600\xD7900"},"pc-21-9":{id:"pc-21-9",device:"pc",platform:"KEYBOARD",width:2100,height:900,ratio:"21:9",luaDevice:"KeyboardAndMouse",label:"PC 2100\xD7900"},"mobile-16-9":{id:"mobile-16-9",device:"mobile",platform:"TOUCHSCREEN",width:1280,height:720,ratio:"16:9",luaDevice:"Mobile",label:"\u624B\u673A 1280\xD7720"},"mobile-19.5-9":{id:"mobile-19.5-9",device:"mobile",platform:"TOUCHSCREEN",width:1560,height:720,ratio:"19.5:9",luaDevice:"Mobile",label:"\u624B\u673A 1560\xD7720"},"mobile-4-3":{id:"mobile-4-3",device:"mobile",platform:"TOUCHSCREEN",width:1280,height:960,ratio:"4:3",luaDevice:"Mobile",label:"\u624B\u673A 1280\xD7960"}}),Ki="pc-16-9",ve=2,Ft=Object.freeze({KEYBOARD:"pc-16-9",TOUCHSCREEN:"mobile-16-9",CONTROLLER_CONSOLE:"pc-16-9",CONTROLLER_MOBILE:"mobile-16-9"}),Ot=Object.freeze({"server-container":"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668",container:"\u5BB9\u5668\u8282\u70B9",textbox:"\u6587\u672C\u6846",image:"\u56FE\u7247",button:"\u9884\u8BBE\u6309\u94AE",cursor:"\u5149\u6807\u68C0\u6D4B\u533A\u57DF",grid:"\u7F51\u683C\u89C6\u7A97",reference:"\u6A21\u677F\u5F15\u7528\u63A7\u4EF6",textwindow:"\u6587\u672C\u89C6\u7A97",keyhint:"\u6309\u952E\u63D0\u793A",animation:"\u754C\u9762\u52A8\u6548",fullscreen:"\u5168\u5C4F\u52A8\u6548"}),qi=Object.freeze(["server-container","container","textbox","cursor","reference","grid","image","button","textwindow","keyhint","animation","fullscreen"]),Vo=Object.freeze({"server-container":null,container:[150,150],textbox:[100,40],image:[80,80],button:[150,50],cursor:[150,50],grid:[80,80],reference:[80,80],textwindow:[100,40],keyhint:[40,40],animation:[100,100],fullscreen:null}),Pc=Object.freeze({100001:"rect",100002:"circle",100003:"triangle",100004:"fourstar",100005:"fivestar",100006:"ring"});function zt(e,t){return ke(t)==="StaticReference"&&Pc[e]||(it(e,t)?"sprite":"missing")}var Bo=50888,di=Object.freeze({font:4294967295,bg:16777215,outline:858993459,image:4294967295});import{Worker as ph}from"node:worker_threads";import{existsSync as mh,mkdirSync as gh,readFileSync as Ro,writeFileSync as yh}from"node:fs";import{basename as bh,dirname as vh}from"node:path";import{existsSync as Fi,readFileSync as Hf}from"node:fs";import{randomUUID as nl}from"node:crypto";import{isAbsolute as Yo,win32 as Lo}from"node:path";function Ji(e,t=!1){let i=String(e??"").trim().replaceAll("\\","/");if(t&&(!i||i==="."))return"";if(!i||Yo(i)||Lo.isAbsolute(i)||i.split("/").some(r=>!r||r==="."||r===".."||/[<>:"|?*\x00-\x1f]/.test(r)||/[. ]$/.test(r)||/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(r)))throw new Error("\u811A\u672C\u76EE\u5F55/\u8DEF\u5F84\u5FC5\u987B\u662F\u6709\u6548\u7684\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u4E0D\u80FD\u5305\u542B .. \u6216 Windows \u7279\u6B8A\u6587\u4EF6\u540D");return i}function hi(e){if(e==null)return null;if(e.version!==1)throw new Error("unsupported scriptSync version");let t=String(e.clientImportRoot||"").trim();if(!Yo(t)&&!Lo.isAbsolute(t))throw new Error("\u5B9E\u673A\u5BFC\u5165\u6839\u76EE\u5F55\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84");return{version:1,workspaceDir:Ji(e.workspaceDir,!0),clientImportRoot:t,clientSubdir:Ji(e.clientSubdir,!0)}}import{basename as Qt,dirname as Uf,isAbsolute as Xf,join as ol,resolve as al}from"node:path";function Dt(e,t="$",i=new Set){if(e===void 0)throw new Error(`undefined at ${t}`);if(typeof e=="number"&&!Number.isFinite(e))throw new Error(`non-finite number at ${t}`);if(typeof e=="bigint"||typeof e=="function"||typeof e=="symbol")throw new Error(`non-JSON value at ${t}`);if(!(e===null||typeof e!="object")){if(i.has(e))throw new Error(`circular value at ${t}`);if(i.add(e),Array.isArray(e))e.forEach((r,n)=>Dt(r,`${t}[${n}]`,i));else for(let[r,n]of Object.entries(e))Dt(n,`${t}.${r}`,i);i.delete(e)}}function L(e){return Dt(e),JSON.parse(JSON.stringify(e))}function jo(e,t="$"){Dt(e,t)}function Ho(e){return K[e]||K[Ki]}function pi(e,t=0,i=0){return!e||typeof e!="object"?{x:t,y:i}:{x:Number(e.x??t),y:Number(e.y??i)}}function Tc(e){return!e||typeof e!="object"?{x:1,y:1,z:1}:{x:Number(e.x??1),y:Number(e.y??1),z:Number(e.z??1)}}function Rc(e){return!e||typeof e!="object"?{x:0,y:0,z:0}:{x:Number(e.x??0),y:Number(e.y??0),z:Number(e.z??0)}}function Qi({layout:e="center",size:t=[100,40],offset:i=[0,0]}={}){return e==="stretch"?{scale:{x:1,y:1,z:1},rotation:{x:0,y:0,z:0},anchorMin:{x:0,y:0},anchorMax:{x:1,y:1},offset:{x:0,y:0},size:{x:0,y:0},pivot:{x:.5,y:.5}}:{scale:{x:1,y:1,z:1},rotation:{x:0,y:0,z:0},anchorMin:{x:.5,y:.5},anchorMax:{x:.5,y:.5},offset:{x:Number(i[0]??0),y:Number(i[1]??0)},size:{x:Number(t[0]??0),y:Number(t[1]??0)},pivot:{x:.5,y:.5}}}function Be(e){let t=e||Qi();return{scale:Tc(t.scale),rotation:Rc(t.rotation),anchorMin:pi(t.anchorMin??t.anchor_min,.5,.5),anchorMax:pi(t.anchorMax??t.anchor_max,.5,.5),offset:pi(t.offset,0,0),size:pi(t.size,0,0),pivot:pi(t.pivot,.5,.5)}}function de(e,t=0){let i=Number(e);return Number.isFinite(i)?i:t}function Ue(e,t){let i=e.width,r=e.height,n=e.left,o=e.bottom,a=t.anchorMin||{x:t.anchorMinX,y:t.anchorMinY},s=t.anchorMax||{x:t.anchorMaxX,y:t.anchorMaxY},c=t.offset||{x:t.anchoredPositionX,y:t.anchoredPositionY},l=t.size||{x:t.sizeDeltaX,y:t.sizeDeltaY},u=t.pivot||{x:t.pivotX,y:t.pivotY},f=de(a?.x,.5)*i,h=de(a?.y,.5)*r,p=de(s?.x,.5)*i,m=de(s?.y,.5)*r,y=de(l?.x),I=de(l?.y),b=de(u?.x,.5),v=de(u?.y,.5),P=p-f+y,R=m-h+I,F=n+f+de(c?.x)-y*b,$=o+h+de(c?.y)-I*v;return{left:F,bottom:$,width:P,height:R,right:F+P,top:$+R,centerX:F+P/2,centerY:$+R/2}}function $t(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}}function Mc(e,t){return{a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,tx:e.a*t.tx+e.c*t.ty+e.tx,ty:e.b*t.tx+e.d*t.ty+e.ty}}function Ie(e,t,i){return{x:e.a*t+e.c*i+e.tx,y:e.b*t+e.d*i+e.ty}}function Xe(e){let t=e.a*e.d-e.b*e.c;return!Number.isFinite(t)||Math.abs(t)<1e-8?null:{a:e.d/t,b:-e.b/t,c:-e.c/t,d:e.a/t,tx:(e.c*e.ty-e.d*e.tx)/t,ty:(e.b*e.tx-e.a*e.ty)/t}}function Qr(e,t){let i=t.rotation||{x:t.localRotationX,y:t.localRotationY,z:t.localRotationZ},r=t.scale||{x:t.localScaleX,y:t.localScaleY},n=t.pivot||{x:t.pivotX,y:t.pivotY},o=de(i?.z)*Math.PI/180,a=Math.cos(o),s=Math.sin(o),c=de(i?.x)*Math.PI/180,l=de(i?.y)*Math.PI/180,u=Math.cos(c),f=Math.sin(c),h=Math.cos(l),p=Math.sin(l),m=Y=>Math.abs(Y)<1e-12?0:Y,y=de(r?.x,1),I=de(r?.y,1),b=e.left+e.width*de(n?.x,.5),v=e.bottom+e.height*de(n?.y,.5),P=m(h*a+p*f*s)*y,R=m(u*s)*y,F=m(-h*s+p*f*a)*I,$=m(u*a)*I;return{a:P,b:R,c:F,d:$,tx:b-P*b-F*v,ty:v-R*b-$*v}}function mi(e,t,i){return Mc(e||$t(),Qr(t,i))}function Uo(e,t){let i=Ie(t,e.centerX,e.centerY),r=Math.abs(e.width*Math.hypot(t.a,t.b)),n=Math.abs(e.height*Math.hypot(t.c,t.d));return{left:i.x-r/2,bottom:i.y-n/2,width:r,height:n,centerX:i.x,centerY:i.y,rotationZ:Math.atan2(t.b,t.a)*180/Math.PI}}function we(e){let t=typeof e=="string"?Ho(e):e;return{left:0,bottom:0,width:t.width,height:t.height,right:t.width,top:t.height,centerX:t.width/2,centerY:t.height/2}}function Zr(e){return{posX:e.centerX,posY:e.centerY,width:e.width,height:e.height}}function mt(e,t,i){let r=Be(t),n=e.width,o=e.height,a=r.anchorMin.x*n,s=r.anchorMin.y*o,c=r.anchorMax.x*n,l=r.anchorMax.y*o,u=Number(i.width),f=Number(i.height),h=Number(i.posX),p=Number(i.posY),m=h-u/2,y=p-f/2;return r.size={x:u-(c-a),y:f-(l-s)},r.offset={x:m-e.left-a+r.size.x*r.pivot.x,y:y-e.bottom-s+r.size.y*r.pivot.y},r}function Xo(e,t){let i=Be(e),n={"bottom-left":[[0,0],[0,0],[0,0]],bottom:[[.5,0],[.5,0],[.5,0]],"bottom-right":[[1,0],[1,0],[1,0]],left:[[0,.5],[0,.5],[0,.5]],center:[[.5,.5],[.5,.5],[.5,.5]],right:[[1,.5],[1,.5],[1,.5]],"top-left":[[0,1],[0,1],[0,1]],top:[[.5,1],[.5,1],[.5,1]],"top-right":[[1,1],[1,1],[1,1]],stretch:[[0,0],[1,1],[.5,.5]],"stretch-horizontal":[[0,.5],[1,.5],[.5,.5]],"stretch-vertical":[[.5,0],[.5,1],[.5,.5]]}[t];return n&&(i.anchorMin={x:n[0][0],y:n[0][1]},i.anchorMax={x:n[1][0],y:n[1][1]},i.pivot={x:n[2][0],y:n[2][1]}),i}function Wo(e){let t=Be(e),i=(r,n)=>Math.abs(r-n)<1e-4;if(i(t.anchorMin.x,0)&&i(t.anchorMin.y,0)&&i(t.anchorMax.x,1)&&i(t.anchorMax.y,1))return"stretch";if(i(t.anchorMin.x,t.anchorMax.x)&&i(t.anchorMin.y,t.anchorMax.y)){let r=t.anchorMin.x,n=t.anchorMin.y,o=[[0,0,"bottom-left"],[.5,0,"bottom"],[1,0,"bottom-right"],[0,.5,"left"],[.5,.5,"center"],[1,.5,"right"],[0,1,"top-left"],[.5,1,"top"],[1,1,"top-right"]];for(let a of o)if(i(r,a[0])&&i(n,a[1]))return a[2]}return"custom"}function gt(e){return Ho(e).platform}function Ko(e){let t={};for(let i of ue)t[i]=e(i);return t}var Nc={scale:["x","y","z"],rotation:["x","y","z"],anchorMin:["x","y"],anchorMax:["x","y"],offset:["x","y"],size:["x","y"],pivot:["x","y"]};function qo(e,t){for(let[i,r]of Object.entries(Nc))for(let n of r)if(!Number.isFinite(e?.[i]?.[n]))throw new Error(`${t}.${i}.${n} must be a finite number`)}function rt(e,t="transformByPlatform"){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}: \u9700\u8981\u5B8C\u6574\u7684\u56DB\u5E73\u53F0\u5E03\u5C40`);for(let i of Object.keys(e))if(!ue.includes(i))throw new Error(`${t}: unknown platform ${i}`);for(let i of ue)qo(e[i],`${t}.${i}`)}function yt(e){if(Object.hasOwn(e,"transformByCanvas"))throw new Error(`${e.name||e.id||"\u63A7\u4EF6"}: \u4E0D\u518D\u652F\u6301 transformByCanvas\uFF1B\u8BF7\u4F7F\u7528\u56DB\u5E73\u53F0 transformByPlatform \u5E03\u5C40`);rt(e.transformByPlatform,`${e.name||e.id||"\u63A7\u4EF6"}.transformByPlatform`)}function bt(e,t){if(!ue.includes(t))throw new Error(`unknown platform ${t}`);return qo(e?.[t],`transformByPlatform.${t}`),Be(e[t])}var Fc=Object.freeze([{key:"genericField501",label:"\u901A\u7528\u69FD field501",type:"number",defaultValue:0,wire:"GenericSlot.field501"},{key:"footerField505",label:"\u5C3E\u90E8\u69FD field505",type:"number",defaultValue:0,wire:"FooterSlot.field505"}]),Oc=Object.freeze({container:[],textbox:[{key:"textField501",label:"\u6587\u672C\u914D\u7F6E field501",type:"number",defaultValue:20,wire:"TextConfig.field501"},{key:"textField503",label:"\u6587\u672C\u914D\u7F6E field503",type:"number",defaultValue:12,wire:"TextConfig.field503"},{key:"textAlign",label:"\u6C34\u5E73\u5BF9\u9F50\u679A\u4E3E\u539F\u59CB\u503C",type:"enum",defaultValue:0,wire:"TextConfig.align",options:[{value:0,label:"0 \xB7 \u5DE6\u5BF9\u9F50"},{value:1,label:"1 \xB7 \u5C45\u4E2D"},{value:2,label:"2 \xB7 \u53F3\u5BF9\u9F50"}]}],textwindow:[{key:"textField501",label:"\u6587\u672C\u914D\u7F6E field501",type:"number",defaultValue:20,wire:"TextConfig.field501"},{key:"textField503",label:"\u6587\u672C\u914D\u7F6E field503",type:"number",defaultValue:12,wire:"TextConfig.field503"},{key:"textAlign",label:"\u6C34\u5E73\u5BF9\u9F50\u679A\u4E3E\u539F\u59CB\u503C",type:"enum",defaultValue:0,wire:"TextConfig.align",options:[{value:0,label:"0 \xB7 \u5DE6\u5BF9\u9F50"},{value:1,label:"1 \xB7 \u5C45\u4E2D"},{value:2,label:"2 \xB7 \u53F3\u5BF9\u9F50"}]},{key:"textField511",label:"\u6587\u672C\u89C6\u7A97 field511",type:"number",defaultValue:1,wire:"TextConfig.field511"},{key:"textViewField502",label:"\u89C6\u7A97\u6807\u8BB0 field502",type:"number",defaultValue:1,wire:"TextConfig.viewFlags.field502"},{key:"textViewField503",label:"\u89C6\u7A97\u6807\u8BB0 field503",type:"number",defaultValue:1,wire:"TextConfig.viewFlags.field503"}],cursor:[{key:"cursorField501",label:"\u5149\u6807\u68C0\u6D4B field501",type:"number",defaultValue:1,wire:"CursorConfig.field501"}],reference:[{key:"templateRefSlot",label:"\u6A21\u677F\u5F15\u7528\u69FD\u539F\u59CB\u503C",type:"string",defaultValue:"",wire:"Details.templateRefSlot"}],grid:[{key:"gridField501",label:"\u7F51\u683C\u6807\u8BB0 field501",type:"number",defaultValue:1,wire:"GridViewConfig.field501"},{key:"gridField507",label:"\u7F51\u683C\u6807\u8BB0 field507",type:"number",defaultValue:1,wire:"GridViewConfig.field507"},{key:"gridField508",label:"\u7F51\u683C\u6807\u8BB0 field508",type:"number",defaultValue:1,wire:"GridViewConfig.field508"},{key:"gridField509",label:"\u7F51\u683C\u6807\u8BB0 field509",type:"number",defaultValue:1,wire:"GridViewConfig.field509"},{key:"gridField511",label:"\u7F51\u683C\u6807\u8BB0 field511",type:"number",defaultValue:5,wire:"GridViewConfig.field511"},{key:"gridField512",label:"\u7F51\u683C\u6807\u8BB0 field512",type:"number",defaultValue:1,wire:"GridViewConfig.field512"}],keyhint:[{key:"keyHintField501",label:"\u6309\u952E\u63D0\u793A field501",type:"number",defaultValue:1,wire:"KeyHintConfig.field501"},{key:"keyHintField502",label:"\u952E\u9F20\u952E\u4F4D\u539F\u59CB\u503C",type:"number",defaultValue:1,wire:"KeyHintConfig.field502"}],image:[{key:"imageSlotType",label:"\u56FE\u7247\u7C7B\u578B\u539F\u59CB\u503C",type:"number",defaultValue:0,wire:"ImageSlotConfig.imageType"},{key:"imageField502",label:"\u56FE\u7247\u6807\u8BB0 field502",type:"number",defaultValue:1,wire:"ImageConfig.field502"},{key:"imageField504",label:"\u56FE\u7247\u6807\u8BB0 field504",type:"number",defaultValue:1,wire:"ImageConfig.field504"},{key:"imageField505",label:"\u56FE\u7247\u6807\u8BB0 field505",type:"number",defaultValue:1,wire:"ImageConfig.field505"},{key:"imageField507",label:"\u56FE\u7247\u6807\u8BB0 field507",type:"number",defaultValue:2,wire:"ImageConfig.field507"},{key:"imageFillType",label:"\u586B\u5145\u5F62\u72B6\u679A\u4E3E\u539F\u59CB\u503C",type:"enum",defaultValue:1,wire:"ImageConfig.fillType",options:[{value:1,label:"1 \xB7 \u6A2A\u5411"},{value:2,label:"2 \xB7 \u7EB5\u5411"},{value:3,label:"3 \xB7 90\u5EA6\u73AF\u7ED5"},{value:4,label:"4 \xB7 180\u5EA6\u73AF\u7ED5"},{value:5,label:"5 \xB7 360\u5EA6\u73AF\u7ED5"}]}],animation:[{key:"effectSlot",label:"\u754C\u9762\u52A8\u6548\u69FD\u539F\u59CB\u503C",type:"string",defaultValue:"",wire:"Details.effectSlot"}],fullscreen:[{key:"fullscreenEffectSlot",label:"\u5168\u5C4F\u52A8\u6548\u69FD\u539F\u59CB\u503C",type:"string",defaultValue:"",wire:"Details.fullscreenEffectSlot"}]});function Jo(e){return[...Fc,...Oc[e]||[]]}function Qo(e,t){return Jo(e).find(i=>i.key===t)||null}function en(e,t){if(!e)throw new Error("unknown raw GIA field");if(e.type==="string")return String(t??"");let i=Number(t);if(!Number.isFinite(i))throw new Error(`${e.wire} must be a finite number`);return Math.trunc(i)}function Zo(e,t={}){let i={};for(let r of Jo(e)){let n=Object.hasOwn(t||{},r.key)?t[r.key]:r.defaultValue;i[r.key]=en(r,n)}if(e==="reference")for(let r of["templateRefSlotBase64","templateRefOuterBase64"]){if(!Object.hasOwn(t||{},r))continue;let n=t[r];if(typeof n!="string"||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(n))throw new Error(`${r} must be base64`);n&&(i[r]=n)}return i}function Ne(e){let t=Number(e);return Number.isSafeInteger(t)&&t>0&&t<=2147483647}function tn(e,t){if(e){t(e);for(let i of e.children||[])tn(i,t)}}function Gt(e,t=new Set,{skipServerContainer:i=!1}={}){return tn(e,r=>{i&&r.kind==="server-container"||Ne(r.guid)&&t.add(Number(r.guid))}),t}function nt(e,t=1073741850){let i=Number.isSafeInteger(t)&&t>0?t:1073741850;i<1073741850&&(i=1073741850);for(let r of e)Ne(r)&&r>=i&&(i=Number(r)+1);for(;e.has(i);)i+=1;if(i>2147483647)throw new Error("GUID space exhausted");return i}function ea(e,t=new Set,{skipServerContainer:i=!1}={}){let r=[];tn(e,n=>{if(i&&n.kind==="server-container")return;let o=Number(n.guid);if(Ne(o)&&!t.has(o)){t.add(o),n.guid=o;return}r.push(n)});for(let n of r){let o=nt(t);n.guid=o,t.add(o)}return t}function _e(e){return Number.isSafeInteger(e)&&e>0&&e<=2147483647}function We(e,{warnings:t=[]}={}){if(e.meta?.assetType!=="client-control-template")return;if(e.meta.giaAssetIndexSchemaVersion>1)throw new Error(`\u4E0D\u652F\u6301\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u7248\u672C ${e.meta.giaAssetIndexSchemaVersion}`);let i=[],r=m=>{m.kind!=="server-container"&&i.push(m);for(let y of m.children||[])r(y)};r(e.root);let n=new Map,o=new Map;for(let m of i){if(!_e(m.giaInfoIndex))continue;let y=n.get(m.giaInfoIndex)||[];y.push(m),n.set(m.giaInfoIndex,y);let I=o.get(m.kind)||new Set;I.add(m.giaInfoIndex),o.set(m.kind,I)}let a=(e.root.children||[]).filter(m=>m.kind!=="server-container"),s=new Set(a),c=a.some((m,y)=>_e(m.giaInfoIndex)&&a.slice(0,y).some(I=>I.giaInfoIndex===m.giaInfoIndex)),l=!e.meta.giaAssetIndexSchemaVersion&&c&&i.every(m=>m.giaInfoIndexSource!=="authoring")&&[...o.values()].every(m=>m.size===1)&&[...n.values()].every(m=>m.every(y=>y.kind===m[0].kind)),u=new Set;if(l)for(let m of n.values()){let y=m.find(I=>s.has(I))||m[0];for(let I of m)I!==y&&u.add(I)}let f=new Map,h=Number.isSafeInteger(e.meta.giaNextAssetIndex)&&e.meta.giaNextAssetIndex>=2?e.meta.giaNextAssetIndex:2;for(let m of i){if(!_e(m.giaInfoIndex)||(h=Math.max(h,m.giaInfoIndex+1),u.has(m)))continue;let y=f.get(m.giaInfoIndex);if(y&&(y.giaInfoIndexSource==="authoring"||m.giaInfoIndexSource==="authoring"))throw new Error(`\u65B0\u5EFA\u8D44\u4EA7\u7F16\u53F7 ${m.giaInfoIndex} \u91CD\u590D\uFF1A${y.name} / ${m.name}`);f.set(m.giaInfoIndex,m)}l&&(h=Math.max(h,13));let p=l?[...a,...i.filter(m=>!s.has(m))].filter(m=>u.has(m)||!_e(m.giaInfoIndex)):i.filter(m=>!_e(m.giaInfoIndex));if(p.length&&h+p.length-1>2147483647)throw new Error("\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u7A7A\u95F4\u5DF2\u8017\u5C3D");for(let m of p)m.giaInfoIndex=h++,m.giaInfoIndexSource="authoring";e.meta.giaNextAssetIndex=h,e.meta.giaAssetIndexSchemaVersion=1,u.size&&t.push(`\u65E7\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u81EA\u52A8\u8FC1\u79FB\uFF1A\u4FEE\u590D ${u.size} \u6761\u6309\u63A7\u4EF6\u7C7B\u578B\u590D\u7528\u7684\u7F16\u53F7\uFF1BGUID\u3001Lua \u5F15\u7528\u548C\u63A7\u4EF6\u5C5E\u6027\u4FDD\u6301\u4E0D\u53D8\u3002`)}var rn=1;function nn(e="n"){let t=`${e}${rn}`;return rn+=1,t}function Zi(e=1){rn=e}function on(e,{isRootContainer:t=!1}={}){if(e==="server-container"||e==="fullscreen"||e==="container"&&t)return Qi({layout:"stretch"});let i=Vo[e]||[80,80];return Qi({layout:"center",size:i})}function zc(e,t){return Ko(()=>on(e,t))}function Dc(e){rt(e);let t={};for(let i of ue)t[i]=bt(e,i);return t}function q(e,t={}){if(!Ot[e])throw new Error(`unknown kind: ${e}`);Object.hasOwn(t,"transformByCanvas")&&yt(t);let i=t.isRootContainer===!0,r=t.id||nn(e==="server-container"?"sc":"n"),n=Object.hasOwn(t,"transformByPlatform")?Dc(t.transformByPlatform):zc(e,{isRootContainer:i}),o={id:r,kind:e,name:t.name||Ot[e],guid:t.guid??0,giaRelatedGuids:Array.isArray(t.giaRelatedGuids)?t.giaRelatedGuids.filter(a=>Number.isSafeInteger(Number(a))&&Number(a)>0).map(Number):[],..._e(Number(t.giaInfoIndex))?{giaInfoIndex:Number(t.giaInfoIndex),giaInfoIndexSource:t.giaInfoIndexSource==="authoring"?"authoring":"imported"}:{},active:t.active!==!1,visible:t.visible!==!1,canControllerFocus:t.canControllerFocus??t.giaRaw?.footerField505===1,syncAllDevices:t.syncAllDevices!==!1,giaRaw:Zo(e,t.giaRaw),transformByPlatform:n,children:[],scriptMappingIds:Array.isArray(t.scriptMappingIds)?t.scriptMappingIds.filter(a=>Number.isSafeInteger(Number(a))&&Number(a)>0).map(Number):[]};if(e==="container"&&(o.isolateNavigation=t.isolateNavigation===!0,o.disableKeyEventPassthrough=t.disableKeyEventPassthrough===!0,o.disableCursorEventPassthrough=t.disableCursorEventPassthrough===!0,o.showCursor=t.showCursor===!0),(e==="textbox"||e==="textwindow")&&(o.fontSize=t.fontSize??20,o.adaptiveFontSize=t.adaptiveFontSize===!0,o.minimumFontSize=t.minimumFontSize??20,o.fontColor=t.fontColor??di.font,o.bgColor=t.bgColor??di.bg,o.enableOutline=t.enableOutline!==!1,o.outlineColor=t.outlineColor??di.outline,o.horizontalAlignment=t.horizontalAlignment||"Left",o.verticalAlignment=t.verticalAlignment||"Top",Number.isInteger(t.giaRaw?.textVerticalAlign)&&![0,1,2].includes(t.giaRaw.textVerticalAlign)&&(o.giaRaw.textVerticalAlign=t.giaRaw.textVerticalAlign),o.text=t.text??"",Object.hasOwn(t.giaRaw||{},"textAlign")||(o.giaRaw.textAlign={Left:0,Middle:1,Right:2}[o.horizontalAlignment]??o.giaRaw.textAlign),e==="textwindow"&&(o.interactable=t.interactable!==!1,o.showScrollBar=t.showScrollBar!==!1)),e==="image"&&(o.imageSource=t.imageSource||"StaticReference",o.imageType=["Basic","Stretch"].includes(t.imageType)?t.imageType:null,o.imageId=t.imageId??100001,o.imageColor=t.imageColor??di.image,o.enableMask=t.enableMask===!0,o.enableSoftEdge=t.enableSoftEdge===!0,o.softEdgeMode=t.softEdgeMode||"Percentage",o.softEdgeWidthX=t.softEdgeWidthX??8,o.softEdgeWidthY=t.softEdgeWidthY??8,o.horizontalSoftRange=t.horizontalSoftRange??85,o.verticalSoftRange=t.verticalSoftRange??85,o.enableFill=t.enableFill===!0,o.fillType=t.fillType||"Horizontal",o.fillHorizontalType=t.fillHorizontalType||"Left",o.fillVerticalType=t.fillVerticalType||"Bottom",o.fillRadial90Type=t.fillRadial90Type||"BottomLeft",o.fillRadialType=t.fillRadialType||"Bottom",o.fillAmount=t.fillAmount??1,o.reverseMaskArea=t.reverseMaskArea===!0||t.reverseMask===!0,Object.hasOwn(t.giaRaw||{},"imageFillType")||(o.giaRaw.imageFillType={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[o.fillType]??o.giaRaw.imageFillType)),e==="button"&&(o.raycastTarget=t.raycastTarget!==!1,o.interactable=t.interactable!==!1,o.clickAudioId=t.clickAudioId??Bo,o.unavailableChildId=t.unavailableChildId??null,o.hoverChildId=t.hoverChildId??null,o.pressedChildId=t.pressedChildId??null,o.selectedChildId=t.selectedChildId??null),e==="cursor"&&(o.raycastTarget=t.raycastTarget??t.giaRaw?.cursorField501!==0),e==="reference"&&(o.referencedPrefabId=t.referencedPrefabId??t.giaRaw?.templateRefSlot??null,Object.hasOwn(t.giaRaw||{},"templateRefSlot")||(o.giaRaw.templateRefSlot=String(o.referencedPrefabId??""))),e==="grid"&&(o.itemPrefabId=t.itemPrefabId??null,o.raycastTarget=t.raycastTarget!==!1,o.interactable=t.interactable!==!1,o.showScrollBar=t.showScrollBar!==!1,o.scrollDirection=t.scrollDirection||"Vertical",o.layoutConstraint=t.layoutConstraint||"AutoWrap",o.layoutConstraintFixedCount=t.layoutConstraintFixedCount??null,o.cellSizeX=t.cellSizeX??50,o.cellSizeY=t.cellSizeY??50,o.spacingX=t.spacingX??8,o.spacingY=t.spacingY??8,o.padding1X=t.padding1X??20,o.padding1Y=t.padding1Y??20,o.padding2X=t.padding2X??20,o.padding2Y=t.padding2Y??20,o.previewCount=t.previewCount??t.giaRaw?.gridField511??5,Object.hasOwn(t.giaRaw||{},"gridField511")||(o.giaRaw.gridField511=Math.trunc(o.previewCount))),e==="keyhint"&&(o.keyboardKeyCode=t.keyboardKeyCode??t.giaRaw?.keyHintField502??null,o.controllerKeyCode=t.controllerKeyCode??t.giaRaw?.keyHintField501??null,Object.hasOwn(t.giaRaw||{},"keyHintField502")||(o.giaRaw.keyHintField502=Math.trunc(o.keyboardKeyCode??1)),Object.hasOwn(t.giaRaw||{},"keyHintField501")||(o.giaRaw.keyHintField501=Math.trunc(o.controllerKeyCode??1))),e==="animation"||e==="fullscreen"){let a=e==="animation"?t.giaRaw?.effectSlot:t.giaRaw?.fullscreenEffectSlot;o.animationId=t.animationId??a??null,o.playSoundEffect=t.playSoundEffect??null,e==="animation"&&(o.layer=t.layer??null);let s=e==="animation"?"effectSlot":"fullscreenEffectSlot";Object.hasOwn(t.giaRaw||{},s)||(o.giaRaw[s]=String(o.animationId??""))}if(t.children)for(let a of t.children)o.children.push(a);return o}function vt(){Zi(1);let e=q("server-container",{id:"sc1",name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668"}),t=q("container",{id:"n1",name:"\u5BB9\u5668\u8282\u70B9",isRootContainer:!0}),i=q("textbox",{id:"n2",name:"\u6587\u672C\u6846",text:"\u6587\u672C"}),r=q("cursor",{id:"n3",name:"\u5149\u6807\u68C0\u6D4B\u533A\u57DF"}),n=q("reference",{id:"n4",name:"\u6A21\u677F\u5F15\u7528\u63A7\u4EF6"}),o=q("grid",{id:"n5",name:"\u7F51\u683C\u89C6\u7A97"}),a=q("button",{id:"n6",name:"\u9884\u8BBE\u6309\u94AE"}),s=q("textwindow",{id:"n7",name:"\u6587\u672C\u89C6\u7A97"}),c=q("keyhint",{id:"n8",name:"\u6309\u952E\u63D0\u793A"}),l=q("image",{id:"n9",name:"\u56FE\u7247",imageId:100005}),u=q("animation",{id:"n10",name:"\u754C\u9762\u52A8\u6548"}),f=q("fullscreen",{id:"n11",name:"\u5168\u5C4F\u52A8\u6548"}),h=(p,m,y)=>{for(let I of Object.values(p.transformByPlatform))I.offset={x:m,y}};return h(i,-300,250),h(r,-300,140),h(n,-300,30),h(o,-300,-100),h(a,0,0),h(s,300,250),h(c,300,140),h(l,300,30),h(u,300,-100),t.children.push(i,r,n,o,a,s,c,l,u,f),e.children.push(t),Zi(12),ea(e),{version:1,layoutSchemaVersion:ve,meta:{name:"\u672A\u547D\u540D\u754C\u9762\u63A7\u4EF6\u7EC4",assetType:"server-control-template",sourceFormat:"authoring",sourceFile:""},canvasId:"pc-16-9",selectedId:"n2",root:e}}function Vt(){Zi(1);let e=q("server-container",{id:"sc1",name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"}),t=q("container",{id:"n1",guid:1073742100,name:"Lua\u5B9E\u4F8B\u5316\u9762\u677F"}),i=q("textbox",{id:"n2",guid:1073742101,name:"\u6A21\u677F\u6807\u9898",text:"\u5BA2\u6237\u7AEF\u6A21\u677F\u5DF2\u5B9E\u4F8B\u5316",fontSize:28,horizontalAlignment:"Middle"}),r=q("image",{id:"n3",guid:1073742102,name:"\u6A21\u677F\u56FE\u6807",imageId:100005}),n=q("button",{id:"n4",guid:1073742103,name:"\u786E\u8BA4\u6309\u94AE"}),o=q("textbox",{id:"n5",guid:1073742104,name:"\u6309\u94AE\u6587\u5B57",text:"\u786E\u8BA4",horizontalAlignment:"Middle",verticalAlignment:"Top"}),a=(l,u,f)=>{for(let h of Object.values(l.transformByPlatform))h.offset={x:u,y:f}};((l,u,f)=>{for(let h of Object.values(l.transformByPlatform))h.size={x:u,y:f}})(t,520,320),a(i,0,110),a(r,0,0),a(n,0,-110),n.children.push(o),t.children.push(i,r,n),e.children.push(t),Zi(6);let c={version:1,layoutSchemaVersion:ve,meta:{name:"Lua\u5B9E\u4F8B\u5316\u9762\u677F",assetType:"client-control-template",sourceFormat:"authoring",sourceFile:"",gameVersion:Wi,giaOwnerUid:114514,giaFileId:1073741829,giaFileName:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868.gia"},canvasId:"pc-16-9",selectedId:"n1",root:e};return We(c),c}function te(e,t,i=null){t(e,i);for(let r of e.children||[])te(r,t,e)}function he(e,t){let i=null;return te(e,r=>{r.id===t&&(i=r)}),i}function an(e,t="n"){let i=nn(t);for(;he(e,i);)i=nn(t);return i}function ot(e,t){let i=null;return te(e,(r,n)=>{r.id===t&&(i=n)}),i}function sn(e){let t=e.root||e;return t.kind==="container"?t:(t.children||[]).find(i=>i.kind==="container")||(t.children||[])[0]||t}function gi(e){if(e.meta?.assetType!=="client-control-template")return sn(e);let t=he(e.root,e.selectedId);if(!t||t.kind==="server-container")return e.root.children?.[0]||e.root;let i=ot(e.root,t.id);for(;i&&i.kind!=="server-container";)t=i,i=ot(e.root,t.id);return t}function ln(e){yt(e);let t={id:e.id,name:e.name,guid:e.guid,giaRelatedGuids:e.giaRelatedGuids,giaInfoIndex:e.giaInfoIndex,giaInfoIndexSource:e.giaInfoIndexSource,scriptMappingIds:e.scriptMappingIds,giaRaw:e.giaRaw,active:e.active,visible:e.visible,canControllerFocus:e.canControllerFocus,syncAllDevices:e.syncAllDevices,transformByPlatform:e.transformByPlatform};e.kind==="container"&&(t.isolateNavigation=e.isolateNavigation,t.disableKeyEventPassthrough=e.disableKeyEventPassthrough,t.disableCursorEventPassthrough=e.disableCursorEventPassthrough,t.showCursor=e.showCursor),(e.kind==="textbox"||e.kind==="textwindow")&&(t.fontSize=e.fontSize,t.adaptiveFontSize=e.adaptiveFontSize,t.minimumFontSize=e.minimumFontSize,t.fontColor=e.fontColor,t.bgColor=e.bgColor,t.enableOutline=e.enableOutline,t.outlineColor=e.outlineColor,t.horizontalAlignment=e.horizontalAlignment,t.verticalAlignment=e.verticalAlignment,t.text=e.text??"",e.kind==="textwindow"&&(t.interactable=e.interactable,t.showScrollBar=e.showScrollBar)),e.kind==="image"&&(t.imageSource=e.imageSource,t.imageType=e.imageType,t.imageId=e.imageId,t.imageColor=e.imageColor,t.enableMask=e.enableMask,t.enableSoftEdge=e.enableSoftEdge,t.softEdgeMode=e.softEdgeMode,t.softEdgeWidthX=e.softEdgeWidthX,t.softEdgeWidthY=e.softEdgeWidthY,t.horizontalSoftRange=e.horizontalSoftRange,t.verticalSoftRange=e.verticalSoftRange,t.enableFill=e.enableFill,t.fillType=e.fillType,t.fillHorizontalType=e.fillHorizontalType,t.fillVerticalType=e.fillVerticalType,t.fillRadial90Type=e.fillRadial90Type,t.fillRadialType=e.fillRadialType,t.fillAmount=e.fillAmount,t.reverseMaskArea=e.reverseMaskArea??e.reverseMask),e.kind==="button"&&(t.raycastTarget=e.raycastTarget,t.interactable=e.interactable,t.clickAudioId=e.clickAudioId,t.unavailableChildId=e.unavailableChildId??null,t.hoverChildId=e.hoverChildId??null,t.pressedChildId=e.pressedChildId??null,t.selectedChildId=e.selectedChildId??null),e.kind==="cursor"&&(t.raycastTarget=e.raycastTarget),e.kind==="reference"&&(t.referencedPrefabId=e.referencedPrefabId??null),e.kind==="grid"&&(t.itemPrefabId=e.itemPrefabId??null,t.raycastTarget=e.raycastTarget,t.interactable=e.interactable,t.showScrollBar=e.showScrollBar,t.scrollDirection=e.scrollDirection,t.layoutConstraint=e.layoutConstraint,t.layoutConstraintFixedCount=e.layoutConstraintFixedCount??null,t.cellSizeX=e.cellSizeX,t.cellSizeY=e.cellSizeY,t.spacingX=e.spacingX,t.spacingY=e.spacingY,t.padding1X=e.padding1X,t.padding1Y=e.padding1Y,t.padding2X=e.padding2X,t.padding2Y=e.padding2Y,t.previewCount=e.previewCount),e.kind==="keyhint"&&(t.keyboardKeyCode=e.keyboardKeyCode??null,t.controllerKeyCode=e.controllerKeyCode??null),(e.kind==="animation"||e.kind==="fullscreen")&&(t.animationId=e.animationId??null,t.playSoundEffect=e.playSoundEffect??null,e.kind==="animation"&&(t.layer=e.layer??null)),t.isRootContainer=e.kind==="container"&&$c(e.transformByPlatform);let i=q(e.kind,t);return i.children=(e.children||[]).map(r=>ln(r)),i}function $c(e){let t=e&&(e.KEYBOARD||Object.values(e)[0]);return t?Math.abs(t.anchorMin?.x??.5)<1e-4&&Math.abs(t.anchorMin?.y??.5)<1e-4&&Math.abs((t.anchorMax?.x??.5)-1)<1e-4&&Math.abs((t.anchorMax?.y??.5)-1)<1e-4:!1}function ta(e,t,i={}){if(e.kind==="server-container"&&t!=="container")throw new Error("server container only accepts container nodes");let r=q(t,i);return e.children.push(r),r}function ia(e,t){if(e.id===t)throw new Error("cannot remove root");let i=ot(e,t);if(!i)return!1;let r=i.children.findIndex(n=>n.id===t);return r<0?!1:(i.children.splice(r,1),!0)}var ra=1e-4;function Gc(e,t){return Math.abs(e.anchorMax[t]-e.anchorMin[t])>ra&&Math.abs(e.size[t])<=ra}function Vc(e,t,i){if(!(t.width>0)||!(t.height>0))throw new Error("source parent must have positive size");if(!(i.width>0)||!(i.height>0))throw new Error("target parent must have positive size");let r=Ue(t,e),n=(r.centerX-t.left)/t.width,o=(r.centerY-t.bottom)/t.height,a=mt(i,e,{posX:i.left+n*i.width,posY:i.bottom+o*i.height,width:r.width,height:r.height});for(let s of["x","y"])Gc(e,s)&&(a.offset[s]=e.offset[s],a.size[s]=e.size[s]);return a}function na({transformByPlatform:e,source:t,canvasId:i,syncAllDevices:r,sourceParentBox:n=we(i),targetParentBoxByPlatform:o={}}){rt(e);let a=gt(i),s={};for(let c of ue)c===a?s[c]=Be(t):r!==!1?s[c]=Vc(t,n,o[c]||we(Ft[c])):s[c]=bt(e,c);return rt(s),s}function at(e,t){return bt(e,gt(t))}import{createCanvas as nu}from"@napi-rs/canvas";import{existsSync as Kc,openSync as qc,closeSync as Jc,fstatSync as Qc,readFileSync as Zc}from"node:fs";import{extname as eu,isAbsolute as tu}from"node:path";import{createHash as iu}from"node:crypto";import{workerData as ir}from"node:worker_threads";import{GlobalFonts as ca}from"@napi-rs/canvas";var oa='"Microsoft YaHei UI","Microsoft YaHei","HarmonyOS Sans SC","Noto Sans CJK SC",sans-serif',Bt="/qxqy-font";var cn=e=>`QxqyLocal_${e}`,aa=e=>e?`"${cn(e)}",${oa}`:oa;import{existsSync as Bc,mkdirSync as Yc,readFileSync as Lc,renameSync as jc,rmSync as Hc,writeFileSync as Uc}from"node:fs";import{randomUUID as Xc}from"node:crypto";import{homedir as un}from"node:os";import{dirname as Wc,join as er,win32 as tr}from"node:path";function fn(e=process.platform,t=process.env){if(e!=="win32")return[];let i=t.SystemDrive||"C:",r=t.ProgramFiles||`${i}\\Program Files`,n="YuanShen_Data\\StreamingAssets\\MiHoYoSDKRes\\HttpServerResources\\font\\zh-cn.ttf";return[...new Set([tr.join(r,"Genshin Impact","Genshin Impact Game",n),tr.join(i+"\\","Mihoyo","Genshin Impact","Genshin Impact Game",n),tr.join(r,"HoYoPlay","games","Genshin Impact game",n),tr.join(r,"miHoYo Launcher","games","Genshin Impact Game",n)])]}function sa(){if(process.env.QXQY_FONT_CONFIG_PATH)return process.env.QXQY_FONT_CONFIG_PATH;let e=process.platform==="win32"?process.env.APPDATA||er(un(),"AppData","Roaming"):process.platform==="darwin"?er(un(),"Library","Application Support"):process.env.XDG_CONFIG_HOME||er(un(),".config");return er(e,"beyond-simulator","font.json")}function dn(e){if(!e||!["auto","custom","system"].includes(e.mode))throw new Error("\u8BF7\u9009\u62E9\u81EA\u52A8\u67E5\u627E\u3001\u6307\u5B9A\u6587\u4EF6\u6216\u7CFB\u7EDF\u5B57\u4F53");let t=e.scope===void 0?"all":e.scope;if(!["game","all"].includes(t))throw new Error("\u8BF7\u9009\u62E9\u5B57\u4F53\u5E94\u7528\u8303\u56F4");let i=typeof e.path=="string"?e.path.trim():"";if(i.length>4096)throw new Error("\u5B57\u4F53\u8DEF\u5F84\u8FC7\u957F");if((i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),e.mode==="custom"&&!i)throw new Error("\u8BF7\u586B\u5199\u5B57\u4F53\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84");return{mode:e.mode,path:e.mode==="custom"?i:"",scope:t}}function hn(e=sa()){if(!Bc(e))return{mode:"auto",path:"",scope:"all"};try{return dn(JSON.parse(Lc(e,"utf8")))}catch{throw new Error("\u672C\u673A\u5B57\u4F53\u8BBE\u7F6E\u65E0\u6CD5\u8BFB\u53D6\uFF0C\u8BF7\u5728\u300C\u5B57\u4F53\u8BBE\u7F6E\u300D\u4E2D\u91CD\u65B0\u4FDD\u5B58")}}function la(e,t=sa()){let i=`${t}.${Xc()}.tmp`;try{Yc(Wc(t),{recursive:!0}),Uc(i,JSON.stringify(e,null,2)+`
|
|
3
|
-
`,{flag:"wx",mode:384}),
|
|
4
|
-
`),n=
|
|
5
|
-
`)){let $="";for(let Y of F)$&&yn.measureText($+Y).width>m&&(y.push($),$=""),$+=Y;y.push($)}let I=p*1.2,b=y.length*I,v=e.kind==="textbox"&&r?p*.25+4:0,P=r?b+v:0,R=P<=i+1e-6&&y.every(F=>yn.measureText(F).width<=m+1e-6);return{fontSize:p,lines:y,lineHeight:I,contentHeight:b,blockInset:v,requiredHeight:P,textWidth:m,fits:R}},f=Math.max(0,t-4),h=u(n,f);if(a&&!h.fits&&o<n){h=u(o,f);let p=o+1,m=n-1;for(;p<=m;){let y=Math.floor((p+m)/2),I=u(y,f);I.fits?(h=I,p=y+1):m=y-1}}return e.kind==="textwindow"&&e.showScrollBar!==!1&&h.contentHeight>i&&(h=u(h.fontSize,Math.max(0,f-12))),ba.set(e,{key:c,value:h}),h}function wa(e,t){let i=[];function r(n){t[n.id]&&i.push(t[n.id]);let o=n.children||[];for(let a=o.length-1;a>=0;a-=1)r(o[a])}return r(e),i}function st(e,t,i=gt(t)){let r=we(t),n={};function o(a,s,c){let l=bt(a.transformByPlatform,i),u=Ue(s,l),f=a.kind==="server-container"?c:mi(c,u,l),h=Uo(u,f);n[a.id]={...u,...Zr(u),id:a.id,kind:a.kind,name:a.name,visible:a.visible!==!1,active:a.active!==!1,rotationX:l.rotation.x,rotationY:l.rotation.y,rotationZ:l.rotation.z,renderLeft:h.left,renderBottom:h.bottom,renderWidth:h.width,renderHeight:h.height,renderRotationZ:h.rotationZ,renderMatrix:f,primitive:a.kind==="image"?zt(a.imageId,a.imageSource):null,...a.kind==="textbox"||a.kind==="textwindow"?{text:a.text??"",fontSize:a.fontSize,adaptiveFontSize:a.adaptiveFontSize===!0,minimumFontSize:a.minimumFontSize,textLayout:qe(a,u.width,u.height),fontColor:a.fontColor,bgColor:a.bgColor,enableOutline:a.enableOutline!==!1,outlineColor:a.outlineColor,horizontalAlignment:a.horizontalAlignment,verticalAlignment:a.verticalAlignment}:{},...a.kind==="image"?{imageSource:a.imageSource,imageType:a.imageType??null,imageId:a.imageId,imageColor:a.imageColor,enableMask:a.enableMask===!0,enableSoftEdge:a.enableSoftEdge===!0,softEdgeMode:a.softEdgeMode,softEdgeWidthX:a.softEdgeWidthX,softEdgeWidthY:a.softEdgeWidthY,horizontalSoftRange:a.horizontalSoftRange,verticalSoftRange:a.verticalSoftRange,enableFill:a.enableFill===!0,fillType:a.fillType,fillHorizontalType:a.fillHorizontalType,fillVerticalType:a.fillVerticalType,fillRadial90Type:a.fillRadial90Type,fillRadialType:a.fillRadialType,fillAmount:a.fillAmount,reverseMaskArea:a.reverseMaskArea===!0}:{},...a.kind==="button"?{raycastTarget:a.raycastTarget!==!1,interactable:a.interactable!==!1,clickAudioId:a.clickAudioId,unavailableChildId:a.unavailableChildId??null,hoverChildId:a.hoverChildId??null,pressedChildId:a.pressedChildId??null,selectedChildId:a.selectedChildId??null}:{}};let p=a.kind==="server-container"?s:u;for(let m of a.children||[])o(m,p,f)}return o(e,r,$t()),{canvas:r,boxes:n}}function bn(e,t){let i=[];function r(n,o,a=null,s=[],c=0,l=1,u=e.id){i.push({id:n.id,guid:t?.get(n.id)??(n.guid||0),kind:n.kind,name:n.name,label:Ot[n.kind]||n.kind,depth:o,parentId:a,ancestorIds:s,siblingIndex:c,siblingCount:l,templateId:u,childCount:(n.children||[]).length,incomplete:!qi.includes(n.kind)});let f=n.children||[];for(let h=0;h<f.length;h+=1)r(f[h],o+1,n.id,[...s,n.id],h,f.length,u)}return r(e,0),i}function T(e,t,i,r,n={}){return{key:e,label:t,type:i,value:r,...n}}function Sa(e,t,i,r){if(!e)return null;let n=at(e.transformByPlatform,t),o=Zr(i),a=[T("name","\u540D\u79F0","string",e.name),T("active","\u521D\u59CB\u6FC0\u6D3B","bool",e.active!==!1),T("visible","\u521D\u59CB\u53EF\u89C1\u6027","bool",e.visible!==!1),T("canControllerFocus","\u53EF\u88AB\u624B\u67C4\u6447\u6746\u5BFC\u822A\u9009\u4E2D","bool",e.canControllerFocus===!0),T("posX","\u4F4D\u7F6E X","number",o.posX,{computed:!0}),T("posY","\u4F4D\u7F6E Y","number",o.posY,{computed:!0}),T("width","\u5927\u5C0F W","number",o.width,{computed:!0}),T("height","\u5927\u5C0F H","number",o.height,{computed:!0}),T("rotationX","\u65CB\u8F6C X","number",n.rotation.x),T("rotationY","\u65CB\u8F6C Y","number",n.rotation.y),T("rotationZ","\u65CB\u8F6C Z","number",n.rotation.z),T("syncAllDevices","\u540C\u6B65\u4FE1\u606F\u81F3\u6240\u6709\u8BBE\u5907","bool",e.syncAllDevices!==!1),T("anchorType","\u951A\u70B9\u7C7B\u578B","enum",Wo(n),{options:[{value:"center",label:"\u5C45\u4E2D"},{value:"top-left",label:"\u5DE6\u4E0A"},{value:"top",label:"\u4E0A\u65B9"},{value:"top-right",label:"\u53F3\u4E0A"},{value:"left",label:"\u5DE6\u4FA7"},{value:"right",label:"\u53F3\u4FA7"},{value:"bottom-left",label:"\u5DE6\u4E0B"},{value:"bottom",label:"\u4E0B\u65B9"},{value:"bottom-right",label:"\u53F3\u4E0B"},{value:"stretch",label:"\u53CC\u5411\u62C9\u4F38"},{value:"stretch-horizontal",label:"\u6C34\u5E73\u62C9\u4F38"},{value:"stretch-vertical",label:"\u5782\u76F4\u62C9\u4F38"},{value:"custom",label:"\u81EA\u5B9A\u4E49"}]}),T("anchorMinX","\u951A\u70B9 Min X","number",n.anchorMin.x),T("anchorMinY","\u951A\u70B9 Min Y","number",n.anchorMin.y),T("anchorMaxX","\u951A\u70B9 Max X","number",n.anchorMax.x),T("anchorMaxY","\u951A\u70B9 Max Y","number",n.anchorMax.y),T("pivotX","\u4E2D\u5FC3 X","number",n.pivot.x),T("pivotY","\u4E2D\u5FC3 Y","number",n.pivot.y)];if(e.kind==="container"&&a.push(T("isolateNavigation","\u9694\u79BB\u624B\u67C4\u5BFC\u822A","bool",e.isolateNavigation===!0),T("disableKeyEventPassthrough","\u5C4F\u853D\u6309\u952E\u4E8B\u4EF6\u7A7F\u900F","bool",e.disableKeyEventPassthrough===!0),T("disableCursorEventPassthrough","\u5C4F\u853D\u533A\u57DF\u5185\u70B9\u51FB\u4E8B\u4EF6\u7A7F\u900F","bool",e.disableCursorEventPassthrough===!0),T("showCursor","\u663E\u793A\u5E38\u9A7B\u5149\u6807","bool",e.showCursor===!0)),e.kind==="textbox"||e.kind==="textwindow"){let s=e.giaRaw?.textAlign,c=[0,1,2].includes(s)?e.horizontalAlignment||"Left":`__unrecognized:${s}`;a.push(T("fontSize","\u5B57\u53F7","number",e.fontSize),T("adaptiveFontSize","\u5B57\u53F7\u81EA\u9002\u5E94","bool",e.adaptiveFontSize===!0),T("minimumFontSize","\u6700\u5C0F\u5B57\u53F7","number",e.minimumFontSize),T("fontColor","\u6587\u672C\u8272","color",e.fontColor),T("bgColor","\u80CC\u666F\u8272","color",e.bgColor),T("enableOutline","\u542F\u7528\u63CF\u8FB9","bool",e.enableOutline!==!1),T("outlineColor","\u63CF\u8FB9\u8272","color",e.outlineColor),T("horizontalAlignment","\u6C34\u5E73\u5BF9\u9F50","enum",c,{...[0,1,2].includes(s)?{}:{unknownValue:s},options:[{value:"Left",label:"\u5DE6\u5BF9\u9F50"},{value:"Middle",label:"\u5C45\u4E2D"},{value:"Right",label:"\u53F3\u5BF9\u9F50"}]}),T("verticalAlignment","\u5782\u76F4\u5BF9\u9F50","enum",e.verticalAlignment||"Top",{options:[{value:"Top",label:"\u9876\u90E8"},{value:"Middle",label:"\u5C45\u4E2D"},{value:"Bottom",label:"\u5E95\u90E8"}]}),T("text","\u6587\u672C","text",e.text??""))}if(e.kind==="image"){let s=e.giaRaw?.imageFillType,c=[1,2,3,4,5].includes(s)?e.fillType:`__unrecognized:${s}`;a.push(T("imageSource","\u56FE\u7247\u6E90","enum",e.imageSource,{options:[{value:"StaticReference",label:"\u9759\u6001\u5F15\u7528"},{value:"Prefab",label:"\u5143\u4EF6"}]}),T("imageId","imageId","number",e.imageId??0),T("imageType","\u56FE\u7247\u7C7B\u578B","enum",e.imageType??null,{options:[{value:"Basic",label:"\u57FA\u7840"},{value:"Stretch",label:"\u62C9\u4F38"}]}),T("imageColor","\u586B\u5145\u8272","color",e.imageColor),T("enableMask","\u5F00\u542F\u906E\u7F69","bool",e.enableMask===!0),T("enableSoftEdge","\u8FB9\u7F18\u7FBD\u5316","bool",e.enableSoftEdge===!0,{gia:"W"}),T("softEdgeMode","\u7FBD\u5316\u6A21\u5F0F","enum",e.softEdgeMode,{options:[{value:"Percentage",label:"\u767E\u5206\u6BD4"},{value:"Pixel",label:"\u50CF\u7D20"}]}),T("softEdgeWidthX","\u7FBD\u5316\u5BBD\u5EA6 X","number",e.softEdgeWidthX),T("softEdgeWidthY","\u7FBD\u5316\u5BBD\u5EA6 Y","number",e.softEdgeWidthY),T("horizontalSoftRange","\u6C34\u5E73\u7FBD\u5316\u8303\u56F4","number",e.horizontalSoftRange),T("verticalSoftRange","\u5782\u76F4\u7FBD\u5316\u8303\u56F4","number",e.verticalSoftRange),T("enableFill","\u6309\u8FDB\u5EA6\u586B\u5145","bool",e.enableFill===!0,{gia:"W"}),T("fillType","\u5F62\u72B6","enum",c,{...[1,2,3,4,5].includes(s)?{}:{unknownValue:s},options:[{value:"Horizontal",label:"\u6A2A\u5411"},{value:"Vertical",label:"\u7EB5\u5411"},{value:"Radial90",label:"90\u5EA6\u73AF\u7ED5"},{value:"Radial180",label:"180\u5EA6\u73AF\u7ED5"},{value:"Radial360",label:"360\u5EA6\u73AF\u7ED5"}]}),T("fillHorizontalType","\u65B9\u5411","enum",e.fillHorizontalType,{options:[{value:"Left",label:"\u4ECE\u5DE6\u81F3\u53F3"},{value:"Right",label:"\u4ECE\u53F3\u81F3\u5DE6"}]}),T("fillVerticalType","\u65B9\u5411","enum",e.fillVerticalType,{options:[{value:"Bottom",label:"\u4ECE\u4E0B\u81F3\u4E0A"},{value:"Top",label:"\u4ECE\u4E0A\u81F3\u4E0B"}]}),T("fillRadial90Type","\u8D77\u70B9","enum",e.fillRadial90Type,{options:[{value:"BottomLeft",label:"\u5DE6\u4E0B"},{value:"TopLeft",label:"\u5DE6\u4E0A"},{value:"TopRight",label:"\u53F3\u4E0A"},{value:"BottomRight",label:"\u53F3\u4E0B"}]}),T("fillRadialType","\u8D77\u70B9","enum",e.fillRadialType,{options:[{value:"Bottom",label:"\u4E0B\u65B9"},{value:"Left",label:"\u5DE6\u4FA7"},{value:"Top",label:"\u4E0A\u65B9"},{value:"Right",label:"\u53F3\u4FA7"}]}),T("fillAmount","\u8FDB\u5EA6","percent",e.fillAmount),T("reverseMaskArea","\u906E\u7F69\u533A\u57DF\u53CD\u8F6C","bool",e.reverseMaskArea===!0,{gia:"W"}))}if(e.kind==="button"){let s=[{value:"",label:"\u672A\u8BBE\u7F6E"},...(e.children||[]).map(c=>({value:c.id,label:`${c.name} \xB7 ${c.id}`}))];a.push(T("raycastTarget","\u53EF\u88AB\u5149\u6807\u5C04\u7EBF\u68C0\u6D4B","bool",e.raycastTarget!==!1),T("interactable","\u6309\u94AE\u662F\u5426\u53EF\u7528","bool",e.interactable!==!1),T("unavailableChildId","\u4E0D\u53EF\u7528\u72B6\u6001\u8282\u70B9","node",e.unavailableChildId,{options:s,gia:"W"}),T("hoverChildId","\u60AC\u505C\u72B6\u6001\u8282\u70B9","node",e.hoverChildId,{options:s,gia:"W"}),T("pressedChildId","\u6309\u4E0B\u72B6\u6001\u8282\u70B9","node",e.pressedChildId,{options:s,gia:"W"}),T("selectedChildId","\u9009\u4E2D\u72B6\u6001\u8282\u70B9","node",e.selectedChildId,{options:s,gia:"W"}),T("clickAudioId","\u70B9\u51FB\u97F3\u6548","number",e.clickAudioId))}return e.kind==="reference"&&a.push(T("referencedPrefabId","\u5F15\u7528\u63A7\u4EF6\u6A21\u677F\u7D22\u5F15","string",e.referencedPrefabId??"")),(e.kind==="textwindow"||e.kind==="grid")&&a.push(T("interactable","\u5141\u8BB8\u6EDA\u52A8\u4EA4\u4E92","bool",e.interactable!==!1),T("showScrollBar","\u663E\u793A\u6EDA\u52A8\u6761","bool",e.showScrollBar!==!1)),e.kind==="grid"&&a.push(T("itemPrefabId","\u5217\u8868\u9879\u6A21\u677F\u7D22\u5F15","number",e.itemPrefabId??0),T("raycastTarget","\u53EF\u88AB\u5149\u6807\u5C04\u7EBF\u68C0\u6D4B","bool",e.raycastTarget!==!1),T("scrollDirection","\u6EDA\u52A8\u65B9\u5411","enum",e.scrollDirection,{options:[{value:"Vertical",label:"\u7EB5\u5411"},{value:"Horizontal",label:"\u6A2A\u5411"}]}),T("layoutConstraint","\u6392\u5217\u9650\u5236","enum",e.layoutConstraint,{options:[{value:"AutoWrap",label:"\u81EA\u52A8\u6362\u884C"},{value:"Fixed",label:"\u56FA\u5B9A\u884C\u5217\u6570"}]}),T("layoutConstraintFixedCount","\u6BCF\u884C\u6216\u6BCF\u5217\u6570\u91CF","number",e.layoutConstraintFixedCount??1),T("cellSizeX","\u5217\u8868\u9879\u5927\u5C0F W","number",e.cellSizeX,{evidence:"W"}),T("cellSizeY","\u5217\u8868\u9879\u5927\u5C0F H","number",e.cellSizeY,{evidence:"W"}),T("spacingX","\u5217\u8868\u9879\u95F4\u9694 X","number",e.spacingX,{evidence:"W"}),T("spacingY","\u5217\u8868\u9879\u95F4\u9694 Y","number",e.spacingY,{evidence:"W"}),T("padding1X","\u8FB9\u8DDD\u5411\u91CF 1 X","number",e.padding1X,{evidence:"W"}),T("padding1Y","\u8FB9\u8DDD\u5411\u91CF 1 Y","number",e.padding1Y,{evidence:"W"}),T("padding2X","\u8FB9\u8DDD\u5411\u91CF 2 X","number",e.padding2X,{evidence:"W"}),T("padding2Y","\u8FB9\u8DDD\u5411\u91CF 2 Y","number",e.padding2Y,{evidence:"W"}),T("previewCount","\u9884\u89C8\u6570\u91CF","number",e.previewCount)),e.kind==="keyhint"&&a.push(T("keyboardKeyCode","\u952E\u9F20\u6309\u952E","number",e.keyboardKeyCode??e.giaRaw?.keyHintField502??1,{gia:"W"}),T("controllerKeyCode","\u624B\u67C4\u6309\u952E","number",e.controllerKeyCode??e.giaRaw?.keyHintField501??1)),(e.kind==="animation"||e.kind==="fullscreen")&&a.push(T("animationId",e.kind==="animation"?"\u52A8\u6548\u7D22\u5F15":"\u5168\u5C4F\u52A8\u6548\u7D22\u5F15","string",e.animationId??"")),(!qi.includes(e.kind)||e.kind==="textwindow"||e.kind==="grid")&&a.push(T("incomplete","\u5B8C\u6574\u5EA6","note",e.kind==="textwindow"||e.kind==="grid"?"\u8BD5\u73A9\u652F\u6301\u57FA\u7840\u6EDA\u52A8\uFF1B\u6EDA\u52A8\u4EA4\u4E92\u3001\u6EDA\u52A8\u6761\u53CA\u5217\u8868\u914D\u7F6E\u4EE5 JSON/Lua \u4E3A\u51C6\uFF0C\u76F8\u5173 GIA \u5F00\u5173\u6620\u5C04\u5C1A\u672A\u6838\u5B9E\u3002":"\u672C\u9636\u6BB5\u4EC5\u516C\u5171\u53D8\u6362\uFF0C\u4E1A\u52A1\u69FD\u4E0D\u5B8C\u6574")),{id:e.id,guid:r?.get(e.id)??(e.guid||0),kind:e.kind,label:Ot[e.kind]||e.kind,incomplete:!qi.includes(e.kind),fields:a}}function xa(e,t,i){let r=(Array.isArray(e)?e:Object.values(e)).filter(n=>n.kind!=="server-container");for(let n=r.length-1;n>=0;n-=1){let o=r[n];if(!o.visible||!o.active)continue;let a=o.renderMatrix&&Xe(o.renderMatrix),s=a&&Ie(a,t,i);if(s&&s.x>=o.left&&s.x<=o.right&&s.y>=o.bottom&&s.y<=o.top)return o.id}return null}import ou from"protobufjs";function Lt(e,t=!1){let i=[],r=(n,o)=>{n.kind!=="server-container"&&i.push({node:n,parent:o});let a=t&&n.kind!=="server-container"?[...n.children||[]].reverse():n.children||[];for(let s of a)r(s,n)};return r(e.root,null),i}var au=String.raw`
|
|
2
|
+
import{spawn as I1}from"node:child_process";import{createServer as C1}from"node:http";import{readFileSync as k1,realpathSync as Al}from"node:fs";import{extname as A1,resolve as Pl}from"node:path";import{fileURLToPath as Tl}from"node:url";import{createHash as _1,timingSafeEqual as P1}from"node:crypto";import{statSync as t1}from"node:fs";var mi={name:"beyond-simulator-web",version:"0.5.2",description:"Self-hosted editor, preview and play surface for Qianxing simulator saves",type:"module",main:"dist/server.js",bin:{"beyond-simulator-web":"dist/server.js"},files:["dist","README.md"],scripts:{build:"node ../scripts/build.mjs web",pretest:"node ../scripts/build.mjs web",prepack:"node ../scripts/build.mjs web",start:"node dist/server.js",dev:"node ../scripts/build.mjs web && node server.js",test:"node --test test/*.test.mjs"},engines:{node:">=20"},dependencies:{"@napi-rs/canvas":"0.1.100",fengari:"0.1.5",protobufjs:"8.7.2"},devDependencies:{react:"19.1.1","react-dom":"19.1.1","qxqy-editor-ui":"workspace:*","qxqy-studio":"workspace:*"},license:"GPL-3.0-only",repository:{type:"git",url:"git+https://github.com/1475505/miliastra-beyond-simulator.git",directory:"web"}};var ro="https://oss.070077.xyz/prefabs/",pi="prefab-v1",ed=[[10003004,10003004],[10005001,10005142],[10006001,10006002],[10007002,10007002],[10008001,10008001],[10009001,10009011],[20001001,20001074],[20001076,20001121],[20001123,20001156],[20001158,20001302],[20001304,20001568],[20001570,20001999],[20002001,20002755],[20002757,20002999],[20003001,20003455],[30001001,30001016],[30002001,30002017],[30003001,30003011],[30004001,30004001],[30005001,30005020],[30006001,30006026],[30007001,30007013],[30008001,30008011]];function Qi(e){return!Number.isSafeInteger(e)||!ed.some(([t,i])=>e>=t&&e<=i)?null:e===10003004||e===10008001?128:256}var Zi="https://oss.070077.xyz/images/",ca="sprite-v1",en="/qxqy-assets/",td=[[100001,100006],[100101,100213],[101001,101018],[101020,101028],[101030,101046],[101048,101048],[101050,101054],[101056,101080],[102001,102052],[103001,103148],[104001,104010],[105001,105140],[105142,105219],[105221,105317],[106001,106047],[106049,106096],[107001,107007],[107010,107020],[107031,107092],[107094,107180],[107183,107201],[107203,107205],[107207,107228],[107231,107278],[107280,107402],[108001,108017],[108019,108020],[109001,109031],[109033,109034],[109036,109075],[110001,110053],[111001,111139],[112001,112042]];function Ae(e){return e==null||e===""?"StaticReference":typeof e=="string"?e:typeof e.Name=="string"?e.Name:"Unknown"}function tn(e,t){return`${Ae(t)}:${e}`}function oo(e,t){return Ae(t)==="StaticReference"&&at(e,t)}function at(e,t){let i=Ae(t);return i==="Prefab"?Qi(e)!==null:i==="StaticReference"&&Number.isSafeInteger(e)&&e>100006&&td.some(([n,a])=>e>=n&&e<=a)}var nn="7.1.0",fe=Object.freeze(["KEYBOARD","TOUCHSCREEN","CONTROLLER_CONSOLE","CONTROLLER_MOBILE"]),J=Object.freeze({"pc-16-9":{id:"pc-16-9",device:"pc",platform:"KEYBOARD",width:1600,height:900,ratio:"16:9",luaDevice:"KeyboardAndMouse",label:"PC 1600\xD7900"},"pc-21-9":{id:"pc-21-9",device:"pc",platform:"KEYBOARD",width:2100,height:900,ratio:"21:9",luaDevice:"KeyboardAndMouse",label:"PC 2100\xD7900"},"mobile-16-9":{id:"mobile-16-9",device:"mobile",platform:"TOUCHSCREEN",width:1280,height:720,ratio:"16:9",luaDevice:"Mobile",label:"\u624B\u673A 1280\xD7720"},"mobile-19.5-9":{id:"mobile-19.5-9",device:"mobile",platform:"TOUCHSCREEN",width:1560,height:720,ratio:"19.5:9",luaDevice:"Mobile",label:"\u624B\u673A 1560\xD7720"},"mobile-4-3":{id:"mobile-4-3",device:"mobile",platform:"TOUCHSCREEN",width:1280,height:960,ratio:"4:3",luaDevice:"Mobile",label:"\u624B\u673A 1280\xD7960"}}),an="pc-16-9",we=2,Vt=Object.freeze({KEYBOARD:"pc-16-9",TOUCHSCREEN:"mobile-16-9",CONTROLLER_CONSOLE:"pc-16-9",CONTROLLER_MOBILE:"mobile-16-9"}),Bt=Object.freeze({"server-container":"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668",container:"\u5BB9\u5668\u8282\u70B9",textbox:"\u6587\u672C\u6846",image:"\u56FE\u7247",button:"\u9884\u8BBE\u6309\u94AE",cursor:"\u5149\u6807\u68C0\u6D4B\u533A\u57DF",grid:"\u7F51\u683C\u89C6\u7A97",reference:"\u6A21\u677F\u5F15\u7528\u63A7\u4EF6",textwindow:"\u6587\u672C\u89C6\u7A97",keyhint:"\u6309\u952E\u63D0\u793A",animation:"\u754C\u9762\u52A8\u6548",fullscreen:"\u5168\u5C4F\u52A8\u6548"}),rn=Object.freeze(["server-container","container","textbox","cursor","reference","grid","image","button","textwindow","keyhint","animation","fullscreen"]),so=Object.freeze({"server-container":null,container:[150,150],textbox:[100,40],image:[80,80],button:[150,50],cursor:[150,50],grid:[80,80],reference:[80,80],textwindow:[100,40],keyhint:[40,40],animation:[100,100],fullscreen:null}),id=Object.freeze({100001:"rect",100002:"circle",100003:"triangle",100004:"fourstar",100005:"fivestar",100006:"ring"});function Ht(e,t){return Ae(t)==="StaticReference"&&id[e]||(at(e,t)?"sprite":"missing")}var co=50888,bi=Object.freeze({font:4294967295,bg:16777215,outline:858993459,image:4294967295});import{Worker as qu}from"node:worker_threads";import{existsSync as Ju,mkdirSync as fl,readFileSync as Kr,writeFileSync as ul}from"node:fs";import{basename as Qu,dirname as hl}from"node:path";import{existsSync as Vi,readFileSync as _f}from"node:fs";import{randomUUID as Ec}from"node:crypto";import{isAbsolute as lo,win32 as fo}from"node:path";function on(e,t=!1){let i=String(e??"").trim().replaceAll("\\","/");if(t&&(!i||i==="."))return"";if(!i||lo(i)||fo.isAbsolute(i)||i.split("/").some(n=>!n||n==="."||n===".."||/[<>:"|?*\x00-\x1f]/.test(n)||/[. ]$/.test(n)||/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(n)))throw new Error("\u811A\u672C\u76EE\u5F55/\u8DEF\u5F84\u5FC5\u987B\u662F\u6709\u6548\u7684\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u4E0D\u80FD\u5305\u542B .. \u6216 Windows \u7279\u6B8A\u6587\u4EF6\u540D");return i}function gi(e){if(e==null)return null;if(e.version!==1)throw new Error("unsupported scriptSync version");let t=String(e.clientImportRoot||"").trim();if(!lo(t)&&!fo.isAbsolute(t))throw new Error("\u5B9E\u673A\u5BFC\u5165\u6839\u76EE\u5F55\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84");return{version:1,workspaceDir:on(e.workspaceDir,!0),clientImportRoot:t,clientSubdir:on(e.clientSubdir,!0)}}import{basename as ai,dirname as Pf,isAbsolute as Tf,join as Ic,resolve as Cc}from"node:path";function Lt(e,t="$",i=new Set){if(e===void 0)throw new Error(`undefined at ${t}`);if(typeof e=="number"&&!Number.isFinite(e))throw new Error(`non-finite number at ${t}`);if(typeof e=="bigint"||typeof e=="function"||typeof e=="symbol")throw new Error(`non-JSON value at ${t}`);if(!(e===null||typeof e!="object")){if(i.has(e))throw new Error(`circular value at ${t}`);if(i.add(e),Array.isArray(e))e.forEach((n,a)=>Lt(n,`${t}[${a}]`,i));else for(let[n,a]of Object.entries(e))Lt(a,`${t}.${n}`,i);i.delete(e)}}function L(e){return Lt(e),JSON.parse(JSON.stringify(e))}function uo(e,t="$"){Lt(e,t)}function ho(e){return J[e]||J[an]}function yi(e,t=0,i=0){return!e||typeof e!="object"?{x:t,y:i}:{x:Number(e.x??t),y:Number(e.y??i)}}function nd(e){return!e||typeof e!="object"?{x:1,y:1,z:1}:{x:Number(e.x??1),y:Number(e.y??1),z:Number(e.z??1)}}function ad(e){return!e||typeof e!="object"?{x:0,y:0,z:0}:{x:Number(e.x??0),y:Number(e.y??0),z:Number(e.z??0)}}function sn({layout:e="center",size:t=[100,40],offset:i=[0,0]}={}){return e==="stretch"?{scale:{x:1,y:1,z:1},rotation:{x:0,y:0,z:0},anchorMin:{x:0,y:0},anchorMax:{x:1,y:1},offset:{x:0,y:0},size:{x:0,y:0},pivot:{x:.5,y:.5}}:{scale:{x:1,y:1,z:1},rotation:{x:0,y:0,z:0},anchorMin:{x:.5,y:.5},anchorMax:{x:.5,y:.5},offset:{x:Number(i[0]??0),y:Number(i[1]??0)},size:{x:Number(t[0]??0),y:Number(t[1]??0)},pivot:{x:.5,y:.5}}}function je(e){let t=e||sn();return{scale:nd(t.scale),rotation:ad(t.rotation),anchorMin:yi(t.anchorMin??t.anchor_min,.5,.5),anchorMax:yi(t.anchorMax??t.anchor_max,.5,.5),offset:yi(t.offset,0,0),size:yi(t.size,0,0),pivot:yi(t.pivot,.5,.5)}}function he(e,t=0){let i=Number(e);return Number.isFinite(i)?i:t}function Ke(e,t){let i=e.width,n=e.height,a=e.left,r=e.bottom,o=t.anchorMin||{x:t.anchorMinX,y:t.anchorMinY},s=t.anchorMax||{x:t.anchorMaxX,y:t.anchorMaxY},c=t.offset||{x:t.anchoredPositionX,y:t.anchoredPositionY},l=t.size||{x:t.sizeDeltaX,y:t.sizeDeltaY},d=t.pivot||{x:t.pivotX,y:t.pivotY},f=he(o?.x,.5)*i,h=he(o?.y,.5)*n,m=he(s?.x,.5)*i,p=he(s?.y,.5)*n,b=he(l?.x),v=he(l?.y),y=he(d?.x,.5),w=he(d?.y,.5),_=m-f+b,T=p-h+v,N=a+f+he(c?.x)-b*y,O=r+h+he(c?.y)-v*w;return{left:N,bottom:O,width:_,height:T,right:N+_,top:O+T,centerX:N+_/2,centerY:O+T/2}}function Ut(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}}function rd(e,t){return{a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,tx:e.a*t.tx+e.c*t.ty+e.tx,ty:e.b*t.tx+e.d*t.ty+e.ty}}function Ie(e,t,i){return{x:e.a*t+e.c*i+e.tx,y:e.b*t+e.d*i+e.ty}}function qe(e){let t=e.a*e.d-e.b*e.c;return!Number.isFinite(t)||Math.abs(t)<1e-8?null:{a:e.d/t,b:-e.b/t,c:-e.c/t,d:e.a/t,tx:(e.c*e.ty-e.d*e.tx)/t,ty:(e.b*e.tx-e.a*e.ty)/t}}function la(e,t){let i=t.rotation||{x:t.localRotationX,y:t.localRotationY,z:t.localRotationZ},n=t.scale||{x:t.localScaleX,y:t.localScaleY},a=t.pivot||{x:t.pivotX,y:t.pivotY},r=he(i?.z)*Math.PI/180,o=Math.cos(r),s=Math.sin(r),c=he(i?.x)*Math.PI/180,l=he(i?.y)*Math.PI/180,d=Math.cos(c),f=Math.sin(c),h=Math.cos(l),m=Math.sin(l),p=V=>Math.abs(V)<1e-12?0:V,b=he(n?.x,1),v=he(n?.y,1),y=e.left+e.width*he(a?.x,.5),w=e.bottom+e.height*he(a?.y,.5),_=p(h*o+m*f*s)*b,T=p(d*s)*b,N=p(-h*s+m*f*o)*v,O=p(d*o)*v;return{a:_,b:T,c:N,d:O,tx:y-_*y-N*w,ty:w-T*y-O*w}}function wi(e,t,i){return rd(e||Ut(),la(t,i))}function mo(e,t){let i=Ie(t,e.centerX,e.centerY),n=Math.abs(e.width*Math.hypot(t.a,t.b)),a=Math.abs(e.height*Math.hypot(t.c,t.d));return{left:i.x-n/2,bottom:i.y-a/2,width:n,height:a,centerX:i.x,centerY:i.y,rotationZ:Math.atan2(t.b,t.a)*180/Math.PI}}function ve(e){let t=typeof e=="string"?ho(e):e;return{left:0,bottom:0,width:t.width,height:t.height,right:t.width,top:t.height,centerX:t.width/2,centerY:t.height/2}}function da(e){return{posX:e.centerX,posY:e.centerY,width:e.width,height:e.height}}function pt(e,t,i){let n=je(t),a=e.width,r=e.height,o=n.anchorMin.x*a,s=n.anchorMin.y*r,c=n.anchorMax.x*a,l=n.anchorMax.y*r,d=Number(i.width),f=Number(i.height),h=Number(i.posX),m=Number(i.posY),p=h-d/2,b=m-f/2;return n.size={x:d-(c-o),y:f-(l-s)},n.offset={x:p-e.left-o+n.size.x*n.pivot.x,y:b-e.bottom-s+n.size.y*n.pivot.y},n}function po(e,t){let i=je(e),a={"bottom-left":[[0,0],[0,0],[0,0]],bottom:[[.5,0],[.5,0],[.5,0]],"bottom-right":[[1,0],[1,0],[1,0]],left:[[0,.5],[0,.5],[0,.5]],center:[[.5,.5],[.5,.5],[.5,.5]],right:[[1,.5],[1,.5],[1,.5]],"top-left":[[0,1],[0,1],[0,1]],top:[[.5,1],[.5,1],[.5,1]],"top-right":[[1,1],[1,1],[1,1]],stretch:[[0,0],[1,1],[.5,.5]],"stretch-horizontal":[[0,.5],[1,.5],[.5,.5]],"stretch-vertical":[[.5,0],[.5,1],[.5,.5]]}[t];return a&&(i.anchorMin={x:a[0][0],y:a[0][1]},i.anchorMax={x:a[1][0],y:a[1][1]},i.pivot={x:a[2][0],y:a[2][1]}),i}function bo(e){let t=je(e),i=(n,a)=>Math.abs(n-a)<1e-4;if(i(t.anchorMin.x,0)&&i(t.anchorMin.y,0)&&i(t.anchorMax.x,1)&&i(t.anchorMax.y,1))return"stretch";if(i(t.anchorMin.x,t.anchorMax.x)&&i(t.anchorMin.y,t.anchorMax.y)){let n=t.anchorMin.x,a=t.anchorMin.y,r=[[0,0,"bottom-left"],[.5,0,"bottom"],[1,0,"bottom-right"],[0,.5,"left"],[.5,.5,"center"],[1,.5,"right"],[0,1,"top-left"],[.5,1,"top"],[1,1,"top-right"]];for(let o of r)if(i(n,o[0])&&i(a,o[1]))return o[2]}return"custom"}function bt(e){return ho(e).platform}function go(e){let t={};for(let i of fe)t[i]=e(i);return t}var od={scale:["x","y","z"],rotation:["x","y","z"],anchorMin:["x","y"],anchorMax:["x","y"],offset:["x","y"],size:["x","y"],pivot:["x","y"]};function yo(e,t){for(let[i,n]of Object.entries(od))for(let a of n)if(!Number.isFinite(e?.[i]?.[a]))throw new Error(`${t}.${i}.${a} must be a finite number`)}function rt(e,t="transformByPlatform"){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}: \u9700\u8981\u5B8C\u6574\u7684\u56DB\u5E73\u53F0\u5E03\u5C40`);for(let i of Object.keys(e))if(!fe.includes(i))throw new Error(`${t}: unknown platform ${i}`);for(let i of fe)yo(e[i],`${t}.${i}`)}function gt(e){if(Object.hasOwn(e,"transformByCanvas"))throw new Error(`${e.name||e.id||"\u63A7\u4EF6"}: \u4E0D\u518D\u652F\u6301 transformByCanvas\uFF1B\u8BF7\u4F7F\u7528\u56DB\u5E73\u53F0 transformByPlatform \u5E03\u5C40`);rt(e.transformByPlatform,`${e.name||e.id||"\u63A7\u4EF6"}.transformByPlatform`)}function yt(e,t){if(!fe.includes(t))throw new Error(`unknown platform ${t}`);return yo(e?.[t],`transformByPlatform.${t}`),je(e[t])}var sd=Object.freeze([{key:"genericField501",label:"\u901A\u7528\u69FD field501",type:"number",defaultValue:0,wire:"GenericSlot.field501"},{key:"footerField505",label:"\u5C3E\u90E8\u69FD field505",type:"number",defaultValue:0,wire:"FooterSlot.field505"}]),cd=Object.freeze({container:[],textbox:[{key:"textField501",label:"\u6587\u672C\u914D\u7F6E field501",type:"number",defaultValue:20,wire:"TextConfig.field501"},{key:"textField503",label:"\u6587\u672C\u914D\u7F6E field503",type:"number",defaultValue:12,wire:"TextConfig.field503"},{key:"textAlign",label:"\u6C34\u5E73\u5BF9\u9F50\u679A\u4E3E\u539F\u59CB\u503C",type:"enum",defaultValue:0,wire:"TextConfig.align",options:[{value:0,label:"0 \xB7 \u5DE6\u5BF9\u9F50"},{value:1,label:"1 \xB7 \u5C45\u4E2D"},{value:2,label:"2 \xB7 \u53F3\u5BF9\u9F50"}]}],textwindow:[{key:"textField501",label:"\u6587\u672C\u914D\u7F6E field501",type:"number",defaultValue:20,wire:"TextConfig.field501"},{key:"textField503",label:"\u6587\u672C\u914D\u7F6E field503",type:"number",defaultValue:12,wire:"TextConfig.field503"},{key:"textAlign",label:"\u6C34\u5E73\u5BF9\u9F50\u679A\u4E3E\u539F\u59CB\u503C",type:"enum",defaultValue:0,wire:"TextConfig.align",options:[{value:0,label:"0 \xB7 \u5DE6\u5BF9\u9F50"},{value:1,label:"1 \xB7 \u5C45\u4E2D"},{value:2,label:"2 \xB7 \u53F3\u5BF9\u9F50"}]},{key:"textField511",label:"\u6587\u672C\u89C6\u7A97 field511",type:"number",defaultValue:1,wire:"TextConfig.field511"},{key:"textViewField502",label:"\u89C6\u7A97\u6807\u8BB0 field502",type:"number",defaultValue:1,wire:"TextConfig.viewFlags.field502"},{key:"textViewField503",label:"\u89C6\u7A97\u6807\u8BB0 field503",type:"number",defaultValue:1,wire:"TextConfig.viewFlags.field503"}],cursor:[{key:"cursorField501",label:"\u5149\u6807\u68C0\u6D4B field501",type:"number",defaultValue:1,wire:"CursorConfig.field501"}],reference:[{key:"templateRefSlot",label:"\u6A21\u677F\u5F15\u7528\u69FD\u539F\u59CB\u503C",type:"string",defaultValue:"",wire:"Details.templateRefSlot"}],grid:[{key:"gridField501",label:"\u7F51\u683C\u6807\u8BB0 field501",type:"number",defaultValue:1,wire:"GridViewConfig.field501"},{key:"gridField507",label:"\u7F51\u683C\u6807\u8BB0 field507",type:"number",defaultValue:1,wire:"GridViewConfig.field507"},{key:"gridField508",label:"\u7F51\u683C\u6807\u8BB0 field508",type:"number",defaultValue:1,wire:"GridViewConfig.field508"},{key:"gridField509",label:"\u7F51\u683C\u6807\u8BB0 field509",type:"number",defaultValue:1,wire:"GridViewConfig.field509"},{key:"gridField511",label:"\u7F51\u683C\u6807\u8BB0 field511",type:"number",defaultValue:5,wire:"GridViewConfig.field511"},{key:"gridField512",label:"\u7F51\u683C\u6807\u8BB0 field512",type:"number",defaultValue:1,wire:"GridViewConfig.field512"}],keyhint:[{key:"keyHintField501",label:"\u6309\u952E\u63D0\u793A field501",type:"number",defaultValue:1,wire:"KeyHintConfig.field501"},{key:"keyHintField502",label:"\u952E\u9F20\u952E\u4F4D\u539F\u59CB\u503C",type:"number",defaultValue:1,wire:"KeyHintConfig.field502"}],image:[{key:"imageSlotType",label:"\u56FE\u7247\u7C7B\u578B\u539F\u59CB\u503C",type:"number",defaultValue:0,wire:"ImageSlotConfig.imageType"},{key:"imageField502",label:"\u56FE\u7247\u6807\u8BB0 field502",type:"number",defaultValue:1,wire:"ImageConfig.field502"},{key:"imageField504",label:"\u56FE\u7247\u6807\u8BB0 field504",type:"number",defaultValue:1,wire:"ImageConfig.field504"},{key:"imageField505",label:"\u56FE\u7247\u6807\u8BB0 field505",type:"number",defaultValue:1,wire:"ImageConfig.field505"},{key:"imageField507",label:"\u56FE\u7247\u6807\u8BB0 field507",type:"number",defaultValue:2,wire:"ImageConfig.field507"},{key:"imageFillType",label:"\u586B\u5145\u5F62\u72B6\u679A\u4E3E\u539F\u59CB\u503C",type:"enum",defaultValue:1,wire:"ImageConfig.fillType",options:[{value:1,label:"1 \xB7 \u6A2A\u5411"},{value:2,label:"2 \xB7 \u7EB5\u5411"},{value:3,label:"3 \xB7 90\u5EA6\u73AF\u7ED5"},{value:4,label:"4 \xB7 180\u5EA6\u73AF\u7ED5"},{value:5,label:"5 \xB7 360\u5EA6\u73AF\u7ED5"}]}],animation:[{key:"effectSlot",label:"\u754C\u9762\u52A8\u6548\u69FD\u539F\u59CB\u503C",type:"string",defaultValue:"",wire:"Details.effectSlot"}],fullscreen:[{key:"fullscreenEffectSlot",label:"\u5168\u5C4F\u52A8\u6548\u69FD\u539F\u59CB\u503C",type:"string",defaultValue:"",wire:"Details.fullscreenEffectSlot"}]});function wo(e){return[...sd,...cd[e]||[]]}function vo(e,t){return wo(e).find(i=>i.key===t)||null}function fa(e,t){if(!e)throw new Error("unknown raw GIA field");if(e.type==="string")return String(t??"");let i=Number(t);if(!Number.isFinite(i))throw new Error(`${e.wire} must be a finite number`);return Math.trunc(i)}function So(e,t={}){let i={};for(let n of wo(e)){let a=Object.hasOwn(t||{},n.key)?t[n.key]:n.defaultValue;i[n.key]=fa(n,a)}if(e==="reference")for(let n of["templateRefSlotBase64","templateRefOuterBase64"]){if(!Object.hasOwn(t||{},n))continue;let a=t[n];if(typeof a!="string"||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a))throw new Error(`${n} must be base64`);a&&(i[n]=a)}return i}function Te(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=1073741824&&t<=1077936127}function Je(e){let t=Number(e);return Number.isSafeInteger(t)&&t>0&&t<=2147483647}function ua(e,t){if(Je(e)&&!Te(e))throw new Error(`${t||"\u8D44\u4EA7"}: \u7D22\u5F15 ${e} \u8D85\u51FA 1073741824\u20131077936127\uFF1B\u8BF7\u5148\u6821\u51C6\u7D22\u5F15\u5E76\u6838\u5BF9 Lua \u5F15\u7528\uFF0C\u5BFC\u51FA\u4E0D\u4F1A\u81EA\u52A8\u91CD\u7F16\u53F7\u3002`)}function ha(e,t){if(e){t(e);for(let i of e.children||[])ha(i,t)}}function jt(e,t=new Set,{skipServerContainer:i=!1}={}){return ha(e,n=>{i&&n.kind==="server-container"||Te(n.guid)&&t.add(Number(n.guid))}),t}function ot(e,t=1073741850){let i=Number.isSafeInteger(t)&&t>0?t:1073741850;i<1073741850&&(i=1073741850);for(let n of e)Te(n)&&n>=i&&(i=Number(n)+1);for(;e.has(i);)i+=1;if(i>1077936127)throw new Error("GUID space exhausted");return i}function xo(e,t=new Set,{skipServerContainer:i=!1}={}){let n=[];ha(e,a=>{if(i&&a.kind==="server-container")return;let r=Number(a.guid);if(Te(r)&&!t.has(r)){t.add(r),a.guid=r;return}n.push(a)});for(let a of n){let r=ot(t);a.guid=r,t.add(r)}return t}function Me(e){return Number.isSafeInteger(e)&&e>0&&e<=2147483647}function Qe(e,{warnings:t=[]}={}){if(e.meta?.assetType!=="client-control-template")return;if(e.meta.giaAssetIndexSchemaVersion>1)throw new Error(`\u4E0D\u652F\u6301\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u7248\u672C ${e.meta.giaAssetIndexSchemaVersion}`);let i=[],n=p=>{p.kind!=="server-container"&&i.push(p);for(let b of p.children||[])n(b)};n(e.root);let a=new Map,r=new Map;for(let p of i){if(!Me(p.giaInfoIndex))continue;let b=a.get(p.giaInfoIndex)||[];b.push(p),a.set(p.giaInfoIndex,b);let v=r.get(p.kind)||new Set;v.add(p.giaInfoIndex),r.set(p.kind,v)}let o=(e.root.children||[]).filter(p=>p.kind!=="server-container"),s=new Set(o),c=o.some((p,b)=>Me(p.giaInfoIndex)&&o.slice(0,b).some(v=>v.giaInfoIndex===p.giaInfoIndex)),l=!e.meta.giaAssetIndexSchemaVersion&&c&&i.every(p=>p.giaInfoIndexSource!=="authoring")&&[...r.values()].every(p=>p.size===1)&&[...a.values()].every(p=>p.every(b=>b.kind===p[0].kind)),d=new Set;if(l)for(let p of a.values()){let b=p.find(v=>s.has(v))||p[0];for(let v of p)v!==b&&d.add(v)}let f=new Map,h=Number.isSafeInteger(e.meta.giaNextAssetIndex)&&e.meta.giaNextAssetIndex>=2?e.meta.giaNextAssetIndex:2;for(let p of i){if(!Me(p.giaInfoIndex)||(h=Math.max(h,p.giaInfoIndex+1),d.has(p)))continue;let b=f.get(p.giaInfoIndex);if(b&&(b.giaInfoIndexSource==="authoring"||p.giaInfoIndexSource==="authoring"))throw new Error(`\u65B0\u5EFA\u8D44\u4EA7\u7F16\u53F7 ${p.giaInfoIndex} \u91CD\u590D\uFF1A${b.name} / ${p.name}`);f.set(p.giaInfoIndex,p)}l&&(h=Math.max(h,13));let m=l?[...o,...i.filter(p=>!s.has(p))].filter(p=>d.has(p)||!Me(p.giaInfoIndex)):i.filter(p=>!Me(p.giaInfoIndex));if(m.length&&h+m.length-1>2147483647)throw new Error("\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u7A7A\u95F4\u5DF2\u8017\u5C3D");for(let p of m)p.giaInfoIndex=h++,p.giaInfoIndexSource="authoring";e.meta.giaNextAssetIndex=h,e.meta.giaAssetIndexSchemaVersion=1,d.size&&t.push(`\u65E7\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u81EA\u52A8\u8FC1\u79FB\uFF1A\u4FEE\u590D ${d.size} \u6761\u6309\u63A7\u4EF6\u7C7B\u578B\u590D\u7528\u7684\u7F16\u53F7\uFF1BGUID\u3001Lua \u5F15\u7528\u548C\u63A7\u4EF6\u5C5E\u6027\u4FDD\u6301\u4E0D\u53D8\u3002`)}var ma=1;function pa(e="n"){let t=`${e}${ma}`;return ma+=1,t}function cn(e=1){ma=e}function ba(e,{isRootContainer:t=!1}={}){if(e==="server-container"||e==="fullscreen"||e==="container"&&t)return sn({layout:"stretch"});let i=so[e]||[80,80];return sn({layout:"center",size:i})}function ld(e,t){return go(()=>ba(e,t))}function dd(e){rt(e);let t={};for(let i of fe)t[i]=yt(e,i);return t}function Q(e,t={}){if(!Bt[e])throw new Error(`unknown kind: ${e}`);Object.hasOwn(t,"transformByCanvas")&>(t);let i=t.isRootContainer===!0,n=t.id||pa(e==="server-container"?"sc":"n"),a=Object.hasOwn(t,"transformByPlatform")?dd(t.transformByPlatform):ld(e,{isRootContainer:i}),r={id:n,kind:e,name:t.name||Bt[e],guid:t.guid??0,giaRelatedGuids:Array.isArray(t.giaRelatedGuids)?t.giaRelatedGuids.filter(o=>Number.isSafeInteger(Number(o))&&Number(o)>0).map(Number):[],...Me(Number(t.giaInfoIndex))?{giaInfoIndex:Number(t.giaInfoIndex),giaInfoIndexSource:t.giaInfoIndexSource==="authoring"?"authoring":"imported"}:{},active:t.active!==!1,visible:t.visible!==!1,canControllerFocus:t.canControllerFocus??t.giaRaw?.footerField505===1,syncAllDevices:t.syncAllDevices!==!1,giaRaw:So(e,t.giaRaw),transformByPlatform:a,children:[],scriptMappingIds:Array.isArray(t.scriptMappingIds)?t.scriptMappingIds.filter(o=>Number.isSafeInteger(Number(o))&&Number(o)>0).map(Number):[]};if(e==="container"&&(r.isolateNavigation=t.isolateNavigation===!0,r.disableKeyEventPassthrough=t.disableKeyEventPassthrough===!0,r.disableCursorEventPassthrough=t.disableCursorEventPassthrough===!0,r.showCursor=Object.hasOwn(t,"showCursor")?t.showCursor===!0:!0),(e==="textbox"||e==="textwindow")&&(r.fontSize=t.fontSize??20,r.adaptiveFontSize=t.adaptiveFontSize===!0,r.minimumFontSize=t.minimumFontSize??20,r.fontColor=t.fontColor??bi.font,r.bgColor=t.bgColor??bi.bg,r.enableOutline=t.enableOutline!==!1,r.outlineColor=t.outlineColor??bi.outline,r.horizontalAlignment=t.horizontalAlignment||"Left",r.verticalAlignment=t.verticalAlignment||"Top",Number.isInteger(t.giaRaw?.textVerticalAlign)&&![0,1,2].includes(t.giaRaw.textVerticalAlign)&&(r.giaRaw.textVerticalAlign=t.giaRaw.textVerticalAlign),r.text=t.text??"",Object.hasOwn(t.giaRaw||{},"textAlign")||(r.giaRaw.textAlign={Left:0,Middle:1,Right:2}[r.horizontalAlignment]??r.giaRaw.textAlign),e==="textwindow"&&(r.interactable=t.interactable!==!1,r.showScrollBar=t.showScrollBar!==!1)),e==="image"&&(r.imageSource=t.imageSource||"StaticReference",r.imageType=["Basic","Stretch"].includes(t.imageType)?t.imageType:null,r.imageId=t.imageId??100001,r.imageColor=t.imageColor??bi.image,r.enableMask=t.enableMask===!0,r.enableSoftEdge=t.enableSoftEdge===!0,r.softEdgeMode=t.softEdgeMode||"Percentage",r.softEdgeWidthX=t.softEdgeWidthX??8,r.softEdgeWidthY=t.softEdgeWidthY??8,r.horizontalSoftRange=t.horizontalSoftRange??85,r.verticalSoftRange=t.verticalSoftRange??85,r.enableFill=t.enableFill===!0,r.fillType=t.fillType||"Horizontal",r.fillHorizontalType=t.fillHorizontalType||"Left",r.fillVerticalType=t.fillVerticalType||"Bottom",r.fillRadial90Type=t.fillRadial90Type||"BottomLeft",r.fillRadialType=t.fillRadialType||"Bottom",r.fillAmount=t.fillAmount??1,r.reverseMaskArea=t.reverseMaskArea===!0||t.reverseMask===!0,Object.hasOwn(t.giaRaw||{},"imageFillType")||(r.giaRaw.imageFillType={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[r.fillType]??r.giaRaw.imageFillType)),e==="button"&&(r.raycastTarget=t.raycastTarget!==!1,r.interactable=t.interactable!==!1,r.clickAudioId=t.clickAudioId??co,r.unavailableChildId=t.unavailableChildId??null,r.hoverChildId=t.hoverChildId??null,r.pressedChildId=t.pressedChildId??null,r.selectedChildId=t.selectedChildId??null),e==="cursor"&&(r.raycastTarget=t.raycastTarget??t.giaRaw?.cursorField501!==0),e==="reference"&&(r.referencedPrefabId=t.referencedPrefabId??t.giaRaw?.templateRefSlot??null,Object.hasOwn(t.giaRaw||{},"templateRefSlot")||(r.giaRaw.templateRefSlot=String(r.referencedPrefabId??""))),e==="grid"&&(r.itemPrefabId=t.itemPrefabId??null,r.raycastTarget=t.raycastTarget!==!1,r.interactable=t.interactable!==!1,r.showScrollBar=t.showScrollBar!==!1,r.scrollDirection=t.scrollDirection||"Vertical",r.layoutConstraint=t.layoutConstraint||"AutoWrap",r.layoutConstraintFixedCount=t.layoutConstraintFixedCount??null,r.cellSizeX=t.cellSizeX??50,r.cellSizeY=t.cellSizeY??50,r.spacingX=t.spacingX??8,r.spacingY=t.spacingY??8,r.padding1X=t.padding1X??20,r.padding1Y=t.padding1Y??20,r.padding2X=t.padding2X??20,r.padding2Y=t.padding2Y??20,r.previewCount=t.previewCount??t.giaRaw?.gridField511??5,Object.hasOwn(t.giaRaw||{},"gridField511")||(r.giaRaw.gridField511=Math.trunc(r.previewCount))),e==="keyhint"&&(r.keyboardKeyCode=t.keyboardKeyCode??t.giaRaw?.keyHintField502??null,r.controllerKeyCode=t.controllerKeyCode??t.giaRaw?.keyHintField501??null,Object.hasOwn(t.giaRaw||{},"keyHintField502")||(r.giaRaw.keyHintField502=Math.trunc(r.keyboardKeyCode??1)),Object.hasOwn(t.giaRaw||{},"keyHintField501")||(r.giaRaw.keyHintField501=Math.trunc(r.controllerKeyCode??1))),e==="animation"||e==="fullscreen"){let o=e==="animation"?t.giaRaw?.effectSlot:t.giaRaw?.fullscreenEffectSlot;r.animationId=t.animationId??o??null,r.playSoundEffect=t.playSoundEffect??null,e==="animation"&&(r.layer=t.layer??null);let s=e==="animation"?"effectSlot":"fullscreenEffectSlot";Object.hasOwn(t.giaRaw||{},s)||(r.giaRaw[s]=String(r.animationId??""))}if(t.children)for(let o of t.children)r.children.push(o);return r}function wt(){cn(1);let e=Q("server-container",{id:"sc1",name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668"}),t=Q("container",{id:"n1",name:"\u5BB9\u5668\u8282\u70B9",isRootContainer:!0}),i=Q("textbox",{id:"n2",name:"\u6587\u672C\u6846",text:"\u6587\u672C"}),n=Q("cursor",{id:"n3",name:"\u5149\u6807\u68C0\u6D4B\u533A\u57DF"}),a=Q("reference",{id:"n4",name:"\u6A21\u677F\u5F15\u7528\u63A7\u4EF6"}),r=Q("grid",{id:"n5",name:"\u7F51\u683C\u89C6\u7A97"}),o=Q("button",{id:"n6",name:"\u9884\u8BBE\u6309\u94AE"}),s=Q("textwindow",{id:"n7",name:"\u6587\u672C\u89C6\u7A97"}),c=Q("keyhint",{id:"n8",name:"\u6309\u952E\u63D0\u793A"}),l=Q("image",{id:"n9",name:"\u56FE\u7247",imageId:100005}),d=Q("animation",{id:"n10",name:"\u754C\u9762\u52A8\u6548"}),f=Q("fullscreen",{id:"n11",name:"\u5168\u5C4F\u52A8\u6548"}),h=(m,p,b)=>{for(let v of Object.values(m.transformByPlatform))v.offset={x:p,y:b}};return h(i,-300,250),h(n,-300,140),h(a,-300,30),h(r,-300,-100),h(o,0,0),h(s,300,250),h(c,300,140),h(l,300,30),h(d,300,-100),t.children.push(i,n,a,r,o,s,c,l,d,f),e.children.push(t),cn(12),xo(e),{version:1,layoutSchemaVersion:we,meta:{name:"\u672A\u547D\u540D\u754C\u9762\u63A7\u4EF6\u7EC4",assetType:"server-control-template",sourceFormat:"authoring",sourceFile:""},canvasId:"pc-16-9",selectedId:"n2",root:e}}function Yt(){cn(1);let e=Q("server-container",{id:"sc1",name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"}),t=Q("container",{id:"n1",guid:1073742100,name:"Lua\u5B9E\u4F8B\u5316\u9762\u677F"}),i=Q("textbox",{id:"n2",guid:1073742101,name:"\u6A21\u677F\u6807\u9898",text:"\u5BA2\u6237\u7AEF\u6A21\u677F\u5DF2\u5B9E\u4F8B\u5316",fontSize:28,horizontalAlignment:"Middle"}),n=Q("image",{id:"n3",guid:1073742102,name:"\u6A21\u677F\u56FE\u6807",imageId:100005}),a=Q("button",{id:"n4",guid:1073742103,name:"\u786E\u8BA4\u6309\u94AE"}),r=Q("textbox",{id:"n5",guid:1073742104,name:"\u6309\u94AE\u6587\u5B57",text:"\u786E\u8BA4",horizontalAlignment:"Middle",verticalAlignment:"Top"}),o=(l,d,f)=>{for(let h of Object.values(l.transformByPlatform))h.offset={x:d,y:f}};((l,d,f)=>{for(let h of Object.values(l.transformByPlatform))h.size={x:d,y:f}})(t,520,320),o(i,0,110),o(n,0,0),o(a,0,-110),a.children.push(r),t.children.push(i,n,a),e.children.push(t),cn(6);let c={version:1,layoutSchemaVersion:we,meta:{name:"Lua\u5B9E\u4F8B\u5316\u9762\u677F",assetType:"client-control-template",sourceFormat:"authoring",sourceFile:"",gameVersion:nn,giaOwnerUid:114514,giaFileId:1073741829,giaFileName:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868.gia"},canvasId:"pc-16-9",selectedId:"n1",root:e};return Qe(c),c}function K(e,t,i=null){t(e,i);for(let n of e.children||[])K(n,t,e)}function me(e,t){let i=null;return K(e,n=>{n.id===t&&(i=n)}),i}function ga(e,t="n"){let i=pa(t);for(;me(e,i);)i=pa(t);return i}function st(e,t){let i=null;return K(e,(n,a)=>{n.id===t&&(i=a)}),i}function ya(e){let t=e.root||e;return t.kind==="container"?t:(t.children||[]).find(i=>i.kind==="container")||(t.children||[])[0]||t}function vi(e){if(e.meta?.assetType!=="client-control-template")return ya(e);let t=me(e.root,e.selectedId);if(!t||t.kind==="server-container")return e.root.children?.[0]||e.root;let i=st(e.root,t.id);for(;i&&i.kind!=="server-container";)t=i,i=st(e.root,t.id);return t}function wa(e){gt(e);let t={id:e.id,name:e.name,guid:e.guid,giaRelatedGuids:e.giaRelatedGuids,giaInfoIndex:e.giaInfoIndex,giaInfoIndexSource:e.giaInfoIndexSource,scriptMappingIds:e.scriptMappingIds,giaRaw:e.giaRaw,active:e.active,visible:e.visible,canControllerFocus:e.canControllerFocus,syncAllDevices:e.syncAllDevices,transformByPlatform:e.transformByPlatform};e.kind==="container"&&(t.isolateNavigation=e.isolateNavigation,t.disableKeyEventPassthrough=e.disableKeyEventPassthrough,t.disableCursorEventPassthrough=e.disableCursorEventPassthrough,t.showCursor=e.showCursor),(e.kind==="textbox"||e.kind==="textwindow")&&(t.fontSize=e.fontSize,t.adaptiveFontSize=e.adaptiveFontSize,t.minimumFontSize=e.minimumFontSize,t.fontColor=e.fontColor,t.bgColor=e.bgColor,t.enableOutline=e.enableOutline,t.outlineColor=e.outlineColor,t.horizontalAlignment=e.horizontalAlignment,t.verticalAlignment=e.verticalAlignment,t.text=e.text??"",e.kind==="textwindow"&&(t.interactable=e.interactable,t.showScrollBar=e.showScrollBar)),e.kind==="image"&&(t.imageSource=e.imageSource,t.imageType=e.imageType,t.imageId=e.imageId,t.imageColor=e.imageColor,t.enableMask=e.enableMask,t.enableSoftEdge=e.enableSoftEdge,t.softEdgeMode=e.softEdgeMode,t.softEdgeWidthX=e.softEdgeWidthX,t.softEdgeWidthY=e.softEdgeWidthY,t.horizontalSoftRange=e.horizontalSoftRange,t.verticalSoftRange=e.verticalSoftRange,t.enableFill=e.enableFill,t.fillType=e.fillType,t.fillHorizontalType=e.fillHorizontalType,t.fillVerticalType=e.fillVerticalType,t.fillRadial90Type=e.fillRadial90Type,t.fillRadialType=e.fillRadialType,t.fillAmount=e.fillAmount,t.reverseMaskArea=e.reverseMaskArea??e.reverseMask),e.kind==="button"&&(t.raycastTarget=e.raycastTarget,t.interactable=e.interactable,t.clickAudioId=e.clickAudioId,t.unavailableChildId=e.unavailableChildId??null,t.hoverChildId=e.hoverChildId??null,t.pressedChildId=e.pressedChildId??null,t.selectedChildId=e.selectedChildId??null),e.kind==="cursor"&&(t.raycastTarget=e.raycastTarget),e.kind==="reference"&&(t.referencedPrefabId=e.referencedPrefabId??null),e.kind==="grid"&&(t.itemPrefabId=e.itemPrefabId??null,t.raycastTarget=e.raycastTarget,t.interactable=e.interactable,t.showScrollBar=e.showScrollBar,t.scrollDirection=e.scrollDirection,t.layoutConstraint=e.layoutConstraint,t.layoutConstraintFixedCount=e.layoutConstraintFixedCount??null,t.cellSizeX=e.cellSizeX,t.cellSizeY=e.cellSizeY,t.spacingX=e.spacingX,t.spacingY=e.spacingY,t.padding1X=e.padding1X,t.padding1Y=e.padding1Y,t.padding2X=e.padding2X,t.padding2Y=e.padding2Y,t.previewCount=e.previewCount),e.kind==="keyhint"&&(t.keyboardKeyCode=e.keyboardKeyCode??null,t.controllerKeyCode=e.controllerKeyCode??null),(e.kind==="animation"||e.kind==="fullscreen")&&(t.animationId=e.animationId??null,t.playSoundEffect=e.playSoundEffect??null,e.kind==="animation"&&(t.layer=e.layer??null)),t.isRootContainer=e.kind==="container"&&fd(e.transformByPlatform);let i=Q(e.kind,t);return i.children=(e.children||[]).map(n=>wa(n)),i}function fd(e){let t=e&&(e.KEYBOARD||Object.values(e)[0]);return t?Math.abs(t.anchorMin?.x??.5)<1e-4&&Math.abs(t.anchorMin?.y??.5)<1e-4&&Math.abs((t.anchorMax?.x??.5)-1)<1e-4&&Math.abs((t.anchorMax?.y??.5)-1)<1e-4:!1}function Eo(e,t,i={}){if(e.kind==="server-container"&&t!=="container")throw new Error("server container only accepts container nodes");let n=Q(t,i);return e.children.push(n),n}function Io(e,t){if(e.id===t)throw new Error("cannot remove root");let i=st(e,t);if(!i)return!1;let n=i.children.findIndex(a=>a.id===t);return n<0?!1:(i.children.splice(n,1),!0)}var Co=1e-4;function ud(e,t){return Math.abs(e.anchorMax[t]-e.anchorMin[t])>Co&&Math.abs(e.size[t])<=Co}function hd(e,t,i){if(!(t.width>0)||!(t.height>0))throw new Error("source parent must have positive size");if(!(i.width>0)||!(i.height>0))throw new Error("target parent must have positive size");let n=Ke(t,e),a=(n.centerX-t.left)/t.width,r=(n.centerY-t.bottom)/t.height,o=pt(i,e,{posX:i.left+a*i.width,posY:i.bottom+r*i.height,width:n.width,height:n.height});for(let s of["x","y"])ud(e,s)&&(o.offset[s]=e.offset[s],o.size[s]=e.size[s]);return o}function ko({transformByPlatform:e,source:t,canvasId:i,syncAllDevices:n,sourceParentBox:a=ve(i),targetParentBoxByPlatform:r={}}){rt(e);let o=bt(i),s={};for(let c of fe)c===o?s[c]=je(t):n!==!1?s[c]=hd(t,a,r[c]||ve(Vt[c])):s[c]=yt(e,c);return rt(s),s}function ct(e,t){return yt(e,bt(t))}import{createCanvas as Nd}from"@napi-rs/canvas";import{existsSync as xd,openSync as Ed,closeSync as Id,fstatSync as Cd,readFileSync as kd}from"node:fs";import{extname as Ad,isAbsolute as _d}from"node:path";import{createHash as Pd}from"node:crypto";import{workerData as fn}from"node:worker_threads";import{GlobalFonts as To}from"@napi-rs/canvas";var Si='"Microsoft YaHei UI","Microsoft YaHei","HarmonyOS Sans SC","Noto Sans CJK SC",sans-serif',Xt="/qxqy-font";var va=e=>`QxqyLocal_${e}`,Ao=e=>e?`"${va(e)}",${Si}`:Si;import{existsSync as md,mkdirSync as pd,readFileSync as bd,renameSync as gd,rmSync as yd,writeFileSync as wd}from"node:fs";import{randomUUID as vd}from"node:crypto";import{homedir as Sa}from"node:os";import{dirname as Sd,join as ln,win32 as dn}from"node:path";function xa(e=process.platform,t=process.env){if(e!=="win32")return[];let i=t.SystemDrive||"C:",n=t.ProgramFiles||`${i}\\Program Files`,a="YuanShen_Data\\StreamingAssets\\MiHoYoSDKRes\\HttpServerResources\\font\\zh-cn.ttf";return[...new Set([dn.join(n,"Genshin Impact","Genshin Impact Game",a),dn.join(i+"\\","Mihoyo","Genshin Impact","Genshin Impact Game",a),dn.join(n,"HoYoPlay","games","Genshin Impact game",a),dn.join(n,"miHoYo Launcher","games","Genshin Impact Game",a)])]}function _o(){if(process.env.QXQY_FONT_CONFIG_PATH)return process.env.QXQY_FONT_CONFIG_PATH;let e=process.platform==="win32"?process.env.APPDATA||ln(Sa(),"AppData","Roaming"):process.platform==="darwin"?ln(Sa(),"Library","Application Support"):process.env.XDG_CONFIG_HOME||ln(Sa(),".config");return ln(e,"beyond-simulator","font.json")}function Ea(e){if(!e||!["auto","custom","system"].includes(e.mode))throw new Error("\u8BF7\u9009\u62E9\u81EA\u52A8\u67E5\u627E\u3001\u6307\u5B9A\u6587\u4EF6\u6216\u7CFB\u7EDF\u5B57\u4F53");let t=e.scope===void 0?"all":e.scope;if(!["game","all"].includes(t))throw new Error("\u8BF7\u9009\u62E9\u5B57\u4F53\u5E94\u7528\u8303\u56F4");let i=typeof e.path=="string"?e.path.trim():"";if(i.length>4096)throw new Error("\u5B57\u4F53\u8DEF\u5F84\u8FC7\u957F");if((i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),e.mode==="custom"&&!i)throw new Error("\u8BF7\u586B\u5199\u5B57\u4F53\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84");return{mode:e.mode,path:e.mode==="custom"?i:"",scope:t}}function Ia(e=_o()){if(!md(e))return{mode:"auto",path:"",scope:"all"};try{return Ea(JSON.parse(bd(e,"utf8")))}catch{throw new Error("\u672C\u673A\u5B57\u4F53\u8BBE\u7F6E\u65E0\u6CD5\u8BFB\u53D6\uFF0C\u8BF7\u5728\u300C\u5B57\u4F53\u8BBE\u7F6E\u300D\u4E2D\u91CD\u65B0\u4FDD\u5B58")}}function Po(e,t=_o()){let i=`${t}.${vd()}.tmp`;try{pd(Sd(t),{recursive:!0}),wd(i,JSON.stringify(e,null,2)+`
|
|
3
|
+
`,{flag:"wx",mode:384}),gd(i,t)}catch(n){throw new Error("\u65E0\u6CD5\u4FDD\u5B58\u672C\u673A\u5B57\u4F53\u8BBE\u7F6E\uFF0C\u8BF7\u68C0\u67E5\u914D\u7F6E\u76EE\u5F55\u7684\u5199\u5165\u6743\u9650",{cause:n})}finally{yd(i,{force:!0})}}function Oo(e){let t=Buffer.from(e),i=t.subarray(0,4).toString("hex");if(t.length<12||t.length>33554432||!["00010000","4f54544f"].includes(i))throw new Error("QXQY_FONT_PATH must contain a valid TTF or OTF font (at most 32 MiB)");let n=Pd("sha256").update(t).digest("hex"),a=va(n);try{if(!To.has(a)&&!To.register(t,a))throw new Error("invalid font")}catch{throw new Error("QXQY_FONT_PATH font could not be registered")}return{id:n,data:t,type:i==="4f54544f"?"font/otf":"font/ttf"}}function Ca(e){if(!e)return null;if(!_d(e)||![".ttf",".otf"].includes(Ad(e).toLowerCase()))throw new Error("QXQY_FONT_PATH must be an absolute path to a TTF or OTF font");let t,i;try{t=Ed(e,"r");let n=Cd(t);if(!n.isFile()||n.size<12||n.size>33554432)throw new Error("invalid size");i=kd(t)}catch{throw new Error("QXQY_FONT_PATH must point to a readable font file of at most 32 MiB")}finally{t!==void 0&&Id(t)}return Oo(i)}var Mo=!1,un=null,vt={path:"",source:"system",scope:"all"},Wt=null,ka="",$o=!1;function Do(e){if(e.mode==="custom")return{font:Ca(e.path),path:e.path,source:"custom"};if(e.mode==="auto"){let t;for(let i of xa())if(xd(i))try{return{font:Ca(i),path:i,source:"auto"}}catch(n){t=n}if(t)throw t}return{font:null,path:"",source:"system"}}function Ze(){if(!Mo){if(fn&&Object.hasOwn(fn,"localFont"))un=fn.localFont?Oo(fn.localFont):null;else{try{Wt=Ia()}catch(e){ka=e.message}if(vt.scope=Wt?.scope||"all",process.env.QXQY_FONT_PATH)un=Ca(process.env.QXQY_FONT_PATH),vt={...vt,path:process.env.QXQY_FONT_PATH,source:"environment"};else if(Wt)try{let e=Do(Wt);un=e.font,vt={...vt,path:e.path,source:e.source}}catch(e){ka=e.message}}Mo=!0}return un}function Aa(){Ze();let e={mode:"auto",path:"",scope:"all"},t=ka;try{e=Ia()}catch(i){t=i.message}return{...e,active:{...vt},error:t,environmentPath:process.env.QXQY_FONT_PATH||"",defaultPaths:xa(),restartRequired:$o||Wt!==null&&JSON.stringify(Wt)!==JSON.stringify(e)}}function Td(e){Ze();let t=process.env.QXQY_FONT_PATH;if(t&&(!e||!Object.hasOwn(e,"scope")||Object.hasOwn(e,"mode")||Object.hasOwn(e,"path")))throw new Error("\u5F53\u524D\u5B57\u4F53\u7531 QXQY_FONT_PATH \u56FA\u5B9A\uFF0C\u8BF7\u79FB\u9664\u8BE5\u73AF\u5883\u53D8\u91CF\u5E76\u91CD\u542F\u540E\u518D\u4F7F\u7528\u524D\u7AEF\u8BBE\u7F6E");let i=Ea(t?{...Aa(),scope:e.scope}:e),n=t?{path:t,source:"environment"}:Do(i);return Po(i),$o=!0,{...Aa(),nextFont:{path:n.path,source:n.source}}}var Kt=()=>Ao(Ze()?.id),Ro=e=>["127.0.0.1","localhost","::1","[::1]","::ffff:127.0.0.1"].includes(e);function No(e){try{let t=e.headers.host;return Ro(e.socket.remoteAddress)&&Ro(new URL(`http://${t}`).hostname)&&!e.headers.forwarded&&!e.headers["x-forwarded-for"]&&!e.headers["x-forwarded-host"]&&!e.headers.via&&e.headers["sec-fetch-site"]!=="cross-site"&&(!e.headers.origin||new URL(e.headers.origin).host===t)}catch{return!1}}function zo(e,t,{settingsEnabled:i=!0}={}){let n=new URL(e.url||"/","http://localhost");if(n.pathname!==Xt&&!n.pathname.startsWith(`${Xt}/`))return!1;let a=(r,o,s)=>(t.writeHead(r,{"content-type":o,"cache-control":"no-store","x-content-type-options":"nosniff","cross-origin-resource-policy":"same-origin"}),t.end(e.method==="HEAD"?void 0:s),!0);if(n.pathname===`${Xt}/settings`)return!i||!No(e)?a(403,"text/plain","\u5B57\u4F53\u8BBE\u7F6E\u4EC5\u9650\u672C\u673A\u76F4\u63A5\u8BBF\u95EE"):(async()=>{try{let r;if(e.method==="GET")r=Aa();else if(e.method==="POST"){if(!/^application\/json(?:;|$)/i.test(e.headers["content-type"]||""))return a(415,"text/plain","application/json required");let o=[],s=0;for await(let c of e){if(s+=c.length,s>8192)return a(413,"text/plain","\u5B57\u4F53\u8BBE\u7F6E\u8FC7\u5927");o.push(c)}r=Td(JSON.parse(Buffer.concat(o).toString("utf8")))}else return a(405,"text/plain","GET or POST required");return a(200,"application/json",JSON.stringify(r))}catch(r){return a(400,"text/plain",r.message)}})();if(!["GET","HEAD"].includes(e.method))return a(405,"text/plain","Method not allowed");try{let r=Ze();return r&&!No(e)?a(403,"text/plain","Local font access requires a direct loopback connection"):n.pathname===`${Xt}/manifest`?a(200,"application/json",JSON.stringify({id:r?.id??null,scope:vt.scope})):r&&n.pathname===`${Xt}/file/${r.id}`?a(200,r.type,r.data):a(404,"text/plain","Font not found")}catch{return a(500,"text/plain","Local font configuration failed; check QXQY_FONT_PATH and restart the host")}}var _a=Object.freeze({aqua:"00ffff",black:"000000",blue:"0000ff",brown:"a52a2a",cyan:"00ffff",darkblue:"0000a0",fuchsia:"ff00ff",green:"008000",grey:"808080",lightblue:"add8e6",lime:"00ff00",magenta:"ff00ff",maroon:"800000",navy:"000080",olive:"808000",orange:"ffa500",purple:"800080",red:"ff0000",silver:"c0c0c0",teal:"008080",white:"ffffff",yellow:"ffff00"});function Md(e){let t=Object.hasOwn(_a,e.toLowerCase())?_a[e.toLowerCase()]:e.slice(1);return!Object.hasOwn(_a,e.toLowerCase())&&!/^#[\da-f]{6}([\da-f]{2})?$/i.test(e)?null:(parseInt(t.slice(6)||"ff",16)<<24|parseInt(t.slice(0,6),16))>>>0}function Rd(e){let t=/^<\/(b|i|color|size)>$/i.exec(e);if(t)return{name:t[1].toLowerCase(),close:!0};let i=/^<(b|i)>$/i.exec(e);if(i)return{name:i[1].toLowerCase(),value:!0};let n=/^<(color|size)=(?:"([^"\s<>]+)"|'([^'\s<>]+)'|([^\s'"<>]+))>$/i.exec(e);if(!n)return null;let a=n[1].toLowerCase(),r=n[2]??n[3]??n[4];if(a==="color"){let s=Md(r);return s===null?null:{name:a,value:s}}let o=Number(r);return/^\d+$/.test(r)&&Number.isSafeInteger(o)&&o>0?{name:a,value:o}:null}function Go(e){let t=String(e??"").replace(/\r\n?/g,`
|
|
4
|
+
`),i=[],n=[],a=0;for(let c of t.matchAll(/<[^<>\r\n]*>/g)){c.index>a&&i.push({text:t.slice(a,c.index)});let l={text:c[0],tag:Rd(c[0]),paired:!1};i.push(l),a=c.index+c[0].length,l.tag&&(l.tag.close?n.at(-1)?.tag.name===l.tag.name?n.pop().paired=l.paired=!0:n.length=0:n.push(l))}a<t.length&&i.push({text:t.slice(a)});let r=[],o=[{bold:!1,italic:!1,size:null,color:null}],s=!1;for(let c of i)if(c.paired)if(s=!0,c.tag.close)o.pop();else{let l={b:"bold",i:"italic",size:"size",color:"color"}[c.tag.name];o.push({...o.at(-1),[l]:c.tag.value})}else if(c.text){let l=o.at(-1),d=r.at(-1);d&&["bold","italic","size","color"].every(f=>d[f]===l[f])?d.text+=c.text:r.push({text:c.text,...l})}return{rich:s,text:r.map(c=>c.text).join(""),runs:r}}function hn(e,t){return`${e.italic?"italic ":""}${e.bold?"bold ":""}${e.fontSize}px ${t}`}var St=Nd(1,1).getContext("2d"),Vo=new WeakMap,Bo=(e,t)=>Math.max(1,Math.trunc(Number.isFinite(Number(e))?Number(e):t));function Fd(e,t,i,n,a,r){let o=[],s=[],c=0,l=t,d=0,f=()=>{let v=s.length?s.reduce((N,O)=>Math.max(N,O.fontSize),0):l,y=v*1.2,w=s.length?s.reduce((N,O)=>Math.max(N,O.ascent),0):v*.8,_=s.length?s.reduce((N,O)=>Math.max(N,O.descent),0):v*.2,T=(y-w-_)/2+w;o.push({runs:s,width:c,top:d,height:y,baseline:T,fontSize:v}),d+=y,s=[],c=0};for(let v of e.runs){let y={fontSize:v.size??t,bold:v.bold,italic:v.italic,color:v.color};St.font=hn(y,n);let w=St.measureText("Mg"),_=w.fontBoundingBoxAscent??w.emHeightAscent??y.fontSize*.8,T=w.fontBoundingBoxDescent??w.emHeightDescent??y.fontSize*.2;l=y.fontSize;for(let N of v.text){if(N===`
|
|
5
|
+
`){f();continue}let O=s.at(-1),V=O&&["fontSize","bold","italic","color"].every(A=>O[A]===y[A]),$=St.measureText((V?O.text:"")+N).width,S=c+$-(V?O.width:0);s.length&&S>i&&(f(),O=null,$=St.measureText(N).width,S=$),O&&V?(O.text+=N,O.width=$):s.push({text:N,...y,x:c,width:$,ascent:_,descent:T}),c=S}}f();let h=o.map(v=>v.runs.map(y=>y.text).join("")),m=o.reduce((v,y)=>Math.max(v,y.fontSize),0),p=a==="textbox"&&e.text?m*.25+4:0,b=e.text?d+p:0;return{fontSize:t,lines:h,lineHeight:t*1.2,contentHeight:d,blockInset:p,requiredHeight:b,textWidth:i,fits:b<=r+1e-6&&o.every(v=>v.width<=i+1e-6),richLines:o}}function et(e,t,i){let n=String(e.text??"").replace(/\r\n?/g,`
|
|
6
|
+
`),a=Bo(e.fontSize,20),r=Math.min(a,Bo(e.minimumFontSize,10)),o=e.adaptiveFontSize===!0,s=Kt(),c=JSON.stringify([n,t,i,a,r,o,e.kind,e.showScrollBar,s]),l=Vo.get(e);if(l?.key===c)return l.value;let d=Go(n),f=(v,y)=>{if(d.rich)return Fd(d,v,y,s,e.kind,i);St.font=`${v}px ${s}`;let w=[];for(let $ of n.split(`
|
|
7
|
+
`)){let S="";for(let A of $)S&&St.measureText(S+A).width>y&&(w.push(S),S=""),S+=A;w.push(S)}let _=v*1.2,T=w.length*_,N=e.kind==="textbox"&&n?v*.25+4:0,O=n?T+N:0,V=O<=i+1e-6&&w.every($=>St.measureText($).width<=y+1e-6);return{fontSize:v,lines:w,lineHeight:_,contentHeight:T,blockInset:N,requiredHeight:O,textWidth:y,fits:V}},h=Math.max(0,t-4),m=f(a,h);if(o&&!m.fits&&r<a){m=f(r,h);let v=r+1,y=a-1;for(;v<=y;){let w=Math.floor((v+y)/2),_=f(w,h);_.fits?(m=_,v=w+1):y=w-1}}e.kind==="textwindow"&&e.showScrollBar!==!1&&m.contentHeight>i&&(m=f(m.fontSize,Math.max(0,h-12)));let p=m.lines.length,b=m.contentHeight;if(e.kind==="textbox"&&(p=0,b=0,m.lines.join(`
|
|
8
|
+
`)))for(let v=0;v<m.lines.length;v++){let y=m.richLines?.[v],w=y?y.top+y.height:(v+1)*m.lineHeight;if(w+m.blockInset>i+1e-6)break;p=v+1,b=w}return m={...m,visibleLineCount:p,visibleContentHeight:b},Vo.set(e,{key:c,value:m}),m}var mn=e=>Number.isFinite(Number(e))?Math.max(0,Number(e)):0;function xt(e,t){if(!e||e.kind!=="image"||e.enableMask!==!0||!t)return null;let i=mn(e.sourceWidth??e.width),n=mn(e.sourceHeight??e.height),a=e.enableSoftEdge===!0,r=e.softEdgeMode!=="Pixel",o=a?mn(e.softEdgeWidthX):0,s=a?mn(e.softEdgeWidthY):0;return{id:e.id,matrix:t,width:i,height:n,featherX:r?i*o/100:o,featherY:r?n*s/100:s}}function Et(e,t,i){let n=Ie(e,t,i);return{a:e.a,b:e.b,c:e.c,d:e.d,tx:n.x,ty:n.y}}function Ho(e,t,i){let n=(a,r)=>a<=0?0:!(r>0)||a>=r?1:a/r;return Math.min(n(e+i.width/2,i.featherX),n(i.width/2-e,i.featherX),n(t+i.height/2,i.featherY),n(i.height/2-t,i.featherY))}function Pa(e){let t={children:[]},i=[t],n=[];for(let a of e||[]){if(!a||a.id==null)continue;let r=a.masks||[],o=r.map(c=>JSON.stringify([c.id,c.matrix,c.width,c.height,c.featherX,c.featherY])),s=0;for(;s<n.length&&s<o.length&&n[s]===o[s];)s++;i.length=s+1;for(let c=s;c<r.length;c++){let l={mask:r[c],children:[]};i.at(-1).children.push(l),i.push(l)}i.at(-1).children.push({item:a}),n=o}return t.children}function Lo(e,t){let i=[];function n(a){t[a.id]&&i.push(t[a.id]);let r=a.children||[];for(let o=r.length-1;o>=0;o-=1)n(r[o])}return n(e),i}function lt(e,t,i=bt(t)){let n=ve(t),a={};function r(o,s,c,l=!0,d=[]){let f=yt(o.transformByPlatform,i),h=Ke(s,f),m=o.kind==="server-container"?c:wi(c,h,f),p=mo(h,m),b=l&&o.visible!==!1,v=o.kind==="image"&&o.enableMask===!0?xt({...o,width:h.width,height:h.height},Et(m,h.centerX,h.centerY)):null,y=v?[...d,v]:d;a[o.id]={...h,...da(h),id:o.id,kind:o.kind,name:o.name,visible:o.visible!==!1,visibleInHierarchy:b,active:o.active!==!1,rotationX:f.rotation.x,rotationY:f.rotation.y,rotationZ:f.rotation.z,renderLeft:p.left,renderBottom:p.bottom,renderWidth:p.width,renderHeight:p.height,renderRotationZ:p.rotationZ,renderMatrix:m,...y.length?{masks:y}:{},primitive:o.kind==="image"?Ht(o.imageId,o.imageSource):null,...["animation","fullscreen"].includes(o.kind)?{animationId:o.animationId??null,playSoundEffect:o.playSoundEffect!==!1,layer:o.layer||"AboveAllControls"}:{},...o.kind==="textbox"||o.kind==="textwindow"?{text:o.text??"",fontSize:o.fontSize,adaptiveFontSize:o.adaptiveFontSize===!0,minimumFontSize:o.minimumFontSize,textLayout:et(o,h.width,h.height),fontColor:o.fontColor,bgColor:o.bgColor,enableOutline:o.enableOutline!==!1,outlineColor:o.outlineColor,horizontalAlignment:o.horizontalAlignment,verticalAlignment:o.verticalAlignment}:{},...o.kind==="image"?{imageSource:o.imageSource,imageType:o.imageType??null,imageId:o.imageId,imageColor:o.imageColor,enableMask:o.enableMask===!0,enableSoftEdge:o.enableSoftEdge===!0,softEdgeMode:o.softEdgeMode,softEdgeWidthX:o.softEdgeWidthX,softEdgeWidthY:o.softEdgeWidthY,horizontalSoftRange:o.horizontalSoftRange,verticalSoftRange:o.verticalSoftRange,enableFill:o.enableFill===!0,fillType:o.fillType,fillHorizontalType:o.fillHorizontalType,fillVerticalType:o.fillVerticalType,fillRadial90Type:o.fillRadial90Type,fillRadialType:o.fillRadialType,fillAmount:o.fillAmount,reverseMaskArea:o.reverseMaskArea===!0}:{},...o.kind==="button"?{raycastTarget:o.raycastTarget!==!1,interactable:o.interactable!==!1,clickAudioId:o.clickAudioId,unavailableChildId:o.unavailableChildId??null,hoverChildId:o.hoverChildId??null,pressedChildId:o.pressedChildId??null,selectedChildId:o.selectedChildId??null}:{}};let w=o.kind==="server-container"?s:h;for(let _ of o.children||[])r(_,w,m,b,y)}return r(e,n,Ut()),{canvas:n,boxes:a}}function Ta(e,t){let i=[];function n(a,r,o=null,s=[],c=0,l=1,d=e.id){i.push({id:a.id,guid:t?.get(a.id)??(a.guid||0),kind:a.kind,name:a.name,label:Bt[a.kind]||a.kind,depth:r,parentId:o,ancestorIds:s,siblingIndex:c,siblingCount:l,templateId:d,childCount:(a.children||[]).length,incomplete:!rn.includes(a.kind)});let f=a.children||[];for(let h=0;h<f.length;h+=1)n(f[h],r+1,a.id,[...s,a.id],h,f.length,d)}return n(e,0),i}function R(e,t,i,n,a={}){return{key:e,label:t,type:i,value:n,...a}}function Uo(e,t,i,n){if(!e)return null;let a=ct(e.transformByPlatform,t),r=da(i),o=[R("name","\u540D\u79F0","string",e.name),R("active","\u521D\u59CB\u6FC0\u6D3B","bool",e.active!==!1),R("visible","\u521D\u59CB\u53EF\u89C1\u6027","bool",e.visible!==!1),R("canControllerFocus","\u53EF\u88AB\u624B\u67C4\u6447\u6746\u5BFC\u822A\u9009\u4E2D","bool",e.canControllerFocus===!0),R("posX","\u4F4D\u7F6E X","number",r.posX,{computed:!0}),R("posY","\u4F4D\u7F6E Y","number",r.posY,{computed:!0}),R("width","\u5927\u5C0F W","number",r.width,{computed:!0}),R("height","\u5927\u5C0F H","number",r.height,{computed:!0}),R("rotationX","\u65CB\u8F6C X","number",a.rotation.x),R("rotationY","\u65CB\u8F6C Y","number",a.rotation.y),R("rotationZ","\u65CB\u8F6C Z","number",a.rotation.z),R("syncAllDevices","\u540C\u6B65\u4FE1\u606F\u81F3\u6240\u6709\u8BBE\u5907","bool",e.syncAllDevices!==!1),R("anchorType","\u951A\u70B9\u7C7B\u578B","enum",bo(a),{options:[{value:"center",label:"\u5C45\u4E2D"},{value:"top-left",label:"\u5DE6\u4E0A"},{value:"top",label:"\u4E0A\u65B9"},{value:"top-right",label:"\u53F3\u4E0A"},{value:"left",label:"\u5DE6\u4FA7"},{value:"right",label:"\u53F3\u4FA7"},{value:"bottom-left",label:"\u5DE6\u4E0B"},{value:"bottom",label:"\u4E0B\u65B9"},{value:"bottom-right",label:"\u53F3\u4E0B"},{value:"stretch",label:"\u53CC\u5411\u62C9\u4F38"},{value:"stretch-horizontal",label:"\u6C34\u5E73\u62C9\u4F38"},{value:"stretch-vertical",label:"\u5782\u76F4\u62C9\u4F38"},{value:"custom",label:"\u81EA\u5B9A\u4E49"}]}),R("anchorMinX","\u951A\u70B9 Min X","number",a.anchorMin.x),R("anchorMinY","\u951A\u70B9 Min Y","number",a.anchorMin.y),R("anchorMaxX","\u951A\u70B9 Max X","number",a.anchorMax.x),R("anchorMaxY","\u951A\u70B9 Max Y","number",a.anchorMax.y),R("pivotX","\u4E2D\u5FC3 X","number",a.pivot.x),R("pivotY","\u4E2D\u5FC3 Y","number",a.pivot.y)];if(e.kind==="container"&&o.push(R("isolateNavigation","\u9694\u79BB\u624B\u67C4\u5BFC\u822A","bool",e.isolateNavigation===!0),R("disableKeyEventPassthrough","\u5C4F\u853D\u6309\u952E\u4E8B\u4EF6\u7A7F\u900F","bool",e.disableKeyEventPassthrough===!0),R("disableCursorEventPassthrough","\u5C4F\u853D\u533A\u57DF\u5185\u70B9\u51FB\u4E8B\u4EF6\u7A7F\u900F","bool",e.disableCursorEventPassthrough===!0),R("showCursor","\u663E\u793A\u5E38\u9A7B\u5149\u6807","bool",e.showCursor===!0)),e.kind==="textbox"||e.kind==="textwindow"){let s=e.giaRaw?.textAlign,c=[0,1,2].includes(s)?e.horizontalAlignment||"Left":`__unrecognized:${s}`;o.push(R("fontSize","\u5B57\u53F7","number",e.fontSize),R("adaptiveFontSize","\u5B57\u53F7\u81EA\u9002\u5E94","bool",e.adaptiveFontSize===!0),R("minimumFontSize","\u6700\u5C0F\u5B57\u53F7","number",e.minimumFontSize),R("fontColor","\u6587\u672C\u8272","color",e.fontColor),R("bgColor","\u80CC\u666F\u8272","color",e.bgColor),R("enableOutline","\u542F\u7528\u63CF\u8FB9","bool",e.enableOutline!==!1),R("outlineColor","\u63CF\u8FB9\u8272","color",e.outlineColor),R("horizontalAlignment","\u6C34\u5E73\u5BF9\u9F50","enum",c,{...[0,1,2].includes(s)?{}:{unknownValue:s},options:[{value:"Left",label:"\u5DE6\u5BF9\u9F50"},{value:"Middle",label:"\u5C45\u4E2D"},{value:"Right",label:"\u53F3\u5BF9\u9F50"}]}),R("verticalAlignment","\u5782\u76F4\u5BF9\u9F50","enum",e.verticalAlignment||"Top",{options:[{value:"Top",label:"\u9876\u90E8"},{value:"Middle",label:"\u5C45\u4E2D"},{value:"Bottom",label:"\u5E95\u90E8"}]}),R("text","\u6587\u672C","text",e.text??""))}if(e.kind==="image"){let s=e.giaRaw?.imageFillType,c=[1,2,3,4,5].includes(s)?e.fillType:`__unrecognized:${s}`;o.push(R("imageSource","\u56FE\u7247\u6E90","enum",e.imageSource,{options:[{value:"StaticReference",label:"\u9759\u6001\u5F15\u7528"},{value:"Prefab",label:"\u5143\u4EF6"}]}),R("imageId","imageId","number",e.imageId??0),R("imageType","\u56FE\u7247\u7C7B\u578B","enum",e.imageType??null,{options:[{value:"Basic",label:"\u57FA\u7840"},{value:"Stretch",label:"\u62C9\u4F38"}]}),R("imageColor","\u586B\u5145\u8272","color",e.imageColor),R("enableMask","\u5F00\u542F\u906E\u7F69","bool",e.enableMask===!0),R("enableSoftEdge","\u8FB9\u7F18\u7FBD\u5316","bool",e.enableSoftEdge===!0,{gia:"W"}),R("softEdgeMode","\u7FBD\u5316\u6A21\u5F0F","enum",e.softEdgeMode,{options:[{value:"Percentage",label:"\u767E\u5206\u6BD4"},{value:"Pixel",label:"\u50CF\u7D20"}]}),R("softEdgeWidthX","\u7FBD\u5316\u5BBD\u5EA6 X","number",e.softEdgeWidthX),R("softEdgeWidthY","\u7FBD\u5316\u5BBD\u5EA6 Y","number",e.softEdgeWidthY),R("horizontalSoftRange","\u6C34\u5E73\u7FBD\u5316\u8303\u56F4","number",e.horizontalSoftRange),R("verticalSoftRange","\u5782\u76F4\u7FBD\u5316\u8303\u56F4","number",e.verticalSoftRange),R("enableFill","\u6309\u8FDB\u5EA6\u586B\u5145","bool",e.enableFill===!0,{gia:"W"}),R("fillType","\u5F62\u72B6","enum",c,{...[1,2,3,4,5].includes(s)?{}:{unknownValue:s},options:[{value:"Horizontal",label:"\u6A2A\u5411"},{value:"Vertical",label:"\u7EB5\u5411"},{value:"Radial90",label:"90\u5EA6\u73AF\u7ED5"},{value:"Radial180",label:"180\u5EA6\u73AF\u7ED5"},{value:"Radial360",label:"360\u5EA6\u73AF\u7ED5"}]}),R("fillHorizontalType","\u65B9\u5411","enum",e.fillHorizontalType,{options:[{value:"Left",label:"\u4ECE\u5DE6\u81F3\u53F3"},{value:"Right",label:"\u4ECE\u53F3\u81F3\u5DE6"}]}),R("fillVerticalType","\u65B9\u5411","enum",e.fillVerticalType,{options:[{value:"Bottom",label:"\u4ECE\u4E0B\u81F3\u4E0A"},{value:"Top",label:"\u4ECE\u4E0A\u81F3\u4E0B"}]}),R("fillRadial90Type","\u8D77\u70B9","enum",e.fillRadial90Type,{options:[{value:"BottomLeft",label:"\u5DE6\u4E0B"},{value:"TopLeft",label:"\u5DE6\u4E0A"},{value:"TopRight",label:"\u53F3\u4E0A"},{value:"BottomRight",label:"\u53F3\u4E0B"}]}),R("fillRadialType","\u8D77\u70B9","enum",e.fillRadialType,{options:[{value:"Bottom",label:"\u4E0B\u65B9"},{value:"Left",label:"\u5DE6\u4FA7"},{value:"Top",label:"\u4E0A\u65B9"},{value:"Right",label:"\u53F3\u4FA7"}]}),R("fillAmount","\u8FDB\u5EA6","percent",e.fillAmount),R("reverseMaskArea","\u906E\u7F69\u533A\u57DF\u53CD\u8F6C","bool",e.reverseMaskArea===!0,{gia:"W"}))}if(e.kind==="button"){let s=[{value:"",label:"\u672A\u8BBE\u7F6E"},...(e.children||[]).map(c=>({value:c.id,label:`${c.name} \xB7 ${c.id}`}))];o.push(R("raycastTarget","\u53EF\u88AB\u5149\u6807\u5C04\u7EBF\u68C0\u6D4B","bool",e.raycastTarget!==!1),R("interactable","\u6309\u94AE\u662F\u5426\u53EF\u7528","bool",e.interactable!==!1),R("unavailableChildId","\u4E0D\u53EF\u7528\u72B6\u6001\u8282\u70B9","node",e.unavailableChildId,{options:s,gia:"W"}),R("hoverChildId","\u60AC\u505C\u72B6\u6001\u8282\u70B9","node",e.hoverChildId,{options:s,gia:"W"}),R("pressedChildId","\u6309\u4E0B\u72B6\u6001\u8282\u70B9","node",e.pressedChildId,{options:s,gia:"W"}),R("selectedChildId","\u9009\u4E2D\u72B6\u6001\u8282\u70B9","node",e.selectedChildId,{options:s,gia:"W"}),R("clickAudioId","\u70B9\u51FB\u97F3\u6548","number",e.clickAudioId))}return e.kind==="reference"&&o.push(R("referencedPrefabId","\u5F15\u7528\u63A7\u4EF6\u6A21\u677F\u7D22\u5F15","string",e.referencedPrefabId??"")),(e.kind==="textwindow"||e.kind==="grid")&&o.push(R("interactable","\u5141\u8BB8\u6EDA\u52A8\u4EA4\u4E92","bool",e.interactable!==!1),R("showScrollBar","\u663E\u793A\u6EDA\u52A8\u6761","bool",e.showScrollBar!==!1)),e.kind==="grid"&&o.push(R("itemPrefabId","\u5217\u8868\u9879\u6A21\u677F\u7D22\u5F15","number",e.itemPrefabId??0),R("raycastTarget","\u53EF\u88AB\u5149\u6807\u5C04\u7EBF\u68C0\u6D4B","bool",e.raycastTarget!==!1),R("scrollDirection","\u6EDA\u52A8\u65B9\u5411","enum",e.scrollDirection,{options:[{value:"Vertical",label:"\u7EB5\u5411"},{value:"Horizontal",label:"\u6A2A\u5411"}]}),R("layoutConstraint","\u6392\u5217\u9650\u5236","enum",e.layoutConstraint,{options:[{value:"AutoWrap",label:"\u81EA\u52A8\u6362\u884C"},{value:"Fixed",label:"\u56FA\u5B9A\u884C\u5217\u6570"}]}),R("layoutConstraintFixedCount","\u6BCF\u884C\u6216\u6BCF\u5217\u6570\u91CF","number",e.layoutConstraintFixedCount??1),R("cellSizeX","\u5217\u8868\u9879\u5927\u5C0F W","number",e.cellSizeX,{evidence:"W"}),R("cellSizeY","\u5217\u8868\u9879\u5927\u5C0F H","number",e.cellSizeY,{evidence:"W"}),R("spacingX","\u5217\u8868\u9879\u95F4\u9694 X","number",e.spacingX,{evidence:"W"}),R("spacingY","\u5217\u8868\u9879\u95F4\u9694 Y","number",e.spacingY,{evidence:"W"}),R("padding1X","\u8FB9\u8DDD\u5411\u91CF 1 X","number",e.padding1X,{evidence:"W"}),R("padding1Y","\u8FB9\u8DDD\u5411\u91CF 1 Y","number",e.padding1Y,{evidence:"W"}),R("padding2X","\u8FB9\u8DDD\u5411\u91CF 2 X","number",e.padding2X,{evidence:"W"}),R("padding2Y","\u8FB9\u8DDD\u5411\u91CF 2 Y","number",e.padding2Y,{evidence:"W"}),R("previewCount","\u9884\u89C8\u6570\u91CF","number",e.previewCount)),e.kind==="keyhint"&&o.push(R("keyboardKeyCode","\u952E\u9F20\u6309\u952E","number",e.keyboardKeyCode??e.giaRaw?.keyHintField502??1,{gia:"W"}),R("controllerKeyCode","\u624B\u67C4\u6309\u952E","number",e.controllerKeyCode??e.giaRaw?.keyHintField501??1)),(e.kind==="animation"||e.kind==="fullscreen")&&(o.push(R("animationId",e.kind==="animation"?"\u52A8\u6548\u7D22\u5F15":"\u5168\u5C4F\u52A8\u6548\u7D22\u5F15","string",e.animationId??"")),o.push(R("playSoundEffect","\u64AD\u653E\u52A8\u6548\u97F3\u6548","bool",e.playSoundEffect!==!1)),e.kind==="animation"&&o.push(R("layer","\u52A8\u6548\u5C42\u7EA7","enum",e.layer||"AboveAllControls",{options:[{value:"AboveAllControls",label:"\u6240\u6709\u63A7\u4EF6\u4E4B\u4E0A"},{value:"BelowAllControls",label:"\u6240\u6709\u63A7\u4EF6\u4E4B\u4E0B"}]}))),(!rn.includes(e.kind)||e.kind==="textwindow"||e.kind==="grid")&&o.push(R("incomplete","\u5B8C\u6574\u5EA6","note",e.kind==="textwindow"||e.kind==="grid"?"\u8BD5\u73A9\u652F\u6301\u57FA\u7840\u6EDA\u52A8\uFF1B\u6EDA\u52A8\u4EA4\u4E92\u3001\u6EDA\u52A8\u6761\u53CA\u5217\u8868\u914D\u7F6E\u4EE5 JSON/Lua \u4E3A\u51C6\uFF0C\u76F8\u5173 GIA \u5F00\u5173\u6620\u5C04\u5C1A\u672A\u6838\u5B9E\u3002":["animation","fullscreen"].includes(e.kind)?"\u652F\u6301\u6D4F\u89C8\u5668\u52A8\u6548\u64AD\u653E\uFF1B\u975E\u7A7A\u52A8\u6548 GIA \u914D\u7F6E\u5C1A\u672A\u6838\u5B9E\u3002":"\u672C\u9636\u6BB5\u4EC5\u516C\u5171\u53D8\u6362\uFF0C\u4E1A\u52A1\u69FD\u4E0D\u5B8C\u6574")),{id:e.id,guid:n?.get(e.id)??(e.guid||0),kind:e.kind,label:Bt[e.kind]||e.kind,incomplete:!rn.includes(e.kind),fields:o}}function jo(e,t,i){let n=(Array.isArray(e)?e:Object.values(e)).filter(a=>a.kind!=="server-container");for(let a=n.length-1;a>=0;a-=1){let r=n[a];if(!r.visible||r.visibleInHierarchy===!1||!r.active)continue;let o=r.renderMatrix&&qe(r.renderMatrix),s=o&&Ie(o,t,i);if(s&&s.x>=r.left&&s.x<=r.right&&s.y>=r.bottom&&s.y<=r.top)return r.id}return null}import Od from"protobufjs";function qt(e,t=!1){let i=[],n=(a,r)=>{a.kind!=="server-container"&&i.push({node:a,parent:r});let o=t&&a.kind!=="server-container"?[...a.children||[]].reverse():a.children||[];for(let s of o)n(s,a)};return n(e.root,null),i}var $d=String.raw`
|
|
6
9
|
syntax = "proto3";
|
|
7
10
|
// Root.graph is singular in the game's canonical schema, but template-list
|
|
8
11
|
// assets legally emit field 1 more than once. Model it as repeated here so
|
|
@@ -103,20 +106,20 @@ message ImageConfig {
|
|
|
103
106
|
message SliceVector { float field501 = 501; float field502 = 502; }
|
|
104
107
|
}
|
|
105
108
|
message FooterSlot { int32 field505 = 505; }
|
|
106
|
-
`,{root:su}=ou.parse(au,{keepCase:!1}),Fe=su.lookupType("Root"),lt=20,vn=4,Ca=806,ka=1657,bi={image:23,"server-container":24,container:25,grid:26,reference:27,button:28,animation:29,fullscreen:30,textbox:31,textwindow:32,cursor:33,keyhint:34},Ea={KEYBOARD:0,TOUCHSCREEN:1,CONTROLLER_CONSOLE:2,CONTROLLER_MOBILE:3},lu="server-control-template",or="client-control-template";function nr(e,t){let i=Number(e);return Number.isFinite(i)?i:t}var cu=Object.fromEntries(Object.entries(Ea).map(([e,t])=>[t,e])),Aa=Object.freeze({container:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["68/91","empty78","containerNodeSlot"],["67/90","empty77","footerSlot"]],textbox:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["64/84","empty74","textConfig"],["67/90","empty77","footerSlot"]],cursor:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["65/85","empty75","cursorConfig"],["67/90","empty77","footerSlot"]],reference:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["66/89","empty76","templateRefSlot"],["67/90","empty77","footerSlot"]],grid:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["69/92","empty79","gridView"],["67/90","empty77","footerSlot"]],button:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["70/93","empty80","buttonPreset"],["67/90","empty77","footerSlot"]],textwindow:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["71/94","empty81","textConfig"],["67/90","empty77","footerSlot"]],keyhint:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["72/95","empty82","keyHint"],["67/90","empty77","footerSlot"]],image:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["73/96","empty83","imageSlot"],["74/97","empty84","image"],["67/90","empty77","footerSlot"]],animation:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["75/98","empty85","effectSlot"],["67/90","empty77","footerSlot"]],fullscreen:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["76/99","empty86","fullscreenEffectSlot"],["67/90","empty77","footerSlot"]]}),_a=Object.freeze({"4/23":5,"4/86":5,"1/12":4,"62/82":64,"63/83":65,"64/84":66,"65/85":67,"66/89":68,"67/90":69,"68/91":70,"69/92":71,"70/93":72,"71/94":66,"72/95":74,"73/96":75,"74/97":76,"75/98":77,"76/99":78}),uu=Object.freeze([["2/15","name",null],["4/23","field14","field14"],["1/12","transform","transform"],["62/82","empty72","rootChildRef"]]);function wn(e){return{class:1,type:8,id:e}}function vi(e,t,i,r){return{...r,field501:t,field502:i,field503:1,nodeRef:wn(e)}}function fu(e){let t=[],i=e.meta?.assetType==="client-control-template";return te(e.root,r=>{i&&r.kind==="server-container"||t.push(r)}),t}function wi(e,t=new Set){let i=new Map,r=[];for(let n of fu(e)){let o=Number(n.guid);Ne(o)&&!t.has(o)?(t.add(o),n.guid=o,i.set(n.id,o)):r.push(n)}for(let n of r){let o=nt(t);t.add(o),n.guid=o,i.set(n.id,o)}return i}function du(e){return{scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z},anchorMin:{x:e.anchorMin.x,y:e.anchorMin.y},anchorMax:{x:e.anchorMax.x,y:e.anchorMax.y},offset:{x:e.offset.x,y:e.offset.y},size:{x:e.size.x,y:e.size.y},pivot:{x:e.pivot.x,y:e.pivot.y},field508:Object.fromEntries(Object.entries(e.rotation).filter(([,t])=>t!==0))}}function hu(e,t){let r={multiPlatform:{platforms:ue.map(n=>({platformType:Ea[n],transform:du(e.transformByPlatform[n])})),field502:bi[e.kind]||25,...e.syncAllDevices===!1?{}:{field504:1}},type:2};return{transform:{multiPlatform:{},type:2},field501:1,field502:12,details:vi(t,4,12,{transform:r})}}function pu(e,t,i){let r=i?{empty15:"",field501:5}:{field17:{},field501:7},n=i?r:{...r,...e.visible===!1?{field17:{initiallyHidden:!0}}:{},...e.active===!1?{initiallyInactive:!0}:{}};return[{name:{value:e.name},field501:2,field502:15},{field14:r,field501:4,field502:i?23:86,details:vi(t,5,i?23:86,{field14:n})},hu(e,t)]}function mu(e,t,i,r){let n=(l,u,f,h,p)=>({[f]:"",field501:l,field502:u,details:vi(t,l+2,u,{[h]:p})}),o=e.giaRaw||{},a=Array.isArray(e.scriptMappingIds)&&e.scriptMappingIds.length?{field501:o.genericField501||1,field502:e.scriptMappingIds.map(l=>({field1:{id:Number(l)}}))}:{field501:o.genericField501??0},s=n(63,83,"empty73","genericSlot",a),c=n(67,90,"empty77","footerSlot",{field505:[void 0,0,1].includes(o.footerField505)?e.canControllerFocus?1:0:o.footerField505});if(e.kind==="container")return[s,n(68,91,"empty78","containerNodeSlot",{...e.isolateNavigation?{isolateNavigation:!0}:{},...e.disableKeyEventPassthrough?{disableKeyEventPassthrough:!0}:{},...e.disableCursorEventPassthrough?{disableCursorEventPassthrough:!0}:{},...e.showCursor?{showCursor:!0}:{}}),c];if(e.kind==="textbox"||e.kind==="textwindow"){e.verticalAlignment==="Middle"&&r.push(`${e.name}: \u5782\u76F4\u5C45\u4E2D\u6309\u63A8\u5B9A\u503C\u5BFC\u51FA\uFF0C\u5C1A\u5F85\u5B9E\u673A\u786E\u8BA4\u3002`);let l={Left:0,Middle:1,Right:2}[e.horizontalAlignment]??0,u=Number.isFinite(o.textAlign)?Math.trunc(o.textAlign):l,f={field501:o.textField501??20,field503:o.textField503??12,color:e.fontColor>>>0,color2:e.bgColor>>>0,color3:e.outlineColor>>>0,text:{value:e.text||""},fontSize:Math.trunc(e.fontSize),minimumFontSize:Math.trunc(e.minimumFontSize),...e.adaptiveFontSize?{adaptive:1}:{},...e.enableOutline===!1?{outlineOff:1}:{},...u?{align:u}:{},verticalAlign:o.textVerticalAlign??{Top:0,Middle:1,Bottom:2}[e.verticalAlignment]??0};return e.kind==="textwindow"?((e.interactable===!1||e.showScrollBar===!1)&&r.push(`${e.name}: \u6587\u672C\u89C6\u7A97\u4EA4\u4E92/\u6EDA\u52A8\u6761\u5F00\u5173\u4EC5\u4FDD\u5B58\u5728 JSON\uFF0CGIA \u672A\u6620\u5C04\u8FD9\u4E9B\u6539\u52A8\u3002`),f.field511=o.textField511??1,f.viewFlags={field502:o.textViewField502??1,field503:o.textViewField503??1},[s,{empty81:"",field501:71,field502:94,details:vi(t,66,94,{textConfig:f})},c]):[s,n(64,84,"empty74","textConfig",f),c]}if(e.kind==="image"){let l=[0,1].includes(o.imageSlotType??0)?e.imageType==="Stretch"?1:0:o.imageSlotType;e.imageType==null&&e.imageSource==="StaticReference"&&e.imageId>100006&&r.push(`${e.name}: \u56FE\u7247\u7C7B\u578B\u968F\u7D20\u6750\u8FB9\u754C\u81EA\u52A8\u9009\u62E9\uFF0CGIA \u6309\u57FA\u7840\u5BFC\u51FA\uFF1B\u9700\u8981\u62C9\u4F38\u8BF7\u5148\u660E\u786E\u9009\u62E9\u6216\u5728 Lua \u8BBE\u7F6E imageType\u3002`),e.imageSource&&e.imageSource!=="StaticReference"&&r.push(`${e.name}: \u56FE\u7247\u6765\u6E90 ${e.imageSource} \u4EC5\u4FDD\u5B58\u5728 JSON\uFF0C\u5C1A\u672A\u6620\u5C04\u5230 GIA\uFF1B\u8BF7\u5728 Lua \u4E2D\u7528 SetImage(Enum.ImageSource.${e.imageSource}, ${e.imageId}) \u8BBE\u7F6E\u3002`);let u={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[e.fillType],f=Number.isFinite(o.imageFillType)?Math.trunc(o.imageFillType):u||1;e.enableFill&&!f&&r.push(`${e.name}: \u586B\u5145\u5F62\u72B6\u539F\u59CB\u679A\u4E3E\u4E3A 0\uFF0C\u5DF2\u5173\u95ED\u5BFC\u51FA\u6587\u4EF6\u4E2D\u7684\u8FDB\u5EA6\u586B\u5145\u3002`),e.fillType==="Horizontal"&&e.fillHorizontalType!=="Left"&&r.push(`${e.name}: \u5F53\u524D\u6A2A\u5411\u586B\u5145\u65B9\u5411\u6682\u4E0D\u652F\u6301\u5199\u5165 GIA\u3002`),e.fillType==="Radial180"&&e.fillRadialType!=="Bottom"&&r.push(`${e.name}: \u5F53\u524D 180 \u5EA6\u586B\u5145\u8D77\u70B9\u6682\u4E0D\u652F\u6301\u5199\u5165 GIA\u3002`);let h={field502:o.imageField502??1,field504:o.imageField504??1,field505:o.imageField505??1,field507:o.imageField507??2,field508:Math.round(Math.max(0,Math.min(1,Number(e.fillAmount)||0))*100),border:{field501:nr(e.softEdgeWidthX,8),field502:nr(e.softEdgeWidthY,8)},field512:nr(e.horizontalSoftRange,85),field513:nr(e.verticalSoftRange,85),fillType:f,...e.enableMask?{enableMask:1}:{},...e.enableSoftEdge?{enableSoftEdge:1}:{},...e.softEdgeMode==="Pixel"?{softEdgePixel:1}:{},...e.enableFill&&f?{enableFill:1}:{},...e.reverseMaskArea?{reverseMask:1}:{}};return[s,n(73,96,"empty83","imageSlot",{field502:Number.isFinite(e.imageColor)?e.imageColor>>>0:4294967295,assetId:e.imageId>>>0,...l?{imageType:l}:{}}),n(74,97,"empty84","image",h),c]}if(e.kind==="button"){let l=(m,y)=>{let I=e[m];return I?(e.children||[]).some(b=>b.id===I)?i.get(I)||0:(r.push(`${e.name}: ${y}\u72B6\u6001\u8282\u70B9\u4E0D\u662F\u6309\u94AE\u7684\u76F4\u63A5\u5B50\u63A7\u4EF6\uFF0CGIA \u672A\u5199\u5165\u8BE5\u72B6\u6001\u3002`),0):0},u=l("unavailableChildId","\u4E0D\u53EF\u7528"),f=l("hoverChildId","\u60AC\u505C"),h=l("pressedChildId","\u6309\u4E0B"),p=l("selectedChildId","\u9009\u4E2D");return[s,n(70,93,"empty80","buttonPreset",{clickAudioId:Math.trunc(e.clickAudioId),...u?{disabledChild:u}:{},...f?{hoverChild:f}:{},...h?{pressedChild:h}:{},...p?{selectedChild:p}:{},...e.interactable?{interactable:1}:{},...e.raycastTarget?{raycastTarget:1}:{}}),c]}if(e.kind==="cursor")return[s,n(65,85,"empty75","cursorConfig",{field501:[void 0,0,1].includes(o.cursorField501)?e.raycastTarget!==!1?1:0:o.cursorField501}),c];if(e.kind==="reference"){let l=o.templateRefSlotBase64;(l||o.templateRefOuterBase64)&&r.push(`${e.name}: \u6A21\u677F\u5F15\u7528\u7684\u975E\u7A7A\u4E8C\u8FDB\u5236\u914D\u7F6E\u5C1A\u672A\u89E3\u6790\uFF0C\u5DF2\u539F\u6837\u4FDD\u7559\uFF1B\u4E0D\u4F1A\u81EA\u52A8\u5C55\u5F00\u88AB\u5F15\u7528\u6A21\u677F\u3002`);let u=n(66,89,"empty76","templateRefSlot",l?Buffer.from(l,"base64"):Buffer.from(o.templateRefSlot??"","utf8"));return u.empty76=Buffer.from(o.templateRefOuterBase64||"","base64"),[s,u,c]}return e.kind==="grid"?((e.itemPrefabId||e.interactable===!1||e.showScrollBar===!1||e.raycastTarget===!1||e.scrollDirection!=="Vertical"||e.layoutConstraint!=="AutoWrap")&&r.push(`${e.name}: \u7F51\u683C\u5217\u8868\u9879\u6A21\u677F\u3001\u4EA4\u4E92/\u6EDA\u52A8\u6761\u5F00\u5173\u3001\u6EDA\u52A8\u65B9\u5411\u53CA\u6392\u5217\u9650\u5236\u4EC5\u4FDD\u5B58\u5728 JSON\uFF0CGIA \u672A\u6620\u5C04\u8FD9\u4E9B\u6539\u52A8\u3002`),[s,n(69,92,"empty79","gridView",{field501:o.gridField501??1,cellSize:{field501:e.cellSizeX,field502:e.cellSizeY},gap:{field501:e.spacingX,field502:e.spacingY},padding1:{field501:e.padding1X,field502:e.padding1Y},padding2:{field501:e.padding2X,field502:e.padding2Y},field507:o.gridField507??1,field508:o.gridField508??1,field509:o.gridField509??1,field511:o.gridField511??5,field512:o.gridField512??1}),c]):e.kind==="keyhint"?[s,n(72,95,"empty82","keyHint",{field501:Number.isFinite(o.keyHintField501)?Math.trunc(o.keyHintField501):e.controllerKeyCode??1,field502:Number.isFinite(o.keyHintField502)?Math.trunc(o.keyHintField502):e.keyboardKeyCode??1}),c]:e.kind==="animation"?[s,n(75,98,"empty85","effectSlot",o.effectSlot??""),c]:e.kind==="fullscreen"?[s,n(76,99,"empty86","fullscreenEffectSlot",o.fullscreenEffectSlot??""),c]:(r.push(`${e.name}: ${e.kind} \u4E0D\u662F\u5DF2\u77E5 GIA \u63A7\u4EF6\u7C7B\u578B\uFF0C\u5DF2\u4EC5\u5199\u516C\u5171\u53D8\u6362\u3002`),[s,c])}function gu(e,t){if(t)return 1;if(!_e(e.giaInfoIndex))throw new Error(`${e.name}: \u7F3A\u5C11\u5408\u6CD5\u7684\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7`);return e.giaInfoIndex}function yu(e,t,i){let r=Array.isArray(e.giaRelatedGuids)?e.giaRelatedGuids.filter(n=>Number.isSafeInteger(n)&&n>0&&n<=2147483647):[];return r.length?r:(t.push(`${e.name}: \u65B0${i}\u5199\u5165\u663E\u5F0F\u7A7A Info.related\uFF0C\u907F\u514D\u8DE8\u6C99\u7BB1\u590D\u7528\u4F34\u751F\u8D44\u6E90 GUID \u4EA7\u751F\u65E0\u6CD5\u52A0\u8F7D\u7684\u7D22\u5F15\u3002`),[])}function Sn(e,t){let i=String(e.meta?.giaFilePath||"").trim();if(/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i))return i;let r=(l,u)=>Number.isSafeInteger(Number(l))&&Number(l)>0?Number(l):u,n=r(e.meta?.giaOwnerUid,114514),o=r(e.meta?.giaTimestamp,Math.floor(Date.now()/1e3)),a=r(e.meta?.giaFileId,t?1073741829:1073741830),s=t?"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868.gia":"\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F-\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668.gia",c=String(e.meta?.giaFileName||s).replace(/[\\/:*?"<>|]/gu,"-").replace(/\.gia$/iu,"").trim()||s.replace(/\.gia$/iu,"");return`${n}-${o}-${a}-\\${c}.gia`}function ar(e,t,i,r,n,o=!1,a=!1,s=a,c=!1){let l=i.get(e.id),f=(c?[...e.children||[]].reverse():e.children||[]).map(m=>i.get(m.id)),h=o?r:f,p=pu(e,l,o);if(o){let m=e.children?.[0];m&&p.push({empty72:"",field501:62,field502:82,details:vi(l,64,82,{rootChildRef:{guid:i.get(m.id)}})})}else p.push(...mu(e,l,i,n));return{id:wn(l),relatedIds:h.map(m=>wn(m)),name:e.name,which:o?21:a?70:15,ui:{content:{guid:l,info:[{guid:{value:l},field501:1,field502:5},...o||s?[{index:{value:gu(e,o)},field501:2,field502:6}]:[],...o||a?[{related:{value:yu(e,n,o?"\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F")},field501:4,field502:4}]:[]],children:o?[]:f,parent:t&&t.kind!=="server-container"?i.get(t.id):0,data:p}}}}function bu(e,t){let i=new Map;for(let r of e||[]){if(!r.controlId||!(t===or?r.controlAsset===or:r.controlAsset!==or))continue;let o=i.get(r.controlId)||[];o.push(r.guid),i.set(r.controlId,o)}return i}function Pa(e,t,i,r){let n=bu(t,i),o=new Map;te(e.root,a=>{n.has(a.id)&&(o.set(a,a.scriptMappingIds),a.scriptMappingIds=n.get(a.id))});try{return r()}finally{for(let[a,s]of o)s===void 0?delete a.scriptMappingIds:a.scriptMappingIds=s}}function xn(e){let t=Number(e.meta?.giaModeFlag);return Number.isSafeInteger(t)&&t>=0?{modeFlag:t}:{}}function In(e){let t=e.meta?.gameVersion;return!t||t==="7.0.50"?Wi:t}function Ta(e,t,i,r,n=[]){let o=Lt(e,!0),a=o.filter(({parent:u})=>u?.kind==="server-container");if(!a.length)throw new Error("\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868\u81F3\u5C11\u9700\u8981\u4E00\u4E2A\u6A21\u677F");let s=new Set(a.map(({node:u})=>u.id)),c=o.filter(({node:u})=>!s.has(u.id)),l=o.map(({node:u})=>t.get(u.id));return Pa(e,n,or,()=>({graph:a.map(({node:u,parent:f})=>ar(u,f,t,l,i,!1,!0,!0,!0)),accessories:c.map(({node:u,parent:f})=>ar(u,f,t,l,i,!1,!1,!0,!0)),filePath:r||Sn(e,!0),gameVersion:In(e),...xn(e)}))}function Ra(e,t,i,r,n){let o=Lt(e),a=[o[0],...o.slice(1).reverse()],s=a.map(({node:c})=>t.get(c.id));return Pa(e,i.scripts,lu,()=>({graph:[ar(e.root,null,t,s,r,!0,!1,!1,!0),...i.units||[]],accessories:a.map(({node:c,parent:l})=>ar(c,l,t,s,r,!1,!1,!1,!0)),filePath:n||Sn(e,!1),gameVersion:In(e),...xn(e)}))}function Ma(e,t){let i=Cn(e),r=t(i);if(!r.valid)throw new Error(`GIA compatibility validation failed:
|
|
107
|
-
${r.errors.join(`
|
|
108
|
-
`)}`);return i}function Na(e,t={}){te(e.root,yt);let i=[];We(e,{warnings:i});let r=wi(L(e)),n=e.meta?.assetType==="client-control-template",o;if(n)o=Ta(e,r,i,void 0,t.scripts||[]);else{let s=kn(t.scripts||[],new Set(r.values()));i.push(...s.warnings),o=Ra(e,r,s,i)}return{buffer:Ma(o,n?An:_n),warnings:[...new Set(i)]}}function Fa(e,t,i={}){te(e.root,yt),t&&te(t.root,yt);let r=["\u6574\u5408\u5305\u628A\u670D\u52A1\u7AEF UIControlGroup \u4E0E\u5BA2\u6237\u7AEF UIControlTemplate \u5E76\u6392\u5199\u5165\u540C\u4E00 GIA \u7684 Root.graph\uFF1B\u5BFC\u5165\u65F6\u62C6\u56DE\u4E24\u7C7B\u8D44\u4EA7\uFF0C\u6A21\u677F\u8FB9\u754C\u3001\u811A\u672C\u6620\u5C04\u4E0E\u63A7\u4EF6\u6302\u8F7D\u5173\u7CFB\u4F1A\u4FDD\u7559\u3002"];t&&We(t,{warnings:r});let n=t?.root?.children||[];n.length||r.push("\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u4E3A\u7A7A\uFF0C\u6574\u5408\u5305\u53EA\u5305\u542B\u670D\u52A1\u7AEF\u63A7\u4EF6\u4E0E\u811A\u672C\u3002");let o=new Set,a=L(e),s=t?L(t):null,c=wi(a,o),l=kn(i.scripts||[],o);r.push(...l.warnings.filter(I=>I!==za));let u=String(i.fileName||`${a.meta?.name||"\u6574\u5408\u5305"} \xB7 \u6574\u5408\u5305.gia`),f=Sn({...a,meta:{...a.meta,giaFileName:u}},!1),h=Ra(a,c,l,r,f),p={graph:[],accessories:[]};if(n.length&&s){let I=wi({...s,meta:{...s.meta,assetType:"client-control-template"}},o);p=Ta(s,I,r,f,l.scripts)}let m={graph:[...h.graph,...p.graph],accessories:[...h.accessories,...p.accessories],filePath:f,gameVersion:In({meta:{gameVersion:e.meta?.gameVersion||t?.meta?.gameVersion}}),...xn(e)};return{buffer:Ma(m,_n),warnings:[...new Set(r)]}}var St=69,Oa=30,za="\u811A\u672C\u6302\u8F7D\u5173\u7CFB\u4E0D\u8FDB\u5165 GIA\uFF1A\u5B98\u65B9 script.gia \u53EA\u542B\u6620\u5C04\uFF08ID/\u540D\u79F0/\u8DEF\u5F84/\u6E90\u7801\uFF09\uFF0C\u5BFC\u5165\u540E\u9700\u91CD\u65B0\u6302\u8F7D\u3002";function vu(e){return(String(e.path||"").replace(/\\/g,"/").split("/").pop()||"").replace(/\.lua$/iu,"")||`\u811A\u672C${e.id||""}`}function Cn(e){let t=Fe.verify(e);if(t)throw new Error(`GIA encode validation failed: ${t}`);let i=Fe.encode(Fe.create(e)).finish(),r=Buffer.alloc(lt+i.length+vn);return r.writeUInt32BE(r.length-4,0),r.writeUInt32BE(1,4),r.writeUInt32BE(Ca,8),r.writeUInt32BE(3,12),r.writeUInt32BE(i.length,16),Buffer.from(i).copy(r,lt),r.writeUInt32BE(ka,lt+i.length),r}function kn(e,t=new Set){let i=(e||[]).filter(a=>a.path||a.source).map(a=>({...a})),r=[];for(let a of i){let s=Number(a.guid);Ne(s)&&!t.has(s)?(t.add(s),a.guid=s):r.push(a)}for(let a of r){let s=nt(t);t.add(s),a.guid=s}let n=[];return(e||[]).some(a=>a.controlId)&&n.push(za),{units:i.map(a=>{let s=vu(a),c=String(a.path||"").replace(/\\/g,"/"),l=/\.lua$/iu.test(c)?c:`${c||s}.lua`,u={id:a.guid,name:s,filePath:l};return String(a.source||"")&&(u.source=String(a.source)),{id:{class:Oa,id:a.guid},name:s,which:St,script:{mapping:u}}}),warnings:n,scripts:i}}function Da(e){let t=kn(e);if(!t.units.length)throw new Error("\u6CA1\u6709\u53EF\u5BFC\u51FA\u7684 Lua \u811A\u672C\uFF0C\u8BF7\u5148\u5728\u201CLua \u811A\u672C\u201D\u9875\u521B\u5EFA");let i={graph:t.units,filePath:`114514-${Math.floor(Date.now()/1e3)}-1073741832-\\script.gia`,gameVersion:"7.0.51"},r=Cn(i),n=wu(r);if(!n.valid)throw new Error(`GIA compatibility validation failed:
|
|
109
|
+
`,{root:Dd}=Od.parse($d,{keepCase:!1}),De=Dd.lookupType("Root"),dt=20,Ma=4,Xo=806,Wo=1657,xi={image:23,"server-container":24,container:25,grid:26,reference:27,button:28,animation:29,fullscreen:30,textbox:31,textwindow:32,cursor:33,keyhint:34},Ko={KEYBOARD:0,TOUCHSCREEN:1,CONTROLLER_CONSOLE:2,CONTROLLER_MOBILE:3},zd="server-control-template",bn="client-control-template";function pn(e,t){let i=Number(e);return Number.isFinite(i)?i:t}var Gd=Object.fromEntries(Object.entries(Ko).map(([e,t])=>[t,e])),qo=Object.freeze({container:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["68/91","empty78","containerNodeSlot"],["67/90","empty77","footerSlot"]],textbox:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["64/84","empty74","textConfig"],["67/90","empty77","footerSlot"]],cursor:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["65/85","empty75","cursorConfig"],["67/90","empty77","footerSlot"]],reference:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["66/89","empty76","templateRefSlot"],["67/90","empty77","footerSlot"]],grid:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["69/92","empty79","gridView"],["67/90","empty77","footerSlot"]],button:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["70/93","empty80","buttonPreset"],["67/90","empty77","footerSlot"]],textwindow:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["71/94","empty81","textConfig"],["67/90","empty77","footerSlot"]],keyhint:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["72/95","empty82","keyHint"],["67/90","empty77","footerSlot"]],image:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["73/96","empty83","imageSlot"],["74/97","empty84","image"],["67/90","empty77","footerSlot"]],animation:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["75/98","empty85","effectSlot"],["67/90","empty77","footerSlot"]],fullscreen:[["2/15","name",null],["4/86","field14","field14"],["1/12","transform","transform"],["63/83","empty73","genericSlot"],["76/99","empty86","fullscreenEffectSlot"],["67/90","empty77","footerSlot"]]}),Jo=Object.freeze({"4/23":5,"4/86":5,"1/12":4,"62/82":64,"63/83":65,"64/84":66,"65/85":67,"66/89":68,"67/90":69,"68/91":70,"69/92":71,"70/93":72,"71/94":66,"72/95":74,"73/96":75,"74/97":76,"75/98":77,"76/99":78}),Vd=Object.freeze([["2/15","name",null],["4/23","field14","field14"],["1/12","transform","transform"],["62/82","empty72","rootChildRef"]]);function Ra(e){return{class:1,type:8,id:e}}function Ei(e,t,i,n){return{...n,field501:t,field502:i,field503:1,nodeRef:Ra(e)}}function Bd(e){let t=[],i=e.meta?.assetType==="client-control-template";return K(e.root,n=>{i&&n.kind==="server-container"||t.push(n)}),t}function Ii(e,t=new Set,{preserveLegacy:i=!1}={}){let n=new Map,a=[],r=Bd(e);if(!i)for(let o of r)ua(o.guid,o.name);for(let o of r){let s=Number(o.guid);(i?Je(s):Te(s))&&!t.has(s)?(t.add(s),o.guid=s,n.set(o.id,s)):a.push(o)}for(let o of a){let s=ot(t);t.add(s),o.guid=s,n.set(o.id,s)}return n}function Hd(e){return{scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z},anchorMin:{x:e.anchorMin.x,y:e.anchorMin.y},anchorMax:{x:e.anchorMax.x,y:e.anchorMax.y},offset:{x:e.offset.x,y:e.offset.y},size:{x:e.size.x,y:e.size.y},pivot:{x:e.pivot.x,y:e.pivot.y},field508:Object.fromEntries(Object.entries(e.rotation).filter(([,t])=>t!==0))}}function Ld(e,t){let n={multiPlatform:{platforms:fe.map(a=>({platformType:Ko[a],transform:Hd(e.transformByPlatform[a])})),field502:xi[e.kind]||25,...e.syncAllDevices===!1?{}:{field504:1}},type:2};return{transform:{multiPlatform:{},type:2},field501:1,field502:12,details:Ei(t,4,12,{transform:n})}}function Ud(e,t,i){let n=i?{empty15:"",field501:5}:{field17:{},field501:7},a=i?n:{...n,...e.visible===!1?{field17:{initiallyHidden:!0}}:{},...e.active===!1?{initiallyInactive:!0}:{}};return[{name:{value:e.name},field501:2,field502:15},{field14:n,field501:4,field502:i?23:86,details:Ei(t,5,i?23:86,{field14:a})},Ld(e,t)]}function jd(e,t,i,n){let a=(l,d,f,h,m)=>({[f]:"",field501:l,field502:d,details:Ei(t,l+2,d,{[h]:m})}),r=e.giaRaw||{},o=Array.isArray(e.scriptMappingIds)&&e.scriptMappingIds.length?{field501:r.genericField501||1,field502:e.scriptMappingIds.map(l=>({field1:{id:Number(l)}}))}:{field501:r.genericField501??0},s=a(63,83,"empty73","genericSlot",o),c=a(67,90,"empty77","footerSlot",{field505:[void 0,0,1].includes(r.footerField505)?e.canControllerFocus?1:0:r.footerField505});if(e.kind==="container")return[s,a(68,91,"empty78","containerNodeSlot",{...e.isolateNavigation?{isolateNavigation:!0}:{},...e.disableKeyEventPassthrough?{disableKeyEventPassthrough:!0}:{},...e.disableCursorEventPassthrough?{disableCursorEventPassthrough:!0}:{},...e.showCursor?{showCursor:!0}:{}}),c];if(e.kind==="textbox"||e.kind==="textwindow"){e.verticalAlignment==="Middle"&&n.push(`${e.name}: \u5782\u76F4\u5C45\u4E2D\u6309\u63A8\u5B9A\u503C\u5BFC\u51FA\uFF0C\u5C1A\u5F85\u5B9E\u673A\u786E\u8BA4\u3002`);let l={Left:0,Middle:1,Right:2}[e.horizontalAlignment]??0,d=Number.isFinite(r.textAlign)?Math.trunc(r.textAlign):l,f={field501:r.textField501??20,field503:r.textField503??12,color:e.fontColor>>>0,color2:e.bgColor>>>0,color3:e.outlineColor>>>0,text:{value:e.text||""},fontSize:Math.trunc(e.fontSize),minimumFontSize:Math.trunc(e.minimumFontSize),...e.adaptiveFontSize?{adaptive:1}:{},...e.enableOutline===!1?{outlineOff:1}:{},...d?{align:d}:{},verticalAlign:r.textVerticalAlign??{Top:0,Middle:1,Bottom:2}[e.verticalAlignment]??0};return e.kind==="textwindow"?((e.interactable===!1||e.showScrollBar===!1)&&n.push(`${e.name}: \u6587\u672C\u89C6\u7A97\u4EA4\u4E92/\u6EDA\u52A8\u6761\u5F00\u5173\u4EC5\u4FDD\u5B58\u5728 JSON\uFF0CGIA \u672A\u6620\u5C04\u8FD9\u4E9B\u6539\u52A8\u3002`),f.field511=r.textField511??1,f.viewFlags={field502:r.textViewField502??1,field503:r.textViewField503??1},[s,{empty81:"",field501:71,field502:94,details:Ei(t,66,94,{textConfig:f})},c]):[s,a(64,84,"empty74","textConfig",f),c]}if(e.kind==="image"){let l=[0,1].includes(r.imageSlotType??0)?e.imageType==="Stretch"?1:0:r.imageSlotType;e.imageType==null&&e.imageSource==="StaticReference"&&e.imageId>100006&&n.push(`${e.name}: \u56FE\u7247\u7C7B\u578B\u968F\u7D20\u6750\u8FB9\u754C\u81EA\u52A8\u9009\u62E9\uFF0CGIA \u6309\u57FA\u7840\u5BFC\u51FA\uFF1B\u9700\u8981\u62C9\u4F38\u8BF7\u5148\u660E\u786E\u9009\u62E9\u6216\u5728 Lua \u8BBE\u7F6E imageType\u3002`),e.imageSource&&e.imageSource!=="StaticReference"&&n.push(`${e.name}: \u56FE\u7247\u6765\u6E90 ${e.imageSource} \u4EC5\u4FDD\u5B58\u5728 JSON\uFF0C\u5C1A\u672A\u6620\u5C04\u5230 GIA\uFF1B\u8BF7\u5728 Lua \u4E2D\u7528 SetImage(Enum.ImageSource.${e.imageSource}, ${e.imageId}) \u8BBE\u7F6E\u3002`);let d={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[e.fillType],f=Number.isFinite(r.imageFillType)?Math.trunc(r.imageFillType):d||1;e.enableFill&&!f&&n.push(`${e.name}: \u586B\u5145\u5F62\u72B6\u539F\u59CB\u679A\u4E3E\u4E3A 0\uFF0C\u5DF2\u5173\u95ED\u5BFC\u51FA\u6587\u4EF6\u4E2D\u7684\u8FDB\u5EA6\u586B\u5145\u3002`),e.fillType==="Horizontal"&&e.fillHorizontalType!=="Left"&&n.push(`${e.name}: \u5F53\u524D\u6A2A\u5411\u586B\u5145\u65B9\u5411\u6682\u4E0D\u652F\u6301\u5199\u5165 GIA\u3002`),e.fillType==="Radial180"&&e.fillRadialType!=="Bottom"&&n.push(`${e.name}: \u5F53\u524D 180 \u5EA6\u586B\u5145\u8D77\u70B9\u6682\u4E0D\u652F\u6301\u5199\u5165 GIA\u3002`);let h={field502:r.imageField502??1,field504:r.imageField504??1,field505:r.imageField505??1,field507:r.imageField507??2,field508:Math.round(Math.max(0,Math.min(1,Number(e.fillAmount)||0))*100),border:{field501:pn(e.softEdgeWidthX,8),field502:pn(e.softEdgeWidthY,8)},field512:pn(e.horizontalSoftRange,85),field513:pn(e.verticalSoftRange,85),fillType:f,...e.enableMask?{enableMask:1}:{},...e.enableSoftEdge?{enableSoftEdge:1}:{},...e.softEdgeMode==="Pixel"?{softEdgePixel:1}:{},...e.enableFill&&f?{enableFill:1}:{},...e.reverseMaskArea?{reverseMask:1}:{}};return[s,a(73,96,"empty83","imageSlot",{field502:Number.isFinite(e.imageColor)?e.imageColor>>>0:4294967295,assetId:e.imageId>>>0,...l?{imageType:l}:{}}),a(74,97,"empty84","image",h),c]}if(e.kind==="button"){let l=(p,b)=>{let v=e[p];return v?(e.children||[]).some(y=>y.id===v)?i.get(v)||0:(n.push(`${e.name}: ${b}\u72B6\u6001\u8282\u70B9\u4E0D\u662F\u6309\u94AE\u7684\u76F4\u63A5\u5B50\u63A7\u4EF6\uFF0CGIA \u672A\u5199\u5165\u8BE5\u72B6\u6001\u3002`),0):0},d=l("unavailableChildId","\u4E0D\u53EF\u7528"),f=l("hoverChildId","\u60AC\u505C"),h=l("pressedChildId","\u6309\u4E0B"),m=l("selectedChildId","\u9009\u4E2D");return[s,a(70,93,"empty80","buttonPreset",{clickAudioId:Math.trunc(e.clickAudioId),...d?{disabledChild:d}:{},...f?{hoverChild:f}:{},...h?{pressedChild:h}:{},...m?{selectedChild:m}:{},...e.interactable?{interactable:1}:{},...e.raycastTarget?{raycastTarget:1}:{}}),c]}if(e.kind==="cursor")return[s,a(65,85,"empty75","cursorConfig",{field501:[void 0,0,1].includes(r.cursorField501)?e.raycastTarget!==!1?1:0:r.cursorField501}),c];if(e.kind==="reference"){let l=r.templateRefSlotBase64;(l||r.templateRefOuterBase64)&&n.push(`${e.name}: \u6A21\u677F\u5F15\u7528\u7684\u975E\u7A7A\u4E8C\u8FDB\u5236\u914D\u7F6E\u5C1A\u672A\u89E3\u6790\uFF0C\u5DF2\u539F\u6837\u4FDD\u7559\uFF1B\u4E0D\u4F1A\u81EA\u52A8\u5C55\u5F00\u88AB\u5F15\u7528\u6A21\u677F\u3002`);let d=a(66,89,"empty76","templateRefSlot",l?Buffer.from(l,"base64"):Buffer.from(r.templateRefSlot??"","utf8"));return d.empty76=Buffer.from(r.templateRefOuterBase64||"","base64"),[s,d,c]}return e.kind==="grid"?((e.itemPrefabId||e.interactable===!1||e.showScrollBar===!1||e.raycastTarget===!1||e.scrollDirection!=="Vertical"||e.layoutConstraint!=="AutoWrap")&&n.push(`${e.name}: \u7F51\u683C\u5217\u8868\u9879\u6A21\u677F\u3001\u4EA4\u4E92/\u6EDA\u52A8\u6761\u5F00\u5173\u3001\u6EDA\u52A8\u65B9\u5411\u53CA\u6392\u5217\u9650\u5236\u4EC5\u4FDD\u5B58\u5728 JSON\uFF0CGIA \u672A\u6620\u5C04\u8FD9\u4E9B\u6539\u52A8\u3002`),[s,a(69,92,"empty79","gridView",{field501:r.gridField501??1,cellSize:{field501:e.cellSizeX,field502:e.cellSizeY},gap:{field501:e.spacingX,field502:e.spacingY},padding1:{field501:e.padding1X,field502:e.padding1Y},padding2:{field501:e.padding2X,field502:e.padding2Y},field507:r.gridField507??1,field508:r.gridField508??1,field509:r.gridField509??1,field511:r.gridField511??5,field512:r.gridField512??1}),c]):e.kind==="keyhint"?[s,a(72,95,"empty82","keyHint",{field501:Number.isFinite(r.keyHintField501)?Math.trunc(r.keyHintField501):e.controllerKeyCode??1,field502:Number.isFinite(r.keyHintField502)?Math.trunc(r.keyHintField502):e.keyboardKeyCode??1}),c]:e.kind==="animation"?[s,a(75,98,"empty85","effectSlot",r.effectSlot??""),c]:e.kind==="fullscreen"?[s,a(76,99,"empty86","fullscreenEffectSlot",r.fullscreenEffectSlot??""),c]:(n.push(`${e.name}: ${e.kind} \u4E0D\u662F\u5DF2\u77E5 GIA \u63A7\u4EF6\u7C7B\u578B\uFF0C\u5DF2\u4EC5\u5199\u516C\u5171\u53D8\u6362\u3002`),[s,c])}function Yd(e,t){if(t)return 1;if(!Me(e.giaInfoIndex))throw new Error(`${e.name}: \u7F3A\u5C11\u5408\u6CD5\u7684\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7`);return e.giaInfoIndex}function Xd(e,t,i){let n=Array.isArray(e.giaRelatedGuids)?e.giaRelatedGuids.filter(a=>Number.isSafeInteger(a)&&a>0&&a<=2147483647):[];return n.length?n:(t.push(`${e.name}: \u65B0${i}\u5199\u5165\u663E\u5F0F\u7A7A Info.related\uFF0C\u907F\u514D\u8DE8\u6C99\u7BB1\u590D\u7528\u4F34\u751F\u8D44\u6E90 GUID \u4EA7\u751F\u65E0\u6CD5\u52A0\u8F7D\u7684\u7D22\u5F15\u3002`),[])}function Na(e,t){let i=String(e.meta?.giaFilePath||"").trim();if(/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i))return i;let n=(l,d)=>Number.isSafeInteger(Number(l))&&Number(l)>0?Number(l):d,a=n(e.meta?.giaOwnerUid,114514),r=n(e.meta?.giaTimestamp,Math.floor(Date.now()/1e3)),o=n(e.meta?.giaFileId,t?1073741829:1073741830),s=t?"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868.gia":"\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F-\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668.gia",c=String(e.meta?.giaFileName||s).replace(/[\\/:*?"<>|]/gu,"-").replace(/\.gia$/iu,"").trim()||s.replace(/\.gia$/iu,"");return`${a}-${r}-${o}-\\${c}.gia`}function gn(e,t,i,n,a,r=!1,o=!1,s=o,c=!1){let l=i.get(e.id),f=(c?[...e.children||[]].reverse():e.children||[]).map(p=>i.get(p.id)),h=r?n:f,m=Ud(e,l,r);if(r){let p=e.children?.[0];p&&m.push({empty72:"",field501:62,field502:82,details:Ei(l,64,82,{rootChildRef:{guid:i.get(p.id)}})})}else m.push(...jd(e,l,i,a));return{id:Ra(l),relatedIds:h.map(p=>Ra(p)),name:e.name,which:r?21:o?70:15,ui:{content:{guid:l,info:[{guid:{value:l},field501:1,field502:5},...r||s?[{index:{value:Yd(e,r)},field501:2,field502:6}]:[],...r||o?[{related:{value:Xd(e,a,r?"\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F")},field501:4,field502:4}]:[]],children:r?[]:f,parent:t&&t.kind!=="server-container"?i.get(t.id):0,data:m}}}}function Wd(e,t){let i=new Map;for(let n of e||[]){if(!n.controlId||!(t===bn?n.controlAsset===bn:n.controlAsset!==bn))continue;let r=i.get(n.controlId)||[];r.push(n.guid),i.set(n.controlId,r)}return i}function Qo(e,t,i,n){let a=Wd(t,i),r=new Map;K(e.root,o=>{a.has(o.id)&&(r.set(o,o.scriptMappingIds),o.scriptMappingIds=a.get(o.id))});try{return n()}finally{for(let[o,s]of r)s===void 0?delete o.scriptMappingIds:o.scriptMappingIds=s}}function Fa(e){let t=Number(e.meta?.giaModeFlag);return Number.isSafeInteger(t)&&t>=0?{modeFlag:t}:{}}function Oa(e){let t=e.meta?.gameVersion;return!t||t==="7.0.50"?nn:t}function Zo(e,t,i,n,a=[]){let r=qt(e,!0),o=r.filter(({parent:d})=>d?.kind==="server-container");if(!o.length)throw new Error("\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868\u81F3\u5C11\u9700\u8981\u4E00\u4E2A\u6A21\u677F");let s=new Set(o.map(({node:d})=>d.id)),c=r.filter(({node:d})=>!s.has(d.id)),l=r.map(({node:d})=>t.get(d.id));return Qo(e,a,bn,()=>({graph:o.map(({node:d,parent:f})=>gn(d,f,t,l,i,!1,!0,!0,!0)),accessories:c.map(({node:d,parent:f})=>gn(d,f,t,l,i,!1,!1,!0,!0)),filePath:n||Na(e,!0),gameVersion:Oa(e),...Fa(e)}))}function es(e,t,i,n,a){let r=qt(e),o=[r[0],...r.slice(1).reverse()],s=o.map(({node:c})=>t.get(c.id));return Qo(e,i.scripts,zd,()=>({graph:[gn(e.root,null,t,s,n,!0,!1,!1,!0),...i.units||[]],accessories:o.map(({node:c,parent:l})=>gn(c,l,t,s,n,!1,!1,!1,!0)),filePath:a||Na(e,!1),gameVersion:Oa(e),...Fa(e)}))}function ts(e,t){let i=Da(e),n=t(i);if(!n.valid)throw new Error(`GIA compatibility validation failed:
|
|
109
110
|
${n.errors.join(`
|
|
110
|
-
`)}`);return{buffer:r,warnings:[...new Set(t.warnings)]}}function En(e){return Fe.toObject(Fe.decode(lr(e)),{longs:Number,enums:Number,bytes:Buffer,defaults:!1,arrays:!0,objects:!0})}function $a(e){try{let i=En(e).graph||[];return i.length>0&&i.every(r=>Number(r.which)===St)}catch{return!1}}function Ga(e){let t=[...e.graph||[],...e.accessories||[]].filter(n=>Number(n.which)===St),i=[],r=t.map((n,o)=>{let a=n.script?.mapping||{},s=Number(n.id?.id)||0;s<=0&&i.push(`\u7B2C ${o+1} \u6761\u811A\u672C\u6620\u5C04\u7F3A\u5C11 GraphUnit.id.id\uFF0C\u5DF2\u6309 0 \u5904\u7406\uFF08\u5BFC\u51FA\u65F6\u4F1A\u91CD\u65B0\u5206\u914D\uFF09\u3002`);let c=Number(a.id)||0;return c&&c!==s&&i.push(`\u7B2C ${o+1} \u6761\u811A\u672C\u6620\u5C04 id(${c}) \u4E0E\u5355\u5143 id(${s}) \u4E0D\u4E00\u81F4\uFF0C\u4EE5\u5355\u5143 id \u4E3A\u51C6\u3002`),{guid:s,path:String(a.filePath||""),source:String(a.source||"")}});for(let[n,o]of r.entries())o.path&&!/\.lua$/iu.test(o.path)&&i.push(`\u7B2C ${n+1} \u6761\u811A\u672C\u6620\u5C04 file_path \u7F3A\u5C11 .lua \u540E\u7F00\uFF08${o.path}\uFF09\uFF0C\u771F\u673A\u53EF\u80FD\u62D2\u7EDD\u5BFC\u5165\uFF1B\u6A21\u62DF\u5668\u5185\u6309\u5F52\u4E00\u5316\u8DEF\u5F84\u7167\u5E38 require\u3002`);return{scripts:r,warnings:i}}function Va(e){let t=En(e),i=Ga(t);if(!i.scripts.length)throw new Error("GIA \u5185\u6CA1\u6709\u811A\u672C\u6620\u5C04\u5355\u5143\uFF08which=69\uFF09");return{scripts:i.scripts,warnings:i.warnings,metadata:{assetType:"lua-script"}}}function wu(e){let t=[],i;try{i=En(e)}catch(n){return{valid:!1,errors:[n?.message||String(n)],scriptCount:0}}let r=i.graph||[];return r.length||t.push("Root.graph \u4E3A\u7A7A"),(i.accessories||[]).length&&t.push("script.gia \u4E0D\u5E94\u5305\u542B accessories"),r.forEach((n,o)=>{let a=`\u5355\u5143 ${o+1}`;Number(n.which)!==St&&t.push(`${a}: which \u5E94\u4E3A 69\uFF0C\u5B9E\u9645 ${n.which}`),Number(n.id?.class)!==Oa&&t.push(`${a}: id.class \u5E94\u4E3A 30\uFF0C\u5B9E\u9645 ${n.id?.class}`),Number(n.id?.type??0)!==0&&t.push(`${a}: id.type \u5E94\u7F3A\u7701`);let s=n.script?.mapping;if(!s){t.push(`${a}: \u7F3A\u5C11 field35 ScriptMappingWrapper`);return}Number(n.id?.id)<=0&&t.push(`${a}: GraphUnit.id.id \u975E\u6CD5`),Number(s.id)!==Number(n.id?.id)&&t.push(`${a}: mapping.id \u5E94\u7B49\u4E8E GraphUnit.id.id`),String(s.name||"")!==String(n.name||"")&&t.push(`${a}: mapping.name \u5E94\u7B49\u4E8E GraphUnit.name`),String(s.filePath||"").trim()?/\.lua$/iu.test(String(s.filePath))||t.push(`${a}: file_path \u5E94\u4EE5 .lua \u7ED3\u5C3E\uFF08\u5B98\u65B9 script.gia \u6837\u672C\u5747\u4E3A \u540D\u79F0.lua\uFF0C\u771F\u673A require \u65F6\u624D\u53BB\u6269\u5C55\u540D\uFF09`):t.push(`${a}: file_path \u4E3A\u7A7A`)}),{valid:t.length===0,errors:t,scriptCount:r.length}}function lr(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);if(t.length<lt+vn)throw new Error("GIA \u6587\u4EF6\u8FC7\u77ED");if(t.readUInt32BE(4)!==1||t.readUInt32BE(8)!==Ca||t.readUInt32BE(12)!==3)throw new Error("\u4E0D\u662F\u53D7\u652F\u6301\u7684 GIA v1 \u6587\u4EF6");let i=t.readUInt32BE(16);if(i!==t.length-lt-vn)throw new Error("GIA payload \u957F\u5EA6\u4E0D\u4E00\u81F4");if(t.readUInt32BE(lt+i)!==ka)throw new Error("GIA \u5C3E\u6807\u8BB0\u65E0\u6548");return t.subarray(lt,lt+i)}function pe(e,t){return e.ui?.content?.data?.find(i=>i.details?.[t])?.details?.[t]||null}function Su(e){let t=e.ui?.content?.data?.find(o=>o.field501===66&&o.field502===89||Object.hasOwn(o.details||{},"templateRefSlot")),i=Buffer.from(t?.details?.templateRefSlot||[]),r=i.toString("utf8"),n=Buffer.from(r,"utf8").equals(i)&&!/[\u0000-\u001f\u007f-\u009f]/u.test(r);return{referencedPrefabId:n?r:"",raw:{templateRefSlot:n?r:"",...n?{}:{templateRefSlotBase64:i.toString("base64")},...t?.empty76?.length?{templateRefOuterBase64:Buffer.from(t.empty76).toString("base64")}:{}}}}function xu(e){let t=pe(e,"transform")?.multiPlatform,i={};for(let n of t?.platforms||[]){let o=cu[n.platformType||0],a=n.transform||{};i[o]={scale:a.scale?{x:a.scale.x??0,y:a.scale.y??0,z:a.scale.z??0}:{x:1,y:1,z:1},rotation:{x:a.field508?.x??0,y:a.field508?.y??0,z:a.field508?.z??0},anchorMin:{x:a.anchorMin?.x??0,y:a.anchorMin?.y??0},anchorMax:{x:a.anchorMax?.x??0,y:a.anchorMax?.y??0},offset:{x:a.offset?.x??0,y:a.offset?.y??0},size:{x:a.size?.x??0,y:a.size?.y??0},pivot:a.pivot?{x:a.pivot.x??0,y:a.pivot.y??0}:{x:.5,y:.5}}}let r=i.KEYBOARD||i[Object.keys(i)[0]];if(!r)throw new Error(`GIA \u63A7\u4EF6 ${e.name||e.id?.id} \u7F3A\u5C11\u591A\u5E73\u53F0\u53D8\u6362`);for(let n of ue)i[n]||(i[n]=structuredClone(r));return i}function sr(e){let t=e.ui?.content?.data||[];return t.some(i=>i.details?.textConfig)?t.some(i=>i.field501===71)?"textwindow":"textbox":t.some(i=>i.details?.cursorConfig)?"cursor":t.some(i=>Object.hasOwn(i.details||{},"templateRefSlot")||i.field501===66&&i.field502===89)?"reference":t.some(i=>i.details?.gridView)?"grid":t.some(i=>i.details?.buttonPreset)?"button":t.some(i=>i.details?.keyHint)?"keyhint":t.some(i=>i.details?.image||i.details?.imageSlot)?"image":t.some(i=>Object.hasOwn(i.details||{},"effectSlot"))?"animation":t.some(i=>Object.hasOwn(i.details||{},"fullscreenEffectSlot"))?"fullscreen":(t.some(i=>Object.hasOwn(i.details||{},"containerNodeSlot")),"container")}function Ia(e,{reverseSiblings:t=!1,idOffset:i=0}={}){if(!e.length)return{nodes:new Map,rootCandidates:[],warnings:[]};let r=new Map(e.map((l,u)=>[l.id?.id,`n${i+u+1}`])),n=new Map,o=new Map,a=[];for(let l of e){let u=sr(l),f=pe(l,"textConfig"),h=pe(l,"imageSlot"),p=pe(l,"image"),m=pe(l,"buttonPreset"),y=pe(l,"gridView"),I=pe(l,"genericSlot"),b=pe(l,"footerSlot"),v=pe(l,"cursorConfig"),P=pe(l,"keyHint"),R=pe(l,"containerNodeSlot"),F=u==="reference"?Su(l):null,$=pe(l,"effectSlot"),Y=pe(l,"fullscreenEffectSlot"),G=q(u,{id:r.get(l.id?.id),guid:l.id?.id||0,giaInfoIndex:(l.ui?.content?.info||[]).find(w=>w.field501===2&&w.field502===6)?.index?.value,giaRelatedGuids:(l.ui?.content?.info||[]).find(w=>w.field501===4&&w.field502===4)?.related?.value||[],name:l.name||u,visible:pe(l,"field14")?.field17?.initiallyHidden!==!0,active:pe(l,"field14")?.initiallyInactive!==!0,canControllerFocus:b?.field505===1,scriptMappingIds:(I?.field502||[]).map(w=>Number(w?.field1?.id)).filter(w=>Number.isSafeInteger(w)&&w>0),transformByPlatform:xu(l),syncAllDevices:pe(l,"transform")?.multiPlatform?.field504===1,giaRaw:{genericField501:I?.field501??0,footerField505:b?.field505??0,...u==="textbox"||u==="textwindow"?{textField501:f?.field501??20,textField503:f?.field503??12,textAlign:f?.align??0,...[void 0,0,1,2].includes(f?.verticalAlign)?{}:{textVerticalAlign:f.verticalAlign},...u==="textwindow"?{textField511:f?.field511??1,textViewField502:f?.viewFlags?.field502??1,textViewField503:f?.viewFlags?.field503??1}:{}}:{},...u==="cursor"?{cursorField501:v?.field501??0}:{},...F?.raw||{},...u==="grid"?{gridField501:y?.field501??1,gridField507:y?.field507??1,gridField508:y?.field508??1,gridField509:y?.field509??1,gridField511:y?.field511??5,gridField512:y?.field512??1}:{},...u==="keyhint"?{keyHintField501:P?.field501??1,keyHintField502:P?.field502??1}:{},...u==="image"?{imageSlotType:h?.imageType??0,imageField502:p?.field502??1,imageField504:p?.field504??1,imageField505:p?.field505??1,imageField507:p?.field507??2,imageFillType:p?.fillType??1}:{},...u==="animation"?{effectSlot:$??""}:{},...u==="fullscreen"?{fullscreenEffectSlot:Y??""}:{}},...u==="container"?{isolateNavigation:R?.isolateNavigation===!0,disableKeyEventPassthrough:R?.disableKeyEventPassthrough===!0,disableCursorEventPassthrough:R?.disableCursorEventPassthrough===!0,showCursor:R?.showCursor===!0}:{},...u==="cursor"?{raycastTarget:v?.field501===1}:{},...u==="textbox"||u==="textwindow"?{text:f?.text?.value??"",fontSize:f?.fontSize??20,minimumFontSize:f?.minimumFontSize??20,adaptiveFontSize:f?.adaptive===1,fontColor:f?.color??4294967295,bgColor:f?.color2??0,enableOutline:f?.outlineOff!==1,outlineColor:f?.color3??858993459,horizontalAlignment:f?.align===1?"Middle":f?.align===2?"Right":"Left",verticalAlignment:{0:"Top",1:"Middle",2:"Bottom"}[f?.verticalAlign??0]||"Top",...u==="textwindow"?{interactable:!0,showScrollBar:!0}:{}}:{},...u==="image"?{imageSource:"StaticReference",imageId:h?.assetId??0,imageType:h?.imageType===1?"Stretch":"Basic",imageColor:Number.isFinite(h?.field502)?h.field502>>>0:4294967295,enableMask:p?.enableMask===1,enableSoftEdge:p?.enableSoftEdge===1,enableFill:p?.enableFill===1,softEdgeMode:p?.softEdgePixel===1?"Pixel":"Percentage",softEdgeWidthX:p?.border?.field501??8,softEdgeWidthY:p?.border?.field502??8,horizontalSoftRange:p?.field512??85,verticalSoftRange:p?.field513??85,fillType:{1:"Horizontal",2:"Vertical",3:"Radial90",4:"Radial180",5:"Radial360"}[p?.fillType]||"Horizontal",fillAmount:Number.isFinite(p?.field508)?Math.max(0,Math.min(1,p.field508/100)):p?.enableFill===1?0:1,reverseMaskArea:p?.reverseMask===1}:{},...u==="button"?{interactable:m?.interactable===1,raycastTarget:m?.raycastTarget===1,clickAudioId:m?.clickAudioId??50888}:{},...u==="grid"?{cellSizeX:y?.cellSize?.field501??50,cellSizeY:y?.cellSize?.field502??50,spacingX:y?.gap?.field501??8,spacingY:y?.gap?.field502??8,padding1X:y?.padding1?.field501??20,padding1Y:y?.padding1?.field502??20,padding2X:y?.padding2?.field501??20,padding2Y:y?.padding2?.field502??20,previewCount:y?.field511??5}:{},...F?{referencedPrefabId:F.referencedPrefabId}:{},...u==="keyhint"?{keyboardKeyCode:P?.field502??null,controllerKeyCode:P?.field501??null}:{},...u==="animation"?{animationId:$??""}:{},...u==="fullscreen"?{animationId:Y??""}:{}});n.set(l.id?.id,G),(F?.raw.templateRefSlotBase64||F?.raw.templateRefOuterBase64)&&a.push(`${G.name}: \u6A21\u677F\u5F15\u7528\u914D\u7F6E\u542B\u5C1A\u672A\u89E3\u6790\u7684\u4E8C\u8FDB\u5236\u5B57\u6BB5\uFF0C\u5DF2\u539F\u6837\u4FDD\u5B58\uFF1B\u5F15\u7528\u76EE\u6807\u672A\u63A8\u65AD\uFF0C\u9884\u89C8\u4E0D\u4F1A\u81EA\u52A8\u5C55\u5F00\u3002`),(u==="textbox"||u==="textwindow")&&![void 0,0,1,2].includes(f?.align)&&a.push(`${G.name}: \u6C34\u5E73\u5BF9\u9F50\u679A\u4E3E ${f.align} \u7684\u542B\u4E49\u672A\u77E5\uFF0C\u5DF2\u539F\u6837\u4FDD\u7559\u3002`),(u==="textbox"||u==="textwindow")&&![void 0,0,1,2].includes(f?.verticalAlign)&&a.push(`${G.name}: \u5782\u76F4\u5BF9\u9F50\u679A\u4E3E ${f.verticalAlign} \u7684\u542B\u4E49\u672A\u77E5\uFF0C\u5DF2\u539F\u6837\u4FDD\u7559\u3002`),u==="image"&&![void 0,0,1,2,3,4,5].includes(p?.fillType)&&a.push(`${G.name}: \u586B\u5145\u5F62\u72B6\u679A\u4E3E ${p.fillType} \u672A\u8BC6\u522B\uFF0C\u5DF2\u4FDD\u7559\u539F\u503C\u3002`),u==="button"&&o.set(G.id,{unavailableChildId:m?.disabledChild,hoverChildId:m?.hoverChild,pressedChildId:m?.pressedChild,selectedChildId:m?.selectedChild})}let s=[],c=new Set;for(let l of e){let u=n.get(l.id?.id),f=(l.ui?.content?.children||[]).map(h=>n.get(h)).filter(Boolean);if(f.length){u.children=t?f.slice().reverse():f;for(let h of f)c.add(h.id)}}for(let l of e){let u=n.get(l.id?.id),f=l.ui?.content?.parent||0,h=n.get(f);h?c.has(u.id)||(t?h.children.unshift(u):h.children.push(u)):s.push(u)}for(let[l,u]of o){let f=[...n.values()].find(h=>h.id===l);for(let[h,p]of Object.entries(u))f[h]=r.get(p)||null}return{nodes:n,rootCandidates:s,warnings:a}}function Ba(e){let t=lr(e),i=Fe.toObject(Fe.decode(t),{longs:Number,enums:Number,bytes:Buffer,defaults:!1,arrays:!0,objects:!0}),r=[...i.graph||[],...i.accessories||[]],n=b=>!!b.ui?.content&&[15,21,70].includes(Number(b.which)),o=(i.graph||[]).filter(n);if(!o.some(b=>b.ui?.content))throw new Error("GIA \u4E0D\u542B\u53EF\u8BC6\u522B\u7684 UIControlGroup \u4E3B\u56FE");let a=o.find(b=>b.which===21)||null,s=o.filter(b=>Number(b.which)===70),c=(i.accessories||[]).filter(n),l=new Set((a?.relatedIds||[]).map(b=>b.id||0)),u=a?l.size?c.filter(b=>l.has(b.id?.id||0)):c:[],f=s.length?[...s,...c.filter(b=>!l.has(b.id?.id||0))]:a?[]:[...o,...c];if(!u.length&&!f.length)throw new Error("GIA \u4E0D\u542B\u5BA2\u6237\u7AEF\u63A7\u4EF6");let h=["GIA \u5BFC\u5165\u4E3A\u5DF2\u9A8C\u8BC1 UI \u5B57\u6BB5\u7684\u8BED\u4E49\u5BFC\u5165\uFF1B\u672A\u77E5 protobuf \u5B57\u6BB5\u4E0D\u4F1A\u8FDB\u5165 Authoring JSON\u3002"],p=r.filter(b=>!n(b)&&Number(b.which)!==St);p.length&&h.push(`\u8DF3\u8FC7 ${p.length} \u4E2A\u975E UI / \u975E\u811A\u672C\u4F9D\u8D56\u5355\u5143\uFF1B\u8FD9\u4E9B\u8D44\u6E90\u4E0D\u4F1A\u8FDB\u5165\u5B58\u6863\u6216\u91CD\u65B0\u5BFC\u51FA\u3002`);let m=Ga(i);h.push(...m.warnings);let y=null,I=null;if(u.length){let b=Ia(u,{reverseSiblings:!0,idOffset:0});h.push(...b.warnings);let v=b.rootCandidates.find(R=>R.kind==="container")||b.rootCandidates[0];if(!v)throw new Error("GIA \u672A\u627E\u5230\u5BA2\u6237\u7AEF\u6839\u63A7\u4EF6");let P=q("server-container",{id:"sc1",guid:a?.id?.id||0,name:a?.name||"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668",giaRelatedGuids:(a?.ui?.content?.info||[]).find(R=>R.field501===4&&R.field502===4)?.related?.value||[]});P.children=[v],b.rootCandidates.length>1&&h.push(`\u68C0\u6D4B\u5230 ${b.rootCandidates.length} \u4E2A\u65E0\u7236\u8282\u70B9\u63A7\u4EF6\uFF0C\u4EC5\u5BFC\u5165\u4EE5\u201C${v.name}\u201D\u4E3A\u6839\u7684\u6811\u3002`),y={version:1,layoutSchemaVersion:ve,meta:{name:a?.name||"\u5BFC\u5165\u7684\u754C\u9762\u63A7\u4EF6\u7EC4",assetType:"server-control-template",sourceFormat:"gia",sourceFile:"",gameVersion:i.gameVersion||"",giaFilePath:i.filePath||"",...Number.isSafeInteger(Number(i.modeFlag))?{giaModeFlag:Number(i.modeFlag)}:{}},canvasId:"pc-16-9",selectedId:v.id,script:{controlId:v.id,path:"",source:""},root:P}}if(f.length){let b=Ia(f,{reverseSiblings:!1,idOffset:1e3});if(h.push(...b.warnings),!b.rootCandidates.length)throw new Error("GIA \u672A\u627E\u5230\u5BA2\u6237\u7AEF\u6A21\u677F");let v=q("server-container",{id:"sc1",guid:0,name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"});v.children=b.rootCandidates,I={version:1,layoutSchemaVersion:ve,meta:{name:b.rootCandidates.length===1?b.rootCandidates[0].name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868",assetType:"client-control-template",sourceFormat:"gia",sourceFile:"",gameVersion:i.gameVersion||"",giaFilePath:i.filePath||"",...Number.isSafeInteger(Number(i.modeFlag))?{giaModeFlag:Number(i.modeFlag)}:{}},canvasId:"pc-16-9",selectedId:b.rootCandidates[0].id,script:{controlId:b.rootCandidates[0].id,path:"",source:""},root:v},We(I,{warnings:h});for(let P of b.rootCandidates)te(P,R=>R.children.reverse());y||(y=I)}return{project:y,clientProject:I&&y!==I?I:void 0,scripts:m.scripts,warnings:h,metadata:{gameVersion:i.gameVersion||"",filePath:i.filePath||"",...Number.isSafeInteger(Number(i.modeFlag))?{modeFlag:Number(i.modeFlag)}:{},combined:!!(a&&s.length)}}}function An(e){let t=lr(e),i=Fe.toObject(Fe.decode(t),{longs:Number,enums:Number,defaults:!1,arrays:!0,objects:!0}),r=i.graph||[],n=i.accessories||[],o=[],a=(p,m)=>p!=null&&Object.prototype.hasOwnProperty.call(p,m),s=new Map,c=[];/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i.filePath||"")||o.push(`Root.filePath \u4E0D\u662F UID-TIME-ID-\\\u6587\u4EF6\u540D.gia\uFF1A${i.filePath||"<missing>"}`);let l=r.filter(p=>p.which===70).map(p=>{let m=sr(p),y=p.ui?.content?.info||[],I=y.find(P=>P.field501===2&&P.field502===6)?.index?.value,b=y.find(P=>P.field501===4&&P.field502===4),v=b?.related?.value||[];return _e(I)||o.push(`${p.name}: Info.index=${I??"<missing>"}\uFF0C\u5FC5\u987B\u662F\u6B63\u6574\u6570`),b||o.push(`${p.name}: \u9876\u5C42 UIControlTemplate \u7F3A\u5C11 Info.related \u8BB0\u5F55`),{id:p.id?.id||0,name:p.name||"",kind:m,actualIndex:I,relatedPresent:!!b,relatedGuids:v}}),u=new Map;for(let p of l){if(!_e(p.actualIndex))continue;let m=u.get(p.actualIndex);m?o.push(`${p.name}: \u72EC\u7ACB\u6A21\u677F\u8D44\u4EA7\u7F16\u53F7 ${p.actualIndex} \u4E0E ${m.name} \u91CD\u590D`):u.set(p.actualIndex,p)}l.length||o.push("Root.graph \u4E0D\u542B UIControlTemplate(70)");let f=0,h=0;for(let p of[...r,...n]){if(!p.ui?.content)continue;let m=p.id?.id||0,y=p.ui.content,I=sr(p),b=r.includes(p)&&p.which===70,v=`${p.name||"<unnamed>"}(${m||"<missing-guid>"})`;!Number.isSafeInteger(m)||m<=0||m>2147483647?o.push(`${v}: GraphUnit GUID \u975E\u6CD5`):s.has(m)?o.push(`${v}: GUID \u4E0E ${s.get(m).name||"<unnamed>"} \u91CD\u590D`):s.set(m,p),(p.id?.class!==1||p.id?.type!==8)&&o.push(`${v}: GraphUnit.id \u5FC5\u987B\u4E3A class=1,type=8`),y.guid!==m&&o.push(`${v}: content.guid=${y.guid??"<missing>"} \u4E0E GraphUnit.id.id \u4E0D\u4E00\u81F4`),b&&p.which!==70&&o.push(`${v}: \u6A21\u677F\u6839 which \u5FC5\u987B\u4E3A UIControlTemplate(70)`),!b&&p.which!==15&&o.push(`${v}: \u9644\u4EF6\u63A7\u4EF6 which \u5FC5\u987B\u4E3A UIControl(15)`);let P=y.info||[],R=P.find(_=>_.field501===1&&_.field502===5),F=P.find(_=>_.field501===2&&_.field502===6);R?.guid?.value!==m&&o.push(`${v}: Info.self GUID \u7F3A\u5931\u6216\u4E0E\u81EA\u8EAB\u4E0D\u4E00\u81F4`),_e(F?.index?.value)||o.push(`${v}: Info.index=${F?.index?.value??"<missing>"}\uFF0C\u5FC5\u987B\u662F\u6B63\u6574\u6570`);let $=P.find(_=>_.field501===4&&_.field502===4);b&&!$&&o.push(`${v}: \u9876\u5C42\u6A21\u677F\u7F3A\u5C11 Info.related \u8BB0\u5F55`),!b&&$&&o.push(`${v}: \u9644\u4EF6\u63A7\u4EF6\u4E0D\u5E94\u5199 Info.related`);let Y=Aa[I],G=y.data||[],w=G.map(_=>`${_.field501}/${_.field502}`),A=Y?.map(([_])=>_)||[];Y?JSON.stringify(w)!==JSON.stringify(A)&&o.push(`${v}: Data \u69FD\u4F4D\u987A\u5E8F ${w.join(",")}\uFF0C\u5E94\u4E3A ${A.join(",")}`):o.push(`${v}: \u672A\u77E5\u5BA2\u6237\u7AEF\u63A7\u4EF6\u7C7B\u578B ${I}`);for(let _=0;_<Math.min(G.length,Y?.length||0);_+=1){let B=G[_],[j,re,U]=Y[_];if(a(B,re)||o.push(`${v}: Data ${j} \u7F3A\u5C11 ${re} \u5206\u652F`),!U)continue;a(B.details,U)||o.push(`${v}: Details ${j} \u7F3A\u5C11 ${U} \u5206\u652F`);let ie=_a[j];(B.details?.field501!==ie||B.details?.field502!==B.field502||B.details?.field503!==1)&&o.push(`${v}: Details ${j} \u6807\u8BB0\u5E94\u4E3A ${ie}/${B.field502}/1`);let Re=B.details?.nodeRef;(Re?.class!==1||Re?.type!==8||Re?.id!==m)&&o.push(`${v}: Details ${j} node_ref \u672A\u6307\u5411\u81EA\u8EAB`)}let x=(p.ui.content.data||[]).find(_=>_.field501===4&&_.field502===86);x&&(a(x.field14,"field17")?f+=1:o.push(`${v}: \u7C7B\u578B Data \u7F3A\u5C11\u663E\u5F0F Field14.field17 \u7A7A\u4E32`),a(x.details?.field14,"field17")?f+=1:o.push(`${v}: \u7C7B\u578B Details \u7F3A\u5C11\u663E\u5F0F Field14.field17 \u7A7A\u4E32`));let k=(p.ui.content.data||[]).find(_=>_.details?.transform)?.details?.transform?.multiPlatform?.platforms||[];k.length!==4&&o.push(`${v}: \u591A\u5E73\u53F0\u53D8\u6362\u6570\u91CF=${k.length}\uFF0C\u5E94\u4E3A 4`);let z=k.map(_=>_.platformType||0);JSON.stringify(z)!==JSON.stringify([0,1,2,3])&&o.push(`${v}: \u5E73\u53F0\u987A\u5E8F ${z.join(",")}\uFF0C\u5E94\u4E3A 0,1,2,3`);let E=(p.ui.content.data||[]).find(_=>_.details?.transform)?.details?.transform;E?.multiPlatform?.field502!==bi[I]&&o.push(`${v}: \u53D8\u6362 preset=${E?.multiPlatform?.field502??"<missing>"}\uFF0C${I} \u5E94\u4E3A ${bi[I]}`);for(let _ of k)a(_.transform,"field508")?h+=1:o.push(`${v}: RectTransform \u7F3A\u5C11\u663E\u5F0F field508 \u7A7A\u4E32`);c.push({id:m,name:p.name||"",kind:I,template:b,parent:y.parent||0,children:[...y.children||[]],relatedIds:(p.relatedIds||[]).map(_=>_.id||0),dataSignatures:w})}for(let p of c){let m=`${p.name||"<unnamed>"}(${p.id})`;if(JSON.stringify(p.relatedIds)!==JSON.stringify(p.children)&&o.push(`${m}: GraphUnit.relatedIds \u4E0E content.children \u4E0D\u4E00\u81F4`),p.template&&p.parent&&o.push(`${m}: \u9876\u5C42\u6A21\u677F\u4E0D\u5E94\u6709 parent`),!p.template){let y=s.get(p.parent);y?(y.ui?.content?.children||[]).includes(p.id)||o.push(`${m}: \u7236\u63A7\u4EF6 children \u672A\u53CD\u5411\u5305\u542B\u81EA\u8EAB`):o.push(`${m}: parent=${p.parent||"<missing>"} \u4E0D\u5B58\u5728`)}for(let y of p.children){let I=s.get(y);I?(I.ui?.content?.parent||0)!==p.id&&o.push(`${m}: child=${y} \u7684 parent \u672A\u6307\u56DE\u81EA\u8EAB`):o.push(`${m}: child=${y} \u4E0D\u5B58\u5728`)}}return{valid:o.length===0,errors:o,filePath:i.filePath||"",gameVersion:i.gameVersion||"",templateCount:l.length,accessoryCount:n.length,templates:l,units:c,explicitEmpty:{field17:f,rectField508:h}}}function _n(e){let t=lr(e),i=Fe.toObject(Fe.decode(t),{longs:Number,enums:Number,defaults:!1,arrays:!0,objects:!0}),r=(i.graph||[]).filter(E=>E.ui?.content&&Number(E.which)===21),n=(i.graph||[]).filter(E=>Number(E.which)===70),o=(i.graph||[]).filter(E=>Number(E.which)===St),a=(i.accessories||[]).filter(E=>E.ui?.content),s=[],c=(E,_)=>E!=null&&Object.prototype.hasOwnProperty.call(E,_);/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i.filePath||"")||s.push(`Root.filePath \u4E0D\u662F UID-TIME-ID-\\\u6587\u4EF6\u540D.gia\uFF1A${i.filePath||"<missing>"}`),r.length!==1&&s.push(`\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F UIControlGroup \u6570\u91CF=${r.length}\uFF0C\u5E94\u4E3A 1`);let l=(i.graph||[]).filter(E=>{let _=Number(E.which);return _===St||_===70||_===21?!1:!E.ui?.content});l.length&&s.push(`Root.graph \u542B ${l.length} \u4E2A\u65E0\u6CD5\u8BC6\u522B\u7684\u975E\u63A7\u4EF6/\u975E\u811A\u672C\u5355\u5143`);let u=r[0];if(!u)return{valid:!1,errors:s,filePath:i.filePath||"",gameVersion:i.gameVersion||"",accessoryCount:a.length,controls:[],scriptCount:o.length,explicitEmpty:{field17:0,rectField508:0}};let f=[u,...n,...a],h=new Map;for(let E of f){let _=E.id?.id||0,B=`${E.name||"<unnamed>"}(${_||"<missing-guid>"})`;!Number.isSafeInteger(_)||_<=0||_>2147483647?s.push(`${B}: GraphUnit GUID \u975E\u6CD5`):h.has(_)?s.push(`${B}: GUID \u91CD\u590D`):h.set(_,E),(E.id?.class!==1||E.id?.type!==8)&&s.push(`${B}: GraphUnit.id \u5FC5\u987B\u4E3A class=1,type=8`),E.ui?.content?.guid!==_&&s.push(`${B}: content.guid \u4E0E GraphUnit.id.id \u4E0D\u4E00\u81F4`)}let p=u.id?.id||0,m=u.ui.content,y=`${u.name||"<unnamed>"}(${p})`;u.which!==21&&s.push(`${y}: which \u5FC5\u987B\u4E3A UIControlGroup(21)`);let I=m.info||[];I.find(E=>E.field501===1&&E.field502===5)?.guid?.value!==p&&s.push(`${y}: Info.self GUID \u7F3A\u5931\u6216\u4E0D\u4E00\u81F4`),I.find(E=>E.field501===2&&E.field502===6)?.index?.value!==1&&s.push(`${y}: Info.index \u5FC5\u987B\u4E3A 1`);let b=I.find(E=>E.field501===4&&E.field502===4);b||s.push(`${y}: \u7F3A\u5C11\u663E\u5F0F Info.related \u8BB0\u5F55`);let v=0,P=0,R=(E,_,B,j=!1)=>{let re=E.id?.id||0,U=`${E.name||"<unnamed>"}(${re})`,ie=E.ui.content.data||[],Re=ie.map(oe=>`${oe.field501}/${oe.field502}`),Nt=B.map(([oe])=>oe);JSON.stringify(Re)!==JSON.stringify(Nt)&&s.push(`${U}: Data \u69FD\u4F4D\u987A\u5E8F ${Re.join(",")}\uFF0C\u5E94\u4E3A ${Nt.join(",")}`);for(let oe=0;oe<Math.min(ie.length,B.length);oe+=1){let Ge=ie[oe],[Le,ni,oi]=B[oe];if(c(Ge,ni)||s.push(`${U}: Data ${Le} \u7F3A\u5C11 ${ni} \u5206\u652F`),!oi)continue;c(Ge.details,oi)||s.push(`${U}: Details ${Le} \u7F3A\u5C11 ${oi} \u5206\u652F`);let et=_a[Le];(Ge.details?.field501!==et||Ge.details?.field502!==Ge.field502||Ge.details?.field503!==1)&&s.push(`${U}: Details ${Le} \u6807\u8BB0\u5E94\u4E3A ${et}/${Ge.field502}/1`);let ai=Ge.details?.nodeRef;(ai?.class!==1||ai?.type!==8||ai?.id!==re)&&s.push(`${U}: Details ${Le} node_ref \u672A\u6307\u5411\u81EA\u8EAB`)}let ri=ie.find(oe=>oe.field501===4&&oe.field502===(j?23:86)),ne=j?"empty15":"field17";c(ri?.field14,ne)?j||(v+=1):s.push(`${U}: \u7C7B\u578B Data \u7F3A\u5C11\u663E\u5F0F Field14.${ne} \u7A7A\u4E32`),c(ri?.details?.field14,ne)?j||(v+=1):s.push(`${U}: \u7C7B\u578B Details \u7F3A\u5C11\u663E\u5F0F Field14.${ne} \u7A7A\u4E32`);let $e=ie.find(oe=>oe.details?.transform)?.details?.transform,ht=$e?.multiPlatform?.platforms||[];ht.length!==4&&s.push(`${U}: \u591A\u5E73\u53F0\u53D8\u6362\u6570\u91CF=${ht.length}\uFF0C\u5E94\u4E3A 4`);let Bi=ht.map(oe=>oe.platformType||0);JSON.stringify(Bi)!==JSON.stringify([0,1,2,3])&&s.push(`${U}: \u5E73\u53F0\u987A\u5E8F ${Bi.join(",")}\uFF0C\u5E94\u4E3A 0,1,2,3`);let Yi=j?bi["server-container"]:bi[_];$e?.multiPlatform?.field502!==Yi&&s.push(`${U}: \u53D8\u6362 preset=${$e?.multiPlatform?.field502??"<missing>"}\uFF0C\u5E94\u4E3A ${Yi}`);for(let oe of ht)c(oe.transform,"field508")?P+=1:s.push(`${U}: RectTransform \u7F3A\u5C11\u663E\u5F0F field508 \u7A7A\u4E32`);return Re};R(u,"server-container",uu,!0);let F=(u.relatedIds||[]).map(E=>E.id||0),$=new Set(F),Y=a.filter(E=>$.has(E.id?.id||0)),G=Y.map(E=>E.id?.id||0);JSON.stringify(F)!==JSON.stringify(G)&&s.push(`${y}: \u4E3B\u56FE relatedIds \u5FC5\u987B\u6309\u987A\u5E8F\u8986\u76D6\u672C\u7EC4 accessories`);let w=m.data?.find(E=>E.details?.rootChildRef)?.details?.rootChildRef?.guid||0,A=h.get(w);(!A||!Y.includes(A))&&s.push(`${y}: 62/82 \u6839\u8282\u70B9\u5F15\u7528\u4E0D\u5B58\u5728`),G[0]!==w&&s.push(`${y}: \u6839\u5BB9\u5668\u8282\u70B9\u5FC5\u987B\u662F\u672C\u7EC4 accessories[0]`);let x=[];for(let E of Y){let _=E.id?.id||0,B=E.ui.content,j=`${E.name||"<unnamed>"}(${_})`,re=sr(E);E.which!==15&&s.push(`${j}: which \u5FC5\u987B\u4E3A UIControl(15)`);let U=B.info||[];(U.length!==1||U[0]?.field501!==1||U[0]?.field502!==5||U[0]?.guid?.value!==_)&&s.push(`${j}: \u670D\u52A1\u7AEF\u5BB9\u5668\u5185\u63A7\u4EF6 Info \u5FC5\u987B\u53EA\u542B\u81EA\u8EAB GUID`);let ie=Aa[re];ie||s.push(`${j}: \u672A\u77E5\u5BA2\u6237\u7AEF\u63A7\u4EF6\u7C7B\u578B ${re}`);let Re=ie?R(E,re,ie):[];x.push({id:_,name:E.name||"",kind:re,parent:B.parent||0,children:[...B.children||[]],relatedIds:(E.relatedIds||[]).map(Nt=>Nt.id||0),dataSignatures:Re})}let k=x.find(E=>E.id===w);k&&(k.kind!=="container"&&s.push(`${k.name}(${w}): \u6839\u63A7\u4EF6\u5FC5\u987B\u4E3A\u5BB9\u5668\u8282\u70B9`),k.parent&&s.push(`${k.name}(${w}): \u6839\u63A7\u4EF6\u4E0D\u5E94\u6709 parent`));let z=new Map(x.map(E=>[E.id,E]));for(let E of x){let _=`${E.name}(${E.id})`;if(JSON.stringify(E.relatedIds)!==JSON.stringify(E.children)&&s.push(`${_}: relatedIds \u5FC5\u987B\u4E0E\u76F4\u63A5 children \u4E00\u81F4`),E.id!==w){let B=z.get(E.parent);B?B.children.includes(E.id)||s.push(`${_}: \u7236\u63A7\u4EF6 children \u672A\u53CD\u5411\u5305\u542B\u81EA\u8EAB`):s.push(`${_}: parent=${E.parent||"<missing>"} \u4E0D\u5B58\u5728`)}for(let B of E.children){let j=z.get(B);j?j.parent!==E.id&&s.push(`${_}: child=${B} \u7684 parent \u672A\u6307\u56DE\u81EA\u8EAB`):s.push(`${_}: child=${B} \u4E0D\u5B58\u5728`)}}if(n.length){let E=An(Cn({...i,graph:n,accessories:a.filter(_=>!$.has(_.id?.id||0))}));s.push(...E.errors.map(_=>`\u5BA2\u6237\u7AEF\u6A21\u677F: ${_}`))}return{valid:s.length===0,errors:s,filePath:i.filePath||"",gameVersion:i.gameVersion||"",graph:{id:p,name:u.name||"",relatedGuids:b?.related?.value||[],rootGuid:w},accessoryCount:a.length,controls:x,scriptCount:o.length,explicitEmpty:{field17:v,rectField508:P}}}function Ya(e,t=[]){if(!e||e.layoutSchemaVersion===ve)return e;if(e.layoutSchemaVersion!==void 0&&e.layoutSchemaVersion!==1)throw new Error(`\u4EC5\u652F\u6301 layoutSchemaVersion=2 \u6216\u53EF\u8FC1\u79FB\u7684\u65E7\u5E03\u5C40\uFF0C\u6536\u5230 ${e.layoutSchemaVersion}`);if(!e.root)return{...e,layoutSchemaVersion:ve};let i=structuredClone(e),r=0;return te(i.root,n=>{let o=n.transformByPlatform||{},a=n.transformByCanvas||{},s=n.name||n.id;for(let l of Object.keys(o))if(!ue.includes(l))throw new Error(`${s}: unknown platform ${l}`);let c={};for(let l of ue){let u=Ft[l],f=K[u].platform,h=Object.keys(K).filter(I=>K[I].platform===f&&a[I]),p=a[u]?u:h[0],m=l==="CONTROLLER_CONSOLE"?c.KEYBOARD:l==="CONTROLLER_MOBILE"?c.TOUCHSCREEN:null,y=o[l]??m??(p?a[p]:null);if(c[l]=y?Be(y):on(n.kind),y||t.push(`${s}: ${l} \u65E0\u65E7\u5E03\u5C40\uFF0C\u5DF2\u4F7F\u7528\u63A7\u4EF6\u9ED8\u8BA4\u503C`),!o[l]&&!m&&p&&p!==u&&t.push(`${s}: \u7F3A\u5C11 ${u}\uFF0C\u5DF2\u91C7\u7528 ${p} \u7684\u951A\u70B9\u548C\u5C3A\u5BF8\u53C2\u6570`),!m)for(let I of h)JSON.stringify(c[l])!==JSON.stringify(Be(a[I]))&&t.push(`${s}: ${I} \u4E0E ${l} \u5E03\u5C40\u51B2\u7A81\uFF0C\u4FDD\u7559${o[l]?"\u5DF2\u6709\u5E73\u53F0":p}\u53C2\u6570`)}rt(c,`${s}.transformByPlatform`),n.transformByPlatform=c,delete n.transformByCanvas,r++}),i.layoutSchemaVersion=ve,t.unshift(`\u5DF2\u81EA\u52A8\u8FC1\u79FB\u65E7\u5E03\u5C40\uFF1A${r} \u4E2A\u63A7\u4EF6\u8F6C\u6362\u4E3A\u56DB\u5E73\u53F0\u53C2\u6570\uFF1B\u518D\u6B21\u4FDD\u5B58\u5C06\u4F7F\u7528\u65B0\u7248\u683C\u5F0F`),i}function Pn(e){if(![1,2,3,4].includes(e))throw new Error(`\u4EC5\u652F\u6301 version=1\u20134 \u7684\u5B58\u6863\uFF0C\u6536\u5230 ${e}`)}function Rn(e,t,i,r=e.canvasId){let n=ot(e.root,t);return!n||n.kind==="server-container"?we(r):i[n.id]||we(r)}function ct(e,{warnings:t=[]}={}){if(!e)return vt();if(e=Ya(e,t),(e.root||e.layoutSchemaVersion!==void 0)&&e.layoutSchemaVersion!==ve)throw new Error(`\u4EC5\u652F\u6301 layoutSchemaVersion=${ve} \u7684\u56DB\u5E73\u53F0\u5E03\u5C40\uFF0C\u4E0D\u652F\u6301\u65E7\u753B\u5E03\u5E03\u5C40\u6216\u5176\u4ED6\u7248\u672C`);let i=e.meta?.assetType==="client-control-template"?"client-control-template":"server-control-template",r=i==="client-control-template"?Vt():vt(),n={layoutSchemaVersion:ve,version:Number.isSafeInteger(e.version)&&e.version>0?e.version:1,meta:{name:String(e.meta?.name||r.meta.name),assetType:i,sourceFormat:String(e.meta?.sourceFormat||r.meta.sourceFormat),sourceFile:String(e.meta?.sourceFile||""),...e.meta?.gameVersion?{gameVersion:String(e.meta.gameVersion)}:{},...e.meta?.giaFilePath?{giaFilePath:String(e.meta.giaFilePath)}:{},...Number.isSafeInteger(Number(e.meta?.giaOwnerUid))?{giaOwnerUid:Number(e.meta.giaOwnerUid)}:{},...Number.isSafeInteger(Number(e.meta?.giaTimestamp))?{giaTimestamp:Number(e.meta.giaTimestamp)}:{},...Number.isSafeInteger(Number(e.meta?.giaFileId))?{giaFileId:Number(e.meta.giaFileId)}:{},...e.meta?.giaFileName?{giaFileName:String(e.meta.giaFileName)}:{},...Number.isSafeInteger(e.meta?.giaNextAssetIndex)&&e.meta.giaNextAssetIndex>=2?{giaNextAssetIndex:e.meta.giaNextAssetIndex}:{},...Number.isSafeInteger(e.meta?.giaAssetIndexSchemaVersion)&&e.meta.giaAssetIndexSchemaVersion>0?{giaAssetIndexSchemaVersion:e.meta.giaAssetIndexSchemaVersion}:{},...Number.isSafeInteger(Number(e.meta?.giaModeFlag))&&Number(e.meta.giaModeFlag)>=0?{giaModeFlag:Number(e.meta.giaModeFlag)}:{}},canvasId:e.canvasId&&K[e.canvasId]?e.canvasId:Ki,selectedId:e.selectedId||r.selectedId,root:ln(e.root||r.root)};return Xa(n),We(n,{warnings:t}),n}function Xa(e){let t=new Set;te(e.root,i=>{if(typeof i.id!="string"||!i.id)throw new Error("node id must be a non-empty string");if(t.has(i.id))throw new Error(`duplicate node id: ${i.id}`);t.add(i.id)}),t.has(e.selectedId)||(e.selectedId=sn(e.root).id)}function La(e){return nt(Gt(e))}function Iu(e,t){let i=!1;return te(e,r=>{r.id===t&&(i=!0)}),i}function Cu(e,t,i,r){let o=st(e.root,e.canvasId).boxes[t.id],a=i.children.findIndex(f=>f.id===t.id);if(a<0)throw new Error("reparent: source node is not attached");if(i.children.splice(a,1),r.children.push(t),!o)return;let s=st(e.root,e.canvasId),c=r.kind==="server-container"?we(e.canvasId):s.boxes[r.id]||we(e.canvasId),l=at(t.transformByPlatform,e.canvasId),u=mt(c,l,{posX:o.centerX,posY:o.centerY,width:o.width,height:o.height});jt(e,t,u)}function ku(e,t){return e.meta.assetType!=="client-control-template"?bn(e.root,t):(e.root.children||[]).flatMap(i=>bn(i,t))}function Wa(e,t){let i=wa(e.root,t);if(e.meta.assetType!=="client-control-template")return i;let r=gi(e),n=new Set;return r&&r.kind!=="server-container"&&te(r,o=>n.add(o.id)),i.filter(o=>n.has(o.id))}function Ka(e){let{canvas:t,boxes:i}=st(e.root,e.canvasId),r=wi(e),n=he(e.root,e.selectedId),o=n?i[n.id]:null;return L({layoutSchemaVersion:ve,version:e.version,meta:{...e.meta},canvasId:e.canvasId,canvas:{id:e.canvasId,width:t.width,height:t.height,platform:K[e.canvasId].platform,label:K[e.canvasId].label,presets:Object.values(K).map(a=>({id:a.id,label:a.label,width:a.width,height:a.height,platform:a.platform}))},selectedId:e.selectedId,asset:{type:e.meta.assetType,label:e.meta.assetType==="client-control-template"?"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F",templateCount:e.meta.assetType==="client-control-template"?e.root.children.length:1,currentTemplateId:e.meta.assetType==="client-control-template"&&gi(e)?.id||""},tree:ku(e,r),boxes:Wa(e,i),inspector:Sa(n,e.canvasId,o||t,r),root:e.root})}function jt(e,t,i){let r=st(e.root,e.canvasId),n=Rn(e,t.id,r.boxes),o={};if(t.syncAllDevices!==!1)for(let a of ue){if(a===gt(e.canvasId))continue;let s=Ft[a],c=st(e.root,s,a);o[a]=Rn(e,t.id,c.boxes,s)}t.transformByPlatform=na({transformByPlatform:t.transformByPlatform,source:i,canvasId:e.canvasId,syncAllDevices:t.syncAllDevices!==!1,sourceParentBox:n,targetParentBoxByPlatform:o})}var Eu=new Set(["name","active","visible","canControllerFocus","isolateNavigation","disableKeyEventPassthrough","disableCursorEventPassthrough","showCursor","fontSize","adaptiveFontSize","minimumFontSize","fontColor","bgColor","enableOutline","outlineColor","horizontalAlignment","verticalAlignment","text","imageSource","imageType","imageId","imageColor","enableMask","enableSoftEdge","softEdgeMode","softEdgeWidthX","softEdgeWidthY","horizontalSoftRange","verticalSoftRange","enableFill","fillType","fillHorizontalType","fillVerticalType","fillRadial90Type","fillRadialType","fillAmount","reverseMaskArea","raycastTarget","interactable","clickAudioId","unavailableChildId","hoverChildId","pressedChildId","selectedChildId","showScrollBar","cellSizeX","cellSizeY","spacingX","spacingY","padding1X","padding1Y","padding2X","padding2Y","previewCount","scrollDirection","layoutConstraint","referencedPrefabId","animationId","keyboardKeyCode","controllerKeyCode","itemPrefabId","layoutConstraintFixedCount"]),Au=new Set(["posX","posY","width","height"]),_u=new Set(["anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY"]);function Pu(e){if(typeof e=="number"&&Number.isFinite(e))return e>>>0;if(typeof e=="string"){let t=e.trim();if(t.startsWith("#")){let r=t.slice(1);if(r.length===6)return(4278190080|parseInt(r,16))>>>0;if(r.length===8)return parseInt(r,16)>>>0}let i=Number(t);if(Number.isFinite(i))return i>>>0}throw new Error("color must be an ARGB integer or #RRGGBB/#AARRGGBB string")}function Je(e,t){let i=Number(e);if(!Number.isFinite(i))throw new Error(`${t} must be a finite number`);return i}function ja(e){if(e===!0||e===1||e==="1"||e==="true")return!0;if(e===!1||e===0||e==="0"||e==="false")return!1;throw new Error("boolean field requires true or false")}var Tu=new Set(["fontSize","minimumFontSize","imageId","clickAudioId","softEdgeWidthX","softEdgeWidthY","horizontalSoftRange","verticalSoftRange","fillAmount","cellSizeX","cellSizeY","spacingX","spacingY","padding1X","padding1Y","padding2X","padding2Y","previewCount","keyboardKeyCode","controllerKeyCode","itemPrefabId","layoutConstraintFixedCount"]),Ru=new Set(["active","visible","canControllerFocus","isolateNavigation","disableKeyEventPassthrough","disableCursorEventPassthrough","showCursor","adaptiveFontSize","enableOutline","enableMask","enableSoftEdge","enableFill","reverseMaskArea","raycastTarget","interactable","showScrollBar"]),Mu=new Set(["name","imageSource","horizontalAlignment","verticalAlignment","text","softEdgeMode","fillType","fillHorizontalType","fillVerticalType","fillRadial90Type","fillRadialType","scrollDirection","layoutConstraint","referencedPrefabId","animationId"]),Ha=new Set(["unavailableChildId","hoverChildId","pressedChildId","selectedChildId"]),Ua={imageSource:["StaticReference","Prefab"],imageType:["Basic","Stretch",null],scrollDirection:["Horizontal","Vertical"],layoutConstraint:["AutoWrap","Fixed"],softEdgeMode:["Percentage","Pixel"],fillType:["Horizontal","Vertical","Radial90","Radial180","Radial360"],fillHorizontalType:["Left","Right"],fillVerticalType:["Bottom","Top"],fillRadial90Type:["BottomLeft","TopLeft","TopRight","BottomRight"],fillRadialType:["Bottom","Left","Top","Right"]};function Nu(e,t){if(!t||typeof t!="object")throw new Error("patch requires op");let i=t.op;if(i==="select")return t.id&&he(e.root,t.id)&&(e.selectedId=t.id),e;if(i==="pick"){let{boxes:r}=st(e.root,e.canvasId),n=Wa(e,r),o=xa(n,Number(t.x),Number(t.y));return o&&(e.selectedId=o),e}if(i==="setCanvas")return t.canvasId&&K[t.canvasId]&&(e.canvasId=t.canvasId),e;if(i==="setScript")throw new Error("\u811A\u672C\u7531\u5B58\u6863\u7EDF\u4E00\u7BA1\u7406\uFF0C\u8BF7\u4F7F\u7528 addScript / updateScript / removeScript \u64CD\u4F5C");if(i==="newAsset"){let r=t.assetType==="client-control-template"?Vt():vt();return e.version=r.version,e.meta=r.meta,e.canvasId=r.canvasId,e.selectedId=r.selectedId,e.root=r.root,e}if(i==="addTemplate"){if(e.meta.assetType!=="client-control-template")throw new Error("\u53EA\u6709\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5DE5\u7A0B\u53EF\u4EE5\u65B0\u589E\u6A21\u677F");let r=q(t.kind,{id:an(e.root),guid:La(e.root),name:t.name||`\u65B0${t.kind==="container"?"\u5BB9\u5668\u8282\u70B9":t.kind}\u6A21\u677F`});return e.root.children.push(r),e.selectedId=r.id,e}if(i==="add"){let r=he(e.root,t.parentId||e.selectedId);if(!r)throw new Error("add: parent not found");let n=ta(r,t.kind,{id:an(e.root),guid:La(e.root),name:t.name});return e.selectedId=n.id,e}if(i==="reparent"){if(e.meta.assetType!=="client-control-template")throw new Error("\u5C42\u7EA7\u8C03\u6574\u4EC5\u9002\u7528\u4E8E\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5DE5\u7A0B");let r=he(e.root,t.id||e.selectedId),n=r?ot(e.root,r.id):null,o=he(e.root,t.parentId);if(!r||r.kind==="server-container"||!n)throw new Error("reparent: node not found");if(!o)throw new Error("reparent: parent not found");if(o.id===r.id||Iu(r,o.id))throw new Error("\u63A7\u4EF6\u4E0D\u80FD\u79FB\u52A8\u5230\u81EA\u8EAB\u6216\u5176\u540E\u4EE3\u4E0B\u9762");if(o.kind==="server-container"&&n.kind==="server-container")return e;if(n.kind==="server-container"&&o.kind!=="server-container"&&e.root.children.length<=1)throw new Error("\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868\u81F3\u5C11\u4FDD\u7559\u4E00\u4E2A\u9876\u5C42\u6A21\u677F");return Cu(e,r,n,o),e.selectedId=r.id,e}if(i==="moveSibling"){let r=he(e.root,t.id||e.selectedId),n=r?ot(e.root,r.id):null;if(!r||!n)throw new Error("moveSibling: node not found");let o=n.children.findIndex(c=>c.id===r.id),a=t.direction==="up"?-1:t.direction==="down"?1:0,s=o+a;return!a||s<0||s>=n.children.length||(n.children.splice(o,1),n.children.splice(s,0,r),e.selectedId=r.id),e}if(i==="remove"){let r=t.id||e.selectedId,n=ot(e.root,r);if(n?.kind==="server-container"){if(e.meta.assetType!=="client-control-template")throw new Error("\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F\u7684\u5BA2\u6237\u7AEF\u6839\u8282\u70B9\u4E0D\u80FD\u5220\u9664");if((e.root.children||[]).length<=1)throw new Error("\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868\u81F3\u5C11\u4FDD\u7559\u4E00\u4E2A\u6A21\u677F")}return ia(e.root,r)&&(te(e.root,o=>{if(o.kind==="button")for(let a of Ha)o[a]&&!he(e.root,o[a])&&(o[a]=null)}),e.selectedId=n?n.id:e.root.id),e}if(i==="set"){let r=he(e.root,t.id||e.selectedId);if(!r)throw new Error("set: node not found");let n=t.key;n==="reverseMask"&&(n="reverseMaskArea");let o=t.value;if(r.kind==="reference"&&["referencedPrefabId","giaRaw.templateRefSlot"].includes(n)&&(r.giaRaw.templateRefSlotBase64||r.giaRaw.templateRefOuterBase64))throw new Error("\u8BE5\u6A21\u677F\u5F15\u7528\u542B\u5C1A\u672A\u89E3\u6790\u7684\u539F\u59CB\u914D\u7F6E\uFF0C\u6682\u4E0D\u80FD\u6539\u5199\u76EE\u6807\u7D22\u5F15\uFF1B\u8BF7\u5728\u5B98\u65B9\u7F16\u8F91\u5668\u4FEE\u6539\u540E\u91CD\u65B0\u5BFC\u5165");if(n.startsWith("giaRaw.")){let l=n.slice(7);if(!l||l.includes("."))throw new Error("invalid raw GIA field path");let u=Qo(r.kind,l);if(!u)throw new Error(`unknown raw GIA field for ${r.kind}: ${l}`);if(r.giaRaw||={},r.giaRaw[l]=en(u,o),l==="footerField505"&&[0,1].includes(r.giaRaw[l])&&(r.canControllerFocus=r.giaRaw[l]===1),r.kind==="cursor"&&l==="cursorField501"&&[0,1].includes(r.giaRaw[l])&&(r.raycastTarget=r.giaRaw[l]===1),(r.kind==="textbox"||r.kind==="textwindow")&&l==="textAlign"){let f={0:"Left",1:"Middle",2:"Right"}[r.giaRaw[l]];f&&(r.horizontalAlignment=f)}if(r.kind==="image"&&l==="imageFillType"){let f={1:"Horizontal",2:"Vertical",3:"Radial90",4:"Radial180",5:"Radial360"}[r.giaRaw[l]];f&&(r.fillType=f)}return r.kind==="keyhint"&&l==="keyHintField502"&&(r.keyboardKeyCode=r.giaRaw[l]),r.kind==="keyhint"&&l==="keyHintField501"&&(r.controllerKeyCode=r.giaRaw[l]),e}if(n==="syncAllDevices"){if(r.syncAllDevices=ja(o),r.syncAllDevices){let l=at(r.transformByPlatform,e.canvasId);jt(e,r,l)}return e}if(Eu.has(n)){if(n.endsWith("Color")&&(o=Pu(o)),Tu.has(n)){if(o=Je(o,n),o<0)throw new Error(`${n} must not be negative`);if((n==="imageId"||n==="clickAudioId"||n==="keyboardKeyCode"||n==="controllerKeyCode")&&(o=Math.trunc(o)),n==="fillAmount"&&o>1)throw new Error("fillAmount must be between 0 and 1")}if(Ru.has(n)&&(o=ja(o)),Mu.has(n)&&(o=String(o??"")),n==="horizontalAlignment"&&!["Left","Middle","Right"].includes(o))throw new Error("invalid horizontalAlignment");if(n==="verticalAlignment"&&!["Top","Middle","Bottom"].includes(o))throw new Error("invalid verticalAlignment");if(Ua[n]&&!Ua[n].includes(o))throw new Error(`invalid ${n}`);if(Ha.has(n))if(o===""||o===void 0||o===null)o=null;else{o=String(o);let l=he(e.root,o);if(!l||l===r||l.kind==="server-container"||!(r.children||[]).some(u=>u.id===o))throw new Error(`${n} must reference a direct child of this button`)}if(r.kind==="image"&&(n==="imageSource"||n==="imageId")&&r[n]!==o&&(r.imageType=null,r.giaRaw.imageSlotType=0),r[n]=o,r.kind==="image"&&n==="imageType"&&(r.giaRaw.imageSlotType=o==="Stretch"?1:0),n==="canControllerFocus"&&(r.giaRaw.footerField505=o?1:0),r.kind==="cursor"&&n==="raycastTarget"&&(r.giaRaw.cursorField501=o?1:0),(r.kind==="textbox"||r.kind==="textwindow")&&n==="horizontalAlignment"&&(r.giaRaw.textAlign={Left:0,Middle:1,Right:2}[o]),(r.kind==="textbox"||r.kind==="textwindow")&&n==="verticalAlignment"&&delete r.giaRaw.textVerticalAlign,r.kind==="image"&&n==="fillType"){let l={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[o];l&&(r.giaRaw.imageFillType=l)}return r.kind==="reference"&&n==="referencedPrefabId"&&(r.giaRaw.templateRefSlot=o),r.kind==="grid"&&n==="previewCount"&&(r.giaRaw.gridField511=Math.trunc(o)),r.kind==="keyhint"&&n==="keyboardKeyCode"&&(r.giaRaw.keyHintField502=Math.trunc(o)),r.kind==="keyhint"&&n==="controllerKeyCode"&&(r.giaRaw.keyHintField501=Math.trunc(o)),(r.kind==="animation"||r.kind==="fullscreen")&&n==="animationId"&&(r.giaRaw[r.kind==="animation"?"effectSlot":"fullscreenEffectSlot"]=o),e}let{boxes:a}=st(e.root,e.canvasId),s=Rn(e,r.id,a),c=at(r.transformByPlatform,e.canvasId);if(n==="anchorType"){let l=Tn(a[r.id]),u=Xo(c,o);return u=mt(s,u,l),jt(e,r,u),e}if(["rotationX","rotationY","rotationZ"].includes(n)){let l={...c,rotation:{...c.rotation,[n.slice(-1).toLowerCase()]:Je(o,n)}};return jt(e,r,l),e}if(_u.has(n)){let l=Tn(a[r.id]),u={...c,anchorMin:{...c.anchorMin},anchorMax:{...c.anchorMax},pivot:{...c.pivot}};return n==="anchorMinX"&&(u.anchorMin.x=Je(o,n)),n==="anchorMinY"&&(u.anchorMin.y=Je(o,n)),n==="anchorMaxX"&&(u.anchorMax.x=Je(o,n)),n==="anchorMaxY"&&(u.anchorMax.y=Je(o,n)),n==="pivotX"&&(u.pivot.x=Je(o,n)),n==="pivotY"&&(u.pivot.y=Je(o,n)),jt(e,r,mt(s,u,l)),e}if(Au.has(n)){let l=Tn(a[r.id]),u=Je(o,n);if((n==="width"||n==="height")&&u<0)throw new Error(`${n} must not be negative`);return l[n]=u,jt(e,r,mt(s,c,l)),e}throw new Error(`set: unknown key ${n}`)}if(i==="replace"){let r=ct(t.project);return e.version=r.version,e.meta=r.meta,e.canvasId=r.canvasId,e.selectedId=r.selectedId,e.root=r.root,e}throw new Error(`unknown op ${i}`)}function Mn(e,t){if(!t||typeof t!="object")throw new Error("patch requires op");if(t.expectedRevision!==void 0&&Number(t.expectedRevision)!==e.version)throw new Error(`revision conflict: expected ${t.expectedRevision}, current ${e.version}`);let i=e.version,r=JSON.parse(JSON.stringify(e));return Nu(r,t),Xa(r),We(r),r.version=i+1,Object.keys(e).forEach(n=>{delete e[n]}),Object.assign(e,r),e}function Tn(e){return e?{posX:e.centerX,posY:e.centerY,width:e.width,height:e.height}:{posX:0,posY:0,width:0,height:0}}import Fu from"fengari";var{lua:d,lauxlib:Q,lualib:qa,to_luastring:cr,to_jsstring:Ou}=Fu,zu=d.LUA_TNIL,Du=d.LUA_TBOOLEAN,$u=d.LUA_TNUMBER,Gu=d.LUA_TSTRING,Ja=d.LUA_TTABLE,Vu=d.LUA_TFUNCTION,Nn=d.LUA_TUSERDATA,Oe=d.LUA_OK,Qa=new WeakMap,Fn=Symbol("luaTableEntries"),On={__scriptHostKey:!0};function M(e){return cr(String(e))}function xt(e,t){Qa.set(e,t)}function Ee(e){return Qa.get(e)}var Si=class{constructor(t){this.value=t}};function le(e,t,i){if(i instanceof Si){d.lua_pushnumber(e,i.value);return}if(i==null){d.lua_pushnil(e);return}let r=typeof i;if(r==="boolean"){d.lua_pushboolean(e,i);return}if(r==="number"){Number.isInteger(i)&&Math.abs(i)<=2147483647?d.lua_pushinteger(e,i):d.lua_pushnumber(e,i);return}if(r==="string"){d.lua_pushstring(e,M(i));return}if(r==="function"){Lu(e,t,i);return}if(i&&i[Fn]){let n=i[Fn];d.lua_createtable(e,Array.isArray(i)?i.length:0,n.length);for(let[o,a]of n)le(e,t,o),le(e,t,a),d.lua_settable(e,-3);return}if(Array.isArray(i)){d.lua_createtable(e,i.length,0);for(let n=0;n<i.length;n++)le(e,t,i[n]),d.lua_rawseti(e,-2,n+1);return}if(i&&i.__kind==="EnumItem"){t.pushEnumItem(e,i);return}if(i&&i.__kind==="CursorEventData"){t.pushCursor(e,i);return}if(i&&i.__kind==="Script"){t.pushScript(e,i);return}if(i&&i.typeofName){t.pushControl(e,i);return}if(i&&i.__kind==="ServerSignal"){t.pushSignal(e,i);return}if(i&&(i.SetEase||i.Append)){t.pushTween(e,i);return}if(r==="object"){d.lua_createtable(e,0,Object.keys(i).length);for(let[n,o]of Object.entries(i))le(e,t,o),d.lua_setfield(e,-2,M(n));return}d.lua_pushnil(e)}function Z(e,t){if(d.lua_isnil(e,t)||d.lua_type(e,t)===d.LUA_TNONE)return"";if(!d.lua_isstring(e,t)&&d.lua_type(e,t)!==d.LUA_TNUMBER)return`lua_type=${d.lua_type(e,t)}`;let i=d.lua_tostring(e,t);return i==null?"":Ou(i)}function Qe(e,t){t=d.lua_absindex(e,t);let i=d.lua_type(e,t);if(i===Nn)return Ee(d.lua_touserdata(e,t));if(i===Ja){d.lua_pushlightuserdata(e,On),d.lua_rawget(e,t);let r=d.lua_type(e,-1)===Nn?d.lua_touserdata(e,-1):null;return d.lua_pop(e,1),r?Ee(r):null}return null}function me(e,t,i){i=d.lua_absindex(e,i);let r=d.lua_type(e,i);if(r===zu)return null;if(r===Du)return!!d.lua_toboolean(e,i);if(r===$u)return d.lua_isinteger(e,i)?d.lua_tointeger(e,i):d.lua_tonumber(e,i);if(r===Gu)return Z(e,i);if(r===Nn){let n=d.lua_touserdata(e,i);return Ee(n)??n}if(r===Vu)return Bu(e,t,i);if(r===Ja){let n=Qe(e,i);if(n)return n;let o=[];for(d.lua_pushnil(e);d.lua_next(e,i)!==0;){let l=me(e,t,-2),u=me(e,t,-1);o.push([l,u]),d.lua_pop(e,1)}let a=new Map(o.filter(([l])=>Number.isInteger(l)&&l>=1)),s=0;for(;a.has(s+1);)s+=1;let c=s>0?[]:{};for(let[l,u]of o)Array.isArray(c)&&Number.isInteger(l)&&l>=1?c[l-1]=u:(typeof l=="string"||typeof l=="number")&&(c[l]=u);return Object.defineProperty(c,Fn,{value:o}),c}return null}function Bu(e,t,i){t.luaFunctions||(t.luaFunctions=new Map);let r=typeof d.lua_topointer=="function"?d.lua_topointer(e,i):null;if(r!=null&&t.luaFunctions.has(r))return t.luaFunctions.get(r);d.lua_pushvalue(e,i);let n=Q.luaL_ref(e,d.LUA_REGISTRYINDEX),o=Yu(e,t,n);return r!=null&&t.luaFunctions.set(r,o),o}function Yu(e,t,i){let r=(...n)=>{if(r.__luaRef==null)throw new Error("attempt to call a released Lua callback");let o=d.lua_gettop(e);d.lua_rawgeti(e,d.LUA_REGISTRYINDEX,r.__luaRef);for(let l of n)le(e,t,l);if(d.lua_pcall(e,n.length,d.LUA_MULTRET,0)!==Oe){let l=Z(e,-1);throw d.lua_settop(e,o),new Error(l)}let s=d.lua_gettop(e)-o,c=[];for(let l=1;l<=s;l++)c.push(me(e,t,o+l));if(d.lua_settop(e,o),c.length!==0)return c.length===1?c[0]:c};return r.__luaRef=i,r.__luaState=e,r}function Za(e){e?.__luaRef!=null&&(e.__luaHolds=(e.__luaHolds||0)+1)}function es(e,t){if(!t||t.__luaRef==null||!t.__luaState)return;if(t.__luaHolds>1){t.__luaHolds-=1;return}let i=t.__luaState;if((!e?.luaStates||e.luaStates.has(i))&&Q.luaL_unref(i,d.LUA_REGISTRYINDEX,t.__luaRef),t.__luaRef=null,t.__luaState=null,e?.luaFunctions)for(let[r,n]of e.luaFunctions)n===t&&e.luaFunctions.delete(r)}function Lu(e,t,i){d.lua_pushlightuserdata(e,i),d.lua_pushlightuserdata(e,t),d.lua_pushcclosure(e,function(n){let o=d.lua_touserdata(n,d.lua_upvalueindex(1)),a=d.lua_touserdata(n,d.lua_upvalueindex(2)),s=d.lua_gettop(n),c=[];for(let l=1;l<=s;l++)c.push(me(n,a,l));try{let l=o(...c);if(Array.isArray(l)&&l.__multi){for(let u of l)le(n,a,u);return l.length}return l===void 0?0:(le(n,a,l),1)}catch(l){return d.lua_pushstring(n,M(String(l&&l.message?l.message:l))),d.lua_error(n)}},2)}function ts(e){!e||typeof d.lua_close!="function"||d.lua_close(e)}function is(e){if(Q.luaL_loadstring(e,M(["local nativeGetMetatable = getmetatable","getmetatable = function(value)",' if type(value) == "string" then return nil end'," return nativeGetMetatable(value)","end"].join(`
|
|
111
|
-
`)))===Oe&&d.lua_pcall(e,0,0,0),d.lua_settop(e,0),d.lua_pushnil(e),d.lua_setglobal(e,M("_VERSION")),d.lua_getglobal(e,M("string")),!d.lua_isnil(e,-1))for(let i of["dump","pack","unpack"])d.lua_pushnil(e),d.lua_setfield(e,-2,M(i));if(d.lua_pop(e,1),d.lua_pushnil(e),d.lua_setglobal(e,M("io")),d.lua_getglobal(e,M("os")),!d.lua_isnil(e,-1))for(let i of Object.keys({execute:1,getenv:1,remove:1,rename:1,tmpname:1,setlocale:1,exit:1}))d.lua_pushnil(e),d.lua_setfield(e,-2,M(i));d.lua_pop(e,1),d.lua_getglobal(e,M("debug")),d.lua_isnil(e,-1)?d.lua_pop(e,1):(d.lua_getfield(e,-1,M("traceback")),d.lua_newtable(e),d.lua_pushvalue(e,-2),d.lua_setfield(e,-2,M("traceback")),d.lua_setglobal(e,M("debug")),d.lua_pop(e,2)),d.lua_getglobal(e,M("math")),d.lua_isnil(e,-1)||(d.lua_pushcfunction(e,i=>{let r=d.lua_tonumber(i,1);return d.lua_pushboolean(i,Number.isNaN(r)),1}),d.lua_setfield(e,-2,M("isnan")),d.lua_pushcfunction(e,i=>{let r=d.lua_tonumber(i,1);return d.lua_pushboolean(i,r===1/0||r===-1/0),1}),d.lua_setfield(e,-2,M("isinf"))),d.lua_pop(e,1),d.lua_pushnil(e),d.lua_setglobal(e,M("package")),d.lua_pushnil(e),d.lua_setglobal(e,M("load")),d.lua_pushnil(e),d.lua_setglobal(e,M("loadfile")),d.lua_pushnil(e),d.lua_setglobal(e,M("dofile")),d.lua_pushnil(e),d.lua_setglobal(e,M("collectgarbage")),d.lua_pushnil(e),d.lua_setglobal(e,M("coroutine")),d.lua_pushnil(e),d.lua_setglobal(e,M("fengari"))}var Pe=(e,t=0)=>Number.isFinite(Number(e))?Number(e):t,rs=e=>e?.Name||e,ur=e=>Math.max(0,Math.min(1,Pe(e)));function xi(e){let t=e.parent?xi(e.parent):[e.runtime.canvasWidth,e.runtime.canvasHeight];return[Math.max(0,(e.anchorMaxX-e.anchorMinX)*t[0]+Pe(e.sizeDeltaX)),Math.max(0,(e.anchorMaxY-e.anchorMinY)*t[1]+Pe(e.sizeDeltaY))]}function Ii(e){let[t,i]=xi(e),r=rs(e.scrollDirection)==="Horizontal",n=Math.max(1,Pe(e.cellSizeX,50)),o=Math.max(1,Pe(e.cellSizeY,50)),a=Math.max(0,Pe(e.spacingX)),s=Math.max(0,Pe(e.spacingY)),c=Math.max(0,Pe(e.padding1X)),l=Math.max(0,Pe(e.padding1Y)),u=Math.max(0,Pe(e.padding2X)),f=Math.max(0,Pe(e.padding2Y)),h=r?i-l-f:t-c-u,p=r?o:n,m=r?s:a,y=rs(e.layoutConstraint)==="Fixed"?Math.max(1,Math.floor(Pe(e.layoutConstraintFixedCount,1))):Math.max(1,Math.floor((h+m)/(p+m))),I=Math.ceil(e.itemCount/y),b=I?r?c+u+I*n+(I-1)*a:l+f+I*o+(I-1)*s:0,v=r?t:i,P=Math.max(0,b-v);return{width:t,height:i,horizontal:r,cellW:n,cellH:o,gapX:a,gapY:s,left:c,top:l,right:u,bottom:f,lanes:y,length:b,viewport:v,max:P,offset:ur(e.scrollProgress)*P}}function Ht(e){let t=Ii(e);for(let i=0;i<(e._gridItems?.length||0);i+=1){let r=e._gridItems[i];if(!r.alive||r.parent!==e)continue;let n=Math.floor(i/t.lanes),o=i%t.lanes,a=t.horizontal?n:o,s=t.horizontal?o:n,c=t.left+a*(t.cellW+t.gapX)+t.cellW/2-(t.horizontal?t.offset:0),l=-t.top-s*(t.cellH+t.gapY)-t.cellH/2+(t.horizontal?0:t.offset),u={anchorMinX:0,anchorMaxX:0,anchorMinY:1,anchorMaxY:1,pivotX:.5,pivotY:.5,sizeDeltaX:t.cellW,sizeDeltaY:t.cellH,anchoredPositionX:c,anchoredPositionY:l};Object.entries(u).some(([f,h])=>r[f]!==h)&&(Object.assign(r,u),r.markPlayDirty(!0))}return t}var ns={container:"ClientUIContainerControl",textbox:"ClientUITextBoxControl",textwindow:"ClientUITextWindowControl",image:"ClientUIImageControl",button:"ClientUIPresetButtonControl",cursor:"ClientUICursorEventAreaControl",grid:"ClientUIGridScrollerControl",keyhint:"ClientUIKeyHintControl",animation:"ClientUIAnimationControl",fullscreen:"ClientUIFullscreenAnimationControl",reference:"ClientUIReferenceControl"},ju=["alive","Id","prefabIndex","active","activeInHierarchy","visible"],fr=new Set(["active","visible","parent","sizeDeltaX","sizeDeltaY","anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY"]),Hu=["name","parent","anchoredPositionX","anchoredPositionY","sizeDeltaX","sizeDeltaY","anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY","localScaleX","localScaleY","localScaleZ","localRotationX","localRotationY","localRotationZ","canControllerFocus"],Uu={image:["imageSource","imageId"],grid:["itemCount","scrollDirection","layoutConstraint","layoutConstraintFixedCount"],reference:["referencedPrefabIndex"]},Xu={container:["isolateNavigation","disableKeyEventPassthrough","disableCursorEventPassthrough","showCursor"],textbox:["text","fontSize","fontColor","bgColor","enableOutline","outlineColor","horizontalAlignment","verticalAlignment","adaptiveFontSize","minimumFontSize"],textwindow:["interactable","showScrollBar","text","fontSize","fontColor","bgColor","enableOutline","outlineColor","horizontalAlignment","verticalAlignment","adaptiveFontSize","minimumFontSize"],image:["imageColor","enableMask","enableSoftEdge","softEdgeMode","softEdgeWidthX","softEdgeWidthY","horizontalSoftRange","verticalSoftRange","reverseMaskArea","fillType","fillHorizontalType","fillVerticalType","fillRadial90Type","fillRadialType","fillAmount"],button:["interactable","clickAudioId","raycastTarget"],cursor:["raycastTarget"],grid:["itemPrefabIndex","raycastTarget","showScrollBar","interactable","scrollProgress"],keyhint:["keyboardKeyCode","controllerKeyCode"],animation:["animationId","playSoundEffect","layer"],fullscreen:["animationId","playSoundEffect"]},Wu=["GetChildren","GetChild","FindChild","SetActive","SetVisible","GetSiblingIndex","SetSiblingIndex","SetAsFirstSibling","SetAsLastSibling","GetAnchoredPosition","SetAnchoredPosition","GetSizeDelta","SetSizeDelta","GetAnchorMin","SetAnchorMin","GetAnchorMax","SetAnchorMax","GetPivot","SetPivot","GetLocalScale","SetLocalScale","GetLocalRotation","SetLocalRotation","GetScriptByPath","GetScript","GetScripts","AddKeyEventListener","RemoveKeyEventListener","RemoveKeyEventListeners","RemoveAllKeyEventListeners","AddNavigationEventListener","RemoveNavigationEventListener","RemoveNavigationEventListeners","RemoveAllNavigationEventListeners","SetControllerNavigation","GetControllerNavigation"],os=["AddCursorEventListener","RemoveCursorEventListener","RemoveCursorEventListeners","RemoveAllCursorEventListeners","SimulateCursorClick"],Ku={image:["SetImage","SetSoftEdgeWidth","SetFillUnused","SetFillHorizontal","SetFillVertical","SetFillRadial90","SetFillRadial180","SetFillRadial360"],button:os,cursor:os,animation:["PlayAnimation","StopAnimation"],grid:["RefreshItems","GetItemIndex","GetItemSize","GetItemSpacing","GetPadding","ScrollToItemAt","GetContentLength"]};function Dn(e,t){return e.kind==="image"&&t==="imageType"&&e.runtime.canSelectImageType(e.imageId,e.imageSource)?"rw":ju.includes(t)||(Uu[e.kind]||[]).includes(t)?"ro":Hu.includes(t)||(Xu[e.kind]||[]).includes(t)?"rw":null}var qu=["localRotationX","localRotationY","localRotationZ"],Ut=Math.PI/180;function as(e,t){return[e[3]*t[0]+e[0]*t[3]+e[1]*t[2]-e[2]*t[1],e[3]*t[1]-e[0]*t[2]+e[1]*t[3]+e[2]*t[0],e[3]*t[2]+e[0]*t[1]-e[1]*t[0]+e[2]*t[3],e[3]*t[3]-e[0]*t[0]-e[1]*t[1]-e[2]*t[2]]}function zn(e){if(Object.is(e,-0))return e;let t=(e%360+360)%360,i=Math.round(t*1e6)/1e6;return i>=360?0:i}function ss(e,t,i){let r=v=>[Math.sin(v*Ut/2),Math.cos(v*Ut/2)],[n,o]=r(e),[a,s]=r(t),[c,l]=r(i),[u,f,h,p]=as(as([0,a,0,s],[n,0,0,o]),[0,0,c,l]),m=Math.max(-1,Math.min(1,-2*(f*h-p*u))),y,I,b;return Math.abs(m)>.999999?(y=Math.sign(m)*90,I=2*Math.atan2(f,p)/Ut,b=0):(y=Math.asin(m)/Ut,I=Math.atan2(2*(p*f+u*h),1-2*(u*u+f*f))/Ut,b=Math.atan2(2*(p*h+u*f),1-2*(u*u+h*h))/Ut),[zn(y),zn(I),zn(b)]}function ls(e,t){return Wu.includes(t)||(Ku[e.kind]||[]).includes(t)}var Ju={container:{isolateNavigation:!1,disableKeyEventPassthrough:!1,disableCursorEventPassthrough:!1,showCursor:!1},textbox:{text:"",fontSize:20,fontColor:4294967295,bgColor:0,enableOutline:!1,outlineColor:0,horizontalAlignment:null,verticalAlignment:null,adaptiveFontSize:!1,minimumFontSize:10},textwindow:{interactable:!0,showScrollBar:!0,text:"",fontSize:20,fontColor:4294967295,bgColor:0,enableOutline:!1,outlineColor:0,horizontalAlignment:null,verticalAlignment:null,adaptiveFontSize:!1,minimumFontSize:10},image:{imageSource:null,imageId:0,imageColor:4294967295,imageType:null,enableMask:!1,enableSoftEdge:!1,softEdgeMode:"Percentage",softEdgeWidthX:8,softEdgeWidthY:8,horizontalSoftRange:85,verticalSoftRange:85,enableFill:!1,fillType:"Unused",fillHorizontalType:"Left",fillVerticalType:"Bottom",fillRadial90Type:"BottomLeft",fillRadialType:"Bottom",reverseMaskArea:!1,fillAmount:1},button:{interactable:!0,clickAudioId:0,raycastTarget:!0,unavailableChildId:null,hoverChildId:null,pressedChildId:null,selectedChildId:null,pressed:!1},cursor:{raycastTarget:!0},grid:{itemCount:0,itemPrefabIndex:null,raycastTarget:!0,interactable:!0,showScrollBar:!0,scrollDirection:"Vertical",layoutConstraint:"AutoWrap",layoutConstraintFixedCount:null,scrollProgress:0,cellSizeX:50,cellSizeY:50,spacingX:8,spacingY:8,padding1X:20,padding1Y:20,padding2X:20,padding2Y:20,previewCount:5},keyhint:{keyboardKeyCode:null,controllerKeyCode:null},animation:{animationId:null,playSoundEffect:null,layer:null,raycastTarget:!1},fullscreen:{animationId:null,playSoundEffect:null,raycastTarget:!1},reference:{referencedPrefabIndex:null}},ut=class e{constructor(t,i){this.runtime=t,this.kind=i.kind||"container",this.typeofName=ns[this.kind]||ns.container,this.alive=!0,this.Id=i.Id??t.nextControlId(),this.authoringId=i.authoringId??null,this.prefabIndex=i.prefabIndex??0,this.name=i.name??"",this.active=i.active===!0,this.visible=i.visible!==!1,this._parent=null,this.children=[],this.scripts=[],this.cursorListeners=new Map,this.keyListeners=new Map,this.navListeners=new Map,this.navConfig=new Map,this.anchoredPositionX=i.anchoredPositionX??0,this.anchoredPositionY=i.anchoredPositionY??0,this.sizeDeltaX=i.sizeDeltaX??0,this.sizeDeltaY=i.sizeDeltaY??0,this.anchorMinX=i.anchorMinX??.5,this.anchorMinY=i.anchorMinY??.5,this.anchorMaxX=i.anchorMaxX??.5,this.anchorMaxY=i.anchorMaxY??.5,this.pivotX=i.pivotX??.5,this.pivotY=i.pivotY??.5,this.localScaleX=i.localScaleX??1,this.localScaleY=i.localScaleY??1,this.localScaleZ=i.localScaleZ??1,this.localRotationX=i.localRotationX??0,this.localRotationY=i.localRotationY??0,this.localRotationZ=i.localRotationZ??0,this.canControllerFocus=i.canControllerFocus??!1,this._playDirty=!0,this._playDeepDirty=!0,this._playChildDirty=!1,(this.kind==="grid"||this.kind==="textwindow")&&(this.runtime.scrollControls||=new Set,this.runtime.scrollControls.add(this));let r=Ju[this.kind]||{};for(let[n,o]of Object.entries(r))this[n]===void 0&&(this[n]=i[n]!==void 0?i[n]:o);if(this.kind==="grid"&&(this.scrollProgress=i.scrollProgress??0),i.children)for(let n of i.children){let o=n instanceof e?n:new e(t,n);this.addChild(o)}}get parent(){return this._parent}set parent(t){if(this._parent===t)return;if(t!==null&&!(t instanceof e))throw new Error("parent must be a Control or nil");if(t&&t.runtime!==this.runtime)throw new Error("parent must belong to the same runtime");if(t===this)throw new Error("cannot parent a control to itself or its descendant");for(let r=t;r;r=r._parent)if(r===this)throw new Error("cannot parent a control to itself or its descendant");let i=this._parent;if(i){let r=i.children.indexOf(this);r>=0&&i.children.splice(r,1),i.markPlayDirty(!0)}else{let r=this.runtime.roots.indexOf(this);r>=0&&this.runtime.roots.splice(r,1)}this._parent=t,this.markPlayDirty(!0),t&&!t.children.includes(this)?(t.children.push(this),t.markPlayDirty(!0)):!t&&this.alive&&!this.runtime.roots.includes(this)&&this.runtime.roots.push(this)}markPlayDirty(t=!1){this._playDirty=!0,t&&(this._playDeepDirty=!0);for(let i=this._parent;i&&!i._playChildDirty;i=i._parent)i._playChildDirty=!0}get activeInHierarchy(){return this.active?this._parent?this._parent.activeInHierarchy:!0:!1}get scrollProgress(){return this._scrollProgress??0}set scrollProgress(t){if(typeof t!="number"||!Number.isFinite(t))throw new Error("scrollProgress must be a finite number");this._scrollProgress=ur(t),this.markPlayDirty()}addChild(t){return t.parent=this,t}GetChildren(){return this.children.slice()}GetChild(t){return this.children.find(i=>i.name===t)||null}FindChild(t){if(!t)return null;if(!t.includes("/"))return this.GetChild(t);let i=t.split("/").filter(Boolean),r=this;for(let n of i)if(r=r.GetChild(n),!r)return null;return r}SetActive(t){let i=!!t;if(this.active!==i){if(typeof this.runtime?.onControlActiveChanging=="function"){this.runtime.onControlActiveChanging(this,i);return}this.active=i,this.markPlayDirty(!0)}}SetVisible(t){this.visible=!!t,this.markPlayDirty(!0)}GetSiblingIndex(){if(!this._parent)return-1;let t=this._parent.children,i=t.indexOf(this);return i<0?-1:t.length-1-i}SetSiblingIndex(t){if(!this._parent)return!1;let i=this._parent.children,r=i.indexOf(this);if(r<0)return!1;let n=i.length-1;return!Number.isInteger(t)||t<0||t>n?!1:(i.splice(r,1),i.splice(n-t,0,this),this._parent.markPlayDirty(!0),this.markPlayDirty(),!0)}SetAsFirstSibling(){return this.SetSiblingIndex(0)}SetAsLastSibling(){return this._parent?this.SetSiblingIndex(this._parent.children.length-1):!1}GetAnchoredPosition(){return[this.anchoredPositionX,this.anchoredPositionY]}SetAnchoredPosition(t,i){this.anchoredPositionX=t,this.anchoredPositionY=i,this.markPlayDirty()}GetSizeDelta(){return[this.sizeDeltaX,this.sizeDeltaY]}SetSizeDelta(t,i){this.sizeDeltaX=t,this.sizeDeltaY=i,this.markPlayDirty(!0)}GetAnchorMin(){return[this.anchorMinX,this.anchorMinY]}SetAnchorMin(t,i){this.anchorMinX=t,this.anchorMinY=i,this.markPlayDirty(!0)}GetAnchorMax(){return[this.anchorMaxX,this.anchorMaxY]}SetAnchorMax(t,i){this.anchorMaxX=t,this.anchorMaxY=i,this.markPlayDirty(!0)}GetPivot(){return[this.pivotX,this.pivotY]}SetPivot(t,i){this.pivotX=t,this.pivotY=i,this.markPlayDirty(!0)}GetLocalScale(){return[this.localScaleX,this.localScaleY,this.localScaleZ]}SetLocalScale(t,i,r){this.localScaleX=t,this.localScaleY=i,this.localScaleZ=r,this.markPlayDirty()}GetLocalRotation(){return ss(this.localRotationX,this.localRotationY,this.localRotationZ)}luaFieldValue(t){if(t==="imageType")return this.imageType??"Stretch";let i=qu.indexOf(t);return i<0?this[t]:ss(this.localRotationX,this.localRotationY,this.localRotationZ)[i]}SetLocalRotation(t,i,r){this.localRotationX=t,this.localRotationY=i,this.localRotationZ=r,this.markPlayDirty()}GetScriptByPath(t){return this.scripts.find(i=>i.path===t)||null}GetScript(t){return this.scripts.find(i=>i.scriptMappingId===t)||null}GetScripts(){return this.scripts.slice()}_addListener(t,i,r){let n=t.get(i)||[];n.push(r),t.set(i,n),this.runtime.retainLuaCallback?.(r)}_removeListener(t,i,r){let n=t.get(i);if(!n)return;let o=n.filter(a=>a!==r);t.set(i,o);for(let a=o.length;a<n.length;a++)this.runtime.unrefLuaCallback?.(r)}_removeListeners(t,i){let r=t.get(i)||[];for(let n of r)this.runtime.unrefLuaCallback?.(n);t.delete(i)}_removeAllListeners(t){for(let i of t.values())for(let r of i)this.runtime.unrefLuaCallback?.(r);t.clear()}AddCursorEventListener(t,i){this._addListener(this.cursorListeners,t,i)}RemoveCursorEventListener(t,i){this._removeListener(this.cursorListeners,t,i)}RemoveCursorEventListeners(t){this._removeListeners(this.cursorListeners,t)}RemoveAllCursorEventListeners(){this._removeAllListeners(this.cursorListeners)}SimulateCursorClick(){let t=this.runtime.makeCursorEventData({x:0,y:0,pressX:0,pressY:0});this.emitCursor("CursorDown",t),this.emitCursor("CursorUp",t),this.emitCursor("CursorClick",t)}emitCursor(t,i){if(!this.runtime.cursorEventsEnabled(this))return;let r=this.cursorListeners.get(t)||[];for(let n of r)n(i)}AddKeyEventListener(t,i){this._addListener(this.keyListeners,t,i)}RemoveKeyEventListener(t,i){this._removeListener(this.keyListeners,t,i)}RemoveKeyEventListeners(t){this._removeListeners(this.keyListeners,t)}RemoveAllKeyEventListeners(){this._removeAllListeners(this.keyListeners)}emitKey(t){let i=this.keyListeners.get(t)||[];for(let r of i)if(r()===!0)return!0;return!1}AddNavigationEventListener(t,i){this._addListener(this.navListeners,t,i)}RemoveNavigationEventListener(t,i){this._removeListener(this.navListeners,t,i)}RemoveNavigationEventListeners(t){this._removeListeners(this.navListeners,t)}RemoveAllNavigationEventListeners(){this._removeAllListeners(this.navListeners)}SetControllerNavigation(t,i,r){this.navConfig.set(t,{mode:i,target:r})}GetControllerNavigation(t){let i=this.navConfig.get(t),r=i?[i.mode,i.target]:[null,null];return r.__multi=!0,r}SetImage(t,i){let r=this.imageSource?.Name||this.imageSource,n=t?.Name||t;(i!==this.imageId||r!==n)&&(this.imageType=null),this.imageSource=t,this.imageId=i,this.markPlayDirty()}SetSoftEdgeWidth(t,i){this.softEdgeWidthX=t,this.softEdgeWidthY=i,this.markPlayDirty()}SetFillUnused(){this.fillType="Unused",this.markPlayDirty()}SetFillHorizontal(t,i){this.fillType="Horizontal",this.fillHorizontalType=t,this.fillAmount=i,this.markPlayDirty()}SetFillVertical(t,i){this.fillType="Vertical",this.fillVerticalType=t,this.fillAmount=i,this.markPlayDirty()}SetFillRadial90(t,i){this.fillType="Radial90",this.fillRadial90Type=t,this.fillAmount=i,this.markPlayDirty()}SetFillRadial180(t,i){this.fillType="Radial180",this.fillRadialType=t,this.fillAmount=i,this.markPlayDirty()}SetFillRadial360(t,i){this.fillType="Radial360",this.fillRadialType=t,this.fillAmount=i,this.markPlayDirty()}PlayAnimation(){}StopAnimation(){}RefreshItems(t,i){if(!Number.isInteger(t)||t<0||t>2e3)throw new Error("RefreshItems: simulator supports 0..2000 items");if(typeof i!="function")throw new Error("RefreshItems: callback must be a function");if(!this.alive||this._refreshingGrid)throw new Error("RefreshItems: destroyed control or recursive refresh");if(t&&!this.runtime.templates.has(Number(this.itemPrefabIndex)))throw new Error("RefreshItems: item template not found");if(t&&["OnInit","OnDestroy"].includes(this.runtime.lifecyclePhase))throw new Error("RefreshItems: items cannot be created during OnInit/OnDestroy");this._refreshingGrid=!0;try{this._gridItems||=[];let r=[];for(let n of this._gridItems)n.alive&&n.parent===this&&n.prefabIndex===Number(this.itemPrefabIndex)&&r.length<t?r.push(n):n.alive&&n.parent===this&&this.runtime.destroyControl(n);for(this._gridItems=r;r.length<t;){let n=this.runtime.instantiate(this.itemPrefabIndex,this,this.runtime.lifecyclePhase);if(!n)throw new Error("RefreshItems: could not instantiate item");r.push(n),n.SetActive(!0)}this.itemCount=t,Ht(this),this.markPlayDirty(!0);for(let n=0;n<r.length&&this.alive;n+=1)i(r[n],n)}finally{this._refreshingGrid=!1}}GetItemIndex(t){return t?.alive&&t.parent===this?this._gridItems?.indexOf(t)??-1:-1}GetItemSize(){return[this.cellSizeX,this.cellSizeY]}GetItemSpacing(){return[this.spacingX,this.spacingY]}GetPadding(){return[this.padding1Y,this.padding2Y,this.padding1X,this.padding2X]}ScrollToItemAt(t,i){if(!Number.isInteger(t)||t<0||t>=this.itemCount)throw new Error("ScrollToItemAt: item index out of range");let r=Ii(this),n=r.horizontal?r.cellW:r.cellH,o=r.horizontal?r.gapX:r.gapY,a=(r.horizontal?r.left:r.top)+Math.floor(t/r.lanes)*(n+o),s=i?.Name||i;if(!["Top","Center","Bottom"].includes(s))throw new Error("ScrollToItemAt: invalid alignment");let c=a-(s==="Center"?(r.viewport-n)/2:s==="Bottom"?r.viewport-n:0);this.scrollProgress=r.max?ur(c/r.max):0,Ht(this),this.markPlayDirty(!0)}GetContentLength(){return Ii(this).length}};function Ye(e,t){t(e);for(let i of e.children)Ye(i,t)}function $n(e,t=[],i=""){t.push(`${i}${e.name||"(unnamed)"} [${e.typeofName}] Id=${e.Id}`);for(let r of e.children)$n(r,t,i+" ");return t}function dr(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}var cs={Linear:e=>e,InSine:e=>1-Math.cos(e*Math.PI/2),OutSine:e=>Math.sin(e*Math.PI/2),InOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,InQuad:e=>e*e,OutQuad:e=>1-(1-e)*(1-e),InOutQuad:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,InCubic:e=>e*e*e,OutCubic:e=>1-(1-e)**3,InOutCubic:e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,InQuart:e=>e**4,OutQuart:e=>1-(1-e)**4,InOutQuart:e=>e<.5?8*e**4:1-(-2*e+2)**4/2,InQuint:e=>e**5,OutQuint:e=>1-(1-e)**5,InOutQuint:e=>e<.5?16*e**5:1-(-2*e+2)**5/2,InExpo:e=>e===0?0:2**(10*e-10),OutExpo:e=>e===1?1:1-2**(-10*e),InOutExpo:e=>e===0||e===1?e:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,InCirc:e=>1-Math.sqrt(1-e**2),OutCirc:e=>Math.sqrt(1-(e-1)**2),InOutCirc:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2,InBack:e=>(1.70158+1)*e*e*e-1.70158*e*e,OutBack:e=>1+2.70158*(e-1)**3+1.70158*(e-1)**2,InOutBack:e=>{let i=2.5949095;return e<.5?(2*e)**2*((i+1)*2*e-i)/2:((2*e-2)**2*((i+1)*(e*2-2)+i)+2)/2},InElastic:e=>e===0||e===1?e:-(2**(10*e-10))*Math.sin((e*10-10.75)*(2*Math.PI/3)),OutElastic:e=>e===0||e===1?e:2**(-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,InOutElastic:e=>{if(e===0||e===1)return e;let t=2*Math.PI/4.5;return e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*t))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*t)/2+1},InBounce:e=>1-dr(1-e),OutBounce:dr,InOutBounce:e=>e<.5?(1-dr(1-2*e))/2:(1+dr(2*e-1))/2};function us(e,t){let i=cs[e]||cs.Linear;return t<=0?0:t>=1?1:i(t)}function Xt(e,t,i,r=255){let n=hr(e),o=hr(t),a=hr(i);return((r==null?255:hr(r))<<24|n<<16|o<<8|a)>>>0}function Ci(e){let t=e>>>0;return[t>>>16&255,t>>>8&255,t&255,t>>>24&255]}function hr(e){let t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(255,Math.trunc(t))):0}function fs(e,t,i){let r=Ci(e),n=Ci(t);return Xt(r[0]+(n[0]-r[0])*i,r[1]+(n[1]-r[1])*i,r[2]+(n[2]-r[2])*i,r[3]+(n[3]-r[3])*i)}var Qu=new Set(["fontColor","bgColor","outlineColor","imageColor"]),Zu=new Set(["fontSize","minimumFontSize"]),Gn=1e-9;function ef(e,t){return typeof e?.luaFieldValue=="function"?e.luaFieldValue(t):e[t]}var ki=class{constructor(t,i,r,n){this.runtime=t,this.object=i,this.data={...r},this.duration=Math.max(0,Number(n)||0),this.easeName="Linear",this.relative=!1,this.playing=!1,this.paused=!1,this.elapsed=0,this.loops=1,this.loopIndex=0,this.from={},this.to={},this.initialFrom=null,this.initialTo=null,this.onComplete=null,this.onStepComplete=null,this.killed=!1,this.dead=!1,this.completed=!1}capture(){this.from={},this.to={};for(let[t,i]of Object.entries(this.data)){let r=ef(this.object,t);this.from[t]=r,this.to[t]=this.relative?Number(r)+Number(i):i}}restoreInitial(){this.from={...this.initialFrom},this.to={...this.initialTo}}SetEase(t){return this.easeName=typeof t=="string"?t:t?.Name||"Linear",this}SetRelative(t){return this.relative=!!t,this}Play(){return this.dead?this:this.playing?(this.paused=!1,this):this._start(!1)}_begin(t){this.playing=!0,this.paused=!1,this.elapsed=0,this.loopIndex=0,this.killed=!1,this.completed=!1,t&&this.initialFrom?this.restoreInitial():(this.capture(),this.initialFrom={...this.from},this.initialTo={...this.to})}_start(t){return this._begin(t),this.runtime.tweens.add(this),this.runtime.animations.add(this),this}get loopCount(){return this.loops>0?this.loops:1}Pause(){this.paused=!0}Resume(){this.paused=!1}Restart(){return this.dead?this:this._start(!0)}Complete(){this.dead||this.completed||(this.initialFrom||this._begin(!1),this.apply(1),this.finish(!0))}Kill(t){t?this.Complete():this.finish(!1),this.dead=!0}SetOnComplete(t){return this.onComplete=t,this}SetOnStepComplete(t){return this.onStepComplete=t,this}SetLoops(t){return this.loops=t,this}apply(t){if(this.object?.alive===!1)return;let i=us(this.easeName,t),r=!1,n=!1;for(let o of Object.keys(this.to)){let a=this.from[o],s=this.to[o];if(Qu.has(o)&&typeof a=="number"&&typeof s=="number")this.object[o]=fs(a,s,i);else if(typeof a=="number"&&typeof s=="number"){let c=a+(s-a)*i;this.object[o]=Zu.has(o)?Math.trunc(c):c}else this.object[o]=i>=1?s:a;r=!0,fr.has(o)&&(n=!0)}r&&typeof this.object?.markPlayDirty=="function"&&this.object.markPlayDirty(n)}_advance(t,i){this.elapsed+=t;let r=this.duration<=0?1:Math.min(1,this.elapsed/this.duration);return this.apply(r),r<1?!1:i>=0&&this.loopIndex+1>=i?!0:(this.onStepComplete&&this.runtime.safeCall(this.onStepComplete),this.loopIndex++,this.elapsed=0,this.restoreInitial(),!1)}step(t){!this.playing||this.paused||this.killed||this._advance(t,this.loops<0?-1:this.loopCount)&&(this.onStepComplete&&this.runtime.safeCall(this.onStepComplete),this.finish(!0))}finish(t){this.playing=!1,this.killed=!0,t&&(this.completed=!0),this.runtime.tweens.delete(this),this.runtime.animations.delete(this),t&&this.onComplete&&this.runtime.safeCall(this.onComplete)}},Wt=class{constructor(t){this.runtime=t,this.steps=[],this.playing=!1,this.paused=!1,this.killed=!1,this.dead=!1,this.completed=!1,this.elapsed=0,this.loops=1,this.loopIndex=0,this.onComplete=null,this.onStepComplete=null,this._entries=null}Append(t){return this.steps.push({kind:"tween",tween:t,parallel:!1}),this}AppendInterval(t){return this.steps.push({kind:"interval",duration:t}),this}AppendCallback(t){return this.steps.push({kind:"callback",fn:t}),this}Join(t){return this.steps.push({kind:"tween",tween:t,parallel:!0}),this}Insert(t,i){return this.steps.push({kind:"insert",time:t,tween:i}),this}InsertCallback(t,i){return this.steps.push({kind:"insertCb",time:t,fn:i}),this}Play(){return this.dead?this:this.playing?(this.paused=!1,this):this._play()}_play(){return this.playing=!0,this.paused=!1,this.killed=!1,this.completed=!1,this.elapsed=0,this.loopIndex=0,this._schedule(),this.runtime.sequences.add(this),this.runtime.animations.add(this),this}_schedule(){let t=0,i=0,r=!1,n=[],o=a=>a.duration*a.loopCount;for(let a of this.steps)if(a.kind==="tween"&&a.parallel){let s=r?i:t;n.push({at:s,tween:a.tween}),t=Math.max(t,s+o(a.tween))}else a.kind==="tween"?(n.push({at:t,tween:a.tween}),i=t,r=!0,t+=o(a.tween)):a.kind==="interval"?(i=t,r=!0,t+=a.duration):a.kind==="callback"?n.push({at:t,fn:a.fn}):a.kind==="insert"?(n.push({at:a.time,tween:a.tween}),t=Math.max(t,a.time+o(a.tween))):a.kind==="insertCb"&&(n.push({at:a.time,fn:a.fn}),t=Math.max(t,a.time));this._entries=n.map((a,s)=>({...a,index:s,end:a.tween?a.at+o(a.tween):a.at})),this._end=t,this._resetEntries()}_resetEntries(){for(let t of this._entries)t.started=!1,t.done=!1}_startChild(t){t.started=!0,t.tween._begin(!!t.tween.initialFrom)}_finishChild(t){t.done=!0,t.tween.apply(1),t.tween.onStepComplete&&this.runtime.safeCall(t.tween.onStepComplete),t.tween.finish(!0)}_advanceTo(t,i){let r=this._entries,n=[];for(let a of r)!a.started&&a.at<=t+Gn&&n.push({at:a.at,rank:a.fn?1:2,entry:a}),a.tween&&!a.done&&a.end<=t+Gn&&n.push({at:a.end,rank:0,entry:a});n.sort((a,s)=>a.at-s.at||a.rank-s.rank||a.entry.index-s.entry.index);let o=new Set;for(let{rank:a,entry:s}of n)if(a===1){if(s.started=!0,this.runtime.safeCall(s.fn),!this.playing||this.killed||this._entries!==r)return!1}else s.started||(this._startChild(s),o.add(s)),a===0&&!s.done&&this._finishChild(s);for(let a of r)!a.tween||!a.started||a.done||(o.has(a)?a.tween._advance(t-a.at,a.tween.loopCount):a.tween._advance(i,a.tween.loopCount));return!0}step(t){!this.playing||this.paused||this.killed||(this.elapsed+=t,this._advanceTo(this.elapsed,t)&&(this.elapsed+Gn<this._end||(this.onStepComplete&&this.runtime.safeCall(this.onStepComplete),this.loopIndex++,this.loops<0||this.loopIndex<this.loops?(this.elapsed=0,this._resetEntries()):this.finish(!0))))}Pause(){this.paused=!0}Resume(){this.paused=!1}Restart(){this.dead||this._play()}Complete(){this.dead||this.completed||(this._entries||this._schedule(),this.playing=!0,this.killed=!1,this._advanceTo(1/0,0)&&(this.onStepComplete&&this.runtime.safeCall(this.onStepComplete),this.finish(!0)))}Kill(t){t?this.Complete():this.finish(!1),this.dead=!0}SetOnComplete(t){return this.onComplete=t,this}SetOnStepComplete(t){return this.onStepComplete=t,this}SetLoops(t){return this.loops=t,this}finish(t){this.playing=!1,this.killed=!0,t&&(this.completed=!0),this.runtime.sequences.delete(this),this.runtime.animations.delete(this),t&&this.onComplete&&this.runtime.safeCall(this.onComplete)}};var pr={EaseType:["Linear","InSine","OutSine","InOutSine","InQuad","OutQuad","InOutQuad","InCubic","OutCubic","InOutCubic","InQuart","OutQuart","InOutQuart","InQuint","OutQuint","InOutQuint","InExpo","OutExpo","InOutExpo","InCirc","OutCirc","InOutCirc","InBack","OutBack","InOutBack","InElastic","OutElastic","InOutElastic","InBounce","OutBounce","InOutBounce"],CustomVariableEntityType:["Level","PlayerSelf","AvatarSelf"],Device:["KeyboardAndMouse","Mobile","Controller","MobileController"],StageMode:["Beyond","Classic"],LanguageType:["LanguageNone","LanguageEng","LanguageChs","LanguageCht","LanguageFra","LanguageDeu","LanguageSpa","LanguagePor","LanguageRus","LanguageJpn","LanguageKor","LanguageTha","LanguageVie","LanguageInd","LanguageTur","LanguageIta"],ParamType:["Entity","EntityList","Int","IntList","Bool","BoolList","Float","FloatList","String","StringList","Vector3","Vector3List","Guid","GuidList","ConfigId","PrefabId","ConfigIdList","PrefabIdList"],CursorEventType:["CursorDown","CursorUp","CursorEnter","CursorExit","CursorDrag","CursorBeginDrag","CursorEndDrag","CursorClick"],ScrollDirection:["Horizontal","Vertical"],ScrollLayoutConstraint:["AutoWrap","Fixed"],ScrollAlignType:["Bottom","Center","Top"],ControllerNavigationDir:["Up","Down","Left","Right"],ControllerNavigationEventType:["Confirm","Cancel","Focus","LostFocus","RightStickUp","RightStickDown","RightStickRight","RightStickLeft","LeftStickUp","LeftStickDown","LeftStickRight","LeftStickLeft"],ControllerNavigationMode:["None","NearestControl","Specified"],TextHorizontalAlignment:["Left","Middle","Right"],TextVerticalAlignment:["Top","Middle","Bottom"],ImageType:["Basic","Stretch"],ImageSource:["StaticReference","Item","Equipment","Skill","UnitStatus","Faction","Currency","Prefab"],ImageFillType:["Unused","Horizontal","Vertical","Radial90","Radial180","Radial360"],ImageFillHorizontalType:["Left","Right"],ImageFillVerticalType:["Bottom","Top"],ImageFillRadial90Type:["BottomLeft","TopLeft","TopRight","BottomRight"],ImageFillRadialType:["Bottom","Left","Top","Right"],ImageMaskSoftEdgeMode:["Percentage","Pixel"],UIAnimationLayer:["AboveAllControls","BelowAllControls"]},tf=[...Array.from({length:43},(e,t)=>`CraftspersonKey${t+1}`),"MoveForwardKey","MoveBackwardKey","MoveLeftKey","MoveRightKey","SwitchToWalkOrRunKey","SprintKey","JumpKey","DropKey","OpenShortcutWheelKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key","None"],rf=[...Array.from({length:14},(e,t)=>`CraftspersonKey${t+1}`),"SprintKey","JumpKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key","MenuConfirmKey","MenuBackKey","None"];function nf(){let e=[];for(let t of["Down","Up"]){for(let i=1;i<=43;i++)e.push(`KeyboardCraftspersonKey${i}${t}`);for(let i of["MoveForwardKey","MoveBackwardKey","MoveLeftKey","MoveRightKey","SwitchToWalkOrRunKey","SprintKey","JumpKey","DropKey","OpenShortcutWheelKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key"])e.push(`Keyboard${i}${t}`);for(let i=1;i<=14;i++)e.push(`ControllerCraftspersonKey${i}${t}`);for(let i of["SprintKey","JumpKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key","MenuConfirmKey","MenuBackKey"])e.push(`Controller${i}${t}`)}return e}pr.KeyboardKeyCode=tf;pr.ControllerKeyCode=rf;pr.KeyEventType=nf();var ds=new Map;function It(e,t){let i=`${e}\0${t}`,r=ds.get(i);return r||(r={__kind:"EnumItem",Name:t,FullName:`Enum.${e}.${t}`,EnumType:e},ds.set(i,r)),r}function Vn(e,t){return t==null?t:t.__kind==="EnumItem"?It(t.EnumType||e,t.Name):typeof t=="string"&&t?It(e,t):t}function Bn(){let e={};for(let[t,i]of Object.entries(pr)){let r={};for(let n of i)r[n]=It(t,n);e[t]=r}return e}var of=new Set(["Id","prefabIndex","imageId","fontSize","minimumFontSize","clickAudioId","itemCount","itemPrefabIndex","animationId","referencedPrefabIndex"]),af=new Set(["imageColor","fontColor","bgColor","outlineColor"]),hs={horizontalAlignment:"TextHorizontalAlignment",verticalAlignment:"TextVerticalAlignment",imageSource:"ImageSource",imageType:"ImageType",fillType:"ImageFillType",fillHorizontalType:"ImageFillHorizontalType",fillVerticalType:"ImageFillVerticalType",fillRadial90Type:"ImageFillRadial90Type",fillRadialType:"ImageFillRadialType",softEdgeMode:"ImageMaskSoftEdgeMode",layer:"UIAnimationLayer",scrollDirection:"ScrollDirection",layoutConstraint:"ScrollLayoutConstraint"},Ct=d.LUA_REGISTRYINDEX,ps=d.LUA_MULTRET,sf=Object.freeze({InstantiateClientUIControl:2,DestroyClientUIControl:1,GetClientUIControl:1,FindClientUIRoot:1,GetClientUIRoots:0,GetUICanvasSize:0,GetCursorUIPos:0,GetDevice:0,SetControllerFocus:1,GetControllerFocus:0,GetControllerLeftStickAxis:0,GetControllerRightStickAxis:0,Tween:3,TweenSequence:0,ServerSignal:1,GetGlobalCustomVariableValue:2,PauseLevelTime:1,IsLevelTimePaused:0,PlayAudio2D:1,StopAudio:1,IsAudioAlive:1,GetLanguageType:0,GetStageMode:0,IsTestPlay:0,GetText:1,PrintClientUITree:0});function Se(e){return e==null?"":typeof e=="string"?e:e.Name||e.FullName||String(e)}var mr=class{constructor(t={}){this.canvasWidth=t.canvasWidth??1600,this.canvasHeight=t.canvasHeight??900,this.device=t.device??"KeyboardAndMouse",this.language=t.language??"LanguageChs",this.stageMode=t.stageMode??"Classic",this.testPlay=t.testPlay!==!1,this.canSelectImageType=t.canSelectImageType||(()=>!1),this.clock={time:0,levelTime:0,paused:!1,frame:0},this.logs=[],this.mountErrors=[],this.tweens=new Set,this.sequences=new Set,this.animations=new Set,this.audios=new Map,this.nextAudioId=1,this.audioDuration=t.audioDuration||(()=>null),this.audioHistory=[],this.audioWarnings=new Set,this.audioRevision=0,this._nextControlId=1,this._playRemoved=[],this._nextScriptMappingId=1,this.lifecyclePhase="idle",this.controlsById=new Map,this.roots=[],this.templates=new Map,this.scriptFiles=new Map,this.requireAliases=new Map,this.requireCache=new Map,this.moduleBaseEnvironments=new Map,this.luaFunctions=new Map,this.mountedScripts=[],this.serverVars={Level:Object.create(null),PlayerSelf:Object.create(null),AvatarSelf:Object.create(null)},this.serverBridge=null,this.varHandlers=[],this.signalHandlers=[],this.cursor={x:0,y:0},this.focus=null,this.stick={left:[0,0],right:[0,0]},this.enumTree=Bn(),this.luaStates=new Set,this.L=null}nextControlId(){let t=this._nextControlId;return this._nextControlId+=1,t}resolveScriptMappingId(t){let i=Number(t);if(Number.isSafeInteger(i)&&i>0)return this._nextScriptMappingId=Math.max(this._nextScriptMappingId,i+1),i;let r=this._nextScriptMappingId;return this._nextScriptMappingId+=1,r}pushPackedColor(t,i){let r=i>>>0;(r|0)===r?d.lua_pushinteger(t,r):d.lua_pushnumber(t,r)}retainLuaCallback(t){Za(t)}unrefLuaCallback(t){es(this,t)}log(t,...i){let r=i.map(n=>n==null?"nil":typeof n=="object"&&n!==null&&n.__kind==="EnumItem"?n.Name:String(n)).join(" ");this.logs.push({level:t,text:r,time:this.clock.time})}safeCall(t,...i){try{return t(...i)}catch(r){this.log("lua-error",r&&r.message?r.message:String(r))}}scriptCanRun(t){if(!t?.alive||!t.enabled)return!1;let i=t.object;return!i||i.alive&&i.activeInHierarchy}cursorEventsEnabled(t){for(let i=t;i;i=i.parent)if(i.kind==="container"&&i.showCursor===!0)return!0;return!1}registerTemplate(t,i){this.templates.set(Number(t),i)}registerScriptFile(t,i){let r=this.normalizeRequirePath(t);this.scriptFiles.set(r,i),r.startsWith("default_import_file/")||this.requireAliases.set(`default_import_file/${r}`,r)}normalizeRequirePath(t){let i=String(t).replace(/\\/g,"/");return i.endsWith(".lua")&&(i=i.slice(0,-4)),i=i.replace(/\./g,"/"),i}addRoot(t){let i=t instanceof ut?t:new ut(this,t);return this.roots.push(i),Ye(i,r=>this.controlsById.set(r.Id,r)),this.mountSpecScripts(t,i),i}mountSpecScripts(t,i){if(t instanceof ut)return;let r=o=>(o.scripts?.length||0)>0||(o.children||[]).some(r);if(!t||!r(t))return;let n=this.lifecyclePhase;try{let o=(a,s)=>{for(let l of a.scripts||[])try{this.mountScript({path:l.path,source:l.source,control:s,scriptMappingId:l.scriptMappingId})}catch(u){let f=u&&u.message?u.message:String(u);this.mountErrors.push(f),this.log("lua-error",f)}let c=a.children||[];for(let l=0;l<c.length;l+=1)o(c[l],s?.children?.[l])};o(t,i)}finally{this.lifecyclePhase=n}}makeCursorEventData({x:t=0,y:i=0,pressX:r=t,pressY:n=i,deltaX:o=t-r,deltaY:a=i-n,dragging:s=!1,touchId:c=-1}={}){let l=this;return{__kind:"CursorEventData",typeofName:"CursorEventData",dragging:s,touchId:c,x:t,y:i,pressX:r,pressY:n,GetUIPos(){return[t,i]},GetPressUIPos(){return[r,n]},GetUIPosDelta(){return[o,a]}}}boot(){let t=this.newLuaThread();this.L=t}installGlobals(t){let i=this;d.lua_pushcfunction(t,r=>{let n=d.lua_gettop(r),o=[];for(let a=1;a<=n;a++)o.push(me(r,i,a));return i.log("info",...o),0}),d.lua_setglobal(t,M("print")),d.lua_pushcfunction(t,r=>{let n=d.lua_gettop(r),o=[];for(let a=1;a<=n;a++)o.push(me(r,i,a));return i.log("error",...o),0}),d.lua_setglobal(t,M("printerr")),d.lua_pushcfunction(t,r=>{if(d.lua_type(r,1)===d.LUA_TTABLE&&!Qe(r,1))return d.lua_pushstring(r,M("table")),1;let n=me(r,i,1);return d.lua_pushstring(r,M(i.typeofOf(n))),1}),d.lua_setglobal(t,M("typeof")),this.pushColorLib(t),this.pushEnumLib(t),this.pushGameLib(t),d.lua_pushcfunction(t,r=>i.luaRequire(r)),d.lua_setglobal(t,M("require"))}typeofOf(t){return t==null?"nil":t.__kind==="Script"?"Script":t.__kind==="EnumItem"?"EnumItem":t.__kind==="CursorEventData"?"CursorEventData":t.__kind==="ServerSignal"?"ServerSignal":t instanceof Wt?"TweenSequence":t instanceof ki?"Tween":t.typeofName?t.typeofName:typeof t=="number"?"number":typeof t=="string"?"string":typeof t=="boolean"?"boolean":typeof t}pushColorLib(t){d.lua_newtable(t),d.lua_pushcfunction(t,i=>(this.pushPackedColor(i,Xt(d.lua_tonumber(i,1),d.lua_tonumber(i,2),d.lua_tonumber(i,3),255)),1)),d.lua_setfield(t,-2,M("FromRGB")),d.lua_pushcfunction(t,i=>{let r=d.lua_isnoneornil(i,4)?255:d.lua_tonumber(i,4);return this.pushPackedColor(i,Xt(d.lua_tonumber(i,1),d.lua_tonumber(i,2),d.lua_tonumber(i,3),r)),1}),d.lua_setfield(t,-2,M("FromRGBA")),d.lua_pushcfunction(t,i=>{let r=d.lua_tonumber(i,1)>>>0;for(let n of Ci(r))d.lua_pushinteger(i,n);return 4}),d.lua_setfield(t,-2,M("ToRGBA")),d.lua_newtable(t),d.lua_pushcfunction(t,i=>{let r=d.lua_tonumber(i,2),n=d.lua_tonumber(i,3),o=d.lua_tonumber(i,4),a=d.lua_isnoneornil(i,5)?255:d.lua_tonumber(i,5);return this.pushPackedColor(i,Xt(r,n,o,a)),1}),d.lua_setfield(t,-2,M("__call")),d.lua_setmetatable(t,-2),d.lua_setglobal(t,M("Color"))}pushEnumLib(t){d.lua_newtable(t);for(let[i,r]of Object.entries(this.enumTree)){d.lua_newtable(t);for(let[n,o]of Object.entries(r))this.pushEnumItem(t,o),d.lua_setfield(t,-2,M(n));d.lua_setfield(t,-2,M(i))}d.lua_setglobal(t,M("Enum"))}pushEnumItem(t,i){let r=d.lua_newuserdata(t,0);xt(r,i),Q.luaL_setmetatable(t,M("EnumItem"))}pushControl(t,i){let r=d.lua_newuserdata(t,0);xt(r,i),Q.luaL_setmetatable(t,M("Control"))}pushScript(t,i){d.lua_newtable(t),d.lua_pushlightuserdata(t,On);let r=d.lua_newuserdata(t,0);xt(r,i),d.lua_rawset(t,-3),Q.luaL_getmetatable(t,M("Script")),d.lua_setmetatable(t,-2)}pushTween(t,i){let r=d.lua_newuserdata(t,0);xt(r,i);let n=i instanceof Wt?"TweenSequence":"Tween";Q.luaL_setmetatable(t,M(n))}pushSignal(t,i){let r=d.lua_newuserdata(t,0);xt(r,i),Q.luaL_setmetatable(t,M("ServerSignal"))}pushCursor(t,i){let r=d.lua_newuserdata(t,0);xt(r,i),Q.luaL_setmetatable(t,M("CursorEventData"))}pushGameLib(t){let i=this;d.lua_newtable(t);let r={InstantiateClientUIControl:n=>{let o=d.lua_tointeger(n,1),a=Ee(d.lua_touserdata(n,2)),s=i.instantiate(o,a,i.lifecyclePhase);return s?(i.pushControl(n,s),1):(d.lua_pushnil(n),1)},DestroyClientUIControl:n=>{let o=Ee(d.lua_touserdata(n,1));return o&&i.destroyControl(o),0},GetClientUIControl:n=>{let o=d.lua_tointeger(n,1),a=i.controlsById.get(o);return a?i.pushControl(n,a):d.lua_pushnil(n),1},FindClientUIRoot:n=>{let o=Z(n,1),a=i.roots.find(s=>s.name===o);return a?i.pushControl(n,a):d.lua_pushnil(n),1},GetClientUIRoots:n=>(d.lua_createtable(n,i.roots.length,0),i.roots.forEach((o,a)=>{i.pushControl(n,o),d.lua_rawseti(n,-2,a+1)}),1),GetUICanvasSize:n=>(d.lua_pushnumber(n,i.canvasWidth),d.lua_pushnumber(n,i.canvasHeight),2),GetCursorUIPos:n=>(d.lua_pushnumber(n,i.cursor.x),d.lua_pushnumber(n,i.cursor.y),2),GetDevice:n=>(i.pushEnumItem(n,It("Device",i.device)),1),SetControllerFocus:n=>(i.focus=Ee(d.lua_touserdata(n,1)),0),GetControllerFocus:n=>(i.focus?i.pushControl(n,i.focus):d.lua_pushnil(n),1),GetControllerLeftStickAxis:n=>(d.lua_pushnumber(n,i.stick.left[0]),d.lua_pushnumber(n,i.stick.left[1]),2),GetControllerRightStickAxis:n=>(d.lua_pushnumber(n,i.stick.right[0]),d.lua_pushnumber(n,i.stick.right[1]),2),Tween:n=>{let o=Ee(d.lua_touserdata(n,1))||me(n,i,1),a=me(n,i,2)||{},s=d.lua_tonumber(n,3),c=new ki(i,o,a,s);return i.pushTween(n,c),1},TweenSequence:n=>(i.pushTween(n,new Wt(i)),1),ServerSignal:n=>{let o=Z(n,1);return i.pushSignal(n,i.makeServerSignal(o)),1},GetGlobalCustomVariableValue:n=>{let o=Se(me(n,i,1)),a=Z(n,2);return le(n,i,i.getVar(o,a)),1},PauseLevelTime:n=>(i.clock.paused=!!d.lua_toboolean(n,1),0),IsLevelTimePaused:n=>(d.lua_pushboolean(n,i.clock.paused),1),PlayAudio2D:n=>{let o=i.playAudio(i.audioInteger(n));return d.lua_pushinteger(n,o),1},StopAudio:n=>(i.stopAudio(i.audioInteger(n)),0),IsAudioAlive:n=>{let o=i.audios.get(i.audioInteger(n));return d.lua_pushboolean(n,!!(o&&o.alive)),1},GetLanguageType:n=>(i.pushEnumItem(n,It("LanguageType",i.language)),1),GetStageMode:n=>(i.pushEnumItem(n,It("StageMode",i.stageMode)),1),IsTestPlay:n=>(d.lua_pushboolean(n,i.testPlay),1),GetText:n=>{let o=Z(n,1);return d.lua_pushstring(n,M(o)),1},PrintClientUITree:n=>{for(let o of i.roots)i.log("info",$n(o).join(`
|
|
112
|
-
`));return 0}};for(let[n,o]of Object.entries(r)){let a=sf[n];if(a===void 0)throw new Error(`missing game arity for ${n}`);d.lua_pushcfunction(t,s=>{let c=d.lua_gettop(s);return c!==a?Q.luaL_error(s,M(`bad argument count to '${n}' (${a} expected, got ${c})`)):o(s)}),d.lua_setfield(t,-2,M(n))}d.lua_setglobal(t,M("game"))}makeServerSignal(t){let i=[],r=this;return{__kind:"ServerSignal",name:t,AddParam(n,o){i.push({type:Se(n),value:o})},AddInt(n){i.push({type:"Int",value:n})},AddIntList(n){i.push({type:"IntList",value:n})},AddFloat(n){i.push({type:"Float",value:n})},AddFloatList(n){i.push({type:"FloatList",value:n})},AddString(n){i.push({type:"String",value:n})},AddStringList(n){i.push({type:"StringList",value:n})},AddVector3(n){i.push({type:"Vector3",value:n})},AddVector3List(n){i.push({type:"Vector3List",value:n})},AddBool(n){i.push({type:"Bool",value:n})},AddBoolList(n){i.push({type:"BoolList",value:n})},AddGuid(n){i.push({type:"Guid",value:n})},AddGuidList(n){i.push({type:"GuidList",value:n})},AddEntity(n){i.push({type:"Entity",value:n})},AddEntityList(n){i.push({type:"EntityList",value:n})},AddPrefabId(n){i.push({type:"PrefabId",value:n})},AddPrefabIdList(n){i.push({type:"PrefabIdList",value:n})},AddConfigId(n){i.push({type:"ConfigId",value:n})},AddConfigIdList(n){i.push({type:"ConfigIdList",value:n})},SendSignal(){let n=i.slice();r.serverBridge&&typeof r.serverBridge.receiveFromClient=="function"&&r.serverBridge.receiveFromClient(t,n)}}}audioInteger(t){let i=d.lua_tonumber(t,1);return d.lua_type(t,1)!==d.LUA_TNUMBER||!Number.isSafeInteger(i)?Q.luaL_error(t,M("audio argument must be an integer")):i}playAudio(t){this.audioRevision++;let i=this.nextAudioId++,r=this.audioDuration(t),n=Number.isFinite(r)&&r>0,o={instanceId:i,audioId:t,startedAt:this.clock.time,duration:n?r:0,alive:n,stopped:!1};return this.audioHistory.push(o),this.audioHistory.length>128&&this.audioHistory.shift(),n?(this.audios.size>=128&&this.stopAudio(this.audios.keys().next().value),this.audios.set(i,o)):this.audioWarnings.has(t)||(this.audioWarnings.size>=128&&this.audioWarnings.delete(this.audioWarnings.values().next().value),this.audioWarnings.add(t),this.log("warn",`\u97F3\u6548 ${t} \u672A\u5217\u5165\u6A21\u62DF\u5668\u97F3\u9891\u767D\u540D\u5355`)),i}stopAudio(t){let i=this.audios.get(t)||this.audioHistory.find(r=>r.instanceId===t);i&&!i.stopped&&(i.alive=!1,i.stopped=!0,this.audioRevision++),this.audios.delete(t)}audioSnapshot(){return{sequence:this.nextAudioId-1,revision:this.audioRevision,active:[...this.audios.values()].map(t=>({...t})),recent:this.audioHistory.map(t=>({...t}))}}instantiate(t,i,r){if(r==="OnInit"||r==="OnDestroy")return null;let n=this.templates.get(Number(t));if(!n||!i)return null;let o=new ut(this,{...n,Id:this.nextControlId(),authoringId:null,prefabIndex:Number(t)});return i.addChild(o),o.SetAsLastSibling(),Ye(o,a=>this.controlsById.set(a.Id,a)),this.mountSpecScripts(n,o),o}destroyControl(t){if(!(!t||!t.alive)){if(t._destroying)throw new Error(`\u5BA2\u6237\u7AEF\u63A7\u4EF6\u751F\u547D\u5468\u671F\u5904\u4E8E\u521B\u5EFA\u6216\u9500\u6BC1\u65F6\uFF0C\u65E0\u6CD5\u8C03\u7528DestroyClientUIControl, ID:${t.name}`);Ye(t,i=>{i._destroying=!0}),this._destroyControlTree(t)}}_destroyControlTree(t){this.releaseControlListeners(t);for(let i of t.scripts.slice())this.unmountScript(i);for(let i of t.children.slice())this._destroyControlTree(i);if(t.alive=!1,this.scrollControls?.delete(t),this._playRemoved.push(t.Id),t.parent){let i=t.parent,r=i.children.indexOf(t);r>=0&&i.children.splice(r,1),t._parent=null,i.markPlayDirty(!0)}else{let i=this.roots.indexOf(t);i>=0&&this.roots.splice(i,1)}this.controlsById.delete(t.Id),this.focus===t&&(this.focus=null);for(let i of[...this.tweens])i.object===t&&i.Kill(!1)}releaseControlListeners(t){for(let i of t.cursorListeners.values())for(let r of i)this.unrefLuaCallback(r);for(let i of t.keyListeners.values())for(let r of i)this.unrefLuaCallback(r);for(let i of t.navListeners.values())for(let r of i)this.unrefLuaCallback(r);t.cursorListeners.clear(),t.keyListeners.clear(),t.navListeners.clear(),t.navConfig.clear()}onControlActiveChanging(t,i){let r=[];Ye(t,n=>r.push({control:n,was:n.activeInHierarchy})),t.active=!!i,t.markPlayDirty(!0);for(let n of r){let o=n.control.activeInHierarchy;if(n.was!==o)for(let a of n.control.scripts.slice())o?this.enableScript(a):this.disableScript(a)}}bindScriptEnv(t){let i=t.env;return i?(this.pushScript(i,t),d.lua_setglobal(i,M("script")),i):null}disableScript(t){if(!t?.alive||!t.env||t.lifecyclePhase!=="running")return;let i=this.lifecyclePhase;this.lifecyclePhase="OnDisable",t.lifecyclePhase="OnDisable",this.bindScriptEnv(t),this.callGlobal(t.env,"OnDisable"),t.lifecyclePhase="disabled",this.lifecyclePhase=i}enableScript(t){if(!t?.alive||!t.env||t.lifecyclePhase!=="disabled")return;let i=this.lifecyclePhase;this.lifecyclePhase="OnEnable",t.lifecyclePhase="OnEnable",this.bindScriptEnv(t),this.callGlobal(t.env,"OnEnable"),t.lifecyclePhase="running",this.lifecyclePhase=i}unmountScript(t){if(!t||!t.alive)return;let i=t.env,r=this.lifecyclePhase;i&&(t.lifecyclePhase==="running"&&(this.lifecyclePhase="OnDisable",t.lifecyclePhase="OnDisable",this.bindScriptEnv(t),this.callGlobal(i,"OnDisable")),this.lifecyclePhase="OnDestroy",t.lifecyclePhase="OnDestroy",this.bindScriptEnv(t),this.callGlobal(i,"OnDestroy")),t.alive=!1,t.lifecyclePhase="destroyed",this.lifecyclePhase=r,this.mountedScripts=this.mountedScripts.filter(n=>n!==t),t.object&&(t.object.scripts=t.object.scripts.filter(n=>n!==t)),this.varHandlers=this.varHandlers.filter(n=>n.script!==t),this.signalHandlers=this.signalHandlers.filter(n=>n.script!==t),i&&i!==this.L&&this.closeTrackedLuaState(i),t.env=null}installMetatables(t){this.mtEnum(t),this.mtControl(t),this.mtScript(t),this.mtTween(t),this.mtSeq(t),this.mtSignal(t),this.mtCursor(t)}mtIndexNewindex(t,i,r,n,o,a){Q.luaL_newmetatable(t,M(i)),d.lua_pushcfunction(t,s=>{let c=Qe(s,1)||Ee(d.lua_touserdata(s,1)),l=Z(s,2);if(o[l]&&(!a||a(c,l)))return d.lua_pushcfunction(s,o[l]),1;let u;try{u=r(c,l)}catch(f){return Q.luaL_error(s,M(String(f.message||f)))}return u===void 0?(d.lua_pushnil(s),1):(le(s,this,u),1)}),d.lua_setfield(t,-2,M("__index")),d.lua_pushcfunction(t,s=>{try{let c=Qe(s,1)||Ee(d.lua_touserdata(s,1)),l=Z(s,2),u=me(s,this,3);return n(c,l,u),0}catch(c){return d.lua_pushstring(s,M(String(c.message||c))),d.lua_error(s)}}),d.lua_setfield(t,-2,M("__newindex")),d.lua_pushcfunction(t,s=>{let c=Qe(s,1)||Ee(d.lua_touserdata(s,1)),l=Qe(s,2)||Ee(d.lua_touserdata(s,2));return d.lua_pushboolean(s,c===l),1}),d.lua_setfield(t,-2,M("__eq")),d.lua_pop(t,1)}method(t){let i=this;return r=>{let n=Qe(r,1)||Ee(d.lua_touserdata(r,1)),o=d.lua_gettop(r),a=[];for(let s=2;s<=o;s++)a.push(me(r,i,s));try{let s=t(n,...a);if(s===n)return d.lua_pushvalue(r,1),1;if(s===void 0)return 0;if(Array.isArray(s)&&s.__multi){for(let c of s)le(r,i,c);return s.length}if(Array.isArray(s)&&!(s.length&&typeof s[0]=="object"&&s[0]?.typeofName)){if(s.__controls)return d.lua_createtable(r,s.length,0),s.forEach((c,l)=>{i.pushControl(r,c),d.lua_rawseti(r,-2,l+1)}),1;if(s.__scripts)return d.lua_createtable(r,s.length,0),s.forEach((c,l)=>{i.pushScript(r,c),d.lua_rawseti(r,-2,l+1)}),1;if(typeof s[0]=="number"&&s.length<=4){for(let c of s)d.lua_pushnumber(r,c);return s.length}}return le(r,i,s),1}catch(s){return d.lua_pushstring(r,M(String(s.message||s))),d.lua_error(r)}}}mtEnum(t){let i=new Set(["Name","FullName","EnumType"]);this.mtIndexNewindex(t,"EnumItem",(r,n)=>i.has(n)?r[n]:void 0,(r,n)=>{throw new Error(`cannot set ${n}, no such field`)},{})}mtCursor(t){let i=new Set(["dragging","touchId"]);this.mtIndexNewindex(t,"CursorEventData",(r,n)=>i.has(n)?r[n]:void 0,(r,n)=>{throw new Error(`cannot set ${n}, no such field`)},{GetUIPos:this.method(r=>r.GetUIPos()),GetPressUIPos:this.method(r=>r.GetPressUIPos()),GetUIPosDelta:this.method(r=>r.GetUIPosDelta())})}mtControl(t){let i=this.method((n,o)=>n.SetVisible(o)),r={GetChildren:this.method(n=>{let o=n.GetChildren();return o.__controls=!0,o}),GetChild:this.method((n,o)=>n.GetChild(o)),FindChild:this.method((n,o)=>n.FindChild(o)),SetActive:this.method((n,o)=>n.SetActive(o)),SetVisible:n=>d.lua_isboolean(n,2)?i(n):Q.luaL_error(n,M("bad argument #2 to 'SetVisible' (boolean expected, got %s)"),Q.luaL_typename(n,2)),GetSiblingIndex:this.method(n=>n.GetSiblingIndex()),SetSiblingIndex:this.method((n,o)=>n.SetSiblingIndex(o)),SetAsFirstSibling:this.method(n=>n.SetAsFirstSibling()),SetAsLastSibling:this.method(n=>n.SetAsLastSibling()),GetAnchoredPosition:this.method(n=>n.GetAnchoredPosition()),SetAnchoredPosition:this.method((n,o,a)=>n.SetAnchoredPosition(o,a)),GetSizeDelta:this.method(n=>n.GetSizeDelta()),SetSizeDelta:this.method((n,o,a)=>n.SetSizeDelta(o,a)),GetAnchorMin:this.method(n=>n.GetAnchorMin()),SetAnchorMin:this.method((n,o,a)=>n.SetAnchorMin(o,a)),GetAnchorMax:this.method(n=>n.GetAnchorMax()),SetAnchorMax:this.method((n,o,a)=>n.SetAnchorMax(o,a)),GetPivot:this.method(n=>n.GetPivot()),SetPivot:this.method((n,o,a)=>n.SetPivot(o,a)),GetLocalScale:this.method(n=>n.GetLocalScale()),SetLocalScale:this.method((n,o,a,s)=>n.SetLocalScale(o,a,s)),GetLocalRotation:this.method(n=>n.GetLocalRotation()),SetLocalRotation:this.method((n,o,a,s)=>n.SetLocalRotation(o,a,s)),GetScriptByPath:this.method((n,o)=>n.GetScriptByPath(o)),GetScript:this.method((n,o)=>n.GetScript(o)),GetScripts:this.method(n=>{let o=n.GetScripts();return o.__scripts=!0,o}),AddCursorEventListener:this.method((n,o,a)=>n.AddCursorEventListener(Se(o),a)),RemoveCursorEventListener:this.method((n,o,a)=>n.RemoveCursorEventListener(Se(o),a)),RemoveCursorEventListeners:this.method((n,o)=>n.RemoveCursorEventListeners(Se(o))),RemoveAllCursorEventListeners:this.method(n=>n.RemoveAllCursorEventListeners()),SimulateCursorClick:this.method(n=>n.SimulateCursorClick()),AddKeyEventListener:this.method((n,o,a)=>n.AddKeyEventListener(Se(o),a)),RemoveKeyEventListener:this.method((n,o,a)=>n.RemoveKeyEventListener(Se(o),a)),RemoveKeyEventListeners:this.method((n,o)=>n.RemoveKeyEventListeners(Se(o))),RemoveAllKeyEventListeners:this.method(n=>n.RemoveAllKeyEventListeners()),AddNavigationEventListener:this.method((n,o,a)=>n.AddNavigationEventListener(Se(o),a)),RemoveNavigationEventListener:this.method((n,o,a)=>n.RemoveNavigationEventListener(Se(o),a)),RemoveNavigationEventListeners:this.method((n,o)=>n.RemoveNavigationEventListeners(Se(o))),RemoveAllNavigationEventListeners:this.method(n=>n.RemoveAllNavigationEventListeners()),SetControllerNavigation:this.method((n,o,a,s)=>n.SetControllerNavigation(Se(o),a,s)),GetControllerNavigation:this.method((n,o)=>n.GetControllerNavigation(Se(o))),SetImage:this.method((n,o,a)=>n.SetImage(o,a)),SetSoftEdgeWidth:this.method((n,o,a)=>n.SetSoftEdgeWidth(o,a)),SetFillUnused:this.method(n=>n.SetFillUnused()),SetFillHorizontal:this.method((n,o,a)=>n.SetFillHorizontal(o,a)),SetFillVertical:this.method((n,o,a)=>n.SetFillVertical(o,a)),SetFillRadial90:this.method((n,o,a)=>n.SetFillRadial90(o,a)),SetFillRadial180:this.method((n,o,a)=>n.SetFillRadial180(o,a)),SetFillRadial360:this.method((n,o,a)=>n.SetFillRadial360(o,a)),PlayAnimation:this.method(n=>n.PlayAnimation()),StopAnimation:this.method(n=>n.StopAnimation()),RefreshItems:this.method((n,o,a)=>{this.retainLuaCallback(a);try{n.RefreshItems(o,a)}finally{this.unrefLuaCallback(a)}}),GetItemIndex:this.method((n,o)=>n.GetItemIndex(o)),GetItemSize:this.method(n=>n.GetItemSize()),GetItemSpacing:this.method(n=>n.GetItemSpacing()),GetPadding:this.method(n=>n.GetPadding()),ScrollToItemAt:this.method((n,o,a)=>n.ScrollToItemAt(o,a)),GetContentLength:this.method(n=>n.GetContentLength())};this.mtIndexNewindex(t,"Control",(n,o)=>{if(!Dn(n,o))return;if(!n.alive&&o!=="alive")throw new Error(`attempt to read '${o}' of a destroyed control`);let a=n.luaFieldValue(o),s=hs[o];return s?Vn(s,a):typeof a=="number"&&!of.has(o)&&!af.has(o)?new Si(a):a},(n,o,a)=>{if(Dn(n,o)==="rw"){if((o==="fontSize"||o==="minimumFontSize")&&!Number.isInteger(a)){let l=a===null?"nil":typeof a;throw new Error(`bad argument #2 to '${o}' (integer expected, got ${l})`)}let c=hs[o];if(o==="imageType"&&(a?.EnumType!=="ImageType"||!["Basic","Stretch"].includes(a.Name)))throw new Error("imageType requires Enum.ImageType.Basic or Stretch");n[o]=c?Vn(c,a):a,typeof n.markPlayDirty=="function"&&n.markPlayDirty(fr.has(o));return}throw new Error(`cannot set ${o}, no such field`)},r,ls)}mtScript(t){let i=this,r=new Set(["alive","scriptMappingId","object","path","enabled"]);this.mtIndexNewindex(t,"Script",(n,o)=>r.has(o)?n[o]:void 0,(n,o,a)=>{if(o==="enabled"){n.enabled=!!a;return}throw new Error(`cannot set ${o}, no such field`)},{GetParam:this.method((n,o)=>Object.prototype.hasOwnProperty.call(n.params,o)?n.params[o]:null),Invoke:n=>i.luaInvoke(n),EnableUpdate:this.method((n,o)=>{n.updateEnabled=!!o}),RegisterServerSignalHandler:this.method((n,o,a)=>{i.signalHandlers.push({script:n,name:o,fn:a})}),UnregisterServerSignalHandler:this.method((n,o)=>{i.signalHandlers=i.signalHandlers.filter(a=>!(a.script===n&&a.name===o))}),RegisterCustomVariableChangedHandler:this.method((n,o,a,s)=>{i.varHandlers.push({script:n,entityType:Se(o),name:a,fn:s})}),UnregisterCustomVariableChangedHandler:this.method((n,o,a)=>{let s=Se(o);i.varHandlers=i.varHandlers.filter(c=>!(c.script===n&&c.entityType===s&&c.name===a))})})}mtTween(t){this.mtIndexNewindex(t,"Tween",()=>{},()=>{},{SetEase:this.method((i,r)=>i.SetEase(r)),SetRelative:this.method((i,r)=>i.SetRelative(r)),Play:this.method(i=>i.Play()),Pause:this.method(i=>i.Pause()),Resume:this.method(i=>i.Resume()),Restart:this.method(i=>i.Restart()),Complete:this.method(i=>i.Complete()),Kill:this.method((i,r)=>i.Kill(r)),SetOnComplete:this.method((i,r)=>i.SetOnComplete(r)),SetOnStepComplete:this.method((i,r)=>i.SetOnStepComplete(r)),SetLoops:this.method((i,r)=>i.SetLoops(r))})}mtSeq(t){this.mtIndexNewindex(t,"TweenSequence",()=>{},()=>{},{Append:this.method((i,r)=>i.Append(r)),AppendInterval:this.method((i,r)=>i.AppendInterval(r)),AppendCallback:this.method((i,r)=>i.AppendCallback(r)),Join:this.method((i,r)=>i.Join(r)),Insert:this.method((i,r,n)=>i.Insert(r,n)),InsertCallback:this.method((i,r,n)=>i.InsertCallback(r,n)),Play:this.method(i=>i.Play()),Pause:this.method(i=>i.Pause()),Resume:this.method(i=>i.Resume()),Restart:this.method(i=>i.Restart()),Complete:this.method(i=>i.Complete()),Kill:this.method((i,r)=>i.Kill(r)),SetOnComplete:this.method((i,r)=>i.SetOnComplete(r)),SetOnStepComplete:this.method((i,r)=>i.SetOnStepComplete(r)),SetLoops:this.method((i,r)=>i.SetLoops(r))})}mtSignal(t){this.mtIndexNewindex(t,"ServerSignal",()=>{},()=>{},{AddParam:this.method((i,r,n)=>i.AddParam(r,n)),SendSignal:this.method(i=>i.SendSignal()),AddInt:this.method((i,r)=>i.AddInt(r)),AddIntList:this.method((i,r)=>i.AddIntList(r)),AddFloat:this.method((i,r)=>i.AddFloat(r)),AddFloatList:this.method((i,r)=>i.AddFloatList(r)),AddString:this.method((i,r)=>i.AddString(r)),AddStringList:this.method((i,r)=>i.AddStringList(r)),AddVector3:this.method((i,r)=>i.AddVector3(r)),AddVector3List:this.method((i,r)=>i.AddVector3List(r)),AddBool:this.method((i,r)=>i.AddBool(r)),AddBoolList:this.method((i,r)=>i.AddBoolList(r)),AddGuid:this.method((i,r)=>i.AddGuid(r)),AddGuidList:this.method((i,r)=>i.AddGuidList(r)),AddEntity:this.method((i,r)=>i.AddEntity(r)),AddEntityList:this.method((i,r)=>i.AddEntityList(r)),AddPrefabId:this.method((i,r)=>i.AddPrefabId(r)),AddPrefabIdList:this.method((i,r)=>i.AddPrefabIdList(r)),AddConfigId:this.method((i,r)=>i.AddConfigId(r)),AddConfigIdList:this.method((i,r)=>i.AddConfigIdList(r))})}luaRequire(t){let i=Z(t,1),r=this.normalizeRequirePath(i),n=this.requireAliases.get(r)||r;d.lua_rawgeti(t,Ct,d.LUA_RIDX_MAINTHREAD);let o=d.lua_tothread(t,-1);d.lua_pop(t,1);let a=this.requireCache.get(o);a||(a=new Map,this.requireCache.set(o,a));let s=a.get(n);if(s?.loading)return d.lua_pushstring(t,M(`failed to load script '${r}': cyclic require`)),d.lua_error(t);if(s&&s.ref!=null)return d.lua_rawgeti(t,Ct,s.ref),1;let c=this.scriptFiles.get(n);if(c==null)return d.lua_pushstring(t,M(`failed to load script '${r}'`)),d.lua_error(t);let l=d.lua_gettop(t);a.set(n,{loading:!0});try{this.loadModule(t,o,n,c),d.lua_pushvalue(t,-1);let u=Q.luaL_ref(t,Ct);return a.set(n,{ref:u}),1}catch(u){return a.delete(n),d.lua_settop(t,l),d.lua_pushstring(t,M(`failed to load script '${r}': ${u.message||u}`)),d.lua_error(t)}}newLuaThread(){let t=Q.luaL_newstate();return qa.luaL_openlibs(t),is(t),this.installMetatables(t),this.installGlobals(t),this.luaStates.add(t),d.lua_pushglobaltable(t),this.copyLuaEnvironment(t,-1),d.lua_remove(t,-2),this.moduleBaseEnvironments.set(t,Q.luaL_ref(t,Ct)),t}copyLuaEnvironment(t,i){let r=d.lua_absindex(t,i);d.lua_newtable(t);let n=d.lua_absindex(t,-1);for(d.lua_pushnil(t);d.lua_next(t,r)!==0;)d.lua_pushvalue(t,-2),d.lua_pushvalue(t,-2),d.lua_rawset(t,n),d.lua_pop(t,1);d.lua_pushvalue(t,n),d.lua_setfield(t,n,M("_G"))}closeTrackedLuaState(t){if(!t||!this.luaStates.has(t))return;for(let r of this.requireCache.get(t)?.values()||[])r.ref!=null&&Q.luaL_unref(t,Ct,r.ref);this.requireCache.delete(t);let i=this.moduleBaseEnvironments.get(t);if(i!=null&&Q.luaL_unref(t,Ct,i),this.moduleBaseEnvironments.delete(t),this.luaStates.delete(t),this.luaFunctions)for(let[r,n]of this.luaFunctions)n.__luaState===t&&this.luaFunctions.delete(r);ts(t)}loadModule(t,i,r,n){let o={__kind:"Script",alive:!0,scriptMappingId:this.resolveScriptMappingId(),object:null,path:r,enabled:!0,updateEnabled:!1,params:{},env:t,invoke(){}},a=String(n).replace(/^\uFEFF/,""),s=cr(a);if(Q.luaL_loadbuffer(t,s,s.length,M(`@${r}`))!==Oe)throw new Error(Z(t,-1));let l=d.lua_absindex(t,-1);if(d.lua_rawgeti(t,Ct,this.moduleBaseEnvironments.get(i)),this.copyLuaEnvironment(t,-1),d.lua_remove(t,-2),this.pushScript(t,o),d.lua_setfield(t,-2,M("script")),d.lua_setupvalue(t,l,1),d.lua_pcall(t,0,1,0)!==Oe)throw new Error(Z(t,-1))}mountScript({path:t,source:i,control:r,params:n={},scriptMappingId:o=void 0}){this.L||this.boot();let a=this.newLuaThread(),s={__kind:"Script",alive:!0,scriptMappingId:this.resolveScriptMappingId(o),object:r,path:this.normalizeRequirePath(t),enabled:!0,updateEnabled:!1,params:n,env:a,lifecyclePhase:"idle"};s.invoke=(l,u)=>this.invokeOn(a,l,u),r&&r.scripts.push(s),this.mountedScripts.push(s),this.pushScript(a,s),d.lua_setglobal(a,M("script"));let c=this.lifecyclePhase;try{this.lifecyclePhase="OnInit",s.lifecyclePhase="OnInit",this.runChunk(a,i,t);let l=this.callGlobal(a,"OnInit");l&&this.mountErrors.push(l),this.lifecyclePhase="OnEnable",s.lifecyclePhase="OnEnable";let u=this.callGlobal(a,"OnEnable");u&&this.mountErrors.push(u),this.lifecyclePhase="OnStart",s.lifecyclePhase="OnStart";let f=this.callGlobal(a,"OnStart");return f&&this.mountErrors.push(f),this.lifecyclePhase="running",s.lifecyclePhase="running",s}catch(l){throw s.alive=!1,s.lifecyclePhase="failed",this.mountedScripts=this.mountedScripts.filter(u=>u!==s),r&&(r.scripts=r.scripts.filter(u=>u!==s)),this.varHandlers=this.varHandlers.filter(u=>u.script!==s),this.signalHandlers=this.signalHandlers.filter(u=>u.script!==s),this.lifecyclePhase=c,a&&a!==this.L&&this.closeTrackedLuaState(a),s.env=null,l}}runChunk(t,i,r){let n=String(i).replace(/^\uFEFF/,""),o=cr(n),a=Q.luaL_loadbuffer(t,o,o.length,M(`@${r}`));if(a!==Oe){let c=Z(t,-1)||`luaL_loadbuffer status ${a}`;throw d.lua_pop(t,1),new Error(c)}let s=d.lua_pcall(t,0,0,0);if(s!==Oe){let c=Z(t,-1)||`lua_pcall status ${s}`;throw d.lua_pop(t,1),new Error(c)}}callGlobal(t,i){if(d.lua_getglobal(t,M(i)),d.lua_isfunction(t,-1)){if(d.lua_pcall(t,0,0,0)!==Oe){let n=Z(t,-1);d.lua_pop(t,1);let o=`${i}: ${n}`;return this.log("lua-error",o),o}}else d.lua_pop(t,1);return null}callGlobalDt(t,i,r){if(d.lua_getglobal(t,M(i)),d.lua_isfunction(t,-1)){if(d.lua_pushnumber(t,r),d.lua_pcall(t,1,0,0)!==Oe){let o=Z(t,-1);d.lua_pop(t,1),this.log("lua-error",`${i}: ${o}`)}}else d.lua_pop(t,1)}luaInvoke(t){let i=Qe(t,1);if(!i||i.__kind!=="Script")return Q.luaL_error(t,M("bad self to 'Invoke' (Script expected)"));let r=Z(t,2),n=i.env;if(!n||n.l_G!==t.l_G){let c=[];for(let f=3;f<=d.lua_gettop(t);f++)c.push(me(t,this,f));let l;try{l=i.invoke(r,c)}catch(f){return Q.luaL_error(t,M(String(f.message||f)))}if(l===void 0)return 0;let u=Array.isArray(l)&&l.__multi?l:[l];for(let f of u)le(t,this,f);return u.length}let o=2;if(d.lua_getglobal(t,M(r)),!d.lua_isfunction(t,-1))return 0;d.lua_replace(t,o),d.lua_remove(t,1);let a=d.lua_gettop(t)-1;return d.lua_pcall(t,a,ps,0)!==Oe?d.lua_error(t):d.lua_gettop(t)}invokeOn(t,i,r){let n=d.lua_gettop(t);if(d.lua_getglobal(t,M(i)),!d.lua_isfunction(t,-1)){d.lua_settop(t,n);return}for(let c of r)le(t,this,c);if(d.lua_pcall(t,r.length,ps,0)!==Oe){let c=Z(t,-1);throw d.lua_settop(t,n),new Error(c)}let a=d.lua_gettop(t)-n;if(a<=0){d.lua_settop(t,n);return}if(a===1){let c=me(t,this,-1);return d.lua_settop(t,n),c}let s=[];for(let c=1;c<=a;c++)s.push(me(t,this,n+c));return d.lua_settop(t,n),s.__multi=!0,s}runScriptPhase(t,i){for(let r of this.mountedScripts){if(!this.scriptCanRun(r))continue;let n=r.env;n&&(this.pushScript(n,r),d.lua_setglobal(n,M("script")),!(t==="OnUpdate"&&!r.updateEnabled)&&this.callGlobalDt(n,t,i))}}step(t=1/30){if(typeof t!="number"||!Number.isFinite(t)||t<0)throw new TypeError("dt must be a finite non-negative number");this.clock.frame++,this.clock.time+=t;for(let[r,n]of this.audios)this.clock.time+1e-9>=n.startedAt+n.duration&&(n.alive=!1,this.audios.delete(r),this.audioRevision++);let i=!this.clock.paused;for(let r of[...this.animations])r.step(t);this.runScriptPhase("OnUpdate",t),i&&(this.clock.levelTime+=t,this.runScriptPhase("OnLevelUpdate",t))}injectKey(t){let i=r=>{if(!r.alive||!r.activeInHierarchy)return!1;if(r.keyListeners.has(t)&&r.emitKey(t))return!0;for(let n of[...r.children])if(i(n))return!0;return!1};for(let r of[...this.roots])i(r)}injectCursor(t,i,r){let n=r||this.makeCursorEventData({});Number.isFinite(n.x)&&Number.isFinite(n.y)&&(this.cursor.x=n.x,this.cursor.y=n.y),t.emitCursor(i,n)}getVar(t,i){if(this.serverBridge&&typeof this.serverBridge.getVar=="function")return this.serverBridge.getVar(t,i);let r=this.serverVars[t];return r?r[i]:void 0}notifyVarHandlers(t,i){for(let r of this.varHandlers)this.scriptCanRun(r.script)&&r.entityType===t&&r.name===i&&this.safeCall(r.fn,this.enumTree.CustomVariableEntityType[t],i)}setVar(t,i,r){if(this.serverBridge&&typeof this.serverBridge.setVar=="function"){this.serverBridge.setVar(t,i,r);return}let n=this.serverVars[t]||(this.serverVars[t]=Object.create(null));n[i]=r,this.notifyVarHandlers(t,i)}sendClientSignal(t,i){for(let r of this.signalHandlers)this.scriptCanRun(r.script)&&r.name===t&&this.safeCall(r.fn,t,i)}evalQueryScript(t,i){this.L||this.boot();let r=this.L;d.lua_createtable(r,0,5);let n=(o,a)=>{d.lua_pushcfunction(r,a),d.lua_setfield(r,-2,M(o))};return n("var",o=>(le(o,this,i.var(Z(o,1),Z(o,2))),1)),n("logContains",o=>(d.lua_pushboolean(o,i.logContains(Z(o,1))),1)),n("control",o=>(le(o,this,i.control(Z(o,1))),1)),n("logs",o=>(le(o,this,i.logs()),1)),n("signals",o=>(le(o,this,i.signals(Z(o,1))),1)),n("serverLogs",o=>(le(o,this,i.serverLogs?i.serverLogs():[]),1)),n("serverLogContains",o=>{let a=i.serverLogContains;return d.lua_pushboolean(o,a?!!a(Z(o,1)):!1),1}),d.lua_setglobal(r,M("query")),this.runChunk(r,t,"autotest-assert"),!0}destroy(){for(let t of this.roots.slice())this.destroyControl(t);for(let t of this.mountedScripts.slice())this.unmountScript(t);this.lifecyclePhase="idle",this.mountedScripts=[],this.luaFunctions.clear();for(let t of[...this.luaStates])this.closeTrackedLuaState(t);this.L=null,this.audios.clear(),this.audioHistory.length=0,this.audioWarnings.clear()}};function Ei(e){let t=new mr(e);return t.boot(),t}var Et=Object.freeze(Array.from({length:8},(e,t)=>`Player${t+1}`)),jn=Object.freeze(Array.from({length:8},(e,t)=>`Avatar${t+1}`)),xs=Object.freeze(["Level","PlayerSelf","AvatarSelf"]);var Yn=Object.freeze([...xs,...Et,...jn]),Is=Object.freeze(["PlayerSelf","AllPlayers",...Et]),lf=Object.freeze(["Level","PlayerSelf",...Et]),ms=Object.freeze(["Int","Float","String","Bool","Vector3","Entity","Guid","PrefabId","ConfigId","IntList","FloatList","StringList","BoolList","Vector3List","EntityList","GuidList","PrefabIdList","ConfigIdList","Dict","Struct"]),cf=-2147483648,uf=2147483647,ff=new Set(["set-custom-variable","get-custom-variable","custom-variable-changed","\u8BBE\u7F6E\u81EA\u5B9A\u4E49\u53D8\u91CF","\u83B7\u53D6\u81EA\u5B9A\u4E49\u53D8\u91CF","\u81EA\u5B9A\u4E49\u53D8\u91CF\u53D8\u5316\u65F6","send-signal","listen-signal","send-client-script-signal","\u53D1\u9001\u4FE1\u53F7","\u76D1\u542C\u4FE1\u53F7","\u53D1\u9001\u5BA2\u6237\u7AEF\u811A\u672C\u4FE1\u53F7","setVar","getVar","signal","var"]);function Ai(e){return`Player${Number(e)}`}function gr(e){return`Avatar${Number(e)}`}function gs(e){let t=String(e||"").match(/^(?:Player|Avatar)([1-8])$/);return t?Number(t[1]):0}function kt(e){if(e==null||e==="")return 1;let t=Number(e);if(!Number.isInteger(t)||t<1||t>8)throw new Error("playerCount must be an integer 1-8");return t}function Ze(e,t=8){let i=kt(t);if(e==null||e==="")return 1;let r=Number(e);if(!Number.isInteger(r)||r<1||r>i)throw new Error(`playerIndex must be an integer 1-${i}`);return r}function ys(){let e={Level:Object.create(null),PlayerSelf:Object.create(null),AvatarSelf:Object.create(null)};for(let t of Et)e[t]=Object.create(null);for(let t of jn)e[t]=Object.create(null);return e}function Cs(e){let t=String(e||"");if(!Yn.includes(t))throw new Error(`unknown CustomVariableEntityType: ${e}`);return t}function df(e,t){let i=Cs(e);if(!lf.includes(i))throw new Error(`${t}.entityType must be Level, PlayerSelf, or Player1-8`);return i}function _i(e){let t=String(e??"");if(!t)throw new Error("custom variable name is required");return t}function yr(e){let t=String(e??"");if(!t)throw new Error("signal name is required");return t}function Ln(e){let t=String(e||"PlayerSelf");if(!Is.includes(t))throw new Error(`unsupported client signal target: ${e}. use PlayerSelf, AllPlayers, or Player1-8`);return t}function Pi(e){if(e==null)return"";if(typeof e=="boolean")return"Bool";if(typeof e=="string")return"String";if(typeof e=="number")return Number.isInteger(e)?"Int":"Float";if(Array.isArray(e)){if(e.length===0)return"IntList";let t=Pi(e[0]);return t&&!t.endsWith("List")&&t!=="Dict"&&t!=="Struct"?`${t}List`:"IntList"}return e&&typeof e=="object"?"x"in e||"y"in e||"z"in e?"Vector3":"Dict":""}function Ce(e){return e===void 0?null:JSON.parse(JSON.stringify(e))}function bs(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"value")&&"type"in t?t.value:t):[]}function vs(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"value")&&"type"in t?{type:String(t.type||""),value:t.value}:{type:Pi(t),value:t}):[]}function hf(e){return String(e?.kind||e?.type||e?.name||e?.id||"")}function br(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ks(e,t){if(!br(e)||!Object.prototype.hasOwnProperty.call(e,"fromSignalParam"))return null;if(Object.keys(e).some(r=>r!=="fromSignalParam"))throw new Error(`${t}.fromSignalParam cannot be combined with literal fields`);let i=Number(e.fromSignalParam);if(!Number.isSafeInteger(i)||i<0)throw new Error(`${t}.fromSignalParam must be a non-negative integer`);return{fromSignalParam:i}}function ws(e,t){return ks(e,t)||Ce(e)}function pf(e,t,i){if(!br(e))throw new Error(`serverLogic.rules[${t}].actions[${i}] must be an object`);let r=String(e.kind||e.type||""),n=`serverLogic.rules[${t}].actions[${i}]`;if(r==="setCustomVariable"){let o=df(e.entityType,n);if(!Object.prototype.hasOwnProperty.call(e,"value"))throw new Error(`${n}.value is required`);return{kind:r,entityType:o,name:_i(e.name),value:ws(e.value,`${n}.value`),...e.variableType?{variableType:String(e.variableType)}:{}}}if(r==="sendClientScriptSignal"){if(!Array.isArray(e.params))throw new Error(`${n}.params must be an array`);return{kind:r,target:Ln(e.target),signalName:yr(e.signalName),params:e.params.map((o,a)=>ws(o,`${n}.params[${a}]`))}}throw new Error(`${n}.kind must be setCustomVariable or sendClientScriptSignal`)}function Ti(e){if(e==null)return{version:1,rules:[]};if(!br(e))throw new Error("serverLogic must be an object");let t=e.rules===void 0?[]:e.rules;if(!Array.isArray(t))throw new Error("serverLogic.rules must be an array");return{version:1,rules:t.map((i,r)=>{if(!br(i))throw new Error(`serverLogic.rules[${r}] must be an object`);if(!Array.isArray(i.actions)||i.actions.length===0)throw new Error(`serverLogic.rules[${r}].actions must be a non-empty array`);return{id:String(i.id||`signal-${r+1}`),signalName:yr(i.signalName),actions:i.actions.map((n,o)=>pf(n,r,o))}})}}function Ss(e,t,{typed:i=!1}={}){let r=ks(e,"server logic value");if(r){let n=i?t.params:t.values;if(r.fromSignalParam>=n.length)throw new Error(`signal ${t.name} has no parameter at index ${r.fromSignalParam}`);return Ce(n[r.fromSignalParam])}return Ce(e)}function mf(e){return e==="Level"?"Level":Et.includes(e)?"PlayerSelf":jn.includes(e)?"AvatarSelf":e}function Es(e={}){let t=ys(),i=ys(),r=[],n=[],o=[],a=[],s=Array.from({length:9},()=>null),c=1,l=0,u=Number(e.onlineLatencyMs||0);(!Number.isFinite(u)||u<0)&&(u=0);let f=Ti(e.logic),h=kt(e.playerCount),p=Ze(e.viewPlayerIndex,h);function m(w,A){a.push({source:"server",level:String(w||"engine"),text:String(A),time:l})}function y(w){let A=s[w||p],x=Number(A?.clock?.time);Number.isFinite(x)&&(l=x)}function I(w,A,x,k){t[w][A]=x,i[w][A]={type:k||Pi(x)||i[w][A]?.type||""}}function b(w,A,x){return typeof x!="number"||!Number.isInteger(x)?{ok:!0,value:x}:x>=cf&&x<=uf?{ok:!0,value:x}:(m("engine",`Int custom variable ${w}.${A} out of range ${x}; keeping previous legal value`),{ok:!1,value:t[w][A]})}function v(w,A){let x=Cs(w),k=A||p;return x==="PlayerSelf"?Ai(k):x==="AvatarSelf"?gr(k):x}function P(w,A){let x=mf(w);if(w==="Level"){for(let E=1;E<=h;E+=1){let _=s[E];_&&typeof _.notifyVarHandlers=="function"&&_.notifyVarHandlers("Level",A)}return}let k=gs(w);if(!k)return;let z=s[k];z&&typeof z.notifyVarHandlers=="function"&&z.notifyVarHandlers(x,A)}function R(w,A){let x=Ln(w);return x==="AllPlayers"?Array.from({length:h},(k,z)=>z+1):x==="PlayerSelf"?[A||p]:[gs(x)]}function F(w){for(let A of f.rules)if(A.signalName===w.name)for(let x of A.actions){if(x.kind==="setCustomVariable"){let k=Ss(x.value,w);G.setVar(x.entityType,x.name,k,{type:x.variableType,playerIndex:w.playerIndex}),m("info",`logic ${A.id}: set ${x.entityType}.${x.name}`);continue}if(x.kind==="sendClientScriptSignal"){let k=x.params.map(z=>Ss(z,w,{typed:!0}));G.sendToClient(x.signalName,k,{target:x.target,playerIndex:w.playerIndex}),m("info",`logic ${A.id}: sent ${x.signalName} to ${x.target}`)}}}function $(w,A){w&&(w.serverBridge={getVar:(x,k)=>G.getVar(x,k,{playerIndex:A}),setVar:(x,k,z)=>G.setVar(x,k,z,{playerIndex:A}),receiveFromClient:(x,k)=>G.receiveFromClient(x,k,{playerIndex:A})})}function Y(w){w&&(w.serverBridge=null)}let G={ENTITY_TYPES:xs,ALL_ENTITY_TYPES:Yn,CLIENT_SIGNAL_TARGETS:Is,get clock(){return l},get playerCount(){return h},get viewPlayerIndex(){return p},setClock(w){l=Number(w)||0},setPlayerCount(w){return h=kt(w),p>h&&(p=h),h},setViewPlayerIndex(w){return p=Ze(w,h),p},log(w,A){m(w,A)},defineVar(w,A,x={},{playerIndex:k}={}){let z=v(w,k),E=_i(A);if(Object.prototype.hasOwnProperty.call(t[z],E))throw new Error(`custom variable already exists: ${z}.${E}`);let _=x.type?String(x.type):Pi(x.value??x.defaultValue);if(_&&!ms.includes(_))throw new Error(`unsupported custom variable type: ${_}`);let B=x.value!==void 0?x.value:x.defaultValue!==void 0?x.defaultValue:null;return I(z,E,B,_),G.getVar(z,E)},getVar(w,A,{playerIndex:x}={}){let k=v(w,x),z=_i(A);if(!Object.prototype.hasOwnProperty.call(t[k],z)){m("engine",`GetGlobalCustomVariableValue missing ${k}.${z}; returning nil (simulator policy)`);return}return t[k][z]},setVar(w,A,x,{notify:k=!0,type:z,playerIndex:E}={}){let _=v(w,E),B=_i(A),j=z||i[_][B]?.type||Pi(x);if(j&&!ms.includes(j)&&j!=="")throw new Error(`unsupported custom variable type: ${j}`);let re=x;if(!((j==="Int"||j===""&&typeof x=="number"&&Number.isInteger(x))&&(re=b(_,B,x).value,re===void 0)))return I(_,B,re,j),k&&P(_,B),re},listVars(w){let A=w?[v(w)]:["Level",...Array.from({length:h},(k,z)=>Ai(z+1)),...Array.from({length:h},(k,z)=>gr(z+1))],x=[];for(let k of A)for(let z of Object.keys(t[k]))x.push({entityType:k,name:z,type:i[k][z]?.type||"",value:Ce(t[k][z])});return x},receiveFromClient(w,A=[],{playerIndex:x}={}){let k=Ze(x||p,h);y(k);let z=yr(w),E={id:c++,direction:"inbound",name:z,params:vs(A),values:bs(A),time:l,playerIndex:k,from:Ai(k)};return r.push(E),F(E),E},sendToClient(w,A=[],{target:x="PlayerSelf",playerIndex:k}={}){let z=yr(w),E=Ln(x),B=R(E,k||p),j={id:c++,direction:"outbound",name:z,params:vs(A),values:bs(A),time:l,target:E,players:B,deliverAt:l+u/1e3,delivered:!1};return n.push(j),u===0?G.deliver(j):o.push(j),j},getLogic(){return Ce(f)},setLogic(w){return f=Ti(w),G.getLogic()},deliver(w){if(!w||w.delivered)return;w.delivered=!0;let A=Array.isArray(w.players)&&w.players.length?w.players:R(w.target);for(let x of A){let k=s[x];k&&typeof k.sendClientSignal=="function"&&k.sendClientSignal(w.name,w.values)}},flush(w){w!==void 0&&(l=Number(w)||0);let A=[];for(let x=o.length-1;x>=0;x-=1)o[x].deliverAt<=l&&A.push(o.splice(x,1)[0]);A.sort((x,k)=>x.id-k.id);for(let x of A)G.deliver(x);return A},inbound(){return r.slice()},outbound(){return n.slice()},loadConfig(w){if(w!=null){if(typeof w!="object")throw new Error("server config must be an object");if(w.graph&&!Array.isArray(w.nodes))throw new Error("unsupported server node graph: v1 only accepts custom variables and signals");for(let A of w.nodes||[]){let x=hf(A);if(!ff.has(x))throw new Error(`unsupported server node: ${x||JSON.stringify(A)}. v1 only supports custom variables and signals`)}if(w.onlineLatencyMs!==void 0){let A=Number(w.onlineLatencyMs);if(!Number.isFinite(A)||A<0)throw new Error("onlineLatencyMs must be a non-negative finite number");u=A}w.playerCount!==void 0&&G.setPlayerCount(w.playerCount),w.viewPlayerIndex!==void 0&&G.setViewPlayerIndex(w.viewPlayerIndex),(w.logic!==void 0||w.serverLogic!==void 0)&&G.setLogic(w.logic??w.serverLogic);for(let A of w.vars||[]){let x=v(A.entityType),k=_i(A.name);Object.prototype.hasOwnProperty.call(t[x],k)?G.setVar(x,k,A.value??A.defaultValue,{notify:!1,type:A.type}):G.defineVar(x,k,A)}}},attachRuntime(w,{playerIndex:A=1}={}){let x=Ze(A,8);return s[x]&&s[x]!==w&&Y(s[x]),s[x]=w||null,$(s[x],x),G},attachRuntimes(w){G.detachRuntime();let A=Array.isArray(w)?w:[];for(let x=0;x<A.length&&x<8;x+=1)s[x+1]=A[x]||null,$(s[x+1],x+1);return G},detachRuntime(){for(let w=1;w<=8;w+=1)Y(s[w]),s[w]=null},snapshot(){let w=Ai(p),A=gr(p),x={Level:{},PlayerSelf:{},AvatarSelf:{}};for(let k of Object.keys(t.Level))x.Level[k]={type:i.Level[k]?.type||"",value:Ce(t.Level[k])};for(let k of Object.keys(t[w]))x.PlayerSelf[k]={type:i[w][k]?.type||"",value:Ce(t[w][k])};for(let k of Object.keys(t[A]))x.AvatarSelf[k]={type:i[A][k]?.type||"",value:Ce(t[A][k])};for(let k=1;k<=h;k+=1){let z=Ai(k),E=gr(k);x[z]={},x[E]={};for(let _ of Object.keys(t[z]))x[z][_]={type:i[z][_]?.type||"",value:Ce(t[z][_])};for(let _ of Object.keys(t[E]))x[E][_]={type:i[E][_]?.type||"",value:Ce(t[E][_])}}return{clock:l,onlineLatencyMs:u,playerCount:h,viewPlayerIndex:p,logic:G.getLogic(),vars:x,inbound:r.map(k=>({id:k.id,name:k.name,params:Ce(k.params),values:Ce(k.values),time:k.time,playerIndex:k.playerIndex,from:k.from})),outbound:n.map(k=>({id:k.id,name:k.name,params:Ce(k.params),values:Ce(k.values),time:k.time,target:k.target,players:Array.isArray(k.players)?k.players.slice():[],deliverAt:k.deliverAt,delivered:!!k.delivered})),logs:a.map(k=>({source:"server",level:k.level,text:k.text,time:k.time}))}},reset(){for(let w of Yn){for(let A of Object.keys(t[w]))delete t[w][A];for(let A of Object.keys(i[w]))delete i[w][A]}r.length=0,n.length=0,o.length=0,a.length=0,c=1,l=0},destroy(){G.detachRuntime(),G.reset()}};e.config&&G.loadConfig(e.config);for(let w of e.vars||[])G.defineVar(w.entityType,w.name,w);return G}var gf={container:"container",textbox:"textbox",image:"image",button:"button",cursor:"cursor",grid:"grid",reference:"reference",textwindow:"textwindow",keyhint:"keyhint",animation:"animation",fullscreen:"fullscreen"};function Hn(e,t,i=null){let r=at(e.transformByPlatform,t),n={authoringId:e.id,kind:gf[e.kind]||"container",name:e.name,prefabIndex:e.guid||0,active:e.active!==!1,visible:e.visible!==!1,canControllerFocus:e.canControllerFocus===!0,anchoredPositionX:r.offset.x,anchoredPositionY:r.offset.y,sizeDeltaX:r.size.x,sizeDeltaY:r.size.y,anchorMinX:r.anchorMin.x,anchorMinY:r.anchorMin.y,anchorMaxX:r.anchorMax.x,anchorMaxY:r.anchorMax.y,pivotX:r.pivot.x,pivotY:r.pivot.y,localScaleX:r.scale.x,localScaleY:r.scale.y,localScaleZ:r.scale.z,localRotationX:r.rotation.x,localRotationY:r.rotation.y,localRotationZ:r.rotation.z,children:(e.children||[]).map(a=>Hn(a,t,i))},o=i?.get(e.id);return o?.length&&(n.scripts=o.map(a=>{let s=Number(a.guid);return{path:a.path||a.id,source:a.source||"",...Number.isSafeInteger(s)&&s>0?{scriptMappingId:s}:{}}})),e.kind==="container"&&(n.isolateNavigation=e.isolateNavigation===!0,n.disableKeyEventPassthrough=e.disableKeyEventPassthrough===!0,n.disableCursorEventPassthrough=e.disableCursorEventPassthrough===!0,n.showCursor=e.showCursor===!0),(e.kind==="textbox"||e.kind==="textwindow")&&(n.text=e.text??"",n.fontSize=e.fontSize,n.adaptiveFontSize=e.adaptiveFontSize===!0,n.minimumFontSize=e.minimumFontSize,n.fontColor=e.fontColor,n.bgColor=e.bgColor,n.enableOutline=e.enableOutline!==!1,n.outlineColor=e.outlineColor,n.horizontalAlignment=e.horizontalAlignment||"Left",n.verticalAlignment=e.verticalAlignment||"Top",e.kind==="textwindow"&&(n.interactable=e.interactable!==!1,n.showScrollBar=e.showScrollBar!==!1)),e.kind==="image"&&(n.imageSource=e.imageSource,n.imageType=e.imageType??null,n.imageId=e.imageId??0,n.imageColor=e.imageColor,n.raycastTarget=e.raycastTarget===!0,n.enableMask=e.enableMask===!0,n.enableSoftEdge=e.enableSoftEdge===!0,n.softEdgeMode=e.softEdgeMode,n.softEdgeWidthX=e.softEdgeWidthX,n.softEdgeWidthY=e.softEdgeWidthY,n.horizontalSoftRange=e.horizontalSoftRange,n.verticalSoftRange=e.verticalSoftRange,n.enableFill=e.enableFill===!0,n.fillType=e.enableFill?e.fillType:"Unused",n.fillHorizontalType=e.fillHorizontalType,n.fillVerticalType=e.fillVerticalType,n.fillRadial90Type=e.fillRadial90Type,n.fillRadialType=e.fillRadialType,n.fillAmount=e.fillAmount,n.reverseMaskArea=e.reverseMaskArea===!0),e.kind==="button"&&(n.raycastTarget=e.raycastTarget!==!1,n.interactable=e.interactable!==!1,n.clickAudioId=e.clickAudioId,n.unavailableChildId=e.unavailableChildId??null,n.hoverChildId=e.hoverChildId??null,n.pressedChildId=e.pressedChildId??null,n.selectedChildId=e.selectedChildId??null),e.kind==="cursor"&&(n.raycastTarget=e.raycastTarget!==!1),e.kind==="reference"&&(n.referencedPrefabIndex=e.referencedPrefabId),e.kind==="grid"&&(n.itemPrefabIndex=e.itemPrefabId,n.raycastTarget=e.raycastTarget!==!1,n.interactable=e.interactable!==!1,n.showScrollBar=e.showScrollBar!==!1,n.scrollDirection=e.scrollDirection,n.layoutConstraint=e.layoutConstraint,n.layoutConstraintFixedCount=e.layoutConstraintFixedCount,n.cellSizeX=e.cellSizeX,n.cellSizeY=e.cellSizeY,n.spacingX=e.spacingX,n.spacingY=e.spacingY,n.padding1X=e.padding1X,n.padding1Y=e.padding1Y,n.padding2X=e.padding2X,n.padding2Y=e.padding2Y,n.previewCount=e.previewCount),e.kind==="keyhint"&&(n.keyboardKeyCode=e.keyboardKeyCode,n.controllerKeyCode=e.controllerKeyCode),(e.kind==="animation"||e.kind==="fullscreen")&&(n.raycastTarget=!1,n.animationId=e.animationId,n.playSoundEffect=e.playSoundEffect,e.kind==="animation"&&(n.layer=e.layer)),n}function Un(e,t=[],i=""){let r=i&&K[i]?i:e.canvasId,n=K[r],o=gi(e),a=new Map;for(let c of t){if(!c.controlId)continue;let l=a.get(c.controlId)||[];l.push(c),a.set(c.controlId,l)}let s=e.meta?.assetType==="client-control-template"?(e.root.children||[]).map(c=>Hn(c,r,a)):[];return{canvasId:r,platform:n.platform,device:n.luaDevice,canvasWidth:n.width,canvasHeight:n.height,root:Hn(o,r,a),templates:s}}var vr="qxqy-autotest";var _t=.03333333333333333,yf=new Set(["pointer","key","click","pause","resume","serverSet","serverSend","view"]),bf=new Set(["log","control","var","signal","tree","lua"]);function At(e,t){let i=Number(e);if(!Number.isFinite(i))throw new Error(`${t} must be a finite number`);return i}function Xn(e){return JSON.parse(JSON.stringify(e??null))}function wr(e,t){if(!e||typeof e!="object")throw new Error(`events[${t}] must be an object`);let i=String(e.kind||e.do||"");if(!yf.has(i))throw new Error(`unsupported event kind: ${i||"(empty)"}`);let r=e.payload&&typeof e.payload=="object"?{...e.payload}:{};if(i==="pointer")!r.type&&e.type&&(r.type=e.type),r.x===void 0&&(r.x=e.x),r.y===void 0&&(r.y=e.y),r.x=At(r.x,"pointer.x"),r.y=At(r.y,"pointer.y"),r.type=String(r.type||"click"),r.type==="wheel"&&(r.deltaX=At(r.deltaX??e.deltaX??0,"pointer.deltaX"),r.deltaY=At(r.deltaY??e.deltaY??0,"pointer.deltaY"));else if(i==="key"){if(r.typeName=String(r.typeName||r.key||e.typeName||e.key||""),!r.typeName)throw new Error("key event requires typeName")}else if(i==="click"){if(r.name=String(r.name||e.name||""),!r.name)throw new Error("click event requires control name")}else if(i==="serverSet"){if(r.entityType=String(r.entityType||e.entityType||""),r.name=String(r.name||e.name||""),r.value===void 0&&(r.value=e.value),r.value===void 0&&(r.value=null),!r.entityType||!r.name)throw new Error("serverSet requires entityType and name")}else if(i==="serverSend"){if(r.name=String(r.name||e.name||""),r.params=Array.isArray(r.params)?r.params:Array.isArray(e.params)?e.params:[],r.target=String(r.target||e.target||"PlayerSelf"),!r.name)throw new Error("serverSend requires signal name")}else if(i==="view"&&(r.playerIndex=Number(r.playerIndex||r.viewPlayerIndex||e.playerIndex||e.viewPlayerIndex||0),!Number.isInteger(r.playerIndex)||r.playerIndex<1))throw new Error("view event requires playerIndex 1-8");return{t:At(e.t??0,"event.t"),source:String(e.source||"user"),kind:i,payload:r}}function Wn(e,t){if(!e||typeof e!="object")throw new Error(`asserts[${t}] must be an object`);let i=String(e.kind||(e.check?"log":""));if(!bf.has(i))throw new Error(`unsupported assert kind: ${i||"(empty)"}`);let r={kind:i};if(e.at!==void 0&&(r.at=At(e.at,"assert.at")),i==="log"){if(r.contains=String(e.contains||e.check||e.text||""),r.source=e.source==="server"?"server":"client",e.level&&(r.level=String(e.level)),!r.contains)throw new Error("log assert requires contains")}else if(i==="control"){if(r.id=e.id?String(e.id):"",r.name=e.name?String(e.name):"",r.field=String(e.field||""),!r.field)throw new Error("control assert requires field");if(!r.id&&!r.name)throw new Error("control assert requires id or name");if(!Object.prototype.hasOwnProperty.call(e,"equals"))throw new Error("control assert requires equals");r.equals=Xn(e.equals)}else if(i==="var"){if(r.entityType=String(e.entityType||""),r.name=String(e.name||""),!r.entityType||!r.name)throw new Error("var assert requires entityType and name");if(!Object.prototype.hasOwnProperty.call(e,"equals"))throw new Error("var assert requires equals");r.equals=Xn(e.equals)}else if(i==="signal"){if(r.direction=e.direction==="outbound"?"outbound":"inbound",r.name=String(e.name||""),!r.name)throw new Error("signal assert requires name");e.values!==void 0&&(r.values=Xn(e.values))}else if(i==="tree"){if(r.name=String(e.name||""),r.exists=e.exists!==!1,!r.name)throw new Error("tree assert requires name")}else if(i==="lua"&&(r.source=String(e.source||""),!r.source.trim()))throw new Error("lua assert requires source");return r}function As(e){let t=0,i=[],r=[];for(let n of e){if(!n||typeof n!="object")throw new Error("queue step must be an object");if(n.do!=="start"){if(n.do==="step"){t+=At(n.dt??_t,"step.dt");continue}if(n.do==="pointer"||n.do==="key"||n.do==="click"||n.do==="pause"||n.do==="resume"||n.do==="serverSet"||n.do==="serverSend"||n.do==="view"){i.push(wr({...n,kind:n.do,t},i.length));continue}if(n.assert||n.check||n.kind){r.push(Wn({...n.assert||n,at:n.at??t},r.length));continue}throw new Error(`unsupported queue step: ${JSON.stringify(n)}`)}}return{events:i,asserts:r,dt:_t}}function Ri(e){if(Array.isArray(e)){let r=As(e);return{format:vr,version:1,name:"",dt:r.dt,events:r.events,asserts:r.asserts}}if(!e||typeof e!="object")throw new Error("autotest case must be an object or step array");if(Array.isArray(e.queue)||Array.isArray(e.steps)){let r=As(e.queue||e.steps);return{format:vr,version:1,name:String(e.name||""),dt:Number(e.dt)>0?Number(e.dt):r.dt,events:r.events,asserts:r.asserts}}let t=(e.events||[]).map((r,n)=>wr(r,n)),i=(e.asserts||[]).map((r,n)=>Wn(r,n));return t.sort((r,n)=>r.t-n.t||0),{format:vr,version:1,name:String(e.name||""),dt:Number(e.dt)>0?Number(e.dt):_t,playerCount:Number(e.playerCount)>0?Number(e.playerCount):1,events:t,asserts:i}}function _s(e,t={}){let i=(e||[]).map((r,n)=>wr(r,n));return{format:vr,version:1,name:String(t.name||""),dt:Number(t.dt)>0?Number(t.dt):_t,playerCount:Number(t.playerCount)>0?Number(t.playerCount):1,events:i,asserts:(t.asserts||[]).map((r,n)=>Wn(r,n))}}function Ps(e,t,i){if(!e)return null;let r=wr({...t,t:t.t??i??0},e.events.length);return e.events.push(r),r}var Sr=(e,t)=>Math.max(0,Math.min(t,Number.isFinite(e)?e:0));function Ts(e,t,i){let r=qe(e,t,i),n=Math.max(0,r.contentHeight-i),o=Sr(e._scrollOffset||0,n);return e._scrollOffset=o,{...r,length:r.contentHeight,max:n,offset:o,viewport:i,horizontal:!1,width:t,height:i}}function Kt(e,t,i){if(!e?.showBar||e.max<=0||t<=0||i<=0)return null;let r=e.horizontal===!0,n=r?t:i,o=Math.max(0,n-4),a=Math.min(o,Math.max(18,o*n/(n+e.max))),s=o-a,c=s*e.offset/e.max,l=Math.min(8,r?i:t),u=r?{x:-t/2+2,y:i/2-l-2,width:o,height:l}:{x:t/2-l-2,y:-i/2+2,width:l,height:o},f=r?{...u,x:u.x+c,width:a}:{...u,y:u.y+c,height:a};return{track:u,thumb:f,travel:s}}var Rs="https://oss.070077.xyz/",Kn="mp3-v1",xr="/qxqy-audio/",vf=[[10001,"ura.1ht4.2ag9.1hh5.jbb.k02.jcw.2tv.2wn.2xk.2r3.d5s.94l.ebv.kcr.b40.77k.9gp.97w.1hb5.jag.btu.jc9.hp5.bmj.blq.blq.ff9.ffk.o74.1owl.rp.mg.l3.lf.lh.qy.1a3z.2xk.2xk.2xk.2xk.2xk.17dc.1f2b.2bc.2bc.2bc.2bc.2bc.ffo.ffo.126.1fk.4mo.4mo.15e.1h2.237.2ba.2kd.2bc.4mo.4mo.4mo.4mo.1mc.1n6.2cu.1ud.2b1.2ee.1tj.1tk"],[20001,"o6.fh.kb.cr.og.sm.6x.8c.87.o7.vz.kt.qo.lg.ob.9w.mg.1kz.zc.1ex.1d5.ps.uu.su.qs.ys.zp.10k.15a.xc.uk.mx.1ax.nt.tu.19m.uj.1ku.tt.100.ie.d3.fp.ie.ie.d3.fp.ie.8p.7k.fw.h0.qc.ot.uc.ot.rk.gb.1c2.ff.cl.9v.wg.1ir.1lr.1b8.1ri.1p0.104.10n.mw.j6.jb.f1.dv.84.a0.cp.bx.1ko.1au.1ia.rs.rt.rs.t7.x6.wi.zc.16f.1i6.2jh.28d.qh.k8.1gz.1ko.2iv.1xp.1l4.1gk.10j.yo.1jk.1jk.xv.104.15o.1xg.1xg.1xi.25i.p1.t1.yh.1ak.1i6.1y2.xt.32u.3g6.1bz.2mn.14l.14c.1e1.op.s8.p2.v5.2ix.1a0.ry.16m.17n.13c.134.ys.yu.xr.sl.sr.sd.yh.z5.gd.gl.hx.h2.g8.fj.iy.hz.jj.th.12n.16r.d3.j9.dg.lj.fl.a7.f9.iw.el.27f.1dh.1rh.2ph.yd.w5.x5.tr.pq.zf.16h.1a5.17t.wy.vn.y8.wl.yv.2ye.2qt.1ah.163.19t.uf.119.2vv.1bm.13h.14p.1so.c3.as.9z.19w.1l4.1nl.rj.we"],[30001,"jo.my.ss.dw.c1.b4.hl.hl.hl.cz.dw.dw.b4.dw.fr.kd.qv.px.px.74.6u.8h.60.8q.8b.eo.eo.eo.8k.a5.99.12v.13y.lg.m4.qr.dw.ex.g0.ef.cd.br.11n.17h.1b8.1c9.9p.ag.9z.l9.m8.m8.lw.m8.cz.99.b4.8c.63.7f.6h.99.re.pp.pi.cq.c9.cp.ck.c6.b0.bd.al.f6.gl.ed.fs.lc.k6.kh.i6.cx.j1.hk.gb.d7.h7.g2.em.kj.kn.k4.j5.rh.t0.qt.mj.i7.ih.i2.hd.3r.8d.6u.6z.by.de.dg.cr.1a5.1ab.16c.18g.n2.ly.no.nt.f9.de.lr.fe.f0.fj.el.fo.t1.g9.ly.h3.g6.de.2ak.2f3.wf.kg.qn.11p.rg.uj.u6.11c.22o.2cs.3dp.3dq.3d5.3d6.1zx.18v"],[40001,"19x.215.2zt.1ex.2pj.7hy.1ur.1gn.1g7.1b1.u9.1tw.108.1ew.rs.1qu.w9.lk.244.qi.b6.tk.jg.jg.jg.y4.c1.b4.iv.hi.r4.n7.gy.ev.qe.12z.18n.dw.1l6.ou.wz.1un.19t.18k.yy.1hs.sl.dw.1vl.100.14k.1q8.209.1jk.1xr.ua.1j2.pr.26h.1gs.s9.px.15v.pf.1jk.xc.1hb.111.172.ut.285.1oh.149.zj.22r.2l9.14a.ok.23y.1eh.xe.1j0.1rp.1cz.wf.1mh.22k.334.1z2.1xo.1br.4ji.5nq.5nf.2za.18r.h3.eo.ia.1kn.dc.ss.s0.1bl.1oc.is.km.177.1ec.1ao.h4.hp.dx.l9.iw.i3.12w.n1.yq.12w.1ju.yx.14s.18b.22t.u3.my.2rb.36w.13u.z8.20r.18g.19r.2x9.w4.q2.1d2.wo.13a.v6.17w.ur.288.1b6.14m.1fi.1xx.1ee.kj.121.j2.1d2.2ad.1ri.2lc.1vk.138.12r.xj.1h5.1c5.2qx.1gj.t2.lv.rf.18q.1kz.dw.2aq.ia.1i9.k5.199.f4.10y.18a.xf.rk.1g9.1q3.10h.sj.15o.e3.dz.sv.135.w9.yg.aw.2a2.19m.22w.1c8.272.13o.104.1sr.rs.1pb.d5.df.kp.jq.1a7.s8.1ao.ba.rb.in.pz.q8.140.ij.1e7.jl.yk.117.10i.1tn.1oj.1sv.sj.1e3.2so.1c7.1gv.178.107.10n.1dx.1qi.1wp.2bc.218.16r.105.xc.z6.11w.1mc.1y9.17p.1cs.2ij.18c.1ie.nn.16c.1ce.xb.1ei.3j0.ve.14x.1sx.285.1b8.1at.v4.rv.rs.10z.xq.11o.15k.xq.u1.i2.pu.i4.l3.9u.oh.mc.nm.pw.1i3.1h4.pj.111.l4.lb.qq.qf.u0.h4.nk.yf.6h.ij.ds.oy.re.m8.1gl.cz.16z.a1.1f8.1x6.vp.dz.gp.g6.fr.vl.fr.gg.qc.aj.99.go.ij.fz.11a.x5.mo.1u9.h0.m8.10m.1an.2bc.3uw.2gk.124.xb.1uk.1b6.2xj.1os.11a.vs.1i9.1lr.2gv.265.668.1xg.45j.404.2x1.1io.3om.4q2.4mo.1d4.2bp.1pr.166.2y6.2bv.361.2nc.2bc.3g0.7g4.334.2bc.2xo.3uw.6ic.4ig.3uw.23v.1la.2zr.1jt.1cq.27a.1n1.19x.1qg.1jn.1ca.26y.2d6.4v4.4mo.4mo.7ps.1jk.153.1fo.1dm.1s2.1w1.oe.1lb.319.2eg.58p.4mo.3dw.2y2.2xm.1u8.1ko.12n.1e0.2sd.1md.2cl.1q2.372.4mo.48s.b14.3fu.334.334.34i.4nf.4ji.5eg.3uw.2u8.1g1.110.37x.2jo.su.334.3aj.3uw.63f.2bc.2bc.8v4.1ts.ax5.5du.34d.3oc.34j.4si.174.rt.1rp.2b0.37d.1ta.2gh.28a.22z.1nc.1a5.1pa.4dd.3ha.2cs.5mv.4mq.5c2.3uw.1gf.4md.113.10x.21o.2hj.1b3.1cx.1ol.3ar.1fv.17t.1a7.2uj.2we.1jk"],[50001,"1o8.1k1.mo.1wu.2c9.22d.1kb.23n.1b8.1ic.24c.2wz.1mq.1mu.1jx.1z1.o3.190.vp.1h7.th.4mo.1rp.4mo.4mo.7ps.zz.143.21v.1nf.34s.1s3.r9.18t.s1.r9.21w.277.ls.25k.5v1.2bc.1kh.wt.14i.1eq.15o.668.sh.rl.3wi.3vc.43c.3yn.17c.f5.xu.jg.176.19v.1xy.23m.18x.30c.10l.13k.v8.vp.17t.qj.17m.1wr.1la.8t.s7.18d.1l2.152.mx.1c8.1l4.1f5.1xe.rz.2hz.1et.13t.xb.14r.15o.z0.1zo.ur.257.1gb.li.12d.15a.132.1m1.3vu.296.1mg.11m.z0.159.mp.hd.x4.1go.ns.xh.2a7.tt.2vb.1bx.1kh.u3.11i.1y1.24e.2hp.2mn.1w6.3zm.166.14g.1mo.2v9.2rg.2f9.1r0.139.m1.k3.ys.1dy.29k.1mm.22m.3zx.4dr.2h7.22o.tv.rm.1et.2wv.2ar.1t7.ku.12s.10b.1v9.1gu.12m.1b3.tv.1c8.tk.10s.ul.1tt.ka.oi.qb.13f.13f.13k.17h.1uh.ez.en.2x7.2ln.2h8.3h8.ig.n9.27o.18b.hl.nm.uk.11a.1ta.1k4.1eh.wv.1go.1gg.sc.18u.1dz.2aq.vt.2l7.25h.1l5.1kn.1vc.1b4.28i.17t.1d6.1k2.18z.jy.jw.dh.1mx.fr.vp.35w.34z.35w.34z.4so.vf.yx.1bg.1d3.2yc.1tg.8q3.99g.am.2du.rm.rg.xa.2cw.xc.1j6.1if.18z.13a.yz.142.1z5.262.1bj.1y8.ur.u5.16j.1pf.1bi.l8.1il.3vz.2dr.jo.ls.18s.16l.18c.141.219.1yz.1fc.24t.27e.481.1vp.25h.1yq.1zn.1uw.11u.1jp.1pz.39o.t6.1mj.1u5.11l.1vd.1dk.1zb.1ic.3ql.14p.1wq.25x.267.zn.zn.1pf.13z.1j7.r9.1hb.4yp.1lt.1cw.1z4.19z.1og.1j4.1cl.1eg.u8.16s.1en.zu.1hr.1js.19g.303.22j.2oa.180.1v7.2ud.2d7.21s.3g9.vh.v1.284.3lg.3lg.17q.1h3.4mo.1cm.1rv.22i.2mc.2j3.27o.333.1q8.237.2ll.23b.2sp.2ll.2ox.2cf.2f8.2hz.1uo.y4.s9.w6.2dg.2q9.up.1m1.1vz.2n8.192.1eb.z7.2em.2q3.1sd.1gj.348.3vf.2iu.29x.1dc.7oj.4pq.5vb.4mx.5me.5sf.5yf.7ps.yj.q0.10w.13p.18b.2wd.11q.2vx.dd.iv.12p.jh.u9.1uy.w0.3f0.3bj.126.qo.1gj.11k.pu.22h.1z6.rp.y4.y0.xl.1d0.11s.wa.1a6.127.10m.12r.1nh.1fy.yo.1js.162.n4.174.1aj.y4.o8.qz.rh.qa.18s.mr.j3.ii.sr.sx.1jk.17l.mj.zr.uy.wa.19t.2bt.xe.1od.hs.xr.5b.12c.1ab.we.gz.mz.4y.sf.11s.e0.1l7.ew.h6.jz.l0.e8.1cx.p6.17u.bw.1ah.10r.10e.o9.1bc.uv.lq.tl.zb.100.jy.b8.bj.336.10n.na.sq.14r.yr.nm.123.tf.l1.zp.1xc.1vk.31l.zl.2bj.2b9.2fv.17p.y0.so.1ln.29c.1eh.nh.xn.131.qc.186.ff.fc.xq.1bm.la.l8.14f.243.111.xi.qw.1qn.11v.1ur.1jx.1ks.s9.nz.269.1zj.2zd.1pv.18n.2vk.p3.1fh.13v.1lf.1lu.2db.1sr.1k3.26o.1dl.1f3.187.2lh.166.v9.xh.1e3.119.s2.mt.1iu.1k6.1o2.12s.u4.2br.1q3.qv.1e4.1zu.1v4.1vk.1t3.3p7.1ob.14d.1ns.1ef.1e4.12w.2kk.1ba.2jx.1e0.1s5.12w.17r.14s.wz.1qp.183.3fb.188.1gr.2ot.168.1u7.w8.28o.1zd.32z.230.w7.vq.x8.1qh.19f.14o.2r9.qg.1ey.1qr.1p6.3a3.1ov.13d.tz.wk.22v.1qa.2l9.yw.yf.nw.p6.1ly.1jk.1nh.x9.q0.17r.17h.ux.uw.12y.p7.g7.kt.14c.ze.1kh.1eo.18a.1d8.26j.15k.19f.1ym.1j5.1c6.11k.1sd.1jp.1ws.13s.1o5.214.sx.px.20x.14h.1ja.s6.1q8.w8.1ks.so.ub.121.202.1ej.1g1.1s8.2bc.4t1.bih.3uw.3pb.avp.6c7.bko.5eg.79c.6wh.3wd.4pn.55j.4a5.3gg.bko.5ei.52p.578.bcv.6gr.2bc.4j9.5y7.9d2.2bb.2bc.668.73z.5pg.50f.5m7.788.267.642.8h2.8h2.49s.64g.5e8.5e8.2bb.3ih.5ur.6bk.578.4ck.3sg.5fe.23i.e9w.2b8.5oj.6bw.2al.2rk.2rk.5pj.n6e.350.6v9.70t.639.3uw.3uw.2bg.639.2bb.2bd.6gj.2bh.660.578.3bk.65e.359.3o0.44i.4tn.1zq.5ee.4a5.3zu.rs.639.33q.5eg.1k1.15o.dw.3uw.b7p.7qd.898.4l4.5uu.5uu.b4g.2yh.2yh.3uw.51a.51a.5kk.66f.iq9.3n7.4nb.46a.1wb.20p.bih.8xa.7ps.70t.70t.4rv.5p1.6aq.ts.63z.668.5v2.5nu.563.55s.55s.5p3.2ga.32x.42x.5cr.4c2.71b.5zp.5c2.66t.4c8.2bc.2bc.2gn.3ea.2kp.fz6.8hz.3e8.4an.bko.j7e.jag.7sr.2bc.3zx.7qd.5ut.5jp.2wk.5q7.3uw.334.4i3.3uw.4bd.5eu.46h.4i2.6t4.446.5s7.5cg.4bk.5nd.7bf.4rt.23b.2bc.2bc.2bc.2bc.2ba.4mo.4dv.3wn.2bc.1we.4he.2bc.4gz.3wn.3km.4xy.4hi.4mr.2bc.247.3yj.2c6.2bc.3aj.446.4ub.3uw.51.e0.86.is.i1.hg.mn.m4.2c.7h.sg.e3.jb.7r.eq.nf.u0.60.4o.ke.47.47.47.47.b8.4x.dr.dy.rw.rw.59.8j.5z.a5.l3.c0.ik.f7.li.lr.7x.dv.du.dd.5e.91.1b.ce.cc.59.bh.e6.8m.9n.cl.lt.7ip.4mr.4si.4kf.vo.we.13e.17n.1iw.2pi.lp.r6.gw.7x.xz.qt.bq.ls.q1.eh.bx.cr.3c.j7.b8.fz.4k.8p.bg.5w.iy.j3.12o.rs.cz.dp.yz.jk.63.63.7ps.7ps.7ps.40g.3jp.4tw.89k.88a.7s0.83d.668.7ps.2fw.2ev.2fp.7ps.2jb.2dh.2ud.25i.24c.2bt.1pa.17r.1a7.7ps.7pt.5rg.4nl.3vv.7qo.31a.2p0.2k0.49a.3v4.3nl.1ug.1ug.1l6.7s1.7ps.2cp.2f8.2i7.7ps.28q.2be.275.1ma.1oz.1q7.16s.1iq.1e0.78m.7ps.2bc.2bc.2bc.bko.2wu.2wu.2wu.3b4.38f.3uw.3uw.3uw.3uw.7ps.7qa.32n.2gg.2wk.7rv.1v3.1qq.1rb.1zk.1my.1zp.1yn.1oh.1uh.7st.9q.9q.9q.9q.9q.kk.kk.kk.kk.kk.dw.dp.dw.rs.rs.rs.rs.s4.sd.54j.5n8.2n6.21r.1nu.1o5.14u.t6.3f7.2j0.32c.304.189.1gf.18w.18j.1st.1vq.116.kw.3uw.3uw.vr.zx.xc.tc.7d.7r.9d.9w.8s.9p.3b.3b"]].map(([e,t])=>[e,t.split(".").map(i=>parseInt(i,36)/1e3)]);function Ir(e){if(!Number.isSafeInteger(e))return null;for(let[t,i]of vf)if(e>=t&&e<t+i.length)return i[e-t];return null}var Cr=e=>Number.isFinite(Number(e))?Math.max(0,Number(e)):0;function kr(e,t){if(!e||e.kind!=="image"||e.enableMask!==!0||!t)return null;let i=Cr(e.sourceWidth??e.width),r=Cr(e.sourceHeight??e.height),n=e.enableSoftEdge===!0,o=e.softEdgeMode!=="Pixel",a=n?Cr(e.softEdgeWidthX):0,s=n?Cr(e.softEdgeWidthY):0;return{id:e.id,matrix:t,width:i,height:r,featherX:o?i*a/100:a,featherY:o?r*s/100:s}}function Ms(e,t,i){let r=Ie(e,t,i);return{a:e.a,b:e.b,c:e.c,d:e.d,tx:r.x,ty:r.y}}function Ns(e,t,i){let r=(n,o)=>n<=0?0:!(o>0)||n>=o?1:n/o;return Math.min(r(e+i.width/2,i.featherX),r(i.width/2-e,i.featherX),r(t+i.height/2,i.featherY),r(i.height/2-t,i.featherY))}function Fs(e){let t={children:[]},i=[t],r=[];for(let n of e||[]){if(!n||n.id==null)continue;let o=n.masks||[],a=o.map(c=>JSON.stringify([c.id,c.matrix,c.width,c.height,c.featherX,c.featherY])),s=0;for(;s<r.length&&s<a.length&&r[s]===a[s];)s++;i.length=s+1;for(let c=s;c<o.length;c++){let l={mask:o[c],children:[]};i.at(-1).children.push(l),i.push(l)}i.at(-1).children.push({item:n}),r=a}return t.children}import{randomUUID as $s}from"node:crypto";function _r(e){for(let t of e.runtime.scrollControls||[]){let[i,r]=xi(t),n=t.kind==="grid"?Ht(t):Ts(t,i,r),o={offset:n.offset,max:n.max,horizontal:n.horizontal,showBar:t.showScrollBar!==!1,textWidth:n.textWidth??0,lines:n.lines||[],lineHeight:n.lineHeight||0,contentLength:n.length,...t.kind==="textwindow"?{fontSize:n.fontSize}:{}},a=JSON.stringify(o);t._scrollKey!==a&&(t._scrollKey=a,t._scroll=o,t.markPlayDirty())}}function Gs(e){return{...e._scroll?{scroll:e._scroll}:{},...e.parent?._gridItems?.includes(e)?{clipToParent:!0}:{}}}function qn(e,t){let i=e._scroll?.max||0;e.kind==="grid"?e.scrollProgress=i?Sr(t,i)/i:0:e._scrollOffset=Sr(t,i),e.markPlayDirty()}var wf=Object.freeze(Object.values(K).map(e=>Object.freeze({id:e.id,label:e.label,platform:e.platform,width:e.width,height:e.height})));function Pr(e){_r(e);let t=we({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),i=new Map;function r(n,o,a){let s=Ue(o,n);s.activeInHierarchy=a&&n.active!==!1,i.set(n.Id,s);let c=s.activeInHierarchy;for(let l of n.children)r(l,s,c)}for(let n of e.runtime.roots)r(n,t,!0);return i}function Vs(e,t=Pr(e)){let i=new Map;function r(n,o){let a=t.get(n.Id);if(!a)return;let s=mi(o,a,n);i.set(n.Id,s);for(let c of n.children)r(c,s)}for(let n of e.runtime.roots)r(n,$t());return i}function Bs(e,t){let i=t.get(e.Id);return{id:e.Id,prefabId:e.prefabIndex,authoringId:e.authoringId,name:e.name,kind:e.kind,typeofName:e.typeofName,instantiated:!e.authoringId,active:!!e.active,visible:!!e.visible,activeInHierarchy:!!i?.activeInHierarchy,raycastTarget:e.raycastTarget!==!1,interactable:e.interactable!==!1,pressed:e.pressed===!0,...e._scroll?{scrollOffset:e._scroll.offset,scrollMax:e._scroll.max}:{},...e.kind==="grid"?{itemCount:e.itemCount,scrollProgress:e.scrollProgress}:{},anchoredPositionX:e.anchoredPositionX,anchoredPositionY:e.anchoredPositionY,sizeDeltaX:e.sizeDeltaX,sizeDeltaY:e.sizeDeltaY,localScaleX:e.localScaleX,localScaleY:e.localScaleY,localScaleZ:e.localScaleZ,localRotationZ:e.localRotationZ,text:e.kind==="textbox"||e.kind==="textwindow"?e.text??"":null,fontSize:e.kind==="textbox"||e.kind==="textwindow"?e.fontSize:null,adaptiveFontSize:e.kind==="textbox"||e.kind==="textwindow"?e.adaptiveFontSize===!0:null,minimumFontSize:e.kind==="textbox"||e.kind==="textwindow"?e.minimumFontSize:null,fontColor:e.kind==="textbox"||e.kind==="textwindow"?e.fontColor:null,bgColor:e.kind==="textbox"||e.kind==="textwindow"?e.bgColor:null,enableOutline:e.kind==="textbox"||e.kind==="textwindow"?e.enableOutline===!0:null,outlineColor:e.kind==="textbox"||e.kind==="textwindow"?e.outlineColor:null,imageId:e.kind==="image"?e.imageId??0:null,imageSource:e.kind==="image"?ke(e.imageSource):null,imageType:e.kind==="image"?e.imageType==null?null:ze(e.imageType):null,primitive:e.kind==="image"?zt(e.imageId,e.imageSource):null,imageColor:e.kind==="image"?e.imageColor:null,enableMask:e.kind==="image"?e.enableMask===!0:null,enableSoftEdge:e.kind==="image"?e.enableSoftEdge===!0:null,softEdgeMode:e.kind==="image"?e.softEdgeMode:null,softEdgeWidthX:e.kind==="image"?e.softEdgeWidthX:null,softEdgeWidthY:e.kind==="image"?e.softEdgeWidthY:null,horizontalSoftRange:e.kind==="image"?e.horizontalSoftRange:null,verticalSoftRange:e.kind==="image"?e.verticalSoftRange:null,enableFill:e.kind==="image"?e.enableFill===!0:null,fillType:e.kind==="image"?e.fillType:null,fillHorizontalType:e.kind==="image"?e.fillHorizontalType:null,fillVerticalType:e.kind==="image"?e.fillVerticalType:null,fillRadial90Type:e.kind==="image"?e.fillRadial90Type:null,fillRadialType:e.kind==="image"?e.fillRadialType:null,reverseMaskArea:e.kind==="image"?e.reverseMaskArea===!0:null,fillAmount:e.kind==="image"?e.fillAmount:null,box:i?{left:i.left,bottom:i.bottom,width:i.width,height:i.height}:null,children:e.children.map(r=>Bs(r,t))}}function Sf(){return{pointerDownControl:null,pointerDownPosition:null,pointerLastPosition:null,pointerDragging:!1,pointerHoverControl:null,pointerScroll:null,hoveredControl:null,selectedControl:null,stateRestores:new Map,viewCache:null}}function xf(e,t,i,r){let n=Ei({canvasWidth:e.canvasWidth,canvasHeight:e.canvasHeight,device:e.device,audioDuration:Ir,canSelectImageType:Go,...r?{language:r}:{}});for(let o of[...e.templates||[],...t?.templates||[]])Number.isSafeInteger(o.prefabIndex)&&o.prefabIndex>0&&n.registerTemplate(o.prefabIndex,o);for(let o of i){let a=o.path||o.id,s=o.source||"";a&&s&&n.registerScriptFile(a,s)}return n}var If=["pointerDownControl","pointerDownPosition","pointerLastPosition","pointerDragging","pointerHoverControl","pointerScroll","hoveredControl","selectedControl","stateRestores","viewCache"];function Cf(e){Object.defineProperty(e,"runtime",{configurable:!0,enumerable:!0,get(){return e.runtimes[e.viewPlayerIndex-1]}});for(let t of If)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){return e.views[e.viewPlayerIndex-1][t]},set(i){e.views[e.viewPlayerIndex-1][t]=i}})}function Ys(e,{templatesProject:t=null,scripts:i=[],sceneScripts:r=null,templateScripts:n=null,serverConfig:o=null,canvasId:a="",playerCount:s=1,viewPlayerIndex:c=1,language:l=""}={}){let u=r||i,f=n||i,h=Un(e,u,a),p=t?Un(t,f,a):null,m=kt(s),y=Ze(c,m),I=Es({playerCount:m,viewPlayerIndex:y});o&&I.loadConfig({...o,playerCount:m,viewPlayerIndex:y});let b=[];for(let R=0;R<m;R+=1)b.push(xf(h,p,i,l));I.attachRuntimes(b);for(let R of b)R.addRoot(h.root);let v={audioSessionId:$s(),runtimes:b,views:b.map(()=>Sf()),playerCount:m,viewPlayerIndex:y,server:I,compiled:h,mountError:b.find(R=>R.mountErrors[0])?.mountErrors[0]||null,debugPaused:!1,history:{events:[]},recording:!0};Cf(v);let P=v.viewPlayerIndex;for(let R=1;R<=m;R+=1)v.viewPlayerIndex=R,Of(v);return v.viewPlayerIndex=P,v}function eo(e,t){if(!e)throw new Error("play session has not started");let i=Ze(t,e.playerCount);return i===e.viewPlayerIndex||(ft(e,{kind:"view",payload:{playerIndex:i}}),e.viewPlayerIndex=i,e.viewCache=null,e.server&&e.server.setViewPlayerIndex(i)),i}function ft(e,t){!e?.recording||!e.history||Ps(e.history,{...t,source:t.source||"user"},e.runtime.clock.time)}function kf(e){return e?.history?.events||[]}var to=new Set(["image","textbox","textwindow","button","grid"]);function Ef(e,t){let i=Ie(t,e.centerX,e.centerY);return{centerX:i.x,centerY:i.y,scaleX:Math.hypot(t.a,t.b),scaleY:Math.hypot(t.c,t.d),rotationZ:Math.atan2(t.b,t.a)*180/Math.PI,matrix:{a:t.a,b:t.b,c:t.c,d:t.d,tx:i.x,ty:i.y}}}function ze(e){return typeof e=="string"?e:e?.Name}function Ls(e){return{fillType:ze(e.fillType),fillHorizontalType:ze(e.fillHorizontalType),fillVerticalType:ze(e.fillVerticalType),fillAmount:e.fillAmount}}function Af(e,t,i){let r=Math.abs(t.width*i.scaleX),n=Math.abs(t.height*i.scaleY),o={id:e.Id,kind:e.kind,name:e.name,left:i.centerX-r/2,bottom:i.centerY-n/2,width:r,height:n,sourceWidth:t.width,sourceHeight:t.height,rotationZ:i.rotationZ,matrix:i.matrix,pressed:e.pressed===!0,...Gs(e)};return e.kind==="image"&&(o.imageSource=ke(e.imageSource),o.imageType=e.imageType==null?null:ze(e.imageType),o.primitive=zt(e.imageId,o.imageSource),o.imageColor=e.imageColor,o.imageId=e.imageId,Object.assign(o,Ls(e))),(e.kind==="textbox"||e.kind==="textwindow")&&(o.text=e.text??"",o.fontSize=e.fontSize,o.adaptiveFontSize=e.adaptiveFontSize===!0,o.minimumFontSize=e.minimumFontSize,o.textLayout=qe(e,t.width,t.height),o.fontColor=e.fontColor,o.bgColor=e.bgColor,o.enableOutline=e.enableOutline===!0,o.outlineColor=e.outlineColor,o.horizontalAlignment=ze(e.horizontalAlignment),o.verticalAlignment=ze(e.verticalAlignment)),o}function _f(e,t=Pr(e)){let i=[],r=Vs(e,t);function n(o,a=[],s=[]){let c=t.get(o.Id);if(!c||o.visible===!1||!c.activeInHierarchy)return;let l=r.get(o.Id);if(!l)return;let u=Ef(c,l),f=o.kind==="image"&&o.enableMask===!0?kr({...js(o,c),id:o.Id},Ms(l,c.centerX,c.centerY)):null,h=f?[...s,f]:s,p=()=>i.push({...Af(o,c,u),...a.length?{clipPolygons:a}:{},...h.length?{masks:h}:{}});to.has(o.kind)&&o.kind!=="grid"&&p();let m=o.children||[];for(let y=m.length-1;y>=0;y-=1){let I=o._gridItems?.includes(m[y])?[...a,[[c.left,c.bottom],[c.right,c.bottom],[c.right,c.top],[c.left,c.top]].map(([b,v])=>Ie(l,b,v))]:a;n(m[y],I,h)}o.kind==="grid"&&p()}for(let o of e.runtime.roots)n(o);return i}function js(e,t){let i={kind:e.kind,name:e.name,sourceWidth:t.width,sourceHeight:t.height,pressed:e.pressed===!0,...Gs(e)};return e.kind==="image"&&(i.imageSource=ke(e.imageSource),i.imageType=e.imageType==null?null:ze(e.imageType),i.primitive=zt(e.imageId,i.imageSource),i.imageColor=e.imageColor,i.imageId=e.imageId,Object.assign(i,Ls(e),{enableMask:e.enableMask===!0,enableSoftEdge:e.enableSoftEdge===!0,softEdgeMode:ze(e.softEdgeMode)||"Percentage",softEdgeWidthX:e.softEdgeWidthX,softEdgeWidthY:e.softEdgeWidthY})),(e.kind==="textbox"||e.kind==="textwindow")&&(i.text=e.text??"",i.fontSize=e.fontSize,i.adaptiveFontSize=e.adaptiveFontSize===!0,i.minimumFontSize=e.minimumFontSize,i.textLayout=qe(e,t.width,t.height),i.fontColor=e.fontColor,i.bgColor=e.bgColor,i.enableOutline=e.enableOutline===!0,i.outlineColor=e.outlineColor,i.horizontalAlignment=ze(e.horizontalAlignment),i.verticalAlignment=ze(e.verticalAlignment)),i}function Pf(e,t,i){let r=Qr(e,t),n=Ie(r,e.centerX,e.centerY);return{a:r.a,b:r.b,c:r.c,d:r.d,tx:n.x-(i?i.centerX:0),ty:n.y-(i?i.centerY:0)}}function Hs(e){let t=e.matrix;return[e.parent,e.z,e.group?1:0,t.a,t.b,t.c,t.d,t.tx,t.ty,e.kind,e.name,e.sourceWidth,e.sourceHeight,e.pressed,e.primitive,e.imageColor,e.imageId,e.imageSource,e.imageType,e.fillType,e.fillHorizontalType,e.fillVerticalType,e.fillAmount,e.enableMask,e.enableSoftEdge,e.softEdgeMode,e.softEdgeWidthX,e.softEdgeWidthY,e.text,e.fontSize,e.fontColor,e.bgColor,e.adaptiveFontSize,e.minimumFontSize,JSON.stringify(e.textLayout),e.enableOutline,e.outlineColor,e.horizontalAlignment,e.verticalAlignment,JSON.stringify(e.scroll),e.clipToParent].join(" ")}function Us(e,t,i,r,n,o){return{id:e.Id,parent:t,z:n,group:o>=16,matrix:Pf(r,e,i),...js(e,r)}}function Tf(e){let t=we({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),i=new Set,r=new Map,n=new Map;function o(c,l,u){let f=Ue(l,c);if(f.activeInHierarchy=u&&c.active!==!1,n.set(c.Id,f),c.visible===!1||!f.activeInHierarchy)return!1;let h=c.children||[],p=to.has(c.kind),m=0;for(let y=0;y<h.length;y+=1)o(h[y],f,f.activeInHierarchy)&&(p=!0,m+=1);return p?(i.add(c.Id),r.set(c.Id,m),!0):!1}function a(c,l,u,f){if(!i.has(c.Id))return;let h=n.get(c.Id);s.push(Us(c,l,u,h,f,r.get(c.Id)||0));let p=c.children||[];for(let m=0;m<p.length;m+=1)a(p[m],c.Id,h,m)}let s=[];for(let c=0;c<e.runtime.roots.length;c+=1)o(e.runtime.roots[c],t,!0),a(e.runtime.roots[c],null,null,c);return{nodes:s,childCounts:r}}function Qn(e){let t=e._playChildDirty===!0||e._playDeepDirty===!0;if(e._playDirty=!1,e._playChildDirty=!1,e._playDeepDirty=!1,!t)return;let i=e.children;for(let r=0;r<i.length;r+=1)Qn(i[r])}function Rf(e,t){let i=we({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),r=[],n=[],o=t.count,a=e.runtime._playRemoved||[];for(let l=0;l<a.length;l+=1){let u=a[l];t.fingerprints.has(u)&&(n.push(u),t.fingerprints.delete(u),t.childCounts.delete(u),o-=1)}e.runtime._playRemoved=[];function s(l){t.fingerprints.has(l.Id)&&(n.push(l.Id),t.fingerprints.delete(l.Id),t.childCounts.delete(l.Id),o-=1);let u=l.children;for(let f=0;f<u.length;f+=1)s(u[f])}function c(l,u,f,h,p,m){let y=m||l._playDeepDirty===!0,I=y||l._playDirty===!0,b=y||l._playChildDirty===!0;if(!I&&!b)return;if(!(p&&l.active!==!1)||l.visible===!1){s(l);return}let P=Ue(u,l),R=t.childCounts.get(l.Id)||0;if(b){R=0;let A=l.children;for(let x=0;x<A.length;x+=1)c(A[x],P,l.Id,x,!0,y),t.fingerprints.has(A[x].Id)&&(R+=1)}if(!(to.has(l.kind)||R>0)){t.fingerprints.has(l.Id)&&(n.push(l.Id),t.fingerprints.delete(l.Id),t.childCounts.delete(l.Id),o-=1);return}let $=t.childCounts.get(l.Id);t.childCounts.set(l.Id,R);let Y=R>=16!=($||0)>=16;if(!I&&!Y&&t.fingerprints.has(l.Id))return;let G=Us(l,f,u===i?null:u,P,h,R),w=Hs(G);t.fingerprints.get(G.id)!==w&&(t.fingerprints.has(G.id)||(o+=1),t.fingerprints.set(G.id,w),r.push(G))}for(let l=0;l<e.runtime.roots.length;l+=1)c(e.runtime.roots[l],i,null,l,!0,!1);return t.count=o,{changed:r,removed:n,count:o}}function Mf(e,t){let i=e.viewCache||(e.viewCache={rev:0,fingerprints:new Map,childCounts:new Map,count:0}),r=Number(t);if(!(Number.isFinite(r)&&r===i.rev&&i.fingerprints.size>0)){let{nodes:c,childCounts:l}=Tf(e);i.rev+=1,i.fingerprints=new Map(c.map(u=>[u.id,Hs(u)])),i.childCounts=l,i.count=c.length;for(let u of e.runtime.roots)Qn(u);return{format:"tree-v1",revision:i.rev,reset:!0,count:c.length,nodes:c}}let{changed:o,removed:a,count:s}=Rf(e,i);i.rev+=1;for(let c of e.runtime.roots)Qn(c);return{format:"tree-v1",revision:i.rev,reset:!1,count:s,changed:o,removed:a}}function io(e,{inspect:t=!1,view:i=!1,paint:r=!1,sceneRev:n,compact:o=!1}={}){_r(e),e.audioSessionId||=$s();let a=e.runtime,s=e.compiled,[c,l]=[a.canvasWidth,a.canvasHeight];e.server&&e.server.setClock(a.clock.time);let u=o?a.logs.slice(-100):a.logs,f=kf(e),h=e.server?e.server.snapshot():{vars:{},inbound:[],outbound:[],logs:[]};o&&(h.inbound=h.inbound.slice(-100),h.outbound=h.outbound.slice(-100),h.logs=h.logs.slice(-100));let p={canvasId:s.canvasId,platform:s.platform,device:a.device,canvasWidth:c,canvasHeight:l,canvasPresets:wf,playerCount:e.playerCount||1,viewPlayerIndex:e.viewPlayerIndex||1,players:Array.from({length:e.playerCount||1},(m,y)=>({index:y+1,label:`\u73A9\u5BB6${y+1}`,entityType:`Player${y+1}`})),time:a.clock.time,frame:a.clock.frame,paused:!!e.debugPaused,levelTimePaused:!!a.clock.paused,audio:{sessionId:e.audioSessionId,playerIndex:e.viewPlayerIndex||1,...a.audioSnapshot()},mountError:e.mountError||a.mountErrors[0]||null,logs:u.map(m=>({source:"client",level:m.level,text:m.text,time:m.time})),tree:[],paint:[],scene:null,server:h,history:(o?f.slice(-100):f).map(m=>({t:m.t,source:m.source||"user",kind:m.kind,payload:m.payload||{}}))};if(t||r){let m=Pr(e);t&&(p.tree=a.roots.map(y=>Bs(y,m))),r&&(p.paint=_f(e,m))}return i&&(p.scene=Mf(e,n)),Dt(p),p}function Tr(e,t=1/30){let i=e.runtimes||(e.runtime?[e.runtime]:[]);for(let r of i)r.step(t);e.server&&(e.server.setClock(e.runtime.clock.time),e.server.flush())}function ro(e,t){ft(e,{kind:"key",payload:{typeName:String(t)}}),e.runtime.injectKey(t)}function Nf(e,t){let i=null;for(let r of e.runtime.roots)Ye(r,n=>{!i&&n.name===t&&(i=n)});return i}function no(e,t){ft(e,{kind:"click",payload:{name:String(t)}});let i=Nf(e,t);i&&oo(i)&&(i.kind==="button"||i.kind==="cursor")&&i.SimulateCursorClick()}function Ff(e,t){return!e||!t?null:e.children.find(i=>i.authoringId===t||i.Id===t)||null}var Xs={unavailable:"unavailableChildId",hover:"hoverChildId",pressed:"pressedChildId",selected:"selectedChildId"};function Ws(e,t){let i=[];for(let[r,n]of Object.entries(Xs)){let o=t[n]?Ff(t,t[n]):null;o&&i.push({state:r,child:o})}return i}function Of(e){for(let t of e.runtime.roots)Ye(t,i=>{if(i.kind==="button"){for(let{child:r}of Ws(e,i))e.stateRestores.has(r.Id)||e.stateRestores.set(r.Id,{child:r,active:r.active,visible:r.visible}),r.active=!0,r.visible=!1,typeof r.markPlayDirty=="function"&&r.markPlayDirty(!0);Mi(e,i)}})}function Mi(e,t){if(!t||t.kind!=="button")return;let i=null;t.interactable===!1?i="unavailable":t.pressed===!0?i="pressed":e.hoveredControl===t?i="hover":e.selectedControl===t&&(i="selected");for(let r of Ws(e,t))r.child.active=!0,r.child.visible=r.state===i,typeof r.child.markPlayDirty=="function"&&r.child.markPlayDirty(!0)}function Jn(e){if(!e)return null;let t=e.parent;return t?.kind==="button"&&Object.values(Xs).map(r=>t[r]).filter(Boolean).includes(e.authoringId)?t:e}function oo(e){return e.kind==="button"?e.raycastTarget!==!1&&e.interactable!==!1:e.kind==="cursor"||e.kind==="grid"?e.raycastTarget!==!1:e.kind==="textwindow"?e.interactable!==!1:e.raycastTarget===!0}function Ks(e){return e.kind==="container"||e.kind==="grid"||e.kind==="textwindow"||e.kind==="reference"||e.kind==="button"}function qs(e,t){let i=e.Id,r=t.get(i);if(r!==void 0)return r;let n=oo(e);if(!n&&Ks(e)){let o=e.children;for(let a=0;a<o.length;a+=1)if(qs(o[a],t)){n=!0;break}}return t.set(i,n),n}function Er(e,t,i){_r(e);let r=we({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),n=new Map;function o(s,c,l,u){if(!u||s.active===!1||s.visible===!1||!qs(s,n))return null;let f=Ue(c,s),h=mi(l,f,s),p=Xe(h);if(!p)return null;let m=Ie(p,t,i);if(m.x<f.left||m.x>f.right||m.y<f.bottom||m.y>f.top)return null;if(Ar(s)){let y=Kt(s._scroll,f.width,f.height)?.track,I=m.x-f.centerX,b=f.centerY-m.y;if(y&&I>=y.x&&I<=y.x+y.width&&b>=y.y&&b<=y.y+y.height)return s}if(Ks(s))for(let y=0;y<s.children.length;y+=1){let I=o(s.children[y],f,h,!0);if(I)return I}return oo(s)?s:null}let a=$t();for(let s=e.runtime.roots.length-1;s>=0;s-=1){let c=o(e.runtime.roots[s],r,a,!0);if(c)return c}return null}function qt(e,t,i,{dragging:r=!1,press:n=null,previous:o=null}={}){let a=n||{x:t,y:i},s=o||{x:t,y:i};return e.runtime.makeCursorEventData({x:t,y:i,pressX:a.x,pressY:a.y,deltaX:t-s.x,deltaY:i-s.y,dragging:r})}function Zn(e,t,i){t.kind==="grid"||t.kind==="textwindow"||(t.pressed=i,typeof t.markPlayDirty=="function"&&t.markPlayDirty(),Mi(e,t))}function Ar(e){if(!e?.alive||!e.activeInHierarchy||e.interactable===!1||e.raycastTarget===!1)return!1;for(let t=e;t;t=t.parent)if(t.visible===!1)return!1;return e._scroll?.max>0}function Os(e){for(let t=e;t;t=t.parent)if(Ar(t))return t;return null}function zs(e,t,i,r){let n=Pr(e),o=n.get(t.Id),a=Vs(e,n).get(t.Id),s=a&&Xe(a);if(!o||!s)return null;let c=Ie(s,i,r);return{x:c.x-o.centerX,y:o.centerY-c.y,width:o.width,height:o.height}}function Ds(e,t,i){let r=e.pointerDownControl;if(r?.alive){let n=qt(e,t,i,{dragging:e.pointerDragging,press:e.pointerDownPosition,previous:e.pointerLastPosition});e.runtime.injectCursor(r,"CursorUp",n),e.pointerDragging&&!e.pointerScroll&&e.runtime.injectCursor(r,"CursorEndDrag",n),Zn(e,r,!1)}e.pointerDownControl=null,e.pointerScroll=null,e.pointerDownPosition=null,e.pointerDragging=!1,e.pointerLastPosition={x:t,y:i}}function Ni(e,t,i,r,n={}){let o=Number(i),a=Number(r);if(!Number.isFinite(o)||!Number.isFinite(a))throw new Error("pointer coordinates must be finite");e.runtime.cursor.x=o,e.runtime.cursor.y=a;let s=Number(n.deltaX??0),c=Number(n.deltaY??0);if(t==="wheel"&&(!Number.isFinite(s)||!Number.isFinite(c)))throw new Error("wheel deltas must be finite");if(n.silent||ft(e,{kind:"pointer",payload:{type:t,x:o,y:a,...t==="wheel"?{deltaX:s,deltaY:c}:{}}}),t==="wheel"){let l=Er(e,o,a),u=Os(l);if(u){let f=u._scroll.horizontal&&s||c;qn(u,u._scroll.offset+f)}return l}if(t==="cancel")return Ds(e,o,a),null;if((t==="move"||t==="up")&&e.pointerScroll&&!Ar(e.pointerScroll.control)&&Ds(e,o,a),t==="move"){let l=e.pointerLastPosition||{x:o,y:a},u=e.pointerHoverControl,f=Jn(Er(e,o,a)),h=qt(e,o,a,{previous:l});u&&u!==f&&e.runtime.injectCursor(u,"CursorExit",h),f&&u!==f&&e.runtime.injectCursor(f,"CursorEnter",h),e.pointerHoverControl=f;let p=e.hoveredControl;e.hoveredControl=f?.kind==="button"?f:null,p&&p!==e.hoveredControl&&Mi(e,p),e.hoveredControl&&Mi(e,e.hoveredControl);let m=e.pointerDownControl,y=e.pointerScroll;if(y)if(!Ar(y.control))e.pointerScroll=null;else{let I=zs(e,y.control,o,a);if(I){let b=y.control._scroll,v=b.horizontal?I.x-y.start.x:I.y-y.start.y,P=Kt(b,I.width,I.height)?.travel||0,R=y.bar?P?v*b.max/P:0:-v;qn(y.control,y.offset+R)}}if(m?.alive){let I=e.pointerDownPosition||l,b=Math.hypot(o-I.x,a-I.y)>5;!e.pointerDragging&&b&&(y||e.runtime.injectCursor(m,"CursorBeginDrag",qt(e,o,a,{press:I,previous:l,dragging:!1})),e.pointerDragging=!0),e.pointerDragging&&!y&&e.runtime.injectCursor(m,"CursorDrag",qt(e,o,a,{press:I,previous:l,dragging:!0}))}return e.pointerLastPosition={x:o,y:a},f}if(t==="down"){let l=Jn(Er(e,o,a));e.pointerDownControl=l,e.pointerDownPosition={x:o,y:a},e.pointerLastPosition={x:o,y:a},e.pointerDragging=!1,e.pointerScroll=null;let u=Os(l);if(u){let f=zs(e,u,o,a),h=f&&Kt(u._scroll,f.width,f.height),p=y=>f.x>=y.x&&f.x<=y.x+y.width&&f.y>=y.y&&f.y<=y.y+y.height,m=h&&p(h.track);if(m&&!p(h.thumb)){let y=u._scroll.horizontal?f.x-h.track.x-h.thumb.width/2:f.y-h.track.y-h.thumb.height/2;qn(u,h.travel?y/h.travel*u._scroll.max:0),_r(e)}f&&(e.pointerScroll={control:u,start:f,offset:u._scroll.offset,bar:!!m})}return l&&(Zn(e,l,!0),e.runtime.injectCursor(l,"CursorDown",qt(e,o,a))),l}if(t==="up"){let l=e.pointerDownControl,u=Jn(Er(e,o,a));if(l?.alive){let f=qt(e,o,a,{press:e.pointerDownPosition,previous:e.pointerLastPosition,dragging:e.pointerDragging});if(e.runtime.injectCursor(l,"CursorUp",f),e.pointerDragging)e.pointerScroll||e.runtime.injectCursor(l,"CursorEndDrag",f);else if(u===l&&!e.pointerScroll?.bar){e.runtime.injectCursor(l,"CursorClick",f);let h=e.selectedControl;e.selectedControl=l.kind==="button"?l:null,h&&h!==e.selectedControl&&Mi(e,h)}Zn(e,l,!1)}return e.pointerDownControl=null,e.pointerDownPosition=null,e.pointerLastPosition={x:o,y:a},e.pointerDragging=!1,e.pointerScroll=null,u}if(t==="click")return Ni(e,"down",o,a,{silent:!0}),Ni(e,"up",o,a,{silent:!0});throw new Error(`unknown pointer type ${t}`)}function ao(e,t,i,r){if(!e?.server)throw new Error("play session has no server");return ft(e,{kind:"serverSet",payload:{entityType:t,name:i,value:r,playerIndex:e.viewPlayerIndex}}),e.server.setVar(t,i,r,{playerIndex:e.viewPlayerIndex})}function Js(e,t,i){if(!e?.server)throw new Error("play session has no server");let r=e.server.getVar(t,i,{playerIndex:e.viewPlayerIndex});return r===void 0?null:r}function so(e,t,i=[],r="PlayerSelf"){if(!e?.server)throw new Error("play session has no server");return ft(e,{kind:"serverSend",payload:{name:t,params:i,target:r,playerIndex:e.viewPlayerIndex}}),e.server.sendToClient(t,i,{target:r,playerIndex:e.viewPlayerIndex})}function Rr(e){return{snapshot:t=>io(e,t),step:t=>Tr(e,t),pointer:(t,i,r,n)=>Ni(e,t,i,r,n),key:t=>ro(e,t),click:t=>no(e,t),view:t=>eo(e,t),pause:()=>{ft(e,{kind:"pause",payload:{}}),e.debugPaused=!0},resume:()=>{ft(e,{kind:"resume",payload:{}}),e.debugPaused=!1},serverSet:(t,i,r)=>ao(e,t,i,r),serverSend:(t,i,r)=>so(e,t,i,r)}}function lo(e){e?.server&&e.server.destroy();let t=e?.runtimes||(e?.runtime?[e.runtime]:[]);for(let i of t)i.destroy()}function co(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Qs(e,t){for(let i of e||[])t(i),i.children?.length&&Qs(i.children,t)}function uo(e,{id:t,name:i}){let r=null;return Qs(e,n=>{r||(t&&String(n.id)===String(t)||!t&&i&&n.name===i)&&(r=n)}),r}function zf(e,t){if(e){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];if(e.box&&Object.prototype.hasOwnProperty.call(e.box,t))return e.box[t]}}function Df(e){return{var(t,i){return e.server?.vars?.[t]?.[i]?.value??null},logs(){return(e.logs||[]).map(t=>t.text)},logContains(t){return(e.logs||[]).some(i=>String(i.text||"").includes(String(t)))},serverLogs(){return(e.server?.logs||e.serverLogs||[]).map(t=>t.text)},serverLogContains(t){return(e.server?.logs||e.serverLogs||[]).some(i=>String(i.text||"").includes(String(t)))},control(t){let i=uo(e.tree,{name:String(t)});return i?{id:i.id,name:i.name,kind:i.kind,active:i.active,visible:i.visible,pressed:i.pressed,text:i.text,interactable:i.interactable}:null},signals(t){let i=t==="outbound"?"outbound":"inbound";return(e.server?.[i]||[]).map(r=>({name:r.name,values:r.values}))}}}function $f(e,t){if(e.kind==="log"){let i=e.source==="server"?t.server?.logs||t.serverLogs||[]:t.logs||[];return i.some(n=>e.level&&n.level!==e.level?!1:String(n.text||"").includes(e.contains))?{ok:!0,actual:e.contains}:{ok:!1,actual:i.map(n=>n.text).slice(-8),expected:e.contains}}if(e.kind==="control"){let i=uo(t.tree,e);if(!i)return{ok:!1,actual:null,expected:e.equals,message:`control not found: ${e.id||e.name}`};let r=zf(i,e.field);return co(r,e.equals)?{ok:!0,actual:r}:{ok:!1,actual:r,expected:e.equals}}if(e.kind==="var"){let i=t.server?.vars?.[e.entityType],n=!i||!Object.prototype.hasOwnProperty.call(i,e.name)?null:i[e.name].value;return co(n,e.equals)?{ok:!0,actual:n}:{ok:!1,actual:n,expected:e.equals}}if(e.kind==="signal"){let i=e.direction==="outbound"?t.server?.outbound||[]:t.server?.inbound||[],r=i.find(n=>n.name===e.name&&(e.values===void 0||co(n.values,e.values)));return r?{ok:!0,actual:r.values}:{ok:!1,actual:i.map(n=>({name:n.name,values:n.values})),expected:{name:e.name,values:e.values??null}}}if(e.kind==="tree"){let i=!!uo(t.tree,{name:e.name});return i===e.exists?{ok:!0,actual:i}:{ok:!1,actual:i,expected:e.exists}}return{ok:!1,message:`unsupported assert kind ${e.kind}`}}function Gf(e,t){let i=Ei();try{return i.evalQueryScript(e,Df(t)),{ok:!0,actual:!0}}catch(r){return{ok:!1,message:r?.message||String(r)}}finally{i.destroy()}}function Zs(e,t){return e.kind==="lua"?Gf(e.source,t):$f(e,t)}function Vf(e,t){let i=t>0?t:_t;return Math.round((e+i)*1e9)/1e9}function Bf(e,t){let i=t.payload||{};if(t.kind==="pointer")e.pointer(i.type,i.x,i.y,i);else if(t.kind==="key")e.key(i.typeName);else if(t.kind==="click")e.click(i.name);else if(t.kind==="pause")e.pause();else if(t.kind==="resume")e.resume();else if(t.kind==="serverSet")e.serverSet(i.entityType,i.name,i.value);else if(t.kind==="serverSend")e.serverSend(i.name,i.params,i.target);else if(t.kind==="view")e.view(i.playerIndex);else throw new Error(`unsupported event kind: ${t.kind}`)}function Yf(e,t){let i=Zs(e,t);return{kind:e.kind,at:Number(e.at||0),ok:!!i.ok,actual:i.actual??null,expected:i.expected??null,message:i.message||""}}function el(e,t){let i=Ri(t),r=i.events.slice().sort((b,v)=>b.t-v.t),n=i.asserts.slice(),o=i.dt||_t,a=r.reduce((b,v)=>Math.max(b,v.t),0),s=n.reduce((b,v)=>Math.max(b,Number(v.at||0)),0),c=Math.max(a,s),l=0,u=[],f=0,h=n.some(b=>b.kind==="control"||b.kind==="tree"||b.kind==="lua"),p=e.snapshot({inspect:h}),m=()=>{for(;l<r.length&&r[l].t<=f+1e-9;)Bf(e,r[l]),l+=1,p=e.snapshot({inspect:h})},y=()=>{for(let b of n)if(!b._done&&Number(b.at||0)<=f+1e-9){let v=Yf(b,p);if(u.push(v),b._done=!0,!v.ok)return{passed:!1,failedAt:f,frame:p.frame||0,results:u,snapshot:p}}return null};m();let I=y();if(I)return fo(i,I);for(;f+1e-9<c;){e.step(o),f=Vf(f,o),p=e.snapshot({inspect:h}),m();let b=y();if(b)return fo(i,b)}return fo(i,{passed:u.every(b=>b.ok),failedAt:null,frame:p.frame||0,results:u,snapshot:p})}function fo(e,t){return L({format:e.format,name:e.name,passed:t.passed,failedAt:t.failedAt,frame:t.frame,results:t.results,snapshot:{time:t.snapshot?.time??0,frame:t.snapshot?.frame??0,logs:t.snapshot?.logs||[],serverLogs:t.snapshot?.serverLogs||t.snapshot?.server?.logs||[],server:t.snapshot?.server||{vars:{},inbound:[],outbound:[],logs:[]}}})}function ho(e){return Array.isArray(e)?e.slice():[]}import{createHash as Lf}from"node:crypto";var tl=e=>Lf("sha256").update(JSON.stringify(e.map(({id:t,path:i,source:r})=>({id:t,path:i,source:r})))).digest("hex");function il(e){let t=new Map;for(let r of e){let n=`${r.controlAsset}:${r.controlId}`,o=t.get(n);if(o&&o.newGuid!==r.oldGuid)throw new Error("\u7D22\u5F15\u53D8\u66F4\u8BB0\u5F55\u4E0D\u8FDE\u7EED\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6838\u5BF9");t.set(n,{oldGuid:o?.oldGuid??r.oldGuid,newGuid:r.newGuid})}let i=new Map;for(let{oldGuid:r,newGuid:n}of t.values()){if(i.has(r))throw new Error("\u591A\u4E2A\u63A7\u4EF6\u5171\u7528\u65E7\u7D22\u5F15\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6309\u63A7\u4EF6\u8EAB\u4EFD\u6838\u5BF9");i.set(r,n)}return new Map([...i].filter(([r,n])=>r!==n))}function rl(e,t){let i=[],r=new Map([...t].map(([c,l])=>[String(c),l])),n=1,o=0,a=0;return{source:e.replace(/\d+/g,(c,l)=>{if(!r.has(c))return c;for(;o<l;o++)e[o]===`
|
|
113
|
-
`&&(n++,a=o+1);let u=r.get(c),f=l+c.length,h=e.indexOf(`
|
|
114
|
-
`,f);return i.push({start:l,end:f,oldGuid:Number(c),newGuid:u,line:n,before:e.slice(a,h<0?e.length:h).trim()}),String(u)}),edits:i,issues:[]}}var Wf={Level:"\u5173\u5361",PlayerSelf:"\u5F53\u524D\u73A9\u5BB6",AvatarSelf:"\u5F53\u524D\u89D2\u8272",...Object.fromEntries(Et.map((e,t)=>[e,`\u73A9\u5BB6${t+1}`])),...Object.fromEntries(Array.from({length:8},(e,t)=>[`Avatar${t+1}`,`\u89D2\u8272${t+1}`]))};function Kf(e,t=1){let i=e?.vars||{},r=[],n=Number(t)>0?Number(t):1,o=["Level","PlayerSelf","AvatarSelf"];if(n>1)for(let s=1;s<=n;s+=1)o.push(`Player${s}`,`Avatar${s}`);let a=new Set;for(let s of o){if(a.has(s)||!i[s])continue;a.add(s);let c=i[s]||{};for(let l of Object.keys(c))r.push(L({entityType:s,entityLabel:Wf[s]||s,name:l,type:c[l]?.type||"",value:c[l]?.value??null}))}return r}var Tt="qxqy-simulator-save",qf="qxqy-simulator-scripts",ce="server-control-template",H="client-control-template",po={[ce]:"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F",[H]:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"};function Pt(e){return e===H?"client":"server"}function Zt(e){if(!(typeof e=="number"||typeof e=="string"&&/^\d+$/.test(e.trim()))||!Ne(e))throw new Error("\u63A7\u4EF6\u7D22\u5F15\u5FC5\u987B\u662F 1\u20132147483647 \u8303\u56F4\u5185\u7684\u6574\u6570");return Number(e)}function mo(e=[]){if(!Array.isArray(e))throw new Error("controlGuidChanges \u5FC5\u987B\u662F\u6570\u7EC4");let t=new Set;return e.map(i=>{if(!i||typeof i.id!="string"||!i.id||t.has(i.id)||![ce,H].includes(i.controlAsset)||typeof i.controlId!="string"||!i.controlId||typeof i.controlName!="string")throw new Error("controlGuidChanges \u5305\u542B\u65E0\u6548\u6216\u91CD\u590D\u7684\u53D8\u66F4\u8BB0\u5F55");if(t.add(i.id),i.batchId!==void 0&&(typeof i.batchId!="string"||!i.batchId))throw new Error("controlGuidChanges \u5305\u542B\u65E0\u6548\u7684 batchId");if(i.scriptSignature!==void 0&&!/^[a-f0-9]{64}$/.test(i.scriptSignature))throw new Error("controlGuidChanges \u5305\u542B\u65E0\u6548\u7684 scriptSignature");return{id:i.id,controlAsset:i.controlAsset,controlId:i.controlId,controlName:i.controlName,oldGuid:Zt(i.oldGuid),newGuid:Zt(i.newGuid),...i.batchId?{batchId:i.batchId}:{},...i.scriptSignature?{scriptSignature:i.scriptSignature}:{}}})}function Jf(e){let t=[e?.guid,e?.id];for(let i of t){let r=Number(i);if(Number.isSafeInteger(r)&&r>0&&r<=2147483647)return r}return 0}function Mr(e){let t=String(e?.controlAsset||""),i=Jf(e);return{id:String(i||e?.id||""),guid:i,path:String(e?.path||""),source:String(e?.source||""),controlId:String(e?.controlId||""),controlAsset:t===H||t==="client"?H:t===ce||t==="server"?ce:""}}function Qf(e){let t=[],i=(r,n="")=>{if(r&&(r.path||r.source)){let o=Mr(r);t.push(n?{...o,controlAsset:n}:o)}};if(Array.isArray(e?.assets?.scripts)){for(let r of e.assets.scripts)r&&(r.path||r.source)&&t.push(Mr(r));return t}if(i(e?.assets?.server?.script,ce),i(e?.assets?.client?.script,H),e&&e.format!==Tt){i(e?.script);for(let r of e?.scripts||[])i(r)}return t}function go(e){return ct(e===H?Vt():vt())}var Zf="\u672A\u7ED1\u5B9A",Jt="\u672A\u547D\u540D\u5B58\u6863",ed="\u672A\u547D\u540D\u754C\u9762";function td(e){let t=e;for(let i=0;i<8;i++){if(Fi(ol(t,"simulator","studio"))&&Fi(ol(t,"lua")))return t;let r=Uf(t);if(r===t)break;t=r}return e}function id(e){return e?{name:Qt(e),path:e,bound:!0}:{name:Zf,path:"",bound:!1}}function rd(e,t=process.cwd()){if(Xf(e)&&Fi(e))return e;let i=t||process.cwd(),r=td(i),n=al(r,e);if(Fi(n))return n;let o=al(i,e);if(Fi(o))return o;throw new Error("script file not found: "+e)}function Oi(e,t={}){e?.format===Tt&&Pn(e.version);let i=[],r=typeof t.workspacePath=="string"&&t.workspacePath?t.workspacePath:"",n=e?.format===Tt&&e.assets,o=mo(e?.controlGuidChanges),a=hi(e?.scriptSync),s=n?null:ct(e,{warnings:i}),c={server:n&&e.assets.server?ct(e.assets.server,{warnings:i}):go(ce),client:n&&e.assets.client?ct(e.assets.client,{warnings:i}):go(H)};s&&(c[Pt(s.meta.assetType)]=s);let l=n&&e.activeAssetType===H?H:s?.meta.assetType||ce,u=n&&e.meta?.name?String(e.meta.name):"",f=()=>u||Jt;!e?.meta?.name&&c.server.meta.name==="\u672A\u547D\u540D\u754C\u9762\u63A7\u4EF6\u7EC4"&&(c.server.meta.name=ed);let h=[],p=new Set;function m(){p.clear(),Gt(c.server.root,p),Gt(c.client.root,p,{skipServerContainer:!0});for(let g of h)Ne(g.guid)&&p.add(Number(g.guid))}function y(g=0){m();let S=Ne(g)&&!p.has(Number(g))?Number(g):nt(p);return p.add(S),S}function I(g){let S=Mr(g),C=y(S.guid);return{...S,guid:C,id:String(C)}}et(Qf(e));let b=Ti(e?.serverLogic),v=null,P="",R=1,F=1;function $(g){let S=String(g||"").trim();if(!S)return"";if(!K[S])throw new Error(`unknown canvas preset: ${S} (available: ${Object.keys(K).join(", ")})`);return S}let Y=()=>c[Pt(l)];function G(g){if(!g)return null;for(let[S,C]of[["server",c.server],["client",c.client]]){let N=he(C.root,g);if(N&&N.kind!=="server-container")return{key:S,node:N}}return null}function w(g){if(!g.controlId)return null;let S=g.controlAsset===H?"client":g.controlAsset===ce?"server":null;if(S){let C=he(c[S].root,g.controlId);return C&&C.kind!=="server-container"?{key:S,node:C}:null}return G(g.controlId)}function A(){for(let g of h)g.controlId&&!w(g)&&(g.controlId="",g.controlAsset="")}function x(g){if(!Ne(g))return null;for(let[S,C]of[[ce,c.server],[H,c.client]]){let N="";if(te(C.root,O=>{!N&&(O.scriptMappingIds||[]).includes(Number(g))&&(N=O.id)}),N)return{controlId:N,controlAsset:S}}return null}function k(g,S,C){let N=c[Pt(g.controlAsset)],O=N&&he(N.root,g.controlId);O&&(O.scriptMappingIds=(O.scriptMappingIds||[]).map(D=>Number(D)===Number(S)?Number(C):D))}A();function z(){return h.map(g=>{let S=w(g),C=S?S.key==="client"?H:ce:"";return L({id:g.id,guid:g.guid||0,path:g.path||"",source:g.source||"",controlId:g.controlId||"",controlAsset:g.controlAsset||C,controlName:S?.node.name||"",assetType:C,assetLabel:S?po[C]:"",mounted:!!S})})}function E(){let g=[],S=(C,N)=>{te(C.root,O=>{O.kind!=="server-container"&&g.push(L({id:O.id,name:O.name,kind:O.kind,assetType:N,assetLabel:po[N]}))})};return S(c.server,ce),S(c.client,H),g}function _(g){let S=[];return te(g.root,C=>{C.kind!=="server-container"&&S.push(JSON.stringify({kind:C.kind,guid:C.guid,name:C.name,text:C.text??null,imageId:C.imageId??null,imageSource:C.imageSource??null,imageType:C.imageType??null,fontSize:C.fontSize??null,adaptiveFontSize:C.adaptiveFontSize??null,minimumFontSize:C.minimumFontSize??null,fontColor:C.fontColor??null,bgColor:C.bgColor??null,imageColor:C.imageColor??null,fillType:C.fillType??null,fillAmount:C.fillAmount??null,syncAllDevices:C.syncAllDevices!==!1,transformByPlatform:C.transformByPlatform||null}))}),S.join("/")}let B=_(Vt()),j=_(vt());function re(g){let S=_(g);return g.meta?.assetType===H?S===B:S===j}function U(g,S){return String(g||"").replace(/[\\/:*?"<>|]/g,"-").trim()||S}function ie(g){let S=U(f(),Jt),C=g.meta?.assetType===H?"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F";return`${S} \xB7 ${C}`}function Re(){if(!((c.server.root.children||[]).find(S=>S.kind==="container")||c.server.root.children?.[0]))throw new Error("\u6574\u5408\u5305\u9700\u8981\u670D\u52A1\u7AEF\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668\u4E0B\u81F3\u5C11\u6709\u4E00\u4E2A\u6839\u63A7\u4EF6");return Fa(c.server,c.client,{scripts:h,fileName:`${U(f(),Jt)} \xB7 \u6574\u5408\u5305.gia`})}function Nt(){let g=S=>({type:S.meta.assetType,name:S.meta.name,sourceFile:S.meta.sourceFile||""});return{format:Tt,name:f(),activeAssetType:l,assets:{server:g(c.server),client:g(c.client),scripts:z()}}}function ri(){return L({format:Tt,version:4,meta:{name:f()},activeAssetType:l,serverLogic:b,controlGuidChanges:o,scriptSync:a,assets:{server:c.server,client:c.client,scripts:h.map(g=>L({id:g.id,guid:g.guid||0,path:g.path||"",source:g.source||"",controlId:g.controlId||"",controlAsset:g.controlAsset||""}))}})}function ne(){let g=Y(),S=Ka(g);if(S.workspace=id(r),S.save=Nt(),S.scripts=z(),S.mountTargets=E(),S.serverLogic=b,S.migrationWarnings=[...i],S.controlGuidChanges=L(o),l===H){let C=Lt(g,!0);S.clientGuidAutofill={count:C.length,templateCount:C.filter(({parent:N})=>N?.kind==="server-container").length,selectedOffset:C.findIndex(({node:N})=>N.id===S.selectedId)}}return S.scriptSync=L(a),jo(S),S}function $e(g){let S=Y();if(g.expectedRevision!==void 0&&Number(g.expectedRevision)!==S.version)throw new Error(`revision conflict: expected ${g.expectedRevision}, current ${S.version}`);return S}function ht(g,S,C=""){let N=String(S||"");if(N){let O=C===H?H:C===ce?ce:"";if(!w({controlId:N,controlAsset:O}))throw new Error("\u6302\u8F7D\u76EE\u6807\u5FC5\u987B\u662F\u5B58\u6863\u5185\u7684\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6216\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F");g.controlAsset=O}else g.controlAsset="";g.controlId=N}function Bi(g){let S=$e(g);if(g.op==="addScript"){let C=I({path:String(g.path||""),source:String(g.source||""),controlId:"",controlAsset:""});g.controlId!==void 0&&g.controlId!==""&&ht(C,g.controlId,g.controlAsset),h.push(C)}else if(g.op==="updateScript"){let C=h.find(N=>N.id===g.id);if(!C)throw new Error(`\u811A\u672C\u4E0D\u5B58\u5728: ${g.id}`);g.controlId!==void 0&&ht(C,g.controlId,g.controlAsset),g.path!==void 0&&(C.path=String(g.path)),g.source!==void 0&&(C.source=String(g.source))}else if(g.op==="removeScript"){let C=h.length;if(h=h.filter(N=>N.id!==g.id),h.length===C)throw new Error(`\u811A\u672C\u4E0D\u5B58\u5728: ${g.id}`)}return S.version+=1,ne()}function Yi(g){let S=$e(g),C=he(S.root,g.id??S.selectedId);if(!C||C.kind==="server-container")throw new Error("\u4EC5\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6216\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5141\u8BB8\u4FEE\u6539\u7D22\u5F15");let N=Zt(g.guid);if(Zt(C.guid),g.autoFillClientGuids!==void 0&&typeof g.autoFillClientGuids!="boolean")throw new Error("autoFillClientGuids \u5FC5\u987B\u662F\u5E03\u5C14\u503C");let O=g.autoFillClientGuids===!0;if(O&&l!==H)throw new Error("\u81EA\u52A8\u586B\u5145\u4EC5\u652F\u6301\u5BA2\u6237\u7AEF\u6A21\u677F\u5217\u8868\uFF1B\u670D\u52A1\u7AEF\u754C\u9762\u7684\u7D22\u5F15\u9700\u5355\u72EC\u586B\u5199");let D=O?Lt(S,!0).map(({node:V})=>V):[C],X=N-D.indexOf(C),J=D.map((V,se)=>({node:V,oldGuid:Zt(V.guid),newGuid:Zt(X+se)})),je=J.filter(({oldGuid:V,newGuid:se})=>V!==se);if(!je.length)return ne();let ae=new Map(J.map(({oldGuid:V,newGuid:se})=>[V,se]));if(ae.size!==J.length)throw new Error("\u5BA2\u6237\u7AEF\u6A21\u677F\u5B58\u5728\u91CD\u590D\u65E7\u7D22\u5F15\uFF0C\u65E0\u6CD5\u81EA\u52A8\u586B\u5145\uFF1B\u8BF7\u5148\u6D88\u9664\u6B67\u4E49");let tt=new Set(D),ge=[];for(let V of Object.values(c))te(V.root,se=>{V===c.client&&se.kind==="server-container"||ge.push({node:se,project:V})});let pt=new Map([...ge.filter(V=>!tt.has(V.node)).map(({node:V})=>[Number(V.guid),V.name]),...h.map(V=>[Number(V.guid),V.path||"Lua \u811A\u672C"])]);for(let{newGuid:V}of je)if(pt.has(V))throw new Error(`\u63A7\u4EF6\u7D22\u5F15 ${V} \u5DF2\u88AB\u300C${pt.get(V)}\u300D\u5360\u7528\uFF1B\u8BF7\u5148\u586B\u5199\u5B83\u7684\u5B9E\u9645\u7D22\u5F15\u3002\u672C\u6B21\u672A\u4FEE\u6539\u4EFB\u4F55\u7D22\u5F15\u3002`);let Ve=[],ee=(V,se,He)=>{let Me=V?.[se];(typeof Me=="number"||typeof Me=="string"&&/^\d+$/.test(Me.trim()))&&ae.has(Number(Me))&&ae.get(Number(Me))!==Number(Me)&&Ve.push({owner:V,key:se,project:He.project,oldGuid:Number(Me),newGuid:ae.get(Number(Me))})};for(let V of ge)ee(V.node,"referencedPrefabId",V),ee(V.node,"itemPrefabId",V),ee(V.node.giaRaw,"templateRefSlot",V);let ye=new Map;for(let{node:V}of ge)ye.set(Number(V.guid),(ye.get(Number(V.guid))||0)+1);for(let{oldGuid:V}of Ve)if(ye.get(V)!==1)throw new Error(`\u65E7\u7D22\u5F15 ${V} \u5728\u591A\u68F5\u8D44\u4EA7\u6811\u4E2D\u91CD\u590D\uFF0C\u65E0\u6CD5\u786E\u5B9A\u6A21\u677F\u5F15\u7528\u5F52\u5C5E\uFF1B\u8BF7\u5148\u6D88\u9664\u6B67\u4E49\u540E\u4FEE\u6539`);let ci=O?nl():"",be=tl(h);for(let{node:V,oldGuid:se,newGuid:He}of je)V.guid=He,o.push({id:nl(),controlAsset:l,controlId:V.id,controlName:V.name,oldGuid:se,newGuid:He,scriptSignature:be,...ci?{batchId:ci}:{}});let Li=new Set([S]);for(let{owner:V,key:se,project:He,newGuid:Me}of Ve)V[se]=typeof V[se]=="string"?String(Me):Me,Li.add(He);for(let V of Li)V.version+=1;return ne()}function oe(g){let S=$e(g);if(!Array.isArray(g.changeIds)||!g.changeIds.length||g.changeIds.some(N=>typeof N!="string"||!o.some(O=>O.id===N)))throw new Error("\u8BF7\u660E\u786E\u6307\u5B9A\u5DF2\u6838\u5BF9 Lua \u5F15\u7528\u7684\u6709\u6548\u7D22\u5F15\u53D8\u66F4\u8BB0\u5F55 changeIds");let C=new Set(g.changeIds);return o=o.filter(N=>!C.has(N.id)),S.version+=1,ne()}function Ge(g){if(!g||typeof g!="object")throw new Error("patch requires op");if(g.op==="setScriptSync"){let S=$e(g);return a=hi(g.config),S.version+=1,ne()}if(g.op==="setControlGuid")return Yi(g);if(g.op==="acknowledgeControlGuidChanges")return oe(g);if(g.op==="setServerLogic"){let S=$e(g);return b=Ti(g.logic),S.version+=1,ne()}if(g.op==="addScript"||g.op==="updateScript"||g.op==="removeScript")return Bi(g);if(g.op==="selectAsset")return l=g.assetType===H?H:ce,ne();if(g.op==="renameSave"){let S=String(g.name||"").trim();if(!S)throw new Error("\u5B58\u6863\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");return u=S,ne()}if(g.op==="newAsset"){let S=$e(g);l=g.assetType===H?H:ce;let C=go(l);return C.version=S.version+1,c[Pt(l)]=C,o=o.filter(N=>N.controlAsset!==l),A(),ne()}return Mn(Y(),g),A(),ne()}function Le(g){return h.filter(S=>{let C=w(S);return!!(C&&C.key==="client"==(g===H))})}function ni(g="json",S=""){let C=oi(g,S);if(o.length&&!["save","archive"].includes(String(g).toLowerCase())){let N=o.map(O=>`\u63A7\u4EF6\u7D22\u5F15\u5F85\u6838\u5BF9 Lua \u5F15\u7528\uFF1A${po[O.controlAsset]} / ${O.controlName} (${O.controlId})\uFF1A${O.oldGuid} \u2192 ${O.newGuid}\u3002\u8BF7\u6309\u8BED\u4E49\u66F4\u65B0\u811A\u672C\u4E2D\u7684\u63A7\u4EF6\u7D22\u5F15\u5F15\u7528\uFF0C\u6838\u5BF9\u540E\u786E\u8BA4\u53D8\u66F4\u8BB0\u5F55 ${O.id}\uFF1B\u4E0D\u8981\u5168\u5C40\u66FF\u6362\u540C\u503C\u6570\u5B57\u3002`);C.warnings=[...new Set([...C.warnings||[],...N])]}return C}function oi(g="json",S=""){let C=String(g).toLowerCase();if(C==="save"||C==="archive"){let D=Buffer.from(JSON.stringify(ri(),null,2),"utf8");return L({filename:`${f().replace(/[\\/:*?"<>|]/g,"-")} \xB7 \u8D44\u4EA7\u5305.json`,mimeType:"application/json",encoding:"base64",data:D.toString("base64"),warnings:[]})}if(C==="save-gia"||C==="archive-gia"){let D=[],X=[],J=(ae,tt="")=>{let ge=ni(ae,tt);D.push(L({filename:ge.filename,mimeType:ge.mimeType,encoding:ge.encoding,data:ge.data,warnings:ge.warnings||[]})),X.push(...ge.warnings||[])},je=(ae,tt)=>{let ge=c[Pt(ae)],pt=ae===l,Ve=h.some(ee=>ee.controlAsset===ae&&ee.controlId);if(!pt&&re(ge)&&!Ve){X.push(tt);return}J("gia",ae)};if(je(ce,"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F\u4ECD\u662F\u9ED8\u8BA4\u6A71\u7A97\uFF0C\u672A\u6539\u52A8\u4E14\u5F53\u524D\u672A\u663E\u793A\uFF0C\u5DF2\u4ECE\u8D44\u4EA7\u5305 GIA \u4E2D\u7701\u7565\u3002"),je(H,"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u4ECD\u662F\u9ED8\u8BA4\u300CLua\u5B9E\u4F8B\u5316\u9762\u677F\u300D\uFF0C\u672A\u6539\u52A8\u4E14\u5F53\u524D\u672A\u663E\u793A\uFF0C\u5DF2\u4ECE\u8D44\u4EA7\u5305 GIA \u4E2D\u7701\u7565\u3002"),h.some(ae=>ae.path||ae.source)&&J("scripts-gia"),!D.length)throw new Error("\u8D44\u4EA7\u5305 GIA \u6CA1\u6709\u53EF\u5BFC\u51FA\u7684\u5DF2\u6539\u52A8\u9879\uFF1B\u8BF7\u5148\u7F16\u8F91\u5F53\u524D\u754C\u9762\uFF0C\u6216\u6539\u7528\u300C\u5F53\u524D\u754C\u9762 GIA\u300D\u3002");return L({format:"qxqy-gia-package",files:D,warnings:[...new Set(X)]})}if(C==="gia-combined"||C==="combined-gia"||C==="combined"){let D=Re();return L({filename:`${U(f(),Jt)} \xB7 \u6574\u5408\u5305.gia`,mimeType:"application/octet-stream",encoding:"base64",data:D.buffer.toString("base64"),warnings:[...new Set(D.warnings||[])]})}if(C==="scripts"){let D=L({format:qf,version:1,scripts:h.map(J=>L({id:J.id,guid:J.guid||0,path:J.path||"",source:J.source||"",controlId:J.controlId||"",controlAsset:J.controlAsset||""}))}),X=Buffer.from(JSON.stringify(D,null,2),"utf8");return L({filename:`${U(f(),Jt)} \xB7 \u811A\u672C.json`,mimeType:"application/json",encoding:"base64",data:X.toString("base64"),warnings:[]})}if(C==="scripts-gia"||C==="scriptsgia"){let D=Da(h);return L({filename:`${U(f(),Jt)} \xB7 \u811A\u672C.gia`,mimeType:"application/octet-stream",encoding:"base64",data:D.buffer.toString("base64"),warnings:D.warnings})}if(C==="lua"){let D=h.find(J=>J.id===S)||h.find(J=>J.path===S);if(!D)throw new Error("\u6CA1\u6709\u53EF\u5BFC\u51FA\u7684 Lua \u811A\u672C\uFF0C\u8BF7\u5148\u5728\u201CLua \u811A\u672C\u201D\u9875\u521B\u5EFA");let X=Qt(D.path||"")||`qxqy-script-${D.id}`;return L({filename:/\.lua$/i.test(X)?X:`${X}.lua`,mimeType:"text/x-lua",encoding:"base64",data:Buffer.from(D.source||"","utf8").toString("base64"),warnings:[]})}let N=S?c[Pt(S)]:Y(),O=ie(N);if(C==="json"){let D=L({...N,scripts:Le(N.meta.assetType),controlGuidChanges:o.filter(J=>J.controlAsset===N.meta.assetType)}),X=Buffer.from(JSON.stringify(D,null,2),"utf8");return L({filename:`${O}.json`,mimeType:"application/json",encoding:"base64",data:X.toString("base64"),warnings:[]})}if(C==="gia"){let D=Na(N,N.meta.assetType===H?{scripts:Le(H)}:{}),X=N.meta.assetType===H?[]:Le(ce);return X.length&&D.warnings.unshift(`\u5F53\u524D\u670D\u52A1\u5668\u63A7\u4EF6 GIA \u4E0D\u5305\u542B ${X.length} \u4E2A Lua \u811A\u672C\u7684\u6E90\u7801\uFF1B\u8BF7\u4F7F\u7528\u300C\u8D44\u4EA7\u5305 GIA \u6574\u5408\u5305\u300D\uFF0C\u6216\u53E6\u884C\u5BFC\u5165\u811A\u672C\u5305\u5E76\u6838\u5BF9\u6302\u8F7D\u3002`),L({filename:`${O}.gia`,mimeType:"application/octet-stream",encoding:"base64",data:D.buffer.toString("base64"),warnings:D.warnings})}throw new Error(`unsupported export format: ${g}`)}function et(g){for(let S of g){let C=Mr(S);if(!C.path&&!C.source)continue;let N=C.controlId?null:x(C.guid),O=I(N?{...C,...N}:C);N&&O.guid!==C.guid&&k(N,C.guid,O.guid),O.controlId&&!w(O)&&(O.controlId="",O.controlAsset=""),h.push(O)}}function ai(g,S,C=""){let N=String(g||"").toLowerCase();if(typeof S!="string"||!S)throw new Error("import data is required");let O=Buffer.from(S,"base64"),D,X=[],J={},je=[];if(N==="json"){try{D=JSON.parse(O.toString("utf8"))}catch{throw new Error("JSON \u6587\u4EF6\u65E0\u6548")}if(D?.project&&(D=D.project),D?.format===Tt&&D?.assets){Pn(D.version);let ee=Oi(D);X.push(...ee.get().migrationWarnings);let ye=ee.archiveData();return c.server=ye.assets.server,c.client=ye.assets.client,i=[...X],l=D.activeAssetType===H?H:ce,u=String(D.meta?.name||Qt(C).replace(/\.json$/i,"")||u),b=ye.serverLogic,h=ye.assets.scripts,o=ye.controlGuidChanges,a=ye.scriptSync,p.clear(),L({snapshot:ne(),warnings:X,metadata:{format:Tt}})}}else{if(N==="lua")return h.push(I({path:Qt(C||"imported.lua"),source:O.toString("utf8"),controlId:""})),L({snapshot:ne(),warnings:X,metadata:{assetType:"lua-script"}});if(N==="gia"){if($a(O)){let be=Va(O);return et(be.scripts),L({snapshot:ne(),warnings:be.warnings,metadata:be.metadata})}let ee=Ba(O);D=ee.project,X=ee.warnings,J=ee.metadata,ee.clientProject&&(c.client=ct(ee.clientProject),o=o.filter(be=>be.controlAsset!==H),X.push("\u6574\u5408\u5305\u5DF2\u62C6\u56DE\u300CUI\u63A7\u4EF6-\u670D\u52A1\u7AEF\u300D\u4E0E\u300CUI\u63A7\u4EF6-\u5BA2\u6237\u7AEF\u300D\uFF1B\u5BA2\u6237\u7AEF\u6A21\u677F\u8FB9\u754C\u5DF2\u4FDD\u7559\u3002"));let ye=new Map,ci=(be,Li)=>{be&&te(be.root,V=>{for(let se of V.scriptMappingIds||[]){let He=ye.get(Number(se));if(He){X.push(`\u811A\u672C GUID ${se} \u540C\u65F6\u6302\u8F7D\u5230\u591A\u4E2A\u63A7\u4EF6\uFF0C\u5DF2\u4FDD\u7559\u201C${He.controlAsset===ce?"\u670D\u52A1\u7AEF":"\u5BA2\u6237\u7AEF"}\u201D\u76EE\u6807\u3002`);continue}ye.set(Number(se),{controlId:V.id,controlAsset:Li})}})};ci(ee.project,ee.project.meta.assetType),ci(ee.clientProject,H),je=(ee.scripts||[]).map(be=>ye.has(Number(be.guid))?{...be,...ye.get(Number(be.guid))}:be)}else throw new Error(`unsupported import format: ${g}`)}let ae=ct(D,{warnings:X}),tt=mo(D?.controlGuidChanges);if(tt.some(ee=>ee.controlAsset!==ae.meta.assetType))throw new Error("\u5355\u8D44\u4EA7 JSON \u7684\u7D22\u5F15\u53D8\u66F4\u8BB0\u5F55\u5FC5\u987B\u5C5E\u4E8E\u5F53\u524D\u5BFC\u5165\u8D44\u4EA7");let ge=mo([...o.filter(ee=>ee.controlAsset!==ae.meta.assetType),...tt]);i=[...X];let pt=Pt(ae.meta.assetType);c[pt]=ae,o=ge,l=ae.meta.assetType;let Ve=c[pt];return C&&(Ve.meta.name=Qt(C).replace(/\.(json|gia)$/i,"")||Ve.meta.name,Ve.meta.sourceFile=Qt(C),Ve.meta.sourceFormat=N),et(je),et(D?.scripts||[]),D?.script&&(D.script.path||D.script.source)&&et([D.script]),L({snapshot:ne(),warnings:X,metadata:J})}function ac(g,S){return Mn(Y(),{op:"pick",x:g,y:S}),ne()}function sc(g){let S=typeof g=="string"&&g?g:"";!S||S===r||(r=S)}function lc(g){let S=g.source||"";if(!S.trim()&&g.path.trim())try{S=Hf(rd(g.path,r),"utf8")}catch(C){throw new Error(`\u811A\u672C ${g.path} \u8BFB\u53D6\u5931\u8D25: ${C?.message||C}`)}return S}function si(g={}){let S=$(g.canvasId);S&&(P=S),g.playerCount!==void 0&&g.playerCount!==null&&g.playerCount!==""&&(R=kt(g.playerCount),F>R&&(F=1)),g.viewPlayerIndex!==void 0&&g.viewPlayerIndex!==null&&g.viewPlayerIndex!==""&&(F=Ze(g.viewPlayerIndex,R)),v&&lo(v);let C=h.map(O=>{try{return{id:O.id,guid:O.guid||0,path:O.path||O.id,source:lc(O),controlId:O.controlId||"",controlAsset:O.controlAsset||""}}catch(D){return{id:O.id,guid:O.guid||0,path:O.path||O.id,source:`error([==[ ${String(D.message).replace(/]=+]/g,"] =]")} ])`,controlId:O.controlId||"",controlAsset:O.controlAsset||""}}}),N=O=>C.filter(D=>{let X={controlId:D.controlId,controlAsset:D.controlAsset},J=D.controlId?w(X):null;return!!(J&&J.key===O)});return v=Ys(c.server,{templatesProject:c.client,scripts:C,sceneScripts:N("server"),templateScripts:N("client"),serverConfig:{logic:b},canvasId:P,playerCount:R,viewPlayerIndex:F,language:g.language||""}),fe(g)}function cc(g,S={}){let C=$(g);if(!C)throw new Error("playSetCanvas requires canvasId");return si({...S,canvasId:C})}function fe(g={}){if(!v)return L({running:!1,tree:[],logs:[],serverLogs:[],serverVars:[]});let S=io(v,g);return S.running=!0,S.logs=ho(S.logs),S.serverLogs=ho(S.server?.logs||[]),S.serverVars=Kf(S.server,S.playerCount||1),S}function uc(g,S={}){return v||si(),Tr(v,g),S.observe===!1?L({running:!0,time:v.runtime.clock.time,frame:v.runtime.clock.frame,paused:!!v.debugPaused,levelTimePaused:!!v.runtime.clock.paused,playerCount:v.playerCount||1,viewPlayerIndex:v.viewPlayerIndex||1}):fe(S)}function fc(g=0){si();let S=Math.max(0,Number(g)||0);for(let C=0;C<S;C++)Tr(v,1/30);return fe()}function dc(){return v&&lo(v),v=null,P="",R=1,F=1,L({running:!1,tree:[],logs:[],serverLogs:[],serverVars:[]})}function hc(g,S={}){let C=li();return F=eo(C,g),S.observe===!1?null:fe(S)}function pc(g,S={}){if(!v)throw new Error("play session has not started");return ro(v,g),S.observe===!1?null:fe(S)}function mc(g,S={}){if(!v)throw new Error("play session has not started");return no(v,g),S.observe===!1?null:fe(S)}function gc(g,S,C,N={}){if(!v)throw new Error("play session has not started");return Ni(v,g,S,C,N),N.observe===!1?null:fe(N)}function yc(g={}){return v&&Rr(v).pause(),g.observe===!1?null:fe(g)}function bc(g={}){return v&&Rr(v).resume(),g.observe===!1?null:fe(g)}function li(){if(!v)throw new Error("play session has not started");return v}function vc(g,S){let C=li();if(!g&&!S){let N=fe();return L({vars:N.serverVars||[]})}return L({entityType:String(g||""),name:String(S||""),value:Js(C,g,S)})}function wc(g,S,C){let N=li();return ao(N,g,S,C),fe()}function Sc(g,S=[],C="PlayerSelf"){let N=li();return so(N,g,S,C),fe()}function xc(){let g=fe();return L({events:g.history||[],case:_s(g.history||[],{playerCount:g.playerCount||1})})}function Ic(g={}){let S=fe(),C=Ri({name:g.name||"",dt:g.dt,playerCount:g.playerCount||S.playerCount||1,events:g.events||S.history||[],asserts:g.asserts||[]});return L(C)}function Cc(g,S={}){let C=Ri(g);si({...S,playerCount:S.playerCount||C.playerCount||1});let N=li();N.recording=!1;try{return el(Rr(N),g)}finally{N.recording=!0}}function kc(){if(!v)return{running:!1,paused:!1,time:0,frame:0,playerCount:1,viewPlayerIndex:1};let g=v.runtime.clock;return{running:!0,paused:!!v.debugPaused,levelTimePaused:!!g.paused,time:g.time,frame:g.frame,playerCount:v.playerCount||1,viewPlayerIndex:v.viewPlayerIndex||1}}let Do={get:ne,patch:Ge,setWorkspace:sc,exportData:ni,importData:ai,pick:ac,playStart:si,playSetCanvas:cc,playSetView:hc,playGet:fe,playStatus:kc,playStep:uc,playRun:fc,playStop:dc,playKey:pc,playClick:mc,playPointer:gc,playPause:yc,playResume:bc,playServerGet:vc,playServerSet:wc,playServerSend:Sc,playHistory:xc,playSaveCase:Ic,playRunCase:Cc,archiveData:ri};return Object.defineProperty(Do,"_project",{enumerable:!1,get:Y}),Do}import{createRequire as ad}from"node:module";function yo(e,t,i){if(e.fillType!=="Horizontal"&&e.fillType!=="Vertical")return null;let r=Number(e.fillAmount??1),n=Number.isFinite(r)?Math.max(0,Math.min(1,r)):1;if(e.fillType==="Horizontal"){let a=t*n;return{x:e.fillHorizontalType==="Right"?t/2-a:-t/2,y:-i/2,width:a,height:i}}let o=i*n;return{x:-t/2,y:e.fillVerticalType==="Top"?-i/2:i/2-o,width:t,height:o}}function sl(e,t,i){let r=t?.m_Rect,n=t?.m_RD?.textureRectOffset,o=t?.m_RD?.textureRect,a=Math.round(Number(r?.width)),s=Math.round(Number(r?.height)),c=Math.round(Number(n?.X)),l=Math.round(Number(n?.Y)),u=Math.round(Number(o?.width)),f=Math.round(Number(o?.height)),h=t?.m_RD?.settingsRaw?.packingRotation;if(![a,s,u,f].every(y=>Number.isInteger(y)&&y>0&&y<=8192)||a*s>16777216||!Number.isFinite(c)||!Number.isFinite(l)||c<0||l<0||c+u>a||l+f>s)throw new Error("Invalid sprite dimensions or trim offset");if(h&&h!=="None")throw new Error(`Unsupported sprite packing rotation: ${h}`);let p=i(a,s),m=p.getContext("2d");if(e.width===a&&e.height===s)m.drawImage(e,0,0);else{if(e.width!==u||e.height!==f)throw new Error("Sprite PNG does not match its trim metadata");m.drawImage(e,c,s-l-f)}return p}function ll(e,t,i){let r=Number(t??4294967295)>>>0;if((r&16777215)===16777215)return e;let n=i(e.width,e.height),o=n.getContext("2d");o.drawImage(e,0,0);let a=o.getImageData(0,0,n.width,n.height),s=r>>>16&255,c=r>>>8&255,l=r&255;for(let u=0;u<a.data.length;u+=4)a.data[u]=Math.round(a.data[u]*s/255),a.data[u+1]=Math.round(a.data[u+1]*c/255),a.data[u+2]=Math.round(a.data[u+2]*l/255);return o.putImageData(a,0,0),n}function nd(e){return!!e?.border&&Object.values(e.border).some(t=>Number.isFinite(t)&&t>0)}function ul(e,t){let i=typeof t=="object"?t?.Name:t;return nd(e)&&i!=="Basic"?"Stretch":"Basic"}function fl(e){if(!e)return null;let t=Number(e.m_Rect?.width),i=Number(e.m_Rect?.height);if(![t,i].every(n=>Number.isFinite(n)&&n>0&&n<=8192)||t*i>16777216)throw new Error("Invalid image metadata dimensions");let r={};for(let[n,o]of[["left","X"],["bottom","Y"],["right","Z"],["top","W"]]){let a=Number(e.m_Border?.[o]??0);if(!Number.isFinite(a))throw new Error("Invalid image border");r[n]=Math.max(0,a)}return{width:t,height:i,border:r}}function od(e,t,i,r){t=Number.isFinite(t)?Math.max(0,t):0,i=Number.isFinite(i)?Math.max(0,i):0;let n=Math.min(1,e/(t+i||1));t*=n,i*=n;let o=Math.min(1,r/(t+i||1));return{source:[0,t,e-i,e],target:[0,t*o,r-i*o,r]}}var cl=new WeakMap;function dl(e,t,i,r,n){let o=Math.max(0,i),a=Math.max(0,r),s=Math.min(1,4096/Math.max(1,o),4096/Math.max(1,a)),c=Math.max(1,Math.round(o*s)),l=Math.max(1,Math.round(a*s)),u=n(c,l),f=u.getContext("2d");if(!o||!a)return u;let h=cl.get(e);if(!h){let v=n(e.width,e.height),P=v.getContext("2d");P.drawImage(e,0,0),h=P.getImageData(0,0,e.width,e.height),cl.set(e,h)}let p=f.createImageData(c,l),m=h.data,y=(v,P,R,F,$,Y)=>{let{source:G,target:w}=od(P,R,F,$);return Array.from({length:Y},(A,x)=>{let k=(x+.5)*$/Y,z=k<w[1]?0:k<w[2]?1:2,E=w[z+1]>w[z]?(k-w[z])/(w[z+1]-w[z]):0,_=Math.max(0,Math.min(v-1,(G[z]+E*(G[z+1]-G[z]))*v/P-.5)),B=Math.floor(_);return[B,Math.min(v-1,B+1),_-B]})},I=y(e.width,t.width,t.border.left,t.border.right,o,c),b=y(e.height,t.height,t.border.top,t.border.bottom,a,l);for(let v=0;v<l;v++)for(let P=0;P<c;P++){let[R,F,$]=I[P],[Y,G,w]=b[v],A=(Y*e.width+R)*4,x=(Y*e.width+F)*4,k=(G*e.width+R)*4,z=(G*e.width+F)*4,E=m[A+3]*(1-$)*(1-w),_=m[x+3]*$*(1-w),B=m[k+3]*(1-$)*w,j=m[z+3]*$*w,re=E+_+B+j,U=(v*c+P)*4;p.data[U+3]=Math.round(re);for(let ie=0;ie<3;ie++)p.data[U+ie]=re?Math.round((m[A+ie]*E+m[x+ie]*_+m[k+ie]*B+m[z+ie]*j)/re):0}return f.putImageData(p,0,0),u}var sd=ad(import.meta.url),ld=[0,-.5,.5,.5,-.5,.5],cd=[0,-.5,.12,-.12,.5,0,.12,.12,0,.5,-.12,.12,-.5,0,-.12,-.12],ud=[0,-.5,.11,-.15,.48,-.15,.18,.07,.29,.41,0,.2,-.29,.41,-.18,.07,-.48,-.15,-.11,-.15],bo=Buffer.from([137,80,78,71,13,10,26,10]),fd=new Set(["image","textbox","textwindow","button","grid"]),Nr={cursor:"\u5149\u6807\u68C0\u6D4B\u533A\u57DF",reference:"\u6A21\u677F\u5F15\u7528\u63A7\u4EF6",grid:"\u7F51\u683C\u89C6\u7A97",button:"\u9884\u8BBE\u6309\u94AE",keyhint:"\u6309\u952E\u63D0\u793A",animation:"\u754C\u9762\u52A8\u6548",fullscreen:"\u5168\u5C4F\u52A8\u6548"},Fr=null;function zi(){if(Fr)return Fr;try{Fr=sd("@napi-rs/canvas")}catch(e){let t=e?.message||String(e);throw new Error(`Host screenshot renderer requires @napi-rs/canvas (${t})`)}return Fr}function W(e,t=0){let i=Number(e);return Number.isFinite(i)?i:t}function zr(e,t=4294967295){let i=Number(e??t)>>>0;return{r:i>>>16&255,g:i>>>8&255,b:i&255,a:(i>>>24&255)/255}}function Rt(e,t=1){return`rgba(${e.r},${e.g},${e.b},${Math.max(0,Math.min(1,e.a*t))})`}function pl(e,t,i=1){let r=Math.max(1,Math.round(W(e,1))),n=Math.max(1,Math.round(W(t,1))),o=Math.max(1,Math.min(2,W(i,1)));return{width:r,height:n,pixelWidth:Math.max(1,Math.round(r*o)),pixelHeight:Math.max(1,Math.round(n*o)),pixelRatio:o}}function ml(e){let t=Buffer.from(e.toBuffer("image/png"));if(t.length<bo.length||!t.subarray(0,bo.length).equals(bo))throw new Error("Host screenshot renderer did not produce a PNG");return t}function dd(e){return e==="triangle"?ld:e==="fourstar"?cd:ud}function hd(e,t,i,r,n){let o=dd(t);e.beginPath();for(let a=0;a<o.length;a+=2){let s=o[a]*i,c=o[a+1]*r;a===0?e.moveTo(s,c):e.lineTo(s,c)}e.closePath(),e.fillStyle=Rt(n),e.fill()}function gl(e,t,i){let r=t?.matrix,n=r&&typeof r=="object"?[r.a,r.b,r.c,r.d,r.tx,r.ty].map(Number):null,o=t?.pressed?.98:1;if(n&&n.every(Number.isFinite)){let[a,s,c,l,u,f]=n;e.transform(a*o,-s*o,-c*o,l*o,u,i-f);return}e.translate(W(t.left)+W(t.width)/2,i-W(t.bottom)-W(t.height)/2),e.rotate(-W(t.rotationZ)*Math.PI/180),e.scale(o,o)}function pd(e,t,i,r,n,o){if(typeof e.roundRect=="function"){e.roundRect(t,i,r,n,o);return}let a=Math.max(0,Math.min(o,r/2,n/2));e.moveTo(t+a,i),e.arcTo(t+r,i,t+r,i+n,a),e.arcTo(t+r,i+n,t,i+n,a),e.arcTo(t,i+n,t,i,a),e.arcTo(t,i,t+r,i,a),e.closePath()}function yl(e,t,i,r){let n=zr(t.bgColor,16777215);e.fillStyle=Rt(n),e.fillRect(-i/2,-r/2,i,r);let o=t.textLayout||qe(t,i,r),a=o.fontSize,s=zr(t.fontColor,4294967295),c=t.horizontalAlignment==="Right"?1:t.horizontalAlignment==="Middle"?.5:0,l=t.verticalAlignment==="Bottom"?1:t.verticalAlignment==="Middle"?.5:0;e.save(),e.beginPath(),e.rect(-i/2,-r/2,i,r),e.clip(),e.font=`${a}px ${yi()}`,e.fillStyle=Rt(s),e.textAlign=c===1?"right":c===.5?"center":"left";let u=t.kind==="textwindow"?t.scroll:null;if(e.textBaseline=u?"top":l===1?"bottom":l===.5?"middle":"top",t.enableOutline){let I=zr(t.outlineColor,4278190080);e.strokeStyle=Rt(I),e.lineWidth=Math.max(2,a*.12),e.lineJoin="round"}let f=u?-i/2+2+c*u.textWidth:c===0?-i/2+2:c===1?i/2-2:0,h=l===0?-r/2:l===1?r/2:0,p=u?.lines||o.lines,m=u?.lineHeight||o.lineHeight,y=u?-r/2-u.offset+(u.max>0?0:l*(r-u.contentLength)):l===.5?h-(p.length-1)*m/2:l===1?h-(p.length-1)*m:h;for(let I=0;I<p.length;I+=1){let b=y+I*m;u&&(b+m<-r/2||b>r/2)||(t.enableOutline&&e.strokeText(p[I],f,b),e.fillText(p[I],f,b))}e.restore()}function md(e,t,i,r){let n=Kt(t.scroll,i,r);if(n)for(let[o,a]of[[n.track,"#263447"],[n.thumb,"#90aecb"]])e.fillStyle=a,e.fillRect(o.x,o.y,o.width,o.height)}function bl(e,t,i,r){e.beginPath(),pd(e,-i/2,-r/2,i,r,6),e.fillStyle="#3268cf",e.fill(),e.strokeStyle="rgba(112,160,255,0.8)",e.lineWidth=1,e.stroke(),t.pressed&&(e.fillStyle="rgba(0,0,0,0.28)",e.fill())}function vl(e,t,i,r,n){let o=zr(t.imageColor,4294967295),a=Xi(t.imageId,t.imageSource),s=n?.images?.get(a);if(t.primitive==="sprite"&&s){let c=n.imageMetadata?.get(a),l=ul(c,t.imageType),u=`${a}:${Number(t.imageColor??4294967295)&16777215}:${l}:${l==="Stretch"?`${i}:${r}`:""}`,f=n.tints.get(u);if(!f){let h=l==="Stretch"?dl(s,c,i,r,zi().createCanvas):s;f=ll(h,t.imageColor,zi().createCanvas),n.tints.set(u,f)}e.globalAlpha*=o.a,e.drawImage(f,-i/2,-r/2,i,r);return}if(t.primitive==="missing"||t.primitive==="sprite"){e.fillStyle="rgba(72,34,40,0.36)",e.fillRect(-i/2,-r/2,i,r),e.strokeStyle="#ff7481",e.lineWidth=1,e.strokeRect(-i/2+.5,-r/2+.5,Math.max(0,i-1),Math.max(0,r-1));return}if(t.primitive==="circle"){e.beginPath(),e.ellipse(0,0,i/2,r/2,0,0,Math.PI*2),e.fillStyle=Rt(o),e.fill();return}if(t.primitive==="ring"){e.beginPath(),e.ellipse(0,0,Math.max(1,i/2-3.5),Math.max(1,r/2-3.5),0,0,Math.PI*2),e.strokeStyle=Rt(o),e.lineWidth=7,e.stroke();return}if(t.primitive==="triangle"||t.primitive==="fourstar"||t.primitive==="fivestar"){hd(e,t.primitive,i,r,o);return}e.fillStyle=Rt(o),e.fillRect(-i/2,-r/2,i,r)}function gd(e,t,i,r){let n=Math.max(0,W(t.sourceWidth,W(t.width))),o=Math.max(0,W(t.sourceHeight,W(t.height)));e.save();for(let a of t.clipPolygons||[])e.beginPath(),a.forEach((s,c)=>c?e.lineTo(s.x,i-s.y):e.moveTo(s.x,i-s.y)),e.closePath(),e.clip();if(gl(e,t,i),t.kind==="textbox"||t.kind==="textwindow")yl(e,t,n,o);else if(t.kind==="button")bl(e,t,n,o);else if(t.kind!=="grid"){let a=yo(t,n,o);a&&(e.beginPath(),e.rect(a.x,a.y,a.width,a.height),e.clip()),vl(e,t,n,o,r)}md(e,t,n,o),e.restore()}function wl(e,t,i,{checker:r=!1}={}){if(r){e.fillStyle="#28313e",e.fillRect(0,0,t,i);let o=16;for(let a=0;a<i;a+=o)for(let s=0;s<t;s+=o)(s/o+a/o)%2===0&&(e.fillStyle="rgba(255,255,255,0.04)",e.fillRect(s,a,o,o));e.strokeStyle="#40b8cf",e.lineWidth=1,e.strokeRect(.5,.5,t-1,i-1);return}let n=e.createRadialGradient(t/2,i*.45,8,t/2,i/2,Math.max(t,i)*.72);n.addColorStop(0,"#123a6b"),n.addColorStop(.72,"#061934"),n.addColorStop(1,"#071426"),e.fillStyle=n,e.fillRect(0,0,t,i)}function yd(e,t){return{a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,tx:e.a*t.tx+e.c*t.ty+e.tx,ty:e.b*t.tx+e.d*t.ty+e.ty}}function hl(e){let t=e?.matrix;return!t||typeof t!="object"?{a:1,b:0,c:0,d:1,tx:0,ty:0}:{a:W(t.a,1),b:W(t.b),c:W(t.c),d:W(t.d,1),tx:W(t.tx),ty:W(t.ty)}}function bd(e){let t=Array.isArray(e?.nodes)?e.nodes:[],i=new Map;for(let a of t){if(!a||a.id===void 0||a.id===null)continue;let s=a.parent==null?"":String(a.parent),c=i.get(s);c?c.push(a):i.set(s,[a])}for(let a of i.values())a.sort((s,c)=>W(s.z)-W(c.z));let r=[];function n(a,s,c,l){if(!fd.has(a.kind))return;let u=Math.abs(W(a.sourceWidth)*Math.hypot(s.a,s.b)),f=Math.abs(W(a.sourceHeight)*Math.hypot(s.c,s.d));r.push({...a,left:s.tx-u/2,bottom:s.ty-f/2,width:u,height:f,rotationZ:Math.atan2(s.b,s.a)*180/Math.PI,matrix:{a:s.a,b:s.b,c:s.c,d:s.d,tx:s.tx,ty:s.ty},...c.length?{clipPolygons:c}:{},...l.length?{masks:l}:{}})}function o(a,s,c=null,l=[],u=[]){let f=i.get(a)||[];for(let h=f.length-1;h>=0;h-=1){let p=f[h],m=s?yd(s,hl(p)):hl(p),y=l;if(p.clipToParent&&s&&c){let v=c.sourceWidth/2,P=c.sourceHeight/2;y=[...l,[[-v,-P],[v,-P],[v,P],[-v,P]].map(([R,F])=>({x:s.a*R+s.c*F+s.tx,y:s.b*R+s.d*F+s.ty}))]}let I=kr(p,m),b=I?[...u,I]:u;p.kind!=="grid"&&n(p,m,y,b),o(String(p.id),m,p,y,b),p.kind==="grid"&&n(p,m,y,b)}}return o("",null),r}function Sl(e,t,i,r={}){return Sd(bd(e),t,i,r)}function vd(e,t,i){if(!(e.width>0&&e.height>0)||!Xe(e.matrix))return null;let r=[[-1,-1],[1,-1],[1,1],[-1,1]].map(([c,l])=>{let u=Ie(e.matrix,c*e.width/2,l*e.height/2);return{x:u.x*i.pixelRatio,y:(i.height-u.y)*i.pixelRatio}}),n=Math.max(t.x,Math.floor(Math.min(...r.map(c=>c.x)))),o=Math.max(t.y,Math.floor(Math.min(...r.map(c=>c.y)))),a=Math.min(t.x+t.canvas.width,Math.ceil(Math.max(...r.map(c=>c.x)))),s=Math.min(t.y+t.canvas.height,Math.ceil(Math.max(...r.map(c=>c.y))));return a>n&&s>o?{x:n,y:o,width:a-n,height:s-o}:null}function wd(e,t,i,r){let n=t.canvas.width,o=t.canvas.height,a=t.ctx.getImageData(0,0,n,o).data,s=t.x-e.x,c=t.y-e.y,l=e.ctx.getImageData(s,c,n,o),u=l.data,f=Xe(i.matrix);for(let h=0;h<o;h++){let p=r.height-(t.y+h+.5)/r.pixelRatio;for(let m=0;m<n;m++){let y=(h*n+m)*4;if(!a[y+3])continue;let I=(t.x+m+.5)/r.pixelRatio,b=f.a*I+f.c*p+f.tx,v=f.b*I+f.d*p+f.ty,P=Ns(b,v,i),R=Math.round(a[y+3]*P)/255;if(!R)continue;let F=u[y+3]/255,$=R+F*(1-R);for(let Y=0;Y<3;Y++)u[y+Y]=Math.round((a[y+Y]*R+u[y+Y]*F*(1-R))/$);u[y+3]=Math.round($*255)}}e.ctx.save(),e.ctx.setTransform(1,0,0,1,0,0),e.ctx.putImageData(l,s,c),e.ctx.restore()}function xl(e,t,i,r){for(let n of t){if(n.item){gd(e.ctx,n.item,i.height,r);continue}let o=vd(n.mask,e,i);if(!o)continue;let a=zi().createCanvas(o.width,o.height),s=a.getContext("2d");s.setTransform(i.pixelRatio,0,0,i.pixelRatio,-o.x,-o.y);let c={canvas:a,ctx:s,x:o.x,y:o.y};xl(c,n.children,i,r),wd(e,c,n.mask,i)}}function Sd(e,t,i,r={}){let{createCanvas:n}=zi(),o=pl(t,i,r.scale),a=n(o.pixelWidth,o.pixelHeight),s=a.getContext("2d");s.scale(o.pixelRatio,o.pixelRatio),r.background!=="transparent"&&wl(s,o.width,o.height);let c=Array.isArray(e)?e:[],l={images:r.images,imageMetadata:r.imageMetadata,tints:new Map};return xl({canvas:a,ctx:s,x:0,y:0},Fs(c),o,l),{data:ml(a),width:o.width,height:o.height,pixelWidth:o.pixelWidth,pixelHeight:o.pixelHeight}}function xd(e){if(e.renderMatrix){let t=Ie(e.renderMatrix,e.centerX,e.centerY);return{kind:e.kind,width:e.width,height:e.height,matrix:{...e.renderMatrix,tx:t.x,ty:t.y}}}return{kind:e.kind,left:W(e.renderLeft,e.left),bottom:W(e.renderBottom,e.bottom),width:Math.max(0,W(e.renderWidth,e.width)),height:Math.max(0,W(e.renderHeight,e.height)),rotationZ:W(e.renderRotationZ,e.rotationZ)}}function Or(e,t,i){let r=String(t||"");if(!r)return;e.font=`10px ${yi()}`,e.textAlign="center",e.textBaseline="middle";let n=e.measureText(r),o=Math.min(i-4,Math.max(24,n.width+8)),a=16;e.fillStyle="rgba(17,25,37,0.66)",e.fillRect(-o/2,-a/2,o,a),e.fillStyle="#e7edf5",e.fillText(r,0,0)}function Id(e,t,i,r,n){let o=xd(t);if(o.width<=0||o.height<=0)return;e.save(),gl(e,o,i);let a=-o.width/2,s=-o.height/2;if(t.kind==="image"){e.save();let c=Math.max(0,W(t.width,o.width)),l=Math.max(0,W(t.height,o.height));e.scale(c?o.width/c:1,l?o.height/l:1);let u=t.enableFill?yo(t,c,l):null;u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),vl(e,t,c,l,n),e.restore()}else if(t.kind==="textbox"||t.kind==="textwindow")yl(e,t,o.width,o.height);else if(t.kind==="button")bl(e,t,o.width,o.height),Or(e,t.name||Nr.button,o.width);else if(t.kind==="cursor")e.setLineDash([6,4]),e.strokeStyle="rgba(74,142,181,0.7)",e.fillStyle="rgba(74,142,181,0.1)",e.fillRect(a,s,o.width,o.height),e.strokeRect(a,s,o.width,o.height),Or(e,t.name||Nr.cursor,o.width);else if(t.kind==="grid"){e.strokeStyle="rgba(106,146,189,0.55)",e.strokeRect(a,s,o.width,o.height),e.beginPath();for(let c=20;c<o.width;c+=20)e.moveTo(a+c,s),e.lineTo(a+c,s+o.height);for(let c=20;c<o.height;c+=20)e.moveTo(a,s+c),e.lineTo(a+o.width,s+c);e.stroke(),Or(e,t.name||Nr.grid,o.width)}else t.kind!=="container"&&t.kind!=="server-container"?(e.setLineDash(t.kind==="reference"||t.kind==="animation"||t.kind==="fullscreen"?[4,4]:[]),e.strokeStyle="rgba(203,218,237,0.55)",e.strokeRect(a,s,o.width,o.height),Or(e,t.name||Nr[t.kind]||t.kind,o.width)):(e.strokeStyle="rgba(78,165,230,0.42)",e.strokeRect(a,s,o.width,o.height));t.id===r&&t.kind!=="container"&&t.kind!=="server-container"&&(e.setLineDash([]),e.strokeStyle="#61b9ff",e.lineWidth=2,e.strokeRect(a,s,o.width,o.height)),e.restore()}function Il(e,t={}){let{createCanvas:i}=zi(),r=e?.canvas||{},n=pl(r.width||1600,r.height||900,t.scale),o=i(n.pixelWidth,n.pixelHeight),a=o.getContext("2d");a.scale(n.pixelRatio,n.pixelRatio),wl(a,n.width,n.height,{checker:!0});let s=Array.isArray(e?.boxes)?e.boxes:[],c=e?.selectedId,l={images:t.images,imageMetadata:t.imageMetadata,tints:new Map};for(let u of s)!u||u.kind==="server-container"||u.visible===!1||Id(a,u,n.height,c,l);return{data:ml(o),page:e?.asset?.type==="client-control-template"?"UI\u63A7\u4EF6-\u5BA2\u6237\u7AEF":"UI \u7F16\u8F91",width:n.width,height:n.height,pixelWidth:n.pixelWidth,pixelHeight:n.pixelHeight}}import{closeSync as Cd,existsSync as Dr,openSync as kd,opendirSync as Ed,readSync as Ad,realpathSync as ei,statSync as kl}from"node:fs";import{basename as _d,dirname as Cl,isAbsolute as wo,join as Pd,relative as El,resolve as Gi}from"node:path";var Td="qxqy-simulator-save",Al=new Set(["node_modules",".git","dist",".dsh","coverage"]),Di=50,_l=4096,vo=(e,t)=>{let i=Number(process.env[e]);return Number.isSafeInteger(i)&&i>0?i:t},Rd=()=>({entries:vo("QXQY_SCAN_ENTRY_LIMIT",1e4),directories:vo("QXQY_SCAN_DIR_LIMIT",1e3),depth:vo("QXQY_SCAN_DEPTH_LIMIT",8)});function Mt(e=""){let t=Gi(String(e||process.cwd()));if(!Dr(t))throw new Error(`workspace does not exist: ${t}`);if(!kl(t).isDirectory())throw new Error(`workspace is not a directory: ${t}`);return ei(t)}function $i(e,t,i=!1){let r=El(e,t);if(!i&&!r||r.startsWith("..")||wo(r))throw new Error("path must stay inside the configured workspace");return r}function Te(e,t){let i=String(t||"").trim();if(!i||wo(i))throw new Error("path must be a non-empty workspace-relative path");let r=ei(Gi(e)),n=Gi(r,i);if($i(r,n),!Dr(n))throw new Error(`file does not exist: ${i}`);let o=ei(n);return $i(r,o),o}function xe(e,t){let i=String(t||"").trim();if(!i||wo(i))throw new Error("path must be a non-empty workspace-relative path");let r=ei(Gi(e)),n=Gi(r,i);$i(r,n);let o=Cl(n);for(;!Dr(o);){let a=Cl(o);if(a===o)throw new Error("unable to resolve output directory");o=a}return $i(r,ei(o),!0),Dr(n)&&$i(r,ei(n)),n}function Md(e,t=_l){let i=Buffer.alloc(t),r=kd(e,"r");try{let n=Ad(r,i,0,t,0);return i.subarray(0,n).toString("utf8")}finally{Cd(r)}}function Pl(e,t,i,r,n){let o=n.limits;if(r>o.depth){n.depthLimitedDirectories+=1;return}if(n.scannedDirectories>=o.directories){n.directoryLimitReached=!0;return}let a;try{n.scannedDirectories+=1,a=Ed(e)}catch{n.unreadableEntries+=1;return}try{let s;for(;s=a.readSync();){if(n.scannedEntries>=o.entries){n.entryLimitReached=!0;return}if(n.scannedEntries+=1,s.name.startsWith(".")||s.isDirectory()&&Al.has(s.name)){n.skippedEntries+=1,s.isDirectory()&&(n.skippedDirectories+=1);continue}let c=Pd(e,s.name);if(s.isDirectory()){if(Pl(c,t,i,r+1,n),n.entryLimitReached||n.directoryLimitReached)return;continue}if(!(!s.isFile()||!/\.json$/i.test(s.name))){n.scannedJsonFiles+=1;try{let l=kl(c),u=Md(c);if(!u.includes(Td))continue;let f=u.match(/"name"\s*:\s*("(?:\\.|[^"\\])*")/)?.[1],h=_d(s.name,".json");if(f)try{h=JSON.parse(f)||h}catch{}i.push({path:El(t,c).replaceAll("\\","/"),name:h,bytes:l.size,mtime:l.mtimeMs})}catch{n.unreadableEntries+=1}}}}catch{n.unreadableEntries+=1}finally{try{a.closeSync()}catch{n.unreadableEntries+=1}}}function $r(e){let t=Mt(e),i=[],r={truncated:!1,warnings:[],scannedDirectories:0,scannedEntries:0,scannedJsonFiles:0,matchedArchives:0,skippedDirectories:0,skippedEntries:0,unreadableEntries:0,depthLimitedDirectories:0,entryLimitReached:!1,directoryLimitReached:!1,limits:{archives:Di,headBytes:_l,...Rd()},policy:{excludedDirectories:[...Al],hiddenEntries:!1,symlinks:!1,validatesJson:!1}};return Pl(t,t,i,0,r),i.sort((n,o)=>o.mtime-n.mtime||n.path.localeCompare(o.path)),r.matchedArchives=i.length,i.length>Di&&r.warnings.push(`\u53D1\u73B0 ${i.length} \u4E2A\u5B58\u6863\uFF0C\u4EC5\u663E\u793A\u4FEE\u6539\u65F6\u95F4\u6700\u65B0\u7684 ${Di} \u4E2A\uFF1B\u5176\u4ED6\u5B58\u6863\u53EF\u901A\u8FC7\u6307\u5B9A\u8DEF\u5F84\u6253\u5F00\u3002`),(r.entryLimitReached||r.directoryLimitReached)&&r.warnings.push(`\u81EA\u52A8\u53D1\u73B0\u8FBE\u5230\u626B\u63CF\u4E0A\u9650\uFF08${r.limits.entries} \u9879 / ${r.limits.directories} \u4E2A\u76EE\u5F55\uFF09\uFF0C\u5217\u8868\u53EF\u80FD\u4E0D\u5B8C\u6574\uFF1B\u53EF\u901A\u8FC7\u6307\u5B9A\u8DEF\u5F84\u6253\u5F00\u5B58\u6863\u3002`),r.depthLimitedDirectories&&r.warnings.push(`\u81EA\u52A8\u53D1\u73B0\u8DF3\u8FC7 ${r.depthLimitedDirectories} \u4E2A\u8D85\u8FC7 ${r.limits.depth} \u5C42\u7684\u76EE\u5F55\uFF1B\u53EF\u901A\u8FC7\u6307\u5B9A\u8DEF\u5F84\u6253\u5F00\u5176\u4E2D\u7684\u5B58\u6863\u3002`),r.skippedEntries&&r.warnings.push("\u81EA\u52A8\u53D1\u73B0\u8DF3\u8FC7\u9690\u85CF\u9879\u53CA\u751F\u6210\u76EE\u5F55\uFF08\u5982 node_modules\u3001dist\uFF09\uFF1B\u53EF\u901A\u8FC7\u6307\u5B9A\u8DEF\u5F84\u6253\u5F00\u5176\u4E2D\u7684\u5B58\u6863\u3002"),r.unreadableEntries&&r.warnings.push(`\u81EA\u52A8\u53D1\u73B0\u65E0\u6CD5\u8BFB\u53D6 ${r.unreadableEntries} \u4E2A\u6587\u4EF6\u6216\u76EE\u5F55\uFF1B\u8BF7\u68C0\u67E5\u8BBF\u95EE\u6743\u9650\uFF0C\u6216\u901A\u8FC7\u6307\u5B9A\u8DEF\u5F84\u67E5\u770B\u5177\u4F53\u9519\u8BEF\u3002`),r.truncated=i.length>Di||r.entryLimitReached||r.directoryLimitReached||r.depthLimitedDirectories>0,{bound:!0,workspace:t,archives:i.slice(0,Di),discovery:r}}import{readFileSync as Nd}from"node:fs";import{homedir as Fd}from"node:os";import{join as Od}from"node:path";var zd={"zh-cn":"LanguageChs",chs:"LanguageChs","zh-tw":"LanguageCht",cht:"LanguageCht",en:"LanguageEng","en-us":"LanguageEng",eng:"LanguageEng",ja:"LanguageJpn","ja-jp":"LanguageJpn",jp:"LanguageJpn",ko:"LanguageKor","ko-kr":"LanguageKor",kr:"LanguageKor",fr:"LanguageFra",fra:"LanguageFra",de:"LanguageDeu",deu:"LanguageDeu",es:"LanguageSpa",spa:"LanguageSpa",pt:"LanguagePor",por:"LanguagePor",ru:"LanguageRus",rus:"LanguageRus",th:"LanguageTha",tha:"LanguageTha",vi:"LanguageVie",vie:"LanguageVie",id:"LanguageInd",ind:"LanguageInd",tr:"LanguageTur",tur:"LanguageTur",it:"LanguageIta",ita:"LanguageIta"};function Dd(e){let i=[...String(e||"").matchAll(/Request to set language:([A-Za-z0-9_-]+)/g)].at(-1)?.[1]?.toLowerCase();return zd[i]||null}function $d(){return Od(Fd(),"AppData","LocalLow","miHoYo","\u539F\u795E","output_log.txt")}function Tl(e=$d()){try{return Dd(Nd(e,"utf8"))}catch{return null}}import{existsSync as Io,lstatSync as Gd,mkdirSync as Rl,readFileSync as Gr,readdirSync as Vd,realpathSync as Ml,renameSync as Bd,rmSync as Yd,statSync as Yr,writeFileSync as Nl}from"node:fs";import{createHash as Ld,randomUUID as Fl}from"node:crypto";import{homedir as jd}from"node:os";import{basename as Hd,dirname as Vr,isAbsolute as Ud,join as Br,relative as Xd}from"node:path";var De=e=>Ld("sha256").update(e).digest("hex"),So=e=>Io(e)?De(Gr(e)):null,xo=(e,t)=>{let i=Xd(e,t);return!Ud(i)&&i!==".."&&!i.startsWith(`..${process.platform==="win32"?"\\":"/"}`)};function Ol(e,t){let i=xe(e,t),r=i;for(;r!==e;){try{if(Gd(r).isSymbolicLink())throw new Error("\u5B9E\u673A\u76EE\u6807\u4E0D\u80FD\u5305\u542B\u7B26\u53F7\u94FE\u63A5\u6216\u76EE\u5F55\u8054\u63A5")}catch(n){if(n.code!=="ENOENT")throw n}r=Vr(r)}if(Io(i)&&!Yr(i).isFile())throw new Error("\u5B9E\u673A\u76EE\u6807\u4E0D\u662F\u666E\u901A\u6587\u4EF6");return i}function zl(e=Br(jd(),"AppData","LocalLow","miHoYo","\u539F\u795E","BeyondLocal")){let t=r=>{try{return Vd(r,{withFileTypes:!0}).filter(n=>n.isDirectory()&&/^\d+$/.test(n.name)).map(n=>n.name)}catch{return[]}},i=[];for(let r of t(e)){let n=Br(e,r,"Beyond_Local_Save_Level");for(let o of t(n)){let a=Br(n,o,"external_lua_file","default_import_file");Io(a)&&Yr(a).isDirectory()&&i.push({uid:r,editorId:o,path:a})}}return{candidates:i}}var Lr=class{constructor(t){this.controller=t,this.plan=null,this.lastResult=null}preview(){let t=this.controller,i=t.studio.archiveData(),r=hi(i.scriptSync);if(!r)throw new Error("\u8BF7\u5148\u914D\u7F6E\u5B9E\u673A\u811A\u672C\u76EE\u5F55");let n=Ml(t.activeWorkspacePath()),o=Ml(r.clientImportRoot);if(!Yr(o).isDirectory())throw new Error("\u5B9E\u673A\u5BFC\u5165\u6839\u76EE\u5F55\u4E0D\u5B58\u5728");let a=r.workspaceDir?Te(n,r.workspaceDir):n;if(!Yr(a).isDirectory())throw new Error("\u5DE5\u4F5C\u533A\u811A\u672C\u76EE\u5F55\u4E0D\u5B58\u5728");if(xo(a,o)||xo(o,a))throw new Error("\u5DE5\u4F5C\u533A\u811A\u672C\u76EE\u5F55\u4E0E\u5B9E\u673A\u76EE\u5F55\u4E0D\u80FD\u91CD\u53E0");let s=new Map,c=i.assets.scripts.map(u=>{let f={id:u.id,path:u.path,sourceKind:u.source.trim()?"\u5B58\u6863\u6E90\u7801":"\u5DE5\u4F5C\u533A\u6587\u4EF6"};try{let h=Ji(u.path);if(!/\.lua$/i.test(h))throw new Error("\u811A\u672C\u8DEF\u5F84\u5FC5\u987B\u4EE5 .lua \u7ED3\u5C3E");let p=r.workspaceDir?`${r.workspaceDir}/`:"";if(!h.startsWith(p))throw new Error("\u811A\u672C\u4E0D\u5728\u6240\u914D\u7F6E\u7684\u5DE5\u4F5C\u533A\u811A\u672C\u76EE\u5F55\u4E2D");let m=[r.clientSubdir,h.slice(p.length)].filter(Boolean).join("/"),y=Ol(o,m),I=y.toLowerCase();s.set(I,(s.get(I)||0)+1);let b=null,v="";try{b=Gr(Te(n,h),"utf8")}catch(F){v=F.message}if(!u.source.trim()&&b===null)throw new Error(v);let P=u.source.trim()?u.source:b,R=So(y);return{...f,target:y,targetRelative:m,source:P,diskSource:b,diskError:v,sourceMismatch:!!(u.source.trim()&&b!==null&&u.source!==b),beforeSource:R===null?"":Gr(y,"utf8"),beforeHash:R,sourceHash:De(P),status:R===null?"\u65B0\u589E":R===De(P)?"\u672A\u53D8\u5316":"\u8986\u76D6"}}catch(h){return{...f,status:"\u9519\u8BEF",error:h.message}}});for(let u of c)u.target&&s.get(u.target.toLowerCase())>1&&(u.status="\u9519\u8BEF",u.error="\u591A\u4E2A\u811A\u672C\u6620\u5C04\u5230\u540C\u4E00\u76EE\u6807\u6587\u4EF6");let l=De(JSON.stringify({archive:i,workspace:n,root:o,rows:c}));return this.plan={id:Fl(),fingerprint:l,root:o,workspace:n,rows:c,pendingGuidChanges:i.controlGuidChanges.length,createdAt:new Date().toISOString()},this.plan}apply({planId:t,scriptIds:i,confirmed:r}){let n=this.plan;if(r!==!0||!n||n.id!==t)throw new Error("\u8BF7\u5148\u68C0\u67E5\u5DEE\u5F02\u5E76\u786E\u8BA4\u672C\u6B21\u590D\u5236");let o=this.preview();if(this.plan=null,o.fingerprint!==n.fingerprint)throw new Error("\u5185\u5BB9\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5");if(n.pendingGuidChanges)throw new Error("\u8BF7\u5148\u6838\u5BF9\u5E76\u786E\u8BA4\u63A7\u4EF6\u7D22\u5F15\u7684 Lua \u5F15\u7528\u53D8\u66F4");if(!Array.isArray(i)||!i.length||new Set(i).size!==i.length)throw new Error("\u8BF7\u9009\u62E9\u8981\u590D\u5236\u7684\u811A\u672C");let a=i.map(u=>{let f=n.rows.find(h=>h.id===u);if(!f||f.error||f.status==="\u672A\u53D8\u5316")throw new Error("\u6240\u9009\u811A\u672C\u4E0D\u80FD\u590D\u5236\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5");return f});this.controller.assertSavedArchive();let s=`.qxqy-script-sync-backups/${n.id}`,c=xe(n.workspace,s);if(xo(n.root,c))throw new Error("\u5907\u4EFD\u76EE\u5F55\u4E0D\u80FD\u4F4D\u4E8E\u5B9E\u673A\u811A\u672C\u76EE\u5F55\u4E2D");let l=[];for(let u of a){let f="";try{let h=Ol(n.root,u.targetRelative);if(So(h)!==u.beforeHash)throw new Error("\u76EE\u6807\u6587\u4EF6\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5");if(u.beforeHash!==null){let p=xe(n.workspace,`${s}/${u.targetRelative}`);Rl(Vr(p),{recursive:!0}),Nl(p,Gr(h),{flag:"wx"})}if(Rl(Vr(h),{recursive:!0}),f=Br(Vr(h),`.${Hd(h)}.${Fl()}.tmp`),Nl(f,u.source,{flag:"wx"}),So(h)!==u.beforeHash)throw new Error("\u76EE\u6807\u6587\u4EF6\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5");Bd(f,h),l.push({id:u.id,target:h,status:"\u6210\u529F"})}catch(h){l.push({id:u.id,target:u.target,status:"\u5931\u8D25",error:h.message})}finally{f&&Yd(f,{force:!0})}}return this.lastResult={completed:l.every(u=>u.status==="\u6210\u529F"),at:new Date().toISOString(),backupRoot:c,results:l},this.lastResult}};import{createHash as Wd,randomUUID as Kd}from"node:crypto";import{mkdir as qd,open as Jd,readFile as Qd,rename as Zd,rm as Co,stat as eh,writeFile as th}from"node:fs/promises";import{homedir as ko}from"node:os";import{join as ti,resolve as ih}from"node:path";import{setTimeout as rh}from"node:timers/promises";var Eo=e=>Wd("sha256").update(e).digest("hex");function jr(e){return ti(process.platform==="win32"?process.env.LOCALAPPDATA||ti(ko(),"AppData","Local"):process.platform==="darwin"?ti(ko(),"Library","Caches"):process.env.XDG_CACHE_HOME||ti(ko(),".cache"),"beyond-simulator",e)}var dt=class{constructor({cacheDir:t,source:i,version:r,extension:n,accepts:o,fetch:a=globalThis.fetch,timeout:s=12e3}){this.directory=ti(ih(t),r,Eo(i).slice(0,12)),Object.assign(this,{source:i,extension:n,accepts:o,fetcher:a,timeout:s}),this.pending=new Map,this.failures=new Map,this.active=0,this.waiters=[]}async limited(t){this.active>=4?await new Promise(i=>this.waiters.push(i)):this.active++;try{return await t()}finally{let i=this.waiters.shift();i?i():this.active--}}async download(t,i,r,n){let o=await this.fetcher(new URL(t,this.source),{signal:r,redirect:"error",cache:n?"no-cache":"default"});if(!o.ok)throw Object.assign(new Error(`Asset source returned HTTP ${o.status}`),{status:o.status});if(Number(o.headers.get("content-length"))>i)throw new Error("Asset response too large");let a=[],s=0;for await(let c of o.body){if(s+=c.length,s>i)throw new Error("Asset response too large");a.push(c)}return Buffer.concat(a)}async cached(t){try{let i=await Qd(t);return{data:i,...await this.decode(i),etag:`"${Eo(i)}"`}}catch(i){if(i.code==="ENOENT")return null;if(i.code==="EACCES"||i.code==="EPERM")throw i;return null}}async load(t,i=!1){let r=ti(this.directory,`${t}.${this.extension}`),n=!i&&await this.cached(r);if(n)return n;await qd(this.directory,{recursive:!0});let o=`${r}.lock`,a=Date.now()+3e4,s;for(;!s;)try{s=await Jd(o,"wx")}catch(l){if(l.code!=="EEXIST")throw l;let u=!i&&await this.cached(r);if(u)return u;try{Date.now()-(await eh(o)).mtimeMs>6e4&&await Co(o,{force:!0})}catch(f){if(f.code!=="ENOENT")throw f}if(Date.now()>a)throw new Error("Timed out waiting for asset cache writer");await rh(80)}let c=`${r}.${Kd()}.tmp`;try{let l=!i&&await this.cached(r);if(l)return l;let u=new AbortController,f=setTimeout(()=>u.abort(),this.timeout),h;try{h=await this.produce(t,u.signal,i)}finally{clearTimeout(f),u.abort()}let p=await this.decode(h);return await th(c,h,{flag:"wx"}),await Zd(c,r),{data:h,...p,etag:`"${Eo(h)}"`}}finally{try{await Co(c,{force:!0})}finally{await s.close(),await Co(o,{force:!0})}}}get(t,{refresh:i=!1}={}){if(!this.accepts(t))return Promise.reject(Object.assign(new Error("Asset ID is not in the preview allowlist"),{status:404}));if(this.pending.has(t))return this.pending.get(t);let r=this.failures.get(t);if(!i&&r&&r.until>Date.now())return Promise.reject(r.error);let n=this.limited(()=>this.load(t,i)).then(o=>(this.failures.delete(t),o),o=>{throw i||this.failures.set(t,{until:Date.now()+6e4,error:o}),o}).finally(()=>this.pending.delete(t));return this.pending.set(t,n),n}async refresh(t){if(!this.accepts(t))throw Object.assign(new Error("Asset ID is not in the preview allowlist"),{status:404});return await this.pending.get(t)?.catch(()=>{}),this.failures.delete(t),this.get(t,{refresh:!0})}};import{createHash as nh}from"node:crypto";import{createCanvas as oh,loadImage as Dl}from"@napi-rs/canvas";var Hr=class extends dt{constructor({cacheDir:t,source:i=Hi,fetch:r=globalThis.fetch}){super({cacheDir:t,source:i,fetch:r,version:"border-v1",extension:"json",accepts:n=>it(n)})}decode(t){let i=JSON.parse(t.toString("utf8"));if(i!==null&&(typeof i!="object"||Array.isArray(i)))throw new Error("Invalid image metadata");let r=fl(i);return{raw:i,meta:r}}async produce(t,i,r){try{return await this.download(`border/${t}.json`,128*1024,i,r)}catch(n){if(n.status===404)return Buffer.from("null");throw n}}};var _o=20*1024*1024,ah=Buffer.from("89504e470d0a1a0a","hex");function $l(e,t){return t.throwIfAborted(),new Promise((i,r)=>{let n=()=>r(t.reason);t.addEventListener("abort",n,{once:!0}),e.then(i,r).finally(()=>t.removeEventListener("abort",n))})}function sh(){return process.env.QXQY_IMAGE_CACHE_DIR||jr("images")}function Ao(e){if(e.length<24||e.length>_o||!e.subarray(0,8).equals(ah))throw new Error("Invalid sprite PNG");let t=e.readUInt32BE(16),i=e.readUInt32BE(20);if(!t||!i||t>8192||i>8192||t*i>16777216)throw new Error("Sprite PNG exceeds pixel limit")}var Po=class e extends dt{constructor({cacheDir:t=sh(),fetch:i=globalThis.fetch,source:r,imageSource:n="StaticReference"}={}){let o=ke(n);if(!["StaticReference","Prefab"].includes(o))throw new Error(`Unsupported image source: ${o}`);super({cacheDir:t,fetch:i,source:r||(o==="Prefab"?$o:Hi),version:o==="Prefab"?fi:Jr,extension:"png",accepts:a=>it(a,o)}),this.imageSource=o,this.cacheDir=t,this.prefabStore=null,this.metadataStore=null}forSource(t){let i=ke(t);if(i===this.imageSource)return this;if(i==="Prefab"&&this.imageSource==="StaticReference")return this.prefabStore||=new e({cacheDir:this.cacheDir,imageSource:"Prefab",fetch:(...r)=>this.fetcher(...r)});throw Object.assign(new Error(`Unsupported image source: ${i}`),{status:404})}get(t,{imageSource:i=this.imageSource,...r}={}){try{let n=this.forSource(i);return n===this?super.get(t,r):n.get(t,r)}catch(n){return Promise.reject(n)}}refresh(t,{imageSource:i=this.imageSource}={}){try{let r=this.forSource(i);return r===this?super.refresh(t):r.refresh(t)}catch(r){return Promise.reject(r)}}async decode(t){return Ao(t),{image:await Dl(t)}}metadata(t,{imageSource:i=this.imageSource,refresh:r=!1}={}){try{let n=this.forSource(i);if(n!==this)return n.metadata(t,{refresh:r});if(!this.accepts(t))throw Object.assign(new Error("Image ID is not in the preview allowlist"),{status:404});return this.imageSource==="Prefab"?Promise.resolve({meta:null,raw:null}):(this.metadataStore||=new Hr({cacheDir:this.cacheDir,source:this.source,fetch:(...o)=>this.fetcher(...o)}),r?this.metadataStore.refresh(t):this.metadataStore.get(t))}catch(n){return Promise.reject(n)}}async produce(t,i,r){if(this.imageSource==="Prefab"){let c=await this.download(`sprite/${t}.png`,_o,i,r);Ao(c);let l=ji(t);if(c.readUInt32BE(16)!==l||c.readUInt32BE(20)!==l)throw new Error("Prefab PNG does not match catalog dimensions");return c}let[n,o]=await Promise.all([this.download(`sprite/${t}.png`,_o,i,r),this.metadata(t,{refresh:r})]);Ao(n);let a=await Dl(n),s=o.raw?sl(a,o.raw,oh):a;return o.raw?Buffer.from(s.toBuffer("image/png")):n}async prepare(t,i){let r=new Map,n=new Map,o=[],a=[...new Map((t||[]).filter(u=>u.kind==="image"&&u.visible!==!1&&it(u.imageId,u.imageSource)).map(u=>[Xi(u.imageId,u.imageSource),{imageId:u.imageId,imageSource:ke(u.imageSource)}])).entries()];i?.throwIfAborted();let s=AbortSignal.timeout(45e3),c=i?AbortSignal.any([i,s]):s,l=0;await Promise.all(Array.from({length:Math.min(4,a.length)},async()=>{for(;l<a.length&&!c.aborted;){let[u,f]=a[l++];try{let h=await $l(this.get(f.imageId,f),c);r.set(u,h.image);let p=await $l(this.metadata(f.imageId,f),c);n.set(u,p.meta)}catch(h){o.push({...f,error:h.message})}}}));for(let[,u]of a.slice(l))o.push({...u,error:"Image preparation timed out"});return i?.throwIfAborted(),{images:r,imageMetadata:n,warnings:o}}},lh;function Vi(){return lh||=new Po}async function Gl(e,t,i=Vi()){let r=new URL(e.url,"http://localhost");if(r.pathname!==Ui.slice(0,-1)&&!r.pathname.startsWith(Ui))return!1;try{if(!["GET","HEAD"].includes(e.method))throw Object.assign(new Error("GET or HEAD required"),{status:405});let n=r.pathname.match(new RegExp(`^${Ui}(${Jr}|${fi})/([0-9]+)\\.(png|json)$`));if(!n)throw Object.assign(new Error("Unknown image resource"),{status:404});let o={imageSource:n[1]===fi?"Prefab":"StaticReference"};if(n[3]==="json"){let{meta:c}=await i.metadata(Number(n[2]),o),l=JSON.stringify(c),u=`"${nh("sha256").update(l).digest("hex")}"`,f={"content-type":"application/json; charset=utf-8","cache-control":"private, max-age=43200",etag:u,"x-content-type-options":"nosniff"};return e.headers["if-none-match"]===u?(t.writeHead(304,f),t.end()):(t.writeHead(200,f),t.end(e.method==="HEAD"?void 0:l)),!0}let a=await i.get(Number(n[2]),o),s={"content-type":"image/png","cache-control":"private, max-age=43200",etag:a.etag,"x-content-type-options":"nosniff"};e.headers["if-none-match"]===a.etag?(t.writeHead(304,s),t.end()):(t.writeHead(200,{...s,"content-length":a.data.length}),t.end(e.method==="HEAD"?void 0:a.data))}catch(n){t.writeHead(n.status||502,{"content-type":"text/plain; charset=utf-8","cache-control":"no-store","x-content-type-options":"nosniff"}),t.end(e.method==="HEAD"?void 0:n.message)}return!0}import{existsSync as ch,mkdirSync as Vl,readFileSync as uh,renameSync as fh,rmSync as dh,writeFileSync as To}from"node:fs";import{randomUUID as Ll}from"node:crypto";import{dirname as Bl,join as hh}from"node:path";function Yl(e,t){let i=`${e}.${Ll()}.tmp`;try{To(i,t,{flag:"wx"}),fh(i,e)}finally{dh(i,{force:!0})}}var Ur=class{constructor(t){this.controller=t,this.plan=null}inspect(){let t=this.controller.studio.archiveData(),i=t.controlGuidChanges||[],r=t.assets.scripts,n=[],o=new Map;i.length||n.push("\u6CA1\u6709\u5F85\u540C\u6B65\u7684\u7D22\u5F15\u53D8\u66F4");try{o=il(i)}catch(u){n.push(u.message)}let a=this.controller.activeWorkspacePath();a||n.push("\u8BF7\u5148\u7ED1\u5B9A\u5DE5\u4F5C\u533A\uFF0C\u4EE5\u4FDD\u5B58\u540C\u6B65\u524D\u7684\u5907\u4EFD");let s=new Map,c=r.map(u=>{let f={id:u.id,path:u.path,source:u.source,file:"",fileBefore:null,edits:[],issues:[]};if(u.path)try{if(!a)throw new Error("\u5DE5\u4F5C\u533A\u5C1A\u672A\u7ED1\u5B9A\uFF0C\u65E0\u6CD5\u6838\u5BF9\u9879\u76EE\u811A\u672C\u6587\u4EF6");let p=xe(a,u.path);if(ch(p)){f.file=Te(a,u.path);let m=uh(f.file);if(f.fileBefore=m.toString("utf8"),!m.equals(Buffer.from(f.fileBefore)))throw new Error("\u9879\u76EE\u811A\u672C\u4E0D\u662F\u6709\u6548 UTF-8\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6838\u5BF9\u7F16\u7801");if(u.source.trim()&&f.fileBefore!==u.source)throw new Error("\u5B58\u6863\u6E90\u7801\u4E0E\u9879\u76EE\u6587\u4EF6\u4E0D\u540C\uFF0C\u8BF7\u4EA4\u7ED9 AI \u5408\u5E76\u540E\u540C\u6B65");if(u.source.trim()||(f.source=f.fileBefore),s.has(f.file))throw new Error("\u591A\u4E2A\u811A\u672C\u6307\u5411\u540C\u4E00\u4E2A\u9879\u76EE\u6587\u4EF6\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6838\u5BF9");s.set(f.file,u.id)}}catch(p){f.issues.push({line:0,reason:p.message})}!f.source.trim()&&u.path&&!f.file&&f.issues.push({line:0,reason:"\u627E\u4E0D\u5230\u6B64\u811A\u672C\u7684\u6E90\u7801\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6838\u5BF9\u6587\u4EF6\u8DEF\u5F84"});let h=rl(f.source,o);return f.source=h.source,f.edits=h.edits,f.issues.push(...h.issues),f}),l=De(JSON.stringify({archive:t,files:c.map(u=>[u.file,u.fileBefore])}));return{archive:t,rows:c,issues:n,fingerprint:l}}preview(){let t=this.inspect();return t.id=Ll(),this.plan=t,{id:t.id,canApply:!t.issues.length&&t.rows.every(i=>!i.issues.length),issues:t.issues,changes:t.archive.controlGuidChanges.length,replacements:t.rows.reduce((i,r)=>i+r.edits.length,0),rows:t.rows.map(({id:i,path:r,file:n,edits:o,issues:a})=>({id:i,path:r,file:n,edits:o,issues:a}))}}apply({planId:t,expectedRevision:i}){let r=this.plan;if(!r||r.id!==t)throw new Error("\u8BF7\u5148\u9884\u89C8 Lua \u7D22\u5F15\u540C\u6B65");if(i!==this.controller.get().version)throw new Error("revision conflict: \u8BF7\u91CD\u65B0\u9884\u89C8");if(this.inspect().fingerprint!==r.fingerprint)throw new Error("\u6E90\u7801\u3001\u6587\u4EF6\u6216\u7D22\u5F15\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u9884\u89C8");if(r.issues.length||r.rows.some(f=>f.issues.length))throw new Error("\u6E90\u7801\u6587\u4EF6\u6216\u7D22\u5F15\u6620\u5C04\u5B58\u5728\u51B2\u7A81\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6838\u5BF9\uFF1B\u672C\u6B21\u6CA1\u6709\u4FEE\u6539\u811A\u672C");let o=Oi(r.archive);for(let f of r.rows.filter(h=>h.edits.length))o.patch({op:"updateScript",id:f.id,source:f.source});o.patch({op:"acknowledgeControlGuidChanges",changeIds:r.archive.controlGuidChanges.map(f=>f.id)});let a=Buffer.from(JSON.stringify(o.archiveData())).toString("base64"),s=r.rows.filter(f=>f.edits.length&&f.file),c=this.controller.activeWorkspacePath(),l=s.length?xe(c,`.qxqy-guid-sync-backups/${r.id}`):"",u=[];try{for(let h of s){let p=hh(l,`${h.id}.lua`);Vl(Bl(p),{recursive:!0}),To(p,h.fileBefore,{flag:"wx"})}let f=xe(c,`.qxqy-guid-sync-backups/${r.id}/before.save.json`);Vl(Bl(f),{recursive:!0}),To(f,JSON.stringify(r.archive),{flag:"wx"});for(let h of s)Yl(h.file,h.source),u.push(h);this.controller.studio.importData("json",a)}catch(f){let h=[];for(let p of u.reverse())try{Yl(p.file,p.fileBefore)}catch{h.push(p.file)}throw this.plan=null,new Error(`${f.message}${h.length?`\uFF1B\u56DE\u6EDA\u5931\u8D25\uFF0C\u8BF7\u4ECE ${l} \u6062\u590D\uFF1A${h.join("\u3001")}`:"\uFF1B\u5B58\u6863\u672A\u63D0\u4EA4\uFF0C\u5DF2\u5199\u5165\u7684\u9879\u76EE\u6587\u4EF6\u5DF2\u56DE\u6EDA"}`)}return this.plan=null,{...this.controller.get(),controlGuidSyncResult:{replacements:r.rows.reduce((f,h)=>f+h.edits.length,0),scripts:r.rows.filter(f=>f.edits.length).length,projectFiles:s.length,backupRoot:`.qxqy-guid-sync-backups/${r.id}`}}}};var wh=Math.max(1e3,Number(process.env.QXQY_PLAY_TIMEOUT_MS)||8e3),Sh=8e3;function jl(){let e=new Error("operation aborted");return e.name="AbortError",e}function Mo(e){if(e!=="manual"&&e!=="realtime")throw new Error("clockMode must be manual or realtime");return e}var ii=class{constructor(t="",{imageAssets:i=Vi(),clockMode:r="realtime"}={}){Ke(),this.workspacePath=t?Mt(t):"",this.studio=Oi(void 0,this.workspacePath?{workspacePath:this.workspacePath}:void 0),this.worker=null,this.pending=new Map,this.sequence=1,this.lock=Promise.resolve(),this.archivePath="",this.archiveStamp="",this.savedArchive="",this.scriptSync=new Lr(this),this.controlGuidSync=new Ur(this),this.imageAssets=i,this.defaultClockMode=Mo(r),this.playClockMode=this.defaultClockMode}async exclusive(t){let i=this.lock,r;this.lock=new Promise(n=>{r=n}),await i;try{return await t()}finally{r()}}get(){return{...this.studio.get(),storage:{path:this.archivePath}}}scriptSyncAction(t,i={}){if(t==="discover")return zl();if(t==="status")return{config:this.get().scriptSync,lastResult:this.scriptSync.lastResult};if(t==="configure"){if(!Number.isInteger(i.expectedRevision))throw new Error("expectedRevision is required");return this.patch({op:"setScriptSync",config:i.config,expectedRevision:i.expectedRevision})}if(t==="preview")return this.scriptSync.preview();throw new Error("unknown script sync action (AI \u53EF\u914D\u7F6E\u548C\u9884\u89C8\uFF1B\u590D\u5236\u9700\u5728\u7F16\u8F91\u5668\u4E2D\u786E\u8BA4)")}assertSavedArchive(){if(!this.archivePath||this.savedArchive!==JSON.stringify(this.studio.archiveData()))throw new Error("\u8BF7\u5148\u4FDD\u5B58\u5F53\u524D\u5B8C\u6574\u5B58\u6863\uFF0C\u518D\u786E\u8BA4\u590D\u5236");let t=Te(this.activeWorkspacePath(),this.archivePath);if(De(Ro(t))!==this.archiveStamp)throw new Error("\u5B58\u6863\u6587\u4EF6\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u52A0\u8F7D\u5E76\u68C0\u67E5")}saveForScriptSync(t,i){if(i!==this.get().version)throw new Error("revision conflict: reload before saving");let r=xe(this.activeWorkspacePath(),t);if(mh(r)){let n=this.archivePath?xe(this.activeWorkspacePath(),this.archivePath):"";if(r!==n||De(Ro(r))!==this.archiveStamp)throw new Error("File changed or already exists; load it again or save under a new path")}return this.saveArchive(t)}patch(t){return t?.op==="previewControlGuidSync"?{...this.get(),controlGuidSyncPreview:this.controlGuidSync.preview()}:t?.op==="syncControlGuidReferences"?this.controlGuidSync.apply(t):{...this.studio.patch(t),storage:{path:this.archivePath}}}listArchives(){return $r(this.workspacePath)}loadArchive(t){let i=this.activeWorkspacePath();if(!i)throw new Error("workspace is not bound");let r=Te(i,t),n=Ro(r),o=this.studio.importData("json",n.toString("base64"),bh(r));return this.archivePath=String(t).trim().replaceAll("\\","/"),this.archiveStamp=De(n),this.savedArchive=JSON.stringify(this.studio.archiveData()),o}saveArchive(t=this.archivePath||"qxqy-simulator.save.json"){let i=String(t).trim(),r=this.activeWorkspacePath();if(!r)throw new Error("workspace is not bound");let n=xe(r,i);gh(vh(n),{recursive:!0});let o=Buffer.from(JSON.stringify(this.studio.archiveData(),null,2)+`
|
|
115
|
-
`,"utf8");return yh(n,o),this.archivePath=i.replaceAll("\\","/"),this.archiveStamp=De(o),this.savedArchive=JSON.stringify(this.studio.archiveData()),{path:this.archivePath,bytes:o.length,revision:this.studio.get().version,name:this.studio.get().save?.name||""}}activeWorkspacePath(){let t=this.studio.get().workspace;return t?.bound&&t.path?String(t.path):this.workspacePath}createWorker(){let t=new ph(new URL("./worker.js",import.meta.url),{type:"module",workerData:{localFont:Ke()?.data??null}});return t.on("message",i=>{let r=this.pending.get(i?.id);r&&(this.pending.delete(i.id),i.ok?r.resolve(i.value):r.reject(new Error(i.error||"play worker failed")))}),t.on("error",i=>{this.worker===t&&(this.worker=null),this.rejectPending(i)}),t.on("exit",i=>{this.worker===t&&(this.worker=null),i!==0&&this.rejectPending(new Error(`play worker exited with code ${i}`))}),this.worker=t,t}rejectPending(t){for(let i of this.pending.values())i.reject(t);this.pending.clear()}async terminateWorker(t=new Error("play worker terminated")){let i=this.worker;this.worker=null,this.rejectPending(t),i&&await i.terminate().catch(()=>{})}request(t,i,r,n=wh){let o=this.worker||this.createWorker(),a=this.sequence++;return new Promise((s,c)=>{let l=!1,u=(p,m)=>{l||(l=!0,clearTimeout(h),r?.removeEventListener("abort",f),p(m))},f=()=>{this.pending.delete(a),u(c,jl()),this.terminateWorker(jl())},h=setTimeout(()=>{this.pending.delete(a);let p=new Error(`play worker timed out after ${n}ms`);u(c,p),this.terminateWorker(p)},n);if(this.pending.set(a,{resolve:p=>u(s,p),reject:p=>u(c,p)}),r?.aborted)return f();r?.addEventListener("abort",f,{once:!0}),o.postMessage({id:a,action:t,args:i})})}async play(t,i={},r){if((t==="start"||t==="device")&&!i.language){let n=Tl();n&&(i={...i,language:n})}if(t==="start"){let n=Mo(i.clockMode??this.defaultClockMode);return await this.terminateWorker(),this.playClockMode=n,this.request("start",{archive:this.studio.archiveData(),workspacePath:this.activeWorkspacePath(),...i,clockMode:n},r)}if(t==="device"){let n=String(i.canvasId||"").trim();if(!K[n])throw new Error(`unknown canvas preset: ${n||"(empty)"} (available: ${Object.keys(K).join(", ")})`);let o=Mo(i.clockMode??this.playClockMode);return await this.terminateWorker(),this.playClockMode=o,this.request("start",{archive:this.studio.archiveData(),workspacePath:this.activeWorkspacePath(),...i,canvasId:n,clockMode:o},r)}if(t==="stop"){if(!this.worker)return{running:!1,tree:[],logs:[]};try{return await this.request("stop",i,r)}finally{await this.terminateWorker()}}if(!this.worker)throw new Error("play session has not started");return this.request(t,i,r)}async playScreenshot(t){if(!this.worker)throw new Error("play session has not started");let i=await this.request("get",{view:!0},t,Sh),r=await this.imageAssets.prepare(i.scene?.nodes,t),n=Sl(i.scene,i.canvasWidth,i.canvasHeight,r);return{data:n.data,canvasId:String(i.canvasId||""),frame:Number.isFinite(Number(i.frame))?Number(i.frame):0,time:Number.isFinite(Number(i.time))?Number(i.time):0,clockMode:i.clockMode,width:n.width,height:n.height,pixelWidth:n.pixelWidth,pixelHeight:n.pixelHeight,assetWarnings:r.warnings}}async uiScreenshot(t){let i=this.studio.get(),r=await this.imageAssets.prepare(i.boxes,t),n=Il(i,r);return{data:n.data,page:n.page,width:n.width,height:n.height,pixelWidth:n.pixelWidth,pixelHeight:n.pixelHeight,assetWarnings:r.warnings}}async dispose(){await this.terminateWorker()}};var Ih=new Set(["server-control-template","client-control-template"]),Ch=new Set(["start","device","view","get","step","pointer","key","click","pause","resume","stop","serverGet","serverSet","serverSend","history","saveCase","runCase"]);function Hl(e){return String(e||"").trim().replaceAll("\\","/")}function Ul(e,t){let i=xh(Te(e,t));return`${i.size}:${i.mtimeMs}`}function kh(e){return{version:e.version,selectedId:e.selectedId,save:e.save,asset:e.asset,canvas:e.canvas,tree:e.tree,workspace:e.workspace,scriptCount:Array.isArray(e.scripts)?e.scripts.length:0}}function Xl(e,t,i){let r=i==="stop"||t?.running===!1,n=Array.isArray(t?.logs)?t.logs.slice(-100):e.logs;return{running:!r,paused:r?!1:!!t?.paused,canvasId:String(t?.canvasId||e.canvasId||""),width:Number(t?.canvasWidth||e.width||0),height:Number(t?.canvasHeight||e.height||0),frame:Number(t?.frame||0),time:Number(t?.time||0),logs:n}}var Xr=class{constructor({workspace:t,initialPath:i="",watchIntervalMs:r=700,discoveryIntervalMs:n=5e3,imageAssets:o}={}){this.workspace=Mt(t),this.controller=new ii(this.workspace,{imageAssets:o}),this.initialPath=Hl(i),this.watchIntervalMs=Math.max(100,Number(r)||700),this.activePath="",this.activeStamp="",this.lastLoadedAt="",this.lastError="",this.listeners=new Set,this.playState={running:!1,paused:!1,canvasId:"",width:0,height:0,frame:0,time:0,logs:[]},this.timer=null,this.refreshing=!1,this.discoveryIntervalMs=Math.max(100,Number(n)||5e3),this.archiveCache=null,this.archiveCacheTime=0,this.openGeneration=0,this.disposed=!1}async initialize(){let t=this.archives().archives,i=this.initialPath||t[0]?.path||"";if(i)try{await this.open(i,"startup")}catch{}return this.timer=setInterval(()=>{this.refreshFromDisk()},this.watchIntervalMs),this.state()}archives(t=!1){return(t||!this.archiveCache||Date.now()-this.archiveCacheTime>=this.discoveryIntervalMs)&&(this.archiveCache=$r(this.workspace),this.archiveCacheTime=Date.now()),this.archiveCache}previewStatus(){let t=this.controller.get();return{service:"beyond-simulator-web",version:ui.version,workspace:this.workspace,activePath:this.activePath,lastLoadedAt:this.lastLoadedAt,lastError:this.lastError,revision:this.activePath?t.version:null,name:this.activePath&&t.save?.name||""}}state(){let t=this.archives();return{...this.previewStatus(),archives:t.archives,discovery:t.discovery,snapshot:kh(this.controller.get()),play:this.playState}}recordError(t){let i=t?.message||String(t),r=i!==this.lastError;this.lastError=i,r&&this.emit({type:"error",error:i})}async open(t,i="manual",r=this.openGeneration){let n=Hl(t);if(!n)throw new Error("path is required");return this.controller.exclusive(async()=>{if(this.disposed||i==="external-change"&&r!==this.openGeneration)return this.state();try{await this.controller.play("stop"),this.playState=Xl(this.playState,{running:!1,logs:[]},"stop");let o=Ul(this.workspace,n),a=this.controller.loadArchive(n);return this.activePath=n,this.activeStamp=o,this.initialPath="",this.openGeneration++,this.lastLoadedAt=new Date().toISOString(),this.lastError="",this.archiveCache=null,this.emit({type:"archive",reason:i,path:n,revision:a.version}),this.state()}catch(o){throw this.recordError(o),o}})}async refreshFromDisk(){if(this.refreshing||this.disposed)return!1;this.refreshing=!0;try{if(!this.activePath){let i=this.initialPath||this.archives().archives[0]?.path||"";return i?(await this.open(i,"external-change"),!0):!1}return Ul(this.workspace,this.activePath)===this.activeStamp&&!this.lastError?!1:(await this.open(this.activePath,"external-change"),!0)}catch(t){return this.recordError(t),!1}finally{this.refreshing=!1}}async setView({assetType:t,canvasId:i}={}){if(t&&!Ih.has(t))throw new Error(`unknown asset type: ${t}`);if(i&&!K[i])throw new Error(`unknown canvas preset: ${i}`);return await this.controller.exclusive(async()=>{if(t&&this.controller.patch({op:"selectAsset",assetType:t}),i){let r=this.controller.get().version;this.controller.patch({op:"setCanvas",canvasId:i,expectedRevision:r})}}),this.emit({type:"view"}),this.state()}async play(t,i={},r){if(!Ch.has(t))throw new Error(`unknown play action: ${t||"(empty)"}`);let n=await this.controller.exclusive(()=>this.controller.play(t,i,r));return this.playState=Xl(this.playState,n,t),this.emit({type:"play",action:t,frame:this.playState.frame}),n}async currentState(t){return this.state()}editorScreenshot(t){return this.controller.uiScreenshot(t)}playScreenshot(t){return this.controller.exclusive(()=>this.controller.playScreenshot(t))}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t){for(let i of this.listeners)i(t)}async dispose(){this.disposed=!0,this.timer&&clearInterval(this.timer),this.timer=null,this.listeners.clear(),await this.controller.exclusive(()=>this.controller.dispose())}};import{existsSync as Eh,readFileSync as Ah}from"node:fs";import{createHash as _h}from"node:crypto";var Ph=new Set(["get","patch","import","export","archives","load-archive","save","play","script-sync","script-sync-apply","image-refresh"]),No=e=>_h("sha256").update(Ah(e)).digest("hex"),Wr=class{constructor(t,{initialPath:i="",maxSessions:r=8,imageAssets:n}={}){this.workspace=t,this.initialPath=i,this.maxSessions=r,this.sessions=new Map,this.imageAssets=n}getSession(t){if(typeof t!="string"||!/^[a-zA-Z0-9_-]{1,100}$/.test(t))throw new Error("Invalid editor sessionId");if(!this.sessions.has(t)){if(this.sessions.size>=this.maxSessions)throw new Error("Editor session limit reached; save your work and restart the server");let r={controller:new ii(this.workspace,{imageAssets:this.imageAssets}),path:"",fileStamp:""};this.initialPath&&this.load(r,this.initialPath),this.sessions.set(t,r)}return this.sessions.get(t)}snapshot(t){return{...t.controller.get(),storage:{path:t.path}}}load(t,i){let r=Te(this.workspace,i),n=t.controller.loadArchive(i);return t.path=String(i).replaceAll("\\","/"),t.fileStamp=No(r),{...n,snapshot:this.snapshot(t)}}async call(t,i,r){if(!Ph.has(t))throw new Error("Unknown editor action");let n=this.getSession(i.sessionId),o=n.controller;return o.exclusive(async()=>{if(t==="get")return this.snapshot(n);if(t==="image-refresh")return await o.imageAssets.refresh(i.imageId,{imageSource:i.imageSource}),{imageId:i.imageId,imageSource:i.imageSource||"StaticReference",refreshed:!0};if(t==="script-sync")return o.scriptSyncAction(i.action,i.args||{});if(t==="script-sync-apply")return o.scriptSync.apply(i);if(t==="archives")return o.listArchives();if(t==="patch"){if(!Number.isInteger(i.op?.expectedRevision))throw new Error("expectedRevision is required");return{...o.patch(i.op),storage:{path:n.path}}}if(t==="export")return o.studio.exportData(i.format,i.assetType);if(t==="play")return o.play(i.action,i.args||{},r);if(t==="load-archive"||t==="import"){if(await o.play("stop"),t==="load-archive")return this.load(n,i.path);let a=o.studio.importData(i.format,i.data,i.filename);return n.path="",n.fileStamp="",{...a,snapshot:this.snapshot(n)}}if(t==="save"){if(i.expectedRevision!==o.get().version)throw new Error("revision conflict: reload before saving");let a=xe(this.workspace,i.path);if(Eh(a)){let c=n.path?xe(this.workspace,n.path):"";if(a!==c||No(a)!==n.fileStamp)throw new Error("File changed or already exists; load it again or save under a new path")}let s=o.saveArchive(i.path);return n.path=s.path,n.fileStamp=No(a),s}})}async dispose(){await Promise.all([...this.sessions.values()].map(t=>t.controller.exclusive(()=>t.controller.dispose()))),this.sessions.clear()}};var Wl=32*1024*1024;function Th(e){if(e.length<8||e.length>Wl)throw new Error("Invalid MP3 size");let t=0,i=0;if(e.subarray(0,3).toString()==="ID3"){if(e.length<10||e[3]<2||e[3]>4||e.subarray(6,10).some(r=>r>127))throw new Error("Invalid MP3 ID3 header");t=10+(e[6]<<21|e[7]<<14|e[8]<<7|e[9])+(e[5]&16&&e[3]===4?10:0)}for(;t+4<=e.length;){if(e.length-t===128&&e.subarray(t,t+3).toString()==="TAG"){t=e.length;break}let r=e[t+1],n=e[t+2],o=r>>3&3,a=n>>2&3,s=n>>4;if(e[t]!==255||(r&224)!==224||(r&6)!==2||o===1||a===3||s===0||s===15)throw new Error("Invalid MP3 frame");let c=(o===3?[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320]:[0,8,16,24,32,40,48,56,64,80,96,112,128,144,160])[s],l=[44100,48e3,32e3][a]/(o===3?1:o===2?2:4),u=Math.floor((o===3?144e3:72e3)*c/l)+(n>>1&1);t+=u,i++}if(i<2||t!==e.length)throw new Error("Truncated or invalid MP3")}var Fo=class extends dt{constructor({cacheDir:t=process.env.QXQY_AUDIO_CACHE_DIR||jr("audio"),fetch:i=globalThis.fetch,source:r=Rs}={}){super({cacheDir:t,fetch:i,source:r,version:Kn,extension:"mp3",accepts:n=>Ir(n)!==null,timeout:2e4})}decode(t){return Th(t),{}}produce(t,i,r){return this.download(`audio/${t}.mp3`,Wl,i,r)}},Rh;function Oo(){return Rh||=new Fo}async function Kl(e,t,i=Oo()){let r=new URL(e.url,"http://localhost");if(r.pathname!==xr.slice(0,-1)&&!r.pathname.startsWith(xr))return!1;try{if(!["GET","HEAD"].includes(e.method))throw Object.assign(new Error("GET or HEAD required"),{status:405});let n=r.pathname.match(new RegExp(`^${xr}${Kn}/([0-9]+)\\.mp3$`));if(!n)throw Object.assign(new Error("Unknown audio resource"),{status:404});let o=await i.get(Number(n[1])),a=o.data.length,s={"content-type":"audio/mpeg","cache-control":"private, max-age=43200",etag:o.etag,"accept-ranges":"bytes","x-content-type-options":"nosniff"};if(e.headers["if-none-match"]===o.etag)return t.writeHead(304,s),t.end(),!0;let c=e.headers.range,l=0,u=a-1,f=200;if(c&&(!e.headers["if-range"]||e.headers["if-range"]===o.etag)){let h=c.match(/^bytes=(\d*)-(\d*)$/);if(!h||!h[1]&&!h[2])throw Object.assign(new Error("Invalid byte range"),{status:416,size:a});if(h[1]?(l=Number(h[1]),u=h[2]?Math.min(a-1,Number(h[2])):u):l=Math.max(0,a-Number(h[2])),!Number.isSafeInteger(l)||!Number.isSafeInteger(u)||l>=a||u<l)throw Object.assign(new Error("Unsatisfiable byte range"),{status:416,size:a});f=206,s["content-range"]=`bytes ${l}-${u}/${a}`}t.writeHead(f,{...s,"content-length":u-l+1}),t.end(e.method==="HEAD"?void 0:o.data.subarray(l,u+1))}catch(n){t.writeHead(n.status||502,{"content-type":"text/plain; charset=utf-8","cache-control":"no-store",...n.status===416?{"content-range":`bytes */${n.size}`}:{}}),t.end(e.method==="HEAD"?void 0:n.message)}return!0}var Mh="https://github.com/1475505/miliastra-beyond-simulator",Nh="https://api.github.com/repos/1475505/miliastra-beyond-simulator/releases?per_page=100",Fh=e=>/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(e),Jl=(e,t)=>{let i=e.split(/[.-]/).slice(0,3).map(Number),r=t.split(/[.-]/).slice(0,3).map(Number);for(let n=0;n<3;n++)if(i[n]!==r[n])return Math.sign(i[n]-r[n]);return t.includes("-")&&!e.includes("-")?1:e.includes("-")&&!t.includes("-")?-1:0};function ql(e,t){try{let i=new URL(e);return i.protocol==="https:"&&i.origin==="https://github.com"&&i.pathname.startsWith(`/1475505/miliastra-beyond-simulator/releases/${t}/`)?i.href:null}catch{return null}}function Oh(e,t){if(!Array.isArray(e))throw new Error("Invalid release response");let i=[];for(let r of e)if(!(r.draft||r.prerelease||!Array.isArray(r.assets)))for(let n of r.assets){if(typeof n.name!="string"||!n.name.startsWith(t+"-")||!n.name.endsWith(".tgz"))continue;let o=n.name.slice(t.length+1,-4),a=ql(r.html_url,"tag"),s=ql(n.browser_download_url,"download");!Fh(o)||!a||!s||i.push({version:o,url:a,downloadUrl:s,publishedAt:r.published_at||null})}return i.sort((r,n)=>Jl(n.version,r.version))[0]||null}function Ql({packageName:e,currentVersion:t,fetch:i=globalThis.fetch,now:r=Date.now}){let n=null,o=null;return async function(){return n&&r()-n.checkedAt<5*6e4?n:o||(o=(async()=>{let s=await i(Nh,{headers:{accept:"application/vnd.github+json","user-agent":"beyond-simulator-update-check","x-github-api-version":"2022-11-28"},signal:AbortSignal.timeout(8e3)});if(!s.ok)throw new Error(`Update check failed (HTTP ${s.status})`);let c=Oh(await s.json(),e),l=c?Jl(c.version,t):0;return n={packageName:e,currentVersion:t,latestVersion:c?.version||null,status:c?l>0?"available":l<0?"ahead":"current":"unavailable",url:c?.url||`${Mh}/releases`,downloadUrl:c?.downloadUrl||null,checkedAt:r(),publishedAt:c?.publishedAt||null},n})().finally(()=>{o=null}),o)}}import{execFile as zh}from"node:child_process";import{win32 as Dh}from"node:path";import{promisify as $h}from"node:util";var Gh=$h(zh),Zl=e=>["localhost","127.0.0.1","::1","[::1]","::ffff:127.0.0.1"].includes(e);function zo(e){if(typeof e!="string")return"";let t=e.trim().replace(/^\uFEFF/,"").split(/[.@]/)[0].replaceAll("_","-");if(!t||/^(?:C|POSIX)$/i.test(t)||t.length>80)return"";try{return Intl.getCanonicalLocales(t)[0]||""}catch{return""}}function ec(e){try{return Zl(e.socket?.remoteAddress)&&Zl(new URL("http://"+e.headers.host).hostname)&&!e.headers.forwarded&&!e.headers["x-forwarded-for"]&&!e.headers["x-forwarded-host"]&&!e.headers.via&&e.headers["sec-fetch-site"]!=="cross-site"&&(!e.headers.origin||new URL(e.headers.origin).host===e.headers.host)}catch{return!1}}function Vh({platform:e=process.platform,env:t=process.env,execFile:i=Gh}={}){let r;return()=>r||=(async()=>{try{let n="",o="browser",a={windowsHide:!0,timeout:2500,maxBuffer:4096,encoding:"utf8"};if(e==="win32"){let s=Dh.join(t.SystemRoot||"C:\\Windows","System32","WindowsPowerShell","v1.0","powershell.exe"),{stdout:c}=await i(s,["-NoLogo","-NoProfile","-NonInteractive","-Command","[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;(Get-UICulture).Name"],a);n=zo(c),o="windows-ui"}else if(e==="darwin"){let{stdout:s}=await i("/usr/bin/defaults",["read","-g","AppleLanguages"],a);n=(s.match(/\b[a-z]{2,3}(?:[-_][a-zA-Z0-9]{2,8})*\b/g)||[]).map(zo).find(Boolean)||"",o="macos-ui"}else n=[t.LANGUAGE?.split(":")[0],t.LC_ALL,t.LC_MESSAGES,t.LANG].map(zo).find(Boolean)||"",o="host-locale";return{language:n,source:n?o:"browser"}}catch{return{language:"",source:"browser"}}})()}var tc=Vh();var Xh=oc(new URL(".",import.meta.url)),Wh=nc(Xh,"public"),rc=new Map([["/","index.html"],["/index.html","index.html"],["/app.js","app.js"],["/play-renderer.js","play-renderer.js"],["/styles.css","styles.css"],["/editor","editor.html"],["/editor/","editor.html"],["/editor.js","editor.js"],["/editor.css","editor.css"],["/editor/play","play.html"],["/editor/play.js","play.js"],["/editor/play.css","play.css"],["/editor/play-renderer.js","play-renderer.js"]]),Kh={".html":"text/html; charset=utf-8",".js":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8"};function qh(e=process.argv.slice(2)){let t=(i,r="")=>{let n=e.indexOf(i);return n>=0&&e[n+1]?e[n+1]:r};return{workspace:t("--workspace",process.env.QXQY_WORKSPACE||process.cwd()),initialPath:t("--file"),host:t("--host","127.0.0.1"),port:Number(t("--port","4173")),open:e.includes("--open")}}function qr(e,t="'none'"){return{"cache-control":"no-store","content-type":e,"content-security-policy":`default-src 'self'; img-src 'self' data:; connect-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; object-src 'none'; frame-ancestors ${t}`,"x-content-type-options":"nosniff"}}function Ae(e,t,i){e.writeHead(t,qr("application/json; charset=utf-8")),e.end(JSON.stringify(i))}function Jh(e,t){e.writeHead(200,{...qr("image/png"),"content-length":t.data.length,"x-qxqy-width":String(t.width||0),"x-qxqy-height":String(t.height||0)}),e.end(t.data)}async function Kr(e,t=1024*1024){let i=[],r=0;for await(let n of e){if(r+=n.length,r>t)throw new Error("request body is too large");i.push(n)}return i.length?JSON.parse(Buffer.concat(i).toString("utf8")):{}}function Qh(e){let t=process.platform==="win32"?"cmd.exe":process.platform==="darwin"?"open":"xdg-open",i=process.platform==="win32"?["/c","start","",e]:[e];Bh(t,i,{detached:!0,stdio:"ignore",windowsHide:!0}).unref()}async function Zh(e={}){e={...e,imageAssets:e.imageAssets||Vi(),audioAssets:e.audioAssets||Oo()};let t=e.host||"127.0.0.1",i=e.password??process.env.QXQY_WEB_PASSWORD??"",r=["127.0.0.1","localhost","::1"].includes(t);if(Ke()&&!r)throw new Error("QXQY_FONT_PATH requires a loopback-only Web host");if(!r&&!i)throw new Error("QXQY_WEB_PASSWORD is required when listening outside loopback");let n=b=>Hh("sha256").update(b).digest(),o=n(i),a=new Xr(e);await a.initialize();let s=new Wr(a.workspace,e),c=e.checkUpdates||Ql({packageName:ui.name,currentVersion:ui.version}),l=e.systemLanguage||tc,u=new Set,f=a.subscribe(b=>{let v=`event: state
|
|
116
|
-
data: ${JSON.stringify(b)}
|
|
111
|
+
`)}`);return i}function $a(e,t={}){K(e.root,gt);let i=[];Qe(e,{warnings:i});let n=Ii(L(e)),a=e.meta?.assetType==="client-control-template",r;if(a){let s=t.includeScriptMappings?yn(t.scripts||[],new Set(n.values())):null;r=Zo(e,n,i,void 0,s?.scripts||t.scripts||[]),s&&r.accessories.push(...s.units)}else{let s=yn(t.scripts||[],new Set(n.values()));i.push(...s.warnings),r=es(e,n,s,i)}return{buffer:ts(r,a?Ga:Va),warnings:[...new Set(i)]}}function is(e,t,i={}){K(e.root,gt),t&&K(t.root,gt);let n=["\u6574\u5408\u5305\u628A\u670D\u52A1\u7AEF UIControlGroup \u4E0E\u5BA2\u6237\u7AEF UIControlTemplate \u5E76\u6392\u5199\u5165\u540C\u4E00 GIA \u7684 Root.graph\uFF1B\u5BFC\u5165\u65F6\u62C6\u56DE\u4E24\u7C7B\u8D44\u4EA7\uFF0C\u6A21\u677F\u8FB9\u754C\u3001\u811A\u672C\u6620\u5C04\u4E0E\u63A7\u4EF6\u6302\u8F7D\u5173\u7CFB\u4F1A\u4FDD\u7559\u3002"];t&&Qe(t,{warnings:n});let a=t?.root?.children||[];a.length||n.push("\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u4E3A\u7A7A\uFF0C\u6574\u5408\u5305\u53EA\u5305\u542B\u670D\u52A1\u7AEF\u63A7\u4EF6\u4E0E\u811A\u672C\u3002");let r=new Set,o=L(e),s=t?L(t):null,c=Ii(o,r),l=yn(i.scripts||[],r);n.push(...l.warnings.filter(v=>v!==as));let d=String(i.fileName||`${o.meta?.name||"\u6574\u5408\u5305"} \xB7 \u6574\u5408\u5305.gia`),f=Na({...o,meta:{...o.meta,giaFileName:d}},!1),h=es(o,c,l,n,f),m={graph:[],accessories:[]};if(a.length&&s){let v=Ii({...s,meta:{...s.meta,assetType:"client-control-template"}},r);m=Zo(s,v,n,f,l.scripts)}let p={graph:[...h.graph,...m.graph],accessories:[...h.accessories,...m.accessories],filePath:f,gameVersion:Oa({meta:{gameVersion:e.meta?.gameVersion||t?.meta?.gameVersion}}),...Fa(e)};return{buffer:ts(p,Va),warnings:[...new Set(n)]}}var It=69,ns=30,as="\u811A\u672C\u6302\u8F7D\u5173\u7CFB\u4E0D\u8FDB\u5165 GIA\uFF1A\u5B98\u65B9 script.gia \u53EA\u542B\u6620\u5C04\uFF08ID/\u540D\u79F0/\u8DEF\u5F84/\u6E90\u7801\uFF09\uFF0C\u5BFC\u5165\u540E\u9700\u91CD\u65B0\u6302\u8F7D\u3002";function Kd(e){return(String(e.path||"").replace(/\\/g,"/").split("/").pop()||"").replace(/\.lua$/iu,"")||`\u811A\u672C${e.id||""}`}function Da(e){let t=De.verify(e);if(t)throw new Error(`GIA encode validation failed: ${t}`);let i=De.encode(De.create(e)).finish(),n=Buffer.alloc(dt+i.length+Ma);return n.writeUInt32BE(n.length-4,0),n.writeUInt32BE(1,4),n.writeUInt32BE(Xo,8),n.writeUInt32BE(3,12),n.writeUInt32BE(i.length,16),Buffer.from(i).copy(n,dt),n.writeUInt32BE(Wo,dt+i.length),n}function yn(e,t=new Set){let i=(e||[]).filter(o=>o.path||o.source).map(o=>({...o})),n=[];for(let o of i)ua(o.guid,o.path||o.id);for(let o of i){let s=Number(o.guid);Te(s)&&!t.has(s)?(t.add(s),o.guid=s):n.push(o)}for(let o of n){let s=ot(t);t.add(s),o.guid=s}let a=[];return(e||[]).some(o=>o.controlId)&&a.push(as),{units:i.map(o=>{let s=Kd(o),c=String(o.path||"").replace(/\\/g,"/"),l=/\.lua$/iu.test(c)?c:`${c||s}.lua`,d={id:o.guid,name:s,filePath:l};return String(o.source||"")&&(d.source=String(o.source)),{id:{class:ns,id:o.guid},name:s,which:It,script:{mapping:d}}}),warnings:a,scripts:i}}function rs(e){let t=yn(e);if(!t.units.length)throw new Error("\u6CA1\u6709\u53EF\u5BFC\u51FA\u7684 Lua \u811A\u672C\uFF0C\u8BF7\u5148\u5728\u201CLua \u811A\u672C\u201D\u9875\u521B\u5EFA");let i={graph:t.units,filePath:`114514-${Math.floor(Date.now()/1e3)}-1073741832-\\script.gia`,gameVersion:"7.0.51"},n=Da(i),a=qd(n);if(!a.valid)throw new Error(`GIA compatibility validation failed:
|
|
112
|
+
${a.errors.join(`
|
|
113
|
+
`)}`);return{buffer:n,warnings:[...new Set(t.warnings)]}}function za(e){return De.toObject(De.decode(vn(e)),{longs:Number,enums:Number,bytes:Buffer,defaults:!1,arrays:!0,objects:!0})}function os(e){try{let i=za(e).graph||[];return i.length>0&&i.every(n=>Number(n.which)===It)}catch{return!1}}function ss(e){let t=[...e.graph||[],...e.accessories||[]].filter(a=>Number(a.which)===It),i=[],n=t.map((a,r)=>{let o=a.script?.mapping||{},s=Number(a.id?.id)||0;s<=0&&i.push(`\u7B2C ${r+1} \u6761\u811A\u672C\u6620\u5C04\u7F3A\u5C11 GraphUnit.id.id\uFF0C\u5DF2\u6309 0 \u5904\u7406\uFF08\u5BFC\u51FA\u65F6\u4F1A\u91CD\u65B0\u5206\u914D\uFF09\u3002`);let c=Number(o.id)||0;return c&&c!==s&&i.push(`\u7B2C ${r+1} \u6761\u811A\u672C\u6620\u5C04 id(${c}) \u4E0E\u5355\u5143 id(${s}) \u4E0D\u4E00\u81F4\uFF0C\u4EE5\u5355\u5143 id \u4E3A\u51C6\u3002`),{guid:s,path:String(o.filePath||""),source:String(o.source||"")}});for(let[a,r]of n.entries())r.path&&!/\.lua$/iu.test(r.path)&&i.push(`\u7B2C ${a+1} \u6761\u811A\u672C\u6620\u5C04 file_path \u7F3A\u5C11 .lua \u540E\u7F00\uFF08${r.path}\uFF09\uFF0C\u771F\u673A\u53EF\u80FD\u62D2\u7EDD\u5BFC\u5165\uFF1B\u6A21\u62DF\u5668\u5185\u6309\u5F52\u4E00\u5316\u8DEF\u5F84\u7167\u5E38 require\u3002`);return{scripts:n,warnings:i}}function cs(e){let t=za(e),i=ss(t);if(!i.scripts.length)throw new Error("GIA \u5185\u6CA1\u6709\u811A\u672C\u6620\u5C04\u5355\u5143\uFF08which=69\uFF09");return{scripts:i.scripts,warnings:i.warnings,metadata:{assetType:"lua-script"}}}function qd(e){let t=[],i;try{i=za(e)}catch(a){return{valid:!1,errors:[a?.message||String(a)],scriptCount:0}}let n=i.graph||[];return n.length||t.push("Root.graph \u4E3A\u7A7A"),(i.accessories||[]).length&&t.push("script.gia \u4E0D\u5E94\u5305\u542B accessories"),n.forEach((a,r)=>{let o=`\u5355\u5143 ${r+1}`;Number(a.which)!==It&&t.push(`${o}: which \u5E94\u4E3A 69\uFF0C\u5B9E\u9645 ${a.which}`),Number(a.id?.class)!==ns&&t.push(`${o}: id.class \u5E94\u4E3A 30\uFF0C\u5B9E\u9645 ${a.id?.class}`),Number(a.id?.type??0)!==0&&t.push(`${o}: id.type \u5E94\u7F3A\u7701`);let s=a.script?.mapping;if(!s){t.push(`${o}: \u7F3A\u5C11 field35 ScriptMappingWrapper`);return}Te(a.id?.id)||t.push(`${o}: GraphUnit.id.id \u975E\u6CD5\uFF08\u5141\u8BB8 0x40000000\u20130x403FFFFF\uFF09`),Number(s.id)!==Number(a.id?.id)&&t.push(`${o}: mapping.id \u5E94\u7B49\u4E8E GraphUnit.id.id`),String(s.name||"")!==String(a.name||"")&&t.push(`${o}: mapping.name \u5E94\u7B49\u4E8E GraphUnit.name`),String(s.filePath||"").trim()?/\.lua$/iu.test(String(s.filePath))||t.push(`${o}: file_path \u5E94\u4EE5 .lua \u7ED3\u5C3E\uFF08\u5B98\u65B9 script.gia \u6837\u672C\u5747\u4E3A \u540D\u79F0.lua\uFF0C\u771F\u673A require \u65F6\u624D\u53BB\u6269\u5C55\u540D\uFF09`):t.push(`${o}: file_path \u4E3A\u7A7A`)}),{valid:t.length===0,errors:t,scriptCount:n.length}}function vn(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);if(t.length<dt+Ma)throw new Error("GIA \u6587\u4EF6\u8FC7\u77ED");if(t.readUInt32BE(4)!==1||t.readUInt32BE(8)!==Xo||t.readUInt32BE(12)!==3)throw new Error("\u4E0D\u662F\u53D7\u652F\u6301\u7684 GIA v1 \u6587\u4EF6");let i=t.readUInt32BE(16);if(i!==t.length-dt-Ma)throw new Error("GIA payload \u957F\u5EA6\u4E0D\u4E00\u81F4");if(t.readUInt32BE(dt+i)!==Wo)throw new Error("GIA \u5C3E\u6807\u8BB0\u65E0\u6548");return t.subarray(dt,dt+i)}function pe(e,t){return e.ui?.content?.data?.find(i=>i.details?.[t])?.details?.[t]||null}function Jd(e){let t=e.ui?.content?.data?.find(r=>r.field501===66&&r.field502===89||Object.hasOwn(r.details||{},"templateRefSlot")),i=Buffer.from(t?.details?.templateRefSlot||[]),n=i.toString("utf8"),a=Buffer.from(n,"utf8").equals(i)&&!/[\u0000-\u001f\u007f-\u009f]/u.test(n);return{referencedPrefabId:a?n:"",raw:{templateRefSlot:a?n:"",...a?{}:{templateRefSlotBase64:i.toString("base64")},...t?.empty76?.length?{templateRefOuterBase64:Buffer.from(t.empty76).toString("base64")}:{}}}}function Qd(e){let t=pe(e,"transform")?.multiPlatform,i={};for(let a of t?.platforms||[]){let r=Gd[a.platformType||0],o=a.transform||{};i[r]={scale:o.scale?{x:o.scale.x??0,y:o.scale.y??0,z:o.scale.z??0}:{x:1,y:1,z:1},rotation:{x:o.field508?.x??0,y:o.field508?.y??0,z:o.field508?.z??0},anchorMin:{x:o.anchorMin?.x??0,y:o.anchorMin?.y??0},anchorMax:{x:o.anchorMax?.x??0,y:o.anchorMax?.y??0},offset:{x:o.offset?.x??0,y:o.offset?.y??0},size:{x:o.size?.x??0,y:o.size?.y??0},pivot:o.pivot?{x:o.pivot.x??0,y:o.pivot.y??0}:{x:.5,y:.5}}}let n=i.KEYBOARD||i[Object.keys(i)[0]];if(!n)throw new Error(`GIA \u63A7\u4EF6 ${e.name||e.id?.id} \u7F3A\u5C11\u591A\u5E73\u53F0\u53D8\u6362`);for(let a of fe)i[a]||(i[a]=structuredClone(n));return i}function wn(e){let t=e.ui?.content?.data||[];return t.some(i=>i.details?.textConfig)?t.some(i=>i.field501===71)?"textwindow":"textbox":t.some(i=>i.details?.cursorConfig)?"cursor":t.some(i=>Object.hasOwn(i.details||{},"templateRefSlot")||i.field501===66&&i.field502===89)?"reference":t.some(i=>i.details?.gridView)?"grid":t.some(i=>i.details?.buttonPreset)?"button":t.some(i=>i.details?.keyHint)?"keyhint":t.some(i=>i.details?.image||i.details?.imageSlot)?"image":t.some(i=>Object.hasOwn(i.details||{},"effectSlot"))?"animation":t.some(i=>Object.hasOwn(i.details||{},"fullscreenEffectSlot"))?"fullscreen":(t.some(i=>Object.hasOwn(i.details||{},"containerNodeSlot")),"container")}function Yo(e,{reverseSiblings:t=!1,idOffset:i=0}={}){if(!e.length)return{nodes:new Map,rootCandidates:[],warnings:[]};let n=new Map(e.map((l,d)=>[l.id?.id,`n${i+d+1}`])),a=new Map,r=new Map,o=[];for(let l of e){let d=wn(l),f=pe(l,"textConfig"),h=pe(l,"imageSlot"),m=pe(l,"image"),p=pe(l,"buttonPreset"),b=pe(l,"gridView"),v=pe(l,"genericSlot"),y=pe(l,"footerSlot"),w=pe(l,"cursorConfig"),_=pe(l,"keyHint"),T=pe(l,"containerNodeSlot"),N=d==="reference"?Jd(l):null,O=pe(l,"effectSlot"),V=pe(l,"fullscreenEffectSlot"),$=Q(d,{id:n.get(l.id?.id),guid:l.id?.id||0,giaInfoIndex:(l.ui?.content?.info||[]).find(S=>S.field501===2&&S.field502===6)?.index?.value,giaRelatedGuids:(l.ui?.content?.info||[]).find(S=>S.field501===4&&S.field502===4)?.related?.value||[],name:l.name||d,visible:pe(l,"field14")?.field17?.initiallyHidden!==!0,active:pe(l,"field14")?.initiallyInactive!==!0,canControllerFocus:y?.field505===1,scriptMappingIds:(v?.field502||[]).map(S=>Number(S?.field1?.id)).filter(S=>Number.isSafeInteger(S)&&S>0),transformByPlatform:Qd(l),syncAllDevices:pe(l,"transform")?.multiPlatform?.field504===1,giaRaw:{genericField501:v?.field501??0,footerField505:y?.field505??0,...d==="textbox"||d==="textwindow"?{textField501:f?.field501??20,textField503:f?.field503??12,textAlign:f?.align??0,...[void 0,0,1,2].includes(f?.verticalAlign)?{}:{textVerticalAlign:f.verticalAlign},...d==="textwindow"?{textField511:f?.field511??1,textViewField502:f?.viewFlags?.field502??1,textViewField503:f?.viewFlags?.field503??1}:{}}:{},...d==="cursor"?{cursorField501:w?.field501??0}:{},...N?.raw||{},...d==="grid"?{gridField501:b?.field501??1,gridField507:b?.field507??1,gridField508:b?.field508??1,gridField509:b?.field509??1,gridField511:b?.field511??5,gridField512:b?.field512??1}:{},...d==="keyhint"?{keyHintField501:_?.field501??1,keyHintField502:_?.field502??1}:{},...d==="image"?{imageSlotType:h?.imageType??0,imageField502:m?.field502??1,imageField504:m?.field504??1,imageField505:m?.field505??1,imageField507:m?.field507??2,imageFillType:m?.fillType??1}:{},...d==="animation"?{effectSlot:O??""}:{},...d==="fullscreen"?{fullscreenEffectSlot:V??""}:{}},...d==="container"?{isolateNavigation:T?.isolateNavigation===!0,disableKeyEventPassthrough:T?.disableKeyEventPassthrough===!0,disableCursorEventPassthrough:T?.disableCursorEventPassthrough===!0,showCursor:T?.showCursor===!0}:{},...d==="cursor"?{raycastTarget:w?.field501===1}:{},...d==="textbox"||d==="textwindow"?{text:f?.text?.value??"",fontSize:f?.fontSize??20,minimumFontSize:f?.minimumFontSize??20,adaptiveFontSize:f?.adaptive===1,fontColor:f?.color??4294967295,bgColor:f?.color2??0,enableOutline:f?.outlineOff!==1,outlineColor:f?.color3??858993459,horizontalAlignment:f?.align===1?"Middle":f?.align===2?"Right":"Left",verticalAlignment:{0:"Top",1:"Middle",2:"Bottom"}[f?.verticalAlign??0]||"Top",...d==="textwindow"?{interactable:!0,showScrollBar:!0}:{}}:{},...d==="image"?{imageSource:"StaticReference",imageId:h?.assetId??0,imageType:h?.imageType===1?"Stretch":"Basic",imageColor:Number.isFinite(h?.field502)?h.field502>>>0:4294967295,enableMask:m?.enableMask===1,enableSoftEdge:m?.enableSoftEdge===1,enableFill:m?.enableFill===1,softEdgeMode:m?.softEdgePixel===1?"Pixel":"Percentage",softEdgeWidthX:m?.border?.field501??8,softEdgeWidthY:m?.border?.field502??8,horizontalSoftRange:m?.field512??85,verticalSoftRange:m?.field513??85,fillType:{1:"Horizontal",2:"Vertical",3:"Radial90",4:"Radial180",5:"Radial360"}[m?.fillType]||"Horizontal",fillAmount:Number.isFinite(m?.field508)?Math.max(0,Math.min(1,m.field508/100)):m?.enableFill===1?0:1,reverseMaskArea:m?.reverseMask===1}:{},...d==="button"?{interactable:p?.interactable===1,raycastTarget:p?.raycastTarget===1,clickAudioId:p?.clickAudioId??50888}:{},...d==="grid"?{cellSizeX:b?.cellSize?.field501??50,cellSizeY:b?.cellSize?.field502??50,spacingX:b?.gap?.field501??8,spacingY:b?.gap?.field502??8,padding1X:b?.padding1?.field501??20,padding1Y:b?.padding1?.field502??20,padding2X:b?.padding2?.field501??20,padding2Y:b?.padding2?.field502??20,previewCount:b?.field511??5}:{},...N?{referencedPrefabId:N.referencedPrefabId}:{},...d==="keyhint"?{keyboardKeyCode:_?.field502??null,controllerKeyCode:_?.field501??null}:{},...d==="animation"?{animationId:O??""}:{},...d==="fullscreen"?{animationId:V??""}:{}});a.set(l.id?.id,$),(N?.raw.templateRefSlotBase64||N?.raw.templateRefOuterBase64)&&o.push(`${$.name}: \u6A21\u677F\u5F15\u7528\u914D\u7F6E\u542B\u5C1A\u672A\u89E3\u6790\u7684\u4E8C\u8FDB\u5236\u5B57\u6BB5\uFF0C\u5DF2\u539F\u6837\u4FDD\u5B58\uFF1B\u5F15\u7528\u76EE\u6807\u672A\u63A8\u65AD\uFF0C\u9884\u89C8\u4E0D\u4F1A\u81EA\u52A8\u5C55\u5F00\u3002`),(d==="textbox"||d==="textwindow")&&![void 0,0,1,2].includes(f?.align)&&o.push(`${$.name}: \u6C34\u5E73\u5BF9\u9F50\u679A\u4E3E ${f.align} \u7684\u542B\u4E49\u672A\u77E5\uFF0C\u5DF2\u539F\u6837\u4FDD\u7559\u3002`),(d==="textbox"||d==="textwindow")&&![void 0,0,1,2].includes(f?.verticalAlign)&&o.push(`${$.name}: \u5782\u76F4\u5BF9\u9F50\u679A\u4E3E ${f.verticalAlign} \u7684\u542B\u4E49\u672A\u77E5\uFF0C\u5DF2\u539F\u6837\u4FDD\u7559\u3002`),d==="image"&&![void 0,0,1,2,3,4,5].includes(m?.fillType)&&o.push(`${$.name}: \u586B\u5145\u5F62\u72B6\u679A\u4E3E ${m.fillType} \u672A\u8BC6\u522B\uFF0C\u5DF2\u4FDD\u7559\u539F\u503C\u3002`),d==="button"&&r.set($.id,{unavailableChildId:p?.disabledChild,hoverChildId:p?.hoverChild,pressedChildId:p?.pressedChild,selectedChildId:p?.selectedChild})}let s=[],c=new Set;for(let l of e){let d=a.get(l.id?.id),f=(l.ui?.content?.children||[]).map(h=>a.get(h)).filter(Boolean);if(f.length){d.children=t?f.slice().reverse():f;for(let h of f)c.add(h.id)}}for(let l of e){let d=a.get(l.id?.id),f=l.ui?.content?.parent||0,h=a.get(f);h?c.has(d.id)||(t?h.children.unshift(d):h.children.push(d)):s.push(d)}for(let[l,d]of r){let f=[...a.values()].find(h=>h.id===l);for(let[h,m]of Object.entries(d))f[h]=n.get(m)||null}return{nodes:a,rootCandidates:s,warnings:o}}function ls(e){let t=vn(e),i=De.toObject(De.decode(t),{longs:Number,enums:Number,bytes:Buffer,defaults:!1,arrays:!0,objects:!0}),n=[...i.graph||[],...i.accessories||[]],a=y=>!!y.ui?.content&&[15,21,70].includes(Number(y.which)),r=(i.graph||[]).filter(a);if(!r.some(y=>y.ui?.content))throw new Error("GIA \u4E0D\u542B\u53EF\u8BC6\u522B\u7684 UIControlGroup \u4E3B\u56FE");let o=r.find(y=>y.which===21)||null,s=r.filter(y=>Number(y.which)===70),c=(i.accessories||[]).filter(a),l=new Set((o?.relatedIds||[]).map(y=>y.id||0)),d=o?l.size?c.filter(y=>l.has(y.id?.id||0)):c:[],f=s.length?[...s,...c.filter(y=>!l.has(y.id?.id||0))]:o?[]:[...r,...c];if(!d.length&&!f.length)throw new Error("GIA \u4E0D\u542B\u5BA2\u6237\u7AEF\u63A7\u4EF6");let h=["GIA \u5BFC\u5165\u4E3A\u5DF2\u9A8C\u8BC1 UI \u5B57\u6BB5\u7684\u8BED\u4E49\u5BFC\u5165\uFF1B\u672A\u77E5 protobuf \u5B57\u6BB5\u4E0D\u4F1A\u8FDB\u5165 Authoring JSON\u3002"],m=n.filter(y=>!a(y)&&Number(y.which)!==It);m.length&&h.push(`\u8DF3\u8FC7 ${m.length} \u4E2A\u975E UI / \u975E\u811A\u672C\u4F9D\u8D56\u5355\u5143\uFF1B\u8FD9\u4E9B\u8D44\u6E90\u4E0D\u4F1A\u8FDB\u5165\u5B58\u6863\u6216\u91CD\u65B0\u5BFC\u51FA\u3002`);let p=ss(i);h.push(...p.warnings);let b=null,v=null;if(d.length){let y=Yo(d,{reverseSiblings:!0,idOffset:0});h.push(...y.warnings);let w=y.rootCandidates.find(T=>T.kind==="container")||y.rootCandidates[0];if(!w)throw new Error("GIA \u672A\u627E\u5230\u5BA2\u6237\u7AEF\u6839\u63A7\u4EF6");let _=Q("server-container",{id:"sc1",guid:o?.id?.id||0,name:o?.name||"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668",giaRelatedGuids:(o?.ui?.content?.info||[]).find(T=>T.field501===4&&T.field502===4)?.related?.value||[]});_.children=[w],y.rootCandidates.length>1&&h.push(`\u68C0\u6D4B\u5230 ${y.rootCandidates.length} \u4E2A\u65E0\u7236\u8282\u70B9\u63A7\u4EF6\uFF0C\u4EC5\u5BFC\u5165\u4EE5\u201C${w.name}\u201D\u4E3A\u6839\u7684\u6811\u3002`),b={version:1,layoutSchemaVersion:we,meta:{name:o?.name||"\u5BFC\u5165\u7684\u754C\u9762\u63A7\u4EF6\u7EC4",assetType:"server-control-template",sourceFormat:"gia",sourceFile:"",gameVersion:i.gameVersion||"",giaFilePath:i.filePath||"",...Number.isSafeInteger(Number(i.modeFlag))?{giaModeFlag:Number(i.modeFlag)}:{}},canvasId:"pc-16-9",selectedId:w.id,script:{controlId:w.id,path:"",source:""},root:_}}if(f.length){let y=Yo(f,{reverseSiblings:!1,idOffset:1e3});if(h.push(...y.warnings),!y.rootCandidates.length)throw new Error("GIA \u672A\u627E\u5230\u5BA2\u6237\u7AEF\u6A21\u677F");let w=Q("server-container",{id:"sc1",guid:0,name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"});w.children=y.rootCandidates,v={version:1,layoutSchemaVersion:we,meta:{name:y.rootCandidates.length===1?y.rootCandidates[0].name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868",assetType:"client-control-template",sourceFormat:"gia",sourceFile:"",gameVersion:i.gameVersion||"",giaFilePath:i.filePath||"",...Number.isSafeInteger(Number(i.modeFlag))?{giaModeFlag:Number(i.modeFlag)}:{}},canvasId:"pc-16-9",selectedId:y.rootCandidates[0].id,script:{controlId:y.rootCandidates[0].id,path:"",source:""},root:w},Qe(v,{warnings:h});for(let _ of y.rootCandidates)K(_,T=>T.children.reverse());b||(b=v)}return{project:b,clientProject:v&&b!==v?v:void 0,scripts:p.scripts,warnings:h,metadata:{gameVersion:i.gameVersion||"",filePath:i.filePath||"",...Number.isSafeInteger(Number(i.modeFlag))?{modeFlag:Number(i.modeFlag)}:{},combined:!!(o&&s.length)}}}function Ga(e){let t=vn(e),i=De.toObject(De.decode(t),{longs:Number,enums:Number,defaults:!1,arrays:!0,objects:!0}),n=i.graph||[],a=i.accessories||[],r=[],o=(m,p)=>m!=null&&Object.prototype.hasOwnProperty.call(m,p),s=new Map,c=[];/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i.filePath||"")||r.push(`Root.filePath \u4E0D\u662F UID-TIME-ID-\\\u6587\u4EF6\u540D.gia\uFF1A${i.filePath||"<missing>"}`);let l=n.filter(m=>m.which===70).map(m=>{let p=wn(m),b=m.ui?.content?.info||[],v=b.find(_=>_.field501===2&&_.field502===6)?.index?.value,y=b.find(_=>_.field501===4&&_.field502===4),w=y?.related?.value||[];return Me(v)||r.push(`${m.name}: Info.index=${v??"<missing>"}\uFF0C\u5FC5\u987B\u662F\u6B63\u6574\u6570`),y||r.push(`${m.name}: \u9876\u5C42 UIControlTemplate \u7F3A\u5C11 Info.related \u8BB0\u5F55`),{id:m.id?.id||0,name:m.name||"",kind:p,actualIndex:v,relatedPresent:!!y,relatedGuids:w}}),d=new Map;for(let m of l){if(!Me(m.actualIndex))continue;let p=d.get(m.actualIndex);p?r.push(`${m.name}: \u72EC\u7ACB\u6A21\u677F\u8D44\u4EA7\u7F16\u53F7 ${m.actualIndex} \u4E0E ${p.name} \u91CD\u590D`):d.set(m.actualIndex,m)}l.length||r.push("Root.graph \u4E0D\u542B UIControlTemplate(70)");let f=0,h=0;for(let m of[...n,...a]){if(!m.ui?.content)continue;let p=m.id?.id||0,b=m.ui.content,v=wn(m),y=n.includes(m)&&m.which===70,w=`${m.name||"<unnamed>"}(${p||"<missing-guid>"})`;Te(p)?s.has(p)?r.push(`${w}: GUID \u4E0E ${s.get(p).name||"<unnamed>"} \u91CD\u590D`):s.set(p,m):r.push(`${w}: GraphUnit GUID \u975E\u6CD5\uFF08\u5141\u8BB8 0x40000000\u20130x403FFFFF\uFF09`),(m.id?.class!==1||m.id?.type!==8)&&r.push(`${w}: GraphUnit.id \u5FC5\u987B\u4E3A class=1,type=8`),b.guid!==p&&r.push(`${w}: content.guid=${b.guid??"<missing>"} \u4E0E GraphUnit.id.id \u4E0D\u4E00\u81F4`),y&&m.which!==70&&r.push(`${w}: \u6A21\u677F\u6839 which \u5FC5\u987B\u4E3A UIControlTemplate(70)`),!y&&m.which!==15&&r.push(`${w}: \u9644\u4EF6\u63A7\u4EF6 which \u5FC5\u987B\u4E3A UIControl(15)`);let _=b.info||[],T=_.find(P=>P.field501===1&&P.field502===5),N=_.find(P=>P.field501===2&&P.field502===6);T?.guid?.value!==p&&r.push(`${w}: Info.self GUID \u7F3A\u5931\u6216\u4E0E\u81EA\u8EAB\u4E0D\u4E00\u81F4`),Me(N?.index?.value)||r.push(`${w}: Info.index=${N?.index?.value??"<missing>"}\uFF0C\u5FC5\u987B\u662F\u6B63\u6574\u6570`);let O=_.find(P=>P.field501===4&&P.field502===4);y&&!O&&r.push(`${w}: \u9876\u5C42\u6A21\u677F\u7F3A\u5C11 Info.related \u8BB0\u5F55`),!y&&O&&r.push(`${w}: \u9644\u4EF6\u63A7\u4EF6\u4E0D\u5E94\u5199 Info.related`);let V=qo[v],$=b.data||[],S=$.map(P=>`${P.field501}/${P.field502}`),A=V?.map(([P])=>P)||[];V?JSON.stringify(S)!==JSON.stringify(A)&&r.push(`${w}: Data \u69FD\u4F4D\u987A\u5E8F ${S.join(",")}\uFF0C\u5E94\u4E3A ${A.join(",")}`):r.push(`${w}: \u672A\u77E5\u5BA2\u6237\u7AEF\u63A7\u4EF6\u7C7B\u578B ${v}`);for(let P=0;P<Math.min($.length,V?.length||0);P+=1){let B=$[P],[j,ae,X]=V[P];if(o(B,ae)||r.push(`${w}: Data ${j} \u7F3A\u5C11 ${ae} \u5206\u652F`),!X)continue;o(B.details,X)||r.push(`${w}: Details ${j} \u7F3A\u5C11 ${X} \u5206\u652F`);let ie=Jo[j];(B.details?.field501!==ie||B.details?.field502!==B.field502||B.details?.field503!==1)&&r.push(`${w}: Details ${j} \u6807\u8BB0\u5E94\u4E3A ${ie}/${B.field502}/1`);let Oe=B.details?.nodeRef;(Oe?.class!==1||Oe?.type!==8||Oe?.id!==p)&&r.push(`${w}: Details ${j} node_ref \u672A\u6307\u5411\u81EA\u8EAB`)}let E=(m.ui.content.data||[]).find(P=>P.field501===4&&P.field502===86);E&&(o(E.field14,"field17")?f+=1:r.push(`${w}: \u7C7B\u578B Data \u7F3A\u5C11\u663E\u5F0F Field14.field17 \u7A7A\u4E32`),o(E.details?.field14,"field17")?f+=1:r.push(`${w}: \u7C7B\u578B Details \u7F3A\u5C11\u663E\u5F0F Field14.field17 \u7A7A\u4E32`));let C=(m.ui.content.data||[]).find(P=>P.details?.transform)?.details?.transform?.multiPlatform?.platforms||[];C.length!==4&&r.push(`${w}: \u591A\u5E73\u53F0\u53D8\u6362\u6570\u91CF=${C.length}\uFF0C\u5E94\u4E3A 4`);let z=C.map(P=>P.platformType||0);JSON.stringify(z)!==JSON.stringify([0,1,2,3])&&r.push(`${w}: \u5E73\u53F0\u987A\u5E8F ${z.join(",")}\uFF0C\u5E94\u4E3A 0,1,2,3`);let k=(m.ui.content.data||[]).find(P=>P.details?.transform)?.details?.transform;k?.multiPlatform?.field502!==xi[v]&&r.push(`${w}: \u53D8\u6362 preset=${k?.multiPlatform?.field502??"<missing>"}\uFF0C${v} \u5E94\u4E3A ${xi[v]}`);for(let P of C)o(P.transform,"field508")?h+=1:r.push(`${w}: RectTransform \u7F3A\u5C11\u663E\u5F0F field508 \u7A7A\u4E32`);c.push({id:p,name:m.name||"",kind:v,template:y,parent:b.parent||0,children:[...b.children||[]],relatedIds:(m.relatedIds||[]).map(P=>P.id||0),dataSignatures:S})}for(let m of c){let p=`${m.name||"<unnamed>"}(${m.id})`;if(JSON.stringify(m.relatedIds)!==JSON.stringify(m.children)&&r.push(`${p}: GraphUnit.relatedIds \u4E0E content.children \u4E0D\u4E00\u81F4`),m.template&&m.parent&&r.push(`${p}: \u9876\u5C42\u6A21\u677F\u4E0D\u5E94\u6709 parent`),!m.template){let b=s.get(m.parent);b?(b.ui?.content?.children||[]).includes(m.id)||r.push(`${p}: \u7236\u63A7\u4EF6 children \u672A\u53CD\u5411\u5305\u542B\u81EA\u8EAB`):r.push(`${p}: parent=${m.parent||"<missing>"} \u4E0D\u5B58\u5728`)}for(let b of m.children){let v=s.get(b);v?(v.ui?.content?.parent||0)!==m.id&&r.push(`${p}: child=${b} \u7684 parent \u672A\u6307\u56DE\u81EA\u8EAB`):r.push(`${p}: child=${b} \u4E0D\u5B58\u5728`)}}return{valid:r.length===0,errors:r,filePath:i.filePath||"",gameVersion:i.gameVersion||"",templateCount:l.length,accessoryCount:a.length,templates:l,units:c,explicitEmpty:{field17:f,rectField508:h}}}function Va(e){let t=vn(e),i=De.toObject(De.decode(t),{longs:Number,enums:Number,defaults:!1,arrays:!0,objects:!0}),n=(i.graph||[]).filter(k=>k.ui?.content&&Number(k.which)===21),a=(i.graph||[]).filter(k=>Number(k.which)===70),r=(i.graph||[]).filter(k=>Number(k.which)===It),o=(i.accessories||[]).filter(k=>k.ui?.content),s=[],c=(k,P)=>k!=null&&Object.prototype.hasOwnProperty.call(k,P);/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i.filePath||"")||s.push(`Root.filePath \u4E0D\u662F UID-TIME-ID-\\\u6587\u4EF6\u540D.gia\uFF1A${i.filePath||"<missing>"}`),n.length!==1&&s.push(`\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F UIControlGroup \u6570\u91CF=${n.length}\uFF0C\u5E94\u4E3A 1`);let l=(i.graph||[]).filter(k=>{let P=Number(k.which);return P===It||P===70||P===21?!1:!k.ui?.content});l.length&&s.push(`Root.graph \u542B ${l.length} \u4E2A\u65E0\u6CD5\u8BC6\u522B\u7684\u975E\u63A7\u4EF6/\u975E\u811A\u672C\u5355\u5143`);let d=n[0];if(!d)return{valid:!1,errors:s,filePath:i.filePath||"",gameVersion:i.gameVersion||"",accessoryCount:o.length,controls:[],scriptCount:r.length,explicitEmpty:{field17:0,rectField508:0}};let f=[d,...a,...o],h=new Map;for(let k of f){let P=k.id?.id||0,B=`${k.name||"<unnamed>"}(${P||"<missing-guid>"})`;Te(P)?h.has(P)?s.push(`${B}: GUID \u91CD\u590D`):h.set(P,k):s.push(`${B}: GraphUnit GUID \u975E\u6CD5\uFF08\u5141\u8BB8 0x40000000\u20130x403FFFFF\uFF09`),(k.id?.class!==1||k.id?.type!==8)&&s.push(`${B}: GraphUnit.id \u5FC5\u987B\u4E3A class=1,type=8`),k.ui?.content?.guid!==P&&s.push(`${B}: content.guid \u4E0E GraphUnit.id.id \u4E0D\u4E00\u81F4`)}let m=d.id?.id||0,p=d.ui.content,b=`${d.name||"<unnamed>"}(${m})`;d.which!==21&&s.push(`${b}: which \u5FC5\u987B\u4E3A UIControlGroup(21)`);let v=p.info||[];v.find(k=>k.field501===1&&k.field502===5)?.guid?.value!==m&&s.push(`${b}: Info.self GUID \u7F3A\u5931\u6216\u4E0D\u4E00\u81F4`),v.find(k=>k.field501===2&&k.field502===6)?.index?.value!==1&&s.push(`${b}: Info.index \u5FC5\u987B\u4E3A 1`);let y=v.find(k=>k.field501===4&&k.field502===4);y||s.push(`${b}: \u7F3A\u5C11\u663E\u5F0F Info.related \u8BB0\u5F55`);let w=0,_=0,T=(k,P,B,j=!1)=>{let ae=k.id?.id||0,X=`${k.name||"<unnamed>"}(${ae})`,ie=k.ui.content.data||[],Oe=ie.map(oe=>`${oe.field501}/${oe.field502}`),Dt=B.map(([oe])=>oe);JSON.stringify(Oe)!==JSON.stringify(Dt)&&s.push(`${X}: Data \u69FD\u4F4D\u987A\u5E8F ${Oe.join(",")}\uFF0C\u5E94\u4E3A ${Dt.join(",")}`);for(let oe=0;oe<Math.min(ie.length,B.length);oe+=1){let Be=ie[oe],[He,Ki,zt]=B[oe];if(c(Be,Ki)||s.push(`${X}: Data ${He} \u7F3A\u5C11 ${Ki} \u5206\u652F`),!zt)continue;c(Be.details,zt)||s.push(`${X}: Details ${He} \u7F3A\u5C11 ${zt} \u5206\u652F`);let qi=Jo[He];(Be.details?.field501!==qi||Be.details?.field502!==Be.field502||Be.details?.field503!==1)&&s.push(`${X}: Details ${He} \u6807\u8BB0\u5E94\u4E3A ${qi}/${Be.field502}/1`);let Gt=Be.details?.nodeRef;(Gt?.class!==1||Gt?.type!==8||Gt?.id!==ae)&&s.push(`${X}: Details ${He} node_ref \u672A\u6307\u5411\u81EA\u8EAB`)}let li=ie.find(oe=>oe.field501===4&&oe.field502===(j?23:86)),re=j?"empty15":"field17";c(li?.field14,re)?j||(w+=1):s.push(`${X}: \u7C7B\u578B Data \u7F3A\u5C11\u663E\u5F0F Field14.${re} \u7A7A\u4E32`),c(li?.details?.field14,re)?j||(w+=1):s.push(`${X}: \u7C7B\u578B Details \u7F3A\u5C11\u663E\u5F0F Field14.${re} \u7A7A\u4E32`);let Ve=ie.find(oe=>oe.details?.transform)?.details?.transform,mt=Ve?.multiPlatform?.platforms||[];mt.length!==4&&s.push(`${X}: \u591A\u5E73\u53F0\u53D8\u6362\u6570\u91CF=${mt.length}\uFF0C\u5E94\u4E3A 4`);let Xi=mt.map(oe=>oe.platformType||0);JSON.stringify(Xi)!==JSON.stringify([0,1,2,3])&&s.push(`${X}: \u5E73\u53F0\u987A\u5E8F ${Xi.join(",")}\uFF0C\u5E94\u4E3A 0,1,2,3`);let Wi=j?xi["server-container"]:xi[P];Ve?.multiPlatform?.field502!==Wi&&s.push(`${X}: \u53D8\u6362 preset=${Ve?.multiPlatform?.field502??"<missing>"}\uFF0C\u5E94\u4E3A ${Wi}`);for(let oe of mt)c(oe.transform,"field508")?_+=1:s.push(`${X}: RectTransform \u7F3A\u5C11\u663E\u5F0F field508 \u7A7A\u4E32`);return Oe};T(d,"server-container",Vd,!0);let N=(d.relatedIds||[]).map(k=>k.id||0),O=new Set(N),V=o.filter(k=>O.has(k.id?.id||0)),$=V.map(k=>k.id?.id||0);JSON.stringify(N)!==JSON.stringify($)&&s.push(`${b}: \u4E3B\u56FE relatedIds \u5FC5\u987B\u6309\u987A\u5E8F\u8986\u76D6\u672C\u7EC4 accessories`);let S=p.data?.find(k=>k.details?.rootChildRef)?.details?.rootChildRef?.guid||0,A=h.get(S);(!A||!V.includes(A))&&s.push(`${b}: 62/82 \u6839\u8282\u70B9\u5F15\u7528\u4E0D\u5B58\u5728`),$[0]!==S&&s.push(`${b}: \u6839\u5BB9\u5668\u8282\u70B9\u5FC5\u987B\u662F\u672C\u7EC4 accessories[0]`);let E=[];for(let k of V){let P=k.id?.id||0,B=k.ui.content,j=`${k.name||"<unnamed>"}(${P})`,ae=wn(k);k.which!==15&&s.push(`${j}: which \u5FC5\u987B\u4E3A UIControl(15)`);let X=B.info||[];(X.length!==1||X[0]?.field501!==1||X[0]?.field502!==5||X[0]?.guid?.value!==P)&&s.push(`${j}: \u670D\u52A1\u7AEF\u5BB9\u5668\u5185\u63A7\u4EF6 Info \u5FC5\u987B\u53EA\u542B\u81EA\u8EAB GUID`);let ie=qo[ae];ie||s.push(`${j}: \u672A\u77E5\u5BA2\u6237\u7AEF\u63A7\u4EF6\u7C7B\u578B ${ae}`);let Oe=ie?T(k,ae,ie):[];E.push({id:P,name:k.name||"",kind:ae,parent:B.parent||0,children:[...B.children||[]],relatedIds:(k.relatedIds||[]).map(Dt=>Dt.id||0),dataSignatures:Oe})}let C=E.find(k=>k.id===S);C&&(C.kind!=="container"&&s.push(`${C.name}(${S}): \u6839\u63A7\u4EF6\u5FC5\u987B\u4E3A\u5BB9\u5668\u8282\u70B9`),C.parent&&s.push(`${C.name}(${S}): \u6839\u63A7\u4EF6\u4E0D\u5E94\u6709 parent`));let z=new Map(E.map(k=>[k.id,k]));for(let k of E){let P=`${k.name}(${k.id})`;if(JSON.stringify(k.relatedIds)!==JSON.stringify(k.children)&&s.push(`${P}: relatedIds \u5FC5\u987B\u4E0E\u76F4\u63A5 children \u4E00\u81F4`),k.id!==S){let B=z.get(k.parent);B?B.children.includes(k.id)||s.push(`${P}: \u7236\u63A7\u4EF6 children \u672A\u53CD\u5411\u5305\u542B\u81EA\u8EAB`):s.push(`${P}: parent=${k.parent||"<missing>"} \u4E0D\u5B58\u5728`)}for(let B of k.children){let j=z.get(B);j?j.parent!==k.id&&s.push(`${P}: child=${B} \u7684 parent \u672A\u6307\u56DE\u81EA\u8EAB`):s.push(`${P}: child=${B} \u4E0D\u5B58\u5728`)}}if(a.length){let k=Ga(Da({...i,graph:a,accessories:o.filter(P=>!O.has(P.id?.id||0))}));s.push(...k.errors.map(P=>`\u5BA2\u6237\u7AEF\u6A21\u677F: ${P}`))}return{valid:s.length===0,errors:s,filePath:i.filePath||"",gameVersion:i.gameVersion||"",graph:{id:m,name:d.name||"",relatedGuids:y?.related?.value||[],rootGuid:S},accessoryCount:o.length,controls:E,scriptCount:r.length,explicitEmpty:{field17:w,rectField508:_}}}function ds(e,t=[]){if(!e||e.layoutSchemaVersion===we)return e;if(e.layoutSchemaVersion!==void 0&&e.layoutSchemaVersion!==1)throw new Error(`\u4EC5\u652F\u6301 layoutSchemaVersion=2 \u6216\u53EF\u8FC1\u79FB\u7684\u65E7\u5E03\u5C40\uFF0C\u6536\u5230 ${e.layoutSchemaVersion}`);if(!e.root)return{...e,layoutSchemaVersion:we};let i=structuredClone(e),n=0;return K(i.root,a=>{let r=a.transformByPlatform||{},o=a.transformByCanvas||{},s=a.name||a.id;for(let l of Object.keys(r))if(!fe.includes(l))throw new Error(`${s}: unknown platform ${l}`);let c={};for(let l of fe){let d=Vt[l],f=J[d].platform,h=Object.keys(J).filter(v=>J[v].platform===f&&o[v]),m=o[d]?d:h[0],p=l==="CONTROLLER_CONSOLE"?c.KEYBOARD:l==="CONTROLLER_MOBILE"?c.TOUCHSCREEN:null,b=r[l]??p??(m?o[m]:null);if(c[l]=b?je(b):ba(a.kind),b||t.push(`${s}: ${l} \u65E0\u65E7\u5E03\u5C40\uFF0C\u5DF2\u4F7F\u7528\u63A7\u4EF6\u9ED8\u8BA4\u503C`),!r[l]&&!p&&m&&m!==d&&t.push(`${s}: \u7F3A\u5C11 ${d}\uFF0C\u5DF2\u91C7\u7528 ${m} \u7684\u951A\u70B9\u548C\u5C3A\u5BF8\u53C2\u6570`),!p)for(let v of h)JSON.stringify(c[l])!==JSON.stringify(je(o[v]))&&t.push(`${s}: ${v} \u4E0E ${l} \u5E03\u5C40\u51B2\u7A81\uFF0C\u4FDD\u7559${r[l]?"\u5DF2\u6709\u5E73\u53F0":m}\u53C2\u6570`)}rt(c,`${s}.transformByPlatform`),a.transformByPlatform=c,delete a.transformByCanvas,n++}),i.layoutSchemaVersion=we,t.unshift(`\u5DF2\u81EA\u52A8\u8FC1\u79FB\u65E7\u5E03\u5C40\uFF1A${n} \u4E2A\u63A7\u4EF6\u8F6C\u6362\u4E3A\u56DB\u5E73\u53F0\u53C2\u6570\uFF1B\u518D\u6B21\u4FDD\u5B58\u5C06\u4F7F\u7528\u65B0\u7248\u683C\u5F0F`),i}function Ba(e){if(![1,2,3,4].includes(e))throw new Error(`\u4EC5\u652F\u6301 version=1\u20134 \u7684\u5B58\u6863\uFF0C\u6536\u5230 ${e}`)}function La(e,t,i,n=e.canvasId){let a=st(e.root,t);return!a||a.kind==="server-container"?ve(n):i[a.id]||ve(n)}function ft(e,{warnings:t=[]}={}){if(!e)return wt();if(e=ds(e,t),(e.root||e.layoutSchemaVersion!==void 0)&&e.layoutSchemaVersion!==we)throw new Error(`\u4EC5\u652F\u6301 layoutSchemaVersion=${we} \u7684\u56DB\u5E73\u53F0\u5E03\u5C40\uFF0C\u4E0D\u652F\u6301\u65E7\u753B\u5E03\u5E03\u5C40\u6216\u5176\u4ED6\u7248\u672C`);let i=e.meta?.assetType==="client-control-template"?"client-control-template":"server-control-template",n=i==="client-control-template"?Yt():wt(),a={layoutSchemaVersion:we,version:Number.isSafeInteger(e.version)&&e.version>0?e.version:1,meta:{name:String(e.meta?.name||n.meta.name),assetType:i,sourceFormat:String(e.meta?.sourceFormat||n.meta.sourceFormat),sourceFile:String(e.meta?.sourceFile||""),...e.meta?.gameVersion?{gameVersion:String(e.meta.gameVersion)}:{},...e.meta?.giaFilePath?{giaFilePath:String(e.meta.giaFilePath)}:{},...Number.isSafeInteger(Number(e.meta?.giaOwnerUid))?{giaOwnerUid:Number(e.meta.giaOwnerUid)}:{},...Number.isSafeInteger(Number(e.meta?.giaTimestamp))?{giaTimestamp:Number(e.meta.giaTimestamp)}:{},...Number.isSafeInteger(Number(e.meta?.giaFileId))?{giaFileId:Number(e.meta.giaFileId)}:{},...e.meta?.giaFileName?{giaFileName:String(e.meta.giaFileName)}:{},...Number.isSafeInteger(e.meta?.giaNextAssetIndex)&&e.meta.giaNextAssetIndex>=2?{giaNextAssetIndex:e.meta.giaNextAssetIndex}:{},...Number.isSafeInteger(e.meta?.giaAssetIndexSchemaVersion)&&e.meta.giaAssetIndexSchemaVersion>0?{giaAssetIndexSchemaVersion:e.meta.giaAssetIndexSchemaVersion}:{},...Number.isSafeInteger(Number(e.meta?.giaModeFlag))&&Number(e.meta.giaModeFlag)>=0?{giaModeFlag:Number(e.meta.giaModeFlag)}:{}},canvasId:e.canvasId&&J[e.canvasId]?e.canvasId:an,selectedId:e.selectedId||n.selectedId,root:wa(e.root||n.root)};return ps(a),Qe(a,{warnings:t}),a}function ps(e){let t=new Set;K(e.root,i=>{if(typeof i.id!="string"||!i.id)throw new Error("node id must be a non-empty string");if(t.has(i.id))throw new Error(`duplicate node id: ${i.id}`);t.add(i.id)}),t.has(e.selectedId)||(e.selectedId=ya(e.root).id)}function fs(e){return ot(jt(e))}function Zd(e,t){let i=!1;return K(e,n=>{n.id===t&&(i=!0)}),i}function e0(e,t,i,n){let r=lt(e.root,e.canvasId).boxes[t.id],o=i.children.findIndex(f=>f.id===t.id);if(o<0)throw new Error("reparent: source node is not attached");if(i.children.splice(o,1),n.children.push(t),!r)return;let s=lt(e.root,e.canvasId),c=n.kind==="server-container"?ve(e.canvasId):s.boxes[n.id]||ve(e.canvasId),l=ct(t.transformByPlatform,e.canvasId),d=pt(c,l,{posX:r.centerX,posY:r.centerY,width:r.width,height:r.height});Jt(e,t,d)}function t0(e,t){return e.meta.assetType!=="client-control-template"?Ta(e.root,t):(e.root.children||[]).flatMap(i=>Ta(i,t))}function bs(e,t){let i=Lo(e.root,t);if(e.meta.assetType!=="client-control-template")return i;let n=vi(e),a=new Set;return n&&n.kind!=="server-container"&&K(n,r=>a.add(r.id)),i.filter(r=>a.has(r.id))}function Ua(e){let{canvas:t,boxes:i}=lt(e.root,e.canvasId),n=Ii(e,new Set,{preserveLegacy:!0}),a=me(e.root,e.selectedId),r=a?i[a.id]:null;return L({layoutSchemaVersion:we,version:e.version,meta:{...e.meta},canvasId:e.canvasId,canvas:{id:e.canvasId,width:t.width,height:t.height,platform:J[e.canvasId].platform,label:J[e.canvasId].label,presets:Object.values(J).map(o=>({id:o.id,label:o.label,width:o.width,height:o.height,platform:o.platform}))},selectedId:e.selectedId,asset:{type:e.meta.assetType,label:e.meta.assetType==="client-control-template"?"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F",templateCount:e.meta.assetType==="client-control-template"?e.root.children.length:1,currentTemplateId:e.meta.assetType==="client-control-template"&&vi(e)?.id||""},tree:t0(e,n),boxes:bs(e,i),inspector:Uo(a,e.canvasId,r||t,n),root:e.root})}function Jt(e,t,i){let n=lt(e.root,e.canvasId),a=La(e,t.id,n.boxes),r={};if(t.syncAllDevices!==!1)for(let o of fe){if(o===bt(e.canvasId))continue;let s=Vt[o],c=lt(e.root,s,o);r[o]=La(e,t.id,c.boxes,s)}t.transformByPlatform=ko({transformByPlatform:t.transformByPlatform,source:i,canvasId:e.canvasId,syncAllDevices:t.syncAllDevices!==!1,sourceParentBox:a,targetParentBoxByPlatform:r})}var i0=new Set(["name","active","visible","canControllerFocus","isolateNavigation","disableKeyEventPassthrough","disableCursorEventPassthrough","showCursor","fontSize","adaptiveFontSize","minimumFontSize","fontColor","bgColor","enableOutline","outlineColor","horizontalAlignment","verticalAlignment","text","imageSource","imageType","imageId","imageColor","enableMask","enableSoftEdge","softEdgeMode","softEdgeWidthX","softEdgeWidthY","horizontalSoftRange","verticalSoftRange","enableFill","fillType","fillHorizontalType","fillVerticalType","fillRadial90Type","fillRadialType","fillAmount","reverseMaskArea","raycastTarget","interactable","clickAudioId","unavailableChildId","hoverChildId","pressedChildId","selectedChildId","showScrollBar","cellSizeX","cellSizeY","spacingX","spacingY","padding1X","padding1Y","padding2X","padding2Y","previewCount","scrollDirection","layoutConstraint","referencedPrefabId","animationId","playSoundEffect","layer","keyboardKeyCode","controllerKeyCode","itemPrefabId","layoutConstraintFixedCount"]),n0=new Set(["posX","posY","width","height"]),a0=new Set(["anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY"]);function r0(e){if(typeof e=="number"&&Number.isFinite(e))return e>>>0;if(typeof e=="string"){let t=e.trim();if(t.startsWith("#")){let n=t.slice(1);if(n.length===6)return(4278190080|parseInt(n,16))>>>0;if(n.length===8)return parseInt(n,16)>>>0}let i=Number(t);if(Number.isFinite(i))return i>>>0}throw new Error("color must be an ARGB integer or #RRGGBB/#AARRGGBB string")}function tt(e,t){let i=Number(e);if(!Number.isFinite(i))throw new Error(`${t} must be a finite number`);return i}function us(e){if(e===!0||e===1||e==="1"||e==="true")return!0;if(e===!1||e===0||e==="0"||e==="false")return!1;throw new Error("boolean field requires true or false")}var o0=new Set(["fontSize","minimumFontSize","imageId","clickAudioId","softEdgeWidthX","softEdgeWidthY","horizontalSoftRange","verticalSoftRange","fillAmount","cellSizeX","cellSizeY","spacingX","spacingY","padding1X","padding1Y","padding2X","padding2Y","previewCount","keyboardKeyCode","controllerKeyCode","itemPrefabId","layoutConstraintFixedCount"]),s0=new Set(["active","visible","canControllerFocus","isolateNavigation","disableKeyEventPassthrough","disableCursorEventPassthrough","showCursor","adaptiveFontSize","enableOutline","enableMask","enableSoftEdge","enableFill","reverseMaskArea","raycastTarget","interactable","showScrollBar","playSoundEffect"]),c0=new Set(["name","imageSource","horizontalAlignment","verticalAlignment","text","softEdgeMode","fillType","fillHorizontalType","fillVerticalType","fillRadial90Type","fillRadialType","scrollDirection","layoutConstraint","referencedPrefabId","animationId"]),hs=new Set(["unavailableChildId","hoverChildId","pressedChildId","selectedChildId"]),ms={layer:["AboveAllControls","BelowAllControls"],imageSource:["StaticReference","Prefab"],imageType:["Basic","Stretch",null],scrollDirection:["Horizontal","Vertical"],layoutConstraint:["AutoWrap","Fixed"],softEdgeMode:["Percentage","Pixel"],fillType:["Horizontal","Vertical","Radial90","Radial180","Radial360"],fillHorizontalType:["Left","Right"],fillVerticalType:["Bottom","Top"],fillRadial90Type:["BottomLeft","TopLeft","TopRight","BottomRight"],fillRadialType:["Bottom","Left","Top","Right"]};function l0(e,t){if(!t||typeof t!="object")throw new Error("patch requires op");let i=t.op;if(i==="select")return t.id&&me(e.root,t.id)&&(e.selectedId=t.id),e;if(i==="pick"){let{boxes:n}=lt(e.root,e.canvasId),a=bs(e,n),r=jo(a,Number(t.x),Number(t.y));return r&&(e.selectedId=r),e}if(i==="setCanvas")return t.canvasId&&J[t.canvasId]&&(e.canvasId=t.canvasId),e;if(i==="setScript")throw new Error("\u811A\u672C\u7531\u5B58\u6863\u7EDF\u4E00\u7BA1\u7406\uFF0C\u8BF7\u4F7F\u7528 addScript / updateScript / removeScript \u64CD\u4F5C");if(i==="newAsset"){let n=t.assetType==="client-control-template"?Yt():wt();return e.version=n.version,e.meta=n.meta,e.canvasId=n.canvasId,e.selectedId=n.selectedId,e.root=n.root,e}if(i==="addTemplate"){if(e.meta.assetType!=="client-control-template")throw new Error("\u53EA\u6709\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5DE5\u7A0B\u53EF\u4EE5\u65B0\u589E\u6A21\u677F");let n=Q(t.kind,{id:ga(e.root),guid:fs(e.root),name:t.name||`\u65B0${t.kind==="container"?"\u5BB9\u5668\u8282\u70B9":t.kind}\u6A21\u677F`});return e.root.children.push(n),e.selectedId=n.id,e}if(i==="add"){let n=me(e.root,t.parentId||e.selectedId);if(!n)throw new Error("add: parent not found");let a=Eo(n,t.kind,{id:ga(e.root),guid:fs(e.root),name:t.name});return e.selectedId=a.id,e}if(i==="reparent"){if(e.meta.assetType!=="client-control-template")throw new Error("\u5C42\u7EA7\u8C03\u6574\u4EC5\u9002\u7528\u4E8E\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5DE5\u7A0B");let n=me(e.root,t.id||e.selectedId),a=n?st(e.root,n.id):null,r=me(e.root,t.parentId);if(!n||n.kind==="server-container"||!a)throw new Error("reparent: node not found");if(!r)throw new Error("reparent: parent not found");if(r.id===n.id||Zd(n,r.id))throw new Error("\u63A7\u4EF6\u4E0D\u80FD\u79FB\u52A8\u5230\u81EA\u8EAB\u6216\u5176\u540E\u4EE3\u4E0B\u9762");if(r.kind==="server-container"&&a.kind==="server-container")return e;if(a.kind==="server-container"&&r.kind!=="server-container"&&e.root.children.length<=1)throw new Error("\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868\u81F3\u5C11\u4FDD\u7559\u4E00\u4E2A\u9876\u5C42\u6A21\u677F");return e0(e,n,a,r),e.selectedId=n.id,e}if(i==="moveSibling"){let n=me(e.root,t.id||e.selectedId),a=n?st(e.root,n.id):null;if(!n||!a)throw new Error("moveSibling: node not found");let r=a.children.findIndex(c=>c.id===n.id),o=t.direction==="up"?-1:t.direction==="down"?1:0,s=r+o;return!o||s<0||s>=a.children.length||(a.children.splice(r,1),a.children.splice(s,0,n),e.selectedId=n.id),e}if(i==="remove"){let n=t.id||e.selectedId,a=st(e.root,n);if(a?.kind==="server-container"){if(e.meta.assetType!=="client-control-template")throw new Error("\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F\u7684\u5BA2\u6237\u7AEF\u6839\u8282\u70B9\u4E0D\u80FD\u5220\u9664");if((e.root.children||[]).length<=1)throw new Error("\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868\u81F3\u5C11\u4FDD\u7559\u4E00\u4E2A\u6A21\u677F")}return Io(e.root,n)&&(K(e.root,r=>{if(r.kind==="button")for(let o of hs)r[o]&&!me(e.root,r[o])&&(r[o]=null)}),e.selectedId=a?a.id:e.root.id),e}if(i==="set"){let n=me(e.root,t.id||e.selectedId);if(!n)throw new Error("set: node not found");let a=t.key;a==="reverseMask"&&(a="reverseMaskArea");let r=t.value;if(n.kind==="reference"&&["referencedPrefabId","giaRaw.templateRefSlot"].includes(a)&&(n.giaRaw.templateRefSlotBase64||n.giaRaw.templateRefOuterBase64))throw new Error("\u8BE5\u6A21\u677F\u5F15\u7528\u542B\u5C1A\u672A\u89E3\u6790\u7684\u539F\u59CB\u914D\u7F6E\uFF0C\u6682\u4E0D\u80FD\u6539\u5199\u76EE\u6807\u7D22\u5F15\uFF1B\u8BF7\u5728\u5B98\u65B9\u7F16\u8F91\u5668\u4FEE\u6539\u540E\u91CD\u65B0\u5BFC\u5165");if(a.startsWith("giaRaw.")){let l=a.slice(7);if(!l||l.includes("."))throw new Error("invalid raw GIA field path");let d=vo(n.kind,l);if(!d)throw new Error(`unknown raw GIA field for ${n.kind}: ${l}`);if(n.giaRaw||={},n.giaRaw[l]=fa(d,r),l==="footerField505"&&[0,1].includes(n.giaRaw[l])&&(n.canControllerFocus=n.giaRaw[l]===1),n.kind==="cursor"&&l==="cursorField501"&&[0,1].includes(n.giaRaw[l])&&(n.raycastTarget=n.giaRaw[l]===1),(n.kind==="textbox"||n.kind==="textwindow")&&l==="textAlign"){let f={0:"Left",1:"Middle",2:"Right"}[n.giaRaw[l]];f&&(n.horizontalAlignment=f)}if(n.kind==="image"&&l==="imageFillType"){let f={1:"Horizontal",2:"Vertical",3:"Radial90",4:"Radial180",5:"Radial360"}[n.giaRaw[l]];f&&(n.fillType=f)}return n.kind==="keyhint"&&l==="keyHintField502"&&(n.keyboardKeyCode=n.giaRaw[l]),n.kind==="keyhint"&&l==="keyHintField501"&&(n.controllerKeyCode=n.giaRaw[l]),e}if(a==="syncAllDevices"){if(n.syncAllDevices=us(r),n.syncAllDevices){let l=ct(n.transformByPlatform,e.canvasId);Jt(e,n,l)}return e}if(i0.has(a)){if(a==="layer"&&n.kind!=="animation")throw new Error("layer is only available on UI animations");if(a==="playSoundEffect"&&!["animation","fullscreen"].includes(n.kind))throw new Error("playSoundEffect requires an animation control");if(a.endsWith("Color")&&(r=r0(r)),o0.has(a)){if(r=tt(r,a),r<0)throw new Error(`${a} must not be negative`);if((a==="imageId"||a==="clickAudioId"||a==="keyboardKeyCode"||a==="controllerKeyCode")&&(r=Math.trunc(r)),a==="fillAmount"&&r>1)throw new Error("fillAmount must be between 0 and 1")}if(s0.has(a)&&(r=us(r)),c0.has(a)&&(r=String(r??"")),a==="horizontalAlignment"&&!["Left","Middle","Right"].includes(r))throw new Error("invalid horizontalAlignment");if(a==="verticalAlignment"&&!["Top","Middle","Bottom"].includes(r))throw new Error("invalid verticalAlignment");if(ms[a]&&!ms[a].includes(r))throw new Error(`invalid ${a}`);if(hs.has(a))if(r===""||r===void 0||r===null)r=null;else{r=String(r);let l=me(e.root,r);if(!l||l===n||l.kind==="server-container"||!(n.children||[]).some(d=>d.id===r))throw new Error(`${a} must reference a direct child of this button`)}if(n.kind==="image"&&(a==="imageSource"||a==="imageId")&&n[a]!==r&&(n.imageType=null,n.giaRaw.imageSlotType=0),n[a]=r,n.kind==="image"&&a==="imageType"&&(n.giaRaw.imageSlotType=r==="Stretch"?1:0),a==="canControllerFocus"&&(n.giaRaw.footerField505=r?1:0),n.kind==="cursor"&&a==="raycastTarget"&&(n.giaRaw.cursorField501=r?1:0),(n.kind==="textbox"||n.kind==="textwindow")&&a==="horizontalAlignment"&&(n.giaRaw.textAlign={Left:0,Middle:1,Right:2}[r]),(n.kind==="textbox"||n.kind==="textwindow")&&a==="verticalAlignment"&&delete n.giaRaw.textVerticalAlign,n.kind==="image"&&a==="fillType"){let l={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[r];l&&(n.giaRaw.imageFillType=l)}return n.kind==="reference"&&a==="referencedPrefabId"&&(n.giaRaw.templateRefSlot=r),n.kind==="grid"&&a==="previewCount"&&(n.giaRaw.gridField511=Math.trunc(r)),n.kind==="keyhint"&&a==="keyboardKeyCode"&&(n.giaRaw.keyHintField502=Math.trunc(r)),n.kind==="keyhint"&&a==="controllerKeyCode"&&(n.giaRaw.keyHintField501=Math.trunc(r)),(n.kind==="animation"||n.kind==="fullscreen")&&a==="animationId"&&(n.giaRaw[n.kind==="animation"?"effectSlot":"fullscreenEffectSlot"]=r),e}let{boxes:o}=lt(e.root,e.canvasId),s=La(e,n.id,o),c=ct(n.transformByPlatform,e.canvasId);if(a==="anchorType"){let l=Ha(o[n.id]),d=po(c,r);return d=pt(s,d,l),Jt(e,n,d),e}if(["rotationX","rotationY","rotationZ"].includes(a)){let l={...c,rotation:{...c.rotation,[a.slice(-1).toLowerCase()]:tt(r,a)}};return Jt(e,n,l),e}if(a0.has(a)){let l=Ha(o[n.id]),d={...c,anchorMin:{...c.anchorMin},anchorMax:{...c.anchorMax},pivot:{...c.pivot}};return a==="anchorMinX"&&(d.anchorMin.x=tt(r,a)),a==="anchorMinY"&&(d.anchorMin.y=tt(r,a)),a==="anchorMaxX"&&(d.anchorMax.x=tt(r,a)),a==="anchorMaxY"&&(d.anchorMax.y=tt(r,a)),a==="pivotX"&&(d.pivot.x=tt(r,a)),a==="pivotY"&&(d.pivot.y=tt(r,a)),Jt(e,n,pt(s,d,l)),e}if(n0.has(a)){let l=Ha(o[n.id]),d=tt(r,a);if((a==="width"||a==="height")&&d<0)throw new Error(`${a} must not be negative`);return l[a]=d,Jt(e,n,pt(s,c,l)),e}throw new Error(`set: unknown key ${a}`)}if(i==="replace"){let n=ft(t.project);return e.version=n.version,e.meta=n.meta,e.canvasId=n.canvasId,e.selectedId=n.selectedId,e.root=n.root,e}throw new Error(`unknown op ${i}`)}function ja(e,t){if(!t||typeof t!="object")throw new Error("patch requires op");if(t.expectedRevision!==void 0&&Number(t.expectedRevision)!==e.version)throw new Error(`revision conflict: expected ${t.expectedRevision}, current ${e.version}`);let i=e.version,n=JSON.parse(JSON.stringify(e));return l0(n,t),ps(n),Qe(n),n.version=i+1,Object.keys(e).forEach(a=>{delete e[a]}),Object.assign(e,n),e}function Ha(e){return e?{posX:e.centerX,posY:e.centerY,width:e.width,height:e.height}:{posX:0,posY:0,width:0,height:0}}import d0 from"fengari";var{lua:u,lauxlib:Z,lualib:gs,to_luastring:Sn,to_jsstring:f0}=d0,u0=u.LUA_TNIL,h0=u.LUA_TBOOLEAN,m0=u.LUA_TNUMBER,p0=u.LUA_TSTRING,ys=u.LUA_TTABLE,b0=u.LUA_TFUNCTION,Ya=u.LUA_TUSERDATA,ze=u.LUA_OK,ws=new WeakMap,Xa=Symbol("luaTableEntries"),Wa={__scriptHostKey:!0};function F(e){return Sn(String(e))}function Ct(e,t){ws.set(e,t)}function _e(e){return ws.get(e)}var Ci=class{constructor(t){this.value=t}};function ce(e,t,i){if(i instanceof Ci){u.lua_pushnumber(e,i.value);return}if(i==null){u.lua_pushnil(e);return}let n=typeof i;if(n==="boolean"){u.lua_pushboolean(e,i);return}if(n==="number"){Number.isInteger(i)&&Math.abs(i)<=2147483647?u.lua_pushinteger(e,i):u.lua_pushnumber(e,i);return}if(n==="string"){u.lua_pushstring(e,F(i));return}if(n==="function"){w0(e,t,i);return}if(i&&i[Xa]){let a=i[Xa];u.lua_createtable(e,Array.isArray(i)?i.length:0,a.length);for(let[r,o]of a)ce(e,t,r),ce(e,t,o),u.lua_settable(e,-3);return}if(Array.isArray(i)){u.lua_createtable(e,i.length,0);for(let a=0;a<i.length;a++)ce(e,t,i[a]),u.lua_rawseti(e,-2,a+1);return}if(i&&i.__kind==="EnumItem"){t.pushEnumItem(e,i);return}if(i&&i.__kind==="CursorEventData"){t.pushCursor(e,i);return}if(i&&i.__kind==="Script"){t.pushScript(e,i);return}if(i&&i.typeofName){t.pushControl(e,i);return}if(i&&i.__kind==="ServerSignal"){t.pushSignal(e,i);return}if(i&&(i.SetEase||i.Append)){t.pushTween(e,i);return}if(n==="object"){u.lua_createtable(e,0,Object.keys(i).length);for(let[a,r]of Object.entries(i))ce(e,t,r),u.lua_setfield(e,-2,F(a));return}u.lua_pushnil(e)}function te(e,t){if(u.lua_isnil(e,t)||u.lua_type(e,t)===u.LUA_TNONE)return"";if(!u.lua_isstring(e,t)&&u.lua_type(e,t)!==u.LUA_TNUMBER)return`lua_type=${u.lua_type(e,t)}`;let i=u.lua_tostring(e,t);return i==null?"":f0(i)}function it(e,t){t=u.lua_absindex(e,t);let i=u.lua_type(e,t);if(i===Ya)return _e(u.lua_touserdata(e,t));if(i===ys){u.lua_pushlightuserdata(e,Wa),u.lua_rawget(e,t);let n=u.lua_type(e,-1)===Ya?u.lua_touserdata(e,-1):null;return u.lua_pop(e,1),n?_e(n):null}return null}function be(e,t,i){i=u.lua_absindex(e,i);let n=u.lua_type(e,i);if(n===u0)return null;if(n===h0)return!!u.lua_toboolean(e,i);if(n===m0)return u.lua_isinteger(e,i)?u.lua_tointeger(e,i):u.lua_tonumber(e,i);if(n===p0)return te(e,i);if(n===Ya){let a=u.lua_touserdata(e,i);return _e(a)??a}if(n===b0)return g0(e,t,i);if(n===ys){let a=it(e,i);if(a)return a;let r=[];for(u.lua_pushnil(e);u.lua_next(e,i)!==0;){let l=be(e,t,-2),d=be(e,t,-1);r.push([l,d]),u.lua_pop(e,1)}let o=new Map(r.filter(([l])=>Number.isInteger(l)&&l>=1)),s=0;for(;o.has(s+1);)s+=1;let c=s>0?[]:{};for(let[l,d]of r)Array.isArray(c)&&Number.isInteger(l)&&l>=1?c[l-1]=d:(typeof l=="string"||typeof l=="number")&&(c[l]=d);return Object.defineProperty(c,Xa,{value:r}),c}return null}function g0(e,t,i){t.luaFunctions||(t.luaFunctions=new Map);let n=typeof u.lua_topointer=="function"?u.lua_topointer(e,i):null;if(n!=null&&t.luaFunctions.has(n))return t.luaFunctions.get(n);u.lua_pushvalue(e,i);let a=Z.luaL_ref(e,u.LUA_REGISTRYINDEX),r=y0(e,t,a);return n!=null&&t.luaFunctions.set(n,r),r}function y0(e,t,i){let n=(...a)=>{if(n.__luaRef==null)throw new Error("attempt to call a released Lua callback");let r=u.lua_gettop(e);u.lua_rawgeti(e,u.LUA_REGISTRYINDEX,n.__luaRef);for(let l of a)ce(e,t,l);if(u.lua_pcall(e,a.length,u.LUA_MULTRET,0)!==ze){let l=te(e,-1);throw u.lua_settop(e,r),new Error(l)}let s=u.lua_gettop(e)-r,c=[];for(let l=1;l<=s;l++)c.push(be(e,t,r+l));if(u.lua_settop(e,r),c.length!==0)return c.length===1?c[0]:c};return n.__luaRef=i,n.__luaState=e,n}function vs(e){e?.__luaRef!=null&&(e.__luaHolds=(e.__luaHolds||0)+1)}function Ss(e,t){if(!t||t.__luaRef==null||!t.__luaState)return;if(t.__luaHolds>1){t.__luaHolds-=1;return}let i=t.__luaState;if((!e?.luaStates||e.luaStates.has(i))&&Z.luaL_unref(i,u.LUA_REGISTRYINDEX,t.__luaRef),t.__luaRef=null,t.__luaState=null,e?.luaFunctions)for(let[n,a]of e.luaFunctions)a===t&&e.luaFunctions.delete(n)}function w0(e,t,i){u.lua_pushlightuserdata(e,i),u.lua_pushlightuserdata(e,t),u.lua_pushcclosure(e,function(a){let r=u.lua_touserdata(a,u.lua_upvalueindex(1)),o=u.lua_touserdata(a,u.lua_upvalueindex(2)),s=u.lua_gettop(a),c=[];for(let l=1;l<=s;l++)c.push(be(a,o,l));try{let l=r(...c);if(Array.isArray(l)&&l.__multi){for(let d of l)ce(a,o,d);return l.length}return l===void 0?0:(ce(a,o,l),1)}catch(l){return u.lua_pushstring(a,F(String(l&&l.message?l.message:l))),u.lua_error(a)}},2)}function xs(e){!e||typeof u.lua_close!="function"||u.lua_close(e)}function Es(e){if(Z.luaL_loadstring(e,F(["local nativeGetMetatable = getmetatable","getmetatable = function(value)",' if type(value) == "string" then return nil end'," return nativeGetMetatable(value)","end"].join(`
|
|
114
|
+
`)))===ze&&u.lua_pcall(e,0,0,0),u.lua_settop(e,0),u.lua_pushnil(e),u.lua_setglobal(e,F("_VERSION")),u.lua_getglobal(e,F("string")),!u.lua_isnil(e,-1))for(let i of["dump","pack","unpack"])u.lua_pushnil(e),u.lua_setfield(e,-2,F(i));if(u.lua_pop(e,1),u.lua_pushnil(e),u.lua_setglobal(e,F("io")),u.lua_getglobal(e,F("os")),!u.lua_isnil(e,-1))for(let i of Object.keys({execute:1,getenv:1,remove:1,rename:1,tmpname:1,setlocale:1,exit:1}))u.lua_pushnil(e),u.lua_setfield(e,-2,F(i));u.lua_pop(e,1),u.lua_getglobal(e,F("debug")),u.lua_isnil(e,-1)?u.lua_pop(e,1):(u.lua_getfield(e,-1,F("traceback")),u.lua_newtable(e),u.lua_pushvalue(e,-2),u.lua_setfield(e,-2,F("traceback")),u.lua_setglobal(e,F("debug")),u.lua_pop(e,2)),u.lua_getglobal(e,F("math")),u.lua_isnil(e,-1)||(u.lua_pushcfunction(e,i=>{let n=u.lua_tonumber(i,1);return u.lua_pushboolean(i,Number.isNaN(n)),1}),u.lua_setfield(e,-2,F("isnan")),u.lua_pushcfunction(e,i=>{let n=u.lua_tonumber(i,1);return u.lua_pushboolean(i,n===1/0||n===-1/0),1}),u.lua_setfield(e,-2,F("isinf"))),u.lua_pop(e,1),u.lua_pushnil(e),u.lua_setglobal(e,F("package")),u.lua_pushnil(e),u.lua_setglobal(e,F("load")),u.lua_pushnil(e),u.lua_setglobal(e,F("loadfile")),u.lua_pushnil(e),u.lua_setglobal(e,F("dofile")),u.lua_pushnil(e),u.lua_setglobal(e,F("collectgarbage")),u.lua_pushnil(e),u.lua_setglobal(e,F("coroutine")),u.lua_pushnil(e),u.lua_setglobal(e,F("fengari"))}var Re=(e,t=0)=>Number.isFinite(Number(e))?Number(e):t,Is=e=>e?.Name||e,xn=e=>Math.max(0,Math.min(1,Re(e)));function ki(e){let t=e.parent?ki(e.parent):[e.runtime.canvasWidth,e.runtime.canvasHeight];return[Math.max(0,(e.anchorMaxX-e.anchorMinX)*t[0]+Re(e.sizeDeltaX)),Math.max(0,(e.anchorMaxY-e.anchorMinY)*t[1]+Re(e.sizeDeltaY))]}function Ai(e){let[t,i]=ki(e),n=Is(e.scrollDirection)==="Horizontal",a=Math.max(1,Re(e.cellSizeX,50)),r=Math.max(1,Re(e.cellSizeY,50)),o=Math.max(0,Re(e.spacingX)),s=Math.max(0,Re(e.spacingY)),c=Math.max(0,Re(e.padding1X)),l=Math.max(0,Re(e.padding1Y)),d=Math.max(0,Re(e.padding2X)),f=Math.max(0,Re(e.padding2Y)),h=n?i-l-f:t-c-d,m=n?r:a,p=n?s:o,b=Is(e.layoutConstraint)==="Fixed"?Math.max(1,Math.floor(Re(e.layoutConstraintFixedCount,1))):Math.max(1,Math.floor((h+p)/(m+p))),v=Math.ceil(e.itemCount/b),y=v?n?c+d+v*a+(v-1)*o:l+f+v*r+(v-1)*s:0,w=n?t:i,_=Math.max(0,y-w);return{width:t,height:i,horizontal:n,cellW:a,cellH:r,gapX:o,gapY:s,left:c,top:l,right:d,bottom:f,lanes:b,length:y,viewport:w,max:_,offset:xn(e.scrollProgress)*_}}function Qt(e){let t=Ai(e);for(let i=0;i<(e._gridItems?.length||0);i+=1){let n=e._gridItems[i];if(!n.alive||n.parent!==e)continue;let a=Math.floor(i/t.lanes),r=i%t.lanes,o=t.horizontal?a:r,s=t.horizontal?r:a,c=t.left+o*(t.cellW+t.gapX)+t.cellW/2-(t.horizontal?t.offset:0),l=-t.top-s*(t.cellH+t.gapY)-t.cellH/2+(t.horizontal?0:t.offset),d={anchorMinX:0,anchorMaxX:0,anchorMinY:1,anchorMaxY:1,pivotX:.5,pivotY:.5,sizeDeltaX:t.cellW,sizeDeltaY:t.cellH,anchoredPositionX:c,anchoredPositionY:l};Object.entries(d).some(([f,h])=>n[f]!==h)&&(Object.assign(n,d),n.markPlayDirty(!0))}return t}var Cs={container:"ClientUIContainerControl",textbox:"ClientUITextBoxControl",textwindow:"ClientUITextWindowControl",image:"ClientUIImageControl",button:"ClientUIPresetButtonControl",cursor:"ClientUICursorEventAreaControl",grid:"ClientUIGridScrollerControl",keyhint:"ClientUIKeyHintControl",animation:"ClientUIAnimationControl",fullscreen:"ClientUIFullscreenAnimationControl",reference:"ClientUIReferenceControl"},v0=["alive","id","Id","prefabIndex","active","activeInHierarchy","visible"],En=new Set(["active","visible","parent","sizeDeltaX","sizeDeltaY","anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY"]),S0=["name","parent","anchoredPositionX","anchoredPositionY","sizeDeltaX","sizeDeltaY","anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY","localScaleX","localScaleY","localScaleZ","localRotationX","localRotationY","localRotationZ","canControllerFocus"],x0={image:["imageSource","imageId"],grid:["itemCount","scrollDirection","layoutConstraint","layoutConstraintFixedCount"],reference:["referencedPrefabIndex"]},E0={container:["isolateNavigation","disableKeyEventPassthrough","disableCursorEventPassthrough","showCursor"],textbox:["text","fontSize","fontColor","bgColor","enableOutline","outlineColor","horizontalAlignment","verticalAlignment","adaptiveFontSize","minimumFontSize"],textwindow:["interactable","showScrollBar","text","fontSize","fontColor","bgColor","enableOutline","outlineColor","horizontalAlignment","verticalAlignment","adaptiveFontSize","minimumFontSize"],image:["imageColor","enableMask","enableSoftEdge","softEdgeMode","softEdgeWidthX","softEdgeWidthY","horizontalSoftRange","verticalSoftRange","reverseMaskArea","fillType","fillHorizontalType","fillVerticalType","fillRadial90Type","fillRadialType","fillAmount"],button:["interactable","clickAudioId","raycastTarget"],cursor:["raycastTarget"],grid:["itemPrefabIndex","raycastTarget","showScrollBar","interactable","scrollProgress"],keyhint:["keyboardKeyCode","controllerKeyCode"],animation:["animationId","playSoundEffect","layer"],fullscreen:["animationId","playSoundEffect"]},I0=["GetChildren","GetChild","FindChild","SetActive","SetVisible","GetSiblingIndex","SetSiblingIndex","SetAsFirstSibling","SetAsLastSibling","GetAnchoredPosition","SetAnchoredPosition","GetSizeDelta","SetSizeDelta","GetAnchorMin","SetAnchorMin","GetAnchorMax","SetAnchorMax","GetPivot","SetPivot","GetLocalScale","SetLocalScale","GetLocalRotation","SetLocalRotation","GetScriptByPath","GetScript","GetScripts","AddKeyEventListener","RemoveKeyEventListener","RemoveKeyEventListeners","RemoveAllKeyEventListeners","AddNavigationEventListener","RemoveNavigationEventListener","RemoveNavigationEventListeners","RemoveAllNavigationEventListeners","SetControllerNavigation","GetControllerNavigation"],ks=["AddCursorEventListener","RemoveCursorEventListener","RemoveCursorEventListeners","RemoveAllCursorEventListeners","SimulateCursorClick"],C0={image:["SetImage","SetSoftEdgeWidth","SetFillUnused","SetFillHorizontal","SetFillVertical","SetFillRadial90","SetFillRadial180","SetFillRadial360"],button:ks,cursor:ks,animation:["PlayAnimation","StopAnimation"],grid:["RefreshItems","GetItemIndex","GetItemSize","GetItemSpacing","GetPadding","ScrollToItemAt","GetContentLength"]};function qa(e,t){return e.kind==="image"&&t==="imageType"&&e.runtime.canSelectImageType(e.imageId,e.imageSource)?"rw":v0.includes(t)||(x0[e.kind]||[]).includes(t)?"ro":S0.includes(t)||(E0[e.kind]||[]).includes(t)?"rw":null}var k0=["localRotationX","localRotationY","localRotationZ"],Zt=Math.PI/180;function As(e,t){return[e[3]*t[0]+e[0]*t[3]+e[1]*t[2]-e[2]*t[1],e[3]*t[1]-e[0]*t[2]+e[1]*t[3]+e[2]*t[0],e[3]*t[2]+e[0]*t[1]-e[1]*t[0]+e[2]*t[3],e[3]*t[3]-e[0]*t[0]-e[1]*t[1]-e[2]*t[2]]}function Ka(e){if(Object.is(e,-0))return e;let t=(e%360+360)%360,i=Math.round(t*1e6)/1e6;return i>=360?0:i}function _s(e,t,i){let n=w=>[Math.sin(w*Zt/2),Math.cos(w*Zt/2)],[a,r]=n(e),[o,s]=n(t),[c,l]=n(i),[d,f,h,m]=As(As([0,o,0,s],[a,0,0,r]),[0,0,c,l]),p=Math.max(-1,Math.min(1,-2*(f*h-m*d))),b,v,y;return Math.abs(p)>.999999?(b=Math.sign(p)*90,v=2*Math.atan2(f,m)/Zt,y=0):(b=Math.asin(p)/Zt,v=Math.atan2(2*(m*f+d*h),1-2*(d*d+f*f))/Zt,y=Math.atan2(2*(m*h+d*f),1-2*(d*d+h*h))/Zt),[Ka(b),Ka(v),Ka(y)]}function Ps(e,t){return I0.includes(t)||(C0[e.kind]||[]).includes(t)}var A0={container:{isolateNavigation:!1,disableKeyEventPassthrough:!1,disableCursorEventPassthrough:!1,showCursor:!1},textbox:{text:"",fontSize:20,fontColor:4294967295,bgColor:0,enableOutline:!1,outlineColor:0,horizontalAlignment:null,verticalAlignment:null,adaptiveFontSize:!1,minimumFontSize:10},textwindow:{interactable:!0,showScrollBar:!0,text:"",fontSize:20,fontColor:4294967295,bgColor:0,enableOutline:!1,outlineColor:0,horizontalAlignment:null,verticalAlignment:null,adaptiveFontSize:!1,minimumFontSize:10},image:{imageSource:null,imageId:0,imageColor:4294967295,imageType:null,enableMask:!1,enableSoftEdge:!1,softEdgeMode:"Percentage",softEdgeWidthX:8,softEdgeWidthY:8,horizontalSoftRange:85,verticalSoftRange:85,enableFill:!1,fillType:"Unused",fillHorizontalType:"Left",fillVerticalType:"Bottom",fillRadial90Type:"BottomLeft",fillRadialType:"Bottom",reverseMaskArea:!1,fillAmount:1},button:{interactable:!0,clickAudioId:0,raycastTarget:!0,unavailableChildId:null,hoverChildId:null,pressedChildId:null,selectedChildId:null,pressed:!1},cursor:{raycastTarget:!0},grid:{itemCount:0,itemPrefabIndex:null,raycastTarget:!0,interactable:!0,showScrollBar:!0,scrollDirection:"Vertical",layoutConstraint:"AutoWrap",layoutConstraintFixedCount:null,scrollProgress:0,cellSizeX:50,cellSizeY:50,spacingX:8,spacingY:8,padding1X:20,padding1Y:20,padding2X:20,padding2Y:20,previewCount:5},keyhint:{keyboardKeyCode:null,controllerKeyCode:null},animation:{animationId:null,playSoundEffect:null,layer:null,raycastTarget:!1},fullscreen:{animationId:null,playSoundEffect:null,raycastTarget:!1},reference:{referencedPrefabIndex:null}},ut=class e{constructor(t,i){this.runtime=t,this.kind=i.kind||"container",this.typeofName=Cs[this.kind]||Cs.container,this.alive=!0,this.Id=i.Id??t.nextControlId(),this.authoringId=i.authoringId??null,this.prefabIndex=i.prefabIndex??0,this.name=i.name??"",this.active=i.active===!0,this.visible=i.visible!==!1,this._parent=null,this.children=[],this.scripts=[],this.cursorListeners=new Map,this.keyListeners=new Map,this.navListeners=new Map,this.navConfig=new Map,this.anchoredPositionX=i.anchoredPositionX??0,this.anchoredPositionY=i.anchoredPositionY??0,this.sizeDeltaX=i.sizeDeltaX??0,this.sizeDeltaY=i.sizeDeltaY??0,this.anchorMinX=i.anchorMinX??.5,this.anchorMinY=i.anchorMinY??.5,this.anchorMaxX=i.anchorMaxX??.5,this.anchorMaxY=i.anchorMaxY??.5,this.pivotX=i.pivotX??.5,this.pivotY=i.pivotY??.5,this.localScaleX=i.localScaleX??1,this.localScaleY=i.localScaleY??1,this.localScaleZ=i.localScaleZ??1,this.localRotationX=i.localRotationX??0,this.localRotationY=i.localRotationY??0,this.localRotationZ=i.localRotationZ??0,this.canControllerFocus=i.canControllerFocus??!1,this._playDirty=!0,this._playDeepDirty=!0,this._playChildDirty=!1,(this.kind==="grid"||this.kind==="textwindow")&&(this.runtime.scrollControls||=new Set,this.runtime.scrollControls.add(this));let n=A0[this.kind]||{};for(let[a,r]of Object.entries(n))this[a]===void 0&&(this[a]=i[a]!==void 0?i[a]:r);if((this.kind==="animation"||this.kind==="fullscreen")&&(this.runtime.uiAnimations||=new Set,this.runtime.uiAnimations.add(this),this.PlayAnimation()),this.kind==="grid"&&(this.scrollProgress=i.scrollProgress??0),i.children)for(let a of i.children){let r=a instanceof e?a:new e(t,a);this.addChild(r)}}get parent(){return this._parent}set parent(t){if(this._parent===t)return;if(t!==null&&!(t instanceof e))throw new Error("parent must be a Control or nil");if(t&&t.runtime!==this.runtime)throw new Error("parent must belong to the same runtime");if(t===this)throw new Error("cannot parent a control to itself or its descendant");for(let n=t;n;n=n._parent)if(n===this)throw new Error("cannot parent a control to itself or its descendant");let i=this._parent;if(i){let n=i.children.indexOf(this);n>=0&&i.children.splice(n,1),i.markPlayDirty(!0)}else{let n=this.runtime.roots.indexOf(this);n>=0&&this.runtime.roots.splice(n,1)}this._parent=t,this.markPlayDirty(!0),t&&!t.children.includes(this)?(t.children.push(this),t.markPlayDirty(!0)):!t&&this.alive&&!this.runtime.roots.includes(this)&&this.runtime.roots.push(this)}markPlayDirty(t=!1){this._playDirty=!0,t&&(this._playDeepDirty=!0);for(let i=this._parent;i&&!i._playChildDirty;i=i._parent)i._playChildDirty=!0}get activeInHierarchy(){return this.active?this._parent?this._parent.activeInHierarchy:!0:!1}get scrollProgress(){return this._scrollProgress??0}set scrollProgress(t){if(typeof t!="number"||!Number.isFinite(t))throw new Error("scrollProgress must be a finite number");this._scrollProgress=xn(t),this.markPlayDirty()}addChild(t){return t.parent=this,t}GetChildren(){return this.children.slice()}GetChild(t){return this.children.find(i=>i.name===t)||null}FindChild(t){if(!t)return null;if(!t.includes("/"))return this.GetChild(t);let i=t.split("/").filter(Boolean),n=this;for(let a of i)if(n=n.GetChild(a),!n)return null;return n}SetActive(t){let i=!!t;if(this.active!==i){if(typeof this.runtime?.onControlActiveChanging=="function"){this.runtime.onControlActiveChanging(this,i);return}this.active=i,this.markPlayDirty(!0)}}SetVisible(t){this.visible=!!t,this.markPlayDirty(!0)}GetSiblingIndex(){if(!this._parent)return-1;let t=this._parent.children,i=t.indexOf(this);return i<0?-1:t.length-1-i}SetSiblingIndex(t){if(!this._parent)return!1;let i=this._parent.children,n=i.indexOf(this);if(n<0)return!1;let a=i.length-1;return!Number.isInteger(t)||t<0||t>a?!1:(i.splice(n,1),i.splice(a-t,0,this),this._parent.markPlayDirty(!0),this.markPlayDirty(),!0)}SetAsFirstSibling(){return this.SetSiblingIndex(0)}SetAsLastSibling(){return this._parent?this.SetSiblingIndex(this._parent.children.length-1):!1}GetAnchoredPosition(){return[this.anchoredPositionX,this.anchoredPositionY]}SetAnchoredPosition(t,i){this.anchoredPositionX=t,this.anchoredPositionY=i,this.markPlayDirty()}GetSizeDelta(){return[this.sizeDeltaX,this.sizeDeltaY]}SetSizeDelta(t,i){this.sizeDeltaX=t,this.sizeDeltaY=i,this.markPlayDirty(!0)}GetAnchorMin(){return[this.anchorMinX,this.anchorMinY]}SetAnchorMin(t,i){this.anchorMinX=t,this.anchorMinY=i,this.markPlayDirty(!0)}GetAnchorMax(){return[this.anchorMaxX,this.anchorMaxY]}SetAnchorMax(t,i){this.anchorMaxX=t,this.anchorMaxY=i,this.markPlayDirty(!0)}GetPivot(){return[this.pivotX,this.pivotY]}SetPivot(t,i){this.pivotX=t,this.pivotY=i,this.markPlayDirty(!0)}GetLocalScale(){return[this.localScaleX,this.localScaleY,this.localScaleZ]}SetLocalScale(t,i,n){this.localScaleX=t,this.localScaleY=i,this.localScaleZ=n,this.markPlayDirty()}GetLocalRotation(){return _s(this.localRotationX,this.localRotationY,this.localRotationZ)}luaFieldValue(t){if(t==="id")return this.Id;if(t==="imageType")return this.imageType??"Stretch";let i=k0.indexOf(t);return i<0?this[t]:_s(this.localRotationX,this.localRotationY,this.localRotationZ)[i]}SetLocalRotation(t,i,n){this.localRotationX=t,this.localRotationY=i,this.localRotationZ=n,this.markPlayDirty()}GetScriptByPath(t){return this.scripts.find(i=>i.path===t)||null}GetScript(t){return this.scripts.find(i=>i.scriptMappingId===t)||null}GetScripts(){return this.scripts.slice()}_addListener(t,i,n){let a=t.get(i)||[];a.push(n),t.set(i,a),this.runtime.retainLuaCallback?.(n)}_removeListener(t,i,n){let a=t.get(i);if(!a)return;let r=a.filter(o=>o!==n);t.set(i,r);for(let o=r.length;o<a.length;o++)this.runtime.unrefLuaCallback?.(n)}_removeListeners(t,i){let n=t.get(i)||[];for(let a of n)this.runtime.unrefLuaCallback?.(a);t.delete(i)}_removeAllListeners(t){for(let i of t.values())for(let n of i)this.runtime.unrefLuaCallback?.(n);t.clear()}AddCursorEventListener(t,i){this._addListener(this.cursorListeners,t,i)}RemoveCursorEventListener(t,i){this._removeListener(this.cursorListeners,t,i)}RemoveCursorEventListeners(t){this._removeListeners(this.cursorListeners,t)}RemoveAllCursorEventListeners(){this._removeAllListeners(this.cursorListeners)}SimulateCursorClick(){let t=this.runtime.makeCursorEventData({x:0,y:0,pressX:0,pressY:0});this.emitCursor("CursorDown",t),this.emitCursor("CursorUp",t),this.emitCursor("CursorClick",t)}emitCursor(t,i){if(!this.runtime.cursorEventsEnabled(this))return;let n=this.cursorListeners.get(t)||[];for(let a of n)a(i)}AddKeyEventListener(t,i){this._addListener(this.keyListeners,t,i)}RemoveKeyEventListener(t,i){this._removeListener(this.keyListeners,t,i)}RemoveKeyEventListeners(t){this._removeListeners(this.keyListeners,t)}RemoveAllKeyEventListeners(){this._removeAllListeners(this.keyListeners)}emitKey(t){let i=this.keyListeners.get(t)||[];for(let n of i)if(n()===!0)return!0;return!1}AddNavigationEventListener(t,i){this._addListener(this.navListeners,t,i)}RemoveNavigationEventListener(t,i){this._removeListener(this.navListeners,t,i)}RemoveNavigationEventListeners(t){this._removeListeners(this.navListeners,t)}RemoveAllNavigationEventListeners(){this._removeAllListeners(this.navListeners)}SetControllerNavigation(t,i,n){this.navConfig.set(t,{mode:i,target:n})}GetControllerNavigation(t){let i=this.navConfig.get(t),n=i?[i.mode,i.target]:[null,null];return n.__multi=!0,n}SetImage(t,i){let n=this.imageSource?.Name||this.imageSource,a=t?.Name||t;(i!==this.imageId||n!==a)&&(this.imageType=null),this.imageSource=t,this.imageId=i,this.markPlayDirty()}SetSoftEdgeWidth(t,i){this.softEdgeWidthX=t,this.softEdgeWidthY=i,this.markPlayDirty()}SetFillUnused(){this.fillType="Unused",this.markPlayDirty()}SetFillHorizontal(t,i){this.fillType="Horizontal",this.fillHorizontalType=t,this.fillAmount=i,this.markPlayDirty()}SetFillVertical(t,i){this.fillType="Vertical",this.fillVerticalType=t,this.fillAmount=i,this.markPlayDirty()}SetFillRadial90(t,i){this.fillType="Radial90",this.fillRadial90Type=t,this.fillAmount=i,this.markPlayDirty()}SetFillRadial180(t,i){this.fillType="Radial180",this.fillRadialType=t,this.fillAmount=i,this.markPlayDirty()}SetFillRadial360(t,i){this.fillType="Radial360",this.fillRadialType=t,this.fillAmount=i,this.markPlayDirty()}get animationId(){return this._animationId}set animationId(t){this._animationId!==t&&(this._animationId=t,this._uiAnimation&&this.PlayAnimation())}PlayAnimation(){this.alive&&(this._uiAnimation={generation:(this._uiAnimation?.generation||0)+1,startedAt:this.runtime.clock.time,playing:!0},this.markPlayDirty())}StopAnimation(){this._uiAnimation&&(this._uiAnimation.playing=!1),this.markPlayDirty()}RefreshItems(t,i){if(!Number.isInteger(t)||t<0||t>2e3)throw new Error("RefreshItems: simulator supports 0..2000 items");if(typeof i!="function")throw new Error("RefreshItems: callback must be a function");if(!this.alive||this._refreshingGrid)throw new Error("RefreshItems: destroyed control or recursive refresh");if(t&&!this.runtime.templates.has(Number(this.itemPrefabIndex)))throw new Error("RefreshItems: item template not found");if(t&&["OnInit","OnDestroy"].includes(this.runtime.lifecyclePhase))throw new Error("RefreshItems: items cannot be created during OnInit/OnDestroy");this._refreshingGrid=!0;try{this._gridItems||=[];let n=[];for(let a of this._gridItems)a.alive&&a.parent===this&&a.prefabIndex===Number(this.itemPrefabIndex)&&n.length<t?n.push(a):a.alive&&a.parent===this&&this.runtime.destroyControl(a);for(this._gridItems=n;n.length<t;){let a=this.runtime.instantiate(this.itemPrefabIndex,this,this.runtime.lifecyclePhase);if(!a)throw new Error("RefreshItems: could not instantiate item");n.push(a),a.SetActive(!0)}this.itemCount=t,Qt(this),this.markPlayDirty(!0);for(let a=0;a<n.length&&this.alive;a+=1)i(n[a],a)}finally{this._refreshingGrid=!1}}GetItemIndex(t){return t?.alive&&t.parent===this?this._gridItems?.indexOf(t)??-1:-1}GetItemSize(){return[this.cellSizeX,this.cellSizeY]}GetItemSpacing(){return[this.spacingX,this.spacingY]}GetPadding(){return[this.padding1Y,this.padding2Y,this.padding1X,this.padding2X]}ScrollToItemAt(t,i){if(!Number.isInteger(t)||t<0||t>=this.itemCount)throw new Error("ScrollToItemAt: item index out of range");let n=Ai(this),a=n.horizontal?n.cellW:n.cellH,r=n.horizontal?n.gapX:n.gapY,o=(n.horizontal?n.left:n.top)+Math.floor(t/n.lanes)*(a+r),s=i?.Name||i;if(!["Top","Center","Bottom"].includes(s))throw new Error("ScrollToItemAt: invalid alignment");let c=o-(s==="Center"?(n.viewport-a)/2:s==="Bottom"?n.viewport-a:0);this.scrollProgress=n.max?xn(c/n.max):0,Qt(this),this.markPlayDirty(!0)}GetContentLength(){return Ai(this).length}};function Ye(e,t){t(e);for(let i of e.children)Ye(i,t)}function Ja(e,t=[],i=""){t.push(`${i}${e.name||"(unnamed)"} [${e.typeofName}] Id=${e.Id}`);for(let n of e.children)Ja(n,t,i+" ");return t}function In(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}var Ts={Linear:e=>e,InSine:e=>1-Math.cos(e*Math.PI/2),OutSine:e=>Math.sin(e*Math.PI/2),InOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,InQuad:e=>e*e,OutQuad:e=>1-(1-e)*(1-e),InOutQuad:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,InCubic:e=>e*e*e,OutCubic:e=>1-(1-e)**3,InOutCubic:e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,InQuart:e=>e**4,OutQuart:e=>1-(1-e)**4,InOutQuart:e=>e<.5?8*e**4:1-(-2*e+2)**4/2,InQuint:e=>e**5,OutQuint:e=>1-(1-e)**5,InOutQuint:e=>e<.5?16*e**5:1-(-2*e+2)**5/2,InExpo:e=>e===0?0:2**(10*e-10),OutExpo:e=>e===1?1:1-2**(-10*e),InOutExpo:e=>e===0||e===1?e:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,InCirc:e=>1-Math.sqrt(1-e**2),OutCirc:e=>Math.sqrt(1-(e-1)**2),InOutCirc:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2,InBack:e=>(1.70158+1)*e*e*e-1.70158*e*e,OutBack:e=>1+2.70158*(e-1)**3+1.70158*(e-1)**2,InOutBack:e=>{let i=2.5949095;return e<.5?(2*e)**2*((i+1)*2*e-i)/2:((2*e-2)**2*((i+1)*(e*2-2)+i)+2)/2},InElastic:e=>e===0||e===1?e:-(2**(10*e-10))*Math.sin((e*10-10.75)*(2*Math.PI/3)),OutElastic:e=>e===0||e===1?e:2**(-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1,InOutElastic:e=>{if(e===0||e===1)return e;let t=2*Math.PI/4.5;return e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*t))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*t)/2+1},InBounce:e=>1-In(1-e),OutBounce:In,InOutBounce:e=>e<.5?(1-In(1-2*e))/2:(1+In(2*e-1))/2};function Ms(e,t){let i=Ts[e]||Ts.Linear;return t<=0?0:t>=1?1:i(t)}function ei(e,t,i,n=255){let a=Cn(e),r=Cn(t),o=Cn(i);return((n==null?255:Cn(n))<<24|a<<16|r<<8|o)>>>0}function _i(e){let t=e>>>0;return[t>>>16&255,t>>>8&255,t&255,t>>>24&255]}function Cn(e){let t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(255,Math.trunc(t))):0}function Rs(e,t,i){let n=_i(e),a=_i(t);return ei(n[0]+(a[0]-n[0])*i,n[1]+(a[1]-n[1])*i,n[2]+(a[2]-n[2])*i,n[3]+(a[3]-n[3])*i)}var _0=new Set(["fontColor","bgColor","outlineColor","imageColor"]),P0=new Set(["fontSize","minimumFontSize"]),Qa=1e-9;function T0(e,t){return typeof e?.luaFieldValue=="function"?e.luaFieldValue(t):e[t]}var Pi=class{constructor(t,i,n,a){this.runtime=t,this.object=i,this.data={...n},this.duration=Math.max(0,Number(a)||0),this.easeName="Linear",this.relative=!1,this.playing=!1,this.paused=!1,this.elapsed=0,this.loops=1,this.loopIndex=0,this.from={},this.to={},this.initialFrom=null,this.initialTo=null,this.onComplete=null,this.onStepComplete=null,this.killed=!1,this.dead=!1,this.completed=!1}capture(){this.from={},this.to={};for(let[t,i]of Object.entries(this.data)){let n=T0(this.object,t);this.from[t]=n,this.to[t]=this.relative?Number(n)+Number(i):i}}restoreInitial(){this.from={...this.initialFrom},this.to={...this.initialTo}}SetEase(t){return this.easeName=typeof t=="string"?t:t?.Name||"Linear",this}SetRelative(t){return this.relative=!!t,this}Play(){return this.dead?this:this.playing?(this.paused=!1,this):this._start(!1)}_begin(t){this.playing=!0,this.paused=!1,this.elapsed=0,this.loopIndex=0,this.killed=!1,this.completed=!1,t&&this.initialFrom?this.restoreInitial():(this.capture(),this.initialFrom={...this.from},this.initialTo={...this.to})}_start(t){return this._begin(t),this.runtime.tweens.add(this),this.runtime.animations.add(this),this}get loopCount(){return this.loops>0?this.loops:1}Pause(){this.paused=!0}Resume(){this.paused=!1}Restart(){return this.dead?this:this._start(!0)}Complete(){this.dead||this.completed||(this.initialFrom||this._begin(!1),this.apply(1),this.finish(!0))}Kill(t){t?this.Complete():this.finish(!1),this.dead=!0}SetOnComplete(t){return this.onComplete=t,this}SetOnStepComplete(t){return this.onStepComplete=t,this}SetLoops(t){return this.loops=t,this}apply(t){if(this.object?.alive===!1)return;let i=Ms(this.easeName,t),n=!1,a=!1;for(let r of Object.keys(this.to)){let o=this.from[r],s=this.to[r];if(_0.has(r)&&typeof o=="number"&&typeof s=="number")this.object[r]=Rs(o,s,i);else if(typeof o=="number"&&typeof s=="number"){let c=o+(s-o)*i;this.object[r]=P0.has(r)?Math.trunc(c):c}else this.object[r]=i>=1?s:o;n=!0,En.has(r)&&(a=!0)}n&&typeof this.object?.markPlayDirty=="function"&&this.object.markPlayDirty(a)}_advance(t,i){this.elapsed+=t;let n=this.duration<=0?1:Math.min(1,this.elapsed/this.duration);return this.apply(n),n<1?!1:i>=0&&this.loopIndex+1>=i?!0:(this.onStepComplete&&this.runtime.safeCall(this.onStepComplete),this.loopIndex++,this.elapsed=0,this.restoreInitial(),!1)}step(t){!this.playing||this.paused||this.killed||this._advance(t,this.loops<0?-1:this.loopCount)&&(this.onStepComplete&&this.runtime.safeCall(this.onStepComplete),this.finish(!0))}finish(t){this.playing=!1,this.killed=!0,t&&(this.completed=!0),this.runtime.tweens.delete(this),this.runtime.animations.delete(this),t&&this.onComplete&&this.runtime.safeCall(this.onComplete)}},ti=class{constructor(t){this.runtime=t,this.steps=[],this.playing=!1,this.paused=!1,this.killed=!1,this.dead=!1,this.completed=!1,this.elapsed=0,this.loops=1,this.loopIndex=0,this.onComplete=null,this.onStepComplete=null,this._entries=null}Append(t){return this.steps.push({kind:"tween",tween:t,parallel:!1}),this}AppendInterval(t){return this.steps.push({kind:"interval",duration:t}),this}AppendCallback(t){return this.steps.push({kind:"callback",fn:t}),this}Join(t){return this.steps.push({kind:"tween",tween:t,parallel:!0}),this}Insert(t,i){return this.steps.push({kind:"insert",time:t,tween:i}),this}InsertCallback(t,i){return this.steps.push({kind:"insertCb",time:t,fn:i}),this}Play(){return this.dead?this:this.playing?(this.paused=!1,this):this._play()}_play(){return this.playing=!0,this.paused=!1,this.killed=!1,this.completed=!1,this.elapsed=0,this.loopIndex=0,this._schedule(),this.runtime.sequences.add(this),this.runtime.animations.add(this),this}_schedule(){let t=0,i=0,n=!1,a=[],r=o=>o.duration*o.loopCount;for(let o of this.steps)if(o.kind==="tween"&&o.parallel){let s=n?i:t;a.push({at:s,tween:o.tween}),t=Math.max(t,s+r(o.tween))}else o.kind==="tween"?(a.push({at:t,tween:o.tween}),i=t,n=!0,t+=r(o.tween)):o.kind==="interval"?(i=t,n=!0,t+=o.duration):o.kind==="callback"?a.push({at:t,fn:o.fn}):o.kind==="insert"?(a.push({at:o.time,tween:o.tween}),t=Math.max(t,o.time+r(o.tween))):o.kind==="insertCb"&&(a.push({at:o.time,fn:o.fn}),t=Math.max(t,o.time));this._entries=a.map((o,s)=>({...o,index:s,end:o.tween?o.at+r(o.tween):o.at})),this._end=t,this._resetEntries()}_resetEntries(){for(let t of this._entries)t.started=!1,t.done=!1}_startChild(t){t.started=!0,t.tween._begin(!!t.tween.initialFrom)}_finishChild(t){t.done=!0,t.tween.apply(1),t.tween.onStepComplete&&this.runtime.safeCall(t.tween.onStepComplete),t.tween.finish(!0)}_advanceTo(t,i){let n=this._entries,a=[];for(let o of n)!o.started&&o.at<=t+Qa&&a.push({at:o.at,rank:o.fn?1:2,entry:o}),o.tween&&!o.done&&o.end<=t+Qa&&a.push({at:o.end,rank:0,entry:o});a.sort((o,s)=>o.at-s.at||o.rank-s.rank||o.entry.index-s.entry.index);let r=new Set;for(let{rank:o,entry:s}of a)if(o===1){if(s.started=!0,this.runtime.safeCall(s.fn),!this.playing||this.killed||this._entries!==n)return!1}else s.started||(this._startChild(s),r.add(s)),o===0&&!s.done&&this._finishChild(s);for(let o of n)!o.tween||!o.started||o.done||(r.has(o)?o.tween._advance(t-o.at,o.tween.loopCount):o.tween._advance(i,o.tween.loopCount));return!0}step(t){!this.playing||this.paused||this.killed||(this.elapsed+=t,this._advanceTo(this.elapsed,t)&&(this.elapsed+Qa<this._end||(this.onStepComplete&&this.runtime.safeCall(this.onStepComplete),this.loopIndex++,this.loops<0||this.loopIndex<this.loops?(this.elapsed=0,this._resetEntries()):this.finish(!0))))}Pause(){this.paused=!0}Resume(){this.paused=!1}Restart(){this.dead||this._play()}Complete(){this.dead||this.completed||(this._entries||this._schedule(),this.playing=!0,this.killed=!1,this._advanceTo(1/0,0)&&(this.onStepComplete&&this.runtime.safeCall(this.onStepComplete),this.finish(!0)))}Kill(t){t?this.Complete():this.finish(!1),this.dead=!0}SetOnComplete(t){return this.onComplete=t,this}SetOnStepComplete(t){return this.onStepComplete=t,this}SetLoops(t){return this.loops=t,this}finish(t){this.playing=!1,this.killed=!0,t&&(this.completed=!0),this.runtime.sequences.delete(this),this.runtime.animations.delete(this),t&&this.onComplete&&this.runtime.safeCall(this.onComplete)}};var kn={EaseType:["Linear","InSine","OutSine","InOutSine","InQuad","OutQuad","InOutQuad","InCubic","OutCubic","InOutCubic","InQuart","OutQuart","InOutQuart","InQuint","OutQuint","InOutQuint","InExpo","OutExpo","InOutExpo","InCirc","OutCirc","InOutCirc","InBack","OutBack","InOutBack","InElastic","OutElastic","InOutElastic","InBounce","OutBounce","InOutBounce"],CustomVariableEntityType:["Level","PlayerSelf","AvatarSelf"],Device:["KeyboardAndMouse","Mobile","Controller","MobileController"],StageMode:["Beyond","Classic"],LanguageType:["LanguageNone","LanguageEng","LanguageChs","LanguageCht","LanguageFra","LanguageDeu","LanguageSpa","LanguagePor","LanguageRus","LanguageJpn","LanguageKor","LanguageTha","LanguageVie","LanguageInd","LanguageTur","LanguageIta"],ParamType:["Entity","EntityList","Int","IntList","Bool","BoolList","Float","FloatList","String","StringList","Vector3","Vector3List","Guid","GuidList","ConfigId","PrefabId","ConfigIdList","PrefabIdList"],CursorEventType:["CursorDown","CursorUp","CursorEnter","CursorExit","CursorDrag","CursorBeginDrag","CursorEndDrag","CursorClick"],ScrollDirection:["Horizontal","Vertical"],ScrollLayoutConstraint:["AutoWrap","Fixed"],ScrollAlignType:["Bottom","Center","Top"],ControllerNavigationDir:["Up","Down","Left","Right"],ControllerNavigationEventType:["Confirm","Cancel","Focus","LostFocus","RightStickUp","RightStickDown","RightStickRight","RightStickLeft","LeftStickUp","LeftStickDown","LeftStickRight","LeftStickLeft"],ControllerNavigationMode:["None","NearestControl","Specified"],TextHorizontalAlignment:["Left","Middle","Right"],TextVerticalAlignment:["Top","Middle","Bottom"],ImageType:["Basic","Stretch"],ImageSource:["StaticReference","Item","Equipment","Skill","UnitStatus","Faction","Currency","Prefab"],ImageFillType:["Unused","Horizontal","Vertical","Radial90","Radial180","Radial360"],ImageFillHorizontalType:["Left","Right"],ImageFillVerticalType:["Bottom","Top"],ImageFillRadial90Type:["BottomLeft","TopLeft","TopRight","BottomRight"],ImageFillRadialType:["Bottom","Left","Top","Right"],ImageMaskSoftEdgeMode:["Percentage","Pixel"],UIAnimationLayer:["AboveAllControls","BelowAllControls"]},M0=[...Array.from({length:43},(e,t)=>`CraftspersonKey${t+1}`),"MoveForwardKey","MoveBackwardKey","MoveLeftKey","MoveRightKey","SwitchToWalkOrRunKey","SprintKey","JumpKey","DropKey","OpenShortcutWheelKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key","None"],R0=[...Array.from({length:14},(e,t)=>`CraftspersonKey${t+1}`),"SprintKey","JumpKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key","MenuConfirmKey","MenuBackKey","None"];function N0(){let e=[];for(let t of["Down","Up"]){for(let i=1;i<=43;i++)e.push(`KeyboardCraftspersonKey${i}${t}`);for(let i of["MoveForwardKey","MoveBackwardKey","MoveLeftKey","MoveRightKey","SwitchToWalkOrRunKey","SprintKey","JumpKey","DropKey","OpenShortcutWheelKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key"])e.push(`Keyboard${i}${t}`);for(let i=1;i<=14;i++)e.push(`ControllerCraftspersonKey${i}${t}`);for(let i of["SprintKey","JumpKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key","MenuConfirmKey","MenuBackKey"])e.push(`Controller${i}${t}`)}return e}kn.KeyboardKeyCode=M0;kn.ControllerKeyCode=R0;kn.KeyEventType=N0();var Ns=new Map;function kt(e,t){let i=`${e}\0${t}`,n=Ns.get(i);return n||(n={__kind:"EnumItem",Name:t,FullName:`Enum.${e}.${t}`,EnumType:e},Ns.set(i,n)),n}function Za(e,t){return t==null?t:t.__kind==="EnumItem"?kt(t.EnumType||e,t.Name):typeof t=="string"&&t?kt(e,t):t}function er(){let e={};for(let[t,i]of Object.entries(kn)){let n={};for(let a of i)n[a]=kt(t,a);e[t]=n}return e}var F0=new Set(["id","Id","prefabIndex","imageId","fontSize","minimumFontSize","clickAudioId","itemCount","itemPrefabIndex","animationId","referencedPrefabIndex"]),O0=new Set(["imageColor","fontColor","bgColor","outlineColor"]),Fs={horizontalAlignment:"TextHorizontalAlignment",verticalAlignment:"TextVerticalAlignment",imageSource:"ImageSource",imageType:"ImageType",fillType:"ImageFillType",fillHorizontalType:"ImageFillHorizontalType",fillVerticalType:"ImageFillVerticalType",fillRadial90Type:"ImageFillRadial90Type",fillRadialType:"ImageFillRadialType",softEdgeMode:"ImageMaskSoftEdgeMode",layer:"UIAnimationLayer",scrollDirection:"ScrollDirection",layoutConstraint:"ScrollLayoutConstraint"},At=u.LUA_REGISTRYINDEX,Os=u.LUA_MULTRET,$0=Object.freeze({InstantiateClientUIControl:2,DestroyClientUIControl:1,GetClientUIControl:1,FindClientUIRoot:1,GetClientUIRoots:0,GetUICanvasSize:0,GetCursorUIPos:0,GetDevice:0,SetControllerFocus:1,GetControllerFocus:0,GetControllerLeftStickAxis:0,GetControllerRightStickAxis:0,Tween:3,TweenSequence:0,ServerSignal:1,GetGlobalCustomVariableValue:2,PauseLevelTime:1,IsLevelTimePaused:0,PlayAudio2D:1,StopAudio:1,IsAudioAlive:1,GetLanguageType:0,GetStageMode:0,IsTestPlay:0,GetText:1,PrintClientUITree:0});function Se(e){return e==null?"":typeof e=="string"?e:e.Name||e.FullName||String(e)}var An=class{constructor(t={}){this.canvasWidth=t.canvasWidth??1600,this.canvasHeight=t.canvasHeight??900,this.device=t.device??"KeyboardAndMouse",this.language=t.language??"LanguageChs",this.stageMode=t.stageMode??"Classic",this.testPlay=t.testPlay!==!1,this.canSelectImageType=t.canSelectImageType||(()=>!1),this.clock={time:0,levelTime:0,paused:!1,frame:0},this.logs=[],this.mountErrors=[],this.tweens=new Set,this.sequences=new Set,this.animations=new Set,this.audios=new Map,this.nextAudioId=1,this.audioDuration=t.audioDuration||(()=>null),this.audioHistory=[],this.audioWarnings=new Set,this.audioRevision=0,this._nextControlId=1,this._playRemoved=[],this._nextScriptMappingId=1,this.lifecyclePhase="idle",this.controlsById=new Map,this.roots=[],this.templates=new Map,this.scriptFiles=new Map,this.requireAliases=new Map,this.requireCache=new Map,this.moduleBaseEnvironments=new Map,this.luaFunctions=new Map,this.mountedScripts=[],this.serverVars={Level:Object.create(null),PlayerSelf:Object.create(null),AvatarSelf:Object.create(null)},this.serverBridge=null,this.varHandlers=[],this.signalHandlers=[],this.cursor={x:0,y:0},this.focus=null,this.stick={left:[0,0],right:[0,0]},this.enumTree=er(),this.luaStates=new Set,this.L=null}nextControlId(){let t=this._nextControlId;return this._nextControlId+=1,t}resolveScriptMappingId(t){let i=Number(t);if(Number.isSafeInteger(i)&&i>0)return this._nextScriptMappingId=Math.max(this._nextScriptMappingId,i+1),i;let n=this._nextScriptMappingId;return this._nextScriptMappingId+=1,n}pushPackedColor(t,i){let n=i>>>0;(n|0)===n?u.lua_pushinteger(t,n):u.lua_pushnumber(t,n)}retainLuaCallback(t){vs(t)}unrefLuaCallback(t){Ss(this,t)}log(t,...i){let n=i.map(a=>a==null?"nil":typeof a=="object"&&a!==null&&a.__kind==="EnumItem"?a.Name:String(a)).join(" ");this.logs.push({level:t,text:n,time:this.clock.time})}safeCall(t,...i){try{return t(...i)}catch(n){this.log("lua-error",n&&n.message?n.message:String(n))}}scriptCanRun(t){if(!t?.alive||!t.enabled)return!1;let i=t.object;return!i||i.alive&&i.activeInHierarchy}cursorEventsEnabled(t){for(let i=t;i;i=i.parent)if(i.kind==="container"&&i.showCursor===!0)return!0;return!1}registerTemplate(t,i){this.templates.set(Number(t),i)}registerScriptFile(t,i){let n=this.normalizeRequirePath(t);this.scriptFiles.set(n,i),n.startsWith("default_import_file/")||this.requireAliases.set(`default_import_file/${n}`,n)}normalizeRequirePath(t){let i=String(t).replace(/\\/g,"/");return i.endsWith(".lua")&&(i=i.slice(0,-4)),i=i.replace(/\./g,"/"),i}addRoot(t){let i=t instanceof ut?t:new ut(this,t);return this.roots.push(i),Ye(i,n=>this.controlsById.set(n.Id,n)),this.mountSpecScripts(t,i),i}mountSpecScripts(t,i){if(t instanceof ut)return;let n=r=>(r.scripts?.length||0)>0||(r.children||[]).some(n);if(!t||!n(t))return;let a=this.lifecyclePhase;try{let r=(o,s)=>{for(let l of o.scripts||[])try{this.mountScript({path:l.path,source:l.source,control:s,scriptMappingId:l.scriptMappingId})}catch(d){let f=d&&d.message?d.message:String(d);this.mountErrors.push(f),this.log("lua-error",f)}let c=o.children||[];for(let l=0;l<c.length;l+=1)r(c[l],s?.children?.[l])};r(t,i)}finally{this.lifecyclePhase=a}}makeCursorEventData({x:t=0,y:i=0,pressX:n=t,pressY:a=i,deltaX:r=t-n,deltaY:o=i-a,dragging:s=!1,touchId:c=-1}={}){let l=this;return{__kind:"CursorEventData",typeofName:"CursorEventData",dragging:s,touchId:c,x:t,y:i,pressX:n,pressY:a,GetUIPos(){return[t,i]},GetPressUIPos(){return[n,a]},GetUIPosDelta(){return[r,o]}}}boot(){let t=this.newLuaThread();this.L=t}installGlobals(t){let i=this;u.lua_pushcfunction(t,n=>{let a=u.lua_gettop(n),r=[];for(let o=1;o<=a;o++)r.push(be(n,i,o));return i.log("info",...r),0}),u.lua_setglobal(t,F("print")),u.lua_pushcfunction(t,n=>{let a=u.lua_gettop(n),r=[];for(let o=1;o<=a;o++)r.push(be(n,i,o));return i.log("error",...r),0}),u.lua_setglobal(t,F("printerr")),u.lua_pushcfunction(t,n=>{if(u.lua_type(n,1)===u.LUA_TTABLE&&!it(n,1))return u.lua_pushstring(n,F("table")),1;let a=be(n,i,1);return u.lua_pushstring(n,F(i.typeofOf(a))),1}),u.lua_setglobal(t,F("typeof")),this.pushColorLib(t),this.pushEnumLib(t),this.pushGameLib(t),u.lua_pushcfunction(t,n=>i.luaRequire(n)),u.lua_setglobal(t,F("require"))}typeofOf(t){return t==null?"nil":t.__kind==="Script"?"Script":t.__kind==="EnumItem"?"EnumItem":t.__kind==="CursorEventData"?"CursorEventData":t.__kind==="ServerSignal"?"ServerSignal":t instanceof ti?"TweenSequence":t instanceof Pi?"Tween":t.typeofName?t.typeofName:typeof t=="number"?"number":typeof t=="string"?"string":typeof t=="boolean"?"boolean":typeof t}pushColorLib(t){u.lua_newtable(t),u.lua_pushcfunction(t,i=>(this.pushPackedColor(i,ei(u.lua_tonumber(i,1),u.lua_tonumber(i,2),u.lua_tonumber(i,3),255)),1)),u.lua_setfield(t,-2,F("FromRGB")),u.lua_pushcfunction(t,i=>{let n=u.lua_isnoneornil(i,4)?255:u.lua_tonumber(i,4);return this.pushPackedColor(i,ei(u.lua_tonumber(i,1),u.lua_tonumber(i,2),u.lua_tonumber(i,3),n)),1}),u.lua_setfield(t,-2,F("FromRGBA")),u.lua_pushcfunction(t,i=>{let n=u.lua_tonumber(i,1)>>>0;for(let a of _i(n))u.lua_pushinteger(i,a);return 4}),u.lua_setfield(t,-2,F("ToRGBA")),u.lua_newtable(t),u.lua_pushcfunction(t,i=>{let n=u.lua_tonumber(i,2),a=u.lua_tonumber(i,3),r=u.lua_tonumber(i,4),o=u.lua_isnoneornil(i,5)?255:u.lua_tonumber(i,5);return this.pushPackedColor(i,ei(n,a,r,o)),1}),u.lua_setfield(t,-2,F("__call")),u.lua_setmetatable(t,-2),u.lua_setglobal(t,F("Color"))}pushEnumLib(t){u.lua_newtable(t);for(let[i,n]of Object.entries(this.enumTree)){u.lua_newtable(t);for(let[a,r]of Object.entries(n))this.pushEnumItem(t,r),u.lua_setfield(t,-2,F(a));u.lua_setfield(t,-2,F(i))}u.lua_setglobal(t,F("Enum"))}pushEnumItem(t,i){let n=u.lua_newuserdata(t,0);Ct(n,i),Z.luaL_setmetatable(t,F("EnumItem"))}pushControl(t,i){let n=u.lua_newuserdata(t,0);Ct(n,i),Z.luaL_setmetatable(t,F("Control"))}pushScript(t,i){u.lua_newtable(t),u.lua_pushlightuserdata(t,Wa);let n=u.lua_newuserdata(t,0);Ct(n,i),u.lua_rawset(t,-3),Z.luaL_getmetatable(t,F("Script")),u.lua_setmetatable(t,-2)}pushTween(t,i){let n=u.lua_newuserdata(t,0);Ct(n,i);let a=i instanceof ti?"TweenSequence":"Tween";Z.luaL_setmetatable(t,F(a))}pushSignal(t,i){let n=u.lua_newuserdata(t,0);Ct(n,i),Z.luaL_setmetatable(t,F("ServerSignal"))}pushCursor(t,i){let n=u.lua_newuserdata(t,0);Ct(n,i),Z.luaL_setmetatable(t,F("CursorEventData"))}pushGameLib(t){let i=this;u.lua_newtable(t);let n={InstantiateClientUIControl:a=>{let r=u.lua_tointeger(a,1),o=_e(u.lua_touserdata(a,2)),s=i.instantiate(r,o,i.lifecyclePhase);return s?(i.pushControl(a,s),1):(u.lua_pushnil(a),1)},DestroyClientUIControl:a=>{let r=_e(u.lua_touserdata(a,1));return r&&i.destroyControl(r),0},GetClientUIControl:a=>{let r=u.lua_tointeger(a,1),o=i.controlsById.get(r);return o?i.pushControl(a,o):u.lua_pushnil(a),1},FindClientUIRoot:a=>{let r=te(a,1),o=i.roots.find(s=>s.name===r);return o?i.pushControl(a,o):u.lua_pushnil(a),1},GetClientUIRoots:a=>(u.lua_createtable(a,i.roots.length,0),i.roots.forEach((r,o)=>{i.pushControl(a,r),u.lua_rawseti(a,-2,o+1)}),1),GetUICanvasSize:a=>(u.lua_pushnumber(a,i.canvasWidth),u.lua_pushnumber(a,i.canvasHeight),2),GetCursorUIPos:a=>(u.lua_pushnumber(a,i.cursor.x),u.lua_pushnumber(a,i.cursor.y),2),GetDevice:a=>(i.pushEnumItem(a,kt("Device",i.device)),1),SetControllerFocus:a=>(i.focus=_e(u.lua_touserdata(a,1)),0),GetControllerFocus:a=>(i.focus?i.pushControl(a,i.focus):u.lua_pushnil(a),1),GetControllerLeftStickAxis:a=>(u.lua_pushnumber(a,i.stick.left[0]),u.lua_pushnumber(a,i.stick.left[1]),2),GetControllerRightStickAxis:a=>(u.lua_pushnumber(a,i.stick.right[0]),u.lua_pushnumber(a,i.stick.right[1]),2),Tween:a=>{let r=_e(u.lua_touserdata(a,1))||be(a,i,1),o=be(a,i,2)||{},s=u.lua_tonumber(a,3),c=new Pi(i,r,o,s);return i.pushTween(a,c),1},TweenSequence:a=>(i.pushTween(a,new ti(i)),1),ServerSignal:a=>{let r=te(a,1);return i.pushSignal(a,i.makeServerSignal(r)),1},GetGlobalCustomVariableValue:a=>{let r=Se(be(a,i,1)),o=te(a,2);return ce(a,i,i.getVar(r,o)),1},PauseLevelTime:a=>(i.clock.paused=!!u.lua_toboolean(a,1),0),IsLevelTimePaused:a=>(u.lua_pushboolean(a,i.clock.paused),1),PlayAudio2D:a=>{let r=i.playAudio(i.audioInteger(a));return u.lua_pushinteger(a,r),1},StopAudio:a=>(i.stopAudio(i.audioInteger(a)),0),IsAudioAlive:a=>{let r=i.audios.get(i.audioInteger(a));return u.lua_pushboolean(a,!!(r&&r.alive)),1},GetLanguageType:a=>(i.pushEnumItem(a,kt("LanguageType",i.language)),1),GetStageMode:a=>(i.pushEnumItem(a,kt("StageMode",i.stageMode)),1),IsTestPlay:a=>(u.lua_pushboolean(a,i.testPlay),1),GetText:a=>{let r=te(a,1);return u.lua_pushstring(a,F(r)),1},PrintClientUITree:a=>{for(let r of i.roots)i.log("info",Ja(r).join(`
|
|
115
|
+
`));return 0}};for(let[a,r]of Object.entries(n)){let o=$0[a];if(o===void 0)throw new Error(`missing game arity for ${a}`);u.lua_pushcfunction(t,s=>{let c=u.lua_gettop(s);return c!==o?Z.luaL_error(s,F(`bad argument count to '${a}' (${o} expected, got ${c})`)):r(s)}),u.lua_setfield(t,-2,F(a))}u.lua_setglobal(t,F("game"))}makeServerSignal(t){let i=[],n=this;return{__kind:"ServerSignal",name:t,AddParam(a,r){i.push({type:Se(a),value:r})},AddInt(a){i.push({type:"Int",value:a})},AddIntList(a){i.push({type:"IntList",value:a})},AddFloat(a){i.push({type:"Float",value:a})},AddFloatList(a){i.push({type:"FloatList",value:a})},AddString(a){i.push({type:"String",value:a})},AddStringList(a){i.push({type:"StringList",value:a})},AddVector3(a){i.push({type:"Vector3",value:a})},AddVector3List(a){i.push({type:"Vector3List",value:a})},AddBool(a){i.push({type:"Bool",value:a})},AddBoolList(a){i.push({type:"BoolList",value:a})},AddGuid(a){i.push({type:"Guid",value:a})},AddGuidList(a){i.push({type:"GuidList",value:a})},AddEntity(a){i.push({type:"Entity",value:a})},AddEntityList(a){i.push({type:"EntityList",value:a})},AddPrefabId(a){i.push({type:"PrefabId",value:a})},AddPrefabIdList(a){i.push({type:"PrefabIdList",value:a})},AddConfigId(a){i.push({type:"ConfigId",value:a})},AddConfigIdList(a){i.push({type:"ConfigIdList",value:a})},SendSignal(){let a=i.slice();n.serverBridge&&typeof n.serverBridge.receiveFromClient=="function"&&n.serverBridge.receiveFromClient(t,a)}}}audioInteger(t){let i=u.lua_tonumber(t,1);return u.lua_type(t,1)!==u.LUA_TNUMBER||!Number.isSafeInteger(i)?Z.luaL_error(t,F("audio argument must be an integer")):i}playAudio(t){this.audioRevision++;let i=this.nextAudioId++,n=this.audioDuration(t),a=Number.isFinite(n)&&n>0,r={instanceId:i,audioId:t,startedAt:this.clock.time,duration:a?n:0,alive:a,stopped:!1};return this.audioHistory.push(r),this.audioHistory.length>128&&this.audioHistory.shift(),a?(this.audios.size>=128&&this.stopAudio(this.audios.keys().next().value),this.audios.set(i,r)):this.audioWarnings.has(t)||(this.audioWarnings.size>=128&&this.audioWarnings.delete(this.audioWarnings.values().next().value),this.audioWarnings.add(t),this.log("warn",`\u97F3\u6548 ${t} \u672A\u5217\u5165\u6A21\u62DF\u5668\u97F3\u9891\u767D\u540D\u5355`)),i}stopAudio(t){let i=this.audios.get(t)||this.audioHistory.find(n=>n.instanceId===t);i&&!i.stopped&&(i.alive=!1,i.stopped=!0,this.audioRevision++),this.audios.delete(t)}audioSnapshot(){return{sequence:this.nextAudioId-1,revision:this.audioRevision,active:[...this.audios.values()].map(t=>({...t})),recent:this.audioHistory.map(t=>({...t}))}}instantiate(t,i,n){if(n==="OnInit"||n==="OnDestroy")return null;let a=this.templates.get(Number(t));if(!a||!i)return null;let r=new ut(this,{...a,Id:this.nextControlId(),authoringId:null,prefabIndex:Number(t)});return i.addChild(r),r.SetAsLastSibling(),Ye(r,o=>this.controlsById.set(o.Id,o)),this.mountSpecScripts(a,r),r}destroyControl(t){if(!(!t||!t.alive)){if(t._destroying)throw new Error(`\u5BA2\u6237\u7AEF\u63A7\u4EF6\u751F\u547D\u5468\u671F\u5904\u4E8E\u521B\u5EFA\u6216\u9500\u6BC1\u65F6\uFF0C\u65E0\u6CD5\u8C03\u7528DestroyClientUIControl, ID:${t.name}`);Ye(t,i=>{i._destroying=!0}),this._destroyControlTree(t)}}_destroyControlTree(t){this.releaseControlListeners(t);for(let i of t.scripts.slice())this.unmountScript(i);for(let i of t.children.slice())this._destroyControlTree(i);if(t.alive=!1,this.scrollControls?.delete(t),this.uiAnimations?.delete(t),this._playRemoved.push(t.Id),t.parent){let i=t.parent,n=i.children.indexOf(t);n>=0&&i.children.splice(n,1),t._parent=null,i.markPlayDirty(!0)}else{let i=this.roots.indexOf(t);i>=0&&this.roots.splice(i,1)}this.controlsById.delete(t.Id),this.focus===t&&(this.focus=null);for(let i of[...this.tweens])i.object===t&&i.Kill(!1)}releaseControlListeners(t){for(let i of t.cursorListeners.values())for(let n of i)this.unrefLuaCallback(n);for(let i of t.keyListeners.values())for(let n of i)this.unrefLuaCallback(n);for(let i of t.navListeners.values())for(let n of i)this.unrefLuaCallback(n);t.cursorListeners.clear(),t.keyListeners.clear(),t.navListeners.clear(),t.navConfig.clear()}onControlActiveChanging(t,i){let n=[];Ye(t,a=>n.push({control:a,was:a.activeInHierarchy})),t.active=!!i,t.markPlayDirty(!0);for(let a of n){let r=a.control.activeInHierarchy;if(a.was!==r)for(let o of a.control.scripts.slice())r?this.enableScript(o):this.disableScript(o)}}bindScriptEnv(t){let i=t.env;return i?(this.pushScript(i,t),u.lua_setglobal(i,F("script")),i):null}disableScript(t){if(!t?.alive||!t.env||t.lifecyclePhase!=="running")return;let i=this.lifecyclePhase;this.lifecyclePhase="OnDisable",t.lifecyclePhase="OnDisable",this.bindScriptEnv(t),this.callGlobal(t.env,"OnDisable"),t.lifecyclePhase="disabled",this.lifecyclePhase=i}enableScript(t){if(!t?.alive||!t.env||t.lifecyclePhase!=="disabled")return;let i=this.lifecyclePhase;this.lifecyclePhase="OnEnable",t.lifecyclePhase="OnEnable",this.bindScriptEnv(t),this.callGlobal(t.env,"OnEnable"),t.lifecyclePhase="running",this.lifecyclePhase=i}unmountScript(t){if(!t||!t.alive)return;let i=t.env,n=this.lifecyclePhase;i&&(t.lifecyclePhase==="running"&&(this.lifecyclePhase="OnDisable",t.lifecyclePhase="OnDisable",this.bindScriptEnv(t),this.callGlobal(i,"OnDisable")),this.lifecyclePhase="OnDestroy",t.lifecyclePhase="OnDestroy",this.bindScriptEnv(t),this.callGlobal(i,"OnDestroy")),t.alive=!1,t.lifecyclePhase="destroyed",this.lifecyclePhase=n,this.mountedScripts=this.mountedScripts.filter(a=>a!==t),t.object&&(t.object.scripts=t.object.scripts.filter(a=>a!==t)),this.varHandlers=this.varHandlers.filter(a=>a.script!==t),this.signalHandlers=this.signalHandlers.filter(a=>a.script!==t),i&&i!==this.L&&this.closeTrackedLuaState(i),t.env=null}installMetatables(t){this.mtEnum(t),this.mtControl(t),this.mtScript(t),this.mtTween(t),this.mtSeq(t),this.mtSignal(t),this.mtCursor(t)}mtIndexNewindex(t,i,n,a,r,o){Z.luaL_newmetatable(t,F(i)),u.lua_pushcfunction(t,s=>{let c=it(s,1)||_e(u.lua_touserdata(s,1)),l=te(s,2);if(r[l]&&(!o||o(c,l)))return u.lua_pushcfunction(s,r[l]),1;let d;try{d=n(c,l)}catch(f){return Z.luaL_error(s,F(String(f.message||f)))}return d===void 0?(u.lua_pushnil(s),1):(ce(s,this,d),1)}),u.lua_setfield(t,-2,F("__index")),u.lua_pushcfunction(t,s=>{try{let c=it(s,1)||_e(u.lua_touserdata(s,1)),l=te(s,2),d=be(s,this,3);return a(c,l,d),0}catch(c){return u.lua_pushstring(s,F(String(c.message||c))),u.lua_error(s)}}),u.lua_setfield(t,-2,F("__newindex")),u.lua_pushcfunction(t,s=>{let c=it(s,1)||_e(u.lua_touserdata(s,1)),l=it(s,2)||_e(u.lua_touserdata(s,2));return u.lua_pushboolean(s,c===l),1}),u.lua_setfield(t,-2,F("__eq")),u.lua_pop(t,1)}method(t){let i=this;return n=>{let a=it(n,1)||_e(u.lua_touserdata(n,1)),r=u.lua_gettop(n),o=[];for(let s=2;s<=r;s++)o.push(be(n,i,s));try{let s=t(a,...o);if(s===a)return u.lua_pushvalue(n,1),1;if(s===void 0)return 0;if(Array.isArray(s)&&s.__multi){for(let c of s)ce(n,i,c);return s.length}if(Array.isArray(s)&&!(s.length&&typeof s[0]=="object"&&s[0]?.typeofName)){if(s.__controls)return u.lua_createtable(n,s.length,0),s.forEach((c,l)=>{i.pushControl(n,c),u.lua_rawseti(n,-2,l+1)}),1;if(s.__scripts)return u.lua_createtable(n,s.length,0),s.forEach((c,l)=>{i.pushScript(n,c),u.lua_rawseti(n,-2,l+1)}),1;if(typeof s[0]=="number"&&s.length<=4){for(let c of s)u.lua_pushnumber(n,c);return s.length}}return ce(n,i,s),1}catch(s){return u.lua_pushstring(n,F(String(s.message||s))),u.lua_error(n)}}}mtEnum(t){let i=new Set(["Name","FullName","EnumType"]);this.mtIndexNewindex(t,"EnumItem",(n,a)=>i.has(a)?n[a]:void 0,(n,a)=>{throw new Error(`cannot set ${a}, no such field`)},{})}mtCursor(t){let i=new Set(["dragging","touchId"]);this.mtIndexNewindex(t,"CursorEventData",(n,a)=>i.has(a)?n[a]:void 0,(n,a)=>{throw new Error(`cannot set ${a}, no such field`)},{GetUIPos:this.method(n=>n.GetUIPos()),GetPressUIPos:this.method(n=>n.GetPressUIPos()),GetUIPosDelta:this.method(n=>n.GetUIPosDelta())})}mtControl(t){let i=this.method((a,r)=>a.SetVisible(r)),n={GetChildren:this.method(a=>{let r=a.GetChildren();return r.__controls=!0,r}),GetChild:this.method((a,r)=>a.GetChild(r)),FindChild:this.method((a,r)=>a.FindChild(r)),SetActive:this.method((a,r)=>a.SetActive(r)),SetVisible:a=>u.lua_isboolean(a,2)?i(a):Z.luaL_error(a,F("bad argument #2 to 'SetVisible' (boolean expected, got %s)"),Z.luaL_typename(a,2)),GetSiblingIndex:this.method(a=>a.GetSiblingIndex()),SetSiblingIndex:this.method((a,r)=>a.SetSiblingIndex(r)),SetAsFirstSibling:this.method(a=>a.SetAsFirstSibling()),SetAsLastSibling:this.method(a=>a.SetAsLastSibling()),GetAnchoredPosition:this.method(a=>a.GetAnchoredPosition()),SetAnchoredPosition:this.method((a,r,o)=>a.SetAnchoredPosition(r,o)),GetSizeDelta:this.method(a=>a.GetSizeDelta()),SetSizeDelta:this.method((a,r,o)=>a.SetSizeDelta(r,o)),GetAnchorMin:this.method(a=>a.GetAnchorMin()),SetAnchorMin:this.method((a,r,o)=>a.SetAnchorMin(r,o)),GetAnchorMax:this.method(a=>a.GetAnchorMax()),SetAnchorMax:this.method((a,r,o)=>a.SetAnchorMax(r,o)),GetPivot:this.method(a=>a.GetPivot()),SetPivot:this.method((a,r,o)=>a.SetPivot(r,o)),GetLocalScale:this.method(a=>a.GetLocalScale()),SetLocalScale:this.method((a,r,o,s)=>a.SetLocalScale(r,o,s)),GetLocalRotation:this.method(a=>a.GetLocalRotation()),SetLocalRotation:this.method((a,r,o,s)=>a.SetLocalRotation(r,o,s)),GetScriptByPath:this.method((a,r)=>a.GetScriptByPath(r)),GetScript:this.method((a,r)=>a.GetScript(r)),GetScripts:this.method(a=>{let r=a.GetScripts();return r.__scripts=!0,r}),AddCursorEventListener:this.method((a,r,o)=>a.AddCursorEventListener(Se(r),o)),RemoveCursorEventListener:this.method((a,r,o)=>a.RemoveCursorEventListener(Se(r),o)),RemoveCursorEventListeners:this.method((a,r)=>a.RemoveCursorEventListeners(Se(r))),RemoveAllCursorEventListeners:this.method(a=>a.RemoveAllCursorEventListeners()),SimulateCursorClick:this.method(a=>a.SimulateCursorClick()),AddKeyEventListener:this.method((a,r,o)=>a.AddKeyEventListener(Se(r),o)),RemoveKeyEventListener:this.method((a,r,o)=>a.RemoveKeyEventListener(Se(r),o)),RemoveKeyEventListeners:this.method((a,r)=>a.RemoveKeyEventListeners(Se(r))),RemoveAllKeyEventListeners:this.method(a=>a.RemoveAllKeyEventListeners()),AddNavigationEventListener:this.method((a,r,o)=>a.AddNavigationEventListener(Se(r),o)),RemoveNavigationEventListener:this.method((a,r,o)=>a.RemoveNavigationEventListener(Se(r),o)),RemoveNavigationEventListeners:this.method((a,r)=>a.RemoveNavigationEventListeners(Se(r))),RemoveAllNavigationEventListeners:this.method(a=>a.RemoveAllNavigationEventListeners()),SetControllerNavigation:this.method((a,r,o,s)=>a.SetControllerNavigation(Se(r),o,s)),GetControllerNavigation:this.method((a,r)=>a.GetControllerNavigation(Se(r))),SetImage:this.method((a,r,o)=>a.SetImage(r,o)),SetSoftEdgeWidth:this.method((a,r,o)=>a.SetSoftEdgeWidth(r,o)),SetFillUnused:this.method(a=>a.SetFillUnused()),SetFillHorizontal:this.method((a,r,o)=>a.SetFillHorizontal(r,o)),SetFillVertical:this.method((a,r,o)=>a.SetFillVertical(r,o)),SetFillRadial90:this.method((a,r,o)=>a.SetFillRadial90(r,o)),SetFillRadial180:this.method((a,r,o)=>a.SetFillRadial180(r,o)),SetFillRadial360:this.method((a,r,o)=>a.SetFillRadial360(r,o)),PlayAnimation:this.method(a=>a.PlayAnimation()),StopAnimation:this.method(a=>a.StopAnimation()),RefreshItems:this.method((a,r,o)=>{this.retainLuaCallback(o);try{a.RefreshItems(r,o)}finally{this.unrefLuaCallback(o)}}),GetItemIndex:this.method((a,r)=>a.GetItemIndex(r)),GetItemSize:this.method(a=>a.GetItemSize()),GetItemSpacing:this.method(a=>a.GetItemSpacing()),GetPadding:this.method(a=>a.GetPadding()),ScrollToItemAt:this.method((a,r,o)=>a.ScrollToItemAt(r,o)),GetContentLength:this.method(a=>a.GetContentLength())};this.mtIndexNewindex(t,"Control",(a,r)=>{if(!qa(a,r))return;if(!a.alive&&r!=="alive")throw new Error(`attempt to read '${r}' of a destroyed control`);let o=a.luaFieldValue(r),s=Fs[r];return s?Za(s,o):typeof o=="number"&&!F0.has(r)&&!O0.has(r)?new Ci(o):o},(a,r,o)=>{if(qa(a,r)==="rw"){if((r==="fontSize"||r==="minimumFontSize")&&!Number.isInteger(o)){let l=o===null?"nil":typeof o;throw new Error(`bad argument #2 to '${r}' (integer expected, got ${l})`)}let c=Fs[r];if(r==="animationId"&&!Number.isSafeInteger(o))throw new Error("animationId requires an integer");if(r==="playSoundEffect"&&typeof o!="boolean")throw new Error("playSoundEffect requires a boolean");if(r==="layer"&&(o?.EnumType!=="UIAnimationLayer"||!["AboveAllControls","BelowAllControls"].includes(o.Name)))throw new Error("layer requires Enum.UIAnimationLayer");if(r==="imageType"&&(o?.EnumType!=="ImageType"||!["Basic","Stretch"].includes(o.Name)))throw new Error("imageType requires Enum.ImageType.Basic or Stretch");a[r]=c?Za(c,o):o,typeof a.markPlayDirty=="function"&&a.markPlayDirty(En.has(r));return}throw new Error(`cannot set ${r}, no such field`)},n,Ps)}mtScript(t){let i=this,n=new Set(["alive","scriptMappingId","object","path","enabled"]);this.mtIndexNewindex(t,"Script",(a,r)=>n.has(r)?a[r]:void 0,(a,r,o)=>{if(r==="enabled"){a.enabled=!!o;return}throw new Error(`cannot set ${r}, no such field`)},{GetParam:this.method((a,r)=>Object.prototype.hasOwnProperty.call(a.params,r)?a.params[r]:null),Invoke:a=>i.luaInvoke(a),EnableUpdate:this.method((a,r)=>{a.updateEnabled=!!r}),RegisterServerSignalHandler:this.method((a,r,o)=>{i.signalHandlers.push({script:a,name:r,fn:o})}),UnregisterServerSignalHandler:this.method((a,r)=>{i.signalHandlers=i.signalHandlers.filter(o=>!(o.script===a&&o.name===r))}),RegisterCustomVariableChangedHandler:this.method((a,r,o,s)=>{i.varHandlers.push({script:a,entityType:Se(r),name:o,fn:s})}),UnregisterCustomVariableChangedHandler:this.method((a,r,o)=>{let s=Se(r);i.varHandlers=i.varHandlers.filter(c=>!(c.script===a&&c.entityType===s&&c.name===o))})})}mtTween(t){this.mtIndexNewindex(t,"Tween",()=>{},()=>{},{SetEase:this.method((i,n)=>i.SetEase(n)),SetRelative:this.method((i,n)=>i.SetRelative(n)),Play:this.method(i=>i.Play()),Pause:this.method(i=>i.Pause()),Resume:this.method(i=>i.Resume()),Restart:this.method(i=>i.Restart()),Complete:this.method(i=>i.Complete()),Kill:this.method((i,n)=>i.Kill(n)),SetOnComplete:this.method((i,n)=>i.SetOnComplete(n)),SetOnStepComplete:this.method((i,n)=>i.SetOnStepComplete(n)),SetLoops:this.method((i,n)=>i.SetLoops(n))})}mtSeq(t){this.mtIndexNewindex(t,"TweenSequence",()=>{},()=>{},{Append:this.method((i,n)=>i.Append(n)),AppendInterval:this.method((i,n)=>i.AppendInterval(n)),AppendCallback:this.method((i,n)=>i.AppendCallback(n)),Join:this.method((i,n)=>i.Join(n)),Insert:this.method((i,n,a)=>i.Insert(n,a)),InsertCallback:this.method((i,n,a)=>i.InsertCallback(n,a)),Play:this.method(i=>i.Play()),Pause:this.method(i=>i.Pause()),Resume:this.method(i=>i.Resume()),Restart:this.method(i=>i.Restart()),Complete:this.method(i=>i.Complete()),Kill:this.method((i,n)=>i.Kill(n)),SetOnComplete:this.method((i,n)=>i.SetOnComplete(n)),SetOnStepComplete:this.method((i,n)=>i.SetOnStepComplete(n)),SetLoops:this.method((i,n)=>i.SetLoops(n))})}mtSignal(t){this.mtIndexNewindex(t,"ServerSignal",()=>{},()=>{},{AddParam:this.method((i,n,a)=>i.AddParam(n,a)),SendSignal:this.method(i=>i.SendSignal()),AddInt:this.method((i,n)=>i.AddInt(n)),AddIntList:this.method((i,n)=>i.AddIntList(n)),AddFloat:this.method((i,n)=>i.AddFloat(n)),AddFloatList:this.method((i,n)=>i.AddFloatList(n)),AddString:this.method((i,n)=>i.AddString(n)),AddStringList:this.method((i,n)=>i.AddStringList(n)),AddVector3:this.method((i,n)=>i.AddVector3(n)),AddVector3List:this.method((i,n)=>i.AddVector3List(n)),AddBool:this.method((i,n)=>i.AddBool(n)),AddBoolList:this.method((i,n)=>i.AddBoolList(n)),AddGuid:this.method((i,n)=>i.AddGuid(n)),AddGuidList:this.method((i,n)=>i.AddGuidList(n)),AddEntity:this.method((i,n)=>i.AddEntity(n)),AddEntityList:this.method((i,n)=>i.AddEntityList(n)),AddPrefabId:this.method((i,n)=>i.AddPrefabId(n)),AddPrefabIdList:this.method((i,n)=>i.AddPrefabIdList(n)),AddConfigId:this.method((i,n)=>i.AddConfigId(n)),AddConfigIdList:this.method((i,n)=>i.AddConfigIdList(n))})}luaRequire(t){let i=te(t,1),n=this.normalizeRequirePath(i),a=this.requireAliases.get(n)||n;u.lua_rawgeti(t,At,u.LUA_RIDX_MAINTHREAD);let r=u.lua_tothread(t,-1);u.lua_pop(t,1);let o=this.requireCache.get(r);o||(o=new Map,this.requireCache.set(r,o));let s=o.get(a);if(s?.loading)return u.lua_pushstring(t,F(`failed to load script '${n}': cyclic require`)),u.lua_error(t);if(s&&s.ref!=null)return u.lua_rawgeti(t,At,s.ref),1;let c=this.scriptFiles.get(a);if(c==null)return u.lua_pushstring(t,F(`failed to load script '${n}'`)),u.lua_error(t);let l=u.lua_gettop(t);o.set(a,{loading:!0});try{this.loadModule(t,r,a,c),u.lua_pushvalue(t,-1);let d=Z.luaL_ref(t,At);return o.set(a,{ref:d}),1}catch(d){return o.delete(a),u.lua_settop(t,l),u.lua_pushstring(t,F(`failed to load script '${n}': ${d.message||d}`)),u.lua_error(t)}}newLuaThread(){let t=Z.luaL_newstate();return gs.luaL_openlibs(t),Es(t),this.installMetatables(t),this.installGlobals(t),this.luaStates.add(t),u.lua_pushglobaltable(t),this.copyLuaEnvironment(t,-1),u.lua_remove(t,-2),this.moduleBaseEnvironments.set(t,Z.luaL_ref(t,At)),t}copyLuaEnvironment(t,i){let n=u.lua_absindex(t,i);u.lua_newtable(t);let a=u.lua_absindex(t,-1);for(u.lua_pushnil(t);u.lua_next(t,n)!==0;)u.lua_pushvalue(t,-2),u.lua_pushvalue(t,-2),u.lua_rawset(t,a),u.lua_pop(t,1);u.lua_pushvalue(t,a),u.lua_setfield(t,a,F("_G"))}closeTrackedLuaState(t){if(!t||!this.luaStates.has(t))return;for(let n of this.requireCache.get(t)?.values()||[])n.ref!=null&&Z.luaL_unref(t,At,n.ref);this.requireCache.delete(t);let i=this.moduleBaseEnvironments.get(t);if(i!=null&&Z.luaL_unref(t,At,i),this.moduleBaseEnvironments.delete(t),this.luaStates.delete(t),this.luaFunctions)for(let[n,a]of this.luaFunctions)a.__luaState===t&&this.luaFunctions.delete(n);xs(t)}loadModule(t,i,n,a){let r={__kind:"Script",alive:!0,scriptMappingId:this.resolveScriptMappingId(),object:null,path:n,enabled:!0,updateEnabled:!1,params:{},env:t,invoke(){}},o=String(a).replace(/^\uFEFF/,""),s=Sn(o);if(Z.luaL_loadbuffer(t,s,s.length,F(`@${n}`))!==ze)throw new Error(te(t,-1));let l=u.lua_absindex(t,-1);if(u.lua_rawgeti(t,At,this.moduleBaseEnvironments.get(i)),this.copyLuaEnvironment(t,-1),u.lua_remove(t,-2),this.pushScript(t,r),u.lua_setfield(t,-2,F("script")),u.lua_setupvalue(t,l,1),u.lua_pcall(t,0,1,0)!==ze)throw new Error(te(t,-1))}mountScript({path:t,source:i,control:n,params:a={},scriptMappingId:r=void 0}){this.L||this.boot();let o=this.newLuaThread(),s={__kind:"Script",alive:!0,scriptMappingId:this.resolveScriptMappingId(r),object:n,path:this.normalizeRequirePath(t),enabled:!0,updateEnabled:!1,params:a,env:o,lifecyclePhase:"idle"};s.invoke=(l,d)=>this.invokeOn(o,l,d),n&&n.scripts.push(s),this.mountedScripts.push(s),this.pushScript(o,s),u.lua_setglobal(o,F("script"));let c=this.lifecyclePhase;try{this.lifecyclePhase="OnInit",s.lifecyclePhase="OnInit",this.runChunk(o,i,t);let l=this.callGlobal(o,"OnInit");l&&this.mountErrors.push(l),this.lifecyclePhase="OnEnable",s.lifecyclePhase="OnEnable";let d=this.callGlobal(o,"OnEnable");d&&this.mountErrors.push(d),this.lifecyclePhase="OnStart",s.lifecyclePhase="OnStart";let f=this.callGlobal(o,"OnStart");return f&&this.mountErrors.push(f),this.lifecyclePhase="running",s.lifecyclePhase="running",s}catch(l){throw s.alive=!1,s.lifecyclePhase="failed",this.mountedScripts=this.mountedScripts.filter(d=>d!==s),n&&(n.scripts=n.scripts.filter(d=>d!==s)),this.varHandlers=this.varHandlers.filter(d=>d.script!==s),this.signalHandlers=this.signalHandlers.filter(d=>d.script!==s),this.lifecyclePhase=c,o&&o!==this.L&&this.closeTrackedLuaState(o),s.env=null,l}}runChunk(t,i,n){let a=String(i).replace(/^\uFEFF/,""),r=Sn(a),o=Z.luaL_loadbuffer(t,r,r.length,F(`@${n}`));if(o!==ze){let c=te(t,-1)||`luaL_loadbuffer status ${o}`;throw u.lua_pop(t,1),new Error(c)}let s=u.lua_pcall(t,0,0,0);if(s!==ze){let c=te(t,-1)||`lua_pcall status ${s}`;throw u.lua_pop(t,1),new Error(c)}}callGlobal(t,i){if(u.lua_getglobal(t,F(i)),u.lua_isfunction(t,-1)){if(u.lua_pcall(t,0,0,0)!==ze){let a=te(t,-1);u.lua_pop(t,1);let r=`${i}: ${a}`;return this.log("lua-error",r),r}}else u.lua_pop(t,1);return null}callGlobalDt(t,i,n){if(u.lua_getglobal(t,F(i)),u.lua_isfunction(t,-1)){if(u.lua_pushnumber(t,n),u.lua_pcall(t,1,0,0)!==ze){let r=te(t,-1);u.lua_pop(t,1),this.log("lua-error",`${i}: ${r}`)}}else u.lua_pop(t,1)}luaInvoke(t){let i=it(t,1);if(!i||i.__kind!=="Script")return Z.luaL_error(t,F("bad self to 'Invoke' (Script expected)"));let n=te(t,2),a=i.env;if(!a||a.l_G!==t.l_G){let c=[];for(let f=3;f<=u.lua_gettop(t);f++)c.push(be(t,this,f));let l;try{l=i.invoke(n,c)}catch(f){return Z.luaL_error(t,F(String(f.message||f)))}if(l===void 0)return 0;let d=Array.isArray(l)&&l.__multi?l:[l];for(let f of d)ce(t,this,f);return d.length}let r=2;if(u.lua_getglobal(t,F(n)),!u.lua_isfunction(t,-1))return 0;u.lua_replace(t,r),u.lua_remove(t,1);let o=u.lua_gettop(t)-1;return u.lua_pcall(t,o,Os,0)!==ze?u.lua_error(t):u.lua_gettop(t)}invokeOn(t,i,n){let a=u.lua_gettop(t);if(u.lua_getglobal(t,F(i)),!u.lua_isfunction(t,-1)){u.lua_settop(t,a);return}for(let c of n)ce(t,this,c);if(u.lua_pcall(t,n.length,Os,0)!==ze){let c=te(t,-1);throw u.lua_settop(t,a),new Error(c)}let o=u.lua_gettop(t)-a;if(o<=0){u.lua_settop(t,a);return}if(o===1){let c=be(t,this,-1);return u.lua_settop(t,a),c}let s=[];for(let c=1;c<=o;c++)s.push(be(t,this,a+c));return u.lua_settop(t,a),s.__multi=!0,s}runScriptPhase(t,i){for(let n of this.mountedScripts){if(!this.scriptCanRun(n))continue;let a=n.env;a&&(this.pushScript(a,n),u.lua_setglobal(a,F("script")),!(t==="OnUpdate"&&!n.updateEnabled)&&this.callGlobalDt(a,t,i))}}step(t=1/30){if(typeof t!="number"||!Number.isFinite(t)||t<0)throw new TypeError("dt must be a finite non-negative number");this.clock.frame++,this.clock.time+=t;for(let[n,a]of this.audios)this.clock.time+1e-9>=a.startedAt+a.duration&&(a.alive=!1,this.audios.delete(n),this.audioRevision++);let i=!this.clock.paused;for(let n of[...this.animations])n.step(t);this.runScriptPhase("OnUpdate",t),i&&(this.clock.levelTime+=t,this.runScriptPhase("OnLevelUpdate",t))}injectKey(t){let i=n=>{if(!n.alive||!n.activeInHierarchy)return!1;if(n.keyListeners.has(t)&&n.emitKey(t))return!0;for(let a of[...n.children])if(i(a))return!0;return!1};for(let n of[...this.roots])i(n)}injectCursor(t,i,n){let a=n||this.makeCursorEventData({});Number.isFinite(a.x)&&Number.isFinite(a.y)&&(this.cursor.x=a.x,this.cursor.y=a.y),t.emitCursor(i,a)}getVar(t,i){if(this.serverBridge&&typeof this.serverBridge.getVar=="function")return this.serverBridge.getVar(t,i);let n=this.serverVars[t];return n?n[i]:void 0}notifyVarHandlers(t,i){for(let n of this.varHandlers)this.scriptCanRun(n.script)&&n.entityType===t&&n.name===i&&this.safeCall(n.fn,this.enumTree.CustomVariableEntityType[t],i)}setVar(t,i,n){if(this.serverBridge&&typeof this.serverBridge.setVar=="function"){this.serverBridge.setVar(t,i,n);return}let a=this.serverVars[t]||(this.serverVars[t]=Object.create(null));a[i]=n,this.notifyVarHandlers(t,i)}sendClientSignal(t,i){for(let n of this.signalHandlers)this.scriptCanRun(n.script)&&n.name===t&&this.safeCall(n.fn,t,i)}evalQueryScript(t,i){this.L||this.boot();let n=this.L;u.lua_createtable(n,0,5);let a=(r,o)=>{u.lua_pushcfunction(n,o),u.lua_setfield(n,-2,F(r))};return a("var",r=>(ce(r,this,i.var(te(r,1),te(r,2))),1)),a("logContains",r=>(u.lua_pushboolean(r,i.logContains(te(r,1))),1)),a("control",r=>(ce(r,this,i.control(te(r,1))),1)),a("logs",r=>(ce(r,this,i.logs()),1)),a("signals",r=>(ce(r,this,i.signals(te(r,1))),1)),a("serverLogs",r=>(ce(r,this,i.serverLogs?i.serverLogs():[]),1)),a("serverLogContains",r=>{let o=i.serverLogContains;return u.lua_pushboolean(r,o?!!o(te(r,1)):!1),1}),u.lua_setglobal(n,F("query")),this.runChunk(n,t,"autotest-assert"),!0}destroy(){for(let t of this.roots.slice())this.destroyControl(t);for(let t of this.mountedScripts.slice())this.unmountScript(t);this.lifecyclePhase="idle",this.mountedScripts=[],this.luaFunctions.clear();for(let t of[...this.luaStates])this.closeTrackedLuaState(t);this.L=null,this.audios.clear(),this.audioHistory.length=0,this.audioWarnings.clear()}};function Ti(e){let t=new An(e);return t.boot(),t}var Pt=Object.freeze(Array.from({length:8},(e,t)=>`Player${t+1}`)),nr=Object.freeze(Array.from({length:8},(e,t)=>`Avatar${t+1}`)),Ls=Object.freeze(["Level","PlayerSelf","AvatarSelf"]);var tr=Object.freeze([...Ls,...Pt,...nr]),Us=Object.freeze(["PlayerSelf","AllPlayers",...Pt]),D0=Object.freeze(["Level","PlayerSelf",...Pt]),$s=Object.freeze(["Int","Float","String","Bool","Vector3","Entity","Guid","PrefabId","ConfigId","IntList","FloatList","StringList","BoolList","Vector3List","EntityList","GuidList","PrefabIdList","ConfigIdList","Dict","Struct"]),z0=-2147483648,G0=2147483647,V0=new Set(["set-custom-variable","get-custom-variable","custom-variable-changed","\u8BBE\u7F6E\u81EA\u5B9A\u4E49\u53D8\u91CF","\u83B7\u53D6\u81EA\u5B9A\u4E49\u53D8\u91CF","\u81EA\u5B9A\u4E49\u53D8\u91CF\u53D8\u5316\u65F6","send-signal","listen-signal","send-client-script-signal","\u53D1\u9001\u4FE1\u53F7","\u76D1\u542C\u4FE1\u53F7","\u53D1\u9001\u5BA2\u6237\u7AEF\u811A\u672C\u4FE1\u53F7","setVar","getVar","signal","var"]);function Mi(e){return`Player${Number(e)}`}function _n(e){return`Avatar${Number(e)}`}function Ds(e){let t=String(e||"").match(/^(?:Player|Avatar)([1-8])$/);return t?Number(t[1]):0}function _t(e){if(e==null||e==="")return 1;let t=Number(e);if(!Number.isInteger(t)||t<1||t>8)throw new Error("playerCount must be an integer 1-8");return t}function nt(e,t=8){let i=_t(t);if(e==null||e==="")return 1;let n=Number(e);if(!Number.isInteger(n)||n<1||n>i)throw new Error(`playerIndex must be an integer 1-${i}`);return n}function zs(){let e={Level:Object.create(null),PlayerSelf:Object.create(null),AvatarSelf:Object.create(null)};for(let t of Pt)e[t]=Object.create(null);for(let t of nr)e[t]=Object.create(null);return e}function js(e){let t=String(e||"");if(!tr.includes(t))throw new Error(`unknown CustomVariableEntityType: ${e}`);return t}function B0(e,t){let i=js(e);if(!D0.includes(i))throw new Error(`${t}.entityType must be Level, PlayerSelf, or Player1-8`);return i}function Ri(e){let t=String(e??"");if(!t)throw new Error("custom variable name is required");return t}function Pn(e){let t=String(e??"");if(!t)throw new Error("signal name is required");return t}function ir(e){let t=String(e||"PlayerSelf");if(!Us.includes(t))throw new Error(`unsupported client signal target: ${e}. use PlayerSelf, AllPlayers, or Player1-8`);return t}function Ni(e){if(e==null)return"";if(typeof e=="boolean")return"Bool";if(typeof e=="string")return"String";if(typeof e=="number")return Number.isInteger(e)?"Int":"Float";if(Array.isArray(e)){if(e.length===0)return"IntList";let t=Ni(e[0]);return t&&!t.endsWith("List")&&t!=="Dict"&&t!=="Struct"?`${t}List`:"IntList"}return e&&typeof e=="object"?"x"in e||"y"in e||"z"in e?"Vector3":"Dict":""}function Ce(e){return e===void 0?null:JSON.parse(JSON.stringify(e))}function Gs(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"value")&&"type"in t?t.value:t):[]}function Vs(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"value")&&"type"in t?{type:String(t.type||""),value:t.value}:{type:Ni(t),value:t}):[]}function H0(e){return String(e?.kind||e?.type||e?.name||e?.id||"")}function Tn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ys(e,t){if(!Tn(e)||!Object.prototype.hasOwnProperty.call(e,"fromSignalParam"))return null;if(Object.keys(e).some(n=>n!=="fromSignalParam"))throw new Error(`${t}.fromSignalParam cannot be combined with literal fields`);let i=Number(e.fromSignalParam);if(!Number.isSafeInteger(i)||i<0)throw new Error(`${t}.fromSignalParam must be a non-negative integer`);return{fromSignalParam:i}}function Bs(e,t){return Ys(e,t)||Ce(e)}function L0(e,t,i){if(!Tn(e))throw new Error(`serverLogic.rules[${t}].actions[${i}] must be an object`);let n=String(e.kind||e.type||""),a=`serverLogic.rules[${t}].actions[${i}]`;if(n==="setCustomVariable"){let r=B0(e.entityType,a);if(!Object.prototype.hasOwnProperty.call(e,"value"))throw new Error(`${a}.value is required`);return{kind:n,entityType:r,name:Ri(e.name),value:Bs(e.value,`${a}.value`),...e.variableType?{variableType:String(e.variableType)}:{}}}if(n==="sendClientScriptSignal"){if(!Array.isArray(e.params))throw new Error(`${a}.params must be an array`);return{kind:n,target:ir(e.target),signalName:Pn(e.signalName),params:e.params.map((r,o)=>Bs(r,`${a}.params[${o}]`))}}throw new Error(`${a}.kind must be setCustomVariable or sendClientScriptSignal`)}function Fi(e){if(e==null)return{version:1,rules:[]};if(!Tn(e))throw new Error("serverLogic must be an object");let t=e.rules===void 0?[]:e.rules;if(!Array.isArray(t))throw new Error("serverLogic.rules must be an array");return{version:1,rules:t.map((i,n)=>{if(!Tn(i))throw new Error(`serverLogic.rules[${n}] must be an object`);if(!Array.isArray(i.actions)||i.actions.length===0)throw new Error(`serverLogic.rules[${n}].actions must be a non-empty array`);return{id:String(i.id||`signal-${n+1}`),signalName:Pn(i.signalName),actions:i.actions.map((a,r)=>L0(a,n,r))}})}}function Hs(e,t,{typed:i=!1}={}){let n=Ys(e,"server logic value");if(n){let a=i?t.params:t.values;if(n.fromSignalParam>=a.length)throw new Error(`signal ${t.name} has no parameter at index ${n.fromSignalParam}`);return Ce(a[n.fromSignalParam])}return Ce(e)}function U0(e){return e==="Level"?"Level":Pt.includes(e)?"PlayerSelf":nr.includes(e)?"AvatarSelf":e}function Xs(e={}){let t=zs(),i=zs(),n=[],a=[],r=[],o=[],s=Array.from({length:9},()=>null),c=1,l=0,d=Number(e.onlineLatencyMs||0);(!Number.isFinite(d)||d<0)&&(d=0);let f=Fi(e.logic),h=_t(e.playerCount),m=nt(e.viewPlayerIndex,h);function p(S,A){o.push({source:"server",level:String(S||"engine"),text:String(A),time:l})}function b(S){let A=s[S||m],E=Number(A?.clock?.time);Number.isFinite(E)&&(l=E)}function v(S,A,E,C){t[S][A]=E,i[S][A]={type:C||Ni(E)||i[S][A]?.type||""}}function y(S,A,E){return typeof E!="number"||!Number.isInteger(E)?{ok:!0,value:E}:E>=z0&&E<=G0?{ok:!0,value:E}:(p("engine",`Int custom variable ${S}.${A} out of range ${E}; keeping previous legal value`),{ok:!1,value:t[S][A]})}function w(S,A){let E=js(S),C=A||m;return E==="PlayerSelf"?Mi(C):E==="AvatarSelf"?_n(C):E}function _(S,A){let E=U0(S);if(S==="Level"){for(let k=1;k<=h;k+=1){let P=s[k];P&&typeof P.notifyVarHandlers=="function"&&P.notifyVarHandlers("Level",A)}return}let C=Ds(S);if(!C)return;let z=s[C];z&&typeof z.notifyVarHandlers=="function"&&z.notifyVarHandlers(E,A)}function T(S,A){let E=ir(S);return E==="AllPlayers"?Array.from({length:h},(C,z)=>z+1):E==="PlayerSelf"?[A||m]:[Ds(E)]}function N(S){for(let A of f.rules)if(A.signalName===S.name)for(let E of A.actions){if(E.kind==="setCustomVariable"){let C=Hs(E.value,S);$.setVar(E.entityType,E.name,C,{type:E.variableType,playerIndex:S.playerIndex}),p("info",`logic ${A.id}: set ${E.entityType}.${E.name}`);continue}if(E.kind==="sendClientScriptSignal"){let C=E.params.map(z=>Hs(z,S,{typed:!0}));$.sendToClient(E.signalName,C,{target:E.target,playerIndex:S.playerIndex}),p("info",`logic ${A.id}: sent ${E.signalName} to ${E.target}`)}}}function O(S,A){S&&(S.serverBridge={getVar:(E,C)=>$.getVar(E,C,{playerIndex:A}),setVar:(E,C,z)=>$.setVar(E,C,z,{playerIndex:A}),receiveFromClient:(E,C)=>$.receiveFromClient(E,C,{playerIndex:A})})}function V(S){S&&(S.serverBridge=null)}let $={ENTITY_TYPES:Ls,ALL_ENTITY_TYPES:tr,CLIENT_SIGNAL_TARGETS:Us,get clock(){return l},get playerCount(){return h},get viewPlayerIndex(){return m},setClock(S){l=Number(S)||0},setPlayerCount(S){return h=_t(S),m>h&&(m=h),h},setViewPlayerIndex(S){return m=nt(S,h),m},log(S,A){p(S,A)},defineVar(S,A,E={},{playerIndex:C}={}){let z=w(S,C),k=Ri(A);if(Object.prototype.hasOwnProperty.call(t[z],k))throw new Error(`custom variable already exists: ${z}.${k}`);let P=E.type?String(E.type):Ni(E.value??E.defaultValue);if(P&&!$s.includes(P))throw new Error(`unsupported custom variable type: ${P}`);let B=E.value!==void 0?E.value:E.defaultValue!==void 0?E.defaultValue:null;return v(z,k,B,P),$.getVar(z,k)},getVar(S,A,{playerIndex:E}={}){let C=w(S,E),z=Ri(A);if(!Object.prototype.hasOwnProperty.call(t[C],z)){p("engine",`GetGlobalCustomVariableValue missing ${C}.${z}; returning nil (simulator policy)`);return}return t[C][z]},setVar(S,A,E,{notify:C=!0,type:z,playerIndex:k}={}){let P=w(S,k),B=Ri(A),j=z||i[P][B]?.type||Ni(E);if(j&&!$s.includes(j)&&j!=="")throw new Error(`unsupported custom variable type: ${j}`);let ae=E;if(!((j==="Int"||j===""&&typeof E=="number"&&Number.isInteger(E))&&(ae=y(P,B,E).value,ae===void 0)))return v(P,B,ae,j),C&&_(P,B),ae},listVars(S){let A=S?[w(S)]:["Level",...Array.from({length:h},(C,z)=>Mi(z+1)),...Array.from({length:h},(C,z)=>_n(z+1))],E=[];for(let C of A)for(let z of Object.keys(t[C]))E.push({entityType:C,name:z,type:i[C][z]?.type||"",value:Ce(t[C][z])});return E},receiveFromClient(S,A=[],{playerIndex:E}={}){let C=nt(E||m,h);b(C);let z=Pn(S),k={id:c++,direction:"inbound",name:z,params:Vs(A),values:Gs(A),time:l,playerIndex:C,from:Mi(C)};return n.push(k),N(k),k},sendToClient(S,A=[],{target:E="PlayerSelf",playerIndex:C}={}){let z=Pn(S),k=ir(E),B=T(k,C||m),j={id:c++,direction:"outbound",name:z,params:Vs(A),values:Gs(A),time:l,target:k,players:B,deliverAt:l+d/1e3,delivered:!1};return a.push(j),d===0?$.deliver(j):r.push(j),j},getLogic(){return Ce(f)},setLogic(S){return f=Fi(S),$.getLogic()},deliver(S){if(!S||S.delivered)return;S.delivered=!0;let A=Array.isArray(S.players)&&S.players.length?S.players:T(S.target);for(let E of A){let C=s[E];C&&typeof C.sendClientSignal=="function"&&C.sendClientSignal(S.name,S.values)}},flush(S){S!==void 0&&(l=Number(S)||0);let A=[];for(let E=r.length-1;E>=0;E-=1)r[E].deliverAt<=l&&A.push(r.splice(E,1)[0]);A.sort((E,C)=>E.id-C.id);for(let E of A)$.deliver(E);return A},inbound(){return n.slice()},outbound(){return a.slice()},loadConfig(S){if(S!=null){if(typeof S!="object")throw new Error("server config must be an object");if(S.graph&&!Array.isArray(S.nodes))throw new Error("unsupported server node graph: v1 only accepts custom variables and signals");for(let A of S.nodes||[]){let E=H0(A);if(!V0.has(E))throw new Error(`unsupported server node: ${E||JSON.stringify(A)}. v1 only supports custom variables and signals`)}if(S.onlineLatencyMs!==void 0){let A=Number(S.onlineLatencyMs);if(!Number.isFinite(A)||A<0)throw new Error("onlineLatencyMs must be a non-negative finite number");d=A}S.playerCount!==void 0&&$.setPlayerCount(S.playerCount),S.viewPlayerIndex!==void 0&&$.setViewPlayerIndex(S.viewPlayerIndex),(S.logic!==void 0||S.serverLogic!==void 0)&&$.setLogic(S.logic??S.serverLogic);for(let A of S.vars||[]){let E=w(A.entityType),C=Ri(A.name);Object.prototype.hasOwnProperty.call(t[E],C)?$.setVar(E,C,A.value??A.defaultValue,{notify:!1,type:A.type}):$.defineVar(E,C,A)}}},attachRuntime(S,{playerIndex:A=1}={}){let E=nt(A,8);return s[E]&&s[E]!==S&&V(s[E]),s[E]=S||null,O(s[E],E),$},attachRuntimes(S){$.detachRuntime();let A=Array.isArray(S)?S:[];for(let E=0;E<A.length&&E<8;E+=1)s[E+1]=A[E]||null,O(s[E+1],E+1);return $},detachRuntime(){for(let S=1;S<=8;S+=1)V(s[S]),s[S]=null},snapshot(){let S=Mi(m),A=_n(m),E={Level:{},PlayerSelf:{},AvatarSelf:{}};for(let C of Object.keys(t.Level))E.Level[C]={type:i.Level[C]?.type||"",value:Ce(t.Level[C])};for(let C of Object.keys(t[S]))E.PlayerSelf[C]={type:i[S][C]?.type||"",value:Ce(t[S][C])};for(let C of Object.keys(t[A]))E.AvatarSelf[C]={type:i[A][C]?.type||"",value:Ce(t[A][C])};for(let C=1;C<=h;C+=1){let z=Mi(C),k=_n(C);E[z]={},E[k]={};for(let P of Object.keys(t[z]))E[z][P]={type:i[z][P]?.type||"",value:Ce(t[z][P])};for(let P of Object.keys(t[k]))E[k][P]={type:i[k][P]?.type||"",value:Ce(t[k][P])}}return{clock:l,onlineLatencyMs:d,playerCount:h,viewPlayerIndex:m,logic:$.getLogic(),vars:E,inbound:n.map(C=>({id:C.id,name:C.name,params:Ce(C.params),values:Ce(C.values),time:C.time,playerIndex:C.playerIndex,from:C.from})),outbound:a.map(C=>({id:C.id,name:C.name,params:Ce(C.params),values:Ce(C.values),time:C.time,target:C.target,players:Array.isArray(C.players)?C.players.slice():[],deliverAt:C.deliverAt,delivered:!!C.delivered})),logs:o.map(C=>({source:"server",level:C.level,text:C.text,time:C.time}))}},reset(){for(let S of tr){for(let A of Object.keys(t[S]))delete t[S][A];for(let A of Object.keys(i[S]))delete i[S][A]}n.length=0,a.length=0,r.length=0,o.length=0,c=1,l=0},destroy(){$.detachRuntime(),$.reset()}};e.config&&$.loadConfig(e.config);for(let S of e.vars||[])$.defineVar(S.entityType,S.name,S);return $}var j0={container:"container",textbox:"textbox",image:"image",button:"button",cursor:"cursor",grid:"grid",reference:"reference",textwindow:"textwindow",keyhint:"keyhint",animation:"animation",fullscreen:"fullscreen"};function ar(e,t,i=null){let n=ct(e.transformByPlatform,t),a={authoringId:e.id,kind:j0[e.kind]||"container",name:e.name,prefabIndex:e.guid||0,active:e.active!==!1,visible:e.visible!==!1,canControllerFocus:e.canControllerFocus===!0,anchoredPositionX:n.offset.x,anchoredPositionY:n.offset.y,sizeDeltaX:n.size.x,sizeDeltaY:n.size.y,anchorMinX:n.anchorMin.x,anchorMinY:n.anchorMin.y,anchorMaxX:n.anchorMax.x,anchorMaxY:n.anchorMax.y,pivotX:n.pivot.x,pivotY:n.pivot.y,localScaleX:n.scale.x,localScaleY:n.scale.y,localScaleZ:n.scale.z,localRotationX:n.rotation.x,localRotationY:n.rotation.y,localRotationZ:n.rotation.z,children:(e.children||[]).map(o=>ar(o,t,i))},r=i?.get(e.id);if(r?.length&&(a.scripts=r.map(o=>{let s=Number(o.guid);return{path:o.path||o.id,source:o.source||"",...Number.isSafeInteger(s)&&s>0?{scriptMappingId:s}:{}}})),e.kind==="container"&&(a.isolateNavigation=e.isolateNavigation===!0,a.disableKeyEventPassthrough=e.disableKeyEventPassthrough===!0,a.disableCursorEventPassthrough=e.disableCursorEventPassthrough===!0,a.showCursor=e.showCursor===!0),(e.kind==="textbox"||e.kind==="textwindow")&&(a.text=e.text??"",a.fontSize=e.fontSize,a.adaptiveFontSize=e.adaptiveFontSize===!0,a.minimumFontSize=e.minimumFontSize,a.fontColor=e.fontColor,a.bgColor=e.bgColor,a.enableOutline=e.enableOutline!==!1,a.outlineColor=e.outlineColor,a.horizontalAlignment=e.horizontalAlignment||"Left",a.verticalAlignment=e.verticalAlignment||"Top",e.kind==="textwindow"&&(a.interactable=e.interactable!==!1,a.showScrollBar=e.showScrollBar!==!1)),e.kind==="image"&&(a.imageSource=e.imageSource,a.imageType=e.imageType??null,a.imageId=e.imageId??0,a.imageColor=e.imageColor,a.raycastTarget=e.raycastTarget===!0,a.enableMask=e.enableMask===!0,a.enableSoftEdge=e.enableSoftEdge===!0,a.softEdgeMode=e.softEdgeMode,a.softEdgeWidthX=e.softEdgeWidthX,a.softEdgeWidthY=e.softEdgeWidthY,a.horizontalSoftRange=e.horizontalSoftRange,a.verticalSoftRange=e.verticalSoftRange,a.enableFill=e.enableFill===!0,a.fillType=e.enableFill?e.fillType:"Unused",a.fillHorizontalType=e.fillHorizontalType,a.fillVerticalType=e.fillVerticalType,a.fillRadial90Type=e.fillRadial90Type,a.fillRadialType=e.fillRadialType,a.fillAmount=e.fillAmount,a.reverseMaskArea=e.reverseMaskArea===!0),e.kind==="button"&&(a.raycastTarget=e.raycastTarget!==!1,a.interactable=e.interactable!==!1,a.clickAudioId=e.clickAudioId,a.unavailableChildId=e.unavailableChildId??null,a.hoverChildId=e.hoverChildId??null,a.pressedChildId=e.pressedChildId??null,a.selectedChildId=e.selectedChildId??null),e.kind==="cursor"&&(a.raycastTarget=e.raycastTarget!==!1),e.kind==="reference"&&(a.referencedPrefabIndex=e.referencedPrefabId),e.kind==="grid"&&(a.itemPrefabIndex=e.itemPrefabId,a.raycastTarget=e.raycastTarget!==!1,a.interactable=e.interactable!==!1,a.showScrollBar=e.showScrollBar!==!1,a.scrollDirection=e.scrollDirection,a.layoutConstraint=e.layoutConstraint,a.layoutConstraintFixedCount=e.layoutConstraintFixedCount,a.cellSizeX=e.cellSizeX,a.cellSizeY=e.cellSizeY,a.spacingX=e.spacingX,a.spacingY=e.spacingY,a.padding1X=e.padding1X,a.padding1Y=e.padding1Y,a.padding2X=e.padding2X,a.padding2Y=e.padding2Y,a.previewCount=e.previewCount),e.kind==="keyhint"&&(a.keyboardKeyCode=e.keyboardKeyCode,a.controllerKeyCode=e.controllerKeyCode),e.kind==="animation"||e.kind==="fullscreen"){a.raycastTarget=!1;let o=Number(e.animationId);a.animationId=e.animationId!=null&&String(e.animationId).trim()!==""&&Number.isSafeInteger(o)?o:e.animationId,a.playSoundEffect=e.playSoundEffect,e.kind==="animation"&&(a.layer=e.layer)}return a}function rr(e,t=[],i=""){let n=i&&J[i]?i:e.canvasId,a=J[n],r=vi(e),o=new Map;for(let c of t){if(!c.controlId)continue;let l=o.get(c.controlId)||[];l.push(c),o.set(c.controlId,l)}let s=e.meta?.assetType==="client-control-template"?(e.root.children||[]).map(c=>ar(c,n,o)):[];return{canvasId:n,platform:a.platform,device:a.luaDevice,canvasWidth:a.width,canvasHeight:a.height,root:ar(r,n,o),templates:s}}var Mn="qxqy-autotest";var Mt=.03333333333333333,Y0=new Set(["pointer","key","click","pause","resume","serverSet","serverSend","view"]),X0=new Set(["log","control","var","signal","tree","lua"]);function Tt(e,t){let i=Number(e);if(!Number.isFinite(i))throw new Error(`${t} must be a finite number`);return i}function or(e){return JSON.parse(JSON.stringify(e??null))}function Rn(e,t){if(!e||typeof e!="object")throw new Error(`events[${t}] must be an object`);let i=String(e.kind||e.do||"");if(!Y0.has(i))throw new Error(`unsupported event kind: ${i||"(empty)"}`);let n=e.payload&&typeof e.payload=="object"?{...e.payload}:{};if(i==="pointer")!n.type&&e.type&&(n.type=e.type),n.x===void 0&&(n.x=e.x),n.y===void 0&&(n.y=e.y),n.x=Tt(n.x,"pointer.x"),n.y=Tt(n.y,"pointer.y"),n.type=String(n.type||"click"),n.type==="wheel"&&(n.deltaX=Tt(n.deltaX??e.deltaX??0,"pointer.deltaX"),n.deltaY=Tt(n.deltaY??e.deltaY??0,"pointer.deltaY"));else if(i==="key"){if(n.typeName=String(n.typeName||n.key||e.typeName||e.key||""),!n.typeName)throw new Error("key event requires typeName")}else if(i==="click"){if(n.name=String(n.name||e.name||""),!n.name)throw new Error("click event requires control name")}else if(i==="serverSet"){if(n.entityType=String(n.entityType||e.entityType||""),n.name=String(n.name||e.name||""),n.value===void 0&&(n.value=e.value),n.value===void 0&&(n.value=null),!n.entityType||!n.name)throw new Error("serverSet requires entityType and name")}else if(i==="serverSend"){if(n.name=String(n.name||e.name||""),n.params=Array.isArray(n.params)?n.params:Array.isArray(e.params)?e.params:[],n.target=String(n.target||e.target||"PlayerSelf"),!n.name)throw new Error("serverSend requires signal name")}else if(i==="view"&&(n.playerIndex=Number(n.playerIndex||n.viewPlayerIndex||e.playerIndex||e.viewPlayerIndex||0),!Number.isInteger(n.playerIndex)||n.playerIndex<1))throw new Error("view event requires playerIndex 1-8");return{t:Tt(e.t??0,"event.t"),source:String(e.source||"user"),kind:i,payload:n}}function sr(e,t){if(!e||typeof e!="object")throw new Error(`asserts[${t}] must be an object`);let i=String(e.kind||(e.check?"log":""));if(!X0.has(i))throw new Error(`unsupported assert kind: ${i||"(empty)"}`);let n={kind:i};if(e.at!==void 0&&(n.at=Tt(e.at,"assert.at")),i==="log"){if(n.contains=String(e.contains||e.check||e.text||""),n.source=e.source==="server"?"server":"client",e.level&&(n.level=String(e.level)),!n.contains)throw new Error("log assert requires contains")}else if(i==="control"){if(n.id=e.id?String(e.id):"",n.name=e.name?String(e.name):"",n.field=String(e.field||""),!n.field)throw new Error("control assert requires field");if(!n.id&&!n.name)throw new Error("control assert requires id or name");if(!Object.prototype.hasOwnProperty.call(e,"equals"))throw new Error("control assert requires equals");n.equals=or(e.equals)}else if(i==="var"){if(n.entityType=String(e.entityType||""),n.name=String(e.name||""),!n.entityType||!n.name)throw new Error("var assert requires entityType and name");if(!Object.prototype.hasOwnProperty.call(e,"equals"))throw new Error("var assert requires equals");n.equals=or(e.equals)}else if(i==="signal"){if(n.direction=e.direction==="outbound"?"outbound":"inbound",n.name=String(e.name||""),!n.name)throw new Error("signal assert requires name");e.values!==void 0&&(n.values=or(e.values))}else if(i==="tree"){if(n.name=String(e.name||""),n.exists=e.exists!==!1,!n.name)throw new Error("tree assert requires name")}else if(i==="lua"&&(n.source=String(e.source||""),!n.source.trim()))throw new Error("lua assert requires source");return n}function Ws(e){let t=0,i=[],n=[];for(let a of e){if(!a||typeof a!="object")throw new Error("queue step must be an object");if(a.do!=="start"){if(a.do==="step"){t+=Tt(a.dt??Mt,"step.dt");continue}if(a.do==="pointer"||a.do==="key"||a.do==="click"||a.do==="pause"||a.do==="resume"||a.do==="serverSet"||a.do==="serverSend"||a.do==="view"){i.push(Rn({...a,kind:a.do,t},i.length));continue}if(a.assert||a.check||a.kind){n.push(sr({...a.assert||a,at:a.at??t},n.length));continue}throw new Error(`unsupported queue step: ${JSON.stringify(a)}`)}}return{events:i,asserts:n,dt:Mt}}function Oi(e){if(Array.isArray(e)){let n=Ws(e);return{format:Mn,version:1,name:"",dt:n.dt,events:n.events,asserts:n.asserts}}if(!e||typeof e!="object")throw new Error("autotest case must be an object or step array");if(Array.isArray(e.queue)||Array.isArray(e.steps)){let n=Ws(e.queue||e.steps);return{format:Mn,version:1,name:String(e.name||""),dt:Number(e.dt)>0?Number(e.dt):n.dt,events:n.events,asserts:n.asserts}}let t=(e.events||[]).map((n,a)=>Rn(n,a)),i=(e.asserts||[]).map((n,a)=>sr(n,a));return t.sort((n,a)=>n.t-a.t||0),{format:Mn,version:1,name:String(e.name||""),dt:Number(e.dt)>0?Number(e.dt):Mt,playerCount:Number(e.playerCount)>0?Number(e.playerCount):1,events:t,asserts:i}}function Ks(e,t={}){let i=(e||[]).map((n,a)=>Rn(n,a));return{format:Mn,version:1,name:String(t.name||""),dt:Number(t.dt)>0?Number(t.dt):Mt,playerCount:Number(t.playerCount)>0?Number(t.playerCount):1,events:i,asserts:(t.asserts||[]).map((n,a)=>sr(n,a))}}function qs(e,t,i){if(!e)return null;let n=Rn({...t,t:t.t??i??0},e.events.length);return e.events.push(n),n}var Nn=(e,t)=>Math.max(0,Math.min(t,Number.isFinite(e)?e:0));function Js(e,t,i){let n=et(e,t,i),a=Math.max(0,n.contentHeight-i),r=Nn(e._scrollOffset||0,a);return e._scrollOffset=r,{...n,length:n.contentHeight,max:a,offset:r,viewport:i,horizontal:!1,width:t,height:i}}function ii(e,t,i){if(!e?.showBar||e.max<=0||t<=0||i<=0)return null;let n=e.horizontal===!0,a=n?t:i,r=Math.max(0,a-4),o=Math.min(r,Math.max(18,r*a/(a+e.max))),s=r-o,c=s*e.offset/e.max,l=Math.min(8,n?i:t),d=n?{x:-t/2+2,y:i/2-l-2,width:r,height:l}:{x:t/2-l-2,y:-i/2+2,width:l,height:r},f=n?{...d,x:d.x+c,width:o}:{...d,y:d.y+c,height:o};return{track:d,thumb:f,travel:s}}var Qs="https://oss.070077.xyz/",cr="mp3-v1",Fn="/qxqy-audio/",W0=[[10001,"ura.1ht4.2ag9.1hh5.jbb.k02.jcw.2tv.2wn.2xk.2r3.d5s.94l.ebv.kcr.b40.77k.9gp.97w.1hb5.jag.btu.jc9.hp5.bmj.blq.blq.ff9.ffk.o74.1owl.rp.mg.l3.lf.lh.qy.1a3z.2xk.2xk.2xk.2xk.2xk.17dc.1f2b.2bc.2bc.2bc.2bc.2bc.ffo.ffo.126.1fk.4mo.4mo.15e.1h2.237.2ba.2kd.2bc.4mo.4mo.4mo.4mo.1mc.1n6.2cu.1ud.2b1.2ee.1tj.1tk"],[20001,"o6.fh.kb.cr.og.sm.6x.8c.87.o7.vz.kt.qo.lg.ob.9w.mg.1kz.zc.1ex.1d5.ps.uu.su.qs.ys.zp.10k.15a.xc.uk.mx.1ax.nt.tu.19m.uj.1ku.tt.100.ie.d3.fp.ie.ie.d3.fp.ie.8p.7k.fw.h0.qc.ot.uc.ot.rk.gb.1c2.ff.cl.9v.wg.1ir.1lr.1b8.1ri.1p0.104.10n.mw.j6.jb.f1.dv.84.a0.cp.bx.1ko.1au.1ia.rs.rt.rs.t7.x6.wi.zc.16f.1i6.2jh.28d.qh.k8.1gz.1ko.2iv.1xp.1l4.1gk.10j.yo.1jk.1jk.xv.104.15o.1xg.1xg.1xi.25i.p1.t1.yh.1ak.1i6.1y2.xt.32u.3g6.1bz.2mn.14l.14c.1e1.op.s8.p2.v5.2ix.1a0.ry.16m.17n.13c.134.ys.yu.xr.sl.sr.sd.yh.z5.gd.gl.hx.h2.g8.fj.iy.hz.jj.th.12n.16r.d3.j9.dg.lj.fl.a7.f9.iw.el.27f.1dh.1rh.2ph.yd.w5.x5.tr.pq.zf.16h.1a5.17t.wy.vn.y8.wl.yv.2ye.2qt.1ah.163.19t.uf.119.2vv.1bm.13h.14p.1so.c3.as.9z.19w.1l4.1nl.rj.we"],[30001,"jo.my.ss.dw.c1.b4.hl.hl.hl.cz.dw.dw.b4.dw.fr.kd.qv.px.px.74.6u.8h.60.8q.8b.eo.eo.eo.8k.a5.99.12v.13y.lg.m4.qr.dw.ex.g0.ef.cd.br.11n.17h.1b8.1c9.9p.ag.9z.l9.m8.m8.lw.m8.cz.99.b4.8c.63.7f.6h.99.re.pp.pi.cq.c9.cp.ck.c6.b0.bd.al.f6.gl.ed.fs.lc.k6.kh.i6.cx.j1.hk.gb.d7.h7.g2.em.kj.kn.k4.j5.rh.t0.qt.mj.i7.ih.i2.hd.3r.8d.6u.6z.by.de.dg.cr.1a5.1ab.16c.18g.n2.ly.no.nt.f9.de.lr.fe.f0.fj.el.fo.t1.g9.ly.h3.g6.de.2ak.2f3.wf.kg.qn.11p.rg.uj.u6.11c.22o.2cs.3dp.3dq.3d5.3d6.1zx.18v"],[40001,"19x.215.2zt.1ex.2pj.7hy.1ur.1gn.1g7.1b1.u9.1tw.108.1ew.rs.1qu.w9.lk.244.qi.b6.tk.jg.jg.jg.y4.c1.b4.iv.hi.r4.n7.gy.ev.qe.12z.18n.dw.1l6.ou.wz.1un.19t.18k.yy.1hs.sl.dw.1vl.100.14k.1q8.209.1jk.1xr.ua.1j2.pr.26h.1gs.s9.px.15v.pf.1jk.xc.1hb.111.172.ut.285.1oh.149.zj.22r.2l9.14a.ok.23y.1eh.xe.1j0.1rp.1cz.wf.1mh.22k.334.1z2.1xo.1br.4ji.5nq.5nf.2za.18r.h3.eo.ia.1kn.dc.ss.s0.1bl.1oc.is.km.177.1ec.1ao.h4.hp.dx.l9.iw.i3.12w.n1.yq.12w.1ju.yx.14s.18b.22t.u3.my.2rb.36w.13u.z8.20r.18g.19r.2x9.w4.q2.1d2.wo.13a.v6.17w.ur.288.1b6.14m.1fi.1xx.1ee.kj.121.j2.1d2.2ad.1ri.2lc.1vk.138.12r.xj.1h5.1c5.2qx.1gj.t2.lv.rf.18q.1kz.dw.2aq.ia.1i9.k5.199.f4.10y.18a.xf.rk.1g9.1q3.10h.sj.15o.e3.dz.sv.135.w9.yg.aw.2a2.19m.22w.1c8.272.13o.104.1sr.rs.1pb.d5.df.kp.jq.1a7.s8.1ao.ba.rb.in.pz.q8.140.ij.1e7.jl.yk.117.10i.1tn.1oj.1sv.sj.1e3.2so.1c7.1gv.178.107.10n.1dx.1qi.1wp.2bc.218.16r.105.xc.z6.11w.1mc.1y9.17p.1cs.2ij.18c.1ie.nn.16c.1ce.xb.1ei.3j0.ve.14x.1sx.285.1b8.1at.v4.rv.rs.10z.xq.11o.15k.xq.u1.i2.pu.i4.l3.9u.oh.mc.nm.pw.1i3.1h4.pj.111.l4.lb.qq.qf.u0.h4.nk.yf.6h.ij.ds.oy.re.m8.1gl.cz.16z.a1.1f8.1x6.vp.dz.gp.g6.fr.vl.fr.gg.qc.aj.99.go.ij.fz.11a.x5.mo.1u9.h0.m8.10m.1an.2bc.3uw.2gk.124.xb.1uk.1b6.2xj.1os.11a.vs.1i9.1lr.2gv.265.668.1xg.45j.404.2x1.1io.3om.4q2.4mo.1d4.2bp.1pr.166.2y6.2bv.361.2nc.2bc.3g0.7g4.334.2bc.2xo.3uw.6ic.4ig.3uw.23v.1la.2zr.1jt.1cq.27a.1n1.19x.1qg.1jn.1ca.26y.2d6.4v4.4mo.4mo.7ps.1jk.153.1fo.1dm.1s2.1w1.oe.1lb.319.2eg.58p.4mo.3dw.2y2.2xm.1u8.1ko.12n.1e0.2sd.1md.2cl.1q2.372.4mo.48s.b14.3fu.334.334.34i.4nf.4ji.5eg.3uw.2u8.1g1.110.37x.2jo.su.334.3aj.3uw.63f.2bc.2bc.8v4.1ts.ax5.5du.34d.3oc.34j.4si.174.rt.1rp.2b0.37d.1ta.2gh.28a.22z.1nc.1a5.1pa.4dd.3ha.2cs.5mv.4mq.5c2.3uw.1gf.4md.113.10x.21o.2hj.1b3.1cx.1ol.3ar.1fv.17t.1a7.2uj.2we.1jk"],[50001,"1o8.1k1.mo.1wu.2c9.22d.1kb.23n.1b8.1ic.24c.2wz.1mq.1mu.1jx.1z1.o3.190.vp.1h7.th.4mo.1rp.4mo.4mo.7ps.zz.143.21v.1nf.34s.1s3.r9.18t.s1.r9.21w.277.ls.25k.5v1.2bc.1kh.wt.14i.1eq.15o.668.sh.rl.3wi.3vc.43c.3yn.17c.f5.xu.jg.176.19v.1xy.23m.18x.30c.10l.13k.v8.vp.17t.qj.17m.1wr.1la.8t.s7.18d.1l2.152.mx.1c8.1l4.1f5.1xe.rz.2hz.1et.13t.xb.14r.15o.z0.1zo.ur.257.1gb.li.12d.15a.132.1m1.3vu.296.1mg.11m.z0.159.mp.hd.x4.1go.ns.xh.2a7.tt.2vb.1bx.1kh.u3.11i.1y1.24e.2hp.2mn.1w6.3zm.166.14g.1mo.2v9.2rg.2f9.1r0.139.m1.k3.ys.1dy.29k.1mm.22m.3zx.4dr.2h7.22o.tv.rm.1et.2wv.2ar.1t7.ku.12s.10b.1v9.1gu.12m.1b3.tv.1c8.tk.10s.ul.1tt.ka.oi.qb.13f.13f.13k.17h.1uh.ez.en.2x7.2ln.2h8.3h8.ig.n9.27o.18b.hl.nm.uk.11a.1ta.1k4.1eh.wv.1go.1gg.sc.18u.1dz.2aq.vt.2l7.25h.1l5.1kn.1vc.1b4.28i.17t.1d6.1k2.18z.jy.jw.dh.1mx.fr.vp.35w.34z.35w.34z.4so.vf.yx.1bg.1d3.2yc.1tg.8q3.99g.am.2du.rm.rg.xa.2cw.xc.1j6.1if.18z.13a.yz.142.1z5.262.1bj.1y8.ur.u5.16j.1pf.1bi.l8.1il.3vz.2dr.jo.ls.18s.16l.18c.141.219.1yz.1fc.24t.27e.481.1vp.25h.1yq.1zn.1uw.11u.1jp.1pz.39o.t6.1mj.1u5.11l.1vd.1dk.1zb.1ic.3ql.14p.1wq.25x.267.zn.zn.1pf.13z.1j7.r9.1hb.4yp.1lt.1cw.1z4.19z.1og.1j4.1cl.1eg.u8.16s.1en.zu.1hr.1js.19g.303.22j.2oa.180.1v7.2ud.2d7.21s.3g9.vh.v1.284.3lg.3lg.17q.1h3.4mo.1cm.1rv.22i.2mc.2j3.27o.333.1q8.237.2ll.23b.2sp.2ll.2ox.2cf.2f8.2hz.1uo.y4.s9.w6.2dg.2q9.up.1m1.1vz.2n8.192.1eb.z7.2em.2q3.1sd.1gj.348.3vf.2iu.29x.1dc.7oj.4pq.5vb.4mx.5me.5sf.5yf.7ps.yj.q0.10w.13p.18b.2wd.11q.2vx.dd.iv.12p.jh.u9.1uy.w0.3f0.3bj.126.qo.1gj.11k.pu.22h.1z6.rp.y4.y0.xl.1d0.11s.wa.1a6.127.10m.12r.1nh.1fy.yo.1js.162.n4.174.1aj.y4.o8.qz.rh.qa.18s.mr.j3.ii.sr.sx.1jk.17l.mj.zr.uy.wa.19t.2bt.xe.1od.hs.xr.5b.12c.1ab.we.gz.mz.4y.sf.11s.e0.1l7.ew.h6.jz.l0.e8.1cx.p6.17u.bw.1ah.10r.10e.o9.1bc.uv.lq.tl.zb.100.jy.b8.bj.336.10n.na.sq.14r.yr.nm.123.tf.l1.zp.1xc.1vk.31l.zl.2bj.2b9.2fv.17p.y0.so.1ln.29c.1eh.nh.xn.131.qc.186.ff.fc.xq.1bm.la.l8.14f.243.111.xi.qw.1qn.11v.1ur.1jx.1ks.s9.nz.269.1zj.2zd.1pv.18n.2vk.p3.1fh.13v.1lf.1lu.2db.1sr.1k3.26o.1dl.1f3.187.2lh.166.v9.xh.1e3.119.s2.mt.1iu.1k6.1o2.12s.u4.2br.1q3.qv.1e4.1zu.1v4.1vk.1t3.3p7.1ob.14d.1ns.1ef.1e4.12w.2kk.1ba.2jx.1e0.1s5.12w.17r.14s.wz.1qp.183.3fb.188.1gr.2ot.168.1u7.w8.28o.1zd.32z.230.w7.vq.x8.1qh.19f.14o.2r9.qg.1ey.1qr.1p6.3a3.1ov.13d.tz.wk.22v.1qa.2l9.yw.yf.nw.p6.1ly.1jk.1nh.x9.q0.17r.17h.ux.uw.12y.p7.g7.kt.14c.ze.1kh.1eo.18a.1d8.26j.15k.19f.1ym.1j5.1c6.11k.1sd.1jp.1ws.13s.1o5.214.sx.px.20x.14h.1ja.s6.1q8.w8.1ks.so.ub.121.202.1ej.1g1.1s8.2bc.4t1.bih.3uw.3pb.avp.6c7.bko.5eg.79c.6wh.3wd.4pn.55j.4a5.3gg.bko.5ei.52p.578.bcv.6gr.2bc.4j9.5y7.9d2.2bb.2bc.668.73z.5pg.50f.5m7.788.267.642.8h2.8h2.49s.64g.5e8.5e8.2bb.3ih.5ur.6bk.578.4ck.3sg.5fe.23i.e9w.2b8.5oj.6bw.2al.2rk.2rk.5pj.n6e.350.6v9.70t.639.3uw.3uw.2bg.639.2bb.2bd.6gj.2bh.660.578.3bk.65e.359.3o0.44i.4tn.1zq.5ee.4a5.3zu.rs.639.33q.5eg.1k1.15o.dw.3uw.b7p.7qd.898.4l4.5uu.5uu.b4g.2yh.2yh.3uw.51a.51a.5kk.66f.iq9.3n7.4nb.46a.1wb.20p.bih.8xa.7ps.70t.70t.4rv.5p1.6aq.ts.63z.668.5v2.5nu.563.55s.55s.5p3.2ga.32x.42x.5cr.4c2.71b.5zp.5c2.66t.4c8.2bc.2bc.2gn.3ea.2kp.fz6.8hz.3e8.4an.bko.j7e.jag.7sr.2bc.3zx.7qd.5ut.5jp.2wk.5q7.3uw.334.4i3.3uw.4bd.5eu.46h.4i2.6t4.446.5s7.5cg.4bk.5nd.7bf.4rt.23b.2bc.2bc.2bc.2bc.2ba.4mo.4dv.3wn.2bc.1we.4he.2bc.4gz.3wn.3km.4xy.4hi.4mr.2bc.247.3yj.2c6.2bc.3aj.446.4ub.3uw.51.e0.86.is.i1.hg.mn.m4.2c.7h.sg.e3.jb.7r.eq.nf.u0.60.4o.ke.47.47.47.47.b8.4x.dr.dy.rw.rw.59.8j.5z.a5.l3.c0.ik.f7.li.lr.7x.dv.du.dd.5e.91.1b.ce.cc.59.bh.e6.8m.9n.cl.lt.7ip.4mr.4si.4kf.vo.we.13e.17n.1iw.2pi.lp.r6.gw.7x.xz.qt.bq.ls.q1.eh.bx.cr.3c.j7.b8.fz.4k.8p.bg.5w.iy.j3.12o.rs.cz.dp.yz.jk.63.63.7ps.7ps.7ps.40g.3jp.4tw.89k.88a.7s0.83d.668.7ps.2fw.2ev.2fp.7ps.2jb.2dh.2ud.25i.24c.2bt.1pa.17r.1a7.7ps.7pt.5rg.4nl.3vv.7qo.31a.2p0.2k0.49a.3v4.3nl.1ug.1ug.1l6.7s1.7ps.2cp.2f8.2i7.7ps.28q.2be.275.1ma.1oz.1q7.16s.1iq.1e0.78m.7ps.2bc.2bc.2bc.bko.2wu.2wu.2wu.3b4.38f.3uw.3uw.3uw.3uw.7ps.7qa.32n.2gg.2wk.7rv.1v3.1qq.1rb.1zk.1my.1zp.1yn.1oh.1uh.7st.9q.9q.9q.9q.9q.kk.kk.kk.kk.kk.dw.dp.dw.rs.rs.rs.rs.s4.sd.54j.5n8.2n6.21r.1nu.1o5.14u.t6.3f7.2j0.32c.304.189.1gf.18w.18j.1st.1vq.116.kw.3uw.3uw.vr.zx.xc.tc.7d.7r.9d.9w.8s.9p.3b.3b"]].map(([e,t])=>[e,t.split(".").map(i=>parseInt(i,36)/1e3)]);function On(e){if(!Number.isSafeInteger(e))return null;for(let[t,i]of W0)if(e>=t&&e<t+i.length)return i[e-t];return null}var $i={version:"ct-v1",catalogSha256:"fcdd2087b0ce558f90489db6c1368211d8b110e8cc755baf1efd731814a53fd4",assets:[{id:10001001,scope:"ui",width:182,height:182,loop:!0,duration:10,name:"\u96F7\u80FD\u91CF\u6EE1\u503C1",nameEn:"Electro Energy Max Value 1",video:"video/10001001.webm",icon:"icon/10001001.png",audio:[]},{id:10001002,scope:"ui",width:182,height:182,loop:!0,duration:10,name:"\u706B\u80FD\u91CF\u6EE1\u503C1",nameEn:"Pyro Energy Max Value 1",video:"video/10001002.webm",icon:"icon/10001002.png",audio:[]},{id:10001003,scope:"ui",width:174,height:182,loop:!0,duration:10,name:"\u8349\u80FD\u91CF\u6EE1\u503C1",nameEn:"Dendro Energy Max Value 1",video:"video/10001003.webm",icon:"icon/10001003.png",audio:[]},{id:10001004,scope:"ui",width:182,height:182,loop:!0,duration:10,name:"\u51B0\u80FD\u91CF\u6EE1\u503C1",nameEn:"Cryo Energy Max Value 1",video:"video/10001004.webm",icon:"icon/10001004.png",audio:[]},{id:10001005,scope:"ui",width:182,height:182,loop:!0,duration:10,name:"\u5CA9\u80FD\u91CF\u6EE1\u503C1",nameEn:"Geo Energy Max Value 1",video:"video/10001005.webm",icon:"icon/10001005.png",audio:[]},{id:10001006,scope:"ui",width:186,height:186,loop:!0,duration:10,name:"\u6C34\u80FD\u91CF\u6EE1\u503C1",nameEn:"Hydro Energy Max Value 1",video:"video/10001006.webm",icon:"icon/10001006.png",audio:[]},{id:10001007,scope:"ui",width:182,height:182,loop:!0,duration:10,name:"\u98CE\u80FD\u91CF\u6EE1\u503C1",nameEn:"Anemo Energy Max Value 1",video:"video/10001007.webm",icon:"icon/10001007.png",audio:[]},{id:10001008,scope:"ui",width:224,height:224,loop:!1,duration:1.3,name:"\u53EF\u7528\u63D0\u793A1",nameEn:"Available Hint 1",video:"video/10001008.webm",icon:"icon/10001008.png",audio:[]},{id:10001009,scope:"ui",width:224,height:224,loop:!1,duration:1.3,name:"\u53EF\u7528\u63D0\u793A2",nameEn:"Available Hint 2",video:"video/10001009.webm",icon:"icon/10001009.png",audio:[]},{id:10001010,scope:"ui",width:176,height:176,loop:!0,duration:10,name:"\u96F7\u80FD\u91CF\u6EE1\u503C2",nameEn:"Electro Energy Max Value 2",video:"video/10001010.webm",icon:"icon/10001010.png",audio:[]},{id:10001011,scope:"ui",width:182,height:182,loop:!0,duration:10,name:"\u706B\u80FD\u91CF\u6EE1\u503C2",nameEn:"Pyro Energy Max Value 2",video:"video/10001011.webm",icon:"icon/10001011.png",audio:[]},{id:10001012,scope:"ui",width:162,height:162,loop:!0,duration:10,name:"\u8349\u80FD\u91CF\u6EE1\u503C2",nameEn:"Dendro Energy Max Value 2",video:"video/10001012.webm",icon:"icon/10001012.png",audio:[]},{id:10001013,scope:"ui",width:176,height:184,loop:!0,duration:10,name:"\u51B0\u80FD\u91CF\u6EE1\u503C2",nameEn:"Cryo Energy Max Value 2",video:"video/10001013.webm",icon:"icon/10001013.png",audio:[]},{id:10001014,scope:"ui",width:170,height:170,loop:!0,duration:10,name:"\u5CA9\u80FD\u91CF\u6EE1\u503C2",nameEn:"Geo Energy Max Value 2",video:"video/10001014.webm",icon:"icon/10001014.png",audio:[]},{id:10001015,scope:"ui",width:186,height:186,loop:!0,duration:10,name:"\u6C34\u80FD\u91CF\u6EE1\u503C2",nameEn:"Hydro Energy Max Value 2",video:"video/10001015.webm",icon:"icon/10001015.png",audio:[]},{id:10001016,scope:"ui",width:180,height:180,loop:!0,duration:10,name:"\u98CE\u80FD\u91CF\u6EE1\u503C2",nameEn:"Anemo Energy Max Value 2",video:"video/10001016.webm",icon:"icon/10001016.png",audio:[]},{id:10001017,scope:"ui",width:300,height:280,loop:!0,duration:10,name:"\u80FD\u91CF\u6EE1\u503C1",nameEn:"Energy Max Value 1",video:"video/10001017.webm",icon:"icon/10001017.png",audio:["audio/10001017.mp3"]},{id:10001018,scope:"ui",width:220,height:226,loop:!0,duration:10,name:"\u80FD\u91CF\u6EE1\u503C2",nameEn:"Energy Max Value 2",video:"video/10001018.webm",icon:"icon/10001018.png",audio:[]},{id:10001019,scope:"ui",width:220,height:226,loop:!0,duration:10,name:"\u80FD\u91CF\u6EE1\u503C3",nameEn:"Energy Max Value 3",video:"video/10001019.webm",icon:"icon/10001019.png",audio:[]},{id:10001020,scope:"ui",width:210,height:216,loop:!0,duration:10,name:"\u80FD\u91CF\u6EE1\u503C4",nameEn:"Energy Max Value 4",video:"video/10001020.webm",icon:"icon/10001020.png",audio:[]},{id:10001021,scope:"ui",width:216,height:220,loop:!0,duration:10,name:"\u80FD\u91CF\u6EE1\u503C5",nameEn:"Energy Max Value 5",video:"video/10001021.webm",icon:"icon/10001021.png",audio:[]},{id:10001022,scope:"ui",width:216,height:220,loop:!0,duration:10,name:"\u80FD\u91CF\u6EE1\u503C6",nameEn:"Energy Max Value 6",video:"video/10001022.webm",icon:"icon/10001022.png",audio:[]},{id:10001023,scope:"ui",width:216,height:220,loop:!0,duration:10,name:"\u80FD\u91CF\u6EE1\u503C7",nameEn:"Energy Max Value 7",video:"video/10001023.webm",icon:"icon/10001023.png",audio:[]},{id:10001024,scope:"ui",width:134,height:134,loop:!0,duration:10,name:"\u96F7\u5143\u7D20\u5171\u9E23",nameEn:"Electro Elemental Resonance",video:"video/10001024.webm",icon:"icon/10001024.png",audio:[]},{id:10001025,scope:"ui",width:130,height:134,loop:!0,duration:10,name:"\u706B\u5143\u7D20\u5171\u9E23",nameEn:"Pyro Elemental Resonance",video:"video/10001025.webm",icon:"icon/10001025.png",audio:[]},{id:10001026,scope:"ui",width:130,height:130,loop:!0,duration:10,name:"\u8349\u5143\u7D20\u5171\u9E23",nameEn:"Dendro Elemental Resonance",video:"video/10001026.webm",icon:"icon/10001026.png",audio:[]},{id:10001027,scope:"ui",width:128,height:128,loop:!0,duration:10,name:"\u51B0\u5143\u7D20\u5171\u9E23",nameEn:"Cryo Elemental Resonance",video:"video/10001027.webm",icon:"icon/10001027.png",audio:[]},{id:10001028,scope:"ui",width:130,height:130,loop:!0,duration:10,name:"\u5CA9\u5143\u7D20\u5171\u9E23",nameEn:"Geo Elemental Resonance",video:"video/10001028.webm",icon:"icon/10001028.png",audio:[]},{id:10001029,scope:"ui",width:130,height:134,loop:!0,duration:10,name:"\u6C34\u5143\u7D20\u5171\u9E23",nameEn:"Hydro Elemental Resonance",video:"video/10001029.webm",icon:"icon/10001029.png",audio:[]},{id:10001030,scope:"ui",width:130,height:130,loop:!0,duration:10,name:"\u98CE\u5143\u7D20\u5171\u9E23",nameEn:"Anemo Elemental Resonance",video:"video/10001030.webm",icon:"icon/10001030.png",audio:[]},{id:10001031,scope:"ui",width:156,height:160,loop:!1,duration:1,name:"\u6C34\u70AE\u6548\u679C1",nameEn:"Hydro Cannon Effect 1",video:"video/10001031.webm",icon:"icon/10001031.png",audio:[]},{id:10001032,scope:"ui",width:216,height:216,loop:!1,duration:.933,name:"\u6C34\u70AE\u6548\u679C2",nameEn:"Hydro Cannon Effect 2",video:"video/10001032.webm",icon:"icon/10001032.png",audio:["audio/10001032.mp3"]},{id:10001033,scope:"ui",width:488,height:488,loop:!1,duration:1.2,name:"\u97F3\u7B26\u6548\u679C1",nameEn:"Note Effect 1",video:"video/10001033.webm",icon:"icon/10001033.png",audio:[]},{id:10001034,scope:"ui",width:536,height:536,loop:!1,duration:1.4,name:"\u97F3\u7B26\u6548\u679C2",nameEn:"Note Effect 2",video:"video/10001034.webm",icon:"icon/10001034.png",audio:[]},{id:10001035,scope:"ui",width:262,height:266,loop:!0,duration:10,name:"\u97F3\u7B26\u6548\u679C3",nameEn:"Note Effect 3",video:"video/10001035.webm",icon:"icon/10001035.png",audio:[]},{id:10001036,scope:"ui",width:536,height:536,loop:!1,duration:1.4,name:"\u97F3\u7B26\u6548\u679C4",nameEn:"Note Effect 4",video:"video/10001036.webm",icon:"icon/10001036.png",audio:[]},{id:10001037,scope:"ui",width:262,height:266,loop:!0,duration:10,name:"\u97F3\u7B26\u6548\u679C5",nameEn:"Note Effect 5",video:"video/10001037.webm",icon:"icon/10001037.png",audio:[]},{id:10001038,scope:"ui",width:190,height:190,loop:!0,duration:10,name:"\u6269\u6563\u6548\u679C1",nameEn:"Swirl Effect 1",video:"video/10001038.webm",icon:"icon/10001038.png",audio:[]},{id:10001039,scope:"ui",width:208,height:208,loop:!1,duration:.766,name:"\u70B9\u51FB\u6548\u679C1",nameEn:"Press Effect 1",video:"video/10001039.webm",icon:"icon/10001039.png",audio:[]},{id:10001040,scope:"ui",width:390,height:390,loop:!1,duration:1.2,name:"\u8F6C\u6362\u6548\u679C1",nameEn:"Conversion Effect 1",video:"video/10001040.webm",icon:"icon/10001040.png",audio:["audio/10001040.mp3"]},{id:10001041,scope:"ui",width:208,height:208,loop:!0,duration:10,name:"\u8F6C\u6362\u6548\u679C2",nameEn:"Conversion Effect 2",video:"video/10001041.webm",icon:"icon/10001041.png",audio:[]},{id:10001042,scope:"ui",width:208,height:208,loop:!0,duration:10,name:"\u8F6C\u6362\u6548\u679C3",nameEn:"Conversion Effect 3",video:"video/10001042.webm",icon:"icon/10001042.png",audio:[]},{id:10001043,scope:"ui",width:168,height:180,loop:!1,duration:1.233,name:"\u70B9\u51FB\u6548\u679C2",nameEn:"Press Effect 2",video:"video/10001043.webm",icon:"icon/10001043.png",audio:["audio/10001043.mp3","audio/10001043_02.mp3"]},{id:10001044,scope:"ui",width:190,height:198,loop:!1,duration:1.566,name:"\u70B9\u51FB\u6548\u679C3",nameEn:"Press Effect 3",video:"video/10001044.webm",icon:"icon/10001044.png",audio:[]},{id:10001045,scope:"ui",width:114,height:114,loop:!1,duration:.733,name:"\u70B9\u51FB\u6548\u679C4",nameEn:"Press Effect 4",video:"video/10001045.webm",icon:"icon/10001045.png",audio:[]},{id:10001046,scope:"ui",width:106,height:122,loop:!1,duration:.8,name:"\u70B9\u51FB\u6548\u679C5",nameEn:"Press Effect 5",video:"video/10001046.webm",icon:"icon/10001046.png",audio:[]},{id:10001047,scope:"ui",width:114,height:114,loop:!1,duration:.733,name:"\u70B9\u51FB\u6548\u679C6",nameEn:"Press Effect 6",video:"video/10001047.webm",icon:"icon/10001047.png",audio:[]},{id:10001048,scope:"ui",width:114,height:114,loop:!1,duration:.733,name:"\u70B9\u51FB\u6548\u679C7",nameEn:"Press Effect 7",video:"video/10001048.webm",icon:"icon/10001048.png",audio:[]},{id:10001049,scope:"ui",width:130,height:118,loop:!1,duration:1,name:"\u70B9\u51FB\u6548\u679C8",nameEn:"Press Effect 8",video:"video/10001049.webm",icon:"icon/10001049.png",audio:[]},{id:10001050,scope:"ui",width:114,height:114,loop:!1,duration:.733,name:"\u70B9\u51FB\u6548\u679C9",nameEn:"Press Effect 9",video:"video/10001050.webm",icon:"icon/10001050.png",audio:[]},{id:10001051,scope:"ui",width:408,height:408,loop:!0,duration:10,name:"\u9AD8\u4EAE\u6548\u679C1",nameEn:"Highlight Effect 1",video:"video/10001051.webm",icon:"icon/10001051.png",audio:[]},{id:10001052,scope:"ui",width:272,height:272,loop:!1,duration:.9,name:"\u95EA\u70C1\u6548\u679C1",nameEn:"Blink Effect 1",video:"video/10001052.webm",icon:"icon/10001052.png",audio:[]},{id:10001053,scope:"ui",width:176,height:194,loop:!0,duration:10,name:"\u9AD8\u4EAE\u6548\u679C2",nameEn:"Highlight Effect 2",video:"video/10001053.webm",icon:"icon/10001053.png",audio:[]},{id:10001054,scope:"ui",width:274,height:286,loop:!1,duration:1,name:"\u95EA\u70C1\u6548\u679C2",nameEn:"Blink Effect 2",video:"video/10001054.webm",icon:"icon/10001054.png",audio:[]},{id:10001055,scope:"ui",width:368,height:368,loop:!1,duration:1,name:"\u95EA\u70C1\u6548\u679C3",nameEn:"Blink Effect 3",video:"video/10001055.webm",icon:"icon/10001055.png",audio:[]},{id:10001056,scope:"ui",width:226,height:210,loop:!0,duration:10,name:"\u9AD8\u4EAE\u6548\u679C3",nameEn:"Highlight Effect 3",video:"video/10001056.webm",icon:"icon/10001056.png",audio:[]},{id:10001057,scope:"ui",width:304,height:304,loop:!1,duration:.966,name:"\u8F6C\u6362\u6548\u679C4",nameEn:"Conversion Effect 4",video:"video/10001057.webm",icon:"icon/10001057.png",audio:["audio/10001057.mp3"]},{id:10001058,scope:"ui",width:174,height:178,loop:!1,duration:1.6,name:"\u95EA\u70C1\u6548\u679C4",nameEn:"Blink Effect 4",video:"video/10001058.webm",icon:"icon/10001058.png",audio:[]},{id:10001059,scope:"ui",width:362,height:362,loop:!1,duration:1.766,name:"\u95EA\u70C1\u6548\u679C5",nameEn:"Blink Effect 5",video:"video/10001059.webm",icon:"icon/10001059.png",audio:["audio/10001059.mp3"]},{id:10001060,scope:"ui",width:190,height:192,loop:!0,duration:10,name:"\u95EA\u70C1\u6548\u679C6",nameEn:"Blink Effect 6",video:"video/10001060.webm",icon:"icon/10001060.png",audio:[]},{id:10001061,scope:"ui",width:890,height:456,loop:!1,duration:1,name:"\u95EA\u70C1\u6548\u679C7",nameEn:"Blink Effect 7",video:"video/10001061.webm",icon:"icon/10001061.png",audio:[]},{id:10001062,scope:"ui",width:890,height:646,loop:!1,duration:1,name:"\u95EA\u70C1\u6548\u679C8",nameEn:"Blink Effect 8",video:"video/10001062.webm",icon:"icon/10001062.png",audio:[]},{id:10001063,scope:"ui",width:290,height:290,loop:!0,duration:10,name:"\u9AD8\u4EAE\u6548\u679C4",nameEn:"Highlight Effect 4",video:"video/10001063.webm",icon:"icon/10001063.png",audio:[]},{id:10001064,scope:"ui",width:272,height:272,loop:!1,duration:.866,name:"\u6D88\u9664\u6548\u679C1",nameEn:"Clear Effect 1",video:"video/10001064.webm",icon:"icon/10001064.png",audio:[]},{id:10001065,scope:"ui",width:272,height:272,loop:!1,duration:.9,name:"\u6D88\u9664\u6548\u679C2",nameEn:"Clear Effect 2",video:"video/10001065.webm",icon:"icon/10001065.png",audio:[]},{id:10001066,scope:"ui",width:238,height:210,loop:!1,duration:1.066,name:"\u6D88\u9664\u6548\u679C3",nameEn:"Clear Effect 3",video:"video/10001066.webm",icon:"icon/10001066.png",audio:[]},{id:10001067,scope:"ui",width:154,height:154,loop:!0,duration:10,name:"\u95EA\u70C1\u6548\u679C9",nameEn:"Blink Effect 9",video:"video/10001067.webm",icon:"icon/10001067.png",audio:[]},{id:10001068,scope:"ui",width:484,height:484,loop:!1,duration:1,name:"\u95EA\u70C1\u6548\u679C10",nameEn:"Blink Effect 10",video:"video/10001068.webm",icon:"icon/10001068.png",audio:[]},{id:10001069,scope:"ui",width:326,height:326,loop:!0,duration:10,name:"\u9AD8\u4EAE\u6548\u679C5",nameEn:"Highlight Effect 5",video:"video/10001069.webm",icon:"icon/10001069.png",audio:[]},{id:10001070,scope:"ui",width:206,height:196,loop:!0,duration:10,name:"\u9AD8\u4EAE\u6548\u679C6",nameEn:"Highlight Effect 6",video:"video/10001070.webm",icon:"icon/10001070.png",audio:[]},{id:10001071,scope:"ui",width:2236,height:2236,loop:!0,duration:10,name:"\u6C1B\u56F4\u6548\u679C1",nameEn:"Ambience Effect 1",video:"video/10001071.webm",icon:"icon/10001071.png",audio:[]},{id:10001072,scope:"ui",width:406,height:406,loop:!0,duration:10,name:"\u6C1B\u56F4\u6548\u679C2",nameEn:"Ambience Effect 2",video:"video/10001072.webm",icon:"icon/10001072.png",audio:[]},{id:10001073,scope:"ui",width:376,height:336,loop:!1,duration:2.1,name:"\u95EA\u70C1\u6548\u679C11",nameEn:"Blink Effect 11",video:"video/10001073.webm",icon:"icon/10001073.png",audio:[]},{id:10001074,scope:"ui",width:258,height:228,loop:!1,duration:1.666,name:"\u95EA\u70C1\u6548\u679C12",nameEn:"Blink Effect 12",video:"video/10001074.webm",icon:"icon/10001074.png",audio:[]},{id:10001075,scope:"ui",width:322,height:322,loop:!0,duration:10,name:"\u9AD8\u4EAE\u6548\u679C7",nameEn:"Highlight Effect 7",video:"video/10001075.webm",icon:"icon/10001075.png",audio:[]},{id:10001076,scope:"ui",width:258,height:270,loop:!1,duration:1.2,name:"\u4E92\u52A8\u6548\u679C1",nameEn:"Interaction Effect 1",video:"video/10001076.webm",icon:"icon/10001076.png",audio:[]},{id:10001077,scope:"ui",width:126,height:118,loop:!1,duration:1.1,name:"\u88C5\u9970\u6548\u679C1",nameEn:"Decoration Effect 1",video:"video/10001077.webm",icon:"icon/10001077.png",audio:[]},{id:10001078,scope:"ui",width:220,height:248,loop:!1,duration:1.133,name:"\u88C5\u9970\u6548\u679C2",nameEn:"Decoration Effect 2",video:"video/10001078.webm",icon:"icon/10001078.png",audio:[]},{id:10001079,scope:"ui",width:234,height:232,loop:!1,duration:1.166,name:"\u88C5\u9970\u6548\u679C3",nameEn:"Decoration Effect 3",video:"video/10001079.webm",icon:"icon/10001079.png",audio:[]},{id:10001080,scope:"ui",width:582,height:550,loop:!0,duration:10,name:"\u88C5\u9970\u6548\u679C4",nameEn:"Decoration Effect 4",video:"video/10001080.webm",icon:"icon/10001080.png",audio:[]},{id:10001081,scope:"ui",width:388,height:400,loop:!0,duration:10,name:"\u88C5\u9970\u6548\u679C5",nameEn:"Decoration Effect 5",video:"video/10001081.webm",icon:"icon/10001081.png",audio:[]},{id:10001082,scope:"ui",width:386,height:386,loop:!0,duration:10,name:"\u88C5\u9970\u6548\u679C6",nameEn:"Decoration Effect 6",video:"video/10001082.webm",icon:"icon/10001082.png",audio:[]},{id:10001083,scope:"ui",width:196,height:196,loop:!1,duration:1.2,name:"\u88C5\u9970\u6548\u679C7",nameEn:"Decoration Effect 7",video:"video/10001083.webm",icon:"icon/10001083.png",audio:[]},{id:10001084,scope:"ui",width:496,height:462,loop:!1,duration:.7,name:"\u95EA\u70C1\u6548\u679C13",nameEn:"Blink Effect 13",video:"video/10001084.webm",icon:"icon/10001084.png",audio:[]},{id:10001085,scope:"ui",width:426,height:336,loop:!1,duration:.566,name:"\u95EA\u70C1\u6548\u679C14",nameEn:"Blink Effect 14",video:"video/10001085.webm",icon:"icon/10001085.png",audio:[]},{id:10001086,scope:"ui",width:266,height:190,loop:!1,duration:.866,name:"\u88C5\u9970\u6548\u679C8",nameEn:"Decoration Effect 8",video:"video/10001086.webm",icon:"icon/10001086.png",audio:[]},{id:10001087,scope:"ui",width:310,height:252,loop:!1,duration:1.166,name:"\u88C5\u9970\u6548\u679C9",nameEn:"Decoration Effect 9",video:"video/10001087.webm",icon:"icon/10001087.png",audio:[]},{id:10001088,scope:"ui",width:310,height:252,loop:!1,duration:1.166,name:"\u88C5\u9970\u6548\u679C10",nameEn:"Decoration Effect 10",video:"video/10001088.webm",icon:"icon/10001088.png",audio:[]},{id:10001089,scope:"ui",width:178,height:74,loop:!1,duration:1.966,name:"\u88C5\u9970\u6548\u679C11",nameEn:"Decoration Effect 11",video:"video/10001089.webm",icon:"icon/10001089.png",audio:[]},{id:10001090,scope:"ui",width:190,height:190,loop:!1,duration:1.166,name:"\u95EA\u70C1\u6548\u679C15",nameEn:"Blink Effect 15",video:"video/10001090.webm",icon:"icon/10001090.png",audio:[]},{id:10001091,scope:"ui",width:188,height:188,loop:!1,duration:1.6,name:"\u95EA\u70C1\u6548\u679C16",nameEn:"Blink Effect 16",video:"video/10001091.webm",icon:"icon/10001091.png",audio:[]},{id:10001092,scope:"ui",width:200,height:200,loop:!0,duration:10,name:"\u88C5\u9970\u6548\u679C12",nameEn:"Decoration Effect 12",video:"video/10001092.webm",icon:"icon/10001092.png",audio:[]},{id:10001093,scope:"ui",width:294,height:302,loop:!1,duration:1.033,name:"\u88C5\u9970\u6548\u679C13",nameEn:"Decoration Effect 13",video:"video/10001093.webm",icon:"icon/10001093.png",audio:[]},{id:10001094,scope:"ui",width:310,height:310,loop:!1,duration:.833,name:"\u88C5\u9970\u6548\u679C14",nameEn:"Decoration Effect 14",video:"video/10001094.webm",icon:"icon/10001094.png",audio:[]},{id:10001095,scope:"ui",width:252,height:300,loop:!1,duration:1.8,name:"\u88C5\u9970\u6548\u679C15",nameEn:"Decoration Effect 15",video:"video/10001095.webm",icon:"icon/10001095.png",audio:[]},{id:10001096,scope:"ui",width:252,height:252,loop:!1,duration:1.6,name:"\u88C5\u9970\u6548\u679C16",nameEn:"Decoration Effect 16",video:"video/10001096.webm",icon:"icon/10001096.png",audio:[]},{id:10001097,scope:"ui",width:252,height:252,loop:!1,duration:1.6,name:"\u88C5\u9970\u6548\u679C17",nameEn:"Decoration Effect 17",video:"video/10001097.webm",icon:"icon/10001097.png",audio:[]},{id:10001098,scope:"ui",width:252,height:252,loop:!1,duration:1.6,name:"\u88C5\u9970\u6548\u679C18",nameEn:"Decoration Effect 18",video:"video/10001098.webm",icon:"icon/10001098.png",audio:[]},{id:10001099,scope:"ui",width:252,height:252,loop:!1,duration:1.6,name:"\u88C5\u9970\u6548\u679C19",nameEn:"Decoration Effect 19",video:"video/10001099.webm",icon:"icon/10001099.png",audio:[]},{id:10001100,scope:"ui",width:252,height:252,loop:!1,duration:1.6,name:"\u88C5\u9970\u6548\u679C20",nameEn:"Decoration Effect 20",video:"video/10001100.webm",icon:"icon/10001100.png",audio:[]},{id:10001101,scope:"ui",width:252,height:252,loop:!1,duration:1.6,name:"\u88C5\u9970\u6548\u679C21",nameEn:"Decoration Effect 21",video:"video/10001101.webm",icon:"icon/10001101.png",audio:[]},{id:10001102,scope:"ui",width:260,height:260,loop:!1,duration:1.133,name:"\u9AD8\u4EAE\u6548\u679C8",nameEn:"Highlight Effect 8",video:"video/10001102.webm",icon:"icon/10001102.png",audio:[]},{id:10001103,scope:"ui",width:260,height:260,loop:!1,duration:1.166,name:"\u9AD8\u4EAE\u6548\u679C9",nameEn:"Highlight Effect 9",video:"video/10001103.webm",icon:"icon/10001103.png",audio:[]},{id:10001104,scope:"ui",width:322,height:344,loop:!1,duration:1.133,name:"\u9AD8\u4EAE\u6548\u679C10",nameEn:"Highlight Effect 10",video:"video/10001104.webm",icon:"icon/10001104.png",audio:[]},{id:10001105,scope:"ui",width:380,height:394,loop:!1,duration:1.133,name:"\u9AD8\u4EAE\u6548\u679C11",nameEn:"Highlight Effect 11",video:"video/10001105.webm",icon:"icon/10001105.png",audio:[]},{id:10001106,scope:"ui",width:176,height:140,loop:!0,duration:10,name:"\u6C1B\u56F4\u6548\u679C3",nameEn:"Ambience Effect 3",video:"video/10001106.webm",icon:"icon/10001106.png",audio:[]},{id:10001107,scope:"ui",width:136,height:136,loop:!1,duration:.8,name:"\u95EA\u70C1\u6548\u679C17",nameEn:"Blink Effect 17",video:"video/10001107.webm",icon:"icon/10001107.png",audio:["audio/10001107.mp3"]},{id:10001108,scope:"ui",width:206,height:212,loop:!1,duration:1.7,name:"\u95EA\u70C1\u6548\u679C18",nameEn:"Blink Effect 18",video:"video/10001108.webm",icon:"icon/10001108.png",audio:["audio/10001108.mp3"]},{id:10001109,scope:"ui",width:182,height:182,loop:!1,duration:1.666,name:"\u95EA\u70C1\u6548\u679C19",nameEn:"Blink Effect 19",video:"video/10001109.webm",icon:"icon/10001109.png",audio:[]},{id:10001110,scope:"ui",width:650,height:306,loop:!1,duration:1.533,name:"\u95EA\u70C1\u6548\u679C20",nameEn:"Blink Effect 20",video:"video/10001110.webm",icon:"icon/10001110.png",audio:["audio/10001110.mp3"]},{id:10001111,scope:"ui",width:742,height:494,loop:!1,duration:.9,name:"\u95EA\u70C1\u6548\u679C21",nameEn:"Blink Effect 21",video:"video/10001111.webm",icon:"icon/10001111.png",audio:["audio/10001111.mp3"]},{id:10001112,scope:"ui",width:872,height:462,loop:!1,duration:.9,name:"\u95EA\u70C1\u6548\u679C22",nameEn:"Blink Effect 22",video:"video/10001112.webm",icon:"icon/10001112.png",audio:["audio/10001112.mp3"]},{id:10001113,scope:"ui",width:182,height:182,loop:!1,duration:1.166,name:"\u95EA\u70C1\u6548\u679C23",nameEn:"Blink Effect 23",video:"video/10001113.webm",icon:"icon/10001113.png",audio:[]},{id:10001114,scope:"ui",width:116,height:228,loop:!0,duration:10,name:"\u8FDB\u5EA6\u7D2F\u79EF1",nameEn:"Progress Accumulation 1",video:"video/10001114.webm",icon:"icon/10001114.png",audio:[]},{id:10001115,scope:"ui",width:520,height:676,loop:!1,duration:1.133,name:"\u8FDB\u5EA6\u7D2F\u79EF2",nameEn:"Progress Accumulation 2",video:"video/10001115.webm",icon:"icon/10001115.png",audio:[]},{id:10001116,scope:"ui",width:88,height:88,loop:!0,duration:10,name:"\u8FDB\u5EA6\u7D2F\u79EF3",nameEn:"Progress Accumulation 3",video:"video/10001116.webm",icon:"icon/10001116.png",audio:[]},{id:10001117,scope:"ui",width:166,height:278,loop:!1,duration:1.466,name:"\u95EA\u70C1\u6548\u679C24",nameEn:"Blink Effect 24",video:"video/10001117.webm",icon:"icon/10001117.png",audio:[]},{id:10001118,scope:"ui",width:106,height:106,loop:!0,duration:10,name:"\u95EA\u70C1\u6548\u679C25",nameEn:"Blink Effect 25",video:"video/10001118.webm",icon:"icon/10001118.png",audio:[]},{id:10001119,scope:"ui",width:118,height:118,loop:!0,duration:10,name:"\u95EA\u70C1\u6548\u679C26",nameEn:"Blink Effect 26",video:"video/10001119.webm",icon:"icon/10001119.png",audio:[]},{id:10001120,scope:"ui",width:130,height:118,loop:!1,duration:1.566,name:"\u95EA\u70C1\u6548\u679C27",nameEn:"Blink Effect 27",video:"video/10001120.webm",icon:"icon/10001120.png",audio:["audio/10001120.mp3","audio/10001120_02.mp3","audio/10001120_03.mp3","audio/10001120_04.mp3","audio/10001120_05.mp3","audio/10001120_06.mp3","audio/10001120_07.mp3","audio/10001120_08.mp3","audio/10001120_09.mp3","audio/10001120_10.mp3","audio/10001120_11.mp3"]},{id:10001121,scope:"ui",width:376,height:400,loop:!1,duration:1.333,name:"\u95EA\u70C1\u6548\u679C28",nameEn:"Blink Effect 28",video:"video/10001121.webm",icon:"icon/10001121.png",audio:[]},{id:10001122,scope:"ui",width:986,height:706,loop:!1,duration:2.6,name:"\u95EA\u70C1\u6548\u679C29",nameEn:"Blink Effect 29",video:"video/10001122.webm",icon:"icon/10001122.png",audio:[]},{id:10001124,scope:"ui",width:2334,height:2714,loop:!1,duration:1.4,name:"\u7ED3\u7B97\u6548\u679C1",nameEn:"Settlement Effect 1",video:"video/10001124.webm",icon:"icon/10001124.png",audio:[]},{id:10001125,scope:"ui",width:2214,height:2270,loop:!1,duration:1.233,name:"\u7ED3\u7B97\u6548\u679C2",nameEn:"Settlement Effect 2",video:"video/10001125.webm",icon:"icon/10001125.png",audio:[]},{id:10001126,scope:"ui",width:2574,height:1178,loop:!1,duration:3.133,name:"\u7ED3\u7B97\u6548\u679C3",nameEn:"Settlement Effect 3",video:"video/10001126.webm",icon:"icon/10001126.png",audio:[]},{id:10001127,scope:"ui",width:1918,height:1138,loop:!1,duration:3.066,name:"\u7ED3\u7B97\u6548\u679C4",nameEn:"Settlement Effect 4",video:"video/10001127.webm",icon:"icon/10001127.png",audio:[]},{id:10001128,scope:"ui",width:548,height:212,loop:!1,duration:1.966,name:"\u95EA\u70C1\u6548\u679C30",nameEn:"Blink Effect 30",video:"video/10001128.webm",icon:"icon/10001128.png",audio:[]},{id:10001129,scope:"ui",width:638,height:520,loop:!1,duration:1.133,name:"\u95EA\u70C1\u6548\u679C31",nameEn:"Blink Effect 31",video:"video/10001129.webm",icon:"icon/10001129.png",audio:["audio/10001129.mp3"]},{id:10001130,scope:"ui",width:284,height:142,loop:!1,duration:1.2,name:"\u95EA\u70C1\u6548\u679C32",nameEn:"Blink Effect 32",video:"video/10001130.webm",icon:"icon/10001130.png",audio:[]},{id:10001131,scope:"ui",width:790,height:790,loop:!0,duration:10,name:"\u95EA\u70C1\u6548\u679C33",nameEn:"Blink Effect 33",video:"video/10001131.webm",icon:"icon/10001131.png",audio:["audio/10001131.mp3"]},{id:10001132,scope:"ui",width:1020,height:264,loop:!0,duration:10,name:"\u95EA\u70C1\u6548\u679C34",nameEn:"Blink Effect 34",video:"video/10001132.webm",icon:"icon/10001132.png",audio:[]},{id:10001133,scope:"ui",width:1348,height:358,loop:!1,duration:1.5,name:"\u7ED3\u7B97\u6548\u679C5",nameEn:"Settlement Effect 5",video:"video/10001133.webm",icon:"icon/10001133.png",audio:[]},{id:10001134,scope:"ui",width:1116,height:290,loop:!1,duration:2,name:"\u95EA\u70C1\u6548\u679C35",nameEn:"Blink Effect 35",video:"video/10001134.webm",icon:"icon/10001134.png",audio:["audio/10001134.mp3"]},{id:10001135,scope:"ui",width:1116,height:290,loop:!1,duration:2,name:"\u95EA\u70C1\u6548\u679C36",nameEn:"Blink Effect 36",video:"video/10001135.webm",icon:"icon/10001135.png",audio:["audio/10001135.mp3"]},{id:10001136,scope:"ui",width:1520,height:296,loop:!1,duration:1.466,name:"\u95EA\u70C1\u6548\u679C37",nameEn:"Blink Effect 37",video:"video/10001136.webm",icon:"icon/10001136.png",audio:[]},{id:10001137,scope:"ui",width:2266,height:706,loop:!1,duration:2.066,name:"\u95EA\u70C1\u6548\u679C38",nameEn:"Blink Effect 38",video:"video/10001137.webm",icon:"icon/10001137.png",audio:[]},{id:10001138,scope:"ui",width:912,height:192,loop:!1,duration:2.033,name:"\u95EA\u70C1\u6548\u679C39",nameEn:"Blink Effect 39",video:"video/10001138.webm",icon:"icon/10001138.png",audio:[]},{id:10001139,scope:"ui",width:912,height:192,loop:!1,duration:2.033,name:"\u95EA\u70C1\u6548\u679C40",nameEn:"Blink Effect 40",video:"video/10001139.webm",icon:"icon/10001139.png",audio:[]},{id:10001140,scope:"ui",width:912,height:174,loop:!1,duration:2.033,name:"\u95EA\u70C1\u6548\u679C41",nameEn:"Blink Effect 41",video:"video/10001140.webm",icon:"icon/10001140.png",audio:[]},{id:10001141,scope:"ui",width:912,height:102,loop:!1,duration:2.033,name:"\u95EA\u70C1\u6548\u679C42",nameEn:"Blink Effect 42",video:"video/10001141.webm",icon:"icon/10001141.png",audio:[]},{id:10001142,scope:"ui",width:1766,height:1542,loop:!1,duration:3.8,name:"\u95EA\u70C1\u6548\u679C43",nameEn:"Blink Effect 43",video:"video/10001142.webm",icon:"icon/10001142.png",audio:[]},{id:10001143,scope:"ui",width:1312,height:168,loop:!1,duration:1.066,name:"\u95EA\u70C1\u6548\u679C44",nameEn:"Blink Effect 44",video:"video/10001143.webm",icon:"icon/10001143.png",audio:["audio/10001143.mp3","audio/10001143_02.mp3"]},{id:10001144,scope:"ui",width:698,height:82,loop:!1,duration:2.233,name:"\u95EA\u70C1\u6548\u679C45",nameEn:"Blink Effect 45",video:"video/10001144.webm",icon:"icon/10001144.png",audio:[]},{id:10001145,scope:"ui",width:698,height:92,loop:!1,duration:2.266,name:"\u95EA\u70C1\u6548\u679C46",nameEn:"Blink Effect 46",video:"video/10001145.webm",icon:"icon/10001145.png",audio:[]},{id:10001146,scope:"ui",width:698,height:92,loop:!1,duration:2.266,name:"\u95EA\u70C1\u6548\u679C47",nameEn:"Blink Effect 47",video:"video/10001146.webm",icon:"icon/10001146.png",audio:[]},{id:10001147,scope:"ui",width:306,height:54,loop:!0,duration:10,name:"\u8FDB\u5EA6\u7D2F\u79EF4",nameEn:"Progress Accumulation 4",video:"video/10001147.webm",icon:"icon/10001147.png",audio:[]},{id:10001148,scope:"ui",width:934,height:194,loop:!1,duration:1.233,name:"\u8FDB\u5EA6\u7D2F\u79EF5",nameEn:"Progress Accumulation 5",video:"video/10001148.webm",icon:"icon/10001148.png",audio:[]},{id:10001149,scope:"ui",width:616,height:248,loop:!0,duration:10,name:"\u95EA\u70C1\u6548\u679C48",nameEn:"Blink Effect 48",video:"video/10001149.webm",icon:"icon/10001149.png",audio:[]},{id:10001150,scope:"ui",width:746,height:228,loop:!1,duration:1.366,name:"\u95EA\u70C1\u6548\u679C49",nameEn:"Blink Effect 49",video:"video/10001150.webm",icon:"icon/10001150.png",audio:[]},{id:10001151,scope:"ui",width:606,height:210,loop:!1,duration:1.233,name:"\u95EA\u70C1\u6548\u679C50",nameEn:"Blink Effect 50",video:"video/10001151.webm",icon:"icon/10001151.png",audio:[]},{id:10001152,scope:"ui",width:1674,height:346,loop:!0,duration:10,name:"\u8FDB\u5EA6\u7D2F\u79EF6",nameEn:"Progress Accumulation 6",video:"video/10001152.webm",icon:"icon/10001152.png",audio:[]},{id:10001153,scope:"ui",width:1110,height:400,loop:!1,duration:1.2,name:"\u95EA\u70C1\u6548\u679C51",nameEn:"Blink Effect 51",video:"video/10001153.webm",icon:"icon/10001153.png",audio:["audio/10001153.mp3","audio/10001153_02.mp3"]},{id:10001154,scope:"ui",width:1178,height:506,loop:!0,duration:10,name:"\u8FDB\u5EA6\u7D2F\u79EF7",nameEn:"Progress Accumulation 7",video:"video/10001154.webm",icon:"icon/10001154.png",audio:[]},{id:10001155,scope:"ui",width:1254,height:200,loop:!1,duration:1.2,name:"\u8FDB\u5EA6\u7D2F\u79EF8",nameEn:"Progress Accumulation 8",video:"video/10001155.webm",icon:"icon/10001155.png",audio:["audio/10001155.mp3"]},{id:10001156,scope:"ui",width:1180,height:202,loop:!1,duration:1.2,name:"\u8FDB\u5EA6\u7D2F\u79EF9",nameEn:"Progress Accumulation 9",video:"video/10001156.webm",icon:"icon/10001156.png",audio:["audio/10001156.mp3"]},{id:10001157,scope:"ui",width:654,height:118,loop:!0,duration:10,name:"\u8FDB\u5EA6\u7D2F\u79EF10",nameEn:"Progress Accumulation 10",video:"video/10001157.webm",icon:"icon/10001157.png",audio:[]},{id:10001158,scope:"ui",width:962,height:162,loop:!0,duration:10,name:"\u8FDB\u5EA6\u7D2F\u79EF11",nameEn:"Progress Accumulation 11",video:"video/10001158.webm",icon:"icon/10001158.png",audio:[]},{id:10001159,scope:"ui",width:1016,height:142,loop:!0,duration:10,name:"\u8FDB\u5EA6\u7D2F\u79EF12",nameEn:"Progress Accumulation 12",video:"video/10001159.webm",icon:"icon/10001159.png",audio:[]},{id:10001160,scope:"ui",width:790,height:210,loop:!1,duration:1,name:"\u8FDB\u5EA6\u7D2F\u79EF13",nameEn:"Progress Accumulation 13",video:"video/10001160.webm",icon:"icon/10001160.png",audio:[]},{id:10002001,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F41",nameEn:"View Ambience 1",video:"video/10002001.webm",icon:"icon/10002001.png",audio:["audio/10002001.mp3"]},{id:10002002,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F42",nameEn:"View Ambience 2",video:"video/10002002.webm",icon:"icon/10002002.png",audio:[]},{id:10002003,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F43",nameEn:"View Ambience 3",video:"video/10002003.webm",icon:"icon/10002003.png",audio:[]},{id:10002004,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F44",nameEn:"View Ambience 4",video:"video/10002004.webm",icon:"icon/10002004.png",audio:[]},{id:10002005,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F45",nameEn:"View Ambience 5",video:"video/10002005.webm",icon:"icon/10002005.png",audio:[]},{id:10002006,scope:"screen",width:1280,height:720,loop:!1,duration:1.9,name:"\u89C6\u91CE\u6C1B\u56F46",nameEn:"View Ambience 6",video:"video/10002006.webm",icon:"icon/10002006.png",audio:[]},{id:10002007,scope:"screen",width:1280,height:720,loop:!1,duration:2.4,name:"\u89C6\u91CE\u6C1B\u56F47",nameEn:"View Ambience 7",video:"video/10002007.webm",icon:"icon/10002007.png",audio:[]},{id:10002008,scope:"screen",width:1280,height:720,loop:!1,duration:3.433,name:"\u89C6\u91CE\u6C1B\u56F48",nameEn:"View Ambience 8",video:"video/10002008.webm",icon:"icon/10002008.png",audio:["audio/10002008.mp3"]},{id:10002009,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F49",nameEn:"View Ambience 9",video:"video/10002009.webm",icon:"icon/10002009.png",audio:["audio/10002009.mp3"]},{id:10002010,scope:"screen",width:1280,height:720,loop:!1,duration:2.5,name:"\u89C6\u91CE\u6C1B\u56F410",nameEn:"View Ambience 10",video:"video/10002010.webm",icon:"icon/10002010.png",audio:[]},{id:10002011,scope:"screen",width:1280,height:720,loop:!1,duration:1.8,name:"\u89C6\u91CE\u6C1B\u56F411",nameEn:"View Ambience 11",video:"video/10002011.webm",icon:"icon/10002011.png",audio:[]},{id:10002012,scope:"screen",width:1280,height:720,loop:!1,duration:2.933,name:"\u89C6\u91CE\u6C1B\u56F412",nameEn:"View Ambience 12",video:"video/10002012.webm",icon:"icon/10002012.png",audio:[]},{id:10002013,scope:"screen",width:1280,height:720,loop:!1,duration:3.9,name:"\u89C6\u91CE\u6C1B\u56F413",nameEn:"View Ambience 13",video:"video/10002013.webm",icon:"icon/10002013.png",audio:[]},{id:10002014,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F414",nameEn:"View Ambience 14",video:"video/10002014.webm",icon:"icon/10002014.png",audio:[]},{id:10002015,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F415",nameEn:"View Ambience 15",video:"video/10002015.webm",icon:"icon/10002015.png",audio:["audio/10002015.mp3"]},{id:10002016,scope:"screen",width:1280,height:720,loop:!1,duration:2.5,name:"\u89C6\u91CE\u6C1B\u56F416",nameEn:"View Ambience 16",video:"video/10002016.webm",icon:"icon/10002016.png",audio:[]},{id:10002017,scope:"screen",width:1280,height:720,loop:!1,duration:.733,name:"\u89C6\u91CE\u6C1B\u56F417",nameEn:"View Ambience 17",video:"video/10002017.webm",icon:"icon/10002017.png",audio:[]},{id:10002018,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F418",nameEn:"View Ambience 18",video:"video/10002018.webm",icon:"icon/10002018.png",audio:[]},{id:10002019,scope:"screen",width:1280,height:720,loop:!1,duration:2.2,name:"\u89C6\u91CE\u6C1B\u56F419",nameEn:"View Ambience 19",video:"video/10002019.webm",icon:"icon/10002019.png",audio:[]},{id:10002020,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F420",nameEn:"View Ambience 20",video:"video/10002020.webm",icon:"icon/10002020.png",audio:[]},{id:10002021,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F421",nameEn:"View Ambience 21",video:"video/10002021.webm",icon:"icon/10002021.png",audio:[]},{id:10002022,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F422",nameEn:"View Ambience 22",video:"video/10002022.webm",icon:"icon/10002022.png",audio:[]},{id:10002023,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F423",nameEn:"View Ambience 23",video:"video/10002023.webm",icon:"icon/10002023.png",audio:[]},{id:10002024,scope:"screen",width:1280,height:720,loop:!1,duration:3.4,name:"\u89C6\u91CE\u6C1B\u56F424",nameEn:"View Ambience 24",video:"video/10002024.webm",icon:"icon/10002024.png",audio:[]},{id:10002025,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F425",nameEn:"View Ambience 25",video:"video/10002025.webm",icon:"icon/10002025.png",audio:[]},{id:10002026,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F426",nameEn:"View Ambience 26",video:"video/10002026.webm",icon:"icon/10002026.png",audio:["audio/10002026.mp3"]},{id:10002027,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F427",nameEn:"View Ambience 27",video:"video/10002027.webm",icon:"icon/10002027.png",audio:[]},{id:10002028,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F428",nameEn:"View Ambience 28",video:"video/10002028.webm",icon:"icon/10002028.png",audio:[]},{id:10002029,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F429",nameEn:"View Ambience 29",video:"video/10002029.webm",icon:"icon/10002029.png",audio:[]},{id:10002030,scope:"screen",width:1280,height:720,loop:!1,duration:1.966,name:"\u89C6\u91CE\u6C1B\u56F430",nameEn:"View Ambience 30",video:"video/10002030.webm",icon:"icon/10002030.png",audio:[]},{id:10002031,scope:"screen",width:1280,height:720,loop:!1,duration:1.166,name:"\u89C6\u91CE\u6C1B\u56F431",nameEn:"View Ambience 31",video:"video/10002031.webm",icon:"icon/10002031.png",audio:["audio/10002031.mp3","audio/10002031_02.mp3","audio/10002031_03.mp3","audio/10002031_04.mp3"]},{id:10002032,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F432",nameEn:"View Ambience 32",video:"video/10002032.webm",icon:"icon/10002032.png",audio:["audio/10002032.mp3"]},{id:10002033,scope:"screen",width:1280,height:720,loop:!1,duration:2,name:"\u89C6\u91CE\u6C1B\u56F433",nameEn:"View Ambience 33",video:"video/10002033.webm",icon:"icon/10002033.png",audio:["audio/10002033.mp3","audio/10002033_02.mp3"]},{id:10002034,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F434",nameEn:"View Ambience 34",video:"video/10002034.webm",icon:"icon/10002034.png",audio:[]},{id:10002035,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u89C6\u91CE\u6C1B\u56F435",nameEn:"View Ambience 35",video:"video/10002035.webm",icon:"icon/10002035.png",audio:["audio/10002035.mp3"]},{id:10002036,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u7784\u51C6\u6548\u679C1",nameEn:"Aiming Effect 1",video:"video/10002036.webm",icon:"icon/10002036.png",audio:[]},{id:10002037,scope:"screen",width:1280,height:720,loop:!0,duration:10,name:"\u7784\u51C6\u6548\u679C2",nameEn:"Aiming Effect 2",video:"video/10002037.webm",icon:"icon/10002037.png",audio:["audio/10002037.mp3"]}],files:{"audio/10001017.mp3":{bytes:6524,sha256:"82470dfef398dab45fb3d50134da7b49573e7189f683d2bdf0849b478f267c79",duration:.850667},"audio/10001032.mp3":{bytes:27907,sha256:"53ca71dde10d2d7b6fbf7232d2461f48e564c2d847cbb29f9aac685114634dff",duration:1.258231},"audio/10001040.mp3":{bytes:24212,sha256:"faf6a45ba3d02a6d86ba43f8fe8bf7dbadd22997f0e16ed22b990b0eeaac05c2",duration:1.202104},"audio/10001043.mp3":{bytes:15068,sha256:"ffe52807864f795fd7f8e5e235fca49537437d70a34db83d66352063fe538a52",duration:.570563},"audio/10001043_02.mp3":{bytes:12812,sha256:"b8c194027b798e504f51ae73b67ae63e0d56904ebc95d458b0065d995fa2ed58",duration:.501813},"audio/10001057.mp3":{bytes:28220,sha256:"df501138ff9ae6a43fc8b434c09a401093a5598e9366136e7071e1c57baeb238",duration:1.613042},"audio/10001059.mp3":{bytes:29516,sha256:"2d80dbec2dde2348c3c9dcf95598a79bd851aa8329c5ed68e33d40a532ee491c",duration:1.4855},"audio/10001107.mp3":{bytes:27174,sha256:"eedee79d5e4cb0282bba21e5b12a24170a07354f3285d3f50cd47e24ead5149b",duration:1.383039},"audio/10001108.mp3":{bytes:27174,sha256:"eedee79d5e4cb0282bba21e5b12a24170a07354f3285d3f50cd47e24ead5149b",duration:1.383039},"audio/10001110.mp3":{bytes:12164,sha256:"de0f6db4c8942741fa82168431e31f8b54d68260bf412266ef707506ff6f10c3",duration:.448},"audio/10001111.mp3":{bytes:12164,sha256:"de0f6db4c8942741fa82168431e31f8b54d68260bf412266ef707506ff6f10c3",duration:.448},"audio/10001112.mp3":{bytes:12164,sha256:"de0f6db4c8942741fa82168431e31f8b54d68260bf412266ef707506ff6f10c3",duration:.448},"audio/10001120.mp3":{bytes:19556,sha256:"2f7a402979dc442b4214e46d79b2dd1b7925c96c0eaebbbf0555fe3f5bb3a529",duration:1.5},"audio/10001120_02.mp3":{bytes:19772,sha256:"f1c0f5e4b3f8a550d058f14a35340f4cbf56de86b4c409dd13b1125d682e09d6",duration:1.5},"audio/10001120_03.mp3":{bytes:18572,sha256:"630975e0a80512e788648adadc6b2d96c526a6125e13ffffde83e65cf000aa5e",duration:1.5},"audio/10001120_04.mp3":{bytes:21212,sha256:"00da41febe7cf8a8491117ef820c42aa79c65172769b4a12705666e9d7f2b636",duration:1.5},"audio/10001120_05.mp3":{bytes:19220,sha256:"5d85fe103ecc1868eefc679ff676996c329e61881640ac743409899d34fc5b6b",duration:1.5},"audio/10001120_06.mp3":{bytes:24596,sha256:"ce03626d5f0a7ccaf4a6cec7bce8ed915f61d6ec57b3cd532cbfc89da5bdcc3e",duration:1.5},"audio/10001120_07.mp3":{bytes:22316,sha256:"4dadba002982494e40772cccfedce6f6405fb4abc1e81f2206c4c2e0ac2645b5",duration:1.5},"audio/10001120_08.mp3":{bytes:21548,sha256:"309625fddc0d645da062ff788100a656bd83c4ce8cb75d523ed1949387e8252e",duration:1.5},"audio/10001120_09.mp3":{bytes:23060,sha256:"2eaf460f61ae85e8e2a4c324ebb9c4bc4f460fd2489a15943b92d2fa4422d3b6",duration:1.5},"audio/10001120_10.mp3":{bytes:18668,sha256:"6242a47c96c9ce87cb00a6f2288e8209b9ef5e3dc7ecb62bdadbf8672df95714",duration:1.5},"audio/10001120_11.mp3":{bytes:21188,sha256:"880383e307f7fe7210c05c37fc04a0ac8e3c909d500215f72c7228b9c2e660a6",duration:1.5},"audio/10001129.mp3":{bytes:45188,sha256:"07198b0853f2a859c6ccb85ec4ad1e56c6131302f5145f50d39fd98efe7e5387",duration:2.130667},"audio/10001131.mp3":{bytes:45188,sha256:"07198b0853f2a859c6ccb85ec4ad1e56c6131302f5145f50d39fd98efe7e5387",duration:2.130667},"audio/10001134.mp3":{bytes:45908,sha256:"ff64e15c3144791ad9073ee4537eb21ec7cf1d41dd205b0ef051a8263784793f",duration:2.518667},"audio/10001135.mp3":{bytes:49940,sha256:"edf39fa868e9e42da6fe38c8f726bf4162c950543efdfdefb1f85d3dfaa4d72b",duration:2.758667},"audio/10001143.mp3":{bytes:20156,sha256:"740c276f344b457077bc48f627304d15bbd879d06b3d6b6108673f07d2ec0dc5",duration:.841333},"audio/10001143_02.mp3":{bytes:36524,sha256:"b70b6326344739a781ef5ba96103b349d37052102a29cf2d5cddd2517cd13dff",duration:2.298604},"audio/10001153.mp3":{bytes:20372,sha256:"5c7d6a7ee0d3fff9352071a17979c9941ab1e5322e9b5a94692077f932c71ecf",duration:1.074208},"audio/10001153_02.mp3":{bytes:21140,sha256:"34e4852a0e1bcfd46c8820d9d61a1ef5288ba2795decc8829d1cf1c4b04d1b3a",duration:1.074208},"audio/10001155.mp3":{bytes:32132,sha256:"e1b38d6f72b3b7124da2c8a6417484053e1dd2833507d03cea32175d3d8e486c",duration:1.361167},"audio/10001156.mp3":{bytes:17468,sha256:"b945a4cc1ef374343806f677e1e2ab461c452a4eed6992151575791ccae7e9b2",duration:.808958},"audio/10002001.mp3":{bytes:126284,sha256:"9bedc3f73a10d1b4205d53c2c11b22ad1fc54375a430be0f64e2e5a7ed68b35d",duration:6.018875},"audio/10002008.mp3":{bytes:58316,sha256:"e24d9e46941a40c27b0adbc06927f245cb4826445142d3d4d1ca5d4e7a6889b7",duration:2.57125},"audio/10002009.mp3":{bytes:57932,sha256:"abea73a14c14dc143ed4b1244eba7257bf38119edb13923504c00ee11f51deb1",duration:2.5},"audio/10002015.mp3":{bytes:57932,sha256:"abea73a14c14dc143ed4b1244eba7257bf38119edb13923504c00ee11f51deb1",duration:2.5},"audio/10002026.mp3":{bytes:38137,sha256:"3ce1a1df88494fb7179a6df74a9f30f14e185e16060d84daff586c2992f06c1d",duration:1.994603},"audio/10002031.mp3":{bytes:6932,sha256:"81439fcff710fdd6ce4541ddf76edc30f119c44fbf7e6d39df2c6349ffe4a347",duration:.301333},"audio/10002031_02.mp3":{bytes:5420,sha256:"f9ad4c41d670a010fb7e8acc6227e0ea8dc73dc1504972190aa513fdc0257d05",duration:.296104},"audio/10002031_03.mp3":{bytes:8012,sha256:"40c44c0ea861bd86e1bbedda8bf48dbe5c4d0b3a22f493cc2d9dfab43544d9e5",duration:.296104},"audio/10002031_04.mp3":{bytes:5948,sha256:"69c8ab1fc17a47a696e1e65d2a87613ae98377712d09a4d18cfbdf6cb06defae",duration:.296104},"audio/10002032.mp3":{bytes:111082,sha256:"0f17b84ae322621d29af50d88c3ee8d66677926429ae818579eba240e5f07a52",duration:4.90771},"audio/10002033.mp3":{bytes:59847,sha256:"0476fabf3f0d6d000758a82e467a1ff0e363d0efa3e873b60eb2d4194372aa24",duration:2.949274},"audio/10002033_02.mp3":{bytes:60791,sha256:"9f6eac53ec1f8dd02be7a532ee51ddbfc2c1f34c935616194e2c92e8ea8794bd",duration:2.928254},"audio/10002035.mp3":{bytes:93092,sha256:"360a57a535ffe34d8fdd3ef652512dac3cb46c1155791ea5992b3fd5cfde3a0c",duration:4.26},"audio/10002037.mp3":{bytes:50252,sha256:"508a7cadf5dec9f94a41570aa5d0dae7b7ee2fef4bbf42e96b7a8b46da21e51d",duration:2.246667},"icon/10001001.png":{bytes:23905,sha256:"fe51bb11c58eef524f2f6683663a58f69c4272de1d027797ccf1b283b5fcc583"},"icon/10001002.png":{bytes:22166,sha256:"36936f7678f5c5cb0a3a014a76eb9c6bdd5a9f23e72dfbef6d9523523cf9be48"},"icon/10001003.png":{bytes:22959,sha256:"77e1ca70f67b68c3a2ff8951017a95c54af43a02d37f025c4b39e299a0389820"},"icon/10001004.png":{bytes:24182,sha256:"127a9be79e7a0460bbba6f4390b83cf0137a1f50995fd4ddfdf071d0ce9aec5c"},"icon/10001005.png":{bytes:24501,sha256:"78dfe771d99b5002ef7ba93d6b2705aabf28fc8ad362becccd986de62da8b9ee"},"icon/10001006.png":{bytes:23058,sha256:"0bd296f4d2ec3fb3a46f6cbaaeaa959de21e5e94927317cc1c00f3eb767a8ab4"},"icon/10001007.png":{bytes:24384,sha256:"0d858dd1574291ff8365a64381eb7c2244e2f3ee054b89c4291d295af23cb565"},"icon/10001008.png":{bytes:25339,sha256:"60fb9e6b7b0765eb6559360a501220628f73995f20cf32bf600556ed55baebed"},"icon/10001009.png":{bytes:25470,sha256:"6eedb42ef97b243de8b3c7ce7d4ff06ecda408e333c1b67bfb0c3252ba2b71fc"},"icon/10001010.png":{bytes:17067,sha256:"3067643b0330ec446e15ff4b50eadc5c9d75597fac5b7ead544cf9f74c27c8f3"},"icon/10001011.png":{bytes:20283,sha256:"693c10ff57c4f729c5bc4bbc64aa15a7ee9ed1666ad08af11a6bf976e3608ab6"},"icon/10001012.png":{bytes:17900,sha256:"eeb4aa0a6a2e7d52983207ae143660f4cb50c1b529f7c42817112f760ef07520"},"icon/10001013.png":{bytes:20986,sha256:"273f7d86fb8e209bbd2dc06ceb3679c7f8d5d78f57fc3690bfbf83dd48a5fb4c"},"icon/10001014.png":{bytes:19083,sha256:"966cdcbd74d3e990262f5fdf1cc58704f67ca4a2ea5cd36d0118c0be2f312e0c"},"icon/10001015.png":{bytes:19533,sha256:"da2debca11cfa90e1868b966aa19f426664b968d0523ed458bc23e6a26601272"},"icon/10001016.png":{bytes:20596,sha256:"9a584e1393532cc8649512c31319bfa901fc73d557e01c3cd3c77ec80b8a6225"},"icon/10001017.png":{bytes:15766,sha256:"b2588c21a03d6c7795398e2240e527bbdd4e3f718f806f3906930bd68a4c8b85"},"icon/10001018.png":{bytes:18168,sha256:"5e9938443c22663db8434fc568362ae4d3de48cb1b6c411e703aeac07e3b5c4c"},"icon/10001019.png":{bytes:21447,sha256:"7625187d1c358b23e8ff7c38a9a4c6a9952bb0d7f9d4b6cf1256f1a0493df72f"},"icon/10001020.png":{bytes:24125,sha256:"2c07a35ade6a3d73b08d24b76153eedb6de41f1298e840dd5faee04bbf8fbcb0"},"icon/10001021.png":{bytes:19226,sha256:"06046a9387fd8ead3fbe4002c9cafbaa4189852bd683ef3b627133324fc578e9"},"icon/10001022.png":{bytes:19063,sha256:"30406afc29728bd50b1cd1704307effdca73a86db5d3b97a7fd1b2ba936e383a"},"icon/10001023.png":{bytes:19749,sha256:"29ed71483317b6d1f7fdcc4556731ca19a3828158bd70710eaaac5f7512b7aa1"},"icon/10001024.png":{bytes:7178,sha256:"1459dc8c6bba8f391e63d40dc410b0a94ba1ea346a2cc19b8fcee940010a3bd6"},"icon/10001025.png":{bytes:5758,sha256:"7fd586d94c22c9a6c4ad0248974b21d4f29b2a7e2c8c04cecf607f860bd4dd74"},"icon/10001026.png":{bytes:6248,sha256:"1829dd3720c0df86849f78fc5fb532e8412a5302bae20cd4571376c9ae06f43d"},"icon/10001027.png":{bytes:5454,sha256:"fed706b5943134d4fdb776ec35f479bf792a0b4603e23b2030e7893a3159ecd8"},"icon/10001028.png":{bytes:5275,sha256:"f0f01e125afd58d2a7cc6f850e1a69edb8e47d31a424eed21431b0b4f0e34bdd"},"icon/10001029.png":{bytes:6492,sha256:"592c905f1b364684d1004bc17739d1dd563e6aad5a0da97174d6f4d91dde0afc"},"icon/10001030.png":{bytes:5994,sha256:"816c8995dc94a724233222b3a21633d55330bad2c9879509587cfc10a20e9f50"},"icon/10001031.png":{bytes:12053,sha256:"36d3220568ee902b5cdce711946423d79edf54d70b46f7e46d9d79316a60f470"},"icon/10001032.png":{bytes:6189,sha256:"4d2f2a6a4aa56f799fa6d9b2bf112dd14754f3480951962899ed8e19f0f3d5a4"},"icon/10001033.png":{bytes:19270,sha256:"74367881fc31f13f6c8c6aa87a5da0c779d8303cda03aab1b914d03e2e243697"},"icon/10001034.png":{bytes:23429,sha256:"fdf41e7834dacd674f9d14e4db0c3a4598ae18ad7bcb0ed2f819af69decc4564"},"icon/10001035.png":{bytes:10567,sha256:"71e42a76b7d82964f609885a8fd0f4b8082dfbbc450349dd1329fac1d0f3b8d7"},"icon/10001036.png":{bytes:20003,sha256:"3ffb2d2cae852795566819b3bc65e42d6f5cfea442807813e3f110d2ae5306ab"},"icon/10001037.png":{bytes:11651,sha256:"0f2f343b4030beb38a5d03ca500b16292ee3402853a685eea33907da3166d00d"},"icon/10001038.png":{bytes:3402,sha256:"4fe6ebe2f6160b91c3c51971e4d588fa75f17dc58680c5e7525547eadb8a9922"},"icon/10001039.png":{bytes:16348,sha256:"c91c4bb5fd6c4ca331d4e47015669bd8727d2c91a3d79e97dceabba5484eed51"},"icon/10001040.png":{bytes:15606,sha256:"02c74e003d186f3c5ca4ea280312e2629faade7a3b95dc9ea320f587d411c658"},"icon/10001041.png":{bytes:7378,sha256:"dcec72b04c3096893874d605112c6c8aca2182a5d7af4231e08e279155efc6f0"},"icon/10001042.png":{bytes:9216,sha256:"4d53cec5485b07cde76ef6a459d7f30b73cbb149c7d22d70f94c9d4f08caca95"},"icon/10001043.png":{bytes:7268,sha256:"d0c2a175a0de3b1ed673ff2298cd964e93681a79b8bae03cb3a9940bf2b295b7"},"icon/10001044.png":{bytes:17785,sha256:"b166e9094cfb03ecce6eeeef4715623325ec4b86eda3236e72d34c7f1e4c7aee"},"icon/10001045.png":{bytes:20257,sha256:"dba951310f94d16e23800d78e6f15fb09753de1106fce0b6b65c869ac836ae5e"},"icon/10001046.png":{bytes:18695,sha256:"ccabfef92ec484881baade8997962077e362dde9552a0eefa4c11a063156bc61"},"icon/10001047.png":{bytes:20724,sha256:"571f24becceb229b8388a458c72bf5367c9c9b1bd2f511be9b6175f34c3fa743"},"icon/10001048.png":{bytes:19845,sha256:"3bccfb7c346d124071a2746f75d9e519d90985f07a9122cbb373347646c50d1e"},"icon/10001049.png":{bytes:26620,sha256:"62eaca8f1fa7013d5a9039864571102c640f0ad38b7fc19c34e475caf719cda5"},"icon/10001050.png":{bytes:21554,sha256:"9757b6b14968327fbd2933e4bc1df5c88e8acaa6a1654f880d0aa60557d0f012"},"icon/10001051.png":{bytes:23608,sha256:"3649049db87f65e60857124089570f03d8a87ccd367eddf1cd3189dc49318222"},"icon/10001052.png":{bytes:10144,sha256:"2939136db3eeca57cf771b6e776b0d00ef93b53d00a436b1429c8035821cb49b"},"icon/10001053.png":{bytes:16400,sha256:"29c5e8192b476e74b655b9b717ffa08b0195d5e098951a07904128b2fdfd8cd3"},"icon/10001054.png":{bytes:26202,sha256:"f73fbc019e699b109591814aae3f6d8b111b1388e6bb129ccb35edf7b526dd6d"},"icon/10001055.png":{bytes:19948,sha256:"48de3fe25bdde874eac546529417ffcc4ad395640539895293de829bc9d28fcb"},"icon/10001056.png":{bytes:9550,sha256:"a681352376be706911851bb90563ed343968c35c58c7af3a77fff4b4c16ea3a2"},"icon/10001057.png":{bytes:4530,sha256:"f855883dd19a55155968b77c238f2b5fe0cd894569959ec0f776b3c7d9c0006d"},"icon/10001058.png":{bytes:19430,sha256:"d94b796fbddaf0d63531c0b5569b26ef3e5cb42a51b06faced91b6c9fe467c94"},"icon/10001059.png":{bytes:21181,sha256:"71fe484027e51e4b7af32da4a4d3c661bef1dc5e011710aa0c8512db46237072"},"icon/10001060.png":{bytes:19537,sha256:"cb3ee2648a2b1b656e731d8b2c0cb102bc2eed1c6125b166e1867ca0129b4117"},"icon/10001061.png":{bytes:19347,sha256:"2b7bff19a05b1868e680b8d96919aa1449a7a35fb16fad62ce12d9e546f1cc8c"},"icon/10001062.png":{bytes:24195,sha256:"381bb70063fa7dcc3eda51a116bd79c44f41f32fb2abe647c3957570ca3c5257"},"icon/10001063.png":{bytes:24414,sha256:"240ad25841dcf341fc202efeb82009b52f9e99a403129b251443248f8729200d"},"icon/10001064.png":{bytes:21752,sha256:"8f37873cb51acc05c3e38534b272fc0dffaf2455e85f123fb7d1273584e9a276"},"icon/10001065.png":{bytes:22353,sha256:"082328a9b48c365b77eb4b7c7fe3461647af52da0f6f8d3a9a6aed4715ef55c9"},"icon/10001066.png":{bytes:25040,sha256:"93e8e9a1154521759b8275da6dd7813520067bdbb958fa1ef40a3e2db5d33ebd"},"icon/10001067.png":{bytes:17900,sha256:"764844d417a505af87d84c5b45ed11d8d4f6751e0bb934296354baf2c5e9b7db"},"icon/10001068.png":{bytes:27775,sha256:"f1696ad983c71560c9954d23d24e32fa79d877b7f136b115526d74002dfa13ee"},"icon/10001069.png":{bytes:27560,sha256:"14a34457ecf46a8f4a587ec4c7349a56dfa50550382dade7b3496365165b6f3c"},"icon/10001070.png":{bytes:7342,sha256:"392327cac6f05cd50cf10517e065449b3e3d63a20f2e7028cb54597341fffa1a"},"icon/10001071.png":{bytes:8292,sha256:"e35b725fd8337d3caf63550d9b3483fcc4d2e033711538db5cf792c1990760f2"},"icon/10001072.png":{bytes:2941,sha256:"92b0722a12b3370aaa2ddc69da17d1df9ded02d96e1310d9f88d22531d1e52bf"},"icon/10001073.png":{bytes:26648,sha256:"8cb0bfeb6f957c3507f9c59987440e34f9b8af8435ded2e80451c47c5e40e3ed"},"icon/10001074.png":{bytes:15602,sha256:"ade023a5bbeabcb56c1f14936c05d43a55836d9e0d530ac27a582ce5fd099cbd"},"icon/10001075.png":{bytes:29167,sha256:"d104103a60927435254c590c3d13294426f05ea81193ba5581ac1c56dbad690d"},"icon/10001076.png":{bytes:21611,sha256:"d42eff9554cf6b8010729decfe48c67f82fbe044d7174ffcf6f66ce1e0aaa776"},"icon/10001077.png":{bytes:17232,sha256:"417922105baee5e55df1ca41dec0f6ea50e5597e25e972bda5e85921ba89defa"},"icon/10001078.png":{bytes:22903,sha256:"f595cae988c1aa72bb46aaed66fbd4eb2a80b0d428e6f69279e6cc5eb8f33d43"},"icon/10001079.png":{bytes:12314,sha256:"d786c8e75869e85cd1282fedbdd7184599d467323ec627ba84fc8ac4d5b32802"},"icon/10001080.png":{bytes:21705,sha256:"40070edd6457107645f67436623734dc991b9ca443ab90f69f70dbaaea7a39ad"},"icon/10001081.png":{bytes:20562,sha256:"d56e7c2c982f3b27cd11f81799f37e59bed9c0ee33c38cb388a761faa3ff4aa7"},"icon/10001082.png":{bytes:16044,sha256:"d1a2f46512f076d4c94d595d09bd79a621823a9beb605d7550ec7c0a18063fee"},"icon/10001083.png":{bytes:20479,sha256:"fdccdda6ccfed67eac85cfa376d6f8a40ee1219ddd3cad6900b277b609e192eb"},"icon/10001084.png":{bytes:10321,sha256:"8ed3211996fe8174c1eea74b1b5187b507fda63b2d4f9c92d1a198d2560b00b3"},"icon/10001085.png":{bytes:14763,sha256:"2f965520fc95c4616a4af85f5340788038a5b4530ee2e687153ce58559c03220"},"icon/10001086.png":{bytes:18341,sha256:"060c578e663efedf5cb8516fedc4f05837fcf63a55b977d19658324708910776"},"icon/10001087.png":{bytes:4213,sha256:"769837b1d6caa5bbd3e3aa99ea416c57538b18c7c24d918e284d9c1251bbc460"},"icon/10001088.png":{bytes:4172,sha256:"5d4ea01aaec16fe631fc2383d258bba90158083c6bfcd8c1183dc22bad62fc0e"},"icon/10001089.png":{bytes:3474,sha256:"90625242ffa6ef70ba55f48bc7ecdb056c359db8381831ff22f9885d3c3f22f3"},"icon/10001090.png":{bytes:7435,sha256:"513808a1c0e913a192a113b8503698612af55c7ba9f3f341d24f50995aa7e902"},"icon/10001091.png":{bytes:22367,sha256:"7daa0d126bd8a7389720014dcb8448da8bc21eb0b381a99062bfa81d0b4d090c"},"icon/10001092.png":{bytes:12227,sha256:"9d63290e2cfa3acf8d58df425be36a101579b867c66c306986d762d7d4f422fd"},"icon/10001093.png":{bytes:26518,sha256:"bc385ef5b565fd3a9e6f923d6172155fd25472be7705b2b62569b07b8dc08cf6"},"icon/10001094.png":{bytes:25052,sha256:"e4ae56756a19592c96fe52a7a4b538c943377c2a20d921d8fecaea6a8f0c7dea"},"icon/10001095.png":{bytes:23206,sha256:"c4f38e680893ecda45e5c7e3589a2b852a15f4345abe4ec23629e1836d4db70e"},"icon/10001096.png":{bytes:22122,sha256:"f686a5ea91407ebdc08f4291b5169bd552ed5c8d8333be59db9366770cf7ff2b"},"icon/10001097.png":{bytes:12560,sha256:"f73d09781a3c85f822b0c88fa72b740cd50a15c2b8f592fa87979353ab4469dd"},"icon/10001098.png":{bytes:15059,sha256:"7e8050b1404cc16aa86a71b41dbc9d21925a9b78ad9e5254cc4e9624deb31f6c"},"icon/10001099.png":{bytes:15584,sha256:"ac80e1a8be3932dd9961cf91cbb2b177c47600b2bebe29e415bbb6fea798164c"},"icon/10001100.png":{bytes:16326,sha256:"c09dc9a07b44cf2c71c61756237422b4a0c2d2067321cd43695ce6585cffcf56"},"icon/10001101.png":{bytes:10612,sha256:"7aedce9017c7ee89d59e134d9ddd054dd907a26db6c45e7fc20b7506c51b687a"},"icon/10001102.png":{bytes:23039,sha256:"493c35fb2876f09ab03cfe98eb72b4897c8ae425650572c20fb92e71434c98ca"},"icon/10001103.png":{bytes:19364,sha256:"530857b7b8e777d3f96fda60ccb9f23007ecac339c4f752ef3c85a297b3a7966"},"icon/10001104.png":{bytes:28069,sha256:"e9eb24af2a0ba2805b54c614f10221fcb7c1d73217b5d0dc6b7e00fea2e26c33"},"icon/10001105.png":{bytes:26082,sha256:"24952154a32e5955b8503c92d6ebbd85991930130c4308e2cafe9f7c5f577230"},"icon/10001106.png":{bytes:1651,sha256:"617f1f8e08229f2678330ba3c3b6167ba865b07f93691127e870b8d6adf6641b"},"icon/10001107.png":{bytes:22485,sha256:"938d08c4bf33909d7f0895c84a91713cfd1e6f937f33ff2da5eaf2b52eb5b06d"},"icon/10001108.png":{bytes:24430,sha256:"a601101f8b16bdd131b47c8f66433bcb973d1b695d992b09e634a728dff54535"},"icon/10001109.png":{bytes:15975,sha256:"210c74315ec41a5d3c19c29a76bdd3413765f8f17ded734dc0691e76d85b2191"},"icon/10001110.png":{bytes:2344,sha256:"e655f46b6fccd2edafc4eb323d8678eb28f3c3ff117e3ac9f69c60c1827ace46"},"icon/10001111.png":{bytes:3021,sha256:"85f3c7595d26004037c41ec5303b62384a0e78b1ae06bdb99386e027de99ff54"},"icon/10001112.png":{bytes:3407,sha256:"89107889930ee230b538fbbaf11e6d0d041ab412ddf5b9d834a35c30289184e6"},"icon/10001113.png":{bytes:20006,sha256:"043f3dc850dd766a97ca36a4a6b6a4f69f6bd1a39b503a94ae7f44d24a3f9f94"},"icon/10001114.png":{bytes:13510,sha256:"00746c36384a8db4907dd246d6eefa673f5d1779ebd7411e9ce240b605129211"},"icon/10001115.png":{bytes:25840,sha256:"81c3874b31b33ff76ff5696828fc7e041acbc4e5802a159e6d7cf39623b6e4d9"},"icon/10001116.png":{bytes:26845,sha256:"e08add35bb5d9dab63eb2113db0a3f02837033f89ef5bf03d6fb6bde4b143a7e"},"icon/10001117.png":{bytes:5260,sha256:"7d5929d69cf88c4fd3aad5d0924e5501c8d6466ae8deea9dd98587bcc683ace5"},"icon/10001118.png":{bytes:2319,sha256:"4a2e00b11368da3400d0fde87af9ae0004a491f9e5166cbe9ba3e412d8c42977"},"icon/10001119.png":{bytes:9639,sha256:"69c0e0c0244fe4f9a863a749dd0697021334cf6f8a940aae48047447d07abfb5"},"icon/10001120.png":{bytes:3934,sha256:"92b3b1c0bb994c6eda4527f6b6dd2af58c3fa895d04867856d0ff59ccfd19048"},"icon/10001121.png":{bytes:20543,sha256:"2ab3a15500ca6a11e4ca65bc371d95c0af1e0563cc2c0dc4f20c8c01ab092e38"},"icon/10001122.png":{bytes:12810,sha256:"b5836c452bfa9d9a1db7a362538da5568db5824118c696eb3a2c158ae70f0cf6"},"icon/10001124.png":{bytes:35989,sha256:"619ff5c41712328cb34e98705aa8df74574a1821770a4586b22909577a4bc58e"},"icon/10001125.png":{bytes:29137,sha256:"99a9ab0501de6dba85c2abc0e1e36adf7a86f10fb37875e2680f2f6d9ca3e83f"},"icon/10001126.png":{bytes:22453,sha256:"f43f07f4c18e71b27570d8523eb3a8e029420c31ffadcb3e3aa1bbaa80a9fe4d"},"icon/10001127.png":{bytes:19714,sha256:"07781839310d272bc7aa3dad17d09224462964e4a677466697030781c8fa71ce"},"icon/10001128.png":{bytes:13908,sha256:"e1181919aa1dcf4fce455f94c43548cdc4db1eccbd1056cd9cc2dd3eb8f61d64"},"icon/10001129.png":{bytes:17401,sha256:"350f315d554986c5a522f79ce80a4f33b658317e2dfd28e765f31f1f55d9fd8b"},"icon/10001130.png":{bytes:12296,sha256:"9a43c99b2df57772c96547b0de18a8d0760d6c324c2b9d3cc3db33467dd08503"},"icon/10001131.png":{bytes:5038,sha256:"75d352f831fb2cb7f33db7514a5e8c96e1dbaedcf370955cad7783baa0845efe"},"icon/10001132.png":{bytes:7256,sha256:"b0dba588447f82e38c20eb54684a9d1f84ea83fb011287908f81cac2d9c29756"},"icon/10001133.png":{bytes:6606,sha256:"96100d356bd18b99201bde0a3196a851804f391a99e915a189d1ece883c4e349"},"icon/10001134.png":{bytes:7075,sha256:"93352721db5da92231f0b53f01f72aacc33670a820e2fa6331f402c79ab3dff3"},"icon/10001135.png":{bytes:7300,sha256:"e978e0bfac39714827cd7dd770b54fda77e5e7bc82392ce8092e9ba616ceac3c"},"icon/10001136.png":{bytes:4617,sha256:"403a83d32973ff5007759b8910d8d38f29c42d0caaee60876a29951a263008c1"},"icon/10001137.png":{bytes:6923,sha256:"e64530fb2cc4cb2e95be5481ce47d78a99d095cb4739f6c58f0269bb6c06df60"},"icon/10001138.png":{bytes:3412,sha256:"0d8839c0f16110389f079dd0cdaf32130b0d4363994cd62e51f64775a89736c6"},"icon/10001139.png":{bytes:3432,sha256:"ed8360d109e366c6a330c2806137f37d458194adcb5d7a5d61da0c168061f316"},"icon/10001140.png":{bytes:2813,sha256:"b3d6c1d80544a5327c21f9e63e452ed129e729e4ba18653013386bfe9a26d6ea"},"icon/10001141.png":{bytes:1976,sha256:"7874744cf4f00e0a676a4d76eb469e72ecd5fed016ae4b25a164f78994dedc19"},"icon/10001142.png":{bytes:15037,sha256:"14d12854b4b17da8ba54f0808be9acca2cdea82f004b047343b288fc5c442d65"},"icon/10001143.png":{bytes:5652,sha256:"5f02f7cf842d9aef4b81b784e3dce9ed4e820745c97efde3b7af2fa94cc6f2c6"},"icon/10001144.png":{bytes:3080,sha256:"ed7b8552f4dff8310e269986336dba5cbe76ccb6e065156b825bf8e0b5c8fdfc"},"icon/10001145.png":{bytes:2987,sha256:"ffa4d3452e8d0c751aec973fffe797c2e872175cd5912d0393c72b3da8cad13c"},"icon/10001146.png":{bytes:5483,sha256:"4ed80b9c3fa0d88c6cef1289f18048b9b373742348e991e23b3ac042bd71ad26"},"icon/10001147.png":{bytes:1152,sha256:"05750a2593db8d6cb0e64755e447fa2236cc5edfdd633a8ab9be8d8b5fcd7d89"},"icon/10001148.png":{bytes:2662,sha256:"421eafe1622cd73809a8b09b7a74074628a8acc9df8c4411f7ee51fb96a6cc2d"},"icon/10001149.png":{bytes:5963,sha256:"a16c6f9abbd6d866df576878a10477bb1f9c055d4ad19a050e3305b394f80058"},"icon/10001150.png":{bytes:7106,sha256:"66161334208241a31f9f5bca369733c81c6070de9b1d9f4c922c6c5a15dcc684"},"icon/10001151.png":{bytes:10932,sha256:"260a9dc36d191df0700e243e8461362605ddd759a0bd7fb382a9175ead3d9c91"},"icon/10001152.png":{bytes:5867,sha256:"e1980362d5eed82c2806a9ea5fc1b0ccdac33629f7aee398f74c5f54389ed683"},"icon/10001153.png":{bytes:9870,sha256:"e1e279e3065898eca9503c8652b74a71b4151284a733ee9293026be4d249c05d"},"icon/10001154.png":{bytes:9156,sha256:"6c6bd25805bb81659537de7814550b6b4daaddaf894645eb630ff9520a246d04"},"icon/10001155.png":{bytes:5172,sha256:"057bb0e931efc9b955b43943dcbbe5df73cc34ffd1755df8986e0f8f691b4794"},"icon/10001156.png":{bytes:4527,sha256:"5b93b62d5f786efce3b63ad62da61c67f15a65441a47fcb2df3cf92807170758"},"icon/10001157.png":{bytes:1326,sha256:"054bbfcfbb69453dfeec70ac86a3fef70f4ea818110a9a8285bd294d65972d60"},"icon/10001158.png":{bytes:4270,sha256:"dc54dad40d681aaf0f6aac8b3dd4b419e05a079d5d05bd4561a7348b9edf7927"},"icon/10001159.png":{bytes:3192,sha256:"b3962f15d41f625b1435c7d7182f2b744fa9de0ff299503dd3683171de794d2a"},"icon/10001160.png":{bytes:5158,sha256:"9e52b24f602584cc198214039c10c2bd33609b3c448ddfd2acbd565beb8bfbac"},"icon/10002001.png":{bytes:20145,sha256:"f4d95a54594309ab6deed445289097af22295f51ff5b7139acad7bb06045bcb3"},"icon/10002002.png":{bytes:21810,sha256:"af166959cddb542b83349dcc045096dae6185cd52d48a013dad78fe7ba1053ce"},"icon/10002003.png":{bytes:21958,sha256:"8bd0e7b9603ab0136ce86d8f7ace42ae23640013f07464730efd774655bd1628"},"icon/10002004.png":{bytes:23769,sha256:"4c1e6d5b3eef62b104f392bcd6cbf3ae7d2abaee06b161a1a65c6e916734945f"},"icon/10002005.png":{bytes:23898,sha256:"b30336b8be741b5a6315bf6ffffde315446e1639d9438e649f282153eec3f13b"},"icon/10002006.png":{bytes:36362,sha256:"81973c5d0fc8a86e8cec23d9d3eeb68f23ea95c302e8fefccaec90a320891427"},"icon/10002007.png":{bytes:23004,sha256:"1b42dcbd00fb4f45d6818b05e8b56c2880b0b2fbe061d17562f0c2125e6dbef6"},"icon/10002008.png":{bytes:25821,sha256:"7a6a91b0b32ef193de8601d3779c8a96b30c8994f746ecdb14920f364f434401"},"icon/10002009.png":{bytes:29951,sha256:"d736d5118775d03725093e1dd6bc51236c7fa39ed00184487db2267bae5f9f4f"},"icon/10002010.png":{bytes:26085,sha256:"6b92c88569ffcdd8b2cd4836f281b36ef5085c468fbb14923d085317e3d25c81"},"icon/10002011.png":{bytes:25715,sha256:"827cbcdb97487fefbfb801847e4acbcf298d0c10037173d612b006f615ef5ef0"},"icon/10002012.png":{bytes:26384,sha256:"e7ae9e007cddcc3c1f3a0d8206052b107ed5726276105583f4bb9015a14c5fa3"},"icon/10002013.png":{bytes:27500,sha256:"5ff084b46a5b00e83aefdba355c33bd972cad0537c08fee7bc6ffb42bc0ebdc6"},"icon/10002014.png":{bytes:20236,sha256:"c98b3528d9506c343a680e3699c3481dc0e17a7c14966b447a963c8bc0639c81"},"icon/10002015.png":{bytes:30913,sha256:"1efb63f37ed6ebcb4e28488901b4866d37204840be668a677e53fd8735b55c53"},"icon/10002016.png":{bytes:26866,sha256:"a91a05fa0e2f633e32011fc416ecc7b79096bdc531480200bc64b71ff8c05b5a"},"icon/10002017.png":{bytes:27987,sha256:"e9adecf78cac8b30edfec13604726b9e04a3bc5cc9ab2459ca09957a4300130b"},"icon/10002018.png":{bytes:25698,sha256:"2c9ce8412106fef0b68132d1bb13358b0c2953ab968f248559f1b4bfb043cc80"},"icon/10002019.png":{bytes:20846,sha256:"891a3906fc6324235cdbf4c83c7e0d58c6a7a71c423b2bb0a38e04d0de717d4b"},"icon/10002020.png":{bytes:19304,sha256:"b06d5f3d0a91dd2b49174f680d829d73260a6d4cbec4fff48a6131d4a4e89695"},"icon/10002021.png":{bytes:21812,sha256:"01dad29e897e1660646fdaa826b72fadbe822ceb13bbad6cb57fd1f9519e3139"},"icon/10002022.png":{bytes:19095,sha256:"eb571c371e8c9f6447d1567652425c43d2e6cfa9ed5f3dbd6b29fd3ff26f741e"},"icon/10002023.png":{bytes:20241,sha256:"5769cad4d0fa0effb7498b15f97ee1f45e6655275df15164e04f79ef314324e3"},"icon/10002024.png":{bytes:14546,sha256:"b823c0e0b8e4b852519254794cf219b42e02021d667528c6387a545fc2a066ac"},"icon/10002025.png":{bytes:28393,sha256:"5374e4d458ac4d8ae45419c0040c1981f12395afb984b631c48b640b8be2aebb"},"icon/10002026.png":{bytes:5243,sha256:"f97e20c0f2ea8e3c2d3b3dfaa9d3b9449e3ed559364cc2e7ab1516d0cb88bd78"},"icon/10002027.png":{bytes:4486,sha256:"cdd1376115bf45ba21b47c6e574a5b28f7c83cb36159bb1f7c60d737f9ec8ecc"},"icon/10002028.png":{bytes:3253,sha256:"41e38057943bc5dfbb24d8279c9ce23b58c871615deb28d934b0bb954bb66df2"},"icon/10002029.png":{bytes:24855,sha256:"60c949a324f60ac215dd01ea0dd4471ccff9b912717fd3b03443dea31dd87940"},"icon/10002030.png":{bytes:4435,sha256:"0a3e76f32808add9274d8e65d279b33521b655036d24cf87de3f5fa11de6dfc9"},"icon/10002031.png":{bytes:27998,sha256:"8fa5a2187292213adab843c9fbc68e8f099371a3ed74c55195998f92810e8b4f"},"icon/10002032.png":{bytes:21697,sha256:"9ece6166203932aad1a59d851258dc92e17f67f11de52b642c3abedeef571a3a"},"icon/10002033.png":{bytes:35521,sha256:"99c220eec1407ade7a0a5ff8c22a8dc6e4149ac6d0f407c005f78f8338f9bab5"},"icon/10002034.png":{bytes:6754,sha256:"b5097a0501688fe67edf17c7a993ce12323a2b86b55226db7cad7d9c2ffa016b"},"icon/10002035.png":{bytes:9625,sha256:"172106dc0c33f12daad2eee2ab1278f94c1026d0d6db70320851f2908eb9eb46"},"icon/10002036.png":{bytes:2474,sha256:"43ca13e6572a60aacfba330ac86bf5211a6901914fbd1559fffbb89ca15ccd41"},"icon/10002037.png":{bytes:23717,sha256:"d232b256c550eb85f96d5eb28f19a661f2127f383f49bf4ba4348f935f32dbe9"},"video/10001001.webm":{bytes:147646,sha256:"a72065f7abcc9387fb3dccd473d509bec7b421aa6c34c89e344dd8ee294bc2d2",duration:10},"video/10001002.webm":{bytes:171594,sha256:"b6e89b1967387bf40278b73414d90f0a3b8c61b0e4bfa63e74f67fa049ad3482",duration:10},"video/10001003.webm":{bytes:151975,sha256:"c5fa8ecbc3e6992256ee128dc400d2c93bf91fe5f7813a4d289c4b6d477fda54",duration:10},"video/10001004.webm":{bytes:164765,sha256:"d85282288b6a845d35f7ec6bfe49fc0f5d4766fe61ae30b87a9df6ff2a4961fc",duration:10},"video/10001005.webm":{bytes:189607,sha256:"0f186507b14407573ebb42da49a5749809e28819854cd46b4bf82b858ff057fd",duration:10},"video/10001006.webm":{bytes:136733,sha256:"cd11113d02047c42e3c03be3f2835f34eb52d0fe595b8e380a69fa86d9a40957",duration:10},"video/10001007.webm":{bytes:174723,sha256:"c9e65dbd73985b4ee5e716b63f5a9bf5719be8b95ea9a3a61a3aae772adaa064",duration:10},"video/10001008.webm":{bytes:13947,sha256:"d494a403015acc7700b45021ce269771edc8766e62f2bd82a7d26c9f60c63bb5",duration:1.3},"video/10001009.webm":{bytes:15895,sha256:"04d442aa0a51199be173b17a069b8365ae3205b26db275fb73355356fa1f871a",duration:1.3},"video/10001010.webm":{bytes:83391,sha256:"9bb064beb2f4622cc761ba26e5793da93c576d9c26be517912bd0d25f82763a2",duration:10},"video/10001011.webm":{bytes:107849,sha256:"d884e886fd74baba25a896921907e37675329915a90081fbcdd30e84fe4df099",duration:10},"video/10001012.webm":{bytes:84881,sha256:"c3ed5ae0813a45908906170ed6513b64c20a51f72aa0783ee55112ddb8701f80",duration:10},"video/10001013.webm":{bytes:96819,sha256:"560da96c18685b4fe4acc7b32ab940f229bc7ed1c57b0dd4511be7c22e5b6162",duration:10},"video/10001014.webm":{bytes:140840,sha256:"6ae425c9aa6d7ce1a476f18caa12ef0b124fa8b98e446696a3bba29ef6ae9a32",duration:10},"video/10001015.webm":{bytes:106513,sha256:"78e68a0cd736cf5c7a433f79f603126d0036bec8a751c937c7b96106180865c9",duration:10},"video/10001016.webm":{bytes:126160,sha256:"206ff8c1ba2836b2e58a907458b3c5a9ded69556eb4e29685725f49a90a2b481",duration:10},"video/10001017.webm":{bytes:217547,sha256:"0b1402a3ab2b0b3fa2284c33dec5b818049399a3a7cf1c2bf6b891c604905577",duration:10},"video/10001018.webm":{bytes:78212,sha256:"b5681b42272c66d918e143a63b6b4f9c044cd6b3ef1a8d2050a26f583b6b7a2c",duration:10},"video/10001019.webm":{bytes:175270,sha256:"6f493f9db0be094ab927becf8be553d416eab7ccdbac76896cd02a33ea094af3",duration:10},"video/10001020.webm":{bytes:227796,sha256:"57eb38683cf84e8abbd6319da39e08e4233baee90bac54568034fca55f7a253b",duration:10},"video/10001021.webm":{bytes:216527,sha256:"e19c751b9c36ce5d68c18a161ada9216e23f7cf8598638de9c8b4c2911d6e390",duration:10},"video/10001022.webm":{bytes:188626,sha256:"6ca2e91020c1141ee626b5dca2c7c190978562a70af2a6982f387c1e9cd9e53d",duration:10},"video/10001023.webm":{bytes:199004,sha256:"0b42968e4ac8f1152244e3821ef33d15954bfd3efba5709568b778b7ef375d23",duration:10},"video/10001024.webm":{bytes:60772,sha256:"a1a4269849425bc985f07f4e2c9e7bfd2fa5094238926b9d4096b8155bee39ce",duration:10},"video/10001025.webm":{bytes:61785,sha256:"0d7e10b6b97b5cbb5098046277b0315b0db4b5542ad8da82758adb800eb970f0",duration:10},"video/10001026.webm":{bytes:59199,sha256:"d2404c66eb3f357ae6349541a53fa713c4d81793c9b5f273cb6d5b949ded6330",duration:10},"video/10001027.webm":{bytes:37421,sha256:"c97fd7cda4cf46636757fd2913f5cdbfc44db0c183d7190499c3f54c1b007bc5",duration:10},"video/10001028.webm":{bytes:57620,sha256:"0deb4f0b933adce6785a46c2319e63721774f185532875fb4434f78eb905863d",duration:10},"video/10001029.webm":{bytes:66083,sha256:"ae3ef6d5ed1c676ce11136f98404159bbd3e847b7967c7cd76e53060df090ddd",duration:10},"video/10001030.webm":{bytes:58745,sha256:"0c7965cbed1119b1ff13e1b3381129a28468a6464279751590063f11efd8028a",duration:10},"video/10001031.webm":{bytes:8557,sha256:"5847d08b09f9f39575fba5fabada6133757231545bf08656ae145136c8d21bd9",duration:1},"video/10001032.webm":{bytes:25221,sha256:"0a401d8d73d2a838d01daecdf047b04ae98cf76cac899ae7a21fda8b9cefc2da",duration:.933},"video/10001033.webm":{bytes:34602,sha256:"896f71d3387bcf4154cec5fe67593c1982374af65cfebd5b989108adc2e07ddd",duration:1.2},"video/10001034.webm":{bytes:125134,sha256:"3804a3b13d8974702162d97a703c63a7aa5bb2690e892a6215d3a61af788fa8a",duration:1.4},"video/10001035.webm":{bytes:67308,sha256:"22651c969c1e7ad47a6aa062a7791fed498069d407dce6471afb760b83eee66c",duration:10},"video/10001036.webm":{bytes:127270,sha256:"f0dabcf3554f6aeb9a3070796760df4f5a7047e435ba94e8c3948bdae24dcc45",duration:1.4},"video/10001037.webm":{bytes:168190,sha256:"3b0423327eac86c2376f2d0e1ad08142c335e80b3bf2a35b58410e43038a39e4",duration:10},"video/10001038.webm":{bytes:131917,sha256:"3153ff561dbb204cff54001334794aff6551dc29e55dbeb0fad35bdef372033a",duration:10},"video/10001039.webm":{bytes:11634,sha256:"2bbbdddc40b1790c6ff3f4a7be9c6ad0f8a5ef521d45e4c7ca9f0a84a70dcca3",duration:.766},"video/10001040.webm":{bytes:29034,sha256:"9187e82dace372eda0441947980d8a981238b519fe8b91b3cd8983a25bc38124",duration:1.2},"video/10001041.webm":{bytes:145234,sha256:"86c73a18f5f07c18427a4f6540e94ae0488a22ba061f931c5071f4524aeb8e33",duration:10},"video/10001042.webm":{bytes:173888,sha256:"f4011ff7a3474cf2ff9cc02eee560e46d3e1ad165848dafb989907199951ac01",duration:10},"video/10001043.webm":{bytes:42182,sha256:"9bd4b77d6cb8be53aa0cb3954a124c523f076cd4b3f3ef646d1a41a272c9a058",duration:1.233},"video/10001044.webm":{bytes:32089,sha256:"789fc8b1316530b118bedf21682606096aa1f4191c1946dcd1d3262713567a84",duration:1.566},"video/10001045.webm":{bytes:9892,sha256:"d9261d0738da8852b6473a93bff97ec9f5d7e8fe130d314b44f4d870f9e2ef85",duration:.733},"video/10001046.webm":{bytes:7771,sha256:"bc5fcfa1b15638d4f4b44cea1f27e02e5c7281e5d422dd70e8945e52524f236b",duration:.8},"video/10001047.webm":{bytes:11433,sha256:"8dfb6ace018b13706517ee2511753af3606a9d646ef98f7808a1bbdf0220e23f",duration:.733},"video/10001048.webm":{bytes:9648,sha256:"d92bced2753f1ab8cd2edbab06905ac82e4b1423235bd32e9259058070d19470",duration:.733},"video/10001049.webm":{bytes:24623,sha256:"54769931e5ce88f652c63c4b190aa017a7e70e5860b046df7a2813f00cb42b59",duration:1},"video/10001050.webm":{bytes:20713,sha256:"919a6070b7e1f042e5a74f091ba8c23924f467cc1ddfdc5816feb3d638cc3acb",duration:.733},"video/10001051.webm":{bytes:317681,sha256:"a1dda360215590f4b5fb7b8a82cbe44d240211270485eae950b5535b01686d08",duration:10},"video/10001052.webm":{bytes:15091,sha256:"ff7685c63cf73e1422f07b59bf5e006b6dad8d2d80b1a8ae0997d13ef58487df",duration:.9},"video/10001053.webm":{bytes:183319,sha256:"c8c07a2deb6b4899a6d1c1b8dda72fac6ed45a11d6646c40f5c2e354a84a8d13",duration:10},"video/10001054.webm":{bytes:17094,sha256:"ca07c647725212c323dad57886c5b56a5eda2ae27909bf5ddf0f3589e99b5b5b",duration:1},"video/10001055.webm":{bytes:53469,sha256:"a8c69dd8c3c9e4836f1c3c9a4c033bc7bfacc0fab9ac2981c48e4391589c41de",duration:1},"video/10001056.webm":{bytes:225400,sha256:"60fbad9fef225e7205c0eba98951387354a8470e9a50db3921494db3dba6ba0f",duration:10},"video/10001057.webm":{bytes:7082,sha256:"0aeb94988ec8862c3bec3f357f380b675da3b0881c48640b37fa3d1215353b9b",duration:.966},"video/10001058.webm":{bytes:90245,sha256:"4bbbc44479a590344eb38e965facc757347d87c63816e0ccf8939d98d8278ecb",duration:1.6},"video/10001059.webm":{bytes:87447,sha256:"fb1b2bf01c971fcf2a69833b2728d8553f058877386c6e17947e2bc28e50f904",duration:1.766},"video/10001060.webm":{bytes:1276390,sha256:"19f135d0143a973a7ea358a64f83aacb227ddd483f200c6fc88738b3a2e1c9b5",duration:10},"video/10001061.webm":{bytes:70336,sha256:"10d1a43ee81a6fb691448a1a3165612edd96943e7188612069a13f57788c3513",duration:1},"video/10001062.webm":{bytes:102563,sha256:"79a12a7baa9ab219c27845166f613f87829073e0214ff26ac1b3239a2f8a8222",duration:1},"video/10001063.webm":{bytes:565456,sha256:"6784dd43aa64a9005df034defe99ca23eedf9a124f0a0681bb9ea531152d5656",duration:10},"video/10001064.webm":{bytes:48740,sha256:"3585e3b7579301babf2a941529d05261f7a4e7993d394be668ce3e6b34269be2",duration:.866},"video/10001065.webm":{bytes:16738,sha256:"96de617b4263a73bdb61e98d4643e8ad6488bc0cc359ee4f8da5eb6b0333c466",duration:.9},"video/10001066.webm":{bytes:12376,sha256:"ca507ca6ab20dae1d3e9ff3cf8fb0fb70763983f4b3c82fe8f05b5b011160189",duration:1.066},"video/10001067.webm":{bytes:23685,sha256:"8702ce3719d477e8a79a5321b152a804a583578aa6335aae221e238e449c4508",duration:10},"video/10001068.webm":{bytes:55734,sha256:"708b564295d3c3e1929d4f5da5af6595e9ef236e692380a838e4230ff3813381",duration:1},"video/10001069.webm":{bytes:1128088,sha256:"56b38a26aaa7913066c3336ba98f7eb1037c17fe80fb110d45e123cc46c36acc",duration:10},"video/10001070.webm":{bytes:975681,sha256:"4c762f4cc796d0a167e47ba18c6c658b9173cc8fd951b9c7537043ac1d3cab4c",duration:10},"video/10001071.webm":{bytes:815992,sha256:"e2547ebac9f4d2dba4cc455fc73cf1de2afa209f4a54473a252f3578b5882361",duration:10},"video/10001072.webm":{bytes:616757,sha256:"551e36eea20409279ac7b058f0658460e88b60c7b62189209ab219ab5ab35969",duration:10},"video/10001073.webm":{bytes:37684,sha256:"913e5eb86f0de97099bc8f1c2860dcc0ccb23af3df7b9565e46d23dcd3d5b2e4",duration:2.1},"video/10001074.webm":{bytes:12604,sha256:"7a034a81cb6b8d09507a83c42b44fa6ce5dac567aaa4dad86900772e81573fac",duration:1.666},"video/10001075.webm":{bytes:107268,sha256:"a58331fcb3c6ca07f581b3ca490eedcd4e4d486ddcf944083038198495dc8c6b",duration:10},"video/10001076.webm":{bytes:32481,sha256:"6c49036a5c3d63f3f8a554e751fde071afa7a88c69c0eb5fa8aac3ead9936c85",duration:1.2},"video/10001077.webm":{bytes:34358,sha256:"8b1cd91b4547b5c773688dc7586d02ef3505b56a6c0e5e8cfe95ac2877074fd9",duration:1.1},"video/10001078.webm":{bytes:46506,sha256:"d2b1506af78535ae8c25d12ed47f613f58c96c237aabd3a69481926279abbad2",duration:1.133},"video/10001079.webm":{bytes:73888,sha256:"14eaab31df0169c82d784132e336f21e3dbcde36e8d863e813fdbbd0cc7fe736",duration:1.166},"video/10001080.webm":{bytes:227149,sha256:"f953d8cb2c360f1a7beff3f1eb0287d2ad5b4b5021cd8add406935e7bce0f499",duration:10},"video/10001081.webm":{bytes:206185,sha256:"bd954a94b76ecb754018c8d2f5600757907fcbf5b8d8fd8c16eba98d2c77bd45",duration:10},"video/10001082.webm":{bytes:414215,sha256:"a66f150faa15b300f9d87422b83566b253c50579b8b08a83e7d5fecdeb33117a",duration:10},"video/10001083.webm":{bytes:103790,sha256:"f7619598f5fd506003b6161a7d7a9f7d13eaf3ae26a51cf560899ee50ab74850",duration:1.2},"video/10001084.webm":{bytes:49760,sha256:"075a51589f5556f125c56e3448e2b8c7fcfeec7f7981228e46991fcadb58b603",duration:.7},"video/10001085.webm":{bytes:39486,sha256:"7782a3f27d41c5b833746b6892a2074821226da33b0dfefe1173c5a45890abbc",duration:.566},"video/10001086.webm":{bytes:24420,sha256:"1e7c975fd2c3027095353ae2b7651e3b9f0104554a072579127817aa5ccdea02",duration:.866},"video/10001087.webm":{bytes:58874,sha256:"5101e1da0097fc9785131be66f411e54f427ef18f21ade4b254728e94ac568b7",duration:1.166},"video/10001088.webm":{bytes:64189,sha256:"a3c150eeaca295e70a351b250bd3554b4633a77f6704e581b72a8bd93f0ea194",duration:1.166},"video/10001089.webm":{bytes:25443,sha256:"0e5a1151fea93701ebc923211c8f5c406e895104a4afb9ba71d521ad45b39b85",duration:1.966},"video/10001090.webm":{bytes:65254,sha256:"89ad6f296294c0abf4fb08e68ebf141d1c602a659c0ec563f7058ac6d2462fd4",duration:1.166},"video/10001091.webm":{bytes:81681,sha256:"3081d901c969bc1f4a4b10a447c3a712a8b4136965c34a76119e1b6dcd5e6cd3",duration:1.6},"video/10001092.webm":{bytes:548135,sha256:"5c013b847ea4b8338927ebd2597c2bb12b9c9a7231853c3d277eba10f9dd453f",duration:10},"video/10001093.webm":{bytes:63342,sha256:"bc87982e78383167ff4c649b6603a78cff1d6cf3cb51349e73626fcb2a5a7b49",duration:1.033},"video/10001094.webm":{bytes:20050,sha256:"53e91848830acea081a4d56ab8db383627a78ebb806ecb6766a2e11ed9573c58",duration:.833},"video/10001095.webm":{bytes:84670,sha256:"172553d18635861bfe28c6f06b5c8cea5e7640287cb75242fec31c12319772d4",duration:1.8},"video/10001096.webm":{bytes:28716,sha256:"31d3f4236eb9e2f2f6cc76003284b02496bc581ab1c8e19cd5929b5828c894ef",duration:1.6},"video/10001097.webm":{bytes:25147,sha256:"2129484b7dfcc5abe518553a0841a92a6582062356acda687b942b2cb221d26f",duration:1.6},"video/10001098.webm":{bytes:76333,sha256:"ac1d85c4f336abd854fd461db4e0951c83346dd2669c38b91e537ec758e9de65",duration:1.6},"video/10001099.webm":{bytes:76173,sha256:"2fba51975dae32febc9c1a270b1b5b769d299f143c4996198c7dfca26efd1014",duration:1.6},"video/10001100.webm":{bytes:80616,sha256:"ee23d3bf91e53bf9eb93d5a7c5879daa54aaa7e7194ba3944758131ebee68c5d",duration:1.6},"video/10001101.webm":{bytes:84160,sha256:"cb606310669a2a1d2f30b0903af51eae290a4276d2d934439999bfa10bdb5604",duration:1.6},"video/10001102.webm":{bytes:82257,sha256:"01cad0b39abfc2f041df3c1e786a11d3323cd25297fbebca2f196f8f556c8d82",duration:1.133},"video/10001103.webm":{bytes:91224,sha256:"106929efba101b9ae0f76b6b637cd4e16863bf9f72f779c2474d0d6cab4fc1fc",duration:1.166},"video/10001104.webm":{bytes:89745,sha256:"0862ade9ff0001d2cb5458e3cb6998a7ac42c2336840d73532f5492e522cbb34",duration:1.133},"video/10001105.webm":{bytes:93873,sha256:"0b03b634e18bb25087af672cee8e29df618540f3ac73761dae9a854a629dcfff",duration:1.133},"video/10001106.webm":{bytes:80898,sha256:"c25414e50001dd924e75c4b9aab2aa4fca72d1765bec268344e1541c9f9734ff",duration:10},"video/10001107.webm":{bytes:14411,sha256:"faa6ad2693c69433203864414e338b8d0f322096ff6b05b826787ec3a7bf7f57",duration:.8},"video/10001108.webm":{bytes:45841,sha256:"5e3c3dbbbd11985807452e9b02a69477d018b60dcf1598ed1deb21ec82bb4a50",duration:1.7},"video/10001109.webm":{bytes:53026,sha256:"2a0c537529b94d06bac852d498825b431a2830d944e8601e752b115b68d481ac",duration:1.666},"video/10001110.webm":{bytes:28873,sha256:"b1ec1a3d0d577270b1eb3fd1dcf2ddc36df9dcea52df0249b8440db3e0ec9b6f",duration:1.533},"video/10001111.webm":{bytes:15873,sha256:"74c62d1739cb80ecfbc66b755c7332a27a53b3ff3c6d72aa75d47804b211ad36",duration:.9},"video/10001112.webm":{bytes:17381,sha256:"e3c96e5b87f26c54347abcc591e241a78ae3ccccfc2eaa0bc447f1400410ed92",duration:.9},"video/10001113.webm":{bytes:28753,sha256:"1b16a8e140a6787675a0201e4ef4dea5633076d9494cdfb6f8c16c9b2507b8ea",duration:1.166},"video/10001114.webm":{bytes:111410,sha256:"13cd5f511962912110c6ac8d6ef7e39a823fcf48477762a18123080866b43138",duration:10},"video/10001115.webm":{bytes:43777,sha256:"0000583cb60ee7e8d562e13bbf5ddd7fc3fd8c9d93d2bcc7b96df9ab524f980e",duration:1.133},"video/10001116.webm":{bytes:87365,sha256:"d96dc3d3f552ca40e77ddd55b50da8c93a7bf34f53a6ecf01802751248f2189c",duration:10},"video/10001117.webm":{bytes:15087,sha256:"9e95f50d1385083834770fa0f09ffe79fa570e93def94b52a6a7a7e64f581a0b",duration:1.466},"video/10001118.webm":{bytes:74213,sha256:"4340b8ff11f8a3795d4d2fcd5c32d112ea4bb92153880f8b3eda34e15a82738d",duration:10},"video/10001119.webm":{bytes:26934,sha256:"244f12529343f2163be2b075dafc1907662ef53ab60c4ad081b8db9d81b4abc1",duration:10},"video/10001120.webm":{bytes:15909,sha256:"77c6308d62f016d2f6a0669f5c165efab2afff3d15611afb54965bc65e3ecca4",duration:1.566},"video/10001121.webm":{bytes:14072,sha256:"d5cc8215a5d4e8499f402cf5ad34e4ed958319a559c669aef9d5507be8f31d03",duration:1.333},"video/10001122.webm":{bytes:39768,sha256:"a0c0c537e22211affdafff6d4a42fee3b6fbe1d0fcdc17adbd5854b6395c9496",duration:2.6},"video/10001124.webm":{bytes:568780,sha256:"39b58e373aa854c91dfad8af90b3b84e9b04b7cde050388152622ac2c1f9c19b",duration:1.4},"video/10001125.webm":{bytes:179690,sha256:"42591454c30e14b1a65f5c7696516edf9e690002ca6fedf5a331e3fb39e13a83",duration:1.233},"video/10001126.webm":{bytes:243266,sha256:"faf35bae68aa35a358447c791c91808872921d4794f5c90e5763d692bd807a9f",duration:3.133},"video/10001127.webm":{bytes:208681,sha256:"42fecb16b110931f78c06d61d52374f5fa74fee60b1b37dcec4c608bf240adba",duration:3.066},"video/10001128.webm":{bytes:14331,sha256:"4a57b0082c4f32309eb212ebea0d1069efb87e4c3da4d65d556ca7d4cf397954",duration:1.966},"video/10001129.webm":{bytes:34019,sha256:"4bcab75c2f7ce6e2980b13fca3f8cb95bfb3bbb46396f52b0691a3b9499b2af9",duration:1.133},"video/10001130.webm":{bytes:10181,sha256:"f9e3bd1de752007281ab2d45fddc933b4709182a765e602879c3c9402dcebef2",duration:1.2},"video/10001131.webm":{bytes:168665,sha256:"275465192460a885a738b907be135e91be2546c9596cf0d0232ffea6d06065a5",duration:10},"video/10001132.webm":{bytes:97830,sha256:"4dbe1e8d33843f8360ad246082650ae7ebd0d66ce6b133e2f12f1d748719d13d",duration:10},"video/10001133.webm":{bytes:51508,sha256:"44b562df1ae76f3a1983447107aeeb00fb439afe3eb3e1d6a67a141467673aa1",duration:1.5},"video/10001134.webm":{bytes:36767,sha256:"adf67abc9bb2872b6aae897ecdaeb281384654e3066d03b07d6616a7393708a0",duration:2},"video/10001135.webm":{bytes:26042,sha256:"c2d6215296f9e200fc75c0d36f8523c4c5b24066a0e8eda2f01b6f5daa717bec",duration:2},"video/10001136.webm":{bytes:28762,sha256:"07d2d47eb8672b958f35fe6abe9ee2dae11db9a8846f1ac8d1e7206e466bf2db",duration:1.466},"video/10001137.webm":{bytes:151972,sha256:"f94c2f584f894e56def265d016e53ebf81473677633dfded66890fe6d3e2f175",duration:2.066},"video/10001138.webm":{bytes:68031,sha256:"43929724a51e2f99d9ebf5f7ffebc51ee90712b7520e213a9457bfcbb5f9a517",duration:2.033},"video/10001139.webm":{bytes:72750,sha256:"19d626334d981b16c00b4c5cc39ddab5bca75034f497f5345f18526e7fe25250",duration:2.033},"video/10001140.webm":{bytes:70456,sha256:"8cadee838df527fbe11b4e8fc5e3b7c784fad21f61c7c214ef7dffca72f0ef58",duration:2.033},"video/10001141.webm":{bytes:42664,sha256:"34f97de7d1dc183a5fb958305424f73ea6498254804c3ad669d44dc04bef939a",duration:2.033},"video/10001142.webm":{bytes:710423,sha256:"dd2aec022ab89b4e048b4e212216e5c0862b6c8be9899970d11b1d7a2267f9be",duration:3.8},"video/10001143.webm":{bytes:14487,sha256:"c393d0afa72faccf42aefb8cf946f08725dd76e28af2cb608049ae9416dc0887",duration:1.066},"video/10001144.webm":{bytes:13412,sha256:"47692e1e22510aef145080fcf1e42d6d4594cbc1ce3ca8dd89f247d7c59fd271",duration:2.233},"video/10001145.webm":{bytes:19632,sha256:"8fa9abcbc084f7952e2dd8b1ec325e676b78e2fd2be421aadbc83137463175f4",duration:2.266},"video/10001146.webm":{bytes:13723,sha256:"bda3925d9183b351f85c8152a9a2ca36ed994e6656fb210e08e2251df70c4ddd",duration:2.266},"video/10001147.webm":{bytes:23765,sha256:"566fafa5c585eb127bb81912324486a26c12db6bce8509763eb130ca1bf4be57",duration:10},"video/10001148.webm":{bytes:48537,sha256:"d7eb086bbe4e43d1733c4b7c4683248fc9686c0d2540b15b44030050415f18e7",duration:1.233},"video/10001149.webm":{bytes:56797,sha256:"a89363c03820728fe3041217caf3daa2c6b3b18c03a38478c9fbc38013df4874",duration:10},"video/10001150.webm":{bytes:71959,sha256:"33d5db768fc90f96ad2dd81fcaa2944ad721331fdba90ebbbc76abe9c9e622ad",duration:1.366},"video/10001151.webm":{bytes:70714,sha256:"f866a0e45980bbb029df58349d1401f259e79076e5a919584eebaea9b94d451b",duration:1.233},"video/10001152.webm":{bytes:1072305,sha256:"b9200f9b1dea6f7350dfaa0d1bc4eadcc4b4f0650fe190fe22ad25bc7e3a2b7e",duration:10},"video/10001153.webm":{bytes:37507,sha256:"add87a7074d611f312fe0c43a24ae18d774ff62a4cd24db69d2526fb7a2e1736",duration:1.2},"video/10001154.webm":{bytes:755336,sha256:"cae2ff5f2dc15d639a5ea411cab50a9bea03fad5f73116764945f6d012be74b6",duration:10},"video/10001155.webm":{bytes:28588,sha256:"ee157e4e1e8452bf7f1dbb32bb5509e9b8659edc5d1bb0bbba0b70af2e6c4328",duration:1.2},"video/10001156.webm":{bytes:21193,sha256:"2655315d0fa59d136b1a77e760a5b085aeaabfe70d1130ea17e937b037160afb",duration:1.2},"video/10001157.webm":{bytes:146426,sha256:"eb48647b768bf300429f157eb570b4c0d7c9d04bb3df53768e6875b91e51931d",duration:10},"video/10001158.webm":{bytes:231389,sha256:"8ea98583d1972f176e3354b6d7c116ac6b2689c1593b02ae4fea55774ca0bf8c",duration:10},"video/10001159.webm":{bytes:69087,sha256:"8b70a7eb8e83a9230bd3b7a658633c84037ed0667b0da87b78206f48ca2f487b",duration:10},"video/10001160.webm":{bytes:46691,sha256:"11698fa6b8a4f5ffd3f289e41266a7097f0e620bbb64359e97f1bcf7430731e4",duration:1},"video/10002001.webm":{bytes:543544,sha256:"6a3509a94437899e30846d0f701e0ae3ccfa82793f51d293ed507c8efaa67099",duration:10},"video/10002002.webm":{bytes:796059,sha256:"8cdab49708511f4d42d45fe0a319d2334e4e9aa42709e946c8d00a1ff77b07fd",duration:10},"video/10002003.webm":{bytes:715230,sha256:"6b5422c889243db499114370af5a260d624180fe17991445f7e3133eee619381",duration:10},"video/10002004.webm":{bytes:693595,sha256:"24aa66de5a0649c10652bb66b70a0407210e26e18a8d2d64b0610ca29fdfb02b",duration:10},"video/10002005.webm":{bytes:815174,sha256:"5ec0b1a66bf28c7bf0b2bc61a7bbbb374be18d4b1f338217ab3d84d88cd2838f",duration:10},"video/10002006.webm":{bytes:194930,sha256:"7ef8f4e4a5ea4430ea4910b06f0dc00c71d61ed9bd54e03b4a268a4d1f3e7525",duration:1.9},"video/10002007.webm":{bytes:93264,sha256:"cbdc07ca88626c73d074eae923aac8972ce8898fd331fecb40cbb22392d32e6a",duration:2.4},"video/10002008.webm":{bytes:669120,sha256:"9299206b7cdc7fc4f319864e425be91f90b4721bcd8555f56ead4dc45f776b27",duration:3.433},"video/10002009.webm":{bytes:434158,sha256:"3db3a361cf11e9ee543dff860ba8a7aef3831d920e1e95fb6773a13f15f7ff6a",duration:10},"video/10002010.webm":{bytes:161424,sha256:"3b6e41d32df6eca2645978e8ba0f13a4aef69aa8217d38e85e5b8db058016a9a",duration:2.5},"video/10002011.webm":{bytes:73568,sha256:"86966a56aef3a2a6a263526d1efa0092044b48ce26f7f076c5bdd259131a8121",duration:1.8},"video/10002012.webm":{bytes:187942,sha256:"2b3e1b9538ddaeb62adeae52b9ea0ab38801430c76bab0f6425da9e127e0d896",duration:2.933},"video/10002013.webm":{bytes:482076,sha256:"14b90e097eebe09d3337afb0867da590081f111b5593d601963dcccf39638a4e",duration:3.9},"video/10002014.webm":{bytes:1475640,sha256:"f81e417888b1a833e254cf069f33a5ff1820bfc1599ac0f86d67a3cea44cad78",duration:10},"video/10002015.webm":{bytes:2392745,sha256:"db572d1dd4f090a104cdeea17a84aaa94c5800820ec66168ccd2eb99cb05d867",duration:10},"video/10002016.webm":{bytes:178656,sha256:"aa5dfb8ef461f168b2b64790b90f5a0e847b2a02aa3964e35a1734b37f0b69dc",duration:2.5},"video/10002017.webm":{bytes:80715,sha256:"addc2369f55de0a067937f48f40f300d123c320efc9c03ff3be6ea922581b575",duration:.733},"video/10002018.webm":{bytes:790722,sha256:"1d8d5b69fe0a5949566c216eac072f739ee0be9d0ac7ad85a809db6fe4da14c5",duration:10},"video/10002019.webm":{bytes:115786,sha256:"1a4a39ff5bd9dd26bfda75176469acca6a2aace830961c3a5e5dc164bcc1ac64",duration:2.2},"video/10002020.webm":{bytes:581822,sha256:"2ce9a04ffb641ef53d0090a22dcb394f580475c41052c5dea83ceed1dffbcd69",duration:10},"video/10002021.webm":{bytes:568208,sha256:"b3aa5b1f712c379a80767d599059adcb482bb8cd2c0f07c404b6fd862c8d7e9b",duration:10},"video/10002022.webm":{bytes:610636,sha256:"8c2663f7c031328ef06dc59aa0c0a11f5e7708b3981b4399d8bfd609573e986f",duration:10},"video/10002023.webm":{bytes:612556,sha256:"79a90a1d7d5f6a2b9a1e81738e12566f14ce96f99fa81ca102aab157b4b2664f",duration:10},"video/10002024.webm":{bytes:1453404,sha256:"7e5412973270e8e58a539c9f83304b4cd07a0faa740a4752b982333e380a1d55",duration:3.4},"video/10002025.webm":{bytes:1544749,sha256:"63af745659c7063ba0d7fff63af97eaf8972c2a5a06cd6739ad518cd4187b153",duration:10},"video/10002026.webm":{bytes:280741,sha256:"cf701673766d966c3b522749ba169622c98261501be50bb3afee3c998898486e",duration:10},"video/10002027.webm":{bytes:327918,sha256:"d59447600017e11aa42fc342833fad186af9f9d1670aba32f922d77fca63d6c6",duration:10},"video/10002028.webm":{bytes:336612,sha256:"827a91d60bf0fa75a131853e0f1fda8855cf2cfdf9b06194d195833bda026986",duration:10},"video/10002029.webm":{bytes:700863,sha256:"1a8ad0969222629d8fd89bafb174df58082aaa50755e3843ca82ad953b18e0aa",duration:10},"video/10002030.webm":{bytes:34533,sha256:"f4080af95380d8f640133b255bbe2b25b03180a3cfcd99aed1f281265c6f18cb",duration:1.966},"video/10002031.webm":{bytes:187567,sha256:"8bbdc15b123c3ac7f3cba16b04ca18571996e6556f190edd4f13d6a50ecd8c0c",duration:1.166},"video/10002032.webm":{bytes:1776997,sha256:"e3b15a717b1db503bd3d838ed9b6fdb70def2fcb4b47f51db24eb86fc03e7923",duration:10},"video/10002033.webm":{bytes:297716,sha256:"425cd20f5a5038f720e0f3c4dd65ab58c6c5ad80aa346b6c9035eb0700e69d3e",duration:2},"video/10002034.webm":{bytes:2495666,sha256:"70f377770e704850e9a2eff20fa283cbae7939fd42b66b85110b9b6eb1aa2add",duration:10},"video/10002035.webm":{bytes:183443,sha256:"a631becd1c4585ec80d91b435a5c6cda28b6b2033f2eb62f929a7580ad2ffbad",duration:10},"video/10002036.webm":{bytes:89987,sha256:"5b523e749db42145e8f3947e86d6e8d9683300b737f7775477cd94f02c1c8004",duration:10},"video/10002037.webm":{bytes:823633,sha256:"a4e7ba6ce6a6a43c31597d6b6430e86c507ab45a89910eb5010f1d058901f539",duration:10}}};var Zs="https://oss.070077.xyz/uivfx/",lr=$i.version,$n="/qxqy-vfx/",q0=Object.freeze($i.assets.map(Object.freeze)),J0=new Map(q0.map(e=>[e.id,e]));function ec(e,t="animation"){let i=J0.get(Number(e));return i?.scope===(t==="fullscreen"?"screen":"ui")?i:null}function Dn(e){return Object.hasOwn($i.files,e)?$i.files[e]:null}import{randomUUID as ac}from"node:crypto";function Vn(e){for(let t of e.runtime.scrollControls||[]){let[i,n]=ki(t),a=t.kind==="grid"?Qt(t):Js(t,i,n),r={offset:a.offset,max:a.max,horizontal:a.horizontal,showBar:t.showScrollBar!==!1,textWidth:a.textWidth??0,lines:a.lines||[],lineHeight:a.lineHeight||0,contentLength:a.length,...t.kind==="textwindow"?{fontSize:a.fontSize}:{}},o=JSON.stringify(r);t._scrollKey!==o&&(t._scrollKey=o,t._scroll=r,t.markPlayDirty())}}function rc(e){return{...e._scroll?{scroll:e._scroll}:{},...e.parent?._gridItems?.includes(e)?{clipToParent:!0}:{}}}function dr(e,t){let i=e._scroll?.max||0;e.kind==="grid"?e.scrollProgress=i?Nn(t,i)/i:0:e._scrollOffset=Nn(t,i),e.markPlayDirty()}var Q0=Object.freeze(Object.values(J).map(e=>Object.freeze({id:e.id,label:e.label,platform:e.platform,width:e.width,height:e.height})));function Gi(e){Vn(e);let t=ve({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),i=new Map;function n(a,r,o){let s=Ke(r,a);s.activeInHierarchy=o&&a.active!==!1,i.set(a.Id,s);let c=s.activeInHierarchy;for(let l of a.children)n(l,s,c)}for(let a of e.runtime.roots)n(a,t,!0);return i}function pr(e,t=Gi(e)){let i=new Map;function n(a,r){let o=t.get(a.Id);if(!o)return;let s=wi(r,o,a);i.set(a.Id,s);for(let c of a.children)n(c,s)}for(let a of e.runtime.roots)n(a,Ut());return i}function oc(e,t){let i=t.get(e.Id);return{id:e.Id,prefabId:e.prefabIndex,authoringId:e.authoringId,name:e.name,kind:e.kind,typeofName:e.typeofName,instantiated:!e.authoringId,active:!!e.active,visible:!!e.visible,activeInHierarchy:!!i?.activeInHierarchy,raycastTarget:e.raycastTarget!==!1,interactable:e.interactable!==!1,pressed:e.pressed===!0,...e._scroll?{scrollOffset:e._scroll.offset,scrollMax:e._scroll.max}:{},...e.kind==="grid"?{itemCount:e.itemCount,scrollProgress:e.scrollProgress}:{},anchoredPositionX:e.anchoredPositionX,anchoredPositionY:e.anchoredPositionY,sizeDeltaX:e.sizeDeltaX,sizeDeltaY:e.sizeDeltaY,localScaleX:e.localScaleX,localScaleY:e.localScaleY,localScaleZ:e.localScaleZ,localRotationZ:e.localRotationZ,text:e.kind==="textbox"||e.kind==="textwindow"?e.text??"":null,fontSize:e.kind==="textbox"||e.kind==="textwindow"?e.fontSize:null,adaptiveFontSize:e.kind==="textbox"||e.kind==="textwindow"?e.adaptiveFontSize===!0:null,minimumFontSize:e.kind==="textbox"||e.kind==="textwindow"?e.minimumFontSize:null,fontColor:e.kind==="textbox"||e.kind==="textwindow"?e.fontColor:null,bgColor:e.kind==="textbox"||e.kind==="textwindow"?e.bgColor:null,enableOutline:e.kind==="textbox"||e.kind==="textwindow"?e.enableOutline===!0:null,outlineColor:e.kind==="textbox"||e.kind==="textwindow"?e.outlineColor:null,imageId:e.kind==="image"?e.imageId??0:null,imageSource:e.kind==="image"?Ae(e.imageSource):null,imageType:e.kind==="image"?e.imageType==null?null:Ne(e.imageType):null,primitive:e.kind==="image"?Ht(e.imageId,e.imageSource):null,imageColor:e.kind==="image"?e.imageColor:null,enableMask:e.kind==="image"?e.enableMask===!0:null,enableSoftEdge:e.kind==="image"?e.enableSoftEdge===!0:null,softEdgeMode:e.kind==="image"?e.softEdgeMode:null,softEdgeWidthX:e.kind==="image"?e.softEdgeWidthX:null,softEdgeWidthY:e.kind==="image"?e.softEdgeWidthY:null,horizontalSoftRange:e.kind==="image"?e.horizontalSoftRange:null,verticalSoftRange:e.kind==="image"?e.verticalSoftRange:null,enableFill:e.kind==="image"?e.enableFill===!0:null,fillType:e.kind==="image"?e.fillType:null,fillHorizontalType:e.kind==="image"?e.fillHorizontalType:null,fillVerticalType:e.kind==="image"?e.fillVerticalType:null,fillRadial90Type:e.kind==="image"?e.fillRadial90Type:null,fillRadialType:e.kind==="image"?e.fillRadialType:null,reverseMaskArea:e.kind==="image"?e.reverseMaskArea===!0:null,fillAmount:e.kind==="image"?e.fillAmount:null,box:i?{left:i.left,bottom:i.bottom,width:i.width,height:i.height}:null,children:e.children.map(n=>oc(n,t))}}function Z0(){return{pointerDownControl:null,pointerDownPosition:null,pointerLastPosition:null,pointerDragging:!1,pointerHoverControl:null,pointerScroll:null,hoveredControl:null,selectedControl:null,stateRestores:new Map,viewCache:null}}function ef(e,t,i,n){let a=Ti({canvasWidth:e.canvasWidth,canvasHeight:e.canvasHeight,device:e.device,audioDuration:On,canSelectImageType:oo,...n?{language:n}:{}});for(let r of[...e.templates||[],...t?.templates||[]])Number.isSafeInteger(r.prefabIndex)&&r.prefabIndex>0&&a.registerTemplate(r.prefabIndex,r);for(let r of i){let o=r.path||r.id,s=r.source||"";o&&s&&a.registerScriptFile(o,s)}return a}var tf=["pointerDownControl","pointerDownPosition","pointerLastPosition","pointerDragging","pointerHoverControl","pointerScroll","hoveredControl","selectedControl","stateRestores","viewCache"];function nf(e){Object.defineProperty(e,"runtime",{configurable:!0,enumerable:!0,get(){return e.runtimes[e.viewPlayerIndex-1]}});for(let t of tf)Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){return e.views[e.viewPlayerIndex-1][t]},set(i){e.views[e.viewPlayerIndex-1][t]=i}})}function sc(e,{templatesProject:t=null,scripts:i=[],sceneScripts:n=null,templateScripts:a=null,serverConfig:r=null,canvasId:o="",playerCount:s=1,viewPlayerIndex:c=1,language:l=""}={}){let d=n||i,f=a||i,h=rr(e,d,o),m=t?rr(t,f,o):null,p=_t(s),b=nt(c,p),v=Xs({playerCount:p,viewPlayerIndex:b});r&&v.loadConfig({...r,playerCount:p,viewPlayerIndex:b});let y=[];for(let T=0;T<p;T+=1)y.push(ef(h,m,i,l));v.attachRuntimes(y);for(let T of y)T.addRoot(h.root);let w={audioSessionId:ac(),runtimes:y,views:y.map(()=>Z0()),playerCount:p,viewPlayerIndex:b,server:v,compiled:h,mountError:y.find(T=>T.mountErrors[0])?.mountErrors[0]||null,debugPaused:!1,history:{events:[]},recording:!0};nf(w);let _=w.viewPlayerIndex;for(let T=1;T<=p;T+=1)w.viewPlayerIndex=T,pf(w);return w.viewPlayerIndex=_,w}function br(e,t){if(!e)throw new Error("play session has not started");let i=nt(t,e.playerCount);return i===e.viewPlayerIndex||(ht(e,{kind:"view",payload:{playerIndex:i}}),e.viewPlayerIndex=i,e.viewCache=null,e.server&&e.server.setViewPlayerIndex(i)),i}function ht(e,t){!e?.recording||!e.history||qs(e.history,{...t,source:t.source||"user"},e.runtime.clock.time)}function af(e){return e?.history?.events||[]}var gr=new Set(["image","textbox","textwindow","button","grid"]);function rf(e,t){let i=Ie(t,e.centerX,e.centerY);return{centerX:i.x,centerY:i.y,scaleX:Math.hypot(t.a,t.b),scaleY:Math.hypot(t.c,t.d),rotationZ:Math.atan2(t.b,t.a)*180/Math.PI,matrix:{a:t.a,b:t.b,c:t.c,d:t.d,tx:i.x,ty:i.y}}}function Ne(e){return typeof e=="string"?e:e?.Name}function cc(e){return{fillType:Ne(e.fillType),fillHorizontalType:Ne(e.fillHorizontalType),fillVerticalType:Ne(e.fillVerticalType),fillAmount:e.fillAmount}}function of(e,t,i){let n=Math.abs(t.width*i.scaleX),a=Math.abs(t.height*i.scaleY),r={id:e.Id,kind:e.kind,name:e.name,left:i.centerX-n/2,bottom:i.centerY-a/2,width:n,height:a,sourceWidth:t.width,sourceHeight:t.height,rotationZ:i.rotationZ,matrix:i.matrix,pressed:e.pressed===!0,...rc(e)};return e.kind==="image"&&(r.imageSource=Ae(e.imageSource),r.imageType=e.imageType==null?null:Ne(e.imageType),r.primitive=Ht(e.imageId,r.imageSource),r.imageColor=e.imageColor,r.imageId=e.imageId,Object.assign(r,cc(e))),(e.kind==="textbox"||e.kind==="textwindow")&&(r.text=e.text??"",r.fontSize=e.fontSize,r.adaptiveFontSize=e.adaptiveFontSize===!0,r.minimumFontSize=e.minimumFontSize,r.textLayout=et(e,t.width,t.height),r.fontColor=e.fontColor,r.bgColor=e.bgColor,r.enableOutline=e.enableOutline===!0,r.outlineColor=e.outlineColor,r.horizontalAlignment=Ne(e.horizontalAlignment),r.verticalAlignment=Ne(e.verticalAlignment)),r}function sf(e,t=Gi(e)){let i=[],n=pr(e,t);function a(r,o=[],s=[]){let c=t.get(r.Id);if(!c||r.visible===!1||!c.activeInHierarchy)return;let l=n.get(r.Id);if(!l)return;let d=rf(c,l),f=r.kind==="image"&&r.enableMask===!0?xt({...lc(r,c),id:r.Id},Et(l,c.centerX,c.centerY)):null,h=f?[...s,f]:s,m=()=>i.push({...of(r,c,d),...o.length?{clipPolygons:o}:{},...h.length?{masks:h}:{}});gr.has(r.kind)&&r.kind!=="grid"&&m();let p=r.children||[];for(let b=p.length-1;b>=0;b-=1){let v=r._gridItems?.includes(p[b])?[...o,[[c.left,c.bottom],[c.right,c.bottom],[c.right,c.top],[c.left,c.top]].map(([y,w])=>Ie(l,y,w))]:o;a(p[b],v,h)}r.kind==="grid"&&m()}for(let r of e.runtime.roots)a(r);return i}function lc(e,t){let i={kind:e.kind,name:e.name,sourceWidth:t.width,sourceHeight:t.height,pressed:e.pressed===!0,...rc(e)};return e.kind==="image"&&(i.imageSource=Ae(e.imageSource),i.imageType=e.imageType==null?null:Ne(e.imageType),i.primitive=Ht(e.imageId,i.imageSource),i.imageColor=e.imageColor,i.imageId=e.imageId,Object.assign(i,cc(e),{enableMask:e.enableMask===!0,enableSoftEdge:e.enableSoftEdge===!0,softEdgeMode:Ne(e.softEdgeMode)||"Percentage",softEdgeWidthX:e.softEdgeWidthX,softEdgeWidthY:e.softEdgeWidthY})),(e.kind==="textbox"||e.kind==="textwindow")&&(i.text=e.text??"",i.fontSize=e.fontSize,i.adaptiveFontSize=e.adaptiveFontSize===!0,i.minimumFontSize=e.minimumFontSize,i.textLayout=et(e,t.width,t.height),i.fontColor=e.fontColor,i.bgColor=e.bgColor,i.enableOutline=e.enableOutline===!0,i.outlineColor=e.outlineColor,i.horizontalAlignment=Ne(e.horizontalAlignment),i.verticalAlignment=Ne(e.verticalAlignment)),i}function cf(e,t,i){let n=la(e,t),a=Ie(n,e.centerX,e.centerY);return{a:n.a,b:n.b,c:n.c,d:n.d,tx:a.x-(i?i.centerX:0),ty:a.y-(i?i.centerY:0)}}function dc(e){let t=e.matrix;return[e.parent,e.z,e.group?1:0,t.a,t.b,t.c,t.d,t.tx,t.ty,e.kind,e.name,e.sourceWidth,e.sourceHeight,e.pressed,e.primitive,e.imageColor,e.imageId,e.imageSource,e.imageType,e.fillType,e.fillHorizontalType,e.fillVerticalType,e.fillAmount,e.enableMask,e.enableSoftEdge,e.softEdgeMode,e.softEdgeWidthX,e.softEdgeWidthY,e.text,e.fontSize,e.fontColor,e.bgColor,e.adaptiveFontSize,e.minimumFontSize,JSON.stringify(e.textLayout),e.enableOutline,e.outlineColor,e.horizontalAlignment,e.verticalAlignment,JSON.stringify(e.scroll),e.clipToParent].join(" ")}function fc(e,t,i,n,a,r){return{id:e.Id,parent:t,z:a,group:r>=16,matrix:cf(n,e,i),...lc(e,n)}}function lf(e){let t=ve({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),i=new Set,n=new Map,a=new Map;function r(c,l,d){let f=Ke(l,c);if(f.activeInHierarchy=d&&c.active!==!1,a.set(c.Id,f),c.visible===!1||!f.activeInHierarchy)return!1;let h=c.children||[],m=gr.has(c.kind),p=0;for(let b=0;b<h.length;b+=1)r(h[b],f,f.activeInHierarchy)&&(m=!0,p+=1);return m?(i.add(c.Id),n.set(c.Id,p),!0):!1}function o(c,l,d,f){if(!i.has(c.Id))return;let h=a.get(c.Id);s.push(fc(c,l,d,h,f,n.get(c.Id)||0));let m=c.children||[];for(let p=0;p<m.length;p+=1)o(m[p],c.Id,h,p)}let s=[];for(let c=0;c<e.runtime.roots.length;c+=1)r(e.runtime.roots[c],t,!0),o(e.runtime.roots[c],null,null,c);return{nodes:s,childCounts:n}}function ur(e){let t=e._playChildDirty===!0||e._playDeepDirty===!0;if(e._playDirty=!1,e._playChildDirty=!1,e._playDeepDirty=!1,!t)return;let i=e.children;for(let n=0;n<i.length;n+=1)ur(i[n])}function df(e,t){let i=ve({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),n=[],a=[],r=t.count,o=e.runtime._playRemoved||[];for(let l=0;l<o.length;l+=1){let d=o[l];t.fingerprints.has(d)&&(a.push(d),t.fingerprints.delete(d),t.childCounts.delete(d),r-=1)}e.runtime._playRemoved=[];function s(l){t.fingerprints.has(l.Id)&&(a.push(l.Id),t.fingerprints.delete(l.Id),t.childCounts.delete(l.Id),r-=1);let d=l.children;for(let f=0;f<d.length;f+=1)s(d[f])}function c(l,d,f,h,m,p){let b=p||l._playDeepDirty===!0,v=b||l._playDirty===!0,y=b||l._playChildDirty===!0;if(!v&&!y)return;if(!(m&&l.active!==!1)||l.visible===!1){s(l);return}let _=Ke(d,l),T=t.childCounts.get(l.Id)||0;if(y){T=0;let A=l.children;for(let E=0;E<A.length;E+=1)c(A[E],_,l.Id,E,!0,b),t.fingerprints.has(A[E].Id)&&(T+=1)}if(!(gr.has(l.kind)||T>0)){t.fingerprints.has(l.Id)&&(a.push(l.Id),t.fingerprints.delete(l.Id),t.childCounts.delete(l.Id),r-=1);return}let O=t.childCounts.get(l.Id);t.childCounts.set(l.Id,T);let V=T>=16!=(O||0)>=16;if(!v&&!V&&t.fingerprints.has(l.Id))return;let $=fc(l,f,d===i?null:d,_,h,T),S=dc($);t.fingerprints.get($.id)!==S&&(t.fingerprints.has($.id)||(r+=1),t.fingerprints.set($.id,S),n.push($))}for(let l=0;l<e.runtime.roots.length;l+=1)c(e.runtime.roots[l],i,null,l,!0,!1);return t.count=r,{changed:n,removed:a,count:r}}function ff(e,t){let i=e.viewCache||(e.viewCache={rev:0,fingerprints:new Map,childCounts:new Map,count:0}),n=Number(t);if(!(Number.isFinite(n)&&n===i.rev&&i.fingerprints.size>0)){let{nodes:c,childCounts:l}=lf(e);i.rev+=1,i.fingerprints=new Map(c.map(d=>[d.id,dc(d)])),i.childCounts=l,i.count=c.length;for(let d of e.runtime.roots)ur(d);return{format:"tree-v1",revision:i.rev,reset:!0,count:c.length,nodes:c}}let{changed:r,removed:o,count:s}=df(e,i);i.rev+=1;for(let c of e.runtime.roots)ur(c);return{format:"tree-v1",revision:i.rev,reset:!1,count:s,changed:r,removed:o}}function yr(e,{inspect:t=!1,view:i=!1,paint:n=!1,sceneRev:a,compact:r=!1}={}){Vn(e),e.audioSessionId||=ac();let o=e.runtime,s=e.compiled,[c,l]=[o.canvasWidth,o.canvasHeight];e.server&&e.server.setClock(o.clock.time);let d=r?o.logs.slice(-100):o.logs,f=af(e),h=e.server?e.server.snapshot():{vars:{},inbound:[],outbound:[],logs:[]};r&&(h.inbound=h.inbound.slice(-100),h.outbound=h.outbound.slice(-100),h.logs=h.logs.slice(-100));let m={canvasId:s.canvasId,platform:s.platform,device:o.device,canvasWidth:c,canvasHeight:l,canvasPresets:Q0,playerCount:e.playerCount||1,viewPlayerIndex:e.viewPlayerIndex||1,players:Array.from({length:e.playerCount||1},(p,b)=>({index:b+1,label:`\u73A9\u5BB6${b+1}`,entityType:`Player${b+1}`})),time:o.clock.time,frame:o.clock.frame,paused:!!e.debugPaused,levelTimePaused:!!o.clock.paused,audio:{sessionId:e.audioSessionId,playerIndex:e.viewPlayerIndex||1,...o.audioSnapshot()},effects:uf(e),mountError:e.mountError||o.mountErrors[0]||null,logs:d.map(p=>({source:"client",level:p.level,text:p.text,time:p.time})),tree:[],paint:[],scene:null,server:h,history:(r?f.slice(-100):f).map(p=>({t:p.t,source:p.source||"user",kind:p.kind,payload:p.payload||{}}))};if(t||n){let p=Gi(e);t&&(m.tree=o.roots.map(b=>oc(b,p))),n&&(m.paint=sf(e,p))}return i&&(m.scene=ff(e,a)),Lt(m),m}function uf(e){let t=o=>o._uiAnimation?.playing&&o.animationId!=null&&String(o.animationId).trim()!==""&&Number(o.animationId)!==0;if(![...e.runtime.uiAnimations||[]].some(t))return[];let i=Gi(e),n=pr(e,i),a=[],r=(o,s=[])=>{let c=i.get(o.Id),l=n.get(o.Id);if(!c||!l||!c.activeInHierarchy||o.visible===!1)return;let d=o.kind==="image"&&o.enableMask===!0?xt({...o,id:o.Id,sourceWidth:c.width,sourceHeight:c.height},Et(l,c.centerX,c.centerY)):null,f=d?[...s,d]:s,h=o._uiAnimation;if(t(o)){let m=ec(o.animationId,o.kind),p=m?.audio.length?m.audio[(o.Id+h.generation-1)%m.audio.length]:null;a.push({id:o.Id,kind:o.kind,animationId:o.animationId??null,generation:h.generation,startedAt:h.startedAt,playSoundEffect:o.playSoundEffect!==!1,audioPath:p,layer:o.kind==="fullscreen"?"BelowAllControls":Ne(o.layer)||"AboveAllControls",matrix:Et(l,c.centerX,c.centerY),masks:f})}for(let m of[...o.children].reverse()){let p=o._gridItems?.includes(m)?{id:`viewport:${o.Id}`,matrix:Et(l,c.centerX,c.centerY),width:c.width,height:c.height,featherX:0,featherY:0}:null;r(m,p?[...f,p]:f)}};for(let o of e.runtime.roots)r(o);return a}function Bn(e,t=1/30){let i=e.runtimes||(e.runtime?[e.runtime]:[]);for(let n of i)n.step(t);e.server&&(e.server.setClock(e.runtime.clock.time),e.server.flush())}function wr(e,t){ht(e,{kind:"key",payload:{typeName:String(t)}}),e.runtime.injectKey(t)}function hf(e,t){let i=null;for(let n of e.runtime.roots)Ye(n,a=>{!i&&a.name===t&&(i=a)});return i}function vr(e,t){ht(e,{kind:"click",payload:{name:String(t)}});let i=hf(e,t);i&&Sr(i)&&(i.kind==="button"||i.kind==="cursor")&&i.SimulateCursorClick()}function mf(e,t){return!e||!t?null:e.children.find(i=>i.authoringId===t||i.Id===t)||null}var uc={unavailable:"unavailableChildId",hover:"hoverChildId",pressed:"pressedChildId",selected:"selectedChildId"};function hc(e,t){let i=[];for(let[n,a]of Object.entries(uc)){let r=t[a]?mf(t,t[a]):null;r&&i.push({state:n,child:r})}return i}function pf(e){for(let t of e.runtime.roots)Ye(t,i=>{if(i.kind==="button"){for(let{child:n}of hc(e,i))e.stateRestores.has(n.Id)||e.stateRestores.set(n.Id,{child:n,active:n.active,visible:n.visible}),n.active=!0,n.visible=!1,typeof n.markPlayDirty=="function"&&n.markPlayDirty(!0);Di(e,i)}})}function Di(e,t){if(!t||t.kind!=="button")return;let i=null;t.interactable===!1?i="unavailable":t.pressed===!0?i="pressed":e.hoveredControl===t?i="hover":e.selectedControl===t&&(i="selected");for(let n of hc(e,t))n.child.active=!0,n.child.visible=n.state===i,typeof n.child.markPlayDirty=="function"&&n.child.markPlayDirty(!0)}function fr(e){if(!e)return null;let t=e.parent;return t?.kind==="button"&&Object.values(uc).map(n=>t[n]).filter(Boolean).includes(e.authoringId)?t:e}function Sr(e){return e.kind==="button"?e.raycastTarget!==!1&&e.interactable!==!1:e.kind==="cursor"||e.kind==="grid"?e.raycastTarget!==!1:e.kind==="textwindow"?e.interactable!==!1:e.raycastTarget===!0}function hr(e){return e.kind==="container"||e.kind==="grid"||e.kind==="textwindow"||e.kind==="reference"||e.kind==="button"}function bf(e){return e.kind==="grid"||e.kind==="textwindow"}function mc(e,t){let i=e.Id,n=t.get(i);if(n!==void 0)return n;let a=Sr(e);if(!a&&hr(e)){let r=e.children;for(let o=0;o<r.length;o+=1)if(mc(r[o],t)){a=!0;break}}return t.set(i,a),a}function zn(e,t,i){Vn(e);let n=ve({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),a=new Map;function r(s,c,l,d){if(!d||s.active===!1||s.visible===!1||!mc(s,a))return null;let f=Ke(c,s),h=wi(l,f,s),m=qe(h);if(!m)return null;let p=Ie(m,t,i),b=p.x>=f.left&&p.x<=f.right&&p.y>=f.bottom&&p.y<=f.top;if(!b&&(!hr(s)||bf(s)))return null;if(b&&Gn(s)){let v=ii(s._scroll,f.width,f.height)?.track,y=p.x-f.centerX,w=f.centerY-p.y;if(v&&y>=v.x&&y<=v.x+v.width&&w>=v.y&&w<=v.y+v.height)return s}if(hr(s))for(let v=0;v<s.children.length;v+=1){let y=r(s.children[v],f,h,!0);if(y)return y}return b&&Sr(s)?s:null}let o=Ut();for(let s=e.runtime.roots.length-1;s>=0;s-=1){let c=r(e.runtime.roots[s],n,o,!0);if(c)return c}return null}function ni(e,t,i,{dragging:n=!1,press:a=null,previous:r=null}={}){let o=a||{x:t,y:i},s=r||{x:t,y:i};return e.runtime.makeCursorEventData({x:t,y:i,pressX:o.x,pressY:o.y,deltaX:t-s.x,deltaY:i-s.y,dragging:n})}function mr(e,t,i){t.kind==="grid"||t.kind==="textwindow"||(t.pressed=i,typeof t.markPlayDirty=="function"&&t.markPlayDirty(),Di(e,t))}function Gn(e){if(!e?.alive||!e.activeInHierarchy||e.interactable===!1||e.raycastTarget===!1)return!1;for(let t=e;t;t=t.parent)if(t.visible===!1)return!1;return e._scroll?.max>0}function tc(e){for(let t=e;t;t=t.parent)if(Gn(t))return t;return null}function ic(e,t,i,n){let a=Gi(e),r=a.get(t.Id),o=pr(e,a).get(t.Id),s=o&&qe(o);if(!r||!s)return null;let c=Ie(s,i,n);return{x:c.x-r.centerX,y:r.centerY-c.y,width:r.width,height:r.height}}function nc(e,t,i){let n=e.pointerDownControl;if(n?.alive){let a=ni(e,t,i,{dragging:e.pointerDragging,press:e.pointerDownPosition,previous:e.pointerLastPosition});e.runtime.injectCursor(n,"CursorUp",a),e.pointerDragging&&!e.pointerScroll&&e.runtime.injectCursor(n,"CursorEndDrag",a),mr(e,n,!1)}e.pointerDownControl=null,e.pointerScroll=null,e.pointerDownPosition=null,e.pointerDragging=!1,e.pointerLastPosition={x:t,y:i}}function zi(e,t,i,n,a={}){let r=Number(i),o=Number(n);if(!Number.isFinite(r)||!Number.isFinite(o))throw new Error("pointer coordinates must be finite");e.runtime.cursor.x=r,e.runtime.cursor.y=o;let s=Number(a.deltaX??0),c=Number(a.deltaY??0);if(t==="wheel"&&(!Number.isFinite(s)||!Number.isFinite(c)))throw new Error("wheel deltas must be finite");if(a.silent||ht(e,{kind:"pointer",payload:{type:t,x:r,y:o,...t==="wheel"?{deltaX:s,deltaY:c}:{}}}),t==="wheel"){let l=zn(e,r,o),d=tc(l);if(d){let f=d._scroll.horizontal&&s||c;dr(d,d._scroll.offset+f)}return l}if(t==="cancel")return nc(e,r,o),null;if((t==="move"||t==="up")&&e.pointerScroll&&!Gn(e.pointerScroll.control)&&nc(e,r,o),t==="move"){let l=e.pointerLastPosition||{x:r,y:o},d=e.pointerHoverControl,f=fr(zn(e,r,o)),h=ni(e,r,o,{previous:l});d&&d!==f&&e.runtime.injectCursor(d,"CursorExit",h),f&&d!==f&&e.runtime.injectCursor(f,"CursorEnter",h),e.pointerHoverControl=f;let m=e.hoveredControl;e.hoveredControl=f?.kind==="button"?f:null,m&&m!==e.hoveredControl&&Di(e,m),e.hoveredControl&&Di(e,e.hoveredControl);let p=e.pointerDownControl,b=e.pointerScroll;if(b)if(!Gn(b.control))e.pointerScroll=null;else{let v=ic(e,b.control,r,o);if(v){let y=b.control._scroll,w=y.horizontal?v.x-b.start.x:v.y-b.start.y,_=ii(y,v.width,v.height)?.travel||0,T=b.bar?_?w*y.max/_:0:-w;dr(b.control,b.offset+T)}}if(p?.alive){let v=e.pointerDownPosition||l,y=Math.hypot(r-v.x,o-v.y)>5;!e.pointerDragging&&y&&(b||e.runtime.injectCursor(p,"CursorBeginDrag",ni(e,r,o,{press:v,previous:l,dragging:!1})),e.pointerDragging=!0),e.pointerDragging&&!b&&e.runtime.injectCursor(p,"CursorDrag",ni(e,r,o,{press:v,previous:l,dragging:!0}))}return e.pointerLastPosition={x:r,y:o},f}if(t==="down"){let l=fr(zn(e,r,o));e.pointerDownControl=l,e.pointerDownPosition={x:r,y:o},e.pointerLastPosition={x:r,y:o},e.pointerDragging=!1,e.pointerScroll=null;let d=tc(l);if(d){let f=ic(e,d,r,o),h=f&&ii(d._scroll,f.width,f.height),m=b=>f.x>=b.x&&f.x<=b.x+b.width&&f.y>=b.y&&f.y<=b.y+b.height,p=h&&m(h.track);if(p&&!m(h.thumb)){let b=d._scroll.horizontal?f.x-h.track.x-h.thumb.width/2:f.y-h.track.y-h.thumb.height/2;dr(d,h.travel?b/h.travel*d._scroll.max:0),Vn(e)}f&&(e.pointerScroll={control:d,start:f,offset:d._scroll.offset,bar:!!p})}return l&&(mr(e,l,!0),e.runtime.injectCursor(l,"CursorDown",ni(e,r,o))),l}if(t==="up"){let l=e.pointerDownControl,d=fr(zn(e,r,o));if(l?.alive){let f=ni(e,r,o,{press:e.pointerDownPosition,previous:e.pointerLastPosition,dragging:e.pointerDragging});if(e.runtime.injectCursor(l,"CursorUp",f),e.pointerDragging)e.pointerScroll||e.runtime.injectCursor(l,"CursorEndDrag",f);else if(d===l&&!e.pointerScroll?.bar){e.runtime.injectCursor(l,"CursorClick",f);let h=e.selectedControl;e.selectedControl=l.kind==="button"?l:null,h&&h!==e.selectedControl&&Di(e,h)}mr(e,l,!1)}return e.pointerDownControl=null,e.pointerDownPosition=null,e.pointerLastPosition={x:r,y:o},e.pointerDragging=!1,e.pointerScroll=null,d}if(t==="click")return zi(e,"down",r,o,{silent:!0}),zi(e,"up",r,o,{silent:!0});throw new Error(`unknown pointer type ${t}`)}function xr(e,t,i,n){if(!e?.server)throw new Error("play session has no server");return ht(e,{kind:"serverSet",payload:{entityType:t,name:i,value:n,playerIndex:e.viewPlayerIndex}}),e.server.setVar(t,i,n,{playerIndex:e.viewPlayerIndex})}function pc(e,t,i){if(!e?.server)throw new Error("play session has no server");let n=e.server.getVar(t,i,{playerIndex:e.viewPlayerIndex});return n===void 0?null:n}function Er(e,t,i=[],n="PlayerSelf"){if(!e?.server)throw new Error("play session has no server");return ht(e,{kind:"serverSend",payload:{name:t,params:i,target:n,playerIndex:e.viewPlayerIndex}}),e.server.sendToClient(t,i,{target:n,playerIndex:e.viewPlayerIndex})}function Hn(e){return{snapshot:t=>yr(e,t),step:t=>Bn(e,t),pointer:(t,i,n,a)=>zi(e,t,i,n,a),key:t=>wr(e,t),click:t=>vr(e,t),view:t=>br(e,t),pause:()=>{ht(e,{kind:"pause",payload:{}}),e.debugPaused=!0},resume:()=>{ht(e,{kind:"resume",payload:{}}),e.debugPaused=!1},serverSet:(t,i,n)=>xr(e,t,i,n),serverSend:(t,i,n)=>Er(e,t,i,n)}}function Ir(e){e?.server&&e.server.destroy();let t=e?.runtimes||(e?.runtime?[e.runtime]:[]);for(let i of t)i.destroy()}function Cr(e,t){return JSON.stringify(e)===JSON.stringify(t)}function bc(e,t){for(let i of e||[])t(i),i.children?.length&&bc(i.children,t)}function kr(e,{id:t,name:i}){let n=null;return bc(e,a=>{n||(t&&String(a.id)===String(t)||!t&&i&&a.name===i)&&(n=a)}),n}function gf(e,t){if(e){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];if(e.box&&Object.prototype.hasOwnProperty.call(e.box,t))return e.box[t]}}function yf(e){return{var(t,i){return e.server?.vars?.[t]?.[i]?.value??null},logs(){return(e.logs||[]).map(t=>t.text)},logContains(t){return(e.logs||[]).some(i=>String(i.text||"").includes(String(t)))},serverLogs(){return(e.server?.logs||e.serverLogs||[]).map(t=>t.text)},serverLogContains(t){return(e.server?.logs||e.serverLogs||[]).some(i=>String(i.text||"").includes(String(t)))},control(t){let i=kr(e.tree,{name:String(t)});return i?{id:i.id,name:i.name,kind:i.kind,active:i.active,visible:i.visible,pressed:i.pressed,text:i.text,interactable:i.interactable}:null},signals(t){let i=t==="outbound"?"outbound":"inbound";return(e.server?.[i]||[]).map(n=>({name:n.name,values:n.values}))}}}function wf(e,t){if(e.kind==="log"){let i=e.source==="server"?t.server?.logs||t.serverLogs||[]:t.logs||[];return i.some(a=>e.level&&a.level!==e.level?!1:String(a.text||"").includes(e.contains))?{ok:!0,actual:e.contains}:{ok:!1,actual:i.map(a=>a.text).slice(-8),expected:e.contains}}if(e.kind==="control"){let i=kr(t.tree,e);if(!i)return{ok:!1,actual:null,expected:e.equals,message:`control not found: ${e.id||e.name}`};let n=gf(i,e.field);return Cr(n,e.equals)?{ok:!0,actual:n}:{ok:!1,actual:n,expected:e.equals}}if(e.kind==="var"){let i=t.server?.vars?.[e.entityType],a=!i||!Object.prototype.hasOwnProperty.call(i,e.name)?null:i[e.name].value;return Cr(a,e.equals)?{ok:!0,actual:a}:{ok:!1,actual:a,expected:e.equals}}if(e.kind==="signal"){let i=e.direction==="outbound"?t.server?.outbound||[]:t.server?.inbound||[],n=i.find(a=>a.name===e.name&&(e.values===void 0||Cr(a.values,e.values)));return n?{ok:!0,actual:n.values}:{ok:!1,actual:i.map(a=>({name:a.name,values:a.values})),expected:{name:e.name,values:e.values??null}}}if(e.kind==="tree"){let i=!!kr(t.tree,{name:e.name});return i===e.exists?{ok:!0,actual:i}:{ok:!1,actual:i,expected:e.exists}}return{ok:!1,message:`unsupported assert kind ${e.kind}`}}function vf(e,t){let i=Ti();try{return i.evalQueryScript(e,yf(t)),{ok:!0,actual:!0}}catch(n){return{ok:!1,message:n?.message||String(n)}}finally{i.destroy()}}function gc(e,t){return e.kind==="lua"?vf(e.source,t):wf(e,t)}function Sf(e,t){let i=t>0?t:Mt;return Math.round((e+i)*1e9)/1e9}function xf(e,t){let i=t.payload||{};if(t.kind==="pointer")e.pointer(i.type,i.x,i.y,i);else if(t.kind==="key")e.key(i.typeName);else if(t.kind==="click")e.click(i.name);else if(t.kind==="pause")e.pause();else if(t.kind==="resume")e.resume();else if(t.kind==="serverSet")e.serverSet(i.entityType,i.name,i.value);else if(t.kind==="serverSend")e.serverSend(i.name,i.params,i.target);else if(t.kind==="view")e.view(i.playerIndex);else throw new Error(`unsupported event kind: ${t.kind}`)}function Ef(e,t){let i=gc(e,t);return{kind:e.kind,at:Number(e.at||0),ok:!!i.ok,actual:i.actual??null,expected:i.expected??null,message:i.message||""}}function yc(e,t){let i=Oi(t),n=i.events.slice().sort((y,w)=>y.t-w.t),a=i.asserts.slice(),r=i.dt||Mt,o=n.reduce((y,w)=>Math.max(y,w.t),0),s=a.reduce((y,w)=>Math.max(y,Number(w.at||0)),0),c=Math.max(o,s),l=0,d=[],f=0,h=a.some(y=>y.kind==="control"||y.kind==="tree"||y.kind==="lua"),m=e.snapshot({inspect:h}),p=()=>{for(;l<n.length&&n[l].t<=f+1e-9;)xf(e,n[l]),l+=1,m=e.snapshot({inspect:h})},b=()=>{for(let y of a)if(!y._done&&Number(y.at||0)<=f+1e-9){let w=Ef(y,m);if(d.push(w),y._done=!0,!w.ok)return{passed:!1,failedAt:f,frame:m.frame||0,results:d,snapshot:m}}return null};p();let v=b();if(v)return Ar(i,v);for(;f+1e-9<c;){e.step(r),f=Sf(f,r),m=e.snapshot({inspect:h}),p();let y=b();if(y)return Ar(i,y)}return Ar(i,{passed:d.every(y=>y.ok),failedAt:null,frame:m.frame||0,results:d,snapshot:m})}function Ar(e,t){return L({format:e.format,name:e.name,passed:t.passed,failedAt:t.failedAt,frame:t.frame,results:t.results,snapshot:{time:t.snapshot?.time??0,frame:t.snapshot?.frame??0,logs:t.snapshot?.logs||[],serverLogs:t.snapshot?.serverLogs||t.snapshot?.server?.logs||[],server:t.snapshot?.server||{vars:{},inbound:[],outbound:[],logs:[]}}})}function _r(e){return Array.isArray(e)?e.slice():[]}import{createHash as If}from"node:crypto";var wc=e=>If("sha256").update(JSON.stringify(e.map(({id:t,path:i,source:n})=>({id:t,path:i,source:n})))).digest("hex");function vc(e){let t=new Map;for(let n of e){let a=`${n.controlAsset}:${n.controlId}`,r=t.get(a);if(r&&r.newGuid!==n.oldGuid)throw new Error("\u7D22\u5F15\u53D8\u66F4\u8BB0\u5F55\u4E0D\u8FDE\u7EED\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6838\u5BF9");t.set(a,{oldGuid:r?.oldGuid??n.oldGuid,newGuid:n.newGuid})}let i=new Map;for(let{oldGuid:n,newGuid:a}of t.values()){if(i.has(n))throw new Error("\u591A\u4E2A\u63A7\u4EF6\u5171\u7528\u65E7\u7D22\u5F15\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6309\u63A7\u4EF6\u8EAB\u4EFD\u6838\u5BF9");i.set(n,a)}return new Map([...i].filter(([n,a])=>n!==a))}function Sc(e,t){let i=[],n=new Map([...t].map(([c,l])=>[String(c),l])),a=1,r=0,o=0;return{source:e.replace(/\d+/g,(c,l)=>{if(!n.has(c))return c;for(;r<l;r++)e[r]===`
|
|
116
|
+
`&&(a++,o=r+1);let d=n.get(c),f=l+c.length,h=e.indexOf(`
|
|
117
|
+
`,f);return i.push({start:l,end:f,oldGuid:Number(c),newGuid:d,line:a,before:e.slice(o,h<0?e.length:h).trim()}),String(d)}),edits:i,issues:[]}}function Pr(e,t=[]){let i=[],n=new Map,a=new Map;for(let s of t)a.set(s.controlId,(a.get(s.controlId)||0)+1);function r(s){let c=(s.children||[]).map(r),l={controlCount:1+c.reduce((d,f)=>d+f.controlCount,0),scriptCount:(a.get(s.id)||0)+c.reduce((d,f)=>d+f.scriptCount,0)};return n.set(s.id,l),l}r(e.root);function o(s,c="",l=[]){i.push({id:s.id,name:s.name,kind:s.kind,guid:s.guid,parentId:c,ancestorIds:l,depth:l.length,...n.get(s.id)});for(let d of s.children||[])o(d,s.id,[...l,s.id])}for(let s of e.root.children||[])o(s);return i}function xc(e,t,{controlIds:i,includeScripts:n=!0}={}){if(!Array.isArray(i)||!i.length||i.some(b=>typeof b!="string"||!b))throw new Error("\u8BF7\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u5BA2\u6237\u7AEF\u63A7\u4EF6 controlIds");if(typeof n!="boolean")throw new Error("includeScripts must be a boolean");let a=Pr(e,t),r=new Map(a.map(b=>[b.id,b]));for(let b of i)if(!r.has(b))throw new Error(`\u672A\u77E5\u5BA2\u6237\u7AEF\u63A7\u4EF6\uFF1A${b}`);let o=new Set(i),s=a.filter(b=>o.has(b.id)&&!b.ancestorIds.some(v=>o.has(v))),c=L(e),l=new Map;K(c.root,b=>l.set(b.id,b)),c.root.children=s.map(b=>l.get(b.id)),c.selectedId=s[0].id;let d=new Set;K(c.root,b=>{b.kind!=="server-container"&&d.add(b.id)});let f=[];for(let b of s)b.parentId&&f.push(`${b.name}\uFF1A\u4EC5\u5728\u5BFC\u51FA\u526F\u672C\u4E2D\u63D0\u5347\u4E3A\u72EC\u7ACB\u6A21\u677F\uFF0C\u4FDD\u7559\u56DB\u5E73\u53F0\u5C40\u90E8\u53D8\u6362\uFF1B\u5916\u90E8\u7236\u7EA7\u7684\u7F29\u653E\u3001\u65CB\u8F6C\u3001\u906E\u7F69\u53CA\u663E\u9690\u4E0D\u5305\u542B\u5728\u5185\u3002`);let h=new Set([...d].map(b=>l.get(b).guid));K(c.root,b=>{for(let v of["referencedPrefabId","itemPrefabId"]){let y=b[v];y&&!h.has(Number(y))&&f.push(`${b.name}\uFF1A\u5F15\u7528 ${y} \u4E0D\u5728\u672C\u6B21\u5BFC\u51FA\u4E2D\uFF0C\u8BF7\u540C\u65F6\u5BFC\u5165\u5BF9\u5E94\u6A21\u677F\u3002`)}b.giaRaw?.templateRefSlotBase64&&f.push(`${b.name}\uFF1A\u4E8C\u8FDB\u5236\u6A21\u677F\u5F15\u7528\u539F\u6837\u4FDD\u7559\uFF0C\u65E0\u6CD5\u81EA\u52A8\u5224\u65AD\u5916\u90E8\u4F9D\u8D56\u3002`),!n&&b.scriptMappingIds?.length&&(b.scriptMappingIds=[])});let m=n?t.filter(b=>!b.controlId||d.has(b.controlId)):[];for(let b of m)!b.source&&b.path&&f.push(`${b.path}\uFF1A\u4EC5\u767B\u8BB0\u4E86\u8DEF\u5F84\uFF0C\u6CA1\u6709\u5185\u8054\u6E90\u7801\uFF1B\u8BF7\u6838\u5BF9\u6E38\u620F\u5185\u7684\u811A\u672C\u6587\u4EF6\u3002`);n&&m.some(b=>!b.controlId)&&f.push("\u5DF2\u5305\u542B\u672A\u6302\u8F7D\u7684 Lua \u6A21\u5757\uFF1BLua \u52A8\u6001\u5F15\u7528\u65E0\u6CD5\u81EA\u52A8\u5224\u65AD\uFF0C\u8BF7\u6838\u5BF9\u5916\u90E8\u6A21\u677F\u548C\u811A\u672C\u4F9D\u8D56\u3002"),!n&&t.some(b=>d.has(b.controlId))&&f.push("\u672C\u6B21\u672A\u5305\u542B\u6302\u8F7D\u811A\u672C\uFF0C\u5BFC\u5165\u540E\u9700\u53E6\u884C\u5BFC\u5165\u5E76\u6302\u8F7D\u3002");let p=new Set(m.map(b=>b.guid));return n&&K(c.root,b=>{for(let v of b.scriptMappingIds||[])p.has(v)||f.push(`${b.name}\uFF1A\u811A\u672C\u6620\u5C04 ${v} \u7684\u6E90\u7801\u672A\u767B\u8BB0\uFF0C\u8BF7\u53E6\u884C\u5BFC\u5165\u3002`)}),{project:c,scripts:m,warnings:[...new Set(f)],selection:{controlIds:s.map(b=>b.id),controlCount:d.size,templateCount:s.length,scriptCount:m.length,includeScripts:n}}}var Mf={Level:"\u5173\u5361",PlayerSelf:"\u5F53\u524D\u73A9\u5BB6",AvatarSelf:"\u5F53\u524D\u89D2\u8272",...Object.fromEntries(Pt.map((e,t)=>[e,`\u73A9\u5BB6${t+1}`])),...Object.fromEntries(Array.from({length:8},(e,t)=>[`Avatar${t+1}`,`\u89D2\u8272${t+1}`]))};function Rf(e,t=1){let i=e?.vars||{},n=[],a=Number(t)>0?Number(t):1,r=["Level","PlayerSelf","AvatarSelf"];if(a>1)for(let s=1;s<=a;s+=1)r.push(`Player${s}`,`Avatar${s}`);let o=new Set;for(let s of r){if(o.has(s)||!i[s])continue;o.add(s);let c=i[s]||{};for(let l of Object.keys(c))n.push(L({entityType:s,entityLabel:Mf[s]||s,name:l,type:c[l]?.type||"",value:c[l]?.value??null}))}return n}var Ft="qxqy-simulator-save",Nf="qxqy-simulator-scripts",le="server-control-template",Y="client-control-template",Tr={[le]:"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F",[Y]:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"};function Rt(e){return e===Y?"client":"server"}function kc(e){if(!(typeof e=="number"||typeof e=="string"&&/^\d+$/.test(e.trim()))||!Te(e))throw new Error(`\u63A7\u4EF6\u7D22\u5F15\u5FC5\u987B\u662F ${1073741824}\u2013${1077936127}\uFF080x40000000\u20130x403FFFFF\uFF09\u8303\u56F4\u5185\u7684\u6574\u6570`);return Number(e)}function Ln(e){let t=typeof e=="number"||typeof e=="string"&&/^\d+$/.test(e.trim()),i=Number(e);if(!t||!Je(i))throw new Error("\u63A7\u4EF6\u7D22\u5F15\u5FC5\u987B\u662F 1\u20132147483647 \u8303\u56F4\u5185\u7684\u6574\u6570");return i}function Mr(e=[]){if(!Array.isArray(e))throw new Error("controlGuidChanges \u5FC5\u987B\u662F\u6570\u7EC4");let t=new Set;return e.map(i=>{if(!i||typeof i.id!="string"||!i.id||t.has(i.id)||![le,Y].includes(i.controlAsset)||typeof i.controlId!="string"||!i.controlId||typeof i.controlName!="string")throw new Error("controlGuidChanges \u5305\u542B\u65E0\u6548\u6216\u91CD\u590D\u7684\u53D8\u66F4\u8BB0\u5F55");if(t.add(i.id),i.batchId!==void 0&&(typeof i.batchId!="string"||!i.batchId))throw new Error("controlGuidChanges \u5305\u542B\u65E0\u6548\u7684 batchId");if(i.scriptSignature!==void 0&&!/^[a-f0-9]{64}$/.test(i.scriptSignature))throw new Error("controlGuidChanges \u5305\u542B\u65E0\u6548\u7684 scriptSignature");return{id:i.id,controlAsset:i.controlAsset,controlId:i.controlId,controlName:i.controlName,oldGuid:Ln(i.oldGuid),newGuid:Ln(i.newGuid),...i.batchId?{batchId:i.batchId}:{},...i.scriptSignature?{scriptSignature:i.scriptSignature}:{}}})}function Ff(e){let t=[e?.guid,e?.id];for(let i of t){let n=Number(i);if(Je(n))return n}return 0}function Un(e){let t=String(e?.controlAsset||""),i=Ff(e);return{id:String(i||e?.id||""),guid:i,path:String(e?.path||""),source:String(e?.source||""),controlId:String(e?.controlId||""),controlAsset:t===Y||t==="client"?Y:t===le||t==="server"?le:""}}function Of(e){let t=[],i=(n,a="")=>{if(n&&(n.path||n.source)){let r=Un(n);t.push(a?{...r,controlAsset:a}:r)}};if(Array.isArray(e?.assets?.scripts)){for(let n of e.assets.scripts)n&&(n.path||n.source)&&t.push(Un(n));return t}if(i(e?.assets?.server?.script,le),i(e?.assets?.client?.script,Y),e&&e.format!==Ft){i(e?.script);for(let n of e?.scripts||[])i(n)}return t}function Rr(e){return ft(e===Y?Yt():wt())}var $f="\u672A\u7ED1\u5B9A",Nt="\u672A\u547D\u540D\u5B58\u6863",Df="\u672A\u547D\u540D\u754C\u9762";function zf(e){let t=e;for(let i=0;i<8;i++){if(Vi(Ic(t,"simulator","studio"))&&Vi(Ic(t,"lua")))return t;let n=Pf(t);if(n===t)break;t=n}return e}function Gf(e){return e?{name:ai(e),path:e,bound:!0}:{name:$f,path:"",bound:!1}}function Vf(e,t=process.cwd()){if(Tf(e)&&Vi(e))return e;let i=t||process.cwd(),n=zf(i),a=Cc(n,e);if(Vi(a))return a;let r=Cc(i,e);if(Vi(r))return r;throw new Error("script file not found: "+e)}function Bi(e,t={}){e?.format===Ft&&Ba(e.version);let i=[],n=typeof t.workspacePath=="string"&&t.workspacePath?t.workspacePath:"",a=e?.format===Ft&&e.assets,r=Mr(e?.controlGuidChanges),o=gi(e?.scriptSync),s=a?null:ft(e,{warnings:i}),c={server:a&&e.assets.server?ft(e.assets.server,{warnings:i}):Rr(le),client:a&&e.assets.client?ft(e.assets.client,{warnings:i}):Rr(Y)};s&&(c[Rt(s.meta.assetType)]=s);let l=a&&e.activeAssetType===Y?Y:s?.meta.assetType||le,d=a&&e.meta?.name?String(e.meta.name):"",f=()=>d||Nt;!e?.meta?.name&&c.server.meta.name==="\u672A\u547D\u540D\u754C\u9762\u63A7\u4EF6\u7EC4"&&(c.server.meta.name=Df);let h=[],m=new Set;function p(){m.clear(),jt(c.server.root,m),jt(c.client.root,m,{skipServerContainer:!0});for(let g of h)Je(g.guid)&&m.add(Number(g.guid))}function b(g=0){p();let x=Je(g)&&!m.has(Number(g))?Number(g):ot(m);return m.add(x),x}function v(g){let x=Un(g),I=b(x.guid);return{...x,guid:I,id:String(I)}}di(Of(e));let y=Fi(e?.serverLogic),w=null,_="",T=1,N=1;function O(g){let x=String(g||"").trim();if(!x)return"";if(!J[x])throw new Error(`unknown canvas preset: ${x} (available: ${Object.keys(J).join(", ")})`);return x}let V=()=>c[Rt(l)];function $(g){if(!g)return null;for(let[x,I]of[["server",c.server],["client",c.client]]){let M=me(I.root,g);if(M&&M.kind!=="server-container")return{key:x,node:M}}return null}function S(g){if(!g.controlId)return null;let x=g.controlAsset===Y?"client":g.controlAsset===le?"server":null;if(x){let I=me(c[x].root,g.controlId);return I&&I.kind!=="server-container"?{key:x,node:I}:null}return $(g.controlId)}function A(){for(let g of h)g.controlId&&!S(g)&&(g.controlId="",g.controlAsset="")}function E(g){if(!Je(g))return null;for(let[x,I]of[[le,c.server],[Y,c.client]]){let M="";if(K(I.root,D=>{!M&&(D.scriptMappingIds||[]).includes(Number(g))&&(M=D.id)}),M)return{controlId:M,controlAsset:x}}return null}function C(g,x,I){let M=c[Rt(g.controlAsset)],D=M&&me(M.root,g.controlId);D&&(D.scriptMappingIds=(D.scriptMappingIds||[]).map(U=>Number(U)===Number(x)?Number(I):U))}A();function z(){return h.map(g=>{let x=S(g),I=x?x.key==="client"?Y:le:"";return L({id:g.id,guid:g.guid||0,path:g.path||"",source:g.source||"",controlId:g.controlId||"",controlAsset:g.controlAsset||I,controlName:x?.node.name||"",assetType:I,assetLabel:x?Tr[I]:"",mounted:!!x})})}function k(){let g=[],x=(I,M)=>{K(I.root,D=>{D.kind!=="server-container"&&g.push(L({id:D.id,name:D.name,kind:D.kind,assetType:M,assetLabel:Tr[M]}))})};return x(c.server,le),x(c.client,Y),g}function P(g){let x=[];return K(g.root,I=>{I.kind!=="server-container"&&x.push(JSON.stringify({kind:I.kind,guid:I.guid,name:I.name,text:I.text??null,imageId:I.imageId??null,imageSource:I.imageSource??null,imageType:I.imageType??null,fontSize:I.fontSize??null,adaptiveFontSize:I.adaptiveFontSize??null,minimumFontSize:I.minimumFontSize??null,fontColor:I.fontColor??null,bgColor:I.bgColor??null,imageColor:I.imageColor??null,fillType:I.fillType??null,fillAmount:I.fillAmount??null,syncAllDevices:I.syncAllDevices!==!1,transformByPlatform:I.transformByPlatform||null}))}),x.join("/")}let B=P(Yt()),j=P(wt());function ae(g){let x=P(g);return g.meta?.assetType===Y?x===B:x===j}function X(g,x){return String(g||"").replace(/[\\/:*?"<>|]/g,"-").trim()||x}function ie(g){let x=X(f(),Nt),I=g.meta?.assetType===Y?"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F";return`${x} \xB7 ${I}`}function Oe(){if(!((c.server.root.children||[]).find(x=>x.kind==="container")||c.server.root.children?.[0]))throw new Error("\u6574\u5408\u5305\u9700\u8981\u670D\u52A1\u7AEF\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668\u4E0B\u81F3\u5C11\u6709\u4E00\u4E2A\u6839\u63A7\u4EF6");return is(c.server,c.client,{scripts:h,fileName:`${X(f(),Nt)} \xB7 \u6574\u5408\u5305.gia`})}function Dt(){let g=x=>({type:x.meta.assetType,name:x.meta.name,sourceFile:x.meta.sourceFile||""});return{format:Ft,name:f(),activeAssetType:l,assets:{server:g(c.server),client:g(c.client),scripts:z()}}}function li(){return L({format:Ft,version:4,meta:{name:f()},activeAssetType:l,serverLogic:y,controlGuidChanges:r,scriptSync:o,assets:{server:c.server,client:c.client,scripts:h.map(g=>L({id:g.id,guid:g.guid||0,path:g.path||"",source:g.source||"",controlId:g.controlId||"",controlAsset:g.controlAsset||""}))}})}function re(){let g=V(),x=Ua(g);if(x.workspace=Gf(n),x.save=Dt(),x.scripts=z(),x.mountTargets=k(),x.serverLogic=y,x.migrationWarnings=[...i],x.controlGuidChanges=L(r),l===Y){let I=qt(g,!0);x.clientGuidAutofill={count:I.length,templateCount:I.filter(({parent:M})=>M?.kind==="server-container").length,selectedOffset:I.findIndex(({node:M})=>M.id===x.selectedId)}}return x.scriptSync=L(o),uo(x),x}function Ve(g){let x=V();if(g.expectedRevision!==void 0&&Number(g.expectedRevision)!==x.version)throw new Error(`revision conflict: expected ${g.expectedRevision}, current ${x.version}`);return x}function mt(g,x,I=""){let M=String(x||"");if(M){let D=I===Y?Y:I===le?le:"";if(!S({controlId:M,controlAsset:D}))throw new Error("\u6302\u8F7D\u76EE\u6807\u5FC5\u987B\u662F\u5B58\u6863\u5185\u7684\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6216\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F");g.controlAsset=D}else g.controlAsset="";g.controlId=M}function Xi(g){let x=Ve(g);if(g.op==="addScript"){let I=v({path:String(g.path||""),source:String(g.source||""),controlId:"",controlAsset:""});g.controlId!==void 0&&g.controlId!==""&&mt(I,g.controlId,g.controlAsset),h.push(I)}else if(g.op==="updateScript"){let I=h.find(M=>M.id===g.id);if(!I)throw new Error(`\u811A\u672C\u4E0D\u5B58\u5728: ${g.id}`);g.controlId!==void 0&&mt(I,g.controlId,g.controlAsset),g.path!==void 0&&(I.path=String(g.path)),g.source!==void 0&&(I.source=String(g.source))}else if(g.op==="removeScript"){let I=h.length;if(h=h.filter(M=>M.id!==g.id),h.length===I)throw new Error(`\u811A\u672C\u4E0D\u5B58\u5728: ${g.id}`)}return x.version+=1,re()}function Wi(g){let x=Ve(g),I=me(x.root,g.id??x.selectedId);if(!I||I.kind==="server-container")throw new Error("\u4EC5\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6216\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5141\u8BB8\u4FEE\u6539\u7D22\u5F15");let M=kc(g.guid);if(Ln(I.guid),g.autoFillClientGuids!==void 0&&typeof g.autoFillClientGuids!="boolean")throw new Error("autoFillClientGuids \u5FC5\u987B\u662F\u5E03\u5C14\u503C");let D=g.autoFillClientGuids===!0;if(D&&l!==Y)throw new Error("\u81EA\u52A8\u586B\u5145\u4EC5\u652F\u6301\u5BA2\u6237\u7AEF\u6A21\u677F\u5217\u8868\uFF1B\u670D\u52A1\u7AEF\u754C\u9762\u7684\u7D22\u5F15\u9700\u5355\u72EC\u586B\u5199");let U=D?qt(x,!0).map(({node:G})=>G):[I],H=M-U.indexOf(I),q=U.map((G,se)=>({node:G,oldGuid:Ln(G.guid),newGuid:kc(H+se)})),ee=q.filter(({oldGuid:G,newGuid:se})=>G!==se);if(!ee.length)return re();let ke=new Map(q.map(({oldGuid:G,newGuid:se})=>[G,se]));if(ke.size!==q.length)throw new Error("\u5BA2\u6237\u7AEF\u6A21\u677F\u5B58\u5728\u91CD\u590D\u65E7\u7D22\u5F15\uFF0C\u65E0\u6CD5\u81EA\u52A8\u586B\u5145\uFF1B\u8BF7\u5148\u6D88\u9664\u6B67\u4E49");let xe=new Set(U),Le=[];for(let G of Object.values(c))K(G.root,se=>{G===c.client&&se.kind==="server-container"||Le.push({node:se,project:G})});let Ee=new Map([...Le.filter(G=>!xe.has(G.node)).map(({node:G})=>[Number(G.guid),G.name]),...h.map(G=>[Number(G.guid),G.path||"Lua \u811A\u672C"])]);for(let{newGuid:G}of ee)if(Ee.has(G))throw new Error(`\u63A7\u4EF6\u7D22\u5F15 ${G} \u5DF2\u88AB\u300C${Ee.get(G)}\u300D\u5360\u7528\uFF1B\u8BF7\u5148\u586B\u5199\u5B83\u7684\u5B9E\u9645\u7D22\u5F15\u3002\u672C\u6B21\u672A\u4FEE\u6539\u4EFB\u4F55\u7D22\u5F15\u3002`);let Ue=[],ne=(G,se,We)=>{let $e=G?.[se];(typeof $e=="number"||typeof $e=="string"&&/^\d+$/.test($e.trim()))&&ke.has(Number($e))&&ke.get(Number($e))!==Number($e)&&Ue.push({owner:G,key:se,project:We.project,oldGuid:Number($e),newGuid:ke.get(Number($e))})};for(let G of Le)ne(G.node,"referencedPrefabId",G),ne(G.node,"itemPrefabId",G),ne(G.node.giaRaw,"templateRefSlot",G);let de=new Map;for(let{node:G}of Le)de.set(Number(G.guid),(de.get(Number(G.guid))||0)+1);for(let{oldGuid:G}of Ue)if(de.get(G)!==1)throw new Error(`\u65E7\u7D22\u5F15 ${G} \u5728\u591A\u68F5\u8D44\u4EA7\u6811\u4E2D\u91CD\u590D\uFF0C\u65E0\u6CD5\u786E\u5B9A\u6A21\u677F\u5F15\u7528\u5F52\u5C5E\uFF1B\u8BF7\u5148\u6D88\u9664\u6B67\u4E49\u540E\u4FEE\u6539`);let hi=D?Ec():"",ye=wc(h);for(let{node:G,oldGuid:se,newGuid:We}of ee)G.guid=We,r.push({id:Ec(),controlAsset:l,controlId:G.id,controlName:G.name,oldGuid:se,newGuid:We,scriptSignature:ye,...hi?{batchId:hi}:{}});let Ji=new Set([x]);for(let{owner:G,key:se,project:We,newGuid:$e}of Ue)G[se]=typeof G[se]=="string"?String($e):$e,Ji.add(We);for(let G of Ji)G.version+=1;return re()}function oe(g){let x=Ve(g);if(!Array.isArray(g.changeIds)||!g.changeIds.length||g.changeIds.some(M=>typeof M!="string"||!r.some(D=>D.id===M)))throw new Error("\u8BF7\u660E\u786E\u6307\u5B9A\u5DF2\u6838\u5BF9 Lua \u5F15\u7528\u7684\u6709\u6548\u7D22\u5F15\u53D8\u66F4\u8BB0\u5F55 changeIds");let I=new Set(g.changeIds);return r=r.filter(M=>!I.has(M.id)),x.version+=1,re()}function Be(g){if(!g||typeof g!="object")throw new Error("patch requires op");if(g.op==="setScriptSync"){let x=Ve(g);return o=gi(g.config),x.version+=1,re()}if(g.op==="setControlGuid")return Wi(g);if(g.op==="acknowledgeControlGuidChanges")return oe(g);if(g.op==="setServerLogic"){let x=Ve(g);return y=Fi(g.logic),x.version+=1,re()}if(g.op==="addScript"||g.op==="updateScript"||g.op==="removeScript")return Xi(g);if(g.op==="selectAsset")return l=g.assetType===Y?Y:le,re();if(g.op==="renameSave"){let x=String(g.name||"").trim();if(!x)throw new Error("\u5B58\u6863\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");return d=x,re()}if(g.op==="newAsset"){let x=Ve(g);l=g.assetType===Y?Y:le;let I=Rr(l);return I.version=x.version+1,c[Rt(l)]=I,r=r.filter(M=>M.controlAsset!==l),A(),re()}return ja(V(),g),A(),re()}function He(g){return h.filter(x=>{let I=S(x);return!!(I&&I.key==="client"==(g===Y))})}function Ki(){return L({assetType:Y,revision:c.client.version,rows:Pr(c.client,He(Y))})}function zt(g={}){if(g.expectedRevision!==void 0&&g.expectedRevision!==c.client.version)throw new Error("revision conflict: reload export choices");let x=h.filter(M=>!M.controlId||S(M)?.key==="client"),I=xc(c.client,x,g);if(g.canvasId){if(!J[g.canvasId])throw new Error(`unknown canvas preset: ${g.canvasId}`);I.project.canvasId=g.canvasId}return I}function qi(g={}){let x=zt(g);return L({snapshot:Ua(x.project),selection:x.selection,warnings:x.warnings})}function Gt(g="json",x="",I={}){let M=Ml(g,x,I);if(r.length&&!["save","archive"].includes(String(g).toLowerCase())){let D=r.map(U=>`\u63A7\u4EF6\u7D22\u5F15\u5F85\u6838\u5BF9 Lua \u5F15\u7528\uFF1A${Tr[U.controlAsset]} / ${U.controlName} (${U.controlId})\uFF1A${U.oldGuid} \u2192 ${U.newGuid}\u3002\u8BF7\u6309\u8BED\u4E49\u66F4\u65B0\u811A\u672C\u4E2D\u7684\u63A7\u4EF6\u7D22\u5F15\u5F15\u7528\uFF0C\u6838\u5BF9\u540E\u786E\u8BA4\u53D8\u66F4\u8BB0\u5F55 ${U.id}\uFF1B\u4E0D\u8981\u5168\u5C40\u66FF\u6362\u540C\u503C\u6570\u5B57\u3002`);M.warnings=[...new Set([...M.warnings||[],...D])]}return M}function Ml(g="json",x="",I={}){let M=String(g).toLowerCase();if(M==="gia-partial"){let H=zt(I),q=$a(H.project,{scripts:H.scripts,includeScriptMappings:!0}),ee=H.selection.templateCount===1?H.project.root.children[0].name:"\u90E8\u5206\u7EC4\u5408";return L({filename:`${X(f(),Nt)} \xB7 ${X(ee,"\u90E8\u5206\u7EC4\u5408")}.gia`,mimeType:"application/octet-stream",encoding:"base64",data:q.buffer.toString("base64"),selection:H.selection,warnings:[...new Set([...H.warnings,...q.warnings])]})}if(M==="save"||M==="archive"){let H=Buffer.from(JSON.stringify(li(),null,2),"utf8");return L({filename:`${f().replace(/[\\/:*?"<>|]/g,"-")} \xB7 \u8D44\u4EA7\u5305.json`,mimeType:"application/json",encoding:"base64",data:H.toString("base64"),warnings:[]})}if(M==="save-gia"||M==="archive-gia"){let H=[],q=[],ee=(xe,Le="")=>{let Ee=Gt(xe,Le);H.push(L({filename:Ee.filename,mimeType:Ee.mimeType,encoding:Ee.encoding,data:Ee.data,warnings:Ee.warnings||[]})),q.push(...Ee.warnings||[])},ke=(xe,Le)=>{let Ee=c[Rt(xe)],Ue=xe===l,ne=h.some(de=>de.controlAsset===xe&&de.controlId);if(!Ue&&ae(Ee)&&!ne){q.push(Le);return}ee("gia",xe)};if(ke(le,"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F\u4ECD\u662F\u9ED8\u8BA4\u6A71\u7A97\uFF0C\u672A\u6539\u52A8\u4E14\u5F53\u524D\u672A\u663E\u793A\uFF0C\u5DF2\u4ECE\u8D44\u4EA7\u5305 GIA \u4E2D\u7701\u7565\u3002"),ke(Y,"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u4ECD\u662F\u9ED8\u8BA4\u300CLua\u5B9E\u4F8B\u5316\u9762\u677F\u300D\uFF0C\u672A\u6539\u52A8\u4E14\u5F53\u524D\u672A\u663E\u793A\uFF0C\u5DF2\u4ECE\u8D44\u4EA7\u5305 GIA \u4E2D\u7701\u7565\u3002"),h.some(xe=>xe.path||xe.source)&&ee("scripts-gia"),!H.length)throw new Error("\u8D44\u4EA7\u5305 GIA \u6CA1\u6709\u53EF\u5BFC\u51FA\u7684\u5DF2\u6539\u52A8\u9879\uFF1B\u8BF7\u5148\u7F16\u8F91\u5F53\u524D\u754C\u9762\uFF0C\u6216\u6539\u7528\u300C\u5F53\u524D\u754C\u9762 GIA\u300D\u3002");return L({format:"qxqy-gia-package",files:H,warnings:[...new Set(q)]})}if(M==="gia-combined"||M==="combined-gia"||M==="combined"){let H=Oe();return L({filename:`${X(f(),Nt)} \xB7 \u6574\u5408\u5305.gia`,mimeType:"application/octet-stream",encoding:"base64",data:H.buffer.toString("base64"),warnings:[...new Set(H.warnings||[])]})}if(M==="scripts"){let H=L({format:Nf,version:1,scripts:h.map(ee=>L({id:ee.id,guid:ee.guid||0,path:ee.path||"",source:ee.source||"",controlId:ee.controlId||"",controlAsset:ee.controlAsset||""}))}),q=Buffer.from(JSON.stringify(H,null,2),"utf8");return L({filename:`${X(f(),Nt)} \xB7 \u811A\u672C.json`,mimeType:"application/json",encoding:"base64",data:q.toString("base64"),warnings:[]})}if(M==="scripts-gia"||M==="scriptsgia"){let H=rs(h);return L({filename:`${X(f(),Nt)} \xB7 \u811A\u672C.gia`,mimeType:"application/octet-stream",encoding:"base64",data:H.buffer.toString("base64"),warnings:H.warnings})}if(M==="lua"){let H=h.find(ee=>ee.id===x)||h.find(ee=>ee.path===x);if(!H)throw new Error("\u6CA1\u6709\u53EF\u5BFC\u51FA\u7684 Lua \u811A\u672C\uFF0C\u8BF7\u5148\u5728\u201CLua \u811A\u672C\u201D\u9875\u521B\u5EFA");let q=ai(H.path||"")||`qxqy-script-${H.id}`;return L({filename:/\.lua$/i.test(q)?q:`${q}.lua`,mimeType:"text/x-lua",encoding:"base64",data:Buffer.from(H.source||"","utf8").toString("base64"),warnings:[]})}let D=x?c[Rt(x)]:V(),U=ie(D);if(M==="json"){let H=L({...D,scripts:He(D.meta.assetType),controlGuidChanges:r.filter(ee=>ee.controlAsset===D.meta.assetType)}),q=Buffer.from(JSON.stringify(H,null,2),"utf8");return L({filename:`${U}.json`,mimeType:"application/json",encoding:"base64",data:q.toString("base64"),warnings:[]})}if(M==="gia"){let H=$a(D,D.meta.assetType===Y?{scripts:He(Y)}:{}),q=D.meta.assetType===Y?[]:He(le);return q.length&&H.warnings.unshift(`\u5F53\u524D\u670D\u52A1\u5668\u63A7\u4EF6 GIA \u4E0D\u5305\u542B ${q.length} \u4E2A Lua \u811A\u672C\u7684\u6E90\u7801\uFF1B\u8BF7\u4F7F\u7528\u300C\u8D44\u4EA7\u5305 GIA \u6574\u5408\u5305\u300D\uFF0C\u6216\u53E6\u884C\u5BFC\u5165\u811A\u672C\u5305\u5E76\u6838\u5BF9\u6302\u8F7D\u3002`),L({filename:`${U}.gia`,mimeType:"application/octet-stream",encoding:"base64",data:H.buffer.toString("base64"),warnings:H.warnings})}throw new Error(`unsupported export format: ${g}`)}function di(g){for(let x of g){let I=Un(x);if(!I.path&&!I.source)continue;let M=I.controlId?null:E(I.guid),D=v(M?{...I,...M}:I);M&&D.guid!==I.guid&&C(M,I.guid,D.guid),D.controlId&&!S(D)&&(D.controlId="",D.controlAsset=""),h.push(D)}}function Rl(g,x,I=""){let M=String(g||"").toLowerCase();if(typeof x!="string"||!x)throw new Error("import data is required");let D=Buffer.from(x,"base64"),U,H=[],q={},ee=[];if(M==="json"){try{U=JSON.parse(D.toString("utf8"))}catch{throw new Error("JSON \u6587\u4EF6\u65E0\u6548")}if(U?.project&&(U=U.project),U?.format===Ft&&U?.assets){Ba(U.version);let ne=Bi(U);H.push(...ne.get().migrationWarnings);let de=ne.archiveData();return c.server=de.assets.server,c.client=de.assets.client,i=[...H],l=U.activeAssetType===Y?Y:le,d=String(U.meta?.name||ai(I).replace(/\.json$/i,"")||d),y=de.serverLogic,h=de.assets.scripts,r=de.controlGuidChanges,o=de.scriptSync,m.clear(),L({snapshot:re(),warnings:H,metadata:{format:Ft}})}}else{if(M==="lua")return h.push(v({path:ai(I||"imported.lua"),source:D.toString("utf8"),controlId:""})),L({snapshot:re(),warnings:H,metadata:{assetType:"lua-script"}});if(M==="gia"){if(os(D)){let ye=cs(D);return di(ye.scripts),L({snapshot:re(),warnings:ye.warnings,metadata:ye.metadata})}let ne=ls(D);U=ne.project,H=ne.warnings,q=ne.metadata,ne.clientProject&&(c.client=ft(ne.clientProject),r=r.filter(ye=>ye.controlAsset!==Y),H.push("\u6574\u5408\u5305\u5DF2\u62C6\u56DE\u300CUI\u63A7\u4EF6-\u670D\u52A1\u7AEF\u300D\u4E0E\u300CUI\u63A7\u4EF6-\u5BA2\u6237\u7AEF\u300D\uFF1B\u5BA2\u6237\u7AEF\u6A21\u677F\u8FB9\u754C\u5DF2\u4FDD\u7559\u3002"));let de=new Map,hi=(ye,Ji)=>{ye&&K(ye.root,G=>{for(let se of G.scriptMappingIds||[]){let We=de.get(Number(se));if(We){H.push(`\u811A\u672C GUID ${se} \u540C\u65F6\u6302\u8F7D\u5230\u591A\u4E2A\u63A7\u4EF6\uFF0C\u5DF2\u4FDD\u7559\u201C${We.controlAsset===le?"\u670D\u52A1\u7AEF":"\u5BA2\u6237\u7AEF"}\u201D\u76EE\u6807\u3002`);continue}de.set(Number(se),{controlId:G.id,controlAsset:Ji})}})};hi(ne.project,ne.project.meta.assetType),hi(ne.clientProject,Y),ee=(ne.scripts||[]).map(ye=>de.has(Number(ye.guid))?{...ye,...de.get(Number(ye.guid))}:ye)}else throw new Error(`unsupported import format: ${g}`)}let ke=ft(U,{warnings:H}),xe=Mr(U?.controlGuidChanges);if(xe.some(ne=>ne.controlAsset!==ke.meta.assetType))throw new Error("\u5355\u8D44\u4EA7 JSON \u7684\u7D22\u5F15\u53D8\u66F4\u8BB0\u5F55\u5FC5\u987B\u5C5E\u4E8E\u5F53\u524D\u5BFC\u5165\u8D44\u4EA7");let Le=Mr([...r.filter(ne=>ne.controlAsset!==ke.meta.assetType),...xe]);i=[...H];let Ee=Rt(ke.meta.assetType);c[Ee]=ke,r=Le,l=ke.meta.assetType;let Ue=c[Ee];return I&&(Ue.meta.name=ai(I).replace(/\.(json|gia)$/i,"")||Ue.meta.name,Ue.meta.sourceFile=ai(I),Ue.meta.sourceFormat=M),di(ee),di(U?.scripts||[]),U?.script&&(U.script.path||U.script.source)&&di([U.script]),L({snapshot:re(),warnings:H,metadata:q})}function Nl(g,x){return ja(V(),{op:"pick",x:g,y:x}),re()}function Fl(g){let x=typeof g=="string"&&g?g:"";!x||x===n||(n=x)}function Ol(g){let x=g.source||"";if(!x.trim()&&g.path.trim())try{x=_f(Vf(g.path,n),"utf8")}catch(I){throw new Error(`\u811A\u672C ${g.path} \u8BFB\u53D6\u5931\u8D25: ${I?.message||I}`)}return x}function fi(g={}){let x=O(g.canvasId);x&&(_=x),g.playerCount!==void 0&&g.playerCount!==null&&g.playerCount!==""&&(T=_t(g.playerCount),N>T&&(N=1)),g.viewPlayerIndex!==void 0&&g.viewPlayerIndex!==null&&g.viewPlayerIndex!==""&&(N=nt(g.viewPlayerIndex,T)),w&&Ir(w);let I=h.map(D=>{try{return{id:D.id,guid:D.guid||0,path:D.path||D.id,source:Ol(D),controlId:D.controlId||"",controlAsset:D.controlAsset||""}}catch(U){return{id:D.id,guid:D.guid||0,path:D.path||D.id,source:`error([==[ ${String(U.message).replace(/]=+]/g,"] =]")} ])`,controlId:D.controlId||"",controlAsset:D.controlAsset||""}}}),M=D=>I.filter(U=>{let H={controlId:U.controlId,controlAsset:U.controlAsset},q=U.controlId?S(H):null;return!!(q&&q.key===D)});return w=sc(c.server,{templatesProject:c.client,scripts:I,sceneScripts:M("server"),templateScripts:M("client"),serverConfig:{logic:y},canvasId:_,playerCount:T,viewPlayerIndex:N,language:g.language||""}),ue(g)}function $l(g,x={}){let I=O(g);if(!I)throw new Error("playSetCanvas requires canvasId");return fi({...x,canvasId:I})}function ue(g={}){if(!w)return L({running:!1,tree:[],logs:[],serverLogs:[],serverVars:[]});let x=yr(w,g);return x.running=!0,x.logs=_r(x.logs),x.serverLogs=_r(x.server?.logs||[]),x.serverVars=Rf(x.server,x.playerCount||1),x}function Dl(g,x={}){return w||fi(),Bn(w,g),x.observe===!1?L({running:!0,time:w.runtime.clock.time,frame:w.runtime.clock.frame,paused:!!w.debugPaused,levelTimePaused:!!w.runtime.clock.paused,playerCount:w.playerCount||1,viewPlayerIndex:w.viewPlayerIndex||1}):ue(x)}function zl(g=0){fi();let x=Math.max(0,Number(g)||0);for(let I=0;I<x;I++)Bn(w,1/30);return ue()}function Gl(){return w&&Ir(w),w=null,_="",T=1,N=1,L({running:!1,tree:[],logs:[],serverLogs:[],serverVars:[]})}function Vl(g,x={}){let I=ui();return N=br(I,g),x.observe===!1?null:ue(x)}function Bl(g,x={}){if(!w)throw new Error("play session has not started");return wr(w,g),x.observe===!1?null:ue(x)}function Hl(g,x={}){if(!w)throw new Error("play session has not started");return vr(w,g),x.observe===!1?null:ue(x)}function Ll(g,x,I,M={}){if(!w)throw new Error("play session has not started");return zi(w,g,x,I,M),M.observe===!1?null:ue(M)}function Ul(g={}){return w&&Hn(w).pause(),g.observe===!1?null:ue(g)}function jl(g={}){return w&&Hn(w).resume(),g.observe===!1?null:ue(g)}function ui(){if(!w)throw new Error("play session has not started");return w}function Yl(g,x){let I=ui();if(!g&&!x){let M=ue();return L({vars:M.serverVars||[]})}return L({entityType:String(g||""),name:String(x||""),value:pc(I,g,x)})}function Xl(g,x,I){let M=ui();return xr(M,g,x,I),ue()}function Wl(g,x=[],I="PlayerSelf"){let M=ui();return Er(M,g,x,I),ue()}function Kl(){let g=ue();return L({events:g.history||[],case:Ks(g.history||[],{playerCount:g.playerCount||1})})}function ql(g={}){let x=ue(),I=Oi({name:g.name||"",dt:g.dt,playerCount:g.playerCount||x.playerCount||1,events:g.events||x.history||[],asserts:g.asserts||[]});return L(I)}function Jl(g,x={}){let I=Oi(g);fi({...x,playerCount:x.playerCount||I.playerCount||1});let M=ui();M.recording=!1;try{return yc(Hn(M),g)}finally{M.recording=!0}}function Ql(){if(!w)return{running:!1,paused:!1,time:0,frame:0,playerCount:1,viewPlayerIndex:1};let g=w.runtime.clock;return{running:!0,paused:!!w.debugPaused,levelTimePaused:!!g.paused,time:g.time,frame:g.frame,playerCount:w.playerCount||1,viewPlayerIndex:w.viewPlayerIndex||1}}let ao={get:re,patch:Be,setWorkspace:Fl,exportData:Gt,exportChoices:Ki,exportPreview:qi,importData:Rl,pick:Nl,playStart:fi,playSetCanvas:$l,playSetView:Vl,playGet:ue,playStatus:Ql,playStep:Dl,playRun:zl,playStop:Gl,playKey:Bl,playClick:Hl,playPointer:Ll,playPause:Ul,playResume:jl,playServerGet:Yl,playServerSet:Xl,playServerSend:Wl,playHistory:Kl,playSaveCase:ql,playRunCase:Jl,archiveData:li};return Object.defineProperty(ao,"_project",{enumerable:!1,get:V}),ao}import{createRequire as Lf}from"node:module";function Nr(e,t,i){if(e.fillType!=="Horizontal"&&e.fillType!=="Vertical")return null;let n=Number(e.fillAmount??1),a=Number.isFinite(n)?Math.max(0,Math.min(1,n)):1;if(e.fillType==="Horizontal"){let o=t*a;return{x:e.fillHorizontalType==="Right"?t/2-o:-t/2,y:-i/2,width:o,height:i}}let r=i*a;return{x:-t/2,y:e.fillVerticalType==="Top"?-i/2:i/2-r,width:t,height:r}}function Ac(e,t,i){let n=t?.m_Rect,a=t?.m_RD?.textureRectOffset,r=t?.m_RD?.textureRect,o=Math.round(Number(n?.width)),s=Math.round(Number(n?.height)),c=Math.round(Number(a?.X)),l=Math.round(Number(a?.Y)),d=Math.round(Number(r?.width)),f=Math.round(Number(r?.height)),h=t?.m_RD?.settingsRaw?.packingRotation;if(![o,s,d,f].every(b=>Number.isInteger(b)&&b>0&&b<=8192)||o*s>16777216||!Number.isFinite(c)||!Number.isFinite(l)||c<0||l<0||c+d>o||l+f>s)throw new Error("Invalid sprite dimensions or trim offset");if(h&&h!=="None")throw new Error(`Unsupported sprite packing rotation: ${h}`);let m=i(o,s),p=m.getContext("2d");if(e.width===o&&e.height===s)p.drawImage(e,0,0);else{if(e.width!==d||e.height!==f)throw new Error("Sprite PNG does not match its trim metadata");p.drawImage(e,c,s-l-f)}return m}function _c(e,t,i){let n=Number(t??4294967295)>>>0;if((n&16777215)===16777215)return e;let a=i(e.width,e.height),r=a.getContext("2d");r.drawImage(e,0,0);let o=r.getImageData(0,0,a.width,a.height),s=n>>>16&255,c=n>>>8&255,l=n&255;for(let d=0;d<o.data.length;d+=4)o.data[d]=Math.round(o.data[d]*s/255),o.data[d+1]=Math.round(o.data[d+1]*c/255),o.data[d+2]=Math.round(o.data[d+2]*l/255);return r.putImageData(o,0,0),a}function Bf(e){return!!e?.border&&Object.values(e.border).some(t=>Number.isFinite(t)&&t>0)}function Tc(e,t){let i=typeof t=="object"?t?.Name:t;return Bf(e)&&i!=="Basic"?"Stretch":"Basic"}function Mc(e){if(!e)return null;let t=Number(e.m_Rect?.width),i=Number(e.m_Rect?.height);if(![t,i].every(a=>Number.isFinite(a)&&a>0&&a<=8192)||t*i>16777216)throw new Error("Invalid image metadata dimensions");let n={};for(let[a,r]of[["left","X"],["bottom","Y"],["right","Z"],["top","W"]]){let o=Number(e.m_Border?.[r]??0);if(!Number.isFinite(o))throw new Error("Invalid image border");n[a]=Math.max(0,o)}return{width:t,height:i,border:n}}function Hf(e,t,i,n){t=Number.isFinite(t)?Math.max(0,t):0,i=Number.isFinite(i)?Math.max(0,i):0;let a=Math.min(1,e/(t+i||1));t*=a,i*=a;let r=Math.min(1,n/(t+i||1));return{source:[0,t,e-i,e],target:[0,t*r,n-i*r,n]}}var Pc=new WeakMap;function Rc(e,t,i,n,a){let r=Math.max(0,i),o=Math.max(0,n),s=Math.min(1,4096/Math.max(1,r),4096/Math.max(1,o)),c=Math.max(1,Math.round(r*s)),l=Math.max(1,Math.round(o*s)),d=a(c,l),f=d.getContext("2d");if(!r||!o)return d;let h=Pc.get(e);if(!h){let w=a(e.width,e.height),_=w.getContext("2d");_.drawImage(e,0,0),h=_.getImageData(0,0,e.width,e.height),Pc.set(e,h)}let m=f.createImageData(c,l),p=h.data,b=(w,_,T,N,O,V)=>{let{source:$,target:S}=Hf(_,T,N,O);return Array.from({length:V},(A,E)=>{let C=(E+.5)*O/V,z=C<S[1]?0:C<S[2]?1:2,k=S[z+1]>S[z]?(C-S[z])/(S[z+1]-S[z]):0,P=Math.max(0,Math.min(w-1,($[z]+k*($[z+1]-$[z]))*w/_-.5)),B=Math.floor(P);return[B,Math.min(w-1,B+1),P-B]})},v=b(e.width,t.width,t.border.left,t.border.right,r,c),y=b(e.height,t.height,t.border.top,t.border.bottom,o,l);for(let w=0;w<l;w++)for(let _=0;_<c;_++){let[T,N,O]=v[_],[V,$,S]=y[w],A=(V*e.width+T)*4,E=(V*e.width+N)*4,C=($*e.width+T)*4,z=($*e.width+N)*4,k=p[A+3]*(1-O)*(1-S),P=p[E+3]*O*(1-S),B=p[C+3]*(1-O)*S,j=p[z+3]*O*S,ae=k+P+B+j,X=(w*c+_)*4;m.data[X+3]=Math.round(ae);for(let ie=0;ie<3;ie++)m.data[X+ie]=ae?Math.round((p[A+ie]*k+p[E+ie]*P+p[C+ie]*B+p[z+ie]*j)/ae):0}return f.putImageData(m,0,0),d}function Nc(e){let t=Number(e)>>>0;return`rgba(${t>>>16&255},${t>>>8&255},${t&255},${(t>>>24)/255})`}function Fc(e,t,i,n,a=Si){let r=t.textLayout;if(!r?.richLines||i<=0||n<=0)return;let o=t.horizontalAlignment==="Right"?1:t.horizontalAlignment==="Middle"?.5:0,s=t.verticalAlignment==="Bottom"?1:t.verticalAlignment==="Middle"?.5:0,c=t.kind==="textwindow"?t.scroll:null,l=r.visibleLineCount??r.richLines.length,d=r.visibleContentHeight??r.contentHeight,f=t.kind==="textwindow"&&r.contentHeight>n?-(c?.offset||0):s*(n-d);e.save(),e.beginPath(),e.rect(0,0,i,n),e.clip(),e.textAlign="left",e.textBaseline="alphabetic",e.lineJoin="round",e.strokeStyle=Nc(t.outlineColor??4278190080);for(let h=0;h<l;h++){let m=r.richLines[h],p=f+m.top;if(p+m.height<0||p>n)continue;let b=2+o*(r.textWidth-m.width);for(let v of m.runs)e.font=hn(v,a||Si),e.fillStyle=Nc(v.color??t.fontColor??4294967295),t.enableOutline&&(e.lineWidth=Math.max(2,v.fontSize*.12),e.strokeText(v.text,b+v.x,p+m.baseline)),e.fillText(v.text,b+v.x,p+m.baseline)}e.restore()}var Uf=Lf(import.meta.url),jf=[0,-.5,.5,.5,-.5,.5],Yf=[0,-.5,.12,-.12,.5,0,.12,.12,0,.5,-.12,.12,-.5,0,-.12,-.12],Xf=[0,-.5,.11,-.15,.48,-.15,.18,.07,.29,.41,0,.2,-.29,.41,-.18,.07,-.48,-.15,-.11,-.15],Fr=Buffer.from([137,80,78,71,13,10,26,10]),Wf=new Set(["image","textbox","textwindow","button","grid"]),jn={cursor:"\u5149\u6807\u68C0\u6D4B\u533A\u57DF",reference:"\u6A21\u677F\u5F15\u7528\u63A7\u4EF6",grid:"\u7F51\u683C\u89C6\u7A97",button:"\u9884\u8BBE\u6309\u94AE",keyhint:"\u6309\u952E\u63D0\u793A",animation:"\u754C\u9762\u52A8\u6548",fullscreen:"\u5168\u5C4F\u52A8\u6548"},Yn=null;function Hi(){if(Yn)return Yn;try{Yn=Uf("@napi-rs/canvas")}catch(e){let t=e?.message||String(e);throw new Error(`Host screenshot renderer requires @napi-rs/canvas (${t})`)}return Yn}function W(e,t=0){let i=Number(e);return Number.isFinite(i)?i:t}function Wn(e,t=4294967295){let i=Number(e??t)>>>0;return{r:i>>>16&255,g:i>>>8&255,b:i&255,a:(i>>>24&255)/255}}function Ot(e,t=1){return`rgba(${e.r},${e.g},${e.b},${Math.max(0,Math.min(1,e.a*t))})`}function $c(e,t,i=1){let n=Math.max(1,Math.round(W(e,1))),a=Math.max(1,Math.round(W(t,1))),r=Math.max(1,Math.min(2,W(i,1)));return{width:n,height:a,pixelWidth:Math.max(1,Math.round(n*r)),pixelHeight:Math.max(1,Math.round(a*r)),pixelRatio:r}}function Dc(e){let t=Buffer.from(e.toBuffer("image/png"));if(t.length<Fr.length||!t.subarray(0,Fr.length).equals(Fr))throw new Error("Host screenshot renderer did not produce a PNG");return t}function Kf(e){return e==="triangle"?jf:e==="fourstar"?Yf:Xf}function qf(e,t,i,n,a){let r=Kf(t);e.beginPath();for(let o=0;o<r.length;o+=2){let s=r[o]*i,c=r[o+1]*n;o===0?e.moveTo(s,c):e.lineTo(s,c)}e.closePath(),e.fillStyle=Ot(a),e.fill()}function Or(e,t,i){let n=t?.matrix,a=n&&typeof n=="object"?[n.a,n.b,n.c,n.d,n.tx,n.ty].map(Number):null,r=t?.pressed?.98:1;if(a&&a.every(Number.isFinite)){let[o,s,c,l,d,f]=a;e.transform(o*r,-s*r,-c*r,l*r,d,i-f);return}e.translate(W(t.left)+W(t.width)/2,i-W(t.bottom)-W(t.height)/2),e.rotate(-W(t.rotationZ)*Math.PI/180),e.scale(r,r)}function Jf(e,t,i,n,a,r){if(typeof e.roundRect=="function"){e.roundRect(t,i,n,a,r);return}let o=Math.max(0,Math.min(r,n/2,a/2));e.moveTo(t+o,i),e.arcTo(t+n,i,t+n,i+a,o),e.arcTo(t+n,i+a,t,i+a,o),e.arcTo(t,i+a,t,i,o),e.arcTo(t,i,t+n,i,o),e.closePath()}function zc(e,t,i,n){let a=Wn(t.bgColor,16777215);e.fillStyle=Ot(a),e.fillRect(-i/2,-n/2,i,n);let r=t.textLayout||et(t,i,n);if(r.richLines){e.save(),e.translate(-i/2,-n/2),Fc(e,{...t,textLayout:r},i,n,Kt()),e.restore();return}let o=r.fontSize,s=Wn(t.fontColor,4294967295),c=t.horizontalAlignment==="Right"?1:t.horizontalAlignment==="Middle"?.5:0,l=t.verticalAlignment==="Bottom"?1:t.verticalAlignment==="Middle"?.5:0;e.save(),e.beginPath(),e.rect(-i/2,-n/2,i,n),e.clip(),e.font=`${o}px ${Kt()}`,e.fillStyle=Ot(s),e.textAlign=c===1?"right":c===.5?"center":"left";let d=t.kind==="textwindow"?t.scroll:null;if(e.textBaseline=d?"top":l===1?"bottom":l===.5?"middle":"top",t.enableOutline){let v=Wn(t.outlineColor,4278190080);e.strokeStyle=Ot(v),e.lineWidth=Math.max(2,o*.12),e.lineJoin="round"}let f=d?-i/2+2+c*d.textWidth:c===0?-i/2+2:c===1?i/2-2:0,h=l===0?-n/2:l===1?n/2:0,m=d?.lines||r.lines.slice(0,r.visibleLineCount??r.lines.length),p=d?.lineHeight||r.lineHeight,b=d?-n/2-d.offset+(d.max>0?0:l*(n-d.contentLength)):l===.5?h-(m.length-1)*p/2:l===1?h-(m.length-1)*p:h;for(let v=0;v<m.length;v+=1){let y=b+v*p;d&&(y+p<-n/2||y>n/2)||(t.enableOutline&&e.strokeText(m[v],f,y),e.fillText(m[v],f,y))}e.restore()}function Qf(e,t,i,n){let a=ii(t.scroll,i,n);if(a)for(let[r,o]of[[a.track,"#263447"],[a.thumb,"#90aecb"]])e.fillStyle=o,e.fillRect(r.x,r.y,r.width,r.height)}function Gc(e,t,i,n){e.beginPath(),Jf(e,-i/2,-n/2,i,n,6),e.fillStyle="#3268cf",e.fill(),e.strokeStyle="rgba(112,160,255,0.8)",e.lineWidth=1,e.stroke(),t.pressed&&(e.fillStyle="rgba(0,0,0,0.28)",e.fill())}function Vc(e,t,i,n,a){let r=Wn(t.imageColor,4294967295),o=tn(t.imageId,t.imageSource),s=a?.images?.get(o);if(t.primitive==="sprite"&&s){let c=a.imageMetadata?.get(o),l=Tc(c,t.imageType),d=`${o}:${Number(t.imageColor??4294967295)&16777215}:${l}:${l==="Stretch"?`${i}:${n}`:""}`,f=a.tints.get(d);if(!f){let h=l==="Stretch"?Rc(s,c,i,n,Hi().createCanvas):s;f=_c(h,t.imageColor,Hi().createCanvas),a.tints.set(d,f)}e.globalAlpha*=r.a,e.drawImage(f,-i/2,-n/2,i,n);return}if(t.primitive==="missing"||t.primitive==="sprite"){e.fillStyle="rgba(72,34,40,0.36)",e.fillRect(-i/2,-n/2,i,n),e.strokeStyle="#ff7481",e.lineWidth=1,e.strokeRect(-i/2+.5,-n/2+.5,Math.max(0,i-1),Math.max(0,n-1));return}if(t.primitive==="circle"){e.beginPath(),e.ellipse(0,0,i/2,n/2,0,0,Math.PI*2),e.fillStyle=Ot(r),e.fill();return}if(t.primitive==="ring"){e.beginPath(),e.ellipse(0,0,Math.max(1,i/2-3.5),Math.max(1,n/2-3.5),0,0,Math.PI*2),e.strokeStyle=Ot(r),e.lineWidth=7,e.stroke();return}if(t.primitive==="triangle"||t.primitive==="fourstar"||t.primitive==="fivestar"){qf(e,t.primitive,i,n,r);return}e.fillStyle=Ot(r),e.fillRect(-i/2,-n/2,i,n)}function Zf(e,t,i,n){let a=Math.max(0,W(t.sourceWidth,W(t.width))),r=Math.max(0,W(t.sourceHeight,W(t.height)));e.save();for(let o of t.clipPolygons||[])e.beginPath(),o.forEach((s,c)=>c?e.lineTo(s.x,i-s.y):e.moveTo(s.x,i-s.y)),e.closePath(),e.clip();if(Or(e,t,i),t.kind==="textbox"||t.kind==="textwindow")zc(e,t,a,r);else if(t.kind==="button")Gc(e,t,a,r);else if(t.kind!=="grid"){let o=Nr(t,a,r);o&&(e.beginPath(),e.rect(o.x,o.y,o.width,o.height),e.clip()),Vc(e,t,a,r,n)}Qf(e,t,a,r),e.restore()}function Bc(e,t,i,{checker:n=!1}={}){if(n){e.fillStyle="#28313e",e.fillRect(0,0,t,i);let r=16;for(let o=0;o<i;o+=r)for(let s=0;s<t;s+=r)(s/r+o/r)%2===0&&(e.fillStyle="rgba(255,255,255,0.04)",e.fillRect(s,o,r,r));e.strokeStyle="#40b8cf",e.lineWidth=1,e.strokeRect(.5,.5,t-1,i-1);return}let a=e.createRadialGradient(t/2,i*.45,8,t/2,i/2,Math.max(t,i)*.72);a.addColorStop(0,"#123a6b"),a.addColorStop(.72,"#061934"),a.addColorStop(1,"#071426"),e.fillStyle=a,e.fillRect(0,0,t,i)}function eu(e,t){return{a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,tx:e.a*t.tx+e.c*t.ty+e.tx,ty:e.b*t.tx+e.d*t.ty+e.ty}}function Oc(e){let t=e?.matrix;return!t||typeof t!="object"?{a:1,b:0,c:0,d:1,tx:0,ty:0}:{a:W(t.a,1),b:W(t.b),c:W(t.c),d:W(t.d,1),tx:W(t.tx),ty:W(t.ty)}}function tu(e){let t=Array.isArray(e?.nodes)?e.nodes:[],i=new Map;for(let o of t){if(!o||o.id===void 0||o.id===null)continue;let s=o.parent==null?"":String(o.parent),c=i.get(s);c?c.push(o):i.set(s,[o])}for(let o of i.values())o.sort((s,c)=>W(s.z)-W(c.z));let n=[];function a(o,s,c,l){if(!Wf.has(o.kind))return;let d=Math.abs(W(o.sourceWidth)*Math.hypot(s.a,s.b)),f=Math.abs(W(o.sourceHeight)*Math.hypot(s.c,s.d));n.push({...o,left:s.tx-d/2,bottom:s.ty-f/2,width:d,height:f,rotationZ:Math.atan2(s.b,s.a)*180/Math.PI,matrix:{a:s.a,b:s.b,c:s.c,d:s.d,tx:s.tx,ty:s.ty},...c.length?{clipPolygons:c}:{},...l.length?{masks:l}:{}})}function r(o,s,c=null,l=[],d=[]){let f=i.get(o)||[];for(let h=f.length-1;h>=0;h-=1){let m=f[h],p=s?eu(s,Oc(m)):Oc(m),b=l;if(m.clipToParent&&s&&c){let w=c.sourceWidth/2,_=c.sourceHeight/2;b=[...l,[[-w,-_],[w,-_],[w,_],[-w,_]].map(([T,N])=>({x:s.a*T+s.c*N+s.tx,y:s.b*T+s.d*N+s.ty}))]}let v=xt(m,p),y=v?[...d,v]:d;m.kind!=="grid"&&a(m,p,b,y),r(String(m.id),p,m,b,y),m.kind==="grid"&&a(m,p,b,y)}}return r("",null),n}function Hc(e,t,i,n={}){return au(tu(e),t,i,n)}function iu(e,t,i){if(!(e.width>0&&e.height>0)||!qe(e.matrix))return null;let n=[[-1,-1],[1,-1],[1,1],[-1,1]].map(([c,l])=>{let d=Ie(e.matrix,c*e.width/2,l*e.height/2);return{x:d.x*i.pixelRatio,y:(i.height-d.y)*i.pixelRatio}}),a=Math.max(t.x,Math.floor(Math.min(...n.map(c=>c.x)))),r=Math.max(t.y,Math.floor(Math.min(...n.map(c=>c.y)))),o=Math.min(t.x+t.canvas.width,Math.ceil(Math.max(...n.map(c=>c.x)))),s=Math.min(t.y+t.canvas.height,Math.ceil(Math.max(...n.map(c=>c.y))));return o>a&&s>r?{x:a,y:r,width:o-a,height:s-r}:null}function nu(e,t,i,n){let a=t.canvas.width,r=t.canvas.height,o=t.ctx.getImageData(0,0,a,r).data,s=t.x-e.x,c=t.y-e.y,l=e.ctx.getImageData(s,c,a,r),d=l.data,f=qe(i.matrix);for(let h=0;h<r;h++){let m=n.height-(t.y+h+.5)/n.pixelRatio;for(let p=0;p<a;p++){let b=(h*a+p)*4;if(!o[b+3])continue;let v=(t.x+p+.5)/n.pixelRatio,y=f.a*v+f.c*m+f.tx,w=f.b*v+f.d*m+f.ty,_=Ho(y,w,i),T=Math.round(o[b+3]*_)/255;if(!T)continue;let N=d[b+3]/255,O=T+N*(1-T);for(let V=0;V<3;V++)d[b+V]=Math.round((o[b+V]*T+d[b+V]*N*(1-T))/O);d[b+3]=Math.round(O*255)}}e.ctx.save(),e.ctx.setTransform(1,0,0,1,0,0),e.ctx.putImageData(l,s,c),e.ctx.restore()}function $r(e,t,i,n,a=Zf){for(let r of t){if(r.item){a(e.ctx,r.item,i.height,n);continue}let o=iu(r.mask,e,i);if(!o)continue;let s=Hi().createCanvas(o.width,o.height),c=s.getContext("2d");c.setTransform(i.pixelRatio,0,0,i.pixelRatio,-o.x,-o.y);let l={canvas:s,ctx:c,x:o.x,y:o.y};$r(l,r.children,i,n,a),nu(e,l,r.mask,i)}}function au(e,t,i,n={}){let{createCanvas:a}=Hi(),r=$c(t,i,n.scale),o=a(r.pixelWidth,r.pixelHeight),s=o.getContext("2d");s.scale(r.pixelRatio,r.pixelRatio),n.background!=="transparent"&&Bc(s,r.width,r.height);let c=Array.isArray(e)?e:[],l={images:n.images,imageMetadata:n.imageMetadata,tints:new Map};return $r({canvas:o,ctx:s,x:0,y:0},Pa(c),r,l),{data:Dc(o),width:r.width,height:r.height,pixelWidth:r.pixelWidth,pixelHeight:r.pixelHeight}}function Lc(e){if(e.renderMatrix){let t=Ie(e.renderMatrix,e.centerX,e.centerY);return{kind:e.kind,width:e.width,height:e.height,matrix:{...e.renderMatrix,tx:t.x,ty:t.y}}}return{kind:e.kind,left:W(e.renderLeft,e.left),bottom:W(e.renderBottom,e.bottom),width:Math.max(0,W(e.renderWidth,e.width)),height:Math.max(0,W(e.renderHeight,e.height)),rotationZ:W(e.renderRotationZ,e.rotationZ)}}function Xn(e,t,i){let n=String(t||"");if(!n)return;e.font=`10px ${Kt()}`,e.textAlign="center",e.textBaseline="middle";let a=e.measureText(n),r=Math.min(i-4,Math.max(24,a.width+8)),o=16;e.fillStyle="rgba(17,25,37,0.66)",e.fillRect(-r/2,-o/2,r,o),e.fillStyle="#e7edf5",e.fillText(n,0,0)}function ru(e,t,i,n){let a=Lc(t);if(a.width<=0||a.height<=0)return;e.save(),Or(e,a,i);let r=-a.width/2,o=-a.height/2;if(t.kind==="image"){e.save();let s=Math.max(0,W(t.width,a.width)),c=Math.max(0,W(t.height,a.height));e.scale(s?a.width/s:1,c?a.height/c:1);let l=t.enableFill?Nr(t,s,c):null;l&&(e.beginPath(),e.rect(l.x,l.y,l.width,l.height),e.clip()),Vc(e,t,s,c,n),e.restore()}else if(t.kind==="textbox"||t.kind==="textwindow")zc(e,t,a.width,a.height);else if(t.kind==="button")Gc(e,t,a.width,a.height),Xn(e,t.name||jn.button,a.width);else if(t.kind==="cursor")e.setLineDash([6,4]),e.strokeStyle="rgba(74,142,181,0.7)",e.fillStyle="rgba(74,142,181,0.1)",e.fillRect(r,o,a.width,a.height),e.strokeRect(r,o,a.width,a.height),Xn(e,t.name||jn.cursor,a.width);else if(t.kind==="grid"){e.strokeStyle="rgba(106,146,189,0.55)",e.strokeRect(r,o,a.width,a.height),e.beginPath();for(let s=20;s<a.width;s+=20)e.moveTo(r+s,o),e.lineTo(r+s,o+a.height);for(let s=20;s<a.height;s+=20)e.moveTo(r,o+s),e.lineTo(r+a.width,o+s);e.stroke(),Xn(e,t.name||jn.grid,a.width)}else t.kind!=="container"&&t.kind!=="server-container"?(e.setLineDash(t.kind==="reference"||t.kind==="animation"||t.kind==="fullscreen"?[4,4]:[]),e.strokeStyle="rgba(203,218,237,0.55)",e.strokeRect(r,o,a.width,a.height),Xn(e,t.name||jn[t.kind]||t.kind,a.width)):(e.strokeStyle="rgba(78,165,230,0.42)",e.strokeRect(r,o,a.width,a.height));e.restore()}function Uc(e,t={}){let{createCanvas:i}=Hi(),n=e?.canvas||{},a=$c(n.width||1600,n.height||900,t.scale),r=i(a.pixelWidth,a.pixelHeight),o=r.getContext("2d");o.scale(a.pixelRatio,a.pixelRatio),Bc(o,a.width,a.height,{checker:!0});let s=(Array.isArray(e?.boxes)?e.boxes:[]).filter(f=>f&&f.kind!=="server-container"&&f.visible!==!1&&f.visibleInHierarchy!==!1),c=e?.selectedId,l={images:t.images,imageMetadata:t.imageMetadata,tints:new Map};$r({canvas:r,ctx:o,x:0,y:0},Pa(s),a,l,ru);let d=s.find(f=>f.id===c);if(d&&d.kind!=="container"){let f=Lc(d);o.save(),Or(o,f,a.height),o.strokeStyle="#61b9ff",o.lineWidth=2,o.strokeRect(-f.width/2,-f.height/2,f.width,f.height),o.restore()}return{data:Dc(r),page:e?.asset?.type==="client-control-template"?"UI\u63A7\u4EF6-\u5BA2\u6237\u7AEF":"UI \u7F16\u8F91",width:a.width,height:a.height,pixelWidth:a.pixelWidth,pixelHeight:a.pixelHeight}}import{closeSync as ou,existsSync as Kn,openSync as su,opendirSync as cu,readSync as lu,realpathSync as ri,statSync as Yc}from"node:fs";import{basename as du,dirname as jc,isAbsolute as zr,join as fu,relative as Xc,resolve as ji}from"node:path";var uu="qxqy-simulator-save",Wc=new Set(["node_modules",".git","dist",".dsh","coverage"]),Li=50,Kc=4096,Dr=(e,t)=>{let i=Number(process.env[e]);return Number.isSafeInteger(i)&&i>0?i:t},hu=()=>({entries:Dr("QXQY_SCAN_ENTRY_LIMIT",1e4),directories:Dr("QXQY_SCAN_DIR_LIMIT",1e3),depth:Dr("QXQY_SCAN_DEPTH_LIMIT",8)});function $t(e=""){let t=ji(String(e||process.cwd()));if(!Kn(t))throw new Error(`workspace does not exist: ${t}`);if(!Yc(t).isDirectory())throw new Error(`workspace is not a directory: ${t}`);return ri(t)}function Ui(e,t,i=!1){let n=Xc(e,t);if(!i&&!n||n.startsWith("..")||zr(n))throw new Error("path must stay inside the configured workspace");return n}function Fe(e,t){let i=String(t||"").trim();if(!i||zr(i))throw new Error("path must be a non-empty workspace-relative path");let n=ri(ji(e)),a=ji(n,i);if(Ui(n,a),!Kn(a))throw new Error(`file does not exist: ${i}`);let r=ri(a);return Ui(n,r),r}function ge(e,t){let i=String(t||"").trim();if(!i||zr(i))throw new Error("path must be a non-empty workspace-relative path");let n=ri(ji(e)),a=ji(n,i);Ui(n,a);let r=jc(a);for(;!Kn(r);){let o=jc(r);if(o===r)throw new Error("unable to resolve output directory");r=o}return Ui(n,ri(r),!0),Kn(a)&&Ui(n,ri(a)),a}function mu(e,t=Kc){let i=Buffer.alloc(t),n=su(e,"r");try{let a=lu(n,i,0,t,0);return i.subarray(0,a).toString("utf8")}finally{ou(n)}}function qc(e,t,i,n,a){let r=a.limits;if(n>r.depth){a.depthLimitedDirectories+=1;return}if(a.scannedDirectories>=r.directories){a.directoryLimitReached=!0;return}let o;try{a.scannedDirectories+=1,o=cu(e)}catch{a.unreadableEntries+=1;return}try{let s;for(;s=o.readSync();){if(a.scannedEntries>=r.entries){a.entryLimitReached=!0;return}if(a.scannedEntries+=1,s.name.startsWith(".")||s.isDirectory()&&Wc.has(s.name)){a.skippedEntries+=1,s.isDirectory()&&(a.skippedDirectories+=1);continue}let c=fu(e,s.name);if(s.isDirectory()){if(qc(c,t,i,n+1,a),a.entryLimitReached||a.directoryLimitReached)return;continue}if(!(!s.isFile()||!/\.json$/i.test(s.name))){a.scannedJsonFiles+=1;try{let l=Yc(c),d=mu(c);if(!d.includes(uu))continue;let f=d.match(/"name"\s*:\s*("(?:\\.|[^"\\])*")/)?.[1],h=du(s.name,".json");if(f)try{h=JSON.parse(f)||h}catch{}i.push({path:Xc(t,c).replaceAll("\\","/"),name:h,bytes:l.size,mtime:l.mtimeMs})}catch{a.unreadableEntries+=1}}}}catch{a.unreadableEntries+=1}finally{try{o.closeSync()}catch{a.unreadableEntries+=1}}}function qn(e){let t=$t(e),i=[],n={truncated:!1,warnings:[],scannedDirectories:0,scannedEntries:0,scannedJsonFiles:0,matchedArchives:0,skippedDirectories:0,skippedEntries:0,unreadableEntries:0,depthLimitedDirectories:0,entryLimitReached:!1,directoryLimitReached:!1,limits:{archives:Li,headBytes:Kc,...hu()},policy:{excludedDirectories:[...Wc],hiddenEntries:!1,symlinks:!1,validatesJson:!1}};return qc(t,t,i,0,n),i.sort((a,r)=>r.mtime-a.mtime||a.path.localeCompare(r.path)),n.matchedArchives=i.length,i.length>Li&&n.warnings.push(`\u53D1\u73B0 ${i.length} \u4E2A\u5B58\u6863\uFF0C\u4EC5\u663E\u793A\u4FEE\u6539\u65F6\u95F4\u6700\u65B0\u7684 ${Li} \u4E2A\uFF1B\u5176\u4ED6\u5B58\u6863\u53EF\u901A\u8FC7\u6307\u5B9A\u8DEF\u5F84\u6253\u5F00\u3002`),(n.entryLimitReached||n.directoryLimitReached)&&n.warnings.push(`\u81EA\u52A8\u53D1\u73B0\u8FBE\u5230\u626B\u63CF\u4E0A\u9650\uFF08${n.limits.entries} \u9879 / ${n.limits.directories} \u4E2A\u76EE\u5F55\uFF09\uFF0C\u5217\u8868\u53EF\u80FD\u4E0D\u5B8C\u6574\uFF1B\u53EF\u901A\u8FC7\u6307\u5B9A\u8DEF\u5F84\u6253\u5F00\u5B58\u6863\u3002`),n.depthLimitedDirectories&&n.warnings.push(`\u81EA\u52A8\u53D1\u73B0\u8DF3\u8FC7 ${n.depthLimitedDirectories} \u4E2A\u8D85\u8FC7 ${n.limits.depth} \u5C42\u7684\u76EE\u5F55\uFF1B\u53EF\u901A\u8FC7\u6307\u5B9A\u8DEF\u5F84\u6253\u5F00\u5176\u4E2D\u7684\u5B58\u6863\u3002`),n.skippedEntries&&n.warnings.push("\u81EA\u52A8\u53D1\u73B0\u8DF3\u8FC7\u9690\u85CF\u9879\u53CA\u751F\u6210\u76EE\u5F55\uFF08\u5982 node_modules\u3001dist\uFF09\uFF1B\u53EF\u901A\u8FC7\u6307\u5B9A\u8DEF\u5F84\u6253\u5F00\u5176\u4E2D\u7684\u5B58\u6863\u3002"),n.unreadableEntries&&n.warnings.push(`\u81EA\u52A8\u53D1\u73B0\u65E0\u6CD5\u8BFB\u53D6 ${n.unreadableEntries} \u4E2A\u6587\u4EF6\u6216\u76EE\u5F55\uFF1B\u8BF7\u68C0\u67E5\u8BBF\u95EE\u6743\u9650\uFF0C\u6216\u901A\u8FC7\u6307\u5B9A\u8DEF\u5F84\u67E5\u770B\u5177\u4F53\u9519\u8BEF\u3002`),n.truncated=i.length>Li||n.entryLimitReached||n.directoryLimitReached||n.depthLimitedDirectories>0,{bound:!0,workspace:t,archives:i.slice(0,Li),discovery:n}}import{readFileSync as pu}from"node:fs";import{homedir as bu}from"node:os";import{join as gu}from"node:path";var yu={"zh-cn":"LanguageChs",chs:"LanguageChs","zh-tw":"LanguageCht",cht:"LanguageCht",en:"LanguageEng","en-us":"LanguageEng",eng:"LanguageEng",ja:"LanguageJpn","ja-jp":"LanguageJpn",jp:"LanguageJpn",ko:"LanguageKor","ko-kr":"LanguageKor",kr:"LanguageKor",fr:"LanguageFra",fra:"LanguageFra",de:"LanguageDeu",deu:"LanguageDeu",es:"LanguageSpa",spa:"LanguageSpa",pt:"LanguagePor",por:"LanguagePor",ru:"LanguageRus",rus:"LanguageRus",th:"LanguageTha",tha:"LanguageTha",vi:"LanguageVie",vie:"LanguageVie",id:"LanguageInd",ind:"LanguageInd",tr:"LanguageTur",tur:"LanguageTur",it:"LanguageIta",ita:"LanguageIta"};function wu(e){let i=[...String(e||"").matchAll(/Request to set language:([A-Za-z0-9_-]+)/g)].at(-1)?.[1]?.toLowerCase();return yu[i]||null}function vu(){return gu(bu(),"AppData","LocalLow","miHoYo","\u539F\u795E","output_log.txt")}function Jc(e=vu()){try{return wu(pu(e,"utf8"))}catch{return null}}import{existsSync as Br,lstatSync as Su,mkdirSync as Qc,readFileSync as Jn,readdirSync as xu,realpathSync as Zc,renameSync as Eu,rmSync as Iu,statSync as ea,writeFileSync as el}from"node:fs";import{createHash as Cu,randomUUID as tl}from"node:crypto";import{homedir as ku}from"node:os";import{basename as Au,dirname as Qn,isAbsolute as _u,join as Zn,relative as Pu}from"node:path";var Ge=e=>Cu("sha256").update(e).digest("hex"),Gr=e=>Br(e)?Ge(Jn(e)):null,Vr=(e,t)=>{let i=Pu(e,t);return!_u(i)&&i!==".."&&!i.startsWith(`..${process.platform==="win32"?"\\":"/"}`)};function il(e,t){let i=ge(e,t),n=i;for(;n!==e;){try{if(Su(n).isSymbolicLink())throw new Error("\u5B9E\u673A\u76EE\u6807\u4E0D\u80FD\u5305\u542B\u7B26\u53F7\u94FE\u63A5\u6216\u76EE\u5F55\u8054\u63A5")}catch(a){if(a.code!=="ENOENT")throw a}n=Qn(n)}if(Br(i)&&!ea(i).isFile())throw new Error("\u5B9E\u673A\u76EE\u6807\u4E0D\u662F\u666E\u901A\u6587\u4EF6");return i}function nl(e=Zn(ku(),"AppData","LocalLow","miHoYo","\u539F\u795E","BeyondLocal")){let t=n=>{try{return xu(n,{withFileTypes:!0}).filter(a=>a.isDirectory()&&/^\d+$/.test(a.name)).map(a=>a.name)}catch{return[]}},i=[];for(let n of t(e)){let a=Zn(e,n,"Beyond_Local_Save_Level");for(let r of t(a)){let o=Zn(a,r,"external_lua_file","default_import_file");Br(o)&&ea(o).isDirectory()&&i.push({uid:n,editorId:r,path:o})}}return{candidates:i}}var ta=class{constructor(t){this.controller=t,this.plan=null,this.lastResult=null}preview(){let t=this.controller,i=t.studio.archiveData(),n=gi(i.scriptSync);if(!n)throw new Error("\u8BF7\u5148\u914D\u7F6E\u5B9E\u673A\u811A\u672C\u76EE\u5F55");let a=Zc(t.activeWorkspacePath()),r=Zc(n.clientImportRoot);if(!ea(r).isDirectory())throw new Error("\u5B9E\u673A\u5BFC\u5165\u6839\u76EE\u5F55\u4E0D\u5B58\u5728");let o=n.workspaceDir?Fe(a,n.workspaceDir):a;if(!ea(o).isDirectory())throw new Error("\u5DE5\u4F5C\u533A\u811A\u672C\u76EE\u5F55\u4E0D\u5B58\u5728");if(Vr(o,r)||Vr(r,o))throw new Error("\u5DE5\u4F5C\u533A\u811A\u672C\u76EE\u5F55\u4E0E\u5B9E\u673A\u76EE\u5F55\u4E0D\u80FD\u91CD\u53E0");let s=new Map,c=i.assets.scripts.map(d=>{let f={id:d.id,path:d.path,sourceKind:d.source.trim()?"\u5B58\u6863\u6E90\u7801":"\u5DE5\u4F5C\u533A\u6587\u4EF6"};try{let h=on(d.path);if(!/\.lua$/i.test(h))throw new Error("\u811A\u672C\u8DEF\u5F84\u5FC5\u987B\u4EE5 .lua \u7ED3\u5C3E");let m=n.workspaceDir?`${n.workspaceDir}/`:"";if(!h.startsWith(m))throw new Error("\u811A\u672C\u4E0D\u5728\u6240\u914D\u7F6E\u7684\u5DE5\u4F5C\u533A\u811A\u672C\u76EE\u5F55\u4E2D");let p=[n.clientSubdir,h.slice(m.length)].filter(Boolean).join("/"),b=il(r,p),v=b.toLowerCase();s.set(v,(s.get(v)||0)+1);let y=null,w="";try{y=Jn(Fe(a,h),"utf8")}catch(N){w=N.message}if(!d.source.trim()&&y===null)throw new Error(w);let _=d.source.trim()?d.source:y,T=Gr(b);return{...f,target:b,targetRelative:p,source:_,diskSource:y,diskError:w,sourceMismatch:!!(d.source.trim()&&y!==null&&d.source!==y),beforeSource:T===null?"":Jn(b,"utf8"),beforeHash:T,sourceHash:Ge(_),status:T===null?"\u65B0\u589E":T===Ge(_)?"\u672A\u53D8\u5316":"\u8986\u76D6"}}catch(h){return{...f,status:"\u9519\u8BEF",error:h.message}}});for(let d of c)d.target&&s.get(d.target.toLowerCase())>1&&(d.status="\u9519\u8BEF",d.error="\u591A\u4E2A\u811A\u672C\u6620\u5C04\u5230\u540C\u4E00\u76EE\u6807\u6587\u4EF6");let l=Ge(JSON.stringify({archive:i,workspace:a,root:r,rows:c}));return this.plan={id:tl(),fingerprint:l,root:r,workspace:a,rows:c,pendingGuidChanges:i.controlGuidChanges.length,createdAt:new Date().toISOString()},this.plan}apply({planId:t,scriptIds:i,confirmed:n}){let a=this.plan;if(n!==!0||!a||a.id!==t)throw new Error("\u8BF7\u5148\u68C0\u67E5\u5DEE\u5F02\u5E76\u786E\u8BA4\u672C\u6B21\u590D\u5236");let r=this.preview();if(this.plan=null,r.fingerprint!==a.fingerprint)throw new Error("\u5185\u5BB9\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5");if(a.pendingGuidChanges)throw new Error("\u8BF7\u5148\u6838\u5BF9\u5E76\u786E\u8BA4\u63A7\u4EF6\u7D22\u5F15\u7684 Lua \u5F15\u7528\u53D8\u66F4");if(!Array.isArray(i)||!i.length||new Set(i).size!==i.length)throw new Error("\u8BF7\u9009\u62E9\u8981\u590D\u5236\u7684\u811A\u672C");let o=i.map(d=>{let f=a.rows.find(h=>h.id===d);if(!f||f.error||f.status==="\u672A\u53D8\u5316")throw new Error("\u6240\u9009\u811A\u672C\u4E0D\u80FD\u590D\u5236\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5");return f});this.controller.assertSavedArchive();let s=`.qxqy-script-sync-backups/${a.id}`,c=ge(a.workspace,s);if(Vr(a.root,c))throw new Error("\u5907\u4EFD\u76EE\u5F55\u4E0D\u80FD\u4F4D\u4E8E\u5B9E\u673A\u811A\u672C\u76EE\u5F55\u4E2D");let l=[];for(let d of o){let f="";try{let h=il(a.root,d.targetRelative);if(Gr(h)!==d.beforeHash)throw new Error("\u76EE\u6807\u6587\u4EF6\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5");if(d.beforeHash!==null){let m=ge(a.workspace,`${s}/${d.targetRelative}`);Qc(Qn(m),{recursive:!0}),el(m,Jn(h),{flag:"wx"})}if(Qc(Qn(h),{recursive:!0}),f=Zn(Qn(h),`.${Au(h)}.${tl()}.tmp`),el(f,d.source,{flag:"wx"}),Gr(h)!==d.beforeHash)throw new Error("\u76EE\u6807\u6587\u4EF6\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u68C0\u67E5");Eu(f,h),l.push({id:d.id,target:h,status:"\u6210\u529F"})}catch(h){l.push({id:d.id,target:d.target,status:"\u5931\u8D25",error:h.message})}finally{f&&Iu(f,{force:!0})}}return this.lastResult={completed:l.every(d=>d.status==="\u6210\u529F"),at:new Date().toISOString(),backupRoot:c,results:l},this.lastResult}};import{createHash as Tu,randomUUID as Mu}from"node:crypto";import{mkdir as Ru,open as Nu,readFile as Fu,rename as Ou,rm as Hr,stat as $u,writeFile as Du}from"node:fs/promises";import{homedir as Lr}from"node:os";import{join as oi,resolve as zu}from"node:path";import{setTimeout as Gu}from"node:timers/promises";var Ur=e=>Tu("sha256").update(e).digest("hex");function si(e){return oi(process.platform==="win32"?process.env.LOCALAPPDATA||oi(Lr(),"AppData","Local"):process.platform==="darwin"?oi(Lr(),"Library","Caches"):process.env.XDG_CACHE_HOME||oi(Lr(),".cache"),"beyond-simulator",e)}var Xe=class{constructor({cacheDir:t,source:i,version:n,extension:a,accepts:r,fetch:o=globalThis.fetch,timeout:s=12e3}){this.directory=oi(zu(t),n,Ur(i).slice(0,12)),Object.assign(this,{source:i,extension:a,accepts:r,fetcher:o,timeout:s}),this.pending=new Map,this.failures=new Map,this.active=0,this.waiters=[]}async limited(t){this.active>=4?await new Promise(i=>this.waiters.push(i)):this.active++;try{return await t()}finally{let i=this.waiters.shift();i?i():this.active--}}async download(t,i,n,a){let r=await this.fetcher(new URL(t,this.source),{signal:n,redirect:"error",cache:a?"no-cache":"default"});if(!r.ok)throw Object.assign(new Error(`Asset source returned HTTP ${r.status}`),{status:r.status});if(Number(r.headers.get("content-length"))>i)throw new Error("Asset response too large");let o=[],s=0;for await(let c of r.body){if(s+=c.length,s>i)throw new Error("Asset response too large");o.push(c)}return Buffer.concat(o)}async cached(t){try{let i=await Fu(t);return{data:i,...await this.decode(i),etag:`"${Ur(i)}"`}}catch(i){if(i.code==="ENOENT")return null;if(i.code==="EACCES"||i.code==="EPERM")throw i;return null}}async load(t,i=!1){let n=oi(this.directory,`${t}.${this.extension}`),a=!i&&await this.cached(n);if(a)return a;await Ru(this.directory,{recursive:!0});let r=`${n}.lock`,o=Date.now()+3e4,s;for(;!s;)try{s=await Nu(r,"wx")}catch(l){if(l.code!=="EEXIST")throw l;let d=!i&&await this.cached(n);if(d)return d;try{Date.now()-(await $u(r)).mtimeMs>6e4&&await Hr(r,{force:!0})}catch(f){if(f.code!=="ENOENT")throw f}if(Date.now()>o)throw new Error("Timed out waiting for asset cache writer");await Gu(80)}let c=`${n}.${Mu()}.tmp`;try{let l=!i&&await this.cached(n);if(l)return l;let d=new AbortController,f=setTimeout(()=>d.abort(),this.timeout),h;try{h=await this.produce(t,d.signal,i)}finally{clearTimeout(f),d.abort()}let m=await this.decode(h);return await Du(c,h,{flag:"wx"}),await Ou(c,n),{data:h,...m,etag:`"${Ur(h)}"`}}finally{try{await Hr(c,{force:!0})}finally{await s.close(),await Hr(r,{force:!0})}}}get(t,{refresh:i=!1}={}){if(!this.accepts(t))return Promise.reject(Object.assign(new Error("Asset ID is not in the preview allowlist"),{status:404}));if(this.pending.has(t))return this.pending.get(t);let n=this.failures.get(t);if(!i&&n&&n.until>Date.now())return Promise.reject(n.error);let a=this.limited(()=>this.load(t,i)).then(r=>(this.failures.delete(t),r),r=>{throw i||this.failures.set(t,{until:Date.now()+6e4,error:r}),r}).finally(()=>this.pending.delete(t));return this.pending.set(t,a),a}async refresh(t){if(!this.accepts(t))throw Object.assign(new Error("Asset ID is not in the preview allowlist"),{status:404});return await this.pending.get(t)?.catch(()=>{}),this.failures.delete(t),this.get(t,{refresh:!0})}};import{createHash as Vu}from"node:crypto";import{createCanvas as Bu,loadImage as al}from"@napi-rs/canvas";var ia=class extends Xe{constructor({cacheDir:t,source:i=Zi,fetch:n=globalThis.fetch}){super({cacheDir:t,source:i,fetch:n,version:"border-v1",extension:"json",accepts:a=>at(a)})}decode(t){let i=JSON.parse(t.toString("utf8"));if(i!==null&&(typeof i!="object"||Array.isArray(i)))throw new Error("Invalid image metadata");let n=Mc(i);return{raw:i,meta:n}}async produce(t,i,n){try{return await this.download(`border/${t}.json`,128*1024,i,n)}catch(a){if(a.status===404)return Buffer.from("null");throw a}}};var Yr=20*1024*1024,Hu=Buffer.from("89504e470d0a1a0a","hex");function rl(e,t){return t.throwIfAborted(),new Promise((i,n)=>{let a=()=>n(t.reason);t.addEventListener("abort",a,{once:!0}),e.then(i,n).finally(()=>t.removeEventListener("abort",a))})}function Lu(){return process.env.QXQY_IMAGE_CACHE_DIR||si("images")}function jr(e){if(e.length<24||e.length>Yr||!e.subarray(0,8).equals(Hu))throw new Error("Invalid sprite PNG");let t=e.readUInt32BE(16),i=e.readUInt32BE(20);if(!t||!i||t>8192||i>8192||t*i>16777216)throw new Error("Sprite PNG exceeds pixel limit")}var Xr=class e extends Xe{constructor({cacheDir:t=Lu(),fetch:i=globalThis.fetch,source:n,imageSource:a="StaticReference"}={}){let r=Ae(a);if(!["StaticReference","Prefab"].includes(r))throw new Error(`Unsupported image source: ${r}`);super({cacheDir:t,fetch:i,source:n||(r==="Prefab"?ro:Zi),version:r==="Prefab"?pi:ca,extension:"png",accepts:o=>at(o,r)}),this.imageSource=r,this.cacheDir=t,this.prefabStore=null,this.metadataStore=null}forSource(t){let i=Ae(t);if(i===this.imageSource)return this;if(i==="Prefab"&&this.imageSource==="StaticReference")return this.prefabStore||=new e({cacheDir:this.cacheDir,imageSource:"Prefab",fetch:(...n)=>this.fetcher(...n)});throw Object.assign(new Error(`Unsupported image source: ${i}`),{status:404})}get(t,{imageSource:i=this.imageSource,...n}={}){try{let a=this.forSource(i);return a===this?super.get(t,n):a.get(t,n)}catch(a){return Promise.reject(a)}}refresh(t,{imageSource:i=this.imageSource}={}){try{let n=this.forSource(i);return n===this?super.refresh(t):n.refresh(t)}catch(n){return Promise.reject(n)}}async decode(t){return jr(t),{image:await al(t)}}metadata(t,{imageSource:i=this.imageSource,refresh:n=!1}={}){try{let a=this.forSource(i);if(a!==this)return a.metadata(t,{refresh:n});if(!this.accepts(t))throw Object.assign(new Error("Image ID is not in the preview allowlist"),{status:404});return this.imageSource==="Prefab"?Promise.resolve({meta:null,raw:null}):(this.metadataStore||=new ia({cacheDir:this.cacheDir,source:this.source,fetch:(...r)=>this.fetcher(...r)}),n?this.metadataStore.refresh(t):this.metadataStore.get(t))}catch(a){return Promise.reject(a)}}async produce(t,i,n){if(this.imageSource==="Prefab"){let c=await this.download(`sprite/${t}.png`,Yr,i,n);jr(c);let l=Qi(t);if(c.readUInt32BE(16)!==l||c.readUInt32BE(20)!==l)throw new Error("Prefab PNG does not match catalog dimensions");return c}let[a,r]=await Promise.all([this.download(`sprite/${t}.png`,Yr,i,n),this.metadata(t,{refresh:n})]);jr(a);let o=await al(a),s=r.raw?Ac(o,r.raw,Bu):o;return r.raw?Buffer.from(s.toBuffer("image/png")):a}async prepare(t,i){let n=new Map,a=new Map,r=[],o=[...new Map((t||[]).filter(d=>d.kind==="image"&&d.visible!==!1&&at(d.imageId,d.imageSource)).map(d=>[tn(d.imageId,d.imageSource),{imageId:d.imageId,imageSource:Ae(d.imageSource)}])).entries()];i?.throwIfAborted();let s=AbortSignal.timeout(45e3),c=i?AbortSignal.any([i,s]):s,l=0;await Promise.all(Array.from({length:Math.min(4,o.length)},async()=>{for(;l<o.length&&!c.aborted;){let[d,f]=o[l++];try{let h=await rl(this.get(f.imageId,f),c);n.set(d,h.image);let m=await rl(this.metadata(f.imageId,f),c);a.set(d,m.meta)}catch(h){r.push({...f,error:h.message})}}}));for(let[,d]of o.slice(l))r.push({...d,error:"Image preparation timed out"});return i?.throwIfAborted(),{images:n,imageMetadata:a,warnings:r}}},Uu;function Yi(){return Uu||=new Xr}async function ol(e,t,i=Yi()){let n=new URL(e.url,"http://localhost");if(n.pathname!==en.slice(0,-1)&&!n.pathname.startsWith(en))return!1;try{if(!["GET","HEAD"].includes(e.method))throw Object.assign(new Error("GET or HEAD required"),{status:405});let a=n.pathname.match(new RegExp(`^${en}(${ca}|${pi})/([0-9]+)\\.(png|json)$`));if(!a)throw Object.assign(new Error("Unknown image resource"),{status:404});let r={imageSource:a[1]===pi?"Prefab":"StaticReference"};if(a[3]==="json"){let{meta:c}=await i.metadata(Number(a[2]),r),l=JSON.stringify(c),d=`"${Vu("sha256").update(l).digest("hex")}"`,f={"content-type":"application/json; charset=utf-8","cache-control":"private, max-age=43200",etag:d,"x-content-type-options":"nosniff"};return e.headers["if-none-match"]===d?(t.writeHead(304,f),t.end()):(t.writeHead(200,f),t.end(e.method==="HEAD"?void 0:l)),!0}let o=await i.get(Number(a[2]),r),s={"content-type":"image/png","cache-control":"private, max-age=43200",etag:o.etag,"x-content-type-options":"nosniff"};e.headers["if-none-match"]===o.etag?(t.writeHead(304,s),t.end()):(t.writeHead(200,{...s,"content-length":o.data.length}),t.end(e.method==="HEAD"?void 0:o.data))}catch(a){t.writeHead(a.status||502,{"content-type":"text/plain; charset=utf-8","cache-control":"no-store","x-content-type-options":"nosniff"}),t.end(e.method==="HEAD"?void 0:a.message)}return!0}import{existsSync as ju,mkdirSync as sl,readFileSync as Yu,renameSync as Xu,rmSync as Wu,writeFileSync as Wr}from"node:fs";import{randomUUID as dl}from"node:crypto";import{dirname as cl,join as Ku}from"node:path";function ll(e,t){let i=`${e}.${dl()}.tmp`;try{Wr(i,t,{flag:"wx"}),Xu(i,e)}finally{Wu(i,{force:!0})}}var na=class{constructor(t){this.controller=t,this.plan=null}inspect(){let t=this.controller.studio.archiveData(),i=t.controlGuidChanges||[],n=t.assets.scripts,a=[],r=new Map;i.length||a.push("\u6CA1\u6709\u5F85\u540C\u6B65\u7684\u7D22\u5F15\u53D8\u66F4");try{r=vc(i)}catch(d){a.push(d.message)}let o=this.controller.activeWorkspacePath();o||a.push("\u8BF7\u5148\u7ED1\u5B9A\u5DE5\u4F5C\u533A\uFF0C\u4EE5\u4FDD\u5B58\u540C\u6B65\u524D\u7684\u5907\u4EFD");let s=new Map,c=n.map(d=>{let f={id:d.id,path:d.path,source:d.source,file:"",fileBefore:null,edits:[],issues:[]};if(d.path)try{if(!o)throw new Error("\u5DE5\u4F5C\u533A\u5C1A\u672A\u7ED1\u5B9A\uFF0C\u65E0\u6CD5\u6838\u5BF9\u9879\u76EE\u811A\u672C\u6587\u4EF6");let m=ge(o,d.path);if(ju(m)){f.file=Fe(o,d.path);let p=Yu(f.file);if(f.fileBefore=p.toString("utf8"),!p.equals(Buffer.from(f.fileBefore)))throw new Error("\u9879\u76EE\u811A\u672C\u4E0D\u662F\u6709\u6548 UTF-8\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6838\u5BF9\u7F16\u7801");if(d.source.trim()&&f.fileBefore!==d.source)throw new Error("\u5B58\u6863\u6E90\u7801\u4E0E\u9879\u76EE\u6587\u4EF6\u4E0D\u540C\uFF0C\u8BF7\u4EA4\u7ED9 AI \u5408\u5E76\u540E\u540C\u6B65");if(d.source.trim()||(f.source=f.fileBefore),s.has(f.file))throw new Error("\u591A\u4E2A\u811A\u672C\u6307\u5411\u540C\u4E00\u4E2A\u9879\u76EE\u6587\u4EF6\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6838\u5BF9");s.set(f.file,d.id)}}catch(m){f.issues.push({line:0,reason:m.message})}!f.source.trim()&&d.path&&!f.file&&f.issues.push({line:0,reason:"\u627E\u4E0D\u5230\u6B64\u811A\u672C\u7684\u6E90\u7801\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6838\u5BF9\u6587\u4EF6\u8DEF\u5F84"});let h=Sc(f.source,r);return f.source=h.source,f.edits=h.edits,f.issues.push(...h.issues),f}),l=Ge(JSON.stringify({archive:t,files:c.map(d=>[d.file,d.fileBefore])}));return{archive:t,rows:c,issues:a,fingerprint:l}}preview(){let t=this.inspect();return t.id=dl(),this.plan=t,{id:t.id,canApply:!t.issues.length&&t.rows.every(i=>!i.issues.length),issues:t.issues,changes:t.archive.controlGuidChanges.length,replacements:t.rows.reduce((i,n)=>i+n.edits.length,0),rows:t.rows.map(({id:i,path:n,file:a,edits:r,issues:o})=>({id:i,path:n,file:a,edits:r,issues:o}))}}apply({planId:t,expectedRevision:i}){let n=this.plan;if(!n||n.id!==t)throw new Error("\u8BF7\u5148\u9884\u89C8 Lua \u7D22\u5F15\u540C\u6B65");if(i!==this.controller.get().version)throw new Error("revision conflict: \u8BF7\u91CD\u65B0\u9884\u89C8");if(this.inspect().fingerprint!==n.fingerprint)throw new Error("\u6E90\u7801\u3001\u6587\u4EF6\u6216\u7D22\u5F15\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u9884\u89C8");if(n.issues.length||n.rows.some(f=>f.issues.length))throw new Error("\u6E90\u7801\u6587\u4EF6\u6216\u7D22\u5F15\u6620\u5C04\u5B58\u5728\u51B2\u7A81\uFF0C\u8BF7\u4EA4\u7ED9 AI \u6838\u5BF9\uFF1B\u672C\u6B21\u6CA1\u6709\u4FEE\u6539\u811A\u672C");let r=Bi(n.archive);for(let f of n.rows.filter(h=>h.edits.length))r.patch({op:"updateScript",id:f.id,source:f.source});r.patch({op:"acknowledgeControlGuidChanges",changeIds:n.archive.controlGuidChanges.map(f=>f.id)});let o=Buffer.from(JSON.stringify(r.archiveData())).toString("base64"),s=n.rows.filter(f=>f.edits.length&&f.file),c=this.controller.activeWorkspacePath(),l=s.length?ge(c,`.qxqy-guid-sync-backups/${n.id}`):"",d=[];try{for(let h of s){let m=Ku(l,`${h.id}.lua`);sl(cl(m),{recursive:!0}),Wr(m,h.fileBefore,{flag:"wx"})}let f=ge(c,`.qxqy-guid-sync-backups/${n.id}/before.save.json`);sl(cl(f),{recursive:!0}),Wr(f,JSON.stringify(n.archive),{flag:"wx"});for(let h of s)ll(h.file,h.source),d.push(h);this.controller.studio.importData("json",o)}catch(f){let h=[];for(let m of d.reverse())try{ll(m.file,m.fileBefore)}catch{h.push(m.file)}throw this.plan=null,new Error(`${f.message}${h.length?`\uFF1B\u56DE\u6EDA\u5931\u8D25\uFF0C\u8BF7\u4ECE ${l} \u6062\u590D\uFF1A${h.join("\u3001")}`:"\uFF1B\u5B58\u6863\u672A\u63D0\u4EA4\uFF0C\u5DF2\u5199\u5165\u7684\u9879\u76EE\u6587\u4EF6\u5DF2\u56DE\u6EDA"}`)}return this.plan=null,{...this.controller.get(),controlGuidSyncResult:{replacements:n.rows.reduce((f,h)=>f+h.edits.length,0),scripts:n.rows.filter(f=>f.edits.length).length,projectFiles:s.length,backupRoot:`.qxqy-guid-sync-backups/${n.id}`}}}};var Zu=Math.max(1e3,Number(process.env.QXQY_PLAY_TIMEOUT_MS)||8e3),e1=8e3;function ml(){let e=new Error("operation aborted");return e.name="AbortError",e}function qr(e){if(e!=="manual"&&e!=="realtime")throw new Error("clockMode must be manual or realtime");return e}var ci=class{constructor(t="",{imageAssets:i=Yi(),clockMode:n="realtime"}={}){Ze(),this.workspacePath=t?$t(t):"",this.studio=Bi(void 0,this.workspacePath?{workspacePath:this.workspacePath}:void 0),this.worker=null,this.pending=new Map,this.sequence=1,this.lock=Promise.resolve(),this.archivePath="",this.archiveStamp="",this.savedArchive="",this.scriptSync=new ta(this),this.controlGuidSync=new na(this),this.imageAssets=i,this.defaultClockMode=qr(n),this.playClockMode=this.defaultClockMode}async exclusive(t){let i=this.lock,n;this.lock=new Promise(a=>{n=a}),await i;try{return await t()}finally{n()}}get(){return{...this.studio.get(),storage:{path:this.archivePath}}}exportData(t,i,n={}){return this.studio.exportData(t,i,n)}exportAction(t,i={}){if(t==="list")return this.studio.exportChoices();if(t==="preview")return this.studio.exportPreview(i);if(t!=="export")throw new Error(`unknown export action: ${t}`);let n=this.exportData(i.format||"gia-partial",i.assetType||"",i);if(!i.path)return n;if(!this.activeWorkspacePath())throw new Error("workspace is not bound");if(n.files)throw new Error("path requires a single-file export format");let a=ge(this.activeWorkspacePath(),i.path);fl(hl(a),{recursive:!0});let r=Buffer.from(n.data,"base64");ul(a,r,{flag:"wx"});let{data:o,...s}=n;return{...s,path:String(i.path).replaceAll("\\","/"),bytes:r.length}}scriptSyncAction(t,i={}){if(t==="discover")return nl();if(t==="status")return{config:this.get().scriptSync,lastResult:this.scriptSync.lastResult};if(t==="configure"){if(!Number.isInteger(i.expectedRevision))throw new Error("expectedRevision is required");return this.patch({op:"setScriptSync",config:i.config,expectedRevision:i.expectedRevision})}if(t==="save"){if(!Number.isInteger(i.expectedRevision))throw new Error("expectedRevision is required");let n=i.path??this.archivePath;if(typeof n!="string"||!n.trim())throw new Error("script sync save requires a workspace-relative path for a new archive");return this.saveForScriptSync(n,i.expectedRevision)}if(t==="preview")return this.scriptSync.preview();if(t==="apply")return this.scriptSync.apply(i);throw new Error(`unknown script sync action: ${t}`)}assertSavedArchive(){if(!this.archivePath||this.savedArchive!==JSON.stringify(this.studio.archiveData()))throw new Error("\u8BF7\u5148\u4FDD\u5B58\u5F53\u524D\u5B8C\u6574\u5B58\u6863\uFF0C\u518D\u786E\u8BA4\u590D\u5236");let t=Fe(this.activeWorkspacePath(),this.archivePath);if(Ge(Kr(t))!==this.archiveStamp)throw new Error("\u5B58\u6863\u6587\u4EF6\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u52A0\u8F7D\u5E76\u68C0\u67E5")}saveForScriptSync(t,i){if(i!==this.get().version)throw new Error("revision conflict: reload before saving");let n=ge(this.activeWorkspacePath(),t);if(Ju(n)){let a=this.archivePath?ge(this.activeWorkspacePath(),this.archivePath):"";if(n!==a||Ge(Kr(n))!==this.archiveStamp)throw new Error("File changed or already exists; load it again or save under a new path")}return this.saveArchive(t)}patch(t){return t?.op==="previewControlGuidSync"?{...this.get(),controlGuidSyncPreview:this.controlGuidSync.preview()}:t?.op==="syncControlGuidReferences"?this.controlGuidSync.apply(t):{...this.studio.patch(t),storage:{path:this.archivePath}}}listArchives(){return qn(this.workspacePath)}loadArchive(t){let i=this.activeWorkspacePath();if(!i)throw new Error("workspace is not bound");let n=Fe(i,t),a=Kr(n),r=this.studio.importData("json",a.toString("base64"),Qu(n));return this.archivePath=String(t).trim().replaceAll("\\","/"),this.archiveStamp=Ge(a),this.savedArchive=JSON.stringify(this.studio.archiveData()),r}saveArchive(t=this.archivePath||"qxqy-simulator.save.json"){let i=String(t).trim(),n=this.activeWorkspacePath();if(!n)throw new Error("workspace is not bound");let a=ge(n,i);fl(hl(a),{recursive:!0});let r=Buffer.from(JSON.stringify(this.studio.archiveData(),null,2)+`
|
|
118
|
+
`,"utf8");return ul(a,r),this.archivePath=i.replaceAll("\\","/"),this.archiveStamp=Ge(r),this.savedArchive=JSON.stringify(this.studio.archiveData()),{path:this.archivePath,bytes:r.length,revision:this.studio.get().version,name:this.studio.get().save?.name||""}}activeWorkspacePath(){let t=this.studio.get().workspace;return t?.bound&&t.path?String(t.path):this.workspacePath}createWorker(){let t=new qu(new URL("./worker.js",import.meta.url),{type:"module",workerData:{localFont:Ze()?.data??null}});return t.on("message",i=>{let n=this.pending.get(i?.id);n&&(this.pending.delete(i.id),i.ok?n.resolve(i.value):n.reject(new Error(i.error||"play worker failed")))}),t.on("error",i=>{this.worker===t&&(this.worker=null),this.rejectPending(i)}),t.on("exit",i=>{this.worker===t&&(this.worker=null),i!==0&&this.rejectPending(new Error(`play worker exited with code ${i}`))}),this.worker=t,t}rejectPending(t){for(let i of this.pending.values())i.reject(t);this.pending.clear()}async terminateWorker(t=new Error("play worker terminated")){let i=this.worker;this.worker=null,this.rejectPending(t),i&&await i.terminate().catch(()=>{})}request(t,i,n,a=Zu){let r=this.worker||this.createWorker(),o=this.sequence++;return new Promise((s,c)=>{let l=!1,d=(m,p)=>{l||(l=!0,clearTimeout(h),n?.removeEventListener("abort",f),m(p))},f=()=>{this.pending.delete(o),d(c,ml()),this.terminateWorker(ml())},h=setTimeout(()=>{this.pending.delete(o);let m=new Error(`play worker timed out after ${a}ms`);d(c,m),this.terminateWorker(m)},a);if(this.pending.set(o,{resolve:m=>d(s,m),reject:m=>d(c,m)}),n?.aborted)return f();n?.addEventListener("abort",f,{once:!0}),r.postMessage({id:o,action:t,args:i})})}async play(t,i={},n){if((t==="start"||t==="device")&&!i.language){let a=Jc();a&&(i={...i,language:a})}if(t==="start"){let a=qr(i.clockMode??this.defaultClockMode);return await this.terminateWorker(),this.playClockMode=a,this.request("start",{archive:this.studio.archiveData(),workspacePath:this.activeWorkspacePath(),...i,clockMode:a},n)}if(t==="device"){let a=String(i.canvasId||"").trim();if(!J[a])throw new Error(`unknown canvas preset: ${a||"(empty)"} (available: ${Object.keys(J).join(", ")})`);let r=qr(i.clockMode??this.playClockMode);return await this.terminateWorker(),this.playClockMode=r,this.request("start",{archive:this.studio.archiveData(),workspacePath:this.activeWorkspacePath(),...i,canvasId:a,clockMode:r},n)}if(t==="stop"){if(!this.worker)return{running:!1,tree:[],logs:[]};try{return await this.request("stop",i,n)}finally{await this.terminateWorker()}}if(!this.worker)throw new Error("play session has not started");return this.request(t,i,n)}async playScreenshot(t){if(!this.worker)throw new Error("play session has not started");let i=await this.request("get",{view:!0},t,e1),n=await this.imageAssets.prepare(i.scene?.nodes,t),a=Hc(i.scene,i.canvasWidth,i.canvasHeight,n);return{data:a.data,canvasId:String(i.canvasId||""),frame:Number.isFinite(Number(i.frame))?Number(i.frame):0,time:Number.isFinite(Number(i.time))?Number(i.time):0,clockMode:i.clockMode,width:a.width,height:a.height,pixelWidth:a.pixelWidth,pixelHeight:a.pixelHeight,assetWarnings:[...n.warnings,...(i.effects||[]).map(r=>({animationId:r.animationId,error:"UI effect video frames are available in browser playback only; omitted from this PNG"}))]}}async uiScreenshot(t){let i=this.studio.get(),n=await this.imageAssets.prepare(i.boxes,t),a=Uc(i,n);return{data:a.data,page:a.page,width:a.width,height:a.height,pixelWidth:a.pixelWidth,pixelHeight:a.pixelHeight,assetWarnings:[...n.warnings,...i.boxes.filter(r=>["animation","fullscreen"].includes(r.kind)&&r.visibleInHierarchy!==!1&&r.animationId).map(r=>({animationId:r.animationId,error:"UI effect video frames are available in browser playback only; omitted from this PNG"}))]}}async dispose(){await this.terminateWorker()}};var i1=new Set(["server-control-template","client-control-template"]),n1=new Set(["start","device","view","get","step","pointer","key","click","pause","resume","stop","serverGet","serverSet","serverSend","history","saveCase","runCase"]);function pl(e){return String(e||"").trim().replaceAll("\\","/")}function bl(e,t){let i=t1(Fe(e,t));return`${i.size}:${i.mtimeMs}`}function a1(e){return{version:e.version,selectedId:e.selectedId,save:e.save,asset:e.asset,canvas:e.canvas,tree:e.tree,workspace:e.workspace,scriptCount:Array.isArray(e.scripts)?e.scripts.length:0}}function gl(e,t,i){let n=i==="stop"||t?.running===!1,a=Array.isArray(t?.logs)?t.logs.slice(-100):e.logs;return{running:!n,paused:n?!1:!!t?.paused,canvasId:String(t?.canvasId||e.canvasId||""),width:Number(t?.canvasWidth||e.width||0),height:Number(t?.canvasHeight||e.height||0),frame:Number(t?.frame||0),time:Number(t?.time||0),logs:a}}var aa=class{constructor({workspace:t,initialPath:i="",watchIntervalMs:n=700,discoveryIntervalMs:a=5e3,imageAssets:r}={}){this.workspace=$t(t),this.controller=new ci(this.workspace,{imageAssets:r}),this.initialPath=pl(i),this.watchIntervalMs=Math.max(100,Number(n)||700),this.activePath="",this.activeStamp="",this.lastLoadedAt="",this.lastError="",this.listeners=new Set,this.playState={running:!1,paused:!1,canvasId:"",width:0,height:0,frame:0,time:0,logs:[]},this.timer=null,this.refreshing=!1,this.discoveryIntervalMs=Math.max(100,Number(a)||5e3),this.archiveCache=null,this.archiveCacheTime=0,this.openGeneration=0,this.disposed=!1}async initialize(){let t=this.archives().archives,i=this.initialPath||t[0]?.path||"";if(i)try{await this.open(i,"startup")}catch{}return this.timer=setInterval(()=>{this.refreshFromDisk()},this.watchIntervalMs),this.state()}archives(t=!1){return(t||!this.archiveCache||Date.now()-this.archiveCacheTime>=this.discoveryIntervalMs)&&(this.archiveCache=qn(this.workspace),this.archiveCacheTime=Date.now()),this.archiveCache}previewStatus(){let t=this.controller.get();return{service:"beyond-simulator-web",version:mi.version,workspace:this.workspace,activePath:this.activePath,lastLoadedAt:this.lastLoadedAt,lastError:this.lastError,revision:this.activePath?t.version:null,name:this.activePath&&t.save?.name||""}}state(){let t=this.archives();return{...this.previewStatus(),archives:t.archives,discovery:t.discovery,snapshot:a1(this.controller.get()),play:this.playState}}recordError(t){let i=t?.message||String(t),n=i!==this.lastError;this.lastError=i,n&&this.emit({type:"error",error:i})}async open(t,i="manual",n=this.openGeneration){let a=pl(t);if(!a)throw new Error("path is required");return this.controller.exclusive(async()=>{if(this.disposed||i==="external-change"&&n!==this.openGeneration)return this.state();try{await this.controller.play("stop"),this.playState=gl(this.playState,{running:!1,logs:[]},"stop");let r=bl(this.workspace,a),o=this.controller.loadArchive(a);return this.activePath=a,this.activeStamp=r,this.initialPath="",this.openGeneration++,this.lastLoadedAt=new Date().toISOString(),this.lastError="",this.archiveCache=null,this.emit({type:"archive",reason:i,path:a,revision:o.version}),this.state()}catch(r){throw this.recordError(r),r}})}async refreshFromDisk(){if(this.refreshing||this.disposed)return!1;this.refreshing=!0;try{if(!this.activePath){let i=this.initialPath||this.archives().archives[0]?.path||"";return i?(await this.open(i,"external-change"),!0):!1}return bl(this.workspace,this.activePath)===this.activeStamp&&!this.lastError?!1:(await this.open(this.activePath,"external-change"),!0)}catch(t){return this.recordError(t),!1}finally{this.refreshing=!1}}async setView({assetType:t,canvasId:i}={}){if(t&&!i1.has(t))throw new Error(`unknown asset type: ${t}`);if(i&&!J[i])throw new Error(`unknown canvas preset: ${i}`);return await this.controller.exclusive(async()=>{if(t&&this.controller.patch({op:"selectAsset",assetType:t}),i){let n=this.controller.get().version;this.controller.patch({op:"setCanvas",canvasId:i,expectedRevision:n})}}),this.emit({type:"view"}),this.state()}async play(t,i={},n){if(!n1.has(t))throw new Error(`unknown play action: ${t||"(empty)"}`);let a=await this.controller.exclusive(()=>this.controller.play(t,i,n));return this.playState=gl(this.playState,a,t),this.emit({type:"play",action:t,frame:this.playState.frame}),a}async currentState(t){return this.state()}editorScreenshot(t){return this.controller.uiScreenshot(t)}playScreenshot(t){return this.controller.exclusive(()=>this.controller.playScreenshot(t))}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t){for(let i of this.listeners)i(t)}async dispose(){this.disposed=!0,this.timer&&clearInterval(this.timer),this.timer=null,this.listeners.clear(),await this.controller.exclusive(()=>this.controller.dispose())}};import{existsSync as r1,readFileSync as o1}from"node:fs";import{createHash as s1}from"node:crypto";var c1=new Set(["get","patch","import","export","export-list","export-preview","archives","load-archive","save","play","script-sync","script-sync-apply","image-refresh"]),Jr=e=>s1("sha256").update(o1(e)).digest("hex"),ra=class{constructor(t,{initialPath:i="",maxSessions:n=8,imageAssets:a}={}){this.workspace=t,this.initialPath=i,this.maxSessions=n,this.sessions=new Map,this.imageAssets=a}getSession(t){if(typeof t!="string"||!/^[a-zA-Z0-9_-]{1,100}$/.test(t))throw new Error("Invalid editor sessionId");if(!this.sessions.has(t)){if(this.sessions.size>=this.maxSessions)throw new Error("Editor session limit reached; save your work and restart the server");let n={controller:new ci(this.workspace,{imageAssets:this.imageAssets}),path:"",fileStamp:""};this.initialPath&&this.load(n,this.initialPath),this.sessions.set(t,n)}return this.sessions.get(t)}snapshot(t){return{...t.controller.get(),storage:{path:t.path}}}load(t,i){let n=Fe(this.workspace,i),a=t.controller.loadArchive(i);return t.path=String(i).replaceAll("\\","/"),t.fileStamp=Jr(n),{...a,snapshot:this.snapshot(t)}}async call(t,i,n){if(!c1.has(t))throw new Error("Unknown editor action");let a=this.getSession(i.sessionId),r=a.controller;return r.exclusive(async()=>{if(t==="get")return this.snapshot(a);if(t==="image-refresh")return await r.imageAssets.refresh(i.imageId,{imageSource:i.imageSource}),{imageId:i.imageId,imageSource:i.imageSource||"StaticReference",refreshed:!0};if(t==="script-sync")return r.scriptSyncAction(i.action,i.args||{});if(t==="script-sync-apply")return r.scriptSync.apply(i);if(t==="archives")return r.listArchives();if(t==="patch"){if(!Number.isInteger(i.op?.expectedRevision))throw new Error("expectedRevision is required");return{...r.patch(i.op),storage:{path:a.path}}}if(t==="export-list")return r.exportAction("list");if(t==="export-preview")return r.exportAction("preview",i);if(t==="export")return r.exportData(i.format,i.assetType,i);if(t==="play")return r.play(i.action,i.args||{},n);if(t==="load-archive"||t==="import"){if(await r.play("stop"),t==="load-archive")return this.load(a,i.path);let o=r.studio.importData(i.format,i.data,i.filename);return a.path="",a.fileStamp="",{...o,snapshot:this.snapshot(a)}}if(t==="save"){if(i.expectedRevision!==r.get().version)throw new Error("revision conflict: reload before saving");let o=ge(this.workspace,i.path);if(r1(o)){let c=a.path?ge(this.workspace,a.path):"";if(o!==c||Jr(o)!==a.fileStamp)throw new Error("File changed or already exists; load it again or save under a new path")}let s=r.saveArchive(i.path);return a.path=s.path,a.fileStamp=Jr(o),s}})}async dispose(){await Promise.all([...this.sessions.values()].map(t=>t.controller.exclusive(()=>t.controller.dispose()))),this.sessions.clear()}};var yl=32*1024*1024;function l1(e){if(e.length<8||e.length>yl)throw new Error("Invalid MP3 size");let t=0,i=0;if(e.subarray(0,3).toString()==="ID3"){if(e.length<10||e[3]<2||e[3]>4||e.subarray(6,10).some(n=>n>127))throw new Error("Invalid MP3 ID3 header");t=10+(e[6]<<21|e[7]<<14|e[8]<<7|e[9])+(e[5]&16&&e[3]===4?10:0)}for(;t+4<=e.length;){if(e.length-t===128&&e.subarray(t,t+3).toString()==="TAG"){t=e.length;break}let n=e[t+1],a=e[t+2],r=n>>3&3,o=a>>2&3,s=a>>4;if(e[t]!==255||(n&224)!==224||(n&6)!==2||r===1||o===3||s===0||s===15)throw new Error("Invalid MP3 frame");let c=(r===3?[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320]:[0,8,16,24,32,40,48,56,64,80,96,112,128,144,160])[s],l=[44100,48e3,32e3][o]/(r===3?1:r===2?2:4),d=Math.floor((r===3?144e3:72e3)*c/l)+(a>>1&1);t+=d,i++}if(i<2||t!==e.length)throw new Error("Truncated or invalid MP3")}var Qr=class extends Xe{constructor({cacheDir:t=process.env.QXQY_AUDIO_CACHE_DIR||si("audio"),fetch:i=globalThis.fetch,source:n=Qs}={}){super({cacheDir:t,fetch:i,source:n,version:cr,extension:"mp3",accepts:a=>On(a)!==null,timeout:2e4})}decode(t){return l1(t),{}}produce(t,i,n){return this.download(`audio/${t}.mp3`,yl,i,n)}},d1;function Zr(){return d1||=new Qr}async function wl(e,t,i=Zr()){let n=new URL(e.url,"http://localhost");if(n.pathname!==Fn.slice(0,-1)&&!n.pathname.startsWith(Fn))return!1;try{if(!["GET","HEAD"].includes(e.method))throw Object.assign(new Error("GET or HEAD required"),{status:405});let a=n.pathname.match(new RegExp(`^${Fn}${cr}/([0-9]+)\\.mp3$`));if(!a)throw Object.assign(new Error("Unknown audio resource"),{status:404});let r=await i.get(Number(a[1])),o=r.data.length,s={"content-type":"audio/mpeg","cache-control":"private, max-age=43200",etag:r.etag,"accept-ranges":"bytes","x-content-type-options":"nosniff"};if(e.headers["if-none-match"]===r.etag)return t.writeHead(304,s),t.end(),!0;let c=e.headers.range,l=0,d=o-1,f=200;if(c&&(!e.headers["if-range"]||e.headers["if-range"]===r.etag)){let h=c.match(/^bytes=(\d*)-(\d*)$/);if(!h||!h[1]&&!h[2])throw Object.assign(new Error("Invalid byte range"),{status:416,size:o});if(h[1]?(l=Number(h[1]),d=h[2]?Math.min(o-1,Number(h[2])):d):l=Math.max(0,o-Number(h[2])),!Number.isSafeInteger(l)||!Number.isSafeInteger(d)||l>=o||d<l)throw Object.assign(new Error("Unsatisfiable byte range"),{status:416,size:o});f=206,s["content-range"]=`bytes ${l}-${d}/${o}`}t.writeHead(f,{...s,"content-length":d-l+1}),t.end(e.method==="HEAD"?void 0:r.data.subarray(l,d+1))}catch(a){t.writeHead(a.status||502,{"content-type":"text/plain; charset=utf-8","cache-control":"no-store",...a.status===416?{"content-range":`bytes */${a.size}`}:{}}),t.end(e.method==="HEAD"?void 0:a.message)}return!0}import{createHash as f1}from"node:crypto";import{basename as u1}from"node:path";var h1={webm:"video/webm",png:"image/png",mp3:"audio/mpeg"},eo=class extends Xe{constructor(t,i,n){let a={video:"webm",icon:"png",audio:"mp3"}[t];super({...i,version:`${lr}/${t}`,extension:a,accepts:r=>/^[0-9]+(?:_[0-9]+)?$/.test(String(r))&&!!n(`${t}/${r}.${a}`)}),this.kind=t,this.media=n}async cached(t){let i=await super.cached(t);if(!i)return null;try{return this.validate(u1(t,`.${this.extension}`),i.data),i}catch{return null}}validate(t,i){let n=this.media(`${this.kind}/${t}.${this.extension}`);if(i.length!==n.bytes||f1("sha256").update(i).digest("hex")!==n.sha256)throw new Error("UI effect media failed integrity check")}decode(){return{}}async produce(t,i,n){let a=await this.download(`${this.kind}/${t}.${this.extension}`,8388608,i,n);return this.validate(t,a),a}},to=class{constructor({cacheDir:t=process.env.QXQY_UI_VFX_CACHE_DIR||si("ui-vfx"),source:i=process.env.QXQY_UI_VFX_SOURCE||Zs,fetch:n=globalThis.fetch,timeout:a=12e3,media:r=Dn}={}){this.stores=Object.fromEntries(["video","icon","audio"].map(o=>[o,new eo(o,{cacheDir:t,source:i,fetch:n,timeout:a},r)]))}get(t,{retry:i=!1}={}){let n=/^(video|icon|audio)\/([0-9]+(?:_[0-9]+)?)\.(webm|png|mp3)$/.exec(t);if(!n||!Dn(t))return Promise.reject(Object.assign(new Error("Unknown UI effect resource"),{status:404}));let a=this.stores[n[1]];return i&&a.failures.delete(n[2]),a.get(n[2])}},m1;function io(){return m1||=new to}async function vl(e,t,i=io()){let n=new URL(e.url,"http://localhost");if(n.pathname!==$n.slice(0,-1)&&!n.pathname.startsWith($n))return!1;try{if(!["GET","HEAD"].includes(e.method))throw Object.assign(new Error("GET or HEAD required"),{status:405});let a=`${$n}${lr}/`,r=n.pathname.startsWith(a)?n.pathname.slice(a.length):"";if(!Dn(r))throw Object.assign(new Error("Unknown UI effect resource"),{status:404});let o=await i.get(r,{retry:n.searchParams.get("retry")==="1"}),s=o.data.length;if(t.destroyed)return!0;let c={"content-type":h1[r.split(".").at(-1)],"cache-control":"private, max-age=43200",etag:o.etag,"accept-ranges":"bytes","x-content-type-options":"nosniff"};if(e.headers["if-none-match"]===o.etag)return t.writeHead(304,c),t.end(),!0;let l=0,d=s-1,f=200;if(e.headers.range&&(!e.headers["if-range"]||e.headers["if-range"]===o.etag)){let h=/^bytes=(\d*)-(\d*)$/.exec(e.headers.range);if(!h||!h[1]&&!h[2])throw Object.assign(new Error("Invalid byte range"),{status:416,size:s});if(h[1]?(l=Number(h[1]),d=h[2]?Math.min(s-1,Number(h[2])):d):l=Math.max(0,s-Number(h[2])),!Number.isSafeInteger(l)||!Number.isSafeInteger(d)||l>=s||d<l)throw Object.assign(new Error("Unsatisfiable byte range"),{status:416,size:s});c["content-range"]=`bytes ${l}-${d}/${s}`,f=206}t.writeHead(f,{...c,"content-length":d-l+1}),t.end(e.method==="HEAD"?void 0:o.data.subarray(l,d+1))}catch(a){!t.destroyed&&!t.headersSent&&(t.writeHead([404,405,416].includes(a.status)?a.status:502,{"content-type":"text/plain; charset=utf-8","cache-control":"no-store",...a.status===416?{"content-range":`bytes */${a.size}`}:{}}),t.end(e.method==="HEAD"?void 0:"UI effect resource unavailable"))}return!0}var p1="https://github.com/1475505/miliastra-beyond-simulator",b1="https://api.github.com/repos/1475505/miliastra-beyond-simulator/releases?per_page=100",g1=e=>/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(e),xl=(e,t)=>{let i=e.split(/[.-]/).slice(0,3).map(Number),n=t.split(/[.-]/).slice(0,3).map(Number);for(let a=0;a<3;a++)if(i[a]!==n[a])return Math.sign(i[a]-n[a]);return t.includes("-")&&!e.includes("-")?1:e.includes("-")&&!t.includes("-")?-1:0};function Sl(e,t){try{let i=new URL(e);return i.protocol==="https:"&&i.origin==="https://github.com"&&i.pathname.startsWith(`/1475505/miliastra-beyond-simulator/releases/${t}/`)?i.href:null}catch{return null}}function y1(e,t){if(!Array.isArray(e))throw new Error("Invalid release response");let i=[];for(let n of e)if(!(n.draft||n.prerelease||!Array.isArray(n.assets)))for(let a of n.assets){if(typeof a.name!="string"||!a.name.startsWith(t+"-")||!a.name.endsWith(".tgz"))continue;let r=a.name.slice(t.length+1,-4),o=Sl(n.html_url,"tag"),s=Sl(a.browser_download_url,"download");!g1(r)||!o||!s||i.push({version:r,url:o,downloadUrl:s,publishedAt:n.published_at||null})}return i.sort((n,a)=>xl(a.version,n.version))[0]||null}function El({packageName:e,currentVersion:t,fetch:i=globalThis.fetch,now:n=Date.now}){let a=null,r=null;return async function(){return a&&n()-a.checkedAt<5*6e4?a:r||(r=(async()=>{let s=await i(b1,{headers:{accept:"application/vnd.github+json","user-agent":"beyond-simulator-update-check","x-github-api-version":"2022-11-28"},signal:AbortSignal.timeout(8e3)});if(!s.ok)throw new Error(`Update check failed (HTTP ${s.status})`);let c=y1(await s.json(),e),l=c?xl(c.version,t):0;return a={packageName:e,currentVersion:t,latestVersion:c?.version||null,status:c?l>0?"available":l<0?"ahead":"current":"unavailable",url:c?.url||`${p1}/releases`,downloadUrl:c?.downloadUrl||null,checkedAt:n(),publishedAt:c?.publishedAt||null},a})().finally(()=>{r=null}),r)}}import{execFile as w1}from"node:child_process";import{win32 as v1}from"node:path";import{promisify as S1}from"node:util";var x1=S1(w1),Il=e=>["localhost","127.0.0.1","::1","[::1]","::ffff:127.0.0.1"].includes(e);function no(e){if(typeof e!="string")return"";let t=e.trim().replace(/^\uFEFF/,"").split(/[.@]/)[0].replaceAll("_","-");if(!t||/^(?:C|POSIX)$/i.test(t)||t.length>80)return"";try{return Intl.getCanonicalLocales(t)[0]||""}catch{return""}}function Cl(e){try{return Il(e.socket?.remoteAddress)&&Il(new URL("http://"+e.headers.host).hostname)&&!e.headers.forwarded&&!e.headers["x-forwarded-for"]&&!e.headers["x-forwarded-host"]&&!e.headers.via&&e.headers["sec-fetch-site"]!=="cross-site"&&(!e.headers.origin||new URL(e.headers.origin).host===e.headers.host)}catch{return!1}}function E1({platform:e=process.platform,env:t=process.env,execFile:i=x1}={}){let n;return()=>n||=(async()=>{try{let a="",r="browser",o={windowsHide:!0,timeout:2500,maxBuffer:4096,encoding:"utf8"};if(e==="win32"){let s=v1.join(t.SystemRoot||"C:\\Windows","System32","WindowsPowerShell","v1.0","powershell.exe"),{stdout:c}=await i(s,["-NoLogo","-NoProfile","-NonInteractive","-Command","[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;(Get-UICulture).Name"],o);a=no(c),r="windows-ui"}else if(e==="darwin"){let{stdout:s}=await i("/usr/bin/defaults",["read","-g","AppleLanguages"],o);a=(s.match(/\b[a-z]{2,3}(?:[-_][a-zA-Z0-9]{2,8})*\b/g)||[]).map(no).find(Boolean)||"",r="macos-ui"}else a=[t.LANGUAGE?.split(":")[0],t.LC_ALL,t.LC_MESSAGES,t.LANG].map(no).find(Boolean)||"",r="host-locale";return{language:a,source:a?r:"browser"}}catch{return{language:"",source:"browser"}}})()}var kl=E1();var T1=Tl(new URL(".",import.meta.url)),M1=Pl(T1,"public"),_l=new Map([["/","index.html"],["/index.html","index.html"],["/app.js","app.js"],["/play-renderer.js","play-renderer.js"],["/styles.css","styles.css"],["/editor","editor.html"],["/editor/","editor.html"],["/editor.js","editor.js"],["/editor.css","editor.css"],["/editor/play","play.html"],["/editor/play.js","play.js"],["/editor/play.css","play.css"],["/editor/play-renderer.js","play-renderer.js"]]),R1={".html":"text/html; charset=utf-8",".js":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8"};function N1(e=process.argv.slice(2)){let t=(i,n="")=>{let a=e.indexOf(i);return a>=0&&e[a+1]?e[a+1]:n};return{workspace:t("--workspace",process.env.QXQY_WORKSPACE||process.cwd()),initialPath:t("--file"),host:t("--host","127.0.0.1"),port:Number(t("--port","4173")),open:e.includes("--open")}}function sa(e,t="'none'"){return{"cache-control":"no-store","content-type":e,"content-security-policy":`default-src 'self'; img-src 'self' data:; connect-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; object-src 'none'; frame-ancestors ${t}`,"x-content-type-options":"nosniff"}}function Pe(e,t,i){e.writeHead(t,sa("application/json; charset=utf-8")),e.end(JSON.stringify(i))}function F1(e,t){e.writeHead(200,{...sa("image/png"),"content-length":t.data.length,"x-qxqy-width":String(t.width||0),"x-qxqy-height":String(t.height||0)}),e.end(t.data)}async function oa(e,t=1024*1024){let i=[],n=0;for await(let a of e){if(n+=a.length,n>t)throw new Error("request body is too large");i.push(a)}return i.length?JSON.parse(Buffer.concat(i).toString("utf8")):{}}function O1(e){let t=process.platform==="win32"?"cmd.exe":process.platform==="darwin"?"open":"xdg-open",i=process.platform==="win32"?["/c","start","",e]:[e];I1(t,i,{detached:!0,stdio:"ignore",windowsHide:!0}).unref()}async function $1(e={}){e={...e,imageAssets:e.imageAssets||Yi(),audioAssets:e.audioAssets||Zr(),uiVfxAssets:e.uiVfxAssets||io()};let t=e.host||"127.0.0.1",i=e.password??process.env.QXQY_WEB_PASSWORD??"",n=["127.0.0.1","localhost","::1"].includes(t);if(Ze()&&!n)throw new Error("QXQY_FONT_PATH requires a loopback-only Web host");if(!n&&!i)throw new Error("QXQY_WEB_PASSWORD is required when listening outside loopback");let a=y=>_1("sha256").update(y).digest(),r=a(i),o=new aa(e);await o.initialize();let s=new ra(o.workspace,e),c=e.checkUpdates||El({packageName:mi.name,currentVersion:mi.version}),l=e.systemLanguage||kl,d=new Set,f=o.subscribe(y=>{let w=`event: state
|
|
119
|
+
data: ${JSON.stringify(y)}
|
|
117
120
|
|
|
118
|
-
`;for(let
|
|
121
|
+
`;for(let _ of d)_.write(w)}),h=C1(async(y,w)=>{let _=new URL(y.url||"/","http://localhost"),T=new AbortController;y.once("aborted",()=>T.abort());try{if(y.method==="GET"&&_.pathname==="/health"){Pe(w,200,{status:"ok"});return}if(i){let N=String(y.headers.authorization||""),O=N.startsWith("Basic ")?Buffer.from(N.slice(6),"base64").toString("utf8"):"";if(!(O.startsWith("simulator:")&&P1(a(O.slice(10)),r))){w.setHeader("www-authenticate",'Basic realm="QXQY Simulator", charset="UTF-8"'),Pe(w,401,{ok:!1,error:"Authentication required"});return}}if(!i&&n){let N=new URL(`http://${y.headers.host}`).hostname;if(!["127.0.0.1","localhost","[::1]"].includes(N)){Pe(w,403,{ok:!1,error:"Local Host required"});return}}if(y.method==="POST"){if(!/^application\/json(?:;|$)/i.test(y.headers["content-type"]||"")){Pe(w,415,{ok:!1,error:"application/json required"});return}if(y.headers.origin&&new URL(y.headers.origin).host!==y.headers.host){Pe(w,403,{ok:!1,error:"Cross-origin requests are not allowed"});return}}if(await ol(y,w,e.imageAssets)||await wl(y,w,e.audioAssets)||await vl(y,w,e.uiVfxAssets)||await zo(y,w,{settingsEnabled:n}))return;if(y.method==="GET"&&_l.has(_.pathname)){let N=_l.get(_.pathname),O=k1(Pl(M1,N));w.writeHead(200,sa(R1[A1(N)]||"application/octet-stream",_.pathname==="/editor/play"?"'self'":"'none'")),w.end(O);return}if(y.method==="GET"&&_.pathname==="/api/state"){_.searchParams.get("refresh")==="1"&&o.archives(!0),Pe(w,200,{ok:!0,value:await o.currentState(T.signal)});return}if(y.method==="GET"&&_.pathname==="/api/preview"){Pe(w,200,{ok:!0,value:o.previewStatus()});return}if(y.method==="GET"&&_.pathname==="/api/editor.png"){F1(w,await o.editorScreenshot(T.signal));return}if(y.method==="GET"&&_.pathname==="/api/events"){w.writeHead(200,{...sa("text/event-stream; charset=utf-8"),connection:"keep-alive"}),w.write(`: connected
|
|
119
122
|
|
|
120
|
-
`),
|
|
121
|
-
`),e.open&&
|
|
122
|
-
`),process.exitCode=1});export{
|
|
123
|
+
`),d.add(w),y.once("close",()=>d.delete(w));return}if(y.method==="POST"&&_.pathname==="/api/open"){let N=await oa(y);if(N.expectedWorkspace!==void 0){let O=$t(N.expectedWorkspace);if(!(process.platform==="win32"?O.toLowerCase()===o.workspace.toLowerCase():O===o.workspace))throw new Error(`Web workspace mismatch: ${o.workspace}`)}Pe(w,200,{ok:!0,value:await o.open(N.path,N.expectedWorkspace===void 0?"manual":"mcp-preview")});return}if(y.method==="POST"&&_.pathname.startsWith("/editor/api/")){let N=await oa(y,8388608),O=_.pathname.slice(12),V=O==="locale"?Cl(y)?await l():{language:"",source:"browser"}:O==="updates"?await c():await s.call(O,N,T.signal);Pe(w,200,{ok:!0,value:V});return}if(y.method==="POST"&&_.pathname==="/api/view"){Pe(w,200,{ok:!0,value:await o.setView(await oa(y))});return}if(y.method==="POST"&&_.pathname==="/api/play"){let N=await oa(y);Pe(w,200,{ok:!0,value:await o.play(N.action,N.args||{},T.signal)});return}Pe(w,404,{ok:!1,error:"not found"})}catch(N){Pe(w,400,{ok:!1,error:N?.message||String(N)})}}),m=Number.isFinite(Number(e.port))?Number(e.port):4173;try{await new Promise((y,w)=>{h.once("error",w),h.listen(m,t,y)})}catch(y){throw f(),await o.dispose(),await s.dispose(),y}let p=h.address(),b=typeof p=="object"&&p?p.port:m;return{url:`http://${t.includes(":")?`[${t}]`:t}:${b}`,session:o,server:h,async close(){f();for(let y of d)y.end();d.clear(),await o.dispose(),await s.dispose(),await new Promise(y=>h.close(y))}}}async function D1(){let e=N1(),t=await $1(e);process.stdout.write(`QXQY Simulator Web: ${t.url}
|
|
124
|
+
`),e.open&&O1(t.url);let i=()=>{t.close().finally(()=>process.exit(0))};process.once("SIGINT",i),process.once("SIGTERM",i)}function z1(){if(!process.argv[1])return!1;try{return Al(process.argv[1])===Al(Tl(import.meta.url))}catch{return!1}}z1()&&D1().catch(e=>{process.stderr.write(`${e?.stack||e}
|
|
125
|
+
`),process.exitCode=1});export{$1 as createWebServer};
|