{"version":3,"file":"builder-D7bF91nc.cjs","names":["identity","isTypeOfString","XMLParser","XMLBuilder","isTruthy","True","cases","False","True","identity","z","toArray","identity","z","fallback","identity","namesPlugin","cases","P","isTypeOfFunction","identity"],"sources":["../../internal/src/hash.ts","../../internal/src/intl.ts","../../internal/src/log.ts","../../internal/src/params.ts","../../colors/dist/index.mjs","../../internal/src/errors.ts","../../internal/src/tasks.ts","../src/core/cleanup.ts","../src/core/shared.ts","../src/core/parser.ts","../src/core/collector.ts","../src/core/inlining.ts","../../internal/src/zod.ts","../src/core/metadata.ts","../../internal/src/svgo.ts","../src/core/optimizer.ts","../src/core/reset-colors.ts","../src/core/builder.ts"],"sourcesContent":["import { isTypeOfString } from '@neodx/std';\nimport { type BinaryLike, createHash } from 'node:crypto';\nimport hashObject from 'object-hash';\n\nexport const hashContent = (content: BinaryLike) =>\n  createHash('sha256').update(content).digest('hex');\nexport const hashUnknown = (value: unknown) => {\n  if (Buffer.isBuffer(value)) {\n    return hashContent(new Uint8Array(value));\n  }\n  if (isTypeOfString(value)) {\n    return hashContent(value);\n  }\n  return hashObject(value ?? '');\n};\n\nexport const printHash = (pattern: string, hash: string, name = 'hash') =>\n  pattern\n    .replace(new RegExp(`\\\\{${name}:(\\\\d)}`, 'g'), (_, length) => hash.slice(0, Number(length)))\n    .replace(`{${name}}`, hash);\n\nexport const shortHash = (value: unknown) => hashUnknown(value).slice(0, 8);\n","import type { SetOptional } from 'type-fest';\n\ntype OptionalRules = keyof typeof similarPlurals;\ntype Forms = SetOptional<Record<Intl.LDMLPluralRule, string>, OptionalRules>;\n\nconst rules = new Intl.PluralRules();\nconst similarPlurals = {\n  two: 'few',\n  few: 'many',\n  many: 'other',\n  zero: 'other'\n} satisfies Partial<Record<Intl.LDMLPluralRule, Intl.LDMLPluralRule>>;\nconst getPluralForm = (current: Intl.LDMLPluralRule, forms: Forms): string =>\n  forms[current] ?? getPluralForm(similarPlurals[current as OptionalRules], forms);\n\nexport const plural = (\n  n: number,\n  forms: SetOptional<Record<Intl.LDMLPluralRule, string>, OptionalRules>\n) => getPluralForm(rules.select(n), forms).replace('%d', n.toString());\n\nconst sortingCollator = new Intl.Collator('en');\n\nexport const compare = {\n  by:\n    <T>(fn: (value: T) => string, compareFn: (a: string, b: string) => number) =>\n    (a: T, b: T) =>\n      compareFn(fn(a), fn(b)),\n  locale: sortingCollator.compare.bind(sortingCollator)\n};\n","import { compact, type Falsy } from '@neodx/std';\n\nexport const timeDisplay = () => {\n  const start = Date.now();\n\n  return () => formatTimeMs(Date.now() - start);\n};\n\nexport const formatTimeMs = (time: number) => {\n  const showSeconds = time >= 100;\n  const timeValue = showSeconds ? time / 1000 : time;\n\n  return timeValue\n    .toLocaleString('en', {\n      style: 'unit',\n      unit: showSeconds ? 'second' : 'millisecond',\n      unitDisplay: 'narrow'\n    })\n    .padEnd(showSeconds ? 6 : 4);\n};\n\nexport const formatList = (list: Array<string | Falsy>, max = 4) => {\n  const visible = compact(list);\n  const extra = visible.slice(max).length;\n\n  return visible.length > 0\n    ? listFormatter.format(extra ? visible.slice(0, max - 1).concat(`${extra} more`) : visible)\n    : 'none';\n};\n\nconst listFormatter = new Intl.ListFormat('en', {\n  style: 'short',\n  type: 'unit'\n});\n","import { isTypeOfFunction } from '@neodx/std';\nimport type { AnyFn } from '@neodx/std/shared';\n\nexport type CallableParam<Fn extends AnyFn> = Fn | boolean | null;\n\nexport function callable<Fn extends AnyFn>(\n  value: Fn | boolean | null,\n  positive: Fn,\n  negative?: false | null\n): Fn | null;\nexport function callable<Fn extends AnyFn>(\n  value: Fn | boolean | null,\n  positive: Fn,\n  negative: Fn\n): Fn;\n/**\n * Simple shortcut for defining \"option: true | false | null | <implementation>\" semantics\n *\n * @example Usage\n * async function doSomething({ optimize = true }: { optimize: CallableParam<(content: string) => string> }) {\n *   const originalContent = await getContent();\n *   const getOptimized = callable(\n *     optimize,\n *     content => optimize(content), // return optimized content if optimize is enabled\n *     content => content // just return original content otherwise\n *   );\n *\n *   console.log(getOptimized(originalContent));\n * }\n *\n * doSomething(); // optimized (default)\n * doSomething({ optimize: null }); // original\n * doSomething({ optimize: false }); // original\n * doSomething({ optimize: content => customOptimize(content) }); // custom optimized\n */\nexport function callable<Fn extends AnyFn>(\n  value: Fn | boolean | null,\n  positive: Fn,\n  negative: Fn | false | null = null\n) {\n  if (!(value ||= negative)) return null;\n  return isTypeOfFunction(value) ? value : positive;\n}\n","import { entries, identity } from \"@neodx/std\";\n//#region src/create-colors.ts\nfunction createColors(isTTY = false, disabled = false, force = false) {\n\tconst enabled = force || !disabled && typeof process !== \"undefined\" && !(\"NO_COLOR\" in process.env || process.argv.includes(\"--no-color\")) && !(\"GITHUB_ACTIONS\" in process.env) && (\"FORCE_COLOR\" in process.env || process.argv.includes(\"--color\") || process.platform === \"win32\" || isTTY && process.env.TERM !== \"dumb\" || \"CI\" in process.env);\n\treturn Object.fromEntries(colorsEntries.map(([color]) => [color, enabled ? formatters[color] : identity]));\n}\nconst colorsEntries = entries({\n\treset: [0, 0],\n\tbold: [1, 22],\n\tdim: [2, 22],\n\titalic: [3, 23],\n\toverline: [53, 55],\n\tunderline: [4, 24],\n\tinverse: [7, 27],\n\thidden: [8, 28],\n\tstrikethrough: [9, 29],\n\tblack: [30, 39],\n\tred: [31, 39],\n\tgreen: [32, 39],\n\tyellow: [33, 39],\n\tblue: [34, 39],\n\tmagenta: [35, 39],\n\tcyan: [36, 39],\n\twhite: [37, 39],\n\tgray: [90, 39],\n\tredBright: [91, 39],\n\tgreenBright: [92, 39],\n\tyellowBright: [93, 39],\n\tblueBright: [94, 39],\n\tmagentaBright: [95, 39],\n\tcyanBright: [96, 39],\n\twhiteBright: [97, 39],\n\tbgBlack: [40, 49],\n\tbgRed: [41, 49],\n\tbgGreen: [42, 49],\n\tbgYellow: [43, 49],\n\tbgBlue: [44, 49],\n\tbgMagenta: [45, 49],\n\tbgCyan: [46, 49],\n\tbgWhite: [47, 49]\n});\nconst formatters = Object.fromEntries(colorsEntries.map(([key, [openCode, closeCode]]) => {\n\tconst rgx = new RegExp(`\\\\x1b\\\\[${closeCode}m`, \"g\");\n\tconst open = `\\u001B[${openCode}m`;\n\tconst close = `\\u001B[${closeCode}m`;\n\treturn [key, (message) => open + (!message.includes(close) ? message.replace(rgx, close + open) : message) + close];\n}));\n//#endregion\n//#region src/index.ts\nconst colors = createColors(true);\n//#endregion\nexport { colors, createColors };\n\n//# sourceMappingURL=index.mjs.map","import { isTypeOfString } from '@neodx/std';\nimport { redefineName } from '@neodx/std/shared';\n\nexport const linkError = (error: unknown, cause?: unknown) =>\n  isTypeOfString(error) ? new Error(error, { cause }) : (error ?? cause);\n\nexport const createErrorType = <Name extends string>(name: Name) => {\n  const ErrorType = class extends Error {\n    static child = <ChildName extends string>(childName: ChildName) =>\n      createErrorType<`${Name}.${ChildName}`>(`${name}.${childName}`);\n\n    constructor(message: string, options?: ErrorOptions) {\n      super(message, options);\n      this.name = name;\n    }\n  };\n\n  redefineName(ErrorType, name);\n  return ErrorType;\n};\n","import { colors } from '@neodx/colors';\nimport { type Logger } from '@neodx/log';\nimport { type Falsy, invariant, isTypeOfFunction } from '@neodx/std';\nimport { redefineName } from '@neodx/std/shared';\nimport { linkError } from './errors.ts';\nimport { timeDisplay } from './log.ts';\n\ntype EnabledTaskInvariant<Args extends readonly unknown[], Result> =\n  | string\n  | ((result: Result, ...args: Args) => string);\ntype DisabledTaskInvariant = false | void;\n\nexport function createTaskRunner({ log }: { log?: Logger<'error' | 'debug'> } = {}) {\n  return {\n    task: <\n      const Args extends readonly unknown[],\n      Result,\n      Invariant extends EnabledTaskInvariant<Args, Result> | DisabledTaskInvariant = false\n    >(\n      name: string,\n      handler: (...args: Args) => Result | Promise<Result>,\n      {\n        mapError,\n        invariant: invariantMessage,\n        mapSuccessMessage\n      }: {\n        mapSuccessMessage?: NoInfer<(result: Result, ...args: Args) => string>;\n        invariant?: Invariant;\n        mapError?: NoInfer<(cause: unknown, ...args: Args) => string | Error>;\n      } = {}\n    ) => {\n      async function task(\n        ...args: Args\n      ): Promise<Invariant extends DisabledTaskInvariant ? Result : Exclude<Result, Falsy>> {\n        const printAllTime = timeDisplay();\n\n        try {\n          const result = await handler(...args);\n\n          if (mapSuccessMessage) {\n            log?.debug(\n              `${colors.gray(`[${name}] ${printAllTime()}`)} ${mapSuccessMessage(result, ...args)}`\n            );\n          }\n          if (invariantMessage) {\n            invariant(\n              result,\n              isTypeOfFunction(invariantMessage)\n                ? invariantMessage(result, ...args)\n                : invariantMessage\n            );\n          }\n          return result as any;\n        } catch (error) {\n          // eslint-disable-next-line no-ex-assign\n          error = linkError(mapError?.(error, ...args), error);\n          log?.error(error);\n          throw error;\n        }\n      }\n\n      redefineName(task, name);\n      return Object.assign(task, createTaskRunner({ log }));\n    }\n  };\n}\n","import { plural } from '@neodx/internal/intl';\nimport { formatList } from '@neodx/internal/log';\nimport { createTaskRunner } from '@neodx/internal/tasks';\nimport { concurrently, invariant, once, prop } from '@neodx/std';\nimport type { Vfs } from '@neodx/vfs';\nimport type { SpritesMetadata } from './metadata.ts';\nimport type { SpriteAsset, SvgLogger } from './shared.ts';\n\nexport type SpritesCleanupType = 'force' | 'auto';\n\nexport const createSpritesCleanup = ({\n  log,\n  vfs,\n  outputVfs,\n  cleanupType,\n  metadata\n}: {\n  log: SvgLogger;\n  vfs: Vfs;\n  outputVfs: Vfs;\n  metadata: SpritesMetadata | null;\n  cleanupType: SpritesCleanupType | false;\n}) => {\n  if (!cleanupType) return null;\n  let current = [] as string[];\n\n  const { task } = createTaskRunner({ log });\n\n  return {\n    current: () => [...current.values()],\n    preload: once(\n      task('preload', async (): Promise<void> => {\n        // We don't need to preload anything if we're dropping output dir\n        if (cleanupType === 'force') return;\n        if (!metadata) {\n          // TODO Write documentation about cleanup\n          log.error(\n            `For automatic cleanup you need to provide \"metadata\" option because we use it to determine which sprites are outdated.\nPlease, provide following options:\n\nsvg({\n  // ...\n  metadata: 'path/to/metadata.ts'\n});\n\nYou can read more about metadata in https://neodx.pages.dev/svg/metadata.html\n`\n          );\n          return;\n        }\n        try {\n          const { name, path } = metadata.params;\n\n          if (!(await vfs.isFile(path))) {\n            log.info(`Cleanup is disabled because metadata file doesn't exist`);\n            return;\n          }\n          const require = (await import('jiti')).default(vfs.resolve(path));\n          const { [name]: { all } = {} as any } = require(vfs.resolve(path)) ?? {};\n\n          invariant(all, `Metadata file doesn't export \"${name}\" symbol`);\n          invariant(Array.isArray(all), 'Metadata file exports invalid \"all\" property');\n\n          // TODO Add simple schema for metadata\n          current = all.flatMap((it: any) => getAssetsFileNames(it.assets.map(prop('meta'))));\n          log.info(\n            `Loaded %s from previous build: %s`,\n            plural(current.length, { one: '%d asset', other: '%d assets' }),\n            formatList(current)\n          );\n        } catch (error) {\n          log.error(error, `Failed to read metadata file`);\n        }\n      })\n    ),\n    actualize: task(\n      'cleanup',\n      async (assets: SpriteAsset[]) => {\n        if (cleanupType === 'force') {\n          await concurrently(await outputVfs.glob('**/*'), outputVfs.delete);\n        }\n        if (cleanupType === 'auto') {\n          const actualFileNames = getAssetsFileNames(assets);\n\n          await concurrently(\n            current.filter(sprite => !actualFileNames.includes(sprite)),\n            outputVfs.delete\n          );\n          // eslint-disable-next-line require-atomic-updates\n          current = actualFileNames;\n        }\n      },\n      {\n        mapSuccessMessage: (_, actual) =>\n          `cleaned up ${plural(actual.length, { one: '%d sprite', other: '%d sprites' })}`\n      }\n    )\n  };\n};\n\nconst getAssetsFileNames = (assets: SpriteAsset[]) =>\n  assets\n    .filter(asset => asset.type !== 'inject')\n    .map(asset => (asset as Exclude<SpriteAsset, { type: 'inject' }>).fileName);\n","import type { Logger } from '@neodx/log';\nimport {\n  entries,\n  groupBy,\n  invariant,\n  isEmpty,\n  isTypeOfString,\n  keys,\n  mapValues,\n  not\n} from '@neodx/std';\nimport { dropValue } from '@neodx/std/array';\nimport type { VfsLogMethod } from '@neodx/vfs';\nimport { type ParsedSvgNode } from './parser.ts';\n\nexport const parseViewBox = (viewBox: string) =>\n  viewBox.split(' ').slice(2).map(Number.parseFloat) as [width: number, height: number] | [];\n\nexport const getSvgSizeProps = ({ props }: ParsedSvgNode) => {\n  const [viewBoxWidth, viewBoxHeight] = parseViewBox(props.viewBox ?? '');\n  const width = props.width ? Number.parseFloat(props.width) : viewBoxWidth;\n  const height = props.height ? Number.parseFloat(props.height) : viewBoxHeight;\n  const viewBox = props.viewBox ?? `0 0 ${width} ${height}`;\n\n  invariant(width && height && viewBox, 'invalid svg props - width, height or viewBox is missing');\n  return {\n    width: width!,\n    height: height!,\n    viewBox\n  };\n};\n\nexport const defineSymbolMeta = (\n  name: string,\n  path: string,\n  source: string,\n  node: ParsedSvgNode\n) => {\n  const symbol = {\n    name,\n    path,\n    node,\n    /** The original SVG source */\n    source,\n    inlined: false,\n    /** @internal */\n    __: {\n      id: name,\n      sync: () => {\n        Object.assign(symbol.__, calcNodeInternals(symbol.node));\n      },\n      ...calcNodeInternals(node)\n    }\n  };\n\n  return symbol;\n};\n\nexport const defineSpriteMeta = (name: string, symbols: SymbolMeta[]) => ({\n  /**\n   * Name of the sprite.\n   * @example \"common\"\n   */\n  name,\n  assets: [\n    {\n      type: 'external',\n      symbols,\n      fileName: `${name}.svg`\n    }\n  ] as SpriteAsset[]\n});\n\nexport const compactSprites = (sprites: SpriteMeta[]) => sprites.filter(compactSprite);\nexport const compactSprite = (sprite: SpriteMeta) =>\n  isEmpty((sprite.assets = sprite.assets.filter(it => !isEmpty(it.symbols)))) ? null : sprite;\nexport const getExternalAsset = (sprite: SpriteMeta) =>\n  sprite.assets.find(it => it.type === 'external') as ExternalFileSpriteChunk;\nexport const getAllSymbols = (sprite: SpriteMeta) => sprite.assets.flatMap(it => it.symbols);\n\nexport const checkNode = (node: ParsedSvgNode) => {\n  if (node.parent) {\n    invariant(\n      node.parent.children.includes(node),\n      `node \"${node.name}\" is not a child of \"${node.parent.name}\"`\n    );\n  }\n  node.children.forEach(child => !isTypeOfString(child) && checkNode(child));\n};\nexport const replaceNodeParent = (node: ParsedSvgNode, parent?: ParsedSvgNode) => {\n  if (parent === node.parent) return;\n  checkNode(node);\n  if (node.parent) dropValue(node.parent.children, node);\n  node.parent = parent;\n  parent?.children.push(node);\n};\nexport const getChildNodes = (node?: ParsedSvgNode) =>\n  node?.children.filter(not(isTypeOfString)) ?? [];\n\nconst calcNodeInternals = (node: ParsedSvgNode) => {\n  const allNodes = flattenNode(node);\n  const nodeById = mapValues(\n    groupBy(allNodes, it => it.props.id),\n    (it, id) => {\n      invariant(it.length === 1, `duplicate id \"${id}\"`);\n      return it[0]!;\n    }\n  );\n  const references = groupBy(allNodes.flatMap(extractReferences(keys(nodeById))), 'id');\n\n  return {\n    allNodes,\n    nodeById,\n    references\n  };\n};\nconst extractReferences = (ids: string[]) => (node: ParsedSvgNode) =>\n  entries(node.props).flatMap(([prop, value]) =>\n    ids\n      .filter(id =>\n        value.match(\n          // we want to be sure that we're not matching substrings\n          new RegExp(`#${id}\\\\b`, 'ig')\n        )\n      )\n      .map(id => ({ value, prop, node, id }))\n  );\n\nconst flattenNode = (node: ParsedSvgNode): ParsedSvgNode[] => [\n  node,\n  ...getChildNodes(node).flatMap(flattenNode)\n];\n\nexport type SymbolMeta = ReturnType<typeof defineSymbolMeta>;\nexport type SpriteMeta = ReturnType<typeof defineSpriteMeta>;\n// We're expecting a logger compatible with `@neodx/vfs` to be passed to the builder\nexport type SvgLogger = Logger<VfsLogMethod>;\n\ninterface BaseSpriteAsset {\n  /**\n   * Optional name of the asset.\n   * If omitted, the name will be generated from the sprite name.\n   */\n  assetName?: string;\n  /**\n   * Symbols in the asset.\n   * The single sprite can hold multiple assets, so we need to track and distinguish them.\n   */\n  symbols: SymbolMeta[];\n  additionalChildren?: ParsedSvgNode[];\n}\n\n/**\n * The asset will be saved as a file and used as a regular external SVG sprite (`<use href=\"/file.svg#symbol-name\" />`).\n */\nexport interface ExternalFileSpriteChunk extends BaseSpriteAsset {\n  type: 'external';\n  /**\n   * Name of the SVG file that will be referenced.\n   * Will be actualized before writing to the disk.\n   * @example \"common.2eb4b56f.svg\"\n   */\n  fileName: string;\n}\n\n/**\n * The asset content will be injected into the document for global usage (`<symbol id=\"symbol-name\" />`).\n */\nexport interface InlinedSpriteAsset extends BaseSpriteAsset {\n  type: 'inject';\n  /**\n   * Inlined SVG content.\n   */\n  content: string;\n}\n\n/**\n * Same as `inject`, but the sprite content will be saved as a file and then fetched from the server and injected into the document.\n */\nexport interface ExtractedSpriteAsset extends BaseSpriteAsset {\n  type: 'fetch-and-inject';\n  /**\n   * Name of the SVG file that will be loaded and inlined.\n   * Will be actualized before writing to the disk.\n   * @example \"inlined-common.2eb4b56f.svg\"\n   */\n  fileName: string;\n}\n\nexport type SpriteAsset = ExternalFileSpriteChunk | InlinedSpriteAsset | ExtractedSpriteAsset;\n","import { entries, filterObject, invariant, isTruthy, isTypeOfString, toArray } from '@neodx/std';\nimport { XMLBuilder, XMLParser } from 'fast-xml-parser';\nimport { checkNode, type SpriteAsset } from './shared.ts';\n\nconst parser = new XMLParser({\n  ignoreAttributes: false,\n  ignoreDeclaration: true,\n  allowBooleanAttributes: true,\n  attributesGroupName: '@props',\n  attributeNamePrefix: '',\n  textNodeName: '@text',\n  // transformAttributeName: cases.camel,\n  htmlEntities: true,\n  processEntities: false\n});\nconst builder = new XMLBuilder({\n  attributeNamePrefix: '',\n  attributesGroupName: 'props',\n  textNodeName: '@text'\n});\n\nexport const formatSvgAsset = ({ symbols, additionalChildren = [] }: SpriteAsset) =>\n  formatSvg({\n    name: 'svg',\n    props: { width: '0', height: '0' },\n    children: additionalChildren.concat(\n      symbols.map(symbol => ({\n        ...symbol.node,\n        props: {\n          ...symbol.node.props,\n          id: symbol.__.id\n        },\n        name: 'symbol'\n      }))\n    )\n  });\n\n/** Formats SVG node to a string */\nexport const formatSvg = (node: ParsedSvgNode): string =>\n  builder.build({\n    [node.name]: toFastXml(node)\n  });\n\nexport const parseSvg = (input: string) => {\n  const [parsed, ...rest] = injectFastXml(parser.parse(input), createNode('root'));\n\n  invariant(parsed, 'nothing to parse');\n  invariant(rest.length === 0, 'multiple root nodes');\n  invariant(parsed.name === 'svg', 'root node is not svg');\n  invariant(parsed.children.length, 'no children');\n  checkNode(parsed);\n\n  return parsed;\n};\n\n/**\n * Converts parsed SVG node to fast-xml-parser compatible format\n */\nconst toFastXml = (node: ParsedSvgNode) => {\n  const result = {\n    props: node.props\n  } as Record<string, any>;\n\n  node.children.forEach(child => {\n    if (isTypeOfString(child)) result['@text'] = child;\n    else (result[child.name] ??= []).push(toFastXml(child));\n  });\n\n  return result;\n};\n\n// fast-xml-parser merges attributes and children, so we need to separate them and build a tree\nconst injectFastXml = (node: Record<string, any>, parent: ParsedSvgNode) =>\n  entries(node)\n    .flatMap(([key, value]) => {\n      if (key === '@text') {\n        parent.children.push(value);\n        return null;\n      }\n      if (key === '@props') {\n        parent.props = filterObject(value, (_, key) => !key.match(/data-|aria-/));\n        return null;\n      }\n      return toArray(value).map(child => {\n        const node = createNode(key, parent);\n\n        if (isTypeOfString(child)) node.children.push(child);\n        else injectFastXml(child, node);\n        return node;\n      });\n    })\n    .filter(isTruthy);\nconst createNode = (name: string, parent?: ParsedSvgNode): ParsedSvgNode => {\n  const node = {\n    name,\n    props: {},\n    parent,\n    children: []\n  };\n\n  if (parent) parent.children.push(node);\n  return node;\n};\n\nexport interface ParsedSvgNode {\n  name: string;\n  props: Record<string, string>;\n  parent?: ParsedSvgNode;\n  children: Array<ParsedSvgNode | string>;\n}\n","import type { WalkIgnoreInput } from '@neodx/glob';\nimport { plural } from '@neodx/internal/intl';\nimport { createTaskRunner } from '@neodx/internal/tasks';\nimport type { Logger } from '@neodx/log';\nimport { type Awaitable, cases, concurrently, toArray, True } from '@neodx/std';\nimport { setMapValue } from '@neodx/std/shared';\nimport { type Vfs, type VfsLogMethod } from '@neodx/vfs';\nimport type { GlobVfsParams } from '@neodx/vfs/plugins/glob';\nimport { basename } from 'pathe';\nimport type { SvgOptimizer } from './optimizer.ts';\nimport { parseSvg } from './parser.ts';\nimport type { SvgResetColors } from './reset-colors.ts';\nimport { defineSymbolMeta, type SymbolMeta } from './shared.ts';\n\nexport interface SvgCollectorParams {\n  /**\n   * Logger instance\n   * @see `@neodx/log`\n   */\n  log: Logger<VfsLogMethod>;\n  /**\n   * VFS instance\n   * @see `@neodx/vfs`\n   */\n  vfs: Vfs;\n  /**\n   * Filter unwanted files by their path\n   * @param path\n   */\n  filter?: (path: string) => Awaitable<boolean>;\n  /**\n   * @default path => cases.kebab(basename(path, '.svg'))\n   */\n  getName?: (path: string) => string;\n  optimizer: SvgOptimizer;\n  resetColors: SvgResetColors;\n  ignore?: WalkIgnoreInput;\n}\n\nexport type SvgCollector = ReturnType<typeof createSvgCollector>;\n\n/**\n * Abstraction for collecting SVG files.\n * Should be used in conjunction with `createSvgBuilder`.\n * @example\n * const collector = createSvgCollector({ vfs, log });\n * const builder = createSvgBuilder({ vfs, log, collector });\n *\n * await collector.load('**\\/*.svg');\n * await builder.build();\n */\nexport function createSvgCollector({\n  vfs,\n  log,\n  optimizer,\n  resetColors,\n  filter = True,\n  getName = getDefaultName,\n  ignore\n}: SvgCollectorParams) {\n  const symbols = new Map<string, SymbolMeta>();\n  const { task } = createTaskRunner({ log });\n\n  const add = task('add', async (path: string) => {\n    if (!(await filter(path))) return;\n    const name = getName(path);\n    const content = optimizer.symbol(await vfs.read(path, 'utf-8'));\n    // prevent unnecessary parsing and invalidating references to the unchanged file\n    if (symbols.has(path) && symbols.get(path)!.source === content) return;\n    return setMapValue(\n      symbols,\n      path,\n      defineSymbolMeta(name, path, content, resetColors.apply(path, parseSvg(content)))\n    );\n  });\n  const addMany = task('add many', async (paths: string[]) => await concurrently(paths, add), {\n    mapSuccessMessage: (_, paths) =>\n      `added ${plural(paths.length, { one: '%d file', other: '%d files' })}`\n  });\n\n  return {\n    /**\n     * Returns all the files in the current directory.\n     */\n    getAll() {\n      if (symbols.size === 0) {\n        log.error(\n          `\nProbably, you've started building sprites before the first file was added or you have defined wrong source path.\n\nPlease, check the following:\n\n- You've added at least one .svg file to the source path\n- You've defined the correct source path (currently it's \"${vfs.path}\")\n- If you've defined the \"inputRoot\" option, you've added at least one file to it\n\nIf you've done all of the above, please, open an issue at https://github.com/secundant/neodx/issues/new\n        `.trim()\n        );\n      }\n      return [...symbols.values()].sort((a, b) => a.path.localeCompare(b.path));\n    },\n    /**\n     * Adds new source svg files.\n     * Could be used for adding new files or updating existing ones.\n     */\n    add,\n    addMany,\n    /**\n     * Add source files by glob pattern(s)\n     * @see `@neodx/vfs`: `glob` method\n     */\n    load: task('load', async (patterns: string | string[], params?: GlobVfsParams) => {\n      log.debug('Loading %s...', patterns);\n      return await addMany(\n        await vfs.glob(patterns, {\n          ignore,\n          ...params\n        })\n      );\n    }),\n    /**\n     * Removes previously added files\n     */\n    remove(paths: string | string[]) {\n      toArray(paths)\n        .filter(path => symbols.has(path))\n        .forEach(path => symbols.delete(path));\n    },\n    /**\n     * Clears all stored files\n     */\n    clear: () => symbols.clear(),\n    __: {\n      vfs,\n      log\n    }\n  };\n}\n\nconst getDefaultName = (path: string) => cases.kebab(basename(path, '.svg'));\n","import { hashUnknown } from '@neodx/internal/hash';\nimport { plural } from '@neodx/internal/intl';\nimport { formatList } from '@neodx/internal/log';\nimport { createTaskRunner } from '@neodx/internal/tasks';\nimport {\n  concurrently,\n  entries,\n  False,\n  identity,\n  includesIn,\n  invariant,\n  isEmpty,\n  isEmptyObject,\n  isTypeOfString,\n  mapValues,\n  not,\n  prop,\n  True\n} from '@neodx/std';\nimport { dropValue } from '@neodx/std/array';\nimport { match } from 'ts-pattern';\nimport type { ParsedSvgNode } from './parser.ts';\nimport {\n  compactSprites,\n  defineSpriteMeta,\n  getAllSymbols,\n  getChildNodes,\n  getExternalAsset,\n  replaceNodeParent,\n  type SpriteMeta,\n  type SvgLogger,\n  type SymbolMeta\n} from './shared.ts';\n\nexport type ExtractInlinedMode = 'extract-per-sprite' | 'merge-all';\nexport type FilterInlineMode = 'auto' | 'none' | 'all' | ((symbol: SymbolMeta) => boolean);\nexport type SvgSpriteInlining = ReturnType<typeof createSvgSpriteInlining>;\n\nexport interface SvgSpriteInliningParams {\n  /**\n   * Generates a unique ID for the symbol.\n   * The ID will be used as a global ID for the symbol in the document.\n   *\n   * @default ({ spriteName, symbolName, contentHash }) => `${spriteName}-${symbolName}-${contentHash.slice(0, 8)}`\n   * @example Single hash\n   * { getId: it => it.hash(`${it.spriteName}-${it.symbolName}-${it.contentHash}`) }\n   */\n  getId?: (params: SymbolIdParams) => string;\n  /**\n   * Name of the generated asset for \"extract: true\" mode.\n   * You can use \"{name}\" placeholder to include sprite name or a custom function.\n   *\n   * @default \"inlined-{name}\"\n   */\n  assetName?: string | ((sprite: SpriteMeta) => string);\n  /**\n   * Name of the merged sprite for \"merge: true\" mode.\n   * @default \"all\"\n   */\n  mergeName?: string;\n  /**\n   * Extract inlined symbols from sprites.\n   * - if `true`, inlined symbols will be extracted as separate assets and marked as \"fetch-and-inject\".\n   * - if `false`, inlined symbols will be injected into the document as \"inject\" assets.\n   *\n   * @default false\n   */\n  extract?: boolean;\n  /**\n   * Inline recognition strategy.\n   * - \"auto\" - (default) detects all symbols that reference other symbols\n   * - \"none\" - disables inlining\n   * - \"all\" - inlines all symbols\n   * - (fn: (symbol: SymbolMeta) => boolean) - custom filter function\n   *\n   * @default 'auto'\n   * @example Custom filter function\n   * symbol => symbol.name.includes('illustration')\n   */\n  filter?: FilterInlineMode;\n  /**\n   * Merge all inlined symbols into a single sprite.\n   * @default false\n   */\n  merge?: boolean;\n  /**\n   * Logger instance\n   * @see `@neodx/log`\n   */\n  log: SvgLogger;\n}\n\nexport interface SymbolIdParams {\n  /**\n   * Name of the symbol\n   * @example \"close\"\n   */\n  symbolName: string;\n  /**\n   * Name of the sprite\n   * @example \"common\"\n   */\n  spriteName: string;\n  /** Hash of the symbol's content */\n  contentHash: string;\n  /** Hash function */\n  hash: (value: unknown) => string;\n}\n\n/**\n * An API for detecting and extracting inline symbols from SVG sprites.\n * Inline symbols will be placed in the document and accessible via global IDs (e.g., `<use href=\"#sprite-symbol-name\" />`).\n */\nexport function createSvgSpriteInlining({\n  assetName = 'inlined-{name}',\n  mergeName = 'all',\n  extract,\n  getId = ({ spriteName, symbolName, contentHash }) =>\n    `${spriteName}-${symbolName}-${contentHash.slice(0, 8)}`,\n  filter = 'auto',\n  merge,\n  log\n}: SvgSpriteInliningParams) {\n  const isInlinedSymbol = match(filter)\n    .with('auto', () => hasReferences)\n    .with('none', () => False)\n    .with('all', () => True)\n    .otherwise(identity);\n  const { task } = createTaskRunner({ log });\n  const getAssetName = isTypeOfString(assetName)\n    ? (sprite: SpriteMeta) => assetName.replace('{name}', sprite.name)\n    : assetName;\n\n  const extractSprite = task('analyze', (sprite: SpriteMeta) => {\n    const external = getExternalAsset(sprite);\n    const inlined = external.symbols.filter(isInlinedSymbol);\n\n    if (isEmpty(inlined)) log.debug('No inlined symbols found in \"%s\"', sprite.name);\n    else if (inlined.length === getAllSymbols(sprite).length) {\n      log.debug('All symbols are inlined in \"%s\"', sprite.name);\n    } else {\n      log.info(\n        'Sprite \"%s\" inlines %s: %s',\n        sprite.name,\n        plural(inlined.length, { one: '%d symbol', other: '%d symbols' }),\n        formatList(inlined.map(prop('name')))\n      );\n    }\n    external.symbols = external.symbols.filter(not(includesIn(inlined))) as SymbolMeta[];\n    return { sprite, inlined };\n  });\n\n  const compileSymbol = task(\n    'inline symbol',\n    async (symbol: SymbolMeta, spriteName: string, virtualNode: ParsedSvgNode) => {\n      const contentHash = hashUnknown(symbol.source);\n      const createId = (symbolName: string) =>\n        getId({ spriteName, symbolName, contentHash, hash: hashUnknown });\n      const moveToVirtual = (node: ParsedSvgNode) => replaceNodeParent(node, virtualNode);\n      const mappedIds = mapValues(\n        symbol.__.nodeById,\n        (node, id) => (node.props.id = createId(`${symbol.name}-ref-${id}`))\n      );\n\n      symbol.inlined = true;\n      // Extract all defs\n      symbol.__.allNodes\n        .filter(it => it.name === 'defs')\n        .forEach(node => {\n          // 1. Move all defs children to virtual defs node\n          getChildNodes(node).forEach(moveToVirtual);\n          // 2. Remove defs node itself\n          dropValue(node.parent!.children, node);\n        });\n\n      // Extract all referenced nodes\n      entries(symbol.__.references).forEach(([id, affected]) => {\n        const node = symbol.__.nodeById[id];\n\n        invariant(node, `Referenced node \"${id}\" is not found in the symbol \"${symbol.name}\"`);\n        // Each dependent node will be updated with new id\n        affected.forEach(({ node, prop, value }) => {\n          node.props[prop] = value.replace(`#${id}`, `#${mappedIds[id]}`);\n        });\n        moveToVirtual(node);\n      });\n      symbol.__.id = createId(symbol.name);\n      // TODO Rethink SVG Node API\n      symbol.__.sync();\n    }\n  );\n  const compileSymbols = task(\n    'inline symbols',\n    async (spriteName: string, symbols: SymbolMeta[]) => {\n      const defs = {\n        name: 'defs',\n        props: {},\n        children: []\n      } satisfies ParsedSvgNode;\n\n      await concurrently(symbols, symbol => compileSymbol(symbol, spriteName, defs));\n      return defs;\n    }\n  );\n\n  const apply = task(\n    'apply',\n    async (sprites: SpriteMeta[]) => {\n      const allSymbols = sprites.flatMap(it => getAllSymbols(it));\n      const extracted = await concurrently(sprites, extractSprite);\n      const inlined = extracted.flatMap(it => it.inlined);\n\n      if (inlined.length > 0) {\n        log.info(\n          '%d/%s in %s will be inlined',\n          inlined.length,\n          plural(allSymbols.length, { one: '%d symbol', other: '%d symbols' }),\n          plural(sprites.length, { one: '%d sprite', other: '%d sprites' })\n        );\n      } else {\n        log.info(\n          'No symbols will be inlined in any of %s',\n          plural(sprites.length, { one: '%d sprite', other: '%d sprites' })\n        );\n      }\n      if (inlined.length === 0) return sprites;\n      const addInlinedAsset = async (sprite: SpriteMeta, symbols: SymbolMeta[]) => {\n        sprite.assets.push({\n          type: extract ? 'fetch-and-inject' : 'inject',\n          symbols,\n          content: '',\n          fileName: '',\n          assetName: getAssetName(sprite),\n          additionalChildren: [await compileSymbols(sprite.name, symbols)]\n        });\n        return sprite;\n      };\n\n      return compactSprites(\n        merge\n          ? [\n              ...extracted.map(prop('sprite')),\n              await addInlinedAsset(defineSpriteMeta(mergeName, []), inlined)\n            ]\n          : await concurrently(extracted, it => addInlinedAsset(it.sprite, it.inlined))\n      );\n    },\n    {\n      mapSuccessMessage: sprites =>\n        sprites\n          ? `inline ${plural(sprites.length, { one: '%d sprite', other: '%d sprites' })}`\n          : 'skip inlining'\n    }\n  );\n\n  return {\n    apply\n  };\n}\n\nconst hasReferences = (symbol: SymbolMeta) => !isEmptyObject(symbol.__.references);\n","import { toArray } from '@neodx/std';\nimport { z } from 'zod';\n\nexport const parseAs = <T extends z.ZodTypeAny>(name: string, schema: T, value: unknown) => {\n  try {\n    return schema.parse(value) as z.infer<T>;\n  } catch (error) {\n    throw new Error(`Wrong value for \"${name}\": ${(error as z.ZodError).message}`, {\n      cause: error\n    });\n  }\n};\n\nexport const StringListSchema = z.string().transform(toArray).or(z.string().array());\n","import { createTaskRunner } from '@neodx/internal/tasks';\nimport { parseAs } from '@neodx/internal/zod';\nimport { identity } from '@neodx/std';\nimport type { Vfs } from '@neodx/vfs';\nimport { match } from 'ts-pattern';\nimport { z } from 'zod';\nimport {\n  getAllSymbols,\n  getSvgSizeProps,\n  type SpriteAsset,\n  type SpriteMeta,\n  type SvgLogger,\n  type SymbolMeta\n} from './shared.ts';\n\nexport type SpritesMetadataParams = z.infer<typeof MetadataParamsSchema>;\nexport type SpritesMetadataInput = z.input<typeof MetadataInputSchema>;\nexport type SpritesMetadata = ReturnType<typeof createSpritesMetadata>;\n\nexport function createSpritesMetadata(\n  input: SpritesMetadataInput,\n  {\n    vfs,\n    log\n  }: {\n    log: SvgLogger;\n    vfs: Vfs;\n  }\n) {\n  const params = parseAs('metadata', MetadataInputSchema, input);\n\n  if (!params) return null;\n  const { name, path, typeName } = params;\n  const { task } = createTaskRunner({ log });\n  const render = task('render', async (sprites: SpriteMeta[]) => {\n    await vfs.write(\n      path,\n      template\n        .replaceAll('/* @replace */ export ', '')\n        .replace(\n          '// $VARIABLES$',\n          `export const ${name} = defineSpriteMap(${tmpl.array(sprites, renderSprite)})`\n        )\n        .replace(\n          '// $TYPES$',\n          `export type ${typeName} = {\n  ${sprites.map(renderSpriteType).join('\\n  ')}\n}`\n        )\n    );\n  });\n\n  if (params.runtime) log.warn('`metadata.runtime` option is deprecated, remove it from your code');\n\n  return {\n    params: Object.freeze(params),\n    render\n  };\n}\n\nconst renderSpriteType = (sprite: SpriteMeta) =>\n  `\"${sprite.name}\": ${getAllSymbols(sprite)\n    .map(it => `\"${it.name}\"`)\n    .join(' | ')};`;\n\nconst renderSprite = ({ name, assets }: SpriteMeta) => `defineSprite(\n  '${name}',\n  ${tmpl.array(assets, renderAsset)}\n)`;\nconst renderAsset = (asset: SpriteAsset) => `defineSpriteAsset(\n  ${tmpl.array(asset.symbols, renderSymbol)},\n  ${match(asset)\n    .with({ type: 'external' }, it => `defineExternalAssetMeta('${it.fileName}')`)\n    .with({ type: 'inject' }, it => `defineInjectedAssetMeta('${it.content}')`)\n    .with({ type: 'fetch-and-inject' }, it => `defineFetchAndInjectedAssetMeta('${it.fileName}')`)\n    .exhaustive()}\n)`;\nconst renderSymbol = ({ name, node, __: { id } }: SymbolMeta) => {\n  const { width, height, viewBox } = getSvgSizeProps(node);\n  const defineId = id !== name;\n  const defineHeight = height !== width;\n  const defineViewBox = viewBox !== `0 0 ${width} ${height}`;\n\n  return `defineSpriteSymbol(\n     ${tmpl.array([name, defineId && id], tmpl.string)},\n     ${tmpl.array([width, defineHeight && height, defineViewBox && tmpl.string(viewBox)])}\n   )`;\n};\n\nconst tmpl = {\n  string: (value: any) => `\"${value}\"`,\n  array: <T>(items: T[], map: (item: T) => string = identity as any) =>\n    `[${items\n      .filter(it => it !== false)\n      .map(map)\n      .join(', ')}]`\n};\n\n/** Parameters for `metadata` option */\nexport const MetadataParamsSchema = z.object({\n  /**\n   * Path to generated sprites metadata - types and runtime information\n   * @example \"src/sprites/meta.ts\"\n   */\n  path: z.string(),\n  /**\n   * Name for the variable generated for sprites metadata\n   * @default \"sprites\"\n   * @example Generated metadata\n   * export const sprites = defineSpriteMap({\n   *   common: defineSprite('common', 'common.svg', [\n   *     defineSpriteSymbol('close', 16, 16),\n   *     defineSpriteSymbol('add', 16, 16),\n   *   ]),\n   * });\n   * // ...\n   * console.log(sprites.common.symbols.close); // { name: 'close', axis: 'xy', width: 16, height: 16, viewBox: '0 0 16 16' }\n   */\n  name: z.string().default('sprites'),\n  /**\n   * Name of the type generated for sprites metadata\n   * @default \"SpritesMeta\"\n   * @example Generated metadata\n   * export type SpritesMeta = typeof sprites;\n   */\n  typeName: z.string().default('SpritesMeta'),\n  /**\n   * @deprecated Not used anymore, remove it from your code\n   */\n  runtime: z.any().optional()\n});\n\n/** Any possible value for `metadata` option */\nexport const MetadataInputSchema = z.union([\n  MetadataParamsSchema,\n  z.string().transform(path => MetadataParamsSchema.parse({ path })),\n  z.literal(false).transform(() => null)\n]);\n\n// TODO Copy template automatically\nconst template = `\n/// <reference lib=\"dom\" />\n/* eslint-disable */\n// This file is autogenerated by @neodx/svg\n// Do not edit it manually\n\n//#region @neodx/svg runtime utils\n\n/**\n * Fetches the sprite from the given URL and injects it into the DOM.\n * Should be used in the browser environment for loading inline sprites.\n */\nexport async function loadSvgSprite(url: URL | string, parent?: HTMLElement | null) {\n  mountSvgSprite(await fetch(url).then(res => res.text()), parent);\n}\n\n/**\n * Mounts the sprite content into the DOM.\n * Under the hood, it will wait for the DOM to be ready and then inject the sprite.\n * @example\n * mountSvgSprite('<svg>...</svg>');\n */\nexport function mountSvgSprite(svg: string, parent?: HTMLElement | null) {\n  if (typeof window === 'undefined') return;\n  // eslint-disable-next-line no-param-reassign\n  parent ??= window.document.body;\n\n  if (parent.ownerDocument.readyState === 'loading') {\n    parent.ownerDocument.addEventListener('DOMContentLoaded', () => injectSvgSprite(svg, parent));\n  } else {\n    injectSvgSprite(svg, parent);\n  }\n}\n\n/**\n * Injects the sprite content into the DOM.\n * @example\n * injectSvgSprite('<svg>...</svg>');\n */\nexport function injectSvgSprite(svg: string, parent: HTMLElement) {\n  const host = Object.assign(parent.ownerDocument.createElement('div'), {\n    innerHTML: svg\n  });\n\n  Object.assign(host.style, {\n    pointerEvents: 'none',\n    position: 'absolute',\n    overflow: 'hidden',\n    height: '0',\n    width: '0'\n  });\n  parent.append(host);\n}\n\n/* @replace */ export const defineSpriteMap = <const Sprites extends readonly [...SvgSprite[]]>(\n  all: [...Sprites]\n) => {\n  const map = defineNamedMap(all);\n\n  return {\n    ...map,\n    /**\n     * Safely get symbol by untyped sprite and symbol names.\n     *\n     * @experimental Current version of this API will be stabilized in v1.0.0\n     *\n     * @example Accessing symbol with custom template\n     * const [spriteName, symbolName] = myName.split('/');\n     * const symbol = sprites.get(spriteName, symbolName);\n     *\n     * if (!symbol) throw new Error(\\`Symbol \"\\${symbolName}\" is not found in \"\\${spriteName}\"\\`);\n     */\n    experimental_get(spriteName: string, symbolName: string, config?: SpritePrepareConfig) {\n      const sprite = map.byName[spriteName as keyof typeof map.byName] as Sprites[number] | null;\n      const symbol = sprite?.symbols.byName[symbolName] as SvgSpriteSymbol | null;\n      const asset = sprite?.assets.find(it => it.symbols.all.includes(symbol)) as SvgSpriteAsset;\n      const href = symbol && sprite?.prepare(asset, symbol, config);\n\n      if (!sprite || !symbol || !asset || !href) return null;\n      return { sprite, symbol, asset, href };\n    }\n  };\n};\n\nexport interface SpritePrepareConfig {\n  /** Base URL for external assets */\n  baseUrl?: string;\n  /** DOM element to inject the sprite into */\n  parent?: HTMLElement | null;\n  /**\n   * Loads the sprite from the given URL and injects it into the DOM.\n   *\n   * @example simplified default implementation\n   * async (url, parent) => mountSvgSprite(await fetch(url).then(res => res.text()), parent)\n   */\n  loadSvgSprite?: typeof loadSvgSprite;\n  /**\n   * Mounts the sprite content into the DOM.\n   */\n  mountSvgSprite?: typeof mountSvgSprite;\n}\n\n/* @replace */ export const defineSprite = <\n  const Name extends string,\n  const Assets extends readonly [...SvgSpriteAsset[]]\n>(\n  name: Name,\n  assets: [...Assets]\n) => {\n  const getUrl = (fileName: string, baseUrl?: string) =>\n    !baseUrl?.startsWith('http')\n      ? \\`/\\${baseUrl?.replace(/(^\\\\/)|(\\\\/$)/g, '')}/\\${fileName}\\`\n      : new URL(fileName, baseUrl);\n  const prepareAsset = (\n    asset: SvgSpriteAsset,\n    {\n      parent,\n      baseUrl,\n      loadSvgSprite: load = loadSvgSprite,\n      mountSvgSprite: mount = mountSvgSprite\n    }: SpritePrepareConfig = {}\n  ) => {\n    if (asset.meta.type === 'inject') {\n      mount(asset.meta.content, parent);\n    }\n    if (asset.meta.type === 'fetch-and-inject') {\n      load(getUrl(asset.meta.fileName, baseUrl), parent);\n    }\n  };\n\n  return {\n    name,\n    assets,\n    symbols: defineNamedMap<[...MergeAssetsSymbols<Assets>]>(\n      assets.flatMap(asset => asset.symbols.all) as any\n    ),\n    prepare(asset: SvgSpriteAsset, symbol: SvgSpriteSymbol, config?: SpritePrepareConfig) {\n      if (!assets.includes(asset)) return null;\n      if (!asset.done) {\n        asset.done = true;\n        prepareAsset(asset, config);\n      }\n      switch (asset.meta.type) {\n        case 'inject':\n        case 'fetch-and-inject':\n          return \\`#\\${symbol.id}\\`;\n        case 'external':\n          return \\`\\${getUrl(asset.meta.fileName, config?.baseUrl)}#\\${symbol.id}\\`;\n        default:\n          return null;\n      }\n    }\n  };\n};\n\n/* @replace */ export const defineExternalAssetMeta = (fileName: string) => ({\n  type: 'external' as const,\n  fileName\n});\n/* @replace */ export const defineInjectedAssetMeta = (content: string) => ({\n  type: 'inject' as const,\n  content\n});\n/* @replace */ export const defineFetchAndInjectedAssetMeta = (fileName: string) => ({\n  type: 'fetch-and-inject' as const,\n  fileName\n});\n/* @replace */ export const defineSpriteAsset = <\n  const Symbols extends readonly [...SvgSpriteSymbol[]]\n>(\n  symbols: [...Symbols],\n  meta: SpriteAssetMeta\n) => ({\n  symbols: defineNamedMap(symbols),\n  meta,\n  done: false\n});\n\nexport type SpriteAssetMeta =\n  | ReturnType<typeof defineExternalAssetMeta>\n  | ReturnType<typeof defineInjectedAssetMeta>\n  | ReturnType<typeof defineFetchAndInjectedAssetMeta>;\n\n/** Common structure for interaction with all named data. */\n/* @replace */ export const defineNamedMap = <\n  const Items extends readonly [\n    ...{\n      name: string;\n    }[]\n  ]\n>(\n  all: readonly [...Items]\n) => ({\n  /**\n   * List of all items\n   * @example\n   * console.log(mySprite.symbols.all); // [ { name: 'close', ... }, { name: 'add', ... } ]\n   */\n  all,\n  /**\n   * List of all names\n   * @example\n   * console.log(mySprite.symbols.names); // [ 'close', 'add', ... ]\n   */\n  names: all.map(symbol => symbol.name) as readonly [\n    ...{\n      [Index in keyof Items]: Items[Index]['name'];\n    }\n  ],\n  /**\n   * Map of all items where key is the item name and value is the item itself\n   * @example Symbols\n   * console.log(mySprite.symbols.byName); // { close: { name: 'close', ... }, ... }\n   * @example Sprites\n   * console.log(sprites.byName.common); // { name: 'common', symbols: { ... } }\n   */\n  byName: Object.fromEntries(all.map(symbol => [symbol.name, symbol])) as {\n    [Item in Items[number] as Item['name']]: Item;\n  }\n});\n\n/* @replace */ export const defineSpriteSymbol = <const Name extends string>(\n  [name, id = name]: [Name] | [Name, string],\n  [width, height = width, viewBox = \\`0 0 \\${width} \\${height}\\`]: [number, number?, string?]\n) => ({\n  id,\n  name,\n  width,\n  height,\n  viewBox\n});\n\n/* @replace */ export type MergeAssetsSymbols<\n  Assets extends readonly [...SvgSpriteAsset[]],\n  Result extends SvgSpriteSymbol[] = []\n> = Assets extends [SvgSpriteAsset<infer Symbols>, ...infer Tail extends readonly SvgSpriteAsset[]]\n  ? MergeAssetsSymbols<Tail, [...Result, ...Symbols]>\n  : Result;\n\nexport type SvgSpriteSymbol<Name extends string = any> = ReturnType<\n  typeof defineSpriteSymbol<Name>\n>;\nexport type SvgSprite<\n  Name extends string = any,\n  Assets extends readonly [...SvgSpriteAsset[]] = any\n> = ReturnType<typeof defineSprite<Name, Assets>>;\n\nexport type SvgSpriteAsset<Symbols extends readonly [...SvgSpriteSymbol[]] = any> = ReturnType<\n  typeof defineSpriteAsset<Symbols>\n>;\n\n//#endregion\n\n//#region autogenerated sprites\n\n// $VARIABLES$\n\n// $TYPES$\n\n//#endregion\n`;\n","import type { Config } from 'svgo';\nimport type { PresetDefaultOverrides } from 'svgo/plugins/plugins-types';\n\nexport interface CreateSvgoConfigParams {\n  /**\n   * Additional attributes to remove. Provide them if you want to extend the default behavior, but do not override it.\n   */\n  removeAttrs?: string[];\n  /**\n   * If `true`, disables specific optimizations which are not compatible with sprites:\n   * - \"removeHiddenElems\" removes invisible elements\n   * - \"removeUselessDefs\" removes unused symbols\n   * - \"cleanupIds\" removes symbol ids\n   *\n   * @see https://github.com/svg/svgo/issues/1962\n   * @default false\n   */\n  spriteMode?: boolean;\n  /**\n   * SVGO configuration\n   * @see https://github.com/svg/svgo#configuration\n   */\n  config?: Config;\n}\n\nexport const createSvgoConfig = ({\n  removeAttrs = [],\n  spriteMode,\n  config\n}: CreateSvgoConfigParams = {}): Config => ({\n  multipass: true,\n  ...config,\n  plugins: [\n    {\n      name: 'preset-default',\n      params: {\n        overrides: Object.assign<PresetDefaultOverrides, PresetDefaultOverrides>(\n          {\n            mergePaths: {},\n            removeUselessStrokeAndFill: {},\n            removeViewBox: false,\n            cleanupAttrs: {},\n            convertPathData: {\n              removeUseless: true,\n              lineShorthands: true,\n              applyTransforms: true\n            }\n          },\n          spriteMode\n            ? {\n                removeHiddenElems: false, // don't remove invisible elements\n                removeUselessDefs: false, // don't remove unused symbols\n                cleanupIds: false // don't remove symbol ids\n              }\n            : {}\n        )\n      }\n    },\n    { name: 'removeStyleElement' },\n    { name: 'removeScriptElement' },\n    {\n      name: 'removeAttrs',\n      params: {\n        attrs: [\n          '(class)', //|style)',\n          'xlink:href',\n          'aria-labelledby',\n          'aria-describedby',\n          'xmlns:xlink',\n          'data-name'\n        ].concat(removeAttrs)\n      }\n    },\n    ...(config?.plugins ?? [])\n  ]\n});\n","import { createSvgoConfig, type CreateSvgoConfigParams } from '@neodx/internal/svgo';\nimport { identity } from '@neodx/std';\nimport { optimize } from 'svgo';\n\nexport type SvgOptimizer = ReturnType<typeof createSvgOptimizer>;\n\n/**\n * Creates SVG optimization API for minifying regular SVG files and SVG sprites\n */\nexport function createSvgOptimizer(input: CreateSvgoConfigParams | boolean = true) {\n  if (!input) return fallback;\n  const params = input === true ? {} : input;\n\n  const applySvgo = (content: string, overrides?: Partial<CreateSvgoConfigParams>) => {\n    try {\n      return optimize(\n        content,\n        createSvgoConfig({\n          ...params,\n          ...overrides\n        })\n      ).data;\n    } catch (error) {\n      console.error(error);\n      return content;\n    }\n  };\n\n  return {\n    symbol: (content: string) =>\n      applySvgo(content, {\n        spriteMode: false,\n        config: {\n          plugins: [\n            {\n              name: 'cleanupIds',\n              params: {\n                minify: false,\n                remove: false\n              }\n            }\n          ]\n        }\n      }),\n    sprite: (content: string) => applySvgo(content, { spriteMode: true })\n  };\n}\n\nconst fallback = {\n  symbol: identity,\n  sprite: identity\n};\n","import { toArray } from '@neodx/std';\nimport { type AnyColor, type Colord, colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport type { ParsedSvgNode } from './parser.ts';\nimport { getChildNodes } from './shared.ts';\n\nexport type SvgResetColors = ReturnType<typeof createSvgResetColors>;\nexport type SvgResetColorsParams = ColorPropertyReplacementInput | ColorPropertyReplacementInput[];\n\nexport interface ColorPropertyReplacementInput {\n  /**\n   * Properties to replace colors in\n   * @default ['fill', 'stroke']\n   */\n  properties?: string | string[];\n  /**\n   * Colors to keep untouched\n   * @default []\n   * @example ['#fff', '#000']\n   */\n  keep?: ColorsKeepInput;\n  /**\n   * Define it if you want to include only certain files\n   * @example /.*\\.icon\\.svg$/ // include only icons\n   */\n  include?: FileFilterInput;\n  /**\n   * Define it if you want to exclude certain files\n   * @example /.*\\.illustration\\.svg$/ // exclude illustrations\n   */\n  exclude?: FileFilterInput;\n  /**\n   * Replace colors policy. You can define it in multiple ways:\n   * - { from: <color>, [...<color>], to: <color> } will replace all colors from the `from` array with the `to` value\n   * - `to` property is optional and will be replaced with the \"replaceUnknown\" option value if not defined\n   * - raw color string ot array (e.g. '#fff' or ['#fff', '#000']) is alias for `{ from: <color>, [...<color>] }`\n   *\n   * @example Replace \"#fff\" with \"currentColor\"\n   * { replace: '#fff' }\n   * @example Replace \"#fff\" and \"#000\" with \"currentColor\"\n   * { replace: ['#fff', '#000'] }\n   * @example Replace \"#fff\" with \"#000\"\n   * { replace: { from: '#fff', to: '#000' } }\n   * @example Replace \"#fff\" and \"#000\" with \"currentColor\"\n   * { replace: { from: ['#fff', '#000'], to: 'currentColor' } }\n   * @example Replace \"#fff\" and \"#000\" with \"currentColor\" and \"#eee\" with \"#e5e5e5\"\n   * { replace: ['#fff', '#000', { from: '#eee', to: '#e5e5e5' }], replaceUnknown: 'currentColor' }\n   */\n  replace?: ColorReplacementInput | ColorReplacementInput[];\n  /**\n   * Color to replace unknown (not defined implicitly in \"replace.to\" option) colors\n   * @default 'currentColor'\n   */\n  replaceUnknown?: string | false;\n}\n\nexport type ColorsKeepInput = AnyColorInput | AnyColorInput[];\nexport type FileFilterInput = FileFilterInputValue | FileFilterInputValue[];\nexport type FileFilterInputValue = string | RegExp;\nexport type ColorReplacementInput = string | ColorReplacementInputConfig;\n\nexport interface ColorReplacementInputConfig {\n  from: AnyColorInput | AnyColorInput[];\n  to?: string;\n}\n\nexport type AnyColorInput = AnyColor | Colord;\n\nexport const createSvgResetColors = (params: SvgResetColorsParams | boolean = defaults) => {\n  if (!params) return fallback;\n  const replacements = toArray(\n    params === true ? (defaults as SvgResetColorsParams) : params\n  ).map<ColorPropertyReplacement>(input => ({\n    properties: toArray(input.properties ?? defaults.properties),\n    keep: toArray(input.keep ?? []).map(colord),\n    exclude: toFileFilterPredicate(input.exclude),\n    include: toFileFilterPredicate(input.include),\n    replace: toArray(input.replace ?? []).map(anyInputToReplacement),\n    // If replace is set, replaceUnknown is false by default, otherwise it's \"currentColor\"\n    replaceUnknown: input.replaceUnknown ?? (input.replace ? false : defaults.replaceUnknown)\n  }));\n  const apply = (path: string, node: ParsedSvgNode) => {\n    Object.assign(node.props, getSvgNodeResetColorAttributes(path, node, replacements));\n    getChildNodes(node).forEach(child => apply(path, child));\n    return node;\n  };\n\n  return {\n    apply\n  };\n};\n\nconst anyInputToReplacement = (input: ColorReplacementInput) =>\n  configToReplacement(typeof input === 'string' ? { from: input } : input);\nconst configToReplacement = ({ from, to }: ColorReplacementInputConfig) => ({\n  from: toArray(from).map(colord),\n  to: to ?? defaults.replaceUnknown\n});\n\nconst getSvgNodeResetColorAttributes = (\n  path: string,\n  node: ParsedSvgNode,\n  replacements: ColorPropertyReplacement[]\n) => {\n  const result = { ...node.props };\n\n  for (const { properties, replaceUnknown, replace, keep, exclude, include } of replacements) {\n    if (exclude?.(path)) continue;\n    if (include && !include(path)) continue;\n\n    for (const name of properties.filter(name => name in node.props)) {\n      const sourceColor = colord(node.props[name]!);\n\n      if (!sourceColor.isValid()) continue;\n      if (keep.some(color => color.isEqual(sourceColor))) continue;\n\n      const replacement =\n        replace.find(({ from }) => from.some(color => color.isEqual(sourceColor)))?.to ??\n        replaceUnknown;\n\n      result[name] = replacement ? replacement : result[name]!;\n    }\n  }\n  return result;\n};\n\nconst toFileFilterPredicate = (input?: FileFilterInput): FileFilter | null => {\n  const filters = input && toArray(input).map(toRegex);\n\n  if (!filters || filters.length === 0) return null;\n\n  return (name: string) => filters.some(regex => regex.test(name));\n};\n\nconst toRegex = (input: string | RegExp) => (typeof input === 'string' ? new RegExp(input) : input);\nconst defaults = {\n  properties: ['fill', 'stroke'],\n  replaceUnknown: 'currentColor'\n} satisfies ColorPropertyReplacementInput;\nconst fallback = {\n  apply: (_: string, node: ParsedSvgNode) => node\n};\n\nextend([namesPlugin]);\n\ninterface ColorPropertyReplacement {\n  properties: string[];\n  keep: Colord[];\n  include: FileFilter | null;\n  exclude: FileFilter | null;\n  replace: ColorReplacement[];\n  replaceUnknown?: string | false;\n}\n\ninterface ColorReplacement {\n  from: Colord[];\n  to: string;\n}\n\ntype FileFilter = (path: string) => boolean;\n","import { hashContent, printHash } from '@neodx/internal/hash';\nimport { plural } from '@neodx/internal/intl';\nimport { formatList } from '@neodx/internal/log';\nimport { callable, type CallableParam } from '@neodx/internal/params';\nimport type { CreateSvgoConfigParams } from '@neodx/internal/svgo';\nimport { createTaskRunner } from '@neodx/internal/tasks';\nimport type { AutoLoggerInput } from '@neodx/log';\nimport { createAutoLogger, pretty } from '@neodx/log/node';\nimport {\n  cases,\n  concurrently,\n  entries,\n  groupBy,\n  identity,\n  isEmpty,\n  isTypeOfFunction,\n  pick,\n  prop\n} from '@neodx/std';\nimport { type AutoVfsInput, createAutoVfs, type VfsLogMethod } from '@neodx/vfs';\nimport { dirname } from 'node:path';\nimport { match, P } from 'ts-pattern';\nimport { createSpritesCleanup, type SpritesCleanupType } from './cleanup.ts';\nimport { createSvgCollector } from './collector.ts';\nimport {\n  createSvgSpriteInlining,\n  type FilterInlineMode,\n  type SvgSpriteInliningParams\n} from './inlining.ts';\nimport { createSpritesMetadata, type SpritesMetadataInput } from './metadata.ts';\nimport { createSvgOptimizer } from './optimizer.ts';\nimport { formatSvgAsset } from './parser.ts';\nimport { createSvgResetColors, type SvgResetColorsParams } from './reset-colors.ts';\nimport { defineSpriteMeta, type SpriteAsset, type SpriteMeta, type SymbolMeta } from './shared.ts';\n\nexport interface CreateSvgSpriteBuilderParams {\n  /**\n   * Logger instance\n   * @see `@neodx/log`\n   * @default built-in logger\n   */\n  log?: AutoLoggerInput<VfsLogMethod>;\n  /**\n   * VFS instance, a path or params for creating a VFS instance\n   * @see `@neodx/vfs`\n   * @default process.cwd()\n   */\n  vfs?: AutoVfsInput;\n  /**\n   * Sprite grouping mode\n   *\n   * - `true` - use `dirname` as sprite name (default),\n   * - `false` - don't group sprites, `defaultSpriteName` will be used for all sprites,\n   * - otherwise a function that accepts relative path and returns sprite name\n   *\n   * @default true\n   * @example Grouping by path's dirname and specific attribute\n   * { group: ({ node, path }) => `${dirname(path)}/${node.props['data-category']}` }\n   */\n  group?: CallableParam<(file: SymbolMeta) => string>;\n  /**\n   * Root path for the input files.\n   * All paths will be relative to this path.\n   * @default '.'\n   */\n  inputRoot?: string;\n  /**\n   * Sprite inlining mode, disabled by default\n   *\n   * - `'auto'` - we'll automatically detect all problematic svgs and extract them into separate sprite for future inlining\n   * - `'all'` - all sprites will be inlined. Perfect for solving CDN compatibility\n   * - `false` - no inlining. If we find any potential issues, we'll display corresponding errors in the console\n   *\n   * @default false\n   */\n  inline?: Partial<SvgSpriteInliningParams> | FilterInlineMode | false;\n  /**\n   * Path to generated sprite/sprites folder\n   * @default 'public/sprites'\n   */\n  output?: string;\n  /**\n   * Sprite cleanup mode.\n   *\n   * - `'auto'` - smart cleanup, removes only outdated sprites and requires `metadata` option to identify current sprites\n   * - `'force'` - delete the entire output directory before building sprites\n   * - `false` - no cleanup\n   *\n   * @default 'auto' if `metadata` option is provided, otherwise `false`\n   */\n  cleanup?: false | SpritesCleanupType;\n  /**\n   * Template of sprite file name\n   * @example {name}.svg\n   * @example sprite-{name}.svg\n   * @example {name}-{hash}.svg\n   * @example {name}-{hash:8}.svg\n   * @default {name}.svg\n   */\n  fileName?: string;\n  /**\n   * Resolves symbol name for the given file path.\n   * By default, it's a kebab-cased file name without an extension.\n   *\n   * @default path => cases.kebab(basename(path, '.svg'))\n   * @example path => basename(path, '.svg') // don't force any case\n   */\n  getSymbolName?: (path: string) => string;\n  /**\n   * Should we optimize icons?\n   * - `true` - minify SVG files,\n   * - `false` - don't minify,\n   * - otherwise, a custom configuration (with an SVGO configuration as a part)\n   *\n   * @default true\n   * @example With additional plugins\n   * {\n   *   optimize: {\n   *     config: {\n   *       plugins: [\n   *         { name: 'sortDefsChildren' },\n   *       ]\n   *     }\n   *   }\n   * }\n   */\n  optimize?: boolean | CreateSvgoConfigParams;\n  /**\n   * Metadata generation rules.\n   *\n   * - `false` - don't generate metadata,\n   * - `<string>` - path to generated metadata file, alias for `{ path: 'path/to/metadata.ts' }`,\n   * - otherwise, a configuration object (`SpritesMetadataParams`)\n   *\n   * @see `SpritesMetadataParams`\n   * @example\n   * {\n   *   metadata: {\n   *     path: 'src/sprites/meta.ts',\n   *     name: 'mySpritesVariableName', // default: 'sprites'\n   *     typeName: 'MySpritesTypeName' // default: 'SpritesMeta'\n   *   }\n   * }\n   */\n  metadata?: SpritesMetadataInput;\n  /**\n   * Reset colors config.\n   *\n   * - `true` - converts all colors to `currentColor`,\n   * - `false` - keeps original colors,\n   * - otherwise custom config\n   *\n   * @default true\n   * @example Complex config\n   * {\n   *   resetColors: {\n   *     // 1. Don't touch our special static colors\n   *     keep: Object.values(colors.static),\n   *     // 2. Replace all brand colors with CSS variables\n   *     replace: [\n   *       { from: colors.brand.main, to: 'var(--color-brand-main)' },\n   *       { from: colors.brand.secondary, to: 'var(--color-brand-secondary)' }\n   *     ],\n   *     // 3. Replace all other (\"unknown\" means \"not defined implicitly in `replace.to` option\") colors with `currentColor`\n   *     replaceUnknown: 'currentColor',\n   *     // 4. Preserve specific SVG files untouched\n   *     exclude: /.*\\.standalone\\.svg$/\n   *   }\n   * }\n   */\n  resetColors?: SvgResetColorsParams | boolean;\n  /**\n   * Default sprite name. Will be used if `group` is `false` or for all root-level svg files.\n   * @default 'sprite'\n   */\n  defaultSpriteName?: string;\n}\n\nexport type SvgSpriteBuilder = Awaited<ReturnType<typeof createSvgSpriteBuilder>>;\n\nexport function createSvgSpriteBuilder({\n  vfs: vfsInput = process.cwd(),\n  log: logInput = 'warn',\n  group = true,\n  inline = 'auto',\n  output = 'public/sprites',\n  inputRoot = '.',\n  fileName = '{name}.svg',\n  optimize = true,\n  metadata: metadataInput = false,\n  cleanup: cleanupType = metadataInput ? 'auto' : false,\n  resetColors: resetColorsParams = true,\n  getSymbolName,\n  defaultSpriteName = 'sprite'\n}: CreateSvgSpriteBuilderParams = {}) {\n  const log = createAutoLogger(logInput, { name: 'svg', target: pretty() });\n  const vfs = createAutoVfs(vfsInput, {\n    log: log.child('vfs'),\n    // TODO Figure out why eslint is so slow\n    eslint: false\n  });\n  const inputVfs = vfs.child(inputRoot);\n  const outputVfs = vfs.child(output);\n\n  const getSpriteName = callable(\n    group,\n    file => cases.kebab(getNameByDirname(file.path) || defaultSpriteName),\n    () => defaultSpriteName\n  );\n  // todo move options normalization to the inlining module itself\n  const inlining = inline\n    ? createSvgSpriteInlining(\n        Object.assign(\n          { log: log.child('inline') },\n          match(inline)\n            .with(P.string.or(P.when(isTypeOfFunction)), filter => ({ filter }))\n            .otherwise(identity)\n        )\n      )\n    : null;\n  const { task } = createTaskRunner({ log });\n\n  const resetColors = createSvgResetColors(resetColorsParams);\n  const optimizer = createSvgOptimizer(optimize);\n  const metadata = createSpritesMetadata(metadataInput, {\n    log,\n    vfs\n  });\n  const cleanup = createSpritesCleanup({\n    cleanupType,\n    metadata,\n    outputVfs,\n    log,\n    vfs\n  });\n  const collector = createSvgCollector({\n    vfs: inputVfs,\n    log: log.child('collect'),\n    ignore: inputVfs.relative(outputVfs.path),\n    getName: getSymbolName,\n    optimizer,\n    resetColors\n  });\n\n  const buildSprite = task(\n    'build sprite',\n    async (sprite: SpriteMeta) =>\n      await concurrently(sprite.assets, async asset => {\n        const content = optimizer.sprite(formatSvgAsset(asset));\n\n        if (asset.type === 'inject') asset.content = content;\n        else {\n          asset.fileName = printHash(\n            fileName.replace('{name}', asset.assetName ?? sprite.name),\n            hashContent(content)\n          );\n        }\n\n        return { sprite, asset, content };\n      }),\n    {\n      mapSuccessMessage: (_, sprite) =>\n        `build sprite '${sprite.name}' (${plural(sprite.assets.length, {\n          one: '%d asset',\n          other: '%d assets'\n        })})`,\n      mapError: (_, sprite) => `Failed to generate sprite '${sprite.name}'`\n    }\n  );\n  const build = task(\n    'build',\n    async ({ apply = true } = {}) => {\n      await cleanup?.preload();\n\n      const collectedSprites = entries(groupBy(collector.getAll(), getSpriteName)).map(\n        ([name, files]) => defineSpriteMeta(name, files)\n      );\n      const sprites = (await inlining?.apply(collectedSprites)) ?? collectedSprites;\n      const spriteNames = sprites.map(prop('name'));\n      const inlinedSprites = sprites.filter(it => it.assets.some(it => it.type !== 'external'));\n\n      if (isEmpty(sprites)) {\n        log.error('No symbols found, nothing to build');\n        return [];\n      }\n      if (!isEmpty(inlinedSprites) && !metadata) {\n        log.error(\n          `Required 'metadata' option due to %s was inlined, you won't be able to use sprites without access to actual information about them.\nPlease, provide following options:\n\nsvg({\n  // ...\n  metadata: 'path/to/metadata.ts'\n});\n\nYou can read more about metadata in https://neodx.pages.dev/svg/metadata.html\n        `,\n          plural(inlinedSprites.length, { one: '%d sprite', other: '%d sprites' })\n        );\n        return [];\n      }\n      log.info(\n        'Building %s: %s...',\n        plural(sprites.length, { one: '%d sprite', other: '%d sprites' }),\n        formatList(spriteNames)\n      );\n      // todo rework cleanup logic, currently it's required to cleanup BEFORE writing new sprites, so we should make the following hack with delayed write\n      const results = (await concurrently(sprites, buildSprite)).flat();\n\n      await cleanup?.actualize(results.map(it => it.asset));\n      await metadata?.render(sprites);\n      await concurrently(\n        results.filter(it => it.asset.type !== 'inject'),\n        async ({ asset, content }) =>\n          await outputVfs.write(\n            (asset as Exclude<SpriteAsset, { type: 'inject' }>).fileName,\n            content\n          )\n      );\n      if (apply) await vfs.apply();\n\n      return sprites;\n    },\n    {\n      mapSuccessMessage: sprites =>\n        sprites\n          ? `build ${plural(sprites.length, { one: '%d sprite', other: '%d sprites' })}`\n          : 'skip build'\n    }\n  );\n\n  return {\n    ...pick(collector, ['load', 'add', 'remove', 'clear']),\n    build,\n    __: {\n      resetColors,\n      collector,\n      optimizer,\n      outputVfs,\n      metadata,\n      cleanup,\n      vfs,\n      log\n    }\n  };\n}\n\nconst getNameByDirname = (path: string) => (dirname(path) === '.' ? null : dirname(path));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAa,eAAe,aAAA,GAAA,YAAA,WAAA,CACf,QAAQ,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,OAAO,KAAK;A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