2024-07-24 17:58:32 +02:00
|
|
|
import{a as w}from"./chunk-MZXVCX43-5rTpxkNE.js";import{o as C,s as x,g as N}from"./lifecycle-u0QeOdKt.js";import"./v4-D8aEg3BZ.js";function R(t){x("after-navigate-args",t)}function f(t){return[{subscribe(s){let e=N(t);return s(e),()=>{}}},s=>{x(t,s)}]}var[O,F]=f("page-ctx"),[U,H]=f("navigating-ctx"),[S,T]=f("updated-ctx");S.check=()=>{};var D=t=>typeof t=="function"?{callback:t,asRegex:!1}:t,_=[(t,s)=>{var d,v,u,m,L;let e=((d=s.parameters)==null?void 0:d.sveltekit_experimental)??{};return F((v=e==null?void 0:e.stores)==null?void 0:v.page),H((u=e==null?void 0:e.stores)==null?void 0:u.navigating),T((m=e==null?void 0:e.stores)==null?void 0:m.updated),R((L=e==null?void 0:e.navigation)==null?void 0:L.afterNavigate),C(()=>{let h=r=>{let c=r.composedPath().findLast(n=>n instanceof HTMLElement&&n.tagName==="A");if(c&&c instanceof HTMLAnchorElement){let n=c.getAttribute("href");if(!n)return;r.preventDefault();let g=()=>w("navigate")(n,r);if(!e.hrefs){g();return}let a=!0;Object.entries(e.hrefs).forEach(([i,l])=>{let{callback:o,asRegex:p}=D(l);(p?new RegExp(i).test(n):n===i)&&(a=!1,o==null||o(n,r))}),a&&g()}};function E(r,c,n){let g=[];return c.forEach(a=>{var l;let i=((l=e[r])==null?void 0:l[a])&&e[r][a]instanceof Function;if(i||n){let o=({detail:k=[]})=>{let y=Array.isArray(k)?k:[];(i?e[r][a]:w(a))(...y)},p=`storybook:${a}`;g.push({eventType:p,listener:o}),window.addEventListener(p,o)}}),()=>{g.forEach(({eventType:a,listener:i})=>{window.removeEventListener(a,i)})}}let A=E("navigation",["goto","invalidate","invalidateAll","pushState","replaceState"],!0),b=E("forms",["enhance"]);return window.addEventListener("click",h),()=>{window.removeEventListener("click",h),A(),b()}}),t()}];export{_ as decorators};
|