@opennsw/jsonforms-renderers 0.8.0 → 0.10.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.
@@ -0,0 +1 @@
1
+ "use strict";function at(s,Z){for(var P=0;P<Z.length;P++){const c=Z[P];if(typeof c!="string"&&!Array.isArray(c)){for(const M in c)if(M!=="default"&&!(M in s)){const h=Object.getOwnPropertyDescriptor(c,M);h&&Object.defineProperty(s,M,h.get?h:{enumerable:!0,get:()=>c[M]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}function st(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var k={exports:{}},it=k.exports,I;function ut(){return I||(I=1,(function(s,Z){(function(P,c){s.exports=c()})(it,(function(){var P={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},c=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,M=/\d/,h=/\d\d/,i=/\d\d?/,O=/\d*[^-_:/,()\s\d]+/,v={},N=function(t){return(t=+t)+(t>68?1900:2e3)},o=function(t){return function(e){this[t]=+e}},R=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=(function(e){if(!e||e==="Z")return 0;var r=e.match(/([+-]|\d\d)/g),n=60*r[1]+(+r[2]||0);return n===0?0:r[0]==="+"?-n:n})(t)}],j=function(t){var e=v[t];return e&&(e.indexOf?e:e.s.concat(e.f))},V=function(t,e){var r,n=v.meridiem;if(n){for(var d=1;d<=24;d+=1)if(t.indexOf(n(d,0,e))>-1){r=d>12;break}}else r=t===(e?"pm":"PM");return r},K={A:[O,function(t){this.afternoon=V(t,!1)}],a:[O,function(t){this.afternoon=V(t,!0)}],Q:[M,function(t){this.month=3*(t-1)+1}],S:[M,function(t){this.milliseconds=100*+t}],SS:[h,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[i,o("seconds")],ss:[i,o("seconds")],m:[i,o("minutes")],mm:[i,o("minutes")],H:[i,o("hours")],h:[i,o("hours")],HH:[i,o("hours")],hh:[i,o("hours")],D:[i,o("day")],DD:[h,o("day")],Do:[O,function(t){var e=v.ordinal,r=t.match(/\d+/);if(this.day=r[0],e)for(var n=1;n<=31;n+=1)e(n).replace(/\[|\]/g,"")===t&&(this.day=n)}],w:[i,o("week")],ww:[h,o("week")],M:[i,o("month")],MM:[h,o("month")],MMM:[O,function(t){var e=j("months"),r=(j("monthsShort")||e.map((function(n){return n.slice(0,3)}))).indexOf(t)+1;if(r<1)throw new Error;this.month=r%12||r}],MMMM:[O,function(t){var e=j("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e}],Y:[/[+-]?\d+/,o("year")],YY:[h,function(t){this.year=N(t)}],YYYY:[/\d{4}/,o("year")],Z:R,ZZ:R};function W(t){var e,r;e=t,r=v&&v.formats;for(var n=(t=e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(y,Y,f){var u=f&&f.toUpperCase();return Y||r[f]||P[f]||r[u].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(D,g,L){return g||L.slice(1)}))}))).match(c),d=n.length,m=0;m<d;m+=1){var S=n[m],w=K[S],l=w&&w[0],p=w&&w[1];n[m]=p?{regex:l,parser:p}:S.replace(/^\[|\]$/g,"")}return function(y){for(var Y={},f=0,u=0;f<d;f+=1){var D=n[f];if(typeof D=="string")u+=D.length;else{var g=D.regex,L=D.parser,F=y.slice(u),x=g.exec(F)[0];L.call(Y,x),y=y.replace(x,"")}}return(function($){var b=$.afternoon;if(b!==void 0){var a=$.hours;b?a<12&&($.hours+=12):a===12&&($.hours=0),delete $.afternoon}})(Y),Y}}return function(t,e,r){r.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(N=t.parseTwoDigitYear);var n=e.prototype,d=n.parse;n.parse=function(m){var S=m.date,w=m.utc,l=m.args;this.$u=w;var p=l[1];if(typeof p=="string"){var y=l[2]===!0,Y=l[3]===!0,f=y||Y,u=l[2];Y&&(u=l[2]),v=this.$locale(),!y&&u&&(v=r.Ls[u]),this.$d=(function(F,x,$,b){try{if(["x","X"].indexOf(x)>-1)return new Date((x==="X"?1e3:1)*F);var a=W(x)(F),C=a.year,A=a.month,tt=a.day,et=a.hours,rt=a.minutes,nt=a.seconds,ot=a.milliseconds,B=a.zone,G=a.week,z=new Date,H=tt||(C||A?1:z.getDate()),E=C||z.getFullYear(),_=0;C&&!A||(_=A>0?A-1:z.getMonth());var T,U=et||0,q=rt||0,Q=nt||0,X=ot||0;return B?new Date(Date.UTC(E,_,H,U,q,Q,X+60*B.offset*1e3)):$?new Date(Date.UTC(E,_,H,U,q,Q,X)):(T=new Date(E,_,H,U,q,Q,X),G&&(T=b(T).week(G).toDate()),T)}catch{return new Date("")}})(S,p,w,r),this.init(),u&&u!==!0&&(this.$L=this.locale(u).$L),f&&S!=this.format(p)&&(this.$d=new Date("")),v={}}else if(p instanceof Array)for(var D=p.length,g=1;g<=D;g+=1){l[1]=p[g-1];var L=r.apply(this,l);if(L.isValid()){this.$d=L.$d,this.$L=L.$L,this.init();break}g===D&&(this.$d=new Date(""))}else d.call(this,m)}}}))})(k)),k.exports}var J=ut();const ft=st(J),ct=at({__proto__:null,default:ft},[J]);exports.customParseFormat=ct;
@@ -0,0 +1,150 @@
1
+ function at(s, Z) {
2
+ for (var x = 0; x < Z.length; x++) {
3
+ const c = Z[x];
4
+ if (typeof c != "string" && !Array.isArray(c)) {
5
+ for (const M in c)
6
+ if (M !== "default" && !(M in s)) {
7
+ const h = Object.getOwnPropertyDescriptor(c, M);
8
+ h && Object.defineProperty(s, M, h.get ? h : {
9
+ enumerable: !0,
10
+ get: () => c[M]
11
+ });
12
+ }
13
+ }
14
+ }
15
+ return Object.freeze(Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }));
16
+ }
17
+ function st(s) {
18
+ return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
19
+ }
20
+ var k = { exports: {} }, it = k.exports, I;
21
+ function ut() {
22
+ return I || (I = 1, (function(s, Z) {
23
+ (function(x, c) {
24
+ s.exports = c();
25
+ })(it, (function() {
26
+ var x = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, c = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, M = /\d/, h = /\d\d/, i = /\d\d?/, O = /\d*[^-_:/,()\s\d]+/, v = {}, N = function(t) {
27
+ return (t = +t) + (t > 68 ? 1900 : 2e3);
28
+ }, o = function(t) {
29
+ return function(e) {
30
+ this[t] = +e;
31
+ };
32
+ }, R = [/[+-]\d\d:?(\d\d)?|Z/, function(t) {
33
+ (this.zone || (this.zone = {})).offset = (function(e) {
34
+ if (!e || e === "Z") return 0;
35
+ var r = e.match(/([+-]|\d\d)/g), n = 60 * r[1] + (+r[2] || 0);
36
+ return n === 0 ? 0 : r[0] === "+" ? -n : n;
37
+ })(t);
38
+ }], j = function(t) {
39
+ var e = v[t];
40
+ return e && (e.indexOf ? e : e.s.concat(e.f));
41
+ }, V = function(t, e) {
42
+ var r, n = v.meridiem;
43
+ if (n) {
44
+ for (var d = 1; d <= 24; d += 1) if (t.indexOf(n(d, 0, e)) > -1) {
45
+ r = d > 12;
46
+ break;
47
+ }
48
+ } else r = t === (e ? "pm" : "PM");
49
+ return r;
50
+ }, K = { A: [O, function(t) {
51
+ this.afternoon = V(t, !1);
52
+ }], a: [O, function(t) {
53
+ this.afternoon = V(t, !0);
54
+ }], Q: [M, function(t) {
55
+ this.month = 3 * (t - 1) + 1;
56
+ }], S: [M, function(t) {
57
+ this.milliseconds = 100 * +t;
58
+ }], SS: [h, function(t) {
59
+ this.milliseconds = 10 * +t;
60
+ }], SSS: [/\d{3}/, function(t) {
61
+ this.milliseconds = +t;
62
+ }], s: [i, o("seconds")], ss: [i, o("seconds")], m: [i, o("minutes")], mm: [i, o("minutes")], H: [i, o("hours")], h: [i, o("hours")], HH: [i, o("hours")], hh: [i, o("hours")], D: [i, o("day")], DD: [h, o("day")], Do: [O, function(t) {
63
+ var e = v.ordinal, r = t.match(/\d+/);
64
+ if (this.day = r[0], e) for (var n = 1; n <= 31; n += 1) e(n).replace(/\[|\]/g, "") === t && (this.day = n);
65
+ }], w: [i, o("week")], ww: [h, o("week")], M: [i, o("month")], MM: [h, o("month")], MMM: [O, function(t) {
66
+ var e = j("months"), r = (j("monthsShort") || e.map((function(n) {
67
+ return n.slice(0, 3);
68
+ }))).indexOf(t) + 1;
69
+ if (r < 1) throw new Error();
70
+ this.month = r % 12 || r;
71
+ }], MMMM: [O, function(t) {
72
+ var e = j("months").indexOf(t) + 1;
73
+ if (e < 1) throw new Error();
74
+ this.month = e % 12 || e;
75
+ }], Y: [/[+-]?\d+/, o("year")], YY: [h, function(t) {
76
+ this.year = N(t);
77
+ }], YYYY: [/\d{4}/, o("year")], Z: R, ZZ: R };
78
+ function W(t) {
79
+ var e, r;
80
+ e = t, r = v && v.formats;
81
+ for (var n = (t = e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(y, Y, f) {
82
+ var u = f && f.toUpperCase();
83
+ return Y || r[f] || x[f] || r[u].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(D, g, L) {
84
+ return g || L.slice(1);
85
+ }));
86
+ }))).match(c), d = n.length, l = 0; l < d; l += 1) {
87
+ var S = n[l], w = K[S], m = w && w[0], p = w && w[1];
88
+ n[l] = p ? { regex: m, parser: p } : S.replace(/^\[|\]$/g, "");
89
+ }
90
+ return function(y) {
91
+ for (var Y = {}, f = 0, u = 0; f < d; f += 1) {
92
+ var D = n[f];
93
+ if (typeof D == "string") u += D.length;
94
+ else {
95
+ var g = D.regex, L = D.parser, F = y.slice(u), P = g.exec(F)[0];
96
+ L.call(Y, P), y = y.replace(P, "");
97
+ }
98
+ }
99
+ return (function($) {
100
+ var b = $.afternoon;
101
+ if (b !== void 0) {
102
+ var a = $.hours;
103
+ b ? a < 12 && ($.hours += 12) : a === 12 && ($.hours = 0), delete $.afternoon;
104
+ }
105
+ })(Y), Y;
106
+ };
107
+ }
108
+ return function(t, e, r) {
109
+ r.p.customParseFormat = !0, t && t.parseTwoDigitYear && (N = t.parseTwoDigitYear);
110
+ var n = e.prototype, d = n.parse;
111
+ n.parse = function(l) {
112
+ var S = l.date, w = l.utc, m = l.args;
113
+ this.$u = w;
114
+ var p = m[1];
115
+ if (typeof p == "string") {
116
+ var y = m[2] === !0, Y = m[3] === !0, f = y || Y, u = m[2];
117
+ Y && (u = m[2]), v = this.$locale(), !y && u && (v = r.Ls[u]), this.$d = (function(F, P, $, b) {
118
+ try {
119
+ if (["x", "X"].indexOf(P) > -1) return new Date((P === "X" ? 1e3 : 1) * F);
120
+ var a = W(P)(F), C = a.year, A = a.month, tt = a.day, et = a.hours, rt = a.minutes, nt = a.seconds, ot = a.milliseconds, B = a.zone, G = a.week, z = /* @__PURE__ */ new Date(), H = tt || (C || A ? 1 : z.getDate()), E = C || z.getFullYear(), _ = 0;
121
+ C && !A || (_ = A > 0 ? A - 1 : z.getMonth());
122
+ var T, U = et || 0, q = rt || 0, Q = nt || 0, X = ot || 0;
123
+ return B ? new Date(Date.UTC(E, _, H, U, q, Q, X + 60 * B.offset * 1e3)) : $ ? new Date(Date.UTC(E, _, H, U, q, Q, X)) : (T = new Date(E, _, H, U, q, Q, X), G && (T = b(T).week(G).toDate()), T);
124
+ } catch {
125
+ return /* @__PURE__ */ new Date("");
126
+ }
127
+ })(S, p, w, r), this.init(), u && u !== !0 && (this.$L = this.locale(u).$L), f && S != this.format(p) && (this.$d = /* @__PURE__ */ new Date("")), v = {};
128
+ } else if (p instanceof Array) for (var D = p.length, g = 1; g <= D; g += 1) {
129
+ m[1] = p[g - 1];
130
+ var L = r.apply(this, m);
131
+ if (L.isValid()) {
132
+ this.$d = L.$d, this.$L = L.$L, this.init();
133
+ break;
134
+ }
135
+ g === D && (this.$d = /* @__PURE__ */ new Date(""));
136
+ }
137
+ else d.call(this, l);
138
+ };
139
+ };
140
+ }));
141
+ })(k)), k.exports;
142
+ }
143
+ var J = ut();
144
+ const ft = /* @__PURE__ */ st(J), ht = /* @__PURE__ */ at({
145
+ __proto__: null,
146
+ default: ft
147
+ }, [J]);
148
+ export {
149
+ ht as c
150
+ };
package/dist/index.d.ts CHANGED
@@ -146,4 +146,8 @@ export declare const VerticalLayoutRenderer: ({ uischema, schema, path, renderer
146
146
 
147
147
  export declare const VerticalLayoutTester: RankedTester;
148
148
 
149
+ export declare const XmlControl: ComponentType<OwnPropsOfControl>;
150
+
151
+ export declare const XmlControlTester: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => number;
152
+
149
153
  export { }
@@ -1 +1 @@
1
- /*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-300:oklch(80.8% .114 19.571);--color-blue-50:oklch(97% .014 254.604);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--spacing:.25rem;--font-weight-semibold:600;--tracking-wide:.025em;--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mt-1{margin-top:var(--spacing)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.table{display:table}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-300{border-color:var(--color-red-300)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-red-50{background-color:var(--color-red-50)}.p-6{padding:calc(var(--spacing) * 6)}.text-center{text-align:center}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-gray-500{color:var(--color-gray-500)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}@media(hover:hover){.hover\:border-blue-400:hover{border-color:var(--color-blue-400)}.hover\:bg-\(--gray-3\):hover{background-color:var(--gray-3)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
1
+ /*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-300:oklch(80.8% .114 19.571);--color-blue-50:oklch(97% .014 254.604);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--spacing:.25rem;--font-weight-semibold:600;--tracking-wide:.025em;--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.collapse{visibility:collapse}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mt-1{margin-top:var(--spacing)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.table{display:table}.grow{flex-grow:1}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-blue-500{border-color:var(--color-blue-500)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-300{border-color:var(--color-red-300)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-red-50{background-color:var(--color-red-50)}.p-6{padding:calc(var(--spacing) * 6)}.text-center{text-align:center}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-gray-500{color:var(--color-gray-500)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}@media(hover:hover){.hover\:border-blue-400:hover{border-color:var(--color-blue-400)}.hover\:bg-\(--gray-3\):hover{background-color:var(--gray-3)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
@@ -1,3 +1,3 @@
1
- "use strict";var wt=Object.create;var je=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty;var At=(e,n,r)=>n in e?je(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var Ft=(e,n,r,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let x of Rt(n))!St.call(e,x)&&x!==r&&je(e,x,{get:()=>n[x],enumerable:!(l=Ct(n,x))||l.enumerable});return e};var Re=(e,n,r)=>(r=e!=null?wt(Et(e)):{},Ft(n||!e||!e.__esModule?je(r,"default",{value:e,enumerable:!0}):r,e));var Ee=(e,n,r)=>At(e,typeof n!="symbol"?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),b=require("react"),y=require("@jsonforms/core"),H=require("@jsonforms/react"),o=require("@radix-ui/themes"),ee=require("@radix-ui/react-icons"),Ot=require("dayjs"),Se=require("@e965/xlsx"),Me=b.createContext(null);function It({children:e,onUpload:n,getDownloadUrl:r}){const l={onUpload:n,getDownloadUrl:r};return t.jsx(Me.Provider,{value:l,children:e})}function ze(){return b.useContext(Me)}const De=b.createContext(null);function Nt({children:e,services:n}){const r=b.useMemo(()=>n,[n]);return t.jsx(De.Provider,{value:r,children:e})}function Ue(e){const n=b.useContext(De);return!n||!e?null:n[e]??null}const se=(e,n,r,l=void 0)=>{b.useEffect(()=>{e===!1&&r(n,l)},[e,n,r,l])},le=(e,n)=>e?e.split(`
2
- `).map(r=>r.trim()==="is a required property"?`${n||"This field"} is required`:r).join(`
3
- `):"",Be=({data:e,handleChange:n,path:r,label:l,required:x,errors:c,uischema:i,schema:u,enabled:s,visible:a=!0})=>{var m;if(se(a,r,n),a===!1)return null;const d=c.length===0;return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[l," ",x&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.TextField.Root,{value:e||"",onChange:h=>n(r,h.target.value),disabled:!s,placeholder:(m=i.options)==null?void 0:m.placeholder,color:d?void 0:"red",id:r}),!d&&t.jsx(o.Text,{color:"red",size:"1",children:le(c,l)}),u.description&&t.jsx(o.Text,{size:"1",color:"gray",children:u.description})]})})},Pe=y.rankWith(1,y.isStringControl),kt=H.withJsonFormsControlProps(Be),He=({data:e,handleChange:n,path:r,label:l,required:x,errors:c,uischema:i,schema:u,enabled:s,visible:a=!0})=>{var h;if(se(a,r,n),a===!1)return null;const d=c.length===0,m=p=>{if(p===""){n(r,void 0);return}const g=Number(p);isNaN(g)||n(r,g)};return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[l," ",x&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.TextField.Root,{type:"number",value:e??"",onChange:p=>m(p.target.value),disabled:!s,placeholder:(h=i.options)==null?void 0:h.placeholder,color:d?void 0:"red",id:r}),!d&&t.jsx(o.Text,{color:"red",size:"1",children:le(c,l)}),u.description&&t.jsx(o.Text,{size:"1",color:"gray",children:u.description})]})})},We=y.rankWith(2,y.or(y.isNumberControl,y.isIntegerControl)),Lt=H.withJsonFormsControlProps(He),$e=({data:e,handleChange:n,path:r,label:l,required:x,errors:c,schema:i,enabled:u,visible:s=!0})=>{if(se(s,r,n),s===!1)return null;const a=c.length===0;return t.jsxs(o.Box,{mb:"4",children:[t.jsxs(o.Flex,{gap:"2",align:"center",children:[t.jsx(o.Checkbox,{checked:!!e,onCheckedChange:d=>n(r,d===!0),disabled:!u,id:r}),t.jsxs(o.Text,{as:"label",size:"2",htmlFor:r,children:[l," ",x&&"*"]})]}),!a&&t.jsx(o.Text,{color:"red",size:"1",className:"block mt-1",children:le(c,l)}),i.description&&t.jsx(o.Text,{size:"1",color:"gray",className:"block mt-1",children:i.description})]})},_e=y.rankWith(2,y.isBooleanControl),Mt=H.withJsonFormsControlProps($e),Ve=({data:e,handleChange:n,path:r,label:l,required:x,errors:c,schema:i,enabled:u,visible:s=!0})=>{if(se(s,r,n),s===!1)return null;const a=c.length===0;let d=[];i.enum?d=i.enum.map(h=>({value:h,label:String(h)})):i.oneOf&&(d=i.oneOf.map(h=>({value:h.const,label:h.title||String(h.const)})));const m=e;return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"div",size:"2",weight:"bold",children:[l," ",x&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.RadioGroup.Root,{value:m!==void 0?String(m):"",onValueChange:h=>{const p=d.find(g=>String(g.value)===h);p&&n(r,p.value)},disabled:!u,children:t.jsx(o.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:d.map(h=>t.jsxs(o.Flex,{align:"center",gap:"2",style:{minWidth:"max-content"},children:[t.jsx(o.RadioGroup.Item,{value:String(h.value)}),t.jsx(o.Text,{size:"2",color:u?void 0:"gray",children:h.label})]},String(h.value)))})}),!a&&t.jsx(o.Text,{color:"red",size:"1",children:le(c,l)}),i.description&&t.jsx(o.Text,{size:"1",color:"gray",children:i.description})]})})},Je=(e,n,r)=>{var x;return y.or(y.isEnumControl,y.isOneOfControl)(e,n,r)&&((x=e==null?void 0:e.options)==null?void 0:x.format)==="radio"?3:-1},zt=H.withJsonFormsControlProps(Ve),Ke=({data:e,handleChange:n,path:r,label:l,required:x,errors:c,schema:i,uischema:u,enabled:s,visible:a=!0})=>{var p;if(se(a,r,n),a===!1)return null;const d=c.length===0;let m=[];i.enum?m=i.enum.map(g=>({value:String(g),label:String(g)})):i.oneOf&&(m=i.oneOf.map(g=>({value:String(g.const),label:g.title||String(g.const)})));const h=e!==void 0?String(e):"";return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[l," ",x&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsxs(o.Select.Root,{value:h,onValueChange:g=>n(r,g),disabled:!s,children:[t.jsx(o.Select.Trigger,{placeholder:((p=u.options)==null?void 0:p.placeholder)||"Select an option",color:d?void 0:"red",id:r}),t.jsx(o.Select.Content,{children:m.map(g=>t.jsx(o.Select.Item,{value:g.value,children:g.label},g.value))})]}),!d&&t.jsx(o.Text,{color:"red",size:"1",children:le(c,l)}),i.description&&t.jsx(o.Text,{size:"1",color:"gray",children:i.description})]})})},Ge=y.rankWith(2,y.or(y.isEnumControl,y.isOneOfControl)),Dt=H.withJsonFormsControlProps(Ke),Ut={"small-list":{fetchOnOpen:!0,searchable:!1,paginated:!1},"large-searchable-list":{fetchOnOpen:!0,searchable:!0,paginated:!1},"large-paginated-list":{fetchOnOpen:!1,searchable:!0,paginated:!0}},Bt=({data:e,handleChange:n,path:r,label:l,required:x,errors:c,enabled:i,visible:u=!0,schema:s,uischema:a})=>{var pe;const d=(s==null?void 0:s["x-search"])??{service:""},m=d.service??"",h=d.mode??"large-paginated-list",p=Ut[h],g=(p==null?void 0:p.fetchOnOpen)??!1,S=d.params,R=Ue(m),v=s.type==="object",A=v?typeof e=="string"?{value:e}:e??void 0:void 0,N=v?A==null?void 0:A.value:e,L=A==null?void 0:A.label,w=m?R?p?null:`Invalid x-search.mode "${h}". Expected "small-list", "large-searchable-list", or "large-paginated-list".`:`Search service "${m}" is not registered.`:"Search not configured.",z=i!==!1,P=!c||c.length===0,[F,E]=b.useState(!1),[M,W]=b.useState(""),[re,Y]=b.useState([]),[ne,J]=b.useState(!1),[X,Z]=b.useState(!1),[ce,te]=b.useState(!1),[ie,T]=b.useState(null),[I,D]=b.useState(void 0),C=b.useRef(void 0),U=b.useRef(null),K=b.useRef(null),q=b.useRef(null),$=b.useRef(void 0);b.useEffect(()=>{var j,G;if(!N){D(void 0),$.current=void 0;return}if(((j=$.current)==null?void 0:j.value)===N&&((G=$.current)==null?void 0:G.label)===L)return;if($.current={value:N,label:L},v&&L){D({id:N,name:L});return}if(D({id:N,name:L??N}),!(R!=null&&R.resolve))return;let f=!1;return R.resolve(N,S).then(Q=>{!f&&Q&&D(Q)}).catch(()=>{}),()=>{f=!0}},[N,L,v,R,S]);const xe=b.useCallback(async(f,j=!1)=>{var Q;if(!R){T("Search service not configured.");return}(Q=K.current)==null||Q.abort();const G=new AbortController;K.current=G,j?te(!0):(Z(!0),te(!1),T(null));try{const oe=await R.search({query:f,cursor:j?C.current:void 0,signal:G.signal,params:S}),k=oe.options??[];Y(j?jt=>[...jt,...k]:k),C.current=oe.nextCursor,J(((p==null?void 0:p.paginated)??!1)&&oe.nextCursor!=null)}catch{if(G.signal.aborted)return;T("Failed to load results. Please try again.")}finally{G.signal.aborted||(j?te(!1):Z(!1))}},[R,p==null?void 0:p.paginated,S]);if(b.useEffect(()=>{if(!F)return;const f=j=>{q.current&&!q.current.contains(j.target)&&E(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[F]),b.useEffect(()=>{var f;F||((f=K.current)==null||f.abort(),W(""),Y([]),J(!1),T(null),Z(!1),te(!1),C.current=void 0)},[F]),b.useEffect(()=>{if(!F)return;if(!M&&!g){Y([]),J(!1),T(null),C.current=void 0;return}U.current&&clearTimeout(U.current);const f=M?300:0;return U.current=setTimeout(()=>{Y([]),J(!1),C.current=void 0,xe(M)},f),()=>{U.current&&clearTimeout(U.current)}},[M,F,g,xe]),se(u,r,n,v?void 0:null),u===!1)return null;const he=()=>{W(""),Y([]),J(!1),T(null),C.current=void 0,E(!0)},be=f=>{n(r,v?{value:f.id,label:f.name}:f.id),D(f),$.current={value:f.id,label:v?f.name:void 0},E(!1)},ge=f=>{f.stopPropagation(),n(r,v?void 0:null),D(void 0)},ve=f=>{(f.key==="Enter"||f.key===" ")&&ge(f)},Te=((pe=a==null?void 0:a.options)==null?void 0:pe.placeholder)??"Select an option";return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:r,children:[l," ",x&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsxs("div",{ref:q,style:{position:"relative"},children:[t.jsx(o.TextField.Root,{id:r,value:F?M:(I==null?void 0:I.name)??"",placeholder:F&&(p!=null&&p.searchable)?"Search...":Te,disabled:!z,readOnly:F&&!(p!=null&&p.searchable),style:P?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:f=>{p!=null&&p.searchable&&(W(f.target.value),F||he())},onFocus:()=>{z&&!F&&he()},onKeyDown:f=>{f.key==="Escape"&&E(!1)},children:t.jsx(o.TextField.Slot,{side:"right",children:t.jsxs(o.Flex,{align:"center",gap:"1",children:[N&&z&&t.jsx("span",{role:"button",tabIndex:0,onMouseDown:f=>f.preventDefault(),onClick:ge,onKeyDown:ve,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),t.jsx(ee.ChevronDownIcon,{style:{transform:F?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),F&&t.jsx(o.Box,{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:50,background:"var(--color-panel-solid)",borderRadius:"var(--radius-3)",boxShadow:"var(--shadow-5)",border:"1px solid var(--gray-a6)",overflow:"hidden"},children:w?t.jsx(o.Box,{p:"3",children:t.jsx(o.Text,{size:"2",color:"gray",children:w})}):t.jsx(o.ScrollArea,{style:{maxHeight:240},children:t.jsxs(o.Box,{p:"1",children:[X&&t.jsx(o.Flex,{justify:"center",p:"4",children:t.jsx(o.Spinner,{})}),!X&&ie&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Text,{size:"2",color:"red",children:ie})}),!X&&!ie&&re.length===0&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Text,{size:"2",color:"gray",children:M||g?"No results found.":"Type to search…"})}),re.map(f=>t.jsx(o.Box,{px:"3",py:"2",onMouseDown:j=>j.preventDefault(),onClick:()=>be(f),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:f.id===N?"var(--accent-3)":void 0},className:"hover:bg-(--gray-3)",children:t.jsx(o.Text,{size:"2",children:f.name})},f.id)),(p==null?void 0:p.paginated)&&ne&&!ce&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Button,{variant:"ghost",size:"1",style:{width:"100%"},onMouseDown:f=>f.preventDefault(),onClick:()=>void xe(M,!0),children:"Load more"})}),ce&&t.jsx(o.Flex,{justify:"center",p:"2",children:t.jsx(o.Spinner,{})})]})})})]}),!P&&t.jsx(o.Text,{color:"red",size:"1",children:le(c,l)}),s.description&&t.jsx(o.Text,{size:"1",color:"gray",children:s.description})]})})},Xe=H.withJsonFormsControlProps(Bt),qe=y.rankWith(3,y.schemaMatches(e=>{const n=e["x-search"];return(e.type==="string"||e.type==="object")&&typeof(n==null?void 0:n.service)=="string"&&n.service!==""})),Pt=(e,n)=>Ot(`${e}T${n}`).format(),Ht=({path:e,label:n,required:r,errors:l,description:x,children:c})=>{const i=l.length===0;return t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:e,children:[n," ",r&&t.jsx(o.Text,{color:"red",children:"*"})]}),c,!i&&t.jsx(o.Text,{color:"red",size:"1",children:le(l,n)}),x&&t.jsx(o.Text,{size:"1",color:"gray",children:x})]})})},Ye=({data:e,handleChange:n,path:r,label:l,required:x,errors:c,schema:i,enabled:u,visible:s=!0})=>{if(b.useEffect(()=>{s===!1&&n(r,void 0)},[s,r,n]),s===!1)return null;const a=c.length===0,d=typeof e=="string"?e:"",m=v=>t.jsx(Ht,{path:r,label:l,required:x,errors:c,description:i.description,children:v});if(i.format==="time")return m(t.jsx(o.TextField.Root,{type:"time",value:d,onChange:v=>n(r,v.target.value),disabled:!u,color:a?void 0:"red",id:r}));const h=i.format==="date-time",[p="",g=""]=d.split("T"),S=g.slice(0,5),R=(v,A)=>{if(!v){n(r,void 0);return}n(r,h?Pt(v,A||"00:00"):v)};return m(t.jsxs(o.Flex,{gap:"2",align:"center",children:[t.jsx(o.TextField.Root,{type:"date",value:p,disabled:!u,color:a?void 0:"red",onChange:v=>R(v.target.value,S),id:r,style:{flex:1}}),h&&t.jsx(o.TextField.Root,{type:"time",value:S,disabled:!u||!p,color:a?void 0:"red",onChange:v=>R(p,v.target.value),style:{flex:1}})]}))},Ze=y.rankWith(2,y.or(y.isDateControl,y.isDateTimeControl,y.isTimeControl)),Wt=H.withJsonFormsControlProps(Ye),Qe=({uischema:e,schema:n,path:r,renderers:l,cells:x,enabled:c,visible:i=!0})=>{const s=e.elements;return i===!1?null:t.jsx(o.Flex,{direction:"column",gap:"4",children:s.map((a,d)=>t.jsx(H.JsonFormsDispatch,{uischema:a,schema:n,path:r,renderers:l,cells:x,enabled:c},`${r}-${d}`))})},et=y.rankWith(1,y.uiTypeIs("VerticalLayout")),tt=({uischema:e,schema:n,path:r,renderers:l,cells:x,enabled:c,visible:i=!0})=>{const s=e.elements;return i===!1?null:t.jsx(o.Flex,{direction:"row",gap:"4",children:s.map((a,d)=>t.jsx(o.Box,{style:{flex:1},children:t.jsx(H.JsonFormsDispatch,{uischema:a,schema:n,path:r,renderers:l,cells:x,enabled:c})},`${r}-${d}`))})},rt=y.rankWith(1,y.uiTypeIs("HorizontalLayout")),nt=({uischema:e,schema:n,path:r,renderers:l,cells:x,enabled:c,visible:i=!0})=>{const u=e,s=u.elements;return i===!1?null:t.jsxs(o.Box,{mb:"6",children:[u.label&&t.jsx(o.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:u.label}),t.jsx(o.Flex,{direction:"column",gap:"4",children:s.map((a,d)=>t.jsx(H.JsonFormsDispatch,{uischema:a,schema:n,path:r,renderers:l,cells:x,enabled:c},`${r}-${d}`))})]})},ot=y.rankWith(1,y.uiTypeIs("Group")),st=({uischema:e,schema:n,path:r,renderers:l,cells:x,enabled:c,visible:i=!0})=>{var h;const s=e.elements.filter(p=>p.type==="Category"),[a,d]=b.useState(((h=s[0])==null?void 0:h.label)||"");if(i===!1||!s.length)return null;const m=s.find(p=>p.label===a)?a:s[0].label;return t.jsxs(o.Tabs.Root,{value:m,onValueChange:d,children:[t.jsx(o.Tabs.List,{children:s.map((p,g)=>t.jsx(o.Tabs.Trigger,{value:p.label,children:p.label},`${r}-${g}`))}),t.jsx(o.Box,{pt:"3",children:s.map((p,g)=>t.jsx(o.Tabs.Content,{value:p.label,children:t.jsx(o.Flex,{direction:"column",gap:"4",children:p.elements.map((S,R)=>t.jsx(H.JsonFormsDispatch,{uischema:S,schema:n,path:r,renderers:l,cells:x,enabled:c},`${r}-${g}-${R}`))})},`${r}-${g}`))})]})},lt=y.rankWith(1,y.uiTypeIs("Categorization"));function ue(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function de(e){return e.split(",").map(n=>{if(n=n.trim(),n.endsWith("/*"))return n.split("/")[0].toUpperCase()+"S";if(n.startsWith("."))return n.slice(1).toUpperCase();const r=n.split("/")[1];return r?r.toUpperCase():n}).join(", ")}function $t(e){return e?Array.isArray(e)?e:[e]:[]}const _t=({data:e,handleChange:n,path:r,label:l,required:x,uischema:c,schema:i,enabled:u,errors:s,visible:a=!0})=>{const d=ze();se(a,r,n,null);const m=!s||s.length===0,h=(i==null?void 0:i["x-file"])??{},p=(c==null?void 0:c.options)??{},g=h.maxFiles??p.maxFiles??1,S=h.maxSize??p.maxSize??5*1024*1024,R=h.accept??p.accept??"image/*,application/pdf",v=g>1,A=u!==!1,[N,L]=b.useState(!1),[w,z]=b.useState(null),[P,F]=b.useState({}),E=b.useRef(new Set),M=b.useRef(null),W=$t(e),re=W.length>=g;b.useEffect(()=>()=>{E.current.forEach(T=>URL.revokeObjectURL(T)),E.current.clear()},[]);const Y=b.useCallback(async T=>{if(z(null),W.length>=g){z(`Maximum ${g} file${g>1?"s":""} allowed.`);return}if(T.size>S){z(`File exceeds the ${ue(S)} limit.`);return}if(!R.split(",").map(C=>C.trim()).some(C=>C==="*"||C==="*/*"?!0:C.endsWith("/*")?T.type.startsWith(C.slice(0,-1)):C.startsWith(".")?T.name.toLowerCase().endsWith(C.toLowerCase()):T.type===C)){z(`Invalid type. Accepted: ${de(R)}`);return}if(!(d!=null&&d.onUpload)){z("Upload service not configured.");return}try{const C=await d.onUpload(T),U=URL.createObjectURL(T);E.current.add(U);const K={key:C.key,name:C.name??T.name,blobUrl:U};F($=>({...$,[C.key]:K}));const q=[...W,C.key];n(r,v?q:q[0])}catch{z("Upload failed. Please try again."),M.current&&(M.current.value="")}},[W,g,S,R,d,r,n,v]);if(a===!1)return null;const ne=T=>{T.preventDefault(),T.stopPropagation(),!(!A||re)&&L(T.type==="dragenter"||T.type==="dragover")},J=T=>{var I;T.preventDefault(),T.stopPropagation(),L(!1),!(!A||re)&&(I=T.dataTransfer.files)!=null&&I[0]&&Y(T.dataTransfer.files[0])},X=T=>{var I;(I=T.target.files)!=null&&I[0]&&(Y(T.target.files[0]),T.target.value="")},Z=T=>{if(!A)return;F(D=>{var K;const C={...D},U=(K=C[T])==null?void 0:K.blobUrl;return U&&(URL.revokeObjectURL(U),E.current.delete(U)),delete C[T],C});const I=W.filter(D=>D!==T);n(r,v?I.length>0?I:null:I[0]??null)},ce=async(T,I)=>{var U,K,q;T.preventDefault();const D=(U=P[I])==null?void 0:U.blobUrl;if(D){(K=window.open(D,"_blank","noopener,noreferrer"))==null||K.focus();return}const C=window.open("","_blank");if(C)try{const $=await((q=d==null?void 0:d.getDownloadUrl)==null?void 0:q.call(d,I));$!=null&&$.url?C.location.href=$.url:C.close()}catch{C.close()}};if(!A&&W.length===0)return null;const te=g-W.length,ie=A&&!re;return t.jsxs(o.Box,{mb:"4",children:[t.jsxs(o.Flex,{align:"center",justify:"between",mb:"2",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",children:[l,x&&t.jsx(o.Text,{color:"red",children:" *"})]}),t.jsx(o.Text,{size:"1",color:"gray",children:v?`Up to ${g} files · ${ue(S)} each · ${de(R)}`:`${ue(S)} · ${de(R)}`})]}),W.map(T=>{var I;return t.jsx(o.Card,{size:"2",variant:"surface",mb:"2",children:t.jsxs(o.Flex,{align:"center",gap:"3",children:[t.jsx(o.Box,{style:{background:"var(--blue-3)",padding:8,borderRadius:6,color:"var(--blue-9)",flexShrink:0},children:t.jsx(ee.FileTextIcon,{width:"20",height:"20"})}),t.jsx(o.Box,{style:{flex:1,overflow:"hidden"},children:t.jsx(o.Text,{size:"2",weight:"bold",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((I=P[T])==null?void 0:I.name)??"Uploaded File"})}),t.jsxs(o.Flex,{align:"center",gap:"2",style:{flexShrink:0},children:[t.jsx(o.Button,{variant:"soft",color:"blue",size:"1",onClick:D=>ce(D,T),children:"View"}),t.jsx(ee.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),A&&t.jsx(o.IconButton,{variant:"ghost",color:"gray",onClick:()=>Z(T),children:t.jsx(ee.Cross2Icon,{})})]})]})},T)}),ie&&t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var T;return(T=M.current)==null?void 0:T.click()},onKeyDown:T=>{var I;(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),(I=M.current)==null||I.click())},onDragEnter:ne,onDragLeave:ne,onDragOver:ne,onDrop:J,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",N?"border-blue-500 bg-blue-50":w?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[t.jsx("input",{ref:M,type:"file",style:{display:"none"},accept:R,onChange:X}),t.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:w?t.jsxs(t.Fragment,{children:[t.jsx(ee.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),t.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:w}),t.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):t.jsxs(t.Fragment,{children:[t.jsx(ee.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),t.jsx(o.Text,{size:"2",weight:"medium",children:W.length>0?`Add another file (${te} remaining)`:"Click to upload or drag and drop"}),t.jsxs(o.Text,{size:"1",color:"gray",children:[ue(S)," max · ",de(R)]})]})})]}),A&&re&&v&&t.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",g," files uploaded. Remove one to replace it."]}),!m&&t.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:le(s,l)})]})},it=H.withJsonFormsControlProps(_t),ct=y.rankWith(10,y.and(y.schemaMatches(e=>{if(e.type==="string"&&e.format==="file")return!0;if(e.type==="array"){const n=e.items;return(n==null?void 0:n.type)==="string"&&(n==null?void 0:n.format)==="file"}return!1})));function Vt(e,n){return e!==!1&&n!==!0}class we extends Error{}function Jt(e,n){const r=Se.read(e,{type:"array",cellDates:!0});if(r.SheetNames.length===0)throw new we("This file has no sheets.");const l=n??r.SheetNames[0],x=r.Sheets[l];if(!x)throw new we(`This file doesn't have a sheet named "${l}".`);const c=Se.utils.sheet_to_json(x,{header:1,raw:!0,defval:null});return{sheetName:l,matrix:c,rowCount:c.length,colCount:Math.max(0,...c.map(i=>i.length))}}function Kt(e){let n=e+1,r="";for(;n>0;){const l=(n-1)%26;r=String.fromCharCode(65+l)+r,n=Math.floor((n-1)/26)}return r}class V extends Error{constructor(r,l){super(l??r);Ee(this,"code");this.code=r,this.name="FormulaError"}}const Gt=["IFS","IFERROR","AND","OR","NOT","ROUND","ROUNDUP","ROUNDDOWN","INDEX","VLOOKUP","HLOOKUP","SUM","AVERAGE","COUNT","DATE","TODAY"],Xt=["MAX","MIN","MAXA","MINA","MEDIAN","LARGE","SMALL","PERMUT","PERMUTATIONA","MATCH","SWITCH","SUBSTITUTE","TEXTJOIN","COUNTA","UPPER"],qt=["YEAR","MONTH","DAY","WEEKDAY"],Yt=["IF"],Zt=["CONCATENATE","CONCAT","LEN","TRIM","LOWER","LEFT","RIGHT","MID","FIND","SEARCH"],Qt=new Set([...Gt,...Xt,...qt,...Zt,...Yt]),er=/"(?:[^"]|"")*"/g,Ae=new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(","g");function tr(e){const n=e.replace(er,l=>" ".repeat(l.length));Ae.lastIndex=0;let r;for(;(r=Ae.exec(n))!==null;){const l=r[1].toUpperCase();if(!Qt.has(l))throw new V("NAME",`Function ${l} is not allowed.`)}}function rr(e,n,r){let l=e;if(l==null)throw r.NA;if(typeof l=="object"&&!(l instanceof r)&&(l=n.retrieveRef(l)),l instanceof r)throw l;if(typeof l=="boolean")return l;if(typeof l=="number")return l!==0;throw r.VALUE}function at(e){return e!==null&&typeof e=="object"&&"value"in e?e.value:e}function ae(e){const n=at(e);return Array.isArray(n)?n.flat(1/0):[n]}function O(e){const n=at(e);return Array.isArray(n)?n.flat(1/0)[0]:n}function ye(e){return e===void 0?void 0:O(e)}function _(e){return e==null||e===""?"":typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof Date?e.toLocaleDateString():String(e)}function nr(e,n){return e instanceof n?e:new n(e.message||"#ERROR!")}function B(e){return e.find(n=>n instanceof Error)}function or(e,n){const r=c=>{throw nr(c,n)},l=(c,{checkArgsForErrors:i=!0}={})=>(...u)=>{const s=u.flatMap(ae);if(i){const d=B(s);d&&r(d)}const a=c(...s);return a instanceof Error?r(a):a},x=(c,{toText:i=!1}={})=>u=>{const s=O(u),a=B([s]);a&&r(a);const d=c(i?_(s):s);return d instanceof Error?r(d):d};return{IF:(c,i,u,s)=>{const a=rr(i,c,n);if(u==null)throw n.NA;return a?u:s??!1},MAX:l(e.MAX),MIN:l(e.MIN),MAXA:l(e.MAXA),MINA:l(e.MINA),MEDIAN:l(e.MEDIAN),COUNTA:l(e.COUNTA,{checkArgsForErrors:!1}),LARGE:(c,i)=>{const u=ae(c),s=O(i),a=B([...u,s]);a&&r(a);const d=e.LARGE(u,s);return d instanceof Error?r(d):d},SMALL:(c,i)=>{const u=ae(c),s=O(i),a=B([...u,s]);a&&r(a);const d=e.SMALL(u,s);return d instanceof Error?r(d):d},PERMUT:(c,i)=>{const u=[O(c),O(i)],s=B(u);s&&r(s);const a=e.PERMUT(u[0],u[1]);return a instanceof Error?r(a):a},PERMUTATIONA:(c,i)=>{const u=[O(c),O(i)],s=B(u);s&&r(s);const a=e.PERMUTATIONA(u[0],u[1]);return a instanceof Error?r(a):a},MATCH:(c,i)=>{const u=O(c),s=ae(i),a=B([u,...s]);a&&r(a);const d=e.MATCH(u,s,0);return d instanceof Error?r(d):d},SWITCH:(...c)=>{const i=c.map(O),u=B(i);u&&r(u);const s=e.SWITCH(...i);return s instanceof Error?r(s):s},SUBSTITUTE:(c,i,u,s)=>{const a=[_(O(c)),_(O(i)),_(O(u))];s!==void 0&&a.push(O(s));const d=B(a);d&&r(d);const m=e.SUBSTITUTE(...a);return m instanceof Error?r(m):m},TEXTJOIN:(c,i,...u)=>{const s=_(O(c)),a=O(i),d=u.flatMap(ae).map(_),m=B([s,a]);m&&r(m);const h=e.TEXTJOIN(s,a,d);return h instanceof Error?r(h):h},UPPER:x(e.UPPER),YEAR:x(e.YEAR),MONTH:x(e.MONTH),DAY:x(e.DAY),WEEKDAY:(c,i)=>{const u=O(c),s=O(i),a=B([u]);a&&r(a);const d=e.WEEKDAY(u,s);return d instanceof Error?r(d):d},CONCATENATE:(...c)=>{const i=c.flatMap(ae),u=B(i);u&&r(u);const s=e.CONCATENATE(...i.map(_));return s instanceof Error?r(s):s},CONCAT:(...c)=>{const i=c.flatMap(ae),u=B(i);u&&r(u);const s=e.CONCAT(...i.map(_));return s instanceof Error?r(s):s},LEN:x(e.LEN,{toText:!0}),TRIM:x(e.TRIM,{toText:!0}),LOWER:x(e.LOWER,{toText:!0}),LEFT:(c,i)=>{const u=O(c),s=ye(i),a=B([u]);a&&r(a);const d=e.LEFT(_(u),s);return d instanceof Error?r(d):d},RIGHT:(c,i)=>{const u=O(c),s=ye(i),a=B([u]);a&&r(a);const d=e.RIGHT(_(u),s);return d instanceof Error?r(d):d},MID:(c,i,u)=>{const s=O(c),a=O(i),d=O(u),m=B([s,a,d]);m&&r(m);const h=e.MID(_(s),a,d);return h instanceof Error?r(h):h},FIND:(c,i,u)=>{const s=O(c),a=O(i),d=ye(u),m=B([s,a]);m&&r(m);const h=e.FIND(_(s),_(a),d);return h instanceof Error?r(h):h},SEARCH:(c,i,u)=>{const s=O(c),a=O(i),d=ye(u),m=B([s,a]);m&&r(m);const h=e.SEARCH(_(s),_(a),d);return h instanceof Error?r(h):h}}}const sr={"#REF!":"REF","#VALUE!":"VALUE","#DIV/0!":"DIV0","#NAME?":"NAME","#N/A":"NA","#NUM!":"NUM","#NULL!":"NULL"};function Fe(e){return sr[e.error]??"ERROR"}function Oe(e,n){if(e instanceof V)return e;if(e instanceof n){const r=e.details;return r instanceof V?r:r instanceof n?new V(Fe(r),r.message):new V(Fe(e),e.message)}return new V("ERROR",e instanceof Error?e.message:void 0)}function lr(e){return Math.max(0,...e.map(n=>(n==null?void 0:n.length)??0))}function ir(e){return n=>{const r=e[n.row-1];if(n.row<1||n.col<1||r==null||n.col-1>=r.length)throw new V("REF");const l=r[n.col-1];return l==null||l===""?null:l}}function cr(e){return n=>{const r=Math.min(n.from.row,n.to.row),l=Math.min(n.from.col,n.to.col),x=Math.max(n.from.row,n.to.row),c=Math.max(n.from.col,n.to.col),i=lr(e);if(r>e.length||l>i)throw new V("REF");const u=Math.min(x,e.length),s=[];for(let a=r;a<=u;a++){const d=e[a-1],m=[];if(d!=null){const h=Math.min(c,d.length);for(let p=l;p<=h;p++){const g=d[p-1];m.push(g==null||g===""?null:g)}}s.push(m)}return s}}function ar(e){if(e==null||e==="")return null;if(typeof e=="number"||typeof e=="string"||typeof e=="boolean"||e instanceof Date)return e;throw new V("VALUE")}async function ut(e,n){if(typeof e!="string")throw new V("ERROR");const r=e.trim();if(r==="")throw new V("ERROR");const l=r.startsWith("=")?r.slice(1):r;tr(l);const[x,c]=await Promise.all([import("fast-formula-parser"),import("@formulajs/formulajs")]),i=x.default??x,u=i.FormulaError,s=new i({...n,functions:or(c,u)});let a;try{a=s.parse(l,{row:1,col:1,sheet:"Sheet1"})}catch(d){throw Oe(d,u)}if(a instanceof u)throw Oe(a,u);return ar(a)}async function ur(e,n){return ut(n,{onCell:ir(e),onRange:cr(e)})}const Ie=-1;async function dr(e,n){const r=Object.keys(e);return ut(n,{onVariable:l=>{const x=r.indexOf(l);return x===-1?null:{row:Ie,col:x+1}},onCell:l=>{if(l.row===Ie)return e[r[l.col-1]]??null;throw new V("REF")},onRange:()=>{throw new V("REF")}})}const dt={REF:"#REF!",VALUE:"#VALUE!",DIV0:"#DIV/0!",NAME:"#NAME?",ERROR:"#ERROR!",NA:"#N/A",NUM:"#NUM!",NULL:"#NULL!"};function ft(e){const n=e instanceof V?e.code:"ERROR";return dt[n]}async function fr(e,n){return e.length===0?n.map(r=>({id:typeof(r==null?void 0:r.id)=="string"?r.id:"(unknown)",label:(r==null?void 0:r.label)??"(unknown)",value:null,error:dt.ERROR})):Promise.all(n.map(async r=>{try{if(!r||typeof r.label!="string"||typeof r.expression!="string"||typeof r.id!="string")throw new V("ERROR");return{id:r.id,label:r.label,value:await ur(e,r.expression)}}catch(l){return{id:typeof(r==null?void 0:r.id)=="string"?r.id:"(unknown)",label:(r==null?void 0:r.label)??"(unknown)",value:null,error:ft(l)}}}))}function xr(e,n={}){if(n.columnHeader&&n.rowHeader)throw new Error("x-spreadsheet: columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape.");return n.columnHeader?hr(e):n.rowHeader?pr(e):e}function xt(e){return e==null||e===""?null:e instanceof Date?e.toISOString():String(e)}function ht(e,n){const r=new Set;for(const l of e)if(l!=null){if(r.has(l))throw new Error(`x-spreadsheet: duplicate ${n} value "${l}" — every ${n==="columnHeader"?"column header":"column-A value"} must be unique to shape as records.`);r.add(l)}}function hr(e){const[n,...r]=e;if(!n)return[];const l=n.map(xt);return ht(l,"columnHeader"),r.map(x=>{const c=Object.create(null);return l.forEach((i,u)=>{i!=null&&(c[i]=x[u]??null)}),c})}function pr(e){const n=e.map(x=>xt(x[0]));ht(n,"rowHeader");const r=Math.max(0,...e.map(x=>x.length)),l=Math.max(0,r-1);return Array.from({length:l},(x,c)=>{const i=c+1,u=Object.create(null);return n.forEach((s,a)=>{s!=null&&(u[s]=e[a][i]??null)}),u})}function Ne(e){return!Array.isArray(e[0])}async function mr(e,n,r={}){const l=await fr(e,n),x=Object.create(null);for(const{id:c,label:i,value:u,error:s}of l)x[c]=s===void 0?{label:i,value:u}:{label:i,value:u,error:s};return r.persistSheet===!1?{derivations:x}:{sheet:xr(e,r),derivations:x}}const gr=".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv",Tr=10*1024*1024,fe=200,ke=50,yr=[];function me(e){return e==null||e===""?"":e instanceof Date?e.toLocaleDateString():String(e)}const br=({data:e,handleChange:n,path:r,label:l,required:x,schema:c,enabled:i,readonly:u,errors:s,visible:a=!0})=>{se(a,r,n,null);const d=!s||s.length===0,m=Vt(i,u),h=(c==null?void 0:c["x-spreadsheet"])??{},p=(c==null?void 0:c["x-evaluate"])??yr,g=h.accept??gr,S=h.maxSize??Tr,R=h.persistSheet!==!1,v=h.columnHeader===!0,A=h.rowHeader===!0,N=h.showSheet!==!1,L=h.sheetName,w=e??null,[z,P]=b.useState(()=>w!=null&&w.sheet||Object.keys((w==null?void 0:w.derivations)??{}).length>0?"ready":"empty"),[F,E]=b.useState(null),[M,W]=b.useState(!1),[re,Y]=b.useState(null),ne=b.useRef(null),J=(w==null?void 0:w.sheet)??null,X=re??(J&&!Ne(J)?J:null),Z=re==null&&J&&Ne(J)?J:null,ce=(w==null?void 0:w.derivations)??{},te=X!=null||w!=null,ie=b.useCallback(async f=>{if(E(null),f.size>S){E(`File exceeds the ${ue(S)} limit.`);return}if(!g.split(",").map(k=>k.trim()).some(k=>k==="*"||k==="*/*"?!0:k.endsWith("/*")?f.type.startsWith(k.slice(0,-1)):k.startsWith(".")?f.name.toLowerCase().endsWith(k.toLowerCase()):f.type===k)){E(`Invalid type. Accepted: ${de(g)}`);return}P("parsing");let Q;try{const k=await f.arrayBuffer();Q=Jt(k,L).matrix}catch(k){P("error"),E(k instanceof we?k.message:"This doesn't look like a valid spreadsheet. Please check the file and try again.");return}Y(Q);let oe;try{oe=await mr(Q,p,{persistSheet:R,columnHeader:v,rowHeader:A})}catch(k){P("error"),E(k instanceof Error?k.message:"Failed to process the uploaded spreadsheet.");return}n(r,oe),P("ready")},[g,S,R,v,A,L,p,r,n]);if(a===!1)return null;if(v&&A)return t.jsxs(o.Box,{mb:"4",children:[t.jsx(o.Text,{as:"label",size:"2",weight:"bold",children:l}),t.jsx(o.Text,{size:"2",color:"red",style:{display:"block"},children:"Invalid x-spreadsheet config: columnHeader and rowHeader cannot both be true — pick one orientation."})]});if(!m&&!te)return null;const T=f=>{f.preventDefault(),f.stopPropagation(),m&&W(f.type==="dragenter"||f.type==="dragover")},I=f=>{var j;f.preventDefault(),f.stopPropagation(),W(!1),m&&(j=f.dataTransfer.files)!=null&&j[0]&&ie(f.dataTransfer.files[0])},D=f=>{var j;(j=f.target.files)!=null&&j[0]&&(ie(f.target.files[0]),f.target.value="")},C=()=>{m&&(Y(null),E(null),P("empty"),n(r,null))},U=v?1:0,K=A?1:0,q=X?X.slice(U):[],$=q.slice(0,fe),xe=Math.min(ke,Math.max(0,...$.map(f=>Math.max(0,f.length-K)))),he=Array.from({length:xe},(f,j)=>j+K),be=N&&X==null&&Z==null&&w!=null,ge="",ve=A&&!v,Te=Z?Z.slice(0,fe):[],pe=Array.from(new Set(Te.flatMap(f=>Object.keys(f)))).slice(0,ke);return t.jsxs(o.Box,{mb:"4",children:[t.jsxs(o.Flex,{align:"center",justify:"between",mb:"2",children:[t.jsxs(o.Flex,{align:"center",gap:"1",children:[t.jsxs(o.Text,{as:"label",size:"2",weight:"bold",children:[l,x&&t.jsx(o.Text,{color:"red",children:" *"})]}),te&&m&&t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{content:"Replace spreadsheet",children:t.jsx(o.IconButton,{variant:"ghost",size:"1",onClick:()=>{var f;return(f=ne.current)==null?void 0:f.click()},"aria-label":"Replace spreadsheet",children:t.jsx(ee.UploadIcon,{})})}),t.jsx(o.Tooltip,{content:"Remove spreadsheet",children:t.jsx(o.IconButton,{variant:"ghost",size:"1",color:"gray",onClick:C,"aria-label":"Remove spreadsheet",children:t.jsx(ee.Cross2Icon,{})})})]})]}),t.jsxs(o.Text,{size:"1",color:"gray",children:[ue(S)," max · ",de(g)]})]}),te&&F&&t.jsx(o.Text,{size:"2",color:"red",mb:"2",style:{display:"block"},children:F}),t.jsx("input",{ref:ne,type:"file",style:{display:"none"},accept:g,onChange:D}),m&&!te&&t.jsx("div",{role:"button",tabIndex:0,onClick:()=>{var f;return(f=ne.current)==null?void 0:f.click()},onKeyDown:f=>{var j;(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),(j=ne.current)==null||j.click())},onDragEnter:T,onDragLeave:T,onDragOver:T,onDrop:I,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",M?"border-blue-500 bg-blue-50":F?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:t.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:z==="parsing"?t.jsxs(t.Fragment,{children:[t.jsx(o.Spinner,{size:"3"}),t.jsx(o.Text,{size:"2",color:"gray",children:"Parsing spreadsheet…"})]}):F?t.jsxs(t.Fragment,{children:[t.jsx(ee.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),t.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:F}),t.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):t.jsxs(t.Fragment,{children:[t.jsx(ee.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),t.jsx(o.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),t.jsxs(o.Text,{size:"1",color:"gray",children:[ue(S)," max · ",de(g)]})]})})}),X&&N&&t.jsxs(o.Box,{mt:"3",children:[t.jsx(o.Box,{style:{overflow:"auto",maxHeight:420},children:t.jsxs(o.Table.Root,{variant:"surface",size:"1",children:[!ve&&t.jsx(o.Table.Header,{children:t.jsxs(o.Table.Row,{children:[t.jsx(o.Table.ColumnHeaderCell,{children:ge}),he.map(f=>{var j;return t.jsx(o.Table.ColumnHeaderCell,{children:v?me((j=X[0])==null?void 0:j[f]):Kt(f)},f)})]})}),t.jsx(o.Table.Body,{children:$.map((f,j)=>{var Q;const G=U+j;return t.jsxs(o.Table.Row,{children:[t.jsx(o.Table.RowHeaderCell,{style:A?{fontWeight:700,background:"var(--gray-a3)"}:void 0,children:A?me((Q=X[G])==null?void 0:Q[0]):v?"":G+1}),he.map(oe=>t.jsx(o.Table.Cell,{children:me(f[oe])},oe))]},j)})})]})}),q.length>fe&&t.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block"},children:["Showing first ",fe," of ",q.length," rows"]})]}),Z&&N&&t.jsxs(o.Box,{mt:"3",children:[t.jsx(o.Box,{style:{overflow:"auto",maxHeight:420},children:t.jsxs(o.Table.Root,{variant:"surface",size:"1",children:[t.jsx(o.Table.Header,{children:t.jsxs(o.Table.Row,{children:[t.jsx(o.Table.ColumnHeaderCell,{}),pe.map(f=>t.jsx(o.Table.ColumnHeaderCell,{children:f},f))]})}),t.jsx(o.Table.Body,{children:Te.map((f,j)=>t.jsxs(o.Table.Row,{children:[t.jsx(o.Table.RowHeaderCell,{children:j+1}),pe.map(G=>t.jsx(o.Table.Cell,{children:me(f[G])},G))]},j))})]})}),Z.length>fe&&t.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block"},children:["Showing first ",fe," of ",Z.length," rows"]})]}),be&&t.jsx(o.Text,{size:"2",color:"gray",mt:"3",style:{display:"block"},children:"Sheet preview not stored for this field — re-upload to view contents."}),Object.keys(ce).length>0&&t.jsxs(o.Box,{mt:"3",children:[t.jsx(o.Text,{size:"2",weight:"bold",as:"div",mb:"1",children:"Computed values"}),t.jsx(o.Flex,{direction:"column",gap:"1",children:Object.entries(ce).map(([f,j])=>t.jsxs(o.Flex,{justify:"between",children:[t.jsx(o.Text,{size:"2",children:j.label}),j.error?t.jsx(o.Text,{size:"2",color:"red",children:j.error}):t.jsx(o.Text,{size:"2",children:me(j.value)})]},f))})]}),!d&&t.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:le(s,l)})]})},pt=H.withJsonFormsControlProps(br),mt=y.rankWith(10,y.schemaMatches(e=>e.type==="object"&&typeof e["x-spreadsheet"]=="object"));function vr(e,n,r){const l={};for(const[x,c]of Object.entries(r)){const{path:i,default:u}=typeof c=="string"?{path:c,default:void 0}:c,s=n?`${n}.${i}`:i,a=y.Resolve.data(e,s);if(a==null){if(u===void 0)return;l[x]=u}else l[x]=a}return l}async function jr(e,n){try{return{status:"ok",value:await dr(e,n)}}catch(r){return{status:"error",error:ft(r)}}}function wr(e,n){return e==null?"":typeof e=="number"?e.toFixed(Cr(n)):e instanceof Date?e.toLocaleDateString():String(e)}function Cr(e){return Number.isFinite(e)?Math.min(100,Math.max(0,Math.trunc(e))):0}const Le="{value}",Rr=2,Er={},Sr=({data:e,handleChange:n,path:r,label:l,schema:x,visible:c=!0})=>{var z;se(c,r,n,null);const i=x==null?void 0:x["x-computed"],u=(i==null?void 0:i.inputs)??Er,s=(i==null?void 0:i.formula)??"",a=(i==null?void 0:i.format)??Le,d=(i==null?void 0:i.decimals)??Rr,m=H.useJsonForms(),h=r.split(".").slice(0,-1).join("."),p=vr((z=m.core)==null?void 0:z.data,h,u),g=p?JSON.stringify(p):null,S=m.readonly===!0,[R,v]=b.useState(()=>typeof e=="number"?"ok":"unavailable"),[A,N]=b.useState(()=>typeof e=="number"?e:null),[L,w]=b.useState(null);return b.useEffect(()=>{if(!c)return;let P=!1;const F=E=>{S||E!==(e??null)&&n(r,E)};if(p===void 0){v("unavailable"),w(null),N(null),F(null);return}return v(E=>E==="ok"?E:"loading"),jr(p,s).then(E=>{if(P)return;const M=E.status==="ok"&&typeof E.value=="number"&&Number.isFinite(E.value)?E.value:null;if(M===null){v("error"),w(E.status==="error"?E.error??"Unable to compute value.":"Computed value must be a number."),N(null),F(null);return}v("ok"),w(null),N(M),F(M)}),()=>{P=!0}},[g,s,c,S]),c===!1?null:t.jsx(o.Box,{mb:"4",children:t.jsxs(o.Flex,{direction:"column",gap:"1",children:[t.jsx(o.Text,{as:"label",size:"2",weight:"bold",children:l}),R==="unavailable"?t.jsx(o.Text,{size:"2",color:"gray",children:"Not yet available."}):R==="loading"?t.jsxs(o.Flex,{align:"center",gap:"2",children:[t.jsx(o.Spinner,{size:"1"}),t.jsx(o.Text,{size:"2",color:"gray",children:"Computing…"})]}):R==="error"?t.jsx(o.Text,{size:"2",color:"red",children:L}):t.jsx(o.Text,{size:"2",children:a.split(Le).join(wr(A,d))}),x.description&&t.jsx(o.Text,{size:"1",color:"gray",children:x.description})]})})},gt=H.withJsonFormsControlProps(Sr),Tt=y.rankWith(5,y.schemaMatches(e=>{const n=e["x-computed"];return e.type==="number"&&typeof n=="object"&&n!==null})),Ar=({data:e,path:n,schema:r,uischema:l,enabled:x,visible:c,addItem:i,removeItems:u,rootSchema:s,arraySchema:a})=>{const d=a?r:r.items,m=a||r;if(c===!1||!d||typeof d!="object"||Array.isArray(d))return null;const h=d,p=Array.isArray(e)?e:[],g=m.title||"Array Items",S=l.options??{},R=x&&S.addable!==!1,v=x&&S.removable!==!1,A=()=>{const L=y.createDefaultValue(h,s);i&&i(n,L)()},N=L=>{if(u){const w=u(n,[L]);w&&w()}};return t.jsx(o.Box,{mb:"6",children:t.jsxs(o.Flex,{direction:"column",gap:"4",children:[t.jsx(o.Text,{as:"div",size:"4",weight:"bold",children:g}),p.length===0&&t.jsx(o.Box,{py:"4",px:"4",style:{backgroundColor:"var(--gray-3)",borderRadius:"var(--radius-3)"},children:t.jsx(o.Text,{size:"2",color:"gray",children:"No items have been added yet."})}),p.map((L,w)=>{var P;const z=`${n}.${w}`;return t.jsx(o.Card,{size:"3",variant:"surface",children:t.jsxs(o.Flex,{direction:"column",gap:"4",children:[t.jsxs(o.Flex,{justify:"between",align:"center",children:[t.jsxs(o.Text,{size:"3",weight:"bold",children:["Item ",w+1]}),v&&t.jsxs(o.Button,{type:"button",color:"red",variant:"soft",onClick:()=>N(w),title:"Remove item",children:[t.jsx(ee.TrashIcon,{}),"Remove"]})]}),t.jsx(o.Box,{children:t.jsx(H.JsonFormsDispatch,{schema:h,uischema:((P=l.options)==null?void 0:P.detail)||(h.type==="object"||h.properties?{type:"VerticalLayout",elements:Object.keys(h.properties||{}).map(F=>({type:"Control",scope:`#/properties/${F}`}))}:{type:"Control",scope:"#"}),path:z,enabled:x,renderers:void 0,cells:void 0})})]})},z)}),R&&t.jsx(o.Box,{mt:"2",children:t.jsxs(o.Button,{type:"button",variant:"surface",onClick:A,children:[t.jsx(ee.PlusIcon,{}),"Add Item"]})})]})})},Ce=H.withJsonFormsArrayControlProps(Ar),yt=y.rankWith(3,y.isObjectArrayControl),bt=({uischema:e,visible:n})=>{const r=e;return n===!1?null:t.jsx(o.Box,{mb:"4",children:t.jsx(o.Heading,{size:"4",children:r.text})})},vt=y.rankWith(1,y.uiTypeIs("Label")),Fr=y.rankWith(3,y.isPrimitiveArrayControl),Or=[{tester:Pe,renderer:kt},{tester:We,renderer:Lt},{tester:_e,renderer:Mt},{tester:Je,renderer:zt},{tester:qe,renderer:Xe},{tester:Ge,renderer:Dt},{tester:Ze,renderer:Wt},{tester:et,renderer:Qe},{tester:rt,renderer:tt},{tester:ot,renderer:nt},{tester:lt,renderer:st},{tester:ct,renderer:it},{tester:mt,renderer:pt},{tester:Tt,renderer:gt},{tester:yt,renderer:Ce},{tester:Fr,renderer:Ce},{tester:vt,renderer:bt}];exports.ArrayControl=Ce;exports.ArrayControlTester=yt;exports.BooleanControl=$e;exports.BooleanControlTester=_e;exports.CategorizationLayoutRenderer=st;exports.CategorizationLayoutTester=lt;exports.ComputedControl=gt;exports.ComputedControlTester=Tt;exports.DateControl=Ye;exports.DateControlTester=Ze;exports.FileControl=it;exports.FileControlTester=ct;exports.GroupLayoutRenderer=nt;exports.GroupLayoutTester=ot;exports.HorizontalLayoutRenderer=tt;exports.HorizontalLayoutTester=rt;exports.LabelRenderer=bt;exports.LabelTester=vt;exports.NumberControl=He;exports.NumberControlTester=We;exports.RadioControl=Ve;exports.RadioControlTester=Je;exports.SearchSelectControl=Xe;exports.SearchSelectControlTester=qe;exports.SearchServiceProvider=Nt;exports.SelectControl=Ke;exports.SelectControlTester=Ge;exports.SpreadsheetControl=pt;exports.SpreadsheetControlTester=mt;exports.TextControl=Be;exports.TextControlTester=Pe;exports.UploadProvider=It;exports.VerticalLayoutRenderer=Qe;exports.VerticalLayoutTester=et;exports.radixRenderers=Or;exports.useSearchService=Ue;exports.useUpload=ze;
1
+ "use strict";var Mt=Object.create;var Se=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var Ut=Object.getOwnPropertyNames;var Pt=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty;var $t=(e,n,t)=>n in e?Se(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var _t=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of Ut(n))!Bt.call(e,c)&&c!==t&&Se(e,c,{get:()=>n[c],enumerable:!(s=zt(n,c))||s.enumerable});return e};var ve=(e,n,t)=>(t=e!=null?Mt(Pt(e)):{},_t(n||!e||!e.__esModule?Se(t,"default",{value:e,enumerable:!0}):t,e));var Me=(e,n,t)=>$t(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),y=require("react"),w=require("@jsonforms/core"),G=require("@jsonforms/react"),o=require("@radix-ui/themes"),Z=require("@radix-ui/react-icons"),Wt=require("dayjs"),Je=y.createContext(null);function Vt({children:e,onUpload:n,getDownloadUrl:t}){const s={onUpload:n,getDownloadUrl:t};return r.jsx(Je.Provider,{value:s,children:e})}function Ke(){return y.useContext(Je)}const Ge=y.createContext(null);function Ht({children:e,services:n}){const t=y.useMemo(()=>n,[n]);return r.jsx(Ge.Provider,{value:t,children:e})}function Ye(e){const n=y.useContext(Ge);return!n||!e?null:n[e]??null}const fe=(e,n,t,s=void 0)=>{y.useEffect(()=>{e===!1&&t(n,s)},[e,n,t,s])},le=(e,n)=>e?e.split(`
2
+ `).map(t=>t.trim()==="is a required property"?`${n||"This field"} is required`:t).join(`
3
+ `):"",qe=({data:e,handleChange:n,path:t,label:s,required:c,errors:i,uischema:l,schema:u,enabled:a,visible:f=!0})=>{var x;if(fe(f,t,n),f===!1)return null;const d=i.length===0;return r.jsx(o.Box,{mb:"4",children:r.jsxs(o.Flex,{direction:"column",gap:"1",children:[r.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[s," ",c&&r.jsx(o.Text,{color:"red",children:"*"})]}),r.jsx(o.TextField.Root,{value:e||"",onChange:h=>n(t,h.target.value),disabled:!a,placeholder:(x=l.options)==null?void 0:x.placeholder,color:d?void 0:"red",id:t}),!d&&r.jsx(o.Text,{color:"red",size:"1",children:le(i,s)}),u.description&&r.jsx(o.Text,{size:"1",color:"gray",children:u.description})]})})},Ze=w.rankWith(1,w.isStringControl),Xt=G.withJsonFormsControlProps(qe),Qe=({data:e,handleChange:n,path:t,label:s,required:c,errors:i,uischema:l,schema:u,enabled:a,visible:f=!0})=>{var h;if(fe(f,t,n),f===!1)return null;const d=i.length===0,x=m=>{if(m===""){n(t,void 0);return}const v=Number(m);isNaN(v)||n(t,v)};return r.jsx(o.Box,{mb:"4",children:r.jsxs(o.Flex,{direction:"column",gap:"1",children:[r.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[s," ",c&&r.jsx(o.Text,{color:"red",children:"*"})]}),r.jsx(o.TextField.Root,{type:"number",value:e??"",onChange:m=>x(m.target.value),disabled:!a,placeholder:(h=l.options)==null?void 0:h.placeholder,color:d?void 0:"red",id:t}),!d&&r.jsx(o.Text,{color:"red",size:"1",children:le(i,s)}),u.description&&r.jsx(o.Text,{size:"1",color:"gray",children:u.description})]})})},et=w.rankWith(2,w.or(w.isNumberControl,w.isIntegerControl)),Jt=G.withJsonFormsControlProps(Qe),tt=({data:e,handleChange:n,path:t,label:s,required:c,errors:i,schema:l,enabled:u,visible:a=!0})=>{if(fe(a,t,n),a===!1)return null;const f=i.length===0;return r.jsxs(o.Box,{mb:"4",children:[r.jsxs(o.Flex,{gap:"2",align:"center",children:[r.jsx(o.Checkbox,{checked:!!e,onCheckedChange:d=>n(t,d===!0),disabled:!u,id:t}),r.jsxs(o.Text,{as:"label",size:"2",htmlFor:t,children:[s," ",c&&"*"]})]}),!f&&r.jsx(o.Text,{color:"red",size:"1",className:"block mt-1",children:le(i,s)}),l.description&&r.jsx(o.Text,{size:"1",color:"gray",className:"block mt-1",children:l.description})]})},rt=w.rankWith(2,w.isBooleanControl),Kt=G.withJsonFormsControlProps(tt),nt=({data:e,handleChange:n,path:t,label:s,required:c,errors:i,schema:l,enabled:u,visible:a=!0})=>{if(fe(a,t,n),a===!1)return null;const f=i.length===0;let d=[];l.enum?d=l.enum.map(h=>({value:h,label:String(h)})):l.oneOf&&(d=l.oneOf.map(h=>({value:h.const,label:h.title||String(h.const)})));const x=e;return r.jsx(o.Box,{mb:"4",children:r.jsxs(o.Flex,{direction:"column",gap:"1",children:[r.jsxs(o.Text,{as:"div",size:"2",weight:"bold",children:[s," ",c&&r.jsx(o.Text,{color:"red",children:"*"})]}),r.jsx(o.RadioGroup.Root,{value:x!==void 0?String(x):"",onValueChange:h=>{const m=d.find(v=>String(v.value)===h);m&&n(t,m.value)},disabled:!u,children:r.jsx(o.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:d.map(h=>r.jsxs(o.Flex,{align:"center",gap:"2",style:{minWidth:"max-content"},children:[r.jsx(o.RadioGroup.Item,{value:String(h.value)}),r.jsx(o.Text,{size:"2",color:u?void 0:"gray",children:h.label})]},String(h.value)))})}),!f&&r.jsx(o.Text,{color:"red",size:"1",children:le(i,s)}),l.description&&r.jsx(o.Text,{size:"1",color:"gray",children:l.description})]})})},ot=(e,n,t)=>{var c;return w.or(w.isEnumControl,w.isOneOfControl)(e,n,t)&&((c=e==null?void 0:e.options)==null?void 0:c.format)==="radio"?3:-1},Gt=G.withJsonFormsControlProps(nt),st=({data:e,handleChange:n,path:t,label:s,required:c,errors:i,schema:l,uischema:u,enabled:a,visible:f=!0})=>{var U,$,N;fe(f,t,n);const d=((U=u.options)==null?void 0:U.autocomplete)===!0,[x,h]=y.useState(!1),[m,v]=y.useState(""),[D,A]=y.useState(0),j=y.useRef(null);if(y.useEffect(()=>{if(!d||!x)return;const T=b=>{j.current&&!j.current.contains(b.target)&&h(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[d,x]),f===!1)return null;const R=i.length===0;let S=[];l.enum?S=l.enum.map(T=>({value:String(T),label:String(T)})):l.oneOf&&(S=l.oneOf.map(T=>({value:String(T.const),label:T.title||String(T.const)})));const O=e!==void 0?String(e):"",I=(($=u.options)==null?void 0:$.placeholder)||"Select an option";if(d){const T=((N=S.find(E=>E.value===O))==null?void 0:N.label)??"",b=x?S.filter(E=>E.label.toLowerCase().includes(m.toLowerCase())):S,H=Math.min(D,b.length-1),X=E=>{n(t,E.value),h(!1)},_=E=>{E.stopPropagation(),n(t,void 0),v("")},J=E=>{(E.key==="Enter"||E.key===" ")&&_(E)};return r.jsx(o.Box,{mb:"4",children:r.jsxs(o.Flex,{direction:"column",gap:"1",children:[r.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[s," ",c&&r.jsx(o.Text,{color:"red",children:"*"})]}),r.jsxs("div",{ref:j,style:{position:"relative"},children:[r.jsx(o.TextField.Root,{id:t,value:x?m:T,placeholder:I,disabled:!a,style:R?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:E=>{v(E.target.value),A(0),x||h(!0)},onFocus:()=>{a&&!x&&(v(""),A(0),h(!0))},onKeyDown:E=>{E.key==="Escape"?h(!1):E.key==="ArrowDown"?(E.preventDefault(),x?A(Y=>Math.min(Y+1,b.length-1)):(v(""),h(!0))):E.key==="ArrowUp"?(E.preventDefault(),x&&A(Y=>Math.max(Y-1,0))):E.key==="Enter"&&x&&b[H]&&(E.preventDefault(),X(b[H]))},children:r.jsx(o.TextField.Slot,{side:"right",children:r.jsxs(o.Flex,{align:"center",gap:"1",children:[O&&a&&r.jsx("span",{role:"button",tabIndex:0,onMouseDown:E=>E.preventDefault(),onClick:_,onKeyDown:J,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),r.jsx(Z.ChevronDownIcon,{style:{transform:x?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),x&&r.jsx(o.Box,{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:50,background:"var(--color-panel-solid)",borderRadius:"var(--radius-3)",boxShadow:"var(--shadow-5)",border:"1px solid var(--gray-a6)",overflow:"hidden"},children:r.jsx(o.ScrollArea,{style:{maxHeight:240},children:r.jsxs(o.Box,{p:"1",children:[b.length===0&&r.jsx(o.Box,{px:"3",py:"2",children:r.jsx(o.Text,{size:"2",color:"gray",children:"No results found."})}),b.map((E,Y)=>r.jsx(o.Box,{px:"3",py:"2",onMouseDown:K=>K.preventDefault(),onClick:()=>X(E),onMouseEnter:()=>A(Y),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:Y===H?"var(--accent-4)":E.value===O?"var(--accent-3)":void 0},children:r.jsx(o.Text,{size:"2",children:E.label})},E.value))]})})})]}),!R&&r.jsx(o.Text,{color:"red",size:"1",children:le(i,s)}),l.description&&r.jsx(o.Text,{size:"1",color:"gray",children:l.description})]})})}return r.jsx(o.Box,{mb:"4",children:r.jsxs(o.Flex,{direction:"column",gap:"1",children:[r.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[s," ",c&&r.jsx(o.Text,{color:"red",children:"*"})]}),r.jsxs(o.Select.Root,{value:O,onValueChange:T=>n(t,T),disabled:!a,children:[r.jsx(o.Select.Trigger,{placeholder:I,color:R?void 0:"red",id:t}),r.jsx(o.Select.Content,{children:S.map(T=>r.jsx(o.Select.Item,{value:T.value,children:T.label},T.value))})]}),!R&&r.jsx(o.Text,{color:"red",size:"1",children:le(i,s)}),l.description&&r.jsx(o.Text,{size:"1",color:"gray",children:l.description})]})})},it=w.rankWith(2,w.or(w.isEnumControl,w.isOneOfControl)),Yt=G.withJsonFormsControlProps(st),qt={"small-list":{fetchOnOpen:!0,searchable:!1,paginated:!1},"large-searchable-list":{fetchOnOpen:!0,searchable:!0,paginated:!1},"large-paginated-list":{fetchOnOpen:!1,searchable:!0,paginated:!0}},Zt=({data:e,handleChange:n,path:t,label:s,required:c,errors:i,enabled:l,visible:u=!0,schema:a,uischema:f})=>{var C;const d=(a==null?void 0:a["x-search"])??{service:""},x=d.service??"",h=d.mode??"large-paginated-list",m=qt[h],v=(m==null?void 0:m.fetchOnOpen)??!1,D=d.params,A=Ye(x),j=a.type==="object",R=j?typeof e=="string"?{value:e}:e??void 0:void 0,S=j?R==null?void 0:R.value:e,O=R==null?void 0:R.label,I=x?A?m?null:`Invalid x-search.mode "${h}". Expected "small-list", "large-searchable-list", or "large-paginated-list".`:`Search service "${x}" is not registered.`:"Search not configured.",U=l!==!1,$=!i||i.length===0,[N,T]=y.useState(!1),[b,H]=y.useState(""),[X,_]=y.useState([]),[J,E]=y.useState(!1),[Y,K]=y.useState(!1),[ae,oe]=y.useState(!1),[ce,p]=y.useState(null),[F,W]=y.useState(void 0),k=y.useRef(void 0),z=y.useRef(null),Q=y.useRef(null),ee=y.useRef(null),te=y.useRef(void 0);y.useEffect(()=>{var V,L;if(!S){W(void 0),te.current=void 0;return}if(((V=te.current)==null?void 0:V.value)===S&&((L=te.current)==null?void 0:L.label)===O)return;if(te.current={value:S,label:O},j&&O){W({id:S,name:O});return}if(W({id:S,name:O??S}),!(A!=null&&A.resolve))return;let g=!1;return A.resolve(S,D).then(M=>{!g&&M&&W(M)}).catch(()=>{}),()=>{g=!0}},[S,O,j,A,D]);const P=y.useCallback(async(g,V=!1)=>{var M;if(!A){p("Search service not configured.");return}(M=Q.current)==null||M.abort();const L=new AbortController;Q.current=L,V?oe(!0):(K(!0),oe(!1),p(null));try{const se=await A.search({query:g,cursor:V?k.current:void 0,signal:L.signal,params:D}),xe=se.options??[];_(V?Re=>[...Re,...xe]:xe),k.current=se.nextCursor,E(((m==null?void 0:m.paginated)??!1)&&se.nextCursor!=null)}catch{if(L.signal.aborted)return;p("Failed to load results. Please try again.")}finally{L.signal.aborted||(V?oe(!1):K(!1))}},[A,m==null?void 0:m.paginated,D]);if(y.useEffect(()=>{if(!N)return;const g=V=>{ee.current&&!ee.current.contains(V.target)&&T(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[N]),y.useEffect(()=>{var g;N||((g=Q.current)==null||g.abort(),H(""),_([]),E(!1),p(null),K(!1),oe(!1),k.current=void 0)},[N]),y.useEffect(()=>{if(!N)return;if(!b&&!v){_([]),E(!1),p(null),k.current=void 0;return}z.current&&clearTimeout(z.current);const g=b?300:0;return z.current=setTimeout(()=>{_([]),E(!1),k.current=void 0,P(b)},g),()=>{z.current&&clearTimeout(z.current)}},[b,N,v,P]),fe(u,t,n),u===!1)return null;const be=()=>{H(""),_([]),E(!1),p(null),k.current=void 0,T(!0)},je=g=>{n(t,j?{value:g.id,label:g.name}:g.id),W(g),te.current={value:g.id,label:j?g.name:void 0},T(!1)},Te=g=>{g.stopPropagation(),n(t,void 0),W(void 0)},Ce=g=>{(g.key==="Enter"||g.key===" ")&&Te(g)},Ee=((C=f==null?void 0:f.options)==null?void 0:C.placeholder)??"Select an option";return r.jsx(o.Box,{mb:"4",children:r.jsxs(o.Flex,{direction:"column",gap:"1",children:[r.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[s," ",c&&r.jsx(o.Text,{color:"red",children:"*"})]}),r.jsxs("div",{ref:ee,style:{position:"relative"},children:[r.jsx(o.TextField.Root,{id:t,value:N?b:(F==null?void 0:F.name)??"",placeholder:N&&(m!=null&&m.searchable)?"Search...":Ee,disabled:!U,readOnly:N&&!(m!=null&&m.searchable),style:$?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:g=>{m!=null&&m.searchable&&(H(g.target.value),N||be())},onFocus:()=>{U&&!N&&be()},onKeyDown:g=>{g.key==="Escape"&&T(!1)},children:r.jsx(o.TextField.Slot,{side:"right",children:r.jsxs(o.Flex,{align:"center",gap:"1",children:[S&&U&&r.jsx("span",{role:"button",tabIndex:0,onMouseDown:g=>g.preventDefault(),onClick:Te,onKeyDown:Ce,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),r.jsx(Z.ChevronDownIcon,{style:{transform:N?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),N&&r.jsx(o.Box,{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:50,background:"var(--color-panel-solid)",borderRadius:"var(--radius-3)",boxShadow:"var(--shadow-5)",border:"1px solid var(--gray-a6)",overflow:"hidden"},children:I?r.jsx(o.Box,{p:"3",children:r.jsx(o.Text,{size:"2",color:"gray",children:I})}):r.jsx(o.ScrollArea,{style:{maxHeight:240},children:r.jsxs(o.Box,{p:"1",children:[Y&&r.jsx(o.Flex,{justify:"center",p:"4",children:r.jsx(o.Spinner,{})}),!Y&&ce&&r.jsx(o.Box,{px:"3",py:"2",children:r.jsx(o.Text,{size:"2",color:"red",children:ce})}),!Y&&!ce&&X.length===0&&r.jsx(o.Box,{px:"3",py:"2",children:r.jsx(o.Text,{size:"2",color:"gray",children:b||v?"No results found.":"Type to search…"})}),X.map(g=>r.jsx(o.Box,{px:"3",py:"2",onMouseDown:V=>V.preventDefault(),onClick:()=>je(g),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:g.id===S?"var(--accent-3)":void 0},className:"hover:bg-(--gray-3)",children:r.jsx(o.Text,{size:"2",children:g.name})},g.id)),(m==null?void 0:m.paginated)&&J&&!ae&&r.jsx(o.Box,{px:"3",py:"2",children:r.jsx(o.Button,{variant:"ghost",size:"1",style:{width:"100%"},onMouseDown:g=>g.preventDefault(),onClick:()=>void P(b,!0),children:"Load more"})}),ae&&r.jsx(o.Flex,{justify:"center",p:"2",children:r.jsx(o.Spinner,{})})]})})})]}),!$&&r.jsx(o.Text,{color:"red",size:"1",children:le(i,s)}),a.description&&r.jsx(o.Text,{size:"1",color:"gray",children:a.description})]})})},lt=G.withJsonFormsControlProps(Zt),at=w.rankWith(3,w.schemaMatches(e=>{const n=e["x-search"];return(e.type==="string"||e.type==="object")&&typeof(n==null?void 0:n.service)=="string"&&n.service!==""})),Qt=(e,n)=>Wt(`${e}T${n}`).format(),er=({path:e,label:n,required:t,errors:s,description:c,children:i})=>{const l=s.length===0;return r.jsx(o.Box,{mb:"4",children:r.jsxs(o.Flex,{direction:"column",gap:"1",children:[r.jsxs(o.Text,{as:"label",size:"2",weight:"bold",htmlFor:e,children:[n," ",t&&r.jsx(o.Text,{color:"red",children:"*"})]}),i,!l&&r.jsx(o.Text,{color:"red",size:"1",children:le(s,n)}),c&&r.jsx(o.Text,{size:"1",color:"gray",children:c})]})})},ct=({data:e,handleChange:n,path:t,label:s,required:c,errors:i,schema:l,enabled:u,visible:a=!0})=>{if(y.useEffect(()=>{a===!1&&n(t,void 0)},[a,t,n]),a===!1)return null;const f=i.length===0,d=typeof e=="string"?e:"",x=j=>r.jsx(er,{path:t,label:s,required:c,errors:i,description:l.description,children:j});if(l.format==="time")return x(r.jsx(o.TextField.Root,{type:"time",value:d,onChange:j=>n(t,j.target.value),disabled:!u,color:f?void 0:"red",id:t}));const h=l.format==="date-time",[m="",v=""]=d.split("T"),D=v.slice(0,5),A=(j,R)=>{if(!j){n(t,void 0);return}n(t,h?Qt(j,R||"00:00"):j)};return x(r.jsxs(o.Flex,{gap:"2",align:"center",children:[r.jsx(o.TextField.Root,{type:"date",value:m,disabled:!u,color:f?void 0:"red",onChange:j=>A(j.target.value,D),id:t,style:{flex:1}}),h&&r.jsx(o.TextField.Root,{type:"time",value:D,disabled:!u||!m,color:f?void 0:"red",onChange:j=>A(m,j.target.value),style:{flex:1}})]}))},ut=w.rankWith(2,w.or(w.isDateControl,w.isDateTimeControl,w.isTimeControl)),tr=G.withJsonFormsControlProps(ct),dt=({uischema:e,schema:n,path:t,renderers:s,cells:c,enabled:i,visible:l=!0})=>{const a=e.elements;return l===!1?null:r.jsx(o.Flex,{direction:"column",gap:"4",children:a.map((f,d)=>r.jsx(G.JsonFormsDispatch,{uischema:f,schema:n,path:t,renderers:s,cells:c,enabled:i},`${t}-${d}`))})},ft=w.rankWith(1,w.uiTypeIs("VerticalLayout")),ht=({uischema:e,schema:n,path:t,renderers:s,cells:c,enabled:i,visible:l=!0})=>{const a=e.elements;return l===!1?null:r.jsx(o.Flex,{direction:"row",gap:"4",children:a.map((f,d)=>r.jsx(o.Box,{style:{flex:1},children:r.jsx(G.JsonFormsDispatch,{uischema:f,schema:n,path:t,renderers:s,cells:c,enabled:i})},`${t}-${d}`))})},pt=w.rankWith(1,w.uiTypeIs("HorizontalLayout")),xt=({uischema:e,schema:n,path:t,renderers:s,cells:c,enabled:i,visible:l=!0})=>{const u=e,a=u.elements;return l===!1?null:r.jsxs(o.Box,{mb:"6",children:[u.label&&r.jsx(o.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:u.label}),r.jsx(o.Flex,{direction:"column",gap:"4",children:a.map((f,d)=>r.jsx(G.JsonFormsDispatch,{uischema:f,schema:n,path:t,renderers:s,cells:c,enabled:i},`${t}-${d}`))})]})},mt=w.rankWith(1,w.uiTypeIs("Group")),gt=({uischema:e,schema:n,path:t,renderers:s,cells:c,enabled:i,visible:l=!0})=>{var h;const a=e.elements.filter(m=>m.type==="Category"),[f,d]=y.useState(((h=a[0])==null?void 0:h.label)||"");if(l===!1||!a.length)return null;const x=a.find(m=>m.label===f)?f:a[0].label;return r.jsxs(o.Tabs.Root,{value:x,onValueChange:d,children:[r.jsx(o.Tabs.List,{children:a.map((m,v)=>r.jsx(o.Tabs.Trigger,{value:m.label,children:m.label},`${t}-${v}`))}),r.jsx(o.Box,{pt:"3",children:a.map((m,v)=>r.jsx(o.Tabs.Content,{value:m.label,children:r.jsx(o.Flex,{direction:"column",gap:"4",children:m.elements.map((D,A)=>r.jsx(G.JsonFormsDispatch,{uischema:D,schema:n,path:t,renderers:s,cells:c,enabled:i},`${t}-${v}-${A}`))})},`${t}-${v}`))})]})},yt=w.rankWith(1,w.uiTypeIs("Categorization"));function ue(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function de(e){const n=e.split(",").map(i=>i.trim()).filter(Boolean),t=n.filter(i=>i.startsWith(".")),c=(t.length>0?t:n).map(i=>{if(i.endsWith("/*"))return i.split("/")[0].toUpperCase()+"S";if(i.startsWith("."))return i.slice(1).toUpperCase();const l=i.split("/")[1];return l?l.toUpperCase():i});return[...new Set(c)].join(", ")}function rr(e){return e?Array.isArray(e)?e:[e]:[]}const nr=({data:e,handleChange:n,path:t,label:s,required:c,uischema:i,schema:l,enabled:u,errors:a,visible:f=!0})=>{const d=Ke();fe(f,t,n);const x=!a||a.length===0,h=(l==null?void 0:l["x-file"])??{},m=(i==null?void 0:i.options)??{},v=h.maxFiles??m.maxFiles??1,D=h.maxSize??m.maxSize??5*1024*1024,A=h.accept??m.accept??"image/*,application/pdf",j=v>1,R=u!==!1,[S,O]=y.useState(!1),[I,U]=y.useState(null),[$,N]=y.useState({}),T=y.useRef(new Set),b=y.useRef(null),H=rr(e),X=H.length>=v;y.useEffect(()=>()=>{T.current.forEach(p=>URL.revokeObjectURL(p)),T.current.clear()},[]);const _=y.useCallback(async p=>{if(U(null),H.length>=v){U(`Maximum ${v} file${v>1?"s":""} allowed.`);return}if(p.size>D){U(`File exceeds the ${ue(D)} limit.`);return}if(!A.split(",").map(k=>k.trim()).some(k=>k==="*"||k==="*/*"?!0:k.endsWith("/*")?p.type.startsWith(k.slice(0,-1)):k.startsWith(".")?p.name.toLowerCase().endsWith(k.toLowerCase()):p.type===k)){U(`Invalid type. Accepted: ${de(A)}`);return}if(!(d!=null&&d.onUpload)){U("Upload service not configured.");return}try{const k=await d.onUpload(p),z=URL.createObjectURL(p);T.current.add(z);const Q={key:k.key,name:k.name??p.name,blobUrl:z};N(te=>({...te,[k.key]:Q}));const ee=[...H,k.key];n(t,j?ee:ee[0])}catch{U("Upload failed. Please try again."),b.current&&(b.current.value="")}},[H,v,D,A,d,t,n,j]);if(f===!1)return null;const J=p=>{p.preventDefault(),p.stopPropagation(),!(!R||X)&&O(p.type==="dragenter"||p.type==="dragover")},E=p=>{var F;p.preventDefault(),p.stopPropagation(),O(!1),!(!R||X)&&(F=p.dataTransfer.files)!=null&&F[0]&&_(p.dataTransfer.files[0])},Y=p=>{var F;(F=p.target.files)!=null&&F[0]&&(_(p.target.files[0]),p.target.value="")},K=p=>{if(!R)return;N(W=>{var Q;const k={...W},z=(Q=k[p])==null?void 0:Q.blobUrl;return z&&(URL.revokeObjectURL(z),T.current.delete(z)),delete k[p],k});const F=H.filter(W=>W!==p);n(t,j?F.length>0?F:void 0:F[0])},ae=async(p,F)=>{var z,Q,ee;p.preventDefault();const W=(z=$[F])==null?void 0:z.blobUrl;if(W){(Q=window.open(W,"_blank","noopener,noreferrer"))==null||Q.focus();return}const k=window.open("","_blank");if(k)try{const te=await((ee=d==null?void 0:d.getDownloadUrl)==null?void 0:ee.call(d,F));te!=null&&te.url?k.location.href=te.url:k.close()}catch{k.close()}};if(!R&&H.length===0)return null;const oe=v-H.length,ce=R&&!X;return r.jsxs(o.Box,{mb:"4",children:[r.jsxs(o.Flex,{align:"center",justify:"between",mb:"2",children:[r.jsxs(o.Text,{as:"label",size:"2",weight:"bold",children:[s,c&&r.jsx(o.Text,{color:"red",children:" *"})]}),r.jsx(o.Text,{size:"1",color:"gray",children:j?`Up to ${v} files · ${ue(D)} each · ${de(A)}`:`${ue(D)} · ${de(A)}`})]}),H.map(p=>{var F;return r.jsx(o.Card,{size:"2",variant:"surface",mb:"2",children:r.jsxs(o.Flex,{align:"center",gap:"3",children:[r.jsx(o.Box,{style:{background:"var(--blue-3)",padding:8,borderRadius:6,color:"var(--blue-9)",flexShrink:0},children:r.jsx(Z.FileTextIcon,{width:"20",height:"20"})}),r.jsx(o.Box,{style:{flex:1,overflow:"hidden"},children:r.jsx(o.Text,{size:"2",weight:"bold",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((F=$[p])==null?void 0:F.name)??"Uploaded File"})}),r.jsxs(o.Flex,{align:"center",gap:"2",style:{flexShrink:0},children:[r.jsx(o.Button,{variant:"soft",color:"blue",size:"1",onClick:W=>ae(W,p),children:"View"}),r.jsx(Z.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),R&&r.jsx(o.IconButton,{variant:"ghost",color:"gray",onClick:()=>K(p),children:r.jsx(Z.Cross2Icon,{})})]})]})},p)}),ce&&r.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var p;return(p=b.current)==null?void 0:p.click()},onKeyDown:p=>{var F;(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),(F=b.current)==null||F.click())},onDragEnter:J,onDragLeave:J,onDragOver:J,onDrop:E,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",S?"border-blue-500 bg-blue-50":I?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[r.jsx("input",{ref:b,type:"file",style:{display:"none"},accept:A,onChange:Y}),r.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:I?r.jsxs(r.Fragment,{children:[r.jsx(Z.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),r.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:I}),r.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Z.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),r.jsx(o.Text,{size:"2",weight:"medium",children:H.length>0?`Add another file (${oe} remaining)`:"Click to upload or drag and drop"}),r.jsxs(o.Text,{size:"1",color:"gray",children:[ue(D)," max · ",de(A)]})]})})]}),R&&X&&j&&r.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",v," files uploaded. Remove one to replace it."]}),!x&&r.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:le(a,s)})]})},bt=G.withJsonFormsControlProps(nr),vt=w.rankWith(10,w.and(w.schemaMatches(e=>{if(e.type==="string"&&e.format==="file")return!0;if(e.type==="array"){const n=e.items;return(n==null?void 0:n.type)==="string"&&(n==null?void 0:n.format)==="file"}return!1})));function Tt(e,n){return e!==!1&&n!==!0}class Fe extends Error{}async function or(e,n){const{read:t,utils:s}=await import("@e965/xlsx"),c=t(e,{type:"array",cellDates:!0});if(c.SheetNames.length===0)throw new Fe("This file has no sheets.");const i=n??c.SheetNames[0],l=c.Sheets[i];if(!l)throw new Fe(`This file doesn't have a sheet named "${i}".`);const u=s.sheet_to_json(l,{header:1,raw:!0,defval:null});return{sheetName:i,matrix:u,rowCount:u.length,colCount:Math.max(0,...u.map(a=>a.length))}}function sr(e){let n=e+1,t="";for(;n>0;){const s=(n-1)%26;t=String.fromCharCode(65+s)+t,n=Math.floor((n-1)/26)}return t}class ne extends Error{constructor(t,s){super(s??t);Me(this,"code");this.code=t,this.name="FormulaError"}}const ir=["IFS","IFERROR","AND","OR","NOT","ROUND","ROUNDUP","ROUNDDOWN","INDEX","VLOOKUP","HLOOKUP","SUM","AVERAGE","COUNT","DATE","TODAY"],lr=["MAX","MIN","MAXA","MINA","MEDIAN","LARGE","SMALL","PERMUT","PERMUTATIONA","MATCH","SWITCH","SUBSTITUTE","TEXTJOIN","COUNTA","UPPER"],ar=["YEAR","MONTH","DAY","WEEKDAY"],cr=["IF"],ur=["CONCATENATE","CONCAT","LEN","TRIM","LOWER","LEFT","RIGHT","MID","FIND","SEARCH"],dr=new Set([...ir,...lr,...ar,...ur,...cr]),fr=/"(?:[^"]|"")*"/g,ze=new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(","g");function hr(e){const n=e.replace(fr,s=>" ".repeat(s.length));ze.lastIndex=0;let t;for(;(t=ze.exec(n))!==null;){const s=t[1].toUpperCase();if(!dr.has(s))throw new ne("NAME",`Function ${s} is not allowed.`)}}function pr(e,n,t){let s=e;if(s==null)throw t.NA;if(typeof s=="object"&&!(s instanceof t)&&(s=n.retrieveRef(s)),s instanceof t)throw s;if(typeof s=="boolean")return s;if(typeof s=="number")return s!==0;throw t.VALUE}function wt(e){return e!==null&&typeof e=="object"&&"value"in e?e.value:e}function ge(e){const n=wt(e);return Array.isArray(n)?n.flat(1/0):[n]}function B(e){const n=wt(e);return Array.isArray(n)?n.flat(1/0)[0]:n}function we(e){return e===void 0?void 0:B(e)}function re(e){return e==null||e===""?"":typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof Date?e.toLocaleDateString():String(e)}function xr(e,n){return e instanceof n?e:new n(e.message||"#ERROR!")}function q(e){return e.find(n=>n instanceof Error)}function mr(e,n){const t=i=>{throw xr(i,n)},s=(i,{checkArgsForErrors:l=!0}={})=>(...u)=>{const a=u.flatMap(ge);if(l){const d=q(a);d&&t(d)}const f=i(...a);return f instanceof Error?t(f):f},c=(i,{toText:l=!1}={})=>u=>{const a=B(u),f=q([a]);f&&t(f);const d=i(l?re(a):a);return d instanceof Error?t(d):d};return{IF:(i,l,u,a)=>{const f=pr(l,i,n);if(u==null)throw n.NA;return f?u:a??!1},MAX:s(e.MAX),MIN:s(e.MIN),MAXA:s(e.MAXA),MINA:s(e.MINA),MEDIAN:s(e.MEDIAN),COUNTA:s(e.COUNTA,{checkArgsForErrors:!1}),LARGE:(i,l)=>{const u=ge(i),a=B(l),f=q([...u,a]);f&&t(f);const d=e.LARGE(u,a);return d instanceof Error?t(d):d},SMALL:(i,l)=>{const u=ge(i),a=B(l),f=q([...u,a]);f&&t(f);const d=e.SMALL(u,a);return d instanceof Error?t(d):d},PERMUT:(i,l)=>{const u=[B(i),B(l)],a=q(u);a&&t(a);const f=e.PERMUT(u[0],u[1]);return f instanceof Error?t(f):f},PERMUTATIONA:(i,l)=>{const u=[B(i),B(l)],a=q(u);a&&t(a);const f=e.PERMUTATIONA(u[0],u[1]);return f instanceof Error?t(f):f},MATCH:(i,l)=>{const u=B(i),a=ge(l),f=q([u,...a]);f&&t(f);const d=e.MATCH(u,a,0);return d instanceof Error?t(d):d},SWITCH:(...i)=>{const l=i.map(B),u=q(l);u&&t(u);const a=e.SWITCH(...l);return a instanceof Error?t(a):a},SUBSTITUTE:(i,l,u,a)=>{const f=[re(B(i)),re(B(l)),re(B(u))];a!==void 0&&f.push(B(a));const d=q(f);d&&t(d);const x=e.SUBSTITUTE(...f);return x instanceof Error?t(x):x},TEXTJOIN:(i,l,...u)=>{const a=re(B(i)),f=B(l),d=u.flatMap(ge).map(re),x=q([a,f]);x&&t(x);const h=e.TEXTJOIN(a,f,d);return h instanceof Error?t(h):h},UPPER:c(e.UPPER),YEAR:c(e.YEAR),MONTH:c(e.MONTH),DAY:c(e.DAY),WEEKDAY:(i,l)=>{const u=B(i),a=B(l),f=q([u]);f&&t(f);const d=e.WEEKDAY(u,a);return d instanceof Error?t(d):d},CONCATENATE:(...i)=>{const l=i.flatMap(ge),u=q(l);u&&t(u);const a=e.CONCATENATE(...l.map(re));return a instanceof Error?t(a):a},CONCAT:(...i)=>{const l=i.flatMap(ge),u=q(l);u&&t(u);const a=e.CONCAT(...l.map(re));return a instanceof Error?t(a):a},LEN:c(e.LEN,{toText:!0}),TRIM:c(e.TRIM,{toText:!0}),LOWER:c(e.LOWER,{toText:!0}),LEFT:(i,l)=>{const u=B(i),a=we(l),f=q([u]);f&&t(f);const d=e.LEFT(re(u),a);return d instanceof Error?t(d):d},RIGHT:(i,l)=>{const u=B(i),a=we(l),f=q([u]);f&&t(f);const d=e.RIGHT(re(u),a);return d instanceof Error?t(d):d},MID:(i,l,u)=>{const a=B(i),f=B(l),d=B(u),x=q([a,f,d]);x&&t(x);const h=e.MID(re(a),f,d);return h instanceof Error?t(h):h},FIND:(i,l,u)=>{const a=B(i),f=B(l),d=we(u),x=q([a,f]);x&&t(x);const h=e.FIND(re(a),re(f),d);return h instanceof Error?t(h):h},SEARCH:(i,l,u)=>{const a=B(i),f=B(l),d=we(u),x=q([a,f]);x&&t(x);const h=e.SEARCH(re(a),re(f),d);return h instanceof Error?t(h):h}}}const gr={"#REF!":"REF","#VALUE!":"VALUE","#DIV/0!":"DIV0","#NAME?":"NAME","#N/A":"NA","#NUM!":"NUM","#NULL!":"NULL"};function Ue(e){return gr[e.error]??"ERROR"}function Pe(e,n){if(e instanceof ne)return e;if(e instanceof n){const t=e.details;return t instanceof ne?t:t instanceof n?new ne(Ue(t),t.message):new ne(Ue(e),e.message)}return new ne("ERROR",e instanceof Error?e.message:void 0)}function yr(e){return Math.max(0,...e.map(n=>(n==null?void 0:n.length)??0))}function br(e){return n=>{const t=e[n.row-1];if(n.row<1||n.col<1||t==null||n.col-1>=t.length)throw new ne("REF");const s=t[n.col-1];return s==null||s===""?null:s}}function vr(e){return n=>{const t=Math.min(n.from.row,n.to.row),s=Math.min(n.from.col,n.to.col),c=Math.max(n.from.row,n.to.row),i=Math.max(n.from.col,n.to.col),l=yr(e);if(t>e.length||s>l)throw new ne("REF");const u=Math.min(c,e.length),a=[];for(let f=t;f<=u;f++){const d=e[f-1],x=[];if(d!=null){const h=Math.min(i,d.length);for(let m=s;m<=h;m++){const v=d[m-1];x.push(v==null||v===""?null:v)}}a.push(x)}return a}}function Tr(e){if(e==null||e==="")return null;if(typeof e=="number"||typeof e=="string"||typeof e=="boolean"||e instanceof Date)return e;throw new ne("VALUE")}async function jt(e,n){if(typeof e!="string")throw new ne("ERROR");const t=e.trim();if(t==="")throw new ne("ERROR");const s=t.startsWith("=")?t.slice(1):t;hr(s);const[c,i]=await Promise.all([import("fast-formula-parser"),import("@formulajs/formulajs")]),l=c.default??c,u=l.FormulaError,a=new l({...n,functions:mr(i,u)});let f;try{f=a.parse(s,{row:1,col:1,sheet:"Sheet1"})}catch(d){throw Pe(d,u)}if(f instanceof u)throw Pe(f,u);return Tr(f)}async function wr(e,n){return jt(n,{onCell:br(e),onRange:vr(e)})}const Be=-1;async function Ct(e,n){const t=Object.keys(e);return jt(n,{onVariable:s=>{const c=t.indexOf(s);return c===-1?null:{row:Be,col:c+1}},onCell:s=>{if(s.row===Be)return e[t[s.col-1]]??null;throw new ne("REF")},onRange:()=>{throw new ne("REF")}})}const Et={REF:"#REF!",VALUE:"#VALUE!",DIV0:"#DIV/0!",NAME:"#NAME?",ERROR:"#ERROR!",NA:"#N/A",NUM:"#NUM!",NULL:"#NULL!"};function ke(e){const n=e instanceof ne?e.code:"ERROR";return Et[n]}async function jr(e,n){return e.length===0?n.map(t=>({id:typeof(t==null?void 0:t.id)=="string"?t.id:"(unknown)",label:(t==null?void 0:t.label)??"(unknown)",value:null,error:Et.ERROR})):Promise.all(n.map(async t=>{try{if(!t||typeof t.label!="string"||typeof t.expression!="string"||typeof t.id!="string")throw new ne("ERROR");return{id:t.id,label:t.label,value:await wr(e,t.expression)}}catch(s){return{id:typeof(t==null?void 0:t.id)=="string"?t.id:"(unknown)",label:(t==null?void 0:t.label)??"(unknown)",value:null,error:ke(s)}}}))}function $e(e){const n=new Set;for(const{id:t}of e){if(n.has(t))return t;n.add(t)}return null}function Rt(e){const{columnHeader:n,rowHeader:t,columns:s,rows:c}=e;if(s!==void 0&&!Array.isArray(s))return"columns must be an array of { id, label } objects.";if(c!==void 0&&!Array.isArray(c))return"rows must be an array of { id, label } objects.";if(s!==void 0&&s.length===0)return"columns is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";if(c!==void 0&&c.length===0)return"rows is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";const i=d=>!!d&&typeof d.id=="string"&&d.id!==""&&typeof d.label=="string"&&d.label!=="",l=s==null?void 0:s.findIndex(d=>!i(d));if(l!=null&&l!==-1)return`columns[${l}] must be a { id, label } object with non-empty string fields.`;const u=c==null?void 0:c.findIndex(d=>!i(d));if(u!=null&&u!==-1)return`rows[${u}] must be a { id, label } object with non-empty string fields.`;const a=!!s&&s.length>0,f=!!c&&c.length>0;if(a){const d=$e(s);if(d)return`duplicate column id "${d}" — every declared column id must be unique.`}if(f){const d=$e(c);if(d)return`duplicate row id "${d}" — every declared row id must be unique.`}return n&&t?"columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape.":a&&f?"columns and rows cannot both be declared — pick one orientation for the persisted sheet shape.":n&&!a?"columnHeader is true but columns is missing or empty — declare the column list columnHeader positions map to.":t&&!f?"rowHeader is true but rows is missing or empty — declare the row list rowHeader positions map to.":null}function _e(e,n={}){const t=Rt(n);if(t)throw new Error(`x-spreadsheet: ${t}`);const{columnHeader:s,rowHeader:c,columns:i,rows:l}=n;return i&&i.length>0?Cr(e,i,s===!0):l&&l.length>0?Er(e,l,c===!0):e}function Cr(e,n,t){return(t?e.slice(1):e).map(c=>{const i=Object.create(null);return n.forEach((l,u)=>{i[l.id]=c[u]??null}),i})}function Er(e,n,t){const s=t?1:0,c=Math.max(0,...e.map(l=>l.length)),i=Math.max(0,c-s);return Array.from({length:i},(l,u)=>{const a=s+u,f=Object.create(null);return n.forEach((d,x)=>{var h;f[d.id]=((h=e[x])==null?void 0:h[a])??null}),f})}function Rr(e){return!Array.isArray(e[0])}function Sr(e){const n=Object.create(null);for(const{id:t,label:s,value:c,error:i}of e)n[t]=i===void 0?{label:s,value:c}:{label:s,value:c,error:i};return n}function Oe(e,n){const t=s=>s instanceof Date?s.toISOString():s??null;return t(e)===t(n)}function Ar(e,n){const t=e??{},s=n??{},c=Object.keys(t);return c.length!==Object.keys(s).length?!1:c.every(i=>{if(!Object.prototype.hasOwnProperty.call(s,i))return!1;const l=t[i],u=s[i];return l.label===u.label&&l.error===u.error&&Oe(l.value,u.value)})}function Fr(e,n){if(e==null||n==null)return e===n;const t=Array.isArray(e);if(t!==Array.isArray(n))return!1;if(t){const l=e,u=n;return l.length===u.length&&l.every((a,f)=>Oe(a,u[f]))}const s=e,c=n,i=Object.keys(s);return i.length!==Object.keys(c).length?!1:i.every(l=>Object.prototype.hasOwnProperty.call(c,l)&&Oe(s[l],c[l]))}function Or(e,n){if(e===n)return!0;if(e==null||n==null)return!1;const t=e,s=n;return t.length!==s.length?!1:t.every((c,i)=>Fr(c,s[i]))}function Ir(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Date}function kr(e,n){if(e.length===0)return[];const t=[],s=new Set;for(const i of n??[])s.has(i)||(s.add(i),t.push(i));for(const i of e)for(const l of Object.keys(i))s.has(l)||(s.add(l),t.push(l));if(t.length===0)return[];const c=e.map(i=>t.map(l=>{if(!Object.prototype.hasOwnProperty.call(i,l))return null;const u=i[l];return Ir(u)?u:null}));return[t,...c]}function Nr(e){const n=Math.max(0,...e.map(t=>t.length));return Array.from({length:n},(t,s)=>e.map(c=>c[s]??null))}const Dr=".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv",Lr=10*1024*1024,Ae=200,Mr=50,zr=[];function We(e){return e==null||e===""?"":e instanceof Date?e.toLocaleDateString():String(e)}const Ur=({data:e,handleChange:n,path:t,label:s,required:c,schema:i,enabled:l,readonly:u,errors:a,visible:f=!0})=>{fe(f,t,n);const d=!a||a.length===0,x=Tt(l,u),h=(i==null?void 0:i["x-spreadsheet"])??{},m=(i==null?void 0:i["x-evaluate"])??zr,v=h.accept??Dr,D=h.maxSize??Lr,A=h.columnHeader===!0,j=h.rowHeader===!0,R=h.columns,S=h.rows,O=Array.isArray(R)&&R.length>0,I=Array.isArray(S)&&S.length>0,U=Rt({columnHeader:A,rowHeader:j,columns:R,rows:S}),$=h.showSheet!==!1,N=h.sheetName,T=h.persistSheet!==!1,b=e??null,[H,X]=y.useState(()=>b!=null&&b.sheet||Object.keys((b==null?void 0:b.derivations)??{}).length>0?"ready":"empty"),[_,J]=y.useState(null),[E,Y]=y.useState(!1),[K,ae]=y.useState(null),[oe,ce]=y.useState(null),p=y.useRef(null),F=y.useRef(null),W=(b==null?void 0:b.sheet)??null,k=y.useCallback(C=>{if(!Rr(C))return C;const g=I?S:O?R:void 0,V=kr(C,g==null?void 0:g.map(L=>L.id));return I?Nr(V):V},[O,I,R,S]),z=y.useMemo(()=>K??(W?k(W):null),[K,W,k]),Q=((oe==null?void 0:oe.matrix)===z?oe.derivations:null)??(b==null?void 0:b.derivations)??{},ee=z!=null||b!=null,te=y.useMemo(()=>{const C=O?1:0,g=I?1:0,V=z?z.slice(C):[],L=V.slice(0,Ae),M=Math.min(Mr,Math.max(0,...L.map(he=>Math.max(0,he.length-g)))),se=Array.from({length:M},(he,me)=>me+g),xe="",Re=I&&!O;return r.jsx(r.Fragment,{children:z&&$&&r.jsxs(o.Box,{mt:"3",children:[r.jsx(o.Box,{style:{overflow:"auto",maxHeight:420},children:r.jsxs(o.Table.Root,{variant:"surface",size:"1",children:[!Re&&r.jsx(o.Table.Header,{children:r.jsxs(o.Table.Row,{children:[r.jsx(o.Table.ColumnHeaderCell,{children:xe}),se.map(he=>{var me;return r.jsx(o.Table.ColumnHeaderCell,{children:O?((me=R==null?void 0:R[he])==null?void 0:me.label)??"":sr(he)},he)})]})}),r.jsx(o.Table.Body,{children:L.map((he,me)=>{var De;const Ne=C+me;return r.jsxs(o.Table.Row,{children:[r.jsx(o.Table.RowHeaderCell,{style:I?{fontWeight:700,background:"var(--gray-a3)"}:void 0,children:I?((De=S==null?void 0:S[Ne])==null?void 0:De.label)??"":O?"":Ne+1}),se.map(Le=>r.jsx(o.Table.Cell,{children:We(he[Le])},Le))]},me)})})]})}),V.length>Ae&&r.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block"},children:["Showing first ",Ae," of ",V.length," rows"]})]})})},[z,$,O,I,R,S]),P=y.useCallback(async C=>{if(J(null),C.size>D){J(`File exceeds the ${ue(D)} limit.`);return}if(!v.split(",").map(M=>M.trim()).some(M=>M==="*"||M==="*/*"?!0:M.endsWith("/*")?C.type.startsWith(M.slice(0,-1)):M.startsWith(".")?C.name.toLowerCase().endsWith(M.toLowerCase()):C.type===M)){J(`Invalid type. Accepted: ${de(v)}`);return}X("parsing");let L;try{const M=await C.arrayBuffer();L=(await or(M,N)).matrix}catch(M){X("error"),J(M instanceof Fe?M.message:"This doesn't look like a valid spreadsheet. Please check the file and try again.");return}if(O||I)try{L=k(_e(L,{columnHeader:A,rowHeader:j,columns:R,rows:S}))}catch(M){X("error"),J(M instanceof Error?M.message:"Failed to process this sheet.");return}F.current=(e==null?void 0:e.sheet)??null,ae(L),X("ready")},[v,D,N,e,A,j,R,S,O,I,k]);if(y.useEffect(()=>{K!=null&&W!=null&&W!==F.current&&ae(null)},[K,W]),y.useEffect(()=>{if(U||m.length===0&&!T)return;let C=!1;const g=L=>{x&&(Ar(b==null?void 0:b.derivations,L==null?void 0:L.derivations)&&Or(b==null?void 0:b.sheet,L==null?void 0:L.sheet)||(F.current=(L==null?void 0:L.sheet)??null,n(t,L)))},V=z??[];if(V.length===0){b!=null&&g(void 0);return}return jr(V,m).then(L=>{if(C)return;let M;if(K!=null){if(T)try{M=_e(V,{columnHeader:O,rowHeader:I,columns:R,rows:S})}catch(xe){J(xe instanceof Error?xe.message:"Failed to process this sheet.");return}}else M=b==null?void 0:b.sheet;J(null);const se=Sr(L);ce({matrix:V,derivations:se}),g(M===void 0?{derivations:se}:{sheet:M,derivations:se})}),()=>{C=!0}},[z,K,m,x,T,O,I,R,S,U]),f===!1)return null;if(U)return r.jsxs(o.Box,{mb:"4",children:[r.jsx(o.Text,{as:"label",size:"2",weight:"bold",children:s}),r.jsxs(o.Text,{size:"2",color:"red",style:{display:"block"},children:["Invalid x-spreadsheet config: ",U]})]});if(!x&&!ee)return null;const be=C=>{C.preventDefault(),C.stopPropagation(),x&&Y(C.type==="dragenter"||C.type==="dragover")},je=C=>{var g;C.preventDefault(),C.stopPropagation(),Y(!1),x&&(g=C.dataTransfer.files)!=null&&g[0]&&P(C.dataTransfer.files[0])},Te=C=>{var g;(g=C.target.files)!=null&&g[0]&&(P(C.target.files[0]),C.target.value="")},Ce=()=>{x&&(ae(null),ce(null),F.current=null,J(null),X("empty"),n(t,void 0))},Ee=$&&z==null&&b!=null;return r.jsxs(o.Box,{mb:"4",children:[r.jsxs(o.Flex,{align:"center",justify:"between",mb:"2",children:[r.jsxs(o.Flex,{align:"center",gap:"1",children:[r.jsxs(o.Text,{as:"label",size:"2",weight:"bold",children:[s,c&&r.jsx(o.Text,{color:"red",children:" *"})]}),ee&&x&&r.jsxs(r.Fragment,{children:[r.jsx(o.Tooltip,{content:"Replace spreadsheet",children:r.jsx(o.IconButton,{variant:"ghost",size:"1",onClick:()=>{var C;return(C=p.current)==null?void 0:C.click()},"aria-label":"Replace spreadsheet",children:r.jsx(Z.UploadIcon,{})})}),r.jsx(o.Tooltip,{content:"Remove spreadsheet",children:r.jsx(o.IconButton,{variant:"ghost",size:"1",color:"gray",onClick:Ce,"aria-label":"Remove spreadsheet",children:r.jsx(Z.Cross2Icon,{})})})]})]}),r.jsxs(o.Text,{size:"1",color:"gray",children:[ue(D)," max · ",de(v)]})]}),ee&&_&&r.jsx(o.Text,{size:"2",color:"red",mb:"2",style:{display:"block"},children:_}),r.jsx("input",{ref:p,type:"file",style:{display:"none"},accept:v,onChange:Te}),x&&!ee&&r.jsx("div",{role:"button",tabIndex:0,onClick:()=>{var C;return(C=p.current)==null?void 0:C.click()},onKeyDown:C=>{var g;(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),(g=p.current)==null||g.click())},onDragEnter:be,onDragLeave:be,onDragOver:be,onDrop:je,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",E?"border-blue-500 bg-blue-50":_?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:r.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:H==="parsing"?r.jsxs(r.Fragment,{children:[r.jsx(o.Spinner,{size:"3"}),r.jsx(o.Text,{size:"2",color:"gray",children:"Parsing spreadsheet…"})]}):_?r.jsxs(r.Fragment,{children:[r.jsx(Z.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),r.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:_}),r.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Z.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),r.jsx(o.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),r.jsxs(o.Text,{size:"1",color:"gray",children:[ue(D)," max · ",de(v)]})]})})}),te,Ee&&r.jsx(o.Text,{size:"2",color:"gray",mt:"3",style:{display:"block"},children:"Sheet preview not stored for this field — re-upload to view contents."}),Object.keys(Q).length>0&&r.jsxs(o.Box,{mt:"3",children:[r.jsx(o.Text,{size:"2",weight:"bold",as:"div",mb:"1",children:"Computed values"}),r.jsx(o.Flex,{direction:"column",gap:"1",children:Object.entries(Q).map(([C,g])=>r.jsxs(o.Flex,{justify:"between",children:[r.jsx(o.Text,{size:"2",children:g.label}),g.error?r.jsx(o.Text,{size:"2",color:"red",children:g.error}):r.jsx(o.Text,{size:"2",children:We(g.value)})]},C))})]}),!d&&r.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:le(a,s)})]})},St=G.withJsonFormsControlProps(Ur),At=w.rankWith(10,w.schemaMatches(e=>e.type==="object"&&typeof e["x-spreadsheet"]=="object"));class pe extends Error{}const Ve=5e6,Pr=1024,Br=/^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["']/i,$r={ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",parseTagValue:!0,parseAttributeValue:!0,numberParseOptions:{hex:!1,leadingZeros:!1,eNotation:!0},trimValues:!0,cdataPropName:!1,commentPropName:!1,processEntities:!0,htmlEntities:!0,ignoreDeclaration:!0,ignorePiTags:!0,alwaysCreateTextNode:!1,preserveOrder:!1,removeNSPrefix:!1,maxNestedTags:100,strictReservedNames:!0};function _r(e){const n=new Set(e);return n.size===0?()=>!1:(t,s)=>n.has(typeof s=="string"?s:s.toString())||n.has(t)}function Wr(e){const n=e instanceof Error?e.message:"";return n.startsWith("[SECURITY] Invalid name:")?"This document uses a reserved JavaScript name (__proto__, constructor or prototype) as an element or attribute name, which cannot be represented safely.":n==="External entities are not supported"||n==="Parameter entities are not supported"?`${n}. Please remove the DOCTYPE entity declarations and try again.`:n.startsWith("Maximum nested tags exceeded")?"This document is nested too deeply to parse.":n.startsWith("Entity count")||n.includes("exceeds maximum allowed")?"This document declares too many or too large entity definitions to expand safely.":"This doesn't look like a valid XML document. Please check the file and try again."}async function Vr(e,n={}){var f;if(typeof e!="string")throw new pe("This file could not be read as text.");const t=e.charCodeAt(0)===65279?e.slice(1):e;if(t.trim()==="")throw new pe("This file is empty.");if(t.length>Ve)throw new pe(`This document is too large to parse (over ${Ve/1e6} million characters).`);const s=(f=Br.exec(t.slice(0,Pr)))==null?void 0:f[1];if(s&&!/^utf-?8$/i.test(s))throw new pe(`This document declares the unsupported encoding "${s}". Only UTF-8 is supported.`);const{XMLParser:c,XMLValidator:i}=await import("fast-xml-parser"),l=i.validate(t,{allowBooleanAttributes:!1});if(l!==!0){const{msg:d,line:x,col:h}=l.err;throw new pe(`Invalid XML at line ${x}, column ${h}: ${d}`)}const u=new c({...$r,removeNSPrefix:n.removeNamespaces===!0,isArray:_r(n.arrayPaths??[])});let a;try{a=u.parse(t)}catch(d){throw new pe(Wr(d))}if(a==null||typeof a!="object"||Array.isArray(a))throw new pe("This document has no root element.");return a}const ye={found:!1},ie=e=>({found:!0,value:e});function He(e){return e==null||e===""?ye:Array.isArray(e)||e instanceof Date?ie(e):typeof e=="object"?ye:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?ie(e):ye}const Hr=new Set(["true","1","yes","y"]),Xr=new Set(["false","0","no","n"]);async function Jr(e,n){switch(n.as){case void 0:return ie(e);case"string":return ie(e instanceof Date?e.toISOString():String(e));case"number":{const t=e instanceof Date?e.getTime():Number(e);return Number.isFinite(t)?ie(t):ye}case"boolean":{const t=String(e).trim().toLowerCase();return Hr.has(t)?ie(!0):Xr.has(t)?ie(!1):ye}case"date":{const{default:t}=await import("dayjs"),{default:s}=await Promise.resolve().then(()=>require("./customParseFormat-CLvZwox5.cjs")).then(l=>l.customParseFormat);t.extend(s);const c=e instanceof Date?e.toISOString():String(e),i=n.format?t(c,n.format,!0):t(c);return i.isValid()?ie(i.format("YYYY-MM-DD")):ye}}}async function Kr(e,n){if(n.formula!==void 0){const t={};for(const[s,c]of Object.entries(n.inputs??{})){const i=He(w.Resolve.data(e,c));if(!i.found||Array.isArray(i.value))return ye;t[s]=i.value}try{return ie(await Ct(t,n.formula))}catch(s){throw new Error(`x-xml.writeTo "${n.to}": ${ke(s)}`)}}if(n.from===void 0)throw new Error(`x-xml.writeTo "${n.to}" needs either "from" or "formula".`);return He(w.Resolve.data(e,n.from))}async function Gr(e,n){const t=[];for(const s of n){let c=await Kr(e,s);const i=c.found&&Array.isArray(c.value);if(c.found&&!i&&s.map){const l=c.value instanceof Date?c.value.toISOString():String(c.value);Object.prototype.hasOwnProperty.call(s.map,l)&&(c=ie(s.map[l]))}if(c.found&&!i&&(c=await Jr(c.value,s)),!c.found){if(s.default===void 0)continue;t.push({to:s.to,value:s.default});continue}t.push({to:s.to,value:c.value})}return t}const Yr=".xml,text/xml,application/xml",qr=5*1024*1024,Zr=({data:e,handleChange:n,path:t,label:s,required:c,schema:i,enabled:l,readonly:u,errors:a,visible:f=!0})=>{fe(f,t,n);const d=!a||a.length===0,x=Tt(l,u),h=(i==null?void 0:i["x-xml"])??{},m=h.accept??Yr,v=h.maxSize??qr,D=h.arrayPaths,A=h.removeNamespaces===!0,j=h.writeTo,R=h.writeBase??"root",S=h.persistDocument!==!1,O=G.useJsonForms(),I=e??null,[U,$]=y.useState(()=>I?"ready":"empty"),[N,T]=y.useState(null),[b,H]=y.useState(!1),X=y.useRef(null),_=y.useRef(0),J=I!=null,E=j!==void 0&&j.length>0,Y=y.useCallback(async p=>{var te;const F=++_.current;if(T(null),p.size>v){T(`File exceeds the ${ue(v)} limit.`);return}if(!m.split(",").map(P=>P.trim()).some(P=>P==="*"||P==="*/*"?!0:P.endsWith("/*")?p.type.startsWith(P.slice(0,-1)):P.startsWith(".")?p.name.toLowerCase().endsWith(P.toLowerCase()):p.type===P)){T(`Invalid type. Accepted: ${de(m)}`);return}$("parsing");let z;try{const P=await p.text();z=await Vr(P,{arrayPaths:D,removeNamespaces:A})}catch(P){if(F!==_.current)return;$("error"),T(P instanceof pe?P.message:"This doesn't look like a valid XML document. Please check the file and try again.");return}let Q=[];if(j&&j.length>0)try{Q=await Gr(z,j)}catch(P){if(F!==_.current)return;$("error"),T(P instanceof Error?P.message:"This document could not be mapped onto the form.");return}if(F!==_.current)return;S&&n(t,z);const ee=R==="parent"?t.split(".").slice(0,-1).join("."):"";for(const P of Q)(te=O.dispatch)==null||te.call(O,w.update(ee?`${ee}.${P.to}`:P.to,()=>P.value));$("ready")},[m,v,D,A,j,R,S,t,n,O]);if(f===!1||!x&&!J)return null;const K=p=>{p.preventDefault(),p.stopPropagation(),x&&H(p.type==="dragenter"||p.type==="dragover")},ae=p=>{var F;p.preventDefault(),p.stopPropagation(),H(!1),x&&(F=p.dataTransfer.files)!=null&&F[0]&&Y(p.dataTransfer.files[0])},oe=p=>{var F;(F=p.target.files)!=null&&F[0]&&(Y(p.target.files[0]),p.target.value="")},ce=()=>{x&&(++_.current,T(null),$("empty"),n(t,void 0))};return r.jsxs(o.Box,{mb:"4",children:[r.jsxs(o.Flex,{align:"center",justify:"between",mb:"2",children:[r.jsxs(o.Flex,{align:"center",gap:"1",children:[r.jsxs(o.Text,{as:"label",size:"2",weight:"bold",children:[s,c&&r.jsx(o.Text,{color:"red",children:" *"})]}),!E&&J&&x&&r.jsxs(r.Fragment,{children:[r.jsx(o.Tooltip,{content:"Replace document",children:r.jsx(o.IconButton,{variant:"ghost",size:"1",onClick:()=>{var p;return(p=X.current)==null?void 0:p.click()},"aria-label":"Replace document",children:r.jsx(Z.UploadIcon,{})})}),r.jsx(o.Tooltip,{content:"Remove document",children:r.jsx(o.IconButton,{variant:"ghost",size:"1",color:"gray",onClick:ce,"aria-label":"Remove document",children:r.jsx(Z.Cross2Icon,{})})})]})]}),r.jsxs(o.Flex,{align:"center",gap:"2",children:[r.jsxs(o.Text,{size:"1",color:"gray",children:[ue(v)," max · ",de(m)]}),E&&x&&r.jsxs(o.Button,{size:"1",variant:"soft",onClick:()=>{var p;return(p=X.current)==null?void 0:p.click()},disabled:U==="parsing",children:[U==="parsing"?r.jsx(o.Spinner,{size:"1"}):r.jsx(Z.UploadIcon,{}),"Upload"]})]})]}),(E||J)&&N&&r.jsx(o.Text,{size:"2",color:"red",mb:"2",style:{display:"block"},children:N}),r.jsx("input",{ref:X,type:"file",style:{display:"none"},accept:m,onChange:oe}),!E&&x&&!J&&r.jsx("div",{role:"button",tabIndex:0,onClick:()=>{var p;return(p=X.current)==null?void 0:p.click()},onKeyDown:p=>{var F;(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),(F=X.current)==null||F.click())},onDragEnter:K,onDragLeave:K,onDragOver:K,onDrop:ae,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",b?"border-blue-500 bg-blue-50":N?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:r.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:U==="parsing"?r.jsxs(r.Fragment,{children:[r.jsx(o.Spinner,{size:"3"}),r.jsx(o.Text,{size:"2",color:"gray",children:"Parsing document…"})]}):N?r.jsxs(r.Fragment,{children:[r.jsx(Z.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),r.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:N}),r.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Z.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),r.jsx(o.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),r.jsxs(o.Text,{size:"1",color:"gray",children:[ue(v)," max · ",de(m)]})]})})}),!d&&r.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:le(a,s)})]})},Ft=G.withJsonFormsControlProps(Zr),Ot=w.rankWith(10,w.schemaMatches(e=>{const n=e["x-xml"];return e.type==="object"&&typeof n=="object"&&n!==null}));function Qr(e,n,t){const s={};for(const[c,i]of Object.entries(t)){const{path:l,default:u}=typeof i=="string"?{path:i,default:void 0}:i,a=n?`${n}.${l}`:l,f=w.Resolve.data(e,a);if(f==null){if(u===void 0)return;s[c]=u}else s[c]=f}return s}async function en(e,n){try{return{status:"ok",value:await Ct(e,n)}}catch(t){return{status:"error",error:ke(t)}}}function tn(e,n){return e==null?"":typeof e=="number"?e.toFixed(rn(n)):e instanceof Date?e.toLocaleDateString():String(e)}function rn(e){return Number.isFinite(e)?Math.min(100,Math.max(0,Math.trunc(e))):0}const Xe="{value}",nn=2,on={},sn=({data:e,handleChange:n,path:t,label:s,schema:c,visible:i=!0})=>{var U;fe(i,t,n);const l=c==null?void 0:c["x-computed"],u=(l==null?void 0:l.inputs)??on,a=(l==null?void 0:l.formula)??"",f=(l==null?void 0:l.format)??Xe,d=(l==null?void 0:l.decimals)??nn,x=G.useJsonForms(),h=t.split(".").slice(0,-1).join("."),m=Qr((U=x.core)==null?void 0:U.data,h,u),v=m?JSON.stringify(m):null,D=x.readonly===!0,[A,j]=y.useState(()=>typeof e=="number"?"ok":"unavailable"),[R,S]=y.useState(()=>typeof e=="number"?e:null),[O,I]=y.useState(null);return y.useEffect(()=>{if(!i)return;let $=!1;const N=T=>{D||T!==e&&n(t,T)};if(m===void 0){j("unavailable"),I(null),S(null),N(void 0);return}return j(T=>T==="ok"?T:"loading"),en(m,a).then(T=>{if($)return;const b=T.status==="ok"&&typeof T.value=="number"&&Number.isFinite(T.value)?T.value:null;if(b===null){j("error"),I(T.status==="error"?T.error??"Unable to compute value.":"Computed value must be a number."),S(null),N(void 0);return}j("ok"),I(null),S(b),N(b)}),()=>{$=!0}},[v,a,i,D]),i===!1?null:r.jsx(o.Box,{mb:"4",children:r.jsxs(o.Flex,{direction:"column",gap:"1",children:[r.jsx(o.Text,{as:"label",size:"2",weight:"bold",children:s}),A==="unavailable"?r.jsx(o.Text,{size:"2",color:"gray",children:"Not yet available."}):A==="loading"?r.jsxs(o.Flex,{align:"center",gap:"2",children:[r.jsx(o.Spinner,{size:"1"}),r.jsx(o.Text,{size:"2",color:"gray",children:"Computing…"})]}):A==="error"?r.jsx(o.Text,{size:"2",color:"red",children:O}):r.jsx(o.Text,{size:"2",children:f.split(Xe).join(tn(R,d))}),c.description&&r.jsx(o.Text,{size:"1",color:"gray",children:c.description})]})})},It=G.withJsonFormsControlProps(sn),kt=w.rankWith(5,w.schemaMatches(e=>{const n=e["x-computed"];return e.type==="number"&&typeof n=="object"&&n!==null})),ln=({data:e,path:n,schema:t,uischema:s,enabled:c,visible:i,addItem:l,removeItems:u,rootSchema:a,arraySchema:f})=>{const d=f?t:t.items,x=f||t;if(i===!1||!d||typeof d!="object"||Array.isArray(d))return null;const h=d,m=Array.isArray(e)?e:[],v=x.title||"Array Items",D=s.options??{},A=c&&D.addable!==!1,j=c&&D.removable!==!1,R=()=>{const O=w.createDefaultValue(h,a);l&&l(n,O)()},S=O=>{if(u){const I=u(n,[O]);I&&I()}};return r.jsx(o.Box,{mb:"6",children:r.jsxs(o.Flex,{direction:"column",gap:"4",children:[r.jsx(o.Text,{as:"div",size:"4",weight:"bold",children:v}),m.length===0&&r.jsx(o.Box,{py:"4",px:"4",style:{backgroundColor:"var(--gray-3)",borderRadius:"var(--radius-3)"},children:r.jsx(o.Text,{size:"2",color:"gray",children:"No items have been added yet."})}),m.map((O,I)=>{var $;const U=`${n}.${I}`;return r.jsx(o.Card,{size:"3",variant:"surface",children:r.jsxs(o.Flex,{direction:"column",gap:"4",children:[r.jsxs(o.Flex,{justify:"between",align:"center",children:[r.jsxs(o.Text,{size:"3",weight:"bold",children:["Item ",I+1]}),j&&r.jsxs(o.Button,{type:"button",color:"red",variant:"soft",onClick:()=>S(I),title:"Remove item",children:[r.jsx(Z.TrashIcon,{}),"Remove"]})]}),r.jsx(o.Box,{children:r.jsx(G.JsonFormsDispatch,{schema:h,uischema:(($=s.options)==null?void 0:$.detail)||(h.type==="object"||h.properties?{type:"VerticalLayout",elements:Object.keys(h.properties||{}).map(N=>({type:"Control",scope:`#/properties/${N}`}))}:{type:"Control",scope:"#"}),path:U,enabled:c,renderers:void 0,cells:void 0})})]})},U)}),A&&r.jsx(o.Box,{mt:"2",children:r.jsxs(o.Button,{type:"button",variant:"surface",onClick:R,children:[r.jsx(Z.PlusIcon,{}),"Add Item"]})})]})})},Ie=G.withJsonFormsArrayControlProps(ln),Nt=w.rankWith(3,w.isObjectArrayControl),Dt=({uischema:e,visible:n})=>{const t=e;return n===!1?null:r.jsx(o.Box,{mb:"4",children:r.jsx(o.Heading,{size:"4",children:t.text})})},Lt=w.rankWith(1,w.uiTypeIs("Label")),an=w.rankWith(3,w.isPrimitiveArrayControl),cn=[{tester:Ze,renderer:Xt},{tester:et,renderer:Jt},{tester:rt,renderer:Kt},{tester:ot,renderer:Gt},{tester:at,renderer:lt},{tester:it,renderer:Yt},{tester:ut,renderer:tr},{tester:ft,renderer:dt},{tester:pt,renderer:ht},{tester:mt,renderer:xt},{tester:yt,renderer:gt},{tester:vt,renderer:bt},{tester:At,renderer:St},{tester:Ot,renderer:Ft},{tester:kt,renderer:It},{tester:Nt,renderer:Ie},{tester:an,renderer:Ie},{tester:Lt,renderer:Dt}];exports.ArrayControl=Ie;exports.ArrayControlTester=Nt;exports.BooleanControl=tt;exports.BooleanControlTester=rt;exports.CategorizationLayoutRenderer=gt;exports.CategorizationLayoutTester=yt;exports.ComputedControl=It;exports.ComputedControlTester=kt;exports.DateControl=ct;exports.DateControlTester=ut;exports.FileControl=bt;exports.FileControlTester=vt;exports.GroupLayoutRenderer=xt;exports.GroupLayoutTester=mt;exports.HorizontalLayoutRenderer=ht;exports.HorizontalLayoutTester=pt;exports.LabelRenderer=Dt;exports.LabelTester=Lt;exports.NumberControl=Qe;exports.NumberControlTester=et;exports.RadioControl=nt;exports.RadioControlTester=ot;exports.SearchSelectControl=lt;exports.SearchSelectControlTester=at;exports.SearchServiceProvider=Ht;exports.SelectControl=st;exports.SelectControlTester=it;exports.SpreadsheetControl=St;exports.SpreadsheetControlTester=At;exports.TextControl=qe;exports.TextControlTester=Ze;exports.UploadProvider=Vt;exports.VerticalLayoutRenderer=dt;exports.VerticalLayoutTester=ft;exports.XmlControl=Ft;exports.XmlControlTester=Ot;exports.radixRenderers=cn;exports.useSearchService=Ye;exports.useUpload=Ke;