@tempots/beatui 0.86.1 → 0.87.1

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 (57) 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/beatui.css +0 -1
  6. package/dist/beatui.tailwind.css +0 -1
  7. package/dist/better-auth/index.cjs.js +1 -1
  8. package/dist/better-auth/index.es.js +4 -4
  9. package/dist/{deep-merge-CmQoIYPC.js → deep-merge-BRqRzEQs.js} +3 -3
  10. package/dist/{deep-merge-UghuPcyW.cjs → deep-merge-CvN7Xvd1.cjs} +1 -1
  11. package/dist/{duration-input-DaB6s0rL.js → duration-input-BDEb1Bb7.js} +95 -89
  12. package/dist/duration-input-BtFL5Vjx.cjs +1 -0
  13. package/dist/{editor-toolbar-group-_V1rDM-1.cjs → editor-toolbar-group-BgWLVgMZ.cjs} +1 -1
  14. package/dist/{editor-toolbar-group-BslfdazC.js → editor-toolbar-group-CwCCGzEC.js} +1 -1
  15. package/dist/{index-DfJMDwSU.js → index-B0t-nt7i.js} +1 -1
  16. package/dist/{index-BzRuy4V1.cjs → index-CaWDj1Vg.cjs} +2 -2
  17. package/dist/{index-vzoI95E1.js → index-DdqGL9Jk.js} +4 -4
  18. package/dist/{index-4GQLcxme.cjs → index-qa82MK4Z.cjs} +1 -1
  19. package/dist/index.cjs.js +1 -1
  20. package/dist/index.es.js +16 -16
  21. package/dist/input-container-B31Seozh.cjs +1 -0
  22. package/dist/input-container-DhUiLmXE.js +263 -0
  23. package/dist/json-schema/index.cjs.js +1 -1
  24. package/dist/json-schema/index.es.js +7 -7
  25. package/dist/json-structure/index.cjs.js +1 -1
  26. package/dist/json-structure/index.es.js +5 -5
  27. package/dist/lexical/index.cjs.js +1 -1
  28. package/dist/lexical/index.es.js +3 -3
  29. package/dist/{modal-kyZfvVZb.cjs → modal-Coenk8Fy.cjs} +1 -1
  30. package/dist/{modal-DaI1jH-X.js → modal-Dkje8L_l.js} +2 -2
  31. package/dist/{notice-Dz4nX57_.js → notice-BmkckDsD.js} +3 -3
  32. package/dist/{notice-Bc1L4Zpr.cjs → notice-DMK7dx9a.cjs} +1 -1
  33. package/dist/prosemirror/index.cjs.js +1 -1
  34. package/dist/prosemirror/index.es.js +1 -1
  35. package/dist/{text-input-CPJzUC2r.js → text-input-BZmAB3_o.js} +15 -15
  36. package/dist/text-input-w0eVcqk5.cjs +1 -0
  37. package/dist/{toolbar-D3ZsC0g_.cjs → toolbar-BR8In7O0.cjs} +1 -1
  38. package/dist/{toolbar-CjQG7l7X.js → toolbar-Pdj-F80l.js} +1 -1
  39. package/dist/types/components/form/input/input-container.d.ts +5 -2
  40. package/dist/types/components/form/input/input-options.d.ts +24 -2
  41. package/dist/types/components/form/input/nullable-plain-date-input.d.ts +1 -0
  42. package/dist/types/components/form/input/nullable-plain-date-time-input.d.ts +1 -0
  43. package/dist/types/components/form/input/nullable-plain-time-input.d.ts +1 -0
  44. package/dist/types/components/form/input/nullable-plain-year-month-input.d.ts +1 -0
  45. package/dist/types/components/form/input/plain-date-input.d.ts +1 -0
  46. package/dist/types/components/form/input/plain-date-time-input.d.ts +1 -0
  47. package/dist/types/components/form/input/plain-time-input.d.ts +1 -0
  48. package/dist/types/components/form/input/plain-year-month-input.d.ts +1 -0
  49. package/dist/{use-form-BurzbPVV.js → use-form-BSvvERhX.js} +1 -1
  50. package/dist/{use-form-Uree6QFy.cjs → use-form-B_mCauP0.cjs} +1 -1
  51. package/dist/{widget-customization-B9Oc1bG4.cjs → widget-customization-BASfRpF7.cjs} +1 -1
  52. package/dist/{widget-customization-Ct2eqKKR.js → widget-customization-DFr3ycD7.js} +4 -4
  53. package/package.json +2 -2
  54. package/dist/duration-input-BJzKgI15.cjs +0 -1
  55. package/dist/input-container-CSi72GI1.cjs +0 -1
  56. package/dist/input-container-Nx0gMAzS.js +0 -258
  57. package/dist/text-input-8v79fzEy.cjs +0 -1
package/dist/index.es.js CHANGED
@@ -7,34 +7,34 @@ import { c as Se } from "./colors-BmLYKmoH.js";
7
7
  import { b as fl, h as gl, j as ml, e as hl, d as vl, o as yl, g as _l, a as wl, m as kl, k as xl, n as Cl, r as $l, s as Sl, f as Dl, i as Il, t as Tl } from "./colors-BmLYKmoH.js";
8
8
  import { e as On } from "./index-D2_J_-XS.js";
9
9
  import { J as Ml, aa as Pl, v as Al, j as Bl, L as Vl, P as El, K as Nl, M as Rl, h as Ol, n as Fl, f as jl, a as Ul, ai as zl, q as Hl, a5 as Wl, al as Yl, u as Gl, I as ql, B as Zl, as as Jl, g as Kl, F as Xl, y as Ql, aq as ei, a4 as ti, a9 as ni, T as ai, c as si, af as ri, ae as oi, m as li, l as ii, k as ci, a1 as ui, a0 as di, V as pi, U as bi, S as fi, R as gi, X as mi, W as hi, $ as vi, _ as yi, Z as _i, Y as wi, ad as ki, d as xi, ah as Ci, ag as $i, p as Si, o as Di, a3 as Ii, a2 as Ti, ak as Li, t as Mi, H as Pi, A as Ai, ar as Bi, E as Vi, D as Ei, x as Ni, b as Ri, ap as Oi, ao as Fi, i as ji, a8 as Ui, a7 as zi, O as Hi, N as Wi, ab as Yi, ac as Gi, r as qi, Q as Zi, aj as Ji, s as Ki, G as Xi, z as Qi, an as ec, C as tc, w as nc, am as ac, a6 as sc } from "./index-D2_J_-XS.js";
10
- import { C as We, m as Gt, c as qt, I as ft, B as Zt, b as Jt, d as Fn } from "./use-form-BurzbPVV.js";
11
- import { A as oc, h as lc, a as ic, j as cc, M as uc, f as dc, R as pc, n as bc, q as fc, o as gc, l as mc, k as hc, e as vc, p as yc, i as _c, s as wc, t as kc, g as xc, u as Cc, w as $c } from "./use-form-BurzbPVV.js";
10
+ import { C as We, m as Gt, c as qt, I as ft, B as Zt, b as Jt, d as Fn } from "./use-form-BSvvERhX.js";
11
+ import { A as oc, h as lc, a as ic, j as cc, M as uc, f as dc, R as pc, n as bc, q as fc, o as gc, l as mc, k as hc, e as vc, p as yc, i as _c, s as wc, t as kc, g as xc, u as Cc, w as $c } from "./use-form-BSvvERhX.js";
12
12
  import { u as Ke, A as St, a as jn } from "./use-animated-toggle-89fKlXxy.js";
13
13
  import { b as Dc, c as Ic } from "./use-animated-toggle-89fKlXxy.js";
14
14
  import { T as Kt, a as Un } from "./theme-BzpMLdvH.js";
15
15
  import { beatuiPreset as Lc, createBeatuiPreset as Mc } from "./tailwind/preset.es.js";
16
- import { p as Dt, q as zn, r as Hn, s as It, t as Fe } from "./widget-customization-Ct2eqKKR.js";
17
- import { B as Ac, v as Bc, C as Vc, E as Ec, f as Nc, e as Rc, h as Oc, d as Fc, j as jc, i as Uc, a as zc, N as Hc, b as Wc, c as Yc, R as Gc, S as qc, k as Zc, u as Jc, m as Kc, n as Xc, l as Qc, T as eu, D as tu, A as nu, I as au, J as su, y as ru, w as ou, x as lu, O as iu, H as cu, P as uu, F as du, U as pu, z as bu, K as fu, L as gu, Q as mu, M as hu, G as vu } from "./widget-customization-Ct2eqKKR.js";
18
- import { B as Be, I as ye, a as Xe, b as Tt, c as Lt } from "./input-container-Nx0gMAzS.js";
19
- import { g as _u } from "./input-container-Nx0gMAzS.js";
20
- import { W as Ce, S as Wn, G as Xt, E as Yn, b as Qt, N as Qe, M as gt } from "./deep-merge-CmQoIYPC.js";
21
- import { B as ku, o as xu, F as Cu, L as $u, n as Su, l as Du, h as Iu, c as Tu, f as Lu, g as Mu, T as Pu, U as Au, i as Bu, k as Vu, a as Eu, j as Nu, p as Ru, q as Ou, r as Fu, e as ju, t as Uu, m as zu } from "./deep-merge-CmQoIYPC.js";
22
- import { C as Ie } from "./text-input-CPJzUC2r.js";
23
- import { T as Wu } from "./text-input-CPJzUC2r.js";
16
+ import { p as Dt, q as zn, r as Hn, s as It, t as Fe } from "./widget-customization-DFr3ycD7.js";
17
+ import { B as Ac, v as Bc, C as Vc, E as Ec, f as Nc, e as Rc, h as Oc, d as Fc, j as jc, i as Uc, a as zc, N as Hc, b as Wc, c as Yc, R as Gc, S as qc, k as Zc, u as Jc, m as Kc, n as Xc, l as Qc, T as eu, D as tu, A as nu, I as au, J as su, y as ru, w as ou, x as lu, O as iu, H as cu, P as uu, F as du, U as pu, z as bu, K as fu, L as gu, Q as mu, M as hu, G as vu } from "./widget-customization-DFr3ycD7.js";
18
+ import { B as Be, I as ye, a as Xe, b as Tt, c as Lt } from "./input-container-DhUiLmXE.js";
19
+ import { g as _u } from "./input-container-DhUiLmXE.js";
20
+ import { W as Ce, S as Wn, G as Xt, E as Yn, b as Qt, N as Qe, M as gt } from "./deep-merge-BRqRzEQs.js";
21
+ import { B as ku, o as xu, F as Cu, L as $u, n as Su, l as Du, h as Iu, c as Tu, f as Lu, g as Mu, T as Pu, U as Au, i as Bu, k as Vu, a as Eu, j as Nu, p as Ru, q as Ou, r as Fu, e as ju, t as Uu, m as zu } from "./deep-merge-BRqRzEQs.js";
22
+ import { C as Ie } from "./text-input-BZmAB3_o.js";
23
+ import { T as Wu } from "./text-input-BZmAB3_o.js";
24
24
  import { F as mt, M as en, a as tn } from "./menu-Ui4lUPHM.js";
25
25
  import { b as Gu } from "./menu-Ui4lUPHM.js";
26
26
  import { s as ve } from "./session-id-3KiilioY.js";
27
- import { E as Zu, N as Ju, P as Ku } from "./notice-Dz4nX57_.js";
28
- import { f as Gn, g as qn } from "./duration-input-DaB6s0rL.js";
29
- import { B as Qu, D as ed, F as td, N as nd, d as ad, b as sd, a as rd, e as od, c as ld, P as id } from "./duration-input-DaB6s0rL.js";
30
- import { O as ht, F as nn, M as vt } from "./modal-DaI1jH-X.js";
31
- import { B as ud, C as dd, a as pd, S as bd, b as fd, c as gd, o as md, s as hd, u as vd } from "./modal-DaI1jH-X.js";
27
+ import { E as Zu, N as Ju, P as Ku } from "./notice-BmkckDsD.js";
28
+ import { f as Gn, g as qn } from "./duration-input-BDEb1Bb7.js";
29
+ import { B as Qu, D as ed, F as td, N as nd, d as ad, b as sd, a as rd, e as od, c as ld, P as id } from "./duration-input-BDEb1Bb7.js";
30
+ import { O as ht, F as nn, M as vt } from "./modal-Dkje8L_l.js";
31
+ import { B as ud, C as dd, a as pd, S as bd, b as fd, c as gd, o as md, s as hd, u as vd } from "./modal-Dkje8L_l.js";
32
32
  import { C as _d } from "./utils-DEbsp9Q9.js";
33
33
  import { g as an, T as Mt } from "./timer-Rd2sKnvH.js";
34
34
  import { S as Zn } from "./stack-BJgsPJ9A.js";
35
35
  import { D as kd, E as xd, L as Cd, M as $d } from "./stack-BJgsPJ9A.js";
36
36
  import { L as Dd } from "./link-portal-Cr2l9f3k.js";
