import{X as z}from"./vendor-icons-B2dQ8Ycb-aster.js";import{B as m}from"./vendor-ui-SnQwDthD-aster.js";import{k as E,w as f,o as I,b as V,_ as L,Z as n,I as x,Y as g,N as v,$ as r,X as y,a1 as N,r as _,c,j as M,n as W,V as R}from"./vendor-vue-Dqr9UV61-aster.js";import{_ as q}from"./_plugin-vue_export-helper-DlAUqK2U-aster.js";const H={key:0,class:"page-tour-layer","aria-live":"polite"},X=["aria-labelledby"],j={class:"page-tour-eyebrow"},A=["id"],D={class:"page-tour-actions"},F=E({__name:"PageTour",props:{show:{type:Boolean},steps:{},titleId:{}},emits:["update:show"],setup(u,{emit:b}){const a=u,k=b,o=_(0),e=_({top:0,left:0,width:0,height:0}),S=c(()=>a.steps[0]),l=c(()=>a.steps[o.value]??S.value),w=c(()=>a.titleId||"pageTourTitle"),T=c(()=>({top:`${e.value.top}px`,left:`${e.value.left}px`,width:`${e.value.width}px`,height:`${e.value.height}px`})),B=c(()=>{const t=Math.min(390,Math.max(300,window.innerWidth-32)),s=e.value.left+e.value.width+16+t<=window.innerWidth,$=e.value.left-16-t>=16,C=s?e.value.left+e.value.width+16:$?e.value.left-16-t:Math.min(Math.max(16,e.value.left),window.innerWidth-t-16);return{top:`${Math.min(Math.max(16,e.value.top),Math.max(16,window.innerHeight-260-16))}px`,left:`${C}px`,width:`${t}px`}});function d(){!a.show||!l.value||W(()=>{const i=document.querySelector(l.value.target);i&&(i.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),window.requestAnimationFrame(()=>{const t=i.getBoundingClientRect(),s=8;e.value={top:Math.max(8,t.top-s),left:Math.max(8,t.left-s),width:Math.min(window.innerWidth-16,t.width+s*2),height:Math.min(window.innerHeight-16,t.height+s*2)}}))})}function h(){k("update:show",!1)}function P(){if(o.value>=a.steps.length-1){h();return}o.value+=1,d()}function p(){a.show&&d()}return f(()=>a.show,i=>{i&&(o.value=0,d())}),f(o,d),I(()=>{window.addEventListener("resize",p),window.addEventListener("scroll",p,!0)}),V(()=>{window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0)}),(i,t)=>u.show&&l.value?(R(),L("div",H,[n("div",{class:"page-tour-highlight",style:x(T.value),"aria-hidden":"true"},null,4),n("section",{class:"page-tour-card",style:x(B.value),role:"dialog","aria-modal":"true","aria-labelledby":w.value},[n("button",{class:"page-tour-close",type:"button","aria-label":"关闭教程",onClick:h},[g(v(z),{size:18})]),n("p",j,"STEP "+r(o.value+1)+" / "+r(u.steps.length),1),n("h3",{id:w.value},r(l.value.title),9,A),n("p",null,r(l.value.text),1),n("div",D,[g(v(m),{size:"small",secondary:"",onClick:h},{default:y(()=>[...t[0]||(t[0]=[M("结束教程",-1)])]),_:1}),g(v(m),{size:"small",type:"primary",onClick:P},{default:y(()=>[M(r(o.value>=u.steps.length-1?"完成教程":"下一个"),1)]),_:1})])],12,X)])):N("",!0)}}),K=q(F,[["__scopeId","data-v-31f9d09c"]]);export{K as P};
