(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))d(t);new MutationObserver(t=>{for(const n of t)if(n.type==="childList")for(const s of n.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&d(s)}).observe(document,{childList:!0,subtree:!0});function a(t){const n={};return t.integrity&&(n.integrity=t.integrity),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?n.credentials="include":t.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function d(t){if(t.ep)return;t.ep=!0;const n=a(t);fetch(t.href,n)}})();function I(o){const r=new URLSearchParams(location.search).get("host")??"*",a=t=>window.parent.postMessage({m3:1,...t},r);let d=0;return window.addEventListener("message",t=>{var s,l,u;if(t.source!==window.parent||r!=="*"&&t.origin!==r)return;const n=t.data;if(!(!n||n.m3!==1))switch(n.type){case"init":o.onInit(n),a({type:"ready"});break;case"state":o.onState(n.env);break;case"ack":(s=o.onAck)==null||s.call(o,n);break;case"view_changed":(l=o.onViewChanged)==null||l.call(o,n.view);break;case"cmd_failed":(u=o.onCmdFailed)==null||u.call(o,n.req_id,n.code);break}}),a({type:"loaded"}),{cmd(t,n={}){const s=++d;return a({type:"cmd",cmd_type:t,payload:n,req_id:s}),s},toast(t,n,s="info"){a({type:"toast",text_fa:t,text_en:n,kind:s})}}}let e=null,w=null;const i=(o,r)=>(w==null?void 0:w.locale)==="en"?r:o,k=I({onInit(o){w=o,document.documentElement.lang=o.locale,document.documentElement.dir=o.dir,p()},onState(o){o.t==="snap"&&(e=o.body,e.turn!==e.me&&(c="",m=null),p())},onAck(o){o.status==="rejected"&&k.toast("حرکت پذیرفته نشد","Move not accepted","warn")}});function p(){var q,h,C,L;const o=document.getElementById("app");if(!e){o.innerHTML=`
${i("در حال بارگذاری…","Loading…")}
`;return}const r=e.me,a=r!=null?(q=e.players[r])==null?void 0:q.color:null,d=a==="b",t={};for(const f of e.board)t[f.square]=f;const n=d?[7,6,5,4,3,2,1,0]:[0,1,2,3,4,5,6,7],s=d?[0,1,2,3,4,5,6,7]:[7,6,5,4,3,2,1,0],l=e.phase==="play"&&e.turn===r,u=s.map(f=>n.map(_=>{const g=String.fromCharCode(97+_)+(f+1),y=t[g]||{type:null,color:null},P=y.color?`${M(y.type,y.color)}`:"",O=l&&!!a&&y.color===a,E=c===g,H=c?l:O;return``}).join("")).join(""),b=c?`
${i("مبدا","From")}: ${c} — ${i("یک خانه مقصد را بزنید (برای لغو، دوباره همان خانه)","click a target square (click it again to cancel)")}