@tempots/beatui 0.86.1 → 0.87.0

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.
Files changed (55) hide show
  1. package/dist/auth/index.cjs.js +1 -1
  2. package/dist/auth/index.es.js +1 -1
  3. package/dist/{auth-divider-C3_CgC0l.js → auth-divider-BIefTDoO.js} +5 -5
  4. package/dist/{auth-divider-C4WTL71M.cjs → auth-divider-V_Se6Qhe.cjs} +1 -1
  5. package/dist/better-auth/index.cjs.js +1 -1
  6. package/dist/better-auth/index.es.js +4 -4
  7. package/dist/{deep-merge-CmQoIYPC.js → deep-merge-BRqRzEQs.js} +3 -3
  8. package/dist/{deep-merge-UghuPcyW.cjs → deep-merge-CvN7Xvd1.cjs} +1 -1
  9. package/dist/{duration-input-DaB6s0rL.js → duration-input-BDEb1Bb7.js} +95 -89
  10. package/dist/duration-input-BtFL5Vjx.cjs +1 -0
  11. package/dist/{editor-toolbar-group-_V1rDM-1.cjs → editor-toolbar-group-BgWLVgMZ.cjs} +1 -1
  12. package/dist/{editor-toolbar-group-BslfdazC.js → editor-toolbar-group-CwCCGzEC.js} +1 -1
  13. package/dist/{index-DfJMDwSU.js → index-B0t-nt7i.js} +1 -1
  14. package/dist/{index-BzRuy4V1.cjs → index-CaWDj1Vg.cjs} +2 -2
  15. package/dist/{index-vzoI95E1.js → index-DdqGL9Jk.js} +4 -4
  16. package/dist/{index-4GQLcxme.cjs → index-qa82MK4Z.cjs} +1 -1
  17. package/dist/index.cjs.js +1 -1
  18. package/dist/index.es.js +16 -16
  19. package/dist/input-container-B31Seozh.cjs +1 -0
  20. package/dist/input-container-DhUiLmXE.js +263 -0
  21. package/dist/json-schema/index.cjs.js +1 -1
  22. package/dist/json-schema/index.es.js +7 -7
  23. package/dist/json-structure/index.cjs.js +1 -1
  24. package/dist/json-structure/index.es.js +5 -5
  25. package/dist/lexical/index.cjs.js +1 -1
  26. package/dist/lexical/index.es.js +3 -3
  27. package/dist/{modal-kyZfvVZb.cjs → modal-Coenk8Fy.cjs} +1 -1
  28. package/dist/{modal-DaI1jH-X.js → modal-Dkje8L_l.js} +2 -2
  29. package/dist/{notice-Dz4nX57_.js → notice-BmkckDsD.js} +3 -3
  30. package/dist/{notice-Bc1L4Zpr.cjs → notice-DMK7dx9a.cjs} +1 -1
  31. package/dist/prosemirror/index.cjs.js +1 -1
  32. package/dist/prosemirror/index.es.js +1 -1
  33. package/dist/{text-input-CPJzUC2r.js → text-input-BZmAB3_o.js} +15 -15
  34. package/dist/text-input-w0eVcqk5.cjs +1 -0
  35. package/dist/{toolbar-D3ZsC0g_.cjs → toolbar-BR8In7O0.cjs} +1 -1
  36. package/dist/{toolbar-CjQG7l7X.js → toolbar-Pdj-F80l.js} +1 -1
  37. package/dist/types/components/form/input/input-container.d.ts +5 -2
  38. package/dist/types/components/form/input/input-options.d.ts +24 -2
  39. package/dist/types/components/form/input/nullable-plain-date-input.d.ts +1 -0
  40. package/dist/types/components/form/input/nullable-plain-date-time-input.d.ts +1 -0
  41. package/dist/types/components/form/input/nullable-plain-time-input.d.ts +1 -0
  42. package/dist/types/components/form/input/nullable-plain-year-month-input.d.ts +1 -0
  43. package/dist/types/components/form/input/plain-date-input.d.ts +1 -0
  44. package/dist/types/components/form/input/plain-date-time-input.d.ts +1 -0
  45. package/dist/types/components/form/input/plain-time-input.d.ts +1 -0
  46. package/dist/types/components/form/input/plain-year-month-input.d.ts +1 -0
  47. package/dist/{use-form-BurzbPVV.js → use-form-BSvvERhX.js} +1 -1
  48. package/dist/{use-form-Uree6QFy.cjs → use-form-B_mCauP0.cjs} +1 -1
  49. package/dist/{widget-customization-B9Oc1bG4.cjs → widget-customization-BASfRpF7.cjs} +1 -1
  50. package/dist/{widget-customization-Ct2eqKKR.js → widget-customization-DFr3ycD7.js} +4 -4
  51. package/package.json +2 -2
  52. package/dist/duration-input-BJzKgI15.cjs +0 -1
  53. package/dist/input-container-CSi72GI1.cjs +0 -1
  54. package/dist/input-container-Nx0gMAzS.js +0 -258
  55. package/dist/text-input-8v79fzEy.cjs +0 -1
@@ -1,31 +1,31 @@
1
1
  import { Fragment as I, attr as t, aria as c, html as f, on as o, Empty as p, emitValue as i } from "@tempots/dom";
