UNPKG

@vue-js-cron/prime

Version:
1 lines 158 kB
{"version":3,"file":"prime.umd.cjs","sources":["../../node_modules/@primeuix/utils/object/index.mjs","../../node_modules/@primeuix/utils/eventbus/index.mjs","../../node_modules/@primeuix/styled/index.mjs","../../node_modules/@primeuix/utils/dom/index.mjs","../../node_modules/@primeuix/utils/zindex/index.mjs","../../node_modules/primevue/ripple/index.mjs","../../node_modules/primevue/popover/index.mjs","../src/components/select.vue","../src/components/cron-prime.vue","../src/index.ts"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\n\n// src/object/methods/isEmpty.ts\nfunction isEmpty(value) {\n return value === null || value === void 0 || value === \"\" || Array.isArray(value) && value.length === 0 || !(value instanceof Date) && typeof value === \"object\" && Object.keys(value).length === 0;\n}\n\n// src/object/methods/compare.ts\nfunction compare(value1, value2, comparator, order = 1) {\n let result = -1;\n const emptyValue1 = isEmpty(value1);\n const emptyValue2 = isEmpty(value2);\n if (emptyValue1 && emptyValue2) result = 0;\n else if (emptyValue1) result = order;\n else if (emptyValue2) result = -order;\n else if (typeof value1 === \"string\" && typeof value2 === \"string\") result = comparator(value1, value2);\n else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;\n return result;\n}\n\n// src/object/methods/deepEquals.ts\nfunction _deepEquals(obj1, obj2, visited = /* @__PURE__ */ new WeakSet()) {\n if (obj1 === obj2) return true;\n if (!obj1 || !obj2 || typeof obj1 !== \"object\" || typeof obj2 !== \"object\") return false;\n if (visited.has(obj1) || visited.has(obj2)) return false;\n visited.add(obj1).add(obj2);\n let arrObj1 = Array.isArray(obj1), arrObj2 = Array.isArray(obj2), i, length, key;\n if (arrObj1 && arrObj2) {\n length = obj1.length;\n if (length != obj2.length) return false;\n for (i = length; i-- !== 0; ) if (!_deepEquals(obj1[i], obj2[i], visited)) return false;\n return true;\n }\n if (arrObj1 != arrObj2) return false;\n let dateObj1 = obj1 instanceof Date, dateObj2 = obj2 instanceof Date;\n if (dateObj1 != dateObj2) return false;\n if (dateObj1 && dateObj2) return obj1.getTime() == obj2.getTime();\n let regexpObj1 = obj1 instanceof RegExp, regexpObj2 = obj2 instanceof RegExp;\n if (regexpObj1 != regexpObj2) return false;\n if (regexpObj1 && regexpObj2) return obj1.toString() == obj2.toString();\n let keys = Object.keys(obj1);\n length = keys.length;\n if (length !== Object.keys(obj2).length) return false;\n for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(obj2, keys[i])) return false;\n for (i = length; i-- !== 0; ) {\n key = keys[i];\n if (!_deepEquals(obj1[key], obj2[key], visited)) return false;\n }\n return true;\n}\nfunction deepEquals(obj1, obj2) {\n return _deepEquals(obj1, obj2);\n}\n\n// src/object/methods/isFunction.ts\nfunction isFunction(value) {\n return !!(value && value.constructor && value.call && value.apply);\n}\n\n// src/object/methods/isNotEmpty.ts\nfunction isNotEmpty(value) {\n return !isEmpty(value);\n}\n\n// src/object/methods/resolveFieldData.ts\nfunction resolveFieldData(data, field) {\n if (!data || !field) {\n return null;\n }\n try {\n const value = data[field];\n if (isNotEmpty(value)) return value;\n } catch (e) {\n }\n if (Object.keys(data).length) {\n if (isFunction(field)) {\n return field(data);\n } else if (field.indexOf(\".\") === -1) {\n return data[field];\n } else {\n let fields = field.split(\".\");\n let value = data;\n for (let i = 0, len = fields.length; i < len; ++i) {\n if (value == null) {\n return null;\n }\n value = value[fields[i]];\n }\n return value;\n }\n }\n return null;\n}\n\n// src/object/methods/equals.ts\nfunction equals(obj1, obj2, field) {\n if (field) return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);\n else return deepEquals(obj1, obj2);\n}\n\n// src/object/methods/contains.ts\nfunction contains(value, list) {\n if (value != null && list && list.length) {\n for (let val of list) {\n if (equals(value, val)) return true;\n }\n }\n return false;\n}\n\n// src/object/methods/filter.ts\nfunction filter(value, fields, filterValue) {\n let filteredItems = [];\n if (value) {\n for (let item of value) {\n for (let field of fields) {\n if (String(resolveFieldData(item, field)).toLowerCase().indexOf(filterValue.toLowerCase()) > -1) {\n filteredItems.push(item);\n break;\n }\n }\n }\n }\n return filteredItems;\n}\n\n// src/object/methods/findIndexInList.ts\nfunction findIndexInList(value, list) {\n let index = -1;\n if (list) {\n for (let i = 0; i < list.length; i++) {\n if (list[i] === value) {\n index = i;\n break;\n }\n }\n }\n return index;\n}\n\n// src/object/methods/findLast.ts\nfunction findLast(arr, callback) {\n let item;\n if (isNotEmpty(arr)) {\n try {\n item = arr.findLast(callback);\n } catch (e) {\n item = [...arr].reverse().find(callback);\n }\n }\n return item;\n}\n\n// src/object/methods/findLastIndex.ts\nfunction findLastIndex(arr, callback) {\n let index = -1;\n if (isNotEmpty(arr)) {\n try {\n index = arr.findLastIndex(callback);\n } catch (e) {\n index = arr.lastIndexOf([...arr].reverse().find(callback));\n }\n }\n return index;\n}\n\n// src/object/methods/isObject.ts\nfunction isObject(value, empty = true) {\n return value instanceof Object && value.constructor === Object && (empty || Object.keys(value).length !== 0);\n}\n\n// src/object/methods/resolve.ts\nfunction resolve(obj, ...params) {\n return isFunction(obj) ? obj(...params) : obj;\n}\n\n// src/object/methods/isString.ts\nfunction isString(value, empty = true) {\n return typeof value === \"string\" && (empty || value !== \"\");\n}\n\n// src/object/methods/toFlatCase.ts\nfunction toFlatCase(str) {\n return isString(str) ? str.replace(/(-|_)/g, \"\").toLowerCase() : str;\n}\n\n// src/object/methods/getKeyValue.ts\nfunction getKeyValue(obj, key = \"\", params = {}) {\n const fKeys = toFlatCase(key).split(\".\");\n const fKey = fKeys.shift();\n return fKey ? isObject(obj) ? getKeyValue(resolve(obj[Object.keys(obj).find((k) => toFlatCase(k) === fKey) || \"\"], params), fKeys.join(\".\"), params) : void 0 : resolve(obj, params);\n}\n\n// src/object/methods/insertIntoOrderedArray.ts\nfunction insertIntoOrderedArray(item, index, arr, sourceArr) {\n if (arr.length > 0) {\n let injected = false;\n for (let i = 0; i < arr.length; i++) {\n let currentItemIndex = findIndexInList(arr[i], sourceArr);\n if (currentItemIndex > index) {\n arr.splice(i, 0, item);\n injected = true;\n break;\n }\n }\n if (!injected) {\n arr.push(item);\n }\n } else {\n arr.push(item);\n }\n}\n\n// src/object/methods/isArray.ts\nfunction isArray(value, empty = true) {\n return Array.isArray(value) && (empty || value.length !== 0);\n}\n\n// src/object/methods/isDate.ts\nfunction isDate(value) {\n return value instanceof Date && value.constructor === Date;\n}\n\n// src/object/methods/isLetter.ts\nfunction isLetter(char) {\n return /^[a-zA-Z\\u00C0-\\u017F]$/.test(char);\n}\n\n// src/object/methods/isNumber.ts\nfunction isNumber(value) {\n return isNotEmpty(value) && !isNaN(value);\n}\n\n// src/object/methods/isPrintableCharacter.ts\nfunction isPrintableCharacter(char = \"\") {\n return isNotEmpty(char) && char.length === 1 && !!char.match(/\\S| /);\n}\n\n// src/object/methods/isScalar.ts\nfunction isScalar(value) {\n return value != null && (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"bigint\" || typeof value === \"boolean\");\n}\n\n// src/object/methods/localeComparator.ts\nfunction localeComparator() {\n return new Intl.Collator(void 0, { numeric: true }).compare;\n}\n\n// src/object/methods/matchRegex.ts\nfunction matchRegex(str, regex) {\n if (regex) {\n const match = regex.test(str);\n regex.lastIndex = 0;\n return match;\n }\n return false;\n}\n\n// src/object/methods/mergeKeys.ts\nfunction mergeKeys(...args) {\n const _mergeKeys = (target = {}, source = {}) => {\n const mergedObj = __spreadValues({}, target);\n Object.keys(source).forEach((key) => {\n if (isObject(source[key]) && key in target && isObject(target[key])) {\n mergedObj[key] = _mergeKeys(target[key], source[key]);\n } else {\n mergedObj[key] = source[key];\n }\n });\n return mergedObj;\n };\n return args.reduce((acc, obj, i) => i === 0 ? obj : _mergeKeys(acc, obj), {});\n}\n\n// src/object/methods/minifyCSS.ts\nfunction minifyCSS(css) {\n return css ? css.replace(/\\/\\*(?:(?!\\*\\/)[\\s\\S])*\\*\\/|[\\r\\n\\t]+/g, \"\").replace(/ {2,}/g, \" \").replace(/ ([{:}]) /g, \"$1\").replace(/([;,]) /g, \"$1\").replace(/ !/g, \"!\").replace(/: /g, \":\") : css;\n}\n\n// src/object/methods/nestedKeys.ts\nfunction nestedKeys(obj = {}, parentKey = \"\") {\n return Object.entries(obj).reduce((o, [key, value]) => {\n const currentKey = parentKey ? `${parentKey}.${key}` : key;\n isObject(value) ? o = o.concat(nestedKeys(value, currentKey)) : o.push(currentKey);\n return o;\n }, []);\n}\n\n// src/object/methods/omit.ts\nfunction omit(obj, ...keys) {\n if (!isObject(obj)) return obj;\n const copy = __spreadValues({}, obj);\n keys == null ? void 0 : keys.flat().forEach((key) => delete copy[key]);\n return copy;\n}\n\n// src/object/methods/removeAccents.ts\nfunction removeAccents(str) {\n const accentCheckRegex = /[\\xC0-\\xFF\\u0100-\\u017E]/;\n if (str && accentCheckRegex.test(str)) {\n const accentsMap = {\n A: /[\\xC0-\\xC5\\u0100\\u0102\\u0104]/g,\n AE: /[\\xC6]/g,\n C: /[\\xC7\\u0106\\u0108\\u010A\\u010C]/g,\n D: /[\\xD0\\u010E\\u0110]/g,\n E: /[\\xC8-\\xCB\\u0112\\u0114\\u0116\\u0118\\u011A]/g,\n G: /[\\u011C\\u011E\\u0120\\u0122]/g,\n H: /[\\u0124\\u0126]/g,\n I: /[\\xCC-\\xCF\\u0128\\u012A\\u012C\\u012E\\u0130]/g,\n IJ: /[\\u0132]/g,\n J: /[\\u0134]/g,\n K: /[\\u0136]/g,\n L: /[\\u0139\\u013B\\u013D\\u013F\\u0141]/g,\n N: /[\\xD1\\u0143\\u0145\\u0147\\u014A]/g,\n O: /[\\xD2-\\xD6\\xD8\\u014C\\u014E\\u0150]/g,\n OE: /[\\u0152]/g,\n R: /[\\u0154\\u0156\\u0158]/g,\n S: /[\\u015A\\u015C\\u015E\\u0160]/g,\n T: /[\\u0162\\u0164\\u0166]/g,\n U: /[\\xD9-\\xDC\\u0168\\u016A\\u016C\\u016E\\u0170\\u0172]/g,\n W: /[\\u0174]/g,\n Y: /[\\xDD\\u0176\\u0178]/g,\n Z: /[\\u0179\\u017B\\u017D]/g,\n a: /[\\xE0-\\xE5\\u0101\\u0103\\u0105]/g,\n ae: /[\\xE6]/g,\n c: /[\\xE7\\u0107\\u0109\\u010B\\u010D]/g,\n d: /[\\u010F\\u0111]/g,\n e: /[\\xE8-\\xEB\\u0113\\u0115\\u0117\\u0119\\u011B]/g,\n g: /[\\u011D\\u011F\\u0121\\u0123]/g,\n i: /[\\xEC-\\xEF\\u0129\\u012B\\u012D\\u012F\\u0131]/g,\n ij: /[\\u0133]/g,\n j: /[\\u0135]/g,\n k: /[\\u0137,\\u0138]/g,\n l: /[\\u013A\\u013C\\u013E\\u0140\\u0142]/g,\n n: /[\\xF1\\u0144\\u0146\\u0148\\u014B]/g,\n p: /[\\xFE]/g,\n o: /[\\xF2-\\xF6\\xF8\\u014D\\u014F\\u0151]/g,\n oe: /[\\u0153]/g,\n r: /[\\u0155\\u0157\\u0159]/g,\n s: /[\\u015B\\u015D\\u015F\\u0161]/g,\n t: /[\\u0163\\u0165\\u0167]/g,\n u: /[\\xF9-\\xFC\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173]/g,\n w: /[\\u0175]/g,\n y: /[\\xFD\\xFF\\u0177]/g,\n z: /[\\u017A\\u017C\\u017E]/g\n };\n for (let key in accentsMap) {\n str = str.replace(accentsMap[key], key);\n }\n }\n return str;\n}\n\n// src/object/methods/reorderArray.ts\nfunction reorderArray(value, from, to) {\n if (value && from !== to) {\n if (to >= value.length) {\n to %= value.length;\n from %= value.length;\n }\n value.splice(to, 0, value.splice(from, 1)[0]);\n }\n}\n\n// src/object/methods/sort.ts\nfunction sort(value1, value2, order = 1, comparator, nullSortOrder = 1) {\n const result = compare(value1, value2, comparator, order);\n let finalSortOrder = order;\n if (isEmpty(value1) || isEmpty(value2)) {\n finalSortOrder = nullSortOrder === 1 ? order : nullSortOrder;\n }\n return finalSortOrder * result;\n}\n\n// src/object/methods/stringify.ts\nfunction stringify(value, indent = 2, currentIndent = 0) {\n const currentIndentStr = \" \".repeat(currentIndent);\n const nextIndentStr = \" \".repeat(currentIndent + indent);\n if (isArray(value)) {\n return \"[\" + value.map((v) => stringify(v, indent, currentIndent + indent)).join(\", \") + \"]\";\n } else if (isDate(value)) {\n return value.toISOString();\n } else if (isFunction(value)) {\n return value.toString();\n } else if (isObject(value)) {\n return \"{\\n\" + Object.entries(value).map(([k, v]) => `${nextIndentStr}${k}: ${stringify(v, indent, currentIndent + indent)}`).join(\",\\n\") + `\n${currentIndentStr}}`;\n } else {\n return JSON.stringify(value);\n }\n}\n\n// src/object/methods/toCapitalCase.ts\nfunction toCapitalCase(str) {\n return isString(str, false) ? str[0].toUpperCase() + str.slice(1) : str;\n}\n\n// src/object/methods/toKebabCase.ts\nfunction toKebabCase(str) {\n return isString(str) ? str.replace(/(_)/g, \"-\").replace(/[A-Z]/g, (c, i) => i === 0 ? c : \"-\" + c.toLowerCase()).toLowerCase() : str;\n}\n\n// src/object/methods/toTokenKey.ts\nfunction toTokenKey(str) {\n return isString(str) ? str.replace(/[A-Z]/g, (c, i) => i === 0 ? c : \".\" + c.toLowerCase()).toLowerCase() : str;\n}\n\n// src/object/methods/toValue.ts\nfunction toValue(value) {\n if (value && typeof value === \"object\") {\n if (value.hasOwnProperty(\"current\")) {\n return value.current;\n } else if (value.hasOwnProperty(\"value\")) {\n return value.value;\n }\n }\n return resolve(value);\n}\nexport {\n compare,\n contains,\n deepEquals,\n equals,\n filter,\n findIndexInList,\n findLast,\n findLastIndex,\n getKeyValue,\n insertIntoOrderedArray,\n isArray,\n isDate,\n isEmpty,\n isFunction,\n isLetter,\n isNotEmpty,\n isNumber,\n isObject,\n isPrintableCharacter,\n isScalar,\n isString,\n localeComparator,\n matchRegex,\n mergeKeys,\n minifyCSS,\n nestedKeys,\n omit,\n removeAccents,\n reorderArray,\n resolve,\n resolveFieldData,\n sort,\n stringify,\n toCapitalCase,\n toFlatCase,\n toKebabCase,\n toTokenKey,\n toValue\n};\n//# sourceMappingURL=index.mjs.map","// src/eventbus/index.ts\nfunction EventBus() {\n const allHandlers = /* @__PURE__ */ new Map();\n return {\n on(type, handler) {\n let handlers = allHandlers.get(type);\n if (!handlers) handlers = [handler];\n else handlers.push(handler);\n allHandlers.set(type, handlers);\n return this;\n },\n off(type, handler) {\n let handlers = allHandlers.get(type);\n if (handlers) {\n handlers.splice(handlers.indexOf(handler) >>> 0, 1);\n }\n return this;\n },\n emit(type, evt) {\n let handlers = allHandlers.get(type);\n if (handlers) {\n handlers.slice().map((handler) => {\n handler(evt);\n });\n }\n },\n clear() {\n allHandlers.clear();\n }\n };\n}\nexport {\n EventBus\n};\n//# sourceMappingURL=index.mjs.map","var __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nvar __objRest = (source, exclude) => {\n var target = {};\n for (var prop in source)\n if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)\n target[prop] = source[prop];\n if (source != null && __getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(source)) {\n if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))\n target[prop] = source[prop];\n }\n return target;\n};\n\n// src/actions/definePreset.ts\nimport { mergeKeys } from \"@primeuix/utils/object\";\nfunction definePreset(...presets) {\n return mergeKeys(...presets);\n}\n\n// src/actions/updatePreset.ts\nimport { mergeKeys as mergeKeys3 } from \"@primeuix/utils/object\";\n\n// src/service/index.ts\nimport { EventBus } from \"@primeuix/utils/eventbus\";\nvar ThemeService = EventBus();\nvar service_default = ThemeService;\n\n// src/utils/sharedUtils.ts\nimport { getKeyValue, isArray, isNotEmpty, isNumber, isObject, isString, matchRegex, toKebabCase } from \"@primeuix/utils/object\";\nfunction toTokenKey(str) {\n return isString(str) ? str.replace(/[A-Z]/g, (c, i) => i === 0 ? c : \".\" + c.toLowerCase()).toLowerCase() : str;\n}\nfunction merge(value1, value2) {\n if (isArray(value1)) {\n value1.push(...value2 || []);\n } else if (isObject(value1)) {\n Object.assign(value1, value2);\n }\n}\nfunction toValue(value) {\n return isObject(value) && value.hasOwnProperty(\"value\") && value.hasOwnProperty(\"type\") ? value.value : value;\n}\nfunction toUnit(value, variable = \"\") {\n const excludedProperties = [\"opacity\", \"z-index\", \"line-height\", \"font-weight\", \"flex\", \"flex-grow\", \"flex-shrink\", \"order\"];\n if (!excludedProperties.some((property) => variable.endsWith(property))) {\n const val = `${value}`.trim();\n const valArr = val.split(\" \");\n return valArr.map((v) => isNumber(v) ? `${v}px` : v).join(\" \");\n }\n return value;\n}\nfunction toNormalizePrefix(prefix) {\n return prefix.replaceAll(/ /g, \"\").replace(/[^\\w]/g, \"-\");\n}\nfunction toNormalizeVariable(prefix = \"\", variable = \"\") {\n return toNormalizePrefix(`${isString(prefix, false) && isString(variable, false) ? `${prefix}-` : prefix}${variable}`);\n}\nfunction getVariableName(prefix = \"\", variable = \"\") {\n return `--${toNormalizeVariable(prefix, variable)}`;\n}\nfunction getVariableValue(value, variable = \"\", prefix = \"\", excludedKeyRegexes = [], fallback) {\n if (isString(value)) {\n const regex = /{([^}]*)}/g;\n const val = value.trim();\n if (matchRegex(val, regex)) {\n const _val = val.replaceAll(regex, (v) => {\n const path = v.replace(/{|}/g, \"\");\n const keys = path.split(\".\").filter((_v) => !excludedKeyRegexes.some((_r) => matchRegex(_v, _r)));\n return `var(${getVariableName(prefix, toKebabCase(keys.join(\"-\")))}${isNotEmpty(fallback) ? `, ${fallback}` : \"\"})`;\n });\n const calculationRegex = /(\\d+\\s+[\\+\\-\\*\\/]\\s+\\d+)/g;\n const cleanedVarRegex = /var\\([^)]+\\)/g;\n return matchRegex(_val.replace(cleanedVarRegex, \"0\"), calculationRegex) ? `calc(${_val})` : _val;\n }\n return val;\n } else if (isNumber(value)) {\n return value;\n }\n return void 0;\n}\nfunction getComputedValue(obj = {}, value) {\n if (isString(value)) {\n const regex = /{([^}]*)}/g;\n const val = value.trim();\n return matchRegex(val, regex) ? val.replaceAll(regex, (v) => getKeyValue(obj, v.replace(/{|}/g, \"\"))) : val;\n } else if (isNumber(value)) {\n return value;\n }\n return void 0;\n}\nfunction setProperty(properties, key, value) {\n if (isString(key, false)) {\n properties.push(`${key}:${value};`);\n }\n}\nfunction getRule(selector, properties) {\n if (selector) {\n return `${selector}{${properties}}`;\n }\n return \"\";\n}\n\n// src/utils/themeUtils.ts\nimport { isArray as isArray2, isEmpty as isEmpty2, isNotEmpty as isNotEmpty2, isObject as isObject3, matchRegex as matchRegex4, minifyCSS, resolve as resolve2, toTokenKey as toTokenKey2 } from \"@primeuix/utils/object\";\n\n// src/helpers/color/mix.ts\nfunction normalizeColor(color) {\n if (color.length === 4) {\n return `#${color[1]}${color[1]}${color[2]}${color[2]}${color[3]}${color[3]}`;\n }\n return color;\n}\nfunction hexToRgb(hex) {\n var bigint = parseInt(hex.substring(1), 16);\n var r = bigint >> 16 & 255;\n var g = bigint >> 8 & 255;\n var b = bigint & 255;\n return { r, g, b };\n}\nfunction rgbToHex(r, g, b) {\n return `#${r.toString(16).padStart(2, \"0\")}${g.toString(16).padStart(2, \"0\")}${b.toString(16).padStart(2, \"0\")}`;\n}\nvar mix_default = (color1, color2, weight) => {\n color1 = normalizeColor(color1);\n color2 = normalizeColor(color2);\n var p = weight / 100;\n var w = p * 2 - 1;\n var w1 = (w + 1) / 2;\n var w2 = 1 - w1;\n var rgb1 = hexToRgb(color1);\n var rgb2 = hexToRgb(color2);\n var r = Math.round(rgb1.r * w1 + rgb2.r * w2);\n var g = Math.round(rgb1.g * w1 + rgb2.g * w2);\n var b = Math.round(rgb1.b * w1 + rgb2.b * w2);\n return rgbToHex(r, g, b);\n};\n\n// src/helpers/color/shade.ts\nvar shade_default = (color, percent) => mix_default(\"#000000\", color, percent);\n\n// src/helpers/color/tint.ts\nvar tint_default = (color, percent) => mix_default(\"#ffffff\", color, percent);\n\n// src/helpers/color/palette.ts\nvar scales = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];\nvar palette_default = (color) => {\n if (/{([^}]*)}/g.test(color)) {\n const token = color.replace(/{|}/g, \"\");\n return scales.reduce((acc, scale) => (acc[scale] = `{${token}.${scale}}`, acc), {});\n }\n return typeof color === \"string\" ? scales.reduce((acc, scale, i) => (acc[scale] = i <= 5 ? tint_default(color, (5 - i) * 19) : shade_default(color, (i - 5) * 15), acc), {}) : color;\n};\n\n// src/helpers/css.ts\nimport { resolve } from \"@primeuix/utils/object\";\n\n// src/helpers/dt.ts\nimport { isEmpty, matchRegex as matchRegex2 } from \"@primeuix/utils/object\";\nvar $dt = (tokenPath) => {\n var _a;\n const theme = config_default.getTheme();\n const variable = dtwt(theme, tokenPath, void 0, \"variable\");\n const name = (_a = variable == null ? void 0 : variable.match(/--[\\w-]+/g)) == null ? void 0 : _a[0];\n const value = dtwt(theme, tokenPath, void 0, \"value\");\n return {\n name,\n variable,\n value\n };\n};\nvar dt = (...args) => {\n return dtwt(config_default.getTheme(), ...args);\n};\nvar dtwt = (theme = {}, tokenPath, fallback, type) => {\n if (tokenPath) {\n const { variable: VARIABLE, options: OPTIONS } = config_default.defaults || {};\n const { prefix, transform } = (theme == null ? void 0 : theme.options) || OPTIONS || {};\n const regex = /{([^}]*)}/g;\n const token = matchRegex2(tokenPath, regex) ? tokenPath : `{${tokenPath}}`;\n const isStrictTransform = type === \"value\" || isEmpty(type) && transform === \"strict\";\n return isStrictTransform ? config_default.getTokenValue(tokenPath) : getVariableValue(token, void 0, prefix, [VARIABLE.excludedKeyRegex], fallback);\n }\n return \"\";\n};\n\n// src/helpers/css.ts\nfunction css(style) {\n return resolve(style, { dt });\n}\n\n// src/helpers/t.ts\nimport { mergeKeys as mergeKeys2 } from \"@primeuix/utils/object\";\nvar $t = (theme = {}) => {\n let { preset: _preset, options: _options } = theme;\n return {\n preset(value) {\n _preset = _preset ? mergeKeys2(_preset, value) : value;\n return this;\n },\n options(value) {\n _options = _options ? __spreadValues(__spreadValues({}, _options), value) : value;\n return this;\n },\n // features\n primaryPalette(primary) {\n const { semantic } = _preset || {};\n _preset = __spreadProps(__spreadValues({}, _preset), { semantic: __spreadProps(__spreadValues({}, semantic), { primary }) });\n return this;\n },\n surfacePalette(surface) {\n var _a, _b;\n const { semantic } = _preset || {};\n const lightSurface = (surface == null ? void 0 : surface.hasOwnProperty(\"light\")) ? surface == null ? void 0 : surface.light : surface;\n const darkSurface = (surface == null ? void 0 : surface.hasOwnProperty(\"dark\")) ? surface == null ? void 0 : surface.dark : surface;\n const newColorScheme = {\n colorScheme: {\n light: __spreadValues(__spreadValues({}, (_a = semantic == null ? void 0 : semantic.colorScheme) == null ? void 0 : _a.light), !!lightSurface && { surface: lightSurface }),\n dark: __spreadValues(__spreadValues({}, (_b = semantic == null ? void 0 : semantic.colorScheme) == null ? void 0 : _b.dark), !!darkSurface && { surface: darkSurface })\n }\n };\n _preset = __spreadProps(__spreadValues({}, _preset), { semantic: __spreadValues(__spreadValues({}, semantic), newColorScheme) });\n return this;\n },\n // actions\n define({ useDefaultPreset = false, useDefaultOptions = false } = {}) {\n return {\n preset: useDefaultPreset ? config_default.getPreset() : _preset,\n options: useDefaultOptions ? config_default.getOptions() : _options\n };\n },\n update({ mergePresets = true, mergeOptions = true } = {}) {\n const newTheme = {\n preset: mergePresets ? mergeKeys2(config_default.getPreset(), _preset) : _preset,\n options: mergeOptions ? __spreadValues(__spreadValues({}, config_default.getOptions()), _options) : _options\n };\n config_default.setTheme(newTheme);\n return newTheme;\n },\n use(options) {\n const newTheme = this.define(options);\n config_default.setTheme(newTheme);\n return newTheme;\n }\n };\n};\n\n// src/helpers/toVariables.ts\nimport { isObject as isObject2, matchRegex as matchRegex3, toKebabCase as toKebabCase2 } from \"@primeuix/utils/object\";\nfunction toVariables_default(theme, options = {}) {\n const VARIABLE = config_default.defaults.variable;\n const { prefix = VARIABLE.prefix, selector = VARIABLE.selector, excludedKeyRegex = VARIABLE.excludedKeyRegex } = options;\n const _toVariables = (_theme, _prefix = \"\") => {\n return Object.entries(_theme).reduce(\n (acc, [key, value]) => {\n const px = matchRegex3(key, excludedKeyRegex) ? toNormalizeVariable(_prefix) : toNormalizeVariable(_prefix, toKebabCase2(key));\n const v = toValue(value);\n if (isObject2(v)) {\n const { variables: variables2, tokens: tokens2 } = _toVariables(v, px);\n merge(acc[\"tokens\"], tokens2);\n merge(acc[\"variables\"], variables2);\n } else {\n acc[\"tokens\"].push((prefix ? px.replace(`${prefix}-`, \"\") : px).replaceAll(\"-\", \".\"));\n setProperty(acc[\"variables\"], getVariableName(px), getVariableValue(v, px, prefix, [excludedKeyRegex]));\n }\n return acc;\n },\n { variables: [], tokens: [] }\n );\n };\n const { variables, tokens } = _toVariables(theme, prefix);\n return {\n value: variables,\n tokens,\n declarations: variables.join(\"\"),\n css: getRule(selector, variables.join(\"\"))\n };\n}\n\n// src/utils/themeUtils.ts\nvar themeUtils_default = {\n regex: {\n rules: {\n class: {\n pattern: /^\\.([a-zA-Z][\\w-]*)$/,\n resolve(value) {\n return { type: \"class\", selector: value, matched: this.pattern.test(value.trim()) };\n }\n },\n attr: {\n pattern: /^\\[(.*)\\]$/,\n resolve(value) {\n return { type: \"attr\", selector: `:root${value}`, matched: this.pattern.test(value.trim()) };\n }\n },\n media: {\n pattern: /^@media (.*)$/,\n resolve(value) {\n return { type: \"media\", selector: `${value}{:root{[CSS]}}`, matched: this.pattern.test(value.trim()) };\n }\n },\n system: {\n pattern: /^system$/,\n resolve(value) {\n return { type: \"system\", selector: \"@media (prefers-color-scheme: dark){:root{[CSS]}}\", matched: this.pattern.test(value.trim()) };\n }\n },\n custom: {\n resolve(value) {\n return { type: \"custom\", selector: value, matched: true };\n }\n }\n },\n resolve(value) {\n const rules = Object.keys(this.rules).filter((k) => k !== \"custom\").map((r) => this.rules[r]);\n return [value].flat().map((v) => {\n var _a;\n return (_a = rules.map((r) => r.resolve(v)).find((rr) => rr.matched)) != null ? _a : this.rules.custom.resolve(v);\n });\n }\n },\n _toVariables(theme, options) {\n return toVariables_default(theme, { prefix: options == null ? void 0 : options.prefix });\n },\n getCommon({ name = \"\", theme = {}, params, set, defaults }) {\n var _e, _f, _g, _h, _i, _j, _k;\n const { preset, options } = theme;\n let primitive_css, primitive_tokens, semantic_css, semantic_tokens, global_css, global_tokens, style;\n if (isNotEmpty2(preset) && options.transform !== \"strict\") {\n const { primitive, semantic, extend } = preset;\n const _a = semantic || {}, { colorScheme } = _a, sRest = __objRest(_a, [\"colorScheme\"]);\n const _b = extend || {}, { colorScheme: eColorScheme } = _b, eRest = __objRest(_b, [\"colorScheme\"]);\n const _c = colorScheme || {}, { dark } = _c, csRest = __objRest(_c, [\"dark\"]);\n const _d = eColorScheme || {}, { dark: eDark } = _d, ecsRest = __objRest(_d, [\"dark\"]);\n const prim_var = isNotEmpty2(primitive) ? this._toVariables({ primitive }, options) : {};\n const sRest_var = isNotEmpty2(sRest) ? this._toVariables({ semantic: sRest }, options) : {};\n const csRest_var = isNotEmpty2(csRest) ? this._toVariables({ light: csRest }, options) : {};\n const csDark_var = isNotEmpty2(dark) ? this._toVariables({ dark }, options) : {};\n const eRest_var = isNotEmpty2(eRest) ? this._toVariables({ semantic: eRest }, options) : {};\n const ecsRest_var = isNotEmpty2(ecsRest) ? this._toVariables({ light: ecsRest }, options) : {};\n const ecsDark_var = isNotEmpty2(eDark) ? this._toVariables({ dark: eDark }, options) : {};\n const [prim_css, prim_tokens] = [(_e = prim_var.declarations) != null ? _e : \"\", prim_var.tokens];\n const [sRest_css, sRest_tokens] = [(_f = sRest_var.declarations) != null ? _f : \"\", sRest_var.tokens || []];\n const [csRest_css, csRest_tokens] = [(_g = csRest_var.declarations) != null ? _g : \"\", csRest_var.tokens || []];\n const [csDark_css, csDark_tokens] = [(_h = csDark_var.declarations) != null ? _h : \"\", csDark_var.tokens || []];\n const [eRest_css, eRest_tokens] = [(_i = eRest_var.declarations) != null ? _i : \"\", eRest_var.tokens || []];\n const [ecsRest_css, ecsRest_tokens] = [(_j = ecsRest_var.declarations) != null ? _j : \"\", ecsRest_var.tokens || []];\n const [ecsDark_css, ecsDark_tokens] = [(_k = ecsDark_var.declarations) != null ? _k : \"\", ecsDark_var.tokens || []];\n primitive_css = this.transformCSS(name, prim_css, \"light\", \"variable\", options, set, defaults);\n primitive_tokens = prim_tokens;\n const semantic_light_css = this.transformCSS(name, `${sRest_css}${csRest_css}`, \"light\", \"variable\", options, set, defaults);\n const semantic_dark_css = this.transformCSS(name, `${csDark_css}`, \"dark\", \"variable\", options, set, defaults);\n semantic_css = `${semantic_light_css}${semantic_dark_css}`;\n semantic_tokens = [.../* @__PURE__ */ new Set([...sRest_tokens, ...csRest_tokens, ...csDark_tokens])];\n const global_light_css = this.transformCSS(name, `${eRest_css}${ecsRest_css}color-scheme:light`, \"light\", \"variable\", options, set, defaults);\n const global_dark_css = this.transformCSS(name, `${ecsDark_css}color-scheme:dark`, \"dark\", \"variable\", options, set, defaults);\n global_css = `${global_light_css}${global_dark_css}`;\n global_tokens = [.../* @__PURE__ */ new Set([...eRest_tokens, ...ecsRest_tokens, ...ecsDark_tokens])];\n style = resolve2(preset.css, { dt });\n }\n return {\n primitive: {\n css: primitive_css,\n tokens: primitive_tokens\n },\n semantic: {\n css: semantic_css,\n tokens: semantic_tokens\n },\n global: {\n css: global_css,\n tokens: global_tokens\n },\n style\n };\n },\n getPreset({ name = \"\", preset = {}, options, params, set, defaults, selector }) {\n var _e, _f, _g;\n let p_css, p_tokens, p_style;\n if (isNotEmpty2(preset) && options.transform !== \"strict\") {\n const _name = name.replace(\"-directive\", \"\");\n const _a = preset, { colorScheme, extend, css: css2 } = _a, vRest = __objRest(_a, [\"colorScheme\", \"extend\", \"css\"]);\n const _b = extend || {}, { colorScheme: eColorScheme } = _b, evRest = __objRest(_b, [\"colorScheme\"]);\n const _c = colorScheme || {}, { dark } = _c, csRest = __objRest(_c, [\"dark\"]);\n const _d = eColorScheme || {}, { dark: ecsDark } = _d, ecsRest = __objRest(_d, [\"dark\"]);\n const vRest_var = isNotEmpty2(vRest) ? this._toVariables({ [_name]: __spreadValues(__spreadValues({}, vRest), evRest) }, options) : {};\n const csRest_var = isNotEmpty2(csRest) ? this._toVariables({ [_name]: __spreadValues(__spreadValues({}, csRest), ecsRest) }, options) : {};\n const csDark_var = isNotEmpty2(dark) ? this._toVariables({ [_name]: __spreadValues(__spreadValues({}, dark), ecsDark) }, options) : {};\n const [vRest_css, vRest_tokens] = [(_e = vRest_var.declarations) != null ? _e : \"\", vRest_var.tokens || []];\n const [csRest_css, csRest_tokens] = [(_f = csRest_var.declarations) != null ? _f : \"\", csRest_var.tokens || []];\n const [csDark_css, csDark_tokens] = [(_g = csDark_var.declarations) != null ? _g : \"\", csDark_var.tokens || []];\n const light_variable_css = this.transformCSS(_name, `${vRest_css}${csRest_css}`, \"light\", \"variable\", options, set, defaults, selector);\n const dark_variable_css = this.transformCSS(_name, csDark_css, \"dark\", \"variable\", options, set, defaults, selector);\n p_css = `${light_variable_css}${dark_variable_css}`;\n p_tokens = [.../* @__PURE__ */ new Set([...vRest_tokens, ...csRest_tokens, ...csDark_tokens])];\n p_style = resolve2(css2, { dt });\n }\n return {\n css: p_css,\n tokens: p_tokens,\n style: p_style\n };\n },\n getPresetC({ name = \"\", theme = {}, params, set, defaults }) {\n var _a;\n const { preset, options } = theme;\n const cPreset = (_a = preset == null ? void 0 : preset.components) == null ? void 0 : _a[name];\n return this.getPreset({ name, preset: cPreset, options, params, set, defaults });\n },\n getPresetD({ name = \"\", theme = {}, params, set, defaults }) {\n var _a;\n const dName = name.replace(\"-directive\", \"\");\n const { preset, options } = theme;\n const dPreset = (_a = preset == null ? void 0 : preset.directives) == null ? void 0 : _a[dName];\n return this.getPreset({ name: dName, preset: dPreset, options, params, set, defaults });\n },\n applyDarkColorScheme(options) {\n return !(options.darkModeSelector === \"none\" || options.darkModeSelector === false);\n },\n getColorSchemeOption(options, defaults) {\n var _a;\n return this.applyDarkColorScheme(options) ? this.regex.resolve(options.darkModeSelector === true ? defaults.options.darkModeSelector : (_a = options.darkModeSelector) != null ? _a : defaults.options.darkModeSelector) : [];\n },\n getLayerOrder(name, options = {}, params, defaults) {\n const { cssLayer } = options;\n if (cssLayer) {\n const order = resolve2(cssLayer.order || \"primeui\", params);\n return `@layer ${order}`;\n }\n return \"\";\n },\n getCommonStyleSheet({ name = \"\", theme = {}, params, props = {}, set, defaults }) {\n const common = this.getCommon({ name, theme, params, set, defaults });\n const _props = Object.entries(props).reduce((acc, [k, v]) => acc.push(`${k}=\"${v}\"`) && acc, []).join(\" \");\n return Object.entries(common || {}).reduce((acc, [key, value]) => {\n if (value == null ? void 0 : value.css) {\n const _css = minifyCSS(value == null ? void 0 : value.css);\n const id = `${key}-variables`;\n acc.push(`<style type=\"text/css\" data-primevue-style-id=\"${id}\" ${_props}>${_css}</style>`);\n }\n return acc;\n }, []).join(\"\");\n },\n getStyleSheet({ name = \"\", theme = {}, params, props = {}, set, defaults }) {\n var _a;\n const options = { name, theme, params, set, defaults };\n const preset_css = (_a = name.includes(\"-directive\") ? this.getPresetD(options) : this.getPresetC(options)) == null ? void 0 : _a.css;\n const _props = Object.entries(props).reduce((acc, [k, v]) => acc.push(`${k}=\"${v}\"`) && acc, []).join(\" \");\n return preset_css ? `<style type=\"text/css\" data-primevue-style-id=\"${name}-variables\" ${_props}>${minifyCSS(preset_css)}</style>` : \"\";\n },\n createTokens(obj = {}, defaults, parentKey = \"\", parentPath = \"\", tokens = {}) {\n Object.entries(obj).forEach(([key, value]) => {\n const currentKey = matchRegex4(key, defaults.variable.excludedKeyRegex) ? parentKey : parentKey ? `${parentKey}.${toTokenKey2(key)}` : toTokenKey2(key);\n const currentPath = parentPath ? `${parentPath}.${key}` : key;\n if (isObject3(value)) {\n this.createTokens(value, defaults, currentKey, currentPath, tokens);\n } else {\n tokens[currentKey] || (tokens[currentKey] = {\n paths: [],\n computed(colorScheme, tokenPathMap = {}) {\n var _a, _b;\n if (this.paths.length === 1) {\n return (_a = this.paths[0]) == null ? void 0 : _a.computed(this.paths[0].scheme, tokenPathMap[\"binding\"]);\n } else if (colorScheme && colorScheme !== \"none\") {\n return (_b = this.paths.find((p) => p.scheme === colorScheme)) == null ? void 0 : _b.computed(colorScheme, tokenPathMap[\"binding\"]);\n }\n return this.paths.map((p) => p.computed(p.scheme, tokenPathMap[p.scheme]));\n }\n });\n tokens[currentKey].paths.push({\n path: currentPath,\n value,\n scheme: currentPath.includes(\"colorScheme.light\") ? \"light\" : currentPath.includes(\"colorScheme.dark\") ? \"dark\" : \"none\",\n computed(colorScheme, tokenPathMap = {}) {\n const regex = /{([^}]*)}/g;\n let computedValue = value;\n tokenPathMap[\"name\"] = this.path;\n tokenPathMap[\"binding\"] || (tokenPathMap[\"binding\"] = {});\n if (matchRegex4(value, regex)) {\n const val = value.trim();\n const _val = val.replaceAll(regex, (v) => {\n var _a;\n const path = v.replace(/{|}/g, \"\");\n const computed = (_a = tokens[path]) == null ? void 0 : _a.computed(colorScheme, tokenPathMap);\n return isArray2(computed) && computed.length === 2 ? `light-dark(${computed[0].value},${computed[1].value})` : computed == null ? void 0 : computed.value;\n });\n const calculationRegex = /(\\d+\\w*\\s+[\\+\\-\\*\\/]\\s+\\d+\\w*)/g;\n const cleanedVarRegex = /var\\([^)]+\\)/g;\n computedValue = matchRegex4(_val.replace(cleanedVarRegex, \"0\"), calculationRegex) ? `calc(${_val})` : _val;\n }\n isEmpty2(tokenPathMap[\"binding\"]) && delete tokenPathMap[\"binding\"];\n return {\n colorScheme,\n path: this.path,\n paths: tokenPathMap,\n value: computedValue.includes(\"undefined\") ? void 0 : computedValue\n };\n }\n });\n }\n });\n return tokens;\n },\n getTokenValue(tokens, path, defaults) {\n var _a;\n const normalizePath = (str) => {\n const strArr = str.split(\".\");\n return strArr.filter((s) => !matchRegex4(s.toLowerCase(), defaults.variable.excludedKeyRegex)).join(\".\");\n };\n const token = normalizePath(path);\n const colorScheme = path.includes(\"colorScheme.light\") ? \"light\" : path.includes(\"colorScheme.dark\") ? \"dark\" : void 0;\n const computedValues = [(_a = tokens[token]) == null ? void 0 : _a.computed(colorScheme)].flat().filter((computed) => computed);\n return computedValues.length === 1 ? computedValues[0].value : computedValues.reduce((acc = {}, computed) => {\n const _a2 = computed, { colorScheme: cs } = _a2, rest = __objRest(_a2, [\"colorScheme\"]);\n acc[cs] = rest;\n return acc;\n }, void 0);\n },\n getSelectorRule(selector1, selector2, type, css2) {\n return type === \"class\" || type === \"attr\" ? getRule(isNotEmpty2(selector2) ? `${selector1}${selector2},${selector1} ${selector2}` : selector1, css2) : getRule(selector1, isNotEmpty2(selector2) ? getRule(selector2, css2) : css2);\n },\n transformCSS(name, css2, mode, type, options = {}, set, defaults, selector) {\n if (isNotEmpty2(css2)) {\n const { cssLayer } = options;\n if (type !== \"style\") {\n const colorSchemeOption = this.getColorSchemeOption(options, defaults);\n css2 = mode === \"dark\" ? colorSchemeOption.reduce((acc, { type: type2, selector: _selector }) => {\n if (isNotEmpty2(_selector)) {\n acc += _selector.includes(\"[CSS]\") ? _selector.replace(\"[CSS]\", css2) : this.getSelectorRule(_selector, selector, type2, css2);\n }\n return acc;\n }, \"\") : getRule(selector != null ? selector : \":root\", css2);\n }\n if (cssLayer) {\n const layerOptions = {\n name: \"primeui\",\n order: \"primeui\"\n };\n isObject3(cssLayer) && (layerOptions.name = resolve2(cssLayer.name, { name, type }));\n if (isNotEmpty2(layerOptions.name)) {\n css2 = getRule(`@layer ${layerOptions.name}`, css2);\n set == null ? void 0 : set.layerNames(layerOptions.name);\n }\n }\n return css2;\n }\n return \"\";\n }\n};\n\n// src/config/index.ts\nvar config_default = {\n defaults: {\n variable: {\n prefix: \"p\",\n selector: \":root\",\n excludedKeyRegex: /^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states|extend|css)$/gi\n },\n options: {\n prefix: \"p\",\n darkModeSelector: \"system\",\n cssLayer: false\n }\n },\n _theme: void 0,\n _layerNames: /* @__PURE__ */ new Set(),\n _loadedStyleNames: /* @__PURE__ */ new Set(),\n _loadingStyles: /* @__PURE__ */ new Set(),\n _tokens: {},\n update(newValues = {}) {\n const { theme } = newValues;\n if (theme) {\n this._theme = __spreadProps(__spreadValues({}, theme), {\n options: __spreadValues(__spreadValues({}, this.defaults.options), theme.options)\n });\n this._tokens = themeUtils_default.createTokens(this.preset, this.defaults);\n this.clearLoadedStyleNames();\n }\n },\n get theme() {\n return this._theme;\n },\n get preset() {\n var _a;\n return ((_a = this.theme) == null ? void 0 : _a.preset) || {};\n },\n get options() {\n var _a;\n return ((_a = this.theme) == null ? void 0 : _a.options) || {};\n },\n get tokens() {\n return this._tokens;\n },\n getTheme() {\n return this.theme;\n },\n setTheme(newValue) {\n this.update({ theme: newValue });\n service_default.emit(\"theme:change\", newValue);\n },\n getPreset() {\n return this.preset;\n },\n setPreset(newValue) {\n this._theme = __spreadProps(__spreadValues({}, this.theme), { preset: newValue });\n this._tokens = themeUtils_default.createTokens(newValue, this.defaults);\n this.clearLoadedStyleNames();\n service_default.emit(\"preset:change\", newValue);\n service_default.emit(\"theme:change\", this.theme);\n },\n getOptions() {\n return this.options;\n },\n setOptions(newValue) {\n this._theme = __spreadProps(__spreadValues({}, this.theme), { options: newValue });\n this.clearLoadedStyleNames();\n service_default.emit(\"options:change\", newValue);\n service_default.emit(\"theme:change\", this.theme);\n },\n getLayerNames() {\n return [...this._layerNames];\n },\n setLayerNames(layerName) {\n this._layerNames.add(layerName);\n },\n getLoadedStyleNames() {\n return this._loadedStyleNames;\n },\n isStyleNameLoaded(name) {\n return this._loadedStyleNames.has(name);\n },\n setLoadedStyleName(name) {\n this._loadedStyleNames.add(name);\n },\n deleteLoadedStyleName(name) {\n this._loadedStyleNames.delete(name);\n },\n clearLoadedStyleNames() {\n this._loadedStyleNames.clear();\n },\n getTokenValue(tokenPath) {\n return themeUtils_default.getTokenValue(this.tokens, tokenPath, this.defaults);\n },\n getCommon(name = \"\", params) {\n return themeUtils_default.getCommon({ name, theme: this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } });\n },\n getComponent(name = \"\", params) {\n const options = { name, theme: this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } };\n return themeUtils_default.getPresetC(options);\n },\n getDirective(name = \"\", params) {\n const options = { name, theme: this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } };\n return themeUtils_default.getPresetD(options);\n },\n getCustomPreset(name = \"\", preset, selector, params) {\n const options = { name, preset, options: this.options, selector, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } };\n return themeUtils_default.getPreset(options);\n },\n getLayerOrderCSS(name = \"\") {\n return themeUtils_default.getLayerOrder(name, this.options, { names: this.getLayerNames() }, this.defaults);\n },\n transformCSS(name = \"\", css2, type = \"style\", mode) {\n return themeUtils_default.transformCSS(name, css2, mode, type, this.options, { layerNames: this.setLayerNames.bind(this) }, this.defaults);\n },\n getCommonStyleSheet(name = \"\", params, props = {}) {\n return themeUtils_default.getCommonStyleSheet({ name, theme: this.theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } });\n },\n getStyleSheet(name, params, props = {}) {\n return themeUtils_default.getStyleSheet({ name, theme: this.theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } });\n },\n onStyleMounted(name) {\n this._loadingStyles.add(name);\n },\n onStyleUpdated(name) {\n this._loadingStyles.add(name);\n },\n onStyleLoaded(event, { name }) {\n if (this._loadingStyles.size) {\n this._loadingStyles.delete(name);\n service_default.emit(`theme:${name}:load`, event);\n !this._loadingStyles.size && service_default.emit(\"theme:load\");\n }\n }\n};\n\n// src/actions/updatePreset.ts\nfunction updatePreset(...presets) {\n const newPreset = mergeKeys3(config_default.getPreset(), ...presets);\n config_default.setPreset(newPreset);\n return newPreset;\n}\n\n// src/actions/updatePrimaryPalette.ts\nfunction updatePrimaryPalette(primary) {\n return $t().primaryPalette(primary).update().preset;\n}\n\n// src/actions/updateSurfacePalette.ts\nfunction updateSurfacePalette(palette) {\n return $t().surfacePalette(palette).update().preset;\n}\n\n// src/actions/usePreset.ts\nimport { mergeKeys as mergeKeys4 } from \"@primeuix/utils/object\";\nfunction usePreset(...presets) {\n const newPreset = mergeKeys4(...presets);\n config_default.setPreset(newPreset);\n return newPreset;\n}\n\n// src/actions/useTheme.ts\nfunction useTheme(theme) {\n return $t(theme).update({ mergePresets: false });\n}\nexport {\n $dt,\n $t,\n config_default as Theme,\n service_default as ThemeService,\n themeUtils_default as ThemeUtils,\n css,\n definePreset,\n dt,\n dtwt,\n getComputedValue,\n getRule,\n getVariableName,\n getVariableValue,\n merge,\n mix_default as mix,\n palette_default as palette,\n setProperty,\n shade_default as shade,\n tint_default as tint,\n toNormalizePrefix,\n toNormalizeVariable,\n toTokenKey,\n toUnit,\n toValue,\n toVariables_default as toVariables,\n updatePreset,\n updatePrimaryPalette,\n updateSurfacePalette,\n usePreset,\n useTheme\n};\n//# sourceMappingURL=index.mjs.map","// src/dom/methods/hasClass.ts\nfunction hasClass(element, className) {\n if (element) {\n if (element.classList) return element.classList.contains(className);\n else return new RegExp(\"(^| )\" + className + \"( |$)\", \"gi\").test(element.className);\n }\n return false;\n}\n\n// src/dom/methods/addClass.ts\nfunction addClass(element, className) {\n if (element && className) {\n const fn = (_className) => {\n if (!hasClass(element, _classNa