import{aP as I,aQ as M,i as s,p as T,ax as g,az as q,m as H,aR as L,n as N}from"./app-JmgyQoR0.js";import{X as W}from"./MkWindow-CDKuPhD-.js";import{p as F}from"./popout-CZfGmYRx.js";import{b as S,a as u,c as p,p as r,h as i,i as m,j as f,F as V,x as X,t as b,H as w,E as j,u as k,y as D,z as K}from"./vue-y3KLWBaS.js";import"./contains-sEkIgjp4.js";const O=S({__name:"MkPageWindow",props:{initialPath:{}},emits:["closed"],setup(y,{expose:C}){const x=y,e=new I(M,x.initialPath);let a=u(),n=u();const o=u([{path:e.getCurrentPath(),key:e.getCurrentKey()}]),P=p(()=>{const t=[];return o.value.length>1&&t.push({icon:"ph-caret-left ph-bold ph-lg",onClick:z}),t}),_=p(()=>[{icon:"ph-arrow-clockwise ph-bold ph-lg",title:s.ts.reload,onClick:R},{icon:"ph-arrows-out-simple ph-bold ph-lg",title:s.ts.showInPage,onClick:h}]);let c=u(0);e.addListener("push",t=>{o.value.push({path:t.path,key:t.key})}),r("router",e),T(t=>{a.value=t}),r("shouldOmitHeaderTitle",!0),r("shouldBackButton",!1),r("shouldHeaderThin",!0);const B=p(()=>[{icon:"ph-arrows-out-simple ph-bold ph-lg",text:s.ts.showInPage,action:h},{icon:"ph-arrow-square-out ph-bold ph-lg",text:s.ts.popout,action:E},{icon:"ph-arrow-square-out ph-bold ph-lg",text:s.ts.openInNewTab,action:()=>{window.open(g+e.getCurrentPath(),"_blank"),n.value.close()}},{icon:"ph-link-simple ph-bold ph-lg",text:s.ts.copyLink,action:async()=>{await q(g+e.getCurrentPath())}}]);function z(){o.value.pop(),e.replace(o.value[o.value.length-1].path,o.value[o.value.length-1].key)}function R(){c.value++}function $(){n.value.close()}function h(){H.push(e.getCurrentPath(),"forcePage"),n.value.close()}function E(){F(e.getCurrentPath(),n.value.$el),n.value.close()}return C({close:$}),(t,d)=>(i(),m(W,{ref_key:"windowEl",ref:n,"initial-width":500,"initial-height":500,"can-resize":!0,"close-button":!0,"buttons-left":P.value,"buttons-right":_.value,contextmenu:B.value,onClosed:d[0]||(d[0]=l=>t.$emit("closed")),class:"page-window"},{header:f(()=>{var l;return[(l=a.value)!=null&&l.value?(i(),b(V,{key:0},[a.value.value.icon?(i(),b("i",{key:0,class:X(["icon",a.value.value.icon]),style:{"margin-right":"0.5em"}},null,2)):w("",!0),k("span",null,j(a.value.value.title),1)],64)):w("",!0)]}),default:f(()=>{var l,v;return[k("div",{class:"yrolvcoq",style:D({background:(v=(l=a.value)==null?void 0:l.value)==null?void 0:v.bg})},[(i(),m(L,{key:c.value,router:K(e)},null,8,["router"]))],4)]}),_:1},8,["buttons-left","buttons-right","contextmenu"]))}}),Y=N(O,[["__scopeId","data-v-4c29467e"]]);export{Y as default};
