From 39fb78a3b002c1877fb240872b8db57f77c0bc9f Mon Sep 17 00:00:00 2001 From: Link- Date: Thu, 29 Apr 2021 21:43:57 +0000 Subject: [PATCH] Update build --- bin/starred_search | 18543 +++++++++++++++++++++---------------------- 1 file changed, 9267 insertions(+), 9276 deletions(-) diff --git a/bin/starred_search b/bin/starred_search index 0cb9154..f4f4730 100755 --- a/bin/starred_search +++ b/bin/starred_search @@ -1,1814 +1,1924 @@ #!/usr/bin/env node -module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ var threw = true; -/******/ try { -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ threw = false; -/******/ } finally { -/******/ if(threw) delete installedModules[moduleId]; -/******/ } -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ __webpack_require__.ab = __dirname + "/"; -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(323); -/******/ }; -/******/ // initialize runtime -/******/ runtime(__webpack_require__); -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ({ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ -/***/ 4: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 2068: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; +/* module decorator */ module = __nccwpck_require__.nmd(module); -var utils = __webpack_require__(397); -var bind = __webpack_require__(556); -var Axios = __webpack_require__(363); -var mergeConfig = __webpack_require__(978); -var defaults = __webpack_require__(857); - -/** - * Create an instance of Axios - * - * @param {Object} defaultConfig The default config for the instance - * @return {Axios} A new instance of Axios - */ -function createInstance(defaultConfig) { - var context = new Axios(defaultConfig); - var instance = bind(Axios.prototype.request, context); +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; - // Copy axios.prototype to instance - utils.extend(instance, Axios.prototype, context); +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; - // Copy context to instance - utils.extend(instance, context); +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; - return instance; -} +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; -// Create the default instance to be exported -var axios = createInstance(defaults); +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); -// Expose Axios class to allow class inheritance -axios.Axios = Axios; + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); -// Factory for creating new instances -axios.create = function create(instanceConfig) { - return createInstance(mergeConfig(axios.defaults, instanceConfig)); + return value; + }, + enumerable: true, + configurable: true + }); }; -// Expose Cancel & CancelToken -axios.Cancel = __webpack_require__(774); -axios.CancelToken = __webpack_require__(143); -axios.isCancel = __webpack_require__(565); +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = __nccwpck_require__(6931); + } -// Expose all/spread -axios.all = function all(promises) { - return Promise.all(promises); -}; -axios.spread = __webpack_require__(806); + const offset = isBackground ? 10 : 0; + const styles = {}; -// Expose isAxiosError -axios.isAxiosError = __webpack_require__(543); + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } -module.exports = axios; + return styles; +}; -// Allow use of default import syntax in TypeScript -module.exports.default = axios; +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], -/***/ }), + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; -/***/ 18: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; -exports.alphasort = alphasort -exports.alphasorti = alphasorti -exports.setopts = setopts -exports.ownProp = ownProp -exports.makeAbs = makeAbs -exports.finish = finish -exports.mark = mark -exports.isIgnored = isIgnored -exports.childrenIgnored = childrenIgnored + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; -function ownProp (obj, field) { - return Object.prototype.hasOwnProperty.call(obj, field) -} + group[styleName] = styles[styleName]; -var path = __webpack_require__(622) -var minimatch = __webpack_require__(689) -var isAbsolute = __webpack_require__(829) -var Minimatch = minimatch.Minimatch + codes.set(style[0], style[1]); + } -function alphasorti (a, b) { - return a.toLowerCase().localeCompare(b.toLowerCase()) -} + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } -function alphasort (a, b) { - return a.localeCompare(b) -} + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); -function setupIgnores (self, options) { - self.ignore = options.ignore || [] + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; - if (!Array.isArray(self.ignore)) - self.ignore = [self.ignore] + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); - if (self.ignore.length) { - self.ignore = self.ignore.map(ignoreMap) - } + return styles; } -// ignore patterns are always in dot:true mode. -function ignoreMap (pattern) { - var gmatcher = null - if (pattern.slice(-3) === '/**') { - var gpattern = pattern.replace(/(\/\*\*)+$/, '') - gmatcher = new Minimatch(gpattern, { dot: true }) - } +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); - return { - matcher: new Minimatch(pattern, { dot: true }), - gmatcher: gmatcher - } -} -function setopts (self, pattern, options) { - if (!options) - options = {} +/***/ }), - // base-matching: just use globstar for that. - if (options.matchBase && -1 === pattern.indexOf("/")) { - if (options.noglobstar) { - throw new Error("base matching requires globstar") - } - pattern = "**/" + pattern - } +/***/ 9482: +/***/ ((module) => { - self.silent = !!options.silent - self.pattern = pattern - self.strict = options.strict !== false - self.realpath = !!options.realpath - self.realpathCache = options.realpathCache || Object.create(null) - self.follow = !!options.follow - self.dot = !!options.dot - self.mark = !!options.mark - self.nodir = !!options.nodir - if (self.nodir) - self.mark = true - self.sync = !!options.sync - self.nounique = !!options.nounique - self.nonull = !!options.nonull - self.nosort = !!options.nosort - self.nocase = !!options.nocase - self.stat = !!options.stat - self.noprocess = !!options.noprocess - self.absolute = !!options.absolute +const flagSymbol = Symbol('arg flag'); - self.maxLength = options.maxLength || Infinity - self.cache = options.cache || Object.create(null) - self.statCache = options.statCache || Object.create(null) - self.symlinks = options.symlinks || Object.create(null) - - setupIgnores(self, options) +function arg(opts, {argv = process.argv.slice(2), permissive = false, stopAtPositional = false} = {}) { + if (!opts) { + throw new Error('Argument specification object is required'); + } - self.changedCwd = false - var cwd = process.cwd() - if (!ownProp(options, "cwd")) - self.cwd = cwd - else { - self.cwd = path.resolve(options.cwd) - self.changedCwd = self.cwd !== cwd - } + const result = {_: []}; - self.root = options.root || path.resolve(self.cwd, "/") - self.root = path.resolve(self.root) - if (process.platform === "win32") - self.root = self.root.replace(/\\/g, "/") + const aliases = {}; + const handlers = {}; - // TODO: is an absolute `cwd` supposed to be resolved against `root`? - // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') - self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) - if (process.platform === "win32") - self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") - self.nomount = !!options.nomount + for (const key of Object.keys(opts)) { + if (!key) { + throw new TypeError('Argument key cannot be an empty string'); + } - // disable comments and negation in Minimatch. - // Note that they are not supported in Glob itself anyway. - options.nonegate = true - options.nocomment = true + if (key[0] !== '-') { + throw new TypeError(`Argument key must start with '-' but found: '${key}'`); + } - self.minimatch = new Minimatch(pattern, options) - self.options = self.minimatch.options -} + if (key.length === 1) { + throw new TypeError(`Argument key must have a name; singular '-' keys are not allowed: ${key}`); + } -function finish (self) { - var nou = self.nounique - var all = nou ? [] : Object.create(null) + if (typeof opts[key] === 'string') { + aliases[key] = opts[key]; + continue; + } - for (var i = 0, l = self.matches.length; i < l; i ++) { - var matches = self.matches[i] - if (!matches || Object.keys(matches).length === 0) { - if (self.nonull) { - // do like the shell, and spit out the literal glob - var literal = self.minimatch.globSet[i] - if (nou) - all.push(literal) - else - all[literal] = true - } - } else { - // had matches - var m = Object.keys(matches) - if (nou) - all.push.apply(all, m) - else - m.forEach(function (m) { - all[m] = true - }) - } - } + let type = opts[key]; + let isFlag = false; - if (!nou) - all = Object.keys(all) + if (Array.isArray(type) && type.length === 1 && typeof type[0] === 'function') { + const [fn] = type; + type = (value, name, prev = []) => { + prev.push(fn(value, name, prev[prev.length - 1])); + return prev; + }; + isFlag = fn === Boolean || fn[flagSymbol] === true; + } else if (typeof type === 'function') { + isFlag = type === Boolean || type[flagSymbol] === true; + } else { + throw new TypeError(`Type missing or not a function or valid array type: ${key}`); + } - if (!self.nosort) - all = all.sort(self.nocase ? alphasorti : alphasort) + if (key[1] !== '-' && key.length > 2) { + throw new TypeError(`Short argument keys (with a single hyphen) must have only one character: ${key}`); + } - // at *some* point we statted all of these - if (self.mark) { - for (var i = 0; i < all.length; i++) { - all[i] = self._mark(all[i]) - } - if (self.nodir) { - all = all.filter(function (e) { - var notDir = !(/\/$/.test(e)) - var c = self.cache[e] || self.cache[makeAbs(self, e)] - if (notDir && c) - notDir = c !== 'DIR' && !Array.isArray(c) - return notDir - }) - } - } + handlers[key] = [type, isFlag]; + } - if (self.ignore.length) - all = all.filter(function(m) { - return !isIgnored(self, m) - }) + for (let i = 0, len = argv.length; i < len; i++) { + const wholeArg = argv[i]; - self.found = all -} + if (stopAtPositional && result._.length > 0) { + result._ = result._.concat(argv.slice(i)); + break; + } -function mark (self, p) { - var abs = makeAbs(self, p) - var c = self.cache[abs] - var m = p - if (c) { - var isDir = c === 'DIR' || Array.isArray(c) - var slash = p.slice(-1) === '/' + if (wholeArg === '--') { + result._ = result._.concat(argv.slice(i + 1)); + break; + } - if (isDir && !slash) - m += '/' - else if (!isDir && slash) - m = m.slice(0, -1) + if (wholeArg.length > 1 && wholeArg[0] === '-') { + /* eslint-disable operator-linebreak */ + const separatedArguments = (wholeArg[1] === '-' || wholeArg.length === 2) + ? [wholeArg] + : wholeArg.slice(1).split('').map(a => `-${a}`); + /* eslint-enable operator-linebreak */ - if (m !== p) { - var mabs = makeAbs(self, m) - self.statCache[mabs] = self.statCache[abs] - self.cache[mabs] = self.cache[abs] - } - } + for (let j = 0; j < separatedArguments.length; j++) { + const arg = separatedArguments[j]; + const [originalArgName, argStr] = arg[1] === '-' ? arg.split(/=(.*)/, 2) : [arg, undefined]; - return m -} + let argName = originalArgName; + while (argName in aliases) { + argName = aliases[argName]; + } -// lotta situps... -function makeAbs (self, f) { - var abs = f - if (f.charAt(0) === '/') { - abs = path.join(self.root, f) - } else if (isAbsolute(f) || f === '') { - abs = f - } else if (self.changedCwd) { - abs = path.resolve(self.cwd, f) - } else { - abs = path.resolve(f) - } + if (!(argName in handlers)) { + if (permissive) { + result._.push(arg); + continue; + } else { + const err = new Error(`Unknown or unexpected option: ${originalArgName}`); + err.code = 'ARG_UNKNOWN_OPTION'; + throw err; + } + } - if (process.platform === 'win32') - abs = abs.replace(/\\/g, '/') + const [type, isFlag] = handlers[argName]; - return abs -} + if (!isFlag && ((j + 1) < separatedArguments.length)) { + throw new TypeError(`Option requires argument (but was followed by another short argument): ${originalArgName}`); + } + if (isFlag) { + result[argName] = type(true, argName, result[argName]); + } else if (argStr === undefined) { + if ( + argv.length < i + 2 || + ( + argv[i + 1].length > 1 && + (argv[i + 1][0] === '-') && + !( + argv[i + 1].match(/^-?\d*(\.(?=\d))?\d*$/) && + ( + type === Number || + // eslint-disable-next-line no-undef + (typeof BigInt !== 'undefined' && type === BigInt) + ) + ) + ) + ) { + const extended = originalArgName === argName ? '' : ` (alias for ${argName})`; + throw new Error(`Option requires argument: ${originalArgName}${extended}`); + } -// Return true, if pattern ends with globstar '**', for the accompanying parent directory. -// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents -function isIgnored (self, path) { - if (!self.ignore.length) - return false + result[argName] = type(argv[i + 1], argName, result[argName]); + ++i; + } else { + result[argName] = type(argStr, argName, result[argName]); + } + } + } else { + result._.push(wholeArg); + } + } - return self.ignore.some(function(item) { - return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) - }) + return result; } -function childrenIgnored (self, path) { - if (!self.ignore.length) - return false +arg.flag = fn => { + fn[flagSymbol] = true; + return fn; +}; - return self.ignore.some(function(item) { - return !!(item.gmatcher && item.gmatcher.match(path)) - }) -} +// Utility types +arg.COUNT = arg.flag((v, name, existingCount) => (existingCount || 0) + 1); + +module.exports = arg; /***/ }), -/***/ 87: -/***/ (function(module) { +/***/ 6545: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = require("os"); +module.exports = __nccwpck_require__(2618); /***/ }), -/***/ 96: -/***/ (function(module) { +/***/ 8104: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = {"name":"axios","version":"0.21.1","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test && bundlesize","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://github.com/axios/axios","devDependencies":{"bundlesize":"^0.17.0","coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^5.2.0","sinon":"^4.5.0","typescript":"^2.8.1","url-search-params":"^0.10.0","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.10.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}; +"use strict"; -/***/ }), -/***/ 104: -/***/ (function(module, __unusedexports, __webpack_require__) { +var utils = __nccwpck_require__(328); +var settle = __nccwpck_require__(3211); +var buildFullPath = __nccwpck_require__(1934); +var buildURL = __nccwpck_require__(646); +var http = __nccwpck_require__(8605); +var https = __nccwpck_require__(7211); +var httpFollow = __nccwpck_require__(7707).http; +var httpsFollow = __nccwpck_require__(7707).https; +var url = __nccwpck_require__(8835); +var zlib = __nccwpck_require__(8761); +var pkg = __nccwpck_require__(696); +var createError = __nccwpck_require__(5226); +var enhanceError = __nccwpck_require__(1516); -/* MIT license */ -/* eslint-disable no-mixed-operators */ -const cssKeywords = __webpack_require__(618); +var isHttps = /https:?/; -// NOTE: conversions should only return primitive values (i.e. arrays, or -// values that give correct `typeof` results). -// do not use box values types (i.e. Number(), String(), etc.) +/** + * + * @param {http.ClientRequestArgs} options + * @param {AxiosProxyConfig} proxy + * @param {string} location + */ +function setProxy(options, proxy, location) { + options.hostname = proxy.host; + options.host = proxy.host; + options.port = proxy.port; + options.path = location; -const reverseKeywords = {}; -for (const key of Object.keys(cssKeywords)) { - reverseKeywords[cssKeywords[key]] = key; -} + // Basic proxy authorization + if (proxy.auth) { + var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64'); + options.headers['Proxy-Authorization'] = 'Basic ' + base64; + } -const convert = { - rgb: {channels: 3, labels: 'rgb'}, - hsl: {channels: 3, labels: 'hsl'}, - hsv: {channels: 3, labels: 'hsv'}, - hwb: {channels: 3, labels: 'hwb'}, - cmyk: {channels: 4, labels: 'cmyk'}, - xyz: {channels: 3, labels: 'xyz'}, - lab: {channels: 3, labels: 'lab'}, - lch: {channels: 3, labels: 'lch'}, - hex: {channels: 1, labels: ['hex']}, - keyword: {channels: 1, labels: ['keyword']}, - ansi16: {channels: 1, labels: ['ansi16']}, - ansi256: {channels: 1, labels: ['ansi256']}, - hcg: {channels: 3, labels: ['h', 'c', 'g']}, - apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, - gray: {channels: 1, labels: ['gray']} -}; + // If a proxy is used, any redirects must also pass through the proxy + options.beforeRedirect = function beforeRedirect(redirection) { + redirection.headers.host = redirection.host; + setProxy(redirection, proxy, redirection.href); + }; +} -module.exports = convert; +/*eslint consistent-return:0*/ +module.exports = function httpAdapter(config) { + return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) { + var resolve = function resolve(value) { + resolvePromise(value); + }; + var reject = function reject(value) { + rejectPromise(value); + }; + var data = config.data; + var headers = config.headers; -// Hide .channels and .labels properties -for (const model of Object.keys(convert)) { - if (!('channels' in convert[model])) { - throw new Error('missing channels property: ' + model); - } + // Set User-Agent (required by some servers) + // Only set header if it hasn't been set in config + // See https://github.com/axios/axios/issues/69 + if (!headers['User-Agent'] && !headers['user-agent']) { + headers['User-Agent'] = 'axios/' + pkg.version; + } - if (!('labels' in convert[model])) { - throw new Error('missing channel labels property: ' + model); - } + if (data && !utils.isStream(data)) { + if (Buffer.isBuffer(data)) { + // Nothing to do... + } else if (utils.isArrayBuffer(data)) { + data = Buffer.from(new Uint8Array(data)); + } else if (utils.isString(data)) { + data = Buffer.from(data, 'utf-8'); + } else { + return reject(createError( + 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', + config + )); + } - if (convert[model].labels.length !== convert[model].channels) { - throw new Error('channel and label counts mismatch: ' + model); - } + // Add Content-Length header if data exists + headers['Content-Length'] = data.length; + } - const {channels, labels} = convert[model]; - delete convert[model].channels; - delete convert[model].labels; - Object.defineProperty(convert[model], 'channels', {value: channels}); - Object.defineProperty(convert[model], 'labels', {value: labels}); -} + // HTTP basic authentication + var auth = undefined; + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password || ''; + auth = username + ':' + password; + } -convert.rgb.hsl = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const min = Math.min(r, g, b); - const max = Math.max(r, g, b); - const delta = max - min; - let h; - let s; + // Parse url + var fullPath = buildFullPath(config.baseURL, config.url); + var parsed = url.parse(fullPath); + var protocol = parsed.protocol || 'http:'; - if (max === min) { - h = 0; - } else if (r === max) { - h = (g - b) / delta; - } else if (g === max) { - h = 2 + (b - r) / delta; - } else if (b === max) { - h = 4 + (r - g) / delta; - } + if (!auth && parsed.auth) { + var urlAuth = parsed.auth.split(':'); + var urlUsername = urlAuth[0] || ''; + var urlPassword = urlAuth[1] || ''; + auth = urlUsername + ':' + urlPassword; + } - h = Math.min(h * 60, 360); + if (auth) { + delete headers.Authorization; + } - if (h < 0) { - h += 360; - } + var isHttpsRequest = isHttps.test(protocol); + var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; - const l = (min + max) / 2; + var options = { + path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), + method: config.method.toUpperCase(), + headers: headers, + agent: agent, + agents: { http: config.httpAgent, https: config.httpsAgent }, + auth: auth + }; - if (max === min) { - s = 0; - } else if (l <= 0.5) { - s = delta / (max + min); - } else { - s = delta / (2 - max - min); - } + if (config.socketPath) { + options.socketPath = config.socketPath; + } else { + options.hostname = parsed.hostname; + options.port = parsed.port; + } - return [h, s * 100, l * 100]; -}; + var proxy = config.proxy; + if (!proxy && proxy !== false) { + var proxyEnv = protocol.slice(0, -1) + '_proxy'; + var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()]; + if (proxyUrl) { + var parsedProxyUrl = url.parse(proxyUrl); + var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY; + var shouldProxy = true; -convert.rgb.hsv = function (rgb) { - let rdif; - let gdif; - let bdif; - let h; - let s; + if (noProxyEnv) { + var noProxy = noProxyEnv.split(',').map(function trim(s) { + return s.trim(); + }); - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const v = Math.max(r, g, b); - const diff = v - Math.min(r, g, b); - const diffc = function (c) { - return (v - c) / 6 / diff + 1 / 2; - }; + shouldProxy = !noProxy.some(function proxyMatch(proxyElement) { + if (!proxyElement) { + return false; + } + if (proxyElement === '*') { + return true; + } + if (proxyElement[0] === '.' && + parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) { + return true; + } - if (diff === 0) { - h = 0; - s = 0; - } else { - s = diff / v; - rdif = diffc(r); - gdif = diffc(g); - bdif = diffc(b); + return parsed.hostname === proxyElement; + }); + } - if (r === v) { - h = bdif - gdif; - } else if (g === v) { - h = (1 / 3) + rdif - bdif; - } else if (b === v) { - h = (2 / 3) + gdif - rdif; - } + if (shouldProxy) { + proxy = { + host: parsedProxyUrl.hostname, + port: parsedProxyUrl.port, + protocol: parsedProxyUrl.protocol + }; - if (h < 0) { - h += 1; - } else if (h > 1) { - h -= 1; - } - } + if (parsedProxyUrl.auth) { + var proxyUrlAuth = parsedProxyUrl.auth.split(':'); + proxy.auth = { + username: proxyUrlAuth[0], + password: proxyUrlAuth[1] + }; + } + } + } + } - return [ - h * 360, - s * 100, - v * 100 - ]; -}; + if (proxy) { + options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : ''); + setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); + } -convert.rgb.hwb = function (rgb) { - const r = rgb[0]; - const g = rgb[1]; - let b = rgb[2]; - const h = convert.rgb.hsl(rgb)[0]; - const w = 1 / 255 * Math.min(r, Math.min(g, b)); + var transport; + var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true); + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsProxy ? https : http; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + transport = isHttpsProxy ? httpsFollow : httpFollow; + } - b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); + if (config.maxBodyLength > -1) { + options.maxBodyLength = config.maxBodyLength; + } - return [h, w * 100, b * 100]; -}; + // Create the request + var req = transport.request(options, function handleResponse(res) { + if (req.aborted) return; -convert.rgb.cmyk = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; + // uncompress the response body transparently if required + var stream = res; - const k = Math.min(1 - r, 1 - g, 1 - b); - const c = (1 - r - k) / (1 - k) || 0; - const m = (1 - g - k) / (1 - k) || 0; - const y = (1 - b - k) / (1 - k) || 0; + // return the last request in case of redirects + var lastRequest = res.req || req; - return [c * 100, m * 100, y * 100, k * 100]; -}; -function comparativeDistance(x, y) { - /* - See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance - */ - return ( - ((x[0] - y[0]) ** 2) + - ((x[1] - y[1]) ** 2) + - ((x[2] - y[2]) ** 2) - ); -} + // if no content, is HEAD request or decompress disabled we should not decompress + if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) { + switch (res.headers['content-encoding']) { + /*eslint default-case:0*/ + case 'gzip': + case 'compress': + case 'deflate': + // add the unzipper to the body stream processing pipeline + stream = stream.pipe(zlib.createUnzip()); -convert.rgb.keyword = function (rgb) { - const reversed = reverseKeywords[rgb]; - if (reversed) { - return reversed; - } + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + } + } - let currentClosestDistance = Infinity; - let currentClosestKeyword; + var response = { + status: res.statusCode, + statusText: res.statusMessage, + headers: res.headers, + config: config, + request: lastRequest + }; - for (const keyword of Object.keys(cssKeywords)) { - const value = cssKeywords[keyword]; + if (config.responseType === 'stream') { + response.data = stream; + settle(resolve, reject, response); + } else { + var responseBuffer = []; + stream.on('data', function handleStreamData(chunk) { + responseBuffer.push(chunk); - // Compute comparative distance - const distance = comparativeDistance(rgb, value); + // make sure the content length is not over the maxContentLength if specified + if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) { + stream.destroy(); + reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded', + config, null, lastRequest)); + } + }); - // Check if its less, if so set as closest - if (distance < currentClosestDistance) { - currentClosestDistance = distance; - currentClosestKeyword = keyword; - } - } + stream.on('error', function handleStreamError(err) { + if (req.aborted) return; + reject(enhanceError(err, config, null, lastRequest)); + }); - return currentClosestKeyword; -}; + stream.on('end', function handleStreamEnd() { + var responseData = Buffer.concat(responseBuffer); + if (config.responseType !== 'arraybuffer') { + responseData = responseData.toString(config.responseEncoding); + if (!config.responseEncoding || config.responseEncoding === 'utf8') { + responseData = utils.stripBOM(responseData); + } + } -convert.keyword.rgb = function (keyword) { - return cssKeywords[keyword]; -}; + response.data = responseData; + settle(resolve, reject, response); + }); + } + }); -convert.rgb.xyz = function (rgb) { - let r = rgb[0] / 255; - let g = rgb[1] / 255; - let b = rgb[2] / 255; + // Handle errors + req.on('error', function handleRequestError(err) { + if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return; + reject(enhanceError(err, config, null, req)); + }); - // Assume sRGB - r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); - g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); - b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); + // Handle request timeout + if (config.timeout) { + // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. + // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. + // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. + // And then these socket which be hang up will devoring CPU little by little. + // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. + req.setTimeout(config.timeout, function handleRequestTimeout() { + req.abort(); + reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req)); + }); + } - const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + if (config.cancelToken) { + // Handle cancellation + config.cancelToken.promise.then(function onCanceled(cancel) { + if (req.aborted) return; - return [x * 100, y * 100, z * 100]; + req.abort(); + reject(cancel); + }); + } + + // Send the request + if (utils.isStream(data)) { + data.on('error', function handleStreamError(err) { + reject(enhanceError(err, config, null, req)); + }).pipe(req); + } else { + req.end(data); + } + }); }; -convert.rgb.lab = function (rgb) { - const xyz = convert.rgb.xyz(rgb); - let x = xyz[0]; - let y = xyz[1]; - let z = xyz[2]; - x /= 95.047; - y /= 100; - z /= 108.883; +/***/ }), - x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); +/***/ 3454: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - const l = (116 * y) - 16; - const a = 500 * (x - y); - const b = 200 * (y - z); +"use strict"; - return [l, a, b]; -}; -convert.hsl.rgb = function (hsl) { - const h = hsl[0] / 360; - const s = hsl[1] / 100; - const l = hsl[2] / 100; - let t2; - let t3; - let val; +var utils = __nccwpck_require__(328); +var settle = __nccwpck_require__(3211); +var cookies = __nccwpck_require__(1545); +var buildURL = __nccwpck_require__(646); +var buildFullPath = __nccwpck_require__(1934); +var parseHeaders = __nccwpck_require__(6455); +var isURLSameOrigin = __nccwpck_require__(3608); +var createError = __nccwpck_require__(5226); - if (s === 0) { - val = l * 255; - return [val, val, val]; - } +module.exports = function xhrAdapter(config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var requestData = config.data; + var requestHeaders = config.headers; - if (l < 0.5) { - t2 = l * (1 + s); - } else { - t2 = l + s - l * s; - } + if (utils.isFormData(requestData)) { + delete requestHeaders['Content-Type']; // Let the browser set it + } - const t1 = 2 * l - t2; + var request = new XMLHttpRequest(); - const rgb = [0, 0, 0]; - for (let i = 0; i < 3; i++) { - t3 = h + 1 / 3 * -(i - 1); - if (t3 < 0) { - t3++; - } + // HTTP basic authentication + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; + requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); + } - if (t3 > 1) { - t3--; - } + var fullPath = buildFullPath(config.baseURL, config.url); + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); - if (6 * t3 < 1) { - val = t1 + (t2 - t1) * 6 * t3; - } else if (2 * t3 < 1) { - val = t2; - } else if (3 * t3 < 2) { - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - } else { - val = t1; - } + // Set the request timeout in MS + request.timeout = config.timeout; - rgb[i] = val * 255; - } + // Listen for ready state + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } - return rgb; -}; + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } -convert.hsl.hsv = function (hsl) { - const h = hsl[0]; - let s = hsl[1] / 100; - let l = hsl[2] / 100; - let smin = s; - const lmin = Math.max(l, 0.01); + // Prepare the response + var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; + var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; - l *= 2; - s *= (l <= 1) ? l : 2 - l; - smin *= lmin <= 1 ? lmin : 2 - lmin; - const v = (l + s) / 2; - const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); + settle(resolve, reject, response); - return [h, sv * 100, v * 100]; -}; + // Clean up request + request = null; + }; -convert.hsv.rgb = function (hsv) { - const h = hsv[0] / 60; - const s = hsv[1] / 100; - let v = hsv[2] / 100; - const hi = Math.floor(h) % 6; + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } - const f = h - Math.floor(h); - const p = 255 * v * (1 - s); - const q = 255 * v * (1 - (s * f)); - const t = 255 * v * (1 - (s * (1 - f))); - v *= 255; + reject(createError('Request aborted', config, 'ECONNABORTED', request)); - switch (hi) { - case 0: - return [v, t, p]; - case 1: - return [q, v, p]; - case 2: - return [p, v, t]; - case 3: - return [p, q, v]; - case 4: - return [t, p, v]; - case 5: - return [v, p, q]; - } -}; + // Clean up request + request = null; + }; -convert.hsv.hsl = function (hsv) { - const h = hsv[0]; - const s = hsv[1] / 100; - const v = hsv[2] / 100; - const vmin = Math.max(v, 0.01); - let sl; - let l; + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(createError('Network Error', config, null, request)); - l = (2 - s) * v; - const lmin = (2 - s) * vmin; - sl = s * vmin; - sl /= (lmin <= 1) ? lmin : 2 - lmin; - sl = sl || 0; - l /= 2; + // Clean up request + request = null; + }; - return [h, sl * 100, l * 100]; -}; + // Handle timeout + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', + request)); -// http://dev.w3.org/csswg/css-color/#hwb-to-rgb -convert.hwb.rgb = function (hwb) { - const h = hwb[0] / 360; - let wh = hwb[1] / 100; - let bl = hwb[2] / 100; - const ratio = wh + bl; - let f; + // Clean up request + request = null; + }; - // Wh + bl cant be > 1 - if (ratio > 1) { - wh /= ratio; - bl /= ratio; - } + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + if (utils.isStandardBrowserEnv()) { + // Add xsrf header + var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? + cookies.read(config.xsrfCookieName) : + undefined; - const i = Math.floor(6 * h); - const v = 1 - bl; - f = 6 * h - i; + if (xsrfValue) { + requestHeaders[config.xsrfHeaderName] = xsrfValue; + } + } - if ((i & 0x01) !== 0) { - f = 1 - f; - } + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders, function setRequestHeader(val, key) { + if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { + // Remove Content-Type if data is undefined + delete requestHeaders[key]; + } else { + // Otherwise add header to the request + request.setRequestHeader(key, val); + } + }); + } - const n = wh + f * (v - wh); // Linear interpolation + // Add withCredentials to request if needed + if (!utils.isUndefined(config.withCredentials)) { + request.withCredentials = !!config.withCredentials; + } - let r; - let g; - let b; - /* eslint-disable max-statements-per-line,no-multi-spaces */ - switch (i) { - default: - case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; - } - /* eslint-enable max-statements-per-line,no-multi-spaces */ + // Add responseType to request if needed + if (config.responseType) { + try { + request.responseType = config.responseType; + } catch (e) { + // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. + // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. + if (config.responseType !== 'json') { + throw e; + } + } + } - return [r * 255, g * 255, b * 255]; -}; + // Handle progress if needed + if (typeof config.onDownloadProgress === 'function') { + request.addEventListener('progress', config.onDownloadProgress); + } -convert.cmyk.rgb = function (cmyk) { - const c = cmyk[0] / 100; - const m = cmyk[1] / 100; - const y = cmyk[2] / 100; - const k = cmyk[3] / 100; + // Not all browsers support upload events + if (typeof config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', config.onUploadProgress); + } - const r = 1 - Math.min(1, c * (1 - k) + k); - const g = 1 - Math.min(1, m * (1 - k) + k); - const b = 1 - Math.min(1, y * (1 - k) + k); + if (config.cancelToken) { + // Handle cancellation + config.cancelToken.promise.then(function onCanceled(cancel) { + if (!request) { + return; + } - return [r * 255, g * 255, b * 255]; -}; + request.abort(); + reject(cancel); + // Clean up request + request = null; + }); + } -convert.xyz.rgb = function (xyz) { - const x = xyz[0] / 100; - const y = xyz[1] / 100; - const z = xyz[2] / 100; - let r; - let g; - let b; + if (!requestData) { + requestData = null; + } - r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); - g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); - b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); + // Send the request + request.send(requestData); + }); +}; - // Assume sRGB - r = r > 0.0031308 - ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) - : r * 12.92; - g = g > 0.0031308 - ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) - : g * 12.92; +/***/ }), - b = b > 0.0031308 - ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) - : b * 12.92; +/***/ 2618: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); +"use strict"; - return [r * 255, g * 255, b * 255]; -}; -convert.xyz.lab = function (xyz) { - let x = xyz[0]; - let y = xyz[1]; - let z = xyz[2]; +var utils = __nccwpck_require__(328); +var bind = __nccwpck_require__(7065); +var Axios = __nccwpck_require__(8178); +var mergeConfig = __nccwpck_require__(4831); +var defaults = __nccwpck_require__(8190); - x /= 95.047; - y /= 100; - z /= 108.883; +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * @return {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + var context = new Axios(defaultConfig); + var instance = bind(Axios.prototype.request, context); - x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + // Copy axios.prototype to instance + utils.extend(instance, Axios.prototype, context); - const l = (116 * y) - 16; - const a = 500 * (x - y); - const b = 200 * (y - z); + // Copy context to instance + utils.extend(instance, context); - return [l, a, b]; -}; + return instance; +} -convert.lab.xyz = function (lab) { - const l = lab[0]; - const a = lab[1]; - const b = lab[2]; - let x; - let y; - let z; +// Create the default instance to be exported +var axios = createInstance(defaults); - y = (l + 16) / 116; - x = a / 500 + y; - z = y - b / 200; +// Expose Axios class to allow class inheritance +axios.Axios = Axios; - const y2 = y ** 3; - const x2 = x ** 3; - const z2 = z ** 3; - y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; - x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; - z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; +// Factory for creating new instances +axios.create = function create(instanceConfig) { + return createInstance(mergeConfig(axios.defaults, instanceConfig)); +}; - x *= 95.047; - y *= 100; - z *= 108.883; +// Expose Cancel & CancelToken +axios.Cancel = __nccwpck_require__(8875); +axios.CancelToken = __nccwpck_require__(1587); +axios.isCancel = __nccwpck_require__(4057); - return [x, y, z]; +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); }; +axios.spread = __nccwpck_require__(4850); -convert.lab.lch = function (lab) { - const l = lab[0]; - const a = lab[1]; - const b = lab[2]; - let h; +// Expose isAxiosError +axios.isAxiosError = __nccwpck_require__(650); - const hr = Math.atan2(b, a); - h = hr * 360 / 2 / Math.PI; +module.exports = axios; - if (h < 0) { - h += 360; - } +// Allow use of default import syntax in TypeScript +module.exports.default = axios; - const c = Math.sqrt(a * a + b * b); - return [l, c, h]; -}; +/***/ }), -convert.lch.lab = function (lch) { - const l = lch[0]; - const c = lch[1]; - const h = lch[2]; +/***/ 8875: +/***/ ((module) => { - const hr = h / 360 * 2 * Math.PI; - const a = c * Math.cos(hr); - const b = c * Math.sin(hr); +"use strict"; - return [l, a, b]; -}; -convert.rgb.ansi16 = function (args, saturation = null) { - const [r, g, b] = args; - let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization +/** + * A `Cancel` is an object that is thrown when an operation is canceled. + * + * @class + * @param {string=} message The message. + */ +function Cancel(message) { + this.message = message; +} - value = Math.round(value / 50); +Cancel.prototype.toString = function toString() { + return 'Cancel' + (this.message ? ': ' + this.message : ''); +}; - if (value === 0) { - return 30; - } +Cancel.prototype.__CANCEL__ = true; - let ansi = 30 - + ((Math.round(b / 255) << 2) - | (Math.round(g / 255) << 1) - | Math.round(r / 255)); +module.exports = Cancel; - if (value === 2) { - ansi += 60; - } - return ansi; -}; +/***/ }), -convert.hsv.ansi16 = function (args) { - // Optimization here; we already know the value and don't need to get - // it converted for us. - return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); -}; +/***/ 1587: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -convert.rgb.ansi256 = function (args) { - const r = args[0]; - const g = args[1]; - const b = args[2]; +"use strict"; - // We use the extended greyscale palette here, with the exception of - // black and white. normal palette only has 4 greyscale shades. - if (r === g && g === b) { - if (r < 8) { - return 16; - } - if (r > 248) { - return 231; - } +var Cancel = __nccwpck_require__(8875); - return Math.round(((r - 8) / 247) * 24) + 232; - } +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @class + * @param {Function} executor The executor function. + */ +function CancelToken(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } - const ansi = 16 - + (36 * Math.round(r / 255 * 5)) - + (6 * Math.round(g / 255 * 5)) - + Math.round(b / 255 * 5); + var resolvePromise; + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); - return ansi; -}; + var token = this; + executor(function cancel(message) { + if (token.reason) { + // Cancellation has already been requested + return; + } -convert.ansi16.rgb = function (args) { - let color = args % 10; + token.reason = new Cancel(message); + resolvePromise(token.reason); + }); +} - // Handle greyscale - if (color === 0 || color === 7) { - if (args > 50) { - color += 3.5; - } +/** + * Throws a `Cancel` if cancellation has been requested. + */ +CancelToken.prototype.throwIfRequested = function throwIfRequested() { + if (this.reason) { + throw this.reason; + } +}; - color = color / 10.5 * 255; +/** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ +CancelToken.source = function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token: token, + cancel: cancel + }; +}; - return [color, color, color]; - } +module.exports = CancelToken; - const mult = (~~(args > 50) + 1) * 0.5; - const r = ((color & 1) * mult) * 255; - const g = (((color >> 1) & 1) * mult) * 255; - const b = (((color >> 2) & 1) * mult) * 255; - return [r, g, b]; -}; +/***/ }), -convert.ansi256.rgb = function (args) { - // Handle greyscale - if (args >= 232) { - const c = (args - 232) * 10 + 8; - return [c, c, c]; - } +/***/ 4057: +/***/ ((module) => { - args -= 16; +"use strict"; - let rem; - const r = Math.floor(args / 36) / 5 * 255; - const g = Math.floor((rem = args % 36) / 6) / 5 * 255; - const b = (rem % 6) / 5 * 255; - return [r, g, b]; +module.exports = function isCancel(value) { + return !!(value && value.__CANCEL__); }; -convert.rgb.hex = function (args) { - const integer = ((Math.round(args[0]) & 0xFF) << 16) - + ((Math.round(args[1]) & 0xFF) << 8) - + (Math.round(args[2]) & 0xFF); - - const string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; -convert.hex.rgb = function (args) { - const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); - if (!match) { - return [0, 0, 0]; - } +/***/ }), - let colorString = match[0]; +/***/ 8178: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (match[0].length === 3) { - colorString = colorString.split('').map(char => { - return char + char; - }).join(''); - } +"use strict"; - const integer = parseInt(colorString, 16); - const r = (integer >> 16) & 0xFF; - const g = (integer >> 8) & 0xFF; - const b = integer & 0xFF; - return [r, g, b]; -}; +var utils = __nccwpck_require__(328); +var buildURL = __nccwpck_require__(646); +var InterceptorManager = __nccwpck_require__(3214); +var dispatchRequest = __nccwpck_require__(5062); +var mergeConfig = __nccwpck_require__(4831); -convert.rgb.hcg = function (rgb) { - const r = rgb[0] / 255; - const g = rgb[1] / 255; - const b = rgb[2] / 255; - const max = Math.max(Math.max(r, g), b); - const min = Math.min(Math.min(r, g), b); - const chroma = (max - min); - let grayscale; - let hue; +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + */ +function Axios(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager(), + response: new InterceptorManager() + }; +} - if (chroma < 1) { - grayscale = min / (1 - chroma); - } else { - grayscale = 0; - } +/** + * Dispatch a request + * + * @param {Object} config The config specific for this request (merged with this.defaults) + */ +Axios.prototype.request = function request(config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof config === 'string') { + config = arguments[1] || {}; + config.url = arguments[0]; + } else { + config = config || {}; + } - if (chroma <= 0) { - hue = 0; - } else - if (max === r) { - hue = ((g - b) / chroma) % 6; - } else - if (max === g) { - hue = 2 + (b - r) / chroma; - } else { - hue = 4 + (r - g) / chroma; - } + config = mergeConfig(this.defaults, config); - hue /= 6; - hue %= 1; + // Set config.method + if (config.method) { + config.method = config.method.toLowerCase(); + } else if (this.defaults.method) { + config.method = this.defaults.method.toLowerCase(); + } else { + config.method = 'get'; + } - return [hue * 360, chroma * 100, grayscale * 100]; -}; + // Hook up interceptors middleware + var chain = [dispatchRequest, undefined]; + var promise = Promise.resolve(config); -convert.hsl.hcg = function (hsl) { - const s = hsl[1] / 100; - const l = hsl[2] / 100; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + chain.unshift(interceptor.fulfilled, interceptor.rejected); + }); - const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + chain.push(interceptor.fulfilled, interceptor.rejected); + }); - let f = 0; - if (c < 1.0) { - f = (l - 0.5 * c) / (1.0 - c); - } + while (chain.length) { + promise = promise.then(chain.shift(), chain.shift()); + } - return [hsl[0], c * 100, f * 100]; + return promise; }; -convert.hsv.hcg = function (hsv) { - const s = hsv[1] / 100; - const v = hsv[2] / 100; - - const c = s * v; - let f = 0; +Axios.prototype.getUri = function getUri(config) { + config = mergeConfig(this.defaults, config); + return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); +}; - if (c < 1.0) { - f = (v - c) / (1 - c); - } +// Provide aliases for supported request methods +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: (config || {}).data + })); + }; +}); - return [hsv[0], c * 100, f * 100]; -}; +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, data, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: data + })); + }; +}); -convert.hcg.rgb = function (hcg) { - const h = hcg[0] / 360; - const c = hcg[1] / 100; - const g = hcg[2] / 100; +module.exports = Axios; - if (c === 0.0) { - return [g * 255, g * 255, g * 255]; - } - const pure = [0, 0, 0]; - const hi = (h % 1) * 6; - const v = hi % 1; - const w = 1 - v; - let mg = 0; +/***/ }), - /* eslint-disable max-statements-per-line */ - switch (Math.floor(hi)) { - case 0: - pure[0] = 1; pure[1] = v; pure[2] = 0; break; - case 1: - pure[0] = w; pure[1] = 1; pure[2] = 0; break; - case 2: - pure[0] = 0; pure[1] = 1; pure[2] = v; break; - case 3: - pure[0] = 0; pure[1] = w; pure[2] = 1; break; - case 4: - pure[0] = v; pure[1] = 0; pure[2] = 1; break; - default: - pure[0] = 1; pure[1] = 0; pure[2] = w; - } - /* eslint-enable max-statements-per-line */ +/***/ 3214: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - mg = (1.0 - c) * g; +"use strict"; - return [ - (c * pure[0] + mg) * 255, - (c * pure[1] + mg) * 255, - (c * pure[2] + mg) * 255 - ]; -}; -convert.hcg.hsv = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; +var utils = __nccwpck_require__(328); - const v = c + g * (1.0 - c); - let f = 0; +function InterceptorManager() { + this.handlers = []; +} - if (v > 0.0) { - f = c / v; - } +/** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ +InterceptorManager.prototype.use = function use(fulfilled, rejected) { + this.handlers.push({ + fulfilled: fulfilled, + rejected: rejected + }); + return this.handlers.length - 1; +}; - return [hcg[0], f * 100, v * 100]; +/** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + */ +InterceptorManager.prototype.eject = function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } }; -convert.hcg.hsl = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; +/** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + */ +InterceptorManager.prototype.forEach = function forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); +}; - const l = g * (1.0 - c) + 0.5 * c; - let s = 0; +module.exports = InterceptorManager; - if (l > 0.0 && l < 0.5) { - s = c / (2 * l); - } else - if (l >= 0.5 && l < 1.0) { - s = c / (2 * (1 - l)); - } - return [hcg[0], s * 100, l * 100]; -}; +/***/ }), -convert.hcg.hwb = function (hcg) { - const c = hcg[1] / 100; - const g = hcg[2] / 100; - const v = c + g * (1.0 - c); - return [hcg[0], (v - c) * 100, (1 - v) * 100]; -}; +/***/ 1934: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -convert.hwb.hcg = function (hwb) { - const w = hwb[1] / 100; - const b = hwb[2] / 100; - const v = 1 - b; - const c = v - w; - let g = 0; +"use strict"; - if (c < 1) { - g = (v - c) / (1 - c); - } - return [hwb[0], c * 100, g * 100]; -}; +var isAbsoluteURL = __nccwpck_require__(1301); +var combineURLs = __nccwpck_require__(7189); -convert.apple.rgb = function (apple) { - return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * @returns {string} The combined full path + */ +module.exports = function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; }; -convert.rgb.apple = function (rgb) { - return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; -}; -convert.gray.rgb = function (args) { - return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; -}; +/***/ }), -convert.gray.hsl = function (args) { - return [0, 0, args[0]]; -}; +/***/ 5226: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -convert.gray.hsv = convert.gray.hsl; +"use strict"; -convert.gray.hwb = function (gray) { - return [0, 100, gray[0]]; -}; -convert.gray.cmyk = function (gray) { - return [0, 0, 0, gray[0]]; -}; +var enhanceError = __nccwpck_require__(1516); -convert.gray.lab = function (gray) { - return [gray[0], 0, 0]; -}; - -convert.gray.hex = function (gray) { - const val = Math.round(gray[0] / 100 * 255) & 0xFF; - const integer = (val << 16) + (val << 8) + val; - - const string = integer.toString(16).toUpperCase(); - return '000000'.substring(string.length) + string; -}; - -convert.rgb.gray = function (rgb) { - const val = (rgb[0] + rgb[1] + rgb[2]) / 3; - return [val / 255 * 100]; +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The created error. + */ +module.exports = function createError(message, config, code, request, response) { + var error = new Error(message); + return enhanceError(error, config, code, request, response); }; /***/ }), -/***/ 133: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 5062: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = globSync -globSync.GlobSync = GlobSync +"use strict"; -var fs = __webpack_require__(747) -var rp = __webpack_require__(544) -var minimatch = __webpack_require__(689) -var Minimatch = minimatch.Minimatch -var Glob = __webpack_require__(696).Glob -var util = __webpack_require__(669) -var path = __webpack_require__(622) -var assert = __webpack_require__(357) -var isAbsolute = __webpack_require__(829) -var common = __webpack_require__(18) -var alphasort = common.alphasort -var alphasorti = common.alphasorti -var setopts = common.setopts -var ownProp = common.ownProp -var childrenIgnored = common.childrenIgnored -var isIgnored = common.isIgnored -function globSync (pattern, options) { - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') +var utils = __nccwpck_require__(328); +var transformData = __nccwpck_require__(9812); +var isCancel = __nccwpck_require__(4057); +var defaults = __nccwpck_require__(8190); - return new GlobSync(pattern, options).found +/** + * Throws a `Cancel` if cancellation has been requested. + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } } -function GlobSync (pattern, options) { - if (!pattern) - throw new Error('must provide pattern') +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * @returns {Promise} The Promise to be fulfilled + */ +module.exports = function dispatchRequest(config) { + throwIfCancellationRequested(config); - if (typeof options === 'function' || arguments.length === 3) - throw new TypeError('callback provided to sync glob\n'+ - 'See: https://github.com/isaacs/node-glob/issues/167') + // Ensure headers exist + config.headers = config.headers || {}; - if (!(this instanceof GlobSync)) - return new GlobSync(pattern, options) + // Transform request data + config.data = transformData( + config.data, + config.headers, + config.transformRequest + ); - setopts(this, pattern, options) + // Flatten headers + config.headers = utils.merge( + config.headers.common || {}, + config.headers[config.method] || {}, + config.headers + ); - if (this.noprocess) - return this + utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + function cleanHeaderConfig(method) { + delete config.headers[method]; + } + ); - var n = this.minimatch.set.length - this.matches = new Array(n) - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false) - } - this._finish() -} + var adapter = config.adapter || defaults.adapter; -GlobSync.prototype._finish = function () { - assert(this instanceof GlobSync) - if (this.realpath) { - var self = this - this.matches.forEach(function (matchset, index) { - var set = self.matches[index] = Object.create(null) - for (var p in matchset) { - try { - p = self._makeAbs(p) - var real = rp.realpathSync(p, self.realpathCache) - set[real] = true - } catch (er) { - if (er.syscall === 'stat') - set[self._makeAbs(p)] = true - else - throw er - } + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData( + response.data, + response.headers, + config.transformResponse + ); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData( + reason.response.data, + reason.response.headers, + config.transformResponse + ); } - }) - } - common.finish(this) -} + } + return Promise.reject(reason); + }); +}; -GlobSync.prototype._process = function (pattern, index, inGlobStar) { - assert(this instanceof GlobSync) - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. +/***/ }), - // See if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index) - return +/***/ 1516: +/***/ ((module) => { - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break +"use strict"; - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break + +/** + * Update an Error with the specified config, error code, and response. + * + * @param {Error} error The error to update. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The error. + */ +module.exports = function enhanceError(error, config, code, request, response) { + error.config = config; + if (code) { + error.code = code; } - var remain = pattern.slice(n) + error.request = request; + error.response = response; + error.isAxiosError = true; - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix + error.toJSON = function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: this.config, + code: this.code + }; + }; + return error; +}; - var abs = this._makeAbs(read) - //if ignored, skip processing - if (childrenIgnored(this, read)) - return +/***/ }), - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar) -} +/***/ 4831: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +"use strict"; -GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { - var entries = this._readdir(abs, inGlobStar) - // if the abs isn't a dir, then nothing can match! - if (!entries) - return +var utils = __nccwpck_require__(328); - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * @returns {Object} New object resulting from merging config2 to config1 + */ +module.exports = function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + var config = {}; - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) + var valueFromConfig2Keys = ['url', 'method', 'data']; + var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; + var defaultToConfig2Keys = [ + 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', + 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', + 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', + 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', + 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' + ]; + var directMergeKeys = ['validateStatus']; + + function getMergedValue(target, source) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge(target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); } + return source; } - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return + function mergeDeepProperties(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + } - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. + utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); + } + }); - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) + utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix.slice(-1) !== '/') - e = prefix + '/' + e - else - e = prefix + e - } + utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } + }); - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this._emitMatch(index, e) + utils.forEach(directMergeKeys, function merge(prop) { + if (prop in config2) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (prop in config1) { + config[prop] = getMergedValue(undefined, config1[prop]); } - // This was the last one, and no stats were needed - return - } + }); - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) - newPattern = [prefix, e] - else - newPattern = [e] - this._process(newPattern.concat(remain), index, inGlobStar) - } -} + var axiosKeys = valueFromConfig2Keys + .concat(mergeDeepPropertiesKeys) + .concat(defaultToConfig2Keys) + .concat(directMergeKeys); + var otherKeys = Object + .keys(config1) + .concat(Object.keys(config2)) + .filter(function filterAxiosKeys(key) { + return axiosKeys.indexOf(key) === -1; + }); -GlobSync.prototype._emitMatch = function (index, e) { - if (isIgnored(this, e)) - return + utils.forEach(otherKeys, mergeDeepProperties); - var abs = this._makeAbs(e) + return config; +}; - if (this.mark) - e = this._mark(e) - if (this.absolute) { - e = abs - } +/***/ }), - if (this.matches[index][e]) - return +/***/ 3211: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return +"use strict"; + + +var createError = __nccwpck_require__(5226); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + */ +module.exports = function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(createError( + 'Request failed with status code ' + response.status, + response.config, + null, + response.request, + response + )); } +}; - this.matches[index][e] = true - if (this.stat) - this._stat(e) -} +/***/ }), +/***/ 9812: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -GlobSync.prototype._readdirInGlobStar = function (abs) { - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false) +"use strict"; - var entries - var lstat - var stat - try { - lstat = fs.lstatSync(abs) - } catch (er) { - if (er.code === 'ENOENT') { - // lstat failed, doesn't exist - return null - } - } - var isSym = lstat && lstat.isSymbolicLink() - this.symlinks[abs] = isSym +var utils = __nccwpck_require__(328); - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) - this.cache[abs] = 'FILE' - else - entries = this._readdir(abs, false) +/** + * Transform the data for a request or a response + * + * @param {Object|String} data The data to be transformed + * @param {Array} headers The headers for the request or response + * @param {Array|Function} fns A single function or Array of functions + * @returns {*} The resulting transformed data + */ +module.exports = function transformData(data, headers, fns) { + /*eslint no-param-reassign:0*/ + utils.forEach(fns, function transform(fn) { + data = fn(data, headers); + }); - return entries -} + return data; +}; -GlobSync.prototype._readdir = function (abs, inGlobStar) { - var entries - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs) +/***/ }), - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return null +/***/ 8190: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (Array.isArray(c)) - return c - } +"use strict"; - try { - return this._readdirEntries(abs, fs.readdirSync(abs)) - } catch (er) { - this._readdirError(abs, er) - return null + +var utils = __nccwpck_require__(328); +var normalizeHeaderName = __nccwpck_require__(6240); + +var DEFAULT_CONTENT_TYPE = { + 'Content-Type': 'application/x-www-form-urlencoded' +}; + +function setContentTypeIfUnset(headers, value) { + if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { + headers['Content-Type'] = value; } } -GlobSync.prototype._readdirEntries = function (abs, entries) { - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } +function getDefaultAdapter() { + var adapter; + if (typeof XMLHttpRequest !== 'undefined') { + // For browsers use XHR adapter + adapter = __nccwpck_require__(3454); + } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { + // For node use HTTP adapter + adapter = __nccwpck_require__(8104); } - - this.cache[abs] = entries - - // mark and cache dir-ness - return entries + return adapter; } -GlobSync.prototype._readdirError = function (f, er) { - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - throw error - } - break +var defaults = { + adapter: getDefaultAdapter(), - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break + transformRequest: [function transformRequest(data, headers) { + normalizeHeaderName(headers, 'Accept'); + normalizeHeaderName(headers, 'Content-Type'); + if (utils.isFormData(data) || + utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); + return data.toString(); + } + if (utils.isObject(data)) { + setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); + return JSON.stringify(data); + } + return data; + }], - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) - throw er - if (!this.silent) - console.error('glob error', er) - break - } -} + transformResponse: [function transformResponse(data) { + /*eslint no-param-reassign:0*/ + if (typeof data === 'string') { + try { + data = JSON.parse(data); + } catch (e) { /* Ignore */ } + } + return data; + }], -GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, - var entries = this._readdir(abs, inGlobStar) + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return + maxContentLength: -1, + maxBodyLength: -1, - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + } +}; - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false) +defaults.headers = { + common: { + 'Accept': 'application/json, text/plain, */*' + } +}; - var len = entries.length - var isSym = this.symlinks[abs] +utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { + defaults.headers[method] = {}; +}); - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); +}); - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue +module.exports = defaults; - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true) - var below = gspref.concat(entries[i], remain) - this._process(below, index, true) - } -} +/***/ }), -GlobSync.prototype._processSimple = function (prefix, index) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var exists = this._stat(prefix) +/***/ 7065: +/***/ ((module) => { - if (!this.matches[index]) - this.matches[index] = Object.create(null) +"use strict"; - // If it doesn't exist, then just mark the lack of results - if (!exists) - return - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' +module.exports = function bind(fn, thisArg) { + return function wrap() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; } - } - - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') + return fn.apply(thisArg, args); + }; +}; - // Mark this as a match - this._emitMatch(index, prefix) -} -// Returns either 'DIR', 'FILE', or false -GlobSync.prototype._stat = function (f) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' +/***/ }), - if (f.length > this.maxLength) - return false +/***/ 646: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] +"use strict"; - if (Array.isArray(c)) - c = 'DIR' - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return c +var utils = __nccwpck_require__(328); - if (needDir && c === 'FILE') - return false +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @returns {string} The formatted url + */ +module.exports = function buildURL(url, params, paramsSerializer) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; } - var exists - var stat = this.statCache[abs] - if (!stat) { - var lstat - try { - lstat = fs.lstatSync(abs) - } catch (er) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return false - } - } + var serializedParams; + if (paramsSerializer) { + serializedParams = paramsSerializer(params); + } else if (utils.isURLSearchParams(params)) { + serializedParams = params.toString(); + } else { + var parts = []; - if (lstat && lstat.isSymbolicLink()) { - try { - stat = fs.statSync(abs) - } catch (er) { - stat = lstat + utils.forEach(params, function serialize(val, key) { + if (val === null || typeof val === 'undefined') { + return; } - } else { - stat = lstat - } - } - this.statCache[abs] = stat - - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' + if (utils.isArray(val)) { + key = key + '[]'; + } else { + val = [val]; + } - this.cache[abs] = this.cache[abs] || c + utils.forEach(val, function parseValue(v) { + if (utils.isDate(v)) { + v = v.toISOString(); + } else if (utils.isObject(v)) { + v = JSON.stringify(v); + } + parts.push(encode(key) + '=' + encode(v)); + }); + }); - if (needDir && c === 'FILE') - return false + serializedParams = parts.join('&'); + } - return c -} + if (serializedParams) { + var hashmarkIndex = url.indexOf('#'); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } -GlobSync.prototype._mark = function (p) { - return common.mark(this, p) -} + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } -GlobSync.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} + return url; +}; /***/ }), -/***/ 143: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 7189: +/***/ ((module) => { "use strict"; -var Cancel = __webpack_require__(774); - /** - * A `CancelToken` is an object that can be used to request cancellation of an operation. + * Creates a new URL by combining the specified URLs * - * @class - * @param {Function} executor The executor function. + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * @returns {string} The combined URL */ -function CancelToken(executor) { - if (typeof executor !== 'function') { - throw new TypeError('executor must be a function.'); - } +module.exports = function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +}; - var resolvePromise; - this.promise = new Promise(function promiseExecutor(resolve) { - resolvePromise = resolve; - }); - var token = this; - executor(function cancel(message) { - if (token.reason) { - // Cancellation has already been requested - return; - } +/***/ }), + +/***/ 1545: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var utils = __nccwpck_require__(328); + +module.exports = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs support document.cookie + (function standardBrowserEnv() { + return { + write: function write(name, value, expires, path, domain, secure) { + var cookie = []; + cookie.push(name + '=' + encodeURIComponent(value)); + + if (utils.isNumber(expires)) { + cookie.push('expires=' + new Date(expires).toGMTString()); + } + + if (utils.isString(path)) { + cookie.push('path=' + path); + } + + if (utils.isString(domain)) { + cookie.push('domain=' + domain); + } + + if (secure === true) { + cookie.push('secure'); + } + + document.cookie = cookie.join('; '); + }, + + read: function read(name) { + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + }; + })() : + + // Non standard browser env (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return { + write: function write() {}, + read: function read() { return null; }, + remove: function remove() {} + }; + })() +); + + +/***/ }), + +/***/ 1301: +/***/ ((module) => { + +"use strict"; - token.reason = new Cancel(message); - resolvePromise(token.reason); - }); -} /** - * Throws a `Cancel` if cancellation has been requested. + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * @returns {boolean} True if the specified URL is absolute, otherwise false */ -CancelToken.prototype.throwIfRequested = function throwIfRequested() { - if (this.reason) { - throw this.reason; - } +module.exports = function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); }; + +/***/ }), + +/***/ 650: +/***/ ((module) => { + +"use strict"; + + /** - * Returns an object that contains a new `CancelToken` and a function that, when called, - * cancels the `CancelToken`. + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false */ -CancelToken.source = function source() { - var cancel; - var token = new CancelToken(function executor(c) { - cancel = c; - }); - return { - token: token, - cancel: cancel - }; +module.exports = function isAxiosError(payload) { + return (typeof payload === 'object') && (payload.isAxiosError === true); }; -module.exports = CancelToken; - /***/ }), -/***/ 149: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 3608: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var debug; +"use strict"; -module.exports = function () { - if (!debug) { - try { - /* eslint global-require: off */ - debug = __webpack_require__(310)("follow-redirects"); - } - catch (error) { - debug = function () { /* */ }; - } - } - debug.apply(null, arguments); -}; + +var utils = __nccwpck_require__(328); + +module.exports = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement('a'); + var originURL; + + /** + * Parse a URL to discover it's components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + var href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })() +); /***/ }), -/***/ 152: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 6240: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; -var utils = __webpack_require__(397); +var utils = __nccwpck_require__(328); module.exports = function normalizeHeaderName(headers, normalizedName) { utils.forEach(headers, function processHeader(value, name) { @@ -1822,7547 +1932,5552 @@ module.exports = function normalizeHeaderName(headers, normalizedName) { /***/ }), -/***/ 183: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 6455: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = rimraf -rimraf.sync = rimrafSync +"use strict"; -var assert = __webpack_require__(357) -var path = __webpack_require__(622) -var fs = __webpack_require__(747) -var glob = __webpack_require__(696) -var _0666 = parseInt('666', 8) -var defaultGlobOpts = { - nosort: true, - silent: true -} +var utils = __nccwpck_require__(328); -// for EMFILE handling -var timeout = 0 +// Headers whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +var ignoreDuplicateOf = [ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]; -var isWindows = (process.platform === "win32") +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} headers Headers needing to be parsed + * @returns {Object} Headers parsed into an object + */ +module.exports = function parseHeaders(headers) { + var parsed = {}; + var key; + var val; + var i; -function defaults (options) { - var methods = [ - 'unlink', - 'chmod', - 'stat', - 'lstat', - 'rmdir', - 'readdir' - ] - methods.forEach(function(m) { - options[m] = options[m] || fs[m] - m = m + 'Sync' - options[m] = options[m] || fs[m] - }) + if (!headers) { return parsed; } - options.maxBusyTries = options.maxBusyTries || 3 - options.emfileWait = options.emfileWait || 1000 - if (options.glob === false) { - options.disableGlob = true - } - options.disableGlob = options.disableGlob || false - options.glob = options.glob || defaultGlobOpts -} + utils.forEach(headers.split('\n'), function parser(line) { + i = line.indexOf(':'); + key = utils.trim(line.substr(0, i)).toLowerCase(); + val = utils.trim(line.substr(i + 1)); -function rimraf (p, options, cb) { - if (typeof options === 'function') { - cb = options - options = {} - } + if (key) { + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { + return; + } + if (key === 'set-cookie') { + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + } + }); - assert(p, 'rimraf: missing path') - assert.equal(typeof p, 'string', 'rimraf: path should be a string') - assert.equal(typeof cb, 'function', 'rimraf: callback function required') - assert(options, 'rimraf: invalid options argument provided') - assert.equal(typeof options, 'object', 'rimraf: options should be object') + return parsed; +}; - defaults(options) - var busyTries = 0 - var errState = null - var n = 0 +/***/ }), - if (options.disableGlob || !glob.hasMagic(p)) - return afterGlob(null, [p]) +/***/ 4850: +/***/ ((module) => { - options.lstat(p, function (er, stat) { - if (!er) - return afterGlob(null, [p]) +"use strict"; - glob(p, options.glob, afterGlob) - }) - function next (er) { - errState = errState || er - if (--n === 0) - cb(errState) - } +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * @returns {Function} + */ +module.exports = function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +}; - function afterGlob (er, results) { - if (er) - return cb(er) - n = results.length - if (n === 0) - return cb() +/***/ }), - results.forEach(function (p) { - rimraf_(p, options, function CB (er) { - if (er) { - if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && - busyTries < options.maxBusyTries) { - busyTries ++ - var time = busyTries * 100 - // try again, with the same exact callback as this one. - return setTimeout(function () { - rimraf_(p, options, CB) - }, time) - } +/***/ 328: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // this one won't happen if graceful-fs is used. - if (er.code === "EMFILE" && timeout < options.emfileWait) { - return setTimeout(function () { - rimraf_(p, options, CB) - }, timeout ++) - } +"use strict"; - // already gone - if (er.code === "ENOENT") er = null - } - timeout = 0 - next(er) - }) - }) - } -} +var bind = __nccwpck_require__(7065); -// Two possible strategies. -// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR -// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR -// -// Both result in an extra syscall when you guess wrong. However, there -// are likely far more normal files in the world than directories. This -// is based on the assumption that a the average number of files per -// directory is >= 1. -// -// If anyone ever complains about this, then I guess the strategy could -// be made configurable somehow. But until then, YAGNI. -function rimraf_ (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') +/*global toString:true*/ - // sunos lets the root user unlink directories, which is... weird. - // so we have to lstat here and make sure it's not a dir. - options.lstat(p, function (er, st) { - if (er && er.code === "ENOENT") - return cb(null) +// utils is a library of generic helper functions non-specific to axios - // Windows can EPERM on stat. Life is suffering. - if (er && er.code === "EPERM" && isWindows) - fixWinEPERM(p, options, er, cb) +var toString = Object.prototype.toString; - if (st && st.isDirectory()) - return rmdir(p, options, er, cb) +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Array, otherwise false + */ +function isArray(val) { + return toString.call(val) === '[object Array]'; +} - options.unlink(p, function (er) { - if (er) { - if (er.code === "ENOENT") - return cb(null) - if (er.code === "EPERM") - return (isWindows) - ? fixWinEPERM(p, options, er, cb) - : rmdir(p, options, er, cb) - if (er.code === "EISDIR") - return rmdir(p, options, er, cb) - } - return cb(er) - }) - }) +/** + * Determine if a value is undefined + * + * @param {Object} val The value to test + * @returns {boolean} True if the value is undefined, otherwise false + */ +function isUndefined(val) { + return typeof val === 'undefined'; } -function fixWinEPERM (p, options, er, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - if (er) - assert(er instanceof Error) +/** + * Determine if a value is a Buffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); +} - options.chmod(p, _0666, function (er2) { - if (er2) - cb(er2.code === "ENOENT" ? null : er) - else - options.stat(p, function(er3, stats) { - if (er3) - cb(er3.code === "ENOENT" ? null : er) - else if (stats.isDirectory()) - rmdir(p, options, er, cb) - else - options.unlink(p, cb) - }) - }) +/** + * Determine if a value is an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +function isArrayBuffer(val) { + return toString.call(val) === '[object ArrayBuffer]'; } -function fixWinEPERMSync (p, options, er) { - assert(p) - assert(options) - if (er) - assert(er instanceof Error) +/** + * Determine if a value is a FormData + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an FormData, otherwise false + */ +function isFormData(val) { + return (typeof FormData !== 'undefined') && (val instanceof FormData); +} - try { - options.chmodSync(p, _0666) - } catch (er2) { - if (er2.code === "ENOENT") - return - else - throw er +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + var result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); } + return result; +} - try { - var stats = options.statSync(p) - } catch (er3) { - if (er3.code === "ENOENT") - return - else - throw er +/** + * Determine if a value is a String + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a String, otherwise false + */ +function isString(val) { + return typeof val === 'string'; +} + +/** + * Determine if a value is a Number + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Number, otherwise false + */ +function isNumber(val) { + return typeof val === 'number'; +} + +/** + * Determine if a value is an Object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Object, otherwise false + */ +function isObject(val) { + return val !== null && typeof val === 'object'; +} + +/** + * Determine if a value is a plain Object + * + * @param {Object} val The value to test + * @return {boolean} True if value is a plain Object, otherwise false + */ +function isPlainObject(val) { + if (toString.call(val) !== '[object Object]') { + return false; } - if (stats.isDirectory()) - rmdirSync(p, options, er) - else - options.unlinkSync(p) + var prototype = Object.getPrototypeOf(val); + return prototype === null || prototype === Object.prototype; } -function rmdir (p, options, originalEr, cb) { - assert(p) - assert(options) - if (originalEr) - assert(originalEr instanceof Error) - assert(typeof cb === 'function') +/** + * Determine if a value is a Date + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Date, otherwise false + */ +function isDate(val) { + return toString.call(val) === '[object Date]'; +} - // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) - // if we guessed wrong, and it's not a directory, then - // raise the original error. - options.rmdir(p, function (er) { - if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) - rmkids(p, options, cb) - else if (er && er.code === "ENOTDIR") - cb(originalEr) - else - cb(er) - }) +/** + * Determine if a value is a File + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a File, otherwise false + */ +function isFile(val) { + return toString.call(val) === '[object File]'; } -function rmkids(p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') +/** + * Determine if a value is a Blob + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Blob, otherwise false + */ +function isBlob(val) { + return toString.call(val) === '[object Blob]'; +} - options.readdir(p, function (er, files) { - if (er) - return cb(er) - var n = files.length - if (n === 0) - return options.rmdir(p, cb) - var errState - files.forEach(function (f) { - rimraf(path.join(p, f), options, function (er) { - if (errState) - return - if (er) - return cb(errState = er) - if (--n === 0) - options.rmdir(p, cb) - }) - }) - }) +/** + * Determine if a value is a Function + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +function isFunction(val) { + return toString.call(val) === '[object Function]'; } -// this looks simpler, and is strictly *faster*, but will -// tie up the JavaScript thread and fail on excessively -// deep directory trees. -function rimrafSync (p, options) { - options = options || {} - defaults(options) +/** + * Determine if a value is a Stream + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Stream, otherwise false + */ +function isStream(val) { + return isObject(val) && isFunction(val.pipe); +} - assert(p, 'rimraf: missing path') - assert.equal(typeof p, 'string', 'rimraf: path should be a string') - assert(options, 'rimraf: missing options') - assert.equal(typeof options, 'object', 'rimraf: options should be object') +/** + * Determine if a value is a URLSearchParams object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +function isURLSearchParams(val) { + return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; +} - var results +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * @returns {String} The String freed of excess whitespace + */ +function trim(str) { + return str.replace(/^\s*/, '').replace(/\s*$/, ''); +} - if (options.disableGlob || !glob.hasMagic(p)) { - results = [p] - } else { - try { - options.lstatSync(p) - results = [p] - } catch (er) { - results = glob.sync(p, options.glob) - } +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + */ +function isStandardBrowserEnv() { + if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || + navigator.product === 'NativeScript' || + navigator.product === 'NS')) { + return false; } + return ( + typeof window !== 'undefined' && + typeof document !== 'undefined' + ); +} - if (!results.length) - return - - for (var i = 0; i < results.length; i++) { - var p = results[i] +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + */ +function forEach(obj, fn) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } - try { - var st = options.lstatSync(p) - } catch (er) { - if (er.code === "ENOENT") - return + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } - // Windows can EPERM on stat. Life is suffering. - if (er.code === "EPERM" && isWindows) - fixWinEPERMSync(p, options, er) + if (isArray(obj)) { + // Iterate over array values + for (var i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); } - - try { - // sunos lets the root user unlink directories, which is... weird. - if (st && st.isDirectory()) - rmdirSync(p, options, null) - else - options.unlinkSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - if (er.code === "EPERM") - return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) - if (er.code !== "EISDIR") - throw er - - rmdirSync(p, options, er) + } else { + // Iterate over object keys + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn.call(null, obj[key], key, obj); + } } } } -function rmdirSync (p, options, originalEr) { - assert(p) - assert(options) - if (originalEr) - assert(originalEr instanceof Error) +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + var result = {}; + function assignValue(val, key) { + if (isPlainObject(result[key]) && isPlainObject(val)) { + result[key] = merge(result[key], val); + } else if (isPlainObject(val)) { + result[key] = merge({}, val); + } else if (isArray(val)) { + result[key] = val.slice(); + } else { + result[key] = val; + } + } - try { - options.rmdirSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - if (er.code === "ENOTDIR") - throw originalEr - if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") - rmkidsSync(p, options) + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); } + return result; } -function rmkidsSync (p, options) { - assert(p) - assert(options) - options.readdirSync(p).forEach(function (f) { - rimrafSync(path.join(p, f), options) - }) - - // We only end up here once we got ENOTEMPTY at least once, and - // at this point, we are guaranteed to have removed all the kids. - // So, we know that it won't be ENOENT or ENOTDIR or anything else. - // try really hard to delete stuff on windows, because it has a - // PROFOUNDLY annoying habit of not closing handles promptly when - // files are deleted, resulting in spurious ENOTEMPTY errors. - var retries = isWindows ? 100 : 1 - var i = 0 - do { - var threw = true - try { - var ret = options.rmdirSync(p, options) - threw = false - return ret - } finally { - if (++i < retries && threw) - continue +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * @return {Object} The resulting value of object a + */ +function extend(a, b, thisArg) { + forEach(b, function assignValue(val, key) { + if (thisArg && typeof val === 'function') { + a[key] = bind(val, thisArg); + } else { + a[key] = val; } - } while (true) + }); + return a; } +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * @return {string} content value without BOM + */ +function stripBOM(content) { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +} -/***/ }), - -/***/ 211: -/***/ (function(module) { +module.exports = { + isArray: isArray, + isArrayBuffer: isArrayBuffer, + isBuffer: isBuffer, + isFormData: isFormData, + isArrayBufferView: isArrayBufferView, + isString: isString, + isNumber: isNumber, + isObject: isObject, + isPlainObject: isPlainObject, + isUndefined: isUndefined, + isDate: isDate, + isFile: isFile, + isBlob: isBlob, + isFunction: isFunction, + isStream: isStream, + isURLSearchParams: isURLSearchParams, + isStandardBrowserEnv: isStandardBrowserEnv, + forEach: forEach, + merge: merge, + extend: extend, + trim: trim, + stripBOM: stripBOM +}; -module.exports = require("https"); /***/ }), -/***/ 236: -/***/ (function(module, __unusedexports, __webpack_require__) { - -const conversions = __webpack_require__(104); -const route = __webpack_require__(935); - -const convert = {}; - -const models = Object.keys(conversions); - -function wrapRaw(fn) { - const wrappedFn = function (...args) { - const arg0 = args[0]; - if (arg0 === undefined || arg0 === null) { - return arg0; - } +/***/ 9417: +/***/ ((module) => { - if (arg0.length > 1) { - args = arg0; - } +"use strict"; - return fn(args); - }; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); - // Preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } + var r = range(a, b, str); - return wrappedFn; + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; } -function wrapRounded(fn) { - const wrappedFn = function (...args) { - const arg0 = args[0]; +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} - if (arg0 === undefined || arg0 === null) { - return arg0; - } +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; - if (arg0.length > 1) { - args = arg0; - } + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; - const result = fn(args); + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } - // We're assuming the result is an array here. - // see notice in conversions.js; don't use box types - // in conversion functions. - if (typeof result === 'object') { - for (let len = result.length, i = 0; i < len; i++) { - result[i] = Math.round(result[i]); - } - } + bi = str.indexOf(b, i + 1); + } - return result; - }; + i = ai < bi && ai >= 0 ? ai : bi; + } - // Preserve .conversion property if there is one - if ('conversion' in fn) { - wrappedFn.conversion = fn.conversion; - } + if (begs.length) { + result = [ left, right ]; + } + } - return wrappedFn; + return result; } -models.forEach(fromModel => { - convert[fromModel] = {}; - - Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); - Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); - - const routes = route(fromModel); - const routeModels = Object.keys(routes); - - routeModels.forEach(toModel => { - const fn = routes[toModel]; - - convert[fromModel][toModel] = wrapRounded(fn); - convert[fromModel][toModel].raw = wrapRaw(fn); - }); -}); - -module.exports = convert; - /***/ }), -/***/ 240: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 3717: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +var concatMap = __nccwpck_require__(6891); +var balanced = __nccwpck_require__(9417); +module.exports = expandTop; -var utils = __webpack_require__(397); +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; -module.exports = ( - utils.isStandardBrowserEnv() ? +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} - // Standard browser envs have full support of the APIs needed to test - // whether the request URL is of the same origin as current location. - (function standardBrowserEnv() { - var msie = /(msie|trident)/i.test(navigator.userAgent); - var urlParsingNode = document.createElement('a'); - var originURL; - - /** - * Parse a URL to discover it's components - * - * @param {String} url The URL to be parsed - * @returns {Object} - */ - function resolveURL(url) { - var href = url; - - if (msie) { - // IE needs attribute set twice to normalize properties - urlParsingNode.setAttribute('href', href); - href = urlParsingNode.href; - } +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} - urlParsingNode.setAttribute('href', href); +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} - // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils - return { - href: urlParsingNode.href, - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', - host: urlParsingNode.host, - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', - hostname: urlParsingNode.hostname, - port: urlParsingNode.port, - pathname: (urlParsingNode.pathname.charAt(0) === '/') ? - urlParsingNode.pathname : - '/' + urlParsingNode.pathname - }; - } - originURL = resolveURL(window.location.href); +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; - /** - * Determine if a URL shares the same origin as the current location - * - * @param {String} requestURL The URL to test - * @returns {boolean} True if URL shares the same origin, otherwise false - */ - return function isURLSameOrigin(requestURL) { - var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; - return (parsed.protocol === originURL.protocol && - parsed.host === originURL.host); - }; - })() : + var parts = []; + var m = balanced('{', '}', str); - // Non standard browser envs (web workers, react-native) lack needed support. - (function nonStandardBrowserEnv() { - return function isURLSameOrigin() { - return true; - }; - })() -); + if (!m) + return str.split(','); + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); -/***/ }), + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } -/***/ 272: -/***/ (function(module) { + parts.push.apply(parts, p); -module.exports = {"name":"starred_search","version":"0.1.10","description":"Search your starred repositories on GitHub for a keyword.","main":"src/cli.js","scripts":{"test":"mocha","build":"ncc build src/cli.js -o bin && mv bin/index.js bin/starred_search"},"bin":{"@link-/starred_search":"bin/starred_search","starred_search":"bin/starred_search"},"repository":{"type":"git","url":"git+https://github.com/Link-/starred_search.git"},"bugs":{"url":"https://github.com/Link-/starred_search/issues"},"homepage":"https://github.com/Link-/starred_search/#readme","keywords":["GitHub","repository","fulltext search","starred","stargazers","cli","terminal","nodejs"],"author":"Link-","license":"ISC","dependencies":{"arg":"^4.1.3","axios":"^0.21.1","cachedir":"^2.3.0","chalk":"^4.1.0","esm":"^3.2.25","flat-cache":"^2.0.1","imurmurhash":"^0.1.4","minisearch":"^3.0.2"},"devDependencies":{"prettier":"^2.2.1"}}; + return parts; +} -/***/ }), +function expandTop(str) { + if (!str) + return []; -/***/ 276: -/***/ (function(module, __unusedexports, __webpack_require__) { + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } -try { - var util = __webpack_require__(669); - /* istanbul ignore next */ - if (typeof util.inherits !== 'function') throw ''; - module.exports = util.inherits; -} catch (e) { - /* istanbul ignore next */ - module.exports = __webpack_require__(851); + return expand(escapeBraces(str), true).map(unescapeBraces); } +function identity(e) { + return e; +} -/***/ }), +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} -/***/ 298: -/***/ (function(module, __unusedexports, __webpack_require__) { +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} -"use strict"; +function expand(str, isTop) { + var expansions = []; + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; -var createError = __webpack_require__(462); + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } -/** - * Resolve or reject a Promise based on response status. - * - * @param {Function} resolve A function that resolves the promise. - * @param {Function} reject A function that rejects the promise. - * @param {object} response The response. - */ -module.exports = function settle(resolve, reject, response) { - var validateStatus = response.config.validateStatus; - if (!response.status || !validateStatus || validateStatus(response.status)) { - resolve(response); + var n; + if (isSequence) { + n = m.body.split(/\.\./); } else { - reject(createError( - 'Request failed with status code ' + response.status, - response.config, - null, - response.request, - response - )); + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } } -}; + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. -/***/ }), + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; -/***/ 310: -/***/ (function(module) { + var N; -module.exports = eval("require")("debug"); + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + N = []; -/***/ }), + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } -/***/ 323: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } -const arg = __webpack_require__(976); -const main = __webpack_require__(994); -const pkg = __webpack_require__(272); -const chalk = __webpack_require__(640); -const cachedir = __webpack_require__(823); + return expansions; +} -const help = ` -Usage: starred_search [OPTIONS] [ARGS]... - Search your or any other user's starred repositories on GitHub for a keyword. -Options: - -h, --help - Show this message and exit. - - -u, --user - Any GitHub handle. Example: link- +/***/ }), - -c, --cache-dir - Directory you want to store the cache file in. Example: /tmp/.cache +/***/ 6974: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -f, --find - The keyword you want to search for. Example: es6 +const os = __nccwpck_require__(2087) +const path = __nccwpck_require__(5622) - -l, --limit - Limit the search results to the specified number. Default is 10 - - -V, --verbose - Outputs debugging log - - -v, --version - Outputs release version +function posix (id) { + const cacheHome = process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache') + return path.join(cacheHome, id) +} - -d, --debug - Outputs stack trace in case an exception is thrown -` +function darwin (id) { + return path.join(os.homedir(), 'Library', 'Caches', id) +} -const parseArgs = (rawArgs) => { - const args = arg( - { - // Types - '--debug': Boolean, - '--help': Boolean, - '--user': String, - '--find': String, - '--cache-dir': String, - '--limit': Number, - '--verbose': Boolean, - '--version': Boolean, - // Aliases - '-d': '--debug', - '-h': '--help', - '-u': '--user', - '-f': '--find', - '-c': '--cache-dir', - '-l': '--limit', - '-V': '--verbose', - '-v': '--version' - } - ) - return { - debug: args['--debug'] || false, - help: args['--help'], - user: args['--user'], - findParam: args['--find'], - cacheDir: args['--cache-dir'] || cachedir('starredsearch'), - limit: args['--limit'] || 10, - verbose: args['--verbose'] || false, - version: args['--version'] || false, - } +function win32 (id) { + const appData = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local') + return path.join(appData, id, 'Cache') } -const cli = (args) => { - let options = parseArgs(args) +const implementation = (function () { + switch (os.platform()) { + case 'darwin': + return darwin + case 'win32': + return win32 + case 'aix': + case 'android': + case 'freebsd': + case 'linux': + case 'netbsd': + case 'openbsd': + case 'sunos': + return posix + default: + console.error(`(node:${process.pid}) [cachedir] Warning: the platform "${os.platform()}" is not currently supported by node-cachedir, falling back to "posix". Please file an issue with your platform here: https://github.com/LinusU/node-cachedir/issues/new`) + return posix + } +}()) - // Display commands guide - if (options.help) { - console.log(help) - return +module.exports = function cachedir (id) { + if (typeof id !== 'string') { + throw new TypeError('id is not a string') } - // Display version - if (options.version) { - console.log(pkg.version) - return + if (id.length === 0) { + throw new Error('id cannot be empty') } - - // Trigger the search - try { - main.search(options); - } catch (error) { - if (!options.debug) { - console.error(chalk.bold.red(`🛑 ${error.message}`)); - } else { - console.error(error); - } + if (/[^0-9a-zA-Z-]/.test(id)) { + throw new Error('id cannot contain special characters') } -} -cli(process.argv); + return implementation(id) +} /***/ }), -/***/ 348: -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ 8818: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. +"use strict"; -var pathModule = __webpack_require__(622); -var isWindows = process.platform === 'win32'; -var fs = __webpack_require__(747); +const ansiStyles = __nccwpck_require__(2068); +const {stdout: stdoutColor, stderr: stderrColor} = __nccwpck_require__(9318); +const { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +} = __nccwpck_require__(2415); -// JavaScript implementation of realpath, ported from node pre-v6 +const {isArray} = Array; -var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = [ + 'ansi', + 'ansi', + 'ansi256', + 'ansi16m' +]; -function rethrow() { - // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and - // is fairly slow to generate. - var callback; - if (DEBUG) { - var backtrace = new Error; - callback = debugCallback; - } else - callback = missingCallback; +const styles = Object.create(null); - return callback; +const applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { + throw new Error('The `level` option should be an integer from 0 to 3'); + } - function debugCallback(err) { - if (err) { - backtrace.message = err.message; - err = backtrace; - missingCallback(err); - } - } + // Detect level if not set manually + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === undefined ? colorLevel : options.level; +}; - function missingCallback(err) { - if (err) { - if (process.throwDeprecation) - throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs - else if (!process.noDeprecation) { - var msg = 'fs: missing callback ' + (err.stack || err.message); - if (process.traceDeprecation) - console.trace(msg); - else - console.error(msg); - } - } - } +class ChalkClass { + constructor(options) { + // eslint-disable-next-line no-constructor-return + return chalkFactory(options); + } } -function maybeCallback(cb) { - return typeof cb === 'function' ? cb : rethrow(); -} +const chalkFactory = options => { + const chalk = {}; + applyOptions(chalk, options); -var normalize = pathModule.normalize; + chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); -// Regexp that finds the next partion of a (partial) path -// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] -if (isWindows) { - var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; -} else { - var nextPartRe = /(.*?)(?:[\/]+|$)/g; -} + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); -// Regex to find the device root, including trailing slash. E.g. 'c:\\'. -if (isWindows) { - var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; -} else { - var splitRootRe = /^[\/]*/; -} + chalk.template.constructor = () => { + throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); + }; -exports.realpathSync = function realpathSync(p, cache) { - // make p is absolute - p = pathModule.resolve(p); + chalk.template.Instance = ChalkClass; - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return cache[p]; - } + return chalk.template; +}; - var original = p, - seenLinks = {}, - knownHard = {}; +function Chalk(options) { + return chalkFactory(options); +} - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; +for (const [styleName, style] of Object.entries(ansiStyles)) { + styles[styleName] = { + get() { + const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); + Object.defineProperty(this, styleName, {value: builder}); + return builder; + } + }; +} - start(); +styles.visible = { + get() { + const builder = createBuilder(this, this._styler, true); + Object.defineProperty(this, 'visible', {value: builder}); + return builder; + } +}; - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; +const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstatSync(base); - knownHard[base] = true; - } - } +for (const model of usedModels) { + styles[model] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} - // walk down the path, swapping out linked pathparts for their real - // values - // NB: p.length changes. - while (pos < p.length) { - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; +for (const model of usedModels) { + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - continue; - } +const proto = Object.defineProperties(() => {}, { + ...styles, + level: { + enumerable: true, + get() { + return this._generator.level; + }, + set(level) { + this._generator.level = level; + } + } +}); - var resolvedLink; - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // some known symbolic link. no need to stat again. - resolvedLink = cache[base]; - } else { - var stat = fs.lstatSync(base); - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - continue; - } +const createStyler = (open, close, parent) => { + let openAll; + let closeAll; + if (parent === undefined) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } - // read the link if it wasn't read before - // dev/ino always return 0 on windows, so skip the check. - var linkTarget = null; - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - linkTarget = seenLinks[id]; - } - } - if (linkTarget === null) { - fs.statSync(base); - linkTarget = fs.readlinkSync(base); - } - resolvedLink = pathModule.resolve(previous, linkTarget); - // track this, if given a cache. - if (cache) cache[base] = resolvedLink; - if (!isWindows) seenLinks[id] = linkTarget; - } + return { + open, + close, + openAll, + closeAll, + parent + }; +}; - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } +const createBuilder = (self, _styler, _isEmpty) => { + const builder = (...arguments_) => { + if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) { + // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}` + return applyStyle(builder, chalkTag(builder, ...arguments_)); + } - if (cache) cache[original] = p; + // Single argument is hot path, implicit coercion is faster than anything + // eslint-disable-next-line no-implicit-coercion + return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); + }; - return p; + // We alter the prototype because we must return a function, but there is + // no way to create a function with a different prototype + Object.setPrototypeOf(builder, proto); + + builder._generator = self; + builder._styler = _styler; + builder._isEmpty = _isEmpty; + + return builder; }; +const applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self._isEmpty ? '' : string; + } -exports.realpath = function realpath(p, cache, cb) { - if (typeof cb !== 'function') { - cb = maybeCallback(cache); - cache = null; - } + let styler = self._styler; - // make p is absolute - p = pathModule.resolve(p); + if (styler === undefined) { + return string; + } - if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { - return process.nextTick(cb.bind(null, null, cache[p])); - } + const {openAll, closeAll} = styler; + if (string.indexOf('\u001B') !== -1) { + while (styler !== undefined) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + string = stringReplaceAll(string, styler.close, styler.open); - var original = p, - seenLinks = {}, - knownHard = {}; + styler = styler.parent; + } + } - // current character position in p - var pos; - // the partial path so far, including a trailing slash if any - var current; - // the partial path without a trailing slash (except when pointing at a root) - var base; - // the partial path scanned in the previous round, with slash - var previous; + // We can move both next actions out of loop, because remaining actions in loop won't have + // any/visible effect on parts we add here. Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 + const lfIndex = string.indexOf('\n'); + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); + } - start(); + return openAll + string + closeAll; +}; - function start() { - // Skip over roots - var m = splitRootRe.exec(p); - pos = m[0].length; - current = m[0]; - base = m[0]; - previous = ''; +let template; +const chalkTag = (chalk, ...strings) => { + const [firstString] = strings; - // On windows, check that the root exists. On unix there is no need. - if (isWindows && !knownHard[base]) { - fs.lstat(base, function(err) { - if (err) return cb(err); - knownHard[base] = true; - LOOP(); - }); - } else { - process.nextTick(LOOP); - } - } + if (!isArray(firstString) || !isArray(firstString.raw)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return strings.join(' '); + } - // walk down the path, swapping out linked pathparts for their real - // values - function LOOP() { - // stop if scanned past end of path - if (pos >= p.length) { - if (cache) cache[original] = p; - return cb(null, p); - } + const arguments_ = strings.slice(1); + const parts = [firstString.raw[0]]; - // find the next part - nextPartRe.lastIndex = pos; - var result = nextPartRe.exec(p); - previous = current; - current += result[0]; - base = previous + result[1]; - pos = nextPartRe.lastIndex; + for (let i = 1; i < firstString.length; i++) { + parts.push( + String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), + String(firstString.raw[i]) + ); + } - // continue if not a symlink - if (knownHard[base] || (cache && cache[base] === base)) { - return process.nextTick(LOOP); - } + if (template === undefined) { + template = __nccwpck_require__(500); + } - if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { - // known symbolic link. no need to stat again. - return gotResolvedLink(cache[base]); - } + return template(chalk, parts.join('')); +}; - return fs.lstat(base, gotStat); - } +Object.defineProperties(Chalk.prototype, styles); - function gotStat(err, stat) { - if (err) return cb(err); +const chalk = Chalk(); // eslint-disable-line new-cap +chalk.supportsColor = stdoutColor; +chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap +chalk.stderr.supportsColor = stderrColor; - // if not a symlink, skip to the next path part - if (!stat.isSymbolicLink()) { - knownHard[base] = true; - if (cache) cache[base] = base; - return process.nextTick(LOOP); - } +module.exports = chalk; - // stat & read the link if not read before - // call gotTarget as soon as the link target is known - // dev/ino always return 0 on windows, so skip the check. - if (!isWindows) { - var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); - if (seenLinks.hasOwnProperty(id)) { - return gotTarget(null, seenLinks[id], base); - } - } - fs.stat(base, function(err) { - if (err) return cb(err); - fs.readlink(base, function(err, target) { - if (!isWindows) seenLinks[id] = target; - gotTarget(err, target); - }); - }); - } +/***/ }), - function gotTarget(err, target, base) { - if (err) return cb(err); +/***/ 500: +/***/ ((module) => { - var resolvedLink = pathModule.resolve(previous, target); - if (cache) cache[base] = resolvedLink; - gotResolvedLink(resolvedLink); - } +"use strict"; - function gotResolvedLink(resolvedLink) { - // resolve the link, then start over - p = pathModule.resolve(resolvedLink, p.slice(pos)); - start(); - } -}; +const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; +const ESCAPES = new Map([ + ['n', '\n'], + ['r', '\r'], + ['t', '\t'], + ['b', '\b'], + ['f', '\f'], + ['v', '\v'], + ['0', '\0'], + ['\\', '\\'], + ['e', '\u001B'], + ['a', '\u0007'] +]); -/***/ }), +function unescape(c) { + const u = c[0] === 'u'; + const bracket = c[1] === '{'; -/***/ 356: -/***/ (function(module, __unusedexports, __webpack_require__) { + if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } -"use strict"; + if (u && bracket) { + return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); + } + return ESCAPES.get(c) || c; +} -var utils = __webpack_require__(397); -var settle = __webpack_require__(298); -var buildFullPath = __webpack_require__(757); -var buildURL = __webpack_require__(946); -var http = __webpack_require__(605); -var https = __webpack_require__(211); -var httpFollow = __webpack_require__(804).http; -var httpsFollow = __webpack_require__(804).https; -var url = __webpack_require__(835); -var zlib = __webpack_require__(761); -var pkg = __webpack_require__(96); -var createError = __webpack_require__(462); -var enhanceError = __webpack_require__(614); +function parseArguments(name, arguments_) { + const results = []; + const chunks = arguments_.trim().split(/\s*,\s*/g); + let matches; -var isHttps = /https:?/; + for (const chunk of chunks) { + const number = Number(chunk); + if (!Number.isNaN(number)) { + results.push(number); + } else if ((matches = chunk.match(STRING_REGEX))) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } -/** - * - * @param {http.ClientRequestArgs} options - * @param {AxiosProxyConfig} proxy - * @param {string} location - */ -function setProxy(options, proxy, location) { - options.hostname = proxy.host; - options.host = proxy.host; - options.port = proxy.port; - options.path = location; + return results; +} - // Basic proxy authorization - if (proxy.auth) { - var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64'); - options.headers['Proxy-Authorization'] = 'Basic ' + base64; - } +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; - // If a proxy is used, any redirects must also pass through the proxy - options.beforeRedirect = function beforeRedirect(redirection) { - redirection.headers.host = redirection.host; - setProxy(redirection, proxy, redirection.href); - }; -} + const results = []; + let matches; -/*eslint consistent-return:0*/ -module.exports = function httpAdapter(config) { - return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) { - var resolve = function resolve(value) { - resolvePromise(value); - }; - var reject = function reject(value) { - rejectPromise(value); - }; - var data = config.data; - var headers = config.headers; + while ((matches = STYLE_REGEX.exec(style)) !== null) { + const name = matches[1]; - // Set User-Agent (required by some servers) - // Only set header if it hasn't been set in config - // See https://github.com/axios/axios/issues/69 - if (!headers['User-Agent'] && !headers['user-agent']) { - headers['User-Agent'] = 'axios/' + pkg.version; - } + if (matches[2]) { + const args = parseArguments(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } - if (data && !utils.isStream(data)) { - if (Buffer.isBuffer(data)) { - // Nothing to do... - } else if (utils.isArrayBuffer(data)) { - data = Buffer.from(new Uint8Array(data)); - } else if (utils.isString(data)) { - data = Buffer.from(data, 'utf-8'); - } else { - return reject(createError( - 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', - config - )); - } + return results; +} - // Add Content-Length header if data exists - headers['Content-Length'] = data.length; - } +function buildStyle(chalk, styles) { + const enabled = {}; - // HTTP basic authentication - var auth = undefined; - if (config.auth) { - var username = config.auth.username || ''; - var password = config.auth.password || ''; - auth = username + ':' + password; - } + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } - // Parse url - var fullPath = buildFullPath(config.baseURL, config.url); - var parsed = url.parse(fullPath); - var protocol = parsed.protocol || 'http:'; + let current = chalk; + for (const [styleName, styles] of Object.entries(enabled)) { + if (!Array.isArray(styles)) { + continue; + } - if (!auth && parsed.auth) { - var urlAuth = parsed.auth.split(':'); - var urlUsername = urlAuth[0] || ''; - var urlPassword = urlAuth[1] || ''; - auth = urlUsername + ':' + urlPassword; - } + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } - if (auth) { - delete headers.Authorization; - } + current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; + } - var isHttpsRequest = isHttps.test(protocol); - var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + return current; +} - var options = { - path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), - method: config.method.toUpperCase(), - headers: headers, - agent: agent, - agents: { http: config.httpAgent, https: config.httpsAgent }, - auth: auth - }; +module.exports = (chalk, temporary) => { + const styles = []; + const chunks = []; + let chunk = []; - if (config.socketPath) { - options.socketPath = config.socketPath; - } else { - options.hostname = parsed.hostname; - options.port = parsed.port; - } + // eslint-disable-next-line max-params + temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { + if (escapeCharacter) { + chunk.push(unescape(escapeCharacter)); + } else if (style) { + const string = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); + styles.push({inverse, styles: parseStyle(style)}); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } - var proxy = config.proxy; - if (!proxy && proxy !== false) { - var proxyEnv = protocol.slice(0, -1) + '_proxy'; - var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()]; - if (proxyUrl) { - var parsedProxyUrl = url.parse(proxyUrl); - var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY; - var shouldProxy = true; + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(character); + } + }); - if (noProxyEnv) { - var noProxy = noProxyEnv.split(',').map(function trim(s) { - return s.trim(); - }); + chunks.push(chunk.join('')); - shouldProxy = !noProxy.some(function proxyMatch(proxyElement) { - if (!proxyElement) { - return false; - } - if (proxyElement === '*') { - return true; - } - if (proxyElement[0] === '.' && - parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) { - return true; - } + if (styles.length > 0) { + const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMessage); + } - return parsed.hostname === proxyElement; - }); - } + return chunks.join(''); +}; - if (shouldProxy) { - proxy = { - host: parsedProxyUrl.hostname, - port: parsedProxyUrl.port, - protocol: parsedProxyUrl.protocol - }; - if (parsedProxyUrl.auth) { - var proxyUrlAuth = parsedProxyUrl.auth.split(':'); - proxy.auth = { - username: proxyUrlAuth[0], - password: proxyUrlAuth[1] - }; - } - } - } - } +/***/ }), - if (proxy) { - options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : ''); - setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); - } +/***/ 2415: +/***/ ((module) => { - var transport; - var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true); - if (config.transport) { - transport = config.transport; - } else if (config.maxRedirects === 0) { - transport = isHttpsProxy ? https : http; - } else { - if (config.maxRedirects) { - options.maxRedirects = config.maxRedirects; - } - transport = isHttpsProxy ? httpsFollow : httpFollow; - } +"use strict"; - if (config.maxBodyLength > -1) { - options.maxBodyLength = config.maxBodyLength; - } - // Create the request - var req = transport.request(options, function handleResponse(res) { - if (req.aborted) return; +const stringReplaceAll = (string, substring, replacer) => { + let index = string.indexOf(substring); + if (index === -1) { + return string; + } - // uncompress the response body transparently if required - var stream = res; + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ''; + do { + returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); - // return the last request in case of redirects - var lastRequest = res.req || req; + returnValue += string.substr(endIndex); + return returnValue; +}; +const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { + let endIndex = 0; + let returnValue = ''; + do { + const gotCR = string[index - 1] === '\r'; + returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + endIndex = index + 1; + index = string.indexOf('\n', endIndex); + } while (index !== -1); - // if no content, is HEAD request or decompress disabled we should not decompress - if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) { - switch (res.headers['content-encoding']) { - /*eslint default-case:0*/ - case 'gzip': - case 'compress': - case 'deflate': - // add the unzipper to the body stream processing pipeline - stream = stream.pipe(zlib.createUnzip()); + returnValue += string.substr(endIndex); + return returnValue; +}; - // remove the content-encoding in order to not confuse downstream operations - delete res.headers['content-encoding']; - break; - } - } +module.exports = { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +}; - var response = { - status: res.statusCode, - statusText: res.statusMessage, - headers: res.headers, - config: config, - request: lastRequest - }; - if (config.responseType === 'stream') { - response.data = stream; - settle(resolve, reject, response); - } else { - var responseBuffer = []; - stream.on('data', function handleStreamData(chunk) { - responseBuffer.push(chunk); +/***/ }), - // make sure the content length is not over the maxContentLength if specified - if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) { - stream.destroy(); - reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded', - config, null, lastRequest)); - } - }); +/***/ 7391: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - stream.on('error', function handleStreamError(err) { - if (req.aborted) return; - reject(enhanceError(err, config, null, lastRequest)); - }); +/* MIT license */ +/* eslint-disable no-mixed-operators */ +const cssKeywords = __nccwpck_require__(8510); - stream.on('end', function handleStreamEnd() { - var responseData = Buffer.concat(responseBuffer); - if (config.responseType !== 'arraybuffer') { - responseData = responseData.toString(config.responseEncoding); - if (!config.responseEncoding || config.responseEncoding === 'utf8') { - responseData = utils.stripBOM(responseData); - } - } +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) - response.data = responseData; - settle(resolve, reject, response); - }); - } - }); +const reverseKeywords = {}; +for (const key of Object.keys(cssKeywords)) { + reverseKeywords[cssKeywords[key]] = key; +} - // Handle errors - req.on('error', function handleRequestError(err) { - if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return; - reject(enhanceError(err, config, null, req)); - }); +const convert = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} +}; - // Handle request timeout - if (config.timeout) { - // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. - // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. - // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. - // And then these socket which be hang up will devoring CPU little by little. - // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. - req.setTimeout(config.timeout, function handleRequestTimeout() { - req.abort(); - reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req)); - }); - } +module.exports = convert; - if (config.cancelToken) { - // Handle cancellation - config.cancelToken.promise.then(function onCanceled(cancel) { - if (req.aborted) return; +// Hide .channels and .labels properties +for (const model of Object.keys(convert)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } - req.abort(); - reject(cancel); - }); - } + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } - // Send the request - if (utils.isStream(data)) { - data.on('error', function handleStreamError(err) { - reject(enhanceError(err, config, null, req)); - }).pipe(req); - } else { - req.end(data); - } - }); -}; + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } + const {channels, labels} = convert[model]; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); +} -/***/ }), +convert.rgb.hsl = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const delta = max - min; + let h; + let s; -/***/ 357: -/***/ (function(module) { + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } -module.exports = require("assert"); + h = Math.min(h * 60, 360); -/***/ }), + if (h < 0) { + h += 360; + } -/***/ 363: -/***/ (function(module, __unusedexports, __webpack_require__) { + const l = (min + max) / 2; -"use strict"; + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } + return [h, s * 100, l * 100]; +}; -var utils = __webpack_require__(397); -var buildURL = __webpack_require__(946); -var InterceptorManager = __webpack_require__(844); -var dispatchRequest = __webpack_require__(403); -var mergeConfig = __webpack_require__(978); +convert.rgb.hsv = function (rgb) { + let rdif; + let gdif; + let bdif; + let h; + let s; -/** - * Create a new instance of Axios - * - * @param {Object} instanceConfig The default config for the instance - */ -function Axios(instanceConfig) { - this.defaults = instanceConfig; - this.interceptors = { - request: new InterceptorManager(), - response: new InterceptorManager() - }; -} + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const v = Math.max(r, g, b); + const diff = v - Math.min(r, g, b); + const diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; -/** - * Dispatch a request - * - * @param {Object} config The config specific for this request (merged with this.defaults) - */ -Axios.prototype.request = function request(config) { - /*eslint no-param-reassign:0*/ - // Allow for axios('example/url'[, config]) a la fetch API - if (typeof config === 'string') { - config = arguments[1] || {}; - config.url = arguments[0]; - } else { - config = config || {}; - } + if (diff === 0) { + h = 0; + s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); - config = mergeConfig(this.defaults, config); + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } - // Set config.method - if (config.method) { - config.method = config.method.toLowerCase(); - } else if (this.defaults.method) { - config.method = this.defaults.method.toLowerCase(); - } else { - config.method = 'get'; - } + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } - // Hook up interceptors middleware - var chain = [dispatchRequest, undefined]; - var promise = Promise.resolve(config); + return [ + h * 360, + s * 100, + v * 100 + ]; +}; - this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { - chain.unshift(interceptor.fulfilled, interceptor.rejected); - }); +convert.rgb.hwb = function (rgb) { + const r = rgb[0]; + const g = rgb[1]; + let b = rgb[2]; + const h = convert.rgb.hsl(rgb)[0]; + const w = 1 / 255 * Math.min(r, Math.min(g, b)); - this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { - chain.push(interceptor.fulfilled, interceptor.rejected); - }); + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); - while (chain.length) { - promise = promise.then(chain.shift(), chain.shift()); - } + return [h, w * 100, b * 100]; +}; - return promise; +convert.rgb.cmyk = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + + const k = Math.min(1 - r, 1 - g, 1 - b); + const c = (1 - r - k) / (1 - k) || 0; + const m = (1 - g - k) / (1 - k) || 0; + const y = (1 - b - k) / (1 - k) || 0; + + return [c * 100, m * 100, y * 100, k * 100]; }; -Axios.prototype.getUri = function getUri(config) { - config = mergeConfig(this.defaults, config); - return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); +function comparativeDistance(x, y) { + /* + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + */ + return ( + ((x[0] - y[0]) ** 2) + + ((x[1] - y[1]) ** 2) + + ((x[2] - y[2]) ** 2) + ); +} + +convert.rgb.keyword = function (rgb) { + const reversed = reverseKeywords[rgb]; + if (reversed) { + return reversed; + } + + let currentClosestDistance = Infinity; + let currentClosestKeyword; + + for (const keyword of Object.keys(cssKeywords)) { + const value = cssKeywords[keyword]; + + // Compute comparative distance + const distance = comparativeDistance(rgb, value); + + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + + return currentClosestKeyword; }; -// Provide aliases for supported request methods -utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { - /*eslint func-names:0*/ - Axios.prototype[method] = function(url, config) { - return this.request(mergeConfig(config || {}, { - method: method, - url: url, - data: (config || {}).data - })); - }; -}); +convert.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; +}; -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { - /*eslint func-names:0*/ - Axios.prototype[method] = function(url, data, config) { - return this.request(mergeConfig(config || {}, { - method: method, - url: url, - data: data - })); - }; -}); +convert.rgb.xyz = function (rgb) { + let r = rgb[0] / 255; + let g = rgb[1] / 255; + let b = rgb[2] / 255; -module.exports = Axios; + // Assume sRGB + r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); + g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); + b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); + const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); -/***/ }), + return [x * 100, y * 100, z * 100]; +}; -/***/ 384: -/***/ (function(module) { +convert.rgb.lab = function (rgb) { + const xyz = convert.rgb.xyz(rgb); + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; -"use strict"; + x /= 95.047; + y /= 100; + z /= 108.883; + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); -module.exports = (flag, argv = process.argv) => { - const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); - const position = argv.indexOf(prefix + flag); - const terminatorPosition = argv.indexOf('--'); - return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + return [l, a, b]; }; +convert.hsl.rgb = function (hsl) { + const h = hsl[0] / 360; + const s = hsl[1] / 100; + const l = hsl[2] / 100; + let t2; + let t3; + let val; -/***/ }), + if (s === 0) { + val = l * 255; + return [val, val, val]; + } -/***/ 391: -/***/ (function(module) { + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } -(function (global, factory) { - true ? module.exports = factory() : - undefined; -}(this, (function () { 'use strict'; + const t1 = 2 * l - t2; - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - - function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - } - - function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - } - - function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - } + const rgb = [0, 0, 0]; + for (let i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; + } - /** @ignore */ - var ENTRIES = 'ENTRIES'; - /** @ignore */ - var KEYS = 'KEYS'; - /** @ignore */ - var VALUES = 'VALUES'; - /** @ignore */ - var LEAF = ''; - /** - * @private - */ - var TreeIterator = /** @class */ (function () { - function TreeIterator(set, type) { - var node = set._tree; - var keys = Object.keys(node); - this.set = set; - this._type = type; - this._path = keys.length > 0 ? [{ node: node, keys: keys }] : []; - } - TreeIterator.prototype.next = function () { - var value = this.dive(); - this.backtrack(); - return value; - }; - TreeIterator.prototype.dive = function () { - if (this._path.length === 0) { - return { done: true, value: undefined }; - } - var _a = last(this._path), node = _a.node, keys = _a.keys; - if (last(keys) === LEAF) { - return { done: false, value: this.result() }; - } - this._path.push({ node: node[last(keys)], keys: Object.keys(node[last(keys)]) }); - return this.dive(); - }; - TreeIterator.prototype.backtrack = function () { - if (this._path.length === 0) { - return; - } - last(this._path).keys.pop(); - if (last(this._path).keys.length > 0) { - return; - } - this._path.pop(); - this.backtrack(); - }; - TreeIterator.prototype.key = function () { - return this.set._prefix + this._path - .map(function (_a) { - var keys = _a.keys; - return last(keys); - }) - .filter(function (key) { return key !== LEAF; }) - .join(''); - }; - TreeIterator.prototype.value = function () { - return last(this._path).node[LEAF]; - }; - TreeIterator.prototype.result = function () { - if (this._type === VALUES) { - return this.value(); - } - if (this._type === KEYS) { - return this.key(); - } - return [this.key(), this.value()]; - }; - TreeIterator.prototype[Symbol.iterator] = function () { - return this; - }; - return TreeIterator; - }()); - var last = function (array) { - return array[array.length - 1]; - }; + if (t3 > 1) { + t3--; + } - var NONE = 0; - var CHANGE = 1; - var ADD = 2; - var DELETE = 3; - /** - * @ignore - */ - var fuzzySearch = function (node, query, maxDistance) { - var stack = [{ distance: 0, i: 0, key: '', node: node }]; - var results = {}; - var innerStack = []; - var _loop_1 = function () { - var _a = stack.pop(), node_1 = _a.node, distance = _a.distance, key = _a.key, i = _a.i, edit = _a.edit; - Object.keys(node_1).forEach(function (k) { - if (k === LEAF) { - var totDistance = distance + (query.length - i); - var _a = __read(results[key] || [null, Infinity], 2), d = _a[1]; - if (totDistance <= maxDistance && totDistance < d) { - results[key] = [node_1[k], totDistance]; - } - } - else { - withinDistance(query, k, maxDistance - distance, i, edit, innerStack).forEach(function (_a) { - var d = _a.distance, i = _a.i, edit = _a.edit; - stack.push({ node: node_1[k], distance: distance + d, key: key + k, i: i, edit: edit }); - }); - } - }); - }; - while (stack.length > 0) { - _loop_1(); - } - return results; - }; - /** - * @ignore - */ - var withinDistance = function (a, b, maxDistance, i, edit, stack) { - stack.push({ distance: 0, ia: i, ib: 0, edit: edit }); - var results = []; - while (stack.length > 0) { - var _a = stack.pop(), distance = _a.distance, ia = _a.ia, ib = _a.ib, edit_1 = _a.edit; - if (ib === b.length) { - results.push({ distance: distance, i: ia, edit: edit_1 }); - continue; - } - if (a[ia] === b[ib]) { - stack.push({ distance: distance, ia: ia + 1, ib: ib + 1, edit: NONE }); - } - else { - if (distance >= maxDistance) { - continue; - } - if (edit_1 !== ADD) { - stack.push({ distance: distance + 1, ia: ia, ib: ib + 1, edit: DELETE }); - } - if (ia < a.length) { - if (edit_1 !== DELETE) { - stack.push({ distance: distance + 1, ia: ia + 1, ib: ib, edit: ADD }); - } - if (edit_1 !== DELETE && edit_1 !== ADD) { - stack.push({ distance: distance + 1, ia: ia + 1, ib: ib + 1, edit: CHANGE }); - } - } - } - } - return results; - }; - - /** - * A class implementing the same interface as a standard JavaScript - * [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) - * with string keys, but adding support for efficiently searching entries with - * prefix or fuzzy search. This class is used internally by [[MiniSearch]] as - * the inverted index data structure. The implementation is a radix tree - * (compressed prefix tree). - * - * Since this class can be of general utility beyond _MiniSearch_, it is - * exported by the `minisearch` package and can be imported (or required) as - * `minisearch/SearchableMap`. - * - * @typeParam T The type of the values stored in the map. - */ - var SearchableMap = /** @class */ (function () { - /** - * The constructor is normally called without arguments, creating an empty - * map. In order to create a [[SearchableMap]] from an iterable or from an - * object, check [[SearchableMap.from]] and [[SearchableMap.fromObject]]. - * - * The constructor arguments are for internal use, when creating derived - * mutable views of a map at a prefix. - */ - function SearchableMap(tree, prefix) { - if (tree === void 0) { tree = {}; } - if (prefix === void 0) { prefix = ''; } - this._tree = tree; - this._prefix = prefix; - } - /** - * Creates and returns a mutable view of this [[SearchableMap]], containing only - * entries that share the given prefix. - * - * ### Usage: - * - * ```javascript - * let map = new SearchableMap() - * map.set("unicorn", 1) - * map.set("universe", 2) - * map.set("university", 3) - * map.set("unique", 4) - * map.set("hello", 5) - * - * let uni = map.atPrefix("uni") - * uni.get("unique") // => 4 - * uni.get("unicorn") // => 1 - * uni.get("hello") // => undefined - * - * let univer = map.atPrefix("univer") - * univer.get("unique") // => undefined - * univer.get("universe") // => 2 - * univer.get("university") // => 3 - * ``` - * - * @param prefix The prefix - * @return A [[SearchableMap]] representing a mutable view of the original Map at the given prefix - */ - SearchableMap.prototype.atPrefix = function (prefix) { - var _a; - if (!prefix.startsWith(this._prefix)) { - throw new Error('Mismatched prefix'); - } - var _b = __read(trackDown(this._tree, prefix.slice(this._prefix.length)), 2), node = _b[0], path = _b[1]; - if (node === undefined) { - var _c = __read(last$1(path), 2), parentNode = _c[0], key_1 = _c[1]; - var nodeKey = Object.keys(parentNode).find(function (k) { return k !== LEAF && k.startsWith(key_1); }); - if (nodeKey !== undefined) { - return new SearchableMap((_a = {}, _a[nodeKey.slice(key_1.length)] = parentNode[nodeKey], _a), prefix); - } - } - return new SearchableMap(node || {}, prefix); - }; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear - */ - SearchableMap.prototype.clear = function () { - delete this._size; - this._tree = {}; - }; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete - * @param key Key to delete - */ - SearchableMap.prototype.delete = function (key) { - delete this._size; - return remove(this._tree, key); - }; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries - * @return An iterator iterating through `[key, value]` entries. - */ - SearchableMap.prototype.entries = function () { - return new TreeIterator(this, ENTRIES); - }; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach - * @param fn Iteration function - */ - SearchableMap.prototype.forEach = function (fn) { - var e_1, _a; - try { - for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) { - var _d = __read(_c.value, 2), key = _d[0], value = _d[1]; - fn(key, value, this); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - }; - /** - * Returns a key-value object of all the entries that have a key within the - * given edit distance from the search key. The keys of the returned object are - * the matching keys, while the values are two-elements arrays where the first - * element is the value associated to the key, and the second is the edit - * distance of the key to the search key. - * - * ### Usage: - * - * ```javascript - * let map = new SearchableMap() - * map.set('hello', 'world') - * map.set('hell', 'yeah') - * map.set('ciao', 'mondo') - * - * // Get all entries that match the key 'hallo' with a maximum edit distance of 2 - * map.fuzzyGet('hallo', 2) - * // => { "hello": ["world", 1], "hell": ["yeah", 2] } - * - * // In the example, the "hello" key has value "world" and edit distance of 1 - * // (change "e" to "a"), the key "hell" has value "yeah" and edit distance of 2 - * // (change "e" to "a", delete "o") - * ``` - * - * @param key The search key - * @param maxEditDistance The maximum edit distance (Levenshtein) - * @return A key-value object of the matching keys to their value and edit distance - */ - SearchableMap.prototype.fuzzyGet = function (key, maxEditDistance) { - return fuzzySearch(this._tree, key, maxEditDistance); - }; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get - * @param key Key to get - * @return Value associated to the key, or `undefined` if the key is not - * found. - */ - SearchableMap.prototype.get = function (key) { - var node = lookup(this._tree, key); - return node !== undefined ? node[LEAF] : undefined; - }; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has - * @param key Key - * @return True if the key is in the map, false otherwise - */ - SearchableMap.prototype.has = function (key) { - var node = lookup(this._tree, key); - return node !== undefined && node.hasOwnProperty(LEAF); - }; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys - * @return An `Iterable` iterating through keys - */ - SearchableMap.prototype.keys = function () { - return new TreeIterator(this, KEYS); - }; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/set - * @param key Key to set - * @param value Value to associate to the key - * @return The [[SearchableMap]] itself, to allow chaining - */ - SearchableMap.prototype.set = function (key, value) { - if (typeof key !== 'string') { - throw new Error('key must be a string'); - } - delete this._size; - var node = createPath(this._tree, key); - node[LEAF] = value; - return this; - }; - Object.defineProperty(SearchableMap.prototype, "size", { - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size - */ - get: function () { - var _this = this; - if (this._size) { - return this._size; - } - /** @ignore */ - this._size = 0; - this.forEach(function () { _this._size += 1; }); - return this._size; - }, - enumerable: false, - configurable: true - }); - /** - * Updates the value at the given key using the provided function. The function - * is called with the current value at the key, and its return value is used as - * the new value to be set. - * - * ### Example: - * - * ```javascript - * // Increment the current value by one - * searchableMap.update('somekey', (currentValue) => currentValue == null ? 0 : currentValue + 1) - * ``` - * - * @param key The key to update - * @param fn The function used to compute the new value from the current one - * @return The [[SearchableMap]] itself, to allow chaining - */ - SearchableMap.prototype.update = function (key, fn) { - if (typeof key !== 'string') { - throw new Error('key must be a string'); - } - delete this._size; - var node = createPath(this._tree, key); - node[LEAF] = fn(node[LEAF]); - return this; - }; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/values - * @return An `Iterable` iterating through values. - */ - SearchableMap.prototype.values = function () { - return new TreeIterator(this, VALUES); - }; - /** - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/@@iterator - */ - SearchableMap.prototype[Symbol.iterator] = function () { - return this.entries(); - }; - /** - * Creates a [[SearchableMap]] from an `Iterable` of entries - * - * @param entries Entries to be inserted in the [[SearchableMap]] - * @return A new [[SearchableMap]] with the given entries - */ - SearchableMap.from = function (entries) { - var e_2, _a; - var tree = new SearchableMap(); - try { - for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) { - var _b = __read(entries_1_1.value, 2), key = _b[0], value = _b[1]; - tree.set(key, value); - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1); - } - finally { if (e_2) throw e_2.error; } - } - return tree; - }; - /** - * Creates a [[SearchableMap]] from the iterable properties of a JavaScript object - * - * @param object Object of entries for the [[SearchableMap]] - * @return A new [[SearchableMap]] with the given entries - */ - SearchableMap.fromObject = function (object) { - return SearchableMap.from(Object.entries(object)); - }; - return SearchableMap; - }()); - var trackDown = function (tree, key, path) { - if (path === void 0) { path = []; } - if (key.length === 0 || tree == null) { - return [tree, path]; - } - var nodeKey = Object.keys(tree).find(function (k) { return k !== LEAF && key.startsWith(k); }); - if (nodeKey === undefined) { - path.push([tree, key]); // performance: update in place - return trackDown(undefined, '', path); - } - path.push([tree, nodeKey]); // performance: update in place - return trackDown(tree[nodeKey], key.slice(nodeKey.length), path); - }; - var lookup = function (tree, key) { - if (key.length === 0 || tree == null) { - return tree; - } - var nodeKey = Object.keys(tree).find(function (k) { return k !== LEAF && key.startsWith(k); }); - if (nodeKey === undefined) { - return undefined; - } - return lookup(tree[nodeKey], key.slice(nodeKey.length)); - }; - var createPath = function (tree, key) { - var _a; - if (key.length === 0 || tree == null) { - return tree; - } - var nodeKey = Object.keys(tree).find(function (k) { return k !== LEAF && key.startsWith(k); }); - if (nodeKey === undefined) { - var toSplit = Object.keys(tree).find(function (k) { return k !== LEAF && k.startsWith(key[0]); }); - if (toSplit === undefined) { - tree[key] = {}; - } - else { - var prefix = commonPrefix(key, toSplit); - tree[prefix] = (_a = {}, _a[toSplit.slice(prefix.length)] = tree[toSplit], _a); - delete tree[toSplit]; - return createPath(tree[prefix], key.slice(prefix.length)); - } - return tree[key]; - } - return createPath(tree[nodeKey], key.slice(nodeKey.length)); - }; - var commonPrefix = function (a, b, i, length, prefix) { - if (i === void 0) { i = 0; } - if (length === void 0) { length = Math.min(a.length, b.length); } - if (prefix === void 0) { prefix = ''; } - if (i >= length) { - return prefix; - } - if (a[i] !== b[i]) { - return prefix; - } - return commonPrefix(a, b, i + 1, length, prefix + a[i]); - }; - var remove = function (tree, key) { - var _a = __read(trackDown(tree, key), 2), node = _a[0], path = _a[1]; - if (node === undefined) { - return; - } - delete node[LEAF]; - var keys = Object.keys(node); - if (keys.length === 0) { - cleanup(path); - } - if (keys.length === 1) { - merge(path, keys[0], node[keys[0]]); - } - }; - var cleanup = function (path) { - if (path.length === 0) { - return; - } - var _a = __read(last$1(path), 2), node = _a[0], key = _a[1]; - delete node[key]; - if (Object.keys(node).length === 0) { - cleanup(path.slice(0, -1)); - } - }; - var merge = function (path, key, value) { - if (path.length === 0) { - return; - } - var _a = __read(last$1(path), 2), node = _a[0], nodeKey = _a[1]; - node[nodeKey + key] = value; - delete node[nodeKey]; - }; - var last$1 = function (array) { - return array[array.length - 1]; - }; - - var _a; - var OR = 'or'; - var AND = 'and'; - /** - * [[MiniSearch]] is the main entrypoint class, implementing a full-text search - * engine in memory. - * - * @typeParam T The type of the documents being indexed. - * - * ### Basic example: - * - * ```javascript - * const documents = [ - * { - * id: 1, - * title: 'Moby Dick', - * text: 'Call me Ishmael. Some years ago...', - * category: 'fiction' - * }, - * { - * id: 2, - * title: 'Zen and the Art of Motorcycle Maintenance', - * text: 'I can see by my watch...', - * category: 'fiction' - * }, - * { - * id: 3, - * title: 'Neuromancer', - * text: 'The sky above the port was...', - * category: 'fiction' - * }, - * { - * id: 4, - * title: 'Zen and the Art of Archery', - * text: 'At first sight it must seem...', - * category: 'non-fiction' - * }, - * // ...and more - * ] - * - * // Create a search engine that indexes the 'title' and 'text' fields for - * // full-text search. Search results will include 'title' and 'category' (plus the - * // id field, that is always stored and returned) - * const miniSearch = new MiniSearch({ - * fields: ['title', 'text'], - * storeFields: ['title', 'category'] - * }) - * - * // Add documents to the index - * miniSearch.addAll(documents) - * - * // Search for documents: - * let results = miniSearch.search('zen art motorcycle') - * // => [ - * // { id: 2, title: 'Zen and the Art of Motorcycle Maintenance', category: 'fiction', score: 2.77258 }, - * // { id: 4, title: 'Zen and the Art of Archery', category: 'non-fiction', score: 1.38629 } - * // ] - * ``` - */ - var MiniSearch = /** @class */ (function () { - /** - * @param options Configuration options - * - * ### Examples: - * - * ```javascript - * // Create a search engine that indexes the 'title' and 'text' fields of your - * // documents: - * const miniSearch = new MiniSearch({ fields: ['title', 'text'] }) - * ``` - * - * ### ID Field: - * - * ```javascript - * // Your documents are assumed to include a unique 'id' field, but if you want - * // to use a different field for document identification, you can set the - * // 'idField' option: - * const miniSearch = new MiniSearch({ idField: 'key', fields: ['title', 'text'] }) - * ``` - * - * ### Options and defaults: - * - * ```javascript - * // The full set of options (here with their default value) is: - * const miniSearch = new MiniSearch({ - * // idField: field that uniquely identifies a document - * idField: 'id', - * - * // extractField: function used to get the value of a field in a document. - * // By default, it assumes the document is a flat object with field names as - * // property keys and field values as string property values, but custom logic - * // can be implemented by setting this option to a custom extractor function. - * extractField: (document, fieldName) => document[fieldName], - * - * // tokenize: function used to split fields into individual terms. By - * // default, it is also used to tokenize search queries, unless a specific - * // `tokenize` search option is supplied. When tokenizing an indexed field, - * // the field name is passed as the second argument. - * tokenize: (string, _fieldName) => string.split(SPACE_OR_PUNCTUATION), - * - * // processTerm: function used to process each tokenized term before - * // indexing. It can be used for stemming and normalization. Return a falsy - * // value in order to discard a term. By default, it is also used to process - * // search queries, unless a specific `processTerm` option is supplied as a - * // search option. When processing a term from a indexed field, the field - * // name is passed as the second argument. - * processTerm: (term, _fieldName) => term.toLowerCase(), - * - * // searchOptions: default search options, see the `search` method for - * // details - * searchOptions: undefined, - * - * // fields: document fields to be indexed. Mandatory, but not set by default - * fields: undefined - * - * // storeFields: document fields to be stored and returned as part of the - * // search results. - * storeFields: [] - * }) - * ``` - */ - function MiniSearch(options) { - if ((options === null || options === void 0 ? void 0 : options.fields) == null) { - throw new Error('MiniSearch: option "fields" must be provided'); - } - this._options = __assign(__assign(__assign({}, defaultOptions), options), { searchOptions: __assign(__assign({}, defaultSearchOptions), (options.searchOptions || {})) }); - this._index = new SearchableMap(); - this._documentCount = 0; - this._documentIds = {}; - this._fieldIds = {}; - this._fieldLength = {}; - this._averageFieldLength = {}; - this._nextId = 0; - this._storedFields = {}; - this.addFields(this._options.fields); - } - /** - * Adds a document to the index - * - * @param document The document to be indexed - */ - MiniSearch.prototype.add = function (document) { - var _this = this; - var _a = this._options, extractField = _a.extractField, tokenize = _a.tokenize, processTerm = _a.processTerm, fields = _a.fields, idField = _a.idField; - var id = extractField(document, idField); - if (id == null) { - throw new Error("MiniSearch: document does not have ID field \"" + idField + "\""); - } - var shortDocumentId = this.addDocumentId(id); - this.saveStoredFields(shortDocumentId, document); - fields.forEach(function (field) { - var fieldValue = extractField(document, field); - if (fieldValue == null) { - return; - } - var tokens = tokenize(fieldValue.toString(), field); - _this.addFieldLength(shortDocumentId, _this._fieldIds[field], _this.documentCount - 1, tokens.length); - tokens.forEach(function (term) { - var processedTerm = processTerm(term, field); - if (processedTerm) { - _this.addTerm(_this._fieldIds[field], shortDocumentId, processedTerm); - } - }); - }); - }; - /** - * Adds all the given documents to the index - * - * @param documents An array of documents to be indexed - */ - MiniSearch.prototype.addAll = function (documents) { - var _this = this; - documents.forEach(function (document) { return _this.add(document); }); - }; - /** - * Adds all the given documents to the index asynchronously. - * - * Returns a promise that resolves (to `undefined`) when the indexing is done. - * This method is useful when index many documents, to avoid blocking the main - * thread. The indexing is performed asynchronously and in chunks. - * - * @param documents An array of documents to be indexed - * @param options Configuration options - * @return A promise resolving to `undefined` when the indexing is done - */ - MiniSearch.prototype.addAllAsync = function (documents, options) { - var _this = this; - if (options === void 0) { options = {}; } - var _a = options.chunkSize, chunkSize = _a === void 0 ? 10 : _a; - var acc = { chunk: [], promise: Promise.resolve() }; - var _b = documents.reduce(function (_a, document, i) { - var chunk = _a.chunk, promise = _a.promise; - chunk.push(document); - if ((i + 1) % chunkSize === 0) { - return { - chunk: [], - promise: promise - .then(function () { return new Promise(function (resolve) { return setTimeout(resolve, 0); }); }) - .then(function () { return _this.addAll(chunk); }) - }; - } - else { - return { chunk: chunk, promise: promise }; - } - }, acc), chunk = _b.chunk, promise = _b.promise; - return promise.then(function () { return _this.addAll(chunk); }); - }; - /** - * Removes the given document from the index. - * - * The document to delete must NOT have changed between indexing and deletion, - * otherwise the index will be corrupted. Therefore, when reindexing a document - * after a change, the correct order of operations is: - * - * 1. remove old version - * 2. apply changes - * 3. index new version - * - * @param document The document to be removed - */ - MiniSearch.prototype.remove = function (document) { - var _this = this; - var _a = this._options, tokenize = _a.tokenize, processTerm = _a.processTerm, extractField = _a.extractField, fields = _a.fields, idField = _a.idField; - var id = extractField(document, idField); - if (id == null) { - throw new Error("MiniSearch: document does not have ID field \"" + idField + "\""); - } - var _b = __read(Object.entries(this._documentIds) - .find(function (_a) { - var _b = __read(_a, 2), _ = _b[0], longId = _b[1]; - return id === longId; - }) || [], 1), shortDocumentId = _b[0]; - if (shortDocumentId == null) { - throw new Error("MiniSearch: cannot remove document with ID " + id + ": it is not in the index"); - } - fields.forEach(function (field) { - var fieldValue = extractField(document, field); - if (fieldValue == null) { - return; - } - var tokens = tokenize(fieldValue.toString(), field); - tokens.forEach(function (term) { - var processedTerm = processTerm(term, field); - if (processedTerm) { - _this.removeTerm(_this._fieldIds[field], shortDocumentId, processedTerm); - } - }); - }); - delete this._storedFields[shortDocumentId]; - delete this._documentIds[shortDocumentId]; - this._documentCount -= 1; - }; - /** - * Removes all the given documents from the index. If called with no arguments, - * it removes _all_ documents from the index. - * - * @param documents The documents to be removed. If this argument is omitted, - * all documents are removed. Note that, for removing all documents, it is - * more efficient to call this method with no arguments than to pass all - * documents. - */ - MiniSearch.prototype.removeAll = function (documents) { - var _this = this; - if (documents) { - documents.forEach(function (document) { return _this.remove(document); }); - } - else if (arguments.length > 0) { - throw new Error('Expected documents to be present. Omit the argument to remove all documents.'); - } - else { - this._index = new SearchableMap(); - this._documentCount = 0; - this._documentIds = {}; - this._fieldLength = {}; - this._averageFieldLength = {}; - this._storedFields = {}; - this._nextId = 0; - } - }; - /** - * Search for documents matching the given search query. - * - * The result is a list of scored document IDs matching the query, sorted by - * descending score, and each including data about which terms were matched and - * in which fields. - * - * ### Basic usage: - * - * ```javascript - * // Search for "zen art motorcycle" with default options: terms have to match - * // exactly, and individual terms are joined with OR - * miniSearch.search('zen art motorcycle') - * // => [ { id: 2, score: 2.77258, match: { ... } }, { id: 4, score: 1.38629, match: { ... } } ] - * ``` - * - * ### Restrict search to specific fields: - * - * ```javascript - * // Search only in the 'title' field - * miniSearch.search('zen', { fields: ['title'] }) - * ``` - * - * ### Field boosting: - * - * ```javascript - * // Boost a field - * miniSearch.search('zen', { boost: { title: 2 } }) - * ``` - * - * ### Prefix search: - * - * ```javascript - * // Search for "moto" with prefix search (it will match documents - * // containing terms that start with "moto" or "neuro") - * miniSearch.search('moto neuro', { prefix: true }) - * ``` - * - * ### Fuzzy search: - * - * ```javascript - * // Search for "ismael" with fuzzy search (it will match documents containing - * // terms similar to "ismael", with a maximum edit distance of 0.2 term.length - * // (rounded to nearest integer) - * miniSearch.search('ismael', { fuzzy: 0.2 }) - * ``` - * - * ### Combining strategies: - * - * ```javascript - * // Mix of exact match, prefix search, and fuzzy search - * miniSearch.search('ismael mob', { - * prefix: true, - * fuzzy: 0.2 - * }) - * ``` - * - * ### Advanced prefix and fuzzy search: - * - * ```javascript - * // Perform fuzzy and prefix search depending on the search term. Here - * // performing prefix and fuzzy search only on terms longer than 3 characters - * miniSearch.search('ismael mob', { - * prefix: term => term.length > 3 - * fuzzy: term => term.length > 3 ? 0.2 : null - * }) - * ``` - * - * ### Combine with AND: - * - * ```javascript - * // Combine search terms with AND (to match only documents that contain both - * // "motorcycle" and "art") - * miniSearch.search('motorcycle art', { combineWith: 'AND' }) - * ``` - * - * ### Filtering results: - * - * ```javascript - * // Filter only results in the 'fiction' category (assuming that 'category' - * // is a stored field) - * miniSearch.search('motorcycle art', { - * filter: (result) => result.category === 'fiction' - * }) - * ``` - * - * @param queryString Query string to search for - * @param options Search options. Each option, if not given, defaults to the corresponding value of `searchOptions` given to the constructor, or to the library default. - */ - MiniSearch.prototype.search = function (queryString, searchOptions) { - var _this = this; - if (searchOptions === void 0) { searchOptions = {}; } - var _a = this._options, tokenize = _a.tokenize, processTerm = _a.processTerm, globalSearchOptions = _a.searchOptions; - var options = __assign(__assign({ tokenize: tokenize, processTerm: processTerm }, globalSearchOptions), searchOptions); - var searchTokenize = options.tokenize, searchProcessTerm = options.processTerm; - var terms = searchTokenize(queryString) - .map(function (term) { return searchProcessTerm(term); }) - .filter(function (term) { return !!term; }); - var queries = terms.map(termToQuery(options)); - var results = queries.map(function (query) { return _this.executeQuery(query, options); }); - var combinedResults = this.combineResults(results, options.combineWith); - return Object.entries(combinedResults) - .reduce(function (results, _a) { - var _b = __read(_a, 2), docId = _b[0], _c = _b[1], score = _c.score, match = _c.match, terms = _c.terms; - var result = { - id: _this._documentIds[docId], - terms: uniq(terms), - score: score, - match: match - }; - Object.assign(result, _this._storedFields[docId]); - if (options.filter == null || options.filter(result)) { - results.push(result); - } - return results; - }, []) - .sort(function (_a, _b) { - var a = _a.score; - var b = _b.score; - return a < b ? 1 : -1; - }); - }; - /** - * Provide suggestions for the given search query - * - * The result is a list of suggested modified search queries, derived from the - * given search query, each with a relevance score, sorted by descending score. - * - * ### Basic usage: - * - * ```javascript - * // Get suggestions for 'neuro': - * miniSearch.autoSuggest('neuro') - * // => [ { suggestion: 'neuromancer', terms: [ 'neuromancer' ], score: 0.46240 } ] - * ``` - * - * ### Multiple words: - * - * ```javascript - * // Get suggestions for 'zen ar': - * miniSearch.autoSuggest('zen ar') - * // => [ - * // { suggestion: 'zen archery art', terms: [ 'zen', 'archery', 'art' ], score: 1.73332 }, - * // { suggestion: 'zen art', terms: [ 'zen', 'art' ], score: 1.21313 } - * // ] - * ``` - * - * ### Fuzzy suggestions: - * - * ```javascript - * // Correct spelling mistakes using fuzzy search: - * miniSearch.autoSuggest('neromancer', { fuzzy: 0.2 }) - * // => [ { suggestion: 'neuromancer', terms: [ 'neuromancer' ], score: 1.03998 } ] - * ``` - * - * ### Filtering: - * - * ```javascript - * // Get suggestions for 'zen ar', but only within the 'fiction' category - * // (assuming that 'category' is a stored field): - * miniSearch.autoSuggest('zen ar', { - * filter: (result) => result.category === 'fiction' - * }) - * // => [ - * // { suggestion: 'zen archery art', terms: [ 'zen', 'archery', 'art' ], score: 1.73332 }, - * // { suggestion: 'zen art', terms: [ 'zen', 'art' ], score: 1.21313 } - * // ] - * ``` - * - * @param queryString Query string to be expanded into suggestions - * @param options Search options. The supported options and default values - * are the same as for the `search` method, except that by default prefix - * search is performed on the last term in the query. - * @return A sorted array of suggestions sorted by relevance score. - */ - MiniSearch.prototype.autoSuggest = function (queryString, options) { - if (options === void 0) { options = {}; } - options = __assign(__assign({}, defaultAutoSuggestOptions), options); - var suggestions = this.search(queryString, options).reduce(function (suggestions, _a) { - var score = _a.score, terms = _a.terms; - var phrase = terms.join(' '); - if (suggestions[phrase] == null) { - suggestions[phrase] = { score: score, terms: terms, count: 1 }; - } - else { - suggestions[phrase].score += score; - suggestions[phrase].count += 1; - } - return suggestions; - }, {}); - return Object.entries(suggestions) - .map(function (_a) { - var _b = __read(_a, 2), suggestion = _b[0], _c = _b[1], score = _c.score, terms = _c.terms, count = _c.count; - return ({ suggestion: suggestion, terms: terms, score: score / count }); - }) - .sort(function (_a, _b) { - var a = _a.score; - var b = _b.score; - return a < b ? 1 : -1; - }); - }; - Object.defineProperty(MiniSearch.prototype, "documentCount", { - /** - * Number of documents in the index - */ - get: function () { - return this._documentCount; - }, - enumerable: false, - configurable: true - }); - /** - * Deserializes a JSON index (serialized with `miniSearch.toJSON()`) and - * instantiates a MiniSearch instance. It should be given the same options - * originally used when serializing the index. - * - * ### Usage: - * - * ```javascript - * // If the index was serialized with: - * let miniSearch = new MiniSearch({ fields: ['title', 'text'] }) - * miniSearch.addAll(documents) - * - * const json = JSON.stringify(miniSearch) - * // It can later be deserialized like this: - * miniSearch = MiniSearch.loadJSON(json, { fields: ['title', 'text'] }) - * ``` - * - * @param json JSON-serialized index - * @param options configuration options, same as the constructor - * @return An instance of MiniSearch deserialized from the given JSON. - */ - MiniSearch.loadJSON = function (json, options) { - if (options == null) { - throw new Error('MiniSearch: loadJSON should be given the same options used when serializing the index'); - } - return MiniSearch.loadJS(JSON.parse(json), options); - }; - /** - * Returns the default value of an option. It will throw an error if no option - * with the given name exists. - * - * @param optionName Name of the option - * @return The default value of the given option - * - * ### Usage: - * - * ```javascript - * // Get default tokenizer - * MiniSearch.getDefault('tokenize') - * - * // Get default term processor - * MiniSearch.getDefault('processTerm') - * - * // Unknown options will throw an error - * MiniSearch.getDefault('notExisting') - * // => throws 'MiniSearch: unknown option "notExisting"' - * ``` - */ - MiniSearch.getDefault = function (optionName) { - if (defaultOptions.hasOwnProperty(optionName)) { - return getOwnProperty(defaultOptions, optionName); - } - else { - throw new Error("MiniSearch: unknown option \"" + optionName + "\""); - } - }; - /** - * @ignore - */ - MiniSearch.loadJS = function (js, options) { - var index = js.index, documentCount = js.documentCount, nextId = js.nextId, documentIds = js.documentIds, fieldIds = js.fieldIds, fieldLength = js.fieldLength, averageFieldLength = js.averageFieldLength, storedFields = js.storedFields; - var miniSearch = new MiniSearch(options); - miniSearch._index = new SearchableMap(index._tree, index._prefix); - miniSearch._documentCount = documentCount; - miniSearch._nextId = nextId; - miniSearch._documentIds = documentIds; - miniSearch._fieldIds = fieldIds; - miniSearch._fieldLength = fieldLength; - miniSearch._averageFieldLength = averageFieldLength; - miniSearch._fieldIds = fieldIds; - miniSearch._storedFields = storedFields || {}; - return miniSearch; - }; - /** - * @ignore - */ - MiniSearch.prototype.executeQuery = function (query, searchOptions) { - var _this = this; - var options = __assign(__assign({}, this._options.searchOptions), searchOptions); - var boosts = (options.fields || this._options.fields).reduce(function (boosts, field) { - var _a; - return (__assign(__assign({}, boosts), (_a = {}, _a[field] = getOwnProperty(boosts, field) || 1, _a))); - }, options.boost || {}); - var boostDocument = options.boostDocument, weights = options.weights; - var _a = __assign(__assign({}, defaultSearchOptions.weights), weights), fuzzyWeight = _a.fuzzy, prefixWeight = _a.prefix; - var exactMatch = this.termResults(query.term, boosts, boostDocument, this._index.get(query.term)); - if (!query.fuzzy && !query.prefix) { - return exactMatch; - } - var results = [exactMatch]; - if (query.prefix) { - this._index.atPrefix(query.term).forEach(function (term, data) { - var weightedDistance = (0.3 * (term.length - query.term.length)) / term.length; - results.push(_this.termResults(term, boosts, boostDocument, data, prefixWeight, weightedDistance)); - }); - } - if (query.fuzzy) { - var fuzzy = (query.fuzzy === true) ? 0.2 : query.fuzzy; - var maxDistance = fuzzy < 1 ? Math.round(query.term.length * fuzzy) : fuzzy; - Object.entries(this._index.fuzzyGet(query.term, maxDistance)).forEach(function (_a) { - var _b = __read(_a, 2), term = _b[0], _c = __read(_b[1], 2), data = _c[0], distance = _c[1]; - var weightedDistance = distance / term.length; - results.push(_this.termResults(term, boosts, boostDocument, data, fuzzyWeight, weightedDistance)); - }); - } - return results.reduce(combinators[OR], {}); - }; - /** - * @ignore - */ - MiniSearch.prototype.combineResults = function (results, combineWith) { - if (combineWith === void 0) { combineWith = OR; } - if (results.length === 0) { - return {}; - } - var operator = combineWith.toLowerCase(); - return results.reduce(combinators[operator], null) || {}; - }; - /** - * Allows serialization of the index to JSON, to possibly store it and later - * deserialize it with `MiniSearch.loadJSON`. - * - * Normally one does not directly call this method, but rather call the - * standard JavaScript `JSON.stringify()` passing the `MiniSearch` instance, - * and JavaScript will internally call this method. Upon deserialization, one - * must pass to `loadJSON` the same options used to create the original - * instance that was serialized. - * - * ### Usage: - * - * ```javascript - * // Serialize the index: - * let miniSearch = new MiniSearch({ fields: ['title', 'text'] }) - * miniSearch.addAll(documents) - * const json = JSON.stringify(miniSearch) - * - * // Later, to deserialize it: - * miniSearch = MiniSearch.loadJSON(json, { fields: ['title', 'text'] }) - * ``` - * - * @return A plain-object serializeable representation of the search index. - */ - MiniSearch.prototype.toJSON = function () { - return { - index: this._index, - documentCount: this._documentCount, - nextId: this._nextId, - documentIds: this._documentIds, - fieldIds: this._fieldIds, - fieldLength: this._fieldLength, - averageFieldLength: this._averageFieldLength, - storedFields: this._storedFields - }; - }; - /** - * @ignore - */ - MiniSearch.prototype.termResults = function (term, boosts, boostDocument, indexData, weight, editDistance) { - var _this = this; - if (editDistance === void 0) { editDistance = 0; } - if (indexData == null) { - return {}; - } - return Object.entries(boosts).reduce(function (results, _a) { - var _b = __read(_a, 2), field = _b[0], boost = _b[1]; - var fieldId = _this._fieldIds[field]; - var _c = indexData[fieldId] || { ds: {} }, df = _c.df, ds = _c.ds; - Object.entries(ds).forEach(function (_a) { - var _b = __read(_a, 2), documentId = _b[0], tf = _b[1]; - var docBoost = boostDocument ? boostDocument(_this._documentIds[documentId], term) : 1; - if (!docBoost) { - return; - } - var normalizedLength = _this._fieldLength[documentId][fieldId] / _this._averageFieldLength[fieldId]; - results[documentId] = results[documentId] || { score: 0, match: {}, terms: [] }; - results[documentId].terms.push(term); - results[documentId].match[term] = getOwnProperty(results[documentId].match, term) || []; - results[documentId].score += docBoost * score(tf, df, _this._documentCount, normalizedLength, boost, editDistance); - results[documentId].match[term].push(field); - }); - return results; - }, {}); - }; - /** - * @ignore - */ - MiniSearch.prototype.addTerm = function (fieldId, documentId, term) { - this._index.update(term, function (indexData) { - var _a; - indexData = indexData || {}; - var fieldIndex = indexData[fieldId] || { df: 0, ds: {} }; - if (fieldIndex.ds[documentId] == null) { - fieldIndex.df += 1; - } - fieldIndex.ds[documentId] = (fieldIndex.ds[documentId] || 0) + 1; - return __assign(__assign({}, indexData), (_a = {}, _a[fieldId] = fieldIndex, _a)); - }); - }; - /** - * @ignore - */ - MiniSearch.prototype.removeTerm = function (fieldId, documentId, term) { - var _this = this; - if (!this._index.has(term)) { - this.warnDocumentChanged(documentId, fieldId, term); - return; - } - this._index.update(term, function (indexData) { - var _a; - var fieldIndex = indexData[fieldId]; - if (fieldIndex == null || fieldIndex.ds[documentId] == null) { - _this.warnDocumentChanged(documentId, fieldId, term); - return indexData; - } - if (fieldIndex.ds[documentId] <= 1) { - if (fieldIndex.df <= 1) { - delete indexData[fieldId]; - return indexData; - } - fieldIndex.df -= 1; - } - if (fieldIndex.ds[documentId] <= 1) { - delete fieldIndex.ds[documentId]; - return indexData; - } - fieldIndex.ds[documentId] -= 1; - return __assign(__assign({}, indexData), (_a = {}, _a[fieldId] = fieldIndex, _a)); - }); - if (Object.keys(this._index.get(term)).length === 0) { - this._index.delete(term); - } - }; - /** - * @ignore - */ - MiniSearch.prototype.warnDocumentChanged = function (shortDocumentId, fieldId, term) { - if (console == null || console.warn == null) { - return; - } - var fieldName = Object.entries(this._fieldIds).find(function (_a) { - var _b = __read(_a, 2), name = _b[0], id = _b[1]; - return id === fieldId; - })[0]; - console.warn("MiniSearch: document with ID " + this._documentIds[shortDocumentId] + " has changed before removal: term \"" + term + "\" was not present in field \"" + fieldName + "\". Removing a document after it has changed can corrupt the index!"); - }; - /** - * @ignore - */ - MiniSearch.prototype.addDocumentId = function (documentId) { - var shortDocumentId = this._nextId.toString(36); - this._documentIds[shortDocumentId] = documentId; - this._documentCount += 1; - this._nextId += 1; - return shortDocumentId; - }; - /** - * @ignore - */ - MiniSearch.prototype.addFields = function (fields) { - var _this = this; - fields.forEach(function (field, i) { _this._fieldIds[field] = i; }); - }; - /** - * @ignore - */ - MiniSearch.prototype.addFieldLength = function (documentId, fieldId, count, length) { - this._averageFieldLength[fieldId] = this._averageFieldLength[fieldId] || 0; - var totalLength = (this._averageFieldLength[fieldId] * count) + length; - this._fieldLength[documentId] = this._fieldLength[documentId] || {}; - this._fieldLength[documentId][fieldId] = length; - this._averageFieldLength[fieldId] = totalLength / (count + 1); - }; - /** - * @ignore - */ - MiniSearch.prototype.saveStoredFields = function (documentId, doc) { - var _this = this; - var _a = this._options, storeFields = _a.storeFields, extractField = _a.extractField; - if (storeFields == null || storeFields.length === 0) { - return; - } - this._storedFields[documentId] = this._storedFields[documentId] || {}; - storeFields.forEach(function (fieldName) { - var fieldValue = extractField(doc, fieldName); - if (fieldValue === undefined) { - return; - } - _this._storedFields[documentId][fieldName] = fieldValue; - }); - }; - return MiniSearch; - }()); - var getOwnProperty = function (object, property) { - return Object.prototype.hasOwnProperty.call(object, property) ? object[property] : undefined; - }; - var combinators = (_a = {}, - _a[OR] = function (a, b) { - return Object.entries(b).reduce(function (combined, _a) { - var _b; - var _c = __read(_a, 2), documentId = _c[0], _d = _c[1], score = _d.score, match = _d.match, terms = _d.terms; - if (combined[documentId] == null) { - combined[documentId] = { score: score, match: match, terms: terms }; - } - else { - combined[documentId].score += score; - combined[documentId].score *= 1.5; - (_b = combined[documentId].terms).push.apply(_b, __spread(terms)); - Object.assign(combined[documentId].match, match); - } - return combined; - }, a || {}); - }, - _a[AND] = function (a, b) { - if (a == null) { - return b; - } - return Object.entries(b).reduce(function (combined, _a) { - var _b = __read(_a, 2), documentId = _b[0], _c = _b[1], score = _c.score, match = _c.match, terms = _c.terms; - if (a[documentId] === undefined) { - return combined; - } - combined[documentId] = combined[documentId] || {}; - combined[documentId].score = a[documentId].score + score; - combined[documentId].match = __assign(__assign({}, a[documentId].match), match); - combined[documentId].terms = __spread(a[documentId].terms, terms); - return combined; - }, {}); - }, - _a); - var tfIdf = function (tf, df, n) { return tf * Math.log(n / df); }; - var score = function (termFrequency, documentFrequency, documentCount, normalizedLength, boost, editDistance) { - var weight = boost / (1 + (0.333 * boost * editDistance)); - return weight * tfIdf(termFrequency, documentFrequency, documentCount) / normalizedLength; - }; - var termToQuery = function (options) { return function (term, i, terms) { - var fuzzy = (typeof options.fuzzy === 'function') - ? options.fuzzy(term, i, terms) - : (options.fuzzy || false); - var prefix = (typeof options.prefix === 'function') - ? options.prefix(term, i, terms) - : (options.prefix === true); - return { term: term, fuzzy: fuzzy, prefix: prefix }; - }; }; - var uniq = function (array) { - return array.filter(function (element, i, array) { return array.indexOf(element) === i; }); - }; - var defaultOptions = { - idField: 'id', - extractField: function (document, fieldName) { return document[fieldName]; }, - tokenize: function (text, fieldName) { return text.split(SPACE_OR_PUNCTUATION); }, - processTerm: function (term, fieldName) { return term.toLowerCase(); }, - fields: undefined, - searchOptions: undefined, - storeFields: [] - }; - var defaultSearchOptions = { - combineWith: OR, - prefix: false, - fuzzy: false, - boost: {}, - weights: { fuzzy: 0.9, prefix: 0.75 } - }; - var defaultAutoSuggestOptions = { - prefix: function (term, i, terms) { - return i === terms.length - 1; - } - }; - // This regular expression matches any Unicode space or punctuation character - // Adapted from https://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5Cp%7BZ%7D%5Cp%7BP%7D&abb=on&c=on&esc=on - var SPACE_OR_PUNCTUATION = /[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u; - - return MiniSearch; - -}))); -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 397: -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -var bind = __webpack_require__(556); - -/*global toString:true*/ - -// utils is a library of generic helper functions non-specific to axios - -var toString = Object.prototype.toString; - -/** - * Determine if a value is an Array - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an Array, otherwise false - */ -function isArray(val) { - return toString.call(val) === '[object Array]'; -} - -/** - * Determine if a value is undefined - * - * @param {Object} val The value to test - * @returns {boolean} True if the value is undefined, otherwise false - */ -function isUndefined(val) { - return typeof val === 'undefined'; -} - -/** - * Determine if a value is a Buffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Buffer, otherwise false - */ -function isBuffer(val) { - return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) - && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); -} - -/** - * Determine if a value is an ArrayBuffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an ArrayBuffer, otherwise false - */ -function isArrayBuffer(val) { - return toString.call(val) === '[object ArrayBuffer]'; -} - -/** - * Determine if a value is a FormData - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an FormData, otherwise false - */ -function isFormData(val) { - return (typeof FormData !== 'undefined') && (val instanceof FormData); -} - -/** - * Determine if a value is a view on an ArrayBuffer - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false - */ -function isArrayBufferView(val) { - var result; - if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { - result = ArrayBuffer.isView(val); - } else { - result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); - } - return result; -} - -/** - * Determine if a value is a String - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a String, otherwise false - */ -function isString(val) { - return typeof val === 'string'; -} - -/** - * Determine if a value is a Number - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Number, otherwise false - */ -function isNumber(val) { - return typeof val === 'number'; -} - -/** - * Determine if a value is an Object - * - * @param {Object} val The value to test - * @returns {boolean} True if value is an Object, otherwise false - */ -function isObject(val) { - return val !== null && typeof val === 'object'; -} - -/** - * Determine if a value is a plain Object - * - * @param {Object} val The value to test - * @return {boolean} True if value is a plain Object, otherwise false - */ -function isPlainObject(val) { - if (toString.call(val) !== '[object Object]') { - return false; - } - - var prototype = Object.getPrototypeOf(val); - return prototype === null || prototype === Object.prototype; -} - -/** - * Determine if a value is a Date - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Date, otherwise false - */ -function isDate(val) { - return toString.call(val) === '[object Date]'; -} - -/** - * Determine if a value is a File - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a File, otherwise false - */ -function isFile(val) { - return toString.call(val) === '[object File]'; -} - -/** - * Determine if a value is a Blob - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Blob, otherwise false - */ -function isBlob(val) { - return toString.call(val) === '[object Blob]'; -} - -/** - * Determine if a value is a Function - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Function, otherwise false - */ -function isFunction(val) { - return toString.call(val) === '[object Function]'; -} - -/** - * Determine if a value is a Stream - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a Stream, otherwise false - */ -function isStream(val) { - return isObject(val) && isFunction(val.pipe); -} - -/** - * Determine if a value is a URLSearchParams object - * - * @param {Object} val The value to test - * @returns {boolean} True if value is a URLSearchParams object, otherwise false - */ -function isURLSearchParams(val) { - return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; -} - -/** - * Trim excess whitespace off the beginning and end of a string - * - * @param {String} str The String to trim - * @returns {String} The String freed of excess whitespace - */ -function trim(str) { - return str.replace(/^\s*/, '').replace(/\s*$/, ''); -} - -/** - * Determine if we're running in a standard browser environment - * - * This allows axios to run in a web worker, and react-native. - * Both environments support XMLHttpRequest, but not fully standard globals. - * - * web workers: - * typeof window -> undefined - * typeof document -> undefined - * - * react-native: - * navigator.product -> 'ReactNative' - * nativescript - * navigator.product -> 'NativeScript' or 'NS' - */ -function isStandardBrowserEnv() { - if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || - navigator.product === 'NativeScript' || - navigator.product === 'NS')) { - return false; - } - return ( - typeof window !== 'undefined' && - typeof document !== 'undefined' - ); -} - -/** - * Iterate over an Array or an Object invoking a function for each item. - * - * If `obj` is an Array callback will be called passing - * the value, index, and complete array for each item. - * - * If 'obj' is an Object callback will be called passing - * the value, key, and complete object for each property. - * - * @param {Object|Array} obj The object to iterate - * @param {Function} fn The callback to invoke for each item - */ -function forEach(obj, fn) { - // Don't bother if no value provided - if (obj === null || typeof obj === 'undefined') { - return; - } - - // Force an array if not already something iterable - if (typeof obj !== 'object') { - /*eslint no-param-reassign:0*/ - obj = [obj]; - } - - if (isArray(obj)) { - // Iterate over array values - for (var i = 0, l = obj.length; i < l; i++) { - fn.call(null, obj[i], i, obj); - } - } else { - // Iterate over object keys - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - fn.call(null, obj[key], key, obj); - } - } - } -} - -/** - * Accepts varargs expecting each argument to be an object, then - * immutably merges the properties of each object and returns result. - * - * When multiple objects contain the same key the later object in - * the arguments list will take precedence. - * - * Example: - * - * ```js - * var result = merge({foo: 123}, {foo: 456}); - * console.log(result.foo); // outputs 456 - * ``` - * - * @param {Object} obj1 Object to merge - * @returns {Object} Result of all merge properties - */ -function merge(/* obj1, obj2, obj3, ... */) { - var result = {}; - function assignValue(val, key) { - if (isPlainObject(result[key]) && isPlainObject(val)) { - result[key] = merge(result[key], val); - } else if (isPlainObject(val)) { - result[key] = merge({}, val); - } else if (isArray(val)) { - result[key] = val.slice(); - } else { - result[key] = val; - } - } - - for (var i = 0, l = arguments.length; i < l; i++) { - forEach(arguments[i], assignValue); - } - return result; -} - -/** - * Extends object a by mutably adding to it the properties of object b. - * - * @param {Object} a The object to be extended - * @param {Object} b The object to copy properties from - * @param {Object} thisArg The object to bind function to - * @return {Object} The resulting value of object a - */ -function extend(a, b, thisArg) { - forEach(b, function assignValue(val, key) { - if (thisArg && typeof val === 'function') { - a[key] = bind(val, thisArg); - } else { - a[key] = val; - } - }); - return a; -} - -/** - * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) - * - * @param {string} content with BOM - * @return {string} content value without BOM - */ -function stripBOM(content) { - if (content.charCodeAt(0) === 0xFEFF) { - content = content.slice(1); - } - return content; -} - -module.exports = { - isArray: isArray, - isArrayBuffer: isArrayBuffer, - isBuffer: isBuffer, - isFormData: isFormData, - isArrayBufferView: isArrayBufferView, - isString: isString, - isNumber: isNumber, - isObject: isObject, - isPlainObject: isPlainObject, - isUndefined: isUndefined, - isDate: isDate, - isFile: isFile, - isBlob: isBlob, - isFunction: isFunction, - isStream: isStream, - isURLSearchParams: isURLSearchParams, - isStandardBrowserEnv: isStandardBrowserEnv, - forEach: forEach, - merge: merge, - extend: extend, - trim: trim, - stripBOM: stripBOM -}; - - -/***/ }), - -/***/ 403: -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -var utils = __webpack_require__(397); -var transformData = __webpack_require__(700); -var isCancel = __webpack_require__(565); -var defaults = __webpack_require__(857); - -/** - * Throws a `Cancel` if cancellation has been requested. - */ -function throwIfCancellationRequested(config) { - if (config.cancelToken) { - config.cancelToken.throwIfRequested(); - } -} - -/** - * Dispatch a request to the server using the configured adapter. - * - * @param {object} config The config that is to be used for the request - * @returns {Promise} The Promise to be fulfilled - */ -module.exports = function dispatchRequest(config) { - throwIfCancellationRequested(config); - - // Ensure headers exist - config.headers = config.headers || {}; - - // Transform request data - config.data = transformData( - config.data, - config.headers, - config.transformRequest - ); - - // Flatten headers - config.headers = utils.merge( - config.headers.common || {}, - config.headers[config.method] || {}, - config.headers - ); - - utils.forEach( - ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], - function cleanHeaderConfig(method) { - delete config.headers[method]; - } - ); - - var adapter = config.adapter || defaults.adapter; - - return adapter(config).then(function onAdapterResolution(response) { - throwIfCancellationRequested(config); - - // Transform response data - response.data = transformData( - response.data, - response.headers, - config.transformResponse - ); - - return response; - }, function onAdapterRejection(reason) { - if (!isCancel(reason)) { - throwIfCancellationRequested(config); - - // Transform response data - if (reason && reason.response) { - reason.response.data = transformData( - reason.response.data, - reason.response.headers, - config.transformResponse - ); - } - } - - return Promise.reject(reason); - }); -}; - - -/***/ }), - -/***/ 413: -/***/ (function(module) { - -module.exports = require("stream"); - -/***/ }), - -/***/ 416: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var concatMap = __webpack_require__(812); -var balanced = __webpack_require__(502); - -module.exports = expandTop; - -var escSlash = '\0SLASH'+Math.random()+'\0'; -var escOpen = '\0OPEN'+Math.random()+'\0'; -var escClose = '\0CLOSE'+Math.random()+'\0'; -var escComma = '\0COMMA'+Math.random()+'\0'; -var escPeriod = '\0PERIOD'+Math.random()+'\0'; - -function numeric(str) { - return parseInt(str, 10) == str - ? parseInt(str, 10) - : str.charCodeAt(0); -} - -function escapeBraces(str) { - return str.split('\\\\').join(escSlash) - .split('\\{').join(escOpen) - .split('\\}').join(escClose) - .split('\\,').join(escComma) - .split('\\.').join(escPeriod); -} - -function unescapeBraces(str) { - return str.split(escSlash).join('\\') - .split(escOpen).join('{') - .split(escClose).join('}') - .split(escComma).join(',') - .split(escPeriod).join('.'); -} - - -// Basically just str.split(","), but handling cases -// where we have nested braced sections, which should be -// treated as individual members, like {a,{b,c},d} -function parseCommaParts(str) { - if (!str) - return ['']; - - var parts = []; - var m = balanced('{', '}', str); - - if (!m) - return str.split(','); - - var pre = m.pre; - var body = m.body; - var post = m.post; - var p = pre.split(','); - - p[p.length-1] += '{' + body + '}'; - var postParts = parseCommaParts(post); - if (post.length) { - p[p.length-1] += postParts.shift(); - p.push.apply(p, postParts); - } - - parts.push.apply(parts, p); - - return parts; -} - -function expandTop(str) { - if (!str) - return []; - - // I don't know why Bash 4.3 does this, but it does. - // Anything starting with {} will have the first two bytes preserved - // but *only* at the top level, so {},a}b will not expand to anything, - // but a{},b}c will be expanded to [a}c,abc]. - // One could argue that this is a bug in Bash, but since the goal of - // this module is to match Bash's rules, we escape a leading {} - if (str.substr(0, 2) === '{}') { - str = '\\{\\}' + str.substr(2); - } - - return expand(escapeBraces(str), true).map(unescapeBraces); -} - -function identity(e) { - return e; -} - -function embrace(str) { - return '{' + str + '}'; -} -function isPadded(el) { - return /^-?0\d/.test(el); -} - -function lte(i, y) { - return i <= y; -} -function gte(i, y) { - return i >= y; -} - -function expand(str, isTop) { - var expansions = []; - - var m = balanced('{', '}', str); - if (!m || /\$$/.test(m.pre)) return [str]; - - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = m.body.indexOf(',') >= 0; - if (!isSequence && !isOptions) { - // {a},b} - if (m.post.match(/,.*\}/)) { - str = m.pre + '{' + m.body + escClose + m.post; - return expand(str); - } - return [str]; - } - - var n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - // x{{a,b}}y ==> x{a}y x{b}y - n = expand(n[0], false).map(embrace); - if (n.length === 1) { - var post = m.post.length - ? expand(m.post, false) - : ['']; - return post.map(function(p) { - return m.pre + n[0] + p; - }); - } - } - } - - // at this point, n is the parts, and we know it's not a comma set - // with a single entry. - - // no need to expand pre, since it is guaranteed to be free of brace-sets - var pre = m.pre; - var post = m.post.length - ? expand(m.post, false) - : ['']; - - var N; - - if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length) - var incr = n.length == 3 - ? Math.abs(numeric(n[2])) - : 1; - var test = lte; - var reverse = y < x; - if (reverse) { - incr *= -1; - test = gte; - } - var pad = n.some(isPadded); - - N = []; - - for (var i = x; test(i, y); i += incr) { - var c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === '\\') - c = ''; - } else { - c = String(i); - if (pad) { - var need = width - c.length; - if (need > 0) { - var z = new Array(need + 1).join('0'); - if (i < 0) - c = '-' + z + c.slice(1); - else - c = z + c; - } - } - } - N.push(c); - } - } else { - N = concatMap(n, function(el) { return expand(el, false) }); - } - - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) - expansions.push(expansion); - } - } - - return expansions; -} - - - -/***/ }), - -/***/ 421: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var wrappy = __webpack_require__(719) -var reqs = Object.create(null) -var once = __webpack_require__(870) - -module.exports = wrappy(inflight) - -function inflight (key, cb) { - if (reqs[key]) { - reqs[key].push(cb) - return null - } else { - reqs[key] = [cb] - return makeres(key) - } -} - -function makeres (key) { - return once(function RES () { - var cbs = reqs[key] - var len = cbs.length - var args = slice(arguments) - - // XXX It's somewhat ambiguous whether a new callback added in this - // pass should be queued for later execution if something in the - // list of callbacks throws, or if it should just be discarded. - // However, it's such an edge case that it hardly matters, and either - // choice is likely as surprising as the other. - // As it happens, we do go ahead and schedule it for later execution. - try { - for (var i = 0; i < len; i++) { - cbs[i].apply(null, args) - } - } finally { - if (cbs.length > len) { - // added more in the interim. - // de-zalgo, just in case, but don't call again. - cbs.splice(0, len) - process.nextTick(function () { - RES.apply(null, args) - }) - } else { - delete reqs[key] - } - } - }) -} - -function slice (args) { - var length = args.length - var array = [] - - for (var i = 0; i < length; i++) array[i] = args[i] - return array -} - - -/***/ }), - -/***/ 429: -/***/ (function(module) { - -"use strict"; - - -/** - * Determines whether the specified URL is absolute - * - * @param {string} url The URL to test - * @returns {boolean} True if the specified URL is absolute, otherwise false - */ -module.exports = function isAbsoluteURL(url) { - // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). - // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed - // by any combination of letters, digits, plus, period, or hyphen. - return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); -}; - - -/***/ }), - -/***/ 462: -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -var enhanceError = __webpack_require__(614); - -/** - * Create an Error with the specified message, config, error code, request and response. - * - * @param {string} message The error message. - * @param {Object} config The config. - * @param {string} [code] The error code (for example, 'ECONNABORTED'). - * @param {Object} [request] The request. - * @param {Object} [response] The response. - * @returns {Error} The created error. - */ -module.exports = function createError(message, config, code, request, response) { - var error = new Error(message); - return enhanceError(error, config, code, request, response); -}; - - -/***/ }), - -/***/ 490: -/***/ (function(module) { - -"use strict"; - - -const stringReplaceAll = (string, substring, replacer) => { - let index = string.indexOf(substring); - if (index === -1) { - return string; - } - - const substringLength = substring.length; - let endIndex = 0; - let returnValue = ''; - do { - returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; - endIndex = index + substringLength; - index = string.indexOf(substring, endIndex); - } while (index !== -1); - - returnValue += string.substr(endIndex); - return returnValue; -}; - -const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { - let endIndex = 0; - let returnValue = ''; - do { - const gotCR = string[index - 1] === '\r'; - returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; - endIndex = index + 1; - index = string.indexOf('\n', endIndex); - } while (index !== -1); - - returnValue += string.substr(endIndex); - return returnValue; -}; - -module.exports = { - stringReplaceAll, - stringEncaseCRLFWithFirstIndex -}; - - -/***/ }), - -/***/ 502: -/***/ (function(module) { - -"use strict"; - -module.exports = balanced; -function balanced(a, b, str) { - if (a instanceof RegExp) a = maybeMatch(a, str); - if (b instanceof RegExp) b = maybeMatch(b, str); - - var r = range(a, b, str); - - return r && { - start: r[0], - end: r[1], - pre: str.slice(0, r[0]), - body: str.slice(r[0] + a.length, r[1]), - post: str.slice(r[1] + b.length) - }; -} - -function maybeMatch(reg, str) { - var m = str.match(reg); - return m ? m[0] : null; -} - -balanced.range = range; -function range(a, b, str) { - var begs, beg, left, right, result; - var ai = str.indexOf(a); - var bi = str.indexOf(b, ai + 1); - var i = ai; - - if (ai >= 0 && bi > 0) { - if(a===b) { - return [ai, bi]; - } - begs = []; - left = str.length; - - while (i >= 0 && !result) { - if (i == ai) { - begs.push(i); - ai = str.indexOf(a, i + 1); - } else if (begs.length == 1) { - result = [ begs.pop(), bi ]; - } else { - beg = begs.pop(); - if (beg < left) { - left = beg; - right = bi; - } - - bi = str.indexOf(b, i + 1); - } - - i = ai < bi && ai >= 0 ? ai : bi; - } - - if (begs.length) { - result = [ left, right ]; - } - } - - return result; -} - - -/***/ }), - -/***/ 507: -/***/ (function(module) { - -"use strict"; + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } + rgb[i] = val * 255; + } -/** - * Creates a new URL by combining the specified URLs - * - * @param {string} baseURL The base URL - * @param {string} relativeURL The relative URL - * @returns {string} The combined URL - */ -module.exports = function combineURLs(baseURL, relativeURL) { - return relativeURL - ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') - : baseURL; + return rgb; }; +convert.hsl.hsv = function (hsl) { + const h = hsl[0]; + let s = hsl[1] / 100; + let l = hsl[2] / 100; + let smin = s; + const lmin = Math.max(l, 0.01); -/***/ }), - -/***/ 543: -/***/ (function(module) { - -"use strict"; - + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + const v = (l + s) / 2; + const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); -/** - * Determines whether the payload is an error thrown by Axios - * - * @param {*} payload The value to test - * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false - */ -module.exports = function isAxiosError(payload) { - return (typeof payload === 'object') && (payload.isAxiosError === true); + return [h, sv * 100, v * 100]; }; +convert.hsv.rgb = function (hsv) { + const h = hsv[0] / 60; + const s = hsv[1] / 100; + let v = hsv[2] / 100; + const hi = Math.floor(h) % 6; -/***/ }), - -/***/ 544: -/***/ (function(module, __unusedexports, __webpack_require__) { - -module.exports = realpath -realpath.realpath = realpath -realpath.sync = realpathSync -realpath.realpathSync = realpathSync -realpath.monkeypatch = monkeypatch -realpath.unmonkeypatch = unmonkeypatch - -var fs = __webpack_require__(747) -var origRealpath = fs.realpath -var origRealpathSync = fs.realpathSync + const f = h - Math.floor(h); + const p = 255 * v * (1 - s); + const q = 255 * v * (1 - (s * f)); + const t = 255 * v * (1 - (s * (1 - f))); + v *= 255; -var version = process.version -var ok = /^v[0-5]\./.test(version) -var old = __webpack_require__(348) + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +}; -function newError (er) { - return er && er.syscall === 'realpath' && ( - er.code === 'ELOOP' || - er.code === 'ENOMEM' || - er.code === 'ENAMETOOLONG' - ) -} +convert.hsv.hsl = function (hsv) { + const h = hsv[0]; + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const vmin = Math.max(v, 0.01); + let sl; + let l; -function realpath (p, cache, cb) { - if (ok) { - return origRealpath(p, cache, cb) - } + l = (2 - s) * v; + const lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; - if (typeof cache === 'function') { - cb = cache - cache = null - } - origRealpath(p, cache, function (er, result) { - if (newError(er)) { - old.realpath(p, cache, cb) - } else { - cb(er, result) - } - }) -} + return [h, sl * 100, l * 100]; +}; -function realpathSync (p, cache) { - if (ok) { - return origRealpathSync(p, cache) - } +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert.hwb.rgb = function (hwb) { + const h = hwb[0] / 360; + let wh = hwb[1] / 100; + let bl = hwb[2] / 100; + const ratio = wh + bl; + let f; - try { - return origRealpathSync(p, cache) - } catch (er) { - if (newError(er)) { - return old.realpathSync(p, cache) - } else { - throw er - } - } -} + // Wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } -function monkeypatch () { - fs.realpath = realpath - fs.realpathSync = realpathSync -} + const i = Math.floor(6 * h); + const v = 1 - bl; + f = 6 * h - i; -function unmonkeypatch () { - fs.realpath = origRealpath - fs.realpathSync = origRealpathSync -} + if ((i & 0x01) !== 0) { + f = 1 - f; + } + const n = wh + f * (v - wh); // Linear interpolation -/***/ }), + let r; + let g; + let b; + /* eslint-disable max-statements-per-line,no-multi-spaces */ + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } + /* eslint-enable max-statements-per-line,no-multi-spaces */ -/***/ 556: -/***/ (function(module) { + return [r * 255, g * 255, b * 255]; +}; -"use strict"; +convert.cmyk.rgb = function (cmyk) { + const c = cmyk[0] / 100; + const m = cmyk[1] / 100; + const y = cmyk[2] / 100; + const k = cmyk[3] / 100; + const r = 1 - Math.min(1, c * (1 - k) + k); + const g = 1 - Math.min(1, m * (1 - k) + k); + const b = 1 - Math.min(1, y * (1 - k) + k); -module.exports = function bind(fn, thisArg) { - return function wrap() { - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; - } - return fn.apply(thisArg, args); - }; + return [r * 255, g * 255, b * 255]; }; +convert.xyz.rgb = function (xyz) { + const x = xyz[0] / 100; + const y = xyz[1] / 100; + const z = xyz[2] / 100; + let r; + let g; + let b; + + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); -/***/ }), + // Assume sRGB + r = r > 0.0031308 + ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) + : r * 12.92; -/***/ 565: -/***/ (function(module) { + g = g > 0.0031308 + ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) + : g * 12.92; -"use strict"; + b = b > 0.0031308 + ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) + : b * 12.92; + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); -module.exports = function isCancel(value) { - return !!(value && value.__CANCEL__); + return [r * 255, g * 255, b * 255]; }; +convert.xyz.lab = function (xyz) { + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; -/***/ }), + x /= 95.047; + y /= 100; + z /= 108.883; -/***/ 569: -/***/ (function(module, __unusedexports, __webpack_require__) { + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); -var rimraf = __webpack_require__( 183 ).sync; -var fs = __webpack_require__( 747 ); + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); -module.exports = function del( file ) { - if ( fs.existsSync( file ) ) { - //if rimraf doesn't throw then the file has been deleted or didn't exist - rimraf( file, { - glob: false - } ); - return true; - } - return false; + return [l, a, b]; }; +convert.lab.xyz = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let x; + let y; + let z; + + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; -/***/ }), + const y2 = y ** 3; + const x2 = x ** 3; + const z2 = z ** 3; + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; -/***/ 605: -/***/ (function(module) { + x *= 95.047; + y *= 100; + z *= 108.883; -module.exports = require("http"); + return [x, y, z]; +}; -/***/ }), +convert.lab.lch = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let h; -/***/ 614: -/***/ (function(module) { + const hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; -"use strict"; + if (h < 0) { + h += 360; + } + const c = Math.sqrt(a * a + b * b); -/** - * Update an Error with the specified config, error code, and response. - * - * @param {Error} error The error to update. - * @param {Object} config The config. - * @param {string} [code] The error code (for example, 'ECONNABORTED'). - * @param {Object} [request] The request. - * @param {Object} [response] The response. - * @returns {Error} The error. - */ -module.exports = function enhanceError(error, config, code, request, response) { - error.config = config; - if (code) { - error.code = code; - } + return [l, c, h]; +}; - error.request = request; - error.response = response; - error.isAxiosError = true; +convert.lch.lab = function (lch) { + const l = lch[0]; + const c = lch[1]; + const h = lch[2]; - error.toJSON = function toJSON() { - return { - // Standard - message: this.message, - name: this.name, - // Microsoft - description: this.description, - number: this.number, - // Mozilla - fileName: this.fileName, - lineNumber: this.lineNumber, - columnNumber: this.columnNumber, - stack: this.stack, - // Axios - config: this.config, - code: this.code - }; - }; - return error; + const hr = h / 360 * 2 * Math.PI; + const a = c * Math.cos(hr); + const b = c * Math.sin(hr); + + return [l, a, b]; }; +convert.rgb.ansi16 = function (args, saturation = null) { + const [r, g, b] = args; + let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization -/***/ }), + value = Math.round(value / 50); -/***/ 615: -/***/ (function(module, __unusedexports, __webpack_require__) { + if (value === 0) { + return 30; + } -var path = __webpack_require__(622); -var fs = __webpack_require__(747); -var _0777 = parseInt('0777', 8); + let ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; + if (value === 2) { + ansi += 60; + } -function mkdirP (p, opts, f, made) { - if (typeof opts === 'function') { - f = opts; - opts = {}; - } - else if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 - } - if (!made) made = null; - - var cb = f || function () {}; - p = path.resolve(p); - - xfs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - if (path.dirname(p) === p) return cb(er); - mkdirP(path.dirname(p), opts, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, opts, cb, made); - }); - break; + return ansi; +}; - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); -} +convert.hsv.ansi16 = function (args) { + // Optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); +}; -mkdirP.sync = function sync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 - } - if (!made) made = null; +convert.rgb.ansi256 = function (args) { + const r = args[0]; + const g = args[1]; + const b = args[2]; - p = path.resolve(p); + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } - try { - xfs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), opts, made); - sync(p, opts, made); - break; + if (r > 248) { + return 231; + } - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = xfs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } + return Math.round(((r - 8) / 247) * 24) + 232; + } + + const ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); - return made; + return ansi; }; +convert.ansi16.rgb = function (args) { + let color = args % 10; -/***/ }), - -/***/ 618: -/***/ (function(module) { + // Handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } -"use strict"; - - -module.exports = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] -}; + color = color / 10.5 * 255; + return [color, color, color]; + } -/***/ }), + const mult = (~~(args > 50) + 1) * 0.5; + const r = ((color & 1) * mult) * 255; + const g = (((color >> 1) & 1) * mult) * 255; + const b = (((color >> 2) & 1) * mult) * 255; -/***/ 622: -/***/ (function(module) { + return [r, g, b]; +}; -module.exports = require("path"); +convert.ansi256.rgb = function (args) { + // Handle greyscale + if (args >= 232) { + const c = (args - 232) * 10 + 8; + return [c, c, c]; + } -/***/ }), + args -= 16; -/***/ 640: -/***/ (function(module, __unusedexports, __webpack_require__) { + let rem; + const r = Math.floor(args / 36) / 5 * 255; + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; + const b = (rem % 6) / 5 * 255; -"use strict"; + return [r, g, b]; +}; -const ansiStyles = __webpack_require__(991); -const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(885); -const { - stringReplaceAll, - stringEncaseCRLFWithFirstIndex -} = __webpack_require__(490); +convert.rgb.hex = function (args) { + const integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); -const {isArray} = Array; + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; -// `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = [ - 'ansi', - 'ansi', - 'ansi256', - 'ansi16m' -]; +convert.hex.rgb = function (args) { + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } -const styles = Object.create(null); + let colorString = match[0]; -const applyOptions = (object, options = {}) => { - if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { - throw new Error('The `level` option should be an integer from 0 to 3'); + if (match[0].length === 3) { + colorString = colorString.split('').map(char => { + return char + char; + }).join(''); } - // Detect level if not set manually - const colorLevel = stdoutColor ? stdoutColor.level : 0; - object.level = options.level === undefined ? colorLevel : options.level; + const integer = parseInt(colorString, 16); + const r = (integer >> 16) & 0xFF; + const g = (integer >> 8) & 0xFF; + const b = integer & 0xFF; + + return [r, g, b]; }; -class ChalkClass { - constructor(options) { - // eslint-disable-next-line no-constructor-return - return chalkFactory(options); +convert.rgb.hcg = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const max = Math.max(Math.max(r, g), b); + const min = Math.min(Math.min(r, g), b); + const chroma = (max - min); + let grayscale; + let hue; + + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } + + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma; } -} -const chalkFactory = options => { - const chalk = {}; - applyOptions(chalk, options); + hue /= 6; + hue %= 1; - chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); + return [hue * 360, chroma * 100, grayscale * 100]; +}; - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); +convert.hsl.hcg = function (hsl) { + const s = hsl[1] / 100; + const l = hsl[2] / 100; - chalk.template.constructor = () => { - throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); - }; + const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); - chalk.template.Instance = ChalkClass; + let f = 0; + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } - return chalk.template; + return [hsl[0], c * 100, f * 100]; }; -function Chalk(options) { - return chalkFactory(options); -} +convert.hsv.hcg = function (hsv) { + const s = hsv[1] / 100; + const v = hsv[2] / 100; -for (const [styleName, style] of Object.entries(ansiStyles)) { - styles[styleName] = { - get() { - const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); - Object.defineProperty(this, styleName, {value: builder}); - return builder; - } - }; -} + const c = s * v; + let f = 0; -styles.visible = { - get() { - const builder = createBuilder(this, this._styler, true); - Object.defineProperty(this, 'visible', {value: builder}); - return builder; + if (c < 1.0) { + f = (v - c) / (1 - c); } + + return [hsv[0], c * 100, f * 100]; }; -const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; +convert.hcg.rgb = function (hcg) { + const h = hcg[0] / 360; + const c = hcg[1] / 100; + const g = hcg[2] / 100; -for (const model of usedModels) { - styles[model] = { - get() { - const {level} = this; - return function (...arguments_) { - const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); - return createBuilder(this, styler, this._isEmpty); - }; - } - }; -} + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } -for (const model of usedModels) { - const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); - styles[bgModel] = { - get() { - const {level} = this; - return function (...arguments_) { - const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); - return createBuilder(this, styler, this._isEmpty); - }; - } - }; -} + const pure = [0, 0, 0]; + const hi = (h % 1) * 6; + const v = hi % 1; + const w = 1 - v; + let mg = 0; -const proto = Object.defineProperties(() => {}, { - ...styles, - level: { - enumerable: true, - get() { - return this._generator.level; - }, - set(level) { - this._generator.level = level; - } + /* eslint-disable max-statements-per-line */ + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; } -}); + /* eslint-enable max-statements-per-line */ -const createStyler = (open, close, parent) => { - let openAll; - let closeAll; - if (parent === undefined) { - openAll = open; - closeAll = close; - } else { - openAll = parent.openAll + open; - closeAll = close + parent.closeAll; - } + mg = (1.0 - c) * g; - return { - open, - close, - openAll, - closeAll, - parent - }; + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; }; -const createBuilder = (self, _styler, _isEmpty) => { - const builder = (...arguments_) => { - if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) { - // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}` - return applyStyle(builder, chalkTag(builder, ...arguments_)); - } - - // Single argument is hot path, implicit coercion is faster than anything - // eslint-disable-next-line no-implicit-coercion - return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); - }; +convert.hcg.hsv = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; - // We alter the prototype because we must return a function, but there is - // no way to create a function with a different prototype - Object.setPrototypeOf(builder, proto); + const v = c + g * (1.0 - c); + let f = 0; - builder._generator = self; - builder._styler = _styler; - builder._isEmpty = _isEmpty; + if (v > 0.0) { + f = c / v; + } - return builder; + return [hcg[0], f * 100, v * 100]; }; -const applyStyle = (self, string) => { - if (self.level <= 0 || !string) { - return self._isEmpty ? '' : string; - } +convert.hcg.hsl = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; - let styler = self._styler; + const l = g * (1.0 - c) + 0.5 * c; + let s = 0; - if (styler === undefined) { - return string; + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); } - const {openAll, closeAll} = styler; - if (string.indexOf('\u001B') !== -1) { - while (styler !== undefined) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - string = stringReplaceAll(string, styler.close, styler.open); + return [hcg[0], s * 100, l * 100]; +}; - styler = styler.parent; - } - } +convert.hcg.hwb = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; - // We can move both next actions out of loop, because remaining actions in loop won't have - // any/visible effect on parts we add here. Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 - const lfIndex = string.indexOf('\n'); - if (lfIndex !== -1) { - string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); +convert.hwb.hcg = function (hwb) { + const w = hwb[1] / 100; + const b = hwb[2] / 100; + const v = 1 - b; + const c = v - w; + let g = 0; + + if (c < 1) { + g = (v - c) / (1 - c); } - return openAll + string + closeAll; + return [hwb[0], c * 100, g * 100]; }; -let template; -const chalkTag = (chalk, ...strings) => { - const [firstString] = strings; +convert.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +}; - if (!isArray(firstString) || !isArray(firstString.raw)) { - // If chalk() was called by itself or with a string, - // return the string itself as a string. - return strings.join(' '); - } +convert.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; - const arguments_ = strings.slice(1); - const parts = [firstString.raw[0]]; +convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; - for (let i = 1; i < firstString.length; i++) { - parts.push( - String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), - String(firstString.raw[i]) - ); - } +convert.gray.hsl = function (args) { + return [0, 0, args[0]]; +}; + +convert.gray.hsv = convert.gray.hsl; + +convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; - if (template === undefined) { - template = __webpack_require__(807); - } +convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; - return template(chalk, parts.join('')); +convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; }; -Object.defineProperties(Chalk.prototype, styles); +convert.gray.hex = function (gray) { + const val = Math.round(gray[0] / 100 * 255) & 0xFF; + const integer = (val << 16) + (val << 8) + val; -const chalk = Chalk(); // eslint-disable-line new-cap -chalk.supportsColor = stdoutColor; -chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap -chalk.stderr.supportsColor = stderrColor; + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; -module.exports = chalk; +convert.rgb.gray = function (rgb) { + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; /***/ }), -/***/ 669: -/***/ (function(module) { +/***/ 6931: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = require("util"); +const conversions = __nccwpck_require__(7391); +const route = __nccwpck_require__(880); -/***/ }), +const convert = {}; -/***/ 689: -/***/ (function(module, __unusedexports, __webpack_require__) { +const models = Object.keys(conversions); -module.exports = minimatch -minimatch.Minimatch = Minimatch +function wrapRaw(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + if (arg0 === undefined || arg0 === null) { + return arg0; + } -var path = { sep: '/' } -try { - path = __webpack_require__(622) -} catch (er) {} + if (arg0.length > 1) { + args = arg0; + } -var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = __webpack_require__(416) + return fn(args); + }; -var plTypes = { - '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, - '?': { open: '(?:', close: ')?' }, - '+': { open: '(?:', close: ')+' }, - '*': { open: '(?:', close: ')*' }, - '@': { open: '(?:', close: ')' } + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; } -// any single thing other than / -// don't need to escape / when using new RegExp() -var qmark = '[^/]' +function wrapRounded(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; -// * => any number of characters -var star = qmark + '*?' + if (arg0 === undefined || arg0 === null) { + return arg0; + } -// ** when dots are allowed. Anything goes, except .. and . -// not (^ or / followed by one or two dots followed by $ or /), -// followed by anything, any number of times. -var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + if (arg0.length > 1) { + args = arg0; + } -// not a ^ or / followed by a dot, -// followed by anything, any number of times. -var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + const result = fn(args); -// characters that need to be escaped in RegExp. -var reSpecials = charSet('().*{}+?[]^$\\!') + // We're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (let len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } -// "abc" -> { a:true, b:true, c:true } -function charSet (s) { - return s.split('').reduce(function (set, c) { - set[c] = true - return set - }, {}) -} + return result; + }; -// normalizes slashes. -var slashSplit = /\/+/ + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } -minimatch.filter = filter -function filter (pattern, options) { - options = options || {} - return function (p, i, list) { - return minimatch(p, pattern, options) - } + return wrappedFn; } -function ext (a, b) { - a = a || {} - b = b || {} - var t = {} - Object.keys(b).forEach(function (k) { - t[k] = b[k] - }) - Object.keys(a).forEach(function (k) { - t[k] = a[k] - }) - return t -} +models.forEach(fromModel => { + convert[fromModel] = {}; -minimatch.defaults = function (def) { - if (!def || !Object.keys(def).length) return minimatch + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); - var orig = minimatch + const routes = route(fromModel); + const routeModels = Object.keys(routes); - var m = function minimatch (p, pattern, options) { - return orig.minimatch(p, pattern, ext(def, options)) - } + routeModels.forEach(toModel => { + const fn = routes[toModel]; - m.Minimatch = function Minimatch (pattern, options) { - return new orig.Minimatch(pattern, ext(def, options)) - } + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); +}); - return m -} +module.exports = convert; -Minimatch.defaults = function (def) { - if (!def || !Object.keys(def).length) return Minimatch - return minimatch.defaults(def).Minimatch -} -function minimatch (p, pattern, options) { - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } +/***/ }), - if (!options) options = {} +/***/ 880: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // shortcut: comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - return false - } +const conversions = __nccwpck_require__(7391); - // "" only matches "" - if (pattern.trim() === '') return p === '' +/* + This function routes a model to all other models. - return new Minimatch(pattern, options).match(p) -} + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). -function Minimatch (pattern, options) { - if (!(this instanceof Minimatch)) { - return new Minimatch(pattern, options) - } + conversions that are not possible simply are not included. +*/ - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } +function buildGraph() { + const graph = {}; + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + const models = Object.keys(conversions); - if (!options) options = {} - pattern = pattern.trim() + for (let len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } - // windows support: need to use /, not \ - if (path.sep !== '/') { - pattern = pattern.split(path.sep).join('/') - } + return graph; +} - this.options = options - this.set = [] - this.pattern = pattern - this.regexp = null - this.negate = false - this.comment = false - this.empty = false +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS(fromModel) { + const graph = buildGraph(); + const queue = [fromModel]; // Unshift -> queue -> pop - // make the set of regexps etc. - this.make() -} + graph[fromModel].distance = 0; -Minimatch.prototype.debug = function () {} + while (queue.length) { + const current = queue.pop(); + const adjacents = Object.keys(conversions[current]); -Minimatch.prototype.make = make -function make () { - // don't do it more than once. - if (this._made) return + for (let len = adjacents.length, i = 0; i < len; i++) { + const adjacent = adjacents[i]; + const node = graph[adjacent]; - var pattern = this.pattern - var options = this.options + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true - return - } - if (!pattern) { - this.empty = true - return - } + return graph; +} - // step 1: figure out negation, etc. - this.parseNegate() +function link(from, to) { + return function (args) { + return to(from(args)); + }; +} - // step 2: expand braces - var set = this.globSet = this.braceExpand() +function wrapConversion(toModel, graph) { + const path = [graph[toModel].parent, toModel]; + let fn = conversions[graph[toModel].parent][toModel]; - if (options.debug) this.debug = console.error + let cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } - this.debug(this.pattern, set) + fn.conversion = path; + return fn; +} - // step 3: now we have a set, so turn each one into a series of path-portion - // matching patterns. - // These will be regexps, except in the case of "**", which is - // set to the GLOBSTAR object for globstar behavior, - // and will not contain any / characters - set = this.globParts = set.map(function (s) { - return s.split(slashSplit) - }) +module.exports = function (fromModel) { + const graph = deriveBFS(fromModel); + const conversion = {}; - this.debug(this.pattern, set) + const models = Object.keys(graph); + for (let len = models.length, i = 0; i < len; i++) { + const toModel = models[i]; + const node = graph[toModel]; - // glob --> regexps - set = set.map(function (s, si, set) { - return s.map(this.parse, this) - }, this) + if (node.parent === null) { + // No possible conversion, or this node is the source model. + continue; + } - this.debug(this.pattern, set) + conversion[toModel] = wrapConversion(toModel, graph); + } - // filter out everything that didn't compile properly. - set = set.filter(function (s) { - return s.indexOf(false) === -1 - }) + return conversion; +}; - this.debug(this.pattern, set) - this.set = set -} -Minimatch.prototype.parseNegate = parseNegate -function parseNegate () { - var pattern = this.pattern - var negate = false - var options = this.options - var negateOffset = 0 +/***/ }), - if (options.nonegate) return +/***/ 8510: +/***/ ((module) => { - for (var i = 0, l = pattern.length - ; i < l && pattern.charAt(i) === '!' - ; i++) { - negate = !negate - negateOffset++ - } +"use strict"; + + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; - if (negateOffset) this.pattern = pattern.substr(negateOffset) - this.negate = negate -} -// Brace expansion: -// a{b,c}d -> abd acd -// a{b,}c -> abc ac -// a{0..3}d -> a0d a1d a2d a3d -// a{b,c{d,e}f}g -> abg acdfg acefg -// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg -// -// Invalid sets are not expanded. -// a{2..}b -> a{2..}b -// a{b}c -> a{b}c -minimatch.braceExpand = function (pattern, options) { - return braceExpand(pattern, options) -} +/***/ }), -Minimatch.prototype.braceExpand = braceExpand +/***/ 6891: +/***/ ((module) => { -function braceExpand (pattern, options) { - if (!options) { - if (this instanceof Minimatch) { - options = this.options - } else { - options = {} +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); } - } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; - pattern = typeof pattern === 'undefined' - ? this.pattern : pattern - if (typeof pattern === 'undefined') { - throw new TypeError('undefined pattern') - } +/***/ }), - if (options.nobrace || - !pattern.match(/\{.*\}/)) { - // shortcut. no need to expand. - return [pattern] - } +/***/ 3854: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - return expand(pattern) -} +var path = __nccwpck_require__( 5622 ); +var fs = __nccwpck_require__( 5747 ); +var utils = __nccwpck_require__( 9135 ); +var del = __nccwpck_require__( 8600 ); +var writeJSON = utils.writeJSON; -// parse a component of the expanded set. -// At this point, no pattern may contain "/" in it -// so we're going to return a 2d array, where each entry is the full -// pattern, split on '/', and then turned into a regular expression. -// A regexp is made at the end which joins each array with an -// escaped /, and another full one which joins each regexp with |. -// -// Following the lead of Bash 4.1, note that "**" only has special meaning -// when it is the *only* thing in a path portion. Otherwise, any series -// of * is equivalent to a single *. Globstar behavior is enabled by -// default, and can be disabled by setting options.noglobstar. -Minimatch.prototype.parse = parse -var SUBPARSE = {} -function parse (pattern, isSub) { - if (pattern.length > 1024 * 64) { - throw new TypeError('pattern is too long') - } +var cache = { + /** + * Load a cache identified by the given Id. If the element does not exists, then initialize an empty + * cache storage. If specified `cacheDir` will be used as the directory to persist the data to. If omitted + * then the cache module directory `./cache` will be used instead + * + * @method load + * @param docId {String} the id of the cache, would also be used as the name of the file cache + * @param [cacheDir] {String} directory for the cache entry + */ + load: function ( docId, cacheDir ) { + var me = this; - var options = this.options + me._visited = { }; + me._persisted = { }; + me._pathToFile = cacheDir ? path.resolve( cacheDir, docId ) : path.resolve( __dirname, './.cache/', docId ); - // shortcuts - if (!options.noglobstar && pattern === '**') return GLOBSTAR - if (pattern === '') return '' + if ( fs.existsSync( me._pathToFile ) ) { + me._persisted = utils.tryParse( me._pathToFile, { } ); + } + }, - var re = '' - var hasMagic = !!options.nocase - var escaping = false - // ? => one single character - var patternListStack = [] - var negativeLists = [] - var stateChar - var inClass = false - var reClassStart = -1 - var classStart = -1 - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - var patternStart = pattern.charAt(0) === '.' ? '' // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' - : '(?!\\.)' - var self = this + /** + * Load the cache from the provided file + * @method loadFile + * @param {String} pathToFile the path to the file containing the info for the cache + */ + loadFile: function ( pathToFile ) { + var me = this; + var dir = path.dirname( pathToFile ); + var fName = path.basename( pathToFile ); - function clearStateChar () { - if (stateChar) { - // we had some state-tracking character - // that wasn't consumed by this pass. - switch (stateChar) { - case '*': - re += star - hasMagic = true - break - case '?': - re += qmark - hasMagic = true - break - default: - re += '\\' + stateChar - break - } - self.debug('clearStateChar %j %j', stateChar, re) - stateChar = false - } - } + me.load( fName, dir ); + }, - for (var i = 0, len = pattern.length, c - ; (i < len) && (c = pattern.charAt(i)) - ; i++) { - this.debug('%s\t%s %s %j', pattern, i, re, c) + /** + * Returns the entire persisted object + * @method all + * @returns {*} + */ + all: function () { + return this._persisted; + }, - // skip over any that are escaped. - if (escaping && reSpecials[c]) { - re += '\\' + c - escaping = false - continue - } + keys: function () { + return Object.keys( this._persisted ); + }, + /** + * sets a key to a given value + * @method setKey + * @param key {string} the key to set + * @param value {object} the value of the key. Could be any object that can be serialized with JSON.stringify + */ + setKey: function ( key, value ) { + this._visited[ key ] = true; + this._persisted[ key ] = value; + }, + /** + * remove a given key from the cache + * @method removeKey + * @param key {String} the key to remove from the object + */ + removeKey: function ( key ) { + delete this._visited[ key ]; // esfmt-ignore-line + delete this._persisted[ key ]; // esfmt-ignore-line + }, + /** + * Return the value of the provided key + * @method getKey + * @param key {String} the name of the key to retrieve + * @returns {*} the value from the key + */ + getKey: function ( key ) { + this._visited[ key ] = true; + return this._persisted[ key ]; + }, - switch (c) { - case '/': - // completely not allowed, even escaped. - // Should already be path-split by now. - return false + /** + * Remove keys that were not accessed/set since the + * last time the `prune` method was called. + * @method _prune + * @private + */ + _prune: function () { + var me = this; + var obj = { }; - case '\\': - clearStateChar() - escaping = true - continue + var keys = Object.keys( me._visited ); - // the various stateChar values - // for the "extglob" stuff. - case '?': - case '*': - case '+': - case '@': - case '!': - this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + // no keys visited for either get or set value + if ( keys.length === 0 ) { + return; + } - // all of those are literals inside a class, except that - // the glob [!a] means [^a] in regexp - if (inClass) { - this.debug(' in class') - if (c === '!' && i === classStart + 1) c = '^' - re += c - continue - } + keys.forEach( function ( key ) { + obj[ key ] = me._persisted[ key ]; + } ); - // if we already have a stateChar, then it means - // that there was something like ** or +? in there. - // Handle the stateChar, then proceed with this one. - self.debug('call clearStateChar %j', stateChar) - clearStateChar() - stateChar = c - // if extglob is disabled, then +(asdf|foo) isn't a thing. - // just clear the statechar *now*, rather than even diving into - // the patternList stuff. - if (options.noext) clearStateChar() - continue + me._visited = { }; + me._persisted = obj; + }, - case '(': - if (inClass) { - re += '(' - continue - } + /** + * Save the state of the cache identified by the docId to disk + * as a JSON structure + * @param [noPrune=false] {Boolean} whether to remove from cache the non visited files + * @method save + */ + save: function ( noPrune ) { + var me = this; - if (!stateChar) { - re += '\\(' - continue - } + (!noPrune) && me._prune(); + writeJSON( me._pathToFile, me._persisted ); + }, - patternListStack.push({ - type: stateChar, - start: i - 1, - reStart: re.length, - open: plTypes[stateChar].open, - close: plTypes[stateChar].close - }) - // negation is (?:(?!js)[^/]*) - re += stateChar === '!' ? '(?:(?!(?:' : '(?:' - this.debug('plType %j %j', stateChar, re) - stateChar = false - continue + /** + * remove the file where the cache is persisted + * @method removeCacheFile + * @return {Boolean} true or false if the file was successfully deleted + */ + removeCacheFile: function () { + return del( this._pathToFile ); + }, + /** + * Destroy the file cache and cache content. + * @method destroy + */ + destroy: function () { + var me = this; + me._visited = { }; + me._persisted = { }; - case ')': - if (inClass || !patternListStack.length) { - re += '\\)' - continue - } + me.removeCacheFile(); + } +}; - clearStateChar() - hasMagic = true - var pl = patternListStack.pop() - // negation is (?:(?!js)[^/]*) - // The others are (?:) - re += pl.close - if (pl.type === '!') { - negativeLists.push(pl) - } - pl.reEnd = re.length - continue +module.exports = { + /** + * Alias for create. Should be considered depreacted. Will be removed in next releases + * + * @method load + * @param docId {String} the id of the cache, would also be used as the name of the file cache + * @param [cacheDir] {String} directory for the cache entry + * @returns {cache} cache instance + */ + load: function ( docId, cacheDir ) { + return this.create( docId, cacheDir ); + }, - case '|': - if (inClass || !patternListStack.length || escaping) { - re += '\\|' - escaping = false - continue - } + /** + * Load a cache identified by the given Id. If the element does not exists, then initialize an empty + * cache storage. + * + * @method create + * @param docId {String} the id of the cache, would also be used as the name of the file cache + * @param [cacheDir] {String} directory for the cache entry + * @returns {cache} cache instance + */ + create: function ( docId, cacheDir ) { + var obj = Object.create( cache ); + obj.load( docId, cacheDir ); + return obj; + }, - clearStateChar() - re += '|' - continue + createFromFile: function ( filePath ) { + var obj = Object.create( cache ); + obj.loadFile( filePath ); + return obj; + }, + /** + * Clear the cache identified by the given id. Caches stored in a different cache directory can be deleted directly + * + * @method clearCache + * @param docId {String} the id of the cache, would also be used as the name of the file cache + * @param cacheDir {String} the directory where the cache file was written + * @returns {Boolean} true if the cache folder was deleted. False otherwise + */ + clearCacheById: function ( docId, cacheDir ) { + var filePath = cacheDir ? path.resolve( cacheDir, docId ) : path.resolve( __dirname, './.cache/', docId ); + return del( filePath ); + }, + /** + * Remove all cache stored in the cache directory + * @method clearAll + * @returns {Boolean} true if the cache folder was deleted. False otherwise + */ + clearAll: function ( cacheDir ) { + var filePath = cacheDir ? path.resolve( cacheDir ) : path.resolve( __dirname, './.cache/' ); + return del( filePath ); + } +}; - // these are mostly the same in regexp and glob - case '[': - // swallow any state-tracking char before the [ - clearStateChar() - if (inClass) { - re += '\\' + c - continue - } +/***/ }), - inClass = true - classStart = i - reClassStart = re.length - re += c - continue +/***/ 8600: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - case ']': - // a right bracket shall lose its special - // meaning and represent itself in - // a bracket expression if it occurs - // first in the list. -- POSIX.2 2.8.3.2 - if (i === classStart + 1 || !inClass) { - re += '\\' + c - escaping = false - continue - } +var rimraf = __nccwpck_require__(4959).sync; +var fs = __nccwpck_require__( 5747 ); - // handle the case where we left a class open. - // "[z-a]" is valid, equivalent to "\[z-a\]" - if (inClass) { - // split where the last [ was, make sure we don't have - // an invalid re. if so, re-walk the contents of the - // would-be class to re-translate any characters that - // were passed through as-is - // TODO: It would probably be faster to determine this - // without a try/catch and a new RegExp, but it's tricky - // to do safely. For now, this is safe and works. - var cs = pattern.substring(classStart + 1, i) - try { - RegExp('[' + cs + ']') - } catch (er) { - // not a valid class! - var sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' - hasMagic = hasMagic || sp[1] - inClass = false - continue - } - } +module.exports = function del( file ) { + if ( fs.existsSync( file ) ) { + //if rimraf doesn't throw then the file has been deleted or didn't exist + rimraf( file, { + glob: false + } ); + return true; + } + return false; +}; - // finish up the class. - hasMagic = true - inClass = false - re += c - continue - default: - // swallow any state char that wasn't consumed - clearStateChar() +/***/ }), - if (escaping) { - // no need - escaping = false - } else if (reSpecials[c] - && !(c === '^' && inClass)) { - re += '\\' - } +/***/ 9135: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - re += c +var fs = __nccwpck_require__( 5747 ); +var write = __nccwpck_require__( 3531 ); +var flatted = __nccwpck_require__( 9511 ); - } // switch - } // for +module.exports = { + tryParse: function ( filePath, defaultValue ) { + var result; + try { + result = this.readJSON( filePath ); + } catch (ex) { + result = defaultValue; + } + return result; + }, - // handle the case where we left a class open. - // "[abc" is valid, equivalent to "\[abc" - if (inClass) { - // split where the last [ was, and escape it - // this is a huge pita. We now have to re-walk - // the contents of the would-be class to re-translate - // any characters that were passed through as-is - cs = pattern.substr(classStart + 1) - sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] - hasMagic = hasMagic || sp[1] + /** + * Read json file synchronously using flatted + * + * @method readJSON + * @param {String} filePath Json filepath + * @returns {*} parse result + */ + readJSON: function ( filePath ) { + return flatted.parse( fs.readFileSync( filePath, { + encoding: 'utf8' + } ) ); + }, + + /** + * Write json file synchronously using circular-json + * + * @method writeJSON + * @param {String} filePath Json filepath + * @param {*} data Object to serialize + */ + writeJSON: function ( filePath, data ) { + write.sync( filePath, flatted.stringify( data ) ); } +}; - // handle the case where we had a +( thing at the *end* - // of the pattern. - // each pattern list stack adds 3 chars, and we need to go through - // and escape any | chars that were passed through as-is for the regexp. - // Go through and escape them, taking care not to double-escape any - // | chars that were already escaped. - for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - var tail = re.slice(pl.reStart + pl.open.length) - this.debug('setting tail', re, pl) - // maybe some even number of \, then maybe 1 \, followed by a | - tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { - if (!$2) { - // the | isn't already escaped, so escape it. - $2 = '\\' - } - // need to escape all those slashes *again*, without escaping the - // one that we need for escaping the | character. As it works out, - // escaping an even number of slashes can be done by simply repeating - // it exactly after itself. That's why this trick works. - // - // I am sorry that you have to see this. - return $1 + $1 + $2 + '|' - }) +/***/ }), - this.debug('tail=%j\n %s', tail, tail, pl, re) - var t = pl.type === '*' ? star - : pl.type === '?' ? qmark - : '\\' + pl.type +/***/ 9511: +/***/ ((module) => { - hasMagic = true - re = re.slice(0, pl.reStart) + t + '\\(' + tail - } +var Flatted = (function (Primitive, primitive) { - // handle trailing things that only matter at the very end. - clearStateChar() - if (escaping) { - // trailing \\ - re += '\\\\' - } + /*! + * ISC License + * + * Copyright (c) 2018, Andrea Giammarchi, @WebReflection + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ - // only need to apply the nodot start if the re starts with - // something that could conceivably capture a dot - var addPatternStart = false - switch (re.charAt(0)) { - case '.': - case '[': - case '(': addPatternStart = true - } + var Flatted = { - // Hack to work around lack of negative lookbehind in JS - // A pattern like: *.!(x).!(y|z) needs to ensure that a name - // like 'a.xyz.yz' doesn't match. So, the first negative - // lookahead, has to look ALL the way ahead, to the end of - // the pattern. - for (var n = negativeLists.length - 1; n > -1; n--) { - var nl = negativeLists[n] + parse: function parse(text, reviver) { + var input = JSON.parse(text, Primitives).map(primitives); + var value = input[0]; + var $ = reviver || noop; + var tmp = typeof value === 'object' && value ? + revive(input, new Set, value, $) : + value; + return $.call({'': tmp}, '', tmp); + }, - var nlBefore = re.slice(0, nl.reStart) - var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) - var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) - var nlAfter = re.slice(nl.reEnd) + stringify: function stringify(value, replacer, space) { + for (var + firstRun, + known = new Map, + input = [], + output = [], + $ = replacer && typeof replacer === typeof input ? + function (k, v) { + if (k === '' || -1 < replacer.indexOf(k)) return v; + } : + (replacer || noop), + i = +set(known, input, $.call({'': value}, '', value)), + replace = function (key, value) { + if (firstRun) { + firstRun = !firstRun; + return value; + } + var after = $.call(this, key, value); + switch (typeof after) { + case 'object': + if (after === null) return after; + case primitive: + return known.get(after) || set(known, input, after); + } + return after; + }; + i < input.length; i++ + ) { + firstRun = true; + output[i] = JSON.stringify(input[i], replace, space); + } + return '[' + output.join(',') + ']'; + } - nlLast += nlAfter + }; - // Handle nested stuff like *(*.js|!(*.json)), where open parens - // mean that we should *not* include the ) in the bit that is considered - // "after" the negated section. - var openParensBefore = nlBefore.split('(').length - 1 - var cleanAfter = nlAfter - for (i = 0; i < openParensBefore; i++) { - cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') - } - nlAfter = cleanAfter + return Flatted; - var dollar = '' - if (nlAfter === '' && isSub !== SUBPARSE) { - dollar = '$' - } - var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast - re = newRe + function noop(key, value) { + return value; } - // if the re is not "" at this point, then we need to make sure - // it doesn't match against an empty path part. - // Otherwise a/* will match a/, which it should not. - if (re !== '' && hasMagic) { - re = '(?=.)' + re + function revive(input, parsed, output, $) { + return Object.keys(output).reduce( + function (output, key) { + var value = output[key]; + if (value instanceof Primitive) { + var tmp = input[value]; + if (typeof tmp === 'object' && !parsed.has(tmp)) { + parsed.add(tmp); + output[key] = $.call(output, key, revive(input, parsed, tmp, $)); + } else { + output[key] = $.call(output, key, tmp); + } + } else + output[key] = $.call(output, key, value); + return output; + }, + output + ); } - if (addPatternStart) { - re = patternStart + re + function set(known, input, value) { + var index = Primitive(input.push(value) - 1); + known.set(value, index); + return index; } - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] - } + // the two kinds of primitives + // 1. the real one + // 2. the wrapped one - // skip the regexp for non-magical patterns - // unescape anything in it, though, so that it'll be - // an exact match against a file etc. - if (!hasMagic) { - return globUnescape(pattern) + function primitives(value) { + return value instanceof Primitive ? Primitive(value) : value; } - var flags = options.nocase ? 'i' : '' - try { - var regExp = new RegExp('^' + re + '$', flags) - } catch (er) { - // If it was an invalid regular expression, then it can't match - // anything. This trick looks for a character after the end of - // the string, which is of course impossible, except in multi-line - // mode, but it's not a /m regex. - return new RegExp('$.') + function Primitives(key, value) { + return typeof value === primitive ? new Primitive(value) : value; } - regExp._glob = pattern - regExp._src = re +}(String, 'string')); +module.exports = Flatted; - return regExp -} -minimatch.makeRe = function (pattern, options) { - return new Minimatch(pattern, options || {}).makeRe() -} +/***/ }), -Minimatch.prototype.makeRe = makeRe -function makeRe () { - if (this.regexp || this.regexp === false) return this.regexp +/***/ 1133: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // at this point, this.set is a 2d array of partial - // pattern strings, or "**". - // - // It's better to use .match(). This function shouldn't - // be used, really, but it's pretty convenient sometimes, - // when you just want to work with a regex. - var set = this.set +var debug; - if (!set.length) { - this.regexp = false - return this.regexp +module.exports = function () { + if (!debug) { + try { + /* eslint global-require: off */ + debug = __nccwpck_require__(9975)("follow-redirects"); + } + catch (error) { + debug = function () { /* */ }; + } } - var options = this.options + debug.apply(null, arguments); +}; - var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - var flags = options.nocase ? 'i' : '' - var re = set.map(function (pattern) { - return pattern.map(function (p) { - return (p === GLOBSTAR) ? twoStar - : (typeof p === 'string') ? regExpEscape(p) - : p._src - }).join('\\\/') - }).join('|') +/***/ }), - // must match entire pattern - // ending in a * or ** will make it less strict. - re = '^(?:' + re + ')$' +/***/ 7707: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // can match anything, as long as it's not this. - if (this.negate) re = '^(?!' + re + ').*$' +var url = __nccwpck_require__(8835); +var URL = url.URL; +var http = __nccwpck_require__(8605); +var https = __nccwpck_require__(7211); +var Writable = __nccwpck_require__(2413).Writable; +var assert = __nccwpck_require__(2357); +var debug = __nccwpck_require__(1133); - try { - this.regexp = new RegExp(re, flags) - } catch (ex) { - this.regexp = false - } - return this.regexp -} +// Create handlers that pass events from native requests +var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; +var eventHandlers = Object.create(null); +events.forEach(function (event) { + eventHandlers[event] = function (arg1, arg2, arg3) { + this._redirectable.emit(event, arg1, arg2, arg3); + }; +}); -minimatch.match = function (list, pattern, options) { - options = options || {} - var mm = new Minimatch(pattern, options) - list = list.filter(function (f) { - return mm.match(f) - }) - if (mm.options.nonull && !list.length) { - list.push(pattern) - } - return list -} +// Error types with codes +var RedirectionError = createErrorType( + "ERR_FR_REDIRECTION_FAILURE", + "" +); +var TooManyRedirectsError = createErrorType( + "ERR_FR_TOO_MANY_REDIRECTS", + "Maximum number of redirects exceeded" +); +var MaxBodyLengthExceededError = createErrorType( + "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", + "Request body larger than maxBodyLength limit" +); +var WriteAfterEndError = createErrorType( + "ERR_STREAM_WRITE_AFTER_END", + "write after end" +); -Minimatch.prototype.match = match -function match (f, partial) { - this.debug('match', f, this.pattern) - // short-circuit in the case of busted things. - // comments, etc. - if (this.comment) return false - if (this.empty) return f === '' +// An HTTP(S) request that can be redirected +function RedirectableRequest(options, responseCallback) { + // Initialize the request + Writable.call(this); + this._sanitizeOptions(options); + this._options = options; + this._ended = false; + this._ending = false; + this._redirectCount = 0; + this._redirects = []; + this._requestBodyLength = 0; + this._requestBodyBuffers = []; - if (f === '/' && partial) return true + // Attach a callback if passed + if (responseCallback) { + this.on("response", responseCallback); + } - var options = this.options + // React to responses of native requests + var self = this; + this._onNativeResponse = function (response) { + self._processResponse(response); + }; - // windows: need to use /, not \ - if (path.sep !== '/') { - f = f.split(path.sep).join('/') - } + // Perform the first request + this._performRequest(); +} +RedirectableRequest.prototype = Object.create(Writable.prototype); - // treat the test path as a set of pathparts. - f = f.split(slashSplit) - this.debug(this.pattern, 'split', f) +RedirectableRequest.prototype.abort = function () { + // Abort the internal request + abortRequest(this._currentRequest); - // just ONE of the pattern sets in this.set needs to match - // in order for it to be valid. If negating, then just one - // match means that we have failed. - // Either way, return on the first hit. + // Abort this request + this.emit("abort"); + this.removeAllListeners(); +}; - var set = this.set - this.debug(this.pattern, 'set', set) +// Writes buffered data to the current native request +RedirectableRequest.prototype.write = function (data, encoding, callback) { + // Writing is not allowed if end has been called + if (this._ending) { + throw new WriteAfterEndError(); + } - // Find the basename of the path by looking for the last non-empty segment - var filename - var i - for (i = f.length - 1; i >= 0; i--) { - filename = f[i] - if (filename) break + // Validate input and shift parameters if necessary + if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) { + throw new TypeError("data should be a string, Buffer or Uint8Array"); + } + if (typeof encoding === "function") { + callback = encoding; + encoding = null; } - for (i = 0; i < set.length; i++) { - var pattern = set[i] - var file = f - if (options.matchBase && pattern.length === 1) { - file = [filename] - } - var hit = this.matchOne(file, pattern, partial) - if (hit) { - if (options.flipNegate) return true - return !this.negate + // Ignore empty buffers, since writing them doesn't invoke the callback + // https://github.com/nodejs/node/issues/22066 + if (data.length === 0) { + if (callback) { + callback(); } + return; + } + // Only write when we don't exceed the maximum body length + if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { + this._requestBodyLength += data.length; + this._requestBodyBuffers.push({ data: data, encoding: encoding }); + this._currentRequest.write(data, encoding, callback); + } + // Error when we exceed the maximum body length + else { + this.emit("error", new MaxBodyLengthExceededError()); + this.abort(); } +}; - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate -} +// Ends the current native request +RedirectableRequest.prototype.end = function (data, encoding, callback) { + // Shift parameters if necessary + if (typeof data === "function") { + callback = data; + data = encoding = null; + } + else if (typeof encoding === "function") { + callback = encoding; + encoding = null; + } -// set partial to true to test if, for example, -// "/a/b" matches the start of "/*/b/*/d" -// Partial means, if you run out of file before you run -// out of pattern, then that's fine, as long as all -// the parts match. -Minimatch.prototype.matchOne = function (file, pattern, partial) { - var options = this.options + // Write data if needed and end + if (!data) { + this._ended = this._ending = true; + this._currentRequest.end(null, null, callback); + } + else { + var self = this; + var currentRequest = this._currentRequest; + this.write(data, encoding, function () { + self._ended = true; + currentRequest.end(null, null, callback); + }); + this._ending = true; + } +}; - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }) +// Sets a header value on the current native request +RedirectableRequest.prototype.setHeader = function (name, value) { + this._options.headers[name] = value; + this._currentRequest.setHeader(name, value); +}; - this.debug('matchOne', file.length, pattern.length) +// Clears a header value on the current native request +RedirectableRequest.prototype.removeHeader = function (name) { + delete this._options.headers[name]; + this._currentRequest.removeHeader(name); +}; - for (var fi = 0, - pi = 0, - fl = file.length, - pl = pattern.length - ; (fi < fl) && (pi < pl) - ; fi++, pi++) { - this.debug('matchOne loop') - var p = pattern[pi] - var f = file[fi] +// Global timeout for all underlying requests +RedirectableRequest.prototype.setTimeout = function (msecs, callback) { + var self = this; + if (callback) { + this.on("timeout", callback); + } - this.debug(pattern, p, f) + function destroyOnTimeout(socket) { + socket.setTimeout(msecs); + socket.removeListener("timeout", socket.destroy); + socket.addListener("timeout", socket.destroy); + } - // should be impossible. - // some invalid regexp stuff in the set. - if (p === false) return false + // Sets up a timer to trigger a timeout event + function startTimer(socket) { + if (self._timeout) { + clearTimeout(self._timeout); + } + self._timeout = setTimeout(function () { + self.emit("timeout"); + clearTimer(); + }, msecs); + destroyOnTimeout(socket); + } - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]) + // Prevent a timeout from triggering + function clearTimer() { + clearTimeout(this._timeout); + if (callback) { + self.removeListener("timeout", callback); + } + if (!this.socket) { + self._currentRequest.removeListener("socket", startTimer); + } + } - // "**" - // a/**/b/**/c would match the following: - // a/b/x/y/z/c - // a/x/y/z/b/c - // a/b/x/b/x/c - // a/b/c - // To do this, take the rest of the pattern after - // the **, and see if it would match the file remainder. - // If so, return success. - // If not, the ** "swallows" a segment, and try again. - // This is recursively awful. - // - // a/**/b/**/c matching a/b/x/y/z/c - // - a matches a - // - doublestar - // - matchOne(b/x/y/z/c, b/**/c) - // - b matches b - // - doublestar - // - matchOne(x/y/z/c, c) -> no - // - matchOne(y/z/c, c) -> no - // - matchOne(z/c, c) -> no - // - matchOne(c, c) yes, hit - var fr = fi - var pr = pi + 1 - if (pr === pl) { - this.debug('** at the end') - // a ** at the end will just swallow the rest. - // We have found a match. - // however, it will not swallow /.x, unless - // options.dot is set. - // . and .. are *never* matched by **, for explosively - // exponential reasons. - for (; fi < fl; fi++) { - if (file[fi] === '.' || file[fi] === '..' || - (!options.dot && file[fi].charAt(0) === '.')) return false - } - return true - } + // Start the timer when the socket is opened + if (this.socket) { + startTimer(this.socket); + } + else { + this._currentRequest.once("socket", startTimer); + } - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr] + this.on("socket", destroyOnTimeout); + this.once("response", clearTimer); + this.once("error", clearTimer); - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + return this; +}; - // XXX remove this slice. Just pass the start index. - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug('globstar found match!', fr, fl, swallowee) - // found a match. - return true - } else { - // can't swallow "." or ".." ever. - // can only swallow ".foo" when explicitly asked. - if (swallowee === '.' || swallowee === '..' || - (!options.dot && swallowee.charAt(0) === '.')) { - this.debug('dot detected!', file, fr, pattern, pr) - break - } +// Proxy all other public ClientRequest methods +[ + "flushHeaders", "getHeader", + "setNoDelay", "setSocketKeepAlive", +].forEach(function (method) { + RedirectableRequest.prototype[method] = function (a, b) { + return this._currentRequest[method](a, b); + }; +}); + +// Proxy all public ClientRequest properties +["aborted", "connection", "socket"].forEach(function (property) { + Object.defineProperty(RedirectableRequest.prototype, property, { + get: function () { return this._currentRequest[property]; }, + }); +}); - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue') - fr++ - } - } +RedirectableRequest.prototype._sanitizeOptions = function (options) { + // Ensure headers are always present + if (!options.headers) { + options.headers = {}; + } - // no match was found. - // However, in partial mode, we can't say this is necessarily over. - // If there's more *pattern* left, then - if (partial) { - // ran out of file - this.debug('\n>>> no match, partial?', file, fr, pattern, pr) - if (fr === fl) return true - } - return false + // Since http.request treats host as an alias of hostname, + // but the url module interprets host as hostname plus port, + // eliminate the host property to avoid confusion. + if (options.host) { + // Use hostname if set, because it has precedence + if (!options.hostname) { + options.hostname = options.host; } + delete options.host; + } - // something other than ** - // non-magic patterns just have to match exactly - // patterns with magic have been turned into regexps. - var hit - if (typeof p === 'string') { - if (options.nocase) { - hit = f.toLowerCase() === p.toLowerCase() - } else { - hit = f === p - } - this.debug('string match', p, f, hit) - } else { - hit = f.match(p) - this.debug('pattern match', p, f, hit) + // Complete the URL object when necessary + if (!options.pathname && options.path) { + var searchPos = options.path.indexOf("?"); + if (searchPos < 0) { + options.pathname = options.path; + } + else { + options.pathname = options.path.substring(0, searchPos); + options.search = options.path.substring(searchPos); } - - if (!hit) return false } +}; - // Note: ending in / means that we'll get a final "" - // at the end of the pattern. This can only match a - // corresponding "" at the end of the file. - // If the file ends in /, then it can only match a - // a pattern that ends in /, unless the pattern just - // doesn't have any more for it. But, a/b/ should *not* - // match "a/b/*", even though "" matches against the - // [^/]*? pattern, except in partial mode, where it might - // simply not be reached yet. - // However, a/b/ should still satisfy a/* - // now either we fell off the end of the pattern, or we're done. - if (fi === fl && pi === pl) { - // ran out of pattern and filename at the same time. - // an exact hit! - return true - } else if (fi === fl) { - // ran out of file, but still had pattern left. - // this is ok if we're doing the match as part of - // a glob fs traversal. - return partial - } else if (pi === pl) { - // ran out of pattern, still have file left. - // this is only acceptable if we're on the very last - // empty segment of a file with a trailing slash. - // a/* should match a/b/ - var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') - return emptyFileEnd +// Executes the next native request (initial or redirect) +RedirectableRequest.prototype._performRequest = function () { + // Load the native protocol + var protocol = this._options.protocol; + var nativeProtocol = this._options.nativeProtocols[protocol]; + if (!nativeProtocol) { + this.emit("error", new TypeError("Unsupported protocol " + protocol)); + return; } - // should be unreachable. - throw new Error('wtf?') -} + // If specified, use the agent corresponding to the protocol + // (HTTP and HTTPS use different types of agents) + if (this._options.agents) { + var scheme = protocol.substr(0, protocol.length - 1); + this._options.agent = this._options.agents[scheme]; + } -// replace stuff like \* with * -function globUnescape (s) { - return s.replace(/\\(.)/g, '$1') -} + // Create the native request + var request = this._currentRequest = + nativeProtocol.request(this._options, this._onNativeResponse); + this._currentUrl = url.format(this._options); -function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') -} + // Set up event handlers + request._redirectable = this; + for (var e = 0; e < events.length; e++) { + request.on(events[e], eventHandlers[events[e]]); + } + + // End a redirected request + // (The first request must be ended explicitly with RedirectableRequest#end) + if (this._isRedirect) { + // Write the request entity and end. + var i = 0; + var self = this; + var buffers = this._requestBodyBuffers; + (function writeNext(error) { + // Only write if this request has not been redirected yet + /* istanbul ignore else */ + if (request === self._currentRequest) { + // Report any write errors + /* istanbul ignore if */ + if (error) { + self.emit("error", error); + } + // Write the next buffer if there are still left + else if (i < buffers.length) { + var buffer = buffers[i++]; + /* istanbul ignore else */ + if (!request.finished) { + request.write(buffer.data, buffer.encoding, writeNext); + } + } + // End the request if `end` has been called on us + else if (self._ended) { + request.end(); + } + } + }()); + } +}; +// Processes a response from the current native request +RedirectableRequest.prototype._processResponse = function (response) { + // Store the redirected response + var statusCode = response.statusCode; + if (this._options.trackRedirects) { + this._redirects.push({ + url: this._currentUrl, + headers: response.headers, + statusCode: statusCode, + }); + } -/***/ }), + // RFC7231§6.4: The 3xx (Redirection) class of status code indicates + // that further action needs to be taken by the user agent in order to + // fulfill the request. If a Location header field is provided, + // the user agent MAY automatically redirect its request to the URI + // referenced by the Location field value, + // even if the specific status code is not understood. + var location = response.headers.location; + if (location && this._options.followRedirects !== false && + statusCode >= 300 && statusCode < 400) { + // Abort the current request + abortRequest(this._currentRequest); + // Discard the remainder of the response to avoid waiting for data + response.destroy(); -/***/ 696: -/***/ (function(module, __unusedexports, __webpack_require__) { + // RFC7231§6.4: A client SHOULD detect and intervene + // in cyclical redirections (i.e., "infinite" redirection loops). + if (++this._redirectCount > this._options.maxRedirects) { + this.emit("error", new TooManyRedirectsError()); + return; + } -// Approach: -// -// 1. Get the minimatch set -// 2. For each pattern in the set, PROCESS(pattern, false) -// 3. Store matches per-set, then uniq them -// -// PROCESS(pattern, inGlobStar) -// Get the first [n] items from pattern that are all strings -// Join these together. This is PREFIX. -// If there is no more remaining, then stat(PREFIX) and -// add to matches if it succeeds. END. -// -// If inGlobStar and PREFIX is symlink and points to dir -// set ENTRIES = [] -// else readdir(PREFIX) as ENTRIES -// If fail, END -// -// with ENTRIES -// If pattern[n] is GLOBSTAR -// // handle the case where the globstar match is empty -// // by pruning it out, and testing the resulting pattern -// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) -// // handle other cases. -// for ENTRY in ENTRIES (not dotfiles) -// // attach globstar + tail onto the entry -// // Mark that this entry is a globstar match -// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) -// -// else // not globstar -// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) -// Test ENTRY against pattern[n] -// If fails, continue -// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) -// -// Caveat: -// Cache all stats and readdirs results to minimize syscall. Since all -// we ever care about is existence and directory-ness, we can just keep -// `true` for files, and [children,...] for directories, or `false` for -// things that don't exist. + // RFC7231§6.4: Automatic redirection needs to done with + // care for methods not known to be safe, […] + // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change + // the request method from POST to GET for the subsequent request. + if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || + // RFC7231§6.4.4: The 303 (See Other) status code indicates that + // the server is redirecting the user agent to a different resource […] + // A user agent can perform a retrieval request targeting that URI + // (a GET or HEAD request if using HTTP) […] + (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { + this._options.method = "GET"; + // Drop a possible entity and headers related to it + this._requestBodyBuffers = []; + removeMatchingHeaders(/^content-/i, this._options.headers); + } -module.exports = glob + // Drop the Host header, as the redirect might lead to a different host + var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) || + url.parse(this._currentUrl).hostname; -var fs = __webpack_require__(747) -var rp = __webpack_require__(544) -var minimatch = __webpack_require__(689) -var Minimatch = minimatch.Minimatch -var inherits = __webpack_require__(276) -var EE = __webpack_require__(759).EventEmitter -var path = __webpack_require__(622) -var assert = __webpack_require__(357) -var isAbsolute = __webpack_require__(829) -var globSync = __webpack_require__(133) -var common = __webpack_require__(18) -var alphasort = common.alphasort -var alphasorti = common.alphasorti -var setopts = common.setopts -var ownProp = common.ownProp -var inflight = __webpack_require__(421) -var util = __webpack_require__(669) -var childrenIgnored = common.childrenIgnored -var isIgnored = common.isIgnored + // Create the redirected request + var redirectUrl = url.resolve(this._currentUrl, location); + debug("redirecting to", redirectUrl); + this._isRedirect = true; + var redirectUrlParts = url.parse(redirectUrl); + Object.assign(this._options, redirectUrlParts); -var once = __webpack_require__(870) + // Drop the Authorization header if redirecting to another host + if (redirectUrlParts.hostname !== previousHostName) { + removeMatchingHeaders(/^authorization$/i, this._options.headers); + } -function glob (pattern, options, cb) { - if (typeof options === 'function') cb = options, options = {} - if (!options) options = {} + // Evaluate the beforeRedirect callback + if (typeof this._options.beforeRedirect === "function") { + var responseDetails = { headers: response.headers }; + try { + this._options.beforeRedirect.call(null, this._options, responseDetails); + } + catch (err) { + this.emit("error", err); + return; + } + this._sanitizeOptions(this._options); + } - if (options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return globSync(pattern, options) + // Perform the redirected request + try { + this._performRequest(); + } + catch (cause) { + var error = new RedirectionError("Redirected request failed: " + cause.message); + error.cause = cause; + this.emit("error", error); + } } + else { + // The response is not a redirect; return it as-is + response.responseUrl = this._currentUrl; + response.redirects = this._redirects; + this.emit("response", response); - return new Glob(pattern, options, cb) -} + // Clean up + this._requestBodyBuffers = []; + } +}; -glob.sync = globSync -var GlobSync = glob.GlobSync = globSync.GlobSync +// Wraps the key/value object of protocols with redirect functionality +function wrap(protocols) { + // Default settings + var exports = { + maxRedirects: 21, + maxBodyLength: 10 * 1024 * 1024, + }; -// old api surface -glob.glob = glob + // Wrap each protocol + var nativeProtocols = {}; + Object.keys(protocols).forEach(function (scheme) { + var protocol = scheme + ":"; + var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; + var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); -function extend (origin, add) { - if (add === null || typeof add !== 'object') { - return origin - } + // Executes a request, following redirects + function request(input, options, callback) { + // Parse parameters + if (typeof input === "string") { + var urlStr = input; + try { + input = urlToOptions(new URL(urlStr)); + } + catch (err) { + /* istanbul ignore next */ + input = url.parse(urlStr); + } + } + else if (URL && (input instanceof URL)) { + input = urlToOptions(input); + } + else { + callback = options; + options = input; + input = { protocol: protocol }; + } + if (typeof options === "function") { + callback = options; + options = null; + } - var keys = Object.keys(add) - var i = keys.length - while (i--) { - origin[keys[i]] = add[keys[i]] - } - return origin -} + // Set defaults + options = Object.assign({ + maxRedirects: exports.maxRedirects, + maxBodyLength: exports.maxBodyLength, + }, input, options); + options.nativeProtocols = nativeProtocols; -glob.hasMagic = function (pattern, options_) { - var options = extend({}, options_) - options.noprocess = true + assert.equal(options.protocol, protocol, "protocol mismatch"); + debug("options", options); + return new RedirectableRequest(options, callback); + } - var g = new Glob(pattern, options) - var set = g.minimatch.set + // Executes a GET request, following redirects + function get(input, options, callback) { + var wrappedRequest = wrappedProtocol.request(input, options, callback); + wrappedRequest.end(); + return wrappedRequest; + } - if (!pattern) - return false + // Expose the properties on the wrapped protocol + Object.defineProperties(wrappedProtocol, { + request: { value: request, configurable: true, enumerable: true, writable: true }, + get: { value: get, configurable: true, enumerable: true, writable: true }, + }); + }); + return exports; +} - if (set.length > 1) - return true +/* istanbul ignore next */ +function noop() { /* empty */ } - for (var j = 0; j < set[0].length; j++) { - if (typeof set[0][j] !== 'string') - return true +// from https://github.com/nodejs/node/blob/master/lib/internal/url.js +function urlToOptions(urlObject) { + var options = { + protocol: urlObject.protocol, + hostname: urlObject.hostname.startsWith("[") ? + /* istanbul ignore next */ + urlObject.hostname.slice(1, -1) : + urlObject.hostname, + hash: urlObject.hash, + search: urlObject.search, + pathname: urlObject.pathname, + path: urlObject.pathname + urlObject.search, + href: urlObject.href, + }; + if (urlObject.port !== "") { + options.port = Number(urlObject.port); } + return options; +} - return false +function removeMatchingHeaders(regex, headers) { + var lastValue; + for (var header in headers) { + if (regex.test(header)) { + lastValue = headers[header]; + delete headers[header]; + } + } + return lastValue; } -glob.Glob = Glob -inherits(Glob, EE) -function Glob (pattern, options, cb) { - if (typeof options === 'function') { - cb = options - options = null +function createErrorType(code, defaultMessage) { + function CustomError(message) { + Error.captureStackTrace(this, this.constructor); + this.message = message || defaultMessage; } + CustomError.prototype = new Error(); + CustomError.prototype.constructor = CustomError; + CustomError.prototype.name = "Error [" + code + "]"; + CustomError.prototype.code = code; + return CustomError; +} - if (options && options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return new GlobSync(pattern, options) +function abortRequest(request) { + for (var e = 0; e < events.length; e++) { + request.removeListener(events[e], eventHandlers[events[e]]); } + request.on("error", noop); + request.abort(); +} - if (!(this instanceof Glob)) - return new Glob(pattern, options, cb) +// Exports +module.exports = wrap({ http: http, https: https }); +module.exports.wrap = wrap; - setopts(this, pattern, options) - this._didRealPath = false - // process each pattern in the minimatch set - var n = this.minimatch.set.length +/***/ }), - // The matches are stored as {: true,...} so that - // duplicates are automagically pruned. - // Later, we do an Object.keys() on these. - // Keep them as a list so we can fill in when nonull is set. - this.matches = new Array(n) +/***/ 6863: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (typeof cb === 'function') { - cb = once(cb) - this.on('error', cb) - this.on('end', function (matches) { - cb(null, matches) - }) - } +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch - var self = this - this._processing = 0 +var fs = __nccwpck_require__(5747) +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync - this._emitQueue = [] - this._processQueue = [] - this.paused = false +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = __nccwpck_require__(1734) - if (this.noprocess) - return this +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} - if (n === 0) - return done() +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } - var sync = true - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false, done) + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) + } + }) +} + +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) } - sync = false - function done () { - --self._processing - if (self._processing <= 0) { - if (sync) { - process.nextTick(function () { - self._finish() - }) - } else { - self._finish() - } + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er } } } -Glob.prototype._finish = function () { - assert(this instanceof Glob) - if (this.aborted) - return - - if (this.realpath && !this._didRealpath) - return this._realpath() +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync +} - common.finish(this) - this.emit('end', this.found) +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync } -Glob.prototype._realpath = function () { - if (this._didRealpath) - return - this._didRealpath = true +/***/ }), - var n = this.matches.length - if (n === 0) - return this._finish() +/***/ 1734: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - var self = this - for (var i = 0; i < this.matches.length; i++) - this._realpathSet(i, next) +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - function next () { - if (--n === 0) - self._finish() - } -} +var pathModule = __nccwpck_require__(5622); +var isWindows = process.platform === 'win32'; +var fs = __nccwpck_require__(5747); -Glob.prototype._realpathSet = function (index, cb) { - var matchset = this.matches[index] - if (!matchset) - return cb() +// JavaScript implementation of realpath, ported from node pre-v6 - var found = Object.keys(matchset) - var self = this - var n = found.length +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); - if (n === 0) - return cb() +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; - var set = this.matches[index] = Object.create(null) - found.forEach(function (p, i) { - // If there's a problem with the stat, then it means that - // one or more of the links in the realpath couldn't be - // resolved. just return the abs value in that case. - p = self._makeAbs(p) - rp.realpath(p, self.realpathCache, function (er, real) { - if (!er) - set[real] = true - else if (er.syscall === 'stat') - set[p] = true - else - self.emit('error', er) // srsly wtf right here + return callback; - if (--n === 0) { - self.matches[index] = set - cb() + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } + + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); } - }) - }) + } + } } -Glob.prototype._mark = function (p) { - return common.mark(this, p) +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); } -Glob.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) +var normalize = pathModule.normalize; + +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; } -Glob.prototype.abort = function () { - this.aborted = true - this.emit('abort') +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; } -Glob.prototype.pause = function () { - if (!this.paused) { - this.paused = true - this.emit('pause') +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; } -} -Glob.prototype.resume = function () { - if (this.paused) { - this.emit('resume') - this.paused = false - if (this._emitQueue.length) { - var eq = this._emitQueue.slice(0) - this._emitQueue.length = 0 - for (var i = 0; i < eq.length; i ++) { - var e = eq[i] - this._emitMatch(e[0], e[1]) - } - } - if (this._processQueue.length) { - var pq = this._processQueue.slice(0) - this._processQueue.length = 0 - for (var i = 0; i < pq.length; i ++) { - var p = pq[i] - this._processing-- - this._process(p[0], p[1], p[2], p[3]) - } + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; } } -} -Glob.prototype._process = function (pattern, index, inGlobStar, cb) { - assert(this instanceof Glob) - assert(typeof cb === 'function') + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; - if (this.aborted) - return + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; + } + + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } + + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } - this._processing++ - if (this.paused) { - this._processQueue.push([pattern, index, inGlobStar, cb]) - return + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); } - //console.error('PROCESS %d', this._processing, pattern) - - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. + if (cache) cache[original] = p; - // see if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index, cb) - return + return p; +}; - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; } - var remain = pattern.slice(n) + // make p is absolute + p = pathModule.resolve(p); - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } - var abs = this._makeAbs(read) + var original = p, + seenLinks = {}, + knownHard = {}; - //if ignored, skip _processing - if (childrenIgnored(this, read)) - return cb() + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) -} + start(); -Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; -Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } + } - // if the abs isn't a dir, then nothing can match! - if (!entries) - return cb() + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); + } - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); } - } - //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) - - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return cb() + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. + return fs.lstat(base, gotStat); + } - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) + function gotStat(err, stat) { + if (err) return cb(err); - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); + } - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); } - this._emitMatch(index, e) } - // This was the last one, and no stats were needed - return cb() - } + fs.stat(base, function(err) { + if (err) return cb(err); - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - this._process([e].concat(remain), index, inGlobStar, cb) + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); } - cb() -} - -Glob.prototype._emitMatch = function (index, e) { - if (this.aborted) - return - if (isIgnored(this, e)) - return + function gotTarget(err, target, base) { + if (err) return cb(err); - if (this.paused) { - this._emitQueue.push([index, e]) - return + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); } - var abs = isAbsolute(e) ? e : this._makeAbs(e) + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } +}; - if (this.mark) - e = this._mark(e) - if (this.absolute) - e = abs +/***/ }), - if (this.matches[index][e]) - return +/***/ 7625: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return - } +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored - this.matches[index][e] = true +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} - var st = this.statCache[abs] - if (st) - this.emit('stat', e, st) +var path = __nccwpck_require__(5622) +var minimatch = __nccwpck_require__(3973) +var isAbsolute = __nccwpck_require__(8714) +var Minimatch = minimatch.Minimatch - this.emit('match', e) +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) } -Glob.prototype._readdirInGlobStar = function (abs, cb) { - if (this.aborted) - return - - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false, cb) +function alphasort (a, b) { + return a.localeCompare(b) +} - var lstatkey = 'lstat\0' + abs - var self = this - var lstatcb = inflight(lstatkey, lstatcb_) +function setupIgnores (self, options) { + self.ignore = options.ignore || [] - if (lstatcb) - fs.lstat(abs, lstatcb) + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] - function lstatcb_ (er, lstat) { - if (er && er.code === 'ENOENT') - return cb() + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} - var isSym = lstat && lstat.isSymbolicLink() - self.symlinks[abs] = isSym +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) { - self.cache[abs] = 'FILE' - cb() - } else - self._readdir(abs, false, cb) + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher } } -Glob.prototype._readdir = function (abs, inGlobStar, cb) { - if (this.aborted) - return +function setopts (self, pattern, options) { + if (!options) + options = {} - cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) - if (!cb) - return + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } - //console.error('RD %j %j', +inGlobStar, abs) - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs, cb) + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return cb() + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) - if (Array.isArray(c)) - return cb(null, c) + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd } - var self = this - fs.readdir(abs, readdirCb(this, abs, cb)) -} + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") -function readdirCb (self, abs, cb) { - return function (er, entries) { - if (er) - self._readdirError(abs, er, cb) - else - self._readdirEntries(abs, entries, cb) - } + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + if (process.platform === "win32") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + self.nomount = !!options.nomount + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options } -Glob.prototype._readdirEntries = function (abs, entries, cb) { - if (this.aborted) - return +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) else - e = abs + '/' + e - this.cache[e] = true + m.forEach(function (m) { + all[m] = true + }) } } - this.cache[abs] = entries - return cb(null, entries) -} + if (!nou) + all = Object.keys(all) -Glob.prototype._readdirError = function (f, er, cb) { - if (this.aborted) - return + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - this.emit('error', error) - this.abort() - } - break + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } + } - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) { - this.emit('error', er) - // If the error is handled, then we abort - // if not, we threw out of here - this.abort() - } - if (!this.silent) - console.error('glob error', er) - break + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } } - return cb() + return m } -Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') -Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - //console.error('pgs2', prefix, remain[0], entries) + return abs +} - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return cb() - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false, cb) + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} - var isSym = this.symlinks[abs] - var len = entries.length +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return cb() + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true, cb) +/***/ }), - var below = gspref.concat(entries[i], remain) - this._process(below, index, true, cb) - } +/***/ 1957: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - cb() -} +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. -Glob.prototype._processSimple = function (prefix, index, cb) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var self = this - this._stat(prefix, function (er, exists) { - self._processSimple2(prefix, index, er, exists, cb) - }) -} -Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { +module.exports = glob - //console.error('ps2', prefix, exists) +var fs = __nccwpck_require__(5747) +var rp = __nccwpck_require__(6863) +var minimatch = __nccwpck_require__(3973) +var Minimatch = minimatch.Minimatch +var inherits = __nccwpck_require__(4124) +var EE = __nccwpck_require__(8614).EventEmitter +var path = __nccwpck_require__(5622) +var assert = __nccwpck_require__(2357) +var isAbsolute = __nccwpck_require__(8714) +var globSync = __nccwpck_require__(9010) +var common = __nccwpck_require__(7625) +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = __nccwpck_require__(2492) +var util = __nccwpck_require__(1669) +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored - if (!this.matches[index]) - this.matches[index] = Object.create(null) +var once = __nccwpck_require__(1223) - // If it doesn't exist, then just mark the lack of results - if (!exists) - return cb() +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' - } + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) } - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') - - // Mark this as a match - this._emitMatch(index, prefix) - cb() + return new Glob(pattern, options, cb) } -// Returns either 'DIR', 'FILE', or false -Glob.prototype._stat = function (f, cb) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' - - if (f.length > this.maxLength) - return cb() +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] +// old api surface +glob.glob = glob - if (Array.isArray(c)) - c = 'DIR' +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return cb(null, c) + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} - if (needDir && c === 'FILE') - return cb() +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. - } + var g = new Glob(pattern, options) + var set = g.minimatch.set - var exists - var stat = this.statCache[abs] - if (stat !== undefined) { - if (stat === false) - return cb(null, stat) - else { - var type = stat.isDirectory() ? 'DIR' : 'FILE' - if (needDir && type === 'FILE') - return cb() - else - return cb(null, type, stat) - } - } + if (!pattern) + return false - var self = this - var statcb = inflight('stat\0' + abs, lstatcb_) - if (statcb) - fs.lstat(abs, statcb) + if (set.length > 1) + return true - function lstatcb_ (er, lstat) { - if (lstat && lstat.isSymbolicLink()) { - // If it's a symlink, then treat it as the target, unless - // the target does not exist, then treat it as a file. - return fs.stat(abs, function (er, stat) { - if (er) - self._stat2(f, abs, null, lstat, cb) - else - self._stat2(f, abs, er, stat, cb) - }) - } else { - self._stat2(f, abs, er, lstat, cb) - } + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true } + + return false } -Glob.prototype._stat2 = function (f, abs, er, stat, cb) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return cb() +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null } - var needDir = f.slice(-1) === '/' - this.statCache[abs] = stat - - if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) - return cb(null, false, stat) + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - this.cache[abs] = this.cache[abs] || c + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) - if (needDir && c === 'FILE') - return cb() + setopts(this, pattern, options) + this._didRealPath = false - return cb(null, c, stat) -} + // process each pattern in the minimatch set + var n = this.minimatch.set.length + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) -/***/ }), + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } -/***/ 700: -/***/ (function(module, __unusedexports, __webpack_require__) { + var self = this + this._processing = 0 -"use strict"; + this._emitQueue = [] + this._processQueue = [] + this.paused = false + if (this.noprocess) + return this -var utils = __webpack_require__(397); + if (n === 0) + return done() -/** - * Transform the data for a request or a response - * - * @param {Object|String} data The data to be transformed - * @param {Array} headers The headers for the request or response - * @param {Array|Function} fns A single function or Array of functions - * @returns {*} The resulting transformed data - */ -module.exports = function transformData(data, headers, fns) { - /*eslint no-param-reassign:0*/ - utils.forEach(fns, function transform(fn) { - data = fn(data, headers); - }); + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + sync = false - return data; -}; + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } + } +} +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return -/***/ }), + if (this.realpath && !this._didRealpath) + return this._realpath() -/***/ 701: -/***/ (function(module, __unusedexports, __webpack_require__) { + common.finish(this) + this.emit('end', this.found) +} -"use strict"; +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + this._didRealpath = true -var utils = __webpack_require__(397); -var settle = __webpack_require__(298); -var cookies = __webpack_require__(928); -var buildURL = __webpack_require__(946); -var buildFullPath = __webpack_require__(757); -var parseHeaders = __webpack_require__(908); -var isURLSameOrigin = __webpack_require__(240); -var createError = __webpack_require__(462); + var n = this.matches.length + if (n === 0) + return this._finish() -module.exports = function xhrAdapter(config) { - return new Promise(function dispatchXhrRequest(resolve, reject) { - var requestData = config.data; - var requestHeaders = config.headers; + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) - if (utils.isFormData(requestData)) { - delete requestHeaders['Content-Type']; // Let the browser set it - } + function next () { + if (--n === 0) + self._finish() + } +} - var request = new XMLHttpRequest(); +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() - // HTTP basic authentication - if (config.auth) { - var username = config.auth.username || ''; - var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; - requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); - } + var found = Object.keys(matchset) + var self = this + var n = found.length - var fullPath = buildFullPath(config.baseURL, config.url); - request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); + if (n === 0) + return cb() - // Set the request timeout in MS - request.timeout = config.timeout; + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here - // Listen for ready state - request.onreadystatechange = function handleLoad() { - if (!request || request.readyState !== 4) { - return; + if (--n === 0) { + self.matches[index] = set + cb() } + }) + }) +} - // The request errored out and we didn't get a response, this will be - // handled by onerror instead - // With one exception: request that using file: protocol, most browsers - // will return status as 0 even though it's a successful request - if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { - return; - } +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} - // Prepare the response - var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; - var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; - var response = { - data: responseData, - status: request.status, - statusText: request.statusText, - headers: responseHeaders, - config: config, - request: request - }; +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} - settle(resolve, reject, response); +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} - // Clean up request - request = null; - }; +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} - // Handle browser request cancellation (as opposed to a manual cancellation) - request.onabort = function handleAbort() { - if (!request) { - return; +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) } + } + } +} - reject(createError('Request aborted', config, 'ECONNABORTED', request)); +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') - // Clean up request - request = null; - }; + if (this.aborted) + return - // Handle low level network errors - request.onerror = function handleError() { - // Real errors are hidden from us by the browser - // onerror should only fire if it's a network error - reject(createError('Network Error', config, null, request)); + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } - // Clean up request - request = null; - }; + //console.error('PROCESS %d', this._processing, pattern) - // Handle timeout - request.ontimeout = function handleTimeout() { - var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; - if (config.timeoutErrorMessage) { - timeoutErrorMessage = config.timeoutErrorMessage; - } - reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', - request)); + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return - // Clean up request - request = null; - }; + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break - // Add xsrf header - // This is only done if running in a standard browser environment. - // Specifically not if we're in a web worker, or react-native. - if (utils.isStandardBrowserEnv()) { - // Add xsrf header - var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? - cookies.read(config.xsrfCookieName) : - undefined; + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } - if (xsrfValue) { - requestHeaders[config.xsrfHeaderName] = xsrfValue; - } - } + var remain = pattern.slice(n) - // Add headers to the request - if ('setRequestHeader' in request) { - utils.forEach(requestHeaders, function setRequestHeader(val, key) { - if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { - // Remove Content-Type if data is undefined - delete requestHeaders[key]; - } else { - // Otherwise add header to the request - request.setRequestHeader(key, val); - } - }); - } + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix - // Add withCredentials to request if needed - if (!utils.isUndefined(config.withCredentials)) { - request.withCredentials = !!config.withCredentials; - } + var abs = this._makeAbs(read) - // Add responseType to request if needed - if (config.responseType) { - try { - request.responseType = config.responseType; - } catch (e) { - // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. - // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. - if (config.responseType !== 'json') { - throw e; - } - } - } + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() - // Handle progress if needed - if (typeof config.onDownloadProgress === 'function') { - request.addEventListener('progress', config.onDownloadProgress); - } + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} - // Not all browsers support upload events - if (typeof config.onUploadProgress === 'function' && request.upload) { - request.upload.addEventListener('progress', config.onUploadProgress); - } +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} - if (config.cancelToken) { - // Handle cancellation - config.cancelToken.promise.then(function onCanceled(cancel) { - if (!request) { - return; - } +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - request.abort(); - reject(cancel); - // Clean up request - request = null; - }); - } + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() - if (!requestData) { - requestData = null; + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) } + } - // Send the request - request.send(requestData); - }); -}; + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() -/***/ }), + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. -/***/ 705: -/***/ (function(module, __unusedexports, __webpack_require__) { + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) -var fs = __webpack_require__( 747 ); -var write = __webpack_require__( 985 ); -var flatted = __webpack_require__( 927 ); + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } -module.exports = { - tryParse: function ( filePath, defaultValue ) { - var result; - try { - result = this.readJSON( filePath ); - } catch (ex) { - result = defaultValue; + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) } - return result; - }, - - /** - * Read json file synchronously using flatted - * - * @method readJSON - * @param {String} filePath Json filepath - * @returns {*} parse result - */ - readJSON: function ( filePath ) { - return flatted.parse( fs.readFileSync( filePath, { - encoding: 'utf8' - } ) ); - }, + // This was the last one, and no stats were needed + return cb() + } - /** - * Write json file synchronously using circular-json - * - * @method writeJSON - * @param {String} filePath Json filepath - * @param {*} data Object to serialize - */ - writeJSON: function ( filePath, data ) { - write.sync( filePath, flatted.stringify( data ) ); + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) } -}; + cb() +} +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return -/***/ }), + if (isIgnored(this, e)) + return -/***/ 719: -/***/ (function(module) { + if (this.paused) { + this._emitQueue.push([index, e]) + return + } -// Returns a wrapper function that returns a wrapped callback -// The wrapper function should do some stuff, and return a -// presumably different callback function. -// This makes sure that own properties are retained, so that -// decorations and such are not lost along the way. -module.exports = wrappy -function wrappy (fn, cb) { - if (fn && cb) return wrappy(fn)(cb) + var abs = isAbsolute(e) ? e : this._makeAbs(e) - if (typeof fn !== 'function') - throw new TypeError('need wrapper function') + if (this.mark) + e = this._mark(e) - Object.keys(fn).forEach(function (k) { - wrapper[k] = fn[k] - }) + if (this.absolute) + e = abs - return wrapper + if (this.matches[index][e]) + return - function wrapper() { - var args = new Array(arguments.length) - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - var ret = fn.apply(this, args) - var cb = args[args.length-1] - if (typeof ret === 'function' && ret !== cb) { - Object.keys(cb).forEach(function (k) { - ret[k] = cb[k] - }) - } - return ret + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return } -} + this.matches[index][e] = true -/***/ }), + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) -/***/ 747: -/***/ (function(module) { + this.emit('match', e) +} -module.exports = require("fs"); +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return -/***/ }), + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) -/***/ 757: -/***/ (function(module, __unusedexports, __webpack_require__) { + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) -"use strict"; + if (lstatcb) + fs.lstat(abs, lstatcb) + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() -var isAbsoluteURL = __webpack_require__(429); -var combineURLs = __webpack_require__(507); + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym -/** - * Creates a new URL by combining the baseURL with the requestedURL, - * only when the requestedURL is not already an absolute URL. - * If the requestURL is absolute, this function returns the requestedURL untouched. - * - * @param {string} baseURL The base URL - * @param {string} requestedURL Absolute or relative URL to combine - * @returns {string} The combined full path - */ -module.exports = function buildFullPath(baseURL, requestedURL) { - if (baseURL && !isAbsoluteURL(requestedURL)) { - return combineURLs(baseURL, requestedURL); + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) } - return requestedURL; -}; +} +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return -/***/ }), + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return -/***/ 759: -/***/ (function(module) { + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) -module.exports = require("events"); + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() -/***/ }), + if (Array.isArray(c)) + return cb(null, c) + } -/***/ 761: -/***/ (function(module) { + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} -module.exports = require("zlib"); +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} -/***/ }), +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return -/***/ 774: -/***/ (function(module) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } -"use strict"; + this.cache[abs] = entries + return cb(null, entries) +} +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return -/** - * A `Cancel` is an object that is thrown when an operation is canceled. - * - * @class - * @param {string=} message The message. - */ -function Cancel(message) { - this.message = message; + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() } -Cancel.prototype.toString = function toString() { - return 'Cancel' + (this.message ? ': ' + this.message : ''); -}; +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} -Cancel.prototype.__CANCEL__ = true; -module.exports = Cancel; +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() -/***/ }), + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) -/***/ 802: -/***/ (function(module, __unusedexports, __webpack_require__) { + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) -module.exports = __webpack_require__(4); + var isSym = this.symlinks[abs] + var len = entries.length -/***/ }), + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() -/***/ 804: -/***/ (function(module, __unusedexports, __webpack_require__) { + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue -var url = __webpack_require__(835); -var URL = url.URL; -var http = __webpack_require__(605); -var https = __webpack_require__(211); -var Writable = __webpack_require__(413).Writable; -var assert = __webpack_require__(357); -var debug = __webpack_require__(149); + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) -// Create handlers that pass events from native requests -var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; -var eventHandlers = Object.create(null); -events.forEach(function (event) { - eventHandlers[event] = function (arg1, arg2, arg3) { - this._redirectable.emit(event, arg1, arg2, arg3); - }; -}); + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } -// Error types with codes -var RedirectionError = createErrorType( - "ERR_FR_REDIRECTION_FAILURE", - "" -); -var TooManyRedirectsError = createErrorType( - "ERR_FR_TOO_MANY_REDIRECTS", - "Maximum number of redirects exceeded" -); -var MaxBodyLengthExceededError = createErrorType( - "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", - "Request body larger than maxBodyLength limit" -); -var WriteAfterEndError = createErrorType( - "ERR_STREAM_WRITE_AFTER_END", - "write after end" -); + cb() +} -// An HTTP(S) request that can be redirected -function RedirectableRequest(options, responseCallback) { - // Initialize the request - Writable.call(this); - this._sanitizeOptions(options); - this._options = options; - this._ended = false; - this._ending = false; - this._redirectCount = 0; - this._redirects = []; - this._requestBodyLength = 0; - this._requestBodyBuffers = []; +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { - // Attach a callback if passed - if (responseCallback) { - this.on("response", responseCallback); + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } } - // React to responses of native requests - var self = this; - this._onNativeResponse = function (response) { - self._processResponse(response); - }; + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') - // Perform the first request - this._performRequest(); + // Mark this as a match + this._emitMatch(index, prefix) + cb() } -RedirectableRequest.prototype = Object.create(Writable.prototype); -RedirectableRequest.prototype.abort = function () { - // Abort the internal request - abortRequest(this._currentRequest); +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' - // Abort this request - this.emit("abort"); - this.removeAllListeners(); -}; + if (f.length > this.maxLength) + return cb() -// Writes buffered data to the current native request -RedirectableRequest.prototype.write = function (data, encoding, callback) { - // Writing is not allowed if end has been called - if (this._ending) { - throw new WriteAfterEndError(); - } + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] - // Validate input and shift parameters if necessary - if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) { - throw new TypeError("data should be a string, Buffer or Uint8Array"); - } - if (typeof encoding === "function") { - callback = encoding; - encoding = null; + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. } - // Ignore empty buffers, since writing them doesn't invoke the callback - // https://github.com/nodejs/node/issues/22066 - if (data.length === 0) { - if (callback) { - callback(); + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) } - return; - } - // Only write when we don't exceed the maximum body length - if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { - this._requestBodyLength += data.length; - this._requestBodyBuffers.push({ data: data, encoding: encoding }); - this._currentRequest.write(data, encoding, callback); - } - // Error when we exceed the maximum body length - else { - this.emit("error", new MaxBodyLengthExceededError()); - this.abort(); } -}; -// Ends the current native request -RedirectableRequest.prototype.end = function (data, encoding, callback) { - // Shift parameters if necessary - if (typeof data === "function") { - callback = data; - data = encoding = null; - } - else if (typeof encoding === "function") { - callback = encoding; - encoding = null; - } + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) - // Write data if needed and end - if (!data) { - this._ended = this._ending = true; - this._currentRequest.end(null, null, callback); + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } } - else { - var self = this; - var currentRequest = this._currentRequest; - this.write(data, encoding, function () { - self._ended = true; - currentRequest.end(null, null, callback); - }); - this._ending = true; +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() } -}; -// Sets a header value on the current native request -RedirectableRequest.prototype.setHeader = function (name, value) { - this._options.headers[name] = value; - this._currentRequest.setHeader(name, value); -}; + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat -// Clears a header value on the current native request -RedirectableRequest.prototype.removeHeader = function (name) { - delete this._options.headers[name]; - this._currentRequest.removeHeader(name); -}; + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) -// Global timeout for all underlying requests -RedirectableRequest.prototype.setTimeout = function (msecs, callback) { - var self = this; - if (callback) { - this.on("timeout", callback); - } + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c - function destroyOnTimeout(socket) { - socket.setTimeout(msecs); - socket.removeListener("timeout", socket.destroy); - socket.addListener("timeout", socket.destroy); - } + if (needDir && c === 'FILE') + return cb() - // Sets up a timer to trigger a timeout event - function startTimer(socket) { - if (self._timeout) { - clearTimeout(self._timeout); - } - self._timeout = setTimeout(function () { - self.emit("timeout"); - clearTimer(); - }, msecs); - destroyOnTimeout(socket); - } + return cb(null, c, stat) +} - // Prevent a timeout from triggering - function clearTimer() { - clearTimeout(this._timeout); - if (callback) { - self.removeListener("timeout", callback); - } - if (!this.socket) { - self._currentRequest.removeListener("socket", startTimer); - } - } - // Start the timer when the socket is opened - if (this.socket) { - startTimer(this.socket); +/***/ }), + +/***/ 9010: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = __nccwpck_require__(5747) +var rp = __nccwpck_require__(6863) +var minimatch = __nccwpck_require__(3973) +var Minimatch = minimatch.Minimatch +var Glob = __nccwpck_require__(1957).Glob +var util = __nccwpck_require__(1669) +var path = __nccwpck_require__(5622) +var assert = __nccwpck_require__(2357) +var isAbsolute = __nccwpck_require__(8714) +var common = __nccwpck_require__(7625) +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) } - else { - this._currentRequest.once("socket", startTimer); + this._finish() +} + +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = rp.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) } + common.finish(this) +} - this.on("socket", destroyOnTimeout); - this.once("response", clearTimer); - this.once("error", clearTimer); - return this; -}; +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) -// Proxy all other public ClientRequest methods -[ - "flushHeaders", "getHeader", - "setNoDelay", "setSocketKeepAlive", -].forEach(function (method) { - RedirectableRequest.prototype[method] = function (a, b) { - return this._currentRequest[method](a, b); - }; -}); + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. -// Proxy all public ClientRequest properties -["aborted", "connection", "socket"].forEach(function (property) { - Object.defineProperty(RedirectableRequest.prototype, property, { - get: function () { return this._currentRequest[property]; }, - }); -}); + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return -RedirectableRequest.prototype._sanitizeOptions = function (options) { - // Ensure headers are always present - if (!options.headers) { - options.headers = {}; - } + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break - // Since http.request treats host as an alias of hostname, - // but the url module interprets host as hostname plus port, - // eliminate the host property to avoid confusion. - if (options.host) { - // Use hostname if set, because it has precedence - if (!options.hostname) { - options.hostname = options.host; - } - delete options.host; + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break } - // Complete the URL object when necessary - if (!options.pathname && options.path) { - var searchPos = options.path.indexOf("?"); - if (searchPos < 0) { - options.pathname = options.path; - } - else { - options.pathname = options.path.substring(0, searchPos); - options.search = options.path.substring(searchPos); - } - } -}; + var remain = pattern.slice(n) + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix -// Executes the next native request (initial or redirect) -RedirectableRequest.prototype._performRequest = function () { - // Load the native protocol - var protocol = this._options.protocol; - var nativeProtocol = this._options.nativeProtocols[protocol]; - if (!nativeProtocol) { - this.emit("error", new TypeError("Unsupported protocol " + protocol)); - return; - } + var abs = this._makeAbs(read) - // If specified, use the agent corresponding to the protocol - // (HTTP and HTTPS use different types of agents) - if (this._options.agents) { - var scheme = protocol.substr(0, protocol.length - 1); - this._options.agent = this._options.agents[scheme]; - } + //if ignored, skip processing + if (childrenIgnored(this, read)) + return - // Create the native request - var request = this._currentRequest = - nativeProtocol.request(this._options, this._onNativeResponse); - this._currentUrl = url.format(this._options); + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} - // Set up event handlers - request._redirectable = this; - for (var e = 0; e < events.length; e++) { - request.on(events[e], eventHandlers[events[e]]); - } - // End a redirected request - // (The first request must be ended explicitly with RedirectableRequest#end) - if (this._isRedirect) { - // Write the request entity and end. - var i = 0; - var self = this; - var buffers = this._requestBodyBuffers; - (function writeNext(error) { - // Only write if this request has not been redirected yet - /* istanbul ignore else */ - if (request === self._currentRequest) { - // Report any write errors - /* istanbul ignore if */ - if (error) { - self.emit("error", error); - } - // Write the next buffer if there are still left - else if (i < buffers.length) { - var buffer = buffers[i++]; - /* istanbul ignore else */ - if (!request.finished) { - request.write(buffer.data, buffer.encoding, writeNext); - } - } - // End the request if `end` has been called on us - else if (self._ended) { - request.end(); - } +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) } - }()); + if (m) + matchedEntries.push(e) + } } -}; -// Processes a response from the current native request -RedirectableRequest.prototype._processResponse = function (response) { - // Store the redirected response - var statusCode = response.statusCode; - if (this._options.trackRedirects) { - this._redirects.push({ - url: this._currentUrl, - headers: response.headers, - statusCode: statusCode, - }); - } + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return - // RFC7231§6.4: The 3xx (Redirection) class of status code indicates - // that further action needs to be taken by the user agent in order to - // fulfill the request. If a Location header field is provided, - // the user agent MAY automatically redirect its request to the URI - // referenced by the Location field value, - // even if the specific status code is not understood. - var location = response.headers.location; - if (location && this._options.followRedirects !== false && - statusCode >= 300 && statusCode < 400) { - // Abort the current request - abortRequest(this._currentRequest); - // Discard the remainder of the response to avoid waiting for data - response.destroy(); + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. - // RFC7231§6.4: A client SHOULD detect and intervene - // in cyclical redirections (i.e., "infinite" redirection loops). - if (++this._redirectCount > this._options.maxRedirects) { - this.emit("error", new TooManyRedirectsError()); - return; - } + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) - // RFC7231§6.4: Automatic redirection needs to done with - // care for methods not known to be safe, […] - // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change - // the request method from POST to GET for the subsequent request. - if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || - // RFC7231§6.4.4: The 303 (See Other) status code indicates that - // the server is redirecting the user agent to a different resource […] - // A user agent can perform a retrieval request targeting that URI - // (a GET or HEAD request if using HTTP) […] - (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { - this._options.method = "GET"; - // Drop a possible entity and headers related to it - this._requestBodyBuffers = []; - removeMatchingHeaders(/^content-/i, this._options.headers); + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} - // Drop the Host header, as the redirect might lead to a different host - var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) || - url.parse(this._currentUrl).hostname; - // Create the redirected request - var redirectUrl = url.resolve(this._currentUrl, location); - debug("redirecting to", redirectUrl); - this._isRedirect = true; - var redirectUrlParts = url.parse(redirectUrl); - Object.assign(this._options, redirectUrlParts); +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) + return - // Drop the Authorization header if redirecting to another host - if (redirectUrlParts.hostname !== previousHostName) { - removeMatchingHeaders(/^authorization$/i, this._options.headers); - } + var abs = this._makeAbs(e) - // Evaluate the beforeRedirect callback - if (typeof this._options.beforeRedirect === "function") { - var responseDetails = { headers: response.headers }; - try { - this._options.beforeRedirect.call(null, this._options, responseDetails); - } - catch (err) { - this.emit("error", err); - return; - } - this._sanitizeOptions(this._options); - } + if (this.mark) + e = this._mark(e) - // Perform the redirected request - try { - this._performRequest(); - } - catch (cause) { - var error = new RedirectionError("Redirected request failed: " + cause.message); - error.cause = cause; - this.emit("error", error); - } + if (this.absolute) { + e = abs } - else { - // The response is not a redirect; return it as-is - response.responseUrl = this._currentUrl; - response.redirects = this._redirects; - this.emit("response", response); - // Clean up - this._requestBodyBuffers = []; + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return } -}; -// Wraps the key/value object of protocols with redirect functionality -function wrap(protocols) { - // Default settings - var exports = { - maxRedirects: 21, - maxBodyLength: 10 * 1024 * 1024, - }; + this.matches[index][e] = true - // Wrap each protocol - var nativeProtocols = {}; - Object.keys(protocols).forEach(function (scheme) { - var protocol = scheme + ":"; - var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; - var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); + if (this.stat) + this._stat(e) +} - // Executes a request, following redirects - function request(input, options, callback) { - // Parse parameters - if (typeof input === "string") { - var urlStr = input; - try { - input = urlToOptions(new URL(urlStr)); - } - catch (err) { - /* istanbul ignore next */ - input = url.parse(urlStr); - } - } - else if (URL && (input instanceof URL)) { - input = urlToOptions(input); - } - else { - callback = options; - options = input; - input = { protocol: protocol }; - } - if (typeof options === "function") { - callback = options; - options = null; - } - // Set defaults - options = Object.assign({ - maxRedirects: exports.maxRedirects, - maxBodyLength: exports.maxBodyLength, - }, input, options); - options.nativeProtocols = nativeProtocols; +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) - assert.equal(options.protocol, protocol, "protocol mismatch"); - debug("options", options); - return new RedirectableRequest(options, callback); + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null } + } - // Executes a GET request, following redirects - function get(input, options, callback) { - var wrappedRequest = wrappedProtocol.request(input, options, callback); - wrappedRequest.end(); - return wrappedRequest; - } + var isSym = lstat && lstat.isSymbolicLink() + this.symlinks[abs] = isSym - // Expose the properties on the wrapped protocol - Object.defineProperties(wrappedProtocol, { - request: { value: request, configurable: true, enumerable: true, writable: true }, - get: { value: get, configurable: true, enumerable: true, writable: true }, - }); - }); - return exports; + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries } -/* istanbul ignore next */ -function noop() { /* empty */ } +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries -// from https://github.com/nodejs/node/blob/master/lib/internal/url.js -function urlToOptions(urlObject) { - var options = { - protocol: urlObject.protocol, - hostname: urlObject.hostname.startsWith("[") ? - /* istanbul ignore next */ - urlObject.hostname.slice(1, -1) : - urlObject.hostname, - hash: urlObject.hash, - search: urlObject.search, - pathname: urlObject.pathname, - path: urlObject.pathname + urlObject.search, - href: urlObject.href, - }; - if (urlObject.port !== "") { - options.port = Number(urlObject.port); + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c } - return options; -} -function removeMatchingHeaders(regex, headers) { - var lastValue; - for (var header in headers) { - if (regex.test(header)) { - lastValue = headers[header]; - delete headers[header]; - } + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null } - return lastValue; } -function createErrorType(code, defaultMessage) { - function CustomError(message) { - Error.captureStackTrace(this, this.constructor); - this.message = message || defaultMessage; +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } } - CustomError.prototype = new Error(); - CustomError.prototype.constructor = CustomError; - CustomError.prototype.name = "Error [" + code + "]"; - CustomError.prototype.code = code; - return CustomError; + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries } -function abortRequest(request) { - for (var e = 0; e < events.length; e++) { - request.removeListener(events[e], eventHandlers[events[e]]); +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + throw error + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break } - request.on("error", noop); - request.abort(); } -// Exports -module.exports = wrap({ http: http, https: https }); -module.exports.wrap = wrap; - +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { -/***/ }), + var entries = this._readdir(abs, inGlobStar) -/***/ 806: -/***/ (function(module) { + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return -"use strict"; + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) -/** - * Syntactic sugar for invoking a function and expanding an array for arguments. - * - * Common use case would be to use `Function.prototype.apply`. - * - * ```js - * function f(x, y, z) {} - * var args = [1, 2, 3]; - * f.apply(null, args); - * ``` - * - * With `spread` this example can be re-written. - * - * ```js - * spread(function(x, y, z) {})([1, 2, 3]); - * ``` - * - * @param {Function} callback - * @returns {Function} - */ -module.exports = function spread(callback) { - return function wrap(arr) { - return callback.apply(null, arr); - }; -}; + var len = entries.length + var isSym = this.symlinks[abs] + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return -/***/ }), + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue -/***/ 807: -/***/ (function(module) { + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) -"use strict"; + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} -const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; -const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; -const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; -const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) -const ESCAPES = new Map([ - ['n', '\n'], - ['r', '\r'], - ['t', '\t'], - ['b', '\b'], - ['f', '\f'], - ['v', '\v'], - ['0', '\0'], - ['\\', '\\'], - ['e', '\u001B'], - ['a', '\u0007'] -]); + if (!this.matches[index]) + this.matches[index] = Object.create(null) -function unescape(c) { - const u = c[0] === 'u'; - const bracket = c[1] === '{'; + // If it doesn't exist, then just mark the lack of results + if (!exists) + return - if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { - return String.fromCharCode(parseInt(c.slice(1), 16)); - } + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } - if (u && bracket) { - return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); - } + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') - return ESCAPES.get(c) || c; + // Mark this as a match + this._emitMatch(index, prefix) } -function parseArguments(name, arguments_) { - const results = []; - const chunks = arguments_.trim().split(/\s*,\s*/g); - let matches; +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' - for (const chunk of chunks) { - const number = Number(chunk); - if (!Number.isNaN(number)) { - results.push(number); - } else if ((matches = chunk.match(STRING_REGEX))) { - results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); - } else { - throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); - } - } + if (f.length > this.maxLength) + return false - return results; -} + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] -function parseStyle(style) { - STYLE_REGEX.lastIndex = 0; + if (Array.isArray(c)) + c = 'DIR' - const results = []; - let matches; + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c - while ((matches = STYLE_REGEX.exec(style)) !== null) { - const name = matches[1]; + if (needDir && c === 'FILE') + return false - if (matches[2]) { - const args = parseArguments(name, matches[2]); - results.push([name].concat(args)); - } else { - results.push([name]); - } - } + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } - return results; -} + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } + } -function buildStyle(chalk, styles) { - const enabled = {}; + if (lstat && lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } - for (const layer of styles) { - for (const style of layer.styles) { - enabled[style[0]] = layer.inverse ? null : style.slice(1); - } - } + this.statCache[abs] = stat - let current = chalk; - for (const [styleName, styles] of Object.entries(enabled)) { - if (!Array.isArray(styles)) { - continue; - } + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' - if (!(styleName in current)) { - throw new Error(`Unknown Chalk style: ${styleName}`); - } + this.cache[abs] = this.cache[abs] || c - current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; - } + if (needDir && c === 'FILE') + return false - return current; + return c } -module.exports = (chalk, temporary) => { - const styles = []; - const chunks = []; - let chunk = []; - - // eslint-disable-next-line max-params - temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { - if (escapeCharacter) { - chunk.push(unescape(escapeCharacter)); - } else if (style) { - const string = chunk.join(''); - chunk = []; - chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); - styles.push({inverse, styles: parseStyle(style)}); - } else if (close) { - if (styles.length === 0) { - throw new Error('Found extraneous } in Chalk template literal'); - } - - chunks.push(buildStyle(chalk, styles)(chunk.join(''))); - chunk = []; - styles.pop(); - } else { - chunk.push(character); - } - }); - - chunks.push(chunk.join('')); - - if (styles.length > 0) { - const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; - throw new Error(errMessage); - } +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} - return chunks.join(''); -}; +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} /***/ }), -/***/ 812: -/***/ (function(module) { +/***/ 1621: +/***/ ((module) => { + +"use strict"; -module.exports = function (xs, fn) { - var res = []; - for (var i = 0; i < xs.length; i++) { - var x = fn(xs[i], i); - if (isArray(x)) res.push.apply(res, x); - else res.push(x); - } - return res; -}; -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; +module.exports = (flag, argv = process.argv) => { + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); }; /***/ }), -/***/ 823: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 2527: +/***/ ((module) => { -const os = __webpack_require__(87) -const path = __webpack_require__(622) +/** + * @preserve + * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) + * + * @author Jens Taylor + * @see http://github.com/homebrewing/brauhaus-diff + * @author Gary Court + * @see http://github.com/garycourt/murmurhash-js + * @author Austin Appleby + * @see http://sites.google.com/site/murmurhash/ + */ +(function(){ + var cache; -function posix (id) { - const cacheHome = process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache') - return path.join(cacheHome, id) -} + // Call this function without `new` to use the cached object (good for + // single-threaded environments), or with `new` to create a new object. + // + // @param {string} key A UTF-16 or ASCII string + // @param {number} seed An optional positive integer + // @return {object} A MurmurHash3 object for incremental hashing + function MurmurHash3(key, seed) { + var m = this instanceof MurmurHash3 ? this : cache; + m.reset(seed) + if (typeof key === 'string' && key.length > 0) { + m.hash(key); + } -function darwin (id) { - return path.join(os.homedir(), 'Library', 'Caches', id) -} + if (m !== this) { + return m; + } + }; -function win32 (id) { - const appData = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local') - return path.join(appData, id, 'Cache') -} + // Incrementally add a string to this hash + // + // @param {string} key A UTF-16 or ASCII string + // @return {object} this + MurmurHash3.prototype.hash = function(key) { + var h1, k1, i, top, len; -const implementation = (function () { - switch (os.platform()) { - case 'darwin': - return darwin - case 'win32': - return win32 - case 'aix': - case 'android': - case 'freebsd': - case 'linux': - case 'netbsd': - case 'openbsd': - case 'sunos': - return posix - default: - console.error(`(node:${process.pid}) [cachedir] Warning: the platform "${os.platform()}" is not currently supported by node-cachedir, falling back to "posix". Please file an issue with your platform here: https://github.com/LinusU/node-cachedir/issues/new`) - return posix - } -}()) + len = key.length; + this.len += len; -module.exports = function cachedir (id) { - if (typeof id !== 'string') { - throw new TypeError('id is not a string') - } - if (id.length === 0) { - throw new Error('id cannot be empty') - } - if (/[^0-9a-zA-Z-]/.test(id)) { - throw new Error('id cannot contain special characters') - } + k1 = this.k1; + i = 0; + switch (this.rem) { + case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0; + case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0; + case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0; + case 3: + k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0; + k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0; + } - return implementation(id) -} + this.rem = (len + this.rem) & 3; // & 3 is same as % 4 + len -= this.rem; + if (len > 0) { + h1 = this.h1; + while (1) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + h1 ^= k1; + h1 = (h1 << 13) | (h1 >>> 19); + h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff; -/***/ }), + if (i >= len) { + break; + } -/***/ 829: -/***/ (function(module) { + k1 = ((key.charCodeAt(i++) & 0xffff)) ^ + ((key.charCodeAt(i++) & 0xffff) << 8) ^ + ((key.charCodeAt(i++) & 0xffff) << 16); + top = key.charCodeAt(i++); + k1 ^= ((top & 0xff) << 24) ^ + ((top & 0xff00) >> 8); + } -"use strict"; + k1 = 0; + switch (this.rem) { + case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16; + case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8; + case 1: k1 ^= (key.charCodeAt(i) & 0xffff); + } + this.h1 = h1; + } -function posix(path) { - return path.charAt(0) === '/'; -} + this.k1 = k1; + return this; + }; -function win32(path) { - // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 - var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; - var result = splitDeviceRe.exec(path); - var device = result[1] || ''; - var isUnc = Boolean(device && device.charAt(1) !== ':'); + // Get the result of this hash + // + // @return {number} The 32-bit hash + MurmurHash3.prototype.result = function() { + var k1, h1; + + k1 = this.k1; + h1 = this.h1; - // UNC paths are always absolute - return Boolean(result[2] || isUnc); -} + if (k1 > 0) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + h1 ^= k1; + } -module.exports = process.platform === 'win32' ? win32 : posix; -module.exports.posix = posix; -module.exports.win32 = win32; + h1 ^= this.len; + + h1 ^= h1 >>> 16; + h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff; + h1 ^= h1 >>> 13; + h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff; + h1 ^= h1 >>> 16; + return h1 >>> 0; + }; -/***/ }), + // Reset the hash object for reuse + // + // @param {number} seed An optional positive integer + MurmurHash3.prototype.reset = function(seed) { + this.h1 = typeof seed === 'number' ? seed : 0; + this.rem = this.k1 = this.len = 0; + return this; + }; -/***/ 835: -/***/ (function(module) { + // A cached object to use. This can be safely used if you're in a single- + // threaded environment, otherwise you need to create new hashes to use. + cache = new MurmurHash3(); + + if (true) { + module.exports = MurmurHash3; + } else {} +}()); -module.exports = require("url"); /***/ }), -/***/ 844: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 2492: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +var wrappy = __nccwpck_require__(2940) +var reqs = Object.create(null) +var once = __nccwpck_require__(1223) +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} -var utils = __webpack_require__(397); +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) -function InterceptorManager() { - this.handlers = []; + // XXX It's somewhat ambiguous whether a new callback added in this + // pass should be queued for later execution if something in the + // list of callbacks throws, or if it should just be discarded. + // However, it's such an edge case that it hardly matters, and either + // choice is likely as surprising as the other. + // As it happens, we do go ahead and schedule it for later execution. + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + } finally { + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + } + }) } -/** - * Add a new interceptor to the stack - * - * @param {Function} fulfilled The function to handle `then` for a `Promise` - * @param {Function} rejected The function to handle `reject` for a `Promise` - * - * @return {Number} An ID used to remove interceptor later - */ -InterceptorManager.prototype.use = function use(fulfilled, rejected) { - this.handlers.push({ - fulfilled: fulfilled, - rejected: rejected - }); - return this.handlers.length - 1; -}; +function slice (args) { + var length = args.length + var array = [] -/** - * Remove an interceptor from the stack - * - * @param {Number} id The ID that was returned by `use` - */ -InterceptorManager.prototype.eject = function eject(id) { - if (this.handlers[id]) { - this.handlers[id] = null; - } -}; + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} -/** - * Iterate over all the registered interceptors - * - * This method is particularly useful for skipping over any - * interceptors that may have become `null` calling `eject`. - * - * @param {Function} fn The function to call for each interceptor - */ -InterceptorManager.prototype.forEach = function forEach(fn) { - utils.forEach(this.handlers, function forEachHandler(h) { - if (h !== null) { - fn(h); - } - }); -}; -module.exports = InterceptorManager; +/***/ }), + +/***/ 4124: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +try { + var util = __nccwpck_require__(1669); + /* istanbul ignore next */ + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + /* istanbul ignore next */ + module.exports = __nccwpck_require__(8544); +} /***/ }), -/***/ 851: -/***/ (function(module) { +/***/ 8544: +/***/ ((module) => { if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module @@ -9395,1331 +7510,3126 @@ if (typeof Object.create === 'function') { /***/ }), -/***/ 857: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 3973: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -"use strict"; +module.exports = minimatch +minimatch.Minimatch = Minimatch +var path = { sep: '/' } +try { + path = __nccwpck_require__(5622) +} catch (er) {} -var utils = __webpack_require__(397); -var normalizeHeaderName = __webpack_require__(152); +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = __nccwpck_require__(3717) -var DEFAULT_CONTENT_TYPE = { - 'Content-Type': 'application/x-www-form-urlencoded' -}; +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} -function setContentTypeIfUnset(headers, value) { - if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { - headers['Content-Type'] = value; +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) } } -function getDefaultAdapter() { - var adapter; - if (typeof XMLHttpRequest !== 'undefined') { - // For browsers use XHR adapter - adapter = __webpack_require__(701); - } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { - // For node use HTTP adapter - adapter = __webpack_require__(356); +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ } - return adapter; + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate } -var defaults = { - adapter: getDefaultAdapter(), +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} - transformRequest: [function transformRequest(data, headers) { - normalizeHeaderName(headers, 'Accept'); - normalizeHeaderName(headers, 'Content-Type'); - if (utils.isFormData(data) || - utils.isArrayBuffer(data) || - utils.isBuffer(data) || - utils.isStream(data) || - utils.isFile(data) || - utils.isBlob(data) - ) { - return data; - } - if (utils.isArrayBufferView(data)) { - return data.buffer; - } - if (utils.isURLSearchParams(data)) { - setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); - return data.toString(); - } - if (utils.isObject(data)) { - setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); - return JSON.stringify(data); - } - return data; - }], +Minimatch.prototype.braceExpand = braceExpand - transformResponse: [function transformResponse(data) { - /*eslint no-param-reassign:0*/ - if (typeof data === 'string') { - try { - data = JSON.parse(data); - } catch (e) { /* Ignore */ } +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} } - return data; - }], - - /** - * A timeout in milliseconds to abort a request. If set to 0 (default) a - * timeout is not created. - */ - timeout: 0, + } - xsrfCookieName: 'XSRF-TOKEN', - xsrfHeaderName: 'X-XSRF-TOKEN', + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern - maxContentLength: -1, - maxBodyLength: -1, + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern') + } - validateStatus: function validateStatus(status) { - return status >= 200 && status < 300; + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] } -}; -defaults.headers = { - common: { - 'Accept': 'application/json, text/plain, */*' + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError('pattern is too long') } -}; -utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { - defaults.headers[method] = {}; -}); + var options = this.options -utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { - defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); -}); + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' -module.exports = defaults; + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } -/***/ }), + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) -/***/ 867: -/***/ (function(module) { + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } -module.exports = require("tty"); + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false -/***/ }), + case '\\': + clearStateChar() + escaping = true + continue -/***/ 870: -/***/ (function(module, __unusedexports, __webpack_require__) { + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) -var wrappy = __webpack_require__(719) -module.exports = wrappy(once) -module.exports.strict = wrappy(onceStrict) + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }) + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function () { - return onceStrict(this) - }, - configurable: true - }) -}) + case '(': + if (inClass) { + re += '(' + continue + } -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true - return f.value = fn.apply(this, arguments) - } - f.called = false - return f -} + if (!stateChar) { + re += '\\(' + continue + } -function onceStrict (fn) { - var f = function () { - if (f.called) - throw new Error(f.onceError) - f.called = true - return f.value = fn.apply(this, arguments) - } - var name = fn.name || 'Function wrapped with `once`' - f.onceError = name + " shouldn't be called more than once" - f.called = false - return f -} + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } -/***/ }), + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue -/***/ 879: -/***/ (function(module) { + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } -/** - * @preserve - * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) - * - * @author Jens Taylor - * @see http://github.com/homebrewing/brauhaus-diff - * @author Gary Court - * @see http://github.com/garycourt/murmurhash-js - * @author Austin Appleby - * @see http://sites.google.com/site/murmurhash/ - */ -(function(){ - var cache; + clearStateChar() + re += '|' + continue - // Call this function without `new` to use the cached object (good for - // single-threaded environments), or with `new` to create a new object. - // - // @param {string} key A UTF-16 or ASCII string - // @param {number} seed An optional positive integer - // @return {object} A MurmurHash3 object for incremental hashing - function MurmurHash3(key, seed) { - var m = this instanceof MurmurHash3 ? this : cache; - m.reset(seed) - if (typeof key === 'string' && key.length > 0) { - m.hash(key); - } + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() - if (m !== this) { - return m; + if (inClass) { + re += '\\' + c + continue } - }; - // Incrementally add a string to this hash - // - // @param {string} key A UTF-16 or ASCII string - // @return {object} this - MurmurHash3.prototype.hash = function(key) { - var h1, k1, i, top, len; + inClass = true + classStart = i + reClassStart = re.length + re += c + continue - len = key.length; - this.len += len; + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } - k1 = this.k1; - i = 0; - switch (this.rem) { - case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0; - case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0; - case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0; - case 3: - k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0; - k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0; + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } } - this.rem = (len + this.rem) & 3; // & 3 is same as % 4 - len -= this.rem; - if (len > 0) { - h1 = this.h1; - while (1) { - k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; - k1 = (k1 << 15) | (k1 >>> 17); - k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + // finish up the class. + hasMagic = true + inClass = false + re += c + continue - h1 ^= k1; - h1 = (h1 << 13) | (h1 >>> 19); - h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff; + default: + // swallow any state char that wasn't consumed + clearStateChar() - if (i >= len) { - break; - } + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } - k1 = ((key.charCodeAt(i++) & 0xffff)) ^ - ((key.charCodeAt(i++) & 0xffff) << 8) ^ - ((key.charCodeAt(i++) & 0xffff) << 16); - top = key.charCodeAt(i++); - k1 ^= ((top & 0xff) << 24) ^ - ((top & 0xff00) >> 8); - } + re += c - k1 = 0; - switch (this.rem) { - case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16; - case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8; - case 1: k1 ^= (key.charCodeAt(i) & 0xffff); - } + } // switch + } // for - this.h1 = h1; - } + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } - this.k1 = k1; - return this; - }; + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } - // Get the result of this hash - // - // @return {number} The 32-bit hash - MurmurHash3.prototype.result = function() { - var k1, h1; - - k1 = this.k1; - h1 = this.h1; + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) - if (k1 > 0) { - k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; - k1 = (k1 << 15) | (k1 >>> 17); - k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; - h1 ^= k1; - } + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type - h1 ^= this.len; + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } - h1 ^= h1 >>> 16; - h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff; - h1 ^= h1 >>> 13; - h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff; - h1 ^= h1 >>> 16; + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } - return h1 >>> 0; - }; + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] - // Reset the hash object for reuse - // - // @param {number} seed An optional positive integer - MurmurHash3.prototype.reset = function(seed) { - this.h1 = typeof seed === 'number' ? seed : 0; - this.rem = this.k1 = this.len = 0; - return this; - }; + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) - // A cached object to use. This can be safely used if you're in a single- - // threaded environment, otherwise you need to create new hashes to use. - cache = new MurmurHash3(); + nlLast += nlAfter - if (true) { - module.exports = MurmurHash3; - } else {} -}()); + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } -/***/ }), + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } -/***/ 885: -/***/ (function(module, __unusedexports, __webpack_require__) { + if (addPatternStart) { + re = patternStart + re + } -"use strict"; + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } -const os = __webpack_require__(87); -const tty = __webpack_require__(867); -const hasFlag = __webpack_require__(384); + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } -const {env} = process; + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } -let forceColor; -if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false') || - hasFlag('color=never')) { - forceColor = 0; -} else if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - forceColor = 1; -} + regExp._glob = pattern + regExp._src = re -if ('FORCE_COLOR' in env) { - if (env.FORCE_COLOR === 'true') { - forceColor = 1; - } else if (env.FORCE_COLOR === 'false') { - forceColor = 0; - } else { - forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); - } + return regExp } -function translateLevel(level) { - if (level === 0) { - return false; - } - - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() } -function supportsColor(haveStream, streamIsTTY) { - if (forceColor === 0) { - return 0; - } +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set - if (hasFlag('color=256')) { - return 2; - } + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options - if (haveStream && !streamIsTTY && forceColor === undefined) { - return 0; - } + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' - const min = forceColor || 0; + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') - if (env.TERM === 'dumb') { - return min; - } + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' - if (process.platform === 'win32') { - // Windows 10 build 10586 is the first Windows release that supports 256 colors. - // Windows 10 build 14931 is the first release that supports 16m/TrueColor. - const osRelease = os.release().split('.'); - if ( - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' - return 1; - } + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} - return min; - } +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } + if (f === '/' && partial) return true - if (env.COLORTERM === 'truecolor') { - return 3; - } + var options = this.options - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } - } + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } + var set = this.set + this.debug(this.pattern, 'set', set) - if ('COLORTERM' in env) { - return 1; - } + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } - return min; -} + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } -function getSupportLevel(stream) { - const level = supportsColor(stream, stream && stream.isTTY); - return translateLevel(level); + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate } -module.exports = { - supportsColor: getSupportLevel, - stdout: translateLevel(supportsColor(true, tty.isatty(1))), - stderr: translateLevel(supportsColor(true, tty.isatty(2))) -}; +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) -/***/ }), + this.debug('matchOne', file.length, pattern.length) -/***/ 908: -/***/ (function(module, __unusedexports, __webpack_require__) { + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] -"use strict"; + this.debug(pattern, p, f) + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false -var utils = __webpack_require__(397); + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) -// Headers whose duplicates are ignored by node -// c.f. https://nodejs.org/api/http.html#http_message_headers -var ignoreDuplicateOf = [ - 'age', 'authorization', 'content-length', 'content-type', 'etag', - 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', - 'last-modified', 'location', 'max-forwards', 'proxy-authorization', - 'referer', 'retry-after', 'user-agent' -]; + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } -/** - * Parse headers into an object - * - * ``` - * Date: Wed, 27 Aug 2014 08:58:49 GMT - * Content-Type: application/json - * Connection: keep-alive - * Transfer-Encoding: chunked - * ``` - * - * @param {String} headers Headers needing to be parsed - * @returns {Object} Headers parsed into an object - */ -module.exports = function parseHeaders(headers) { - var parsed = {}; - var key; - var val; - var i; + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] - if (!headers) { return parsed; } + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) - utils.forEach(headers.split('\n'), function parser(line) { - i = line.indexOf(':'); - key = utils.trim(line.substr(0, i)).toLowerCase(); - val = utils.trim(line.substr(i + 1)); + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } - if (key) { - if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { - return; + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } } - if (key === 'set-cookie') { - parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); - } else { - parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true } + return false } - }); - - return parsed; -}; - - -/***/ }), - -/***/ 924: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var path = __webpack_require__( 622 ); -var fs = __webpack_require__( 747 ); -var utils = __webpack_require__( 705 ); -var del = __webpack_require__( 569 ); -var writeJSON = utils.writeJSON; - -var cache = { - /** - * Load a cache identified by the given Id. If the element does not exists, then initialize an empty - * cache storage. If specified `cacheDir` will be used as the directory to persist the data to. If omitted - * then the cache module directory `./cache` will be used instead - * - * @method load - * @param docId {String} the id of the cache, would also be used as the name of the file cache - * @param [cacheDir] {String} directory for the cache entry - */ - load: function ( docId, cacheDir ) { - var me = this; - - me._visited = { }; - me._persisted = { }; - me._pathToFile = cacheDir ? path.resolve( cacheDir, docId ) : path.resolve( __dirname, './.cache/', docId ); - if ( fs.existsSync( me._pathToFile ) ) { - me._persisted = utils.tryParse( me._pathToFile, { } ); + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) } - }, - /** - * Load the cache from the provided file - * @method loadFile - * @param {String} pathToFile the path to the file containing the info for the cache - */ - loadFile: function ( pathToFile ) { - var me = this; - var dir = path.dirname( pathToFile ); - var fName = path.basename( pathToFile ); - - me.load( fName, dir ); - }, + if (!hit) return false + } - /** - * Returns the entire persisted object - * @method all - * @returns {*} - */ - all: function () { - return this._persisted; - }, + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* - keys: function () { - return Object.keys( this._persisted ); - }, - /** - * sets a key to a given value - * @method setKey - * @param key {string} the key to set - * @param value {object} the value of the key. Could be any object that can be serialized with JSON.stringify - */ - setKey: function ( key, value ) { - this._visited[ key ] = true; - this._persisted[ key ] = value; - }, - /** - * remove a given key from the cache - * @method removeKey - * @param key {String} the key to remove from the object - */ - removeKey: function ( key ) { - delete this._visited[ key ]; // esfmt-ignore-line - delete this._persisted[ key ]; // esfmt-ignore-line - }, - /** - * Return the value of the provided key - * @method getKey - * @param key {String} the name of the key to retrieve - * @returns {*} the value from the key - */ - getKey: function ( key ) { - this._visited[ key ] = true; - return this._persisted[ key ]; - }, + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } - /** - * Remove keys that were not accessed/set since the - * last time the `prune` method was called. - * @method _prune - * @private - */ - _prune: function () { - var me = this; - var obj = { }; + // should be unreachable. + throw new Error('wtf?') +} - var keys = Object.keys( me._visited ); +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} - // no keys visited for either get or set value - if ( keys.length === 0 ) { - return; - } +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} - keys.forEach( function ( key ) { - obj[ key ] = me._persisted[ key ]; - } ); - me._visited = { }; - me._persisted = obj; - }, +/***/ }), - /** - * Save the state of the cache identified by the docId to disk - * as a JSON structure - * @param [noPrune=false] {Boolean} whether to remove from cache the non visited files - * @method save - */ - save: function ( noPrune ) { - var me = this; +/***/ 9622: +/***/ (function(module) { - (!noPrune) && me._prune(); - writeJSON( me._pathToFile, me._persisted ); - }, +(function (global, factory) { + true ? module.exports = factory() : + 0; +}(this, (function () { 'use strict'; - /** - * remove the file where the cache is persisted - * @method removeCacheFile - * @return {Boolean} true or false if the file was successfully deleted - */ - removeCacheFile: function () { - return del( this._pathToFile ); - }, - /** - * Destroy the file cache and cache content. - * @method destroy - */ - destroy: function () { - var me = this; - me._visited = { }; - me._persisted = { }; + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + } + + function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + } + + function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + } - me.removeCacheFile(); - } -}; + /** @ignore */ + var ENTRIES = 'ENTRIES'; + /** @ignore */ + var KEYS = 'KEYS'; + /** @ignore */ + var VALUES = 'VALUES'; + /** @ignore */ + var LEAF = ''; + /** + * @private + */ + var TreeIterator = /** @class */ (function () { + function TreeIterator(set, type) { + var node = set._tree; + var keys = Object.keys(node); + this.set = set; + this._type = type; + this._path = keys.length > 0 ? [{ node: node, keys: keys }] : []; + } + TreeIterator.prototype.next = function () { + var value = this.dive(); + this.backtrack(); + return value; + }; + TreeIterator.prototype.dive = function () { + if (this._path.length === 0) { + return { done: true, value: undefined }; + } + var _a = last(this._path), node = _a.node, keys = _a.keys; + if (last(keys) === LEAF) { + return { done: false, value: this.result() }; + } + this._path.push({ node: node[last(keys)], keys: Object.keys(node[last(keys)]) }); + return this.dive(); + }; + TreeIterator.prototype.backtrack = function () { + if (this._path.length === 0) { + return; + } + last(this._path).keys.pop(); + if (last(this._path).keys.length > 0) { + return; + } + this._path.pop(); + this.backtrack(); + }; + TreeIterator.prototype.key = function () { + return this.set._prefix + this._path + .map(function (_a) { + var keys = _a.keys; + return last(keys); + }) + .filter(function (key) { return key !== LEAF; }) + .join(''); + }; + TreeIterator.prototype.value = function () { + return last(this._path).node[LEAF]; + }; + TreeIterator.prototype.result = function () { + if (this._type === VALUES) { + return this.value(); + } + if (this._type === KEYS) { + return this.key(); + } + return [this.key(), this.value()]; + }; + TreeIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return TreeIterator; + }()); + var last = function (array) { + return array[array.length - 1]; + }; + + var NONE = 0; + var CHANGE = 1; + var ADD = 2; + var DELETE = 3; + /** + * @ignore + */ + var fuzzySearch = function (node, query, maxDistance) { + var stack = [{ distance: 0, i: 0, key: '', node: node }]; + var results = {}; + var innerStack = []; + var _loop_1 = function () { + var _a = stack.pop(), node_1 = _a.node, distance = _a.distance, key = _a.key, i = _a.i, edit = _a.edit; + Object.keys(node_1).forEach(function (k) { + if (k === LEAF) { + var totDistance = distance + (query.length - i); + var _a = __read(results[key] || [null, Infinity], 2), d = _a[1]; + if (totDistance <= maxDistance && totDistance < d) { + results[key] = [node_1[k], totDistance]; + } + } + else { + withinDistance(query, k, maxDistance - distance, i, edit, innerStack).forEach(function (_a) { + var d = _a.distance, i = _a.i, edit = _a.edit; + stack.push({ node: node_1[k], distance: distance + d, key: key + k, i: i, edit: edit }); + }); + } + }); + }; + while (stack.length > 0) { + _loop_1(); + } + return results; + }; + /** + * @ignore + */ + var withinDistance = function (a, b, maxDistance, i, edit, stack) { + stack.push({ distance: 0, ia: i, ib: 0, edit: edit }); + var results = []; + while (stack.length > 0) { + var _a = stack.pop(), distance = _a.distance, ia = _a.ia, ib = _a.ib, edit_1 = _a.edit; + if (ib === b.length) { + results.push({ distance: distance, i: ia, edit: edit_1 }); + continue; + } + if (a[ia] === b[ib]) { + stack.push({ distance: distance, ia: ia + 1, ib: ib + 1, edit: NONE }); + } + else { + if (distance >= maxDistance) { + continue; + } + if (edit_1 !== ADD) { + stack.push({ distance: distance + 1, ia: ia, ib: ib + 1, edit: DELETE }); + } + if (ia < a.length) { + if (edit_1 !== DELETE) { + stack.push({ distance: distance + 1, ia: ia + 1, ib: ib, edit: ADD }); + } + if (edit_1 !== DELETE && edit_1 !== ADD) { + stack.push({ distance: distance + 1, ia: ia + 1, ib: ib + 1, edit: CHANGE }); + } + } + } + } + return results; + }; -module.exports = { - /** - * Alias for create. Should be considered depreacted. Will be removed in next releases - * - * @method load - * @param docId {String} the id of the cache, would also be used as the name of the file cache - * @param [cacheDir] {String} directory for the cache entry - * @returns {cache} cache instance - */ - load: function ( docId, cacheDir ) { - return this.create( docId, cacheDir ); - }, + /** + * A class implementing the same interface as a standard JavaScript + * [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) + * with string keys, but adding support for efficiently searching entries with + * prefix or fuzzy search. This class is used internally by [[MiniSearch]] as + * the inverted index data structure. The implementation is a radix tree + * (compressed prefix tree). + * + * Since this class can be of general utility beyond _MiniSearch_, it is + * exported by the `minisearch` package and can be imported (or required) as + * `minisearch/SearchableMap`. + * + * @typeParam T The type of the values stored in the map. + */ + var SearchableMap = /** @class */ (function () { + /** + * The constructor is normally called without arguments, creating an empty + * map. In order to create a [[SearchableMap]] from an iterable or from an + * object, check [[SearchableMap.from]] and [[SearchableMap.fromObject]]. + * + * The constructor arguments are for internal use, when creating derived + * mutable views of a map at a prefix. + */ + function SearchableMap(tree, prefix) { + if (tree === void 0) { tree = {}; } + if (prefix === void 0) { prefix = ''; } + this._tree = tree; + this._prefix = prefix; + } + /** + * Creates and returns a mutable view of this [[SearchableMap]], containing only + * entries that share the given prefix. + * + * ### Usage: + * + * ```javascript + * let map = new SearchableMap() + * map.set("unicorn", 1) + * map.set("universe", 2) + * map.set("university", 3) + * map.set("unique", 4) + * map.set("hello", 5) + * + * let uni = map.atPrefix("uni") + * uni.get("unique") // => 4 + * uni.get("unicorn") // => 1 + * uni.get("hello") // => undefined + * + * let univer = map.atPrefix("univer") + * univer.get("unique") // => undefined + * univer.get("universe") // => 2 + * univer.get("university") // => 3 + * ``` + * + * @param prefix The prefix + * @return A [[SearchableMap]] representing a mutable view of the original Map at the given prefix + */ + SearchableMap.prototype.atPrefix = function (prefix) { + var _a; + if (!prefix.startsWith(this._prefix)) { + throw new Error('Mismatched prefix'); + } + var _b = __read(trackDown(this._tree, prefix.slice(this._prefix.length)), 2), node = _b[0], path = _b[1]; + if (node === undefined) { + var _c = __read(last$1(path), 2), parentNode = _c[0], key_1 = _c[1]; + var nodeKey = Object.keys(parentNode).find(function (k) { return k !== LEAF && k.startsWith(key_1); }); + if (nodeKey !== undefined) { + return new SearchableMap((_a = {}, _a[nodeKey.slice(key_1.length)] = parentNode[nodeKey], _a), prefix); + } + } + return new SearchableMap(node || {}, prefix); + }; + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear + */ + SearchableMap.prototype.clear = function () { + delete this._size; + this._tree = {}; + }; + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete + * @param key Key to delete + */ + SearchableMap.prototype.delete = function (key) { + delete this._size; + return remove(this._tree, key); + }; + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries + * @return An iterator iterating through `[key, value]` entries. + */ + SearchableMap.prototype.entries = function () { + return new TreeIterator(this, ENTRIES); + }; + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach + * @param fn Iteration function + */ + SearchableMap.prototype.forEach = function (fn) { + var e_1, _a; + try { + for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) { + var _d = __read(_c.value, 2), key = _d[0], value = _d[1]; + fn(key, value, this); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + }; + /** + * Returns a key-value object of all the entries that have a key within the + * given edit distance from the search key. The keys of the returned object are + * the matching keys, while the values are two-elements arrays where the first + * element is the value associated to the key, and the second is the edit + * distance of the key to the search key. + * + * ### Usage: + * + * ```javascript + * let map = new SearchableMap() + * map.set('hello', 'world') + * map.set('hell', 'yeah') + * map.set('ciao', 'mondo') + * + * // Get all entries that match the key 'hallo' with a maximum edit distance of 2 + * map.fuzzyGet('hallo', 2) + * // => { "hello": ["world", 1], "hell": ["yeah", 2] } + * + * // In the example, the "hello" key has value "world" and edit distance of 1 + * // (change "e" to "a"), the key "hell" has value "yeah" and edit distance of 2 + * // (change "e" to "a", delete "o") + * ``` + * + * @param key The search key + * @param maxEditDistance The maximum edit distance (Levenshtein) + * @return A key-value object of the matching keys to their value and edit distance + */ + SearchableMap.prototype.fuzzyGet = function (key, maxEditDistance) { + return fuzzySearch(this._tree, key, maxEditDistance); + }; + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get + * @param key Key to get + * @return Value associated to the key, or `undefined` if the key is not + * found. + */ + SearchableMap.prototype.get = function (key) { + var node = lookup(this._tree, key); + return node !== undefined ? node[LEAF] : undefined; + }; + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has + * @param key Key + * @return True if the key is in the map, false otherwise + */ + SearchableMap.prototype.has = function (key) { + var node = lookup(this._tree, key); + return node !== undefined && node.hasOwnProperty(LEAF); + }; + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys + * @return An `Iterable` iterating through keys + */ + SearchableMap.prototype.keys = function () { + return new TreeIterator(this, KEYS); + }; + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/set + * @param key Key to set + * @param value Value to associate to the key + * @return The [[SearchableMap]] itself, to allow chaining + */ + SearchableMap.prototype.set = function (key, value) { + if (typeof key !== 'string') { + throw new Error('key must be a string'); + } + delete this._size; + var node = createPath(this._tree, key); + node[LEAF] = value; + return this; + }; + Object.defineProperty(SearchableMap.prototype, "size", { + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size + */ + get: function () { + var _this = this; + if (this._size) { + return this._size; + } + /** @ignore */ + this._size = 0; + this.forEach(function () { _this._size += 1; }); + return this._size; + }, + enumerable: false, + configurable: true + }); + /** + * Updates the value at the given key using the provided function. The function + * is called with the current value at the key, and its return value is used as + * the new value to be set. + * + * ### Example: + * + * ```javascript + * // Increment the current value by one + * searchableMap.update('somekey', (currentValue) => currentValue == null ? 0 : currentValue + 1) + * ``` + * + * @param key The key to update + * @param fn The function used to compute the new value from the current one + * @return The [[SearchableMap]] itself, to allow chaining + */ + SearchableMap.prototype.update = function (key, fn) { + if (typeof key !== 'string') { + throw new Error('key must be a string'); + } + delete this._size; + var node = createPath(this._tree, key); + node[LEAF] = fn(node[LEAF]); + return this; + }; + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/values + * @return An `Iterable` iterating through values. + */ + SearchableMap.prototype.values = function () { + return new TreeIterator(this, VALUES); + }; + /** + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/@@iterator + */ + SearchableMap.prototype[Symbol.iterator] = function () { + return this.entries(); + }; + /** + * Creates a [[SearchableMap]] from an `Iterable` of entries + * + * @param entries Entries to be inserted in the [[SearchableMap]] + * @return A new [[SearchableMap]] with the given entries + */ + SearchableMap.from = function (entries) { + var e_2, _a; + var tree = new SearchableMap(); + try { + for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) { + var _b = __read(entries_1_1.value, 2), key = _b[0], value = _b[1]; + tree.set(key, value); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1); + } + finally { if (e_2) throw e_2.error; } + } + return tree; + }; + /** + * Creates a [[SearchableMap]] from the iterable properties of a JavaScript object + * + * @param object Object of entries for the [[SearchableMap]] + * @return A new [[SearchableMap]] with the given entries + */ + SearchableMap.fromObject = function (object) { + return SearchableMap.from(Object.entries(object)); + }; + return SearchableMap; + }()); + var trackDown = function (tree, key, path) { + if (path === void 0) { path = []; } + if (key.length === 0 || tree == null) { + return [tree, path]; + } + var nodeKey = Object.keys(tree).find(function (k) { return k !== LEAF && key.startsWith(k); }); + if (nodeKey === undefined) { + path.push([tree, key]); // performance: update in place + return trackDown(undefined, '', path); + } + path.push([tree, nodeKey]); // performance: update in place + return trackDown(tree[nodeKey], key.slice(nodeKey.length), path); + }; + var lookup = function (tree, key) { + if (key.length === 0 || tree == null) { + return tree; + } + var nodeKey = Object.keys(tree).find(function (k) { return k !== LEAF && key.startsWith(k); }); + if (nodeKey === undefined) { + return undefined; + } + return lookup(tree[nodeKey], key.slice(nodeKey.length)); + }; + var createPath = function (tree, key) { + var _a; + if (key.length === 0 || tree == null) { + return tree; + } + var nodeKey = Object.keys(tree).find(function (k) { return k !== LEAF && key.startsWith(k); }); + if (nodeKey === undefined) { + var toSplit = Object.keys(tree).find(function (k) { return k !== LEAF && k.startsWith(key[0]); }); + if (toSplit === undefined) { + tree[key] = {}; + } + else { + var prefix = commonPrefix(key, toSplit); + tree[prefix] = (_a = {}, _a[toSplit.slice(prefix.length)] = tree[toSplit], _a); + delete tree[toSplit]; + return createPath(tree[prefix], key.slice(prefix.length)); + } + return tree[key]; + } + return createPath(tree[nodeKey], key.slice(nodeKey.length)); + }; + var commonPrefix = function (a, b, i, length, prefix) { + if (i === void 0) { i = 0; } + if (length === void 0) { length = Math.min(a.length, b.length); } + if (prefix === void 0) { prefix = ''; } + if (i >= length) { + return prefix; + } + if (a[i] !== b[i]) { + return prefix; + } + return commonPrefix(a, b, i + 1, length, prefix + a[i]); + }; + var remove = function (tree, key) { + var _a = __read(trackDown(tree, key), 2), node = _a[0], path = _a[1]; + if (node === undefined) { + return; + } + delete node[LEAF]; + var keys = Object.keys(node); + if (keys.length === 0) { + cleanup(path); + } + if (keys.length === 1) { + merge(path, keys[0], node[keys[0]]); + } + }; + var cleanup = function (path) { + if (path.length === 0) { + return; + } + var _a = __read(last$1(path), 2), node = _a[0], key = _a[1]; + delete node[key]; + if (Object.keys(node).length === 0) { + cleanup(path.slice(0, -1)); + } + }; + var merge = function (path, key, value) { + if (path.length === 0) { + return; + } + var _a = __read(last$1(path), 2), node = _a[0], nodeKey = _a[1]; + node[nodeKey + key] = value; + delete node[nodeKey]; + }; + var last$1 = function (array) { + return array[array.length - 1]; + }; - /** - * Load a cache identified by the given Id. If the element does not exists, then initialize an empty - * cache storage. - * - * @method create - * @param docId {String} the id of the cache, would also be used as the name of the file cache - * @param [cacheDir] {String} directory for the cache entry - * @returns {cache} cache instance - */ - create: function ( docId, cacheDir ) { - var obj = Object.create( cache ); - obj.load( docId, cacheDir ); - return obj; - }, + var _a; + var OR = 'or'; + var AND = 'and'; + /** + * [[MiniSearch]] is the main entrypoint class, implementing a full-text search + * engine in memory. + * + * @typeParam T The type of the documents being indexed. + * + * ### Basic example: + * + * ```javascript + * const documents = [ + * { + * id: 1, + * title: 'Moby Dick', + * text: 'Call me Ishmael. Some years ago...', + * category: 'fiction' + * }, + * { + * id: 2, + * title: 'Zen and the Art of Motorcycle Maintenance', + * text: 'I can see by my watch...', + * category: 'fiction' + * }, + * { + * id: 3, + * title: 'Neuromancer', + * text: 'The sky above the port was...', + * category: 'fiction' + * }, + * { + * id: 4, + * title: 'Zen and the Art of Archery', + * text: 'At first sight it must seem...', + * category: 'non-fiction' + * }, + * // ...and more + * ] + * + * // Create a search engine that indexes the 'title' and 'text' fields for + * // full-text search. Search results will include 'title' and 'category' (plus the + * // id field, that is always stored and returned) + * const miniSearch = new MiniSearch({ + * fields: ['title', 'text'], + * storeFields: ['title', 'category'] + * }) + * + * // Add documents to the index + * miniSearch.addAll(documents) + * + * // Search for documents: + * let results = miniSearch.search('zen art motorcycle') + * // => [ + * // { id: 2, title: 'Zen and the Art of Motorcycle Maintenance', category: 'fiction', score: 2.77258 }, + * // { id: 4, title: 'Zen and the Art of Archery', category: 'non-fiction', score: 1.38629 } + * // ] + * ``` + */ + var MiniSearch = /** @class */ (function () { + /** + * @param options Configuration options + * + * ### Examples: + * + * ```javascript + * // Create a search engine that indexes the 'title' and 'text' fields of your + * // documents: + * const miniSearch = new MiniSearch({ fields: ['title', 'text'] }) + * ``` + * + * ### ID Field: + * + * ```javascript + * // Your documents are assumed to include a unique 'id' field, but if you want + * // to use a different field for document identification, you can set the + * // 'idField' option: + * const miniSearch = new MiniSearch({ idField: 'key', fields: ['title', 'text'] }) + * ``` + * + * ### Options and defaults: + * + * ```javascript + * // The full set of options (here with their default value) is: + * const miniSearch = new MiniSearch({ + * // idField: field that uniquely identifies a document + * idField: 'id', + * + * // extractField: function used to get the value of a field in a document. + * // By default, it assumes the document is a flat object with field names as + * // property keys and field values as string property values, but custom logic + * // can be implemented by setting this option to a custom extractor function. + * extractField: (document, fieldName) => document[fieldName], + * + * // tokenize: function used to split fields into individual terms. By + * // default, it is also used to tokenize search queries, unless a specific + * // `tokenize` search option is supplied. When tokenizing an indexed field, + * // the field name is passed as the second argument. + * tokenize: (string, _fieldName) => string.split(SPACE_OR_PUNCTUATION), + * + * // processTerm: function used to process each tokenized term before + * // indexing. It can be used for stemming and normalization. Return a falsy + * // value in order to discard a term. By default, it is also used to process + * // search queries, unless a specific `processTerm` option is supplied as a + * // search option. When processing a term from a indexed field, the field + * // name is passed as the second argument. + * processTerm: (term, _fieldName) => term.toLowerCase(), + * + * // searchOptions: default search options, see the `search` method for + * // details + * searchOptions: undefined, + * + * // fields: document fields to be indexed. Mandatory, but not set by default + * fields: undefined + * + * // storeFields: document fields to be stored and returned as part of the + * // search results. + * storeFields: [] + * }) + * ``` + */ + function MiniSearch(options) { + if ((options === null || options === void 0 ? void 0 : options.fields) == null) { + throw new Error('MiniSearch: option "fields" must be provided'); + } + this._options = __assign(__assign(__assign({}, defaultOptions), options), { searchOptions: __assign(__assign({}, defaultSearchOptions), (options.searchOptions || {})) }); + this._index = new SearchableMap(); + this._documentCount = 0; + this._documentIds = {}; + this._fieldIds = {}; + this._fieldLength = {}; + this._averageFieldLength = {}; + this._nextId = 0; + this._storedFields = {}; + this.addFields(this._options.fields); + } + /** + * Adds a document to the index + * + * @param document The document to be indexed + */ + MiniSearch.prototype.add = function (document) { + var _this = this; + var _a = this._options, extractField = _a.extractField, tokenize = _a.tokenize, processTerm = _a.processTerm, fields = _a.fields, idField = _a.idField; + var id = extractField(document, idField); + if (id == null) { + throw new Error("MiniSearch: document does not have ID field \"" + idField + "\""); + } + var shortDocumentId = this.addDocumentId(id); + this.saveStoredFields(shortDocumentId, document); + fields.forEach(function (field) { + var fieldValue = extractField(document, field); + if (fieldValue == null) { + return; + } + var tokens = tokenize(fieldValue.toString(), field); + _this.addFieldLength(shortDocumentId, _this._fieldIds[field], _this.documentCount - 1, tokens.length); + tokens.forEach(function (term) { + var processedTerm = processTerm(term, field); + if (processedTerm) { + _this.addTerm(_this._fieldIds[field], shortDocumentId, processedTerm); + } + }); + }); + }; + /** + * Adds all the given documents to the index + * + * @param documents An array of documents to be indexed + */ + MiniSearch.prototype.addAll = function (documents) { + var _this = this; + documents.forEach(function (document) { return _this.add(document); }); + }; + /** + * Adds all the given documents to the index asynchronously. + * + * Returns a promise that resolves (to `undefined`) when the indexing is done. + * This method is useful when index many documents, to avoid blocking the main + * thread. The indexing is performed asynchronously and in chunks. + * + * @param documents An array of documents to be indexed + * @param options Configuration options + * @return A promise resolving to `undefined` when the indexing is done + */ + MiniSearch.prototype.addAllAsync = function (documents, options) { + var _this = this; + if (options === void 0) { options = {}; } + var _a = options.chunkSize, chunkSize = _a === void 0 ? 10 : _a; + var acc = { chunk: [], promise: Promise.resolve() }; + var _b = documents.reduce(function (_a, document, i) { + var chunk = _a.chunk, promise = _a.promise; + chunk.push(document); + if ((i + 1) % chunkSize === 0) { + return { + chunk: [], + promise: promise + .then(function () { return new Promise(function (resolve) { return setTimeout(resolve, 0); }); }) + .then(function () { return _this.addAll(chunk); }) + }; + } + else { + return { chunk: chunk, promise: promise }; + } + }, acc), chunk = _b.chunk, promise = _b.promise; + return promise.then(function () { return _this.addAll(chunk); }); + }; + /** + * Removes the given document from the index. + * + * The document to delete must NOT have changed between indexing and deletion, + * otherwise the index will be corrupted. Therefore, when reindexing a document + * after a change, the correct order of operations is: + * + * 1. remove old version + * 2. apply changes + * 3. index new version + * + * @param document The document to be removed + */ + MiniSearch.prototype.remove = function (document) { + var _this = this; + var _a = this._options, tokenize = _a.tokenize, processTerm = _a.processTerm, extractField = _a.extractField, fields = _a.fields, idField = _a.idField; + var id = extractField(document, idField); + if (id == null) { + throw new Error("MiniSearch: document does not have ID field \"" + idField + "\""); + } + var _b = __read(Object.entries(this._documentIds) + .find(function (_a) { + var _b = __read(_a, 2), _ = _b[0], longId = _b[1]; + return id === longId; + }) || [], 1), shortDocumentId = _b[0]; + if (shortDocumentId == null) { + throw new Error("MiniSearch: cannot remove document with ID " + id + ": it is not in the index"); + } + fields.forEach(function (field) { + var fieldValue = extractField(document, field); + if (fieldValue == null) { + return; + } + var tokens = tokenize(fieldValue.toString(), field); + tokens.forEach(function (term) { + var processedTerm = processTerm(term, field); + if (processedTerm) { + _this.removeTerm(_this._fieldIds[field], shortDocumentId, processedTerm); + } + }); + }); + delete this._storedFields[shortDocumentId]; + delete this._documentIds[shortDocumentId]; + this._documentCount -= 1; + }; + /** + * Removes all the given documents from the index. If called with no arguments, + * it removes _all_ documents from the index. + * + * @param documents The documents to be removed. If this argument is omitted, + * all documents are removed. Note that, for removing all documents, it is + * more efficient to call this method with no arguments than to pass all + * documents. + */ + MiniSearch.prototype.removeAll = function (documents) { + var _this = this; + if (documents) { + documents.forEach(function (document) { return _this.remove(document); }); + } + else if (arguments.length > 0) { + throw new Error('Expected documents to be present. Omit the argument to remove all documents.'); + } + else { + this._index = new SearchableMap(); + this._documentCount = 0; + this._documentIds = {}; + this._fieldLength = {}; + this._averageFieldLength = {}; + this._storedFields = {}; + this._nextId = 0; + } + }; + /** + * Search for documents matching the given search query. + * + * The result is a list of scored document IDs matching the query, sorted by + * descending score, and each including data about which terms were matched and + * in which fields. + * + * ### Basic usage: + * + * ```javascript + * // Search for "zen art motorcycle" with default options: terms have to match + * // exactly, and individual terms are joined with OR + * miniSearch.search('zen art motorcycle') + * // => [ { id: 2, score: 2.77258, match: { ... } }, { id: 4, score: 1.38629, match: { ... } } ] + * ``` + * + * ### Restrict search to specific fields: + * + * ```javascript + * // Search only in the 'title' field + * miniSearch.search('zen', { fields: ['title'] }) + * ``` + * + * ### Field boosting: + * + * ```javascript + * // Boost a field + * miniSearch.search('zen', { boost: { title: 2 } }) + * ``` + * + * ### Prefix search: + * + * ```javascript + * // Search for "moto" with prefix search (it will match documents + * // containing terms that start with "moto" or "neuro") + * miniSearch.search('moto neuro', { prefix: true }) + * ``` + * + * ### Fuzzy search: + * + * ```javascript + * // Search for "ismael" with fuzzy search (it will match documents containing + * // terms similar to "ismael", with a maximum edit distance of 0.2 term.length + * // (rounded to nearest integer) + * miniSearch.search('ismael', { fuzzy: 0.2 }) + * ``` + * + * ### Combining strategies: + * + * ```javascript + * // Mix of exact match, prefix search, and fuzzy search + * miniSearch.search('ismael mob', { + * prefix: true, + * fuzzy: 0.2 + * }) + * ``` + * + * ### Advanced prefix and fuzzy search: + * + * ```javascript + * // Perform fuzzy and prefix search depending on the search term. Here + * // performing prefix and fuzzy search only on terms longer than 3 characters + * miniSearch.search('ismael mob', { + * prefix: term => term.length > 3 + * fuzzy: term => term.length > 3 ? 0.2 : null + * }) + * ``` + * + * ### Combine with AND: + * + * ```javascript + * // Combine search terms with AND (to match only documents that contain both + * // "motorcycle" and "art") + * miniSearch.search('motorcycle art', { combineWith: 'AND' }) + * ``` + * + * ### Filtering results: + * + * ```javascript + * // Filter only results in the 'fiction' category (assuming that 'category' + * // is a stored field) + * miniSearch.search('motorcycle art', { + * filter: (result) => result.category === 'fiction' + * }) + * ``` + * + * @param queryString Query string to search for + * @param options Search options. Each option, if not given, defaults to the corresponding value of `searchOptions` given to the constructor, or to the library default. + */ + MiniSearch.prototype.search = function (queryString, searchOptions) { + var _this = this; + if (searchOptions === void 0) { searchOptions = {}; } + var _a = this._options, tokenize = _a.tokenize, processTerm = _a.processTerm, globalSearchOptions = _a.searchOptions; + var options = __assign(__assign({ tokenize: tokenize, processTerm: processTerm }, globalSearchOptions), searchOptions); + var searchTokenize = options.tokenize, searchProcessTerm = options.processTerm; + var terms = searchTokenize(queryString) + .map(function (term) { return searchProcessTerm(term); }) + .filter(function (term) { return !!term; }); + var queries = terms.map(termToQuery(options)); + var results = queries.map(function (query) { return _this.executeQuery(query, options); }); + var combinedResults = this.combineResults(results, options.combineWith); + return Object.entries(combinedResults) + .reduce(function (results, _a) { + var _b = __read(_a, 2), docId = _b[0], _c = _b[1], score = _c.score, match = _c.match, terms = _c.terms; + var result = { + id: _this._documentIds[docId], + terms: uniq(terms), + score: score, + match: match + }; + Object.assign(result, _this._storedFields[docId]); + if (options.filter == null || options.filter(result)) { + results.push(result); + } + return results; + }, []) + .sort(function (_a, _b) { + var a = _a.score; + var b = _b.score; + return a < b ? 1 : -1; + }); + }; + /** + * Provide suggestions for the given search query + * + * The result is a list of suggested modified search queries, derived from the + * given search query, each with a relevance score, sorted by descending score. + * + * ### Basic usage: + * + * ```javascript + * // Get suggestions for 'neuro': + * miniSearch.autoSuggest('neuro') + * // => [ { suggestion: 'neuromancer', terms: [ 'neuromancer' ], score: 0.46240 } ] + * ``` + * + * ### Multiple words: + * + * ```javascript + * // Get suggestions for 'zen ar': + * miniSearch.autoSuggest('zen ar') + * // => [ + * // { suggestion: 'zen archery art', terms: [ 'zen', 'archery', 'art' ], score: 1.73332 }, + * // { suggestion: 'zen art', terms: [ 'zen', 'art' ], score: 1.21313 } + * // ] + * ``` + * + * ### Fuzzy suggestions: + * + * ```javascript + * // Correct spelling mistakes using fuzzy search: + * miniSearch.autoSuggest('neromancer', { fuzzy: 0.2 }) + * // => [ { suggestion: 'neuromancer', terms: [ 'neuromancer' ], score: 1.03998 } ] + * ``` + * + * ### Filtering: + * + * ```javascript + * // Get suggestions for 'zen ar', but only within the 'fiction' category + * // (assuming that 'category' is a stored field): + * miniSearch.autoSuggest('zen ar', { + * filter: (result) => result.category === 'fiction' + * }) + * // => [ + * // { suggestion: 'zen archery art', terms: [ 'zen', 'archery', 'art' ], score: 1.73332 }, + * // { suggestion: 'zen art', terms: [ 'zen', 'art' ], score: 1.21313 } + * // ] + * ``` + * + * @param queryString Query string to be expanded into suggestions + * @param options Search options. The supported options and default values + * are the same as for the `search` method, except that by default prefix + * search is performed on the last term in the query. + * @return A sorted array of suggestions sorted by relevance score. + */ + MiniSearch.prototype.autoSuggest = function (queryString, options) { + if (options === void 0) { options = {}; } + options = __assign(__assign({}, defaultAutoSuggestOptions), options); + var suggestions = this.search(queryString, options).reduce(function (suggestions, _a) { + var score = _a.score, terms = _a.terms; + var phrase = terms.join(' '); + if (suggestions[phrase] == null) { + suggestions[phrase] = { score: score, terms: terms, count: 1 }; + } + else { + suggestions[phrase].score += score; + suggestions[phrase].count += 1; + } + return suggestions; + }, {}); + return Object.entries(suggestions) + .map(function (_a) { + var _b = __read(_a, 2), suggestion = _b[0], _c = _b[1], score = _c.score, terms = _c.terms, count = _c.count; + return ({ suggestion: suggestion, terms: terms, score: score / count }); + }) + .sort(function (_a, _b) { + var a = _a.score; + var b = _b.score; + return a < b ? 1 : -1; + }); + }; + Object.defineProperty(MiniSearch.prototype, "documentCount", { + /** + * Number of documents in the index + */ + get: function () { + return this._documentCount; + }, + enumerable: false, + configurable: true + }); + /** + * Deserializes a JSON index (serialized with `miniSearch.toJSON()`) and + * instantiates a MiniSearch instance. It should be given the same options + * originally used when serializing the index. + * + * ### Usage: + * + * ```javascript + * // If the index was serialized with: + * let miniSearch = new MiniSearch({ fields: ['title', 'text'] }) + * miniSearch.addAll(documents) + * + * const json = JSON.stringify(miniSearch) + * // It can later be deserialized like this: + * miniSearch = MiniSearch.loadJSON(json, { fields: ['title', 'text'] }) + * ``` + * + * @param json JSON-serialized index + * @param options configuration options, same as the constructor + * @return An instance of MiniSearch deserialized from the given JSON. + */ + MiniSearch.loadJSON = function (json, options) { + if (options == null) { + throw new Error('MiniSearch: loadJSON should be given the same options used when serializing the index'); + } + return MiniSearch.loadJS(JSON.parse(json), options); + }; + /** + * Returns the default value of an option. It will throw an error if no option + * with the given name exists. + * + * @param optionName Name of the option + * @return The default value of the given option + * + * ### Usage: + * + * ```javascript + * // Get default tokenizer + * MiniSearch.getDefault('tokenize') + * + * // Get default term processor + * MiniSearch.getDefault('processTerm') + * + * // Unknown options will throw an error + * MiniSearch.getDefault('notExisting') + * // => throws 'MiniSearch: unknown option "notExisting"' + * ``` + */ + MiniSearch.getDefault = function (optionName) { + if (defaultOptions.hasOwnProperty(optionName)) { + return getOwnProperty(defaultOptions, optionName); + } + else { + throw new Error("MiniSearch: unknown option \"" + optionName + "\""); + } + }; + /** + * @ignore + */ + MiniSearch.loadJS = function (js, options) { + var index = js.index, documentCount = js.documentCount, nextId = js.nextId, documentIds = js.documentIds, fieldIds = js.fieldIds, fieldLength = js.fieldLength, averageFieldLength = js.averageFieldLength, storedFields = js.storedFields; + var miniSearch = new MiniSearch(options); + miniSearch._index = new SearchableMap(index._tree, index._prefix); + miniSearch._documentCount = documentCount; + miniSearch._nextId = nextId; + miniSearch._documentIds = documentIds; + miniSearch._fieldIds = fieldIds; + miniSearch._fieldLength = fieldLength; + miniSearch._averageFieldLength = averageFieldLength; + miniSearch._fieldIds = fieldIds; + miniSearch._storedFields = storedFields || {}; + return miniSearch; + }; + /** + * @ignore + */ + MiniSearch.prototype.executeQuery = function (query, searchOptions) { + var _this = this; + var options = __assign(__assign({}, this._options.searchOptions), searchOptions); + var boosts = (options.fields || this._options.fields).reduce(function (boosts, field) { + var _a; + return (__assign(__assign({}, boosts), (_a = {}, _a[field] = getOwnProperty(boosts, field) || 1, _a))); + }, options.boost || {}); + var boostDocument = options.boostDocument, weights = options.weights; + var _a = __assign(__assign({}, defaultSearchOptions.weights), weights), fuzzyWeight = _a.fuzzy, prefixWeight = _a.prefix; + var exactMatch = this.termResults(query.term, boosts, boostDocument, this._index.get(query.term)); + if (!query.fuzzy && !query.prefix) { + return exactMatch; + } + var results = [exactMatch]; + if (query.prefix) { + this._index.atPrefix(query.term).forEach(function (term, data) { + var weightedDistance = (0.3 * (term.length - query.term.length)) / term.length; + results.push(_this.termResults(term, boosts, boostDocument, data, prefixWeight, weightedDistance)); + }); + } + if (query.fuzzy) { + var fuzzy = (query.fuzzy === true) ? 0.2 : query.fuzzy; + var maxDistance = fuzzy < 1 ? Math.round(query.term.length * fuzzy) : fuzzy; + Object.entries(this._index.fuzzyGet(query.term, maxDistance)).forEach(function (_a) { + var _b = __read(_a, 2), term = _b[0], _c = __read(_b[1], 2), data = _c[0], distance = _c[1]; + var weightedDistance = distance / term.length; + results.push(_this.termResults(term, boosts, boostDocument, data, fuzzyWeight, weightedDistance)); + }); + } + return results.reduce(combinators[OR], {}); + }; + /** + * @ignore + */ + MiniSearch.prototype.combineResults = function (results, combineWith) { + if (combineWith === void 0) { combineWith = OR; } + if (results.length === 0) { + return {}; + } + var operator = combineWith.toLowerCase(); + return results.reduce(combinators[operator], null) || {}; + }; + /** + * Allows serialization of the index to JSON, to possibly store it and later + * deserialize it with `MiniSearch.loadJSON`. + * + * Normally one does not directly call this method, but rather call the + * standard JavaScript `JSON.stringify()` passing the `MiniSearch` instance, + * and JavaScript will internally call this method. Upon deserialization, one + * must pass to `loadJSON` the same options used to create the original + * instance that was serialized. + * + * ### Usage: + * + * ```javascript + * // Serialize the index: + * let miniSearch = new MiniSearch({ fields: ['title', 'text'] }) + * miniSearch.addAll(documents) + * const json = JSON.stringify(miniSearch) + * + * // Later, to deserialize it: + * miniSearch = MiniSearch.loadJSON(json, { fields: ['title', 'text'] }) + * ``` + * + * @return A plain-object serializeable representation of the search index. + */ + MiniSearch.prototype.toJSON = function () { + return { + index: this._index, + documentCount: this._documentCount, + nextId: this._nextId, + documentIds: this._documentIds, + fieldIds: this._fieldIds, + fieldLength: this._fieldLength, + averageFieldLength: this._averageFieldLength, + storedFields: this._storedFields + }; + }; + /** + * @ignore + */ + MiniSearch.prototype.termResults = function (term, boosts, boostDocument, indexData, weight, editDistance) { + var _this = this; + if (editDistance === void 0) { editDistance = 0; } + if (indexData == null) { + return {}; + } + return Object.entries(boosts).reduce(function (results, _a) { + var _b = __read(_a, 2), field = _b[0], boost = _b[1]; + var fieldId = _this._fieldIds[field]; + var _c = indexData[fieldId] || { ds: {} }, df = _c.df, ds = _c.ds; + Object.entries(ds).forEach(function (_a) { + var _b = __read(_a, 2), documentId = _b[0], tf = _b[1]; + var docBoost = boostDocument ? boostDocument(_this._documentIds[documentId], term) : 1; + if (!docBoost) { + return; + } + var normalizedLength = _this._fieldLength[documentId][fieldId] / _this._averageFieldLength[fieldId]; + results[documentId] = results[documentId] || { score: 0, match: {}, terms: [] }; + results[documentId].terms.push(term); + results[documentId].match[term] = getOwnProperty(results[documentId].match, term) || []; + results[documentId].score += docBoost * score(tf, df, _this._documentCount, normalizedLength, boost, editDistance); + results[documentId].match[term].push(field); + }); + return results; + }, {}); + }; + /** + * @ignore + */ + MiniSearch.prototype.addTerm = function (fieldId, documentId, term) { + this._index.update(term, function (indexData) { + var _a; + indexData = indexData || {}; + var fieldIndex = indexData[fieldId] || { df: 0, ds: {} }; + if (fieldIndex.ds[documentId] == null) { + fieldIndex.df += 1; + } + fieldIndex.ds[documentId] = (fieldIndex.ds[documentId] || 0) + 1; + return __assign(__assign({}, indexData), (_a = {}, _a[fieldId] = fieldIndex, _a)); + }); + }; + /** + * @ignore + */ + MiniSearch.prototype.removeTerm = function (fieldId, documentId, term) { + var _this = this; + if (!this._index.has(term)) { + this.warnDocumentChanged(documentId, fieldId, term); + return; + } + this._index.update(term, function (indexData) { + var _a; + var fieldIndex = indexData[fieldId]; + if (fieldIndex == null || fieldIndex.ds[documentId] == null) { + _this.warnDocumentChanged(documentId, fieldId, term); + return indexData; + } + if (fieldIndex.ds[documentId] <= 1) { + if (fieldIndex.df <= 1) { + delete indexData[fieldId]; + return indexData; + } + fieldIndex.df -= 1; + } + if (fieldIndex.ds[documentId] <= 1) { + delete fieldIndex.ds[documentId]; + return indexData; + } + fieldIndex.ds[documentId] -= 1; + return __assign(__assign({}, indexData), (_a = {}, _a[fieldId] = fieldIndex, _a)); + }); + if (Object.keys(this._index.get(term)).length === 0) { + this._index.delete(term); + } + }; + /** + * @ignore + */ + MiniSearch.prototype.warnDocumentChanged = function (shortDocumentId, fieldId, term) { + if (console == null || console.warn == null) { + return; + } + var fieldName = Object.entries(this._fieldIds).find(function (_a) { + var _b = __read(_a, 2), name = _b[0], id = _b[1]; + return id === fieldId; + })[0]; + console.warn("MiniSearch: document with ID " + this._documentIds[shortDocumentId] + " has changed before removal: term \"" + term + "\" was not present in field \"" + fieldName + "\". Removing a document after it has changed can corrupt the index!"); + }; + /** + * @ignore + */ + MiniSearch.prototype.addDocumentId = function (documentId) { + var shortDocumentId = this._nextId.toString(36); + this._documentIds[shortDocumentId] = documentId; + this._documentCount += 1; + this._nextId += 1; + return shortDocumentId; + }; + /** + * @ignore + */ + MiniSearch.prototype.addFields = function (fields) { + var _this = this; + fields.forEach(function (field, i) { _this._fieldIds[field] = i; }); + }; + /** + * @ignore + */ + MiniSearch.prototype.addFieldLength = function (documentId, fieldId, count, length) { + this._averageFieldLength[fieldId] = this._averageFieldLength[fieldId] || 0; + var totalLength = (this._averageFieldLength[fieldId] * count) + length; + this._fieldLength[documentId] = this._fieldLength[documentId] || {}; + this._fieldLength[documentId][fieldId] = length; + this._averageFieldLength[fieldId] = totalLength / (count + 1); + }; + /** + * @ignore + */ + MiniSearch.prototype.saveStoredFields = function (documentId, doc) { + var _this = this; + var _a = this._options, storeFields = _a.storeFields, extractField = _a.extractField; + if (storeFields == null || storeFields.length === 0) { + return; + } + this._storedFields[documentId] = this._storedFields[documentId] || {}; + storeFields.forEach(function (fieldName) { + var fieldValue = extractField(doc, fieldName); + if (fieldValue === undefined) { + return; + } + _this._storedFields[documentId][fieldName] = fieldValue; + }); + }; + return MiniSearch; + }()); + var getOwnProperty = function (object, property) { + return Object.prototype.hasOwnProperty.call(object, property) ? object[property] : undefined; + }; + var combinators = (_a = {}, + _a[OR] = function (a, b) { + return Object.entries(b).reduce(function (combined, _a) { + var _b; + var _c = __read(_a, 2), documentId = _c[0], _d = _c[1], score = _d.score, match = _d.match, terms = _d.terms; + if (combined[documentId] == null) { + combined[documentId] = { score: score, match: match, terms: terms }; + } + else { + combined[documentId].score += score; + combined[documentId].score *= 1.5; + (_b = combined[documentId].terms).push.apply(_b, __spread(terms)); + Object.assign(combined[documentId].match, match); + } + return combined; + }, a || {}); + }, + _a[AND] = function (a, b) { + if (a == null) { + return b; + } + return Object.entries(b).reduce(function (combined, _a) { + var _b = __read(_a, 2), documentId = _b[0], _c = _b[1], score = _c.score, match = _c.match, terms = _c.terms; + if (a[documentId] === undefined) { + return combined; + } + combined[documentId] = combined[documentId] || {}; + combined[documentId].score = a[documentId].score + score; + combined[documentId].match = __assign(__assign({}, a[documentId].match), match); + combined[documentId].terms = __spread(a[documentId].terms, terms); + return combined; + }, {}); + }, + _a); + var tfIdf = function (tf, df, n) { return tf * Math.log(n / df); }; + var score = function (termFrequency, documentFrequency, documentCount, normalizedLength, boost, editDistance) { + var weight = boost / (1 + (0.333 * boost * editDistance)); + return weight * tfIdf(termFrequency, documentFrequency, documentCount) / normalizedLength; + }; + var termToQuery = function (options) { return function (term, i, terms) { + var fuzzy = (typeof options.fuzzy === 'function') + ? options.fuzzy(term, i, terms) + : (options.fuzzy || false); + var prefix = (typeof options.prefix === 'function') + ? options.prefix(term, i, terms) + : (options.prefix === true); + return { term: term, fuzzy: fuzzy, prefix: prefix }; + }; }; + var uniq = function (array) { + return array.filter(function (element, i, array) { return array.indexOf(element) === i; }); + }; + var defaultOptions = { + idField: 'id', + extractField: function (document, fieldName) { return document[fieldName]; }, + tokenize: function (text, fieldName) { return text.split(SPACE_OR_PUNCTUATION); }, + processTerm: function (term, fieldName) { return term.toLowerCase(); }, + fields: undefined, + searchOptions: undefined, + storeFields: [] + }; + var defaultSearchOptions = { + combineWith: OR, + prefix: false, + fuzzy: false, + boost: {}, + weights: { fuzzy: 0.9, prefix: 0.75 } + }; + var defaultAutoSuggestOptions = { + prefix: function (term, i, terms) { + return i === terms.length - 1; + } + }; + // This regular expression matches any Unicode space or punctuation character + // Adapted from https://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5Cp%7BZ%7D%5Cp%7BP%7D&abb=on&c=on&esc=on + var SPACE_OR_PUNCTUATION = /[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u; - createFromFile: function ( filePath ) { - var obj = Object.create( cache ); - obj.loadFile( filePath ); - return obj; - }, - /** - * Clear the cache identified by the given id. Caches stored in a different cache directory can be deleted directly - * - * @method clearCache - * @param docId {String} the id of the cache, would also be used as the name of the file cache - * @param cacheDir {String} the directory where the cache file was written - * @returns {Boolean} true if the cache folder was deleted. False otherwise - */ - clearCacheById: function ( docId, cacheDir ) { - var filePath = cacheDir ? path.resolve( cacheDir, docId ) : path.resolve( __dirname, './.cache/', docId ); - return del( filePath ); - }, - /** - * Remove all cache stored in the cache directory - * @method clearAll - * @returns {Boolean} true if the cache folder was deleted. False otherwise - */ - clearAll: function ( cacheDir ) { - var filePath = cacheDir ? path.resolve( cacheDir ) : path.resolve( __dirname, './.cache/' ); - return del( filePath ); - } -}; + return MiniSearch; + +}))); +//# sourceMappingURL=index.js.map /***/ }), -/***/ 927: -/***/ (function(module) { +/***/ 6186: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var Flatted = (function (Primitive, primitive) { +var path = __nccwpck_require__(5622); +var fs = __nccwpck_require__(5747); +var _0777 = parseInt('0777', 8); - /*! - * ISC License - * - * Copyright (c) 2018, Andrea Giammarchi, @WebReflection - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - var Flatted = { +function mkdirP (p, opts, f, made) { + if (typeof opts === 'function') { + f = opts; + opts = {}; + } + else if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = _0777 + } + if (!made) made = null; + + var cb = f || function () {}; + p = path.resolve(p); + + xfs.mkdir(p, mode, function (er) { + if (!er) { + made = made || p; + return cb(null, made); + } + switch (er.code) { + case 'ENOENT': + if (path.dirname(p) === p) return cb(er); + mkdirP(path.dirname(p), opts, function (er, made) { + if (er) cb(er, made); + else mkdirP(p, opts, cb, made); + }); + break; - parse: function parse(text, reviver) { - var input = JSON.parse(text, Primitives).map(primitives); - var value = input[0]; - var $ = reviver || noop; - var tmp = typeof value === 'object' && value ? - revive(input, new Set, value, $) : - value; - return $.call({'': tmp}, '', tmp); - }, + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, function (er2, stat) { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) cb(er, made) + else cb(null, made); + }); + break; + } + }); +} - stringify: function stringify(value, replacer, space) { - for (var - firstRun, - known = new Map, - input = [], - output = [], - $ = replacer && typeof replacer === typeof input ? - function (k, v) { - if (k === '' || -1 < replacer.indexOf(k)) return v; - } : - (replacer || noop), - i = +set(known, input, $.call({'': value}, '', value)), - replace = function (key, value) { - if (firstRun) { - firstRun = !firstRun; - return value; - } - var after = $.call(this, key, value); - switch (typeof after) { - case 'object': - if (after === null) return after; - case primitive: - return known.get(after) || set(known, input, after); - } - return after; - }; - i < input.length; i++ - ) { - firstRun = true; - output[i] = JSON.stringify(input[i], replace, space); - } - return '[' + output.join(',') + ']'; +mkdirP.sync = function sync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = _0777 } + if (!made) made = null; - }; + p = path.resolve(p); - return Flatted; + try { + xfs.mkdirSync(p, mode); + made = made || p; + } + catch (err0) { + switch (err0.code) { + case 'ENOENT' : + made = sync(path.dirname(p), opts, made); + sync(p, opts, made); + break; - function noop(key, value) { - return value; - } + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + var stat; + try { + stat = xfs.statSync(p); + } + catch (err1) { + throw err0; + } + if (!stat.isDirectory()) throw err0; + break; + } + } - function revive(input, parsed, output, $) { - return Object.keys(output).reduce( - function (output, key) { - var value = output[key]; - if (value instanceof Primitive) { - var tmp = input[value]; - if (typeof tmp === 'object' && !parsed.has(tmp)) { - parsed.add(tmp); - output[key] = $.call(output, key, revive(input, parsed, tmp, $)); - } else { - output[key] = $.call(output, key, tmp); - } - } else - output[key] = $.call(output, key, value); - return output; - }, - output - ); - } + return made; +}; - function set(known, input, value) { - var index = Primitive(input.push(value) - 1); - known.set(value, index); - return index; - } - // the two kinds of primitives - // 1. the real one - // 2. the wrapped one +/***/ }), - function primitives(value) { - return value instanceof Primitive ? Primitive(value) : value; - } +/***/ 1223: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - function Primitives(key, value) { - return typeof value === primitive ? new Primitive(value) : value; +var wrappy = __nccwpck_require__(2940) +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) } + f.called = false + return f +} -}(String, 'string')); -module.exports = Flatted; +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} /***/ }), -/***/ 928: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 8714: +/***/ ((module) => { "use strict"; -var utils = __webpack_require__(397); - -module.exports = ( - utils.isStandardBrowserEnv() ? - - // Standard browser envs support document.cookie - (function standardBrowserEnv() { - return { - write: function write(name, value, expires, path, domain, secure) { - var cookie = []; - cookie.push(name + '=' + encodeURIComponent(value)); - - if (utils.isNumber(expires)) { - cookie.push('expires=' + new Date(expires).toGMTString()); - } +function posix(path) { + return path.charAt(0) === '/'; +} - if (utils.isString(path)) { - cookie.push('path=' + path); - } +function win32(path) { + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = Boolean(device && device.charAt(1) !== ':'); - if (utils.isString(domain)) { - cookie.push('domain=' + domain); - } + // UNC paths are always absolute + return Boolean(result[2] || isUnc); +} - if (secure === true) { - cookie.push('secure'); - } +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; - document.cookie = cookie.join('; '); - }, - read: function read(name) { - var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); - return (match ? decodeURIComponent(match[3]) : null); - }, +/***/ }), - remove: function remove(name) { - this.write(name, '', Date.now() - 86400000); - } - }; - })() : +/***/ 4959: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - // Non standard browser env (web workers, react-native) lack needed support. - (function nonStandardBrowserEnv() { - return { - write: function write() {}, - read: function read() { return null; }, - remove: function remove() {} - }; - })() -); +module.exports = rimraf +rimraf.sync = rimrafSync +var assert = __nccwpck_require__(2357) +var path = __nccwpck_require__(5622) +var fs = __nccwpck_require__(5747) +var glob = __nccwpck_require__(1957) +var _0666 = parseInt('666', 8) -/***/ }), +var defaultGlobOpts = { + nosort: true, + silent: true +} -/***/ 935: -/***/ (function(module, __unusedexports, __webpack_require__) { +// for EMFILE handling +var timeout = 0 -const conversions = __webpack_require__(104); +var isWindows = (process.platform === "win32") -/* - This function routes a model to all other models. +function defaults (options) { + var methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(function(m) { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) - all functions that are routed have a property `.conversion` attached - to the returned synthetic function. This property is an array - of strings, each with the steps in between the 'from' and 'to' - color models (inclusive). + options.maxBusyTries = options.maxBusyTries || 3 + options.emfileWait = options.emfileWait || 1000 + if (options.glob === false) { + options.disableGlob = true + } + options.disableGlob = options.disableGlob || false + options.glob = options.glob || defaultGlobOpts +} - conversions that are not possible simply are not included. -*/ +function rimraf (p, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } -function buildGraph() { - const graph = {}; - // https://jsperf.com/object-keys-vs-for-in-with-closure/3 - const models = Object.keys(conversions); + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert.equal(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.equal(typeof options, 'object', 'rimraf: options should be object') - for (let len = models.length, i = 0; i < len; i++) { - graph[models[i]] = { - // http://jsperf.com/1-vs-infinity - // micro-opt, but this is simple. - distance: -1, - parent: null - }; - } + defaults(options) - return graph; -} + var busyTries = 0 + var errState = null + var n = 0 -// https://en.wikipedia.org/wiki/Breadth-first_search -function deriveBFS(fromModel) { - const graph = buildGraph(); - const queue = [fromModel]; // Unshift -> queue -> pop + if (options.disableGlob || !glob.hasMagic(p)) + return afterGlob(null, [p]) - graph[fromModel].distance = 0; + options.lstat(p, function (er, stat) { + if (!er) + return afterGlob(null, [p]) - while (queue.length) { - const current = queue.pop(); - const adjacents = Object.keys(conversions[current]); + glob(p, options.glob, afterGlob) + }) - for (let len = adjacents.length, i = 0; i < len; i++) { - const adjacent = adjacents[i]; - const node = graph[adjacent]; + function next (er) { + errState = errState || er + if (--n === 0) + cb(errState) + } - if (node.distance === -1) { - node.distance = graph[current].distance + 1; - node.parent = current; - queue.unshift(adjacent); - } - } - } + function afterGlob (er, results) { + if (er) + return cb(er) - return graph; -} + n = results.length + if (n === 0) + return cb() -function link(from, to) { - return function (args) { - return to(from(args)); - }; -} + results.forEach(function (p) { + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && + busyTries < options.maxBusyTries) { + busyTries ++ + var time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(function () { + rimraf_(p, options, CB) + }, time) + } -function wrapConversion(toModel, graph) { - const path = [graph[toModel].parent, toModel]; - let fn = conversions[graph[toModel].parent][toModel]; + // this one won't happen if graceful-fs is used. + if (er.code === "EMFILE" && timeout < options.emfileWait) { + return setTimeout(function () { + rimraf_(p, options, CB) + }, timeout ++) + } - let cur = graph[toModel].parent; - while (graph[cur].parent) { - path.unshift(graph[cur].parent); - fn = link(conversions[graph[cur].parent][cur], fn); - cur = graph[cur].parent; - } + // already gone + if (er.code === "ENOENT") er = null + } - fn.conversion = path; - return fn; + timeout = 0 + next(er) + }) + }) + } } -module.exports = function (fromModel) { - const graph = deriveBFS(fromModel); - const conversion = {}; +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') - const models = Object.keys(graph); - for (let len = models.length, i = 0; i < len; i++) { - const toModel = models[i]; - const node = graph[toModel]; + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, function (er, st) { + if (er && er.code === "ENOENT") + return cb(null) - if (node.parent === null) { - // No possible conversion, or this node is the source model. - continue; - } + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === "EPERM" && isWindows) + fixWinEPERM(p, options, er, cb) - conversion[toModel] = wrapConversion(toModel, graph); - } + if (st && st.isDirectory()) + return rmdir(p, options, er, cb) - return conversion; -}; + options.unlink(p, function (er) { + if (er) { + if (er.code === "ENOENT") + return cb(null) + if (er.code === "EPERM") + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + if (er.code === "EISDIR") + return rmdir(p, options, er, cb) + } + return cb(er) + }) + }) +} +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + if (er) + assert(er instanceof Error) + options.chmod(p, _0666, function (er2) { + if (er2) + cb(er2.code === "ENOENT" ? null : er) + else + options.stat(p, function(er3, stats) { + if (er3) + cb(er3.code === "ENOENT" ? null : er) + else if (stats.isDirectory()) + rmdir(p, options, er, cb) + else + options.unlink(p, cb) + }) + }) +} -/***/ }), +function fixWinEPERMSync (p, options, er) { + assert(p) + assert(options) + if (er) + assert(er instanceof Error) -/***/ 946: -/***/ (function(module, __unusedexports, __webpack_require__) { + try { + options.chmodSync(p, _0666) + } catch (er2) { + if (er2.code === "ENOENT") + return + else + throw er + } -"use strict"; + try { + var stats = options.statSync(p) + } catch (er3) { + if (er3.code === "ENOENT") + return + else + throw er + } + if (stats.isDirectory()) + rmdirSync(p, options, er) + else + options.unlinkSync(p) +} -var utils = __webpack_require__(397); +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + if (originalEr) + assert(originalEr instanceof Error) + assert(typeof cb === 'function') -function encode(val) { - return encodeURIComponent(val). - replace(/%3A/gi, ':'). - replace(/%24/g, '$'). - replace(/%2C/gi, ','). - replace(/%20/g, '+'). - replace(/%5B/gi, '['). - replace(/%5D/gi, ']'); + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, function (er) { + if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) + rmkids(p, options, cb) + else if (er && er.code === "ENOTDIR") + cb(originalEr) + else + cb(er) + }) } -/** - * Build a URL by appending params to the end - * - * @param {string} url The base of the url (e.g., http://www.google.com) - * @param {object} [params] The params to be appended - * @returns {string} The formatted url - */ -module.exports = function buildURL(url, params, paramsSerializer) { - /*eslint no-param-reassign:0*/ - if (!params) { - return url; - } +function rmkids(p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') - var serializedParams; - if (paramsSerializer) { - serializedParams = paramsSerializer(params); - } else if (utils.isURLSearchParams(params)) { - serializedParams = params.toString(); - } else { - var parts = []; + options.readdir(p, function (er, files) { + if (er) + return cb(er) + var n = files.length + if (n === 0) + return options.rmdir(p, cb) + var errState + files.forEach(function (f) { + rimraf(path.join(p, f), options, function (er) { + if (errState) + return + if (er) + return cb(errState = er) + if (--n === 0) + options.rmdir(p, cb) + }) + }) + }) +} - utils.forEach(params, function serialize(val, key) { - if (val === null || typeof val === 'undefined') { - return; - } +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + options = options || {} + defaults(options) - if (utils.isArray(val)) { - key = key + '[]'; - } else { - val = [val]; - } + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.equal(typeof options, 'object', 'rimraf: options should be object') - utils.forEach(val, function parseValue(v) { - if (utils.isDate(v)) { - v = v.toISOString(); - } else if (utils.isObject(v)) { - v = JSON.stringify(v); - } - parts.push(encode(key) + '=' + encode(v)); - }); - }); + var results - serializedParams = parts.join('&'); + if (options.disableGlob || !glob.hasMagic(p)) { + results = [p] + } else { + try { + options.lstatSync(p) + results = [p] + } catch (er) { + results = glob.sync(p, options.glob) + } } - if (serializedParams) { - var hashmarkIndex = url.indexOf('#'); - if (hashmarkIndex !== -1) { - url = url.slice(0, hashmarkIndex); - } + if (!results.length) + return - url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; - } + for (var i = 0; i < results.length; i++) { + var p = results[i] - return url; -}; + try { + var st = options.lstatSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + // Windows can EPERM on stat. Life is suffering. + if (er.code === "EPERM" && isWindows) + fixWinEPERMSync(p, options, er) + } -/***/ }), + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) + rmdirSync(p, options, null) + else + options.unlinkSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "EPERM") + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + if (er.code !== "EISDIR") + throw er -/***/ 976: -/***/ (function(module) { + rmdirSync(p, options, er) + } + } +} -const flagSymbol = Symbol('arg flag'); +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + if (originalEr) + assert(originalEr instanceof Error) -function arg(opts, {argv = process.argv.slice(2), permissive = false, stopAtPositional = false} = {}) { - if (!opts) { - throw new Error('Argument specification object is required'); - } + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "ENOTDIR") + throw originalEr + if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") + rmkidsSync(p, options) + } +} - const result = {_: []}; +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(function (f) { + rimrafSync(path.join(p, f), options) + }) - const aliases = {}; - const handlers = {}; + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + var retries = isWindows ? 100 : 1 + var i = 0 + do { + var threw = true + try { + var ret = options.rmdirSync(p, options) + threw = false + return ret + } finally { + if (++i < retries && threw) + continue + } + } while (true) +} - for (const key of Object.keys(opts)) { - if (!key) { - throw new TypeError('Argument key cannot be an empty string'); - } - if (key[0] !== '-') { - throw new TypeError(`Argument key must start with '-' but found: '${key}'`); - } +/***/ }), - if (key.length === 1) { - throw new TypeError(`Argument key must have a name; singular '-' keys are not allowed: ${key}`); - } +/***/ 9318: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - if (typeof opts[key] === 'string') { - aliases[key] = opts[key]; - continue; - } +"use strict"; - let type = opts[key]; - let isFlag = false; +const os = __nccwpck_require__(2087); +const tty = __nccwpck_require__(3867); +const hasFlag = __nccwpck_require__(1621); - if (Array.isArray(type) && type.length === 1 && typeof type[0] === 'function') { - const [fn] = type; - type = (value, name, prev = []) => { - prev.push(fn(value, name, prev[prev.length - 1])); - return prev; - }; - isFlag = fn === Boolean || fn[flagSymbol] === true; - } else if (typeof type === 'function') { - isFlag = type === Boolean || type[flagSymbol] === true; - } else { - throw new TypeError(`Type missing or not a function or valid array type: ${key}`); - } +const {env} = process; - if (key[1] !== '-' && key.length > 2) { - throw new TypeError(`Short argument keys (with a single hyphen) must have only one character: ${key}`); - } +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false') || + hasFlag('color=never')) { + forceColor = 0; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = 1; +} - handlers[key] = [type, isFlag]; +if ('FORCE_COLOR' in env) { + if (env.FORCE_COLOR === 'true') { + forceColor = 1; + } else if (env.FORCE_COLOR === 'false') { + forceColor = 0; + } else { + forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); } +} - for (let i = 0, len = argv.length; i < len; i++) { - const wholeArg = argv[i]; - - if (stopAtPositional && result._.length > 0) { - result._ = result._.concat(argv.slice(i)); - break; - } - - if (wholeArg === '--') { - result._ = result._.concat(argv.slice(i + 1)); - break; - } - - if (wholeArg.length > 1 && wholeArg[0] === '-') { - /* eslint-disable operator-linebreak */ - const separatedArguments = (wholeArg[1] === '-' || wholeArg.length === 2) - ? [wholeArg] - : wholeArg.slice(1).split('').map(a => `-${a}`); - /* eslint-enable operator-linebreak */ +function translateLevel(level) { + if (level === 0) { + return false; + } - for (let j = 0; j < separatedArguments.length; j++) { - const arg = separatedArguments[j]; - const [originalArgName, argStr] = arg[1] === '-' ? arg.split(/=(.*)/, 2) : [arg, undefined]; + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} - let argName = originalArgName; - while (argName in aliases) { - argName = aliases[argName]; - } +function supportsColor(haveStream, streamIsTTY) { + if (forceColor === 0) { + return 0; + } - if (!(argName in handlers)) { - if (permissive) { - result._.push(arg); - continue; - } else { - const err = new Error(`Unknown or unexpected option: ${originalArgName}`); - err.code = 'ARG_UNKNOWN_OPTION'; - throw err; - } - } + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } - const [type, isFlag] = handlers[argName]; + if (hasFlag('color=256')) { + return 2; + } - if (!isFlag && ((j + 1) < separatedArguments.length)) { - throw new TypeError(`Option requires argument (but was followed by another short argument): ${originalArgName}`); - } + if (haveStream && !streamIsTTY && forceColor === undefined) { + return 0; + } - if (isFlag) { - result[argName] = type(true, argName, result[argName]); - } else if (argStr === undefined) { - if ( - argv.length < i + 2 || - ( - argv[i + 1].length > 1 && - (argv[i + 1][0] === '-') && - !( - argv[i + 1].match(/^-?\d*(\.(?=\d))?\d*$/) && - ( - type === Number || - // eslint-disable-next-line no-undef - (typeof BigInt !== 'undefined' && type === BigInt) - ) - ) - ) - ) { - const extended = originalArgName === argName ? '' : ` (alias for ${argName})`; - throw new Error(`Option requires argument: ${originalArgName}${extended}`); - } + const min = forceColor || 0; - result[argName] = type(argv[i + 1], argName, result[argName]); - ++i; - } else { - result[argName] = type(argStr, argName, result[argName]); - } - } - } else { - result._.push(wholeArg); - } + if (env.TERM === 'dumb') { + return min; } - return result; -} + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } -arg.flag = fn => { - fn[flagSymbol] = true; - return fn; -}; + return 1; + } -// Utility types -arg.COUNT = arg.flag((v, name, existingCount) => (existingCount || 0) + 1); + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } -module.exports = arg; + return min; + } + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } -/***/ }), + if (env.COLORTERM === 'truecolor') { + return 3; + } -/***/ 978: -/***/ (function(module, __unusedexports, __webpack_require__) { + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); -"use strict"; + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } -var utils = __webpack_require__(397); + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } -/** - * Config-specific merge-function which creates a new config-object - * by merging two configuration objects together. - * - * @param {Object} config1 - * @param {Object} config2 - * @returns {Object} New object resulting from merging config2 to config1 - */ -module.exports = function mergeConfig(config1, config2) { - // eslint-disable-next-line no-param-reassign - config2 = config2 || {}; - var config = {}; + if ('COLORTERM' in env) { + return 1; + } - var valueFromConfig2Keys = ['url', 'method', 'data']; - var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; - var defaultToConfig2Keys = [ - 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', - 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', - 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', - 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', - 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' - ]; - var directMergeKeys = ['validateStatus']; + return min; +} - function getMergedValue(target, source) { - if (utils.isPlainObject(target) && utils.isPlainObject(source)) { - return utils.merge(target, source); - } else if (utils.isPlainObject(source)) { - return utils.merge({}, source); - } else if (utils.isArray(source)) { - return source.slice(); - } - return source; - } +function getSupportLevel(stream) { + const level = supportsColor(stream, stream && stream.isTTY); + return translateLevel(level); +} - function mergeDeepProperties(prop) { - if (!utils.isUndefined(config2[prop])) { - config[prop] = getMergedValue(config1[prop], config2[prop]); - } else if (!utils.isUndefined(config1[prop])) { - config[prop] = getMergedValue(undefined, config1[prop]); - } - } +module.exports = { + supportsColor: getSupportLevel, + stdout: translateLevel(supportsColor(true, tty.isatty(1))), + stderr: translateLevel(supportsColor(true, tty.isatty(2))) +}; - utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { - if (!utils.isUndefined(config2[prop])) { - config[prop] = getMergedValue(undefined, config2[prop]); - } - }); - utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); +/***/ }), - utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { - if (!utils.isUndefined(config2[prop])) { - config[prop] = getMergedValue(undefined, config2[prop]); - } else if (!utils.isUndefined(config1[prop])) { - config[prop] = getMergedValue(undefined, config1[prop]); - } - }); +/***/ 2940: +/***/ ((module) => { - utils.forEach(directMergeKeys, function merge(prop) { - if (prop in config2) { - config[prop] = getMergedValue(config1[prop], config2[prop]); - } else if (prop in config1) { - config[prop] = getMergedValue(undefined, config1[prop]); - } - }); +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) - var axiosKeys = valueFromConfig2Keys - .concat(mergeDeepPropertiesKeys) - .concat(defaultToConfig2Keys) - .concat(directMergeKeys); + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') - var otherKeys = Object - .keys(config1) - .concat(Object.keys(config2)) - .filter(function filterAxiosKeys(key) { - return axiosKeys.indexOf(key) === -1; - }); + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) - utils.forEach(otherKeys, mergeDeepProperties); + return wrapper - return config; -}; + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} /***/ }), -/***/ 985: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 3531: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { "use strict"; /*! @@ -10731,9 +10641,9 @@ module.exports = function mergeConfig(config1, config2) { -var fs = __webpack_require__(747); -var path = __webpack_require__(622); -var mkdirp = __webpack_require__(615); +var fs = __nccwpck_require__(5747); +var path = __nccwpck_require__(5622); +var mkdirp = __nccwpck_require__(6186); /** * Asynchronously writes data to a file, replacing the file if it already @@ -10838,235 +10748,63 @@ writeFile.promise = function(filepath, val, options) { * @param {string|Buffer|Uint8Array} `data` String or buffer to write to disk. * @param {object} `options` Options to pass to [fs.writeFileSync][fs]{#fs_fs_writefilesync_file_data_options} and/or [mkdirp][] * @return {undefined} - * @api public - */ - -writeFile.sync = function(filepath, data, options) { - if (typeof filepath !== 'string') { - throw new TypeError('expected filepath to be a string'); - } - mkdirp.sync(path.dirname(filepath), options); - fs.writeFileSync(filepath, data, options); -}; - -/** - * Uses `fs.createWriteStream` to write data to a file, replacing the - * file if it already exists and creating any intermediate directories - * if they don't already exist. Data can be a string or a buffer. Returns - * a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) - * object. - * - * ```js - * var fs = require('fs'); - * var writeFile = require('write'); - * fs.createReadStream('README.md') - * .pipe(writeFile.stream('a/b/c/other-file.md')) - * .on('close', function() { - * // do stuff - * }); - * ``` - * @name .stream - * @param {string|Buffer|integer} `filepath` filepath or file descriptor. - * @param {object} `options` Options to pass to [mkdirp][] and [fs.createWriteStream][fs]{#fs_fs_createwritestream_path_options} - * @return {Stream} Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object. (See [Writable Stream](https://nodejs.org/api/stream.html#stream_class_stream_writable)). - * @api public - */ - -writeFile.stream = function(filepath, options) { - mkdirp.sync(path.dirname(filepath), options); - return fs.createWriteStream(filepath, options); -}; - -/** - * Expose `writeFile` - */ - -module.exports = writeFile; - - -/***/ }), - -/***/ 991: -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; -/* module decorator */ module = __webpack_require__.nmd(module); - - -const wrapAnsi16 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${code + offset}m`; -}; - -const wrapAnsi256 = (fn, offset) => (...args) => { - const code = fn(...args); - return `\u001B[${38 + offset};5;${code}m`; -}; - -const wrapAnsi16m = (fn, offset) => (...args) => { - const rgb = fn(...args); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; -}; - -const ansi2ansi = n => n; -const rgb2rgb = (r, g, b) => [r, g, b]; - -const setLazyProperty = (object, property, get) => { - Object.defineProperty(object, property, { - get: () => { - const value = get(); - - Object.defineProperty(object, property, { - value, - enumerable: true, - configurable: true - }); - - return value; - }, - enumerable: true, - configurable: true - }); -}; - -/** @type {typeof import('color-convert')} */ -let colorConvert; -const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { - if (colorConvert === undefined) { - colorConvert = __webpack_require__(236); - } - - const offset = isBackground ? 10 : 0; - const styles = {}; - - for (const [sourceSpace, suite] of Object.entries(colorConvert)) { - const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; - if (sourceSpace === targetSpace) { - styles[name] = wrap(identity, offset); - } else if (typeof suite === 'object') { - styles[name] = wrap(suite[targetSpace], offset); - } - } - - return styles; -}; - -function assembleStyles() { - const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - - // Bright color - blackBright: [90, 39], - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } - }; - - // Alias bright black as gray (and grey) - styles.color.gray = styles.color.blackBright; - styles.bgColor.bgGray = styles.bgColor.bgBlackBright; - styles.color.grey = styles.color.blackBright; - styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; - - for (const [groupName, group] of Object.entries(styles)) { - for (const [styleName, style] of Object.entries(group)) { - styles[styleName] = { - open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` - }; - - group[styleName] = styles[styleName]; - - codes.set(style[0], style[1]); - } - - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); - } + * @api public + */ - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); +writeFile.sync = function(filepath, data, options) { + if (typeof filepath !== 'string') { + throw new TypeError('expected filepath to be a string'); + } + mkdirp.sync(path.dirname(filepath), options); + fs.writeFileSync(filepath, data, options); +}; - styles.color.close = '\u001B[39m'; - styles.bgColor.close = '\u001B[49m'; +/** + * Uses `fs.createWriteStream` to write data to a file, replacing the + * file if it already exists and creating any intermediate directories + * if they don't already exist. Data can be a string or a buffer. Returns + * a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) + * object. + * + * ```js + * var fs = require('fs'); + * var writeFile = require('write'); + * fs.createReadStream('README.md') + * .pipe(writeFile.stream('a/b/c/other-file.md')) + * .on('close', function() { + * // do stuff + * }); + * ``` + * @name .stream + * @param {string|Buffer|integer} `filepath` filepath or file descriptor. + * @param {object} `options` Options to pass to [mkdirp][] and [fs.createWriteStream][fs]{#fs_fs_createwritestream_path_options} + * @return {Stream} Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object. (See [Writable Stream](https://nodejs.org/api/stream.html#stream_class_stream_writable)). + * @api public + */ - setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); - setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); - setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); - setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); +writeFile.stream = function(filepath, options) { + mkdirp.sync(path.dirname(filepath), options); + return fs.createWriteStream(filepath, options); +}; - return styles; -} +/** + * Expose `writeFile` + */ -// Make the export immutable -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles -}); +module.exports = writeFile; /***/ }), -/***/ 994: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 1713: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const axios = __webpack_require__(802); -const path = __webpack_require__(622); -const chalk = __webpack_require__(640); -const flatCache = __webpack_require__(924); -const MiniSearch = __webpack_require__(391); -const MurmurHash3 = __webpack_require__(879); +const axios = __nccwpck_require__(6545); +const path = __nccwpck_require__(5622); +const chalk = __nccwpck_require__(8818); +const flatCache = __nccwpck_require__(3854); +const MiniSearch = __nccwpck_require__(9622); +const MurmurHash3 = __nccwpck_require__(2527); // GitHub's API endpoint const gh_starred_endpoint = 'https://api.github.com/users/{{USER}}/starred'; @@ -11245,28 +10983,281 @@ module.exports = { search } +/***/ }), + +/***/ 9975: +/***/ ((module) => { + +module.exports = eval("require")("debug"); + + +/***/ }), + +/***/ 696: +/***/ ((module) => { + +"use strict"; +module.exports = JSON.parse('{"_args":[["axios@0.21.1","/home/runner/work/starred_search/starred_search"]],"_from":"axios@0.21.1","_id":"axios@0.21.1","_inBundle":false,"_integrity":"sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==","_location":"/axios","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"axios@0.21.1","name":"axios","escapedName":"axios","rawSpec":"0.21.1","saveSpec":null,"fetchSpec":"0.21.1"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.1.tgz","_spec":"0.21.1","_where":"/home/runner/work/starred_search/starred_search","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.10.0"},"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"bundlesize":"^0.17.0","coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^5.2.0","sinon":"^4.5.0","typescript":"^2.8.1","url-search-params":"^0.10.0","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"homepage":"https://github.com/axios/axios","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test && bundlesize","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.1"}'); + +/***/ }), + +/***/ 306: +/***/ ((module) => { + +"use strict"; +module.exports = JSON.parse('{"name":"starred_search","version":"0.1.10","description":"Search your starred repositories on GitHub for a keyword.","main":"src/cli.js","scripts":{"test":"mocha","build":"ncc build src/cli.js -o bin && mv bin/index.js bin/starred_search"},"bin":{"@link-/starred_search":"bin/starred_search","starred_search":"bin/starred_search"},"repository":{"type":"git","url":"git+https://github.com/Link-/starred_search.git"},"bugs":{"url":"https://github.com/Link-/starred_search/issues"},"homepage":"https://github.com/Link-/starred_search/#readme","keywords":["GitHub","repository","fulltext search","starred","stargazers","cli","terminal","nodejs"],"author":"Link-","license":"ISC","dependencies":{"@vercel/ncc":"^0.28.4","arg":"^4.1.3","axios":"^0.21.1","cachedir":"^2.3.0","chalk":"^4.1.0","esm":"^3.2.25","flat-cache":"^2.0.1","imurmurhash":"^0.1.4","minisearch":"^3.0.2"},"devDependencies":{"prettier":"^2.2.1"}}'); + +/***/ }), + +/***/ 2357: +/***/ ((module) => { + +"use strict"; +module.exports = require("assert");; + +/***/ }), + +/***/ 8614: +/***/ ((module) => { + +"use strict"; +module.exports = require("events");; + +/***/ }), + +/***/ 5747: +/***/ ((module) => { + +"use strict"; +module.exports = require("fs");; + +/***/ }), + +/***/ 8605: +/***/ ((module) => { + +"use strict"; +module.exports = require("http");; + +/***/ }), + +/***/ 7211: +/***/ ((module) => { + +"use strict"; +module.exports = require("https");; + +/***/ }), + +/***/ 2087: +/***/ ((module) => { + +"use strict"; +module.exports = require("os");; + +/***/ }), + +/***/ 5622: +/***/ ((module) => { + +"use strict"; +module.exports = require("path");; + +/***/ }), + +/***/ 2413: +/***/ ((module) => { + +"use strict"; +module.exports = require("stream");; + +/***/ }), + +/***/ 3867: +/***/ ((module) => { + +"use strict"; +module.exports = require("tty");; + +/***/ }), + +/***/ 8835: +/***/ ((module) => { + +"use strict"; +module.exports = require("url");; + +/***/ }), + +/***/ 1669: +/***/ ((module) => { + +"use strict"; +module.exports = require("util");; + +/***/ }), + +/***/ 8761: +/***/ ((module) => { + +"use strict"; +module.exports = require("zlib");; + /***/ }) -/******/ }, -/******/ function(__webpack_require__) { // webpackRuntimeModules -/******/ "use strict"; -/******/ +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ id: moduleId, +/******/ loaded: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ /******/ /* webpack/runtime/node module decorator */ -/******/ !function() { -/******/ __webpack_require__.nmd = function(module) { +/******/ (() => { +/******/ __nccwpck_require__.nmd = (module) => { /******/ module.paths = []; /******/ if (!module.children) module.children = []; -/******/ Object.defineProperty(module, 'loaded', { -/******/ enumerable: true, -/******/ get: function() { return module.l; } -/******/ }); -/******/ Object.defineProperty(module, 'id', { -/******/ enumerable: true, -/******/ get: function() { return module.i; } -/******/ }); /******/ return module; /******/ }; -/******/ }(); +/******/ })(); +/******/ +/******/ /* webpack/runtime/compat */ /******/ -/******/ } -); \ No newline at end of file +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +const arg = __nccwpck_require__(9482); +const main = __nccwpck_require__(1713); +const pkg = __nccwpck_require__(306); +const chalk = __nccwpck_require__(8818); +const cachedir = __nccwpck_require__(6974); + +const help = ` +Usage: starred_search [OPTIONS] [ARGS]... + + Search your or any other user's starred repositories on GitHub for a keyword. + +Options: + -h, --help + Show this message and exit. + + -u, --user + Any GitHub handle. Example: link- + + -c, --cache-dir + Directory you want to store the cache file in. Example: /tmp/.cache + + -f, --find + The keyword you want to search for. Example: es6 + + -l, --limit + Limit the search results to the specified number. Default is 10 + + -V, --verbose + Outputs debugging log + + -v, --version + Outputs release version + + -d, --debug + Outputs stack trace in case an exception is thrown +` + +const parseArgs = (rawArgs) => { + const args = arg( + { + // Types + '--debug': Boolean, + '--help': Boolean, + '--user': String, + '--find': String, + '--cache-dir': String, + '--limit': Number, + '--verbose': Boolean, + '--version': Boolean, + // Aliases + '-d': '--debug', + '-h': '--help', + '-u': '--user', + '-f': '--find', + '-c': '--cache-dir', + '-l': '--limit', + '-V': '--verbose', + '-v': '--version' + } + ) + return { + debug: args['--debug'] || false, + help: args['--help'], + user: args['--user'], + findParam: args['--find'], + cacheDir: args['--cache-dir'] || cachedir('starredsearch'), + limit: args['--limit'] || 10, + verbose: args['--verbose'] || false, + version: args['--version'] || false, + } +} + +const cli = (args) => { + let options = parseArgs(args) + + // Display commands guide + if (options.help) { + console.log(help) + return + } + // Display version + if (options.version) { + console.log(pkg.version) + return + } + + // Trigger the search + try { + main.search(options); + } catch (error) { + if (!options.debug) { + console.error(chalk.bold.red(`🛑 ${error.message}`)); + } else { + console.error(error); + } + } +} + +cli(process.argv); + +})(); + +module.exports = __webpack_exports__; +/******/ })() +; \ No newline at end of file