var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/properties/NumberProperty.tsx
var NumberProperty_exports = {};
__export(NumberProperty_exports, {
  NumberProperty: () => NumberProperty
});
module.exports = __toCommonJS(NumberProperty_exports);
var import_lucide_react2 = require("lucide-react");
var import_clsx4 = __toESM(require("clsx"), 1);

// src/components/user-action/input/Input.tsx
var import_react4 = require("react");
var import_clsx = __toESM(require("clsx"), 1);

// src/hooks/useDelay.ts
var import_react = require("react");
var defaultOptions = {
  delay: 3e3,
  disabled: false
};
function useDelay(options) {
  const [timer, setTimer] = (0, import_react.useState)(void 0);
  const { delay, disabled } = {
    ...defaultOptions,
    ...options
  };
  const clearTimer = () => {
    clearTimeout(timer);
    setTimer(void 0);
  };
  const restartTimer = (onDelayFinish) => {
    if (disabled) {
      return;
    }
    clearTimeout(timer);
    setTimer(setTimeout(() => {
      onDelayFinish();
      setTimer(void 0);
    }, delay));
  };
  (0, import_react.useEffect)(() => {
    return () => {
      clearTimeout(timer);
    };
  }, [timer]);
  (0, import_react.useEffect)(() => {
    if (disabled) {
      clearTimeout(timer);
      setTimer(void 0);
    }
  }, [disabled, timer]);
  return { restartTimer, clearTimer, hasActiveTimer: !!timer };
}

// src/hooks/focus/useFocusManagement.ts
var import_react2 = require("react");
function useFocusManagement() {
  const getFocusableElements = (0, import_react2.useCallback)(() => {
    return Array.from(
      document.querySelectorAll(
        'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
      )
    ).filter(
      (el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
    );
  }, []);
  const getNextFocusElement = (0, import_react2.useCallback)(() => {
    const elements = getFocusableElements();
    if (elements.length === 0) {
      return void 0;
    }
    let nextElement = elements[0];
    if (document.activeElement instanceof HTMLElement) {
      const currentIndex = elements.indexOf(document.activeElement);
      nextElement = elements[(currentIndex + 1) % elements.length];
    }
    return nextElement;
  }, [getFocusableElements]);
  const focusNext = (0, import_react2.useCallback)(() => {
    const nextElement = getNextFocusElement();
    nextElement?.focus();
  }, [getNextFocusElement]);
  const getPreviousFocusElement = (0, import_react2.useCallback)(() => {
    const elements = getFocusableElements();
    if (elements.length === 0) {
      return void 0;
    }
    let previousElement = elements[0];
    if (document.activeElement instanceof HTMLElement) {
      const currentIndex = elements.indexOf(document.activeElement);
      if (currentIndex === 0) {
        previousElement = elements[elements.length - 1];
      } else {
        previousElement = elements[currentIndex - 1];
      }
    }
    return previousElement;
  }, [getFocusableElements]);
  const focusPrevious = (0, import_react2.useCallback)(() => {
    const previousElement = getPreviousFocusElement();
    if (previousElement) previousElement.focus();
  }, [getPreviousFocusElement]);
  return {
    getFocusableElements,
    getNextFocusElement,
    getPreviousFocusElement,
    focusNext,
    focusPrevious
  };
}

// src/hooks/useOverwritableState.ts
var import_react3 = require("react");

// src/components/user-action/input/Input.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var defaultEditCompleteOptions = {
  allowEnterComplete: false,
  onBlur: true,
  afterDelay: true,
  delay: 2500
};
var Input = (0, import_react4.forwardRef)(function Input2({
  value,
  onChange,
  onChangeText,
  onEditCompleted,
  editCompleteOptions,
  disabled = false,
  invalid = false,
  defaultStyle = true,
  className,
  ...props
}, forwardedRef) {
  const {
    onBlur: allowEditCompleteOnBlur,
    afterDelay,
    delay,
    allowEnterComplete
  } = { ...defaultEditCompleteOptions, ...editCompleteOptions };
  const {
    restartTimer,
    clearTimer
  } = useDelay({ delay, disabled: !afterDelay });
  const innerRef = (0, import_react4.useRef)(null);
  (0, import_react4.useImperativeHandle)(forwardedRef, () => innerRef.current);
  const { focusNext } = useFocusManagement();
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    "input",
    {
      ...props,
      ref: innerRef,
      value,
      disabled,
      className: defaultStyle ? (0, import_clsx.default)(
        "px-3 py-2 rounded-md text-sm h-10 border-2 border-transparent focus-style-none",
        {
          "bg-input-background text-input-text hover:border-primary focus:border-primary": !disabled && !invalid,
          "bg-negative/20 text-negative hover:border-negative focus-visible:border-negative": !disabled && invalid,
          "bg-disabled-background text-disabled border-disabled-border": disabled
        },
        className
      ) : className,
      onKeyDown: (event) => {
        props.onKeyDown?.(event);
        if (!allowEnterComplete) {
          return;
        }
        if (event.key === "Enter" && !event.shiftKey) {
          event.preventDefault();
          innerRef.current?.blur();
          onEditCompleted?.(event.target.value);
          focusNext();
        }
      },
      onBlur: (event) => {
        props.onBlur?.(event);
        if (allowEditCompleteOnBlur) {
          onEditCompleted?.(event.target.value);
          clearTimer();
        }
      },
      onChange: (event) => {
        onChange?.(event);
        const value2 = event.target.value;
        restartTimer(() => {
          innerRef.current?.blur();
          onEditCompleted?.(value2);
        });
        onChangeText?.(value2);
      },
      "aria-invalid": props["aria-invalid"] ?? invalid,
      "aria-disabled": props["aria-disabled"] ?? disabled
    }
  );
});

