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,SACvC,IAAK,MAAM,KAAO,EACT,EAAY,SAAS,KAAQ,IAC9B,EAAW,GAAO,SAAS,QAAQ,GAG/C,CACA,MAAM,EAAgB,QAAQ,IACvB,KACA,IAED,EAAc,CAAC,EACrB,IAAK,MAAO,EAAM,KAAW,EACzB,EAAY,GAAG,KAAU,EAGpB,aAAa,KAGlB,EAAY,IAAQ,EAAI,QAAQ,WAAW,EAAQ,CAAE,WAAU,WAAU,UAE7E,OAAO,CAAW,EAEtB,QAAQ,WAAa","file":"/npm/tailwind-lerp-colors@1.2.6/dist/cjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/tailwind-lerp-colors@1.2.6/dist/cjs/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.lerpColors = exports.lerpColor = exports.validColorModes = void 0;\nconst chroma_js_1 = __importDefault(require(\"chroma-js\"));\nconst colors_1 = __importDefault(require(\"tailwindcss/colors\"));\nfunction keys(obj) {\n    return Object.keys(obj);\n}\nfunction entries(obj) {\n    return Object.entries(obj);\n}\nfunction hasOwn(obj, key) {\n    return Object.prototype.hasOwnProperty.call(obj, key);\n}\n// valid color modes for chroma-js\nexports.validColorModes = [\n    'rgb',\n    'lab',\n    'lch',\n    'lrgb',\n    'hcl',\n    'num',\n    'hcg',\n    'oklch',\n    'hsi',\n    'hsl',\n    'hsv',\n    'oklab',\n];\n// default options for tailwind-lerp-colors -> lerpColor\nconst defaultSingleOptions = {\n    lerpEnds: true,\n    interval: 25,\n    mode: 'lrgb',\n};\n// default options for tailwind-lerp-colors -> lerpColors\nconst defaultOptions = {\n    includeBase: true,\n    includeLegacy: false,\n    ...defaultSingleOptions,\n};\nconst isOptionInvalid = (options, optionName, test) => {\n    return options && hasOwn(options, optionName) && !test(options[optionName]);\n};\nconst throwError = (message) => {\n    throw new Error(message);\n};\nconst isValidShade = (shades) => {\n    if (\n    // undefined or null\n    shades == null ||\n        // check if shades is an object\n        typeof shades !== 'object' ||\n        // check if shades is an array\n        Array.isArray(shades) ||\n        shades.toString() !== '[object Object]' ||\n        !keys(shades).every((key) => {\n            return !isNaN(+key);\n        })) {\n        return false;\n    }\n    return true;\n};\nconst lerpColor = (shades, options = {}) => {\n    // validate lerpEnds\n    if (isOptionInvalid(options, 'lerpEnds', (v) => typeof v === 'boolean'))\n        throwError('tailwind-lerp-colors option `lerpEnds` must be a boolean.');\n    // validate interval\n    if (isOptionInvalid(options, 'interval', (v) => Number.isInteger(v) && typeof v === 'number' && v > 0))\n        throwError('tailwind-lerp-colors option `interval` must be a positive integer greater than 0.');\n    // validate mode\n    if (isOptionInvalid(options, 'mode', (v) => typeof v === 'string' && exports.validColorModes.includes(v)))\n        throwError(`tailwind-lerp-colors option \\`mode\\` must be one of the following values: ${exports.validColorModes.join(', ')}.`);\n    if (!isValidShade(shades))\n        throwError('tailwind-lerp-colors object `shades` must be an object with numeric keys.\\n\\nvalue used: ' +\n            JSON.stringify(shades, null, 2));\n    const { lerpEnds, interval, mode } = {\n        ...defaultSingleOptions,\n        ...(options !== null && options !== void 0 ? options : {}),\n    };\n    const sortByNumericFirstIndex = ([numericKeyA], [numericKeyB]) => {\n        return numericKeyA - numericKeyB;\n    };\n    const shadesArray = entries(shades)\n        .map(([numericStringKey, color]) => {\n        return [Number(numericStringKey), color];\n    })\n        .sort(sortByNumericFirstIndex);\n    if (lerpEnds) {\n        shadesArray.unshift([0, '#ffffff']);\n        shadesArray.push([1000, '#000000']);\n    }\n    const finalShades = [...shadesArray];\n    for (let i = 0; i < shadesArray.length - 1; i++) {\n        const [shade, color] = shadesArray[i];\n        const [nextShade, nextColor] = shadesArray[i + 1];\n        // check to make sure both shades being compared\n        // are evenly divisible by the set interval\n        const interpolations = (nextShade - shade) / interval - 1;\n        if (interpolations <= 0 || !Number.isInteger(interpolations))\n            continue;\n        const scale = chroma_js_1.default.scale([color, nextColor]).mode(mode);\n        const getColorAt = (percent) => scale(percent).hex();\n        for (let run = 1; run <= interpolations; run++) {\n            const percent = run / (interpolations + 1);\n            finalShades.push([shade + interval * run, getColorAt(percent)]);\n        }\n    }\n    finalShades.sort(sortByNumericFirstIndex);\n    return Object.fromEntries(finalShades);\n};\nexports.lerpColor = lerpColor;\nconst lerpColors = (colorsObj = {}, options = {}) => {\n    // validate includeBase\n    if (isOptionInvalid(options, 'includeBase', (v) => typeof v === 'boolean'))\n        throwError('tailwind-lerp-colors option `includeBase` must be a boolean.');\n    // validate includeLegacy\n    if (isOptionInvalid(options, 'includeLegacy', (v) => typeof v === 'boolean'))\n        throwError('tailwind-lerp-colors option `includeLegacy` must be a boolean.');\n    const legacyNames = ['lightBlue', 'warmGray', 'trueGray', 'coolGray', 'blueGray'];\n    const { includeBase, includeLegacy, lerpEnds, interval, mode } = {\n        ...defaultOptions,\n        ...options,\n    };\n    const baseColors = {};\n    if (includeBase) {\n        const builtInColorKeys = keys(colors_1.default);\n        for (const key of builtInColorKeys) {\n            if (!legacyNames.includes(key) || includeLegacy) {\n                baseColors[key] = colors_1.default[key];\n            }\n        }\n    }\n    const initialColors = entries({\n        ...baseColors,\n        ...colorsObj,\n    });\n    const finalColors = {};\n    for (const [name, shades] of initialColors) {\n        finalColors[`${name}`] = shades;\n        // some shades from tailwind base colors are not objects;\n        // skip those\n        if (!isValidShade(shades)) {\n            continue;\n        }\n        finalColors[name] = (0, exports.lerpColor)(shades, { lerpEnds, interval, mode });\n    }\n    return finalColors;\n};\nexports.lerpColors = lerpColors;\n"]}