import{s as K,g as v,a as _,b as S,t as Y,p as Z}from"../chunks/legacy.MjBvvGLm.js";import{aG as Q,aH as X,L as aa,M as ea,x as O,j as ta,O as na,w as sa,k as ra,$ as oa,aI as ia,p as N,aJ as g,aK as M,f as b,a as B,t as la,F as t,aL as k,_ as y,G as p}from"../chunks/utils.Bch77dSh.js";import{e as ca,i as ga,s as D,L as ua,a as fa,b as ha,c as H,d as ma}from"../chunks/index.CBZfw3Mb.js";import{n as $,p as E,s as I,i as da}from"../chunks/i18n.D7wMA4yh.js";import{p as x,i as j}from"../chunks/props.ChTZ5wkX.js";import{i as q}from"../chunks/lifecycle.DsUxRvcF.js";import{p as T}from"../chunks/stores.BcFlh_A8.js";import{b as F,i as pa}from"../chunks/entry.B_Jif6VC.js";import{g as _a}from"../chunks/control.DkBfWYwi.js";function La(s,a,u){O&&ta();var r=s,e=oa,i,l=Q()?X:aa;ea(()=>{l(e,e=a())&&(i&&na(i),i=sa(()=>u(r)))}),O&&(r=ra)}const va=ia;function ba(s,a){return s.protocol!==a.protocol?a.href:a.password||a.username?"//"+[a.username,a.password].filter(Boolean).join(":")+"@"+a.host+a.pathname+a.search+a.hash:s.host!==a.host?"//"+a.host+a.pathname+a.search+a.hash:a.pathname+a.search+a.hash}function ka(s,a,u){const r=new URL(u??"/",a).pathname;return s.origin!==a.origin||!s.pathname.startsWith(r)}var ya=Y('<link rel="alternate">');function Pa(s,a){N(a,!1);const u=K(),r=()=>S(T,"$page",u),e=k(),i=k(),l=k(),P=$(F,new URL(r().url))||"/";let n=x(a,"availableLanguageTags",8),f=x(a,"strategy",8),A=x(a,"currentLang",8);const R=(c,o)=>{const d=[];for(const w of n()){const U=o.getLocalisedPath(c,w),L=I(U,P,void 0),h=new URL(L,new URL(r().url)).href;d.push(h)}return d};g(()=>r(),()=>{y(e,E(r().url.pathname,P)[0])}),g(()=>(p(f()),t(e),p(A())),()=>{y(i,f().getCanonicalPath(t(e),A()))}),g(()=>(t(i),p(f())),()=>{y(l,R(t(i),f()))}),M(),q();var C=v(),m=b(C);j(m,()=>n().length>=1,c=>{var o=v(),d=b(o);ca(d,1,()=>t(l),ga,(w,U,L)=>{var h=ya();la(()=>{D(h,"hreflang",n()[L]),D(h,"href",t(U))}),_(w,h)}),_(c,o)}),_(s,C),B()}const wa=(s,a)=>`${ua}=${s};Path=${a};SameSite=lax;Max-Age=31557600`;function Ua(s,a){N(a,!1);const u=K(),r=()=>S(T,"$page",u),e=k(),i=k(),l=$(F,new URL(r().url))||"/";let P=x(a,"languageTag",24,()=>{}),n=x(a,"i18n",8),f=k(0);function A(m,c){try{const o=new URL(_a(T).url),[d,w]=E(o.pathname,l),U=n().strategy.getCanonicalPath(d,t(e)),L=new URL(o);L.pathname=I(U,l,w);const h=new URL(m,new URL(L));if(ka(h,o,l)||n().config.exclude(h.pathname))return m;const J=c??t(e),[V,z]=E(h.pathname,l),W=n().strategy.getLocalisedPath(V,J),G=new URL(h);return G.pathname=I(W,l,z),ba(o,G)}catch{return m}}fa({translateHref:A}),g(()=>(p(P()),p(n()),r()),()=>{y(e,P()??n().getLanguageFromUrl(r().url))}),g(()=>(p(n()),t(e)),()=>{n().config.runtime.setLanguageTag(t(e))}),g(()=>t(e),()=>{document.documentElement.lang=t(e)}),g(()=>(p(n()),t(e)),()=>{document.documentElement.dir=n().config.textDirection[t(e)]??"ltr"}),g(()=>(t(e),t(f)),()=>{t(e)&&y(f,t(f)+1)}),g(()=>(t(e),t(f),H),()=>{t(e)&&(t(f)>1||va)&&pa(H)}),g(()=>t(e),()=>{y(i,t(e))}),g(()=>t(e),()=>{document.cookie=wa(t(e),l)}),M(),q();var R=v();Z(m=>{var c=v(),o=b(c);j(o,()=>n().config.seo.noAlternateLinks!==!0&&!n().config.exclude(r().url.pathname),d=>{Pa(d,{get availableLanguageTags(){return n().config.runtime.availableLanguageTags},get strategy(){return n().strategy},get currentLang(){return t(e)}})}),_(m,c)});var C=b(R);La(C,()=>t(i),m=>{var c=v(),o=b(c);ha(o,a,"default",{},null),_(m,c)}),_(s,R),B()}function Ga(s,a){N(a,!0),Ua(s,{i18n:da,children:(u,r)=>{var e=v(),i=b(e);ma(i,()=>a.children),_(u,e)},$$slots:{default:!0}}),B()}export{Ga as component};