// src/i18n/LocaleProvider.tsx
var import_react6 = require("react");

// src/hooks/useLocalStorage.ts
var import_react5 = require("react");

// src/i18n/translations.ts
var import_internationalization = require("@helpwave/internationalization");
var hightideTranslationLocales = ["de-DE", "en-US"];
var hightideTranslation = {
  "de-DE": {
    "add": `Hinzuf\xFCgen`,
    "age": `Alter`,
    "all": `Alle`,
    "apply": `Anwenden`,
    "back": `Zur\xFCck`,
    "cancel": `Abbrechen`,
    "carousel": `Karussell`,
    "change": `\xC4ndern`,
    "chooseLanguage": `W\xE4hle deine bevorzugte Sprache`,
    "chooseSlide": `W\xE4hle die angezeigte Slide aus`,
    "chooseTheme": `W\xE4hle dein bevorzugtes Farbschema.`,
    "clear": `L\xF6schen`,
    "click": `Klicken`,
    "clickToCopy": `Zum kopieren klicken`,
    "clickToSelect": `Zum Ausw\xE4hlen dr\xFCcken`,
    "close": `Schlie\xDFen`,
    "confirm": `Best\xE4tigen`,
    "copied": `Kopiert`,
    "copy": `Kopieren`,
    "create": `Erstellen`,
    "decline": `Ablehnen`,
    "delete": `L\xF6schen`,
    "discard": `Verwerfen`,
    "discardChanges": `\xC4nderungen Verwerfen`,
    "done": `Fertig`,
    "edit": `Bearbeiten`,
    "endDate": `Ende`,
    "enterText": `Text hier eingeben`,
    "entryDate": `Eintragsdatum`,
    "error": `Fehler`,
    "errorOccurred": `Ein Fehler ist aufgetreten`,
    "exit": `Beenden`,
    "fieldRequiredError": `Dieses Feld ist erforderlich.`,
    "filter": `Filter`,
    "gender": ({ gender }) => {
      return import_internationalization.TranslationGen.resolveSelect(gender, {
        "male": `M\xE4nnlich`,
        "female": `Weiblich`,
        "other": `Divers`
      });
    },
    "goodToSeeYou": `Sch\xF6n dich zu sehen`,
    "identifier": `Identifikator`,
    "invalidEmail": `Die E-Mail ist ung\xFCltig.`,
    "invalidEmailError": `Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.`,
    "language": `Sprache`,
    "less": `Weniger`,
    "loading": `L\xE4dt`,
    "locale": `Locale`,
    "max": `Max`,
    "maxLengthError": `Maximale L\xE4nge \xFCberschritten.`,
    "min": `Min`,
    "minLengthError": `Mindestl\xE4nge nicht erreicht.`,
    "more": `Mehr`,
    "name": `Name`,
    "next": `Weiter`,
    "no": `Nein`,
    "none": `Nichts`,
    "notEmpty": `Das Feld darf nicht leer sein.`,
    "nothingFound": `Nichts gefunden`,
    "of": `von`,
    "optional": `Optional`,
    "outOfRangeNumber": ({ min, max }) => {
      return `Der Wert muss zwischen ${min} und ${max} liegen.`;
    },
    "outOfRangeSelectionItems": ({ min, max }) => {
      return `Es m\xFCssen zwischen ${min} und ${max} Elemente ausgew\xE4hlt werden.`;
    },
    "outOfRangeString": ({ min, max }) => {
      return `Der Wert muss zwischen ${min} und ${max} Zeichen lang sein.`;
    },
    "pleaseWait": `Bitte warten...`,
    "previous": `Vorherige`,
    "remove": `Entfernen`,
    "required": `Erforderlich`,
    "reset": `Zur\xFCcksetzen`,
    "save": `Speichern`,
    "saved": `Gespeichert`,
    "search": `Suche`,
    "select": `Select`,
    "selectOption": `Option ausw\xE4hlen`,
    "show": `Anzeigen`,
    "showLess": `Weniger anzeigen`,
    "showMore": `Mehr anzeigen`,
    "showSlide": ({ index }) => {
      return `Zeige Slide ${index}`;
    },
    "slide": `Slide`,
    "slideNavigation": `Slide Navigation`,
    "slideOf": ({ index, length }) => {
      return `Slide ${index} von ${length} slides`;
    },
    "startDate": `Start`,
    "street": `Stra\xDFe`,
    "submit": `Abschicken`,
    "success": `Erfolg`,
    "text": `Text`,
    "themeMode": ({ theme }) => {
      return import_internationalization.TranslationGen.resolveSelect(theme, {
        "dark": `Dunkel`,
        "light": `Hell`,
        "system": `System`
      });
    },
    "themes": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Farbschema`,
        "other": `Farbschemas`
      });
    },
    "time.ago": `vor`,
    "time.agoDays": ({ days }) => {
      return `var ${days} Tagen`;
    },
    "time.april": `April`,
    "time.august": `August`,
    "time.century": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Jahrhundert`,
        "other": `Jahrhunderte`
      });
    },
    "time.day": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Tag`,
        "other": `Tage`
      });
    },
    "time.decade": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Jahrzehnt`,
        "other": `Jahrzehnte`
      });
    },
    "time.december": `December`,
    "time.february": `Febuar`,
    "time.hour": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Stunde`,
        "other": `Stunden`
      });
    },
    "time.in": `in`,
    "time.inDays": ({ days }) => {
      return `in ${days} Tagen`;
    },
    "time.january": `Januar`,
    "time.july": `Juli`,
    "time.june": `Juni`,
    "time.march": `M\xE4rz`,
    "time.may": `Mai`,
    "time.microsecond": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Mikrosekunde`,
        "other": `Mikrosekunden`
      });
    },
    "time.millisecond": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Millisekunde`,
        "other": `Millisekunden`
      });
    },
    "time.minute": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Minute`,
        "other": `Minuten`
      });
    },
    "time.month": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Monat`,
        "other": `Monate`
      });
    },
    "time.monthName": ({ month }) => {
      return import_internationalization.TranslationGen.resolveSelect(month, {
        "january": `Januar`,
        "february": `Februar`,
        "march": `M\xE4rz`,
        "april": `April`,
        "may": `Mai`,
        "june": `Juni`,
        "july": `Juli`,
        "august": `August`,
        "september": `September`,
        "october": `Oktober`,
        "november": `November`,
        "december": `Dezember`,
        "other": `Unbekannter Monat`
      });
    },
    "time.nanosecond": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Nanosekunde`,
        "other": `Nanosekunden`
      });
    },
    "time.november": `November`,
    "time.october": `October`,
    "time.second": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Sekunde`,
        "other": `Sekunden`
      });
    },
    "time.september": `September`,
    "time.today": `Heute`,
    "time.tomorrow": `Morgen`,
    "time.year": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Jahr`,
        "other": `Jahre`
      });
    },
    "time.yesterday": `Gestern`,
    "tooFewSelectionItems": ({ min }) => {
      return `Es m\xFCssen mindestens ${min} Elemente ausgew\xE4hlt werden.`;
    },
    "tooLong": ({ max }) => {
      return `Der Wert darf h\xF6chstens ${max} Zeichen enthalten.`;
    },
    "tooManySelectionItems": ({ max }) => {
      return `Es m\xFCssen maximal ${max} Elemente ausgew\xE4hlt werden.`;
    },
    "tooShort": ({ min }) => {
      return `Der Wert muss mindestens ${min} Zeichen enthalten.`;
    },
    "unsavedChanges": `Ungespeicherte \xC4nderungen`,
    "unsavedChangesSaveQuestion": `M\xF6chtest du die \xC4nderungen speichern?`,
    "update": `Update`,
    "value": `Wert`,
    "welcome": `Willkommen`,
    "yes": `Ja`
  },
  "en-US": {
    "add": `Add`,
    "age": `Age`,
    "all": `All`,
    "apply": `Apply`,
    "back": `Back`,
    "cancel": `Cancel`,
    "carousel": `Carousel`,
    "change": `Change`,
    "chooseLanguage": `Choose your language`,
    "chooseSlide": `Choose slide to display`,
    "chooseTheme": `Choose your preferred color theme.`,
    "clear": `Clear`,
    "click": `Click`,
    "clickToCopy": `Click to Copy`,
    "clickToSelect": `Click to select`,
    "close": `Close`,
    "confirm": `Confirm`,
    "copied": `Copied`,
    "copy": `Copy`,
    "create": `Create`,
    "decline": `Decline`,
    "delete": `Delete`,
    "discard": `Discard`,
    "discardChanges": `Discard Changes`,
    "done": `Done`,
    "edit": `Edit`,
    "endDate": `End`,
    "enterText": `Enter text here`,
    "entryDate": `Entry Date`,
    "error": `Error`,
    "errorOccurred": `An error occurred`,
    "exit": `Exit`,
    "fieldRequiredError": `This field is required.`,
    "filter": `Filter`,
    "gender": ({ gender }) => {
      return import_internationalization.TranslationGen.resolveSelect(gender, {
        "male": `Male`,
        "female": `Female`,
        "other": `Other`
      });
    },
    "goodToSeeYou": `Good to see you`,
    "identifier": `Identifier`,
    "invalidEmail": `The email is not valid.`,
    "invalidEmailError": `Please enter a valid email address.`,
    "language": `Language`,
    "less": `Less`,
    "loading": `Loading`,
    "locale": `Locale`,
    "max": `Max`,
    "maxLengthError": `Maximum length exceeded.`,
    "min": `Min`,
    "minLengthError": `Minimum length not met.`,
    "more": `More`,
    "name": `Name`,
    "next": `Next`,
    "no": `No`,
    "none": `None`,
    "notEmpty": `The field cannot be empty.`,
    "nothingFound": `Nothing found`,
    "of": `of`,
    "optional": `Optional`,
    "outOfRangeNumber": ({ min, max }) => {
      return `The value must be between ${min} and ${max}.`;
    },
    "outOfRangeSelectionItems": ({ min, max }) => {
      return `Between ${min} and ${max} items must be selected.`;
    },
    "outOfRangeString": ({ min, max }) => {
      return `The value needs to have between ${min} and ${max} characters.`;
    },
    "pleaseWait": `Please wait...`,
    "previous": `Previous`,
    "remove": `Remove`,
    "required": `Required`,
    "reset": `Reset`,
    "save": `Save`,
    "saved": `Saved`,
    "search": `Search`,
    "select": `Select`,
    "selectOption": `Select an option`,
    "show": `Show`,
    "showLess": `Show less`,
    "showMore": `Show more`,
    "showSlide": ({ index }) => {
      return `Show Slide ${index}`;
    },
    "slide": `Slide`,
    "slideNavigation": `Slide navigation`,
    "slideOf": ({ index, length }) => {
      return `Slide ${index} of ${length} slides`;
    },
    "startDate": `Start`,
    "street": `Street`,
    "submit": `Submit`,
    "success": `Success`,
    "text": `Text`,
    "themeMode": ({ theme }) => {
      return import_internationalization.TranslationGen.resolveSelect(theme, {
        "dark": `Dark`,
        "light": `Light`,
        "system": `System`
      });
    },
    "themes": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Theme`,
        "other": `Themes`
      });
    },
    "time.ago": `ago`,
    "time.agoDays": ({ days }) => {
      return `days ${days} ago`;
    },
    "time.april": `April`,
    "time.august": `August`,
    "time.century": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Century`,
        "other": `Centuries`
      });
    },
    "time.day": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Day`,
        "other": `Days`
      });
    },
    "time.decade": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Decade`,
        "other": `Decades`
      });
    },
    "time.december": `December`,
    "time.february": `Febuary`,
    "time.hour": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Hour`,
        "other": `Hours`
      });
    },
    "time.in": `in`,
    "time.inDays": ({ days }) => {
      return `in ${days} days`;
    },
    "time.january": `January`,
    "time.july": `July`,
    "time.june": `June`,
    "time.march": `March`,
    "time.may": `May`,
    "time.microsecond": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Microsecond`,
        "other": `Microseconds`
      });
    },
    "time.millisecond": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Millisecond`,
        "other": `Milliseconds`
      });
    },
    "time.minute": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Minute`,
        "other": `Minutes`
      });
    },
    "time.month": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Month`,
        "other": `Months`
      });
    },
    "time.monthName": ({ month }) => {
      return import_internationalization.TranslationGen.resolveSelect(month, {
        "january": `January`,
        "february": `February`,
        "march": `March`,
        "april": `April`,
        "may": `May`,
        "june": `June`,
        "july": `July`,
        "august": `August`,
        "september": `September`,
        "october": `October`,
        "november": `November`,
        "december": `December`,
        "other": `Unknown Month`
      });
    },
    "time.nanosecond": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Nanosecond`,
        "other": `Nanoseconds`
      });
    },
    "time.november": `November`,
    "time.october": `October`,
    "time.second": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Second`,
        "other": `Seconds`
      });
    },
    "time.september": `September`,
    "time.today": `Today`,
    "time.tomorrow": `Tomorrow`,
    "time.year": ({ count }) => {
      return import_internationalization.TranslationGen.resolveSelect(count, {
        "=1": `Year`,
        "other": `Years`
      });
    },
    "time.yesterday": `Yesterday`,
    "tooFewSelectionItems": ({ min }) => {
      return `Select at least ${min} items.`;
    },
    "tooLong": ({ max }) => {
      return `The value requires less than ${max} characters.`;
    },
    "tooManySelectionItems": ({ max }) => {
      return `Select at most ${max} items.`;
    },
    "tooShort": ({ min }) => {
      return `The value requires at least ${min} characters.`;
    },
    "unsavedChanges": `Unsaved Changes`,
    "unsavedChangesSaveQuestion": `Do you want to save your changes?`,
    "update": `Update`,
    "value": `Value`,
    "welcome": `Welcome`,
    "yes": `Yes`
  }
};

// src/i18n/util.ts
var localsNames = {
  "en-US": "English (US)",
  "de-DE": "Deutsch"
};
var DEFAULT_LOCALE = "en-US";
function localeToLanguage(locale) {
  return locale.split("-")[0];
}
var LocalizationUtil = {
  locals: hightideTranslationLocales,
  localToLanguage: localeToLanguage,
  DEFAULT_LOCALE,
  languagesLocalNames: localsNames
};

// src/i18n/LocaleProvider.tsx
var import_jsx_runtime2 = require("react/jsx-runtime");
var LocaleContext = (0, import_react6.createContext)({
  locale: LocalizationUtil.DEFAULT_LOCALE,
  setLocale: (v) => v
});
var useLocale = () => {
  const context = (0, import_react6.useContext)(LocaleContext);
  if (!context) {
    throw new Error("useLocale must be used within LocaleContext. Try adding a LocaleProvider around your app.");
  }
  return context;
};

// src/i18n/useHightideTranslation.ts
var import_internationalization2 = require("@helpwave/internationalization");

// src/utils/array.ts
var moveItems = (list, move = 0) => {
  const result = [];
  let start = move;
  if (start < 0) {
    start = list.length - move;
  }
  start = start % list.length;
  for (let i = 0; i < list.length; i++) {
    result[i] = list[(i + start) % list.length];
  }
  return result;
};
function resolveSingleOrArray(value) {
  if (Array.isArray(value)) {
    return value;
  } else if (value) {
    return [value];
  }
  return [];
}
var ArrayUtil = {
  unique: (list) => {
    const seen = /* @__PURE__ */ new Set();
    return list.filter((item) => {
      if (seen.has(item)) {
        return false;
      }
      seen.add(item);
      return true;
    });
  },
  difference: (list, removeList) => {
    const remove = new Set(removeList);
    return list.filter((item) => !remove.has(item));
  },
  moveItems,
  resolveSingleOrArray
};

// src/i18n/useHightideTranslation.ts
function useHightideTranslation(extensions, overwrites) {
  const { locale: inferredLocale } = useLocale();
  const locale = overwrites?.locale ?? inferredLocale;
  const translationExtensions = ArrayUtil.resolveSingleOrArray(extensions);
  return (0, import_internationalization2.combineTranslation)([
    ...translationExtensions,
    hightideTranslation
  ], locale);
}

// src/components/properties/PropertyBase.tsx
var import_lucide_react = require("lucide-react");
var import_clsx3 = __toESM(require("clsx"), 1);

// src/components/user-action/Button.tsx
var import_react7 = require("react");
var import_clsx2 = __toESM(require("clsx"), 1);
var import_jsx_runtime3 = require("react/jsx-runtime");
var ButtonColorUtil = {
  solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
  text: ["primary", "negative", "neutral"],
  outline: ["primary"]
};
var IconButtonUtil = {
  icon: [...ButtonColorUtil.solid, "transparent"]
};
var paddingMapping = {
  none: "",
  small: "btn-sm",
  medium: "btn-md",
  large: "btn-lg"
};
var iconPaddingMapping = {
  none: "",
  tiny: "icon-btn-xs",
  small: "icon-btn-sm",
  medium: "icon-btn-md",
  large: "icon-btn-lg"
};
var ButtonUtil = {
  paddingMapping,
  iconPaddingMapping
};
var SolidButton = (0, import_react7.forwardRef)(function SolidButton2({
  children,
  color = "primary",
  size = "medium",
  startIcon,
  endIcon,
  onClick,
  className,
  ...restProps
}, ref) {
  const colorClasses = {
    primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
    secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
    tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
    positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
    warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
    negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
    neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text"
  }[color];
  const iconColorClasses = {
    primary: "not-group-disabled:text-button-solid-primary-icon",
    secondary: "not-group-disabled:text-button-solid-secondary-icon",
    tertiary: "not-group-disabled:text-button-solid-tertiary-icon",
    positive: "not-group-disabled:text-button-solid-positive-icon",
    warning: "not-group-disabled:text-button-solid-warning-icon",
    negative: "not-group-disabled:text-button-solid-negative-icon",
    neutral: "not-group-disabled:text-button-solid-neutral-icon"
  }[color];
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
    "button",
    {
      ref,
      onClick,
      className: (0, import_clsx2.default)(
        "group font-semibold",
        colorClasses,
        "not-disabled:hover:brightness-90",
        "disabled:text-disabled disabled:bg-disabled-background",
        ButtonUtil.paddingMapping[size],
        className
      ),
      ...restProps,
      children: [
        startIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
          "span",
          {
            className: (0, import_clsx2.default)(
              iconColorClasses,
              "group-disabled:text-disabled-icon"
            ),
            children: startIcon
          }
        ),
        children,
        endIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
          "span",
          {
            className: (0, import_clsx2.default)(
              iconColorClasses,
              "group-disabled:text-disabled-icon"
            ),
            children: endIcon
          }
        )
      ]
    }
  );
});
var TextButton = ({
  children,
  color = "neutral",
  size = "medium",
  startIcon,
  endIcon,
  onClick,
  coloredHoverBackground = true,
  className,
  ...restProps
}) => {
  const colorClasses = {
    primary: "not-disabled:bg-transparent not-disabled:text-button-text-primary-text not-disabled:focus-visible:outline-button-text-primary-text",
    negative: "not-disabled:bg-transparent not-disabled:text-button-text-negative-text not-disabled:focus-visible:outline-button-text-negative-text",
    neutral: "not-disabled:bg-transparent not-disabled:text-button-text-neutral-text not-disabled:focus-visible:outline-button-text-neutral-text"
  }[color];
  const backgroundColor = {
    primary: "not-disabled:hover:bg-button-text-primary-text/20 not-disabled:focus-visible:bg-button-text-primary-text/20",
    negative: "not-disabled:hover:bg-button-text-negative-text/20 not-disabled:focus-visible:bg-button-text-negative-text/20",
    neutral: "not-disabled:hover:bg-button-text-neutral-text/20 not-disabled:focus-visible:bg-button-text-neutral-text/20"
  }[color];
  const iconColorClasses = {
    primary: "not-group-disabled:text-button-text-primary-icon",
    negative: "not-group-disabled:text-button-text-negative-icon",
    neutral: "not-group-disabled:text-button-text-neutral-icon"
  }[color];
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
    "button",
    {
      onClick,
      className: (0, import_clsx2.default)(
        "group font-semibold",
        "disabled:text-disabled",
        colorClasses,
        {
          [backgroundColor]: coloredHoverBackground,
          "not-disabled:hover:bg-button-text-hover-background": !coloredHoverBackground
        },
        ButtonUtil.paddingMapping[size],
        className
      ),
      ...restProps,
      children: [
        startIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
          "span",
          {
            className: (0, import_clsx2.default)(
              iconColorClasses,
              "group-disabled:text-disabled-icon"
            ),
            children: startIcon
          }
        ),
        children,
        endIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
          "span",
          {
            className: (0, import_clsx2.default)(
              iconColorClasses,
              "group-disabled:text-disabled-icon"
            ),
            children: endIcon
          }
        )
      ]
    }
  );
};
var IconButton = (0, import_react7.forwardRef)(function IconButton2({
  children,
  color = "primary",
  size = "medium",
  className,
  ...restProps
}, ref) {
  const colorClasses = {
    primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
    secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
    tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
    positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
    warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
    negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
    neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text",
    transparent: "not-disabled:bg-transparent"
  }[color];
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
    "button",
    {
      ref,
      className: (0, import_clsx2.default)(
        colorClasses,
        "not-disabled:hover:brightness-90",
        "disabled:text-disabled",
        {
          "disabled:bg-disabled-background": color !== "transparent",
          "disabled:opacity-70": color === "transparent",
          "not-disabled:hover:bg-button-text-hover-background": color === "transparent"
        },
        ButtonUtil.iconPaddingMapping[size],
        className
      ),
      ...restProps,
      children
    }
  );
});

// src/components/properties/PropertyBase.tsx
var import_jsx_runtime4 = require("react/jsx-runtime");
var PropertyBase = ({
  name,
  input,
  softRequired = false,
  hasValue,
  icon,
  readOnly,
  onRemove,
  className = ""
}) => {
  const translation = useHightideTranslation();
  const requiredAndNoValue = softRequired && !hasValue;
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx3.default)("flex-row-0 group", className), children: [
    /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
      "div",
      {
        className: (0, import_clsx3.default)(
          "flex-row-2 max-w-48 min-w-48 px-3 py-2 items-center rounded-l-xl border-2 border-r-0",
          {
            "bg-property-title-background text-property-title-text group-hover:border-primary": !requiredAndNoValue,
            "bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
          },
          className
        ),
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "max-w-6 min-w-6 text-text-primary", children: icon }),
          /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "font-semibold", children: name })
        ]
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
      "div",
      {
        className: (0, import_clsx3.default)(
          "flex-row-2 grow px-3 py-2 justify-between items-center rounded-r-xl border-2 border-l-0 min-h-15",
          {
            "bg-input-background text-input-text group-hover:border-primary": !requiredAndNoValue,
            "bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
          },
          className
        ),
        children: [
          input({ softRequired, hasValue }),
          requiredAndNoValue && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "text-warning", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.AlertTriangle, { size: 24 }) }),
          onRemove && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
            TextButton,
            {
              onClick: onRemove,
              color: "negative",
              className: (0, import_clsx3.default)("items-center"),
              disabled: !hasValue,
              children: translation("remove")
            }
          )
        ]
      }
    )
  ] });
};

// src/components/properties/NumberProperty.tsx
var import_jsx_runtime5 = require("react/jsx-runtime");
var NumberProperty = ({
  value,
  onChange,
  onRemove,
  onEditComplete,
  readOnly,
  suffix,
  ...baseProps
}) => {
  const translation = useHightideTranslation();
  const hasValue = value !== void 0;
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
    PropertyBase,
    {
      ...baseProps,
      onRemove,
      hasValue,
      icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Binary, { size: 24 }),
      input: ({ softRequired }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
        "div",
        {
          className: (0, import_clsx4.default)("flex-row-2 grow", { "text-warning": softRequired && !hasValue }),
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
              Input,
              {
                className: (0, import_clsx4.default)("!ring-0 !border-0 !outline-0 !p-0 !m-0 !w-fit !shadow-none !rounded-none", { "bg-surface-warning placeholder-warning": softRequired && !hasValue }),
                value: value?.toString() ?? "",
                type: "number",
                readOnly,
                placeholder: `${translation("value")}...`,
                onChangeText: (value2) => {
                  const numberValue = parseFloat(value2);
                  if (isNaN(numberValue)) {
                    onRemove();
                  } else {
                    onChange?.(numberValue);
                  }
                },
                onEditCompleted: (value2) => {
                  const numberValue = parseFloat(value2);
                  if (isNaN(numberValue)) {
                    onRemove();
                  } else {
                    onEditComplete(numberValue);
                  }
                }
              }
            ),
            suffix && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: (0, import_clsx4.default)("ml-1", { "bg-surface-warning": softRequired && !hasValue }), children: suffix })
          ]
        }
      )
    }
  );
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  NumberProperty
});
//# sourceMappingURL=NumberProperty.cjs.map