@timeax/form-palette 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -549,1631 +549,650 @@ var FieldRegistry = class {
549
549
  }
550
550
  };
551
551
  _binding = new WeakMap();
552
- var CORE_PROP_KEYS = /* @__PURE__ */ new Set([
553
- "adapter",
554
- "schema",
555
- "exceptions",
556
- "persist",
557
- "name",
558
- "activateButtonOnChange",
559
- "onChange",
560
- "onUpdate",
561
- "changeBefore",
562
- "formRef",
563
- "valueBag",
564
- "valueFeed",
565
- "onFinish",
566
- "init",
567
- "onSubmit",
568
- "onSubmitted",
569
- "children"
570
- ]);
571
- function isPlainObject(value) {
572
- return typeof value === "object" && value !== null && !Array.isArray(value);
573
- }
574
- function deepEqual(a3, b2) {
575
- if (a3 === b2) return true;
576
- if (typeof a3 === "number" && typeof b2 === "number") {
577
- if (Number.isNaN(a3) && Number.isNaN(b2)) return true;
552
+
553
+ // src/lib/register-global.ts
554
+ function registerPaletteUtil(key, value) {
555
+ if (typeof window === "undefined") return;
556
+ if (!window["form-palette"]) {
557
+ window["form-palette"] = {};
578
558
  }
579
- if (Array.isArray(a3) && Array.isArray(b2)) {
580
- if (a3.length !== b2.length) return false;
581
- for (let i3 = 0; i3 < a3.length; i3++) {
582
- if (!deepEqual(a3[i3], b2[i3])) return false;
583
- }
584
- return true;
559
+ window["form-palette"][key] = value;
560
+ }
561
+ function getPaletteUtil(key, defaultValue) {
562
+ if (typeof window === "undefined") {
563
+ return defaultValue;
585
564
  }
586
- if (isPlainObject(a3) && isPlainObject(b2)) {
587
- const aKeys = Object.keys(a3);
588
- const bKeys = Object.keys(b2);
589
- if (aKeys.length !== bKeys.length) return false;
590
- for (const key of aKeys) {
591
- if (!Object.prototype.hasOwnProperty.call(b2, key)) return false;
592
- if (!deepEqual(a3[key], b2[key])) return false;
593
- }
594
- return true;
565
+ const registry3 = window["form-palette"];
566
+ if (registry3 && key in registry3) {
567
+ return registry3[key];
595
568
  }
596
- return false;
569
+ return defaultValue;
597
570
  }
598
- function CoreProvider(props) {
599
- var _a, _b;
600
- const registryRef = React68.useRef(new FieldRegistry());
601
- const bucketRef = React68.useRef({});
602
- const uncaughtRef = React68.useRef([]);
603
- const errorsRef = React68.useRef(null);
604
- const buttonRef = React68.useRef(null);
605
- const activeButtonNameRef = React68.useRef(null);
606
- const [hasUncaughtErrors, setHasUncaughtErrors] = React68.useState(0);
607
- const originalRef = React68.useRef(null);
608
- const propsRef = React68.useRef(props);
609
- React68.useEffect(() => {
610
- propsRef.current = props;
611
- }, [props]);
612
- const adapterKey = (_a = props.adapter) != null ? _a : "local";
613
- const schema = props.schema;
614
- const errorBagId = (_b = props.name) != null ? _b : void 0;
615
- let context;
616
- function fetchAllNamedFields() {
617
- return registryRef.current.getAllNamed();
618
- }
619
- function clearFieldErrors() {
620
- for (const field of fetchAllNamedFields()) {
621
- const anyField = field;
622
- if (typeof anyField.setError === "function") {
623
- anyField.setError(void 0);
624
- } else if ("error" in anyField) {
625
- anyField.error = void 0;
626
- }
627
- }
571
+
572
+ // ../../node_modules/clsx/dist/clsx.mjs
573
+ function r(e4) {
574
+ var t4, f2, n3 = "";
575
+ if ("string" == typeof e4 || "number" == typeof e4) n3 += e4;
576
+ else if ("object" == typeof e4) if (Array.isArray(e4)) {
577
+ var o3 = e4.length;
578
+ for (t4 = 0; t4 < o3; t4++) e4[t4] && (f2 = r(e4[t4])) && (n3 && (n3 += " "), n3 += f2);
579
+ } else for (f2 in e4) e4[f2] && (n3 && (n3 += " "), n3 += f2);
580
+ return n3;
581
+ }
582
+ function clsx() {
583
+ for (var e4, t4, f2 = 0, n3 = "", o3 = arguments.length; f2 < o3; f2++) (e4 = arguments[f2]) && (t4 = r(e4)) && (n3 && (n3 += " "), n3 += t4);
584
+ return n3;
585
+ }
586
+
587
+ // ../../node_modules/tailwind-merge/dist/bundle-mjs.mjs
588
+ var concatArrays = (array1, array2) => {
589
+ const combinedArray = new Array(array1.length + array2.length);
590
+ for (let i3 = 0; i3 < array1.length; i3++) {
591
+ combinedArray[i3] = array1[i3];
628
592
  }
629
- function findFieldForErrorKey(key) {
630
- if (!key) return void 0;
631
- return fetchAllNamedFields().find((f2) => {
632
- const raw = f2.name;
633
- if (!raw) return false;
634
- const trimmed = raw.trim();
635
- if (!trimmed) return false;
636
- const base = trimmed.replace(/\[]$/, "");
637
- if (key === base || key === trimmed) return true;
638
- const sharedKey = f2.shared;
639
- if (!sharedKey) return false;
640
- const sharedBase = `${sharedKey}.${base}`;
641
- const sharedRaw = `${sharedKey}.${trimmed}`;
642
- return key === sharedBase || key === sharedRaw;
643
- });
593
+ for (let i3 = 0; i3 < array2.length; i3++) {
594
+ combinedArray[array1.length + i3] = array2[i3];
644
595
  }
645
- function setFieldError(name, message2) {
646
- const field = findFieldForErrorKey(name);
647
- if (field) {
648
- const anyField = field;
649
- if (typeof anyField.setError === "function") {
650
- anyField.setError(message2);
651
- } else {
652
- anyField.error = message2;
653
- }
654
- } else {
655
- uncaughtRef.current.push(message2);
596
+ return combinedArray;
597
+ };
598
+ var createClassValidatorObject = (classGroupId, validator) => ({
599
+ classGroupId,
600
+ validator
601
+ });
602
+ var createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators = null, classGroupId) => ({
603
+ nextPart,
604
+ validators,
605
+ classGroupId
606
+ });
607
+ var CLASS_PART_SEPARATOR = "-";
608
+ var EMPTY_CONFLICTS = [];
609
+ var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
610
+ var createClassGroupUtils = (config) => {
611
+ const classMap = createClassMap(config);
612
+ const {
613
+ conflictingClassGroups,
614
+ conflictingClassGroupModifiers
615
+ } = config;
616
+ const getClassGroupId = (className) => {
617
+ if (className.startsWith("[") && className.endsWith("]")) {
618
+ return getGroupIdForArbitraryProperty(className);
656
619
  }
657
- }
658
- function collectValues() {
659
- var _a2, _b2;
660
- const exceptions = (_a2 = propsRef.current.exceptions) != null ? _a2 : [];
661
- const list = {};
662
- const shared = {};
663
- for (const item of fetchAllNamedFields()) {
664
- const rawName = item.name;
665
- if (!rawName) continue;
666
- const trimmed = rawName.trim();
667
- if (!trimmed) continue;
668
- const isArray = trimmed.endsWith("[]");
669
- const base = trimmed.replace(/\[]$/, "");
670
- const sharedKey = item.shared;
671
- const target = sharedKey ? (_b2 = shared[sharedKey]) != null ? _b2 : shared[sharedKey] = {} : list;
672
- const fullPath = sharedKey ? `${sharedKey}.${base}` : base;
673
- if (exceptions.includes(trimmed) || exceptions.includes(base) || exceptions.includes(fullPath)) {
674
- continue;
675
- }
676
- const anyField = item;
677
- const val = typeof anyField.getValue === "function" ? anyField.getValue() : anyField.value;
678
- if (isArray) {
679
- const existing = target[base];
680
- if (Array.isArray(existing)) {
681
- target[base] = [...existing, val];
682
- } else if (typeof existing === "undefined") {
683
- target[base] = [val];
684
- } else {
685
- target[base] = [existing, val];
620
+ const classParts = className.split(CLASS_PART_SEPARATOR);
621
+ const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
622
+ return getGroupRecursive(classParts, startIndex, classMap);
623
+ };
624
+ const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
625
+ if (hasPostfixModifier) {
626
+ const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
627
+ const baseConflicts = conflictingClassGroups[classGroupId];
628
+ if (modifierConflicts) {
629
+ if (baseConflicts) {
630
+ return concatArrays(baseConflicts, modifierConflicts);
686
631
  }
687
- } else {
688
- target[base] = val;
632
+ return modifierConflicts;
689
633
  }
634
+ return baseConflicts || EMPTY_CONFLICTS;
690
635
  }
691
- const fromFields = { ...list, ...shared };
692
- const merged = {
693
- ...bucketRef.current,
694
- ...fromFields
695
- };
696
- return merged;
636
+ return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
637
+ };
638
+ return {
639
+ getClassGroupId,
640
+ getConflictingClassGroupIds
641
+ };
642
+ };
643
+ var getGroupRecursive = (classParts, startIndex, classPartObject) => {
644
+ const classPathsLength = classParts.length - startIndex;
645
+ if (classPathsLength === 0) {
646
+ return classPartObject.classGroupId;
697
647
  }
698
- function validateInternal(report = false) {
699
- let valid = true;
700
- if (report) {
701
- uncaughtRef.current = [];
702
- clearFieldErrors();
703
- }
704
- for (const field of fetchAllNamedFields()) {
705
- const anyField = field;
706
- if (typeof anyField.validate === "function") {
707
- const ok = anyField.validate(report);
708
- if (!ok) valid = false;
709
- }
710
- }
711
- if (schema) {
712
- try {
713
- schema.parse(collectValues());
714
- } catch (err) {
715
- valid = false;
716
- if (report && err && typeof err === "object") {
717
- const anyErr = err;
718
- if (anyErr.issues) {
719
- const { fieldErrors, uncaught } = mapZodError(anyErr);
720
- for (const [name, message2] of Object.entries(
721
- fieldErrors
722
- )) {
723
- setFieldError(name, message2);
724
- }
725
- if (uncaught.length) {
726
- uncaughtRef.current.push(...uncaught);
727
- }
728
- }
729
- }
730
- }
731
- }
732
- return valid;
648
+ const currentClassPart = classParts[startIndex];
649
+ const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
650
+ if (nextClassPartObject) {
651
+ const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
652
+ if (result) return result;
733
653
  }
734
- function getAdapterPropsFrom(current) {
735
- const result = {};
736
- for (const key in current) {
737
- if (!CORE_PROP_KEYS.has(key)) {
738
- result[key] = current[key];
739
- }
654
+ const validators = classPartObject.validators;
655
+ if (validators === null) {
656
+ return void 0;
657
+ }
658
+ const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
659
+ const validatorsLength = validators.length;
660
+ for (let i3 = 0; i3 < validatorsLength; i3++) {
661
+ const validatorObj = validators[i3];
662
+ if (validatorObj.validator(classRest)) {
663
+ return validatorObj.classGroupId;
740
664
  }
741
- return result;
742
665
  }
743
- async function submitWithAdapter(adapterOverride, extra, ignoreForm, autoErr = true, autoRun = true) {
744
- var _a2, _b2;
745
- const currentProps = propsRef.current;
746
- const btn = buttonRef.current;
747
- const activeName = activeButtonNameRef.current;
748
- const isActiveButton = !!btn && typeof btn === "object" && btn.name === activeName;
749
- const setButtonLoading = (loading) => {
750
- if (!isActiveButton) return;
751
- if (typeof btn.setLoading === "function") {
752
- btn.setLoading(loading);
753
- } else if ("loading" in btn) {
754
- btn.loading = loading;
666
+ return void 0;
667
+ };
668
+ var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
669
+ const content = className.slice(1, -1);
670
+ const colonIndex = content.indexOf(":");
671
+ const property = content.slice(0, colonIndex);
672
+ return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
673
+ })();
674
+ var createClassMap = (config) => {
675
+ const {
676
+ theme,
677
+ classGroups
678
+ } = config;
679
+ return processClassGroups(classGroups, theme);
680
+ };
681
+ var processClassGroups = (classGroups, theme) => {
682
+ const classMap = createClassPartObject();
683
+ for (const classGroupId in classGroups) {
684
+ const group = classGroups[classGroupId];
685
+ processClassesRecursively(group, classMap, classGroupId, theme);
686
+ }
687
+ return classMap;
688
+ };
689
+ var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
690
+ const len = classGroup.length;
691
+ for (let i3 = 0; i3 < len; i3++) {
692
+ const classDefinition = classGroup[i3];
693
+ processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
694
+ }
695
+ };
696
+ var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
697
+ if (typeof classDefinition === "string") {
698
+ processStringDefinition(classDefinition, classPartObject, classGroupId);
699
+ return;
700
+ }
701
+ if (typeof classDefinition === "function") {
702
+ processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
703
+ return;
704
+ }
705
+ processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
706
+ };
707
+ var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
708
+ const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
709
+ classPartObjectToEdit.classGroupId = classGroupId;
710
+ };
711
+ var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
712
+ if (isThemeGetter(classDefinition)) {
713
+ processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
714
+ return;
715
+ }
716
+ if (classPartObject.validators === null) {
717
+ classPartObject.validators = [];
718
+ }
719
+ classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
720
+ };
721
+ var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
722
+ const entries = Object.entries(classDefinition);
723
+ const len = entries.length;
724
+ for (let i3 = 0; i3 < len; i3++) {
725
+ const [key, value] = entries[i3];
726
+ processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
727
+ }
728
+ };
729
+ var getPart = (classPartObject, path) => {
730
+ let current = classPartObject;
731
+ const parts = path.split(CLASS_PART_SEPARATOR);
732
+ const len = parts.length;
733
+ for (let i3 = 0; i3 < len; i3++) {
734
+ const part = parts[i3];
735
+ let next = current.nextPart.get(part);
736
+ if (!next) {
737
+ next = createClassPartObject();
738
+ current.nextPart.set(part, next);
739
+ }
740
+ current = next;
741
+ }
742
+ return current;
743
+ };
744
+ var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
745
+ var createLruCache = (maxCacheSize) => {
746
+ if (maxCacheSize < 1) {
747
+ return {
748
+ get: () => void 0,
749
+ set: () => {
755
750
  }
756
751
  };
757
- setButtonLoading(true);
758
- let finished = false;
759
- const finish = () => {
760
- if (finished) return;
761
- finished = true;
762
- if (uncaughtRef.current.length)
763
- setHasUncaughtErrors(hasUncaughtErrors + 1);
764
- setButtonLoading(false);
765
- };
766
- if (!ignoreForm) {
767
- const ok = validateInternal(true);
768
- if (!ok) {
769
- finish();
770
- return void 0;
752
+ }
753
+ let cacheSize = 0;
754
+ let cache = /* @__PURE__ */ Object.create(null);
755
+ let previousCache = /* @__PURE__ */ Object.create(null);
756
+ const update = (key, value) => {
757
+ cache[key] = value;
758
+ cacheSize++;
759
+ if (cacheSize > maxCacheSize) {
760
+ cacheSize = 0;
761
+ previousCache = cache;
762
+ cache = /* @__PURE__ */ Object.create(null);
763
+ }
764
+ };
765
+ return {
766
+ get(key) {
767
+ let value = cache[key];
768
+ if (value !== void 0) {
769
+ return value;
770
+ }
771
+ if ((value = previousCache[key]) !== void 0) {
772
+ update(key, value);
773
+ return value;
774
+ }
775
+ },
776
+ set(key, value) {
777
+ if (key in cache) {
778
+ cache[key] = value;
779
+ } else {
780
+ update(key, value);
771
781
  }
772
782
  }
773
- let submissionValues = {
774
- ...collectValues(),
775
- ...extra != null ? extra : {}
776
- };
777
- let adapterConfig = {
778
- ...getAdapterPropsFrom(currentProps),
779
- ...adapterOverride
780
- };
781
- const event = {
782
- preventDefault() {
783
- this.continue = false;
784
- },
785
- editData(cb) {
786
- const result = cb(submissionValues);
787
- if (result) {
788
- submissionValues = result;
783
+ };
784
+ };
785
+ var IMPORTANT_MODIFIER = "!";
786
+ var MODIFIER_SEPARATOR = ":";
787
+ var EMPTY_MODIFIERS = [];
788
+ var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
789
+ modifiers,
790
+ hasImportantModifier,
791
+ baseClassName,
792
+ maybePostfixModifierPosition,
793
+ isExternal
794
+ });
795
+ var createParseClassName = (config) => {
796
+ const {
797
+ prefix,
798
+ experimentalParseClassName
799
+ } = config;
800
+ let parseClassName = (className) => {
801
+ const modifiers = [];
802
+ let bracketDepth = 0;
803
+ let parenDepth = 0;
804
+ let modifierStart = 0;
805
+ let postfixModifierPosition;
806
+ const len = className.length;
807
+ for (let index = 0; index < len; index++) {
808
+ const currentCharacter = className[index];
809
+ if (bracketDepth === 0 && parenDepth === 0) {
810
+ if (currentCharacter === MODIFIER_SEPARATOR) {
811
+ modifiers.push(className.slice(modifierStart, index));
812
+ modifierStart = index + 1;
813
+ continue;
789
814
  }
790
- },
791
- setConfig(arg1, arg2) {
792
- if (typeof arg1 === "string") {
793
- adapterConfig[arg1] = arg2;
794
- } else if (arg1 && typeof arg1 === "object") {
795
- adapterConfig = {
796
- ...adapterConfig,
797
- ...arg1
798
- };
815
+ if (currentCharacter === "/") {
816
+ postfixModifierPosition = index;
817
+ continue;
799
818
  }
800
- },
801
- button: (_a2 = buttonRef.current) != null ? _a2 : void 0,
802
- get formData() {
803
- return submissionValues;
804
- },
805
- form: context,
806
- continue: true
807
- };
808
- if (currentProps.onSubmit) {
809
- try {
810
- await currentProps.onSubmit(event);
811
- } catch (err) {
812
- finish();
813
- throw err;
814
819
  }
820
+ if (currentCharacter === "[") bracketDepth++;
821
+ else if (currentCharacter === "]") bracketDepth--;
822
+ else if (currentCharacter === "(") parenDepth++;
823
+ else if (currentCharacter === ")") parenDepth--;
815
824
  }
816
- if (!event.continue) {
817
- finish();
818
- return void 0;
825
+ const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
826
+ let baseClassName = baseClassNameWithImportantModifier;
827
+ let hasImportantModifier = false;
828
+ if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
829
+ baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
830
+ hasImportantModifier = true;
831
+ } else if (
832
+ /**
833
+ * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
834
+ * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
835
+ */
836
+ baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
837
+ ) {
838
+ baseClassName = baseClassNameWithImportantModifier.slice(1);
839
+ hasImportantModifier = true;
819
840
  }
820
- const factory = (_b2 = getAdapter(adapterKey)) != null ? _b2 : localAdapter;
821
- const adapter = factory({
822
- // adapter-specific config (url, method, config, etc.)
823
- ...adapterConfig,
824
- // core config
825
- data: submissionValues,
826
- errorBag: errorBagId,
827
- callbacks: {
828
- onSuccess(ok) {
829
- const maybe = propsRef.current.onSubmitted;
830
- if (maybe) {
831
- void maybe(context, ok, () => {
832
- finish();
833
- });
834
- }
835
- },
836
- onError(err, updateRef) {
837
- var _a3;
838
- if (!autoErr || !err || typeof err !== "object") {
839
- return;
840
- }
841
- const anyErr = err;
842
- if (anyErr.errors && typeof anyErr.errors === "object") {
843
- const { fieldErrors, uncaught } = mapErrorBag(
844
- (_a3 = anyErr.errors) != null ? _a3 : {}
845
- );
846
- if (updateRef) {
847
- errorsRef.current = fieldErrors;
848
- } else
849
- for (const [name, message2] of Object.entries(
850
- fieldErrors
851
- )) {
852
- setFieldError(name, message2);
853
- }
854
- if (uncaught.length) {
855
- uncaughtRef.current.push(...uncaught);
856
- }
857
- }
858
- },
859
- onFinish() {
860
- const maybe = propsRef.current.onFinish;
861
- if (maybe) {
862
- maybe(context);
863
- }
864
- finish();
865
- }
866
- }
841
+ const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
842
+ return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
843
+ };
844
+ if (prefix) {
845
+ const fullPrefix = prefix + MODIFIER_SEPARATOR;
846
+ const parseClassNameOriginal = parseClassName;
847
+ parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
848
+ }
849
+ if (experimentalParseClassName) {
850
+ const parseClassNameOriginal = parseClassName;
851
+ parseClassName = (className) => experimentalParseClassName({
852
+ className,
853
+ parseClassName: parseClassNameOriginal
867
854
  });
868
- if (autoRun) {
869
- try {
870
- await adapter.send();
871
- } catch (e4) {
872
- console.log("Adapter failed to send.", e4);
873
- }
874
- }
875
- return adapter;
876
855
  }
877
- context = {
878
- values() {
879
- return collectValues();
880
- },
881
- submit() {
882
- const valid = validateInternal(true);
883
- const vals = collectValues();
884
- return { values: vals, valid };
885
- },
886
- getBind(id) {
887
- return registryRef.current.getByBind(id);
888
- },
889
- validate(report) {
890
- return validateInternal(report);
891
- },
892
- addField(field) {
893
- var _a2, _b2;
894
- const rawName = (_a2 = field.name) != null ? _a2 : "";
895
- field.name = rawName.trim();
896
- const { valueBag, valueFeed } = propsRef.current;
897
- const trimmed = ((_b2 = field.name) != null ? _b2 : "").trim();
898
- const hasName = !!trimmed;
899
- const isArray = hasName && trimmed.endsWith("[]");
900
- const base = hasName ? trimmed.replace(/\[]$/, "") : "";
901
- const sharedKey = field.shared;
902
- if (valueBag && !field.ignore && hasName) {
903
- const sourceRoot = sharedKey && valueBag[sharedKey] ? valueBag[sharedKey] : valueBag;
904
- let value = void 0;
905
- if (sourceRoot && typeof sourceRoot === "object") {
906
- if (isArray && Array.isArray(sourceRoot[base])) {
907
- const siblings = fetchAllNamedFields().filter((f2) => {
908
- var _a3;
909
- const rn = ((_a3 = f2.name) != null ? _a3 : "").trim();
910
- return rn === trimmed && f2.shared === sharedKey;
911
- });
912
- const idx = siblings.length;
913
- value = sourceRoot[base][idx];
914
- } else {
915
- value = sourceRoot[base];
916
- }
917
- }
918
- let hydrated = value;
919
- if (valueFeed) {
920
- const maybe = valueFeed(
921
- base,
922
- value,
923
- context
924
- );
925
- if (typeof maybe !== "undefined") {
926
- hydrated = maybe;
927
- }
928
- }
929
- if (typeof hydrated !== "undefined") {
930
- const anyField = field;
931
- if (typeof anyField.setValue === "function") {
932
- anyField.setValue(hydrated);
933
- } else {
934
- anyField.value = hydrated;
935
- }
856
+ return parseClassName;
857
+ };
858
+ var createSortModifiers = (config) => {
859
+ const modifierWeights = /* @__PURE__ */ new Map();
860
+ config.orderSensitiveModifiers.forEach((mod, index) => {
861
+ modifierWeights.set(mod, 1e6 + index);
862
+ });
863
+ return (modifiers) => {
864
+ const result = [];
865
+ let currentSegment = [];
866
+ for (let i3 = 0; i3 < modifiers.length; i3++) {
867
+ const modifier = modifiers[i3];
868
+ const isArbitrary = modifier[0] === "[";
869
+ const isOrderSensitive = modifierWeights.has(modifier);
870
+ if (isArbitrary || isOrderSensitive) {
871
+ if (currentSegment.length > 0) {
872
+ currentSegment.sort();
873
+ result.push(...currentSegment);
874
+ currentSegment = [];
936
875
  }
876
+ result.push(modifier);
877
+ } else {
878
+ currentSegment.push(modifier);
937
879
  }
938
- registryRef.current.add(field);
939
- },
940
- // Expose registry view as inputs (delegates to FieldRegistry instance)
941
- inputs: registryRef.current,
942
- // Also expose raw list of fields for compatibility is defined later as a getter
943
- bucket: bucketRef.current,
944
- error(nameOrBag, maybeMsg) {
945
- if (typeof nameOrBag === "string") {
946
- if (!maybeMsg) return;
947
- setFieldError(nameOrBag, maybeMsg);
948
- return;
949
- }
950
- const { fieldErrors, uncaught } = mapErrorBag(nameOrBag);
951
- for (const [name, message2] of Object.entries(fieldErrors)) {
952
- setFieldError(name, message2);
953
- }
954
- if (uncaught.length) {
955
- uncaughtRef.current.push(...uncaught);
880
+ }
881
+ if (currentSegment.length > 0) {
882
+ currentSegment.sort();
883
+ result.push(...currentSegment);
884
+ }
885
+ return result;
886
+ };
887
+ };
888
+ var createConfigUtils = (config) => ({
889
+ cache: createLruCache(config.cacheSize),
890
+ parseClassName: createParseClassName(config),
891
+ sortModifiers: createSortModifiers(config),
892
+ ...createClassGroupUtils(config)
893
+ });
894
+ var SPLIT_CLASSES_REGEX = /\s+/;
895
+ var mergeClassList = (classList, configUtils) => {
896
+ const {
897
+ parseClassName,
898
+ getClassGroupId,
899
+ getConflictingClassGroupIds,
900
+ sortModifiers
901
+ } = configUtils;
902
+ const classGroupsInConflict = [];
903
+ const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
904
+ let result = "";
905
+ for (let index = classNames.length - 1; index >= 0; index -= 1) {
906
+ const originalClassName = classNames[index];
907
+ const {
908
+ isExternal,
909
+ modifiers,
910
+ hasImportantModifier,
911
+ baseClassName,
912
+ maybePostfixModifierPosition
913
+ } = parseClassName(originalClassName);
914
+ if (isExternal) {
915
+ result = originalClassName + (result.length > 0 ? " " + result : result);
916
+ continue;
917
+ }
918
+ let hasPostfixModifier = !!maybePostfixModifierPosition;
919
+ let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
920
+ if (!classGroupId) {
921
+ if (!hasPostfixModifier) {
922
+ result = originalClassName + (result.length > 0 ? " " + result : result);
923
+ continue;
956
924
  }
957
- },
958
- controlButton() {
959
- const { activateButtonOnChange } = propsRef.current;
960
- if (!activateButtonOnChange) return;
961
- const btn = buttonRef.current;
962
- const activeName = activeButtonNameRef.current;
963
- if (!btn || btn.name !== activeName) {
964
- return;
925
+ classGroupId = getClassGroupId(baseClassName);
926
+ if (!classGroupId) {
927
+ result = originalClassName + (result.length > 0 ? " " + result : result);
928
+ continue;
965
929
  }
966
- if (!originalRef.current) {
967
- originalRef.current = collectValues();
930
+ hasPostfixModifier = false;
931
+ }
932
+ const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
933
+ const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
934
+ const classId = modifierId + classGroupId;
935
+ if (classGroupsInConflict.indexOf(classId) > -1) {
936
+ continue;
937
+ }
938
+ classGroupsInConflict.push(classId);
939
+ const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
940
+ for (let i3 = 0; i3 < conflictGroups.length; ++i3) {
941
+ const group = conflictGroups[i3];
942
+ classGroupsInConflict.push(modifierId + group);
943
+ }
944
+ result = originalClassName + (result.length > 0 ? " " + result : result);
945
+ }
946
+ return result;
947
+ };
948
+ var twJoin = (...classLists) => {
949
+ let index = 0;
950
+ let argument;
951
+ let resolvedValue;
952
+ let string = "";
953
+ while (index < classLists.length) {
954
+ if (argument = classLists[index++]) {
955
+ if (resolvedValue = toValue(argument)) {
956
+ string && (string += " ");
957
+ string += resolvedValue;
968
958
  }
969
- const current = collectValues();
970
- const original = originalRef.current;
971
- const dirty = !deepEqual(original, current);
972
- const setDisabled = (disabled) => {
973
- if (typeof btn.setDisabled === "function") {
974
- btn.setDisabled(disabled);
975
- } else if ("disabled" in btn) {
976
- btn.disabled = disabled;
977
- }
978
- };
979
- setDisabled(!dirty);
980
- },
981
- isDirty() {
982
- if (!originalRef.current) {
983
- originalRef.current = collectValues();
984
- }
985
- const current = collectValues();
986
- const original = originalRef.current;
987
- return !deepEqual(original, current);
988
- },
989
- async prepare(type, route, extra, ignoreForm, autoErr) {
990
- const override = {
991
- method: type,
992
- url: route
993
- };
994
- return submitWithAdapter(
995
- override,
996
- extra,
997
- ignoreForm,
998
- autoErr,
999
- false
1000
- );
1001
- },
1002
- persist(data, feed) {
1003
- var _a2, _b2;
1004
- const seen = {};
1005
- const root = data;
1006
- const useFeed = feed || (propsRef.current.valueFeed ? (name, value, original) => {
1007
- const vf = propsRef.current.valueFeed;
1008
- const maybe = vf(
1009
- name,
1010
- value,
1011
- context
1012
- );
1013
- return typeof maybe === "undefined" ? original : maybe;
1014
- } : void 0);
1015
- for (const field of fetchAllNamedFields()) {
1016
- const rawName = field.name;
1017
- if (!rawName) continue;
1018
- if (field.ignore) continue;
1019
- const trimmed = rawName.trim();
1020
- if (!trimmed) continue;
1021
- const isArray = trimmed.endsWith("[]");
1022
- const base = trimmed.replace(/\[]$/, "");
1023
- const sharedKey = field.shared;
1024
- const key = sharedKey ? `${sharedKey}.${base}` : base;
1025
- let value = void 0;
1026
- if (sharedKey) {
1027
- const group = root[sharedKey];
1028
- if (group && typeof group === "object") {
1029
- if (isArray && Array.isArray(group[base])) {
1030
- const idx = (_a2 = seen[key]) != null ? _a2 : 0;
1031
- value = group[base][idx];
1032
- seen[key] = idx + 1;
1033
- } else {
1034
- value = group[base];
1035
- }
1036
- }
1037
- } else {
1038
- if (isArray && Array.isArray(root[base])) {
1039
- const idx = (_b2 = seen[key]) != null ? _b2 : 0;
1040
- value = root[base][idx];
1041
- seen[key] = idx + 1;
1042
- } else {
1043
- value = root[base];
1044
- }
1045
- }
1046
- const anyField = field;
1047
- const original = typeof anyField.getValue === "function" ? anyField.getValue() : anyField.value;
1048
- let next = value;
1049
- if (useFeed) {
1050
- const maybe = useFeed(base, value, original);
1051
- if (typeof maybe === "undefined") {
1052
- continue;
1053
- }
1054
- next = maybe;
1055
- }
1056
- if (typeof anyField.setValue === "function") {
1057
- anyField.setValue(next);
1058
- } else {
1059
- anyField.value = next;
1060
- }
1061
- }
1062
- if (propsRef.current.onUpdate) {
1063
- propsRef.current.onUpdate(collectValues());
1064
- }
1065
- },
1066
- setValue(name, value) {
1067
- if (!name) return;
1068
- let sharedKey;
1069
- let base = name;
1070
- if (name.includes(".")) {
1071
- const [group, field] = name.split(".", 2);
1072
- sharedKey = group;
1073
- base = field;
1074
- }
1075
- const targetField = fetchAllNamedFields().find((f2) => {
1076
- var _a2;
1077
- const raw = ((_a2 = f2.name) != null ? _a2 : "").trim();
1078
- if (!raw) return false;
1079
- const isArray = raw.endsWith("[]");
1080
- const rawBase = raw.replace(/\[]$/, "");
1081
- const fShared = f2.shared;
1082
- const sameGroup = fShared === sharedKey;
1083
- const sameName = raw === name || rawBase === base || `${fShared}.${rawBase}` === name;
1084
- return (!sharedKey || sameGroup) && sameName && !isArray;
1085
- });
1086
- if (targetField) {
1087
- const anyField = targetField;
1088
- if (typeof anyField.setValue === "function") {
1089
- anyField.setValue(value);
1090
- } else {
1091
- anyField.value = value;
1092
- }
1093
- } else {
1094
- bucketRef.current[name] = value;
1095
- }
1096
- if (propsRef.current.onUpdate) {
1097
- propsRef.current.onUpdate(collectValues());
1098
- }
1099
- },
1100
- go(data, ignoreForm) {
1101
- void submitWithAdapter(void 0, data, ignoreForm, true, true);
1102
- },
1103
- reset(inputs) {
1104
- if (!inputs.length) return;
1105
- for (const field of fetchAllNamedFields()) {
1106
- const raw = field.name;
1107
- if (!raw) continue;
1108
- if (!inputs.includes(raw)) continue;
1109
- const anyField = field;
1110
- if (typeof anyField.reset === "function") {
1111
- anyField.reset();
1112
- } else if (typeof anyField.setValue === "function") {
1113
- anyField.setValue(void 0);
1114
- } else {
1115
- anyField.value = void 0;
1116
- }
1117
- }
1118
- },
1119
- set button(btn) {
1120
- buttonRef.current = btn;
1121
- },
1122
- async forceSubmit() {
1123
- await submitWithAdapter(void 0, void 0, false, true, true);
1124
- },
1125
- get fields() {
1126
- return fetchAllNamedFields();
1127
- },
1128
- get props() {
1129
- const { formRef, valueBag, ...rest } = propsRef.current;
1130
- return rest;
1131
- },
1132
- setActiveButton(name) {
1133
- activeButtonNameRef.current = name;
1134
- },
1135
- hasUncaughtErrors,
1136
- getUncaught() {
1137
- return uncaughtRef.current;
1138
- }
1139
- };
1140
- React68.useEffect(() => {
1141
- if (!props.formRef) return;
1142
- props.formRef.current = context;
1143
- return () => {
1144
- if (props.formRef) {
1145
- props.formRef.current = null;
1146
- }
1147
- };
1148
- }, [context]);
1149
- React68.useEffect(() => {
1150
- if (props.init) {
1151
- props.init(context);
1152
959
  }
1153
- }, []);
1154
- return /* @__PURE__ */ jsx(CoreContextReact.Provider, { value: context, children: props.children });
1155
- }
1156
- function useCoreContext() {
1157
- const ctx = useContext(CoreContextReact);
1158
- if (!ctx) {
1159
- throw new Error("useCoreContext must be used within a <CoreProvider>.");
1160
960
  }
1161
- return ctx;
1162
- }
1163
-
1164
- // src/core/hooks/use-core.ts
1165
- function useCore() {
1166
- return useCoreContext();
1167
- }
1168
-
1169
- // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
1170
- var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1171
- var toCamelCase = (string) => string.replace(
1172
- /^([A-Z])|[\s-_]+(\w)/g,
1173
- (match2, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
1174
- );
1175
- var toPascalCase = (string) => {
1176
- const camelCase = toCamelCase(string);
1177
- return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
961
+ return string;
1178
962
  };
1179
- var mergeClasses = (...classes) => classes.filter((className, index, array) => {
1180
- return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
1181
- }).join(" ").trim();
1182
- var hasA11yProp = (props) => {
1183
- for (const prop in props) {
1184
- if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
1185
- return true;
963
+ var toValue = (mix) => {
964
+ if (typeof mix === "string") {
965
+ return mix;
966
+ }
967
+ let resolvedValue;
968
+ let string = "";
969
+ for (let k2 = 0; k2 < mix.length; k2++) {
970
+ if (mix[k2]) {
971
+ if (resolvedValue = toValue(mix[k2])) {
972
+ string && (string += " ");
973
+ string += resolvedValue;
974
+ }
1186
975
  }
1187
976
  }
977
+ return string;
1188
978
  };
1189
-
1190
- // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
1191
- var defaultAttributes = {
1192
- xmlns: "http://www.w3.org/2000/svg",
1193
- width: 24,
1194
- height: 24,
1195
- viewBox: "0 0 24 24",
1196
- fill: "none",
1197
- stroke: "currentColor",
1198
- strokeWidth: 2,
1199
- strokeLinecap: "round",
1200
- strokeLinejoin: "round"
979
+ var createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
980
+ let configUtils;
981
+ let cacheGet;
982
+ let cacheSet;
983
+ let functionToCall;
984
+ const initTailwindMerge = (classList) => {
985
+ const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
986
+ configUtils = createConfigUtils(config);
987
+ cacheGet = configUtils.cache.get;
988
+ cacheSet = configUtils.cache.set;
989
+ functionToCall = tailwindMerge;
990
+ return tailwindMerge(classList);
991
+ };
992
+ const tailwindMerge = (classList) => {
993
+ const cachedResult = cacheGet(classList);
994
+ if (cachedResult) {
995
+ return cachedResult;
996
+ }
997
+ const result = mergeClassList(classList, configUtils);
998
+ cacheSet(classList, result);
999
+ return result;
1000
+ };
1001
+ functionToCall = initTailwindMerge;
1002
+ return (...args) => functionToCall(twJoin(...args));
1201
1003
  };
1202
-
1203
- // ../../node_modules/lucide-react/dist/esm/Icon.js
1204
- var Icon = forwardRef(
1205
- ({
1206
- color = "currentColor",
1207
- size = 24,
1208
- strokeWidth = 2,
1209
- absoluteStrokeWidth,
1210
- className = "",
1211
- children,
1212
- iconNode,
1213
- ...rest
1214
- }, ref) => createElement(
1215
- "svg",
1216
- {
1217
- ref,
1218
- ...defaultAttributes,
1219
- width: size,
1220
- height: size,
1221
- stroke: color,
1222
- strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
1223
- className: mergeClasses("lucide", className),
1224
- ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
1225
- ...rest
1226
- },
1227
- [
1228
- ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
1229
- ...Array.isArray(children) ? children : [children]
1230
- ]
1231
- )
1232
- );
1233
-
1234
- // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
1235
- var createLucideIcon = (iconName, iconNode) => {
1236
- const Component = forwardRef(
1237
- ({ className, ...props }, ref) => createElement(Icon, {
1238
- ref,
1239
- iconNode,
1240
- className: mergeClasses(
1241
- `lucide-${toKebabCase(toPascalCase(iconName))}`,
1242
- `lucide-${iconName}`,
1243
- className
1244
- ),
1245
- ...props
1246
- })
1247
- );
1248
- Component.displayName = toPascalCase(iconName);
1249
- return Component;
1004
+ var fallbackThemeArr = [];
1005
+ var fromTheme = (key) => {
1006
+ const themeGetter = (theme) => theme[key] || fallbackThemeArr;
1007
+ themeGetter.isThemeGetter = true;
1008
+ return themeGetter;
1250
1009
  };
1251
-
1252
- // ../../node_modules/lucide-react/dist/esm/icons/calendar.js
1253
- var __iconNode = [
1254
- ["path", { d: "M8 2v4", key: "1cmpym" }],
1255
- ["path", { d: "M16 2v4", key: "4m81vk" }],
1256
- ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
1257
- ["path", { d: "M3 10h18", key: "8toen8" }]
1258
- ];
1259
- var Calendar = createLucideIcon("calendar", __iconNode);
1260
-
1261
- // ../../node_modules/lucide-react/dist/esm/icons/check.js
1262
- var __iconNode2 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
1263
- var Check = createLucideIcon("check", __iconNode2);
1264
-
1265
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-down.js
1266
- var __iconNode3 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
1267
- var ChevronDown = createLucideIcon("chevron-down", __iconNode3);
1268
-
1269
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-left.js
1270
- var __iconNode4 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
1271
- var ChevronLeft = createLucideIcon("chevron-left", __iconNode4);
1272
-
1273
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
1274
- var __iconNode5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
1275
- var ChevronRight = createLucideIcon("chevron-right", __iconNode5);
1276
-
1277
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-up.js
1278
- var __iconNode6 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
1279
- var ChevronUp = createLucideIcon("chevron-up", __iconNode6);
1280
-
1281
- // ../../node_modules/lucide-react/dist/esm/icons/circle-alert.js
1282
- var __iconNode7 = [
1283
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1284
- ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
1285
- ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
1286
- ];
1287
- var CircleAlert = createLucideIcon("circle-alert", __iconNode7);
1288
-
1289
- // ../../node_modules/lucide-react/dist/esm/icons/circle-check.js
1290
- var __iconNode8 = [
1291
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1292
- ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
1293
- ];
1294
- var CircleCheck = createLucideIcon("circle-check", __iconNode8);
1295
-
1296
- // ../../node_modules/lucide-react/dist/esm/icons/circle.js
1297
- var __iconNode9 = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
1298
- var Circle = createLucideIcon("circle", __iconNode9);
1299
-
1300
- // ../../node_modules/lucide-react/dist/esm/icons/cloud-upload.js
1301
- var __iconNode10 = [
1302
- ["path", { d: "M12 13v8", key: "1l5pq0" }],
1303
- ["path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242", key: "1pljnt" }],
1304
- ["path", { d: "m8 17 4-4 4 4", key: "1quai1" }]
1305
- ];
1306
- var CloudUpload = createLucideIcon("cloud-upload", __iconNode10);
1307
-
1308
- // ../../node_modules/lucide-react/dist/esm/icons/code-xml.js
1309
- var __iconNode11 = [
1310
- ["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
1311
- ["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
1312
- ["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
1313
- ];
1314
- var CodeXml = createLucideIcon("code-xml", __iconNode11);
1315
-
1316
- // ../../node_modules/lucide-react/dist/esm/icons/ellipsis.js
1317
- var __iconNode12 = [
1318
- ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
1319
- ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
1320
- ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
1321
- ];
1322
- var Ellipsis = createLucideIcon("ellipsis", __iconNode12);
1323
-
1324
- // ../../node_modules/lucide-react/dist/esm/icons/eye-off.js
1325
- var __iconNode13 = [
1326
- [
1327
- "path",
1328
- {
1329
- d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
1330
- key: "ct8e1f"
1331
- }
1332
- ],
1333
- ["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242", key: "151rxh" }],
1334
- [
1335
- "path",
1336
- {
1337
- d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
1338
- key: "13bj9a"
1339
- }
1340
- ],
1341
- ["path", { d: "m2 2 20 20", key: "1ooewy" }]
1342
- ];
1343
- var EyeOff = createLucideIcon("eye-off", __iconNode13);
1344
-
1345
- // ../../node_modules/lucide-react/dist/esm/icons/eye.js
1346
- var __iconNode14 = [
1347
- [
1348
- "path",
1349
- {
1350
- d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
1351
- key: "1nclc0"
1352
- }
1353
- ],
1354
- ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
1355
- ];
1356
- var Eye = createLucideIcon("eye", __iconNode14);
1357
-
1358
- // ../../node_modules/lucide-react/dist/esm/icons/file.js
1359
- var __iconNode15 = [
1360
- [
1361
- "path",
1362
- {
1363
- d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
1364
- key: "1oefj6"
1365
- }
1366
- ],
1367
- ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
1368
- ];
1369
- var File2 = createLucideIcon("file", __iconNode15);
1370
-
1371
- // ../../node_modules/lucide-react/dist/esm/icons/folder-open.js
1372
- var __iconNode16 = [
1373
- [
1374
- "path",
1375
- {
1376
- d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
1377
- key: "usdka0"
1010
+ var arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
1011
+ var arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
1012
+ var fractionRegex = /^\d+\/\d+$/;
1013
+ var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
1014
+ var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
1015
+ var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
1016
+ var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
1017
+ var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
1018
+ var isFraction = (value) => fractionRegex.test(value);
1019
+ var isNumber = (value) => !!value && !Number.isNaN(Number(value));
1020
+ var isInteger = (value) => !!value && Number.isInteger(Number(value));
1021
+ var isPercent = (value) => value.endsWith("%") && isNumber(value.slice(0, -1));
1022
+ var isTshirtSize = (value) => tshirtUnitRegex.test(value);
1023
+ var isAny = () => true;
1024
+ var isLengthOnly = (value) => (
1025
+ // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
1026
+ // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
1027
+ // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
1028
+ lengthUnitRegex.test(value) && !colorFunctionRegex.test(value)
1029
+ );
1030
+ var isNever = () => false;
1031
+ var isShadow = (value) => shadowRegex.test(value);
1032
+ var isImage = (value) => imageRegex.test(value);
1033
+ var isAnyNonArbitrary = (value) => !isArbitraryValue(value) && !isArbitraryVariable(value);
1034
+ var isArbitrarySize = (value) => getIsArbitraryValue(value, isLabelSize, isNever);
1035
+ var isArbitraryValue = (value) => arbitraryValueRegex.test(value);
1036
+ var isArbitraryLength = (value) => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
1037
+ var isArbitraryNumber = (value) => getIsArbitraryValue(value, isLabelNumber, isNumber);
1038
+ var isArbitraryPosition = (value) => getIsArbitraryValue(value, isLabelPosition, isNever);
1039
+ var isArbitraryImage = (value) => getIsArbitraryValue(value, isLabelImage, isImage);
1040
+ var isArbitraryShadow = (value) => getIsArbitraryValue(value, isLabelShadow, isShadow);
1041
+ var isArbitraryVariable = (value) => arbitraryVariableRegex.test(value);
1042
+ var isArbitraryVariableLength = (value) => getIsArbitraryVariable(value, isLabelLength);
1043
+ var isArbitraryVariableFamilyName = (value) => getIsArbitraryVariable(value, isLabelFamilyName);
1044
+ var isArbitraryVariablePosition = (value) => getIsArbitraryVariable(value, isLabelPosition);
1045
+ var isArbitraryVariableSize = (value) => getIsArbitraryVariable(value, isLabelSize);
1046
+ var isArbitraryVariableImage = (value) => getIsArbitraryVariable(value, isLabelImage);
1047
+ var isArbitraryVariableShadow = (value) => getIsArbitraryVariable(value, isLabelShadow, true);
1048
+ var getIsArbitraryValue = (value, testLabel, testValue) => {
1049
+ const result = arbitraryValueRegex.exec(value);
1050
+ if (result) {
1051
+ if (result[1]) {
1052
+ return testLabel(result[1]);
1378
1053
  }
1379
- ]
1380
- ];
1381
- var FolderOpen = createLucideIcon("folder-open", __iconNode16);
1382
-
1383
- // ../../node_modules/lucide-react/dist/esm/icons/folder-up.js
1384
- var __iconNode17 = [
1385
- [
1386
- "path",
1387
- {
1388
- d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
1389
- key: "1kt360"
1390
- }
1391
- ],
1392
- ["path", { d: "M12 10v6", key: "1bos4e" }],
1393
- ["path", { d: "m9 13 3-3 3 3", key: "1pxg3c" }]
1394
- ];
1395
- var FolderUp = createLucideIcon("folder-up", __iconNode17);
1396
-
1397
- // ../../node_modules/lucide-react/dist/esm/icons/folder.js
1398
- var __iconNode18 = [
1399
- [
1400
- "path",
1401
- {
1402
- d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
1403
- key: "1kt360"
1404
- }
1405
- ]
1406
- ];
1407
- var Folder = createLucideIcon("folder", __iconNode18);
1408
-
1409
- // ../../node_modules/lucide-react/dist/esm/icons/funnel.js
1410
- var __iconNode19 = [
1411
- [
1412
- "path",
1413
- {
1414
- d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
1415
- key: "sc7q7i"
1416
- }
1417
- ]
1418
- ];
1419
- var Funnel = createLucideIcon("funnel", __iconNode19);
1420
-
1421
- // ../../node_modules/lucide-react/dist/esm/icons/globe.js
1422
- var __iconNode20 = [
1423
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
1424
- ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
1425
- ["path", { d: "M2 12h20", key: "9i4pu4" }]
1426
- ];
1427
- var Globe = createLucideIcon("globe", __iconNode20);
1428
-
1429
- // ../../node_modules/lucide-react/dist/esm/icons/loader-circle.js
1430
- var __iconNode21 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
1431
- var LoaderCircle = createLucideIcon("loader-circle", __iconNode21);
1432
-
1433
- // ../../node_modules/lucide-react/dist/esm/icons/map-pin.js
1434
- var __iconNode22 = [
1435
- [
1436
- "path",
1437
- {
1438
- d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",
1439
- key: "1r0f0z"
1440
- }
1441
- ],
1442
- ["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }]
1443
- ];
1444
- var MapPin = createLucideIcon("map-pin", __iconNode22);
1445
-
1446
- // ../../node_modules/lucide-react/dist/esm/icons/minus.js
1447
- var __iconNode23 = [["path", { d: "M5 12h14", key: "1ays0h" }]];
1448
- var Minus = createLucideIcon("minus", __iconNode23);
1449
-
1450
- // ../../node_modules/lucide-react/dist/esm/icons/palette.js
1451
- var __iconNode24 = [
1452
- [
1453
- "path",
1454
- {
1455
- d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
1456
- key: "e79jfc"
1457
- }
1458
- ],
1459
- ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
1460
- ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
1461
- ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
1462
- ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
1463
- ];
1464
- var Palette = createLucideIcon("palette", __iconNode24);
1465
-
1466
- // ../../node_modules/lucide-react/dist/esm/icons/pen-line.js
1467
- var __iconNode25 = [
1468
- ["path", { d: "M13 21h8", key: "1jsn5i" }],
1469
- [
1470
- "path",
1471
- {
1472
- d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
1473
- key: "1a8usu"
1474
- }
1475
- ]
1476
- ];
1477
- var PenLine = createLucideIcon("pen-line", __iconNode25);
1478
-
1479
- // ../../node_modules/lucide-react/dist/esm/icons/plus.js
1480
- var __iconNode26 = [
1481
- ["path", { d: "M5 12h14", key: "1ays0h" }],
1482
- ["path", { d: "M12 5v14", key: "s699le" }]
1483
- ];
1484
- var Plus = createLucideIcon("plus", __iconNode26);
1485
-
1486
- // ../../node_modules/lucide-react/dist/esm/icons/search.js
1487
- var __iconNode27 = [
1488
- ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
1489
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
1490
- ];
1491
- var Search = createLucideIcon("search", __iconNode27);
1492
-
1493
- // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
1494
- var __iconNode28 = [
1495
- ["path", { d: "M10 5H3", key: "1qgfaw" }],
1496
- ["path", { d: "M12 19H3", key: "yhmn1j" }],
1497
- ["path", { d: "M14 3v4", key: "1sua03" }],
1498
- ["path", { d: "M16 17v4", key: "1q0r14" }],
1499
- ["path", { d: "M21 12h-9", key: "1o4lsq" }],
1500
- ["path", { d: "M21 19h-5", key: "1rlt1p" }],
1501
- ["path", { d: "M21 5h-7", key: "1oszz2" }],
1502
- ["path", { d: "M8 10v4", key: "tgpxqk" }],
1503
- ["path", { d: "M8 12H3", key: "a7s4jb" }]
1504
- ];
1505
- var SlidersHorizontal = createLucideIcon("sliders-horizontal", __iconNode28);
1506
-
1507
- // ../../node_modules/lucide-react/dist/esm/icons/square-split-vertical.js
1508
- var __iconNode29 = [
1509
- ["path", { d: "M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3", key: "1pi83i" }],
1510
- ["path", { d: "M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3", key: "ido5k7" }],
1511
- ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
1512
- ];
1513
- var SquareSplitVertical = createLucideIcon("square-split-vertical", __iconNode29);
1514
-
1515
- // ../../node_modules/lucide-react/dist/esm/icons/tag.js
1516
- var __iconNode30 = [
1517
- [
1518
- "path",
1519
- {
1520
- d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",
1521
- key: "vktsd0"
1522
- }
1523
- ],
1524
- ["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }]
1525
- ];
1526
- var Tag = createLucideIcon("tag", __iconNode30);
1527
-
1528
- // ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
1529
- var __iconNode31 = [
1530
- ["path", { d: "M10 11v6", key: "nco0om" }],
1531
- ["path", { d: "M14 11v6", key: "outv1u" }],
1532
- ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
1533
- ["path", { d: "M3 6h18", key: "d0wm0j" }],
1534
- ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
1535
- ];
1536
- var Trash2 = createLucideIcon("trash-2", __iconNode31);
1537
-
1538
- // ../../node_modules/lucide-react/dist/esm/icons/upload.js
1539
- var __iconNode32 = [
1540
- ["path", { d: "M12 3v12", key: "1x0j5s" }],
1541
- ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
1542
- ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
1543
- ];
1544
- var Upload = createLucideIcon("upload", __iconNode32);
1545
-
1546
- // ../../node_modules/lucide-react/dist/esm/icons/x.js
1547
- var __iconNode33 = [
1548
- ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1549
- ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1550
- ];
1551
- var X = createLucideIcon("x", __iconNode33);
1552
-
1553
- // ../../node_modules/clsx/dist/clsx.mjs
1554
- function r(e4) {
1555
- var t4, f2, n3 = "";
1556
- if ("string" == typeof e4 || "number" == typeof e4) n3 += e4;
1557
- else if ("object" == typeof e4) if (Array.isArray(e4)) {
1558
- var o3 = e4.length;
1559
- for (t4 = 0; t4 < o3; t4++) e4[t4] && (f2 = r(e4[t4])) && (n3 && (n3 += " "), n3 += f2);
1560
- } else for (f2 in e4) e4[f2] && (n3 && (n3 += " "), n3 += f2);
1561
- return n3;
1562
- }
1563
- function clsx() {
1564
- for (var e4, t4, f2 = 0, n3 = "", o3 = arguments.length; f2 < o3; f2++) (e4 = arguments[f2]) && (t4 = r(e4)) && (n3 && (n3 += " "), n3 += t4);
1565
- return n3;
1566
- }
1567
-
1568
- // ../../node_modules/tailwind-merge/dist/bundle-mjs.mjs
1569
- var concatArrays = (array1, array2) => {
1570
- const combinedArray = new Array(array1.length + array2.length);
1571
- for (let i3 = 0; i3 < array1.length; i3++) {
1572
- combinedArray[i3] = array1[i3];
1573
- }
1574
- for (let i3 = 0; i3 < array2.length; i3++) {
1575
- combinedArray[array1.length + i3] = array2[i3];
1576
- }
1577
- return combinedArray;
1578
- };
1579
- var createClassValidatorObject = (classGroupId, validator) => ({
1580
- classGroupId,
1581
- validator
1582
- });
1583
- var createClassPartObject = (nextPart = /* @__PURE__ */ new Map(), validators = null, classGroupId) => ({
1584
- nextPart,
1585
- validators,
1586
- classGroupId
1587
- });
1588
- var CLASS_PART_SEPARATOR = "-";
1589
- var EMPTY_CONFLICTS = [];
1590
- var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
1591
- var createClassGroupUtils = (config) => {
1592
- const classMap = createClassMap(config);
1593
- const {
1594
- conflictingClassGroups,
1595
- conflictingClassGroupModifiers
1596
- } = config;
1597
- const getClassGroupId = (className) => {
1598
- if (className.startsWith("[") && className.endsWith("]")) {
1599
- return getGroupIdForArbitraryProperty(className);
1600
- }
1601
- const classParts = className.split(CLASS_PART_SEPARATOR);
1602
- const startIndex = classParts[0] === "" && classParts.length > 1 ? 1 : 0;
1603
- return getGroupRecursive(classParts, startIndex, classMap);
1604
- };
1605
- const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
1606
- if (hasPostfixModifier) {
1607
- const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
1608
- const baseConflicts = conflictingClassGroups[classGroupId];
1609
- if (modifierConflicts) {
1610
- if (baseConflicts) {
1611
- return concatArrays(baseConflicts, modifierConflicts);
1612
- }
1613
- return modifierConflicts;
1614
- }
1615
- return baseConflicts || EMPTY_CONFLICTS;
1616
- }
1617
- return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
1618
- };
1619
- return {
1620
- getClassGroupId,
1621
- getConflictingClassGroupIds
1622
- };
1623
- };
1624
- var getGroupRecursive = (classParts, startIndex, classPartObject) => {
1625
- const classPathsLength = classParts.length - startIndex;
1626
- if (classPathsLength === 0) {
1627
- return classPartObject.classGroupId;
1628
- }
1629
- const currentClassPart = classParts[startIndex];
1630
- const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
1631
- if (nextClassPartObject) {
1632
- const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
1633
- if (result) return result;
1634
- }
1635
- const validators = classPartObject.validators;
1636
- if (validators === null) {
1637
- return void 0;
1638
- }
1639
- const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
1640
- const validatorsLength = validators.length;
1641
- for (let i3 = 0; i3 < validatorsLength; i3++) {
1642
- const validatorObj = validators[i3];
1643
- if (validatorObj.validator(classRest)) {
1644
- return validatorObj.classGroupId;
1054
+ return testValue(result[2]);
1055
+ }
1056
+ return false;
1057
+ };
1058
+ var getIsArbitraryVariable = (value, testLabel, shouldMatchNoLabel = false) => {
1059
+ const result = arbitraryVariableRegex.exec(value);
1060
+ if (result) {
1061
+ if (result[1]) {
1062
+ return testLabel(result[1]);
1645
1063
  }
1064
+ return shouldMatchNoLabel;
1646
1065
  }
1647
- return void 0;
1066
+ return false;
1648
1067
  };
1649
- var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
1650
- const content = className.slice(1, -1);
1651
- const colonIndex = content.indexOf(":");
1652
- const property = content.slice(0, colonIndex);
1653
- return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
1654
- })();
1655
- var createClassMap = (config) => {
1656
- const {
1657
- theme,
1658
- classGroups
1659
- } = config;
1660
- return processClassGroups(classGroups, theme);
1661
- };
1662
- var processClassGroups = (classGroups, theme) => {
1663
- const classMap = createClassPartObject();
1664
- for (const classGroupId in classGroups) {
1665
- const group = classGroups[classGroupId];
1666
- processClassesRecursively(group, classMap, classGroupId, theme);
1667
- }
1668
- return classMap;
1669
- };
1670
- var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
1671
- const len = classGroup.length;
1672
- for (let i3 = 0; i3 < len; i3++) {
1673
- const classDefinition = classGroup[i3];
1674
- processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
1675
- }
1676
- };
1677
- var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
1678
- if (typeof classDefinition === "string") {
1679
- processStringDefinition(classDefinition, classPartObject, classGroupId);
1680
- return;
1681
- }
1682
- if (typeof classDefinition === "function") {
1683
- processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
1684
- return;
1685
- }
1686
- processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
1687
- };
1688
- var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
1689
- const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
1690
- classPartObjectToEdit.classGroupId = classGroupId;
1691
- };
1692
- var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
1693
- if (isThemeGetter(classDefinition)) {
1694
- processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
1695
- return;
1696
- }
1697
- if (classPartObject.validators === null) {
1698
- classPartObject.validators = [];
1699
- }
1700
- classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
1701
- };
1702
- var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
1703
- const entries = Object.entries(classDefinition);
1704
- const len = entries.length;
1705
- for (let i3 = 0; i3 < len; i3++) {
1706
- const [key, value] = entries[i3];
1707
- processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
1708
- }
1709
- };
1710
- var getPart = (classPartObject, path) => {
1711
- let current = classPartObject;
1712
- const parts = path.split(CLASS_PART_SEPARATOR);
1713
- const len = parts.length;
1714
- for (let i3 = 0; i3 < len; i3++) {
1715
- const part = parts[i3];
1716
- let next = current.nextPart.get(part);
1717
- if (!next) {
1718
- next = createClassPartObject();
1719
- current.nextPart.set(part, next);
1720
- }
1721
- current = next;
1722
- }
1723
- return current;
1724
- };
1725
- var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
1726
- var createLruCache = (maxCacheSize) => {
1727
- if (maxCacheSize < 1) {
1728
- return {
1729
- get: () => void 0,
1730
- set: () => {
1731
- }
1732
- };
1733
- }
1734
- let cacheSize = 0;
1735
- let cache = /* @__PURE__ */ Object.create(null);
1736
- let previousCache = /* @__PURE__ */ Object.create(null);
1737
- const update = (key, value) => {
1738
- cache[key] = value;
1739
- cacheSize++;
1740
- if (cacheSize > maxCacheSize) {
1741
- cacheSize = 0;
1742
- previousCache = cache;
1743
- cache = /* @__PURE__ */ Object.create(null);
1744
- }
1745
- };
1068
+ var isLabelPosition = (label) => label === "position" || label === "percentage";
1069
+ var isLabelImage = (label) => label === "image" || label === "url";
1070
+ var isLabelSize = (label) => label === "length" || label === "size" || label === "bg-size";
1071
+ var isLabelLength = (label) => label === "length";
1072
+ var isLabelNumber = (label) => label === "number";
1073
+ var isLabelFamilyName = (label) => label === "family-name";
1074
+ var isLabelShadow = (label) => label === "shadow";
1075
+ var getDefaultConfig = () => {
1076
+ const themeColor = fromTheme("color");
1077
+ const themeFont = fromTheme("font");
1078
+ const themeText = fromTheme("text");
1079
+ const themeFontWeight = fromTheme("font-weight");
1080
+ const themeTracking = fromTheme("tracking");
1081
+ const themeLeading = fromTheme("leading");
1082
+ const themeBreakpoint = fromTheme("breakpoint");
1083
+ const themeContainer = fromTheme("container");
1084
+ const themeSpacing = fromTheme("spacing");
1085
+ const themeRadius = fromTheme("radius");
1086
+ const themeShadow = fromTheme("shadow");
1087
+ const themeInsetShadow = fromTheme("inset-shadow");
1088
+ const themeTextShadow = fromTheme("text-shadow");
1089
+ const themeDropShadow = fromTheme("drop-shadow");
1090
+ const themeBlur = fromTheme("blur");
1091
+ const themePerspective = fromTheme("perspective");
1092
+ const themeAspect = fromTheme("aspect");
1093
+ const themeEase = fromTheme("ease");
1094
+ const themeAnimate = fromTheme("animate");
1095
+ const scaleBreak = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"];
1096
+ const scalePosition = () => [
1097
+ "center",
1098
+ "top",
1099
+ "bottom",
1100
+ "left",
1101
+ "right",
1102
+ "top-left",
1103
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
1104
+ "left-top",
1105
+ "top-right",
1106
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
1107
+ "right-top",
1108
+ "bottom-right",
1109
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
1110
+ "right-bottom",
1111
+ "bottom-left",
1112
+ // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
1113
+ "left-bottom"
1114
+ ];
1115
+ const scalePositionWithArbitrary = () => [...scalePosition(), isArbitraryVariable, isArbitraryValue];
1116
+ const scaleOverflow = () => ["auto", "hidden", "clip", "visible", "scroll"];
1117
+ const scaleOverscroll = () => ["auto", "contain", "none"];
1118
+ const scaleUnambiguousSpacing = () => [isArbitraryVariable, isArbitraryValue, themeSpacing];
1119
+ const scaleInset = () => [isFraction, "full", "auto", ...scaleUnambiguousSpacing()];
1120
+ const scaleGridTemplateColsRows = () => [isInteger, "none", "subgrid", isArbitraryVariable, isArbitraryValue];
1121
+ const scaleGridColRowStartAndEnd = () => ["auto", {
1122
+ span: ["full", isInteger, isArbitraryVariable, isArbitraryValue]
1123
+ }, isInteger, isArbitraryVariable, isArbitraryValue];
1124
+ const scaleGridColRowStartOrEnd = () => [isInteger, "auto", isArbitraryVariable, isArbitraryValue];
1125
+ const scaleGridAutoColsRows = () => ["auto", "min", "max", "fr", isArbitraryVariable, isArbitraryValue];
1126
+ const scaleAlignPrimaryAxis = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"];
1127
+ const scaleAlignSecondaryAxis = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"];
1128
+ const scaleMargin = () => ["auto", ...scaleUnambiguousSpacing()];
1129
+ const scaleSizing = () => [isFraction, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...scaleUnambiguousSpacing()];
1130
+ const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue];
1131
+ const scaleBgPosition = () => [...scalePosition(), isArbitraryVariablePosition, isArbitraryPosition, {
1132
+ position: [isArbitraryVariable, isArbitraryValue]
1133
+ }];
1134
+ const scaleBgRepeat = () => ["no-repeat", {
1135
+ repeat: ["", "x", "y", "space", "round"]
1136
+ }];
1137
+ const scaleBgSize = () => ["auto", "cover", "contain", isArbitraryVariableSize, isArbitrarySize, {
1138
+ size: [isArbitraryVariable, isArbitraryValue]
1139
+ }];
1140
+ const scaleGradientStopPosition = () => [isPercent, isArbitraryVariableLength, isArbitraryLength];
1141
+ const scaleRadius = () => [
1142
+ // Deprecated since Tailwind CSS v4.0.0
1143
+ "",
1144
+ "none",
1145
+ "full",
1146
+ themeRadius,
1147
+ isArbitraryVariable,
1148
+ isArbitraryValue
1149
+ ];
1150
+ const scaleBorderWidth = () => ["", isNumber, isArbitraryVariableLength, isArbitraryLength];
1151
+ const scaleLineStyle = () => ["solid", "dashed", "dotted", "double"];
1152
+ const scaleBlendMode = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
1153
+ const scaleMaskImagePosition = () => [isNumber, isPercent, isArbitraryVariablePosition, isArbitraryPosition];
1154
+ const scaleBlur = () => [
1155
+ // Deprecated since Tailwind CSS v4.0.0
1156
+ "",
1157
+ "none",
1158
+ themeBlur,
1159
+ isArbitraryVariable,
1160
+ isArbitraryValue
1161
+ ];
1162
+ const scaleRotate = () => ["none", isNumber, isArbitraryVariable, isArbitraryValue];
1163
+ const scaleScale = () => ["none", isNumber, isArbitraryVariable, isArbitraryValue];
1164
+ const scaleSkew = () => [isNumber, isArbitraryVariable, isArbitraryValue];
1165
+ const scaleTranslate = () => [isFraction, "full", ...scaleUnambiguousSpacing()];
1746
1166
  return {
1747
- get(key) {
1748
- let value = cache[key];
1749
- if (value !== void 0) {
1750
- return value;
1751
- }
1752
- if ((value = previousCache[key]) !== void 0) {
1753
- update(key, value);
1754
- return value;
1755
- }
1167
+ cacheSize: 500,
1168
+ theme: {
1169
+ animate: ["spin", "ping", "pulse", "bounce"],
1170
+ aspect: ["video"],
1171
+ blur: [isTshirtSize],
1172
+ breakpoint: [isTshirtSize],
1173
+ color: [isAny],
1174
+ container: [isTshirtSize],
1175
+ "drop-shadow": [isTshirtSize],
1176
+ ease: ["in", "out", "in-out"],
1177
+ font: [isAnyNonArbitrary],
1178
+ "font-weight": ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black"],
1179
+ "inset-shadow": [isTshirtSize],
1180
+ leading: ["none", "tight", "snug", "normal", "relaxed", "loose"],
1181
+ perspective: ["dramatic", "near", "normal", "midrange", "distant", "none"],
1182
+ radius: [isTshirtSize],
1183
+ shadow: [isTshirtSize],
1184
+ spacing: ["px", isNumber],
1185
+ text: [isTshirtSize],
1186
+ "text-shadow": [isTshirtSize],
1187
+ tracking: ["tighter", "tight", "normal", "wide", "wider", "widest"]
1756
1188
  },
1757
- set(key, value) {
1758
- if (key in cache) {
1759
- cache[key] = value;
1760
- } else {
1761
- update(key, value);
1762
- }
1763
- }
1764
- };
1765
- };
1766
- var IMPORTANT_MODIFIER = "!";
1767
- var MODIFIER_SEPARATOR = ":";
1768
- var EMPTY_MODIFIERS = [];
1769
- var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
1770
- modifiers,
1771
- hasImportantModifier,
1772
- baseClassName,
1773
- maybePostfixModifierPosition,
1774
- isExternal
1775
- });
1776
- var createParseClassName = (config) => {
1777
- const {
1778
- prefix,
1779
- experimentalParseClassName
1780
- } = config;
1781
- let parseClassName = (className) => {
1782
- const modifiers = [];
1783
- let bracketDepth = 0;
1784
- let parenDepth = 0;
1785
- let modifierStart = 0;
1786
- let postfixModifierPosition;
1787
- const len = className.length;
1788
- for (let index = 0; index < len; index++) {
1789
- const currentCharacter = className[index];
1790
- if (bracketDepth === 0 && parenDepth === 0) {
1791
- if (currentCharacter === MODIFIER_SEPARATOR) {
1792
- modifiers.push(className.slice(modifierStart, index));
1793
- modifierStart = index + 1;
1794
- continue;
1795
- }
1796
- if (currentCharacter === "/") {
1797
- postfixModifierPosition = index;
1798
- continue;
1799
- }
1800
- }
1801
- if (currentCharacter === "[") bracketDepth++;
1802
- else if (currentCharacter === "]") bracketDepth--;
1803
- else if (currentCharacter === "(") parenDepth++;
1804
- else if (currentCharacter === ")") parenDepth--;
1805
- }
1806
- const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
1807
- let baseClassName = baseClassNameWithImportantModifier;
1808
- let hasImportantModifier = false;
1809
- if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
1810
- baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
1811
- hasImportantModifier = true;
1812
- } else if (
1189
+ classGroups: {
1190
+ // --------------
1191
+ // --- Layout ---
1192
+ // --------------
1813
1193
  /**
1814
- * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
1815
- * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
1816
- */
1817
- baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)
1818
- ) {
1819
- baseClassName = baseClassNameWithImportantModifier.slice(1);
1820
- hasImportantModifier = true;
1821
- }
1822
- const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
1823
- return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
1824
- };
1825
- if (prefix) {
1826
- const fullPrefix = prefix + MODIFIER_SEPARATOR;
1827
- const parseClassNameOriginal = parseClassName;
1828
- parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
1829
- }
1830
- if (experimentalParseClassName) {
1831
- const parseClassNameOriginal = parseClassName;
1832
- parseClassName = (className) => experimentalParseClassName({
1833
- className,
1834
- parseClassName: parseClassNameOriginal
1835
- });
1836
- }
1837
- return parseClassName;
1838
- };
1839
- var createSortModifiers = (config) => {
1840
- const modifierWeights = /* @__PURE__ */ new Map();
1841
- config.orderSensitiveModifiers.forEach((mod, index) => {
1842
- modifierWeights.set(mod, 1e6 + index);
1843
- });
1844
- return (modifiers) => {
1845
- const result = [];
1846
- let currentSegment = [];
1847
- for (let i3 = 0; i3 < modifiers.length; i3++) {
1848
- const modifier = modifiers[i3];
1849
- const isArbitrary = modifier[0] === "[";
1850
- const isOrderSensitive = modifierWeights.has(modifier);
1851
- if (isArbitrary || isOrderSensitive) {
1852
- if (currentSegment.length > 0) {
1853
- currentSegment.sort();
1854
- result.push(...currentSegment);
1855
- currentSegment = [];
1856
- }
1857
- result.push(modifier);
1858
- } else {
1859
- currentSegment.push(modifier);
1860
- }
1861
- }
1862
- if (currentSegment.length > 0) {
1863
- currentSegment.sort();
1864
- result.push(...currentSegment);
1865
- }
1866
- return result;
1867
- };
1868
- };
1869
- var createConfigUtils = (config) => ({
1870
- cache: createLruCache(config.cacheSize),
1871
- parseClassName: createParseClassName(config),
1872
- sortModifiers: createSortModifiers(config),
1873
- ...createClassGroupUtils(config)
1874
- });
1875
- var SPLIT_CLASSES_REGEX = /\s+/;
1876
- var mergeClassList = (classList, configUtils) => {
1877
- const {
1878
- parseClassName,
1879
- getClassGroupId,
1880
- getConflictingClassGroupIds,
1881
- sortModifiers
1882
- } = configUtils;
1883
- const classGroupsInConflict = [];
1884
- const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
1885
- let result = "";
1886
- for (let index = classNames.length - 1; index >= 0; index -= 1) {
1887
- const originalClassName = classNames[index];
1888
- const {
1889
- isExternal,
1890
- modifiers,
1891
- hasImportantModifier,
1892
- baseClassName,
1893
- maybePostfixModifierPosition
1894
- } = parseClassName(originalClassName);
1895
- if (isExternal) {
1896
- result = originalClassName + (result.length > 0 ? " " + result : result);
1897
- continue;
1898
- }
1899
- let hasPostfixModifier = !!maybePostfixModifierPosition;
1900
- let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
1901
- if (!classGroupId) {
1902
- if (!hasPostfixModifier) {
1903
- result = originalClassName + (result.length > 0 ? " " + result : result);
1904
- continue;
1905
- }
1906
- classGroupId = getClassGroupId(baseClassName);
1907
- if (!classGroupId) {
1908
- result = originalClassName + (result.length > 0 ? " " + result : result);
1909
- continue;
1910
- }
1911
- hasPostfixModifier = false;
1912
- }
1913
- const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
1914
- const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
1915
- const classId = modifierId + classGroupId;
1916
- if (classGroupsInConflict.indexOf(classId) > -1) {
1917
- continue;
1918
- }
1919
- classGroupsInConflict.push(classId);
1920
- const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
1921
- for (let i3 = 0; i3 < conflictGroups.length; ++i3) {
1922
- const group = conflictGroups[i3];
1923
- classGroupsInConflict.push(modifierId + group);
1924
- }
1925
- result = originalClassName + (result.length > 0 ? " " + result : result);
1926
- }
1927
- return result;
1928
- };
1929
- var twJoin = (...classLists) => {
1930
- let index = 0;
1931
- let argument;
1932
- let resolvedValue;
1933
- let string = "";
1934
- while (index < classLists.length) {
1935
- if (argument = classLists[index++]) {
1936
- if (resolvedValue = toValue(argument)) {
1937
- string && (string += " ");
1938
- string += resolvedValue;
1939
- }
1940
- }
1941
- }
1942
- return string;
1943
- };
1944
- var toValue = (mix) => {
1945
- if (typeof mix === "string") {
1946
- return mix;
1947
- }
1948
- let resolvedValue;
1949
- let string = "";
1950
- for (let k2 = 0; k2 < mix.length; k2++) {
1951
- if (mix[k2]) {
1952
- if (resolvedValue = toValue(mix[k2])) {
1953
- string && (string += " ");
1954
- string += resolvedValue;
1955
- }
1956
- }
1957
- }
1958
- return string;
1959
- };
1960
- var createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
1961
- let configUtils;
1962
- let cacheGet;
1963
- let cacheSet;
1964
- let functionToCall;
1965
- const initTailwindMerge = (classList) => {
1966
- const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
1967
- configUtils = createConfigUtils(config);
1968
- cacheGet = configUtils.cache.get;
1969
- cacheSet = configUtils.cache.set;
1970
- functionToCall = tailwindMerge;
1971
- return tailwindMerge(classList);
1972
- };
1973
- const tailwindMerge = (classList) => {
1974
- const cachedResult = cacheGet(classList);
1975
- if (cachedResult) {
1976
- return cachedResult;
1977
- }
1978
- const result = mergeClassList(classList, configUtils);
1979
- cacheSet(classList, result);
1980
- return result;
1981
- };
1982
- functionToCall = initTailwindMerge;
1983
- return (...args) => functionToCall(twJoin(...args));
1984
- };
1985
- var fallbackThemeArr = [];
1986
- var fromTheme = (key) => {
1987
- const themeGetter = (theme) => theme[key] || fallbackThemeArr;
1988
- themeGetter.isThemeGetter = true;
1989
- return themeGetter;
1990
- };
1991
- var arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
1992
- var arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
1993
- var fractionRegex = /^\d+\/\d+$/;
1994
- var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
1995
- var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
1996
- var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
1997
- var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
1998
- var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
1999
- var isFraction = (value) => fractionRegex.test(value);
2000
- var isNumber = (value) => !!value && !Number.isNaN(Number(value));
2001
- var isInteger = (value) => !!value && Number.isInteger(Number(value));
2002
- var isPercent = (value) => value.endsWith("%") && isNumber(value.slice(0, -1));
2003
- var isTshirtSize = (value) => tshirtUnitRegex.test(value);
2004
- var isAny = () => true;
2005
- var isLengthOnly = (value) => (
2006
- // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
2007
- // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
2008
- // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
2009
- lengthUnitRegex.test(value) && !colorFunctionRegex.test(value)
2010
- );
2011
- var isNever = () => false;
2012
- var isShadow = (value) => shadowRegex.test(value);
2013
- var isImage = (value) => imageRegex.test(value);
2014
- var isAnyNonArbitrary = (value) => !isArbitraryValue(value) && !isArbitraryVariable(value);
2015
- var isArbitrarySize = (value) => getIsArbitraryValue(value, isLabelSize, isNever);
2016
- var isArbitraryValue = (value) => arbitraryValueRegex.test(value);
2017
- var isArbitraryLength = (value) => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
2018
- var isArbitraryNumber = (value) => getIsArbitraryValue(value, isLabelNumber, isNumber);
2019
- var isArbitraryPosition = (value) => getIsArbitraryValue(value, isLabelPosition, isNever);
2020
- var isArbitraryImage = (value) => getIsArbitraryValue(value, isLabelImage, isImage);
2021
- var isArbitraryShadow = (value) => getIsArbitraryValue(value, isLabelShadow, isShadow);
2022
- var isArbitraryVariable = (value) => arbitraryVariableRegex.test(value);
2023
- var isArbitraryVariableLength = (value) => getIsArbitraryVariable(value, isLabelLength);
2024
- var isArbitraryVariableFamilyName = (value) => getIsArbitraryVariable(value, isLabelFamilyName);
2025
- var isArbitraryVariablePosition = (value) => getIsArbitraryVariable(value, isLabelPosition);
2026
- var isArbitraryVariableSize = (value) => getIsArbitraryVariable(value, isLabelSize);
2027
- var isArbitraryVariableImage = (value) => getIsArbitraryVariable(value, isLabelImage);
2028
- var isArbitraryVariableShadow = (value) => getIsArbitraryVariable(value, isLabelShadow, true);
2029
- var getIsArbitraryValue = (value, testLabel, testValue) => {
2030
- const result = arbitraryValueRegex.exec(value);
2031
- if (result) {
2032
- if (result[1]) {
2033
- return testLabel(result[1]);
2034
- }
2035
- return testValue(result[2]);
2036
- }
2037
- return false;
2038
- };
2039
- var getIsArbitraryVariable = (value, testLabel, shouldMatchNoLabel = false) => {
2040
- const result = arbitraryVariableRegex.exec(value);
2041
- if (result) {
2042
- if (result[1]) {
2043
- return testLabel(result[1]);
2044
- }
2045
- return shouldMatchNoLabel;
2046
- }
2047
- return false;
2048
- };
2049
- var isLabelPosition = (label) => label === "position" || label === "percentage";
2050
- var isLabelImage = (label) => label === "image" || label === "url";
2051
- var isLabelSize = (label) => label === "length" || label === "size" || label === "bg-size";
2052
- var isLabelLength = (label) => label === "length";
2053
- var isLabelNumber = (label) => label === "number";
2054
- var isLabelFamilyName = (label) => label === "family-name";
2055
- var isLabelShadow = (label) => label === "shadow";
2056
- var getDefaultConfig = () => {
2057
- const themeColor = fromTheme("color");
2058
- const themeFont = fromTheme("font");
2059
- const themeText = fromTheme("text");
2060
- const themeFontWeight = fromTheme("font-weight");
2061
- const themeTracking = fromTheme("tracking");
2062
- const themeLeading = fromTheme("leading");
2063
- const themeBreakpoint = fromTheme("breakpoint");
2064
- const themeContainer = fromTheme("container");
2065
- const themeSpacing = fromTheme("spacing");
2066
- const themeRadius = fromTheme("radius");
2067
- const themeShadow = fromTheme("shadow");
2068
- const themeInsetShadow = fromTheme("inset-shadow");
2069
- const themeTextShadow = fromTheme("text-shadow");
2070
- const themeDropShadow = fromTheme("drop-shadow");
2071
- const themeBlur = fromTheme("blur");
2072
- const themePerspective = fromTheme("perspective");
2073
- const themeAspect = fromTheme("aspect");
2074
- const themeEase = fromTheme("ease");
2075
- const themeAnimate = fromTheme("animate");
2076
- const scaleBreak = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"];
2077
- const scalePosition = () => [
2078
- "center",
2079
- "top",
2080
- "bottom",
2081
- "left",
2082
- "right",
2083
- "top-left",
2084
- // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
2085
- "left-top",
2086
- "top-right",
2087
- // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
2088
- "right-top",
2089
- "bottom-right",
2090
- // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
2091
- "right-bottom",
2092
- "bottom-left",
2093
- // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
2094
- "left-bottom"
2095
- ];
2096
- const scalePositionWithArbitrary = () => [...scalePosition(), isArbitraryVariable, isArbitraryValue];
2097
- const scaleOverflow = () => ["auto", "hidden", "clip", "visible", "scroll"];
2098
- const scaleOverscroll = () => ["auto", "contain", "none"];
2099
- const scaleUnambiguousSpacing = () => [isArbitraryVariable, isArbitraryValue, themeSpacing];
2100
- const scaleInset = () => [isFraction, "full", "auto", ...scaleUnambiguousSpacing()];
2101
- const scaleGridTemplateColsRows = () => [isInteger, "none", "subgrid", isArbitraryVariable, isArbitraryValue];
2102
- const scaleGridColRowStartAndEnd = () => ["auto", {
2103
- span: ["full", isInteger, isArbitraryVariable, isArbitraryValue]
2104
- }, isInteger, isArbitraryVariable, isArbitraryValue];
2105
- const scaleGridColRowStartOrEnd = () => [isInteger, "auto", isArbitraryVariable, isArbitraryValue];
2106
- const scaleGridAutoColsRows = () => ["auto", "min", "max", "fr", isArbitraryVariable, isArbitraryValue];
2107
- const scaleAlignPrimaryAxis = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"];
2108
- const scaleAlignSecondaryAxis = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"];
2109
- const scaleMargin = () => ["auto", ...scaleUnambiguousSpacing()];
2110
- const scaleSizing = () => [isFraction, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...scaleUnambiguousSpacing()];
2111
- const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue];
2112
- const scaleBgPosition = () => [...scalePosition(), isArbitraryVariablePosition, isArbitraryPosition, {
2113
- position: [isArbitraryVariable, isArbitraryValue]
2114
- }];
2115
- const scaleBgRepeat = () => ["no-repeat", {
2116
- repeat: ["", "x", "y", "space", "round"]
2117
- }];
2118
- const scaleBgSize = () => ["auto", "cover", "contain", isArbitraryVariableSize, isArbitrarySize, {
2119
- size: [isArbitraryVariable, isArbitraryValue]
2120
- }];
2121
- const scaleGradientStopPosition = () => [isPercent, isArbitraryVariableLength, isArbitraryLength];
2122
- const scaleRadius = () => [
2123
- // Deprecated since Tailwind CSS v4.0.0
2124
- "",
2125
- "none",
2126
- "full",
2127
- themeRadius,
2128
- isArbitraryVariable,
2129
- isArbitraryValue
2130
- ];
2131
- const scaleBorderWidth = () => ["", isNumber, isArbitraryVariableLength, isArbitraryLength];
2132
- const scaleLineStyle = () => ["solid", "dashed", "dotted", "double"];
2133
- const scaleBlendMode = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
2134
- const scaleMaskImagePosition = () => [isNumber, isPercent, isArbitraryVariablePosition, isArbitraryPosition];
2135
- const scaleBlur = () => [
2136
- // Deprecated since Tailwind CSS v4.0.0
2137
- "",
2138
- "none",
2139
- themeBlur,
2140
- isArbitraryVariable,
2141
- isArbitraryValue
2142
- ];
2143
- const scaleRotate = () => ["none", isNumber, isArbitraryVariable, isArbitraryValue];
2144
- const scaleScale = () => ["none", isNumber, isArbitraryVariable, isArbitraryValue];
2145
- const scaleSkew = () => [isNumber, isArbitraryVariable, isArbitraryValue];
2146
- const scaleTranslate = () => [isFraction, "full", ...scaleUnambiguousSpacing()];
2147
- return {
2148
- cacheSize: 500,
2149
- theme: {
2150
- animate: ["spin", "ping", "pulse", "bounce"],
2151
- aspect: ["video"],
2152
- blur: [isTshirtSize],
2153
- breakpoint: [isTshirtSize],
2154
- color: [isAny],
2155
- container: [isTshirtSize],
2156
- "drop-shadow": [isTshirtSize],
2157
- ease: ["in", "out", "in-out"],
2158
- font: [isAnyNonArbitrary],
2159
- "font-weight": ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black"],
2160
- "inset-shadow": [isTshirtSize],
2161
- leading: ["none", "tight", "snug", "normal", "relaxed", "loose"],
2162
- perspective: ["dramatic", "near", "normal", "midrange", "distant", "none"],
2163
- radius: [isTshirtSize],
2164
- shadow: [isTshirtSize],
2165
- spacing: ["px", isNumber],
2166
- text: [isTshirtSize],
2167
- "text-shadow": [isTshirtSize],
2168
- tracking: ["tighter", "tight", "normal", "wide", "wider", "widest"]
2169
- },
2170
- classGroups: {
2171
- // --------------
2172
- // --- Layout ---
2173
- // --------------
2174
- /**
2175
- * Aspect Ratio
2176
- * @see https://tailwindcss.com/docs/aspect-ratio
1194
+ * Aspect Ratio
1195
+ * @see https://tailwindcss.com/docs/aspect-ratio
2177
1196
  */
2178
1197
  aspect: [{
2179
1198
  aspect: ["auto", "square", isFraction, isArbitraryValue, isArbitraryVariable, themeAspect]
@@ -4516,68 +3535,1082 @@ var getDefaultConfig = () => {
4516
3535
  "forced-color-adjust": ["auto", "none"]
4517
3536
  }]
4518
3537
  },
4519
- conflictingClassGroups: {
4520
- overflow: ["overflow-x", "overflow-y"],
4521
- overscroll: ["overscroll-x", "overscroll-y"],
4522
- inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
4523
- "inset-x": ["right", "left"],
4524
- "inset-y": ["top", "bottom"],
4525
- flex: ["basis", "grow", "shrink"],
4526
- gap: ["gap-x", "gap-y"],
4527
- p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
4528
- px: ["pr", "pl"],
4529
- py: ["pt", "pb"],
4530
- m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
4531
- mx: ["mr", "ml"],
4532
- my: ["mt", "mb"],
4533
- size: ["w", "h"],
4534
- "font-size": ["leading"],
4535
- "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
4536
- "fvn-ordinal": ["fvn-normal"],
4537
- "fvn-slashed-zero": ["fvn-normal"],
4538
- "fvn-figure": ["fvn-normal"],
4539
- "fvn-spacing": ["fvn-normal"],
4540
- "fvn-fraction": ["fvn-normal"],
4541
- "line-clamp": ["display", "overflow"],
4542
- rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"],
4543
- "rounded-s": ["rounded-ss", "rounded-es"],
4544
- "rounded-e": ["rounded-se", "rounded-ee"],
4545
- "rounded-t": ["rounded-tl", "rounded-tr"],
4546
- "rounded-r": ["rounded-tr", "rounded-br"],
4547
- "rounded-b": ["rounded-br", "rounded-bl"],
4548
- "rounded-l": ["rounded-tl", "rounded-bl"],
4549
- "border-spacing": ["border-spacing-x", "border-spacing-y"],
4550
- "border-w": ["border-w-x", "border-w-y", "border-w-s", "border-w-e", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
4551
- "border-w-x": ["border-w-r", "border-w-l"],
4552
- "border-w-y": ["border-w-t", "border-w-b"],
4553
- "border-color": ["border-color-x", "border-color-y", "border-color-s", "border-color-e", "border-color-t", "border-color-r", "border-color-b", "border-color-l"],
4554
- "border-color-x": ["border-color-r", "border-color-l"],
4555
- "border-color-y": ["border-color-t", "border-color-b"],
4556
- translate: ["translate-x", "translate-y", "translate-none"],
4557
- "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
4558
- "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
4559
- "scroll-mx": ["scroll-mr", "scroll-ml"],
4560
- "scroll-my": ["scroll-mt", "scroll-mb"],
4561
- "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
4562
- "scroll-px": ["scroll-pr", "scroll-pl"],
4563
- "scroll-py": ["scroll-pt", "scroll-pb"],
4564
- touch: ["touch-x", "touch-y", "touch-pz"],
4565
- "touch-x": ["touch"],
4566
- "touch-y": ["touch"],
4567
- "touch-pz": ["touch"]
3538
+ conflictingClassGroups: {
3539
+ overflow: ["overflow-x", "overflow-y"],
3540
+ overscroll: ["overscroll-x", "overscroll-y"],
3541
+ inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
3542
+ "inset-x": ["right", "left"],
3543
+ "inset-y": ["top", "bottom"],
3544
+ flex: ["basis", "grow", "shrink"],
3545
+ gap: ["gap-x", "gap-y"],
3546
+ p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
3547
+ px: ["pr", "pl"],
3548
+ py: ["pt", "pb"],
3549
+ m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
3550
+ mx: ["mr", "ml"],
3551
+ my: ["mt", "mb"],
3552
+ size: ["w", "h"],
3553
+ "font-size": ["leading"],
3554
+ "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
3555
+ "fvn-ordinal": ["fvn-normal"],
3556
+ "fvn-slashed-zero": ["fvn-normal"],
3557
+ "fvn-figure": ["fvn-normal"],
3558
+ "fvn-spacing": ["fvn-normal"],
3559
+ "fvn-fraction": ["fvn-normal"],
3560
+ "line-clamp": ["display", "overflow"],
3561
+ rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"],
3562
+ "rounded-s": ["rounded-ss", "rounded-es"],
3563
+ "rounded-e": ["rounded-se", "rounded-ee"],
3564
+ "rounded-t": ["rounded-tl", "rounded-tr"],
3565
+ "rounded-r": ["rounded-tr", "rounded-br"],
3566
+ "rounded-b": ["rounded-br", "rounded-bl"],
3567
+ "rounded-l": ["rounded-tl", "rounded-bl"],
3568
+ "border-spacing": ["border-spacing-x", "border-spacing-y"],
3569
+ "border-w": ["border-w-x", "border-w-y", "border-w-s", "border-w-e", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
3570
+ "border-w-x": ["border-w-r", "border-w-l"],
3571
+ "border-w-y": ["border-w-t", "border-w-b"],
3572
+ "border-color": ["border-color-x", "border-color-y", "border-color-s", "border-color-e", "border-color-t", "border-color-r", "border-color-b", "border-color-l"],
3573
+ "border-color-x": ["border-color-r", "border-color-l"],
3574
+ "border-color-y": ["border-color-t", "border-color-b"],
3575
+ translate: ["translate-x", "translate-y", "translate-none"],
3576
+ "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
3577
+ "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
3578
+ "scroll-mx": ["scroll-mr", "scroll-ml"],
3579
+ "scroll-my": ["scroll-mt", "scroll-mb"],
3580
+ "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
3581
+ "scroll-px": ["scroll-pr", "scroll-pl"],
3582
+ "scroll-py": ["scroll-pt", "scroll-pb"],
3583
+ touch: ["touch-x", "touch-y", "touch-pz"],
3584
+ "touch-x": ["touch"],
3585
+ "touch-y": ["touch"],
3586
+ "touch-pz": ["touch"]
3587
+ },
3588
+ conflictingClassGroupModifiers: {
3589
+ "font-size": ["leading"]
3590
+ },
3591
+ orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
3592
+ };
3593
+ };
3594
+ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
3595
+
3596
+ // src/lib/utils.ts
3597
+ function cn(...inputs) {
3598
+ return twMerge(clsx(inputs));
3599
+ }
3600
+ function toArray(v2) {
3601
+ if (v2 == null) return [];
3602
+ return Array.isArray(v2) ? v2 : [v2];
3603
+ }
3604
+ var CORE_PROP_KEYS = /* @__PURE__ */ new Set([
3605
+ "adapter",
3606
+ "schema",
3607
+ "exceptions",
3608
+ "persist",
3609
+ "name",
3610
+ "activateButtonOnChange",
3611
+ "onChange",
3612
+ "onUpdate",
3613
+ "changeBefore",
3614
+ "formRef",
3615
+ "valueBag",
3616
+ "valueFeed",
3617
+ "onFinish",
3618
+ "init",
3619
+ "onSubmit",
3620
+ "onSubmitted",
3621
+ "children"
3622
+ ]);
3623
+ function isPlainObject(value) {
3624
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3625
+ }
3626
+ function deepEqual(a3, b2) {
3627
+ if (a3 === b2) return true;
3628
+ if (typeof a3 === "number" && typeof b2 === "number") {
3629
+ if (Number.isNaN(a3) && Number.isNaN(b2)) return true;
3630
+ }
3631
+ if (Array.isArray(a3) && Array.isArray(b2)) {
3632
+ if (a3.length !== b2.length) return false;
3633
+ for (let i3 = 0; i3 < a3.length; i3++) {
3634
+ if (!deepEqual(a3[i3], b2[i3])) return false;
3635
+ }
3636
+ return true;
3637
+ }
3638
+ if (isPlainObject(a3) && isPlainObject(b2)) {
3639
+ const aKeys = Object.keys(a3);
3640
+ const bKeys = Object.keys(b2);
3641
+ if (aKeys.length !== bKeys.length) return false;
3642
+ for (const key of aKeys) {
3643
+ if (!Object.prototype.hasOwnProperty.call(b2, key)) return false;
3644
+ if (!deepEqual(a3[key], b2[key])) return false;
3645
+ }
3646
+ return true;
3647
+ }
3648
+ return false;
3649
+ }
3650
+ function CoreProvider(props) {
3651
+ var _a, _b;
3652
+ const registryRef = React68.useRef(new FieldRegistry());
3653
+ const bucketRef = React68.useRef({});
3654
+ const uncaughtRef = React68.useRef([]);
3655
+ const errorsRef = React68.useRef(null);
3656
+ const buttonRef = React68.useRef(null);
3657
+ const activeButtonNameRef = React68.useRef(null);
3658
+ const [hasUncaughtErrors, setHasUncaughtErrors] = React68.useState(0);
3659
+ const originalRef = React68.useRef(null);
3660
+ const propsRef = React68.useRef(props);
3661
+ React68.useEffect(() => {
3662
+ propsRef.current = props;
3663
+ }, [props]);
3664
+ const adapterKey = (_a = props.adapter) != null ? _a : "local";
3665
+ const schema = props.schema;
3666
+ const errorBagId = (_b = props.name) != null ? _b : void 0;
3667
+ let context;
3668
+ function fetchAllNamedFields() {
3669
+ return registryRef.current.getAllNamed();
3670
+ }
3671
+ function clearFieldErrors() {
3672
+ for (const field of fetchAllNamedFields()) {
3673
+ const anyField = field;
3674
+ if (typeof anyField.setError === "function") {
3675
+ anyField.setError(void 0);
3676
+ } else if ("error" in anyField) {
3677
+ anyField.error = void 0;
3678
+ }
3679
+ }
3680
+ }
3681
+ function findFieldForErrorKey(key) {
3682
+ if (!key) return void 0;
3683
+ return fetchAllNamedFields().find((f2) => {
3684
+ const raw = f2.name;
3685
+ if (!raw) return false;
3686
+ const trimmed = raw.trim();
3687
+ if (!trimmed) return false;
3688
+ const base = trimmed.replace(/\[]$/, "");
3689
+ if (key === base || key === trimmed) return true;
3690
+ const sharedKey = f2.shared;
3691
+ if (!sharedKey) return false;
3692
+ const sharedBase = `${sharedKey}.${base}`;
3693
+ const sharedRaw = `${sharedKey}.${trimmed}`;
3694
+ return key === sharedBase || key === sharedRaw;
3695
+ });
3696
+ }
3697
+ function setFieldError(name, message2) {
3698
+ const field = findFieldForErrorKey(name);
3699
+ if (field) {
3700
+ const anyField = field;
3701
+ if (typeof anyField.setError === "function") {
3702
+ anyField.setError(message2);
3703
+ } else {
3704
+ anyField.error = message2;
3705
+ }
3706
+ } else {
3707
+ uncaughtRef.current.push(message2);
3708
+ }
3709
+ }
3710
+ function collectValues() {
3711
+ var _a2, _b2;
3712
+ const exceptions = (_a2 = propsRef.current.exceptions) != null ? _a2 : [];
3713
+ const list = {};
3714
+ const shared = {};
3715
+ const formatFileValue = getPaletteUtil("formatFileValue");
3716
+ for (const item of fetchAllNamedFields()) {
3717
+ const rawName = item.name;
3718
+ if (!rawName) continue;
3719
+ const trimmed = rawName.trim();
3720
+ if (!trimmed) continue;
3721
+ const isArray = trimmed.endsWith("[]");
3722
+ const base = trimmed.replace(/\[]$/, "");
3723
+ const sharedKey = item.shared;
3724
+ const target = sharedKey ? (_b2 = shared[sharedKey]) != null ? _b2 : shared[sharedKey] = {} : list;
3725
+ const fullPath = sharedKey ? `${sharedKey}.${base}` : base;
3726
+ if (exceptions.includes(trimmed) || exceptions.includes(base) || exceptions.includes(fullPath)) {
3727
+ continue;
3728
+ }
3729
+ const anyField = item;
3730
+ const val = typeof anyField.getValue === "function" ? anyField.getValue() : anyField.value;
3731
+ const onFormat = (value) => {
3732
+ if (anyField.onSubmit) {
3733
+ return anyField.onSubmit(value);
3734
+ }
3735
+ if (formatFileValue && item.variant == "file") {
3736
+ return toArray(value).map(formatFileValue);
3737
+ }
3738
+ return value;
3739
+ };
3740
+ if (isArray) {
3741
+ const existing = target[base];
3742
+ if (Array.isArray(existing)) {
3743
+ target[base] = onFormat([...existing, val]);
3744
+ } else if (typeof existing === "undefined") {
3745
+ target[base] = onFormat([val]);
3746
+ } else {
3747
+ target[base] = onFormat([existing, val]);
3748
+ }
3749
+ } else {
3750
+ target[base] = onFormat(val);
3751
+ }
3752
+ }
3753
+ const fromFields = { ...list, ...shared };
3754
+ const merged = {
3755
+ ...bucketRef.current,
3756
+ ...fromFields
3757
+ };
3758
+ return merged;
3759
+ }
3760
+ function validateInternal(report = false) {
3761
+ let valid = true;
3762
+ if (report) {
3763
+ uncaughtRef.current = [];
3764
+ clearFieldErrors();
3765
+ }
3766
+ for (const field of fetchAllNamedFields()) {
3767
+ const anyField = field;
3768
+ if (typeof anyField.validate === "function") {
3769
+ const ok = anyField.validate(report);
3770
+ if (!ok) valid = false;
3771
+ }
3772
+ }
3773
+ if (schema) {
3774
+ try {
3775
+ schema.parse(collectValues());
3776
+ } catch (err) {
3777
+ valid = false;
3778
+ if (report && err && typeof err === "object") {
3779
+ const anyErr = err;
3780
+ if (anyErr.issues) {
3781
+ const { fieldErrors, uncaught } = mapZodError(anyErr);
3782
+ for (const [name, message2] of Object.entries(
3783
+ fieldErrors
3784
+ )) {
3785
+ setFieldError(name, message2);
3786
+ }
3787
+ if (uncaught.length) {
3788
+ uncaughtRef.current.push(...uncaught);
3789
+ }
3790
+ }
3791
+ }
3792
+ }
3793
+ }
3794
+ return valid;
3795
+ }
3796
+ function getAdapterPropsFrom(current) {
3797
+ const result = {};
3798
+ for (const key in current) {
3799
+ if (!CORE_PROP_KEYS.has(key)) {
3800
+ result[key] = current[key];
3801
+ }
3802
+ }
3803
+ return result;
3804
+ }
3805
+ async function submitWithAdapter(adapterOverride, extra, ignoreForm, autoErr = true, autoRun = true) {
3806
+ var _a2, _b2;
3807
+ const currentProps = propsRef.current;
3808
+ const btn = buttonRef.current;
3809
+ const activeName = activeButtonNameRef.current;
3810
+ const isActiveButton = !!btn && typeof btn === "object" && btn.name === activeName;
3811
+ const setButtonLoading = (loading) => {
3812
+ if (!isActiveButton) return;
3813
+ if (typeof btn.setLoading === "function") {
3814
+ btn.setLoading(loading);
3815
+ } else if ("loading" in btn) {
3816
+ btn.loading = loading;
3817
+ }
3818
+ };
3819
+ setButtonLoading(true);
3820
+ let finished = false;
3821
+ const finish = () => {
3822
+ if (finished) return;
3823
+ finished = true;
3824
+ if (uncaughtRef.current.length)
3825
+ setHasUncaughtErrors(hasUncaughtErrors + 1);
3826
+ setButtonLoading(false);
3827
+ };
3828
+ if (!ignoreForm) {
3829
+ const ok = validateInternal(true);
3830
+ if (!ok) {
3831
+ finish();
3832
+ return void 0;
3833
+ }
3834
+ }
3835
+ let submissionValues = {
3836
+ ...collectValues(),
3837
+ ...extra != null ? extra : {}
3838
+ };
3839
+ let adapterConfig = {
3840
+ ...getAdapterPropsFrom(currentProps),
3841
+ ...adapterOverride
3842
+ };
3843
+ const event = {
3844
+ preventDefault() {
3845
+ this.continue = false;
3846
+ },
3847
+ editData(cb) {
3848
+ const result = cb(submissionValues);
3849
+ if (result) {
3850
+ submissionValues = result;
3851
+ }
3852
+ },
3853
+ setConfig(arg1, arg2) {
3854
+ if (typeof arg1 === "string") {
3855
+ adapterConfig[arg1] = arg2;
3856
+ } else if (arg1 && typeof arg1 === "object") {
3857
+ adapterConfig = {
3858
+ ...adapterConfig,
3859
+ ...arg1
3860
+ };
3861
+ }
3862
+ },
3863
+ button: (_a2 = buttonRef.current) != null ? _a2 : void 0,
3864
+ get formData() {
3865
+ return submissionValues;
3866
+ },
3867
+ form: context,
3868
+ continue: true
3869
+ };
3870
+ if (currentProps.onSubmit) {
3871
+ try {
3872
+ await currentProps.onSubmit(event);
3873
+ } catch (err) {
3874
+ finish();
3875
+ throw err;
3876
+ }
3877
+ }
3878
+ if (!event.continue) {
3879
+ finish();
3880
+ return void 0;
3881
+ }
3882
+ const factory = (_b2 = getAdapter(adapterKey)) != null ? _b2 : localAdapter;
3883
+ const adapter = factory({
3884
+ // adapter-specific config (url, method, config, etc.)
3885
+ ...adapterConfig,
3886
+ // core config
3887
+ data: submissionValues,
3888
+ errorBag: errorBagId,
3889
+ callbacks: {
3890
+ onSuccess(ok) {
3891
+ const maybe = propsRef.current.onSubmitted;
3892
+ if (maybe) {
3893
+ void maybe(context, ok, () => {
3894
+ finish();
3895
+ });
3896
+ }
3897
+ },
3898
+ onError(err, updateRef) {
3899
+ var _a3;
3900
+ if (!autoErr || !err || typeof err !== "object") {
3901
+ return;
3902
+ }
3903
+ const anyErr = err;
3904
+ if (anyErr.errors && typeof anyErr.errors === "object") {
3905
+ const { fieldErrors, uncaught } = mapErrorBag(
3906
+ (_a3 = anyErr.errors) != null ? _a3 : {}
3907
+ );
3908
+ if (updateRef) {
3909
+ errorsRef.current = fieldErrors;
3910
+ } else
3911
+ for (const [name, message2] of Object.entries(
3912
+ fieldErrors
3913
+ )) {
3914
+ setFieldError(name, message2);
3915
+ }
3916
+ if (uncaught.length) {
3917
+ uncaughtRef.current.push(...uncaught);
3918
+ }
3919
+ }
3920
+ },
3921
+ onFinish() {
3922
+ const maybe = propsRef.current.onFinish;
3923
+ if (maybe) {
3924
+ maybe(context);
3925
+ }
3926
+ finish();
3927
+ }
3928
+ }
3929
+ });
3930
+ if (autoRun) {
3931
+ try {
3932
+ await adapter.send();
3933
+ } catch (e4) {
3934
+ console.log("Adapter failed to send.", e4);
3935
+ }
3936
+ }
3937
+ return adapter;
3938
+ }
3939
+ context = {
3940
+ values() {
3941
+ return collectValues();
3942
+ },
3943
+ submit() {
3944
+ const valid = validateInternal(true);
3945
+ const vals = collectValues();
3946
+ return { values: vals, valid };
3947
+ },
3948
+ getBind(id) {
3949
+ return registryRef.current.getByBind(id);
3950
+ },
3951
+ validate(report) {
3952
+ return validateInternal(report);
3953
+ },
3954
+ addField(field) {
3955
+ var _a2, _b2;
3956
+ const rawName = (_a2 = field.name) != null ? _a2 : "";
3957
+ field.name = rawName.trim();
3958
+ const { valueBag, valueFeed } = propsRef.current;
3959
+ const trimmed = ((_b2 = field.name) != null ? _b2 : "").trim();
3960
+ const hasName = !!trimmed;
3961
+ const isArray = hasName && trimmed.endsWith("[]");
3962
+ const base = hasName ? trimmed.replace(/\[]$/, "") : "";
3963
+ const sharedKey = field.shared;
3964
+ if (valueBag && !field.ignore && hasName) {
3965
+ const sourceRoot = sharedKey && valueBag[sharedKey] ? valueBag[sharedKey] : valueBag;
3966
+ let value = void 0;
3967
+ if (sourceRoot && typeof sourceRoot === "object") {
3968
+ if (isArray && Array.isArray(sourceRoot[base])) {
3969
+ const siblings = fetchAllNamedFields().filter((f2) => {
3970
+ var _a3;
3971
+ const rn = ((_a3 = f2.name) != null ? _a3 : "").trim();
3972
+ return rn === trimmed && f2.shared === sharedKey;
3973
+ });
3974
+ const idx = siblings.length;
3975
+ value = sourceRoot[base][idx];
3976
+ } else {
3977
+ value = sourceRoot[base];
3978
+ }
3979
+ }
3980
+ let hydrated = value;
3981
+ if (valueFeed) {
3982
+ const maybe = valueFeed(
3983
+ base,
3984
+ value,
3985
+ context
3986
+ );
3987
+ if (typeof maybe !== "undefined") {
3988
+ hydrated = maybe;
3989
+ }
3990
+ }
3991
+ if (typeof hydrated !== "undefined") {
3992
+ const anyField = field;
3993
+ if (typeof anyField.setValue === "function") {
3994
+ anyField.setValue(hydrated);
3995
+ } else {
3996
+ anyField.value = hydrated;
3997
+ }
3998
+ }
3999
+ }
4000
+ registryRef.current.add(field);
4001
+ },
4002
+ // Expose registry view as inputs (delegates to FieldRegistry instance)
4003
+ inputs: registryRef.current,
4004
+ // Also expose raw list of fields for compatibility is defined later as a getter
4005
+ bucket: bucketRef.current,
4006
+ error(nameOrBag, maybeMsg) {
4007
+ if (typeof nameOrBag === "string") {
4008
+ if (!maybeMsg) return;
4009
+ setFieldError(nameOrBag, maybeMsg);
4010
+ return;
4011
+ }
4012
+ const { fieldErrors, uncaught } = mapErrorBag(nameOrBag);
4013
+ for (const [name, message2] of Object.entries(fieldErrors)) {
4014
+ setFieldError(name, message2);
4015
+ }
4016
+ if (uncaught.length) {
4017
+ uncaughtRef.current.push(...uncaught);
4018
+ }
4019
+ },
4020
+ controlButton() {
4021
+ const { activateButtonOnChange } = propsRef.current;
4022
+ if (!activateButtonOnChange) return;
4023
+ const btn = buttonRef.current;
4024
+ const activeName = activeButtonNameRef.current;
4025
+ if (!btn || btn.name !== activeName) {
4026
+ return;
4027
+ }
4028
+ if (!originalRef.current) {
4029
+ originalRef.current = collectValues();
4030
+ }
4031
+ const current = collectValues();
4032
+ const original = originalRef.current;
4033
+ const dirty = !deepEqual(original, current);
4034
+ const setDisabled = (disabled) => {
4035
+ if (typeof btn.setDisabled === "function") {
4036
+ btn.setDisabled(disabled);
4037
+ } else if ("disabled" in btn) {
4038
+ btn.disabled = disabled;
4039
+ }
4040
+ };
4041
+ setDisabled(!dirty);
4042
+ },
4043
+ isDirty() {
4044
+ if (!originalRef.current) {
4045
+ originalRef.current = collectValues();
4046
+ }
4047
+ const current = collectValues();
4048
+ const original = originalRef.current;
4049
+ return !deepEqual(original, current);
4050
+ },
4051
+ async prepare(type, route, extra, ignoreForm, autoErr) {
4052
+ const override = {
4053
+ method: type,
4054
+ url: route
4055
+ };
4056
+ return submitWithAdapter(
4057
+ override,
4058
+ extra,
4059
+ ignoreForm,
4060
+ autoErr,
4061
+ false
4062
+ );
4063
+ },
4064
+ persist(data, feed) {
4065
+ var _a2, _b2;
4066
+ const seen = {};
4067
+ const root = data;
4068
+ const useFeed = feed || (propsRef.current.valueFeed ? (name, value, original) => {
4069
+ const vf = propsRef.current.valueFeed;
4070
+ const maybe = vf(
4071
+ name,
4072
+ value,
4073
+ context
4074
+ );
4075
+ return typeof maybe === "undefined" ? original : maybe;
4076
+ } : void 0);
4077
+ for (const field of fetchAllNamedFields()) {
4078
+ const rawName = field.name;
4079
+ if (!rawName) continue;
4080
+ if (field.ignore) continue;
4081
+ const trimmed = rawName.trim();
4082
+ if (!trimmed) continue;
4083
+ const isArray = trimmed.endsWith("[]");
4084
+ const base = trimmed.replace(/\[]$/, "");
4085
+ const sharedKey = field.shared;
4086
+ const key = sharedKey ? `${sharedKey}.${base}` : base;
4087
+ let value = void 0;
4088
+ if (sharedKey) {
4089
+ const group = root[sharedKey];
4090
+ if (group && typeof group === "object") {
4091
+ if (isArray && Array.isArray(group[base])) {
4092
+ const idx = (_a2 = seen[key]) != null ? _a2 : 0;
4093
+ value = group[base][idx];
4094
+ seen[key] = idx + 1;
4095
+ } else {
4096
+ value = group[base];
4097
+ }
4098
+ }
4099
+ } else {
4100
+ if (isArray && Array.isArray(root[base])) {
4101
+ const idx = (_b2 = seen[key]) != null ? _b2 : 0;
4102
+ value = root[base][idx];
4103
+ seen[key] = idx + 1;
4104
+ } else {
4105
+ value = root[base];
4106
+ }
4107
+ }
4108
+ const anyField = field;
4109
+ const original = typeof anyField.getValue === "function" ? anyField.getValue() : anyField.value;
4110
+ let next = value;
4111
+ if (useFeed) {
4112
+ const maybe = useFeed(base, value, original);
4113
+ if (typeof maybe === "undefined") {
4114
+ continue;
4115
+ }
4116
+ next = maybe;
4117
+ }
4118
+ if (typeof anyField.setValue === "function") {
4119
+ anyField.setValue(next);
4120
+ } else {
4121
+ anyField.value = next;
4122
+ }
4123
+ }
4124
+ if (propsRef.current.onUpdate) {
4125
+ propsRef.current.onUpdate(collectValues());
4126
+ }
4127
+ },
4128
+ setValue(name, value) {
4129
+ if (!name) return;
4130
+ let sharedKey;
4131
+ let base = name;
4132
+ if (name.includes(".")) {
4133
+ const [group, field] = name.split(".", 2);
4134
+ sharedKey = group;
4135
+ base = field;
4136
+ }
4137
+ const targetField = fetchAllNamedFields().find((f2) => {
4138
+ var _a2;
4139
+ const raw = ((_a2 = f2.name) != null ? _a2 : "").trim();
4140
+ if (!raw) return false;
4141
+ const isArray = raw.endsWith("[]");
4142
+ const rawBase = raw.replace(/\[]$/, "");
4143
+ const fShared = f2.shared;
4144
+ const sameGroup = fShared === sharedKey;
4145
+ const sameName = raw === name || rawBase === base || `${fShared}.${rawBase}` === name;
4146
+ return (!sharedKey || sameGroup) && sameName && !isArray;
4147
+ });
4148
+ if (targetField) {
4149
+ const anyField = targetField;
4150
+ if (typeof anyField.setValue === "function") {
4151
+ anyField.setValue(value);
4152
+ } else {
4153
+ anyField.value = value;
4154
+ }
4155
+ } else {
4156
+ bucketRef.current[name] = value;
4157
+ }
4158
+ if (propsRef.current.onUpdate) {
4159
+ propsRef.current.onUpdate(collectValues());
4160
+ }
4161
+ },
4162
+ go(data, ignoreForm) {
4163
+ void submitWithAdapter(void 0, data, ignoreForm, true, true);
4164
+ },
4165
+ reset(inputs) {
4166
+ if (!inputs.length) return;
4167
+ for (const field of fetchAllNamedFields()) {
4168
+ const raw = field.name;
4169
+ if (!raw) continue;
4170
+ if (!inputs.includes(raw)) continue;
4171
+ const anyField = field;
4172
+ if (typeof anyField.reset === "function") {
4173
+ anyField.reset();
4174
+ } else if (typeof anyField.setValue === "function") {
4175
+ anyField.setValue(void 0);
4176
+ } else {
4177
+ anyField.value = void 0;
4178
+ }
4179
+ }
4180
+ },
4181
+ set button(btn) {
4182
+ buttonRef.current = btn;
4568
4183
  },
4569
- conflictingClassGroupModifiers: {
4570
- "font-size": ["leading"]
4184
+ async forceSubmit() {
4185
+ await submitWithAdapter(void 0, void 0, false, true, true);
4571
4186
  },
4572
- orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
4187
+ get fields() {
4188
+ return fetchAllNamedFields();
4189
+ },
4190
+ get props() {
4191
+ const { formRef, valueBag, ...rest } = propsRef.current;
4192
+ return rest;
4193
+ },
4194
+ setActiveButton(name) {
4195
+ activeButtonNameRef.current = name;
4196
+ },
4197
+ hasUncaughtErrors,
4198
+ getUncaught() {
4199
+ return uncaughtRef.current;
4200
+ }
4573
4201
  };
4202
+ React68.useEffect(() => {
4203
+ if (!props.formRef) return;
4204
+ props.formRef.current = context;
4205
+ return () => {
4206
+ if (props.formRef) {
4207
+ props.formRef.current = null;
4208
+ }
4209
+ };
4210
+ }, [context]);
4211
+ React68.useEffect(() => {
4212
+ if (props.init) {
4213
+ props.init(context);
4214
+ }
4215
+ }, []);
4216
+ return /* @__PURE__ */ jsx(CoreContextReact.Provider, { value: context, children: props.children });
4217
+ }
4218
+ function useCoreContext() {
4219
+ const ctx = useContext(CoreContextReact);
4220
+ if (!ctx) {
4221
+ throw new Error("useCoreContext must be used within a <CoreProvider>.");
4222
+ }
4223
+ return ctx;
4224
+ }
4225
+
4226
+ // src/core/hooks/use-core.ts
4227
+ function useCore() {
4228
+ return useCoreContext();
4229
+ }
4230
+
4231
+ // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
4232
+ var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4233
+ var toCamelCase = (string) => string.replace(
4234
+ /^([A-Z])|[\s-_]+(\w)/g,
4235
+ (match2, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
4236
+ );
4237
+ var toPascalCase = (string) => {
4238
+ const camelCase = toCamelCase(string);
4239
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
4574
4240
  };
4575
- var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
4241
+ var mergeClasses = (...classes) => classes.filter((className, index, array) => {
4242
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
4243
+ }).join(" ").trim();
4244
+ var hasA11yProp = (props) => {
4245
+ for (const prop in props) {
4246
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
4247
+ return true;
4248
+ }
4249
+ }
4250
+ };
4251
+
4252
+ // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
4253
+ var defaultAttributes = {
4254
+ xmlns: "http://www.w3.org/2000/svg",
4255
+ width: 24,
4256
+ height: 24,
4257
+ viewBox: "0 0 24 24",
4258
+ fill: "none",
4259
+ stroke: "currentColor",
4260
+ strokeWidth: 2,
4261
+ strokeLinecap: "round",
4262
+ strokeLinejoin: "round"
4263
+ };
4264
+
4265
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
4266
+ var Icon = forwardRef(
4267
+ ({
4268
+ color = "currentColor",
4269
+ size = 24,
4270
+ strokeWidth = 2,
4271
+ absoluteStrokeWidth,
4272
+ className = "",
4273
+ children,
4274
+ iconNode,
4275
+ ...rest
4276
+ }, ref) => createElement(
4277
+ "svg",
4278
+ {
4279
+ ref,
4280
+ ...defaultAttributes,
4281
+ width: size,
4282
+ height: size,
4283
+ stroke: color,
4284
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
4285
+ className: mergeClasses("lucide", className),
4286
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
4287
+ ...rest
4288
+ },
4289
+ [
4290
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
4291
+ ...Array.isArray(children) ? children : [children]
4292
+ ]
4293
+ )
4294
+ );
4295
+
4296
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
4297
+ var createLucideIcon = (iconName, iconNode) => {
4298
+ const Component = forwardRef(
4299
+ ({ className, ...props }, ref) => createElement(Icon, {
4300
+ ref,
4301
+ iconNode,
4302
+ className: mergeClasses(
4303
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
4304
+ `lucide-${iconName}`,
4305
+ className
4306
+ ),
4307
+ ...props
4308
+ })
4309
+ );
4310
+ Component.displayName = toPascalCase(iconName);
4311
+ return Component;
4312
+ };
4313
+
4314
+ // ../../node_modules/lucide-react/dist/esm/icons/calendar.js
4315
+ var __iconNode = [
4316
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
4317
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
4318
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
4319
+ ["path", { d: "M3 10h18", key: "8toen8" }]
4320
+ ];
4321
+ var Calendar = createLucideIcon("calendar", __iconNode);
4322
+
4323
+ // ../../node_modules/lucide-react/dist/esm/icons/check.js
4324
+ var __iconNode2 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
4325
+ var Check = createLucideIcon("check", __iconNode2);
4326
+
4327
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-down.js
4328
+ var __iconNode3 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
4329
+ var ChevronDown = createLucideIcon("chevron-down", __iconNode3);
4330
+
4331
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-left.js
4332
+ var __iconNode4 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
4333
+ var ChevronLeft = createLucideIcon("chevron-left", __iconNode4);
4334
+
4335
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
4336
+ var __iconNode5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
4337
+ var ChevronRight = createLucideIcon("chevron-right", __iconNode5);
4338
+
4339
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-up.js
4340
+ var __iconNode6 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
4341
+ var ChevronUp = createLucideIcon("chevron-up", __iconNode6);
4342
+
4343
+ // ../../node_modules/lucide-react/dist/esm/icons/circle-alert.js
4344
+ var __iconNode7 = [
4345
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
4346
+ ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
4347
+ ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
4348
+ ];
4349
+ var CircleAlert = createLucideIcon("circle-alert", __iconNode7);
4350
+
4351
+ // ../../node_modules/lucide-react/dist/esm/icons/circle-check.js
4352
+ var __iconNode8 = [
4353
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
4354
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
4355
+ ];
4356
+ var CircleCheck = createLucideIcon("circle-check", __iconNode8);
4357
+
4358
+ // ../../node_modules/lucide-react/dist/esm/icons/circle.js
4359
+ var __iconNode9 = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
4360
+ var Circle = createLucideIcon("circle", __iconNode9);
4361
+
4362
+ // ../../node_modules/lucide-react/dist/esm/icons/cloud-upload.js
4363
+ var __iconNode10 = [
4364
+ ["path", { d: "M12 13v8", key: "1l5pq0" }],
4365
+ ["path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242", key: "1pljnt" }],
4366
+ ["path", { d: "m8 17 4-4 4 4", key: "1quai1" }]
4367
+ ];
4368
+ var CloudUpload = createLucideIcon("cloud-upload", __iconNode10);
4369
+
4370
+ // ../../node_modules/lucide-react/dist/esm/icons/code-xml.js
4371
+ var __iconNode11 = [
4372
+ ["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
4373
+ ["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
4374
+ ["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
4375
+ ];
4376
+ var CodeXml = createLucideIcon("code-xml", __iconNode11);
4377
+
4378
+ // ../../node_modules/lucide-react/dist/esm/icons/ellipsis.js
4379
+ var __iconNode12 = [
4380
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
4381
+ ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
4382
+ ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
4383
+ ];
4384
+ var Ellipsis = createLucideIcon("ellipsis", __iconNode12);
4385
+
4386
+ // ../../node_modules/lucide-react/dist/esm/icons/eye-off.js
4387
+ var __iconNode13 = [
4388
+ [
4389
+ "path",
4390
+ {
4391
+ d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
4392
+ key: "ct8e1f"
4393
+ }
4394
+ ],
4395
+ ["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242", key: "151rxh" }],
4396
+ [
4397
+ "path",
4398
+ {
4399
+ d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
4400
+ key: "13bj9a"
4401
+ }
4402
+ ],
4403
+ ["path", { d: "m2 2 20 20", key: "1ooewy" }]
4404
+ ];
4405
+ var EyeOff = createLucideIcon("eye-off", __iconNode13);
4576
4406
 
4577
- // src/lib/utils.ts
4578
- function cn(...inputs) {
4579
- return twMerge(clsx(inputs));
4580
- }
4407
+ // ../../node_modules/lucide-react/dist/esm/icons/eye.js
4408
+ var __iconNode14 = [
4409
+ [
4410
+ "path",
4411
+ {
4412
+ d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
4413
+ key: "1nclc0"
4414
+ }
4415
+ ],
4416
+ ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
4417
+ ];
4418
+ var Eye = createLucideIcon("eye", __iconNode14);
4419
+
4420
+ // ../../node_modules/lucide-react/dist/esm/icons/file.js
4421
+ var __iconNode15 = [
4422
+ [
4423
+ "path",
4424
+ {
4425
+ d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
4426
+ key: "1oefj6"
4427
+ }
4428
+ ],
4429
+ ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
4430
+ ];
4431
+ var File2 = createLucideIcon("file", __iconNode15);
4432
+
4433
+ // ../../node_modules/lucide-react/dist/esm/icons/folder-open.js
4434
+ var __iconNode16 = [
4435
+ [
4436
+ "path",
4437
+ {
4438
+ d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
4439
+ key: "usdka0"
4440
+ }
4441
+ ]
4442
+ ];
4443
+ var FolderOpen = createLucideIcon("folder-open", __iconNode16);
4444
+
4445
+ // ../../node_modules/lucide-react/dist/esm/icons/folder-up.js
4446
+ var __iconNode17 = [
4447
+ [
4448
+ "path",
4449
+ {
4450
+ d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
4451
+ key: "1kt360"
4452
+ }
4453
+ ],
4454
+ ["path", { d: "M12 10v6", key: "1bos4e" }],
4455
+ ["path", { d: "m9 13 3-3 3 3", key: "1pxg3c" }]
4456
+ ];
4457
+ var FolderUp = createLucideIcon("folder-up", __iconNode17);
4458
+
4459
+ // ../../node_modules/lucide-react/dist/esm/icons/folder.js
4460
+ var __iconNode18 = [
4461
+ [
4462
+ "path",
4463
+ {
4464
+ d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
4465
+ key: "1kt360"
4466
+ }
4467
+ ]
4468
+ ];
4469
+ var Folder = createLucideIcon("folder", __iconNode18);
4470
+
4471
+ // ../../node_modules/lucide-react/dist/esm/icons/funnel.js
4472
+ var __iconNode19 = [
4473
+ [
4474
+ "path",
4475
+ {
4476
+ d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
4477
+ key: "sc7q7i"
4478
+ }
4479
+ ]
4480
+ ];
4481
+ var Funnel = createLucideIcon("funnel", __iconNode19);
4482
+
4483
+ // ../../node_modules/lucide-react/dist/esm/icons/globe.js
4484
+ var __iconNode20 = [
4485
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
4486
+ ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
4487
+ ["path", { d: "M2 12h20", key: "9i4pu4" }]
4488
+ ];
4489
+ var Globe = createLucideIcon("globe", __iconNode20);
4490
+
4491
+ // ../../node_modules/lucide-react/dist/esm/icons/loader-circle.js
4492
+ var __iconNode21 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
4493
+ var LoaderCircle = createLucideIcon("loader-circle", __iconNode21);
4494
+
4495
+ // ../../node_modules/lucide-react/dist/esm/icons/map-pin.js
4496
+ var __iconNode22 = [
4497
+ [
4498
+ "path",
4499
+ {
4500
+ d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",
4501
+ key: "1r0f0z"
4502
+ }
4503
+ ],
4504
+ ["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }]
4505
+ ];
4506
+ var MapPin = createLucideIcon("map-pin", __iconNode22);
4507
+
4508
+ // ../../node_modules/lucide-react/dist/esm/icons/minus.js
4509
+ var __iconNode23 = [["path", { d: "M5 12h14", key: "1ays0h" }]];
4510
+ var Minus = createLucideIcon("minus", __iconNode23);
4511
+
4512
+ // ../../node_modules/lucide-react/dist/esm/icons/palette.js
4513
+ var __iconNode24 = [
4514
+ [
4515
+ "path",
4516
+ {
4517
+ d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
4518
+ key: "e79jfc"
4519
+ }
4520
+ ],
4521
+ ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
4522
+ ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
4523
+ ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
4524
+ ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
4525
+ ];
4526
+ var Palette = createLucideIcon("palette", __iconNode24);
4527
+
4528
+ // ../../node_modules/lucide-react/dist/esm/icons/pen-line.js
4529
+ var __iconNode25 = [
4530
+ ["path", { d: "M13 21h8", key: "1jsn5i" }],
4531
+ [
4532
+ "path",
4533
+ {
4534
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
4535
+ key: "1a8usu"
4536
+ }
4537
+ ]
4538
+ ];
4539
+ var PenLine = createLucideIcon("pen-line", __iconNode25);
4540
+
4541
+ // ../../node_modules/lucide-react/dist/esm/icons/plus.js
4542
+ var __iconNode26 = [
4543
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
4544
+ ["path", { d: "M12 5v14", key: "s699le" }]
4545
+ ];
4546
+ var Plus = createLucideIcon("plus", __iconNode26);
4547
+
4548
+ // ../../node_modules/lucide-react/dist/esm/icons/search.js
4549
+ var __iconNode27 = [
4550
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
4551
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
4552
+ ];
4553
+ var Search = createLucideIcon("search", __iconNode27);
4554
+
4555
+ // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
4556
+ var __iconNode28 = [
4557
+ ["path", { d: "M10 5H3", key: "1qgfaw" }],
4558
+ ["path", { d: "M12 19H3", key: "yhmn1j" }],
4559
+ ["path", { d: "M14 3v4", key: "1sua03" }],
4560
+ ["path", { d: "M16 17v4", key: "1q0r14" }],
4561
+ ["path", { d: "M21 12h-9", key: "1o4lsq" }],
4562
+ ["path", { d: "M21 19h-5", key: "1rlt1p" }],
4563
+ ["path", { d: "M21 5h-7", key: "1oszz2" }],
4564
+ ["path", { d: "M8 10v4", key: "tgpxqk" }],
4565
+ ["path", { d: "M8 12H3", key: "a7s4jb" }]
4566
+ ];
4567
+ var SlidersHorizontal = createLucideIcon("sliders-horizontal", __iconNode28);
4568
+
4569
+ // ../../node_modules/lucide-react/dist/esm/icons/square-split-vertical.js
4570
+ var __iconNode29 = [
4571
+ ["path", { d: "M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3", key: "1pi83i" }],
4572
+ ["path", { d: "M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3", key: "ido5k7" }],
4573
+ ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
4574
+ ];
4575
+ var SquareSplitVertical = createLucideIcon("square-split-vertical", __iconNode29);
4576
+
4577
+ // ../../node_modules/lucide-react/dist/esm/icons/tag.js
4578
+ var __iconNode30 = [
4579
+ [
4580
+ "path",
4581
+ {
4582
+ d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",
4583
+ key: "vktsd0"
4584
+ }
4585
+ ],
4586
+ ["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }]
4587
+ ];
4588
+ var Tag = createLucideIcon("tag", __iconNode30);
4589
+
4590
+ // ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
4591
+ var __iconNode31 = [
4592
+ ["path", { d: "M10 11v6", key: "nco0om" }],
4593
+ ["path", { d: "M14 11v6", key: "outv1u" }],
4594
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
4595
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
4596
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
4597
+ ];
4598
+ var Trash2 = createLucideIcon("trash-2", __iconNode31);
4599
+
4600
+ // ../../node_modules/lucide-react/dist/esm/icons/upload.js
4601
+ var __iconNode32 = [
4602
+ ["path", { d: "M12 3v12", key: "1x0j5s" }],
4603
+ ["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
4604
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
4605
+ ];
4606
+ var Upload = createLucideIcon("upload", __iconNode32);
4607
+
4608
+ // ../../node_modules/lucide-react/dist/esm/icons/x.js
4609
+ var __iconNode33 = [
4610
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
4611
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
4612
+ ];
4613
+ var X = createLucideIcon("x", __iconNode33);
4581
4614
  function ErrorStrip(props) {
4582
4615
  var _a, _b;
4583
4616
  const {
@@ -4814,7 +4847,8 @@ function useField(options) {
4814
4847
  readOnly: readOnlyProp = false,
4815
4848
  validate,
4816
4849
  getOriginalValue,
4817
- onValueChange
4850
+ onValueChange,
4851
+ onSubmit
4818
4852
  } = options;
4819
4853
  const ref = React68.useRef(null);
4820
4854
  const stateRef = React68.useRef({
@@ -4901,6 +4935,7 @@ function useField(options) {
4901
4935
  main,
4902
4936
  ignore,
4903
4937
  required,
4938
+ onSubmit,
4904
4939
  ref,
4905
4940
  get defaultValue() {
4906
4941
  return stateRef.current.original;
@@ -4934,7 +4969,8 @@ function useField(options) {
4934
4969
  if (onValueChange) {
4935
4970
  onValueChange(value2, old, variant);
4936
4971
  }
4937
- }
4972
+ },
4973
+ variant: options.variant
4938
4974
  // Flags not directly on the Field interface but used via `as any`
4939
4975
  // in core-provider (getValue/setValue/reset).
4940
4976
  };
@@ -8026,25 +8062,6 @@ function getGlobalCountryList() {
8026
8062
  cachedCountries = DEFAULT_COUNTRIES;
8027
8063
  return cachedCountries;
8028
8064
  }
8029
-
8030
- // src/lib/register-global.ts
8031
- function registerPaletteUtil(key, value) {
8032
- if (typeof window === "undefined") return;
8033
- if (!window["form-palette"]) {
8034
- window["form-palette"] = {};
8035
- }
8036
- window["form-palette"][key] = value;
8037
- }
8038
- function getPaletteUtil(key, defaultValue) {
8039
- if (typeof window === "undefined") {
8040
- return defaultValue;
8041
- }
8042
- const registry3 = window["form-palette"];
8043
- if (registry3 && key in registry3) {
8044
- return registry3[key];
8045
- }
8046
- return defaultValue;
8047
- }
8048
8065
  var TOKEN_CHARS = /* @__PURE__ */ new Set(["9", "a", "*"]);
8049
8066
  function compileMask(pattern, placeholderChar = "_") {
8050
8067
  return { pattern, placeholderChar };
@@ -19528,10 +19545,6 @@ function pickerBtnSize(size) {
19528
19545
  return "h-7 w-7";
19529
19546
  }
19530
19547
  }
19531
- function toArray(v2) {
19532
- if (v2 == null) return [];
19533
- return Array.isArray(v2) ? v2 : [v2];
19534
- }
19535
19548
  function normaliseFileLike(input) {
19536
19549
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
19537
19550
  const asAny = input;
@@ -19689,6 +19702,7 @@ var ShadcnFileVariant = React68.forwardRef(function ShadcnFileVariant2(props, re
19689
19702
  formatFileName,
19690
19703
  formatFileSize = formatSizeDefault,
19691
19704
  placeholder = "Select file...",
19705
+ asRaw,
19692
19706
  className,
19693
19707
  custom,
19694
19708
  dropAreaClassName,
@@ -27154,6 +27168,7 @@ function InputField(props) {
27154
27168
  var _a, _b, _c, _d, _e, _f, _g;
27155
27169
  const {
27156
27170
  variant,
27171
+ onSubmit,
27157
27172
  // Field identity / wiring
27158
27173
  name,
27159
27174
  bind,
@@ -27285,6 +27300,8 @@ function InputField(props) {
27285
27300
  alias,
27286
27301
  main,
27287
27302
  ignore,
27303
+ onSubmit,
27304
+ variant,
27288
27305
  required,
27289
27306
  defaultValue,
27290
27307
  validate