@tempots/beatui 0.76.0 → 0.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/{ar-CefikVG3.cjs → ar-DNoFBb9J.cjs} +1 -1
  2. package/dist/{ar-BbgpGwJp.js → ar-D__6gR_P.js} +1 -1
  3. package/dist/auth/index.cjs.js +1 -1
  4. package/dist/auth/index.es.js +5 -5
  5. package/dist/beatui.css +11 -2
  6. package/dist/beatui.tailwind.css +11 -2
  7. package/dist/{colors-B9fcMxa_.cjs → colors-B2yrgHSW.cjs} +1 -1
  8. package/dist/{colors-pQZlNrwM.js → colors-DPo9GEJR.js} +6 -6
  9. package/dist/{de-ZRnkggf5.cjs → de-AwUkK0rS.cjs} +1 -1
  10. package/dist/{de-R7lPfyZ4.js → de-DmKpCTuQ.js} +1 -1
  11. package/dist/deep-merge-BoJqJNah.cjs +1 -0
  12. package/dist/{deep-merge-CQQCMLwG.js → deep-merge-Cjm-tFVT.js} +224 -226
  13. package/dist/{duration-input-D-SIoDoo.cjs → duration-input-COTlyMwv.cjs} +1 -1
  14. package/dist/{duration-input-DKxZ6OCa.js → duration-input-DfdE7_V9.js} +3 -3
  15. package/dist/{es-DV0Jr_BZ.js → es-BDZ5UJLS.js} +1 -1
  16. package/dist/{es-IkNtVSp2.cjs → es-D-d2AIlX.cjs} +1 -1
  17. package/dist/{fa-DXvHejs9.js → fa-CuPgy1cj.js} +1 -1
  18. package/dist/{fa-B-byOhgU.cjs → fa-D7rRdG8c.cjs} +1 -1
  19. package/dist/{fr-F0ZegdR2.cjs → fr-0er_BWMt.cjs} +1 -1
  20. package/dist/{fr-D8FOMX0o.js → fr-DmyMO3lB.js} +1 -1
  21. package/dist/{he-B19Qsx-u.js → he-C3RHfs6R.js} +1 -1
  22. package/dist/{he-BcEFNuYz.cjs → he-R2veUyP3.cjs} +1 -1
  23. package/dist/{hi-CarXvOJD.cjs → hi-C9UP7NGG.cjs} +1 -1
  24. package/dist/{hi-DozFnE3b.js → hi-YnvrXBht.js} +1 -1
  25. package/dist/{index-DdpYvBeh.js → index-BSl-AmDV.js} +3 -3
  26. package/dist/{index-B7lXSIXm.cjs → index-ByWYsYVI.cjs} +2 -2
  27. package/dist/{index-CYb1YxDX.js → index-Ck1DAzZ9.js} +1 -1
  28. package/dist/{index-gSTSk9KZ.cjs → index-D5kPtj3r.cjs} +1 -1
  29. package/dist/{index-CyyNsVT9.cjs → index-DE2tjivA.cjs} +1 -1
  30. package/dist/{index-CpZh_Snx.js → index-DklKfzD4.js} +1 -1
  31. package/dist/index.cjs.js +2 -2
  32. package/dist/index.es.js +244 -243
  33. package/dist/{it-But8uzNi.js → it-CWLwlDXe.js} +1 -1
  34. package/dist/{it-ops3Czzi.cjs → it-Cxt1_D4h.cjs} +1 -1
  35. package/dist/{ja-2dzONSkh.cjs → ja-CpDovHPb.cjs} +1 -1
  36. package/dist/{ja-DkwTnFdU.js → ja-DthjgDtM.js} +1 -1
  37. package/dist/json-schema/index.cjs.js +2 -2
  38. package/dist/json-schema/index.es.js +7 -7
  39. package/dist/json-structure/index.cjs.js +1 -1
  40. package/dist/json-structure/index.es.js +5 -5
  41. package/dist/{ko-uVJEhtyQ.cjs → ko-M_MCTNuN.cjs} +1 -1
  42. package/dist/{ko-Cqv-IjhX.js → ko-joDK7ONT.js} +1 -1
  43. package/dist/{modal-MofsfmAe.js → modal-CkcwBTk2.js} +28 -28
  44. package/dist/{modal-5P9mU_a4.cjs → modal-CwDATZfz.cjs} +1 -1
  45. package/dist/monaco/index.cjs.js +2 -2
  46. package/dist/monaco/index.es.js +11 -11
  47. package/dist/{nl-DXnbYulJ.cjs → nl-DGhIOGxN.cjs} +1 -1
  48. package/dist/{nl-YSiU3rFI.js → nl-DmoWeXUt.js} +1 -1
  49. package/dist/{notice-DP209Ed8.cjs → notice-Bs90dF7k.cjs} +1 -1
  50. package/dist/{notice-Cqq8g17n.js → notice-CQ1Vx-z1.js} +2 -2
  51. package/dist/{pl-DXmHc2Nh.js → pl-8hl5VXnm.js} +1 -1
  52. package/dist/{pl-RbiIBA3C.cjs → pl-DocnXix_.cjs} +1 -1
  53. package/dist/prosemirror/index.cjs.js +1 -1
  54. package/dist/prosemirror/index.es.js +1 -1
  55. package/dist/{pt-Bf3z_-26.js → pt-BfYK9Rl3.js} +1 -1
  56. package/dist/{pt-BAecyAv-.cjs → pt-DO2Zcuqv.cjs} +1 -1
  57. package/dist/{ru-DZ4gJ6yr.cjs → ru-D9KCOBqN.cjs} +1 -1
  58. package/dist/{ru-Sy00qUeG.js → ru-eA_dNkJz.js} +1 -1
  59. package/dist/tailwind/index.cjs.js +1 -1
  60. package/dist/tailwind/index.es.js +1 -1
  61. package/dist/tailwind/preset.cjs.js +1 -1
  62. package/dist/tailwind/preset.es.js +2 -2
  63. package/dist/tailwind/vite-plugin.cjs.js +1 -1
  64. package/dist/tailwind/vite-plugin.es.js +1 -1
  65. package/dist/timer-BJHOsuS6.cjs +1 -0
  66. package/dist/timer-Rd2sKnvH.js +65 -0
  67. package/dist/{toolbar-C_Ec0_XC.js → toolbar-CdY5huSG.js} +1 -1
  68. package/dist/{toolbar-wEm8iNet.cjs → toolbar-DoRPrs-s.cjs} +1 -1
  69. package/dist/{tr-7jGF_acJ.cjs → tr-BBmQvRSa.cjs} +1 -1
  70. package/dist/{tr-BDxG3qd6.js → tr-CdqbnopM.js} +1 -1
  71. package/dist/{translations-DQxouiBG.js → translations-BEMKy6-W.js} +19 -19
  72. package/dist/{translations-BmsRhth7.js → translations-CVfr2JXG.js} +1 -1
  73. package/dist/{translations-C7HVMcOQ.cjs → translations-D_Vu2mbd.cjs} +1 -1
  74. package/dist/{translations-hMQlZmD4.cjs → translations-eUtMHN9s.cjs} +1 -1
  75. package/dist/types/components/form/controller/controller-validation.d.ts +41 -0
  76. package/dist/types/components/json-schema/widgets/widget-customization.d.ts +7 -7
  77. package/dist/{ur-55zdT2TQ.js → ur-D9sr_I1M.js} +1 -1
  78. package/dist/{ur-ZT6fZFId.cjs → ur-u5qjZsKM.cjs} +1 -1
  79. package/dist/use-form-C5eF9ALX.cjs +2 -0
  80. package/dist/use-form-D3EXhCfe.js +1731 -0
  81. package/dist/{vi-C7K7W0hM.js → vi-0f97dtZb.js} +1 -1
  82. package/dist/{vi-tNs62pgs.cjs → vi-_w5RE8el.cjs} +1 -1
  83. package/dist/{widget-customization-CobH7Rj_.js → widget-customization-BB1gYtwq.js} +4 -4
  84. package/dist/{widget-customization-GaZB6sLP.cjs → widget-customization-Czt9chmX.cjs} +1 -1
  85. package/dist/{zh-CBnP8_Lf.cjs → zh-6cQcHbf6.cjs} +1 -1
  86. package/dist/{zh-DvJBV9D8.js → zh-C7HcUKhE.js} +1 -1
  87. package/package.json +7 -4
  88. package/dist/deep-merge-DZxfgKqX.cjs +0 -1
  89. package/dist/timer-DK_yKNwE.cjs +0 -1
  90. package/dist/timer-DzWb416P.js +0 -51
  91. package/dist/use-form-B7A865EM.js +0 -1298
  92. package/dist/use-form-DVJXMMoN.cjs +0 -2
@@ -1,12 +1,12 @@
1
- import { U as sn, V as ye, B as Gs, o as ze, m as br, p as Xs, C as Zs, t as Ys, l as xs, j as Qs, N as ei, k as ti, s as ri, r as ni, q as ai, R as si, S as ii, E as rs, W as oi, u as ci, X as ui } from "../widget-customization-CobH7Rj_.js";
2
- import { Y as gf, c as vf, d as $f, f as bf } from "../widget-customization-CobH7Rj_.js";
1
+ import { U as sn, V as ye, B as Gs, o as ze, m as br, p as Xs, C as Zs, t as Ys, l as xs, j as Qs, N as ei, k as ti, s as ri, r as ni, q as ai, R as si, S as ii, E as rs, W as oi, u as ci, X as ui } from "../widget-customization-BB1gYtwq.js";
2
+ import { Y as gf, c as vf, d as $f, f as bf } from "../widget-customization-BB1gYtwq.js";
3
3
  import { g as dr } from "../_commonjsHelpers-C6fGbg64.js";
4
- import { a as Ee, S as me, I as nt, c as te, j as _r, b as on, L as We, M as li, C as ns, g as di, A as fi, h as mi } from "../use-form-B7A865EM.js";
5
- import { _ as Kr, g as pi, S as hi, f as yi, N as as, l as de, W as gi, e as vi, t as Xe, T as $i, U as bi, b as Mr, c as _i, M as st, h as wi, G as Si, L as Pi, i as ji, j as Ei } from "../deep-merge-CQQCMLwG.js";
4
+ import { i as Ee, S as me, I as nt, b as te, j as _r, a as on, L as We, M as li, C as ns, f as di, A as fi, g as mi } from "../use-form-D3EXhCfe.js";
5
+ import { _ as Kr, g as pi, S as hi, f as yi, N as as, l as de, W as gi, e as vi, t as Xe, T as $i, U as bi, b as Mr, c as _i, M as st, h as wi, G as Si, L as Pi, i as ji, j as Ei } from "../deep-merge-Cjm-tFVT.js";
6
6
  import { attr as K, Value as ae, Fragment as ke, WithElement as ss, Empty as is, html as J, When as et, computedOf as ce, prop as Ne, Use as Wr, style as os, Ensure as cs, aria as Oi, on as tt, MapSignal as fr, Async as Ri, OnDispose as Ai } from "@tempots/dom";
7
- import { T as ki, a as Br, c as us, B as Ni } from "../translations-DQxouiBG.js";
8
- import { P as Ii, E as Ci, N as ls } from "../notice-Cqq8g17n.js";
9
- import { f as Ti } from "../colors-pQZlNrwM.js";
7
+ import { T as ki, a as Br, c as us, B as Ni } from "../translations-BEMKy6-W.js";
8
+ import { P as Ii, E as Ci, N as ls } from "../notice-CQ1Vx-z1.js";
9
+ import { l as Ti } from "../colors-DPo9GEJR.js";
10
10
  var it = { exports: {} }, wr = {}, Oe = {}, Te = {}, Sr = {}, Pr = {}, jr = {}, cn;
