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B,CACvD,MAAO,EAAK,OAAS,EACrB,KAAM,EAAK,MAAQ,QAAQ,GAAQ,GAAQ,YAC3C,IAAK,EAAK,KAAO,IAGb,EAAqB,IAAI,IAGzB,EAAY,IAAI,QAChB,EAAW,IAAI,QAErB,MAAO,CACL,QAAA,CAAS,GACP,MAAM,OAAE,EAAM,MAAE,GAAU,eACxB,EACA,EACA,EACA,GAEF,EAAI,UAAU,GACd,GACF,EAEJ,EAEJ,CAEA,cAAc,SAAU,EACxB,OAAO,QAAU","file":"/npm/postcss-merge-rules@7.0.10/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/postcss-merge-rules@7.0.10/src/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\nconst { dirname } = require('path');\nconst browserslist = require('browserslist');\nconst { sameParent } = require('cssnano-utils');\nconst {\n  ensureCompatibility,\n  sameVendor,\n  noVendor,\n} = require('./lib/ensureCompatibility');\n\n/**\n * @param {import('postcss').Declaration} a\n * @param {import('postcss').Declaration} b\n * @return {boolean}\n */\nfunction declarationIsEqual(a, b) {\n  return (\n    a.important === b.important && a.prop === b.prop && a.value === b.value\n  );\n}\n\n/**\n * @param {import('postcss').Declaration[]} array\n * @param {import('postcss').Declaration} decl\n * @return {number}\n */\nfunction indexOfDeclaration(array, decl) {\n  return array.findIndex((d) => declarationIsEqual(d, decl));\n}\n\n/**\n * Returns filtered array of matched or unmatched declarations\n * @param {import('postcss').Declaration[]} a\n * @param {import('postcss').Declaration[]} b\n * @param {boolean} [not=false]\n * @return {import('postcss').Declaration[]}\n */\nfunction intersect(a, b, not) {\n  return a.filter((c) => {\n    const index = indexOfDeclaration(b, c) !== -1;\n    return not ? !index : index;\n  });\n}\n\n/**\n * @param {import('postcss').Declaration[]} a\n * @param {import('postcss').Declaration[]} b\n * @return {boolean}\n */\nfunction sameDeclarationsAndOrder(a, b) {\n  if (a.length !== b.length) {\n    return false;\n  }\n  return a.every((d, index) => declarationIsEqual(d, b[index]));\n}\n\n/**\n * RuleMeta stores metadata about a `Rule` during the merging process.\n * It tracks selectors and declarations without re-parsing the AST many times.\n *\n * @typedef {Object} RuleMeta\n * @property {string[]} selectors - Array of selector strings for the rule\n * @property {import('postcss').Declaration[]} declarations - Array of declaration nodes for the rule\n * @property {boolean} dirty - Whether the selectors have been modified and need flushing\n */\n\n/**\n * @param {import('postcss').Rule} ruleA\n * @param {import('postcss').Rule} ruleB\n * @param {string[]} browsers\n * @param {Map<string, boolean>} compatibilityCache\n * @param {WeakSet<import('postcss').Rule>} ruleCache\n * @param {WeakMap<import('postcss').Rule, RuleMeta>} ruleMeta\n * @return {boolean}\n */\nfunction canMerge(\n  ruleA,\n  ruleB,\n  browsers,\n  compatibilityCache,\n  ruleCache,\n  ruleMeta\n) {\n  const metaA = getMeta(ruleA, ruleMeta);\n  const metaB = getMeta(ruleB, ruleMeta);\n  const a = metaA.selectors;\n  const b = metaB.selectors;\n\n  const selectors = a.concat(b);\n\n  if (ruleCache.has(ruleA) && ruleCache.has(ruleB)) {\n    // Both already validated\n  } else if (ruleCache.has(ruleA)) {\n    if (!ensureCompatibility(b, browsers, compatibilityCache)) {\n      return false;\n    }\n  } else if (ruleCache.has(ruleB)) {\n    if (!ensureCompatibility(a, browsers, compatibilityCache)) {\n      return false;\n    }\n  } else if (!ensureCompatibility(selectors, browsers, compatibilityCache)) {\n    return false;\n  }\n\n  const parent = sameParent(\n    /** @type {any} */ (ruleA),\n    /** @type {any} */ (ruleB)\n  );\n  if (\n    parent &&\n    ruleA.parent &&\n    ruleA.parent.type === 'atrule' &&\n    /** @type {import('postcss').AtRule} */ (ruleA.parent).name.includes(\n      'keyframes'\n    )\n  ) {\n    return false;\n  }\n  if (ruleA.some(isRuleOrAtRule) || ruleB.some(isRuleOrAtRule)) {\n    return false;\n  }\n  return parent && (selectors.every(noVendor) || sameVendor(a, b));\n}\n\n/**\n * @param {import('postcss').ChildNode} node\n * @return {boolean}\n */\nfunction isRuleOrAtRule(node) {\n  return node.type === 'rule' || node.type === 'atrule';\n}\n/**\n * @param {import('postcss').ChildNode} node\n * @return {node is import('postcss').Declaration}\n */\nfunction isDeclaration(node) {\n  return node.type === 'decl';\n}\n\n/**\n * Retrieves or initializes virtual metadata for a PostCSS rule.\n *\n * This metadata caches selectors and declarations to avoid expensive AST\n * re-parsing, especially for the selectors.\n *\n * @param {import('postcss').Rule} rule The PostCSS rule to get metadata for.\n * @param {WeakMap<import('postcss').Rule, RuleMeta>} [ruleMeta] The metadata cache.\n * @return {RuleMeta} The rule's virtual metadata.\n */\nfunction getMeta(rule, ruleMeta) {\n  if (ruleMeta && rule) {\n    let meta = ruleMeta.get(rule);\n    if (!meta && rule.nodes) {\n      meta = {\n        selectors: rule.selectors,\n        declarations: rule.nodes.filter(isDeclaration),\n        dirty: false,\n      };\n      ruleMeta.set(rule, meta);\n    }\n    return meta ?? { selectors: [], declarations: [], dirty: false };\n  }\n  return {\n    selectors: rule?.selectors ?? [],\n    declarations: rule?.nodes?.filter(isDeclaration) ?? [],\n    dirty: false,\n  };\n}\n\n/**\n * Commits virtual metadata changes back to the actual PostCSS rule.\n *\n * @param {import('postcss').Rule} rule The PostCSS rule to flush.\n * @param {WeakMap<import('postcss').Rule, RuleMeta>} ruleMeta The metadata cache.\n */\nfunction flush(rule, ruleMeta) {\n  const meta = ruleMeta.get(rule);\n  if (meta && meta.dirty) {\n    rule.selector = meta.selectors.join(',');\n    meta.dirty = false;\n  }\n}\n\n/**\n * @param {import('postcss').Rule} rule\n * @return {import('postcss').Declaration[]}\n */\nfunction getDecls(rule) {\n  return rule.nodes.filter(isDeclaration);\n}\n\n/**\n * @param {...import('postcss').Rule} rules\n * @return {number}\n */\nfunction ruleLength(...rules) {\n  return rules.map((r) => (r.nodes.length ? String(r) : '')).join('').length;\n}\n\n/**\n * @param {string} prop\n * @return {{prefix: string?, base:string?, rest:string[]}}\n */\nfunction splitProp(prop) {\n  // Treat vendor prefixed properties as if they were unprefixed;\n  // moving them when combined with non-prefixed properties can\n  // cause issues. e.g. moving -webkit-background-clip when there\n  // is a background shorthand definition.\n\n  const parts = prop.split('-');\n  if (prop[0] !== '-') {\n    return {\n      prefix: '',\n      base: parts[0],\n      rest: parts.slice(1),\n    };\n  }\n  // Don't split css variables\n  if (prop[1] === '-') {\n    return {\n      prefix: null,\n      base: null,\n      rest: [prop],\n    };\n  }\n  // Found prefix\n  return {\n    prefix: parts[1],\n    base: parts[2],\n    rest: parts.slice(3),\n  };\n}\n\n/**\n * @param {string} propA\n * @param {string} propB\n * @return {boolean}\n */\nfunction isConflictingProp(propA, propB) {\n  if (propA === propB) {\n    // Same specificity\n    return true;\n  }\n  const a = splitProp(propA);\n  const b = splitProp(propB);\n  // Don't resort css variables\n  if (!a.base && !b.base) {\n    return true;\n  }\n\n  // Different base and none is `place`;\n  if (a.base !== b.base && a.base !== 'place' && b.base !== 'place') {\n    return false;\n  }\n\n  // Conflict if rest-count mismatches\n  if (a.rest.length !== b.rest.length) {\n    return true;\n  }\n\n  /* Do not merge conflicting border properties */\n  if (a.base === 'border') {\n    const allRestProps = new Set([...a.rest, ...b.rest]);\n    if (\n      allRestProps.has('image') ||\n      allRestProps.has('width') ||\n      allRestProps.has('color') ||\n      allRestProps.has('style')\n    ) {\n      return true;\n    }\n  }\n  // Conflict if rest parameters are equal (same but unprefixed)\n  return a.rest.every((s, index) => b.rest[index] === s);\n}\n\n/**\n * @param {import('postcss').Rule} first\n * @param {import('postcss').Rule} second\n * @return {boolean} merged\n */\nfunction mergeParents(first, second) {\n  // Null check for detached rules\n  if (!first.parent || !second.parent) {\n    return false;\n  }\n\n  // Check if parents share node\n  if (first.parent === second.parent) {\n    return false;\n  }\n\n  // sameParent() already called by canMerge()\n\n  second.remove();\n  first.parent.append(second);\n  return true;\n}\n\n/**\n * @param {import('postcss').Rule} first\n * @param {import('postcss').Rule} second\n * @param {string[]} browsers\n * @param {Map<string, boolean>} compatibilityCache\n * @param {WeakSet<import('postcss').Rule>} ruleCache\n * @param {WeakMap<import('postcss').Rule, RuleMeta>} ruleMeta\n * @return {import('postcss').Rule} mergedRule\n */\nfunction partialMerge(\n  first,\n  second,\n  browsers,\n  compatibilityCache,\n  ruleCache,\n  ruleMeta\n) {\n  if (ruleMeta) {\n    flush(first, ruleMeta);\n  }\n  const metaFirst = getMeta(first, ruleMeta);\n  const metaSecond = getMeta(second, ruleMeta);\n  let intersection = intersect(metaFirst.declarations, metaSecond.declarations);\n  if (intersection.length === 0) {\n    return second;\n  }\n  let nextRule = second.next();\n  if (!nextRule) {\n    // Grab next cousin\n    /** @type {any} */\n    const parentSibling =\n      /** @type {import('postcss').Container<import('postcss').ChildNode>} */ (\n        second.parent\n      ).next();\n    nextRule = parentSibling && parentSibling.nodes && parentSibling.nodes[0];\n  }\n  if (\n    nextRule?.type === 'rule' &&\n    canMerge(\n      second,\n      nextRule,\n      browsers,\n      compatibilityCache,\n      ruleCache,\n      ruleMeta\n    )\n  ) {\n    const metaNext = getMeta(nextRule, ruleMeta);\n    let nextIntersection = intersect(\n      metaSecond.declarations,\n      metaNext.declarations\n    );\n    if (nextIntersection.length > intersection.length) {\n      mergeParents(second, nextRule);\n      first = second;\n      second = nextRule;\n      intersection = nextIntersection;\n    }\n  }\n\n  const metaFirstActual = getMeta(first, ruleMeta);\n  const metaSecondActual = getMeta(second, ruleMeta);\n  let firstDecls = [...metaFirstActual.declarations];\n  let secondDecls = [...metaSecondActual.declarations];\n\n  // Filter out intersections with later conflicts in First\n  intersection = intersection.filter((decl, intersectIndex) => {\n    const indexOfDecl = indexOfDeclaration(firstDecls, decl);\n    const nextConflictInFirst = firstDecls\n      .slice(indexOfDecl + 1)\n      .filter((d) => isConflictingProp(d.prop, decl.prop));\n    if (nextConflictInFirst.length === 0) {\n      return true;\n    }\n    const nextConflictInIntersection = intersection\n      .slice(intersectIndex + 1)\n      .filter((d) => isConflictingProp(d.prop, decl.prop));\n    if (nextConflictInFirst.length !== nextConflictInIntersection.length) {\n      return false;\n    }\n    return nextConflictInFirst.every((d, index) =>\n      declarationIsEqual(d, nextConflictInIntersection[index])\n    );\n  });\n\n  // Filter out intersections with previous conflicts in Second\n  intersection = intersection.filter((decl) => {\n    const nextConflictIndex = secondDecls.findIndex((d) =>\n      isConflictingProp(d.prop, decl.prop)\n    );\n    if (nextConflictIndex === -1) {\n      return false;\n    }\n    if (!declarationIsEqual(secondDecls[nextConflictIndex], decl)) {\n      return false;\n    }\n    if (\n      decl.prop.toLowerCase() !== 'direction' &&\n      decl.prop.toLowerCase() !== 'unicode-bidi' &&\n      secondDecls.some(\n        (declaration) => declaration.prop.toLowerCase() === 'all'\n      )\n    ) {\n      return false;\n    }\n    secondDecls.splice(nextConflictIndex, 1);\n    return true;\n  });\n\n  if (intersection.length === 0) {\n    // Nothing to merge\n    return second;\n  }\n\n  const receivingBlock = second.clone();\n  const firstSelectors = metaFirstActual.selectors;\n  const secondSelectors = metaSecondActual.selectors;\n\n  receivingBlock.selector = [...firstSelectors, ...secondSelectors].join();\n  receivingBlock.nodes = [];\n\n  /** @type {import('postcss').Container<import('postcss').ChildNode>} */ (\n    second.parent\n  ).insertBefore(second, receivingBlock);\n\n  const firstClone = first.clone({ selectors: firstSelectors });\n  const secondClone = second.clone({ selectors: secondSelectors });\n\n  /**\n   * @param {function(import('postcss').Declaration):void} callback\n   * @this void\n   * @return {function(import('postcss').Declaration)}\n   */\n  function moveDecl(callback) {\n    return (decl) => {\n      if (indexOfDeclaration(intersection, decl) !== -1) {\n        callback.call(this, decl);\n      }\n    };\n  }\n  firstClone.walkDecls(\n    moveDecl((decl) => {\n      decl.remove();\n      receivingBlock.append(decl);\n    })\n  );\n  secondClone.walkDecls(moveDecl((decl) => decl.remove()));\n\n  // Ensure original rules are flushed for accurate length comparison\n  if (ruleMeta) {\n    flush(first, ruleMeta);\n    flush(second, ruleMeta);\n  }\n\n  const merged = ruleLength(firstClone, receivingBlock, secondClone);\n  const original = ruleLength(first, second);\n  if (merged < original) {\n    first.replaceWith(firstClone);\n    second.replaceWith(secondClone);\n    [firstClone, receivingBlock, secondClone].forEach((r) => {\n      if (r.nodes.length === 0) {\n        r.remove();\n      }\n    });\n    if (!secondClone.parent) {\n      ruleCache?.add(receivingBlock);\n      return receivingBlock;\n    }\n    ruleCache?.add(receivingBlock);\n    ruleCache?.add(secondClone);\n    ruleMeta?.delete(first);\n    ruleMeta?.delete(second);\n    return secondClone;\n  } else {\n    receivingBlock.remove();\n    return second;\n  }\n}\n\n/**\n * @param {string[]} browsers\n * @param {Map<string, boolean>} compatibilityCache\n * @param {WeakSet<import('postcss').Rule>} ruleCache\n * @param {WeakMap<import('postcss').Rule, RuleMeta>} ruleMeta\n * @return {{ merger: function(import('postcss').Rule): void, clean: function(): void }}\n */\nfunction selectorMerger(browsers, compatibilityCache, ruleCache, ruleMeta) {\n  /** @type {import('postcss').Rule | null} */\n  let cache = null;\n  return {\n    merger(rule) {\n      // Prime the cache with the first rule, or alternately ensure that it is\n      // safe to merge both declarations before continuing\n      if (\n        !cache ||\n        !canMerge(\n          rule,\n          cache,\n          browsers,\n          compatibilityCache,\n          ruleCache,\n          ruleMeta\n        )\n      ) {\n        if (cache) {\n          flush(cache, ruleMeta);\n        }\n        cache = rule;\n        return;\n      }\n      // Ensure that we don't deduplicate the same rule; this is sometimes\n      // caused by a partial merge\n      if (cache === rule) {\n        cache = rule;\n        return;\n      }\n\n      // Parents merge: check if the rules have same parents, but not same parent nodes\n      mergeParents(cache, rule);\n\n      // Merge when declarations are exactly equal\n      // e.g. h1 { color: red } h2 { color: red }\n      if (\n        sameDeclarationsAndOrder(\n          getMeta(rule, ruleMeta).declarations,\n          getMeta(cache, ruleMeta).declarations\n        )\n      ) {\n        const metaRule = getMeta(rule, ruleMeta);\n        const metaCache = getMeta(cache, ruleMeta);\n        metaRule.selectors = [...metaCache.selectors, ...metaRule.selectors];\n        metaRule.dirty = true;\n        cache.remove();\n        ruleMeta?.delete(cache);\n        cache = rule;\n        ruleCache?.add(rule);\n        return;\n      }\n      // Merge when both selectors are exactly equal\n      // e.g. a { color: blue } a { font-weight: bold }\n      if (\n        getMeta(cache, ruleMeta).selectors.join(',') ===\n        getMeta(rule, ruleMeta).selectors.join(',')\n      ) {\n        const cachedDecls = getMeta(cache, ruleMeta).declarations;\n        rule.walk((node) => {\n          if (\n            node.type === 'decl' &&\n            indexOfDeclaration(cachedDecls, node) !== -1\n          ) {\n            node.remove();\n            return;\n          }\n          /** @type {import('postcss').Rule} */ (cache).append(node);\n        });\n        getMeta(cache, ruleMeta).declarations = getDecls(cache);\n        rule.remove();\n        ruleMeta?.delete(rule);\n        return;\n      }\n      // Partial merge: check if the rule contains a subset of the last; if\n      // so create a joined selector with the subset, if smaller.\n      cache = partialMerge(\n        cache,\n        rule,\n        browsers,\n        compatibilityCache,\n        ruleCache,\n        ruleMeta\n      );\n    },\n    // Flushes any remaining rule in the cache to avoid memory leaks.\n    clean() {\n      if (cache) {\n        flush(cache, ruleMeta);\n      }\n    },\n  };\n}\n\n/**\n * @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions\n * @typedef {Pick<browserslist.Options, 'stats' | 'path' | 'env'>} BrowserslistOptions\n * @typedef {AutoprefixerOptions & BrowserslistOptions} Options\n */\n\n/**\n * @type {import('postcss').PluginCreator<Options>}\n * @param {Options} opts\n * @return {import('postcss').Plugin}\n */\nfunction pluginCreator(opts = {}) {\n  return {\n    postcssPlugin: 'postcss-merge-rules',\n\n    /**\n     * @param {import('postcss').Result & {opts: BrowserslistOptions & {file?: string}}} result\n     */\n    prepare(result) {\n      const { stats, env, from, file } = result.opts || {};\n      const browsers = browserslist(opts.overrideBrowserslist, {\n        stats: opts.stats || stats,\n        path: opts.path || dirname(from || file || __filename),\n        env: opts.env || env,\n      });\n\n      const compatibilityCache = new Map();\n\n      // Use WeakSet and WeakMap to avoid memory leaks because the keys are objects.\n      const ruleCache = new WeakSet();\n      const ruleMeta = new WeakMap();\n\n      return {\n        OnceExit(css) {\n          const { merger, clean } = selectorMerger(\n            browsers,\n            compatibilityCache,\n            ruleCache,\n            ruleMeta\n          );\n          css.walkRules(merger);\n          clean();\n        },\n      };\n    },\n  };\n}\n\npluginCreator.postcss = true;\nmodule.exports = pluginCreator;\n"]}