1 line
No EOL
7.7 KiB
Text
1 line
No EOL
7.7 KiB
Text
{"version":3,"file":"preview-Co4YIjAr.js","sources":["../../node_modules/@storybook/addon-actions/dist/preview.mjs"],"sourcesContent":["import { v4 } from 'uuid';\nimport { addons } from 'storybook/internal/preview-api';\nimport { global } from '@storybook/global';\nimport { ImplicitActionsDuringRendering } from 'storybook/internal/preview-errors';\n\nvar ADDON_ID=\"storybook/actions\",EVENT_ID=`${ADDON_ID}/action-event`;var config={depth:10,clearOnStoryChange:!0,limit:50};var findProto=(obj,callback)=>{let proto=Object.getPrototypeOf(obj);return !proto||callback(proto)?proto:findProto(proto,callback)},isReactSyntheticEvent=e=>!!(typeof e==\"object\"&&e&&findProto(e,proto=>/^Synthetic(?:Base)?Event$/.test(proto.constructor.name))&&typeof e.persist==\"function\"),serializeArg=a=>{if(isReactSyntheticEvent(a)){let e=Object.create(a.constructor.prototype,Object.getOwnPropertyDescriptors(a));e.persist();let viewDescriptor=Object.getOwnPropertyDescriptor(e,\"view\"),view=viewDescriptor?.value;return typeof view==\"object\"&&view?.constructor.name===\"Window\"&&Object.defineProperty(e,\"view\",{...viewDescriptor,value:Object.create(view.constructor.prototype)}),e}return a},generateId=()=>typeof crypto==\"object\"&&typeof crypto.getRandomValues==\"function\"?v4():Date.now().toString(36)+Math.random().toString(36).substring(2);function action(name,options={}){let actionOptions={...config,...options},handler=function(...args){if(options.implicit){let storyRenderer=(\"__STORYBOOK_PREVIEW__\"in global?global.__STORYBOOK_PREVIEW__:void 0)?.storyRenders.find(render=>render.phase===\"playing\"||render.phase===\"rendering\");if(storyRenderer){let deprecated=!window?.FEATURES?.disallowImplicitActionsInRenderV8,error=new ImplicitActionsDuringRendering({phase:storyRenderer.phase,name,deprecated});if(deprecated)console.warn(error);else throw error}}let channel=addons.getChannel(),id=generateId(),minDepth=5,serializedArgs=args.map(serializeArg),normalizedArgs=args.length>1?serializedArgs:serializedArgs[0],actionDisplayToEmit={id,count:0,data:{name,args:normalizedArgs},options:{...actionOptions,maxDepth:minDepth+(actionOptions.depth||3),allowFunction:actionOptions.allowFunction||!1}};channel.emit(EVENT_ID,actionDisplayToEmit);};return handler.isAction=!0,handler.implicit=options.implicit,handler}var isInInitialArgs=(name,initialArgs)=>typeof initialArgs[name]>\"u\"&&!(name in initialArgs),inferActionsFromArgTypesRegex=context=>{let{initialArgs,argTypes,id,parameters:{actions}}=context;if(!actions||actions.disable||!actions.argTypesRegex||!argTypes)return {};let argTypesRegex=new RegExp(actions.argTypesRegex);return Object.entries(argTypes).filter(([name])=>!!argTypesRegex.test(name)).reduce((acc,[name,argType])=>(isInInitialArgs(name,initialArgs)&&(acc[name]=action(name,{implicit:!0,id})),acc),{})},addActionsFromArgTypes=context=>{let{initialArgs,argTypes,parameters:{actions}}=context;return actions?.disable||!argTypes?{}:Object.entries(argTypes).filter(([name,argType])=>!!argType.action).reduce((acc,[name,argType])=>(isInInitialArgs(name,initialArgs)&&(acc[name]=action(typeof argType.action==\"string\"?argType.action:name)),acc),{})};var argsEnhancers=[addActionsFromArgTypes,inferActionsFromArgTypesRegex];var subscribed=!1,logActionsWhenMockCalled=context=>{let{parameters:{actions}}=context;if(!actions?.disable&&!subscribed&&\"__STORYBOOK_TEST_ON_MOCK_CALL__\"in global&&typeof global.__STORYBOOK_TEST_ON_MOCK_CALL__==\"function\"){let onMockCall=global.__STORYBOOK_TEST_ON_MOCK_CALL__;onMockCall((mock,args)=>{let name=mock.getMockName();name!==\"spy\"&&(!/^next\\/.*::/.test(name)||[\"next/router::useRouter()\",\"next/navigation::useRouter()\",\"next/navigation::redirect\",\"next/cache::\",\"next/headers::cookies().set\",\"next/headers::cookies().delete\",\"next/headers::headers().set\",\"next/headers::headers().delete\"].some(prefix=>name.startsWith(prefix)))&&action(name)(args);}),subscribed=!0;}},loaders=[logActionsWhenMockCalled];\n\nexport { argsEnhancers, loaders };\n"],"names":["addons","global","ImplicitActionsDuringRendering","ADDON_ID","EVENT_ID","config","findProto","obj","callback","proto","isReactSyntheticEvent","e","serializeArg","a","viewDescriptor","view","generateId","v4","action","name","options","actionOptions","handler","args","storyRenderer","_a","render","deprecated","_b","error","channel","id","minDepth","serializedArgs","normalizedArgs","actionDisplayToEmit","isInInitialArgs","initialArgs","inferActionsFromArgTypesRegex","context","argTypes","actions","argTypesRegex","acc","argType","addActionsFromArgTypes","argsEnhancers","subscribed","logActionsWhenMockCalled","onMockCall","mock","prefix","loaders"],"mappings":"qCACA,KAAA,CAAA,OAAAA,CAAA,EAAA,iCACA,CAAA,OAAAC,CAAA,EAAA,4BACA,CAAA,+BAAAC,CAAA,EAAA,gDAEA,IAAIC,EAAS,oBAAoBC,EAAS,GAAGD,CAAQ,gBAAoBE,EAAO,CAAC,MAAM,GAAG,mBAAmB,GAAG,MAAM,EAAE,EAAMC,EAAU,CAACC,EAAIC,IAAW,CAAC,IAAIC,EAAM,OAAO,eAAeF,CAAG,EAAE,MAAO,CAACE,GAAOD,EAASC,CAAK,EAAEA,EAAMH,EAAUG,EAAMD,CAAQ,CAAC,EAAEE,EAAsBC,GAAG,CAAC,EAAE,OAAOA,GAAG,UAAUA,GAAGL,EAAUK,EAAEF,GAAO,4BAA4B,KAAKA,EAAM,YAAY,IAAI,CAAC,GAAG,OAAOE,EAAE,SAAS,YAAYC,EAAaC,GAAG,CAAC,GAAGH,EAAsBG,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,OAAOA,EAAE,YAAY,UAAU,OAAO,0BAA0BA,CAAC,CAAC,EAAE,EAAE,QAAO,EAAG,IAAIC,EAAe,OAAO,yBAAyB,EAAE,MAAM,EAAEC,EAAKD,GAAA,YAAAA,EAAgB,MAAM,OAAO,OAAOC,GAAM,WAAUA,GAAA,YAAAA,EAAM,YAAY,QAAO,UAAU,OAAO,eAAe,EAAE,OAAO,CAAC,GAAGD,EAAe,MAAM,OAAO,OAAOC,EAAK,YAAY,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,OAAOF,CAAC,EAAEG,EAAW,IAAI,OAAO,QAAQ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