{"version":3,"file":"preview-CXooXs_x.js","sources":["../../node_modules/@storybook/sveltekit/dist/preview.mjs"],"sourcesContent":["import { action } from '@storybook/addon-actions';\nimport { onMount, setContext, getContext } from 'svelte';\n\nfunction setAfterNavigateArgument(afterNavigateArgs){setContext(\"after-navigate-args\",afterNavigateArgs);}function createMockedStore(contextName){return [{subscribe(runner){let page2=getContext(contextName);return runner(page2),()=>{}}},value=>{setContext(contextName,value);}]}var[page,setPage]=createMockedStore(\"page-ctx\"),[navigating,setNavigating]=createMockedStore(\"navigating-ctx\"),[updated,setUpdated]=createMockedStore(\"updated-ctx\");updated.check=()=>{};var normalizeHrefConfig=hrefConfig=>typeof hrefConfig==\"function\"?{callback:hrefConfig,asRegex:!1}:hrefConfig,decorators=[(Story,ctx)=>{let svelteKitParameters=ctx.parameters?.sveltekit_experimental??{};return setPage(svelteKitParameters?.stores?.page),setNavigating(svelteKitParameters?.stores?.navigating),setUpdated(svelteKitParameters?.stores?.updated),setAfterNavigateArgument(svelteKitParameters?.navigation?.afterNavigate),onMount(()=>{let globalClickListener=e=>{let element=e.composedPath().findLast(el=>el instanceof HTMLElement&&el.tagName===\"A\");if(element&&element instanceof HTMLAnchorElement){let to=element.getAttribute(\"href\");if(!to)return;e.preventDefault();let defaultActionCallback=()=>action(\"navigate\")(to,e);if(!svelteKitParameters.hrefs){defaultActionCallback();return}let callDefaultCallback=!0;Object.entries(svelteKitParameters.hrefs).forEach(([href,hrefConfig])=>{let{callback,asRegex}=normalizeHrefConfig(hrefConfig);(asRegex?new RegExp(href).test(to):to===href)&&(callDefaultCallback=!1,callback?.(to,e));}),callDefaultCallback&&defaultActionCallback();}};function createListeners(baseModule,functions,defaultToAction){let toRemove=[];return functions.forEach(func=>{let hasFunction=svelteKitParameters[baseModule]?.[func]&&svelteKitParameters[baseModule][func]instanceof Function;if(hasFunction||defaultToAction){let listener=({detail=[]})=>{let args=Array.isArray(detail)?detail:[];(hasFunction?svelteKitParameters[baseModule][func]:action(func))(...args);},eventType=`storybook:${func}`;toRemove.push({eventType,listener}),window.addEventListener(eventType,listener);}}),()=>{toRemove.forEach(({eventType,listener})=>{window.removeEventListener(eventType,listener);});}}let removeNavigationListeners=createListeners(\"navigation\",[\"goto\",\"invalidate\",\"invalidateAll\",\"pushState\",\"replaceState\"],!0),removeFormsListeners=createListeners(\"forms\",[\"enhance\"]);return window.addEventListener(\"click\",globalClickListener),()=>{window.removeEventListener(\"click\",globalClickListener),removeNavigationListeners(),removeFormsListeners();}}),Story()}];\n\nexport { decorators };\n"],"names":["setAfterNavigateArgument","afterNavigateArgs","setContext","createMockedStore","contextName","runner","page2","getContext","value","page","setPage","navigating","setNavigating","updated","setUpdated","normalizeHrefConfig","hrefConfig","decorators","Story","ctx","svelteKitParameters","_a","_b","_c","_d","_e","onMount","globalClickListener","e","element","el","to","defaultActionCallback","action","callDefaultCallback","href","callback","asRegex","createListeners","baseModule","functions","defaultToAction","toRemove","func","hasFunction","listener","detail","args","eventType","removeNavigationListeners","removeFormsListeners"],"mappings":"oIAGA,SAASA,EAAyBC,EAAkB,CAACC,EAAW,sBAAsBD,CAAiB,CAAE,CAAC,SAASE,EAAkBC,EAAY,CAAC,MAAO,CAAC,CAAC,UAAUC,EAAO,CAAC,IAAIC,EAAMC,EAAWH,CAAW,EAAE,OAAOC,EAAOC,CAAK,EAAE,IAAI,CAAE,CAAA,CAAC,EAAEE,GAAO,CAACN,EAAWE,EAAYI,CAAK,CAAE,CAAC,CAAC,CAAC,GAAG,CAACC,EAAKC,CAAO,EAAEP,EAAkB,UAAU,EAAE,CAACQ,EAAWC,CAAa,EAAET,EAAkB,gBAAgB,EAAE,CAACU,EAAQC,CAAU,EAAEX,EAAkB,aAAa,EAAEU,EAAQ,MAAM,IAAI,CAAE,EAAI,IAACE,EAAoBC,GAAY,OAAOA,GAAY,WAAW,CAAC,SAASA,EAAW,QAAQ,EAAE,EAAEA,EAAWC,EAAW,CAAC,CAACC,EAAMC,IAAM,eAAC,IAAIC,IAAoBC,E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