PageSourceSearch

https://we2-mainapp.web.app/assets/mapts.fbf95952.js

js we2-mainapp.web.app collected 2026-10-03 12:41:06 UTC 133,167 bytes, 1 lines download raw bytes

1import{_ as Rs,r as h,j as We,o as sl,bl as Vs,A as Rt,n as _,p as m,q as l,t as ot,X as J,F as K,bx as Ae,v as R,G as me,a9 as nt,a7 as V,s as z,w as U,a0 as we,T as ke,x as Bs,y as As,H as Rl,c0 as Ll,M as at,c1 as Sl,bk as ll,av as Gt,f as Ml,bz as rs,I as pe,P as ht,Y as Hs,Z as js,O as Ks,aO as el,bW as Cl}from"./index.0106ef4e.js";import{Q as Jt}from"./QSpinnerDots.52a06029.js";import{Q as tl}from"./QTooltip.019d9b19.js";import"./position-engine.f3e6e30c.js";import"./selection.bb4a1117.js";const El=["onTouchstart","onTouchmove","onTouchend","onTouchcancel"],Tl={__name:"GameCanvas",props:{localPlayer:{type:Object,required:!0},otherPlayers:{type:Object,default:()=>({})},mapId:{type:String,default:"office"},startX:{type:Number,default:816},startY:{type:Number,default:656},chatMessages:{type:Object,default:()=>({})},missionItems:{type:Array,default:()=>[]},speedBoost:{type:Boolean,default:!1},hintsEnabled:{type:Boolean,default:!1},sabotageActive:{type:Boolean,default:!1},fuseBoxPos:{type:Object,default:null},missionOpen:{type:Boolean,default:!1},isHost:{type:Boolean,default:!1},externalGhostPos:{type:Object,default:null},outfit:{type:Object,default:()=>({})}},emits:["positionUpdate","zoneEnter","zoneLeave","missionItemClick","fuseBoxClick","ghostCatch","ghostPosUpdate"],setup(q,{expose:ge,emit:le}){const k=q,t=32,T=50,A=40,ue=14,oe=150,n=Object.freeze({LOBBY:0,OFFICE:1,MTG1:2,MTG2:3,MGR:4,BREAK:5,WALL:6,DESK:7,MTG_TABLE:8,PLANT:9,WHITEBOARD:10,MACHINE:11,SOFA:12,SHELF:13,BORDER:14}),ae=new Set([n.WALL,n.DESK,n.MTG_TABLE,n.PLANT,n.WHITEBOARD,n.MACHINE,n.SOFA,n.SHELF,n.BORDER]),j=64,N=Math.round(j*331/626),Xe=4,mt="/images/mapts/Avatar/",Te={front_idle:{order:["legs_L","legs_R","arms_L","arms_R","torso_bottom","torso_top","head"],files:{head:"head/head_front.png",torso_top:"torso_top/torso_top_front.png",torso_bottom:"torso_bottom/torso_bottom_font_and_back.png",arms_L:"arms/arm_front_idle_L.png",arms_R:"arms/arm_front_idle_R.png",legs_L:"legs/legs_front_idle_L.png",legs_R:"legs/legs_front_idle_R.png"}},back_idle:{order:["head","torso_top","torso_bottom","arms_L","arms_R","legs_L","legs_R"],files:{head:"head/head_back.png",torso_top:"torso_top/torso_top_back.png",torso_bottom:"torso_bottom/torso_bottom_font_and_back.png",arms_L:"arms/arm_front_idle_L.png",arms_R:"arms/arm_front_idle_R.png",legs_L:"legs/legs_back_idle_L.png",legs_R:"legs/legs_back_idle_R.png"}},walk_front_step1:{order:["arms_R","legs_R","torso_top","head","torso_bottom","legs_L","arms_L"],files:{head:"head/head_front.png",torso_top:"torso_top/torso_top_front.png",torso_bottom:"torso_bottom/torso_bottom_font_and_back.png",arms_L:"arms/arm_front_walk_step1_L.png",arms_R:"arms/arm_front_walk_step1_R.png",legs_L:"legs/legs_front_walk_step1_L.png",legs_R:"legs/legs_front_walk_step1_R.png"}},walk_front_step2:{order:["arms_L","torso_top","head","legs_R","torso_bottom","legs_L","arms_R"],files:{head:"head/head_front.png",torso_top:"torso_top/torso_top_front.png",torso_bottom:"torso_bottom/torso_bottom_font_and_back.png",arms_L:"arms/arm_front_walk_step2_L.png",arms_R:"arms/arm_front_walk_step2_R.png",legs_L:"legs/legs_front_walk_step2_L.png",legs_R:"legs/legs_front_walk_step2_R.png"}},walk_back_step1:{order:["head","arms_L","arms_R","torso_top","legs_R","torso_bottom","legs_L"],files:{head:"head/head_back.png",torso_top:"torso_top/torso_top_back.png",torso_bottom:"torso_bottom/torso_bottom_font_and_back.png",arms_L:"arms/arm_back_walk_step1_L.png",arms_R:"arms/arm_back_walk_step1_R.png",legs_L:"legs/legs_back_walk_step1_L.png",legs_R:"legs/legs_back_walk_step1_R.png"}},walk_back_step2:{order:["head","arms_L","arms_R","torso_top","legs_L","torso_bottom","legs_R"],files:{head:"head/head_back.png",torso_top:"torso_top/torso_top_back.png",torso_bottom:"torso_bottom/torso_bottom_font_and_back.png",arms_L:"arms/arm_back_walk_step2_L.png",arms_R:"arms/arm_back_walk_step2_R.png",legs_L:"legs/legs_back_walk_step2_L.png",legs_R:"legs/legs_back_walk_step2_R.png"}},walk_L_idle:{order:["torso_bottom","head","torso_top","legs_L","legs_R","arms_L"],files:{head:"head/head_left.png",torso_top:"torso_top/torso_top_left.png",torso_bottom:"torso_bottom/torso_bottom_left.png",arms_L:"arms/arm_left_idle.png",legs_L:"legs/legs_left_idle_L.png",legs_R:"legs/legs_left_idle_R.png"}},walk_L_step1:{order:["head","torso_top","legs_L","torso_bottom","arms_R","legs_R","arms_L"],files:{head:"head/head_left.png",torso_top:"torso_top/torso_top_left.png",torso_bottom:"torso_bottom/torso_bottom_left.png",arms_L:"arms/arm_left_walk_step1_L.png",arms_R:"arms/arm_left_walk_step1_R.png",legs_L:"legs/legs_left_walk_step1_L.png",legs_R:"legs/legs_left_walk_step1_R.png"}},walk_L_step2:{order:["head","torso_top","legs_L","torso_bottom","arms_R","legs_R","arms_L"],files:{head:"head/head_left.png",torso_top:"torso_top/torso_top_left.png",torso_bottom:"torso_bottom/torso_bottom_left.png",arms_L:"arms/arm_left_walk_step2_L.png",arms_R:"arms/arm_left_walk_step2_R.png",legs_L:"legs/legs_left_walk_step2_L.png",legs_R:"legs/legs_left_walk_step2_R.png"}},walk_R_idle:{order:["torso_bottom","head","torso_top","legs_R","legs_L","arms_R"],files:{head:"head/head_right.png",torso_top:"torso_top/torso_top_right.png",torso_bottom:"torso_bottom/torso_bottom_right.png",arms_R:"arms/arm_right_idle.png",legs_L:"legs/legs_right_idle_L.png",legs_R:"legs/legs_right_idle_R.png"}},walk_R_step1:{order:["head","torso_top","legs_R","torso_bottom","arms_L","legs_L","arms_R"],files:{head:"head/head_right.png",torso_top:"torso_top/torso_top_right.png",torso_bottom:"torso_bottom/torso_bottom_right.png",arms_L:"arms/arm_right_walk_step1_L.png",arms_R:"arms/arm_right_walk_step1_R.png",legs_L:"legs/legs_right_walk_step1_L.png",legs_R:"legs/legs_right_walk_step1_R.png"}},walk_R_step2:{order:["head","torso_top","legs_R","torso_bottom","arms_L","legs_L","arms_R"],files:{head:"head/head_right.png",torso_top:"torso_top/torso_top_right.png",torso_bottom:"torso_bottom/torso_bottom_right.png",arms_L:"arms/arm_right_walk_step2_L.png",arms_R:"arms/arm_right_walk_step2_R.png",legs_L:"legs/legs_right_walk_step2_L.png",legs_R:"legs/legs_right_walk_step2_R.png"}}};function Ue(e,s,a){if(!s)return e==="up"?"back_idle":e==="left"?"walk_L_idle":e==="right"?"walk_R_idle":"front_idle";if(e==="down"){const o=Math.floor(a*3)%3;return o===0?"walk_front_step1":o===1?"front_idle":"walk_front_step2"}if(e==="up"){const o=Math.floor(a*3)%3;
1return o===0?"back_idle":o===1?"walk_back_step1":"walk_back_step2"}if(e==="left"){const o=Math.floor(a*3)%3;return o===0?"walk_L_idle":o===1?"walk_L_step1":"walk_L_step2"}const v=Math.floor(a*3)%3;return v===0?"walk_R_idle":v===1?"walk_R_step1":"walk_R_step2"}const ee={};let Ge=!1;const he={},Qe={};let be=null,Re=null,Ze="sleeve_font.png";const Ye={shirt:{base:"/images/mapts/clothes/top/",dirs:[["front","font.png"],["back","back.png"],["left","L.png"],["right","R.png"]],sleeves:{"01":{back:"sleeve_font.png",map:{"front_idle:arms_L":{f:"sleeve_font.png",flip:!1},"front_idle:arms_R":{f:"sleeve_font.png",flip:!1},"walk_front_step1:arms_L":{f:"sleeve_walk_font_step_1_L.png",flip:!1},"walk_front_step1:arms_R":{f:"sleeve_walk_font_step_1_R.png",flip:!1},"walk_front_step2:arms_L":{f:"sleeve_walk_font_step_2_L.png",flip:!1},"walk_front_step2:arms_R":{f:"sleeve_walk_font_step_2_R.png",flip:!1},"walk_L_idle:arms_L":{f:"sleeve_idle_L.png",flip:!1},"walk_L_step1:arms_L":{f:"sleeve_step1_L_L.png",flip:!1},"walk_L_step1:arms_R":{f:"sleeve_step1_L_R.png",flip:!1},"walk_L_step2:arms_L":{f:"sleeve_step2_L_L.png",flip:!1},"walk_L_step2:arms_R":{f:"sleeve_step2_L_R.png",flip:!1},"walk_R_idle:arms_R":{f:"sleeve_idle_L.png",flip:!0},"walk_R_step1:arms_R":{f:"sleeve_step1_L_L.png",flip:!0},"walk_R_step1:arms_L":{f:"sleeve_step1_L_R.png",flip:!0},"walk_R_step2:arms_R":{f:"sleeve_step2_L_L.png",flip:!0},"walk_R_step2:arms_L":{f:"sleeve_step2_L_R.png",flip:!0}}},"02":{back:"sleeve_back.png",map:{"front_idle:arms_L":{f:"sleeve_font.png",flip:!1},"front_idle:arms_R":{f:"sleeve_font.png",flip:!1},"walk_front_step1:arms_L":{f:"sleeve_walk_font_step_1_L.png",flip:!1},"walk_front_step1:arms_R":{f:"sleeve_walk_font_step_1_R.png",flip:!1},"walk_front_step2:arms_L":{f:"sleeve_walk_font_step_2_L.png",flip:!1},"walk_front_step2:arms_R":{f:"sleeve_walk_font_step_2_R.png",flip:!1},"walk_L_idle:arms_L":{f:"sleeve_idle_L.png",flip:!1},"walk_L_step1:arms_L":{f:"sleeve_step1_L_L.png",flip:!1},"walk_L_step1:arms_R":{f:"sleeve_step1_L_R.png",flip:!1},"walk_L_step2:arms_L":{f:"sleeve_step2_L_L.png",flip:!1},"walk_L_step2:arms_R":{f:"sleeve_step2_L_R.png",flip:!1},"walk_R_idle:arms_R":{f:"sleeve_idle_R.png",flip:!1},"walk_R_step1:arms_L":{f:"sleeve_step1_R_L.png",flip:!1},"walk_R_step1:arms_R":{f:"sleeve_step1_R_R.png",flip:!1},"walk_R_step2:arms_L":{f:"sleeve_step2_R_L.png",flip:!1},"walk_R_step2:arms_R":{f:"sleeve_step2_R_R.png",flip:!1}}},"03":{back:"sleeve_font.png",map:{"front_idle:arms_L":{f:"sleeve_font.png",flip:!1},"front_idle:arms_R":{f:"sleeve_font.png",flip:!1},"walk_front_step1:arms_L":{f:"sleeve_walk_font_step_1_L.png",flip:!1},"walk_front_step1:arms_R":{f:"sleeve_walk_font_step_1_R.png",flip:!1},"walk_front_step2:arms_L":{f:"sleeve_walk_font_step_2_L.png",flip:!1},"walk_front_step2:arms_R":{f:"sleeve_walk_font_step_2_R.png",flip:!1},"walk_L_idle:arms_L":{f:"sleeve_idle_L.png",flip:!1},"walk_L_step1:arms_L":{f:"sleeve_step1_L_L.png",flip:!1},"walk_L_step1:arms_R":{f:"sleeve_step1_L_R.png",flip:!1},"walk_L_step2:arms_L":{f:"sleeve_step2_L_L.png",flip:!1},"walk_L_step2:arms_R":{f:"sleeve_step2_L_R.png",flip:!1},"walk_R_idle:arms_R":{f:"sleeve_idle_R.png",flip:!1},"walk_R_step1:arms_L":{f:"sleeve_step1_R_L.png",flip:!1},"walk_R_step1:arms_R":{f:"sleeve_step1_R_R.png",flip:!1},"walk_R_step2:arms_L":{f:"sleeve_step2_R_L.png",flip:!1},"walk_R_step2:arms_R":{f:"sleeve_step2_R_R.png",flip:!1}}},"04":{back:"sleeve_font.png",map:{"front_idle:arms_L":{f:"sleeve_font.png",flip:!1},"front_idle:arms_R":{f:"sleeve_font.png",flip:!1},"walk_front_step1:arms_L":{f:"sleeve_walk_font_step_1_L.png",flip:!1},"walk_front_step1:arms_R":{f:"sleeve_walk_font_step_1_R.png",flip:!1},"walk_front_step2:arms_L":{f:"sleeve_walk_font_step_2_L.png",flip:!1},"walk_front_step2:arms_R":{f:"sleeve_walk_font_step_2_R.png",flip:!1},"walk_L_idle:arms_L":{f:"sleeve_idle_L.png",flip:!1},"walk_L_step1:arms_L":{f:"sleeve_step1_L_L.png",flip:!1},"walk_L_step1:arms_R":{f:"sleeve_step1_L_R.png",flip:!1},"walk_L_step2:arms_L":{f:"sleeve_step2_L_L.png",flip:!1},"walk_L_step2:arms_R":{f:"sleeve_step2_L_R.png",flip:!1},"walk_R_idle:arms_R":{f:"sleeve_idle_R.png",flip:!1},"walk_R_step1:arms_L":{f:"sleeve_step1_R_L.png",flip:!1},"walk_R_step1:arms_R":{f:"sleeve_step1_R_R.png",flip:!1},"walk_R_step2:arms_L":{f:"sleeve_step2_R_L.png",flip:!1},"walk_R_step2:arms_R":{f:"sleeve_step2_R_R.png",flip:!1}}}}},dress:{base:"/images/mapts/clothes/",dirs:[["front","font.png"],["back","back.png"],["left","L.png"],["right","R.png"]]},pants:{base:"/images/mapts/clothes/",dirs:[["front","font.png"],["back","back.png"],["left","L.png"],["right","R.png"]]},face:{base:"/images/mapts/face/",dirs:[["front","font.png"],["left","side.png"]]}
1,hair:{base:"/images/mapts/hair/",dirs:[["front","font.png"],["back","back.png"],["left","left.png"],["right","right.png"]]}};function F(e,s){var v;const a=Ye[e];if(!!a){for(const[o,i]of a.dirs){const f=`${e}:${o}`;if(!s){delete he[f];continue}const w=new Image;w.src=`${a.base}${s}/${i}`,he[f]=w}if(e==="shirt"){Re=s||null;const o=s?(v=a.sleeves)==null?void 0:v[s]:null;if(be=(o==null?void 0:o.map)||null,Ze=(o==null?void 0:o.back)||"sleeve_font.png",s&&(o==null?void 0:o.map)){const i=new Set(Object.values(o.map).map(f=>f.f));o.back&&i.add(o.back);for(const f of i){const w=`${s}:${f}`;if(!Qe[w]){const B=new Image;B.src=`${a.base}${s}/${f}`,Qe[w]=B}}}}}}function W(e){for(const[s,a]of Object.entries(e||{}))F(s,a)}function se(){const e=[],s=a=>{const v=new Image;return v.src=mt+a,e.push(new Promise(o=>{v.onload=o,v.onerror=o})),v};for(const[a,v]of Object.entries(Te)){ee[a]={};for(const[o,i]of Object.entries(v.files))ee[a][o]=s(i)}Promise.all(e).then(()=>{Ge=!0})}const ie={[n.LOBBY]:"lobby",[n.OFFICE]:"office",[n.MTG1]:"meeting1",[n.MTG2]:"meeting2",[n.MGR]:"mgr",[n.BREAK]:"break"},Le={[n.LOBBY]:"hall",[n.OFFICE]:"north",[n.MTG1]:"east",[n.MTG2]:"west",[n.MGR]:"center",[n.BREAK]:"south"},Se={[n.LOBBY]:"hallway",[n.OFFICE]:"class1",[n.MTG1]:"class2",[n.MTG2]:"class3",[n.MGR]:"library",[n.BREAK]:"canteen"};let Je=ie;function P(e,s,a,v,o,i){for(let f=s;f<=a;f++)for(let w=v;w<=o;w++)f>=0&&f<A&&w>=0&&w<T&&(e[f][w]=i)}function ut(){const e=Array.from({length:A},()=>Array(T).fill(n.LOBBY));for(let s=0;s<T;s++)e[0][s]=n.BORDER,e[A-1][s]=n.BORDER;for(let s=0;s<A;s++)e[s][0]=n.BORDER,e[s][T-1]=n.BORDER;return P(e,1,13,1,24,n.OFFICE),P(e,14,14,1,24,n.WALL),e[14][10]=n.LOBBY,e[14][11]=n.LOBBY,P(e,1,14,25,25,n.WALL),P(e,1,13,26,48,n.MTG1),P(e,14,14,26,48,n.WALL),e[14][37]=n.LOBBY,e[14][38]=n.LOBBY,P(e,18,27,1,11,n.MGR),P(e,17,17,1,12,n.WALL),P(e,18,27,12,12,n.WALL),e[22][12]=n.LOBBY,e[23][12]=n.LOBBY,P(e,28,28,1,12,n.WALL),P(e,18,33,37,48,n.MTG2),P(e,17,17,36,48,n.WALL),P(e,18,33,36,36,n.WALL),e[25][36]=n.LOBBY,e[26][36]=n.LOBBY,P(e,34,34,36,48,n.WALL),P(e,31,38,1,15,n.BREAK),P(e,30,30,1,15,n.WALL),e[30][11]=n.LOBBY,e[30][12]=n.LOBBY,P(e,30,38,16,16,n.WALL),Nt(e),e}function Nt(e){[2,5,8,11].forEach(s=>[2,5,8,11,14,17,20,23].forEach(a=>{e[s][a]===n.OFFICE&&(e[s][a]=n.DESK)})),[[1,1],[1,22],[12,1],[12,22]].forEach(([s,a])=>{e[s][a]===n.OFFICE&&(e[s][a]=n.PLANT)}),P(e,5,9,30,44,n.MTG_TABLE);for(let s=31;s<=40;s++)e[2][s]===n.MTG1&&(e[2][s]=n.WHITEBOARD);[[1,26],[1,47],[12,26],[12,47]].forEach(([s,a])=>{e[s][a]===n.MTG1&&(e[s][a]=n.PLANT)}),P(e,20,21,3,7,n.DESK);for(let s=18;s<=25;s++)e[s][10]===n.MGR&&(e[s][10]=n.SHELF);[[18,1],[26,9]].forEach(([s,a])=>{e[s][a]===n.MGR&&(e[s][a]=n.PLANT)});for(let s=2;s<=9;s++)e[31][s]===n.BREAK&&(e[31][s]=n.MACHINE);[[33,2],[33,3],[33,4]].forEach(([s,a])=>{e[s][a]===n.BREAK&&(e[s][a]=n.SOFA)}),[[31,14],[37,2]].forEach(([s,a])=>{e[s][a]===n.BREAK&&(e[s][a]=n.PLANT)}),P(e,21,29,39,46,n.MTG_TABLE);for(let s=39;s<=46;s++)e[19][s]===n.MTG2&&(e[19][s]=n.WHITEBOARD);[[18,37],[18,47],[32,37],[32,47]].forEach(([s,a])=>{e[s][a]===n.MTG2&&(e[s][a]=n.PLANT)}),P(e,16,17,15,18,n.DESK),[[15,1],[15,35],[29,1],[38,35],[38,17]].forEach(([s,a])=>{e[s][a]===n.LOBBY&&(e[s][a]=n.PLANT)})}let yt=[];function cs(){const e=Array.from({length:A},()=>Array(T).fill(n.WALL));for(let p=0;p<T;p++)e[0][p]=n.BORDER,e[A-1][p]=n.BORDER;for(let p=0;p<A;p++)e[p][0]=n.BORDER,e[p][T-1]=n.BORDER;const s=3,a=16,v=13,o=1,i=1,f=p=>o+p*s,w=p=>i+p*s;function B(p,g){e[w(g)][f(p)]=n.LOBBY}function Y(p,g){e[w(g)][f(p)+1]=n.LOBBY,e[w(g)][f(p)+2]=n.LOBBY}function G(p,g){e[w(g)+1][f(p)]=n.LOBBY,e[w(g)+2][f(p)]=n.LOBBY}let ye=31415;function Me(){return ye=ye*1103515245+12345&2147483647,ye/2147483647}const ce=new Set,L=[];function C(p,g){p+1<a&&!ce.has((p+1)*100+g)&&L.push([p,g,"e"]),p-1>=0&&!ce.has((p-1)*100+g)&&L.push([p,g,"w"]),g+1<v&&!ce.has(p*100+g+1)&&L.push([p,g,"s"]),g-1>=0&&!ce.has(p*100+g-1)&&L.push([p,g,"n"])}function S(p,g){ce.add(p*100+g),B(p,g),C(p,g)}for(S(5,4);L.length;){const p=0|Me()*L.length,[g,H,ve]=L.splice(p,1)[0],Mt=g+(ve==="e"?1:ve==="w"?-1:0),Ce=H+(ve==="s"?1:ve==="n"?-1:0);ce.has(Mt*100+Ce)||(ve==="e"&&Y(g,H),ve==="w"&&Y(Mt,H),ve==="s"&&G(g,H),ve==="n"&&G(g,Ce),S(Mt,Ce))}const O=[];for(let p=0;p<v;p++)for(let g=0;g<a;g++){if(!ce.has(g*100+p))continue;let H=0;g+1<a&&e[w(p)][f(g)+1]===n.LOBBY&&H++,g>0&&e[w(p)][f(g)-1]===n.LOBBY&&H++,p+1<v&&e[w(p)+1][f(g)]===n.LOBBY&&H++,p>0&&e[w(p)-1][f(g)]===n.LOBBY&&H++,H===1&&O.push([p,g])}for(let p=0;p<A;p++)for(let g=0;g<T;g++)e[p][g]===n.LOBBY&&(p<=14?e[p][g]=n.OFFICE:p>=25?e[p][g]=n.BREAK:g<=15?e[p][g]=n.MTG2:g>=32?e[p][g]=n.MTG1:e[p][g]=n.MGR);for(let p=14;p<=24;p++)for(let g=13;g<=33;g++)e[p][g]=n.MGR;yt=[];for(const[p,g]of O){const H=w(p),ve=f(g);H>=14&&H<=24&&ve>=13&&ve<=33||(e[H][ve]=n.PLANT,yt.push({x:ve*32+16,y:H*32+16}))}return e[19][25]=n.MACHINE,e}function ne(){const e=Array.from({length:A},()=>Array(T).fill(n.LOBBY));for(let s=0;s<T;s++)e[0][s]=n.BORDER,e[A-1][s]=n.BORDER;for(let s=0;s<A;s++)e[s][0]=n.BORDER,e[s][T-1]=n.BORDER;return P(e,1,12,1,15,n.OFFICE),P(e,13,13,1,15,n.WALL),e[13][6]=n.LOBBY,e[13][7]=n.LOBBY,P(e,1,12,16,16,n.WALL),P(e,1,12,17,32,n.MTG1),P(e,13,13,17,32,n.WALL),e[13][23]=n.LOBBY,e[13][24]=n.LOBBY,P(e,1,12,33,33,n.WALL),P(e,1,12,34,48,n.MTG2),P(e,13,13,34,48,n.WALL),e[13][40]=n.LOBBY,e[13][41]=n.LOBBY,P(e,20,20,1,48,n.WALL),e[20][10]=n.LOBBY,e[20][11]=n.LOBBY,e[20][37]=n.LOBBY,e[20][38]=n.LOBBY,P(e,21,34,1,22,n.MGR),P(e,21,34,23,23,n.WALL),P(e,21,34,24,48,n.BREAK),P(e,35,35,1,48,n.WALL),e[35][10]=n.LOBBY,e[35][11]=n.LOBBY,e[35][37]=n.LOBBY,e[35][38]=n.LOBBY,Dt(e),e}function Dt(e){for(let s=2;s<=14;s++)e[1][s]===n.OFFICE&&(e[1][s]=n.WHITEBOARD);
1e[2][8]===n.OFFICE&&(e[2][8]=n.DESK),[4,6,8,10].forEach(s=>[2,5,8,11,14].forEach(a=>{e[s][a]===n.OFFICE&&(e[s][a]=n.DESK)})),[[11,1],[12,14]].forEach(([s,a])=>{e[s][a]===n.OFFICE&&(e[s][a]=n.PLANT)});for(let s=18;s<=31;s++)e[1][s]===n.MTG1&&(e[1][s]=n.WHITEBOARD);e[2][24]===n.MTG1&&(e[2][24]=n.DESK),[4,6,8,10].forEach(s=>[18,21,24,27,30].forEach(a=>{e[s][a]===n.MTG1&&(e[s][a]=n.DESK)})),[[11,17],[12,31]].forEach(([s,a])=>{e[s][a]===n.MTG1&&(e[s][a]=n.PLANT)});for(let s=35;s<=47;s++)e[1][s]===n.MTG2&&(e[1][s]=n.WHITEBOARD);e[2][41]===n.MTG2&&(e[2][41]=n.DESK),[4,6,8,10].forEach(s=>[35,38,41,44,47].forEach(a=>{e[s][a]===n.MTG2&&(e[s][a]=n.DESK)})),[[11,34],[12,47]].forEach(([s,a])=>{e[s][a]===n.MTG2&&(e[s][a]=n.PLANT)}),[[16,2],[16,47],[17,24]].forEach(([s,a])=>{e[s][a]===n.LOBBY&&(e[s][a]=n.PLANT)});for(let s=22;s<=33;s++)e[s][1]===n.MGR&&(e[s][1]=n.SHELF);for(let s=22;s<=33;s++)e[s][21]===n.MGR&&(e[s][21]=n.SHELF);for(let s=2;s<=20;s++)e[21][s]===n.MGR&&s!==10&&s!==11&&(e[21][s]=n.SHELF);[[24,5],[24,11],[24,17],[28,5],[28,11],[28,17],[31,5],[31,11]].forEach(([s,a])=>{e[s][a]===n.MGR&&(e[s][a]=n.MTG_TABLE)}),[[33,3],[33,18]].forEach(([s,a])=>{e[s][a]===n.MGR&&(e[s][a]=n.PLANT)});for(let s=25;s<=47;s++)e[21][s]===n.BREAK&&s!==37&&s!==38&&(e[21][s]=n.MACHINE);[[24,26],[24,31],[24,36],[24,41],[24,46],[28,26],[28,31],[28,36],[28,41],[28,46],[31,26],[31,31],[31,36],[31,41]].forEach(([s,a])=>{e[s][a]===n.BREAK&&(e[s][a]=n.MTG_TABLE)}),[[33,25],[33,46]].forEach(([s,a])=>{e[s][a]===n.BREAK&&(e[s][a]=n.PLANT)}),[[37,2],[37,47]].forEach(([s,a])=>{e[s][a]===n.LOBBY&&(e[s][a]=n.PLANT)})}function Z(e,s,a){e.fillStyle="#3a6028",e.fillRect(s,a,t,t)}function gt(e,s,a){const v=ft[a][s],o=s*t,i=a*t;switch(v){case n.LOBBY:{const f=(s*3+a*7)%4;e.fillStyle=["#c4b890","#bcb088","#c8bc96","#b8ac84"][f],e.fillRect(o,i,t,t),e.fillStyle="rgba(0,0,0,0.08)",e.fillRect(o,i,t,1),e.fillRect(o,i,1,t),e.fillStyle="rgba(255,255,255,0.10)",e.fillRect(o,i+t-1,t,1),e.fillRect(o+t-1,i,1,t);break}case n.OFFICE:{const f=(s*2+a*5)%3;e.fillStyle=["#4a7a38","#507e3c","#446e34"][f],e.fillRect(o,i,t,t),(s*13+a*7)%7===0&&(e.fillStyle="#b0c8f8",e.fillRect(o+s*17%8+2,i+a*13%8+2,4,4)),(s*7+a*17)%9===0&&(e.fillStyle="#9ab8f0",e.fillRect(o+s*11%10+1,i+a*9%10+1,3,3));break}case n.MTG1:{const f=(s*2+a*5)%3;e.fillStyle=["#427034","#487438","#3e6c30"][f],e.fillRect(o,i,t,t),(s*13+a*7)%7===0&&(e.fillStyle="#f08090",e.fillRect(o+s*17%8+2,i+a*13%8+2,4,4)),(s*7+a*17)%9===0&&(e.fillStyle="#e06070",e.fillRect(o+s*11%10+1,i+a*9%10+1,3,3));break}case n.BREAK:{const f=(s*2+a*5)%3;e.fillStyle=["#4a7838","#507c3c","#446e32"][f],e.fillRect(o,i,t,t),(s*13+a*7)%7===0&&(e.fillStyle="#f0e060",e.fillRect(o+s*17%8+2,i+a*13%8+2,4,4)),(s*7+a*17)%9===0&&(e.fillStyle="#e8d050",e.fillRect(o+s*11%10+1,i+a*9%10+1,3,3));break}case n.MTG2:{const f=(s*2+a*5)%3;e.fillStyle=["#3a6c40","#406e3a","#346438"][f],e.fillRect(o,i,t,t),(s*13+a*7)%7===0&&(e.fillStyle="#c090f8",e.fillRect(o+s*17%8+2,i+a*13%8+2,4,4)),(s*7+a*17)%9===0&&(e.fillStyle="#a870e8",e.fillRect(o+s*11%10+1,i+a*9%10+1,3,3));break}case n.MGR:{const f=(s+a)%2;e.fillStyle=f?"#cec8b8":"#c4beaa",e.fillRect(o,i,t,t),e.strokeStyle="rgba(0,0,0,0.10)",e.lineWidth=.5,e.strokeRect(o+.5,i+.5,t-1,t-1);break}case n.WALL:{const f=(s*5+a*7)%4;e.fillStyle=["#1a4a0e","#163e0a","#1c520e","#18420c"][f],e.fillRect(o,i,t,t),e.fillStyle=["#246018","#20580c","#28681a","#1e5010"][f],e.fillRect(o,i,t,10),e.fillStyle="rgba(255,255,255,0.07)",e.fillRect(o,i,t,2);const w=["#2c7020","#287418","#307824","#246018"][(s+a)%4];e.fillStyle=w,e.beginPath(),e.arc(o+4,i+8,5,Math.PI,0,!1),e.fill(),e.beginPath(),e.arc(o+13,i+5,6,Math.PI,0,!1),e.fill(),e.beginPath(),e.arc(o+22,i+7,5,Math.PI,0,!1),e.fill(),e.beginPath(),e.arc(o+30,i+9,4,Math.PI,0,!1),e.fill(),e.fillStyle=["#347828","#308020","#38802c","#2c6e1e"][(s*3+a)%4],e.beginPath(),e.arc(o+8,i+4,4,Math.PI,0,!1),e.fill(),e.beginPath(),e.arc(o+18,i+3,5,Math.PI,0,!1),e.fill(),e.beginPath(),e.arc(o+27,i+5,4,Math.PI,0,!1),e.fill(),e.fillStyle="rgba(0,0,0,0.30)",e.fillRect(o,i+t-6,t,6),e.fillStyle="rgba(0,0,0,0.15)",e.fillRect(o,i+t-12,t,6);break}case n.BORDER:{e.fillStyle="#2a3820",e.fillRect(o,i,t,t),e.fillStyle="rgba(0,0,0,0.3)",e.fillRect(o,i+t-3,t,3);break}case n.PLANT:{const f=(s*2+a*5)%3;e.fillStyle=["#4a7a38","#507e3c","#446e34"][f],e.fillRect(o,i,t,t),e.fillStyle="#8a8070",e.fillRect(o+8,i+20,t-16,t-22),e.fillStyle="#a09888",e.fillRect(o+7,i+19,t-14,4),e.fillStyle="#b8b0a0",e.fillRect(o+11,i+11,t-22,9),e.fillRect(o+13,i+20,t-26,0),e.beginPath(),e.arc(o+t/2,i+9,5,0,Math.PI*2),e.fill(),e.fillRect(o+4,i+12,7,3),e.fillRect(o+t-11,i+12,7,3),e.fillStyle="#a8a098",e.beginPath(),e.moveTo(o+9,i+20),e.lineTo(o+5,i+25),e.lineTo(o+t-5,i+25),e.lineTo(o+t-9,i+20),e.fill(),e.fillStyle="rgba(0,0,0,0.18)",e.fillRect(o+11,i+11,3,9);break}case n.MACHINE:{const f=(s+a)%2;e.fillStyle=f?"#cec8b8":"#c4beaa",e.fillRect(o,i,t,t),e.fillStyle="#a09888",e.beginPath(),e.arc(o+t/2,i+t/2,11,0,Math.PI*2),e.fill(),e.fillStyle="#6ab0d8",e.beginPath(),e.arc(o+t/2,i+t/2,8,0,Math.PI*2),e.fill(),e.fillStyle="#80c8f0",e.beginPath(),e.arc(o+t/2,i+t/2,5,0,Math.PI*2),e.fill(),e.fillStyle="#b0a898",e.fillRect(o+14,
1i+7,4,12),e.fillStyle="rgba(160,220,255,0.8)",e.beginPath(),e.arc(o+t/2,i+7,4,0,Math.PI*2),e.fill(),e.fillStyle="rgba(160,220,255,0.4)",e.beginPath(),e.arc(o+t/2,i+5,3,0,Math.PI*2),e.fill();break}default:{Z(e,o,i);break}}}function It(e,s,a){const v=ft[a][s],o=s*t,i=a*t;switch(v){case n.LOBBY:{const f=(s+a)%2===0;e.fillStyle=f?"#dcd8d0":"#d4d0c8",e.fillRect(o,i,t,t),a>=14&&a<=19&&s%8===0&&(e.fillStyle="rgba(180,160,100,0.18)",e.fillRect(o+t/2-1,i,2,t)),e.strokeStyle="rgba(0,0,0,0.05)",e.lineWidth=.5,e.strokeRect(o+.5,i+.5,t-1,t-1);break}case n.OFFICE:{e.fillStyle=(s+a)%2===0?"#d8eef6":"#cce6f2",e.fillRect(o,i,t,t),e.strokeStyle="rgba(100,160,200,0.12)",e.lineWidth=.5,e.strokeRect(o+.5,i+.5,t-1,t-1);break}case n.MTG1:{e.fillStyle=(s+a)%2===0?"#d8eec8":"#cce6c0",e.fillRect(o,i,t,t),e.strokeStyle="rgba(100,180,120,0.12)",e.lineWidth=.5,e.strokeRect(o+.5,i+.5,t-1,t-1);break}case n.MTG2:{e.fillStyle=(s+a)%2===0?"#f0e8d0":"#e8dfc8",e.fillRect(o,i,t,t),e.strokeStyle="rgba(180,150,80,0.10)",e.lineWidth=.5,e.strokeRect(o+.5,i+.5,t-1,t-1);break}case n.MGR:{const f=(s*7+a*3)%3;e.fillStyle=["#c8a870","#bc9e68","#c4a46c"][f],e.fillRect(o,i,t,t),e.strokeStyle="rgba(80,40,0,0.12)",e.lineWidth=.6,e.beginPath(),e.moveTo(o,i+t*.5),e.lineTo(o+t,i+t*.5),e.stroke();break}case n.BREAK:{e.fillStyle=(s+a)%2===0?"#f2ede4":"#e8e4d8",e.fillRect(o,i,t,t),e.strokeStyle="rgba(0,0,0,0.06)",e.lineWidth=.8,e.strokeRect(o+1,i+1,t-2,t-2);break}case n.WALL:{const f=(s*3+a*5)%3;e.fillStyle=["#c0b4a0","#b8ac98","#c4b8a4"][f],e.fillRect(o,i,t,t);const w=a%2===0?0:t/2;e.fillStyle="rgba(0,0,0,0.10)",e.fillRect(o,i+t/2-1,t,1);for(let B=w%t;B<t;B+=t/2)e.fillRect(o+B,i,1,t/2);e.fillStyle="rgba(255,255,255,0.15)",e.fillRect(o,i,t,2),e.fillStyle="rgba(0,0,0,0.12)",e.fillRect(o,i+t-2,t,2);break}case n.BORDER:{e.fillStyle="#1a1626",e.fillRect(o,i,t,t),e.fillStyle="rgba(255,255,255,0.04)",e.fillRect(o,i,t,2);break}case n.DESK:{Lt(e,o,i,s,a),e.fillStyle="#b8c8d8",e.fillRect(o+2,i+7,t-4,t-11),e.fillStyle="#1a1a2e",e.fillRect(o+7,i+9,t-14,12),e.fillStyle="#2040aa",e.fillRect(o+9,i+11,t-18,8),e.fillStyle="#d0c8bc",e.fillRect(o+5,i+23,t-10,5),e.fillStyle="#8090a0",e.fillRect(o+3,i+t-5,4,3),e.fillRect(o+t-7,i+t-5,4,3);break}case n.MTG_TABLE:{e.fillStyle="#4a3010",e.fillRect(o,i,t,t),e.fillStyle="#6a4820",e.fillRect(o,i,t,4),e.fillRect(o,i,4,t),e.fillStyle="rgba(255,200,100,0.06)",e.fillRect(o+4,i+5,t-7,t-7);break}case n.PLANT:{Lt(e,o,i,s,a),e.fillStyle="#a05030",e.fillRect(o+8,i+20,t-16,t-22),e.fillStyle="#c07050",e.fillRect(o+9,i+21,t-18,3),e.fillStyle="#2d6a2d",e.beginPath(),e.arc(o+t/2,i+13,9,0,Math.PI*2),e.fill(),e.fillStyle="#3d8a3d",e.beginPath(),e.arc(o+t/2-6,i+9,6,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(o+t/2+6,i+9,6,0,Math.PI*2),e.fill(),e.fillStyle="#2f7a2f",e.beginPath(),e.arc(o+t/2,i+7,5,0,Math.PI*2),e.fill();break}case n.WHITEBOARD:{Lt(e,o,i,s,a),e.fillStyle="#f6f4f0",e.fillRect(o+1,i+2,t-2,t-7),e.strokeStyle="#c0b8a8",e.lineWidth=1.5,e.strokeRect(o+1,i+2,t-2,t-7),e.fillStyle="#e0d8cc",e.fillRect(o+1,i+t-7,t-2,4),e.strokeStyle="#7090c0",e.lineWidth=1,e.beginPath(),e.moveTo(o+4,i+8),e.lineTo(o+t-4,i+8),e.moveTo(o+4,i+14),e.lineTo(o+t-8,i+14),e.moveTo(o+4,i+20),e.lineTo(o+t-6,i+20),e.stroke();break}case n.MACHINE:{Lt(e,o,i,s,a),e.fillStyle="#e0e8f0",e.fillRect(o+1,i+3,t-2,t-5),e.fillStyle="#c8d4de",e.fillRect(o+1,i+3,t-2,4),e.fillStyle="rgba(100,140,180,0.25)",e.fillRect(o+3,i+8,t-6,t-12),e.fillStyle="rgba(80,120,160,0.3)",e.fillRect(o+4,i+9,t-8,6);break}case n.SOFA:{Lt(e,o,i,s,a),e.fillStyle="#5068a0",e.fillRect(o+2,i+12,t-4,t-14),e.fillStyle="#6080c0",e.fillRect(o+2,i+10,t-4,4),e.fillStyle="rgba(255,255,255,0.10)",e.fillRect(o+4,i+12,t/2-5,t-16),e.fillRect(o+t/2+1,i+12,t/2-5,t-16);break}case n.SHELF:{e.fillStyle="#6a4820",e.fillRect(o,i,t,t),e.fillStyle="#8a6030",e.fillRect(o,i,t,2),e.fillRect(o,i,2,t);const f=["#c04030","#3060a0","#308040","#a0a030","#8030a0","#cc6010","#206080"];[2,9,17,24].forEach((w,B)=>{e.fillStyle="#7a5028",e.fillRect(o+2,i+w,t-4,2);let Y=o+3;for(;Y<o+t-4;){const G=3+(B*3+Y)%4;e.fillStyle=f[(Y*7+w*3)%f.length],e.fillRect(Y,i+w+2,G,6),Y+=G+1}});break}default:{const f=(s+a)%2===0;e.fillStyle=f?"#dcd8d0":"#d4d0c8",e.fillRect(o,i,t,t);break}}}let ft=k.mapId==="maze"||k.mapId==="horror-maze"?cs():k.mapId==="school"?ne():ut();k.mapId==="maze"||k.mapId==="horror-maze"?Je=Le:k.mapId==="school"&&(Je=Se);let ds=null;function Ws(){const e=document.createElement("canvas");e.width=T*t,e.height=A*t;const s=e.getContext("2d");for(let a=0;a<A;a++)for(let v=0;v<T;v++)Ht(s,v,a);ds=e}const us=[{tx:12,ty:7,text:"Open Office"},{tx:37,ty:7,text:"Meeting Room 1"},{tx:5,ty:22,text:"CEO Office"},{tx:7,ty:34,text:"Break Room"},{tx:42,ty:25,text:"Meeting Room 2"},{tx:25,ty:24,text:"Main Lobby"}],Bt=[{tx:22,ty:7,text:"North Garden"},{tx:6,ty:19,text:"West Garden"},{tx:40,ty:19,text:"East Garden"},{tx:24,ty:18,text:"Fountain Plaza"},{tx:22,ty:31,text:"South Garden"}],He=[{tx:7,ty:6,text:"Classroom 1"},{tx:24,ty:6,text:"Classroom 2"},{tx:40,ty:6,text:"Classroom 3"},{tx:24,ty:16,text:"Main Hallway"},{tx:10,ty:27,text:"Library"},{tx:35,ty:27,text:"Canteen"},{tx:24,ty:37,text:"Entrance"}];let At=k.mapId==="maze"||k.mapId==="horror-maze"?Bt:k.mapId==="school"?He:us;function Yt(e,s,a,v,o){for(const[i,f]of[[1,0],[-1,0],[0,1],[0,-1]]){const w=o+i,B=v+f;if(w<0||w>=A||B<0||B>=T)continue;const Y=ft[w][B];if(Y===n.OFFICE){const G=(v+o)%2===0;e.fillStyle=G?"#4a7a8c":"#426e80",e.fillRect(s,a,t,t);return}if(Y===n.MGR){e.fillStyle=["#8a5830","#7a4e28","#825428"][(v*7+o*3)%3],e.fillRect(s,a,t,t);return}if(Y===n.MTG1||Y===n.MTG2){const G=(v*3+o)%4;
1e.fillStyle=["#c8a870","#c0a068","#b89060","#c4a46c"][G],e.fillRect(s,a,t,t);return}if(Y===n.BREAK){e.fillStyle=(v+o)%2===0?"#ead8b8":"#e2d0b0",e.fillRect(s,a,t,t);return}}e.fillStyle=(v+o)%2===0?"#cec8c0":"#c6c0b8",e.fillRect(s,a,t,t)}function Lt(e,s,a,v,o){for(const[i,f]of[[1,0],[-1,0],[0,1],[0,-1]]){const w=o+i,B=v+f;if(w<0||w>=A||B<0||B>=T)continue;const Y=ft[w][B];if(Y===n.OFFICE){e.fillStyle=(v+o)%2===0?"#d8eef6":"#cce6f2",e.fillRect(s,a,t,t);return}if(Y===n.MTG1){e.fillStyle=(v+o)%2===0?"#d8eec8":"#cce6c0",e.fillRect(s,a,t,t);return}if(Y===n.MTG2){e.fillStyle=(v+o)%2===0?"#f0e8d0":"#e8dfc8",e.fillRect(s,a,t,t);return}if(Y===n.MGR){const G=(v*7+o*3)%3;e.fillStyle=["#c8a870","#bc9e68","#c4a46c"][G],e.fillRect(s,a,t,t);return}if(Y===n.BREAK){e.fillStyle=(v+o)%2===0?"#f2ede4":"#e8e4d8",e.fillRect(s,a,t,t);return}}e.fillStyle=(v+o)%2===0?"#dcd8d0":"#d4d0c8",e.fillRect(s,a,t,t)}function Ht(e,s,a){if(k.mapId==="maze"||k.mapId==="horror-maze")return gt(e,s,a);if(k.mapId==="school")return It(e,s,a);const v=ft[a][s],o=s*t,i=a*t;switch(v){case n.LOBBY:{e.fillStyle=(s+a)%2===0?"#cec8c0":"#c6c0b8",e.fillRect(o,i,t,t),e.strokeStyle="rgba(0,0,0,0.06)",e.lineWidth=.5,e.strokeRect(o+.5,i+.5,t-1,t-1);break}case n.OFFICE:{const f=(s+a)%2===0;e.fillStyle=f?"#4a7a8c":"#426e80",e.fillRect(o,i,t,t),e.fillStyle="rgba(255,255,255,0.06)",e.fillRect(o+4,i+4,2,2),e.fillRect(o+14,i+18,2,2),e.fillRect(o+22,i+8,2,2),e.fillRect(o+8,i+26,2,2),e.fillRect(o+26,i+20,2,2);break}case n.MTG1:{const f=(s*3+a)%4;e.fillStyle=["#c8a870","#c0a068","#b89060","#c4a46c"][f],e.fillRect(o,i,t,t),e.strokeStyle="rgba(80,50,10,0.12)",e.lineWidth=.7,e.beginPath(),e.moveTo(o,i+t/2),e.lineTo(o+t,i+t/2),e.stroke();break}case n.MTG2:{const f=(s*5+a*3)%4;e.fillStyle=["#b89060","#c0a068","#b28858","#ba9062"][f],e.fillRect(o,i,t,t),e.strokeStyle="rgba(80,50,10,0.14)",e.lineWidth=.7,e.beginPath(),e.moveTo(o,i+t*.4),e.lineTo(o+t,i+t*.4),e.moveTo(o,i+t*.75),e.lineTo(o+t,i+t*.75),e.stroke();break}case n.MGR:{const f=(s*7+a*3)%3;e.fillStyle=["#8a5830","#7a4e28","#825428"][f],e.fillRect(o,i,t,t),e.strokeStyle="rgba(40,20,0,0.18)",e.lineWidth=.8,e.beginPath(),e.moveTo(o,i+t*.33),e.lineTo(o+t,i+t*.33),e.moveTo(o,i+t*.67),e.lineTo(o+t,i+t*.67),e.stroke();break}case n.BREAK:{e.fillStyle=(s+a)%2===0?"#ead8b8":"#e2d0b0",e.fillRect(o,i,t,t),e.strokeStyle="rgba(0,0,0,0.07)",e.lineWidth=.5,e.strokeRect(o+1.5,i+1.5,t-3,t-3);break}case n.WALL:{e.fillStyle="#2e2a3a",e.fillRect(o,i,t,t),e.fillStyle="rgba(255,255,255,0.09)",e.fillRect(o,i,t,3),e.fillStyle="rgba(0,0,0,0.22)",e.fillRect(o,i+t-3,t,3);break}case n.BORDER:{e.fillStyle="#1a1828",e.fillRect(o,i,t,t),e.fillStyle="rgba(255,255,255,0.04)",e.fillRect(o,i,t,2);break}case n.DESK:{Yt(e,o,i,s,a),e.fillStyle="#d4a860",e.fillRect(o+2,i+7,t-4,t-11),e.fillStyle="#1a1a2e",e.fillRect(o+7,i+9,t-14,12),e.fillStyle="#2040aa",e.fillRect(o+9,i+11,t-18,8),e.fillStyle="#c8c0b8",e.fillRect(o+5,i+23,t-10,5),e.fillStyle="#a07840",e.fillRect(o+3,i+t-5,4,3),e.fillRect(o+t-7,i+t-5,4,3);break}case n.MTG_TABLE:{e.fillStyle="#3a2008",e.fillRect(o,i,t,t),e.fillStyle="#5a3820",e.fillRect(o,i,t,4),e.fillRect(o,i,4,t),e.fillStyle="rgba(255,200,100,0.04)",e.fillRect(o+4,i+5,t-7,t-7);break}case n.PLANT:{Yt(e,o,i,s,a),e.fillStyle="#a05030",e.fillRect(o+8,i+20,t-16,t-22),e.fillStyle="#c07050",e.fillRect(o+9,i+21,t-18,3),e.fillStyle="#2d6a2d",e.beginPath(),e.arc(o+t/2,i+13,9,0,Math.PI*2),e.fill(),e.fillStyle="#3d8a3d",e.beginPath(),e.arc(o+t/2-6,i+9,6,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(o+t/2+6,i+9,6,0,Math.PI*2),e.fill(),e.fillStyle="#2f7a2f",e.beginPath(),e.arc(o+t/2,i+7,5,0,Math.PI*2),e.fill();break}case n.WHITEBOARD:{const f=(s*3+a)%4;e.fillStyle=["#c8a870","#c0a068","#b89060","#c4a46c"][f],e.fillRect(o,i,t,t),e.fillStyle="#f0ece8",e.fillRect(o+2,i+3,t-4,t-8),e.strokeStyle="#b8a898",e.lineWidth=1.2,e.strokeRect(o+2,i+3,t-4,t-8),e.fillStyle="#c8b8a0",e.fillRect(o+2,i+t-7,t-4,3),e.strokeStyle="#6080b0",e.lineWidth=.8,e.beginPath(),e.moveTo(o+5,i+9),e.lineTo(o+t-5,i+9),e.moveTo(o+5,i+14),e.lineTo(o+t-9,i+14),e.moveTo(o+5,i+19),e.lineTo(o+t-7,i+19),e.stroke();break}case n.MACHINE:{e.fillStyle=(s+a)%2===0?"#ead8b8":"#e2d0b0",e.fillRect(o,i,t,t),e.fillStyle="#3a3848",e.fillRect(o+2,i+2,t-4,t-4),e.fillStyle="#4a4858",e.fillRect(o+4,i+4,t-8,t-10),e.fillStyle="#22aa44",e.fillRect(o+6,i+7,t-12,6),e.fillStyle="#cc3333",e.beginPath(),e.arc(o+t/2,i+t*.7,4,0,Math.PI*2),e.fill(),e.fillStyle="rgba(255,255,255,0.4)",e.beginPath(),e.arc(o+t-6,i+6,2,0,Math.PI*2),e.fill();break}case n.SOFA:{e.fillStyle=(s+a)%2===0?"#ead8b8":"#e2d0b0",e.fillRect(o,i,t,t),e.fillStyle="#4a5068",e.fillRect(o+1,i+1,t-2,10),e.fillStyle="#5a6080",e.fillRect(o+1,i+12,t-2,t-14),e.fillStyle="rgba(255,255,255,0.09)",e.fillRect(o+3,i+13,t/2-4,t-1
17),e.fillRect(o+t/2+1,i+13,t/2-4,t-17),e.fillStyle="#3a4058",e.fillRect(o+1,i+12,3,t-14),e.fillRect(o+t-4,i+12,3,t-14);break}case n.SHELF:{Yt(e,o,i,s,a),e.fillStyle="#7a5030",e.fillRect(o+1,i+1,t-2,t-2);const f=["#c05030","#3060a0","#308040","#a0a030","#8030a0"];[2,9,16,23].forEach((w,B)=>{e.fillStyle="#9a7040",e.fillRect(o+2,i+w,t-4,3),e.fillStyle=f[B%f.length],e.fillRect(o+3,i+w+1,t-6,5)});break}}}function je(e,s,a,v){var L;if(!v||!v.length)return a;e.save(),e.font='10px "Noto Sans Thai",Arial,sans-serif',e.textAlign="left",e.textBaseline="top";const o=160,i=8,f=5,w=7,B=6,Y=4,G=14+f*2,ye=v.map(C=>{if(!C)return"";if(e.measureText(C).width<=o-i*2)return C;let S=C;for(;e.measureText(S+"\u2026").width>o-i*2&&S.length>0;)S=S.slice(0,-1);return S+"\u2026"});let Me=a-w-2;const ce=[];for(let C=ye.length-1;C>=0;C--){const S=Math.max(Math.min(e.measureText(ye[C]).width+i*2,o),40);ce.unshift({text:ye[C],bw:S,by:Me-G}),Me=Me-G-Y}return ce.forEach(({text:C,bw:S,by:O},p)=>{const g=s-S/2,H=p===ce.length-1;e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=2,e.fillStyle="rgba(255,255,255,0.96)",e.strokeStyle="rgba(0,0,0,0.10)",e.lineWidth=1,e.beginPath(),e.moveTo(g+B,O),e.lineTo(g+S-B,O),e.arcTo(g+S,O,g+S,O+B,B),e.lineTo(g+S,O+G-B),e.arcTo(g+S,O+G,g+S-B,O+G,B),e.lineTo(g+B,O+G),e.arcTo(g,O+G,g,O+G-B,B),e.lineTo(g,O+B),e.arcTo(g,O,g+B,O,B),e.closePath(),e.fill(),e.stroke(),H&&(e.shadowBlur=0,e.shadowOffsetY=0,e.fillStyle="rgba(255,255,255,0.96)",e.beginPath(),e.moveTo(s-5,O+G),e.lineTo(s+5,O+G),e.lineTo(s,O+G+w),e.closePath(),e.fill(),e.strokeStyle="rgba(255,255,255,0.96)",e.lineWidth=1.5,e.beginPath(),e.moveTo(s-5,O+G),e.lineTo(s+5,O+G),e.stroke()),e.shadowBlur=0,e.shadowOffsetY=0,e.fillStyle="#1a1a1a",e.fillText(C,g+i,O+f)}),e.restore(),((L=ce[0])==null?void 0:L.by)||a}function De(e,s,a,v,o,i,f,w,B,Y,G,ye=0,Me=!1){var O;const ce=Ge?a:a+(f?w:0),L=ce+ue,C=Math.round(s-N/2),S=Math.round(L+Xe-j);if(e.save(),e.globalAlpha=.22,e.fillStyle="#000",e.beginPath(),e.ellipse(s,L+2,13,4.5,0,0,Math.PI*2),e.fill(),e.restore(),Ge){if(e.save(),!Me){const x=Date.now()%2500/2500,$e=Math.sin(x*Math.PI*2)*.015,Ct=1+$e*.5,Et=1+$e;e.translate(s,L+2),e.scale(Ct,Et),e.translate(-s,-(L+2))}e.imageSmoothingEnabled=!0,e.imageSmoothingQuality="high";const p=Ue(i,Me,ye),g=Te[p],H=p.startsWith("back")||p.startsWith("walk_back")?"back":p.startsWith("walk_L")?"left":p.startsWith("walk_R")?"right":"front";for(const x of g.order){const $e=(O=ee[p])==null?void 0:O[x];if(($e==null?void 0:$e.complete)&&$e.naturalWidth&&e.drawImage($e,C,S,N,j),f){const Ct=x==="head"?["face"]:x==="torso_top"?["shirt","dress"]:x==="torso_bottom"?["pants"]:[];for(const Et of Ct)if(Et==="face"){const Be=he[`face:${H==="right"?"left":H}`];(Be==null?void 0:Be.complete)&&Be.naturalWidth&&(H==="right"?(e.save(),e.translate(C+N,S),e.scale(-1,1),e.drawImage(Be,0,0,N,j),e.restore()):e.drawImage(Be,C,S,N,j))}else{const Be=he[`${Et}:${H}`];(Be==null?void 0:Be.complete)&&Be.naturalWidth&&e.drawImage(Be,C,S,N,j)}if(be&&(x==="arms_L"||x==="arms_R")&&H!=="front"){const Et=be[`${p}:${x}`];if(Et){const Be=Qe[`${Re}:${Et.f}`];(Be==null?void 0:Be.complete)&&Be.naturalWidth&&(Et.flip?(e.save(),e.translate(C+N,S),e.scale(-1,1),e.drawImage(Be,0,0,N,j),e.restore()):e.drawImage(Be,C,S,N,j))}}}}if(f&&H==="front"&&be&&Re)for(const x of["arms_L","arms_R"]){const $e=be[`${p}:${x}`];if($e){const Ct=Qe[`${Re}:${$e.f}`];(Ct==null?void 0:Ct.complete)&&Ct.naturalWidth&&e.drawImage(Ct,C,S,N,j)}}if(f&&H==="back"&&be){const x=Qe[`${Re}:${Ze}`];(x==null?void 0:x.complete)&&x.naturalWidth&&e.drawImage(x,C,S,N,j)}if(f){const x=he[`hair:${H}`];(x==null?void 0:x.complete)&&x.naturalWidth&&e.drawImage(x,C,S,N,j)}if(B){const x=(Math.sin(w*6)+1)/2;e.save(),e.strokeStyle=`rgba(76,200,100,${.55+x*.45})`,e.lineWidth=2+x*2,e.shadowColor="rgba(76,200,100,0.8)",e.shadowBlur=10+x*8,e.beginPath(),e.ellipse(s,S+j*.5,N*.52,j*.48,0,0,Math.PI*2),e.stroke(),e.restore()}e.restore(),f&&(e.save(),e.globalAlpha=.55,e.strokeStyle=o||"#aaeeff",e.lineWidth=2,e.shadowColor=o||"#aaeeff",e.shadowBlur=7,e.beginPath(),e.ellipse(s,L+2,13,4.5,0,0,Math.PI*2),e.stroke(),e.restore(
1)),e.font='bold 11px "Noto Sans Thai",Arial,sans-serif',e.textAlign="center";const Ce=e.measureText(v).width+5*2,ze=15,D=s-Ce/2,X=S-ze-4,Q=4;e.fillStyle="rgba(0,0,0,0.65)",e.beginPath(),e.moveTo(D+Q,X),e.lineTo(D+Ce-Q,X),e.arcTo(D+Ce,X,D+Ce,X+Q,Q),e.lineTo(D+Ce,X+ze-Q),e.arcTo(D+Ce,X+ze,D+Ce-Q,X+ze,Q),e.lineTo(D+Q,X+ze),e.arcTo(D,X+ze,D,X+ze-Q,Q),e.lineTo(D,X+Q),e.arcTo(D,X,D+Q,X,Q),e.closePath(),e.fill(),e.fillStyle="#fff",e.fillText(v,s,X+ze-3);const Pe=(G==null?void 0:G.length)>0?je(e,s,X,G):X;Y&&(e.font="20px serif",e.textAlign="center",e.fillText(Y,s,Pe-6))}else{const p=ue;if(B){const $e=(Math.sin(w*6)+1)/2;e.beginPath(),e.arc(s,ce,p+5+$e*4,0,Math.PI*2),e.strokeStyle=`rgba(76,200,100,${.45+$e*.45})`,e.lineWidth=2.5,e.stroke()}e.beginPath(),e.arc(s,ce,p,0,Math.PI*2),e.fillStyle=o||"#FFCDB0",e.fill(),e.strokeStyle=f?"#ffffff":"rgba(255,255,255,0.55)",e.lineWidth=f?2.5:1.5,e.stroke();const g={up:[0,-p+4],down:[0,p-4],left:[-p+4,0],right:[p-4,0]},[H,ve]=g[i]||[0,p-4];e.fillStyle="#fff",e.beginPath(),e.arc(s+H,ce+ve,3.5,0,Math.PI*2),e.fill(),e.font='bold 11px "Noto Sans Thai",Arial,sans-serif',e.textAlign="center";const ze=e.measureText(v).width+5*2,D=15,X=s-ze/2,Q=ce-p-D-4,Pe=4;e.fillStyle="rgba(0,0,0,0.58)",e.beginPath(),e.moveTo(X+Pe,Q),e.lineTo(X+ze-Pe,Q),e.arcTo(X+ze,Q,X+ze,Q+Pe,Pe),e.lineTo(X+ze,Q+D-Pe),e.arcTo(X+ze,Q+D,X+ze-Pe,Q+D,Pe),e.lineTo(X+Pe,Q+D),e.arcTo(X,Q+D,X,Q+D-Pe,Pe),e.lineTo(X,Q+Pe),e.arcTo(X,Q,X+Pe,Q,Pe),e.closePath(),e.fill(),e.fillStyle="#fff",e.fillText(v,s,Q+D-3);const x=(G==null?void 0:G.length)>0?je(e,s,Q,G):Q;Y&&(e.font="20px serif",e.textAlign="center",e.fillText(Y,s,x-6))}}let xe=0,Ke=0,it=0,Ve=0,jt=-1,rt=-1,fe=!1,bt=0,Kt=120,fs=0;const St=new Int32Array(T*A),Ot=new Int32Array(T*A),_s=new Int8Array([0,-1,0,1,-1,0,1,0]);function es(e,s){if(e<0||e>=T||s<0||s>=A)return!1;const a=ft[s][e];return!(ae.has(a)||a===n.MGR)}function Pt(e,s,a,v){if(e===a&&s===v)return null;const o=s*T+e,i=v*T+a;St.fill(-1),St[o]=o;let f=0,w=0;for(Ot[w++]=o;f<w;){const B=Ot[f++],Y=B%T,G=0|B/T;for(let ye=0;ye<8;ye+=2){const Me=Y+_s[ye],ce=G+_s[ye+1];if(Me<0||Me>=T||ce<0||ce>=A)continue;const L=ce*T+Me;if(!(St[L]!==-1||!es(Me,ce))){if(St[L]=B,L===i){let C=L;for(;St[C]!==o;)C=St[C];return{x:C%T,y:0|C/T}}Ot[w++]=L}}}return null}function vs(){if(fe){const o=Pt(it,Ve,0|_e/t,0|re/t);if(o){jt=it,rt=Ve,it=o.x,Ve=o.y;return}}const e=[{x:0,y:-1},{x:0,y:1},{x:-1,y:0},{x:1,y:0}],s=e.filter(o=>{const i=it+o.x,f=Ve+o.y;return es(i,f)&&!(i===jt&&f===rt)}),a=s.length?s:e.filter(o=>es(it+o.x,Ve+o.y));if(!a.length)return;const v=a[0|Math.random()*a.length];jt=it,rt=Ve,it+=v.x,Ve+=v.y}function ts(){const e=yt.filter(a=>{const v=0|a.x/t,o=0|a.y/t;return!(o>=15&&o<=23&&v>=19&&v<=31)}),s=e.length?e[0|Math.random()*e.length]:{x:7*t+t/2,y:4*t+t/2};xe=s.x,Ke=s.y,it=0|xe/t,Ve=0|Ke/t,jt=-1,rt=-1,fe=!1}function ps(){k.mapId==="horror-maze"&&(ts(),Kt=120,bt=3)}function Os(e){var Y,G;if(k.mapId!=="horror-maze")return;if(!k.isHost){if(k.externalGhostPos&&(xe=k.externalGhostPos.x,Ke=k.externalGhostPos.y,fe=!!k.externalGhostPos.chasing),bt>0){bt-=e;return}const ye=Math.sqrt((_e-xe)**2+(re-Ke)**2),Me=(Y=ft[0|re/t])==null?void 0:Y[0|_e/t];!k.missionOpen&&Me!==n.MGR&&ye<26&&(bt=3,fe=!1,le("ghostCatch"));return}if(Kt-=e,Kt<=0&&(ts(),Kt=120),bt>0){bt-=e;return}const s=Math.sqrt((_e-xe)**2+(re-Ke)**2);!fe&&s<130&&(fe=!0),fe&&s>200&&(fe=!1);const a=fe?oe:45,v=it*t+t/2,o=Ve*t+t/2,i=v-xe,f=o-Ke,w=Math.sqrt(i*i+f*f);w<a*e+1?(xe=v,Ke=o,vs()):(xe+=i/w*a*e,Ke+=f/w*a*e);const B=(G=ft[0|re/t])==null?void 0:G[0|_e/t];!k.missionOpen&&B!==n.MGR&&s<26&&(bt=3,fe=!1,le("ghostCatch")),fs-=e,fs<=0&&(fs=fe?.12:.6,le("ghostPosUpdate",{x:xe,y:Ke,chasing:fe}))}function Ps(e){e.save();const s=(Math.sin(zt*4)+1)/2,a=xe,v=Ke-8;e.globalAlpha=.8+s*.1,e.shadowColor=fe?"#ff3030":"#9090ff",e.shadowBlur=14+s*12,e.fillStyle=fe?"#ffe8e8":"#e4eaff",e.beginPath(),e.arc(a,v-5,11,Math.PI,0),e.lineTo(a+11,v+9);const o=v+9+s*3;e.quadraticCurveTo(a+7,o-3,a+3,v+9),e.quadraticCurveTo(a-1,o,a-5,v+9),e.quadraticCurveTo(a-9,o-3,a-11,v+9),e.closePath(),e.fill(),e.shadowBlur=0,e.globalAlpha=1,e.fillStyle=fe?"#cc0000":"#2222aa",e.beginPath(),e.arc(a-3.5,v-6,2.8,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(a+3.5,v-6,2.8,0,Math.PI*2),e.fill(),e.fillStyle=fe?"#ff8080":"#aaaaff",e.beginPath(),e.arc(a-3.5,v-6,1.2,0,Math.PI*2),e.fill(),e.beginPath(),e.arc(a+3.5,v-6,1.2,0,Math.PI*2),e.fill(),e.restore(
1)}const $t=h(null),hs=h(null);let _e=0,re=0,ss="down",zt=0,et=0,ls=!1;const Ie=new Set,kt=new Set,_t=h(!1),as=h(0),os=h(0),Vt=h(0),vt=h(0);let Xt=null,tt={x:0,y:0};const ct=48,ms=We(()=>({left:as.value-ct+"px",top:os.value-ct+"px",width:ct*2+"px",height:ct*2+"px"})),u=We(()=>({transform:`translate(${Vt.value}px,${vt.value}px)`}));function st(e){var a;const s=(a=document.activeElement)==null?void 0:a.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","KeyA","KeyD","KeyW","KeyS"].includes(e.code)&&(Ie.add(e.code),e.preventDefault())}function Ss(e){Ie.delete(e.code)}function Oe(){Ie.clear(),tt={x:0,y:0},Vt.value=0,vt.value=0,_t.value=!1,Xt=null}function gs(e){if(Xt!==null)return;const s=e.changedTouches[0];Xt=s.identifier;const a=$t.value.getBoundingClientRect();as.value=s.clientX-a.left,os.value=s.clientY-a.top,Vt.value=0,vt.value=0,tt={x:0,y:0},_t.value=!0}function bs(e){const s=Array.from(e.changedTouches).find(B=>B.identifier===Xt);if(!s)return;const a=$t.value.getBoundingClientRect(),v=s.clientX-a.left-as.value,o=s.clientY-a.top-os.value,i=Math.sqrt(v*v+o*o),f=Math.min(i,ct),w=Math.atan2(o,v);Vt.value=Math.cos(w)*f,vt.value=Math.sin(w)*f,tt={x:Math.cos(w)*(f/ct),y:Math.sin(w)*(f/ct)}}function $s(e){!Array.from(e.changedTouches).find(s=>s.identifier===Xt)||(Xt=null,Vt.value=0,vt.value=0,tt={x:0,y:0},_t.value=!1)}function ns(e,s){const a=Math.floor(e/t),v=Math.floor(s/t);return a<0||a>=T||v<0||v>=A?!0:ae.has(ft[v][a])}function Ms(e,s){const a=ue-4;return!ns(e-a,s-a)&&!ns(e+a,s-a)&&!ns(e-a,s+a)&&!ns(e+a,s+a)}let qt=null;function Gs(){var v;const e=Math.floor(_e/t),s=Math.floor(re/t);if(e<0||e>=T||s<0||s>=A)return;const a=(v=Je[ft[s][e]])!=null?v:null;a!==qt&&(qt&&le("zoneLeave",qt),a&&le("zoneEnter",a),qt=a)}function Ds(){for(let e=0;e<k.missionItems.length;e++){const s=k.missionItems[e];if(s.answered){kt.delete(s.qid);continue}const a=_e-s.x,v=re-s.y,o=Math.sqrt(a*a+v*v);if(o<=48&&!kt.has(s.qid)){kt.add(s.qid),le("missionItemClick",e);return}o>80&&kt.delete(s.qid)}}let ys=null,ks=0,Cs=0,Ft=-999,Es=-999;function Ut(e){const s=Math.min((e-ks)/1e3,.1);ks=e,zt=(zt+s*5.5)%(Math.PI*2);const a=Ie.has("ArrowLeft")||Ie.has("KeyA")||tt.x<-.2,v=Ie.has("ArrowRight")||Ie.has("KeyD")||tt.x>.2,o=Ie.has("ArrowUp")||Ie.has("KeyW")||tt.y<-.2,i=Ie.has("ArrowDown")||Ie.has("KeyS")||tt.y>.2;let f=0,w=0;const B=oe*(k.speedBoost?1.8:1);if(tt.x!==0||tt.y!==0){const G=Math.min(Math.sqrt(tt.x**2+tt.y**2),1);f=tt.x*B*s*G,w=tt.y*B*s*G}else f=((v?1:0)-(a?1:0))*B*s,w=((i?1:0)-(o?1:0))*B*s;f!==0&&w!==0&&(f*=.707,w*=.707),Math.abs(f)>Math.abs(w)?ss=f<0?"left":"right":w!==0&&(ss=w<0?"up":"down"),ls=f!==0||w!==0,ls&&(et=(et+s*2.5*(k.speedBoost?1.8:1))%(Math.PI*2)),f!==0&&Ms(_e+f,re)&&(_e+=f),w!==0&&Ms(_e,re+w)&&(re+=w),_e=Math.max(ue,Math.min(T*t-ue,_e)),re=Math.max(ue,Math.min(A*t-ue,re)),Gs(),Ds();const Y=Date.now();Y-Cs>80&&(Math.abs(_e-Ft)>.5||Math.abs(re-Es)>.5)&&(Ft=_e,Es=re,Cs=Y,le("positionUpdate",{x:_e,y:re,facing:ss})),Os(s),dt(s),ys=requestAnimationFrame(Ut)}const Qt={};function dt(e){var ce;const s=hs.value;if(!s)return;const a=zs||s.getContext("2d"),v=s.width,o=s.height,i=T*t<=v?-(v-T*t)/2:Math.max(0,Math.min(T*t-v,_e-v/2)),f=A*t<=o?-(o-A*t)/2:Math.max(0,Math.min(A*t-o,re-o/2));if(a.save(),a.translate(-Math.round(i),-Math.round(f)),ds)a.drawImage(ds,0,0);else{const L=Math.max(0,Math.floor(i/t)-1),C=Math.min(T-1,Math.ceil((i+v)/t)+1),S=Math.max(0,Math.floor(f/t)-1),O=Math.min(A-1,Math.ceil((f+o)/t)+1);for(let p=S;p<=O;p++)for(let g=L;g<=C;g++)Ht(a,g,p)}a.textAlign="center",a.textBaseline="middle",a.font='bold 18px "Noto Sans Thai",Arial,sans-serif';for(const L of At){const C=L.tx*t+t/2,S=L.ty*t+t/2;C<i-200||C>i+v+200||S<f-30||S>f+o+30||(a.fillStyle="rgba(255,255,255,0.18)",a.fillText(L.text,C,S))}a.textBaseline="alphabetic";for(const L of k.missionItems){if(L.answered)continue;const C=_e-L.x,S=re-L.y,O=Math.sqrt(C*C+S*S),p=O<=80;if(!k.hintsEnabled&&!p)continue;const g=L.x-t/2,H=L.y-t/2;if(g>i+v+t||g+t<i||H>f+o+t||H+t<f)continue;const ve=(Math.sin(zt*3)+1)/2,Mt=k.hintsEnabled?1:Math.min(1,(80-O)/32);if(a.save(),a.globalAlpha=Mt,k.hintsEnabled){const Ce=(Math.sin(zt*2)+1)/2;a.shadowColor="#FFD700",a.shadowBlur=14+Ce*14,a.strokeStyle=`rgba(255,${215+Math.round(Ce*40)},0,${.8+Ce*.2})`,a.lineWidth=3+Ce*1.5}else a.shadowColor="#FFD700",a.shadowBlur=8+ve*10,a.strokeStyle=`rgba(255,${200+Math.round(ve*55)},0,${.65+ve*.35})`,a.lineWidth=2+ve*1.5;a.strokeRect(g,H,t,t),a.shadowBlur=0,p&&(a.fillStyle="rgba(0,0,0,0.65)",a.beginPath(),a.roundRect(L.x-44,H-18,88,14,4),a.fill(),a.fillStyle="rgba(255,230,80,0.95)",a.font='9px "Noto Sans Thai",Arial,sans-serif',a.textAlign="center",a.textBaseline="middle",a.fillText("\u
10E40\u0E14\u0E34\u0E19\u0E40\u0E02\u0E49\u0E32\u0E43\u0E01\u0E25\u0E49\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E17\u0E33\u0E20\u0E32\u0E23\u0E01\u0E34\u0E08",L.x,H-11)),a.restore()}if(k.fuseBoxPos){const L=k.fuseBoxPos.x,C=k.fuseBoxPos.y,S=L-t/2,O=C-t/2;if(!(S>i+v+t||S+t<i||O>f+o+t||O+t<f)){const p=(Math.sin(zt*2.5)+1)/2,g=k.sabotageActive;a.save(),a.fillStyle=g?"#1a1000":"#1c2028",a.strokeStyle=g?`rgba(255,200,0,${.65+p*.35})`:"rgba(180,200,220,0.35)",a.lineWidth=g?2+p*1.5:1.5,g&&(a.shadowColor="#FFD700",a.shadowBlur=12+p*16),a.beginPath(),a.roundRect(S+2,O+2,t-4,t-4,3),a.fill(),a.stroke(),a.shadowBlur=0,a.font=`${g?14:11}px Arial`,a.textAlign="center",a.textBaseline="middle",a.fillStyle=g?`rgba(255,210,0,${.85+p*.15})`:"rgba(160,200,255,0.55)",a.fillText("\u26A1",L,C);const H=_e-L,ve=re-C;if(Math.sqrt(H*H+ve*ve)<80){const Mt=g?"\u0E04\u0E25\u0E34\u0E01\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E0B\u0E48\u0E2D\u0E21\u0E44\u0E1F":"\u0E44\u0E1F\u0E22\u0E31\u0E07\u0E1B\u0E01\u0E15\u0E34\u0E2D\u0E22\u0E39\u0E48 \u2014 \u0E01\u0E25\u0E31\u0E1A\u0E21\u0E32\u0E40\u0E21\u0E37\u0E48\u0E2D\u0E44\u0E1F\u0E14\u0E31\u0E1A",Ce=g?100:182;a.fillStyle="rgba(0,0,0,0.72)",a.beginPath(),a.roundRect(L-Ce/2,O-18,Ce,14,4),a.fill(),a.fillStyle=g?"rgba(255,220,50,0.95)":"rgba(180,220,255,0.85)",a.font='9px "Noto Sans Thai",Arial,sans-serif',a.textAlign="center",a.textBaseline="middle",a.fillText(Mt,L,O-11)}a.restore()}}const w=Math.sin(zt)*1.8,B=Math.min(1,(e||.016)*14);for(const[L,C]of Object.entries(k.otherPlayers)){Qt[L]||(Qt[L]={x:C.x,y:C.y,walkPh:0,isMoving:!1});const S=Qt[L],O=(C.x||S.x)-S.x,p=(C.y||S.y)-S.y;S.isMoving=Math.abs(O)>.8||Math.abs(p)>.8,S.isMoving&&(S.walkPh=(S.walkPh+(e||.016)*2.5)%(Math.PI*2)),S.x+=O*B,S.y+=p*B,S.name=C.name,S.color=C.color,S.facing=C.facing||"down",S.speaking=C.speaking,S.emote=C.emote,S.sid=L,S.isLocal=!1}for(const L of Object.keys(Qt))k.otherPlayers[L]||delete Qt[L];const Y=Object.values(Qt);k.mapId==="horror-maze"&&Ps(a);const G=[...Y,{x:_e,y:re,name:k.localPlayer.name,color:k.localPlayer.color,facing:ss,isLocal:!0,speaking:k.localPlayer.speaking,emote:k.localPlayer.emote,sid:k.localPlayer.sid,walkPh:et,isMoving:ls}].sort((L,C)=>L.y-C.y),ye=Date.now(),Me=5e3;for(const L of G){const C=(ce=k.chatMessages)==null?void 0:ce[L.sid],S=C?(C.msgs||[]).filter(O=>O.tsMs&&ye-O.tsMs<Me).map(O=>O.text):[];De(a,L.x,L.y,L.name,L.color,L.facing||"down",L.isLocal,w,L.speaking||!1,L.emote||null,S,L.walkPh||0,L.isMoving||!1)}if(a.restore(),k.mapId==="horror-maze"&&(a.save(),a.fillStyle="rgba(8,4,25,0.40)",a.fillRect(0,0,v,o),a.restore()),k.sabotageActive){const L=_e-i,C=re-f,S=130,O=40;a.save(),a.fillStyle="rgba(0,0,0,0.88)",a.beginPath(),a.rect(0,0,v,o),a.arc(L,C,S,0,Math.PI*2,!0),a.fill("evenodd"),(!Zt||Math.abs(L-qs)>2||Math.abs(C-Fs)>2)&&(Zt=a.createRadialGradient(L,C,S-O,L,C,S),Zt.addColorStop(0,"rgba(0,0,0,0)"),Zt.addColorStop(1,"rgba(0,0,0,0.88)"),qs=L,Fs=C),a.fillStyle=Zt,a.fillRect(0,0,v,o),a.restore()}}function Ne(){const e=hs.value,s=$t.value;!e||!s||(e.width=s.clientWidth,e.height=s.clientHeight,zs=e.getContext("2d"),Zt=null)}function Ts(){document.hidden?Oe():ks=performance.now()}function Is(){Oe()}function Ns(e){const s=hs.value;if(!s)return;const a=s.getBoundingClientRect(),v=e.clientX-a.left,o=e.clientY-a.top,i=T*t<=a.width?-(a.width-T*t)/2:Math.max(0,Math.min(T*t-a.width,_e-a.width/2)),f=A*t<=a.height?-(a.height-A*t)/2:Math.max(0,Math.min(A*t-a.height,re-a.height/2)),w=v+i,B=o+f;if(k.fuseBoxPos&&k.sabotageActive){const Y=k.fuseBoxPos.x,G=k.fuseBoxPos.y,ye=_e-Y,Me=re-G;Math.sqrt(ye*ye+Me*Me)<=80&&w>=Y-t/2&&w<=Y+t/2&&B>=G-t/2&&B<=G+t/2&&le("fuseBoxClick")}}let is=null,zs=null,Zt=null,qs=-9999,Fs=-9999;return sl(()=>{var e;_e=k.startX,re=k.startY,se(),Ws(),ps(),Ne(),is=new ResizeObserver(()=>Ne()),is.observe($t.value),window.addEventListener("keydown",st),window.addEventListener("keyup",Ss),window.addEventListener("blur",Oe),window.addEventListener("contextmenu",Is),document.addEventListener("visibilitychange",Ts),(e=$t.value)==null||e.focus(),ks=performance.now(),ys=requestAnimationFrame(Ut)}),Vs(()=>{ys&&cancelAnimationFrame(ys),is==null||is.disconnect(),window.removeEventListener("keydown",st),window.removeEventListener("keyup",Ss),window.removeEventListener("blur",Oe),window.removeEventListener("contextmenu",Is),document.removeEventListener("visibilitychange",Ts)}),Rt(()=>k.outfit,e=>{W(e)},{immediate:!0,deep:!0}),ge({getMazePool:()=>yt,respawnTo:(e,s)=>{_e=e,re=s}}),(e,s)=>(_(),m("div",{ref_key:"wrapperRef",ref:$t,class:"game-wrapper",tabindex:"0",onTouchstart:Ae(gs,["prevent"]),onTouchmove:Ae(bs,["prevent"]),onTouchend:Ae($s,["prevent"]),onTouchcancel:Ae($s,["prevent"]),onClick:Ns},[l("canvas",{ref_key:"canvasRef",ref:hs,class:"game-canvas"},null,512),_t.value?(_(),m("div",{key:0,class:"joy-base",style:ot(J(ms))},[l("div",{class:"joy-stick",style:ot(J(u))},null,4)],4)):K("",!0)],40,El))}};var Il=Rs(Tl,[["__scopeId","data-v-602b67ab"]]);const Ls=q=>
1(Bs("data-v-0a068827"),q=q(),As(),q),Bl={class:"qb-wrap"},Al={class:"qb-hdr"},Ol={class:"qb-hdr-row"},Pl=Ls(()=>l("span",{class:"qb-label"},"\u{1F3C0} Basketball",-1)),$l={class:"qb-num"},Gl={class:"qb-qtxt"},Dl={class:"qb-chips"},zl={class:"qb-chip-letter"},ql={class:"qb-chip-txt"},Fl={class:"qb-timebar"},Wl={class:"qb-time"},Nl=Ls(()=>l("div",{class:"qb-court-bg"},null,-1)),Yl={class:"qb-hoops"},Hl=["onClick","onTouchend"],jl={class:"qb-lbl"},Kl=Ls(()=>l("div",{class:"qb-rim"},null,-1)),Vl=Ls(()=>l("div",{class:"qb-net"},null,-1)),Xl=Rl('<svg viewBox="0 0 48 48" fill="none" data-v-0a068827><circle cx="24" cy="24" r="23" fill="url(#qb-grad)" stroke="#7a3e08" stroke-width="1.5" data-v-0a068827></circle><path d="M1 24 Q12 5 24 24 Q36 43 47 24" stroke="#603010" stroke-width="1.5" fill="none" data-v-0a068827></path><path d="M1 24 Q12 43 24 24 Q36 5 47 24" stroke="#603010" stroke-width="1.5" fill="none" data-v-0a068827></path><line x1="24" y1="1" x2="24" y2="47" stroke="#603010" stroke-width="1.5" data-v-0a068827></line><defs data-v-0a068827><radialGradient id="qb-grad" cx="36%" cy="30%" r="70%" data-v-0a068827><stop offset="0%" stop-color="#f4a030" data-v-0a068827></stop><stop offset="100%" stop-color="#be6210" data-v-0a068827></stop></radialGradient></defs></svg>',1),Ul=[Xl],Ql={key:0,class:"qb-hint"},Zl=Ls(()=>l("div",{class:"qb-floor"},null,-1)),Jl=["onTouchstart"],xl=Ls(()=>l("div",{class:"qb-idle-box"},[l("div",{class:"qb-idle-ico"},"\u{1F3C0}"),l("div",{class:"qb-idle-txt"},"\u0E41\u0E15\u0E30\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E40\u0E23\u0E34\u0E48\u0E21")],-1)),ea=[xl],ta={class:"qb-res-icon"},sa={class:"qb-res-txt"},la={key:0,class:"qb-res-hint"},aa=we(" \u0E40\u0E09\u0E25\u0E22 "),oa={__name:"quiz_basketball",props:{question:{type:Object,required:!0},questionNum:{type:Number,default:1},totalQ:{type:Number,default:5}},emits:["answer","close"],setup(q,{emit:ge}){const le=q,k=25,t=580,T=24,A=h(null),ue=h(null),oe=h([]),n=h(!1),ae=h(!1),j=h(!1),N=h(!1),Xe=h(-1),mt=h(0),Te=h(0),Ue=h(0),ee=h(k);let Ge=null,he=null;function Qe(){n.value||(n.value=!0,Ge=setInterval(()=>{if(j.value){clearInterval(Ge);return}ee.value--,ee.value<=0&&(clearInterval(Ge),j.value=!0,N.value=!1,ge("answer",{choiceIndex:-1,correct:!1}))},1e3))}Vs(()=>{clearInterval(Ge),he&&cancelAnimationFrame(he)});function be(Re){if(!n.value||j.value||ae.value)return;clearInterval(Ge),Xe.value=Re;const Ze=A.value,Ye=oe.value[Re],F=ue.value;if(!Ze||!Ye||!F)return;const W=Ze.getBoundingClientRect(),se=Ye.getBoundingClientRect(),ie=F.getBoundingClientRect(),Le=ie.left+ie.width/2-W.left,Se=ie.top+ie.height/2-W.top,Je=se.left+se.width/2-W.left,P=se.top+se.height*.38-W.top;mt.value=Le,Te.value=Se,ae.value=!0;const ut=Math.abs(Se-P)*.42+60,Nt=performance.now();function yt(cs){const ne=Math.min((cs-Nt)/t,1);mt.value=Le+(Je-Le)*ne,Te.value=Se+(P-Se)*ne-ut*4*ne*(1-ne),Ue.value=ne*720,ne<1?he=requestAnimationFrame(yt):(j.value=!0,N.value=Re===le.question.answer,ge("answer",{choiceIndex:Re,correct:N.value}))}he=requestAnimationFrame(yt)}return(Re,Ze)=>(_(),m("div",Bl,[l("div",Al,[l("div",Ol,[Pl,l("span",$l,R(q.questionNum)+"/"+R(q.totalQ),1)]),l("p",Gl,R(q.question.text),1),l("div",Dl,[(_(!0),m(me,null,nt(q.question.choices,(Ye,F)=>(_(),m("div",{key:F,class:"qb-chip"},[l("span",zl,R("ABCD"[F]),1),l("span",ql,R(Ye),1)]))),128))])]),l("div",Fl,[l("div",{class:"qb-fill",style:ot({width:ee.value/k*100+"%",background:ee.value>15?"#56c96e":ee.value>8?"#f0c040":"#e85d5d"})},null,4),l("span",Wl,R(ee.value)+"s",1)]),l("div",{class:"qb-arena",ref_key:"arenaRef",ref:A},[Nl,l("div",Yl,[(_(!0),m(me,null,nt(q.question.choices,(Ye,F)=>(_(),m("div",{key:F,ref_for:!0,ref:W=>{W&&(oe.value[F]=W)},class:V(["qb-cell",{gold:j.value&&F===q.question.answer&&!N.value,success:j.value&&N.value&&F===Xe.value,fail:j.value&&!N.value&&F===Xe.value}]),onClick:W=>be(F),onTouchend:Ae(W=>be(F),["prevent"])},[l("div",{class:V(["qb-board",`brd${F}`])},[l("span",jl,R("ABCD"[F]),1)],2),Kl,Vl],42,Hl))),128))]),l("div",{ref_key:"ballRef",ref:ue,class:V(["qb-ball",{idle:!ae.value}
1]),style:ot(ae.value?{left:mt.value-T+"px",top:Te.value-T+"px"}:{})},[l("div",{class:"qb-spin",style:ot({transform:`rotate(${Ue.value}deg)`})},Ul,4)],6),n.value&&!ae.value&&!j.value?(_(),m("p",Ql,"\u0E41\u0E15\u0E30\u0E2B\u0E48\u0E27\u0E07\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E22\u0E34\u0E07")):K("",!0),Zl,n.value?K("",!0):(_(),m("div",{key:1,class:"qb-idle",onClick:Qe,onTouchstart:Ae(Qe,["prevent"])},ea,40,Jl))],512),z(ke,{name:"qb-panel"},{default:U(()=>[j.value?(_(),m("div",{key:0,class:V(["qb-result",N.value?"ok":"no"])},[l("div",ta,R(N.value?"\u{1F3C0}":ee.value<=0?"\u23F0":"\u{1F62C}"),1),l("div",sa,R(N.value?"Swish! \u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07!":ee.value<=0?"\u0E2B\u0E21\u0E14\u0E40\u0E27\u0E25\u0E32!":"\u0E1C\u0E34\u0E14!"),1),N.value?K("",!0):(_(),m("div",la,[aa,l("strong",null,R("ABCD"[q.question.answer]),1),we(": "+R(q.question.choices[q.question.answer]),1)])),l("button",{class:"qb-close",onClick:Ze[0]||(Ze[0]=Ye=>ge("close"))},"\u0E1B\u0E34\u0E14")],2)):K("",!0)]),_:1})]))}};var na=Rs(oa,[["__scopeId","data-v-0a068827"]]);const ia={__name:"MissionModal",props:{question:{type:Object,required:!0},questionNum:{type:Number,default:1},totalQ:{type:Number,default:5}},emits:["answer","close"],setup(q,{emit:ge}){const le=Ll(na);return(k,t)=>(_(),at(Sl(J(le)),{question:q.question,questionNum:q.questionNum,totalQ:q.totalQ,onAnswer:t[0]||(t[0]=T=>ge("answer",T)),onClose:t[1]||(t[1]=T=>ge("close"))},null,40,["question","questionNum","totalQ"]))}};const ra=q=>(Bs("data-v-763b1a1e"),q=q(),As(),q),ca={class:"repair-overlay"},da={class:"repair-card"},ua=ra(()=>l("div",{class:"repair-header"},[l("span",{class:"repair-icon"},"\u26A1"),l("div",null,[l("div",{class:"repair-title"},"\u0E0B\u0E48\u0E2D\u0E21\u0E15\u0E39\u0E49\u0E44\u0E1F"),l("div",{class:"repair-sub"},"\u0E41\u0E15\u0E30\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23\u0E43\u0E2B\u0E49\u0E40\u0E1B\u0E47\u0E19\u0E04\u0E33\u0E15\u0E32\u0E21\u0E25\u0E33\u0E14\u0E31\u0E1A")])],-1)),fa={class:"target-row"},_a={class:"tile-grid"},va=["disabled","onClick"],pa={class:"hint-row"},ha=we("\u0E40\u0E1B\u0E49\u0E32\u0E2B\u0E21\u0E32\u0E22: "),ma={class:"hint-word"},ga={__name:"RepairMinigame",emits:["repaired"],setup(q,{emit:ge}){const le=["POWER","LIGHT","STORM","FLAME","SHOCK"],k=["X","Q","Z","J","V","N","U","B","D","Y"],t=h(""),T=h([]),A=h(""),ue=h(!1);sl(()=>{const n=le[Math.floor(Math.random()*le.length)];t.value=n;const ae=[...n.split("")],j=new Set(ae),N=k.filter(Xe=>!j.has(Xe));N.sort(()=>Math.random()-.5),N.slice(0,4).forEach(Xe=>ae.push(Xe)),ae.sort(()=>Math.random()-.5),T.value=ae.map(Xe=>({letter:Xe,used:!1,wrong:!1}))});function oe(n){if(T.value[n].used)return;const ae=t.value[A.value.length];T.value[n].letter===ae?(T.value[n].used=!0,A.value+=T.value[n].letter,A.value===t.value&&setTimeout(()=>ge("repaired"),420)):(T.value[n].wrong=!0,setTimeout(()=>{T.value[n].wrong=!1},360),ue.value=!0,setTimeout(()=>{ue.value=!1},700),T.value.forEach(j=>{j.used=!1}),A.value="")}return(n,ae)=>(_(),m("div",ca,[l("div",da,[ua,l("div",fa,[(_(!0),m(me,null,nt(t.value.split(""),(j,N)=>(_(),m("span",{key:N,class:V(["target-box",{filled:N<A.value.length}])},R(N<A.value.length?A.value[N]:""),3))),128))]),l("div",_a,[(_(!0),m(me,null,nt(T.value,(j,N)=>(_(),m("button",{key:N,class:V(["tile-btn",{used:j.used,wrong:j.wrong}]),disabled:j.used,onClick:Xe=>oe(N)},R(j.letter),11,va))),128))]),l("div",{class:V(["feedback-bar",{show:ue.value}])},"\u0E1C\u0E34\u0E14! \u0E40\u0E23\u0E34\u0E48\u0E21\u0E43\u0E2B\u0E21\u0E48",2),l("div",pa,[ha,l("span",ma,R(t.value),1)])])]))}};var ba=Rs(ga,[["__scopeId","data-v-763b1a1e"]]);const al=q=>(Bs("data-v-11448900"),q=q(),As(),q),ya=["onClick"],ka={class:"wd-panel"},wa=al(()=>l("span",{class:"wd-title"},"\u{1F457} \u0E41\u0E15\u0E48\u0E07\u0E15\u0E31\u0E27",-1)),Ra={class:"wd-body"},La={class:"wd-preview"},Sa={class:"wd-selector"},Ma={class:"wd-tabs"},Ca=["onClick"],Ea={class:"wd-grid"},Ta=al(()=>l("span",{class:"none-label"},"\u0E44\u0E21\u0E48\u0E43\u0E2A\u0E48",-1)),Ia=[Ta],Ba=["onClick"],Aa=["src"],Oa={key:0,class:"wd-empty"},Pa={__name:"WardrobeModal",props:{modelValue:Boolean,outfit:{type:Object,default:()=>({})}},emits:["update:modelValue","update:outfit"],setup(q,{emit:ge}){const le=q,k=4,t=34,T=64,A=t*k,ue=T*k,oe="/images/mapts/Avatar/",n={shirt:"/images/mapts/clothes/top/",dress:"/images/mapts/clothes/",pants:"/images/mapts/clothes/",face:"/images/mapts/face/",hair:"/images/mapts/hair/"},ae=[{key:"shirt",label:"\u0E40\u0E2A\u0E37\u0E49\u0E2D"},{key:"pants",label:"\u0E01\u0E32\u0E07\u0E40\u0E01\u0E07"},{key:"hair",label:"\u0E1C\u0E21"},{key:"face",label:"\u0E2B\u0E19\u0E49\u0E32"},{key:"dress",label:"\u0E40\u0E14\u0E23\u0E2A"}],j={shirt:[{id:"01",thumb:"/images/mapts/clothes/top/01/c01.png"},{id:"02",thumb:"/images/mapts/clothes/top/02/c02.png"},{id:"03",thumb:"/images/mapts/clothes/top/03/c03.png"},{id:"04",thumb:"/images/mapts/clothes/top/04/c04.png"}],pants:[],hair:[{id:"m01",thumb:"/images/mapts/hair/m01/m01.png"},{id:"m02",thumb:"/images/mapts/hair/m02/m02.png"},{id:"w01",thumb:"/images/mapts/hair/w01/w01.png"},{id:"w02",thumb:"/images/mapts/hair/w02/w02.png"}],face:[{id:"m01",thumb:"/images/mapts/face/m01/m01.png"},{id:"m02",thumb:"/images/mapts/face/m02/m02.png"},{id:"w01",thumb:"/images/mapts/face/w01/w01.png"},{id:"w02",thumb:"/images/mapts/face/w02/w02.png"}],dress:[]},N=["legs_L","legs_R","arms_L","arms_R","torso_bottom","torso_top","head"],Xe={head:"head/head_front.png",torso_top:"torso_top/torso_top_front.png",torso_bottom:"torso_bottom/torso_bottom_font_and_back.png",arms_L:"arms/arm_front_idle_L.png",arms_R:"arms/arm_front_idle_R.png",legs_L:"legs/legs_front_idle_L.png",legs_R:"legs/legs_front_idle_R.png"},mt={head:["face"],torso_top:["shirt","dress"],torso_bottom:["pants"]},Te=h(null),Ue=h("shirt"),ee=ll({shirt:null,pants:null,hair:null,face:null,dress:null}),Ge={},he={};function Qe(){for(const[F,W]of Object.entries(Xe)){if(Ge[F])continue;const se=new Image;se.src=oe+W,se.onload=Re,Ge[F]=se}}function be(F,W){const se=`${F}:${W}`;if(he[se])return he[se];const ie=new Image;return ie.src=`${n[F]||"/images/mapts/clothes/"}${W}/font.png`,ie.onload=Re,he[se]=ie,ie}function Re(){const F=Te.value;if(!F)return;const W=F.getContext("2d");W.clearRect(0,0,A,ue),W.imageSmoothingEnabled=!0,W.imageSmoothingQuality="high";for(const ie of N){const Le=Ge[ie];
1(Le==null?void 0:Le.complete)&&Le.naturalWidth&&W.drawImage(Le,0,0,A,ue);for(const Se of mt[ie]||[]){const Je=ee[Se];if(!Je)continue;const P=be(Se,Je);(P==null?void 0:P.complete)&&P.naturalWidth&&W.drawImage(P,0,0,A,ue)}if((ie==="arms_L"||ie==="arms_R")&&ee.shirt){const Se=`__slv_${ee.shirt}`;if(!he[Se]){const P=new Image;P.src=`${n.shirt}${ee.shirt}/sleeve_font.png`,P.onload=Re,he[Se]=P}const Je=he[Se];(Je==null?void 0:Je.complete)&&Je.naturalWidth&&W.drawImage(Je,0,0,A,ue)}}const se=ee.hair;if(se){const ie=be("hair",se);(ie==null?void 0:ie.complete)&&ie.naturalWidth&&W.drawImage(ie,0,0,A,ue)}}function Ze(F){ee[Ue.value]=F,ge("update:outfit",{...ee}),Gt(Re)}function Ye(){ge("update:modelValue",!1)}return Rt(()=>le.modelValue,async F=>{!F||(Object.assign(ee,{shirt:null,pants:null,hair:null,face:null,dress:null,...le.outfit}),Qe(),await Gt(),Re())}),Rt(()=>le.outfit,F=>{!F||!le.modelValue||(Object.assign(ee,F),Gt(Re))},{deep:!0}),(F,W)=>(_(),at(ke,{name:"wd-fade"},{default:U(()=>[q.modelValue?(_(),m("div",{key:0,class:"wd-overlay",onClick:Ae(Ye,["self"])},[l("div",ka,[l("div",{class:"wd-header"},[wa,l("button",{class:"wd-close",onClick:Ye},"\u2715")]),l("div",Ra,[l("div",La,[l("canvas",{ref_key:"previewRef",ref:Te,width:A,height:ue,class:"wd-canvas"},null,512)]),l("div",Sa,[l("div",Ma,[(_(),m(me,null,nt(ae,se=>l("button",{key:se.key,class:V(["wd-tab",{active:Ue.value===se.key}]),onClick:ie=>Ue.value=se.key},R(se.label),11,Ca)),64))]),l("div",Ea,[l("button",{class:V(["wd-slot none-slot",{sel:!ee[Ue.value]}]),onClick:W[0]||(W[0]=se=>Ze(null))},Ia,2),(_(!0),m(me,null,nt(j[Ue.value],se=>(_(),m("button",{key:se.id,class:V(["wd-slot",{sel:ee[Ue.value]===se.id}]),onClick:ie=>Ze(se.id)},[l("img",{src:se.thumb,class:"wd-thumb"},null,8,Aa)],10,Ba))),128)),j[Ue.value].length?K("",!0):(_(),m("div",Oa," \u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E44\u0E2D\u0E40\u0E17\u0E21 "))])])])])],8,ya)):K("",!0)]),_:1}))}};var $a=Rs(Pa,[["__scopeId","data-v-11448900"]]);const xt=q=>(Bs("data-v-de56af5c"),q=q(),As(),q),Ga={key:0,class:"result-overlay"},Da={class:"result-card"},za=xt(()=>l("div",{class:"result-header"},[l("div",{class:"result-icon"},"\u{1F389}"),l("div",{class:"result-title"},"\u0E20\u0E32\u0E23\u0E01\u0E34\u0E08\u0E40\u0E2A\u0E23\u0E47\u0E08\u0E2A\u0E34\u0E49\u0E19!")],-1)),qa={class:"score-section"},Fa={class:"score-circle"},Wa={class:"score-ring",viewBox:"0 0 120 120"},Na=xt(()=>l("circle",{cx:"60",cy:"60",r:"54",class:"score-ring-bg"},null,-1)),Ya={class:"score-text"},Ha={class:"score-number"},ja={class:"score-percent"},Ka={class:"stats-grid"},Va={class:"stat-item"},Xa=xt(()=>l("div",{class:"stat-icon"},"\u2B50",-1)),Ua=xt(()=>l("div",{class:"stat-label"},"\u0E04\u0E30\u0E41\u0E19\u0E19",-1)),Qa={class:"stat-value"},Za={class:"stat-item"},Ja=xt(()=>l("div",{class:"stat-icon"},"\u23F1\uFE0F",-1)),xa=xt(()=>l("div",{class:"stat-label"},"\u0E40\u0E27\u0E25\u0E32",-1)),eo={class:"stat-value"},to={class:"stat-item"},so=xt(()=>l("div",{class:"stat-icon"},"\u2705",-1)),lo=xt(()=>l("div",{class:"stat-label"},"\u0E16\u0E39\u0E01",-1)),ao={class:"stat-value"},oo={class:"stars-display"},no={class:"result-message"},io={__name:"ResultModal",props:{show:{type:Boolean,default:!1},correct:{type:Number,default:0},total:{type:Number,default:5},timeSeconds:{type:Number,default:0}},emits:["close"],setup(q,{emit:ge}){const le=q,k=339.29,t=We(()=>le.total===0?0:Math.round(le.correct/le.total*100)),T=We(()=>{const oe=t.value;return oe>=90?5:oe>=80?4:oe>=70?3:oe>=60?2:oe>=50?1:0}),A=We(()=>{const oe=Math.floor(le.timeSeconds/60),n=le.timeSeconds%60;return`${oe}:${String(n).padStart(2,"0")}`});function ue(){const oe=t.value;return oe===100?"\u0E2A\u0E38\u0E14\u0E22\u0E2D\u0E14! \u0E17\u0E33\u0E44\u0E14\u0E49\u0E04\u0E23\u0E1A 100%!":oe>=90?"\u0E40\u0E22\u0E35\u0E48\u0E22\u0E21\u0E21\u0E32\u0E01! \u0E17\u0E33\u0E44\u0E14\u0E49\u0E40\u0E01\u0E37\u0E2D\u0E1A\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14":oe>=80?"\u0E14\u0E35\u0E21\u0E32\u0E01! \u0E17\u0E33\u0E43\u0E2B\u0E49\u0E14\u0E35\u0E40\u0E25\u0E22\u0E19\u0E30":oe>=70?"\u0E14\u0E35! \u0E44\u0E14\u0E49\u0E19\u0E30\u0E04\u0E23\u0E31\u0E1A":oe>=60?"\u0E1E\u0E2D\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13 \u0E25\u0E2D\u0E07\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07\u0E2B\u0E19\u0E48\u0E2D\u0E22\u0E19\u0E30":"\u0E1D\u0E36\u0E01\u0E1D\u0E19\u0E1A\u0E49\u0E32\u0E07\u0E01\u0E47\u0E08\u0E30\u0E14\u0E35\u0E02\u0E36\u0E49\u0E19!"}return(oe,n)=>(_(),at(ke,{name:"result-pop"},{default:U(()=>[q.show?(_(),m("div",Ga,[l("div",Da,[za,l("div",qa,[l("div",Fa,[(_(),m("svg",Wa,[Na,l("circle",{cx:"60",cy:"60",r:"54",class:"score-ring-fill",style:ot({strokeDasharray:`${k*J(t)} ${k}`})},null,4)])),l("div",Ya,[l("div",Ha,R(q.correct)+"/"+R(q.total),1),l("div",ja,R(J(t))+"%",1)])])]),l("div",Ka,[l("div",Va,[Xa,Ua,l("div",Qa,R(J(T))+"/5",1)]),l("div",Za,[Ja,xa,l("div",eo,R(J(A)),1)]),l("div",to,[so,lo,l("div",ao,R(q.correct),1)])]),l("div",oo,[(_(),m(me,null,nt(5,ae=>l("span",{key:ae,class:V(["star",{filled:ae<=J(T)}])},"\u2B50",2)),64))]),l("div",no,R(ue()),1),l("button",{class:"btn-close",onClick:n[0]||(n[0]=ae=>oe.$emit("close"))}," \u2715 \u0E1B\u0E34\u0E14 ")])])):K("",!0)]),_:1}))}};var ro=Rs(io,[["__scopeId","data-v-de56af5c"]]);const E=q=>(Bs("data-v-4b72d06e"),q=q(),As(),q),co={class:"mapts-root"},uo={key:0,class:"screen-center"},fo=E(()=>l("div",{class:"lobby-deco","aria-hidden":"true"},[l("span",{class:"deco d1"},"\u{1F3E2}"),l("span",{class:"deco d2"},"\u{1F33F}"),l("span",{class:"deco d3"},"\u{1F3EB}"),l("span",{class:"deco d4"},"\u26F2"),l("span",{class:"deco d5"},"\u{1F47B}"),l("span",{class:"deco d6"},"\u2601\uFE0F")],-1)),_o={class:"setup-card lobby-card"},vo=E(()=>l("div",{class:"setup-icon lobby-globe"},"\u{1F30D}",-1)),po=E(()=>l("div",{class:"setup-title lobby-title"},"Winner World",-1)),ho=E(()=>l("div",{class:"setup-sub"},"\u0E0A\u0E27\u0E19\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E19\u0E21\u0E32\u0E40\u0E14\u0E34\u0E19\u0E40\u0E25\u0E48\u0E19 \u0E41\u0E0A\u0E17 \u0E41\u0E25\u0E30\u0E17\u0E33\u0E20\u0E32\u0E23\u0E01\u0E34\u0E08\u0E14\u0E49\u0E27\u0E22\u0E01\u0E31\u0E19",-1)),mo=E(()=>l("div",{class:"lobby-map-chips"},[l("span",{class:"map-chip"},"\u{1F3E2} Office"),l("span",{class:"map-chip"},"\u{1F33F} Maze"),l("span",{class:"map-chip"},"\u{1F3EB} School"),l("span",{class:"map-chip chip-horror"},"\u{1F47B} Horror")],-1)),go=we("\u2728 \u0E2A\u0E23\u0E49\u0E32\u0E07\u0E2B\u0E49\u0E2D\u0E07"),bo=we("\u{1F6AA} \u0E40\u0E02\u0E49\u0E32\u0E23\u0E48\u0E27\u0E21\u0E2B\u0E49\u0E2D\u0E07"),yo=we("\u{1F310} \u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C"),ko={key:0,class:"screen-center"},wo={class:"setup-card"},Ro=E(()=>l("div",{class:"setup-icon"},"\u{1F6AA}",-1)),Lo=E(()=>l("div",{class:"setup-title"},"\u0E40\u0E02\u0E49\u0E32\u0E23\u0E48\u0E27\u0E21\u0E2B\u0E49\u0E2D\u0E07",-1)),So={key:0,class:"error-msg"},Mo=we("\u0E40\u0E02\u0E49\u0E32\u0E23\u0E48\u0E27\u0E21"),Co=we("\u2190 \u0E22\u0E49\u0E2D\u0E19\u0E01\u0E25\u0E31\u0E1A"),Eo={key:0,class:"screen-center"},To={class:"setup-card"},Io=E(()=>l("div",{class:"setup-icon"},"\u2728",-1)),Bo=E(()=>l("div",{class:"setup-title"},"\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E2B\u0E49\u0E2D\u0E07",-1)),Ao=E(()=>l("div",{class:"setup-sub"},"\u0E15\u0E31\u0E49\u0E07\u0E0A\u0E37\u0E48\u0E2D\u0E43\u0E2B\u0E49\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13",
1-1)),Oo=E(()=>l("div",{class:"field-label",style:{"align-self":"flex-start"}},"\u0E0A\u0E37\u0E48\u0E2D\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C",-1)),Po=E(()=>l("div",{class:"field-label",style:{"align-self":"flex-start"}},"\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E21\u0E1E",-1)),$o={class:"map-selector"},Go=["onClick"],Do={class:"map-option-label"},zo={class:"map-option-desc"},qo={class:"map-mode-row"},Fo=["onClick"],Wo=["disabled","onClick"],No={class:"public-toggle-info"},Yo={class:"public-toggle-label"},Ho={class:"public-toggle-sub"},jo=E(()=>l("div",{class:"public-toggle-thumb"},null,-1)),Ko=[jo],Vo=we("\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E2B\u0E49\u0E2D\u0E07\u0E40\u0E25\u0E22 \u2192"),Xo=we("\u2190 \u0E22\u0E49\u0E2D\u0E19\u0E01\u0E25\u0E31\u0E1A"),Uo={key:0,class:"screen-center"},Qo={class:"setup-card"},Zo=E(()=>l("div",{class:"setup-icon"},"\u23F3",-1)),Jo=E(()=>l("div",{class:"setup-title"},"\u0E23\u0E2D\u0E01\u0E32\u0E23\u0E2D\u0E19\u0E38\u0E21\u0E31\u0E15\u0E34",-1)),xo={class:"setup-sub"},en=we("\u0E42\u0E2E\u0E2A\u0E02\u0E2D\u0E07 "),tn=we(" \u0E01\u0E33\u0E25\u0E31\u0E07\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E04\u0E33\u0E02\u0E2D\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13"),sn={class:"pending-spinner"},ln=we("\u2190 \u0E22\u0E01\u0E40\u0E25\u0E34\u0E01"),an={key:0,class:"screen-center"},on={class:"setup-card"},nn={class:"room-code-box"},rn=E(()=>l("div",{class:"rc-label"},"\u0E23\u0E2B\u0E31\u0E2A\u0E2B\u0E49\u0E2D\u0E07",-1)),cn={class:"rc-row"},dn={class:"rc-val"},un=we("\u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01"),fn=E(()=>l("div",{class:"rc-hint"},"\u0E41\u0E0A\u0E23\u0E4C\u0E23\u0E2B\u0E31\u0E2A\u0E19\u0E35\u0E49\u0E43\u0E2B\u0E49\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E19",-1)),_n=E(()=>l("div",{class:"divider"},null,-1)),vn=E(()=>l("div",{class:"field-label"},"\u0E0A\u0E37\u0E48\u0E2D\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13",-1)),pn={class:"color-row"},hn=E(()=>l("span",null,"\u0E2A\u0E35\u0E15\u0E31\u0E27\u0E25\u0E30\u0E04\u0E23",-1)),mn=we("\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E41\u0E21\u0E1E \u2192"),gn={key:0,class:"game-root"},bn={class:"chat-sidebar"},yn={class:"chat-header"},kn={key:0,class:"dm-chat-header"},wn={class:"chat-title",style:{"font-size":"13px"}},Rn=E(()=>l("div",{style:{"font-size":"10px",color:"rgba(255,255,255,0.4)"}},"\u0E41\u0E0A\u0E17\u0E2A\u0E48\u0E27\u0E19\u0E15\u0E31\u0E27",-1)),Ln={key:1,class:"chat-title"},Sn={class:"chat-target-row"},Mn=E(()=>l("span",{class:"dm-mode-tag"},"\u{1F4AC} \u0E2A\u0E48\u0E27\u0E19\u0E15\u0E31\u0E27",-1)),Cn={key:0,class:"chat-empty"},En={class:"msg-bubble"},Tn={class:"msg-meta"},In={class:"msg-name"},Bn={key:0,class:"msg-nearby-tag"},An={class:"msg-time"},On={class:"msg-text"},Pn={class:"chat-input-row"},$n=["placeholder","onKeyup"],Gn={class:"top-bar"},Dn={class:"top-left"},zn=we("\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E41\u0E21\u0E1E"),qn={class:"top-center"},Fn={class:"mission-bar"},Wn=E(()=>l("span",{class:"mission-bar-icon"},"\u26A1",-1)),Nn=E(()=>l("span",{class:"mission-bar-label"},"\u0E20\u0E32\u0E23\u0E01\u0E34\u0E08",-1)),Yn={class:"mission-bar-track"},Hn=E(()=>l("div",{class:"mission-bar-shine"},null,-1)),jn=[Hn],Kn={class:"mission-bar-pct"},Vn={key:0,class:"mission-host-tag"},Xn={class:"top-right",style:{display:"flex","align-items":"center",gap:"8px"}},Un={class:"room-hud-code"},Qn={class:"room-hud-count"},Zn={key:0,class:"nearby-strip"},Jn=E(()=>l("div",{class:"nearby-label"},"\u0E43\u0E19\u0E42\u0E0B\u0E19\u0E19\u0E35\u0E49",-1)),xn={key:0,class:"speaking-ring"},ei={class:"nearby-name"},ti={key:0,class:"mic-on"},si={key:0,class:"sabotage-banner"},li=E(()=>l("span",{class:"sab-icon"},"\u26A1",-1)),ai=E(()=>l("span",{class:"sab-text"},"\u0E44\u0E1F\u0E14\u0E31\u0E1A! \u0E23\u0E35\u0E1A\u0E44\u0E1B\u0E0B\u0E48\u0E2D\u0E21\u0E15\u0E39\u0E49\u0E44\u0E1F",-1)),oi=E(()=>l("span",{class:"sab-blink"},"\u25BC",-1)),ni=[li,ai,oi],ii={class:"bottom-bar"},ri={class:"bb-left"},ci={class:"my-info"},di={class:"my-name"},ui={class:"my-zone"},fi={class:"bb-center"},_i={key:0,class:"ctrl-btn-wrap host-settings-wrap",style:{position:"relative"}}
1,vi=E(()=>l("span",{class:"ctrl-icon"},"\u{1F3EB}",-1)),pi=[vi],hi=E(()=>l("div",{class:"ctrl-label"},"\u0E04\u0E27\u0E1A\u0E04\u0E38\u0E21\u0E2B\u0E49\u0E2D\u0E07",-1)),mi={key:1,class:"ctrl-btn-wrap",style:{position:"relative"}},gi=["disabled","onClick"],bi={class:"ctrl-icon"},yi={class:"ctrl-label sab-label"},ki=E(()=>l("div",{class:"sab-confirm-title"},"\u26A1 \u0E14\u0E31\u0E1A\u0E44\u0E1F\u0E40\u0E25\u0E22\u0E21\u0E31\u0E49\u0E22?",-1)),wi={class:"ctrl-btn-wrap"},Ri={class:"ctrl-icon"},Li={class:"ctrl-label"},Si={class:"ctrl-btn-wrap"},Mi=E(()=>l("span",{class:"ctrl-icon"},"\u{1F60A}",-1)),Ci=[Mi],Ei=E(()=>l("div",{class:"ctrl-label"},"Emote",-1)),Ti={class:"ctrl-btn-wrap"},Ii=E(()=>l("span",{class:"ctrl-icon"},"\u{1F457}",-1)),Bi=[Ii],Ai=E(()=>l("div",{class:"ctrl-label"},"\u0E41\u0E15\u0E48\u0E07\u0E15\u0E31\u0E27",-1)),Oi={class:"bb-right"},Pi=E(()=>l("span",null,"\u{1F465}",-1)),$i=[Pi],Gi=E(()=>l("span",null,"\u{1F4AC}",-1)),Di={key:0,class:"unread-badge"},zi={key:0,class:"emote-picker"},qi=["onClick"],Fi={key:0,class:"zone-popup"},Wi={class:"zone-popup-icon"},Ni={class:"zone-popup-text"},Yi={class:"players-sidebar"},Hi={class:"chat-header"},ji={class:"chat-title"},Ki={class:"players-body"},Vi={class:"player-row local-row"},Xi={class:"player-row-info"},Ui={class:"player-row-name"},Qi=E(()=>l("span",{class:"you-tag"},"\u0E04\u0E38\u0E13",-1)),Zi={class:"player-row-zone"},Ji=E(()=>l("div",{class:"players-divider"},null,-1)),xi={class:"player-row-info"},er={class:"player-row-name"},tr={class:"player-row-zone"},sr=["onClick"],lr={key:1,class:"players-empty"},ar={key:0,class:"kicked-overlay"},or={class:"kicked-card"},nr=E(()=>l("div",{class:"kicked-icon"},"\u{1F6AB}",-1)),ir=E(()=>l("div",{class:"kicked-title"},"\u0E16\u0E39\u0E01\u0E19\u0E33\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C",-1)),rr=E(()=>l("div",{class:"kicked-sub"},"\u0E42\u0E2E\u0E2A\u0E44\u0E14\u0E49\u0E19\u0E33\u0E04\u0E38\u0E13\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E2B\u0E49\u0E2D\u0E07\u0E19\u0E35\u0E49",-1)),cr={class:"sm-card"},dr={class:"sm-header"},ur=E(()=>l("div",{class:"sm-title"},"\u0E08\u0E31\u0E14\u0E01\u0E32\u0E23\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C",-1)),fr={class:"sm-subtitle"},_r={class:"sm-tabs"},vr=we(" \u0E2A\u0E21\u0E32\u0E0A\u0E34\u0E01 "),pr={key:0,class:"sm-tab-badge"},hr=we(" \u0E23\u0E2D\u0E2D\u0E19\u0E38\u0E21\u0E31\u0E15\u0E34 "),mr={key:0,class:"sm-tab-badge sm-tab-badge-warn"},gr={class:"sm-content"},br={key:0,class:"sm-loading"},yr={class:"sv-toggle-info"},kr={class:"sv-toggle-label"},wr={class:"sv-toggle-sub"},Rr=E(()=>l("div",{class:"sv-toggle-thumb"},null,-1)),Lr=[Rr],Sr={class:"sv-toggle-info"},Mr={class:"sv-toggle-label"},Cr=E(()=>l("div",{class:"sv-toggle-sub"},"\u0E41\u0E2A\u0E14\u0E07\u0E04\u0E33\u0E43\u0E1A\u0E49\u0E43\u0E19\u0E42\u0E08\u0E17\u0E22\u0E4C",-1)),Er=E(()=>l("div",{class:"sv-toggle-thumb"},null,-1)),Tr=[Er],Ir={class:"sv-toggle-info"},Br={class:"sv-toggle-label"},Ar={class:"sv-toggle-sub"},Or=E(()=>l("div",{class:"sv-toggle-thumb"},null,-1)),Pr=[Or],$r=E(()=>l("div",{class:"sv-section-label"},"\u{1F5FA}\uFE0F \u0E41\u0E21\u0E1E",-1)),Gr={class:"map-selector"},Dr=["onClick"],zr={class:"map-option-label"},qr={class:"map-option-desc"},Fr={class:"map-mode-row"},Wr=["onClick"],Nr=["disabled","onClick"],Yr={key:0,class:"sm-loading"},Hr={key:1,class:"sm-empty"},jr=E(()=>l("div",{style:{"font-size":"28px"}},"\u{1F47B}",-1)),Kr=E(()=>l("div",null,"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E2A\u0E21\u0E32\u0E0A\u0E34\u0E01\u0E43\u0E19\u0E2B\u0E49\u0E2D\u0E07\u0E15\u0E2D\u0E19\u0E19\u0E35\u0E49",-1)),Vr=[jr,Kr],Xr={key:2,class:"sm-member-list"},Ur={class:"sm-member-name"},Qr=["onClick"],Zr={key:0,class:"sm-loading"},Jr={key:1,class:"sm-empty"},xr=E(()=>l("div",{style:{"font-size":"28px"}},"\u{1F4ED}",-1)),ec=E(()=>l("div",null,"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E33\u0E02\u0E2D\u0E23\u0E2D\u0E2D\u0E19\u0E38\u0E21\u0E31\u0E15\u0E34",-1)),tc=[xr,ec],sc={key:2,class:"sm-member-list"},lc={class:"sm-member-name"},ac={style:{display:"flex",gap:"6px","margin-left":"auto"}},oc=["onClick"],nc=["onClick"],ic={class:"ms-modal"},rc={class:"ms-modal-header"},cc=E(()=>l("span",{class:"ms-modal-title"},"\u{1F310} \u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C",-1)),dc={style:{display:"flex","align-items":"center",gap:"8px"}},uc=E(()=>l("span",{class:"ms-clear-confirm-text"},"\u0E41\u0E19\u0E48\u0E43\u0E08?",-1)),fc=["disabled"],_c={key:1},vc=["disabled"],pc={class:"ms-tabs"},hc=we(" \u0E2A\u0E32\u0E18\u0E32\u0E23\u0E13\u0E30 "),mc={class:"ms-tab-count"},gc=we(" \u0E40\u0E04\u0E22\u0E40\u0E02\u0E49\u0E32 "),bc={class:"ms-tab-count"},yc=we(" \u0E02\u0E2D\u0E07\u0E09\u0E31\u0E19 "),kc={class:"ms-tab-count"},wc={key:0,class:"ms-loading"},Rc={key:1,class:"ms-empty"},Lc=E(()=>l("div",{style:{"font-size":"32px","margin-bottom":"8px"}},"\u{1F4ED}",-1)),Sc={key:2,class:"ms-list"},Mc={class:"ms-info"},Cc={class:"ms-name"},Ec={key:0,class:"ms-host-badge"},Tc=E(()=>l("svg",{xmlns:"http://www.w3.org/2000/svg",width:"10",height:"10",viewBox:"0 0 24 24",fill:"
1currentColor"},[l("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})],-1)),Ic=we(" \u0E04\u0E23\u0E39 "),Bc=[Tc,Ic],Ac={class:"ms-meta"},Oc={class:"ms-code-badge"},Pc={class:"ms-count"},$c={class:"ms-actions"},Gc=["onClick"],Dc=["onClick"],zc=["onClick"],qc=["onClick"],Fc={class:"dc-card"},Wc=E(()=>l("div",{class:"dc-icon"},"\u{1F6AA}",-1)),Nc=E(()=>l("div",{class:"dc-title"},"\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C?",-1)),Yc=E(()=>l("div",{class:"dc-sub"},"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13\u0E43\u0E19\u0E2B\u0E49\u0E2D\u0E07\u0E19\u0E35\u0E49\u0E08\u0E30\u0E16\u0E39\u0E01\u0E25\u0E1A\u0E2D\u0E2D\u0E01",-1)),Hc={class:"dc-code"},jc={class:"dc-actions"},Kc=["disabled"],Vc=["disabled"],Xc={key:1},Uc={class:"dc-card"},Qc=E(()=>l("div",{class:"dc-icon"},"\u26A0\uFE0F",-1)),Zc=E(()=>l("div",{class:"dc-title"},"\u0E25\u0E1A\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C?",-1)),Jc=E(()=>l("div",{class:"dc-sub"},"\u0E1C\u0E39\u0E49\u0E40\u0E25\u0E48\u0E19\u0E43\u0E19\u0E2B\u0E49\u0E2D\u0E07\u0E08\u0E30\u0E16\u0E39\u0E01\u0E15\u0E31\u0E14\u0E01\u0E32\u0E23\u0E40\u0E0A\u0E37\u0E48\u0E2D\u0E21\u0E15\u0E48\u0E2D \u0E41\u0E25\u0E30\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E01\u0E39\u0E49\u0E04\u0E37\u0E19\u0E44\u0E14\u0E49",-1)),xc={class:"dc-code"},ed={class:"dc-actions"},td=["disabled"],sd=["disabled"],ld={key:1},ad={key:0,class:"toast"},od={key:0,class:"map-loading-overlay","aria-live":"polite"},nd={class:"map-loading-inner"},id=E(()=>l("div",{class:"map-loading-ring"},null,-1)),rd=E(()=>l("div",{class:"map-loading-title"},"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E42\u0E2B\u0E25\u0E14\u0E41\u0E21\u0E1E",-1)),cd={class:"map-loading-sub"},dd={__name:"mapts",setup(q){var Js;const ge=Ml(),le=h(null),k=h("lobby"),t=h(""),T=h(""),A=h(""),ue=h(!1),oe=h(!1),n=h(""),ae=h(!0),j=h("office"),N=ll({office:!1,maze:!1,school:!1}),Xe=We(()=>{var c;const r=j.value;return N[r]&&((c=st[r])==null?void 0:c.horrorId)?st[r].horrorId:r}),mt=h(!1),Te=h([]),Ue=h(!1),ee=h(""),Ge=h(""),he=h(""),Qe=h(""),be=h("all"),Re=h([]),Ze=h(!1),Ye=h(!1),F=h(""),W=h(null),se=We(()=>{var c,d;const r=((c=W.value)==null?void 0:c.mapId)||"office";return(d=st[r])!=null&&d._horror&&st[r].baseId||r}),ie=h(!1),Le=h("settings");h(!1);const Se=h(""),Je=h("");h("members");const P=h([]),ut=h([]),Nt=h(!1),yt=h(!1),cs=h("");let ne=null,Dt=null;const Z=h(Math.random().toString(36).slice(2,10)),gt=h(ge.characterName||"\u0E1C\u0E39\u0E49\u0E40\u0E25\u0E48\u0E19"),It=h(((Js=ge.characterData)==null?void 0:Js.color)||"#FFCDB0"),ft=h(!1),ds="mapts_outfit",Ws=(()=>{try{const r=localStorage.getItem(ds);return r?JSON.parse(r):{}}catch{return{}}})(),us=h({shirt:null,pants:null,hair:null,face:null,dress:null,...Ws});Rt(us,r=>{try{localStorage.setItem(ds,JSON.stringify(r))}catch{}},{deep:!0});const Bt=h({}),He=h(null),At=h(!1),Yt=h(!1),Lt=h(null),Ht=h(!1),je=h(!1),De=h("all"),xe=h(""),Ke=h([]),it=h(0),Ve=h(null),jt=h({}),rt=h(!1),fe=h(null),bt=5,Kt=[{id:"q1",text:'What is the past tense of "run"?',choices:["runned","ran","run","runs"],answer:1},{id:"q2",text:'"She _____ coffee every morning." Choose the correct verb.',choices:["drink","drinked","drinks","drinking"],answer:2},{id:"q3",text:'Which word means the same as "happy"?',choices:["Sad","Angry","Joyful","Tired"],answer:2},{id:"q4",text:"Choose the correct sentence.",choices:["He don't like pizza.","He doesn't likes pizza.","He doesn't like pizza.","He not like pizza."],answer:2},{id:"q5",text:'Fill in: "The book is ___ the table." (\u0E2B\u0E19\u0E31\u0E07\u0E2A\u0E37\u0E2D\u0E2D\u0E22\u0E39\u0E48\u0E1A\u0E19\u0E42\u0E15\u0E4A\u0E30)',choices:["in","under","on","at"],answer:2}];function fs(r){const c=[...r];for(let d=c.length-1;d>0;d--){const y=Math.floor(Math.random()*(d+1));[c[d],c[y]]=[c[y],c[d]]}return c}const St=h([]),Ot=h([]),_s=h(0),es=h(!1),Pt=h(null),vs=h(null),ts=h(null),ps=h(!1),Os=h(!1),Ps=h(!1),$t=h(0),hs=We(()=>Oe.value==="maze"||Oe.value==="horror-maze"?{x:28*32+16,y:16*32+16}:Oe.value==="school"?{x:24*32+16,y:17*32+16}:{x:20*32+16,y:33*32+16}),_e=60*1e3,re=h(null);let ss=0;function zt(r){const c=Date.now();c-ss<150||!t.value||(ss=c,dt(t.value).update({ghostX:r.x,ghostY:r.y,ghostChasing:r.chasing}).catch(()=>{}))}const et=h(!1),ls=h(0),Ie=h(0),kt=h(!1);let _t=null;const as=h(!1),os=h(0);let Vt=0;const vt=h(!1);function Xt(){et.value||Ie.value>0||(vt.value=!vt.value)}function tt(){vt.value=!1,rl()}const ct=h(null),ms=h(""),u=16,st={office:{label:"\u{1F3E2} Office",desc:"\u0E2D\u0E2D\u0E1F\u0E1F\u0E34\u0E28 5 \u0E2B\u0E49\u0E2D\u0E07",horrorId:null,spawnX:816,spawnY:656,zoneDefs:{lobby:{icon:"\u{1F3E2}",text:"Main Lobby \u2014 \u0E42\u0E16\u0E07\u0E2B\u0E25\u0E31\u0E01",name:"\u{1F3E2} Main Lobby"},office:{icon:"\u{1F4BC}",text:"Open Office \u2014 \u0E1E\u0E37\u0E49\u0E19\u0E17\u0E35\u0E48\u0E17\u0E33\u0E07\u0E32\u0E19",name:"\u{1F4BC} Open Office"},meeting1:{icon:"\u{1F4CB}",text:"Meeting Room 1 \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E1B\u0E23\u0E30\u0E0A\u0E38\u0E21 (\u0E40\u0E2A\u0E35\u0E22\u0E07\u0E41\u0E22\u0E01)",name:"\u{1F4CB} Meeting Room 1"},meeting2:{icon:"\u{1F4CB}",text:"Meeting Room 2 \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E1B\u0E23\u0E30\u0E0A\u0E38\u0E21 (\u0E40\u0E2A\u0E35\u0E22\u0E07\u0E41\u0E22\u0E01)",name:"\u{1F4CB} Meeting Room 2"},mgr:{icon:"\u{1F454}",text:"CEO Office \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E1C\u0E39\u0E49\u0E1A\u0E23\u0E34\u0E2B\u0E32\u0E23 (\u0E40\u0E2A\u0E35\u0E22\u0E07\u0E41\u0E22\u0E01)",name:"\u{1F454} CEO Office"},break:{icon:"\u2615",text:"Break Room \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E1E\u0E31\u0E01\u0E1C\u0E48\u0E2D\u0E19",name:"\u2615 Break Room"}},spawnPool:[{x:2*32+u,y:2*32+u},{x:5*32+u,y:5*32+u},{x:8*32+u,y:2*32+u},{x:11*32+u,y:8*32+u},{x:14*32+u,y:5*32+u},{x:20*32+u,y:11*32+u},{x:1*32+u,y:1*32+u},{x:22*32+u,y:1*32+u},{x:22*32+u,y:12*32+u},{x:26*32+u,y:1*32+u},{x:47*32+u,y:1*32+u},{x:26*32+u,y:12*32+u},{x:1*32+u,y:18*32+u},{x:10*32+u,y:20*32+u},{x:3*32+u,y:31*32+u},{x:6*32+u,y:31*32+u},{x:2*32+u,y:33*32+u},{x:4*32+u,y:33*32+u},{x:37*32+u,y:18*32+u},{x:47*32+u,y:18*32+u},{x:1*32+u,y:15*32+u},{x:35*32+u,y:15*32+u},{x:15*32+u,y:16*32+u},{x:31*32+u,y:2*32+u},{x:40*32+u,y:2*32+u},{x:39*32+u,y:19*32+u}]},maze:{label:"\u{1F33F} Maze",desc:"\u0E40\u0E02\u0E32\u0E27\u0E07\u0E01\u0E15\u0E2A\u0E27\u0E19 5 \u0E42\u0E0B\u0E19",horrorId:"horror-maze",spawnX:25*32+u,spawnY:17*32+u,zoneDefs:{hall:{icon:"\u{1F33F}",text:"Garden Path \u2014 \u0E17\u0E32\u0E07\u0E40\u0E14\u0E34\u0E19\u0E2A\u0E27\u0E19",name:"\u{1F33F} Garden Path"},north:{icon:"\u{1F338}",text:"North Garden \u2014 \u0E2A\u0E27\u0E19\u0E40\u0E2B\u0E19\u0E37\u0E2D",name:"\u{1F338} North Garden"},east:{icon:"\u{1F33A}",text:"East Garden \u2014 \u0E2A\u0E27\u0E19\u0E15\u0E30\u0E27\u0E31\u0E19\u0E2D\u0E2D\u0E01",name:"\u{1F33A} East Garden"},south:{icon:"\u{1F33B}",text:"South Garden \u2014 \u0E2A\u0E27\u0E19\u0E43\u0E15\u0E49",name:"\u{1F33B} South Garden"},west:{icon:"\u{1F49C}",text:"West Garden \u2014 \u0E2A\u0E27\u0E19\u0E15\u0E30\u0E27\u0E31\u0E19\u0E15\u0E01",name:"\u{1F49C} West Garden"},center:{icon:"\u26F2",text:"Fountain Plaza \u2014 \u0E25\u0E32\u0E19\u0E19\u0E49\u0E33\u0E1E\u0E38",name:"\u26F2 Fountain Plaza"}},spawnPool:[{x:7*32+u,y:4*32+u},{x:25*32+u,y:4*32+u},{x:40*32+u,y:4*32+u},{x:7*32+u,y:34*32+u},{x:25*32+u,y:34*32+u},{x:40*32+u,y:34*32+u},{x:4*32+u,y:19*32+u},{x:43*32+u,y:19*32+u},{x:16*32+u,y:16*32+u},{x:31*32+u,y:22*32+u}]},school:{label:"\u{1F3EB} School",desc:"\u0E42\u0E23\u0E07\u0E40\u0E23\u0E35\u0E22\u0E19 6 \u0E42\u0E0B\u0E19",horrorId:null,spawnX:24*32+u,spawnY:16*32+u,zoneDefs:{hallway:{icon:"\u{1F6B6}",text:"Hallway \u2014 \u0E17\u0E32\u0E07\u0E40\u0E14\u0E34\u0E19",name:"\u{1F6B6} Hallway"},class1:{icon:"\u{1F4DA}",text:"Classroom 1 \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E40\u0E23\u0E35\u0E22\u0E19 1",name:"\u{1F4DA} Classroom 1"},class2:{icon:"\u{1F4DA}",text:"Classroom 2 \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E40\u0E23\u0E35\u0E22\u0E19 2",name:"\u{1F4DA} Classroom 2"},class3:{icon:"\u{1F4DA}",text:"Classroom 3 \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E40\u0E23\u0E35\u0E22\u0E19 3",name:"\u{1F4DA} Classroom 3"},library:{icon:"\u{1F4D6}
1",text:"Library \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E2A\u0E21\u0E38\u0E14",name:"\u{1F4D6} Library"},canteen:{icon:"\u{1F37D}\uFE0F",text:"Canteen \u2014 \u0E42\u0E23\u0E07\u0E2D\u0E32\u0E2B\u0E32\u0E23",name:"\u{1F37D}\uFE0F Canteen"}},spawnPool:[{x:2*32+u,y:4*32+u},{x:5*32+u,y:4*32+u},{x:8*32+u,y:6*32+u},{x:11*32+u,y:8*32+u},{x:2*32+u,y:8*32+u},{x:14*32+u,y:10*32+u},{x:18*32+u,y:4*32+u},{x:21*32+u,y:6*32+u},{x:27*32+u,y:4*32+u},{x:30*32+u,y:8*32+u},{x:24*32+u,y:10*32+u},{x:35*32+u,y:4*32+u},{x:38*32+u,y:6*32+u},{x:44*32+u,y:8*32+u},{x:41*32+u,y:10*32+u},{x:47*32+u,y:4*32+u},{x:5*32+u,y:24*32+u},{x:11*32+u,y:24*32+u},{x:17*32+u,y:24*32+u},{x:5*32+u,y:28*32+u},{x:11*32+u,y:28*32+u},{x:17*32+u,y:28*32+u},{x:5*32+u,y:31*32+u},{x:11*32+u,y:31*32+u},{x:26*32+u,y:24*32+u},{x:31*32+u,y:24*32+u},{x:36*32+u,y:24*32+u},{x:26*32+u,y:28*32+u},{x:31*32+u,y:28*32+u},{x:41*32+u,y:28*32+u}]},"horror-maze":{label:"\u{1F47B} Horror Maze",desc:"\u0E40\u0E02\u0E32\u0E27\u0E07\u0E01\u0E15\u0E2A\u0E22\u0E2D\u0E07\u0E02\u0E27\u0E31\u0E0D \u0E21\u0E35\u0E1C\u0E35\u0E44\u0E25\u0E48!",_horror:!0,baseId:"maze",spawnX:25*32+u,spawnY:17*32+u,zoneDefs:{hall:{icon:"\u{1F33F}",text:"Garden Path \u2014 \u0E17\u0E32\u0E07\u0E40\u0E14\u0E34\u0E19\u0E2A\u0E27\u0E19",name:"\u{1F33F} Garden Path"},north:{icon:"\u{1F338}",text:"North Garden \u2014 \u0E2A\u0E27\u0E19\u0E40\u0E2B\u0E19\u0E37\u0E2D",name:"\u{1F338} North Garden"},east:{icon:"\u{1F33A}",text:"East Garden \u2014 \u0E2A\u0E27\u0E19\u0E15\u0E30\u0E27\u0E31\u0E19\u0E2D\u0E2D\u0E01",name:"\u{1F33A} East Garden"},south:{icon:"\u{1F33B}",text:"South Garden \u2014 \u0E2A\u0E27\u0E19\u0E43\u0E15\u0E49",name:"\u{1F33B} South Garden"},west:{icon:"\u{1F49C}",text:"West Garden \u2014 \u0E2A\u0E27\u0E19\u0E15\u0E30\u0E27\u0E31\u0E19\u0E15\u0E01",name:"\u{1F49C} West Garden"},center:{icon:"\u26F2",text:"Fountain Plaza \u2014 \u0E08\u0E38\u0E14\u0E1B\u0E25\u0E2D\u0E14\u0E20\u0E31\u0E22",name:"\u26F2 Fountain Plaza (Safe)"}},spawnPool:[{x:7*32+u,y:4*32+u},{x:25*32+u,y:4*32+u},{x:40*32+u,y:4*32+u},{x:7*32+u,y:34*32+u},{x:25*32+u,y:34*32+u},{x:40*32+u,y:34*32+u},{x:4*32+u,y:19*32+u},{x:43*32+u,y:19*32+u},{x:16*32+u,y:16*32+u},{x:31*32+u,y:22*32+u}]}},Ss=Object.entries(st).filter(([,r])=>!r._horror).map(([r,c])=>({id:r,cfg:c})),Oe=h("office"),gs=816,bs=656,$s=["\u{1F44B}","\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F914}","\u{1F62E}","\u{1F622}","\u{1F525}","\u{1F4AF}","\u{1F44F}","\u{1F64C}"],ns={lobby:{icon:"\u{1F3E2}",text:"Main Lobby \u2014 \u0E42\u0E16\u0E07\u0E2B\u0E25\u0E31\u0E01",name:"\u{1F3E2} Main Lobby"},office:{icon:"\u{1F4BC}",text:"Open Office \u2014 \u0E1E\u0E37\u0E49\u0E19\u0E17\u0E35\u0E48\u0E17\u0E33\u0E07\u0E32\u0E19",name:"\u{1F4BC} Open Office"},meeting1:{icon:"\u{1F4CB}",text:"Meeting Room 1 \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E1B\u0E23\u0E30\u0E0A\u0E38\u0E21 (\u0E40\u0E2A\u0E35\u0E22\u0E07\u0E41\u0E22\u0E01)",name:"\u{1F4CB} Meeting Room 1"},meeting2:{icon:"\u{1F4CB}",text:"Meeting Room 2 \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E1B\u0E23\u0E30\u0E0A\u0E38\u0E21 (\u0E40\u0E2A\u0E35\u0E22\u0E07\u0E41\u0E22\u0E01)",name:"\u{1F4CB} Meeting Room 2"},mgr:{icon:"\u{1F454}",text:"CEO Office \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E1C\u0E39\u0E49\u0E1A\u0E23\u0E34\u0E2B\u0E32\u0E23 (\u0E40\u0E2A\u0E35\u0E22\u0E07\u0E41\u0E22\u0E01)",name:"\u{1F454} CEO Office"},break:{icon:"\u2615",text:"Break Room \u2014 \u0E2B\u0E49\u0E2D\u0E07\u0E1E\u0E31\u0E01\u0E1C\u0E48\u0E2D\u0E19",name:"\u2615 Break Room"}},Ms=We(()=>{var r;return((r=st[Oe.value])==null?void 0:r.zoneDefs)||ns}),qt=We(()=>{var r;return He.value?((r=Ms.value[He.value])==null?void 0:r.name)||He.value:"\u{1F3E2} Office"}),Gs=We(()=>Object.keys(Bt.value).length+1),Ds=We(()=>{if(De.value==="dm"&&fe.value){const r=fe.value.sid;return Ke.value.filter(c=>c.type==="dm"&&(c.sid===Z.value&&c.targetSid===r||c.sid===r&&c.targetSid===Z.value))}return Ke.value.filter(r=>r.type==="all"||r.type==="nearby"&&r.zone===He.value)}),ys=We(()=>({name:gt.value||"\u0E1C\u0E39\u0E49\u0E40\u0E25\u0E48\u0E19",color:It.value,speaking:At.value,emote:Lt.value,sid:Z.value})),ks=We(()=>St.value.map(r=>({...r,answered:Ot.value.includes(r.qid)}))),Cs=We(()=>be.value==="mine"?Te.value.filter(r=>
1r.isHost):be.value==="visited"?Re.value:Te.value.filter(r=>r.isPublic!==!1)),Ft=We(()=>{var c;const r=((c=ge.student)==null?void 0:c.uid)||"";return r&&ts.value?r===ts.value:Z.value===vs.value}),Es=We(()=>{const r=Object.entries(Bt.value).filter(([y])=>y!==vs.value),c=Ft.value,d=r.map(([,y])=>{var $;return((($=y.missionAnswered)==null?void 0:$.length)||0)/bt});return c||d.push(Ot.value.length/bt),d.length===0?0:d.reduce((y,$)=>y+$,0)/d.length*100}),Ut=We(()=>{if(!He.value)return[];const r=[{sid:Z.value,name:gt.value,color:It.value,speaking:At.value,emote:Lt.value}];for(const[c,d]of Object.entries(Bt.value))d.zone===He.value&&r.push({sid:c,...d});return r}),Qt=We(()=>$t.value?Math.floor((Date.now()-$t.value)/1e3):0);Rt(Ke,async()=>{await Gt(),Ve.value&&je.value&&(Ve.value.scrollTop=Ve.value.scrollHeight),je.value||it.value++}),Rt(je,r=>{r&&(it.value=0,Gt(()=>{Ve.value&&(Ve.value.scrollTop=Ve.value.scrollHeight)}))}),Rt(et,r=>{r&&(vt.value=!1)}),Rt(De,r=>{r!=="dm"&&(fe.value=null)});function dt(r){return pe.collection("mapts-rooms").doc(r)}function Ne(r,c){return pe.collection("mapts-rooms").doc(r).collection("players").doc(c)}function Ts(){const r="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";return Array.from({length:6},()=>r[Math.floor(Math.random()*r.length)]).join("")}async function Is(){var r;ue.value=!0;try{let c=Ts();(await dt(c).get()).exists&&(c=Ts()),await dt(c).set({createdAt:Date.now(),host:Z.value,name:n.value.trim()||"\u0E2B\u0E49\u0E2D\u0E07\u0E02\u0E2D\u0E07\u0E09\u0E31\u0E19",hostStudentId:((r=ge.student)==null?void 0:r.uid)||"",isPublic:ae.value,mapId:Xe.value||"office"}),t.value=c,ae.value=!0,k.value="name"}finally{ue.value=!1}}function Ns(){mt.value=!0,is()}async function is(){var r;Ue.value=!0,Te.value=[];try{const c=((r=ge.student)==null?void 0:r.uid)||"",d=await pe.collection("mapts-rooms").orderBy("createdAt","desc").limit(30).get(),y=[];for(const $ of d.docs){const I=$.data(),M=(await $.ref.collection("players").get()).docs.filter(te=>Date.now()-(te.data().ts||0)<12e3).length;y.push({code:$.id,name:I.name||"\u0E2B\u0E49\u0E2D\u0E07\u0E02\u0E2D\u0E07\u0E09\u0E31\u0E19",playerCount:M,createdAt:I.createdAt||0,isHost:!!c&&I.hostStudentId===c,isPublic:I.isPublic!==!1})}Te.value=y}finally{Ue.value=!1}}async function zs(){Ye.value=!0;try{const r=await pe.collection("mapts-rooms").get(),c=400;for(let d=0;d<r.docs.length;d+=c){const y=pe.batch();r.docs.slice(d,d+c).forEach($=>y.delete($.ref)),await y.commit()}Te.value=[],Re.value=[],localStorage.removeItem("mapts-visited"),Ze.value=!1,wt("\u2705 \u0E25\u0E1A\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14\u0E41\u0E25\u0E49\u0E27")}finally{Ye.value=!1}}async function Zt(r){var d;const c=((d=ge.student)==null?void 0:d.uid)||"";if(!!c){Qe.value=r;try{const y=await pe.collection("mapts-rooms").doc(r).collection("players").where("studentId","==",c).get();if(y.empty){wt("\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13\u0E43\u0E19\u0E2B\u0E49\u0E2D\u0E07\u0E19\u0E35\u0E49");return}const $=pe.batch();y.forEach(b=>$.delete(b.ref)),await $.commit();const I=Te.value.find(b=>b.code===r);I&&(I.playerCount=Math.max(0,I.playerCount-y.size)),he.value="",wt("\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E41\u0E25\u0E49\u0E27")}catch{wt("\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14")}finally{Qe.value=""}}}async function qs(r){Ge.value=r;try{const c=pe.batch();(await pe.collection("mapts-rooms").doc(r).collection("players").get()).forEach(y=>c.delete(y.ref)),c.delete(pe.collection("mapts-rooms").doc(r)),await c.commit(),Te.value=Te.value.filter(y=>y.code!==r),ee.value=""}finally{Ge.value=""}}function Fs(r){t.value=r,k.value="name"}function e(r,c){try{const d="mapts-visited",$=JSON.parse(localStorage.getItem(d)||"[]").filter(I=>I.code!==r);$.unshift({code:r,name:c}),localStorage.setItem(d,JSON.stringify($.slice(0,30)))}catch{}}async function s(){var r;try{const c="mapts-visited",d=JSON.parse(localStorage.getItem(c)||"[]"),y=((r=ge.student)==null?void 0:r.uid)||"",$=[];for(const I of d){const b=await dt(I.code).get();if(!b.exists)continue;const M=b.data();if(!!y&&M.hostStudentId===y)continue;const de=(await dt(I.code).collection("players").get()).docs.filter(lt=>Date.now()-(lt.data().ts||0)<12e3).length;$.push({code:I.code,name:M.name||I.name||"\u0E2B\u0E49\u0E2D\u0E07\u0E02\u0E2D\u0E07\u0E09\u0E31\u0E19",playerCount:de,isHost:!1,isPublic:M.isPublic!==!1})}Re.value=$}catch{}}async function a(){if(!T.value.trim()){A.value="\u0E01\u0E23\u0E38\u0E13\u0E32\u0E43\u0E2A\u0E48\u0E23\u0E2B\u0E31\u0E2A\u0E2B\u0E49\u0E2D\u0E07";return}oe.value=!0,A.value="";try{const r=T.value.toUpperCase().trim();if(!(await dt(r).get()).exists){A.value="\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E23\u0E2B\u0E31\u0E2A\u0E2B\u0E49\u0E2D\u0E07\u0E19\u0E35\u0E49 \u0E01\u0E23\u0E38\u0E13\u0E32\u0E15\u0E23\u0E27\u0E08\u0E2A\u0E2D\u0E1A\u0E2D\u0E35\u0E01\u0E04\u0E23\u0E31\u0E49\u0E07";return}t.value=r,k.value="name"}catch{A.value="\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14 \u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E2D\u0E07\u0E43\u0E2B\u0E21\u0E48"}finally{oe.value=!1}}let v=null,o=null,i=null,f=null;async function w(){var $;gt.value.trim()||(gt.value="\u0E1C\u0E39\u0E49\u0E40\u0E25\u0E48\u0E19");const r=await dt(t.value).get();if(!r.exists){wt("\u0E2B\u0E49\u0E2D\u0E07\u0E19\u0E35\u0E49\u0E16\u0E39\u0E01\u0E25\u0E1A\u0E44\u0E1B\u0E41\u0E25\u0E49\u0E27"),k.value="lobby";return}const c=r.data()||{},d=(($=ge.student)==null?void 0:$.uid)||"",y=!!d&&c.hostStudentId===d;if(!y&&(await pe.collection("mapts-rooms").doc(t.value).collection("players").get()).size>=30){wt("\u274C \u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E19\u0E35\u0E49\u0E40\u0E15\u0E47\u0E21\u0E41\u0E25\u0E49\u0E27 (\u0E2A\u0E39\u0E07\u0E2A\u0E38\u0E14 30 \u0E04\u0E19)");return}if(!y&&c.autoAccept===!1){await B(c,d);return}await G(c,d,y)}async function B(r,c){if(!c){wt("\u0E01\u0E23\u0E38\u0E13\u0E32\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E39\u0E48\u0E23\u0E30\u0E1A\u0E1A\u0E01\u0E48\u0E2D\u0E19");return}const d=pe.collection("mapts-rooms").doc(t.value).collection("pending").doc(c);await d.set({name:gt.value.trim()||"\u0E1C\u0E39\u0E49\u0E40\u0E25\u0E48\u0E19",color:It.value,studentId:c,ts:Date.now(),status:"waiting"}),cs.value=r.name||"\u0E2B\u0E49\u0E2D\u0E07",k.value="pending",ne=d.onSnapshot(async y=>{var I;if(!y.exists){ne==null||ne(),ne=null,k.value="name",wt("\u0E04\u0E33\u0E02\u0E2D\u0E16\u0E39\u0E01\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01");return}const $=(I=y.data())==null?void 0:I.status;if($==="rejected")ne==null||ne(),ne=null,await d.delete().catch(()=>{}),k.value="name",wt("\u0E44\u0E21\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A\u0E01\u0E32\u0E23\u0E2D\u0E19\u0E38\u0E21\u0E31\u0E15\u0E34\u0E08\u0E32\u0E01\u0E42\u0E2E\u0E2A");else if($==="accepted"){ne==null||ne(),ne=null,await d.delete().catch(()=>{});const b=await dt(t.value).get();await G(b.data()||{},c,!1)}})}function Y(){var c;ne==null||ne(),ne=null;const r=((c=ge.student)==null?void 0:c.uid)||"";r&&t.value&&pe.collection("mapts-rooms").doc(t.value).collection("pending").doc(r).delete().catch(()=>{}),k.value="name"}async function G(r,c,d){var I;const y=Z.value;if(vs.value=r.host||null,ts.value=r.hostStudentId||null,ps.value=(I=r.hintsEnabled)!=null?I:!1,Oe.value=r.mapId||"office",os.value=r.mapChangeTs||0,i=dt(t.value).onSnapshot(b=>{var lt,pt,Ee,Tt,qe;const M=b.data()||{};if(ps.value=(lt=M.hintsEnabled)!=null?lt:!1,M.ghostX!==void 0){const Fe=re.value,Wt=!!M.ghostChasing;(!Fe||Fe.x!==M.ghostX||Fe.y!==M.ghostY||Fe.chasing!==Wt)&&(re.value={x:M.ghostX,y:M.ghostY,chasing:Wt})}et.value=(pt=M.sabotagedActive)!=null?pt:!1;const te=(qe=(Tt=(Ee=M.sabotageLastUsed)==null?void 0:Ee.toMillis)==null?void 0:Tt.call(Ee))!=null?qe:0;te!==ls.value&&(ls.value=te,il(te)),!M.sabotagedActive&&kt.value&&(kt.value=!1);const de=M.mapChangeTs||0;de&&de!==os.value&&(os.value=de,ml(M.mapId||"office"))}),c){const b=await pe.collection("mapts-rooms").doc(t.value).collection("players").where("studentId","==",c).get();if(!b.empty){const M=pe.batch();b.forEach(te=>M.delete(te.ref)),await M.commit()}}await Ne(t.value,y).set({name:gt.value.trim(),color:It.value,x:gs,y:bs,facing:"down",zone:null,speaking:!1,emote:null,ts:Date.now(),studentId:c}),Dt&&(Dt(),Dt=null),Dt=Ne(t.value,y).onSnapshot(b=>{var M;b.exists&&((M=b.data())==null?void 0:M.kicked)&&(yt.value=!0)}),d||e(t.value,r.name||"\u0E2B\u0E49\u0E2D\u0E07\u0E02\u0E2D\u0E07\u0E09\u0E31\u0E19");const $=12e3;v=pe.collection("mapts-rooms").doc(t.value).collection("players").onSnapshot(b=>{const M=Date.now(),te={};b.forEach(de=>{if(de.id===y)return;const lt=de.data();lt.ts&&M-lt.ts>$||(te[de.id]=lt)}),Bt.value=te}),f&&clearInterval(f),f=setInterval(()=>{t.value&&Z.value&&Ne(t.value,Z.value).update({ts:Date.now()}).catch(()=>{})},5e3),o=pe.collection("mapts-rooms").doc(t.value).collection("messages").orderBy("ts","asc").limitToLast(80).onSnapshot(b=>{const M=[];b.forEach(te=>{const de={id:te.id,...te.data()};(de.type==="all"||de.type==="nearby"&&de.zone===He.value||de.type==="dm"&&(de.sid===y||de.targetSid===y))&&M.push(de)}),Ke.value=M}),k.value="game",Gt(()=>Et())}let ye=0;function Me({x:r,y:c,facing:d}){const y=Date.now();y-ye<60||(ye=y,Ne(t.value,Z.value).update({x:r,y:c,facing:d,ts:y}).catch(()=>{}))}function ce(r){He.value=r,ct.value=Ms.value[r]||null,Ne(t.value,Z.value).update({zone:r}).catch(()=>{}),setTimeout(()=>{ct.value=null},4e3),Gt(()=>{for(const c of Ut.value)c.sid!==Z.value&&!p[c.sid]&&Q(c.sid)})}function L(){x(),He.value=null,ct.value=null,Ne(t.value,Z.value).update({zone:null}).catch(()=>{})}const C={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"},{urls:"stun:stun2.l.google.com:19302"}]},S=()=>firebase.firestore.FieldValue;let O=null;const p={},g={},H={};function ve(r,c){return pe.collection("mapts-rooms").doc(r).collection("signals").doc(c)}function Mt(r,c){return r<c?`${r}_${c}`:`${c}_${r}`}
1async function Ce(){if(At.value)ze();else{Yt.value=!0;try{if(O=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1}),At.value=!0,Ne(t.value,Z.value).update({speaking:!0}).catch(()=>{}),He.value){x(),await new Promise(r=>setTimeout(r,80));for(const r of Ut.value)r.sid!==Z.value&&Q(r.sid)}}catch{wt("\u274C \u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E40\u0E02\u0E49\u0E32\u0E16\u0E36\u0E07\u0E44\u0E21\u0E04\u0E4C\u0E44\u0E14\u0E49 \u0E01\u0E23\u0E38\u0E13\u0E32\u0E2D\u0E19\u0E38\u0E0D\u0E32\u0E15\u0E01\u0E32\u0E23\u0E40\u0E02\u0E49\u0E32\u0E16\u0E36\u0E07")}finally{Yt.value=!1}}}function ze(){O&&(O.getTracks().forEach(r=>r.stop()),O=null),At.value=!1,Ne(t.value,Z.value).update({speaking:!1}).catch(()=>{}),x()}const D=(...r)=>console.log("%c[RTC]","color:#0af;font-weight:bold",...r),X=(...r)=>console.error("%c[RTC]","color:red;font-weight:bold",...r);async function Q(r){if(!r||!t.value||!Z.value||p[r])return;const c=Z.value,d=c<r,y=Mt(c,r),$=ve(t.value,y),I=d?"CALLER":"CALLEE";D(`connectToPeer [${I}] me=${c.slice(0,6)} \u2192 them=${r.slice(0,6)} hasMic=${!!O}`);const b=new RTCPeerConnection(C);if(p[r]=b,O&&(O.getTracks().forEach(M=>b.addTrack(M,O)),D(`[${I}] added ${O.getTracks().length} local track(s)`)),b.ontrack=M=>{var lt;D(`[${I}] \u2705 ontrack! streams=${M.streams.length} tracks=${(lt=M.streams[0])==null?void 0:lt.getTracks().length}`);let te=g[r];te||(te=new Audio,te.autoplay=!0,g[r]=te),te.srcObject=M.streams[0];const de=te.play();de&&de.then(()=>D(`[${I}] \u2705 audio.play() OK`)).catch(pt=>{D(`[${I}] audio.play() blocked (${pt.name}), retry on click`),document.addEventListener("click",()=>te.play().catch(()=>{}),{once:!0})})},b.onicecandidate=M=>{M.candidate?D(`[${I}] ICE candidate gathered: ${M.candidate.type}`):D(`[${I}] ICE gathering complete`)},b.onconnectionstatechange=()=>{D(`[${I}] connectionState \u2192 ${b.connectionState}`),(b.connectionState==="failed"||b.connectionState==="closed")&&Pe(r)},b.onicegatheringstatechange=()=>D(`[${I}] iceGatheringState \u2192 ${b.iceGatheringState}`),b.onsignalingstatechange=()=>D(`[${I}] signalingState \u2192 ${b.signalingState}`),d){let M=!1;const te=[];b.onicecandidate=qe=>{if(!qe.candidate){D("[CALLER] ICE done");return}D("[CALLER] ICE gathered:",qe.candidate.type);const Fe=qe.candidate.toJSON();M?$.update({callerIce:S().arrayUnion(Fe)}).catch(Wt=>X("callerIce write fail:",Wt.message)):te.push(Fe)};const de=await b.createOffer();await b.setLocalDescription(de),D("[CALLER] offer created, writing to Firestore..."),await $.set({caller:c,callee:r,zone:He.value,offer:{type:de.type,sdp:de.sdp},answer:null,callerIce:[],calleeIce:[],ts:Date.now()}).then(()=>D("[CALLER] \u2705 signal doc written")).catch(qe=>X("[CALLER] \u274C signal doc write FAILED:",qe.message)),M=!0;for(const qe of te)$.update({callerIce:S().arrayUnion(qe)}).catch(()=>{});let lt=!1;const pt=new Set;let Ee=null;const Tt=$.onSnapshot(async qe=>{const Fe=qe.data();if(D("[CALLER] snapshot fired, has answer:",!!(Fe!=null&&Fe.answer),"state:",b.signalingState),!(!Fe||b.signalingState==="closed")){if(Fe.answer&&Fe.answer.sdp!==Ee){if(Ee=Fe.answer.sdp,b.remoteDescription){D("[CALLER] new answer from callee \u2192 reset+reconnect"),Pe(r),Q(r);return}D("[CALLER] setting remote description (answer)..."),await b.setRemoteDescription(new RTCSessionDescription(Fe.answer)).then(()=>D("[CALLER] \u2705 remoteDesc set")).catch(Wt=>X("[CALLER] remoteDesc fail:",Wt.message)),lt=!0,pt.clear()}if(lt)for(const Wt of Fe.calleeIce||[]){const xs=Wt.candidate;pt.has(xs)||(pt.add(xs),b.addIceCandidate(new RTCIceCandidate(Wt)).then(()=>D("[CALLER] ICE added (callee)")).catch(wl=>X("[CALLER] addIceCandidate fail:",wl.message)))}}});H[r]=[Tt]}else{let M=!1,te=null;const de=new Set;b.onicecandidate=pt=>{if(!pt.candidate){D("[CALLEE] ICE done");return}D("[CALLEE] ICE gathered:",pt.candidate.type),$.update({calleeIce:S().arrayUnion(pt.candidate.toJSON())}).catch(Ee=>X("[CALLEE] calleeIce write fail:",Ee.message))};const lt=$.onSnapshot(async pt=>{const Ee=pt.data();if(D("[CALLEE] snapshot fired, has offer:",!!(Ee!=null&&Ee.offer),"has answer:",!!(Ee!=null&&Ee.answer),"state:",b.signalingState),!(!Ee||b.signalingState==="closed")){if(Ee.offer&&Ee.offer.sdp!==te){if(te=Ee.offer.sdp,b.remoteDescription){D("[CALLEE] new offer detected \u2192 reset+reconnect"),Pe(r),Q(r);return}D("[CALLEE] setting remote description (offer)..."),await b.setRemoteDescription(new RTCSessionDescription(Ee.offer)).then(()=>D("[CALLEE] \u2705 remoteDesc set")).catch(qe=>X("[CALLEE] remoteDesc fail:",qe.message));const Tt=await b.createAnswer();await b.setLocalDescription(Tt),D("[CALLEE] answer created, writing..."),await $.update({answer:{type:Tt.type,sdp:Tt.sdp}}).then(()=>D("[CALLEE] \u2705 answer written")).catch(qe=>X("[CALLEE] \u274C answer write FAILED:",qe.message)),M=!0,de.clear()}if(M)for(const Tt of Ee.callerIce||[]){const qe=Tt.candidate;de.has(qe)||(de.add(qe),b.addIceCandidate(new RTCIceCandidate(Tt)).then(()=>D("[CALLEE] ICE added (caller)")).catch(Fe=>X("[CALLEE] addIceCandidate fail:",Fe.message)))}}});H[r]=[lt]}}function Pe(r){H[r]&&(H[r].forEach(c=>c()),delete H[r]),p[r]&&(p[r].close(),delete p[r]),g[r]&&(g[r].srcObject=null,delete g[r])}
1function x(){Object.keys(p).forEach(r=>Pe(r))}Rt(Ke,r=>{var y,$;const c={};for(const I of r){if(!I.sid||!I.text)continue;const b=(y=I.ts)!=null&&y.toDate?I.ts.toDate().getTime():typeof I.ts=="number"?I.ts:Date.now();c[I.sid]||(c[I.sid]=[]),c[I.sid].push({text:I.text,tsMs:b})}const d={};for(const I of Object.keys(c)){const b=c[I].slice(-3);d[I]={msgs:b,lastTs:(($=b[b.length-1])==null?void 0:$.tsMs)||0}}jt.value=d}),Rt(Ut,(r,c)=>{if(!He.value)return;const d=new Set((c||[]).map(y=>y.sid));for(const y of r)y.sid!==Z.value&&!d.has(y.sid)&&Q(y.sid)});let $e=null;function Ct(r){Lt.value=r,Ht.value=!1,Ne(t.value,Z.value).update({emote:r}).catch(()=>{}),clearTimeout($e),$e=setTimeout(()=>{Lt.value=null,Ne(t.value,Z.value).update({emote:null}).catch(()=>{})},3500)}function Et(){var $,I,b;$t.value=Date.now();const r=fs(Kt),c=Oe.value==="maze"||Oe.value==="horror-maze"?((I=($=le.value)==null?void 0:$.getMazePool)==null?void 0:I.call($))||[]:[],d=c.length?c:((b=st[Oe.value])==null?void 0:b.spawnPool)||st.office.spawnPool,y=fs(d).slice(0,bt);St.value=r.map((M,te)=>({qid:M.id,x:y[te].x,y:y[te].y})),Ot.value=[],_s.value=0,es.value=!1,Ne(t.value,Z.value).update({missionAnswered:[],missionCorrect:0,missionCompletedAt:null}).catch(()=>{})}function Be(r){if(Pt.value)return;const c=St.value[r];if(!c||Ot.value.includes(c.qid))return;const d=Kt[Math.floor(Math.random()*Kt.length)];if(!d)return;const y=Ot.value.length+1;Pt.value={itemIndex:r,question:d,questionNum:y}}async function ol({correct:r}){}function nl(){Pt.value=null}function il(r){_t&&(clearInterval(_t),_t=null);function c(){const d=Math.max(0,_e-(Date.now()-r));Ie.value=Math.ceil(d/1e3),d<=0&&(clearInterval(_t),_t=null)}c(),Date.now()-r<_e&&(_t=setInterval(c,500))}function rl(){!Ft.value||et.value||Ie.value>0||dt(t.value).update({sabotagedActive:!0,sabotageLastUsed:firebase.firestore.FieldValue.serverTimestamp(),sabotageRepairedBy:null}).catch(()=>{})}function cl(){!et.value||kt.value||(kt.value=!0)}function dl(){var y,$,I,b;const r=st[Oe.value],c=(y=r==null?void 0:r.spawnX)!=null?y:gs,d=($=r==null?void 0:r.spawnY)!=null?$:bs;(b=(I=le.value)==null?void 0:I.respawnTo)==null||b.call(I,c,d),Z.value&&t.value&&Ne(t.value,Z.value).update({x:c,y:d,facing:"down"}).catch(()=>{})}function ul(){kt.value=!1,dt(t.value).update({sabotagedActive:!1,sabotageRepairedBy:Z.value}).catch(()=>{})}function fl(r){var c;return r?((c=ns[r])==null?void 0:c.name)||r:"\u{1F3E2} Office"}function _l(r,c){fe.value={sid:r,name:c.name,color:c.color||"#FFCDB0"},De.value="dm",je.value=!0,rt.value=!1}function vl(){rt.value=!rt.value,rt.value&&(je.value=!1)}function pl(){je.value=!je.value,je.value&&(rt.value=!1)}async function Xs(){var c;if(!xe.value.trim())return;const r=xe.value.trim();xe.value="",await pe.collection("mapts-rooms").doc(t.value).collection("messages").add({sid:Z.value,name:gt.value,color:It.value,text:r,ts:firebase.firestore.FieldValue.serverTimestamp(),type:De.value,zone:De.value==="nearby"?He.value:null,targetSid:De.value==="dm"&&((c=fe.value)==null?void 0:c.sid)||null})}function hl(r){return r?(r.toDate?r.toDate():new Date(r)).toLocaleTimeString("th-TH",{hour:"2-digit",minute:"2-digit"}):""}async function Us(r){var y;F.value=r.code,Le.value="settings",Se.value=r.code,Je.value=r.name,P.value=[],ut.value=[],ie.value=!0;const d=(await dt(r.code).get()).data()||{};W.value={isPublic:d.isPublic!==!1,hintsEnabled:(y=d.hintsEnabled)!=null?y:!1,autoAccept:d.autoAccept!==!1,mapId:d.mapId||"office"},ie.value=!1}Rt(Le,async r=>{(r==="members"||r==="pending")&&F.value&&await gl()});async function ws(r,c){if(!F.value)return;const d={[r]:c};r==="mapId"&&(d.mapChangeTs=Date.now()),await dt(F.value).update(d),W.value&&(W.value[r]=c);const y=Te.value.find($=>$.code===F.value);y&&(y[r]=c)}async function ml(r){var I,b;if(k.value!=="game")return;const c=++Vt;F.value="",as.value=!0,await Gt(),Oe.value=r;const d=st[r],y=(I=d==null?void 0:d.spawnX)!=null?I:gs,$=(b=d==null?void 0:d.spawnY)!=null?b:bs;Z.value&&t.value&&Ne(t.value,Z.value).update({x:y,y:$,facing:"down",zone:null}).catch(()=>{}),await Gt(),await new Promise(M=>
1setTimeout(M,1400)),c===Vt&&(as.value=!1,Gt(()=>Et()))}async function gl(){Nt.value=!0;try{const[r,c]=await Promise.all([pe.collection("mapts-rooms").doc(Se.value).collection("players").get(),pe.collection("mapts-rooms").doc(Se.value).collection("pending").where("status","==","waiting").get()]);P.value=r.docs.map(d=>({id:d.id,...d.data()})),ut.value=c.docs.map(d=>({id:d.id,...d.data()}))}finally{Nt.value=!1}}async function bl(r){await pe.collection("mapts-rooms").doc(Se.value).collection("players").doc(r).update({kicked:!0}),P.value=P.value.filter(c=>c.id!==r),setTimeout(()=>{pe.collection("mapts-rooms").doc(Se.value).collection("players").doc(r).delete().catch(()=>{})},6e3)}async function yl(r){if((await pe.collection("mapts-rooms").doc(Se.value).collection("players").get()).size>=30){wt("\u26A0\uFE0F \u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E40\u0E15\u0E47\u0E21\u0E41\u0E25\u0E49\u0E27 (30/30) \u0E01\u0E23\u0E38\u0E13\u0E32\u0E25\u0E1A\u0E2A\u0E21\u0E32\u0E0A\u0E34\u0E01\u0E01\u0E48\u0E2D\u0E19");return}await pe.collection("mapts-rooms").doc(Se.value).collection("pending").doc(r).update({status:"accepted"}),ut.value=ut.value.filter(d=>d.id!==r)}async function kl(r){await pe.collection("mapts-rooms").doc(Se.value).collection("pending").doc(r).update({status:"rejected"}),ut.value=ut.value.filter(c=>c.id!==r)}function Ys(){$e&&(clearTimeout($e),$e=null),v&&(v(),v=null),o&&(o(),o=null),i&&(i(),i=null),Dt&&(Dt(),Dt=null),ne&&(ne(),ne=null),yt.value=!1,t.value&&Ne(t.value,Z.value).delete().catch(()=>{}),ze(),Lt.value=null,Bt.value={},Ke.value=[],jt.value={},He.value=null,ct.value=null,je.value=!1,rt.value=!1,fe.value=null,De.value="all",it.value=0,St.value=[],Ot.value=[],_s.value=0,es.value=!1,Pt.value=null,vs.value=null,ts.value=null,ps.value=!1,Os.value=!1,et.value=!1,kt.value=!1,Ie.value=0,ls.value=0,_t&&(clearInterval(_t),_t=null),f&&(clearInterval(f),f=null),k.value="lobby"}function Qs(){var r;(r=navigator.clipboard)==null||r.writeText(t.value).catch(()=>{}),wt("\u2705 \u0E04\u0E31\u0E14\u0E25\u0E2D\u0E01\u0E23\u0E2B\u0E31\u0E2A\u0E41\u0E25\u0E49\u0E27!")}function wt(r){ms.value=r,setTimeout(()=>{ms.value=""},2200)}function Zs(){t.value&&Z.value&&Ne(t.value,Z.value).delete().catch(()=>{})}return window.addEventListener("beforeunload",Zs),Rt(be,r=>{r==="visited"&&s()}),Vs(()=>{window.removeEventListener("beforeunload",Zs),Ys()}),(r,c)=>(_(),m(me,null,[l("div",co,[z(ke,{name:"fade"},{default:U(()=>[k.value==="lobby"?(_(),m("div",uo,[fo,l("div",_o,[vo,po,ho,mo,z(ht,{unelevated:"",class:"btn-primary",onClick:c[0]||(c[0]=d=>k.value="create-setup")},{default:U(()=>[go]),_:1}),z(ht,{unelevated:"",class:"btn-secondary",onClick:c[1]||(c[1]=d=>k.value="join-input")},{default:U(()=>[bo]),_:1}),z(ht,{unelevated:"",class:"btn-tertiary",onClick:Ns},{default:U(()=>[yo]),_:1})])])):K("",!0)]),_:1}),z(ke,{name:"fade"},{default:U(()=>[k.value==="join-input"?(_(),m("div",ko,[l("div",wo,[Ro,Lo,z(Hs,{modelValue:T.value,"onUpdate:modelValue":c[2]||(c[2]=d=>T.value=d),placeholder:"\u0E23\u0E2B\u0E31\u0E2A 6 \u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",maxlength:"6",outlined:"",dense:"",dark:"",class:"code-field","input-class":"code-input-inner",onKeyup:js(a,["enter"])},null,8,["modelValue","onKeyup"]),A.value?(_(),m("div",So,R(A.value),1)):K("",!0),z(ht,{unelevated:"",class:"btn-primary",loading:oe.value,onClick:a},{default:U(()=>[Mo]),_:1},8,["loading"]),z(ht,{flat:"",class:"btn-back",onClick:c[3]||(c[3]=d=>k.value="lobby")},{default:U(()=>[Co]),_:1})])])):K("",!0)]),_:1}),z(ke,{name:"fade"},{default:U(()=>[k.value==="create-setup"?(_(),m("div",Eo,[l("div",To,[Io,Bo,Ao,Oo,z(Hs,{modelValue:n.value,"onUpdate:modelValue":c[4]||(c[4]=d=>n.value=d),placeholder:"\u0E40\u0E0A\u0E48\u0E19 \u0E2B\u0E49\u0E2D\u0E07\u0E40\u0E23\u0E35\u0E22\u0E19 4/2",maxlength:"30",outlined:"",dense:"",dark:"",class:"name-field",onKeyup:js(Is,["enter"])},null,8,["modelValue","onKeyup"]),Po,l("div",$o,[(_(!0),m(me,null,nt(J(Ss),d=>(_(),m("div",{key:d.id,class:V(["map-option",{selected:j.value===d.id}]),onClick:y=>j.value=d.id},[l("div",Do,R(d.cfg.label),1),l("div",zo,R(d.cfg.desc),1),l("div",qo,[l("button",{class:V(["map-mode-btn",{active:!N[d.id]}]),onClick:Ae(y=>{N[d.id]=!1,j.value=d.id},["stop"])},"\u0E1B\u0E01\u0E15\u0E34",10,Fo),l("button",{class:V(["map-mode-btn horror",{active:N[d.id],"n
1o-horror":!d.cfg.horrorId}]),disabled:!d.cfg.horrorId,onClick:Ae(y=>d.cfg.horrorId&&(N[d.id]=!0,j.value=d.id),["stop"])},"\u{1F47B} \u0E1C\u0E35",10,Wo)])],10,Go))),128))]),l("div",{class:"public-toggle-row",onClick:c[5]||(c[5]=d=>ae.value=!ae.value)},[l("div",No,[l("div",Yo,R(ae.value?"\u{1F310} \u0E40\u0E1B\u0E34\u0E14\u0E2A\u0E32\u0E18\u0E32\u0E23\u0E13\u0E30":"\u{1F512} \u0E2A\u0E48\u0E27\u0E19\u0E15\u0E31\u0E27"),1),l("div",Ho,R(ae.value?"\u0E41\u0E2A\u0E14\u0E07\u0E43\u0E19\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14":"\u0E40\u0E02\u0E49\u0E32\u0E44\u0E14\u0E49\u0E40\u0E09\u0E1E\u0E32\u0E30\u0E04\u0E19\u0E17\u0E35\u0E48\u0E21\u0E35\u0E23\u0E2B\u0E31\u0E2A"),1)]),l("div",{class:V(["public-toggle-switch",{on:ae.value}])},Ko,2)]),z(ht,{unelevated:"",class:"btn-primary",loading:ue.value,onClick:Is},{default:U(()=>[Vo]),_:1},8,["loading"]),z(ht,{flat:"",class:"btn-back",onClick:c[6]||(c[6]=d=>k.value="lobby")},{default:U(()=>[Xo]),_:1})])])):K("",!0)]),_:1}),z(ke,{name:"fade"},{default:U(()=>[k.value==="pending"?(_(),m("div",Uo,[l("div",Qo,[Zo,Jo,l("div",xo,[en,l("b",null,R(cs.value),1),tn]),l("div",sn,[z(Jt,{size:"40px",color:"white"})]),z(ht,{flat:"",class:"btn-back",onClick:Y},{default:U(()=>[ln]),_:1})])])):K("",!0)]),_:1}),z(ke,{name:"fade"},{default:U(()=>[k.value==="name"?(_(),m("div",an,[l("div",on,[l("div",nn,[rn,l("div",cn,[l("span",dn,R(t.value),1),z(ht,{flat:"",round:"",dense:"",icon:"content_copy",size:"xs",class:"rc-copy",onClick:Qs},{default:U(()=>[z(tl,null,{default:U(()=>[un]),_:1})]),_:1})]),fn]),_n,vn,z(Hs,{modelValue:gt.value,"onUpdate:modelValue":c[7]||(c[7]=d=>gt.value=d),placeholder:"\u0E0A\u0E37\u0E48\u0E2D\u0E43\u0E19\u0E40\u0E01\u0E21",maxlength:"20",outlined:"",dense:"",dark:"",class:"name-field"},null,8,["modelValue"]),l("div",pn,[l("div",{class:"color-dot",style:ot({background:It.value})},null,4),hn]),z(ht,{unelevated:"",class:"btn-primary",onClick:w},{default:U(()=>[mn]),_:1})])])):K("",!0)]),_:1}),z(ke,{name:"fade"},{default:U(()=>{var d,y,$,I;return[k.value==="game"?(_(),m("div",gn,[z(ke,{name:"slide-left"},{default:U(()=>{var b;return[Ks(l("div",bn,[l("div",yn,[De.value==="dm"&&fe.value?(_(),m("div",kn,[l("div",{class:"dm-avatar",style:ot({background:fe.value.color})},null,4),l("div",null,[l("div",wn,R(fe.value.name),1),Rn])])):(_(),m("span",Ln,"\u{1F4AC} Chat")),z(ht,{flat:"",round:"",dense:"",icon:"close",size:"xs",class:"chat-close",onClick:c[8]||(c[8]=M=>je.value=!1)})]),l("div",Sn,[De.value==="dm"?(_(),m(me,{key:0},[Mn,l("button",{class:"target-btn",style:{flex:"0",padding:"0 12px"},onClick:c[9]||(c[9]=M=>De.value="all")},"\u2190 \u0E01\u0E25\u0E31\u0E1A")],64)):(_(),m(me,{key:1},[l("button",{class:V(["target-btn",{active:De.value==="all"}]),onClick:c[10]||(c[10]=M=>De.value="all")},"\u0E17\u0E38\u0E01\u0E04\u0E19",2),l("button",{class:V(["target-btn",{active:De.value==="nearby"}]),onClick:c[11]||(c[11]=M=>De.value="nearby")},"\u0E04\u0E19\u0E43\u0E01\u0E25\u0E49\u0E46",2)],64))]),l("div",{ref_key:"chatBodyRef",ref:Ve,class:"chat-body"},[J(Ds).length===0?(_(),m("div",Cn,R(De.value==="dm"?"\u0E40\u0E23\u0E34\u0E48\u0E21\u0E01\u0E32\u0E23\u0E2A\u0E19\u0E17\u0E19\u0E32...":"\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21"),1)):K("",!0),(_(!0),m(me,null,nt(J(Ds),M=>(_(),m("div",{key:M.id,class:V(["chat-msg",{mine:M.sid===Z.value}])},[l("div",{class:"msg-avatar",style:ot({background:M.color||"#FFCDB0"})},null,4),l("div",En,[l("div",Tn,[l("span",In,R(M.name),1),M.type==="nearby"?(_(),m("span",Bn,"\u0E43\u0E01\u0E25\u0E49\u0E46")):K("",!0),l("span",An,R(hl(M.ts)),1)]),l("div",On,R(M.text),1)])],2))),128))],512),l("div",Pn,[Ks(l("input",{"onUpdate:modelValue":c[12]||(c[12]=M=>xe.value=M),class:"chat-input",placeholder:De.value==="dm"?`\u0E2A\u0E48\u0E07\u0E2B\u0E32 ${(b=fe.value)==null?void 0:b.name}...`:De.value==="nearby"?"\u0E2A\u0E48\u0E07\u0E16\u0E36\u0E07\u0E04\u0E19\u0E43\u0E01\u0E25\u0E49\u0E46...":"\u0E2A\u0E48\u0E07\u0E16\u0E36\u0E07\u0E17\u0E38\u0E01\u0E04\u0E19...",maxlength:"200",onKeyup:js(Xs,["enter"])},null,40,$n),[[Cl,xe.value]]),l("button",{class:"chat-send",onClick:Xs},"\u2191")])],512),[[el,je.value]])]}),_:1}),l("div",{class:V(["game-main",{"chat-pushed":je.value}]),onClick:c[18]||(c[18]=b=>{vt.value=!1,Os.value=!1})},[l("div",Gn,[l("div",Dn,[z(ht,{flat:"",round:"",dense:"",icon:"logout",size:"sm",class:"tb-btn",onClick:Ys},{default:U(()=>[z(tl,null,{default:U(()=>[zn]),_:1})]),_:1})]),l("div",qn,[l("div",Fn,[Wn,Nn,l("div",Yn,[l("div",{class:"mission-bar-fill",style:ot({width:J(Es)+"%"})},jn,4)]),l("span",Kn,R(Math.round(J(Es)))+"%",1),J(Ft)?(_(),m("span",Vn,"\u0E04\u0E23\u0E39")):K("",!0)]),z(ke,{name:"zone-name-fade",mode:"out-in"},{default:U(()=>[(_(),m("div",{key:J(qt),class:V(["zone-badge",He.value?"zone-active":""])},R(J(qt)),3))]),_:1})]),l("div",Xn,[l("div",{class:"room-hud",onClick:Qs},[l("span",Un,R(t.value),1),l("span",Qn,"\u{1F465} "+R(J(Gs)),1)])])]),z(ke,{name:"nearby-slide"},{default:U(()=>[J(Ut).length>0?(_(),m("div",Zn,[Jn,(_(!0),m(me,null,nt(J(Ut),b=>(_(),m("div",{key:b.sid,class:V(["nearby-tile",{speaking:b.speaking}])},[l("div",{class:"nearby-avatar",style:ot({background:b.color||"#FFCDB0"})},[b.speaking?(_(),m("div",xn)):K("",!0)],4),l("div",ei,R(b.sid===Z.value?"\u0E04\u0E38\u0E13":b.name),1),b.speaking?(_(),m("div",ti,"\u{1F3A4}")):K("",!0)],2))),128))])):K("",!0)]),_:1}),z(ke,{name:"slide-down"},{default:U(()=>[et.value?(_(),m("div",si,ni)):K("",!0)]),_:1}),(_(),at(Il,{ref_key:"gameCanvasRef",ref:le,key:Oe.value,localPlayer:J(ys),otherPlayers:Bt.value,mapId:Oe.value,startX:(y=(d=st[Oe.value])==null?void 0:d.spawnX)!=null?y:gs,startY:(I=($=st[Oe.value])==null?void 0:$.spawnY)!=null?I:bs,chatMessages:jt.value,missionItems:J(ks),speedBoost:es.value,hintsEnabled:ps.value,sabotageActive:et.value,fuseBoxPos:J(hs),missionOpen:!!Pt.value,isHost:J(Ft),externalGhostPos:re.value,outfit:us.value,onPositionUpdate:Me,onZoneEnter:ce,onZoneLeave:L,onMissionItemClick:Be,onFuseBoxClick:cl,onGhostCat
1ch:dl,onGhostPosUpdate:zt},null,8,["localPlayer","otherPlayers","mapId","startX","startY","chatMessages","missionItems","speedBoost","hintsEnabled","sabotageActive","fuseBoxPos","missionOpen","isHost","externalGhostPos","outfit"])),l("div",ii,[l("div",ri,[l("div",{class:"my-avatar",style:ot({background:It.value})},null,4),l("div",ci,[l("div",di,R(gt.value),1),l("div",ui,R(J(qt)),1)])]),l("div",fi,[J(Ft)?(_(),m("div",_i,[l("button",{class:V(["ctrl-btn",{active:F.value===t.value}]),onClick:c[13]||(c[13]=Ae(b=>Us({code:t.value,name:n.value||t.value}),["stop"]))},pi,2),hi])):K("",!0),J(Ft)?(_(),m("div",mi,[l("button",{class:V(["ctrl-btn sabotage-btn",{active:et.value,cooldown:Ie.value>0,"menu-open":vt.value}]),disabled:et.value||Ie.value>0,onClick:Ae(Xt,["stop"])},[l("span",bi,R(Ie.value>0?"\u23F1":et.value?"\u26A1":"\u{1F608}"),1)],10,gi),l("div",yi,R(et.value?"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E0B\u0E48\u0E2D\u0E21":Ie.value>0?`${Ie.value}s`:"\u0E41\u0E01\u0E25\u0E49\u0E07"),1),z(ke,{name:"sab-pop"},{default:U(()=>[vt.value?(_(),m("div",{key:0,class:"sab-confirm-popup",onClick:c[15]||(c[15]=Ae(()=>{},["stop"]))},[ki,l("button",{class:"sab-confirm-btn",onClick:tt},"\u0E15\u0E31\u0E14\u0E44\u0E1F!"),l("button",{class:"sab-cancel-btn",onClick:c[14]||(c[14]=b=>vt.value=!1)},"\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01")])):K("",!0)]),_:1})])):K("",!0),l("div",wi,[l("button",{class:V(["ctrl-btn ptt-btn",{active:At.value,"mic-loading":Yt.value}]),onClick:Ce},[l("span",Ri,R(Yt.value?"\u23F3":At.value?"\u{1F534}":"\u{1F3A4}"),1)],2),l("div",Li,R(At.value?"\u0E40\u0E1B\u0E34\u0E14\u0E2D\u0E22\u0E39\u0E48":"\u0E44\u0E21\u0E04\u0E4C"),1)]),l("div",Si,[l("button",{class:V(["ctrl-btn",{active:Ht.value}]),onClick:c[16]||(c[16]=b=>Ht.value=!Ht.value)},Ci,2),Ei]),l("div",Ti,[l("button",{class:"ctrl-btn",onClick:c[17]||(c[17]=b=>ft.value=!0)},Bi),Ai])]),l("div",Oi,[l("button",{class:V(["side-btn",{active:rt.value}]),onClick:vl},$i,2),l("button",{class:V(["side-btn",{active:je.value}]),onClick:pl},[Gi,it.value>0?(_(),m("span",Di,R(it.value),1)):K("",!0)],2)])]),z(ke,{name:"emote-pop"},{default:U(()=>[Ht.value?(_(),m("div",zi,[(_(),m(me,null,nt($s,b=>l("button",{key:b,class:"emote-item",onClick:M=>Ct(b)},R(b),9,qi)),64))])):K("",!0)]),_:1}),z(ke,{name:"zone-up"},{default:U(()=>[ct.value&&!je.value&&!rt.value?(_(),m("div",Fi,[l("span",Wi,R(ct.value.icon),1),l("span",Ni,R(ct.value.text),1)])):K("",!0)]),_:1})],2),z($a,{modelValue:ft.value,"onUpdate:modelValue":c[19]||(c[19]=b=>ft.value=b),outfit:us.value,"onUpdate:outfit":c[20]||(c[20]=b=>us.value=b)},null,8,["modelValue","outfit"]),z(ke,{name:"slide-right"},{default:U(()=>[Ks(l("div",Yi,[l("div",Hi,[l("span",ji,"\u{1F465} \u0E1C\u0E39\u0E49\u0E40\u0E25\u0E48\u0E19 ("+R(J(Gs))+")",1),z(ht,{flat:"",round:"",dense:"",icon:"close",size:"xs",class:"chat-close",onClick:c[21]||(c[21]=b=>rt.value=!1)})]),l("div",Ki,[l("div",Vi,[l("div",{class:"player-row-avatar",style:ot({background:It.value})},null,4),l("div",Xi,[l("div",Ui,[we(R(gt.value)+" ",1),Qi]),l("div",Zi,R(J(qt)),1)])]),Ji,Object.keys(Bt.value).length>0?(_(!0),m(me,{key:0},nt(Bt.value,(b,M)=>(_(),m("div",{key:M,class:"player-row"},[l("div",{class:"player-row-avatar",style:ot({background:b.color||"#FFCDB0"})},null,4),l("div",xi,[l("div",er,R(b.name),1),l("div",tr,R(fl(b.zone)),1)]),l("button",{class:"dm-btn",onClick:te=>_l(M,b),title:"\u0E41\u0E0A\u0E17\u0E2A\u0E48\u0E27\u0E19\u0E15\u0E31\u0E27"},"\u{1F4AC}",8,sr)]))),128)):(_(),m("div",lr,"\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E1C\u0E39\u0E49\u0E40\u0E25\u0E48\u0E19\u0E04\u0E19\u0E2D\u0E37\u0E48\u0E19"))])],512),[[el,rt.value]])]),_:1})])):K("",!0)]}),_:1}),(_(),at(rs,{to:"body"},[z(ke,{name:"fade"},{default:U(()=>[yt.value?(_(),m("div",ar,[l("div",or,[nr,ir,rr,l("button",{class:"kicked-btn",onClick:c[22]||(c[22]=d=>{yt.value=!1,Ys()})},"\u0E23\u0E31\u0E1A\u0E17\u0E23\u0E32\u0E1A")])])):K("",!0)]),_:1})])),(_(),at(rs,{to:"body"},[z(ke,{name:"fade"},{default:U(()=>[F.value?(_(),m("div",{key:0,class:"sm-overlay",onClick:c[31]||(c[31]=Ae(d=>F.value="",["self"]))},[l("div",cr,[l("div",dr,[l("div",null,[ur,l("div",fr,R(F.value),1)]),l("button",{class:"sm-close",onClick:c[23]||(c[23]=d=>F.value="")},"\u2715")]),l("div",_r,[l("button",{class:V(["sm-tab",{active:Le.value==="settings"}]),onClick:c[24]||(c[24]=d=>Le.value="settings")},"\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32",2),l("button",{class:V(["sm-tab",{active:Le.value==="members"}]),onClick:c[25]||(c[25]=d=>Le.value="members")},[vr,P.value.length?(_(),m("span",pr,R(P.value.length),1)):K("",!0)],2),l("button",{class:V(["sm-tab",{active:Le.value==="pending"}]),onClick:c[26]||(c[26]=d=>Le.value="pending")},[hr,ut.value.length?(_(),m("span",mr,R(ut.value.length),1)):K("",!0)],2)]),l("div",gr,[Le.value==="settings"?(_(),m(me,{key:0},[ie.value?(_(),m("div",br,[z(Jt,{size:"28px",color:"white"})])):W.value?(_(),m(me,{key:1},[l("div",{class:"sv-toggle-row",onClick:c[27]||(c[27]=d=>ws("isPublic",!W.value.isPublic))},[l("div",yr,[l("div",kr,R(W.value.isPublic?"\u{1F310} \u0E2A\u0E32\u0E18\u0E32\u0E23\u0E13\u0E30":"\u{1F512} \u0E2A\u0E48\u0E27\u0E19\u0E15\u0E31\u0E27"),1),l("div",wr,R(W.value.isPublic?"\u0E41\u0E2A\u0E14\u0E07\u0E43\u0E19\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14":"\u0E40\u0E02\u0E49\u0E32\u0E44\u0E14\u0E49\u0E40\u0E09\u0E1E\u0E32\u0E30\u0E42\u0E04\u0E49\u0E14"),1)]),l("div",{class:V(["sv-toggle-switch",{on:W.value.isPublic}])},Lr,2)]),l("div",{class:"sv-toggle-row",onClick:c[28]||(c[28]=d=>ws("hintsEnabled",!W.value.hintsEnabled))},[l("div",Sr,[l("div",Mr,R(W.value.hintsEnabled?"\u{1F4A1} \u0E04\u0E33\u0E43\u0E1A\u0E49\u0E40\u0E1B\u0E34\u0E14":"\u{1F4A1} \u0E04\u0E33\u0E43\u0E1A\u0E49\u0E1B\u0E34\u0E14"),1),Cr]),l("div",{class:V(["sv-toggle-switch",{on:W.value.hintsEnabled}])},Tr,2)]),l("div",{class:"sv-toggle-row",onClick:c[29]||(c[29]=d=>ws("autoAccept",!W.value.autoAccept))},[l("div",Ir,[l("div",Br,R(W.value.autoAccept?"\u2705 \u0E23\u0E31\u0E1A\u0E2D\u0E31\u0E15\u0E42\u0E19\u0E21\u0E31\u0E15\u0E34":"\u{1F510} \u0E15\u0E49\u0E2D\u0E07\u0E2D\u0E19\u0E38\u0E21\u0E31\u0E15\u0E34\u0E01\u0E48\u0E2D\u0E19"),1),l("div",Ar,R(W.value.autoAccept?"\u0E17\u0E38\u0E01\u0E04\u0E19\u0E40\u0E02\u0E49\u0E32\u0E44\u0E14\u0E49\u0E17\u0E31\u0E19\u0E17\u0E35":"\u0E42\u0E2E\u0E2A\u0E15\u0E49\u0E2D\u0E07\u0E01\u0E14\u0E23\u0E31\u0E1A\u0E17\u0E35\u0E25\u0E30\u0E04\u0E19"),1)]),l("div",{class:V(["sv-toggle-switch",{on:W.value.autoAccept}])},Pr,2)]),$r,l("div",Gr,[(_(!0),m(me,null,nt(J(Ss),d=>(_(),m("div",{key:d.id,class:V(["map-option",{selected:J(se)===d.id}]),onClick:y=>ws("mapId",d.id)},[l("div",zr,R(d.cfg.label),1),l("div",qr,R(d.cfg.desc),1),l("div",Fr,[l("button",{class:V(["map-mode-btn",{active:W.value.mapId===d.id||J(se)!==d.id}]),onClick:Ae(y=>ws("mapId",d.id),["stop"])},"\u0E1B\u0E01\u0E15\u0E34",10,Wr),l("button",{class:V(["map-mode-btn horror",{active:W.value.mapId===d.cfg.horrorId,"no-horror":!d.cfg.horrorId}]),disabled:!d.cfg.horrorId,onClick:Ae(y=>d.cfg.horrorId&&ws("mapId",d.cfg.horrorId),["stop"])},"\u{1F47B} \u0E1C\u0E35",10,Nr)])],10,Dr))),128))])],64)):K("",!0)],64)):Le.value==="members"?(_(),m(me,{key:1},[Nt.value?(_(),m("div",Yr,[z(Jt,{size:"28px",color:"white"})])):P.value.length===0?(_(),m("div",Hr,Vr)):(_(),m("div",Xr,[(_(!0),m(me,null,nt(P.value,d=>(_(),m("div",{key:d.id,class:"sm-member-item"},[l("span",{class:"member-dot",style:ot({background:d.color||"#ccc"})},null,4),l("span",Ur,R(d.name||"\u0E44\u0E21\u0E48\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D"),1),l("button",{class:"ms-btn-danger",style:{"margin-left":"auto"},onClick:y=>bl(d.id)},"\u0E14\u0E35\u0E14\u0E2D\u0E2D\u0E01",8,Qr)]))),128))]))],64)):Le.value==="pending"?(_(),m(me,{key:2},[Nt.value?(_(),m("div",Zr,[z(Jt,{size:"28px",color:"white"})])):ut.value.length===0?(_(),m("div",Jr,tc)):(_(),m("div",sc,[(_(!0),m(me,null,nt(ut.value,d=>(_(),m("div",{key:d.id,class:"sm-member-item"},[l("span",{class:"member-dot",style:ot({background:d.color||"#ccc"})},null,4),l("span",lc,R(d.name||"\u0E44\u0E21\u0E48\u0E23\u0E30\u0E1A\u0E38\u0E0A\u0E37\u0E48\u0E2D"),1),l("div",ac,[l("button",{class:"ms-btn-join",onClick:y=>yl(d.id)},"\u0E23\u0E31\u0E1A",8,oc),l("button",{class:"ms-btn-leave",onClick:y=>kl(d.id)},"\u0E44\u0E21\u0E48\u0E23\u0E31\u0E1A",8,nc)])]))),128))]))],64)):K("",!0)]),l("button",{class:"sm-close-btn",onClick:c[30]||(c[30]=d=>F.value="")},"\u0E1B\u0E34\u0E14")])])):K("",!0)]),_:1})])),(_(),at(rs,{to:"body"},[z(ke,{name:"fade"},{default:U(()=>[mt.value?(_(),m("div",{key:0,class:"ms-modal-overlay",onClick:c[44]||(c[44]=Ae(d=>mt.value=!1,["self"]))},[l("div",ic,[l("div",rc,[cc,l("div",dc,[Ze.value?(_(),m(me,{key:1},[uc,l("button",{class:"ms-clear-yes",disabled:Ye.value,onClick:zs},[Ye.value?(_(),at(Jt,{key:0,size:"14px",color:"white"})):(_(),m("span",_c,"\u0E25\u0E1A"))],8,fc),l("button",{class:"ms-clear-no",disabled:Ye.value,onClick:c[33]||(c[33]=d=>Ze.value=!1)},"\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",8,vc)],64)):(_(),m("button",{key:0,class:"ms-clear-btn",onClick:c[32]||(c[32]=d=>Ze.value=!0)},"\u{1F5D1} \u0E25\u0E49\u0E32\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14")),z(ht,{flat:"",round:"",dense:"",icon:"close",size:"sm",class:"ms-modal-close",onClick:c[34]||(c[34]=d=>mt.value=!1)})])]),l("div",pc,[l("button",{class:V(["ms-tab",{active:be.value==="all"}]),onClick:c[35]||(c[35]=d=>be.value="all")},[hc,l("span",mc,R(Te.value.filter(d=>d.isPublic!==!1).length),1)],2),l("button",{class:V(["ms-tab",{active:be.value==="visited"}]),onClick:c[36]||(c[36]=d=>be.value="visited")},[gc,l("span",bc,R(Re.value.length),1)],2),l("button",{class:V(["ms-tab",{active:be.value==="mine"}]),onClick:c[37]||(c[37]=d=>be.value="mine")},[yc,l("span",kc,R(Te.value.filter(d=>d.isHost).length),1)],2)]),Ue.value?(_(),m("div",wc,[z(Jt,{size:"32px",color:"white"})])):J(Cs).length===0?(_(),m("div",Rc,[Lc,l("div",null,R(be.value==="mine"?"\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E2B\u0E49\u0E2D\u0E07\u0E17\u0E35\u0E48\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E40\u0E2D\u0E07":be.value==="visited"?"\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E1B\u0E23\u0E30\u0E27\u0E31\u0E15\u0E34\u0E01\u0E32\u0E23\u0E40\u0E02\u0E49\u0E32\u0E2B\u0E49\u0E2D\u0E07":"\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E21\u0E35\u0E40\u0E0B\u0E34\u0E23\u0E4C\u0E1F\u0E40\u0E27\u0E2D\u0E23\u0E4C\u0E2A\u0E32\u0E18\u0E32\u0E23\u0E13\u0E30"),1)])):(_(),m("div",Sc,[(_(!0),m(me,null,nt(J(Cs),d=>(_(),m("div",{key:d.code,class:V(["ms-item",{"ms-item-host":d.isHost}])},[l("div",Mc,[l("div",Cc,[we(R(d.name)+" ",1),d.isHost?(_(),m("span",Ec,Bc)):K("",!0)]),l("div",Ac,[l("span",Oc,R(d.code),1),l("span",Pc,"\u{1F465} "+R(d.playerCount),1)])]),l("div",$c,[l("button",{class:"ms-btn-join",onClick:y=>
1{mt.value=!1,Fs(d.code)}},"\u0E40\u0E02\u0E49\u0E32",8,Gc),d.isHost?(_(),m(me,{key:0},[l("button",{class:"ms-btn-settings",onClick:Ae(y=>Us(d),["stop"]),title:"\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32"},"\u2699",8,Dc),l("button",{class:"ms-btn-danger",onClick:Ae(y=>ee.value=d.code,["stop"])},"\u0E25\u0E1A",8,zc)],64)):(_(),m("button",{key:1,class:"ms-btn-leave",onClick:Ae(y=>he.value=d.code,["stop"])},"\u0E2D\u0E2D\u0E01",8,qc))])],2))),128))])),z(ke,{name:"fade"},{default:U(()=>[he.value?(_(),m("div",{key:0,class:"dc-overlay",onClick:c[40]||(c[40]=Ae(d=>he.value="",["self"]))},[l("div",Fc,[Wc,Nc,Yc,l("div",Hc,R(he.value),1),l("div",jc,[l("button",{class:"dc-btn-cancel",onClick:c[38]||(c[38]=d=>he.value=""),disabled:!!Qe.value},"\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",8,Kc),l("button",{class:"dc-btn-leave",disabled:!!Qe.value,onClick:c[39]||(c[39]=d=>Zt(he.value))},[Qe.value?(_(),at(Jt,{key:0,size:"16px",color:"white"})):(_(),m("span",Xc,"\u0E2D\u0E2D\u0E01\u0E40\u0E25\u0E22"))],8,Vc)])])])):K("",!0)]),_:1}),z(ke,{name:"fade"},{default:U(()=>[ee.value?(_(),m("div",{key:0,class:"dc-overlay",onClick:c[43]||(c[43]=Ae(d=>ee.value="",["self"]))},[l("div",Uc,[Qc,Zc,Jc,l("div",xc,R(ee.value),1),l("div",ed,[l("button",{class:"dc-btn-cancel",onClick:c[41]||(c[41]=d=>ee.value=""),disabled:!!Ge.value},"\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",8,td),l("button",{class:"dc-btn-confirm",disabled:!!Ge.value,onClick:c[42]||(c[42]=d=>qs(ee.value))},[Ge.value?(_(),at(Jt,{key:0,size:"16px",color:"white"})):(_(),m("span",ld,"\u0E25\u0E1A\u0E40\u0E25\u0E22"))],8,sd)])])])):K("",!0)]),_:1})])])):K("",!0)]),_:1})])),(_(),at(rs,{to:"body"},[kt.value?(_(),at(ba,{key:0,onRepaired:ul})):K("",!0)])),(_(),at(rs,{to:"body"},[Pt.value?(_(),at(ia,{key:0,question:Pt.value.question,questionNum:Pt.value.questionNum,totalQ:bt,onAnswer:ol,onClose:nl},null,8,["question","questionNum"])):K("",!0)])),(_(),at(rs,{to:"body"},[z(ro,{show:Ps.value,correct:_s.value,total:bt,timeSeconds:J(Qt),onClose:c[45]||(c[45]=d=>Ps.value=!1)},null,8,["show","correct","timeSeconds"])])),z(ke,{name:"fade"},{default:U(()=>[ms.value?(_(),m("div",ad,R(ms.value),1)):K("",!0)]),_:1})]),(_(),at(rs,{to:"body"},[z(ke,{name:"map-load"},{default:U(()=>{var d,y;return[as.value?(_(),m("div",od,[l("div",nd,[id,rd,l("div",cd,R((y=(d=st[Oe.value])==null?void 0:d.label)!=null?y:""),1)])])):K("",!0)]}),_:1})]))],64))}};var hd=Rs(dd,[["__scopeId","data-v-4b72d06e"]]);export{hd as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.