import{_ as q}from"./D0tAuAH-.js";import{cI as P,eg as $,ej as R,d9 as D,cO as y,ee as g,cJ as k,cL as j,db as w,ez as U,cM as W,e3 as z,cP as C,ds as A,cX as s,cQ as l,eH as F,cR as n,cS as c,cT as H,cW as L,cU as _,cY as b,dk as M,cV as O}from"./BC4hLSsA.js";import{V as T,a as E}from"./4kGmKtnr.js";import{V as G}from"./CSZeIc-n.js";import{V as J}from"./C6iUKSE9.js";const Q={class:"gameCard-content"},X={class:"text-body-1 font-weight-semibold mt-4"},ae=P({__name:"NetworkSwitcher",props:{chainIds:{type:Object,required:!0},label:{type:String,required:!0},mode:{type:String,default:"redirect"},overridePath:{type:String,required:!1},persistent:{type:Boolean,default:!0},priority:{type:Number,default:0}},setup(i){const o=$(),v=R(),V=D(),t=i,S=y(()=>t.chainIds.map(e=>g[e])),x=e=>`/${b[e.id]}${t.overridePath??o.path}`,m=k(!1);j(()=>{w(()=>o.query.selectNetwork,e=>{m.value=!!e},{immediate:!0})});const B=e=>{t.mode=="wallet"&&(V.changeChainWithUserRequest(e),setTimeout(()=>{d()},500))},d=()=>{const e={...o.query};delete e.selectNetwork,v.push({path:o.path,query:e,hash:o.hash})},a=U("network-switcher-priority",k(0));w(a,e=>{t.priority>e&&(a.value=t.priority)},{immediate:!0});const I=y(()=>t.priority==a.value);W(()=>{t.priority===a.value&&(a.value=0)});const u=z("frameContext");return(e,Y)=>{var p,h,f;const N=q;return s(I)?(l(),C(N,{key:0,"model-value":s(m),"max-width":"620",persistent:i.persistent,"on-close":d,"close-on-other-dialog-open-mobile":!1,title:i.label,style:F({marginBottom:(f=(h=(p=s(u))==null?void 0:p.client)==null?void 0:h.safeAreaInsets)!=null&&f.bottom?`${s(u).client.safeAreaInsets.bottom}`:"0"})},{default:n(()=>[c(E,{class:"mt-0"},{default:n(()=>[(l(!0),H(O,null,L(s(S),r=>(l(),C(T,{cols:"4",sm:"3",class:"px-2 px-sm-3"},{default:n(()=>[c(G,{block:"",to:i.mode=="redirect"?x(r):"",onClick:K=>B(r.id),class:"gameCard gameCard-ratio mt-4 mt-sm-6"},{default:n(()=>[_("div",Q,[c(J,{src:`/img/chains/${s(b)[r.id]}.svg`,width:"28",height:"28",inline:"",alt:s(g)[r.id].name},null,8,["src","alt"]),_("div",X,M(r.name),1)])]),_:2},1032,["to","onClick"])]),_:2},1024))),256))]),_:1})]),_:1},8,["model-value","persistent","title","style"])):A("",!0)}}});export{ae as _};