37
- import { b as Td, T as Ld, c as Md, a as Pd, d as Ad } from "./toolbar-CjQG7l7X.js";
37
+ import { b as Td, T as Ld, c as Md, a as Pd, d as Ad } from "./toolbar-Pdj-F80l.js";
38
38
  function cr(e, t = 0, n = () => !0) {
39
39
  let s = null, r;
40
40
  const u = H(e.value);
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@tempots/dom"),n=require("./translations-gVgMyNno.cjs"),m=require("@tempots/ui");function f(l,o,r,t){const d=["bc-button",`bc-button--size-${l}`,`bc-control--padding-${l}`,`bc-control--rounded-${o}`];return r&&d.push("bc-button--loading"),t&&d.push("bc-button--full-width"),d.join(" ")}function C(l,o,r){const t=new Map;t.set("--button-text-shadow","var(--text-shadow-none)"),t.set("--button-text-shadow-dark","var(--text-shadow-none)");const d=(s,u,b,i)=>{r||(t.set("--button-bg-hover",s),t.set("--button-text-hover",b),t.set("--button-bg-hover-dark",u),t.set("--button-text-hover-dark",i))};switch(l){case"filled":{const s=n.backgroundValue(o,"solid","light"),u=n.backgroundValue(o,"solid","dark");t.set("--button-bg",s.backgroundColor),t.set("--button-text",s.textColor),t.set("--button-bg-dark",u.backgroundColor),t.set("--button-text-dark",u.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 b=n.hoverBackgroundValue(o,"solid","light"),i=n.hoverBackgroundValue(o,"solid","dark");d(b.backgroundColor,i.backgroundColor,b.textColor,i.textColor);break}case"light":{const s=n.backgroundValue(o,"light","light"),u=n.backgroundValue(o,"light","dark");t.set("--button-bg",s.backgroundColor),t.set("--button-text",s.textColor),t.set("--button-bg-dark",u.backgroundColor),t.set("--button-text-dark",u.textColor);const b=n.hoverBackgroundValue(o,"light","light"),i=n.hoverBackgroundValue(o,"light","dark");d(b.backgroundColor,i.backgroundColor,b.textColor,i.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 s=n.hoverBackgroundValue(o,"light","light"),u=n.hoverBackgroundValue(o,"light","dark");d(s.backgroundColor,u.backgroundColor,s.textColor,u.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 s=n.hoverBackgroundValue(o,"light","light"),u=n.hoverBackgroundValue(o,"light","dark");d(s.backgroundColor,u.backgroundColor,s.textColor,u.textColor);break}case"default":{const s=n.backgroundValue("neutral","light","light"),u=n.backgroundValue("neutral","light","dark");t.set("--button-bg",s.backgroundColor),t.set("--button-text",n.textColorValue(o,"light")),t.set("--button-bg-dark",u.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 b=n.hoverBackgroundValue("base","light","light"),i=n.hoverBackgroundValue("base","light","dark");d(b.backgroundColor,i.backgroundColor,t.get("--button-text")??s.textColor,t.get("--button-text-dark")??u.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")),r||t.set("--button-hover-decoration","underline");break}}return Array.from(t.entries()).map(([s,u])=>`${s}: ${u}`).join("; ")}function V({type:l="button",disabled:o=!1,loading:r=!1,variant:t="filled",size:d="md",color:s="base",roundedness:u="sm",onClick:b=()=>{},fullWidth:i=!1,stopPropagation:k=!0},...x){const h=e.prop(null);return e.Use(n.BeatUII18n,g=>e.html.button(e.attr.type(l),e.attr.disabled(e.computedOf(o,r)((a,c)=>a||c)),e.aria.busy(r??!1),e.When(r??!1,()=>e.aria.label(g.$.loadingExtended)),e.attr.class(e.computedOf(d,u,r,i)(f)),e.attr.style(e.computedOf(t,s,o)(C)),e.When(r??!1,()=>e.Fragment(e.style.width(h.map(a=>a==null?"":`${a.width}px`)),e.style.height(h.map(a=>a==null?"":`${a.height}px`)),n.Icon({icon:"line-md:loading-twotone-loop",size:d??"md"}),e.html.span(e.attr.class("sr-only"),e.aria.live("polite"),g.$.loadingExtended)),()=>e.Fragment(e.on.click(a=>{l!=="submit"&&a.preventDefault(),k&&a.stopPropagation(),b()}),...x)),e.When(r!=null,()=>m.ElementRect(a=>(a.on(c=>{e.Value.get(r??!1)||h.set(c)}),e.Empty)))))}function w(l,o,r){const t=[l?"bc-base-input-container":"bc-input-container"];return o?t.push(l?"bc-base-input-container--disabled":"bc-input-container--disabled"):t.push(l?"bc-base-input-container--default":"bc-input-container--default"),r&&t.push("bc-input-container--error"),t.join(" ")}function v(l,o){const r=["bc-input-container__input"];return l||(r.push(`bc-control--padding-${o}`),r.push(`bc-control--text-size-${o}`)),r.join(" ")}const B=({baseContainer:l,class:o,classes:r,disabled:t,input:d,before:s,after:u,hasError:b,focusableSelector:i="input, select, textarea",growInput:k=!0,size:x},...h)=>{const g=e.Value.map(t??!1,a=>a);return e.html.div(e.WithElement(a=>{const c=()=>{a.querySelector(i)?.focus()};return a.addEventListener("click",c),e.OnDispose(()=>a.removeEventListener("click",c))}),e.attr.class(e.computedOf(l,g,b??!1)((a,c,p)=>w(a??!1,c??!1,p??!1))),e.attr.class(o),e.attr.class(r?.container),s!=null?e.html.span(e.attr.class("bc-input-container__before"),s):null,e.html.div(e.attr.class(e.computedOf(l,x??"md")((a,c)=>v(a??!1,c??"md"))),e.attr.class(e.Value.map(k,a=>a?"bc-input-container__input--grow":"")),e.attr.class(r?.wrapper),d),u!=null?e.html.span(e.attr.class("bc-input-container__after"),u):null,...h)};function I({icon:l,size:o="md",color:r="neutral"}){return e.html.span(e.attr.class("bc-input-container__icon"),n.Icon({icon:l,size:o,color:r}))}exports.Button=V;exports.InputContainer=B;exports.InputIcon=I;exports.generateButtonClasses=f;exports.generateButtonStyles=C;exports.generateInputContainerInputClasses=v;
@@ -0,0 +1,263 @@
1
+ import { prop as B, Use as E, html as g, attr as l, computedOf as p, aria as m, When as D, Fragment as y, style as L, on as V, Value as I, Empty as j, WithElement as S, OnDispose as O } from "@tempots/dom";
2
+ import { t as h, b as k, h as c, a as v, B as U, I as _ } from "./translations-BGblCUBj.js";
3
+ import { ElementRect as W } from "@tempots/ui";
4
+ function q(r, e, o, t) {
5
+ const u = [
6
+ "bc-button",
7
+ `bc-button--size-${r}`,
8
+ `bc-control--padding-${r}`,
9
+ `bc-control--rounded-${e}`
10
+ ];
11
+ return o && u.push("bc-button--loading"), t && u.push("bc-button--full-width"), u.join(" ");
12
+ }
13
+ function z(r, e, o) {
14
+ const t = /* @__PURE__ */ new Map();
15
+ t.set("--button-text-shadow", "var(--text-shadow-none)"), t.set("--button-text-shadow-dark", "var(--text-shadow-none)");
16
+ const u = (a, s, b, i) => {
17
+ o || (t.set("--button-bg-hover", a), t.set("--button-text-hover", b), t.set("--button-bg-hover-dark", s), t.set("--button-text-hover-dark", i));
18
+ };
19
+ switch (r) {
20
+ case "filled": {
21
+ const a = k(e, "solid", "light"), s = k(e, "solid", "dark");
22
+ t.set("--button-bg", a.backgroundColor), t.set("--button-text", a.textColor), t.set("--button-bg-dark", s.backgroundColor), t.set("--button-text-dark", s.textColor), t.set(
23
+ "--button-text-shadow",
24
+ "var(--text-shadow-button-filled, var(--text-shadow-sm))"
25
+ ), t.set(
26
+ "--button-text-shadow-dark",
27
+ "var(--text-shadow-button-filled, var(--text-shadow-sm))"
28
+ );
29
+ const b = c(e, "solid", "light"), i = c(e, "solid", "dark");
30
+ u(
31
+ b.backgroundColor,
32
+ i.backgroundColor,
33
+ b.textColor,
34
+ i.textColor
35
+ );
36
+ break;
37
+ }
38
+ case "light": {
39
+ const a = k(e, "light", "light"), s = k(e, "light", "dark");
40
+ t.set("--button-bg", a.backgroundColor), t.set("--button-text", a.textColor), t.set("--button-bg-dark", s.backgroundColor), t.set("--button-text-dark", s.textColor);
41
+ const b = c(e, "light", "light"), i = c(e, "light", "dark");
42
+ u(
43
+ b.backgroundColor,
44
+ i.backgroundColor,
45
+ b.textColor,
46
+ i.textColor
47
+ );
48
+ break;
49
+ }
50
+ case "outline": {
51
+ t.set("--button-bg", "transparent"), t.set("--button-bg-dark", "transparent"), t.set("--button-border", v(e, "light")), t.set("--button-border-dark", v(e, "dark")), t.set("--button-text", h(e, "light")), t.set("--button-text-dark", h(e, "dark")), t.set(
52
+ "--button-text-shadow",
53
+ "var(--text-shadow-button-light, var(--text-shadow-xs))"
54
+ ), t.set(
55
+ "--button-text-shadow-dark",
56
+ "var(--text-shadow-button-light, var(--text-shadow-xs))"
57
+ );
58
+ const a = c(e, "light", "light"), s = c(e, "light", "dark");
59
+ u(
60
+ a.backgroundColor,
61
+ s.backgroundColor,
62
+ a.textColor,
63
+ s.textColor
64
+ );
65
+ break;
66
+ }
67
+ case "dashed": {
68
+ t.set("--button-bg", "transparent"), t.set("--button-bg-dark", "transparent"), t.set("--button-border", v(e, "light")), t.set("--button-border-dark", v(e, "dark")), t.set("--button-border-style", "dashed"), t.set("--button-text", h(e, "light")), t.set("--button-text-dark", h(e, "dark"));
69
+ const a = c(e, "light", "light"), s = c(e, "light", "dark");
70
+ u(
71
+ a.backgroundColor,
72
+ s.backgroundColor,
73
+ a.textColor,
74
+ s.textColor
75
+ );
76
+ break;
77
+ }
78
+ case "default": {
79
+ const a = k("neutral", "light", "light"), s = k("neutral", "light", "dark");
80
+ t.set("--button-bg", a.backgroundColor), t.set("--button-text", h(e, "light")), t.set("--button-bg-dark", s.backgroundColor), t.set("--button-text-dark", h(e, "dark")), t.set(
81
+ "--button-text-shadow",
82
+ "var(--text-shadow-button-default, var(--text-shadow-2xs))"
83
+ ), t.set(
84
+ "--button-text-shadow-dark",
85
+ "var(--text-shadow-button-default, var(--text-shadow-2xs))"
86
+ );
87
+ const b = c("base", "light", "light"), i = c("base", "light", "dark");
88
+ u(
89
+ b.backgroundColor,
90
+ i.backgroundColor,
91
+ t.get("--button-text") ?? a.textColor,
92
+ t.get("--button-text-dark") ?? s.textColor
93
+ );
94
+ break;
95
+ }
96
+ case "text": {
97
+ t.set("--button-bg", "transparent"), t.set("--button-bg-dark", "transparent"), t.set("--button-text", h(e, "light")), t.set("--button-text-dark", h(e, "dark")), o || t.set("--button-hover-decoration", "underline");
98
+ break;
99
+ }
100
+ }
101
+ return Array.from(t.entries()).map(([a, s]) => `${a}: ${s}`).join("; ");
102
+ }
103
+ function R({
104
+ type: r = "button",
105
+ disabled: e = !1,
106
+ loading: o = !1,
107
+ variant: t = "filled",
108
+ size: u = "md",
109
+ color: a = "base",
110
+ roundedness: s = "sm",
111
+ onClick: b = () => {
112
+ },
113
+ fullWidth: i = !1,
114
+ stopPropagation: C = !0
115
+ }, ...w) {
116
+ const x = B(null);
117
+ return E(
118
+ U,
119
+ (f) => g.button(
120
+ l.type(r),
121
+ l.disabled(
122
+ p(
123
+ e,
124
+ o
125
+ )((n, d) => n || d)
126
+ ),
127
+ // Add ARIA attributes for accessibility
128
+ m.busy(o ?? !1),
129
+ D(o ?? !1, () => m.label(f.$.loadingExtended)),
130
+ l.class(
131
+ p(u, s, o, i)(q)
132
+ ),
133
+ l.style(p(t, a, e)(z)),
134
+ D(
135
+ o ?? !1,
136
+ () => y(
137
+ L.width(
138
+ x.map((n) => n == null ? "" : `${n.width}px`)
139
+ ),
140
+ L.height(
141
+ x.map((n) => n == null ? "" : `${n.height}px`)
142
+ ),
143
+ _({ icon: "line-md:loading-twotone-loop", size: u ?? "md" }),
144
+ // Hidden live region for screen reader announcements
145
+ g.span(
146
+ l.class("sr-only"),
147
+ m.live("polite"),
148
+ f.$.loadingExtended
149
+ )
150
+ ),
151
+ () => y(
152
+ V.click((n) => {
153
+ r !== "submit" && n.preventDefault(), C && n.stopPropagation(), b();
154
+ }),
155
+ ...w
156
+ )
157
+ ),
158
+ D(
159
+ o != null,
160
+ () => W((n) => (n.on((d) => {
161
+ I.get(o ?? !1) || x.set(d);
162
+ }), j))
163
+ )
164
+ )
165
+ );
166
+ }
167
+ function A(r, e, o) {
168
+ const t = [
169
+ r ? "bc-base-input-container" : "bc-input-container"
170
+ ];
171
+ return e ? t.push(
172
+ r ? "bc-base-input-container--disabled" : "bc-input-container--disabled"
173
+ ) : t.push(
174
+ r ? "bc-base-input-container--default" : "bc-input-container--default"
175
+ ), o && t.push("bc-input-container--error"), t.join(" ");
176
+ }
177
+ function F(r, e) {
178
+ const o = ["bc-input-container__input"];
179
+ return r || (o.push(`bc-control--padding-${e}`), o.push(`bc-control--text-size-${e}`)), o.join(" ");
180
+ }
181
+ const G = ({
182
+ baseContainer: r,
183
+ class: e,
184
+ classes: o,
185
+ disabled: t,
186
+ input: u,
187
+ before: a,
188
+ after: s,
189
+ hasError: b,
190
+ focusableSelector: i = "input, select, textarea",
191
+ growInput: C = !0,
192
+ size: w
193
+ }, ...x) => {
194
+ const f = I.map(t ?? !1, (n) => n);
195
+ return g.div(
196
+ S((n) => {
197
+ const d = () => {
198
+ n.querySelector(i)?.focus();
199
+ };
200
+ return n.addEventListener("click", d), O(() => n.removeEventListener("click", d));
201
+ }),
202
+ l.class(
203
+ p(
204
+ r,
205
+ f,
206
+ b ?? !1
207
+ // size ?? 'md'
208
+ )(
209
+ (n, d, $) => A(
210
+ n ?? !1,
211
+ d ?? !1,
212
+ $ ?? !1
213
+ // (size ?? 'md') as ControlSize
214
+ )
215
+ )
216
+ ),
217
+ l.class(e),
218
+ l.class(o?.container),
219
+ a != null ? g.span(l.class("bc-input-container__before"), a) : null,
220
+ g.div(
221
+ l.class(
222
+ p(
223
+ r,
224
+ w ?? "md"
225
+ )(
226
+ (n, d) => F(
227
+ n ?? !1,
228
+ d ?? "md"
229
+ )
230
+ )
231
+ ),
232
+ // attr.class('bc-input-container__input'),
233
+ l.class(
234
+ I.map(
235
+ C,
236
+ (n) => n ? "bc-input-container__input--grow" : ""
237
+ )
238
+ ),
239
+ l.class(o?.wrapper),
240
+ u
241
+ ),
242
+ s != null ? g.span(l.class("bc-input-container__after"), s) : null,
243
+ ...x
244
+ );
245
+ };
246
+ function J({
247
+ icon: r,
248
+ size: e = "md",
249
+ color: o = "neutral"
250
+ }) {
251
+ return g.span(
252
+ l.class("bc-input-container__icon"),
253
+ _({ icon: r, size: e, color: o })
254
+ );
255
+ }
256
+ export {
257
+ R as B,
258
+ G as I,
259
+ J as a,
260
+ q as b,
261
+ z as c,
262
+ F as g
263
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("../widget-customization-B9Oc1bG4.cjs"),A=require("../oneof-branch-detection-Vov_e3kI.cjs"),l=require("@tempots/dom"),ve=require("../string-B9vVyfq3.cjs"),I=require("../deep-merge-UghuPcyW.cjs"),P=require("../stack-DcZ_u50f.cjs"),v=require("../use-form-Uree6QFy.cjs"),F=require("../utils-DIUEhA-Z.cjs"),_e=require("../text-input-8v79fzEy.cjs"),Z=require("../notice-Bc1L4Zpr.cjs"),q=require("../translations-gVgMyNno.cjs"),Se=require("../colors-BI0YhONJ.cjs"),we=require("../input-container-CSi72GI1.cjs");function Oe(e){if(!e||typeof e!="object")return!1;const t=e;return!!(e.if||t.dependentRequired||t.dependentSchemas||e.dependencies)}function Ce(e,t,n,r=[]){if(!n)return null;try{if(A.compileWithCache(n,e)(t)){const a=e.title||"disallowed schema";return{path:r,message:`Value matches ${a}`,notSchema:e}}return null}catch{return null}}function Ae(e,t,n,r=[]){const i=[],o=[],a=ie(e,t,n);a&&i.push(a);const s=Array.isArray(e.required)?[...e.required]:[];if(typeof t=="object"&&t!=null&&!Array.isArray(t)){const m=t,f=e.dependentRequired;if(f){for(const[d,p]of Object.entries(f))if(Object.prototype.hasOwnProperty.call(m,d))for(const w of p)s.push(w)}const b=e.dependencies;if(b){for(const[d,p]of Object.entries(b))if(Object.prototype.hasOwnProperty.call(m,d))if(Array.isArray(p))for(const w of p)s.push(w);else typeof p=="object"&&p&&i.push(p)}const S=e.dependentSchemas;if(S)for(const[d,p]of Object.entries(S))Object.prototype.hasOwnProperty.call(m,d)&&i.push(p)}const u=[e,...i],{mergedSchema:c,conflicts:y}=A.mergeAllOf(u,r);if(s.length>0){const m=new Set([...c.required??[],...s]);c.required=[...m]}return o.push(...y),{effective:c,conflicts:o}}function ie(e,t,n){if(!n||!e.if||typeof e.if!="object")return null;try{if(A.compileWithCache(n,e.if)(t)){const o=e.then;if(o&&typeof o=="object")return o}else{const o=e.else;if(o&&typeof o=="object")return o}}catch{}return null}function D(e,t,n){const r=new Set;if(!t||typeof t!="object")return r;if(e.properties&&Object.keys(e.properties).forEach(a=>{a in t&&r.add(a)}),e.patternProperties&&Object.keys(t).forEach(a=>{Object.keys(e.patternProperties).forEach(s=>{try{new RegExp(s).test(a)&&r.add(a)}catch{}})}),e.additionalProperties===!0||e.additionalProperties&&typeof e.additionalProperties=="object"){const a=new Set;e.properties&&Object.keys(e.properties).forEach(s=>{s in t&&a.add(s)}),e.patternProperties&&Object.keys(t).forEach(s=>{Object.keys(e.patternProperties).forEach(u=>{try{new RegExp(u).test(s)&&a.add(s)}catch{}})}),Object.keys(t).forEach(s=>{a.has(s)||r.add(s)})}e.allOf&&e.allOf.forEach(a=>{typeof a=="object"&&D(a,t,n).forEach(u=>r.add(u))});const i=ie(e,t,n);i&&D(i,t,n).forEach(s=>r.add(s));const o=e.dependentSchemas;return o&&Object.keys(o).forEach(a=>{if(a in t){const s=o[a];typeof s=="object"&&D(s,t,n).forEach(c=>r.add(c))}}),e.dependencies&&Object.keys(e.dependencies).forEach(a=>{if(a in t){const s=e.dependencies[a];typeof s=="object"&&!Array.isArray(s)&&D(s,t,n).forEach(c=>r.add(c))}}),r}function L({ctx:e}){const{examples:t,default:n}=e;let{description:r}=e;r==null&&t!=null&&n!=null&&(Array.isArray(t)?r=`example: ${t[0]}`:r=`example: ${t}`);const i=[];if(e.isDeprecated&&i.push("deprecated"),e.isReadOnly&&!e.shouldIgnoreReadOnly&&i.push("read-only"),e.isWriteOnly&&!e.shouldShowWriteOnly&&i.push("write-only"),i.length>0){const o=`(${i.join(", ")})`;r=r?`${r} ${o}`:o}return{label:e.suppressLabel?void 0:e.widgetLabel,description:r,required:e.isPropertyRequired,layout:e.horizontal?"horizontal":"vertical"}}function H(e,t){if(e.default!=null)return t(e.default);if(Array.isArray(e.examples))return t(e.examples[0]);if(e.examples!=null)return t(e.examples)}function je(e){return e==null?1:Math.round(e)}function oe(e){return e.isWriteOnly&&!e.shouldShowWriteOnly}function ae(e){return e.isReadOnly&&!e.shouldIgnoreReadOnly||e.isDeprecated}function W({ctx:e,controller:t,resolved:n}){const r=n?.widget,i={controller:t,ctx:e,options:n?.options,setStatus:e.setStatus,formValue:e.formValue,validationMode:e.validationMode,submitting:e.submitting};if(r!=null&&e.widgetRegistry){const a=e.widgetRegistry.get(r);if(a)return a.factory(i)}if(r!=null){const a=j.globalWidgetRegistry.get(r);if(a)return a.factory(i)}if(e.widgetRegistry){const a=e.widgetRegistry.findBestWidget(e);if(a)return a.registration.factory(i)}const o=j.globalWidgetRegistry.findBestWidget(e);return o?o.registration.factory(i):null}function Ie(e){const{options:t,selected:n,onChange:r,mode:i="auto",size:o="sm",keyFor:a=y=>String(y),parseKey:s=y=>y}=e,u=t.length;if((i==="auto"?u<=3?"segmented":"select":i)==="segmented"){const y=Object.fromEntries(t.map(m=>[a(m.value),m.label]));return I.SegmentedInput({options:y,value:l.Value.map(n,m=>a(m)),onChange:m=>r(s(m)),size:o})}return I.NativeSelect({options:t.map(y=>({type:"value",value:y.value,label:y.label})),value:n,onChange:r})}function ke({ctx:e,showSelector:t,selector:n,inner:r}){return e.isRoot?t?P.Stack(l.attr.class("bc-stack--gap-2"),n,r):r:v.InputWrapper({...L({ctx:e}),content:t?P.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),n,r):r})}function Ke(e,t){if(e===null)return t.includes("null")?"null":null;switch(typeof e){case"string":return t.includes("string")?"string":null;case"number":return Number.isInteger(e)&&t.includes("integer")?"integer":t.includes("number")?"number":null;case"boolean":return t.includes("boolean")?"boolean":null;case"object":return Array.isArray(e)?t.includes("array")?"array":null:t.includes("object")?"object":null;default:return null}}function ze(e,t){try{switch(t){case"string":return e==null?{ok:!0,value:void 0}:{ok:!0,value:String(e)};case"number":{if(typeof e=="number")return{ok:!0,value:e};if(typeof e=="string"){const n=Number(e);return Number.isFinite(n)?{ok:!0,value:n}:{ok:!1}}return typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1}}case"integer":return typeof e=="number"&&Number.isInteger(e)?{ok:!0,value:e}:typeof e=="string"?/^[-+]?\d+$/.test(e.trim())?{ok:!0,value:parseInt(e,10)}:{ok:!1}:typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1};case"boolean":{if(typeof e=="boolean")return{ok:!0,value:e};if(typeof e=="string"){const n=e.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"?{ok:!0,value:!0}:n==="false"||n==="0"||n==="no"?{ok:!0,value:!1}:{ok:!1}}return typeof e=="number"?{ok:!0,value:e!==0}:{ok:!1}}case"array":return Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"object":return e!=null&&typeof e=="object"&&!Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"null":return{ok:!0,value:null}}}catch{return{ok:!1}}}function He(e){switch(e){case"null":return null;case"array":return[];case"object":return{};default:return}}function Ge(e){if(typeof e=="boolean")return{};const t=e["x:ui"];if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const n=t;return{unionDefault:typeof n.unionDefault=="string"?n.unionDefault:void 0,confirmBranchChange:!!n.confirmBranchChange,selector:n.selector==="segmented"||n.selector==="select"?n.selector:void 0}}return{}}function Xe(e){const{definition:t}=e;if(typeof t=="boolean")return;const n={pattern:t.pattern,minLength:t.minLength,maxLength:t.maxLength},r=F.resolveWidget(t,e.name),i=r?.widget;if(i!=null)switch(i){case"binary":return{...n,format:"binary",...r?.options};case"date":return{...n,format:"date"};case"date-time":return{...n,format:"date-time"};case"email":return{...n,format:"email"};case"markdown":return{...n,format:"markdown"};case"password":return{...n,format:"password"};case"textarea":return{...n,format:"textarea"};case"time":return{...n,format:"time"};case"uuid":return{format:"uuid"};case"url":return{...n,format:"url"};case"uri":return{...n,format:"uri"};case"uri-reference":return{...n,format:"uri-reference"};case"hostname":return{...n,format:"hostname"};case"ipv4":return{...n,format:"ipv4"};case"ipv6":return{...n,format:"ipv6"};case"regex":return{...n,format:"regex"};case"duration":return{...n,format:"duration"};case"color":return{...n,format:"color"}}}const Ye=e=>{const{value:t,onBlur:n,onChange:r,onInput:i,after:o,disabled:a,...s}=e,u=I.NullableResetAfter(t,a,r??i);return j.Base64Input({...s,value:l.Value.map(t,c=>c??void 0),onChange:r!=null?c=>r(c??null):void 0,onInput:i!=null?c=>i(c??null):void 0,onBlur:n,after:o!=null?l.Fragment(u,o):u})};function fe({ctx:e,options:t,controller:n}){const r=Xe(e),i=!e.isNullable,o=()=>i?I.transformNullToUndefined(n):n;switch(r?.format){case"email":return v.Control(j.NullableEmailInput,{...t,controller:o()});case"date":return v.MappedControl(j.NullableDateInput,{...t,controller:o(),toInput:a=>a==null?null:new Date(a),fromInput:a=>a?.toISOString().split("T")[0]??null});case"date-time":return v.MappedControl(j.NullableDateTimeInput,{...t,controller:o(),toInput:a=>a==null?null:new Date(a),fromInput:a=>a?.toISOString()??null});case"time":return v.Control(j.NullableTextInput,{...t,controller:o(),placeholder:"HH:MM:SS"});case"password":return v.Control(j.NullablePasswordInput,{...t,controller:o()});case"binary":{const{definition:a}=e,s=typeof a=="object"?a["x:ui"]:void 0;return r.mediaType&&(r.mediaType.startsWith("image/")||r.mediaType.startsWith("video/")||r.mediaType.startsWith("audio/")||r.mediaType==="application/pdf"||s?.preferFileUpload===!0)?v.Control(Ye,{...t,controller:o(),mode:"input",accept:r.mediaType||"*/*",maxFileSize:(typeof s?.maxBytes=="number"?s.maxBytes:void 0)||(typeof s?.maxFileSize=="number"?s.maxFileSize:void 0),showFileList:!0}):v.Control(j.NullableTextArea,{...t,controller:o(),placeholder:"Paste base64-encoded data",rows:3})}case"uri":case"url":return v.Control(j.NullableUrlInput,{...t,controller:o(),placeholder:"https://example.com"});case"uri-reference":return v.Control(j.NullableTextInput,{...t,controller:o(),placeholder:"Enter URL..."});case"hostname":return v.Control(j.NullableTextInput,{...t,controller:o(),placeholder:"example.com"});case"ipv4":return v.Control(j.NullableTextInput,{...t,controller:o(),placeholder:"192.168.1.1"});case"ipv6":return v.Control(j.NullableTextInput,{...t,controller:o(),placeholder:"2001:db8::1"});case"regex":return v.Control(j.NullableTextArea,{...t,controller:o(),placeholder:"^[a-zA-Z0-9]+$",rows:3});case"duration":return I.WithTemporal(({Duration:a})=>v.MappedControl(I.NullableDurationInput,{...t,controller:o(),toInput:s=>s==null?null:a.from(s),fromInput:s=>s?.toString?.()??null}));case"color":return v.Control(j.ColorSwatchInput,{...t,controller:n,displayValue:!0});case"uuid":return v.Control(j.NullableUUIDInput,{...t,controller:o()});case"textarea":return v.Control(j.NullableTextArea,{...t,controller:o()});default:return v.Control(j.NullableTextInput,{...t,controller:o()})}}function Q({ctx:e,controller:t}){if(oe(e))return l.Empty;const n=F.resolveWidget(e.definition,e.name),r=n?.widget,i=W({ctx:e,controller:t,resolved:n});if(i)return i;const o={...L({ctx:e}),placeholder:H(e.definition,String),disabled:ae(e)};if((e.isNullable||e.isOptional)&&!e.shouldShowPresenceToggle)return fe({ctx:e,options:o,controller:t});if(r!=null&&["url","uri","uri-reference","hostname","ipv4","ipv6","regex","duration","binary","markdown","time","color"].includes(r))return fe({ctx:e,options:o,controller:t});switch(r){case"email":return v.Control(Z.EmailInput,{...o,controller:I.transformEmptyStringToUndefined(t)});case"password":return v.Control(Z.PasswordInput,{...o,controller:I.transformEmptyStringToUndefined(t)});case"uuid":return v.Control(I.UUIDInput,{...o,controller:I.transformEmptyStringToUndefined(t)});case"textarea":return v.Control(I.TextArea,{...o,controller:I.transformEmptyStringToUndefined(t)});default:return v.Control(_e.TextInput,{...o,controller:I.transformEmptyStringToUndefined(t)})}}function Ze(e){const t=F.resolveWidget(e.definition,e.name);if(t?.widget==="slider")return{widget:"slider",options:t.options};if(t?.widget==="rating")return{widget:"rating",options:t.options};const n=e.definition,r=typeof n=="object"?n["x:ui"]:void 0;return r?.displayFormat==="currency"?{widget:"currency",options:{currency:typeof r?.currency=="string"?r.currency:"USD"}}:r?.displayFormat==="percent"?{widget:"percent"}:{widget:"number"}}function G({ctx:e,controller:t}){if(oe(e))return l.Empty;const n=e.definition,r=Ze(e),i=F.resolveWidget(e.definition,e.name),o=W({ctx:e,controller:t,resolved:i});if(o)return o;const a={...L({ctx:e}),placeholder:H(e.definition,String),min:n.minimum,max:n.maximum,step:n.multipleOf,disabled:ae(e)},s=(e.isNullable||e.isOptional)&&!e.shouldShowPresenceToggle,u=s&&!e.isNullable;switch(r.widget){case"rating":const c=(typeof r.options?.max=="number"?r.options.max:n.maximum)||5;return s?v.Control(j.NullableRatingInput,{...a,max:c,controller:u?I.transformNullToUndefined(t):t}):v.Control(j.RatingInput,{...a,max:c,controller:t});case"slider":return s?v.Control(j.NullableSliderInput,{...a,controller:u?I.transformNullToUndefined(t):t}):v.Control(j.SliderInput,{...a,controller:t});case"currency":const y=typeof r.options?.currency=="string"?r.options.currency:"USD";return s?v.Control(I.MaskInput,{...a,mask:de(y),controller:t}):v.Control(I.MaskInput,{...a,mask:de(y),controller:t});case"percent":return s?v.Control(I.MaskInput,{...a,mask:pe(),controller:t}):v.Control(I.MaskInput,{...a,mask:pe(),controller:t});default:return s?v.Control(I.NullableNumberInput,{...a,controller:u?I.transformNullToUndefined(t):t}):v.Control(I.NumberInput,{...a,controller:t})}}function de(e){return`${Qe(e)} 000,000.00`}function pe(){return"000.00%"}function Qe(e){return{USD:"$",EUR:"€",GBP:"£",JPY:"¥",CAD:"C$",AUD:"A$"}[e.toUpperCase()]||e}function ee({ctx:e,controller:t}){return G({ctx:e.with({definition:{...e.definition,multipleOf:je(e.definition.multipleOf)}}),controller:t})}function te({ctx:e,controller:t}){if(oe(e))return l.Empty;const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i={...L({ctx:e}),disabled:ae(e)},o=v.Control(v.CheckboxInput,{...i,controller:t});if(!e.isNullable&&(!e.isOptional||e.shouldShowPresenceToggle))return o;const a=!e.isNullable;return v.Control(v.CheckboxInput,{...i,controller:t,after:I.NullableResetAfter(t.signal,t.disabled,()=>t.change(a?void 0:null))})}function se({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});return r||l.WithElement(()=>{t.change(null)})}function et({conflicts:e}){return e.length===0?l.Empty:l.Use(q.BeatUII18n,t=>Z.Notice({variant:"warning",tone:"prominent",title:t.value.schemaConflictsDetected,class:"bc-schema-conflicts-banner"},l.html.ul(l.attr.style("margin: 0; padding-left: 1.25rem; list-style-type: disc;"),...e.map(n=>l.html.li(l.attr.style("margin-bottom: 0.25rem;"),n.message,n.path.length>0?l.html.code(l.attr.style("margin-left: 0.5rem; font-size: 0.75rem; opacity: 0.7;"),` (${n.path.join(".")})`):null)))))}function tt({violations:e}){return e.length===0?l.Empty:l.Use(q.BeatUII18n,t=>Z.Notice({variant:"danger",tone:"prominent",title:t.value.schemaViolationsDetected,class:"bc-not-violations-banner"},l.html.ul(l.attr.style("margin: 0; padding-left: 1.25rem; list-style-type: disc;"),...e.map(n=>l.html.li(l.attr.style("margin-bottom: 0.25rem;"),n.message,n.path.length>0?l.html.code(l.attr.style("margin-left: 0.5rem; font-size: 0.75rem; opacity: 0.7;"),` (${n.path.join(".")})`):null)))))}function nt({ctx:e,controller:t,content:n}){const r=l.Value.map(t.signal,a=>a!==void 0),i=e.widgetLabel??"Property",o=a=>{if(a){const s=e.default;if(s!==void 0)t.change(s);else{const u=e.definition;u.type==="string"?t.change(""):u.type==="number"||u.type==="integer"?t.change(0):u.type==="boolean"?t.change(!1):u.type==="array"?t.change([]):u.type==="object"?t.change({}):t.change(null)}}else t.change(void 0)};return P.Stack(l.html.div(l.attr.class("bc-presence-toggle"),v.InputWrapper({layout:"horizontal",label:`Include ${i}`,content:j.Switch({value:r,onChange:o,size:"xs"})})),l.When(r,()=>n))}function E(e,t,n){const r=e.schemaConflicts.length>0,i=e.notViolations.length>0,o=e.shouldShowPresenceToggle&&n!=null;let a=t;return o&&n!=null&&(a=nt({ctx:e,controller:n,content:t})),!r&&!i?a:P.Stack(l.attr.class("bc-stack--gap-2"),i?tt({violations:e.notViolations}):null,r?et({conflicts:e.schemaConflicts}):null,a)}function Ne(e){if(typeof e=="boolean")return;const t=e["x:ui"];if(!t||!t.visibleIf)return;const n=t.visibleIf;if(typeof n=="string"||typeof n=="object"&&n!==null)return n}function rt(e){if(e.startsWith("!"))return{field:e.slice(1),operator:"falsy"};if(e.includes("!=")){const[t,n]=e.split("!=",2);return{field:t.trim(),operator:"notEquals",value:me(n.trim())}}if(e.includes("=")){const[t,n]=e.split("=",2);return{field:t.trim(),operator:"equals",value:me(n.trim())}}return{field:e.trim(),operator:"truthy"}}function me(e){if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);if(e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e!=="undefined")return/^-?\d+(\.\d+)?$/.test(e)?parseFloat(e):e}function it(e,t){if(e==null||typeof e!="object")return;const n=t.split(".");let r=e;for(const i of n){if(r==null||typeof r!="object")return;if(Array.isArray(r)){const o=parseInt(i,10);if(!isNaN(o))r=r[o];else return}else r=r[i]}return r}function ne(e,t){const n=it(t,e.field);switch(e.operator){case"equals":return n===e.value;case"notEquals":return n!==e.value;case"truthy":return!!n;case"falsy":return!n;case"contains":return typeof n=="string"&&typeof e.value=="string"||Array.isArray(n)?n.includes(e.value):!1;case"notContains":return typeof n=="string"&&typeof e.value=="string"||Array.isArray(n)?!n.includes(e.value):!0;case"greaterThan":return typeof n=="number"&&typeof e.value=="number"&&n>e.value;case"lessThan":return typeof n=="number"&&typeof e.value=="number"&&n<e.value;case"greaterThanOrEqual":return typeof n=="number"&&typeof e.value=="number"&&n>=e.value;case"lessThanOrEqual":return typeof n=="number"&&typeof e.value=="number"&&n<=e.value;case"in":return Array.isArray(e.values)&&e.values.includes(n);case"notIn":return!Array.isArray(e.values)||!e.values.includes(n);default:return!1}}function Pe(e,t){const n=e.conditions.map(r=>"operator"in r&&["and","or","not"].includes(r.operator)?Pe(r,t):ne(r,t));switch(e.operator){case"and":return n.every(Boolean);case"or":return n.some(Boolean);case"not":return!n[0];default:return!1}}function ot(e,t){try{if(typeof e=="string"){const n=rt(e);return ne(n,t)}return"operator"in e&&["and","or","not"].includes(e.operator)?Pe(e,t):ne(e,t)}catch(n){return console.warn("Error evaluating visibility condition:",n),!0}}function at(e,t){return l.computedOf(t)(n=>ot(e,n))}const ye={behavior:"hide",clearOnHide:!1};function st({ctx:e,controller:t,children:n,options:r=ye}){const i=Ne(e.definition);if(!i)return n;const o={...ye,...r},a=lt(t),s=at(i,a);switch(o.clearOnHide&&s.on(u=>{!u&&t.signal.value!==void 0&&t.change(void 0)}),o.behavior){case"unmount":return l.When(s,()=>n);case"hide":default:return n}}function lt(e){return e.signal}function Ve({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const o=e.definition.enum??[],a=(e.isNullable||e.isOptional)&&!o.includes(null),s=!e.isNullable;return l.Use(q.BeatUII18n,u=>{const c=o.map(m=>({type:"value",value:m,label:String(m)}));a&&c.unshift({type:"value",value:null,label:l.Value.get(u.$.selectNone)});const y=a&&s?I.transformNullToUndefined(t):t;return I.NativeSelectControl({...L({ctx:e}),options:c,controller:y,equality:(m,f)=>m==null&&f==null?!0:m===f})})}function Ee({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition;return l.Fragment(l.WithElement(()=>{l.Value.get(t.signal)!==i.const&&t.change(i.const)}),I.Group(P.MutedLabel(e.widgetLabel,": "),P.Label(String(i.const))))}function Te(e,t,n){const{controller:r,effCtx:i,patternProps:o,apSchema:a,canRemove:s,lockKeyAfterSet:u,validatePropertyName:c}=n,y=r.field(e),m=l.prop(e),f=l.prop(null);let b=a;if(t){const w=Object.keys(o).find(h=>{try{return new RegExp(h).test(e)}catch{return!1}});if(w){const h=o[w];h!==!1&&typeof h=="object"&&(b=h)}}const S=w=>{const h=(w??"").trim();if(!h||h===e||Object.prototype.hasOwnProperty.call(l.Value.get(r.signal)??{},h))return;const g=c(h);if(!g.ok){f.set(g.message);return}f.set(null);const O={...l.Value.get(r.signal)??{}},C=O[e];delete O[e],O[h]=C,r.change(O)},d=l.Use(q.BeatUII18n,w=>v.CloseButton({size:"xs",label:w.$.removeItem,disabled:!s(Object.keys(l.Value.get(r.signal)??{}).length),onClick:()=>{const h=Object.keys(l.Value.get(r.signal)??{}).length;if(!s(h))return;const g={...l.Value.get(r.signal)??{}};delete g[e],r.change(g)}})),p=l.Value.map(y.signal,w=>u&&w!=null);return l.html.div(l.attr.class("bc-object-helpers__row"),l.style.gridTemplateColumns("2fr 3fr min-content"),v.InputWrapper({content:j.EditableText({value:m,onChange:S,disabled:l.computedOf(r.disabled,p)((w,h)=>w||h)}),error:l.Ensure(f,w=>l.html.div(l.attr.class("bc-object-helpers__error"),w)),description:Object.keys(o).length>0?l.html.div(l.attr.class("bc-object-helpers__description"),"Allowed patterns: ",Object.keys(o).join(", ")):null}),l.html.div($({ctx:i.with({definition:b,suppressLabel:!0}).append(e),controller:y})),l.html.div(l.attr.class("bc-object-helpers__remove"),d))}function Fe(e,t,n){const{controller:r,effCtx:i,patternProps:o,apSchema:a,unevaluatedProps:s,canRemove:u,lockKeyAfterSet:c,validatePropertyName:y}=n,m=r.field(e),f=l.prop(e),b=l.prop(null);let S;if(s&&typeof s=="object")S=s;else if(t){const h=Object.keys(o).find(g=>{try{return new RegExp(g).test(e)}catch{return!1}});if(h){const g=o[h];g!==!1&&typeof g=="object"?S=g:S=a}else S=a}else S=a;const d=h=>{const g=(h??"").trim();if(!g||g===e||Object.prototype.hasOwnProperty.call(l.Value.get(r.signal)??{},g))return;const O=y(g);if(!O.ok){b.set(O.message);return}b.set(null);const C={...l.Value.get(r.signal)??{}},N=C[e];delete C[e],C[g]=N,r.change(C)},p=l.Use(q.BeatUII18n,h=>v.CloseButton({size:"xs",label:h.$.removeItem,disabled:!u(Object.keys(l.Value.get(r.signal)??{}).length),onClick:()=>{const g=Object.keys(l.Value.get(r.signal)??{}).length;if(!u(g))return;const O={...l.Value.get(r.signal)??{}};delete O[e],r.change(O)}})),w=l.Value.map(m.signal,h=>c&&h!=null);return l.html.div(l.attr.class("bc-object-helpers__row"),l.style.gridTemplateColumns("2fr 3fr min-content"),v.InputWrapper({content:j.EditableText({value:f,onChange:d,disabled:l.computedOf(r.disabled,w)((h,g)=>h||g)}),error:l.Ensure(b,h=>l.html.div(l.attr.class("bc-object-helpers__error"),h)),description:l.html.div(l.attr.class("bc-object-helpers__description"),s===!1?"Unevaluated property (not allowed by schema)":"Unevaluated property",Object.keys(o).length>0?l.html.span(" • Allowed patterns: ",Object.keys(o).join(", ")):null)}),l.html.div($({ctx:i.with({definition:S,suppressLabel:!0}).append(e),controller:m})),l.html.div(l.attr.class("bc-object-helpers__remove"),p))}function We(e){const t=e.properties??{},n=new Set(Object.keys(t)),r=e.additionalProperties??!0,i=r!==!1,o=r===!0||r===void 0?{}:r,a=e.minProperties??0,s=e.maxProperties??1/0,u=e.unevaluatedProperties;let c=!0,y=null;u===!1?(c=!1,y="No unevaluated properties are allowed by schema"):u&&typeof u=="object"&&(c=!0);const m=e.patternProperties??{},f=Object.keys(m).filter(Boolean).map(p=>{try{return new RegExp(p)}catch{return null}}).filter(p=>p!=null),b=e.propertyNames,S=e["x:ui"],d=!!(S&&typeof S=="object"&&S.lockKeyAfterSet);return{knownProps:t,knownKeys:n,ap:r,apAllowed:i,apSchema:o,minProps:a,maxProps:s,unevaluatedProps:u,canAddUnevaluated:c,unevaluatedTooltip:y,patternProps:m,patternList:f,propertyNamesDef:b,lockKeyAfterSet:d}}function Re(e,t){const{knownKeys:n,apAllowed:r,patternList:i,patternProps:o,propertyNamesDef:a}=e;return s=>{const u=(s??"").trim();if(u==="")return{ok:!1,message:"Key cannot be empty"};if(a===!1)return{ok:!1,message:"No property names are allowed by schema"};if(a&&typeof a=="object"&&t)try{const c=t.compile(a);if(!c(u))return{ok:!1,message:c.errors?.[0]?.message??"Invalid property name"}}catch{}if(!r&&!n.has(u)){if(i.length===0)return{ok:!1,message:"Only declared properties are allowed"};if(!i.some(y=>y.test(u)))return{ok:!1,message:`Key must match one of: ${Object.keys(o).join(", ")}`}}return{ok:!0}}}function Me(e){const{minProps:t,apSchema:n,unevaluatedProps:r}=e;return{canRemove:s=>s>t,makeDefaultFor:s=>{const u=H(s,y=>y);if(u!==void 0)return u;const c=s.type;if(c==="string")return"";if(c==="number"||c==="integer")return 0;if(c==="boolean")return!1;if(c==="array")return[];if(c==="object")return{}},getValueSchemaForNew:()=>r&&typeof r=="object"?r:n}}function ut({ctx:e,controller:t,config:n,effective:r}){const i=Se.l(n.knownProps).filter(([,s])=>s!==!1),o=i.map(([s])=>s);return{children:i.map(([s,u])=>{const c=s,y=t.field(c);return $({ctx:e.with({definition:u,isPropertyRequired:Array.isArray(r.required)?r.required.includes(c):e.hasRequiredProperty(c),suppressLabel:!1}).append(c),controller:y})}),names:o}}function ct({controller:e,config:t,validatePropertyName:n,helpers:r}){if(!t.apAllowed)return null;const i=(o,a)=>{const s=o,u=y=>a.has(y)?!1:n(y).ok;if(u(s))return s;let c=1;for(;a.has(s+c)||!u(s+c);)c++;return s+c};return l.Use(q.BeatUII18n,o=>we.Button({variant:"outline",disabled:l.Value.map(e.signal,a=>!t.canAddUnevaluated||Object.keys(a??{}).length>=t.maxProps),onClick:()=>{const a=l.Value.get(e.signal)??{},s=Object.keys(a);if(!t.canAddUnevaluated||s.length>=t.maxProps)return;const u=new Set(s),c=i("property",u);if(!n(c).ok)return;const m=r.getValueSchemaForNew(),f=r.makeDefaultFor(m),b={...a,[c]:f};e.change(b)}},l.attr.title(t.unevaluatedTooltip),o.$.addLabel))}function Ue({ctx:e,containerLayout:t,content:n}){return!e.suppressLabel&&e.name!=null&&(!t||!["fieldset","group"].includes(t.format||""))?v.InputWrapper({...L({ctx:e}),content:n}):n}function ft({ctx:e,controller:t,baseDef:n}){const r=We(n),i=Re(r,e.ajv),o=Me(r),{children:a,names:s}=ut({ctx:e,controller:t,config:r,effective:n}),u=l.MapSignal(t.signal,b=>{const d=Object.keys(b??{}).filter(g=>!r.knownKeys.has(g));if(d.length===0)return l.Empty;const p=D(n,b??{},e.ajv),w=d.filter(g=>!p.has(g)),h=d.filter(g=>p.has(g));return l.Fragment(...h.map(g=>{const O=r.patternList.some(C=>C.test(g));return Te(g,O,{controller:t,effCtx:e,patternProps:r.patternProps,apSchema:r.apSchema,canRemove:o.canRemove,lockKeyAfterSet:r.lockKeyAfterSet,validatePropertyName:i})}),...w.map(g=>{const O=r.patternList.some(C=>C.test(g));return Fe(g,O,{controller:t,effCtx:e,patternProps:r.patternProps,apSchema:r.apSchema,unevaluatedProps:r.unevaluatedProps,canRemove:o.canRemove,lockKeyAfterSet:r.lockKeyAfterSet,validatePropertyName:i})}))}),c=ct({controller:t,config:r,validatePropertyName:i,helpers:o}),y=A.getContainerLayout(e),m=[...a,u,c].filter(Boolean),f=A.applyContainerLayout(y,e,m,s);return Ue({ctx:e,containerLayout:y,content:f})}function dt({ctx:e,controller:t,baseDef:n}){return l.MapSignal(t.signal,r=>{const{effective:i,conflicts:o}=Ae(n,r,e.ajv,e.path),a=e.with({definition:i,schemaConflicts:[...e.schemaConflicts,...o]}),s=We(i),u=Re(s,e.ajv),c=Me(s),y=Object.keys(r??{}),m=y.filter(k=>!s.knownKeys.has(k)),f=D(i,r??{},e.ajv),b=m.filter(k=>!f.has(k)),S=m.filter(k=>f.has(k)),d=s.apAllowed&&s.canAddUnevaluated&&y.length<s.maxProps,p=(k,R)=>{const V=k,x=K=>R.has(K)?!1:u(K).ok;if(x(V))return V;let B=1;for(;R.has(V+B)||!x(V+B);)B++;return V+B},w=l.Use(q.BeatUII18n,k=>we.Button({variant:"outline",disabled:!d,onClick:()=>{if(!d)return;const R=new Set(Object.keys(l.Value.get(t.signal)??{})),V=p("property",R);if(!u(V).ok)return;const B=c.getValueSchemaForNew(),K=c.makeDefaultFor(B),Y={...l.Value.get(t.signal)??{},[V]:K};t.change(Y)}},l.attr.title(s.unevaluatedTooltip),k.$.addLabel)),h=A.getContainerLayout(a),g=Se.l(s.knownProps).filter(([,k])=>k!==!1),C=[...g.map(([k])=>k),...S,...b],N=[...g.map(([k,R])=>{const V=k,x=t.field(V);return $({ctx:a.with({definition:R,isPropertyRequired:Array.isArray(i.required)?i.required.includes(V):a.hasRequiredProperty(V),suppressLabel:!1}).append(V),controller:x})}),...S.map(k=>{const R=s.patternList.some(V=>V.test(k));return Te(k,R,{controller:t,effCtx:a,patternProps:s.patternProps,apSchema:s.apSchema,canRemove:c.canRemove,lockKeyAfterSet:s.lockKeyAfterSet,validatePropertyName:u})}),...b.map(k=>{const R=s.patternList.some(V=>V.test(k));return Fe(k,R,{controller:t,effCtx:a,patternProps:s.patternProps,apSchema:s.apSchema,unevaluatedProps:s.unevaluatedProps,canRemove:c.canRemove,lockKeyAfterSet:s.lockKeyAfterSet,validatePropertyName:u})}),s.apAllowed?w:null].filter(Boolean),_=A.applyContainerLayout(h,a,N,C);return Ue({ctx:a,containerLayout:h,content:_})})}function le({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition;return Oe(i)?dt({ctx:e,controller:t,baseDef:i}):ft({ctx:e,controller:t,baseDef:i})}function pt(e){if(typeof e=="boolean")return{discriminator:null,type:null};if(e.discriminator&&typeof e.discriminator=="object"){const n=e.discriminator;if(typeof n.propertyName=="string")return{discriminator:{propertyName:n.propertyName,mapping:n.mapping||{}},type:"openapi"}}const t=e["x:ui"];return t?.discriminatorKey&&typeof t.discriminatorKey=="string"?{discriminator:{key:t.discriminatorKey,mapping:t.discriminatorMapping||{}},type:"beatui"}:{discriminator:null,type:null}}function mt(e,t,n){if(!t.discriminator||!n||typeof n!="object")return null;const{discriminator:r,type:i}=t;if(i==="openapi"){const o=r,a=n[o.propertyName];if(a==null)return null;if(o.mapping&&o.mapping[a]){const s=o.mapping[a];return yt(e,s)}return ge(e,o.propertyName,a)}if(i==="beatui"){const o=r,a=n[o.key];if(a==null)return null;if(o.mapping&&o.mapping[a]!=null){const s=o.mapping[a];return s>=0&&s<e.length?s:null}return ge(e,o.key,a)}return null}function yt(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(typeof r=="object"&&r.$ref===t)return n}return null}function ge(e,t,n){for(let r=0;r<e.length;r++){const i=e[r];if(typeof i!="object")continue;const o=i.properties;if(o&&o[t]){const a=o[t];if(typeof a=="object"&&a.const===n||typeof a=="object"&&Array.isArray(a.enum)&&a.enum.length===1&&a.enum[0]===n)return r}if(i.const===n)return r}return null}function Le({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition.anyOf;return Be({ctx:e,controller:t,kind:"anyOf",variants:i})}function $e({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition.oneOf;return Be({ctx:e,controller:t,kind:"oneOf",variants:i})}function gt({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const o=e.definition.allOf.filter(c=>typeof c=="object").map(c=>A.resolveAnyRef(c,e.schema,e.ajv)),{mergedSchema:a,conflicts:s}=A.mergeAllOf(o,e.path),u=e.with({definition:a,schemaConflicts:[...e.schemaConflicts,...s]});return $({ctx:u,controller:t})}function Be({ctx:e,controller:t,kind:n,variants:r}){const i=r.map((d,p)=>A.getOneOfBranchLabel(d,p,`${n} ${p+1}`)),o=typeof e.definition=="boolean"?{discriminator:null,type:null}:pt(e.definition),a=l.computedOf(t.signal,e.ajv)((d,p)=>{if(n==="oneOf"){if(o.discriminator){const w=mt(r,o,d);if(w!==null)return w}return A.autoSelectOneOfBranch(e,d,p)}return A.autoSelectOneOfBranch(e,d,p)}),s=l.Value.get(a),u=l.prop(s>=0?s:0);t.onDispose(u.dispose);let c=!1;const y=a.on(d=>{!c&&d>=0&&u.set(d)});t.onDispose(y);const m=r.length,f=d=>{c=!0,u.set(d)},b=m>1?Ie({options:r.map((d,p)=>({value:p,label:i[p]})),selected:u,onChange:f}):"",S=l.MapSignal(u,d=>$({ctx:e.with({definition:r[l.Value.get(d)],suppressLabel:!e.isRoot}),controller:t}));return ke({ctx:e,showSelector:m>1,selector:b,inner:S})}function $({ctx:e,controller:t}){const n=typeof e.definition=="boolean"?{}:e.definition;let r=n?.$ref?A.resolveRef(n,e.schema):n,i=e.with({definition:r});if(r?.allOf!=null){const a=r.allOf.filter(s=>typeof s=="object"&&s!==null);if(a.length>0){const s=a.map(f=>A.resolveAnyRef(f,e.schema,e.ajv)),{mergedSchema:u,conflicts:c}=A.mergeAllOf(s,e.path),{allOf:y,...m}=r;r={...m,...u},i=e.with({definition:r,schemaConflicts:[...e.schemaConflicts,...c]})}}let o=[...i.notViolations];if(r?.not!=null&&typeof r.not=="object"){const a=l.Value.get(t.signal),s=Ce(r.not,a,i.ajv,i.path);s&&(o=[...o,s],i=i.with({notViolations:o}))}if(r==null)return T(i,t,E(i,X({ctx:i,controller:t}),t));if(r.enum!=null)return T(i,t,E(i,Ve({ctx:i,controller:t}),t));if(r.const!=null)return T(i,t,E(i,Ee({ctx:i,controller:t}),t));if(r.anyOf!=null)return T(i,t,E(i,Le({ctx:i,controller:t}),t));if(r.oneOf!=null)return T(i,t,E(i,$e({ctx:i,controller:t}),t));if(r?.type==null)return E(i,X({ctx:i,controller:t}),t);if(Array.isArray(r.type)){const s=r.type.filter(u=>u!=="null");if(s.length===1&&["string","number","integer","boolean"].includes(s[0]))switch(s[0]){case"number":return E(i,G({ctx:i,controller:t}),t);case"integer":return E(i,ee({ctx:i,controller:t}),t);case"string":return E(i,Q({ctx:i,controller:t}),t);case"boolean":return E(i,te({ctx:i,controller:t}),t)}return T(i,t,E(i,ce({ctx:i,controller:t}),t))}switch(r.type){case"number":return T(i,t,E(i,G({ctx:i,controller:t}),t));case"integer":return T(i,t,E(i,ee({ctx:i,controller:t}),t));case"string":return T(i,t,E(i,Q({ctx:i,controller:t}),t));case"boolean":return T(i,t,E(i,te({ctx:i,controller:t}),t));case"array":return T(i,t,E(i,ue({ctx:i,controller:t instanceof v.ArrayController?t:t.array()}),t));case"object":{const a=le({ctx:i,controller:t instanceof v.ObjectController?t:t.object()});return i.isRoot?T(i,t,E(i,a,t)):T(i,t,E(i,l.html.div(l.attr.class("bc-json-schema-object"),a),t))}case"null":return T(i,t,E(i,se({ctx:i,controller:t}),t));default:return console.warn("Unknown type",r.type),T(i,t,E(i,l.html.div(l.attr.class("bc-json-schema-unknown"),"Unknown"),t))}}function xe({schema:e,controller:t,ajv:n,widgetRegistry:r,setStatus:i,formValue:o,validationMode:a,submitting:s}){const u=new A.SchemaContext({schema:e,definition:e,horizontal:!1,isPropertyRequired:!1,path:[],ajv:n,widgetRegistry:r,setStatus:i,formValue:o,validationMode:a,submitting:s});return e===!0?X({ctx:u,controller:t}):e===!1?l.Empty:$({ctx:u,controller:t})}function T(e,t,n){return Ne(e.definition)?st({ctx:e,controller:t,children:n,options:{behavior:"hide",clearOnHide:!1}}):n}function ht(e){return e.prefixItems!=null?{isTuple:!0,prefixItems:e.prefixItems,additionalItemsSchema:Array.isArray(e.items)?!0:e.items??!0,tupleLabels:he(e)}:Array.isArray(e.items)?{isTuple:!0,prefixItems:e.items,additionalItemsSchema:e.additionalItems??!0,tupleLabels:he(e)}:{isTuple:!1,prefixItems:[],additionalItemsSchema:e.items??!0}}function he(e){if(typeof e=="boolean")return;const t=e["x:ui"];return Array.isArray(t?.tupleLabels)?t.tupleLabels:void 0}function ue({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition,o=ht(i),a=l.computedOf(t.signal)(f=>{const b=f?.length??0;return!(i.maxItems!=null&&b>=i.maxItems||o.isTuple&&b>=o.prefixItems.length&&o.additionalItemsSchema===!1)}),s=l.computedOf(t.signal)(f=>{const b=f?.length??0;return i.minItems==null||b>i.minItems}),u=l.computedOf(t.signal)(f=>{if(!i.uniqueItems||!f)return new Set;const b=new Map,S=new Set;for(let d=0;d<f.length;d++){const p=JSON.stringify(f[d]);b.has(p)?(S.add(b.get(p)),S.add(d)):b.set(p,d)}return S}),c=l.computedOf(t.signal)(f=>{if(!i.contains||!f)return{matchingIndices:new Set,count:0,isValid:!0};const b=new Set;let S=0;if(e.ajv)try{const h=e.ajv.compile(i.contains);for(let g=0;g<f.length;g++)h(f[g])&&(b.add(g),S++)}catch{}else{const h=i.contains,g=O=>{if(typeof h=="boolean")return h;if(typeof h!="object"||h==null)return!1;const C=h,N=C.type;if(N==="integer"||N==="number")return!(typeof O!="number"||!Number.isFinite(O)||N==="integer"&&!Number.isInteger(O)||typeof C.minimum=="number"&&O<C.minimum||typeof C.exclusiveMinimum=="number"&&O<=C.exclusiveMinimum||typeof C.maximum=="number"&&O>C.maximum||typeof C.exclusiveMaximum=="number"&&O>=C.exclusiveMaximum||typeof C.multipleOf=="number"&&O%C.multipleOf!==0);if(N==="string"){if(typeof O!="string"||typeof C.minLength=="number"&&O.length<C.minLength||typeof C.maxLength=="number"&&O.length>C.maxLength)return!1;if(typeof C.pattern=="string")try{if(!new RegExp(C.pattern).test(O))return!1}catch{}return!0}return!1};for(let O=0;O<f.length;O++)g(f[O])&&(b.add(O),S++)}const d=i.minContains??(i.contains?1:0),p=i.maxContains,w=S>=d&&(p==null||S<=p);return{matchingIndices:b,count:S,isValid:w,minContains:d,maxContains:p}}),y=i.contains?c.map(f=>{const b=typeof i.contains=="object"&&i.contains.title?i.contains.title:"required pattern";if(!f.isValid){if(f.count<(f.minContains??0))return`Must contain at least ${f.minContains??0} item(s) matching ${b} (currently ${f.count})`;if(f.maxContains!=null&&f.count>f.maxContains)return`Must contain at most ${f.maxContains} item(s) matching ${b} (currently ${f.count})`}return`Contains ${f.count} item(s) matching ${b}`}):null,m=I.ListControl({...L({ctx:e}),createItem:()=>{const f=t.signal.value?.length??0;if(o.isTuple&&f<o.prefixItems.length){const b=o.prefixItems[f];return H(b,()=>{})}else return H(o.additionalItemsSchema,()=>{})},controller:t,showAdd:!0,addDisabled:l.computedOf(a)(f=>!f),showRemove:!0,removeDisabled:l.computedOf(s)(f=>!f),element:f=>{const b=f.item,S=f.position.index;let d,p;o.isTuple&&S<o.prefixItems.length?(d=o.prefixItems[S],o.tupleLabels?.[S]?p=o.tupleLabels[S]:typeof d=="object"&&d.title?p=d.title:p=`Item ${S+1}`):(d=o.additionalItemsSchema,o.isTuple&&(p=`Additional Item ${S-o.prefixItems.length+1}`));const w=$({ctx:e.with({definition:d}).append(S),controller:b}),h=u.map(N=>N.has(S)),g=c.map(N=>N.matchingIndices.has(S));let O=w;p&&o.isTuple&&(O=P.Stack(l.attr.class("bc-stack--gap-1"),P.Label(l.attr.class("bc-array-control__item-label"),p),O));const C=[];return i.uniqueItems&&C.push(l.When(h,()=>P.Label(l.attr.class("bc-array-control__indicator bc-array-control__indicator--error"),"⚠️ Duplicate value"))),i.contains&&C.push(l.When(g,()=>P.Label(l.attr.class("bc-array-control__indicator bc-array-control__indicator--success"),"✓ Matches required pattern"))),C.length>0?P.Stack(l.attr.class("bc-stack--gap-1"),O,...C):O}});return i.contains&&y?P.Stack(l.attr.class("bc-stack--gap-2"),m,l.MapSignal(l.computedOf(c,y)((f,b)=>({info:f,summary:b})),({info:f,summary:b})=>P.Label(l.attr.class(f.isValid?"bc-array-control__summary bc-array-control__summary--success":"bc-array-control__summary bc-array-control__summary--error"),b))):m}function bt(e){return e.map(t=>({key:t,label:ve._t(t),detect:n=>Ke(n,[t])===t,convert:n=>ze(n,t),defaultValue:()=>He(t)}))}function ce({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition;let o=i.type??[];const a=Ge(i),s=o.includes("null"),u=o.filter(d=>d!=="null"&&(d==="string"||d==="number"||d==="integer"||d==="boolean")),c=s&&u.length===o.length-1;c&&(o=u);const y=bt(o),m=new I.UnionController(t.path,t.change,t.signal,t.status,{disabled:t.disabled},y);t.onDispose(()=>m.dispose());const f=d=>Ie({options:o.map(p=>({value:p,label:ve._t(p)})),selected:m.activeBranch,onChange:d,mode:a.selector??"auto"}),b=d=>{m.switchToBranch(d,a.confirmBranchChange)},S=l.MapSignal(m.activeBranch,d=>{const p=l.Value.get(d),w=m.getBranchController(p);if(c&&(p==="number"||p==="integer")){const g=i;return v.Control(I.NullableNumberInput,{...L({ctx:e.with({suppressLabel:!e.isRoot})}),controller:w,min:g.minimum,max:g.maximum,step:p==="integer"?je(g.multipleOf):g.multipleOf})}const h=e.with({definition:{...i,type:p},suppressLabel:!e.isRoot});switch(p){case"string":return Q({ctx:h,controller:w});case"number":return G({ctx:h,controller:w});case"integer":return ee({ctx:h,controller:w});case"boolean":return te({ctx:h,controller:w});case"null":return se({ctx:h,controller:w});case"array":{const g=w.array();return ue({ctx:h,controller:g})}case"object":{const g=w.object();return le({ctx:h,controller:g})}default:return v.Control(I.NullableNumberInput,{...L({ctx:h}),controller:w})}});return ke({ctx:e,showSelector:o.length>1,selector:f(b),inner:S})}function X({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});return r||(e.definition===!0?X({ctx:e.with({definition:{type:["string","number","object","array","boolean","null"]}}),controller:t}):ce({ctx:e.with({definition:{...e.definition,type:["string","number","object","array","boolean","null"]}}),controller:t}))}function vt(e){if(typeof e=="boolean")return[];const t=e["x:ui"];return!t||!Array.isArray(t.crossField)?[]:t.crossField.filter(n=>typeof n=="object"&&n!=null&&typeof n.id=="string"&&Array.isArray(n.fields)&&typeof n.validate=="function")}function St(e,t,n=!1){const r=[],i=[...t].sort((o,a)=>(a.priority||0)-(o.priority||0));for(const o of i)if(!(o.onSubmitOnly&&!n))try{const a={};for(const u of o.fields)a[u]=wt(e,u);const s=o.validate(a,e);if(!s.valid){const u=o.targets||o.fields;if(s.fieldErrors)for(const[c,y]of Object.entries(s.fieldErrors))r.push({instancePath:`/${c}`,schemaPath:`#/x:ui/crossField/${o.id}`,keyword:"crossField",params:{ruleId:o.id,fields:o.fields,context:s.context},message:y});else{const c=s.message||o.message||"Cross-field validation failed";for(const y of u)r.push({instancePath:`/${y}`,schemaPath:`#/x:ui/crossField/${o.id}`,keyword:"crossField",params:{ruleId:o.id,fields:o.fields,context:s.context},message:c})}}}catch(a){console.warn(`Error in cross-field validation rule ${o.id}:`,a);const s=o.targets?.[0]||o.fields[0];r.push({instancePath:`/${s}`,schemaPath:`#/x:ui/crossField/${o.id}`,keyword:"crossField",params:{ruleId:o.id,fields:o.fields},message:"Cross-field validation error"})}return r.length>0?A.ajvErrorsToControllerValidation(r):P.i.valid}function wt(e,t){if(e==null||typeof e!="object")return;const n=t.split(".");let r=e;for(const i of n){if(r==null||typeof r!="object")return;if(Array.isArray(r)){const o=parseInt(i,10);if(!isNaN(o))r=r[o];else return}else r=r[i]}return r}function Ot(e){if(typeof e=="boolean")return;const t=e["x:ui"];if(!t)return;const n={};Array.isArray(t.when)&&(n.when=t.when.filter(i=>typeof i=="object"&&i!=null&&"watch"in i&&"condition"in i)),Array.isArray(t.crossField)&&(n.crossField=t.crossField.filter(i=>typeof i=="object"&&i!=null&&Array.isArray(i.fields)&&typeof i.validate=="function"));const r=vt(e);return r.length>0&&(n.crossFieldRules=r),Array.isArray(t.async)&&(n.async=t.async.filter(i=>typeof i=="object"&&i!=null&&typeof i.validate=="function")),Object.keys(n).length>0?n:void 0}function re(e,t){if(!e.startsWith("$."))throw new Error(`Invalid JSONPath: ${e}. Must start with '$.'.`);const n=e.slice(2).split(/[.[\]]/).filter(Boolean);let r=t;for(const i of n){if(r==null)return;if(typeof r=="object"&&!Array.isArray(r))r=r[i];else if(Array.isArray(r)){const o=parseInt(i,10);if(!isNaN(o))r=r[o];else return}else return}return r}function Ct(e,t){try{if(typeof e.condition=="function"){const r=(Array.isArray(e.watch)?e.watch:[e.watch]).map(i=>re(i,t));return e.condition(r.length===1?r[0]:r,t)}return typeof e.condition=="string"?!!re(e.condition,t):!1}catch(n){return console.warn("Error evaluating conditional validation:",n),!1}}function At(e,t,n,r){const i=[];if(r&&!r(e)&&r.errors&&i.push(...r.errors),n.when){for(const o of n.when)if(Ct(o,t)?o.then:o.else,o.validate)try{const s=o.validate(e,t);s&&i.push({instancePath:"",schemaPath:"#/x:ui/when",keyword:"conditional",params:{},message:s})}catch(s){console.warn("Error in conditional validation:",s)}}if(n.crossField)for(const o of n.crossField)try{const a={};for(const u of o.fields)a[u]=re(`$.${u}`,t);const s=o.validate(a,t);if(s){const u=o.target||o.fields[0];i.push({instancePath:`/${u}`,schemaPath:"#/x:ui/crossField",keyword:"crossField",params:{fields:o.fields},message:o.message||s})}}catch(a){console.warn("Error in cross-field validation:",a)}if(n.crossFieldRules&&n.crossFieldRules.length>0){const o=St(t,n.crossFieldRules);if(o.type==="invalid"){const a=jt(o);i.push(...a)}}return i.length>0?A.ajvErrorsToControllerValidation(i):P.i.valid}function jt(e){if(e.type==="valid")return[];const t=[];function n(r,i=""){if(r.message&&t.push({instancePath:i,schemaPath:"#/crossField",keyword:"crossField",params:{},message:r.message}),r.dependencies)for(const[o,a]of Object.entries(r.dependencies)){const s=i?`${i}/${o}`:`/${o}`;n(a,s)}}return n(e.error),t}function It(e,t){const n=new Set;if(e.when)for(const r of e.when)(Array.isArray(r.watch)?r.watch:[r.watch]).forEach(o=>n.add(o));if(e.crossField)for(const r of e.crossField)r.fields.forEach(i=>n.add(i));return{watchedPaths:Array.from(n),shouldRevalidate:r=>Array.from(n).some(i=>r.startsWith(i)||i.startsWith(r))}}function kt(e){if(typeof e=="boolean")return[];const t=e["x:ui"];return!t||!Array.isArray(t.async)?[]:t.async.filter(n=>typeof n=="object"&&n!=null&&typeof n.id=="string"&&typeof n.field=="string"&&typeof n.validate=="function")}class Nt{timeouts=new Map;validationStates=new Map;abortControllers=new Map;getValidationState(t){return this.validationStates.has(t)||this.validationStates.set(t,l.prop({isValidating:!1,result:P.i.valid,lastValidatedValue:void 0,lastValidatedAt:0})),this.validationStates.get(t)}async validateField(t,n,r,i=!1){const o=`${t.field}_${t.id}`,a=this.getValidationState(o),s=this.timeouts.get(o);s!==void 0&&clearTimeout(s);const u=this.abortControllers.get(o);if(u&&u.abort(),!i&&a.value.lastValidatedValue===n)return;if(t.minLength&&typeof n=="string"&&n.length<t.minLength){a.set({...a.value,result:P.i.valid,isValidating:!1});return}const c=setTimeout(async()=>{const y=new AbortController;this.abortControllers.set(o,y),a.set({...a.value,isValidating:!0,result:t.loadingMessage?P.i.invalid({message:t.loadingMessage}):a.value.result});try{const m=await t.validate(n,r);if(y.signal.aborted)return;const f=m.valid?P.i.valid:P.i.invalid({message:m.message||"Async validation failed",context:m.context});a.set({isValidating:!1,result:f,lastValidatedValue:n,lastValidatedAt:Date.now()})}catch(m){if(y.signal.aborted)return;const f=m instanceof Error?m.message:"Async validation error";a.set({isValidating:!1,result:P.i.invalid({message:f}),lastValidatedValue:n,lastValidatedAt:Date.now()})}finally{this.abortControllers.delete(o),this.timeouts.delete(o)}},i?0:t.debounce||300);this.timeouts.set(o,c)}cancelAll(){for(const t of this.timeouts.values())clearTimeout(t);this.timeouts.clear();for(const t of this.abortControllers.values())t.abort();this.abortControllers.clear()}getAllValidationResults(){const t={};for(const[n,r]of this.validationStates.entries()){const i=r.value;!i.isValidating&&i.result.type==="invalid"&&(t[n]=i.result)}return t}isValidating(){for(const t of this.validationStates.values())if(t.value.isValidating)return!0;return!1}dispose(){this.cancelAll();for(const t of this.validationStates.values())t.dispose();this.validationStates.clear()}}function J(e){if(typeof e!="boolean")return Pt(e)}function Pt(e){if(e.default!==void 0)return e.default;if(Array.isArray(e.examples)&&e.examples.length>0)return e.examples[0];if(e.const!==void 0)return e.const;if(Array.isArray(e.enum)&&e.enum.length>0)return e.enum[0];if(Mt(e))return null;if(e.allOf&&Array.isArray(e.allOf))return Vt(e.allOf);const t=e.oneOf??e.anyOf;if(t&&Array.isArray(t))for(const n of t){const r=J(n);if(r!==void 0)return r}return Et(e)}function Vt(e){const t={};let n=!1;for(const r of e){const i=J(r);i!==void 0&&typeof i=="object"&&i!==null&&(Object.assign(t,i),n=!0)}return n?t:void 0}function Et(e){switch(Ut(e)){case"object":return Tt(e);case"array":return Ft(e);case"string":return Wt(e);case"number":case"integer":return Rt(e);case"boolean":return!1;case"null":return null;default:return}}function Tt(e){if(!e.properties)return{};const t=new Set(e.required??[]),n={};let r=!1;for(const[i,o]of Object.entries(e.properties)){if(!t.has(i)||typeof o=="boolean")continue;const a=J(o);a!==void 0&&(n[i]=a,r=!0)}return r?n:{}}function Ft(e){const t=e.minItems??0;if(t===0)return[];const n=e.items;if(!n||typeof n=="boolean")return Array(t).fill(null);if(Array.isArray(n))return n.slice(0,t).map(i=>J(i)??null);const r=J(n);return Array(t).fill(r??null)}function Wt(e){switch(e.format){case"date":return Lt();case"date-time":return $t();case"time":return"00:00:00";default:return""}}function Rt(e){const t=e.type==="integer";let n=e.minimum,r=e.maximum;if(e.exclusiveMinimum!==void 0){const a=typeof e.exclusiveMinimum=="number"?e.exclusiveMinimum:e.exclusiveMinimum?n??0:void 0;a!==void 0&&(n=t?a+1:a+be(e))}if(e.exclusiveMaximum!==void 0){const a=typeof e.exclusiveMaximum=="number"?e.exclusiveMaximum:e.exclusiveMaximum?r??0:void 0;a!==void 0&&(r=t?a-1:a-be(e))}let i;n!==void 0&&r!==void 0?i=(n+r)/2:n!==void 0?i=n:r!==void 0?i=0<=r?0:r:i=0;const o=e.multipleOf;return o!==void 0&&o>0&&(i=Math.round(i/o)*o,n!==void 0&&i<n&&(i=Math.ceil(n/o)*o),r!==void 0&&i>r&&(i=Math.floor(r/o)*o)),t&&(i=Math.round(i)),i}function be(e){return e.multipleOf!==void 0?e.multipleOf:.001}function Mt(e){return Array.isArray(e.type)?e.type.includes("null"):!1}function Ut(e){if(typeof e.type=="string")return e.type;if(Array.isArray(e.type))return e.type.find(t=>t!=="null");if(e.properties!==void 0)return"object";if(e.items!==void 0)return"array"}function Lt(){return new Date().toISOString().split("T")[0]}function $t(){return new Date().toISOString()}function Bt(e){const t=globalThis.structuredClone;return typeof t=="function"?t(e):JSON.parse(JSON.stringify(e))}function xt(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function Dt(e){const t=new j.WidgetRegistry;for(let n=0;n<e.length;n++){const r=e[n],i=r.displayName??`custom-widget-${n}`;t.register(i,{factory:r.factory,displayName:r.displayName??`Custom Widget ${n+1}`,description:r.description,supportedTypes:r.supportedTypes,priority:r.priority??50,canFallback:!0,matcher:r.matcher})}return t}function Jt({schema:e,initialValue:t,externalSchemas:n,refResolver:r,sanitizeAdditional:i,validationMode:o,validateDebounceMs:a,customWidgets:s,applySchemaDefaults:u=!0,submitting:c},y){const m=t!==void 0?l.Value.get(t):void 0,f=J(e);let b;return t===void 0?b=f??{}:u?b=I.deepMergeDefaults(f,m):b=m,l.Async(A.getAjvForSchema(e,{externalSchemas:n,refResolver:r,sanitizeAdditional:i}),S=>{if(S.ok){const{ajv:d,validate:p}=S.value,w=Ot(e),h=kt(e),g=h.length>0?new Nt:null,O=o??"onTouched",C=M=>{const U=p(M);let z;return U?z=P.i.valid:z=A.ajvErrorsToControllerValidation(p.errors??[]),w?At(M,M,w,p):z},{controller:N,setStatus:_}=v.useController({initialValue:b,validationMode:O,validateDebounceMs:a,validate:O==="onSubmit"?void 0:C}),k=w?It(w):null,R=i!==!1;let V=!1;const x=R?N.signal.on(M=>{if(V)return;const U=Bt(M);p(U)&&!xt(U,M)&&(V=!0,N.change(U),V=!1)}):()=>{},B=k?N.signal.on((M,U)=>{U!=null&&JSON.stringify(M)!==JSON.stringify(U)&&setTimeout(()=>{const qe=N.status.value;_(qe)},10)}):()=>{},K=g&&h.length>0?N.signal.on(M=>{for(const U of h)g.validateField(U,M,M)}):()=>{},Y=()=>{x(),B(),K(),g?.dispose(),N.dispose()},De=s?Dt(s):void 0,Je=l.Fragment(l.OnDispose(Y),xe({schema:e,controller:N,ajv:d,widgetRegistry:De,setStatus:_,formValue:N.signal,validationMode:O,submitting:c}));return y({Form:Je,controller:N,setStatus:_})}return l.html.div(l.attr.class("bc-json-schema-form__error"),S.error)})}function qt(e,t){const r=(t?.ajv??new A.Ajv({allErrors:!0})).compile(e);return{"~standard":{version:1,vendor:"ajv",validate:i=>r(i)?{value:i}:{issues:_t(r.errors??[])},types:void 0}}}function _t(e){return e.map(t=>({message:Kt(t),path:zt(t)}))}function Kt(e){return e.message??`${e.keyword} validation failed`}function zt(e){const t=Ht(e.instancePath||"");if(e.keyword==="required"){const n=e.params.missingProperty;if(n!=null)return[...t,n]}if(e.keyword==="additionalProperties"){const n=e.params.additionalProperty;if(n!=null)return[...t,n]}if(e.keyword==="unevaluatedProperties"){const n=e.params.unevaluatedProperty;if(n!=null)return[...t,n]}return t.length>0?t:void 0}function Ht(e){return e?e.split("/").slice(1).map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~")).map(n=>Gt(n)?Number(n):n):[]}function Gt(e){return/^\d+$/.test(e)}exports.createDiagnosticWidget=j.createDiagnosticWidget;exports.forFormat=j.forFormat;exports.forTypeAndFormat=j.forTypeAndFormat;exports.forXUI=j.forXUI;exports.SchemaContext=A.SchemaContext;exports.ajvErrorsToControllerValidation=A.ajvErrorsToControllerValidation;exports.ajvErrorsToDependencies=A.ajvErrorsToDependencies;exports.buildMessage=A.buildMessage;exports.buildPath=A.buildPath;exports.clearCaches=A.clearCaches;exports.clearCachesForAjv=A.clearCachesForAjv;exports.compileWithCache=A.compileWithCache;exports.getAjvForSchema=A.getAjvForSchema;exports.getCacheStats=A.getCacheStats;exports.jsonPointerToSegments=A.jsonPointerToSegments;exports.mergeAllOf=A.mergeAllOf;exports.JSONSchemaAllOf=gt;exports.JSONSchemaAny=X;exports.JSONSchemaAnyOf=Le;exports.JSONSchemaArray=ue;exports.JSONSchemaBoolean=te;exports.JSONSchemaConst=Ee;exports.JSONSchemaControl=xe;exports.JSONSchemaEnum=Ve;exports.JSONSchemaForm=Jt;exports.JSONSchemaGenericControl=$;exports.JSONSchemaInteger=ee;exports.JSONSchemaNull=se;exports.JSONSchemaNumber=G;exports.JSONSchemaObject=le;exports.JSONSchemaOneOf=$e;exports.JSONSchemaString=Q;exports.JSONSchemaUnion=ce;exports.composeEffectiveObjectSchema=Ae;exports.createAJVStandardSchema=qt;exports.evaluateIfThenElseOverlay=ie;exports.evaluateNotViolation=Ce;exports.extractSchemaDefaults=J;exports.getEvaluatedProperties=D;exports.hasConditionalFeatures=Oe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("../widget-customization-BASfRpF7.cjs"),A=require("../oneof-branch-detection-Vov_e3kI.cjs"),l=require("@tempots/dom"),ve=require("../string-B9vVyfq3.cjs"),I=require("../deep-merge-CvN7Xvd1.cjs"),P=require("../stack-DcZ_u50f.cjs"),v=require("../use-form-B_mCauP0.cjs"),F=require("../utils-DIUEhA-Z.cjs"),_e=require("../text-input-w0eVcqk5.cjs"),Z=require("../notice-DMK7dx9a.cjs"),q=require("../translations-gVgMyNno.cjs"),Se=require("../colors-BI0YhONJ.cjs"),we=require("../input-container-B31Seozh.cjs");function Oe(e){if(!e||typeof e!="object")return!1;const t=e;return!!(e.if||t.dependentRequired||t.dependentSchemas||e.dependencies)}function Ce(e,t,n,r=[]){if(!n)return null;try{if(A.compileWithCache(n,e)(t)){const a=e.title||"disallowed schema";return{path:r,message:`Value matches ${a}`,notSchema:e}}return null}catch{return null}}function Ae(e,t,n,r=[]){const i=[],o=[],a=ie(e,t,n);a&&i.push(a);const s=Array.isArray(e.required)?[...e.required]:[];if(typeof t=="object"&&t!=null&&!Array.isArray(t)){const m=t,f=e.dependentRequired;if(f){for(const[d,p]of Object.entries(f))if(Object.prototype.hasOwnProperty.call(m,d))for(const w of p)s.push(w)}const b=e.dependencies;if(b){for(const[d,p]of Object.entries(b))if(Object.prototype.hasOwnProperty.call(m,d))if(Array.isArray(p))for(const w of p)s.push(w);else typeof p=="object"&&p&&i.push(p)}const S=e.dependentSchemas;if(S)for(const[d,p]of Object.entries(S))Object.prototype.hasOwnProperty.call(m,d)&&i.push(p)}const u=[e,...i],{mergedSchema:c,conflicts:y}=A.mergeAllOf(u,r);if(s.length>0){const m=new Set([...c.required??[],...s]);c.required=[...m]}return o.push(...y),{effective:c,conflicts:o}}function ie(e,t,n){if(!n||!e.if||typeof e.if!="object")return null;try{if(A.compileWithCache(n,e.if)(t)){const o=e.then;if(o&&typeof o=="object")return o}else{const o=e.else;if(o&&typeof o=="object")return o}}catch{}return null}function D(e,t,n){const r=new Set;if(!t||typeof t!="object")return r;if(e.properties&&Object.keys(e.properties).forEach(a=>{a in t&&r.add(a)}),e.patternProperties&&Object.keys(t).forEach(a=>{Object.keys(e.patternProperties).forEach(s=>{try{new RegExp(s).test(a)&&r.add(a)}catch{}})}),e.additionalProperties===!0||e.additionalProperties&&typeof e.additionalProperties=="object"){const a=new Set;e.properties&&Object.keys(e.properties).forEach(s=>{s in t&&a.add(s)}),e.patternProperties&&Object.keys(t).forEach(s=>{Object.keys(e.patternProperties).forEach(u=>{try{new RegExp(u).test(s)&&a.add(s)}catch{}})}),Object.keys(t).forEach(s=>{a.has(s)||r.add(s)})}e.allOf&&e.allOf.forEach(a=>{typeof a=="object"&&D(a,t,n).forEach(u=>r.add(u))});const i=ie(e,t,n);i&&D(i,t,n).forEach(s=>r.add(s));const o=e.dependentSchemas;return o&&Object.keys(o).forEach(a=>{if(a in t){const s=o[a];typeof s=="object"&&D(s,t,n).forEach(c=>r.add(c))}}),e.dependencies&&Object.keys(e.dependencies).forEach(a=>{if(a in t){const s=e.dependencies[a];typeof s=="object"&&!Array.isArray(s)&&D(s,t,n).forEach(c=>r.add(c))}}),r}function L({ctx:e}){const{examples:t,default:n}=e;let{description:r}=e;r==null&&t!=null&&n!=null&&(Array.isArray(t)?r=`example: ${t[0]}`:r=`example: ${t}`);const i=[];if(e.isDeprecated&&i.push("deprecated"),e.isReadOnly&&!e.shouldIgnoreReadOnly&&i.push("read-only"),e.isWriteOnly&&!e.shouldShowWriteOnly&&i.push("write-only"),i.length>0){const o=`(${i.join(", ")})`;r=r?`${r} ${o}`:o}return{label:e.suppressLabel?void 0:e.widgetLabel,description:r,required:e.isPropertyRequired,layout:e.horizontal?"horizontal":"vertical"}}function H(e,t){if(e.default!=null)return t(e.default);if(Array.isArray(e.examples))return t(e.examples[0]);if(e.examples!=null)return t(e.examples)}function je(e){return e==null?1:Math.round(e)}function oe(e){return e.isWriteOnly&&!e.shouldShowWriteOnly}function ae(e){return e.isReadOnly&&!e.shouldIgnoreReadOnly||e.isDeprecated}function W({ctx:e,controller:t,resolved:n}){const r=n?.widget,i={controller:t,ctx:e,options:n?.options,setStatus:e.setStatus,formValue:e.formValue,validationMode:e.validationMode,submitting:e.submitting};if(r!=null&&e.widgetRegistry){const a=e.widgetRegistry.get(r);if(a)return a.factory(i)}if(r!=null){const a=j.globalWidgetRegistry.get(r);if(a)return a.factory(i)}if(e.widgetRegistry){const a=e.widgetRegistry.findBestWidget(e);if(a)return a.registration.factory(i)}const o=j.globalWidgetRegistry.findBestWidget(e);return o?o.registration.factory(i):null}function Ie(e){const{options:t,selected:n,onChange:r,mode:i="auto",size:o="sm",keyFor:a=y=>String(y),parseKey:s=y=>y}=e,u=t.length;if((i==="auto"?u<=3?"segmented":"select":i)==="segmented"){const y=Object.fromEntries(t.map(m=>[a(m.value),m.label]));return I.SegmentedInput({options:y,value:l.Value.map(n,m=>a(m)),onChange:m=>r(s(m)),size:o})}return I.NativeSelect({options:t.map(y=>({type:"value",value:y.value,label:y.label})),value:n,onChange:r})}function ke({ctx:e,showSelector:t,selector:n,inner:r}){return e.isRoot?t?P.Stack(l.attr.class("bc-stack--gap-2"),n,r):r:v.InputWrapper({...L({ctx:e}),content:t?P.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),n,r):r})}function Ke(e,t){if(e===null)return t.includes("null")?"null":null;switch(typeof e){case"string":return t.includes("string")?"string":null;case"number":return Number.isInteger(e)&&t.includes("integer")?"integer":t.includes("number")?"number":null;case"boolean":return t.includes("boolean")?"boolean":null;case"object":return Array.isArray(e)?t.includes("array")?"array":null:t.includes("object")?"object":null;default:return null}}function ze(e,t){try{switch(t){case"string":return e==null?{ok:!0,value:void 0}:{ok:!0,value:String(e)};case"number":{if(typeof e=="number")return{ok:!0,value:e};if(typeof e=="string"){const n=Number(e);return Number.isFinite(n)?{ok:!0,value:n}:{ok:!1}}return typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1}}case"integer":return typeof e=="number"&&Number.isInteger(e)?{ok:!0,value:e}:typeof e=="string"?/^[-+]?\d+$/.test(e.trim())?{ok:!0,value:parseInt(e,10)}:{ok:!1}:typeof e=="boolean"?{ok:!0,value:e?1:0}:{ok:!1};case"boolean":{if(typeof e=="boolean")return{ok:!0,value:e};if(typeof e=="string"){const n=e.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"?{ok:!0,value:!0}:n==="false"||n==="0"||n==="no"?{ok:!0,value:!1}:{ok:!1}}return typeof e=="number"?{ok:!0,value:e!==0}:{ok:!1}}case"array":return Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"object":return e!=null&&typeof e=="object"&&!Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"null":return{ok:!0,value:null}}}catch{return{ok:!1}}}function He(e){switch(e){case"null":return null;case"array":return[];case"object":return{};default:return}}function Ge(e){if(typeof e=="boolean")return{};const t=e["x:ui"];if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const n=t;return{unionDefault:typeof n.unionDefault=="string"?n.unionDefault:void 0,confirmBranchChange:!!n.confirmBranchChange,selector:n.selector==="segmented"||n.selector==="select"?n.selector:void 0}}return{}}function Xe(e){const{definition:t}=e;if(typeof t=="boolean")return;const n={pattern:t.pattern,minLength:t.minLength,maxLength:t.maxLength},r=F.resolveWidget(t,e.name),i=r?.widget;if(i!=null)switch(i){case"binary":return{...n,format:"binary",...r?.options};case"date":return{...n,format:"date"};case"date-time":return{...n,format:"date-time"};case"email":return{...n,format:"email"};case"markdown":return{...n,format:"markdown"};case"password":return{...n,format:"password"};case"textarea":return{...n,format:"textarea"};case"time":return{...n,format:"time"};case"uuid":return{format:"uuid"};case"url":return{...n,format:"url"};case"uri":return{...n,format:"uri"};case"uri-reference":return{...n,format:"uri-reference"};case"hostname":return{...n,format:"hostname"};case"ipv4":return{...n,format:"ipv4"};case"ipv6":return{...n,format:"ipv6"};case"regex":return{...n,format:"regex"};case"duration":return{...n,format:"duration"};case"color":return{...n,format:"color"}}}const Ye=e=>{const{value:t,onBlur:n,onChange:r,onInput:i,after:o,disabled:a,...s}=e,u=I.NullableResetAfter(t,a,r??i);return j.Base64Input({...s,value:l.Value.map(t,c=>c??void 0),onChange:r!=null?c=>r(c??null):void 0,onInput:i!=null?c=>i(c??null):void 0,onBlur:n,after:o!=null?l.Fragment(u,o):u})};function fe({ctx:e,options:t,controller:n}){const r=Xe(e),i=!e.isNullable,o=()=>i?I.transformNullToUndefined(n):n;switch(r?.format){case"email":return v.Control(j.NullableEmailInput,{...t,controller:o()});case"date":return v.MappedControl(j.NullableDateInput,{...t,controller:o(),toInput:a=>a==null?null:new Date(a),fromInput:a=>a?.toISOString().split("T")[0]??null});case"date-time":return v.MappedControl(j.NullableDateTimeInput,{...t,controller:o(),toInput:a=>a==null?null:new Date(a),fromInput:a=>a?.toISOString()??null});case"time":return v.Control(j.NullableTextInput,{...t,controller:o(),placeholder:"HH:MM:SS"});case"password":return v.Control(j.NullablePasswordInput,{...t,controller:o()});case"binary":{const{definition:a}=e,s=typeof a=="object"?a["x:ui"]:void 0;return r.mediaType&&(r.mediaType.startsWith("image/")||r.mediaType.startsWith("video/")||r.mediaType.startsWith("audio/")||r.mediaType==="application/pdf"||s?.preferFileUpload===!0)?v.Control(Ye,{...t,controller:o(),mode:"input",accept:r.mediaType||"*/*",maxFileSize:(typeof s?.maxBytes=="number"?s.maxBytes:void 0)||(typeof s?.maxFileSize=="number"?s.maxFileSize:void 0),showFileList:!0}):v.Control(j.NullableTextArea,{...t,controller:o(),placeholder:"Paste base64-encoded data",rows:3})}case"uri":case"url":return v.Control(j.NullableUrlInput,{...t,controller:o(),placeholder:"https://example.com"});case"uri-reference":return v.Control(j.NullableTextInput,{...t,controller:o(),placeholder:"Enter URL..."});case"hostname":return v.Control(j.NullableTextInput,{...t,controller:o(),placeholder:"example.com"});case"ipv4":return v.Control(j.NullableTextInput,{...t,controller:o(),placeholder:"192.168.1.1"});case"ipv6":return v.Control(j.NullableTextInput,{...t,controller:o(),placeholder:"2001:db8::1"});case"regex":return v.Control(j.NullableTextArea,{...t,controller:o(),placeholder:"^[a-zA-Z0-9]+$",rows:3});case"duration":return I.WithTemporal(({Duration:a})=>v.MappedControl(I.NullableDurationInput,{...t,controller:o(),toInput:s=>s==null?null:a.from(s),fromInput:s=>s?.toString?.()??null}));case"color":return v.Control(j.ColorSwatchInput,{...t,controller:n,displayValue:!0});case"uuid":return v.Control(j.NullableUUIDInput,{...t,controller:o()});case"textarea":return v.Control(j.NullableTextArea,{...t,controller:o()});default:return v.Control(j.NullableTextInput,{...t,controller:o()})}}function Q({ctx:e,controller:t}){if(oe(e))return l.Empty;const n=F.resolveWidget(e.definition,e.name),r=n?.widget,i=W({ctx:e,controller:t,resolved:n});if(i)return i;const o={...L({ctx:e}),placeholder:H(e.definition,String),disabled:ae(e)};if((e.isNullable||e.isOptional)&&!e.shouldShowPresenceToggle)return fe({ctx:e,options:o,controller:t});if(r!=null&&["url","uri","uri-reference","hostname","ipv4","ipv6","regex","duration","binary","markdown","time","color"].includes(r))return fe({ctx:e,options:o,controller:t});switch(r){case"email":return v.Control(Z.EmailInput,{...o,controller:I.transformEmptyStringToUndefined(t)});case"password":return v.Control(Z.PasswordInput,{...o,controller:I.transformEmptyStringToUndefined(t)});case"uuid":return v.Control(I.UUIDInput,{...o,controller:I.transformEmptyStringToUndefined(t)});case"textarea":return v.Control(I.TextArea,{...o,controller:I.transformEmptyStringToUndefined(t)});default:return v.Control(_e.TextInput,{...o,controller:I.transformEmptyStringToUndefined(t)})}}function Ze(e){const t=F.resolveWidget(e.definition,e.name);if(t?.widget==="slider")return{widget:"slider",options:t.options};if(t?.widget==="rating")return{widget:"rating",options:t.options};const n=e.definition,r=typeof n=="object"?n["x:ui"]:void 0;return r?.displayFormat==="currency"?{widget:"currency",options:{currency:typeof r?.currency=="string"?r.currency:"USD"}}:r?.displayFormat==="percent"?{widget:"percent"}:{widget:"number"}}function G({ctx:e,controller:t}){if(oe(e))return l.Empty;const n=e.definition,r=Ze(e),i=F.resolveWidget(e.definition,e.name),o=W({ctx:e,controller:t,resolved:i});if(o)return o;const a={...L({ctx:e}),placeholder:H(e.definition,String),min:n.minimum,max:n.maximum,step:n.multipleOf,disabled:ae(e)},s=(e.isNullable||e.isOptional)&&!e.shouldShowPresenceToggle,u=s&&!e.isNullable;switch(r.widget){case"rating":const c=(typeof r.options?.max=="number"?r.options.max:n.maximum)||5;return s?v.Control(j.NullableRatingInput,{...a,max:c,controller:u?I.transformNullToUndefined(t):t}):v.Control(j.RatingInput,{...a,max:c,controller:t});case"slider":return s?v.Control(j.NullableSliderInput,{...a,controller:u?I.transformNullToUndefined(t):t}):v.Control(j.SliderInput,{...a,controller:t});case"currency":const y=typeof r.options?.currency=="string"?r.options.currency:"USD";return s?v.Control(I.MaskInput,{...a,mask:de(y),controller:t}):v.Control(I.MaskInput,{...a,mask:de(y),controller:t});case"percent":return s?v.Control(I.MaskInput,{...a,mask:pe(),controller:t}):v.Control(I.MaskInput,{...a,mask:pe(),controller:t});default:return s?v.Control(I.NullableNumberInput,{...a,controller:u?I.transformNullToUndefined(t):t}):v.Control(I.NumberInput,{...a,controller:t})}}function de(e){return`${Qe(e)} 000,000.00`}function pe(){return"000.00%"}function Qe(e){return{USD:"$",EUR:"€",GBP:"£",JPY:"¥",CAD:"C$",AUD:"A$"}[e.toUpperCase()]||e}function ee({ctx:e,controller:t}){return G({ctx:e.with({definition:{...e.definition,multipleOf:je(e.definition.multipleOf)}}),controller:t})}function te({ctx:e,controller:t}){if(oe(e))return l.Empty;const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i={...L({ctx:e}),disabled:ae(e)},o=v.Control(v.CheckboxInput,{...i,controller:t});if(!e.isNullable&&(!e.isOptional||e.shouldShowPresenceToggle))return o;const a=!e.isNullable;return v.Control(v.CheckboxInput,{...i,controller:t,after:I.NullableResetAfter(t.signal,t.disabled,()=>t.change(a?void 0:null))})}function se({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});return r||l.WithElement(()=>{t.change(null)})}function et({conflicts:e}){return e.length===0?l.Empty:l.Use(q.BeatUII18n,t=>Z.Notice({variant:"warning",tone:"prominent",title:t.value.schemaConflictsDetected,class:"bc-schema-conflicts-banner"},l.html.ul(l.attr.style("margin: 0; padding-left: 1.25rem; list-style-type: disc;"),...e.map(n=>l.html.li(l.attr.style("margin-bottom: 0.25rem;"),n.message,n.path.length>0?l.html.code(l.attr.style("margin-left: 0.5rem; font-size: 0.75rem; opacity: 0.7;"),` (${n.path.join(".")})`):null)))))}function tt({violations:e}){return e.length===0?l.Empty:l.Use(q.BeatUII18n,t=>Z.Notice({variant:"danger",tone:"prominent",title:t.value.schemaViolationsDetected,class:"bc-not-violations-banner"},l.html.ul(l.attr.style("margin: 0; padding-left: 1.25rem; list-style-type: disc;"),...e.map(n=>l.html.li(l.attr.style("margin-bottom: 0.25rem;"),n.message,n.path.length>0?l.html.code(l.attr.style("margin-left: 0.5rem; font-size: 0.75rem; opacity: 0.7;"),` (${n.path.join(".")})`):null)))))}function nt({ctx:e,controller:t,content:n}){const r=l.Value.map(t.signal,a=>a!==void 0),i=e.widgetLabel??"Property",o=a=>{if(a){const s=e.default;if(s!==void 0)t.change(s);else{const u=e.definition;u.type==="string"?t.change(""):u.type==="number"||u.type==="integer"?t.change(0):u.type==="boolean"?t.change(!1):u.type==="array"?t.change([]):u.type==="object"?t.change({}):t.change(null)}}else t.change(void 0)};return P.Stack(l.html.div(l.attr.class("bc-presence-toggle"),v.InputWrapper({layout:"horizontal",label:`Include ${i}`,content:j.Switch({value:r,onChange:o,size:"xs"})})),l.When(r,()=>n))}function E(e,t,n){const r=e.schemaConflicts.length>0,i=e.notViolations.length>0,o=e.shouldShowPresenceToggle&&n!=null;let a=t;return o&&n!=null&&(a=nt({ctx:e,controller:n,content:t})),!r&&!i?a:P.Stack(l.attr.class("bc-stack--gap-2"),i?tt({violations:e.notViolations}):null,r?et({conflicts:e.schemaConflicts}):null,a)}function Ne(e){if(typeof e=="boolean")return;const t=e["x:ui"];if(!t||!t.visibleIf)return;const n=t.visibleIf;if(typeof n=="string"||typeof n=="object"&&n!==null)return n}function rt(e){if(e.startsWith("!"))return{field:e.slice(1),operator:"falsy"};if(e.includes("!=")){const[t,n]=e.split("!=",2);return{field:t.trim(),operator:"notEquals",value:me(n.trim())}}if(e.includes("=")){const[t,n]=e.split("=",2);return{field:t.trim(),operator:"equals",value:me(n.trim())}}return{field:e.trim(),operator:"truthy"}}function me(e){if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);if(e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e!=="undefined")return/^-?\d+(\.\d+)?$/.test(e)?parseFloat(e):e}function it(e,t){if(e==null||typeof e!="object")return;const n=t.split(".");let r=e;for(const i of n){if(r==null||typeof r!="object")return;if(Array.isArray(r)){const o=parseInt(i,10);if(!isNaN(o))r=r[o];else return}else r=r[i]}return r}function ne(e,t){const n=it(t,e.field);switch(e.operator){case"equals":return n===e.value;case"notEquals":return n!==e.value;case"truthy":return!!n;case"falsy":return!n;case"contains":return typeof n=="string"&&typeof e.value=="string"||Array.isArray(n)?n.includes(e.value):!1;case"notContains":return typeof n=="string"&&typeof e.value=="string"||Array.isArray(n)?!n.includes(e.value):!0;case"greaterThan":return typeof n=="number"&&typeof e.value=="number"&&n>e.value;case"lessThan":return typeof n=="number"&&typeof e.value=="number"&&n<e.value;case"greaterThanOrEqual":return typeof n=="number"&&typeof e.value=="number"&&n>=e.value;case"lessThanOrEqual":return typeof n=="number"&&typeof e.value=="number"&&n<=e.value;case"in":return Array.isArray(e.values)&&e.values.includes(n);case"notIn":return!Array.isArray(e.values)||!e.values.includes(n);default:return!1}}function Pe(e,t){const n=e.conditions.map(r=>"operator"in r&&["and","or","not"].includes(r.operator)?Pe(r,t):ne(r,t));switch(e.operator){case"and":return n.every(Boolean);case"or":return n.some(Boolean);case"not":return!n[0];default:return!1}}function ot(e,t){try{if(typeof e=="string"){const n=rt(e);return ne(n,t)}return"operator"in e&&["and","or","not"].includes(e.operator)?Pe(e,t):ne(e,t)}catch(n){return console.warn("Error evaluating visibility condition:",n),!0}}function at(e,t){return l.computedOf(t)(n=>ot(e,n))}const ye={behavior:"hide",clearOnHide:!1};function st({ctx:e,controller:t,children:n,options:r=ye}){const i=Ne(e.definition);if(!i)return n;const o={...ye,...r},a=lt(t),s=at(i,a);switch(o.clearOnHide&&s.on(u=>{!u&&t.signal.value!==void 0&&t.change(void 0)}),o.behavior){case"unmount":return l.When(s,()=>n);case"hide":default:return n}}function lt(e){return e.signal}function Ve({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const o=e.definition.enum??[],a=(e.isNullable||e.isOptional)&&!o.includes(null),s=!e.isNullable;return l.Use(q.BeatUII18n,u=>{const c=o.map(m=>({type:"value",value:m,label:String(m)}));a&&c.unshift({type:"value",value:null,label:l.Value.get(u.$.selectNone)});const y=a&&s?I.transformNullToUndefined(t):t;return I.NativeSelectControl({...L({ctx:e}),options:c,controller:y,equality:(m,f)=>m==null&&f==null?!0:m===f})})}function Ee({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition;return l.Fragment(l.WithElement(()=>{l.Value.get(t.signal)!==i.const&&t.change(i.const)}),I.Group(P.MutedLabel(e.widgetLabel,": "),P.Label(String(i.const))))}function Te(e,t,n){const{controller:r,effCtx:i,patternProps:o,apSchema:a,canRemove:s,lockKeyAfterSet:u,validatePropertyName:c}=n,y=r.field(e),m=l.prop(e),f=l.prop(null);let b=a;if(t){const w=Object.keys(o).find(h=>{try{return new RegExp(h).test(e)}catch{return!1}});if(w){const h=o[w];h!==!1&&typeof h=="object"&&(b=h)}}const S=w=>{const h=(w??"").trim();if(!h||h===e||Object.prototype.hasOwnProperty.call(l.Value.get(r.signal)??{},h))return;const g=c(h);if(!g.ok){f.set(g.message);return}f.set(null);const O={...l.Value.get(r.signal)??{}},C=O[e];delete O[e],O[h]=C,r.change(O)},d=l.Use(q.BeatUII18n,w=>v.CloseButton({size:"xs",label:w.$.removeItem,disabled:!s(Object.keys(l.Value.get(r.signal)??{}).length),onClick:()=>{const h=Object.keys(l.Value.get(r.signal)??{}).length;if(!s(h))return;const g={...l.Value.get(r.signal)??{}};delete g[e],r.change(g)}})),p=l.Value.map(y.signal,w=>u&&w!=null);return l.html.div(l.attr.class("bc-object-helpers__row"),l.style.gridTemplateColumns("2fr 3fr min-content"),v.InputWrapper({content:j.EditableText({value:m,onChange:S,disabled:l.computedOf(r.disabled,p)((w,h)=>w||h)}),error:l.Ensure(f,w=>l.html.div(l.attr.class("bc-object-helpers__error"),w)),description:Object.keys(o).length>0?l.html.div(l.attr.class("bc-object-helpers__description"),"Allowed patterns: ",Object.keys(o).join(", ")):null}),l.html.div($({ctx:i.with({definition:b,suppressLabel:!0}).append(e),controller:y})),l.html.div(l.attr.class("bc-object-helpers__remove"),d))}function Fe(e,t,n){const{controller:r,effCtx:i,patternProps:o,apSchema:a,unevaluatedProps:s,canRemove:u,lockKeyAfterSet:c,validatePropertyName:y}=n,m=r.field(e),f=l.prop(e),b=l.prop(null);let S;if(s&&typeof s=="object")S=s;else if(t){const h=Object.keys(o).find(g=>{try{return new RegExp(g).test(e)}catch{return!1}});if(h){const g=o[h];g!==!1&&typeof g=="object"?S=g:S=a}else S=a}else S=a;const d=h=>{const g=(h??"").trim();if(!g||g===e||Object.prototype.hasOwnProperty.call(l.Value.get(r.signal)??{},g))return;const O=y(g);if(!O.ok){b.set(O.message);return}b.set(null);const C={...l.Value.get(r.signal)??{}},N=C[e];delete C[e],C[g]=N,r.change(C)},p=l.Use(q.BeatUII18n,h=>v.CloseButton({size:"xs",label:h.$.removeItem,disabled:!u(Object.keys(l.Value.get(r.signal)??{}).length),onClick:()=>{const g=Object.keys(l.Value.get(r.signal)??{}).length;if(!u(g))return;const O={...l.Value.get(r.signal)??{}};delete O[e],r.change(O)}})),w=l.Value.map(m.signal,h=>c&&h!=null);return l.html.div(l.attr.class("bc-object-helpers__row"),l.style.gridTemplateColumns("2fr 3fr min-content"),v.InputWrapper({content:j.EditableText({value:f,onChange:d,disabled:l.computedOf(r.disabled,w)((h,g)=>h||g)}),error:l.Ensure(b,h=>l.html.div(l.attr.class("bc-object-helpers__error"),h)),description:l.html.div(l.attr.class("bc-object-helpers__description"),s===!1?"Unevaluated property (not allowed by schema)":"Unevaluated property",Object.keys(o).length>0?l.html.span(" • Allowed patterns: ",Object.keys(o).join(", ")):null)}),l.html.div($({ctx:i.with({definition:S,suppressLabel:!0}).append(e),controller:m})),l.html.div(l.attr.class("bc-object-helpers__remove"),p))}function We(e){const t=e.properties??{},n=new Set(Object.keys(t)),r=e.additionalProperties??!0,i=r!==!1,o=r===!0||r===void 0?{}:r,a=e.minProperties??0,s=e.maxProperties??1/0,u=e.unevaluatedProperties;let c=!0,y=null;u===!1?(c=!1,y="No unevaluated properties are allowed by schema"):u&&typeof u=="object"&&(c=!0);const m=e.patternProperties??{},f=Object.keys(m).filter(Boolean).map(p=>{try{return new RegExp(p)}catch{return null}}).filter(p=>p!=null),b=e.propertyNames,S=e["x:ui"],d=!!(S&&typeof S=="object"&&S.lockKeyAfterSet);return{knownProps:t,knownKeys:n,ap:r,apAllowed:i,apSchema:o,minProps:a,maxProps:s,unevaluatedProps:u,canAddUnevaluated:c,unevaluatedTooltip:y,patternProps:m,patternList:f,propertyNamesDef:b,lockKeyAfterSet:d}}function Re(e,t){const{knownKeys:n,apAllowed:r,patternList:i,patternProps:o,propertyNamesDef:a}=e;return s=>{const u=(s??"").trim();if(u==="")return{ok:!1,message:"Key cannot be empty"};if(a===!1)return{ok:!1,message:"No property names are allowed by schema"};if(a&&typeof a=="object"&&t)try{const c=t.compile(a);if(!c(u))return{ok:!1,message:c.errors?.[0]?.message??"Invalid property name"}}catch{}if(!r&&!n.has(u)){if(i.length===0)return{ok:!1,message:"Only declared properties are allowed"};if(!i.some(y=>y.test(u)))return{ok:!1,message:`Key must match one of: ${Object.keys(o).join(", ")}`}}return{ok:!0}}}function Me(e){const{minProps:t,apSchema:n,unevaluatedProps:r}=e;return{canRemove:s=>s>t,makeDefaultFor:s=>{const u=H(s,y=>y);if(u!==void 0)return u;const c=s.type;if(c==="string")return"";if(c==="number"||c==="integer")return 0;if(c==="boolean")return!1;if(c==="array")return[];if(c==="object")return{}},getValueSchemaForNew:()=>r&&typeof r=="object"?r:n}}function ut({ctx:e,controller:t,config:n,effective:r}){const i=Se.l(n.knownProps).filter(([,s])=>s!==!1),o=i.map(([s])=>s);return{children:i.map(([s,u])=>{const c=s,y=t.field(c);return $({ctx:e.with({definition:u,isPropertyRequired:Array.isArray(r.required)?r.required.includes(c):e.hasRequiredProperty(c),suppressLabel:!1}).append(c),controller:y})}),names:o}}function ct({controller:e,config:t,validatePropertyName:n,helpers:r}){if(!t.apAllowed)return null;const i=(o,a)=>{const s=o,u=y=>a.has(y)?!1:n(y).ok;if(u(s))return s;let c=1;for(;a.has(s+c)||!u(s+c);)c++;return s+c};return l.Use(q.BeatUII18n,o=>we.Button({variant:"outline",disabled:l.Value.map(e.signal,a=>!t.canAddUnevaluated||Object.keys(a??{}).length>=t.maxProps),onClick:()=>{const a=l.Value.get(e.signal)??{},s=Object.keys(a);if(!t.canAddUnevaluated||s.length>=t.maxProps)return;const u=new Set(s),c=i("property",u);if(!n(c).ok)return;const m=r.getValueSchemaForNew(),f=r.makeDefaultFor(m),b={...a,[c]:f};e.change(b)}},l.attr.title(t.unevaluatedTooltip),o.$.addLabel))}function Ue({ctx:e,containerLayout:t,content:n}){return!e.suppressLabel&&e.name!=null&&(!t||!["fieldset","group"].includes(t.format||""))?v.InputWrapper({...L({ctx:e}),content:n}):n}function ft({ctx:e,controller:t,baseDef:n}){const r=We(n),i=Re(r,e.ajv),o=Me(r),{children:a,names:s}=ut({ctx:e,controller:t,config:r,effective:n}),u=l.MapSignal(t.signal,b=>{const d=Object.keys(b??{}).filter(g=>!r.knownKeys.has(g));if(d.length===0)return l.Empty;const p=D(n,b??{},e.ajv),w=d.filter(g=>!p.has(g)),h=d.filter(g=>p.has(g));return l.Fragment(...h.map(g=>{const O=r.patternList.some(C=>C.test(g));return Te(g,O,{controller:t,effCtx:e,patternProps:r.patternProps,apSchema:r.apSchema,canRemove:o.canRemove,lockKeyAfterSet:r.lockKeyAfterSet,validatePropertyName:i})}),...w.map(g=>{const O=r.patternList.some(C=>C.test(g));return Fe(g,O,{controller:t,effCtx:e,patternProps:r.patternProps,apSchema:r.apSchema,unevaluatedProps:r.unevaluatedProps,canRemove:o.canRemove,lockKeyAfterSet:r.lockKeyAfterSet,validatePropertyName:i})}))}),c=ct({controller:t,config:r,validatePropertyName:i,helpers:o}),y=A.getContainerLayout(e),m=[...a,u,c].filter(Boolean),f=A.applyContainerLayout(y,e,m,s);return Ue({ctx:e,containerLayout:y,content:f})}function dt({ctx:e,controller:t,baseDef:n}){return l.MapSignal(t.signal,r=>{const{effective:i,conflicts:o}=Ae(n,r,e.ajv,e.path),a=e.with({definition:i,schemaConflicts:[...e.schemaConflicts,...o]}),s=We(i),u=Re(s,e.ajv),c=Me(s),y=Object.keys(r??{}),m=y.filter(k=>!s.knownKeys.has(k)),f=D(i,r??{},e.ajv),b=m.filter(k=>!f.has(k)),S=m.filter(k=>f.has(k)),d=s.apAllowed&&s.canAddUnevaluated&&y.length<s.maxProps,p=(k,R)=>{const V=k,x=K=>R.has(K)?!1:u(K).ok;if(x(V))return V;let B=1;for(;R.has(V+B)||!x(V+B);)B++;return V+B},w=l.Use(q.BeatUII18n,k=>we.Button({variant:"outline",disabled:!d,onClick:()=>{if(!d)return;const R=new Set(Object.keys(l.Value.get(t.signal)??{})),V=p("property",R);if(!u(V).ok)return;const B=c.getValueSchemaForNew(),K=c.makeDefaultFor(B),Y={...l.Value.get(t.signal)??{},[V]:K};t.change(Y)}},l.attr.title(s.unevaluatedTooltip),k.$.addLabel)),h=A.getContainerLayout(a),g=Se.l(s.knownProps).filter(([,k])=>k!==!1),C=[...g.map(([k])=>k),...S,...b],N=[...g.map(([k,R])=>{const V=k,x=t.field(V);return $({ctx:a.with({definition:R,isPropertyRequired:Array.isArray(i.required)?i.required.includes(V):a.hasRequiredProperty(V),suppressLabel:!1}).append(V),controller:x})}),...S.map(k=>{const R=s.patternList.some(V=>V.test(k));return Te(k,R,{controller:t,effCtx:a,patternProps:s.patternProps,apSchema:s.apSchema,canRemove:c.canRemove,lockKeyAfterSet:s.lockKeyAfterSet,validatePropertyName:u})}),...b.map(k=>{const R=s.patternList.some(V=>V.test(k));return Fe(k,R,{controller:t,effCtx:a,patternProps:s.patternProps,apSchema:s.apSchema,unevaluatedProps:s.unevaluatedProps,canRemove:c.canRemove,lockKeyAfterSet:s.lockKeyAfterSet,validatePropertyName:u})}),s.apAllowed?w:null].filter(Boolean),_=A.applyContainerLayout(h,a,N,C);return Ue({ctx:a,containerLayout:h,content:_})})}function le({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition;return Oe(i)?dt({ctx:e,controller:t,baseDef:i}):ft({ctx:e,controller:t,baseDef:i})}function pt(e){if(typeof e=="boolean")return{discriminator:null,type:null};if(e.discriminator&&typeof e.discriminator=="object"){const n=e.discriminator;if(typeof n.propertyName=="string")return{discriminator:{propertyName:n.propertyName,mapping:n.mapping||{}},type:"openapi"}}const t=e["x:ui"];return t?.discriminatorKey&&typeof t.discriminatorKey=="string"?{discriminator:{key:t.discriminatorKey,mapping:t.discriminatorMapping||{}},type:"beatui"}:{discriminator:null,type:null}}function mt(e,t,n){if(!t.discriminator||!n||typeof n!="object")return null;const{discriminator:r,type:i}=t;if(i==="openapi"){const o=r,a=n[o.propertyName];if(a==null)return null;if(o.mapping&&o.mapping[a]){const s=o.mapping[a];return yt(e,s)}return ge(e,o.propertyName,a)}if(i==="beatui"){const o=r,a=n[o.key];if(a==null)return null;if(o.mapping&&o.mapping[a]!=null){const s=o.mapping[a];return s>=0&&s<e.length?s:null}return ge(e,o.key,a)}return null}function yt(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(typeof r=="object"&&r.$ref===t)return n}return null}function ge(e,t,n){for(let r=0;r<e.length;r++){const i=e[r];if(typeof i!="object")continue;const o=i.properties;if(o&&o[t]){const a=o[t];if(typeof a=="object"&&a.const===n||typeof a=="object"&&Array.isArray(a.enum)&&a.enum.length===1&&a.enum[0]===n)return r}if(i.const===n)return r}return null}function Le({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition.anyOf;return Be({ctx:e,controller:t,kind:"anyOf",variants:i})}function $e({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition.oneOf;return Be({ctx:e,controller:t,kind:"oneOf",variants:i})}function gt({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const o=e.definition.allOf.filter(c=>typeof c=="object").map(c=>A.resolveAnyRef(c,e.schema,e.ajv)),{mergedSchema:a,conflicts:s}=A.mergeAllOf(o,e.path),u=e.with({definition:a,schemaConflicts:[...e.schemaConflicts,...s]});return $({ctx:u,controller:t})}function Be({ctx:e,controller:t,kind:n,variants:r}){const i=r.map((d,p)=>A.getOneOfBranchLabel(d,p,`${n} ${p+1}`)),o=typeof e.definition=="boolean"?{discriminator:null,type:null}:pt(e.definition),a=l.computedOf(t.signal,e.ajv)((d,p)=>{if(n==="oneOf"){if(o.discriminator){const w=mt(r,o,d);if(w!==null)return w}return A.autoSelectOneOfBranch(e,d,p)}return A.autoSelectOneOfBranch(e,d,p)}),s=l.Value.get(a),u=l.prop(s>=0?s:0);t.onDispose(u.dispose);let c=!1;const y=a.on(d=>{!c&&d>=0&&u.set(d)});t.onDispose(y);const m=r.length,f=d=>{c=!0,u.set(d)},b=m>1?Ie({options:r.map((d,p)=>({value:p,label:i[p]})),selected:u,onChange:f}):"",S=l.MapSignal(u,d=>$({ctx:e.with({definition:r[l.Value.get(d)],suppressLabel:!e.isRoot}),controller:t}));return ke({ctx:e,showSelector:m>1,selector:b,inner:S})}function $({ctx:e,controller:t}){const n=typeof e.definition=="boolean"?{}:e.definition;let r=n?.$ref?A.resolveRef(n,e.schema):n,i=e.with({definition:r});if(r?.allOf!=null){const a=r.allOf.filter(s=>typeof s=="object"&&s!==null);if(a.length>0){const s=a.map(f=>A.resolveAnyRef(f,e.schema,e.ajv)),{mergedSchema:u,conflicts:c}=A.mergeAllOf(s,e.path),{allOf:y,...m}=r;r={...m,...u},i=e.with({definition:r,schemaConflicts:[...e.schemaConflicts,...c]})}}let o=[...i.notViolations];if(r?.not!=null&&typeof r.not=="object"){const a=l.Value.get(t.signal),s=Ce(r.not,a,i.ajv,i.path);s&&(o=[...o,s],i=i.with({notViolations:o}))}if(r==null)return T(i,t,E(i,X({ctx:i,controller:t}),t));if(r.enum!=null)return T(i,t,E(i,Ve({ctx:i,controller:t}),t));if(r.const!=null)return T(i,t,E(i,Ee({ctx:i,controller:t}),t));if(r.anyOf!=null)return T(i,t,E(i,Le({ctx:i,controller:t}),t));if(r.oneOf!=null)return T(i,t,E(i,$e({ctx:i,controller:t}),t));if(r?.type==null)return E(i,X({ctx:i,controller:t}),t);if(Array.isArray(r.type)){const s=r.type.filter(u=>u!=="null");if(s.length===1&&["string","number","integer","boolean"].includes(s[0]))switch(s[0]){case"number":return E(i,G({ctx:i,controller:t}),t);case"integer":return E(i,ee({ctx:i,controller:t}),t);case"string":return E(i,Q({ctx:i,controller:t}),t);case"boolean":return E(i,te({ctx:i,controller:t}),t)}return T(i,t,E(i,ce({ctx:i,controller:t}),t))}switch(r.type){case"number":return T(i,t,E(i,G({ctx:i,controller:t}),t));case"integer":return T(i,t,E(i,ee({ctx:i,controller:t}),t));case"string":return T(i,t,E(i,Q({ctx:i,controller:t}),t));case"boolean":return T(i,t,E(i,te({ctx:i,controller:t}),t));case"array":return T(i,t,E(i,ue({ctx:i,controller:t instanceof v.ArrayController?t:t.array()}),t));case"object":{const a=le({ctx:i,controller:t instanceof v.ObjectController?t:t.object()});return i.isRoot?T(i,t,E(i,a,t)):T(i,t,E(i,l.html.div(l.attr.class("bc-json-schema-object"),a),t))}case"null":return T(i,t,E(i,se({ctx:i,controller:t}),t));default:return console.warn("Unknown type",r.type),T(i,t,E(i,l.html.div(l.attr.class("bc-json-schema-unknown"),"Unknown"),t))}}function xe({schema:e,controller:t,ajv:n,widgetRegistry:r,setStatus:i,formValue:o,validationMode:a,submitting:s}){const u=new A.SchemaContext({schema:e,definition:e,horizontal:!1,isPropertyRequired:!1,path:[],ajv:n,widgetRegistry:r,setStatus:i,formValue:o,validationMode:a,submitting:s});return e===!0?X({ctx:u,controller:t}):e===!1?l.Empty:$({ctx:u,controller:t})}function T(e,t,n){return Ne(e.definition)?st({ctx:e,controller:t,children:n,options:{behavior:"hide",clearOnHide:!1}}):n}function ht(e){return e.prefixItems!=null?{isTuple:!0,prefixItems:e.prefixItems,additionalItemsSchema:Array.isArray(e.items)?!0:e.items??!0,tupleLabels:he(e)}:Array.isArray(e.items)?{isTuple:!0,prefixItems:e.items,additionalItemsSchema:e.additionalItems??!0,tupleLabels:he(e)}:{isTuple:!1,prefixItems:[],additionalItemsSchema:e.items??!0}}function he(e){if(typeof e=="boolean")return;const t=e["x:ui"];return Array.isArray(t?.tupleLabels)?t.tupleLabels:void 0}function ue({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition,o=ht(i),a=l.computedOf(t.signal)(f=>{const b=f?.length??0;return!(i.maxItems!=null&&b>=i.maxItems||o.isTuple&&b>=o.prefixItems.length&&o.additionalItemsSchema===!1)}),s=l.computedOf(t.signal)(f=>{const b=f?.length??0;return i.minItems==null||b>i.minItems}),u=l.computedOf(t.signal)(f=>{if(!i.uniqueItems||!f)return new Set;const b=new Map,S=new Set;for(let d=0;d<f.length;d++){const p=JSON.stringify(f[d]);b.has(p)?(S.add(b.get(p)),S.add(d)):b.set(p,d)}return S}),c=l.computedOf(t.signal)(f=>{if(!i.contains||!f)return{matchingIndices:new Set,count:0,isValid:!0};const b=new Set;let S=0;if(e.ajv)try{const h=e.ajv.compile(i.contains);for(let g=0;g<f.length;g++)h(f[g])&&(b.add(g),S++)}catch{}else{const h=i.contains,g=O=>{if(typeof h=="boolean")return h;if(typeof h!="object"||h==null)return!1;const C=h,N=C.type;if(N==="integer"||N==="number")return!(typeof O!="number"||!Number.isFinite(O)||N==="integer"&&!Number.isInteger(O)||typeof C.minimum=="number"&&O<C.minimum||typeof C.exclusiveMinimum=="number"&&O<=C.exclusiveMinimum||typeof C.maximum=="number"&&O>C.maximum||typeof C.exclusiveMaximum=="number"&&O>=C.exclusiveMaximum||typeof C.multipleOf=="number"&&O%C.multipleOf!==0);if(N==="string"){if(typeof O!="string"||typeof C.minLength=="number"&&O.length<C.minLength||typeof C.maxLength=="number"&&O.length>C.maxLength)return!1;if(typeof C.pattern=="string")try{if(!new RegExp(C.pattern).test(O))return!1}catch{}return!0}return!1};for(let O=0;O<f.length;O++)g(f[O])&&(b.add(O),S++)}const d=i.minContains??(i.contains?1:0),p=i.maxContains,w=S>=d&&(p==null||S<=p);return{matchingIndices:b,count:S,isValid:w,minContains:d,maxContains:p}}),y=i.contains?c.map(f=>{const b=typeof i.contains=="object"&&i.contains.title?i.contains.title:"required pattern";if(!f.isValid){if(f.count<(f.minContains??0))return`Must contain at least ${f.minContains??0} item(s) matching ${b} (currently ${f.count})`;if(f.maxContains!=null&&f.count>f.maxContains)return`Must contain at most ${f.maxContains} item(s) matching ${b} (currently ${f.count})`}return`Contains ${f.count} item(s) matching ${b}`}):null,m=I.ListControl({...L({ctx:e}),createItem:()=>{const f=t.signal.value?.length??0;if(o.isTuple&&f<o.prefixItems.length){const b=o.prefixItems[f];return H(b,()=>{})}else return H(o.additionalItemsSchema,()=>{})},controller:t,showAdd:!0,addDisabled:l.computedOf(a)(f=>!f),showRemove:!0,removeDisabled:l.computedOf(s)(f=>!f),element:f=>{const b=f.item,S=f.position.index;let d,p;o.isTuple&&S<o.prefixItems.length?(d=o.prefixItems[S],o.tupleLabels?.[S]?p=o.tupleLabels[S]:typeof d=="object"&&d.title?p=d.title:p=`Item ${S+1}`):(d=o.additionalItemsSchema,o.isTuple&&(p=`Additional Item ${S-o.prefixItems.length+1}`));const w=$({ctx:e.with({definition:d}).append(S),controller:b}),h=u.map(N=>N.has(S)),g=c.map(N=>N.matchingIndices.has(S));let O=w;p&&o.isTuple&&(O=P.Stack(l.attr.class("bc-stack--gap-1"),P.Label(l.attr.class("bc-array-control__item-label"),p),O));const C=[];return i.uniqueItems&&C.push(l.When(h,()=>P.Label(l.attr.class("bc-array-control__indicator bc-array-control__indicator--error"),"⚠️ Duplicate value"))),i.contains&&C.push(l.When(g,()=>P.Label(l.attr.class("bc-array-control__indicator bc-array-control__indicator--success"),"✓ Matches required pattern"))),C.length>0?P.Stack(l.attr.class("bc-stack--gap-1"),O,...C):O}});return i.contains&&y?P.Stack(l.attr.class("bc-stack--gap-2"),m,l.MapSignal(l.computedOf(c,y)((f,b)=>({info:f,summary:b})),({info:f,summary:b})=>P.Label(l.attr.class(f.isValid?"bc-array-control__summary bc-array-control__summary--success":"bc-array-control__summary bc-array-control__summary--error"),b))):m}function bt(e){return e.map(t=>({key:t,label:ve._t(t),detect:n=>Ke(n,[t])===t,convert:n=>ze(n,t),defaultValue:()=>He(t)}))}function ce({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});if(r)return r;const i=e.definition;let o=i.type??[];const a=Ge(i),s=o.includes("null"),u=o.filter(d=>d!=="null"&&(d==="string"||d==="number"||d==="integer"||d==="boolean")),c=s&&u.length===o.length-1;c&&(o=u);const y=bt(o),m=new I.UnionController(t.path,t.change,t.signal,t.status,{disabled:t.disabled},y);t.onDispose(()=>m.dispose());const f=d=>Ie({options:o.map(p=>({value:p,label:ve._t(p)})),selected:m.activeBranch,onChange:d,mode:a.selector??"auto"}),b=d=>{m.switchToBranch(d,a.confirmBranchChange)},S=l.MapSignal(m.activeBranch,d=>{const p=l.Value.get(d),w=m.getBranchController(p);if(c&&(p==="number"||p==="integer")){const g=i;return v.Control(I.NullableNumberInput,{...L({ctx:e.with({suppressLabel:!e.isRoot})}),controller:w,min:g.minimum,max:g.maximum,step:p==="integer"?je(g.multipleOf):g.multipleOf})}const h=e.with({definition:{...i,type:p},suppressLabel:!e.isRoot});switch(p){case"string":return Q({ctx:h,controller:w});case"number":return G({ctx:h,controller:w});case"integer":return ee({ctx:h,controller:w});case"boolean":return te({ctx:h,controller:w});case"null":return se({ctx:h,controller:w});case"array":{const g=w.array();return ue({ctx:h,controller:g})}case"object":{const g=w.object();return le({ctx:h,controller:g})}default:return v.Control(I.NullableNumberInput,{...L({ctx:h}),controller:w})}});return ke({ctx:e,showSelector:o.length>1,selector:f(b),inner:S})}function X({ctx:e,controller:t}){const n=F.resolveWidget(e.definition,e.name),r=W({ctx:e,controller:t,resolved:n});return r||(e.definition===!0?X({ctx:e.with({definition:{type:["string","number","object","array","boolean","null"]}}),controller:t}):ce({ctx:e.with({definition:{...e.definition,type:["string","number","object","array","boolean","null"]}}),controller:t}))}function vt(e){if(typeof e=="boolean")return[];const t=e["x:ui"];return!t||!Array.isArray(t.crossField)?[]:t.crossField.filter(n=>typeof n=="object"&&n!=null&&typeof n.id=="string"&&Array.isArray(n.fields)&&typeof n.validate=="function")}function St(e,t,n=!1){const r=[],i=[...t].sort((o,a)=>(a.priority||0)-(o.priority||0));for(const o of i)if(!(o.onSubmitOnly&&!n))try{const a={};for(const u of o.fields)a[u]=wt(e,u);const s=o.validate(a,e);if(!s.valid){const u=o.targets||o.fields;if(s.fieldErrors)for(const[c,y]of Object.entries(s.fieldErrors))r.push({instancePath:`/${c}`,schemaPath:`#/x:ui/crossField/${o.id}`,keyword:"crossField",params:{ruleId:o.id,fields:o.fields,context:s.context},message:y});else{const c=s.message||o.message||"Cross-field validation failed";for(const y of u)r.push({instancePath:`/${y}`,schemaPath:`#/x:ui/crossField/${o.id}`,keyword:"crossField",params:{ruleId:o.id,fields:o.fields,context:s.context},message:c})}}}catch(a){console.warn(`Error in cross-field validation rule ${o.id}:`,a);const s=o.targets?.[0]||o.fields[0];r.push({instancePath:`/${s}`,schemaPath:`#/x:ui/crossField/${o.id}`,keyword:"crossField",params:{ruleId:o.id,fields:o.fields},message:"Cross-field validation error"})}return r.length>0?A.ajvErrorsToControllerValidation(r):P.i.valid}function wt(e,t){if(e==null||typeof e!="object")return;const n=t.split(".");let r=e;for(const i of n){if(r==null||typeof r!="object")return;if(Array.isArray(r)){const o=parseInt(i,10);if(!isNaN(o))r=r[o];else return}else r=r[i]}return r}function Ot(e){if(typeof e=="boolean")return;const t=e["x:ui"];if(!t)return;const n={};Array.isArray(t.when)&&(n.when=t.when.filter(i=>typeof i=="object"&&i!=null&&"watch"in i&&"condition"in i)),Array.isArray(t.crossField)&&(n.crossField=t.crossField.filter(i=>typeof i=="object"&&i!=null&&Array.isArray(i.fields)&&typeof i.validate=="function"));const r=vt(e);return r.length>0&&(n.crossFieldRules=r),Array.isArray(t.async)&&(n.async=t.async.filter(i=>typeof i=="object"&&i!=null&&typeof i.validate=="function")),Object.keys(n).length>0?n:void 0}function re(e,t){if(!e.startsWith("$."))throw new Error(`Invalid JSONPath: ${e}. Must start with '$.'.`);const n=e.slice(2).split(/[.[\]]/).filter(Boolean);let r=t;for(const i of n){if(r==null)return;if(typeof r=="object"&&!Array.isArray(r))r=r[i];else if(Array.isArray(r)){const o=parseInt(i,10);if(!isNaN(o))r=r[o];else return}else return}return r}function Ct(e,t){try{if(typeof e.condition=="function"){const r=(Array.isArray(e.watch)?e.watch:[e.watch]).map(i=>re(i,t));return e.condition(r.length===1?r[0]:r,t)}return typeof e.condition=="string"?!!re(e.condition,t):!1}catch(n){return console.warn("Error evaluating conditional validation:",n),!1}}function At(e,t,n,r){const i=[];if(r&&!r(e)&&r.errors&&i.push(...r.errors),n.when){for(const o of n.when)if(Ct(o,t)?o.then:o.else,o.validate)try{const s=o.validate(e,t);s&&i.push({instancePath:"",schemaPath:"#/x:ui/when",keyword:"conditional",params:{},message:s})}catch(s){console.warn("Error in conditional validation:",s)}}if(n.crossField)for(const o of n.crossField)try{const a={};for(const u of o.fields)a[u]=re(`$.${u}`,t);const s=o.validate(a,t);if(s){const u=o.target||o.fields[0];i.push({instancePath:`/${u}`,schemaPath:"#/x:ui/crossField",keyword:"crossField",params:{fields:o.fields},message:o.message||s})}}catch(a){console.warn("Error in cross-field validation:",a)}if(n.crossFieldRules&&n.crossFieldRules.length>0){const o=St(t,n.crossFieldRules);if(o.type==="invalid"){const a=jt(o);i.push(...a)}}return i.length>0?A.ajvErrorsToControllerValidation(i):P.i.valid}function jt(e){if(e.type==="valid")return[];const t=[];function n(r,i=""){if(r.message&&t.push({instancePath:i,schemaPath:"#/crossField",keyword:"crossField",params:{},message:r.message}),r.dependencies)for(const[o,a]of Object.entries(r.dependencies)){const s=i?`${i}/${o}`:`/${o}`;n(a,s)}}return n(e.error),t}function It(e,t){const n=new Set;if(e.when)for(const r of e.when)(Array.isArray(r.watch)?r.watch:[r.watch]).forEach(o=>n.add(o));if(e.crossField)for(const r of e.crossField)r.fields.forEach(i=>n.add(i));return{watchedPaths:Array.from(n),shouldRevalidate:r=>Array.from(n).some(i=>r.startsWith(i)||i.startsWith(r))}}function kt(e){if(typeof e=="boolean")return[];const t=e["x:ui"];return!t||!Array.isArray(t.async)?[]:t.async.filter(n=>typeof n=="object"&&n!=null&&typeof n.id=="string"&&typeof n.field=="string"&&typeof n.validate=="function")}class Nt{timeouts=new Map;validationStates=new Map;abortControllers=new Map;getValidationState(t){return this.validationStates.has(t)||this.validationStates.set(t,l.prop({isValidating:!1,result:P.i.valid,lastValidatedValue:void 0,lastValidatedAt:0})),this.validationStates.get(t)}async validateField(t,n,r,i=!1){const o=`${t.field}_${t.id}`,a=this.getValidationState(o),s=this.timeouts.get(o);s!==void 0&&clearTimeout(s);const u=this.abortControllers.get(o);if(u&&u.abort(),!i&&a.value.lastValidatedValue===n)return;if(t.minLength&&typeof n=="string"&&n.length<t.minLength){a.set({...a.value,result:P.i.valid,isValidating:!1});return}const c=setTimeout(async()=>{const y=new AbortController;this.abortControllers.set(o,y),a.set({...a.value,isValidating:!0,result:t.loadingMessage?P.i.invalid({message:t.loadingMessage}):a.value.result});try{const m=await t.validate(n,r);if(y.signal.aborted)return;const f=m.valid?P.i.valid:P.i.invalid({message:m.message||"Async validation failed",context:m.context});a.set({isValidating:!1,result:f,lastValidatedValue:n,lastValidatedAt:Date.now()})}catch(m){if(y.signal.aborted)return;const f=m instanceof Error?m.message:"Async validation error";a.set({isValidating:!1,result:P.i.invalid({message:f}),lastValidatedValue:n,lastValidatedAt:Date.now()})}finally{this.abortControllers.delete(o),this.timeouts.delete(o)}},i?0:t.debounce||300);this.timeouts.set(o,c)}cancelAll(){for(const t of this.timeouts.values())clearTimeout(t);this.timeouts.clear();for(const t of this.abortControllers.values())t.abort();this.abortControllers.clear()}getAllValidationResults(){const t={};for(const[n,r]of this.validationStates.entries()){const i=r.value;!i.isValidating&&i.result.type==="invalid"&&(t[n]=i.result)}return t}isValidating(){for(const t of this.validationStates.values())if(t.value.isValidating)return!0;return!1}dispose(){this.cancelAll();for(const t of this.validationStates.values())t.dispose();this.validationStates.clear()}}function J(e){if(typeof e!="boolean")return Pt(e)}function Pt(e){if(e.default!==void 0)return e.default;if(Array.isArray(e.examples)&&e.examples.length>0)return e.examples[0];if(e.const!==void 0)return e.const;if(Array.isArray(e.enum)&&e.enum.length>0)return e.enum[0];if(Mt(e))return null;if(e.allOf&&Array.isArray(e.allOf))return Vt(e.allOf);const t=e.oneOf??e.anyOf;if(t&&Array.isArray(t))for(const n of t){const r=J(n);if(r!==void 0)return r}return Et(e)}function Vt(e){const t={};let n=!1;for(const r of e){const i=J(r);i!==void 0&&typeof i=="object"&&i!==null&&(Object.assign(t,i),n=!0)}return n?t:void 0}function Et(e){switch(Ut(e)){case"object":return Tt(e);case"array":return Ft(e);case"string":return Wt(e);case"number":case"integer":return Rt(e);case"boolean":return!1;case"null":return null;default:return}}function Tt(e){if(!e.properties)return{};const t=new Set(e.required??[]),n={};let r=!1;for(const[i,o]of Object.entries(e.properties)){if(!t.has(i)||typeof o=="boolean")continue;const a=J(o);a!==void 0&&(n[i]=a,r=!0)}return r?n:{}}function Ft(e){const t=e.minItems??0;if(t===0)return[];const n=e.items;if(!n||typeof n=="boolean")return Array(t).fill(null);if(Array.isArray(n))return n.slice(0,t).map(i=>J(i)??null);const r=J(n);return Array(t).fill(r??null)}function Wt(e){switch(e.format){case"date":return Lt();case"date-time":return $t();case"time":return"00:00:00";default:return""}}function Rt(e){const t=e.type==="integer";let n=e.minimum,r=e.maximum;if(e.exclusiveMinimum!==void 0){const a=typeof e.exclusiveMinimum=="number"?e.exclusiveMinimum:e.exclusiveMinimum?n??0:void 0;a!==void 0&&(n=t?a+1:a+be(e))}if(e.exclusiveMaximum!==void 0){const a=typeof e.exclusiveMaximum=="number"?e.exclusiveMaximum:e.exclusiveMaximum?r??0:void 0;a!==void 0&&(r=t?a-1:a-be(e))}let i;n!==void 0&&r!==void 0?i=(n+r)/2:n!==void 0?i=n:r!==void 0?i=0<=r?0:r:i=0;const o=e.multipleOf;return o!==void 0&&o>0&&(i=Math.round(i/o)*o,n!==void 0&&i<n&&(i=Math.ceil(n/o)*o),r!==void 0&&i>r&&(i=Math.floor(r/o)*o)),t&&(i=Math.round(i)),i}function be(e){return e.multipleOf!==void 0?e.multipleOf:.001}function Mt(e){return Array.isArray(e.type)?e.type.includes("null"):!1}function Ut(e){if(typeof e.type=="string")return e.type;if(Array.isArray(e.type))return e.type.find(t=>t!=="null");if(e.properties!==void 0)return"object";if(e.items!==void 0)return"array"}function Lt(){return new Date().toISOString().split("T")[0]}function $t(){return new Date().toISOString()}function Bt(e){const t=globalThis.structuredClone;return typeof t=="function"?t(e):JSON.parse(JSON.stringify(e))}function xt(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function Dt(e){const t=new j.WidgetRegistry;for(let n=0;n<e.length;n++){const r=e[n],i=r.displayName??`custom-widget-${n}`;t.register(i,{factory:r.factory,displayName:r.displayName??`Custom Widget ${n+1}`,description:r.description,supportedTypes:r.supportedTypes,priority:r.priority??50,canFallback:!0,matcher:r.matcher})}return t}function Jt({schema:e,initialValue:t,externalSchemas:n,refResolver:r,sanitizeAdditional:i,validationMode:o,validateDebounceMs:a,customWidgets:s,applySchemaDefaults:u=!0,submitting:c},y){const m=t!==void 0?l.Value.get(t):void 0,f=J(e);let b;return t===void 0?b=f??{}:u?b=I.deepMergeDefaults(f,m):b=m,l.Async(A.getAjvForSchema(e,{externalSchemas:n,refResolver:r,sanitizeAdditional:i}),S=>{if(S.ok){const{ajv:d,validate:p}=S.value,w=Ot(e),h=kt(e),g=h.length>0?new Nt:null,O=o??"onTouched",C=M=>{const U=p(M);let z;return U?z=P.i.valid:z=A.ajvErrorsToControllerValidation(p.errors??[]),w?At(M,M,w,p):z},{controller:N,setStatus:_}=v.useController({initialValue:b,validationMode:O,validateDebounceMs:a,validate:O==="onSubmit"?void 0:C}),k=w?It(w):null,R=i!==!1;let V=!1;const x=R?N.signal.on(M=>{if(V)return;const U=Bt(M);p(U)&&!xt(U,M)&&(V=!0,N.change(U),V=!1)}):()=>{},B=k?N.signal.on((M,U)=>{U!=null&&JSON.stringify(M)!==JSON.stringify(U)&&setTimeout(()=>{const qe=N.status.value;_(qe)},10)}):()=>{},K=g&&h.length>0?N.signal.on(M=>{for(const U of h)g.validateField(U,M,M)}):()=>{},Y=()=>{x(),B(),K(),g?.dispose(),N.dispose()},De=s?Dt(s):void 0,Je=l.Fragment(l.OnDispose(Y),xe({schema:e,controller:N,ajv:d,widgetRegistry:De,setStatus:_,formValue:N.signal,validationMode:O,submitting:c}));return y({Form:Je,controller:N,setStatus:_})}return l.html.div(l.attr.class("bc-json-schema-form__error"),S.error)})}function qt(e,t){const r=(t?.ajv??new A.Ajv({allErrors:!0})).compile(e);return{"~standard":{version:1,vendor:"ajv",validate:i=>r(i)?{value:i}:{issues:_t(r.errors??[])},types:void 0}}}function _t(e){return e.map(t=>({message:Kt(t),path:zt(t)}))}function Kt(e){return e.message??`${e.keyword} validation failed`}function zt(e){const t=Ht(e.instancePath||"");if(e.keyword==="required"){const n=e.params.missingProperty;if(n!=null)return[...t,n]}if(e.keyword==="additionalProperties"){const n=e.params.additionalProperty;if(n!=null)return[...t,n]}if(e.keyword==="unevaluatedProperties"){const n=e.params.unevaluatedProperty;if(n!=null)return[...t,n]}return t.length>0?t:void 0}function Ht(e){return e?e.split("/").slice(1).map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~")).map(n=>Gt(n)?Number(n):n):[]}function Gt(e){return/^\d+$/.test(e)}exports.createDiagnosticWidget=j.createDiagnosticWidget;exports.forFormat=j.forFormat;exports.forTypeAndFormat=j.forTypeAndFormat;exports.forXUI=j.forXUI;exports.SchemaContext=A.SchemaContext;exports.ajvErrorsToControllerValidation=A.ajvErrorsToControllerValidation;exports.ajvErrorsToDependencies=A.ajvErrorsToDependencies;exports.buildMessage=A.buildMessage;exports.buildPath=A.buildPath;exports.clearCaches=A.clearCaches;exports.clearCachesForAjv=A.clearCachesForAjv;exports.compileWithCache=A.compileWithCache;exports.getAjvForSchema=A.getAjvForSchema;exports.getCacheStats=A.getCacheStats;exports.jsonPointerToSegments=A.jsonPointerToSegments;exports.mergeAllOf=A.mergeAllOf;exports.JSONSchemaAllOf=gt;exports.JSONSchemaAny=X;exports.JSONSchemaAnyOf=Le;exports.JSONSchemaArray=ue;exports.JSONSchemaBoolean=te;exports.JSONSchemaConst=Ee;exports.JSONSchemaControl=xe;exports.JSONSchemaEnum=Ve;exports.JSONSchemaForm=Jt;exports.JSONSchemaGenericControl=$;exports.JSONSchemaInteger=ee;exports.JSONSchemaNull=se;exports.JSONSchemaNumber=G;exports.JSONSchemaObject=le;exports.JSONSchemaOneOf=$e;exports.JSONSchemaString=Q;exports.JSONSchemaUnion=ce;exports.composeEffectiveObjectSchema=Ae;exports.createAJVStandardSchema=qt;exports.evaluateIfThenElseOverlay=ie;exports.evaluateNotViolation=Ce;exports.extractSchemaDefaults=J;exports.getEvaluatedProperties=D;exports.hasConditionalFeatures=Oe;