{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.2_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.8.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,cAAA,GAAA,KAAA,CAAA","file":"24WEKBY3.cjs","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"]}
{"version":3,"sources":["../src/branded.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAAAA,4BAAA,EAAA","file":"2SJJDCZI.cjs","sourcesContent":["const tag = '___tag___';\n/**\n * Creates a branded type of {@link T} with the brand {@link U}.\n *\n * @param T - Type to brand\n * @param U - Label\n * @returns Branded type\n *\n * @example\n * type Result = Branded<string, 'foo'>\n * // ^? type Result = string & { [symbol]: 'foo' }\n */\nexport type Branded<T, U> = T & { [tag]: U };\n/**\n * Represents a percentage as a decimal value. For example, 25% is represented as 0.25\n */\nexport type Percent = number; // Branded<number, 'percent'>\n\nexport type BrandedError<T extends string> = Branded<Error, T>;\n"]}
{"version":3,"sources":["../src/withRequired.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAEAA,4BAAA,EAAA","file":"4W25K7RR.cjs","sourcesContent":["export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };\n\nexport type AllRequired<T> = {\n [K in keyof T]-?: T[K];\n};\n"]}
{"version":3,"sources":["../src/constructor.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAAAA,4BAAA,EAAA","file":"53OHF4EH.cjs","sourcesContent":["export type Constructor<T> = { new (...args: any[]): T };\n"]}
{"version":3,"sources":["../src/maybeUndefined.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAAAA,4BAAA,EAAA","file":"7RPBI4LQ.cjs","sourcesContent":["/**\n * @description Maps the result type `R` to `R | undefined` when the input type `T` includes `undefined`,\n * preserving the undefined-ness of the input in the output type.\n *\n * @example\n * MaybeUndefinedMapped<string | undefined, number>\n * => number | undefined\n *\n * MaybeUndefinedMapped<string, number>\n * => number\n */\nexport type MaybeUndefinedMapped<T, R> = undefined extends T\n ? T extends undefined\n ? undefined\n : R | undefined\n : R;\n"]}
{"version":3,"sources":["../src/index.ts"],"names":["init_cjs_shims"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAAA,4BAAA,EAAA","file":"index.cjs","sourcesContent":["export * from './advancedRecord';\nexport * from './asyncify';\nexport * from './branded';\nexport * from './constructor';\nexport * from './deep';\nexport * from './disallowedAny';\nexport * from './identity';\nexport * from './lastOf';\nexport * from './maybeUndefined';\nexport * from './merge';\nexport * from './methodOf';\nexport * from './removeNever';\nexport * from './strings';\nexport * from './tuples';\nexport * from './valueOf';\nexport * from './viem';\nexport * from './withRequired';\n"]}
{"version":3,"sources":["../src/strings.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAyCAA,4BAAA,EAAA","file":"K3FZ3EZT.cjs","sourcesContent":["import type { Branded } from './branded';\n\n/**\n * Guarantees that a string does not end with a suffix.\n * You can remove multiple suffixes by using a union.\n *\n * @example\n * type A = StringWithoutSuffix<'hello', 'world'>; // 'hello'\n * type B = StringWithoutSuffix<'hello', 'lo'>; // never\n * type C = StringWithoutSuffix<'hello world', 'lo' | 'world'>; // never\n */\nexport type StringWithoutSuffix<\n T extends string,\n Suffix extends string,\n> = T extends `${infer _}${Suffix}` ? never : T;\n\nexport type HexString = `0x${string}`;\n\nexport declare const _NormalizedHexString: unique symbol;\n\nexport type NormalizedHexString = Branded<typeof _NormalizedHexString, 'NormalizedHexString'>;\n\n/**\n * Guarantees that a hex string is trimmed.\n *\n * @example\n * type A = HexStringIsTrimmed<'0x0'>; // true\n * type B = HexStringIsTrimmed<'0x00'>; // false\n * type C = HexStringIsTrimmed<'0x'>; // false\n * type D = HexStringIsTrimmed<'0x100'>; // true\n */\nexport type HexStringIsTrimmed<T extends HexString> = T extends '0x0'\n ? true\n : T extends '0x'\n ? false\n : T extends `0x0${string}`\n ? false\n : true;\n\nexport declare const _NumberString: unique symbol;\n\nexport type DecimalString = Branded<typeof _NumberString, 'DecimalString'>;\n"]}
{"version":3,"sources":["../src/tuples.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAsDAA,4BAAA,EAAA","file":"KQUDWU4T.cjs","sourcesContent":["import type { BrandedError } from './branded';\n\n//check that the tuple T uses every type in the union K at least once\nexport type IsComplete<\n T extends readonly (string | number | symbol)[],\n K extends string | number | symbol,\n> = Exclude<K, T[number]> extends never ? true : false;\n\nexport type TryGetDuplicate<\n T extends readonly (string | number | symbol)[],\n Seen extends (string | number | symbol)[] = [],\n> = T extends [infer Head, ...infer Tail]\n ? Head extends Seen[number]\n ? Head\n : Head extends string | number | symbol\n ? Tail extends readonly (string | number | symbol)[]\n ? TryGetDuplicate<Tail, [...Seen, Head]>\n : false\n : false\n : false;\n\n//check that the tuple T is a valid ordering of AllKeys, using IsComplete and TryGetDuplicate\n//returns a branded error if there are missing keys or duplicates\nexport type AssertUniqueCompleteSet<\n T extends readonly (string | number | symbol)[],\n AllKeys extends string | number | symbol,\n> =\n IsComplete<T, AllKeys> extends false\n ? BrandedError<`Missing key: ${Exclude<AllKeys extends Symbol ? 'ERR' : AllKeys, T[number]>}`>\n : TryGetDuplicate<T> extends false\n ? T\n : BrandedError<`Duplicate key found: ${TryGetDuplicate<T>}`>;\n\ntype BuildTupleHelper<\n Element,\n Length extends number,\n Rest extends Element[],\n> = Rest['length'] extends Length\n ? readonly [...Rest] // Terminate with readonly array (aka tuple)\n : BuildTupleHelper<Element, Length, [Element, ...Rest]>;\n\nexport type BuildTuple<Element, Length extends number> = number extends Length\n ? // Because `Length extends number` and `number extends Length`, then `Length` is not a specific finite number.\n readonly Element[] // It's not fixed length.\n : BuildTupleHelper<Element, Length, []>; // Otherwise it is a fixed length tuple.\n\nexport type TuplesToObject<T extends readonly (readonly [PropertyKey, any])[]> = {\n [K in T[number] as K[0]]: K[1];\n};\n\nexport type TuplePrefixUnion<T extends any[]> =\n | []\n | (Required<T> extends [...infer Init, any] ? Required<T> | TuplePrefixUnion<Init> : never);\n\nexport type SubtractTuple<Minuend extends any[], Subtrahend extends any[]> = Subtrahend extends [\n any,\n ...infer S,\n]\n ? Minuend extends [any, ...infer M]\n ? // keep subtracting\n SubtractTuple<M, S>\n : // subtrahend has a cardinality less than minuend\n never\n : // we fully subtracted already\n Minuend;\n"]}
{"version":3,"sources":["../src/deep.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAEAA,4BAAA,EAAA","file":"MLSONTXK.cjs","sourcesContent":["import type { Prettify } from './viem';\n\n/**\n * Copy the brand tag from the branded.ts file, can't import it to keep it hidden from library users\n */\nconst brandTag = '___tag___';\n\nexport type DeepRequire<T> = {\n [P in keyof T]-?: DeepRequire<T[P]>;\n};\n\nexport type DeepOptional<T> = T extends { [brandTag]: infer V }\n ? Prettify<\n { [brandTag]: V } & {\n [P in keyof T]?: DeepOptional<T[P]>;\n }\n >\n : {\n [P in keyof T]?: DeepOptional<T[P]>;\n };\n\nexport type DeepUnion<T, U> =\n | {\n [P in keyof T]: DeepUnion<T[P], U>;\n }\n | U;\n"]}
{"version":3,"sources":["../src/removeNever.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAAAA,4BAAA,EAAA","file":"Q35ZNXMT.cjs","sourcesContent":["export type RemoveNever<T> = {\n [K in keyof T as T[K] extends never ? never : K]: T[K];\n};\n"]}
{"version":3,"sources":["../src/strings.test-d.ts"],"names":["init_cjs_shims","test","expectTypeOf","toBeString","toBeNever","toExtend"],"mappings":";;;;;;AAAAA,4BAAA,EAAA;AAIAC,iBAAAA,CAAK,uBAAuB,MAAA;AAExBC,EAAAA,IAAAA,+BAAAA,CAAAA,YAAAA,IAAkBC,UAAAA,EAAU;AAG5BD,EAAAA,IAAAA,+BAAAA,CAAAA,YAAAA,IAAkBE,SAAAA,EAAS;AAI3BF,EAAAA,IAAAA,+BAAAA,CAAAA,YAAAA,IAAkBE,SAAAA,EAAS;AAG3BF,EAAAA,IAAAA,+BAAAA,CAAAA,YAAAA,IAAkBE,SAAAA,EAAS;AAG3BF,EAAAA,IAAAA,+BAAAA,CAAAA,YAAAA,IAAkBC,UAAAA,EAAU;AAChC,CAAA,CAAA;AAEAF,iBAAAA,CAAK,sBAAsB,MAAA;AAEvBC,EAAAA,IAAAA,+BAAAA,CAAAA,YAAAA,IAAkBG,QAAAA,EAAQ;AAG1BH,EAAAA,IAAAA,+BAAAA,CAAAA,YAAAA,IAAkBG,QAAAA,EAAQ;AAG1BH,EAAAA,IAAAA,+BAAAA,CAAAA,YAAAA,IAAkBG,QAAAA,EAAQ;AAC9B,CAAA,CAAA","file":"strings.test-d.cjs","sourcesContent":["import { expectTypeOf, test } from 'vitest';\n\nimport type { HexStringIsTrimmed, StringWithoutSuffix } from './strings';\n\ntest('StringWithoutSuffix', () => {\n type A = StringWithoutSuffix<'hello', 'world'>;\n expectTypeOf<A>().toBeString();\n\n type B = StringWithoutSuffix<'hello', 'lo'>;\n expectTypeOf<B>().toBeNever();\n\n // Multiple suffixes test:\n type C = StringWithoutSuffix<'hello', 'lo' | 'world'>;\n expectTypeOf<C>().toBeNever();\n\n type D = StringWithoutSuffix<'hello world', 'lo' | 'world'>;\n expectTypeOf<D>().toBeNever();\n\n type E = StringWithoutSuffix<'hello world!', 'lo' | 'world'>;\n expectTypeOf<E>().toBeString();\n});\n\ntest('HexStringIsTrimmed', () => {\n type A = HexStringIsTrimmed<'0x0'>;\n expectTypeOf<A>().toExtend<true>();\n\n type B = HexStringIsTrimmed<'0x00'>;\n expectTypeOf<B>().toExtend<false>();\n\n type C = HexStringIsTrimmed<'0x'>;\n expectTypeOf<C>().toExtend<false>();\n});\n"]}
{"version":3,"sources":["../src/identity.ts"],"names":["init_cjs_shims"],"mappings":";;;;;AAAAA,4BAAA,EAAA","file":"TVCGTTL5.cjs","sourcesContent":["// Wraps types and property access with 1-arity which enables creating interfaces\nexport type Identity<T> = T;\n"]}