Anvil/assets/preview-0aa87ae6.js
André Jaenisch 7608654359
Updates
2024-03-03 15:38:10 +01:00

1 line
1.7 KiB
JavaScript

import{a as w}from"./chunk-WFFRPTHA-ed72344b.js";import{o as C,s as x,g as N}from"./lifecycle-96ebe68d.js";import"./preview-errors-dde4324f.js";import"./index-356e4a49.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[U,F]=f("page-ctx"),[_,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};