woocommerce/9031.fdfd8993.iframe.bundle...

7687 lines
249 KiB
JavaScript

(self["webpackChunk_woocommerce_storybook"] = self["webpackChunk_woocommerce_storybook"] || []).push([[9031],{
/***/ "../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js":
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ A: () => (/* binding */ _assertThisInitialized)
/* harmony export */ });
function _assertThisInitialized(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
}
/***/ }),
/***/ "../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/extends.js":
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ A: () => (/* binding */ _extends)
/* harmony export */ });
function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return n;
}, _extends.apply(null, arguments);
}
/***/ }),
/***/ "../../node_modules/.pnpm/@storybook+docs-tools@7.6.19_encoding@0.1.13/node_modules/@storybook/docs-tools/dist/index.mjs":
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Op: () => (/* binding */ SNIPPET_RENDERED),
/* harmony export */ Y1: () => (/* binding */ SourceType),
/* harmony export */ gx: () => (/* binding */ str)
/* harmony export */ });
/* unused harmony exports ADDON_ID, MAX_DEFAULT_VALUE_SUMMARY_LENGTH, MAX_TYPE_SUMMARY_LENGTH, PANEL_ID, PARAM_KEY, TypeSystem, convert, createSummaryValue, enhanceArgTypes, extractComponentDescription, extractComponentProps, extractComponentSectionArray, extractComponentSectionObject, getDocgenDescription, getDocgenSection, hasDocgen, hasDocsOrControls, isDefaultValueBlacklisted, isTooLongForDefaultValueSummary, isTooLongForTypeSummary, isValidDocgenSection, normalizeNewlines, parseJsDoc */
/* harmony import */ var lodash_mapValues_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/mapValues.js");
/* harmony import */ var lodash_mapValues_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_mapValues_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var doctrine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/doctrine@3.0.0/node_modules/doctrine/lib/doctrine.js");
/* harmony import */ var _storybook_preview_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@storybook/preview-api");
/* harmony import */ var _storybook_preview_api__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_storybook_preview_api__WEBPACK_IMPORTED_MODULE_2__);
var QUOTE_REGEX=/^['"]|['"]$/g,trimQuotes=str2=>str2.replace(QUOTE_REGEX,""),includesQuotes=str2=>QUOTE_REGEX.test(str2),parseLiteral=str2=>{let trimmedValue=trimQuotes(str2);return includesQuotes(str2)||Number.isNaN(Number(trimmedValue))?trimmedValue:Number(trimmedValue)};var convertSig=type=>{switch(type.type){case"function":return {name:"function"};case"object":let values={};return type.signature.properties.forEach(prop=>{values[prop.key]=convert(prop.value);}),{name:"object",value:values};default:throw new Error(`Unknown: ${type}`)}},convert=type=>{let{name,raw}=type,base={};switch(typeof raw<"u"&&(base.raw=raw),type.name){case"string":case"number":case"symbol":case"boolean":return {...base,name};case"Array":return {...base,name:"array",value:type.elements.map(convert)};case"signature":return {...base,...convertSig(type)};case"union":let result;return type.elements.every(element=>element.name==="literal")?result={...base,name:"enum",value:type.elements.map(v=>parseLiteral(v.value))}:result={...base,name,value:type.elements.map(convert)},result;case"intersection":return {...base,name,value:type.elements.map(convert)};default:return {...base,name:"other",value:name}}};var isLiteral=type=>type.name==="literal",toEnumOption=element=>element.value.replace(/['|"]/g,""),convertSig2=type=>{switch(type.type){case"function":return {name:"function"};case"object":let values={};return type.signature.properties.forEach(prop=>{values[prop.key]=convert2(prop.value);}),{name:"object",value:values};default:throw new Error(`Unknown: ${type}`)}},convert2=type=>{let{name,raw}=type,base={};switch(typeof raw<"u"&&(base.raw=raw),type.name){case"literal":return {...base,name:"other",value:type.value};case"string":case"number":case"symbol":case"boolean":return {...base,name};case"Array":return {...base,name:"array",value:type.elements.map(convert2)};case"signature":return {...base,...convertSig2(type)};case"union":return type.elements.every(isLiteral)?{...base,name:"enum",value:type.elements.map(toEnumOption)}:{...base,name,value:type.elements.map(convert2)};case"intersection":return {...base,name,value:type.elements.map(convert2)};default:return {...base,name:"other",value:name}}};var SIGNATURE_REGEXP=/^\(.*\) => /,convert3=type=>{let{name,raw,computed,value}=type,base={};switch(typeof raw<"u"&&(base.raw=raw),name){case"enum":{let values2=computed?value:value.map(v=>parseLiteral(v.value));return {...base,name,value:values2}}case"string":case"number":case"symbol":return {...base,name};case"func":return {...base,name:"function"};case"bool":case"boolean":return {...base,name:"boolean"};case"arrayOf":case"array":return {...base,name:"array",value:value&&convert3(value)};case"object":return {...base,name};case"objectOf":return {...base,name,value:convert3(value)};case"shape":case"exact":let values=mapValues(value,field=>convert3(field));return {...base,name:"object",value:values};case"union":return {...base,name:"union",value:value.map(v=>convert3(v))};case"instanceOf":case"element":case"elementType":default:{if(name?.indexOf("|")>0)try{let literalValues=name.split("|").map(v=>JSON.parse(v));return {...base,name:"enum",value:literalValues}}catch{}let otherVal=value?`${name}(${value})`:name,otherName=SIGNATURE_REGEXP.test(name)?"function":"other";return {...base,name:otherName,value:otherVal}}}};var convert4=docgenInfo=>{let{type,tsType,flowType}=docgenInfo;return type!=null?convert3(type):tsType!=null?convert(tsType):flowType!=null?convert2(flowType):null};var TypeSystem=(TypeSystem2=>(TypeSystem2.JAVASCRIPT="JavaScript",TypeSystem2.FLOW="Flow",TypeSystem2.TYPESCRIPT="TypeScript",TypeSystem2.UNKNOWN="Unknown",TypeSystem2))(TypeSystem||{});var BLACKLIST=(/* unused pure expression or super */ null && (["null","undefined"]));function isDefaultValueBlacklisted(value){return BLACKLIST.some(x=>x===value)}var str=obj=>{if(!obj)return "";if(typeof obj=="string")return obj;throw new Error(`Description: expected string, got: ${JSON.stringify(obj)}`)};function hasDocgen(component){return !!component.__docgenInfo}function isValidDocgenSection(docgenSection){return docgenSection!=null&&Object.keys(docgenSection).length>0}function getDocgenSection(component,section){return hasDocgen(component)?component.__docgenInfo[section]:null}function getDocgenDescription(component){return hasDocgen(component)&&str(component.__docgenInfo.description)}function containsJsDoc(value){return value!=null&&value.includes("@")}function parse(content,tags){let ast;try{ast=doctrine.parse(content,{tags,sloppy:!0});}catch(e){throw console.error(e),new Error("Cannot parse JSDoc tags.")}return ast}var DEFAULT_OPTIONS={tags:["param","arg","argument","returns","ignore","deprecated"]},parseJsDoc=(value,options=DEFAULT_OPTIONS)=>{if(!containsJsDoc(value))return {includesJsDoc:!1,ignore:!1};let jsDocAst=parse(value,options.tags),extractedTags=extractJsDocTags(jsDocAst);return extractedTags.ignore?{includesJsDoc:!0,ignore:!0}:{includesJsDoc:!0,ignore:!1,description:jsDocAst.description,extractedTags}};function extractJsDocTags(ast){let extractedTags={params:null,deprecated:null,returns:null,ignore:!1};for(let i=0;i<ast.tags.length;i+=1){let tag=ast.tags[i];if(tag.title==="ignore"){extractedTags.ignore=!0;break}else switch(tag.title){case"param":case"arg":case"argument":{let paramTag=extractParam(tag);paramTag!=null&&(extractedTags.params==null&&(extractedTags.params=[]),extractedTags.params.push(paramTag));break}case"deprecated":{let deprecatedTag=extractDeprecated(tag);deprecatedTag!=null&&(extractedTags.deprecated=deprecatedTag);break}case"returns":{let returnsTag=extractReturns(tag);returnsTag!=null&&(extractedTags.returns=returnsTag);break}}}return extractedTags}function extractParam(tag){let paramName=tag.name;return paramName!=null&&paramName!=="null-null"?{name:tag.name,type:tag.type,description:tag.description,getPrettyName:()=>paramName.includes("null")?paramName.replace("-null","").replace(".null",""):tag.name,getTypeName:()=>tag.type!=null?extractTypeName(tag.type):null}:null}function extractDeprecated(tag){return tag.title!=null?tag.description:null}function extractReturns(tag){return tag.type!=null?{type:tag.type,description:tag.description,getTypeName:()=>extractTypeName(tag.type)}:null}function extractTypeName(type){return type.type==="NameExpression"?type.name:type.type==="RecordType"?`({${type.fields.map(field=>{if(field.value!=null){let valueTypeName=extractTypeName(field.value);return `${field.key}: ${valueTypeName}`}return field.key}).join(", ")}})`:type.type==="UnionType"?`(${type.elements.map(extractTypeName).join("|")})`:type.type==="ArrayType"?"[]":type.type==="TypeApplication"&&type.expression!=null&&type.expression.name==="Array"?`${extractTypeName(type.applications[0])}[]`:type.type==="NullableType"||type.type==="NonNullableType"||type.type==="OptionalType"?extractTypeName(type.expression):type.type==="AllLiteral"?"any":null}var MAX_TYPE_SUMMARY_LENGTH=90,MAX_DEFAULT_VALUE_SUMMARY_LENGTH=50;function isTooLongForTypeSummary(value){return value.length>90}function isTooLongForDefaultValueSummary(value){return value.length>50}function createSummaryValue(summary,detail){return summary===detail?{summary}:{summary,detail}}var normalizeNewlines=string=>string.replace(/\\r\\n/g,"\\n");function generateUnionElement({name,value,elements,raw}){return value??(elements!=null?elements.map(generateUnionElement).join(" | "):raw??name)}function generateUnion({name,raw,elements}){return elements!=null?createSummaryValue(elements.map(generateUnionElement).join(" | ")):raw!=null?createSummaryValue(raw.replace(/^\|\s*/,"")):createSummaryValue(name)}function generateFuncSignature({type,raw}){return raw!=null?createSummaryValue(raw):createSummaryValue(type)}function generateObjectSignature({type,raw}){return raw!=null?isTooLongForTypeSummary(raw)?createSummaryValue(type,raw):createSummaryValue(raw):createSummaryValue(type)}function generateSignature(flowType){let{type}=flowType;return type==="object"?generateObjectSignature(flowType):generateFuncSignature(flowType)}function generateDefault({name,raw}){return raw!=null?isTooLongForTypeSummary(raw)?createSummaryValue(name,raw):createSummaryValue(raw):createSummaryValue(name)}function createType(type){if(type==null)return null;switch(type.name){case"union":return generateUnion(type);case"signature":return generateSignature(type);default:return generateDefault(type)}}function createDefaultValue(defaultValue,type){if(defaultValue!=null){let{value}=defaultValue;if(!isDefaultValueBlacklisted(value))return isTooLongForDefaultValueSummary(value)?createSummaryValue(type.name,value):createSummaryValue(value)}return null}var createFlowPropDef=(propName,docgenInfo)=>{let{flowType,description,required,defaultValue}=docgenInfo;return {name:propName,type:createType(flowType),required,description,defaultValue:createDefaultValue(defaultValue,flowType)}};function createType2({tsType,required}){if(tsType==null)return null;let typeName=tsType.name;return required||(typeName=typeName.replace(" | undefined","")),createSummaryValue(["Array","Record","signature"].includes(tsType.name)?tsType.raw:typeName)}function createDefaultValue2({defaultValue}){if(defaultValue!=null){let{value}=defaultValue;if(!isDefaultValueBlacklisted(value))return createSummaryValue(value)}return null}var createTsPropDef=(propName,docgenInfo)=>{let{description,required}=docgenInfo;return {name:propName,type:createType2(docgenInfo),required,description,defaultValue:createDefaultValue2(docgenInfo)}};function createType3(type){return type!=null?createSummaryValue(type.name):null}function isReactDocgenTypescript(defaultValue){let{computed,func}=defaultValue;return typeof computed>"u"&&typeof func>"u"}function isStringValued(type){return type?type.name==="string"?!0:type.name==="enum"?Array.isArray(type.value)&&type.value.every(({value:tv})=>typeof tv=="string"&&tv[0]==='"'&&tv[tv.length-1]==='"'):!1:!1}function createDefaultValue3(defaultValue,type){if(defaultValue!=null){let{value}=defaultValue;if(!isDefaultValueBlacklisted(value))return isReactDocgenTypescript(defaultValue)&&isStringValued(type)?createSummaryValue(JSON.stringify(value)):createSummaryValue(value)}return null}function createBasicPropDef(name,type,docgenInfo){let{description,required,defaultValue}=docgenInfo;return {name,type:createType3(type),required,description,defaultValue:createDefaultValue3(defaultValue,type)}}function applyJsDocResult(propDef,jsDocParsingResult){if(jsDocParsingResult.includesJsDoc){let{description,extractedTags}=jsDocParsingResult;description!=null&&(propDef.description=jsDocParsingResult.description);let value={...extractedTags,params:extractedTags?.params?.map(x=>({name:x.getPrettyName(),description:x.description}))};Object.values(value).filter(Boolean).length>0&&(propDef.jsDocTags=value);}return propDef}var javaScriptFactory=(propName,docgenInfo,jsDocParsingResult)=>{let propDef=createBasicPropDef(propName,docgenInfo.type,docgenInfo);return propDef.sbType=convert4(docgenInfo),applyJsDocResult(propDef,jsDocParsingResult)},tsFactory=(propName,docgenInfo,jsDocParsingResult)=>{let propDef=createTsPropDef(propName,docgenInfo);return propDef.sbType=convert4(docgenInfo),applyJsDocResult(propDef,jsDocParsingResult)},flowFactory=(propName,docgenInfo,jsDocParsingResult)=>{let propDef=createFlowPropDef(propName,docgenInfo);return propDef.sbType=convert4(docgenInfo),applyJsDocResult(propDef,jsDocParsingResult)},unknownFactory=(propName,docgenInfo,jsDocParsingResult)=>{let propDef=createBasicPropDef(propName,{name:"unknown"},docgenInfo);return applyJsDocResult(propDef,jsDocParsingResult)},getPropDefFactory=typeSystem=>{switch(typeSystem){case"JavaScript":return javaScriptFactory;case"TypeScript":return tsFactory;case"Flow":return flowFactory;default:return unknownFactory}};var getTypeSystem=docgenInfo=>docgenInfo.type!=null?"JavaScript":docgenInfo.flowType!=null?"Flow":docgenInfo.tsType!=null?"TypeScript":"Unknown",extractComponentSectionArray=docgenSection=>{let typeSystem=getTypeSystem(docgenSection[0]),createPropDef=getPropDefFactory(typeSystem);return docgenSection.map(item=>{let sanitizedItem=item;return item.type?.elements&&(sanitizedItem={...item,type:{...item.type,value:item.type.elements}}),extractProp(sanitizedItem.name,sanitizedItem,typeSystem,createPropDef)})},extractComponentSectionObject=docgenSection=>{let docgenPropsKeys=Object.keys(docgenSection),typeSystem=getTypeSystem(docgenSection[docgenPropsKeys[0]]),createPropDef=getPropDefFactory(typeSystem);return docgenPropsKeys.map(propName=>{let docgenInfo=docgenSection[propName];return docgenInfo!=null?extractProp(propName,docgenInfo,typeSystem,createPropDef):null}).filter(Boolean)},extractComponentProps=(component,section)=>{let docgenSection=getDocgenSection(component,section);return isValidDocgenSection(docgenSection)?Array.isArray(docgenSection)?extractComponentSectionArray(docgenSection):extractComponentSectionObject(docgenSection):[]};function extractProp(propName,docgenInfo,typeSystem,createPropDef){let jsDocParsingResult=parseJsDoc(docgenInfo.description);return jsDocParsingResult.includesJsDoc&&jsDocParsingResult.ignore?null:{propDef:createPropDef(propName,docgenInfo,jsDocParsingResult),jsDocTags:jsDocParsingResult.extractedTags,docgenInfo,typeSystem}}function extractComponentDescription(component){return component!=null&&getDocgenDescription(component)}var enhanceArgTypes=context=>{let{component,argTypes:userArgTypes,parameters:{docs={}}}=context,{extractArgTypes}=docs,extractedArgTypes=extractArgTypes&&component?extractArgTypes(component):{};return extractedArgTypes?combineParameters(extractedArgTypes,userArgTypes):userArgTypes};var ADDON_ID="storybook/docs",PANEL_ID=(/* unused pure expression or super */ null && (`${ADDON_ID}/panel`)),PARAM_KEY="docs",SNIPPET_RENDERED=`${ADDON_ID}/snippet-rendered`,SourceType=(SourceType2=>(SourceType2.AUTO="auto",SourceType2.CODE="code",SourceType2.DYNAMIC="dynamic",SourceType2))(SourceType||{});var packageRe=/(addons\/|addon-|addon-essentials\/)(docs|controls)/,hasDocsOrControls=options=>options.presetsList?.some(preset=>packageRe.test(preset.name));
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludes.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var baseIndexOf = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIndexOf.js");
/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}
module.exports = arrayIncludes;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludesWith.js":
/***/ ((module) => {
/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
module.exports = arrayIncludesWith;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFindIndex.js":
/***/ ((module) => {
/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} predicate The function invoked per iteration.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while ((fromRight ? index-- : ++index < length)) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
module.exports = baseFindIndex;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIndexOf.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var baseFindIndex = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFindIndex.js"),
baseIsNaN = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsNaN.js"),
strictIndexOf = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_strictIndexOf.js");
/**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
return value === value
? strictIndexOf(array, value, fromIndex)
: baseFindIndex(array, baseIsNaN, fromIndex);
}
module.exports = baseIndexOf;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsNaN.js":
/***/ ((module) => {
/**
* The base implementation of `_.isNaN` without support for number objects.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
*/
function baseIsNaN(value) {
return value !== value;
}
module.exports = baseIsNaN;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePickBy.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var baseGet = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js"),
baseSet = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSet.js"),
castPath = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js");
/**
* The base implementation of `_.pickBy` without support for iteratee shorthands.
*
* @private
* @param {Object} object The source object.
* @param {string[]} paths The property paths to pick.
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
function basePickBy(object, paths, predicate) {
var index = -1,
length = paths.length,
result = {};
while (++index < length) {
var path = paths[index],
value = baseGet(object, path);
if (predicate(value, path)) {
baseSet(result, castPath(path, object), value);
}
}
return result;
}
module.exports = basePickBy;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseUniq.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var SetCache = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js"),
arrayIncludes = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludes.js"),
arrayIncludesWith = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludesWith.js"),
cacheHas = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cacheHas.js"),
createSet = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createSet.js"),
setToArray = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToArray.js");
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new duplicate free array.
*/
function baseUniq(array, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
length = array.length,
isCommon = true,
result = [],
seen = result;
if (comparator) {
isCommon = false;
includes = arrayIncludesWith;
}
else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : createSet(array);
if (set) {
return setToArray(set);
}
isCommon = false;
includes = cacheHas;
seen = new SetCache;
}
else {
seen = iteratee ? [] : result;
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee) {
seen.push(computed);
}
result.push(value);
}
else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
module.exports = baseUniq;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createSet.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var Set = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Set.js"),
noop = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/noop.js"),
setToArray = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToArray.js");
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/**
* Creates a set object of `values`.
*
* @private
* @param {Array} values The values to add to the set.
* @returns {Object} Returns the new set.
*/
var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
return new Set(values);
};
module.exports = createSet;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_strictIndexOf.js":
/***/ ((module) => {
/**
* A specialized version of `_.indexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
module.exports = strictIndexOf;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/cloneDeep.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var baseClone = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseClone.js");
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_SYMBOLS_FLAG = 4;
/**
* This method is like `_.clone` except that it recursively clones `value`.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Lang
* @param {*} value The value to recursively clone.
* @returns {*} Returns the deep cloned value.
* @see _.clone
* @example
*
* var objects = [{ 'a': 1 }, { 'b': 2 }];
*
* var deep = _.cloneDeep(objects);
* console.log(deep[0] === objects[0]);
* // => false
*/
function cloneDeep(value) {
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
}
module.exports = cloneDeep;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/noop.js":
/***/ ((module) => {
/**
* This method returns `undefined`.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Util
* @example
*
* _.times(2, _.noop);
* // => [undefined, undefined]
*/
function noop() {
// No operation performed.
}
module.exports = noop;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/pickBy.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var arrayMap = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js"),
baseIteratee = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIteratee.js"),
basePickBy = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePickBy.js"),
getAllKeysIn = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getAllKeysIn.js");
/**
* Creates an object composed of the `object` properties `predicate` returns
* truthy for. The predicate is invoked with two arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pickBy(object, _.isNumber);
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = baseIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
module.exports = pickBy;
/***/ }),
/***/ "../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniq.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var baseUniq = __webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseUniq.js");
/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons, in which only the first occurrence of each element
* is kept. The order of result values is determined by the order they occur
* in the array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
* @example
*
* _.uniq([2, 1, 2]);
* // => [2, 1]
*/
function uniq(array) {
return (array && array.length) ? baseUniq(array) : [];
}
module.exports = uniq;
/***/ }),
/***/ "../../node_modules/.pnpm/memoizerific@1.11.3/node_modules/memoizerific/memoizerific.js":
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=undefined;if(!u&&__webpack_require__("../../node_modules/.pnpm/memoizerific@1.11.3/node_modules/memoizerific sync recursive"))return require(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=undefined;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
module.exports = function(forceSimilar) {
if (typeof Map !== 'function' || forceSimilar) {
var Similar = _dereq_('./similar');
return new Similar();
}
else {
return new Map();
}
}
},{"./similar":2}],2:[function(_dereq_,module,exports){
function Similar() {
this.list = [];
this.lastItem = undefined;
this.size = 0;
return this;
}
Similar.prototype.get = function(key) {
var index;
if (this.lastItem && this.isEqual(this.lastItem.key, key)) {
return this.lastItem.val;
}
index = this.indexOf(key);
if (index >= 0) {
this.lastItem = this.list[index];
return this.list[index].val;
}
return undefined;
};
Similar.prototype.set = function(key, val) {
var index;
if (this.lastItem && this.isEqual(this.lastItem.key, key)) {
this.lastItem.val = val;
return this;
}
index = this.indexOf(key);
if (index >= 0) {
this.lastItem = this.list[index];
this.list[index].val = val;
return this;
}
this.lastItem = { key: key, val: val };
this.list.push(this.lastItem);
this.size++;
return this;
};
Similar.prototype.delete = function(key) {
var index;
if (this.lastItem && this.isEqual(this.lastItem.key, key)) {
this.lastItem = undefined;
}
index = this.indexOf(key);
if (index >= 0) {
this.size--;
return this.list.splice(index, 1)[0];
}
return undefined;
};
// important that has() doesn't use get() in case an existing key has a falsy value, in which case has() would return false
Similar.prototype.has = function(key) {
var index;
if (this.lastItem && this.isEqual(this.lastItem.key, key)) {
return true;
}
index = this.indexOf(key);
if (index >= 0) {
this.lastItem = this.list[index];
return true;
}
return false;
};
Similar.prototype.forEach = function(callback, thisArg) {
var i;
for (i = 0; i < this.size; i++) {
callback.call(thisArg || this, this.list[i].val, this.list[i].key, this);
}
};
Similar.prototype.indexOf = function(key) {
var i;
for (i = 0; i < this.size; i++) {
if (this.isEqual(this.list[i].key, key)) {
return i;
}
}
return -1;
};
// check if the numbers are equal, or whether they are both precisely NaN (isNaN returns true for all non-numbers)
Similar.prototype.isEqual = function(val1, val2) {
return val1 === val2 || (val1 !== val1 && val2 !== val2);
};
module.exports = Similar;
},{}],3:[function(_dereq_,module,exports){
var MapOrSimilar = _dereq_('map-or-similar');
module.exports = function (limit) {
var cache = new MapOrSimilar(undefined === 'true'),
lru = [];
return function (fn) {
var memoizerific = function () {
var currentCache = cache,
newMap,
fnResult,
argsLengthMinusOne = arguments.length - 1,
lruPath = Array(argsLengthMinusOne + 1),
isMemoized = true,
i;
if ((memoizerific.numArgs || memoizerific.numArgs === 0) && memoizerific.numArgs !== argsLengthMinusOne + 1) {
throw new Error('Memoizerific functions should always be called with the same number of arguments');
}
// loop through each argument to traverse the map tree
for (i = 0; i < argsLengthMinusOne; i++) {
lruPath[i] = {
cacheItem: currentCache,
arg: arguments[i]
};
// climb through the hierarchical map tree until the second-last argument has been found, or an argument is missing.
// if all arguments up to the second-last have been found, this will potentially be a cache hit (determined later)
if (currentCache.has(arguments[i])) {
currentCache = currentCache.get(arguments[i]);
continue;
}
isMemoized = false;
// make maps until last value
newMap = new MapOrSimilar(undefined === 'true');
currentCache.set(arguments[i], newMap);
currentCache = newMap;
}
// we are at the last arg, check if it is really memoized
if (isMemoized) {
if (currentCache.has(arguments[argsLengthMinusOne])) {
fnResult = currentCache.get(arguments[argsLengthMinusOne]);
}
else {
isMemoized = false;
}
}
if (!isMemoized) {
fnResult = fn.apply(null, arguments);
currentCache.set(arguments[argsLengthMinusOne], fnResult);
}
if (limit > 0) {
lruPath[argsLengthMinusOne] = {
cacheItem: currentCache,
arg: arguments[argsLengthMinusOne]
};
if (isMemoized) {
moveToMostRecentLru(lru, lruPath);
}
else {
lru.push(lruPath);
}
if (lru.length > limit) {
removeCachedResult(lru.shift());
}
}
memoizerific.wasMemoized = isMemoized;
memoizerific.numArgs = argsLengthMinusOne + 1;
return fnResult;
};
memoizerific.limit = limit;
memoizerific.wasMemoized = false;
memoizerific.cache = cache;
memoizerific.lru = lru;
return memoizerific;
};
};
// move current args to most recent position
function moveToMostRecentLru(lru, lruPath) {
var lruLen = lru.length,
lruPathLen = lruPath.length,
isMatch,
i, ii;
for (i = 0; i < lruLen; i++) {
isMatch = true;
for (ii = 0; ii < lruPathLen; ii++) {
if (!isEqual(lru[i][ii].arg, lruPath[ii].arg)) {
isMatch = false;
break;
}
}
if (isMatch) {
break;
}
}
lru.push(lru.splice(i, 1)[0]);
}
// remove least recently used cache item and all dead branches
function removeCachedResult(removedLru) {
var removedLruLen = removedLru.length,
currentLru = removedLru[removedLruLen - 1],
tmp,
i;
currentLru.cacheItem.delete(currentLru.arg);
// walk down the tree removing dead branches (size 0) along the way
for (i = removedLruLen - 2; i >= 0; i--) {
currentLru = removedLru[i];
tmp = currentLru.cacheItem.get(currentLru.arg);
if (!tmp || !tmp.size) {
currentLru.cacheItem.delete(currentLru.arg);
} else {
break;
}
}
}
// check if the numbers are equal, or whether they are both precisely NaN (isNaN returns true for all non-numbers)
function isEqual(val1, val2) {
return val1 === val2 || (val1 !== val1 && val2 !== val2);
}
},{"map-or-similar":1}]},{},[3])(3)
});
/***/ }),
/***/ "../../node_modules/.pnpm/polished@4.2.2/node_modules/polished/dist/polished.esm.js":
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
e$: () => (/* binding */ curriedDarken$1),
a: () => (/* binding */ curriedLighten$1),
mI: () => (/* binding */ curriedOpacify$1),
B3: () => (/* binding */ rgba),
No: () => (/* binding */ curriedTransparentize$1)
});
// UNUSED EXPORTS: adjustHue, animation, backgroundImages, backgrounds, between, border, borderColor, borderRadius, borderStyle, borderWidth, buttons, clearFix, complement, cover, cssVar, desaturate, directionalProperty, easeIn, easeInOut, easeOut, ellipsis, em, fluidRange, fontFace, getContrast, getLuminance, getValueAndUnit, grayscale, hiDPI, hideText, hideVisually, hsl, hslToColorString, hsla, important, invert, linearGradient, margin, math, meetsContrastGuidelines, mix, modularScale, normalize, padding, parseToHsl, parseToRgb, position, radialGradient, readableColor, rem, remToPx, retinaImage, rgb, rgbToColorString, saturate, setHue, setLightness, setSaturation, shade, size, stripUnit, textInputs, timingFunctions, tint, toColorString, transitions, triangle, wordWrap
// EXTERNAL MODULE: ../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/extends.js");
// EXTERNAL MODULE: ../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
var assertThisInitialized = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
// EXTERNAL MODULE: ../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
var inheritsLoose = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js");
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
function _getPrototypeOf(t) {
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
return t.__proto__ || Object.getPrototypeOf(t);
}, _getPrototypeOf(t);
}
// EXTERNAL MODULE: ../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
var setPrototypeOf = __webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
function _isNativeFunction(t) {
try {
return -1 !== Function.toString.call(t).indexOf("[native code]");
} catch (n) {
return "function" == typeof t;
}
}
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
function _isNativeReflectConstruct() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
} catch (t) {}
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
return !!t;
})();
}
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/construct.js
function _construct(t, e, r) {
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
var o = [null];
o.push.apply(o, e);
var p = new (t.bind.apply(t, o))();
return r && (0,setPrototypeOf/* default */.A)(p, r.prototype), p;
}
;// CONCATENATED MODULE: ../../node_modules/.pnpm/@babel+runtime@7.25.0/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
function _wrapNativeSuper(t) {
var r = "function" == typeof Map ? new Map() : void 0;
return _wrapNativeSuper = function _wrapNativeSuper(t) {
if (null === t || !_isNativeFunction(t)) return t;
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
if (void 0 !== r) {
if (r.has(t)) return r.get(t);
r.set(t, Wrapper);
}
function Wrapper() {
return _construct(t, arguments, _getPrototypeOf(this).constructor);
}
return Wrapper.prototype = Object.create(t.prototype, {
constructor: {
value: Wrapper,
enumerable: !1,
writable: !0,
configurable: !0
}
}), (0,setPrototypeOf/* default */.A)(Wrapper, t);
}, _wrapNativeSuper(t);
}
;// CONCATENATED MODULE: ../../node_modules/.pnpm/polished@4.2.2/node_modules/polished/dist/polished.esm.js
function last() {
var _ref;
return _ref = arguments.length - 1, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref];
}
function negation(a) {
return -a;
}
function addition(a, b) {
return a + b;
}
function subtraction(a, b) {
return a - b;
}
function multiplication(a, b) {
return a * b;
}
function division(a, b) {
return a / b;
}
function max() {
return Math.max.apply(Math, arguments);
}
function min() {
return Math.min.apply(Math, arguments);
}
function comma() {
return Array.of.apply(Array, arguments);
}
var defaultSymbols = {
symbols: {
'*': {
infix: {
symbol: '*',
f: multiplication,
notation: 'infix',
precedence: 4,
rightToLeft: 0,
argCount: 2
},
symbol: '*',
regSymbol: '\\*'
},
'/': {
infix: {
symbol: '/',
f: division,
notation: 'infix',
precedence: 4,
rightToLeft: 0,
argCount: 2
},
symbol: '/',
regSymbol: '/'
},
'+': {
infix: {
symbol: '+',
f: addition,
notation: 'infix',
precedence: 2,
rightToLeft: 0,
argCount: 2
},
prefix: {
symbol: '+',
f: last,
notation: 'prefix',
precedence: 3,
rightToLeft: 0,
argCount: 1
},
symbol: '+',
regSymbol: '\\+'
},
'-': {
infix: {
symbol: '-',
f: subtraction,
notation: 'infix',
precedence: 2,
rightToLeft: 0,
argCount: 2
},
prefix: {
symbol: '-',
f: negation,
notation: 'prefix',
precedence: 3,
rightToLeft: 0,
argCount: 1
},
symbol: '-',
regSymbol: '-'
},
',': {
infix: {
symbol: ',',
f: comma,
notation: 'infix',
precedence: 1,
rightToLeft: 0,
argCount: 2
},
symbol: ',',
regSymbol: ','
},
'(': {
prefix: {
symbol: '(',
f: last,
notation: 'prefix',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: '(',
regSymbol: '\\('
},
')': {
postfix: {
symbol: ')',
f: undefined,
notation: 'postfix',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: ')',
regSymbol: '\\)'
},
min: {
func: {
symbol: 'min',
f: min,
notation: 'func',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: 'min',
regSymbol: 'min\\b'
},
max: {
func: {
symbol: 'max',
f: max,
notation: 'func',
precedence: 0,
rightToLeft: 0,
argCount: 1
},
symbol: 'max',
regSymbol: 'max\\b'
}
}
};
var defaultSymbolMap = (/* unused pure expression or super */ null && (defaultSymbols));
// based on https://github.com/styled-components/styled-components/blob/fcf6f3804c57a14dd7984dfab7bc06ee2edca044/src/utils/error.js
/**
* Parse errors.md and turn it into a simple hash of code: message
* @private
*/
var ERRORS = {
"1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
"2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
"3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
"4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
"5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
"6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
"7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
"8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
"9": "Please provide a number of steps to the modularScale helper.\n\n",
"10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
"11": "Invalid value passed as base to modularScale, expected number or em string but got \"%s\"\n\n",
"12": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got \"%s\" instead.\n\n",
"13": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got \"%s\" instead.\n\n",
"14": "Passed invalid pixel value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
"15": "Passed invalid base value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
"16": "You must provide a template to this method.\n\n",
"17": "You passed an unsupported selector state to this method.\n\n",
"18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
"19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
"20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
"21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
"22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
"23": "fontFace expects a name of a font-family.\n\n",
"24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
"25": "fontFace expects localFonts to be an array.\n\n",
"26": "fontFace expects fileFormats to be an array.\n\n",
"27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
"28": "Please supply a filename to retinaImage() as the first argument.\n\n",
"29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
"30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
"31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
"32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
"33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
"34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
"35": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
"36": "Property must be a string value.\n\n",
"37": "Syntax Error at %s.\n\n",
"38": "Formula contains a function that needs parentheses at %s.\n\n",
"39": "Formula is missing closing parenthesis at %s.\n\n",
"40": "Formula has too many closing parentheses at %s.\n\n",
"41": "All values in a formula must have the same unit or be unitless.\n\n",
"42": "Please provide a number of steps to the modularScale helper.\n\n",
"43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
"44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
"45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
"46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
"47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
"48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
"49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
"50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
"51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
"52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
"53": "fontFace expects localFonts to be an array.\n\n",
"54": "fontFace expects fileFormats to be an array.\n\n",
"55": "fontFace expects a name of a font-family.\n\n",
"56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
"57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
"58": "Please supply a filename to retinaImage() as the first argument.\n\n",
"59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
"60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
"61": "Property must be a string value.\n\n",
"62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
"63": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
"64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
"65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
"66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
"67": "You must provide a template to this method.\n\n",
"68": "You passed an unsupported selector state to this method.\n\n",
"69": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got %s instead.\n\n",
"70": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got %s instead.\n\n",
"71": "Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
"72": "Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
"73": "Please provide a valid CSS variable.\n\n",
"74": "CSS variable not found and no default was provided.\n\n",
"75": "important requires a valid style object, got a %s instead.\n\n",
"76": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n\n",
"77": "remToPx expects a value in \"rem\" but you provided it in \"%s\".\n\n",
"78": "base must be set in \"px\" or \"%\" but you set it in \"%s\".\n"
};
/**
* super basic version of sprintf
* @private
*/
function format() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var a = args[0];
var b = [];
var c;
for (c = 1; c < args.length; c += 1) {
b.push(args[c]);
}
b.forEach(function (d) {
a = a.replace(/%[a-z]/, d);
});
return a;
}
/**
* Create an error file out of errors.md for development and a simple web link to the full errors
* in production mode.
* @private
*/
var PolishedError = /*#__PURE__*/function (_Error) {
(0,inheritsLoose/* default */.A)(PolishedError, _Error);
function PolishedError(code) {
var _this;
if (true) {
_this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
} else { var _len2, args, _key2; }
return (0,assertThisInitialized/* default */.A)(_this);
}
return PolishedError;
}( /*#__PURE__*/_wrapNativeSuper(Error));
var unitRegExp = /((?!\w)a|na|hc|mc|dg|me[r]?|xe|ni(?![a-zA-Z])|mm|cp|tp|xp|q(?!s)|hv|xamv|nimv|wv|sm|s(?!\D|$)|ged|darg?|nrut)/g; // Merges additional math functionality into the defaults.
function mergeSymbolMaps(additionalSymbols) {
var symbolMap = {};
symbolMap.symbols = additionalSymbols ? _extends({}, defaultSymbolMap.symbols, additionalSymbols.symbols) : _extends({}, defaultSymbolMap.symbols);
return symbolMap;
}
function exec(operators, values) {
var _ref;
var op = operators.pop();
values.push(op.f.apply(op, (_ref = []).concat.apply(_ref, values.splice(-op.argCount))));
return op.precedence;
}
function calculate(expression, additionalSymbols) {
var symbolMap = mergeSymbolMaps(additionalSymbols);
var match;
var operators = [symbolMap.symbols['('].prefix];
var values = [];
var pattern = new RegExp( // Pattern for numbers
"\\d+(?:\\.\\d+)?|" + // ...and patterns for individual operators/function names
Object.keys(symbolMap.symbols).map(function (key) {
return symbolMap.symbols[key];
}) // longer symbols should be listed first
// $FlowFixMe
.sort(function (a, b) {
return b.symbol.length - a.symbol.length;
}) // $FlowFixMe
.map(function (val) {
return val.regSymbol;
}).join('|') + "|(\\S)", 'g');
pattern.lastIndex = 0; // Reset regular expression object
var afterValue = false;
do {
match = pattern.exec(expression);
var _ref2 = match || [')', undefined],
token = _ref2[0],
bad = _ref2[1];
var notNumber = symbolMap.symbols[token];
var notNewValue = notNumber && !notNumber.prefix && !notNumber.func;
var notAfterValue = !notNumber || !notNumber.postfix && !notNumber.infix; // Check for syntax errors:
if (bad || (afterValue ? notAfterValue : notNewValue)) {
throw new PolishedError(37, match ? match.index : expression.length, expression);
}
if (afterValue) {
// We either have an infix or postfix operator (they should be mutually exclusive)
var curr = notNumber.postfix || notNumber.infix;
do {
var prev = operators[operators.length - 1];
if ((curr.precedence - prev.precedence || prev.rightToLeft) > 0) break; // Apply previous operator, since it has precedence over current one
} while (exec(operators, values)); // Exit loop after executing an opening parenthesis or function
afterValue = curr.notation === 'postfix';
if (curr.symbol !== ')') {
operators.push(curr); // Postfix always has precedence over any operator that follows after it
if (afterValue) exec(operators, values);
}
} else if (notNumber) {
// prefix operator or function
operators.push(notNumber.prefix || notNumber.func);
if (notNumber.func) {
// Require an opening parenthesis
match = pattern.exec(expression);
if (!match || match[0] !== '(') {
throw new PolishedError(38, match ? match.index : expression.length, expression);
}
}
} else {
// number
values.push(+token);
afterValue = true;
}
} while (match && operators.length);
if (operators.length) {
throw new PolishedError(39, match ? match.index : expression.length, expression);
} else if (match) {
throw new PolishedError(40, match ? match.index : expression.length, expression);
} else {
return values.pop();
}
}
function reverseString(str) {
return str.split('').reverse().join('');
}
/**
* Helper for doing math with CSS Units. Accepts a formula as a string. All values in the formula must have the same unit (or be unitless). Supports complex formulas utliziing addition, subtraction, multiplication, division, square root, powers, factorial, min, max, as well as parentheses for order of operation.
*
*In cases where you need to do calculations with mixed units where one unit is a [relative length unit](https://developer.mozilla.org/en-US/docs/Web/CSS/length#Relative_length_units), you will want to use [CSS Calc](https://developer.mozilla.org/en-US/docs/Web/CSS/calc).
*
* *warning* While we've done everything possible to ensure math safely evalutes formulas expressed as strings, you should always use extreme caution when passing `math` user provided values.
* @example
* // Styles as object usage
* const styles = {
* fontSize: math('12rem + 8rem'),
* fontSize: math('(12px + 2px) * 3'),
* fontSize: math('3px^2 + sqrt(4)'),
* }
*
* // styled-components usage
* const div = styled.div`
* fontSize: ${math('12rem + 8rem')};
* fontSize: ${math('(12px + 2px) * 3')};
* fontSize: ${math('3px^2 + sqrt(4)')};
* `
*
* // CSS as JS Output
*
* div: {
* fontSize: '20rem',
* fontSize: '42px',
* fontSize: '11px',
* }
*/
function math(formula, additionalSymbols) {
var reversedFormula = reverseString(formula);
var formulaMatch = reversedFormula.match(unitRegExp); // Check that all units are the same
if (formulaMatch && !formulaMatch.every(function (unit) {
return unit === formulaMatch[0];
})) {
throw new PolishedError(41);
}
var cleanFormula = reverseString(reversedFormula.replace(unitRegExp, ''));
return "" + calculate(cleanFormula, additionalSymbols) + (formulaMatch ? reverseString(formulaMatch[0]) : '');
}
var cssVariableRegex = /--[\S]*/g;
/**
* Fetches the value of a passed CSS Variable in the :root scope, or otherwise returns a defaultValue if provided.
*
* @example
* // Styles as object usage
* const styles = {
* 'background': cssVar('--background-color'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${cssVar('--background-color')};
* `
*
* // CSS in JS Output
*
* element {
* 'background': 'red'
* }
*/
function cssVar(cssVariable, defaultValue) {
if (!cssVariable || !cssVariable.match(cssVariableRegex)) {
throw new PolishedError(73);
}
var variableValue;
/* eslint-disable */
/* istanbul ignore next */
if (typeof document !== 'undefined' && document.documentElement !== null) {
variableValue = getComputedStyle(document.documentElement).getPropertyValue(cssVariable);
}
/* eslint-enable */
if (variableValue) {
return variableValue.trim();
} else if (defaultValue) {
return defaultValue;
}
throw new PolishedError(74);
}
// @private
function capitalizeString(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
var positionMap$1 = (/* unused pure expression or super */ null && (['Top', 'Right', 'Bottom', 'Left']));
function generateProperty(property, position) {
if (!property) return position.toLowerCase();
var splitProperty = property.split('-');
if (splitProperty.length > 1) {
splitProperty.splice(1, 0, position);
return splitProperty.reduce(function (acc, val) {
return "" + acc + capitalizeString(val);
});
}
var joinedProperty = property.replace(/([a-z])([A-Z])/g, "$1" + position + "$2");
return property === joinedProperty ? "" + property + position : joinedProperty;
}
function generateStyles(property, valuesWithDefaults) {
var styles = {};
for (var i = 0; i < valuesWithDefaults.length; i += 1) {
if (valuesWithDefaults[i] || valuesWithDefaults[i] === 0) {
styles[generateProperty(property, positionMap$1[i])] = valuesWithDefaults[i];
}
}
return styles;
}
/**
* Enables shorthand for direction-based properties. It accepts a property (hyphenated or camelCased) and up to four values that map to top, right, bottom, and left, respectively. You can optionally pass an empty string to get only the directional values as properties. You can also optionally pass a null argument for a directional value to ignore it.
* @example
* // Styles as object usage
* const styles = {
* ...directionalProperty('padding', '12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${directionalProperty('padding', '12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'paddingTop': '12px',
* 'paddingRight': '24px',
* 'paddingBottom': '36px',
* 'paddingLeft': '48px'
* }
*/
function directionalProperty(property) {
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
values[_key - 1] = arguments[_key];
}
// prettier-ignore
var firstValue = values[0],
_values$ = values[1],
secondValue = _values$ === void 0 ? firstValue : _values$,
_values$2 = values[2],
thirdValue = _values$2 === void 0 ? firstValue : _values$2,
_values$3 = values[3],
fourthValue = _values$3 === void 0 ? secondValue : _values$3;
var valuesWithDefaults = [firstValue, secondValue, thirdValue, fourthValue];
return generateStyles(property, valuesWithDefaults);
}
/**
* Check if a string ends with something
* @private
*/
function endsWith(string, suffix) {
return string.substr(-suffix.length) === suffix;
}
var cssRegex$1 = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;
/**
* Returns a given CSS value minus its unit of measure.
*
* @example
* // Styles as object usage
* const styles = {
* '--dimension': stripUnit('100px')
* }
*
* // styled-components usage
* const div = styled.div`
* --dimension: ${stripUnit('100px')};
* `
*
* // CSS in JS Output
*
* element {
* '--dimension': 100
* }
*/
function stripUnit(value) {
if (typeof value !== 'string') return value;
var matchedValue = value.match(cssRegex$1);
return matchedValue ? parseFloat(value) : value;
}
/**
* Factory function that creates pixel-to-x converters
* @private
*/
var pxtoFactory = function pxtoFactory(to) {
return function (pxval, base) {
if (base === void 0) {
base = '16px';
}
var newPxval = pxval;
var newBase = base;
if (typeof pxval === 'string') {
if (!endsWith(pxval, 'px')) {
throw new PolishedError(69, to, pxval);
}
newPxval = stripUnit(pxval);
}
if (typeof base === 'string') {
if (!endsWith(base, 'px')) {
throw new PolishedError(70, to, base);
}
newBase = stripUnit(base);
}
if (typeof newPxval === 'string') {
throw new PolishedError(71, pxval, to);
}
if (typeof newBase === 'string') {
throw new PolishedError(72, base, to);
}
return "" + newPxval / newBase + to;
};
};
var pixelsto = (/* unused pure expression or super */ null && (pxtoFactory));
/**
* Convert pixel value to ems. The default base value is 16px, but can be changed by passing a
* second argument to the function.
* @function
* @param {string|number} pxval
* @param {string|number} [base='16px']
* @example
* // Styles as object usage
* const styles = {
* 'height': em('16px')
* }
*
* // styled-components usage
* const div = styled.div`
* height: ${em('16px')}
* `
*
* // CSS in JS Output
*
* element {
* 'height': '1em'
* }
*/
var em = /*#__PURE__*/(/* unused pure expression or super */ null && (pixelsto('em')));
var em$1 = (/* unused pure expression or super */ null && (em));
var cssRegex = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;
/**
* Returns a given CSS value and its unit as elements of an array.
*
* @example
* // Styles as object usage
* const styles = {
* '--dimension': getValueAndUnit('100px')[0],
* '--unit': getValueAndUnit('100px')[1],
* }
*
* // styled-components usage
* const div = styled.div`
* --dimension: ${getValueAndUnit('100px')[0]};
* --unit: ${getValueAndUnit('100px')[1]};
* `
*
* // CSS in JS Output
*
* element {
* '--dimension': 100,
* '--unit': 'px',
* }
*/
function getValueAndUnit(value) {
if (typeof value !== 'string') return [value, ''];
var matchedValue = value.match(cssRegex);
if (matchedValue) return [parseFloat(value), matchedValue[2]];
return [value, undefined];
}
/**
* Helper for targeting rules in a style block generated by polished modules that need !important-level specificity. Can optionally specify a rule (or rules) to target specific rules.
*
* @example
* // Styles as object usage
* const styles = {
* ...important(cover())
* }
*
* // styled-components usage
* const div = styled.div`
* ${important(cover())}
* `
*
* // CSS as JS Output
*
* div: {
* 'position': 'absolute !important',
* 'top': '0 !important',
* 'right: '0 !important',
* 'bottom': '0 !important',
* 'left: '0 !important'
* }
*/
function important(styleBlock, rules) {
if (typeof styleBlock !== 'object' || styleBlock === null) {
throw new PolishedError(75, typeof styleBlock);
}
var newStyleBlock = {};
Object.keys(styleBlock).forEach(function (key) {
if (typeof styleBlock[key] === 'object' && styleBlock[key] !== null) {
newStyleBlock[key] = important(styleBlock[key], rules);
} else if (!rules || rules && (rules === key || rules.indexOf(key) >= 0)) {
newStyleBlock[key] = styleBlock[key] + " !important";
} else {
newStyleBlock[key] = styleBlock[key];
}
});
return newStyleBlock;
}
var ratioNames = {
minorSecond: 1.067,
majorSecond: 1.125,
minorThird: 1.2,
majorThird: 1.25,
perfectFourth: 1.333,
augFourth: 1.414,
perfectFifth: 1.5,
minorSixth: 1.6,
goldenSection: 1.618,
majorSixth: 1.667,
minorSeventh: 1.778,
majorSeventh: 1.875,
octave: 2,
majorTenth: 2.5,
majorEleventh: 2.667,
majorTwelfth: 3,
doubleOctave: 4
};
function getRatio(ratioName) {
return ratioNames[ratioName];
}
/**
* Establish consistent measurements and spacial relationships throughout your projects by incrementing an em or rem value up or down a defined scale. We provide a list of commonly used scales as pre-defined variables.
* @example
* // Styles as object usage
* const styles = {
* // Increment two steps up the default scale
* 'fontSize': modularScale(2)
* }
*
* // styled-components usage
* const div = styled.div`
* // Increment two steps up the default scale
* fontSize: ${modularScale(2)}
* `
*
* // CSS in JS Output
*
* element {
* 'fontSize': '1.77689em'
* }
*/
function modularScale(steps, base, ratio) {
if (base === void 0) {
base = '1em';
}
if (ratio === void 0) {
ratio = 1.333;
}
if (typeof steps !== 'number') {
throw new PolishedError(42);
}
if (typeof ratio === 'string' && !ratioNames[ratio]) {
throw new PolishedError(43);
}
var _ref = typeof base === 'string' ? getValueAndUnit(base) : [base, ''],
realBase = _ref[0],
unit = _ref[1];
var realRatio = typeof ratio === 'string' ? getRatio(ratio) : ratio;
if (typeof realBase === 'string') {
throw new PolishedError(44, base);
}
return "" + realBase * Math.pow(realRatio, steps) + (unit || '');
}
/**
* Convert pixel value to rems. The default base value is 16px, but can be changed by passing a
* second argument to the function.
* @function
* @param {string|number} pxval
* @param {string|number} [base='16px']
* @example
* // Styles as object usage
* const styles = {
* 'height': rem('16px')
* }
*
* // styled-components usage
* const div = styled.div`
* height: ${rem('16px')}
* `
*
* // CSS in JS Output
*
* element {
* 'height': '1rem'
* }
*/
var rem = /*#__PURE__*/(/* unused pure expression or super */ null && (pixelsto('rem')));
var rem$1 = (/* unused pure expression or super */ null && (rem));
var defaultFontSize = 16;
function convertBase(base) {
var deconstructedValue = getValueAndUnit(base);
if (deconstructedValue[1] === 'px') {
return parseFloat(base);
}
if (deconstructedValue[1] === '%') {
return parseFloat(base) / 100 * defaultFontSize;
}
throw new PolishedError(78, deconstructedValue[1]);
}
function getBaseFromDoc() {
/* eslint-disable */
/* istanbul ignore next */
if (typeof document !== 'undefined' && document.documentElement !== null) {
var rootFontSize = getComputedStyle(document.documentElement).fontSize;
return rootFontSize ? convertBase(rootFontSize) : defaultFontSize;
}
/* eslint-enable */
/* istanbul ignore next */
return defaultFontSize;
}
/**
* Convert rem values to px. By default, the base value is pulled from the font-size property on the root element (if it is set in % or px). It defaults to 16px if not found on the root. You can also override the base value by providing your own base in % or px.
* @example
* // Styles as object usage
* const styles = {
* 'height': remToPx('1.6rem')
* 'height': remToPx('1.6rem', '10px')
* }
*
* // styled-components usage
* const div = styled.div`
* height: ${remToPx('1.6rem')}
* height: ${remToPx('1.6rem', '10px')}
* `
*
* // CSS in JS Output
*
* element {
* 'height': '25.6px',
* 'height': '16px',
* }
*/
function remToPx(value, base) {
var deconstructedValue = getValueAndUnit(value);
if (deconstructedValue[1] !== 'rem' && deconstructedValue[1] !== '') {
throw new PolishedError(77, deconstructedValue[1]);
}
var newBase = base ? convertBase(base) : getBaseFromDoc();
return deconstructedValue[0] * newBase + "px";
}
var functionsMap$3 = {
back: 'cubic-bezier(0.600, -0.280, 0.735, 0.045)',
circ: 'cubic-bezier(0.600, 0.040, 0.980, 0.335)',
cubic: 'cubic-bezier(0.550, 0.055, 0.675, 0.190)',
expo: 'cubic-bezier(0.950, 0.050, 0.795, 0.035)',
quad: 'cubic-bezier(0.550, 0.085, 0.680, 0.530)',
quart: 'cubic-bezier(0.895, 0.030, 0.685, 0.220)',
quint: 'cubic-bezier(0.755, 0.050, 0.855, 0.060)',
sine: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)'
};
/**
* String to represent common easing functions as demonstrated here: (github.com/jaukia/easie).
*
* @example
* // Styles as object usage
* const styles = {
* 'transitionTimingFunction': easeIn('quad')
* }
*
* // styled-components usage
* const div = styled.div`
* transitionTimingFunction: ${easeIn('quad')};
* `
*
* // CSS as JS Output
*
* 'div': {
* 'transitionTimingFunction': 'cubic-bezier(0.550, 0.085, 0.680, 0.530)',
* }
*/
function easeIn(functionName) {
return functionsMap$3[functionName.toLowerCase().trim()];
}
var functionsMap$2 = {
back: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)',
circ: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)',
cubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)',
expo: 'cubic-bezier(1.000, 0.000, 0.000, 1.000)',
quad: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)',
quart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)',
quint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)',
sine: 'cubic-bezier(0.445, 0.050, 0.550, 0.950)'
};
/**
* String to represent common easing functions as demonstrated here: (github.com/jaukia/easie).
*
* @example
* // Styles as object usage
* const styles = {
* 'transitionTimingFunction': easeInOut('quad')
* }
*
* // styled-components usage
* const div = styled.div`
* transitionTimingFunction: ${easeInOut('quad')};
* `
*
* // CSS as JS Output
*
* 'div': {
* 'transitionTimingFunction': 'cubic-bezier(0.455, 0.030, 0.515, 0.955)',
* }
*/
function easeInOut(functionName) {
return functionsMap$2[functionName.toLowerCase().trim()];
}
var functionsMap$1 = {
back: 'cubic-bezier(0.175, 0.885, 0.320, 1.275)',
cubic: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)',
circ: 'cubic-bezier(0.075, 0.820, 0.165, 1.000)',
expo: 'cubic-bezier(0.190, 1.000, 0.220, 1.000)',
quad: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
quart: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)',
quint: 'cubic-bezier(0.230, 1.000, 0.320, 1.000)',
sine: 'cubic-bezier(0.390, 0.575, 0.565, 1.000)'
};
/**
* String to represent common easing functions as demonstrated here: (github.com/jaukia/easie).
*
* @example
* // Styles as object usage
* const styles = {
* 'transitionTimingFunction': easeOut('quad')
* }
*
* // styled-components usage
* const div = styled.div`
* transitionTimingFunction: ${easeOut('quad')};
* `
*
* // CSS as JS Output
*
* 'div': {
* 'transitionTimingFunction': 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
* }
*/
function easeOut(functionName) {
return functionsMap$1[functionName.toLowerCase().trim()];
}
/**
* Returns a CSS calc formula for linear interpolation of a property between two values. Accepts optional minScreen (defaults to '320px') and maxScreen (defaults to '1200px').
*
* @example
* // Styles as object usage
* const styles = {
* fontSize: between('20px', '100px', '400px', '1000px'),
* fontSize: between('20px', '100px')
* }
*
* // styled-components usage
* const div = styled.div`
* fontSize: ${between('20px', '100px', '400px', '1000px')};
* fontSize: ${between('20px', '100px')}
* `
*
* // CSS as JS Output
*
* h1: {
* 'fontSize': 'calc(-33.33333333333334px + 13.333333333333334vw)',
* 'fontSize': 'calc(-9.090909090909093px + 9.090909090909092vw)'
* }
*/
function between(fromSize, toSize, minScreen, maxScreen) {
if (minScreen === void 0) {
minScreen = '320px';
}
if (maxScreen === void 0) {
maxScreen = '1200px';
}
var _getValueAndUnit = getValueAndUnit(fromSize),
unitlessFromSize = _getValueAndUnit[0],
fromSizeUnit = _getValueAndUnit[1];
var _getValueAndUnit2 = getValueAndUnit(toSize),
unitlessToSize = _getValueAndUnit2[0],
toSizeUnit = _getValueAndUnit2[1];
var _getValueAndUnit3 = getValueAndUnit(minScreen),
unitlessMinScreen = _getValueAndUnit3[0],
minScreenUnit = _getValueAndUnit3[1];
var _getValueAndUnit4 = getValueAndUnit(maxScreen),
unitlessMaxScreen = _getValueAndUnit4[0],
maxScreenUnit = _getValueAndUnit4[1];
if (typeof unitlessMinScreen !== 'number' || typeof unitlessMaxScreen !== 'number' || !minScreenUnit || !maxScreenUnit || minScreenUnit !== maxScreenUnit) {
throw new PolishedError(47);
}
if (typeof unitlessFromSize !== 'number' || typeof unitlessToSize !== 'number' || fromSizeUnit !== toSizeUnit) {
throw new PolishedError(48);
}
if (fromSizeUnit !== minScreenUnit || toSizeUnit !== maxScreenUnit) {
throw new PolishedError(76);
}
var slope = (unitlessFromSize - unitlessToSize) / (unitlessMinScreen - unitlessMaxScreen);
var base = unitlessToSize - slope * unitlessMaxScreen;
return "calc(" + base.toFixed(2) + (fromSizeUnit || '') + " + " + (100 * slope).toFixed(2) + "vw)";
}
/**
* CSS to contain a float (credit to CSSMojo).
*
* @example
* // Styles as object usage
* const styles = {
* ...clearFix(),
* }
*
* // styled-components usage
* const div = styled.div`
* ${clearFix()}
* `
*
* // CSS as JS Output
*
* '&::after': {
* 'clear': 'both',
* 'content': '""',
* 'display': 'table'
* }
*/
function clearFix(parent) {
var _ref;
if (parent === void 0) {
parent = '&';
}
var pseudoSelector = parent + "::after";
return _ref = {}, _ref[pseudoSelector] = {
clear: 'both',
content: '""',
display: 'table'
}, _ref;
}
/**
* CSS to fully cover an area. Can optionally be passed an offset to act as a "padding".
*
* @example
* // Styles as object usage
* const styles = {
* ...cover()
* }
*
* // styled-components usage
* const div = styled.div`
* ${cover()}
* `
*
* // CSS as JS Output
*
* div: {
* 'position': 'absolute',
* 'top': '0',
* 'right: '0',
* 'bottom': '0',
* 'left: '0'
* }
*/
function cover(offset) {
if (offset === void 0) {
offset = 0;
}
return {
position: 'absolute',
top: offset,
right: offset,
bottom: offset,
left: offset
};
}
/**
* CSS to represent truncated text with an ellipsis. You can optionally pass a max-width and number of lines before truncating.
*
* @example
* // Styles as object usage
* const styles = {
* ...ellipsis('250px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${ellipsis('250px')}
* `
*
* // CSS as JS Output
*
* div: {
* 'display': 'inline-block',
* 'maxWidth': '250px',
* 'overflow': 'hidden',
* 'textOverflow': 'ellipsis',
* 'whiteSpace': 'nowrap',
* 'wordWrap': 'normal'
* }
*/
function ellipsis(width, lines) {
if (lines === void 0) {
lines = 1;
}
var styles = {
display: 'inline-block',
maxWidth: width || '100%',
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
wordWrap: 'normal'
};
return lines > 1 ? _extends({}, styles, {
WebkitBoxOrient: 'vertical',
WebkitLineClamp: lines,
display: '-webkit-box',
whiteSpace: 'normal'
}) : styles;
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
/**
* Returns a set of media queries that resizes a property (or set of properties) between a provided fromSize and toSize. Accepts optional minScreen (defaults to '320px') and maxScreen (defaults to '1200px') to constrain the interpolation.
*
* @example
* // Styles as object usage
* const styles = {
* ...fluidRange(
* {
* prop: 'padding',
* fromSize: '20px',
* toSize: '100px',
* },
* '400px',
* '1000px',
* )
* }
*
* // styled-components usage
* const div = styled.div`
* ${fluidRange(
* {
* prop: 'padding',
* fromSize: '20px',
* toSize: '100px',
* },
* '400px',
* '1000px',
* )}
* `
*
* // CSS as JS Output
*
* div: {
* "@media (min-width: 1000px)": Object {
* "padding": "100px",
* },
* "@media (min-width: 400px)": Object {
* "padding": "calc(-33.33333333333334px + 13.333333333333334vw)",
* },
* "padding": "20px",
* }
*/
function fluidRange(cssProp, minScreen, maxScreen) {
if (minScreen === void 0) {
minScreen = '320px';
}
if (maxScreen === void 0) {
maxScreen = '1200px';
}
if (!Array.isArray(cssProp) && typeof cssProp !== 'object' || cssProp === null) {
throw new PolishedError(49);
}
if (Array.isArray(cssProp)) {
var mediaQueries = {};
var fallbacks = {};
for (var _iterator = _createForOfIteratorHelperLoose(cssProp), _step; !(_step = _iterator()).done;) {
var _extends2, _extends3;
var obj = _step.value;
if (!obj.prop || !obj.fromSize || !obj.toSize) {
throw new PolishedError(50);
}
fallbacks[obj.prop] = obj.fromSize;
mediaQueries["@media (min-width: " + minScreen + ")"] = _extends({}, mediaQueries["@media (min-width: " + minScreen + ")"], (_extends2 = {}, _extends2[obj.prop] = between(obj.fromSize, obj.toSize, minScreen, maxScreen), _extends2));
mediaQueries["@media (min-width: " + maxScreen + ")"] = _extends({}, mediaQueries["@media (min-width: " + maxScreen + ")"], (_extends3 = {}, _extends3[obj.prop] = obj.toSize, _extends3));
}
return _extends({}, fallbacks, mediaQueries);
} else {
var _ref, _ref2, _ref3;
if (!cssProp.prop || !cssProp.fromSize || !cssProp.toSize) {
throw new PolishedError(51);
}
return _ref3 = {}, _ref3[cssProp.prop] = cssProp.fromSize, _ref3["@media (min-width: " + minScreen + ")"] = (_ref = {}, _ref[cssProp.prop] = between(cssProp.fromSize, cssProp.toSize, minScreen, maxScreen), _ref), _ref3["@media (min-width: " + maxScreen + ")"] = (_ref2 = {}, _ref2[cssProp.prop] = cssProp.toSize, _ref2), _ref3;
}
}
var dataURIRegex = /^\s*data:([a-z]+\/[a-z-]+(;[a-z-]+=[a-z-]+)?)?(;charset=[a-z0-9-]+)?(;base64)?,[a-z0-9!$&',()*+,;=\-._~:@/?%\s]*\s*$/i;
var formatHintMap = {
woff: 'woff',
woff2: 'woff2',
ttf: 'truetype',
otf: 'opentype',
eot: 'embedded-opentype',
svg: 'svg',
svgz: 'svg'
};
function generateFormatHint(format, formatHint) {
if (!formatHint) return '';
return " format(\"" + formatHintMap[format] + "\")";
}
function isDataURI(fontFilePath) {
return !!fontFilePath.replace(/\s+/g, ' ').match(dataURIRegex);
}
function generateFileReferences(fontFilePath, fileFormats, formatHint) {
if (isDataURI(fontFilePath)) {
return "url(\"" + fontFilePath + "\")" + generateFormatHint(fileFormats[0], formatHint);
}
var fileFontReferences = fileFormats.map(function (format) {
return "url(\"" + fontFilePath + "." + format + "\")" + generateFormatHint(format, formatHint);
});
return fileFontReferences.join(', ');
}
function generateLocalReferences(localFonts) {
var localFontReferences = localFonts.map(function (font) {
return "local(\"" + font + "\")";
});
return localFontReferences.join(', ');
}
function generateSources(fontFilePath, localFonts, fileFormats, formatHint) {
var fontReferences = [];
if (localFonts) fontReferences.push(generateLocalReferences(localFonts));
if (fontFilePath) {
fontReferences.push(generateFileReferences(fontFilePath, fileFormats, formatHint));
}
return fontReferences.join(', ');
}
/**
* CSS for a @font-face declaration. Defaults to check for local copies of the font on the user's machine. You can disable this by passing `null` to localFonts.
*
* @example
* // Styles as object basic usage
* const styles = {
* ...fontFace({
* 'fontFamily': 'Sans-Pro',
* 'fontFilePath': 'path/to/file'
* })
* }
*
* // styled-components basic usage
* const GlobalStyle = createGlobalStyle`${
* fontFace({
* 'fontFamily': 'Sans-Pro',
* 'fontFilePath': 'path/to/file'
* }
* )}`
*
* // CSS as JS Output
*
* '@font-face': {
* 'fontFamily': 'Sans-Pro',
* 'src': 'url("path/to/file.eot"), url("path/to/file.woff2"), url("path/to/file.woff"), url("path/to/file.ttf"), url("path/to/file.svg")',
* }
*/
function fontFace(_ref) {
var fontFamily = _ref.fontFamily,
fontFilePath = _ref.fontFilePath,
fontStretch = _ref.fontStretch,
fontStyle = _ref.fontStyle,
fontVariant = _ref.fontVariant,
fontWeight = _ref.fontWeight,
_ref$fileFormats = _ref.fileFormats,
fileFormats = _ref$fileFormats === void 0 ? ['eot', 'woff2', 'woff', 'ttf', 'svg'] : _ref$fileFormats,
_ref$formatHint = _ref.formatHint,
formatHint = _ref$formatHint === void 0 ? false : _ref$formatHint,
_ref$localFonts = _ref.localFonts,
localFonts = _ref$localFonts === void 0 ? [fontFamily] : _ref$localFonts,
unicodeRange = _ref.unicodeRange,
fontDisplay = _ref.fontDisplay,
fontVariationSettings = _ref.fontVariationSettings,
fontFeatureSettings = _ref.fontFeatureSettings;
// Error Handling
if (!fontFamily) throw new PolishedError(55);
if (!fontFilePath && !localFonts) {
throw new PolishedError(52);
}
if (localFonts && !Array.isArray(localFonts)) {
throw new PolishedError(53);
}
if (!Array.isArray(fileFormats)) {
throw new PolishedError(54);
}
var fontFaceDeclaration = {
'@font-face': {
fontFamily: fontFamily,
src: generateSources(fontFilePath, localFonts, fileFormats, formatHint),
unicodeRange: unicodeRange,
fontStretch: fontStretch,
fontStyle: fontStyle,
fontVariant: fontVariant,
fontWeight: fontWeight,
fontDisplay: fontDisplay,
fontVariationSettings: fontVariationSettings,
fontFeatureSettings: fontFeatureSettings
}
}; // Removes undefined fields for cleaner css object.
return JSON.parse(JSON.stringify(fontFaceDeclaration));
}
/**
* CSS to hide text to show a background image in a SEO-friendly way.
*
* @example
* // Styles as object usage
* const styles = {
* 'backgroundImage': 'url(logo.png)',
* ...hideText(),
* }
*
* // styled-components usage
* const div = styled.div`
* backgroundImage: url(logo.png);
* ${hideText()};
* `
*
* // CSS as JS Output
*
* 'div': {
* 'backgroundImage': 'url(logo.png)',
* 'textIndent': '101%',
* 'overflow': 'hidden',
* 'whiteSpace': 'nowrap',
* }
*/
function hideText() {
return {
textIndent: '101%',
overflow: 'hidden',
whiteSpace: 'nowrap'
};
}
/**
* CSS to hide content visually but remain accessible to screen readers.
* from [HTML5 Boilerplate](https://github.com/h5bp/html5-boilerplate/blob/9a176f57af1cfe8ec70300da4621fb9b07e5fa31/src/css/main.css#L121)
*
* @example
* // Styles as object usage
* const styles = {
* ...hideVisually(),
* }
*
* // styled-components usage
* const div = styled.div`
* ${hideVisually()};
* `
*
* // CSS as JS Output
*
* 'div': {
* 'border': '0',
* 'clip': 'rect(0 0 0 0)',
* 'height': '1px',
* 'margin': '-1px',
* 'overflow': 'hidden',
* 'padding': '0',
* 'position': 'absolute',
* 'whiteSpace': 'nowrap',
* 'width': '1px',
* }
*/
function hideVisually() {
return {
border: '0',
clip: 'rect(0 0 0 0)',
height: '1px',
margin: '-1px',
overflow: 'hidden',
padding: '0',
position: 'absolute',
whiteSpace: 'nowrap',
width: '1px'
};
}
/**
* Generates a media query to target HiDPI devices.
*
* @example
* // Styles as object usage
* const styles = {
* [hiDPI(1.5)]: {
* width: 200px;
* }
* }
*
* // styled-components usage
* const div = styled.div`
* ${hiDPI(1.5)} {
* width: 200px;
* }
* `
*
* // CSS as JS Output
*
* '@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
* only screen and (min--moz-device-pixel-ratio: 1.5),
* only screen and (-o-min-device-pixel-ratio: 1.5/1),
* only screen and (min-resolution: 144dpi),
* only screen and (min-resolution: 1.5dppx)': {
* 'width': '200px',
* }
*/
function hiDPI(ratio) {
if (ratio === void 0) {
ratio = 1.3;
}
return "\n @media only screen and (-webkit-min-device-pixel-ratio: " + ratio + "),\n only screen and (min--moz-device-pixel-ratio: " + ratio + "),\n only screen and (-o-min-device-pixel-ratio: " + ratio + "/1),\n only screen and (min-resolution: " + Math.round(ratio * 96) + "dpi),\n only screen and (min-resolution: " + ratio + "dppx)\n ";
}
function constructGradientValue(literals) {
var template = '';
for (var _len = arguments.length, substitutions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
substitutions[_key - 1] = arguments[_key];
}
for (var i = 0; i < literals.length; i += 1) {
template += literals[i];
if (i === substitutions.length - 1 && substitutions[i]) {
var definedValues = substitutions.filter(function (substitute) {
return !!substitute;
}); // Adds leading coma if properties preceed color-stops
if (definedValues.length > 1) {
template = template.slice(0, -1);
template += ", " + substitutions[i]; // No trailing space if color-stops is the only param provided
} else if (definedValues.length === 1) {
template += "" + substitutions[i];
}
} else if (substitutions[i]) {
template += substitutions[i] + " ";
}
}
return template.trim();
}
var _templateObject$1;
/**
* CSS for declaring a linear gradient, including a fallback background-color. The fallback is either the first color-stop or an explicitly passed fallback color.
*
* @example
* // Styles as object usage
* const styles = {
* ...linearGradient({
colorStops: ['#00FFFF 0%', 'rgba(0, 0, 255, 0) 50%', '#0000FF 95%'],
toDirection: 'to top right',
fallback: '#FFF',
})
* }
*
* // styled-components usage
* const div = styled.div`
* ${linearGradient({
colorStops: ['#00FFFF 0%', 'rgba(0, 0, 255, 0) 50%', '#0000FF 95%'],
toDirection: 'to top right',
fallback: '#FFF',
})}
*`
*
* // CSS as JS Output
*
* div: {
* 'backgroundColor': '#FFF',
* 'backgroundImage': 'linear-gradient(to top right, #00FFFF 0%, rgba(0, 0, 255, 0) 50%, #0000FF 95%)',
* }
*/
function linearGradient(_ref) {
var colorStops = _ref.colorStops,
fallback = _ref.fallback,
_ref$toDirection = _ref.toDirection,
toDirection = _ref$toDirection === void 0 ? '' : _ref$toDirection;
if (!colorStops || colorStops.length < 2) {
throw new PolishedError(56);
}
return {
backgroundColor: fallback || colorStops[0].replace(/,\s+/g, ',').split(' ')[0].replace(/,(?=\S)/g, ', '),
backgroundImage: constructGradientValue(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["linear-gradient(", "", ")"])), toDirection, colorStops.join(', ').replace(/,(?=\S)/g, ', '))
};
}
/**
* CSS to normalize abnormalities across browsers (normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css)
*
* @example
* // Styles as object usage
* const styles = {
* ...normalize(),
* }
*
* // styled-components usage
* const GlobalStyle = createGlobalStyle`${normalize()}`
*
* // CSS as JS Output
*
* html {
* lineHeight: 1.15,
* textSizeAdjust: 100%,
* } ...
*/
function normalize() {
var _ref;
return [(_ref = {
html: {
lineHeight: '1.15',
textSizeAdjust: '100%'
},
body: {
margin: '0'
},
main: {
display: 'block'
},
h1: {
fontSize: '2em',
margin: '0.67em 0'
},
hr: {
boxSizing: 'content-box',
height: '0',
overflow: 'visible'
},
pre: {
fontFamily: 'monospace, monospace',
fontSize: '1em'
},
a: {
backgroundColor: 'transparent'
},
'abbr[title]': {
borderBottom: 'none',
textDecoration: 'underline'
}
}, _ref["b,\n strong"] = {
fontWeight: 'bolder'
}, _ref["code,\n kbd,\n samp"] = {
fontFamily: 'monospace, monospace',
fontSize: '1em'
}, _ref.small = {
fontSize: '80%'
}, _ref["sub,\n sup"] = {
fontSize: '75%',
lineHeight: '0',
position: 'relative',
verticalAlign: 'baseline'
}, _ref.sub = {
bottom: '-0.25em'
}, _ref.sup = {
top: '-0.5em'
}, _ref.img = {
borderStyle: 'none'
}, _ref["button,\n input,\n optgroup,\n select,\n textarea"] = {
fontFamily: 'inherit',
fontSize: '100%',
lineHeight: '1.15',
margin: '0'
}, _ref["button,\n input"] = {
overflow: 'visible'
}, _ref["button,\n select"] = {
textTransform: 'none'
}, _ref["button,\n html [type=\"button\"],\n [type=\"reset\"],\n [type=\"submit\"]"] = {
WebkitAppearance: 'button'
}, _ref["button::-moz-focus-inner,\n [type=\"button\"]::-moz-focus-inner,\n [type=\"reset\"]::-moz-focus-inner,\n [type=\"submit\"]::-moz-focus-inner"] = {
borderStyle: 'none',
padding: '0'
}, _ref["button:-moz-focusring,\n [type=\"button\"]:-moz-focusring,\n [type=\"reset\"]:-moz-focusring,\n [type=\"submit\"]:-moz-focusring"] = {
outline: '1px dotted ButtonText'
}, _ref.fieldset = {
padding: '0.35em 0.625em 0.75em'
}, _ref.legend = {
boxSizing: 'border-box',
color: 'inherit',
display: 'table',
maxWidth: '100%',
padding: '0',
whiteSpace: 'normal'
}, _ref.progress = {
verticalAlign: 'baseline'
}, _ref.textarea = {
overflow: 'auto'
}, _ref["[type=\"checkbox\"],\n [type=\"radio\"]"] = {
boxSizing: 'border-box',
padding: '0'
}, _ref["[type=\"number\"]::-webkit-inner-spin-button,\n [type=\"number\"]::-webkit-outer-spin-button"] = {
height: 'auto'
}, _ref['[type="search"]'] = {
WebkitAppearance: 'textfield',
outlineOffset: '-2px'
}, _ref['[type="search"]::-webkit-search-decoration'] = {
WebkitAppearance: 'none'
}, _ref['::-webkit-file-upload-button'] = {
WebkitAppearance: 'button',
font: 'inherit'
}, _ref.details = {
display: 'block'
}, _ref.summary = {
display: 'list-item'
}, _ref.template = {
display: 'none'
}, _ref['[hidden]'] = {
display: 'none'
}, _ref), {
'abbr[title]': {
textDecoration: 'underline dotted'
}
}];
}
var _templateObject;
/**
* CSS for declaring a radial gradient, including a fallback background-color. The fallback is either the first color-stop or an explicitly passed fallback color.
*
* @example
* // Styles as object usage
* const styles = {
* ...radialGradient({
* colorStops: ['#00FFFF 0%', 'rgba(0, 0, 255, 0) 50%', '#0000FF 95%'],
* extent: 'farthest-corner at 45px 45px',
* position: 'center',
* shape: 'ellipse',
* })
* }
*
* // styled-components usage
* const div = styled.div`
* ${radialGradient({
* colorStops: ['#00FFFF 0%', 'rgba(0, 0, 255, 0) 50%', '#0000FF 95%'],
* extent: 'farthest-corner at 45px 45px',
* position: 'center',
* shape: 'ellipse',
* })}
*`
*
* // CSS as JS Output
*
* div: {
* 'backgroundColor': '#00FFFF',
* 'backgroundImage': 'radial-gradient(center ellipse farthest-corner at 45px 45px, #00FFFF 0%, rgba(0, 0, 255, 0) 50%, #0000FF 95%)',
* }
*/
function radialGradient(_ref) {
var colorStops = _ref.colorStops,
_ref$extent = _ref.extent,
extent = _ref$extent === void 0 ? '' : _ref$extent,
fallback = _ref.fallback,
_ref$position = _ref.position,
position = _ref$position === void 0 ? '' : _ref$position,
_ref$shape = _ref.shape,
shape = _ref$shape === void 0 ? '' : _ref$shape;
if (!colorStops || colorStops.length < 2) {
throw new PolishedError(57);
}
return {
backgroundColor: fallback || colorStops[0].split(' ')[0],
backgroundImage: constructGradientValue(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["radial-gradient(", "", "", "", ")"])), position, shape, extent, colorStops.join(', '))
};
}
/**
* A helper to generate a retina background image and non-retina
* background image. The retina background image will output to a HiDPI media query. The mixin uses
* a _2x.png filename suffix by default.
*
* @example
* // Styles as object usage
* const styles = {
* ...retinaImage('my-img')
* }
*
* // styled-components usage
* const div = styled.div`
* ${retinaImage('my-img')}
* `
*
* // CSS as JS Output
* div {
* backgroundImage: 'url(my-img.png)',
* '@media only screen and (-webkit-min-device-pixel-ratio: 1.3),
* only screen and (min--moz-device-pixel-ratio: 1.3),
* only screen and (-o-min-device-pixel-ratio: 1.3/1),
* only screen and (min-resolution: 144dpi),
* only screen and (min-resolution: 1.5dppx)': {
* backgroundImage: 'url(my-img_2x.png)',
* }
* }
*/
function retinaImage(filename, backgroundSize, extension, retinaFilename, retinaSuffix) {
var _ref;
if (extension === void 0) {
extension = 'png';
}
if (retinaSuffix === void 0) {
retinaSuffix = '_2x';
}
if (!filename) {
throw new PolishedError(58);
} // Replace the dot at the beginning of the passed extension if one exists
var ext = extension.replace(/^\./, '');
var rFilename = retinaFilename ? retinaFilename + "." + ext : "" + filename + retinaSuffix + "." + ext;
return _ref = {
backgroundImage: "url(" + filename + "." + ext + ")"
}, _ref[hiDPI()] = _extends({
backgroundImage: "url(" + rFilename + ")"
}, backgroundSize ? {
backgroundSize: backgroundSize
} : {}), _ref;
}
/* eslint-disable key-spacing */
var functionsMap = {
easeInBack: 'cubic-bezier(0.600, -0.280, 0.735, 0.045)',
easeInCirc: 'cubic-bezier(0.600, 0.040, 0.980, 0.335)',
easeInCubic: 'cubic-bezier(0.550, 0.055, 0.675, 0.190)',
easeInExpo: 'cubic-bezier(0.950, 0.050, 0.795, 0.035)',
easeInQuad: 'cubic-bezier(0.550, 0.085, 0.680, 0.530)',
easeInQuart: 'cubic-bezier(0.895, 0.030, 0.685, 0.220)',
easeInQuint: 'cubic-bezier(0.755, 0.050, 0.855, 0.060)',
easeInSine: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)',
easeOutBack: 'cubic-bezier(0.175, 0.885, 0.320, 1.275)',
easeOutCubic: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)',
easeOutCirc: 'cubic-bezier(0.075, 0.820, 0.165, 1.000)',
easeOutExpo: 'cubic-bezier(0.190, 1.000, 0.220, 1.000)',
easeOutQuad: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
easeOutQuart: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)',
easeOutQuint: 'cubic-bezier(0.230, 1.000, 0.320, 1.000)',
easeOutSine: 'cubic-bezier(0.390, 0.575, 0.565, 1.000)',
easeInOutBack: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)',
easeInOutCirc: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)',
easeInOutCubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)',
easeInOutExpo: 'cubic-bezier(1.000, 0.000, 0.000, 1.000)',
easeInOutQuad: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)',
easeInOutQuart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)',
easeInOutQuint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)',
easeInOutSine: 'cubic-bezier(0.445, 0.050, 0.550, 0.950)'
};
/* eslint-enable key-spacing */
function getTimingFunction(functionName) {
return functionsMap[functionName];
}
/**
* String to represent common easing functions as demonstrated here: (github.com/jaukia/easie).
*
* @deprecated - This will be deprecated in v5 in favor of `easeIn`, `easeOut`, `easeInOut`.
*
* @example
* // Styles as object usage
* const styles = {
* 'transitionTimingFunction': timingFunctions('easeInQuad')
* }
*
* // styled-components usage
* const div = styled.div`
* transitionTimingFunction: ${timingFunctions('easeInQuad')};
* `
*
* // CSS as JS Output
*
* 'div': {
* 'transitionTimingFunction': 'cubic-bezier(0.550, 0.085, 0.680, 0.530)',
* }
*/
function timingFunctions(timingFunction) {
return getTimingFunction(timingFunction);
}
var getBorderWidth = function getBorderWidth(pointingDirection, height, width) {
var fullWidth = "" + width[0] + (width[1] || '');
var halfWidth = "" + width[0] / 2 + (width[1] || '');
var fullHeight = "" + height[0] + (height[1] || '');
var halfHeight = "" + height[0] / 2 + (height[1] || '');
switch (pointingDirection) {
case 'top':
return "0 " + halfWidth + " " + fullHeight + " " + halfWidth;
case 'topLeft':
return fullWidth + " " + fullHeight + " 0 0";
case 'left':
return halfHeight + " " + fullWidth + " " + halfHeight + " 0";
case 'bottomLeft':
return fullWidth + " 0 0 " + fullHeight;
case 'bottom':
return fullHeight + " " + halfWidth + " 0 " + halfWidth;
case 'bottomRight':
return "0 0 " + fullWidth + " " + fullHeight;
case 'right':
return halfHeight + " 0 " + halfHeight + " " + fullWidth;
case 'topRight':
default:
return "0 " + fullWidth + " " + fullHeight + " 0";
}
};
var getBorderColor = function getBorderColor(pointingDirection, foregroundColor) {
switch (pointingDirection) {
case 'top':
case 'bottomRight':
return {
borderBottomColor: foregroundColor
};
case 'right':
case 'bottomLeft':
return {
borderLeftColor: foregroundColor
};
case 'bottom':
case 'topLeft':
return {
borderTopColor: foregroundColor
};
case 'left':
case 'topRight':
return {
borderRightColor: foregroundColor
};
default:
throw new PolishedError(59);
}
};
/**
* CSS to represent triangle with any pointing direction with an optional background color.
*
* @example
* // Styles as object usage
*
* const styles = {
* ...triangle({ pointingDirection: 'right', width: '100px', height: '100px', foregroundColor: 'red' })
* }
*
*
* // styled-components usage
* const div = styled.div`
* ${triangle({ pointingDirection: 'right', width: '100px', height: '100px', foregroundColor: 'red' })}
*
*
* // CSS as JS Output
*
* div: {
* 'borderColor': 'transparent transparent transparent red',
* 'borderStyle': 'solid',
* 'borderWidth': '50px 0 50px 100px',
* 'height': '0',
* 'width': '0',
* }
*/
function triangle(_ref) {
var pointingDirection = _ref.pointingDirection,
height = _ref.height,
width = _ref.width,
foregroundColor = _ref.foregroundColor,
_ref$backgroundColor = _ref.backgroundColor,
backgroundColor = _ref$backgroundColor === void 0 ? 'transparent' : _ref$backgroundColor;
var widthAndUnit = getValueAndUnit(width);
var heightAndUnit = getValueAndUnit(height);
if (isNaN(heightAndUnit[0]) || isNaN(widthAndUnit[0])) {
throw new PolishedError(60);
}
return _extends({
width: '0',
height: '0',
borderColor: backgroundColor
}, getBorderColor(pointingDirection, foregroundColor), {
borderStyle: 'solid',
borderWidth: getBorderWidth(pointingDirection, heightAndUnit, widthAndUnit)
});
}
/**
* Provides an easy way to change the `wordWrap` property.
*
* @example
* // Styles as object usage
* const styles = {
* ...wordWrap('break-word')
* }
*
* // styled-components usage
* const div = styled.div`
* ${wordWrap('break-word')}
* `
*
* // CSS as JS Output
*
* const styles = {
* overflowWrap: 'break-word',
* wordWrap: 'break-word',
* wordBreak: 'break-all',
* }
*/
function wordWrap(wrap) {
if (wrap === void 0) {
wrap = 'break-word';
}
var wordBreak = wrap === 'break-word' ? 'break-all' : wrap;
return {
overflowWrap: wrap,
wordWrap: wrap,
wordBreak: wordBreak
};
}
function colorToInt(color) {
return Math.round(color * 255);
}
function convertToInt(red, green, blue) {
return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
}
function hslToRgb(hue, saturation, lightness, convert) {
if (convert === void 0) {
convert = convertToInt;
}
if (saturation === 0) {
// achromatic
return convert(lightness, lightness, lightness);
} // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
var huePrime = (hue % 360 + 360) % 360 / 60;
var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
var red = 0;
var green = 0;
var blue = 0;
if (huePrime >= 0 && huePrime < 1) {
red = chroma;
green = secondComponent;
} else if (huePrime >= 1 && huePrime < 2) {
red = secondComponent;
green = chroma;
} else if (huePrime >= 2 && huePrime < 3) {
green = chroma;
blue = secondComponent;
} else if (huePrime >= 3 && huePrime < 4) {
green = secondComponent;
blue = chroma;
} else if (huePrime >= 4 && huePrime < 5) {
red = secondComponent;
blue = chroma;
} else if (huePrime >= 5 && huePrime < 6) {
red = chroma;
blue = secondComponent;
}
var lightnessModification = lightness - chroma / 2;
var finalRed = red + lightnessModification;
var finalGreen = green + lightnessModification;
var finalBlue = blue + lightnessModification;
return convert(finalRed, finalGreen, finalBlue);
}
var namedColorMap = {
aliceblue: 'f0f8ff',
antiquewhite: 'faebd7',
aqua: '00ffff',
aquamarine: '7fffd4',
azure: 'f0ffff',
beige: 'f5f5dc',
bisque: 'ffe4c4',
black: '000',
blanchedalmond: 'ffebcd',
blue: '0000ff',
blueviolet: '8a2be2',
brown: 'a52a2a',
burlywood: 'deb887',
cadetblue: '5f9ea0',
chartreuse: '7fff00',
chocolate: 'd2691e',
coral: 'ff7f50',
cornflowerblue: '6495ed',
cornsilk: 'fff8dc',
crimson: 'dc143c',
cyan: '00ffff',
darkblue: '00008b',
darkcyan: '008b8b',
darkgoldenrod: 'b8860b',
darkgray: 'a9a9a9',
darkgreen: '006400',
darkgrey: 'a9a9a9',
darkkhaki: 'bdb76b',
darkmagenta: '8b008b',
darkolivegreen: '556b2f',
darkorange: 'ff8c00',
darkorchid: '9932cc',
darkred: '8b0000',
darksalmon: 'e9967a',
darkseagreen: '8fbc8f',
darkslateblue: '483d8b',
darkslategray: '2f4f4f',
darkslategrey: '2f4f4f',
darkturquoise: '00ced1',
darkviolet: '9400d3',
deeppink: 'ff1493',
deepskyblue: '00bfff',
dimgray: '696969',
dimgrey: '696969',
dodgerblue: '1e90ff',
firebrick: 'b22222',
floralwhite: 'fffaf0',
forestgreen: '228b22',
fuchsia: 'ff00ff',
gainsboro: 'dcdcdc',
ghostwhite: 'f8f8ff',
gold: 'ffd700',
goldenrod: 'daa520',
gray: '808080',
green: '008000',
greenyellow: 'adff2f',
grey: '808080',
honeydew: 'f0fff0',
hotpink: 'ff69b4',
indianred: 'cd5c5c',
indigo: '4b0082',
ivory: 'fffff0',
khaki: 'f0e68c',
lavender: 'e6e6fa',
lavenderblush: 'fff0f5',
lawngreen: '7cfc00',
lemonchiffon: 'fffacd',
lightblue: 'add8e6',
lightcoral: 'f08080',
lightcyan: 'e0ffff',
lightgoldenrodyellow: 'fafad2',
lightgray: 'd3d3d3',
lightgreen: '90ee90',
lightgrey: 'd3d3d3',
lightpink: 'ffb6c1',
lightsalmon: 'ffa07a',
lightseagreen: '20b2aa',
lightskyblue: '87cefa',
lightslategray: '789',
lightslategrey: '789',
lightsteelblue: 'b0c4de',
lightyellow: 'ffffe0',
lime: '0f0',
limegreen: '32cd32',
linen: 'faf0e6',
magenta: 'f0f',
maroon: '800000',
mediumaquamarine: '66cdaa',
mediumblue: '0000cd',
mediumorchid: 'ba55d3',
mediumpurple: '9370db',
mediumseagreen: '3cb371',
mediumslateblue: '7b68ee',
mediumspringgreen: '00fa9a',
mediumturquoise: '48d1cc',
mediumvioletred: 'c71585',
midnightblue: '191970',
mintcream: 'f5fffa',
mistyrose: 'ffe4e1',
moccasin: 'ffe4b5',
navajowhite: 'ffdead',
navy: '000080',
oldlace: 'fdf5e6',
olive: '808000',
olivedrab: '6b8e23',
orange: 'ffa500',
orangered: 'ff4500',
orchid: 'da70d6',
palegoldenrod: 'eee8aa',
palegreen: '98fb98',
paleturquoise: 'afeeee',
palevioletred: 'db7093',
papayawhip: 'ffefd5',
peachpuff: 'ffdab9',
peru: 'cd853f',
pink: 'ffc0cb',
plum: 'dda0dd',
powderblue: 'b0e0e6',
purple: '800080',
rebeccapurple: '639',
red: 'f00',
rosybrown: 'bc8f8f',
royalblue: '4169e1',
saddlebrown: '8b4513',
salmon: 'fa8072',
sandybrown: 'f4a460',
seagreen: '2e8b57',
seashell: 'fff5ee',
sienna: 'a0522d',
silver: 'c0c0c0',
skyblue: '87ceeb',
slateblue: '6a5acd',
slategray: '708090',
slategrey: '708090',
snow: 'fffafa',
springgreen: '00ff7f',
steelblue: '4682b4',
tan: 'd2b48c',
teal: '008080',
thistle: 'd8bfd8',
tomato: 'ff6347',
turquoise: '40e0d0',
violet: 'ee82ee',
wheat: 'f5deb3',
white: 'fff',
whitesmoke: 'f5f5f5',
yellow: 'ff0',
yellowgreen: '9acd32'
};
/**
* Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
* @private
*/
function nameToHex(color) {
if (typeof color !== 'string') return color;
var normalizedColorName = color.toLowerCase();
return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
}
var hexRegex = /^#[a-fA-F0-9]{6}$/;
var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
var rgbRegex = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i;
var rgbaRegex = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
var hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
/**
* Returns an RgbColor or RgbaColor object. This utility function is only useful
* if want to extract a color component. With the color util `toColorString` you
* can convert a RgbColor or RgbaColor object back to a string.
*
* @example
* // Assigns `{ red: 255, green: 0, blue: 0 }` to color1
* const color1 = parseToRgb('rgb(255, 0, 0)');
* // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
* const color2 = parseToRgb('hsla(210, 10%, 40%, 0.75)');
*/
function parseToRgb(color) {
if (typeof color !== 'string') {
throw new PolishedError(3);
}
var normalizedColor = nameToHex(color);
if (normalizedColor.match(hexRegex)) {
return {
red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
};
}
if (normalizedColor.match(hexRgbaRegex)) {
var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
return {
red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
alpha: alpha
};
}
if (normalizedColor.match(reducedHexRegex)) {
return {
red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
};
}
if (normalizedColor.match(reducedRgbaHexRegex)) {
var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
return {
red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
alpha: _alpha
};
}
var rgbMatched = rgbRegex.exec(normalizedColor);
if (rgbMatched) {
return {
red: parseInt("" + rgbMatched[1], 10),
green: parseInt("" + rgbMatched[2], 10),
blue: parseInt("" + rgbMatched[3], 10)
};
}
var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
if (rgbaMatched) {
return {
red: parseInt("" + rgbaMatched[1], 10),
green: parseInt("" + rgbaMatched[2], 10),
blue: parseInt("" + rgbaMatched[3], 10),
alpha: parseFloat("" + rgbaMatched[4]) > 1 ? parseFloat("" + rgbaMatched[4]) / 100 : parseFloat("" + rgbaMatched[4])
};
}
var hslMatched = hslRegex.exec(normalizedColor);
if (hslMatched) {
var hue = parseInt("" + hslMatched[1], 10);
var saturation = parseInt("" + hslMatched[2], 10) / 100;
var lightness = parseInt("" + hslMatched[3], 10) / 100;
var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
var hslRgbMatched = rgbRegex.exec(rgbColorString);
if (!hslRgbMatched) {
throw new PolishedError(4, normalizedColor, rgbColorString);
}
return {
red: parseInt("" + hslRgbMatched[1], 10),
green: parseInt("" + hslRgbMatched[2], 10),
blue: parseInt("" + hslRgbMatched[3], 10)
};
}
var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
if (hslaMatched) {
var _hue = parseInt("" + hslaMatched[1], 10);
var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
if (!_hslRgbMatched) {
throw new PolishedError(4, normalizedColor, _rgbColorString);
}
return {
red: parseInt("" + _hslRgbMatched[1], 10),
green: parseInt("" + _hslRgbMatched[2], 10),
blue: parseInt("" + _hslRgbMatched[3], 10),
alpha: parseFloat("" + hslaMatched[4]) > 1 ? parseFloat("" + hslaMatched[4]) / 100 : parseFloat("" + hslaMatched[4])
};
}
throw new PolishedError(5);
}
function rgbToHsl(color) {
// make sure rgb are contained in a set of [0, 255]
var red = color.red / 255;
var green = color.green / 255;
var blue = color.blue / 255;
var max = Math.max(red, green, blue);
var min = Math.min(red, green, blue);
var lightness = (max + min) / 2;
if (max === min) {
// achromatic
if (color.alpha !== undefined) {
return {
hue: 0,
saturation: 0,
lightness: lightness,
alpha: color.alpha
};
} else {
return {
hue: 0,
saturation: 0,
lightness: lightness
};
}
}
var hue;
var delta = max - min;
var saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
switch (max) {
case red:
hue = (green - blue) / delta + (green < blue ? 6 : 0);
break;
case green:
hue = (blue - red) / delta + 2;
break;
default:
// blue case
hue = (red - green) / delta + 4;
break;
}
hue *= 60;
if (color.alpha !== undefined) {
return {
hue: hue,
saturation: saturation,
lightness: lightness,
alpha: color.alpha
};
}
return {
hue: hue,
saturation: saturation,
lightness: lightness
};
}
/**
* Returns an HslColor or HslaColor object. This utility function is only useful
* if want to extract a color component. With the color util `toColorString` you
* can convert a HslColor or HslaColor object back to a string.
*
* @example
* // Assigns `{ hue: 0, saturation: 1, lightness: 0.5 }` to color1
* const color1 = parseToHsl('rgb(255, 0, 0)');
* // Assigns `{ hue: 128, saturation: 1, lightness: 0.5, alpha: 0.75 }` to color2
* const color2 = parseToHsl('hsla(128, 100%, 50%, 0.75)');
*/
function parseToHsl(color) {
// Note: At a later stage we can optimize this function as right now a hsl
// color would be parsed converted to rgb values and converted back to hsl.
return rgbToHsl(parseToRgb(color));
}
/**
* Reduces hex values if possible e.g. #ff8866 to #f86
* @private
*/
var reduceHexValue = function reduceHexValue(value) {
if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
return "#" + value[1] + value[3] + value[5];
}
return value;
};
var reduceHexValue$1 = reduceHexValue;
function numberToHex(value) {
var hex = value.toString(16);
return hex.length === 1 ? "0" + hex : hex;
}
function colorToHex(color) {
return numberToHex(Math.round(color * 255));
}
function convertToHex(red, green, blue) {
return reduceHexValue$1("#" + colorToHex(red) + colorToHex(green) + colorToHex(blue));
}
function hslToHex(hue, saturation, lightness) {
return hslToRgb(hue, saturation, lightness, convertToHex);
}
/**
* Returns a string value for the color. The returned result is the smallest possible hex notation.
*
* @example
* // Styles as object usage
* const styles = {
* background: hsl(359, 0.75, 0.4),
* background: hsl({ hue: 360, saturation: 0.75, lightness: 0.4 }),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${hsl(359, 0.75, 0.4)};
* background: ${hsl({ hue: 360, saturation: 0.75, lightness: 0.4 })};
* `
*
* // CSS in JS Output
*
* element {
* background: "#b3191c";
* background: "#b3191c";
* }
*/
function hsl(value, saturation, lightness) {
if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number') {
return hslToHex(value, saturation, lightness);
} else if (typeof value === 'object' && saturation === undefined && lightness === undefined) {
return hslToHex(value.hue, value.saturation, value.lightness);
}
throw new PolishedError(1);
}
/**
* Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
*
* @example
* // Styles as object usage
* const styles = {
* background: hsla(359, 0.75, 0.4, 0.7),
* background: hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 }),
* background: hsla(359, 0.75, 0.4, 1),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${hsla(359, 0.75, 0.4, 0.7)};
* background: ${hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 })};
* background: ${hsla(359, 0.75, 0.4, 1)};
* `
*
* // CSS in JS Output
*
* element {
* background: "rgba(179,25,28,0.7)";
* background: "rgba(179,25,28,0.7)";
* background: "#b3191c";
* }
*/
function hsla(value, saturation, lightness, alpha) {
if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number' && typeof alpha === 'number') {
return alpha >= 1 ? hslToHex(value, saturation, lightness) : "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
} else if (typeof value === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
}
throw new PolishedError(2);
}
/**
* Returns a string value for the color. The returned result is the smallest possible hex notation.
*
* @example
* // Styles as object usage
* const styles = {
* background: rgb(255, 205, 100),
* background: rgb({ red: 255, green: 205, blue: 100 }),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${rgb(255, 205, 100)};
* background: ${rgb({ red: 255, green: 205, blue: 100 })};
* `
*
* // CSS in JS Output
*
* element {
* background: "#ffcd64";
* background: "#ffcd64";
* }
*/
function rgb(value, green, blue) {
if (typeof value === 'number' && typeof green === 'number' && typeof blue === 'number') {
return reduceHexValue$1("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
} else if (typeof value === 'object' && green === undefined && blue === undefined) {
return reduceHexValue$1("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
}
throw new PolishedError(6);
}
/**
* Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
*
* Can also be used to fade a color by passing a hex value or named CSS color along with an alpha value.
*
* @example
* // Styles as object usage
* const styles = {
* background: rgba(255, 205, 100, 0.7),
* background: rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 }),
* background: rgba(255, 205, 100, 1),
* background: rgba('#ffffff', 0.4),
* background: rgba('black', 0.7),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${rgba(255, 205, 100, 0.7)};
* background: ${rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 })};
* background: ${rgba(255, 205, 100, 1)};
* background: ${rgba('#ffffff', 0.4)};
* background: ${rgba('black', 0.7)};
* `
*
* // CSS in JS Output
*
* element {
* background: "rgba(255,205,100,0.7)";
* background: "rgba(255,205,100,0.7)";
* background: "#ffcd64";
* background: "rgba(255,255,255,0.4)";
* background: "rgba(0,0,0,0.7)";
* }
*/
function rgba(firstValue, secondValue, thirdValue, fourthValue) {
if (typeof firstValue === 'string' && typeof secondValue === 'number') {
var rgbValue = parseToRgb(firstValue);
return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
} else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
} else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
}
throw new PolishedError(7);
}
var isRgb = function isRgb(color) {
return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
};
var isRgba = function isRgba(color) {
return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && typeof color.alpha === 'number';
};
var isHsl = function isHsl(color) {
return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
};
var isHsla = function isHsla(color) {
return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && typeof color.alpha === 'number';
};
/**
* Converts a RgbColor, RgbaColor, HslColor or HslaColor object to a color string.
* This util is useful in case you only know on runtime which color object is
* used. Otherwise we recommend to rely on `rgb`, `rgba`, `hsl` or `hsla`.
*
* @example
* // Styles as object usage
* const styles = {
* background: toColorString({ red: 255, green: 205, blue: 100 }),
* background: toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 }),
* background: toColorString({ hue: 240, saturation: 1, lightness: 0.5 }),
* background: toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 }),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${toColorString({ red: 255, green: 205, blue: 100 })};
* background: ${toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 })};
* background: ${toColorString({ hue: 240, saturation: 1, lightness: 0.5 })};
* background: ${toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 })};
* `
*
* // CSS in JS Output
* element {
* background: "#ffcd64";
* background: "rgba(255,205,100,0.72)";
* background: "#00f";
* background: "rgba(179,25,25,0.72)";
* }
*/
function toColorString(color) {
if (typeof color !== 'object') throw new PolishedError(8);
if (isRgba(color)) return rgba(color);
if (isRgb(color)) return rgb(color);
if (isHsla(color)) return hsla(color);
if (isHsl(color)) return hsl(color);
throw new PolishedError(8);
}
// Type definitions taken from https://github.com/gcanti/flow-static-land/blob/master/src/Fun.js
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line no-redeclare
function curried(f, length, acc) {
return function fn() {
// eslint-disable-next-line prefer-rest-params
var combined = acc.concat(Array.prototype.slice.call(arguments));
return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
};
} // eslint-disable-next-line no-redeclare
function curry(f) {
// eslint-disable-line no-redeclare
return curried(f, f.length, []);
}
/**
* Changes the hue of the color. Hue is a number between 0 to 360. The first
* argument for adjustHue is the amount of degrees the color is rotated around
* the color wheel, always producing a positive hue value.
*
* @example
* // Styles as object usage
* const styles = {
* background: adjustHue(180, '#448'),
* background: adjustHue('180', 'rgba(101,100,205,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${adjustHue(180, '#448')};
* background: ${adjustHue('180', 'rgba(101,100,205,0.7)')};
* `
*
* // CSS in JS Output
* element {
* background: "#888844";
* background: "rgba(136,136,68,0.7)";
* }
*/
function adjustHue(degree, color) {
if (color === 'transparent') return color;
var hslColor = parseToHsl(color);
return toColorString(_extends({}, hslColor, {
hue: hslColor.hue + parseFloat(degree)
}));
} // prettier-ignore
var curriedAdjustHue = /*#__PURE__*/(/* unused pure expression or super */ null && (curry
/* ::<number | string, string, string> */
(adjustHue)));
var curriedAdjustHue$1 = (/* unused pure expression or super */ null && (curriedAdjustHue));
/**
* Returns the complement of the provided color. This is identical to adjustHue(180, <color>).
*
* @example
* // Styles as object usage
* const styles = {
* background: complement('#448'),
* background: complement('rgba(204,205,100,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${complement('#448')};
* background: ${complement('rgba(204,205,100,0.7)')};
* `
*
* // CSS in JS Output
* element {
* background: "#884";
* background: "rgba(153,153,153,0.7)";
* }
*/
function complement(color) {
if (color === 'transparent') return color;
var hslColor = parseToHsl(color);
return toColorString(_extends({}, hslColor, {
hue: (hslColor.hue + 180) % 360
}));
}
function guard(lowerBoundary, upperBoundary, value) {
return Math.max(lowerBoundary, Math.min(upperBoundary, value));
}
/**
* Returns a string value for the darkened color.
*
* @example
* // Styles as object usage
* const styles = {
* background: darken(0.2, '#FFCD64'),
* background: darken('0.2', 'rgba(255,205,100,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${darken(0.2, '#FFCD64')};
* background: ${darken('0.2', 'rgba(255,205,100,0.7)')};
* `
*
* // CSS in JS Output
*
* element {
* background: "#ffbd31";
* background: "rgba(255,189,49,0.7)";
* }
*/
function darken(amount, color) {
if (color === 'transparent') return color;
var hslColor = parseToHsl(color);
return toColorString((0,esm_extends/* default */.A)({}, hslColor, {
lightness: guard(0, 1, hslColor.lightness - parseFloat(amount))
}));
} // prettier-ignore
var curriedDarken = /*#__PURE__*/curry
/* ::<number | string, string, string> */
(darken);
var curriedDarken$1 = curriedDarken;
/**
* Decreases the intensity of a color. Its range is between 0 to 1. The first
* argument of the desaturate function is the amount by how much the color
* intensity should be decreased.
*
* @example
* // Styles as object usage
* const styles = {
* background: desaturate(0.2, '#CCCD64'),
* background: desaturate('0.2', 'rgba(204,205,100,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${desaturate(0.2, '#CCCD64')};
* background: ${desaturate('0.2', 'rgba(204,205,100,0.7)')};
* `
*
* // CSS in JS Output
* element {
* background: "#b8b979";
* background: "rgba(184,185,121,0.7)";
* }
*/
function desaturate(amount, color) {
if (color === 'transparent') return color;
var hslColor = parseToHsl(color);
return toColorString(_extends({}, hslColor, {
saturation: guard(0, 1, hslColor.saturation - parseFloat(amount))
}));
} // prettier-ignore
var curriedDesaturate = /*#__PURE__*/(/* unused pure expression or super */ null && (curry
/* ::<number | string, string, string> */
(desaturate)));
var curriedDesaturate$1 = (/* unused pure expression or super */ null && (curriedDesaturate));
/**
* Returns a number (float) representing the luminance of a color.
*
* @example
* // Styles as object usage
* const styles = {
* background: getLuminance('#CCCD64') >= getLuminance('#0000ff') ? '#CCCD64' : '#0000ff',
* background: getLuminance('rgba(58, 133, 255, 1)') >= getLuminance('rgba(255, 57, 149, 1)') ?
* 'rgba(58, 133, 255, 1)' :
* 'rgba(255, 57, 149, 1)',
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${getLuminance('#CCCD64') >= getLuminance('#0000ff') ? '#CCCD64' : '#0000ff'};
* background: ${getLuminance('rgba(58, 133, 255, 1)') >= getLuminance('rgba(255, 57, 149, 1)') ?
* 'rgba(58, 133, 255, 1)' :
* 'rgba(255, 57, 149, 1)'};
*
* // CSS in JS Output
*
* div {
* background: "#CCCD64";
* background: "rgba(58, 133, 255, 1)";
* }
*/
function getLuminance(color) {
if (color === 'transparent') return 0;
var rgbColor = parseToRgb(color);
var _Object$keys$map = Object.keys(rgbColor).map(function (key) {
var channel = rgbColor[key] / 255;
return channel <= 0.03928 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4);
}),
r = _Object$keys$map[0],
g = _Object$keys$map[1],
b = _Object$keys$map[2];
return parseFloat((0.2126 * r + 0.7152 * g + 0.0722 * b).toFixed(3));
}
/**
* Returns the contrast ratio between two colors based on
* [W3's recommended equation for calculating contrast](http://www.w3.org/TR/WCAG20/#contrast-ratiodef).
*
* @example
* const contrastRatio = getContrast('#444', '#fff');
*/
function getContrast(color1, color2) {
var luminance1 = getLuminance(color1);
var luminance2 = getLuminance(color2);
return parseFloat((luminance1 > luminance2 ? (luminance1 + 0.05) / (luminance2 + 0.05) : (luminance2 + 0.05) / (luminance1 + 0.05)).toFixed(2));
}
/**
* Converts the color to a grayscale, by reducing its saturation to 0.
*
* @example
* // Styles as object usage
* const styles = {
* background: grayscale('#CCCD64'),
* background: grayscale('rgba(204,205,100,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${grayscale('#CCCD64')};
* background: ${grayscale('rgba(204,205,100,0.7)')};
* `
*
* // CSS in JS Output
* element {
* background: "#999";
* background: "rgba(153,153,153,0.7)";
* }
*/
function grayscale(color) {
if (color === 'transparent') return color;
return toColorString(_extends({}, parseToHsl(color), {
saturation: 0
}));
}
/**
* Converts a HslColor or HslaColor object to a color string.
* This util is useful in case you only know on runtime which color object is
* used. Otherwise we recommend to rely on `hsl` or `hsla`.
*
* @example
* // Styles as object usage
* const styles = {
* background: hslToColorString({ hue: 240, saturation: 1, lightness: 0.5 }),
* background: hslToColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 }),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${hslToColorString({ hue: 240, saturation: 1, lightness: 0.5 })};
* background: ${hslToColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 })};
* `
*
* // CSS in JS Output
* element {
* background: "#00f";
* background: "rgba(179,25,25,0.72)";
* }
*/
function hslToColorString(color) {
if (typeof color === 'object' && typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number') {
if (color.alpha && typeof color.alpha === 'number') {
return hsla({
hue: color.hue,
saturation: color.saturation,
lightness: color.lightness,
alpha: color.alpha
});
}
return hsl({
hue: color.hue,
saturation: color.saturation,
lightness: color.lightness
});
}
throw new PolishedError(45);
}
/**
* Inverts the red, green and blue values of a color.
*
* @example
* // Styles as object usage
* const styles = {
* background: invert('#CCCD64'),
* background: invert('rgba(101,100,205,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${invert('#CCCD64')};
* background: ${invert('rgba(101,100,205,0.7)')};
* `
*
* // CSS in JS Output
*
* element {
* background: "#33329b";
* background: "rgba(154,155,50,0.7)";
* }
*/
function invert(color) {
if (color === 'transparent') return color; // parse color string to rgb
var value = parseToRgb(color);
return toColorString(_extends({}, value, {
red: 255 - value.red,
green: 255 - value.green,
blue: 255 - value.blue
}));
}
/**
* Returns a string value for the lightened color.
*
* @example
* // Styles as object usage
* const styles = {
* background: lighten(0.2, '#CCCD64'),
* background: lighten('0.2', 'rgba(204,205,100,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${lighten(0.2, '#FFCD64')};
* background: ${lighten('0.2', 'rgba(204,205,100,0.7)')};
* `
*
* // CSS in JS Output
*
* element {
* background: "#e5e6b1";
* background: "rgba(229,230,177,0.7)";
* }
*/
function lighten(amount, color) {
if (color === 'transparent') return color;
var hslColor = parseToHsl(color);
return toColorString((0,esm_extends/* default */.A)({}, hslColor, {
lightness: guard(0, 1, hslColor.lightness + parseFloat(amount))
}));
} // prettier-ignore
var curriedLighten = /*#__PURE__*/curry
/* ::<number | string, string, string> */
(lighten);
var curriedLighten$1 = curriedLighten;
/**
* Determines which contrast guidelines have been met for two colors.
* Based on the [contrast calculations recommended by W3](https://www.w3.org/WAI/WCAG21/Understanding/contrast-enhanced.html).
*
* @example
* const scores = meetsContrastGuidelines('#444', '#fff');
*/
function meetsContrastGuidelines(color1, color2) {
var contrastRatio = getContrast(color1, color2);
return {
AA: contrastRatio >= 4.5,
AALarge: contrastRatio >= 3,
AAA: contrastRatio >= 7,
AAALarge: contrastRatio >= 4.5
};
}
/**
* Mixes the two provided colors together by calculating the average of each of the RGB components weighted to the first color by the provided weight.
*
* @example
* // Styles as object usage
* const styles = {
* background: mix(0.5, '#f00', '#00f')
* background: mix(0.25, '#f00', '#00f')
* background: mix('0.5', 'rgba(255, 0, 0, 0.5)', '#00f')
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${mix(0.5, '#f00', '#00f')};
* background: ${mix(0.25, '#f00', '#00f')};
* background: ${mix('0.5', 'rgba(255, 0, 0, 0.5)', '#00f')};
* `
*
* // CSS in JS Output
*
* element {
* background: "#7f007f";
* background: "#3f00bf";
* background: "rgba(63, 0, 191, 0.75)";
* }
*/
function mix(weight, color, otherColor) {
if (color === 'transparent') return otherColor;
if (otherColor === 'transparent') return color;
if (weight === 0) return otherColor;
var parsedColor1 = parseToRgb(color);
var color1 = _extends({}, parsedColor1, {
alpha: typeof parsedColor1.alpha === 'number' ? parsedColor1.alpha : 1
});
var parsedColor2 = parseToRgb(otherColor);
var color2 = _extends({}, parsedColor2, {
alpha: typeof parsedColor2.alpha === 'number' ? parsedColor2.alpha : 1
}); // The formula is copied from the original Sass implementation:
// http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method
var alphaDelta = color1.alpha - color2.alpha;
var x = parseFloat(weight) * 2 - 1;
var y = x * alphaDelta === -1 ? x : x + alphaDelta;
var z = 1 + x * alphaDelta;
var weight1 = (y / z + 1) / 2.0;
var weight2 = 1 - weight1;
var mixedColor = {
red: Math.floor(color1.red * weight1 + color2.red * weight2),
green: Math.floor(color1.green * weight1 + color2.green * weight2),
blue: Math.floor(color1.blue * weight1 + color2.blue * weight2),
alpha: color1.alpha * parseFloat(weight) + color2.alpha * (1 - parseFloat(weight))
};
return rgba(mixedColor);
} // prettier-ignore
var curriedMix = /*#__PURE__*/(/* unused pure expression or super */ null && (curry
/* ::<number | string, string, string, string> */
(mix)));
var mix$1 = (/* unused pure expression or super */ null && (curriedMix));
/**
* Increases the opacity of a color. Its range for the amount is between 0 to 1.
*
*
* @example
* // Styles as object usage
* const styles = {
* background: opacify(0.1, 'rgba(255, 255, 255, 0.9)');
* background: opacify(0.2, 'hsla(0, 0%, 100%, 0.5)'),
* background: opacify('0.5', 'rgba(255, 0, 0, 0.2)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${opacify(0.1, 'rgba(255, 255, 255, 0.9)')};
* background: ${opacify(0.2, 'hsla(0, 0%, 100%, 0.5)')},
* background: ${opacify('0.5', 'rgba(255, 0, 0, 0.2)')},
* `
*
* // CSS in JS Output
*
* element {
* background: "#fff";
* background: "rgba(255,255,255,0.7)";
* background: "rgba(255,0,0,0.7)";
* }
*/
function opacify(amount, color) {
if (color === 'transparent') return color;
var parsedColor = parseToRgb(color);
var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
var colorWithAlpha = (0,esm_extends/* default */.A)({}, parsedColor, {
alpha: guard(0, 1, (alpha * 100 + parseFloat(amount) * 100) / 100)
});
return rgba(colorWithAlpha);
} // prettier-ignore
var curriedOpacify = /*#__PURE__*/curry
/* ::<number | string, string, string> */
(opacify);
var curriedOpacify$1 = curriedOpacify;
var defaultReturnIfLightColor = '#000';
var defaultReturnIfDarkColor = '#fff';
/**
* Returns black or white (or optional passed colors) for best
* contrast depending on the luminosity of the given color.
* When passing custom return colors, strict mode ensures that the
* return color always meets or exceeds WCAG level AA or greater. If this test
* fails, the default return color (black or white) is returned in place of the
* custom return color. You can optionally turn off strict mode.
*
* Follows [W3C specs for readability](https://www.w3.org/TR/WCAG20-TECHS/G18.html).
*
* @example
* // Styles as object usage
* const styles = {
* color: readableColor('#000'),
* color: readableColor('black', '#001', '#ff8'),
* color: readableColor('white', '#001', '#ff8'),
* color: readableColor('red', '#333', '#ddd', true)
* }
*
* // styled-components usage
* const div = styled.div`
* color: ${readableColor('#000')};
* color: ${readableColor('black', '#001', '#ff8')};
* color: ${readableColor('white', '#001', '#ff8')};
* color: ${readableColor('red', '#333', '#ddd', true)};
* `
*
* // CSS in JS Output
* element {
* color: "#fff";
* color: "#ff8";
* color: "#001";
* color: "#000";
* }
*/
function readableColor(color, returnIfLightColor, returnIfDarkColor, strict) {
if (returnIfLightColor === void 0) {
returnIfLightColor = defaultReturnIfLightColor;
}
if (returnIfDarkColor === void 0) {
returnIfDarkColor = defaultReturnIfDarkColor;
}
if (strict === void 0) {
strict = true;
}
var isColorLight = getLuminance(color) > 0.179;
var preferredReturnColor = isColorLight ? returnIfLightColor : returnIfDarkColor;
if (!strict || getContrast(color, preferredReturnColor) >= 4.5) {
return preferredReturnColor;
}
return isColorLight ? defaultReturnIfLightColor : defaultReturnIfDarkColor;
}
/**
* Converts a RgbColor or RgbaColor object to a color string.
* This util is useful in case you only know on runtime which color object is
* used. Otherwise we recommend to rely on `rgb` or `rgba`.
*
* @example
* // Styles as object usage
* const styles = {
* background: rgbToColorString({ red: 255, green: 205, blue: 100 }),
* background: rgbToColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 }),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${rgbToColorString({ red: 255, green: 205, blue: 100 })};
* background: ${rgbToColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 })};
* `
*
* // CSS in JS Output
* element {
* background: "#ffcd64";
* background: "rgba(255,205,100,0.72)";
* }
*/
function rgbToColorString(color) {
if (typeof color === 'object' && typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number') {
if (typeof color.alpha === 'number') {
return rgba({
red: color.red,
green: color.green,
blue: color.blue,
alpha: color.alpha
});
}
return rgb({
red: color.red,
green: color.green,
blue: color.blue
});
}
throw new PolishedError(46);
}
/**
* Increases the intensity of a color. Its range is between 0 to 1. The first
* argument of the saturate function is the amount by how much the color
* intensity should be increased.
*
* @example
* // Styles as object usage
* const styles = {
* background: saturate(0.2, '#CCCD64'),
* background: saturate('0.2', 'rgba(204,205,100,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${saturate(0.2, '#FFCD64')};
* background: ${saturate('0.2', 'rgba(204,205,100,0.7)')};
* `
*
* // CSS in JS Output
*
* element {
* background: "#e0e250";
* background: "rgba(224,226,80,0.7)";
* }
*/
function saturate(amount, color) {
if (color === 'transparent') return color;
var hslColor = parseToHsl(color);
return toColorString(_extends({}, hslColor, {
saturation: guard(0, 1, hslColor.saturation + parseFloat(amount))
}));
} // prettier-ignore
var curriedSaturate = /*#__PURE__*/(/* unused pure expression or super */ null && (curry
/* ::<number | string, string, string> */
(saturate)));
var curriedSaturate$1 = (/* unused pure expression or super */ null && (curriedSaturate));
/**
* Sets the hue of a color to the provided value. The hue range can be
* from 0 and 359.
*
* @example
* // Styles as object usage
* const styles = {
* background: setHue(42, '#CCCD64'),
* background: setHue('244', 'rgba(204,205,100,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${setHue(42, '#CCCD64')};
* background: ${setHue('244', 'rgba(204,205,100,0.7)')};
* `
*
* // CSS in JS Output
* element {
* background: "#cdae64";
* background: "rgba(107,100,205,0.7)";
* }
*/
function setHue(hue, color) {
if (color === 'transparent') return color;
return toColorString(_extends({}, parseToHsl(color), {
hue: parseFloat(hue)
}));
} // prettier-ignore
var curriedSetHue = /*#__PURE__*/(/* unused pure expression or super */ null && (curry
/* ::<number | string, string, string> */
(setHue)));
var curriedSetHue$1 = (/* unused pure expression or super */ null && (curriedSetHue));
/**
* Sets the lightness of a color to the provided value. The lightness range can be
* from 0 and 1.
*
* @example
* // Styles as object usage
* const styles = {
* background: setLightness(0.2, '#CCCD64'),
* background: setLightness('0.75', 'rgba(204,205,100,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${setLightness(0.2, '#CCCD64')};
* background: ${setLightness('0.75', 'rgba(204,205,100,0.7)')};
* `
*
* // CSS in JS Output
* element {
* background: "#4d4d19";
* background: "rgba(223,224,159,0.7)";
* }
*/
function setLightness(lightness, color) {
if (color === 'transparent') return color;
return toColorString(_extends({}, parseToHsl(color), {
lightness: parseFloat(lightness)
}));
} // prettier-ignore
var curriedSetLightness = /*#__PURE__*/(/* unused pure expression or super */ null && (curry
/* ::<number | string, string, string> */
(setLightness)));
var curriedSetLightness$1 = (/* unused pure expression or super */ null && (curriedSetLightness));
/**
* Sets the saturation of a color to the provided value. The saturation range can be
* from 0 and 1.
*
* @example
* // Styles as object usage
* const styles = {
* background: setSaturation(0.2, '#CCCD64'),
* background: setSaturation('0.75', 'rgba(204,205,100,0.7)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${setSaturation(0.2, '#CCCD64')};
* background: ${setSaturation('0.75', 'rgba(204,205,100,0.7)')};
* `
*
* // CSS in JS Output
* element {
* background: "#adad84";
* background: "rgba(228,229,76,0.7)";
* }
*/
function setSaturation(saturation, color) {
if (color === 'transparent') return color;
return toColorString(_extends({}, parseToHsl(color), {
saturation: parseFloat(saturation)
}));
} // prettier-ignore
var curriedSetSaturation = /*#__PURE__*/(/* unused pure expression or super */ null && (curry
/* ::<number | string, string, string> */
(setSaturation)));
var curriedSetSaturation$1 = (/* unused pure expression or super */ null && (curriedSetSaturation));
/**
* Shades a color by mixing it with black. `shade` can produce
* hue shifts, where as `darken` manipulates the luminance channel and therefore
* doesn't produce hue shifts.
*
* @example
* // Styles as object usage
* const styles = {
* background: shade(0.25, '#00f')
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${shade(0.25, '#00f')};
* `
*
* // CSS in JS Output
*
* element {
* background: "#00003f";
* }
*/
function shade(percentage, color) {
if (color === 'transparent') return color;
return mix$1(parseFloat(percentage), 'rgb(0, 0, 0)', color);
} // prettier-ignore
var curriedShade = /*#__PURE__*/(/* unused pure expression or super */ null && (curry
/* ::<number | string, string, string> */
(shade)));
var curriedShade$1 = (/* unused pure expression or super */ null && (curriedShade));
/**
* Tints a color by mixing it with white. `tint` can produce
* hue shifts, where as `lighten` manipulates the luminance channel and therefore
* doesn't produce hue shifts.
*
* @example
* // Styles as object usage
* const styles = {
* background: tint(0.25, '#00f')
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${tint(0.25, '#00f')};
* `
*
* // CSS in JS Output
*
* element {
* background: "#bfbfff";
* }
*/
function tint(percentage, color) {
if (color === 'transparent') return color;
return mix$1(parseFloat(percentage), 'rgb(255, 255, 255)', color);
} // prettier-ignore
var curriedTint = /*#__PURE__*/(/* unused pure expression or super */ null && (curry
/* ::<number | string, string, string> */
(tint)));
var curriedTint$1 = (/* unused pure expression or super */ null && (curriedTint));
/**
* Decreases the opacity of a color. Its range for the amount is between 0 to 1.
*
*
* @example
* // Styles as object usage
* const styles = {
* background: transparentize(0.1, '#fff'),
* background: transparentize(0.2, 'hsl(0, 0%, 100%)'),
* background: transparentize('0.5', 'rgba(255, 0, 0, 0.8)'),
* }
*
* // styled-components usage
* const div = styled.div`
* background: ${transparentize(0.1, '#fff')};
* background: ${transparentize(0.2, 'hsl(0, 0%, 100%)')};
* background: ${transparentize('0.5', 'rgba(255, 0, 0, 0.8)')};
* `
*
* // CSS in JS Output
*
* element {
* background: "rgba(255,255,255,0.9)";
* background: "rgba(255,255,255,0.8)";
* background: "rgba(255,0,0,0.3)";
* }
*/
function transparentize(amount, color) {
if (color === 'transparent') return color;
var parsedColor = parseToRgb(color);
var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
var colorWithAlpha = (0,esm_extends/* default */.A)({}, parsedColor, {
alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
});
return rgba(colorWithAlpha);
} // prettier-ignore
var curriedTransparentize = /*#__PURE__*/curry
/* ::<number | string, string, string> */
(transparentize);
var curriedTransparentize$1 = curriedTransparentize;
/**
* Shorthand for easily setting the animation property. Allows either multiple arrays with animations
* or a single animation spread over the arguments.
* @example
* // Styles as object usage
* const styles = {
* ...animation(['rotate', '1s', 'ease-in-out'], ['colorchange', '2s'])
* }
*
* // styled-components usage
* const div = styled.div`
* ${animation(['rotate', '1s', 'ease-in-out'], ['colorchange', '2s'])}
* `
*
* // CSS as JS Output
*
* div {
* 'animation': 'rotate 1s ease-in-out, colorchange 2s'
* }
* @example
* // Styles as object usage
* const styles = {
* ...animation('rotate', '1s', 'ease-in-out')
* }
*
* // styled-components usage
* const div = styled.div`
* ${animation('rotate', '1s', 'ease-in-out')}
* `
*
* // CSS as JS Output
*
* div {
* 'animation': 'rotate 1s ease-in-out'
* }
*/
function animation() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// Allow single or multiple animations passed
var multiMode = Array.isArray(args[0]);
if (!multiMode && args.length > 8) {
throw new PolishedError(64);
}
var code = args.map(function (arg) {
if (multiMode && !Array.isArray(arg) || !multiMode && Array.isArray(arg)) {
throw new PolishedError(65);
}
if (Array.isArray(arg) && arg.length > 8) {
throw new PolishedError(66);
}
return Array.isArray(arg) ? arg.join(' ') : arg;
}).join(', ');
return {
animation: code
};
}
/**
* Shorthand that accepts any number of backgroundImage values as parameters for creating a single background statement.
* @example
* // Styles as object usage
* const styles = {
* ...backgroundImages('url("/image/background.jpg")', 'linear-gradient(red, green)')
* }
*
* // styled-components usage
* const div = styled.div`
* ${backgroundImages('url("/image/background.jpg")', 'linear-gradient(red, green)')}
* `
*
* // CSS as JS Output
*
* div {
* 'backgroundImage': 'url("/image/background.jpg"), linear-gradient(red, green)'
* }
*/
function backgroundImages() {
for (var _len = arguments.length, properties = new Array(_len), _key = 0; _key < _len; _key++) {
properties[_key] = arguments[_key];
}
return {
backgroundImage: properties.join(', ')
};
}
/**
* Shorthand that accepts any number of background values as parameters for creating a single background statement.
* @example
* // Styles as object usage
* const styles = {
* ...backgrounds('url("/image/background.jpg")', 'linear-gradient(red, green)', 'center no-repeat')
* }
*
* // styled-components usage
* const div = styled.div`
* ${backgrounds('url("/image/background.jpg")', 'linear-gradient(red, green)', 'center no-repeat')}
* `
*
* // CSS as JS Output
*
* div {
* 'background': 'url("/image/background.jpg"), linear-gradient(red, green), center no-repeat'
* }
*/
function backgrounds() {
for (var _len = arguments.length, properties = new Array(_len), _key = 0; _key < _len; _key++) {
properties[_key] = arguments[_key];
}
return {
background: properties.join(', ')
};
}
var sideMap = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left']));
/**
* Shorthand for the border property that splits out individual properties for use with tools like Fela and Styletron. A side keyword can optionally be passed to target only one side's border properties.
*
* @example
* // Styles as object usage
* const styles = {
* ...border('1px', 'solid', 'red')
* }
*
* // styled-components usage
* const div = styled.div`
* ${border('1px', 'solid', 'red')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderColor': 'red',
* 'borderStyle': 'solid',
* 'borderWidth': `1px`,
* }
*
* // Styles as object usage
* const styles = {
* ...border('top', '1px', 'solid', 'red')
* }
*
* // styled-components usage
* const div = styled.div`
* ${border('top', '1px', 'solid', 'red')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopColor': 'red',
* 'borderTopStyle': 'solid',
* 'borderTopWidth': `1px`,
* }
*/
function border(sideKeyword) {
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
values[_key - 1] = arguments[_key];
}
if (typeof sideKeyword === 'string' && sideMap.indexOf(sideKeyword) >= 0) {
var _ref;
return _ref = {}, _ref["border" + capitalizeString(sideKeyword) + "Width"] = values[0], _ref["border" + capitalizeString(sideKeyword) + "Style"] = values[1], _ref["border" + capitalizeString(sideKeyword) + "Color"] = values[2], _ref;
} else {
values.unshift(sideKeyword);
return {
borderWidth: values[0],
borderStyle: values[1],
borderColor: values[2]
};
}
}
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...borderColor('red', 'green', 'blue', 'yellow')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderColor('red', 'green', 'blue', 'yellow')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopColor': 'red',
* 'borderRightColor': 'green',
* 'borderBottomColor': 'blue',
* 'borderLeftColor': 'yellow'
* }
*/
function borderColor() {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return directionalProperty.apply(void 0, ['borderColor'].concat(values));
}
/**
* Shorthand that accepts a value for side and a value for radius and applies the radius value to both corners of the side.
* @example
* // Styles as object usage
* const styles = {
* ...borderRadius('top', '5px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderRadius('top', '5px')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopRightRadius': '5px',
* 'borderTopLeftRadius': '5px',
* }
*/
function borderRadius(side, radius) {
var uppercaseSide = capitalizeString(side);
if (!radius && radius !== 0) {
throw new PolishedError(62);
}
if (uppercaseSide === 'Top' || uppercaseSide === 'Bottom') {
var _ref;
return _ref = {}, _ref["border" + uppercaseSide + "RightRadius"] = radius, _ref["border" + uppercaseSide + "LeftRadius"] = radius, _ref;
}
if (uppercaseSide === 'Left' || uppercaseSide === 'Right') {
var _ref2;
return _ref2 = {}, _ref2["borderTop" + uppercaseSide + "Radius"] = radius, _ref2["borderBottom" + uppercaseSide + "Radius"] = radius, _ref2;
}
throw new PolishedError(63);
}
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...borderStyle('solid', 'dashed', 'dotted', 'double')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderStyle('solid', 'dashed', 'dotted', 'double')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopStyle': 'solid',
* 'borderRightStyle': 'dashed',
* 'borderBottomStyle': 'dotted',
* 'borderLeftStyle': 'double'
* }
*/
function borderStyle() {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return directionalProperty.apply(void 0, ['borderStyle'].concat(values));
}
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...borderWidth('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${borderWidth('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'borderTopWidth': '12px',
* 'borderRightWidth': '24px',
* 'borderBottomWidth': '36px',
* 'borderLeftWidth': '48px'
* }
*/
function borderWidth() {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return directionalProperty.apply(void 0, ['borderWidth'].concat(values));
}
function generateSelectors(template, state) {
var stateSuffix = state ? ":" + state : '';
return template(stateSuffix);
}
/**
* Function helper that adds an array of states to a template of selectors. Used in textInputs and buttons.
* @private
*/
function statefulSelectors(states, template, stateMap) {
if (!template) throw new PolishedError(67);
if (states.length === 0) return generateSelectors(template, null);
var selectors = [];
for (var i = 0; i < states.length; i += 1) {
if (stateMap && stateMap.indexOf(states[i]) < 0) {
throw new PolishedError(68);
}
selectors.push(generateSelectors(template, states[i]));
}
selectors = selectors.join(',');
return selectors;
}
var stateMap$1 = (/* unused pure expression or super */ null && ([undefined, null, 'active', 'focus', 'hover']));
function template$1(state) {
return "button" + state + ",\n input[type=\"button\"]" + state + ",\n input[type=\"reset\"]" + state + ",\n input[type=\"submit\"]" + state;
}
/**
* Populates selectors that target all buttons. You can pass optional states to append to the selectors.
* @example
* // Styles as object usage
* const styles = {
* [buttons('active')]: {
* 'border': 'none'
* }
* }
*
* // styled-components usage
* const div = styled.div`
* > ${buttons('active')} {
* border: none;
* }
* `
*
* // CSS in JS Output
*
* 'button:active,
* 'input[type="button"]:active,
* 'input[type=\"reset\"]:active,
* 'input[type=\"submit\"]:active: {
* 'border': 'none'
* }
*/
function buttons() {
for (var _len = arguments.length, states = new Array(_len), _key = 0; _key < _len; _key++) {
states[_key] = arguments[_key];
}
return statefulSelectors(states, template$1, stateMap$1);
}
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...margin('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${margin('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'marginTop': '12px',
* 'marginRight': '24px',
* 'marginBottom': '36px',
* 'marginLeft': '48px'
* }
*/
function margin() {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return directionalProperty.apply(void 0, ['margin'].concat(values));
}
/**
* Shorthand that accepts up to four values, including null to skip a value, and maps them to their respective directions.
* @example
* // Styles as object usage
* const styles = {
* ...padding('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${padding('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'paddingTop': '12px',
* 'paddingRight': '24px',
* 'paddingBottom': '36px',
* 'paddingLeft': '48px'
* }
*/
function padding() {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return directionalProperty.apply(void 0, ['padding'].concat(values));
}
var positionMap = (/* unused pure expression or super */ null && (['absolute', 'fixed', 'relative', 'static', 'sticky']));
/**
* Shorthand accepts up to five values, including null to skip a value, and maps them to their respective directions. The first value can optionally be a position keyword.
* @example
* // Styles as object usage
* const styles = {
* ...position('12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${position('12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'top': '12px',
* 'right': '24px',
* 'bottom': '36px',
* 'left': '48px'
* }
*
* // Styles as object usage
* const styles = {
* ...position('absolute', '12px', '24px', '36px', '48px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${position('absolute', '12px', '24px', '36px', '48px')}
* `
*
* // CSS as JS Output
*
* div {
* 'position': 'absolute',
* 'top': '12px',
* 'right': '24px',
* 'bottom': '36px',
* 'left': '48px'
* }
*/
function position(firstValue) {
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
values[_key - 1] = arguments[_key];
}
if (positionMap.indexOf(firstValue) >= 0 && firstValue) {
return _extends({}, directionalProperty.apply(void 0, [''].concat(values)), {
position: firstValue
});
} else {
return directionalProperty.apply(void 0, ['', firstValue].concat(values));
}
}
/**
* Shorthand to set the height and width properties in a single statement.
* @example
* // Styles as object usage
* const styles = {
* ...size('300px', '250px')
* }
*
* // styled-components usage
* const div = styled.div`
* ${size('300px', '250px')}
* `
*
* // CSS as JS Output
*
* div {
* 'height': '300px',
* 'width': '250px',
* }
*/
function size(height, width) {
if (width === void 0) {
width = height;
}
return {
height: height,
width: width
};
}
var stateMap = (/* unused pure expression or super */ null && ([undefined, null, 'active', 'focus', 'hover']));
function template(state) {
return "input[type=\"color\"]" + state + ",\n input[type=\"date\"]" + state + ",\n input[type=\"datetime\"]" + state + ",\n input[type=\"datetime-local\"]" + state + ",\n input[type=\"email\"]" + state + ",\n input[type=\"month\"]" + state + ",\n input[type=\"number\"]" + state + ",\n input[type=\"password\"]" + state + ",\n input[type=\"search\"]" + state + ",\n input[type=\"tel\"]" + state + ",\n input[type=\"text\"]" + state + ",\n input[type=\"time\"]" + state + ",\n input[type=\"url\"]" + state + ",\n input[type=\"week\"]" + state + ",\n input:not([type])" + state + ",\n textarea" + state;
}
/**
* Populates selectors that target all text inputs. You can pass optional states to append to the selectors.
* @example
* // Styles as object usage
* const styles = {
* [textInputs('active')]: {
* 'border': 'none'
* }
* }
*
* // styled-components usage
* const div = styled.div`
* > ${textInputs('active')} {
* border: none;
* }
* `
*
* // CSS in JS Output
*
* 'input[type="color"]:active,
* input[type="date"]:active,
* input[type="datetime"]:active,
* input[type="datetime-local"]:active,
* input[type="email"]:active,
* input[type="month"]:active,
* input[type="number"]:active,
* input[type="password"]:active,
* input[type="search"]:active,
* input[type="tel"]:active,
* input[type="text"]:active,
* input[type="time"]:active,
* input[type="url"]:active,
* input[type="week"]:active,
* input:not([type]):active,
* textarea:active': {
* 'border': 'none'
* }
*/
function textInputs() {
for (var _len = arguments.length, states = new Array(_len), _key = 0; _key < _len; _key++) {
states[_key] = arguments[_key];
}
return statefulSelectors(states, template, stateMap);
}
/**
* Accepts any number of transition values as parameters for creating a single transition statement. You may also pass an array of properties as the first parameter that you would like to apply the same transition values to (second parameter).
* @example
* // Styles as object usage
* const styles = {
* ...transitions('opacity 1.0s ease-in 0s', 'width 2.0s ease-in 2s'),
* ...transitions(['color', 'background-color'], '2.0s ease-in 2s')
* }
*
* // styled-components usage
* const div = styled.div`
* ${transitions('opacity 1.0s ease-in 0s', 'width 2.0s ease-in 2s')};
* ${transitions(['color', 'background-color'], '2.0s ease-in 2s'),};
* `
*
* // CSS as JS Output
*
* div {
* 'transition': 'opacity 1.0s ease-in 0s, width 2.0s ease-in 2s'
* 'transition': 'color 2.0s ease-in 2s, background-color 2.0s ease-in 2s',
* }
*/
function transitions() {
for (var _len = arguments.length, properties = new Array(_len), _key = 0; _key < _len; _key++) {
properties[_key] = arguments[_key];
}
if (Array.isArray(properties[0]) && properties.length === 2) {
var value = properties[1];
if (typeof value !== 'string') {
throw new PolishedError(61);
}
var transitionsString = properties[0].map(function (property) {
return property + " " + value;
}).join(', ');
return {
transition: transitionsString
};
} else {
return {
transition: properties.join(', ')
};
}
}
/***/ }),
/***/ "../../node_modules/.pnpm/telejson@7.2.0/node_modules/telejson/dist/chunk-465TF3XA.mjs":
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ P$: () => (/* binding */ __commonJS),
/* harmony export */ bc: () => (/* binding */ extractEventHiddenProperties),
/* harmony export */ f1: () => (/* binding */ __toESM)
/* harmony export */ });
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// src/dom-event.ts
var eventProperties = [
"bubbles",
"cancelBubble",
"cancelable",
"composed",
"currentTarget",
"defaultPrevented",
"eventPhase",
"isTrusted",
"returnValue",
"srcElement",
"target",
"timeStamp",
"type"
];
var customEventSpecificProperties = ["detail"];
function extractEventHiddenProperties(event) {
const rebuildEvent = eventProperties.filter((value) => event[value] !== void 0).reduce((acc, value) => {
return { ...acc, [value]: event[value] };
}, {});
if (event instanceof CustomEvent) {
customEventSpecificProperties.filter((value) => event[value] !== void 0).forEach((value) => {
rebuildEvent[value] = event[value];
});
}
return rebuildEvent;
}
/***/ }),
/***/ "../../node_modules/.pnpm/telejson@7.2.0/node_modules/telejson/dist/index.mjs":
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ As: () => (/* binding */ stringify)
/* harmony export */ });
/* unused harmony exports isJSON, parse, replacer, reviver */
/* harmony import */ var _chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/telejson@7.2.0/node_modules/telejson/dist/chunk-465TF3XA.mjs");
/* harmony import */ var memoizerific__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/memoizerific@1.11.3/node_modules/memoizerific/memoizerific.js");
/* harmony import */ var memoizerific__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(memoizerific__WEBPACK_IMPORTED_MODULE_1__);
// node_modules/has-symbols/shams.js
var require_shams = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/has-symbols/shams.js"(exports, module) {
"use strict";
module.exports = function hasSymbols() {
if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
return false;
}
if (typeof Symbol.iterator === "symbol") {
return true;
}
var obj = {};
var sym = Symbol("test");
var symObj = Object(sym);
if (typeof sym === "string") {
return false;
}
if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
return false;
}
if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
return false;
}
var symVal = 42;
obj[sym] = symVal;
for (sym in obj) {
return false;
}
if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
return false;
}
if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
return false;
}
var syms = Object.getOwnPropertySymbols(obj);
if (syms.length !== 1 || syms[0] !== sym) {
return false;
}
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
return false;
}
if (typeof Object.getOwnPropertyDescriptor === "function") {
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
if (descriptor.value !== symVal || descriptor.enumerable !== true) {
return false;
}
}
return true;
};
}
});
// node_modules/has-symbols/index.js
var require_has_symbols = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/has-symbols/index.js"(exports, module) {
"use strict";
var origSymbol = typeof Symbol !== "undefined" && Symbol;
var hasSymbolSham = require_shams();
module.exports = function hasNativeSymbols() {
if (typeof origSymbol !== "function") {
return false;
}
if (typeof Symbol !== "function") {
return false;
}
if (typeof origSymbol("foo") !== "symbol") {
return false;
}
if (typeof Symbol("bar") !== "symbol") {
return false;
}
return hasSymbolSham();
};
}
});
// node_modules/function-bind/implementation.js
var require_implementation = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/function-bind/implementation.js"(exports, module) {
"use strict";
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
var slice = Array.prototype.slice;
var toStr = Object.prototype.toString;
var funcType = "[object Function]";
module.exports = function bind(that) {
var target = this;
if (typeof target !== "function" || toStr.call(target) !== funcType) {
throw new TypeError(ERROR_MESSAGE + target);
}
var args2 = slice.call(arguments, 1);
var bound;
var binder = function() {
if (this instanceof bound) {
var result2 = target.apply(
this,
args2.concat(slice.call(arguments))
);
if (Object(result2) === result2) {
return result2;
}
return this;
} else {
return target.apply(
that,
args2.concat(slice.call(arguments))
);
}
};
var boundLength = Math.max(0, target.length - args2.length);
var boundArgs = [];
for (var i = 0; i < boundLength; i++) {
boundArgs.push("$" + i);
}
bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
if (target.prototype) {
var Empty = function Empty2() {
};
Empty.prototype = target.prototype;
bound.prototype = new Empty();
Empty.prototype = null;
}
return bound;
};
}
});
// node_modules/function-bind/index.js
var require_function_bind = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/function-bind/index.js"(exports, module) {
"use strict";
var implementation = require_implementation();
module.exports = Function.prototype.bind || implementation;
}
});
// node_modules/has/src/index.js
var require_src = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/has/src/index.js"(exports, module) {
"use strict";
var bind = require_function_bind();
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
}
});
// node_modules/get-intrinsic/index.js
var require_get_intrinsic = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/get-intrinsic/index.js"(exports, module) {
"use strict";
var undefined2;
var $SyntaxError = SyntaxError;
var $Function = Function;
var $TypeError = TypeError;
var getEvalledConstructor = function(expressionSyntax) {
try {
return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
} catch (e) {
}
};
var $gOPD = Object.getOwnPropertyDescriptor;
if ($gOPD) {
try {
$gOPD({}, "");
} catch (e) {
$gOPD = null;
}
}
var throwTypeError = function() {
throw new $TypeError();
};
var ThrowTypeError = $gOPD ? function() {
try {
arguments.callee;
return throwTypeError;
} catch (calleeThrows) {
try {
return $gOPD(arguments, "callee").get;
} catch (gOPDthrows) {
return throwTypeError;
}
}
}() : throwTypeError;
var hasSymbols = require_has_symbols()();
var getProto = Object.getPrototypeOf || function(x) {
return x.__proto__;
};
var needsEval = {};
var TypedArray = typeof Uint8Array === "undefined" ? undefined2 : getProto(Uint8Array);
var INTRINSICS = {
"%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError,
"%Array%": Array,
"%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer,
"%ArrayIteratorPrototype%": hasSymbols ? getProto([][Symbol.iterator]()) : undefined2,
"%AsyncFromSyncIteratorPrototype%": undefined2,
"%AsyncFunction%": needsEval,
"%AsyncGenerator%": needsEval,
"%AsyncGeneratorFunction%": needsEval,
"%AsyncIteratorPrototype%": needsEval,
"%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics,
"%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt,
"%Boolean%": Boolean,
"%DataView%": typeof DataView === "undefined" ? undefined2 : DataView,
"%Date%": Date,
"%decodeURI%": decodeURI,
"%decodeURIComponent%": decodeURIComponent,
"%encodeURI%": encodeURI,
"%encodeURIComponent%": encodeURIComponent,
"%Error%": Error,
"%eval%": eval,
"%EvalError%": EvalError,
"%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array,
"%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array,
"%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry,
"%Function%": $Function,
"%GeneratorFunction%": needsEval,
"%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array,
"%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array,
"%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array,
"%isFinite%": isFinite,
"%isNaN%": isNaN,
"%IteratorPrototype%": hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined2,
"%JSON%": typeof JSON === "object" ? JSON : undefined2,
"%Map%": typeof Map === "undefined" ? undefined2 : Map,
"%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),
"%Math%": Math,
"%Number%": Number,
"%Object%": Object,
"%parseFloat%": parseFloat,
"%parseInt%": parseInt,
"%Promise%": typeof Promise === "undefined" ? undefined2 : Promise,
"%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy,
"%RangeError%": RangeError,
"%ReferenceError%": ReferenceError,
"%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect,
"%RegExp%": RegExp,
"%Set%": typeof Set === "undefined" ? undefined2 : Set,
"%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),
"%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer,
"%String%": String,
"%StringIteratorPrototype%": hasSymbols ? getProto(""[Symbol.iterator]()) : undefined2,
"%Symbol%": hasSymbols ? Symbol : undefined2,
"%SyntaxError%": $SyntaxError,
"%ThrowTypeError%": ThrowTypeError,
"%TypedArray%": TypedArray,
"%TypeError%": $TypeError,
"%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array,
"%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray,
"%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array,
"%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array,
"%URIError%": URIError,
"%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap,
"%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef,
"%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet
};
var doEval = function doEval2(name2) {
var value2;
if (name2 === "%AsyncFunction%") {
value2 = getEvalledConstructor("async function () {}");
} else if (name2 === "%GeneratorFunction%") {
value2 = getEvalledConstructor("function* () {}");
} else if (name2 === "%AsyncGeneratorFunction%") {
value2 = getEvalledConstructor("async function* () {}");
} else if (name2 === "%AsyncGenerator%") {
var fn = doEval2("%AsyncGeneratorFunction%");
if (fn) {
value2 = fn.prototype;
}
} else if (name2 === "%AsyncIteratorPrototype%") {
var gen = doEval2("%AsyncGenerator%");
if (gen) {
value2 = getProto(gen.prototype);
}
}
INTRINSICS[name2] = value2;
return value2;
};
var LEGACY_ALIASES = {
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
"%ArrayPrototype%": ["Array", "prototype"],
"%ArrayProto_entries%": ["Array", "prototype", "entries"],
"%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
"%ArrayProto_keys%": ["Array", "prototype", "keys"],
"%ArrayProto_values%": ["Array", "prototype", "values"],
"%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
"%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
"%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
"%BooleanPrototype%": ["Boolean", "prototype"],
"%DataViewPrototype%": ["DataView", "prototype"],
"%DatePrototype%": ["Date", "prototype"],
"%ErrorPrototype%": ["Error", "prototype"],
"%EvalErrorPrototype%": ["EvalError", "prototype"],
"%Float32ArrayPrototype%": ["Float32Array", "prototype"],
"%Float64ArrayPrototype%": ["Float64Array", "prototype"],
"%FunctionPrototype%": ["Function", "prototype"],
"%Generator%": ["GeneratorFunction", "prototype"],
"%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
"%Int8ArrayPrototype%": ["Int8Array", "prototype"],
"%Int16ArrayPrototype%": ["Int16Array", "prototype"],
"%Int32ArrayPrototype%": ["Int32Array", "prototype"],
"%JSONParse%": ["JSON", "parse"],
"%JSONStringify%": ["JSON", "stringify"],
"%MapPrototype%": ["Map", "prototype"],
"%NumberPrototype%": ["Number", "prototype"],
"%ObjectPrototype%": ["Object", "prototype"],
"%ObjProto_toString%": ["Object", "prototype", "toString"],
"%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
"%PromisePrototype%": ["Promise", "prototype"],
"%PromiseProto_then%": ["Promise", "prototype", "then"],
"%Promise_all%": ["Promise", "all"],
"%Promise_reject%": ["Promise", "reject"],
"%Promise_resolve%": ["Promise", "resolve"],
"%RangeErrorPrototype%": ["RangeError", "prototype"],
"%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
"%RegExpPrototype%": ["RegExp", "prototype"],
"%SetPrototype%": ["Set", "prototype"],
"%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
"%StringPrototype%": ["String", "prototype"],
"%SymbolPrototype%": ["Symbol", "prototype"],
"%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
"%TypedArrayPrototype%": ["TypedArray", "prototype"],
"%TypeErrorPrototype%": ["TypeError", "prototype"],
"%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
"%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
"%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
"%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
"%URIErrorPrototype%": ["URIError", "prototype"],
"%WeakMapPrototype%": ["WeakMap", "prototype"],
"%WeakSetPrototype%": ["WeakSet", "prototype"]
};
var bind = require_function_bind();
var hasOwn = require_src();
var $concat = bind.call(Function.call, Array.prototype.concat);
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
var $replace = bind.call(Function.call, String.prototype.replace);
var $strSlice = bind.call(Function.call, String.prototype.slice);
var $exec = bind.call(Function.call, RegExp.prototype.exec);
var rePropName2 = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var reEscapeChar2 = /\\(\\)?/g;
var stringToPath2 = function stringToPath3(string) {
var first = $strSlice(string, 0, 1);
var last = $strSlice(string, -1);
if (first === "%" && last !== "%") {
throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
} else if (last === "%" && first !== "%") {
throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
}
var result2 = [];
$replace(string, rePropName2, function(match, number, quote, subString) {
result2[result2.length] = quote ? $replace(subString, reEscapeChar2, "$1") : number || match;
});
return result2;
};
var getBaseIntrinsic = function getBaseIntrinsic2(name2, allowMissing) {
var intrinsicName = name2;
var alias;
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
alias = LEGACY_ALIASES[intrinsicName];
intrinsicName = "%" + alias[0] + "%";
}
if (hasOwn(INTRINSICS, intrinsicName)) {
var value2 = INTRINSICS[intrinsicName];
if (value2 === needsEval) {
value2 = doEval(intrinsicName);
}
if (typeof value2 === "undefined" && !allowMissing) {
throw new $TypeError("intrinsic " + name2 + " exists, but is not available. Please file an issue!");
}
return {
alias,
name: intrinsicName,
value: value2
};
}
throw new $SyntaxError("intrinsic " + name2 + " does not exist!");
};
module.exports = function GetIntrinsic(name2, allowMissing) {
if (typeof name2 !== "string" || name2.length === 0) {
throw new $TypeError("intrinsic name must be a non-empty string");
}
if (arguments.length > 1 && typeof allowMissing !== "boolean") {
throw new $TypeError('"allowMissing" argument must be a boolean');
}
if ($exec(/^%?[^%]*%?$/, name2) === null) {
throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
}
var parts = stringToPath2(name2);
var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
var intrinsicRealName = intrinsic.name;
var value2 = intrinsic.value;
var skipFurtherCaching = false;
var alias = intrinsic.alias;
if (alias) {
intrinsicBaseName = alias[0];
$spliceApply(parts, $concat([0, 1], alias));
}
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
var part = parts[i];
var first = $strSlice(part, 0, 1);
var last = $strSlice(part, -1);
if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) {
throw new $SyntaxError("property names with quotes must have matching quotes");
}
if (part === "constructor" || !isOwn) {
skipFurtherCaching = true;
}
intrinsicBaseName += "." + part;
intrinsicRealName = "%" + intrinsicBaseName + "%";
if (hasOwn(INTRINSICS, intrinsicRealName)) {
value2 = INTRINSICS[intrinsicRealName];
} else if (value2 != null) {
if (!(part in value2)) {
if (!allowMissing) {
throw new $TypeError("base intrinsic for " + name2 + " exists, but the property is not available.");
}
return void 0;
}
if ($gOPD && i + 1 >= parts.length) {
var desc = $gOPD(value2, part);
isOwn = !!desc;
if (isOwn && "get" in desc && !("originalValue" in desc.get)) {
value2 = desc.get;
} else {
value2 = value2[part];
}
} else {
isOwn = hasOwn(value2, part);
value2 = value2[part];
}
if (isOwn && !skipFurtherCaching) {
INTRINSICS[intrinsicRealName] = value2;
}
}
}
return value2;
};
}
});
// node_modules/call-bind/index.js
var require_call_bind = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/call-bind/index.js"(exports, module) {
"use strict";
var bind = require_function_bind();
var GetIntrinsic = require_get_intrinsic();
var $apply = GetIntrinsic("%Function.prototype.apply%");
var $call = GetIntrinsic("%Function.prototype.call%");
var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply);
var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true);
var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
var $max = GetIntrinsic("%Math.max%");
if ($defineProperty) {
try {
$defineProperty({}, "a", { value: 1 });
} catch (e) {
$defineProperty = null;
}
}
module.exports = function callBind(originalFunction) {
var func = $reflectApply(bind, $call, arguments);
if ($gOPD && $defineProperty) {
var desc = $gOPD(func, "length");
if (desc.configurable) {
$defineProperty(
func,
"length",
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
);
}
}
return func;
};
var applyBind = function applyBind2() {
return $reflectApply(bind, $apply, arguments);
};
if ($defineProperty) {
$defineProperty(module.exports, "apply", { value: applyBind });
} else {
module.exports.apply = applyBind;
}
}
});
// node_modules/call-bind/callBound.js
var require_callBound = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/call-bind/callBound.js"(exports, module) {
"use strict";
var GetIntrinsic = require_get_intrinsic();
var callBind = require_call_bind();
var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf"));
module.exports = function callBoundIntrinsic(name2, allowMissing) {
var intrinsic = GetIntrinsic(name2, !!allowMissing);
if (typeof intrinsic === "function" && $indexOf(name2, ".prototype.") > -1) {
return callBind(intrinsic);
}
return intrinsic;
};
}
});
// node_modules/has-tostringtag/shams.js
var require_shams2 = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/has-tostringtag/shams.js"(exports, module) {
"use strict";
var hasSymbols = require_shams();
module.exports = function hasToStringTagShams() {
return hasSymbols() && !!Symbol.toStringTag;
};
}
});
// node_modules/is-regex/index.js
var require_is_regex = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/is-regex/index.js"(exports, module) {
"use strict";
var callBound = require_callBound();
var hasToStringTag = require_shams2()();
var has;
var $exec;
var isRegexMarker;
var badStringifier;
if (hasToStringTag) {
has = callBound("Object.prototype.hasOwnProperty");
$exec = callBound("RegExp.prototype.exec");
isRegexMarker = {};
throwRegexMarker = function() {
throw isRegexMarker;
};
badStringifier = {
toString: throwRegexMarker,
valueOf: throwRegexMarker
};
if (typeof Symbol.toPrimitive === "symbol") {
badStringifier[Symbol.toPrimitive] = throwRegexMarker;
}
}
var throwRegexMarker;
var $toString = callBound("Object.prototype.toString");
var gOPD = Object.getOwnPropertyDescriptor;
var regexClass = "[object RegExp]";
module.exports = hasToStringTag ? function isRegex(value2) {
if (!value2 || typeof value2 !== "object") {
return false;
}
var descriptor = gOPD(value2, "lastIndex");
var hasLastIndexDataProperty = descriptor && has(descriptor, "value");
if (!hasLastIndexDataProperty) {
return false;
}
try {
$exec(value2, badStringifier);
} catch (e) {
return e === isRegexMarker;
}
} : function isRegex(value2) {
if (!value2 || typeof value2 !== "object" && typeof value2 !== "function") {
return false;
}
return $toString(value2) === regexClass;
};
}
});
// node_modules/is-function/index.js
var require_is_function = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/is-function/index.js"(exports, module) {
module.exports = isFunction3;
var toString2 = Object.prototype.toString;
function isFunction3(fn) {
if (!fn) {
return false;
}
var string = toString2.call(fn);
return string === "[object Function]" || typeof fn === "function" && string !== "[object RegExp]" || typeof window !== "undefined" && (fn === window.setTimeout || fn === window.alert || fn === window.confirm || fn === window.prompt);
}
}
});
// node_modules/is-symbol/index.js
var require_is_symbol = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__commonJS */ .P$)({
"node_modules/is-symbol/index.js"(exports, module) {
"use strict";
var toStr = Object.prototype.toString;
var hasSymbols = require_has_symbols()();
if (hasSymbols) {
symToStr = Symbol.prototype.toString;
symStringRegex = /^Symbol\(.*\)$/;
isSymbolObject = function isRealSymbolObject(value2) {
if (typeof value2.valueOf() !== "symbol") {
return false;
}
return symStringRegex.test(symToStr.call(value2));
};
module.exports = function isSymbol3(value2) {
if (typeof value2 === "symbol") {
return true;
}
if (toStr.call(value2) !== "[object Symbol]") {
return false;
}
try {
return isSymbolObject(value2);
} catch (e) {
return false;
}
};
} else {
module.exports = function isSymbol3(value2) {
return false;
};
}
var symToStr;
var symStringRegex;
var isSymbolObject;
}
});
// src/index.ts
var import_is_regex = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__toESM */ .f1)(require_is_regex());
var import_is_function = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__toESM */ .f1)(require_is_function());
var import_is_symbol = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .__toESM */ .f1)(require_is_symbol());
// node_modules/isobject/index.js
function isObject(val) {
return val != null && typeof val === "object" && Array.isArray(val) === false;
}
// node_modules/lodash-es/_freeGlobal.js
var freeGlobal = typeof __webpack_require__.g == "object" && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
var freeGlobal_default = freeGlobal;
// node_modules/lodash-es/_root.js
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root2 = freeGlobal_default || freeSelf || Function("return this")();
var root_default = root2;
// node_modules/lodash-es/_Symbol.js
var Symbol2 = root_default.Symbol;
var Symbol_default = Symbol2;
// node_modules/lodash-es/_getRawTag.js
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
var nativeObjectToString = objectProto.toString;
var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
function getRawTag(value2) {
var isOwn = hasOwnProperty.call(value2, symToStringTag), tag = value2[symToStringTag];
try {
value2[symToStringTag] = void 0;
var unmasked = true;
} catch (e) {
}
var result2 = nativeObjectToString.call(value2);
if (unmasked) {
if (isOwn) {
value2[symToStringTag] = tag;
} else {
delete value2[symToStringTag];
}
}
return result2;
}
var getRawTag_default = getRawTag;
// node_modules/lodash-es/_objectToString.js
var objectProto2 = Object.prototype;
var nativeObjectToString2 = objectProto2.toString;
function objectToString(value2) {
return nativeObjectToString2.call(value2);
}
var objectToString_default = objectToString;
// node_modules/lodash-es/_baseGetTag.js
var nullTag = "[object Null]";
var undefinedTag = "[object Undefined]";
var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
function baseGetTag(value2) {
if (value2 == null) {
return value2 === void 0 ? undefinedTag : nullTag;
}
return symToStringTag2 && symToStringTag2 in Object(value2) ? getRawTag_default(value2) : objectToString_default(value2);
}
var baseGetTag_default = baseGetTag;
// node_modules/lodash-es/isObjectLike.js
function isObjectLike(value2) {
return value2 != null && typeof value2 == "object";
}
var isObjectLike_default = (/* unused pure expression or super */ null && (isObjectLike));
// node_modules/lodash-es/isSymbol.js
var symbolTag = "[object Symbol]";
function isSymbol(value2) {
return typeof value2 == "symbol" || isObjectLike_default(value2) && baseGetTag_default(value2) == symbolTag;
}
var isSymbol_default = (/* unused pure expression or super */ null && (isSymbol));
// node_modules/lodash-es/_arrayMap.js
function arrayMap(array, iteratee) {
var index = -1, length = array == null ? 0 : array.length, result2 = Array(length);
while (++index < length) {
result2[index] = iteratee(array[index], index, array);
}
return result2;
}
var arrayMap_default = (/* unused pure expression or super */ null && (arrayMap));
// node_modules/lodash-es/isArray.js
var isArray = Array.isArray;
var isArray_default = (/* unused pure expression or super */ null && (isArray));
// node_modules/lodash-es/_baseToString.js
var INFINITY = (/* unused pure expression or super */ null && (1 / 0));
var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
var symbolToString = symbolProto ? symbolProto.toString : void 0;
function baseToString(value2) {
if (typeof value2 == "string") {
return value2;
}
if (isArray_default(value2)) {
return arrayMap_default(value2, baseToString) + "";
}
if (isSymbol_default(value2)) {
return symbolToString ? symbolToString.call(value2) : "";
}
var result2 = value2 + "";
return result2 == "0" && 1 / value2 == -INFINITY ? "-0" : result2;
}
var baseToString_default = (/* unused pure expression or super */ null && (baseToString));
// node_modules/lodash-es/isObject.js
function isObject2(value2) {
var type = typeof value2;
return value2 != null && (type == "object" || type == "function");
}
var isObject_default = isObject2;
// node_modules/lodash-es/isFunction.js
var asyncTag = "[object AsyncFunction]";
var funcTag = "[object Function]";
var genTag = "[object GeneratorFunction]";
var proxyTag = "[object Proxy]";
function isFunction(value2) {
if (!isObject_default(value2)) {
return false;
}
var tag = baseGetTag_default(value2);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
var isFunction_default = isFunction;
// node_modules/lodash-es/_coreJsData.js
var coreJsData = root_default["__core-js_shared__"];
var coreJsData_default = coreJsData;
// node_modules/lodash-es/_isMasked.js
var maskSrcKey = function() {
var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
return uid ? "Symbol(src)_1." + uid : "";
}();
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
var isMasked_default = isMasked;
// node_modules/lodash-es/_toSource.js
var funcProto = Function.prototype;
var funcToString = funcProto.toString;
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {
}
try {
return func + "";
} catch (e) {
}
}
return "";
}
var toSource_default = toSource;
// node_modules/lodash-es/_baseIsNative.js
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var funcProto2 = Function.prototype;
var objectProto3 = Object.prototype;
var funcToString2 = funcProto2.toString;
var hasOwnProperty2 = objectProto3.hasOwnProperty;
var reIsNative = RegExp(
"^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function baseIsNative(value2) {
if (!isObject_default(value2) || isMasked_default(value2)) {
return false;
}
var pattern = isFunction_default(value2) ? reIsNative : reIsHostCtor;
return pattern.test(toSource_default(value2));
}
var baseIsNative_default = baseIsNative;
// node_modules/lodash-es/_getValue.js
function getValue(object, key2) {
return object == null ? void 0 : object[key2];
}
var getValue_default = getValue;
// node_modules/lodash-es/_getNative.js
function getNative(object, key2) {
var value2 = getValue_default(object, key2);
return baseIsNative_default(value2) ? value2 : void 0;
}
var getNative_default = getNative;
// node_modules/lodash-es/eq.js
function eq(value2, other) {
return value2 === other || value2 !== value2 && other !== other;
}
var eq_default = eq;
// node_modules/lodash-es/_isKey.js
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
var reIsPlainProp = /^\w*$/;
function isKey(value2, object) {
if (isArray_default(value2)) {
return false;
}
var type = typeof value2;
if (type == "number" || type == "symbol" || type == "boolean" || value2 == null || isSymbol_default(value2)) {
return true;
}
return reIsPlainProp.test(value2) || !reIsDeepProp.test(value2) || object != null && value2 in Object(object);
}
var isKey_default = (/* unused pure expression or super */ null && (isKey));
// node_modules/lodash-es/_nativeCreate.js
var nativeCreate = getNative_default(Object, "create");
var nativeCreate_default = nativeCreate;
// node_modules/lodash-es/_hashClear.js
function hashClear() {
this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
this.size = 0;
}
var hashClear_default = hashClear;
// node_modules/lodash-es/_hashDelete.js
function hashDelete(key2) {
var result2 = this.has(key2) && delete this.__data__[key2];
this.size -= result2 ? 1 : 0;
return result2;
}
var hashDelete_default = hashDelete;
// node_modules/lodash-es/_hashGet.js
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var objectProto4 = Object.prototype;
var hasOwnProperty3 = objectProto4.hasOwnProperty;
function hashGet(key2) {
var data = this.__data__;
if (nativeCreate_default) {
var result2 = data[key2];
return result2 === HASH_UNDEFINED ? void 0 : result2;
}
return hasOwnProperty3.call(data, key2) ? data[key2] : void 0;
}
var hashGet_default = hashGet;
// node_modules/lodash-es/_hashHas.js
var objectProto5 = Object.prototype;
var hasOwnProperty4 = objectProto5.hasOwnProperty;
function hashHas(key2) {
var data = this.__data__;
return nativeCreate_default ? data[key2] !== void 0 : hasOwnProperty4.call(data, key2);
}
var hashHas_default = hashHas;
// node_modules/lodash-es/_hashSet.js
var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
function hashSet(key2, value2) {
var data = this.__data__;
this.size += this.has(key2) ? 0 : 1;
data[key2] = nativeCreate_default && value2 === void 0 ? HASH_UNDEFINED2 : value2;
return this;
}
var hashSet_default = hashSet;
// node_modules/lodash-es/_Hash.js
function Hash(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
Hash.prototype.clear = hashClear_default;
Hash.prototype["delete"] = hashDelete_default;
Hash.prototype.get = hashGet_default;
Hash.prototype.has = hashHas_default;
Hash.prototype.set = hashSet_default;
var Hash_default = Hash;
// node_modules/lodash-es/_listCacheClear.js
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
var listCacheClear_default = listCacheClear;
// node_modules/lodash-es/_assocIndexOf.js
function assocIndexOf(array, key2) {
var length = array.length;
while (length--) {
if (eq_default(array[length][0], key2)) {
return length;
}
}
return -1;
}
var assocIndexOf_default = assocIndexOf;
// node_modules/lodash-es/_listCacheDelete.js
var arrayProto = Array.prototype;
var splice = arrayProto.splice;
function listCacheDelete(key2) {
var data = this.__data__, index = assocIndexOf_default(data, key2);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
var listCacheDelete_default = listCacheDelete;
// node_modules/lodash-es/_listCacheGet.js
function listCacheGet(key2) {
var data = this.__data__, index = assocIndexOf_default(data, key2);
return index < 0 ? void 0 : data[index][1];
}
var listCacheGet_default = listCacheGet;
// node_modules/lodash-es/_listCacheHas.js
function listCacheHas(key2) {
return assocIndexOf_default(this.__data__, key2) > -1;
}
var listCacheHas_default = listCacheHas;
// node_modules/lodash-es/_listCacheSet.js
function listCacheSet(key2, value2) {
var data = this.__data__, index = assocIndexOf_default(data, key2);
if (index < 0) {
++this.size;
data.push([key2, value2]);
} else {
data[index][1] = value2;
}
return this;
}
var listCacheSet_default = listCacheSet;
// node_modules/lodash-es/_ListCache.js
function ListCache(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
ListCache.prototype.clear = listCacheClear_default;
ListCache.prototype["delete"] = listCacheDelete_default;
ListCache.prototype.get = listCacheGet_default;
ListCache.prototype.has = listCacheHas_default;
ListCache.prototype.set = listCacheSet_default;
var ListCache_default = ListCache;
// node_modules/lodash-es/_Map.js
var Map2 = getNative_default(root_default, "Map");
var Map_default = Map2;
// node_modules/lodash-es/_mapCacheClear.js
function mapCacheClear() {
this.size = 0;
this.__data__ = {
"hash": new Hash_default(),
"map": new (Map_default || ListCache_default)(),
"string": new Hash_default()
};
}
var mapCacheClear_default = mapCacheClear;
// node_modules/lodash-es/_isKeyable.js
function isKeyable(value2) {
var type = typeof value2;
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value2 !== "__proto__" : value2 === null;
}
var isKeyable_default = isKeyable;
// node_modules/lodash-es/_getMapData.js
function getMapData(map, key2) {
var data = map.__data__;
return isKeyable_default(key2) ? data[typeof key2 == "string" ? "string" : "hash"] : data.map;
}
var getMapData_default = getMapData;
// node_modules/lodash-es/_mapCacheDelete.js
function mapCacheDelete(key2) {
var result2 = getMapData_default(this, key2)["delete"](key2);
this.size -= result2 ? 1 : 0;
return result2;
}
var mapCacheDelete_default = mapCacheDelete;
// node_modules/lodash-es/_mapCacheGet.js
function mapCacheGet(key2) {
return getMapData_default(this, key2).get(key2);
}
var mapCacheGet_default = mapCacheGet;
// node_modules/lodash-es/_mapCacheHas.js
function mapCacheHas(key2) {
return getMapData_default(this, key2).has(key2);
}
var mapCacheHas_default = mapCacheHas;
// node_modules/lodash-es/_mapCacheSet.js
function mapCacheSet(key2, value2) {
var data = getMapData_default(this, key2), size = data.size;
data.set(key2, value2);
this.size += data.size == size ? 0 : 1;
return this;
}
var mapCacheSet_default = mapCacheSet;
// node_modules/lodash-es/_MapCache.js
function MapCache(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
MapCache.prototype.clear = mapCacheClear_default;
MapCache.prototype["delete"] = mapCacheDelete_default;
MapCache.prototype.get = mapCacheGet_default;
MapCache.prototype.has = mapCacheHas_default;
MapCache.prototype.set = mapCacheSet_default;
var MapCache_default = MapCache;
// node_modules/lodash-es/memoize.js
var FUNC_ERROR_TEXT = "Expected a function";
function memoize(func, resolver) {
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args2 = arguments, key2 = resolver ? resolver.apply(this, args2) : args2[0], cache = memoized.cache;
if (cache.has(key2)) {
return cache.get(key2);
}
var result2 = func.apply(this, args2);
memoized.cache = cache.set(key2, result2) || cache;
return result2;
};
memoized.cache = new (memoize.Cache || MapCache_default)();
return memoized;
}
memoize.Cache = MapCache_default;
var memoize_default = memoize;
// node_modules/lodash-es/_memoizeCapped.js
var MAX_MEMOIZE_SIZE = 500;
function memoizeCapped(func) {
var result2 = memoize_default(func, function(key2) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key2;
});
var cache = result2.cache;
return result2;
}
var memoizeCapped_default = memoizeCapped;
// node_modules/lodash-es/_stringToPath.js
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar = /\\(\\)?/g;
var stringToPath = memoizeCapped_default(function(string) {
var result2 = [];
if (string.charCodeAt(0) === 46) {
result2.push("");
}
string.replace(rePropName, function(match, number, quote, subString) {
result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
});
return result2;
});
var stringToPath_default = (/* unused pure expression or super */ null && (stringToPath));
// node_modules/lodash-es/toString.js
function toString(value2) {
return value2 == null ? "" : baseToString_default(value2);
}
var toString_default = (/* unused pure expression or super */ null && (toString));
// node_modules/lodash-es/_castPath.js
function castPath(value2, object) {
if (isArray_default(value2)) {
return value2;
}
return isKey_default(value2, object) ? [value2] : stringToPath_default(toString_default(value2));
}
var castPath_default = (/* unused pure expression or super */ null && (castPath));
// node_modules/lodash-es/_toKey.js
var INFINITY2 = (/* unused pure expression or super */ null && (1 / 0));
function toKey(value2) {
if (typeof value2 == "string" || isSymbol_default(value2)) {
return value2;
}
var result2 = value2 + "";
return result2 == "0" && 1 / value2 == -INFINITY2 ? "-0" : result2;
}
var toKey_default = (/* unused pure expression or super */ null && (toKey));
// node_modules/lodash-es/_baseGet.js
function baseGet(object, path) {
path = castPath_default(path, object);
var index = 0, length = path.length;
while (object != null && index < length) {
object = object[toKey_default(path[index++])];
}
return index && index == length ? object : void 0;
}
var baseGet_default = (/* unused pure expression or super */ null && (baseGet));
// node_modules/lodash-es/get.js
function get(object, path, defaultValue) {
var result2 = object == null ? void 0 : baseGet_default(object, path);
return result2 === void 0 ? defaultValue : result2;
}
var get_default = (/* unused pure expression or super */ null && (get));
// src/index.ts
var isObject3 = isObject;
var removeCodeComments = (code) => {
let inQuoteChar = null;
let inBlockComment = false;
let inLineComment = false;
let inRegexLiteral = false;
let newCode = "";
if (code.indexOf("//") >= 0 || code.indexOf("/*") >= 0) {
for (let i = 0; i < code.length; i += 1) {
if (!inQuoteChar && !inBlockComment && !inLineComment && !inRegexLiteral) {
if (code[i] === '"' || code[i] === "'" || code[i] === "`") {
inQuoteChar = code[i];
} else if (code[i] === "/" && code[i + 1] === "*") {
inBlockComment = true;
} else if (code[i] === "/" && code[i + 1] === "/") {
inLineComment = true;
} else if (code[i] === "/" && code[i + 1] !== "/") {
inRegexLiteral = true;
}
} else {
if (inQuoteChar && (code[i] === inQuoteChar && code[i - 1] !== "\\" || code[i] === "\n" && inQuoteChar !== "`")) {
inQuoteChar = null;
}
if (inRegexLiteral && (code[i] === "/" && code[i - 1] !== "\\" || code[i] === "\n")) {
inRegexLiteral = false;
}
if (inBlockComment && code[i - 1] === "/" && code[i - 2] === "*") {
inBlockComment = false;
}
if (inLineComment && code[i] === "\n") {
inLineComment = false;
}
}
if (!inBlockComment && !inLineComment) {
newCode += code[i];
}
}
} else {
newCode = code;
}
return newCode;
};
var cleanCode = memoizerific__WEBPACK_IMPORTED_MODULE_1___default()(1e4)(
(code) => removeCodeComments(code).replace(/\n\s*/g, "").trim()
);
var convertShorthandMethods = function convertShorthandMethods2(key2, stringified) {
const fnHead = stringified.slice(0, stringified.indexOf("{"));
const fnBody = stringified.slice(stringified.indexOf("{"));
if (fnHead.includes("=>")) {
return stringified;
}
if (fnHead.includes("function")) {
return stringified;
}
let modifiedHead = fnHead;
modifiedHead = modifiedHead.replace(key2, "function");
return modifiedHead + fnBody;
};
var dateFormat = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/;
var isJSON = (input) => input.match(/^[\[\{\"\}].*[\]\}\"]$/);
function convertUnconventionalData(data) {
if (!isObject3(data)) {
return data;
}
let result2 = data;
let wasMutated = false;
if (typeof Event !== "undefined" && data instanceof Event) {
result2 = (0,_chunk_465TF3XA_mjs__WEBPACK_IMPORTED_MODULE_0__/* .extractEventHiddenProperties */ .bc)(result2);
wasMutated = true;
}
result2 = Object.keys(result2).reduce((acc, key2) => {
try {
if (result2[key2]) {
result2[key2].toJSON;
}
acc[key2] = result2[key2];
} catch (err) {
wasMutated = true;
}
return acc;
}, {});
return wasMutated ? result2 : data;
}
var replacer = function replacer2(options2) {
let objects;
let map;
let stack;
let keys;
return function replace(key2, value2) {
try {
if (key2 === "") {
keys = [];
objects = /* @__PURE__ */ new Map([[value2, "[]"]]);
map = /* @__PURE__ */ new Map();
stack = [];
return value2;
}
const origin = map.get(this) || this;
while (stack.length && origin !== stack[0]) {
stack.shift();
keys.pop();
}
if (typeof value2 === "boolean") {
return value2;
}
if (value2 === void 0) {
if (!options2.allowUndefined) {
return void 0;
}
return "_undefined_";
}
if (value2 === null) {
return null;
}
if (typeof value2 === "number") {
if (value2 === -Infinity) {
return "_-Infinity_";
}
if (value2 === Infinity) {
return "_Infinity_";
}
if (Number.isNaN(value2)) {
return "_NaN_";
}
return value2;
}
if (typeof value2 === "bigint") {
return `_bigint_${value2.toString()}`;
}
if (typeof value2 === "string") {
if (dateFormat.test(value2)) {
if (!options2.allowDate) {
return void 0;
}
return `_date_${value2}`;
}
return value2;
}
if ((0, import_is_regex.default)(value2)) {
if (!options2.allowRegExp) {
return void 0;
}
return `_regexp_${value2.flags}|${value2.source}`;
}
if ((0, import_is_function.default)(value2)) {
if (!options2.allowFunction) {
return void 0;
}
const { name: name2 } = value2;
const stringified = value2.toString();
if (!stringified.match(
/(\[native code\]|WEBPACK_IMPORTED_MODULE|__webpack_exports__|__webpack_require__)/
)) {
return `_function_${name2}|${cleanCode(convertShorthandMethods(key2, stringified))}`;
}
return `_function_${name2}|${(() => {
}).toString()}`;
}
if ((0, import_is_symbol.default)(value2)) {
if (!options2.allowSymbol) {
return void 0;
}
const globalRegistryKey = Symbol.keyFor(value2);
if (globalRegistryKey !== void 0) {
return `_gsymbol_${globalRegistryKey}`;
}
return `_symbol_${value2.toString().slice(7, -1)}`;
}
if (stack.length >= options2.maxDepth) {
if (Array.isArray(value2)) {
return `[Array(${value2.length})]`;
}
return "[Object]";
}
if (value2 === this) {
return `_duplicate_${JSON.stringify(keys)}`;
}
if (value2 instanceof Error && options2.allowError) {
return {
__isConvertedError__: true,
errorProperties: {
...value2.cause ? { cause: value2.cause } : {},
...value2,
name: value2.name,
message: value2.message,
stack: value2.stack,
"_constructor-name_": value2.constructor.name
}
};
}
if (value2.constructor && value2.constructor.name && value2.constructor.name !== "Object" && !Array.isArray(value2) && !options2.allowClass) {
return void 0;
}
const found = objects.get(value2);
if (!found) {
const converted = Array.isArray(value2) ? value2 : convertUnconventionalData(value2);
if (value2.constructor && value2.constructor.name && value2.constructor.name !== "Object" && !Array.isArray(value2) && options2.allowClass) {
try {
Object.assign(converted, { "_constructor-name_": value2.constructor.name });
} catch (e) {
}
}
keys.push(key2);
stack.unshift(converted);
objects.set(value2, JSON.stringify(keys));
if (value2 !== converted) {
map.set(value2, converted);
}
return converted;
}
return `_duplicate_${found}`;
} catch (e) {
return void 0;
}
};
};
var reviver2 = function reviver(options) {
const refs = [];
let root;
return function revive(key, value) {
if (key === "") {
root = value;
refs.forEach(({ target, container, replacement }) => {
const replacementArr = isJSON(replacement) ? JSON.parse(replacement) : replacement.split(".");
if (replacementArr.length === 0) {
container[target] = root;
} else {
container[target] = get_default(root, replacementArr);
}
});
}
if (key === "_constructor-name_") {
return value;
}
if (isObject3(value) && value.__isConvertedError__) {
const { message, ...properties } = value.errorProperties;
const error = new Error(message);
Object.assign(error, properties);
return error;
}
if (isObject3(value) && value["_constructor-name_"] && options.allowFunction) {
const name2 = value["_constructor-name_"];
if (name2 !== "Object") {
const Fn = new Function(`return function ${name2.replace(/[^a-zA-Z0-9$_]+/g, "")}(){}`)();
Object.setPrototypeOf(value, new Fn());
}
delete value["_constructor-name_"];
return value;
}
if (typeof value === "string" && value.startsWith("_function_") && options.allowFunction) {
const [, name, source] = value.match(/_function_([^|]*)\|(.*)/) || [];
const sourceSanitized = source.replace(/[(\(\))|\\| |\]|`]*$/, "");
if (!options.lazyEval) {
return eval(`(${sourceSanitized})`);
}
const result = (...args) => {
const f = eval(`(${sourceSanitized})`);
return f(...args);
};
Object.defineProperty(result, "toString", {
value: () => sourceSanitized
});
Object.defineProperty(result, "name", {
value: name
});
return result;
}
if (typeof value === "string" && value.startsWith("_regexp_") && options.allowRegExp) {
const [, flags, source2] = value.match(/_regexp_([^|]*)\|(.*)/) || [];
return new RegExp(source2, flags);
}
if (typeof value === "string" && value.startsWith("_date_") && options.allowDate) {
return new Date(value.replace("_date_", ""));
}
if (typeof value === "string" && value.startsWith("_duplicate_")) {
refs.push({ target: key, container: this, replacement: value.replace(/^_duplicate_/, "") });
return null;
}
if (typeof value === "string" && value.startsWith("_symbol_") && options.allowSymbol) {
return Symbol(value.replace("_symbol_", ""));
}
if (typeof value === "string" && value.startsWith("_gsymbol_") && options.allowSymbol) {
return Symbol.for(value.replace("_gsymbol_", ""));
}
if (typeof value === "string" && value === "_-Infinity_") {
return -Infinity;
}
if (typeof value === "string" && value === "_Infinity_") {
return Infinity;
}
if (typeof value === "string" && value === "_NaN_") {
return NaN;
}
if (typeof value === "string" && value.startsWith("_bigint_") && typeof BigInt === "function") {
return BigInt(value.replace("_bigint_", ""));
}
return value;
};
};
var defaultOptions = {
maxDepth: 10,
space: void 0,
allowFunction: true,
allowRegExp: true,
allowDate: true,
allowClass: true,
allowError: true,
allowUndefined: true,
allowSymbol: true,
lazyEval: true
};
var stringify = (data, options2 = {}) => {
const mergedOptions = { ...defaultOptions, ...options2 };
return JSON.stringify(convertUnconventionalData(data), replacer(mergedOptions), options2.space);
};
var mutator = () => {
const mutated = /* @__PURE__ */ new Map();
return function mutateUndefined(value2) {
if (isObject3(value2)) {
Object.entries(value2).forEach(([k, v]) => {
if (v === "_undefined_") {
value2[k] = void 0;
} else if (!mutated.get(v)) {
mutated.set(v, true);
mutateUndefined(v);
}
});
}
if (Array.isArray(value2)) {
value2.forEach((v, index) => {
if (v === "_undefined_") {
mutated.set(v, true);
value2[index] = void 0;
} else if (!mutated.get(v)) {
mutated.set(v, true);
mutateUndefined(v);
}
});
}
};
};
var parse = (data, options2 = {}) => {
const mergedOptions = { ...defaultOptions, ...options2 };
const result2 = JSON.parse(data, reviver2(mergedOptions));
mutator()(result2);
return result2;
};
/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/***/ }),
/***/ "../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/build-html.js":
/***/ ((module) => {
/* eslint no-var: off */
/**
* This file is responsible for building the DOM and updating DOM state.
*
* @author Tim Scanlin
*/
module.exports = function (options) {
var forEach = [].forEach
var some = [].some
var body = document.body
var tocElement
var currentlyHighlighting = true
var SPACE_CHAR = ' '
/**
* Create link and list elements.
* @param {Object} d
* @param {HTMLElement} container
* @return {HTMLElement}
*/
function createEl (d, container) {
var link = container.appendChild(createLink(d))
if (d.children.length) {
var list = createList(d.isCollapsed)
d.children.forEach(function (child) {
createEl(child, list)
})
link.appendChild(list)
}
}
/**
* Render nested heading array data into a given element.
* @param {HTMLElement} parent Optional. If provided updates the {@see tocElement} to match.
* @param {Array} data
* @return {HTMLElement}
*/
function render (parent, data) {
var collapsed = false
var container = createList(collapsed)
data.forEach(function (d) {
createEl(d, container)
})
// Return if no TOC element is provided or known.
tocElement = parent || tocElement
if (tocElement === null) {
return
}
// Remove existing child if it exists.
if (tocElement.firstChild) {
tocElement.removeChild(tocElement.firstChild)
}
// Just return the parent and don't append the list if no links are found.
if (data.length === 0) {
return tocElement
}
// Append the Elements that have been created
return tocElement.appendChild(container)
}
/**
* Create link element.
* @param {Object} data
* @return {HTMLElement}
*/
function createLink (data) {
var item = document.createElement('li')
var a = document.createElement('a')
if (options.listItemClass) {
item.setAttribute('class', options.listItemClass)
}
if (options.onClick) {
a.onclick = options.onClick
}
if (options.includeTitleTags) {
a.setAttribute('title', data.textContent)
}
if (options.includeHtml && data.childNodes.length) {
forEach.call(data.childNodes, function (node) {
a.appendChild(node.cloneNode(true))
})
} else {
// Default behavior. Set to textContent to keep tests happy.
a.textContent = data.textContent
}
a.setAttribute('href', options.basePath + '#' + data.id)
a.setAttribute('class', options.linkClass +
SPACE_CHAR + 'node-name--' + data.nodeName +
SPACE_CHAR + options.extraLinkClasses)
item.appendChild(a)
return item
}
/**
* Create list element.
* @param {Boolean} isCollapsed
* @return {HTMLElement}
*/
function createList (isCollapsed) {
var listElement = (options.orderedList) ? 'ol' : 'ul'
var list = document.createElement(listElement)
var classes = options.listClass + SPACE_CHAR + options.extraListClasses
if (isCollapsed) {
// No plus/equals here fixes compilcation issue.
classes = classes + SPACE_CHAR + options.collapsibleClass
classes = classes + SPACE_CHAR + options.isCollapsedClass
}
list.setAttribute('class', classes)
return list
}
/**
* Update fixed sidebar class.
* @return {HTMLElement}
*/
function updateFixedSidebarClass () {
if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
var top
top = document.querySelector(options.scrollContainer).scrollTop
} else {
top = document.documentElement.scrollTop || body.scrollTop
}
var posFixedEl = document.querySelector(options.positionFixedSelector)
if (options.fixedSidebarOffset === 'auto') {
options.fixedSidebarOffset = tocElement.offsetTop
}
if (top > options.fixedSidebarOffset) {
if (posFixedEl.className.indexOf(options.positionFixedClass) === -1) {
posFixedEl.className += SPACE_CHAR + options.positionFixedClass
}
} else {
posFixedEl.className = posFixedEl.className.replace(SPACE_CHAR + options.positionFixedClass, '')
}
}
/**
* Get top position of heading
* @param {HTMLElement} obj
* @return {int} position
*/
function getHeadingTopPos (obj) {
var position = 0
if (obj !== null) {
position = obj.offsetTop
if (options.hasInnerContainers) { position += getHeadingTopPos(obj.offsetParent) }
}
return position
}
/**
* Update className only when changed.
* @param {HTMLElement} obj
* @param {string} className
* @return {HTMLElement} obj
*/
function updateClassname (obj, className) {
if (obj && obj.className !== className) {
obj.className = className
}
return obj
}
/**
* Update TOC highlighting and collapsed groupings.
*/
function updateToc (headingsArray) {
// If a fixed content container was set
if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
var top
top = document.querySelector(options.scrollContainer).scrollTop
} else {
top = document.documentElement.scrollTop || body.scrollTop
}
// Add fixed class at offset
if (options.positionFixedSelector) {
updateFixedSidebarClass()
}
// Get the top most heading currently visible on the page so we know what to highlight.
var headings = headingsArray
var topHeader
// Using some instead of each so that we can escape early.
if (currentlyHighlighting &&
tocElement !== null &&
headings.length > 0) {
some.call(headings, function (heading, i) {
if (getHeadingTopPos(heading) > top + options.headingsOffset + 10) {
// Don't allow negative index value.
var index = (i === 0) ? i : i - 1
topHeader = headings[index]
return true
} else if (i === headings.length - 1) {
// This allows scrolling for the last heading on the page.
topHeader = headings[headings.length - 1]
return true
}
})
var oldActiveTocLink = tocElement.querySelector('.' + options.activeLinkClass)
var activeTocLink = tocElement
.querySelector('.' + options.linkClass +
'.node-name--' + topHeader.nodeName +
'[href="' + options.basePath + '#' + topHeader.id.replace(/([ #;&,.+*~':"!^$[\]()=>|/\\@])/g, '\\$1') + '"]')
// Performance improvement to only change the classes
// for the toc if a new link should be highlighted.
if (oldActiveTocLink === activeTocLink) {
return
}
// Remove the active class from the other tocLinks.
var tocLinks = tocElement
.querySelectorAll('.' + options.linkClass)
forEach.call(tocLinks, function (tocLink) {
updateClassname(tocLink, tocLink.className.replace(SPACE_CHAR + options.activeLinkClass, ''))
})
var tocLis = tocElement
.querySelectorAll('.' + options.listItemClass)
forEach.call(tocLis, function (tocLi) {
updateClassname(tocLi, tocLi.className.replace(SPACE_CHAR + options.activeListItemClass, ''))
})
// Add the active class to the active tocLink.
if (activeTocLink && activeTocLink.className.indexOf(options.activeLinkClass) === -1) {
activeTocLink.className += SPACE_CHAR + options.activeLinkClass
}
var li = activeTocLink && activeTocLink.parentNode
if (li && li.className.indexOf(options.activeListItemClass) === -1) {
li.className += SPACE_CHAR + options.activeListItemClass
}
var tocLists = tocElement
.querySelectorAll('.' + options.listClass + '.' + options.collapsibleClass)
// Collapse the other collapsible lists.
forEach.call(tocLists, function (list) {
if (list.className.indexOf(options.isCollapsedClass) === -1) {
list.className += SPACE_CHAR + options.isCollapsedClass
}
})
// Expand the active link's collapsible list and its sibling if applicable.
if (activeTocLink && activeTocLink.nextSibling && activeTocLink.nextSibling.className.indexOf(options.isCollapsedClass) !== -1) {
updateClassname(activeTocLink.nextSibling, activeTocLink.nextSibling.className.replace(SPACE_CHAR + options.isCollapsedClass, ''))
}
removeCollapsedFromParents(activeTocLink && activeTocLink.parentNode.parentNode)
}
}
/**
* Remove collapsed class from parent elements.
* @param {HTMLElement} element
* @return {HTMLElement}
*/
function removeCollapsedFromParents (element) {
if (element && element.className.indexOf(options.collapsibleClass) !== -1 && element.className.indexOf(options.isCollapsedClass) !== -1) {
updateClassname(element, element.className.replace(SPACE_CHAR + options.isCollapsedClass, ''))
return removeCollapsedFromParents(element.parentNode.parentNode)
}
return element
}
/**
* Disable TOC Animation when a link is clicked.
* @param {Event} event
*/
function disableTocAnimation (event) {
var target = event.target || event.srcElement
if (typeof target.className !== 'string' || target.className.indexOf(options.linkClass) === -1) {
return
}
// Bind to tocLink clicks to temporarily disable highlighting
// while smoothScroll is animating.
currentlyHighlighting = false
}
/**
* Enable TOC Animation.
*/
function enableTocAnimation () {
currentlyHighlighting = true
}
return {
enableTocAnimation,
disableTocAnimation,
render,
updateToc
}
}
/***/ }),
/***/ "../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/default-options.js":
/***/ ((module) => {
module.exports = {
// Where to render the table of contents.
tocSelector: '.js-toc',
// Where to grab the headings to build the table of contents.
contentSelector: '.js-toc-content',
// Which headings to grab inside of the contentSelector element.
headingSelector: 'h1, h2, h3',
// Headings that match the ignoreSelector will be skipped.
ignoreSelector: '.js-toc-ignore',
// For headings inside relative or absolute positioned containers within content
hasInnerContainers: false,
// Main class to add to links.
linkClass: 'toc-link',
// Extra classes to add to links.
extraLinkClasses: '',
// Class to add to active links,
// the link corresponding to the top most heading on the page.
activeLinkClass: 'is-active-link',
// Main class to add to lists.
listClass: 'toc-list',
// Extra classes to add to lists.
extraListClasses: '',
// Class that gets added when a list should be collapsed.
isCollapsedClass: 'is-collapsed',
// Class that gets added when a list should be able
// to be collapsed but isn't necessarily collapsed.
collapsibleClass: 'is-collapsible',
// Class to add to list items.
listItemClass: 'toc-list-item',
// Class to add to active list items.
activeListItemClass: 'is-active-li',
// How many heading levels should not be collapsed.
// For example, number 6 will show everything since
// there are only 6 heading levels and number 0 will collapse them all.
// The sections that are hidden will open
// and close as you scroll to headings within them.
collapseDepth: 0,
// Smooth scrolling enabled.
scrollSmooth: true,
// Smooth scroll duration.
scrollSmoothDuration: 420,
// Smooth scroll offset.
scrollSmoothOffset: 0,
// Callback for scroll end.
scrollEndCallback: function (e) {},
// Headings offset between the headings and the top of the document (this is meant for minor adjustments).
headingsOffset: 1,
// Timeout between events firing to make sure it's
// not too rapid (for performance reasons).
throttleTimeout: 50,
// Element to add the positionFixedClass to.
positionFixedSelector: null,
// Fixed position class to add to make sidebar fixed after scrolling
// down past the fixedSidebarOffset.
positionFixedClass: 'is-position-fixed',
// fixedSidebarOffset can be any number but by default is set
// to auto which sets the fixedSidebarOffset to the sidebar
// element's offsetTop from the top of the document on init.
fixedSidebarOffset: 'auto',
// includeHtml can be set to true to include the HTML markup from the
// heading node instead of just including the innerText.
includeHtml: false,
// includeTitleTags automatically sets the html title tag of the link
// to match the title. This can be useful for SEO purposes or
// when truncating titles.
includeTitleTags: false,
// onclick function to apply to all links in toc. will be called with
// the event as the first parameter, and this can be used to stop,
// propagation, prevent default or perform action
onClick: function (e) {},
// orderedList can be set to false to generate unordered lists (ul)
// instead of ordered lists (ol)
orderedList: true,
// If there is a fixed article scroll container, set to calculate titles' offset
scrollContainer: null,
// prevent ToC DOM rendering if it's already rendered by an external system
skipRendering: false,
// Optional callback to change heading labels.
// For example it can be used to cut down and put ellipses on multiline headings you deem too long.
// Called each time a heading is parsed. Expects a string and returns the modified label to display.
// Additionally, the attribute `data-heading-label` may be used on a heading to specify
// a shorter string to be used in the TOC.
// function (string) => string
headingLabelCallback: false,
// ignore headings that are hidden in DOM
ignoreHiddenElements: false,
// Optional callback to modify properties of parsed headings.
// The heading element is passed in node parameter and information parsed by default parser is provided in obj parameter.
// Function has to return the same or modified obj.
// The heading will be excluded from TOC if nothing is returned.
// function (object, HTMLElement) => object | void
headingObjectCallback: null,
// Set the base path, useful if you use a `base` tag in `head`.
basePath: '',
// Only takes affect when `tocSelector` is scrolling,
// keep the toc scroll position in sync with the content.
disableTocScrollSync: false,
// Offset for the toc scroll (top) position when scrolling the page.
// Only effective if `disableTocScrollSync` is false.
tocScrollOffset: 0
}
/***/ }),
/***/ "../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/index.js":
/***/ ((module, exports, __webpack_require__) => {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint no-var: off */
/**
* Tocbot
* Tocbot creates a table of contents based on HTML headings on a page,
* this allows users to easily jump to different sections of the document.
* Tocbot was inspired by tocify (http://gregfranko.com/jquery.tocify.js/).
* The main differences are that it works natively without any need for jquery or jquery UI).
*
* @author Tim Scanlin
*/
/* globals define */
(function (root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory(root)),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
} else {}
})(typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : window || __webpack_require__.g, function (root) {
'use strict'
// Default options.
var defaultOptions = __webpack_require__("../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/default-options.js")
// Object to store current options.
var options = {}
// Object for public APIs.
var tocbot = {}
var BuildHtml = __webpack_require__("../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/build-html.js")
var ParseContent = __webpack_require__("../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/parse-content.js")
var updateTocScroll = __webpack_require__("../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/update-toc-scroll.js")
// Keep these variables at top scope once options are passed in.
var buildHtml
var parseContent
// Just return if its not a browser.
var supports = !!root && !!root.document && !!root.document.querySelector && !!root.addEventListener // Feature test
if (typeof window === 'undefined' && !supports) {
return
}
var headingsArray
// From: https://github.com/Raynos/xtend
var hasOwnProperty = Object.prototype.hasOwnProperty
function extend () {
var target = {}
for (var i = 0; i < arguments.length; i++) {
var source = arguments[i]
for (var key in source) {
if (hasOwnProperty.call(source, key)) {
target[key] = source[key]
}
}
}
return target
}
// From: https://remysharp.com/2010/07/21/throttling-function-calls
function throttle (fn, threshold, scope) {
threshold || (threshold = 250)
var last
var deferTimer
return function () {
var context = scope || this
var now = +new Date()
var args = arguments
if (last && now < last + threshold) {
// hold on to it
clearTimeout(deferTimer)
deferTimer = setTimeout(function () {
last = now
fn.apply(context, args)
}, threshold)
} else {
last = now
fn.apply(context, args)
}
}
}
function getContentElement (options) {
try {
return options.contentElement || document.querySelector(options.contentSelector)
} catch (e) {
console.warn('Contents element not found: ' + options.contentSelector) // eslint-disable-line
return null
}
}
function getTocElement (options) {
try {
return options.tocElement || document.querySelector(options.tocSelector)
} catch (e) {
console.warn('TOC element not found: ' + options.tocSelector) // eslint-disable-line
return null
}
}
/**
* Destroy tocbot.
*/
tocbot.destroy = function () {
var tocElement = getTocElement(options)
if (tocElement === null) {
return
}
if (!options.skipRendering) {
// Clear HTML.
if (tocElement) {
tocElement.innerHTML = ''
}
}
// Remove event listeners.
if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
document.querySelector(options.scrollContainer).removeEventListener('scroll', this._scrollListener, false)
document.querySelector(options.scrollContainer).removeEventListener('resize', this._scrollListener, false)
if (buildHtml) {
document.querySelector(options.scrollContainer).removeEventListener('click', this._clickListener, false)
}
} else {
document.removeEventListener('scroll', this._scrollListener, false)
document.removeEventListener('resize', this._scrollListener, false)
if (buildHtml) {
document.removeEventListener('click', this._clickListener, false)
}
}
}
/**
* Initialize tocbot.
* @param {object} customOptions
*/
tocbot.init = function (customOptions) {
// feature test
if (!supports) {
return
}
// Merge defaults with user options.
// Set to options variable at the top.
options = extend(defaultOptions, customOptions || {})
this.options = options
this.state = {}
// Init smooth scroll if enabled (default).
if (options.scrollSmooth) {
options.duration = options.scrollSmoothDuration
options.offset = options.scrollSmoothOffset
tocbot.scrollSmooth = (__webpack_require__("../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/scroll-smooth/index.js").initSmoothScrolling)(options)
}
// Pass options to these modules.
buildHtml = BuildHtml(options)
parseContent = ParseContent(options)
// For testing purposes.
this._buildHtml = buildHtml
this._parseContent = parseContent
this._headingsArray = headingsArray
// Destroy it if it exists first.
tocbot.destroy()
var contentElement = getContentElement(options)
if (contentElement === null) {
return
}
var tocElement = getTocElement(options)
if (tocElement === null) {
return
}
// Get headings array.
headingsArray = parseContent.selectHeadings(contentElement, options.headingSelector)
// Return if no headings are found.
if (headingsArray === null) {
return
}
// Build nested headings array.
var nestedHeadingsObj = parseContent.nestHeadingsArray(headingsArray)
var nestedHeadings = nestedHeadingsObj.nest
// Render.
if (!options.skipRendering) {
buildHtml.render(tocElement, nestedHeadings)
} else {
// No need to attach listeners if skipRendering is true, this was causing errors.
return this
}
// Update Sidebar and bind listeners.
this._scrollListener = throttle(function (e) {
buildHtml.updateToc(headingsArray)
!options.disableTocScrollSync && updateTocScroll(options)
var isTop = e && e.target && e.target.scrollingElement && e.target.scrollingElement.scrollTop === 0
if ((e && (e.eventPhase === 0 || e.currentTarget === null)) || isTop) {
buildHtml.updateToc(headingsArray)
if (options.scrollEndCallback) {
options.scrollEndCallback(e)
}
}
}, options.throttleTimeout)
this._scrollListener()
if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
document.querySelector(options.scrollContainer).addEventListener('scroll', this._scrollListener, false)
document.querySelector(options.scrollContainer).addEventListener('resize', this._scrollListener, false)
} else {
document.addEventListener('scroll', this._scrollListener, false)
document.addEventListener('resize', this._scrollListener, false)
}
// Bind click listeners to disable animation.
var timeout = null
this._clickListener = throttle(function (event) {
if (options.scrollSmooth) {
buildHtml.disableTocAnimation(event)
}
buildHtml.updateToc(headingsArray)
// Timeout to re-enable the animation.
timeout && clearTimeout(timeout)
timeout = setTimeout(function () {
buildHtml.enableTocAnimation()
}, options.scrollSmoothDuration)
}, options.throttleTimeout)
if (options.scrollContainer && document.querySelector(options.scrollContainer)) {
document.querySelector(options.scrollContainer).addEventListener('click', this._clickListener, false)
} else {
document.addEventListener('click', this._clickListener, false)
}
return this
}
/**
* Refresh tocbot.
*/
tocbot.refresh = function (customOptions) {
tocbot.destroy()
tocbot.init(customOptions || this.options)
}
// Make tocbot available globally.
root.tocbot = tocbot
return tocbot
})
/***/ }),
/***/ "../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/parse-content.js":
/***/ ((module) => {
/* eslint no-var: off */
/**
* This file is responsible for parsing the content from the DOM and making
* sure data is nested properly.
*
* @author Tim Scanlin
*/
module.exports = function parseContent (options) {
var reduce = [].reduce
/**
* Get the last item in an array and return a reference to it.
* @param {Array} array
* @return {Object}
*/
function getLastItem (array) {
return array[array.length - 1]
}
/**
* Get heading level for a heading dom node.
* @param {HTMLElement} heading
* @return {Number}
*/
function getHeadingLevel (heading) {
return +heading.nodeName.toUpperCase().replace('H', '')
}
/**
* Determine whether the object is an HTML Element.
* Also works inside iframes. HTML Elements might be created by the parent document.
* @param {Object} maybeElement
* @return {Number}
*/
function isHTMLElement (maybeElement) {
try {
return (
maybeElement instanceof window.HTMLElement ||
maybeElement instanceof window.parent.HTMLElement
)
} catch (e) {
return maybeElement instanceof window.HTMLElement
}
}
/**
* Get important properties from a heading element and store in a plain object.
* @param {HTMLElement} heading
* @return {Object}
*/
function getHeadingObject (heading) {
// each node is processed twice by this method because nestHeadingsArray() and addNode() calls it
// first time heading is real DOM node element, second time it is obj
// that is causing problem so I am processing only original DOM node
if (!isHTMLElement(heading)) return heading
if (options.ignoreHiddenElements && (!heading.offsetHeight || !heading.offsetParent)) {
return null
}
const headingLabel = heading.getAttribute('data-heading-label') ||
(options.headingLabelCallback ? String(options.headingLabelCallback(heading.innerText)) : (heading.innerText || heading.textContent).trim())
var obj = {
id: heading.id,
children: [],
nodeName: heading.nodeName,
headingLevel: getHeadingLevel(heading),
textContent: headingLabel
}
if (options.includeHtml) {
obj.childNodes = heading.childNodes
}
if (options.headingObjectCallback) {
return options.headingObjectCallback(obj, heading)
}
return obj
}
/**
* Add a node to the nested array.
* @param {Object} node
* @param {Array} nest
* @return {Array}
*/
function addNode (node, nest) {
var obj = getHeadingObject(node)
var level = obj.headingLevel
var array = nest
var lastItem = getLastItem(array)
var lastItemLevel = lastItem
? lastItem.headingLevel
: 0
var counter = level - lastItemLevel
while (counter > 0) {
lastItem = getLastItem(array)
// Handle case where there are multiple h5+ in a row.
if (lastItem && level === lastItem.headingLevel) {
break
} else if (lastItem && lastItem.children !== undefined) {
array = lastItem.children
}
counter--
}
if (level >= options.collapseDepth) {
obj.isCollapsed = true
}
array.push(obj)
return array
}
/**
* Select headings in content area, exclude any selector in options.ignoreSelector
* @param {HTMLElement} contentElement
* @param {Array} headingSelector
* @return {Array}
*/
function selectHeadings (contentElement, headingSelector) {
var selectors = headingSelector
if (options.ignoreSelector) {
selectors = headingSelector.split(',')
.map(function mapSelectors (selector) {
return selector.trim() + ':not(' + options.ignoreSelector + ')'
})
}
try {
return contentElement.querySelectorAll(selectors)
} catch (e) {
console.warn('Headers not found with selector: ' + selectors); // eslint-disable-line
return null
}
}
/**
* Nest headings array into nested arrays with 'children' property.
* @param {Array} headingsArray
* @return {Object}
*/
function nestHeadingsArray (headingsArray) {
return reduce.call(headingsArray, function reducer (prev, curr) {
var currentHeading = getHeadingObject(curr)
if (currentHeading) {
addNode(currentHeading, prev.nest)
}
return prev
}, {
nest: []
})
}
return {
nestHeadingsArray,
selectHeadings
}
}
/***/ }),
/***/ "../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/scroll-smooth/index.js":
/***/ ((__unused_webpack_module, exports) => {
/* eslint no-var: off */
/* globals location, requestAnimationFrame */
exports.initSmoothScrolling = initSmoothScrolling
function initSmoothScrolling (options) {
// if (isCssSmoothSCrollSupported()) { return }
var duration = options.duration
var offset = options.offset
var pageUrl = location.hash
? stripHash(location.href)
: location.href
delegatedLinkHijacking()
function delegatedLinkHijacking () {
document.body.addEventListener('click', onClick, false)
function onClick (e) {
if (
!isInPageLink(e.target) ||
e.target.className.indexOf('no-smooth-scroll') > -1 ||
(e.target.href.charAt(e.target.href.length - 2) === '#' &&
e.target.href.charAt(e.target.href.length - 1) === '!') ||
e.target.className.indexOf(options.linkClass) === -1) {
return
}
// Don't prevent default or hash doesn't change.
// e.preventDefault()
jump(e.target.hash, {
duration,
offset,
callback: function () {
setFocus(e.target.hash)
}
})
}
}
function isInPageLink (n) {
return n.tagName.toLowerCase() === 'a' &&
(n.hash.length > 0 || n.href.charAt(n.href.length - 1) === '#') &&
(stripHash(n.href) === pageUrl || stripHash(n.href) + '#' === pageUrl)
}
function stripHash (url) {
return url.slice(0, url.lastIndexOf('#'))
}
// function isCssSmoothSCrollSupported () {
// return 'scrollBehavior' in document.documentElement.style
// }
// Adapted from:
// https://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
function setFocus (hash) {
var element = document.getElementById(hash.substring(1))
if (element) {
if (!/^(?:a|select|input|button|textarea)$/i.test(element.tagName)) {
element.tabIndex = -1
}
element.focus()
}
}
}
function jump (target, options) {
var start = window.pageYOffset
var opt = {
duration: options.duration,
offset: options.offset || 0,
callback: options.callback,
easing: options.easing || easeInOutQuad
}
// This makes ids that start with a number work: ('[id="' + decodeURI(target).split('#').join('') + '"]')
// DecodeURI for nonASCII hashes, they was encoded, but id was not encoded, it lead to not finding the tgt element by id.
// And this is for IE: document.body.scrollTop
// Handle decoded and non-decoded URIs since sometimes URLs automatically transform them (support for internation chars).
var tgt = document.querySelector('[id="' + decodeURI(target).split('#').join('') + '"]') ||
document.querySelector('[id="' + (target).split('#').join('') + '"]')
var distance = typeof target === 'string'
? opt.offset + (
target
? (tgt && tgt.getBoundingClientRect().top) || 0 // handle non-existent links better.
: -(document.documentElement.scrollTop || document.body.scrollTop))
: target
var duration = typeof opt.duration === 'function'
? opt.duration(distance)
: opt.duration
var timeStart
var timeElapsed
requestAnimationFrame(function (time) { timeStart = time; loop(time) })
function loop (time) {
timeElapsed = time - timeStart
window.scrollTo(0, opt.easing(timeElapsed, start, distance, duration))
if (timeElapsed < duration) { requestAnimationFrame(loop) } else { end() }
}
function end () {
window.scrollTo(0, start + distance)
if (typeof opt.callback === 'function') { opt.callback() }
}
// Robert Penner's easeInOutQuad - http://robertpenner.com/easing/
function easeInOutQuad (t, b, c, d) {
t /= d / 2
if (t < 1) return c / 2 * t * t + b
t--
return -c / 2 * (t * (t - 2) - 1) + b
}
}
/***/ }),
/***/ "../../node_modules/.pnpm/tocbot@4.23.0/node_modules/tocbot/src/js/update-toc-scroll.js":
/***/ ((module) => {
/* eslint no-var: off */
module.exports = function updateTocScroll (options) {
var toc = options.tocElement || document.querySelector(options.tocSelector)
if (toc && toc.scrollHeight > toc.clientHeight) {
var activeItem = toc.querySelector('.' + options.activeListItemClass)
if (activeItem) {
toc.scrollTop = activeItem.offsetTop - options.tocScrollOffset
}
}
}
/***/ })
}]);