2
- import { I as x } from "./input-container-Nx0gMAzS.js";
2
+ import { I as x } from "./input-container-DhUiLmXE.js";
3
3
  const C = ({
4
4
  autocomplete: n,
5
5
  autofocus: a,
6
- class: e,
7
- disabled: l,
8
- name: u,
6
+ classes: e,
7
+ disabled: u,
8
+ name: l,
9
9
  placeholder: r,
10
- id: s,
10
+ id: m,
11
11
  required: d,
12
12
  tabIndex: b,
13
- hasError: m
13
+ hasError: s
14
14
  }) => I(
15
15
  t.autocomplete(n),
16
16
  t.autofocus(a),
17
- t.class(e),
18
- t.disabled(l),
19
- t.name(u ?? s),
17
+ t.class(e?.input),
18
+ t.disabled(u),
19
+ t.name(l ?? m),
20
20
  t.placeholder(r),
21
- t.id(s),
21
+ t.id(m),
22
22
  c.required(d),
23
23
  t.tabindex(b),
24
- m != null ? c.invalid(
25
- m ?? !1
24
+ s != null ? c.invalid(
25
+ s ?? !1
26
26
  ) : null
27
27
  ), v = (n) => {
28
- const { value: a, onBlur: e, onChange: l, onInput: u, type: r } = n;
28
+ const { value: a, onBlur: e, onChange: u, onInput: l, type: r } = n;
29
29
  return x({
30
30
  ...n,
31
31
  input: f.input(
@@ -34,8 +34,8 @@ const C = ({
34
34
  t.value(a),
35
35
  t.class("bc-input"),
36
36
  e != null ? o.blur(i(e)) : p,
37
- l != null ? o.change(i(l)) : p,
38
- u != null ? o.input(i(u)) : p
37
+ u != null ? o.change(i(u)) : p,
38
+ l != null ? o.input(i(l)) : p
39
39
  )
40
40
  });
41
41
  };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("@tempots/dom"),s=require("./input-container-B31Seozh.cjs"),p=({autocomplete:n,autofocus:r,classes:e,disabled:u,name:a,placeholder:l,id:i,required:m,tabIndex:c,hasError:o})=>t.Fragment(t.attr.autocomplete(n),t.attr.autofocus(r),t.attr.class(e?.input),t.attr.disabled(u),t.attr.name(a??i),t.attr.placeholder(l),t.attr.id(i),t.aria.required(m),t.attr.tabindex(c),o!=null?t.aria.invalid(o??!1):null),d=n=>{const{value:r,onBlur:e,onChange:u,onInput:a,type:l}=n;return s.InputContainer({...n,input:t.html.input(t.attr.type(l??"text"),p(n),t.attr.value(r),t.attr.class("bc-input"),e!=null?t.on.blur(t.emitValue(e)):t.Empty,u!=null?t.on.change(t.emitValue(u)):t.Empty,a!=null?t.on.input(t.emitValue(a)):t.Empty)})};exports.CommonInputAttributes=p;exports.TextInput=d;
@@ -1 +1 @@
1
- "use strict";const e=require("@tempots/dom"),h=require("./input-container-CSi72GI1.cjs"),s=["button:not([disabled])",'[role="button"]:not([aria-disabled="true"])',"a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function m(...a){return e.html.div(e.attr.class("bc-toolbar"),e.attr.role("toolbar"),e.aria.orientation("horizontal"),e.WithElement(n=>{const f=()=>{const r=Array.from(n.querySelectorAll(s));r.length!==0&&r.forEach((t,o)=>t.setAttribute("tabindex",o===0?"0":"-1"))},u=r=>{const t=Array.from(n.querySelectorAll(s));if(t.length===0)return;const o=t.findIndex(c=>c===document.activeElement);let i=(o===-1?0:o)+r;i<0&&(i=t.length-1),i>=t.length&&(i=0),t.forEach(c=>c.setAttribute("tabindex","-1"));const d=t[i];d.setAttribute("tabindex","0"),d.focus()};setTimeout(f,0);const b=r=>{switch(r.key){case"ArrowRight":r.preventDefault(),u(1);break;case"ArrowLeft":r.preventDefault(),u(-1);break;case"Home":r.preventDefault(),u(-1);{const t=Array.from(n.querySelectorAll(s));if(t.length){t.forEach(l=>l.setAttribute("tabindex","-1"));const o=t[0];o.setAttribute("tabindex","0"),o.focus()}}break;case"End":r.preventDefault();{const t=Array.from(n.querySelectorAll(s));if(t.length){t.forEach(l=>l.setAttribute("tabindex","-1"));const o=t[t.length-1];o.setAttribute("tabindex","0"),o.focus()}}break}};return n.addEventListener("keydown",b),e.OnDispose(()=>{n.removeEventListener("keydown",b)})}),...a)}function v(a,...n){return h.Button({color:"neutral",roundedness:"md",variant:"light",...a},e.attr.class("bc-toolbar__button"),...n)}function A(...a){return e.html.div(e.attr.class("bc-toolbar__group"),e.attr.role("group"),...a)}function p(){return e.html.div(e.attr.class("bc-toolbar__divider"),e.attr.role("separator"),e.aria.orientation("vertical"))}function x(){return e.html.div(e.attr.class("bc-toolbar__spacer"))}exports.Toolbar=m;exports.ToolbarButton=v;exports.ToolbarDivider=p;exports.ToolbarGroup=A;exports.ToolbarSpacer=x;
1
+ "use strict";const e=require("@tempots/dom"),h=require("./input-container-B31Seozh.cjs"),s=["button:not([disabled])",'[role="button"]:not([aria-disabled="true"])',"a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function m(...a){return e.html.div(e.attr.class("bc-toolbar"),e.attr.role("toolbar"),e.aria.orientation("horizontal"),e.WithElement(n=>{const f=()=>{const r=Array.from(n.querySelectorAll(s));r.length!==0&&r.forEach((t,o)=>t.setAttribute("tabindex",o===0?"0":"-1"))},u=r=>{const t=Array.from(n.querySelectorAll(s));if(t.length===0)return;const o=t.findIndex(c=>c===document.activeElement);let i=(o===-1?0:o)+r;i<0&&(i=t.length-1),i>=t.length&&(i=0),t.forEach(c=>c.setAttribute("tabindex","-1"));const d=t[i];d.setAttribute("tabindex","0"),d.focus()};setTimeout(f,0);const b=r=>{switch(r.key){case"ArrowRight":r.preventDefault(),u(1);break;case"ArrowLeft":r.preventDefault(),u(-1);break;case"Home":r.preventDefault(),u(-1);{const t=Array.from(n.querySelectorAll(s));if(t.length){t.forEach(l=>l.setAttribute("tabindex","-1"));const o=t[0];o.setAttribute("tabindex","0"),o.focus()}}break;case"End":r.preventDefault();{const t=Array.from(n.querySelectorAll(s));if(t.length){t.forEach(l=>l.setAttribute("tabindex","-1"));const o=t[t.length-1];o.setAttribute("tabindex","0"),o.focus()}}break}};return n.addEventListener("keydown",b),e.OnDispose(()=>{n.removeEventListener("keydown",b)})}),...a)}function v(a,...n){return h.Button({color:"neutral",roundedness:"md",variant:"light",...a},e.attr.class("bc-toolbar__button"),...n)}function A(...a){return e.html.div(e.attr.class("bc-toolbar__group"),e.attr.role("group"),...a)}function p(){return e.html.div(e.attr.class("bc-toolbar__divider"),e.attr.role("separator"),e.aria.orientation("vertical"))}function x(){return e.html.div(e.attr.class("bc-toolbar__spacer"))}exports.Toolbar=m;exports.ToolbarButton=v;exports.ToolbarDivider=p;exports.ToolbarGroup=A;exports.ToolbarSpacer=x;
@@ -1,5 +1,5 @@
1
1
  import { html as c, attr as n, aria as m, WithElement as v, OnDispose as A } from "@tempots/dom";
2
- import { B as x } from "./input-container-Nx0gMAzS.js";
2
+ import { B as x } from "./input-container-DhUiLmXE.js";
3
3
  const l = [
4
4
  "button:not([disabled])",
5
5
  '[role="button"]:not([aria-disabled="true"])',
@@ -1,6 +1,7 @@
1
1
  import { TNode, Value } from '@tempots/dom';
2
2
  import { ControlSize } from '../../theme';
3
3
  import { ThemeColorName } from '../../../tokens';
4
+ import { InputClasses } from './input-options';
4
5
  /**
5
6
  * Generates CSS class names for the input element wrapper based on size and container type.
6
7
  *
@@ -46,7 +47,10 @@ export declare function generateInputContainerInputClasses(baseContainer: boolea
46
47
  * })
47
48
  * ```
48
49
  */
49
- export declare const InputContainer: ({ baseContainer, disabled, input, before, after, hasError, focusableSelector, growInput, size, }: {
50
+ export declare const InputContainer: ({ baseContainer, class: rootClass, classes, disabled, input, before, after, hasError, focusableSelector, growInput, size, }: {
51
+ baseContainer?: Value<boolean>;
52
+ class?: Value<string>;
53
+ classes?: InputClasses;
50
54
  disabled?: Value<boolean>;
51
55
  input: TNode;
52
56
  before?: TNode;
@@ -54,7 +58,6 @@ export declare const InputContainer: ({ baseContainer, disabled, input, before,
54
58
  hasError?: Value<boolean>;
55
59
  focusableSelector?: string;
56
60
  growInput?: Value<boolean>;
57
- baseContainer?: Value<boolean>;
58
61
  size?: Value<ControlSize>;
59
62
  }, ...children: TNode[]) => import("@tempots/dom").Renderable;
60
63
  /**
@@ -1,6 +1,22 @@
1
1
  import { TNode, Value } from '@tempots/dom';
2
2
  import { ControlSize } from '../../theme';
3
3
  import { Merge } from '@tempots/std';
4
+ /**
5
+ * Fine-grained CSS class targets for the three DOM levels of an input container.
6
+ *
7
+ * Use this to apply CSS classes to specific parts of the input structure:
8
+ * - `container` — the outer `div.bc-input-container` (border, background)
9
+ * - `wrapper` — the inner `div.bc-input-container__input` (padding, text size)
10
+ * - `input` — the native `<input>`, `<select>`, or `<textarea>` element
11
+ */
12
+ export type InputClasses = {
13
+ /** Classes applied to the outer container div */
14
+ container?: Value<string>;
15
+ /** Classes applied to the inner wrapper div */
16
+ wrapper?: Value<string>;
17
+ /** Classes applied to the native input/select/textarea element */
18
+ input?: Value<string>;
19
+ };
4
20
  /**
5
21
  * Common options shared across all input components in BeatUI.
6
22
  *
@@ -16,8 +32,14 @@ export type CommonInputOptions = {
16
32
  autocomplete?: Value<string>;
17
33
  /** Whether the input should automatically receive focus when mounted */
18
34
  autofocus?: Value<boolean>;
19
- /** Additional CSS classes to apply to the input element */
35
+ /** Additional CSS classes to apply to the input container root element */
20
36
  class?: Value<string>;
37
+ /**
38
+ * Fine-grained CSS class targets for each DOM level of the input.
39
+ * Use `classes.input` to style the native element, `classes.container`
40
+ * for the outer border div, and `classes.wrapper` for the inner div.
41
+ */
42
+ classes?: InputClasses;
21
43
  /** Whether the input is disabled and cannot be interacted with */
22
44
  disabled?: Value<boolean>;
23
45
  /** Whether the input has a validation error (applies error styling) */
@@ -96,4 +118,4 @@ export type InputOptions<V> = Merge<CommonInputOptions, {
96
118
  * )
97
119
  * ```
98
120
  */
99
- export declare const CommonInputAttributes: ({ autocomplete, autofocus, class: cls, disabled, name, placeholder, id, required, tabIndex, hasError, }: CommonInputOptions) => import("@tempots/dom").Renderable<import("@tempots/dom").DOMContext>;
121
+ export declare const CommonInputAttributes: ({ autocomplete, autofocus, classes, disabled, name, placeholder, id, required, tabIndex, hasError, }: CommonInputOptions) => import("@tempots/dom").Renderable<import("@tempots/dom").DOMContext>;
@@ -20,6 +20,7 @@ export declare const NullablePlainDateInput: (options: {
20
20
  autocomplete?: import("@tempots/dom").Value<string> | undefined;
21
21
  autofocus?: import("@tempots/dom").Value<boolean> | undefined;
22
22
  class?: import("@tempots/dom").Value<string> | undefined;
23
+ classes?: import("./input-options").InputClasses | undefined;
23
24
  disabled?: import("@tempots/dom").Value<boolean> | undefined;
24
25
  hasError?: import("@tempots/dom").Value<boolean> | undefined;
25
26
  name?: import("@tempots/dom").Value<string> | undefined;
@@ -20,6 +20,7 @@ export declare const NullablePlainDateTimeInput: (options: {
20
20
  autocomplete?: import("@tempots/dom").Value<string> | undefined;
21
21
  autofocus?: import("@tempots/dom").Value<boolean> | undefined;
22
22
  class?: import("@tempots/dom").Value<string> | undefined;
23
+ classes?: import("./input-options").InputClasses | undefined;
23
24
  disabled?: import("@tempots/dom").Value<boolean> | undefined;
24
25
  hasError?: import("@tempots/dom").Value<boolean> | undefined;
25
26
  name?: import("@tempots/dom").Value<string> | undefined;
@@ -20,6 +20,7 @@ export declare const NullablePlainTimeInput: (options: {
20
20
  autocomplete?: import("@tempots/dom").Value<string> | undefined;
21
21
  autofocus?: import("@tempots/dom").Value<boolean> | undefined;
22
22
  class?: import("@tempots/dom").Value<string> | undefined;
23
+ classes?: import("./input-options").InputClasses | undefined;
23
24
  disabled?: import("@tempots/dom").Value<boolean> | undefined;
24
25
  hasError?: import("@tempots/dom").Value<boolean> | undefined;
25
26
  name?: import("@tempots/dom").Value<string> | undefined;
@@ -20,6 +20,7 @@ export declare const NullablePlainYearMonthInput: (options: {
20
20
  autocomplete?: import("@tempots/dom").Value<string> | undefined;
21
21
  autofocus?: import("@tempots/dom").Value<boolean> | undefined;
22
22
  class?: import("@tempots/dom").Value<string> | undefined;
23
+ classes?: import("./input-options").InputClasses | undefined;
23
24
  disabled?: import("@tempots/dom").Value<boolean> | undefined;
24
25
  hasError?: import("@tempots/dom").Value<boolean> | undefined;
25
26
  name?: import("@tempots/dom").Value<string> | undefined;
@@ -19,6 +19,7 @@ export declare const PlainDateInput: (options: {
19
19
  autocomplete?: import("@tempots/dom").Value<string> | undefined;
20
20
  autofocus?: import("@tempots/dom").Value<boolean> | undefined;
21
21
  class?: import("@tempots/dom").Value<string> | undefined;
22
+ classes?: import("./input-options").InputClasses | undefined;
22
23
  disabled?: import("@tempots/dom").Value<boolean> | undefined;
23
24
  hasError?: import("@tempots/dom").Value<boolean> | undefined;
24
25
  name?: import("@tempots/dom").Value<string> | undefined;
@@ -19,6 +19,7 @@ export declare const PlainDateTimeInput: (options: {
19
19
  autocomplete?: import("@tempots/dom").Value<string> | undefined;
20
20
  autofocus?: import("@tempots/dom").Value<boolean> | undefined;
21
21
  class?: import("@tempots/dom").Value<string> | undefined;
22
+ classes?: import("./input-options").InputClasses | undefined;
22
23
  disabled?: import("@tempots/dom").Value<boolean> | undefined;
23
24
  hasError?: import("@tempots/dom").Value<boolean> | undefined;
24
25
  name?: import("@tempots/dom").Value<string> | undefined;
@@ -19,6 +19,7 @@ export declare const PlainTimeInput: (options: {
19
19
  autocomplete?: import("@tempots/dom").Value<string> | undefined;
20
20
  autofocus?: import("@tempots/dom").Value<boolean> | undefined;
21
21
  class?: import("@tempots/dom").Value<string> | undefined;
22
+ classes?: import("./input-options").InputClasses | undefined;
22
23
  disabled?: import("@tempots/dom").Value<boolean> | undefined;
23
24
  hasError?: import("@tempots/dom").Value<boolean> | undefined;
24
25
  name?: import("@tempots/dom").Value<string> | undefined;
@@ -19,6 +19,7 @@ export declare const PlainYearMonthInput: (options: {
19
19
  autocomplete?: import("@tempots/dom").Value<string> | undefined;
20
20
  autofocus?: import("@tempots/dom").Value<boolean> | undefined;
21
21
  class?: import("@tempots/dom").Value<string> | undefined;
22
+ classes?: import("./input-options").InputClasses | undefined;
22
23
  disabled?: import("@tempots/dom").Value<boolean> | undefined;
23
24
  hasError?: import("@tempots/dom").Value<boolean> | undefined;
24
25
  name?: import("@tempots/dom").Value<string> | undefined;
@@ -1,6 +1,6 @@
1
1
  import { Use as q, coalesce as G, aria as V, attr as c, on as M, html as m, Value as C, Empty as T, computedOf as y, When as A, dataAttr as P, TextNode as J, prop as k, Fragment as $, emitValue as Q, emitValueAsNumber as X } from "@tempots/dom";
2
2
  import { B as Y, I as z } from "./translations-BGblCUBj.js";
3
- import { B as Z, I as ee } from "./input-container-Nx0gMAzS.js";
3
+ import { B as Z, I as ee } from "./input-container-DhUiLmXE.js";
4
4
  import { M as te, L as se, i as g } from "./stack-BJgsPJ9A.js";
5
5
  import { s as j } from "./session-id-3KiilioY.js";
6
6
  const E = (s, e) => s === e || s !== s && e !== e;
@@ -1,2 +1,2 @@
1
- "use strict";const t=require("@tempots/dom"),E=require("./translations-gVgMyNno.cjs"),j=require("./input-container-CSi72GI1.cjs"),m=require("./stack-DcZ_u50f.cjs"),_=require("./session-id-B5lJMzbB.cjs"),C=(n,e)=>n===e||n!==n&&e!==e;function G({size:n="sm",icon:e="line-md:close",disabled:s,roundedness:i="full",color:r="base",onClick:o,label:l},...a){return t.Use(E.BeatUII18n,c=>{const d=t.coalesce(l,c.$.closeModal);return j.Button({variant:"text",size:n,roundedness:i,disabled:s,color:r,onClick:o},t.attr.title(d),t.aria.label(d),...a,E.Icon({icon:e,size:n??"sm"}))})}const J=n=>{const{value:e,onBlur:s,onChange:i,placeholder:r,disabled:o,id:l,checkedIcon:a,uncheckedIcon:c,iconSize:d="lg"}=n,h=l??_.sessionId("checkbox"),p=`${h}-label`,g=()=>{if(t.Value.get(o??!1))return;const u=t.Value.get(e);i?.(!u)},y=u=>{t.Value.get(o??!1)||(u.key===" "||u.key==="Enter")&&(u.preventDefault(),g())};return j.InputContainer({baseContainer:!0,growInput:!1,...n,input:t.html.span(t.attr.class("bc-checkbox-input"),t.html.span(t.attr.class("bc-checkbox-input__checkbox"),t.attr.class(t.Value.map(e,u=>u?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),t.attr.class(t.Value.map(o??!1,u=>u?"bc-checkbox-input__checkbox--disabled":"")),t.attr.id(h),t.attr.role("checkbox"),t.attr.tabindex(t.Value.map(o??!1,u=>u?-1:0)),t.aria.checked(e),t.aria.disabled(o),r!=null?t.aria.labelledby(p):t.Empty,t.on.keydown(y),s!=null?t.on.blur(s):t.Empty,E.Icon({icon:t.computedOf(e,a,c)((u,f,v)=>u?f??"akar-icons/check-box-fill":v??"akar-icons/box"),accessibility:"decorative",size:d})),r!=null?t.html.label(t.attr.class("bc-checkbox-input__label"),t.attr.id(p),t.attr.for(h),m.MutedLabel(r)):t.Empty)},t.on.click(g))},P=t.html.span(t.attr.class("bc-input-wrapper__required")," *");function Q(n){const e=["bc-input-wrapper"];return n!=="vertical"&&e.push(`bc-input-wrapper--${n}`),e.join(" ")}function X(n,e){const s=["bc-input-wrapper__label-text"];return n?s.push("bc-input-wrapper__label-text--error"):e?s.push("bc-input-wrapper__label-text--disabled"):s.push("bc-input-wrapper__label-text--default"),s.join(" ")}function Y(n,e){if(n==="horizontal-fixed"&&e!=null)return`--input-wrapper-label-width: ${e}`}const M=({fullWidth:n=!1,required:e,label:s,labelChildren:i,context:r,description:o,content:l,error:a,labelFor:c,hasError:d,disabled:h,layout:p,labelWidth:g},...y)=>{const u=d??a!=null,f=h??!1,v=p??"vertical",D=_.sessionId("input-wrapper"),I=o?`${D}-description`:void 0,V=a!=null?`${D}-error`:void 0,B=t.computedOf(v)(b=>b!=="vertical"),K=t.computedOf(v,g??void 0)((b,w)=>Y(b,w));return t.html.div(t.attr.class(t.Value.map(v,b=>Q(b))),t.attr.class(t.Value.map(n,b=>b?"bc-input-wrapper--full-width":"")),t.attr.style(K),s!=null||r!=null?t.html.div(t.attr.class("bc-input-wrapper__header"),t.html.div(t.attr.class("bc-input-wrapper__label-section"),t.html.label(t.attr.class("bc-input-wrapper__label"),c!=null?t.attr.for(c):t.Empty,t.html.span(t.attr.class(t.computedOf(u,f)((b,w)=>X(b??!1,w??!1))),s),s!=null&&e?P:t.Empty),t.When(t.computedOf(B,o)((b,w)=>b&&w!=null),()=>t.html.div(t.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),t.attr.id(I),o))),r!=null?m.Label(r):t.Empty,i):t.Empty,t.html.div(t.attr.class("bc-input-wrapper__content"),[I,V].filter(Boolean).length>0?t.dataAttr.describedby([I,V].filter(Boolean).join(" ")):t.Empty,e?t.dataAttr.required("true"):t.Empty,t.When(u,()=>t.dataAttr.invalid("true")),l),t.When(t.computedOf(B,o)((b,w)=>!b&&w!=null),()=>t.html.div(t.attr.class("bc-input-wrapper__description"),t.attr.id(I),o)),t.When(u,()=>t.html.div(t.attr.class("bc-input-wrapper__error"),t.attr.id(V),t.aria.live("polite"),t.attr.role("alert"),a)),...y)},H=((n,e)=>()=>{n.markTouched(),e?.()}),O=(n,e)=>s=>{n.change(s),e?.(s)};function x(n,e){const{controller:s,onBlur:i,onChange:r,id:o,triggerOn:l,...a}=e;return n({id:o??s.name,disabled:s.disabled,value:s.signal,hasError:s.errorVisible,name:s.name,...a,onInput:l==="input"?O(s,r):void 0,onChange:l!=="input"?O(s,r):void 0,onBlur:H(s,i)})}function Z(n,{id:e,labelFor:s,...i},...r){const o=e??i.controller.name??_.sessionId("control"),l=s??o;return M({...i,hasError:i.controller.errorVisible,error:t.TextNode(i.controller.error.map(a=>a??"")),labelFor:l,content:x(a=>n({...a,id:o}),i)},...r)}function F(n,e){const{toInput:s,fromInput:i,controller:r,...o}=e,l=r.transform(s,i);return x(n,{...o,controller:l})}function ee(n,{id:e,labelFor:s,...i},...r){const o=e??i.controller.name??_.sessionId("control");return M({...i,labelFor:s??o,content:F(n,{...i,id:o})},...r)}function te(n){return n.split(".").map(s=>{const i=s.match(/^\[(\d+)\]$/);return i?Number(i[1]):s})}function $(n){return typeof n=="number"?`[${n}]`:`.${n}`}function W(n){if(n.length===0)return"";const[e,...s]=n;return[typeof e=="number"?`[${e}]`:e,...s.map($)].join("")}const se={valid:m.i.valid,invalid(n){return m.i.invalid({message:n})},invalidFields(n){const e={};for(const[s,i]of Object.entries(n))e[s]=typeof i=="string"?{message:i}:i;return m.i.invalid({dependencies:e})},fromError(n){return m.i.invalid(n)}};function T(n){return function(s){if(s.type==="valid")return s;let i=s.error;for(const r of n)if(i=i?.dependencies?.[r],i==null)return m.i.valid;return m.i.invalid(i)}}class k{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:t.prop(!1),touched:t.prop(!1)};#s;#t=t.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(e,s,i,r,o,l=C){this.path=e,this.change=s,this.signal=i,this.status=r,this.#s=l,this.#t.set(i.value),this.error=r.map(a=>a?.type==="invalid"?a.error?.message:void 0),this.hasError=this.error.map(a=>a!=null),this.touched=this.#e.touched,o.validationMode?this.errorVisible=t.computedOf(this.hasError,this.touched,o.validationMode)((a,c,d)=>d==="eager"?!!a:!!a&&!!c):this.errorVisible=t.computedOf(this.hasError,this.touched)((a,c)=>!!a&&!!c),this.dirty=t.computedOf(this.signal,this.#t)((a,c)=>!this.#s(a,c)),this.dependencyErrors=r.map(a=>a?.type==="invalid"?a.error?.dependencies:void 0),this.parent=o,this.disabled=t.computedOf(this.#e.disabled,o.disabled)((a,c)=>a||c),this.disabledOrHasErrors=t.computedOf(this.disabled,this.hasError)((a,c)=>a||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return W(this.path)}onDispose=e=>{this.#n.push(e)};dispose=()=>{for(const e of this.#n)try{e()}catch(s){console.error("Error in dispose callback:",s)}this.#n.length=0};setDisabled=e=>{this.#e.disabled.set(e)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(e=C)=>new q(this.path,this.change,this.signal,this.status,this.parent,e);object=(e=C)=>new N(this.path,this.change,this.signal,this.status,this.parent,e);transform=(e,s,i=[],r=C)=>new k([...this.path,...i],o=>this.change(s(o)),this.signal.map(e,r),this.status.map(T(i)),this.parent,r);asyncTransform=(e,s,i,r=[],o=C)=>new k([...this.path,...r],l=>{s(l).then(a=>this.change(a))},this.signal.mapAsync(e,i,void 0,o),this.status.map(T(r)),this.parent,o)}class N extends k{#e=new Map;#s=new Map;#t=new Map;#n=t.prop(!1);touchedDeep=this.#n;#r=new Map;#i=new Map;#o=t.prop(!1);dirtyDeep=this.#o;#c;#h;#l=()=>{let e=!1;for(const s of this.#s.values())if(s){e=!0;break}this.#n.set(this.touched.value||e)};constructor(e,s,i,r,o,l){super(e,s,i.map(c=>c??{},l),r,o,l),this.#c=this.touched.on(()=>{this.#l()}),this.#h=this.dirty.on(()=>{this.#a()});const a=this.signal.on(()=>this.#a());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#i.values())c();this.#i.clear(),this.#r.clear(),this.#o.dispose(),this.#c(),this.#h(),a()})}field=e=>{if(this.#e.has(e))return this.#e.get(e);const s=async l=>{this.change({...this.signal.value,[e]:l})},i=new k([...this.path,e],s,this.signal.map(l=>l[e]),this.status.map(T([e])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(e,i);const r=i.touched.on(l=>{this.#s.set(e,l),this.#l()});this.#t.set(e,r);const o=i.dirty.on(l=>{this.#r.set(e,l),this.#a()});return this.#i.set(e,o),i};markAllTouched=()=>{this.markTouched();const e=this.signal.value;for(const s of Object.keys(e))this.field(s).markTouched();for(const s of this.#e.values())s.markTouched()};markAllPristine=()=>{this.markPristine();const e=this.signal.value;for(const s of Object.keys(e))this.field(s).markPristine?.();for(const s of this.#e.values())s.markPristine?.()};#a=()=>{let e=!1;for(const s of this.#r.values())if(s){e=!0;break}this.#o.set(this.dirty.value||e)}}class q extends k{#e=new Array;length;#s=new Map;#t=new Map;#n=t.prop(!1);touchedDeep=this.#n;#r=new Map;#i=new Map;#o=t.prop(!1);dirtyDeep=this.#o;#c;#h;#l=()=>{let e=!1;for(const s of this.#s.values())if(s){e=!0;break}this.#n.set(this.touched.value||e)};constructor(e,s,i,r,o,l){const a=i.map(h=>h??[],l);super(e,s,a,r,o,l);const c=a.on(h=>{const p=this.#e.length-h.length;p>0&&(this.#e.splice(h.length,p).forEach((g,y)=>{const u=h.length+y;g.dispose(),this.#t.get(u)?.(),this.#t.delete(u),this.#s.delete(u),this.#i.get(u)?.(),this.#i.delete(u),this.#r.delete(u)}),this.#l(),this.#a())});this.length=a.map(h=>h.length),this.#c=this.touched.on(()=>{this.#l()}),this.#h=this.dirty.on(()=>{this.#a()});const d=this.signal.on(()=>this.#a());this.onDispose(()=>{for(const h of this.#e)h.dispose();this.length.dispose(),this.#e.length=0,c(),a.dispose();for(const h of this.#t.values())h();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const h of this.#i.values())h();this.#i.clear(),this.#r.clear(),this.#o.dispose(),this.#c(),this.#h(),d()})}item=e=>{if(this.#e[e])return this.#e[e];const s=async l=>{const a=this.signal.value.slice();a[e]=l,this.change(a)},i=new k([...this.path,e],s,this.signal.map(l=>l[e]),this.status.map(T([e])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[e]=i;const r=i.touched.on(l=>{this.#s.set(e,l),this.#l()});this.#t.set(e,r);const o=i.dirty.on(l=>{this.#r.set(e,l),this.#a()});return this.#i.set(e,o),i};push=(...e)=>{this.change([...this.signal.value,...e])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...e)=>{this.change([...e,...this.signal.value])};removeAt=e=>{this.splice(e,1)};splice=(e,s)=>{const i=this.signal.value.slice();i.splice(e,s),this.change(i)};move=(e,s,i=1)=>{if(i<1||e===s)return;const r=this.signal.value.slice(),o=r.splice(e,i);r.splice(s,0,...o),this.change(r)};markAllTouched=()=>{this.markTouched();const e=this.signal.value.length;for(let s=0;s<e;s++)this.item(s).markTouched()};markAllPristine=()=>{this.markPristine();const e=this.signal.value.length;for(let s=0;s<e;s++)this.item(s).markPristine?.()};#a=()=>{let e=!1;for(const s of this.#r.values())if(s){e=!0;break}this.#o.set(this.dirty.value||e)}}function z(n){function e(s){return typeof s=="number"?s:s.toString()}return n.map(s=>typeof s=="object"&&s.key!=null?e(s.key):e(s))}function L(n){const e=n.filter(r=>r.path==null||r.path.length===0).map(r=>r.message),s=n.filter(r=>r.path!=null&&r.path.length>0).reduce((r,o)=>{const l=z(o.path),a=l.pop();let c=r;for(const d of l)c.dependencies==null&&(c.dependencies={}),c.dependencies[d]==null&&(c.dependencies[d]={}),c=c.dependencies[d];return c.dependencies==null&&(c.dependencies={}),c.dependencies[a]={message:o.message},r},{}),i=e.join(`
1
+ "use strict";const t=require("@tempots/dom"),E=require("./translations-gVgMyNno.cjs"),j=require("./input-container-B31Seozh.cjs"),m=require("./stack-DcZ_u50f.cjs"),_=require("./session-id-B5lJMzbB.cjs"),C=(n,e)=>n===e||n!==n&&e!==e;function G({size:n="sm",icon:e="line-md:close",disabled:s,roundedness:i="full",color:r="base",onClick:o,label:l},...a){return t.Use(E.BeatUII18n,c=>{const d=t.coalesce(l,c.$.closeModal);return j.Button({variant:"text",size:n,roundedness:i,disabled:s,color:r,onClick:o},t.attr.title(d),t.aria.label(d),...a,E.Icon({icon:e,size:n??"sm"}))})}const J=n=>{const{value:e,onBlur:s,onChange:i,placeholder:r,disabled:o,id:l,checkedIcon:a,uncheckedIcon:c,iconSize:d="lg"}=n,h=l??_.sessionId("checkbox"),p=`${h}-label`,g=()=>{if(t.Value.get(o??!1))return;const u=t.Value.get(e);i?.(!u)},y=u=>{t.Value.get(o??!1)||(u.key===" "||u.key==="Enter")&&(u.preventDefault(),g())};return j.InputContainer({baseContainer:!0,growInput:!1,...n,input:t.html.span(t.attr.class("bc-checkbox-input"),t.html.span(t.attr.class("bc-checkbox-input__checkbox"),t.attr.class(t.Value.map(e,u=>u?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),t.attr.class(t.Value.map(o??!1,u=>u?"bc-checkbox-input__checkbox--disabled":"")),t.attr.id(h),t.attr.role("checkbox"),t.attr.tabindex(t.Value.map(o??!1,u=>u?-1:0)),t.aria.checked(e),t.aria.disabled(o),r!=null?t.aria.labelledby(p):t.Empty,t.on.keydown(y),s!=null?t.on.blur(s):t.Empty,E.Icon({icon:t.computedOf(e,a,c)((u,f,v)=>u?f??"akar-icons/check-box-fill":v??"akar-icons/box"),accessibility:"decorative",size:d})),r!=null?t.html.label(t.attr.class("bc-checkbox-input__label"),t.attr.id(p),t.attr.for(h),m.MutedLabel(r)):t.Empty)},t.on.click(g))},P=t.html.span(t.attr.class("bc-input-wrapper__required")," *");function Q(n){const e=["bc-input-wrapper"];return n!=="vertical"&&e.push(`bc-input-wrapper--${n}`),e.join(" ")}function X(n,e){const s=["bc-input-wrapper__label-text"];return n?s.push("bc-input-wrapper__label-text--error"):e?s.push("bc-input-wrapper__label-text--disabled"):s.push("bc-input-wrapper__label-text--default"),s.join(" ")}function Y(n,e){if(n==="horizontal-fixed"&&e!=null)return`--input-wrapper-label-width: ${e}`}const M=({fullWidth:n=!1,required:e,label:s,labelChildren:i,context:r,description:o,content:l,error:a,labelFor:c,hasError:d,disabled:h,layout:p,labelWidth:g},...y)=>{const u=d??a!=null,f=h??!1,v=p??"vertical",D=_.sessionId("input-wrapper"),I=o?`${D}-description`:void 0,V=a!=null?`${D}-error`:void 0,B=t.computedOf(v)(b=>b!=="vertical"),K=t.computedOf(v,g??void 0)((b,w)=>Y(b,w));return t.html.div(t.attr.class(t.Value.map(v,b=>Q(b))),t.attr.class(t.Value.map(n,b=>b?"bc-input-wrapper--full-width":"")),t.attr.style(K),s!=null||r!=null?t.html.div(t.attr.class("bc-input-wrapper__header"),t.html.div(t.attr.class("bc-input-wrapper__label-section"),t.html.label(t.attr.class("bc-input-wrapper__label"),c!=null?t.attr.for(c):t.Empty,t.html.span(t.attr.class(t.computedOf(u,f)((b,w)=>X(b??!1,w??!1))),s),s!=null&&e?P:t.Empty),t.When(t.computedOf(B,o)((b,w)=>b&&w!=null),()=>t.html.div(t.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),t.attr.id(I),o))),r!=null?m.Label(r):t.Empty,i):t.Empty,t.html.div(t.attr.class("bc-input-wrapper__content"),[I,V].filter(Boolean).length>0?t.dataAttr.describedby([I,V].filter(Boolean).join(" ")):t.Empty,e?t.dataAttr.required("true"):t.Empty,t.When(u,()=>t.dataAttr.invalid("true")),l),t.When(t.computedOf(B,o)((b,w)=>!b&&w!=null),()=>t.html.div(t.attr.class("bc-input-wrapper__description"),t.attr.id(I),o)),t.When(u,()=>t.html.div(t.attr.class("bc-input-wrapper__error"),t.attr.id(V),t.aria.live("polite"),t.attr.role("alert"),a)),...y)},H=((n,e)=>()=>{n.markTouched(),e?.()}),O=(n,e)=>s=>{n.change(s),e?.(s)};function x(n,e){const{controller:s,onBlur:i,onChange:r,id:o,triggerOn:l,...a}=e;return n({id:o??s.name,disabled:s.disabled,value:s.signal,hasError:s.errorVisible,name:s.name,...a,onInput:l==="input"?O(s,r):void 0,onChange:l!=="input"?O(s,r):void 0,onBlur:H(s,i)})}function Z(n,{id:e,labelFor:s,...i},...r){const o=e??i.controller.name??_.sessionId("control"),l=s??o;return M({...i,hasError:i.controller.errorVisible,error:t.TextNode(i.controller.error.map(a=>a??"")),labelFor:l,content:x(a=>n({...a,id:o}),i)},...r)}function F(n,e){const{toInput:s,fromInput:i,controller:r,...o}=e,l=r.transform(s,i);return x(n,{...o,controller:l})}function ee(n,{id:e,labelFor:s,...i},...r){const o=e??i.controller.name??_.sessionId("control");return M({...i,labelFor:s??o,content:F(n,{...i,id:o})},...r)}function te(n){return n.split(".").map(s=>{const i=s.match(/^\[(\d+)\]$/);return i?Number(i[1]):s})}function $(n){return typeof n=="number"?`[${n}]`:`.${n}`}function W(n){if(n.length===0)return"";const[e,...s]=n;return[typeof e=="number"?`[${e}]`:e,...s.map($)].join("")}const se={valid:m.i.valid,invalid(n){return m.i.invalid({message:n})},invalidFields(n){const e={};for(const[s,i]of Object.entries(n))e[s]=typeof i=="string"?{message:i}:i;return m.i.invalid({dependencies:e})},fromError(n){return m.i.invalid(n)}};function T(n){return function(s){if(s.type==="valid")return s;let i=s.error;for(const r of n)if(i=i?.dependencies?.[r],i==null)return m.i.valid;return m.i.invalid(i)}}class k{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:t.prop(!1),touched:t.prop(!1)};#s;#t=t.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(e,s,i,r,o,l=C){this.path=e,this.change=s,this.signal=i,this.status=r,this.#s=l,this.#t.set(i.value),this.error=r.map(a=>a?.type==="invalid"?a.error?.message:void 0),this.hasError=this.error.map(a=>a!=null),this.touched=this.#e.touched,o.validationMode?this.errorVisible=t.computedOf(this.hasError,this.touched,o.validationMode)((a,c,d)=>d==="eager"?!!a:!!a&&!!c):this.errorVisible=t.computedOf(this.hasError,this.touched)((a,c)=>!!a&&!!c),this.dirty=t.computedOf(this.signal,this.#t)((a,c)=>!this.#s(a,c)),this.dependencyErrors=r.map(a=>a?.type==="invalid"?a.error?.dependencies:void 0),this.parent=o,this.disabled=t.computedOf(this.#e.disabled,o.disabled)((a,c)=>a||c),this.disabledOrHasErrors=t.computedOf(this.disabled,this.hasError)((a,c)=>a||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return W(this.path)}onDispose=e=>{this.#n.push(e)};dispose=()=>{for(const e of this.#n)try{e()}catch(s){console.error("Error in dispose callback:",s)}this.#n.length=0};setDisabled=e=>{this.#e.disabled.set(e)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(e=C)=>new q(this.path,this.change,this.signal,this.status,this.parent,e);object=(e=C)=>new N(this.path,this.change,this.signal,this.status,this.parent,e);transform=(e,s,i=[],r=C)=>new k([...this.path,...i],o=>this.change(s(o)),this.signal.map(e,r),this.status.map(T(i)),this.parent,r);asyncTransform=(e,s,i,r=[],o=C)=>new k([...this.path,...r],l=>{s(l).then(a=>this.change(a))},this.signal.mapAsync(e,i,void 0,o),this.status.map(T(r)),this.parent,o)}class N extends k{#e=new Map;#s=new Map;#t=new Map;#n=t.prop(!1);touchedDeep=this.#n;#r=new Map;#i=new Map;#o=t.prop(!1);dirtyDeep=this.#o;#c;#h;#l=()=>{let e=!1;for(const s of this.#s.values())if(s){e=!0;break}this.#n.set(this.touched.value||e)};constructor(e,s,i,r,o,l){super(e,s,i.map(c=>c??{},l),r,o,l),this.#c=this.touched.on(()=>{this.#l()}),this.#h=this.dirty.on(()=>{this.#a()});const a=this.signal.on(()=>this.#a());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#i.values())c();this.#i.clear(),this.#r.clear(),this.#o.dispose(),this.#c(),this.#h(),a()})}field=e=>{if(this.#e.has(e))return this.#e.get(e);const s=async l=>{this.change({...this.signal.value,[e]:l})},i=new k([...this.path,e],s,this.signal.map(l=>l[e]),this.status.map(T([e])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(e,i);const r=i.touched.on(l=>{this.#s.set(e,l),this.#l()});this.#t.set(e,r);const o=i.dirty.on(l=>{this.#r.set(e,l),this.#a()});return this.#i.set(e,o),i};markAllTouched=()=>{this.markTouched();const e=this.signal.value;for(const s of Object.keys(e))this.field(s).markTouched();for(const s of this.#e.values())s.markTouched()};markAllPristine=()=>{this.markPristine();const e=this.signal.value;for(const s of Object.keys(e))this.field(s).markPristine?.();for(const s of this.#e.values())s.markPristine?.()};#a=()=>{let e=!1;for(const s of this.#r.values())if(s){e=!0;break}this.#o.set(this.dirty.value||e)}}class q extends k{#e=new Array;length;#s=new Map;#t=new Map;#n=t.prop(!1);touchedDeep=this.#n;#r=new Map;#i=new Map;#o=t.prop(!1);dirtyDeep=this.#o;#c;#h;#l=()=>{let e=!1;for(const s of this.#s.values())if(s){e=!0;break}this.#n.set(this.touched.value||e)};constructor(e,s,i,r,o,l){const a=i.map(h=>h??[],l);super(e,s,a,r,o,l);const c=a.on(h=>{const p=this.#e.length-h.length;p>0&&(this.#e.splice(h.length,p).forEach((g,y)=>{const u=h.length+y;g.dispose(),this.#t.get(u)?.(),this.#t.delete(u),this.#s.delete(u),this.#i.get(u)?.(),this.#i.delete(u),this.#r.delete(u)}),this.#l(),this.#a())});this.length=a.map(h=>h.length),this.#c=this.touched.on(()=>{this.#l()}),this.#h=this.dirty.on(()=>{this.#a()});const d=this.signal.on(()=>this.#a());this.onDispose(()=>{for(const h of this.#e)h.dispose();this.length.dispose(),this.#e.length=0,c(),a.dispose();for(const h of this.#t.values())h();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const h of this.#i.values())h();this.#i.clear(),this.#r.clear(),this.#o.dispose(),this.#c(),this.#h(),d()})}item=e=>{if(this.#e[e])return this.#e[e];const s=async l=>{const a=this.signal.value.slice();a[e]=l,this.change(a)},i=new k([...this.path,e],s,this.signal.map(l=>l[e]),this.status.map(T([e])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[e]=i;const r=i.touched.on(l=>{this.#s.set(e,l),this.#l()});this.#t.set(e,r);const o=i.dirty.on(l=>{this.#r.set(e,l),this.#a()});return this.#i.set(e,o),i};push=(...e)=>{this.change([...this.signal.value,...e])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...e)=>{this.change([...e,...this.signal.value])};removeAt=e=>{this.splice(e,1)};splice=(e,s)=>{const i=this.signal.value.slice();i.splice(e,s),this.change(i)};move=(e,s,i=1)=>{if(i<1||e===s)return;const r=this.signal.value.slice(),o=r.splice(e,i);r.splice(s,0,...o),this.change(r)};markAllTouched=()=>{this.markTouched();const e=this.signal.value.length;for(let s=0;s<e;s++)this.item(s).markTouched()};markAllPristine=()=>{this.markPristine();const e=this.signal.value.length;for(let s=0;s<e;s++)this.item(s).markPristine?.()};#a=()=>{let e=!1;for(const s of this.#r.values())if(s){e=!0;break}this.#o.set(this.dirty.value||e)}}function z(n){function e(s){return typeof s=="number"?s:s.toString()}return n.map(s=>typeof s=="object"&&s.key!=null?e(s.key):e(s))}function L(n){const e=n.filter(r=>r.path==null||r.path.length===0).map(r=>r.message),s=n.filter(r=>r.path!=null&&r.path.length>0).reduce((r,o)=>{const l=z(o.path),a=l.pop();let c=r;for(const d of l)c.dependencies==null&&(c.dependencies={}),c.dependencies[d]==null&&(c.dependencies[d]={}),c=c.dependencies[d];return c.dependencies==null&&(c.dependencies={}),c.dependencies[a]={message:o.message},r},{}),i=e.join(`
2
2
  `);return{...s,message:i!=""?i:void 0}}function R({initialValue:n,onChange:e,validate:s,equals:i,validationMode:r,validateDebounceMs:o}){const l=t.Value.deriveProp(n),a=t.prop(m.i.valid),c=t.prop(!1),d=t.prop(r??"onTouched"),h=f=>{a.set(f)};let p;const g=async f=>{if(s!=null){const v=await s(f);h(v)}},y=async f=>{l.set(f),e?.(f);const v=d.value;if(s!=null){if(v==="onSubmit")return;const D=o??0;D>0?(p&&clearTimeout(p),p=setTimeout(()=>{g(f)},D)):await g(f)}},u=new k([],y,l,a,{disabled:c,validationMode:d},i??C);return u.onDispose(()=>{c.dispose(),l.dispose(),a.dispose(),d.dispose(),p&&clearTimeout(p)}),{controller:u,setStatus:h}}function A(n){return t.Fragment(t.attr.disabled(n.disabled),t.attr.name(n.name))}function ne(n,{triggerOn:e="change"}={}){return t.Fragment(A(n),t.attr.value(n.signal),(e==="input"?t.on.input:t.on.change)(t.emitValue(n.change)))}function ie(n,{triggerOn:e="change"}={}){return t.Fragment(A(n),t.attr.valueAsNumber(n.signal),(e==="input"?t.on.input:t.on.change)(t.emitValueAsNumber(n.change)))}function S(n){return n.issues!=null?m.i.invalid(L(n.issues)):m.i.valid}async function re({task:n,errorMessage:e,errorPath:s=["root"],validation:i}){try{const r=await n();return i!=null?i(r):m.i.valid}catch(r){const o=e??(r instanceof Error?r.message:"Operation failed");return s.length===1&&s[0]==="root"?m.i.invalid({message:o}):m.i.invalid({dependencies:U(s,o)})}}function U(n,e){if(n.length===1)return{[n[0]]:{message:e}};const[s,...i]=n;return{[s]:{dependencies:U(i,e)}}}function ae({initialValue:n={},schema:e,onSubmit:s=async()=>m.i.valid,validationMode:i,validateDebounceMs:r}){const{controller:o,setStatus:l}=R({initialValue:n,validationMode:i??"onTouched",validateDebounceMs:r,validate:(i??"onTouched")==="onSubmit"||e==null?void 0:async h=>S(await e["~standard"].validate(h))}),a=t.prop(!1),c=o.object();return c.onDispose(a.dispose),{controller:c,setStatus:l,submit:async h=>{if(a.set(!0),h?.preventDefault(),c.markAllTouched(),e!=null){const g=c.signal.value,y=S(await e["~standard"].validate(g));if(l(y),y.type==="invalid"){a.set(!1);return}}const p=await s(c.signal.value);a.set(!1),p.type==="invalid"&&l(p)},submitting:a}}exports.ArrayController=q;exports.BaseControl=x;exports.BaseMappedControl=F;exports.CheckboxInput=J;exports.CloseButton=G;exports.Control=Z;exports.Controller=k;exports.ControllerValidation=se;exports.InputWrapper=M;exports.MappedControl=ee;exports.O=C;exports.ObjectController=N;exports.RequiredSymbol=P;exports.connectCommonAttributes=A;exports.connectNumberInput=ie;exports.connectStringInput=ne;exports.convertStandardSchemaIssues=L;exports.convertStandardSchemaPathToPath=z;exports.makeMapValidation=T;exports.makeOnBlurHandler=H;exports.makeOnChangeHandler=O;exports.parsePath=te;exports.pathToString=W;exports.standardSchemaResultToValidation=S;exports.taskToValidation=re;exports.useController=R;exports.useForm=ae;exports.wrapSegment=$;
@@ -1 +1 @@
1
- "use strict";const t=require("@tempots/dom"),k=require("./deep-merge-UghuPcyW.cjs"),ct=require("./string-B9vVyfq3.cjs"),D=require("./input-container-CSi72GI1.cjs"),S=require("./text-input-8v79fzEy.cjs"),N=require("./translations-gVgMyNno.cjs"),ut=require("@tempots/ui"),z=require("./notice-Bc1L4Zpr.cjs"),pt=require("./session-id-B5lJMzbB.cjs"),dt=require("./utils-DIUEhA-Z.cjs");function q(e){if(typeof e!="string")return!1;const n=e.startsWith("#")?e.slice(1):e;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function X(e){if(typeof e!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s]=r,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(s,10);return l>=0&&l<=255&&i>=0&&i<=255&&c>=0&&c<=255}function Y(e){if(typeof e!="string")return!1;const n=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s,l]=r,i=parseInt(a,10),c=parseInt(o,10),u=parseInt(s,10),p=parseFloat(l);return i>=0&&i<=255&&c>=0&&c<=255&&u>=0&&u<=255&&p>=0&&p<=1}function G(e){if(typeof e!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s]=r,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(s,10);return l>=0&&l<=360&&i>=0&&i<=100&&c>=0&&c<=100}function gt(e){return q(e)||X(e)||Y(e)||G(e)}function K(e){if(!q(e))return null;let n=e.startsWith("#")?e.slice(1):e;return n.length===3&&(n=n.split("").map(r=>r+r).join("")),`#${n.toLowerCase()}`}function W(e,n,r){const a=o=>{const s=Math.round(Math.max(0,Math.min(255,o))).toString(16);return s.length===1?"0"+s:s};return`#${a(e)}${a(n)}${a(r)}`}function E(e){const n=K(e);if(!n)return null;const r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function ht(e,n){const r=E(e),a=E(n);if(!r||!a)return null;const o=(u,p,h)=>{const[m,d,b]=[u,p,h].map(I=>(I=I/255,I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4)));return .2126*m+.7152*d+.0722*b},s=o(r.r,r.g,r.b),l=o(a.r,a.g,a.b),i=Math.max(s,l),c=Math.min(s,l);return(i+.05)/(c+.05)}function Q(e){if(!e)return[0,0,0,1];const r=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(r){const u=r[1];if(u.length===8){const p=parseInt(u.slice(0,2),16),h=parseInt(u.slice(2,4),16),m=parseInt(u.slice(4,6),16),d=parseInt(u.slice(6,8),16)/255;return[p,h,m,d]}if(u.length===6)return[parseInt(u.slice(0,2),16),parseInt(u.slice(2,4),16),parseInt(u.slice(4,6),16),1];if(u.length===4){const p=parseInt(u[0]+u[0],16),h=parseInt(u[1]+u[1],16),m=parseInt(u[2]+u[2],16),d=parseInt(u[3]+u[3],16)/255;return[p,h,m,d]}if(u.length===3){const p=parseInt(u[0]+u[0],16),h=parseInt(u[1]+u[1],16),m=parseInt(u[2]+u[2],16);return[p,h,m,1]}}const a=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(a)return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];const o=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(o)return[parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10),1];const s=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(s){const u=parseFloat(s[1]),p=parseFloat(s[2]),h=parseFloat(s[3]),m=s[4]!=null?parseFloat(s[4]):1,[d,b,I]=j(u,p/100,h/100);return[d,b,I,m]}const l=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(l){const u=parseFloat(l[1]),p=parseFloat(l[2])/100,h=parseFloat(l[3])/100,m=l[4]!=null?parseFloat(l[4]):1,[d,b,I]=tt(u,p,h);return[d,b,I,m]}const i=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(i){const u=i[1],p=parseFloat(i[2]),h=parseFloat(i[3]),m=i[4]!=null?parseFloat(i[4]):1,d=u.endsWith("%")?Math.max(0,Math.min(1,parseFloat(u)/100)):Math.max(0,Math.min(1,parseFloat(u))),[b,I,V]=nt(d,p,h);return[b,I,V,m]}const c=E(e);return c?[c.r,c.g,c.b,1]:[0,0,0,1]}function Z(e,n,r,a){return`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(r)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`}function J(e){let n=e+1831565813;return function(){return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function j(e,n,r){e=(e%360+360)%360;const a=(1-Math.abs(2*r-1))*n,o=a*(1-Math.abs(e/60%2-1)),s=r-a/2;let l=0,i=0,c=0;return 0<=e&&e<60?[l,i,c]=[a,o,0]:60<=e&&e<120?[l,i,c]=[o,a,0]:120<=e&&e<180?[l,i,c]=[0,a,o]:180<=e&&e<240?[l,i,c]=[0,o,a]:240<=e&&e<300?[l,i,c]=[o,0,a]:[l,i,c]=[a,0,o],[Math.round((l+s)*255),Math.round((i+s)*255),Math.round((c+s)*255)]}function tt(e,n,r){e=(e%360+360)%360;const a=n+r;a>1&&(n/=a,r/=a);const[o,s,l]=j(e,1,.5).map(h=>h/255),i=1-n-r,c=o*i+n,u=s*i+n,p=l*i+n;return[Math.round(c*255),Math.round(u*255),Math.round(p*255)]}function H(e,n,r){e/=255,n/=255,r/=255;const a=Math.max(e,n,r),o=Math.min(e,n,r);let s=0,l=0;const i=(a+o)/2,c=a-o;if(c!==0){switch(l=i>.5?c/(2-a-o):c/(a+o),a){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;default:s=(e-n)/c+4}s*=60}return[Math.round(s),Math.round(l*100),Math.round(i*100)]}function et(e,n,r){const[a]=H(e,n,r),o=e/255,s=n/255,l=r/255,i=Math.min(o,s,l),c=1-Math.max(o,s,l);return[a,Math.round(i*100),Math.round(c*100)]}function O(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function U(e){const n=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function nt(e,n,r){const a=r*Math.PI/180,o=Math.cos(a)*n,s=Math.sin(a)*n,l=e+.3963377774*o+.2158037573*s,i=e-.1055613458*o-.0638541728*s,c=e-.0894841775*o-1.291485548*s,u=l*l*l,p=i*i*i,h=c*c*c,m=4.0767416621*u-3.3077115913*p+.2309699292*h,d=-1.2684380046*u+2.6097574011*p-.3413193965*h,b=-.0041960863*u-.7034186147*p+1.707614701*h;return[U(m),U(d),U(b)]}function at(e,n,r){const a=O(e),o=O(n),s=O(r),l=.4122214708*a+.5363325363*o+.0514459929*s,i=.2119034982*a+.6806995451*o+.1073969566*s,c=.0883024619*a+.2817188376*o+.6299787005*s,u=Math.cbrt(l),p=Math.cbrt(i),h=Math.cbrt(c),m=.2104542553*u+.793617785*p-.0040720468*h,d=1.9779984951*u-2.428592205*p+.4505937099*h,b=.0259040371*u+.7827717662*p-.808675766*h,I=Math.sqrt(d*d+b*b);let V=Math.atan2(b,d)*180/Math.PI;return V<0&&(V+=360),[m,I,V]}function R(e,n,r,a,o,s){switch(o){case"hex":if(s){const l=c=>c.toString(16).padStart(2,"0"),i=Math.max(0,Math.min(255,Math.round(a*255)));return`#${l(e)}${l(n)}${l(r)}${l(i)}`}return W(e,n,r);case"rgb":return`rgb(${e}, ${n}, ${r})`;case"rgba":return`rgba(${e}, ${n}, ${r}, ${Math.round(a*100)/100})`;case"hsl":{const[l,i,c]=H(e,n,r);return`hsl(${l}, ${i}%, ${c}%)`}case"hsla":{const[l,i,c]=H(e,n,r);return`hsla(${l}, ${i}%, ${c}%, ${Math.round(a*100)/100})`}case"hwb":{const[l,i,c]=et(e,n,r);return a<1?`hwb(${l} ${i}% ${c}% / ${Math.round(a*100)/100})`:`hwb(${l} ${i}% ${c}%)`}case"oklch":{const[l,i,c]=at(e,n,r),u=(Math.round(l*1e3)/1e3).toFixed(3),p=(Math.round(i*1e3)/1e3).toFixed(3),h=(Math.round(c*10)/10).toFixed(1),m=Math.round(a*100)/100;return s||a<1?`oklch(${u} ${p} ${h} / ${m})`:`oklch(${u} ${p} ${h})`}}}function v(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}async function rt(e){return new Promise((n,r)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const o=a.result;n(o.split(",")[1])},a.onerror=o=>r(o)})}function mt(e){return Promise.all(e.map(rt))}function ft(e){if(e.length>=4){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===255&&e[1]===216)return"image/jpeg";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80)return"image/webp"}try{if(new TextDecoder("utf-8").decode(e.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function bt(e){const n=ct.$t(e??""),r=n.length,a=new Uint8Array(r);for(let o=0;o<r;o++)a[o]=n.charCodeAt(o);return a}function st(e){const{value:n,onChange:r,onInput:a,...o}=e,s=new Map,l=t.Value.toSignal(n).map(p=>p.map((h,m)=>{const d=s.get(h),b=bt(h??""),I=d?.type||ft(b),V=d?.name??`file-${m}`,y=b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength),f=new Blob([y],{type:I});return new File([f],V,{type:I})})),i=p=>h=>{p&&mt(h).then(m=>{for(const[d,b]of m.entries())s.set(b,{name:h[d].name,type:h[d].type});p(m)})},c=i(r),u=i(a);return k.FilesInput({...o,value:l,onChange:c,onInput:u})}function yt(e){const{value:n,onInput:r,onChange:a,...o}=e;return st({...o,maxFiles:1,value:t.Value.map(n,s=>s==null?[]:[s]),onChange:s=>{a?.(s[0])},onInput:s=>{r?.(s[0])}})}function It(e,n){const[r,a,o]=e,s=r<<16^a<<8^o,l=J(s),i=6+Math.floor(l()*5),c=.18+l()*.06,u=[];for(let d=0;d<i;d++){const b=d/i*Math.PI*2,I=n*(1+(l()*2-1)*c),V=Math.cos(b)*I,y=Math.sin(b)*I;u.push({x:V,y})}const p=(u[0].x+u[i-1].x)/2,h=(u[0].y+u[i-1].y)/2;let m=`M ${p.toFixed(3)} ${h.toFixed(3)}`;for(let d=0;d<i;d++){const b=u[d],I=u[(d+1)%i],V=(b.x+I.x)/2,y=(b.y+I.y)/2;m+=` Q ${b.x.toFixed(3)} ${b.y.toFixed(3)} ${V.toFixed(3)} ${y.toFixed(3)}`}return m+=" Z",m}const wt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,displayValue:s,size:l,withAlpha:i}=e,c=t.Value.map(l??32,g=>g),u=t.Value.map(n,g=>Q(g??"#000000")),p=t.Value.map(u,([g,w,$])=>[g,w,$]),h=t.Value.map(u,([,,,g])=>g),m=t.prop(t.Value.get(h)??1),d=t.Value.map(i??!1,g=>g),b=t.Value.map(e.colorTextFormat??"rgb",g=>g),I=t.computedOf(p,m,b,d)(([g,w,$],C,A,T)=>R(g,w,$,C??1,v(A,T),T)),V=t.Value.map(e.colorTextFormat??"hex",g=>g),y=t.Value.map(c,g=>`${-g/2} ${-g/2} ${g} ${g}`),f=t.computedOf(p,c)((g,w)=>It(g,w/2)),M=t.computedOf(p,m,d)(([g,w,$],C,A)=>A||C<1?Z(g,w,$,C):W(g,w,$)),_=t.html.div(t.attr.class("bc-color-swatch-input__control"),t.attr.class(t.Value.map(d,g=>g?"bc-color-swatch-input__control--alpha":"")),t.attr.style(t.computedOf(c)(g=>`min-width:${g+2}px;height:${g+2}px`)),t.svg.svg(t.attr.class("bc-color-swatch-input__svg"),t.svgAttr.viewBox(y),t.svg.path(t.svgAttr.d(f),t.svgAttr.fill(M))),t.html.input(t.attr.type("color"),S.CommonInputAttributes(e),t.attr.value(t.Value.map(p,([g,w,$])=>W(g,w,$))),t.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),r!=null?t.on.blur(r):t.Empty,a!=null?t.on.change(g=>{const w=g.target.value;if(!a)return;const{r:$,g:C,b:A}=E(w)??{r:0,g:0,b:0},T=t.Value.get(m)??1,F=v(t.Value.get(V),t.Value.get(d)),L=R($,C,A,T,F,t.Value.get(d));a(L)}):t.Empty,o!=null?t.on.input(g=>{const w=g.target.value;if(!o)return;const{r:$,g:C,b:A}=E(w)??{r:0,g:0,b:0},T=t.Value.get(m)??1,F=v(t.Value.get(V),t.Value.get(d)),L=R($,C,A,T,F,t.Value.get(d));o(L)}):t.Empty)),x=t.When(d,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-swatch-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(m,g=>String(g??1))),t.attr.disabled(e.disabled),t.on.input(g=>{const w=parseFloat(g.target.value);m.set(w);const[$,C,A]=t.Value.get(p),T=v(t.Value.get(V),t.Value.get(d)),F=R($,C,A,w,T,t.Value.get(d));o?.(F)}),t.on.change(g=>{const w=parseFloat(g.target.value);m.set(w);const[$,C,A]=t.Value.get(p),T=v(t.Value.get(V),t.Value.get(d)),F=R($,C,A,w,T,t.Value.get(d));a?.(F)})));return D.InputContainer({baseContainer:!0,...e,growInput:!1,input:_,after:t.Fragment(t.When(s??!1,()=>t.html.span(t.attr.class("bc-color-swatch-input__rgb"),I)),x,e.after)})},Vt=({startEditing:e,value:n,onChange:r,placeholder:a,disabled:o})=>{const s=t.Value.deriveProp(e??!1),l=t.prop(!1),i=t.Value.map(o??!1,c=>c);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(i,c=>c?"bc-editable-text--disabled":"")),t.aria.disabled(i),t.When(s,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),ut.AutoSelect(),t.on.keydown(c=>{c.key==="Enter"?s.set(!1):c.key==="Escape"&&(l.set(!0),s.set(!1))}),t.on.blur(t.emitValue(c=>{if(s.set(!1),l.value){l.set(!1);return}r(c)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(i)||s.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,c=>c!=null&&c.trim()!==""),()=>t.html.span(t.attr.class("bc-editable-text__text"),n),()=>t.html.span(t.attr.class("bc-editable-text__placeholder"),a)),t.When(t.Value.map(i,c=>!c),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(N.BeatUII18n,c=>t.aria.label(c.$.editLabel)),t.on.click(()=>s.set(!0)),N.Icon({icon:"line-md/pencil",color:"neutral"}))))))},Mt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,after:s,disabled:l}=e,i=k.NullableResetAfter(n,l,a??o);return D.InputContainer({...e,input:t.input.date(S.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDate(o)):t.Empty),after:s!=null?t.Fragment(i,s):i})},$t=e=>{const n=e.getFullYear(),r=e.getMonth()+1,a=e.getDate(),o=e.getHours(),s=e.getMinutes(),l=e.getSeconds();return`${n}-${r.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${o.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`},xt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,after:s,disabled:l}=e,i=t.Value.map(n,u=>u!=null?$t(u):null),c=k.NullableResetAfter(n,l,a??o);return D.InputContainer({...e,input:t.input["datetime-local"](S.CommonInputAttributes(e),t.attr.value(t.Value.map(i,u=>u??null)),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDateTime(o)):t.Empty),after:s!=null?t.Fragment(c,s):c})},P=e=>typeof e=="string"&&e.trim()===""?null:e,ot=e=>e??"";function B(e){return n=>{const{value:r,onBlur:a,onChange:o,onInput:s,after:l,disabled:i,...c}=n,u=k.NullableResetAfter(r,i,o??s);return e({...c,disabled:i,value:t.Value.map(r,ot),onChange:o!=null?p=>o(P(p)):void 0,onInput:s!=null?p=>s(P(p)):void 0,onBlur:a,after:l!=null?t.Fragment(u,l):u})}}const _t=B(z.EmailInput),Ct=B(S.TextInput),At=B(z.PasswordInput),Tt=B(k.TextArea),kt=({value:e,onChange:n,onInput:r,onBlur:a,offLabel:o,onLabel:s,disabled:l=!1,size:i="md",id:c,color:u="primary",tabIndex:p=0,matchInputHeight:h=!0})=>{const m=c??pt.sessionId("switch");function d(y,f){const M=["bc-switch",`bc-switch--size-${f}`,`bc-switch--${f}`];return h&&M.push("bc-switch--match-input"),y&&M.push("bc-switch--disabled"),M.join(" ")}function b(y){const f=y??"primary",M=new Map,_=N.backgroundValue(f,"solid","light"),x=N.backgroundValue(f,"solid","dark");return M.set("--switch-track-on-bg",_.backgroundColor),M.set("--switch-track-on-label",_.textColor),M.set("--switch-track-on-bg-dark",x.backgroundColor),M.set("--switch-track-on-label-dark",x.textColor),M.set("--switch-track-on-border-dark",N.borderColorValue(f,"dark")),Array.from(M.entries()).map(([g,w])=>`${g}: ${w}`).join("; ")}const I=()=>{t.Value.get(l)||(n?.(!t.Value.get(e)),r?.(!t.Value.get(e)))},V=y=>{t.Value.get(l)||(y.key===" "||y.key==="Enter")&&(y.preventDefault(),I())};return t.html.div(t.attr.class(t.computedOf(l??!1,i)((y,f)=>d(y??!1,f??"md"))),t.attr.style(t.computedOf(u)(y=>b(y))),t.attr.id(m),t.attr.role("switch"),t.attr.tabindex(t.computedOf(l??!1,p)((y,f)=>y?-1:f??0)),t.aria.checked(e),t.aria.disabled(l),t.on.click(I),t.on.keydown(V),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__track--on":"bc-switch__track--off")),o!=null?t.html.div(t.aria.hidden(!0),t.attr.class("bc-switch__track-label bc-switch__track-label--off"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),o):null,s!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),s):null,t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__thumb--on":"bc-switch__thumb--off")))))},Ft=B(k.UUIDInput),Nt="line-md:star-alt-filled",St="line-md:star-alt",lt=e=>{const{value:n,onChange:r,disabled:a,max:o=5,fullColor:s="yellow",emptyColor:l="neutral",fullIcon:i=Nt,emptyIcon:c=St,size:u="md",onBlur:p,rounding:h=1}=e,m=()=>{const f=t.Value.get(h);return f>0?f:1},d=f=>Math.min(Math.max(f,0),t.Value.get(o)),b=(f,M)=>{if(t.Value.get(a??!1))return;const x=f.currentTarget.getBoundingClientRect(),g=(f.clientX-x.left)/x.width,w=M-1+g,$=m(),C=Math.ceil(w/$)*$,A=d(C);r?.(A)},I=f=>{if(t.Value.get(a??!1))return;const M=m(),_=t.Value.get(n)??0;let x;switch(f.key){case"ArrowRight":case"ArrowUp":x=d(_+M);break;case"ArrowLeft":case"ArrowDown":x=d(_-M);break;case"Home":x=0;break;case"End":x=t.Value.get(o);break;default:return}f.preventDefault(),r?.(x)},V=t.Value.map(u,f=>`bc-icon--${f}`),y=({index:f,counter:M})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(V),N.Icon({icon:c,size:u,color:l,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(V),t.style.width(t.Value.map(n,_=>{const x=Math.floor(_);return x>f?"100%":x<f?"0%":`${(_-f)*100}%`})),N.Icon({icon:i,size:u,color:s,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))),t.on.click(t.emit(_=>b(_,M),{preventDefault:!0,stopPropagation:!0})));return D.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(S.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(a??!1,f=>f?-1:0)),t.aria.disabled(a??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(o,f=>f??0)),t.aria.valuenow(t.Value.map(n,f=>f??0)),t.aria.valuetext(t.computedOf(n,o)((f,M)=>{const _=f??0,x=M??0;return`${String(_)} / ${String(x)}`})),t.on.keydown(I),p!=null?t.on.blur(p):null,t.Repeat(o,y))})},Rt=e=>{const{value:n,onChange:r,onInput:a,onBlur:o,after:s,disabled:l,...i}=e,c=k.NullableResetAfter(n,l,r??a);return lt({...i,value:t.Value.map(n,u=>u??0),onChange:r,onInput:a,onBlur:o,after:s!=null?t.Fragment(c,s):c})},vt=e=>{const{value:n,step:r,min:a,max:o,onBlur:s,onChange:l,onInput:i}=e;return D.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),S.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(r),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),s!=null?t.on.blur(t.emitValueAsNumber(s)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(l)):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(i)):t.Empty)})},Et=e=>{const{value:n,step:r,min:a,max:o,onBlur:s,onChange:l,onInput:i}=e,c=t.Value.map(n,p=>{if(p!=null)return p;const h=a!=null?t.Value.get(a):void 0;return typeof h=="number"?h:0}),u=k.NullableResetAfter(n,e.disabled,l??i);return D.InputContainer({...e,focusableSelector:'input[type="range"]',after:u,input:t.html.input(t.attr.type("range"),S.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(r),t.attr.valueAsNumber(c),t.attr.class("bc-input bc-slider-input"),s!=null?t.on.blur(t.emitValueAsNumber(s)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(p=>{l(p)})):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(p=>{i(p)})):t.Empty)})},Dt=B(k.UrlInput);class it{widgets=new Map;typeMapping=new Map;register(n,r){if(this.widgets.set(n,r),r.supportedTypes)for(const a of r.supportedTypes)this.typeMapping.has(a)||this.typeMapping.set(a,[]),this.typeMapping.get(a).push(n),this.typeMapping.get(a).sort((o,s)=>{const l=this.widgets.get(o)?.priority||0;return(this.widgets.get(s)?.priority||0)-l})}unregister(n){const r=this.widgets.get(n);if(r&&(this.widgets.delete(n),r.supportedTypes))for(const a of r.supportedTypes){const o=this.typeMapping.get(a);if(o){const s=o.indexOf(n);s>=0&&o.splice(s,1),o.length===0&&this.typeMapping.delete(a)}}}get(n){return this.widgets.get(n)}getAll(){return new Map(this.widgets)}getForType(n){return(this.typeMapping.get(n)||[]).map(a=>this.widgets.get(a)).filter(Boolean)}findBestWidget(n){const r=dt.resolveWidget(n.definition,n.name);if(r?.widget){const o=this.widgets.get(r.widget);if(o)return{name:r.widget,registration:o,resolved:r}}const a=[];for(const[o,s]of this.widgets.entries())if(s.matcher)try{s.matcher(n)&&a.push({name:o,registration:s,priority:s.priority??0})}catch(l){console.warn(`Error in matcher for widget "${o}":`,l)}if(a.length>0){a.sort((s,l)=>l.priority-s.priority);const o=a[0];return{name:o.name,registration:o.registration,resolved:{widget:o.name,source:"heuristics"}}}if(typeof n.definition=="object"&&n.definition.type){const o=Array.isArray(n.definition.type)?n.definition.type[0]:n.definition.type,s=this.getForType(o);if(s.length>0){const l=this.typeMapping.get(o)[0];return{name:l,registration:s[0],resolved:{widget:l,source:"type-fallback"}}}}return null}}const Bt=new it;function Ot(e,n,r){return{factory:n,matcher:a=>{const s=a.definition["x:ui"];return s===e||typeof s=="object"&&s!==null&&s.widget===e},displayName:r?.displayName??e,priority:r?.priority??100,...r}}function Ut(e,n,r){return{factory:n,matcher:a=>a.definition.format===e,displayName:r?.displayName??`${e} widget`,priority:r?.priority??75,...r}}function Wt(e,n,r,a){return{factory:r,matcher:o=>{const s=o.definition;return s.type===e&&s.format===n},displayName:a?.displayName??`${e}:${n} widget`,priority:a?.priority??80,...a}}function Ht(e){const n=e?.logPrefix??"WIDGET_DIAG",r=e?.filterFn??(()=>!0);return{factory:()=>null,displayName:"Diagnostic Widget (never matches)",priority:-1e3,matcher:a=>{if(!r(a))return!1;const o=a.definition,s={name:a.name,path:a.path.map(String),type:o?.type,hasRegistry:a.widgetRegistry!==void 0,definition:o};return console.log(`[${n}] name="${s.name??"ROOT"}" path=[${s.path.join(", ")}] type="${s.type??"unknown"}" hasRegistry=${s.hasRegistry}`),e?.onProcess?.(s),!1}}}exports.Base64Input=yt;exports.Base64sInput=st;exports.ColorSwatchInput=wt;exports.EditableText=Vt;exports.NullableDateInput=Mt;exports.NullableDateTimeInput=xt;exports.NullableEmailInput=_t;exports.NullablePasswordInput=At;exports.NullableRatingInput=Rt;exports.NullableSliderInput=Et;exports.NullableTextArea=Tt;exports.NullableTextInput=Ct;exports.NullableUUIDInput=Ft;exports.NullableUrlInput=Dt;exports.RatingInput=lt;exports.SliderInput=vt;exports.Switch=kt;exports.WidgetRegistry=it;exports.createDiagnosticWidget=Ht;exports.emptyToNull=P;exports.fileToBase64=rt;exports.forFormat=Ut;exports.forTypeAndFormat=Wt;exports.forXUI=Ot;exports.formatColor=R;exports.getContrastRatio=ht;exports.globalWidgetRegistry=Bt;exports.hexToRgb=E;exports.hslToRgb=j;exports.hwbToRgb=tt;exports.isValidColor=gt;exports.isValidHexColor=q;exports.isValidHslColor=G;exports.isValidRgbColor=X;exports.isValidRgbaColor=Y;exports.linearToSrgb=U;exports.mulberry32=J;exports.normalizeHexColor=K;exports.nullToEmpty=ot;exports.oklchToRgb=nt;exports.parseAnyColor=Q;exports.resolveEffectiveFormat=v;exports.rgbToHex=W;exports.rgbToHsl=H;exports.rgbToHwb=et;exports.rgbToOklch=at;exports.srgbToLinear=O;exports.toRgbaString=Z;
1
+ "use strict";const t=require("@tempots/dom"),k=require("./deep-merge-CvN7Xvd1.cjs"),ct=require("./string-B9vVyfq3.cjs"),D=require("./input-container-B31Seozh.cjs"),S=require("./text-input-w0eVcqk5.cjs"),N=require("./translations-gVgMyNno.cjs"),ut=require("@tempots/ui"),z=require("./notice-DMK7dx9a.cjs"),pt=require("./session-id-B5lJMzbB.cjs"),dt=require("./utils-DIUEhA-Z.cjs");function q(e){if(typeof e!="string")return!1;const n=e.startsWith("#")?e.slice(1):e;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function X(e){if(typeof e!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s]=r,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(s,10);return l>=0&&l<=255&&i>=0&&i<=255&&c>=0&&c<=255}function Y(e){if(typeof e!="string")return!1;const n=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s,l]=r,i=parseInt(a,10),c=parseInt(o,10),u=parseInt(s,10),p=parseFloat(l);return i>=0&&i<=255&&c>=0&&c<=255&&u>=0&&u<=255&&p>=0&&p<=1}function G(e){if(typeof e!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s]=r,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(s,10);return l>=0&&l<=360&&i>=0&&i<=100&&c>=0&&c<=100}function gt(e){return q(e)||X(e)||Y(e)||G(e)}function K(e){if(!q(e))return null;let n=e.startsWith("#")?e.slice(1):e;return n.length===3&&(n=n.split("").map(r=>r+r).join("")),`#${n.toLowerCase()}`}function W(e,n,r){const a=o=>{const s=Math.round(Math.max(0,Math.min(255,o))).toString(16);return s.length===1?"0"+s:s};return`#${a(e)}${a(n)}${a(r)}`}function E(e){const n=K(e);if(!n)return null;const r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function ht(e,n){const r=E(e),a=E(n);if(!r||!a)return null;const o=(u,p,h)=>{const[m,d,b]=[u,p,h].map(I=>(I=I/255,I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4)));return .2126*m+.7152*d+.0722*b},s=o(r.r,r.g,r.b),l=o(a.r,a.g,a.b),i=Math.max(s,l),c=Math.min(s,l);return(i+.05)/(c+.05)}function Q(e){if(!e)return[0,0,0,1];const r=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(r){const u=r[1];if(u.length===8){const p=parseInt(u.slice(0,2),16),h=parseInt(u.slice(2,4),16),m=parseInt(u.slice(4,6),16),d=parseInt(u.slice(6,8),16)/255;return[p,h,m,d]}if(u.length===6)return[parseInt(u.slice(0,2),16),parseInt(u.slice(2,4),16),parseInt(u.slice(4,6),16),1];if(u.length===4){const p=parseInt(u[0]+u[0],16),h=parseInt(u[1]+u[1],16),m=parseInt(u[2]+u[2],16),d=parseInt(u[3]+u[3],16)/255;return[p,h,m,d]}if(u.length===3){const p=parseInt(u[0]+u[0],16),h=parseInt(u[1]+u[1],16),m=parseInt(u[2]+u[2],16);return[p,h,m,1]}}const a=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(a)return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];const o=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(o)return[parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10),1];const s=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(s){const u=parseFloat(s[1]),p=parseFloat(s[2]),h=parseFloat(s[3]),m=s[4]!=null?parseFloat(s[4]):1,[d,b,I]=j(u,p/100,h/100);return[d,b,I,m]}const l=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(l){const u=parseFloat(l[1]),p=parseFloat(l[2])/100,h=parseFloat(l[3])/100,m=l[4]!=null?parseFloat(l[4]):1,[d,b,I]=tt(u,p,h);return[d,b,I,m]}const i=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(i){const u=i[1],p=parseFloat(i[2]),h=parseFloat(i[3]),m=i[4]!=null?parseFloat(i[4]):1,d=u.endsWith("%")?Math.max(0,Math.min(1,parseFloat(u)/100)):Math.max(0,Math.min(1,parseFloat(u))),[b,I,V]=nt(d,p,h);return[b,I,V,m]}const c=E(e);return c?[c.r,c.g,c.b,1]:[0,0,0,1]}function Z(e,n,r,a){return`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(r)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`}function J(e){let n=e+1831565813;return function(){return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function j(e,n,r){e=(e%360+360)%360;const a=(1-Math.abs(2*r-1))*n,o=a*(1-Math.abs(e/60%2-1)),s=r-a/2;let l=0,i=0,c=0;return 0<=e&&e<60?[l,i,c]=[a,o,0]:60<=e&&e<120?[l,i,c]=[o,a,0]:120<=e&&e<180?[l,i,c]=[0,a,o]:180<=e&&e<240?[l,i,c]=[0,o,a]:240<=e&&e<300?[l,i,c]=[o,0,a]:[l,i,c]=[a,0,o],[Math.round((l+s)*255),Math.round((i+s)*255),Math.round((c+s)*255)]}function tt(e,n,r){e=(e%360+360)%360;const a=n+r;a>1&&(n/=a,r/=a);const[o,s,l]=j(e,1,.5).map(h=>h/255),i=1-n-r,c=o*i+n,u=s*i+n,p=l*i+n;return[Math.round(c*255),Math.round(u*255),Math.round(p*255)]}function H(e,n,r){e/=255,n/=255,r/=255;const a=Math.max(e,n,r),o=Math.min(e,n,r);let s=0,l=0;const i=(a+o)/2,c=a-o;if(c!==0){switch(l=i>.5?c/(2-a-o):c/(a+o),a){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;default:s=(e-n)/c+4}s*=60}return[Math.round(s),Math.round(l*100),Math.round(i*100)]}function et(e,n,r){const[a]=H(e,n,r),o=e/255,s=n/255,l=r/255,i=Math.min(o,s,l),c=1-Math.max(o,s,l);return[a,Math.round(i*100),Math.round(c*100)]}function O(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function U(e){const n=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function nt(e,n,r){const a=r*Math.PI/180,o=Math.cos(a)*n,s=Math.sin(a)*n,l=e+.3963377774*o+.2158037573*s,i=e-.1055613458*o-.0638541728*s,c=e-.0894841775*o-1.291485548*s,u=l*l*l,p=i*i*i,h=c*c*c,m=4.0767416621*u-3.3077115913*p+.2309699292*h,d=-1.2684380046*u+2.6097574011*p-.3413193965*h,b=-.0041960863*u-.7034186147*p+1.707614701*h;return[U(m),U(d),U(b)]}function at(e,n,r){const a=O(e),o=O(n),s=O(r),l=.4122214708*a+.5363325363*o+.0514459929*s,i=.2119034982*a+.6806995451*o+.1073969566*s,c=.0883024619*a+.2817188376*o+.6299787005*s,u=Math.cbrt(l),p=Math.cbrt(i),h=Math.cbrt(c),m=.2104542553*u+.793617785*p-.0040720468*h,d=1.9779984951*u-2.428592205*p+.4505937099*h,b=.0259040371*u+.7827717662*p-.808675766*h,I=Math.sqrt(d*d+b*b);let V=Math.atan2(b,d)*180/Math.PI;return V<0&&(V+=360),[m,I,V]}function R(e,n,r,a,o,s){switch(o){case"hex":if(s){const l=c=>c.toString(16).padStart(2,"0"),i=Math.max(0,Math.min(255,Math.round(a*255)));return`#${l(e)}${l(n)}${l(r)}${l(i)}`}return W(e,n,r);case"rgb":return`rgb(${e}, ${n}, ${r})`;case"rgba":return`rgba(${e}, ${n}, ${r}, ${Math.round(a*100)/100})`;case"hsl":{const[l,i,c]=H(e,n,r);return`hsl(${l}, ${i}%, ${c}%)`}case"hsla":{const[l,i,c]=H(e,n,r);return`hsla(${l}, ${i}%, ${c}%, ${Math.round(a*100)/100})`}case"hwb":{const[l,i,c]=et(e,n,r);return a<1?`hwb(${l} ${i}% ${c}% / ${Math.round(a*100)/100})`:`hwb(${l} ${i}% ${c}%)`}case"oklch":{const[l,i,c]=at(e,n,r),u=(Math.round(l*1e3)/1e3).toFixed(3),p=(Math.round(i*1e3)/1e3).toFixed(3),h=(Math.round(c*10)/10).toFixed(1),m=Math.round(a*100)/100;return s||a<1?`oklch(${u} ${p} ${h} / ${m})`:`oklch(${u} ${p} ${h})`}}}function v(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}async function rt(e){return new Promise((n,r)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const o=a.result;n(o.split(",")[1])},a.onerror=o=>r(o)})}function mt(e){return Promise.all(e.map(rt))}function ft(e){if(e.length>=4){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===255&&e[1]===216)return"image/jpeg";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80)return"image/webp"}try{if(new TextDecoder("utf-8").decode(e.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function bt(e){const n=ct.$t(e??""),r=n.length,a=new Uint8Array(r);for(let o=0;o<r;o++)a[o]=n.charCodeAt(o);return a}function st(e){const{value:n,onChange:r,onInput:a,...o}=e,s=new Map,l=t.Value.toSignal(n).map(p=>p.map((h,m)=>{const d=s.get(h),b=bt(h??""),I=d?.type||ft(b),V=d?.name??`file-${m}`,y=b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength),f=new Blob([y],{type:I});return new File([f],V,{type:I})})),i=p=>h=>{p&&mt(h).then(m=>{for(const[d,b]of m.entries())s.set(b,{name:h[d].name,type:h[d].type});p(m)})},c=i(r),u=i(a);return k.FilesInput({...o,value:l,onChange:c,onInput:u})}function yt(e){const{value:n,onInput:r,onChange:a,...o}=e;return st({...o,maxFiles:1,value:t.Value.map(n,s=>s==null?[]:[s]),onChange:s=>{a?.(s[0])},onInput:s=>{r?.(s[0])}})}function It(e,n){const[r,a,o]=e,s=r<<16^a<<8^o,l=J(s),i=6+Math.floor(l()*5),c=.18+l()*.06,u=[];for(let d=0;d<i;d++){const b=d/i*Math.PI*2,I=n*(1+(l()*2-1)*c),V=Math.cos(b)*I,y=Math.sin(b)*I;u.push({x:V,y})}const p=(u[0].x+u[i-1].x)/2,h=(u[0].y+u[i-1].y)/2;let m=`M ${p.toFixed(3)} ${h.toFixed(3)}`;for(let d=0;d<i;d++){const b=u[d],I=u[(d+1)%i],V=(b.x+I.x)/2,y=(b.y+I.y)/2;m+=` Q ${b.x.toFixed(3)} ${b.y.toFixed(3)} ${V.toFixed(3)} ${y.toFixed(3)}`}return m+=" Z",m}const wt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,displayValue:s,size:l,withAlpha:i}=e,c=t.Value.map(l??32,g=>g),u=t.Value.map(n,g=>Q(g??"#000000")),p=t.Value.map(u,([g,w,$])=>[g,w,$]),h=t.Value.map(u,([,,,g])=>g),m=t.prop(t.Value.get(h)??1),d=t.Value.map(i??!1,g=>g),b=t.Value.map(e.colorTextFormat??"rgb",g=>g),I=t.computedOf(p,m,b,d)(([g,w,$],C,A,T)=>R(g,w,$,C??1,v(A,T),T)),V=t.Value.map(e.colorTextFormat??"hex",g=>g),y=t.Value.map(c,g=>`${-g/2} ${-g/2} ${g} ${g}`),f=t.computedOf(p,c)((g,w)=>It(g,w/2)),M=t.computedOf(p,m,d)(([g,w,$],C,A)=>A||C<1?Z(g,w,$,C):W(g,w,$)),_=t.html.div(t.attr.class("bc-color-swatch-input__control"),t.attr.class(t.Value.map(d,g=>g?"bc-color-swatch-input__control--alpha":"")),t.attr.style(t.computedOf(c)(g=>`min-width:${g+2}px;height:${g+2}px`)),t.svg.svg(t.attr.class("bc-color-swatch-input__svg"),t.svgAttr.viewBox(y),t.svg.path(t.svgAttr.d(f),t.svgAttr.fill(M))),t.html.input(t.attr.type("color"),S.CommonInputAttributes(e),t.attr.value(t.Value.map(p,([g,w,$])=>W(g,w,$))),t.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),r!=null?t.on.blur(r):t.Empty,a!=null?t.on.change(g=>{const w=g.target.value;if(!a)return;const{r:$,g:C,b:A}=E(w)??{r:0,g:0,b:0},T=t.Value.get(m)??1,F=v(t.Value.get(V),t.Value.get(d)),L=R($,C,A,T,F,t.Value.get(d));a(L)}):t.Empty,o!=null?t.on.input(g=>{const w=g.target.value;if(!o)return;const{r:$,g:C,b:A}=E(w)??{r:0,g:0,b:0},T=t.Value.get(m)??1,F=v(t.Value.get(V),t.Value.get(d)),L=R($,C,A,T,F,t.Value.get(d));o(L)}):t.Empty)),x=t.When(d,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-swatch-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(m,g=>String(g??1))),t.attr.disabled(e.disabled),t.on.input(g=>{const w=parseFloat(g.target.value);m.set(w);const[$,C,A]=t.Value.get(p),T=v(t.Value.get(V),t.Value.get(d)),F=R($,C,A,w,T,t.Value.get(d));o?.(F)}),t.on.change(g=>{const w=parseFloat(g.target.value);m.set(w);const[$,C,A]=t.Value.get(p),T=v(t.Value.get(V),t.Value.get(d)),F=R($,C,A,w,T,t.Value.get(d));a?.(F)})));return D.InputContainer({baseContainer:!0,...e,growInput:!1,input:_,after:t.Fragment(t.When(s??!1,()=>t.html.span(t.attr.class("bc-color-swatch-input__rgb"),I)),x,e.after)})},Vt=({startEditing:e,value:n,onChange:r,placeholder:a,disabled:o})=>{const s=t.Value.deriveProp(e??!1),l=t.prop(!1),i=t.Value.map(o??!1,c=>c);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(i,c=>c?"bc-editable-text--disabled":"")),t.aria.disabled(i),t.When(s,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),ut.AutoSelect(),t.on.keydown(c=>{c.key==="Enter"?s.set(!1):c.key==="Escape"&&(l.set(!0),s.set(!1))}),t.on.blur(t.emitValue(c=>{if(s.set(!1),l.value){l.set(!1);return}r(c)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(i)||s.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,c=>c!=null&&c.trim()!==""),()=>t.html.span(t.attr.class("bc-editable-text__text"),n),()=>t.html.span(t.attr.class("bc-editable-text__placeholder"),a)),t.When(t.Value.map(i,c=>!c),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(N.BeatUII18n,c=>t.aria.label(c.$.editLabel)),t.on.click(()=>s.set(!0)),N.Icon({icon:"line-md/pencil",color:"neutral"}))))))},Mt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,after:s,disabled:l}=e,i=k.NullableResetAfter(n,l,a??o);return D.InputContainer({...e,input:t.input.date(S.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDate(o)):t.Empty),after:s!=null?t.Fragment(i,s):i})},$t=e=>{const n=e.getFullYear(),r=e.getMonth()+1,a=e.getDate(),o=e.getHours(),s=e.getMinutes(),l=e.getSeconds();return`${n}-${r.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${o.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`},xt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,after:s,disabled:l}=e,i=t.Value.map(n,u=>u!=null?$t(u):null),c=k.NullableResetAfter(n,l,a??o);return D.InputContainer({...e,input:t.input["datetime-local"](S.CommonInputAttributes(e),t.attr.value(t.Value.map(i,u=>u??null)),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDateTime(o)):t.Empty),after:s!=null?t.Fragment(c,s):c})},P=e=>typeof e=="string"&&e.trim()===""?null:e,ot=e=>e??"";function B(e){return n=>{const{value:r,onBlur:a,onChange:o,onInput:s,after:l,disabled:i,...c}=n,u=k.NullableResetAfter(r,i,o??s);return e({...c,disabled:i,value:t.Value.map(r,ot),onChange:o!=null?p=>o(P(p)):void 0,onInput:s!=null?p=>s(P(p)):void 0,onBlur:a,after:l!=null?t.Fragment(u,l):u})}}const _t=B(z.EmailInput),Ct=B(S.TextInput),At=B(z.PasswordInput),Tt=B(k.TextArea),kt=({value:e,onChange:n,onInput:r,onBlur:a,offLabel:o,onLabel:s,disabled:l=!1,size:i="md",id:c,color:u="primary",tabIndex:p=0,matchInputHeight:h=!0})=>{const m=c??pt.sessionId("switch");function d(y,f){const M=["bc-switch",`bc-switch--size-${f}`,`bc-switch--${f}`];return h&&M.push("bc-switch--match-input"),y&&M.push("bc-switch--disabled"),M.join(" ")}function b(y){const f=y??"primary",M=new Map,_=N.backgroundValue(f,"solid","light"),x=N.backgroundValue(f,"solid","dark");return M.set("--switch-track-on-bg",_.backgroundColor),M.set("--switch-track-on-label",_.textColor),M.set("--switch-track-on-bg-dark",x.backgroundColor),M.set("--switch-track-on-label-dark",x.textColor),M.set("--switch-track-on-border-dark",N.borderColorValue(f,"dark")),Array.from(M.entries()).map(([g,w])=>`${g}: ${w}`).join("; ")}const I=()=>{t.Value.get(l)||(n?.(!t.Value.get(e)),r?.(!t.Value.get(e)))},V=y=>{t.Value.get(l)||(y.key===" "||y.key==="Enter")&&(y.preventDefault(),I())};return t.html.div(t.attr.class(t.computedOf(l??!1,i)((y,f)=>d(y??!1,f??"md"))),t.attr.style(t.computedOf(u)(y=>b(y))),t.attr.id(m),t.attr.role("switch"),t.attr.tabindex(t.computedOf(l??!1,p)((y,f)=>y?-1:f??0)),t.aria.checked(e),t.aria.disabled(l),t.on.click(I),t.on.keydown(V),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__track--on":"bc-switch__track--off")),o!=null?t.html.div(t.aria.hidden(!0),t.attr.class("bc-switch__track-label bc-switch__track-label--off"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),o):null,s!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),s):null,t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,y=>y?"bc-switch__thumb--on":"bc-switch__thumb--off")))))},Ft=B(k.UUIDInput),Nt="line-md:star-alt-filled",St="line-md:star-alt",lt=e=>{const{value:n,onChange:r,disabled:a,max:o=5,fullColor:s="yellow",emptyColor:l="neutral",fullIcon:i=Nt,emptyIcon:c=St,size:u="md",onBlur:p,rounding:h=1}=e,m=()=>{const f=t.Value.get(h);return f>0?f:1},d=f=>Math.min(Math.max(f,0),t.Value.get(o)),b=(f,M)=>{if(t.Value.get(a??!1))return;const x=f.currentTarget.getBoundingClientRect(),g=(f.clientX-x.left)/x.width,w=M-1+g,$=m(),C=Math.ceil(w/$)*$,A=d(C);r?.(A)},I=f=>{if(t.Value.get(a??!1))return;const M=m(),_=t.Value.get(n)??0;let x;switch(f.key){case"ArrowRight":case"ArrowUp":x=d(_+M);break;case"ArrowLeft":case"ArrowDown":x=d(_-M);break;case"Home":x=0;break;case"End":x=t.Value.get(o);break;default:return}f.preventDefault(),r?.(x)},V=t.Value.map(u,f=>`bc-icon--${f}`),y=({index:f,counter:M})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(V),N.Icon({icon:c,size:u,color:l,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(V),t.style.width(t.Value.map(n,_=>{const x=Math.floor(_);return x>f?"100%":x<f?"0%":`${(_-f)*100}%`})),N.Icon({icon:i,size:u,color:s,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))),t.on.click(t.emit(_=>b(_,M),{preventDefault:!0,stopPropagation:!0})));return D.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(S.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(a??!1,f=>f?-1:0)),t.aria.disabled(a??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(o,f=>f??0)),t.aria.valuenow(t.Value.map(n,f=>f??0)),t.aria.valuetext(t.computedOf(n,o)((f,M)=>{const _=f??0,x=M??0;return`${String(_)} / ${String(x)}`})),t.on.keydown(I),p!=null?t.on.blur(p):null,t.Repeat(o,y))})},Rt=e=>{const{value:n,onChange:r,onInput:a,onBlur:o,after:s,disabled:l,...i}=e,c=k.NullableResetAfter(n,l,r??a);return lt({...i,value:t.Value.map(n,u=>u??0),onChange:r,onInput:a,onBlur:o,after:s!=null?t.Fragment(c,s):c})},vt=e=>{const{value:n,step:r,min:a,max:o,onBlur:s,onChange:l,onInput:i}=e;return D.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),S.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(r),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),s!=null?t.on.blur(t.emitValueAsNumber(s)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(l)):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(i)):t.Empty)})},Et=e=>{const{value:n,step:r,min:a,max:o,onBlur:s,onChange:l,onInput:i}=e,c=t.Value.map(n,p=>{if(p!=null)return p;const h=a!=null?t.Value.get(a):void 0;return typeof h=="number"?h:0}),u=k.NullableResetAfter(n,e.disabled,l??i);return D.InputContainer({...e,focusableSelector:'input[type="range"]',after:u,input:t.html.input(t.attr.type("range"),S.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(r),t.attr.valueAsNumber(c),t.attr.class("bc-input bc-slider-input"),s!=null?t.on.blur(t.emitValueAsNumber(s)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(p=>{l(p)})):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(p=>{i(p)})):t.Empty)})},Dt=B(k.UrlInput);class it{widgets=new Map;typeMapping=new Map;register(n,r){if(this.widgets.set(n,r),r.supportedTypes)for(const a of r.supportedTypes)this.typeMapping.has(a)||this.typeMapping.set(a,[]),this.typeMapping.get(a).push(n),this.typeMapping.get(a).sort((o,s)=>{const l=this.widgets.get(o)?.priority||0;return(this.widgets.get(s)?.priority||0)-l})}unregister(n){const r=this.widgets.get(n);if(r&&(this.widgets.delete(n),r.supportedTypes))for(const a of r.supportedTypes){const o=this.typeMapping.get(a);if(o){const s=o.indexOf(n);s>=0&&o.splice(s,1),o.length===0&&this.typeMapping.delete(a)}}}get(n){return this.widgets.get(n)}getAll(){return new Map(this.widgets)}getForType(n){return(this.typeMapping.get(n)||[]).map(a=>this.widgets.get(a)).filter(Boolean)}findBestWidget(n){const r=dt.resolveWidget(n.definition,n.name);if(r?.widget){const o=this.widgets.get(r.widget);if(o)return{name:r.widget,registration:o,resolved:r}}const a=[];for(const[o,s]of this.widgets.entries())if(s.matcher)try{s.matcher(n)&&a.push({name:o,registration:s,priority:s.priority??0})}catch(l){console.warn(`Error in matcher for widget "${o}":`,l)}if(a.length>0){a.sort((s,l)=>l.priority-s.priority);const o=a[0];return{name:o.name,registration:o.registration,resolved:{widget:o.name,source:"heuristics"}}}if(typeof n.definition=="object"&&n.definition.type){const o=Array.isArray(n.definition.type)?n.definition.type[0]:n.definition.type,s=this.getForType(o);if(s.length>0){const l=this.typeMapping.get(o)[0];return{name:l,registration:s[0],resolved:{widget:l,source:"type-fallback"}}}}return null}}const Bt=new it;function Ot(e,n,r){return{factory:n,matcher:a=>{const s=a.definition["x:ui"];return s===e||typeof s=="object"&&s!==null&&s.widget===e},displayName:r?.displayName??e,priority:r?.priority??100,...r}}function Ut(e,n,r){return{factory:n,matcher:a=>a.definition.format===e,displayName:r?.displayName??`${e} widget`,priority:r?.priority??75,...r}}function Wt(e,n,r,a){return{factory:r,matcher:o=>{const s=o.definition;return s.type===e&&s.format===n},displayName:a?.displayName??`${e}:${n} widget`,priority:a?.priority??80,...a}}function Ht(e){const n=e?.logPrefix??"WIDGET_DIAG",r=e?.filterFn??(()=>!0);return{factory:()=>null,displayName:"Diagnostic Widget (never matches)",priority:-1e3,matcher:a=>{if(!r(a))return!1;const o=a.definition,s={name:a.name,path:a.path.map(String),type:o?.type,hasRegistry:a.widgetRegistry!==void 0,definition:o};return console.log(`[${n}] name="${s.name??"ROOT"}" path=[${s.path.join(", ")}] type="${s.type??"unknown"}" hasRegistry=${s.hasRegistry}`),e?.onProcess?.(s),!1}}}exports.Base64Input=yt;exports.Base64sInput=st;exports.ColorSwatchInput=wt;exports.EditableText=Vt;exports.NullableDateInput=Mt;exports.NullableDateTimeInput=xt;exports.NullableEmailInput=_t;exports.NullablePasswordInput=At;exports.NullableRatingInput=Rt;exports.NullableSliderInput=Et;exports.NullableTextArea=Tt;exports.NullableTextInput=Ct;exports.NullableUUIDInput=Ft;exports.NullableUrlInput=Dt;exports.RatingInput=lt;exports.SliderInput=vt;exports.Switch=kt;exports.WidgetRegistry=it;exports.createDiagnosticWidget=Ht;exports.emptyToNull=P;exports.fileToBase64=rt;exports.forFormat=Ut;exports.forTypeAndFormat=Wt;exports.forXUI=Ot;exports.formatColor=R;exports.getContrastRatio=ht;exports.globalWidgetRegistry=Bt;exports.hexToRgb=E;exports.hslToRgb=j;exports.hwbToRgb=tt;exports.isValidColor=gt;exports.isValidHexColor=q;exports.isValidHslColor=G;exports.isValidRgbColor=X;exports.isValidRgbaColor=Y;exports.linearToSrgb=U;exports.mulberry32=J;exports.normalizeHexColor=K;exports.nullToEmpty=ot;exports.oklchToRgb=nt;exports.parseAnyColor=Q;exports.resolveEffectiveFormat=v;exports.rgbToHex=W;exports.rgbToHsl=H;exports.rgbToHwb=et;exports.rgbToOklch=at;exports.srgbToLinear=O;exports.toRgbaString=Z;
@@ -1,11 +1,11 @@
1
1
  import { Value as p, prop as rt, computedOf as D, html as k, attr as u, svg as tt, svgAttr as Y, on as M, Empty as A, When as W, Fragment as j, aria as N, emitValue as Z, Use as lt, input as ot, emitValueAsNullableDate as et, emitValueAsNullableDateTime as nt, Repeat as ut, style as pt, emit as dt, emitValueAsNumber as V } from "@tempots/dom";
2
- import { F as ht, N as z, T as gt, U as ft, a as mt } from "./deep-merge-CmQoIYPC.js";
2
+ import { F as ht, N as z, T as gt, U as ft, a as mt } from "./deep-merge-BRqRzEQs.js";
3
3
  import { $ as bt } from "./string-DYyMxBl-.js";
4
- import { I as E } from "./input-container-Nx0gMAzS.js";
5
- import { C as U, T as wt } from "./text-input-CPJzUC2r.js";
4
+ import { I as E } from "./input-container-DhUiLmXE.js";
5
+ import { C as U, T as wt } from "./text-input-BZmAB3_o.js";
6
6
  import { B as yt, I as q, b as st, a as It } from "./translations-BGblCUBj.js";
7
7
  import { AutoSelect as Mt } from "@tempots/ui";
8
- import { E as $t, P as xt } from "./notice-Dz4nX57_.js";
8
+ import { E as $t, P as xt } from "./notice-BmkckDsD.js";
9
9
  import { s as _t } from "./session-id-3KiilioY.js";
10
10
  import { r as kt } from "./utils-DEbsp9Q9.js";
11
11
  function it(t) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/beatui",
3
- "version": "0.86.1",
3
+ "version": "0.87.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",
@@ -232,7 +232,7 @@
232
232
  "release:minor": "pnpm run release:ensure-login && pnpm run release:prepare && pnpm version minor && pnpm run release:publish && pnpm run release:commit",
233
233
  "release:major": "pnpm run release:ensure-login && pnpm run release:prepare && pnpm version major && pnpm run release:publish && pnpm run release:commit",
234
234
  "release:prerelease": "pnpm run release:ensure-login && pnpm run release:prepare && pnpm version prerelease && pnpm run release:publish:next && pnpm run release:commit",
235
- "release:prepare": "pnpm run clean && pnpm run build && pnpm run test",
235
+ "release:prepare": "turbo run build test --filter=@tempots/beatui",
236
236
  "release:publish": "pnpm run release:ensure-login && pnpm publish --no-git-checks",
237
237
  "release:publish:next": "pnpm run release:ensure-login && pnpm publish --tag next --no-git-checks",
238
238
  "release:commit": "git add package.json && git commit -m \"chore: release @tempots/beatui@$(node -p 'require(\"./package.json\").version')\" || echo \"Warning: Could not commit to git. Please commit manually.\"",
@@ -1 +0,0 @@
1
- "use strict";const t=require("@tempots/dom"),V=require("./deep-merge-UghuPcyW.cjs"),y=require("./translations-gVgMyNno.cjs"),q=require("./stack-DcZ_u50f.cjs"),A=require("./input-container-CSi72GI1.cjs"),E=require("./text-input-8v79fzEy.cjs"),w=n=>{const{value:e,onInput:c,onChange:i,...u}=n;return V.FilesInput({...u,maxFiles:1,value:t.Value.map(e,a=>a==null?[]:[a]),onChange:a=>{i?.(a[0])},onInput:a=>{c?.(a[0])}})},F=n=>{try{return BigInt(n)}catch{return null}},z=n=>{const{value:e,step:c,min:i,max:u,onChange:a,onInput:d,after:I}=n,f=m=>{const r=i!=null?t.Value.get(i):void 0,s=u!=null?t.Value.get(u):void 0;return r!=null&&m<r?r:s!=null&&m>s?s:m},g=c!=null?t.Use(y.BeatUII18n,m=>{const r=t.computedOf(e,i)((o,l)=>l==null?!0:(o??0n)>l),s=t.computedOf(e,u)((o,l)=>l==null?!0:(o??0n)<l),T=(o,l)=>{const b=t.Value.get(e)??0n,h=t.Value.get(c),O=l?.shiftKey?10n:1n,C=b+h*O*o,v=i!=null?t.Value.get(i):void 0,S=u!=null?t.Value.get(u):void 0;if(o<0n&&v!=null&&C<v||o>0n&&S!=null&&C>S)return;const D=f(C);D!==b&&a&&a(D)};return q.Stack(t.attr.class("bc-number-input-steppers"),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(s,n.disabled??!1)((o,l)=>!o||l)),t.on.click(o=>T(1n,o)),t.aria.label(m.$.incrementValue),y.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(r,n.disabled??!1)((o,l)=>!o||l)),t.on.click(o=>T(-1n,o)),t.aria.label(m.$.decrementValue),y.Icon({icon:"line-md:minus",size:"xs"})))}):null,p=I!=null&&g!=null?t.Fragment(g,I):I??g,B=a?m=>{const r=F(m);r!=null&&a(f(r))}:void 0,k=d?m=>{const r=F(m);r!=null&&d(f(r))}:void 0;return V.MaskInput({...n,value:t.Value.map(e,m=>m.toString()),onChange:B,onInput:k,after:p,mask:null,allowMode:"digits",class:"bc-number-input"})},M=n=>{if(n==null||n==="")return null;try{return BigInt(n)}catch{return null}},U=n=>{const{value:e,step:c,min:i,max:u,onChange:a,onInput:d,after:I}=n,f=r=>{const s=i!=null?t.Value.get(i):void 0,T=u!=null?t.Value.get(u):void 0;return s!=null&&r<s?s:T!=null&&r>T?T:r},g=c!=null?t.Use(y.BeatUII18n,r=>{const s=t.computedOf(e,i)((l,b)=>{const h=l??0n;return b==null?!0:h>b}),T=t.computedOf(e,u)((l,b)=>{const h=l??0n;return b==null?!0:h<b}),o=(l,b)=>{const h=t.Value.get(e)??0n,O=t.Value.get(c),C=b?.shiftKey?10n:1n,v=h+O*C*l,S=i!=null?t.Value.get(i):void 0,D=u!=null?t.Value.get(u):void 0;if(l<0n&&S!=null&&v<S||l>0n&&D!=null&&v>D)return;const x=f(v);x!==h&&a&&a(x)};return q.Stack(t.attr.class("bc-number-input-steppers"),t.attr.type("button"),t.html.button(t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"),t.attr.disabled(t.computedOf(T,n.disabled??!1)((l,b)=>!l||b)),t.on.click(l=>o(1n,l)),t.aria.label(r.$.incrementValue),y.Icon({icon:"line-md:plus",size:"xs"})),t.html.button(t.attr.type("button"),t.attr.class("bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"),t.attr.disabled(t.computedOf(s,n.disabled??!1)((l,b)=>!l||b)),t.on.click(l=>o(-1n,l)),t.aria.label(r.$.decrementValue),y.Icon({icon:"line-md:minus",size:"xs"})))}):null,p=V.NullableResetAfter(e,n.disabled,a??d),B=I!=null&&g!=null?t.Fragment(g,p,I):I!=null?t.Fragment(p,I):g!=null?t.Fragment(g,p):p,k=a?r=>{const s=M(r);a(s===null?null:f(s))}:void 0,m=d?r=>{const s=M(r);d(s===null?null:f(s))}:void 0;return V.MaskInput({...n,value:t.Value.map(e,r=>r==null?"":r.toString()),onChange:k,onInput:m,after:B,mask:null,allowMode:"digits",class:"bc-number-input"})};function P(n){return e=>{const{value:c,onBlur:i,onChange:u}=e;return V.WithTemporal(a=>A.InputContainer({...e,input:t.input[n.inputType](E.CommonInputAttributes(e),t.attr.value(t.Value.map(c,n.valueToString)),t.attr.class("bc-input"),i!=null?t.on.blur(t.emitValue(i)):t.Empty,u!=null?t.on.change(t.emitValue(d=>u(n.parseValue(a,d)))):t.Empty)}))}}function N(n){return e=>{const{value:c,onBlur:i,onChange:u,onInput:a,after:d,disabled:I}=e,f=V.NullableResetAfter(c,I,u??a);return V.WithTemporal(g=>A.InputContainer({...e,input:t.input[n.inputType](E.CommonInputAttributes(e),t.attr.value(t.Value.map(c,p=>p==null?"":n.valueToString(p))),t.attr.class("bc-input"),i!=null?t.on.blur(t.emitValue(i)):t.Empty,u!=null?t.on.change(t.emitValue(p=>u(p===""?null:n.parseValue(g,p)))):t.Empty,a!=null?t.on.input(t.emitValue(p=>a(p===""?null:n.parseValue(g,p)))):t.Empty),after:d!=null?t.Fragment(f,d):f}))}}const $=P({inputType:"date",valueToString:n=>n.toString(),parseValue:(n,e)=>n.PlainDate.from(e)}),W=N({inputType:"date",valueToString:n=>n.toString(),parseValue:(n,e)=>n.PlainDate.from(e)}),J=P({inputType:"time",valueToString:n=>n.toString(),parseValue:(n,e)=>n.PlainTime.from(e)}),K=N({inputType:"time",valueToString:n=>n.toString(),parseValue:(n,e)=>n.PlainTime.from(e)}),R=P({inputType:"datetime-local",valueToString:n=>n.toJSON(),parseValue:(n,e)=>n.PlainDateTime.from(e)}),H=N({inputType:"datetime-local",valueToString:n=>n.toJSON(),parseValue:(n,e)=>n.PlainDateTime.from(e)}),j=n=>{const{value:e,onChange:c}=n;return V.WithTemporal(i=>V.MaskInput({...n,value:t.Value.map(e,u=>u.toString()),onChange:c?u=>c(i.Duration.from(u)):void 0,onInput:void 0,...V.durationMaskConfig(i.Duration.from),placeholder:"P0DT0H0M0S"}))};exports.BigintInput=z;exports.DurationInput=j;exports.FileInput=w;exports.NullableBigintInput=U;exports.NullablePlainDateInput=W;exports.NullablePlainDateTimeInput=H;exports.NullablePlainTimeInput=K;exports.PlainDateInput=$;exports.PlainDateTimeInput=R;exports.PlainTimeInput=J;exports.createNullableTemporalInput=N;exports.createTemporalInput=P;
@@ -1 +0,0 @@
1
- "use strict";const e=require("@tempots/dom"),n=require("./translations-gVgMyNno.cjs"),v=require("@tempots/ui");function p(u,o,a,t){const l=["bc-button",`bc-button--size-${u}`,`bc-control--padding-${u}`,`bc-control--rounded-${o}`];return a&&l.push("bc-button--loading"),t&&l.push("bc-button--full-width"),l.join(" ")}function f(u,o,a){const t=new Map;t.set("--button-text-shadow","var(--text-shadow-none)"),t.set("--button-text-shadow-dark","var(--text-shadow-none)");const l=(r,s,i,c)=>{a||(t.set("--button-bg-hover",r),t.set("--button-text-hover",i),t.set("--button-bg-hover-dark",s),t.set("--button-text-hover-dark",c))};switch(u){case"filled":{const r=n.backgroundValue(o,"solid","light"),s=n.backgroundValue(o,"solid","dark");t.set("--button-bg",r.backgroundColor),t.set("--button-text",r.textColor),t.set("--button-bg-dark",s.backgroundColor),t.set("--button-text-dark",s.textColor),t.set("--button-text-shadow","var(--text-shadow-button-filled, var(--text-shadow-sm))"),t.set("--button-text-shadow-dark","var(--text-shadow-button-filled, var(--text-shadow-sm))");const i=n.hoverBackgroundValue(o,"solid","light"),c=n.hoverBackgroundValue(o,"solid","dark");l(i.backgroundColor,c.backgroundColor,i.textColor,c.textColor);break}case"light":{const r=n.backgroundValue(o,"light","light"),s=n.backgroundValue(o,"light","dark");t.set("--button-bg",r.backgroundColor),t.set("--button-text",r.textColor),t.set("--button-bg-dark",s.backgroundColor),t.set("--button-text-dark",s.textColor);const i=n.hoverBackgroundValue(o,"light","light"),c=n.hoverBackgroundValue(o,"light","dark");l(i.backgroundColor,c.backgroundColor,i.textColor,c.textColor);break}case"outline":{t.set("--button-bg","transparent"),t.set("--button-bg-dark","transparent"),t.set("--button-border",n.borderColorValue(o,"light")),t.set("--button-border-dark",n.borderColorValue(o,"dark")),t.set("--button-text",n.textColorValue(o,"light")),t.set("--button-text-dark",n.textColorValue(o,"dark")),t.set("--button-text-shadow","var(--text-shadow-button-light, var(--text-shadow-xs))"),t.set("--button-text-shadow-dark","var(--text-shadow-button-light, var(--text-shadow-xs))");const r=n.hoverBackgroundValue(o,"light","light"),s=n.hoverBackgroundValue(o,"light","dark");l(r.backgroundColor,s.backgroundColor,r.textColor,s.textColor);break}case"dashed":{t.set("--button-bg","transparent"),t.set("--button-bg-dark","transparent"),t.set("--button-border",n.borderColorValue(o,"light")),t.set("--button-border-dark",n.borderColorValue(o,"dark")),t.set("--button-border-style","dashed"),t.set("--button-text",n.textColorValue(o,"light")),t.set("--button-text-dark",n.textColorValue(o,"dark"));const r=n.hoverBackgroundValue(o,"light","light"),s=n.hoverBackgroundValue(o,"light","dark");l(r.backgroundColor,s.backgroundColor,r.textColor,s.textColor);break}case"default":{const r=n.backgroundValue("neutral","light","light"),s=n.backgroundValue("neutral","light","dark");t.set("--button-bg",r.backgroundColor),t.set("--button-text",n.textColorValue(o,"light")),t.set("--button-bg-dark",s.backgroundColor),t.set("--button-text-dark",n.textColorValue(o,"dark")),t.set("--button-text-shadow","var(--text-shadow-button-default, var(--text-shadow-2xs))"),t.set("--button-text-shadow-dark","var(--text-shadow-button-default, var(--text-shadow-2xs))");const i=n.hoverBackgroundValue("base","light","light"),c=n.hoverBackgroundValue("base","light","dark");l(i.backgroundColor,c.backgroundColor,t.get("--button-text")??r.textColor,t.get("--button-text-dark")??s.textColor);break}case"text":{t.set("--button-bg","transparent"),t.set("--button-bg-dark","transparent"),t.set("--button-text",n.textColorValue(o,"light")),t.set("--button-text-dark",n.textColorValue(o,"dark")),a||t.set("--button-hover-decoration","underline");break}}return Array.from(t.entries()).map(([r,s])=>`${r}: ${s}`).join("; ")}function m({type:u="button",disabled:o=!1,loading:a=!1,variant:t="filled",size:l="md",color:r="base",roundedness:s="sm",onClick:i=()=>{},fullWidth:c=!1,stopPropagation:g=!0},...k){const d=e.prop(null);return e.Use(n.BeatUII18n,h=>e.html.button(e.attr.type(u),e.attr.disabled(e.computedOf(o,a)((b,x)=>b||x)),e.aria.busy(a??!1),e.When(a??!1,()=>e.aria.label(h.$.loadingExtended)),e.attr.class(e.computedOf(l,s,a,c)(p)),e.attr.style(e.computedOf(t,r,o)(f)),e.When(a??!1,()=>e.Fragment(e.style.width(d.map(b=>b==null?"":`${b.width}px`)),e.style.height(d.map(b=>b==null?"":`${b.height}px`)),n.Icon({icon:"line-md:loading-twotone-loop",size:l??"md"}),e.html.span(e.attr.class("sr-only"),e.aria.live("polite"),h.$.loadingExtended)),()=>e.Fragment(e.on.click(b=>{u!=="submit"&&b.preventDefault(),g&&b.stopPropagation(),i()}),...k)),e.When(a!=null,()=>v.ElementRect(b=>(b.on(x=>{e.Value.get(a??!1)||d.set(x)}),e.Empty)))))}function V(u,o,a){const t=[u?"bc-base-input-container":"bc-input-container"];return o?t.push(u?"bc-base-input-container--disabled":"bc-input-container--disabled"):t.push(u?"bc-base-input-container--default":"bc-input-container--default"),a&&t.push("bc-input-container--error"),t.join(" ")}function C(u,o){const a=["bc-input-container__input"];return u||(a.push(`bc-control--padding-${o}`),a.push(`bc-control--text-size-${o}`)),a.join(" ")}const w=({baseContainer:u,disabled:o,input:a,before:t,after:l,hasError:r,focusableSelector:s="input, select, textarea",growInput:i=!0,size:c},...g)=>{const k=e.Value.map(o??!1,d=>d);return e.html.div(e.WithElement(d=>{const h=()=>{d.querySelector(s)?.focus()};return d.addEventListener("click",h),e.OnDispose(()=>d.removeEventListener("click",h))}),e.attr.class(e.computedOf(u,k,r??!1)((d,h,b)=>V(d??!1,h??!1,b??!1))),t!=null?e.html.span(e.attr.class("bc-input-container__before"),t):null,e.html.div(e.attr.class(e.computedOf(u,c??"md")((d,h)=>C(d??!1,h??"md"))),e.attr.class(e.Value.map(i,d=>d?"bc-input-container__input--grow":"")),a),l!=null?e.html.span(e.attr.class("bc-input-container__after"),l):null,...g)};function B({icon:u,size:o="md",color:a="neutral"}){return e.html.span(e.attr.class("bc-input-container__icon"),n.Icon({icon:u,size:o,color:a}))}exports.Button=m;exports.InputContainer=w;exports.InputIcon=B;exports.generateButtonClasses=p;exports.generateButtonStyles=f;exports.generateInputContainerInputClasses=C;