11
11
  function ir() {
12
12
  return cn || (cn = 1, function(e) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../deep-merge-DZxfgKqX.cjs"),l=require("@tempots/dom"),d=require("../use-form-DVJXMMoN.cjs"),P=require("../translations-hMQlZmD4.cjs"),C=require("../duration-input-D-SIoDoo.cjs"),Ke=require("../colors-B9fcMxa_.cjs");function le(e){return e==="int64"||e==="int128"||e==="uint64"||e==="uint128"}function q(e){return e==="int8"||e==="int16"||e==="int32"||e==="int64"||e==="int128"||e==="uint8"||e==="uint16"||e==="uint32"||e==="uint64"||e==="uint128"}function U(e){return e==="float"||e==="double"||e==="decimal"}function ce(e){return q(e)||U(e)}function W(e){return e==="date"||e==="datetime"||e==="time"||e==="duration"}function pe(e){return e==="string"||e==="boolean"||e==="null"||ce(e)||W(e)||e==="uuid"||e==="uri"||e==="binary"}function Ze(e){return e==="object"||e==="array"||e==="set"||e==="map"||e==="tuple"||e==="choice"||e==="any"}function D(e){return typeof e=="object"&&e!==null&&"$ref"in e}function de(e){return typeof e=="object"&&e!==null&&!("type"in e)&&!("$ref"in e)&&!("enum"in e)&&!("const"in e)}function fe(e){return typeof e=="object"&&e!==null&&("type"in e||"$ref"in e||"enum"in e||"const"in e)}function M(e){return e.type==="object"&&"properties"in e}function Z(e){return e.type==="array"&&"items"in e}function H(e){return e.type==="set"&&"items"in e}function X(e){return e.type==="map"&&"values"in e}function Y(e){return e.type==="tuple"&&"tuple"in e}function Q(e){return e.type==="choice"&&"choices"in e}function me(e){return"enum"in e&&Array.isArray(e.enum)}function ye(e){return"const"in e}function J(e){return e===void 0?null:typeof e=="string"||Array.isArray(e)?e:(D(e),null)}function ge(e){return e===void 0?!1:e==="null"?!0:Array.isArray(e)?e.includes("null"):!1}function B(e){return typeof e=="string"?e==="null"?[]:[e]:Array.isArray(e)?e.filter(t=>t!=="null"):[]}const V={int8:{min:-128n,max:127n},int16:{min:-32768n,max:32767n},int32:{min:-2147483648n,max:2147483647n},int64:{min:-9223372036854775808n,max:9223372036854775807n},int128:{min:-170141183460469231731687303715884105728n,max:170141183460469231731687303715884105727n},uint8:{min:0n,max:255n},uint16:{min:0n,max:65535n},uint32:{min:0n,max:4294967295n},uint64:{min:0n,max:18446744073709551615n},uint128:{min:0n,max:340282366920938463463374607431768211455n}};function he(e){return e.startsWith("#/")?e.slice(2).split("/"):e.includes("/")?e.split("/"):["definitions",e]}function He(e,t){let r=e;for(const n of t){if(r==null||typeof r!="object")return;r=r[n]}return r}function R(e,t){const r=he(e),n=He(t,r);if(n==null){console.warn(`Failed to resolve $ref: ${e}`);return}if(fe(n))return n;if(de(n)){console.warn(`$ref "${e}" points to a namespace, not a type definition`);return}}function Xe(e,t){return R(e.$ref,t)}class be{schema;visited=new Set;constructor(t){this.schema=t}resolve(t){if(this.visited.has(t)){console.warn(`Circular reference detected: ${t}`);return}this.visited.add(t);try{const r=R(t,this.schema);if(r?.type&&D(r.type)){const n=this.resolve(r.type.$ref);if(n){const{type:s,...a}=r;return{...n,...a}}}return r}finally{this.visited.delete(t)}}resolveDefinition(t){if(t.type&&D(t.type)){const r=this.resolve(t.type.$ref);if(r){const{type:n,...s}=t;return{...r,...s}}}return t}reset(){this.visited.clear()}}function _(e){return new be(e)}class z{schema;definition;path;readOnly;locale;widgetRegistry;isPropertyRequired;suppressLabel;refResolver;constructor(t){this.schema=t.schema,this.definition=t.definition,this.path=t.path,this.readOnly=t.readOnly??!1,this.locale=t.locale,this.widgetRegistry=t.widgetRegistry,this.isPropertyRequired=t.isPropertyRequired??!1,this.suppressLabel=t.suppressLabel??!1,this.refResolver=t.refResolver??_(t.schema)}with(t){return new z({schema:this.schema,definition:t.definition??this.definition,path:t.path??this.path,readOnly:t.readOnly??this.readOnly,locale:t.locale??this.locale,widgetRegistry:t.widgetRegistry??this.widgetRegistry,isPropertyRequired:t.isPropertyRequired??this.isPropertyRequired,suppressLabel:t.suppressLabel??this.suppressLabel,refResolver:this.refResolver})}append(t){return this.with({path:[...this.path,t]})}get isRoot(){return this.path.length===0}get name(){const t=this.path[this.path.length-1];return typeof t=="string"?t:void 0}get widgetName(){return this.path.map(String).join(".")}get resolvedType(){const t=this.definition.type;if(!t)return null;if(D(t)){const r=this.refResolver.resolve(t.$ref);return r?.type?J(r.type):null}return J(t)}get primaryType(){const t=this.resolvedType;return t?typeof t=="string"?t==="null"?null:t:B(t)[0]??null:null}get isNullable(){return ge(this.definition.type)}get isRequired(){return this.isPropertyRequired}get isOptional(){return!this.isPropertyRequired}get isDeprecated(){return this.definition.deprecated===!0}get isAbstract(){return this.definition.abstract===!0}get isPrimitive(){const t=this.primaryType;return t!=null&&pe(t)}get description(){return this.definition.description}get examples(){return this.definition.examples}get defaultValue(){return this.definition.default}get unit(){return this.definition.unit}get currency(){return this.definition.currency}get label(){if(this.locale&&this.definition.altnames){const r=`lang:${this.locale}`,n=this.definition.altnames[r];if(n)return n}if(this.definition.name)return this.definition.name;const t=this.name;return t?h._t(h.gt(t)):""}get altnames(){return this.definition.altnames}get jsonPath(){return this.path.length===0?"":"/"+this.path.map(String).join("/")}resolveRef(t){return this.refResolver.resolve(t)}get hasEnum(){return"enum"in this.definition&&Array.isArray(this.definition.enum)}get enumValues(){if("enum"in this.definition)return this.definition.enum}get hasConst(){return"const"in this.definition}get constValue(){if("const"in this.definition)return this.definition.const}get format(){if("format"in this.definition)return this.definition.format}}function ve(e,t){let r;const n=_(e);if(e.$root){const s=n.resolve(e.$root);s?r=s:(console.warn(`Failed to resolve $root: ${e.$root}`),r=e)}else e.type||e.properties?r=e:r={type:"any"};return new z({schema:e,definition:r,path:[],readOnly:t?.readOnly,locale:t?.locale,widgetRegistry:t?.widgetRegistry,refResolver:n})}function ee(e,t,r){const n=[],s=[];if(!e.$extends)return{merged:e,inheritanceChain:n,errors:s};const a=Array.isArray(e.$extends)?e.$extends:[e.$extends],u=new Set,i=(p,y=0)=>{if(y>100)return s.push({path:p.join(" -> "),message:"Maximum inheritance depth exceeded"}),[];const b=[];for(const m of p){if(u.has(m)){s.push({path:m,message:`Circular inheritance detected: ${m}`});continue}u.add(m),n.push(m);const g=R(m,t);if(!g){s.push({path:m,message:`Failed to resolve base type: ${m}`});continue}if(g.$extends){const f=Array.isArray(g.$extends)?g.$extends:[g.$extends],v=i(f,y+1);b.push(...v)}b.push(g),u.delete(m)}return b},o=i(a);return{merged:Ye(o,e),inheritanceChain:n,errors:s}}function Ye(e,t){if(e.length===0)return t;let r={...e[0]};for(let a=1;a<e.length;a++)r=ie(r,e[a]);r=ie(r,t);const{$extends:n,...s}=r;return s}function ie(e,t){return M(e)&&M(t)?Qe(e,t):{...e,...t}}function Qe(e,t){const r={...e.properties??{},...t.properties??{}},n=se(e.required),s=se(t.required),a=et([...n,...s]),u={...e,...t,type:"object",properties:r};return a.length>0&&(u.required=a),u}function se(e){return e?e.length===0?[]:Array.isArray(e[0])?e.flat():e:[]}function et(e){return[...new Set(e)]}function tt(e){const t=_(e);return{resolve:r=>(t.reset(),ee(r,e))}}function rt(){return l.html.span(l.attr.class("bc-json-structure-deprecated-badge"),l.attr.style("font-size: var(--font-size-xs); color: var(--color-warning-500, #d97706); background: var(--color-warning-100, #fef3c7); padding: 0.125em 0.5em; border-radius: var(--radius-sm); margin-inline-start: 0.5em; font-weight: normal;"),"(deprecated)")}function I(e,t){return!e||!t?e??"":l.html.span(e,rt())}function nt(e){const t=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:t}}function xe({ctx:e,controller:t}){const r=nt(e);return d.Control(P.TextInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function it(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function $e({ctx:e,controller:t}){const r=it(e),n=d.Control(d.CheckboxInput,{...r,controller:t});return e.isNullable?d.Control(d.CheckboxInput,{...r,controller:t,after:h.NullableResetAfter(t.signal,t.disabled,s=>t.change(s))}):n}function st(e,t){const r=V[t],n=Te(e,r.min),s=Ie(e,r.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof n=="bigint"?Number(n):n,max:typeof s=="bigint"?Number(s):s,step:1,placeholder:a}}function at(e,t){const r=V[t],n=Te(e,r.min),s=Ie(e,r.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof n=="number"?BigInt(n):n,max:typeof s=="number"?BigInt(s):s,placeholder:a}}function Te(e,t){const r=e.definition;if(r.minimum!==void 0){const n=typeof r.minimum=="string"?BigInt(r.minimum):r.minimum;return typeof n=="bigint"?n>t?n:t:BigInt(n)>t?n:Number(t)}if(r.exclusiveMinimum!==void 0){const n=typeof r.exclusiveMinimum=="string"?BigInt(r.exclusiveMinimum):r.exclusiveMinimum,s=typeof n=="bigint"?n+1n:n+1;return typeof s=="bigint"?s>t?s:t:BigInt(s)>t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function Ie(e,t){const r=e.definition;if(r.maximum!==void 0){const n=typeof r.maximum=="string"?BigInt(r.maximum):r.maximum;return typeof n=="bigint"?n<t?n:t:BigInt(n)<t?n:Number(t)}if(r.exclusiveMaximum!==void 0){const n=typeof r.exclusiveMaximum=="string"?BigInt(r.exclusiveMaximum):r.exclusiveMaximum,s=typeof n=="bigint"?n-1n:n-1;return typeof s=="bigint"?s<t?s:t:BigInt(s)<t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function Ce({ctx:e,controller:t,intType:r}){if(le(r)){const s=at(e,r);return e.isNullable?d.Control(C.NullableBigintInput,{...s,controller:t}):d.Control(C.BigintInput,{...s,controller:t})}const n=st(e,r);return e.isNullable?d.Control(h.NullableNumberInput,{...n,controller:t}):d.Control(h.NumberInput,{...n,controller:t})}function ut(e,t){const r=e.definition;let n;r.multipleOf!==void 0?n=r.multipleOf:t==="decimal"&&r.scale!==void 0?n=Math.pow(10,-r.scale):n=void 0;const s=r.minimum!==void 0?typeof r.minimum=="string"?parseFloat(r.minimum):r.minimum:void 0,a=r.maximum!==void 0?typeof r.maximum=="string"?parseFloat(r.maximum):r.maximum:void 0,u=r.exclusiveMinimum!==void 0?typeof r.exclusiveMinimum=="string"?parseFloat(r.exclusiveMinimum):r.exclusiveMinimum:void 0,i=r.exclusiveMaximum!==void 0?typeof r.exclusiveMaximum=="string"?parseFloat(r.exclusiveMaximum):r.exclusiveMaximum:void 0;let o=e.description;if(u!==void 0||i!==void 0){const p=[];u!==void 0&&p.push(`> ${u}`),i!==void 0&&p.push(`< ${i}`);const y=`Valid range: ${p.join(" and ")}`;o=o?`${o} (${y})`:y}const c=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:o,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:s??u,max:a??i,step:n,placeholder:c}}function je({ctx:e,controller:t,floatType:r}){const n=ut(e,r);return e.isNullable?d.Control(h.NullableNumberInput,{...n,controller:t}):d.Control(h.NumberInput,{...n,controller:t})}function ot(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}}function we({ctx:e,controller:t}){const r=ot(e);return d.Control(h.UUIDInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function lt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Se({ctx:e,controller:t,temporalType:r}){const n=lt(e);switch(r){case"date":return e.isNullable?d.Control(C.NullablePlainDateInput,{...n,controller:t}):d.Control(C.PlainDateInput,{...n,controller:t});case"datetime":return e.isNullable?d.Control(C.NullablePlainDateTimeInput,{...n,controller:t}):d.Control(C.PlainDateTimeInput,{...n,controller:t});case"time":return e.isNullable?d.Control(C.NullablePlainTimeInput,{...n,controller:t}):d.Control(C.PlainTimeInput,{...n,controller:t});case"duration":return e.isNullable?d.Control(h.NullableDurationInput,{...n,controller:t}):d.Control(C.DurationInput,{...n,controller:t});default:return console.warn(`Unknown temporal type: ${r}`),l.Fragment()}}function ct(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"https://example.com"}}function De({ctx:e,controller:t}){const r=ct(e);return d.Control(h.UrlInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function pt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Oe({ctx:e,controller:t}){const r=pt(e);return d.Control(C.FileInput,{...r,controller:t})}function dt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"Enter JSON value"}}function ft(e){return e.transform(t=>t===void 0?void 0:JSON.stringify(t,null,2),t=>{if(!(t===void 0||t.trim()===""))try{return JSON.parse(t)}catch{return t}})}function K({ctx:e,controller:t}){const r=dt(e);return d.Control(h.TextArea,{...r,controller:ft(t)})}function mt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function yt(e,t){return!t||t.length===0?!1:typeof t[0]=="string"?t.includes(e):Array.isArray(t[0])?t.some(r=>r.includes(e)):!1}function gt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function ht(e,t="property"){if(!e.has(t))return t;let r=1;for(;e.has(`${t}${r}`);)r++;return`${t}${r}`}function Ae({ctx:e,controller:t}){const r=e.definition;return r.type!=="object"||!("properties"in r)?(console.warn("StructureObjectControl requires an ObjectTypeDefinition"),l.html.div("Invalid object definition")):l.MapSignal(t.signal,n=>{const s=r.properties,a=r.required,u=r.additionalProperties,i=u!==!1,o=typeof u=="object"&&u!==null?u:{type:"any"},c=r.minProperties??0,p=r.maxProperties??1/0,y=Ke.f(s),b=new Set(y.map(([x])=>x)),m=Object.keys(n??{}),g=m.filter(x=>!b.has(x)),f=i&&m.length<p&&!e.readOnly,v=m.length>c&&!e.readOnly,$=y.map(([x,A])=>{const S=x,G=t.field(S),Je=yt(S,a);return T({ctx:e.with({definition:A,isPropertyRequired:Je,suppressLabel:!1}).append(S),controller:G})}),j=g.map(x=>{const A=t.field(x);return l.html.div(l.attr.class("bc-json-structure-additional-property"),l.html.div(l.attr.class("bc-json-structure-additional-property-header"),l.html.strong(`${x}:`),P.Button({variant:"text",size:"xs",onClick:()=>{const S={...l.Value.get(t.signal)??{}};delete S[x],t.change(S)},disabled:!v},"Remove")),l.html.div(l.attr.class("bc-json-structure-additional-property-value"),T({ctx:e.with({definition:o,isPropertyRequired:!1,suppressLabel:!0}).append(x),controller:A})))}),N=f?P.Button({variant:"outline",size:"sm",onClick:()=>{const x=l.Value.get(t.signal)??{},A=new Set(Object.keys(x)),S=ht(A),G=gt(o);t.change({...x,[S]:G})}},"Add Property"):null,O=l.html.div(l.attr.class("bc-json-structure-object-fields"),...$,...j,N),k=l.html.div(l.attr.class("bc-json-structure-object"),O);return!e.suppressLabel&&e.name?d.InputWrapper({...mt(e),content:k}):k})}function bt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function vt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Me({ctx:e,controller:t}){const r=e.definition;if(r.type!=="array"||!("items"in r))return console.warn("StructureArrayControl requires an ArrayTypeDefinition"),l.html.div("Invalid array definition");const n=r.items,s=r.minItems??0,a=r.maxItems??1/0,u=l.computedOf(t.signal)(o=>(o?.length??0)<a),i=l.computedOf(t.signal)(o=>(o?.length??0)>s);return h.ListControl({...bt(e),controller:t,createItem:()=>vt(n),showAdd:!0,addDisabled:l.computedOf(u)(o=>!o||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(o=>!o||e.readOnly),element:o=>{const c=o.position.index,p=o.item;return T({ctx:e.with({definition:n,suppressLabel:!0}).append(c),controller:p})}})}function xt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function $t(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Re({ctx:e,controller:t}){const r=e.definition;if(r.type!=="set"||!("items"in r))return console.warn("StructureSetControl requires a SetTypeDefinition"),l.html.div("Invalid set definition");const n=r.items,s=r.minItems??0,a=r.maxItems??1/0,u=l.computedOf(t.signal)(c=>(c?.length??0)<a),i=l.computedOf(t.signal)(c=>(c?.length??0)>s),o=l.computedOf(t.signal)(c=>{if(!c||c.length===0)return new Set;const p=new Map,y=new Set;for(let b=0;b<c.length;b++){const m=JSON.stringify(c[b]);p.has(m)?(y.add(p.get(m)),y.add(b)):p.set(m,b)}return y});return h.ListControl({...xt(e),controller:t,createItem:()=>$t(n),showAdd:!0,addDisabled:l.computedOf(u)(c=>!c||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(c=>!c||e.readOnly),element:c=>{const p=c.position.index,y=c.item,b=o.map(g=>g.has(p)),m=T({ctx:e.with({definition:n,suppressLabel:!0}).append(p),controller:y});return b.map(g=>g?d.Stack(l.attr.class("bc-stack--gap-1"),m,d.Label(l.attr.class("bc-json-structure-set-error"),"⚠️ Duplicate value - sets must contain unique items")):m)}})}function Tt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function It(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Ct(e,t="key"){if(!e.has(t))return t;let r=1;for(;e.has(`${t}${r}`);)r++;return`${t}${r}`}function Ne({ctx:e,controller:t}){const r=e.definition;if(r.type!=="map"||!("values"in r))return console.warn("StructureMapControl requires a MapTypeDefinition"),l.html.div("Invalid map definition");const n=r.values,s=r.minProperties??0,a=r.maxProperties??1/0;return l.MapSignal(t.signal,u=>{const i=Object.keys(u??{}),o=i.length,c=o<a&&!e.readOnly,p=o>s&&!e.readOnly,y=i.map(f=>{const v=t.field(f);return l.html.div(l.attr.class("bc-json-structure-map-entry"),l.html.div(l.attr.class("bc-json-structure-map-entry-header"),l.html.strong(l.attr.class("bc-json-structure-map-entry-key"),`${f}:`),P.Button({variant:"text",size:"xs",onClick:()=>{const $={...l.Value.get(t.signal)??{}};delete $[f],t.change($)},disabled:!p},"Remove")),l.html.div(l.attr.class("bc-json-structure-map-entry-value"),T({ctx:e.with({definition:n,suppressLabel:!0}).append(f),controller:v})))}),b=c?P.Button({variant:"outline",size:"sm",onClick:()=>{const f=l.Value.get(t.signal)??{},v=new Set(Object.keys(f)),$=Ct(v),j=It(n);t.change({...f,[$]:j})}},"Add Entry"):null,m=l.html.div(l.attr.class("bc-json-structure-map-entries"),...y,b),g=l.html.div(l.attr.class("bc-json-structure-map"),m);return!e.suppressLabel&&e.name?d.InputWrapper({...Tt(e),content:g}):g})}function jt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function wt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function ke({ctx:e,controller:t}){const r=e.definition;if(r.type!=="tuple"||!("tuple"in r)||!("properties"in r))return console.warn("StructureTupleControl requires a TupleTypeDefinition"),l.html.div("Invalid tuple definition");const n=r.tuple,s=r.properties,a=t.signal.value;if(!Array.isArray(a)||a.length!==n.length){const i=n.map(o=>{const c=s[o];return c?wt(c):void 0});t.change(i)}const u=jt(e);return l.html.div(l.attr.class("bc-json-structure-tuple"),u.label&&l.html.label(l.attr.class("bc-json-structure-tuple-label"),u.label,u.required&&l.html.span(l.attr.class("bc-required-indicator"),"*")),u.description&&l.html.div(l.attr.class("bc-json-structure-tuple-description"),u.description),l.html.div(l.attr.class("bc-json-structure-tuple-elements"),...n.map((i,o)=>{const c=s[i];if(!c)return console.warn(`Tuple element "${i}" at index ${o} not found in properties`),l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.span(`Missing definition for "${i}"`));const p=t.item(o),y=c.name||i;return l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.div(l.attr.class("bc-json-structure-tuple-element-header"),l.html.span(l.attr.class("bc-json-structure-tuple-position"),`[${o}]`),l.html.span(l.attr.class("bc-json-structure-tuple-element-name"),y)),l.html.div(l.attr.class("bc-json-structure-tuple-element-control"),T({ctx:e.with({definition:c,suppressLabel:!0}).append(o),controller:p})))})))}function St({options:e,selected:t,onChange:r,disabled:n}){return h.NativeSelect({options:e.map(s=>({type:"value",value:s.value,label:s.label})),value:t,onChange:r,disabled:n})}function Dt({ctx:e,selector:t,inner:r}){const n=d.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),t,r);return e.isRoot?n:d.InputWrapper({label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,content:n})}function Ot(e,t,r){if(!e||typeof e!="object")return null;const n=e;if(r&&r in n){const a=n[r];if(typeof a=="string"&&a in t)return a}const s=Object.keys(n);if(s.length===1){const a=s[0];if(a in t)return a}return null}function At(e,t,r){if(!e||typeof e!="object")return;const n=e;if(r&&r in n){const{[r]:s,...a}=n;return a}if(t in n)return n[t]}function ae(e,t,r){return r?e&&typeof e=="object"?{[r]:t,...e}:{[r]:t}:{[t]:e}}function Mt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(!t||typeof t=="object"))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};default:return}}function qe({ctx:e,controller:t}){const r=e.definition;if(!r.choices||typeof r.choices!="object")return console.warn("StructureChoiceControl requires choices property"),l.html.div(l.attr.class("bc-json-structure-error"),"Invalid choice definition: missing choices");const n=r.choices,s=r.selector,a=Object.keys(n);if(a.length===0)return l.html.div(l.attr.class("bc-json-structure-error"),"Choice type has no variants defined");const u=a.map(f=>{const $=n[f].name||f;return{value:f,label:$}}),i=l.computedOf(t.signal)(f=>Ot(f,n,s)),o=l.Value.get(i)||a[0],c=l.prop(o);t.onDispose(c.dispose);let p=!1;const y=i.on(f=>{!p&&f!==null&&c.set(f)});t.onDispose(y);const m=St({options:u,selected:c,onChange:f=>{p=!0,c.set(f);const v=n[f];if(v){const $=Mt(v),j=ae($,f,s);t.change(j)}},disabled:e.readOnly||e.isDeprecated}),g=l.MapSignal(c,f=>{const v=n[l.Value.get(f)];if(!v)return l.html.div(l.attr.class("bc-json-structure-error"),`Choice variant not found: ${l.Value.get(f)}`);const $=l.computedOf(t.signal)(O=>At(O,l.Value.get(f),s)),j=O=>{const k=ae(O,l.Value.get(f),s);t.change(k)},N=new d.Controller([...t.path,l.Value.get(f)],j,$,t.status,{disabled:t.disabled},void 0);return t.onDispose(()=>N.dispose()),T({ctx:e.with({definition:v,suppressLabel:!0}).append(l.Value.get(f)),controller:N})});return Dt({ctx:e,selector:m,inner:g})}function Rt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Fe({ctx:e,controller:t}){const r=Rt(e);return h.NativeSelectControl({...r,options:(e.enumValues??[]).map(n=>({type:"value",value:n,label:String(n)})),controller:t})}function Pe({ctx:e,controller:t}){return l.Fragment(l.WithElement(()=>{l.Value.get(t.signal)!==e.constValue&&t.change(e.constValue)}),h.Group(d.MutedLabel(e.label,": "),d.Label(String(e.constValue))))}function Nt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function kt(e,t){if(e===null)return t.includes("null")?"null":null;if(e===void 0)return t.includes("string")?"string":t[0]??null;switch(typeof e){case"string":return t.includes("uuid")?"uuid":t.includes("uri")?"uri":t.includes("date")?"date":t.includes("datetime")?"datetime":t.includes("time")?"time":t.includes("duration")?"duration":t.includes("string")?"string":null;case"number":{if(Number.isInteger(e)){if(t.includes("int32"))return"int32";if(t.includes("int64"))return"int64";if(t.includes("uint32"))return"uint32";if(t.includes("uint64"))return"uint64";if(t.includes("int16"))return"int16";if(t.includes("int8"))return"int8";if(t.includes("uint16"))return"uint16";if(t.includes("uint8"))return"uint8"}return t.includes("double")?"double":t.includes("float")?"float":t.includes("decimal")?"decimal":null}case"bigint":return t.includes("int128")?"int128":t.includes("int64")?"int64":t.includes("uint128")?"uint128":t.includes("uint64")?"uint64":null;case"boolean":return t.includes("boolean")?"boolean":null;case"object":return e instanceof File||e instanceof Blob?t.includes("binary")?"binary":null:Array.isArray(e)?t.includes("array")?"array":t.includes("set")?"set":t.includes("tuple")?"tuple":null:t.includes("object")?"object":t.includes("map")?"map":null;default:return null}}function qt(e,t){try{switch(t){case"string":case"uuid":case"uri":case"date":case"datetime":case"time":case"duration":return e==null?{ok:!0,value:void 0}:{ok:!0,value:String(e)};case"int8":case"int16":case"int32":case"uint8":case"uint16":case"uint32":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"int64":case"int128":case"uint64":case"uint128":{if(typeof e=="bigint")return{ok:!0,value:e};if(typeof e=="number"&&Number.isInteger(e))return{ok:!0,value:BigInt(e)};if(typeof e=="string")try{return{ok:!0,value:BigInt(e.trim())}}catch{return{ok:!1}}return{ok:!1}}case"float":case"double":case"decimal":{if(typeof e=="number")return{ok:!0,value:e};if(typeof e=="string"){const r=Number(e);return Number.isFinite(r)?{ok:!0,value:r}:{ok:!1}}return 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 r=e.trim().toLowerCase();return r==="true"||r==="1"||r==="yes"?{ok:!0,value:!0}:r==="false"||r==="0"||r==="no"?{ok:!0,value:!1}:{ok:!1}}return typeof e=="number"?{ok:!0,value:e!==0}:{ok:!1}}case"array":case"set":case"tuple":return Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"object":case"map":return e!=null&&typeof e=="object"&&!Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"binary":return e instanceof File||e instanceof Blob?{ok:!0,value:e}:{ok:!1};case"null":return{ok:!0,value:null};case"any":case"choice":return{ok:!0,value:e};default:return{ok:!1}}}catch{return{ok:!1}}}function Ft(e){switch(e){case"null":return null;case"array":case"set":case"tuple":return[];case"object":case"map":return{};case"binary":return;default:return}}function Pt(e){return e.map(t=>({key:t,label:h._t(t),detect:r=>kt(r,[t])===t,convert:r=>qt(r,t),defaultValue:()=>Ft(t)}))}function Vt({options:e,selected:t,onChange:r}){if((e.length<=3?"segmented":"select")==="segmented"){const a=Object.fromEntries(e.map(u=>[u.value,u.label]));return h.SegmentedInput({options:a,value:t,onChange:u=>r(u),size:"sm"})}return h.NativeSelect({options:e.map(a=>({type:"value",value:a.value,label:a.label})),value:t,onChange:r})}function Lt({ctx:e,showSelector:t,selector:r,inner:n}){return e.isRoot?t?d.Stack(l.attr.class("bc-stack--gap-2"),r,n):n:d.InputWrapper({...Nt(e),content:t?d.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),r,n):n})}function Et({ctx:e,controller:t}){const r=e.definition,n=r.type;let s=[];if(Array.isArray(n))s=n;else return console.warn("StructureUnionControl called with non-array type"),T({ctx:e,controller:t});const a=s.includes("null"),u=B(n),i=a&&u.length>0?u:s,o=Pt(i),c=new h.UnionController(t.path,t.change,t.signal,t.status,{disabled:t.disabled},o);t.onDispose(()=>c.dispose());const p=m=>Vt({options:i.map(g=>({value:g,label:h._t(g)})),selected:c.activeBranch,onChange:m}),y=m=>{c.switchToBranch(m,!1)},b=l.MapSignal(c.activeBranch,m=>{const g=l.Value.get(m),f=c.getBranchController(g),v=e.with({definition:{...r,type:g},suppressLabel:!e.isRoot});return T({ctx:v,controller:f})});return Lt({ctx:e,showSelector:i.length>1,selector:p(y),inner:b})}function T({ctx:e,controller:t}){let r=e;const n=e.definition;if(n.type&&D(n.type)){const i=e.resolveRef(n.type.$ref);if(i){const{type:o,...c}=n,p={...i,...c};r=e.with({definition:p})}}if(r.definition.$extends){const{merged:i}=ee(r.definition,e.schema);r=r.with({definition:i})}const s=r.widgetRegistry;if(s){const i=s.findBestWidget(r);if(i)return i.registration.factory({controller:t,ctx:r})}if(me(r.definition))return Fe({ctx:r,controller:t});if(ye(r.definition))return Pe({ctx:r,controller:t});const a=r.resolvedType;if(Array.isArray(a)&&B(a).length>1)return Et({ctx:r,controller:t});const u=r.primaryType;if(!u)return K({ctx:r,controller:t});if(M(r.definition)){const i=t instanceof d.ObjectController?t:t.object();return Ae({ctx:r,controller:i})}if(Z(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return Me({ctx:r,controller:i})}if(H(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return Re({ctx:r,controller:i})}if(X(r.definition)){const i=t instanceof d.ObjectController?t:t.object();return Ne({ctx:r,controller:i})}if(Y(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return ke({ctx:r,controller:i})}if(Q(r.definition))return qe({ctx:r,controller:t});switch(u){case"string":return xe({ctx:r,controller:t});case"boolean":return $e({ctx:r,controller:t});case"uuid":return we({ctx:r,controller:t});case"uri":return De({ctx:r,controller:t});case"binary":return Oe({ctx:r,controller:t});case"null":return Ut(r);case"any":return K({ctx:r,controller:t});default:return q(u)?Ce({ctx:r,controller:t,intType:u}):U(u)?je({ctx:r,controller:t,floatType:u}):W(u)?Se({ctx:r,controller:t,temporalType:u}):(console.warn(`Unknown type: ${u}`),Wt(r,u))}}function Ve({schema:e,controller:t,widgetRegistry:r,readOnly:n,locale:s}){const a=ve(e,{widgetRegistry:r,readOnly:n,locale:s});return T({ctx:a,controller:t})}function Ut(e){return l.html.div(l.attr.class("bc-json-structure-placeholder"),l.html.span(`[Null: ${e.label}]`),l.html.em("null"))}function Wt(e,t){return l.html.div(l.attr.class("bc-json-structure-unknown"),l.html.span(`Unknown type: ${t}`),l.html.em(`at path: ${e.jsonPath}`))}function te(e,t){return new Bt(e,t)}class Bt{schema;options;constructor(t,r){this.schema=t,this.options=r??{}}validate(t){const r=[];return this.validateValue(t,this.schema,"",r),{isValid:r.length===0,errors:r}}validateAt(t,r){return this.validate(t)}validateValue(t,r,n,s){if(this.options.stopOnFirstError&&s.length>0)return;if(t===null){const c=r.type;if(c==="null"||Array.isArray(c)&&c.includes("null"))return;s.push({path:n,type:"type",expected:c,actual:"null"});return}if("enum"in r&&Array.isArray(r.enum)){r.enum.includes(t)||s.push({path:n,type:"enum",expected:r.enum,actual:t});return}if("const"in r){t!==r.const&&s.push({path:n,type:"const",expected:r.const,actual:t});return}const a=r.type;if(!a)return;const i=(Array.isArray(a)?a:[a]).filter(c=>typeof c=="string");!i.some(c=>this.checkType(t,c,r,n,s))&&i.length>0&&s.push({path:n,type:"type",expected:a,actual:typeof t})}checkType(t,r,n,s,a){switch(r){case"string":return this.validateString(t,n,s,a);case"boolean":return typeof t=="boolean";case"null":return t===null;case"object":return this.validateObject(t,n,s,a);case"array":return this.validateArray(t,n,s,a);case"set":return this.validateSet(t,n,s,a);case"map":return this.validateMap(t,n,s,a);case"tuple":return this.validateTuple(t,n,s,a);case"choice":return this.validateChoice(t,n,s,a);case"any":return!0;default:return q(r)?this.validateInteger(t,r,n,s,a):U(r)?this.validateFloat(t,n,s,a):W(r)?this.validateTemporal(t,r,s,a):r==="uuid"?this.validateUuid(t,s,a):r==="uri"?this.validateUri(t,s,a):r==="binary"?this.validateBinary(t,s,a):!1}}validateString(t,r,n,s){if(typeof t!="string")return!1;const a=r;if(a.minLength!==void 0&&t.length<a.minLength&&s.push({path:n,type:"minLength",expected:a.minLength,actual:t.length}),a.maxLength!==void 0&&t.length>a.maxLength&&s.push({path:n,type:"maxLength",expected:a.maxLength,actual:t.length}),a.pattern!==void 0)try{new RegExp(a.pattern).test(t)||s.push({path:n,type:"pattern",expected:a.pattern,actual:t})}catch{}return!0}validateInteger(t,r,n,s,a){if(typeof t!="number"&&typeof t!="bigint")return!1;if(typeof t=="number"&&!Number.isInteger(t))return a.push({path:s,type:"type",expected:r,actual:"float"}),!1;if(q(r)){const u=V[r],i=typeof t=="bigint"?t:BigInt(Math.round(t));(i<u.min||i>u.max)&&a.push({path:s,type:"integer_bounds",expected:{min:u.min.toString(),max:u.max.toString()},actual:i.toString(),context:{type:r}})}return this.validateNumericConstraints(t,n,s,a),!0}validateFloat(t,r,n,s){return typeof t!="number"?!1:(this.validateNumericConstraints(t,r,n,s),!0)}validateNumericConstraints(t,r,n,s){const a=r,u=typeof t=="bigint"?Number(t):t;if(a.minimum!==void 0){const i=typeof a.minimum=="string"?Number(a.minimum):a.minimum;u<i&&s.push({path:n,type:"minimum",expected:i,actual:u})}if(a.maximum!==void 0){const i=typeof a.maximum=="string"?Number(a.maximum):a.maximum;u>i&&s.push({path:n,type:"maximum",expected:i,actual:u})}if(a.exclusiveMinimum!==void 0){const i=typeof a.exclusiveMinimum=="string"?Number(a.exclusiveMinimum):a.exclusiveMinimum;u<=i&&s.push({path:n,type:"exclusiveMinimum",expected:i,actual:u})}if(a.exclusiveMaximum!==void 0){const i=typeof a.exclusiveMaximum=="string"?Number(a.exclusiveMaximum):a.exclusiveMaximum;u>=i&&s.push({path:n,type:"exclusiveMaximum",expected:i,actual:u})}a.multipleOf!==void 0&&typeof t=="number"&&t%a.multipleOf!==0&&s.push({path:n,type:"multipleOf",expected:a.multipleOf,actual:t})}validateTemporal(t,r,n,s){if(typeof t!="string")return!1;const u={date:/^\d{4}-\d{2}-\d{2}$/,datetime:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/,time:/^\d{2}:\d{2}:\d{2}(\.\d+)?$/,duration:/^P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/}[r];return u&&!u.test(t)?(s.push({path:n,type:"format",expected:r,actual:t}),!1):!0}validateUuid(t,r,n){return typeof t!="string"?!1:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?!0:(n.push({path:r,type:"format",expected:"uuid",actual:t}),!1)}validateUri(t,r,n){if(typeof t!="string")return!1;try{return new URL(t),!0}catch{return n.push({path:r,type:"format",expected:"uri",actual:t}),!1}}validateBinary(t,r,n){return t instanceof Uint8Array?!0:typeof t!="string"?!1:/^[A-Za-z0-9+/]*={0,2}$/.test(t)?!0:(n.push({path:r,type:"format",expected:"binary",actual:t}),!1)}validateObject(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!M(r))return!0;const a=t,u=r.required;if(u){const i=Array.isArray(u[0])?u.flat():u;for(const o of i)o in a||s.push({path:n?`${n}/${o}`:`/${o}`,type:"required",expected:o})}for(const[i,o]of Object.entries(a)){const c=r.properties?.[i];if(c){const p=n?`${n}/${i}`:`/${i}`;this.validateValue(o,c,p,s)}else if(r.additionalProperties===!1)s.push({path:n?`${n}/${i}`:`/${i}`,type:"additionalProperties",actual:i});else if(typeof r.additionalProperties=="object"){const p=n?`${n}/${i}`:`/${i}`;this.validateValue(o,r.additionalProperties,p,s)}}return!0}validateArray(t,r,n,s){if(!Array.isArray(t))return!1;if(!Z(r))return!0;const a=r;a.minItems!==void 0&&t.length<a.minItems&&s.push({path:n,type:"minItems",expected:a.minItems,actual:t.length}),a.maxItems!==void 0&&t.length>a.maxItems&&s.push({path:n,type:"maxItems",expected:a.maxItems,actual:t.length});for(let u=0;u<t.length;u++){const i=`${n}/${u}`;this.validateValue(t[u],r.items,i,s)}return!0}validateSet(t,r,n,s){if(!Array.isArray(t))return!1;if(!H(r))return!0;const a=new Set;for(let u=0;u<t.length;u++){const i=JSON.stringify(t[u]);a.has(i)&&s.push({path:`${n}/${u}`,type:"uniqueItems",actual:t[u]}),a.add(i)}return this.validateArray(t,r,n,s)}validateMap(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!X(r))return!0;const a=t;for(const[u,i]of Object.entries(a)){const o=`${n}/${u}`;this.validateValue(i,r.values,o,s)}return!0}validateTuple(t,r,n,s){if(!Array.isArray(t))return!1;if(!Y(r))return!0;const a=r.tuple.length;t.length!==a&&s.push({path:n,type:"tuple_length",expected:a,actual:t.length});for(let u=0;u<r.tuple.length;u++){const i=r.tuple[u],o=r.properties?.[i];o&&u<t.length&&this.validateValue(t[u],o,`${n}/${u}`,s)}return!0}validateChoice(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!Q(r))return!0;const a=t,u=Object.keys(r.choices),i=Object.keys(a).find(c=>u.includes(c));if(!i)return s.push({path:n,type:"choice",expected:u,actual:Object.keys(a)}),!1;const o=r.choices[i];return o&&this.validateValue(a[i],o,`${n}/${i}`,s),!0}}function _t(e,t,r){return te(e,r).validate(t)}function Le(e,t){const r=zt(e,t);return{path:e.path,message:r,code:e.type}}function re(e,t){return e.map(r=>{const n=t?.get(r.path);return Le(r,n)})}function zt(e,t){switch(e.type){case"type":return`Expected ${ue(e.expected)}, got ${Gt(e.actual)}`;case"type_mismatch":return`Value must be of type ${ue(e.expected)}`;case"minLength":return`Must be at least ${e.expected} characters`;case"maxLength":return`Must be no more than ${e.expected} characters`;case"pattern":return Jt(e,t);case"format":return Kt(e);case"minimum":return`Must be at least ${e.expected}`;case"maximum":return`Must be at most ${e.expected}`;case"exclusiveMinimum":return`Must be greater than ${e.expected}`;case"exclusiveMaximum":return`Must be less than ${e.expected}`;case"multipleOf":return`Must be a multiple of ${e.expected}`;case"integer_bounds":return Zt(e);case"minItems":return`Must have at least ${e.expected} items`;case"maxItems":return`Must have no more than ${e.expected} items`;case"uniqueItems":return"All items must be unique";case"contains":return"Must contain at least one matching item";case"minContains":return`Must contain at least ${e.expected} matching items`;case"maxContains":return`Must contain no more than ${e.expected} matching items`;case"required":return"This field is required";case"minProperties":return`Must have at least ${e.expected} properties`;case"maxProperties":return`Must have no more than ${e.expected} properties`;case"additionalProperties":return`Unknown property: ${e.actual}`;case"dependentRequired":return Ht(e);case"enum":return Xt(e);case"const":return`Must be exactly ${JSON.stringify(e.expected)}`;case"ref_not_found":return`Invalid reference: ${e.expected}`;case"circular_ref":return"Circular reference detected";case"invalid":return"Invalid value";default:return e.context?.message??`Validation error: ${e.type}`}}function ue(e){return typeof e=="string"?oe(e):Array.isArray(e)?e.map(oe).join(" or "):String(e)}function Gt(e){return e===null?"null":e===void 0?"undefined":typeof e}function oe(e){return{string:"text",boolean:"true/false",int8:"integer (-128 to 127)",int16:"integer (-32768 to 32767)",int32:"integer",int64:"large integer",int128:"very large integer",uint8:"positive integer (0 to 255)",uint16:"positive integer (0 to 65535)",uint32:"positive integer",uint64:"large positive integer",uint128:"very large positive integer",float:"decimal number",double:"decimal number",decimal:"decimal number",date:"date",datetime:"date and time",time:"time",duration:"duration",uuid:"UUID",uri:"URL",binary:"binary data",object:"object",array:"list",set:"unique list",map:"key-value pairs",tuple:"ordered list",choice:"one of multiple options",any:"any value",null:"empty"}[e]??e}function Jt(e,t){const r=t?.description;if(r&&e.type==="pattern")return`Does not match required format: ${r}`;const n=e.expected;if(n){const a={"^[a-zA-Z]+$":"letters only","^[0-9]+$":"numbers only","^[a-zA-Z0-9]+$":"letters and numbers only","^\\S+$":"no spaces allowed","^[a-z]+$":"lowercase letters only","^[A-Z]+$":"uppercase letters only"}[n];if(a)return`Must be ${a}`}return"Does not match required format"}function Kt(e){const t=e.expected;return{email:"Must be a valid email address","date-time":"Must be a valid date and time",date:"Must be a valid date",time:"Must be a valid time",uri:"Must be a valid URL","uri-reference":"Must be a valid URL or relative path",uuid:"Must be a valid UUID",hostname:"Must be a valid hostname",ipv4:"Must be a valid IPv4 address",ipv6:"Must be a valid IPv6 address",regex:"Must be a valid regular expression","json-pointer":"Must be a valid JSON pointer"}[t]??`Must be a valid ${t}`}function Zt(e){const t=e.context?.type;if(t&&q(t)){const r=V[t];return`Must be between ${r.min} and ${r.max}`}return"Value is out of range for this integer type"}function Ht(e){const t=e.context?.dependent,r=e.context?.required;return t&&r?.length?`When "${t}" is present, "${r.join('", "')}" must also be provided`:"Missing required dependent fields"}function Xt(e){const t=e.expected;return t&&t.length<=5?`Must be one of: ${t.map(n=>JSON.stringify(n)).join(", ")}`:"Invalid value"}function Yt(e){const t=new Map;for(const r of e){const n=t.get(r.path)??[];n.push(r),t.set(r.path,n)}return t}function Qt(e,t){return e.filter(r=>r.path===t)}function er(e,t){return e.some(r=>r.path===t)}function tr(e,t){const r=t===""?"/":`${t}/`;return e.filter(n=>n.path.startsWith(r))}class L{registrations=new Map;parent;constructor(t){this.parent=t??null}register(t,r){this.registrations.set(t,r)}unregister(t){this.registrations.delete(t)}get(t){return this.registrations.get(t)??this.parent?.get(t)}has(t){return this.registrations.has(t)||(this.parent?.has(t)??!1)}names(){const t=this.parent?.names()??[],r=Array.from(this.registrations.keys());return[...new Set([...t,...r])]}getForType(t){const r=[];this.parent&&r.push(...this.parent.getForType(t));for(const n of this.registrations.values())n.supportedTypes?.includes(t)&&r.push(n);return r}getForFormat(t){const r=[];this.parent&&r.push(...this.parent.getForFormat(t));for(const n of this.registrations.values())n.supportedFormats?.includes(t)&&r.push(n);return r}findBestWidget(t){const r=[];for(const s of this.names()){const a=this.get(s);if(!a)continue;const u=this.scoreWidget(a,t);u>0&&r.push({name:s,registration:a,score:u})}if(r.length===0)return null;r.sort((s,a)=>a.score!==s.score?a.score-s.score:(a.registration.priority??0)-(s.registration.priority??0));const n=r[0];return{name:n.name,registration:n.registration}}scoreWidget(t,r){let n=0;if(t.matcher)if(t.matcher(r))n+=100;else return 0;const s=r.primaryType;s&&t.supportedTypes?.includes(s)&&(n+=50);const a=r.format;return a&&t.supportedFormats?.includes(a)&&(n+=30),n+=t.priority??0,n}createChild(){return new L(this)}}let E=null;function F(){return E||(E=new L),E}function rr(e){E=e}function nr(e){return new L(e)}function ir(e,t,r){return{name:`type:${e}`,registration:{factory:t,displayName:r?.displayName??`${e} widget`,description:r?.description,supportedTypes:[e],priority:r?.priority??0,canFallback:r?.canFallback??!1}}}function sr(e,t,r){return{name:`format:${e}`,registration:{factory:t,displayName:r?.displayName??`${e} widget`,description:r?.description,supportedFormats:[e],priority:r?.priority??10,canFallback:r?.canFallback??!1}}}function ar(e,t,r,n){return{name:`type:${e}:format:${t}`,registration:{factory:r,displayName:n?.displayName??`${e}/${t} widget`,description:n?.description,supportedTypes:[e],supportedFormats:[t],priority:n?.priority??20,canFallback:n?.canFallback??!1}}}function ur(e,t,r,n){return{name:e,registration:{factory:r,displayName:n?.displayName??e,description:n?.description,matcher:t,priority:n?.priority??50,canFallback:n?.canFallback??!1}}}function Ee(e,t){if(t){const n=t.findBestWidget(e);if(n)return n}return F().findBestWidget(e)}function or(e){const t=e.definition,r={};if(typeof t=="object"&&"x:ui"in t){const n=t["x:ui"];n.widget&&typeof n.widget=="object"&&(r.options=n.widget),typeof n.priority=="number"&&(r.priority=n.priority)}if(typeof t=="object"&&"widget"in t){const n=t.widget;typeof n=="object"&&n!==null&&(r.options={...r.options??{},...n})}return Object.keys(r).length>0?r:void 0}function ne(e){const t=e.definition;if(typeof t=="object"&&"x:ui"in t){const r=t["x:ui"];if(typeof r.widget=="string")return r.widget}if(typeof t=="object"&&"widget"in t){const r=t.widget;if(r&&typeof r.type=="string")return r.type}}function lr(e){return ne(e)!==void 0}function cr(e,t){const r=ne(e);if(r){if(t){const a=t.get(r);if(a)return{name:r,registration:a}}const s=F().get(r);if(s)return{name:r,registration:s};console.warn(`Widget "${r}" specified in definition but not found in registry`,{path:e.jsonPath})}return Ee(e,t)}function pr(e,t,r){return{...e,...t,...r}}function Ue(e=F()){e.register("string",{factory:({controller:i,ctx:o})=>xe({ctx:o,controller:i}),displayName:"String",description:"Text input for string values",supportedTypes:["string"],priority:0,canFallback:!0}),e.register("boolean",{factory:({controller:i,ctx:o})=>$e({ctx:o,controller:i}),displayName:"Boolean",description:"Checkbox for boolean values",supportedTypes:["boolean"],priority:0,canFallback:!0}),e.register("uuid",{factory:({controller:i,ctx:o})=>we({ctx:o,controller:i}),displayName:"UUID",description:"Input for UUID values",supportedTypes:["uuid"],priority:0,canFallback:!0}),e.register("uri",{factory:({controller:i,ctx:o})=>De({ctx:o,controller:i}),displayName:"URI",description:"Input for URI/URL values",supportedTypes:["uri"],priority:0,canFallback:!0}),e.register("binary",{factory:({controller:i,ctx:o})=>Oe({ctx:o,controller:i}),displayName:"Binary",description:"File upload for binary data",supportedTypes:["binary"],priority:0,canFallback:!0}),e.register("any",{factory:({controller:i,ctx:o})=>K({ctx:o,controller:i}),displayName:"Any",description:"Generic control for any type",supportedTypes:["any"],priority:0,canFallback:!0});const t=["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"],r=({controller:i,ctx:o})=>Ce({ctx:o,controller:i,intType:o.primaryType});for(const i of t)e.register(i,{factory:r,displayName:i.toUpperCase(),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const n=["float","double","decimal"],s=({controller:i,ctx:o})=>je({ctx:o,controller:i,floatType:o.primaryType});for(const i of n)e.register(i,{factory:s,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const a=["date","datetime","time","duration"],u=({controller:i,ctx:o})=>Se({ctx:o,controller:i,temporalType:o.primaryType});for(const i of a)e.register(i,{factory:u,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});e.register("object",{factory:({controller:i,ctx:o})=>Ae({ctx:o,controller:i}),displayName:"Object",description:"Form for object values",supportedTypes:["object"],priority:0,canFallback:!0}),e.register("array",{factory:({controller:i,ctx:o})=>Me({ctx:o,controller:i}),displayName:"Array",description:"List control for array values",supportedTypes:["array"],priority:0,canFallback:!0}),e.register("set",{factory:({controller:i,ctx:o})=>Re({ctx:o,controller:i}),displayName:"Set",description:"Set control for unique values",supportedTypes:["set"],priority:0,canFallback:!0}),e.register("map",{factory:({controller:i,ctx:o})=>Ne({ctx:o,controller:i}),displayName:"Map",description:"Map control for key-value pairs",supportedTypes:["map"],priority:0,canFallback:!0}),e.register("tuple",{factory:({controller:i,ctx:o})=>ke({ctx:o,controller:i}),displayName:"Tuple",description:"Tuple control for fixed-length arrays",supportedTypes:["tuple"],priority:0,canFallback:!0}),e.register("choice",{factory:({controller:i,ctx:o})=>qe({ctx:o,controller:i}),displayName:"Choice",description:"Choice control for union types",supportedTypes:["choice"],priority:0,canFallback:!0}),e.register("enum",{factory:({controller:i,ctx:o})=>Fe({ctx:o,controller:i}),displayName:"Enum",description:"Dropdown for enumerated values",priority:10,canFallback:!1,matcher:i=>i.hasEnum}),e.register("const",{factory:({controller:i,ctx:o})=>Pe({ctx:o,controller:i}),displayName:"Const",description:"Display for constant values",priority:20,canFallback:!1,matcher:i=>i.hasConst})}function We(e=F()){return e.has("string")&&e.has("object")&&e.has("array")}function dr(e=F()){We(e)||Ue(e)}function Be(e){let t=e;if(e.$root){const r=R(e.$root,e);r&&(t=r)}return w(t,e,new Set)}function w(e,t,r){if(e.type&&D(e.type)){const n=e.type.$ref;if(r.has(n))return;r.add(n);const s=R(n,t);if(s){const a={...s,...e,type:s.type},u=w(a,t,r);return r.delete(n),u}r.delete(n);return}return e.default!==void 0?e.default:Array.isArray(e.examples)&&e.examples.length>0?e.examples[0]:"const"in e&&e.const!==void 0?e.const:"enum"in e&&Array.isArray(e.enum)&&e.enum.length>0?e.enum[0]:Cr(e)?null:fr(e,t,r)}function fr(e,t,r){const n=_e(e);if(M(e))return yr(e,t,r);if(n==="choice"&&"choices"in e)return gr(e,t,r);if(n==="tuple"&&"tuple"in e&&"properties"in e)return hr(e,t,r);if(n==="array")return br(e,t,r);if(n==="set")return vr(e,t,r);if(n==="map")return{};if(n==="string")return xr(e);if(jr(n))return $r(e);if(wr(n))return Tr(e);if(n==="boolean")return!1;if(n==="null")return null;if(Sr(n))return Ir(n);if(n==="uuid"||n==="uri"||n==="uri-reference"||n==="binary"||n==="bytes")return""}function mr(e){if(!e||e.length===0)return new Set;if(Array.isArray(e[0])){const t=e.flat();return new Set(t)}return new Set(e)}function yr(e,t,r){if(!M(e))return{};const n=mr(e.required),s={};for(const[a,u]of Object.entries(e.properties))if(n.has(a))if(u.type&&D(u.type)){const i=u.type.$ref;if(r.has(i))continue;r.add(i);const o=R(i,t);if(o){const c={...o,...u,type:o.type},p=w(c,t,r);p!==void 0&&(s[a]=p)}r.delete(i)}else{const i=w(u,t,r);i!==void 0&&(s[a]=i)}return s}function gr(e,t,r){if(!("choices"in e))return;const n=e.choices,s=Object.keys(n);if(s.length===0)return;const a=s[0],u=n[a];if("selector"in e&&e.selector){const o=e.selector,c=w(u,t,r);return typeof c=="object"&&c!==null?{[o]:a,...c}:{[o]:a}}const i=w(u,t,r);return{[a]:i}}function hr(e,t,r){if(!("tuple"in e)||!("properties"in e))return{};const n=e.tuple,s=e.properties,a=new Set(e.required??n),u={};for(const i of n){if(!a.has(i))continue;const o=s[i];if(o){const c=w(o,t,r);c!==void 0&&(u[i]=c)}}return u}function br(e,t,r){const n=("minItems"in e?e.minItems:0)??0;if(n===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(n).fill(null);const a=w(s,t,r);return Array(n).fill(a??null)}function vr(e,t,r){const n=("minItems"in e?e.minItems:0)??0;if(n===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(n).fill(null);const a=w(s,t,r);return Array(n).fill(a??null)}function xr(e){switch("format"in e?e.format:void 0){case"date":return ze();case"date-time":return Ge();case"time":return"00:00:00";case"email":case"uri":case"uri-reference":case"uuid":default:return""}}function $r(e){const t=_e(e),r=t==="int64"||t==="uint64"||t==="int128"||t==="uint128";let n="minimum"in e?e.minimum:void 0,s="maximum"in e?e.maximum:void 0;const a="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,u="exclusiveMaximum"in e?e.exclusiveMaximum:void 0;a!==void 0&&(n=a+1),u!==void 0&&(s=u-1);let i;n!==void 0&&s!==void 0?i=Math.round((n+s)/2):n!==void 0?i=n:s!==void 0?i=0<=s?0:s:i=0;const o="multipleOf"in e?e.multipleOf:void 0;return o!==void 0&&o>0&&(i=Math.round(i/o)*o,n!==void 0&&i<n&&(i=Math.ceil(n/o)*o),s!==void 0&&i>s&&(i=Math.floor(s/o)*o)),r?BigInt(Math.round(i)):Math.round(i)}function Tr(e){let t="minimum"in e?e.minimum:void 0,r="maximum"in e?e.maximum:void 0;const n="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,s="exclusiveMaximum"in e?e.exclusiveMaximum:void 0,a="multipleOf"in e?e.multipleOf:.001;n!==void 0&&(t=n+a),s!==void 0&&(r=s-a);let u;t!==void 0&&r!==void 0?u=(t+r)/2:t!==void 0?u=t:r!==void 0?u=0<=r?0:r:u=0;const i="multipleOf"in e?e.multipleOf:void 0;return i!==void 0&&i>0&&(u=Math.round(u/i)*i,t!==void 0&&u<t&&(u=Math.ceil(t/i)*i),r!==void 0&&u>r&&(u=Math.floor(r/i)*i)),u}function Ir(e){switch(e){case"date":return ze();case"time":return"00:00:00";case"datetime":return Ge();case"duration":return"PT0S";default:return""}}function Cr(e){return Array.isArray(e.type)?e.type.some(t=>typeof t=="string"?t==="null":!1):!1}function _e(e){const t=e.type;if(typeof t=="string")return t;if(Array.isArray(t)){for(const r of t)if(typeof r=="string"&&r!=="null")return r}}function jr(e){return e?["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"].includes(e):!1}function wr(e){return e?["float","double","decimal"].includes(e):!1}function Sr(e){return e?["date","time","datetime","duration"].includes(e):!1}function ze(){return new Date().toISOString().split("T")[0]}function Ge(){return new Date().toISOString()}function Dr(e){if(e.isValid)return d.a.valid;const t=re(e.errors),r=new Map;for(const u of t){const i=r.get(u.path)||[];i.push(u),r.set(u.path,i)}const n=(u,i)=>{if(u.length===0)return{message:i.map(y=>y.message).join("; ")};const[o,...c]=u,p=n(c,i);return{dependencies:{[o]:p}}},s={},a={};for(const[u,i]of r.entries())if(u===""||u==="/")s.message=i.map(o=>o.message).join("; ");else{const o=u.split("/").filter(c=>c!=="");if(o.length===1)a[o[0]]={message:i.map(c=>c.message).join("; ")};else{const[c,...p]=o;a[c]=n(p,i)}}return Object.keys(a).length>0&&(s.dependencies=a),d.a.invalid(s)}function Or({schema:e,initialValue:t,validationMode:r,validateDebounceMs:n,widgetRegistry:s,readOnly:a,locale:u,onChange:i,onValidate:o,applySchemaDefaults:c=!0},p){const y=t!==void 0?l.Value.get(t):void 0,b=Be(e);let m;t===void 0?m=b??{}:c?m=h.deepMergeDefaults(b,y):m=y;const g=te(e),f=r??"onTouched",v=k=>{const x=g.validate(k);if(o&&!x.isValid){const A=re(x.errors);o(A)}return Dr(x)},{controller:$,setStatus:j}=d.useController({initialValue:m,validationMode:f,validateDebounceMs:n,validate:f==="onSubmit"?void 0:v,onChange:i}),N=()=>{$.dispose()},O=l.Fragment(l.OnDispose(N),Ve({schema:e,controller:$,widgetRegistry:s,readOnly:a,locale:u}));return p({Form:O,controller:$,setStatus:j})}exports.DefaultWidgetRegistry=L;exports.INTEGER_BOUNDS=V;exports.JSONStructureForm=Or;exports.RefResolver=be;exports.StructureContext=z;exports.StructureControl=Ve;exports.StructureGenericControl=T;exports.createExtendsResolver=tt;exports.createRefResolver=_;exports.createStructureContext=ve;exports.createValidator=te;exports.createWidgetRegistry=nr;exports.ensureDefaultWidgets=dr;exports.extractStructureDefaults=Be;exports.forFormat=sr;exports.forMatcher=ur;exports.forType=ir;exports.forTypeAndFormat=ar;exports.formatValidationError=Le;exports.formatValidationErrors=re;exports.getChildErrors=tr;exports.getErrorsForPath=Qt;exports.getExplicitWidgetName=ne;exports.getGlobalWidgetRegistry=F;exports.getNonNullTypes=B;exports.getResolvedType=J;exports.getWidgetOptions=or;exports.groupErrorsByPath=Yt;exports.hasConstValue=ye;exports.hasCustomWidget=lr;exports.hasDefaultWidgets=We;exports.hasEnumValue=me;exports.hasErrorsAtPath=er;exports.isArrayTypeDefinition=Z;exports.isBigIntType=le;exports.isChoiceTypeDefinition=Q;exports.isCompoundType=Ze;exports.isFloatType=U;exports.isIntegerType=q;exports.isMapTypeDefinition=X;exports.isNamespace=de;exports.isNullableType=ge;exports.isNumericType=ce;exports.isObjectTypeDefinition=M;exports.isPrimitiveType=pe;exports.isSetTypeDefinition=H;exports.isTemporalType=W;exports.isTupleTypeDefinition=Y;exports.isTypeDefinition=fe;exports.isTypeReference=D;exports.mergeWidgetOptions=pr;exports.parseRefPath=he;exports.registerDefaultWidgets=Ue;exports.resolveExtends=ee;exports.resolveRef=R;exports.resolveTypeReference=Xe;exports.resolveWidget=Ee;exports.resolveWidgetWithOverride=cr;exports.setGlobalWidgetRegistry=rr;exports.validate=_t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../deep-merge-BoJqJNah.cjs"),l=require("@tempots/dom"),d=require("../use-form-C5eF9ALX.cjs"),P=require("../translations-eUtMHN9s.cjs"),C=require("../duration-input-COTlyMwv.cjs"),Ke=require("../colors-B2yrgHSW.cjs");function le(e){return e==="int64"||e==="int128"||e==="uint64"||e==="uint128"}function q(e){return e==="int8"||e==="int16"||e==="int32"||e==="int64"||e==="int128"||e==="uint8"||e==="uint16"||e==="uint32"||e==="uint64"||e==="uint128"}function U(e){return e==="float"||e==="double"||e==="decimal"}function ce(e){return q(e)||U(e)}function W(e){return e==="date"||e==="datetime"||e==="time"||e==="duration"}function pe(e){return e==="string"||e==="boolean"||e==="null"||ce(e)||W(e)||e==="uuid"||e==="uri"||e==="binary"}function Ze(e){return e==="object"||e==="array"||e==="set"||e==="map"||e==="tuple"||e==="choice"||e==="any"}function D(e){return typeof e=="object"&&e!==null&&"$ref"in e}function de(e){return typeof e=="object"&&e!==null&&!("type"in e)&&!("$ref"in e)&&!("enum"in e)&&!("const"in e)}function fe(e){return typeof e=="object"&&e!==null&&("type"in e||"$ref"in e||"enum"in e||"const"in e)}function M(e){return e.type==="object"&&"properties"in e}function Z(e){return e.type==="array"&&"items"in e}function H(e){return e.type==="set"&&"items"in e}function X(e){return e.type==="map"&&"values"in e}function Y(e){return e.type==="tuple"&&"tuple"in e}function Q(e){return e.type==="choice"&&"choices"in e}function me(e){return"enum"in e&&Array.isArray(e.enum)}function ye(e){return"const"in e}function J(e){return e===void 0?null:typeof e=="string"||Array.isArray(e)?e:(D(e),null)}function ge(e){return e===void 0?!1:e==="null"?!0:Array.isArray(e)?e.includes("null"):!1}function B(e){return typeof e=="string"?e==="null"?[]:[e]:Array.isArray(e)?e.filter(t=>t!=="null"):[]}const V={int8:{min:-128n,max:127n},int16:{min:-32768n,max:32767n},int32:{min:-2147483648n,max:2147483647n},int64:{min:-9223372036854775808n,max:9223372036854775807n},int128:{min:-170141183460469231731687303715884105728n,max:170141183460469231731687303715884105727n},uint8:{min:0n,max:255n},uint16:{min:0n,max:65535n},uint32:{min:0n,max:4294967295n},uint64:{min:0n,max:18446744073709551615n},uint128:{min:0n,max:340282366920938463463374607431768211455n}};function he(e){return e.startsWith("#/")?e.slice(2).split("/"):e.includes("/")?e.split("/"):["definitions",e]}function He(e,t){let r=e;for(const n of t){if(r==null||typeof r!="object")return;r=r[n]}return r}function R(e,t){const r=he(e),n=He(t,r);if(n==null){console.warn(`Failed to resolve $ref: ${e}`);return}if(fe(n))return n;if(de(n)){console.warn(`$ref "${e}" points to a namespace, not a type definition`);return}}function Xe(e,t){return R(e.$ref,t)}class be{schema;visited=new Set;constructor(t){this.schema=t}resolve(t){if(this.visited.has(t)){console.warn(`Circular reference detected: ${t}`);return}this.visited.add(t);try{const r=R(t,this.schema);if(r?.type&&D(r.type)){const n=this.resolve(r.type.$ref);if(n){const{type:s,...a}=r;return{...n,...a}}}return r}finally{this.visited.delete(t)}}resolveDefinition(t){if(t.type&&D(t.type)){const r=this.resolve(t.type.$ref);if(r){const{type:n,...s}=t;return{...r,...s}}}return t}reset(){this.visited.clear()}}function _(e){return new be(e)}class z{schema;definition;path;readOnly;locale;widgetRegistry;isPropertyRequired;suppressLabel;refResolver;constructor(t){this.schema=t.schema,this.definition=t.definition,this.path=t.path,this.readOnly=t.readOnly??!1,this.locale=t.locale,this.widgetRegistry=t.widgetRegistry,this.isPropertyRequired=t.isPropertyRequired??!1,this.suppressLabel=t.suppressLabel??!1,this.refResolver=t.refResolver??_(t.schema)}with(t){return new z({schema:this.schema,definition:t.definition??this.definition,path:t.path??this.path,readOnly:t.readOnly??this.readOnly,locale:t.locale??this.locale,widgetRegistry:t.widgetRegistry??this.widgetRegistry,isPropertyRequired:t.isPropertyRequired??this.isPropertyRequired,suppressLabel:t.suppressLabel??this.suppressLabel,refResolver:this.refResolver})}append(t){return this.with({path:[...this.path,t]})}get isRoot(){return this.path.length===0}get name(){const t=this.path[this.path.length-1];return typeof t=="string"?t:void 0}get widgetName(){return this.path.map(String).join(".")}get resolvedType(){const t=this.definition.type;if(!t)return null;if(D(t)){const r=this.refResolver.resolve(t.$ref);return r?.type?J(r.type):null}return J(t)}get primaryType(){const t=this.resolvedType;return t?typeof t=="string"?t==="null"?null:t:B(t)[0]??null:null}get isNullable(){return ge(this.definition.type)}get isRequired(){return this.isPropertyRequired}get isOptional(){return!this.isPropertyRequired}get isDeprecated(){return this.definition.deprecated===!0}get isAbstract(){return this.definition.abstract===!0}get isPrimitive(){const t=this.primaryType;return t!=null&&pe(t)}get description(){return this.definition.description}get examples(){return this.definition.examples}get defaultValue(){return this.definition.default}get unit(){return this.definition.unit}get currency(){return this.definition.currency}get label(){if(this.locale&&this.definition.altnames){const r=`lang:${this.locale}`,n=this.definition.altnames[r];if(n)return n}if(this.definition.name)return this.definition.name;const t=this.name;return t?h._t(h.gt(t)):""}get altnames(){return this.definition.altnames}get jsonPath(){return this.path.length===0?"":"/"+this.path.map(String).join("/")}resolveRef(t){return this.refResolver.resolve(t)}get hasEnum(){return"enum"in this.definition&&Array.isArray(this.definition.enum)}get enumValues(){if("enum"in this.definition)return this.definition.enum}get hasConst(){return"const"in this.definition}get constValue(){if("const"in this.definition)return this.definition.const}get format(){if("format"in this.definition)return this.definition.format}}function ve(e,t){let r;const n=_(e);if(e.$root){const s=n.resolve(e.$root);s?r=s:(console.warn(`Failed to resolve $root: ${e.$root}`),r=e)}else e.type||e.properties?r=e:r={type:"any"};return new z({schema:e,definition:r,path:[],readOnly:t?.readOnly,locale:t?.locale,widgetRegistry:t?.widgetRegistry,refResolver:n})}function ee(e,t,r){const n=[],s=[];if(!e.$extends)return{merged:e,inheritanceChain:n,errors:s};const a=Array.isArray(e.$extends)?e.$extends:[e.$extends],u=new Set,i=(p,y=0)=>{if(y>100)return s.push({path:p.join(" -> "),message:"Maximum inheritance depth exceeded"}),[];const b=[];for(const m of p){if(u.has(m)){s.push({path:m,message:`Circular inheritance detected: ${m}`});continue}u.add(m),n.push(m);const g=R(m,t);if(!g){s.push({path:m,message:`Failed to resolve base type: ${m}`});continue}if(g.$extends){const f=Array.isArray(g.$extends)?g.$extends:[g.$extends],v=i(f,y+1);b.push(...v)}b.push(g),u.delete(m)}return b},o=i(a);return{merged:Ye(o,e),inheritanceChain:n,errors:s}}function Ye(e,t){if(e.length===0)return t;let r={...e[0]};for(let a=1;a<e.length;a++)r=ie(r,e[a]);r=ie(r,t);const{$extends:n,...s}=r;return s}function ie(e,t){return M(e)&&M(t)?Qe(e,t):{...e,...t}}function Qe(e,t){const r={...e.properties??{},...t.properties??{}},n=se(e.required),s=se(t.required),a=et([...n,...s]),u={...e,...t,type:"object",properties:r};return a.length>0&&(u.required=a),u}function se(e){return e?e.length===0?[]:Array.isArray(e[0])?e.flat():e:[]}function et(e){return[...new Set(e)]}function tt(e){const t=_(e);return{resolve:r=>(t.reset(),ee(r,e))}}function rt(){return l.html.span(l.attr.class("bc-json-structure-deprecated-badge"),l.attr.style("font-size: var(--font-size-xs); color: var(--color-warning-500, #d97706); background: var(--color-warning-100, #fef3c7); padding: 0.125em 0.5em; border-radius: var(--radius-sm); margin-inline-start: 0.5em; font-weight: normal;"),"(deprecated)")}function I(e,t){return!e||!t?e??"":l.html.span(e,rt())}function nt(e){const t=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:t}}function xe({ctx:e,controller:t}){const r=nt(e);return d.Control(P.TextInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function it(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function $e({ctx:e,controller:t}){const r=it(e),n=d.Control(d.CheckboxInput,{...r,controller:t});return e.isNullable?d.Control(d.CheckboxInput,{...r,controller:t,after:h.NullableResetAfter(t.signal,t.disabled,s=>t.change(s))}):n}function st(e,t){const r=V[t],n=Te(e,r.min),s=Ie(e,r.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof n=="bigint"?Number(n):n,max:typeof s=="bigint"?Number(s):s,step:1,placeholder:a}}function at(e,t){const r=V[t],n=Te(e,r.min),s=Ie(e,r.max),a=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:typeof n=="number"?BigInt(n):n,max:typeof s=="number"?BigInt(s):s,placeholder:a}}function Te(e,t){const r=e.definition;if(r.minimum!==void 0){const n=typeof r.minimum=="string"?BigInt(r.minimum):r.minimum;return typeof n=="bigint"?n>t?n:t:BigInt(n)>t?n:Number(t)}if(r.exclusiveMinimum!==void 0){const n=typeof r.exclusiveMinimum=="string"?BigInt(r.exclusiveMinimum):r.exclusiveMinimum,s=typeof n=="bigint"?n+1n:n+1;return typeof s=="bigint"?s>t?s:t:BigInt(s)>t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function Ie(e,t){const r=e.definition;if(r.maximum!==void 0){const n=typeof r.maximum=="string"?BigInt(r.maximum):r.maximum;return typeof n=="bigint"?n<t?n:t:BigInt(n)<t?n:Number(t)}if(r.exclusiveMaximum!==void 0){const n=typeof r.exclusiveMaximum=="string"?BigInt(r.exclusiveMaximum):r.exclusiveMaximum,s=typeof n=="bigint"?n-1n:n-1;return typeof s=="bigint"?s<t?s:t:BigInt(s)<t?s:Number(t)}return t>=BigInt(Number.MIN_SAFE_INTEGER)&&t<=BigInt(Number.MAX_SAFE_INTEGER)?Number(t):t}function Ce({ctx:e,controller:t,intType:r}){if(le(r)){const s=at(e,r);return e.isNullable?d.Control(C.NullableBigintInput,{...s,controller:t}):d.Control(C.BigintInput,{...s,controller:t})}const n=st(e,r);return e.isNullable?d.Control(h.NullableNumberInput,{...n,controller:t}):d.Control(h.NumberInput,{...n,controller:t})}function ut(e,t){const r=e.definition;let n;r.multipleOf!==void 0?n=r.multipleOf:t==="decimal"&&r.scale!==void 0?n=Math.pow(10,-r.scale):n=void 0;const s=r.minimum!==void 0?typeof r.minimum=="string"?parseFloat(r.minimum):r.minimum:void 0,a=r.maximum!==void 0?typeof r.maximum=="string"?parseFloat(r.maximum):r.maximum:void 0,u=r.exclusiveMinimum!==void 0?typeof r.exclusiveMinimum=="string"?parseFloat(r.exclusiveMinimum):r.exclusiveMinimum:void 0,i=r.exclusiveMaximum!==void 0?typeof r.exclusiveMaximum=="string"?parseFloat(r.exclusiveMaximum):r.exclusiveMaximum:void 0;let o=e.description;if(u!==void 0||i!==void 0){const p=[];u!==void 0&&p.push(`> ${u}`),i!==void 0&&p.push(`< ${i}`);const y=`Valid range: ${p.join(" and ")}`;o=o?`${o} (${y})`:y}const c=e.examples?.[0]!=null?String(e.examples[0]):void 0;return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:o,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,min:s??u,max:a??i,step:n,placeholder:c}}function je({ctx:e,controller:t,floatType:r}){const n=ut(e,r);return e.isNullable?d.Control(h.NullableNumberInput,{...n,controller:t}):d.Control(h.NumberInput,{...n,controller:t})}function ot(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}}function we({ctx:e,controller:t}){const r=ot(e);return d.Control(h.UUIDInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function lt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Se({ctx:e,controller:t,temporalType:r}){const n=lt(e);switch(r){case"date":return e.isNullable?d.Control(C.NullablePlainDateInput,{...n,controller:t}):d.Control(C.PlainDateInput,{...n,controller:t});case"datetime":return e.isNullable?d.Control(C.NullablePlainDateTimeInput,{...n,controller:t}):d.Control(C.PlainDateTimeInput,{...n,controller:t});case"time":return e.isNullable?d.Control(C.NullablePlainTimeInput,{...n,controller:t}):d.Control(C.PlainTimeInput,{...n,controller:t});case"duration":return e.isNullable?d.Control(h.NullableDurationInput,{...n,controller:t}):d.Control(C.DurationInput,{...n,controller:t});default:return console.warn(`Unknown temporal type: ${r}`),l.Fragment()}}function ct(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"https://example.com"}}function De({ctx:e,controller:t}){const r=ct(e);return d.Control(h.UrlInput,{...r,controller:h.transformEmptyStringToUndefined(t)})}function pt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Oe({ctx:e,controller:t}){const r=pt(e);return d.Control(C.FileInput,{...r,controller:t})}function dt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated,placeholder:"Enter JSON value"}}function ft(e){return e.transform(t=>t===void 0?void 0:JSON.stringify(t,null,2),t=>{if(!(t===void 0||t.trim()===""))try{return JSON.parse(t)}catch{return t}})}function K({ctx:e,controller:t}){const r=dt(e);return d.Control(h.TextArea,{...r,controller:ft(t)})}function mt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function yt(e,t){return!t||t.length===0?!1:typeof t[0]=="string"?t.includes(e):Array.isArray(t[0])?t.some(r=>r.includes(e)):!1}function gt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function ht(e,t="property"){if(!e.has(t))return t;let r=1;for(;e.has(`${t}${r}`);)r++;return`${t}${r}`}function Ae({ctx:e,controller:t}){const r=e.definition;return r.type!=="object"||!("properties"in r)?(console.warn("StructureObjectControl requires an ObjectTypeDefinition"),l.html.div("Invalid object definition")):l.MapSignal(t.signal,n=>{const s=r.properties,a=r.required,u=r.additionalProperties,i=u!==!1,o=typeof u=="object"&&u!==null?u:{type:"any"},c=r.minProperties??0,p=r.maxProperties??1/0,y=Ke.l(s),b=new Set(y.map(([x])=>x)),m=Object.keys(n??{}),g=m.filter(x=>!b.has(x)),f=i&&m.length<p&&!e.readOnly,v=m.length>c&&!e.readOnly,$=y.map(([x,A])=>{const S=x,G=t.field(S),Je=yt(S,a);return T({ctx:e.with({definition:A,isPropertyRequired:Je,suppressLabel:!1}).append(S),controller:G})}),j=g.map(x=>{const A=t.field(x);return l.html.div(l.attr.class("bc-json-structure-additional-property"),l.html.div(l.attr.class("bc-json-structure-additional-property-header"),l.html.strong(`${x}:`),P.Button({variant:"text",size:"xs",onClick:()=>{const S={...l.Value.get(t.signal)??{}};delete S[x],t.change(S)},disabled:!v},"Remove")),l.html.div(l.attr.class("bc-json-structure-additional-property-value"),T({ctx:e.with({definition:o,isPropertyRequired:!1,suppressLabel:!0}).append(x),controller:A})))}),N=f?P.Button({variant:"outline",size:"sm",onClick:()=>{const x=l.Value.get(t.signal)??{},A=new Set(Object.keys(x)),S=ht(A),G=gt(o);t.change({...x,[S]:G})}},"Add Property"):null,O=l.html.div(l.attr.class("bc-json-structure-object-fields"),...$,...j,N),k=l.html.div(l.attr.class("bc-json-structure-object"),O);return!e.suppressLabel&&e.name?d.InputWrapper({...mt(e),content:k}):k})}function bt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function vt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Me({ctx:e,controller:t}){const r=e.definition;if(r.type!=="array"||!("items"in r))return console.warn("StructureArrayControl requires an ArrayTypeDefinition"),l.html.div("Invalid array definition");const n=r.items,s=r.minItems??0,a=r.maxItems??1/0,u=l.computedOf(t.signal)(o=>(o?.length??0)<a),i=l.computedOf(t.signal)(o=>(o?.length??0)>s);return h.ListControl({...bt(e),controller:t,createItem:()=>vt(n),showAdd:!0,addDisabled:l.computedOf(u)(o=>!o||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(o=>!o||e.readOnly),element:o=>{const c=o.position.index,p=o.item;return T({ctx:e.with({definition:n,suppressLabel:!0}).append(c),controller:p})}})}function xt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function $t(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Re({ctx:e,controller:t}){const r=e.definition;if(r.type!=="set"||!("items"in r))return console.warn("StructureSetControl requires a SetTypeDefinition"),l.html.div("Invalid set definition");const n=r.items,s=r.minItems??0,a=r.maxItems??1/0,u=l.computedOf(t.signal)(c=>(c?.length??0)<a),i=l.computedOf(t.signal)(c=>(c?.length??0)>s),o=l.computedOf(t.signal)(c=>{if(!c||c.length===0)return new Set;const p=new Map,y=new Set;for(let b=0;b<c.length;b++){const m=JSON.stringify(c[b]);p.has(m)?(y.add(p.get(m)),y.add(b)):p.set(m,b)}return y});return h.ListControl({...xt(e),controller:t,createItem:()=>$t(n),showAdd:!0,addDisabled:l.computedOf(u)(c=>!c||e.readOnly),showRemove:!0,removeDisabled:l.computedOf(i)(c=>!c||e.readOnly),element:c=>{const p=c.position.index,y=c.item,b=o.map(g=>g.has(p)),m=T({ctx:e.with({definition:n,suppressLabel:!0}).append(p),controller:y});return b.map(g=>g?d.Stack(l.attr.class("bc-stack--gap-1"),m,d.Label(l.attr.class("bc-json-structure-set-error"),"⚠️ Duplicate value - sets must contain unique items")):m)}})}function Tt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function It(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function Ct(e,t="key"){if(!e.has(t))return t;let r=1;for(;e.has(`${t}${r}`);)r++;return`${t}${r}`}function Ne({ctx:e,controller:t}){const r=e.definition;if(r.type!=="map"||!("values"in r))return console.warn("StructureMapControl requires a MapTypeDefinition"),l.html.div("Invalid map definition");const n=r.values,s=r.minProperties??0,a=r.maxProperties??1/0;return l.MapSignal(t.signal,u=>{const i=Object.keys(u??{}),o=i.length,c=o<a&&!e.readOnly,p=o>s&&!e.readOnly,y=i.map(f=>{const v=t.field(f);return l.html.div(l.attr.class("bc-json-structure-map-entry"),l.html.div(l.attr.class("bc-json-structure-map-entry-header"),l.html.strong(l.attr.class("bc-json-structure-map-entry-key"),`${f}:`),P.Button({variant:"text",size:"xs",onClick:()=>{const $={...l.Value.get(t.signal)??{}};delete $[f],t.change($)},disabled:!p},"Remove")),l.html.div(l.attr.class("bc-json-structure-map-entry-value"),T({ctx:e.with({definition:n,suppressLabel:!0}).append(f),controller:v})))}),b=c?P.Button({variant:"outline",size:"sm",onClick:()=>{const f=l.Value.get(t.signal)??{},v=new Set(Object.keys(f)),$=Ct(v),j=It(n);t.change({...f,[$]:j})}},"Add Entry"):null,m=l.html.div(l.attr.class("bc-json-structure-map-entries"),...y,b),g=l.html.div(l.attr.class("bc-json-structure-map"),m);return!e.suppressLabel&&e.name?d.InputWrapper({...Tt(e),content:g}):g})}function jt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired}}function wt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];if(!e.type)return;const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(typeof t=="object"&&"$ref"in t))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};case"any":return;default:return t==="int8"||t==="int16"||t==="int32"||t==="int64"||t==="int128"||t==="uint8"||t==="uint16"||t==="uint32"||t==="uint64"||t==="uint128"||t==="float"||t==="double"||t==="decimal"?0:void 0}}function ke({ctx:e,controller:t}){const r=e.definition;if(r.type!=="tuple"||!("tuple"in r)||!("properties"in r))return console.warn("StructureTupleControl requires a TupleTypeDefinition"),l.html.div("Invalid tuple definition");const n=r.tuple,s=r.properties,a=t.signal.value;if(!Array.isArray(a)||a.length!==n.length){const i=n.map(o=>{const c=s[o];return c?wt(c):void 0});t.change(i)}const u=jt(e);return l.html.div(l.attr.class("bc-json-structure-tuple"),u.label&&l.html.label(l.attr.class("bc-json-structure-tuple-label"),u.label,u.required&&l.html.span(l.attr.class("bc-required-indicator"),"*")),u.description&&l.html.div(l.attr.class("bc-json-structure-tuple-description"),u.description),l.html.div(l.attr.class("bc-json-structure-tuple-elements"),...n.map((i,o)=>{const c=s[i];if(!c)return console.warn(`Tuple element "${i}" at index ${o} not found in properties`),l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.span(`Missing definition for "${i}"`));const p=t.item(o),y=c.name||i;return l.html.div(l.attr.class("bc-json-structure-tuple-element"),l.html.div(l.attr.class("bc-json-structure-tuple-element-header"),l.html.span(l.attr.class("bc-json-structure-tuple-position"),`[${o}]`),l.html.span(l.attr.class("bc-json-structure-tuple-element-name"),y)),l.html.div(l.attr.class("bc-json-structure-tuple-element-control"),T({ctx:e.with({definition:c,suppressLabel:!0}).append(o),controller:p})))})))}function St({options:e,selected:t,onChange:r,disabled:n}){return h.NativeSelect({options:e.map(s=>({type:"value",value:s.value,label:s.label})),value:t,onChange:r,disabled:n})}function Dt({ctx:e,selector:t,inner:r}){const n=d.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),t,r);return e.isRoot?n:d.InputWrapper({label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,content:n})}function Ot(e,t,r){if(!e||typeof e!="object")return null;const n=e;if(r&&r in n){const a=n[r];if(typeof a=="string"&&a in t)return a}const s=Object.keys(n);if(s.length===1){const a=s[0];if(a in t)return a}return null}function At(e,t,r){if(!e||typeof e!="object")return;const n=e;if(r&&r in n){const{[r]:s,...a}=n;return a}if(t in n)return n[t]}function ae(e,t,r){return r?e&&typeof e=="object"?{[r]:t,...e}:{[r]:t}:{[t]:e}}function Mt(e){if(e.default!==void 0)return e.default;if(e.examples&&e.examples.length>0)return e.examples[0];const t=Array.isArray(e.type)?e.type[0]:e.type;if(!(!t||typeof t=="object"))switch(t){case"string":return"";case"boolean":return!1;case"null":return null;case"object":return{};case"array":case"set":return[];case"map":return{};default:return}}function qe({ctx:e,controller:t}){const r=e.definition;if(!r.choices||typeof r.choices!="object")return console.warn("StructureChoiceControl requires choices property"),l.html.div(l.attr.class("bc-json-structure-error"),"Invalid choice definition: missing choices");const n=r.choices,s=r.selector,a=Object.keys(n);if(a.length===0)return l.html.div(l.attr.class("bc-json-structure-error"),"Choice type has no variants defined");const u=a.map(f=>{const $=n[f].name||f;return{value:f,label:$}}),i=l.computedOf(t.signal)(f=>Ot(f,n,s)),o=l.Value.get(i)||a[0],c=l.prop(o);t.onDispose(c.dispose);let p=!1;const y=i.on(f=>{!p&&f!==null&&c.set(f)});t.onDispose(y);const m=St({options:u,selected:c,onChange:f=>{p=!0,c.set(f);const v=n[f];if(v){const $=Mt(v),j=ae($,f,s);t.change(j)}},disabled:e.readOnly||e.isDeprecated}),g=l.MapSignal(c,f=>{const v=n[l.Value.get(f)];if(!v)return l.html.div(l.attr.class("bc-json-structure-error"),`Choice variant not found: ${l.Value.get(f)}`);const $=l.computedOf(t.signal)(O=>At(O,l.Value.get(f),s)),j=O=>{const k=ae(O,l.Value.get(f),s);t.change(k)},N=new d.Controller([...t.path,l.Value.get(f)],j,$,t.status,{disabled:t.disabled},void 0);return t.onDispose(()=>N.dispose()),T({ctx:e.with({definition:v,suppressLabel:!0}).append(l.Value.get(f)),controller:N})});return Dt({ctx:e,selector:m,inner:g})}function Rt(e){return{label:e.suppressLabel?void 0:I(e.label,e.isDeprecated),description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function Fe({ctx:e,controller:t}){const r=Rt(e);return h.NativeSelectControl({...r,options:(e.enumValues??[]).map(n=>({type:"value",value:n,label:String(n)})),controller:t})}function Pe({ctx:e,controller:t}){return l.Fragment(l.WithElement(()=>{l.Value.get(t.signal)!==e.constValue&&t.change(e.constValue)}),h.Group(d.MutedLabel(e.label,": "),d.Label(String(e.constValue))))}function Nt(e){return{label:e.suppressLabel?void 0:e.label,description:e.description,required:e.isRequired,disabled:e.readOnly||e.isDeprecated}}function kt(e,t){if(e===null)return t.includes("null")?"null":null;if(e===void 0)return t.includes("string")?"string":t[0]??null;switch(typeof e){case"string":return t.includes("uuid")?"uuid":t.includes("uri")?"uri":t.includes("date")?"date":t.includes("datetime")?"datetime":t.includes("time")?"time":t.includes("duration")?"duration":t.includes("string")?"string":null;case"number":{if(Number.isInteger(e)){if(t.includes("int32"))return"int32";if(t.includes("int64"))return"int64";if(t.includes("uint32"))return"uint32";if(t.includes("uint64"))return"uint64";if(t.includes("int16"))return"int16";if(t.includes("int8"))return"int8";if(t.includes("uint16"))return"uint16";if(t.includes("uint8"))return"uint8"}return t.includes("double")?"double":t.includes("float")?"float":t.includes("decimal")?"decimal":null}case"bigint":return t.includes("int128")?"int128":t.includes("int64")?"int64":t.includes("uint128")?"uint128":t.includes("uint64")?"uint64":null;case"boolean":return t.includes("boolean")?"boolean":null;case"object":return e instanceof File||e instanceof Blob?t.includes("binary")?"binary":null:Array.isArray(e)?t.includes("array")?"array":t.includes("set")?"set":t.includes("tuple")?"tuple":null:t.includes("object")?"object":t.includes("map")?"map":null;default:return null}}function qt(e,t){try{switch(t){case"string":case"uuid":case"uri":case"date":case"datetime":case"time":case"duration":return e==null?{ok:!0,value:void 0}:{ok:!0,value:String(e)};case"int8":case"int16":case"int32":case"uint8":case"uint16":case"uint32":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"int64":case"int128":case"uint64":case"uint128":{if(typeof e=="bigint")return{ok:!0,value:e};if(typeof e=="number"&&Number.isInteger(e))return{ok:!0,value:BigInt(e)};if(typeof e=="string")try{return{ok:!0,value:BigInt(e.trim())}}catch{return{ok:!1}}return{ok:!1}}case"float":case"double":case"decimal":{if(typeof e=="number")return{ok:!0,value:e};if(typeof e=="string"){const r=Number(e);return Number.isFinite(r)?{ok:!0,value:r}:{ok:!1}}return 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 r=e.trim().toLowerCase();return r==="true"||r==="1"||r==="yes"?{ok:!0,value:!0}:r==="false"||r==="0"||r==="no"?{ok:!0,value:!1}:{ok:!1}}return typeof e=="number"?{ok:!0,value:e!==0}:{ok:!1}}case"array":case"set":case"tuple":return Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"object":case"map":return e!=null&&typeof e=="object"&&!Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"binary":return e instanceof File||e instanceof Blob?{ok:!0,value:e}:{ok:!1};case"null":return{ok:!0,value:null};case"any":case"choice":return{ok:!0,value:e};default:return{ok:!1}}}catch{return{ok:!1}}}function Ft(e){switch(e){case"null":return null;case"array":case"set":case"tuple":return[];case"object":case"map":return{};case"binary":return;default:return}}function Pt(e){return e.map(t=>({key:t,label:h._t(t),detect:r=>kt(r,[t])===t,convert:r=>qt(r,t),defaultValue:()=>Ft(t)}))}function Vt({options:e,selected:t,onChange:r}){if((e.length<=3?"segmented":"select")==="segmented"){const a=Object.fromEntries(e.map(u=>[u.value,u.label]));return h.SegmentedInput({options:a,value:t,onChange:u=>r(u),size:"sm"})}return h.NativeSelect({options:e.map(a=>({type:"value",value:a.value,label:a.label})),value:t,onChange:r})}function Lt({ctx:e,showSelector:t,selector:r,inner:n}){return e.isRoot?t?d.Stack(l.attr.class("bc-stack--gap-2"),r,n):n:d.InputWrapper({...Nt(e),content:t?d.Stack(l.attr.class("bc-stack--gap-2 bc-stack--align-start"),r,n):n})}function Et({ctx:e,controller:t}){const r=e.definition,n=r.type;let s=[];if(Array.isArray(n))s=n;else return console.warn("StructureUnionControl called with non-array type"),T({ctx:e,controller:t});const a=s.includes("null"),u=B(n),i=a&&u.length>0?u:s,o=Pt(i),c=new h.UnionController(t.path,t.change,t.signal,t.status,{disabled:t.disabled},o);t.onDispose(()=>c.dispose());const p=m=>Vt({options:i.map(g=>({value:g,label:h._t(g)})),selected:c.activeBranch,onChange:m}),y=m=>{c.switchToBranch(m,!1)},b=l.MapSignal(c.activeBranch,m=>{const g=l.Value.get(m),f=c.getBranchController(g),v=e.with({definition:{...r,type:g},suppressLabel:!e.isRoot});return T({ctx:v,controller:f})});return Lt({ctx:e,showSelector:i.length>1,selector:p(y),inner:b})}function T({ctx:e,controller:t}){let r=e;const n=e.definition;if(n.type&&D(n.type)){const i=e.resolveRef(n.type.$ref);if(i){const{type:o,...c}=n,p={...i,...c};r=e.with({definition:p})}}if(r.definition.$extends){const{merged:i}=ee(r.definition,e.schema);r=r.with({definition:i})}const s=r.widgetRegistry;if(s){const i=s.findBestWidget(r);if(i)return i.registration.factory({controller:t,ctx:r})}if(me(r.definition))return Fe({ctx:r,controller:t});if(ye(r.definition))return Pe({ctx:r,controller:t});const a=r.resolvedType;if(Array.isArray(a)&&B(a).length>1)return Et({ctx:r,controller:t});const u=r.primaryType;if(!u)return K({ctx:r,controller:t});if(M(r.definition)){const i=t instanceof d.ObjectController?t:t.object();return Ae({ctx:r,controller:i})}if(Z(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return Me({ctx:r,controller:i})}if(H(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return Re({ctx:r,controller:i})}if(X(r.definition)){const i=t instanceof d.ObjectController?t:t.object();return Ne({ctx:r,controller:i})}if(Y(r.definition)){const i=t instanceof d.ArrayController?t:t.array();return ke({ctx:r,controller:i})}if(Q(r.definition))return qe({ctx:r,controller:t});switch(u){case"string":return xe({ctx:r,controller:t});case"boolean":return $e({ctx:r,controller:t});case"uuid":return we({ctx:r,controller:t});case"uri":return De({ctx:r,controller:t});case"binary":return Oe({ctx:r,controller:t});case"null":return Ut(r);case"any":return K({ctx:r,controller:t});default:return q(u)?Ce({ctx:r,controller:t,intType:u}):U(u)?je({ctx:r,controller:t,floatType:u}):W(u)?Se({ctx:r,controller:t,temporalType:u}):(console.warn(`Unknown type: ${u}`),Wt(r,u))}}function Ve({schema:e,controller:t,widgetRegistry:r,readOnly:n,locale:s}){const a=ve(e,{widgetRegistry:r,readOnly:n,locale:s});return T({ctx:a,controller:t})}function Ut(e){return l.html.div(l.attr.class("bc-json-structure-placeholder"),l.html.span(`[Null: ${e.label}]`),l.html.em("null"))}function Wt(e,t){return l.html.div(l.attr.class("bc-json-structure-unknown"),l.html.span(`Unknown type: ${t}`),l.html.em(`at path: ${e.jsonPath}`))}function te(e,t){return new Bt(e,t)}class Bt{schema;options;constructor(t,r){this.schema=t,this.options=r??{}}validate(t){const r=[];return this.validateValue(t,this.schema,"",r),{isValid:r.length===0,errors:r}}validateAt(t,r){return this.validate(t)}validateValue(t,r,n,s){if(this.options.stopOnFirstError&&s.length>0)return;if(t===null){const c=r.type;if(c==="null"||Array.isArray(c)&&c.includes("null"))return;s.push({path:n,type:"type",expected:c,actual:"null"});return}if("enum"in r&&Array.isArray(r.enum)){r.enum.includes(t)||s.push({path:n,type:"enum",expected:r.enum,actual:t});return}if("const"in r){t!==r.const&&s.push({path:n,type:"const",expected:r.const,actual:t});return}const a=r.type;if(!a)return;const i=(Array.isArray(a)?a:[a]).filter(c=>typeof c=="string");!i.some(c=>this.checkType(t,c,r,n,s))&&i.length>0&&s.push({path:n,type:"type",expected:a,actual:typeof t})}checkType(t,r,n,s,a){switch(r){case"string":return this.validateString(t,n,s,a);case"boolean":return typeof t=="boolean";case"null":return t===null;case"object":return this.validateObject(t,n,s,a);case"array":return this.validateArray(t,n,s,a);case"set":return this.validateSet(t,n,s,a);case"map":return this.validateMap(t,n,s,a);case"tuple":return this.validateTuple(t,n,s,a);case"choice":return this.validateChoice(t,n,s,a);case"any":return!0;default:return q(r)?this.validateInteger(t,r,n,s,a):U(r)?this.validateFloat(t,n,s,a):W(r)?this.validateTemporal(t,r,s,a):r==="uuid"?this.validateUuid(t,s,a):r==="uri"?this.validateUri(t,s,a):r==="binary"?this.validateBinary(t,s,a):!1}}validateString(t,r,n,s){if(typeof t!="string")return!1;const a=r;if(a.minLength!==void 0&&t.length<a.minLength&&s.push({path:n,type:"minLength",expected:a.minLength,actual:t.length}),a.maxLength!==void 0&&t.length>a.maxLength&&s.push({path:n,type:"maxLength",expected:a.maxLength,actual:t.length}),a.pattern!==void 0)try{new RegExp(a.pattern).test(t)||s.push({path:n,type:"pattern",expected:a.pattern,actual:t})}catch{}return!0}validateInteger(t,r,n,s,a){if(typeof t!="number"&&typeof t!="bigint")return!1;if(typeof t=="number"&&!Number.isInteger(t))return a.push({path:s,type:"type",expected:r,actual:"float"}),!1;if(q(r)){const u=V[r],i=typeof t=="bigint"?t:BigInt(Math.round(t));(i<u.min||i>u.max)&&a.push({path:s,type:"integer_bounds",expected:{min:u.min.toString(),max:u.max.toString()},actual:i.toString(),context:{type:r}})}return this.validateNumericConstraints(t,n,s,a),!0}validateFloat(t,r,n,s){return typeof t!="number"?!1:(this.validateNumericConstraints(t,r,n,s),!0)}validateNumericConstraints(t,r,n,s){const a=r,u=typeof t=="bigint"?Number(t):t;if(a.minimum!==void 0){const i=typeof a.minimum=="string"?Number(a.minimum):a.minimum;u<i&&s.push({path:n,type:"minimum",expected:i,actual:u})}if(a.maximum!==void 0){const i=typeof a.maximum=="string"?Number(a.maximum):a.maximum;u>i&&s.push({path:n,type:"maximum",expected:i,actual:u})}if(a.exclusiveMinimum!==void 0){const i=typeof a.exclusiveMinimum=="string"?Number(a.exclusiveMinimum):a.exclusiveMinimum;u<=i&&s.push({path:n,type:"exclusiveMinimum",expected:i,actual:u})}if(a.exclusiveMaximum!==void 0){const i=typeof a.exclusiveMaximum=="string"?Number(a.exclusiveMaximum):a.exclusiveMaximum;u>=i&&s.push({path:n,type:"exclusiveMaximum",expected:i,actual:u})}a.multipleOf!==void 0&&typeof t=="number"&&t%a.multipleOf!==0&&s.push({path:n,type:"multipleOf",expected:a.multipleOf,actual:t})}validateTemporal(t,r,n,s){if(typeof t!="string")return!1;const u={date:/^\d{4}-\d{2}-\d{2}$/,datetime:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$/,time:/^\d{2}:\d{2}:\d{2}(\.\d+)?$/,duration:/^P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/}[r];return u&&!u.test(t)?(s.push({path:n,type:"format",expected:r,actual:t}),!1):!0}validateUuid(t,r,n){return typeof t!="string"?!1:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?!0:(n.push({path:r,type:"format",expected:"uuid",actual:t}),!1)}validateUri(t,r,n){if(typeof t!="string")return!1;try{return new URL(t),!0}catch{return n.push({path:r,type:"format",expected:"uri",actual:t}),!1}}validateBinary(t,r,n){return t instanceof Uint8Array?!0:typeof t!="string"?!1:/^[A-Za-z0-9+/]*={0,2}$/.test(t)?!0:(n.push({path:r,type:"format",expected:"binary",actual:t}),!1)}validateObject(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!M(r))return!0;const a=t,u=r.required;if(u){const i=Array.isArray(u[0])?u.flat():u;for(const o of i)o in a||s.push({path:n?`${n}/${o}`:`/${o}`,type:"required",expected:o})}for(const[i,o]of Object.entries(a)){const c=r.properties?.[i];if(c){const p=n?`${n}/${i}`:`/${i}`;this.validateValue(o,c,p,s)}else if(r.additionalProperties===!1)s.push({path:n?`${n}/${i}`:`/${i}`,type:"additionalProperties",actual:i});else if(typeof r.additionalProperties=="object"){const p=n?`${n}/${i}`:`/${i}`;this.validateValue(o,r.additionalProperties,p,s)}}return!0}validateArray(t,r,n,s){if(!Array.isArray(t))return!1;if(!Z(r))return!0;const a=r;a.minItems!==void 0&&t.length<a.minItems&&s.push({path:n,type:"minItems",expected:a.minItems,actual:t.length}),a.maxItems!==void 0&&t.length>a.maxItems&&s.push({path:n,type:"maxItems",expected:a.maxItems,actual:t.length});for(let u=0;u<t.length;u++){const i=`${n}/${u}`;this.validateValue(t[u],r.items,i,s)}return!0}validateSet(t,r,n,s){if(!Array.isArray(t))return!1;if(!H(r))return!0;const a=new Set;for(let u=0;u<t.length;u++){const i=JSON.stringify(t[u]);a.has(i)&&s.push({path:`${n}/${u}`,type:"uniqueItems",actual:t[u]}),a.add(i)}return this.validateArray(t,r,n,s)}validateMap(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!X(r))return!0;const a=t;for(const[u,i]of Object.entries(a)){const o=`${n}/${u}`;this.validateValue(i,r.values,o,s)}return!0}validateTuple(t,r,n,s){if(!Array.isArray(t))return!1;if(!Y(r))return!0;const a=r.tuple.length;t.length!==a&&s.push({path:n,type:"tuple_length",expected:a,actual:t.length});for(let u=0;u<r.tuple.length;u++){const i=r.tuple[u],o=r.properties?.[i];o&&u<t.length&&this.validateValue(t[u],o,`${n}/${u}`,s)}return!0}validateChoice(t,r,n,s){if(typeof t!="object"||t===null||Array.isArray(t))return!1;if(!Q(r))return!0;const a=t,u=Object.keys(r.choices),i=Object.keys(a).find(c=>u.includes(c));if(!i)return s.push({path:n,type:"choice",expected:u,actual:Object.keys(a)}),!1;const o=r.choices[i];return o&&this.validateValue(a[i],o,`${n}/${i}`,s),!0}}function _t(e,t,r){return te(e,r).validate(t)}function Le(e,t){const r=zt(e,t);return{path:e.path,message:r,code:e.type}}function re(e,t){return e.map(r=>{const n=t?.get(r.path);return Le(r,n)})}function zt(e,t){switch(e.type){case"type":return`Expected ${ue(e.expected)}, got ${Gt(e.actual)}`;case"type_mismatch":return`Value must be of type ${ue(e.expected)}`;case"minLength":return`Must be at least ${e.expected} characters`;case"maxLength":return`Must be no more than ${e.expected} characters`;case"pattern":return Jt(e,t);case"format":return Kt(e);case"minimum":return`Must be at least ${e.expected}`;case"maximum":return`Must be at most ${e.expected}`;case"exclusiveMinimum":return`Must be greater than ${e.expected}`;case"exclusiveMaximum":return`Must be less than ${e.expected}`;case"multipleOf":return`Must be a multiple of ${e.expected}`;case"integer_bounds":return Zt(e);case"minItems":return`Must have at least ${e.expected} items`;case"maxItems":return`Must have no more than ${e.expected} items`;case"uniqueItems":return"All items must be unique";case"contains":return"Must contain at least one matching item";case"minContains":return`Must contain at least ${e.expected} matching items`;case"maxContains":return`Must contain no more than ${e.expected} matching items`;case"required":return"This field is required";case"minProperties":return`Must have at least ${e.expected} properties`;case"maxProperties":return`Must have no more than ${e.expected} properties`;case"additionalProperties":return`Unknown property: ${e.actual}`;case"dependentRequired":return Ht(e);case"enum":return Xt(e);case"const":return`Must be exactly ${JSON.stringify(e.expected)}`;case"ref_not_found":return`Invalid reference: ${e.expected}`;case"circular_ref":return"Circular reference detected";case"invalid":return"Invalid value";default:return e.context?.message??`Validation error: ${e.type}`}}function ue(e){return typeof e=="string"?oe(e):Array.isArray(e)?e.map(oe).join(" or "):String(e)}function Gt(e){return e===null?"null":e===void 0?"undefined":typeof e}function oe(e){return{string:"text",boolean:"true/false",int8:"integer (-128 to 127)",int16:"integer (-32768 to 32767)",int32:"integer",int64:"large integer",int128:"very large integer",uint8:"positive integer (0 to 255)",uint16:"positive integer (0 to 65535)",uint32:"positive integer",uint64:"large positive integer",uint128:"very large positive integer",float:"decimal number",double:"decimal number",decimal:"decimal number",date:"date",datetime:"date and time",time:"time",duration:"duration",uuid:"UUID",uri:"URL",binary:"binary data",object:"object",array:"list",set:"unique list",map:"key-value pairs",tuple:"ordered list",choice:"one of multiple options",any:"any value",null:"empty"}[e]??e}function Jt(e,t){const r=t?.description;if(r&&e.type==="pattern")return`Does not match required format: ${r}`;const n=e.expected;if(n){const a={"^[a-zA-Z]+$":"letters only","^[0-9]+$":"numbers only","^[a-zA-Z0-9]+$":"letters and numbers only","^\\S+$":"no spaces allowed","^[a-z]+$":"lowercase letters only","^[A-Z]+$":"uppercase letters only"}[n];if(a)return`Must be ${a}`}return"Does not match required format"}function Kt(e){const t=e.expected;return{email:"Must be a valid email address","date-time":"Must be a valid date and time",date:"Must be a valid date",time:"Must be a valid time",uri:"Must be a valid URL","uri-reference":"Must be a valid URL or relative path",uuid:"Must be a valid UUID",hostname:"Must be a valid hostname",ipv4:"Must be a valid IPv4 address",ipv6:"Must be a valid IPv6 address",regex:"Must be a valid regular expression","json-pointer":"Must be a valid JSON pointer"}[t]??`Must be a valid ${t}`}function Zt(e){const t=e.context?.type;if(t&&q(t)){const r=V[t];return`Must be between ${r.min} and ${r.max}`}return"Value is out of range for this integer type"}function Ht(e){const t=e.context?.dependent,r=e.context?.required;return t&&r?.length?`When "${t}" is present, "${r.join('", "')}" must also be provided`:"Missing required dependent fields"}function Xt(e){const t=e.expected;return t&&t.length<=5?`Must be one of: ${t.map(n=>JSON.stringify(n)).join(", ")}`:"Invalid value"}function Yt(e){const t=new Map;for(const r of e){const n=t.get(r.path)??[];n.push(r),t.set(r.path,n)}return t}function Qt(e,t){return e.filter(r=>r.path===t)}function er(e,t){return e.some(r=>r.path===t)}function tr(e,t){const r=t===""?"/":`${t}/`;return e.filter(n=>n.path.startsWith(r))}class L{registrations=new Map;parent;constructor(t){this.parent=t??null}register(t,r){this.registrations.set(t,r)}unregister(t){this.registrations.delete(t)}get(t){return this.registrations.get(t)??this.parent?.get(t)}has(t){return this.registrations.has(t)||(this.parent?.has(t)??!1)}names(){const t=this.parent?.names()??[],r=Array.from(this.registrations.keys());return[...new Set([...t,...r])]}getForType(t){const r=[];this.parent&&r.push(...this.parent.getForType(t));for(const n of this.registrations.values())n.supportedTypes?.includes(t)&&r.push(n);return r}getForFormat(t){const r=[];this.parent&&r.push(...this.parent.getForFormat(t));for(const n of this.registrations.values())n.supportedFormats?.includes(t)&&r.push(n);return r}findBestWidget(t){const r=[];for(const s of this.names()){const a=this.get(s);if(!a)continue;const u=this.scoreWidget(a,t);u>0&&r.push({name:s,registration:a,score:u})}if(r.length===0)return null;r.sort((s,a)=>a.score!==s.score?a.score-s.score:(a.registration.priority??0)-(s.registration.priority??0));const n=r[0];return{name:n.name,registration:n.registration}}scoreWidget(t,r){let n=0;if(t.matcher)if(t.matcher(r))n+=100;else return 0;const s=r.primaryType;s&&t.supportedTypes?.includes(s)&&(n+=50);const a=r.format;return a&&t.supportedFormats?.includes(a)&&(n+=30),n+=t.priority??0,n}createChild(){return new L(this)}}let E=null;function F(){return E||(E=new L),E}function rr(e){E=e}function nr(e){return new L(e)}function ir(e,t,r){return{name:`type:${e}`,registration:{factory:t,displayName:r?.displayName??`${e} widget`,description:r?.description,supportedTypes:[e],priority:r?.priority??0,canFallback:r?.canFallback??!1}}}function sr(e,t,r){return{name:`format:${e}`,registration:{factory:t,displayName:r?.displayName??`${e} widget`,description:r?.description,supportedFormats:[e],priority:r?.priority??10,canFallback:r?.canFallback??!1}}}function ar(e,t,r,n){return{name:`type:${e}:format:${t}`,registration:{factory:r,displayName:n?.displayName??`${e}/${t} widget`,description:n?.description,supportedTypes:[e],supportedFormats:[t],priority:n?.priority??20,canFallback:n?.canFallback??!1}}}function ur(e,t,r,n){return{name:e,registration:{factory:r,displayName:n?.displayName??e,description:n?.description,matcher:t,priority:n?.priority??50,canFallback:n?.canFallback??!1}}}function Ee(e,t){if(t){const n=t.findBestWidget(e);if(n)return n}return F().findBestWidget(e)}function or(e){const t=e.definition,r={};if(typeof t=="object"&&"x:ui"in t){const n=t["x:ui"];n.widget&&typeof n.widget=="object"&&(r.options=n.widget),typeof n.priority=="number"&&(r.priority=n.priority)}if(typeof t=="object"&&"widget"in t){const n=t.widget;typeof n=="object"&&n!==null&&(r.options={...r.options??{},...n})}return Object.keys(r).length>0?r:void 0}function ne(e){const t=e.definition;if(typeof t=="object"&&"x:ui"in t){const r=t["x:ui"];if(typeof r.widget=="string")return r.widget}if(typeof t=="object"&&"widget"in t){const r=t.widget;if(r&&typeof r.type=="string")return r.type}}function lr(e){return ne(e)!==void 0}function cr(e,t){const r=ne(e);if(r){if(t){const a=t.get(r);if(a)return{name:r,registration:a}}const s=F().get(r);if(s)return{name:r,registration:s};console.warn(`Widget "${r}" specified in definition but not found in registry`,{path:e.jsonPath})}return Ee(e,t)}function pr(e,t,r){return{...e,...t,...r}}function Ue(e=F()){e.register("string",{factory:({controller:i,ctx:o})=>xe({ctx:o,controller:i}),displayName:"String",description:"Text input for string values",supportedTypes:["string"],priority:0,canFallback:!0}),e.register("boolean",{factory:({controller:i,ctx:o})=>$e({ctx:o,controller:i}),displayName:"Boolean",description:"Checkbox for boolean values",supportedTypes:["boolean"],priority:0,canFallback:!0}),e.register("uuid",{factory:({controller:i,ctx:o})=>we({ctx:o,controller:i}),displayName:"UUID",description:"Input for UUID values",supportedTypes:["uuid"],priority:0,canFallback:!0}),e.register("uri",{factory:({controller:i,ctx:o})=>De({ctx:o,controller:i}),displayName:"URI",description:"Input for URI/URL values",supportedTypes:["uri"],priority:0,canFallback:!0}),e.register("binary",{factory:({controller:i,ctx:o})=>Oe({ctx:o,controller:i}),displayName:"Binary",description:"File upload for binary data",supportedTypes:["binary"],priority:0,canFallback:!0}),e.register("any",{factory:({controller:i,ctx:o})=>K({ctx:o,controller:i}),displayName:"Any",description:"Generic control for any type",supportedTypes:["any"],priority:0,canFallback:!0});const t=["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"],r=({controller:i,ctx:o})=>Ce({ctx:o,controller:i,intType:o.primaryType});for(const i of t)e.register(i,{factory:r,displayName:i.toUpperCase(),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const n=["float","double","decimal"],s=({controller:i,ctx:o})=>je({ctx:o,controller:i,floatType:o.primaryType});for(const i of n)e.register(i,{factory:s,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Number input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});const a=["date","datetime","time","duration"],u=({controller:i,ctx:o})=>Se({ctx:o,controller:i,temporalType:o.primaryType});for(const i of a)e.register(i,{factory:u,displayName:i.charAt(0).toUpperCase()+i.slice(1),description:`Input for ${i} values`,supportedTypes:[i],priority:0,canFallback:!0});e.register("object",{factory:({controller:i,ctx:o})=>Ae({ctx:o,controller:i}),displayName:"Object",description:"Form for object values",supportedTypes:["object"],priority:0,canFallback:!0}),e.register("array",{factory:({controller:i,ctx:o})=>Me({ctx:o,controller:i}),displayName:"Array",description:"List control for array values",supportedTypes:["array"],priority:0,canFallback:!0}),e.register("set",{factory:({controller:i,ctx:o})=>Re({ctx:o,controller:i}),displayName:"Set",description:"Set control for unique values",supportedTypes:["set"],priority:0,canFallback:!0}),e.register("map",{factory:({controller:i,ctx:o})=>Ne({ctx:o,controller:i}),displayName:"Map",description:"Map control for key-value pairs",supportedTypes:["map"],priority:0,canFallback:!0}),e.register("tuple",{factory:({controller:i,ctx:o})=>ke({ctx:o,controller:i}),displayName:"Tuple",description:"Tuple control for fixed-length arrays",supportedTypes:["tuple"],priority:0,canFallback:!0}),e.register("choice",{factory:({controller:i,ctx:o})=>qe({ctx:o,controller:i}),displayName:"Choice",description:"Choice control for union types",supportedTypes:["choice"],priority:0,canFallback:!0}),e.register("enum",{factory:({controller:i,ctx:o})=>Fe({ctx:o,controller:i}),displayName:"Enum",description:"Dropdown for enumerated values",priority:10,canFallback:!1,matcher:i=>i.hasEnum}),e.register("const",{factory:({controller:i,ctx:o})=>Pe({ctx:o,controller:i}),displayName:"Const",description:"Display for constant values",priority:20,canFallback:!1,matcher:i=>i.hasConst})}function We(e=F()){return e.has("string")&&e.has("object")&&e.has("array")}function dr(e=F()){We(e)||Ue(e)}function Be(e){let t=e;if(e.$root){const r=R(e.$root,e);r&&(t=r)}return w(t,e,new Set)}function w(e,t,r){if(e.type&&D(e.type)){const n=e.type.$ref;if(r.has(n))return;r.add(n);const s=R(n,t);if(s){const a={...s,...e,type:s.type},u=w(a,t,r);return r.delete(n),u}r.delete(n);return}return e.default!==void 0?e.default:Array.isArray(e.examples)&&e.examples.length>0?e.examples[0]:"const"in e&&e.const!==void 0?e.const:"enum"in e&&Array.isArray(e.enum)&&e.enum.length>0?e.enum[0]:Cr(e)?null:fr(e,t,r)}function fr(e,t,r){const n=_e(e);if(M(e))return yr(e,t,r);if(n==="choice"&&"choices"in e)return gr(e,t,r);if(n==="tuple"&&"tuple"in e&&"properties"in e)return hr(e,t,r);if(n==="array")return br(e,t,r);if(n==="set")return vr(e,t,r);if(n==="map")return{};if(n==="string")return xr(e);if(jr(n))return $r(e);if(wr(n))return Tr(e);if(n==="boolean")return!1;if(n==="null")return null;if(Sr(n))return Ir(n);if(n==="uuid"||n==="uri"||n==="uri-reference"||n==="binary"||n==="bytes")return""}function mr(e){if(!e||e.length===0)return new Set;if(Array.isArray(e[0])){const t=e.flat();return new Set(t)}return new Set(e)}function yr(e,t,r){if(!M(e))return{};const n=mr(e.required),s={};for(const[a,u]of Object.entries(e.properties))if(n.has(a))if(u.type&&D(u.type)){const i=u.type.$ref;if(r.has(i))continue;r.add(i);const o=R(i,t);if(o){const c={...o,...u,type:o.type},p=w(c,t,r);p!==void 0&&(s[a]=p)}r.delete(i)}else{const i=w(u,t,r);i!==void 0&&(s[a]=i)}return s}function gr(e,t,r){if(!("choices"in e))return;const n=e.choices,s=Object.keys(n);if(s.length===0)return;const a=s[0],u=n[a];if("selector"in e&&e.selector){const o=e.selector,c=w(u,t,r);return typeof c=="object"&&c!==null?{[o]:a,...c}:{[o]:a}}const i=w(u,t,r);return{[a]:i}}function hr(e,t,r){if(!("tuple"in e)||!("properties"in e))return{};const n=e.tuple,s=e.properties,a=new Set(e.required??n),u={};for(const i of n){if(!a.has(i))continue;const o=s[i];if(o){const c=w(o,t,r);c!==void 0&&(u[i]=c)}}return u}function br(e,t,r){const n=("minItems"in e?e.minItems:0)??0;if(n===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(n).fill(null);const a=w(s,t,r);return Array(n).fill(a??null)}function vr(e,t,r){const n=("minItems"in e?e.minItems:0)??0;if(n===0)return[];const s="items"in e?e.items:void 0;if(!s)return Array(n).fill(null);const a=w(s,t,r);return Array(n).fill(a??null)}function xr(e){switch("format"in e?e.format:void 0){case"date":return ze();case"date-time":return Ge();case"time":return"00:00:00";case"email":case"uri":case"uri-reference":case"uuid":default:return""}}function $r(e){const t=_e(e),r=t==="int64"||t==="uint64"||t==="int128"||t==="uint128";let n="minimum"in e?e.minimum:void 0,s="maximum"in e?e.maximum:void 0;const a="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,u="exclusiveMaximum"in e?e.exclusiveMaximum:void 0;a!==void 0&&(n=a+1),u!==void 0&&(s=u-1);let i;n!==void 0&&s!==void 0?i=Math.round((n+s)/2):n!==void 0?i=n:s!==void 0?i=0<=s?0:s:i=0;const o="multipleOf"in e?e.multipleOf:void 0;return o!==void 0&&o>0&&(i=Math.round(i/o)*o,n!==void 0&&i<n&&(i=Math.ceil(n/o)*o),s!==void 0&&i>s&&(i=Math.floor(s/o)*o)),r?BigInt(Math.round(i)):Math.round(i)}function Tr(e){let t="minimum"in e?e.minimum:void 0,r="maximum"in e?e.maximum:void 0;const n="exclusiveMinimum"in e?e.exclusiveMinimum:void 0,s="exclusiveMaximum"in e?e.exclusiveMaximum:void 0,a="multipleOf"in e?e.multipleOf:.001;n!==void 0&&(t=n+a),s!==void 0&&(r=s-a);let u;t!==void 0&&r!==void 0?u=(t+r)/2:t!==void 0?u=t:r!==void 0?u=0<=r?0:r:u=0;const i="multipleOf"in e?e.multipleOf:void 0;return i!==void 0&&i>0&&(u=Math.round(u/i)*i,t!==void 0&&u<t&&(u=Math.ceil(t/i)*i),r!==void 0&&u>r&&(u=Math.floor(r/i)*i)),u}function Ir(e){switch(e){case"date":return ze();case"time":return"00:00:00";case"datetime":return Ge();case"duration":return"PT0S";default:return""}}function Cr(e){return Array.isArray(e.type)?e.type.some(t=>typeof t=="string"?t==="null":!1):!1}function _e(e){const t=e.type;if(typeof t=="string")return t;if(Array.isArray(t)){for(const r of t)if(typeof r=="string"&&r!=="null")return r}}function jr(e){return e?["int8","int16","int32","int64","int128","uint8","uint16","uint32","uint64","uint128"].includes(e):!1}function wr(e){return e?["float","double","decimal"].includes(e):!1}function Sr(e){return e?["date","time","datetime","duration"].includes(e):!1}function ze(){return new Date().toISOString().split("T")[0]}function Ge(){return new Date().toISOString()}function Dr(e){if(e.isValid)return d.i.valid;const t=re(e.errors),r=new Map;for(const u of t){const i=r.get(u.path)||[];i.push(u),r.set(u.path,i)}const n=(u,i)=>{if(u.length===0)return{message:i.map(y=>y.message).join("; ")};const[o,...c]=u,p=n(c,i);return{dependencies:{[o]:p}}},s={},a={};for(const[u,i]of r.entries())if(u===""||u==="/")s.message=i.map(o=>o.message).join("; ");else{const o=u.split("/").filter(c=>c!=="");if(o.length===1)a[o[0]]={message:i.map(c=>c.message).join("; ")};else{const[c,...p]=o;a[c]=n(p,i)}}return Object.keys(a).length>0&&(s.dependencies=a),d.i.invalid(s)}function Or({schema:e,initialValue:t,validationMode:r,validateDebounceMs:n,widgetRegistry:s,readOnly:a,locale:u,onChange:i,onValidate:o,applySchemaDefaults:c=!0},p){const y=t!==void 0?l.Value.get(t):void 0,b=Be(e);let m;t===void 0?m=b??{}:c?m=h.deepMergeDefaults(b,y):m=y;const g=te(e),f=r??"onTouched",v=k=>{const x=g.validate(k);if(o&&!x.isValid){const A=re(x.errors);o(A)}return Dr(x)},{controller:$,setStatus:j}=d.useController({initialValue:m,validationMode:f,validateDebounceMs:n,validate:f==="onSubmit"?void 0:v,onChange:i}),N=()=>{$.dispose()},O=l.Fragment(l.OnDispose(N),Ve({schema:e,controller:$,widgetRegistry:s,readOnly:a,locale:u}));return p({Form:O,controller:$,setStatus:j})}exports.DefaultWidgetRegistry=L;exports.INTEGER_BOUNDS=V;exports.JSONStructureForm=Or;exports.RefResolver=be;exports.StructureContext=z;exports.StructureControl=Ve;exports.StructureGenericControl=T;exports.createExtendsResolver=tt;exports.createRefResolver=_;exports.createStructureContext=ve;exports.createValidator=te;exports.createWidgetRegistry=nr;exports.ensureDefaultWidgets=dr;exports.extractStructureDefaults=Be;exports.forFormat=sr;exports.forMatcher=ur;exports.forType=ir;exports.forTypeAndFormat=ar;exports.formatValidationError=Le;exports.formatValidationErrors=re;exports.getChildErrors=tr;exports.getErrorsForPath=Qt;exports.getExplicitWidgetName=ne;exports.getGlobalWidgetRegistry=F;exports.getNonNullTypes=B;exports.getResolvedType=J;exports.getWidgetOptions=or;exports.groupErrorsByPath=Yt;exports.hasConstValue=ye;exports.hasCustomWidget=lr;exports.hasDefaultWidgets=We;exports.hasEnumValue=me;exports.hasErrorsAtPath=er;exports.isArrayTypeDefinition=Z;exports.isBigIntType=le;exports.isChoiceTypeDefinition=Q;exports.isCompoundType=Ze;exports.isFloatType=U;exports.isIntegerType=q;exports.isMapTypeDefinition=X;exports.isNamespace=de;exports.isNullableType=ge;exports.isNumericType=ce;exports.isObjectTypeDefinition=M;exports.isPrimitiveType=pe;exports.isSetTypeDefinition=H;exports.isTemporalType=W;exports.isTupleTypeDefinition=Y;exports.isTypeDefinition=fe;exports.isTypeReference=D;exports.mergeWidgetOptions=pr;exports.parseRefPath=he;exports.registerDefaultWidgets=Ue;exports.resolveExtends=ee;exports.resolveRef=R;exports.resolveTypeReference=Xe;exports.resolveWidget=Ee;exports.resolveWidgetWithOverride=cr;exports.setGlobalWidgetRegistry=rr;exports.validate=_t;
@@ -1,9 +1,9 @@
1
- import { _ as J, g as Ke, t as Z, N as Je, b as pe, c as de, U as Ze, e as He, a as Xe, T as Ye, L as fe, f as me, h as Qe, G as et, i as tt, S as nt, j as rt } from "../deep-merge-CQQCMLwG.js";
1
+ import { _ as J, g as Ke, t as Z, N as Je, b as pe, c as de, U as Ze, e as He, a as Xe, T as Ye, L as fe, f as me, h as Qe, G as et, i as tt, S as nt, j as rt } from "../deep-merge-Cjm-tFVT.js";
2
2
  import { html as p, attr as m, Fragment as H, MapSignal as U, Value as I, computedOf as w, prop as it, WithElement as st, OnDispose as at } from "@tempots/dom";
3
- import { c as b, b as ne, I as B, S as V, L as ye, e as ut, M as ot, g as re, A as G, h as ct, a as ie } from "../use-form-B7A865EM.js";
4
- import { T as lt, B as E } from "../translations-DQxouiBG.js";
5
- import { N as pt, B as dt, D as ft, a as mt, P as yt, b as gt, c as ht, d as bt, e as vt, F as xt } from "../duration-input-DKxZ6OCa.js";
6
- import { f as $t } from "../colors-pQZlNrwM.js";
3
+ import { b, a as ne, I as B, S as V, L as ye, d as ut, M as ot, f as re, A as G, g as ct, i as ie } from "../use-form-D3EXhCfe.js";
4
+ import { T as lt, B as E } from "../translations-BEMKy6-W.js";
5
+ import { N as pt, B as dt, D as ft, a as mt, P as yt, b as gt, c as ht, d as bt, e as vt, F as xt } from "../duration-input-DfdE7_V9.js";
6
+ import { l as $t } from "../colors-DPo9GEJR.js";
7
7
  function It(e) {
8
8
  return e === "int64" || e === "int128" || e === "uint64" || e === "uint128";
9
9
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./translations-hMQlZmD4.cjs"),a={loadingExtended:"로딩 중입니다. 잠시만 기다려 주세요",loadingShort:"로딩 중...",locale:"지역",iconDescription:"아이콘",loadingIcon:"로딩 아이콘",failedToLoadIcon:"아이콘 로드 실패",editLabel:"편집",selectOne:"하나 선택",selectMany:"여러 개 선택",noResults:"결과 없음",passwordPlaceholderText:"비밀번호",togglePasswordVisibility:"비밀번호 표시 전환",toggleMenu:"메뉴 전환",toggleAside:"사이드 패널 전환",mainNavigation:"메인 네비게이션",sidebar:"사이드바",closeDrawer:"드로어 닫기",closeModal:"모달 닫기",confirm:"확인",cancel:"취소",addLabel:"추가",removeItem:"항목 제거",currentLocale:"한국어",ar:"아랍어",de:"독일어",en:"영어",es:"스페인어",fr:"프랑스어",hi:"힌디어",it:"이탈리아어",ja:"일본어",ko:"한국어",nl:"네덜란드어",pl:"폴란드어",pt:"포르투갈어",ru:"러시아어",tr:"터키어",vi:"베트남어",zh:"중국어",he:"히브리어",fa:"페르시아어",ur:"우르두어",emailPlaceholderText:"이메일을 입력하세요",incrementValue:"값 증가",decrementValue:"값 감소",dropZoneInstructions:e=>e?"클릭하여 선택하거나 파일을 여기로 드래그하세요, 또는 Enter 또는 Space 키를 눌러 파일 선택기를 여세요":"파일을 여기로 드래그하세요",fileSizeUnits:["바이트","KB","MB","GB","TB"],removeFile:"파일 제거",clearAllFiles:"모든 파일 지우기",clearValue:"값 지우기",unknownType:"알 수 없는 형식",filesInputInstructions:(e,o,t)=>{let n=(e==null||e>1,"클릭하여 선택하거나 파일을 여기로 드래그하세요");if(e||o){const l=[];if(e!=null&&e>1&&l.push(`최대 ${e}개 파일`),o&&t){const i=r.formatFileSize(o,{units:t});l.push(`각각 최대 ${i}`)}l.length>0&&(n+=` (${l.join(", ")})`)}return n},prosemirror:{bold:"Bold",italic:"Italic",code:"Code",link:"Link",removeLink:"Remove Link",heading:e=>`Heading ${e}`,bulletList:"Bullet List",orderedList:"Ordered List",blockquote:"Blockquote",codeBlock:"Code Block",horizontalRule:"Horizontal Rule",linkUrlPlaceholder:"https://example.com"},pdfPageViewer:{loading:"PDF 로딩 중...",loadFailed:"PDF 로드 실패",invalidPdf:"유효하지 않은 PDF 파일",pageOutOfRange:(e,o)=>`페이지 ${e}이(가) 범위를 벗어났습니다 (1-${o})`,renderFailed:"PDF 페이지 렌더링 실패"}};exports.default=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./translations-eUtMHN9s.cjs"),a={loadingExtended:"로딩 중입니다. 잠시만 기다려 주세요",loadingShort:"로딩 중...",locale:"지역",iconDescription:"아이콘",loadingIcon:"로딩 아이콘",failedToLoadIcon:"아이콘 로드 실패",editLabel:"편집",selectOne:"하나 선택",selectMany:"여러 개 선택",noResults:"결과 없음",passwordPlaceholderText:"비밀번호",togglePasswordVisibility:"비밀번호 표시 전환",toggleMenu:"메뉴 전환",toggleAside:"사이드 패널 전환",mainNavigation:"메인 네비게이션",sidebar:"사이드바",closeDrawer:"드로어 닫기",closeModal:"모달 닫기",confirm:"확인",cancel:"취소",addLabel:"추가",removeItem:"항목 제거",currentLocale:"한국어",ar:"아랍어",de:"독일어",en:"영어",es:"스페인어",fr:"프랑스어",hi:"힌디어",it:"이탈리아어",ja:"일본어",ko:"한국어",nl:"네덜란드어",pl:"폴란드어",pt:"포르투갈어",ru:"러시아어",tr:"터키어",vi:"베트남어",zh:"중국어",he:"히브리어",fa:"페르시아어",ur:"우르두어",emailPlaceholderText:"이메일을 입력하세요",incrementValue:"값 증가",decrementValue:"값 감소",dropZoneInstructions:e=>e?"클릭하여 선택하거나 파일을 여기로 드래그하세요, 또는 Enter 또는 Space 키를 눌러 파일 선택기를 여세요":"파일을 여기로 드래그하세요",fileSizeUnits:["바이트","KB","MB","GB","TB"],removeFile:"파일 제거",clearAllFiles:"모든 파일 지우기",clearValue:"값 지우기",unknownType:"알 수 없는 형식",filesInputInstructions:(e,o,t)=>{let n=(e==null||e>1,"클릭하여 선택하거나 파일을 여기로 드래그하세요");if(e||o){const l=[];if(e!=null&&e>1&&l.push(`최대 ${e}개 파일`),o&&t){const i=r.formatFileSize(o,{units:t});l.push(`각각 최대 ${i}`)}l.length>0&&(n+=` (${l.join(", ")})`)}return n},prosemirror:{bold:"Bold",italic:"Italic",code:"Code",link:"Link",removeLink:"Remove Link",heading:e=>`Heading ${e}`,bulletList:"Bullet List",orderedList:"Ordered List",blockquote:"Blockquote",codeBlock:"Code Block",horizontalRule:"Horizontal Rule",linkUrlPlaceholder:"https://example.com"},pdfPageViewer:{loading:"PDF 로딩 중...",loadFailed:"PDF 로드 실패",invalidPdf:"유효하지 않은 PDF 파일",pageOutOfRange:(e,o)=>`페이지 ${e}이(가) 범위를 벗어났습니다 (1-${o})`,renderFailed:"PDF 페이지 렌더링 실패"}};exports.default=a;
@@ -1,4 +1,4 @@
1
- import { f as r } from "./translations-DQxouiBG.js";
1
+ import { f as r } from "./translations-BEMKy6-W.js";
2
2
  const d = {
3
3
  loadingExtended: "로딩 중입니다. 잠시만 기다려 주세요",
4
4
  loadingShort: "로딩 중...",
@@ -1,7 +1,7 @@
1
- import { WithElement as S, OnDispose as z, prop as R, computedOf as w, Fragment as M, attr as g, WithBrowserCtx as J, Value as U, render as Q, html as k, dataAttr as B, aria as V, on as X, When as q, Use as H, coalesce as I } from "@tempots/dom";
2
- import { g as $, T as _ } from "./timer-DzWb416P.js";
3
- import { s as Y, C as Z } from "./use-form-B7A865EM.js";
4
- import { a as K, B as P } from "./translations-DQxouiBG.js";
1
+ import { WithElement as S, OnDispose as z, prop as R, computedOf as A, Fragment as M, attr as g, WithBrowserCtx as J, Value as U, render as Q, html as k, dataAttr as B, aria as V, on as X, When as j, Use as H, coalesce as q } from "@tempots/dom";
2
+ import { g as $, I as _ } from "./timer-Rd2sKnvH.js";
3
+ import { s as Y, C as Z } from "./use-form-D3EXhCfe.js";
4
+ import { a as K, B as P } from "./translations-BEMKy6-W.js";
5
5
  const ee = [
6
6
  "a[href]",
7
7
  "button:not([disabled])",
@@ -101,8 +101,8 @@ function N({
101
101
  u(!a.value);
102
102
  }, f = [], p = (i) => {
103
103
  f.push(
104
- e.on((T) => {
105
- T === "closed" && i();
104
+ e.on((w) => {
105
+ w === "closed" && i();
106
106
  })
107
107
  );
108
108
  };
@@ -214,7 +214,7 @@ function oe({
214
214
  animation: o,
215
215
  status: t
216
216
  }) {
217
- const s = w(
217
+ const s = A(
218
218
  o,
219
219
  t
220
220
  )((n, r) => {
@@ -223,7 +223,7 @@ function oe({
223
223
  const a = r === "start-opening" || r === "opening" || r === "opened";
224
224
  let u;
225
225
  return "enter" in n || "exit" in n ? u = a ? n.enter : n.exit : u = n, `bc-animated-toggle bc-animated-toggle--${se(u)} bc-animated-toggle--${r}`;
226
- }), e = w(
226
+ }), e = A(
227
227
  o,
228
228
  t
229
229
  )((n, r) => {
@@ -282,7 +282,7 @@ function re(o) {
282
282
  }
283
283
  };
284
284
  }
285
- class A {
285
+ class T {
286
286
  optional() {
287
287
  return new ae(this);
288
288
  }
@@ -293,7 +293,7 @@ class A {
293
293
  return re(this);
294
294
  }
295
295
  }
296
- class C extends A {
296
+ class C extends T {
297
297
  minLength;
298
298
  maxLength;
299
299
  pattern;
@@ -339,7 +339,7 @@ class C extends A {
339
339
  return s.minLength = this.minLength, s.maxLength = this.maxLength, s.pattern = this.pattern, s.customValidations = [...this.customValidations, t], s;
340
340
  }
341
341
  }
342
- class O extends A {
342
+ class O extends T {
343
343
  mustBeTrue = !1;
344
344
  trueMessage;
345
345
  validate(t) {
@@ -362,7 +362,7 @@ class O extends A {
362
362
  return e.mustBeTrue = !0, e.trueMessage = s, e;
363
363
  }
364
364
  }
365
- class ae extends A {
365
+ class ae extends T {
366
366
  constructor(t) {
367
367
  super(), this.inner = t;
368
368
  }
@@ -373,7 +373,7 @@ class ae extends A {
373
373
  return s.success ? { success: !0, data: s.data } : { success: !1, errors: s.errors };
374
374
  }
375
375
  }
376
- class ie extends A {
376
+ class ie extends T {
377
377
  constructor(t, s) {
378
378
  super(), this.inner = t, this.defaultValue = s;
379
379
  }
@@ -381,7 +381,7 @@ class ie extends A {
381
381
  return t === void 0 ? { success: !0, data: this.defaultValue } : this.inner.validate(t);
382
382
  }
383
383
  }
384
- class D extends A {
384
+ class D extends T {
385
385
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
386
386
  constructor(t) {
387
387
  super(), this.shape = t;
@@ -451,7 +451,7 @@ function ce(o) {
451
451
  s.push(l), s.push(() => {
452
452
  c.dispose(), v(), b();
453
453
  });
454
- const T = Q((() => {
454
+ const w = Q((() => {
455
455
  const E = /* @__PURE__ */ new Set();
456
456
  for (const d of t.element.querySelectorAll(
457
457
  ":scope > :not([data-overlay])"
@@ -468,7 +468,7 @@ function ce(o) {
468
468
  B.status(c.status.map(String)),
469
469
  B.overlay("true"),
470
470
  g.class(
471
- w(
471
+ A(
472
472
  r ?? "opaque",
473
473
  a
474
474
  )(
@@ -482,7 +482,7 @@ function ce(o) {
482
482
  clear: !1,
483
483
  providers: t.providers
484
484
  });
485
- s.push(T), $(() => c.open());
485
+ s.push(w), $(() => c.open());
486
486
  }, e);
487
487
  });
488
488
  }
@@ -505,12 +505,12 @@ function le(o, t) {
505
505
  U.on(e, (d) => {
506
506
  y.set(d ? "capturing" : "non-capturing");
507
507
  });
508
- const x = w(
508
+ const x = A(
509
509
  h.header != null,
510
510
  n
511
- )((d, L) => d || L), l = Y("modal"), i = `${l}-header`, T = `${l}-body`, E = k.div(
511
+ )((d, L) => d || L), l = Y("modal"), i = `${l}-header`, w = `${l}-body`, E = k.div(
512
512
  g.class(
513
- w(
513
+ A(
514
514
  s,
515
515
  m
516
516
  )(
@@ -521,7 +521,7 @@ function le(o, t) {
521
521
  g.role("dialog"),
522
522
  V.modal(!0),
523
523
  ...h.header ? [V.labelledby(i)] : [],
524
- V.describedby(T),
524
+ V.describedby(w),
525
525
  g.tabindex(-1),
526
526
  // Make modal focusable for initial focus
527
527
  g.id(l),
@@ -540,17 +540,17 @@ function le(o, t) {
540
540
  '[aria-label="Close modal"]'
541
541
  );
542
542
  if (L) return L;
543
- const j = d.querySelector(
543
+ const I = d.querySelector(
544
544
  'button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
545
545
  );
546
- return j || d;
546
+ return I || d;
547
547
  }
548
548
  }),
549
549
  // Modal content container
550
550
  k.div(
551
551
  g.class("bc-modal__content"),
552
552
  // Header section
553
- q(
553
+ j(
554
554
  x,
555
555
  () => k.div(
556
556
  g.class("bc-modal__header"),
@@ -559,7 +559,7 @@ function le(o, t) {
559
559
  ...h.header ? [g.id(i)] : [],
560
560
  h.header
561
561
  ),
562
- q(
562
+ j(
563
563
  n,
564
564
  () => H(
565
565
  K,
@@ -575,7 +575,7 @@ function le(o, t) {
575
575
  )
576
576
  ),
577
577
  // Body section
578
- k.div(g.class("bc-modal__body"), g.id(T), h.body),
578
+ k.div(g.class("bc-modal__body"), g.id(w), h.body),
579
579
  // Footer section
580
580
  h.footer && k.div(g.class("bc-modal__footer"), h.footer)
581
581
  )
@@ -617,7 +617,7 @@ function Ee(o, t) {
617
617
  variant: "outline",
618
618
  onClick: c
619
619
  },
620
- I(e, u.$.cancel)
620
+ q(e, u.$.cancel)
621
621
  ),
622
622
  P(
623
623
  {
@@ -625,7 +625,7 @@ function Ee(o, t) {
625
625
  variant: "filled",
626
626
  onClick: p
627
627
  },
628
- I(s, u.$.confirm)
628
+ q(s, u.$.confirm)
629
629
  )
630
630
  )
631
631
  });