dsh-plugin-beyond-simulator 2.1.1 → 2.2.1
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 +69 -130
- package/dsh-plugin/cordis.patch.yml +1 -1
- package/dsh-plugin/dist/client.js +10 -6
- package/dsh-plugin/dist/index.js +52 -16
- package/dsh-plugin/dist/play-renderer.js +72 -71
- package/dsh-plugin/dist/worker.js +47 -11
- package/dsh-plugin/lib/play.html +56 -40
- package/dsh-plugin/presets/wonderland-lua-builder/README.md +9 -1
- package/dsh-plugin/presets/wonderland-lua-builder/agent.cordis.yml +1 -1
- package/dsh-plugin/presets/wonderland-lua-builder/evals/agent-behavior.md +4 -4
- package/dsh-plugin/presets/wonderland-lua-builder/skills/qxqy-game-studio/references/07-device-validation.md +4 -4
- package/dsh-plugin/skill.md +9 -2
- package/package.json +2 -2
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import{parentPort as fr}from"node:worker_threads";import{existsSync as gi,readFileSync as Bs}from"node:fs";import{randomUUID as So}from"node:crypto";import{isAbsolute as gr,win32 as yr}from"node:path";function pr(e,t=!1){let i=String(e??"").trim().replaceAll("\\","/");if(t&&(!i||i==="."))return"";if(!i||gr(i)||yr.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 en(e){if(e==null)return null;if(e.version!==1)throw new Error("unsupported scriptSync version");let t=String(e.clientImportRoot||"").trim();if(!gr(t)&&!yr.isAbsolute(t))throw new Error("\u5B9E\u673A\u5BFC\u5165\u6839\u76EE\u5F55\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84");return{version:1,workspaceDir:pr(e.workspaceDir,!0),clientImportRoot:t,clientSubdir:pr(e.clientSubdir,!0)}}import{basename as Yt,dirname as Us,isAbsolute as js,join as wo,resolve as Io}from"node:path";var Bo=[[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 br(e){return!Number.isSafeInteger(e)||!Bo.some(([t,i])=>e>=t&&e<=i)?null:e===10003004||e===10008001?128:256}var Uo=[[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 qe(e){return e==null||e===""?"StaticReference":typeof e=="string"?e:typeof e.Name=="string"?e.Name:"Unknown"}function vr(e,t){return qe(t)==="StaticReference"&&tn(e,t)}function tn(e,t){let i=qe(t);return i==="Prefab"?br(e)!==null:i==="StaticReference"&&Number.isSafeInteger(e)&&e>100006&&Uo.some(([n,r])=>e>=n&&e<=r)}var wi="7.1.0",se=Object.freeze(["KEYBOARD","TOUCHSCREEN","CONTROLLER_CONSOLE","CONTROLLER_MOBILE"]),ie=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"}}),Ii="pc-16-9",be=2,Ct=Object.freeze({KEYBOARD:"pc-16-9",TOUCHSCREEN:"mobile-16-9",CONTROLLER_CONSOLE:"pc-16-9",CONTROLLER_MOBILE:"mobile-16-9"}),kt=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"}),xi=Object.freeze(["server-container","container","textbox","cursor","reference","grid","image","button","textwindow","keyhint","animation","fullscreen"]),Sr=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}),jo=Object.freeze({100001:"rect",100002:"circle",100003:"triangle",100004:"fourstar",100005:"fivestar",100006:"ring"});function Et(e,t){return qe(t)==="StaticReference"&&jo[e]||(tn(e,t)?"sprite":"missing")}var wr=50888,Wt=Object.freeze({font:4294967295,bg:16777215,outline:858993459,image:4294967295});function At(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,r)=>At(n,`${t}[${r}]`,i));else for(let[n,r]of Object.entries(e))At(r,`${t}.${n}`,i);i.delete(e)}}function V(e){return At(e),JSON.parse(JSON.stringify(e))}function Ir(e,t="$"){At(e,t)}function xr(e){return ie[e]||ie[Ii]}function Jt(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 Ho(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 Ko(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 Ci({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 ze(e){let t=e||Ci();return{scale:Ho(t.scale),rotation:Ko(t.rotation),anchorMin:Jt(t.anchorMin??t.anchor_min,.5,.5),anchorMax:Jt(t.anchorMax??t.anchor_max,.5,.5),offset:Jt(t.offset,0,0),size:Jt(t.size,0,0),pivot:Jt(t.pivot,.5,.5)}}function de(e,t=0){let i=Number(e);return Number.isFinite(i)?i:t}function Ye(e,t){let i=e.width,n=e.height,r=e.left,a=e.bottom,o=t.anchorMin||{x:t.anchorMinX,y:t.anchorMinY},l=t.anchorMax||{x:t.anchorMaxX,y:t.anchorMaxY},u=t.offset||{x:t.anchoredPositionX,y:t.anchoredPositionY},s=t.size||{x:t.sizeDeltaX,y:t.sizeDeltaY},f=t.pivot||{x:t.pivotX,y:t.pivotY},h=de(o?.x,.5)*i,p=de(o?.y,.5)*n,g=de(l?.x,.5)*i,m=de(l?.y,.5)*n,y=de(s?.x),I=de(s?.y),A=de(f?.x,.5),x=de(f?.y,.5),G=g-h+y,z=m-p+I,q=r+h+de(u?.x)-y*A,J=a+p+de(u?.y)-I*x;return{left:q,bottom:J,width:G,height:z,right:q+G,top:J+z,centerX:q+G/2,centerY:J+z/2}}function _t(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}}function qo(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 Te(e,t,i){return{x:e.a*t+e.c*i+e.tx,y:e.b*t+e.d*i+e.ty}}function Tt(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 nn(e,t){let i=t.rotation||{x:t.localRotationX,y:t.localRotationY,z:t.localRotationZ},n=t.scale||{x:t.localScaleX,y:t.localScaleY},r=t.pivot||{x:t.pivotX,y:t.pivotY},a=de(i?.z)*Math.PI/180,o=Math.cos(a),l=Math.sin(a),u=de(i?.x)*Math.PI/180,s=de(i?.y)*Math.PI/180,f=Math.cos(u),h=Math.sin(u),p=Math.cos(s),g=Math.sin(s),m=H=>Math.abs(H)<1e-12?0:H,y=de(n?.x,1),I=de(n?.y,1),A=e.left+e.width*de(r?.x,.5),x=e.bottom+e.height*de(r?.y,.5),G=m(p*o+g*h*l)*y,z=m(f*l)*y,q=m(-p*l+g*h*o)*I,J=m(f*o)*I;return{a:G,b:z,c:q,d:J,tx:A-G*A-q*x,ty:x-z*A-J*x}}function Zt(e,t,i){return qo(e||_t(),nn(t,i))}function Cr(e,t){let i=Te(t,e.centerX,e.centerY),n=Math.abs(e.width*Math.hypot(t.a,t.b)),r=Math.abs(e.height*Math.hypot(t.c,t.d));return{left:i.x-n/2,bottom:i.y-r/2,width:n,height:r,centerX:i.x,centerY:i.y,rotationZ:Math.atan2(t.b,t.a)*180/Math.PI}}function ve(e){let t=typeof e=="string"?xr(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 rn(e){return{posX:e.centerX,posY:e.centerY,width:e.width,height:e.height}}function lt(e,t,i){let n=ze(t),r=e.width,a=e.height,o=n.anchorMin.x*r,l=n.anchorMin.y*a,u=n.anchorMax.x*r,s=n.anchorMax.y*a,f=Number(i.width),h=Number(i.height),p=Number(i.posX),g=Number(i.posY),m=p-f/2,y=g-h/2;return n.size={x:f-(u-o),y:h-(s-l)},n.offset={x:m-e.left-o+n.size.x*n.pivot.x,y:y-e.bottom-l+n.size.y*n.pivot.y},n}function kr(e,t){let i=ze(e),r={"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 r&&(i.anchorMin={x:r[0][0],y:r[0][1]},i.anchorMax={x:r[1][0],y:r[1][1]},i.pivot={x:r[2][0],y:r[2][1]}),i}function Er(e){let t=ze(e),i=(n,r)=>Math.abs(n-r)<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,r=t.anchorMin.y,a=[[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 a)if(i(n,o[0])&&i(r,o[1]))return o[2]}return"custom"}function st(e){return xr(e).platform}function Ar(e){let t={};for(let i of se)t[i]=e(i);return t}var Lo={scale:["x","y","z"],rotation:["x","y","z"],anchorMin:["x","y"],anchorMax:["x","y"],offset:["x","y"],size:["x","y"],pivot:["x","y"]};function _r(e,t){for(let[i,n]of Object.entries(Lo))for(let r of n)if(!Number.isFinite(e?.[i]?.[r]))throw new Error(`${t}.${i}.${r} must be a finite number`)}function Le(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(!se.includes(i))throw new Error(`${t}: unknown platform ${i}`);for(let i of se)_r(e[i],`${t}.${i}`)}function ut(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`);Le(e.transformByPlatform,`${e.name||e.id||"\u63A7\u4EF6"}.transformByPlatform`)}function ct(e,t){if(!se.includes(t))throw new Error(`unknown platform ${t}`);return _r(e?.[t],`transformByPlatform.${t}`),ze(e[t])}var Wo=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"}]),Jo=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 Tr(e){return[...Wo,...Jo[e]||[]]}function Pr(e,t){return Tr(e).find(i=>i.key===t)||null}function an(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 Rr(e,t={}){let i={};for(let n of Tr(e)){let r=Object.hasOwn(t||{},n.key)?t[n.key]:n.defaultValue;i[n.key]=an(n,r)}return i}function Pe(e){let t=Number(e);return Number.isSafeInteger(t)&&t>0&&t<=2147483647}function on(e,t){if(e){t(e);for(let i of e.children||[])on(i,t)}}function Pt(e,t=new Set,{skipServerContainer:i=!1}={}){return on(e,n=>{i&&n.kind==="server-container"||Pe(n.guid)&&t.add(Number(n.guid))}),t}function We(e,t=1073741850){let i=Number.isSafeInteger(t)&&t>0?t:1073741850;i<1073741850&&(i=1073741850);for(let n of e)Pe(n)&&n>=i&&(i=Number(n)+1);for(;e.has(i);)i+=1;if(i>2147483647)throw new Error("GUID space exhausted");return i}function Mr(e,t=new Set,{skipServerContainer:i=!1}={}){let n=[];on(e,r=>{if(i&&r.kind==="server-container")return;let a=Number(r.guid);if(Pe(a)&&!t.has(a)){t.add(a),r.guid=a;return}n.push(r)});for(let r of n){let a=We(t);r.guid=a,t.add(a)}return t}function ke(e){return Number.isSafeInteger(e)&&e>0&&e<=2147483647}function Xe(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=m=>{m.kind!=="server-container"&&i.push(m);for(let y of m.children||[])n(y)};n(e.root);let r=new Map,a=new Map;for(let m of i){if(!ke(m.giaInfoIndex))continue;let y=r.get(m.giaInfoIndex)||[];y.push(m),r.set(m.giaInfoIndex,y);let I=a.get(m.kind)||new Set;I.add(m.giaInfoIndex),a.set(m.kind,I)}let o=(e.root.children||[]).filter(m=>m.kind!=="server-container"),l=new Set(o),u=o.some((m,y)=>ke(m.giaInfoIndex)&&o.slice(0,y).some(I=>I.giaInfoIndex===m.giaInfoIndex)),s=!e.meta.giaAssetIndexSchemaVersion&&u&&i.every(m=>m.giaInfoIndexSource!=="authoring")&&[...a.values()].every(m=>m.size===1)&&[...r.values()].every(m=>m.every(y=>y.kind===m[0].kind)),f=new Set;if(s)for(let m of r.values()){let y=m.find(I=>l.has(I))||m[0];for(let I of m)I!==y&&f.add(I)}let h=new Map,p=Number.isSafeInteger(e.meta.giaNextAssetIndex)&&e.meta.giaNextAssetIndex>=2?e.meta.giaNextAssetIndex:2;for(let m of i){if(!ke(m.giaInfoIndex)||(p=Math.max(p,m.giaInfoIndex+1),f.has(m)))continue;let y=h.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}`);h.set(m.giaInfoIndex,m)}s&&(p=Math.max(p,13));let g=s?[...o,...i.filter(m=>!l.has(m))].filter(m=>f.has(m)||!ke(m.giaInfoIndex)):i.filter(m=>!ke(m.giaInfoIndex));if(g.length&&p+g.length-1>2147483647)throw new Error("\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u7A7A\u95F4\u5DF2\u8017\u5C3D");for(let m of g)m.giaInfoIndex=p++,m.giaInfoIndexSource="authoring";e.meta.giaNextAssetIndex=p,e.meta.giaAssetIndexSchemaVersion=1,f.size&&t.push(`\u65E7\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u81EA\u52A8\u8FC1\u79FB\uFF1A\u4FEE\u590D ${f.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 ln=1;function sn(e="n"){let t=`${e}${ln}`;return ln+=1,t}function ki(e=1){ln=e}function un(e,{isRootContainer:t=!1}={}){if(e==="server-container"||e==="fullscreen"||e==="container"&&t)return Ci({layout:"stretch"});let i=Sr[e]||[80,80];return Ci({layout:"center",size:i})}function Zo(e,t){return Ar(()=>un(e,t))}function Qo(e){Le(e);let t={};for(let i of se)t[i]=ct(e,i);return t}function K(e,t={}){if(!kt[e])throw new Error(`unknown kind: ${e}`);Object.hasOwn(t,"transformByCanvas")&&ut(t);let i=t.isRootContainer===!0,n=t.id||sn(e==="server-container"?"sc":"n"),r=Object.hasOwn(t,"transformByPlatform")?Qo(t.transformByPlatform):Zo(e,{isRootContainer:i}),a={id:n,kind:e,name:t.name||kt[e],guid:t.guid??0,giaRelatedGuids:Array.isArray(t.giaRelatedGuids)?t.giaRelatedGuids.filter(o=>Number.isSafeInteger(Number(o))&&Number(o)>0).map(Number):[],...ke(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:Rr(e,t.giaRaw),transformByPlatform:r,children:[],scriptMappingIds:Array.isArray(t.scriptMappingIds)?t.scriptMappingIds.filter(o=>Number.isSafeInteger(Number(o))&&Number(o)>0).map(Number):[]};if(e==="container"&&(a.isolateNavigation=t.isolateNavigation===!0,a.disableKeyEventPassthrough=t.disableKeyEventPassthrough===!0,a.disableCursorEventPassthrough=t.disableCursorEventPassthrough===!0,a.showCursor=t.showCursor===!0),(e==="textbox"||e==="textwindow")&&(a.fontSize=t.fontSize??20,a.adaptiveFontSize=t.adaptiveFontSize===!0,a.minimumFontSize=t.minimumFontSize??20,a.fontColor=t.fontColor??Wt.font,a.bgColor=t.bgColor??Wt.bg,a.enableOutline=t.enableOutline!==!1,a.outlineColor=t.outlineColor??Wt.outline,a.horizontalAlignment=t.horizontalAlignment||"Left",a.verticalAlignment=t.verticalAlignment||"Top",Number.isInteger(t.giaRaw?.textVerticalAlign)&&![0,1,2].includes(t.giaRaw.textVerticalAlign)&&(a.giaRaw.textVerticalAlign=t.giaRaw.textVerticalAlign),a.text=t.text??"",Object.hasOwn(t.giaRaw||{},"textAlign")||(a.giaRaw.textAlign={Left:0,Middle:1,Right:2}[a.horizontalAlignment]??a.giaRaw.textAlign),e==="textwindow"&&(a.interactable=t.interactable!==!1,a.showScrollBar=t.showScrollBar!==!1)),e==="image"&&(a.imageSource=t.imageSource||"StaticReference",a.imageType=["Basic","Stretch"].includes(t.imageType)?t.imageType:null,a.imageId=t.imageId??100001,a.imageColor=t.imageColor??Wt.image,a.enableMask=t.enableMask===!0,a.enableSoftEdge=t.enableSoftEdge===!0,a.softEdgeMode=t.softEdgeMode||"Percentage",a.softEdgeWidthX=t.softEdgeWidthX??8,a.softEdgeWidthY=t.softEdgeWidthY??8,a.horizontalSoftRange=t.horizontalSoftRange??85,a.verticalSoftRange=t.verticalSoftRange??85,a.enableFill=t.enableFill===!0,a.fillType=t.fillType||"Horizontal",a.fillHorizontalType=t.fillHorizontalType||"Left",a.fillVerticalType=t.fillVerticalType||"Bottom",a.fillRadial90Type=t.fillRadial90Type||"BottomLeft",a.fillRadialType=t.fillRadialType||"Bottom",a.fillAmount=t.fillAmount??1,a.reverseMaskArea=t.reverseMaskArea===!0||t.reverseMask===!0,Object.hasOwn(t.giaRaw||{},"imageFillType")||(a.giaRaw.imageFillType={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[a.fillType]??a.giaRaw.imageFillType)),e==="button"&&(a.raycastTarget=t.raycastTarget!==!1,a.interactable=t.interactable!==!1,a.clickAudioId=t.clickAudioId??wr,a.unavailableChildId=t.unavailableChildId??null,a.hoverChildId=t.hoverChildId??null,a.pressedChildId=t.pressedChildId??null,a.selectedChildId=t.selectedChildId??null),e==="cursor"&&(a.raycastTarget=t.raycastTarget??t.giaRaw?.cursorField501!==0),e==="reference"&&(a.referencedPrefabId=t.referencedPrefabId??t.giaRaw?.templateRefSlot??null,Object.hasOwn(t.giaRaw||{},"templateRefSlot")||(a.giaRaw.templateRefSlot=String(a.referencedPrefabId??""))),e==="grid"&&(a.itemPrefabId=t.itemPrefabId??null,a.raycastTarget=t.raycastTarget!==!1,a.interactable=t.interactable!==!1,a.showScrollBar=t.showScrollBar!==!1,a.scrollDirection=t.scrollDirection||"Vertical",a.layoutConstraint=t.layoutConstraint||"AutoWrap",a.layoutConstraintFixedCount=t.layoutConstraintFixedCount??null,a.cellSizeX=t.cellSizeX??50,a.cellSizeY=t.cellSizeY??50,a.spacingX=t.spacingX??8,a.spacingY=t.spacingY??8,a.padding1X=t.padding1X??20,a.padding1Y=t.padding1Y??20,a.padding2X=t.padding2X??20,a.padding2Y=t.padding2Y??20,a.previewCount=t.previewCount??t.giaRaw?.gridField511??5,Object.hasOwn(t.giaRaw||{},"gridField511")||(a.giaRaw.gridField511=Math.trunc(a.previewCount))),e==="keyhint"&&(a.keyboardKeyCode=t.keyboardKeyCode??t.giaRaw?.keyHintField502??null,a.controllerKeyCode=t.controllerKeyCode??t.giaRaw?.keyHintField501??null,Object.hasOwn(t.giaRaw||{},"keyHintField502")||(a.giaRaw.keyHintField502=Math.trunc(a.keyboardKeyCode??1)),Object.hasOwn(t.giaRaw||{},"keyHintField501")||(a.giaRaw.keyHintField501=Math.trunc(a.controllerKeyCode??1))),e==="animation"||e==="fullscreen"){let o=e==="animation"?t.giaRaw?.effectSlot:t.giaRaw?.fullscreenEffectSlot;a.animationId=t.animationId??o??null,a.playSoundEffect=t.playSoundEffect??null,e==="animation"&&(a.layer=t.layer??null);let l=e==="animation"?"effectSlot":"fullscreenEffectSlot";Object.hasOwn(t.giaRaw||{},l)||(a.giaRaw[l]=String(a.animationId??""))}if(t.children)for(let o of t.children)a.children.push(o);return a}function ft(){ki(1);let e=K("server-container",{id:"sc1",name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668"}),t=K("container",{id:"n1",name:"\u5BB9\u5668\u8282\u70B9",isRootContainer:!0}),i=K("textbox",{id:"n2",name:"\u6587\u672C\u6846",text:"\u6587\u672C"}),n=K("cursor",{id:"n3",name:"\u5149\u6807\u68C0\u6D4B\u533A\u57DF"}),r=K("reference",{id:"n4",name:"\u6A21\u677F\u5F15\u7528\u63A7\u4EF6"}),a=K("grid",{id:"n5",name:"\u7F51\u683C\u89C6\u7A97"}),o=K("button",{id:"n6",name:"\u9884\u8BBE\u6309\u94AE"}),l=K("textwindow",{id:"n7",name:"\u6587\u672C\u89C6\u7A97"}),u=K("keyhint",{id:"n8",name:"\u6309\u952E\u63D0\u793A"}),s=K("image",{id:"n9",name:"\u56FE\u7247",imageId:100005}),f=K("animation",{id:"n10",name:"\u754C\u9762\u52A8\u6548"}),h=K("fullscreen",{id:"n11",name:"\u5168\u5C4F\u52A8\u6548"}),p=(g,m,y)=>{for(let I of Object.values(g.transformByPlatform))I.offset={x:m,y}};return p(i,-300,250),p(n,-300,140),p(r,-300,30),p(a,-300,-100),p(o,0,0),p(l,300,250),p(u,300,140),p(s,300,30),p(f,300,-100),t.children.push(i,n,r,a,o,l,u,s,f,h),e.children.push(t),ki(12),Mr(e),{version:1,layoutSchemaVersion:be,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 Rt(){ki(1);let e=K("server-container",{id:"sc1",name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"}),t=K("container",{id:"n1",guid:1073742100,name:"Lua\u5B9E\u4F8B\u5316\u9762\u677F"}),i=K("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=K("image",{id:"n3",guid:1073742102,name:"\u6A21\u677F\u56FE\u6807",imageId:100005}),r=K("button",{id:"n4",guid:1073742103,name:"\u786E\u8BA4\u6309\u94AE"}),a=K("textbox",{id:"n5",guid:1073742104,name:"\u6309\u94AE\u6587\u5B57",text:"\u786E\u8BA4",horizontalAlignment:"Middle",verticalAlignment:"Top"}),o=(s,f,h)=>{for(let p of Object.values(s.transformByPlatform))p.offset={x:f,y:h}};((s,f,h)=>{for(let p of Object.values(s.transformByPlatform))p.size={x:f,y:h}})(t,520,320),o(i,0,110),o(n,0,0),o(r,0,-110),r.children.push(a),t.children.push(i,n,r),e.children.push(t),ki(6);let u={version:1,layoutSchemaVersion:be,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 Xe(u),u}function Z(e,t,i=null){t(e,i);for(let n of e.children||[])Z(n,t,e)}function he(e,t){let i=null;return Z(e,n=>{n.id===t&&(i=n)}),i}function cn(e,t="n"){let i=sn(t);for(;he(e,i);)i=sn(t);return i}function Je(e,t){let i=null;return Z(e,(n,r)=>{n.id===t&&(i=r)}),i}function fn(e){let t=e.root||e;return t.kind==="container"?t:(t.children||[]).find(i=>i.kind==="container")||(t.children||[])[0]||t}function Qt(e){if(e.meta?.assetType!=="client-control-template")return fn(e);let t=he(e.root,e.selectedId);if(!t||t.kind==="server-container")return e.root.children?.[0]||e.root;let i=Je(e.root,t.id);for(;i&&i.kind!=="server-container";)t=i,i=Je(e.root,t.id);return t}function dn(e){ut(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"&&el(e.transformByPlatform);let i=K(e.kind,t);return i.children=(e.children||[]).map(n=>dn(n)),i}function el(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 Nr(e,t,i={}){if(e.kind==="server-container"&&t!=="container")throw new Error("server container only accepts container nodes");let n=K(t,i);return e.children.push(n),n}function Fr(e,t){if(e.id===t)throw new Error("cannot remove root");let i=Je(e,t);if(!i)return!1;let n=i.children.findIndex(r=>r.id===t);return n<0?!1:(i.children.splice(n,1),!0)}var Or=1e-4;function tl(e,t){return Math.abs(e.anchorMax[t]-e.anchorMin[t])>Or&&Math.abs(e.size[t])<=Or}function il(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=Ye(t,e),r=(n.centerX-t.left)/t.width,a=(n.centerY-t.bottom)/t.height,o=lt(i,e,{posX:i.left+r*i.width,posY:i.bottom+a*i.height,width:n.width,height:n.height});for(let l of["x","y"])tl(e,l)&&(o.offset[l]=e.offset[l],o.size[l]=e.size[l]);return o}function zr({transformByPlatform:e,source:t,canvasId:i,syncAllDevices:n,sourceParentBox:r=ve(i),targetParentBoxByPlatform:a={}}){Le(e);let o=st(i),l={};for(let u of se)u===o?l[u]=ze(t):n!==!1?l[u]=il(t,r,a[u]||ve(Ct[u])):l[u]=ct(e,u);return Le(l),l}function Ze(e,t){return ct(e,st(t))}function $r(e,t){let i=[];function n(r){t[r.id]&&i.push(t[r.id]);let a=r.children||[];for(let o=a.length-1;o>=0;o-=1)n(a[o])}return n(e),i}function Qe(e,t,i=st(t)){let n=ve(t),r={};function a(o,l,u){let s=ct(o.transformByPlatform,i),f=Ye(l,s),h=o.kind==="server-container"?u:Zt(u,f,s),p=Cr(f,h);r[o.id]={...f,...rn(f),id:o.id,kind:o.kind,name:o.name,visible:o.visible!==!1,active:o.active!==!1,rotationX:s.rotation.x,rotationY:s.rotation.y,rotationZ:s.rotation.z,renderLeft:p.left,renderBottom:p.bottom,renderWidth:p.width,renderHeight:p.height,renderRotationZ:p.rotationZ,renderMatrix:h,primitive:o.kind==="image"?Et(o.imageId,o.imageSource):null,...o.kind==="textbox"||o.kind==="textwindow"?{text:o.text??"",fontSize:o.fontSize,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 g=o.kind==="server-container"?l:f;for(let m of o.children||[])a(m,g,h)}return a(e,n,_t()),{canvas:n,boxes:r}}function hn(e,t){let i=[];function n(r,a,o=null,l=[],u=0,s=1,f=e.id){i.push({id:r.id,guid:t?.get(r.id)??(r.guid||0),kind:r.kind,name:r.name,label:kt[r.kind]||r.kind,depth:a,parentId:o,ancestorIds:l,siblingIndex:u,siblingCount:s,templateId:f,childCount:(r.children||[]).length,incomplete:!xi.includes(r.kind)});let h=r.children||[];for(let p=0;p<h.length;p+=1)n(h[p],a+1,r.id,[...l,r.id],p,h.length,f)}return n(e,0),i}function T(e,t,i,n,r={}){return{key:e,label:t,type:i,value:n,...r}}function Gr(e,t,i,n){if(!e)return null;let r=Ze(e.transformByPlatform,t),a=rn(i),o=[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",a.posX,{computed:!0}),T("posY","\u4F4D\u7F6E Y","number",a.posY,{computed:!0}),T("width","\u5927\u5C0F W","number",a.width,{computed:!0}),T("height","\u5927\u5C0F H","number",a.height,{computed:!0}),T("rotationX","\u65CB\u8F6C X","number",r.rotation.x),T("rotationY","\u65CB\u8F6C Y","number",r.rotation.y),T("rotationZ","\u65CB\u8F6C Z","number",r.rotation.z),T("syncAllDevices","\u540C\u6B65\u4FE1\u606F\u81F3\u6240\u6709\u8BBE\u5907","bool",e.syncAllDevices!==!1),T("anchorType","\u951A\u70B9\u7C7B\u578B","enum",Er(r),{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",r.anchorMin.x),T("anchorMinY","\u951A\u70B9 Min Y","number",r.anchorMin.y),T("anchorMaxX","\u951A\u70B9 Max X","number",r.anchorMax.x),T("anchorMaxY","\u951A\u70B9 Max Y","number",r.anchorMax.y),T("pivotX","\u4E2D\u5FC3 X","number",r.pivot.x),T("pivotY","\u4E2D\u5FC3 Y","number",r.pivot.y)];if(e.kind==="container"&&o.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 l=e.giaRaw?.textAlign,u=[0,1,2].includes(l)?e.horizontalAlignment||"Left":`__unrecognized:${l}`;o.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",u,{...[0,1,2].includes(l)?{}:{unknownValue:l},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 l=e.giaRaw?.imageFillType,u=[1,2,3,4,5].includes(l)?e.fillType:`__unrecognized:${l}`;o.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",u,{...[1,2,3,4,5].includes(l)?{}:{unknownValue:l},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 l=[{value:"",label:"\u672A\u8BBE\u7F6E"},...(e.children||[]).map(u=>({value:u.id,label:`${u.name} \xB7 ${u.id}`}))];o.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:l,gia:"W"}),T("hoverChildId","\u60AC\u505C\u72B6\u6001\u8282\u70B9","node",e.hoverChildId,{options:l,gia:"W"}),T("pressedChildId","\u6309\u4E0B\u72B6\u6001\u8282\u70B9","node",e.pressedChildId,{options:l,gia:"W"}),T("selectedChildId","\u9009\u4E2D\u72B6\u6001\u8282\u70B9","node",e.selectedChildId,{options:l,gia:"W"}),T("clickAudioId","\u70B9\u51FB\u97F3\u6548","number",e.clickAudioId))}return e.kind==="reference"&&o.push(T("referencedPrefabId","\u5F15\u7528\u63A7\u4EF6\u6A21\u677F\u7D22\u5F15","string",e.referencedPrefabId??"")),(e.kind==="textwindow"||e.kind==="grid")&&o.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"&&o.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"&&o.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")&&o.push(T("animationId",e.kind==="animation"?"\u52A8\u6548\u7D22\u5F15":"\u5168\u5C4F\u52A8\u6548\u7D22\u5F15","string",e.animationId??"")),(!xi.includes(e.kind)||e.kind==="textwindow"||e.kind==="grid")&&o.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:n?.get(e.id)??(e.guid||0),kind:e.kind,label:kt[e.kind]||e.kind,incomplete:!xi.includes(e.kind),fields:o}}function Dr(e,t,i){let n=(Array.isArray(e)?e:Object.values(e)).filter(r=>r.kind!=="server-container");for(let r=n.length-1;r>=0;r-=1){let a=n[r];if(!a.visible||!a.active)continue;let o=a.renderMatrix&&Tt(a.renderMatrix),l=o&&Te(o,t,i);if(l&&l.x>=a.left&&l.x<=a.right&&l.y>=a.bottom&&l.y<=a.top)return a.id}return null}import nl from"protobufjs";function Mt(e,t=!1){let i=[],n=(r,a)=>{r.kind!=="server-container"&&i.push({node:r,parent:a});let o=t&&r.kind!=="server-container"?[...r.children||[]].reverse():r.children||[];for(let l of o)n(l,r)};return n(e.root,null),i}var rl=String.raw`
|
|
1
|
+
var yd=Object.create;var Pa=Object.defineProperty;var vd=Object.getOwnPropertyDescriptor;var bd=Object.getOwnPropertyNames;var wd=Object.getPrototypeOf,Sd=Object.prototype.hasOwnProperty;var xd=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var te=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var _d=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of bd(e))!Sd.call(t,n)&&n!==i&&Pa(t,n,{get:()=>e[n],enumerable:!(r=vd(e,n))||r.enumerable});return t};var Id=(t,e,i)=>(i=t!=null?yd(wd(t)):{},_d(e||!t||!t.__esModule?Pa(i,"default",{value:t,enumerable:!0}):i,t));var Go=te((Fy,wl)=>{"use strict";wl.exports=ih;function ih(t,e){for(var i=new Array(arguments.length-1),r=0,n=2,o=!0;n<arguments.length;)i[r++]=arguments[n++];return new Promise(function(a,l){i[r]=function(f){if(o)if(o=!1,f)l(f);else{for(var h=new Array(arguments.length-1),m=0;m<h.length;)h[m++]=arguments[m];a.apply(null,h)}};try{t.apply(e||null,i)}catch(u){o&&(o=!1,l(u))}})}});var _l=te(xl=>{"use strict";var vn=xl;vn.length=function(e){var i=e.length;if(!i)return 0;for(;i>0&&e.charAt(i-1)==="=";)--i;return Math.floor(i*3/4)};var Qi=new Array(64),bn=new Array(123);for(yt=0;yt<64;)bn[Qi[yt]=yt<26?yt+65:yt<52?yt+71:yt<62?yt-4:yt-59|43]=yt++;var yt;bn[45]=62;bn[95]=63;vn.encode=function(e,i,r){for(var n=null,o=[],s=0,a=0,l;i<r;){var u=e[i++];switch(a){case 0:o[s++]=Qi[u>>2],l=(u&3)<<4,a=1;break;case 1:o[s++]=Qi[l|u>>4],l=(u&15)<<2,a=2;break;case 2:o[s++]=Qi[l|u>>6],o[s++]=Qi[u&63],a=0;break}s>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,o)),s=0)}return a&&(o[s++]=Qi[l],o[s++]=61,a===1&&(o[s++]=61)),n?(s&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var Sl="invalid encoding";vn.decode=function(e,i,r){for(var n=r,o=0,s,a=0;a<e.length;){var l=e.charCodeAt(a++);if(l===61&&o>1)break;if((l=bn[l])===void 0)throw Error(Sl);switch(o){case 0:s=l,o=1;break;case 1:i[r++]=s<<2|(l&48)>>4,s=l,o=2;break;case 2:i[r++]=(s&15)<<4|(l&60)>>2,s=l,o=3;break;case 3:i[r++]=(s&3)<<6|l,o=0;break}}if(o===1)throw Error(Sl);return r-n};var rh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,nh=/[-_]/,oh=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}(?:==)?|[A-Za-z0-9_-]{3}=?)?$/;vn.test=function(e){return rh.test(e)||nh.test(e)&&oh.test(e)}});var Cl=te((zy,Il)=>{"use strict";Il.exports=wn;function wn(){this._listeners=Object.create(null)}wn.prototype.on=function(e,i,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:i,ctx:r||this}),this};wn.prototype.off=function(e,i){if(e===void 0)this._listeners=Object.create(null);else if(i===void 0)this._listeners[e]=[];else{var r=this._listeners[e];if(!r)return this;for(var n=0;n<r.length;)r[n].fn===i?r.splice(n,1):++n}return this};wn.prototype.emit=function(e){var i=this._listeners[e];if(i){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<i.length;)i[n].fn.apply(i[n++].ctx,r)}return this}});var Nl=te((Dy,Rl)=>{"use strict";Rl.exports=El(El);function El(t){return typeof Float32Array<"u"?(function(){var e=new Float32Array([-0]),i=new Uint8Array(e.buffer),r=i[3]===128;function n(l,u,f){e[0]=l,u[f]=i[0],u[f+1]=i[1],u[f+2]=i[2],u[f+3]=i[3]}function o(l,u,f){e[0]=l,u[f]=i[3],u[f+1]=i[2],u[f+2]=i[1],u[f+3]=i[0]}t.writeFloatLE=r?n:o,t.writeFloatBE=r?o:n;function s(l,u){return i[0]=l[u],i[1]=l[u+1],i[2]=l[u+2],i[3]=l[u+3],e[0]}function a(l,u){return i[3]=l[u],i[2]=l[u+1],i[1]=l[u+2],i[0]=l[u+3],e[0]}t.readFloatLE=r?s:a,t.readFloatBE=r?a:s})():(function(){function e(r,n,o,s){var a=n<0?1:0;if(a&&(n=-n),n===0)r(1/n>0?0:2147483648,o,s);else if(isNaN(n))r(2143289344,o,s);else if(n>34028234663852886e22)r((a<<31|2139095040)>>>0,o,s);else if(n<11754943508222875e-54)r((a<<31|Math.round(n/1401298464324817e-60))>>>0,o,s);else{var l=Math.floor(Math.log(n)/Math.LN2),u=Math.round(n*Math.pow(2,-l)*8388608)&8388607;r((a<<31|l+127<<23|u)>>>0,o,s)}}t.writeFloatLE=e.bind(null,kl),t.writeFloatBE=e.bind(null,Al);function i(r,n,o){var s=r(n,o),a=(s>>31)*2+1,l=s>>>23&255,u=s&8388607;return l===255?u?NaN:a*(1/0):l===0?a*1401298464324817e-60*u:a*Math.pow(2,l-150)*(u+8388608)}t.readFloatLE=i.bind(null,Ol),t.readFloatBE=i.bind(null,Tl)})(),typeof Float64Array<"u"?(function(){var e=new Float64Array([-0]),i=new Uint8Array(e.buffer),r=i[7]===128;function n(l,u,f){e[0]=l,u[f]=i[0],u[f+1]=i[1],u[f+2]=i[2],u[f+3]=i[3],u[f+4]=i[4],u[f+5]=i[5],u[f+6]=i[6],u[f+7]=i[7]}function o(l,u,f){e[0]=l,u[f]=i[7],u[f+1]=i[6],u[f+2]=i[5],u[f+3]=i[4],u[f+4]=i[3],u[f+5]=i[2],u[f+6]=i[1],u[f+7]=i[0]}t.writeDoubleLE=r?n:o,t.writeDoubleBE=r?o:n;function s(l,u){return i[0]=l[u],i[1]=l[u+1],i[2]=l[u+2],i[3]=l[u+3],i[4]=l[u+4],i[5]=l[u+5],i[6]=l[u+6],i[7]=l[u+7],e[0]}function a(l,u){return i[7]=l[u],i[6]=l[u+1],i[5]=l[u+2],i[4]=l[u+3],i[3]=l[u+4],i[2]=l[u+5],i[1]=l[u+6],i[0]=l[u+7],e[0]}t.readDoubleLE=r?s:a,t.readDoubleBE=r?a:s})():(function(){function e(r,n,o,s,a,l){var u=s<0?1:0;if(u&&(s=-s),s===0)r(0,a,l+n),r(1/s>0?0:2147483648,a,l+o);else if(isNaN(s))r(0,a,l+n),r(2146959360,a,l+o);else if(s>17976931348623157e292)r(0,a,l+n),r((u<<31|2146435072)>>>0,a,l+o);else{var f;if(s<22250738585072014e-324)f=s/5e-324,r(f>>>0,a,l+n),r((u<<31|f/4294967296)>>>0,a,l+o);else{var h=Math.floor(Math.log(s)/Math.LN2);h===1024&&(h=1023),f=s*Math.pow(2,-h),r(f*4503599627370496>>>0,a,l+n),r((u<<31|h+1023<<20|f*1048576&1048575)>>>0,a,l+o)}}}t.writeDoubleLE=e.bind(null,kl,0,4),t.writeDoubleBE=e.bind(null,Al,4,0);function i(r,n,o,s,a){var l=r(s,a+n),u=r(s,a+o),f=(u>>31)*2+1,h=u>>>20&2047,m=4294967296*(u&1048575)+l;return h===2047?m?NaN:f*(1/0):h===0?f*5e-324*m:f*Math.pow(2,h-1075)*(m+4503599627370496)}t.readDoubleLE=i.bind(null,Ol,0,4),t.readDoubleBE=i.bind(null,Tl,4,0)})(),t}function kl(t,e,i){e[i]=t&255,e[i+1]=t>>>8&255,e[i+2]=t>>>16&255,e[i+3]=t>>>24}function Al(t,e,i){e[i]=t>>>24,e[i+1]=t>>>16&255,e[i+2]=t>>>8&255,e[i+3]=t&255}function Ol(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function Tl(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var Ml=te(Fl=>{"use strict";var xn=Fl,Sn=new TextDecoder("utf-8",{ignoreBOM:!0}),Ar,Pl=64;try{Ar=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}catch{Ar=Sn}xn.length=function(e){for(var i=0,r=0,n=0;n<e.length;++n)r=e.charCodeAt(n),r<128?i+=1:r<2048?i+=2:(r&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320?(++n,i+=4):i+=3;return i};function er(t,e,i,r){var n=i===0&&r===e.length?e:e.subarray(i,r);return t.decode(n)}xn.read=function(e,i,r){if(r-i<1)return"";if(r-i>=Pl)return er(Sn,e,i,r);for(var n="",o=i,s,a,l,u,f,h,m,p;o+7<r;o+=8){if(s=e[o],a=e[o+1],l=e[o+2],u=e[o+3],f=e[o+4],h=e[o+5],m=e[o+6],p=e[o+7],(s|a|l|u|f|h|m|p)&128)return n+er(Sn,e,o,r);n+=String.fromCharCode(s,a,l,u,f,h,m,p)}for(;o<r;++o){if(s=e[o],s&128)return n+er(Sn,e,o,r);n+=String.fromCharCode(s)}return n};xn.readStrict=function(e,i,r){if(r-i<1)return"";if(r-i>=Pl)return er(Ar,e,i,r);for(var n="",o=i,s,a,l,u,f,h,m,p;o+7<r;o+=8){if(s=e[o],a=e[o+1],l=e[o+2],u=e[o+3],f=e[o+4],h=e[o+5],m=e[o+6],p=e[o+7],(s|a|l|u|f|h|m|p)&128)return n+er(Ar,e,o,r);n+=String.fromCharCode(s,a,l,u,f,h,m,p)}for(;o<r;++o){if(s=e[o],s&128)return n+er(Ar,e,o,r);n+=String.fromCharCode(s)}return n};xn.write=function(e,i,r){for(var n=r,o,s,a=0;a<e.length;++a)o=e.charCodeAt(a),o<128?i[r++]=o:o<2048?(i[r++]=o>>6|192,i[r++]=o&63|128):(o&64512)===55296&&((s=e.charCodeAt(a+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++a,i[r++]=o>>18|240,i[r++]=o>>12&63|128,i[r++]=o>>6&63|128,i[r++]=o&63|128):(i[r++]=o>>12|224,i[r++]=o>>6&63|128,i[r++]=o&63|128);return r-n}});var Dl=te((Gy,zl)=>{"use strict";zl.exports=sh;function sh(t,e,i){var r=i||8192,n=r>>>1,o=null,s=r;return function(l){if(l<1||l>n)return t(l);s+l>r&&(o=t(r),s=0);var u=e.call(o,s,s+=l);return s&7&&(s=(s|7)+1),u}}});var Gl=te((qy,$l)=>{"use strict";$l.exports=Me;var Or;function Me(t,e){this.lo=t>>>0,this.hi=e>>>0}var Ti=Me.zero=new Me(0,0);Ti.toNumber=function(){return 0};Ti.zzEncode=Ti.zzDecode=function(){return this};Ti.length=function(){return 1};var ah=Me.zeroHash="\0\0\0\0\0\0\0\0";Me.fromNumber=function(e){if(e===0)return Ti;var i=e<0;i&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return i&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new Me(r,n)};Me.from=function(e){if(typeof e=="number")return Me.fromNumber(e);if(typeof e=="string"||e instanceof String)if(Or)e=Or.fromString(e);else return Me.fromNumber(parseInt(e,10));return e.low||e.high?new Me(e.low>>>0,e.high>>>0):Ti};Me.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var i=~this.lo+1>>>0,r=~this.hi>>>0;return i||(r=r+1>>>0),-(i+r*4294967296)}return this.lo+this.hi*4294967296};Me.prototype.toLong=function(e){return Or?new Or(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var ai=String.prototype.charCodeAt;Me.fromHash=function(e){return e===ah?Ti:new Me((ai.call(e,0)|ai.call(e,1)<<8|ai.call(e,2)<<16|ai.call(e,3)<<24)>>>0,(ai.call(e,4)|ai.call(e,5)<<8|ai.call(e,6)<<16|ai.call(e,7)<<24)>>>0)};Me.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Me.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Me.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Me.prototype.length=function(){var e=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return r===0?i===0?e<16384?e<128?1:2:e<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:r<128?9:10};Me._configure=function(t){Or=t}});var ql=te((Tr,qo)=>{(function(t,e){function i(r){return r.default||r}typeof define=="function"&&define.amd?define([],function(){var r={};return e(r),i(r)}):typeof Tr=="object"?(e(Tr),typeof qo=="object"&&(qo.exports=i(Tr))):(function(){var r={};e(r),t.Long=i(r)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Tr,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function i(E,c,S){this.low=E|0,this.high=c|0,this.unsigned=!!S}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0});function r(E){return(E&&E.__isLong__)===!0}function n(E){var c=Math.clz32(E&-E);return E?31-c:c}i.isLong=r;var o={},s={};function a(E,c){var S,M,j;return c?(E>>>=0,(j=0<=E&&E<256)&&(M=s[E],M)?M:(S=u(E,0,!0),j&&(s[E]=S),S)):(E|=0,(j=-128<=E&&E<128)&&(M=o[E],M)?M:(S=u(E,E<0?-1:0,!1),j&&(o[E]=S),S))}i.fromInt=a;function l(E,c){if(isNaN(E))return c?C:$;if(c){if(E<0)return C;if(E>=w)return _}else{if(E<=-x)return O;if(E+1>=x)return B}return E<0?l(-E,c).neg():u(E%b|0,E/b|0,c)}i.fromNumber=l;function u(E,c,S){return new i(E,c,S)}i.fromBits=u;var f=Math.pow;function h(E,c,S){if(E.length===0)throw Error("empty string");if(typeof c=="number"?(S=c,c=!1):c=!!c,E==="NaN"||E==="Infinity"||E==="+Infinity"||E==="-Infinity")return c?C:$;if(S=S||10,S<2||36<S)throw RangeError("radix");var M;if((M=E.indexOf("-"))>0)throw Error("interior hyphen");if(M===0)return h(E.substring(1),c,S).neg();for(var j=l(f(S,8)),H=$,Q=0;Q<E.length;Q+=8){var ce=Math.min(8,E.length-Q),ve=parseInt(E.substring(Q,Q+ce),S);if(ce<8){var be=l(f(S,ce));H=H.mul(be).add(l(ve))}else H=H.mul(j),H=H.add(l(ve))}return H.unsigned=c,H}i.fromString=h;function m(E,c){return typeof E=="number"?l(E,c):typeof E=="string"?h(E,c):u(E.low,E.high,typeof c=="boolean"?c:E.unsigned)}i.fromValue=m;var p=65536,g=1<<24,b=p*p,w=b*b,x=w/2,I=a(g),$=a(0);i.ZERO=$;var C=a(0,!0);i.UZERO=C;var D=a(1);i.ONE=D;var G=a(1,!0);i.UONE=G;var Y=a(-1);i.NEG_ONE=Y;var B=u(-1,2147483647,!1);i.MAX_VALUE=B;var _=u(-1,-1,!0);i.MAX_UNSIGNED_VALUE=_;var O=u(0,-2147483648,!1);i.MIN_VALUE=O;var y=i.prototype;y.toInt=function(){return this.unsigned?this.low>>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*b+(this.low>>>0):this.high*b+(this.low>>>0)},y.toString=function(c){if(c=c||10,c<2||36<c)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(O)){var S=l(c),M=this.div(S),j=M.mul(S).sub(this);return M.toString(c)+j.toInt().toString(c)}else return"-"+this.neg().toString(c);for(var H=l(f(c,6),this.unsigned),Q=this,ce="";;){var ve=Q.div(H),be=Q.sub(ve.mul(H)).toInt()>>>0,me=be.toString(c);if(Q=ve,Q.isZero())return me+ce;for(;me.length<6;)me="0"+me;ce=""+me+ce}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var c=this.high!=0?this.high:this.low,S=31;S>0&&(c&1<<S)==0;S--);return this.high!=0?S+33:S+1},y.isSafeInteger=function(){var c=this.high>>21;return c?this.unsigned?!1:c===-1&&!(this.low===0&&this.high===-2097152):!0},y.isZero=function(){return this.high===0&&this.low===0},y.eqz=y.isZero,y.isNegative=function(){return!this.unsigned&&this.high<0},y.isPositive=function(){return this.unsigned||this.high>=0},y.isOdd=function(){return(this.low&1)===1},y.isEven=function(){return(this.low&1)===0},y.equals=function(c){return r(c)||(c=m(c)),this.unsigned!==c.unsigned&&this.high>>>31===1&&c.high>>>31===1?!1:this.high===c.high&&this.low===c.low},y.eq=y.equals,y.notEquals=function(c){return!this.eq(c)},y.neq=y.notEquals,y.ne=y.notEquals,y.lessThan=function(c){return this.comp(c)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(c){return this.comp(c)<=0},y.lte=y.lessThanOrEqual,y.le=y.lessThanOrEqual,y.greaterThan=function(c){return this.comp(c)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(c){return this.comp(c)>=0},y.gte=y.greaterThanOrEqual,y.ge=y.greaterThanOrEqual,y.compare=function(c){if(r(c)||(c=m(c)),this.eq(c))return 0;var S=this.isNegative(),M=c.isNegative();return S&&!M?-1:!S&&M?1:this.unsigned?c.high>>>0>this.high>>>0||c.high===this.high&&c.low>>>0>this.low>>>0?-1:1:this.sub(c).isNegative()?-1:1},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(D)},y.neg=y.negate,y.add=function(c){r(c)||(c=m(c));var S=this.high>>>16,M=this.high&65535,j=this.low>>>16,H=this.low&65535,Q=c.high>>>16,ce=c.high&65535,ve=c.low>>>16,be=c.low&65535,me=0,ee=0,ue=0,Se=0;return Se+=H+be,ue+=Se>>>16,Se&=65535,ue+=j+ve,ee+=ue>>>16,ue&=65535,ee+=M+ce,me+=ee>>>16,ee&=65535,me+=S+Q,me&=65535,u(ue<<16|Se,me<<16|ee,this.unsigned)},y.subtract=function(c){return r(c)||(c=m(c)),this.add(c.neg())},y.sub=y.subtract,y.multiply=function(c){if(this.isZero())return this;if(r(c)||(c=m(c)),e){var S=e.mul(this.low,this.high,c.low,c.high);return u(S,e.get_high(),this.unsigned)}if(c.isZero())return this.unsigned?C:$;if(this.eq(O))return c.isOdd()?O:$;if(c.eq(O))return this.isOdd()?O:$;if(this.isNegative())return c.isNegative()?this.neg().mul(c.neg()):this.neg().mul(c).neg();if(c.isNegative())return this.mul(c.neg()).neg();if(this.lt(I)&&c.lt(I))return l(this.toNumber()*c.toNumber(),this.unsigned);var M=this.high>>>16,j=this.high&65535,H=this.low>>>16,Q=this.low&65535,ce=c.high>>>16,ve=c.high&65535,be=c.low>>>16,me=c.low&65535,ee=0,ue=0,Se=0,ht=0;return ht+=Q*me,Se+=ht>>>16,ht&=65535,Se+=H*me,ue+=Se>>>16,Se&=65535,Se+=Q*be,ue+=Se>>>16,Se&=65535,ue+=j*me,ee+=ue>>>16,ue&=65535,ue+=H*be,ee+=ue>>>16,ue&=65535,ue+=Q*ve,ee+=ue>>>16,ue&=65535,ee+=M*me+j*be+H*ve+Q*ce,ee&=65535,u(Se<<16|ht,ee<<16|ue,this.unsigned)},y.mul=y.multiply,y.divide=function(c){if(r(c)||(c=m(c)),c.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&c.low===-1&&c.high===-1)return this;var S=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,c.low,c.high);return u(S,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?C:$;var M,j,H;if(this.unsigned){if(c.unsigned||(c=c.toUnsigned()),c.gt(this))return C;if(c.gt(this.shru(1)))return G;H=C}else{if(this.eq(O)){if(c.eq(D)||c.eq(Y))return O;if(c.eq(O))return D;var Q=this.shr(1);return M=Q.div(c).shl(1),M.eq($)?c.isNegative()?D:Y:(j=this.sub(c.mul(M)),H=M.add(j.div(c)),H)}else if(c.eq(O))return this.unsigned?C:$;if(this.isNegative())return c.isNegative()?this.neg().div(c.neg()):this.neg().div(c).neg();if(c.isNegative())return this.div(c.neg()).neg();H=$}for(j=this;j.gte(c);){M=Math.max(1,Math.floor(j.toNumber()/c.toNumber()));for(var ce=Math.ceil(Math.log(M)/Math.LN2),ve=ce<=48?1:f(2,ce-48),be=l(M),me=be.mul(c);me.isNegative()||me.gt(j);)M-=ve,be=l(M,this.unsigned),me=be.mul(c);be.isZero()&&(be=D),H=H.add(be),j=j.sub(me)}return H},y.div=y.divide,y.modulo=function(c){if(r(c)||(c=m(c)),e){var S=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,c.low,c.high);return u(S,e.get_high(),this.unsigned)}return this.sub(this.div(c).mul(c))},y.mod=y.modulo,y.rem=y.modulo,y.not=function(){return u(~this.low,~this.high,this.unsigned)},y.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},y.clz=y.countLeadingZeros,y.countTrailingZeros=function(){return this.low?n(this.low):n(this.high)+32},y.ctz=y.countTrailingZeros,y.and=function(c){return r(c)||(c=m(c)),u(this.low&c.low,this.high&c.high,this.unsigned)},y.or=function(c){return r(c)||(c=m(c)),u(this.low|c.low,this.high|c.high,this.unsigned)},y.xor=function(c){return r(c)||(c=m(c)),u(this.low^c.low,this.high^c.high,this.unsigned)},y.shiftLeft=function(c){return r(c)&&(c=c.toInt()),(c&=63)===0?this:c<32?u(this.low<<c,this.high<<c|this.low>>>32-c,this.unsigned):u(0,this.low<<c-32,this.unsigned)},y.shl=y.shiftLeft,y.shiftRight=function(c){return r(c)&&(c=c.toInt()),(c&=63)===0?this:c<32?u(this.low>>>c|this.high<<32-c,this.high>>c,this.unsigned):u(this.high>>c-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(c){return r(c)&&(c=c.toInt()),(c&=63)===0?this:c<32?u(this.low>>>c|this.high<<32-c,this.high>>>c,this.unsigned):c===32?u(this.high,0,this.unsigned):u(this.high>>>c-32,0,this.unsigned)},y.shru=y.shiftRightUnsigned,y.shr_u=y.shiftRightUnsigned,y.rotateLeft=function(c){var S;return r(c)&&(c=c.toInt()),(c&=63)===0?this:c===32?u(this.high,this.low,this.unsigned):c<32?(S=32-c,u(this.low<<c|this.high>>>S,this.high<<c|this.low>>>S,this.unsigned)):(c-=32,S=32-c,u(this.high<<c|this.low>>>S,this.low<<c|this.high>>>S,this.unsigned))},y.rotl=y.rotateLeft,y.rotateRight=function(c){var S;return r(c)&&(c=c.toInt()),(c&=63)===0?this:c===32?u(this.high,this.low,this.unsigned):c<32?(S=32-c,u(this.high<<S|this.low>>>c,this.low<<S|this.high>>>c,this.unsigned)):(c-=32,S=32-c,u(this.low<<S|this.high>>>c,this.high<<S|this.low>>>c,this.unsigned))},y.rotr=y.rotateRight,y.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},y.toBytes=function(c){return c?this.toBytesLE():this.toBytesBE()},y.toBytesLE=function(){var c=this.high,S=this.low;return[S&255,S>>>8&255,S>>>16&255,S>>>24,c&255,c>>>8&255,c>>>16&255,c>>>24]},y.toBytesBE=function(){var c=this.high,S=this.low;return[c>>>24,c>>>16&255,c>>>8&255,c&255,S>>>24,S>>>16&255,S>>>8&255,S&255]},i.fromBytes=function(c,S,M){return M?i.fromBytesLE(c,S):i.fromBytesBE(c,S)},i.fromBytesLE=function(c,S){return new i(c[0]|c[1]<<8|c[2]<<16|c[3]<<24,c[4]|c[5]<<8|c[6]<<16|c[7]<<24,S)},i.fromBytesBE=function(c,S){return new i(c[4]<<24|c[5]<<16|c[6]<<8|c[7],c[0]<<24|c[1]<<16|c[2]<<8|c[3],S)},typeof BigInt=="function"&&(i.fromBigInt=function(c,S){var M=Number(BigInt.asIntN(32,c)),j=Number(BigInt.asIntN(32,c>>BigInt(32)));return u(M,j,S)},i.fromValue=function(c,S){return typeof c=="bigint"?i.fromBigInt(c,S):m(c,S)},y.toBigInt=function(){var c=BigInt(this.low>>>0),S=BigInt(this.unsigned?this.high>>>0:this.high);return S<<BigInt(32)|c});var N=t.default=i})});var Tt=te(Bo=>{"use strict";var K=Bo;K.asPromise=Go();K.base64=_l();K.EventEmitter=Cl();K.float=Nl();K.utf8=Ml();K.pool=Dl();K.LongBits=Gl();function Bl(t){return t==="__proto__"||t==="prototype"||t==="constructor"}K.isUnsafeProperty=Bl;K.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);K.global=K.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||typeof globalThis<"u"&&globalThis||Bo;K.emptyArray=Object.freeze?Object.freeze([]):[];K.emptyObject=Object.freeze?Object.freeze({}):{};K.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};K.isString=function(e){return typeof e=="string"||e instanceof String};K.isObject=function(e){return e&&typeof e=="object"};K.isset=K.isSet=function(e,i){var r=e[i];return r!=null&&Object.hasOwnProperty.call(e,i)?typeof r!="object"||(Array.isArray(r)?r.length:Object.keys(r).length)>0:!1};K.Buffer=(function(){try{var t=K.global.Buffer;return t.prototype.utf8Write||K.isNode?t:null}catch{return null}})();K.newBuffer=function(e){var i=K.Buffer;return typeof e=="number"?i?i.allocUnsafe(e):new Uint8Array(e):i?i.from(e):new Uint8Array(e)};K.rawField=function(e,i,r){var n=[],o=e<<3|i;for(o>>>=0;o>127;)n.push(o&127|128),o>>>=7;n.push(o);for(var s=0;s<r.length;++s)n.push(r[s]);return K.newBuffer(n)};K.Array=Uint8Array;K.Long=K.global.dcodeIO&&K.global.dcodeIO.Long||K.global.Long||(function(){try{var t=ql();return t&&t.isLong?t:null}catch{return null}})();K.key2Re=/^(?:true|false|0|1)$/;K.key32Re=/^-?(?:0|[1-9][0-9]*)$/;K.key64Re=/^(?:[\x00-\xff]{8}|-?(?:0|[1-9][0-9]*))$/;K.longToHash=function(e){return e?K.LongBits.from(e).toHash():K.LongBits.zeroHash};K.longFromHash=function(e,i){var r=K.LongBits.fromHash(e);return K.Long?K.Long.fromBits(r.lo,r.hi,i):r.toNumber(!!i)};K.longFromKey=function(e,i){return K.key64Re.test(e)&&!K.key32Re.test(e)?K.longFromHash(e,i):e};K.boolFromKey=function(e){return e==="true"||e==="1"};function Vl(t){var e=typeof arguments[arguments.length-1]=="boolean",i=e?arguments.length-1:arguments.length;e=e&&arguments[arguments.length-1];for(var r=1;r<i;++r){var n=arguments[r];if(n)for(var o=Object.keys(n),s=0;s<o.length;++s)!Bl(o[s])&&(!e||!Object.prototype.hasOwnProperty.call(t,o[s])||t[o[s]]===void 0)&&(t[o[s]]=n[o[s]])}return t}K.merge=Vl;K.nestingLimit=32;K.recursionLimit=100;K.makeProp=function(e,i,r){Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{enumerable:r===void 0?!0:r,configurable:!0,writable:!0})};K.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function Ll(t){function e(i,r){if(!(this instanceof e))return new e(i,r);Object.defineProperty(this,"message",{get:function(){return i}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),r&&Vl(this,r)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}K.newError=Ll;K.ProtocolError=Ll("ProtocolError");K.oneOfGetter=function(e){for(var i={},r=0;r<e.length;++r)i[e[r]]=1;return function(){for(var n=Object.keys(this),o=n.length-1;o>-1;--o)if(i[n[o]]===1&&this[n[o]]!==void 0&&this[n[o]]!==null)return n[o]}};K.oneOfSetter=function(e){return function(i){for(var r=0;r<e.length;++r)e[r]!==i&&delete this[e[r]]}};K.toJSONOptions={longs:String,enums:String,bytes:String,json:!0}});var In=te((Vy,Hl)=>{"use strict";Hl.exports=W;var Rt=Tt(),Lo,Ut=Rt.LongBits,jl=Rt.base64,Vo=Rt.utf8;function W(){this.pos=0,this.buf=this.constructor.alloc(W.initialBufferSize),this.view=null,this.states=null}W.initialBufferSize=128;Object.defineProperty(W.prototype,"len",{configurable:!0,enumerable:!0,get:function(){return this.pos}});var Ul=function(){return Rt.Buffer?function(){return(W.create=function(){return new Lo})()}:function(){return new W}};W.create=Ul();W.alloc=function(e){return new Uint8Array(e)};W.alloc=Rt.pool(W.alloc,Uint8Array.prototype.subarray);function jo(t){return t<128?1:t<16384?2:t<2097152?3:t<268435456?4:5}W.prototype._reserve=function(e){var i=this.pos+e;if(i>this.buf.length){var r=this.buf.length<<1;r<i&&(r=i);var n=this.constructor.alloc(r);n.set(this.buf.subarray(0,this.pos),0),this.buf=n,this.view=null}};function lh(t,e,i){for(var r=0;r<t.length;)e[i++]=t.charCodeAt(r++)}function Ri(t,e,i){for(;t>127;)e[i++]=t&127|128,t>>>=7;return e[i]=t,i+1}W.prototype.uint32=function(e){e=e>>>0,this._reserve(5);var i=this.pos;return this.pos=Ri(e,this.buf,i),this};W.prototype.int32=function(e){return(e|=0)<0?(this._reserve(10),ir(Ut.fromNumber(e),this.buf,this.pos),this.pos+=10,this):this.uint32(e)};W.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function ir(t,e,i){for(var r=t.lo,n=t.hi;n;)e[i++]=r&127|128,r=(r>>>7|n<<25)>>>0,n>>>=7;for(;r>127;)e[i++]=r&127|128,r=r>>>7;return e[i]=r,i+1}W.prototype.uint64=function(e){var i=Ut.from(e);this._reserve(10);var r=this.pos;return this.pos=ir(i,this.buf,r),this};W.prototype.int64=W.prototype.uint64;W.prototype.sint64=function(e){var i=Ut.from(e).zzEncode();this._reserve(10);var r=this.pos;return this.pos=ir(i,this.buf,r),this};W.prototype.bool=function(e){return this._reserve(1),this.buf[this.pos++]=e?1:0,this};function tr(t,e,i){e[i]=t&255,e[i+1]=t>>>8&255,e[i+2]=t>>>16&255,e[i+3]=t>>>24}W.prototype.fixed32=function(e){return this._reserve(4),tr(e>>>0,this.buf,this.pos),this.pos+=4,this};W.prototype.sfixed32=W.prototype.fixed32;W.prototype.fixed64=function(e){var i=Ut.from(e);return this._reserve(8),tr(i.lo,this.buf,this.pos),tr(i.hi,this.buf,this.pos+4),this.pos+=8,this};W.prototype.sfixed64=W.prototype.fixed64;W.prototype.float=function(e){return this._reserve(4),Rt.float.writeFloatLE(e,this.buf,this.pos),this.pos+=4,this};W.prototype.double=function(e){return this._reserve(8),Rt.float.writeDoubleLE(e,this.buf,this.pos),this.pos+=8,this};W.prototype.bytes=function(e){var i=e.length>>>0;if(!i)return this._reserve(1),this.buf[this.pos++]=0,this;if(Rt.isString(e)){var r=W.alloc(i=jl.length(e));jl.decode(e,r,0),e=r}return this.uint32(i),this._reserve(i),this.buf.set(e,this.pos),this.pos+=i,this};W.prototype.raw=function(e){var i=e.length>>>0;return i?(this._reserve(i),this.buf.set(e,this.pos),this.pos+=i,this):this};W.prototype._delim=function(e,i){var r=jo(i);return r>1&&this.buf.copyWithin(e+r,e+1,e+1+i),Ri(i,this.buf,e),this.pos=e+r+i,this};W.prototype.string=function(e){var i=e.length;if(!i)return this._reserve(1),this.buf[this.pos++]=0,this;if(i<128){this._reserve(i*3+5);var r=this.pos;return this._delim(r,Vo.write(e,this.buf,r+1))}var n=Vo.length(e);return this.uint32(n),this._reserve(n),n===e.length?lh(e,this.buf,this.pos):Vo.write(e,this.buf,this.pos),this.pos+=n,this};W.prototype.uint32s=function(e){var i=e.length;this._reserve(i*5+5);for(var r=this.buf,n=this.pos,o=n+1,s=0;s<i;++s)o=Ri(e[s]>>>0,r,o);return this._delim(n,o-n-1)};W.prototype.int32s=function(e){var i=e.length;this._reserve(i*10+5);for(var r=this.buf,n=this.pos,o=n+1,s,a=0;a<i;++a)(s=e[a]|0)<0?o=ir(Ut.fromNumber(s),r,o):o=Ri(s,r,o);return this._delim(n,o-n-1)};W.prototype.sint32s=function(e){var i=e.length;this._reserve(i*5+5);for(var r=this.buf,n=this.pos,o=n+1,s=0;s<i;++s)o=Ri((e[s]<<1^e[s]>>31)>>>0,r,o);return this._delim(n,o-n-1)};W.prototype.uint64s=function(e){var i=e.length;this._reserve(i*10+5);for(var r=this.buf,n=this.pos,o=n+1,s=0;s<i;++s)o=ir(Ut.from(e[s]),r,o);return this._delim(n,o-n-1)};W.prototype.int64s=W.prototype.uint64s;W.prototype.sint64s=function(e){var i=e.length;this._reserve(i*10+5);for(var r=this.buf,n=this.pos,o=n+1,s=0;s<i;++s)o=ir(Ut.from(e[s]).zzEncode(),r,o);return this._delim(n,o-n-1)};W.prototype.bools=function(e){var i=e.length;this.uint32(i),this._reserve(i);for(var r=this.buf,n=this.pos,o=0;o<i;++o)r[n++]=e[o]?1:0;return this.pos+=i,this};var Yl=16,Xl=128;function _n(t,e,i){var r=t.view;if(r||e<i)return r;var n=t.buf;return t.view=new DataView(n.buffer,n.byteOffset,n.byteLength)}W.prototype.fixed32s=function(e){var i=e.length,r=i*4;this.uint32(r),this._reserve(r);var n=this.pos,o,s=_n(this,i,Xl);if(s)for(o=0;o<i;++o)s.setUint32(n,e[o]>>>0,!0),n+=4;else{var a=this.buf;for(o=0;o<i;++o)tr(e[o]>>>0,a,n),n+=4}return this.pos+=r,this};W.prototype.sfixed32s=W.prototype.fixed32s;W.prototype.fixed64s=function(e){var i=e.length,r=i*8;this.uint32(r),this._reserve(r);var n=this.pos,o,s,a=_n(this,i,Xl);if(a)for(o=0;o<i;++o)s=Ut.from(e[o]),a.setUint32(n,s.lo,!0),a.setUint32(n+4,s.hi,!0),n+=8;else{var l=this.buf;for(o=0;o<i;++o)s=Ut.from(e[o]),tr(s.lo,l,n),tr(s.hi,l,n+4),n+=8}return this.pos+=r,this};W.prototype.sfixed64s=W.prototype.fixed64s;W.prototype.floats=function(e){var i=e.length,r=i*4;this.uint32(r),this._reserve(r);var n=this.pos,o,s=_n(this,i,Yl);if(s)for(o=0;o<i;++o)s.setFloat32(n,e[o],!0),n+=4;else{var a=this.buf;for(o=0;o<i;++o)Rt.float.writeFloatLE(e[o],a,n),n+=4}return this.pos+=r,this};W.prototype.doubles=function(e){var i=e.length,r=i*8;this.uint32(r),this._reserve(r);var n=this.pos,o,s=_n(this,i,Yl);if(s)for(o=0;o<i;++o)s.setFloat64(n,e[o],!0),n+=8;else{var a=this.buf;for(o=0;o<i;++o)Rt.float.writeDoubleLE(e[o],a,n),n+=8}return this.pos+=r,this};W.prototype.fork=function(){return this._reserve(1),(this.states||(this.states=[])).push(this.pos),this.pos+=1,this};W.prototype.reset=function(){var e=this.states;return e&&e.length?this.pos=e.pop():this.pos=0,this};W.prototype.ldelim=function(){var e=this.states,i,r;if(e&&e.length){var n=e.pop();i=this.pos-n-1,r=jo(i),r>1?(this._reserve(r-1),this.buf.copyWithin(n+r,n+1,n+1+i),this.pos+=r-1,Ri(i,this.buf,n)):this.buf[n]=i}else i=this.pos,r=jo(i),this._reserve(r),this.buf.copyWithin(r,0,i),Ri(i,this.buf,0),this.pos+=r;return this};W.prototype.finish=function(e){if(e)return this.buf.subarray(0,this.pos);var i=this.constructor.alloc(this.pos);return i.set(this.buf.subarray(0,this.pos),0),i};W.prototype.finishInto=function(e,i){return i===void 0&&(i=0),e.set(this.buf.subarray(0,this.pos),i),e};W._configure=function(t){Lo=t,W.create=Ul(),Lo._configure()}});var Jl=te((Ly,Wl)=>{"use strict";Wl.exports=ui;var Kl=In();ui.prototype=Object.create(Kl.prototype,{constructor:{value:ui,writable:!0,enumerable:!1,configurable:!0}});var li=Tt();function ui(){Kl.call(this)}var Uo;ui._configure=function(){ui.alloc=li.Buffer&&li.Buffer.allocUnsafe,Uo=li.Buffer&&li.Buffer.prototype.utf8Write?function(e,i,r){return i.utf8Write(e,r)}:function(e,i,r){return i.write(e,r)}};ui.prototype.bytes=function(e){li.isString(e)&&(e=li.Buffer.from(e,"base64"));var i=e.length>>>0;return this.uint32(i),i&&(this._reserve(i),this.buf.set(e,this.pos),this.pos+=i),this};ui.prototype.string=function(e){var i=e.length;if(!i)return this._reserve(1),this.buf[this.pos++]=0,this;if(i<128){this._reserve(i*3+5);var r=this.pos,n=this.buf;return this._delim(r,i<40?li.utf8.write(e,n,r+1):Uo(e,n,r+1))}var o=li.Buffer.byteLength(e);return this.uint32(o),this._reserve(o),Uo(e,this.buf,this.pos),this.pos+=o,this};ui._configure()});var En=te((jy,ou)=>{"use strict";ou.exports=se;var vt=Tt(),Xo,eu=vt.LongBits,tu=vt.utf8;function ge(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function se(t){this.buf=t,this.pos=0,this.len=t.length,this.view=null,this.discardUnknown=se.discardUnknown}function Zl(t){if(Array.isArray(t)&&(t=new Uint8Array(t)),t instanceof Uint8Array)return new se(t);throw Error("illegal buffer")}var iu=function(){return vt.Buffer?function(i){return(se.create=function(n){return vt.Buffer.isBuffer(n)?new Xo(n):Zl(n)})(i)}:Zl};se.create=iu();se.prototype.raw=function(e,i){return this.buf.subarray(e,i)};se.prototype.uint32=function(){var e=this.buf,i=this.pos,r=(e[i]&127)>>>0;if(e[i++]<128)return this.pos=i,r;if(r=(r|(e[i]&127)<<7)>>>0,e[i++]<128)return this.pos=i,r;if(r=(r|(e[i]&127)<<14)>>>0,e[i++]<128)return this.pos=i,r;if(r=(r|(e[i]&127)<<21)>>>0,e[i++]<128)return this.pos=i,r;if(r=(r|(e[i]&15)<<28)>>>0,e[i++]<128)return this.pos=i,r;for(var n=0;n<5;++n){if(i>=this.len)throw this.pos=i,ge(this);if(e[i++]<128)return this.pos=i,r}throw this.pos=i,Error("invalid varint encoding")};se.prototype.tag=function(){var e=this.buf,i=this.pos,r=(e[i]&127)>>>0;if(e[i++]<128)return this.pos=i,r;if(r=(r|(e[i]&127)<<7)>>>0,e[i++]<128)return this.pos=i,r;if(r=(r|(e[i]&127)<<14)>>>0,e[i++]<128)return this.pos=i,r;if(r=(r|(e[i]&127)<<21)>>>0,e[i++]<128)return this.pos=i,r;if(r=(r|(e[i]&15)<<28)>>>0,e[i]<128&&(e[i]&112)===0)return this.pos=i+1,r;throw this.pos=i+1,Error("invalid tag encoding")};se.prototype.int32=function(){return this.uint32()|0};se.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Yo(){var t=new eu(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<4;++e){if(this.pos>=this.len)throw ge(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}throw ge(this)}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw ge(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}se.prototype.bool=function(){for(var e=!1,i,r=0;r<10;++r){if(this.pos>=this.len)throw ge(this);if(i=this.buf[this.pos++],i&127&&(e=!0),i<128)return e}throw Error("invalid varint encoding")};function rr(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}se.prototype.fixed32=function(){if(this.pos+4>this.len)throw ge(this,4);return rr(this.buf,this.pos+=4)};se.prototype.sfixed32=function(){if(this.pos+4>this.len)throw ge(this,4);return rr(this.buf,this.pos+=4)|0};function Ql(){if(this.pos+8>this.len)throw ge(this,8);return new eu(rr(this.buf,this.pos+=4),rr(this.buf,this.pos+=4))}se.prototype.float=function(){if(this.pos+4>this.len)throw ge(this,4);var e=vt.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};se.prototype.double=function(){if(this.pos+8>this.len)throw ge(this,4);var e=vt.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};se.prototype.uint32s=function(e){e===void 0&&(e=[]);for(var i=this.uint32()+this.pos,r=this.buf,n=this.pos,o;n<i;)o=r[n++],o<128?e.push(o):(this.pos=n-1,e.push(this.uint32()),n=this.pos);return this.pos=n,e};se.prototype.int32s=function(e){e===void 0&&(e=[]);for(var i=this.uint32()+this.pos,r=this.buf,n=this.pos,o;n<i;)o=r[n++],o<128?e.push(o):(this.pos=n-1,e.push(this.int32()),n=this.pos);return this.pos=n,e};se.prototype.sint32s=function(e){e===void 0&&(e=[]);for(var i=this.uint32()+this.pos;this.pos<i;)e.push(this.sint32());return e};se.prototype.bools=function(e){e===void 0&&(e=[]);for(var i=this.uint32()+this.pos,r=this.buf,n=this.pos,o;n<i;)o=r[n++],o<128?e.push(o!==0):(this.pos=n-1,e.push(this.bool()),n=this.pos);return this.pos=n,e};var ru=8,nu=128;function Cn(t,e,i){var r=t.view;if(r||e<i)return r;var n=t.buf;return t.view=new DataView(n.buffer,n.byteOffset,n.byteLength)}se.prototype.fixed32s=function(e){e===void 0&&(e=[]);var i=this.uint32(),r=this.pos+i;if(r>this.len)throw ge(this,i);var n=i>>>2,o=e.length,s=this.pos;e.length=o+n;var a=Cn(this,n,nu);if(a)for(var l=0;l<n;++l,s+=4)e[o++]=a.getUint32(s,!0);else for(var u=this.buf,f=0;f<n;++f,s+=4)e[o++]=rr(u,s+4);if(this.pos=s,s!==r)throw ge(this,4);return e};se.prototype.sfixed32s=function(e){e===void 0&&(e=[]);var i=this.uint32(),r=this.pos+i;if(r>this.len)throw ge(this,i);var n=i>>>2,o=e.length,s=this.pos;e.length=o+n;var a=Cn(this,n,nu);if(a)for(var l=0;l<n;++l,s+=4)e[o++]=a.getInt32(s,!0);else for(var u=this.buf,f=0;f<n;++f,s+=4)e[o++]=rr(u,s+4)|0;if(this.pos=s,s!==r)throw ge(this,4);return e};se.prototype.floats=function(e){e===void 0&&(e=[]);var i=this.uint32(),r=this.pos+i;if(r>this.len)throw ge(this,i);var n=i>>>2,o=e.length,s=this.pos;e.length=o+n;var a=Cn(this,n,ru);if(a)for(var l=0;l<n;++l,s+=4)e[o++]=a.getFloat32(s,!0);else for(var u=this.buf,f=0;f<n;++f,s+=4)e[o++]=vt.float.readFloatLE(u,s);if(this.pos=s,s!==r)throw ge(this,4);return e};se.prototype.doubles=function(e){e===void 0&&(e=[]);var i=this.uint32(),r=this.pos+i;if(r>this.len)throw ge(this,i);var n=i>>>3,o=e.length,s=this.pos;e.length=o+n;var a=Cn(this,n,ru);if(a)for(var l=0;l<n;++l,s+=8)e[o++]=a.getFloat64(s,!0);else for(var u=this.buf,f=0;f<n;++f,s+=8)e[o++]=vt.float.readDoubleLE(u,s);if(this.pos=s,s!==r)throw ge(this,8);return e};se.prototype.uint64s=function(e){e===void 0&&(e=[]);for(var i=this.uint32()+this.pos;this.pos<i;)e.push(this.uint64());return e};se.prototype.int64s=function(e){e===void 0&&(e=[]);for(var i=this.uint32()+this.pos;this.pos<i;)e.push(this.int64());return e};se.prototype.sint64s=function(e){e===void 0&&(e=[]);for(var i=this.uint32()+this.pos;this.pos<i;)e.push(this.sint64());return e};se.prototype.fixed64s=function(e){e===void 0&&(e=[]);var i=this.uint32(),r=this.pos+i,n=e.length;if(r>this.len)throw ge(this,i);var o=i>>>3;e.length=n+o;for(var s=0;s<o;++s)e[n++]=this.fixed64();if(this.pos!==r)throw ge(this,8);return e};se.prototype.sfixed64s=function(e){e===void 0&&(e=[]);var i=this.uint32(),r=this.pos+i,n=e.length;if(r>this.len)throw ge(this,i);var o=i>>>3;e.length=n+o;for(var s=0;s<o;++s)e[n++]=this.sfixed64();if(this.pos!==r)throw ge(this,8);return e};se.prototype.bytes=function(){var e=this.uint32(),i=this.pos,r=this.pos+e;if(r>this.len)throw ge(this,e);return this.pos=r,this.raw(i,r)};se.prototype.string=function(){var e=this.uint32(),i=this.pos,r=this.pos+e;if(r>this.len)throw ge(this,e);return this.pos=r,tu.read(this.buf,i,r)};se.prototype.stringVerify=function(){var e=this.uint32(),i=this.pos,r=this.pos+e;if(r>this.len)throw ge(this,e);return this.pos=r,tu.readStrict(this.buf,i,r)};se.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw ge(this,e);this.pos+=e}else do if(this.pos>=this.len)throw ge(this);while(this.buf[this.pos++]&128);return this};se.recursionLimit=vt.recursionLimit;se.discardUnknown=!0;se.prototype.skipType=function(t,e,i){if(e===void 0&&(e=0),e>se.recursionLimit)throw Error("max depth exceeded");if(i===0)throw Error("illegal tag: field number 0");switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;;){var r=this.tag(),n=r>>>3;if(t=r&7,!n)throw Error("illegal tag: field number 0");if(t===4){if(i!==void 0&&n!==i)throw Error("invalid end group tag");break}this.skipType(t,e+1,n)}break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};se._configure=function(t){Xo=t,se.create=iu(),Xo._configure();var e=vt.Long?"toLong":"toNumber";vt.merge(se.prototype,{int64:function(){return Yo.call(this)[e](!1)},uint64:function(){return Yo.call(this)[e](!0)},sint64:function(){return Yo.call(this).zzDecode()[e](!1)},fixed64:function(){return Ql.call(this)[e](!0)},sfixed64:function(){return Ql.call(this)[e](!1)}})}});var uu=te((Uy,lu)=>{"use strict";lu.exports=fi;var au=En();fi.prototype=Object.create(au.prototype,{constructor:{value:fi,writable:!0,enumerable:!1,configurable:!0}});var su=Tt();function fi(t){au.call(this,t)}fi._configure=function(){su.Buffer&&(fi.prototype._slice=su.Buffer.prototype.slice)};fi.prototype.raw=function(e,i){return this._slice.call(this.buf,e,i)};fi.prototype.string=function(){var e=this.uint32(),i=this.pos,r=this.pos+e;if(r>this.len)throw RangeError("index out of range: "+this.pos+" + "+e+" > "+this.len);return this.pos=r,this.buf.utf8Slice?this.buf.utf8Slice(i,r):this.buf.toString("utf-8",i,r)};fi._configure()});var cu=te((Yy,fu)=>{"use strict";fu.exports=Rr;var Ho=Tt();Rr.prototype=Object.create(Ho.EventEmitter.prototype,{constructor:{value:Rr,writable:!0,enumerable:!1,configurable:!0}});function Rr(t,e,i){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Ho.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!i}Rr.prototype.rpcCall=function t(e,i,r,n,o){if(!n)throw TypeError("request must be specified");var s=this;if(!o)return Ho.asPromise(t,s,e,i,r,n);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(e,i[s.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(l,u){if(l)return s.emit("error",l,e),o(l);if(u===null){s.end(!0);return}if(!(u instanceof r))try{u=r[s.responseDelimited?"decodeDelimited":"decode"](u)}catch(f){return s.emit("error",f,e),o(f)}return s.emit("data",u,e),o(null,u)})}catch(a){s.emit("error",a,e),setTimeout(function(){o(a)},0);return}};Rr.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Ko=te(du=>{"use strict";var uh=du;uh.Service=cu()});var Wo=te((Hy,hu)=>{"use strict";hu.exports=Object.create(null)});var mu=te(Ye=>{"use strict";Ye.build="minimal";Ye.Writer=In();Ye.BufferWriter=Jl();Ye.Reader=En();Ye.BufferReader=uu();Ye.util=Tt();Ye.rpc=Ko();Ye.roots=Wo();Ye.configure=pu;function pu(){Ye.util.LongBits._configure(Ye.util.Long),Ye.Writer._configure(Ye.BufferWriter),Ye.Reader._configure(Ye.BufferReader)}pu()});var Zo=te(gu=>{"use strict";var Jo=gu;Jo.numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;Jo.typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;Jo.reservedRe=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/});var vu=te((Jy,yu)=>{"use strict";yu.exports=Qo;var fh=Zo(),ch=fh.reservedRe;function Qo(t,e){typeof t=="string"&&(e=t,t=void 0);var i=[];function r(o){if(typeof o!="string"){var s=n();if(Qo.verbose&&console.log("codegen: "+s),s="return "+s,o){for(var a=Object.keys(o),l=new Array(a.length+1),u=new Array(a.length),f=0;f<a.length;)l[f]=a[f],u[f]=o[a[f++]];return l[f]=s,Function.apply(null,l).apply(null,u)}return Function(s)()}for(var h=new Array(arguments.length-1),m=0;m<h.length;)h[m]=arguments[++m];if(m=0,o=o.replace(/%([%dfijs])/g,function(g,b){var w=h[m++];switch(b){case"d":case"f":return w=Number(w),Object.is(w,-0)?"-0":String(w);case"i":return String(Math.floor(w));case"j":return JSON.stringify(w);case"s":return String(w)}return"%"}),m!==h.length)throw Error("parameter count mismatch");return i.push(o),r}function n(o){return"function "+dh(o||e)+"("+(t&&t.join(",")||"")+`){
|
|
2
|
+
`+i.join(`
|
|
3
|
+
`)+`
|
|
4
|
+
}`}return Object.defineProperty(r,"toString",{value:n,writable:!0,enumerable:!0,configurable:!0}),r}Qo.verbose=!1;function dh(t){return!t||(t=String(t).replace(/[^\w$]/g,""),!t)?"":(/^\d/.test(t)&&(t="_"+t),ch.test(t)?t+"_":t)}});var es=te((Zy,bu)=>{"use strict";var nr=null;try{nr=xd("fs"),(!nr||!nr.readFile||!nr.readFileSync)&&(nr=null)}catch{}bu.exports=nr});var Su=te((Qy,wu)=>{"use strict";wu.exports=Nr;var hh=Go(),ts=es();function Nr(t,e,i){return typeof e=="function"?(i=e,e={}):e||(e={}),i?!e.xhr&&ts&&ts.readFile?ts.readFile(t,function(n,o){return n&&typeof XMLHttpRequest<"u"?Nr.xhr(t,e,i):n?i(n):i(null,e.binary?o:o.toString("utf8"))}):Nr.xhr(t,e,i):hh(Nr,this,t,e)}Nr.xhr=function(e,i,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(n.readyState===4){if(n.status!==0&&n.status!==200)return r(Error("status "+n.status));if(i.binary){var s=n.response;if(!s){s=[];for(var a=0;a<n.responseText.length;++a)s.push(n.responseText.charCodeAt(a)&255)}return r(null,typeof Uint8Array<"u"?new Uint8Array(s):s)}return r(null,n.responseText)}},i.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()}});var Iu=te(_u=>{"use strict";var ns=_u,rs=/^[a-zA-Z][a-zA-Z0-9+.-]+:\/\//;function ph(t){if(typeof URL>"u"||!rs.test(t))return null;try{return new URL(t).href}catch{return null}}function mh(t,e){if(typeof URL>"u"||!rs.test(t)||rs.test(e))return null;try{return new URL(e,t).href}catch{return null}}var xu=ns.isAbsolute=function(e){return/^(?:\/|\w+:|\\\\\w+)/.test(e)},is=ns.normalize=function(e){var i=ph(e);if(i)return i;var r=e.substring(0,2),n="";r==="\\\\"&&(n=r,e=e.substring(2)),e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var o=e.split("/"),s=xu(e),a="";s&&(a=o.shift()+"/");for(var l=0;l<o.length;)o[l]===".."?l>0&&o[l-1]!==".."?o.splice(--l,2):s?o.splice(l,1):++l:o[l]==="."?o.splice(l,1):++l;return n+a+o.join("/")};ns.resolve=function(e,i,r){var n=mh(e,i);return n||(r||(i=is(i)),xu(i)?i:(r||(e=is(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?is(e+"/"+i):i))}});var sr=te((t0,ku)=>{"use strict";ku.exports=le;var kn=hi();le.prototype=Object.create(kn.prototype,{constructor:{value:le,writable:!0,enumerable:!1,configurable:!0}});le.className="Namespace";var os=di(),ci=Ve(),gh=Fi(),Ni,or,Pi;le.fromJSON=function(e,i,r){if(r===void 0&&(r=0),r>ci.recursionLimit)throw Error("max depth exceeded");return new le(e,i.options).addJSON(i.nested,r)};function Cu(t,e){if(t&&t.length){for(var i={},r=0;r<t.length;++r)i[t[r].name]=t[r].toJSON(e);return i}}le.arrayToJSON=Cu;le.isReservedId=function(e,i){if(e){for(var r=0;r<e.length;++r)if(typeof e[r]!="string"&&e[r][0]<=i&&e[r][1]>=i)return!0}return!1};le.isReservedName=function(e,i){if(e){for(var r=0;r<e.length;++r)if(e[r]===i)return!0}return!1};function le(t,e){kn.call(this,t,e),this.nested=void 0,this._nestedArray=null,this._lookupCache=Object.create(null),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function Eu(t){t._nestedArray=null,t._lookupCache=Object.create(null);for(var e=t;e=e.parent;)e._lookupCache=Object.create(null);return t}Object.defineProperty(le.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=ci.toArray(this.nested))}});le.prototype.toJSON=function(e){return ci.toObject(["options",this.options,"nested",Cu(this.nestedArray,e)])};le.prototype.addJSON=function(e,i){if(i===void 0&&(i=0),i>ci.recursionLimit)throw Error("max depth exceeded");var r=this;if(e)for(var n=Object.keys(e),o=0,s;o<n.length;++o)s=e[n[o]],r.add((s.fields!==void 0?Ni.fromJSON:s.values!==void 0?Pi.fromJSON:s.methods!==void 0?or.fromJSON:s.id!==void 0?os.fromJSON:le.fromJSON)(n[o],s,i+1));return this};le.prototype.get=function(e){return this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)?this.nested[e]:null};le.prototype.getEnum=function(e){if(this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)&&this.nested[e]instanceof Pi)return this.nested[e].values;throw Error("no such enum: "+e)};le.prototype.add=function(e){if(!(e instanceof os&&e.extend!==void 0||e instanceof Ni||e instanceof gh||e instanceof Pi||e instanceof or||e instanceof le))throw TypeError("object must be a valid nested object");if(e.name==="__proto__")return this;if(!this.nested)this.nested={};else{var i=this.get(e.name);if(i)if(i instanceof le&&e instanceof le&&!(i instanceof Ni||i instanceof or)){for(var r=i.nestedArray,n=0;n<r.length;++n)e.add(r[n]);this.remove(i),this.nested||(this.nested={}),e.setOptions(i.options,!0)}else throw Error("duplicate name '"+e.name+"' in "+this)}this.nested[e.name]=e,this instanceof Ni||this instanceof or||this instanceof Pi||this instanceof os||e._edition||(e._edition=e._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var o=this;o=o.parent;)o._needsRecursiveFeatureResolution=!0,o._needsRecursiveResolve=!0;return e.onAdd(this),Eu(this)};le.prototype.remove=function(e){if(!(e instanceof kn))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);if(!ci.remove(this.nested,e,e.name))throw Error(e+" is not a member of "+this);return Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),Eu(this)};le.prototype.define=function(e,i){if(ci.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&e[0]==="")throw Error("path must be relative");if(e.length>ci.recursionLimit)throw Error("max depth exceeded");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(r=r.nested[n],!(r instanceof le))throw Error("path conflicts with non-namespace objects")}else r.add(r=new le(n))}return i&&r.addJSON(i),r};le.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._needsRecursiveFeatureResolution&&this._resolveFeaturesRecursive(this._edition);var e=this.nestedArray,i=0;for(this.resolve();i<e.length;)e[i]instanceof le?e[i++].resolveAll():e[i++].resolve();return this._needsRecursiveResolve=!1,this};le.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,e=this._edition||e,kn.prototype._resolveFeaturesRecursive.call(this,e),this.nestedArray.forEach(i=>{i._resolveFeaturesRecursive(e)}),this):this};le.prototype.lookup=function(e,i,r){if(typeof i=="boolean"?(r=i,i=void 0):i&&!Array.isArray(i)&&(i=[i]),ci.isString(e)&&e.length){if(e===".")return this.root;e=e.split(".")}else if(!e.length)return this;var n=e.join(".");if(e[0]==="")return this.root.lookup(e.slice(1),i);var o=this._lookupImpl(e,n);if(o&&(!i||i.indexOf(o.constructor)>-1)||(o=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+n],o&&(!i||i.indexOf(o.constructor)>-1)))return o;if(r)return null;for(var s=this;s.parent;){if(o=s.parent._lookupImpl(e,n),o&&(!i||i.indexOf(o.constructor)>-1))return o;s=s.parent}return null};le.prototype._lookupImpl=function(e,i){if(Object.prototype.hasOwnProperty.call(this._lookupCache,i))return this._lookupCache[i];var r=this.get(e[0]),n=null;if(r)e.length===1?n=r:r instanceof le&&(e=e.slice(1),n=r._lookupImpl(e,e.join(".")));else for(var o=0;o<this.nestedArray.length;++o)if(this._nestedArray[o]instanceof le&&(r=this._nestedArray[o]._lookupImpl(e,i))){n=r;break}return this._lookupCache[i]=n,n};le.prototype.lookupType=function(e){var i=this.lookup(e,[Ni]);if(!i)throw Error("no such type: "+e);return i};le.prototype.lookupEnum=function(e){var i=this.lookup(e,[Pi]);if(!i)throw Error("no such Enum '"+e+"' in "+this);return i};le.prototype.lookupTypeOrEnum=function(e){var i=this.lookup(e,[Ni,Pi]);if(!i)throw Error("no such Type or Enum '"+e+"' in "+this);return i};le.prototype.lookupService=function(e){var i=this.lookup(e,[or]);if(!i)throw Error("no such Service '"+e+"' in "+this);return i};le._configure=function(t,e,i){Ni=t,or=e,Pi=i}});var An=te((i0,Au)=>{"use strict";Au.exports=Nt;var ss=di();Nt.prototype=Object.create(ss.prototype,{constructor:{value:Nt,writable:!0,enumerable:!1,configurable:!0}});Nt.className="MapField";var yh=pi(),ar=Ve();function Nt(t,e,i,r,n,o){if(ss.call(this,t,e,r,void 0,void 0,n,o),!ar.isString(i))throw TypeError("keyType must be a string");this.keyType=i,this.resolvedKeyType=null,this.map=!0}Nt.fromJSON=function(e,i){var r=new Nt(e,i.id,i.keyType,i.type,i.options,i.comment);return i.protoName&&(r.protoName=i.protoName),i.jsonName!==void 0?r.jsonName=i.jsonName:i.options&&i.options.json_name!==void 0&&(r.jsonName=i.options.json_name),r};Nt.prototype.toJSON=function(e){var i=e?!!e.keepComments:!1;return ar.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"protoName",this.protoName!==this.name?this.protoName:void 0,"jsonName",this.jsonName!==ar.jsonName(this.protoName||this.name)?this.jsonName:void 0,"options",this.options,"comment",i?this.comment:void 0])};Nt.prototype.resolve=function(){if(this.resolved)return this;if(yh.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return ss.prototype.resolve.call(this)};Nt.d=function(e,i,r){return typeof r=="function"?r=ar.decorateType(r).name:r&&typeof r=="object"&&(r=ar.decorateEnum(r).name),function(o,s){ar.decorateType(o.constructor).add(new Nt(s,e,i,r))}}});var On=te((r0,Ou)=>{"use strict";Ou.exports=mi;var as=hi();mi.prototype=Object.create(as.prototype,{constructor:{value:mi,writable:!0,enumerable:!1,configurable:!0}});mi.className="Method";var lr=Ve();function mi(t,e,i,r,n,o,s,a,l){if(lr.isObject(n)?(s=n,n=o=void 0):lr.isObject(o)&&(s=o,o=void 0),!(e===void 0||lr.isString(e)))throw TypeError("type must be a string");if(!lr.isString(i))throw TypeError("requestType must be a string");if(!lr.isString(r))throw TypeError("responseType must be a string");as.call(this,t,s),this.type=e||"rpc",this.requestType=i,this.requestStream=n?!0:void 0,this.responseType=r,this.responseStream=o?!0:void 0,this.path="/"+this.name,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=a,this.parsedOptions=l}mi.fromJSON=function(e,i){return new mi(e,i.type,i.requestType,i.responseType,i.requestStream,i.responseStream,i.options,i.comment,i.parsedOptions)};mi.prototype.toJSON=function(e){var i=e?!!e.keepComments:!1;return lr.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",i?this.comment:void 0,"parsedOptions",this.parsedOptions])};mi.prototype.resolve=function(){if(this.resolved)return this;if(this.parent){var e=this.parent.fullName;e.charAt(0)==="."&&(e=e.substring(1)),this.path="/"+e+"/"+this.name}else this.path="/"+this.name;return this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),as.prototype.resolve.call(this)}});var Rn=te((n0,Nu)=>{"use strict";Nu.exports=tt;var Yt=sr();tt.prototype=Object.create(Yt.prototype,{constructor:{value:tt,writable:!0,enumerable:!1,configurable:!0}});tt.className="Service";var ls=On(),Tn=Ve(),Tu=Ko();function tt(t,e){Yt.call(this,t,e),this.methods={},this._methodsArray=null}tt.fromJSON=function(e,i,r){if(r===void 0&&(r=0),r>Tn.recursionLimit)throw Error("max depth exceeded");var n=new tt(e,i.options);if(i.methods)for(var o=Object.keys(i.methods),s=0;s<o.length;++s)n.add(ls.fromJSON(o[s],i.methods[o[s]]));return i.nested&&n.addJSON(i.nested,r),i.edition&&(n._edition=i.edition),n.comment=i.comment,n._defaultEdition="proto3",n};tt.prototype.toJSON=function(e){var i=Yt.prototype.toJSON.call(this,e),r=e?!!e.keepComments:!1;return Tn.toObject(["edition",this._editionToJSON(),"options",i&&i.options||void 0,"methods",Yt.arrayToJSON(this.methodsArray,e)||{},"nested",i&&i.nested||void 0,"comment",r?this.comment:void 0])};Object.defineProperty(tt.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=Tn.toArray(this.methods))}});function Ru(t){return t._methodsArray=null,t}tt.prototype.get=function(e){return Object.prototype.hasOwnProperty.call(this.methods,e)?this.methods[e]:Yt.prototype.get.call(this,e)};tt.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;Yt.prototype.resolve.call(this);for(var e=this.methodsArray,i=0;i<e.length;++i)e[i].resolve();return this};tt.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,Yt.prototype._resolveFeaturesRecursive.call(this,e),this.methodsArray.forEach(i=>{i._resolveFeaturesRecursive(e)}),this):this};tt.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof ls?e.name==="__proto__"?this:(this.methods[e.name]=e,e.parent=this,Ru(this)):Yt.prototype.add.call(this,e)};tt.prototype.remove=function(e){if(e instanceof ls){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,Ru(this)}return Yt.prototype.remove.call(this,e)};tt.prototype.create=function(e,i,r){for(var n=new Tu.Service(e,i,r),o=0,s;o<this.methodsArray.length;++o){var a=Tn.lcFirst((s=this._methodsArray[o]).resolve().name).replace(/[^$\w_]/g,"");n[a]=(function(l,u,f){return function(m,p){return Tu.Service.prototype.rpcCall.call(this,l,u,f,m,p)}})(s,s.resolvedRequestType.ctor,s.resolvedResponseType.ctor)}return n}});var Nn=te((o0,Pu)=>{"use strict";Pu.exports=Pt;var vh=Tt();function Pt(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&e[i]!=="__proto__"&&(this[e[i]]=t[e[i]])}Pt.create=function(e){return this.$type.create(e)};Pt.encode=function(e,i){return this.$type.encode(e,i)};Pt.encodeDelimited=function(e,i){return this.$type.encodeDelimited(e,i)};Pt.decode=function(e){return this.$type.decode(e)};Pt.decodeDelimited=function(e){return this.$type.decodeDelimited(e)};Pt.verify=function(e){return this.$type.verify(e)};Pt.fromObject=function(e){return this.$type.fromObject(e)};Pt.toObject=function(e,i){return this.$type.toObject(e,i)};Pt.prototype.toJSON=function(){return this.$type.toObject(this,vh.toJSONOptions)}});var us=te((s0,Fu)=>{"use strict";Fu.exports=wh;var Pn=bt(),ze=pi(),Fn=Ve();function bh(t){return"missing required '"+t.name+"'"}function Pr(t){return t._features.utf8_validation==="VERIFY"?"stringVerify":"string"}function ur(t,e){return t("if(!r.discardUnknown){")('util.makeProp(m,"$unknowns",false);')("(m.$unknowns||(m.$unknowns=[])).push(%s)",e)("}")}function wh(t){for(var e=!1,i=!1,r=0;r<t.fieldsArray.length;++r){var n=t._fieldsArray[r];n.map&&(e=!0),(n.resolvedType instanceof Pn||!n.repeated&&!n.map&&!n.hasPresence)&&(i=!0)}var o=Fn.codegen(["r","l","z","q","g"])("if(!(r instanceof Reader))")("r=Reader.create(r)")("if(q===undefined)q=0")("if(q>Reader.recursionLimit)")('throw Error("max depth exceeded")')("var c=l===undefined?r.len:r.pos+l,m=g||new C"+(e?",k,v":i?",v":""))("while(r.pos<c){")("var s=r.pos")("var t=r.tag()")("if(t===z){")("z=undefined")("break")("}");for(t.fieldsArray.length&&o("var u=t&7")("switch(t>>>=3){"),r=0;r<t.fieldsArray.length;++r){var s=t._fieldsArray[r].resolve(),a=s.resolvedType instanceof Pn?"int32":s.type,l="m"+Fn.safeProp(s.name),u=s.resolvedType instanceof Pn&&s.resolvedType._features.enum_type==="CLOSED";if(s.map){o("case %i:{",s.id)("if(u!==2)")("break"),u||o("if(%s===util.emptyObject)",l)("%s={}",l),o("var c2=r.uint32()+r.pos"),ze.defaults[s.keyType]!==void 0?o("k=%j",ze.defaults[s.keyType]):o("k=null"),ze.long[a]!==void 0?o("v=util.Long?util.Long.fromNumber(0,%j):0",a==="uint64"||a==="fixed64"):ze.defaults[a]!==void 0?o("v=%j",ze.defaults[a]):o("v=null"),o("while(r.pos<c2){")("var t2=r.tag()")("u=t2&7")("switch(t2>>>=3){")("case 1:")("if(u!==%i)",ze.mapKey[s.keyType])("break")("k=r.%s()",s.keyType==="string"?Pr(s):s.keyType)("continue")("case 2:")("if(u!==%i)",ze.basic[a]===void 0?2:ze.basic[a])("break"),ze.basic[a]===void 0?o("v=types[%i].decode(r,r.uint32(),undefined,q+1,v)",r):o("v=r.%s()",a==="string"?Pr(s):a),o("continue")("}")("r.skipType(u,q,t2)")("}"),u&&(o("if(types[%i].valuesById[v]===undefined){",r),ur(o,"r.raw(s,r.pos)")("continue")("}")("if(%s===util.emptyObject)",l)("%s={}",l));var f=ze.basic[a]===void 0?"v||new types["+r+"].ctor":"v";ze.long[s.keyType]!==void 0?o('%s[typeof k==="object"?util.longToHash(k):k]=%s',l,f):(s.keyType==="string"&&o('if(k==="__proto__")')("util.makeProp(%s,k)",l),o("%s[k]=%s",l,f))}else s.repeated?(o("case %i:",s.id)("{"),ze.packed[a]!==void 0&&(o("if(u===2){"),u?(o("var c2=r.uint32()+r.pos")("while(r.pos<c2){")("s=r.pos")("v=r.%s()",a)("if(types[%i].valuesById[v]!==undefined){",r)("if(!(%s&&%s.length))",l,l)("%s=[]",l)("%s.push(v)",l)("}else"),ur(o,"util.rawField("+s.id+",0,r.raw(s,r.pos))")("}")):o("if(!(%s&&%s.length))",l,l)("%s=[]",l)("r.%ss(%s)",a,l),o("continue")("}")),o("if(u!==%i)",ze.basic[a]===void 0?s.delimited?3:2:ze.basic[a])("break"),u||o("if(!(%s&&%s.length))",l,l)("%s=[]",l),ze.basic[a]===void 0?s.delimited?o("%s.push(types[%i].decode(r,undefined,%i,q+1))",l,r,s.id*8+4):o("%s.push(types[%i].decode(r,r.uint32(),undefined,q+1))",l,r):u?(o("v=r.%s()",a)("if(types[%i].valuesById[v]!==undefined){",r)("if(!(%s&&%s.length))",l,l)("%s=[]",l)("%s.push(v)",l)("}else"),ur(o,"r.raw(s,r.pos)")):o("%s.push(r.%s())",l,a==="string"?Pr(s):a)):ze.basic[a]===void 0?(o("case %i:{",s.id)("if(u!==%i)",s.delimited?3:2)("break"),s.delimited?o("%s=types[%i].decode(r,undefined,%i,q+1,%s)",l,r,s.id*8+4,l):o("%s=types[%i].decode(r,r.uint32(),undefined,q+1,%s)",l,r,l)):s.hasPresence?(o("case %i:{",s.id)("if(u!==%i)",ze.basic[a])("break"),u?(o("v=r.%s()",a)("if(types[%i].valuesById[v]!==undefined){",r)("%s=v",l),s.partOf&&o("m%s=%j",Fn.safeProp(s.partOf.name),s.name),o("}else"),ur(o,"r.raw(s,r.pos)")):o("%s=r.%s()",l,a==="string"?Pr(s):a)):(o("case %i:{",s.id)("if(u!==%i)",ze.basic[a])("break"),u?(o("v=r.%s()",a)("if(types[%i].valuesById[v]!==undefined){",r)("if(v!==%j)",s.typeDefault)("%s=v",l)("else")("delete %s",l)("}else{"),ur(o,"r.raw(s,r.pos)")("}")):(s.resolvedType instanceof Pn&&s.typeDefault!==0?o("if((v=r.%s())!==%j)",a,s.typeDefault):a==="string"?o("if((v=r.%s()).length)",Pr(s)):a==="bytes"?o("if((v=r.%s()).length)",a):ze.long[a]!==void 0?o('if(typeof(v=r.%s())==="object"?v.low||v.high:v!==0)',a):o(a==="double"||a==="float"?"if(!Object.is(v=r.%s(),0))":"if(v=r.%s())",a),o("%s=v",l)("else")("delete %s",l)));s.partOf&&!u&&o("m%s=%j",Fn.safeProp(s.partOf.name),s.name),o("continue")("}")}for(r&&o("}"),o("r.skipType(%s,q,t)",r?"u":"t&7"),ur(o,"r.raw(s,r.pos)")("}")("if(z!==undefined)")('throw Error("missing end group")'),r=0;r<t._fieldsArray.length;++r){var h=t._fieldsArray[r];h.required&&o("if(!Object.hasOwnProperty.call(m,%j))",h.name)("throw util.ProtocolError(%j,{instance:m})",bh(h))}return o("return m")}});var ds=te((a0,Mu)=>{"use strict";Mu.exports=_h;var Sh=bt(),fs=Ve();function ot(t,e){return t.name+": "+e+(t.repeated&&e!=="array"?"[]":t.map&&e!=="object"?"{k:"+t.keyType+"}":"")+" expected"}function cs(t,e,i,r){var n=e.resolvedType;if(n)if(n instanceof Sh)if(n._features.enum_type==="CLOSED"){t("switch(%s){",r)("default:")("return%j",ot(e,"enum value"));for(var o=Object.keys(n.values),s=0;s<o.length;++s)t("case %i:",n.values[o[s]]);t("break")("}")}else t('if(typeof %s!=="number"||(%s|0)!==%s)',r,r,r)("return%j",ot(e,"enum value"));else t("{")("var e=types[%i].verify(%s,q+1);",i,r)("if(e)")("return%j+e",e.name+".")("}");else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.isInteger(%s))",r)("return%j",ot(e,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",r,r,r,r)("return%j",ot(e,"integer|Long"));break;case"float":case"double":t('if(typeof %s!=="number")',r)("return%j",ot(e,"number"));break;case"bool":t('if(typeof %s!=="boolean")',r)("return%j",ot(e,"boolean"));break;case"string":t("if(!util.isString(%s))",r)("return%j",ot(e,"string"));break;case"bytes":t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',r,r,r)("return%j",ot(e,"buffer"));break}return t}function xh(t,e,i){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.key32Re.test(%s))",i)("return%j",ot(e,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.key64Re.test(%s))",i)("return%j",ot(e,"integer|Long key"));break;case"bool":t("if(!util.key2Re.test(%s))",i)("return%j",ot(e,"boolean key"));break}return t}function _h(t){var e=fs.codegen(["m","q"])('if(typeof m!=="object"||m===null)')("return%j","object expected")("if(q===undefined)q=0")("if(q>util.recursionLimit)")("return%j","max depth exceeded"),i=t.oneofsArray,r={};i.length&&e("var p={}");for(var n=0;n<t.fieldsArray.length;++n){var o=t._fieldsArray[n].resolve(),s="m"+fs.safeProp(o.name);if(o.optional&&e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",s,o.name),o.map)e("if(!util.isObject(%s))",s)("return%j",ot(o,"object"))("var k=Object.keys(%s)",s)("for(var i=0;i<k.length;++i){"),xh(e,o,"k[i]"),cs(e,o,n,s+"[k[i]]")("}");else if(o.repeated)e("if(!Array.isArray(%s))",s)("return%j",ot(o,"array"))("for(var i=0;i<%s.length;++i){",s),cs(e,o,n,s+"[i]")("}");else{if(o.partOf){var a=fs.safeProp(o.partOf.name);r[o.partOf.name]===1&&e("if(p%s===1)",a)("return%j",o.partOf.name+": multiple values"),r[o.partOf.name]=1,e("p%s=1",a)}cs(e,o,n,s)}o.optional&&e("}")}return e("return null")}});var gs=te(Du=>{"use strict";var zu=Du,Xt=bt(),ms=pi(),wt=Ve();function hs(t,e,i,r,n){if(e.resolvedType)if(e.resolvedType instanceof Xt){var o=n?"m"+n+"[m"+n+".length]":"m"+r;t("switch(d%s){",r);for(var s=e.resolvedType.values,a=Object.keys(s),l=0;l<a.length;++l)t("case%j:",a[l])("case %i:",s[a[l]])("%s=%j",o,s[a[l]])("break");t("default:"),e.resolvedType._features.enum_type!=="CLOSED"&&t('if(typeof d%s==="number"&&(d%s|0)===d%s)',r,r,r)("%s=d%s",o,r),t("}")}else t("if(!util.isObject(d%s))",r)("throw TypeError(%j)",e.fullName+": object expected")("m%s=types[%i].fromObject(d%s,q+1)",r,i,r);else{var u=!1;switch(e.type){case"double":case"float":t("m%s=Number(d%s)",r,r);break;case"uint32":case"fixed32":t("m%s=d%s>>>0",r,r);break;case"int32":case"sint32":case"sfixed32":t("m%s=d%s|0",r,r);break;case"uint64":case"fixed64":u=!0;case"int64":case"sint64":case"sfixed64":t("if(util.Long)")("m%s=util.Long.fromValue(d%s,%j)",r,r,u)('else if(typeof d%s==="string")',r)("m%s=parseInt(d%s,10)",r,r)('else if(typeof d%s==="number")',r)("m%s=d%s",r,r)('else if(typeof d%s==="object")',r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",r,r,r,u?"true":"");break;case"bytes":t('if(typeof d%s==="string")',r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",r,r,r)("else if(d%s.length>=0)",r)("m%s=d%s",r,r);break;case"string":t("m%s=String(d%s)",r,r);break;case"bool":t("m%s=Boolean(d%s)",r,r);break}}return t}zu.fromObject=function(e){var i=e.fieldsArray,r=wt.codegen(["d","q"])("if(d instanceof C)")("return d")("if(!util.isObject(d))")("throw TypeError(%j)",e.fullName+": object expected")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")');if(!i.length)return r("return new C");r("var m=new C");for(var n=0;n<i.length;++n){var o=i[n].resolve(),s=wt.safeProp(o.name),a=!o.hasPresence&&!o.repeated&&!o.map&&(o.resolvedType instanceof Xt||ms.basic[o.type]!==void 0);o.map?(r("if(d%s){",s)("if(!util.isObject(d%s))",s)("throw TypeError(%j)",o.fullName+": object expected")("m%s={}",s)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",s),r('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",s),hs(r,o,n,s+"[ks[i]]")("}")("}")):o.repeated?(r("if(d%s){",s)("if(!Array.isArray(d%s))",s)("throw TypeError(%j)",o.fullName+": array expected"),o.resolvedType instanceof Xt?r("m%s=[]",s):r("m%s=Array(d%s.length)",s,s),r("for(var i=0;i<d%s.length;++i){",s),hs(r,o,n,s+"[i]",o.resolvedType instanceof Xt?s:void 0)("}")("}")):(o.resolvedType instanceof Xt||r("if(d%s!=null){",s),a&&(o.resolvedType instanceof Xt?r('if(d%s!==%j&&(typeof d%s!=="string"||types[%i].values[d%s]!==%j)){',s,o.typeDefault,s,n,s,o.typeDefault):o.type==="string"?r('if(typeof d%s!=="string"||d%s.length){',s,s):o.type==="bytes"?r("if(d%s.length){",s):o.type==="bool"?r("if(d%s){",s):o.type==="double"||o.type==="float"?r("if(!Object.is(Number(d%s),0)){",s):ms.long[o.type]!==void 0?r('if(typeof d%s==="object"?d%s.low||d%s.high:Number(d%s)!==0){',s,s,s,s):r("if(Number(d%s)!==0){",s)),hs(r,o,n,s),a&&r("}"),o.resolvedType instanceof Xt||r("}"))}return r("return m")};function ps(t,e,i,r,n){if(n||(n=r),e.resolvedType)e.resolvedType instanceof Xt?t("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",r,i,n,n,i,n,n):t("d%s=types[%i].toObject(m%s,o,q+1)",r,i,n);else{var o=!1;switch(e.type){case"double":case"float":t("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",r,n,n,n);break;case"uint64":case"fixed64":o=!0;case"int64":case"sint64":case"sfixed64":t('if(typeof BigInt!=="undefined"&&o.longs===BigInt)')('d%s=typeof m%s==="number"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()',r,n,n,n,n,o)('else if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",r,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",r,n,n,n,o?"true":"",n);break;case"bytes":t("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",r,n,n,n,n);break;default:t("d%s=m%s",r,n);break}}return t}zu.toObject=function(e){var i=e.fieldsArray.slice().sort(wt.compareFieldsById);if(!i.length)return wt.codegen()("return {}");for(var r=wt.codegen(["m","o","q"])("if(!o)")("o={}")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")')("var d={}"),n=[],o=[],s=[],a=0;a<i.length;++a)i[a].partOf||(i[a].resolve().repeated?n:i[a].map?o:s).push(i[a]);if(n.length){for(r("if(o.arrays||o.defaults){"),a=0;a<n.length;++a)r("d%s=[]",wt.safeProp(n[a].name));r("}")}if(o.length){for(r("if(o.objects||o.defaults){"),a=0;a<o.length;++a)r("d%s={}",wt.safeProp(o[a].name));r("}")}if(s.length){for(r("if(o.defaults){"),a=0;a<s.length;++a){var l=s[a],u=wt.safeProp(l.name);if(l.resolvedType instanceof Xt)r("d%s=o.enums===String?%j:%j",u,l.resolvedType.valuesById[l.typeDefault],l.typeDefault);else if(l.long)r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",l.typeDefault.low,l.typeDefault.high,l.typeDefault.unsigned)('d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():typeof BigInt!=="undefined"&&o.longs===BigInt?n.toBigInt():n',u)("}else")('d%s=o.longs===String?%j:typeof BigInt!=="undefined"&&o.longs===BigInt?BigInt(%j):%i',u,l.typeDefault.toString(),l.typeDefault.toString(),l.typeDefault.toNumber());else if(l.bytes){var f=Array.prototype.slice.call(l.typeDefault);r("if(o.bytes===String)d%s=%j",u,wt.base64.encode(l.typeDefault,0,l.typeDefault.length))("else{")("d%s=%j",u,f)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",u,u)("}")}else(l.type==="double"||l.type==="float")&&typeof l.typeDefault=="number"&&(!isFinite(l.typeDefault)||Object.is(l.typeDefault,-0))?r("d%s=%f",u,l.typeDefault)("if(o.json&&!isFinite(d%s))d%s=String(d%s)",u,u,u):r("d%s=%j",u,l.typeDefault)}r("}")}var h=!1;for(a=0;a<i.length;++a){var l=i[a],m=e._fieldsArray.indexOf(l),u=wt.safeProp(l.name);if(l.map){h||(h=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",u,u)("d%s={}",u);var p=ms.long[l.keyType]!==void 0,g=u+"[ks2[j]]";r("for(var j=0;j<ks2.length;++j){"),p&&r("var k2=util.longFromKey(ks2[j],%j).toString()",l.keyType==="uint64"||l.keyType==="fixed64"),r('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",u),ps(r,l,m,p?u+"[k2]":g,g)("}")}else l.repeated?(r("if(m%s&&m%s.length){",u,u)("d%s=Array(m%s.length)",u,u)("for(var j=0;j<m%s.length;++j){",u),ps(r,l,m,u+"[j]")("}")):(r("if(m%s!=null&&Object.hasOwnProperty.call(m,%j)){",u,l.name),ps(r,l,m,u),l.partOf&&!l.partOf.isProto3Optional&&r("if(o.oneofs)")("d%s=%j",wt.safeProp(l.partOf.name),l.name));r("}")}return r("return d")}});var ys=te($u=>{"use strict";var Ih=$u,Ch=Nn(),Eh=Tt();Ih[".google.protobuf.Any"]={fromObject:function(t,e){if(t&&t["@type"]){var i=t["@type"].substring(t["@type"].lastIndexOf("/")+1),r=this.lookup(i,[this.constructor]);if(r){var n=t["@type"].charAt(0)==="."?t["@type"].slice(1):t["@type"];return n.indexOf("/")===-1&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(t,e===void 0?1:e+1)).finish()})}}return this.fromObject(t,e)},toObject:function(t,e,i){if(i===void 0&&(i=0),i>Eh.recursionLimit)throw Error("max depth exceeded");var r="type.googleapis.com/",n="",o="";if(e&&e.json&&t.type_url&&t.value){o=t.type_url.substring(t.type_url.lastIndexOf("/")+1),n=t.type_url.substring(0,t.type_url.lastIndexOf("/")+1);var s=this.lookup(o,[this.constructor]);s&&(t=s.decode(t.value,void 0,void 0,i+1))}if(!(t instanceof this.ctor)&&t instanceof Ch){var a=t.$type.toObject(t,e,i+1),l=t.$type.fullName[0]==="."?t.$type.fullName.slice(1):t.$type.fullName;return n===""&&(n=r),o=n+l,a["@type"]=o,a}return this.toObject(t,e,i)}}});var Dn=te((f0,Bu)=>{"use strict";Bu.exports=pe;var ft=sr();pe.prototype=Object.create(ft.prototype,{constructor:{value:pe,writable:!0,enumerable:!1,configurable:!0}});pe.className="Type";var kh=bt(),ws=Fi(),Mn=di(),Ah=An(),Oh=Rn(),vs=Nn(),bs=En(),qu=In(),De=Ve(),Th=Ss(),Rh=us(),Nh=ds(),Gu=gs(),Ph=ys();function pe(t,e){t=t.replace(/\W/g,""),ft.call(this,t,e),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null,this._fieldsByJsonName=null}Object.defineProperties(pe.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var t=Object.keys(this.fields),e=0;e<t.length;++e){var i=this.fields[t[e]],r=i.id;if(this._fieldsById[r])throw Error("duplicate id "+r+" in "+this);this._fieldsById[r]=i}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=De.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=De.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=pe.generateConstructor(this)())},set:function(t){var e=t.prototype;e instanceof vs||(t.prototype=new vs,Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),De.merge(t.prototype,e)),t.$type=t.prototype.$type=this,De.merge(t,vs,!0),this._ctor=t,delete this.decode,delete this.fromObject;for(var i=0,r;i<this.fieldsArray.length;++i)r=this._fieldsArray[i].resolve(),t.prototype[r.name]=r.defaultValue;var n={};for(i=0;i<this.oneofsArray.length;++i)n[this._oneofsArray[i].resolve().name]={get:De.oneOfGetter(this._oneofsArray[i].oneof),set:De.oneOfSetter(this._oneofsArray[i].oneof)};i&&Object.defineProperties(t.prototype,n)}}});pe.generateConstructor=function(e){for(var i=De.codegen(["p"]),r=0,n;r<e.fieldsArray.length;++r)(n=e._fieldsArray[r]).map?i("this%s={}",De.safeProp(n.name)):n.repeated&&i("this%s=[]",De.safeProp(n.name));return i('if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null&&ks[i]!=="__proto__")')("this[ks[i]]=p[ks[i]]")};function zn(t){return t._fieldsById=t._fieldsArray=t._oneofsArray=t._fieldsByJsonName=null,delete t.encode,delete t.decode,delete t.verify,t}pe.fromJSON=function(e,i,r){if(r===void 0&&(r=0),r>De.nestingLimit)throw Error("max depth exceeded");var n=new pe(e,i.options);n.extensions=i.extensions,n.reserved=i.reserved;for(var o=Object.keys(i.fields),s=0;s<o.length;++s)n.add((typeof i.fields[o[s]].keyType<"u"?Ah.fromJSON:Mn.fromJSON)(o[s],i.fields[o[s]]));if(i.oneofs)for(o=Object.keys(i.oneofs),s=0;s<o.length;++s)n.add(ws.fromJSON(o[s],i.oneofs[o[s]]));if(i.nested)for(o=Object.keys(i.nested),s=0;s<o.length;++s){var a=i.nested[o[s]];n.add((a.id!==void 0?Mn.fromJSON:a.fields!==void 0?pe.fromJSON:a.values!==void 0?kh.fromJSON:a.methods!==void 0?Oh.fromJSON:ft.fromJSON)(o[s],a,r+1))}return i.extensions&&i.extensions.length&&(n.extensions=i.extensions),i.reserved&&i.reserved.length&&(n.reserved=i.reserved),i.group&&(n.group=!0),i.comment&&(n.comment=i.comment),i.edition&&(n._edition=i.edition),n._defaultEdition="proto3",n};pe.prototype.toJSON=function(e){var i=ft.prototype.toJSON.call(this,e),r=e?!!e.keepComments:!1;return De.toObject(["edition",this._editionToJSON(),"options",i&&i.options||void 0,"oneofs",ft.arrayToJSON(this.oneofsArray,e),"fields",ft.arrayToJSON(this.fieldsArray.filter(function(n){return!n.declaringField}),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",i&&i.nested||void 0,"comment",r?this.comment:void 0])};pe.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;ft.prototype.resolveAll.call(this);var e=this.oneofsArray;for(r=0;r<e.length;)e[r++].resolve();for(var i=this.fieldsArray,r=0;r<i.length;)i[r++].resolve();return this};pe.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,ft.prototype._resolveFeaturesRecursive.call(this,e),this.oneofsArray.forEach(i=>{i._resolveFeatures(e)}),this.fieldsArray.forEach(i=>{i._resolveFeatures(e)}),this):this};pe.prototype.get=function(e){return Object.prototype.hasOwnProperty.call(this.fields,e)?this.fields[e]:this.oneofs&&Object.prototype.hasOwnProperty.call(this.oneofs,e)?this.oneofs[e]:this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)?this.nested[e]:null};pe.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof Mn&&e.extend===void 0){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name)||e.name.charAt(0)==="$")throw Error("name '"+e.name+"' is reserved in "+this);return e.name==="__proto__"?this:(e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),zn(this))}if(e instanceof ws){if(e.name.charAt(0)==="$")throw Error("name '"+e.name+"' is reserved in "+this);return e.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),zn(this))}return ft.prototype.add.call(this,e)};pe.prototype.remove=function(e){if(e instanceof Mn&&e.extend===void 0){if(!De.remove(this.fields,e,e.name))throw Error(e+" is not a member of "+this);return e.parent=null,e.onRemove(this),zn(this)}if(e instanceof ws){if(!De.remove(this.oneofs,e,e.name))throw Error(e+" is not a member of "+this);return e.parent=null,e.onRemove(this),zn(this)}return ft.prototype.remove.call(this,e)};pe.prototype.isReservedId=function(e){return ft.isReservedId(this.reserved,e)};pe.prototype.isReservedName=function(e){return ft.isReservedName(this.reserved,e)};pe.prototype.create=function(e){return new this.ctor(e)};pe.prototype.setup=function(){var e=this.root;if(e&&e._needsRecursiveFeatureResolution){var i=e._edition||this._edition;i&&e._resolveFeaturesRecursive(i)}for(var r=this.fullName,n=[],o=0;o<this.fieldsArray.length;++o)n.push(this._fieldsArray[o].resolve().resolvedType);this.encode=Th(this)({Writer:qu,types:n,util:De}),this.decode=Rh(this)({Reader:bs,types:n,util:De,C:this.ctor}),this.verify=Nh(this)({types:n,util:De}),this.fromObject=Gu.fromObject(this)({types:n,util:De,C:this.ctor}),this.toObject=Gu.toObject(this)({types:n,util:De});var s=Ph[r];if(s){var a=Object.create(this);a._ctor=this.ctor,a.fromObject=this.fromObject,this.fromObject=s.fromObject.bind(a),a.toObject=this.toObject,this.toObject=s.toObject.bind(a)}return this};pe.prototype.encode=function(e,i){return this.setup().encode.apply(this,arguments)};pe.prototype.encodeDelimited=function(e,i){return this.encode(e,(i||qu.create()).fork()).ldelim()};pe.prototype.decode=function(e,i){return this.setup().decode.apply(this,arguments)};pe.prototype.decodeDelimited=function(e){return e instanceof bs||(e=bs.create(e)),this.decode(e,e.uint32())};pe.prototype.verify=function(e){return this.setup().verify.apply(this,arguments)};pe.prototype.fromObject=function(e){return this.setup().fromObject.apply(this,arguments)};pe.prototype.toObject=function(e,i){return this.setup().toObject.apply(this,arguments)};pe.prototype.getTypeUrl=function(e){e===void 0&&(e="type.googleapis.com");var i=this.fullName;return e+"/"+(i.charAt(0)==="."?i.substring(1):i)};pe.d=function(e){return function(r){De.decorateType(r,e)}}});var Bn=te((c0,ju)=>{"use strict";ju.exports=it;var qn=sr();it.prototype=Object.create(qn.prototype,{constructor:{value:it,writable:!0,enumerable:!1,configurable:!0}});it.className="Root";var $n=di(),xs=bt(),Fh=Fi(),Ft=Ve(),_s,Is,fr;function it(t){qn.call(this,"",t),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}it.fromJSON=function(e,i,r){if(r===void 0&&(r=0),r>Ft.recursionLimit)throw Error("max depth exceeded");return i||(i=new it),e.options&&i.setOptions(e.options),i.addJSON(e.nested,r).resolveAll()};it.prototype.resolvePath=Ft.path.resolve;it.prototype.fetch=Ft.fetch;function Lu(){}it.prototype.load=function t(e,i,r){typeof i=="function"&&(r=i,i=void 0);var n=this;if(!r)return Ft.asPromise(t,n,e,i);var o=r===Lu;function s(p,g){if(r){if(o)throw p;g&&g.resolveAll();var b=r;r=null,b(p,g)}}function a(p){var g=p.lastIndexOf("google/protobuf/");if(g>-1){var b=p.substring(g);if(Object.prototype.hasOwnProperty.call(fr,b))return b}return Object.prototype.hasOwnProperty.call(fr,p)?p:null}function l(p,g,b){b===void 0&&(b=0);try{if(b>Ft.recursionLimit)throw Error("max depth exceeded");if(Ft.isString(g)&&g.charAt(0)==="{"&&(g=JSON.parse(g)),!Ft.isString(g))n.setOptions(g.options).addJSON(g.nested);else{Is.filename=p;var w=Is(g,n,i),x,I=0;if(w.imports)for(;I<w.imports.length;++I)(x=a(w.imports[I])||n.resolvePath(p,w.imports[I]))&&u(x,!1,b+1);if(w.weakImports)for(I=0;I<w.weakImports.length;++I)(x=a(w.weakImports[I])||n.resolvePath(p,w.weakImports[I]))&&u(x,!0,b+1)}}catch($){s($)}!o&&!f&&s(null,n)}function u(p,g,b){if(b===void 0&&(b=0),p=a(p)||p,!(n.files.indexOf(p)>-1)){if(n.files.push(p),Object.prototype.hasOwnProperty.call(fr,p)){o?l(p,fr[p],b):(++f,setTimeout(function(){--f,l(p,fr[p],b)}));return}if(o){var w;try{w=Ft.fs.readFileSync(p).toString("utf8")}catch(x){g||s(x);return}l(p,w,b)}else++f,n.fetch(p,function(x,I){if(--f,!!r){if(x){g?f||s(null,n):s(x);return}l(p,I,b)}})}}var f=0;Ft.isString(e)&&(e=[e]);for(var h=0,m;h<e.length;++h)(m=n.resolvePath("",e[h]))&&u(m);return o?(n.resolveAll(),n):(f||s(null,n),n)};it.prototype.loadSync=function(e,i){if(!Ft.isNode)throw Error("not supported");return this.load(e,i,Lu)};it.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return qn.prototype.resolveAll.call(this)};var Gn=/^[A-Z]/;function Vu(t,e){var i=e.parent.lookup(e.extend);if(i){var r=new $n(e.fullName,e.id,e.type,e.rule,void 0,e.options);return i.get(r.name)||(r.declaringField=e,e.extensionField=r,i.add(r)),!0}return!1}it.prototype._handleAdd=function(e){if(e instanceof $n)e.extend!==void 0&&!e.extensionField&&(Vu(this,e)||this.deferred.push(e));else if(e instanceof xs)Gn.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof Fh)){if(e instanceof _s)for(var i=0;i<this.deferred.length;)Vu(this,this.deferred[i])?this.deferred.splice(i,1):++i;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);Gn.test(e.name)&&(e.parent[e.name]=e)}(e instanceof _s||e instanceof xs||e instanceof $n)&&(this._fullyQualifiedObjects[e.fullName]=e)};it.prototype._handleRemove=function(e){if(e instanceof $n){if(e.extend!==void 0)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var i=this.deferred.indexOf(e);i>-1&&this.deferred.splice(i,1)}}else if(e instanceof xs)Gn.test(e.name)&&delete e.parent[e.name];else if(e instanceof qn){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);Gn.test(e.name)&&delete e.parent[e.name]}delete this._fullyQualifiedObjects[e.fullName]};it._configure=function(t,e,i){_s=t,Is=e,fr=i}});var Ve=te((d0,Xu)=>{"use strict";var _e=Xu.exports=Tt(),Uu=Wo(),Cs,Es;_e.codegen=vu();_e.fetch=Su();_e.path=Iu();_e.patterns=Zo();var Yu=_e.patterns.reservedRe;_e.fs=es();_e.toArray=function(e){if(e){for(var i=Object.keys(e),r=new Array(i.length),n=0;n<i.length;)r[n]=e[i[n++]];return r}return[]};_e.toObject=function(e){for(var i={},r=0;r<e.length;){var n=e[r++],o=e[r++];o!==void 0&&(i[n]=o)}return i};_e.remove=function(e,i,r){if(!e)return!1;if(r!==void 0&&Object.prototype.hasOwnProperty.call(e,r)&&e[r]===i)return delete e[r],!0;for(var n=Object.keys(e),o=0;o<n.length;++o)if(e[n[o]]===i)return delete e[n[o]],!0;return!1};_e.isReserved=function(e){return Yu.test(e)};_e.safeProp=function(e){return!/^[$\w_]+$/.test(e)||Yu.test(e)?"["+JSON.stringify(e)+"]":"."+e};_e.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var Mh=/_([a-z])/g;_e.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(Mh,function(i,r){return r.toUpperCase()})};_e.jsonName=function(e){for(var i="",r=!1,n=0;n<e.length;++n){var o=e.charAt(n);o==="_"?r=!0:r?(i+=o.toUpperCase(),r=!1):i+=o}return i};_e.compareFieldsById=function(e,i){return e.id-i.id};_e.decorateType=function(e,i){if(e.$type)return i&&e.$type.name!==i&&(_e.decorateRoot.remove(e.$type),e.$type.name=i,_e.decorateRoot.add(e.$type)),e.$type;Cs||(Cs=Dn());var r=new Cs(i||e.name);return _e.decorateRoot.add(r),r.ctor=e,Object.defineProperty(e,"$type",{value:r,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:r,enumerable:!1}),r};var zh=0;_e.decorateEnum=function(e){if(e.$type)return e.$type;Es||(Es=bt());var i=new Es("Enum"+zh++,e);return _e.decorateRoot.add(i),Object.defineProperty(e,"$type",{value:i,enumerable:!1}),i};_e.setProperty=function(e,i,r,n){function o(s,a,l){var u=a.shift();if(_e.isUnsafeProperty(u))return s;if(a.length>0)s[u]=o(s[u]||{},a,l);else{var f=s[u];if(f&&n)return s;f&&(l=[].concat(f).concat(l)),s[u]=l}return s}if(typeof e!="object")throw TypeError("dst must be an object");if(!i)throw TypeError("path must be specified");if(i=i.split("."),i.length>_e.recursionLimit)throw Error("max depth exceeded");return o(e,i,r)};Object.defineProperty(_e,"decorateRoot",{get:function(){return Uu.decorated||(Uu.decorated=new(Bn()))}})});var pi=te(Hu=>{"use strict";var Fr=Hu,Dh=Ve(),$h=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function Mr(t,e){var i=0,r=Object.create(null);for(e|=0;i<t.length;)r[$h[i+e]]=t[i++];return r}Fr.basic=Mr([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]);Fr.defaults=Mr([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",Dh.emptyArray,null]);Fr.long=Mr([0,0,0,1,1],7);Fr.mapKey=Mr([0,0,0,5,5,0,0,0,1,1,0,2],2);Fr.packed=Mr([1,5,0,0,0,5,5,0,0,0,1,1,0])});var di=te((p0,Wu)=>{"use strict";Wu.exports=$e;var Dr=hi();$e.prototype=Object.create(Dr.prototype,{constructor:{value:$e,writable:!0,enumerable:!1,configurable:!0}});$e.className="Field";var Ku=bt(),Vn=pi(),Ae=Ve(),zr,Gh=/^(?:required|optional|repeated)$/;$e.fromJSON=function(e,i){var r=new $e(e,i.id,i.type,i.rule,i.extend,i.options,i.comment);return i.edition&&(r._edition=i.edition),i.protoName&&(r.protoName=i.protoName),i.jsonName!==void 0?r.jsonName=i.jsonName:i.options&&i.options.json_name!==void 0&&(r.jsonName=i.options.json_name),r._defaultEdition="proto3",r};function $e(t,e,i,r,n,o,s){if(Ae.isObject(r)?(s=n,o=r,r=n=void 0):Ae.isObject(n)&&(s=o,o=n,n=void 0),Dr.call(this,t,o),!Ae.isInteger(e)||e<0)throw TypeError("id must be a non-negative integer");if(!Ae.isString(i))throw TypeError("type must be a string");if(r!==void 0&&!Gh.test(r=r.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(n!==void 0&&!Ae.isString(n))throw TypeError("extend must be a string");this.rule=r&&r!=="optional"?r:void 0,this.type=i,this.id=e,this.extend=n||void 0,this.repeated=r==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=Ae.Long?Vn.long[i]!==void 0:!1,this.bytes=i==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=s,this.protoName=void 0,this.jsonName=void 0}Object.defineProperty($e.prototype,"required",{get:function(){return this._features.field_presence==="LEGACY_REQUIRED"}});Object.defineProperty($e.prototype,"optional",{get:function(){return!this.required}});Object.defineProperty($e.prototype,"delimited",{get:function(){return this.resolvedType instanceof zr&&this._features.message_encoding==="DELIMITED"}});Object.defineProperty($e.prototype,"packed",{get:function(){return this._features.repeated_field_encoding==="PACKED"}});Object.defineProperty($e.prototype,"hasPresence",{get:function(){return this.repeated||this.map?!1:this.partOf||this.declaringField||this.extensionField||this._features.field_presence!=="IMPLICIT"}});$e.prototype.setOption=function(e,i,r){return Dr.prototype.setOption.call(this,e,i,r)};$e.prototype.toJSON=function(e){var i=e?!!e.keepComments:!1;return Ae.toObject(["edition",this._editionToJSON(),"rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"protoName",this.protoName!==this.name?this.protoName:void 0,"jsonName",this.jsonName!==Ae.jsonName(this.protoName||this.name)?this.jsonName:void 0,"options",this.options,"comment",i?this.comment:void 0])};$e.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=Vn.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof zr?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof Ku&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof Ku)&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long){var e=this.type==="uint64"||this.type==="fixed64";this.typeDefault=typeof this.typeDefault=="string"?Ae.Long.fromString(this.typeDefault,e):Ae.Long.fromNumber(this.typeDefault,e),Object.freeze&&Object.freeze(this.typeDefault)}else if(Vn.long[this.type]!==void 0&&typeof this.typeDefault=="string")this.typeDefault=parseInt(this.typeDefault,10);else if(this.bytes&&typeof this.typeDefault=="string"){var i;Ae.base64.test(this.typeDefault)?Ae.base64.decode(this.typeDefault,i=Ae.newBuffer(Ae.base64.length(this.typeDefault)),0):Ae.utf8.write(this.typeDefault,i=Ae.newBuffer(Ae.utf8.length(this.typeDefault)),0),this.typeDefault=i}return this.map?this.defaultValue=Ae.emptyObject:this.repeated?this.defaultValue=Ae.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof zr&&this.parent._ctor&&(this.parent._ctor.prototype[this.name]=this.defaultValue),this.protoName===void 0&&(this.protoName=this.name),this.jsonName===void 0&&(this.jsonName=Ae.jsonName(this.protoName)),Dr.prototype.resolve.call(this)};$e.prototype._inferLegacyProtoFeatures=function(e){if(e!=="proto2"&&e!=="proto3")return{};var i={};if(this.rule==="required"&&(i.field_presence="LEGACY_REQUIRED"),this.parent&&Vn.defaults[this.type]===void 0){var r=this.parent.get(this.type.split(".").pop());r&&r instanceof zr&&r.group&&(i.message_encoding="DELIMITED")}return this.getOption("packed")===!0?i.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(i.repeated_field_encoding="EXPANDED"),i};$e.prototype._resolveFeatures=function(e){return Dr.prototype._resolveFeatures.call(this,this._edition||e)};$e.d=function(e,i,r,n){return typeof i=="function"?i=Ae.decorateType(i).name:i&&typeof i=="object"&&(i=Ae.decorateEnum(i).name),function(s,a){Ae.decorateType(s.constructor).add(new $e(a,e,i,r,{default:n}))}};$e._configure=function(e){zr=e}});var Fi=te((m0,Qu)=>{"use strict";Qu.exports=rt;var jn=hi();rt.prototype=Object.create(jn.prototype,{constructor:{value:rt,writable:!0,enumerable:!1,configurable:!0}});rt.className="OneOf";var Ju=di(),Ln=Ve();function rt(t,e,i,r){if(Array.isArray(e)||(i=e,e=void 0),jn.call(this,t,i),!(e===void 0||Array.isArray(e)))throw TypeError("fieldNames must be an Array");this.oneof=e||[],this.fieldsArray=[],this.comment=r}rt.fromJSON=function(e,i){return new rt(e,i.oneof,i.options,i.comment)};rt.prototype.toJSON=function(e){var i=e?!!e.keepComments:!1;return Ln.toObject(["options",this.options,"oneof",this.oneof,"comment",i?this.comment:void 0])};function Zu(t){if(t.parent)for(var e=0;e<t.fieldsArray.length;++e)t.fieldsArray[e].parent||t.parent.add(t.fieldsArray[e])}rt.prototype.add=function(e){if(!(e instanceof Ju))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,Zu(this),this};rt.prototype.remove=function(e){if(!(e instanceof Ju))throw TypeError("field must be a Field");var i=this.fieldsArray.indexOf(e);if(i<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(i,1),i=this.oneof.indexOf(e.name),i>-1&&this.oneof.splice(i,1),e.partOf=null,this};rt.prototype.onAdd=function(e){jn.prototype.onAdd.call(this,e);for(var i=this,r=0;r<this.oneof.length;++r){var n=e.get(this.oneof[r]);n&&!n.partOf&&(n.partOf=i,i.fieldsArray.push(n))}Zu(this)};rt.prototype.onRemove=function(e){for(var i=0,r;i<this.fieldsArray.length;++i)(r=this.fieldsArray[i]).parent&&r.parent.remove(r);jn.prototype.onRemove.call(this,e)};Object.defineProperty(rt.prototype,"isProto3Optional",{get:function(){if(this.fieldsArray==null||this.fieldsArray.length!==1)return!1;var t=this.fieldsArray[0];return t.options!=null&&t.options.proto3_optional===!0}});rt.d=function(){for(var e=new Array(arguments.length),i=0;i<arguments.length;)e[i]=arguments[i++];return function(n,o){Ln.decorateType(n.constructor).add(new rt(o,e)),Object.defineProperty(n,o,{get:Ln.oneOfGetter(e),set:Ln.oneOfSetter(e)})}}});var hi=te((g0,ef)=>{"use strict";ef.exports=Ue;Ue.className="ReflectionObject";var qh=Fi(),St=Ve(),Un,Bh={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY",enforce_naming_style:"STYLE2024",default_symbol_visibility:"EXPORT_TOP_LEVEL"},Vh={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY",enforce_naming_style:"STYLE_LEGACY",default_symbol_visibility:"EXPORT_ALL"},Lh={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE",enforce_naming_style:"STYLE_LEGACY",default_symbol_visibility:"EXPORT_ALL"},jh={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY",enforce_naming_style:"STYLE_LEGACY",default_symbol_visibility:"EXPORT_ALL"};function Ue(t,e){if(!St.isString(t))throw TypeError("name must be a string");if(e&&!St.isObject(e))throw TypeError("options must be an object");this.options=e,this.parsedOptions=null,this.name=t,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(Ue.prototype,{root:{get:function(){for(var t=this;t.parent!==null;)t=t.parent;return t}},fullName:{get:function(){for(var t=[this.name],e=this.parent;e;)t.unshift(e.name),e=e.parent;return t.join(".")}}});Ue.prototype.toJSON=function(){throw Error()};Ue.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var i=e.root;i instanceof Un&&i._handleAdd(this)};Ue.prototype.onRemove=function(e){var i=e.root;i instanceof Un&&i._handleRemove(this),this.parent=null,this.resolved=!1};Ue.prototype.resolve=function(){return this.resolved?this:(this.root instanceof Un&&(this.resolved=!0),this)};Ue.prototype._resolveFeaturesRecursive=function(e){return this._resolveFeatures(this._edition||e)};Ue.prototype._resolveFeatures=function(e){if(!this._featuresResolved){var i={};if(!e)throw new Error("Unknown edition for "+this.fullName);var r=St.merge({},this.options&&this.options.features,this._inferLegacyProtoFeatures(e));if(this._edition){if(e==="proto2")i=Object.assign({},Lh);else if(e==="proto3")i=Object.assign({},jh);else if(e==="2023")i=Object.assign({},Vh);else if(e==="2024")i=Object.assign({},Bh);else throw new Error("Unknown edition: "+e);this._features=St.merge(i,r)}else if(this.partOf instanceof qh){var n=St.merge({},this.partOf._features);this._features=St.merge(n,r)}else if(!this.declaringField)if(this.parent){var o=St.merge({},this.parent._features);this._features=St.merge(o,r)}else throw new Error("Unable to find a parent for "+this.fullName);this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}};Ue.prototype._inferLegacyProtoFeatures=function(){return{}};Ue.prototype.getOption=function(e){if(this.options&&Object.prototype.hasOwnProperty.call(this.options,e))return this.options[e]};Ue.prototype.setOption=function(e,i,r){if(e==="__proto__")return this;if(this.options||(this.options={}),/^features\./.test(e))St.setProperty(this.options,e,i,r);else{var n=this.getOption(e);(!r||n===void 0)&&(n!==i&&(this.resolved=!1),this.options[e]=i)}return this};Ue.prototype.setParsedOption=function(e,i,r){if(e==="__proto__")return this;this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(r){var o=n.find(function(l){return Object.prototype.hasOwnProperty.call(l,e)});if(o){var s=o[e];St.setProperty(s,r,i)}else o={},o[e]=St.setProperty({},r,i),n.push(o)}else{var a={};a[e]=i,n.push(a)}return this};Ue.prototype.setOptions=function(e,i){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],i);return this};Object.defineProperty(Ue.prototype,"toString",{value:function(){var e=this.constructor.className,i=this.fullName;return i.length?e+" "+i:e},writable:!0,enumerable:!1,configurable:!0});Ue.prototype._editionToJSON=function(){if(!(!this._edition||this._edition==="proto3"))return this._edition};Ue._configure=function(t){Un=t}});var bt=te((y0,rf)=>{"use strict";rf.exports=ct;var ks=hi();ct.prototype=Object.create(ks.prototype,{constructor:{value:ct,writable:!0,enumerable:!1,configurable:!0}});ct.className="Enum";var tf=sr(),cr=Ve();function ct(t,e,i,r,n,o){if(ks.call(this,t,i),e&&typeof e!="object")throw TypeError("values must be an object");if(this.valuesById=Object.create(null),this.values=Object.create(this.valuesById),this.comment=r,this.comments=n||{},this.valuesOptions=o,this._valuesFeatures={},this.reserved=void 0,e)for(var s=Object.keys(e),a=0;a<s.length;++a)s[a]!=="__proto__"&&typeof e[s[a]]=="number"&&(this.values[s[a]]=e[s[a]],this.valuesById[e[s[a]]]===void 0&&(this.valuesById[e[s[a]]]=s[a]))}ct.prototype._resolveFeatures=function(e){return e=this._edition||e,ks.prototype._resolveFeatures.call(this,e),Object.keys(this.values).forEach(i=>{var r=cr.merge({},this._features);this._valuesFeatures[i]=cr.merge(r,this.valuesOptions&&this.valuesOptions[i]&&this.valuesOptions[i].features||{})}),this};ct.fromJSON=function(e,i){var r=new ct(e,i.values,i.options,i.comment,i.comments,i.valuesOptions);return r.reserved=i.reserved,i.edition&&(r._edition=i.edition),r._defaultEdition="proto3",r};ct.prototype.toJSON=function(e){var i=e?!!e.keepComments:!1;return cr.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",i?this.comment:void 0,"comments",i?this.comments:void 0])};ct.prototype.add=function(e,i,r,n){if(!cr.isString(e))throw TypeError("name must be a string");if(!cr.isInteger(i))throw TypeError("id must be an integer");if(e==="__proto__")return this;if(this.values[e]!==void 0)throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(i))throw Error("id "+i+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(this.valuesById[i]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+i+" in "+this);this.values[e]=i}else this.valuesById[this.values[e]=i]=e;return n&&(this.valuesOptions===void 0&&(this.valuesOptions={}),this.valuesOptions[e]=n||null),this.comments[e]=r||null,this};ct.prototype.remove=function(e){if(!cr.isString(e))throw TypeError("name must be a string");var i=this.values[e];if(i==null)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[i],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this};ct.prototype.isReservedId=function(e){return tf.isReservedId(this.reserved,e)};ct.prototype.isReservedName=function(e){return tf.isReservedName(this.reserved,e)}});var Ss=te((v0,of)=>{"use strict";of.exports=Uh;var As=bt(),gi=pi(),Os=Ve();function nf(t,e,i,r){return e.delimited?t("types[%i].encode(%s,w.uint32(%i),q+1).uint32(%i)",i,r,(e.id<<3|3)>>>0,(e.id<<3|4)>>>0):t("types[%i].encode(%s,w.uint32(%i).fork(),q+1).ldelim()",i,r,(e.id<<3|2)>>>0)}function Uh(t){for(var e=Os.codegen(["m","w","q"])("if(!w)")("w=Writer.create()")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")'),i,r,n=t.fieldsArray.slice().sort(Os.compareFieldsById),i=0;i<n.length;++i){var o=n[i].resolve(),s=t._fieldsArray.indexOf(o),a=o.resolvedType instanceof As?"int32":o.type,l=gi.basic[a];r="m"+Os.safeProp(o.name),o.map?(e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",r,o.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",r),o.keyType==="bool"?e("w.uint32(%i).fork().uint32(%i).bool(util.boolFromKey(ks[i]))",(o.id<<3|2)>>>0,8|gi.mapKey[o.keyType]):gi.long[o.keyType]!==void 0?e("w.uint32(%i).fork().uint32(%i).%s(util.longFromKey(ks[i],%j))",(o.id<<3|2)>>>0,8|gi.mapKey[o.keyType],o.keyType,o.keyType==="uint64"||o.keyType==="fixed64"):e("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(o.id<<3|2)>>>0,8|gi.mapKey[o.keyType],o.keyType),l===void 0?e("types[%i].encode(%s[ks[i]],w.uint32(18).fork(),q+1).ldelim().ldelim()",s,r):e(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|l,a,r),e("}")("}")):o.repeated?(e("if(%s!=null&&%s.length){",r,r),o.packed&&gi.packed[a]!==void 0?e("w.uint32(%i).%ss(%s)",(o.id<<3|2)>>>0,a,r):(e("for(var i=0;i<%s.length;++i)",r),l===void 0?nf(e,o,s,r+"[i]"):e("w.uint32(%i).%s(%s[i])",(o.id<<3|l)>>>0,a,r)),e("}")):(o.required||(o.hasPresence||!(o.resolvedType instanceof As||gi.basic[a]!==void 0)?e("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",r,o.name):o.resolvedType instanceof As?e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)&&%s!==%j)",r,o.name,r,o.typeDefault):a==="bool"?e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)&&%s!==false)",r,o.name,r):a==="string"?e('if(%s!=null&&Object.hasOwnProperty.call(m,%j)&&%s!=="")',r,o.name,r):a==="bytes"?e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)&&%s.length)",r,o.name,r):a==="double"||a==="float"?e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)&&!Object.is(%s,0))",r,o.name,r):gi.long[a]!==void 0?e('if(%s!=null&&Object.hasOwnProperty.call(m,%j)&&(typeof %s==="object"?%s.low||%s.high:%s!==0))',r,o.name,r,r,r,r):e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)&&%s!==0)",r,o.name,r)),l===void 0?nf(e,o,s,r):e("w.uint32(%i).%s(%s)",(o.id<<3|l)>>>0,a,r))}return e('if(m.$unknowns!=null&&Object.hasOwnProperty.call(m,"$unknowns"))')("for(var i=0;i<m.$unknowns.length;++i)")("w.raw(m.$unknowns[i])")("return w")}});var af=te((ae,sf)=>{"use strict";ae=sf.exports=mu();ae.build="light";function Yh(t,e,i){return typeof e=="function"?(i=e,e=new ae.Root):e||(e=new ae.Root),e.load(t,i)}ae.load=Yh;function Xh(t,e){return e||(e=new ae.Root),e.loadSync(t)}ae.loadSync=Xh;ae.encoder=Ss();ae.decoder=us();ae.verifier=ds();ae.converter=gs();ae.ReflectionObject=hi();ae.Namespace=sr();ae.Root=Bn();ae.Enum=bt();ae.Type=Dn();ae.Field=di();ae.OneOf=Fi();ae.MapField=An();ae.Service=Rn();ae.Method=On();ae.Message=Nn();ae.wrappers=ys();ae.types=pi();ae.util=Ve();ae.ReflectionObject._configure(ae.Root);ae.Namespace._configure(ae.Type,ae.Service,ae.Enum);ae.Root._configure(ae.Type,void 0,{});ae.Field._configure(ae.Type)});var Rs=te((b0,ff)=>{"use strict";ff.exports=uf;var Ts=/[\s{}=;:[\],'"()<>]/g,Hh=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,Kh=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,Wh=/^ *[*/]+ */,Jh=/^\s*\*?\/*/,Zh=/\n/g,Qh=/\s/,ep=/\\(.?)/g,tp={0:"\0",r:"\r",n:`
|
|
5
|
+
`,t:" "};function lf(t){return t.replace(ep,function(e,i){switch(i){case"\\":case"":return i;default:return tp[i]||""}})}uf.unescape=lf;function uf(t,e){t=t.toString();var i=0,r=t.length,n=1,o=0,s={},a=[],l=null;function u(C){return Error("illegal "+C+" (line "+n+")")}function f(){var C=l==="'"?Kh:Hh;C.lastIndex=i-1;var D=C.exec(t);if(!D)throw u("string");return i=C.lastIndex,w(l),l=null,lf(D[1])}function h(C){return t.charAt(C)}function m(C,D,G){var Y={type:t.charAt(C++),lineEmpty:!1,leading:G},B;e?B=2:B=3;var _=C-B,O;do if(--_<0||(O=t.charAt(_))===`
|
|
6
|
+
`){Y.lineEmpty=!0;break}while(O===" "||O===" ");for(var y=t.substring(C,D).split(Zh),N=0;N<y.length;++N)y[N]=y[N].replace(e?Jh:Wh,"").trim();Y.text=y.join(`
|
|
7
|
+
`).trim(),s[n]=Y,o=n}function p(C){var D=g(C),G=t.substring(C,D),Y=/^\s*\/\//.test(G);return Y}function g(C){for(var D=C;D<r&&h(D)!==`
|
|
8
|
+
`;)D++;return D}function b(){if(a.length>0)return a.shift();if(l)return f();var C,D,G,Y,B,_,O=i===0;do{if(i===r)return null;for(C=!1;Qh.test(G=h(i));)if(G===`
|
|
9
|
+
`&&(O=!0,++n),++i===r)return null;if(h(i)==="/"){if(++i===r)throw u("comment");if(h(i)==="/")if(e){if(Y=i,B=!1,p(i-1)){B=!0;do{if(i=g(i),i===r||(i++,!O))break;_=p(i),_&&n++}while(_)}else i=Math.min(r,g(i)+1);B&&(m(Y,i,O),O=!0),n++,C=!0}else{for(B=h(Y=i+1)==="/";h(++i)!==`
|
|
10
|
+
`;)if(i===r)return null;++i,B&&(m(Y,i-1,O),O=!0),++n,C=!0}else if((G=h(i))==="*"){Y=i+1,B=e||h(Y)==="*";do{if(G===`
|
|
11
|
+
`&&++n,++i===r)throw u("comment");D=G,G=h(i)}while(D!=="*"||G!=="/");++i,B&&(m(Y,i-2,O),O=!0),C=!0}else return"/"}}while(C);var y=i;Ts.lastIndex=0;var N=Ts.test(h(y++));if(!N)for(;y<r&&!Ts.test(h(y));)++y;var E=t.substring(i,i=y);return(E==='"'||E==="'")&&(l=E),E}function w(C){a.push(C)}function x(){if(!a.length){var C=b();if(C===null)return null;w(C)}return a[0]}function I(C,D){var G=x(),Y=G===C;if(Y)return b(),!0;if(!D)throw u("token '"+G+"', '"+C+"' expected");return!1}function $(C){var D=null,G;return C===void 0?(G=s[n-1],delete s[n-1],G&&(e||G.type==="*"||G.lineEmpty)&&(D=G.leading?G.text:null)):(o<C&&x(),G=s[C],delete s[C],G&&!G.lineEmpty&&(e||G.type==="/")&&(D=G.leading?null:G.text)),D}return Object.defineProperty({next:b,peek:x,push:w,skip:I,cmnt:$},"line",{get:function(){return n}})}});var mf=te((w0,pf)=>{"use strict";pf.exports=Kt;Kt.filename=null;Kt.defaults={keepCase:!1};var ip=Rs(),cf=Bn(),df=Dn(),Yn=di(),rp=An(),hf=Fi(),np=bt(),op=Rn(),sp=On(),ap=hi(),lp=pi(),Ht=Ve(),up=/^[1-9][0-9]*$/,fp=/^-?[1-9][0-9]*$/,cp=/^0[x][0-9a-fA-F]+$/,dp=/^-?0[x][0-9a-fA-F]+$/,hp=/^0[0-7]+$/,pp=/^-?0[0-7]+$/,mp=/^(?:u?int|sint|s?fixed)(?:32|64)$/,gp=/^(?:uint|fixed)(?:32|64)$/,yp=Ht.patterns.numberRe,Mt=/^[a-zA-Z_][a-zA-Z_0-9]*$/,xt=Ht.patterns.typeRefRe,vp=536870911,bp=2147483647;function Kt(t,e,i){e instanceof cf||(i=e,e=new cf),i||(i=Kt.defaults);var r=i.preferTrailingComment||!1,n=ip(t,i.alternateCommentMode||!1),o=n.next,s=n.push,a=n.peek,l=n.skip,u=n.cmnt,f=!0,h,m,p,g="proto2",b=e,w=[],x={},I=i.keepCase?function(T){return T}:Ht.camelCase;function $(){w.forEach(T=>{T._edition=g,Object.keys(x).forEach(A=>{T.getOption(A)===void 0&&T.setOption(A,x[A],!0)})})}function C(T,A,P){var F=Kt.filename;return P||(Kt.filename=null),Error("illegal "+(A||"token")+" '"+T+"' ("+(F?F+", ":"")+"line "+n.line+")")}function D(){var T=[],A;do{if((A=o())!=='"'&&A!=="'")throw C(A);T.push(o()),l(A),A=a()}while(A==='"'||A==="'");return T.join("")}function G(T){var A=o();switch(A){case"'":case'"':return s(A),D();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return B(A,!0)}catch{if(T&&xt.test(A))return A;throw C(A,"value")}}function Y(T,A,P,F){var L,J;do if(A&&((L=a())==='"'||L==="'")){var re=D();if(T.push(re),g>=2023)throw C(re,"id")}else try{T.push([J=O(o(),F,P),l("to",!0)?O(o(),F,P):J])}catch(ie){if(A&&xt.test(L)&&g>=2023)T.push(L);else throw ie}while(l(",",!0));var ne={options:void 0};ne.setOption=function(ie,Fe){this.options===void 0&&(this.options={}),this.options[ie]=Fe},M(ne,function(Fe){if(Fe==="option")ee(ne,Fe),l(";");else throw C(Fe)},function(){Gt(ne)})}function B(T,A){var P=1;switch(T.charAt(0)==="-"&&(P=-1,T=T.substring(1)),T){case"inf":case"INF":case"Inf":return P*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return P*0}if(up.test(T))return P*parseInt(T,10);if(cp.test(T))return P*parseInt(T,16);if(hp.test(T))return P*parseInt(T,8);if(yp.test(T))return P*parseFloat(T);throw C(T,"number",A)}function _(T,A,P){if(T===null)throw C(T,"end of input");if(!A&&T.charAt(0)==="-")throw C(T,P||"integer");if(T==="0"||T==="-0")return 0;var F;if(fp.test(T))F=parseInt(T,10);else if(dp.test(T))F=parseInt(T,16);else if(pp.test(T))F=parseInt(T,8);else throw C(T,P||"integer");return F||0}function O(T,A,P){switch(T){case"max":case"MAX":case"Max":return P||vp}return _(T,A,"id")}function y(){if(h!==void 0)throw C("package");if(h=o(),h===null||!xt.test(h))throw C(h,"name");b=b.define(h),l(";")}function N(){var T=a(),A;switch(T){case"option":if(g<"2024")throw C("option");o(),D(),l(";");return;case"weak":A=p||(p=[]),o();break;case"public":o();default:A=m||(m=[]);break}T=D(),l(";"),A.push(T)}function E(){if(l("="),g=D(),g<2023)throw C(g,"syntax");l(";")}function c(){if(l("="),g=D(),!["2023","2024"].includes(g))throw C(g,"edition");l(";")}function S(T,A,P){switch(P===void 0&&(P=0),A){case"option":return ee(T,A),l(";"),!0;case"message":return j(T,A,P+1),!0;case"enum":return be(T,A),!0;case"export":case"local":return g<"2024"||(A=o(),A==="export"||A==="local")||A!=="message"&&A!=="enum"?!1:S(T,A,P);case"service":return Oe(T,A,P+1),!0;case"extend":return pt(T,A,P),!0}return!1}function M(T,A,P){var F=n.line;if(T&&(typeof T.comment!="string"&&(T.comment=u()),T.filename=Kt.filename),l("{",!0)){for(var L;(L=o())!=="}";)A(L);l(";",!0)}else P&&P(),l(";"),T&&(typeof T.comment!="string"||r)&&(T.comment=u(F)||T.comment)}function j(T,A,P){if(P===void 0&&(P=0),P>Ht.nestingLimit)throw Error("max depth exceeded");if((A=o())===null||!Mt.test(A))throw C(A,"type name");var F=new df(A);M(F,function(J){if(!S(F,J,P))switch(J){case";":break;case"map":ce(F,J);break;case"required":if(g!=="proto2")throw C(J);case"repeated":H(F,J,void 0,P+1);break;case"optional":if(g==="proto3")H(F,"proto3_optional",void 0,P+1);else{if(g!=="proto2")throw C(J);H(F,"optional",void 0,P+1)}break;case"oneof":ve(F,J,P+1);break;case"extensions":Y(F.extensions||(F.extensions=[]));break;case"reserved":Y(F.reserved||(F.reserved=[]),!0);break;default:if(g==="proto2"||!xt.test(J))throw C(J);s(J),H(F,"optional",void 0,P+1);break}}),T.add(F),T===b&&w.push(F)}function H(T,A,P,F){var L=o();if(L===null)throw C(L,"end of input");if(L==="group"){Q(T,A,P,F);return}for(;L.endsWith(".")||(a()||"").startsWith(".");){var J=o();if(J===null)throw C(J,"end of input");L+=J}if(!xt.test(L))throw C(L,"type");var re=o();if(re===null)throw C(re,"end of input");if(!Mt.test(re))throw C(re,"name");var ne=re;re=I(re),l("=");var ie=new Yn(re,O(o()),L,A==="proto3_optional"?"optional":A,P);if(ne!==re&&(ie.protoName=ne),M(ie,function(kt){if(kt==="option")ee(ie,kt),l(";");else throw C(kt)},function(){Gt(ie)}),A==="proto3_optional"){var Fe=new hf("_"+re);ie.setOption("proto3_optional",!0),Fe.add(ie),T.add(Fe)}else T.add(ie);T===b&&w.push(ie)}function Q(T,A,P,F){if(F===void 0&&(F=0),F>Ht.nestingLimit)throw Error("max depth exceeded");if(g>=2023)throw C("group");var L=o();if(L===null||!Mt.test(L))throw C(L,"name");var J=Ht.lcFirst(L);L===J&&(L=Ht.ucFirst(L)),l("=");var re=O(o()),ne=new df(L);ne.group=!0;var ie=new Yn(J,re,L,A,P);ie.filename=Kt.filename,M(ne,function(Re){switch(Re){case";":break;case"map":ce(ne);break;case"option":ee(ne,Re),l(";");break;case"required":case"repeated":H(ne,Re,void 0,F+1);break;case"optional":g==="proto3"?H(ne,"proto3_optional",void 0,F+1):H(ne,"optional",void 0,F+1);break;case"message":j(ne,Re,F+1);break;case"enum":be(ne,Re);break;case"reserved":Y(ne.reserved||(ne.reserved=[]),!0);break;case"export":case"local":if(g<"2024")throw C(Re);switch(Re=o(),Re){case"message":j(ne,Re,F+1);break;case"enum":j(ne,Re,F+1);break;default:throw C(Re)}break;default:throw C(Re)}}),T.add(ne).add(ie),T===b&&(w.push(ne),w.push(ie))}function ce(T){l("<");var A=o();if(lp.mapKey[A]===void 0)throw C(A,"type");l(",");var P=o();if(!xt.test(P))throw C(P,"type");l(">");var F=o();if(F===null||!Mt.test(F))throw C(F,"name");l("=");var L=F;F=I(F);var J=new rp(F,O(o()),A,P);L!==F&&(J.protoName=L),M(J,function(ne){if(ne==="option")ee(J,ne),l(";");else throw C(ne)},function(){Gt(J)}),T.add(J)}function ve(T,A,P){if((A=o())===null||!Mt.test(A))throw C(A,"name");var F=new hf(I(A));M(F,function(J){J==="option"?(ee(F,J),l(";")):(s(J),H(F,"optional",void 0,P))}),T.add(F)}function be(T,A){if((A=o())===null||!Mt.test(A))throw C(A,"name");var P=new np(A),F=[];M(P,function(re){switch(re){case";":break;case"option":ee(P,re),l(";");break;case"reserved":Y(P.reserved||(P.reserved=[]),!0,bp,!0),P.reserved===void 0&&(P.reserved=[]);break;default:F.push(me(re))}});for(var L=0;L<F.length;++L)P.add(F[L].name,F[L].id,F[L].comment,F[L].options);T.add(P),T===b&&w.push(P)}function me(T){if(!Mt.test(T))throw C(T,"name");l("=");var A=O(o(),!0),P={options:void 0};return P.getOption=function(F){return this.options[F]},P.setOption=function(F,L){ap.prototype.setOption.call(P,F,L)},P.setParsedOption=function(){},M(P,function(L){if(L==="option")ee(P,L),l(";");else throw C(L)},function(){Gt(P)}),{name:T,id:A,comment:P.comment,options:P.parsedOptions||P.options}}function ee(T,A){var P,F,L=!0;for(A==="option"&&(A=o());A!=="=";){if(A===null)throw C(A,"end of input");if(A==="("){var J=o();l(")"),A="("+J+")"}if(L){if(L=!1,A.includes(".")&&!A.includes("(")){var re=A.split(".");P=re[0]+".",A=re[1];continue}P=A}else F=F?F+=A:A;A=o()}var ne=F?P.concat(F):P,ie=ue(T,ne);F=F&&F[0]==="."?F.slice(1):F,P=P&&P[P.length-1]==="."?P.slice(0,-1):P,ht(T,P,ie,F)}function ue(T,A,P){if(P===void 0&&(P=0),P>Ht.recursionLimit)throw Error("max depth exceeded");if(l("{",!0)){for(var F={};!l("}",!0);){de=o();var L;if(de===null)throw C(de,"end of input");if(de==="["){de=o();var J=de===null?-1:de.lastIndexOf("/");if(de===null||!xt.test(J<0?de:de.slice(J+1)))throw C(de,"name");L="["+de+"]",l("]")}else{if(!Mt.test(de))throw C(de,"name");L=de}var re;if(l(":",!0),a()==="{")re=ue(T,A+"."+L,P+1);else if(a()==="["){re=[];var ne,ie;if(l("[",!0)&&!l("]",!0)){do ie=a()==="{",ne=ie?ue(T,A+"."+L,P+1):G(!0),re.push(ne);while(l(",",!0));l("]"),typeof ne<"u"&&(ie||Se(T,A+"."+L,ne))}}else re=G(!0),Se(T,A+"."+L,re);var Fe=Object.prototype.hasOwnProperty.call(F,L)?F[L]:void 0;Fe&&(re=[].concat(Fe).concat(re)),L!=="__proto__"&&(F[L]=re),l(",",!0),l(";",!0)}return F}var Re=A==="default"&&T instanceof Yn&&mp.test(T.type)?_(o(),!gp.test(T.type)):G(!0);return Se(T,A,Re),Re}function Se(T,A,P){if(b===T&&/^features\./.test(A)){x[A]=P;return}A==="json_name"&&T instanceof Yn&&(T.jsonName=P),T.setOption&&T.setOption(A,P)}function ht(T,A,P,F){T.setParsedOption&&T.setParsedOption(A,P,F)}function Gt(T){if(l("[",!0)){do ee(T,"option");while(l(",",!0));l("]")}return T}function Oe(T,A,P){if(P===void 0&&(P=0),P>Ht.recursionLimit)throw Error("max depth exceeded");if((A=o())===null||!Mt.test(A))throw C(A,"service name");var F=new op(A);M(F,function(J){if(!S(F,J,P)&&J!==";")if(J==="rpc")at(F,J);else throw C(J)}),T.add(F),T===b&&w.push(F)}function at(T,A){var P=u(),F=A;if(!Mt.test(A=o()))throw C(A,"name");var L=A,J,re,ne,ie;if(l("("),l("stream",!0)&&(re=!0),!xt.test(A=o())||(J=A,l(")"),l("returns"),l("("),l("stream",!0)&&(ie=!0),!xt.test(A=o())))throw C(A);ne=A,l(")");var Fe=new sp(L,F,J,ne,re,ie);Fe.comment=P,M(Fe,function(kt){if(kt!==";")if(kt==="option")ee(Fe,kt),l(";");else throw C(kt)}),T.add(Fe)}function pt(T,A,P){if((A=o())===null||!xt.test(A))throw C(A,"reference");var F=A;M(null,function(J){switch(J){case"required":case"repeated":H(T,J,F,P+1);break;case"optional":g==="proto3"?H(T,"proto3_optional",F,P+1):H(T,"optional",F,P+1);break;default:if(g==="proto2"||!xt.test(J))throw C(J);s(J),H(T,"optional",F,P+1);break}})}for(var de;(de=o())!==null;)switch(de){case";":break;case"package":if(!f)throw C(de);y();break;case"import":N();break;case"syntax":if(!f)throw C(de);E();break;case"edition":if(!f)throw C(de);c();break;case"option":ee(b,de),l(";",!0);break;default:if(S(b,de,0)){f=!1;continue}throw C(de)}return $(),Kt.filename=null,{package:h,imports:m,weakImports:p,root:e}}});var vf=te((S0,yf)=>{"use strict";yf.exports=_t;var wp=/\/|\./;function _t(t,e){wp.test(t)||(t="google/protobuf/"+t+".proto",e={nested:{google:{nested:{protobuf:{nested:e}}}}}),_t[t]=e}_t("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var gf;_t("duration",{Duration:gf={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});_t("timestamp",{Timestamp:gf});_t("empty",{Empty:{fields:{}}});_t("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1,protoName:"null_value"},numberValue:{type:"double",id:2,protoName:"number_value"},stringValue:{type:"string",id:3,protoName:"string_value"},boolValue:{type:"bool",id:4,protoName:"bool_value"},structValue:{type:"Struct",id:5,protoName:"struct_value"},listValue:{type:"ListValue",id:6,protoName:"list_value"}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});_t("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});_t("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});_t.get=function(e){return _t[e]||null}});var wf=te((zt,bf)=>{"use strict";zt=bf.exports=af();zt.build="full";zt.tokenize=Rs();zt.parse=mf();zt.common=vf();zt.Root._configure(zt.Type,zt.parse,zt.common)});var xf=te((x0,Sf)=>{"use strict";Sf.exports=wf()});import{parentPort as Oa}from"node:worker_threads";import{existsSync as en,readFileSync as ag}from"node:fs";import{randomUUID as ed}from"node:crypto";import{isAbsolute as Ma,win32 as za}from"node:path";function Fa(t,e=!1){let i=String(t??"").trim().replaceAll("\\","/");if(e&&(!i||i==="."))return"";if(!i||Ma(i)||za.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 So(t){if(t==null)return null;if(t.version!==1)throw new Error("unsupported scriptSync version");let e=String(t.clientImportRoot||"").trim();if(!Ma(e)&&!za.isAbsolute(e))throw new Error("\u5B9E\u673A\u5BFC\u5165\u6839\u76EE\u5F55\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84");return{version:1,workspaceDir:Fa(t.workspaceDir,!0),clientImportRoot:e,clientSubdir:Fa(t.clientSubdir,!0)}}import{basename as wr,dirname as lg,isAbsolute as ug,join as td,resolve as id}from"node:path";var Cd=[[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 Da(t){return!Number.isSafeInteger(t)||!Cd.some(([e,i])=>t>=e&&t<=i)?null:t===10003004||t===10008001?128:256}var Ed=[[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 ti(t){return t==null||t===""?"StaticReference":typeof t=="string"?t:typeof t.Name=="string"?t.Name:"Unknown"}function $a(t,e){return ti(e)==="StaticReference"&&xo(t,e)}function xo(t,e){let i=ti(e);return i==="Prefab"?Da(t)!==null:i==="StaticReference"&&Number.isSafeInteger(t)&&t>100006&&Ed.some(([r,n])=>t>=r&&t<=n)}var on="7.1.0",Be=Object.freeze(["KEYBOARD","TOUCHSCREEN","CONTROLLER_CONSOLE","CONTROLLER_MOBILE"]),Te=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"}}),sn="pc-16-9",Ze=2,Ui=Object.freeze({KEYBOARD:"pc-16-9",TOUCHSCREEN:"mobile-16-9",CONTROLLER_CONSOLE:"pc-16-9",CONTROLLER_MOBILE:"mobile-16-9"}),Yi=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"}),an=Object.freeze(["server-container","container","textbox","cursor","reference","grid","image","button","textwindow","keyhint","animation","fullscreen"]),Ga=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}),kd=Object.freeze({100001:"rect",100002:"circle",100003:"triangle",100004:"fourstar",100005:"fivestar",100006:"ring"});function Xi(t,e){return ti(e)==="StaticReference"&&kd[t]||(xo(t,e)?"sprite":"missing")}var qa=50888,_r=Object.freeze({font:4294967295,bg:16777215,outline:858993459,image:4294967295});function Hi(t,e="$",i=new Set){if(t===void 0)throw new Error(`undefined at ${e}`);if(typeof t=="number"&&!Number.isFinite(t))throw new Error(`non-finite number at ${e}`);if(typeof t=="bigint"||typeof t=="function"||typeof t=="symbol")throw new Error(`non-JSON value at ${e}`);if(!(t===null||typeof t!="object")){if(i.has(t))throw new Error(`circular value at ${e}`);if(i.add(t),Array.isArray(t))t.forEach((r,n)=>Hi(r,`${e}[${n}]`,i));else for(let[r,n]of Object.entries(t))Hi(n,`${e}.${r}`,i);i.delete(t)}}function oe(t){return Hi(t),JSON.parse(JSON.stringify(t))}function Ba(t,e="$"){Hi(t,e)}function Va(t){return Te[t]||Te[sn]}function Ir(t,e=0,i=0){return!t||typeof t!="object"?{x:e,y:i}:{x:Number(t.x??e),y:Number(t.y??i)}}function Ad(t){return!t||typeof t!="object"?{x:1,y:1,z:1}:{x:Number(t.x??1),y:Number(t.y??1),z:Number(t.z??1)}}function Od(t){return!t||typeof t!="object"?{x:0,y:0,z:0}:{x:Number(t.x??0),y:Number(t.y??0),z:Number(t.z??0)}}function ln({layout:t="center",size:e=[100,40],offset:i=[0,0]}={}){return t==="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(e[0]??0),y:Number(e[1]??0)},pivot:{x:.5,y:.5}}}function Ot(t){let e=t||ln();return{scale:Ad(e.scale),rotation:Od(e.rotation),anchorMin:Ir(e.anchorMin??e.anchor_min,.5,.5),anchorMax:Ir(e.anchorMax??e.anchor_max,.5,.5),offset:Ir(e.offset,0,0),size:Ir(e.size,0,0),pivot:Ir(e.pivot,.5,.5)}}function Le(t,e=0){let i=Number(t);return Number.isFinite(i)?i:e}function Vt(t,e){let i=t.width,r=t.height,n=t.left,o=t.bottom,s=e.anchorMin||{x:e.anchorMinX,y:e.anchorMinY},a=e.anchorMax||{x:e.anchorMaxX,y:e.anchorMaxY},l=e.offset||{x:e.anchoredPositionX,y:e.anchoredPositionY},u=e.size||{x:e.sizeDeltaX,y:e.sizeDeltaY},f=e.pivot||{x:e.pivotX,y:e.pivotY},h=Le(s?.x,.5)*i,m=Le(s?.y,.5)*r,p=Le(a?.x,.5)*i,g=Le(a?.y,.5)*r,b=Le(u?.x),w=Le(u?.y),x=Le(f?.x,.5),I=Le(f?.y,.5),$=p-h+b,C=g-m+w,D=n+h+Le(l?.x)-b*x,G=o+m+Le(l?.y)-w*I;return{left:D,bottom:G,width:$,height:C,right:D+$,top:G+C,centerX:D+$/2,centerY:G+C/2}}function Ki(){return{a:1,b:0,c:0,d:1,tx:0,ty:0}}function Td(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,tx:t.a*e.tx+t.c*e.ty+t.tx,ty:t.b*e.tx+t.d*e.ty+t.ty}}function gt(t,e,i){return{x:t.a*e+t.c*i+t.tx,y:t.b*e+t.d*i+t.ty}}function Wi(t){let e=t.a*t.d-t.b*t.c;return!Number.isFinite(e)||Math.abs(e)<1e-8?null:{a:t.d/e,b:-t.b/e,c:-t.c/e,d:t.a/e,tx:(t.c*t.ty-t.d*t.tx)/e,ty:(t.b*t.tx-t.a*t.ty)/e}}function _o(t,e){let i=e.rotation||{x:e.localRotationX,y:e.localRotationY,z:e.localRotationZ},r=e.scale||{x:e.localScaleX,y:e.localScaleY},n=e.pivot||{x:e.pivotX,y:e.pivotY},o=Le(i?.z)*Math.PI/180,s=Math.cos(o),a=Math.sin(o),l=Le(i?.x)*Math.PI/180,u=Le(i?.y)*Math.PI/180,f=Math.cos(l),h=Math.sin(l),m=Math.cos(u),p=Math.sin(u),g=Y=>Math.abs(Y)<1e-12?0:Y,b=Le(r?.x,1),w=Le(r?.y,1),x=t.left+t.width*Le(n?.x,.5),I=t.bottom+t.height*Le(n?.y,.5),$=g(m*s+p*h*a)*b,C=g(f*a)*b,D=g(-m*a+p*h*s)*w,G=g(f*s)*w;return{a:$,b:C,c:D,d:G,tx:x-$*x-D*I,ty:I-C*x-G*I}}function Cr(t,e,i){return Td(t||Ki(),_o(e,i))}function La(t,e){let i=gt(e,t.centerX,t.centerY),r=Math.abs(t.width*Math.hypot(e.a,e.b)),n=Math.abs(t.height*Math.hypot(e.c,e.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(e.b,e.a)*180/Math.PI}}function Qe(t){let e=typeof t=="string"?Va(t):t;return{left:0,bottom:0,width:e.width,height:e.height,right:e.width,top:e.height,centerX:e.width/2,centerY:e.height/2}}function Io(t){return{posX:t.centerX,posY:t.centerY,width:t.width,height:t.height}}function _i(t,e,i){let r=Ot(e),n=t.width,o=t.height,s=r.anchorMin.x*n,a=r.anchorMin.y*o,l=r.anchorMax.x*n,u=r.anchorMax.y*o,f=Number(i.width),h=Number(i.height),m=Number(i.posX),p=Number(i.posY),g=m-f/2,b=p-h/2;return r.size={x:f-(l-s),y:h-(u-a)},r.offset={x:g-t.left-s+r.size.x*r.pivot.x,y:b-t.bottom-a+r.size.y*r.pivot.y},r}function ja(t,e){let i=Ot(t),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]]}[e];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 Ua(t){let e=Ot(t),i=(r,n)=>Math.abs(r-n)<1e-4;if(i(e.anchorMin.x,0)&&i(e.anchorMin.y,0)&&i(e.anchorMax.x,1)&&i(e.anchorMax.y,1))return"stretch";if(i(e.anchorMin.x,e.anchorMax.x)&&i(e.anchorMin.y,e.anchorMax.y)){let r=e.anchorMin.x,n=e.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 s of o)if(i(r,s[0])&&i(n,s[1]))return s[2]}return"custom"}function Ii(t){return Va(t).platform}function Ya(t){let e={};for(let i of Be)e[i]=t(i);return e}var Rd={scale:["x","y","z"],rotation:["x","y","z"],anchorMin:["x","y"],anchorMax:["x","y"],offset:["x","y"],size:["x","y"],pivot:["x","y"]};function Xa(t,e){for(let[i,r]of Object.entries(Rd))for(let n of r)if(!Number.isFinite(t?.[i]?.[n]))throw new Error(`${e}.${i}.${n} must be a finite number`)}function ii(t,e="transformByPlatform"){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e}: \u9700\u8981\u5B8C\u6574\u7684\u56DB\u5E73\u53F0\u5E03\u5C40`);for(let i of Object.keys(t))if(!Be.includes(i))throw new Error(`${e}: unknown platform ${i}`);for(let i of Be)Xa(t[i],`${e}.${i}`)}function Ci(t){if(Object.hasOwn(t,"transformByCanvas"))throw new Error(`${t.name||t.id||"\u63A7\u4EF6"}: \u4E0D\u518D\u652F\u6301 transformByCanvas\uFF1B\u8BF7\u4F7F\u7528\u56DB\u5E73\u53F0 transformByPlatform \u5E03\u5C40`);ii(t.transformByPlatform,`${t.name||t.id||"\u63A7\u4EF6"}.transformByPlatform`)}function Ei(t,e){if(!Be.includes(e))throw new Error(`unknown platform ${e}`);return Xa(t?.[e],`transformByPlatform.${e}`),Ot(t[e])}var Nd=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"}]),Pd=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 Ha(t){return[...Nd,...Pd[t]||[]]}function Ka(t,e){return Ha(t).find(i=>i.key===e)||null}function Co(t,e){if(!t)throw new Error("unknown raw GIA field");if(t.type==="string")return String(e??"");let i=Number(e);if(!Number.isFinite(i))throw new Error(`${t.wire} must be a finite number`);return Math.trunc(i)}function Wa(t,e={}){let i={};for(let r of Ha(t)){let n=Object.hasOwn(e||{},r.key)?e[r.key]:r.defaultValue;i[r.key]=Co(r,n)}if(t==="reference")for(let r of["templateRefSlotBase64","templateRefOuterBase64"]){if(!Object.hasOwn(e||{},r))continue;let n=e[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 lt(t){let e=Number(t);return Number.isSafeInteger(e)&&e>=1073741824&&e<=1077936127}function Lt(t){let e=Number(t);return Number.isSafeInteger(e)&&e>0&&e<=2147483647}function Eo(t,e){if(Lt(t)&&!lt(t))throw new Error(`${e||"\u8D44\u4EA7"}: \u7D22\u5F15 ${t} \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 ko(t,e){if(t){e(t);for(let i of t.children||[])ko(i,e)}}function Ji(t,e=new Set,{skipServerContainer:i=!1}={}){return ko(t,r=>{i&&r.kind==="server-container"||lt(r.guid)&&e.add(Number(r.guid))}),e}function ri(t,e=1073741850){let i=Number.isSafeInteger(e)&&e>0?e:1073741850;i<1073741850&&(i=1073741850);for(let r of t)lt(r)&&r>=i&&(i=Number(r)+1);for(;t.has(i);)i+=1;if(i>1077936127)throw new Error("GUID space exhausted");return i}function Ja(t,e=new Set,{skipServerContainer:i=!1}={}){let r=[];ko(t,n=>{if(i&&n.kind==="server-container")return;let o=Number(n.guid);if(lt(o)&&!e.has(o)){e.add(o),n.guid=o;return}r.push(n)});for(let n of r){let o=ri(e);n.guid=o,e.add(o)}return e}function ut(t){return Number.isSafeInteger(t)&&t>0&&t<=2147483647}function jt(t,{warnings:e=[]}={}){if(t.meta?.assetType!=="client-control-template")return;if(t.meta.giaAssetIndexSchemaVersion>1)throw new Error(`\u4E0D\u652F\u6301\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u7248\u672C ${t.meta.giaAssetIndexSchemaVersion}`);let i=[],r=g=>{g.kind!=="server-container"&&i.push(g);for(let b of g.children||[])r(b)};r(t.root);let n=new Map,o=new Map;for(let g of i){if(!ut(g.giaInfoIndex))continue;let b=n.get(g.giaInfoIndex)||[];b.push(g),n.set(g.giaInfoIndex,b);let w=o.get(g.kind)||new Set;w.add(g.giaInfoIndex),o.set(g.kind,w)}let s=(t.root.children||[]).filter(g=>g.kind!=="server-container"),a=new Set(s),l=s.some((g,b)=>ut(g.giaInfoIndex)&&s.slice(0,b).some(w=>w.giaInfoIndex===g.giaInfoIndex)),u=!t.meta.giaAssetIndexSchemaVersion&&l&&i.every(g=>g.giaInfoIndexSource!=="authoring")&&[...o.values()].every(g=>g.size===1)&&[...n.values()].every(g=>g.every(b=>b.kind===g[0].kind)),f=new Set;if(u)for(let g of n.values()){let b=g.find(w=>a.has(w))||g[0];for(let w of g)w!==b&&f.add(w)}let h=new Map,m=Number.isSafeInteger(t.meta.giaNextAssetIndex)&&t.meta.giaNextAssetIndex>=2?t.meta.giaNextAssetIndex:2;for(let g of i){if(!ut(g.giaInfoIndex)||(m=Math.max(m,g.giaInfoIndex+1),f.has(g)))continue;let b=h.get(g.giaInfoIndex);if(b&&(b.giaInfoIndexSource==="authoring"||g.giaInfoIndexSource==="authoring"))throw new Error(`\u65B0\u5EFA\u8D44\u4EA7\u7F16\u53F7 ${g.giaInfoIndex} \u91CD\u590D\uFF1A${b.name} / ${g.name}`);h.set(g.giaInfoIndex,g)}u&&(m=Math.max(m,13));let p=u?[...s,...i.filter(g=>!a.has(g))].filter(g=>f.has(g)||!ut(g.giaInfoIndex)):i.filter(g=>!ut(g.giaInfoIndex));if(p.length&&m+p.length-1>2147483647)throw new Error("\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u7A7A\u95F4\u5DF2\u8017\u5C3D");for(let g of p)g.giaInfoIndex=m++,g.giaInfoIndexSource="authoring";t.meta.giaNextAssetIndex=m,t.meta.giaAssetIndexSchemaVersion=1,f.size&&e.push(`\u65E7\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7\u81EA\u52A8\u8FC1\u79FB\uFF1A\u4FEE\u590D ${f.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 Ao=1;function Oo(t="n"){let e=`${t}${Ao}`;return Ao+=1,e}function un(t=1){Ao=t}function To(t,{isRootContainer:e=!1}={}){if(t==="server-container"||t==="fullscreen"||t==="container"&&e)return ln({layout:"stretch"});let i=Ga[t]||[80,80];return ln({layout:"center",size:i})}function Fd(t,e){return Ya(()=>To(t,e))}function Md(t){ii(t);let e={};for(let i of Be)e[i]=Ei(t,i);return e}function we(t,e={}){if(!Yi[t])throw new Error(`unknown kind: ${t}`);Object.hasOwn(e,"transformByCanvas")&&Ci(e);let i=e.isRootContainer===!0,r=e.id||Oo(t==="server-container"?"sc":"n"),n=Object.hasOwn(e,"transformByPlatform")?Md(e.transformByPlatform):Fd(t,{isRootContainer:i}),o={id:r,kind:t,name:e.name||Yi[t],guid:e.guid??0,giaRelatedGuids:Array.isArray(e.giaRelatedGuids)?e.giaRelatedGuids.filter(s=>Number.isSafeInteger(Number(s))&&Number(s)>0).map(Number):[],...ut(Number(e.giaInfoIndex))?{giaInfoIndex:Number(e.giaInfoIndex),giaInfoIndexSource:e.giaInfoIndexSource==="authoring"?"authoring":"imported"}:{},active:e.active!==!1,visible:e.visible!==!1,canControllerFocus:e.canControllerFocus??e.giaRaw?.footerField505===1,syncAllDevices:e.syncAllDevices!==!1,giaRaw:Wa(t,e.giaRaw),transformByPlatform:n,children:[],scriptMappingIds:Array.isArray(e.scriptMappingIds)?e.scriptMappingIds.filter(s=>Number.isSafeInteger(Number(s))&&Number(s)>0).map(Number):[]};if(t==="container"&&(o.isolateNavigation=e.isolateNavigation===!0,o.disableKeyEventPassthrough=e.disableKeyEventPassthrough===!0,o.disableCursorEventPassthrough=e.disableCursorEventPassthrough===!0,o.showCursor=e.showCursor===!0),(t==="textbox"||t==="textwindow")&&(o.fontSize=e.fontSize??20,o.adaptiveFontSize=e.adaptiveFontSize===!0,o.minimumFontSize=e.minimumFontSize??20,o.fontColor=e.fontColor??_r.font,o.bgColor=e.bgColor??_r.bg,o.enableOutline=e.enableOutline!==!1,o.outlineColor=e.outlineColor??_r.outline,o.horizontalAlignment=e.horizontalAlignment||"Left",o.verticalAlignment=e.verticalAlignment||"Top",Number.isInteger(e.giaRaw?.textVerticalAlign)&&![0,1,2].includes(e.giaRaw.textVerticalAlign)&&(o.giaRaw.textVerticalAlign=e.giaRaw.textVerticalAlign),o.text=e.text??"",Object.hasOwn(e.giaRaw||{},"textAlign")||(o.giaRaw.textAlign={Left:0,Middle:1,Right:2}[o.horizontalAlignment]??o.giaRaw.textAlign),t==="textwindow"&&(o.interactable=e.interactable!==!1,o.showScrollBar=e.showScrollBar!==!1)),t==="image"&&(o.imageSource=e.imageSource||"StaticReference",o.imageType=["Basic","Stretch"].includes(e.imageType)?e.imageType:null,o.imageId=e.imageId??100001,o.imageColor=e.imageColor??_r.image,o.enableMask=e.enableMask===!0,o.enableSoftEdge=e.enableSoftEdge===!0,o.softEdgeMode=e.softEdgeMode||"Percentage",o.softEdgeWidthX=e.softEdgeWidthX??8,o.softEdgeWidthY=e.softEdgeWidthY??8,o.horizontalSoftRange=e.horizontalSoftRange??85,o.verticalSoftRange=e.verticalSoftRange??85,o.enableFill=e.enableFill===!0,o.fillType=e.fillType||"Horizontal",o.fillHorizontalType=e.fillHorizontalType||"Left",o.fillVerticalType=e.fillVerticalType||"Bottom",o.fillRadial90Type=e.fillRadial90Type||"BottomLeft",o.fillRadialType=e.fillRadialType||"Bottom",o.fillAmount=e.fillAmount??1,o.reverseMaskArea=e.reverseMaskArea===!0||e.reverseMask===!0,Object.hasOwn(e.giaRaw||{},"imageFillType")||(o.giaRaw.imageFillType={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[o.fillType]??o.giaRaw.imageFillType)),t==="button"&&(o.raycastTarget=e.raycastTarget!==!1,o.interactable=e.interactable!==!1,o.clickAudioId=e.clickAudioId??qa,o.unavailableChildId=e.unavailableChildId??null,o.hoverChildId=e.hoverChildId??null,o.pressedChildId=e.pressedChildId??null,o.selectedChildId=e.selectedChildId??null),t==="cursor"&&(o.raycastTarget=e.raycastTarget??e.giaRaw?.cursorField501!==0),t==="reference"&&(o.referencedPrefabId=e.referencedPrefabId??e.giaRaw?.templateRefSlot??null,Object.hasOwn(e.giaRaw||{},"templateRefSlot")||(o.giaRaw.templateRefSlot=String(o.referencedPrefabId??""))),t==="grid"&&(o.itemPrefabId=e.itemPrefabId??null,o.raycastTarget=e.raycastTarget!==!1,o.interactable=e.interactable!==!1,o.showScrollBar=e.showScrollBar!==!1,o.scrollDirection=e.scrollDirection||"Vertical",o.layoutConstraint=e.layoutConstraint||"AutoWrap",o.layoutConstraintFixedCount=e.layoutConstraintFixedCount??null,o.cellSizeX=e.cellSizeX??50,o.cellSizeY=e.cellSizeY??50,o.spacingX=e.spacingX??8,o.spacingY=e.spacingY??8,o.padding1X=e.padding1X??20,o.padding1Y=e.padding1Y??20,o.padding2X=e.padding2X??20,o.padding2Y=e.padding2Y??20,o.previewCount=e.previewCount??e.giaRaw?.gridField511??5,Object.hasOwn(e.giaRaw||{},"gridField511")||(o.giaRaw.gridField511=Math.trunc(o.previewCount))),t==="keyhint"&&(o.keyboardKeyCode=e.keyboardKeyCode??e.giaRaw?.keyHintField502??null,o.controllerKeyCode=e.controllerKeyCode??e.giaRaw?.keyHintField501??null,Object.hasOwn(e.giaRaw||{},"keyHintField502")||(o.giaRaw.keyHintField502=Math.trunc(o.keyboardKeyCode??1)),Object.hasOwn(e.giaRaw||{},"keyHintField501")||(o.giaRaw.keyHintField501=Math.trunc(o.controllerKeyCode??1))),t==="animation"||t==="fullscreen"){let s=t==="animation"?e.giaRaw?.effectSlot:e.giaRaw?.fullscreenEffectSlot;o.animationId=e.animationId??s??null,o.playSoundEffect=e.playSoundEffect??null,t==="animation"&&(o.layer=e.layer??null);let a=t==="animation"?"effectSlot":"fullscreenEffectSlot";Object.hasOwn(e.giaRaw||{},a)||(o.giaRaw[a]=String(o.animationId??""))}if(e.children)for(let s of e.children)o.children.push(s);return o}function ki(){un(1);let t=we("server-container",{id:"sc1",name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668"}),e=we("container",{id:"n1",name:"\u5BB9\u5668\u8282\u70B9",isRootContainer:!0}),i=we("textbox",{id:"n2",name:"\u6587\u672C\u6846",text:"\u6587\u672C"}),r=we("cursor",{id:"n3",name:"\u5149\u6807\u68C0\u6D4B\u533A\u57DF"}),n=we("reference",{id:"n4",name:"\u6A21\u677F\u5F15\u7528\u63A7\u4EF6"}),o=we("grid",{id:"n5",name:"\u7F51\u683C\u89C6\u7A97"}),s=we("button",{id:"n6",name:"\u9884\u8BBE\u6309\u94AE"}),a=we("textwindow",{id:"n7",name:"\u6587\u672C\u89C6\u7A97"}),l=we("keyhint",{id:"n8",name:"\u6309\u952E\u63D0\u793A"}),u=we("image",{id:"n9",name:"\u56FE\u7247",imageId:100005}),f=we("animation",{id:"n10",name:"\u754C\u9762\u52A8\u6548"}),h=we("fullscreen",{id:"n11",name:"\u5168\u5C4F\u52A8\u6548"}),m=(p,g,b)=>{for(let w of Object.values(p.transformByPlatform))w.offset={x:g,y:b}};return m(i,-300,250),m(r,-300,140),m(n,-300,30),m(o,-300,-100),m(s,0,0),m(a,300,250),m(l,300,140),m(u,300,30),m(f,300,-100),e.children.push(i,r,n,o,s,a,l,u,f,h),t.children.push(e),un(12),Ja(t),{version:1,layoutSchemaVersion:Ze,meta:{name:"\u672A\u547D\u540D\u754C\u9762\u63A7\u4EF6\u7EC4",assetType:"server-control-template",sourceFormat:"authoring",sourceFile:""},canvasId:"pc-16-9",selectedId:"n2",root:t}}function Zi(){un(1);let t=we("server-container",{id:"sc1",name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"}),e=we("container",{id:"n1",guid:1073742100,name:"Lua\u5B9E\u4F8B\u5316\u9762\u677F"}),i=we("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=we("image",{id:"n3",guid:1073742102,name:"\u6A21\u677F\u56FE\u6807",imageId:100005}),n=we("button",{id:"n4",guid:1073742103,name:"\u786E\u8BA4\u6309\u94AE"}),o=we("textbox",{id:"n5",guid:1073742104,name:"\u6309\u94AE\u6587\u5B57",text:"\u786E\u8BA4",horizontalAlignment:"Middle",verticalAlignment:"Top"}),s=(u,f,h)=>{for(let m of Object.values(u.transformByPlatform))m.offset={x:f,y:h}};((u,f,h)=>{for(let m of Object.values(u.transformByPlatform))m.size={x:f,y:h}})(e,520,320),s(i,0,110),s(r,0,0),s(n,0,-110),n.children.push(o),e.children.push(i,r,n),t.children.push(e),un(6);let l={version:1,layoutSchemaVersion:Ze,meta:{name:"Lua\u5B9E\u4F8B\u5316\u9762\u677F",assetType:"client-control-template",sourceFormat:"authoring",sourceFile:"",gameVersion:on,giaOwnerUid:114514,giaFileId:1073741829,giaFileName:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868.gia"},canvasId:"pc-16-9",selectedId:"n1",root:t};return jt(l),l}function ke(t,e,i=null){e(t,i);for(let r of t.children||[])ke(r,e,t)}function je(t,e){let i=null;return ke(t,r=>{r.id===e&&(i=r)}),i}function Ro(t,e="n"){let i=Oo(e);for(;je(t,i);)i=Oo(e);return i}function ni(t,e){let i=null;return ke(t,(r,n)=>{r.id===e&&(i=n)}),i}function No(t){let e=t.root||t;return e.kind==="container"?e:(e.children||[]).find(i=>i.kind==="container")||(e.children||[])[0]||e}function Er(t){if(t.meta?.assetType!=="client-control-template")return No(t);let e=je(t.root,t.selectedId);if(!e||e.kind==="server-container")return t.root.children?.[0]||t.root;let i=ni(t.root,e.id);for(;i&&i.kind!=="server-container";)e=i,i=ni(t.root,e.id);return e}function Po(t){Ci(t);let e={id:t.id,name:t.name,guid:t.guid,giaRelatedGuids:t.giaRelatedGuids,giaInfoIndex:t.giaInfoIndex,giaInfoIndexSource:t.giaInfoIndexSource,scriptMappingIds:t.scriptMappingIds,giaRaw:t.giaRaw,active:t.active,visible:t.visible,canControllerFocus:t.canControllerFocus,syncAllDevices:t.syncAllDevices,transformByPlatform:t.transformByPlatform};t.kind==="container"&&(e.isolateNavigation=t.isolateNavigation,e.disableKeyEventPassthrough=t.disableKeyEventPassthrough,e.disableCursorEventPassthrough=t.disableCursorEventPassthrough,e.showCursor=t.showCursor),(t.kind==="textbox"||t.kind==="textwindow")&&(e.fontSize=t.fontSize,e.adaptiveFontSize=t.adaptiveFontSize,e.minimumFontSize=t.minimumFontSize,e.fontColor=t.fontColor,e.bgColor=t.bgColor,e.enableOutline=t.enableOutline,e.outlineColor=t.outlineColor,e.horizontalAlignment=t.horizontalAlignment,e.verticalAlignment=t.verticalAlignment,e.text=t.text??"",t.kind==="textwindow"&&(e.interactable=t.interactable,e.showScrollBar=t.showScrollBar)),t.kind==="image"&&(e.imageSource=t.imageSource,e.imageType=t.imageType,e.imageId=t.imageId,e.imageColor=t.imageColor,e.enableMask=t.enableMask,e.enableSoftEdge=t.enableSoftEdge,e.softEdgeMode=t.softEdgeMode,e.softEdgeWidthX=t.softEdgeWidthX,e.softEdgeWidthY=t.softEdgeWidthY,e.horizontalSoftRange=t.horizontalSoftRange,e.verticalSoftRange=t.verticalSoftRange,e.enableFill=t.enableFill,e.fillType=t.fillType,e.fillHorizontalType=t.fillHorizontalType,e.fillVerticalType=t.fillVerticalType,e.fillRadial90Type=t.fillRadial90Type,e.fillRadialType=t.fillRadialType,e.fillAmount=t.fillAmount,e.reverseMaskArea=t.reverseMaskArea??t.reverseMask),t.kind==="button"&&(e.raycastTarget=t.raycastTarget,e.interactable=t.interactable,e.clickAudioId=t.clickAudioId,e.unavailableChildId=t.unavailableChildId??null,e.hoverChildId=t.hoverChildId??null,e.pressedChildId=t.pressedChildId??null,e.selectedChildId=t.selectedChildId??null),t.kind==="cursor"&&(e.raycastTarget=t.raycastTarget),t.kind==="reference"&&(e.referencedPrefabId=t.referencedPrefabId??null),t.kind==="grid"&&(e.itemPrefabId=t.itemPrefabId??null,e.raycastTarget=t.raycastTarget,e.interactable=t.interactable,e.showScrollBar=t.showScrollBar,e.scrollDirection=t.scrollDirection,e.layoutConstraint=t.layoutConstraint,e.layoutConstraintFixedCount=t.layoutConstraintFixedCount??null,e.cellSizeX=t.cellSizeX,e.cellSizeY=t.cellSizeY,e.spacingX=t.spacingX,e.spacingY=t.spacingY,e.padding1X=t.padding1X,e.padding1Y=t.padding1Y,e.padding2X=t.padding2X,e.padding2Y=t.padding2Y,e.previewCount=t.previewCount),t.kind==="keyhint"&&(e.keyboardKeyCode=t.keyboardKeyCode??null,e.controllerKeyCode=t.controllerKeyCode??null),(t.kind==="animation"||t.kind==="fullscreen")&&(e.animationId=t.animationId??null,e.playSoundEffect=t.playSoundEffect??null,t.kind==="animation"&&(e.layer=t.layer??null)),e.isRootContainer=t.kind==="container"&&zd(t.transformByPlatform);let i=we(t.kind,e);return i.children=(t.children||[]).map(r=>Po(r)),i}function zd(t){let e=t&&(t.KEYBOARD||Object.values(t)[0]);return e?Math.abs(e.anchorMin?.x??.5)<1e-4&&Math.abs(e.anchorMin?.y??.5)<1e-4&&Math.abs((e.anchorMax?.x??.5)-1)<1e-4&&Math.abs((e.anchorMax?.y??.5)-1)<1e-4:!1}function Za(t,e,i={}){if(t.kind==="server-container"&&e!=="container")throw new Error("server container only accepts container nodes");let r=we(e,i);return t.children.push(r),r}function Qa(t,e){if(t.id===e)throw new Error("cannot remove root");let i=ni(t,e);if(!i)return!1;let r=i.children.findIndex(n=>n.id===e);return r<0?!1:(i.children.splice(r,1),!0)}var el=1e-4;function Dd(t,e){return Math.abs(t.anchorMax[e]-t.anchorMin[e])>el&&Math.abs(t.size[e])<=el}function $d(t,e,i){if(!(e.width>0)||!(e.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=Vt(e,t),n=(r.centerX-e.left)/e.width,o=(r.centerY-e.bottom)/e.height,s=_i(i,t,{posX:i.left+n*i.width,posY:i.bottom+o*i.height,width:r.width,height:r.height});for(let a of["x","y"])Dd(t,a)&&(s.offset[a]=t.offset[a],s.size[a]=t.size[a]);return s}function tl({transformByPlatform:t,source:e,canvasId:i,syncAllDevices:r,sourceParentBox:n=Qe(i),targetParentBoxByPlatform:o={}}){ii(t);let s=Ii(i),a={};for(let l of Be)l===s?a[l]=Ot(e):r!==!1?a[l]=$d(e,n,o[l]||Qe(Ui[l])):a[l]=Ei(t,l);return ii(a),a}function oi(t,e){return Ei(t,Ii(e))}import{createCanvas as eh}from"@napi-rs/canvas";import{existsSync as Vd,openSync as Ld,closeSync as jd,fstatSync as Ud,readFileSync as Yd}from"node:fs";import{extname as Xd,isAbsolute as Hd}from"node:path";import{createHash as Kd}from"node:crypto";import{workerData as dn}from"node:worker_threads";import{GlobalFonts as al}from"@napi-rs/canvas";var il='"Microsoft YaHei UI","Microsoft YaHei","HarmonyOS Sans SC","Noto Sans CJK SC",sans-serif';var Fo=t=>`QxqyLocal_${t}`,rl=t=>t?`"${Fo(t)}",${il}`:il;import{existsSync as Gd,mkdirSync as iy,readFileSync as qd,renameSync as ry,rmSync as ny,writeFileSync as oy}from"node:fs";import{homedir as Mo}from"node:os";import{dirname as ly,join as fn,win32 as cn}from"node:path";function nl(t=process.platform,e=process.env){if(t!=="win32")return[];let i=e.SystemDrive||"C:",r=e.ProgramFiles||`${i}\\Program Files`,n="YuanShen_Data\\StreamingAssets\\MiHoYoSDKRes\\HttpServerResources\\font\\zh-cn.ttf";return[...new Set([cn.join(r,"Genshin Impact","Genshin Impact Game",n),cn.join(i+"\\","Mihoyo","Genshin Impact","Genshin Impact Game",n),cn.join(r,"HoYoPlay","games","Genshin Impact game",n),cn.join(r,"miHoYo Launcher","games","Genshin Impact Game",n)])]}function Bd(){if(process.env.QXQY_FONT_CONFIG_PATH)return process.env.QXQY_FONT_CONFIG_PATH;let t=process.platform==="win32"?process.env.APPDATA||fn(Mo(),"AppData","Roaming"):process.platform==="darwin"?fn(Mo(),"Library","Application Support"):process.env.XDG_CONFIG_HOME||fn(Mo(),".config");return fn(t,"beyond-simulator","font.json")}function ol(t){if(!t||!["auto","custom","system"].includes(t.mode))throw new Error("\u8BF7\u9009\u62E9\u81EA\u52A8\u67E5\u627E\u3001\u6307\u5B9A\u6587\u4EF6\u6216\u7CFB\u7EDF\u5B57\u4F53");let e=t.scope===void 0?"all":t.scope;if(!["game","all"].includes(e))throw new Error("\u8BF7\u9009\u62E9\u5B57\u4F53\u5E94\u7528\u8303\u56F4");let i=typeof t.path=="string"?t.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)),t.mode==="custom"&&!i)throw new Error("\u8BF7\u586B\u5199\u5B57\u4F53\u6587\u4EF6\u7684\u7EDD\u5BF9\u8DEF\u5F84");return{mode:t.mode,path:t.mode==="custom"?i:"",scope:e}}function sl(t=Bd()){if(!Gd(t))return{mode:"auto",path:"",scope:"all"};try{return ol(JSON.parse(qd(t,"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 cl(t){let e=Buffer.from(t),i=e.subarray(0,4).toString("hex");if(e.length<12||e.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 r=Kd("sha256").update(e).digest("hex"),n=Fo(r);try{if(!al.has(n)&&!al.register(e,n))throw new Error("invalid font")}catch{throw new Error("QXQY_FONT_PATH font could not be registered")}return{id:r,data:e,type:i==="4f54544f"?"font/otf":"font/ttf"}}function zo(t){if(!t)return null;if(!Hd(t)||![".ttf",".otf"].includes(Xd(t).toLowerCase()))throw new Error("QXQY_FONT_PATH must be an absolute path to a TTF or OTF font");let e,i;try{e=Ld(t,"r");let r=Ud(e);if(!r.isFile()||r.size<12||r.size>33554432)throw new Error("invalid size");i=Yd(e)}catch{throw new Error("QXQY_FONT_PATH must point to a readable font file of at most 32 MiB")}finally{e!==void 0&&jd(e)}return cl(i)}var ll=!1,hn=null,kr={path:"",source:"system",scope:"all"},pn=null,ul="";function Wd(t){if(t.mode==="custom")return{font:zo(t.path),path:t.path,source:"custom"};if(t.mode==="auto"){let e;for(let i of nl())if(Vd(i))try{return{font:zo(i),path:i,source:"auto"}}catch(r){e=r}if(e)throw e}return{font:null,path:"",source:"system"}}function Jd(){if(!ll){if(dn&&Object.hasOwn(dn,"localFont"))hn=dn.localFont?cl(dn.localFont):null;else{try{pn=sl()}catch(t){ul=t.message}if(kr.scope=pn?.scope||"all",process.env.QXQY_FONT_PATH)hn=zo(process.env.QXQY_FONT_PATH),kr={...kr,path:process.env.QXQY_FONT_PATH,source:"environment"};else if(pn)try{let t=Wd(pn);hn=t.font,kr={...kr,path:t.path,source:t.source}}catch(t){ul=t.message}}ll=!0}return hn}var dl=()=>rl(Jd()?.id);var Do=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 Zd(t){let e=Object.hasOwn(Do,t.toLowerCase())?Do[t.toLowerCase()]:t.slice(1);return!Object.hasOwn(Do,t.toLowerCase())&&!/^#[\da-f]{6}([\da-f]{2})?$/i.test(t)?null:(parseInt(e.slice(6)||"ff",16)<<24|parseInt(e.slice(0,6),16))>>>0}function Qd(t){let e=/^<\/(b|i|color|size)>$/i.exec(t);if(e)return{name:e[1].toLowerCase(),close:!0};let i=/^<(b|i)>$/i.exec(t);if(i)return{name:i[1].toLowerCase(),value:!0};let r=/^<(color|size)=(?:"([^"\s<>]+)"|'([^'\s<>]+)'|([^\s'"<>]+))>$/i.exec(t);if(!r)return null;let n=r[1].toLowerCase(),o=r[2]??r[3]??r[4];if(n==="color"){let a=Zd(o);return a===null?null:{name:n,value:a}}let s=Number(o);return/^\d+$/.test(o)&&Number.isSafeInteger(s)&&s>0?{name:n,value:s}:null}function hl(t){let e=String(t??"").replace(/\r\n?/g,`
|
|
12
|
+
`),i=[],r=[],n=0;for(let l of e.matchAll(/<[^<>\r\n]*>/g)){l.index>n&&i.push({text:e.slice(n,l.index)});let u={text:l[0],tag:Qd(l[0]),paired:!1};i.push(u),n=l.index+l[0].length,u.tag&&(u.tag.close?r.at(-1)?.tag.name===u.tag.name?r.pop().paired=u.paired=!0:r.length=0:r.push(u))}n<e.length&&i.push({text:e.slice(n)});let o=[],s=[{bold:!1,italic:!1,size:null,color:null}],a=!1;for(let l of i)if(l.paired)if(a=!0,l.tag.close)s.pop();else{let u={b:"bold",i:"italic",size:"size",color:"color"}[l.tag.name];s.push({...s.at(-1),[u]:l.tag.value})}else if(l.text){let u=s.at(-1),f=o.at(-1);f&&["bold","italic","size","color"].every(h=>f[h]===u[h])?f.text+=l.text:o.push({text:l.text,...u})}return{rich:a,text:o.map(l=>l.text).join(""),runs:o}}function pl(t,e){return`${t.italic?"italic ":""}${t.bold?"bold ":""}${t.fontSize}px ${e}`}var Ai=eh(1,1).getContext("2d"),ml=new WeakMap,gl=(t,e)=>Math.max(1,Math.trunc(Number.isFinite(Number(t))?Number(t):e));function th(t,e,i,r,n,o){let s=[],a=[],l=0,u=e,f=0,h=()=>{let w=a.length?a.reduce((D,G)=>Math.max(D,G.fontSize),0):u,x=w*1.2,I=a.length?a.reduce((D,G)=>Math.max(D,G.ascent),0):w*.8,$=a.length?a.reduce((D,G)=>Math.max(D,G.descent),0):w*.2,C=(x-I-$)/2+I;s.push({runs:a,width:l,top:f,height:x,baseline:C,fontSize:w}),f+=x,a=[],l=0};for(let w of t.runs){let x={fontSize:w.size??e,bold:w.bold,italic:w.italic,color:w.color};Ai.font=pl(x,r);let I=Ai.measureText("Mg"),$=I.fontBoundingBoxAscent??I.emHeightAscent??x.fontSize*.8,C=I.fontBoundingBoxDescent??I.emHeightDescent??x.fontSize*.2;u=x.fontSize;for(let D of w.text){if(D===`
|
|
13
|
+
`){h();continue}let G=a.at(-1),Y=G&&["fontSize","bold","italic","color"].every(O=>G[O]===x[O]),B=Ai.measureText((Y?G.text:"")+D).width,_=l+B-(Y?G.width:0);a.length&&_>i&&(h(),G=null,B=Ai.measureText(D).width,_=B),G&&Y?(G.text+=D,G.width=B):a.push({text:D,...x,x:l,width:B,ascent:$,descent:C}),l=_}}h();let m=s.map(w=>w.runs.map(x=>x.text).join("")),p=s.reduce((w,x)=>Math.max(w,x.fontSize),0),g=n==="textbox"&&t.text?p*.25+4:0,b=t.text?f+g:0;return{fontSize:e,lines:m,lineHeight:e*1.2,contentHeight:f,blockInset:g,requiredHeight:b,textWidth:i,fits:b<=o+1e-6&&s.every(w=>w.width<=i+1e-6),richLines:s}}function Oi(t,e,i){let r=String(t.text??"").replace(/\r\n?/g,`
|
|
14
|
+
`),n=gl(t.fontSize,20),o=Math.min(n,gl(t.minimumFontSize,10)),s=t.adaptiveFontSize===!0,a=dl(),l=JSON.stringify([r,e,i,n,o,s,t.kind,t.showScrollBar,a]),u=ml.get(t);if(u?.key===l)return u.value;let f=hl(r),h=(w,x)=>{if(f.rich)return th(f,w,x,a,t.kind,i);Ai.font=`${w}px ${a}`;let I=[];for(let B of r.split(`
|
|
15
|
+
`)){let _="";for(let O of B)_&&Ai.measureText(_+O).width>x&&(I.push(_),_=""),_+=O;I.push(_)}let $=w*1.2,C=I.length*$,D=t.kind==="textbox"&&r?w*.25+4:0,G=r?C+D:0,Y=G<=i+1e-6&&I.every(B=>Ai.measureText(B).width<=x+1e-6);return{fontSize:w,lines:I,lineHeight:$,contentHeight:C,blockInset:D,requiredHeight:G,textWidth:x,fits:Y}},m=Math.max(0,e-4),p=h(n,m);if(s&&!p.fits&&o<n){p=h(o,m);let w=o+1,x=n-1;for(;w<=x;){let I=Math.floor((w+x)/2),$=h(I,m);$.fits?(p=$,w=I+1):x=I-1}}t.kind==="textwindow"&&t.showScrollBar!==!1&&p.contentHeight>i&&(p=h(p.fontSize,Math.max(0,m-12)));let g=p.lines.length,b=p.contentHeight;if(t.kind==="textbox"&&(g=0,b=0,p.lines.join(`
|
|
16
|
+
`)))for(let w=0;w<p.lines.length;w++){let x=p.richLines?.[w],I=x?x.top+x.height:(w+1)*p.lineHeight;if(I+p.blockInset>i+1e-6)break;g=w+1,b=I}return p={...p,visibleLineCount:g,visibleContentHeight:b},ml.set(t,{key:l,value:p}),p}var mn=t=>Number.isFinite(Number(t))?Math.max(0,Number(t)):0;function gn(t,e){if(!t||t.kind!=="image"||t.enableMask!==!0||!e)return null;let i=mn(t.sourceWidth??t.width),r=mn(t.sourceHeight??t.height),n=t.enableSoftEdge===!0,o=t.softEdgeMode!=="Pixel",s=n?mn(t.softEdgeWidthX):0,a=n?mn(t.softEdgeWidthY):0;return{id:t.id,matrix:e,width:i,height:r,featherX:o?i*s/100:s,featherY:o?r*a/100:a}}function yn(t,e,i){let r=gt(t,e,i);return{a:t.a,b:t.b,c:t.c,d:t.d,tx:r.x,ty:r.y}}function yl(t,e){let i=[];function r(n){e[n.id]&&i.push(e[n.id]);let o=n.children||[];for(let s=o.length-1;s>=0;s-=1)r(o[s])}return r(t),i}function si(t,e,i=Ii(e)){let r=Qe(e),n={};function o(s,a,l,u=!0,f=[]){let h=Ei(s.transformByPlatform,i),m=Vt(a,h),p=s.kind==="server-container"?l:Cr(l,m,h),g=La(m,p),b=u&&s.visible!==!1,w=s.kind==="image"&&s.enableMask===!0?gn({...s,width:m.width,height:m.height},yn(p,m.centerX,m.centerY)):null,x=w?[...f,w]:f;n[s.id]={...m,...Io(m),id:s.id,kind:s.kind,name:s.name,visible:s.visible!==!1,visibleInHierarchy:b,active:s.active!==!1,rotationX:h.rotation.x,rotationY:h.rotation.y,rotationZ:h.rotation.z,renderLeft:g.left,renderBottom:g.bottom,renderWidth:g.width,renderHeight:g.height,renderRotationZ:g.rotationZ,renderMatrix:p,...x.length?{masks:x}:{},primitive:s.kind==="image"?Xi(s.imageId,s.imageSource):null,...s.kind==="textbox"||s.kind==="textwindow"?{text:s.text??"",fontSize:s.fontSize,adaptiveFontSize:s.adaptiveFontSize===!0,minimumFontSize:s.minimumFontSize,textLayout:Oi(s,m.width,m.height),fontColor:s.fontColor,bgColor:s.bgColor,enableOutline:s.enableOutline!==!1,outlineColor:s.outlineColor,horizontalAlignment:s.horizontalAlignment,verticalAlignment:s.verticalAlignment}:{},...s.kind==="image"?{imageSource:s.imageSource,imageType:s.imageType??null,imageId:s.imageId,imageColor:s.imageColor,enableMask:s.enableMask===!0,enableSoftEdge:s.enableSoftEdge===!0,softEdgeMode:s.softEdgeMode,softEdgeWidthX:s.softEdgeWidthX,softEdgeWidthY:s.softEdgeWidthY,horizontalSoftRange:s.horizontalSoftRange,verticalSoftRange:s.verticalSoftRange,enableFill:s.enableFill===!0,fillType:s.fillType,fillHorizontalType:s.fillHorizontalType,fillVerticalType:s.fillVerticalType,fillRadial90Type:s.fillRadial90Type,fillRadialType:s.fillRadialType,fillAmount:s.fillAmount,reverseMaskArea:s.reverseMaskArea===!0}:{},...s.kind==="button"?{raycastTarget:s.raycastTarget!==!1,interactable:s.interactable!==!1,clickAudioId:s.clickAudioId,unavailableChildId:s.unavailableChildId??null,hoverChildId:s.hoverChildId??null,pressedChildId:s.pressedChildId??null,selectedChildId:s.selectedChildId??null}:{}};let I=s.kind==="server-container"?a:m;for(let $ of s.children||[])o($,I,p,b,x)}return o(t,r,Ki()),{canvas:r,boxes:n}}function $o(t,e){let i=[];function r(n,o,s=null,a=[],l=0,u=1,f=t.id){i.push({id:n.id,guid:e?.get(n.id)??(n.guid||0),kind:n.kind,name:n.name,label:Yi[n.kind]||n.kind,depth:o,parentId:s,ancestorIds:a,siblingIndex:l,siblingCount:u,templateId:f,childCount:(n.children||[]).length,incomplete:!an.includes(n.kind)});let h=n.children||[];for(let m=0;m<h.length;m+=1)r(h[m],o+1,n.id,[...a,n.id],m,h.length,f)}return r(t,0),i}function z(t,e,i,r,n={}){return{key:t,label:e,type:i,value:r,...n}}function vl(t,e,i,r){if(!t)return null;let n=oi(t.transformByPlatform,e),o=Io(i),s=[z("name","\u540D\u79F0","string",t.name),z("active","\u521D\u59CB\u6FC0\u6D3B","bool",t.active!==!1),z("visible","\u521D\u59CB\u53EF\u89C1\u6027","bool",t.visible!==!1),z("canControllerFocus","\u53EF\u88AB\u624B\u67C4\u6447\u6746\u5BFC\u822A\u9009\u4E2D","bool",t.canControllerFocus===!0),z("posX","\u4F4D\u7F6E X","number",o.posX,{computed:!0}),z("posY","\u4F4D\u7F6E Y","number",o.posY,{computed:!0}),z("width","\u5927\u5C0F W","number",o.width,{computed:!0}),z("height","\u5927\u5C0F H","number",o.height,{computed:!0}),z("rotationX","\u65CB\u8F6C X","number",n.rotation.x),z("rotationY","\u65CB\u8F6C Y","number",n.rotation.y),z("rotationZ","\u65CB\u8F6C Z","number",n.rotation.z),z("syncAllDevices","\u540C\u6B65\u4FE1\u606F\u81F3\u6240\u6709\u8BBE\u5907","bool",t.syncAllDevices!==!1),z("anchorType","\u951A\u70B9\u7C7B\u578B","enum",Ua(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"}]}),z("anchorMinX","\u951A\u70B9 Min X","number",n.anchorMin.x),z("anchorMinY","\u951A\u70B9 Min Y","number",n.anchorMin.y),z("anchorMaxX","\u951A\u70B9 Max X","number",n.anchorMax.x),z("anchorMaxY","\u951A\u70B9 Max Y","number",n.anchorMax.y),z("pivotX","\u4E2D\u5FC3 X","number",n.pivot.x),z("pivotY","\u4E2D\u5FC3 Y","number",n.pivot.y)];if(t.kind==="container"&&s.push(z("isolateNavigation","\u9694\u79BB\u624B\u67C4\u5BFC\u822A","bool",t.isolateNavigation===!0),z("disableKeyEventPassthrough","\u5C4F\u853D\u6309\u952E\u4E8B\u4EF6\u7A7F\u900F","bool",t.disableKeyEventPassthrough===!0),z("disableCursorEventPassthrough","\u5C4F\u853D\u533A\u57DF\u5185\u70B9\u51FB\u4E8B\u4EF6\u7A7F\u900F","bool",t.disableCursorEventPassthrough===!0),z("showCursor","\u663E\u793A\u5E38\u9A7B\u5149\u6807","bool",t.showCursor===!0)),t.kind==="textbox"||t.kind==="textwindow"){let a=t.giaRaw?.textAlign,l=[0,1,2].includes(a)?t.horizontalAlignment||"Left":`__unrecognized:${a}`;s.push(z("fontSize","\u5B57\u53F7","number",t.fontSize),z("adaptiveFontSize","\u5B57\u53F7\u81EA\u9002\u5E94","bool",t.adaptiveFontSize===!0),z("minimumFontSize","\u6700\u5C0F\u5B57\u53F7","number",t.minimumFontSize),z("fontColor","\u6587\u672C\u8272","color",t.fontColor),z("bgColor","\u80CC\u666F\u8272","color",t.bgColor),z("enableOutline","\u542F\u7528\u63CF\u8FB9","bool",t.enableOutline!==!1),z("outlineColor","\u63CF\u8FB9\u8272","color",t.outlineColor),z("horizontalAlignment","\u6C34\u5E73\u5BF9\u9F50","enum",l,{...[0,1,2].includes(a)?{}:{unknownValue:a},options:[{value:"Left",label:"\u5DE6\u5BF9\u9F50"},{value:"Middle",label:"\u5C45\u4E2D"},{value:"Right",label:"\u53F3\u5BF9\u9F50"}]}),z("verticalAlignment","\u5782\u76F4\u5BF9\u9F50","enum",t.verticalAlignment||"Top",{options:[{value:"Top",label:"\u9876\u90E8"},{value:"Middle",label:"\u5C45\u4E2D"},{value:"Bottom",label:"\u5E95\u90E8"}]}),z("text","\u6587\u672C","text",t.text??""))}if(t.kind==="image"){let a=t.giaRaw?.imageFillType,l=[1,2,3,4,5].includes(a)?t.fillType:`__unrecognized:${a}`;s.push(z("imageSource","\u56FE\u7247\u6E90","enum",t.imageSource,{options:[{value:"StaticReference",label:"\u9759\u6001\u5F15\u7528"},{value:"Prefab",label:"\u5143\u4EF6"}]}),z("imageId","imageId","number",t.imageId??0),z("imageType","\u56FE\u7247\u7C7B\u578B","enum",t.imageType??null,{options:[{value:"Basic",label:"\u57FA\u7840"},{value:"Stretch",label:"\u62C9\u4F38"}]}),z("imageColor","\u586B\u5145\u8272","color",t.imageColor),z("enableMask","\u5F00\u542F\u906E\u7F69","bool",t.enableMask===!0),z("enableSoftEdge","\u8FB9\u7F18\u7FBD\u5316","bool",t.enableSoftEdge===!0,{gia:"W"}),z("softEdgeMode","\u7FBD\u5316\u6A21\u5F0F","enum",t.softEdgeMode,{options:[{value:"Percentage",label:"\u767E\u5206\u6BD4"},{value:"Pixel",label:"\u50CF\u7D20"}]}),z("softEdgeWidthX","\u7FBD\u5316\u5BBD\u5EA6 X","number",t.softEdgeWidthX),z("softEdgeWidthY","\u7FBD\u5316\u5BBD\u5EA6 Y","number",t.softEdgeWidthY),z("horizontalSoftRange","\u6C34\u5E73\u7FBD\u5316\u8303\u56F4","number",t.horizontalSoftRange),z("verticalSoftRange","\u5782\u76F4\u7FBD\u5316\u8303\u56F4","number",t.verticalSoftRange),z("enableFill","\u6309\u8FDB\u5EA6\u586B\u5145","bool",t.enableFill===!0,{gia:"W"}),z("fillType","\u5F62\u72B6","enum",l,{...[1,2,3,4,5].includes(a)?{}:{unknownValue:a},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"}]}),z("fillHorizontalType","\u65B9\u5411","enum",t.fillHorizontalType,{options:[{value:"Left",label:"\u4ECE\u5DE6\u81F3\u53F3"},{value:"Right",label:"\u4ECE\u53F3\u81F3\u5DE6"}]}),z("fillVerticalType","\u65B9\u5411","enum",t.fillVerticalType,{options:[{value:"Bottom",label:"\u4ECE\u4E0B\u81F3\u4E0A"},{value:"Top",label:"\u4ECE\u4E0A\u81F3\u4E0B"}]}),z("fillRadial90Type","\u8D77\u70B9","enum",t.fillRadial90Type,{options:[{value:"BottomLeft",label:"\u5DE6\u4E0B"},{value:"TopLeft",label:"\u5DE6\u4E0A"},{value:"TopRight",label:"\u53F3\u4E0A"},{value:"BottomRight",label:"\u53F3\u4E0B"}]}),z("fillRadialType","\u8D77\u70B9","enum",t.fillRadialType,{options:[{value:"Bottom",label:"\u4E0B\u65B9"},{value:"Left",label:"\u5DE6\u4FA7"},{value:"Top",label:"\u4E0A\u65B9"},{value:"Right",label:"\u53F3\u4FA7"}]}),z("fillAmount","\u8FDB\u5EA6","percent",t.fillAmount),z("reverseMaskArea","\u906E\u7F69\u533A\u57DF\u53CD\u8F6C","bool",t.reverseMaskArea===!0,{gia:"W"}))}if(t.kind==="button"){let a=[{value:"",label:"\u672A\u8BBE\u7F6E"},...(t.children||[]).map(l=>({value:l.id,label:`${l.name} \xB7 ${l.id}`}))];s.push(z("raycastTarget","\u53EF\u88AB\u5149\u6807\u5C04\u7EBF\u68C0\u6D4B","bool",t.raycastTarget!==!1),z("interactable","\u6309\u94AE\u662F\u5426\u53EF\u7528","bool",t.interactable!==!1),z("unavailableChildId","\u4E0D\u53EF\u7528\u72B6\u6001\u8282\u70B9","node",t.unavailableChildId,{options:a,gia:"W"}),z("hoverChildId","\u60AC\u505C\u72B6\u6001\u8282\u70B9","node",t.hoverChildId,{options:a,gia:"W"}),z("pressedChildId","\u6309\u4E0B\u72B6\u6001\u8282\u70B9","node",t.pressedChildId,{options:a,gia:"W"}),z("selectedChildId","\u9009\u4E2D\u72B6\u6001\u8282\u70B9","node",t.selectedChildId,{options:a,gia:"W"}),z("clickAudioId","\u70B9\u51FB\u97F3\u6548","number",t.clickAudioId))}return t.kind==="reference"&&s.push(z("referencedPrefabId","\u5F15\u7528\u63A7\u4EF6\u6A21\u677F\u7D22\u5F15","string",t.referencedPrefabId??"")),(t.kind==="textwindow"||t.kind==="grid")&&s.push(z("interactable","\u5141\u8BB8\u6EDA\u52A8\u4EA4\u4E92","bool",t.interactable!==!1),z("showScrollBar","\u663E\u793A\u6EDA\u52A8\u6761","bool",t.showScrollBar!==!1)),t.kind==="grid"&&s.push(z("itemPrefabId","\u5217\u8868\u9879\u6A21\u677F\u7D22\u5F15","number",t.itemPrefabId??0),z("raycastTarget","\u53EF\u88AB\u5149\u6807\u5C04\u7EBF\u68C0\u6D4B","bool",t.raycastTarget!==!1),z("scrollDirection","\u6EDA\u52A8\u65B9\u5411","enum",t.scrollDirection,{options:[{value:"Vertical",label:"\u7EB5\u5411"},{value:"Horizontal",label:"\u6A2A\u5411"}]}),z("layoutConstraint","\u6392\u5217\u9650\u5236","enum",t.layoutConstraint,{options:[{value:"AutoWrap",label:"\u81EA\u52A8\u6362\u884C"},{value:"Fixed",label:"\u56FA\u5B9A\u884C\u5217\u6570"}]}),z("layoutConstraintFixedCount","\u6BCF\u884C\u6216\u6BCF\u5217\u6570\u91CF","number",t.layoutConstraintFixedCount??1),z("cellSizeX","\u5217\u8868\u9879\u5927\u5C0F W","number",t.cellSizeX,{evidence:"W"}),z("cellSizeY","\u5217\u8868\u9879\u5927\u5C0F H","number",t.cellSizeY,{evidence:"W"}),z("spacingX","\u5217\u8868\u9879\u95F4\u9694 X","number",t.spacingX,{evidence:"W"}),z("spacingY","\u5217\u8868\u9879\u95F4\u9694 Y","number",t.spacingY,{evidence:"W"}),z("padding1X","\u8FB9\u8DDD\u5411\u91CF 1 X","number",t.padding1X,{evidence:"W"}),z("padding1Y","\u8FB9\u8DDD\u5411\u91CF 1 Y","number",t.padding1Y,{evidence:"W"}),z("padding2X","\u8FB9\u8DDD\u5411\u91CF 2 X","number",t.padding2X,{evidence:"W"}),z("padding2Y","\u8FB9\u8DDD\u5411\u91CF 2 Y","number",t.padding2Y,{evidence:"W"}),z("previewCount","\u9884\u89C8\u6570\u91CF","number",t.previewCount)),t.kind==="keyhint"&&s.push(z("keyboardKeyCode","\u952E\u9F20\u6309\u952E","number",t.keyboardKeyCode??t.giaRaw?.keyHintField502??1,{gia:"W"}),z("controllerKeyCode","\u624B\u67C4\u6309\u952E","number",t.controllerKeyCode??t.giaRaw?.keyHintField501??1)),(t.kind==="animation"||t.kind==="fullscreen")&&s.push(z("animationId",t.kind==="animation"?"\u52A8\u6548\u7D22\u5F15":"\u5168\u5C4F\u52A8\u6548\u7D22\u5F15","string",t.animationId??"")),(!an.includes(t.kind)||t.kind==="textwindow"||t.kind==="grid")&&s.push(z("incomplete","\u5B8C\u6574\u5EA6","note",t.kind==="textwindow"||t.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:t.id,guid:r?.get(t.id)??(t.guid||0),kind:t.kind,label:Yi[t.kind]||t.kind,incomplete:!an.includes(t.kind),fields:s}}function bl(t,e,i){let r=(Array.isArray(t)?t:Object.values(t)).filter(n=>n.kind!=="server-container");for(let n=r.length-1;n>=0;n-=1){let o=r[n];if(!o.visible||o.visibleInHierarchy===!1||!o.active)continue;let s=o.renderMatrix&&Wi(o.renderMatrix),a=s&>(s,e,i);if(a&&a.x>=o.left&&a.x<=o.right&&a.y>=o.bottom&&a.y<=o.top)return o.id}return null}var If=Id(xf(),1);function dr(t,e=!1){let i=[],r=(n,o)=>{n.kind!=="server-container"&&i.push({node:n,parent:o});let s=e&&n.kind!=="server-container"?[...n.children||[]].reverse():n.children||[];for(let a of s)r(a,n)};return r(t.root,null),i}var Sp=String.raw`
|
|
2
17
|
syntax = "proto3";
|
|
3
18
|
// Root.graph is singular in the game's canonical schema, but template-list
|
|
4
19
|
// assets legally emit field 1 more than once. Model it as repeated here so
|
|
@@ -24,7 +39,7 @@ message UiControlGroup {
|
|
|
24
39
|
oneof value {
|
|
25
40
|
Transform transform = 11; WrapperString name = 12; Field14 field14 = 14;
|
|
26
41
|
string empty72 = 72; string empty73 = 73; string empty74 = 74; string empty75 = 75;
|
|
27
|
-
|
|
42
|
+
bytes empty76 = 76; string empty77 = 77; string empty78 = 78; string empty79 = 79;
|
|
28
43
|
string empty80 = 80; string empty81 = 81; string empty82 = 82; string empty83 = 83;
|
|
29
44
|
string empty84 = 84; string empty85 = 85; string empty86 = 86;
|
|
30
45
|
}
|
|
@@ -34,7 +49,7 @@ message UiControlGroup {
|
|
|
34
49
|
oneof value {
|
|
35
50
|
Transform transform = 13; Field14 field14 = 14; RootChildRef rootChildRef = 73;
|
|
36
51
|
GenericSlot genericSlot = 74; TextConfig textConfig = 75; CursorConfig cursorConfig = 76;
|
|
37
|
-
|
|
52
|
+
bytes templateRefSlot = 77; FooterSlot footerSlot = 78; ContainerNodeConfig containerNodeSlot = 79;
|
|
38
53
|
GridViewConfig gridView = 80; ButtonPresetConfig buttonPreset = 81; KeyHintConfig keyHint = 83;
|
|
39
54
|
ImageSlotConfig imageSlot = 84; ImageConfig image = 85; string effectSlot = 86;
|
|
40
55
|
string fullscreenEffectSlot = 87;
|
|
@@ -99,12 +114,33 @@ message ImageConfig {
|
|
|
99
114
|
message SliceVector { float field501 = 501; float field502 = 502; }
|
|
100
115
|
}
|
|
101
116
|
message FooterSlot { int32 field505 = 505; }
|
|
102
|
-
`,{root:al}=nl.parse(rl,{keepCase:!1}),Re=al.lookupType("Root"),et=20,mn=4,Yr=806,Xr=1657,ei={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},Br={KEYBOARD:0,TOUCHSCREEN:1,CONTROLLER_CONSOLE:2,CONTROLLER_MOBILE:3},ol="server-control-template",Ai="client-control-template";function Ei(e,t){let i=Number(e);return Number.isFinite(i)?i:t}var ll=Object.fromEntries(Object.entries(Br).map(([e,t])=>[t,e])),Ur=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"]]}),jr=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}),sl=Object.freeze([["2/15","name",null],["4/23","field14","field14"],["1/12","transform","transform"],["62/82","empty72","rootChildRef"]]);function pn(e){return{class:1,type:8,id:e}}function ti(e,t,i,n){return{...n,field501:t,field502:i,field503:1,nodeRef:pn(e)}}function ul(e){let t=[],i=e.meta?.assetType==="client-control-template";return Z(e.root,n=>{i&&n.kind==="server-container"||t.push(n)}),t}function ii(e,t=new Set){let i=new Map,n=[];for(let r of ul(e)){let a=Number(r.guid);Pe(a)&&!t.has(a)?(t.add(a),r.guid=a,i.set(r.id,a)):n.push(r)}for(let r of n){let a=We(t);t.add(a),r.guid=a,i.set(r.id,a)}return i}function cl(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 fl(e,t){let n={multiPlatform:{platforms:se.map(r=>({platformType:Br[r],transform:cl(e.transformByPlatform[r])})),field502:ei[e.kind]||25,...e.syncAllDevices===!1?{}:{field504:1}},type:2};return{transform:{multiPlatform:{},type:2},field501:1,field502:12,details:ti(t,4,12,{transform:n})}}function dl(e,t,i){let n=i?{empty15:"",field501:5}:{field17:{},field501:7},r=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:ti(t,5,i?23:86,{field14:r})},fl(e,t)]}function hl(e,t,i,n){let r=(s,f,h,p,g)=>({[h]:"",field501:s,field502:f,details:ti(t,s+2,f,{[p]:g})}),a=e.giaRaw||{},o=Array.isArray(e.scriptMappingIds)&&e.scriptMappingIds.length?{field501:a.genericField501||1,field502:e.scriptMappingIds.map(s=>({field1:{id:Number(s)}}))}:{field501:a.genericField501??0},l=r(63,83,"empty73","genericSlot",o),u=r(67,90,"empty77","footerSlot",{field505:[void 0,0,1].includes(a.footerField505)?e.canControllerFocus?1:0:a.footerField505});if(e.kind==="container")return[l,r(68,91,"empty78","containerNodeSlot",{...e.isolateNavigation?{isolateNavigation:!0}:{},...e.disableKeyEventPassthrough?{disableKeyEventPassthrough:!0}:{},...e.disableCursorEventPassthrough?{disableCursorEventPassthrough:!0}:{},...e.showCursor?{showCursor:!0}:{}}),u];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 s={Left:0,Middle:1,Right:2}[e.horizontalAlignment]??0,f=Number.isFinite(a.textAlign)?Math.trunc(a.textAlign):s,h={field501:a.textField501??20,field503:a.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}:{},...f?{align:f}:{},verticalAlign:a.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`),h.field511=a.textField511??1,h.viewFlags={field502:a.textViewField502??1,field503:a.textViewField503??1},[l,{empty81:"",field501:71,field502:94,details:ti(t,66,94,{textConfig:h})},u]):[l,r(64,84,"empty74","textConfig",h),u]}if(e.kind==="image"){let s=[0,1].includes(a.imageSlotType??0)?e.imageType==="Stretch"?1:0:a.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 f={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[e.fillType],h=Number.isFinite(a.imageFillType)?Math.trunc(a.imageFillType):f||1;e.enableFill&&!h&&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 p={field502:a.imageField502??1,field504:a.imageField504??1,field505:a.imageField505??1,field507:a.imageField507??2,field508:Math.round(Math.max(0,Math.min(1,Number(e.fillAmount)||0))*100),border:{field501:Ei(e.softEdgeWidthX,8),field502:Ei(e.softEdgeWidthY,8)},field512:Ei(e.horizontalSoftRange,85),field513:Ei(e.verticalSoftRange,85),fillType:h,...e.enableMask?{enableMask:1}:{},...e.enableSoftEdge?{enableSoftEdge:1}:{},...e.softEdgeMode==="Pixel"?{softEdgePixel:1}:{},...e.enableFill&&h?{enableFill:1}:{},...e.reverseMaskArea?{reverseMask:1}:{}};return[l,r(73,96,"empty83","imageSlot",{field502:Number.isFinite(e.imageColor)?e.imageColor>>>0:4294967295,assetId:e.imageId>>>0,...s?{imageType:s}:{}}),r(74,97,"empty84","image",p),u]}if(e.kind==="button"){let s=(m,y)=>{let I=e[m];return I?(e.children||[]).some(A=>A.id===I)?i.get(I)||0:(n.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},f=s("unavailableChildId","\u4E0D\u53EF\u7528"),h=s("hoverChildId","\u60AC\u505C"),p=s("pressedChildId","\u6309\u4E0B"),g=s("selectedChildId","\u9009\u4E2D");return[l,r(70,93,"empty80","buttonPreset",{clickAudioId:Math.trunc(e.clickAudioId),...f?{disabledChild:f}:{},...h?{hoverChild:h}:{},...p?{pressedChild:p}:{},...g?{selectedChild:g}:{},...e.interactable?{interactable:1}:{},...e.raycastTarget?{raycastTarget:1}:{}}),u]}return e.kind==="cursor"?[l,r(65,85,"empty75","cursorConfig",{field501:[void 0,0,1].includes(a.cursorField501)?e.raycastTarget!==!1?1:0:a.cursorField501}),u]:e.kind==="reference"?[l,r(66,89,"empty76","templateRefSlot",a.templateRefSlot??""),u]: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`),[l,r(69,92,"empty79","gridView",{field501:a.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:a.gridField507??1,field508:a.gridField508??1,field509:a.gridField509??1,field511:a.gridField511??5,field512:a.gridField512??1}),u]):e.kind==="keyhint"?[l,r(72,95,"empty82","keyHint",{field501:Number.isFinite(a.keyHintField501)?Math.trunc(a.keyHintField501):e.controllerKeyCode??1,field502:Number.isFinite(a.keyHintField502)?Math.trunc(a.keyHintField502):e.keyboardKeyCode??1}),u]:e.kind==="animation"?[l,r(75,98,"empty85","effectSlot",a.effectSlot??""),u]:e.kind==="fullscreen"?[l,r(76,99,"empty86","fullscreenEffectSlot",a.fullscreenEffectSlot??""),u]:(n.push(`${e.name}: ${e.kind} \u4E0D\u662F\u5DF2\u77E5 GIA \u63A7\u4EF6\u7C7B\u578B\uFF0C\u5DF2\u4EC5\u5199\u516C\u5171\u53D8\u6362\u3002`),[l,u])}function ml(e,t){if(t)return 1;if(!ke(e.giaInfoIndex))throw new Error(`${e.name}: \u7F3A\u5C11\u5408\u6CD5\u7684\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7`);return e.giaInfoIndex}function pl(e,t,i){let n=Array.isArray(e.giaRelatedGuids)?e.giaRelatedGuids.filter(r=>Number.isSafeInteger(r)&&r>0&&r<=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 gn(e,t){let i=String(e.meta?.giaFilePath||"").trim();if(/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i))return i;let n=(s,f)=>Number.isSafeInteger(Number(s))&&Number(s)>0?Number(s):f,r=n(e.meta?.giaOwnerUid,114514),a=n(e.meta?.giaTimestamp,Math.floor(Date.now()/1e3)),o=n(e.meta?.giaFileId,t?1073741829:1073741830),l=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",u=String(e.meta?.giaFileName||l).replace(/[\\/:*?"<>|]/gu,"-").replace(/\.gia$/iu,"").trim()||l.replace(/\.gia$/iu,"");return`${r}-${a}-${o}-\\${u}.gia`}function _i(e,t,i,n,r,a=!1,o=!1,l=o,u=!1){let s=i.get(e.id),h=(u?[...e.children||[]].reverse():e.children||[]).map(m=>i.get(m.id)),p=a?n:h,g=dl(e,s,a);if(a){let m=e.children?.[0];m&&g.push({empty72:"",field501:62,field502:82,details:ti(s,64,82,{rootChildRef:{guid:i.get(m.id)}})})}else g.push(...hl(e,s,i,r));return{id:pn(s),relatedIds:p.map(m=>pn(m)),name:e.name,which:a?21:o?70:15,ui:{content:{guid:s,info:[{guid:{value:s},field501:1,field502:5},...a||l?[{index:{value:ml(e,a)},field501:2,field502:6}]:[],...a||o?[{related:{value:pl(e,r,a?"\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F")},field501:4,field502:4}]:[]],children:a?[]:h,parent:t&&t.kind!=="server-container"?i.get(t.id):0,data:g}}}}function gl(e,t){let i=new Map;for(let n of e||[]){if(!n.controlId||!(t===Ai?n.controlAsset===Ai:n.controlAsset!==Ai))continue;let a=i.get(n.controlId)||[];a.push(n.guid),i.set(n.controlId,a)}return i}function Hr(e,t,i,n){let r=gl(t,i),a=new Map;Z(e.root,o=>{r.has(o.id)&&(a.set(o,o.scriptMappingIds),o.scriptMappingIds=r.get(o.id))});try{return n()}finally{for(let[o,l]of a)l===void 0?delete o.scriptMappingIds:o.scriptMappingIds=l}}function yn(e){let t=Number(e.meta?.giaModeFlag);return Number.isSafeInteger(t)&&t>=0?{modeFlag:t}:{}}function bn(e){let t=e.meta?.gameVersion;return!t||t==="7.0.50"?wi:t}function Kr(e,t,i,n,r=[]){let a=Mt(e,!0),o=a.filter(({parent:f})=>f?.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 l=new Set(o.map(({node:f})=>f.id)),u=a.filter(({node:f})=>!l.has(f.id)),s=a.map(({node:f})=>t.get(f.id));return Hr(e,r,Ai,()=>({graph:o.map(({node:f,parent:h})=>_i(f,h,t,s,i,!1,!0,!0,!0)),accessories:u.map(({node:f,parent:h})=>_i(f,h,t,s,i,!1,!1,!0,!0)),filePath:n||gn(e,!0),gameVersion:bn(e),...yn(e)}))}function qr(e,t,i,n,r){let a=Mt(e),o=[a[0],...a.slice(1).reverse()],l=o.map(({node:u})=>t.get(u.id));return Hr(e,i.scripts,ol,()=>({graph:[_i(e.root,null,t,l,n,!0,!1,!1,!0),...i.units||[]],accessories:o.map(({node:u,parent:s})=>_i(u,s,t,l,n,!1,!1,!1,!0)),filePath:r||gn(e,!1),gameVersion:bn(e),...yn(e)}))}function Lr(e,t){let i=vn(e),n=t(i);if(!n.valid)throw new Error(`GIA compatibility validation failed:
|
|
103
|
-
${n.errors.join(`
|
|
104
|
-
`)}`);return i}function Wr(e,t={}){Z(e.root,ut);let i=[];Xe(e,{warnings:i});let n=ii(V(e)),r=e.meta?.assetType==="client-control-template",a;if(r)a=Kr(e,n,i,void 0,t.scripts||[]);else{let l=Sn(t.scripts||[],new Set(n.values()));i.push(...l.warnings),a=qr(e,n,l,i)}return{buffer:Lr(a,r?In:xn),warnings:[...new Set(i)]}}function Jr(e,t,i={}){Z(e.root,ut),t&&Z(t.root,ut);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&&Xe(t,{warnings:n});let r=t?.root?.children||[];r.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 a=new Set,o=V(e),l=t?V(t):null,u=ii(o,a),s=Sn(i.scripts||[],a);n.push(...s.warnings.filter(I=>I!==Qr));let f=String(i.fileName||`${o.meta?.name||"\u6574\u5408\u5305"} \xB7 \u6574\u5408\u5305.gia`),h=gn({...o,meta:{...o.meta,giaFileName:f}},!1),p=qr(o,u,s,n,h),g={graph:[],accessories:[]};if(r.length&&l){let I=ii({...l,meta:{...l.meta,assetType:"client-control-template"}},a);g=Kr(l,I,n,h,s.scripts)}let m={graph:[...p.graph,...g.graph],accessories:[...p.accessories,...g.accessories],filePath:h,gameVersion:bn({meta:{gameVersion:e.meta?.gameVersion||t?.meta?.gameVersion}}),...yn(e)};return{buffer:Lr(m,xn),warnings:[...new Set(n)]}}var Nt=69,Zr=30,Qr="\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 yl(e){return(String(e.path||"").replace(/\\/g,"/").split("/").pop()||"").replace(/\.lua$/iu,"")||`\u811A\u672C${e.id||""}`}function vn(e){let t=Re.verify(e);if(t)throw new Error(`GIA encode validation failed: ${t}`);let i=Re.encode(Re.create(e)).finish(),n=Buffer.alloc(et+i.length+mn);return n.writeUInt32BE(n.length-4,0),n.writeUInt32BE(1,4),n.writeUInt32BE(Yr,8),n.writeUInt32BE(3,12),n.writeUInt32BE(i.length,16),Buffer.from(i).copy(n,et),n.writeUInt32BE(Xr,et+i.length),n}function Sn(e,t=new Set){let i=(e||[]).filter(o=>o.path||o.source).map(o=>({...o})),n=[];for(let o of i){let l=Number(o.guid);Pe(l)&&!t.has(l)?(t.add(l),o.guid=l):n.push(o)}for(let o of n){let l=We(t);t.add(l),o.guid=l}let r=[];return(e||[]).some(o=>o.controlId)&&r.push(Qr),{units:i.map(o=>{let l=yl(o),u=String(o.path||"").replace(/\\/g,"/"),s=/\.lua$/iu.test(u)?u:`${u||l}.lua`,f={id:o.guid,name:l,filePath:s};return String(o.source||"")&&(f.source=String(o.source)),{id:{class:Zr,id:o.guid},name:l,which:Nt,script:{mapping:f}}}),warnings:r,scripts:i}}function ea(e){let t=Sn(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=vn(i),r=bl(n);if(!r.valid)throw new Error(`GIA compatibility validation failed:
|
|
117
|
+
`,{root:xp}=If.default.parse(Sp,{keepCase:!1}),It=xp.lookupType("Root"),yi=20,Ns=4,Cf=806,Ef=1657,$r={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},kf={KEYBOARD:0,TOUCHSCREEN:1,CONTROLLER_CONSOLE:2,CONTROLLER_MOBILE:3},_p="server-control-template",Hn="client-control-template";function Xn(t,e){let i=Number(t);return Number.isFinite(i)?i:e}var Ip=Object.fromEntries(Object.entries(kf).map(([t,e])=>[e,t])),Af=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"]]}),Of=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}),Cp=Object.freeze([["2/15","name",null],["4/23","field14","field14"],["1/12","transform","transform"],["62/82","empty72","rootChildRef"]]);function Ps(t){return{class:1,type:8,id:t}}function Gr(t,e,i,r){return{...r,field501:e,field502:i,field503:1,nodeRef:Ps(t)}}function Ep(t){let e=[],i=t.meta?.assetType==="client-control-template";return ke(t.root,r=>{i&&r.kind==="server-container"||e.push(r)}),e}function qr(t,e=new Set,{preserveLegacy:i=!1}={}){let r=new Map,n=[],o=Ep(t);if(!i)for(let s of o)Eo(s.guid,s.name);for(let s of o){let a=Number(s.guid);(i?Lt(a):lt(a))&&!e.has(a)?(e.add(a),s.guid=a,r.set(s.id,a)):n.push(s)}for(let s of n){let a=ri(e);e.add(a),s.guid=a,r.set(s.id,a)}return r}function kp(t){return{scale:{x:t.scale.x,y:t.scale.y,z:t.scale.z},anchorMin:{x:t.anchorMin.x,y:t.anchorMin.y},anchorMax:{x:t.anchorMax.x,y:t.anchorMax.y},offset:{x:t.offset.x,y:t.offset.y},size:{x:t.size.x,y:t.size.y},pivot:{x:t.pivot.x,y:t.pivot.y},field508:Object.fromEntries(Object.entries(t.rotation).filter(([,e])=>e!==0))}}function Ap(t,e){let r={multiPlatform:{platforms:Be.map(n=>({platformType:kf[n],transform:kp(t.transformByPlatform[n])})),field502:$r[t.kind]||25,...t.syncAllDevices===!1?{}:{field504:1}},type:2};return{transform:{multiPlatform:{},type:2},field501:1,field502:12,details:Gr(e,4,12,{transform:r})}}function Op(t,e,i){let r=i?{empty15:"",field501:5}:{field17:{},field501:7},n=i?r:{...r,...t.visible===!1?{field17:{initiallyHidden:!0}}:{},...t.active===!1?{initiallyInactive:!0}:{}};return[{name:{value:t.name},field501:2,field502:15},{field14:r,field501:4,field502:i?23:86,details:Gr(e,5,i?23:86,{field14:n})},Ap(t,e)]}function Tp(t,e,i,r){let n=(u,f,h,m,p)=>({[h]:"",field501:u,field502:f,details:Gr(e,u+2,f,{[m]:p})}),o=t.giaRaw||{},s=Array.isArray(t.scriptMappingIds)&&t.scriptMappingIds.length?{field501:o.genericField501||1,field502:t.scriptMappingIds.map(u=>({field1:{id:Number(u)}}))}:{field501:o.genericField501??0},a=n(63,83,"empty73","genericSlot",s),l=n(67,90,"empty77","footerSlot",{field505:[void 0,0,1].includes(o.footerField505)?t.canControllerFocus?1:0:o.footerField505});if(t.kind==="container")return[a,n(68,91,"empty78","containerNodeSlot",{...t.isolateNavigation?{isolateNavigation:!0}:{},...t.disableKeyEventPassthrough?{disableKeyEventPassthrough:!0}:{},...t.disableCursorEventPassthrough?{disableCursorEventPassthrough:!0}:{},...t.showCursor?{showCursor:!0}:{}}),l];if(t.kind==="textbox"||t.kind==="textwindow"){t.verticalAlignment==="Middle"&&r.push(`${t.name}: \u5782\u76F4\u5C45\u4E2D\u6309\u63A8\u5B9A\u503C\u5BFC\u51FA\uFF0C\u5C1A\u5F85\u5B9E\u673A\u786E\u8BA4\u3002`);let u={Left:0,Middle:1,Right:2}[t.horizontalAlignment]??0,f=Number.isFinite(o.textAlign)?Math.trunc(o.textAlign):u,h={field501:o.textField501??20,field503:o.textField503??12,color:t.fontColor>>>0,color2:t.bgColor>>>0,color3:t.outlineColor>>>0,text:{value:t.text||""},fontSize:Math.trunc(t.fontSize),minimumFontSize:Math.trunc(t.minimumFontSize),...t.adaptiveFontSize?{adaptive:1}:{},...t.enableOutline===!1?{outlineOff:1}:{},...f?{align:f}:{},verticalAlign:o.textVerticalAlign??{Top:0,Middle:1,Bottom:2}[t.verticalAlignment]??0};return t.kind==="textwindow"?((t.interactable===!1||t.showScrollBar===!1)&&r.push(`${t.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`),h.field511=o.textField511??1,h.viewFlags={field502:o.textViewField502??1,field503:o.textViewField503??1},[a,{empty81:"",field501:71,field502:94,details:Gr(e,66,94,{textConfig:h})},l]):[a,n(64,84,"empty74","textConfig",h),l]}if(t.kind==="image"){let u=[0,1].includes(o.imageSlotType??0)?t.imageType==="Stretch"?1:0:o.imageSlotType;t.imageType==null&&t.imageSource==="StaticReference"&&t.imageId>100006&&r.push(`${t.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`),t.imageSource&&t.imageSource!=="StaticReference"&&r.push(`${t.name}: \u56FE\u7247\u6765\u6E90 ${t.imageSource} \u4EC5\u4FDD\u5B58\u5728 JSON\uFF0C\u5C1A\u672A\u6620\u5C04\u5230 GIA\uFF1B\u8BF7\u5728 Lua \u4E2D\u7528 SetImage(Enum.ImageSource.${t.imageSource}, ${t.imageId}) \u8BBE\u7F6E\u3002`);let f={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[t.fillType],h=Number.isFinite(o.imageFillType)?Math.trunc(o.imageFillType):f||1;t.enableFill&&!h&&r.push(`${t.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`),t.fillType==="Horizontal"&&t.fillHorizontalType!=="Left"&&r.push(`${t.name}: \u5F53\u524D\u6A2A\u5411\u586B\u5145\u65B9\u5411\u6682\u4E0D\u652F\u6301\u5199\u5165 GIA\u3002`),t.fillType==="Radial180"&&t.fillRadialType!=="Bottom"&&r.push(`${t.name}: \u5F53\u524D 180 \u5EA6\u586B\u5145\u8D77\u70B9\u6682\u4E0D\u652F\u6301\u5199\u5165 GIA\u3002`);let m={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(t.fillAmount)||0))*100),border:{field501:Xn(t.softEdgeWidthX,8),field502:Xn(t.softEdgeWidthY,8)},field512:Xn(t.horizontalSoftRange,85),field513:Xn(t.verticalSoftRange,85),fillType:h,...t.enableMask?{enableMask:1}:{},...t.enableSoftEdge?{enableSoftEdge:1}:{},...t.softEdgeMode==="Pixel"?{softEdgePixel:1}:{},...t.enableFill&&h?{enableFill:1}:{},...t.reverseMaskArea?{reverseMask:1}:{}};return[a,n(73,96,"empty83","imageSlot",{field502:Number.isFinite(t.imageColor)?t.imageColor>>>0:4294967295,assetId:t.imageId>>>0,...u?{imageType:u}:{}}),n(74,97,"empty84","image",m),l]}if(t.kind==="button"){let u=(g,b)=>{let w=t[g];return w?(t.children||[]).some(x=>x.id===w)?i.get(w)||0:(r.push(`${t.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},f=u("unavailableChildId","\u4E0D\u53EF\u7528"),h=u("hoverChildId","\u60AC\u505C"),m=u("pressedChildId","\u6309\u4E0B"),p=u("selectedChildId","\u9009\u4E2D");return[a,n(70,93,"empty80","buttonPreset",{clickAudioId:Math.trunc(t.clickAudioId),...f?{disabledChild:f}:{},...h?{hoverChild:h}:{},...m?{pressedChild:m}:{},...p?{selectedChild:p}:{},...t.interactable?{interactable:1}:{},...t.raycastTarget?{raycastTarget:1}:{}}),l]}if(t.kind==="cursor")return[a,n(65,85,"empty75","cursorConfig",{field501:[void 0,0,1].includes(o.cursorField501)?t.raycastTarget!==!1?1:0:o.cursorField501}),l];if(t.kind==="reference"){let u=o.templateRefSlotBase64;(u||o.templateRefOuterBase64)&&r.push(`${t.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 f=n(66,89,"empty76","templateRefSlot",u?Buffer.from(u,"base64"):Buffer.from(o.templateRefSlot??"","utf8"));return f.empty76=Buffer.from(o.templateRefOuterBase64||"","base64"),[a,f,l]}return t.kind==="grid"?((t.itemPrefabId||t.interactable===!1||t.showScrollBar===!1||t.raycastTarget===!1||t.scrollDirection!=="Vertical"||t.layoutConstraint!=="AutoWrap")&&r.push(`${t.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`),[a,n(69,92,"empty79","gridView",{field501:o.gridField501??1,cellSize:{field501:t.cellSizeX,field502:t.cellSizeY},gap:{field501:t.spacingX,field502:t.spacingY},padding1:{field501:t.padding1X,field502:t.padding1Y},padding2:{field501:t.padding2X,field502:t.padding2Y},field507:o.gridField507??1,field508:o.gridField508??1,field509:o.gridField509??1,field511:o.gridField511??5,field512:o.gridField512??1}),l]):t.kind==="keyhint"?[a,n(72,95,"empty82","keyHint",{field501:Number.isFinite(o.keyHintField501)?Math.trunc(o.keyHintField501):t.controllerKeyCode??1,field502:Number.isFinite(o.keyHintField502)?Math.trunc(o.keyHintField502):t.keyboardKeyCode??1}),l]:t.kind==="animation"?[a,n(75,98,"empty85","effectSlot",o.effectSlot??""),l]:t.kind==="fullscreen"?[a,n(76,99,"empty86","fullscreenEffectSlot",o.fullscreenEffectSlot??""),l]:(r.push(`${t.name}: ${t.kind} \u4E0D\u662F\u5DF2\u77E5 GIA \u63A7\u4EF6\u7C7B\u578B\uFF0C\u5DF2\u4EC5\u5199\u516C\u5171\u53D8\u6362\u3002`),[a,l])}function Rp(t,e){if(e)return 1;if(!ut(t.giaInfoIndex))throw new Error(`${t.name}: \u7F3A\u5C11\u5408\u6CD5\u7684\u5BA2\u6237\u7AEF\u8D44\u4EA7\u7F16\u53F7`);return t.giaInfoIndex}function Np(t,e,i){let r=Array.isArray(t.giaRelatedGuids)?t.giaRelatedGuids.filter(n=>Number.isSafeInteger(n)&&n>0&&n<=2147483647):[];return r.length?r:(e.push(`${t.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 Fs(t,e){let i=String(t.meta?.giaFilePath||"").trim();if(/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i))return i;let r=(u,f)=>Number.isSafeInteger(Number(u))&&Number(u)>0?Number(u):f,n=r(t.meta?.giaOwnerUid,114514),o=r(t.meta?.giaTimestamp,Math.floor(Date.now()/1e3)),s=r(t.meta?.giaFileId,e?1073741829:1073741830),a=e?"\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",l=String(t.meta?.giaFileName||a).replace(/[\\/:*?"<>|]/gu,"-").replace(/\.gia$/iu,"").trim()||a.replace(/\.gia$/iu,"");return`${n}-${o}-${s}-\\${l}.gia`}function Kn(t,e,i,r,n,o=!1,s=!1,a=s,l=!1){let u=i.get(t.id),h=(l?[...t.children||[]].reverse():t.children||[]).map(g=>i.get(g.id)),m=o?r:h,p=Op(t,u,o);if(o){let g=t.children?.[0];g&&p.push({empty72:"",field501:62,field502:82,details:Gr(u,64,82,{rootChildRef:{guid:i.get(g.id)}})})}else p.push(...Tp(t,u,i,n));return{id:Ps(u),relatedIds:m.map(g=>Ps(g)),name:t.name,which:o?21:s?70:15,ui:{content:{guid:u,info:[{guid:{value:u},field501:1,field502:5},...o||a?[{index:{value:Rp(t,o)},field501:2,field502:6}]:[],...o||s?[{related:{value:Np(t,n,o?"\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F")},field501:4,field502:4}]:[]],children:o?[]:h,parent:e&&e.kind!=="server-container"?i.get(e.id):0,data:p}}}}function Pp(t,e){let i=new Map;for(let r of t||[]){if(!r.controlId||!(e===Hn?r.controlAsset===Hn:r.controlAsset!==Hn))continue;let o=i.get(r.controlId)||[];o.push(r.guid),i.set(r.controlId,o)}return i}function Tf(t,e,i,r){let n=Pp(e,i),o=new Map;ke(t.root,s=>{n.has(s.id)&&(o.set(s,s.scriptMappingIds),s.scriptMappingIds=n.get(s.id))});try{return r()}finally{for(let[s,a]of o)a===void 0?delete s.scriptMappingIds:s.scriptMappingIds=a}}function Ms(t){let e=Number(t.meta?.giaModeFlag);return Number.isSafeInteger(e)&&e>=0?{modeFlag:e}:{}}function zs(t){let e=t.meta?.gameVersion;return!e||e==="7.0.50"?on:e}function Rf(t,e,i,r,n=[]){let o=dr(t,!0),s=o.filter(({parent:f})=>f?.kind==="server-container");if(!s.length)throw new Error("\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F\u5217\u8868\u81F3\u5C11\u9700\u8981\u4E00\u4E2A\u6A21\u677F");let a=new Set(s.map(({node:f})=>f.id)),l=o.filter(({node:f})=>!a.has(f.id)),u=o.map(({node:f})=>e.get(f.id));return Tf(t,n,Hn,()=>({graph:s.map(({node:f,parent:h})=>Kn(f,h,e,u,i,!1,!0,!0,!0)),accessories:l.map(({node:f,parent:h})=>Kn(f,h,e,u,i,!1,!1,!0,!0)),filePath:r||Fs(t,!0),gameVersion:zs(t),...Ms(t)}))}function Nf(t,e,i,r,n){let o=dr(t),s=[o[0],...o.slice(1).reverse()],a=s.map(({node:l})=>e.get(l.id));return Tf(t,i.scripts,_p,()=>({graph:[Kn(t.root,null,e,a,r,!0,!1,!1,!0),...i.units||[]],accessories:s.map(({node:l,parent:u})=>Kn(l,u,e,a,r,!1,!1,!1,!0)),filePath:n||Fs(t,!1),gameVersion:zs(t),...Ms(t)}))}function Pf(t,e){let i=Ds(t),r=e(i);if(!r.valid)throw new Error(`GIA compatibility validation failed:
|
|
105
118
|
${r.errors.join(`
|
|
106
|
-
`)}`);return{buffer:n,warnings:[...new Set(t.warnings)]}}function wn(e){return Re.toObject(Re.decode(Pi(e)),{longs:Number,enums:Number,bytes:Buffer,defaults:!1,arrays:!0,objects:!0})}function ta(e){try{let i=wn(e).graph||[];return i.length>0&&i.every(n=>Number(n.which)===Nt)}catch{return!1}}function ia(e){let t=(e.graph||[]).filter(r=>Number(r.which)===Nt),i=[],n=t.map((r,a)=>{let o=r.script?.mapping||{},l=Number(r.id?.id)||0;l<=0&&i.push(`\u7B2C ${a+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 u=Number(o.id)||0;return u&&u!==l&&i.push(`\u7B2C ${a+1} \u6761\u811A\u672C\u6620\u5C04 id(${u}) \u4E0E\u5355\u5143 id(${l}) \u4E0D\u4E00\u81F4\uFF0C\u4EE5\u5355\u5143 id \u4E3A\u51C6\u3002`),{guid:l,path:String(o.filePath||""),source:String(o.source||"")}});for(let[r,a]of n.entries())a.path&&!/\.lua$/iu.test(a.path)&&i.push(`\u7B2C ${r+1} \u6761\u811A\u672C\u6620\u5C04 file_path \u7F3A\u5C11 .lua \u540E\u7F00\uFF08${a.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 na(e){let t=wn(e),i=ia(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 bl(e){let t=[],i;try{i=wn(e)}catch(r){return{valid:!1,errors:[r?.message||String(r)],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((r,a)=>{let o=`\u5355\u5143 ${a+1}`;Number(r.which)!==Nt&&t.push(`${o}: which \u5E94\u4E3A 69\uFF0C\u5B9E\u9645 ${r.which}`),Number(r.id?.class)!==Zr&&t.push(`${o}: id.class \u5E94\u4E3A 30\uFF0C\u5B9E\u9645 ${r.id?.class}`),Number(r.id?.type??0)!==0&&t.push(`${o}: id.type \u5E94\u7F3A\u7701`);let l=r.script?.mapping;if(!l){t.push(`${o}: \u7F3A\u5C11 field35 ScriptMappingWrapper`);return}Number(r.id?.id)<=0&&t.push(`${o}: GraphUnit.id.id \u975E\u6CD5`),Number(l.id)!==Number(r.id?.id)&&t.push(`${o}: mapping.id \u5E94\u7B49\u4E8E GraphUnit.id.id`),String(l.name||"")!==String(r.name||"")&&t.push(`${o}: mapping.name \u5E94\u7B49\u4E8E GraphUnit.name`),String(l.filePath||"").trim()?/\.lua$/iu.test(String(l.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 Pi(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);if(t.length<et+mn)throw new Error("GIA \u6587\u4EF6\u8FC7\u77ED");if(t.readUInt32BE(4)!==1||t.readUInt32BE(8)!==Yr||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-et-mn)throw new Error("GIA payload \u957F\u5EA6\u4E0D\u4E00\u81F4");if(t.readUInt32BE(et+i)!==Xr)throw new Error("GIA \u5C3E\u6807\u8BB0\u65E0\u6548");return t.subarray(et,et+i)}function me(e,t){return e.ui?.content?.data?.find(i=>i.details?.[t])?.details?.[t]||null}function vl(e){let t=me(e,"transform")?.multiPlatform,i={};for(let r of t?.platforms||[]){let a=ll[r.platformType||0],o=r.transform||{};i[a]={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 r of se)i[r]||(i[r]=structuredClone(n));return i}function Ti(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"))?"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 Vr(e,{reverseSiblings:t=!1,idOffset:i=0}={}){if(!e.length)return{nodes:new Map,rootCandidates:[],warnings:[]};let n=new Map(e.map((s,f)=>[s.id?.id,`n${i+f+1}`])),r=new Map,a=new Map,o=[];for(let s of e){let f=Ti(s),h=me(s,"textConfig"),p=me(s,"imageSlot"),g=me(s,"image"),m=me(s,"buttonPreset"),y=me(s,"gridView"),I=me(s,"genericSlot"),A=me(s,"footerSlot"),x=me(s,"cursorConfig"),G=me(s,"keyHint"),z=me(s,"containerNodeSlot"),q=me(s,"templateRefSlot"),J=me(s,"effectSlot"),H=me(s,"fullscreenEffectSlot"),$=K(f,{id:n.get(s.id?.id),guid:s.id?.id||0,giaInfoIndex:(s.ui?.content?.info||[]).find(v=>v.field501===2&&v.field502===6)?.index?.value,giaRelatedGuids:(s.ui?.content?.info||[]).find(v=>v.field501===4&&v.field502===4)?.related?.value||[],name:s.name||f,visible:me(s,"field14")?.field17?.initiallyHidden!==!0,active:me(s,"field14")?.initiallyInactive!==!0,canControllerFocus:A?.field505===1,scriptMappingIds:(I?.field502||[]).map(v=>Number(v?.field1?.id)).filter(v=>Number.isSafeInteger(v)&&v>0),transformByPlatform:vl(s),syncAllDevices:me(s,"transform")?.multiPlatform?.field504===1,giaRaw:{genericField501:I?.field501??0,footerField505:A?.field505??0,...f==="textbox"||f==="textwindow"?{textField501:h?.field501??20,textField503:h?.field503??12,textAlign:h?.align??0,...[void 0,0,1,2].includes(h?.verticalAlign)?{}:{textVerticalAlign:h.verticalAlign},...f==="textwindow"?{textField511:h?.field511??1,textViewField502:h?.viewFlags?.field502??1,textViewField503:h?.viewFlags?.field503??1}:{}}:{},...f==="cursor"?{cursorField501:x?.field501??0}:{},...f==="reference"?{templateRefSlot:q??""}:{},...f==="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}:{},...f==="keyhint"?{keyHintField501:G?.field501??1,keyHintField502:G?.field502??1}:{},...f==="image"?{imageSlotType:p?.imageType??0,imageField502:g?.field502??1,imageField504:g?.field504??1,imageField505:g?.field505??1,imageField507:g?.field507??2,imageFillType:g?.fillType??1}:{},...f==="animation"?{effectSlot:J??""}:{},...f==="fullscreen"?{fullscreenEffectSlot:H??""}:{}},...f==="container"?{isolateNavigation:z?.isolateNavigation===!0,disableKeyEventPassthrough:z?.disableKeyEventPassthrough===!0,disableCursorEventPassthrough:z?.disableCursorEventPassthrough===!0,showCursor:z?.showCursor===!0}:{},...f==="cursor"?{raycastTarget:x?.field501===1}:{},...f==="textbox"||f==="textwindow"?{text:h?.text?.value??"",fontSize:h?.fontSize??20,minimumFontSize:h?.minimumFontSize??20,adaptiveFontSize:h?.adaptive===1,fontColor:h?.color??4294967295,bgColor:h?.color2??0,enableOutline:h?.outlineOff!==1,outlineColor:h?.color3??858993459,horizontalAlignment:h?.align===1?"Middle":h?.align===2?"Right":"Left",verticalAlignment:{0:"Top",1:"Middle",2:"Bottom"}[h?.verticalAlign??0]||"Top",...f==="textwindow"?{interactable:!0,showScrollBar:!0}:{}}:{},...f==="image"?{imageSource:"StaticReference",imageId:p?.assetId??0,imageType:p?.imageType===1?"Stretch":"Basic",imageColor:Number.isFinite(p?.field502)?p.field502>>>0:4294967295,enableMask:g?.enableMask===1,enableSoftEdge:g?.enableSoftEdge===1,enableFill:g?.enableFill===1,softEdgeMode:g?.softEdgePixel===1?"Pixel":"Percentage",softEdgeWidthX:g?.border?.field501??8,softEdgeWidthY:g?.border?.field502??8,horizontalSoftRange:g?.field512??85,verticalSoftRange:g?.field513??85,fillType:{1:"Horizontal",2:"Vertical",3:"Radial90",4:"Radial180",5:"Radial360"}[g?.fillType]||"Horizontal",fillAmount:Number.isFinite(g?.field508)?Math.max(0,Math.min(1,g.field508/100)):g?.enableFill===1?0:1,reverseMaskArea:g?.reverseMask===1}:{},...f==="button"?{interactable:m?.interactable===1,raycastTarget:m?.raycastTarget===1,clickAudioId:m?.clickAudioId??50888}:{},...f==="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==="reference"?{referencedPrefabId:q??""}:{},...f==="keyhint"?{keyboardKeyCode:G?.field502??null,controllerKeyCode:G?.field501??null}:{},...f==="animation"?{animationId:J??""}:{},...f==="fullscreen"?{animationId:H??""}:{}});r.set(s.id?.id,$),(f==="textbox"||f==="textwindow")&&![void 0,0,1,2].includes(h?.align)&&o.push(`${$.name}: \u6C34\u5E73\u5BF9\u9F50\u679A\u4E3E ${h.align} \u7684\u542B\u4E49\u672A\u77E5\uFF0C\u5DF2\u539F\u6837\u4FDD\u7559\u3002`),(f==="textbox"||f==="textwindow")&&![void 0,0,1,2].includes(h?.verticalAlign)&&o.push(`${$.name}: \u5782\u76F4\u5BF9\u9F50\u679A\u4E3E ${h.verticalAlign} \u7684\u542B\u4E49\u672A\u77E5\uFF0C\u5DF2\u539F\u6837\u4FDD\u7559\u3002`),f==="image"&&![void 0,0,1,2,3,4,5].includes(g?.fillType)&&o.push(`${$.name}: \u586B\u5145\u5F62\u72B6\u679A\u4E3E ${g.fillType} \u672A\u8BC6\u522B\uFF0C\u5DF2\u4FDD\u7559\u539F\u503C\u3002`),f==="button"&&a.set($.id,{unavailableChildId:m?.disabledChild,hoverChildId:m?.hoverChild,pressedChildId:m?.pressedChild,selectedChildId:m?.selectedChild})}let l=[],u=new Set;for(let s of e){let f=r.get(s.id?.id),h=(s.ui?.content?.children||[]).map(p=>r.get(p)).filter(Boolean);if(h.length){f.children=t?h.slice().reverse():h;for(let p of h)u.add(p.id)}}for(let s of e){let f=r.get(s.id?.id),h=s.ui?.content?.parent||0,p=r.get(h);p?u.has(f.id)||(t?p.children.unshift(f):p.children.push(f)):l.push(f)}for(let[s,f]of a){let h=[...r.values()].find(p=>p.id===s);for(let[p,g]of Object.entries(f))h[p]=n.get(g)||null}return{nodes:r,rootCandidates:l,warnings:o}}function ra(e){let t=Pi(e),i=Re.toObject(Re.decode(t),{longs:Number,enums:Number,bytes:Buffer,defaults:!1,arrays:!0,objects:!0}),n=i.graph||[];if(!n.some(m=>m.ui?.content))throw new Error("GIA \u4E0D\u542B\u53EF\u8BC6\u522B\u7684 UIControlGroup \u4E3B\u56FE");let r=n.find(m=>m.which===21)||null,a=n.filter(m=>Number(m.which)===70),o=i.accessories||[],l=new Set((r?.relatedIds||[]).map(m=>m.id||0)),u=r?l.size?o.filter(m=>l.has(m.id?.id||0)):o:[],s=a.length?[...a,...o.filter(m=>!l.has(m.id?.id||0))]:r?[]:[...n,...o];if(!u.length&&!s.length)throw new Error("GIA \u4E0D\u542B\u5BA2\u6237\u7AEF\u63A7\u4EF6");let f=["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"],h=ia(i);f.push(...h.warnings);let p=null,g=null;if(u.length){let m=Vr(u,{reverseSiblings:!0,idOffset:0});f.push(...m.warnings);let y=m.rootCandidates.find(A=>A.kind==="container")||m.rootCandidates[0];if(!y)throw new Error("GIA \u672A\u627E\u5230\u5BA2\u6237\u7AEF\u6839\u63A7\u4EF6");let I=K("server-container",{id:"sc1",guid:r?.id?.id||0,name:r?.name||"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668",giaRelatedGuids:(r?.ui?.content?.info||[]).find(A=>A.field501===4&&A.field502===4)?.related?.value||[]});I.children=[y],m.rootCandidates.length>1&&f.push(`\u68C0\u6D4B\u5230 ${m.rootCandidates.length} \u4E2A\u65E0\u7236\u8282\u70B9\u63A7\u4EF6\uFF0C\u4EC5\u5BFC\u5165\u4EE5\u201C${y.name}\u201D\u4E3A\u6839\u7684\u6811\u3002`),p={version:1,layoutSchemaVersion:be,meta:{name:r?.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:y.id,script:{controlId:y.id,path:"",source:""},root:I}}if(s.length){let m=Vr(s,{reverseSiblings:!1,idOffset:1e3});if(f.push(...m.warnings),!m.rootCandidates.length)throw new Error("GIA \u672A\u627E\u5230\u5BA2\u6237\u7AEF\u6A21\u677F");let y=K("server-container",{id:"sc1",guid:0,name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"});y.children=m.rootCandidates,g={version:1,layoutSchemaVersion:be,meta:{name:m.rootCandidates.length===1?m.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:m.rootCandidates[0].id,script:{controlId:m.rootCandidates[0].id,path:"",source:""},root:y},Xe(g,{warnings:f});for(let I of m.rootCandidates)Z(I,A=>A.children.reverse());p||(p=g)}return{project:p,clientProject:g&&p!==g?g:void 0,scripts:h.scripts,warnings:f,metadata:{gameVersion:i.gameVersion||"",filePath:i.filePath||"",...Number.isSafeInteger(Number(i.modeFlag))?{modeFlag:Number(i.modeFlag)}:{},combined:!!(r&&a.length)}}}function In(e){let t=Pi(e),i=Re.toObject(Re.decode(t),{longs:Number,enums:Number,defaults:!1,arrays:!0,objects:!0}),n=i.graph||[],r=i.accessories||[],a=[],o=(g,m)=>g!=null&&Object.prototype.hasOwnProperty.call(g,m),l=new Map,u=[];/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i.filePath||"")||a.push(`Root.filePath \u4E0D\u662F UID-TIME-ID-\\\u6587\u4EF6\u540D.gia\uFF1A${i.filePath||"<missing>"}`);let s=n.filter(g=>g.which===70).map(g=>{let m=Ti(g),y=g.ui?.content?.info||[],I=y.find(G=>G.field501===2&&G.field502===6)?.index?.value,A=y.find(G=>G.field501===4&&G.field502===4),x=A?.related?.value||[];return ke(I)||a.push(`${g.name}: Info.index=${I??"<missing>"}\uFF0C\u5FC5\u987B\u662F\u6B63\u6574\u6570`),A||a.push(`${g.name}: \u9876\u5C42 UIControlTemplate \u7F3A\u5C11 Info.related \u8BB0\u5F55`),{id:g.id?.id||0,name:g.name||"",kind:m,actualIndex:I,relatedPresent:!!A,relatedGuids:x}}),f=new Map;for(let g of s){if(!ke(g.actualIndex))continue;let m=f.get(g.actualIndex);m?a.push(`${g.name}: \u72EC\u7ACB\u6A21\u677F\u8D44\u4EA7\u7F16\u53F7 ${g.actualIndex} \u4E0E ${m.name} \u91CD\u590D`):f.set(g.actualIndex,g)}s.length||a.push("Root.graph \u4E0D\u542B UIControlTemplate(70)");let h=0,p=0;for(let g of[...n,...r]){if(!g.ui?.content)continue;let m=g.id?.id||0,y=g.ui.content,I=Ti(g),A=n.includes(g)&&g.which===70,x=`${g.name||"<unnamed>"}(${m||"<missing-guid>"})`;!Number.isSafeInteger(m)||m<=0||m>2147483647?a.push(`${x}: GraphUnit GUID \u975E\u6CD5`):l.has(m)?a.push(`${x}: GUID \u4E0E ${l.get(m).name||"<unnamed>"} \u91CD\u590D`):l.set(m,g),(g.id?.class!==1||g.id?.type!==8)&&a.push(`${x}: GraphUnit.id \u5FC5\u987B\u4E3A class=1,type=8`),y.guid!==m&&a.push(`${x}: content.guid=${y.guid??"<missing>"} \u4E0E GraphUnit.id.id \u4E0D\u4E00\u81F4`),A&&g.which!==70&&a.push(`${x}: \u6A21\u677F\u6839 which \u5FC5\u987B\u4E3A UIControlTemplate(70)`),!A&&g.which!==15&&a.push(`${x}: \u9644\u4EF6\u63A7\u4EF6 which \u5FC5\u987B\u4E3A UIControl(15)`);let G=y.info||[],z=G.find(_=>_.field501===1&&_.field502===5),q=G.find(_=>_.field501===2&&_.field502===6);z?.guid?.value!==m&&a.push(`${x}: Info.self GUID \u7F3A\u5931\u6216\u4E0E\u81EA\u8EAB\u4E0D\u4E00\u81F4`),ke(q?.index?.value)||a.push(`${x}: Info.index=${q?.index?.value??"<missing>"}\uFF0C\u5FC5\u987B\u662F\u6B63\u6574\u6570`);let J=G.find(_=>_.field501===4&&_.field502===4);A&&!J&&a.push(`${x}: \u9876\u5C42\u6A21\u677F\u7F3A\u5C11 Info.related \u8BB0\u5F55`),!A&&J&&a.push(`${x}: \u9644\u4EF6\u63A7\u4EF6\u4E0D\u5E94\u5199 Info.related`);let H=Ur[I],$=y.data||[],v=$.map(_=>`${_.field501}/${_.field502}`),E=H?.map(([_])=>_)||[];H?JSON.stringify(v)!==JSON.stringify(E)&&a.push(`${x}: Data \u69FD\u4F4D\u987A\u5E8F ${v.join(",")}\uFF0C\u5E94\u4E3A ${E.join(",")}`):a.push(`${x}: \u672A\u77E5\u5BA2\u6237\u7AEF\u63A7\u4EF6\u7C7B\u578B ${I}`);for(let _=0;_<Math.min($.length,H?.length||0);_+=1){let D=$[_],[Y,ue,U]=H[_];if(o(D,ue)||a.push(`${x}: Data ${Y} \u7F3A\u5C11 ${ue} \u5206\u652F`),!U)continue;o(D.details,U)||a.push(`${x}: Details ${Y} \u7F3A\u5C11 ${U} \u5206\u652F`);let we=jr[Y];(D.details?.field501!==we||D.details?.field502!==D.field502||D.details?.field503!==1)&&a.push(`${x}: Details ${Y} \u6807\u8BB0\u5E94\u4E3A ${we}/${D.field502}/1`);let Ae=D.details?.nodeRef;(Ae?.class!==1||Ae?.type!==8||Ae?.id!==m)&&a.push(`${x}: Details ${Y} node_ref \u672A\u6307\u5411\u81EA\u8EAB`)}let w=(g.ui.content.data||[]).find(_=>_.field501===4&&_.field502===86);w&&(o(w.field14,"field17")?h+=1:a.push(`${x}: \u7C7B\u578B Data \u7F3A\u5C11\u663E\u5F0F Field14.field17 \u7A7A\u4E32`),o(w.details?.field14,"field17")?h+=1:a.push(`${x}: \u7C7B\u578B Details \u7F3A\u5C11\u663E\u5F0F Field14.field17 \u7A7A\u4E32`));let C=(g.ui.content.data||[]).find(_=>_.details?.transform)?.details?.transform?.multiPlatform?.platforms||[];C.length!==4&&a.push(`${x}: \u591A\u5E73\u53F0\u53D8\u6362\u6570\u91CF=${C.length}\uFF0C\u5E94\u4E3A 4`);let O=C.map(_=>_.platformType||0);JSON.stringify(O)!==JSON.stringify([0,1,2,3])&&a.push(`${x}: \u5E73\u53F0\u987A\u5E8F ${O.join(",")}\uFF0C\u5E94\u4E3A 0,1,2,3`);let k=(g.ui.content.data||[]).find(_=>_.details?.transform)?.details?.transform;k?.multiPlatform?.field502!==ei[I]&&a.push(`${x}: \u53D8\u6362 preset=${k?.multiPlatform?.field502??"<missing>"}\uFF0C${I} \u5E94\u4E3A ${ei[I]}`);for(let _ of C)o(_.transform,"field508")?p+=1:a.push(`${x}: RectTransform \u7F3A\u5C11\u663E\u5F0F field508 \u7A7A\u4E32`);u.push({id:m,name:g.name||"",kind:I,template:A,parent:y.parent||0,children:[...y.children||[]],relatedIds:(g.relatedIds||[]).map(_=>_.id||0),dataSignatures:v})}for(let g of u){let m=`${g.name||"<unnamed>"}(${g.id})`;if(JSON.stringify(g.relatedIds)!==JSON.stringify(g.children)&&a.push(`${m}: GraphUnit.relatedIds \u4E0E content.children \u4E0D\u4E00\u81F4`),g.template&&g.parent&&a.push(`${m}: \u9876\u5C42\u6A21\u677F\u4E0D\u5E94\u6709 parent`),!g.template){let y=l.get(g.parent);y?(y.ui?.content?.children||[]).includes(g.id)||a.push(`${m}: \u7236\u63A7\u4EF6 children \u672A\u53CD\u5411\u5305\u542B\u81EA\u8EAB`):a.push(`${m}: parent=${g.parent||"<missing>"} \u4E0D\u5B58\u5728`)}for(let y of g.children){let I=l.get(y);I?(I.ui?.content?.parent||0)!==g.id&&a.push(`${m}: child=${y} \u7684 parent \u672A\u6307\u56DE\u81EA\u8EAB`):a.push(`${m}: child=${y} \u4E0D\u5B58\u5728`)}}return{valid:a.length===0,errors:a,filePath:i.filePath||"",gameVersion:i.gameVersion||"",templateCount:s.length,accessoryCount:r.length,templates:s,units:u,explicitEmpty:{field17:h,rectField508:p}}}function xn(e){let t=Pi(e),i=Re.toObject(Re.decode(t),{longs:Number,enums:Number,defaults:!1,arrays:!0,objects:!0}),n=(i.graph||[]).filter(k=>k.ui?.content&&Number(k.which)===21),r=(i.graph||[]).filter(k=>Number(k.which)===70),a=(i.graph||[]).filter(k=>Number(k.which)===Nt),o=(i.accessories||[]).filter(k=>k.ui?.content),l=[],u=(k,_)=>k!=null&&Object.prototype.hasOwnProperty.call(k,_);/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i.filePath||"")||l.push(`Root.filePath \u4E0D\u662F UID-TIME-ID-\\\u6587\u4EF6\u540D.gia\uFF1A${i.filePath||"<missing>"}`),n.length!==1&&l.push(`\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F UIControlGroup \u6570\u91CF=${n.length}\uFF0C\u5E94\u4E3A 1`);let s=(i.graph||[]).filter(k=>{let _=Number(k.which);return _===Nt||_===70||_===21?!1:!k.ui?.content});s.length&&l.push(`Root.graph \u542B ${s.length} \u4E2A\u65E0\u6CD5\u8BC6\u522B\u7684\u975E\u63A7\u4EF6/\u975E\u811A\u672C\u5355\u5143`);let f=n[0];if(!f)return{valid:!1,errors:l,filePath:i.filePath||"",gameVersion:i.gameVersion||"",accessoryCount:o.length,controls:[],scriptCount:a.length,explicitEmpty:{field17:0,rectField508:0}};let h=[f,...r,...o],p=new Map;for(let k of h){let _=k.id?.id||0,D=`${k.name||"<unnamed>"}(${_||"<missing-guid>"})`;!Number.isSafeInteger(_)||_<=0||_>2147483647?l.push(`${D}: GraphUnit GUID \u975E\u6CD5`):p.has(_)?l.push(`${D}: GUID \u91CD\u590D`):p.set(_,k),(k.id?.class!==1||k.id?.type!==8)&&l.push(`${D}: GraphUnit.id \u5FC5\u987B\u4E3A class=1,type=8`),k.ui?.content?.guid!==_&&l.push(`${D}: content.guid \u4E0E GraphUnit.id.id \u4E0D\u4E00\u81F4`)}let g=f.id?.id||0,m=f.ui.content,y=`${f.name||"<unnamed>"}(${g})`;f.which!==21&&l.push(`${y}: which \u5FC5\u987B\u4E3A UIControlGroup(21)`);let I=m.info||[];I.find(k=>k.field501===1&&k.field502===5)?.guid?.value!==g&&l.push(`${y}: Info.self GUID \u7F3A\u5931\u6216\u4E0D\u4E00\u81F4`),I.find(k=>k.field501===2&&k.field502===6)?.index?.value!==1&&l.push(`${y}: Info.index \u5FC5\u987B\u4E3A 1`);let A=I.find(k=>k.field501===4&&k.field502===4);A||l.push(`${y}: \u7F3A\u5C11\u663E\u5F0F Info.related \u8BB0\u5F55`);let x=0,G=0,z=(k,_,D,Y=!1)=>{let ue=k.id?.id||0,U=`${k.name||"<unnamed>"}(${ue})`,we=k.ui.content.data||[],Ae=we.map(ne=>`${ne.field501}/${ne.field502}`),wt=D.map(([ne])=>ne);JSON.stringify(Ae)!==JSON.stringify(wt)&&l.push(`${U}: Data \u69FD\u4F4D\u987A\u5E8F ${Ae.join(",")}\uFF0C\u5E94\u4E3A ${wt.join(",")}`);for(let ne=0;ne<Math.min(we.length,D.length);ne+=1){let Oe=we[ne],[De,Ut,jt]=D[ne];if(u(Oe,Ut)||l.push(`${U}: Data ${De} \u7F3A\u5C11 ${Ut} \u5206\u652F`),!jt)continue;u(Oe.details,jt)||l.push(`${U}: Details ${De} \u7F3A\u5C11 ${jt} \u5206\u652F`);let Ke=jr[De];(Oe.details?.field501!==Ke||Oe.details?.field502!==Oe.field502||Oe.details?.field503!==1)&&l.push(`${U}: Details ${De} \u6807\u8BB0\u5E94\u4E3A ${Ke}/${Oe.field502}/1`);let Ht=Oe.details?.nodeRef;(Ht?.class!==1||Ht?.type!==8||Ht?.id!==ue)&&l.push(`${U}: Details ${De} node_ref \u672A\u6307\u5411\u81EA\u8EAB`)}let Bt=we.find(ne=>ne.field501===4&&ne.field502===(Y?23:86)),ee=Y?"empty15":"field17";u(Bt?.field14,ee)?Y||(x+=1):l.push(`${U}: \u7C7B\u578B Data \u7F3A\u5C11\u663E\u5F0F Field14.${ee} \u7A7A\u4E32`),u(Bt?.details?.field14,ee)?Y||(x+=1):l.push(`${U}: \u7C7B\u578B Details \u7F3A\u5C11\u663E\u5F0F Field14.${ee} \u7A7A\u4E32`);let Fe=we.find(ne=>ne.details?.transform)?.details?.transform,at=Fe?.multiPlatform?.platforms||[];at.length!==4&&l.push(`${U}: \u591A\u5E73\u53F0\u53D8\u6362\u6570\u91CF=${at.length}\uFF0C\u5E94\u4E3A 4`);let vi=at.map(ne=>ne.platformType||0);JSON.stringify(vi)!==JSON.stringify([0,1,2,3])&&l.push(`${U}: \u5E73\u53F0\u987A\u5E8F ${vi.join(",")}\uFF0C\u5E94\u4E3A 0,1,2,3`);let Si=Y?ei["server-container"]:ei[_];Fe?.multiPlatform?.field502!==Si&&l.push(`${U}: \u53D8\u6362 preset=${Fe?.multiPlatform?.field502??"<missing>"}\uFF0C\u5E94\u4E3A ${Si}`);for(let ne of at)u(ne.transform,"field508")?G+=1:l.push(`${U}: RectTransform \u7F3A\u5C11\u663E\u5F0F field508 \u7A7A\u4E32`);return Ae};z(f,"server-container",sl,!0);let q=(f.relatedIds||[]).map(k=>k.id||0),J=new Set(q),H=o.filter(k=>J.has(k.id?.id||0)),$=H.map(k=>k.id?.id||0);JSON.stringify(q)!==JSON.stringify($)&&l.push(`${y}: \u4E3B\u56FE relatedIds \u5FC5\u987B\u6309\u987A\u5E8F\u8986\u76D6\u672C\u7EC4 accessories`);let v=m.data?.find(k=>k.details?.rootChildRef)?.details?.rootChildRef?.guid||0,E=p.get(v);(!E||!H.includes(E))&&l.push(`${y}: 62/82 \u6839\u8282\u70B9\u5F15\u7528\u4E0D\u5B58\u5728`),$[0]!==v&&l.push(`${y}: \u6839\u5BB9\u5668\u8282\u70B9\u5FC5\u987B\u662F\u672C\u7EC4 accessories[0]`);let w=[];for(let k of H){let _=k.id?.id||0,D=k.ui.content,Y=`${k.name||"<unnamed>"}(${_})`,ue=Ti(k);k.which!==15&&l.push(`${Y}: which \u5FC5\u987B\u4E3A UIControl(15)`);let U=D.info||[];(U.length!==1||U[0]?.field501!==1||U[0]?.field502!==5||U[0]?.guid?.value!==_)&&l.push(`${Y}: \u670D\u52A1\u7AEF\u5BB9\u5668\u5185\u63A7\u4EF6 Info \u5FC5\u987B\u53EA\u542B\u81EA\u8EAB GUID`);let we=Ur[ue];we||l.push(`${Y}: \u672A\u77E5\u5BA2\u6237\u7AEF\u63A7\u4EF6\u7C7B\u578B ${ue}`);let Ae=we?z(k,ue,we):[];w.push({id:_,name:k.name||"",kind:ue,parent:D.parent||0,children:[...D.children||[]],relatedIds:(k.relatedIds||[]).map(wt=>wt.id||0),dataSignatures:Ae})}let C=w.find(k=>k.id===v);C&&(C.kind!=="container"&&l.push(`${C.name}(${v}): \u6839\u63A7\u4EF6\u5FC5\u987B\u4E3A\u5BB9\u5668\u8282\u70B9`),C.parent&&l.push(`${C.name}(${v}): \u6839\u63A7\u4EF6\u4E0D\u5E94\u6709 parent`));let O=new Map(w.map(k=>[k.id,k]));for(let k of w){let _=`${k.name}(${k.id})`;if(JSON.stringify(k.relatedIds)!==JSON.stringify(k.children)&&l.push(`${_}: relatedIds \u5FC5\u987B\u4E0E\u76F4\u63A5 children \u4E00\u81F4`),k.id!==v){let D=O.get(k.parent);D?D.children.includes(k.id)||l.push(`${_}: \u7236\u63A7\u4EF6 children \u672A\u53CD\u5411\u5305\u542B\u81EA\u8EAB`):l.push(`${_}: parent=${k.parent||"<missing>"} \u4E0D\u5B58\u5728`)}for(let D of k.children){let Y=O.get(D);Y?Y.parent!==k.id&&l.push(`${_}: child=${D} \u7684 parent \u672A\u6307\u56DE\u81EA\u8EAB`):l.push(`${_}: child=${D} \u4E0D\u5B58\u5728`)}}if(r.length){let k=In(vn({...i,graph:r,accessories:o.filter(_=>!J.has(_.id?.id||0))}));l.push(...k.errors.map(_=>`\u5BA2\u6237\u7AEF\u6A21\u677F: ${_}`))}return{valid:l.length===0,errors:l,filePath:i.filePath||"",gameVersion:i.gameVersion||"",graph:{id:g,name:f.name||"",relatedGuids:A?.related?.value||[],rootGuid:v},accessoryCount:o.length,controls:w,scriptCount:a.length,explicitEmpty:{field17:x,rectField508:G}}}function aa(e,t=[]){if(!e||e.layoutSchemaVersion===be)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:be};let i=structuredClone(e),n=0;return Z(i.root,r=>{let a=r.transformByPlatform||{},o=r.transformByCanvas||{},l=r.name||r.id;for(let s of Object.keys(a))if(!se.includes(s))throw new Error(`${l}: unknown platform ${s}`);let u={};for(let s of se){let f=Ct[s],h=ie[f].platform,p=Object.keys(ie).filter(I=>ie[I].platform===h&&o[I]),g=o[f]?f:p[0],m=s==="CONTROLLER_CONSOLE"?u.KEYBOARD:s==="CONTROLLER_MOBILE"?u.TOUCHSCREEN:null,y=a[s]??m??(g?o[g]:null);if(u[s]=y?ze(y):un(r.kind),y||t.push(`${l}: ${s} \u65E0\u65E7\u5E03\u5C40\uFF0C\u5DF2\u4F7F\u7528\u63A7\u4EF6\u9ED8\u8BA4\u503C`),!a[s]&&!m&&g&&g!==f&&t.push(`${l}: \u7F3A\u5C11 ${f}\uFF0C\u5DF2\u91C7\u7528 ${g} \u7684\u951A\u70B9\u548C\u5C3A\u5BF8\u53C2\u6570`),!m)for(let I of p)JSON.stringify(u[s])!==JSON.stringify(ze(o[I]))&&t.push(`${l}: ${I} \u4E0E ${s} \u5E03\u5C40\u51B2\u7A81\uFF0C\u4FDD\u7559${a[s]?"\u5DF2\u6709\u5E73\u53F0":g}\u53C2\u6570`)}Le(u,`${l}.transformByPlatform`),r.transformByPlatform=u,delete r.transformByCanvas,n++}),i.layoutSchemaVersion=be,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 Cn(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 En(e,t,i,n=e.canvasId){let r=Je(e.root,t);return!r||r.kind==="server-container"?ve(n):i[r.id]||ve(n)}function tt(e,{warnings:t=[]}={}){if(!e)return ft();if(e=aa(e,t),(e.root||e.layoutSchemaVersion!==void 0)&&e.layoutSchemaVersion!==be)throw new Error(`\u4EC5\u652F\u6301 layoutSchemaVersion=${be} \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"?Rt():ft(),r={layoutSchemaVersion:be,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&&ie[e.canvasId]?e.canvasId:Ii,selectedId:e.selectedId||n.selectedId,root:dn(e.root||n.root)};return ca(r),Xe(r,{warnings:t}),r}function ca(e){let t=new Set;Z(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=fn(e.root).id)}function oa(e){return We(Pt(e))}function Sl(e,t){let i=!1;return Z(e,n=>{n.id===t&&(i=!0)}),i}function wl(e,t,i,n){let a=Qe(e.root,e.canvasId).boxes[t.id],o=i.children.findIndex(h=>h.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),!a)return;let l=Qe(e.root,e.canvasId),u=n.kind==="server-container"?ve(e.canvasId):l.boxes[n.id]||ve(e.canvasId),s=Ze(t.transformByPlatform,e.canvasId),f=lt(u,s,{posX:a.centerX,posY:a.centerY,width:a.width,height:a.height});Ft(e,t,f)}function Il(e,t){return e.meta.assetType!=="client-control-template"?hn(e.root,t):(e.root.children||[]).flatMap(i=>hn(i,t))}function fa(e,t){let i=$r(e.root,t);if(e.meta.assetType!=="client-control-template")return i;let n=Qt(e),r=new Set;return n&&n.kind!=="server-container"&&Z(n,a=>r.add(a.id)),i.filter(a=>r.has(a.id))}function da(e){let{canvas:t,boxes:i}=Qe(e.root,e.canvasId),n=ii(e),r=he(e.root,e.selectedId),a=r?i[r.id]:null;return V({layoutSchemaVersion:be,version:e.version,meta:{...e.meta},canvasId:e.canvasId,canvas:{id:e.canvasId,width:t.width,height:t.height,platform:ie[e.canvasId].platform,label:ie[e.canvasId].label,presets:Object.values(ie).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"&&Qt(e)?.id||""},tree:Il(e,n),boxes:fa(e,i),inspector:Gr(r,e.canvasId,a||t,n),root:e.root})}function Ft(e,t,i){let n=Qe(e.root,e.canvasId),r=En(e,t.id,n.boxes),a={};if(t.syncAllDevices!==!1)for(let o of se){if(o===st(e.canvasId))continue;let l=Ct[o],u=Qe(e.root,l,o);a[o]=En(e,t.id,u.boxes,l)}t.transformByPlatform=zr({transformByPlatform:t.transformByPlatform,source:i,canvasId:e.canvasId,syncAllDevices:t.syncAllDevices!==!1,sourceParentBox:r,targetParentBoxByPlatform:a})}var xl=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"]),Cl=new Set(["posX","posY","width","height"]),kl=new Set(["anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY"]);function El(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 Be(e,t){let i=Number(e);if(!Number.isFinite(i))throw new Error(`${t} must be a finite number`);return i}function la(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 Al=new Set(["fontSize","minimumFontSize","imageId","clickAudioId","softEdgeWidthX","softEdgeWidthY","horizontalSoftRange","verticalSoftRange","fillAmount","cellSizeX","cellSizeY","spacingX","spacingY","padding1X","padding1Y","padding2X","padding2Y","previewCount","keyboardKeyCode","controllerKeyCode","itemPrefabId","layoutConstraintFixedCount"]),_l=new Set(["active","visible","canControllerFocus","isolateNavigation","disableKeyEventPassthrough","disableCursorEventPassthrough","showCursor","adaptiveFontSize","enableOutline","enableMask","enableSoftEdge","enableFill","reverseMaskArea","raycastTarget","interactable","showScrollBar"]),Tl=new Set(["name","imageSource","horizontalAlignment","verticalAlignment","text","softEdgeMode","fillType","fillHorizontalType","fillVerticalType","fillRadial90Type","fillRadialType","scrollDirection","layoutConstraint","referencedPrefabId","animationId"]),sa=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 Pl(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:n}=Qe(e.root,e.canvasId),r=fa(e,n),a=Dr(r,Number(t.x),Number(t.y));return a&&(e.selectedId=a),e}if(i==="setCanvas")return t.canvasId&&ie[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"?Rt():ft();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=K(t.kind,{id:cn(e.root),guid:oa(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=he(e.root,t.parentId||e.selectedId);if(!n)throw new Error("add: parent not found");let r=Nr(n,t.kind,{id:cn(e.root),guid:oa(e.root),name:t.name});return e.selectedId=r.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=he(e.root,t.id||e.selectedId),r=n?Je(e.root,n.id):null,a=he(e.root,t.parentId);if(!n||n.kind==="server-container"||!r)throw new Error("reparent: node not found");if(!a)throw new Error("reparent: parent not found");if(a.id===n.id||Sl(n,a.id))throw new Error("\u63A7\u4EF6\u4E0D\u80FD\u79FB\u52A8\u5230\u81EA\u8EAB\u6216\u5176\u540E\u4EE3\u4E0B\u9762");if(a.kind==="server-container"&&r.kind==="server-container")return e;if(r.kind==="server-container"&&a.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 wl(e,n,r,a),e.selectedId=n.id,e}if(i==="moveSibling"){let n=he(e.root,t.id||e.selectedId),r=n?Je(e.root,n.id):null;if(!n||!r)throw new Error("moveSibling: node not found");let a=r.children.findIndex(u=>u.id===n.id),o=t.direction==="up"?-1:t.direction==="down"?1:0,l=a+o;return!o||l<0||l>=r.children.length||(r.children.splice(a,1),r.children.splice(l,0,n),e.selectedId=n.id),e}if(i==="remove"){let n=t.id||e.selectedId,r=Je(e.root,n);if(r?.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 Fr(e.root,n)&&(Z(e.root,a=>{if(a.kind==="button")for(let o of sa)a[o]&&!he(e.root,a[o])&&(a[o]=null)}),e.selectedId=r?r.id:e.root.id),e}if(i==="set"){let n=he(e.root,t.id||e.selectedId);if(!n)throw new Error("set: node not found");let r=t.key;r==="reverseMask"&&(r="reverseMaskArea");let a=t.value;if(r.startsWith("giaRaw.")){let s=r.slice(7);if(!s||s.includes("."))throw new Error("invalid raw GIA field path");let f=Pr(n.kind,s);if(!f)throw new Error(`unknown raw GIA field for ${n.kind}: ${s}`);if(n.giaRaw||={},n.giaRaw[s]=an(f,a),s==="footerField505"&&[0,1].includes(n.giaRaw[s])&&(n.canControllerFocus=n.giaRaw[s]===1),n.kind==="cursor"&&s==="cursorField501"&&[0,1].includes(n.giaRaw[s])&&(n.raycastTarget=n.giaRaw[s]===1),(n.kind==="textbox"||n.kind==="textwindow")&&s==="textAlign"){let h={0:"Left",1:"Middle",2:"Right"}[n.giaRaw[s]];h&&(n.horizontalAlignment=h)}if(n.kind==="image"&&s==="imageFillType"){let h={1:"Horizontal",2:"Vertical",3:"Radial90",4:"Radial180",5:"Radial360"}[n.giaRaw[s]];h&&(n.fillType=h)}return n.kind==="keyhint"&&s==="keyHintField502"&&(n.keyboardKeyCode=n.giaRaw[s]),n.kind==="keyhint"&&s==="keyHintField501"&&(n.controllerKeyCode=n.giaRaw[s]),e}if(r==="syncAllDevices"){if(n.syncAllDevices=la(a),n.syncAllDevices){let s=Ze(n.transformByPlatform,e.canvasId);Ft(e,n,s)}return e}if(xl.has(r)){if(r.endsWith("Color")&&(a=El(a)),Al.has(r)){if(a=Be(a,r),a<0)throw new Error(`${r} must not be negative`);if((r==="imageId"||r==="clickAudioId"||r==="keyboardKeyCode"||r==="controllerKeyCode")&&(a=Math.trunc(a)),r==="fillAmount"&&a>1)throw new Error("fillAmount must be between 0 and 1")}if(_l.has(r)&&(a=la(a)),Tl.has(r)&&(a=String(a??"")),r==="horizontalAlignment"&&!["Left","Middle","Right"].includes(a))throw new Error("invalid horizontalAlignment");if(r==="verticalAlignment"&&!["Top","Middle","Bottom"].includes(a))throw new Error("invalid verticalAlignment");if(ua[r]&&!ua[r].includes(a))throw new Error(`invalid ${r}`);if(sa.has(r))if(a===""||a===void 0||a===null)a=null;else{a=String(a);let s=he(e.root,a);if(!s||s===n||s.kind==="server-container"||!(n.children||[]).some(f=>f.id===a))throw new Error(`${r} must reference a direct child of this button`)}if(n.kind==="image"&&(r==="imageSource"||r==="imageId")&&n[r]!==a&&(n.imageType=null,n.giaRaw.imageSlotType=0),n[r]=a,n.kind==="image"&&r==="imageType"&&(n.giaRaw.imageSlotType=a==="Stretch"?1:0),r==="canControllerFocus"&&(n.giaRaw.footerField505=a?1:0),n.kind==="cursor"&&r==="raycastTarget"&&(n.giaRaw.cursorField501=a?1:0),(n.kind==="textbox"||n.kind==="textwindow")&&r==="horizontalAlignment"&&(n.giaRaw.textAlign={Left:0,Middle:1,Right:2}[a]),(n.kind==="textbox"||n.kind==="textwindow")&&r==="verticalAlignment"&&delete n.giaRaw.textVerticalAlign,n.kind==="image"&&r==="fillType"){let s={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[a];s&&(n.giaRaw.imageFillType=s)}return n.kind==="reference"&&r==="referencedPrefabId"&&(n.giaRaw.templateRefSlot=a),n.kind==="grid"&&r==="previewCount"&&(n.giaRaw.gridField511=Math.trunc(a)),n.kind==="keyhint"&&r==="keyboardKeyCode"&&(n.giaRaw.keyHintField502=Math.trunc(a)),n.kind==="keyhint"&&r==="controllerKeyCode"&&(n.giaRaw.keyHintField501=Math.trunc(a)),(n.kind==="animation"||n.kind==="fullscreen")&&r==="animationId"&&(n.giaRaw[n.kind==="animation"?"effectSlot":"fullscreenEffectSlot"]=a),e}let{boxes:o}=Qe(e.root,e.canvasId),l=En(e,n.id,o),u=Ze(n.transformByPlatform,e.canvasId);if(r==="anchorType"){let s=kn(o[n.id]),f=kr(u,a);return f=lt(l,f,s),Ft(e,n,f),e}if(["rotationX","rotationY","rotationZ"].includes(r)){let s={...u,rotation:{...u.rotation,[r.slice(-1).toLowerCase()]:Be(a,r)}};return Ft(e,n,s),e}if(kl.has(r)){let s=kn(o[n.id]),f={...u,anchorMin:{...u.anchorMin},anchorMax:{...u.anchorMax},pivot:{...u.pivot}};return r==="anchorMinX"&&(f.anchorMin.x=Be(a,r)),r==="anchorMinY"&&(f.anchorMin.y=Be(a,r)),r==="anchorMaxX"&&(f.anchorMax.x=Be(a,r)),r==="anchorMaxY"&&(f.anchorMax.y=Be(a,r)),r==="pivotX"&&(f.pivot.x=Be(a,r)),r==="pivotY"&&(f.pivot.y=Be(a,r)),Ft(e,n,lt(l,f,s)),e}if(Cl.has(r)){let s=kn(o[n.id]),f=Be(a,r);if((r==="width"||r==="height")&&f<0)throw new Error(`${r} must not be negative`);return s[r]=f,Ft(e,n,lt(l,u,s)),e}throw new Error(`set: unknown key ${r}`)}if(i==="replace"){let n=tt(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 An(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 Pl(n,t),ca(n),Xe(n),n.version=i+1,Object.keys(e).forEach(r=>{delete e[r]}),Object.assign(e,n),e}function kn(e){return e?{posX:e.centerX,posY:e.centerY,width:e.width,height:e.height}:{posX:0,posY:0,width:0,height:0}}import Rl from"fengari";var{lua:c,lauxlib:Q,lualib:ha,to_luastring:Ri,to_jsstring:Ml}=Rl,Nl=c.LUA_TNIL,Fl=c.LUA_TBOOLEAN,Ol=c.LUA_TNUMBER,zl=c.LUA_TSTRING,ma=c.LUA_TTABLE,$l=c.LUA_TFUNCTION,_n=c.LUA_TUSERDATA,Me=c.LUA_OK,pa=new WeakMap,Tn=Symbol("luaTableEntries"),Pn={__scriptHostKey:!0};function P(e){return Ri(String(e))}function dt(e,t){pa.set(e,t)}function xe(e){return pa.get(e)}var ni=class{constructor(t){this.value=t}};function oe(e,t,i){if(i instanceof ni){c.lua_pushnumber(e,i.value);return}if(i==null){c.lua_pushnil(e);return}let n=typeof i;if(n==="boolean"){c.lua_pushboolean(e,i);return}if(n==="number"){Number.isInteger(i)&&Math.abs(i)<=2147483647?c.lua_pushinteger(e,i):c.lua_pushnumber(e,i);return}if(n==="string"){c.lua_pushstring(e,P(i));return}if(n==="function"){Vl(e,t,i);return}if(i&&i[Tn]){let r=i[Tn];c.lua_createtable(e,Array.isArray(i)?i.length:0,r.length);for(let[a,o]of r)oe(e,t,a),oe(e,t,o),c.lua_settable(e,-3);return}if(Array.isArray(i)){c.lua_createtable(e,i.length,0);for(let r=0;r<i.length;r++)oe(e,t,i[r]),c.lua_rawseti(e,-2,r+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"){c.lua_createtable(e,0,Object.keys(i).length);for(let[r,a]of Object.entries(i))oe(e,t,a),c.lua_setfield(e,-2,P(r));return}c.lua_pushnil(e)}function W(e,t){if(c.lua_isnil(e,t)||c.lua_type(e,t)===c.LUA_TNONE)return"";if(!c.lua_isstring(e,t)&&c.lua_type(e,t)!==c.LUA_TNUMBER)return`lua_type=${c.lua_type(e,t)}`;let i=c.lua_tostring(e,t);return i==null?"":Ml(i)}function Ue(e,t){t=c.lua_absindex(e,t);let i=c.lua_type(e,t);if(i===_n)return xe(c.lua_touserdata(e,t));if(i===ma){c.lua_pushlightuserdata(e,Pn),c.lua_rawget(e,t);let n=c.lua_type(e,-1)===_n?c.lua_touserdata(e,-1):null;return c.lua_pop(e,1),n?xe(n):null}return null}function ye(e,t,i){i=c.lua_absindex(e,i);let n=c.lua_type(e,i);if(n===Nl)return null;if(n===Fl)return!!c.lua_toboolean(e,i);if(n===Ol)return c.lua_isinteger(e,i)?c.lua_tointeger(e,i):c.lua_tonumber(e,i);if(n===zl)return W(e,i);if(n===_n){let r=c.lua_touserdata(e,i);return xe(r)??r}if(n===$l)return Gl(e,t,i);if(n===ma){let r=Ue(e,i);if(r)return r;let a=[];for(c.lua_pushnil(e);c.lua_next(e,i)!==0;){let s=ye(e,t,-2),f=ye(e,t,-1);a.push([s,f]),c.lua_pop(e,1)}let o=new Map(a.filter(([s])=>Number.isInteger(s)&&s>=1)),l=0;for(;o.has(l+1);)l+=1;let u=l>0?[]:{};for(let[s,f]of a)Array.isArray(u)&&Number.isInteger(s)&&s>=1?u[s-1]=f:(typeof s=="string"||typeof s=="number")&&(u[s]=f);return Object.defineProperty(u,Tn,{value:a}),u}return null}function Gl(e,t,i){t.luaFunctions||(t.luaFunctions=new Map);let n=typeof c.lua_topointer=="function"?c.lua_topointer(e,i):null;if(n!=null&&t.luaFunctions.has(n))return t.luaFunctions.get(n);c.lua_pushvalue(e,i);let r=Q.luaL_ref(e,c.LUA_REGISTRYINDEX),a=Dl(e,t,r);return n!=null&&t.luaFunctions.set(n,a),a}function Dl(e,t,i){let n=(...r)=>{if(n.__luaRef==null)throw new Error("attempt to call a released Lua callback");let a=c.lua_gettop(e);c.lua_rawgeti(e,c.LUA_REGISTRYINDEX,n.__luaRef);for(let s of r)oe(e,t,s);if(c.lua_pcall(e,r.length,c.LUA_MULTRET,0)!==Me){let s=W(e,-1);throw c.lua_settop(e,a),new Error(s)}let l=c.lua_gettop(e)-a,u=[];for(let s=1;s<=l;s++)u.push(ye(e,t,a+s));if(c.lua_settop(e,a),u.length!==0)return u.length===1?u[0]:u};return n.__luaRef=i,n.__luaState=e,n}function ga(e){e?.__luaRef!=null&&(e.__luaHolds=(e.__luaHolds||0)+1)}function ya(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,c.LUA_REGISTRYINDEX,t.__luaRef),t.__luaRef=null,t.__luaState=null,e?.luaFunctions)for(let[n,r]of e.luaFunctions)r===t&&e.luaFunctions.delete(n)}function Vl(e,t,i){c.lua_pushlightuserdata(e,i),c.lua_pushlightuserdata(e,t),c.lua_pushcclosure(e,function(r){let a=c.lua_touserdata(r,c.lua_upvalueindex(1)),o=c.lua_touserdata(r,c.lua_upvalueindex(2)),l=c.lua_gettop(r),u=[];for(let s=1;s<=l;s++)u.push(ye(r,o,s));try{let s=a(...u);if(Array.isArray(s)&&s.__multi){for(let f of s)oe(r,o,f);return s.length}return s===void 0?0:(oe(r,o,s),1)}catch(s){return c.lua_pushstring(r,P(String(s&&s.message?s.message:s))),c.lua_error(r)}},2)}function ba(e){!e||typeof c.lua_close!="function"||c.lua_close(e)}function va(e){if(Q.luaL_loadstring(e,P(["local nativeGetMetatable = getmetatable","getmetatable = function(value)",' if type(value) == "string" then return nil end'," return nativeGetMetatable(value)","end"].join(`
|
|
107
|
-
`)))===Me&&c.lua_pcall(e,0,0,0),c.lua_settop(e,0),c.lua_pushnil(e),c.lua_setglobal(e,P("_VERSION")),c.lua_getglobal(e,P("string")),!c.lua_isnil(e,-1))for(let i of["dump","pack","unpack"])c.lua_pushnil(e),c.lua_setfield(e,-2,P(i));if(c.lua_pop(e,1),c.lua_pushnil(e),c.lua_setglobal(e,P("io")),c.lua_getglobal(e,P("os")),!c.lua_isnil(e,-1))for(let i of Object.keys({execute:1,getenv:1,remove:1,rename:1,tmpname:1,setlocale:1,exit:1}))c.lua_pushnil(e),c.lua_setfield(e,-2,P(i));c.lua_pop(e,1),c.lua_getglobal(e,P("debug")),c.lua_isnil(e,-1)?c.lua_pop(e,1):(c.lua_getfield(e,-1,P("traceback")),c.lua_newtable(e),c.lua_pushvalue(e,-2),c.lua_setfield(e,-2,P("traceback")),c.lua_setglobal(e,P("debug")),c.lua_pop(e,2)),c.lua_getglobal(e,P("math")),c.lua_isnil(e,-1)||(c.lua_pushcfunction(e,i=>{let n=c.lua_tonumber(i,1);return c.lua_pushboolean(i,Number.isNaN(n)),1}),c.lua_setfield(e,-2,P("isnan")),c.lua_pushcfunction(e,i=>{let n=c.lua_tonumber(i,1);return c.lua_pushboolean(i,n===1/0||n===-1/0),1}),c.lua_setfield(e,-2,P("isinf"))),c.lua_pop(e,1),c.lua_pushnil(e),c.lua_setglobal(e,P("package")),c.lua_pushnil(e),c.lua_setglobal(e,P("load")),c.lua_pushnil(e),c.lua_setglobal(e,P("loadfile")),c.lua_pushnil(e),c.lua_setglobal(e,P("dofile")),c.lua_pushnil(e),c.lua_setglobal(e,P("collectgarbage")),c.lua_pushnil(e),c.lua_setglobal(e,P("coroutine")),c.lua_pushnil(e),c.lua_setglobal(e,P("fengari"))}var Ee=(e,t=0)=>Number.isFinite(Number(e))?Number(e):t,Sa=e=>e?.Name||e,Mi=e=>Math.max(0,Math.min(1,Ee(e)));function ri(e){let t=e.parent?ri(e.parent):[e.runtime.canvasWidth,e.runtime.canvasHeight];return[Math.max(0,(e.anchorMaxX-e.anchorMinX)*t[0]+Ee(e.sizeDeltaX)),Math.max(0,(e.anchorMaxY-e.anchorMinY)*t[1]+Ee(e.sizeDeltaY))]}function ai(e){let[t,i]=ri(e),n=Sa(e.scrollDirection)==="Horizontal",r=Math.max(1,Ee(e.cellSizeX,50)),a=Math.max(1,Ee(e.cellSizeY,50)),o=Math.max(0,Ee(e.spacingX)),l=Math.max(0,Ee(e.spacingY)),u=Math.max(0,Ee(e.padding1X)),s=Math.max(0,Ee(e.padding1Y)),f=Math.max(0,Ee(e.padding2X)),h=Math.max(0,Ee(e.padding2Y)),p=n?i-s-h:t-u-f,g=n?a:r,m=n?l:o,y=Sa(e.layoutConstraint)==="Fixed"?Math.max(1,Math.floor(Ee(e.layoutConstraintFixedCount,1))):Math.max(1,Math.floor((p+m)/(g+m))),I=Math.ceil(e.itemCount/y),A=I?n?u+f+I*r+(I-1)*o:s+h+I*a+(I-1)*l:0,x=n?t:i,G=Math.max(0,A-x);return{width:t,height:i,horizontal:n,cellW:r,cellH:a,gapX:o,gapY:l,left:u,top:s,right:f,bottom:h,lanes:y,length:A,viewport:x,max:G,offset:Mi(e.scrollProgress)*G}}function Ot(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 r=Math.floor(i/t.lanes),a=i%t.lanes,o=t.horizontal?r:a,l=t.horizontal?a:r,u=t.left+o*(t.cellW+t.gapX)+t.cellW/2-(t.horizontal?t.offset:0),s=-t.top-l*(t.cellH+t.gapY)-t.cellH/2+(t.horizontal?0:t.offset),f={anchorMinX:0,anchorMaxX:0,anchorMinY:1,anchorMaxY:1,pivotX:.5,pivotY:.5,sizeDeltaX:t.cellW,sizeDeltaY:t.cellH,anchoredPositionX:u,anchoredPositionY:s};Object.entries(f).some(([h,p])=>n[h]!==p)&&(Object.assign(n,f),n.markPlayDirty(!0))}return t}var wa={container:"ClientUIContainerControl",textbox:"ClientUITextBoxControl",textwindow:"ClientUITextWindowControl",image:"ClientUIImageControl",button:"ClientUIPresetButtonControl",cursor:"ClientUICursorEventAreaControl",grid:"ClientUIGridScrollerControl",keyhint:"ClientUIKeyHintControl",animation:"ClientUIAnimationControl",fullscreen:"ClientUIFullscreenAnimationControl",reference:"ClientUIReferenceControl"},Yl=["alive","Id","prefabIndex","active","activeInHierarchy","visible"],Ni=new Set(["active","visible","parent","sizeDeltaX","sizeDeltaY","anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY"]),Xl=["name","parent","anchoredPositionX","anchoredPositionY","sizeDeltaX","sizeDeltaY","anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY","localScaleX","localScaleY","localScaleZ","localRotationX","localRotationY","localRotationZ","canControllerFocus"],Bl={image:["imageSource","imageId"],grid:["itemCount","scrollDirection","layoutConstraint","layoutConstraintFixedCount"],reference:["referencedPrefabIndex"]},Ul={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"]},jl=["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"],Ia=["AddCursorEventListener","RemoveCursorEventListener","RemoveCursorEventListeners","RemoveAllCursorEventListeners","SimulateCursorClick"],Hl={image:["SetImage","SetSoftEdgeWidth","SetFillUnused","SetFillHorizontal","SetFillVertical","SetFillRadial90","SetFillRadial180","SetFillRadial360"],button:Ia,cursor:Ia,animation:["PlayAnimation","StopAnimation"],grid:["RefreshItems","GetItemIndex","GetItemSize","GetItemSpacing","GetPadding","ScrollToItemAt","GetContentLength"]};function Mn(e,t){return e.kind==="image"&&t==="imageType"&&e.runtime.canSelectImageType(e.imageId,e.imageSource)?"rw":Yl.includes(t)||(Bl[e.kind]||[]).includes(t)?"ro":Xl.includes(t)||(Ul[e.kind]||[]).includes(t)?"rw":null}var Kl=["localRotationX","localRotationY","localRotationZ"],zt=Math.PI/180;function xa(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 Rn(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 Ca(e,t,i){let n=x=>[Math.sin(x*zt/2),Math.cos(x*zt/2)],[r,a]=n(e),[o,l]=n(t),[u,s]=n(i),[f,h,p,g]=xa(xa([0,o,0,l],[r,0,0,a]),[0,0,u,s]),m=Math.max(-1,Math.min(1,-2*(h*p-g*f))),y,I,A;return Math.abs(m)>.999999?(y=Math.sign(m)*90,I=2*Math.atan2(h,g)/zt,A=0):(y=Math.asin(m)/zt,I=Math.atan2(2*(g*h+f*p),1-2*(f*f+h*h))/zt,A=Math.atan2(2*(g*p+f*h),1-2*(f*f+p*p))/zt),[Rn(y),Rn(I),Rn(A)]}function ka(e,t){return jl.includes(t)||(Hl[e.kind]||[]).includes(t)}var ql={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}},it=class e{constructor(t,i){this.runtime=t,this.kind=i.kind||"container",this.typeofName=wa[this.kind]||wa.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=ql[this.kind]||{};for(let[r,a]of Object.entries(n))this[r]===void 0&&(this[r]=i[r]!==void 0?i[r]:a);if(this.kind==="grid"&&(this.scrollProgress=i.scrollProgress??0),i.children)for(let r of i.children){let a=r instanceof e?r:new e(t,r);this.addChild(a)}}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=Mi(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 r of i)if(n=n.GetChild(r),!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 r=i.length-1;return!Number.isInteger(t)||t<0||t>r?!1:(i.splice(n,1),i.splice(r-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 Ca(this.localRotationX,this.localRotationY,this.localRotationZ)}luaFieldValue(t){if(t==="imageType")return this.imageType??"Stretch";let i=Kl.indexOf(t);return i<0?this[t]:Ca(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 r=t.get(i)||[];r.push(n),t.set(i,r),this.runtime.retainLuaCallback?.(n)}_removeListener(t,i,n){let r=t.get(i);if(!r)return;let a=r.filter(o=>o!==n);t.set(i,a);for(let o=a.length;o<r.length;o++)this.runtime.unrefLuaCallback?.(n)}_removeListeners(t,i){let n=t.get(i)||[];for(let r of n)this.runtime.unrefLuaCallback?.(r);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 r of n)r(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,r=t?.Name||t;(i!==this.imageId||n!==r)&&(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 n=[];for(let r of this._gridItems)r.alive&&r.parent===this&&r.prefabIndex===Number(this.itemPrefabIndex)&&n.length<t?n.push(r):r.alive&&r.parent===this&&this.runtime.destroyControl(r);for(this._gridItems=n;n.length<t;){let r=this.runtime.instantiate(this.itemPrefabIndex,this,this.runtime.lifecyclePhase);if(!r)throw new Error("RefreshItems: could not instantiate item");n.push(r),r.SetActive(!0)}this.itemCount=t,Ot(this),this.markPlayDirty(!0);for(let r=0;r<n.length&&this.alive;r+=1)i(n[r],r)}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),r=n.horizontal?n.cellW:n.cellH,a=n.horizontal?n.gapX:n.gapY,o=(n.horizontal?n.left:n.top)+Math.floor(t/n.lanes)*(r+a),l=i?.Name||i;if(!["Top","Center","Bottom"].includes(l))throw new Error("ScrollToItemAt: invalid alignment");let u=o-(l==="Center"?(n.viewport-r)/2:l==="Bottom"?n.viewport-r:0);this.scrollProgress=n.max?Mi(u/n.max):0,Ot(this),this.markPlayDirty(!0)}GetContentLength(){return ai(this).length}};function $e(e,t){t(e);for(let i of e.children)$e(i,t)}function Nn(e,t=[],i=""){t.push(`${i}${e.name||"(unnamed)"} [${e.typeofName}] Id=${e.Id}`);for(let n of e.children)Nn(n,t,i+" ");return t}function Fi(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 Ea={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-Fi(1-e),OutBounce:Fi,InOutBounce:e=>e<.5?(1-Fi(1-2*e))/2:(1+Fi(2*e-1))/2};function Aa(e,t){let i=Ea[e]||Ea.Linear;return t<=0?0:t>=1?1:i(t)}function $t(e,t,i,n=255){let r=Oi(e),a=Oi(t),o=Oi(i);return((n==null?255:Oi(n))<<24|r<<16|a<<8|o)>>>0}function oi(e){let t=e>>>0;return[t>>>16&255,t>>>8&255,t&255,t>>>24&255]}function Oi(e){let t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(255,Math.trunc(t))):0}function _a(e,t,i){let n=oi(e),r=oi(t);return $t(n[0]+(r[0]-n[0])*i,n[1]+(r[1]-n[1])*i,n[2]+(r[2]-n[2])*i,n[3]+(r[3]-n[3])*i)}var Ll=new Set(["fontColor","bgColor","outlineColor","imageColor"]),Wl=new Set(["fontSize","minimumFontSize"]),Fn=1e-9;function Jl(e,t){return typeof e?.luaFieldValue=="function"?e.luaFieldValue(t):e[t]}var li=class{constructor(t,i,n,r){this.runtime=t,this.object=i,this.data={...n},this.duration=Math.max(0,Number(r)||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=Jl(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=Aa(this.easeName,t),n=!1,r=!1;for(let a of Object.keys(this.to)){let o=this.from[a],l=this.to[a];if(Ll.has(a)&&typeof o=="number"&&typeof l=="number")this.object[a]=_a(o,l,i);else if(typeof o=="number"&&typeof l=="number"){let u=o+(l-o)*i;this.object[a]=Wl.has(a)?Math.trunc(u):u}else this.object[a]=i>=1?l:o;n=!0,Ni.has(a)&&(r=!0)}n&&typeof this.object?.markPlayDirty=="function"&&this.object.markPlayDirty(r)}_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)}},Gt=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,r=[],a=o=>o.duration*o.loopCount;for(let o of this.steps)if(o.kind==="tween"&&o.parallel){let l=n?i:t;r.push({at:l,tween:o.tween}),t=Math.max(t,l+a(o.tween))}else o.kind==="tween"?(r.push({at:t,tween:o.tween}),i=t,n=!0,t+=a(o.tween)):o.kind==="interval"?(i=t,n=!0,t+=o.duration):o.kind==="callback"?r.push({at:t,fn:o.fn}):o.kind==="insert"?(r.push({at:o.time,tween:o.tween}),t=Math.max(t,o.time+a(o.tween))):o.kind==="insertCb"&&(r.push({at:o.time,fn:o.fn}),t=Math.max(t,o.time));this._entries=r.map((o,l)=>({...o,index:l,end:o.tween?o.at+a(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,r=[];for(let o of n)!o.started&&o.at<=t+Fn&&r.push({at:o.at,rank:o.fn?1:2,entry:o}),o.tween&&!o.done&&o.end<=t+Fn&&r.push({at:o.end,rank:0,entry:o});r.sort((o,l)=>o.at-l.at||o.rank-l.rank||o.entry.index-l.entry.index);let a=new Set;for(let{rank:o,entry:l}of r)if(o===1){if(l.started=!0,this.runtime.safeCall(l.fn),!this.playing||this.killed||this._entries!==n)return!1}else l.started||(this._startChild(l),a.add(l)),o===0&&!l.done&&this._finishChild(l);for(let o of n)!o.tween||!o.started||o.done||(a.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+Fn<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 zi={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"]},Zl=[...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"],Ql=[...Array.from({length:14},(e,t)=>`CraftspersonKey${t+1}`),"SprintKey","JumpKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key","MenuConfirmKey","MenuBackKey","None"];function es(){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}zi.KeyboardKeyCode=Zl;zi.ControllerKeyCode=Ql;zi.KeyEventType=es();var Ta=new Map;function ht(e,t){let i=`${e}\0${t}`,n=Ta.get(i);return n||(n={__kind:"EnumItem",Name:t,FullName:`Enum.${e}.${t}`,EnumType:e},Ta.set(i,n)),n}function On(e,t){return t==null?t:t.__kind==="EnumItem"?ht(t.EnumType||e,t.Name):typeof t=="string"&&t?ht(e,t):t}function zn(){let e={};for(let[t,i]of Object.entries(zi)){let n={};for(let r of i)n[r]=ht(t,r);e[t]=n}return e}var ts=new Set(["Id","prefabIndex","imageId","fontSize","minimumFontSize","clickAudioId","itemCount","itemPrefabIndex","animationId","referencedPrefabIndex"]),is=new Set(["imageColor","fontColor","bgColor","outlineColor"]),Pa={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"},mt=c.LUA_REGISTRYINDEX,Ra=c.LUA_MULTRET,ns=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 $i=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=zn(),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?c.lua_pushinteger(t,n):c.lua_pushnumber(t,n)}retainLuaCallback(t){ga(t)}unrefLuaCallback(t){ya(this,t)}log(t,...i){let n=i.map(r=>r==null?"nil":typeof r=="object"&&r!==null&&r.__kind==="EnumItem"?r.Name:String(r)).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}addRoot(t){let i=t instanceof it?t:new it(this,t);return this.roots.push(i),$e(i,n=>this.controlsById.set(n.Id,n)),this.mountSpecScripts(t,i),i}mountSpecScripts(t,i){if(t instanceof it)return;let n=a=>(a.scripts?.length||0)>0||(a.children||[]).some(n);if(!t||!n(t))return;let r=this.lifecyclePhase;try{let a=(o,l)=>{for(let s of o.scripts||[])try{this.mountScript({path:s.path,source:s.source,control:l,scriptMappingId:s.scriptMappingId})}catch(f){let h=f&&f.message?f.message:String(f);this.mountErrors.push(h),this.log("lua-error",h)}let u=o.children||[];for(let s=0;s<u.length;s+=1)a(u[s],l?.children?.[s])};a(t,i)}finally{this.lifecyclePhase=r}}makeCursorEventData({x:t=0,y:i=0,pressX:n=t,pressY:r=i,deltaX:a=t-n,deltaY:o=i-r,dragging:l=!1,touchId:u=-1}={}){let s=this;return{__kind:"CursorEventData",typeofName:"CursorEventData",dragging:l,touchId:u,x:t,y:i,pressX:n,pressY:r,GetUIPos(){return[t,i]},GetPressUIPos(){return[n,r]},GetUIPosDelta(){return[a,o]}}}boot(){let t=this.newLuaThread();this.L=t}installGlobals(t){let i=this;c.lua_pushcfunction(t,n=>{let r=c.lua_gettop(n),a=[];for(let o=1;o<=r;o++)a.push(ye(n,i,o));return i.log("info",...a),0}),c.lua_setglobal(t,P("print")),c.lua_pushcfunction(t,n=>{let r=c.lua_gettop(n),a=[];for(let o=1;o<=r;o++)a.push(ye(n,i,o));return i.log("error",...a),0}),c.lua_setglobal(t,P("printerr")),c.lua_pushcfunction(t,n=>{if(c.lua_type(n,1)===c.LUA_TTABLE&&!Ue(n,1))return c.lua_pushstring(n,P("table")),1;let r=ye(n,i,1);return c.lua_pushstring(n,P(i.typeofOf(r))),1}),c.lua_setglobal(t,P("typeof")),this.pushColorLib(t),this.pushEnumLib(t),this.pushGameLib(t),c.lua_pushcfunction(t,n=>i.luaRequire(n)),c.lua_setglobal(t,P("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 Gt?"TweenSequence":t instanceof li?"Tween":t.typeofName?t.typeofName:typeof t=="number"?"number":typeof t=="string"?"string":typeof t=="boolean"?"boolean":typeof t}pushColorLib(t){c.lua_newtable(t),c.lua_pushcfunction(t,i=>(this.pushPackedColor(i,$t(c.lua_tonumber(i,1),c.lua_tonumber(i,2),c.lua_tonumber(i,3),255)),1)),c.lua_setfield(t,-2,P("FromRGB")),c.lua_pushcfunction(t,i=>{let n=c.lua_isnoneornil(i,4)?255:c.lua_tonumber(i,4);return this.pushPackedColor(i,$t(c.lua_tonumber(i,1),c.lua_tonumber(i,2),c.lua_tonumber(i,3),n)),1}),c.lua_setfield(t,-2,P("FromRGBA")),c.lua_pushcfunction(t,i=>{let n=c.lua_tonumber(i,1)>>>0;for(let r of oi(n))c.lua_pushinteger(i,r);return 4}),c.lua_setfield(t,-2,P("ToRGBA")),c.lua_newtable(t),c.lua_pushcfunction(t,i=>{let n=c.lua_tonumber(i,2),r=c.lua_tonumber(i,3),a=c.lua_tonumber(i,4),o=c.lua_isnoneornil(i,5)?255:c.lua_tonumber(i,5);return this.pushPackedColor(i,$t(n,r,a,o)),1}),c.lua_setfield(t,-2,P("__call")),c.lua_setmetatable(t,-2),c.lua_setglobal(t,P("Color"))}pushEnumLib(t){c.lua_newtable(t);for(let[i,n]of Object.entries(this.enumTree)){c.lua_newtable(t);for(let[r,a]of Object.entries(n))this.pushEnumItem(t,a),c.lua_setfield(t,-2,P(r));c.lua_setfield(t,-2,P(i))}c.lua_setglobal(t,P("Enum"))}pushEnumItem(t,i){let n=c.lua_newuserdata(t,0);dt(n,i),Q.luaL_setmetatable(t,P("EnumItem"))}pushControl(t,i){let n=c.lua_newuserdata(t,0);dt(n,i),Q.luaL_setmetatable(t,P("Control"))}pushScript(t,i){c.lua_newtable(t),c.lua_pushlightuserdata(t,Pn);let n=c.lua_newuserdata(t,0);dt(n,i),c.lua_rawset(t,-3),Q.luaL_getmetatable(t,P("Script")),c.lua_setmetatable(t,-2)}pushTween(t,i){let n=c.lua_newuserdata(t,0);dt(n,i);let r=i instanceof Gt?"TweenSequence":"Tween";Q.luaL_setmetatable(t,P(r))}pushSignal(t,i){let n=c.lua_newuserdata(t,0);dt(n,i),Q.luaL_setmetatable(t,P("ServerSignal"))}pushCursor(t,i){let n=c.lua_newuserdata(t,0);dt(n,i),Q.luaL_setmetatable(t,P("CursorEventData"))}pushGameLib(t){let i=this;c.lua_newtable(t);let n={InstantiateClientUIControl:r=>{let a=c.lua_tointeger(r,1),o=xe(c.lua_touserdata(r,2)),l=i.instantiate(a,o,i.lifecyclePhase);return l?(i.pushControl(r,l),1):(c.lua_pushnil(r),1)},DestroyClientUIControl:r=>{let a=xe(c.lua_touserdata(r,1));return a&&i.destroyControl(a),0},GetClientUIControl:r=>{let a=c.lua_tointeger(r,1),o=i.controlsById.get(a);return o?i.pushControl(r,o):c.lua_pushnil(r),1},FindClientUIRoot:r=>{let a=W(r,1),o=i.roots.find(l=>l.name===a);return o?i.pushControl(r,o):c.lua_pushnil(r),1},GetClientUIRoots:r=>(c.lua_createtable(r,i.roots.length,0),i.roots.forEach((a,o)=>{i.pushControl(r,a),c.lua_rawseti(r,-2,o+1)}),1),GetUICanvasSize:r=>(c.lua_pushnumber(r,i.canvasWidth),c.lua_pushnumber(r,i.canvasHeight),2),GetCursorUIPos:r=>(c.lua_pushnumber(r,i.cursor.x),c.lua_pushnumber(r,i.cursor.y),2),GetDevice:r=>(i.pushEnumItem(r,ht("Device",i.device)),1),SetControllerFocus:r=>(i.focus=xe(c.lua_touserdata(r,1)),0),GetControllerFocus:r=>(i.focus?i.pushControl(r,i.focus):c.lua_pushnil(r),1),GetControllerLeftStickAxis:r=>(c.lua_pushnumber(r,i.stick.left[0]),c.lua_pushnumber(r,i.stick.left[1]),2),GetControllerRightStickAxis:r=>(c.lua_pushnumber(r,i.stick.right[0]),c.lua_pushnumber(r,i.stick.right[1]),2),Tween:r=>{let a=xe(c.lua_touserdata(r,1))||ye(r,i,1),o=ye(r,i,2)||{},l=c.lua_tonumber(r,3),u=new li(i,a,o,l);return i.pushTween(r,u),1},TweenSequence:r=>(i.pushTween(r,new Gt(i)),1),ServerSignal:r=>{let a=W(r,1);return i.pushSignal(r,i.makeServerSignal(a)),1},GetGlobalCustomVariableValue:r=>{let a=Se(ye(r,i,1)),o=W(r,2);return oe(r,i,i.getVar(a,o)),1},PauseLevelTime:r=>(i.clock.paused=!!c.lua_toboolean(r,1),0),IsLevelTimePaused:r=>(c.lua_pushboolean(r,i.clock.paused),1),PlayAudio2D:r=>{let a=i.playAudio(i.audioInteger(r));return c.lua_pushinteger(r,a),1},StopAudio:r=>(i.stopAudio(i.audioInteger(r)),0),IsAudioAlive:r=>{let a=i.audios.get(i.audioInteger(r));return c.lua_pushboolean(r,!!(a&&a.alive)),1},GetLanguageType:r=>(i.pushEnumItem(r,ht("LanguageType",i.language)),1),GetStageMode:r=>(i.pushEnumItem(r,ht("StageMode",i.stageMode)),1),IsTestPlay:r=>(c.lua_pushboolean(r,i.testPlay),1),GetText:r=>{let a=W(r,1);return c.lua_pushstring(r,P(a)),1},PrintClientUITree:r=>{for(let a of i.roots)i.log("info",Nn(a).join(`
|
|
108
|
-
`));return 0}};for(let[r,a]of Object.entries(n)){let o=ns[r];if(o===void 0)throw new Error(`missing game arity for ${r}`);c.lua_pushcfunction(t,l=>{let u=c.lua_gettop(l);return u!==o?Q.luaL_error(l,P(`bad argument count to '${r}' (${o} expected, got ${u})`)):a(l)}),c.lua_setfield(t,-2,P(r))}c.lua_setglobal(t,P("game"))}makeServerSignal(t){let i=[],n=this;return{__kind:"ServerSignal",name:t,AddParam(r,a){i.push({type:Se(r),value:a})},AddInt(r){i.push({type:"Int",value:r})},AddIntList(r){i.push({type:"IntList",value:r})},AddFloat(r){i.push({type:"Float",value:r})},AddFloatList(r){i.push({type:"FloatList",value:r})},AddString(r){i.push({type:"String",value:r})},AddStringList(r){i.push({type:"StringList",value:r})},AddVector3(r){i.push({type:"Vector3",value:r})},AddVector3List(r){i.push({type:"Vector3List",value:r})},AddBool(r){i.push({type:"Bool",value:r})},AddBoolList(r){i.push({type:"BoolList",value:r})},AddGuid(r){i.push({type:"Guid",value:r})},AddGuidList(r){i.push({type:"GuidList",value:r})},AddEntity(r){i.push({type:"Entity",value:r})},AddEntityList(r){i.push({type:"EntityList",value:r})},AddPrefabId(r){i.push({type:"PrefabId",value:r})},AddPrefabIdList(r){i.push({type:"PrefabIdList",value:r})},AddConfigId(r){i.push({type:"ConfigId",value:r})},AddConfigIdList(r){i.push({type:"ConfigIdList",value:r})},SendSignal(){let r=i.slice();n.serverBridge&&typeof n.serverBridge.receiveFromClient=="function"&&n.serverBridge.receiveFromClient(t,r)}}}audioInteger(t){let i=c.lua_tonumber(t,1);return c.lua_type(t,1)!==c.LUA_TNUMBER||!Number.isSafeInteger(i)?Q.luaL_error(t,P("audio argument must be an integer")):i}playAudio(t){this.audioRevision++;let i=this.nextAudioId++,n=this.audioDuration(t),r=Number.isFinite(n)&&n>0,a={instanceId:i,audioId:t,startedAt:this.clock.time,duration:r?n:0,alive:r,stopped:!1};return this.audioHistory.push(a),this.audioHistory.length>128&&this.audioHistory.shift(),r?(this.audios.size>=128&&this.stopAudio(this.audios.keys().next().value),this.audios.set(i,a)):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 r=this.templates.get(Number(t));if(!r||!i)return null;let a=new it(this,{...r,Id:this.nextControlId(),authoringId:null,prefabIndex:Number(t)});return i.addChild(a),a.SetAsLastSibling(),$e(a,o=>this.controlsById.set(o.Id,o)),this.mountSpecScripts(r,a),a}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}`);$e(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,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=[];$e(t,r=>n.push({control:r,was:r.activeInHierarchy})),t.active=!!i,t.markPlayDirty(!0);for(let r of n){let a=r.control.activeInHierarchy;if(r.was!==a)for(let o of r.control.scripts.slice())a?this.enableScript(o):this.disableScript(o)}}bindScriptEnv(t){let i=t.env;return i?(this.pushScript(i,t),c.lua_setglobal(i,P("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(r=>r!==t),t.object&&(t.object.scripts=t.object.scripts.filter(r=>r!==t)),this.varHandlers=this.varHandlers.filter(r=>r.script!==t),this.signalHandlers=this.signalHandlers.filter(r=>r.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,r,a,o){Q.luaL_newmetatable(t,P(i)),c.lua_pushcfunction(t,l=>{let u=Ue(l,1)||xe(c.lua_touserdata(l,1)),s=W(l,2);if(a[s]&&(!o||o(u,s)))return c.lua_pushcfunction(l,a[s]),1;let f;try{f=n(u,s)}catch(h){return Q.luaL_error(l,P(String(h.message||h)))}return f===void 0?(c.lua_pushnil(l),1):(oe(l,this,f),1)}),c.lua_setfield(t,-2,P("__index")),c.lua_pushcfunction(t,l=>{try{let u=Ue(l,1)||xe(c.lua_touserdata(l,1)),s=W(l,2),f=ye(l,this,3);return r(u,s,f),0}catch(u){return c.lua_pushstring(l,P(String(u.message||u))),c.lua_error(l)}}),c.lua_setfield(t,-2,P("__newindex")),c.lua_pushcfunction(t,l=>{let u=Ue(l,1)||xe(c.lua_touserdata(l,1)),s=Ue(l,2)||xe(c.lua_touserdata(l,2));return c.lua_pushboolean(l,u===s),1}),c.lua_setfield(t,-2,P("__eq")),c.lua_pop(t,1)}method(t){let i=this;return n=>{let r=Ue(n,1)||xe(c.lua_touserdata(n,1)),a=c.lua_gettop(n),o=[];for(let l=2;l<=a;l++)o.push(ye(n,i,l));try{let l=t(r,...o);if(l===r)return c.lua_pushvalue(n,1),1;if(l===void 0)return 0;if(Array.isArray(l)&&l.__multi){for(let u of l)oe(n,i,u);return l.length}if(Array.isArray(l)&&!(l.length&&typeof l[0]=="object"&&l[0]?.typeofName)){if(l.__controls)return c.lua_createtable(n,l.length,0),l.forEach((u,s)=>{i.pushControl(n,u),c.lua_rawseti(n,-2,s+1)}),1;if(l.__scripts)return c.lua_createtable(n,l.length,0),l.forEach((u,s)=>{i.pushScript(n,u),c.lua_rawseti(n,-2,s+1)}),1;if(typeof l[0]=="number"&&l.length<=4){for(let u of l)c.lua_pushnumber(n,u);return l.length}}return oe(n,i,l),1}catch(l){return c.lua_pushstring(n,P(String(l.message||l))),c.lua_error(n)}}}mtEnum(t){let i=new Set(["Name","FullName","EnumType"]);this.mtIndexNewindex(t,"EnumItem",(n,r)=>i.has(r)?n[r]:void 0,(n,r)=>{throw new Error(`cannot set ${r}, no such field`)},{})}mtCursor(t){let i=new Set(["dragging","touchId"]);this.mtIndexNewindex(t,"CursorEventData",(n,r)=>i.has(r)?n[r]:void 0,(n,r)=>{throw new Error(`cannot set ${r}, 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={GetChildren:this.method(n=>{let r=n.GetChildren();return r.__controls=!0,r}),GetChild:this.method((n,r)=>n.GetChild(r)),FindChild:this.method((n,r)=>n.FindChild(r)),SetActive:this.method((n,r)=>n.SetActive(r)),SetVisible:this.method((n,r)=>n.SetVisible(r)),GetSiblingIndex:this.method(n=>n.GetSiblingIndex()),SetSiblingIndex:this.method((n,r)=>n.SetSiblingIndex(r)),SetAsFirstSibling:this.method(n=>n.SetAsFirstSibling()),SetAsLastSibling:this.method(n=>n.SetAsLastSibling()),GetAnchoredPosition:this.method(n=>n.GetAnchoredPosition()),SetAnchoredPosition:this.method((n,r,a)=>n.SetAnchoredPosition(r,a)),GetSizeDelta:this.method(n=>n.GetSizeDelta()),SetSizeDelta:this.method((n,r,a)=>n.SetSizeDelta(r,a)),GetAnchorMin:this.method(n=>n.GetAnchorMin()),SetAnchorMin:this.method((n,r,a)=>n.SetAnchorMin(r,a)),GetAnchorMax:this.method(n=>n.GetAnchorMax()),SetAnchorMax:this.method((n,r,a)=>n.SetAnchorMax(r,a)),GetPivot:this.method(n=>n.GetPivot()),SetPivot:this.method((n,r,a)=>n.SetPivot(r,a)),GetLocalScale:this.method(n=>n.GetLocalScale()),SetLocalScale:this.method((n,r,a,o)=>n.SetLocalScale(r,a,o)),GetLocalRotation:this.method(n=>n.GetLocalRotation()),SetLocalRotation:this.method((n,r,a,o)=>n.SetLocalRotation(r,a,o)),GetScriptByPath:this.method((n,r)=>n.GetScriptByPath(r)),GetScript:this.method((n,r)=>n.GetScript(r)),GetScripts:this.method(n=>{let r=n.GetScripts();return r.__scripts=!0,r}),AddCursorEventListener:this.method((n,r,a)=>n.AddCursorEventListener(Se(r),a)),RemoveCursorEventListener:this.method((n,r,a)=>n.RemoveCursorEventListener(Se(r),a)),RemoveCursorEventListeners:this.method((n,r)=>n.RemoveCursorEventListeners(Se(r))),RemoveAllCursorEventListeners:this.method(n=>n.RemoveAllCursorEventListeners()),SimulateCursorClick:this.method(n=>n.SimulateCursorClick()),AddKeyEventListener:this.method((n,r,a)=>n.AddKeyEventListener(Se(r),a)),RemoveKeyEventListener:this.method((n,r,a)=>n.RemoveKeyEventListener(Se(r),a)),RemoveKeyEventListeners:this.method((n,r)=>n.RemoveKeyEventListeners(Se(r))),RemoveAllKeyEventListeners:this.method(n=>n.RemoveAllKeyEventListeners()),AddNavigationEventListener:this.method((n,r,a)=>n.AddNavigationEventListener(Se(r),a)),RemoveNavigationEventListener:this.method((n,r,a)=>n.RemoveNavigationEventListener(Se(r),a)),RemoveNavigationEventListeners:this.method((n,r)=>n.RemoveNavigationEventListeners(Se(r))),RemoveAllNavigationEventListeners:this.method(n=>n.RemoveAllNavigationEventListeners()),SetControllerNavigation:this.method((n,r,a,o)=>n.SetControllerNavigation(Se(r),a,o)),GetControllerNavigation:this.method((n,r)=>n.GetControllerNavigation(Se(r))),SetImage:this.method((n,r,a)=>n.SetImage(r,a)),SetSoftEdgeWidth:this.method((n,r,a)=>n.SetSoftEdgeWidth(r,a)),SetFillUnused:this.method(n=>n.SetFillUnused()),SetFillHorizontal:this.method((n,r,a)=>n.SetFillHorizontal(r,a)),SetFillVertical:this.method((n,r,a)=>n.SetFillVertical(r,a)),SetFillRadial90:this.method((n,r,a)=>n.SetFillRadial90(r,a)),SetFillRadial180:this.method((n,r,a)=>n.SetFillRadial180(r,a)),SetFillRadial360:this.method((n,r,a)=>n.SetFillRadial360(r,a)),PlayAnimation:this.method(n=>n.PlayAnimation()),StopAnimation:this.method(n=>n.StopAnimation()),RefreshItems:this.method((n,r,a)=>{this.retainLuaCallback(a);try{n.RefreshItems(r,a)}finally{this.unrefLuaCallback(a)}}),GetItemIndex:this.method((n,r)=>n.GetItemIndex(r)),GetItemSize:this.method(n=>n.GetItemSize()),GetItemSpacing:this.method(n=>n.GetItemSpacing()),GetPadding:this.method(n=>n.GetPadding()),ScrollToItemAt:this.method((n,r,a)=>n.ScrollToItemAt(r,a)),GetContentLength:this.method(n=>n.GetContentLength())};this.mtIndexNewindex(t,"Control",(n,r)=>{if(!Mn(n,r))return;if(!n.alive&&r!=="alive")throw new Error(`attempt to read '${r}' of a destroyed control`);let a=n.luaFieldValue(r),o=Pa[r];return o?On(o,a):typeof a=="number"&&!ts.has(r)&&!is.has(r)?new ni(a):a},(n,r,a)=>{if(Mn(n,r)==="rw"){if((r==="fontSize"||r==="minimumFontSize")&&!Number.isInteger(a)){let u=a===null?"nil":typeof a;throw new Error(`bad argument #2 to '${r}' (integer expected, got ${u})`)}let l=Pa[r];if(r==="imageType"&&(a?.EnumType!=="ImageType"||!["Basic","Stretch"].includes(a.Name)))throw new Error("imageType requires Enum.ImageType.Basic or Stretch");n[r]=l?On(l,a):a,typeof n.markPlayDirty=="function"&&n.markPlayDirty(Ni.has(r));return}throw new Error(`cannot set ${r}, no such field`)},i,ka)}mtScript(t){let i=this,n=new Set(["alive","scriptMappingId","object","path","enabled"]);this.mtIndexNewindex(t,"Script",(r,a)=>n.has(a)?r[a]:void 0,(r,a,o)=>{if(a==="enabled"){r.enabled=!!o;return}throw new Error(`cannot set ${a}, no such field`)},{GetParam:this.method((r,a)=>Object.prototype.hasOwnProperty.call(r.params,a)?r.params[a]:null),Invoke:r=>i.luaInvoke(r),EnableUpdate:this.method((r,a)=>{r.updateEnabled=!!a}),RegisterServerSignalHandler:this.method((r,a,o)=>{i.signalHandlers.push({script:r,name:a,fn:o})}),UnregisterServerSignalHandler:this.method((r,a)=>{i.signalHandlers=i.signalHandlers.filter(o=>!(o.script===r&&o.name===a))}),RegisterCustomVariableChangedHandler:this.method((r,a,o,l)=>{i.varHandlers.push({script:r,entityType:Se(a),name:o,fn:l})}),UnregisterCustomVariableChangedHandler:this.method((r,a,o)=>{let l=Se(a);i.varHandlers=i.varHandlers.filter(u=>!(u.script===r&&u.entityType===l&&u.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,r)=>i.Insert(n,r)),InsertCallback:this.method((i,n,r)=>i.InsertCallback(n,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,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,r)=>i.AddParam(n,r)),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=W(t,1),n=this.normalizeRequirePath(i),r=this.requireAliases.get(n)||n;c.lua_rawgeti(t,mt,c.LUA_RIDX_MAINTHREAD);let a=c.lua_tothread(t,-1);c.lua_pop(t,1);let o=this.requireCache.get(a);o||(o=new Map,this.requireCache.set(a,o));let l=o.get(r);if(l?.loading)return c.lua_pushstring(t,P(`failed to load script '${n}': cyclic require`)),c.lua_error(t);if(l&&l.ref!=null)return c.lua_rawgeti(t,mt,l.ref),1;let u=this.scriptFiles.get(r);if(u==null)return c.lua_pushstring(t,P(`failed to load script '${n}'`)),c.lua_error(t);let s=c.lua_gettop(t);o.set(r,{loading:!0});try{this.loadModule(t,a,r,u),c.lua_pushvalue(t,-1);let f=Q.luaL_ref(t,mt);return o.set(r,{ref:f}),1}catch(f){return o.delete(r),c.lua_settop(t,s),c.lua_pushstring(t,P(`failed to load script '${n}': ${f.message||f}`)),c.lua_error(t)}}newLuaThread(){let t=Q.luaL_newstate();return ha.luaL_openlibs(t),va(t),this.installMetatables(t),this.installGlobals(t),this.luaStates.add(t),c.lua_pushglobaltable(t),this.copyLuaEnvironment(t,-1),c.lua_remove(t,-2),this.moduleBaseEnvironments.set(t,Q.luaL_ref(t,mt)),t}copyLuaEnvironment(t,i){let n=c.lua_absindex(t,i);c.lua_newtable(t);let r=c.lua_absindex(t,-1);for(c.lua_pushnil(t);c.lua_next(t,n)!==0;)c.lua_pushvalue(t,-2),c.lua_pushvalue(t,-2),c.lua_rawset(t,r),c.lua_pop(t,1);c.lua_pushvalue(t,r),c.lua_setfield(t,r,P("_G"))}closeTrackedLuaState(t){if(!t||!this.luaStates.has(t))return;for(let n of this.requireCache.get(t)?.values()||[])n.ref!=null&&Q.luaL_unref(t,mt,n.ref);this.requireCache.delete(t);let i=this.moduleBaseEnvironments.get(t);if(i!=null&&Q.luaL_unref(t,mt,i),this.moduleBaseEnvironments.delete(t),this.luaStates.delete(t),this.luaFunctions)for(let[n,r]of this.luaFunctions)r.__luaState===t&&this.luaFunctions.delete(n);ba(t)}loadModule(t,i,n,r){let a={__kind:"Script",alive:!0,scriptMappingId:this.resolveScriptMappingId(),object:null,path:n,enabled:!0,updateEnabled:!1,params:{},env:t,invoke(){}},o=String(r).replace(/^\uFEFF/,""),l=Ri(o);if(Q.luaL_loadbuffer(t,l,l.length,P(`@${n}`))!==Me)throw new Error(W(t,-1));let s=c.lua_absindex(t,-1);if(c.lua_rawgeti(t,mt,this.moduleBaseEnvironments.get(i)),this.copyLuaEnvironment(t,-1),c.lua_remove(t,-2),this.pushScript(t,a),c.lua_setfield(t,-2,P("script")),c.lua_setupvalue(t,s,1),c.lua_pcall(t,0,1,0)!==Me)throw new Error(W(t,-1))}mountScript({path:t,source:i,control:n,params:r={},scriptMappingId:a=void 0}){this.L||this.boot();let o=this.newLuaThread(),l={__kind:"Script",alive:!0,scriptMappingId:this.resolveScriptMappingId(a),object:n,path:this.normalizeRequirePath(t),enabled:!0,updateEnabled:!1,params:r,env:o,lifecyclePhase:"idle"};l.invoke=(s,f)=>this.invokeOn(o,s,f),n&&n.scripts.push(l),this.mountedScripts.push(l),this.pushScript(o,l),c.lua_setglobal(o,P("script"));let u=this.lifecyclePhase;try{this.lifecyclePhase="OnInit",l.lifecyclePhase="OnInit",this.runChunk(o,i,t);let s=this.callGlobal(o,"OnInit");s&&this.mountErrors.push(s),this.lifecyclePhase="OnEnable",l.lifecyclePhase="OnEnable";let f=this.callGlobal(o,"OnEnable");f&&this.mountErrors.push(f),this.lifecyclePhase="OnStart",l.lifecyclePhase="OnStart";let h=this.callGlobal(o,"OnStart");return h&&this.mountErrors.push(h),this.lifecyclePhase="running",l.lifecyclePhase="running",l}catch(s){throw l.alive=!1,l.lifecyclePhase="failed",this.mountedScripts=this.mountedScripts.filter(f=>f!==l),n&&(n.scripts=n.scripts.filter(f=>f!==l)),this.varHandlers=this.varHandlers.filter(f=>f.script!==l),this.signalHandlers=this.signalHandlers.filter(f=>f.script!==l),this.lifecyclePhase=u,o&&o!==this.L&&this.closeTrackedLuaState(o),l.env=null,s}}runChunk(t,i,n){let r=String(i).replace(/^\uFEFF/,""),a=Ri(r),o=Q.luaL_loadbuffer(t,a,a.length,P(`@${n}`));if(o!==Me){let u=W(t,-1)||`luaL_loadbuffer status ${o}`;throw c.lua_pop(t,1),new Error(u)}let l=c.lua_pcall(t,0,0,0);if(l!==Me){let u=W(t,-1)||`lua_pcall status ${l}`;throw c.lua_pop(t,1),new Error(u)}}callGlobal(t,i){if(c.lua_getglobal(t,P(i)),c.lua_isfunction(t,-1)){if(c.lua_pcall(t,0,0,0)!==Me){let r=W(t,-1);c.lua_pop(t,1);let a=`${i}: ${r}`;return this.log("lua-error",a),a}}else c.lua_pop(t,1);return null}callGlobalDt(t,i,n){if(c.lua_getglobal(t,P(i)),c.lua_isfunction(t,-1)){if(c.lua_pushnumber(t,n),c.lua_pcall(t,1,0,0)!==Me){let a=W(t,-1);c.lua_pop(t,1),this.log("lua-error",`${i}: ${a}`)}}else c.lua_pop(t,1)}luaInvoke(t){let i=Ue(t,1);if(!i||i.__kind!=="Script")return Q.luaL_error(t,P("bad self to 'Invoke' (Script expected)"));let n=W(t,2),r=i.env;if(!r||r.l_G!==t.l_G){let u=[];for(let h=3;h<=c.lua_gettop(t);h++)u.push(ye(t,this,h));let s;try{s=i.invoke(n,u)}catch(h){return Q.luaL_error(t,P(String(h.message||h)))}if(s===void 0)return 0;let f=Array.isArray(s)&&s.__multi?s:[s];for(let h of f)oe(t,this,h);return f.length}let a=2;if(c.lua_getglobal(t,P(n)),!c.lua_isfunction(t,-1))return 0;c.lua_replace(t,a),c.lua_remove(t,1);let o=c.lua_gettop(t)-1;return c.lua_pcall(t,o,Ra,0)!==Me?c.lua_error(t):c.lua_gettop(t)}invokeOn(t,i,n){let r=c.lua_gettop(t);if(c.lua_getglobal(t,P(i)),!c.lua_isfunction(t,-1)){c.lua_settop(t,r);return}for(let u of n)oe(t,this,u);if(c.lua_pcall(t,n.length,Ra,0)!==Me){let u=W(t,-1);throw c.lua_settop(t,r),new Error(u)}let o=c.lua_gettop(t)-r;if(o<=0){c.lua_settop(t,r);return}if(o===1){let u=ye(t,this,-1);return c.lua_settop(t,r),u}let l=[];for(let u=1;u<=o;u++)l.push(ye(t,this,r+u));return c.lua_settop(t,r),l.__multi=!0,l}runScriptPhase(t,i){for(let n of this.mountedScripts){if(!this.scriptCanRun(n))continue;let r=n.env;r&&(this.pushScript(r,n),c.lua_setglobal(r,P("script")),!(t==="OnUpdate"&&!n.updateEnabled)&&this.callGlobalDt(r,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,r]of this.audios)this.clock.time+1e-9>=r.startedAt+r.duration&&(r.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 r of[...n.children])if(i(r))return!0;return!1};for(let n of[...this.roots])i(n)}injectCursor(t,i,n){let r=n||this.makeCursorEventData({});Number.isFinite(r.x)&&Number.isFinite(r.y)&&(this.cursor.x=r.x,this.cursor.y=r.y),t.emitCursor(i,r)}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 r=this.serverVars[t]||(this.serverVars[t]=Object.create(null));r[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;c.lua_createtable(n,0,5);let r=(a,o)=>{c.lua_pushcfunction(n,o),c.lua_setfield(n,-2,P(a))};return r("var",a=>(oe(a,this,i.var(W(a,1),W(a,2))),1)),r("logContains",a=>(c.lua_pushboolean(a,i.logContains(W(a,1))),1)),r("control",a=>(oe(a,this,i.control(W(a,1))),1)),r("logs",a=>(oe(a,this,i.logs()),1)),r("signals",a=>(oe(a,this,i.signals(W(a,1))),1)),r("serverLogs",a=>(oe(a,this,i.serverLogs?i.serverLogs():[]),1)),r("serverLogContains",a=>{let o=i.serverLogContains;return c.lua_pushboolean(a,o?!!o(W(a,1)):!1),1}),c.lua_setglobal(n,P("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 si(e){let t=new $i(e);return t.boot(),t}var gt=Object.freeze(Array.from({length:8},(e,t)=>`Player${t+1}`)),Dn=Object.freeze(Array.from({length:8},(e,t)=>`Avatar${t+1}`)),Da=Object.freeze(["Level","PlayerSelf","AvatarSelf"]);var $n=Object.freeze([...Da,...gt,...Dn]),Va=Object.freeze(["PlayerSelf","AllPlayers",...gt]),rs=Object.freeze(["Level","PlayerSelf",...gt]),Ma=Object.freeze(["Int","Float","String","Bool","Vector3","Entity","Guid","PrefabId","ConfigId","IntList","FloatList","StringList","BoolList","Vector3List","EntityList","GuidList","PrefabIdList","ConfigIdList","Dict","Struct"]),as=-2147483648,os=2147483647,ls=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 ui(e){return`Player${Number(e)}`}function Gi(e){return`Avatar${Number(e)}`}function Na(e){let t=String(e||"").match(/^(?:Player|Avatar)([1-8])$/);return t?Number(t[1]):0}function pt(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 je(e,t=8){let i=pt(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 Fa(){let e={Level:Object.create(null),PlayerSelf:Object.create(null),AvatarSelf:Object.create(null)};for(let t of gt)e[t]=Object.create(null);for(let t of Dn)e[t]=Object.create(null);return e}function Ya(e){let t=String(e||"");if(!$n.includes(t))throw new Error(`unknown CustomVariableEntityType: ${e}`);return t}function ss(e,t){let i=Ya(e);if(!rs.includes(i))throw new Error(`${t}.entityType must be Level, PlayerSelf, or Player1-8`);return i}function ci(e){let t=String(e??"");if(!t)throw new Error("custom variable name is required");return t}function Di(e){let t=String(e??"");if(!t)throw new Error("signal name is required");return t}function Gn(e){let t=String(e||"PlayerSelf");if(!Va.includes(t))throw new Error(`unsupported client signal target: ${e}. use PlayerSelf, AllPlayers, or Player1-8`);return t}function fi(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=fi(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 Ie(e){return e===void 0?null:JSON.parse(JSON.stringify(e))}function Oa(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 za(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:fi(t),value:t}):[]}function us(e){return String(e?.kind||e?.type||e?.name||e?.id||"")}function Vi(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xa(e,t){if(!Vi(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 $a(e,t){return Xa(e,t)||Ie(e)}function cs(e,t,i){if(!Vi(e))throw new Error(`serverLogic.rules[${t}].actions[${i}] must be an object`);let n=String(e.kind||e.type||""),r=`serverLogic.rules[${t}].actions[${i}]`;if(n==="setCustomVariable"){let a=ss(e.entityType,r);if(!Object.prototype.hasOwnProperty.call(e,"value"))throw new Error(`${r}.value is required`);return{kind:n,entityType:a,name:ci(e.name),value:$a(e.value,`${r}.value`),...e.variableType?{variableType:String(e.variableType)}:{}}}if(n==="sendClientScriptSignal"){if(!Array.isArray(e.params))throw new Error(`${r}.params must be an array`);return{kind:n,target:Gn(e.target),signalName:Di(e.signalName),params:e.params.map((a,o)=>$a(a,`${r}.params[${o}]`))}}throw new Error(`${r}.kind must be setCustomVariable or sendClientScriptSignal`)}function di(e){if(e==null)return{version:1,rules:[]};if(!Vi(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(!Vi(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:Di(i.signalName),actions:i.actions.map((r,a)=>cs(r,n,a))}})}}function Ga(e,t,{typed:i=!1}={}){let n=Xa(e,"server logic value");if(n){let r=i?t.params:t.values;if(n.fromSignalParam>=r.length)throw new Error(`signal ${t.name} has no parameter at index ${n.fromSignalParam}`);return Ie(r[n.fromSignalParam])}return Ie(e)}function fs(e){return e==="Level"?"Level":gt.includes(e)?"PlayerSelf":Dn.includes(e)?"AvatarSelf":e}function Ba(e={}){let t=Fa(),i=Fa(),n=[],r=[],a=[],o=[],l=Array.from({length:9},()=>null),u=1,s=0,f=Number(e.onlineLatencyMs||0);(!Number.isFinite(f)||f<0)&&(f=0);let h=di(e.logic),p=pt(e.playerCount),g=je(e.viewPlayerIndex,p);function m(v,E){o.push({source:"server",level:String(v||"engine"),text:String(E),time:s})}function y(v){let E=l[v||g],w=Number(E?.clock?.time);Number.isFinite(w)&&(s=w)}function I(v,E,w,C){t[v][E]=w,i[v][E]={type:C||fi(w)||i[v][E]?.type||""}}function A(v,E,w){return typeof w!="number"||!Number.isInteger(w)?{ok:!0,value:w}:w>=as&&w<=os?{ok:!0,value:w}:(m("engine",`Int custom variable ${v}.${E} out of range ${w}; keeping previous legal value`),{ok:!1,value:t[v][E]})}function x(v,E){let w=Ya(v),C=E||g;return w==="PlayerSelf"?ui(C):w==="AvatarSelf"?Gi(C):w}function G(v,E){let w=fs(v);if(v==="Level"){for(let k=1;k<=p;k+=1){let _=l[k];_&&typeof _.notifyVarHandlers=="function"&&_.notifyVarHandlers("Level",E)}return}let C=Na(v);if(!C)return;let O=l[C];O&&typeof O.notifyVarHandlers=="function"&&O.notifyVarHandlers(w,E)}function z(v,E){let w=Gn(v);return w==="AllPlayers"?Array.from({length:p},(C,O)=>O+1):w==="PlayerSelf"?[E||g]:[Na(w)]}function q(v){for(let E of h.rules)if(E.signalName===v.name)for(let w of E.actions){if(w.kind==="setCustomVariable"){let C=Ga(w.value,v);$.setVar(w.entityType,w.name,C,{type:w.variableType,playerIndex:v.playerIndex}),m("info",`logic ${E.id}: set ${w.entityType}.${w.name}`);continue}if(w.kind==="sendClientScriptSignal"){let C=w.params.map(O=>Ga(O,v,{typed:!0}));$.sendToClient(w.signalName,C,{target:w.target,playerIndex:v.playerIndex}),m("info",`logic ${E.id}: sent ${w.signalName} to ${w.target}`)}}}function J(v,E){v&&(v.serverBridge={getVar:(w,C)=>$.getVar(w,C,{playerIndex:E}),setVar:(w,C,O)=>$.setVar(w,C,O,{playerIndex:E}),receiveFromClient:(w,C)=>$.receiveFromClient(w,C,{playerIndex:E})})}function H(v){v&&(v.serverBridge=null)}let $={ENTITY_TYPES:Da,ALL_ENTITY_TYPES:$n,CLIENT_SIGNAL_TARGETS:Va,get clock(){return s},get playerCount(){return p},get viewPlayerIndex(){return g},setClock(v){s=Number(v)||0},setPlayerCount(v){return p=pt(v),g>p&&(g=p),p},setViewPlayerIndex(v){return g=je(v,p),g},log(v,E){m(v,E)},defineVar(v,E,w={},{playerIndex:C}={}){let O=x(v,C),k=ci(E);if(Object.prototype.hasOwnProperty.call(t[O],k))throw new Error(`custom variable already exists: ${O}.${k}`);let _=w.type?String(w.type):fi(w.value??w.defaultValue);if(_&&!Ma.includes(_))throw new Error(`unsupported custom variable type: ${_}`);let D=w.value!==void 0?w.value:w.defaultValue!==void 0?w.defaultValue:null;return I(O,k,D,_),$.getVar(O,k)},getVar(v,E,{playerIndex:w}={}){let C=x(v,w),O=ci(E);if(!Object.prototype.hasOwnProperty.call(t[C],O)){m("engine",`GetGlobalCustomVariableValue missing ${C}.${O}; returning nil (simulator policy)`);return}return t[C][O]},setVar(v,E,w,{notify:C=!0,type:O,playerIndex:k}={}){let _=x(v,k),D=ci(E),Y=O||i[_][D]?.type||fi(w);if(Y&&!Ma.includes(Y)&&Y!=="")throw new Error(`unsupported custom variable type: ${Y}`);let ue=w;if(!((Y==="Int"||Y===""&&typeof w=="number"&&Number.isInteger(w))&&(ue=A(_,D,w).value,ue===void 0)))return I(_,D,ue,Y),C&&G(_,D),ue},listVars(v){let E=v?[x(v)]:["Level",...Array.from({length:p},(C,O)=>ui(O+1)),...Array.from({length:p},(C,O)=>Gi(O+1))],w=[];for(let C of E)for(let O of Object.keys(t[C]))w.push({entityType:C,name:O,type:i[C][O]?.type||"",value:Ie(t[C][O])});return w},receiveFromClient(v,E=[],{playerIndex:w}={}){let C=je(w||g,p);y(C);let O=Di(v),k={id:u++,direction:"inbound",name:O,params:za(E),values:Oa(E),time:s,playerIndex:C,from:ui(C)};return n.push(k),q(k),k},sendToClient(v,E=[],{target:w="PlayerSelf",playerIndex:C}={}){let O=Di(v),k=Gn(w),D=z(k,C||g),Y={id:u++,direction:"outbound",name:O,params:za(E),values:Oa(E),time:s,target:k,players:D,deliverAt:s+f/1e3,delivered:!1};return r.push(Y),f===0?$.deliver(Y):a.push(Y),Y},getLogic(){return Ie(h)},setLogic(v){return h=di(v),$.getLogic()},deliver(v){if(!v||v.delivered)return;v.delivered=!0;let E=Array.isArray(v.players)&&v.players.length?v.players:z(v.target);for(let w of E){let C=l[w];C&&typeof C.sendClientSignal=="function"&&C.sendClientSignal(v.name,v.values)}},flush(v){v!==void 0&&(s=Number(v)||0);let E=[];for(let w=a.length-1;w>=0;w-=1)a[w].deliverAt<=s&&E.push(a.splice(w,1)[0]);E.sort((w,C)=>w.id-C.id);for(let w of E)$.deliver(w);return E},inbound(){return n.slice()},outbound(){return r.slice()},loadConfig(v){if(v!=null){if(typeof v!="object")throw new Error("server config must be an object");if(v.graph&&!Array.isArray(v.nodes))throw new Error("unsupported server node graph: v1 only accepts custom variables and signals");for(let E of v.nodes||[]){let w=us(E);if(!ls.has(w))throw new Error(`unsupported server node: ${w||JSON.stringify(E)}. v1 only supports custom variables and signals`)}if(v.onlineLatencyMs!==void 0){let E=Number(v.onlineLatencyMs);if(!Number.isFinite(E)||E<0)throw new Error("onlineLatencyMs must be a non-negative finite number");f=E}v.playerCount!==void 0&&$.setPlayerCount(v.playerCount),v.viewPlayerIndex!==void 0&&$.setViewPlayerIndex(v.viewPlayerIndex),(v.logic!==void 0||v.serverLogic!==void 0)&&$.setLogic(v.logic??v.serverLogic);for(let E of v.vars||[]){let w=x(E.entityType),C=ci(E.name);Object.prototype.hasOwnProperty.call(t[w],C)?$.setVar(w,C,E.value??E.defaultValue,{notify:!1,type:E.type}):$.defineVar(w,C,E)}}},attachRuntime(v,{playerIndex:E=1}={}){let w=je(E,8);return l[w]&&l[w]!==v&&H(l[w]),l[w]=v||null,J(l[w],w),$},attachRuntimes(v){$.detachRuntime();let E=Array.isArray(v)?v:[];for(let w=0;w<E.length&&w<8;w+=1)l[w+1]=E[w]||null,J(l[w+1],w+1);return $},detachRuntime(){for(let v=1;v<=8;v+=1)H(l[v]),l[v]=null},snapshot(){let v=ui(g),E=Gi(g),w={Level:{},PlayerSelf:{},AvatarSelf:{}};for(let C of Object.keys(t.Level))w.Level[C]={type:i.Level[C]?.type||"",value:Ie(t.Level[C])};for(let C of Object.keys(t[v]))w.PlayerSelf[C]={type:i[v][C]?.type||"",value:Ie(t[v][C])};for(let C of Object.keys(t[E]))w.AvatarSelf[C]={type:i[E][C]?.type||"",value:Ie(t[E][C])};for(let C=1;C<=p;C+=1){let O=ui(C),k=Gi(C);w[O]={},w[k]={};for(let _ of Object.keys(t[O]))w[O][_]={type:i[O][_]?.type||"",value:Ie(t[O][_])};for(let _ of Object.keys(t[k]))w[k][_]={type:i[k][_]?.type||"",value:Ie(t[k][_])}}return{clock:s,onlineLatencyMs:f,playerCount:p,viewPlayerIndex:g,logic:$.getLogic(),vars:w,inbound:n.map(C=>({id:C.id,name:C.name,params:Ie(C.params),values:Ie(C.values),time:C.time,playerIndex:C.playerIndex,from:C.from})),outbound:r.map(C=>({id:C.id,name:C.name,params:Ie(C.params),values:Ie(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 v of $n){for(let E of Object.keys(t[v]))delete t[v][E];for(let E of Object.keys(i[v]))delete i[v][E]}n.length=0,r.length=0,a.length=0,o.length=0,u=1,s=0},destroy(){$.detachRuntime(),$.reset()}};e.config&&$.loadConfig(e.config);for(let v of e.vars||[])$.defineVar(v.entityType,v.name,v);return $}var ds={container:"container",textbox:"textbox",image:"image",button:"button",cursor:"cursor",grid:"grid",reference:"reference",textwindow:"textwindow",keyhint:"keyhint",animation:"animation",fullscreen:"fullscreen"};function Vn(e,t,i=null){let n=Ze(e.transformByPlatform,t),r={authoringId:e.id,kind:ds[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=>Vn(o,t,i))},a=i?.get(e.id);return a?.length&&(r.scripts=a.map(o=>{let l=Number(o.guid);return{path:o.path||o.id,source:o.source||"",...Number.isSafeInteger(l)&&l>0?{scriptMappingId:l}:{}}})),e.kind==="container"&&(r.isolateNavigation=e.isolateNavigation===!0,r.disableKeyEventPassthrough=e.disableKeyEventPassthrough===!0,r.disableCursorEventPassthrough=e.disableCursorEventPassthrough===!0,r.showCursor=e.showCursor===!0),(e.kind==="textbox"||e.kind==="textwindow")&&(r.text=e.text??"",r.fontSize=e.fontSize,r.adaptiveFontSize=e.adaptiveFontSize===!0,r.minimumFontSize=e.minimumFontSize,r.fontColor=e.fontColor,r.bgColor=e.bgColor,r.enableOutline=e.enableOutline!==!1,r.outlineColor=e.outlineColor,r.horizontalAlignment=e.horizontalAlignment||"Left",r.verticalAlignment=e.verticalAlignment||"Top",e.kind==="textwindow"&&(r.interactable=e.interactable!==!1,r.showScrollBar=e.showScrollBar!==!1)),e.kind==="image"&&(r.imageSource=e.imageSource,r.imageType=e.imageType??null,r.imageId=e.imageId??0,r.imageColor=e.imageColor,r.raycastTarget=e.raycastTarget===!0,r.enableMask=e.enableMask===!0,r.enableSoftEdge=e.enableSoftEdge===!0,r.softEdgeMode=e.softEdgeMode,r.softEdgeWidthX=e.softEdgeWidthX,r.softEdgeWidthY=e.softEdgeWidthY,r.horizontalSoftRange=e.horizontalSoftRange,r.verticalSoftRange=e.verticalSoftRange,r.enableFill=e.enableFill===!0,r.fillType=e.enableFill?e.fillType:"Unused",r.fillHorizontalType=e.fillHorizontalType,r.fillVerticalType=e.fillVerticalType,r.fillRadial90Type=e.fillRadial90Type,r.fillRadialType=e.fillRadialType,r.fillAmount=e.fillAmount,r.reverseMaskArea=e.reverseMaskArea===!0),e.kind==="button"&&(r.raycastTarget=e.raycastTarget!==!1,r.interactable=e.interactable!==!1,r.clickAudioId=e.clickAudioId,r.unavailableChildId=e.unavailableChildId??null,r.hoverChildId=e.hoverChildId??null,r.pressedChildId=e.pressedChildId??null,r.selectedChildId=e.selectedChildId??null),e.kind==="cursor"&&(r.raycastTarget=e.raycastTarget!==!1),e.kind==="reference"&&(r.referencedPrefabIndex=e.referencedPrefabId),e.kind==="grid"&&(r.itemPrefabIndex=e.itemPrefabId,r.raycastTarget=e.raycastTarget!==!1,r.interactable=e.interactable!==!1,r.showScrollBar=e.showScrollBar!==!1,r.scrollDirection=e.scrollDirection,r.layoutConstraint=e.layoutConstraint,r.layoutConstraintFixedCount=e.layoutConstraintFixedCount,r.cellSizeX=e.cellSizeX,r.cellSizeY=e.cellSizeY,r.spacingX=e.spacingX,r.spacingY=e.spacingY,r.padding1X=e.padding1X,r.padding1Y=e.padding1Y,r.padding2X=e.padding2X,r.padding2Y=e.padding2Y,r.previewCount=e.previewCount),e.kind==="keyhint"&&(r.keyboardKeyCode=e.keyboardKeyCode,r.controllerKeyCode=e.controllerKeyCode),(e.kind==="animation"||e.kind==="fullscreen")&&(r.raycastTarget=!1,r.animationId=e.animationId,r.playSoundEffect=e.playSoundEffect,e.kind==="animation"&&(r.layer=e.layer)),r}function Yn(e,t=[],i=""){let n=i&&ie[i]?i:e.canvasId,r=ie[n],a=Qt(e),o=new Map;for(let u of t){if(!u.controlId)continue;let s=o.get(u.controlId)||[];s.push(u),o.set(u.controlId,s)}let l=e.meta?.assetType==="client-control-template"?(e.root.children||[]).map(u=>Vn(u,n,o)):[];return{canvasId:n,platform:r.platform,device:r.luaDevice,canvasWidth:r.width,canvasHeight:r.height,root:Vn(a,n,o),templates:l}}var Yi="qxqy-autotest";var bt=.03333333333333333,hs=new Set(["pointer","key","click","pause","resume","serverSet","serverSend","view"]),ms=new Set(["log","control","var","signal","tree","lua"]);function yt(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 Xi(e,t){if(!e||typeof e!="object")throw new Error(`events[${t}] must be an object`);let i=String(e.kind||e.do||"");if(!hs.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=yt(n.x,"pointer.x"),n.y=yt(n.y,"pointer.y"),n.type=String(n.type||"click"),n.type==="wheel"&&(n.deltaX=yt(n.deltaX??e.deltaX??0,"pointer.deltaX"),n.deltaY=yt(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:yt(e.t??0,"event.t"),source:String(e.source||"user"),kind:i,payload:n}}function Bn(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(!ms.has(i))throw new Error(`unsupported assert kind: ${i||"(empty)"}`);let n={kind:i};if(e.at!==void 0&&(n.at=yt(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=Xn(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=Xn(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=Xn(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 Ua(e){let t=0,i=[],n=[];for(let r of e){if(!r||typeof r!="object")throw new Error("queue step must be an object");if(r.do!=="start"){if(r.do==="step"){t+=yt(r.dt??bt,"step.dt");continue}if(r.do==="pointer"||r.do==="key"||r.do==="click"||r.do==="pause"||r.do==="resume"||r.do==="serverSet"||r.do==="serverSend"||r.do==="view"){i.push(Xi({...r,kind:r.do,t},i.length));continue}if(r.assert||r.check||r.kind){n.push(Bn({...r.assert||r,at:r.at??t},n.length));continue}throw new Error(`unsupported queue step: ${JSON.stringify(r)}`)}}return{events:i,asserts:n,dt:bt}}function hi(e){if(Array.isArray(e)){let n=Ua(e);return{format:Yi,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=Ua(e.queue||e.steps);return{format:Yi,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,r)=>Xi(n,r)),i=(e.asserts||[]).map((n,r)=>Bn(n,r));return t.sort((n,r)=>n.t-r.t||0),{format:Yi,version:1,name:String(e.name||""),dt:Number(e.dt)>0?Number(e.dt):bt,playerCount:Number(e.playerCount)>0?Number(e.playerCount):1,events:t,asserts:i}}function ja(e,t={}){let i=(e||[]).map((n,r)=>Xi(n,r));return{format:Yi,version:1,name:String(t.name||""),dt:Number(t.dt)>0?Number(t.dt):bt,playerCount:Number(t.playerCount)>0?Number(t.playerCount):1,events:i,asserts:(t.asserts||[]).map((n,r)=>Bn(n,r))}}function Ha(e,t,i){if(!e)return null;let n=Xi({...t,t:t.t??i??0},e.events.length);return e.events.push(n),n}import{createCanvas as ps}from"@napi-rs/canvas";var Ka=ps(1,1).getContext("2d"),gs='"Microsoft YaHei UI","Microsoft YaHei",sans-serif',Bi=(e,t)=>Math.max(0,Math.min(t,Number.isFinite(e)?e:0));function qa(e,t,i){let n=Math.max(8,Number(e.fontSize)||12),r=String(e.text??"").replace(/\r\n?/g,`
|
|
109
|
-
`),a=JSON.stringify([r,t,i,n,e.showScrollBar]),o=e._textWindowLayout;if(o?.key!==a){Ka.font=`${n}px ${gs}`;let s=g=>{let m=[];for(let y of r.split(`
|
|
110
|
-
`)){let I="";for(let A of y)I&&Ka.measureText(I+A).width>g&&(m.push(I),I=""),I+=A;m.push(I)}return m},f=s(Math.max(1,t-4)),h=e.showScrollBar!==!1&&f.length*n*1.2>i,p=Math.max(1,t-4-(h?12:0));h&&(f=s(p)),o=e._textWindowLayout={key:a,lines:f,font:n,textWidth:p,lineHeight:n*1.2,length:f.length*n*1.2}}let l=Math.max(0,o.length-i),u=Bi(e._scrollOffset||0,l);return e._scrollOffset=u,{...o,max:l,offset:u,viewport:i,horizontal:!1,width:t,height:i}}function Ui(e,t,i){if(!e?.showBar||e.max<=0||t<=0||i<=0)return null;let n=e.horizontal===!0,r=n?t:i,a=Math.max(0,r-4),o=Math.min(a,Math.max(18,a*r/(r+e.max))),l=a-o,u=l*e.offset/e.max,s=Math.min(8,n?i:t),f=n?{x:-t/2+2,y:i/2-s-2,width:a,height:s}:{x:t/2-s-2,y:-i/2+2,width:s,height:a},h=n?{...f,x:f.x+u,width:o}:{...f,y:f.y+u,height:o};return{track:f,thumb:h,travel:l}}var ys=[[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 La(e){if(!Number.isSafeInteger(e))return null;for(let[t,i]of ys)if(e>=t&&e<t+i.length)return i[e-t];return null}var ji=e=>Number.isFinite(Number(e))?Math.max(0,Number(e)):0;function Wa(e,t){if(!e||e.kind!=="image"||e.enableMask!==!0||!t)return null;let i=ji(e.sourceWidth??e.width),n=ji(e.sourceHeight??e.height),r=e.enableSoftEdge===!0,a=e.softEdgeMode!=="Pixel",o=r?ji(e.softEdgeWidthX):0,l=r?ji(e.softEdgeWidthY):0;return{id:e.id,matrix:t,width:i,height:n,featherX:a?i*o/100:o,featherY:a?n*l/100:l}}function Ja(e,t,i){let n=Te(e,t,i);return{a:e.a,b:e.b,c:e.c,d:e.d,tx:n.x,ty:n.y}}import{randomUUID as to}from"node:crypto";function qi(e){for(let t of e.runtime.scrollControls||[]){let[i,n]=ri(t),r=t.kind==="grid"?Ot(t):qa(t,i,n),a={offset:r.offset,max:r.max,horizontal:r.horizontal,showBar:t.showScrollBar!==!1,textWidth:r.textWidth??0,lines:r.lines||[],lineHeight:r.lineHeight||0,contentLength:r.length},o=JSON.stringify(a);t._scrollKey!==o&&(t._scrollKey=o,t._scroll=a,t.markPlayDirty())}}function io(e){return{...e._scroll?{scroll:e._scroll}:{},...e.parent?._gridItems?.includes(e)?{clipToParent:!0}:{}}}function Un(e,t){let i=e._scroll?.max||0;e.kind==="grid"?e.scrollProgress=i?Bi(t,i)/i:0:e._scrollOffset=Bi(t,i),e.markPlayDirty()}var bs=Object.freeze(Object.values(ie).map(e=>Object.freeze({id:e.id,label:e.label,platform:e.platform,width:e.width,height:e.height})));function Li(e){qi(e);let t=ve({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),i=new Map;function n(r,a,o){let l=Ye(a,r);l.activeInHierarchy=o&&r.active!==!1,i.set(r.Id,l);let u=l.activeInHierarchy;for(let s of r.children)n(s,l,u)}for(let r of e.runtime.roots)n(r,t,!0);return i}function no(e,t=Li(e)){let i=new Map;function n(r,a){let o=t.get(r.Id);if(!o)return;let l=Zt(a,o,r);i.set(r.Id,l);for(let u of r.children)n(u,l)}for(let r of e.runtime.roots)n(r,_t());return i}function ro(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,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"?qe(e.imageSource):null,imageType:e.kind==="image"?e.imageType==null?null:Ne(e.imageType):null,primitive:e.kind==="image"?Et(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=>ro(n,t))}}function vs(){return{pointerDownControl:null,pointerDownPosition:null,pointerLastPosition:null,pointerDragging:!1,pointerHoverControl:null,pointerScroll:null,hoveredControl:null,selectedControl:null,stateRestores:new Map,viewCache:null}}function Ss(e,t,i,n){let r=si({canvasWidth:e.canvasWidth,canvasHeight:e.canvasHeight,device:e.device,audioDuration:La,canSelectImageType:vr,...n?{language:n}:{}});for(let a of[...e.templates||[],...t?.templates||[]])Number.isSafeInteger(a.prefabIndex)&&a.prefabIndex>0&&r.registerTemplate(a.prefabIndex,a);for(let a of i){let o=a.path||a.id,l=a.source||"";o&&l&&r.registerScriptFile(o,l)}return r}var ws=["pointerDownControl","pointerDownPosition","pointerLastPosition","pointerDragging","pointerHoverControl","pointerScroll","hoveredControl","selectedControl","stateRestores","viewCache"];function Is(e){Object.defineProperty(e,"runtime",{configurable:!0,enumerable:!0,get(){return e.runtimes[e.viewPlayerIndex-1]}});for(let t of ws)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 ao(e,{templatesProject:t=null,scripts:i=[],sceneScripts:n=null,templateScripts:r=null,serverConfig:a=null,canvasId:o="",playerCount:l=1,viewPlayerIndex:u=1,language:s=""}={}){let f=n||i,h=r||i,p=Yn(e,f,o),g=t?Yn(t,h,o):null,m=pt(l),y=je(u,m),I=Ba({playerCount:m,viewPlayerIndex:y});a&&I.loadConfig({...a,playerCount:m,viewPlayerIndex:y});let A=[];for(let z=0;z<m;z+=1)A.push(Ss(p,g,i,s));I.attachRuntimes(A);for(let z of A)z.addRoot(p.root);let x={audioSessionId:to(),runtimes:A,views:A.map(()=>vs()),playerCount:m,viewPlayerIndex:y,server:I,compiled:p,mountError:A.find(z=>z.mountErrors[0])?.mountErrors[0]||null,debugPaused:!1,history:{events:[]},recording:!0};Is(x);let G=x.viewPlayerIndex;for(let z=1;z<=m;z+=1)x.viewPlayerIndex=z,Ns(x);return x.viewPlayerIndex=G,x}function qn(e,t){if(!e)throw new Error("play session has not started");let i=je(t,e.playerCount);return i===e.viewPlayerIndex||(nt(e,{kind:"view",payload:{playerIndex:i}}),e.viewPlayerIndex=i,e.viewCache=null,e.server&&e.server.setViewPlayerIndex(i)),i}function nt(e,t){!e?.recording||!e.history||Ha(e.history,{...t,source:t.source||"user"},e.runtime.clock.time)}function xs(e){return e?.history?.events||[]}var Ln=new Set(["image","textbox","textwindow","button","grid"]);function Cs(e,t){let i=Te(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 oo(e){return{fillType:Ne(e.fillType),fillHorizontalType:Ne(e.fillHorizontalType),fillVerticalType:Ne(e.fillVerticalType),fillAmount:e.fillAmount}}function ks(e,t,i){let n=Math.abs(t.width*i.scaleX),r=Math.abs(t.height*i.scaleY),a={id:e.Id,kind:e.kind,name:e.name,left:i.centerX-n/2,bottom:i.centerY-r/2,width:n,height:r,sourceWidth:t.width,sourceHeight:t.height,rotationZ:i.rotationZ,matrix:i.matrix,pressed:e.pressed===!0,...io(e)};return e.kind==="image"&&(a.imageSource=qe(e.imageSource),a.imageType=e.imageType==null?null:Ne(e.imageType),a.primitive=Et(e.imageId,a.imageSource),a.imageColor=e.imageColor,a.imageId=e.imageId,Object.assign(a,oo(e))),(e.kind==="textbox"||e.kind==="textwindow")&&(a.text=e.text??"",a.fontSize=e.fontSize,a.fontColor=e.fontColor,a.bgColor=e.bgColor,a.enableOutline=e.enableOutline===!0,a.outlineColor=e.outlineColor,a.horizontalAlignment=Ne(e.horizontalAlignment),a.verticalAlignment=Ne(e.verticalAlignment)),a}function Es(e,t=Li(e)){let i=[],n=no(e,t);function r(a,o=[],l=[]){let u=t.get(a.Id);if(!u||a.visible===!1||!u.activeInHierarchy)return;let s=n.get(a.Id);if(!s)return;let f=Cs(u,s),h=a.kind==="image"&&a.enableMask===!0?Wa({...lo(a,u),id:a.Id},Ja(s,u.centerX,u.centerY)):null,p=h?[...l,h]:l,g=()=>i.push({...ks(a,u,f),...o.length?{clipPolygons:o}:{},...p.length?{masks:p}:{}});Ln.has(a.kind)&&a.kind!=="grid"&&g();let m=a.children||[];for(let y=m.length-1;y>=0;y-=1){let I=a._gridItems?.includes(m[y])?[...o,[[u.left,u.bottom],[u.right,u.bottom],[u.right,u.top],[u.left,u.top]].map(([A,x])=>Te(s,A,x))]:o;r(m[y],I,p)}a.kind==="grid"&&g()}for(let a of e.runtime.roots)r(a);return i}function lo(e,t){let i={kind:e.kind,name:e.name,sourceWidth:t.width,sourceHeight:t.height,pressed:e.pressed===!0,...io(e)};return e.kind==="image"&&(i.imageSource=qe(e.imageSource),i.imageType=e.imageType==null?null:Ne(e.imageType),i.primitive=Et(e.imageId,i.imageSource),i.imageColor=e.imageColor,i.imageId=e.imageId,Object.assign(i,oo(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.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 As(e,t,i){let n=nn(e,t),r=Te(n,e.centerX,e.centerY);return{a:n.a,b:n.b,c:n.c,d:n.d,tx:r.x-(i?i.centerX:0),ty:r.y-(i?i.centerY:0)}}function so(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.enableOutline,e.outlineColor,e.horizontalAlignment,e.verticalAlignment,JSON.stringify(e.scroll),e.clipToParent].join(" ")}function uo(e,t,i,n,r,a){return{id:e.Id,parent:t,z:r,group:a>=16,matrix:As(n,e,i),...lo(e,n)}}function _s(e){let t=ve({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),i=new Set,n=new Map,r=new Map;function a(u,s,f){let h=Ye(s,u);if(h.activeInHierarchy=f&&u.active!==!1,r.set(u.Id,h),u.visible===!1||!h.activeInHierarchy)return!1;let p=u.children||[],g=Ln.has(u.kind),m=0;for(let y=0;y<p.length;y+=1)a(p[y],h,h.activeInHierarchy)&&(g=!0,m+=1);return g?(i.add(u.Id),n.set(u.Id,m),!0):!1}function o(u,s,f,h){if(!i.has(u.Id))return;let p=r.get(u.Id);l.push(uo(u,s,f,p,h,n.get(u.Id)||0));let g=u.children||[];for(let m=0;m<g.length;m+=1)o(g[m],u.Id,p,m)}let l=[];for(let u=0;u<e.runtime.roots.length;u+=1)a(e.runtime.roots[u],t,!0),o(e.runtime.roots[u],null,null,u);return{nodes:l,childCounts:n}}function Hn(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)Hn(i[n])}function Ts(e,t){let i=ve({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),n=[],r=[],a=t.count,o=e.runtime._playRemoved||[];for(let s=0;s<o.length;s+=1){let f=o[s];t.fingerprints.has(f)&&(r.push(f),t.fingerprints.delete(f),t.childCounts.delete(f),a-=1)}e.runtime._playRemoved=[];function l(s){t.fingerprints.has(s.Id)&&(r.push(s.Id),t.fingerprints.delete(s.Id),t.childCounts.delete(s.Id),a-=1);let f=s.children;for(let h=0;h<f.length;h+=1)l(f[h])}function u(s,f,h,p,g,m){let y=m||s._playDeepDirty===!0,I=y||s._playDirty===!0,A=y||s._playChildDirty===!0;if(!I&&!A)return;if(!(g&&s.active!==!1)||s.visible===!1){l(s);return}let G=Ye(f,s),z=t.childCounts.get(s.Id)||0;if(A){z=0;let E=s.children;for(let w=0;w<E.length;w+=1)u(E[w],G,s.Id,w,!0,y),t.fingerprints.has(E[w].Id)&&(z+=1)}if(!(Ln.has(s.kind)||z>0)){t.fingerprints.has(s.Id)&&(r.push(s.Id),t.fingerprints.delete(s.Id),t.childCounts.delete(s.Id),a-=1);return}let J=t.childCounts.get(s.Id);t.childCounts.set(s.Id,z);let H=z>=16!=(J||0)>=16;if(!I&&!H&&t.fingerprints.has(s.Id))return;let $=uo(s,h,f===i?null:f,G,p,z),v=so($);t.fingerprints.get($.id)!==v&&(t.fingerprints.has($.id)||(a+=1),t.fingerprints.set($.id,v),n.push($))}for(let s=0;s<e.runtime.roots.length;s+=1)u(e.runtime.roots[s],i,null,s,!0,!1);return t.count=a,{changed:n,removed:r,count:a}}function Ps(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:u,childCounts:s}=_s(e);i.rev+=1,i.fingerprints=new Map(u.map(f=>[f.id,so(f)])),i.childCounts=s,i.count=u.length;for(let f of e.runtime.roots)Hn(f);return{format:"tree-v1",revision:i.rev,reset:!0,count:u.length,nodes:u}}let{changed:a,removed:o,count:l}=Ts(e,i);i.rev+=1;for(let u of e.runtime.roots)Hn(u);return{format:"tree-v1",revision:i.rev,reset:!1,count:l,changed:a,removed:o}}function Wn(e,{inspect:t=!1,view:i=!1,paint:n=!1,sceneRev:r,compact:a=!1}={}){qi(e),e.audioSessionId||=to();let o=e.runtime,l=e.compiled,[u,s]=[o.canvasWidth,o.canvasHeight];e.server&&e.server.setClock(o.clock.time);let f=a?o.logs.slice(-100):o.logs,h=xs(e),p=e.server?e.server.snapshot():{vars:{},inbound:[],outbound:[],logs:[]};a&&(p.inbound=p.inbound.slice(-100),p.outbound=p.outbound.slice(-100),p.logs=p.logs.slice(-100));let g={canvasId:l.canvasId,platform:l.platform,device:o.device,canvasWidth:u,canvasHeight:s,canvasPresets:bs,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:o.clock.time,frame:o.clock.frame,paused:!!e.debugPaused,levelTimePaused:!!o.clock.paused,audio:{sessionId:e.audioSessionId,playerIndex:e.viewPlayerIndex||1,...o.audioSnapshot()},mountError:e.mountError||o.mountErrors[0]||null,logs:f.map(m=>({source:"client",level:m.level,text:m.text,time:m.time})),tree:[],paint:[],scene:null,server:p,history:(a?h.slice(-100):h).map(m=>({t:m.t,source:m.source||"user",kind:m.kind,payload:m.payload||{}}))};if(t||n){let m=Li(e);t&&(g.tree=o.roots.map(y=>ro(y,m))),n&&(g.paint=Es(e,m))}return i&&(g.scene=Ps(e,r)),At(g),g}function Wi(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 Jn(e,t){nt(e,{kind:"key",payload:{typeName:String(t)}}),e.runtime.injectKey(t)}function Rs(e,t){let i=null;for(let n of e.runtime.roots)$e(n,r=>{!i&&r.name===t&&(i=r)});return i}function Zn(e,t){nt(e,{kind:"click",payload:{name:String(t)}});let i=Rs(e,t);i&&Qn(i)&&(i.kind==="button"||i.kind==="cursor")&&i.SimulateCursorClick()}function Ms(e,t){return!e||!t?null:e.children.find(i=>i.authoringId===t||i.Id===t)||null}var co={unavailable:"unavailableChildId",hover:"hoverChildId",pressed:"pressedChildId",selected:"selectedChildId"};function fo(e,t){let i=[];for(let[n,r]of Object.entries(co)){let a=t[r]?Ms(t,t[r]):null;a&&i.push({state:n,child:a})}return i}function Ns(e){for(let t of e.runtime.roots)$e(t,i=>{if(i.kind==="button"){for(let{child:n}of fo(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);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 n of fo(e,t))n.child.active=!0,n.child.visible=n.state===i,typeof n.child.markPlayDirty=="function"&&n.child.markPlayDirty(!0)}function jn(e){if(!e)return null;let t=e.parent;return t?.kind==="button"&&Object.values(co).map(n=>t[n]).filter(Boolean).includes(e.authoringId)?t:e}function Qn(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 ho(e){return e.kind==="container"||e.kind==="grid"||e.kind==="textwindow"||e.kind==="reference"||e.kind==="button"}function mo(e,t){let i=e.Id,n=t.get(i);if(n!==void 0)return n;let r=Qn(e);if(!r&&ho(e)){let a=e.children;for(let o=0;o<a.length;o+=1)if(mo(a[o],t)){r=!0;break}}return t.set(i,r),r}function Hi(e,t,i){qi(e);let n=ve({width:e.runtime.canvasWidth,height:e.runtime.canvasHeight}),r=new Map;function a(l,u,s,f){if(!f||l.active===!1||l.visible===!1||!mo(l,r))return null;let h=Ye(u,l),p=Zt(s,h,l),g=Tt(p);if(!g)return null;let m=Te(g,t,i);if(m.x<h.left||m.x>h.right||m.y<h.bottom||m.y>h.top)return null;if(Ki(l)){let y=Ui(l._scroll,h.width,h.height)?.track,I=m.x-h.centerX,A=h.centerY-m.y;if(y&&I>=y.x&&I<=y.x+y.width&&A>=y.y&&A<=y.y+y.height)return l}if(ho(l))for(let y=0;y<l.children.length;y+=1){let I=a(l.children[y],h,p,!0);if(I)return I}return Qn(l)?l:null}let o=_t();for(let l=e.runtime.roots.length-1;l>=0;l-=1){let u=a(e.runtime.roots[l],n,o,!0);if(u)return u}return null}function Dt(e,t,i,{dragging:n=!1,press:r=null,previous:a=null}={}){let o=r||{x:t,y:i},l=a||{x:t,y:i};return e.runtime.makeCursorEventData({x:t,y:i,pressX:o.x,pressY:o.y,deltaX:t-l.x,deltaY:i-l.y,dragging:n})}function Kn(e,t,i){t.kind==="grid"||t.kind==="textwindow"||(t.pressed=i,typeof t.markPlayDirty=="function"&&t.markPlayDirty(),mi(e,t))}function Ki(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 Za(e){for(let t=e;t;t=t.parent)if(Ki(t))return t;return null}function Qa(e,t,i,n){let r=Li(e),a=r.get(t.Id),o=no(e,r).get(t.Id),l=o&&Tt(o);if(!a||!l)return null;let u=Te(l,i,n);return{x:u.x-a.centerX,y:a.centerY-u.y,width:a.width,height:a.height}}function eo(e,t,i){let n=e.pointerDownControl;if(n?.alive){let r=Dt(e,t,i,{dragging:e.pointerDragging,press:e.pointerDownPosition,previous:e.pointerLastPosition});e.runtime.injectCursor(n,"CursorUp",r),e.pointerDragging&&!e.pointerScroll&&e.runtime.injectCursor(n,"CursorEndDrag",r),Kn(e,n,!1)}e.pointerDownControl=null,e.pointerScroll=null,e.pointerDownPosition=null,e.pointerDragging=!1,e.pointerLastPosition={x:t,y:i}}function pi(e,t,i,n,r={}){let a=Number(i),o=Number(n);if(!Number.isFinite(a)||!Number.isFinite(o))throw new Error("pointer coordinates must be finite");e.runtime.cursor.x=a,e.runtime.cursor.y=o;let l=Number(r.deltaX??0),u=Number(r.deltaY??0);if(t==="wheel"&&(!Number.isFinite(l)||!Number.isFinite(u)))throw new Error("wheel deltas must be finite");if(r.silent||nt(e,{kind:"pointer",payload:{type:t,x:a,y:o,...t==="wheel"?{deltaX:l,deltaY:u}:{}}}),t==="wheel"){let s=Hi(e,a,o),f=Za(s);if(f){let h=f._scroll.horizontal&&l||u;Un(f,f._scroll.offset+h)}return s}if(t==="cancel")return eo(e,a,o),null;if((t==="move"||t==="up")&&e.pointerScroll&&!Ki(e.pointerScroll.control)&&eo(e,a,o),t==="move"){let s=e.pointerLastPosition||{x:a,y:o},f=e.pointerHoverControl,h=jn(Hi(e,a,o)),p=Dt(e,a,o,{previous:s});f&&f!==h&&e.runtime.injectCursor(f,"CursorExit",p),h&&f!==h&&e.runtime.injectCursor(h,"CursorEnter",p),e.pointerHoverControl=h;let g=e.hoveredControl;e.hoveredControl=h?.kind==="button"?h:null,g&&g!==e.hoveredControl&&mi(e,g),e.hoveredControl&&mi(e,e.hoveredControl);let m=e.pointerDownControl,y=e.pointerScroll;if(y)if(!Ki(y.control))e.pointerScroll=null;else{let I=Qa(e,y.control,a,o);if(I){let A=y.control._scroll,x=A.horizontal?I.x-y.start.x:I.y-y.start.y,G=Ui(A,I.width,I.height)?.travel||0,z=y.bar?G?x*A.max/G:0:-x;Un(y.control,y.offset+z)}}if(m?.alive){let I=e.pointerDownPosition||s,A=a!==s.x||o!==s.y;!e.pointerDragging&&A&&(y||e.runtime.injectCursor(m,"CursorBeginDrag",Dt(e,a,o,{press:I,previous:s,dragging:!1})),e.pointerDragging=!0),e.pointerDragging&&!y&&e.runtime.injectCursor(m,"CursorDrag",Dt(e,a,o,{press:I,previous:s,dragging:!0}))}return e.pointerLastPosition={x:a,y:o},h}if(t==="down"){let s=jn(Hi(e,a,o));e.pointerDownControl=s,e.pointerDownPosition={x:a,y:o},e.pointerLastPosition={x:a,y:o},e.pointerDragging=!1,e.pointerScroll=null;let f=Za(s);if(f){let h=Qa(e,f,a,o),p=h&&Ui(f._scroll,h.width,h.height),g=y=>h.x>=y.x&&h.x<=y.x+y.width&&h.y>=y.y&&h.y<=y.y+y.height,m=p&&g(p.track);if(m&&!g(p.thumb)){let y=f._scroll.horizontal?h.x-p.track.x-p.thumb.width/2:h.y-p.track.y-p.thumb.height/2;Un(f,p.travel?y/p.travel*f._scroll.max:0),qi(e)}h&&(e.pointerScroll={control:f,start:h,offset:f._scroll.offset,bar:!!m})}return s&&(Kn(e,s,!0),e.runtime.injectCursor(s,"CursorDown",Dt(e,a,o))),s}if(t==="up"){let s=e.pointerDownControl,f=jn(Hi(e,a,o));if(s?.alive){let h=Dt(e,a,o,{press:e.pointerDownPosition,previous:e.pointerLastPosition,dragging:e.pointerDragging});if(e.runtime.injectCursor(s,"CursorUp",h),e.pointerDragging)e.pointerScroll||e.runtime.injectCursor(s,"CursorEndDrag",h);else if(f===s&&!e.pointerScroll?.bar){e.runtime.injectCursor(s,"CursorClick",h);let p=e.selectedControl;e.selectedControl=s.kind==="button"?s:null,p&&p!==e.selectedControl&&mi(e,p)}Kn(e,s,!1)}return e.pointerDownControl=null,e.pointerDownPosition=null,e.pointerLastPosition={x:a,y:o},e.pointerDragging=!1,e.pointerScroll=null,f}if(t==="click")return pi(e,"down",a,o,{silent:!0}),pi(e,"up",a,o,{silent:!0});throw new Error(`unknown pointer type ${t}`)}function er(e,t,i,n){if(!e?.server)throw new Error("play session has no server");return nt(e,{kind:"serverSet",payload:{entityType:t,name:i,value:n,playerIndex:e.viewPlayerIndex}}),e.server.setVar(t,i,n,{playerIndex:e.viewPlayerIndex})}function po(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 tr(e,t,i=[],n="PlayerSelf"){if(!e?.server)throw new Error("play session has no server");return nt(e,{kind:"serverSend",payload:{name:t,params:i,target:n,playerIndex:e.viewPlayerIndex}}),e.server.sendToClient(t,i,{target:n,playerIndex:e.viewPlayerIndex})}function Ji(e){return{snapshot:t=>Wn(e,t),step:t=>Wi(e,t),pointer:(t,i,n,r)=>pi(e,t,i,n,r),key:t=>Jn(e,t),click:t=>Zn(e,t),view:t=>qn(e,t),pause:()=>{nt(e,{kind:"pause",payload:{}}),e.debugPaused=!0},resume:()=>{nt(e,{kind:"resume",payload:{}}),e.debugPaused=!1},serverSet:(t,i,n)=>er(e,t,i,n),serverSend:(t,i,n)=>tr(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 nr(e,t){return JSON.stringify(e)===JSON.stringify(t)}function go(e,t){for(let i of e||[])t(i),i.children?.length&&go(i.children,t)}function rr(e,{id:t,name:i}){let n=null;return go(e,r=>{n||(t&&String(r.id)===String(t)||!t&&i&&r.name===i)&&(n=r)}),n}function Fs(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 Os(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=rr(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 zs(e,t){if(e.kind==="log"){let i=e.source==="server"?t.server?.logs||t.serverLogs||[]:t.logs||[];return i.some(r=>e.level&&r.level!==e.level?!1:String(r.text||"").includes(e.contains))?{ok:!0,actual:e.contains}:{ok:!1,actual:i.map(r=>r.text).slice(-8),expected:e.contains}}if(e.kind==="control"){let i=rr(t.tree,e);if(!i)return{ok:!1,actual:null,expected:e.equals,message:`control not found: ${e.id||e.name}`};let n=Fs(i,e.field);return nr(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],r=!i||!Object.prototype.hasOwnProperty.call(i,e.name)?null:i[e.name].value;return nr(r,e.equals)?{ok:!0,actual:r}:{ok:!1,actual:r,expected:e.equals}}if(e.kind==="signal"){let i=e.direction==="outbound"?t.server?.outbound||[]:t.server?.inbound||[],n=i.find(r=>r.name===e.name&&(e.values===void 0||nr(r.values,e.values)));return n?{ok:!0,actual:n.values}:{ok:!1,actual:i.map(r=>({name:r.name,values:r.values})),expected:{name:e.name,values:e.values??null}}}if(e.kind==="tree"){let i=!!rr(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 $s(e,t){let i=si();try{return i.evalQueryScript(e,Os(t)),{ok:!0,actual:!0}}catch(n){return{ok:!1,message:n?.message||String(n)}}finally{i.destroy()}}function yo(e,t){return e.kind==="lua"?$s(e.source,t):zs(e,t)}function Gs(e,t){let i=t>0?t:bt;return Math.round((e+i)*1e9)/1e9}function Ds(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 Vs(e,t){let i=yo(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 bo(e,t){let i=hi(t),n=i.events.slice().sort((A,x)=>A.t-x.t),r=i.asserts.slice(),a=i.dt||bt,o=n.reduce((A,x)=>Math.max(A,x.t),0),l=r.reduce((A,x)=>Math.max(A,Number(x.at||0)),0),u=Math.max(o,l),s=0,f=[],h=0,p=r.some(A=>A.kind==="control"||A.kind==="tree"||A.kind==="lua"),g=e.snapshot({inspect:p}),m=()=>{for(;s<n.length&&n[s].t<=h+1e-9;)Ds(e,n[s]),s+=1,g=e.snapshot({inspect:p})},y=()=>{for(let A of r)if(!A._done&&Number(A.at||0)<=h+1e-9){let x=Vs(A,g);if(f.push(x),A._done=!0,!x.ok)return{passed:!1,failedAt:h,frame:g.frame||0,results:f,snapshot:g}}return null};m();let I=y();if(I)return ar(i,I);for(;h+1e-9<u;){e.step(a),h=Gs(h,a),g=e.snapshot({inspect:p}),m();let A=y();if(A)return ar(i,A)}return ar(i,{passed:f.every(A=>A.ok),failedAt:null,frame:g.frame||0,results:f,snapshot:g})}function ar(e,t){return V({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 or(e){return Array.isArray(e)?e.slice():[]}import{createHash as Ys}from"node:crypto";var vo=e=>Ys("sha256").update(JSON.stringify(e.map(({id:t,path:i,source:n})=>({id:t,path:i,source:n})))).digest("hex");var Hs={Level:"\u5173\u5361",PlayerSelf:"\u5F53\u524D\u73A9\u5BB6",AvatarSelf:"\u5F53\u524D\u89D2\u8272",...Object.fromEntries(gt.map((e,t)=>[e,`\u73A9\u5BB6${t+1}`])),...Object.fromEntries(Array.from({length:8},(e,t)=>[`Avatar${t+1}`,`\u89D2\u8272${t+1}`]))};function Ks(e,t=1){let i=e?.vars||{},n=[],r=Number(t)>0?Number(t):1,a=["Level","PlayerSelf","AvatarSelf"];if(r>1)for(let l=1;l<=r;l+=1)a.push(`Player${l}`,`Avatar${l}`);let o=new Set;for(let l of a){if(o.has(l)||!i[l])continue;o.add(l);let u=i[l]||{};for(let s of Object.keys(u))n.push(V({entityType:l,entityLabel:Hs[l]||l,name:s,type:u[s]?.type||"",value:u[s]?.value??null}))}return n}var St="qxqy-simulator-save",qs="qxqy-simulator-scripts",re="server-control-template",X="client-control-template",lr={[re]:"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F",[X]:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"};function vt(e){return e===X?"client":"server"}function Xt(e){if(!(typeof e=="number"||typeof e=="string"&&/^\d+$/.test(e.trim()))||!Pe(e))throw new Error("\u63A7\u4EF6\u7D22\u5F15\u5FC5\u987B\u662F 1\u20132147483647 \u8303\u56F4\u5185\u7684\u6574\u6570");return Number(e)}function sr(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)||![re,X].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:Xt(i.oldGuid),newGuid:Xt(i.newGuid),...i.batchId?{batchId:i.batchId}:{},...i.scriptSignature?{scriptSignature:i.scriptSignature}:{}}})}function Ls(e){let t=[e?.guid,e?.id];for(let i of t){let n=Number(i);if(Number.isSafeInteger(n)&&n>0&&n<=2147483647)return n}return 0}function Zi(e){let t=String(e?.controlAsset||""),i=Ls(e);return{id:String(i||e?.id||""),guid:i,path:String(e?.path||""),source:String(e?.source||""),controlId:String(e?.controlId||""),controlAsset:t===X||t==="client"?X:t===re||t==="server"?re:""}}function Ws(e){let t=[],i=(n,r="")=>{if(n&&(n.path||n.source)){let a=Zi(n);t.push(r?{...a,controlAsset:r}:a)}};if(Array.isArray(e?.assets?.scripts)){for(let n of e.assets.scripts)n&&(n.path||n.source)&&t.push(Zi(n));return t}if(i(e?.assets?.server?.script,re),i(e?.assets?.client?.script,X),e&&e.format!==St){i(e?.script);for(let n of e?.scripts||[])i(n)}return t}function ur(e){return tt(e===X?Rt():ft())}var Js="\u672A\u7ED1\u5B9A",Vt="\u672A\u547D\u540D\u5B58\u6863",Zs="\u672A\u547D\u540D\u754C\u9762";function Qs(e){let t=e;for(let i=0;i<8;i++){if(gi(wo(t,"simulator","studio"))&&gi(wo(t,"lua")))return t;let n=Us(t);if(n===t)break;t=n}return e}function eu(e){return e?{name:Yt(e),path:e,bound:!0}:{name:Js,path:"",bound:!1}}function tu(e,t=process.cwd()){if(js(e)&&gi(e))return e;let i=t||process.cwd(),n=Qs(i),r=Io(n,e);if(gi(r))return r;let a=Io(i,e);if(gi(a))return a;throw new Error("script file not found: "+e)}function cr(e,t={}){e?.format===St&&Cn(e.version);let i=[],n=typeof t.workspacePath=="string"&&t.workspacePath?t.workspacePath:"",r=e?.format===St&&e.assets,a=sr(e?.controlGuidChanges),o=en(e?.scriptSync),l=r?null:tt(e,{warnings:i}),u={server:r&&e.assets.server?tt(e.assets.server,{warnings:i}):ur(re),client:r&&e.assets.client?tt(e.assets.client,{warnings:i}):ur(X)};l&&(u[vt(l.meta.assetType)]=l);let s=r&&e.activeAssetType===X?X:l?.meta.assetType||re,f=r&&e.meta?.name?String(e.meta.name):"",h=()=>f||Vt;!e?.meta?.name&&u.server.meta.name==="\u672A\u547D\u540D\u754C\u9762\u63A7\u4EF6\u7EC4"&&(u.server.meta.name=Zs);let p=[],g=new Set;function m(){g.clear(),Pt(u.server.root,g),Pt(u.client.root,g,{skipServerContainer:!0});for(let d of p)Pe(d.guid)&&g.add(Number(d.guid))}function y(d=0){m();let b=Pe(d)&&!g.has(Number(d))?Number(d):We(g);return g.add(b),b}function I(d){let b=Zi(d),S=y(b.guid);return{...b,guid:S,id:String(S)}}Ke(Ws(e));let A=di(e?.serverLogic),x=null,G="",z=1,q=1;function J(d){let b=String(d||"").trim();if(!b)return"";if(!ie[b])throw new Error(`unknown canvas preset: ${b} (available: ${Object.keys(ie).join(", ")})`);return b}let H=()=>u[vt(s)];function $(d){if(!d)return null;for(let[b,S]of[["server",u.server],["client",u.client]]){let R=he(S.root,d);if(R&&R.kind!=="server-container")return{key:b,node:R}}return null}function v(d){if(!d.controlId)return null;let b=d.controlAsset===X?"client":d.controlAsset===re?"server":null;if(b){let S=he(u[b].root,d.controlId);return S&&S.kind!=="server-container"?{key:b,node:S}:null}return $(d.controlId)}function E(){for(let d of p)d.controlId&&!v(d)&&(d.controlId="",d.controlAsset="")}function w(d){if(!Pe(d))return null;for(let[b,S]of[[re,u.server],[X,u.client]]){let R="";if(Z(S.root,M=>{!R&&(M.scriptMappingIds||[]).includes(Number(d))&&(R=M.id)}),R)return{controlId:R,controlAsset:b}}return null}function C(d,b,S){let R=u[vt(d.controlAsset)],M=R&&he(R.root,d.controlId);M&&(M.scriptMappingIds=(M.scriptMappingIds||[]).map(N=>Number(N)===Number(b)?Number(S):N))}E();function O(){return p.map(d=>{let b=v(d),S=b?b.key==="client"?X:re:"";return V({id:d.id,guid:d.guid||0,path:d.path||"",source:d.source||"",controlId:d.controlId||"",controlAsset:d.controlAsset||S,controlName:b?.node.name||"",assetType:S,assetLabel:b?lr[S]:"",mounted:!!b})})}function k(){let d=[],b=(S,R)=>{Z(S.root,M=>{M.kind!=="server-container"&&d.push(V({id:M.id,name:M.name,kind:M.kind,assetType:R,assetLabel:lr[R]}))})};return b(u.server,re),b(u.client,X),d}function _(d){let b=[];return Z(d.root,S=>{S.kind!=="server-container"&&b.push(JSON.stringify({kind:S.kind,guid:S.guid,name:S.name,text:S.text??null,imageId:S.imageId??null,imageSource:S.imageSource??null,imageType:S.imageType??null,fontSize:S.fontSize??null,fontColor:S.fontColor??null,bgColor:S.bgColor??null,imageColor:S.imageColor??null,fillType:S.fillType??null,fillAmount:S.fillAmount??null,syncAllDevices:S.syncAllDevices!==!1,transformByPlatform:S.transformByPlatform||null}))}),b.join("/")}let D=_(Rt()),Y=_(ft());function ue(d){let b=_(d);return d.meta?.assetType===X?b===D:b===Y}function U(d,b){return String(d||"").replace(/[\\/:*?"<>|]/g,"-").trim()||b}function we(d){let b=U(h(),Vt),S=d.meta?.assetType===X?"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F";return`${b} \xB7 ${S}`}function Ae(){if(!((u.server.root.children||[]).find(b=>b.kind==="container")||u.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 Jr(u.server,u.client,{scripts:p,fileName:`${U(h(),Vt)} \xB7 \u6574\u5408\u5305.gia`})}function wt(){let d=b=>({type:b.meta.assetType,name:b.meta.name,sourceFile:b.meta.sourceFile||""});return{format:St,name:h(),activeAssetType:s,assets:{server:d(u.server),client:d(u.client),scripts:O()}}}function Bt(){return V({format:St,version:4,meta:{name:h()},activeAssetType:s,serverLogic:A,controlGuidChanges:a,scriptSync:o,assets:{server:u.server,client:u.client,scripts:p.map(d=>V({id:d.id,guid:d.guid||0,path:d.path||"",source:d.source||"",controlId:d.controlId||"",controlAsset:d.controlAsset||""}))}})}function ee(){let d=H(),b=da(d);if(b.workspace=eu(n),b.save=wt(),b.scripts=O(),b.mountTargets=k(),b.serverLogic=A,b.migrationWarnings=[...i],b.controlGuidChanges=V(a),s===X){let S=Mt(d,!0);b.clientGuidAutofill={count:S.length,templateCount:S.filter(({parent:R})=>R?.kind==="server-container").length,selectedOffset:S.findIndex(({node:R})=>R.id===b.selectedId)}}return b.scriptSync=V(o),Ir(b),b}function Fe(d){let b=H();if(d.expectedRevision!==void 0&&Number(d.expectedRevision)!==b.version)throw new Error(`revision conflict: expected ${d.expectedRevision}, current ${b.version}`);return b}function at(d,b,S=""){let R=String(b||"");if(R){let M=S===X?X:S===re?re:"";if(!v({controlId:R,controlAsset:M}))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");d.controlAsset=M}else d.controlAsset="";d.controlId=R}function vi(d){let b=Fe(d);if(d.op==="addScript"){let S=I({path:String(d.path||""),source:String(d.source||""),controlId:"",controlAsset:""});d.controlId!==void 0&&d.controlId!==""&&at(S,d.controlId,d.controlAsset),p.push(S)}else if(d.op==="updateScript"){let S=p.find(R=>R.id===d.id);if(!S)throw new Error(`\u811A\u672C\u4E0D\u5B58\u5728: ${d.id}`);d.controlId!==void 0&&at(S,d.controlId,d.controlAsset),d.path!==void 0&&(S.path=String(d.path)),d.source!==void 0&&(S.source=String(d.source))}else if(d.op==="removeScript"){let S=p.length;if(p=p.filter(R=>R.id!==d.id),p.length===S)throw new Error(`\u811A\u672C\u4E0D\u5B58\u5728: ${d.id}`)}return b.version+=1,ee()}function Si(d){let b=Fe(d),S=he(b.root,d.id??b.selectedId);if(!S||S.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 R=Xt(d.guid);if(Xt(S.guid),d.autoFillClientGuids!==void 0&&typeof d.autoFillClientGuids!="boolean")throw new Error("autoFillClientGuids \u5FC5\u987B\u662F\u5E03\u5C14\u503C");let M=d.autoFillClientGuids===!0;if(M&&s!==X)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 N=M?Mt(b,!0).map(({node:F})=>F):[S],B=R-N.indexOf(S),L=N.map((F,ae)=>({node:F,oldGuid:Xt(F.guid),newGuid:Xt(B+ae)})),Ce=L.filter(({oldGuid:F,newGuid:ae})=>F!==ae);if(!Ce.length)return ee();let fe=new Map(L.map(({oldGuid:F,newGuid:ae})=>[F,ae]));if(fe.size!==L.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 ot=new Set(N),pe=[];for(let F of Object.values(u))Z(F.root,ae=>{F===u.client&&ae.kind==="server-container"||pe.push({node:ae,project:F})});let Ve=new Map([...pe.filter(F=>!ot.has(F.node)).map(({node:F})=>[Number(F.guid),F.name]),...p.map(F=>[Number(F.guid),F.path||"Lua \u811A\u672C"])]);for(let{newGuid:F}of Ce)if(Ve.has(F))throw new Error(`\u63A7\u4EF6\u7D22\u5F15 ${F} \u5DF2\u88AB\u300C${Ve.get(F)}\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 te=[],le=(F,ae,xt)=>{let _e=F?.[ae];(typeof _e=="number"||typeof _e=="string"&&/^\d+$/.test(_e.trim()))&&fe.has(Number(_e))&&fe.get(Number(_e))!==Number(_e)&&te.push({owner:F,key:ae,project:xt.project,oldGuid:Number(_e),newGuid:fe.get(Number(_e))})};for(let F of pe)le(F.node,"referencedPrefabId",F),le(F.node,"itemPrefabId",F),le(F.node.giaRaw,"templateRefSlot",F);let It=new Map;for(let{node:F}of pe)It.set(Number(F.guid),(It.get(Number(F.guid))||0)+1);for(let{oldGuid:F}of te)if(It.get(F)!==1)throw new Error(`\u65E7\u7D22\u5F15 ${F} \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 ge=M?So():"",Qi=vo(p);for(let{node:F,oldGuid:ae,newGuid:xt}of Ce)F.guid=xt,a.push({id:So(),controlAsset:s,controlId:F.id,controlName:F.name,oldGuid:ae,newGuid:xt,scriptSignature:Qi,...ge?{batchId:ge}:{}});let Lt=new Set([b]);for(let{owner:F,key:ae,project:xt,newGuid:_e}of te)F[ae]=typeof F[ae]=="string"?String(_e):_e,Lt.add(xt);for(let F of Lt)F.version+=1;return ee()}function ne(d){let b=Fe(d);if(!Array.isArray(d.changeIds)||!d.changeIds.length||d.changeIds.some(R=>typeof R!="string"||!a.some(M=>M.id===R)))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 S=new Set(d.changeIds);return a=a.filter(R=>!S.has(R.id)),b.version+=1,ee()}function Oe(d){if(!d||typeof d!="object")throw new Error("patch requires op");if(d.op==="setScriptSync"){let b=Fe(d);return o=en(d.config),b.version+=1,ee()}if(d.op==="setControlGuid")return Si(d);if(d.op==="acknowledgeControlGuidChanges")return ne(d);if(d.op==="setServerLogic"){let b=Fe(d);return A=di(d.logic),b.version+=1,ee()}if(d.op==="addScript"||d.op==="updateScript"||d.op==="removeScript")return vi(d);if(d.op==="selectAsset")return s=d.assetType===X?X:re,ee();if(d.op==="renameSave"){let b=String(d.name||"").trim();if(!b)throw new Error("\u5B58\u6863\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");return f=b,ee()}if(d.op==="newAsset"){let b=Fe(d);s=d.assetType===X?X:re;let S=ur(s);return S.version=b.version+1,u[vt(s)]=S,a=a.filter(R=>R.controlAsset!==s),E(),ee()}return An(H(),d),E(),ee()}function De(d){return p.filter(b=>{let S=v(b);return!!(S&&S.key==="client"==(d===X))})}function Ut(d="json",b=""){let S=jt(d,b);if(a.length&&!["save","archive"].includes(String(d).toLowerCase())){let R=a.map(M=>`\u63A7\u4EF6\u7D22\u5F15\u5F85\u6838\u5BF9 Lua \u5F15\u7528\uFF1A${lr[M.controlAsset]} / ${M.controlName} (${M.controlId})\uFF1A${M.oldGuid} \u2192 ${M.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 ${M.id}\uFF1B\u4E0D\u8981\u5168\u5C40\u66FF\u6362\u540C\u503C\u6570\u5B57\u3002`);S.warnings=[...new Set([...S.warnings||[],...R])]}return S}function jt(d="json",b=""){let S=String(d).toLowerCase();if(S==="save"||S==="archive"){let N=Buffer.from(JSON.stringify(Bt(),null,2),"utf8");return V({filename:`${h().replace(/[\\/:*?"<>|]/g,"-")} \xB7 \u8D44\u4EA7\u5305.json`,mimeType:"application/json",encoding:"base64",data:N.toString("base64"),warnings:[]})}if(S==="save-gia"||S==="archive-gia"){let N=[],B=[],L=(fe,ot="")=>{let pe=Ut(fe,ot);N.push(V({filename:pe.filename,mimeType:pe.mimeType,encoding:pe.encoding,data:pe.data,warnings:pe.warnings||[]})),B.push(...pe.warnings||[])},Ce=(fe,ot)=>{let pe=u[vt(fe)],Ve=fe===s,te=p.some(le=>le.controlAsset===fe&&le.controlId);if(!Ve&&ue(pe)&&!te){B.push(ot);return}L("gia",fe)};if(Ce(re,"\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"),Ce(X,"\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"),p.some(fe=>fe.path||fe.source)&&L("scripts-gia"),!N.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 V({format:"qxqy-gia-package",files:N,warnings:[...new Set(B)]})}if(S==="gia-combined"||S==="combined-gia"||S==="combined"){let N=Ae();return V({filename:`${U(h(),Vt)} \xB7 \u6574\u5408\u5305.gia`,mimeType:"application/octet-stream",encoding:"base64",data:N.buffer.toString("base64"),warnings:[...new Set(N.warnings||[])]})}if(S==="scripts"){let N=V({format:qs,version:1,scripts:p.map(L=>V({id:L.id,guid:L.guid||0,path:L.path||"",source:L.source||"",controlId:L.controlId||"",controlAsset:L.controlAsset||""}))}),B=Buffer.from(JSON.stringify(N,null,2),"utf8");return V({filename:`${U(h(),Vt)} \xB7 \u811A\u672C.json`,mimeType:"application/json",encoding:"base64",data:B.toString("base64"),warnings:[]})}if(S==="scripts-gia"||S==="scriptsgia"){let N=ea(p);return V({filename:`${U(h(),Vt)} \xB7 \u811A\u672C.gia`,mimeType:"application/octet-stream",encoding:"base64",data:N.buffer.toString("base64"),warnings:N.warnings})}if(S==="lua"){let N=p.find(L=>L.id===b)||p.find(L=>L.path===b);if(!N)throw new Error("\u6CA1\u6709\u53EF\u5BFC\u51FA\u7684 Lua \u811A\u672C\uFF0C\u8BF7\u5148\u5728\u201CLua \u811A\u672C\u201D\u9875\u521B\u5EFA");let B=Yt(N.path||"")||`qxqy-script-${N.id}`;return V({filename:/\.lua$/i.test(B)?B:`${B}.lua`,mimeType:"text/x-lua",encoding:"base64",data:Buffer.from(N.source||"","utf8").toString("base64"),warnings:[]})}let R=b?u[vt(b)]:H(),M=we(R);if(S==="json"){let N=V({...R,scripts:De(R.meta.assetType),controlGuidChanges:a.filter(L=>L.controlAsset===R.meta.assetType)}),B=Buffer.from(JSON.stringify(N,null,2),"utf8");return V({filename:`${M}.json`,mimeType:"application/json",encoding:"base64",data:B.toString("base64"),warnings:[]})}if(S==="gia"){let N=Wr(R,R.meta.assetType===X?{scripts:De(X)}:{}),B=R.meta.assetType===X?[]:De(re);return B.length&&N.warnings.unshift(`\u5F53\u524D\u670D\u52A1\u5668\u63A7\u4EF6 GIA \u4E0D\u5305\u542B ${B.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`),V({filename:`${M}.gia`,mimeType:"application/octet-stream",encoding:"base64",data:N.buffer.toString("base64"),warnings:N.warnings})}throw new Error(`unsupported export format: ${d}`)}function Ke(d){for(let b of d){let S=Zi(b);if(!S.path&&!S.source)continue;let R=S.controlId?null:w(S.guid),M=I(R?{...S,...R}:S);R&&M.guid!==S.guid&&C(R,S.guid,M.guid),M.controlId&&!v(M)&&(M.controlId="",M.controlAsset=""),p.push(M)}}function Ht(d,b,S=""){let R=String(d||"").toLowerCase();if(typeof b!="string"||!b)throw new Error("import data is required");let M=Buffer.from(b,"base64"),N,B=[],L={};if(R==="json"){try{N=JSON.parse(M.toString("utf8"))}catch{throw new Error("JSON \u6587\u4EF6\u65E0\u6548")}if(N?.project&&(N=N.project),N?.format===St&&N?.assets){Cn(N.version);let te=cr(N);B.push(...te.get().migrationWarnings);let le=te.archiveData();return u.server=le.assets.server,u.client=le.assets.client,i=[...B],s=N.activeAssetType===X?X:re,f=String(N.meta?.name||Yt(S).replace(/\.json$/i,"")||f),A=le.serverLogic,p=le.assets.scripts,a=le.controlGuidChanges,o=le.scriptSync,g.clear(),V({snapshot:ee(),warnings:B,metadata:{format:St}})}}else{if(R==="lua")return p.push(I({path:Yt(S||"imported.lua"),source:M.toString("utf8"),controlId:""})),V({snapshot:ee(),warnings:B,metadata:{assetType:"lua-script"}});if(R==="gia"){if(ta(M)){let ge=na(M);return Ke(ge.scripts),V({snapshot:ee(),warnings:ge.warnings,metadata:ge.metadata})}let te=ra(M);N=te.project,B=te.warnings,L=te.metadata,te.clientProject&&(u.client=tt(te.clientProject),a=a.filter(ge=>ge.controlAsset!==X),B.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 le=new Map,It=(ge,Qi)=>{ge&&Z(ge.root,Lt=>{for(let F of Lt.scriptMappingIds||[]){let ae=le.get(Number(F));if(ae){B.push(`\u811A\u672C GUID ${F} \u540C\u65F6\u6302\u8F7D\u5230\u591A\u4E2A\u63A7\u4EF6\uFF0C\u5DF2\u4FDD\u7559\u201C${ae.controlAsset===re?"\u670D\u52A1\u7AEF":"\u5BA2\u6237\u7AEF"}\u201D\u76EE\u6807\u3002`);continue}le.set(Number(F),{controlId:Lt.id,controlAsset:Qi})}})};It(te.project,re),It(te.clientProject,X),Ke((te.scripts||[]).map(ge=>le.has(Number(ge.guid))?{...ge,...le.get(Number(ge.guid))}:ge))}else throw new Error(`unsupported import format: ${d}`)}let Ce=tt(N,{warnings:B}),fe=sr(N?.controlGuidChanges);if(fe.some(te=>te.controlAsset!==Ce.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 ot=sr([...a.filter(te=>te.controlAsset!==Ce.meta.assetType),...fe]);i=[...B];let pe=vt(Ce.meta.assetType);u[pe]=Ce,a=ot,s=Ce.meta.assetType;let Ve=u[pe];return S&&(Ve.meta.name=Yt(S).replace(/\.(json|gia)$/i,"")||Ve.meta.name,Ve.meta.sourceFile=Yt(S),Ve.meta.sourceFormat=R),Ke(N?.scripts||[]),N?.script&&(N.script.path||N.script.source)&&Ke([N.script]),V({snapshot:ee(),warnings:B,metadata:L})}function xo(d,b){return An(H(),{op:"pick",x:d,y:b}),ee()}function Co(d){let b=typeof d=="string"&&d?d:"";!b||b===n||(n=b)}function ko(d){let b=d.source||"";if(!b.trim()&&d.path.trim())try{b=Bs(tu(d.path,n),"utf8")}catch(S){throw new Error(`\u811A\u672C ${d.path} \u8BFB\u53D6\u5931\u8D25: ${S?.message||S}`)}return b}function Kt(d={}){let b=J(d.canvasId);b&&(G=b),d.playerCount!==void 0&&d.playerCount!==null&&d.playerCount!==""&&(z=pt(d.playerCount),q>z&&(q=1)),d.viewPlayerIndex!==void 0&&d.viewPlayerIndex!==null&&d.viewPlayerIndex!==""&&(q=je(d.viewPlayerIndex,z)),x&&ir(x);let S=p.map(M=>{try{return{id:M.id,guid:M.guid||0,path:M.path||M.id,source:ko(M),controlId:M.controlId||"",controlAsset:M.controlAsset||""}}catch(N){return{id:M.id,guid:M.guid||0,path:M.path||M.id,source:`error([==[ ${String(N.message).replace(/]=+]/g,"] =]")} ])`,controlId:M.controlId||"",controlAsset:M.controlAsset||""}}}),R=M=>S.filter(N=>{let B={controlId:N.controlId,controlAsset:N.controlAsset},L=N.controlId?v(B):null;return!!(L&&L.key===M)});return x=ao(u.server,{templatesProject:u.client,scripts:S,sceneScripts:R("server"),templateScripts:R("client"),serverConfig:{logic:A},canvasId:G,playerCount:z,viewPlayerIndex:q,language:d.language||""}),ce(d)}function Eo(d,b={}){let S=J(d);if(!S)throw new Error("playSetCanvas requires canvasId");return Kt({...b,canvasId:S})}function ce(d={}){if(!x)return V({running:!1,tree:[],logs:[],serverLogs:[],serverVars:[]});let b=Wn(x,d);return b.running=!0,b.logs=or(b.logs),b.serverLogs=or(b.server?.logs||[]),b.serverVars=Ks(b.server,b.playerCount||1),b}function Ao(d,b={}){return x||Kt(),Wi(x,d),b.observe===!1?V({running:!0,time:x.runtime.clock.time,frame:x.runtime.clock.frame,paused:!!x.debugPaused,levelTimePaused:!!x.runtime.clock.paused,playerCount:x.playerCount||1,viewPlayerIndex:x.viewPlayerIndex||1}):ce(b)}function _o(d=0){Kt();let b=Math.max(0,Number(d)||0);for(let S=0;S<b;S++)Wi(x,1/30);return ce()}function To(){return x&&ir(x),x=null,G="",z=1,q=1,V({running:!1,tree:[],logs:[],serverLogs:[],serverVars:[]})}function Po(d,b={}){let S=qt();return q=qn(S,d),b.observe===!1?null:ce(b)}function Ro(d,b={}){if(!x)throw new Error("play session has not started");return Jn(x,d),b.observe===!1?null:ce(b)}function Mo(d,b={}){if(!x)throw new Error("play session has not started");return Zn(x,d),b.observe===!1?null:ce(b)}function No(d,b,S,R={}){if(!x)throw new Error("play session has not started");return pi(x,d,b,S,R),R.observe===!1?null:ce(R)}function Fo(d={}){return x&&Ji(x).pause(),d.observe===!1?null:ce(d)}function Oo(d={}){return x&&Ji(x).resume(),d.observe===!1?null:ce(d)}function qt(){if(!x)throw new Error("play session has not started");return x}function zo(d,b){let S=qt();if(!d&&!b){let R=ce();return V({vars:R.serverVars||[]})}return V({entityType:String(d||""),name:String(b||""),value:po(S,d,b)})}function $o(d,b,S){let R=qt();return er(R,d,b,S),ce()}function Go(d,b=[],S="PlayerSelf"){let R=qt();return tr(R,d,b,S),ce()}function Do(){let d=ce();return V({events:d.history||[],case:ja(d.history||[],{playerCount:d.playerCount||1})})}function Vo(d={}){let b=ce(),S=hi({name:d.name||"",dt:d.dt,playerCount:d.playerCount||b.playerCount||1,events:d.events||b.history||[],asserts:d.asserts||[]});return V(S)}function Yo(d,b={}){let S=hi(d);Kt({...b,playerCount:b.playerCount||S.playerCount||1});let R=qt();R.recording=!1;try{return bo(Ji(R),d)}finally{R.recording=!0}}function Xo(){if(!x)return{running:!1,paused:!1,time:0,frame:0,playerCount:1,viewPlayerIndex:1};let d=x.runtime.clock;return{running:!0,paused:!!x.debugPaused,levelTimePaused:!!d.paused,time:d.time,frame:d.frame,playerCount:x.playerCount||1,viewPlayerIndex:x.viewPlayerIndex||1}}let mr={get:ee,patch:Oe,setWorkspace:Co,exportData:Ut,importData:Ht,pick:xo,playStart:Kt,playSetCanvas:Eo,playSetView:Po,playGet:ce,playStatus:Xo,playStep:Ao,playRun:_o,playStop:To,playKey:Ro,playClick:Mo,playPointer:No,playPause:Fo,playResume:Oo,playServerGet:zo,playServerSet:$o,playServerSend:Go,playHistory:Do,playSaveCase:Vo,playRunCase:Yo,archiveData:Bt};return Object.defineProperty(mr,"_project",{enumerable:!1,get:H}),mr}var j=null,dr=!1,He=0,Ge=0,hr="realtime",iu=33,yi=1/30,nu=5;function bi(e={}){return{...e.inspect?{inspect:!0}:{},...e.view?{view:!0}:{},...e.paint?{paint:!0}:{},...e.compact?{compact:!0}:{},...e.sceneRev!==void 0&&e.sceneRev!==null?{sceneRev:e.sceneRev}:{}}}function ru(e={}){let t=bi(e);for(let i of["canvasId","playerCount","viewPlayerIndex","language"])e[i]!==void 0&&e[i]!==null&&e[i]!==""&&(t[i]=e[i]);return t}function rt(e={}){return e.light?{...j.playStatus()}:j.playGet(bi(e))}function au(){if(!j||dr||hr!=="realtime")return;let e=j.playStatus();if(!e.running||e.paused){He=0,Ge=0;return}let t=Date.now();if(!He){He=t;return}dr=!0;try{Ge+=Math.min(.25,Math.max(0,(t-He)/1e3)),He=t;let i=0;for(;Ge>=yi&&i<nu;)j.playStep(yi,{observe:!1}),Ge-=yi,i+=1;Ge>yi&&(Ge=yi)}finally{dr=!1}}var Hf=setInterval(au,iu);function ou(e,t={}){if(e==="start"){let i=t.clockMode??"realtime";if(i!=="manual"&&i!=="realtime")throw new Error("clockMode must be manual or realtime");return j&&j.playStop(),j=cr(t.archive||t.project,{workspacePath:t.workspacePath||""}),hr=i,He=0,Ge=0,j.playStart(ru(t))}if(!j)throw new Error("play session has not started");if(e==="get")return t.light?rt(t):j.playGet(bi(t));if(e==="step"){let i=j.playStep(t.dt,t.light?{observe:!1}:bi(t));return t.light?rt(t):i}if(e==="pointer")return j.playPointer(t.type,t.x,t.y,{observe:!1,deltaX:t.deltaX,deltaY:t.deltaY}),rt(t);if(e==="key")return j.playKey(t.key,{observe:!1}),rt(t);if(e==="click")return j.playClick(t.name,{observe:!1}),rt(t);if(e==="pause")return j.playPause({observe:!1}),He=0,Ge=0,rt(t);if(e==="resume")return j.playResume({observe:!1}),He=0,Ge=0,rt(t);if(e==="device")return j.playSetCanvas(t.canvasId,bi(t));if(e==="view")return j.playSetView(t.playerIndex??t.viewPlayerIndex,{observe:!1}),rt(t);if(e==="serverGet")return j.playServerGet(t.entityType,t.name);if(e==="serverSet")return j.playServerSet(t.entityType,t.name,t.value);if(e==="serverSend")return j.playServerSend(t.name,t.params||[],t.target||"PlayerSelf");if(e==="history")return j.playHistory();if(e==="saveCase")return j.playSaveCase(t.case||t);if(e==="runCase")return j.playRunCase(t.case||t,{canvasId:t.canvasId,playerCount:t.playerCount,viewPlayerIndex:t.viewPlayerIndex});if(e==="stop"){let i=j.playStop();return j=null,He=0,Ge=0,i}throw new Error(`unknown play action: ${e}`)}fr.on("message",e=>{let{id:t,action:i,args:n={}}=e||{};try{let r=ou(i,n),a=typeof r?.running=="boolean"?{...r,clockMode:hr}:r;fr.postMessage({id:t,ok:!0,value:a,error:null})}catch(r){fr.postMessage({id:t,ok:!1,value:null,error:r?.message||String(r)})}});
|
|
119
|
+
`)}`);return i}function Ff(t,e={}){ke(t.root,Ci);let i=[];jt(t,{warnings:i});let r=qr(oe(t)),n=t.meta?.assetType==="client-control-template",o;if(n)o=Rf(t,r,i,void 0,e.scripts||[]);else{let a=$s(e.scripts||[],new Set(r.values()));i.push(...a.warnings),o=Nf(t,r,a,i)}return{buffer:Pf(o,n?qs:Bs),warnings:[...new Set(i)]}}function Mf(t,e,i={}){ke(t.root,Ci),e&&ke(e.root,Ci);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"];e&&jt(e,{warnings:r});let n=e?.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,s=oe(t),a=e?oe(e):null,l=qr(s,o),u=$s(i.scripts||[],o);r.push(...u.warnings.filter(w=>w!==Df));let f=String(i.fileName||`${s.meta?.name||"\u6574\u5408\u5305"} \xB7 \u6574\u5408\u5305.gia`),h=Fs({...s,meta:{...s.meta,giaFileName:f}},!1),m=Nf(s,l,u,r,h),p={graph:[],accessories:[]};if(n.length&&a){let w=qr({...a,meta:{...a.meta,assetType:"client-control-template"}},o);p=Rf(a,w,r,h,u.scripts)}let g={graph:[...m.graph,...p.graph],accessories:[...m.accessories,...p.accessories],filePath:h,gameVersion:zs({meta:{gameVersion:t.meta?.gameVersion||e?.meta?.gameVersion}}),...Ms(t)};return{buffer:Pf(g,Bs),warnings:[...new Set(r)]}}var Mi=69,zf=30,Df="\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 Fp(t){return(String(t.path||"").replace(/\\/g,"/").split("/").pop()||"").replace(/\.lua$/iu,"")||`\u811A\u672C${t.id||""}`}function Ds(t){let e=It.verify(t);if(e)throw new Error(`GIA encode validation failed: ${e}`);let i=It.encode(It.create(t)).finish(),r=Buffer.alloc(yi+i.length+Ns);return r.writeUInt32BE(r.length-4,0),r.writeUInt32BE(1,4),r.writeUInt32BE(Cf,8),r.writeUInt32BE(3,12),r.writeUInt32BE(i.length,16),Buffer.from(i).copy(r,yi),r.writeUInt32BE(Ef,yi+i.length),r}function $s(t,e=new Set){let i=(t||[]).filter(s=>s.path||s.source).map(s=>({...s})),r=[];for(let s of i)Eo(s.guid,s.path||s.id);for(let s of i){let a=Number(s.guid);lt(a)&&!e.has(a)?(e.add(a),s.guid=a):r.push(s)}for(let s of r){let a=ri(e);e.add(a),s.guid=a}let n=[];return(t||[]).some(s=>s.controlId)&&n.push(Df),{units:i.map(s=>{let a=Fp(s),l=String(s.path||"").replace(/\\/g,"/"),u=/\.lua$/iu.test(l)?l:`${l||a}.lua`,f={id:s.guid,name:a,filePath:u};return String(s.source||"")&&(f.source=String(s.source)),{id:{class:zf,id:s.guid},name:a,which:Mi,script:{mapping:f}}}),warnings:n,scripts:i}}function $f(t){let e=$s(t);if(!e.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:e.units,filePath:`114514-${Math.floor(Date.now()/1e3)}-1073741832-\\script.gia`,gameVersion:"7.0.51"},r=Ds(i),n=Mp(r);if(!n.valid)throw new Error(`GIA compatibility validation failed:
|
|
120
|
+
${n.errors.join(`
|
|
121
|
+
`)}`);return{buffer:r,warnings:[...new Set(e.warnings)]}}function Gs(t){return It.toObject(It.decode(Jn(t)),{longs:Number,enums:Number,bytes:Buffer,defaults:!1,arrays:!0,objects:!0})}function Gf(t){try{let i=Gs(t).graph||[];return i.length>0&&i.every(r=>Number(r.which)===Mi)}catch{return!1}}function qf(t){let e=[...t.graph||[],...t.accessories||[]].filter(n=>Number(n.which)===Mi),i=[],r=e.map((n,o)=>{let s=n.script?.mapping||{},a=Number(n.id?.id)||0;a<=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 l=Number(s.id)||0;return l&&l!==a&&i.push(`\u7B2C ${o+1} \u6761\u811A\u672C\u6620\u5C04 id(${l}) \u4E0E\u5355\u5143 id(${a}) \u4E0D\u4E00\u81F4\uFF0C\u4EE5\u5355\u5143 id \u4E3A\u51C6\u3002`),{guid:a,path:String(s.filePath||""),source:String(s.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 Bf(t){let e=Gs(t),i=qf(e);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 Mp(t){let e=[],i;try{i=Gs(t)}catch(n){return{valid:!1,errors:[n?.message||String(n)],scriptCount:0}}let r=i.graph||[];return r.length||e.push("Root.graph \u4E3A\u7A7A"),(i.accessories||[]).length&&e.push("script.gia \u4E0D\u5E94\u5305\u542B accessories"),r.forEach((n,o)=>{let s=`\u5355\u5143 ${o+1}`;Number(n.which)!==Mi&&e.push(`${s}: which \u5E94\u4E3A 69\uFF0C\u5B9E\u9645 ${n.which}`),Number(n.id?.class)!==zf&&e.push(`${s}: id.class \u5E94\u4E3A 30\uFF0C\u5B9E\u9645 ${n.id?.class}`),Number(n.id?.type??0)!==0&&e.push(`${s}: id.type \u5E94\u7F3A\u7701`);let a=n.script?.mapping;if(!a){e.push(`${s}: \u7F3A\u5C11 field35 ScriptMappingWrapper`);return}lt(n.id?.id)||e.push(`${s}: GraphUnit.id.id \u975E\u6CD5\uFF08\u5141\u8BB8 0x40000000\u20130x403FFFFF\uFF09`),Number(a.id)!==Number(n.id?.id)&&e.push(`${s}: mapping.id \u5E94\u7B49\u4E8E GraphUnit.id.id`),String(a.name||"")!==String(n.name||"")&&e.push(`${s}: mapping.name \u5E94\u7B49\u4E8E GraphUnit.name`),String(a.filePath||"").trim()?/\.lua$/iu.test(String(a.filePath))||e.push(`${s}: 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`):e.push(`${s}: file_path \u4E3A\u7A7A`)}),{valid:e.length===0,errors:e,scriptCount:r.length}}function Jn(t){let e=Buffer.isBuffer(t)?t:Buffer.from(t);if(e.length<yi+Ns)throw new Error("GIA \u6587\u4EF6\u8FC7\u77ED");if(e.readUInt32BE(4)!==1||e.readUInt32BE(8)!==Cf||e.readUInt32BE(12)!==3)throw new Error("\u4E0D\u662F\u53D7\u652F\u6301\u7684 GIA v1 \u6587\u4EF6");let i=e.readUInt32BE(16);if(i!==e.length-yi-Ns)throw new Error("GIA payload \u957F\u5EA6\u4E0D\u4E00\u81F4");if(e.readUInt32BE(yi+i)!==Ef)throw new Error("GIA \u5C3E\u6807\u8BB0\u65E0\u6548");return e.subarray(yi,yi+i)}function Xe(t,e){return t.ui?.content?.data?.find(i=>i.details?.[e])?.details?.[e]||null}function zp(t){let e=t.ui?.content?.data?.find(o=>o.field501===66&&o.field502===89||Object.hasOwn(o.details||{},"templateRefSlot")),i=Buffer.from(e?.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")},...e?.empty76?.length?{templateRefOuterBase64:Buffer.from(e.empty76).toString("base64")}:{}}}}function Dp(t){let e=Xe(t,"transform")?.multiPlatform,i={};for(let n of e?.platforms||[]){let o=Ip[n.platformType||0],s=n.transform||{};i[o]={scale:s.scale?{x:s.scale.x??0,y:s.scale.y??0,z:s.scale.z??0}:{x:1,y:1,z:1},rotation:{x:s.field508?.x??0,y:s.field508?.y??0,z:s.field508?.z??0},anchorMin:{x:s.anchorMin?.x??0,y:s.anchorMin?.y??0},anchorMax:{x:s.anchorMax?.x??0,y:s.anchorMax?.y??0},offset:{x:s.offset?.x??0,y:s.offset?.y??0},size:{x:s.size?.x??0,y:s.size?.y??0},pivot:s.pivot?{x:s.pivot.x??0,y:s.pivot.y??0}:{x:.5,y:.5}}}let r=i.KEYBOARD||i[Object.keys(i)[0]];if(!r)throw new Error(`GIA \u63A7\u4EF6 ${t.name||t.id?.id} \u7F3A\u5C11\u591A\u5E73\u53F0\u53D8\u6362`);for(let n of Be)i[n]||(i[n]=structuredClone(r));return i}function Wn(t){let e=t.ui?.content?.data||[];return e.some(i=>i.details?.textConfig)?e.some(i=>i.field501===71)?"textwindow":"textbox":e.some(i=>i.details?.cursorConfig)?"cursor":e.some(i=>Object.hasOwn(i.details||{},"templateRefSlot")||i.field501===66&&i.field502===89)?"reference":e.some(i=>i.details?.gridView)?"grid":e.some(i=>i.details?.buttonPreset)?"button":e.some(i=>i.details?.keyHint)?"keyhint":e.some(i=>i.details?.image||i.details?.imageSlot)?"image":e.some(i=>Object.hasOwn(i.details||{},"effectSlot"))?"animation":e.some(i=>Object.hasOwn(i.details||{},"fullscreenEffectSlot"))?"fullscreen":(e.some(i=>Object.hasOwn(i.details||{},"containerNodeSlot")),"container")}function _f(t,{reverseSiblings:e=!1,idOffset:i=0}={}){if(!t.length)return{nodes:new Map,rootCandidates:[],warnings:[]};let r=new Map(t.map((u,f)=>[u.id?.id,`n${i+f+1}`])),n=new Map,o=new Map,s=[];for(let u of t){let f=Wn(u),h=Xe(u,"textConfig"),m=Xe(u,"imageSlot"),p=Xe(u,"image"),g=Xe(u,"buttonPreset"),b=Xe(u,"gridView"),w=Xe(u,"genericSlot"),x=Xe(u,"footerSlot"),I=Xe(u,"cursorConfig"),$=Xe(u,"keyHint"),C=Xe(u,"containerNodeSlot"),D=f==="reference"?zp(u):null,G=Xe(u,"effectSlot"),Y=Xe(u,"fullscreenEffectSlot"),B=we(f,{id:r.get(u.id?.id),guid:u.id?.id||0,giaInfoIndex:(u.ui?.content?.info||[]).find(_=>_.field501===2&&_.field502===6)?.index?.value,giaRelatedGuids:(u.ui?.content?.info||[]).find(_=>_.field501===4&&_.field502===4)?.related?.value||[],name:u.name||f,visible:Xe(u,"field14")?.field17?.initiallyHidden!==!0,active:Xe(u,"field14")?.initiallyInactive!==!0,canControllerFocus:x?.field505===1,scriptMappingIds:(w?.field502||[]).map(_=>Number(_?.field1?.id)).filter(_=>Number.isSafeInteger(_)&&_>0),transformByPlatform:Dp(u),syncAllDevices:Xe(u,"transform")?.multiPlatform?.field504===1,giaRaw:{genericField501:w?.field501??0,footerField505:x?.field505??0,...f==="textbox"||f==="textwindow"?{textField501:h?.field501??20,textField503:h?.field503??12,textAlign:h?.align??0,...[void 0,0,1,2].includes(h?.verticalAlign)?{}:{textVerticalAlign:h.verticalAlign},...f==="textwindow"?{textField511:h?.field511??1,textViewField502:h?.viewFlags?.field502??1,textViewField503:h?.viewFlags?.field503??1}:{}}:{},...f==="cursor"?{cursorField501:I?.field501??0}:{},...D?.raw||{},...f==="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}:{},...f==="keyhint"?{keyHintField501:$?.field501??1,keyHintField502:$?.field502??1}:{},...f==="image"?{imageSlotType:m?.imageType??0,imageField502:p?.field502??1,imageField504:p?.field504??1,imageField505:p?.field505??1,imageField507:p?.field507??2,imageFillType:p?.fillType??1}:{},...f==="animation"?{effectSlot:G??""}:{},...f==="fullscreen"?{fullscreenEffectSlot:Y??""}:{}},...f==="container"?{isolateNavigation:C?.isolateNavigation===!0,disableKeyEventPassthrough:C?.disableKeyEventPassthrough===!0,disableCursorEventPassthrough:C?.disableCursorEventPassthrough===!0,showCursor:C?.showCursor===!0}:{},...f==="cursor"?{raycastTarget:I?.field501===1}:{},...f==="textbox"||f==="textwindow"?{text:h?.text?.value??"",fontSize:h?.fontSize??20,minimumFontSize:h?.minimumFontSize??20,adaptiveFontSize:h?.adaptive===1,fontColor:h?.color??4294967295,bgColor:h?.color2??0,enableOutline:h?.outlineOff!==1,outlineColor:h?.color3??858993459,horizontalAlignment:h?.align===1?"Middle":h?.align===2?"Right":"Left",verticalAlignment:{0:"Top",1:"Middle",2:"Bottom"}[h?.verticalAlign??0]||"Top",...f==="textwindow"?{interactable:!0,showScrollBar:!0}:{}}:{},...f==="image"?{imageSource:"StaticReference",imageId:m?.assetId??0,imageType:m?.imageType===1?"Stretch":"Basic",imageColor:Number.isFinite(m?.field502)?m.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}:{},...f==="button"?{interactable:g?.interactable===1,raycastTarget:g?.raycastTarget===1,clickAudioId:g?.clickAudioId??50888}:{},...f==="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}:{},...D?{referencedPrefabId:D.referencedPrefabId}:{},...f==="keyhint"?{keyboardKeyCode:$?.field502??null,controllerKeyCode:$?.field501??null}:{},...f==="animation"?{animationId:G??""}:{},...f==="fullscreen"?{animationId:Y??""}:{}});n.set(u.id?.id,B),(D?.raw.templateRefSlotBase64||D?.raw.templateRefOuterBase64)&&s.push(`${B.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`),(f==="textbox"||f==="textwindow")&&![void 0,0,1,2].includes(h?.align)&&s.push(`${B.name}: \u6C34\u5E73\u5BF9\u9F50\u679A\u4E3E ${h.align} \u7684\u542B\u4E49\u672A\u77E5\uFF0C\u5DF2\u539F\u6837\u4FDD\u7559\u3002`),(f==="textbox"||f==="textwindow")&&![void 0,0,1,2].includes(h?.verticalAlign)&&s.push(`${B.name}: \u5782\u76F4\u5BF9\u9F50\u679A\u4E3E ${h.verticalAlign} \u7684\u542B\u4E49\u672A\u77E5\uFF0C\u5DF2\u539F\u6837\u4FDD\u7559\u3002`),f==="image"&&![void 0,0,1,2,3,4,5].includes(p?.fillType)&&s.push(`${B.name}: \u586B\u5145\u5F62\u72B6\u679A\u4E3E ${p.fillType} \u672A\u8BC6\u522B\uFF0C\u5DF2\u4FDD\u7559\u539F\u503C\u3002`),f==="button"&&o.set(B.id,{unavailableChildId:g?.disabledChild,hoverChildId:g?.hoverChild,pressedChildId:g?.pressedChild,selectedChildId:g?.selectedChild})}let a=[],l=new Set;for(let u of t){let f=n.get(u.id?.id),h=(u.ui?.content?.children||[]).map(m=>n.get(m)).filter(Boolean);if(h.length){f.children=e?h.slice().reverse():h;for(let m of h)l.add(m.id)}}for(let u of t){let f=n.get(u.id?.id),h=u.ui?.content?.parent||0,m=n.get(h);m?l.has(f.id)||(e?m.children.unshift(f):m.children.push(f)):a.push(f)}for(let[u,f]of o){let h=[...n.values()].find(m=>m.id===u);for(let[m,p]of Object.entries(f))h[m]=r.get(p)||null}return{nodes:n,rootCandidates:a,warnings:s}}function Vf(t){let e=Jn(t),i=It.toObject(It.decode(e),{longs:Number,enums:Number,bytes:Buffer,defaults:!1,arrays:!0,objects:!0}),r=[...i.graph||[],...i.accessories||[]],n=x=>!!x.ui?.content&&[15,21,70].includes(Number(x.which)),o=(i.graph||[]).filter(n);if(!o.some(x=>x.ui?.content))throw new Error("GIA \u4E0D\u542B\u53EF\u8BC6\u522B\u7684 UIControlGroup \u4E3B\u56FE");let s=o.find(x=>x.which===21)||null,a=o.filter(x=>Number(x.which)===70),l=(i.accessories||[]).filter(n),u=new Set((s?.relatedIds||[]).map(x=>x.id||0)),f=s?u.size?l.filter(x=>u.has(x.id?.id||0)):l:[],h=a.length?[...a,...l.filter(x=>!u.has(x.id?.id||0))]:s?[]:[...o,...l];if(!f.length&&!h.length)throw new Error("GIA \u4E0D\u542B\u5BA2\u6237\u7AEF\u63A7\u4EF6");let m=["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(x=>!n(x)&&Number(x.which)!==Mi);p.length&&m.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 g=qf(i);m.push(...g.warnings);let b=null,w=null;if(f.length){let x=_f(f,{reverseSiblings:!0,idOffset:0});m.push(...x.warnings);let I=x.rootCandidates.find(C=>C.kind==="container")||x.rootCandidates[0];if(!I)throw new Error("GIA \u672A\u627E\u5230\u5BA2\u6237\u7AEF\u6839\u63A7\u4EF6");let $=we("server-container",{id:"sc1",guid:s?.id?.id||0,name:s?.name||"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u5BB9\u5668",giaRelatedGuids:(s?.ui?.content?.info||[]).find(C=>C.field501===4&&C.field502===4)?.related?.value||[]});$.children=[I],x.rootCandidates.length>1&&m.push(`\u68C0\u6D4B\u5230 ${x.rootCandidates.length} \u4E2A\u65E0\u7236\u8282\u70B9\u63A7\u4EF6\uFF0C\u4EC5\u5BFC\u5165\u4EE5\u201C${I.name}\u201D\u4E3A\u6839\u7684\u6811\u3002`),b={version:1,layoutSchemaVersion:Ze,meta:{name:s?.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:I.id,script:{controlId:I.id,path:"",source:""},root:$}}if(h.length){let x=_f(h,{reverseSiblings:!1,idOffset:1e3});if(m.push(...x.warnings),!x.rootCandidates.length)throw new Error("GIA \u672A\u627E\u5230\u5BA2\u6237\u7AEF\u6A21\u677F");let I=we("server-container",{id:"sc1",guid:0,name:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"});I.children=x.rootCandidates,w={version:1,layoutSchemaVersion:Ze,meta:{name:x.rootCandidates.length===1?x.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:x.rootCandidates[0].id,script:{controlId:x.rootCandidates[0].id,path:"",source:""},root:I},jt(w,{warnings:m});for(let $ of x.rootCandidates)ke($,C=>C.children.reverse());b||(b=w)}return{project:b,clientProject:w&&b!==w?w:void 0,scripts:g.scripts,warnings:m,metadata:{gameVersion:i.gameVersion||"",filePath:i.filePath||"",...Number.isSafeInteger(Number(i.modeFlag))?{modeFlag:Number(i.modeFlag)}:{},combined:!!(s&&a.length)}}}function qs(t){let e=Jn(t),i=It.toObject(It.decode(e),{longs:Number,enums:Number,defaults:!1,arrays:!0,objects:!0}),r=i.graph||[],n=i.accessories||[],o=[],s=(p,g)=>p!=null&&Object.prototype.hasOwnProperty.call(p,g),a=new Map,l=[];/^\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 u=r.filter(p=>p.which===70).map(p=>{let g=Wn(p),b=p.ui?.content?.info||[],w=b.find($=>$.field501===2&&$.field502===6)?.index?.value,x=b.find($=>$.field501===4&&$.field502===4),I=x?.related?.value||[];return ut(w)||o.push(`${p.name}: Info.index=${w??"<missing>"}\uFF0C\u5FC5\u987B\u662F\u6B63\u6574\u6570`),x||o.push(`${p.name}: \u9876\u5C42 UIControlTemplate \u7F3A\u5C11 Info.related \u8BB0\u5F55`),{id:p.id?.id||0,name:p.name||"",kind:g,actualIndex:w,relatedPresent:!!x,relatedGuids:I}}),f=new Map;for(let p of u){if(!ut(p.actualIndex))continue;let g=f.get(p.actualIndex);g?o.push(`${p.name}: \u72EC\u7ACB\u6A21\u677F\u8D44\u4EA7\u7F16\u53F7 ${p.actualIndex} \u4E0E ${g.name} \u91CD\u590D`):f.set(p.actualIndex,p)}u.length||o.push("Root.graph \u4E0D\u542B UIControlTemplate(70)");let h=0,m=0;for(let p of[...r,...n]){if(!p.ui?.content)continue;let g=p.id?.id||0,b=p.ui.content,w=Wn(p),x=r.includes(p)&&p.which===70,I=`${p.name||"<unnamed>"}(${g||"<missing-guid>"})`;lt(g)?a.has(g)?o.push(`${I}: GUID \u4E0E ${a.get(g).name||"<unnamed>"} \u91CD\u590D`):a.set(g,p):o.push(`${I}: GraphUnit GUID \u975E\u6CD5\uFF08\u5141\u8BB8 0x40000000\u20130x403FFFFF\uFF09`),(p.id?.class!==1||p.id?.type!==8)&&o.push(`${I}: GraphUnit.id \u5FC5\u987B\u4E3A class=1,type=8`),b.guid!==g&&o.push(`${I}: content.guid=${b.guid??"<missing>"} \u4E0E GraphUnit.id.id \u4E0D\u4E00\u81F4`),x&&p.which!==70&&o.push(`${I}: \u6A21\u677F\u6839 which \u5FC5\u987B\u4E3A UIControlTemplate(70)`),!x&&p.which!==15&&o.push(`${I}: \u9644\u4EF6\u63A7\u4EF6 which \u5FC5\u987B\u4E3A UIControl(15)`);let $=b.info||[],C=$.find(S=>S.field501===1&&S.field502===5),D=$.find(S=>S.field501===2&&S.field502===6);C?.guid?.value!==g&&o.push(`${I}: Info.self GUID \u7F3A\u5931\u6216\u4E0E\u81EA\u8EAB\u4E0D\u4E00\u81F4`),ut(D?.index?.value)||o.push(`${I}: Info.index=${D?.index?.value??"<missing>"}\uFF0C\u5FC5\u987B\u662F\u6B63\u6574\u6570`);let G=$.find(S=>S.field501===4&&S.field502===4);x&&!G&&o.push(`${I}: \u9876\u5C42\u6A21\u677F\u7F3A\u5C11 Info.related \u8BB0\u5F55`),!x&&G&&o.push(`${I}: \u9644\u4EF6\u63A7\u4EF6\u4E0D\u5E94\u5199 Info.related`);let Y=Af[w],B=b.data||[],_=B.map(S=>`${S.field501}/${S.field502}`),O=Y?.map(([S])=>S)||[];Y?JSON.stringify(_)!==JSON.stringify(O)&&o.push(`${I}: Data \u69FD\u4F4D\u987A\u5E8F ${_.join(",")}\uFF0C\u5E94\u4E3A ${O.join(",")}`):o.push(`${I}: \u672A\u77E5\u5BA2\u6237\u7AEF\u63A7\u4EF6\u7C7B\u578B ${w}`);for(let S=0;S<Math.min(B.length,Y?.length||0);S+=1){let M=B[S],[j,H,Q]=Y[S];if(s(M,H)||o.push(`${I}: Data ${j} \u7F3A\u5C11 ${H} \u5206\u652F`),!Q)continue;s(M.details,Q)||o.push(`${I}: Details ${j} \u7F3A\u5C11 ${Q} \u5206\u652F`);let ce=Of[j];(M.details?.field501!==ce||M.details?.field502!==M.field502||M.details?.field503!==1)&&o.push(`${I}: Details ${j} \u6807\u8BB0\u5E94\u4E3A ${ce}/${M.field502}/1`);let ve=M.details?.nodeRef;(ve?.class!==1||ve?.type!==8||ve?.id!==g)&&o.push(`${I}: Details ${j} node_ref \u672A\u6307\u5411\u81EA\u8EAB`)}let y=(p.ui.content.data||[]).find(S=>S.field501===4&&S.field502===86);y&&(s(y.field14,"field17")?h+=1:o.push(`${I}: \u7C7B\u578B Data \u7F3A\u5C11\u663E\u5F0F Field14.field17 \u7A7A\u4E32`),s(y.details?.field14,"field17")?h+=1:o.push(`${I}: \u7C7B\u578B Details \u7F3A\u5C11\u663E\u5F0F Field14.field17 \u7A7A\u4E32`));let N=(p.ui.content.data||[]).find(S=>S.details?.transform)?.details?.transform?.multiPlatform?.platforms||[];N.length!==4&&o.push(`${I}: \u591A\u5E73\u53F0\u53D8\u6362\u6570\u91CF=${N.length}\uFF0C\u5E94\u4E3A 4`);let E=N.map(S=>S.platformType||0);JSON.stringify(E)!==JSON.stringify([0,1,2,3])&&o.push(`${I}: \u5E73\u53F0\u987A\u5E8F ${E.join(",")}\uFF0C\u5E94\u4E3A 0,1,2,3`);let c=(p.ui.content.data||[]).find(S=>S.details?.transform)?.details?.transform;c?.multiPlatform?.field502!==$r[w]&&o.push(`${I}: \u53D8\u6362 preset=${c?.multiPlatform?.field502??"<missing>"}\uFF0C${w} \u5E94\u4E3A ${$r[w]}`);for(let S of N)s(S.transform,"field508")?m+=1:o.push(`${I}: RectTransform \u7F3A\u5C11\u663E\u5F0F field508 \u7A7A\u4E32`);l.push({id:g,name:p.name||"",kind:w,template:x,parent:b.parent||0,children:[...b.children||[]],relatedIds:(p.relatedIds||[]).map(S=>S.id||0),dataSignatures:_})}for(let p of l){let g=`${p.name||"<unnamed>"}(${p.id})`;if(JSON.stringify(p.relatedIds)!==JSON.stringify(p.children)&&o.push(`${g}: GraphUnit.relatedIds \u4E0E content.children \u4E0D\u4E00\u81F4`),p.template&&p.parent&&o.push(`${g}: \u9876\u5C42\u6A21\u677F\u4E0D\u5E94\u6709 parent`),!p.template){let b=a.get(p.parent);b?(b.ui?.content?.children||[]).includes(p.id)||o.push(`${g}: \u7236\u63A7\u4EF6 children \u672A\u53CD\u5411\u5305\u542B\u81EA\u8EAB`):o.push(`${g}: parent=${p.parent||"<missing>"} \u4E0D\u5B58\u5728`)}for(let b of p.children){let w=a.get(b);w?(w.ui?.content?.parent||0)!==p.id&&o.push(`${g}: child=${b} \u7684 parent \u672A\u6307\u56DE\u81EA\u8EAB`):o.push(`${g}: child=${b} \u4E0D\u5B58\u5728`)}}return{valid:o.length===0,errors:o,filePath:i.filePath||"",gameVersion:i.gameVersion||"",templateCount:u.length,accessoryCount:n.length,templates:u,units:l,explicitEmpty:{field17:h,rectField508:m}}}function Bs(t){let e=Jn(t),i=It.toObject(It.decode(e),{longs:Number,enums:Number,defaults:!1,arrays:!0,objects:!0}),r=(i.graph||[]).filter(c=>c.ui?.content&&Number(c.which)===21),n=(i.graph||[]).filter(c=>Number(c.which)===70),o=(i.graph||[]).filter(c=>Number(c.which)===Mi),s=(i.accessories||[]).filter(c=>c.ui?.content),a=[],l=(c,S)=>c!=null&&Object.prototype.hasOwnProperty.call(c,S);/^\d+-\d+-\d+-\\.+\.gia$/iu.test(i.filePath||"")||a.push(`Root.filePath \u4E0D\u662F UID-TIME-ID-\\\u6587\u4EF6\u540D.gia\uFF1A${i.filePath||"<missing>"}`),r.length!==1&&a.push(`\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F UIControlGroup \u6570\u91CF=${r.length}\uFF0C\u5E94\u4E3A 1`);let u=(i.graph||[]).filter(c=>{let S=Number(c.which);return S===Mi||S===70||S===21?!1:!c.ui?.content});u.length&&a.push(`Root.graph \u542B ${u.length} \u4E2A\u65E0\u6CD5\u8BC6\u522B\u7684\u975E\u63A7\u4EF6/\u975E\u811A\u672C\u5355\u5143`);let f=r[0];if(!f)return{valid:!1,errors:a,filePath:i.filePath||"",gameVersion:i.gameVersion||"",accessoryCount:s.length,controls:[],scriptCount:o.length,explicitEmpty:{field17:0,rectField508:0}};let h=[f,...n,...s],m=new Map;for(let c of h){let S=c.id?.id||0,M=`${c.name||"<unnamed>"}(${S||"<missing-guid>"})`;lt(S)?m.has(S)?a.push(`${M}: GUID \u91CD\u590D`):m.set(S,c):a.push(`${M}: GraphUnit GUID \u975E\u6CD5\uFF08\u5141\u8BB8 0x40000000\u20130x403FFFFF\uFF09`),(c.id?.class!==1||c.id?.type!==8)&&a.push(`${M}: GraphUnit.id \u5FC5\u987B\u4E3A class=1,type=8`),c.ui?.content?.guid!==S&&a.push(`${M}: content.guid \u4E0E GraphUnit.id.id \u4E0D\u4E00\u81F4`)}let p=f.id?.id||0,g=f.ui.content,b=`${f.name||"<unnamed>"}(${p})`;f.which!==21&&a.push(`${b}: which \u5FC5\u987B\u4E3A UIControlGroup(21)`);let w=g.info||[];w.find(c=>c.field501===1&&c.field502===5)?.guid?.value!==p&&a.push(`${b}: Info.self GUID \u7F3A\u5931\u6216\u4E0D\u4E00\u81F4`),w.find(c=>c.field501===2&&c.field502===6)?.index?.value!==1&&a.push(`${b}: Info.index \u5FC5\u987B\u4E3A 1`);let x=w.find(c=>c.field501===4&&c.field502===4);x||a.push(`${b}: \u7F3A\u5C11\u663E\u5F0F Info.related \u8BB0\u5F55`);let I=0,$=0,C=(c,S,M,j=!1)=>{let H=c.id?.id||0,Q=`${c.name||"<unnamed>"}(${H})`,ce=c.ui.content.data||[],ve=ce.map(Oe=>`${Oe.field501}/${Oe.field502}`),be=M.map(([Oe])=>Oe);JSON.stringify(ve)!==JSON.stringify(be)&&a.push(`${Q}: Data \u69FD\u4F4D\u987A\u5E8F ${ve.join(",")}\uFF0C\u5E94\u4E3A ${be.join(",")}`);for(let Oe=0;Oe<Math.min(ce.length,M.length);Oe+=1){let at=ce[Oe],[pt,de,T]=M[Oe];if(l(at,de)||a.push(`${Q}: Data ${pt} \u7F3A\u5C11 ${de} \u5206\u652F`),!T)continue;l(at.details,T)||a.push(`${Q}: Details ${pt} \u7F3A\u5C11 ${T} \u5206\u652F`);let A=Of[pt];(at.details?.field501!==A||at.details?.field502!==at.field502||at.details?.field503!==1)&&a.push(`${Q}: Details ${pt} \u6807\u8BB0\u5E94\u4E3A ${A}/${at.field502}/1`);let P=at.details?.nodeRef;(P?.class!==1||P?.type!==8||P?.id!==H)&&a.push(`${Q}: Details ${pt} node_ref \u672A\u6307\u5411\u81EA\u8EAB`)}let me=ce.find(Oe=>Oe.field501===4&&Oe.field502===(j?23:86)),ee=j?"empty15":"field17";l(me?.field14,ee)?j||(I+=1):a.push(`${Q}: \u7C7B\u578B Data \u7F3A\u5C11\u663E\u5F0F Field14.${ee} \u7A7A\u4E32`),l(me?.details?.field14,ee)?j||(I+=1):a.push(`${Q}: \u7C7B\u578B Details \u7F3A\u5C11\u663E\u5F0F Field14.${ee} \u7A7A\u4E32`);let ue=ce.find(Oe=>Oe.details?.transform)?.details?.transform,Se=ue?.multiPlatform?.platforms||[];Se.length!==4&&a.push(`${Q}: \u591A\u5E73\u53F0\u53D8\u6362\u6570\u91CF=${Se.length}\uFF0C\u5E94\u4E3A 4`);let ht=Se.map(Oe=>Oe.platformType||0);JSON.stringify(ht)!==JSON.stringify([0,1,2,3])&&a.push(`${Q}: \u5E73\u53F0\u987A\u5E8F ${ht.join(",")}\uFF0C\u5E94\u4E3A 0,1,2,3`);let Gt=j?$r["server-container"]:$r[S];ue?.multiPlatform?.field502!==Gt&&a.push(`${Q}: \u53D8\u6362 preset=${ue?.multiPlatform?.field502??"<missing>"}\uFF0C\u5E94\u4E3A ${Gt}`);for(let Oe of Se)l(Oe.transform,"field508")?$+=1:a.push(`${Q}: RectTransform \u7F3A\u5C11\u663E\u5F0F field508 \u7A7A\u4E32`);return ve};C(f,"server-container",Cp,!0);let D=(f.relatedIds||[]).map(c=>c.id||0),G=new Set(D),Y=s.filter(c=>G.has(c.id?.id||0)),B=Y.map(c=>c.id?.id||0);JSON.stringify(D)!==JSON.stringify(B)&&a.push(`${b}: \u4E3B\u56FE relatedIds \u5FC5\u987B\u6309\u987A\u5E8F\u8986\u76D6\u672C\u7EC4 accessories`);let _=g.data?.find(c=>c.details?.rootChildRef)?.details?.rootChildRef?.guid||0,O=m.get(_);(!O||!Y.includes(O))&&a.push(`${b}: 62/82 \u6839\u8282\u70B9\u5F15\u7528\u4E0D\u5B58\u5728`),B[0]!==_&&a.push(`${b}: \u6839\u5BB9\u5668\u8282\u70B9\u5FC5\u987B\u662F\u672C\u7EC4 accessories[0]`);let y=[];for(let c of Y){let S=c.id?.id||0,M=c.ui.content,j=`${c.name||"<unnamed>"}(${S})`,H=Wn(c);c.which!==15&&a.push(`${j}: which \u5FC5\u987B\u4E3A UIControl(15)`);let Q=M.info||[];(Q.length!==1||Q[0]?.field501!==1||Q[0]?.field502!==5||Q[0]?.guid?.value!==S)&&a.push(`${j}: \u670D\u52A1\u7AEF\u5BB9\u5668\u5185\u63A7\u4EF6 Info \u5FC5\u987B\u53EA\u542B\u81EA\u8EAB GUID`);let ce=Af[H];ce||a.push(`${j}: \u672A\u77E5\u5BA2\u6237\u7AEF\u63A7\u4EF6\u7C7B\u578B ${H}`);let ve=ce?C(c,H,ce):[];y.push({id:S,name:c.name||"",kind:H,parent:M.parent||0,children:[...M.children||[]],relatedIds:(c.relatedIds||[]).map(be=>be.id||0),dataSignatures:ve})}let N=y.find(c=>c.id===_);N&&(N.kind!=="container"&&a.push(`${N.name}(${_}): \u6839\u63A7\u4EF6\u5FC5\u987B\u4E3A\u5BB9\u5668\u8282\u70B9`),N.parent&&a.push(`${N.name}(${_}): \u6839\u63A7\u4EF6\u4E0D\u5E94\u6709 parent`));let E=new Map(y.map(c=>[c.id,c]));for(let c of y){let S=`${c.name}(${c.id})`;if(JSON.stringify(c.relatedIds)!==JSON.stringify(c.children)&&a.push(`${S}: relatedIds \u5FC5\u987B\u4E0E\u76F4\u63A5 children \u4E00\u81F4`),c.id!==_){let M=E.get(c.parent);M?M.children.includes(c.id)||a.push(`${S}: \u7236\u63A7\u4EF6 children \u672A\u53CD\u5411\u5305\u542B\u81EA\u8EAB`):a.push(`${S}: parent=${c.parent||"<missing>"} \u4E0D\u5B58\u5728`)}for(let M of c.children){let j=E.get(M);j?j.parent!==c.id&&a.push(`${S}: child=${M} \u7684 parent \u672A\u6307\u56DE\u81EA\u8EAB`):a.push(`${S}: child=${M} \u4E0D\u5B58\u5728`)}}if(n.length){let c=qs(Ds({...i,graph:n,accessories:s.filter(S=>!G.has(S.id?.id||0))}));a.push(...c.errors.map(S=>`\u5BA2\u6237\u7AEF\u6A21\u677F: ${S}`))}return{valid:a.length===0,errors:a,filePath:i.filePath||"",gameVersion:i.gameVersion||"",graph:{id:p,name:f.name||"",relatedGuids:x?.related?.value||[],rootGuid:_},accessoryCount:s.length,controls:y,scriptCount:o.length,explicitEmpty:{field17:I,rectField508:$}}}function Lf(t,e=[]){if(!t||t.layoutSchemaVersion===Ze)return t;if(t.layoutSchemaVersion!==void 0&&t.layoutSchemaVersion!==1)throw new Error(`\u4EC5\u652F\u6301 layoutSchemaVersion=2 \u6216\u53EF\u8FC1\u79FB\u7684\u65E7\u5E03\u5C40\uFF0C\u6536\u5230 ${t.layoutSchemaVersion}`);if(!t.root)return{...t,layoutSchemaVersion:Ze};let i=structuredClone(t),r=0;return ke(i.root,n=>{let o=n.transformByPlatform||{},s=n.transformByCanvas||{},a=n.name||n.id;for(let u of Object.keys(o))if(!Be.includes(u))throw new Error(`${a}: unknown platform ${u}`);let l={};for(let u of Be){let f=Ui[u],h=Te[f].platform,m=Object.keys(Te).filter(w=>Te[w].platform===h&&s[w]),p=s[f]?f:m[0],g=u==="CONTROLLER_CONSOLE"?l.KEYBOARD:u==="CONTROLLER_MOBILE"?l.TOUCHSCREEN:null,b=o[u]??g??(p?s[p]:null);if(l[u]=b?Ot(b):To(n.kind),b||e.push(`${a}: ${u} \u65E0\u65E7\u5E03\u5C40\uFF0C\u5DF2\u4F7F\u7528\u63A7\u4EF6\u9ED8\u8BA4\u503C`),!o[u]&&!g&&p&&p!==f&&e.push(`${a}: \u7F3A\u5C11 ${f}\uFF0C\u5DF2\u91C7\u7528 ${p} \u7684\u951A\u70B9\u548C\u5C3A\u5BF8\u53C2\u6570`),!g)for(let w of m)JSON.stringify(l[u])!==JSON.stringify(Ot(s[w]))&&e.push(`${a}: ${w} \u4E0E ${u} \u5E03\u5C40\u51B2\u7A81\uFF0C\u4FDD\u7559${o[u]?"\u5DF2\u6709\u5E73\u53F0":p}\u53C2\u6570`)}ii(l,`${a}.transformByPlatform`),n.transformByPlatform=l,delete n.transformByCanvas,r++}),i.layoutSchemaVersion=Ze,e.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 Vs(t){if(![1,2,3,4].includes(t))throw new Error(`\u4EC5\u652F\u6301 version=1\u20134 \u7684\u5B58\u6863\uFF0C\u6536\u5230 ${t}`)}function js(t,e,i,r=t.canvasId){let n=ni(t.root,e);return!n||n.kind==="server-container"?Qe(r):i[n.id]||Qe(r)}function vi(t,{warnings:e=[]}={}){if(!t)return ki();if(t=Lf(t,e),(t.root||t.layoutSchemaVersion!==void 0)&&t.layoutSchemaVersion!==Ze)throw new Error(`\u4EC5\u652F\u6301 layoutSchemaVersion=${Ze} \u7684\u56DB\u5E73\u53F0\u5E03\u5C40\uFF0C\u4E0D\u652F\u6301\u65E7\u753B\u5E03\u5E03\u5C40\u6216\u5176\u4ED6\u7248\u672C`);let i=t.meta?.assetType==="client-control-template"?"client-control-template":"server-control-template",r=i==="client-control-template"?Zi():ki(),n={layoutSchemaVersion:Ze,version:Number.isSafeInteger(t.version)&&t.version>0?t.version:1,meta:{name:String(t.meta?.name||r.meta.name),assetType:i,sourceFormat:String(t.meta?.sourceFormat||r.meta.sourceFormat),sourceFile:String(t.meta?.sourceFile||""),...t.meta?.gameVersion?{gameVersion:String(t.meta.gameVersion)}:{},...t.meta?.giaFilePath?{giaFilePath:String(t.meta.giaFilePath)}:{},...Number.isSafeInteger(Number(t.meta?.giaOwnerUid))?{giaOwnerUid:Number(t.meta.giaOwnerUid)}:{},...Number.isSafeInteger(Number(t.meta?.giaTimestamp))?{giaTimestamp:Number(t.meta.giaTimestamp)}:{},...Number.isSafeInteger(Number(t.meta?.giaFileId))?{giaFileId:Number(t.meta.giaFileId)}:{},...t.meta?.giaFileName?{giaFileName:String(t.meta.giaFileName)}:{},...Number.isSafeInteger(t.meta?.giaNextAssetIndex)&&t.meta.giaNextAssetIndex>=2?{giaNextAssetIndex:t.meta.giaNextAssetIndex}:{},...Number.isSafeInteger(t.meta?.giaAssetIndexSchemaVersion)&&t.meta.giaAssetIndexSchemaVersion>0?{giaAssetIndexSchemaVersion:t.meta.giaAssetIndexSchemaVersion}:{},...Number.isSafeInteger(Number(t.meta?.giaModeFlag))&&Number(t.meta.giaModeFlag)>=0?{giaModeFlag:Number(t.meta.giaModeFlag)}:{}},canvasId:t.canvasId&&Te[t.canvasId]?t.canvasId:sn,selectedId:t.selectedId||r.selectedId,root:Po(t.root||r.root)};return Hf(n),jt(n,{warnings:e}),n}function Hf(t){let e=new Set;ke(t.root,i=>{if(typeof i.id!="string"||!i.id)throw new Error("node id must be a non-empty string");if(e.has(i.id))throw new Error(`duplicate node id: ${i.id}`);e.add(i.id)}),e.has(t.selectedId)||(t.selectedId=No(t.root).id)}function jf(t){return ri(Ji(t))}function $p(t,e){let i=!1;return ke(t,r=>{r.id===e&&(i=!0)}),i}function Gp(t,e,i,r){let o=si(t.root,t.canvasId).boxes[e.id],s=i.children.findIndex(h=>h.id===e.id);if(s<0)throw new Error("reparent: source node is not attached");if(i.children.splice(s,1),r.children.push(e),!o)return;let a=si(t.root,t.canvasId),l=r.kind==="server-container"?Qe(t.canvasId):a.boxes[r.id]||Qe(t.canvasId),u=oi(e.transformByPlatform,t.canvasId),f=_i(l,u,{posX:o.centerX,posY:o.centerY,width:o.width,height:o.height});hr(t,e,f)}function qp(t,e){return t.meta.assetType!=="client-control-template"?$o(t.root,e):(t.root.children||[]).flatMap(i=>$o(i,e))}function Kf(t,e){let i=yl(t.root,e);if(t.meta.assetType!=="client-control-template")return i;let r=Er(t),n=new Set;return r&&r.kind!=="server-container"&&ke(r,o=>n.add(o.id)),i.filter(o=>n.has(o.id))}function Wf(t){let{canvas:e,boxes:i}=si(t.root,t.canvasId),r=qr(t,new Set,{preserveLegacy:!0}),n=je(t.root,t.selectedId),o=n?i[n.id]:null;return oe({layoutSchemaVersion:Ze,version:t.version,meta:{...t.meta},canvasId:t.canvasId,canvas:{id:t.canvasId,width:e.width,height:e.height,platform:Te[t.canvasId].platform,label:Te[t.canvasId].label,presets:Object.values(Te).map(s=>({id:s.id,label:s.label,width:s.width,height:s.height,platform:s.platform}))},selectedId:t.selectedId,asset:{type:t.meta.assetType,label:t.meta.assetType==="client-control-template"?"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u670D\u52A1\u7AEF\u63A7\u4EF6\u6A21\u677F",templateCount:t.meta.assetType==="client-control-template"?t.root.children.length:1,currentTemplateId:t.meta.assetType==="client-control-template"&&Er(t)?.id||""},tree:qp(t,r),boxes:Kf(t,i),inspector:vl(n,t.canvasId,o||e,r),root:t.root})}function hr(t,e,i){let r=si(t.root,t.canvasId),n=js(t,e.id,r.boxes),o={};if(e.syncAllDevices!==!1)for(let s of Be){if(s===Ii(t.canvasId))continue;let a=Ui[s],l=si(t.root,a,s);o[s]=js(t,e.id,l.boxes,a)}e.transformByPlatform=tl({transformByPlatform:e.transformByPlatform,source:i,canvasId:t.canvasId,syncAllDevices:e.syncAllDevices!==!1,sourceParentBox:n,targetParentBoxByPlatform:o})}var Bp=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"]),Vp=new Set(["posX","posY","width","height"]),Lp=new Set(["anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY"]);function jp(t){if(typeof t=="number"&&Number.isFinite(t))return t>>>0;if(typeof t=="string"){let e=t.trim();if(e.startsWith("#")){let r=e.slice(1);if(r.length===6)return(4278190080|parseInt(r,16))>>>0;if(r.length===8)return parseInt(r,16)>>>0}let i=Number(e);if(Number.isFinite(i))return i>>>0}throw new Error("color must be an ARGB integer or #RRGGBB/#AARRGGBB string")}function Wt(t,e){let i=Number(t);if(!Number.isFinite(i))throw new Error(`${e} must be a finite number`);return i}function Uf(t){if(t===!0||t===1||t==="1"||t==="true")return!0;if(t===!1||t===0||t==="0"||t==="false")return!1;throw new Error("boolean field requires true or false")}var Up=new Set(["fontSize","minimumFontSize","imageId","clickAudioId","softEdgeWidthX","softEdgeWidthY","horizontalSoftRange","verticalSoftRange","fillAmount","cellSizeX","cellSizeY","spacingX","spacingY","padding1X","padding1Y","padding2X","padding2Y","previewCount","keyboardKeyCode","controllerKeyCode","itemPrefabId","layoutConstraintFixedCount"]),Yp=new Set(["active","visible","canControllerFocus","isolateNavigation","disableKeyEventPassthrough","disableCursorEventPassthrough","showCursor","adaptiveFontSize","enableOutline","enableMask","enableSoftEdge","enableFill","reverseMaskArea","raycastTarget","interactable","showScrollBar"]),Xp=new Set(["name","imageSource","horizontalAlignment","verticalAlignment","text","softEdgeMode","fillType","fillHorizontalType","fillVerticalType","fillRadial90Type","fillRadialType","scrollDirection","layoutConstraint","referencedPrefabId","animationId"]),Yf=new Set(["unavailableChildId","hoverChildId","pressedChildId","selectedChildId"]),Xf={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 Hp(t,e){if(!e||typeof e!="object")throw new Error("patch requires op");let i=e.op;if(i==="select")return e.id&&je(t.root,e.id)&&(t.selectedId=e.id),t;if(i==="pick"){let{boxes:r}=si(t.root,t.canvasId),n=Kf(t,r),o=bl(n,Number(e.x),Number(e.y));return o&&(t.selectedId=o),t}if(i==="setCanvas")return e.canvasId&&Te[e.canvasId]&&(t.canvasId=e.canvasId),t;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=e.assetType==="client-control-template"?Zi():ki();return t.version=r.version,t.meta=r.meta,t.canvasId=r.canvasId,t.selectedId=r.selectedId,t.root=r.root,t}if(i==="addTemplate"){if(t.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=we(e.kind,{id:Ro(t.root),guid:jf(t.root),name:e.name||`\u65B0${e.kind==="container"?"\u5BB9\u5668\u8282\u70B9":e.kind}\u6A21\u677F`});return t.root.children.push(r),t.selectedId=r.id,t}if(i==="add"){let r=je(t.root,e.parentId||t.selectedId);if(!r)throw new Error("add: parent not found");let n=Za(r,e.kind,{id:Ro(t.root),guid:jf(t.root),name:e.name});return t.selectedId=n.id,t}if(i==="reparent"){if(t.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=je(t.root,e.id||t.selectedId),n=r?ni(t.root,r.id):null,o=je(t.root,e.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||$p(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 t;if(n.kind==="server-container"&&o.kind!=="server-container"&&t.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 Gp(t,r,n,o),t.selectedId=r.id,t}if(i==="moveSibling"){let r=je(t.root,e.id||t.selectedId),n=r?ni(t.root,r.id):null;if(!r||!n)throw new Error("moveSibling: node not found");let o=n.children.findIndex(l=>l.id===r.id),s=e.direction==="up"?-1:e.direction==="down"?1:0,a=o+s;return!s||a<0||a>=n.children.length||(n.children.splice(o,1),n.children.splice(a,0,r),t.selectedId=r.id),t}if(i==="remove"){let r=e.id||t.selectedId,n=ni(t.root,r);if(n?.kind==="server-container"){if(t.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((t.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 Qa(t.root,r)&&(ke(t.root,o=>{if(o.kind==="button")for(let s of Yf)o[s]&&!je(t.root,o[s])&&(o[s]=null)}),t.selectedId=n?n.id:t.root.id),t}if(i==="set"){let r=je(t.root,e.id||t.selectedId);if(!r)throw new Error("set: node not found");let n=e.key;n==="reverseMask"&&(n="reverseMaskArea");let o=e.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 u=n.slice(7);if(!u||u.includes("."))throw new Error("invalid raw GIA field path");let f=Ka(r.kind,u);if(!f)throw new Error(`unknown raw GIA field for ${r.kind}: ${u}`);if(r.giaRaw||={},r.giaRaw[u]=Co(f,o),u==="footerField505"&&[0,1].includes(r.giaRaw[u])&&(r.canControllerFocus=r.giaRaw[u]===1),r.kind==="cursor"&&u==="cursorField501"&&[0,1].includes(r.giaRaw[u])&&(r.raycastTarget=r.giaRaw[u]===1),(r.kind==="textbox"||r.kind==="textwindow")&&u==="textAlign"){let h={0:"Left",1:"Middle",2:"Right"}[r.giaRaw[u]];h&&(r.horizontalAlignment=h)}if(r.kind==="image"&&u==="imageFillType"){let h={1:"Horizontal",2:"Vertical",3:"Radial90",4:"Radial180",5:"Radial360"}[r.giaRaw[u]];h&&(r.fillType=h)}return r.kind==="keyhint"&&u==="keyHintField502"&&(r.keyboardKeyCode=r.giaRaw[u]),r.kind==="keyhint"&&u==="keyHintField501"&&(r.controllerKeyCode=r.giaRaw[u]),t}if(n==="syncAllDevices"){if(r.syncAllDevices=Uf(o),r.syncAllDevices){let u=oi(r.transformByPlatform,t.canvasId);hr(t,r,u)}return t}if(Bp.has(n)){if(n.endsWith("Color")&&(o=jp(o)),Up.has(n)){if(o=Wt(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(Yp.has(n)&&(o=Uf(o)),Xp.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(Xf[n]&&!Xf[n].includes(o))throw new Error(`invalid ${n}`);if(Yf.has(n))if(o===""||o===void 0||o===null)o=null;else{o=String(o);let u=je(t.root,o);if(!u||u===r||u.kind==="server-container"||!(r.children||[]).some(f=>f.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 u={Horizontal:1,Vertical:2,Radial90:3,Radial180:4,Radial360:5}[o];u&&(r.giaRaw.imageFillType=u)}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),t}let{boxes:s}=si(t.root,t.canvasId),a=js(t,r.id,s),l=oi(r.transformByPlatform,t.canvasId);if(n==="anchorType"){let u=Ls(s[r.id]),f=ja(l,o);return f=_i(a,f,u),hr(t,r,f),t}if(["rotationX","rotationY","rotationZ"].includes(n)){let u={...l,rotation:{...l.rotation,[n.slice(-1).toLowerCase()]:Wt(o,n)}};return hr(t,r,u),t}if(Lp.has(n)){let u=Ls(s[r.id]),f={...l,anchorMin:{...l.anchorMin},anchorMax:{...l.anchorMax},pivot:{...l.pivot}};return n==="anchorMinX"&&(f.anchorMin.x=Wt(o,n)),n==="anchorMinY"&&(f.anchorMin.y=Wt(o,n)),n==="anchorMaxX"&&(f.anchorMax.x=Wt(o,n)),n==="anchorMaxY"&&(f.anchorMax.y=Wt(o,n)),n==="pivotX"&&(f.pivot.x=Wt(o,n)),n==="pivotY"&&(f.pivot.y=Wt(o,n)),hr(t,r,_i(a,f,u)),t}if(Vp.has(n)){let u=Ls(s[r.id]),f=Wt(o,n);if((n==="width"||n==="height")&&f<0)throw new Error(`${n} must not be negative`);return u[n]=f,hr(t,r,_i(a,l,u)),t}throw new Error(`set: unknown key ${n}`)}if(i==="replace"){let r=vi(e.project);return t.version=r.version,t.meta=r.meta,t.canvasId=r.canvasId,t.selectedId=r.selectedId,t.root=r.root,t}throw new Error(`unknown op ${i}`)}function Us(t,e){if(!e||typeof e!="object")throw new Error("patch requires op");if(e.expectedRevision!==void 0&&Number(e.expectedRevision)!==t.version)throw new Error(`revision conflict: expected ${e.expectedRevision}, current ${t.version}`);let i=t.version,r=JSON.parse(JSON.stringify(t));return Hp(r,e),Hf(r),jt(r),r.version=i+1,Object.keys(t).forEach(n=>{delete t[n]}),Object.assign(t,r),t}function Ls(t){return t?{posX:t.centerX,posY:t.centerY,width:t.width,height:t.height}:{posX:0,posY:0,width:0,height:0}}import Kp from"fengari";var{lua:d,lauxlib:Ie,lualib:Jf,to_luastring:Zn,to_jsstring:Wp}=Kp,Jp=d.LUA_TNIL,Zp=d.LUA_TBOOLEAN,Qp=d.LUA_TNUMBER,em=d.LUA_TSTRING,Zf=d.LUA_TTABLE,tm=d.LUA_TFUNCTION,Ys=d.LUA_TUSERDATA,Ct=d.LUA_OK,Qf=new WeakMap,Xs=Symbol("luaTableEntries"),Hs={__scriptHostKey:!0};function q(t){return Zn(String(t))}function zi(t,e){Qf.set(t,e)}function st(t){return Qf.get(t)}var Br=class{constructor(e){this.value=e}};function Ge(t,e,i){if(i instanceof Br){d.lua_pushnumber(t,i.value);return}if(i==null){d.lua_pushnil(t);return}let r=typeof i;if(r==="boolean"){d.lua_pushboolean(t,i);return}if(r==="number"){Number.isInteger(i)&&Math.abs(i)<=2147483647?d.lua_pushinteger(t,i):d.lua_pushnumber(t,i);return}if(r==="string"){d.lua_pushstring(t,q(i));return}if(r==="function"){nm(t,e,i);return}if(i&&i[Xs]){let n=i[Xs];d.lua_createtable(t,Array.isArray(i)?i.length:0,n.length);for(let[o,s]of n)Ge(t,e,o),Ge(t,e,s),d.lua_settable(t,-3);return}if(Array.isArray(i)){d.lua_createtable(t,i.length,0);for(let n=0;n<i.length;n++)Ge(t,e,i[n]),d.lua_rawseti(t,-2,n+1);return}if(i&&i.__kind==="EnumItem"){e.pushEnumItem(t,i);return}if(i&&i.__kind==="CursorEventData"){e.pushCursor(t,i);return}if(i&&i.__kind==="Script"){e.pushScript(t,i);return}if(i&&i.typeofName){e.pushControl(t,i);return}if(i&&i.__kind==="ServerSignal"){e.pushSignal(t,i);return}if(i&&(i.SetEase||i.Append)){e.pushTween(t,i);return}if(r==="object"){d.lua_createtable(t,0,Object.keys(i).length);for(let[n,o]of Object.entries(i))Ge(t,e,o),d.lua_setfield(t,-2,q(n));return}d.lua_pushnil(t)}function Ce(t,e){if(d.lua_isnil(t,e)||d.lua_type(t,e)===d.LUA_TNONE)return"";if(!d.lua_isstring(t,e)&&d.lua_type(t,e)!==d.LUA_TNUMBER)return`lua_type=${d.lua_type(t,e)}`;let i=d.lua_tostring(t,e);return i==null?"":Wp(i)}function Jt(t,e){e=d.lua_absindex(t,e);let i=d.lua_type(t,e);if(i===Ys)return st(d.lua_touserdata(t,e));if(i===Zf){d.lua_pushlightuserdata(t,Hs),d.lua_rawget(t,e);let r=d.lua_type(t,-1)===Ys?d.lua_touserdata(t,-1):null;return d.lua_pop(t,1),r?st(r):null}return null}function He(t,e,i){i=d.lua_absindex(t,i);let r=d.lua_type(t,i);if(r===Jp)return null;if(r===Zp)return!!d.lua_toboolean(t,i);if(r===Qp)return d.lua_isinteger(t,i)?d.lua_tointeger(t,i):d.lua_tonumber(t,i);if(r===em)return Ce(t,i);if(r===Ys){let n=d.lua_touserdata(t,i);return st(n)??n}if(r===tm)return im(t,e,i);if(r===Zf){let n=Jt(t,i);if(n)return n;let o=[];for(d.lua_pushnil(t);d.lua_next(t,i)!==0;){let u=He(t,e,-2),f=He(t,e,-1);o.push([u,f]),d.lua_pop(t,1)}let s=new Map(o.filter(([u])=>Number.isInteger(u)&&u>=1)),a=0;for(;s.has(a+1);)a+=1;let l=a>0?[]:{};for(let[u,f]of o)Array.isArray(l)&&Number.isInteger(u)&&u>=1?l[u-1]=f:(typeof u=="string"||typeof u=="number")&&(l[u]=f);return Object.defineProperty(l,Xs,{value:o}),l}return null}function im(t,e,i){e.luaFunctions||(e.luaFunctions=new Map);let r=typeof d.lua_topointer=="function"?d.lua_topointer(t,i):null;if(r!=null&&e.luaFunctions.has(r))return e.luaFunctions.get(r);d.lua_pushvalue(t,i);let n=Ie.luaL_ref(t,d.LUA_REGISTRYINDEX),o=rm(t,e,n);return r!=null&&e.luaFunctions.set(r,o),o}function rm(t,e,i){let r=(...n)=>{if(r.__luaRef==null)throw new Error("attempt to call a released Lua callback");let o=d.lua_gettop(t);d.lua_rawgeti(t,d.LUA_REGISTRYINDEX,r.__luaRef);for(let u of n)Ge(t,e,u);if(d.lua_pcall(t,n.length,d.LUA_MULTRET,0)!==Ct){let u=Ce(t,-1);throw d.lua_settop(t,o),new Error(u)}let a=d.lua_gettop(t)-o,l=[];for(let u=1;u<=a;u++)l.push(He(t,e,o+u));if(d.lua_settop(t,o),l.length!==0)return l.length===1?l[0]:l};return r.__luaRef=i,r.__luaState=t,r}function ec(t){t?.__luaRef!=null&&(t.__luaHolds=(t.__luaHolds||0)+1)}function tc(t,e){if(!e||e.__luaRef==null||!e.__luaState)return;if(e.__luaHolds>1){e.__luaHolds-=1;return}let i=e.__luaState;if((!t?.luaStates||t.luaStates.has(i))&&Ie.luaL_unref(i,d.LUA_REGISTRYINDEX,e.__luaRef),e.__luaRef=null,e.__luaState=null,t?.luaFunctions)for(let[r,n]of t.luaFunctions)n===e&&t.luaFunctions.delete(r)}function nm(t,e,i){d.lua_pushlightuserdata(t,i),d.lua_pushlightuserdata(t,e),d.lua_pushcclosure(t,function(n){let o=d.lua_touserdata(n,d.lua_upvalueindex(1)),s=d.lua_touserdata(n,d.lua_upvalueindex(2)),a=d.lua_gettop(n),l=[];for(let u=1;u<=a;u++)l.push(He(n,s,u));try{let u=o(...l);if(Array.isArray(u)&&u.__multi){for(let f of u)Ge(n,s,f);return u.length}return u===void 0?0:(Ge(n,s,u),1)}catch(u){return d.lua_pushstring(n,q(String(u&&u.message?u.message:u))),d.lua_error(n)}},2)}function ic(t){!t||typeof d.lua_close!="function"||d.lua_close(t)}function rc(t){if(Ie.luaL_loadstring(t,q(["local nativeGetMetatable = getmetatable","getmetatable = function(value)",' if type(value) == "string" then return nil end'," return nativeGetMetatable(value)","end"].join(`
|
|
122
|
+
`)))===Ct&&d.lua_pcall(t,0,0,0),d.lua_settop(t,0),d.lua_pushnil(t),d.lua_setglobal(t,q("_VERSION")),d.lua_getglobal(t,q("string")),!d.lua_isnil(t,-1))for(let i of["dump","pack","unpack"])d.lua_pushnil(t),d.lua_setfield(t,-2,q(i));if(d.lua_pop(t,1),d.lua_pushnil(t),d.lua_setglobal(t,q("io")),d.lua_getglobal(t,q("os")),!d.lua_isnil(t,-1))for(let i of Object.keys({execute:1,getenv:1,remove:1,rename:1,tmpname:1,setlocale:1,exit:1}))d.lua_pushnil(t),d.lua_setfield(t,-2,q(i));d.lua_pop(t,1),d.lua_getglobal(t,q("debug")),d.lua_isnil(t,-1)?d.lua_pop(t,1):(d.lua_getfield(t,-1,q("traceback")),d.lua_newtable(t),d.lua_pushvalue(t,-2),d.lua_setfield(t,-2,q("traceback")),d.lua_setglobal(t,q("debug")),d.lua_pop(t,2)),d.lua_getglobal(t,q("math")),d.lua_isnil(t,-1)||(d.lua_pushcfunction(t,i=>{let r=d.lua_tonumber(i,1);return d.lua_pushboolean(i,Number.isNaN(r)),1}),d.lua_setfield(t,-2,q("isnan")),d.lua_pushcfunction(t,i=>{let r=d.lua_tonumber(i,1);return d.lua_pushboolean(i,r===1/0||r===-1/0),1}),d.lua_setfield(t,-2,q("isinf"))),d.lua_pop(t,1),d.lua_pushnil(t),d.lua_setglobal(t,q("package")),d.lua_pushnil(t),d.lua_setglobal(t,q("load")),d.lua_pushnil(t),d.lua_setglobal(t,q("loadfile")),d.lua_pushnil(t),d.lua_setglobal(t,q("dofile")),d.lua_pushnil(t),d.lua_setglobal(t,q("collectgarbage")),d.lua_pushnil(t),d.lua_setglobal(t,q("coroutine")),d.lua_pushnil(t),d.lua_setglobal(t,q("fengari"))}var dt=(t,e=0)=>Number.isFinite(Number(t))?Number(t):e,nc=t=>t?.Name||t,Qn=t=>Math.max(0,Math.min(1,dt(t)));function Vr(t){let e=t.parent?Vr(t.parent):[t.runtime.canvasWidth,t.runtime.canvasHeight];return[Math.max(0,(t.anchorMaxX-t.anchorMinX)*e[0]+dt(t.sizeDeltaX)),Math.max(0,(t.anchorMaxY-t.anchorMinY)*e[1]+dt(t.sizeDeltaY))]}function Lr(t){let[e,i]=Vr(t),r=nc(t.scrollDirection)==="Horizontal",n=Math.max(1,dt(t.cellSizeX,50)),o=Math.max(1,dt(t.cellSizeY,50)),s=Math.max(0,dt(t.spacingX)),a=Math.max(0,dt(t.spacingY)),l=Math.max(0,dt(t.padding1X)),u=Math.max(0,dt(t.padding1Y)),f=Math.max(0,dt(t.padding2X)),h=Math.max(0,dt(t.padding2Y)),m=r?i-u-h:e-l-f,p=r?o:n,g=r?a:s,b=nc(t.layoutConstraint)==="Fixed"?Math.max(1,Math.floor(dt(t.layoutConstraintFixedCount,1))):Math.max(1,Math.floor((m+g)/(p+g))),w=Math.ceil(t.itemCount/b),x=w?r?l+f+w*n+(w-1)*s:u+h+w*o+(w-1)*a:0,I=r?e:i,$=Math.max(0,x-I);return{width:e,height:i,horizontal:r,cellW:n,cellH:o,gapX:s,gapY:a,left:l,top:u,right:f,bottom:h,lanes:b,length:x,viewport:I,max:$,offset:Qn(t.scrollProgress)*$}}function pr(t){let e=Lr(t);for(let i=0;i<(t._gridItems?.length||0);i+=1){let r=t._gridItems[i];if(!r.alive||r.parent!==t)continue;let n=Math.floor(i/e.lanes),o=i%e.lanes,s=e.horizontal?n:o,a=e.horizontal?o:n,l=e.left+s*(e.cellW+e.gapX)+e.cellW/2-(e.horizontal?e.offset:0),u=-e.top-a*(e.cellH+e.gapY)-e.cellH/2+(e.horizontal?0:e.offset),f={anchorMinX:0,anchorMaxX:0,anchorMinY:1,anchorMaxY:1,pivotX:.5,pivotY:.5,sizeDeltaX:e.cellW,sizeDeltaY:e.cellH,anchoredPositionX:l,anchoredPositionY:u};Object.entries(f).some(([h,m])=>r[h]!==m)&&(Object.assign(r,f),r.markPlayDirty(!0))}return e}var oc={container:"ClientUIContainerControl",textbox:"ClientUITextBoxControl",textwindow:"ClientUITextWindowControl",image:"ClientUIImageControl",button:"ClientUIPresetButtonControl",cursor:"ClientUICursorEventAreaControl",grid:"ClientUIGridScrollerControl",keyhint:"ClientUIKeyHintControl",animation:"ClientUIAnimationControl",fullscreen:"ClientUIFullscreenAnimationControl",reference:"ClientUIReferenceControl"},om=["alive","Id","prefabIndex","active","activeInHierarchy","visible"],eo=new Set(["active","visible","parent","sizeDeltaX","sizeDeltaY","anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY"]),sm=["name","parent","anchoredPositionX","anchoredPositionY","sizeDeltaX","sizeDeltaY","anchorMinX","anchorMinY","anchorMaxX","anchorMaxY","pivotX","pivotY","localScaleX","localScaleY","localScaleZ","localRotationX","localRotationY","localRotationZ","canControllerFocus"],am={image:["imageSource","imageId"],grid:["itemCount","scrollDirection","layoutConstraint","layoutConstraintFixedCount"],reference:["referencedPrefabIndex"]},lm={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"]},um=["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"],sc=["AddCursorEventListener","RemoveCursorEventListener","RemoveCursorEventListeners","RemoveAllCursorEventListeners","SimulateCursorClick"],fm={image:["SetImage","SetSoftEdgeWidth","SetFillUnused","SetFillHorizontal","SetFillVertical","SetFillRadial90","SetFillRadial180","SetFillRadial360"],button:sc,cursor:sc,animation:["PlayAnimation","StopAnimation"],grid:["RefreshItems","GetItemIndex","GetItemSize","GetItemSpacing","GetPadding","ScrollToItemAt","GetContentLength"]};function Ws(t,e){return t.kind==="image"&&e==="imageType"&&t.runtime.canSelectImageType(t.imageId,t.imageSource)?"rw":om.includes(e)||(am[t.kind]||[]).includes(e)?"ro":sm.includes(e)||(lm[t.kind]||[]).includes(e)?"rw":null}var cm=["localRotationX","localRotationY","localRotationZ"],mr=Math.PI/180;function ac(t,e){return[t[3]*e[0]+t[0]*e[3]+t[1]*e[2]-t[2]*e[1],t[3]*e[1]-t[0]*e[2]+t[1]*e[3]+t[2]*e[0],t[3]*e[2]+t[0]*e[1]-t[1]*e[0]+t[2]*e[3],t[3]*e[3]-t[0]*e[0]-t[1]*e[1]-t[2]*e[2]]}function Ks(t){if(Object.is(t,-0))return t;let e=(t%360+360)%360,i=Math.round(e*1e6)/1e6;return i>=360?0:i}function lc(t,e,i){let r=I=>[Math.sin(I*mr/2),Math.cos(I*mr/2)],[n,o]=r(t),[s,a]=r(e),[l,u]=r(i),[f,h,m,p]=ac(ac([0,s,0,a],[n,0,0,o]),[0,0,l,u]),g=Math.max(-1,Math.min(1,-2*(h*m-p*f))),b,w,x;return Math.abs(g)>.999999?(b=Math.sign(g)*90,w=2*Math.atan2(h,p)/mr,x=0):(b=Math.asin(g)/mr,w=Math.atan2(2*(p*h+f*m),1-2*(f*f+h*h))/mr,x=Math.atan2(2*(p*m+f*h),1-2*(f*f+m*m))/mr),[Ks(b),Ks(w),Ks(x)]}function uc(t,e){return um.includes(e)||(fm[t.kind]||[]).includes(e)}var dm={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}},bi=class t{constructor(e,i){this.runtime=e,this.kind=i.kind||"container",this.typeofName=oc[this.kind]||oc.container,this.alive=!0,this.Id=i.Id??e.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=dm[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 t?n:new t(e,n);this.addChild(o)}}get parent(){return this._parent}set parent(e){if(this._parent===e)return;if(e!==null&&!(e instanceof t))throw new Error("parent must be a Control or nil");if(e&&e.runtime!==this.runtime)throw new Error("parent must belong to the same runtime");if(e===this)throw new Error("cannot parent a control to itself or its descendant");for(let r=e;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=e,this.markPlayDirty(!0),e&&!e.children.includes(this)?(e.children.push(this),e.markPlayDirty(!0)):!e&&this.alive&&!this.runtime.roots.includes(this)&&this.runtime.roots.push(this)}markPlayDirty(e=!1){this._playDirty=!0,e&&(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(e){if(typeof e!="number"||!Number.isFinite(e))throw new Error("scrollProgress must be a finite number");this._scrollProgress=Qn(e),this.markPlayDirty()}addChild(e){return e.parent=this,e}GetChildren(){return this.children.slice()}GetChild(e){return this.children.find(i=>i.name===e)||null}FindChild(e){if(!e)return null;if(!e.includes("/"))return this.GetChild(e);let i=e.split("/").filter(Boolean),r=this;for(let n of i)if(r=r.GetChild(n),!r)return null;return r}SetActive(e){let i=!!e;if(this.active!==i){if(typeof this.runtime?.onControlActiveChanging=="function"){this.runtime.onControlActiveChanging(this,i);return}this.active=i,this.markPlayDirty(!0)}}SetVisible(e){this.visible=!!e,this.markPlayDirty(!0)}GetSiblingIndex(){if(!this._parent)return-1;let e=this._parent.children,i=e.indexOf(this);return i<0?-1:e.length-1-i}SetSiblingIndex(e){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(e)||e<0||e>n?!1:(i.splice(r,1),i.splice(n-e,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(e,i){this.anchoredPositionX=e,this.anchoredPositionY=i,this.markPlayDirty()}GetSizeDelta(){return[this.sizeDeltaX,this.sizeDeltaY]}SetSizeDelta(e,i){this.sizeDeltaX=e,this.sizeDeltaY=i,this.markPlayDirty(!0)}GetAnchorMin(){return[this.anchorMinX,this.anchorMinY]}SetAnchorMin(e,i){this.anchorMinX=e,this.anchorMinY=i,this.markPlayDirty(!0)}GetAnchorMax(){return[this.anchorMaxX,this.anchorMaxY]}SetAnchorMax(e,i){this.anchorMaxX=e,this.anchorMaxY=i,this.markPlayDirty(!0)}GetPivot(){return[this.pivotX,this.pivotY]}SetPivot(e,i){this.pivotX=e,this.pivotY=i,this.markPlayDirty(!0)}GetLocalScale(){return[this.localScaleX,this.localScaleY,this.localScaleZ]}SetLocalScale(e,i,r){this.localScaleX=e,this.localScaleY=i,this.localScaleZ=r,this.markPlayDirty()}GetLocalRotation(){return lc(this.localRotationX,this.localRotationY,this.localRotationZ)}luaFieldValue(e){if(e==="imageType")return this.imageType??"Stretch";let i=cm.indexOf(e);return i<0?this[e]:lc(this.localRotationX,this.localRotationY,this.localRotationZ)[i]}SetLocalRotation(e,i,r){this.localRotationX=e,this.localRotationY=i,this.localRotationZ=r,this.markPlayDirty()}GetScriptByPath(e){return this.scripts.find(i=>i.path===e)||null}GetScript(e){return this.scripts.find(i=>i.scriptMappingId===e)||null}GetScripts(){return this.scripts.slice()}_addListener(e,i,r){let n=e.get(i)||[];n.push(r),e.set(i,n),this.runtime.retainLuaCallback?.(r)}_removeListener(e,i,r){let n=e.get(i);if(!n)return;let o=n.filter(s=>s!==r);e.set(i,o);for(let s=o.length;s<n.length;s++)this.runtime.unrefLuaCallback?.(r)}_removeListeners(e,i){let r=e.get(i)||[];for(let n of r)this.runtime.unrefLuaCallback?.(n);e.delete(i)}_removeAllListeners(e){for(let i of e.values())for(let r of i)this.runtime.unrefLuaCallback?.(r);e.clear()}AddCursorEventListener(e,i){this._addListener(this.cursorListeners,e,i)}RemoveCursorEventListener(e,i){this._removeListener(this.cursorListeners,e,i)}RemoveCursorEventListeners(e){this._removeListeners(this.cursorListeners,e)}RemoveAllCursorEventListeners(){this._removeAllListeners(this.cursorListeners)}SimulateCursorClick(){let e=this.runtime.makeCursorEventData({x:0,y:0,pressX:0,pressY:0});this.emitCursor("CursorDown",e),this.emitCursor("CursorUp",e),this.emitCursor("CursorClick",e)}emitCursor(e,i){if(!this.runtime.cursorEventsEnabled(this))return;let r=this.cursorListeners.get(e)||[];for(let n of r)n(i)}AddKeyEventListener(e,i){this._addListener(this.keyListeners,e,i)}RemoveKeyEventListener(e,i){this._removeListener(this.keyListeners,e,i)}RemoveKeyEventListeners(e){this._removeListeners(this.keyListeners,e)}RemoveAllKeyEventListeners(){this._removeAllListeners(this.keyListeners)}emitKey(e){let i=this.keyListeners.get(e)||[];for(let r of i)if(r()===!0)return!0;return!1}AddNavigationEventListener(e,i){this._addListener(this.navListeners,e,i)}RemoveNavigationEventListener(e,i){this._removeListener(this.navListeners,e,i)}RemoveNavigationEventListeners(e){this._removeListeners(this.navListeners,e)}RemoveAllNavigationEventListeners(){this._removeAllListeners(this.navListeners)}SetControllerNavigation(e,i,r){this.navConfig.set(e,{mode:i,target:r})}GetControllerNavigation(e){let i=this.navConfig.get(e),r=i?[i.mode,i.target]:[null,null];return r.__multi=!0,r}SetImage(e,i){let r=this.imageSource?.Name||this.imageSource,n=e?.Name||e;(i!==this.imageId||r!==n)&&(this.imageType=null),this.imageSource=e,this.imageId=i,this.markPlayDirty()}SetSoftEdgeWidth(e,i){this.softEdgeWidthX=e,this.softEdgeWidthY=i,this.markPlayDirty()}SetFillUnused(){this.fillType="Unused",this.markPlayDirty()}SetFillHorizontal(e,i){this.fillType="Horizontal",this.fillHorizontalType=e,this.fillAmount=i,this.markPlayDirty()}SetFillVertical(e,i){this.fillType="Vertical",this.fillVerticalType=e,this.fillAmount=i,this.markPlayDirty()}SetFillRadial90(e,i){this.fillType="Radial90",this.fillRadial90Type=e,this.fillAmount=i,this.markPlayDirty()}SetFillRadial180(e,i){this.fillType="Radial180",this.fillRadialType=e,this.fillAmount=i,this.markPlayDirty()}SetFillRadial360(e,i){this.fillType="Radial360",this.fillRadialType=e,this.fillAmount=i,this.markPlayDirty()}PlayAnimation(){}StopAnimation(){}RefreshItems(e,i){if(!Number.isInteger(e)||e<0||e>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(e&&!this.runtime.templates.has(Number(this.itemPrefabIndex)))throw new Error("RefreshItems: item template not found");if(e&&["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<e?r.push(n):n.alive&&n.parent===this&&this.runtime.destroyControl(n);for(this._gridItems=r;r.length<e;){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=e,pr(this),this.markPlayDirty(!0);for(let n=0;n<r.length&&this.alive;n+=1)i(r[n],n)}finally{this._refreshingGrid=!1}}GetItemIndex(e){return e?.alive&&e.parent===this?this._gridItems?.indexOf(e)??-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(e,i){if(!Number.isInteger(e)||e<0||e>=this.itemCount)throw new Error("ScrollToItemAt: item index out of range");let r=Lr(this),n=r.horizontal?r.cellW:r.cellH,o=r.horizontal?r.gapX:r.gapY,s=(r.horizontal?r.left:r.top)+Math.floor(e/r.lanes)*(n+o),a=i?.Name||i;if(!["Top","Center","Bottom"].includes(a))throw new Error("ScrollToItemAt: invalid alignment");let l=s-(a==="Center"?(r.viewport-n)/2:a==="Bottom"?r.viewport-n:0);this.scrollProgress=r.max?Qn(l/r.max):0,pr(this),this.markPlayDirty(!0)}GetContentLength(){return Lr(this).length}};function Dt(t,e){e(t);for(let i of t.children)Dt(i,e)}function Js(t,e=[],i=""){e.push(`${i}${t.name||"(unnamed)"} [${t.typeofName}] Id=${t.Id}`);for(let r of t.children)Js(r,e,i+" ");return e}function to(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}var fc={Linear:t=>t,InSine:t=>1-Math.cos(t*Math.PI/2),OutSine:t=>Math.sin(t*Math.PI/2),InOutSine:t=>-(Math.cos(Math.PI*t)-1)/2,InQuad:t=>t*t,OutQuad:t=>1-(1-t)*(1-t),InOutQuad:t=>t<.5?2*t*t:1-(-2*t+2)**2/2,InCubic:t=>t*t*t,OutCubic:t=>1-(1-t)**3,InOutCubic:t=>t<.5?4*t*t*t:1-(-2*t+2)**3/2,InQuart:t=>t**4,OutQuart:t=>1-(1-t)**4,InOutQuart:t=>t<.5?8*t**4:1-(-2*t+2)**4/2,InQuint:t=>t**5,OutQuint:t=>1-(1-t)**5,InOutQuint:t=>t<.5?16*t**5:1-(-2*t+2)**5/2,InExpo:t=>t===0?0:2**(10*t-10),OutExpo:t=>t===1?1:1-2**(-10*t),InOutExpo:t=>t===0||t===1?t:t<.5?2**(20*t-10)/2:(2-2**(-20*t+10))/2,InCirc:t=>1-Math.sqrt(1-t**2),OutCirc:t=>Math.sqrt(1-(t-1)**2),InOutCirc:t=>t<.5?(1-Math.sqrt(1-(2*t)**2))/2:(Math.sqrt(1-(-2*t+2)**2)+1)/2,InBack:t=>(1.70158+1)*t*t*t-1.70158*t*t,OutBack:t=>1+2.70158*(t-1)**3+1.70158*(t-1)**2,InOutBack:t=>{let i=2.5949095;return t<.5?(2*t)**2*((i+1)*2*t-i)/2:((2*t-2)**2*((i+1)*(t*2-2)+i)+2)/2},InElastic:t=>t===0||t===1?t:-(2**(10*t-10))*Math.sin((t*10-10.75)*(2*Math.PI/3)),OutElastic:t=>t===0||t===1?t:2**(-10*t)*Math.sin((t*10-.75)*(2*Math.PI/3))+1,InOutElastic:t=>{if(t===0||t===1)return t;let e=2*Math.PI/4.5;return t<.5?-(2**(20*t-10)*Math.sin((20*t-11.125)*e))/2:2**(-20*t+10)*Math.sin((20*t-11.125)*e)/2+1},InBounce:t=>1-to(1-t),OutBounce:to,InOutBounce:t=>t<.5?(1-to(1-2*t))/2:(1+to(2*t-1))/2};function cc(t,e){let i=fc[t]||fc.Linear;return e<=0?0:e>=1?1:i(e)}function gr(t,e,i,r=255){let n=io(t),o=io(e),s=io(i);return((r==null?255:io(r))<<24|n<<16|o<<8|s)>>>0}function jr(t){let e=t>>>0;return[e>>>16&255,e>>>8&255,e&255,e>>>24&255]}function io(t){let e=Number(t);return Number.isFinite(e)?Math.max(0,Math.min(255,Math.trunc(e))):0}function dc(t,e,i){let r=jr(t),n=jr(e);return gr(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 hm=new Set(["fontColor","bgColor","outlineColor","imageColor"]),pm=new Set(["fontSize","minimumFontSize"]),Zs=1e-9;function mm(t,e){return typeof t?.luaFieldValue=="function"?t.luaFieldValue(e):t[e]}var Ur=class{constructor(e,i,r,n){this.runtime=e,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[e,i]of Object.entries(this.data)){let r=mm(this.object,e);this.from[e]=r,this.to[e]=this.relative?Number(r)+Number(i):i}}restoreInitial(){this.from={...this.initialFrom},this.to={...this.initialTo}}SetEase(e){return this.easeName=typeof e=="string"?e:e?.Name||"Linear",this}SetRelative(e){return this.relative=!!e,this}Play(){return this.dead?this:this.playing?(this.paused=!1,this):this._start(!1)}_begin(e){this.playing=!0,this.paused=!1,this.elapsed=0,this.loopIndex=0,this.killed=!1,this.completed=!1,e&&this.initialFrom?this.restoreInitial():(this.capture(),this.initialFrom={...this.from},this.initialTo={...this.to})}_start(e){return this._begin(e),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(e){e?this.Complete():this.finish(!1),this.dead=!0}SetOnComplete(e){return this.onComplete=e,this}SetOnStepComplete(e){return this.onStepComplete=e,this}SetLoops(e){return this.loops=e,this}apply(e){if(this.object?.alive===!1)return;let i=cc(this.easeName,e),r=!1,n=!1;for(let o of Object.keys(this.to)){let s=this.from[o],a=this.to[o];if(hm.has(o)&&typeof s=="number"&&typeof a=="number")this.object[o]=dc(s,a,i);else if(typeof s=="number"&&typeof a=="number"){let l=s+(a-s)*i;this.object[o]=pm.has(o)?Math.trunc(l):l}else this.object[o]=i>=1?a:s;r=!0,eo.has(o)&&(n=!0)}r&&typeof this.object?.markPlayDirty=="function"&&this.object.markPlayDirty(n)}_advance(e,i){this.elapsed+=e;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(e){!this.playing||this.paused||this.killed||this._advance(e,this.loops<0?-1:this.loopCount)&&(this.onStepComplete&&this.runtime.safeCall(this.onStepComplete),this.finish(!0))}finish(e){this.playing=!1,this.killed=!0,e&&(this.completed=!0),this.runtime.tweens.delete(this),this.runtime.animations.delete(this),e&&this.onComplete&&this.runtime.safeCall(this.onComplete)}},yr=class{constructor(e){this.runtime=e,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(e){return this.steps.push({kind:"tween",tween:e,parallel:!1}),this}AppendInterval(e){return this.steps.push({kind:"interval",duration:e}),this}AppendCallback(e){return this.steps.push({kind:"callback",fn:e}),this}Join(e){return this.steps.push({kind:"tween",tween:e,parallel:!0}),this}Insert(e,i){return this.steps.push({kind:"insert",time:e,tween:i}),this}InsertCallback(e,i){return this.steps.push({kind:"insertCb",time:e,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 e=0,i=0,r=!1,n=[],o=s=>s.duration*s.loopCount;for(let s of this.steps)if(s.kind==="tween"&&s.parallel){let a=r?i:e;n.push({at:a,tween:s.tween}),e=Math.max(e,a+o(s.tween))}else s.kind==="tween"?(n.push({at:e,tween:s.tween}),i=e,r=!0,e+=o(s.tween)):s.kind==="interval"?(i=e,r=!0,e+=s.duration):s.kind==="callback"?n.push({at:e,fn:s.fn}):s.kind==="insert"?(n.push({at:s.time,tween:s.tween}),e=Math.max(e,s.time+o(s.tween))):s.kind==="insertCb"&&(n.push({at:s.time,fn:s.fn}),e=Math.max(e,s.time));this._entries=n.map((s,a)=>({...s,index:a,end:s.tween?s.at+o(s.tween):s.at})),this._end=e,this._resetEntries()}_resetEntries(){for(let e of this._entries)e.started=!1,e.done=!1}_startChild(e){e.started=!0,e.tween._begin(!!e.tween.initialFrom)}_finishChild(e){e.done=!0,e.tween.apply(1),e.tween.onStepComplete&&this.runtime.safeCall(e.tween.onStepComplete),e.tween.finish(!0)}_advanceTo(e,i){let r=this._entries,n=[];for(let s of r)!s.started&&s.at<=e+Zs&&n.push({at:s.at,rank:s.fn?1:2,entry:s}),s.tween&&!s.done&&s.end<=e+Zs&&n.push({at:s.end,rank:0,entry:s});n.sort((s,a)=>s.at-a.at||s.rank-a.rank||s.entry.index-a.entry.index);let o=new Set;for(let{rank:s,entry:a}of n)if(s===1){if(a.started=!0,this.runtime.safeCall(a.fn),!this.playing||this.killed||this._entries!==r)return!1}else a.started||(this._startChild(a),o.add(a)),s===0&&!a.done&&this._finishChild(a);for(let s of r)!s.tween||!s.started||s.done||(o.has(s)?s.tween._advance(e-s.at,s.tween.loopCount):s.tween._advance(i,s.tween.loopCount));return!0}step(e){!this.playing||this.paused||this.killed||(this.elapsed+=e,this._advanceTo(this.elapsed,e)&&(this.elapsed+Zs<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(e){e?this.Complete():this.finish(!1),this.dead=!0}SetOnComplete(e){return this.onComplete=e,this}SetOnStepComplete(e){return this.onStepComplete=e,this}SetLoops(e){return this.loops=e,this}finish(e){this.playing=!1,this.killed=!0,e&&(this.completed=!0),this.runtime.sequences.delete(this),this.runtime.animations.delete(this),e&&this.onComplete&&this.runtime.safeCall(this.onComplete)}};var ro={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"]},gm=[...Array.from({length:43},(t,e)=>`CraftspersonKey${e+1}`),"MoveForwardKey","MoveBackwardKey","MoveLeftKey","MoveRightKey","SwitchToWalkOrRunKey","SprintKey","JumpKey","DropKey","OpenShortcutWheelKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key","None"],ym=[...Array.from({length:14},(t,e)=>`CraftspersonKey${e+1}`),"SprintKey","JumpKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key","MenuConfirmKey","MenuBackKey","None"];function vm(){let t=[];for(let e of["Down","Up"]){for(let i=1;i<=43;i++)t.push(`KeyboardCraftspersonKey${i}${e}`);for(let i of["MoveForwardKey","MoveBackwardKey","MoveLeftKey","MoveRightKey","SwitchToWalkOrRunKey","SprintKey","JumpKey","DropKey","OpenShortcutWheelKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key"])t.push(`Keyboard${i}${e}`);for(let i=1;i<=14;i++)t.push(`ControllerCraftspersonKey${i}${e}`);for(let i of["SprintKey","JumpKey","InteractKey","NormalAttackKey","CharacterSkill1Key","CharacterSkill2Key","CharacterSkill3Key","CharacterSkill4Key","MenuConfirmKey","MenuBackKey"])t.push(`Controller${i}${e}`)}return t}ro.KeyboardKeyCode=gm;ro.ControllerKeyCode=ym;ro.KeyEventType=vm();var hc=new Map;function Di(t,e){let i=`${t}\0${e}`,r=hc.get(i);return r||(r={__kind:"EnumItem",Name:e,FullName:`Enum.${t}.${e}`,EnumType:t},hc.set(i,r)),r}function Qs(t,e){return e==null?e:e.__kind==="EnumItem"?Di(e.EnumType||t,e.Name):typeof e=="string"&&e?Di(t,e):e}function ea(){let t={};for(let[e,i]of Object.entries(ro)){let r={};for(let n of i)r[n]=Di(e,n);t[e]=r}return t}var bm=new Set(["Id","prefabIndex","imageId","fontSize","minimumFontSize","clickAudioId","itemCount","itemPrefabIndex","animationId","referencedPrefabIndex"]),wm=new Set(["imageColor","fontColor","bgColor","outlineColor"]),pc={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"},$i=d.LUA_REGISTRYINDEX,mc=d.LUA_MULTRET,Sm=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 et(t){return t==null?"":typeof t=="string"?t:t.Name||t.FullName||String(t)}var no=class{constructor(e={}){this.canvasWidth=e.canvasWidth??1600,this.canvasHeight=e.canvasHeight??900,this.device=e.device??"KeyboardAndMouse",this.language=e.language??"LanguageChs",this.stageMode=e.stageMode??"Classic",this.testPlay=e.testPlay!==!1,this.canSelectImageType=e.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=e.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=ea(),this.luaStates=new Set,this.L=null}nextControlId(){let e=this._nextControlId;return this._nextControlId+=1,e}resolveScriptMappingId(e){let i=Number(e);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(e,i){let r=i>>>0;(r|0)===r?d.lua_pushinteger(e,r):d.lua_pushnumber(e,r)}retainLuaCallback(e){ec(e)}unrefLuaCallback(e){tc(this,e)}log(e,...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:e,text:r,time:this.clock.time})}safeCall(e,...i){try{return e(...i)}catch(r){this.log("lua-error",r&&r.message?r.message:String(r))}}scriptCanRun(e){if(!e?.alive||!e.enabled)return!1;let i=e.object;return!i||i.alive&&i.activeInHierarchy}cursorEventsEnabled(e){for(let i=e;i;i=i.parent)if(i.kind==="container"&&i.showCursor===!0)return!0;return!1}registerTemplate(e,i){this.templates.set(Number(e),i)}registerScriptFile(e,i){let r=this.normalizeRequirePath(e);this.scriptFiles.set(r,i),r.startsWith("default_import_file/")||this.requireAliases.set(`default_import_file/${r}`,r)}normalizeRequirePath(e){let i=String(e).replace(/\\/g,"/");return i.endsWith(".lua")&&(i=i.slice(0,-4)),i=i.replace(/\./g,"/"),i}addRoot(e){let i=e instanceof bi?e:new bi(this,e);return this.roots.push(i),Dt(i,r=>this.controlsById.set(r.Id,r)),this.mountSpecScripts(e,i),i}mountSpecScripts(e,i){if(e instanceof bi)return;let r=o=>(o.scripts?.length||0)>0||(o.children||[]).some(r);if(!e||!r(e))return;let n=this.lifecyclePhase;try{let o=(s,a)=>{for(let u of s.scripts||[])try{this.mountScript({path:u.path,source:u.source,control:a,scriptMappingId:u.scriptMappingId})}catch(f){let h=f&&f.message?f.message:String(f);this.mountErrors.push(h),this.log("lua-error",h)}let l=s.children||[];for(let u=0;u<l.length;u+=1)o(l[u],a?.children?.[u])};o(e,i)}finally{this.lifecyclePhase=n}}makeCursorEventData({x:e=0,y:i=0,pressX:r=e,pressY:n=i,deltaX:o=e-r,deltaY:s=i-n,dragging:a=!1,touchId:l=-1}={}){let u=this;return{__kind:"CursorEventData",typeofName:"CursorEventData",dragging:a,touchId:l,x:e,y:i,pressX:r,pressY:n,GetUIPos(){return[e,i]},GetPressUIPos(){return[r,n]},GetUIPosDelta(){return[o,s]}}}boot(){let e=this.newLuaThread();this.L=e}installGlobals(e){let i=this;d.lua_pushcfunction(e,r=>{let n=d.lua_gettop(r),o=[];for(let s=1;s<=n;s++)o.push(He(r,i,s));return i.log("info",...o),0}),d.lua_setglobal(e,q("print")),d.lua_pushcfunction(e,r=>{let n=d.lua_gettop(r),o=[];for(let s=1;s<=n;s++)o.push(He(r,i,s));return i.log("error",...o),0}),d.lua_setglobal(e,q("printerr")),d.lua_pushcfunction(e,r=>{if(d.lua_type(r,1)===d.LUA_TTABLE&&!Jt(r,1))return d.lua_pushstring(r,q("table")),1;let n=He(r,i,1);return d.lua_pushstring(r,q(i.typeofOf(n))),1}),d.lua_setglobal(e,q("typeof")),this.pushColorLib(e),this.pushEnumLib(e),this.pushGameLib(e),d.lua_pushcfunction(e,r=>i.luaRequire(r)),d.lua_setglobal(e,q("require"))}typeofOf(e){return e==null?"nil":e.__kind==="Script"?"Script":e.__kind==="EnumItem"?"EnumItem":e.__kind==="CursorEventData"?"CursorEventData":e.__kind==="ServerSignal"?"ServerSignal":e instanceof yr?"TweenSequence":e instanceof Ur?"Tween":e.typeofName?e.typeofName:typeof e=="number"?"number":typeof e=="string"?"string":typeof e=="boolean"?"boolean":typeof e}pushColorLib(e){d.lua_newtable(e),d.lua_pushcfunction(e,i=>(this.pushPackedColor(i,gr(d.lua_tonumber(i,1),d.lua_tonumber(i,2),d.lua_tonumber(i,3),255)),1)),d.lua_setfield(e,-2,q("FromRGB")),d.lua_pushcfunction(e,i=>{let r=d.lua_isnoneornil(i,4)?255:d.lua_tonumber(i,4);return this.pushPackedColor(i,gr(d.lua_tonumber(i,1),d.lua_tonumber(i,2),d.lua_tonumber(i,3),r)),1}),d.lua_setfield(e,-2,q("FromRGBA")),d.lua_pushcfunction(e,i=>{let r=d.lua_tonumber(i,1)>>>0;for(let n of jr(r))d.lua_pushinteger(i,n);return 4}),d.lua_setfield(e,-2,q("ToRGBA")),d.lua_newtable(e),d.lua_pushcfunction(e,i=>{let r=d.lua_tonumber(i,2),n=d.lua_tonumber(i,3),o=d.lua_tonumber(i,4),s=d.lua_isnoneornil(i,5)?255:d.lua_tonumber(i,5);return this.pushPackedColor(i,gr(r,n,o,s)),1}),d.lua_setfield(e,-2,q("__call")),d.lua_setmetatable(e,-2),d.lua_setglobal(e,q("Color"))}pushEnumLib(e){d.lua_newtable(e);for(let[i,r]of Object.entries(this.enumTree)){d.lua_newtable(e);for(let[n,o]of Object.entries(r))this.pushEnumItem(e,o),d.lua_setfield(e,-2,q(n));d.lua_setfield(e,-2,q(i))}d.lua_setglobal(e,q("Enum"))}pushEnumItem(e,i){let r=d.lua_newuserdata(e,0);zi(r,i),Ie.luaL_setmetatable(e,q("EnumItem"))}pushControl(e,i){let r=d.lua_newuserdata(e,0);zi(r,i),Ie.luaL_setmetatable(e,q("Control"))}pushScript(e,i){d.lua_newtable(e),d.lua_pushlightuserdata(e,Hs);let r=d.lua_newuserdata(e,0);zi(r,i),d.lua_rawset(e,-3),Ie.luaL_getmetatable(e,q("Script")),d.lua_setmetatable(e,-2)}pushTween(e,i){let r=d.lua_newuserdata(e,0);zi(r,i);let n=i instanceof yr?"TweenSequence":"Tween";Ie.luaL_setmetatable(e,q(n))}pushSignal(e,i){let r=d.lua_newuserdata(e,0);zi(r,i),Ie.luaL_setmetatable(e,q("ServerSignal"))}pushCursor(e,i){let r=d.lua_newuserdata(e,0);zi(r,i),Ie.luaL_setmetatable(e,q("CursorEventData"))}pushGameLib(e){let i=this;d.lua_newtable(e);let r={InstantiateClientUIControl:n=>{let o=d.lua_tointeger(n,1),s=st(d.lua_touserdata(n,2)),a=i.instantiate(o,s,i.lifecyclePhase);return a?(i.pushControl(n,a),1):(d.lua_pushnil(n),1)},DestroyClientUIControl:n=>{let o=st(d.lua_touserdata(n,1));return o&&i.destroyControl(o),0},GetClientUIControl:n=>{let o=d.lua_tointeger(n,1),s=i.controlsById.get(o);return s?i.pushControl(n,s):d.lua_pushnil(n),1},FindClientUIRoot:n=>{let o=Ce(n,1),s=i.roots.find(a=>a.name===o);return s?i.pushControl(n,s):d.lua_pushnil(n),1},GetClientUIRoots:n=>(d.lua_createtable(n,i.roots.length,0),i.roots.forEach((o,s)=>{i.pushControl(n,o),d.lua_rawseti(n,-2,s+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,Di("Device",i.device)),1),SetControllerFocus:n=>(i.focus=st(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=st(d.lua_touserdata(n,1))||He(n,i,1),s=He(n,i,2)||{},a=d.lua_tonumber(n,3),l=new Ur(i,o,s,a);return i.pushTween(n,l),1},TweenSequence:n=>(i.pushTween(n,new yr(i)),1),ServerSignal:n=>{let o=Ce(n,1);return i.pushSignal(n,i.makeServerSignal(o)),1},GetGlobalCustomVariableValue:n=>{let o=et(He(n,i,1)),s=Ce(n,2);return Ge(n,i,i.getVar(o,s)),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,Di("LanguageType",i.language)),1),GetStageMode:n=>(i.pushEnumItem(n,Di("StageMode",i.stageMode)),1),IsTestPlay:n=>(d.lua_pushboolean(n,i.testPlay),1),GetText:n=>{let o=Ce(n,1);return d.lua_pushstring(n,q(o)),1},PrintClientUITree:n=>{for(let o of i.roots)i.log("info",Js(o).join(`
|
|
123
|
+
`));return 0}};for(let[n,o]of Object.entries(r)){let s=Sm[n];if(s===void 0)throw new Error(`missing game arity for ${n}`);d.lua_pushcfunction(e,a=>{let l=d.lua_gettop(a);return l!==s?Ie.luaL_error(a,q(`bad argument count to '${n}' (${s} expected, got ${l})`)):o(a)}),d.lua_setfield(e,-2,q(n))}d.lua_setglobal(e,q("game"))}makeServerSignal(e){let i=[],r=this;return{__kind:"ServerSignal",name:e,AddParam(n,o){i.push({type:et(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(e,n)}}}audioInteger(e){let i=d.lua_tonumber(e,1);return d.lua_type(e,1)!==d.LUA_TNUMBER||!Number.isSafeInteger(i)?Ie.luaL_error(e,q("audio argument must be an integer")):i}playAudio(e){this.audioRevision++;let i=this.nextAudioId++,r=this.audioDuration(e),n=Number.isFinite(r)&&r>0,o={instanceId:i,audioId:e,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(e)||(this.audioWarnings.size>=128&&this.audioWarnings.delete(this.audioWarnings.values().next().value),this.audioWarnings.add(e),this.log("warn",`\u97F3\u6548 ${e} \u672A\u5217\u5165\u6A21\u62DF\u5668\u97F3\u9891\u767D\u540D\u5355`)),i}stopAudio(e){let i=this.audios.get(e)||this.audioHistory.find(r=>r.instanceId===e);i&&!i.stopped&&(i.alive=!1,i.stopped=!0,this.audioRevision++),this.audios.delete(e)}audioSnapshot(){return{sequence:this.nextAudioId-1,revision:this.audioRevision,active:[...this.audios.values()].map(e=>({...e})),recent:this.audioHistory.map(e=>({...e}))}}instantiate(e,i,r){if(r==="OnInit"||r==="OnDestroy")return null;let n=this.templates.get(Number(e));if(!n||!i)return null;let o=new bi(this,{...n,Id:this.nextControlId(),authoringId:null,prefabIndex:Number(e)});return i.addChild(o),o.SetAsLastSibling(),Dt(o,s=>this.controlsById.set(s.Id,s)),this.mountSpecScripts(n,o),o}destroyControl(e){if(!(!e||!e.alive)){if(e._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:${e.name}`);Dt(e,i=>{i._destroying=!0}),this._destroyControlTree(e)}}_destroyControlTree(e){this.releaseControlListeners(e);for(let i of e.scripts.slice())this.unmountScript(i);for(let i of e.children.slice())this._destroyControlTree(i);if(e.alive=!1,this.scrollControls?.delete(e),this._playRemoved.push(e.Id),e.parent){let i=e.parent,r=i.children.indexOf(e);r>=0&&i.children.splice(r,1),e._parent=null,i.markPlayDirty(!0)}else{let i=this.roots.indexOf(e);i>=0&&this.roots.splice(i,1)}this.controlsById.delete(e.Id),this.focus===e&&(this.focus=null);for(let i of[...this.tweens])i.object===e&&i.Kill(!1)}releaseControlListeners(e){for(let i of e.cursorListeners.values())for(let r of i)this.unrefLuaCallback(r);for(let i of e.keyListeners.values())for(let r of i)this.unrefLuaCallback(r);for(let i of e.navListeners.values())for(let r of i)this.unrefLuaCallback(r);e.cursorListeners.clear(),e.keyListeners.clear(),e.navListeners.clear(),e.navConfig.clear()}onControlActiveChanging(e,i){let r=[];Dt(e,n=>r.push({control:n,was:n.activeInHierarchy})),e.active=!!i,e.markPlayDirty(!0);for(let n of r){let o=n.control.activeInHierarchy;if(n.was!==o)for(let s of n.control.scripts.slice())o?this.enableScript(s):this.disableScript(s)}}bindScriptEnv(e){let i=e.env;return i?(this.pushScript(i,e),d.lua_setglobal(i,q("script")),i):null}disableScript(e){if(!e?.alive||!e.env||e.lifecyclePhase!=="running")return;let i=this.lifecyclePhase;this.lifecyclePhase="OnDisable",e.lifecyclePhase="OnDisable",this.bindScriptEnv(e),this.callGlobal(e.env,"OnDisable"),e.lifecyclePhase="disabled",this.lifecyclePhase=i}enableScript(e){if(!e?.alive||!e.env||e.lifecyclePhase!=="disabled")return;let i=this.lifecyclePhase;this.lifecyclePhase="OnEnable",e.lifecyclePhase="OnEnable",this.bindScriptEnv(e),this.callGlobal(e.env,"OnEnable"),e.lifecyclePhase="running",this.lifecyclePhase=i}unmountScript(e){if(!e||!e.alive)return;let i=e.env,r=this.lifecyclePhase;i&&(e.lifecyclePhase==="running"&&(this.lifecyclePhase="OnDisable",e.lifecyclePhase="OnDisable",this.bindScriptEnv(e),this.callGlobal(i,"OnDisable")),this.lifecyclePhase="OnDestroy",e.lifecyclePhase="OnDestroy",this.bindScriptEnv(e),this.callGlobal(i,"OnDestroy")),e.alive=!1,e.lifecyclePhase="destroyed",this.lifecyclePhase=r,this.mountedScripts=this.mountedScripts.filter(n=>n!==e),e.object&&(e.object.scripts=e.object.scripts.filter(n=>n!==e)),this.varHandlers=this.varHandlers.filter(n=>n.script!==e),this.signalHandlers=this.signalHandlers.filter(n=>n.script!==e),i&&i!==this.L&&this.closeTrackedLuaState(i),e.env=null}installMetatables(e){this.mtEnum(e),this.mtControl(e),this.mtScript(e),this.mtTween(e),this.mtSeq(e),this.mtSignal(e),this.mtCursor(e)}mtIndexNewindex(e,i,r,n,o,s){Ie.luaL_newmetatable(e,q(i)),d.lua_pushcfunction(e,a=>{let l=Jt(a,1)||st(d.lua_touserdata(a,1)),u=Ce(a,2);if(o[u]&&(!s||s(l,u)))return d.lua_pushcfunction(a,o[u]),1;let f;try{f=r(l,u)}catch(h){return Ie.luaL_error(a,q(String(h.message||h)))}return f===void 0?(d.lua_pushnil(a),1):(Ge(a,this,f),1)}),d.lua_setfield(e,-2,q("__index")),d.lua_pushcfunction(e,a=>{try{let l=Jt(a,1)||st(d.lua_touserdata(a,1)),u=Ce(a,2),f=He(a,this,3);return n(l,u,f),0}catch(l){return d.lua_pushstring(a,q(String(l.message||l))),d.lua_error(a)}}),d.lua_setfield(e,-2,q("__newindex")),d.lua_pushcfunction(e,a=>{let l=Jt(a,1)||st(d.lua_touserdata(a,1)),u=Jt(a,2)||st(d.lua_touserdata(a,2));return d.lua_pushboolean(a,l===u),1}),d.lua_setfield(e,-2,q("__eq")),d.lua_pop(e,1)}method(e){let i=this;return r=>{let n=Jt(r,1)||st(d.lua_touserdata(r,1)),o=d.lua_gettop(r),s=[];for(let a=2;a<=o;a++)s.push(He(r,i,a));try{let a=e(n,...s);if(a===n)return d.lua_pushvalue(r,1),1;if(a===void 0)return 0;if(Array.isArray(a)&&a.__multi){for(let l of a)Ge(r,i,l);return a.length}if(Array.isArray(a)&&!(a.length&&typeof a[0]=="object"&&a[0]?.typeofName)){if(a.__controls)return d.lua_createtable(r,a.length,0),a.forEach((l,u)=>{i.pushControl(r,l),d.lua_rawseti(r,-2,u+1)}),1;if(a.__scripts)return d.lua_createtable(r,a.length,0),a.forEach((l,u)=>{i.pushScript(r,l),d.lua_rawseti(r,-2,u+1)}),1;if(typeof a[0]=="number"&&a.length<=4){for(let l of a)d.lua_pushnumber(r,l);return a.length}}return Ge(r,i,a),1}catch(a){return d.lua_pushstring(r,q(String(a.message||a))),d.lua_error(r)}}}mtEnum(e){let i=new Set(["Name","FullName","EnumType"]);this.mtIndexNewindex(e,"EnumItem",(r,n)=>i.has(n)?r[n]:void 0,(r,n)=>{throw new Error(`cannot set ${n}, no such field`)},{})}mtCursor(e){let i=new Set(["dragging","touchId"]);this.mtIndexNewindex(e,"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(e){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):Ie.luaL_error(n,q("bad argument #2 to 'SetVisible' (boolean expected, got %s)"),Ie.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,s)=>n.SetAnchoredPosition(o,s)),GetSizeDelta:this.method(n=>n.GetSizeDelta()),SetSizeDelta:this.method((n,o,s)=>n.SetSizeDelta(o,s)),GetAnchorMin:this.method(n=>n.GetAnchorMin()),SetAnchorMin:this.method((n,o,s)=>n.SetAnchorMin(o,s)),GetAnchorMax:this.method(n=>n.GetAnchorMax()),SetAnchorMax:this.method((n,o,s)=>n.SetAnchorMax(o,s)),GetPivot:this.method(n=>n.GetPivot()),SetPivot:this.method((n,o,s)=>n.SetPivot(o,s)),GetLocalScale:this.method(n=>n.GetLocalScale()),SetLocalScale:this.method((n,o,s,a)=>n.SetLocalScale(o,s,a)),GetLocalRotation:this.method(n=>n.GetLocalRotation()),SetLocalRotation:this.method((n,o,s,a)=>n.SetLocalRotation(o,s,a)),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,s)=>n.AddCursorEventListener(et(o),s)),RemoveCursorEventListener:this.method((n,o,s)=>n.RemoveCursorEventListener(et(o),s)),RemoveCursorEventListeners:this.method((n,o)=>n.RemoveCursorEventListeners(et(o))),RemoveAllCursorEventListeners:this.method(n=>n.RemoveAllCursorEventListeners()),SimulateCursorClick:this.method(n=>n.SimulateCursorClick()),AddKeyEventListener:this.method((n,o,s)=>n.AddKeyEventListener(et(o),s)),RemoveKeyEventListener:this.method((n,o,s)=>n.RemoveKeyEventListener(et(o),s)),RemoveKeyEventListeners:this.method((n,o)=>n.RemoveKeyEventListeners(et(o))),RemoveAllKeyEventListeners:this.method(n=>n.RemoveAllKeyEventListeners()),AddNavigationEventListener:this.method((n,o,s)=>n.AddNavigationEventListener(et(o),s)),RemoveNavigationEventListener:this.method((n,o,s)=>n.RemoveNavigationEventListener(et(o),s)),RemoveNavigationEventListeners:this.method((n,o)=>n.RemoveNavigationEventListeners(et(o))),RemoveAllNavigationEventListeners:this.method(n=>n.RemoveAllNavigationEventListeners()),SetControllerNavigation:this.method((n,o,s,a)=>n.SetControllerNavigation(et(o),s,a)),GetControllerNavigation:this.method((n,o)=>n.GetControllerNavigation(et(o))),SetImage:this.method((n,o,s)=>n.SetImage(o,s)),SetSoftEdgeWidth:this.method((n,o,s)=>n.SetSoftEdgeWidth(o,s)),SetFillUnused:this.method(n=>n.SetFillUnused()),SetFillHorizontal:this.method((n,o,s)=>n.SetFillHorizontal(o,s)),SetFillVertical:this.method((n,o,s)=>n.SetFillVertical(o,s)),SetFillRadial90:this.method((n,o,s)=>n.SetFillRadial90(o,s)),SetFillRadial180:this.method((n,o,s)=>n.SetFillRadial180(o,s)),SetFillRadial360:this.method((n,o,s)=>n.SetFillRadial360(o,s)),PlayAnimation:this.method(n=>n.PlayAnimation()),StopAnimation:this.method(n=>n.StopAnimation()),RefreshItems:this.method((n,o,s)=>{this.retainLuaCallback(s);try{n.RefreshItems(o,s)}finally{this.unrefLuaCallback(s)}}),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,s)=>n.ScrollToItemAt(o,s)),GetContentLength:this.method(n=>n.GetContentLength())};this.mtIndexNewindex(e,"Control",(n,o)=>{if(!Ws(n,o))return;if(!n.alive&&o!=="alive")throw new Error(`attempt to read '${o}' of a destroyed control`);let s=n.luaFieldValue(o),a=pc[o];return a?Qs(a,s):typeof s=="number"&&!bm.has(o)&&!wm.has(o)?new Br(s):s},(n,o,s)=>{if(Ws(n,o)==="rw"){if((o==="fontSize"||o==="minimumFontSize")&&!Number.isInteger(s)){let u=s===null?"nil":typeof s;throw new Error(`bad argument #2 to '${o}' (integer expected, got ${u})`)}let l=pc[o];if(o==="imageType"&&(s?.EnumType!=="ImageType"||!["Basic","Stretch"].includes(s.Name)))throw new Error("imageType requires Enum.ImageType.Basic or Stretch");n[o]=l?Qs(l,s):s,typeof n.markPlayDirty=="function"&&n.markPlayDirty(eo.has(o));return}throw new Error(`cannot set ${o}, no such field`)},r,uc)}mtScript(e){let i=this,r=new Set(["alive","scriptMappingId","object","path","enabled"]);this.mtIndexNewindex(e,"Script",(n,o)=>r.has(o)?n[o]:void 0,(n,o,s)=>{if(o==="enabled"){n.enabled=!!s;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,s)=>{i.signalHandlers.push({script:n,name:o,fn:s})}),UnregisterServerSignalHandler:this.method((n,o)=>{i.signalHandlers=i.signalHandlers.filter(s=>!(s.script===n&&s.name===o))}),RegisterCustomVariableChangedHandler:this.method((n,o,s,a)=>{i.varHandlers.push({script:n,entityType:et(o),name:s,fn:a})}),UnregisterCustomVariableChangedHandler:this.method((n,o,s)=>{let a=et(o);i.varHandlers=i.varHandlers.filter(l=>!(l.script===n&&l.entityType===a&&l.name===s))})})}mtTween(e){this.mtIndexNewindex(e,"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(e){this.mtIndexNewindex(e,"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(e){this.mtIndexNewindex(e,"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(e){let i=Ce(e,1),r=this.normalizeRequirePath(i),n=this.requireAliases.get(r)||r;d.lua_rawgeti(e,$i,d.LUA_RIDX_MAINTHREAD);let o=d.lua_tothread(e,-1);d.lua_pop(e,1);let s=this.requireCache.get(o);s||(s=new Map,this.requireCache.set(o,s));let a=s.get(n);if(a?.loading)return d.lua_pushstring(e,q(`failed to load script '${r}': cyclic require`)),d.lua_error(e);if(a&&a.ref!=null)return d.lua_rawgeti(e,$i,a.ref),1;let l=this.scriptFiles.get(n);if(l==null)return d.lua_pushstring(e,q(`failed to load script '${r}'`)),d.lua_error(e);let u=d.lua_gettop(e);s.set(n,{loading:!0});try{this.loadModule(e,o,n,l),d.lua_pushvalue(e,-1);let f=Ie.luaL_ref(e,$i);return s.set(n,{ref:f}),1}catch(f){return s.delete(n),d.lua_settop(e,u),d.lua_pushstring(e,q(`failed to load script '${r}': ${f.message||f}`)),d.lua_error(e)}}newLuaThread(){let e=Ie.luaL_newstate();return Jf.luaL_openlibs(e),rc(e),this.installMetatables(e),this.installGlobals(e),this.luaStates.add(e),d.lua_pushglobaltable(e),this.copyLuaEnvironment(e,-1),d.lua_remove(e,-2),this.moduleBaseEnvironments.set(e,Ie.luaL_ref(e,$i)),e}copyLuaEnvironment(e,i){let r=d.lua_absindex(e,i);d.lua_newtable(e);let n=d.lua_absindex(e,-1);for(d.lua_pushnil(e);d.lua_next(e,r)!==0;)d.lua_pushvalue(e,-2),d.lua_pushvalue(e,-2),d.lua_rawset(e,n),d.lua_pop(e,1);d.lua_pushvalue(e,n),d.lua_setfield(e,n,q("_G"))}closeTrackedLuaState(e){if(!e||!this.luaStates.has(e))return;for(let r of this.requireCache.get(e)?.values()||[])r.ref!=null&&Ie.luaL_unref(e,$i,r.ref);this.requireCache.delete(e);let i=this.moduleBaseEnvironments.get(e);if(i!=null&&Ie.luaL_unref(e,$i,i),this.moduleBaseEnvironments.delete(e),this.luaStates.delete(e),this.luaFunctions)for(let[r,n]of this.luaFunctions)n.__luaState===e&&this.luaFunctions.delete(r);ic(e)}loadModule(e,i,r,n){let o={__kind:"Script",alive:!0,scriptMappingId:this.resolveScriptMappingId(),object:null,path:r,enabled:!0,updateEnabled:!1,params:{},env:e,invoke(){}},s=String(n).replace(/^\uFEFF/,""),a=Zn(s);if(Ie.luaL_loadbuffer(e,a,a.length,q(`@${r}`))!==Ct)throw new Error(Ce(e,-1));let u=d.lua_absindex(e,-1);if(d.lua_rawgeti(e,$i,this.moduleBaseEnvironments.get(i)),this.copyLuaEnvironment(e,-1),d.lua_remove(e,-2),this.pushScript(e,o),d.lua_setfield(e,-2,q("script")),d.lua_setupvalue(e,u,1),d.lua_pcall(e,0,1,0)!==Ct)throw new Error(Ce(e,-1))}mountScript({path:e,source:i,control:r,params:n={},scriptMappingId:o=void 0}){this.L||this.boot();let s=this.newLuaThread(),a={__kind:"Script",alive:!0,scriptMappingId:this.resolveScriptMappingId(o),object:r,path:this.normalizeRequirePath(e),enabled:!0,updateEnabled:!1,params:n,env:s,lifecyclePhase:"idle"};a.invoke=(u,f)=>this.invokeOn(s,u,f),r&&r.scripts.push(a),this.mountedScripts.push(a),this.pushScript(s,a),d.lua_setglobal(s,q("script"));let l=this.lifecyclePhase;try{this.lifecyclePhase="OnInit",a.lifecyclePhase="OnInit",this.runChunk(s,i,e);let u=this.callGlobal(s,"OnInit");u&&this.mountErrors.push(u),this.lifecyclePhase="OnEnable",a.lifecyclePhase="OnEnable";let f=this.callGlobal(s,"OnEnable");f&&this.mountErrors.push(f),this.lifecyclePhase="OnStart",a.lifecyclePhase="OnStart";let h=this.callGlobal(s,"OnStart");return h&&this.mountErrors.push(h),this.lifecyclePhase="running",a.lifecyclePhase="running",a}catch(u){throw a.alive=!1,a.lifecyclePhase="failed",this.mountedScripts=this.mountedScripts.filter(f=>f!==a),r&&(r.scripts=r.scripts.filter(f=>f!==a)),this.varHandlers=this.varHandlers.filter(f=>f.script!==a),this.signalHandlers=this.signalHandlers.filter(f=>f.script!==a),this.lifecyclePhase=l,s&&s!==this.L&&this.closeTrackedLuaState(s),a.env=null,u}}runChunk(e,i,r){let n=String(i).replace(/^\uFEFF/,""),o=Zn(n),s=Ie.luaL_loadbuffer(e,o,o.length,q(`@${r}`));if(s!==Ct){let l=Ce(e,-1)||`luaL_loadbuffer status ${s}`;throw d.lua_pop(e,1),new Error(l)}let a=d.lua_pcall(e,0,0,0);if(a!==Ct){let l=Ce(e,-1)||`lua_pcall status ${a}`;throw d.lua_pop(e,1),new Error(l)}}callGlobal(e,i){if(d.lua_getglobal(e,q(i)),d.lua_isfunction(e,-1)){if(d.lua_pcall(e,0,0,0)!==Ct){let n=Ce(e,-1);d.lua_pop(e,1);let o=`${i}: ${n}`;return this.log("lua-error",o),o}}else d.lua_pop(e,1);return null}callGlobalDt(e,i,r){if(d.lua_getglobal(e,q(i)),d.lua_isfunction(e,-1)){if(d.lua_pushnumber(e,r),d.lua_pcall(e,1,0,0)!==Ct){let o=Ce(e,-1);d.lua_pop(e,1),this.log("lua-error",`${i}: ${o}`)}}else d.lua_pop(e,1)}luaInvoke(e){let i=Jt(e,1);if(!i||i.__kind!=="Script")return Ie.luaL_error(e,q("bad self to 'Invoke' (Script expected)"));let r=Ce(e,2),n=i.env;if(!n||n.l_G!==e.l_G){let l=[];for(let h=3;h<=d.lua_gettop(e);h++)l.push(He(e,this,h));let u;try{u=i.invoke(r,l)}catch(h){return Ie.luaL_error(e,q(String(h.message||h)))}if(u===void 0)return 0;let f=Array.isArray(u)&&u.__multi?u:[u];for(let h of f)Ge(e,this,h);return f.length}let o=2;if(d.lua_getglobal(e,q(r)),!d.lua_isfunction(e,-1))return 0;d.lua_replace(e,o),d.lua_remove(e,1);let s=d.lua_gettop(e)-1;return d.lua_pcall(e,s,mc,0)!==Ct?d.lua_error(e):d.lua_gettop(e)}invokeOn(e,i,r){let n=d.lua_gettop(e);if(d.lua_getglobal(e,q(i)),!d.lua_isfunction(e,-1)){d.lua_settop(e,n);return}for(let l of r)Ge(e,this,l);if(d.lua_pcall(e,r.length,mc,0)!==Ct){let l=Ce(e,-1);throw d.lua_settop(e,n),new Error(l)}let s=d.lua_gettop(e)-n;if(s<=0){d.lua_settop(e,n);return}if(s===1){let l=He(e,this,-1);return d.lua_settop(e,n),l}let a=[];for(let l=1;l<=s;l++)a.push(He(e,this,n+l));return d.lua_settop(e,n),a.__multi=!0,a}runScriptPhase(e,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,q("script")),!(e==="OnUpdate"&&!r.updateEnabled)&&this.callGlobalDt(n,e,i))}}step(e=1/30){if(typeof e!="number"||!Number.isFinite(e)||e<0)throw new TypeError("dt must be a finite non-negative number");this.clock.frame++,this.clock.time+=e;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(e);this.runScriptPhase("OnUpdate",e),i&&(this.clock.levelTime+=e,this.runScriptPhase("OnLevelUpdate",e))}injectKey(e){let i=r=>{if(!r.alive||!r.activeInHierarchy)return!1;if(r.keyListeners.has(e)&&r.emitKey(e))return!0;for(let n of[...r.children])if(i(n))return!0;return!1};for(let r of[...this.roots])i(r)}injectCursor(e,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),e.emitCursor(i,n)}getVar(e,i){if(this.serverBridge&&typeof this.serverBridge.getVar=="function")return this.serverBridge.getVar(e,i);let r=this.serverVars[e];return r?r[i]:void 0}notifyVarHandlers(e,i){for(let r of this.varHandlers)this.scriptCanRun(r.script)&&r.entityType===e&&r.name===i&&this.safeCall(r.fn,this.enumTree.CustomVariableEntityType[e],i)}setVar(e,i,r){if(this.serverBridge&&typeof this.serverBridge.setVar=="function"){this.serverBridge.setVar(e,i,r);return}let n=this.serverVars[e]||(this.serverVars[e]=Object.create(null));n[i]=r,this.notifyVarHandlers(e,i)}sendClientSignal(e,i){for(let r of this.signalHandlers)this.scriptCanRun(r.script)&&r.name===e&&this.safeCall(r.fn,e,i)}evalQueryScript(e,i){this.L||this.boot();let r=this.L;d.lua_createtable(r,0,5);let n=(o,s)=>{d.lua_pushcfunction(r,s),d.lua_setfield(r,-2,q(o))};return n("var",o=>(Ge(o,this,i.var(Ce(o,1),Ce(o,2))),1)),n("logContains",o=>(d.lua_pushboolean(o,i.logContains(Ce(o,1))),1)),n("control",o=>(Ge(o,this,i.control(Ce(o,1))),1)),n("logs",o=>(Ge(o,this,i.logs()),1)),n("signals",o=>(Ge(o,this,i.signals(Ce(o,1))),1)),n("serverLogs",o=>(Ge(o,this,i.serverLogs?i.serverLogs():[]),1)),n("serverLogContains",o=>{let s=i.serverLogContains;return d.lua_pushboolean(o,s?!!s(Ce(o,1)):!1),1}),d.lua_setglobal(r,q("query")),this.runChunk(r,e,"autotest-assert"),!0}destroy(){for(let e of this.roots.slice())this.destroyControl(e);for(let e of this.mountedScripts.slice())this.unmountScript(e);this.lifecyclePhase="idle",this.mountedScripts=[],this.luaFunctions.clear();for(let e of[...this.luaStates])this.closeTrackedLuaState(e);this.L=null,this.audios.clear(),this.audioHistory.length=0,this.audioWarnings.clear()}};function Yr(t){let e=new no(t);return e.boot(),e}var qi=Object.freeze(Array.from({length:8},(t,e)=>`Player${e+1}`)),ra=Object.freeze(Array.from({length:8},(t,e)=>`Avatar${e+1}`)),_c=Object.freeze(["Level","PlayerSelf","AvatarSelf"]);var ta=Object.freeze([..._c,...qi,...ra]),Ic=Object.freeze(["PlayerSelf","AllPlayers",...qi]),xm=Object.freeze(["Level","PlayerSelf",...qi]),gc=Object.freeze(["Int","Float","String","Bool","Vector3","Entity","Guid","PrefabId","ConfigId","IntList","FloatList","StringList","BoolList","Vector3List","EntityList","GuidList","PrefabIdList","ConfigIdList","Dict","Struct"]),_m=-2147483648,Im=2147483647,Cm=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 Xr(t){return`Player${Number(t)}`}function oo(t){return`Avatar${Number(t)}`}function yc(t){let e=String(t||"").match(/^(?:Player|Avatar)([1-8])$/);return e?Number(e[1]):0}function Gi(t){if(t==null||t==="")return 1;let e=Number(t);if(!Number.isInteger(e)||e<1||e>8)throw new Error("playerCount must be an integer 1-8");return e}function Zt(t,e=8){let i=Gi(e);if(t==null||t==="")return 1;let r=Number(t);if(!Number.isInteger(r)||r<1||r>i)throw new Error(`playerIndex must be an integer 1-${i}`);return r}function vc(){let t={Level:Object.create(null),PlayerSelf:Object.create(null),AvatarSelf:Object.create(null)};for(let e of qi)t[e]=Object.create(null);for(let e of ra)t[e]=Object.create(null);return t}function Cc(t){let e=String(t||"");if(!ta.includes(e))throw new Error(`unknown CustomVariableEntityType: ${t}`);return e}function Em(t,e){let i=Cc(t);if(!xm.includes(i))throw new Error(`${e}.entityType must be Level, PlayerSelf, or Player1-8`);return i}function Hr(t){let e=String(t??"");if(!e)throw new Error("custom variable name is required");return e}function so(t){let e=String(t??"");if(!e)throw new Error("signal name is required");return e}function ia(t){let e=String(t||"PlayerSelf");if(!Ic.includes(e))throw new Error(`unsupported client signal target: ${t}. use PlayerSelf, AllPlayers, or Player1-8`);return e}function Kr(t){if(t==null)return"";if(typeof t=="boolean")return"Bool";if(typeof t=="string")return"String";if(typeof t=="number")return Number.isInteger(t)?"Int":"Float";if(Array.isArray(t)){if(t.length===0)return"IntList";let e=Kr(t[0]);return e&&!e.endsWith("List")&&e!=="Dict"&&e!=="Struct"?`${e}List`:"IntList"}return t&&typeof t=="object"?"x"in t||"y"in t||"z"in t?"Vector3":"Dict":""}function nt(t){return t===void 0?null:JSON.parse(JSON.stringify(t))}function bc(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"value")&&"type"in e?e.value:e):[]}function wc(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"value")&&"type"in e?{type:String(e.type||""),value:e.value}:{type:Kr(e),value:e}):[]}function km(t){return String(t?.kind||t?.type||t?.name||t?.id||"")}function ao(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Ec(t,e){if(!ao(t)||!Object.prototype.hasOwnProperty.call(t,"fromSignalParam"))return null;if(Object.keys(t).some(r=>r!=="fromSignalParam"))throw new Error(`${e}.fromSignalParam cannot be combined with literal fields`);let i=Number(t.fromSignalParam);if(!Number.isSafeInteger(i)||i<0)throw new Error(`${e}.fromSignalParam must be a non-negative integer`);return{fromSignalParam:i}}function Sc(t,e){return Ec(t,e)||nt(t)}function Am(t,e,i){if(!ao(t))throw new Error(`serverLogic.rules[${e}].actions[${i}] must be an object`);let r=String(t.kind||t.type||""),n=`serverLogic.rules[${e}].actions[${i}]`;if(r==="setCustomVariable"){let o=Em(t.entityType,n);if(!Object.prototype.hasOwnProperty.call(t,"value"))throw new Error(`${n}.value is required`);return{kind:r,entityType:o,name:Hr(t.name),value:Sc(t.value,`${n}.value`),...t.variableType?{variableType:String(t.variableType)}:{}}}if(r==="sendClientScriptSignal"){if(!Array.isArray(t.params))throw new Error(`${n}.params must be an array`);return{kind:r,target:ia(t.target),signalName:so(t.signalName),params:t.params.map((o,s)=>Sc(o,`${n}.params[${s}]`))}}throw new Error(`${n}.kind must be setCustomVariable or sendClientScriptSignal`)}function Wr(t){if(t==null)return{version:1,rules:[]};if(!ao(t))throw new Error("serverLogic must be an object");let e=t.rules===void 0?[]:t.rules;if(!Array.isArray(e))throw new Error("serverLogic.rules must be an array");return{version:1,rules:e.map((i,r)=>{if(!ao(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:so(i.signalName),actions:i.actions.map((n,o)=>Am(n,r,o))}})}}function xc(t,e,{typed:i=!1}={}){let r=Ec(t,"server logic value");if(r){let n=i?e.params:e.values;if(r.fromSignalParam>=n.length)throw new Error(`signal ${e.name} has no parameter at index ${r.fromSignalParam}`);return nt(n[r.fromSignalParam])}return nt(t)}function Om(t){return t==="Level"?"Level":qi.includes(t)?"PlayerSelf":ra.includes(t)?"AvatarSelf":t}function kc(t={}){let e=vc(),i=vc(),r=[],n=[],o=[],s=[],a=Array.from({length:9},()=>null),l=1,u=0,f=Number(t.onlineLatencyMs||0);(!Number.isFinite(f)||f<0)&&(f=0);let h=Wr(t.logic),m=Gi(t.playerCount),p=Zt(t.viewPlayerIndex,m);function g(_,O){s.push({source:"server",level:String(_||"engine"),text:String(O),time:u})}function b(_){let O=a[_||p],y=Number(O?.clock?.time);Number.isFinite(y)&&(u=y)}function w(_,O,y,N){e[_][O]=y,i[_][O]={type:N||Kr(y)||i[_][O]?.type||""}}function x(_,O,y){return typeof y!="number"||!Number.isInteger(y)?{ok:!0,value:y}:y>=_m&&y<=Im?{ok:!0,value:y}:(g("engine",`Int custom variable ${_}.${O} out of range ${y}; keeping previous legal value`),{ok:!1,value:e[_][O]})}function I(_,O){let y=Cc(_),N=O||p;return y==="PlayerSelf"?Xr(N):y==="AvatarSelf"?oo(N):y}function $(_,O){let y=Om(_);if(_==="Level"){for(let c=1;c<=m;c+=1){let S=a[c];S&&typeof S.notifyVarHandlers=="function"&&S.notifyVarHandlers("Level",O)}return}let N=yc(_);if(!N)return;let E=a[N];E&&typeof E.notifyVarHandlers=="function"&&E.notifyVarHandlers(y,O)}function C(_,O){let y=ia(_);return y==="AllPlayers"?Array.from({length:m},(N,E)=>E+1):y==="PlayerSelf"?[O||p]:[yc(y)]}function D(_){for(let O of h.rules)if(O.signalName===_.name)for(let y of O.actions){if(y.kind==="setCustomVariable"){let N=xc(y.value,_);B.setVar(y.entityType,y.name,N,{type:y.variableType,playerIndex:_.playerIndex}),g("info",`logic ${O.id}: set ${y.entityType}.${y.name}`);continue}if(y.kind==="sendClientScriptSignal"){let N=y.params.map(E=>xc(E,_,{typed:!0}));B.sendToClient(y.signalName,N,{target:y.target,playerIndex:_.playerIndex}),g("info",`logic ${O.id}: sent ${y.signalName} to ${y.target}`)}}}function G(_,O){_&&(_.serverBridge={getVar:(y,N)=>B.getVar(y,N,{playerIndex:O}),setVar:(y,N,E)=>B.setVar(y,N,E,{playerIndex:O}),receiveFromClient:(y,N)=>B.receiveFromClient(y,N,{playerIndex:O})})}function Y(_){_&&(_.serverBridge=null)}let B={ENTITY_TYPES:_c,ALL_ENTITY_TYPES:ta,CLIENT_SIGNAL_TARGETS:Ic,get clock(){return u},get playerCount(){return m},get viewPlayerIndex(){return p},setClock(_){u=Number(_)||0},setPlayerCount(_){return m=Gi(_),p>m&&(p=m),m},setViewPlayerIndex(_){return p=Zt(_,m),p},log(_,O){g(_,O)},defineVar(_,O,y={},{playerIndex:N}={}){let E=I(_,N),c=Hr(O);if(Object.prototype.hasOwnProperty.call(e[E],c))throw new Error(`custom variable already exists: ${E}.${c}`);let S=y.type?String(y.type):Kr(y.value??y.defaultValue);if(S&&!gc.includes(S))throw new Error(`unsupported custom variable type: ${S}`);let M=y.value!==void 0?y.value:y.defaultValue!==void 0?y.defaultValue:null;return w(E,c,M,S),B.getVar(E,c)},getVar(_,O,{playerIndex:y}={}){let N=I(_,y),E=Hr(O);if(!Object.prototype.hasOwnProperty.call(e[N],E)){g("engine",`GetGlobalCustomVariableValue missing ${N}.${E}; returning nil (simulator policy)`);return}return e[N][E]},setVar(_,O,y,{notify:N=!0,type:E,playerIndex:c}={}){let S=I(_,c),M=Hr(O),j=E||i[S][M]?.type||Kr(y);if(j&&!gc.includes(j)&&j!=="")throw new Error(`unsupported custom variable type: ${j}`);let H=y;if(!((j==="Int"||j===""&&typeof y=="number"&&Number.isInteger(y))&&(H=x(S,M,y).value,H===void 0)))return w(S,M,H,j),N&&$(S,M),H},listVars(_){let O=_?[I(_)]:["Level",...Array.from({length:m},(N,E)=>Xr(E+1)),...Array.from({length:m},(N,E)=>oo(E+1))],y=[];for(let N of O)for(let E of Object.keys(e[N]))y.push({entityType:N,name:E,type:i[N][E]?.type||"",value:nt(e[N][E])});return y},receiveFromClient(_,O=[],{playerIndex:y}={}){let N=Zt(y||p,m);b(N);let E=so(_),c={id:l++,direction:"inbound",name:E,params:wc(O),values:bc(O),time:u,playerIndex:N,from:Xr(N)};return r.push(c),D(c),c},sendToClient(_,O=[],{target:y="PlayerSelf",playerIndex:N}={}){let E=so(_),c=ia(y),M=C(c,N||p),j={id:l++,direction:"outbound",name:E,params:wc(O),values:bc(O),time:u,target:c,players:M,deliverAt:u+f/1e3,delivered:!1};return n.push(j),f===0?B.deliver(j):o.push(j),j},getLogic(){return nt(h)},setLogic(_){return h=Wr(_),B.getLogic()},deliver(_){if(!_||_.delivered)return;_.delivered=!0;let O=Array.isArray(_.players)&&_.players.length?_.players:C(_.target);for(let y of O){let N=a[y];N&&typeof N.sendClientSignal=="function"&&N.sendClientSignal(_.name,_.values)}},flush(_){_!==void 0&&(u=Number(_)||0);let O=[];for(let y=o.length-1;y>=0;y-=1)o[y].deliverAt<=u&&O.push(o.splice(y,1)[0]);O.sort((y,N)=>y.id-N.id);for(let y of O)B.deliver(y);return O},inbound(){return r.slice()},outbound(){return n.slice()},loadConfig(_){if(_!=null){if(typeof _!="object")throw new Error("server config must be an object");if(_.graph&&!Array.isArray(_.nodes))throw new Error("unsupported server node graph: v1 only accepts custom variables and signals");for(let O of _.nodes||[]){let y=km(O);if(!Cm.has(y))throw new Error(`unsupported server node: ${y||JSON.stringify(O)}. v1 only supports custom variables and signals`)}if(_.onlineLatencyMs!==void 0){let O=Number(_.onlineLatencyMs);if(!Number.isFinite(O)||O<0)throw new Error("onlineLatencyMs must be a non-negative finite number");f=O}_.playerCount!==void 0&&B.setPlayerCount(_.playerCount),_.viewPlayerIndex!==void 0&&B.setViewPlayerIndex(_.viewPlayerIndex),(_.logic!==void 0||_.serverLogic!==void 0)&&B.setLogic(_.logic??_.serverLogic);for(let O of _.vars||[]){let y=I(O.entityType),N=Hr(O.name);Object.prototype.hasOwnProperty.call(e[y],N)?B.setVar(y,N,O.value??O.defaultValue,{notify:!1,type:O.type}):B.defineVar(y,N,O)}}},attachRuntime(_,{playerIndex:O=1}={}){let y=Zt(O,8);return a[y]&&a[y]!==_&&Y(a[y]),a[y]=_||null,G(a[y],y),B},attachRuntimes(_){B.detachRuntime();let O=Array.isArray(_)?_:[];for(let y=0;y<O.length&&y<8;y+=1)a[y+1]=O[y]||null,G(a[y+1],y+1);return B},detachRuntime(){for(let _=1;_<=8;_+=1)Y(a[_]),a[_]=null},snapshot(){let _=Xr(p),O=oo(p),y={Level:{},PlayerSelf:{},AvatarSelf:{}};for(let N of Object.keys(e.Level))y.Level[N]={type:i.Level[N]?.type||"",value:nt(e.Level[N])};for(let N of Object.keys(e[_]))y.PlayerSelf[N]={type:i[_][N]?.type||"",value:nt(e[_][N])};for(let N of Object.keys(e[O]))y.AvatarSelf[N]={type:i[O][N]?.type||"",value:nt(e[O][N])};for(let N=1;N<=m;N+=1){let E=Xr(N),c=oo(N);y[E]={},y[c]={};for(let S of Object.keys(e[E]))y[E][S]={type:i[E][S]?.type||"",value:nt(e[E][S])};for(let S of Object.keys(e[c]))y[c][S]={type:i[c][S]?.type||"",value:nt(e[c][S])}}return{clock:u,onlineLatencyMs:f,playerCount:m,viewPlayerIndex:p,logic:B.getLogic(),vars:y,inbound:r.map(N=>({id:N.id,name:N.name,params:nt(N.params),values:nt(N.values),time:N.time,playerIndex:N.playerIndex,from:N.from})),outbound:n.map(N=>({id:N.id,name:N.name,params:nt(N.params),values:nt(N.values),time:N.time,target:N.target,players:Array.isArray(N.players)?N.players.slice():[],deliverAt:N.deliverAt,delivered:!!N.delivered})),logs:s.map(N=>({source:"server",level:N.level,text:N.text,time:N.time}))}},reset(){for(let _ of ta){for(let O of Object.keys(e[_]))delete e[_][O];for(let O of Object.keys(i[_]))delete i[_][O]}r.length=0,n.length=0,o.length=0,s.length=0,l=1,u=0},destroy(){B.detachRuntime(),B.reset()}};t.config&&B.loadConfig(t.config);for(let _ of t.vars||[])B.defineVar(_.entityType,_.name,_);return B}var Tm={container:"container",textbox:"textbox",image:"image",button:"button",cursor:"cursor",grid:"grid",reference:"reference",textwindow:"textwindow",keyhint:"keyhint",animation:"animation",fullscreen:"fullscreen"};function na(t,e,i=null){let r=oi(t.transformByPlatform,e),n={authoringId:t.id,kind:Tm[t.kind]||"container",name:t.name,prefabIndex:t.guid||0,active:t.active!==!1,visible:t.visible!==!1,canControllerFocus:t.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:(t.children||[]).map(s=>na(s,e,i))},o=i?.get(t.id);return o?.length&&(n.scripts=o.map(s=>{let a=Number(s.guid);return{path:s.path||s.id,source:s.source||"",...Number.isSafeInteger(a)&&a>0?{scriptMappingId:a}:{}}})),t.kind==="container"&&(n.isolateNavigation=t.isolateNavigation===!0,n.disableKeyEventPassthrough=t.disableKeyEventPassthrough===!0,n.disableCursorEventPassthrough=t.disableCursorEventPassthrough===!0,n.showCursor=t.showCursor===!0),(t.kind==="textbox"||t.kind==="textwindow")&&(n.text=t.text??"",n.fontSize=t.fontSize,n.adaptiveFontSize=t.adaptiveFontSize===!0,n.minimumFontSize=t.minimumFontSize,n.fontColor=t.fontColor,n.bgColor=t.bgColor,n.enableOutline=t.enableOutline!==!1,n.outlineColor=t.outlineColor,n.horizontalAlignment=t.horizontalAlignment||"Left",n.verticalAlignment=t.verticalAlignment||"Top",t.kind==="textwindow"&&(n.interactable=t.interactable!==!1,n.showScrollBar=t.showScrollBar!==!1)),t.kind==="image"&&(n.imageSource=t.imageSource,n.imageType=t.imageType??null,n.imageId=t.imageId??0,n.imageColor=t.imageColor,n.raycastTarget=t.raycastTarget===!0,n.enableMask=t.enableMask===!0,n.enableSoftEdge=t.enableSoftEdge===!0,n.softEdgeMode=t.softEdgeMode,n.softEdgeWidthX=t.softEdgeWidthX,n.softEdgeWidthY=t.softEdgeWidthY,n.horizontalSoftRange=t.horizontalSoftRange,n.verticalSoftRange=t.verticalSoftRange,n.enableFill=t.enableFill===!0,n.fillType=t.enableFill?t.fillType:"Unused",n.fillHorizontalType=t.fillHorizontalType,n.fillVerticalType=t.fillVerticalType,n.fillRadial90Type=t.fillRadial90Type,n.fillRadialType=t.fillRadialType,n.fillAmount=t.fillAmount,n.reverseMaskArea=t.reverseMaskArea===!0),t.kind==="button"&&(n.raycastTarget=t.raycastTarget!==!1,n.interactable=t.interactable!==!1,n.clickAudioId=t.clickAudioId,n.unavailableChildId=t.unavailableChildId??null,n.hoverChildId=t.hoverChildId??null,n.pressedChildId=t.pressedChildId??null,n.selectedChildId=t.selectedChildId??null),t.kind==="cursor"&&(n.raycastTarget=t.raycastTarget!==!1),t.kind==="reference"&&(n.referencedPrefabIndex=t.referencedPrefabId),t.kind==="grid"&&(n.itemPrefabIndex=t.itemPrefabId,n.raycastTarget=t.raycastTarget!==!1,n.interactable=t.interactable!==!1,n.showScrollBar=t.showScrollBar!==!1,n.scrollDirection=t.scrollDirection,n.layoutConstraint=t.layoutConstraint,n.layoutConstraintFixedCount=t.layoutConstraintFixedCount,n.cellSizeX=t.cellSizeX,n.cellSizeY=t.cellSizeY,n.spacingX=t.spacingX,n.spacingY=t.spacingY,n.padding1X=t.padding1X,n.padding1Y=t.padding1Y,n.padding2X=t.padding2X,n.padding2Y=t.padding2Y,n.previewCount=t.previewCount),t.kind==="keyhint"&&(n.keyboardKeyCode=t.keyboardKeyCode,n.controllerKeyCode=t.controllerKeyCode),(t.kind==="animation"||t.kind==="fullscreen")&&(n.raycastTarget=!1,n.animationId=t.animationId,n.playSoundEffect=t.playSoundEffect,t.kind==="animation"&&(n.layer=t.layer)),n}function oa(t,e=[],i=""){let r=i&&Te[i]?i:t.canvasId,n=Te[r],o=Er(t),s=new Map;for(let l of e){if(!l.controlId)continue;let u=s.get(l.controlId)||[];u.push(l),s.set(l.controlId,u)}let a=t.meta?.assetType==="client-control-template"?(t.root.children||[]).map(l=>na(l,r,s)):[];return{canvasId:r,platform:n.platform,device:n.luaDevice,canvasWidth:n.width,canvasHeight:n.height,root:na(o,r,s),templates:a}}var lo="qxqy-autotest";var Vi=.03333333333333333,Rm=new Set(["pointer","key","click","pause","resume","serverSet","serverSend","view"]),Nm=new Set(["log","control","var","signal","tree","lua"]);function Bi(t,e){let i=Number(t);if(!Number.isFinite(i))throw new Error(`${e} must be a finite number`);return i}function sa(t){return JSON.parse(JSON.stringify(t??null))}function uo(t,e){if(!t||typeof t!="object")throw new Error(`events[${e}] must be an object`);let i=String(t.kind||t.do||"");if(!Rm.has(i))throw new Error(`unsupported event kind: ${i||"(empty)"}`);let r=t.payload&&typeof t.payload=="object"?{...t.payload}:{};if(i==="pointer")!r.type&&t.type&&(r.type=t.type),r.x===void 0&&(r.x=t.x),r.y===void 0&&(r.y=t.y),r.x=Bi(r.x,"pointer.x"),r.y=Bi(r.y,"pointer.y"),r.type=String(r.type||"click"),r.type==="wheel"&&(r.deltaX=Bi(r.deltaX??t.deltaX??0,"pointer.deltaX"),r.deltaY=Bi(r.deltaY??t.deltaY??0,"pointer.deltaY"));else if(i==="key"){if(r.typeName=String(r.typeName||r.key||t.typeName||t.key||""),!r.typeName)throw new Error("key event requires typeName")}else if(i==="click"){if(r.name=String(r.name||t.name||""),!r.name)throw new Error("click event requires control name")}else if(i==="serverSet"){if(r.entityType=String(r.entityType||t.entityType||""),r.name=String(r.name||t.name||""),r.value===void 0&&(r.value=t.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||t.name||""),r.params=Array.isArray(r.params)?r.params:Array.isArray(t.params)?t.params:[],r.target=String(r.target||t.target||"PlayerSelf"),!r.name)throw new Error("serverSend requires signal name")}else if(i==="view"&&(r.playerIndex=Number(r.playerIndex||r.viewPlayerIndex||t.playerIndex||t.viewPlayerIndex||0),!Number.isInteger(r.playerIndex)||r.playerIndex<1))throw new Error("view event requires playerIndex 1-8");return{t:Bi(t.t??0,"event.t"),source:String(t.source||"user"),kind:i,payload:r}}function aa(t,e){if(!t||typeof t!="object")throw new Error(`asserts[${e}] must be an object`);let i=String(t.kind||(t.check?"log":""));if(!Nm.has(i))throw new Error(`unsupported assert kind: ${i||"(empty)"}`);let r={kind:i};if(t.at!==void 0&&(r.at=Bi(t.at,"assert.at")),i==="log"){if(r.contains=String(t.contains||t.check||t.text||""),r.source=t.source==="server"?"server":"client",t.level&&(r.level=String(t.level)),!r.contains)throw new Error("log assert requires contains")}else if(i==="control"){if(r.id=t.id?String(t.id):"",r.name=t.name?String(t.name):"",r.field=String(t.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(t,"equals"))throw new Error("control assert requires equals");r.equals=sa(t.equals)}else if(i==="var"){if(r.entityType=String(t.entityType||""),r.name=String(t.name||""),!r.entityType||!r.name)throw new Error("var assert requires entityType and name");if(!Object.prototype.hasOwnProperty.call(t,"equals"))throw new Error("var assert requires equals");r.equals=sa(t.equals)}else if(i==="signal"){if(r.direction=t.direction==="outbound"?"outbound":"inbound",r.name=String(t.name||""),!r.name)throw new Error("signal assert requires name");t.values!==void 0&&(r.values=sa(t.values))}else if(i==="tree"){if(r.name=String(t.name||""),r.exists=t.exists!==!1,!r.name)throw new Error("tree assert requires name")}else if(i==="lua"&&(r.source=String(t.source||""),!r.source.trim()))throw new Error("lua assert requires source");return r}function Ac(t){let e=0,i=[],r=[];for(let n of t){if(!n||typeof n!="object")throw new Error("queue step must be an object");if(n.do!=="start"){if(n.do==="step"){e+=Bi(n.dt??Vi,"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(uo({...n,kind:n.do,t:e},i.length));continue}if(n.assert||n.check||n.kind){r.push(aa({...n.assert||n,at:n.at??e},r.length));continue}throw new Error(`unsupported queue step: ${JSON.stringify(n)}`)}}return{events:i,asserts:r,dt:Vi}}function Jr(t){if(Array.isArray(t)){let r=Ac(t);return{format:lo,version:1,name:"",dt:r.dt,events:r.events,asserts:r.asserts}}if(!t||typeof t!="object")throw new Error("autotest case must be an object or step array");if(Array.isArray(t.queue)||Array.isArray(t.steps)){let r=Ac(t.queue||t.steps);return{format:lo,version:1,name:String(t.name||""),dt:Number(t.dt)>0?Number(t.dt):r.dt,events:r.events,asserts:r.asserts}}let e=(t.events||[]).map((r,n)=>uo(r,n)),i=(t.asserts||[]).map((r,n)=>aa(r,n));return e.sort((r,n)=>r.t-n.t||0),{format:lo,version:1,name:String(t.name||""),dt:Number(t.dt)>0?Number(t.dt):Vi,playerCount:Number(t.playerCount)>0?Number(t.playerCount):1,events:e,asserts:i}}function Oc(t,e={}){let i=(t||[]).map((r,n)=>uo(r,n));return{format:lo,version:1,name:String(e.name||""),dt:Number(e.dt)>0?Number(e.dt):Vi,playerCount:Number(e.playerCount)>0?Number(e.playerCount):1,events:i,asserts:(e.asserts||[]).map((r,n)=>aa(r,n))}}function Tc(t,e,i){if(!t)return null;let r=uo({...e,t:e.t??i??0},t.events.length);return t.events.push(r),r}var fo=(t,e)=>Math.max(0,Math.min(e,Number.isFinite(t)?t:0));function Rc(t,e,i){let r=Oi(t,e,i),n=Math.max(0,r.contentHeight-i),o=fo(t._scrollOffset||0,n);return t._scrollOffset=o,{...r,length:r.contentHeight,max:n,offset:o,viewport:i,horizontal:!1,width:e,height:i}}function co(t,e,i){if(!t?.showBar||t.max<=0||e<=0||i<=0)return null;let r=t.horizontal===!0,n=r?e:i,o=Math.max(0,n-4),s=Math.min(o,Math.max(18,o*n/(n+t.max))),a=o-s,l=a*t.offset/t.max,u=Math.min(8,r?i:e),f=r?{x:-e/2+2,y:i/2-u-2,width:o,height:u}:{x:e/2-u-2,y:-i/2+2,width:u,height:o},h=r?{...f,x:f.x+l,width:s}:{...f,y:f.y+l,height:s};return{track:f,thumb:h,travel:a}}var Pm=[[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(([t,e])=>[t,e.split(".").map(i=>parseInt(i,36)/1e3)]);function Nc(t){if(!Number.isSafeInteger(t))return null;for(let[e,i]of Pm)if(t>=e&&t<e+i.length)return i[t-e];return null}import{randomUUID as zc}from"node:crypto";function mo(t){for(let e of t.runtime.scrollControls||[]){let[i,r]=Vr(e),n=e.kind==="grid"?pr(e):Rc(e,i,r),o={offset:n.offset,max:n.max,horizontal:n.horizontal,showBar:e.showScrollBar!==!1,textWidth:n.textWidth??0,lines:n.lines||[],lineHeight:n.lineHeight||0,contentLength:n.length,...e.kind==="textwindow"?{fontSize:n.fontSize}:{}},s=JSON.stringify(o);e._scrollKey!==s&&(e._scrollKey=s,e._scroll=o,e.markPlayDirty())}}function Dc(t){return{...t._scroll?{scroll:t._scroll}:{},...t.parent?._gridItems?.includes(t)?{clipToParent:!0}:{}}}function la(t,e){let i=t._scroll?.max||0;t.kind==="grid"?t.scrollProgress=i?fo(e,i)/i:0:t._scrollOffset=fo(e,i),t.markPlayDirty()}var Fm=Object.freeze(Object.values(Te).map(t=>Object.freeze({id:t.id,label:t.label,platform:t.platform,width:t.width,height:t.height})));function go(t){mo(t);let e=Qe({width:t.runtime.canvasWidth,height:t.runtime.canvasHeight}),i=new Map;function r(n,o,s){let a=Vt(o,n);a.activeInHierarchy=s&&n.active!==!1,i.set(n.Id,a);let l=a.activeInHierarchy;for(let u of n.children)r(u,a,l)}for(let n of t.runtime.roots)r(n,e,!0);return i}function $c(t,e=go(t)){let i=new Map;function r(n,o){let s=e.get(n.Id);if(!s)return;let a=Cr(o,s,n);i.set(n.Id,a);for(let l of n.children)r(l,a)}for(let n of t.runtime.roots)r(n,Ki());return i}function Gc(t,e){let i=e.get(t.Id);return{id:t.Id,prefabId:t.prefabIndex,authoringId:t.authoringId,name:t.name,kind:t.kind,typeofName:t.typeofName,instantiated:!t.authoringId,active:!!t.active,visible:!!t.visible,activeInHierarchy:!!i?.activeInHierarchy,raycastTarget:t.raycastTarget!==!1,interactable:t.interactable!==!1,pressed:t.pressed===!0,...t._scroll?{scrollOffset:t._scroll.offset,scrollMax:t._scroll.max}:{},...t.kind==="grid"?{itemCount:t.itemCount,scrollProgress:t.scrollProgress}:{},anchoredPositionX:t.anchoredPositionX,anchoredPositionY:t.anchoredPositionY,sizeDeltaX:t.sizeDeltaX,sizeDeltaY:t.sizeDeltaY,localScaleX:t.localScaleX,localScaleY:t.localScaleY,localScaleZ:t.localScaleZ,localRotationZ:t.localRotationZ,text:t.kind==="textbox"||t.kind==="textwindow"?t.text??"":null,fontSize:t.kind==="textbox"||t.kind==="textwindow"?t.fontSize:null,adaptiveFontSize:t.kind==="textbox"||t.kind==="textwindow"?t.adaptiveFontSize===!0:null,minimumFontSize:t.kind==="textbox"||t.kind==="textwindow"?t.minimumFontSize:null,fontColor:t.kind==="textbox"||t.kind==="textwindow"?t.fontColor:null,bgColor:t.kind==="textbox"||t.kind==="textwindow"?t.bgColor:null,enableOutline:t.kind==="textbox"||t.kind==="textwindow"?t.enableOutline===!0:null,outlineColor:t.kind==="textbox"||t.kind==="textwindow"?t.outlineColor:null,imageId:t.kind==="image"?t.imageId??0:null,imageSource:t.kind==="image"?ti(t.imageSource):null,imageType:t.kind==="image"?t.imageType==null?null:Et(t.imageType):null,primitive:t.kind==="image"?Xi(t.imageId,t.imageSource):null,imageColor:t.kind==="image"?t.imageColor:null,enableMask:t.kind==="image"?t.enableMask===!0:null,enableSoftEdge:t.kind==="image"?t.enableSoftEdge===!0:null,softEdgeMode:t.kind==="image"?t.softEdgeMode:null,softEdgeWidthX:t.kind==="image"?t.softEdgeWidthX:null,softEdgeWidthY:t.kind==="image"?t.softEdgeWidthY:null,horizontalSoftRange:t.kind==="image"?t.horizontalSoftRange:null,verticalSoftRange:t.kind==="image"?t.verticalSoftRange:null,enableFill:t.kind==="image"?t.enableFill===!0:null,fillType:t.kind==="image"?t.fillType:null,fillHorizontalType:t.kind==="image"?t.fillHorizontalType:null,fillVerticalType:t.kind==="image"?t.fillVerticalType:null,fillRadial90Type:t.kind==="image"?t.fillRadial90Type:null,fillRadialType:t.kind==="image"?t.fillRadialType:null,reverseMaskArea:t.kind==="image"?t.reverseMaskArea===!0:null,fillAmount:t.kind==="image"?t.fillAmount:null,box:i?{left:i.left,bottom:i.bottom,width:i.width,height:i.height}:null,children:t.children.map(r=>Gc(r,e))}}function Mm(){return{pointerDownControl:null,pointerDownPosition:null,pointerLastPosition:null,pointerDragging:!1,pointerHoverControl:null,pointerScroll:null,hoveredControl:null,selectedControl:null,stateRestores:new Map,viewCache:null}}function zm(t,e,i,r){let n=Yr({canvasWidth:t.canvasWidth,canvasHeight:t.canvasHeight,device:t.device,audioDuration:Nc,canSelectImageType:$a,...r?{language:r}:{}});for(let o of[...t.templates||[],...e?.templates||[]])Number.isSafeInteger(o.prefabIndex)&&o.prefabIndex>0&&n.registerTemplate(o.prefabIndex,o);for(let o of i){let s=o.path||o.id,a=o.source||"";s&&a&&n.registerScriptFile(s,a)}return n}var Dm=["pointerDownControl","pointerDownPosition","pointerLastPosition","pointerDragging","pointerHoverControl","pointerScroll","hoveredControl","selectedControl","stateRestores","viewCache"];function $m(t){Object.defineProperty(t,"runtime",{configurable:!0,enumerable:!0,get(){return t.runtimes[t.viewPlayerIndex-1]}});for(let e of Dm)Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){return t.views[t.viewPlayerIndex-1][e]},set(i){t.views[t.viewPlayerIndex-1][e]=i}})}function qc(t,{templatesProject:e=null,scripts:i=[],sceneScripts:r=null,templateScripts:n=null,serverConfig:o=null,canvasId:s="",playerCount:a=1,viewPlayerIndex:l=1,language:u=""}={}){let f=r||i,h=n||i,m=oa(t,f,s),p=e?oa(e,h,s):null,g=Gi(a),b=Zt(l,g),w=kc({playerCount:g,viewPlayerIndex:b});o&&w.loadConfig({...o,playerCount:g,viewPlayerIndex:b});let x=[];for(let C=0;C<g;C+=1)x.push(zm(m,p,i,u));w.attachRuntimes(x);for(let C of x)C.addRoot(m.root);let I={audioSessionId:zc(),runtimes:x,views:x.map(()=>Mm()),playerCount:g,viewPlayerIndex:b,server:w,compiled:m,mountError:x.find(C=>C.mountErrors[0])?.mountErrors[0]||null,debugPaused:!1,history:{events:[]},recording:!0};$m(I);let $=I.viewPlayerIndex;for(let C=1;C<=g;C+=1)I.viewPlayerIndex=C,Km(I);return I.viewPlayerIndex=$,I}function da(t,e){if(!t)throw new Error("play session has not started");let i=Zt(e,t.playerCount);return i===t.viewPlayerIndex||(wi(t,{kind:"view",payload:{playerIndex:i}}),t.viewPlayerIndex=i,t.viewCache=null,t.server&&t.server.setViewPlayerIndex(i)),i}function wi(t,e){!t?.recording||!t.history||Tc(t.history,{...e,source:e.source||"user"},t.runtime.clock.time)}function Gm(t){return t?.history?.events||[]}var ha=new Set(["image","textbox","textwindow","button","grid"]);function qm(t,e){let i=gt(e,t.centerX,t.centerY);return{centerX:i.x,centerY:i.y,scaleX:Math.hypot(e.a,e.b),scaleY:Math.hypot(e.c,e.d),rotationZ:Math.atan2(e.b,e.a)*180/Math.PI,matrix:{a:e.a,b:e.b,c:e.c,d:e.d,tx:i.x,ty:i.y}}}function Et(t){return typeof t=="string"?t:t?.Name}function Bc(t){return{fillType:Et(t.fillType),fillHorizontalType:Et(t.fillHorizontalType),fillVerticalType:Et(t.fillVerticalType),fillAmount:t.fillAmount}}function Bm(t,e,i){let r=Math.abs(e.width*i.scaleX),n=Math.abs(e.height*i.scaleY),o={id:t.Id,kind:t.kind,name:t.name,left:i.centerX-r/2,bottom:i.centerY-n/2,width:r,height:n,sourceWidth:e.width,sourceHeight:e.height,rotationZ:i.rotationZ,matrix:i.matrix,pressed:t.pressed===!0,...Dc(t)};return t.kind==="image"&&(o.imageSource=ti(t.imageSource),o.imageType=t.imageType==null?null:Et(t.imageType),o.primitive=Xi(t.imageId,o.imageSource),o.imageColor=t.imageColor,o.imageId=t.imageId,Object.assign(o,Bc(t))),(t.kind==="textbox"||t.kind==="textwindow")&&(o.text=t.text??"",o.fontSize=t.fontSize,o.adaptiveFontSize=t.adaptiveFontSize===!0,o.minimumFontSize=t.minimumFontSize,o.textLayout=Oi(t,e.width,e.height),o.fontColor=t.fontColor,o.bgColor=t.bgColor,o.enableOutline=t.enableOutline===!0,o.outlineColor=t.outlineColor,o.horizontalAlignment=Et(t.horizontalAlignment),o.verticalAlignment=Et(t.verticalAlignment)),o}function Vm(t,e=go(t)){let i=[],r=$c(t,e);function n(o,s=[],a=[]){let l=e.get(o.Id);if(!l||o.visible===!1||!l.activeInHierarchy)return;let u=r.get(o.Id);if(!u)return;let f=qm(l,u),h=o.kind==="image"&&o.enableMask===!0?gn({...Vc(o,l),id:o.Id},yn(u,l.centerX,l.centerY)):null,m=h?[...a,h]:a,p=()=>i.push({...Bm(o,l,f),...s.length?{clipPolygons:s}:{},...m.length?{masks:m}:{}});ha.has(o.kind)&&o.kind!=="grid"&&p();let g=o.children||[];for(let b=g.length-1;b>=0;b-=1){let w=o._gridItems?.includes(g[b])?[...s,[[l.left,l.bottom],[l.right,l.bottom],[l.right,l.top],[l.left,l.top]].map(([x,I])=>gt(u,x,I))]:s;n(g[b],w,m)}o.kind==="grid"&&p()}for(let o of t.runtime.roots)n(o);return i}function Vc(t,e){let i={kind:t.kind,name:t.name,sourceWidth:e.width,sourceHeight:e.height,pressed:t.pressed===!0,...Dc(t)};return t.kind==="image"&&(i.imageSource=ti(t.imageSource),i.imageType=t.imageType==null?null:Et(t.imageType),i.primitive=Xi(t.imageId,i.imageSource),i.imageColor=t.imageColor,i.imageId=t.imageId,Object.assign(i,Bc(t),{enableMask:t.enableMask===!0,enableSoftEdge:t.enableSoftEdge===!0,softEdgeMode:Et(t.softEdgeMode)||"Percentage",softEdgeWidthX:t.softEdgeWidthX,softEdgeWidthY:t.softEdgeWidthY})),(t.kind==="textbox"||t.kind==="textwindow")&&(i.text=t.text??"",i.fontSize=t.fontSize,i.adaptiveFontSize=t.adaptiveFontSize===!0,i.minimumFontSize=t.minimumFontSize,i.textLayout=Oi(t,e.width,e.height),i.fontColor=t.fontColor,i.bgColor=t.bgColor,i.enableOutline=t.enableOutline===!0,i.outlineColor=t.outlineColor,i.horizontalAlignment=Et(t.horizontalAlignment),i.verticalAlignment=Et(t.verticalAlignment)),i}function Lm(t,e,i){let r=_o(t,e),n=gt(r,t.centerX,t.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 Lc(t){let e=t.matrix;return[t.parent,t.z,t.group?1:0,e.a,e.b,e.c,e.d,e.tx,e.ty,t.kind,t.name,t.sourceWidth,t.sourceHeight,t.pressed,t.primitive,t.imageColor,t.imageId,t.imageSource,t.imageType,t.fillType,t.fillHorizontalType,t.fillVerticalType,t.fillAmount,t.enableMask,t.enableSoftEdge,t.softEdgeMode,t.softEdgeWidthX,t.softEdgeWidthY,t.text,t.fontSize,t.fontColor,t.bgColor,t.adaptiveFontSize,t.minimumFontSize,JSON.stringify(t.textLayout),t.enableOutline,t.outlineColor,t.horizontalAlignment,t.verticalAlignment,JSON.stringify(t.scroll),t.clipToParent].join(" ")}function jc(t,e,i,r,n,o){return{id:t.Id,parent:e,z:n,group:o>=16,matrix:Lm(r,t,i),...Vc(t,r)}}function jm(t){let e=Qe({width:t.runtime.canvasWidth,height:t.runtime.canvasHeight}),i=new Set,r=new Map,n=new Map;function o(l,u,f){let h=Vt(u,l);if(h.activeInHierarchy=f&&l.active!==!1,n.set(l.Id,h),l.visible===!1||!h.activeInHierarchy)return!1;let m=l.children||[],p=ha.has(l.kind),g=0;for(let b=0;b<m.length;b+=1)o(m[b],h,h.activeInHierarchy)&&(p=!0,g+=1);return p?(i.add(l.Id),r.set(l.Id,g),!0):!1}function s(l,u,f,h){if(!i.has(l.Id))return;let m=n.get(l.Id);a.push(jc(l,u,f,m,h,r.get(l.Id)||0));let p=l.children||[];for(let g=0;g<p.length;g+=1)s(p[g],l.Id,m,g)}let a=[];for(let l=0;l<t.runtime.roots.length;l+=1)o(t.runtime.roots[l],e,!0),s(t.runtime.roots[l],null,null,l);return{nodes:a,childCounts:r}}function fa(t){let e=t._playChildDirty===!0||t._playDeepDirty===!0;if(t._playDirty=!1,t._playChildDirty=!1,t._playDeepDirty=!1,!e)return;let i=t.children;for(let r=0;r<i.length;r+=1)fa(i[r])}function Um(t,e){let i=Qe({width:t.runtime.canvasWidth,height:t.runtime.canvasHeight}),r=[],n=[],o=e.count,s=t.runtime._playRemoved||[];for(let u=0;u<s.length;u+=1){let f=s[u];e.fingerprints.has(f)&&(n.push(f),e.fingerprints.delete(f),e.childCounts.delete(f),o-=1)}t.runtime._playRemoved=[];function a(u){e.fingerprints.has(u.Id)&&(n.push(u.Id),e.fingerprints.delete(u.Id),e.childCounts.delete(u.Id),o-=1);let f=u.children;for(let h=0;h<f.length;h+=1)a(f[h])}function l(u,f,h,m,p,g){let b=g||u._playDeepDirty===!0,w=b||u._playDirty===!0,x=b||u._playChildDirty===!0;if(!w&&!x)return;if(!(p&&u.active!==!1)||u.visible===!1){a(u);return}let $=Vt(f,u),C=e.childCounts.get(u.Id)||0;if(x){C=0;let O=u.children;for(let y=0;y<O.length;y+=1)l(O[y],$,u.Id,y,!0,b),e.fingerprints.has(O[y].Id)&&(C+=1)}if(!(ha.has(u.kind)||C>0)){e.fingerprints.has(u.Id)&&(n.push(u.Id),e.fingerprints.delete(u.Id),e.childCounts.delete(u.Id),o-=1);return}let G=e.childCounts.get(u.Id);e.childCounts.set(u.Id,C);let Y=C>=16!=(G||0)>=16;if(!w&&!Y&&e.fingerprints.has(u.Id))return;let B=jc(u,h,f===i?null:f,$,m,C),_=Lc(B);e.fingerprints.get(B.id)!==_&&(e.fingerprints.has(B.id)||(o+=1),e.fingerprints.set(B.id,_),r.push(B))}for(let u=0;u<t.runtime.roots.length;u+=1)l(t.runtime.roots[u],i,null,u,!0,!1);return e.count=o,{changed:r,removed:n,count:o}}function Ym(t,e){let i=t.viewCache||(t.viewCache={rev:0,fingerprints:new Map,childCounts:new Map,count:0}),r=Number(e);if(!(Number.isFinite(r)&&r===i.rev&&i.fingerprints.size>0)){let{nodes:l,childCounts:u}=jm(t);i.rev+=1,i.fingerprints=new Map(l.map(f=>[f.id,Lc(f)])),i.childCounts=u,i.count=l.length;for(let f of t.runtime.roots)fa(f);return{format:"tree-v1",revision:i.rev,reset:!0,count:l.length,nodes:l}}let{changed:o,removed:s,count:a}=Um(t,i);i.rev+=1;for(let l of t.runtime.roots)fa(l);return{format:"tree-v1",revision:i.rev,reset:!1,count:a,changed:o,removed:s}}function pa(t,{inspect:e=!1,view:i=!1,paint:r=!1,sceneRev:n,compact:o=!1}={}){mo(t),t.audioSessionId||=zc();let s=t.runtime,a=t.compiled,[l,u]=[s.canvasWidth,s.canvasHeight];t.server&&t.server.setClock(s.clock.time);let f=o?s.logs.slice(-100):s.logs,h=Gm(t),m=t.server?t.server.snapshot():{vars:{},inbound:[],outbound:[],logs:[]};o&&(m.inbound=m.inbound.slice(-100),m.outbound=m.outbound.slice(-100),m.logs=m.logs.slice(-100));let p={canvasId:a.canvasId,platform:a.platform,device:s.device,canvasWidth:l,canvasHeight:u,canvasPresets:Fm,playerCount:t.playerCount||1,viewPlayerIndex:t.viewPlayerIndex||1,players:Array.from({length:t.playerCount||1},(g,b)=>({index:b+1,label:`\u73A9\u5BB6${b+1}`,entityType:`Player${b+1}`})),time:s.clock.time,frame:s.clock.frame,paused:!!t.debugPaused,levelTimePaused:!!s.clock.paused,audio:{sessionId:t.audioSessionId,playerIndex:t.viewPlayerIndex||1,...s.audioSnapshot()},mountError:t.mountError||s.mountErrors[0]||null,logs:f.map(g=>({source:"client",level:g.level,text:g.text,time:g.time})),tree:[],paint:[],scene:null,server:m,history:(o?h.slice(-100):h).map(g=>({t:g.t,source:g.source||"user",kind:g.kind,payload:g.payload||{}}))};if(e||r){let g=go(t);e&&(p.tree=s.roots.map(b=>Gc(b,g))),r&&(p.paint=Vm(t,g))}return i&&(p.scene=Ym(t,n)),Hi(p),p}function yo(t,e=1/30){let i=t.runtimes||(t.runtime?[t.runtime]:[]);for(let r of i)r.step(e);t.server&&(t.server.setClock(t.runtime.clock.time),t.server.flush())}function ma(t,e){wi(t,{kind:"key",payload:{typeName:String(e)}}),t.runtime.injectKey(e)}function Xm(t,e){let i=null;for(let r of t.runtime.roots)Dt(r,n=>{!i&&n.name===e&&(i=n)});return i}function ga(t,e){wi(t,{kind:"click",payload:{name:String(e)}});let i=Xm(t,e);i&&ya(i)&&(i.kind==="button"||i.kind==="cursor")&&i.SimulateCursorClick()}function Hm(t,e){return!t||!e?null:t.children.find(i=>i.authoringId===e||i.Id===e)||null}var Uc={unavailable:"unavailableChildId",hover:"hoverChildId",pressed:"pressedChildId",selected:"selectedChildId"};function Yc(t,e){let i=[];for(let[r,n]of Object.entries(Uc)){let o=e[n]?Hm(e,e[n]):null;o&&i.push({state:r,child:o})}return i}function Km(t){for(let e of t.runtime.roots)Dt(e,i=>{if(i.kind==="button"){for(let{child:r}of Yc(t,i))t.stateRestores.has(r.Id)||t.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);Zr(t,i)}})}function Zr(t,e){if(!e||e.kind!=="button")return;let i=null;e.interactable===!1?i="unavailable":e.pressed===!0?i="pressed":t.hoveredControl===e?i="hover":t.selectedControl===e&&(i="selected");for(let r of Yc(t,e))r.child.active=!0,r.child.visible=r.state===i,typeof r.child.markPlayDirty=="function"&&r.child.markPlayDirty(!0)}function ua(t){if(!t)return null;let e=t.parent;return e?.kind==="button"&&Object.values(Uc).map(r=>e[r]).filter(Boolean).includes(t.authoringId)?e:t}function ya(t){return t.kind==="button"?t.raycastTarget!==!1&&t.interactable!==!1:t.kind==="cursor"||t.kind==="grid"?t.raycastTarget!==!1:t.kind==="textwindow"?t.interactable!==!1:t.raycastTarget===!0}function Xc(t){return t.kind==="container"||t.kind==="grid"||t.kind==="textwindow"||t.kind==="reference"||t.kind==="button"}function Hc(t,e){let i=t.Id,r=e.get(i);if(r!==void 0)return r;let n=ya(t);if(!n&&Xc(t)){let o=t.children;for(let s=0;s<o.length;s+=1)if(Hc(o[s],e)){n=!0;break}}return e.set(i,n),n}function ho(t,e,i){mo(t);let r=Qe({width:t.runtime.canvasWidth,height:t.runtime.canvasHeight}),n=new Map;function o(a,l,u,f){if(!f||a.active===!1||a.visible===!1||!Hc(a,n))return null;let h=Vt(l,a),m=Cr(u,h,a),p=Wi(m);if(!p)return null;let g=gt(p,e,i);if(g.x<h.left||g.x>h.right||g.y<h.bottom||g.y>h.top)return null;if(po(a)){let b=co(a._scroll,h.width,h.height)?.track,w=g.x-h.centerX,x=h.centerY-g.y;if(b&&w>=b.x&&w<=b.x+b.width&&x>=b.y&&x<=b.y+b.height)return a}if(Xc(a))for(let b=0;b<a.children.length;b+=1){let w=o(a.children[b],h,m,!0);if(w)return w}return ya(a)?a:null}let s=Ki();for(let a=t.runtime.roots.length-1;a>=0;a-=1){let l=o(t.runtime.roots[a],r,s,!0);if(l)return l}return null}function vr(t,e,i,{dragging:r=!1,press:n=null,previous:o=null}={}){let s=n||{x:e,y:i},a=o||{x:e,y:i};return t.runtime.makeCursorEventData({x:e,y:i,pressX:s.x,pressY:s.y,deltaX:e-a.x,deltaY:i-a.y,dragging:r})}function ca(t,e,i){e.kind==="grid"||e.kind==="textwindow"||(e.pressed=i,typeof e.markPlayDirty=="function"&&e.markPlayDirty(),Zr(t,e))}function po(t){if(!t?.alive||!t.activeInHierarchy||t.interactable===!1||t.raycastTarget===!1)return!1;for(let e=t;e;e=e.parent)if(e.visible===!1)return!1;return t._scroll?.max>0}function Pc(t){for(let e=t;e;e=e.parent)if(po(e))return e;return null}function Fc(t,e,i,r){let n=go(t),o=n.get(e.Id),s=$c(t,n).get(e.Id),a=s&&Wi(s);if(!o||!a)return null;let l=gt(a,i,r);return{x:l.x-o.centerX,y:o.centerY-l.y,width:o.width,height:o.height}}function Mc(t,e,i){let r=t.pointerDownControl;if(r?.alive){let n=vr(t,e,i,{dragging:t.pointerDragging,press:t.pointerDownPosition,previous:t.pointerLastPosition});t.runtime.injectCursor(r,"CursorUp",n),t.pointerDragging&&!t.pointerScroll&&t.runtime.injectCursor(r,"CursorEndDrag",n),ca(t,r,!1)}t.pointerDownControl=null,t.pointerScroll=null,t.pointerDownPosition=null,t.pointerDragging=!1,t.pointerLastPosition={x:e,y:i}}function Qr(t,e,i,r,n={}){let o=Number(i),s=Number(r);if(!Number.isFinite(o)||!Number.isFinite(s))throw new Error("pointer coordinates must be finite");t.runtime.cursor.x=o,t.runtime.cursor.y=s;let a=Number(n.deltaX??0),l=Number(n.deltaY??0);if(e==="wheel"&&(!Number.isFinite(a)||!Number.isFinite(l)))throw new Error("wheel deltas must be finite");if(n.silent||wi(t,{kind:"pointer",payload:{type:e,x:o,y:s,...e==="wheel"?{deltaX:a,deltaY:l}:{}}}),e==="wheel"){let u=ho(t,o,s),f=Pc(u);if(f){let h=f._scroll.horizontal&&a||l;la(f,f._scroll.offset+h)}return u}if(e==="cancel")return Mc(t,o,s),null;if((e==="move"||e==="up")&&t.pointerScroll&&!po(t.pointerScroll.control)&&Mc(t,o,s),e==="move"){let u=t.pointerLastPosition||{x:o,y:s},f=t.pointerHoverControl,h=ua(ho(t,o,s)),m=vr(t,o,s,{previous:u});f&&f!==h&&t.runtime.injectCursor(f,"CursorExit",m),h&&f!==h&&t.runtime.injectCursor(h,"CursorEnter",m),t.pointerHoverControl=h;let p=t.hoveredControl;t.hoveredControl=h?.kind==="button"?h:null,p&&p!==t.hoveredControl&&Zr(t,p),t.hoveredControl&&Zr(t,t.hoveredControl);let g=t.pointerDownControl,b=t.pointerScroll;if(b)if(!po(b.control))t.pointerScroll=null;else{let w=Fc(t,b.control,o,s);if(w){let x=b.control._scroll,I=x.horizontal?w.x-b.start.x:w.y-b.start.y,$=co(x,w.width,w.height)?.travel||0,C=b.bar?$?I*x.max/$:0:-I;la(b.control,b.offset+C)}}if(g?.alive){let w=t.pointerDownPosition||u,x=Math.hypot(o-w.x,s-w.y)>5;!t.pointerDragging&&x&&(b||t.runtime.injectCursor(g,"CursorBeginDrag",vr(t,o,s,{press:w,previous:u,dragging:!1})),t.pointerDragging=!0),t.pointerDragging&&!b&&t.runtime.injectCursor(g,"CursorDrag",vr(t,o,s,{press:w,previous:u,dragging:!0}))}return t.pointerLastPosition={x:o,y:s},h}if(e==="down"){let u=ua(ho(t,o,s));t.pointerDownControl=u,t.pointerDownPosition={x:o,y:s},t.pointerLastPosition={x:o,y:s},t.pointerDragging=!1,t.pointerScroll=null;let f=Pc(u);if(f){let h=Fc(t,f,o,s),m=h&&co(f._scroll,h.width,h.height),p=b=>h.x>=b.x&&h.x<=b.x+b.width&&h.y>=b.y&&h.y<=b.y+b.height,g=m&&p(m.track);if(g&&!p(m.thumb)){let b=f._scroll.horizontal?h.x-m.track.x-m.thumb.width/2:h.y-m.track.y-m.thumb.height/2;la(f,m.travel?b/m.travel*f._scroll.max:0),mo(t)}h&&(t.pointerScroll={control:f,start:h,offset:f._scroll.offset,bar:!!g})}return u&&(ca(t,u,!0),t.runtime.injectCursor(u,"CursorDown",vr(t,o,s))),u}if(e==="up"){let u=t.pointerDownControl,f=ua(ho(t,o,s));if(u?.alive){let h=vr(t,o,s,{press:t.pointerDownPosition,previous:t.pointerLastPosition,dragging:t.pointerDragging});if(t.runtime.injectCursor(u,"CursorUp",h),t.pointerDragging)t.pointerScroll||t.runtime.injectCursor(u,"CursorEndDrag",h);else if(f===u&&!t.pointerScroll?.bar){t.runtime.injectCursor(u,"CursorClick",h);let m=t.selectedControl;t.selectedControl=u.kind==="button"?u:null,m&&m!==t.selectedControl&&Zr(t,m)}ca(t,u,!1)}return t.pointerDownControl=null,t.pointerDownPosition=null,t.pointerLastPosition={x:o,y:s},t.pointerDragging=!1,t.pointerScroll=null,f}if(e==="click")return Qr(t,"down",o,s,{silent:!0}),Qr(t,"up",o,s,{silent:!0});throw new Error(`unknown pointer type ${e}`)}function va(t,e,i,r){if(!t?.server)throw new Error("play session has no server");return wi(t,{kind:"serverSet",payload:{entityType:e,name:i,value:r,playerIndex:t.viewPlayerIndex}}),t.server.setVar(e,i,r,{playerIndex:t.viewPlayerIndex})}function Kc(t,e,i){if(!t?.server)throw new Error("play session has no server");let r=t.server.getVar(e,i,{playerIndex:t.viewPlayerIndex});return r===void 0?null:r}function ba(t,e,i=[],r="PlayerSelf"){if(!t?.server)throw new Error("play session has no server");return wi(t,{kind:"serverSend",payload:{name:e,params:i,target:r,playerIndex:t.viewPlayerIndex}}),t.server.sendToClient(e,i,{target:r,playerIndex:t.viewPlayerIndex})}function vo(t){return{snapshot:e=>pa(t,e),step:e=>yo(t,e),pointer:(e,i,r,n)=>Qr(t,e,i,r,n),key:e=>ma(t,e),click:e=>ga(t,e),view:e=>da(t,e),pause:()=>{wi(t,{kind:"pause",payload:{}}),t.debugPaused=!0},resume:()=>{wi(t,{kind:"resume",payload:{}}),t.debugPaused=!1},serverSet:(e,i,r)=>va(t,e,i,r),serverSend:(e,i,r)=>ba(t,e,i,r)}}function wa(t){t?.server&&t.server.destroy();let e=t?.runtimes||(t?.runtime?[t.runtime]:[]);for(let i of e)i.destroy()}function Sa(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Wc(t,e){for(let i of t||[])e(i),i.children?.length&&Wc(i.children,e)}function xa(t,{id:e,name:i}){let r=null;return Wc(t,n=>{r||(e&&String(n.id)===String(e)||!e&&i&&n.name===i)&&(r=n)}),r}function Wm(t,e){if(t){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];if(t.box&&Object.prototype.hasOwnProperty.call(t.box,e))return t.box[e]}}function Jm(t){return{var(e,i){return t.server?.vars?.[e]?.[i]?.value??null},logs(){return(t.logs||[]).map(e=>e.text)},logContains(e){return(t.logs||[]).some(i=>String(i.text||"").includes(String(e)))},serverLogs(){return(t.server?.logs||t.serverLogs||[]).map(e=>e.text)},serverLogContains(e){return(t.server?.logs||t.serverLogs||[]).some(i=>String(i.text||"").includes(String(e)))},control(e){let i=xa(t.tree,{name:String(e)});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(e){let i=e==="outbound"?"outbound":"inbound";return(t.server?.[i]||[]).map(r=>({name:r.name,values:r.values}))}}}function Zm(t,e){if(t.kind==="log"){let i=t.source==="server"?e.server?.logs||e.serverLogs||[]:e.logs||[];return i.some(n=>t.level&&n.level!==t.level?!1:String(n.text||"").includes(t.contains))?{ok:!0,actual:t.contains}:{ok:!1,actual:i.map(n=>n.text).slice(-8),expected:t.contains}}if(t.kind==="control"){let i=xa(e.tree,t);if(!i)return{ok:!1,actual:null,expected:t.equals,message:`control not found: ${t.id||t.name}`};let r=Wm(i,t.field);return Sa(r,t.equals)?{ok:!0,actual:r}:{ok:!1,actual:r,expected:t.equals}}if(t.kind==="var"){let i=e.server?.vars?.[t.entityType],n=!i||!Object.prototype.hasOwnProperty.call(i,t.name)?null:i[t.name].value;return Sa(n,t.equals)?{ok:!0,actual:n}:{ok:!1,actual:n,expected:t.equals}}if(t.kind==="signal"){let i=t.direction==="outbound"?e.server?.outbound||[]:e.server?.inbound||[],r=i.find(n=>n.name===t.name&&(t.values===void 0||Sa(n.values,t.values)));return r?{ok:!0,actual:r.values}:{ok:!1,actual:i.map(n=>({name:n.name,values:n.values})),expected:{name:t.name,values:t.values??null}}}if(t.kind==="tree"){let i=!!xa(e.tree,{name:t.name});return i===t.exists?{ok:!0,actual:i}:{ok:!1,actual:i,expected:t.exists}}return{ok:!1,message:`unsupported assert kind ${t.kind}`}}function Qm(t,e){let i=Yr();try{return i.evalQueryScript(t,Jm(e)),{ok:!0,actual:!0}}catch(r){return{ok:!1,message:r?.message||String(r)}}finally{i.destroy()}}function Jc(t,e){return t.kind==="lua"?Qm(t.source,e):Zm(t,e)}function eg(t,e){let i=e>0?e:Vi;return Math.round((t+i)*1e9)/1e9}function tg(t,e){let i=e.payload||{};if(e.kind==="pointer")t.pointer(i.type,i.x,i.y,i);else if(e.kind==="key")t.key(i.typeName);else if(e.kind==="click")t.click(i.name);else if(e.kind==="pause")t.pause();else if(e.kind==="resume")t.resume();else if(e.kind==="serverSet")t.serverSet(i.entityType,i.name,i.value);else if(e.kind==="serverSend")t.serverSend(i.name,i.params,i.target);else if(e.kind==="view")t.view(i.playerIndex);else throw new Error(`unsupported event kind: ${e.kind}`)}function ig(t,e){let i=Jc(t,e);return{kind:t.kind,at:Number(t.at||0),ok:!!i.ok,actual:i.actual??null,expected:i.expected??null,message:i.message||""}}function Zc(t,e){let i=Jr(e),r=i.events.slice().sort((x,I)=>x.t-I.t),n=i.asserts.slice(),o=i.dt||Vi,s=r.reduce((x,I)=>Math.max(x,I.t),0),a=n.reduce((x,I)=>Math.max(x,Number(I.at||0)),0),l=Math.max(s,a),u=0,f=[],h=0,m=n.some(x=>x.kind==="control"||x.kind==="tree"||x.kind==="lua"),p=t.snapshot({inspect:m}),g=()=>{for(;u<r.length&&r[u].t<=h+1e-9;)tg(t,r[u]),u+=1,p=t.snapshot({inspect:m})},b=()=>{for(let x of n)if(!x._done&&Number(x.at||0)<=h+1e-9){let I=ig(x,p);if(f.push(I),x._done=!0,!I.ok)return{passed:!1,failedAt:h,frame:p.frame||0,results:f,snapshot:p}}return null};g();let w=b();if(w)return _a(i,w);for(;h+1e-9<l;){t.step(o),h=eg(h,o),p=t.snapshot({inspect:m}),g();let x=b();if(x)return _a(i,x)}return _a(i,{passed:f.every(x=>x.ok),failedAt:null,frame:p.frame||0,results:f,snapshot:p})}function _a(t,e){return oe({format:t.format,name:t.name,passed:e.passed,failedAt:e.failedAt,frame:e.frame,results:e.results,snapshot:{time:e.snapshot?.time??0,frame:e.snapshot?.frame??0,logs:e.snapshot?.logs||[],serverLogs:e.snapshot?.serverLogs||e.snapshot?.server?.logs||[],server:e.snapshot?.server||{vars:{},inbound:[],outbound:[],logs:[]}}})}function Ia(t){return Array.isArray(t)?t.slice():[]}import{createHash as rg}from"node:crypto";var Qc=t=>rg("sha256").update(JSON.stringify(t.map(({id:e,path:i,source:r})=>({id:e,path:i,source:r})))).digest("hex");var fg={Level:"\u5173\u5361",PlayerSelf:"\u5F53\u524D\u73A9\u5BB6",AvatarSelf:"\u5F53\u524D\u89D2\u8272",...Object.fromEntries(qi.map((t,e)=>[t,`\u73A9\u5BB6${e+1}`])),...Object.fromEntries(Array.from({length:8},(t,e)=>[`Avatar${e+1}`,`\u89D2\u8272${e+1}`]))};function cg(t,e=1){let i=t?.vars||{},r=[],n=Number(e)>0?Number(e):1,o=["Level","PlayerSelf","AvatarSelf"];if(n>1)for(let a=1;a<=n;a+=1)o.push(`Player${a}`,`Avatar${a}`);let s=new Set;for(let a of o){if(s.has(a)||!i[a])continue;s.add(a);let l=i[a]||{};for(let u of Object.keys(l))r.push(oe({entityType:a,entityLabel:fg[a]||a,name:u,type:l[u]?.type||"",value:l[u]?.value??null}))}return r}var ji="qxqy-simulator-save",dg="qxqy-simulator-scripts",qe="server-control-template",fe="client-control-template",Ca={[qe]:"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F",[fe]:"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F"};function Li(t){return t===fe?"client":"server"}function rd(t){if(!(typeof t=="number"||typeof t=="string"&&/^\d+$/.test(t.trim()))||!lt(t))throw new Error(`\u63A7\u4EF6\u7D22\u5F15\u5FC5\u987B\u662F ${1073741824}\u2013${1077936127}\uFF080x40000000\u20130x403FFFFF\uFF09\u8303\u56F4\u5185\u7684\u6574\u6570`);return Number(t)}function bo(t){let e=typeof t=="number"||typeof t=="string"&&/^\d+$/.test(t.trim()),i=Number(t);if(!e||!Lt(i))throw new Error("\u63A7\u4EF6\u7D22\u5F15\u5FC5\u987B\u662F 1\u20132147483647 \u8303\u56F4\u5185\u7684\u6574\u6570");return i}function Ea(t=[]){if(!Array.isArray(t))throw new Error("controlGuidChanges \u5FC5\u987B\u662F\u6570\u7EC4");let e=new Set;return t.map(i=>{if(!i||typeof i.id!="string"||!i.id||e.has(i.id)||![qe,fe].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(e.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:bo(i.oldGuid),newGuid:bo(i.newGuid),...i.batchId?{batchId:i.batchId}:{},...i.scriptSignature?{scriptSignature:i.scriptSignature}:{}}})}function hg(t){let e=[t?.guid,t?.id];for(let i of e){let r=Number(i);if(Lt(r))return r}return 0}function wo(t){let e=String(t?.controlAsset||""),i=hg(t);return{id:String(i||t?.id||""),guid:i,path:String(t?.path||""),source:String(t?.source||""),controlId:String(t?.controlId||""),controlAsset:e===fe||e==="client"?fe:e===qe||e==="server"?qe:""}}function pg(t){let e=[],i=(r,n="")=>{if(r&&(r.path||r.source)){let o=wo(r);e.push(n?{...o,controlAsset:n}:o)}};if(Array.isArray(t?.assets?.scripts)){for(let r of t.assets.scripts)r&&(r.path||r.source)&&e.push(wo(r));return e}if(i(t?.assets?.server?.script,qe),i(t?.assets?.client?.script,fe),t&&t.format!==ji){i(t?.script);for(let r of t?.scripts||[])i(r)}return e}function ka(t){return vi(t===fe?Zi():ki())}var mg="\u672A\u7ED1\u5B9A",br="\u672A\u547D\u540D\u5B58\u6863",gg="\u672A\u547D\u540D\u754C\u9762";function yg(t){let e=t;for(let i=0;i<8;i++){if(en(td(e,"simulator","studio"))&&en(td(e,"lua")))return e;let r=lg(e);if(r===e)break;e=r}return t}function vg(t){return t?{name:wr(t),path:t,bound:!0}:{name:mg,path:"",bound:!1}}function bg(t,e=process.cwd()){if(ug(t)&&en(t))return t;let i=e||process.cwd(),r=yg(i),n=id(r,t);if(en(n))return n;let o=id(i,t);if(en(o))return o;throw new Error("script file not found: "+t)}function Aa(t,e={}){t?.format===ji&&Vs(t.version);let i=[],r=typeof e.workspacePath=="string"&&e.workspacePath?e.workspacePath:"",n=t?.format===ji&&t.assets,o=Ea(t?.controlGuidChanges),s=So(t?.scriptSync),a=n?null:vi(t,{warnings:i}),l={server:n&&t.assets.server?vi(t.assets.server,{warnings:i}):ka(qe),client:n&&t.assets.client?vi(t.assets.client,{warnings:i}):ka(fe)};a&&(l[Li(a.meta.assetType)]=a);let u=n&&t.activeAssetType===fe?fe:a?.meta.assetType||qe,f=n&&t.meta?.name?String(t.meta.name):"",h=()=>f||br;!t?.meta?.name&&l.server.meta.name==="\u672A\u547D\u540D\u754C\u9762\u63A7\u4EF6\u7EC4"&&(l.server.meta.name=gg);let m=[],p=new Set;function g(){p.clear(),Ji(l.server.root,p),Ji(l.client.root,p,{skipServerContainer:!0});for(let v of m)Lt(v.guid)&&p.add(Number(v.guid))}function b(v=0){g();let k=Lt(v)&&!p.has(Number(v))?Number(v):ri(p);return p.add(k),k}function w(v){let k=wo(v),R=b(k.guid);return{...k,guid:R,id:String(R)}}A(pg(t));let x=Wr(t?.serverLogic),I=null,$="",C=1,D=1;function G(v){let k=String(v||"").trim();if(!k)return"";if(!Te[k])throw new Error(`unknown canvas preset: ${k} (available: ${Object.keys(Te).join(", ")})`);return k}let Y=()=>l[Li(u)];function B(v){if(!v)return null;for(let[k,R]of[["server",l.server],["client",l.client]]){let V=je(R.root,v);if(V&&V.kind!=="server-container")return{key:k,node:V}}return null}function _(v){if(!v.controlId)return null;let k=v.controlAsset===fe?"client":v.controlAsset===qe?"server":null;if(k){let R=je(l[k].root,v.controlId);return R&&R.kind!=="server-container"?{key:k,node:R}:null}return B(v.controlId)}function O(){for(let v of m)v.controlId&&!_(v)&&(v.controlId="",v.controlAsset="")}function y(v){if(!Lt(v))return null;for(let[k,R]of[[qe,l.server],[fe,l.client]]){let V="";if(ke(R.root,U=>{!V&&(U.scriptMappingIds||[]).includes(Number(v))&&(V=U.id)}),V)return{controlId:V,controlAsset:k}}return null}function N(v,k,R){let V=l[Li(v.controlAsset)],U=V&&je(V.root,v.controlId);U&&(U.scriptMappingIds=(U.scriptMappingIds||[]).map(X=>Number(X)===Number(k)?Number(R):X))}O();function E(){return m.map(v=>{let k=_(v),R=k?k.key==="client"?fe:qe:"";return oe({id:v.id,guid:v.guid||0,path:v.path||"",source:v.source||"",controlId:v.controlId||"",controlAsset:v.controlAsset||R,controlName:k?.node.name||"",assetType:R,assetLabel:k?Ca[R]:"",mounted:!!k})})}function c(){let v=[],k=(R,V)=>{ke(R.root,U=>{U.kind!=="server-container"&&v.push(oe({id:U.id,name:U.name,kind:U.kind,assetType:V,assetLabel:Ca[V]}))})};return k(l.server,qe),k(l.client,fe),v}function S(v){let k=[];return ke(v.root,R=>{R.kind!=="server-container"&&k.push(JSON.stringify({kind:R.kind,guid:R.guid,name:R.name,text:R.text??null,imageId:R.imageId??null,imageSource:R.imageSource??null,imageType:R.imageType??null,fontSize:R.fontSize??null,adaptiveFontSize:R.adaptiveFontSize??null,minimumFontSize:R.minimumFontSize??null,fontColor:R.fontColor??null,bgColor:R.bgColor??null,imageColor:R.imageColor??null,fillType:R.fillType??null,fillAmount:R.fillAmount??null,syncAllDevices:R.syncAllDevices!==!1,transformByPlatform:R.transformByPlatform||null}))}),k.join("/")}let M=S(Zi()),j=S(ki());function H(v){let k=S(v);return v.meta?.assetType===fe?k===M:k===j}function Q(v,k){return String(v||"").replace(/[\\/:*?"<>|]/g,"-").trim()||k}function ce(v){let k=Q(h(),br),R=v.meta?.assetType===fe?"\u5BA2\u6237\u7AEF\u63A7\u4EF6\u6A21\u677F":"\u670D\u52A1\u5668\u63A7\u4EF6\u6A21\u677F";return`${k} \xB7 ${R}`}function ve(){if(!((l.server.root.children||[]).find(k=>k.kind==="container")||l.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 Mf(l.server,l.client,{scripts:m,fileName:`${Q(h(),br)} \xB7 \u6574\u5408\u5305.gia`})}function be(){let v=k=>({type:k.meta.assetType,name:k.meta.name,sourceFile:k.meta.sourceFile||""});return{format:ji,name:h(),activeAssetType:u,assets:{server:v(l.server),client:v(l.client),scripts:E()}}}function me(){return oe({format:ji,version:4,meta:{name:h()},activeAssetType:u,serverLogic:x,controlGuidChanges:o,scriptSync:s,assets:{server:l.server,client:l.client,scripts:m.map(v=>oe({id:v.id,guid:v.guid||0,path:v.path||"",source:v.source||"",controlId:v.controlId||"",controlAsset:v.controlAsset||""}))}})}function ee(){let v=Y(),k=Wf(v);if(k.workspace=vg(r),k.save=be(),k.scripts=E(),k.mountTargets=c(),k.serverLogic=x,k.migrationWarnings=[...i],k.controlGuidChanges=oe(o),u===fe){let R=dr(v,!0);k.clientGuidAutofill={count:R.length,templateCount:R.filter(({parent:V})=>V?.kind==="server-container").length,selectedOffset:R.findIndex(({node:V})=>V.id===k.selectedId)}}return k.scriptSync=oe(s),Ba(k),k}function ue(v){let k=Y();if(v.expectedRevision!==void 0&&Number(v.expectedRevision)!==k.version)throw new Error(`revision conflict: expected ${v.expectedRevision}, current ${k.version}`);return k}function Se(v,k,R=""){let V=String(k||"");if(V){let U=R===fe?fe:R===qe?qe:"";if(!_({controlId:V,controlAsset:U}))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");v.controlAsset=U}else v.controlAsset="";v.controlId=V}function ht(v){let k=ue(v);if(v.op==="addScript"){let R=w({path:String(v.path||""),source:String(v.source||""),controlId:"",controlAsset:""});v.controlId!==void 0&&v.controlId!==""&&Se(R,v.controlId,v.controlAsset),m.push(R)}else if(v.op==="updateScript"){let R=m.find(V=>V.id===v.id);if(!R)throw new Error(`\u811A\u672C\u4E0D\u5B58\u5728: ${v.id}`);v.controlId!==void 0&&Se(R,v.controlId,v.controlAsset),v.path!==void 0&&(R.path=String(v.path)),v.source!==void 0&&(R.source=String(v.source))}else if(v.op==="removeScript"){let R=m.length;if(m=m.filter(V=>V.id!==v.id),m.length===R)throw new Error(`\u811A\u672C\u4E0D\u5B58\u5728: ${v.id}`)}return k.version+=1,ee()}function Gt(v){let k=ue(v),R=je(k.root,v.id??k.selectedId);if(!R||R.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 V=rd(v.guid);if(bo(R.guid),v.autoFillClientGuids!==void 0&&typeof v.autoFillClientGuids!="boolean")throw new Error("autoFillClientGuids \u5FC5\u987B\u662F\u5E03\u5C14\u503C");let U=v.autoFillClientGuids===!0;if(U&&u!==fe)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 X=U?dr(k,!0).map(({node:Z})=>Z):[R],he=V-X.indexOf(R),xe=X.map((Z,Pe)=>({node:Z,oldGuid:bo(Z.guid),newGuid:rd(he+Pe)})),qt=xe.filter(({oldGuid:Z,newGuid:Pe})=>Z!==Pe);if(!qt.length)return ee();let Ne=new Map(xe.map(({oldGuid:Z,newGuid:Pe})=>[Z,Pe]));if(Ne.size!==xe.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 ei=new Set(X),Ke=[];for(let Z of Object.values(l))ke(Z.root,Pe=>{Z===l.client&&Pe.kind==="server-container"||Ke.push({node:Pe,project:Z})});let xi=new Map([...Ke.filter(Z=>!ei.has(Z.node)).map(({node:Z})=>[Number(Z.guid),Z.name]),...m.map(Z=>[Number(Z.guid),Z.path||"Lua \u811A\u672C"])]);for(let{newGuid:Z}of qt)if(xi.has(Z))throw new Error(`\u63A7\u4EF6\u7D22\u5F15 ${Z} \u5DF2\u88AB\u300C${xi.get(Z)}\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 At=[],Ee=(Z,Pe,Bt)=>{let mt=Z?.[Pe];(typeof mt=="number"||typeof mt=="string"&&/^\d+$/.test(mt.trim()))&&Ne.has(Number(mt))&&Ne.get(Number(mt))!==Number(mt)&&At.push({owner:Z,key:Pe,project:Bt.project,oldGuid:Number(mt),newGuid:Ne.get(Number(mt))})};for(let Z of Ke)Ee(Z.node,"referencedPrefabId",Z),Ee(Z.node,"itemPrefabId",Z),Ee(Z.node.giaRaw,"templateRefSlot",Z);let We=new Map;for(let{node:Z}of Ke)We.set(Number(Z.guid),(We.get(Number(Z.guid))||0)+1);for(let{oldGuid:Z}of At)if(We.get(Z)!==1)throw new Error(`\u65E7\u7D22\u5F15 ${Z} \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 xr=U?ed():"",Je=Qc(m);for(let{node:Z,oldGuid:Pe,newGuid:Bt}of qt)Z.guid=Bt,o.push({id:ed(),controlAsset:u,controlId:Z.id,controlName:Z.name,oldGuid:Pe,newGuid:Bt,scriptSignature:Je,...xr?{batchId:xr}:{}});let nn=new Set([k]);for(let{owner:Z,key:Pe,project:Bt,newGuid:mt}of At)Z[Pe]=typeof Z[Pe]=="string"?String(mt):mt,nn.add(Bt);for(let Z of nn)Z.version+=1;return ee()}function Oe(v){let k=ue(v);if(!Array.isArray(v.changeIds)||!v.changeIds.length||v.changeIds.some(V=>typeof V!="string"||!o.some(U=>U.id===V)))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 R=new Set(v.changeIds);return o=o.filter(V=>!R.has(V.id)),k.version+=1,ee()}function at(v){if(!v||typeof v!="object")throw new Error("patch requires op");if(v.op==="setScriptSync"){let k=ue(v);return s=So(v.config),k.version+=1,ee()}if(v.op==="setControlGuid")return Gt(v);if(v.op==="acknowledgeControlGuidChanges")return Oe(v);if(v.op==="setServerLogic"){let k=ue(v);return x=Wr(v.logic),k.version+=1,ee()}if(v.op==="addScript"||v.op==="updateScript"||v.op==="removeScript")return ht(v);if(v.op==="selectAsset")return u=v.assetType===fe?fe:qe,ee();if(v.op==="renameSave"){let k=String(v.name||"").trim();if(!k)throw new Error("\u5B58\u6863\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");return f=k,ee()}if(v.op==="newAsset"){let k=ue(v);u=v.assetType===fe?fe:qe;let R=ka(u);return R.version=k.version+1,l[Li(u)]=R,o=o.filter(V=>V.controlAsset!==u),O(),ee()}return Us(Y(),v),O(),ee()}function pt(v){return m.filter(k=>{let R=_(k);return!!(R&&R.key==="client"==(v===fe))})}function de(v="json",k=""){let R=T(v,k);if(o.length&&!["save","archive"].includes(String(v).toLowerCase())){let V=o.map(U=>`\u63A7\u4EF6\u7D22\u5F15\u5F85\u6838\u5BF9 Lua \u5F15\u7528\uFF1A${Ca[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`);R.warnings=[...new Set([...R.warnings||[],...V])]}return R}function T(v="json",k=""){let R=String(v).toLowerCase();if(R==="save"||R==="archive"){let X=Buffer.from(JSON.stringify(me(),null,2),"utf8");return oe({filename:`${h().replace(/[\\/:*?"<>|]/g,"-")} \xB7 \u8D44\u4EA7\u5305.json`,mimeType:"application/json",encoding:"base64",data:X.toString("base64"),warnings:[]})}if(R==="save-gia"||R==="archive-gia"){let X=[],he=[],xe=(Ne,ei="")=>{let Ke=de(Ne,ei);X.push(oe({filename:Ke.filename,mimeType:Ke.mimeType,encoding:Ke.encoding,data:Ke.data,warnings:Ke.warnings||[]})),he.push(...Ke.warnings||[])},qt=(Ne,ei)=>{let Ke=l[Li(Ne)],xi=Ne===u,At=m.some(Ee=>Ee.controlAsset===Ne&&Ee.controlId);if(!xi&&H(Ke)&&!At){he.push(ei);return}xe("gia",Ne)};if(qt(qe,"\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"),qt(fe,"\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"),m.some(Ne=>Ne.path||Ne.source)&&xe("scripts-gia"),!X.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 oe({format:"qxqy-gia-package",files:X,warnings:[...new Set(he)]})}if(R==="gia-combined"||R==="combined-gia"||R==="combined"){let X=ve();return oe({filename:`${Q(h(),br)} \xB7 \u6574\u5408\u5305.gia`,mimeType:"application/octet-stream",encoding:"base64",data:X.buffer.toString("base64"),warnings:[...new Set(X.warnings||[])]})}if(R==="scripts"){let X=oe({format:dg,version:1,scripts:m.map(xe=>oe({id:xe.id,guid:xe.guid||0,path:xe.path||"",source:xe.source||"",controlId:xe.controlId||"",controlAsset:xe.controlAsset||""}))}),he=Buffer.from(JSON.stringify(X,null,2),"utf8");return oe({filename:`${Q(h(),br)} \xB7 \u811A\u672C.json`,mimeType:"application/json",encoding:"base64",data:he.toString("base64"),warnings:[]})}if(R==="scripts-gia"||R==="scriptsgia"){let X=$f(m);return oe({filename:`${Q(h(),br)} \xB7 \u811A\u672C.gia`,mimeType:"application/octet-stream",encoding:"base64",data:X.buffer.toString("base64"),warnings:X.warnings})}if(R==="lua"){let X=m.find(xe=>xe.id===k)||m.find(xe=>xe.path===k);if(!X)throw new Error("\u6CA1\u6709\u53EF\u5BFC\u51FA\u7684 Lua \u811A\u672C\uFF0C\u8BF7\u5148\u5728\u201CLua \u811A\u672C\u201D\u9875\u521B\u5EFA");let he=wr(X.path||"")||`qxqy-script-${X.id}`;return oe({filename:/\.lua$/i.test(he)?he:`${he}.lua`,mimeType:"text/x-lua",encoding:"base64",data:Buffer.from(X.source||"","utf8").toString("base64"),warnings:[]})}let V=k?l[Li(k)]:Y(),U=ce(V);if(R==="json"){let X=oe({...V,scripts:pt(V.meta.assetType),controlGuidChanges:o.filter(xe=>xe.controlAsset===V.meta.assetType)}),he=Buffer.from(JSON.stringify(X,null,2),"utf8");return oe({filename:`${U}.json`,mimeType:"application/json",encoding:"base64",data:he.toString("base64"),warnings:[]})}if(R==="gia"){let X=Ff(V,V.meta.assetType===fe?{scripts:pt(fe)}:{}),he=V.meta.assetType===fe?[]:pt(qe);return he.length&&X.warnings.unshift(`\u5F53\u524D\u670D\u52A1\u5668\u63A7\u4EF6 GIA \u4E0D\u5305\u542B ${he.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`),oe({filename:`${U}.gia`,mimeType:"application/octet-stream",encoding:"base64",data:X.buffer.toString("base64"),warnings:X.warnings})}throw new Error(`unsupported export format: ${v}`)}function A(v){for(let k of v){let R=wo(k);if(!R.path&&!R.source)continue;let V=R.controlId?null:y(R.guid),U=w(V?{...R,...V}:R);V&&U.guid!==R.guid&&N(V,R.guid,U.guid),U.controlId&&!_(U)&&(U.controlId="",U.controlAsset=""),m.push(U)}}function P(v,k,R=""){let V=String(v||"").toLowerCase();if(typeof k!="string"||!k)throw new Error("import data is required");let U=Buffer.from(k,"base64"),X,he=[],xe={},qt=[];if(V==="json"){try{X=JSON.parse(U.toString("utf8"))}catch{throw new Error("JSON \u6587\u4EF6\u65E0\u6548")}if(X?.project&&(X=X.project),X?.format===ji&&X?.assets){Vs(X.version);let Ee=Aa(X);he.push(...Ee.get().migrationWarnings);let We=Ee.archiveData();return l.server=We.assets.server,l.client=We.assets.client,i=[...he],u=X.activeAssetType===fe?fe:qe,f=String(X.meta?.name||wr(R).replace(/\.json$/i,"")||f),x=We.serverLogic,m=We.assets.scripts,o=We.controlGuidChanges,s=We.scriptSync,p.clear(),oe({snapshot:ee(),warnings:he,metadata:{format:ji}})}}else{if(V==="lua")return m.push(w({path:wr(R||"imported.lua"),source:U.toString("utf8"),controlId:""})),oe({snapshot:ee(),warnings:he,metadata:{assetType:"lua-script"}});if(V==="gia"){if(Gf(U)){let Je=Bf(U);return A(Je.scripts),oe({snapshot:ee(),warnings:Je.warnings,metadata:Je.metadata})}let Ee=Vf(U);X=Ee.project,he=Ee.warnings,xe=Ee.metadata,Ee.clientProject&&(l.client=vi(Ee.clientProject),o=o.filter(Je=>Je.controlAsset!==fe),he.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 We=new Map,xr=(Je,nn)=>{Je&&ke(Je.root,Z=>{for(let Pe of Z.scriptMappingIds||[]){let Bt=We.get(Number(Pe));if(Bt){he.push(`\u811A\u672C GUID ${Pe} \u540C\u65F6\u6302\u8F7D\u5230\u591A\u4E2A\u63A7\u4EF6\uFF0C\u5DF2\u4FDD\u7559\u201C${Bt.controlAsset===qe?"\u670D\u52A1\u7AEF":"\u5BA2\u6237\u7AEF"}\u201D\u76EE\u6807\u3002`);continue}We.set(Number(Pe),{controlId:Z.id,controlAsset:nn})}})};xr(Ee.project,Ee.project.meta.assetType),xr(Ee.clientProject,fe),qt=(Ee.scripts||[]).map(Je=>We.has(Number(Je.guid))?{...Je,...We.get(Number(Je.guid))}:Je)}else throw new Error(`unsupported import format: ${v}`)}let Ne=vi(X,{warnings:he}),ei=Ea(X?.controlGuidChanges);if(ei.some(Ee=>Ee.controlAsset!==Ne.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 Ke=Ea([...o.filter(Ee=>Ee.controlAsset!==Ne.meta.assetType),...ei]);i=[...he];let xi=Li(Ne.meta.assetType);l[xi]=Ne,o=Ke,u=Ne.meta.assetType;let At=l[xi];return R&&(At.meta.name=wr(R).replace(/\.(json|gia)$/i,"")||At.meta.name,At.meta.sourceFile=wr(R),At.meta.sourceFormat=V),A(qt),A(X?.scripts||[]),X?.script&&(X.script.path||X.script.source)&&A([X.script]),oe({snapshot:ee(),warnings:he,metadata:xe})}function F(v,k){return Us(Y(),{op:"pick",x:v,y:k}),ee()}function L(v){let k=typeof v=="string"&&v?v:"";!k||k===r||(r=k)}function J(v){let k=v.source||"";if(!k.trim()&&v.path.trim())try{k=ag(bg(v.path,r),"utf8")}catch(R){throw new Error(`\u811A\u672C ${v.path} \u8BFB\u53D6\u5931\u8D25: ${R?.message||R}`)}return k}function re(v={}){let k=G(v.canvasId);k&&($=k),v.playerCount!==void 0&&v.playerCount!==null&&v.playerCount!==""&&(C=Gi(v.playerCount),D>C&&(D=1)),v.viewPlayerIndex!==void 0&&v.viewPlayerIndex!==null&&v.viewPlayerIndex!==""&&(D=Zt(v.viewPlayerIndex,C)),I&&wa(I);let R=m.map(U=>{try{return{id:U.id,guid:U.guid||0,path:U.path||U.id,source:J(U),controlId:U.controlId||"",controlAsset:U.controlAsset||""}}catch(X){return{id:U.id,guid:U.guid||0,path:U.path||U.id,source:`error([==[ ${String(X.message).replace(/]=+]/g,"] =]")} ])`,controlId:U.controlId||"",controlAsset:U.controlAsset||""}}}),V=U=>R.filter(X=>{let he={controlId:X.controlId,controlAsset:X.controlAsset},xe=X.controlId?_(he):null;return!!(xe&&xe.key===U)});return I=qc(l.server,{templatesProject:l.client,scripts:R,sceneScripts:V("server"),templateScripts:V("client"),serverConfig:{logic:x},canvasId:$,playerCount:C,viewPlayerIndex:D,language:v.language||""}),ie(v)}function ne(v,k={}){let R=G(v);if(!R)throw new Error("playSetCanvas requires canvasId");return re({...k,canvasId:R})}function ie(v={}){if(!I)return oe({running:!1,tree:[],logs:[],serverLogs:[],serverVars:[]});let k=pa(I,v);return k.running=!0,k.logs=Ia(k.logs),k.serverLogs=Ia(k.server?.logs||[]),k.serverVars=cg(k.server,k.playerCount||1),k}function Fe(v,k={}){return I||re(),yo(I,v),k.observe===!1?oe({running:!0,time:I.runtime.clock.time,frame:I.runtime.clock.frame,paused:!!I.debugPaused,levelTimePaused:!!I.runtime.clock.paused,playerCount:I.playerCount||1,viewPlayerIndex:I.viewPlayerIndex||1}):ie(k)}function Re(v=0){re();let k=Math.max(0,Number(v)||0);for(let R=0;R<k;R++)yo(I,1/30);return ie()}function kt(){return I&&wa(I),I=null,$="",C=1,D=1,oe({running:!1,tree:[],logs:[],serverLogs:[],serverVars:[]})}function nd(v,k={}){let R=Sr();return D=da(R,v),k.observe===!1?null:ie(k)}function od(v,k={}){if(!I)throw new Error("play session has not started");return ma(I,v),k.observe===!1?null:ie(k)}function sd(v,k={}){if(!I)throw new Error("play session has not started");return ga(I,v),k.observe===!1?null:ie(k)}function ad(v,k,R,V={}){if(!I)throw new Error("play session has not started");return Qr(I,v,k,R,V),V.observe===!1?null:ie(V)}function ld(v={}){return I&&vo(I).pause(),v.observe===!1?null:ie(v)}function ud(v={}){return I&&vo(I).resume(),v.observe===!1?null:ie(v)}function Sr(){if(!I)throw new Error("play session has not started");return I}function fd(v,k){let R=Sr();if(!v&&!k){let V=ie();return oe({vars:V.serverVars||[]})}return oe({entityType:String(v||""),name:String(k||""),value:Kc(R,v,k)})}function cd(v,k,R){let V=Sr();return va(V,v,k,R),ie()}function dd(v,k=[],R="PlayerSelf"){let V=Sr();return ba(V,v,k,R),ie()}function hd(){let v=ie();return oe({events:v.history||[],case:Oc(v.history||[],{playerCount:v.playerCount||1})})}function pd(v={}){let k=ie(),R=Jr({name:v.name||"",dt:v.dt,playerCount:v.playerCount||k.playerCount||1,events:v.events||k.history||[],asserts:v.asserts||[]});return oe(R)}function md(v,k={}){let R=Jr(v);re({...k,playerCount:k.playerCount||R.playerCount||1});let V=Sr();V.recording=!1;try{return Zc(vo(V),v)}finally{V.recording=!0}}function gd(){if(!I)return{running:!1,paused:!1,time:0,frame:0,playerCount:1,viewPlayerIndex:1};let v=I.runtime.clock;return{running:!0,paused:!!I.debugPaused,levelTimePaused:!!v.paused,time:v.time,frame:v.frame,playerCount:I.playerCount||1,viewPlayerIndex:I.viewPlayerIndex||1}}let Na={get:ee,patch:at,setWorkspace:L,exportData:de,importData:P,pick:F,playStart:re,playSetCanvas:ne,playSetView:nd,playGet:ie,playStatus:gd,playStep:Fe,playRun:Re,playStop:kt,playKey:od,playClick:sd,playPointer:ad,playPause:ld,playResume:ud,playServerGet:fd,playServerSet:cd,playServerSend:dd,playHistory:hd,playSaveCase:pd,playRunCase:md,archiveData:me};return Object.defineProperty(Na,"_project",{enumerable:!1,get:Y}),Na}var ye=null,Ta=!1,Qt=0,$t=0,Ra="realtime",wg=33,tn=1/30,Sg=5;function rn(t={}){return{...t.inspect?{inspect:!0}:{},...t.view?{view:!0}:{},...t.paint?{paint:!0}:{},...t.compact?{compact:!0}:{},...t.sceneRev!==void 0&&t.sceneRev!==null?{sceneRev:t.sceneRev}:{}}}function xg(t={}){let e=rn(t);for(let i of["canvasId","playerCount","viewPlayerIndex","language"])t[i]!==void 0&&t[i]!==null&&t[i]!==""&&(e[i]=t[i]);return e}function Si(t={}){return t.light?{...ye.playStatus()}:ye.playGet(rn(t))}function _g(){if(!ye||Ta||Ra!=="realtime")return;let t=ye.playStatus();if(!t.running||t.paused){Qt=0,$t=0;return}let e=Date.now();if(!Qt){Qt=e;return}Ta=!0;try{$t+=Math.min(.25,Math.max(0,(e-Qt)/1e3)),Qt=e;let i=0;for(;$t>=tn&&i<Sg;)ye.playStep(tn,{observe:!1}),$t-=tn,i+=1;$t>tn&&($t=tn)}finally{Ta=!1}}var Ev=setInterval(_g,wg);function Ig(t,e={}){if(t==="start"){let i=e.clockMode??"realtime";if(i!=="manual"&&i!=="realtime")throw new Error("clockMode must be manual or realtime");return ye&&ye.playStop(),ye=Aa(e.archive||e.project,{workspacePath:e.workspacePath||""}),Ra=i,Qt=0,$t=0,ye.playStart(xg(e))}if(!ye)throw new Error("play session has not started");if(t==="get")return e.light?Si(e):ye.playGet(rn(e));if(t==="step"){let i=ye.playStep(e.dt,e.light?{observe:!1}:rn(e));return e.light?Si(e):i}if(t==="pointer")return ye.playPointer(e.type,e.x,e.y,{observe:!1,deltaX:e.deltaX,deltaY:e.deltaY}),Si(e);if(t==="key")return ye.playKey(e.key,{observe:!1}),Si(e);if(t==="click")return ye.playClick(e.name,{observe:!1}),Si(e);if(t==="pause")return ye.playPause({observe:!1}),Qt=0,$t=0,Si(e);if(t==="resume")return ye.playResume({observe:!1}),Qt=0,$t=0,Si(e);if(t==="device")return ye.playSetCanvas(e.canvasId,rn(e));if(t==="view")return ye.playSetView(e.playerIndex??e.viewPlayerIndex,{observe:!1}),Si(e);if(t==="serverGet")return ye.playServerGet(e.entityType,e.name);if(t==="serverSet")return ye.playServerSet(e.entityType,e.name,e.value);if(t==="serverSend")return ye.playServerSend(e.name,e.params||[],e.target||"PlayerSelf");if(t==="history")return ye.playHistory();if(t==="saveCase")return ye.playSaveCase(e.case||e);if(t==="runCase")return ye.playRunCase(e.case||e,{canvasId:e.canvasId,playerCount:e.playerCount,viewPlayerIndex:e.viewPlayerIndex});if(t==="stop"){let i=ye.playStop();return ye=null,Qt=0,$t=0,i}throw new Error(`unknown play action: ${t}`)}Oa.on("message",t=>{let{id:e,action:i,args:r={}}=t||{};try{let n=Ig(i,r),o=typeof n?.running=="boolean"?{...n,clockMode:Ra}:n;Oa.postMessage({id:e,ok:!0,value:o,error:null})}catch(n){Oa.postMessage({id:e,ok:!1,value:null,error:n?.message||String(n)})}});
|
|
124
|
+
/*! Bundled license information:
|
|
125
|
+
|
|
126
|
+
long/umd/index.js:
|
|
127
|
+
(**
|
|
128
|
+
* @license
|
|
129
|
+
* Copyright 2009 The Closure Library Authors
|
|
130
|
+
* Copyright 2020 Daniel Wirtz / The long.js Authors.
|
|
131
|
+
*
|
|
132
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
133
|
+
* you may not use this file except in compliance with the License.
|
|
134
|
+
* You may obtain a copy of the License at
|
|
135
|
+
*
|
|
136
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
137
|
+
*
|
|
138
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
139
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
140
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
141
|
+
* See the License for the specific language governing permissions and
|
|
142
|
+
* limitations under the License.
|
|
143
|
+
*
|
|
144
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
145
|
+
*)
|
|
146
|
+
*/
|