UNPKG

@tiller-ds/util

Version:

Util module of Tiller Design System

1,505 lines (1,264 loc) 76.6 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('tailwind-merge'), require('@tiller-ds/theme'), require('immer')) : typeof define === 'function' && define.amd ? define(['exports', 'react', 'tailwind-merge', '@tiller-ds/theme', 'immer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Util = {}, global.React, global.tailwindMerge, global.theme$1, global.immer)); })(this, (function (exports, React, tailwindMerge, theme$1, immer) { 'use strict'; function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n["default"] = e; return Object.freeze(n); } var React__namespace = /*#__PURE__*/_interopNamespace(React); /* * Copyright 2025 CROZ d.o.o, the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ function useInterval(callback, delay) { var savedCallback = React__namespace.useRef(); // Remember the latest callback. React__namespace.useEffect(function () { savedCallback.current = callback; }, [callback]); // Set up the interval. React__namespace.useEffect(function () { function tick() { if (savedCallback.current) { savedCallback.current(); } } if (delay !== null) { var id_1 = setInterval(tick, delay); return function () { return clearInterval(id_1); }; } }, [delay]); } /* * Copyright 2025 CROZ d.o.o, the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ function useTimeout(callback, delay) { var savedCallback = React__namespace.useRef(); // Remember the latest callback. React__namespace.useEffect(function () { savedCallback.current = callback; }, [callback]); // Set up the interval. React__namespace.useEffect(function () { function tick() { if (savedCallback.current) { savedCallback.current(); } } if (delay !== null) { var id_1 = setTimeout(tick, delay); return function () { return clearTimeout(id_1); }; } }, [delay]); } /* * Copyright 2025 CROZ d.o.o, the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ function useViewport(smallMobileBreakpoint, largeMobileBreakpoint) { if (smallMobileBreakpoint === void 0) { smallMobileBreakpoint = 320; } if (largeMobileBreakpoint === void 0) { largeMobileBreakpoint = 768; } var _a = React__namespace.useState("DESKTOP"), displayType = _a[0], setDisplayType = _a[1]; var handleResize = function handleResize(entries) { if (entries[0].contentRect.width >= smallMobileBreakpoint && entries[0].contentRect.width < largeMobileBreakpoint) { setDisplayType("LARGE_MOBILE"); } else if (entries[0].contentRect.width < smallMobileBreakpoint) { setDisplayType("SMALL_MOBILE"); } else { setDisplayType("DESKTOP"); } }; var resizeObserver = React__namespace.useRef(null); React__namespace.useEffect(function () { resizeObserver.current = new ResizeObserver(handleResize); resizeObserver.current.observe(document.body); }, []); return displayType; } /* * Copyright 2025 CROZ d.o.o, the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var usePrevious = function usePrevious(value) { var ref = React.useRef(); React.useEffect(function () { ref.current = value; }); return ref.current; }; function useWindowEvent(type, listener) { React.useEffect(function () { window.addEventListener(type, listener); return function () { return window.removeEventListener(type, listener); }; }, [type, listener]); } var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; var check = function (it) { return it && it.Math == Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global$i = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof commonjsGlobal == 'object' && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback (function () { return this; })() || Function('return this')(); var objectGetOwnPropertyDescriptor = {}; var fails$6 = function (exec) { try { return !!exec(); } catch (error) { return true; } }; var fails$5 = fails$6; // Detect IE8's incomplete defineProperty implementation var descriptors = !fails$5(function () { // eslint-disable-next-line es/no-object-defineproperty -- required for testing return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; }); var objectPropertyIsEnumerable = {}; var $propertyIsEnumerable = {}.propertyIsEnumerable; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor; // Nashorn ~ JDK8 bug var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1); // `Object.prototype.propertyIsEnumerable` method implementation // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) { var descriptor = getOwnPropertyDescriptor$2(this, V); return !!descriptor && descriptor.enumerable; } : $propertyIsEnumerable; var createPropertyDescriptor$2 = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; var toString = {}.toString; var classofRaw$1 = function (it) { return toString.call(it).slice(8, -1); }; var fails$4 = fails$6; var classof$4 = classofRaw$1; var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings var indexedObject = fails$4(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !Object('z').propertyIsEnumerable(0); }) ? function (it) { return classof$4(it) == 'String' ? split.call(it, '') : Object(it); } : Object; // `RequireObjectCoercible` abstract operation // https://tc39.es/ecma262/#sec-requireobjectcoercible var requireObjectCoercible$2 = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; // toObject with fallback for non-array-like ES3 strings var IndexedObject = indexedObject; var requireObjectCoercible$1 = requireObjectCoercible$2; var toIndexedObject$3 = function (it) { return IndexedObject(requireObjectCoercible$1(it)); }; var isObject$7 = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; var isObject$6 = isObject$7; // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string var toPrimitive$2 = function (input, PREFERRED_STRING) { if (!isObject$6(input)) return input; var fn, val; if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$6(val = fn.call(input))) return val; if (typeof (fn = input.valueOf) == 'function' && !isObject$6(val = fn.call(input))) return val; if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$6(val = fn.call(input))) return val; throw TypeError("Can't convert object to primitive value"); }; var hasOwnProperty = {}.hasOwnProperty; var has$7 = function (it, key) { return hasOwnProperty.call(it, key); }; var global$h = global$i; var isObject$5 = isObject$7; var document$3 = global$h.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject$5(document$3) && isObject$5(document$3.createElement); var documentCreateElement$1 = function (it) { return EXISTS ? document$3.createElement(it) : {}; }; var DESCRIPTORS$5 = descriptors; var fails$3 = fails$6; var createElement$1 = documentCreateElement$1; // Thank's IE8 for his funny defineProperty var ie8DomDefine = !DESCRIPTORS$5 && !fails$3(function () { // eslint-disable-next-line es/no-object-defineproperty -- requied for testing return Object.defineProperty(createElement$1('div'), 'a', { get: function () { return 7; } }).a != 7; }); var DESCRIPTORS$4 = descriptors; var propertyIsEnumerableModule = objectPropertyIsEnumerable; var createPropertyDescriptor$1 = createPropertyDescriptor$2; var toIndexedObject$2 = toIndexedObject$3; var toPrimitive$1 = toPrimitive$2; var has$6 = has$7; var IE8_DOM_DEFINE$1 = ie8DomDefine; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject$2(O); P = toPrimitive$1(P, true); if (IE8_DOM_DEFINE$1) try { return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (has$6(O, P)) return createPropertyDescriptor$1(!propertyIsEnumerableModule.f.call(O, P), O[P]); }; var objectDefineProperty = {}; var isObject$4 = isObject$7; var anObject$8 = function (it) { if (!isObject$4(it)) { throw TypeError(String(it) + ' is not an object'); } return it; }; var DESCRIPTORS$3 = descriptors; var IE8_DOM_DEFINE = ie8DomDefine; var anObject$7 = anObject$8; var toPrimitive = toPrimitive$2; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty objectDefineProperty.f = DESCRIPTORS$3 ? $defineProperty : function defineProperty(O, P, Attributes) { anObject$7(O); P = toPrimitive(P, true); anObject$7(Attributes); if (IE8_DOM_DEFINE) try { return $defineProperty(O, P, Attributes); } catch (error) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; var DESCRIPTORS$2 = descriptors; var definePropertyModule$4 = objectDefineProperty; var createPropertyDescriptor = createPropertyDescriptor$2; var createNonEnumerableProperty$4 = DESCRIPTORS$2 ? function (object, key, value) { return definePropertyModule$4.f(object, key, createPropertyDescriptor(1, value)); } : function (object, key, value) { object[key] = value; return object; }; var redefine$3 = {exports: {}}; var global$g = global$i; var createNonEnumerableProperty$3 = createNonEnumerableProperty$4; var setGlobal$3 = function (key, value) { try { createNonEnumerableProperty$3(global$g, key, value); } catch (error) { global$g[key] = value; } return value; }; var global$f = global$i; var setGlobal$2 = setGlobal$3; var SHARED = '__core-js_shared__'; var store$3 = global$f[SHARED] || setGlobal$2(SHARED, {}); var sharedStore = store$3; var store$2 = sharedStore; var functionToString = Function.toString; // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper if (typeof store$2.inspectSource != 'function') { store$2.inspectSource = function (it) { return functionToString.call(it); }; } var inspectSource$3 = store$2.inspectSource; var global$e = global$i; var inspectSource$2 = inspectSource$3; var WeakMap$1 = global$e.WeakMap; var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource$2(WeakMap$1)); var shared$3 = {exports: {}}; var store$1 = sharedStore; (shared$3.exports = function (key, value) { return store$1[key] || (store$1[key] = value !== undefined ? value : {}); })('versions', []).push({ version: '3.10.1', mode: 'global', copyright: '© 2021 Denis Pushkarev (zloirock.ru)' }); var id = 0; var postfix = Math.random(); var uid$2 = function (key) { return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); }; var shared$2 = shared$3.exports; var uid$1 = uid$2; var keys = shared$2('keys'); var sharedKey$2 = function (key) { return keys[key] || (keys[key] = uid$1(key)); }; var hiddenKeys$4 = {}; var NATIVE_WEAK_MAP = nativeWeakMap; var global$d = global$i; var isObject$3 = isObject$7; var createNonEnumerableProperty$2 = createNonEnumerableProperty$4; var objectHas = has$7; var shared$1 = sharedStore; var sharedKey$1 = sharedKey$2; var hiddenKeys$3 = hiddenKeys$4; var WeakMap = global$d.WeakMap; var set$1, get, has$5; var enforce = function (it) { return has$5(it) ? get(it) : set$1(it, {}); }; var getterFor = function (TYPE) { return function (it) { var state; if (!isObject$3(it) || (state = get(it)).type !== TYPE) { throw TypeError('Incompatible receiver, ' + TYPE + ' required'); } return state; }; }; if (NATIVE_WEAK_MAP) { var store = shared$1.state || (shared$1.state = new WeakMap()); var wmget = store.get; var wmhas = store.has; var wmset = store.set; set$1 = function (it, metadata) { metadata.facade = it; wmset.call(store, it, metadata); return metadata; }; get = function (it) { return wmget.call(store, it) || {}; }; has$5 = function (it) { return wmhas.call(store, it); }; } else { var STATE = sharedKey$1('state'); hiddenKeys$3[STATE] = true; set$1 = function (it, metadata) { metadata.facade = it; createNonEnumerableProperty$2(it, STATE, metadata); return metadata; }; get = function (it) { return objectHas(it, STATE) ? it[STATE] : {}; }; has$5 = function (it) { return objectHas(it, STATE); }; } var internalState = { set: set$1, get: get, has: has$5, enforce: enforce, getterFor: getterFor }; var global$c = global$i; var createNonEnumerableProperty$1 = createNonEnumerableProperty$4; var has$4 = has$7; var setGlobal$1 = setGlobal$3; var inspectSource$1 = inspectSource$3; var InternalStateModule$1 = internalState; var getInternalState$1 = InternalStateModule$1.get; var enforceInternalState = InternalStateModule$1.enforce; var TEMPLATE = String(String).split('String'); (redefine$3.exports = function (O, key, value, options) { var unsafe = options ? !!options.unsafe : false; var simple = options ? !!options.enumerable : false; var noTargetGet = options ? !!options.noTargetGet : false; var state; if (typeof value == 'function') { if (typeof key == 'string' && !has$4(value, 'name')) { createNonEnumerableProperty$1(value, 'name', key); } state = enforceInternalState(value); if (!state.source) { state.source = TEMPLATE.join(typeof key == 'string' ? key : ''); } } if (O === global$c) { if (simple) O[key] = value; else setGlobal$1(key, value); return; } else if (!unsafe) { delete O[key]; } else if (!noTargetGet && O[key]) { simple = true; } if (simple) O[key] = value; else createNonEnumerableProperty$1(O, key, value); // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, 'toString', function toString() { return typeof this == 'function' && getInternalState$1(this).source || inspectSource$1(this); }); var global$b = global$i; var path$1 = global$b; var path = path$1; var global$a = global$i; var aFunction$6 = function (variable) { return typeof variable == 'function' ? variable : undefined; }; var getBuiltIn$5 = function (namespace, method) { return arguments.length < 2 ? aFunction$6(path[namespace]) || aFunction$6(global$a[namespace]) : path[namespace] && path[namespace][method] || global$a[namespace] && global$a[namespace][method]; }; var objectGetOwnPropertyNames = {}; var ceil = Math.ceil; var floor = Math.floor; // `ToInteger` abstract operation // https://tc39.es/ecma262/#sec-tointeger var toInteger$2 = function (argument) { return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); }; var toInteger$1 = toInteger$2; var min$1 = Math.min; // `ToLength` abstract operation // https://tc39.es/ecma262/#sec-tolength var toLength$4 = function (argument) { return argument > 0 ? min$1(toInteger$1(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; var toInteger = toInteger$2; var max = Math.max; var min = Math.min; // Helper for a popular repeating case of the spec: // Let integer be ? ToInteger(index). // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). var toAbsoluteIndex$1 = function (index, length) { var integer = toInteger(index); return integer < 0 ? max(integer + length, 0) : min(integer, length); }; var toIndexedObject$1 = toIndexedObject$3; var toLength$3 = toLength$4; var toAbsoluteIndex = toAbsoluteIndex$1; // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject$1($this); var length = toLength$3(O.length); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare -- NaN check if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare -- NaN check if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) { if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; var arrayIncludes = { // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes includes: createMethod(true), // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof indexOf: createMethod(false) }; var has$3 = has$7; var toIndexedObject = toIndexedObject$3; var indexOf = arrayIncludes.indexOf; var hiddenKeys$2 = hiddenKeys$4; var objectKeysInternal = function (object, names) { var O = toIndexedObject(object); var i = 0; var result = []; var key; for (key in O) !has$3(hiddenKeys$2, key) && has$3(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (has$3(O, key = names[i++])) { ~indexOf(result, key) || result.push(key); } return result; }; // IE8- don't enum bug keys var enumBugKeys$3 = [ 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf' ]; var internalObjectKeys$1 = objectKeysInternal; var enumBugKeys$2 = enumBugKeys$3; var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames // eslint-disable-next-line es/no-object-getownpropertynames -- safe objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return internalObjectKeys$1(O, hiddenKeys$1); }; var objectGetOwnPropertySymbols = {}; // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols; var getBuiltIn$4 = getBuiltIn$5; var getOwnPropertyNamesModule = objectGetOwnPropertyNames; var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols; var anObject$6 = anObject$8; // all object keys, includes non-enumerable and symbols var ownKeys$1 = getBuiltIn$4('Reflect', 'ownKeys') || function ownKeys(it) { var keys = getOwnPropertyNamesModule.f(anObject$6(it)); var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; }; var has$2 = has$7; var ownKeys = ownKeys$1; var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor; var definePropertyModule$3 = objectDefineProperty; var copyConstructorProperties$1 = function (target, source) { var keys = ownKeys(source); var defineProperty = definePropertyModule$3.f; var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (!has$2(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } }; var fails$2 = fails$6; var replacement = /#|\.prototype\./; var isForced$2 = function (feature, detection) { var value = data[normalize(feature)]; return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails$2(detection) : !!detection; }; var normalize = isForced$2.normalize = function (string) { return String(string).replace(replacement, '.').toLowerCase(); }; var data = isForced$2.data = {}; var NATIVE = isForced$2.NATIVE = 'N'; var POLYFILL = isForced$2.POLYFILL = 'P'; var isForced_1 = isForced$2; var global$9 = global$i; var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; var createNonEnumerableProperty = createNonEnumerableProperty$4; var redefine$2 = redefine$3.exports; var setGlobal = setGlobal$3; var copyConstructorProperties = copyConstructorProperties$1; var isForced$1 = isForced_1; /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.noTargetGet - prevent calling a getter on target */ var _export = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var FORCED, target, key, targetProperty, sourceProperty, descriptor; if (GLOBAL) { target = global$9; } else if (STATIC) { target = global$9[TARGET] || setGlobal(TARGET, {}); } else { target = (global$9[TARGET] || {}).prototype; } if (target) for (key in source) { sourceProperty = source[key]; if (options.noTargetGet) { descriptor = getOwnPropertyDescriptor$1(target, key); targetProperty = descriptor && descriptor.value; } else targetProperty = target[key]; FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { if (typeof sourceProperty === typeof targetProperty) continue; copyConstructorProperties(sourceProperty, targetProperty); } // add a flag to not completely full polyfills if (options.sham || (targetProperty && targetProperty.sham)) { createNonEnumerableProperty(sourceProperty, 'sham', true); } // extend global redefine$2(target, key, sourceProperty, options); } }; var classof$3 = classofRaw$1; // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray // eslint-disable-next-line es/no-array-isarray -- safe var isArray$2 = Array.isArray || function isArray(arg) { return classof$3(arg) == 'Array'; }; var aFunction$5 = function (it) { if (typeof it != 'function') { throw TypeError(String(it) + ' is not a function'); } return it; }; var aFunction$4 = aFunction$5; // optional / simple context binding var functionBindContext = function (fn, that, length) { aFunction$4(fn); if (that === undefined) return fn; switch (length) { case 0: return function () { return fn.call(that); }; case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; var isArray$1 = isArray$2; var toLength$2 = toLength$4; var bind$3 = functionBindContext; // `FlattenIntoArray` abstract operation // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray var flattenIntoArray$1 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) { var targetIndex = start; var sourceIndex = 0; var mapFn = mapper ? bind$3(mapper, thisArg, 3) : false; var element; while (sourceIndex < sourceLen) { if (sourceIndex in source) { element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; if (depth > 0 && isArray$1(element)) { targetIndex = flattenIntoArray$1(target, original, element, toLength$2(element.length), targetIndex, depth - 1) - 1; } else { if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length'); target[targetIndex] = element; } targetIndex++; } sourceIndex++; } return targetIndex; }; var flattenIntoArray_1 = flattenIntoArray$1; var requireObjectCoercible = requireObjectCoercible$2; // `ToObject` abstract operation // https://tc39.es/ecma262/#sec-toobject var toObject$1 = function (argument) { return Object(requireObjectCoercible(argument)); }; var classof$2 = classofRaw$1; var global$8 = global$i; var engineIsNode = classof$2(global$8.process) == 'process'; var getBuiltIn$3 = getBuiltIn$5; var engineUserAgent = getBuiltIn$3('navigator', 'userAgent') || ''; var global$7 = global$i; var userAgent$2 = engineUserAgent; var process$4 = global$7.process; var versions = process$4 && process$4.versions; var v8 = versions && versions.v8; var match, version; if (v8) { match = v8.split('.'); version = match[0] + match[1]; } else if (userAgent$2) { match = userAgent$2.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent$2.match(/Chrome\/(\d+)/); if (match) version = match[1]; } } var engineV8Version = version && +version; var IS_NODE$3 = engineIsNode; var V8_VERSION$1 = engineV8Version; var fails$1 = fails$6; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$1(function () { // eslint-disable-next-line es/no-symbol -- required for testing return !Symbol.sham && // Chrome 38 Symbol has incorrect toString conversion // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances (IS_NODE$3 ? V8_VERSION$1 === 38 : V8_VERSION$1 > 37 && V8_VERSION$1 < 41); }); /* eslint-disable es/no-symbol -- required for testing */ var NATIVE_SYMBOL$1 = nativeSymbol; var useSymbolAsUid = NATIVE_SYMBOL$1 && !Symbol.sham && typeof Symbol.iterator == 'symbol'; var global$6 = global$i; var shared = shared$3.exports; var has$1 = has$7; var uid = uid$2; var NATIVE_SYMBOL = nativeSymbol; var USE_SYMBOL_AS_UID = useSymbolAsUid; var WellKnownSymbolsStore = shared('wks'); var Symbol$1 = global$6.Symbol; var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid; var wellKnownSymbol$b = function (name) { if (!has$1(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) { if (NATIVE_SYMBOL && has$1(Symbol$1, name)) { WellKnownSymbolsStore[name] = Symbol$1[name]; } else { WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); } } return WellKnownSymbolsStore[name]; }; var isObject$2 = isObject$7; var isArray = isArray$2; var wellKnownSymbol$a = wellKnownSymbol$b; var SPECIES$3 = wellKnownSymbol$a('species'); // `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate var arraySpeciesCreate$1 = function (originalArray, length) { var C; if (isArray(originalArray)) { C = originalArray.constructor; // cross-realm fallback if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; else if (isObject$2(C)) { C = C[SPECIES$3]; if (C === null) C = undefined; } } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); }; var $$1 = _export; var flattenIntoArray = flattenIntoArray_1; var toObject = toObject$1; var toLength$1 = toLength$4; var aFunction$3 = aFunction$5; var arraySpeciesCreate = arraySpeciesCreate$1; // `Array.prototype.flatMap` method // https://tc39.es/ecma262/#sec-array.prototype.flatmap $$1({ target: 'Array', proto: true }, { flatMap: function flatMap(callbackfn /* , thisArg */) { var O = toObject(this); var sourceLen = toLength$1(O.length); var A; aFunction$3(callbackfn); A = arraySpeciesCreate(O, 0); A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined); return A; } }); var internalObjectKeys = objectKeysInternal; var enumBugKeys$1 = enumBugKeys$3; // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys // eslint-disable-next-line es/no-object-keys -- safe var objectKeys$1 = Object.keys || function keys(O) { return internalObjectKeys(O, enumBugKeys$1); }; var DESCRIPTORS$1 = descriptors; var definePropertyModule$2 = objectDefineProperty; var anObject$5 = anObject$8; var objectKeys = objectKeys$1; // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties // eslint-disable-next-line es/no-object-defineproperties -- safe var objectDefineProperties = DESCRIPTORS$1 ? Object.defineProperties : function defineProperties(O, Properties) { anObject$5(O); var keys = objectKeys(Properties); var length = keys.length; var index = 0; var key; while (length > index) definePropertyModule$2.f(O, key = keys[index++], Properties[key]); return O; }; var getBuiltIn$2 = getBuiltIn$5; var html$2 = getBuiltIn$2('document', 'documentElement'); var anObject$4 = anObject$8; var defineProperties = objectDefineProperties; var enumBugKeys = enumBugKeys$3; var hiddenKeys = hiddenKeys$4; var html$1 = html$2; var documentCreateElement = documentCreateElement$1; var sharedKey = sharedKey$2; var GT = '>'; var LT = '<'; var PROTOTYPE = 'prototype'; var SCRIPT = 'script'; var IE_PROTO = sharedKey('IE_PROTO'); var EmptyConstructor = function () { /* empty */ }; var scriptTag = function (content) { return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype var NullProtoObjectViaActiveX = function (activeXDocument) { activeXDocument.write(scriptTag('')); activeXDocument.close(); var temp = activeXDocument.parentWindow.Object; activeXDocument = null; // avoid memory leak return temp; }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var NullProtoObjectViaIFrame = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement('iframe'); var JS = 'java' + SCRIPT + ':'; var iframeDocument; iframe.style.display = 'none'; html$1.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475 iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag('document.F=Object')); iframeDocument.close(); return iframeDocument.F; }; // Check for document.domain and active x support // No need to use active x approach when document.domain is not set // see https://github.com/es-shims/es5-shim/issues/150 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 // avoid IE GC bug var activeXDocument; var NullProtoObject = function () { try { /* global ActiveXObject -- old IE */ activeXDocument = document.domain && new ActiveXObject('htmlfile'); } catch (error) { /* ignore */ } NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame(); var length = enumBugKeys.length; while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; return NullProtoObject(); }; hiddenKeys[IE_PROTO] = true; // `Object.create` method // https://tc39.es/ecma262/#sec-object.create var objectCreate = Object.create || function create(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE] = anObject$4(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = NullProtoObject(); return Properties === undefined ? result : defineProperties(result, Properties); }; var wellKnownSymbol$9 = wellKnownSymbol$b; var create = objectCreate; var definePropertyModule$1 = objectDefineProperty; var UNSCOPABLES = wellKnownSymbol$9('unscopables'); var ArrayPrototype$1 = Array.prototype; // Array.prototype[@@unscopables] // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables if (ArrayPrototype$1[UNSCOPABLES] == undefined) { definePropertyModule$1.f(ArrayPrototype$1, UNSCOPABLES, { configurable: true, value: create(null) }); } // add a key to Array.prototype[@@unscopables] var addToUnscopables$1 = function (key) { ArrayPrototype$1[UNSCOPABLES][key] = true; }; // this method was added to unscopables after implementation // in popular engines, so it's moved to a separate module var addToUnscopables = addToUnscopables$1; // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('flatMap'); var theme = theme$1.preset.theme.extend || {}; var extractKeys = function extractKeys(prefix, obj) { return obj ? Object.keys(obj).map(function (key) { return prefix + "-" + key; }) : []; }; var fontSizes = extractKeys("text", theme.fontSize); var flexValues = extractKeys("flex", theme.flex); var maxWidths = extractKeys("max-w", theme.maxWidth); var spacings = extractKeys("p", theme.spacing).concat(extractKeys("m", theme.spacing)); var widths = extractKeys("w", theme.width); var textColors = extractKeys("text", theme.textColor); var colors = Object.keys(theme.colors || {}).flatMap(function (color) { return ["bg-" + color, "text-" + color, "border-" + color]; }); var tillerTwMerge = tailwindMerge.extendTailwindMerge({ extend: { theme: { colors: ["primary", "secondary", "tertiary", "success", "danger", "warning", "info"], borderColor: ["base"], spacing: spacings }, classGroups: { "font-size": fontSizes, flex: flexValues, "max-w": maxWidths, w: widths, "text-color": textColors.concat(colors), "bg-color": colors } } }); /* * Copyright 2025 CROZ d.o.o, the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ function createNamedContext(name, initialValue) { if (initialValue === void 0) { initialValue = undefined; } var context = /*#__PURE__*/React__namespace.createContext(initialValue); context.displayName = name; return context; } var global$5 = global$i; var nativePromiseConstructor = global$5.Promise; var redefine$1 = redefine$3.exports; var redefineAll$1 = function (target, src, options) { for (var key in src) redefine$1(target, key, src[key], options); return target; }; var defineProperty = objectDefineProperty.f; var has = has$7; var wellKnownSymbol$8 = wellKnownSymbol$b; var TO_STRING_TAG$2 = wellKnownSymbol$8('toStringTag'); var setToStringTag$1 = function (it, TAG, STATIC) { if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG$2)) { defineProperty(it, TO_STRING_TAG$2, { configurable: true, value: TAG }); } }; var getBuiltIn$1 = getBuiltIn$5; var definePropertyModule = objectDefineProperty; var wellKnownSymbol$7 = wellKnownSymbol$b; var DESCRIPTORS = descriptors; var SPECIES$2 = wellKnownSymbol$7('species'); var setSpecies$1 = function (CONSTRUCTOR_NAME) { var Constructor = getBuiltIn$1(CONSTRUCTOR_NAME); var defineProperty = definePropertyModule.f; if (DESCRIPTORS && Constructor && !Constructor[SPECIES$2]) { defineProperty(Constructor, SPECIES$2, { configurable: true, get: function () { return this; } }); } }; var anInstance$1 = function (it, Constructor, name) { if (!(it instanceof Constructor)) { throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); } return it; }; var iterators = {}; var wellKnownSymbol$6 = wellKnownSymbol$b; var Iterators$1 = iterators; var ITERATOR$2 = wellKnownSymbol$6('iterator'); var ArrayPrototype = Array.prototype; // check on default Array iterator var isArrayIteratorMethod$1 = function (it) { return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$2] === it); }; var wellKnownSymbol$5 = wellKnownSymbol$b; var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag'); var test = {}; test[TO_STRING_TAG$1] = 'z'; var toStringTagSupport = String(test) === '[object z]'; var TO_STRING_TAG_SUPPORT = toStringTagSupport; var classofRaw = classofRaw$1; var wellKnownSymbol$4 = wellKnownSymbol$b; var TO_STRING_TAG = wellKnownSymbol$4('toStringTag'); // ES3 wrong here var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (error) { /* empty */ } }; // getting tag from ES6+ `Object.prototype.toString` var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { var O, tag, result; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; }; var classof = classof$1; var Iterators = iterators; var wellKnownSymbol$3 = wellKnownSymbol$b; var ITERATOR$1 = wellKnownSymbol$3('iterator'); var getIteratorMethod$1 = function (it) { if (it != undefined) return it[ITERATOR$1] || it['@@iterator'] || Iterators[classof(it)]; }; var anObject$3 = anObject$8; var iteratorClose$1 = function (iterator) { var returnMethod = iterator['return']; if (returnMethod !== undefined) { return anObject$3(returnMethod.call(iterator)).value; } }; var anObject$2 = anObject$8; var isArrayIteratorMethod = isArrayIteratorMethod$1; var toLength = toLength$4; var bind$2 = functionBindContext; var getIteratorMethod = getIteratorMethod$1; var iteratorClose = iteratorClose$1; var Result = function (stopped, result) { this.stopped = stopped; this.result = result; }; var iterate$1 = function (iterable, unboundFunction, options) { var that = options && options.that; var AS_ENTRIES = !!(options && options.AS_ENTRIES); var IS_ITERATOR = !!(options && options.IS_ITERATOR); var INTERRUPTED = !!(options && options.INTERRUPTED); var fn = bind$2(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED); var iterator, iterFn, index, length, result, next, step; var stop = function (condition) { if (iterator) iteratorClose(iterator); return new Result(true, condition); }; var callFn = function (value) { if (AS_ENTRIES) { anObject$2(value); return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); } return INTERRUPTED ? fn(value, stop) : fn(value); }; if (IS_ITERATOR) { iterator = iterable; } else { iterFn = getIteratorMethod(iterable); if (typeof iterFn != 'function') throw TypeError('Target is not iterable'); // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { for (index = 0, length = toLength(iterable.length); length > index; index++) { result = callFn(iterable[index]); if (result && result instanceof Result) return result; } return new Result(false); } iterator = iterFn.call(iterable); } next = iterator.next; while (!(step = next.call(iterator)).done) { try { result = callFn(step.value); } catch (error) { iteratorClose(iterator); throw error; } if (typeof result == 'object' && result && result instanceof Result) return result; } return new Result(false); }; var wellKnownSymbol$2 = wellKnownSymbol$b; var ITERATOR = wellKnownSymbol$2('iterator'); var SAFE_CLOSING = false; try { var called = 0; var iteratorWithReturn = { next: function () { return { done: !!called++ }; }, 'return': function () { SAFE_CLOSING = true; } }; iteratorWithReturn[ITERATOR] = function () { return this; }; // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing Array.from(iteratorWithReturn, function () { throw 2; }); } catch (error) { /* empty */ } var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) { if (!SKIP_CLOSING && !SAFE_CLOSING) return false; var ITERATION_SUPPORT = false; try { var object = {}; object[ITERATOR] = function () { return { next: function () { return { done: ITERATION_SUPPORT = true }; } }; }; exec(object); } catch (error) { /* empty */ } return ITERATION_SUPPORT; }; var anObject$1 = anObject$8; var aFunction$2 = aFunction$5; var wellKnownSymbol$1 = wellKnownSymbol$b; var SPECIES$1 = wellKnownSymbol$1('species'); // `SpeciesConstructor` abstract operation // https://tc39.es/ecma262/#sec-speciesconstructor var speciesConstructor$1 = function (O, defaultConstructor) { var C = anObject$1(O).constructor; var S; return C === undefined || (S = anObject$1(C)[SPECIES$1]) == undefined ? defaultConstructor : aFunction$2(S); }; var userAgent$1 = engineUserAgent; var engineIsIos = /(?:iphone|ipod|ipad).*applewebkit/i.test(userAgent$1); var global$4 = global$i; var fails = fails$6; var bind$1 = functionBindContext; var html = html$2; var createElement = documentCreateElement$1; var IS_IOS$1 = engineIsIos; var IS_NODE$2 = engineIsNode; var location = global$4.location; var set = global$4.setImmediate; var clear = global$4.clearImmediate; var process$3 = global$4.process; var MessageChannel = global$4.MessageChannel; var Dispatch = global$4.Dispatch; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var defer, channel, port; var run = function (id) { // eslint-disable-next-line no-prototype-builtins -- safe if (queue.hasOwnProperty(id)) { var fn = queue[id]; delete queue[id]; fn(); } }; var runner = function (id) { return function () { run(id); }; }; var listener = function (event) { run(event.data); }; var post = function (id) { // old engines have not location.origin global$4.postMessage(id + '', location.protocol + '//' + location.host); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!set || !clear) { set = function setImmediate(fn) { var args = []; var i = 1; while (arguments.length > i) args.push(arguments[i++]); queue[++counter] = function () { // eslint-disable-next-line no-new-func -- spec requirement (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args); }; defer(counter); return counter; }; clear = function clearImmediate(id) { delete queue[id]; }; // Node.js 0.8- if (IS_NODE$2) { defer = function (id) { process$3.nextTick(runner(id)); }; // Sphere (JS game engine) Dispatch API } else if (Dispatch && Dispatch.now) { defer = function (id) { Dispatch.now(runner(id)); }; // Browsers with MessageChannel, includes WebWorkers // except iOS - https://github.com/zloirock/core-js/issues/624 } else if (MessageChannel