likec4 1.57.0 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__app__/codegen/react.mjs +7 -8
- package/__app__/codegen/webcomponent.mjs +70 -881
- package/__app__/src/aichat/index.mjs +8 -1
- package/__app__/src/chunks/AIChat.mjs +959 -0
- package/__app__/src/chunks/DiagramActorProvider.mjs +7638 -0
- package/__app__/src/chunks/LikeC4Styles.mjs +1866 -0
- package/__app__/src/chunks/Markdown.mjs +146 -0
- package/__app__/src/chunks/NavigationPanel.mjs +61 -0
- package/__app__/src/chunks/ProjectsOverview.mjs +540 -0
- package/__app__/src/chunks/adhoc-editor.mjs +3386 -0
- package/__app__/src/chunks/es.mjs +439 -0
- package/__app__/src/chunks/hooks.mjs +145 -0
- package/__app__/src/chunks/libs/@dagrejs/dagre.mjs +1894 -0
- package/__app__/src/chunks/libs/@floating-ui.mjs +2218 -0
- package/__app__/src/chunks/libs/@mantine.mjs +12070 -0
- package/__app__/src/chunks/libs/@tabler/icons-react.mjs +252 -0
- package/__app__/src/chunks/libs/@tanstack-ai.mjs +1768 -0
- package/__app__/src/chunks/libs/@tanstack.mjs +2718 -0
- package/__app__/src/chunks/libs/@xstate/react.mjs +1982 -0
- package/__app__/src/chunks/libs/@xyflow/react.mjs +5256 -0
- package/__app__/src/chunks/libs/bezier-js.mjs +1003 -0
- package/__app__/src/chunks/libs/d3.mjs +2842 -0
- package/__app__/src/chunks/libs/fast-equals.mjs +268 -0
- package/__app__/src/chunks/libs/framer.mjs +5872 -0
- package/__app__/src/chunks/libs/remeda.mjs +642 -0
- package/__app__/src/chunks/libs/zod.mjs +3170 -0
- package/__app__/src/chunks/rolldown-runtime.mjs +23 -0
- package/__app__/src/chunks/styled-system.mjs +1040 -0
- package/__app__/src/fonts.css +1 -1
- package/__app__/src/main.mjs +14816 -14
- package/__app__/src/style.css +1 -1
- package/dist/chunks/enableServer.mjs +1 -1
- package/dist/chunks/filenames.mjs +2 -2
- package/dist/chunks/index2.d.mts +1877 -734
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -1
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -3
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/chunks/libs/chevrotain.mjs +25 -25
- package/dist/chunks/libs/langium.mjs +1 -1
- package/dist/chunks/libs/merge-error-cause.mjs +1 -1
- package/dist/chunks/libs/pretty-ms.mjs +1 -1
- package/dist/chunks/libs/remeda.mjs +1 -1
- package/dist/chunks/libs/ufo.mjs +1 -1
- package/dist/chunks/libs/unstorage.mjs +1 -1
- package/dist/chunks/libs/which.mjs +1 -1
- package/dist/chunks/libs/zod.mjs +65 -0
- package/dist/chunks/node.mjs +73 -62
- package/dist/chunks/{plugin.mjs → vite-plugin.mjs} +41 -41
- package/dist/cli/index.mjs +184 -144
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +1 -1
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/vite-plugin/internal/index.d.mts +52 -57
- package/dist/vite-plugin/internal/index.mjs +946 -1
- package/package.json +46 -47
- package/react/index.d.mts +92 -23
- package/react/index.mjs +44551 -42605
- package/__app__/chunks/AIChat2.mjs +0 -2
- package/__app__/chunks/DiagramActorProvider.mjs +0 -10
- package/__app__/chunks/EmbedPage.mjs +0 -1
- package/__app__/chunks/ExportPage.mjs +0 -2
- package/__app__/chunks/LikeC4Diagram.mjs +0 -19
- package/__app__/chunks/LikeC4Styles.mjs +0 -48
- package/__app__/chunks/Markdown.mjs +0 -1
- package/__app__/chunks/NavigationPanel.mjs +0 -1
- package/__app__/chunks/ViewReact.mjs +0 -1
- package/__app__/chunks/adhoc-editor.mjs +0 -1
- package/__app__/chunks/aichat.mjs +0 -1
- package/__app__/chunks/box.mjs +0 -1
- package/__app__/chunks/create-style-context.mjs +0 -1
- package/__app__/chunks/css.mjs +0 -1
- package/__app__/chunks/factory.mjs +0 -1
- package/__app__/chunks/hooks.mjs +0 -1
- package/__app__/chunks/hstack.mjs +0 -1
- package/__app__/chunks/libs/@dagrejs/dagre.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/core.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/dom.mjs +0 -1
- package/__app__/chunks/libs/@floating-ui/react.mjs +0 -1
- package/__app__/chunks/libs/@mantine/core.mjs +0 -41
- package/__app__/chunks/libs/@mantine/hooks.mjs +0 -1
- package/__app__/chunks/libs/@nanostores/react.mjs +0 -1
- package/__app__/chunks/libs/@react-hookz/web.mjs +0 -1
- package/__app__/chunks/libs/@tabler/icons-react.mjs +0 -358
- package/__app__/chunks/libs/@tanstack/ai-client.mjs +0 -2
- package/__app__/chunks/libs/@tanstack/ai-react-ui.mjs +0 -1
- package/__app__/chunks/libs/@tanstack/ai-react.mjs +0 -1
- package/__app__/chunks/libs/@tanstack/ai.mjs +0 -2
- package/__app__/chunks/libs/@tanstack/history.mjs +0 -1
- package/__app__/chunks/libs/@tanstack/react-router.mjs +0 -3
- package/__app__/chunks/libs/@tanstack/router-core.mjs +0 -1
- package/__app__/chunks/libs/@xstate/react.mjs +0 -1
- package/__app__/chunks/libs/@xstate/store.mjs +0 -1
- package/__app__/chunks/libs/@xyflow/react.mjs +0 -7
- package/__app__/chunks/libs/@zag-js/anatomy.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/collection.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/core.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/react.mjs +0 -1
- package/__app__/chunks/libs/@zag-js/tree-view.mjs +0 -1
- package/__app__/chunks/libs/bezier-js.mjs +0 -1
- package/__app__/chunks/libs/copy-anything.mjs +0 -1
- package/__app__/chunks/libs/d3-path.mjs +0 -1
- package/__app__/chunks/libs/d3-shape.mjs +0 -1
- package/__app__/chunks/libs/fast-equals.mjs +0 -1
- package/__app__/chunks/libs/framer-motion.mjs +0 -9
- package/__app__/chunks/libs/html-to-image.mjs +0 -2
- package/__app__/chunks/libs/motion-dom.mjs +0 -1
- package/__app__/chunks/libs/nanostores.mjs +0 -1
- package/__app__/chunks/libs/react-error-boundary.mjs +0 -1
- package/__app__/chunks/libs/react-resizable-panels.mjs +0 -1
- package/__app__/chunks/libs/remeda.mjs +0 -1
- package/__app__/chunks/libs/superjson.mjs +0 -1
- package/__app__/chunks/libs/zod.mjs +0 -64
- package/__app__/chunks/rolldown-runtime.mjs +0 -1
- package/__app__/chunks/styles.css.mjs +0 -1
- package/__app__/chunks/txt.mjs +0 -1
- package/__app__/chunks/useLikeC4Project.mjs +0 -1
- package/__app__/src/pages/AdHocViewEditor.mjs +0 -1
- package/__app__/src/pages/EmbedPage.mjs +0 -1
- package/__app__/src/pages/ExportPage.mjs +0 -1
- package/__app__/src/pages/ProjectsOverview.mjs +0 -1
- package/__app__/src/pages/ViewAsD2.mjs +0 -1
- package/__app__/src/pages/ViewAsDot.mjs +0 -1
- package/__app__/src/pages/ViewAsMmd.mjs +0 -1
- package/__app__/src/pages/ViewAsPuml.mjs +0 -1
- package/__app__/src/pages/ViewEditor.mjs +0 -1
- package/__app__/src/pages/ViewReact.mjs +0 -1
- package/dist/chunks/libs/@chevrotain/utils.mjs +0 -1
- package/dist/chunks/libs/@hono/mcp.mjs +0 -70
- package/dist/chunks/libs/@hono/node-server.mjs +0 -1
- package/dist/chunks/libs/@logtape/logtape.d.mts +0 -1023
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
- package/dist/chunks/libs/ajv.mjs +0 -1
- package/dist/chunks/libs/ansi-align.mjs +0 -2
- package/dist/chunks/libs/ansi-regex.mjs +0 -1
- package/dist/chunks/libs/ansi-styles.mjs +0 -1
- package/dist/chunks/libs/atomically.mjs +0 -1
- package/dist/chunks/libs/boxen.mjs +0 -22
- package/dist/chunks/libs/conf.mjs +0 -1
- package/dist/chunks/libs/defu.mjs +0 -1
- package/dist/chunks/libs/destr.mjs +0 -1
- package/dist/chunks/libs/find-up-simple.mjs +0 -1
- package/dist/chunks/libs/get-port.mjs +0 -1
- package/dist/chunks/libs/hono.mjs +0 -1
- package/dist/chunks/libs/is-docker.mjs +0 -1
- package/dist/chunks/libs/is-error-instance.mjs +0 -1
- package/dist/chunks/libs/is-inside-container.mjs +0 -1
- package/dist/chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/chunks/libs/isexe.mjs +0 -1
- package/dist/chunks/libs/ky.mjs +0 -3
- package/dist/chunks/libs/p-debounce.mjs +0 -1
- package/dist/chunks/libs/p-limit.mjs +0 -1
- package/dist/chunks/libs/p-timeout.mjs +0 -1
- package/dist/chunks/libs/package-up.mjs +0 -1
- package/dist/chunks/libs/parse-ms.mjs +0 -1
- package/dist/chunks/libs/safe-stringify.mjs +0 -1
- package/dist/chunks/libs/strip-indent.mjs +0 -1
- package/dist/chunks/libs/tinyrainbow.mjs +0 -1
- package/dist/chunks/libs/ts-graphviz.mjs +0 -1
- package/dist/chunks/libs/unctx.mjs +0 -1
- package/dist/chunks/libs/vscode-languageserver.mjs +0 -1
- package/dist/chunks/libs/word-wrap.mjs +0 -12
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +0 -1
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"../rolldown-runtime.mjs";import{t}from"./is-error-instance.mjs";import{t as n}from"./is-plain-obj.mjs";const normalizeDescriptors=e=>{r.forEach(t=>{i(e,t)})},r=[`name`,`message`,`stack`,`cause`,`errors`],i=e((e,t)=>{let n=getDescriptor(e,t);if(n!==void 0){if(isReadonlyGetter(n)){a(e,t,e[t]);return}isInvalidDescriptor(n)&&setErrorDescriptor(e,t,n)}},`normalizeDescriptor`),getDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?void 0:getDescriptor(r,t)},isReadonlyGetter=({get:e,set:t})=>e!==void 0&&t===void 0,isInvalidDescriptor=({enumerable:e,writable:t})=>e||!t,a=e((e,t,n)=>{setErrorDescriptor(e,t,{value:n})},`setErrorProperty`),setErrorDescriptor=(e,t,n)=>{Object.defineProperty(e,t,{...n,...`get`in n||`set`in n?{}:{writable:!0},enumerable:!1,configurable:!0})},normalizeAggregate=(e,t)=>{Array.isArray(e.errors)?a(e,`errors`,e.errors.filter(isDefined).map(t).filter(Boolean)):isAggregateError(e)?a(e,`errors`,[]):e.errors!==void 0&&deleteAggregateErrors(e)},isDefined=e=>e!==void 0,isAggregateError=e=>`AggregateError`in globalThis&&(e.name===`AggregateError`||e instanceof AggregateError),deleteAggregateErrors=e=>{delete e.errors,e.errors!==void 0&&a(e,`errors`,[])},normalizeCause=(e,t)=>{if(!(`cause`in e))return;let n=e.cause===void 0?e.cause:t(e.cause);n===void 0?delete e.cause:a(e,`cause`,n)},isNonModifiableError=e=>!Object.isExtensible(e)||r.some(t=>isNonConfigurableProp(e,t)||isThrowingProp(e,t)),isNonConfigurableProp=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&!n.configurable},isThrowingProp=(e,t)=>{try{return e[t],!1}catch{return!0}},setStack=e=>{a(e,`stack`,o(e.message,e.name))},o=e((e=``,t=`Error`)=>{let{stack:n}=new(getErrorClass(t))(e);return typeof n==`string`&&n!==``?n:`${t}: ${e}`},`getStack`),getErrorClass=e=>{let t={value:e,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},"name",t);return Object.defineProperty(n.prototype,"name",t),n},copyObject=e=>{let t={};for(let n of getPropsToCopy(e))try{let r=e[n],{enumerable:i,configurable:a,writable:o=!0}=getDescriptor(e,n);Object.defineProperty(t,n,{value:r,enumerable:i,configurable:a,writable:o})}catch{}return t},getPropsToCopy=e=>{let t=getOwnKeys(e);for(let n of r)isInheritedProp(e,n)&&t.push(n);return t},getOwnKeys=e=>{try{return Reflect.ownKeys(e)}catch{return[]}},isInheritedProp=(e,t)=>{try{return t in e&&!Object.hasOwn(e,t)}catch{return!1}},objectifyError=e=>{let{name:t,message:n,stack:r,cause:i,errors:a,...o}=copyObject(e),c=s(n,o),l=newError(t,c);return n===c&&assignObjectProps(l,o),Object.entries({name:t,stack:r,cause:i,errors:a}).forEach(([e,t])=>{setNewErrorProperty(l,e,t)}),r===void 0&&setStack(l),l},s=e((e,t)=>typeof e==`string`&&e!==``?e:truncateMessage(safeJsonStringify(t)),`getMessage`),safeJsonStringify=e=>{try{return JSON.stringify(e)}catch{return safeStringify(e)}},safeStringify=e=>{try{return String(e)}catch{return`Invalid error`}},truncateMessage=e=>e.length<c?e:`${e.slice(0,c)}...`,c=1e3,newError=(e,t)=>e===`AggregateError`&&`AggregateError`in globalThis?AggregateError([],t):e in l?new l[e](t):Error(t),l={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},assignObjectProps=(e,t)=>{for(let n in t)n in e||(e[n]=t[n])},setNewErrorProperty=(e,t,n)=>{n!==void 0&&a(e,t,n)},stringifyError=e=>{try{let t=Error(String(e));return setStack(t),t}catch(e){return e}},{toString:u}=Object.prototype,createError=e=>isErrorPlainObj(e)?objectifyError(e):t(e)?isInvalidError(e)?objectifyError(e):e:stringifyError(e),isErrorPlainObj=e=>{try{return n(e)}catch{return!1}},isInvalidError=e=>isProxy(e)||isNonModifiableError(e)||hasInvalidConstructor(e),isProxy=e=>{try{return u.call(e)===`[object Object]`}catch{return!0}},hasInvalidConstructor=e=>typeof e.constructor!=`function`||typeof e.constructor.name!=`string`||e.constructor.name===``||e.constructor.prototype!==Object.getPrototypeOf(e),normalizeException=(e,{shallow:t=!1}={})=>recurseException(e,[],t),recurseException=(e,t,n)=>{if(t.includes(e))return;let r=n?identity:r=>recurseException(r,[...t,e],n),i=createError(e);return normalizeProps(i,r),i},identity=e=>e,normalizeProps=(e,t)=>{normalizeName(e),normalizeMessage(e),normalizeStack(e),normalizeCause(e,t),normalizeAggregate(e,t),normalizeDescriptors(e)},normalizeName=e=>{if(d(e.name))return;let t=Object.getPrototypeOf(e).name;a(e,`name`,d(t)?t:e.constructor.name)},normalizeMessage=e=>{d(e.message)||a(e,`message`,``)},normalizeStack=e=>{d(e.stack)||setStack(e)},d=e(e=>typeof e==`string`&&e!==``,`isDefinedString`),f=e((e,t,n=e.name)=>{if(validateErrorClass(t),typeof n!=`string`)throw TypeError(`currentName must be a string: ${n}`);return n},`normalizeArgs`),validateErrorClass=e=>{if(!isClass(e))throw TypeError(`ErrorClass must be a class: ${e}`);if(!isErrorClass(e.prototype))throw TypeError(`ErrorClass must inherit from Error: ${e}`);if(!hasConstructor(e))throw TypeError(`ErrorClass must be have a valid constructor: ${e}`)},isClass=e=>typeof e==`function`&&typeof e.prototype==`object`&&e.prototype!==null,isErrorClass=e=>e!==null&&(e.name===`Error`||isErrorClass(Object.getPrototypeOf(e))),hasConstructor=e=>typeof e.prototype.constructor==`function`,p=e((e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},`setNonEnumProp`),updatePrototype=(e,t)=>{Object.getPrototypeOf(e)!==t.prototype&&(setPrototype(e,t),deleteOwnProperty(e,`constructor`),fixName(e,t))},setPrototype=(e,t)=>{Object.setPrototypeOf(e,t.prototype)},fixName=(e,t)=>{deleteOwnProperty(e,`name`);let n=getClassName(t.prototype);e.name!==n&&p(e,`name`,n)},getClassName=e=>getPrototypeName(e)??getConstructorName(e)??getClassName(Object.getPrototypeOf(e)),getPrototypeName=e=>Object.hasOwn(e,`name`)&&isDefinedString(e.name)?e.name:void 0,getConstructorName=e=>typeof e.constructor==`function`&&isDefinedString(e.constructor.name)?e.constructor.name:void 0,isDefinedString=e=>typeof e==`string`&&e!==``,deleteOwnProperty=(e,t)=>{Object.hasOwn(e,t)&&delete e[t]},m=e((e,t)=>{shouldUpdateStack(e,t)&&p(e,`stack`,g(e,t))},`updateStack`),shouldUpdateStack=(e,t)=>t!==e.name&&t!==``&&e.stack.includes(t)&&stackIncludesName(),stackIncludesName=()=>{class StackError extends Error{}let e={value:h,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(StackError,"name",e),Object.defineProperty(StackError.prototype,"name",e);let{stack:t}=new StackError(``);return typeof t==`string`&&t.includes(h)},h=`SetErrorClassError`,g=e(({name:e,stack:t},n)=>{if(t.startsWith(`${n}: `))return t.replace(n,e);let[r,i]=_(n,e).find(([e])=>t.includes(e));return t.replace(r,i)},`getStack`),_=e((e,t)=>[[`\n${e}: `,`\n${t}: `],[`${e}: `,`${t}: `],[`${e} `,`${t} `],[e,t]],`getReplacers`),setErrorClass=(e,t,n)=>{let r=normalizeException(e),i=f(r,t,n);return updatePrototype(r,t),m(r,i),r},mergeDescriptors=(e,t)=>t.configurable===!1?mergeNonConfig(e,t):mergeConfig(e,t),mergeNonConfig=(e,t)=>({...t,...getNonConfigWritable(e,t),...getNonConfigValue(e,t)}),getNonConfigWritable=(e,t)=>t.writable===!0&&e.writable===!1?{writable:!1}:{},getNonConfigValue=(e,t)=>e.hasValue&&`value`in t&&t.writable===!0?{value:e.value}:{},mergeConfig=(e,t)=>{let n=mergeDescriptor(e.enumerable,t.enumerable,!0),r=mergeDescriptor(e.writable,t.writable,!0),i=mergeDescriptor(e.configurable,t.configurable,!0);return{...mergeValue(e,t,r),enumerable:n,configurable:i}},mergeValue=(e,t,n)=>e.hasValue?{value:e.value,writable:n}:!hasGetSet(e)&&!hasGetSet(t)?{value:t.value,writable:n}:{get:mergeDescriptor(e.get,t.get),set:mergeDescriptor(e.set,t.set)},hasGetSet=({get:e,set:t})=>e!==void 0||t!==void 0,mergeDescriptor=(e,t,n)=>e??t??n,normalizeInput=(e,t,n)=>{if(!isAnyObj(e))throw TypeError(`Argument must be an object: ${e}`);if(!isValidKey(t))throw TypeError(`Property key must be a string, a symbol or an integer: ${t}`);return normalizeDescriptor(n)},isAnyObj=e=>typeof e==`object`&&!!e,isValidKey=e=>{let t=typeof e;return t===`string`||t===`symbol`||t===`number`},normalizeDescriptor=e=>{if(!n(e))throw TypeError(`Descriptor must be a plain object: ${e}`);let{enumerable:t,writable:r,configurable:i,value:a,get:o,set:s,...c}=e,l=`value`in e;return validateDescriptor({enumerable:t,writable:r,configurable:i,get:o,set:s,unknownProps:c,hasValue:l}),{enumerable:t,writable:r,configurable:i,value:a,get:o,set:s,hasValue:l}},validateDescriptor=({enumerable:e,writable:t,configurable:n,get:r,set:i,unknownProps:a,hasValue:o})=>{validateGetSet(o,r,`get`),validateGetSet(o,i,`set`),validateBoolean(e,`enumerable`),validateBoolean(t,`writable`),validateBoolean(n,`configurable`),validateUnknownProps(a)},validateGetSet=(e,t,n)=>{if(validateFunction(t,n),e&&t!==void 0)throw TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${t}`)},validateFunction=(e,t)=>{if(e!==void 0&&typeof e!=`function`)throw TypeError(`Descriptor property "${t}" must be a function: ${e}`)},validateBoolean=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`Descriptor property "${t}" must be a boolean: ${e}`)},validateUnknownProps=e=>{let[t]=Object.keys(e);if(t!==void 0)throw TypeError(`Unknown descriptor property "${t}": ${e[t]}`)},redefineProperty=(e,t,n)=>(setProperty(e,t,mergeDescriptors(normalizeInput(e,t,n),getCurrentDescriptor(e,t))),e),getCurrentDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?{}:getCurrentDescriptor(r,t)},setProperty=(e,t,n)=>{try{Object.defineProperty(e,t,n)}catch{}},assignProp=(e,t,n)=>{if(n!==void 0)return setProp(e,t,n);try{delete e[t]}catch{}if(e[t]!==void 0)return setProp(e,t)},setProp=(e,t,n)=>{redefineProperty(e,t,{value:n,...getNonEnum(t)})},getNonEnum=e=>typeof e==`string`&&e.startsWith(`_`)?{enumerable:!1}:{},normalizeOptions=(e,t,r={})=>{if(validateErrorOrObject(e,`First argument`),validateErrorOrObject(t,`Second argument`),!n(r))throw TypeError(`Options must be a plain object: ${r}`);let{soft:i=!1}=r;if(typeof i!=`boolean`)throw TypeError(`Option "soft" must be a boolean: ${i}`);return{soft:i}},validateErrorOrObject=(e,t)=>{if(e===void 0)throw TypeError(`${t} is required.`);if(!isErrorOrObject(e))throw TypeError(`${t} must be a plain object or an error: ${e}`)},isErrorOrObject=e=>n(e)||t(e),shouldSkipProp=({error:e,props:t,propName:n,soft:r})=>isIgnoredPropName(n)||!b.call(t,n)||r&&e[n]!==void 0,isIgnoredPropName=e=>e in v||y.has(e),v=Error(`check`),y=new Set([`prototype`,`errors`,`cause`]),{propertyIsEnumerable:b}=Object.prototype,setErrorProps=(e,t,n)=>{let{soft:r}=normalizeOptions(e,t,n);for(let n of Reflect.ownKeys(t))setErrorProp({error:e,props:t,propName:n,soft:r});return e},setErrorProp=({error:e,props:t,propName:n,soft:r})=>{shouldSkipProp({error:e,props:t,propName:n,soft:r})||assignProp(e,n,t[n])},setErrorProperty=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!1,configurable:!0})},mergeAggregateCauses=(e,t)=>{e.errors!==void 0&&setErrorProperty(e,`errors`,e.errors.map(e=>t(e).error).filter(Boolean))},mergeAggregateErrors=({target:e,source:t,parent:n,child:r})=>{if(!hasErrors(e)){mergeSourceErrors(e,t);return}hasErrors(t)&&setErrorProperty(e,`errors`,[...r.errors,...n.errors])},mergeSourceErrors=(e,t)=>{t.errors!==void 0&&setErrorProperty(e,`errors`,t.errors)},hasErrors=e=>e.errors!==void 0&&e.errors.length!==0,normalizeArgs=(e,t,n=e.message)=>{if(typeof t!=`string`)throw TypeError(`newMessage must be a string: ${t}`);if(typeof n!=`string`)throw TypeError(`currentMessage must be a string: ${n}`);return n},x=e(({name:e,stack:t},n,r)=>r!==``&&t.includes(r)?replaceMessage({name:e,stack:t,newMessage:n,currentMessage:r}):insertMessage(e,t,n),`getStack`),replaceMessage=({name:e,stack:t,newMessage:n,currentMessage:r})=>{let[i,a]=getReplacers(e,n,r).find(([e])=>t.includes(e));return t.replace(i,a)},getReplacers=(e,t,n)=>[[`${e}: ${n}`,`${e}: ${t}`],[`: ${n}`,`: ${t}`],[`\n${n}`,`\n${t}`],[` ${n}`,` ${t}`],[n,t]],insertMessage=(e,t,n)=>{let r=`${e}: `,i=n.trimEnd();return t===e||t.startsWith(`${e}\n`)?t.replace(e,`${r}${i}`):t.startsWith(r)?t.replace(r,`${r}${i}\n`):`${r}${i}\n${t}`},setErrorMessage=(e,t,n)=>{let r=normalizeException(e),i=normalizeArgs(r,t,n);return setNonEnumProp(r,`message`,t),updateStack(r,t,i),r},updateStack=(e,t,n)=>{t===n||!stackIncludesMessage()||setNonEnumProp(e,`stack`,x(e,t,n))},stackIncludesMessage=()=>{let{stack:e}=Error(S);return typeof e==`string`&&e.includes(S)},S=`set-error-message test message`,setNonEnumProp=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},wrapErrorMessage=(e,t,n)=>{if(typeof t!=`string`)throw TypeError(`Second argument must be a message string: ${t}`);let r=normalizeException(e);return setErrorMessage(r,getMessage(t,r.message),n)},getMessage=(e,t)=>{let n=e.trim(),r=t.trim();return n===``?r:r===``?n:concatMessages(n,r,e)},concatMessages=(e,t,n)=>e.endsWith(C)?n.endsWith(w)?`${e}\n${t}`:`${e} ${t}`:`${t}\n${e}`,C=`:`,w=`
|
|
1
|
+
import{i as e}from"../rolldown-runtime.mjs";const normalizeDescriptors=e=>{t.forEach(t=>{n(e,t)})},t=[`name`,`message`,`stack`,`cause`,`errors`],n=e((e,t)=>{let n=getDescriptor(e,t);if(n!==void 0){if(isReadonlyGetter(n)){r(e,t,e[t]);return}isInvalidDescriptor(n)&&setErrorDescriptor(e,t,n)}},`normalizeDescriptor`),getDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?void 0:getDescriptor(r,t)},isReadonlyGetter=({get:e,set:t})=>e!==void 0&&t===void 0,isInvalidDescriptor=({enumerable:e,writable:t})=>e||!t,r=e((e,t,n)=>{setErrorDescriptor(e,t,{value:n})},`setErrorProperty`),setErrorDescriptor=(e,t,n)=>{Object.defineProperty(e,t,{...n,...`get`in n||`set`in n?{}:{writable:!0},enumerable:!1,configurable:!0})},normalizeAggregate=(e,t)=>{Array.isArray(e.errors)?r(e,`errors`,e.errors.filter(isDefined).map(t).filter(Boolean)):isAggregateError(e)?r(e,`errors`,[]):e.errors!==void 0&&deleteAggregateErrors(e)},isDefined=e=>e!==void 0,isAggregateError=e=>`AggregateError`in globalThis&&(e.name===`AggregateError`||e instanceof AggregateError),deleteAggregateErrors=e=>{delete e.errors,e.errors!==void 0&&r(e,`errors`,[])},normalizeCause=(e,t)=>{if(!(`cause`in e))return;let n=e.cause===void 0?e.cause:t(e.cause);n===void 0?delete e.cause:r(e,`cause`,n)},isErrorInstance=e=>isInstanceOfError(e)||hasErrorTag(e),isInstanceOfError=e=>{try{return e instanceof Error}catch{return!1}},hasErrorTag=e=>{try{return i.has(Object.prototype.toString.call(e))}catch{return!1}},i=new Set([`[object Error]`,`[object DOMException]`,`[object DOMError]`,`[object Exception]`]);function isPlainObject(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}const isNonModifiableError=e=>!Object.isExtensible(e)||t.some(t=>isNonConfigurableProp(e,t)||isThrowingProp(e,t)),isNonConfigurableProp=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&!n.configurable},isThrowingProp=(e,t)=>{try{return e[t],!1}catch{return!0}},setStack=e=>{r(e,`stack`,a(e.message,e.name))},a=e((e=``,t=`Error`)=>{let{stack:n}=new(getErrorClass(t))(e);return typeof n==`string`&&n!==``?n:`${t}: ${e}`},`getStack`),getErrorClass=e=>{let t={value:e,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},"name",t);return Object.defineProperty(n.prototype,"name",t),n},copyObject=e=>{let t={};for(let n of getPropsToCopy(e))try{let r=e[n],{enumerable:i,configurable:a,writable:o=!0}=getDescriptor(e,n);Object.defineProperty(t,n,{value:r,enumerable:i,configurable:a,writable:o})}catch{}return t},getPropsToCopy=e=>{let n=getOwnKeys(e);for(let r of t)isInheritedProp(e,r)&&n.push(r);return n},getOwnKeys=e=>{try{return Reflect.ownKeys(e)}catch{return[]}},isInheritedProp=(e,t)=>{try{return t in e&&!Object.hasOwn(e,t)}catch{return!1}},objectifyError=e=>{let{name:t,message:n,stack:r,cause:i,errors:a,...s}=copyObject(e),c=o(n,s),l=newError(t,c);return n===c&&assignObjectProps(l,s),Object.entries({name:t,stack:r,cause:i,errors:a}).forEach(([e,t])=>{setNewErrorProperty(l,e,t)}),r===void 0&&setStack(l),l},o=e((e,t)=>typeof e==`string`&&e!==``?e:truncateMessage(safeJsonStringify(t)),`getMessage`),safeJsonStringify=e=>{try{return JSON.stringify(e)}catch{return safeStringify(e)}},safeStringify=e=>{try{return String(e)}catch{return`Invalid error`}},truncateMessage=e=>e.length<s?e:`${e.slice(0,s)}...`,s=1e3,newError=(e,t)=>e===`AggregateError`&&`AggregateError`in globalThis?AggregateError([],t):e in c?new c[e](t):Error(t),c={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},assignObjectProps=(e,t)=>{for(let n in t)n in e||(e[n]=t[n])},setNewErrorProperty=(e,t,n)=>{n!==void 0&&r(e,t,n)},stringifyError=e=>{try{let t=Error(String(e));return setStack(t),t}catch(e){return e}},{toString:l}=Object.prototype,createError=e=>isErrorPlainObj(e)?objectifyError(e):isErrorInstance(e)?isInvalidError(e)?objectifyError(e):e:stringifyError(e),isErrorPlainObj=e=>{try{return isPlainObject(e)}catch{return!1}},isInvalidError=e=>isProxy(e)||isNonModifiableError(e)||hasInvalidConstructor(e),isProxy=e=>{try{return l.call(e)===`[object Object]`}catch{return!0}},hasInvalidConstructor=e=>typeof e.constructor!=`function`||typeof e.constructor.name!=`string`||e.constructor.name===``||e.constructor.prototype!==Object.getPrototypeOf(e),normalizeException=(e,{shallow:t=!1}={})=>recurseException(e,[],t),recurseException=(e,t,n)=>{if(t.includes(e))return;let r=n?identity:r=>recurseException(r,[...t,e],n),i=createError(e);return normalizeProps(i,r),i},identity=e=>e,normalizeProps=(e,t)=>{normalizeName(e),normalizeMessage(e),normalizeStack(e),normalizeCause(e,t),normalizeAggregate(e,t),normalizeDescriptors(e)},normalizeName=e=>{if(u(e.name))return;let t=Object.getPrototypeOf(e).name;r(e,`name`,u(t)?t:e.constructor.name)},normalizeMessage=e=>{u(e.message)||r(e,`message`,``)},normalizeStack=e=>{u(e.stack)||setStack(e)},u=e(e=>typeof e==`string`&&e!==``,`isDefinedString`),d=e((e,t,n=e.name)=>{if(validateErrorClass(t),typeof n!=`string`)throw TypeError(`currentName must be a string: ${n}`);return n},`normalizeArgs`),validateErrorClass=e=>{if(!isClass(e))throw TypeError(`ErrorClass must be a class: ${e}`);if(!isErrorClass(e.prototype))throw TypeError(`ErrorClass must inherit from Error: ${e}`);if(!hasConstructor(e))throw TypeError(`ErrorClass must be have a valid constructor: ${e}`)},isClass=e=>typeof e==`function`&&typeof e.prototype==`object`&&e.prototype!==null,isErrorClass=e=>e!==null&&(e.name===`Error`||isErrorClass(Object.getPrototypeOf(e))),hasConstructor=e=>typeof e.prototype.constructor==`function`,f=e((e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},`setNonEnumProp`),updatePrototype=(e,t)=>{Object.getPrototypeOf(e)!==t.prototype&&(setPrototype(e,t),deleteOwnProperty(e,`constructor`),fixName(e,t))},setPrototype=(e,t)=>{Object.setPrototypeOf(e,t.prototype)},fixName=(e,t)=>{deleteOwnProperty(e,`name`);let n=getClassName(t.prototype);e.name!==n&&f(e,`name`,n)},getClassName=e=>getPrototypeName(e)??getConstructorName(e)??getClassName(Object.getPrototypeOf(e)),getPrototypeName=e=>Object.hasOwn(e,`name`)&&isDefinedString(e.name)?e.name:void 0,getConstructorName=e=>typeof e.constructor==`function`&&isDefinedString(e.constructor.name)?e.constructor.name:void 0,isDefinedString=e=>typeof e==`string`&&e!==``,deleteOwnProperty=(e,t)=>{Object.hasOwn(e,t)&&delete e[t]},p=e((e,t)=>{shouldUpdateStack(e,t)&&f(e,`stack`,h(e,t))},`updateStack`),shouldUpdateStack=(e,t)=>t!==e.name&&t!==``&&e.stack.includes(t)&&stackIncludesName(),stackIncludesName=()=>{class StackError extends Error{}let e={value:m,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(StackError,"name",e),Object.defineProperty(StackError.prototype,"name",e);let{stack:t}=new StackError(``);return typeof t==`string`&&t.includes(m)},m=`SetErrorClassError`,h=e(({name:e,stack:t},n)=>{if(t.startsWith(`${n}: `))return t.replace(n,e);let[r,i]=g(n,e).find(([e])=>t.includes(e));return t.replace(r,i)},`getStack`),g=e((e,t)=>[[`\n${e}: `,`\n${t}: `],[`${e}: `,`${t}: `],[`${e} `,`${t} `],[e,t]],`getReplacers`),setErrorClass=(e,t,n)=>{let r=normalizeException(e),i=d(r,t,n);return updatePrototype(r,t),p(r,i),r},mergeDescriptors=(e,t)=>t.configurable===!1?mergeNonConfig(e,t):mergeConfig(e,t),mergeNonConfig=(e,t)=>({...t,...getNonConfigWritable(e,t),...getNonConfigValue(e,t)}),getNonConfigWritable=(e,t)=>t.writable===!0&&e.writable===!1?{writable:!1}:{},getNonConfigValue=(e,t)=>e.hasValue&&`value`in t&&t.writable===!0?{value:e.value}:{},mergeConfig=(e,t)=>{let n=mergeDescriptor(e.enumerable,t.enumerable,!0),r=mergeDescriptor(e.writable,t.writable,!0),i=mergeDescriptor(e.configurable,t.configurable,!0);return{...mergeValue(e,t,r),enumerable:n,configurable:i}},mergeValue=(e,t,n)=>e.hasValue?{value:e.value,writable:n}:!hasGetSet(e)&&!hasGetSet(t)?{value:t.value,writable:n}:{get:mergeDescriptor(e.get,t.get),set:mergeDescriptor(e.set,t.set)},hasGetSet=({get:e,set:t})=>e!==void 0||t!==void 0,mergeDescriptor=(e,t,n)=>e??t??n,normalizeInput=(e,t,n)=>{if(!isAnyObj(e))throw TypeError(`Argument must be an object: ${e}`);if(!isValidKey(t))throw TypeError(`Property key must be a string, a symbol or an integer: ${t}`);return normalizeDescriptor(n)},isAnyObj=e=>typeof e==`object`&&!!e,isValidKey=e=>{let t=typeof e;return t===`string`||t===`symbol`||t===`number`},normalizeDescriptor=e=>{if(!isPlainObject(e))throw TypeError(`Descriptor must be a plain object: ${e}`);let{enumerable:t,writable:n,configurable:r,value:i,get:a,set:o,...s}=e,c=`value`in e;return validateDescriptor({enumerable:t,writable:n,configurable:r,get:a,set:o,unknownProps:s,hasValue:c}),{enumerable:t,writable:n,configurable:r,value:i,get:a,set:o,hasValue:c}},validateDescriptor=({enumerable:e,writable:t,configurable:n,get:r,set:i,unknownProps:a,hasValue:o})=>{validateGetSet(o,r,`get`),validateGetSet(o,i,`set`),validateBoolean(e,`enumerable`),validateBoolean(t,`writable`),validateBoolean(n,`configurable`),validateUnknownProps(a)},validateGetSet=(e,t,n)=>{if(validateFunction(t,n),e&&t!==void 0)throw TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${t}`)},validateFunction=(e,t)=>{if(e!==void 0&&typeof e!=`function`)throw TypeError(`Descriptor property "${t}" must be a function: ${e}`)},validateBoolean=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`Descriptor property "${t}" must be a boolean: ${e}`)},validateUnknownProps=e=>{let[t]=Object.keys(e);if(t!==void 0)throw TypeError(`Unknown descriptor property "${t}": ${e[t]}`)},redefineProperty=(e,t,n)=>(setProperty(e,t,mergeDescriptors(normalizeInput(e,t,n),getCurrentDescriptor(e,t))),e),getCurrentDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?{}:getCurrentDescriptor(r,t)},setProperty=(e,t,n)=>{try{Object.defineProperty(e,t,n)}catch{}},assignProp=(e,t,n)=>{if(n!==void 0)return setProp(e,t,n);try{delete e[t]}catch{}if(e[t]!==void 0)return setProp(e,t)},setProp=(e,t,n)=>{redefineProperty(e,t,{value:n,...getNonEnum(t)})},getNonEnum=e=>typeof e==`string`&&e.startsWith(`_`)?{enumerable:!1}:{},normalizeOptions=(e,t,n={})=>{if(validateErrorOrObject(e,`First argument`),validateErrorOrObject(t,`Second argument`),!isPlainObject(n))throw TypeError(`Options must be a plain object: ${n}`);let{soft:r=!1}=n;if(typeof r!=`boolean`)throw TypeError(`Option "soft" must be a boolean: ${r}`);return{soft:r}},validateErrorOrObject=(e,t)=>{if(e===void 0)throw TypeError(`${t} is required.`);if(!isErrorOrObject(e))throw TypeError(`${t} must be a plain object or an error: ${e}`)},isErrorOrObject=e=>isPlainObject(e)||isErrorInstance(e),shouldSkipProp=({error:e,props:t,propName:n,soft:r})=>isIgnoredPropName(n)||!y.call(t,n)||r&&e[n]!==void 0,isIgnoredPropName=e=>e in _||v.has(e),_=Error(`check`),v=new Set([`prototype`,`errors`,`cause`]),{propertyIsEnumerable:y}=Object.prototype,setErrorProps=(e,t,n)=>{let{soft:r}=normalizeOptions(e,t,n);for(let n of Reflect.ownKeys(t))setErrorProp({error:e,props:t,propName:n,soft:r});return e},setErrorProp=({error:e,props:t,propName:n,soft:r})=>{shouldSkipProp({error:e,props:t,propName:n,soft:r})||assignProp(e,n,t[n])},setErrorProperty=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!1,configurable:!0})},mergeAggregateCauses=(e,t)=>{e.errors!==void 0&&setErrorProperty(e,`errors`,e.errors.map(e=>t(e).error).filter(Boolean))},mergeAggregateErrors=({target:e,source:t,parent:n,child:r})=>{if(!hasErrors(e)){mergeSourceErrors(e,t);return}hasErrors(t)&&setErrorProperty(e,`errors`,[...r.errors,...n.errors])},mergeSourceErrors=(e,t)=>{t.errors!==void 0&&setErrorProperty(e,`errors`,t.errors)},hasErrors=e=>e.errors!==void 0&&e.errors.length!==0,normalizeArgs=(e,t,n=e.message)=>{if(typeof t!=`string`)throw TypeError(`newMessage must be a string: ${t}`);if(typeof n!=`string`)throw TypeError(`currentMessage must be a string: ${n}`);return n},b=e(({name:e,stack:t},n,r)=>r!==``&&t.includes(r)?replaceMessage({name:e,stack:t,newMessage:n,currentMessage:r}):insertMessage(e,t,n),`getStack`),replaceMessage=({name:e,stack:t,newMessage:n,currentMessage:r})=>{let[i,a]=getReplacers(e,n,r).find(([e])=>t.includes(e));return t.replace(i,a)},getReplacers=(e,t,n)=>[[`${e}: ${n}`,`${e}: ${t}`],[`: ${n}`,`: ${t}`],[`\n${n}`,`\n${t}`],[` ${n}`,` ${t}`],[n,t]],insertMessage=(e,t,n)=>{let r=`${e}: `,i=n.trimEnd();return t===e||t.startsWith(`${e}\n`)?t.replace(e,`${r}${i}`):t.startsWith(r)?t.replace(r,`${r}${i}\n`):`${r}${i}\n${t}`},setErrorMessage=(e,t,n)=>{let r=normalizeException(e),i=normalizeArgs(r,t,n);return setNonEnumProp(r,`message`,t),updateStack(r,t,i),r},updateStack=(e,t,n)=>{t===n||!stackIncludesMessage()||setNonEnumProp(e,`stack`,b(e,t,n))},stackIncludesMessage=()=>{let{stack:e}=Error(x);return typeof e==`string`&&e.includes(x)},x=`set-error-message test message`,setNonEnumProp=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},wrapErrorMessage=(e,t,n)=>{if(typeof t!=`string`)throw TypeError(`Second argument must be a message string: ${t}`);let r=normalizeException(e);return setErrorMessage(r,getMessage(t,r.message),n)},getMessage=(e,t)=>{let n=e.trim(),r=t.trim();return n===``?r:r===``?n:concatMessages(n,r,e)},concatMessages=(e,t,n)=>e.endsWith(S)?n.endsWith(C)?`${e}\n${t}`:`${e} ${t}`:`${t}\n${e}`,S=`:`,C=`
|
|
2
2
|
`,mergeMessage=({parent:e,child:t,target:n,stackError:r})=>{let i=e.message,a=r.message;return n.message=t.message,wrapErrorMessage(n,i,a)},hasStack=(e,t)=>getStack(e)===t,getStack=e=>typeof e==`object`&&e?e.stack:void 0,mergeStack=({wrap:e,target:t,source:n,childHasStack:r})=>e===r?t:(setErrorProperty(t,`stack`,n.stack),n),getWrap=e=>{let{wrap:t,name:n}=e;return typeof t==`boolean`?(Object.hasOwn(e,`wrap`)&&delete e.wrap,t):n===`Error`},mergeErrorCause=e=>mergeError(e,[]).error,mergeError=(e,t)=>{if(t.includes(e))return{};let recurse=n=>mergeError(n,[...t,e]),n=getStack(e),r=normalizeException(e,{shallow:!0}),i=hasStack(r,n);mergeAggregateCauses(r,recurse);let{parent:a,childHasStack:o}=mergeCause(r,recurse);return{error:a,errorHasStack:i||o}},mergeCause=(e,t)=>{let n=getWrap(e);if(e.cause===void 0)return{parent:e,childHasStack:!1};let{error:r,errorHasStack:i}=t(e.cause);return delete e.cause,{parent:mergeChild({parent:e,child:r,childHasStack:i,wrap:n}),childHasStack:i}},mergeChild=({parent:e,child:t,childHasStack:n,wrap:r})=>{if(t===void 0)return e;let[i,a]=r?[t,e]:[e,t],o=mergeStack({wrap:r,target:i,source:a,childHasStack:n}),s=mergeMessage({parent:e,child:t,target:setErrorClass(i,i.constructor,o.name),stackError:o});return mergeAggregateErrors({target:s,source:a,parent:e,child:t}),setErrorProps(s,a,{soft:!r})};export{wrapErrorMessage as n,mergeErrorCause as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../rolldown-runtime.mjs";
|
|
1
|
+
import"../rolldown-runtime.mjs";const toZeroIfInfinity=e=>Number.isFinite(e)?e:0;function parseNumber(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(toZeroIfInfinity(e*1e3)%1e3),nanoseconds:Math.trunc(toZeroIfInfinity(e*1e6)%1e3)}}function parseBigint(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function parseMilliseconds(e){switch(typeof e){case`number`:if(Number.isFinite(e))return parseNumber(e);break;case`bigint`:return parseBigint(e)}throw TypeError(`Expected a finite number or bigint`)}const isZero=e=>e===0||e===0n,pluralize=(e,t)=>t===1||t===1n?e:`${e}s`,e=24n*60n*60n*1000n;function prettyMilliseconds(t,n){let r=typeof t==`bigint`;if(!r&&!Number.isFinite(t))throw TypeError(`Expected a finite number or bigint`);n={...n};let i=t<0?`-`:``;t=t<0?-t:t,n.colonNotation&&(n.compact=!1,n.formatSubMilliseconds=!1,n.separateMilliseconds=!1,n.verbose=!1),n.compact&&(n.unitCount=1,n.secondsDecimalDigits=0,n.millisecondsDecimalDigits=0);let a=[],floorDecimals=(e,t)=>{let n=Math.floor(e*10**t+1e-7);return(Math.round(n)/10**t).toFixed(t)},add=(e,t,r,i)=>{if(!((a.length===0||!n.colonNotation)&&isZero(e)&&!(n.colonNotation&&r===`m`))){if(i??=String(e),n.colonNotation){let e=i.includes(`.`)?i.split(`.`)[0].length:i.length,t=a.length>0?2:1;i=`0`.repeat(Math.max(0,t-e))+i}else i+=n.verbose?` `+pluralize(t,e):r;a.push(i)}},o=parseMilliseconds(t),s=BigInt(o.days);if(n.hideYearAndDays?add(BigInt(s)*24n+BigInt(o.hours),`hour`,`h`):(n.hideYear?add(s,`day`,`d`):(add(s/365n,`year`,`y`),add(s%365n,`day`,`d`)),add(Number(o.hours),`hour`,`h`)),add(Number(o.minutes),`minute`,`m`),!n.hideSeconds)if(n.separateMilliseconds||n.formatSubMilliseconds||!n.colonNotation&&t<1e3&&!n.subSecondsAsDecimals){let e=Number(o.seconds),t=Number(o.milliseconds),r=Number(o.microseconds),i=Number(o.nanoseconds);if(add(e,`second`,`s`),n.formatSubMilliseconds)add(t,`millisecond`,`ms`),add(r,`microsecond`,`µs`),add(i,`nanosecond`,`ns`);else{let e=t+r/1e3+i/1e6,a=typeof n.millisecondsDecimalDigits==`number`?n.millisecondsDecimalDigits:0,o=a?e.toFixed(a):e>=1?Math.round(e):Math.ceil(e);add(Number.parseFloat(o),`millisecond`,`ms`,o)}}else{let i=floorDecimals((r?Number(t%e):t)/1e3%60,typeof n.secondsDecimalDigits==`number`?n.secondsDecimalDigits:1),a=n.keepDecimalsOnWholeSeconds?i:i.replace(/\.0+$/,``);add(Number.parseFloat(a),`second`,`s`,a)}if(a.length===0)return i+`0`+(n.verbose?` milliseconds`:`ms`);let c=n.colonNotation?`:`:` `;return typeof n.unitCount==`number`&&(a=a.slice(0,Math.max(n.unitCount,1))),i+a.join(c)}export{prettyMilliseconds as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as o}from"../rolldown-runtime.mjs";function e$20(o,s,c){let r=c=>o(c,...s);return c===void 0?r:Object.assign(r,{lazy:c,lazyArgs:s})}o(e$20,`e`);function t$36(o,s,c){let l=o.length-s.length;if(l===0)return o(...s);if(l===1)return e$20(o,s,c);throw Error(`Wrong number of arguments`)}o(t$36,`t`);function t$35(...o){return t$36(s,o)}o(t$35,`t`);const s=o((o,s)=>s.some(s=>s(o)),`n`);function t$34(...o){return t$36(n$34,o)}o(t$34,`t`);function n$34(o,s){if(s<1)throw RangeError(`chunk: A chunk size of '${s.toString()}' would result in an infinite array`);if(o.length===0)return[];if(s>=o.length)return[[...o]];let c=Math.ceil(o.length/s),l=Array(c);if(s===1)for(let[s,c]of o.entries())l[s]=[c];else for(let u=0;u<c;u+=1){let c=u*s;l[u]=o.slice(c,c+s)}return l}o(n$34,`n`);function t$33(...o){return t$36(c,o)}o(t$33,`t`);const c=o((o,{min:s,max:c})=>s!==void 0&&o<s?s:c!==void 0&&o>c?c:o,`n`);function t$32(...o){return t$36(l,o)}o(t$32,`t`);const l=o((o,s)=>[...o,...s],`n`),u={done:!0,hasNext:!1},d={done:!1,hasNext:!1},h=o(()=>u,`n`),g=o(o=>({hasNext:!0,next:o,done:!1}),`r`);function t$30(o,...s){let c=o,l=s.map(o=>`lazy`in o?r$13(o):void 0),u=0;for(;u<s.length;){if(l[u]===void 0||!i$7(c)){let o=s[u];c=o(c),u+=1;continue}let o=[];for(let c=u;c<s.length;c++){let s=l[c];if(s===void 0||(o.push(s),s.isSingle))break}let d=[];for(let s of c)if(n$30(s,d,o))break;let{isSingle:h}=o.at(-1);c=h?d[0]:d,u+=o.length}return c}o(t$30,`t`);function n$30(o,s,c){if(c.length===0)return s.push(o),!1;let l=o,u=d,h=!1;for(let[o,d]of c.entries()){let{index:g,items:_}=d;if(_.push(l),u=d(l,g,_),d.index+=1,u.hasNext){if(u.hasMany??!1){for(let l of u.next)if(n$30(l,s,c.slice(o+1)))return!0;return h}l=u.next}if(!u.hasNext)break;u.done&&(h=!0)}return u.hasNext&&s.push(l),h}o(n$30,`n`);function r$13(o){let{lazy:s,lazyArgs:c}=o,l=s(...c);return Object.assign(l,{isSingle:s.single??!1,index:0,items:[]})}o(r$13,`r`);function i$7(o){return typeof o==`string`||typeof o==`object`&&!!o&&Symbol.iterator in o}o(i$7,`i`);function t$29(o,s){let c=s.length-o.length;if(c===1){let[c,...l]=s;return t$30(c,{lazy:o,lazyArgs:l})}if(c===0){let c={lazy:o,lazyArgs:s};return Object.assign(o=>t$30(o,c),c)}throw Error(`Wrong number of arguments`)}o(t$29,`t`);function r$12(...o){return t$29(i$6,o)}o(r$12,`r`);function i$6(o){if(o.length===0)return g;let s=new Map;for(let c of o)s.set(c,(s.get(c)??0)+1);return o=>{let c=s.get(o);return c===void 0||c===0?{done:!1,hasNext:!0,next:o}:(s.set(o,c-1),d)}}o(i$6,`i`);function t$28(...o){return t$36(_,o)}o(t$28,`t`);const _=o((o,s)=>o.length>=s,`n`);function t$27(...o){return t$36(Object.entries,o)}o(t$27,`t`);function n$28(...o){return t$36(v,o,y)}o(n$28,`n`);const v=o((o,s)=>o.filter(s),`r`),y=o(o=>(s,c,l)=>o(s,c,l)?{done:!1,hasNext:!0,next:s}:d,`i`),b=o(o=>Object.assign(o,{single:!0}),`e`);function r$10(...o){return t$36(x,o,b(S))}o(r$10,`r`);const x=o((o,s)=>o.find(s),`i`),S=o(o=>(s,c,l)=>o(s,c,l)?{done:!0,hasNext:!0,next:s}:d,`a`);function t$26(...o){return t$36(C,o)}o(t$26,`t`);const C=o((o,s)=>{for(let c=o.length-1;c>=0;c--){let l=o[c];if(s(l,c,o))return l}},`n`);function n$26(...o){return t$36(w,o,b(T))}o(n$26,`n`);const w=o(([o])=>o,`r`),T=o(()=>E,`i`),E=o(o=>({hasNext:!0,next:o,done:!0}),`a`);function n$25(o,s){return typeof o==`object`?D(o,s):e$20(D,o===void 0?[]:[o],O)}o(n$25,`n`);const D=o((o,s)=>s===void 0?o.flat():o.flat(s),`r`),O=o(o=>o===void 0||o===1?k:o<=0?g:s=>Array.isArray(s)?{next:s.flat(o-1),hasNext:!0,hasMany:!0,done:!1}:{next:s,hasNext:!0,done:!1},`i`),k=o(o=>Array.isArray(o)?{next:o,hasNext:!0,hasMany:!0,done:!1}:{next:o,hasNext:!0,done:!1},`a`);function t$25(...o){return t$36(A,o,j)}o(t$25,`t`);const A=o((o,s)=>o.flatMap(s),`n`),j=o(o=>(s,c,l)=>{let u=o(s,c,l);return Array.isArray(u)?{done:!1,hasNext:!0,hasMany:!0,next:u}:{done:!1,hasNext:!0,next:u}},`r`);function t$24(...o){return t$36(n$23,o,M)}o(t$24,`t`);function n$23(o,s){return o.forEach(s),o}o(n$23,`n`);const M=o(o=>(s,c,l)=>(o(s,c,l),{done:!1,hasNext:!0,next:s}),`r`);function t$23(...o){return t$36(n$22,o)}o(t$23,`t`);function n$22(o,s){for(let[c,l]of Object.entries(o))s(l,c,o);return o}o(n$22,`n`);const N=Symbol(`funnel/voidReducer`),P=o(()=>N,`t`);function n$21(o,{triggerAt:s=`end`,minQuietPeriodMs:c,maxBurstDurationMs:l,minGapMs:u,reducer:d=P}){let h,g,_,v,f=()=>{let s=_;s!==void 0&&(_=void 0,s===N?o():o(s),u!==void 0&&(g=setTimeout(p,u)))},p=()=>{clearTimeout(g),g=void 0,h===void 0&&f()},m=()=>{clearTimeout(h),h=void 0,v=void 0,g===void 0&&f()};return{call:(...o)=>{let y=h===void 0&&g===void 0;if((s!==`start`||y)&&(_=d(_,...o)),!(h===void 0&&!y)){if(c!==void 0||l!==void 0||u===void 0){clearTimeout(h);let o=Date.now();v??=o;let s=l===void 0?c??0:Math.min(c??l,Math.max(0,l-(o-v)));h=setTimeout(m,s)}s!==`end`&&y&&f()}},cancel:()=>{clearTimeout(h),h=void 0,v=void 0,clearTimeout(g),g=void 0,_=void 0},flush:()=>{m(),p()},get isIdle(){return h===void 0&&g===void 0}}}o(n$21,`n`);function t$21(...o){return t$36(F,o)}o(t$21,`t`);const F=o((o,s)=>{let c=Object.create(null);for(let l=0;l<o.length;l++){let u=o[l],d=s(u,l,o);if(d!==void 0){let o=c[d];o===void 0?c[d]=[u]:o.push(u)}}return Object.setPrototypeOf(c,Object.prototype),c},`n`);function t$20(...o){return t$36(n$19,o)}o(t$20,`t`);function n$19(o,s){let c=Object.create(null);for(let l of o){let o=l?.[s];if(o!==void 0){let s=c[o];s===void 0?c[o]=[l]:s.push(l)}}return Object.setPrototypeOf(c,Object.prototype),c}o(n$19,`n`);function t$19(...o){return t$36(n$18,o)}o(t$19,`t`);function n$18(o,s){if(o===s||Object.is(o,s))return!0;if(typeof o!=`object`||typeof s!=`object`||o===null||s===null||Object.getPrototypeOf(o)!==Object.getPrototypeOf(s))return!1;if(Array.isArray(o))return r$5(o,s);if(o instanceof Map)return i$1(o,s);if(o instanceof Set)return a(o,s);if(o instanceof Date)return o.getTime()===s.getTime();if(o instanceof RegExp)return o.toString()===s.toString();if(Object.keys(o).length!==Object.keys(s).length)return!1;for(let[c,l]of Object.entries(o))if(!(c in s)||!n$18(l,s[c]))return!1;return!0}o(n$18,`n`);function r$5(o,s){if(o.length!==s.length)return!1;for(let[c,l]of o.entries())if(!n$18(l,s[c]))return!1;return!0}o(r$5,`r`);function i$1(o,s){if(o.size!==s.size)return!1;for(let[c,l]of o.entries())if(!s.has(c)||!n$18(l,s.get(c)))return!1;return!0}o(i$1,`i`);function a(o,s){if(o.size!==s.size)return!1;let c=[...s];for(let s of o){let o=!1;for(let[l,u]of c.entries())if(n$18(s,u)){o=!0,c.splice(l,1);break}if(!o)return!1}return!0}function e$16(){return I}o(e$16,`e`);const I=o(o=>o,`t`);function t$17(...o){return t$36(n$17,o)}o(t$17,`t`);function n$17(o,s){let c={};for(let[l,u]of o.entries()){let d=s(u,l,o);c[d]=u}return c}o(n$17,`n`);function e$15(o){return Array.isArray(o)}o(e$15,`e`);function e$14(o){return typeof o==`boolean`}o(e$14,`e`);function e$13(o){return o!==void 0}o(e$13,`e`);function e$12(o){return o===``||o===void 0?!0:Array.isArray(o)?o.length===0:Object.keys(o).length===0}o(e$12,`e`);function e$11(o){if(o==null||o===``)return!0;if(typeof o!=`object`)return!1;if(`length`in o&&typeof o.length==`number`)return o.length===0;if(`size`in o&&typeof o.size==`number`)return o.size===0;for(let s in o)return!1;return Object.getOwnPropertySymbols(o).length===0}o(e$11,`e`);const L=o(o=>typeof o==`function`,`e`);function e$9(o){return o!=null}o(e$9,`e`);function e$8(o){return s=>!o(s)}o(e$8,`e`);function e$7(o){return o==null}o(e$7,`e`);function e$6(o){return typeof o==`number`&&!Number.isNaN(o)}o(e$6,`e`);function e$5(o){return typeof o==`object`&&!!o}o(e$5,`e`);function e$4(o){return o instanceof Promise}o(e$4,`e`);function e$3(o){return typeof o==`string`}o(e$3,`e`);function e$2(o){return!!o}o(e$2,`e`);function t$16(...o){return t$36(R,o)}o(t$16,`t`);const R=o((o,s)=>o.join(s),`n`);function t$15(...o){return t$36(Object.keys,o)}o(t$15,`t`);function t$14(...o){return t$36(z,o)}o(t$14,`t`);const z=o(o=>o.at(-1),`n`);function t$13(...o){return t$36(B,o,V)}o(t$13,`t`);const B=o((o,s)=>o.map(s),`n`),V=o(o=>(s,c,l)=>({done:!1,hasNext:!0,next:o(s,c,l)}),`r`);function t$12(...o){return t$36(n$13,o)}o(t$12,`t`);function n$13(o,s){let c={};for(let[l,u]of o.entries()){let[d,h]=s(u,l,o);c[d]=h}return c}o(n$13,`n`);function t$11(...o){return t$36(n$12,o)}o(t$11,`t`);function n$12(o,s){let c={};for(let[l,u]of Object.entries(o))c[l]=s(u,l,o);return c}o(n$12,`n`);function n$11(...o){return t$36(r$3,o)}o(n$11,`n`);function r$3(o,s){if(!t$28(s,1))return{...o};if(!t$28(s,2)){let{[s[0]]:c,...l}=o;return l}let c={...o};for(let o of s)delete c[o];return c}o(r$3,`r`);function t$10(...o){return t$36(n$10,o)}o(t$10,`t`);function n$10(o,s){let c={...o};for(let[l,u]of Object.entries(c))s(u,l,o)&&delete c[l];return c}o(n$10,`n`);function e$1(o){let s=!1,c;return()=>(s||=(c=o(),!0),c)}o(e$1,`e`);function t$9(...o){return t$36(H,o)}o(t$9,`t`);const H=o(o=>o.length===1?o[0]:void 0,`n`);function t$8(...o){return t$36(U,o)}o(t$8,`t`);const U=o((o,s)=>{let c=[[],[]];for(let[l,u]of o.entries())s(u,l,o)?c[0].push(u):c[1].push(u);return c},`n`);function t$7(...o){return s=>t$30(s,...o)}o(t$7,`t`);function e(o,...s){return typeof o==`string`||typeof o==`number`||typeof o==`symbol`?c=>t$6(c,o,...s):t$6(o,...s)}function t$6(o,...s){let c=o;for(let o of s){if(c==null)return;c=c[o]}return c}o(t$6,`t`);function t$5(...o){return t$36(n$7,o)}o(t$5,`t`);function n$7(o){let s=[];for(let c=0;c<o;c++){let o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(Math.random()*62)];s.push(o)}return s.join(``)}o(n$7,`n`);function t$4(...o){return t$36(W,o)}o(t$4,`t`);const W=o((o,s,c)=>o.reduce(s,c),`n`);function t$3(...o){return t$36(n$5,o)}o(t$3,`t`);function n$5(o){return[...o].reverse()}o(n$5,`n`);function t$2(...o){return t$36(n$4,o)}o(t$2,`t`);function n$4(o,s){let c=[...o];return c.sort(s),c}o(n$4,`n`);function n$3(...o){return t$36(G,o,i)}o(n$3,`n`);const G=o((o,s)=>s<0?[]:o.slice(0,s),`r`);function i(o){if(o<=0)return h;let s=o;return o=>(--s,{done:s<=0,hasNext:!0,next:o})}function t$1(...o){return t$36(n$2,o)}o(t$1,`t`);function n$2(o,s){return s(o),o}o(n$2,`n`);function n$1(...o){return t$29(r$1,o)}o(n$1,`n`);function r$1(){let o=new Set;return s=>o.has(s)?d:(o.add(s),{done:!1,hasNext:!0,next:s})}o(r$1,`r`);function n(...o){return t$29(r,o)}function r(o){let s=o,c=new Set;return(o,l,u)=>{let h=s(o,l,u);return c.has(h)?d:(c.add(h),{done:!1,hasNext:!0,next:o})}}function t(...o){return t$36(Object.values,o)}export{r$12 as $,e$9 as A,t$20 as B,e$2 as C,e$6 as D,e$5 as E,e$14 as F,t$25 as G,n$21 as H,e$15 as I,t$26 as J,n$25 as K,t$17 as L,e$11 as M,e$12 as N,e$7 as O,e$13 as P,t$28 as Q,e$16 as R,t$16 as S,e$4 as T,t$23 as U,t$21 as V,t$24 as W,n$28 as X,r$10 as Y,t$27 as Z,t$11 as _,n$3 as a,t$36 as at,t$14 as b,t$4 as c,t$7 as d,t$30 as et,t$8 as f,n$11 as g,t$10 as h,t$1 as i,t$35 as it,L as j,e$8 as k,t$5 as l,e$1 as m,n,t$33 as nt,t$2 as o,t$9 as p,n$26 as q,n$1 as r,t$34 as rt,t$3 as s,t,t$32 as tt,e as u,t$12 as v,e$3 as w,t$15 as x,t$13 as y,t$19 as z};
|
|
1
|
+
import{i as s}from"../rolldown-runtime.mjs";function e$20(s,c,l){let r=l=>s(l,...c);return l===void 0?r:Object.assign(r,{lazy:l,lazyArgs:c})}s(e$20,`e`);function t$36(s,c,l){let u=s.length-c.length;if(u===0)return s(...c);if(u===1)return e$20(s,c,l);throw Error(`Wrong number of arguments`)}s(t$36,`t`);function t$35(...s){return t$36(c,s)}s(t$35,`t`);const c=s((s,c)=>c.some(c=>c(s)),`n`);function t$34(...s){return t$36(n$34,s)}s(t$34,`t`);function n$34(s,c){if(c<1)throw RangeError(`chunk: A chunk size of '${c.toString()}' would result in an infinite array`);if(s.length===0)return[];if(c>=s.length)return[[...s]];let l=Math.ceil(s.length/c),u=Array(l);if(c===1)for(let[c,l]of s.entries())u[c]=[l];else for(let d=0;d<l;d+=1){let l=d*c;u[d]=s.slice(l,l+c)}return u}s(n$34,`n`);function t$33(...s){return t$36(l,s)}s(t$33,`t`);const l=s((s,{min:c,max:l})=>c!==void 0&&s<c?c:l!==void 0&&s>l?l:s,`n`);function t$32(...s){return t$36(u,s)}s(t$32,`t`);const u=s((s,c)=>[...s,...c],`n`),d={done:!0,hasNext:!1},h={done:!1,hasNext:!1},g=s(()=>d,`n`),_=s(s=>({hasNext:!0,next:s,done:!1}),`r`);function t$30(s,...c){let l=s,u=c.map(s=>`lazy`in s?r$13(s):void 0),d=0;for(;d<c.length;){if(u[d]===void 0||!i$7(l)){let s=c[d];l=s(l),d+=1;continue}let s=[];for(let l=d;l<c.length;l++){let c=u[l];if(c===void 0||(s.push(c),c.isSingle))break}let h=[];for(let c of l)if(n$30(c,h,s))break;let{isSingle:g}=s.at(-1);l=g?h[0]:h,d+=s.length}return l}s(t$30,`t`);function n$30(s,c,l){if(l.length===0)return c.push(s),!1;let u=s,d=h,g=!1;for(let[s,h]of l.entries()){let{index:_,items:v}=h;if(v.push(u),d=h(u,_,v),h.index+=1,d.hasNext){if(d.hasMany??!1){for(let u of d.next)if(n$30(u,c,l.slice(s+1)))return!0;return g}u=d.next}if(!d.hasNext)break;d.done&&(g=!0)}return d.hasNext&&c.push(u),g}s(n$30,`n`);function r$13(s){let{lazy:c,lazyArgs:l}=s,u=c(...l);return Object.assign(u,{isSingle:c.single??!1,index:0,items:[]})}s(r$13,`r`);function i$7(s){return typeof s==`string`||typeof s==`object`&&!!s&&Symbol.iterator in s}s(i$7,`i`);function t$29(s,c){let l=c.length-s.length;if(l===1){let[l,...u]=c;return t$30(l,{lazy:s,lazyArgs:u})}if(l===0){let l={lazy:s,lazyArgs:c};return Object.assign(s=>t$30(s,l),l)}throw Error(`Wrong number of arguments`)}s(t$29,`t`);function r$12(...s){return t$29(i$6,s)}s(r$12,`r`);function i$6(s){if(s.length===0)return _;let c=new Map;for(let l of s)c.set(l,(c.get(l)??0)+1);return s=>{let l=c.get(s);return l===void 0||l===0?{done:!1,hasNext:!0,next:s}:(c.set(s,l-1),h)}}s(i$6,`i`);function t$28(...s){return t$36(v,s)}s(t$28,`t`);const v=s((s,c)=>s.length>=c,`n`);function t$27(...s){return t$36(Object.entries,s)}s(t$27,`t`);function n$28(...s){return t$36(y,s,b)}s(n$28,`n`);const y=s((s,c)=>s.filter(c),`r`),b=s(s=>(c,l,u)=>s(c,l,u)?{done:!1,hasNext:!0,next:c}:h,`i`),x=s(s=>Object.assign(s,{single:!0}),`e`);function r$10(...s){return t$36(S,s,x(C))}s(r$10,`r`);const S=s((s,c)=>s.find(c),`i`),C=s(s=>(c,l,u)=>s(c,l,u)?{done:!0,hasNext:!0,next:c}:h,`a`);function t$26(...s){return t$36(w,s)}s(t$26,`t`);const w=s((s,c)=>{for(let l=s.length-1;l>=0;l--){let u=s[l];if(c(u,l,s))return u}},`n`);function n$26(...s){return t$36(T,s,x(E))}s(n$26,`n`);const T=s(([s])=>s,`r`),E=s(()=>D,`i`),D=s(s=>({hasNext:!0,next:s,done:!0}),`a`);function n$25(s,c){return typeof s==`object`?O(s,c):e$20(O,s===void 0?[]:[s],k)}s(n$25,`n`);const O=s((s,c)=>c===void 0?s.flat():s.flat(c),`r`),k=s(s=>s===void 0||s===1?A:s<=0?_:c=>Array.isArray(c)?{next:c.flat(s-1),hasNext:!0,hasMany:!0,done:!1}:{next:c,hasNext:!0,done:!1},`i`),A=s(s=>Array.isArray(s)?{next:s,hasNext:!0,hasMany:!0,done:!1}:{next:s,hasNext:!0,done:!1},`a`);function t$25(...s){return t$36(j,s,M)}s(t$25,`t`);const j=s((s,c)=>s.flatMap(c),`n`),M=s(s=>(c,l,u)=>{let d=s(c,l,u);return Array.isArray(d)?{done:!1,hasNext:!0,hasMany:!0,next:d}:{done:!1,hasNext:!0,next:d}},`r`);function t$24(...s){return t$36(n$23,s,N)}s(t$24,`t`);function n$23(s,c){return s.forEach(c),s}s(n$23,`n`);const N=s(s=>(c,l,u)=>(s(c,l,u),{done:!1,hasNext:!0,next:c}),`r`);function t$23(...s){return t$36(n$22,s)}s(t$23,`t`);function n$22(s,c){for(let[l,u]of Object.entries(s))c(u,l,s);return s}s(n$22,`n`);const P=Symbol(`funnel/voidReducer`),F=s(()=>P,`t`);function n$21(s,{triggerAt:c=`end`,minQuietPeriodMs:l,maxBurstDurationMs:u,minGapMs:d,reducer:h=F}){let g,_,v,y,f=()=>{let c=v;c!==void 0&&(v=void 0,c===P?s():s(c),d!==void 0&&(_=setTimeout(p,d)))},p=()=>{clearTimeout(_),_=void 0,g===void 0&&f()},m=()=>{clearTimeout(g),g=void 0,y=void 0,_===void 0&&f()};return{call:(...s)=>{let b=g===void 0&&_===void 0;if((c!==`start`||b)&&(v=h(v,...s)),!(g===void 0&&!b)){if(l!==void 0||u!==void 0||d===void 0){clearTimeout(g);let s=Date.now();y??=s;let c=u===void 0?l??0:Math.min(l??u,Math.max(0,u-(s-y)));g=setTimeout(m,c)}c!==`end`&&b&&f()}},cancel:()=>{clearTimeout(g),g=void 0,y=void 0,clearTimeout(_),_=void 0,v=void 0},flush:()=>{m(),p()},get isIdle(){return g===void 0&&_===void 0}}}s(n$21,`n`);function t$21(...s){return t$36(I,s)}s(t$21,`t`);const I=s((s,c)=>{let l=Object.create(null);for(let u=0;u<s.length;u++){let d=s[u],h=c(d,u,s);if(h!==void 0){let s=l[h];s===void 0?l[h]=[d]:s.push(d)}}return Object.setPrototypeOf(l,Object.prototype),l},`n`);function t$20(...s){return t$36(n$19,s)}s(t$20,`t`);function n$19(s,c){let l=Object.create(null);for(let u of s){let s=u?.[c];if(s!==void 0){let c=l[s];c===void 0?l[s]=[u]:c.push(u)}}return Object.setPrototypeOf(l,Object.prototype),l}s(n$19,`n`);function t$19(...s){return t$36(n$18,s)}s(t$19,`t`);function n$18(s,c){if(s===c||Object.is(s,c))return!0;if(typeof s!=`object`||typeof c!=`object`||s===null||c===null||!r$5(s,c))return!1;if(Array.isArray(s))return i$1(s,c);if(s instanceof Map)return a(s,c);if(s instanceof Set)return o(s,c);if(s instanceof Date)return s.getTime()===c.getTime();if(s instanceof RegExp)return s.toString()===c.toString();if(Object.keys(s).length!==Object.keys(c).length)return!1;for(let[l,u]of Object.entries(s))if(!(l in c)||!n$18(u,c[l]))return!1;return!0}s(n$18,`n`);function r$5(s,c){let l=Object.getPrototypeOf(s),u=Object.getPrototypeOf(c);return l===u?!0:l===null?u===Object.prototype:l===Object.prototype&&u===null}s(r$5,`r`);function i$1(s,c){if(s.length!==c.length)return!1;for(let[l,u]of s.entries())if(!n$18(u,c[l]))return!1;return!0}s(i$1,`i`);function a(s,c){if(s.size!==c.size)return!1;for(let[l,u]of s.entries())if(!c.has(l)||!n$18(u,c.get(l)))return!1;return!0}function o(s,c){if(s.size!==c.size)return!1;let l=[...c];for(let c of s){let s=!1;for(let[u,d]of l.entries())if(n$18(c,d)){s=!0,l.splice(u,1);break}if(!s)return!1}return!0}function e$16(){return L}s(e$16,`e`);const L=s(s=>s,`t`);function t$17(...s){return t$36(n$17,s)}s(t$17,`t`);function n$17(s,c){let l={};for(let[u,d]of s.entries()){let h=c(d,u,s);l[h]=d}return l}s(n$17,`n`);function e$15(s){return Array.isArray(s)}s(e$15,`e`);function e$14(s){return typeof s==`boolean`}s(e$14,`e`);function e$13(s){return s!==void 0}s(e$13,`e`);function e$12(s){return s===``||s===void 0?!0:Array.isArray(s)?s.length===0:Object.keys(s).length===0}s(e$12,`e`);function e$11(s){if(s==null||s===``)return!0;if(typeof s!=`object`)return!1;if(`length`in s&&typeof s.length==`number`)return s.length===0;if(`size`in s&&typeof s.size==`number`)return s.size===0;for(let c in s)return!1;return Object.getOwnPropertySymbols(s).length===0}s(e$11,`e`);const R=s(s=>typeof s==`function`,`e`);function e$9(s){return s!=null}s(e$9,`e`);function e$8(s){return c=>!s(c)}s(e$8,`e`);function e$7(s){return s==null}s(e$7,`e`);function e$6(s){return typeof s==`number`&&!Number.isNaN(s)}s(e$6,`e`);function e$5(s){return typeof s==`object`&&!!s}s(e$5,`e`);function e$4(s){return s instanceof Promise}s(e$4,`e`);function e$3(s){return typeof s==`string`}s(e$3,`e`);function e$2(s){return!!s}s(e$2,`e`);function t$16(...s){return t$36(z,s)}s(t$16,`t`);const z=s((s,c)=>s.join(c),`n`);function t$15(...s){return t$36(Object.keys,s)}s(t$15,`t`);function t$14(...s){return t$36(B,s)}s(t$14,`t`);const B=s(s=>s.at(-1),`n`);function t$13(...s){return t$36(V,s,H)}s(t$13,`t`);const V=s((s,c)=>s.map(c),`n`),H=s(s=>(c,l,u)=>({done:!1,hasNext:!0,next:s(c,l,u)}),`r`);function t$12(...s){return t$36(n$13,s)}s(t$12,`t`);function n$13(s,c){let l={};for(let[u,d]of s.entries()){let[h,g]=c(d,u,s);l[h]=g}return l}s(n$13,`n`);function t$11(...s){return t$36(n$12,s)}s(t$11,`t`);function n$12(s,c){let l={};for(let[u,d]of Object.entries(s))l[u]=c(d,u,s);return l}s(n$12,`n`);function n$11(...s){return t$36(r$3,s)}s(n$11,`n`);function r$3(s,c){if(!t$28(c,1))return{...s};if(!t$28(c,2)){let{[c[0]]:l,...u}=s;return u}let l={...s};for(let s of c)delete l[s];return l}s(r$3,`r`);function t$10(...s){return t$36(n$10,s)}s(t$10,`t`);function n$10(s,c){let l={...s};for(let[u,d]of Object.entries(l))c(d,u,s)&&delete l[u];return l}s(n$10,`n`);function e$1(s){let c=!1,l;return()=>(c||=(l=s(),!0),l)}s(e$1,`e`);function t$9(...s){return t$36(U,s)}s(t$9,`t`);const U=s(s=>s.length===1?s[0]:void 0,`n`);function t$8(...s){return t$36(W,s)}s(t$8,`t`);const W=s((s,c)=>{let l=[[],[]];for(let[u,d]of s.entries())c(d,u,s)?l[0].push(d):l[1].push(d);return l},`n`);function t$7(...s){return c=>t$30(c,...s)}s(t$7,`t`);function e(s,...c){return typeof s==`string`||typeof s==`number`||typeof s==`symbol`?l=>t$6(l,s,...c):t$6(s,...c)}function t$6(s,...c){let l=s;for(let s of c){if(l==null)return;l=l[s]}return l}s(t$6,`t`);function t$5(...s){return t$36(n$7,s)}s(t$5,`t`);function n$7(s){let c=[];for(let l=0;l<s;l++){let s=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(Math.random()*62)];c.push(s)}return c.join(``)}s(n$7,`n`);function t$4(...s){return t$36(G,s)}s(t$4,`t`);const G=s((s,c,l)=>s.reduce(c,l),`n`);function t$3(...s){return t$36(n$5,s)}s(t$3,`t`);function n$5(s){return[...s].reverse()}s(n$5,`n`);function t$2(...s){return t$36(n$4,s)}s(t$2,`t`);function n$4(s,c){let l=[...s];return l.sort(c),l}s(n$4,`n`);function n$3(...s){return t$36(K,s,i)}s(n$3,`n`);const K=s((s,c)=>c<0?[]:s.slice(0,c),`r`);function i(s){if(s<=0)return g;let c=s;return s=>(--c,{done:c<=0,hasNext:!0,next:s})}function t$1(...s){return t$36(n$2,s)}s(t$1,`t`);function n$2(s,c){return c(s),s}s(n$2,`n`);function n$1(...s){return t$29(r$1,s)}s(n$1,`n`);function r$1(){let s=new Set;return c=>s.has(c)?h:(s.add(c),{done:!1,hasNext:!0,next:c})}s(r$1,`r`);function n(...s){return t$29(r,s)}function r(s){let c=s,l=new Set;return(s,u,d)=>{let g=c(s,u,d);return l.has(g)?h:(l.add(g),{done:!1,hasNext:!0,next:s})}}function t(...s){return t$36(Object.values,s)}export{r$12 as $,e$9 as A,t$20 as B,e$2 as C,e$6 as D,e$5 as E,e$14 as F,t$25 as G,n$21 as H,e$15 as I,t$26 as J,n$25 as K,t$17 as L,e$11 as M,e$12 as N,e$7 as O,e$13 as P,t$28 as Q,e$16 as R,t$16 as S,e$4 as T,t$23 as U,t$21 as V,t$24 as W,n$28 as X,r$10 as Y,t$27 as Z,t$11 as _,n$3 as a,t$36 as at,t$14 as b,t$4 as c,t$7 as d,t$30 as et,t$8 as f,n$11 as g,t$10 as h,t$1 as i,t$35 as it,R as j,e$8 as k,t$5 as l,e$1 as m,n,t$33 as nt,t$2 as o,t$9 as p,n$26 as q,n$1 as r,t$34 as rt,t$3 as s,t,t$32 as tt,e as u,t$12 as v,e$3 as w,t$15 as x,t$13 as y,t$19 as z};
|
package/dist/chunks/libs/ufo.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../rolldown-runtime.mjs";String.fromCharCode;const e=/#/g,t=/&/g,n=/\//g,r=/=/g,i=/\+/g,a=/%5e/gi,o=/%60/gi,s=/%7c/gi,c=/%20/gi;function encode(e){return encodeURI(``+e).replace(s,`|`)}function encodeQueryValue(r){return encode(typeof r==`string`?r:JSON.stringify(r)).replace(i,`%2B`).replace(c,`+`).replace(e,`%23`).replace(t,`%26`).replace(o,"`").replace(a,`^`).replace(n,`%2F`)}function encodeQueryKey(e){return encodeQueryValue(e).replace(r,`%3D`)}function decode(e=``){try{return decodeURIComponent(``+e)}catch{return``+e}}function decodeQueryKey(e){return decode(e.replace(i,` `))}function decodeQueryValue(e){return decode(e.replace(i,` `))}function parseQuery(e=``){let t=Object.create(null);e[0]===`?`&&(e=e.slice(1));for(let n of e.split(`&`)){let e=n.match(/([^=]+)=?(.*)/)||[];if(e.length<2)continue;let r=decodeQueryKey(e[1]);if(r===`__proto__`||r===`constructor`)continue;let i=decodeQueryValue(e[2]||``);t[r]===void 0?t[r]=i:Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]}return t}function encodeQueryItem(e,t){return(typeof t==`number`||typeof t==`boolean`)&&(t=String(t)),t?Array.isArray(t)?t.map(t=>`${encodeQueryKey(e)}=${encodeQueryValue(t)}`).join(`&`):`${encodeQueryKey(e)}=${encodeQueryValue(t)}`:encodeQueryKey(e)}function stringifyQuery(e){return Object.keys(e).filter(t=>e[t]!==void 0).map(t=>encodeQueryItem(t,e[t])).filter(Boolean).join(`&`)}const l=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,u=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,d=/^([/\\]\s*){2,}[^/\\]/,f=/\/$|\/\?|\/#/,p=/^\.?\//;function isRelative(e){return[`./`,`../`].some(t=>e.startsWith(t))}function hasProtocol(e,t={}){return typeof t==`boolean`&&(t={acceptRelative:t}),t.strict?l.test(e):u.test(e)||(t.acceptRelative?d.test(e):!1)}function hasTrailingSlash(e=``,t){return t?f.test(e):e.endsWith(`/`)}function withoutTrailingSlash(e=``,t){if(!t)return(hasTrailingSlash(e)?e.slice(0,-1):e)||`/`;if(!hasTrailingSlash(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);i!==-1&&(n=e.slice(0,i),r=e.slice(i));let[a,...o]=n.split(`?`);return((a.endsWith(`/`)?a.slice(0,-1):a)||`/`)+(o.length>0?`?${o.join(`?`)}`:``)+r}function withTrailingSlash(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(hasTrailingSlash(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function hasLeadingSlash(e=``){return e.startsWith(`/`)}function withoutLeadingSlash(e=``){return(hasLeadingSlash(e)?e.slice(1):e)||`/`}function withLeadingSlash(e=``){return hasLeadingSlash(e)?e:`/`+e}function cleanDoubleSlashes(e=``){return e.split(`://`).map(e=>e.replace(/\/{2,}/g,`/`)).join(`://`)}function withoutBase(e,t){if(isEmptyURL(t))return e;let n=withoutTrailingSlash(t);if(!e.startsWith(n))return e;let r=e[n.length];
|
|
1
|
+
import"../rolldown-runtime.mjs";String.fromCharCode;const e=/#/g,t=/&/g,n=/\//g,r=/=/g,i=/\+/g,a=/%5e/gi,o=/%60/gi,s=/%7c/gi,c=/%20/gi;function encode(e){return encodeURI(``+e).replace(s,`|`)}function encodeQueryValue(r){return encode(typeof r==`string`?r:JSON.stringify(r)).replace(i,`%2B`).replace(c,`+`).replace(e,`%23`).replace(t,`%26`).replace(o,"`").replace(a,`^`).replace(n,`%2F`)}function encodeQueryKey(e){return encodeQueryValue(e).replace(r,`%3D`)}function decode(e=``){try{return decodeURIComponent(``+e)}catch{return``+e}}function decodeQueryKey(e){return decode(e.replace(i,` `))}function decodeQueryValue(e){return decode(e.replace(i,` `))}function parseQuery(e=``){let t=Object.create(null);e[0]===`?`&&(e=e.slice(1));for(let n of e.split(`&`)){let e=n.match(/([^=]+)=?(.*)/)||[];if(e.length<2)continue;let r=decodeQueryKey(e[1]);if(r===`__proto__`||r===`constructor`)continue;let i=decodeQueryValue(e[2]||``);t[r]===void 0?t[r]=i:Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]}return t}function encodeQueryItem(e,t){return(typeof t==`number`||typeof t==`boolean`)&&(t=String(t)),t?Array.isArray(t)?t.map(t=>`${encodeQueryKey(e)}=${encodeQueryValue(t)}`).join(`&`):`${encodeQueryKey(e)}=${encodeQueryValue(t)}`:encodeQueryKey(e)}function stringifyQuery(e){return Object.keys(e).filter(t=>e[t]!==void 0).map(t=>encodeQueryItem(t,e[t])).filter(Boolean).join(`&`)}const l=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,u=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,d=/^([/\\]\s*){2,}[^/\\]/,f=/\/$|\/\?|\/#/,p=/^\.?\//;function isRelative(e){return[`./`,`../`].some(t=>e.startsWith(t))}function hasProtocol(e,t={}){return typeof t==`boolean`&&(t={acceptRelative:t}),t.strict?l.test(e):u.test(e)||(t.acceptRelative?d.test(e):!1)}function hasTrailingSlash(e=``,t){return t?f.test(e):e.endsWith(`/`)}function withoutTrailingSlash(e=``,t){if(!t)return(hasTrailingSlash(e)?e.slice(0,-1):e)||`/`;if(!hasTrailingSlash(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);i!==-1&&(n=e.slice(0,i),r=e.slice(i));let[a,...o]=n.split(`?`);return((a.endsWith(`/`)?a.slice(0,-1):a)||`/`)+(o.length>0?`?${o.join(`?`)}`:``)+r}function withTrailingSlash(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(hasTrailingSlash(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function hasLeadingSlash(e=``){return e.startsWith(`/`)}function withoutLeadingSlash(e=``){return(hasLeadingSlash(e)?e.slice(1):e)||`/`}function withLeadingSlash(e=``){return hasLeadingSlash(e)?e:`/`+e}function cleanDoubleSlashes(e=``){return e.split(`://`).map(e=>e.replace(/\/{2,}/g,`/`)).join(`://`)}function withoutBase(e,t){if(isEmptyURL(t))return e;let n=withoutTrailingSlash(t);if(!e.startsWith(n))return e;let r=e[n.length];return r&&r!==`/`&&r!==`?`?e:`/`+e.slice(n.length).replace(/^\/+/,``)}function withQuery(e,t){let n=parseURL(e);return n.search=stringifyQuery({...parseQuery(n.search),...t}),stringifyParsedURL(n)}function isEmptyURL(e){return!e||e===`/`}function isNonEmptyURL(e){return e&&e!==`/`}function joinURL(e,...t){let n=e||``;for(let e of t.filter(e=>isNonEmptyURL(e)))if(n){let t=e.replace(p,``);n=withTrailingSlash(n)+t}else n=e;return n}function joinRelativeURL(...e){let t=/\/(?!\/)/,n=e.filter(Boolean),r=[],i=0;for(let e of n)if(!(!e||e===`/`)){for(let[n,a]of e.split(t).entries())if(!(!a||a===`.`)){if(a===`..`){if(r.length===1&&hasProtocol(r[0]))continue;r.pop(),i--;continue}if(n===1&&r[r.length-1]?.endsWith(`:/`)){r[r.length-1]+=`/`+a;continue}r.push(a),i++}}let a=r.join(`/`);return i>=0?n[0]?.startsWith(`/`)&&!a.startsWith(`/`)?a=`/`+a:n[0]?.startsWith(`./`)&&!a.startsWith(`./`)&&(a=`./`+a):a=`../`.repeat(-1*i)+a,n[n.length-1]?.endsWith(`/`)&&!a.endsWith(`/`)&&(a+=`/`),a}function withoutProtocol(e){return withProtocol(e,``)}function withProtocol(e,t){let n=e.match(u);return n||=e.match(/^\/{2,}/),n?t+e.slice(n[0].length):t+e}const m=Symbol.for(`ufo:protocolRelative`);function parseURL(e=``,t){let n=e.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(n){let[,e,t=``]=n;return{protocol:e.toLowerCase(),pathname:t,href:e+t,auth:``,host:``,search:``,hash:``}}if(!hasProtocol(e,{acceptRelative:!0}))return t?parseURL(t+e):parsePath(e);let[,r=``,i,a=``]=e.replace(/\\/g,`/`).match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[],[,o=``,s=``]=a.match(/([^#/?]*)(.*)?/)||[];r===`file:`&&(s=s.replace(/\/(?=[A-Za-z]:)/,``));let{pathname:c,search:l,hash:u}=parsePath(s);return{protocol:r.toLowerCase(),auth:i?i.slice(0,Math.max(0,i.length-1)):``,host:o,pathname:c,search:l,hash:u,[m]:!r}}function parsePath(e=``){let[t=``,n=``,r=``]=(e.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:t,search:n,hash:r}}function stringifyParsedURL(e){let t=e.pathname||``,n=e.search?(e.search.startsWith(`?`)?``:`?`)+e.search:``,r=e.hash||``,i=e.auth?e.auth+`@`:``,a=e.host||``;return(e.protocol||e[m]?(e.protocol||``)+`//`:``)+i+a+t+n+r}export{joinRelativeURL as a,withQuery as c,withoutLeadingSlash as d,withoutProtocol as f,isRelative as i,withTrailingSlash as l,hasLeadingSlash as n,joinURL as o,withoutTrailingSlash as p,hasProtocol as r,withLeadingSlash as s,cleanDoubleSlashes as t,withoutBase as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../rolldown-runtime.mjs";
|
|
1
|
+
import"../rolldown-runtime.mjs";const e=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,t=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,n=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function jsonParseTransform(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){warnKeyDropped(e);return}return t}function warnKeyDropped(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function destr(r,i={}){if(typeof r!=`string`)return r;if(r[0]===`"`&&r[r.length-1]===`"`&&r.indexOf(`\\`)===-1)return r.slice(1,-1);let a=r.trim();if(a.length<=9)switch(a.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!n.test(r)){if(i.strict)throw SyntaxError(`[destr] Invalid JSON`);return r}try{if(e.test(r)||t.test(r)){if(i.strict)throw Error(`[destr] Possible prototype pollution`);return JSON.parse(r,jsonParseTransform)}return JSON.parse(r)}catch(e){if(i.strict)throw e;return r}}function wrapToPromise(e){return!e||typeof e.then!=`function`?Promise.resolve(e):e}function asyncCall(e,...t){try{return wrapToPromise(e(...t))}catch(e){return Promise.reject(e)}}function isPrimitive(e){let t=typeof e;return e===null||t!==`object`&&t!==`function`}function isPureObject(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function stringify(e){if(isPrimitive(e))return String(e);if(isPureObject(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON==`function`)return stringify(e.toJSON());throw Error(`[unstorage] Cannot stringify value!`)}const r=`base64:`;function serializeRaw(e){return typeof e==`string`?e:r+base64Encode(e)}function deserializeRaw(e){return typeof e!=`string`||!e.startsWith(r)?e:base64Decode(e.slice(7))}function base64Decode(e){return globalThis.Buffer?Buffer.from(e,`base64`):Uint8Array.from(globalThis.atob(e),e=>e.codePointAt(0))}function base64Encode(e){return globalThis.Buffer?Buffer.from(e).toString(`base64`):globalThis.btoa(String.fromCodePoint(...e))}const i=[`has`,`hasItem`,`get`,`getItem`,`getItemRaw`,`set`,`setItem`,`setItemRaw`,`del`,`remove`,`removeItem`,`getMeta`,`setMeta`,`removeMeta`,`getKeys`,`clear`,`mount`,`unmount`];function prefixStorage(e,t){if(t=normalizeBaseKey(t),!t)return e;let n={...e};for(let r of i)n[r]=(n=``,...i)=>e[r](t+n,...i);return n.getKeys=(n=``,...r)=>e.getKeys(t+n,...r).then(e=>e.map(e=>e.slice(t.length))),n.keys=n.getKeys,n.getItems=async(n,r)=>{let i=n.map(e=>typeof e==`string`?t+e:{...e,key:t+e.key});return(await e.getItems(i,r)).map(e=>({key:e.key.slice(t.length),value:e.value}))},n.setItems=async(n,r)=>{let i=n.map(e=>({key:t+e.key,value:e.value,options:e.options}));return e.setItems(i,r)},n}function normalizeKey(e){return e&&e.split(`?`)[0]?.replace(/[/\\]/g,`:`).replace(/:+/g,`:`).replace(/^:|:$/g,``)||``}function joinKeys(...e){return normalizeKey(e.join(`:`))}function normalizeBaseKey(e){return e=normalizeKey(e),e?e+`:`:``}function filterKeyByDepth(e,t){if(t===void 0)return!0;let n=0,r=e.indexOf(`:`);for(;r>-1;)n++,r=e.indexOf(`:`,r+1);return n<=t}function filterKeyByBase(e,t){return t?e.startsWith(t)&&e[e.length-1]!==`$`:e[e.length-1]!==`$`}function defineDriver(e){return e}const a=defineDriver(()=>{let e=new Map;return{name:`memory`,getInstance:()=>e,hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys(){return[...e.keys()]},clear(){e.clear()},dispose(){e.clear()}}});function createStorage(e={}){let t={mounts:{"":e.driver||a()},mountpoints:[``],watching:!1,watchListeners:[],unwatch:{}},getMount=e=>{for(let n of t.mountpoints)if(e.startsWith(n))return{base:n,relativeKey:e.slice(n.length),driver:t.mounts[n]};return{base:``,relativeKey:e,driver:t.mounts[``]}},getMounts=(e,n)=>t.mountpoints.filter(t=>t.startsWith(e)||n&&e.startsWith(t)).map(n=>({relativeBase:e.length>n.length?e.slice(n.length):void 0,mountpoint:n,driver:t.mounts[n]})),onChange=(e,n)=>{if(t.watching){n=normalizeKey(n);for(let r of t.watchListeners)r(e,n)}},startWatch=async()=>{if(!t.watching){t.watching=!0;for(let e in t.mounts)t.unwatch[e]=await watch(t.mounts[e],onChange,e)}},stopWatch=async()=>{if(t.watching){for(let e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},runBatch=(e,t,n)=>{let r=new Map,getBatch=e=>{let t=r.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},r.set(e.base,t)),t};for(let n of e){let e=typeof n==`string`,r=normalizeKey(e?n:n.key),i=e?void 0:n.value,a=e||!n.options?t:{...t,...n.options},o=getMount(r);getBatch(o).items.push({key:r,value:i,relativeKey:o.relativeKey,options:a})}return Promise.all([...r.values()].map(e=>n(e))).then(e=>e.flat())},n={hasItem(e,t={}){e=normalizeKey(e);let{relativeKey:n,driver:r}=getMount(e);return asyncCall(r.hasItem,n,t)},getItem(e,t={}){e=normalizeKey(e);let{relativeKey:n,driver:r}=getMount(e);return asyncCall(r.getItem,n,t).then(e=>destr(e))},getItems(e,t={}){return runBatch(e,t,e=>e.driver.getItems?asyncCall(e.driver.getItems,e.items.map(e=>({key:e.relativeKey,options:e.options})),t).then(t=>t.map(t=>({key:joinKeys(e.base,t.key),value:destr(t.value)}))):Promise.all(e.items.map(t=>asyncCall(e.driver.getItem,t.relativeKey,t.options).then(e=>({key:t.key,value:destr(e)})))))},getItemRaw(e,t={}){e=normalizeKey(e);let{relativeKey:n,driver:r}=getMount(e);return r.getItemRaw?asyncCall(r.getItemRaw,n,t):asyncCall(r.getItem,n,t).then(e=>deserializeRaw(e))},async setItem(e,t,r={}){if(t===void 0)return n.removeItem(e);e=normalizeKey(e);let{relativeKey:i,driver:a}=getMount(e);a.setItem&&(await asyncCall(a.setItem,i,stringify(t),r),a.watch||onChange(`update`,e))},async setItems(e,t){await runBatch(e,t,async e=>{if(e.driver.setItems)return asyncCall(e.driver.setItems,e.items.map(e=>({key:e.relativeKey,value:stringify(e.value),options:e.options})),t);e.driver.setItem&&await Promise.all(e.items.map(t=>asyncCall(e.driver.setItem,t.relativeKey,stringify(t.value),t.options)))})},async setItemRaw(e,t,r={}){if(t===void 0)return n.removeItem(e,r);e=normalizeKey(e);let{relativeKey:i,driver:a}=getMount(e);if(a.setItemRaw)await asyncCall(a.setItemRaw,i,t,r);else if(a.setItem)await asyncCall(a.setItem,i,serializeRaw(t),r);else return;a.watch||onChange(`update`,e)},async removeItem(e,t={}){typeof t==`boolean`&&(t={removeMeta:t}),e=normalizeKey(e);let{relativeKey:n,driver:r}=getMount(e);r.removeItem&&(await asyncCall(r.removeItem,n,t),(t.removeMeta||t.removeMata)&&await asyncCall(r.removeItem,n+`$`,t),r.watch||onChange(`remove`,e))},async getMeta(e,t={}){typeof t==`boolean`&&(t={nativeOnly:t}),e=normalizeKey(e);let{relativeKey:n,driver:r}=getMount(e),i=Object.create(null);if(r.getMeta&&Object.assign(i,await asyncCall(r.getMeta,n,t)),!t.nativeOnly){let e=await asyncCall(r.getItem,n+`$`,t).then(e=>destr(e));e&&typeof e==`object`&&(typeof e.atime==`string`&&(e.atime=new Date(e.atime)),typeof e.mtime==`string`&&(e.mtime=new Date(e.mtime)),Object.assign(i,e))}return i},setMeta(e,t,n={}){return this.setItem(e+`$`,t,n)},removeMeta(e,t={}){return this.removeItem(e+`$`,t)},async getKeys(e,t={}){e=normalizeBaseKey(e);let n=getMounts(e,!0),r=[],i=[],a=!0;for(let e of n){e.driver.flags?.maxDepth||(a=!1);let n=await asyncCall(e.driver.getKeys,e.relativeBase,t);for(let t of n){let n=e.mountpoint+normalizeKey(t);r.some(e=>n.startsWith(e))||i.push(n)}r=[e.mountpoint,...r.filter(t=>!t.startsWith(e.mountpoint))]}let o=t.maxDepth!==void 0&&!a;return i.filter(n=>(!o||filterKeyByDepth(n,t.maxDepth))&&filterKeyByBase(n,e))},async clear(e,t={}){e=normalizeBaseKey(e),await Promise.all(getMounts(e,!1).map(async e=>{if(e.driver.clear)return asyncCall(e.driver.clear,e.relativeBase,t);if(e.driver.removeItem){let n=await e.driver.getKeys(e.relativeBase||``,t);return Promise.all(n.map(n=>e.driver.removeItem(n,t)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(e=>dispose(e)))},async watch(e){return await startWatch(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter(t=>t!==e),t.watchListeners.length===0&&await stopWatch()}},async unwatch(){t.watchListeners=[],await stopWatch()},mount(e,r){if(e=normalizeBaseKey(e),e&&t.mounts[e])throw Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort((e,t)=>t.length-e.length)),t.mounts[e]=r,t.watching&&Promise.resolve(watch(r,onChange,e)).then(n=>{t.unwatch[e]=n}).catch(console.error),n},async unmount(e,n=!0){e=normalizeBaseKey(e),!(!e||!t.mounts[e])&&(t.watching&&e in t.unwatch&&(t.unwatch[e]?.(),delete t.unwatch[e]),n&&await dispose(t.mounts[e]),t.mountpoints=t.mountpoints.filter(t=>t!==e),delete t.mounts[e])},getMount(e=``){e=normalizeKey(e)+`:`;let t=getMount(e);return{driver:t.driver,base:t.base}},getMounts(e=``,t={}){return e=normalizeKey(e),getMounts(e,t.parents).map(e=>({driver:e.driver,base:e.mountpoint}))},keys:(e,t={})=>n.getKeys(e,t),get:(e,t={})=>n.getItem(e,t),set:(e,t,r={})=>n.setItem(e,t,r),has:(e,t={})=>n.hasItem(e,t),del:(e,t={})=>n.removeItem(e,t),remove:(e,t={})=>n.removeItem(e,t)};return n}function watch(e,t,n){return e.watch?e.watch((e,r)=>t(e,n+r)):()=>{}}async function dispose(e){typeof e.dispose==`function`&&await asyncCall(e.dispose)}export{prefixStorage as n,createStorage as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as e,n as t,o as n,r,s as i,t as a}from"../rolldown-runtime.mjs";import{statSync as o}from"node:fs";import{stat as s}from"node:fs/promises";var c=r({isexe:()=>l,sync:()=>u}),l,u,d,checkMode,f=t((()=>{l=e(async(e,t={})=>{let{ignoreErrors:n=!1}=t;try{return d(await s(e),t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}},`isexe`),u=e((e,t={})=>{let{ignoreErrors:n=!1}=t;try{return d(o(e),t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}},`sync`),d=e((e,t)=>e.isFile()&&checkMode(e,t),`checkStat`),checkMode=(e,t)=>{let n=t.uid??process.getuid?.(),r=t.groups??process.getgroups?.()??[],i=t.gid??process.getgid?.()??r[0];if(n===void 0||i===void 0)throw Error(`cannot get uid or gid`);let a=new Set([i,...r]),o=e.mode,s=e.uid,c=e.gid;return!!(o&1||o&8&&a.has(c)||o&64&&s===n||o&72&&n===0)}})),p=r({isexe:()=>m,sync:()=>h}),m,h,checkPathExt,checkStat,g=t((()=>{m=e(async(e,t={})=>{let{ignoreErrors:n=!1}=t;try{return checkStat(await s(e),e,t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}},`isexe`),h=e((e,t={})=>{let{ignoreErrors:n=!1}=t;try{return checkStat(o(e),e,t)}catch(e){let t=e;if(n||t.code===`EACCES`)return!1;throw t}},`sync`),checkPathExt=(e,t)=>{let{pathExt:n=process.env.PATHEXT||``}=t,r=n.split(`;`);if(r.indexOf(``)!==-1)return!0;for(let t=0;t<r.length;t++){let n=r[t].toLowerCase(),i=e.substring(e.length-n.length).toLowerCase();if(n&&i===n)return!0}return!1},checkStat=(e,t,n)=>e.isFile()&&checkPathExt(t,n)})),_=t((()=>{})),v=r({isexe:()=>b,posix:()=>c,sync:()=>x,win32:()=>p}),y,b,x,S=t((()=>{f(),g(),_(),y=(process.env._ISEXE_TEST_PLATFORM_||process.platform)===`win32`?p:c,b=y.isexe,x=y.sync})),C=a(((e,t)=>{let{isexe:r,sync:a}=(S(),i(v)),{join:o,delimiter:s,sep:c,posix:l}=n(`node:path`),u=process.platform===`win32`,d=new RegExp(`[${l.sep}${c===l.sep?``:c}]`.replace(/(\\)/g,`\\$1`)),f=RegExp(`^\\.${d.source}`),getNotFoundError=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),getPathInfo=(e,{path:t=process.env.PATH,pathExt:n=process.env.PATHEXT,delimiter:r=s})=>{let i=e.match(d)?[``]:[...u?[process.cwd()]:[],...(t||``).split(r)];if(u){let t=n||[`.EXE`,`.CMD`,`.BAT`,`.COM`].join(r),a=t.split(r).flatMap(e=>[e,e.toLowerCase()]);return e.includes(`.`)&&a[0]!==``&&a.unshift(``),{pathEnv:i,pathExt:a,pathExtExe:t}}return{pathEnv:i,pathExt:[``]}},getPathPart=(e,t)=>{let n=/^".*"$/.test(e)?e.slice(1,-1):e;return(!n&&f.test(t)?t.slice(0,2):``)+o(n,t)},which=async(e,t={})=>{let{pathEnv:n,pathExt:i,pathExtExe:a}=getPathInfo(e,t),o=[];for(let s of n){let n=getPathPart(s,e);for(let e of i){let i=n+e;if(await r(i,{pathExt:a,ignoreErrors:!0})){if(!t.all)return i;o.push(i)}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw getNotFoundError(e)},whichSync=(e,t={})=>{let{pathEnv:n,pathExt:r,pathExtExe:i}=getPathInfo(e,t),o=[];for(let s of n){let n=getPathPart(s,e);for(let e of r){let r=n+e;if(a(r,{pathExt:i,ignoreErrors:!0})){if(!t.all)return r;o.push(r)}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw getNotFoundError(e)};t.exports=which,which.sync=whichSync}));export{C as t};
|