{"version":3,"sources":["jsdelivr-header.js","/npm/@parameter1/build-match-regex@2.0.0/src/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNO,gBAAiB,qCAqCT,EACb,SACA,WACA,QACA,eAAc,GACZ,CAAC,KACH,MAAM,EAAQ,EAAc,SAAM,EAC5B,EAAS,YAAY,GAAQ,QAAQ,SAAU,KAAK,MAAM,KAAK,QAAQ,GAAM,IAEnF,MAAiB,WAAb,EAEY,QAAV,EAAwB,IAAI,OAAO,GAAG,EAAO,KAAK,GAAM,IAAI,MAAK,KAAK,OAAQ,GAE3E,IAAI,OAAO,IAAI,EAAO,KAAK,OAAQ,GAE3B,SAAb,EAEY,QAAV,EAAwB,IAAI,OAAO,GAAG,EAAO,KAAK,GAAM,GAAG,OAAM,KAAK,OAAQ,GAE3E,IAAI,OAAO,GAAG,EAAO,KAAK,QAAS,GAE3B,UAAb,EAEY,QAAV,EAAwB,IAAI,OAAO,GAAG,EAAO,KAAK,GAAM,IAAI,OAAM,KAAK,OAAQ,GAE5E,IAAI,OAAO,IAAI,EAAO,KAAK,QAAS,GAK/B,QAAV,EAAwB,IAAI,OAAO,GAAG,EAAO,KAAK,OAAQ,GAEvD,IAAI,OAAO,GAAG,EAAO,KAAK,GAAM,QAAQ,OAAM,KAAK,MAAO,EAAM","file":"/npm/@parameter1/build-match-regex@2.0.0/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@parameter1/build-match-regex@2.0.0/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","import escapeRegex from 'escape-string-regexp';\n\n/**\n * Assuming a phrase of `quick brown fox`...\n *\n * Position `starts`:\n *  - Match: `any`\n *    - Where a value starts with `quick`, `brown`, or `fox`\n *    - `/^quick|^brown|^fox/i`\n *  - Match: `all`\n *    - Where a value literally starts with `quick brown fox`\n *    - `/^quick brown fox/i`\n *\n * Position `ends`:\n *  - Match: `any`\n *    - Where a value ends with `quick`, `brown`, or `fox`\n *    - `/quick$|brown$|fox$/i`\n *  - Match: `all`\n *    - Where a value literally ends with `quick brown fox`\n *    - `/quick brown fox$/i`\n *\n * Position: `exact`:\n *  - Match: `any`\n *    - Where a value exactly matches `quick`, `brown`, or `fox`\n *    - `/^quick$|^brown$|^fox$/i`\n *  - Match: `all`\n *    - Where a value exactly matches `quick brown fox`\n *    - `/^quick brown fox$/i`\n *\n * Position `contains`:\n *  - Match: `any`\n *    - Where a value contains any partial matches of `quick`, `brown`, or `fox`\n *    - `/quick|brown|fox/i`\n *  - Match: `all`\n *    - Where a value contains all partial matches of `quick`, `brown`, and `fox`\n *    - `/(?=.*quick)(?=.*brown)(?=.*fox)/i`\n */\nexport default ({\n  phrase,\n  position,\n  words,\n  insensitive = true,\n} = {}) => {\n  const flags = insensitive ? 'i' : undefined;\n  const tokens = escapeRegex(phrase).replace(/\\s\\s+/g, ' ').split(' ').filter((v) => v);\n\n  if (position === 'starts') {\n    // /^quick|^brown|^fox/i\n    if (words === 'any') return new RegExp(`${tokens.map((t) => `^${t}`).join('|')}`, flags);\n    // /^quick brown fox/i\n    return new RegExp(`^${tokens.join(' ')}`, flags);\n  }\n  if (position === 'ends') {\n    // /quick$|brown$|fox$/i\n    if (words === 'any') return new RegExp(`${tokens.map((t) => `${t}$`).join('|')}`, flags);\n    // /quick brown fox$/i\n    return new RegExp(`${tokens.join(' ')}$`, flags);\n  }\n  if (position === 'exact') {\n    // /^quick$|^brown$|^fox$/i\n    if (words === 'any') return new RegExp(`${tokens.map((t) => `^${t}$`).join('|')}`, flags);\n    // /^quick brown fox$/i\n    return new RegExp(`^${tokens.join(' ')}$`, flags);\n  }\n\n  // Contains...\n  // /quick|brown|fox/i\n  if (words === 'any') return new RegExp(`${tokens.join('|')}`, flags);\n  // /(?=.*quick)(?=.*brown)(?=.*fox)/i\n  return new RegExp(`${tokens.map((t) => `(?=.*${t})`).join('')}`, flags);\n};\n"]}