1 line
1.8 KiB
JavaScript
1 line
1.8 KiB
JavaScript
import{I as E,v as b}from"./preview-errors-dde4324f.js";const{addons:m}=__STORYBOOK_MODULE_PREVIEW_API__,{global:y}=__STORYBOOK_MODULE_GLOBAL__;var P="actions",R="storybook/actions",A=`${R}/action-event`,a={depth:10,clearOnStoryChange:!0,limit:50},_=(e,o)=>{let t=Object.getPrototypeOf(e);return!t||o(t)?t:_(t,o)},j=e=>!!(typeof e=="object"&&e&&_(e,o=>/^Synthetic(?:Base)?Event$/.test(o.constructor.name))&&typeof e.persist=="function"),v=e=>{if(j(e)){let o=Object.create(e.constructor.prototype,Object.getOwnPropertyDescriptors(e));o.persist();let t=Object.getOwnPropertyDescriptor(o,"view"),n=t==null?void 0:t.value;return typeof n=="object"&&(n==null?void 0:n.constructor.name)==="Window"&&Object.defineProperty(o,"view",{...t,value:Object.create(n.constructor.prototype)}),o}return e},w=()=>typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?b():Date.now().toString(36)+Math.random().toString(36).substring(2);function D(e,o={}){let t={...a,...o},n=function(...i){var p,l;if(o.implicit){let O=(p="__STORYBOOK_PREVIEW__"in y?y.__STORYBOOK_PREVIEW__:void 0)==null?void 0:p.storyRenders.find(c=>c.phase==="playing"||c.phase==="rendering");if(O){let c=!((l=window==null?void 0:window.FEATURES)!=null&&l.disallowImplicitActionsInRenderV8),g=new E({phase:O.phase,name:e,deprecated:c});if(c)console.warn(g);else throw g}}let r=m.getChannel(),d=w(),f=5,s=i.map(v),h=i.length>1?s:s[0],u={id:d,count:0,data:{name:e,args:h},options:{...t,maxDepth:f+(t.depth||3),allowFunction:t.allowFunction||!1}};r.emit(A,u)};return n.isAction=!0,n}var S=(...e)=>{let o=a,t=e;t.length===1&&Array.isArray(t[0])&&([t]=t),t.length!==1&&typeof t[t.length-1]!="string"&&(o={...a,...t.pop()});let n=t[0];(t.length!==1||typeof n=="string")&&(n={},t.forEach(r=>{n[r]=r}));let i={};return Object.keys(n).forEach(r=>{i[r]=D(n[r],o)}),i};export{P,D as a,S as b};
|