-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreview-0fed05f2.js
2 lines (2 loc) · 3.83 KB
/
preview-0fed05f2.js
1
2
function m(e,r){for(var t=0;t<r.length;t++){const o=r[t];if(typeof o!="string"&&!Array.isArray(o)){for(const n in o)if(n!=="default"&&!(n in e)){const i=Object.getOwnPropertyDescriptor(o,n);i&&Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:()=>o[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var u={},s={},f={};Object.defineProperty(f,"__esModule",{value:!0});f.stringify=f.isPojo=f.setProperty=void 0;function g(e,r,t){if(typeof e!="object"||e===null)return e;const o=r.split("."),n=o.shift();if(!n)return e;if(!o.length)return e[n]=t,e;let i=e[n];if(i===void 0)e[n]={},i=e[n];else if(!i||typeof i!="object")return e;return g(i,o.join("."),t),e}f.setProperty=g;const O=[Object.prototype,null];function l(e){return!!(typeof e=="object"&&e&&O.includes(Object.getPrototypeOf(e)))}f.isPojo=l;function P(e){return JSON.stringify(e,p,2)}f.stringify=P;function p(e,r){if(r===void 0)return"[undefined]";if(typeof r=="number"){if(isNaN(r))return"[NaN]";if(!isFinite(r))return"[Infinity]"}if(!r)return r;if(r instanceof Error)return`[Error("${r.message}")]`;if(typeof r=="function")return`[Function:${r.name||"anonymous"}]`;if(typeof r=="symbol")return`[${r.toString()}]`;if(r instanceof Promise)return"[Promise]";if(r instanceof Map){const t={};for(const[o,n]of r.entries())t[o]=n;return t}return r instanceof RegExp?r.toString():r instanceof Set?Array.from(r):Array.isArray(r)?r.map((t,o)=>p(`${e}[${o}]`,t)):typeof r=="object"?l(r)?r:`[${r.constructor.name}]`:r}Object.defineProperty(s,"__esModule",{value:!0});s.expandObject=s.createFlattenedArgTypes=s.flattenObject=void 0;const c=f,j=new Set(["bigint","boolean","number","string","undefined"]);function A(e){return j.has(typeof e)||e===null}function T(e){return e==null}function y(e,r={currentPath:"",flatObjectOut:{}}){if((0,c.isPojo)(e))return Object.entries(e).forEach(([t,o])=>{if(r.currentPath&&(t=`${r.currentPath}.${t}`),!(0,c.isPojo)(o)){r.flatObjectOut[t]=o;return}y(o,{currentPath:t,flatObjectOut:r.flatObjectOut})}),r.flatObjectOut}s.flattenObject=y;function h(e){return{name:e,control:{type:"object"}}}function d(e){return{name:e,table:{disable:!0}}}function _(e){const r={name:e.name};switch(typeof e.value){case"string":return{...r,type:{name:"string"},control:{type:"text"}};case"number":case"bigint":return{...r,type:{name:"number"},control:{type:"number"}};case"boolean":return{...r,type:{name:"boolean"},control:{type:"boolean"}};case"function":case"undefined":case"object":case"symbol":default:{const t=`Unsupported arg value type: ${typeof e.value} for ${e.name}`;throw console.error(t,e),new Error(t)}}}function v(e,r){for(const t of r)if(e.startsWith(`${t}.`))return!0}function S(e){const r=y(e.initialArgs??{}),t={...e.argTypes??{}},o=new Set(Object.keys(t));for(const n of b(r))o.has(n)||(t[n]=d(n));for(const[n,i]of Object.entries(r))if(!t[n]){if(Array.isArray(i)){t[n]=h(n);continue}if(T(i)||!A(i)){t[n]=d(n);continue}v(n,o)||(t[n]=_({name:n,value:i}))}return t}s.createFlattenedArgTypes=S;function b(e){return Object.keys(e).reduce((r,t)=>{if(t.includes(".")){const o=t.substring(0,t.indexOf("."));r.add(o)}return r},new Set)}function $(e){if(!e)return;const r=b(e);return Object.entries(e).filter(([t])=>!r.has(t)).reduce((t,[o,n])=>(0,c.setProperty)(t,o,n),{})}s.expandObject=$;Object.defineProperty(u,"__esModule",{value:!0});const a=s,N={argsEnhancers:[e=>{var r;return(r=e.parameters.deepControls)!=null&&r.enabled?(0,a.flattenObject)(e.initialArgs):e.initialArgs}],argTypesEnhancers:[e=>{var r;return(r=e.parameters.deepControls)!=null&&r.enabled?(0,a.createFlattenedArgTypes)(e):e.argTypes}],decorators:[(e,r)=>{var t;return(t=r.parameters.deepControls)!=null&&t.enabled?e({...r,args:(0,a.expandObject)(r.args),initialArgs:(0,a.expandObject)(r.initialArgs)}):e(r)}]};var E=u.default=N;const w=m({__proto__:null,default:E},[u]);export{w as p};
//# sourceMappingURL=preview-0fed05f2.js.map