@opennsw/jsonforms-renderers 0.6.0 → 0.8.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.
- package/dist/index.d.ts +4 -0
- package/dist/jsonforms-renderers.css +1 -1
- package/dist/renderers.cjs.js +2 -2
- package/dist/renderers.es.js +1073 -869
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ export declare const CategorizationLayoutRenderer: ({ uischema, schema, path, re
|
|
|
26
26
|
|
|
27
27
|
export declare const CategorizationLayoutTester: RankedTester;
|
|
28
28
|
|
|
29
|
+
export declare const ComputedControl: ComponentType<OwnPropsOfControl>;
|
|
30
|
+
|
|
31
|
+
export declare const ComputedControlTester: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => number;
|
|
32
|
+
|
|
29
33
|
export declare const DateControl: ({ data, handleChange, path, label, required, errors, schema, enabled, visible, }: ControlProps) => JSX.Element | null;
|
|
30
34
|
|
|
31
35
|
export declare const DateControlTester: RankedTester;
|
|
@@ -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}.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{.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}
|
package/dist/renderers.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
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
2
|
`).map(r=>r.trim()==="is a required property"?`${n||"This field"} is required`:r).join(`
|
|
3
|
-
`):"",Me=({data:e,handleChange:n,path:r,label:a,required:f,errors:d,uischema:u,schema:c,enabled:s,visible:i=!0})=>{var g;if(ie(i,r,n),i===!1)return null;const l=d.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:[a," ",f&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.TextField.Root,{value:e||"",onChange:h=>n(r,h.target.value),disabled:!s,placeholder:(g=u.options)==null?void 0:g.placeholder,color:l?void 0:"red",id:r}),!l&&t.jsx(o.Text,{color:"red",size:"1",children:re(d,a)}),c.description&&t.jsx(o.Text,{size:"1",color:"gray",children:c.description})]})})},ze=v.rankWith(1,v.isStringControl),Ct=W.withJsonFormsControlProps(Me),Ue=({data:e,handleChange:n,path:r,label:a,required:f,errors:d,uischema:u,schema:c,enabled:s,visible:i=!0})=>{var h;if(ie(i,r,n),i===!1)return null;const l=d.length===0,g=x=>{if(x===""){n(r,void 0);return}const m=Number(x);isNaN(m)||n(r,m)};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:[a," ",f&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.TextField.Root,{type:"number",value:e??"",onChange:x=>g(x.target.value),disabled:!s,placeholder:(h=u.options)==null?void 0:h.placeholder,color:l?void 0:"red",id:r}),!l&&t.jsx(o.Text,{color:"red",size:"1",children:re(d,a)}),c.description&&t.jsx(o.Text,{size:"1",color:"gray",children:c.description})]})})},Be=v.rankWith(2,v.or(v.isNumberControl,v.isIntegerControl)),Et=W.withJsonFormsControlProps(Ue),Pe=({data:e,handleChange:n,path:r,label:a,required:f,errors:d,schema:u,enabled:c,visible:s=!0})=>{if(ie(s,r,n),s===!1)return null;const i=d.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:l=>n(r,l===!0),disabled:!c,id:r}),t.jsxs(o.Text,{as:"label",size:"2",htmlFor:r,children:[a," ",f&&"*"]})]}),!i&&t.jsx(o.Text,{color:"red",size:"1",className:"block mt-1",children:re(d,a)}),u.description&&t.jsx(o.Text,{size:"1",color:"gray",className:"block mt-1",children:u.description})]})},We=v.rankWith(2,v.isBooleanControl),Rt=W.withJsonFormsControlProps(Pe),$e=({data:e,handleChange:n,path:r,label:a,required:f,errors:d,schema:u,enabled:c,visible:s=!0})=>{if(ie(s,r,n),s===!1)return null;const i=d.length===0;let l=[];u.enum?l=u.enum.map(h=>({value:h,label:String(h)})):u.oneOf&&(l=u.oneOf.map(h=>({value:h.const,label:h.title||String(h.const)})));const g=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:[a," ",f&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsx(o.RadioGroup.Root,{value:g!==void 0?String(g):"",onValueChange:h=>{const x=l.find(m=>String(m.value)===h);x&&n(r,x.value)},disabled:!c,children:t.jsx(o.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:l.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:c?void 0:"gray",children:h.label})]},String(h.value)))})}),!i&&t.jsx(o.Text,{color:"red",size:"1",children:re(d,a)}),u.description&&t.jsx(o.Text,{size:"1",color:"gray",children:u.description})]})})},_e=(e,n,r)=>{var f;return v.or(v.isEnumControl,v.isOneOfControl)(e,n,r)&&((f=e==null?void 0:e.options)==null?void 0:f.format)==="radio"?3:-1},wt=W.withJsonFormsControlProps($e),Ve=({data:e,handleChange:n,path:r,label:a,required:f,errors:d,schema:u,uischema:c,enabled:s,visible:i=!0})=>{var x;if(ie(i,r,n),i===!1)return null;const l=d.length===0;let g=[];u.enum?g=u.enum.map(m=>({value:String(m),label:String(m)})):u.oneOf&&(g=u.oneOf.map(m=>({value:String(m.const),label:m.title||String(m.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:[a," ",f&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsxs(o.Select.Root,{value:h,onValueChange:m=>n(r,m),disabled:!s,children:[t.jsx(o.Select.Trigger,{placeholder:((x=c.options)==null?void 0:x.placeholder)||"Select an option",color:l?void 0:"red",id:r}),t.jsx(o.Select.Content,{children:g.map(m=>t.jsx(o.Select.Item,{value:m.value,children:m.label},m.value))})]}),!l&&t.jsx(o.Text,{color:"red",size:"1",children:re(d,a)}),u.description&&t.jsx(o.Text,{size:"1",color:"gray",children:u.description})]})})},He=v.rankWith(2,v.or(v.isEnumControl,v.isOneOfControl)),St=W.withJsonFormsControlProps(Ve),At={"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}},Ft=({data:e,handleChange:n,path:r,label:a,required:f,errors:d,enabled:u,visible:c=!0,schema:s,uischema:i})=>{var le;const l=(s==null?void 0:s["x-search"])??{service:""},g=l.service??"",h=l.mode??"large-paginated-list",x=At[h],m=(x==null?void 0:x.fetchOnOpen)??!1,O=l.params,E=De(g),j=s.type==="object",S=j?typeof e=="string"?{value:e}:e??void 0:void 0,L=j?S==null?void 0:S.value:e,R=S==null?void 0:S.label,q=g?E?x?null:`Invalid x-search.mode "${h}". Expected "small-list", "large-searchable-list", or "large-paginated-list".`:`Search service "${g}" is not registered.`:"Search not configured.",U=u!==!1,Q=!d||d.length===0,[F,K]=b.useState(!1),[M,B]=b.useState(""),[Y,_]=b.useState([]),[z,Z]=b.useState(!1),[ee,ne]=b.useState(!1),[oe,se]=b.useState(!1),[ce,T]=b.useState(null),[A,I]=b.useState(void 0),C=b.useRef(void 0),k=b.useRef(null),V=b.useRef(null),J=b.useRef(null),$=b.useRef(void 0);b.useEffect(()=>{var X,ae;if(!L){I(void 0),$.current=void 0;return}if(((X=$.current)==null?void 0:X.value)===L&&((ae=$.current)==null?void 0:ae.label)===R)return;if($.current={value:L,label:R},j&&R){I({id:L,name:R});return}if(I({id:L,name:R??L}),!(E!=null&&E.resolve))return;let p=!1;return E.resolve(L,O).then(ge=>{!p&&ge&&I(ge)}).catch(()=>{}),()=>{p=!0}},[L,R,j,E,O]);const fe=b.useCallback(async(p,X=!1)=>{var ge;if(!E){T("Search service not configured.");return}(ge=V.current)==null||ge.abort();const ae=new AbortController;V.current=ae,X?se(!0):(ne(!0),se(!1),T(null));try{const Te=await E.search({query:p,cursor:X?C.current:void 0,signal:ae.signal,params:O}),Ee=Te.options??[];_(X?xt=>[...xt,...Ee]:Ee),C.current=Te.nextCursor,Z(((x==null?void 0:x.paginated)??!1)&&Te.nextCursor!=null)}catch{if(ae.signal.aborted)return;T("Failed to load results. Please try again.")}finally{ae.signal.aborted||(X?se(!1):ne(!1))}},[E,x==null?void 0:x.paginated,O]);if(b.useEffect(()=>{if(!F)return;const p=X=>{J.current&&!J.current.contains(X.target)&&K(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[F]),b.useEffect(()=>{var p;F||((p=V.current)==null||p.abort(),B(""),_([]),Z(!1),T(null),ne(!1),se(!1),C.current=void 0)},[F]),b.useEffect(()=>{if(!F)return;if(!M&&!m){_([]),Z(!1),T(null),C.current=void 0;return}k.current&&clearTimeout(k.current);const p=M?300:0;return k.current=setTimeout(()=>{_([]),Z(!1),C.current=void 0,fe(M)},p),()=>{k.current&&clearTimeout(k.current)}},[M,F,m,fe]),ie(c,r,n,j?void 0:null),c===!1)return null;const he=()=>{B(""),_([]),Z(!1),T(null),C.current=void 0,K(!0)},y=p=>{n(r,j?{value:p.id,label:p.name}:p.id),I(p),$.current={value:p.id,label:j?p.name:void 0},K(!1)},N=p=>{p.stopPropagation(),n(r,j?void 0:null),I(void 0)},pe=p=>{(p.key==="Enter"||p.key===" ")&&N(p)},te=((le=i==null?void 0:i.options)==null?void 0:le.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:[a," ",f&&t.jsx(o.Text,{color:"red",children:"*"})]}),t.jsxs("div",{ref:J,style:{position:"relative"},children:[t.jsx(o.TextField.Root,{id:r,value:F?M:(A==null?void 0:A.name)??"",placeholder:F&&(x!=null&&x.searchable)?"Search...":te,disabled:!U,readOnly:F&&!(x!=null&&x.searchable),style:Q?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:p=>{x!=null&&x.searchable&&(B(p.target.value),F||he())},onFocus:()=>{U&&!F&&he()},onKeyDown:p=>{p.key==="Escape"&&K(!1)},children:t.jsx(o.TextField.Slot,{side:"right",children:t.jsxs(o.Flex,{align:"center",gap:"1",children:[L&&U&&t.jsx("span",{role:"button",tabIndex:0,onMouseDown:p=>p.preventDefault(),onClick:N,onKeyDown:pe,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),t.jsx(H.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:q?t.jsx(o.Box,{p:"3",children:t.jsx(o.Text,{size:"2",color:"gray",children:q})}):t.jsx(o.ScrollArea,{style:{maxHeight:240},children:t.jsxs(o.Box,{p:"1",children:[ee&&t.jsx(o.Flex,{justify:"center",p:"4",children:t.jsx(o.Spinner,{})}),!ee&&ce&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Text,{size:"2",color:"red",children:ce})}),!ee&&!ce&&Y.length===0&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Text,{size:"2",color:"gray",children:M||m?"No results found.":"Type to search…"})}),Y.map(p=>t.jsx(o.Box,{px:"3",py:"2",onMouseDown:X=>X.preventDefault(),onClick:()=>y(p),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:p.id===L?"var(--accent-3)":void 0},className:"hover:bg-(--gray-3)",children:t.jsx(o.Text,{size:"2",children:p.name})},p.id)),(x==null?void 0:x.paginated)&&z&&!oe&&t.jsx(o.Box,{px:"3",py:"2",children:t.jsx(o.Button,{variant:"ghost",size:"1",style:{width:"100%"},onMouseDown:p=>p.preventDefault(),onClick:()=>void fe(M,!0),children:"Load more"})}),oe&&t.jsx(o.Flex,{justify:"center",p:"2",children:t.jsx(o.Spinner,{})})]})})})]}),!Q&&t.jsx(o.Text,{color:"red",size:"1",children:re(d,a)}),s.description&&t.jsx(o.Text,{size:"1",color:"gray",children:s.description})]})})},Ge=W.withJsonFormsControlProps(Ft),Je=v.rankWith(3,v.schemaMatches(e=>{const n=e["x-search"];return(e.type==="string"||e.type==="object")&&typeof(n==null?void 0:n.service)=="string"&&n.service!==""})),Nt=(e,n)=>vt(`${e}T${n}`).format(),Ot=({path:e,label:n,required:r,errors:a,description:f,children:d})=>{const u=a.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:"*"})]}),d,!u&&t.jsx(o.Text,{color:"red",size:"1",children:re(a,n)}),f&&t.jsx(o.Text,{size:"1",color:"gray",children:f})]})})},Ke=({data:e,handleChange:n,path:r,label:a,required:f,errors:d,schema:u,enabled:c,visible:s=!0})=>{if(b.useEffect(()=>{s===!1&&n(r,void 0)},[s,r,n]),s===!1)return null;const i=d.length===0,l=typeof e=="string"?e:"",g=j=>t.jsx(Ot,{path:r,label:a,required:f,errors:d,description:u.description,children:j});if(u.format==="time")return g(t.jsx(o.TextField.Root,{type:"time",value:l,onChange:j=>n(r,j.target.value),disabled:!c,color:i?void 0:"red",id:r}));const h=u.format==="date-time",[x="",m=""]=l.split("T"),O=m.slice(0,5),E=(j,S)=>{if(!j){n(r,void 0);return}n(r,h?Nt(j,S||"00:00"):j)};return g(t.jsxs(o.Flex,{gap:"2",align:"center",children:[t.jsx(o.TextField.Root,{type:"date",value:x,disabled:!c,color:i?void 0:"red",onChange:j=>E(j.target.value,O),id:r,style:{flex:1}}),h&&t.jsx(o.TextField.Root,{type:"time",value:O,disabled:!c||!x,color:i?void 0:"red",onChange:j=>E(x,j.target.value),style:{flex:1}})]}))},Xe=v.rankWith(2,v.or(v.isDateControl,v.isDateTimeControl,v.isTimeControl)),It=W.withJsonFormsControlProps(Ke),qe=({uischema:e,schema:n,path:r,renderers:a,cells:f,enabled:d,visible:u=!0})=>{const s=e.elements;return u===!1?null:t.jsx(o.Flex,{direction:"column",gap:"4",children:s.map((i,l)=>t.jsx(W.JsonFormsDispatch,{uischema:i,schema:n,path:r,renderers:a,cells:f,enabled:d},`${r}-${l}`))})},Ye=v.rankWith(1,v.uiTypeIs("VerticalLayout")),Ze=({uischema:e,schema:n,path:r,renderers:a,cells:f,enabled:d,visible:u=!0})=>{const s=e.elements;return u===!1?null:t.jsx(o.Flex,{direction:"row",gap:"4",children:s.map((i,l)=>t.jsx(o.Box,{style:{flex:1},children:t.jsx(W.JsonFormsDispatch,{uischema:i,schema:n,path:r,renderers:a,cells:f,enabled:d})},`${r}-${l}`))})},Qe=v.rankWith(1,v.uiTypeIs("HorizontalLayout")),et=({uischema:e,schema:n,path:r,renderers:a,cells:f,enabled:d,visible:u=!0})=>{const c=e,s=c.elements;return u===!1?null:t.jsxs(o.Box,{mb:"6",children:[c.label&&t.jsx(o.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:c.label}),t.jsx(o.Flex,{direction:"column",gap:"4",children:s.map((i,l)=>t.jsx(W.JsonFormsDispatch,{uischema:i,schema:n,path:r,renderers:a,cells:f,enabled:d},`${r}-${l}`))})]})},tt=v.rankWith(1,v.uiTypeIs("Group")),rt=({uischema:e,schema:n,path:r,renderers:a,cells:f,enabled:d,visible:u=!0})=>{var h;const s=e.elements.filter(x=>x.type==="Category"),[i,l]=b.useState(((h=s[0])==null?void 0:h.label)||"");if(u===!1||!s.length)return null;const g=s.find(x=>x.label===i)?i:s[0].label;return t.jsxs(o.Tabs.Root,{value:g,onValueChange:l,children:[t.jsx(o.Tabs.List,{children:s.map((x,m)=>t.jsx(o.Tabs.Trigger,{value:x.label,children:x.label},`${r}-${m}`))}),t.jsx(o.Box,{pt:"3",children:s.map((x,m)=>t.jsx(o.Tabs.Content,{value:x.label,children:t.jsx(o.Flex,{direction:"column",gap:"4",children:x.elements.map((O,E)=>t.jsx(W.JsonFormsDispatch,{uischema:O,schema:n,path:r,renderers:a,cells:f,enabled:d},`${r}-${m}-${E}`))})},`${r}-${m}`))})]})},nt=v.rankWith(1,v.uiTypeIs("Categorization"));function de(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function xe(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 Lt(e){return e?Array.isArray(e)?e:[e]:[]}const kt=({data:e,handleChange:n,path:r,label:a,required:f,uischema:d,schema:u,enabled:c,errors:s,visible:i=!0})=>{const l=Le();ie(i,r,n,null);const g=!s||s.length===0,h=(u==null?void 0:u["x-file"])??{},x=(d==null?void 0:d.options)??{},m=h.maxFiles??x.maxFiles??1,O=h.maxSize??x.maxSize??5*1024*1024,E=h.accept??x.accept??"image/*,application/pdf",j=m>1,S=c!==!1,[L,R]=b.useState(!1),[q,U]=b.useState(null),[Q,F]=b.useState({}),K=b.useRef(new Set),M=b.useRef(null),B=Lt(e),Y=B.length>=m;b.useEffect(()=>()=>{K.current.forEach(T=>URL.revokeObjectURL(T)),K.current.clear()},[]);const _=b.useCallback(async T=>{if(U(null),B.length>=m){U(`Maximum ${m} file${m>1?"s":""} allowed.`);return}if(T.size>O){U(`File exceeds the ${de(O)} limit.`);return}if(!E.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)){U(`Invalid type. Accepted: ${xe(E)}`);return}if(!(l!=null&&l.onUpload)){U("Upload service not configured.");return}try{const C=await l.onUpload(T),k=URL.createObjectURL(T);K.current.add(k);const V={key:C.key,name:C.name??T.name,blobUrl:k};F($=>({...$,[C.key]:V}));const J=[...B,C.key];n(r,j?J:J[0])}catch{U("Upload failed. Please try again."),M.current&&(M.current.value="")}},[B,m,O,E,l,r,n,j]);if(i===!1)return null;const z=T=>{T.preventDefault(),T.stopPropagation(),!(!S||Y)&&R(T.type==="dragenter"||T.type==="dragover")},Z=T=>{var A;T.preventDefault(),T.stopPropagation(),R(!1),!(!S||Y)&&(A=T.dataTransfer.files)!=null&&A[0]&&_(T.dataTransfer.files[0])},ee=T=>{var A;(A=T.target.files)!=null&&A[0]&&(_(T.target.files[0]),T.target.value="")},ne=T=>{if(!S)return;F(I=>{var V;const C={...I},k=(V=C[T])==null?void 0:V.blobUrl;return k&&(URL.revokeObjectURL(k),K.current.delete(k)),delete C[T],C});const A=B.filter(I=>I!==T);n(r,j?A.length>0?A:null:A[0]??null)},oe=async(T,A)=>{var k,V,J;T.preventDefault();const I=(k=Q[A])==null?void 0:k.blobUrl;if(I){(V=window.open(I,"_blank","noopener,noreferrer"))==null||V.focus();return}const C=window.open("","_blank");if(C)try{const $=await((J=l==null?void 0:l.getDownloadUrl)==null?void 0:J.call(l,A));$!=null&&$.url?C.location.href=$.url:C.close()}catch{C.close()}};if(!S&&B.length===0)return null;const se=m-B.length,ce=S&&!Y;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:[a,f&&t.jsx(o.Text,{color:"red",children:" *"})]}),t.jsx(o.Text,{size:"1",color:"gray",children:j?`Up to ${m} files · ${de(O)} each · ${xe(E)}`:`${de(O)} · ${xe(E)}`})]}),B.map(T=>{var A;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(H.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:((A=Q[T])==null?void 0:A.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:I=>oe(I,T),children:"View"}),t.jsx(H.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),S&&t.jsx(o.IconButton,{variant:"ghost",color:"gray",onClick:()=>ne(T),children:t.jsx(H.Cross2Icon,{})})]})]})},T)}),ce&&t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var T;return(T=M.current)==null?void 0:T.click()},onKeyDown:T=>{var A;(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),(A=M.current)==null||A.click())},onDragEnter:z,onDragLeave:z,onDragOver:z,onDrop:Z,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",L?"border-blue-500 bg-blue-50":q?"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:E,onChange:ee}),t.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:q?t.jsxs(t.Fragment,{children:[t.jsx(H.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),t.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:q}),t.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):t.jsxs(t.Fragment,{children:[t.jsx(H.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),t.jsx(o.Text,{size:"2",weight:"medium",children:B.length>0?`Add another file (${se} remaining)`:"Click to upload or drag and drop"}),t.jsxs(o.Text,{size:"1",color:"gray",children:[de(O)," max · ",xe(E)]})]})})]}),S&&Y&&j&&t.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",m," files uploaded. Remove one to replace it."]}),!g&&t.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:re(s,a)})]})},ot=W.withJsonFormsControlProps(kt),st=v.rankWith(10,v.and(v.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})));class je extends Error{}function Dt(e,n){const r=Se.read(e,{type:"array",cellDates:!0});if(r.SheetNames.length===0)throw new je("This file has no sheets.");const a=n??r.SheetNames[0],f=r.Sheets[a];if(!f)throw new je(`This file doesn't have a sheet named "${a}".`);const d=Se.utils.sheet_to_json(f,{header:1,raw:!0,defval:null});return{sheetName:a,matrix:d,rowCount:d.length,colCount:Math.max(0,...d.map(u=>u.length))}}function Mt(e){let n=e+1,r="";for(;n>0;){const a=(n-1)%26;r=String.fromCharCode(65+a)+r,n=Math.floor((n-1)/26)}return r}class G extends Error{constructor(r,a){super(a??r);we(this,"code");this.code=r,this.name="FormulaError"}}const zt=["IFS","IFERROR","AND","OR","NOT","ROUND","ROUNDUP","ROUNDDOWN","INDEX","VLOOKUP","HLOOKUP","SUM","AVERAGE","COUNT","DATE","TODAY"],Ut=["MAX","MIN","MAXA","MINA","MEDIAN","LARGE","SMALL","PERMUT","PERMUTATIONA","MATCH","SWITCH","SUBSTITUTE","TEXTJOIN","COUNTA","UPPER"],Bt=["YEAR","MONTH","DAY","WEEKDAY"],Pt=["IF"],Wt=["CONCATENATE","CONCAT","LEN","TRIM","LOWER","LEFT","RIGHT","MID","FIND","SEARCH"],$t=new Set([...zt,...Ut,...Bt,...Wt,...Pt]),_t=/"(?:[^"]|"")*"/g,Ae=new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(","g");function Vt(e){const n=e.replace(_t,a=>" ".repeat(a.length));Ae.lastIndex=0;let r;for(;(r=Ae.exec(n))!==null;){const a=r[1].toUpperCase();if(!$t.has(a))throw new G("NAME",`Function ${a} is not allowed.`)}}function Ht(e,n,r){let a=e;if(a==null)throw r.NA;if(typeof a=="object"&&!(a instanceof r)&&(a=n.retrieveRef(a)),a instanceof r)throw a;if(typeof a=="boolean")return a;if(typeof a=="number")return a!==0;throw r.VALUE}function lt(e){return e!==null&&typeof e=="object"&&"value"in e?e.value:e}function ue(e){const n=lt(e);return Array.isArray(n)?n.flat(1/0):[n]}function w(e){const n=lt(e);return Array.isArray(n)?n.flat(1/0)[0]:n}function ye(e){return e===void 0?void 0:w(e)}function P(e){return e==null||e===""?"":typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof Date?e.toLocaleDateString():String(e)}function Gt(e,n){return e instanceof n?e:new n(e.message||"#ERROR!")}function D(e){return e.find(n=>n instanceof Error)}function Jt(e,n){const r=d=>{throw Gt(d,n)},a=(d,{checkArgsForErrors:u=!0}={})=>(...c)=>{const s=c.flatMap(ue);if(u){const l=D(s);l&&r(l)}const i=d(...s);return i instanceof Error?r(i):i},f=(d,{toText:u=!1}={})=>c=>{const s=w(c),i=D([s]);i&&r(i);const l=d(u?P(s):s);return l instanceof Error?r(l):l};return{IF:(d,u,c,s)=>{const i=Ht(u,d,n);if(c==null)throw n.NA;return i?c:s??!1},MAX:a(e.MAX),MIN:a(e.MIN),MAXA:a(e.MAXA),MINA:a(e.MINA),MEDIAN:a(e.MEDIAN),COUNTA:a(e.COUNTA,{checkArgsForErrors:!1}),LARGE:(d,u)=>{const c=ue(d),s=w(u),i=D([...c,s]);i&&r(i);const l=e.LARGE(c,s);return l instanceof Error?r(l):l},SMALL:(d,u)=>{const c=ue(d),s=w(u),i=D([...c,s]);i&&r(i);const l=e.SMALL(c,s);return l instanceof Error?r(l):l},PERMUT:(d,u)=>{const c=[w(d),w(u)],s=D(c);s&&r(s);const i=e.PERMUT(c[0],c[1]);return i instanceof Error?r(i):i},PERMUTATIONA:(d,u)=>{const c=[w(d),w(u)],s=D(c);s&&r(s);const i=e.PERMUTATIONA(c[0],c[1]);return i instanceof Error?r(i):i},MATCH:(d,u)=>{const c=w(d),s=ue(u),i=D([c,...s]);i&&r(i);const l=e.MATCH(c,s,0);return l instanceof Error?r(l):l},SWITCH:(...d)=>{const u=d.map(w),c=D(u);c&&r(c);const s=e.SWITCH(...u);return s instanceof Error?r(s):s},SUBSTITUTE:(d,u,c,s)=>{const i=[P(w(d)),P(w(u)),P(w(c))];s!==void 0&&i.push(w(s));const l=D(i);l&&r(l);const g=e.SUBSTITUTE(...i);return g instanceof Error?r(g):g},TEXTJOIN:(d,u,...c)=>{const s=P(w(d)),i=w(u),l=c.flatMap(ue).map(P),g=D([s,i]);g&&r(g);const h=e.TEXTJOIN(s,i,l);return h instanceof Error?r(h):h},UPPER:f(e.UPPER),YEAR:f(e.YEAR),MONTH:f(e.MONTH),DAY:f(e.DAY),WEEKDAY:(d,u)=>{const c=w(d),s=w(u),i=D([c]);i&&r(i);const l=e.WEEKDAY(c,s);return l instanceof Error?r(l):l},CONCATENATE:(...d)=>{const u=d.flatMap(ue),c=D(u);c&&r(c);const s=e.CONCATENATE(...u.map(P));return s instanceof Error?r(s):s},CONCAT:(...d)=>{const u=d.flatMap(ue),c=D(u);c&&r(c);const s=e.CONCAT(...u.map(P));return s instanceof Error?r(s):s},LEN:f(e.LEN,{toText:!0}),TRIM:f(e.TRIM,{toText:!0}),LOWER:f(e.LOWER,{toText:!0}),LEFT:(d,u)=>{const c=w(d),s=ye(u),i=D([c]);i&&r(i);const l=e.LEFT(P(c),s);return l instanceof Error?r(l):l},RIGHT:(d,u)=>{const c=w(d),s=ye(u),i=D([c]);i&&r(i);const l=e.RIGHT(P(c),s);return l instanceof Error?r(l):l},MID:(d,u,c)=>{const s=w(d),i=w(u),l=w(c),g=D([s,i,l]);g&&r(g);const h=e.MID(P(s),i,l);return h instanceof Error?r(h):h},FIND:(d,u,c)=>{const s=w(d),i=w(u),l=ye(c),g=D([s,i]);g&&r(g);const h=e.FIND(P(s),P(i),l);return h instanceof Error?r(h):h},SEARCH:(d,u,c)=>{const s=w(d),i=w(u),l=ye(c),g=D([s,i]);g&&r(g);const h=e.SEARCH(P(s),P(i),l);return h instanceof Error?r(h):h}}}const Kt={"#REF!":"REF","#VALUE!":"VALUE","#DIV/0!":"DIV0","#NAME?":"NAME","#N/A":"NA","#NUM!":"NUM","#NULL!":"NULL"};function Fe(e){return Kt[e.error]??"ERROR"}function Ne(e,n){if(e instanceof G)return e;if(e instanceof n){const r=e.details;return r instanceof G?r:r instanceof n?new G(Fe(r),r.message):new G(Fe(e),e.message)}return new G("ERROR",e instanceof Error?e.message:void 0)}function Xt(e){return Math.max(0,...e.map(n=>(n==null?void 0:n.length)??0))}function qt(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 G("REF");const a=r[n.col-1];return a==null||a===""?null:a}}function Yt(e){return n=>{const r=Math.min(n.from.row,n.to.row),a=Math.min(n.from.col,n.to.col),f=Math.max(n.from.row,n.to.row),d=Math.max(n.from.col,n.to.col),u=Xt(e);if(r>e.length||a>u)throw new G("REF");const c=Math.min(f,e.length),s=[];for(let i=r;i<=c;i++){const l=e[i-1],g=[];if(l!=null){const h=Math.min(d,l.length);for(let x=a;x<=h;x++){const m=l[x-1];g.push(m==null||m===""?null:m)}}s.push(g)}return s}}function Zt(e){if(e==null||e==="")return null;if(typeof e=="number"||typeof e=="string"||typeof e=="boolean"||e instanceof Date)return e;throw new G("VALUE")}async function Qt(e,n){if(typeof n!="string")throw new G("ERROR");const r=n.trim();if(r==="")throw new G("ERROR");const a=r.startsWith("=")?r.slice(1):r;Vt(a);const[f,d]=await Promise.all([import("fast-formula-parser"),import("@formulajs/formulajs")]),u=f.default??f,c=u.FormulaError,s=new u({onCell:qt(e),onRange:Yt(e),functions:Jt(d,c)});let i;try{i=s.parse(a,{row:1,col:1,sheet:"Sheet1"})}catch(l){throw Ne(l,c)}if(i instanceof c)throw Ne(i,c);return Zt(i)}const Oe={REF:"#REF!",VALUE:"#VALUE!",DIV0:"#DIV/0!",NAME:"#NAME?",ERROR:"#ERROR!",NA:"#N/A",NUM:"#NUM!",NULL:"#NULL!"};async function er(e,n){return e.length===0?n.map(r=>({label:(r==null?void 0:r.label)??"(unknown)",value:null,error:Oe.ERROR})):Promise.all(n.map(async r=>{try{if(!r||typeof r.label!="string"||typeof r.expression!="string")throw new G("ERROR");return{label:r.label,value:await Qt(e,r.expression)}}catch(a){const f=a instanceof G?a.code:"ERROR";return{label:(r==null?void 0:r.label)??"(unknown)",value:null,error:Oe[f]}}}))}const tr=".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv",rr=10*1024*1024,be=200,nr=50,or=[];function me(e){return e==null||e===""?"":e instanceof Date?e.toLocaleDateString():String(e)}const sr=({data:e,handleChange:n,path:r,label:a,required:f,schema:d,enabled:u,errors:c,visible:s=!0})=>{var he;ie(s,r,n,null);const i=!c||c.length===0,l=u!==!1,g=(d==null?void 0:d["x-spreadsheet"])??{},h=(d==null?void 0:d["x-evaluate"])??or,x=g.accept??tr,m=g.maxSize??rr,O=g.persistSheet!==!1,E=g.columnHeader===!0,j=g.rowHeader===!0,S=g.showSheet!==!1,L=g.sheetName,R=e??null,[q,U]=b.useState(()=>{var y;return R!=null&&R.sheet||(((y=R==null?void 0:R.derivations)==null?void 0:y.length)??0)>0?"ready":"empty"}),[Q,F]=b.useState(null),[K,M]=b.useState(!1),[B,Y]=b.useState(null),_=b.useRef(null),z=B??(R==null?void 0:R.sheet)??null,Z=(R==null?void 0:R.derivations)??[],ee=z!=null||R!=null,ne=b.useCallback(async y=>{if(F(null),y.size>m){F(`File exceeds the ${de(m)} limit.`);return}if(!x.split(",").map(p=>p.trim()).some(p=>p==="*"||p==="*/*"?!0:p.endsWith("/*")?y.type.startsWith(p.slice(0,-1)):p.startsWith(".")?y.name.toLowerCase().endsWith(p.toLowerCase()):y.type===p)){F(`Invalid type. Accepted: ${xe(x)}`);return}U("parsing");let te;try{const p=await y.arrayBuffer();te=Dt(p,L).matrix}catch(p){U("error"),F(p instanceof je?p.message:"This doesn't look like a valid spreadsheet. Please check the file and try again.");return}Y(te);const le=await er(te,h);n(r,O?{sheet:te,derivations:le}:{derivations:le}),U("ready")},[x,m,O,L,h,r,n]);if(s===!1||!l&&!ee)return null;const oe=y=>{y.preventDefault(),y.stopPropagation(),l&&M(y.type==="dragenter"||y.type==="dragover")},se=y=>{var N;y.preventDefault(),y.stopPropagation(),M(!1),l&&(N=y.dataTransfer.files)!=null&&N[0]&&ne(y.dataTransfer.files[0])},ce=y=>{var N;(N=y.target.files)!=null&&N[0]&&(ne(y.target.files[0]),y.target.value="")},T=()=>{l&&(Y(null),F(null),U("empty"),n(r,null))},A=E?1:0,I=j?1:0,C=z?z.slice(A):[],k=C.slice(0,be),V=Math.min(nr,Math.max(0,...k.map(y=>Math.max(0,y.length-I)))),J=Array.from({length:V},(y,N)=>N+I),$=S&&z==null&&R!=null,fe=E&&j?me((he=z==null?void 0:z[0])==null?void 0:he[0]):"";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:[a,f&&t.jsx(o.Text,{color:"red",children:" *"})]}),t.jsxs(o.Text,{size:"1",color:"gray",children:[de(m)," max · ",xe(x)]})]}),ee&&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(H.FileTextIcon,{width:"20",height:"20"})}),t.jsx(o.Box,{style:{flex:1},children:t.jsx(o.Text,{size:"2",weight:"bold",children:"Spreadsheet uploaded"})}),t.jsx(H.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),l&&t.jsx(o.IconButton,{variant:"ghost",color:"gray",onClick:T,"aria-label":"Remove spreadsheet",children:t.jsx(H.Cross2Icon,{})})]})}),l&&t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var y;return(y=_.current)==null?void 0:y.click()},onKeyDown:y=>{var N;(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),(N=_.current)==null||N.click())},onDragEnter:oe,onDragLeave:oe,onDragOver:oe,onDrop:se,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",K?"border-blue-500 bg-blue-50":Q?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[t.jsx("input",{ref:_,type:"file",style:{display:"none"},accept:x,onChange:ce}),t.jsx(o.Flex,{direction:"column",align:"center",gap:"2",children:q==="parsing"?t.jsxs(t.Fragment,{children:[t.jsx(o.Spinner,{size:"3"}),t.jsx(o.Text,{size:"2",color:"gray",children:"Parsing spreadsheet…"})]}):Q?t.jsxs(t.Fragment,{children:[t.jsx(H.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),t.jsx(o.Text,{size:"2",color:"red",weight:"medium",children:Q}),t.jsx(o.Text,{size:"1",color:"gray",children:"Click to try again"})]}):t.jsxs(t.Fragment,{children:[t.jsx(H.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),t.jsx(o.Text,{size:"2",weight:"medium",children:ee?"Click to upload a replacement":"Click to upload or drag and drop"}),t.jsxs(o.Text,{size:"1",color:"gray",children:[de(m)," max · ",xe(x)]})]})})]}),z&&S&&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,{children:fe}),J.map(y=>{var N;return t.jsx(o.Table.ColumnHeaderCell,{children:E?me((N=z[0])==null?void 0:N[y]):Mt(y)},y)})]})}),t.jsx(o.Table.Body,{children:k.map((y,N)=>{var te;const pe=A+N;return t.jsxs(o.Table.Row,{children:[t.jsx(o.Table.RowHeaderCell,{children:j?me((te=z[pe])==null?void 0:te[0]):pe+1}),J.map(le=>t.jsx(o.Table.Cell,{children:me(y[le])},le))]},N)})})]})}),C.length>be&&t.jsxs(o.Text,{size:"1",color:"gray",mt:"1",style:{display:"block"},children:["Showing first ",be," of ",C.length," rows"]})]}),$&&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."}),Z.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:Z.map((y,N)=>t.jsxs(o.Flex,{justify:"between",children:[t.jsx(o.Text,{size:"2",children:y.label}),y.error?t.jsx(o.Text,{size:"2",color:"red",children:y.error}):t.jsx(o.Text,{size:"2",children:me(y.value)})]},N))})]}),!i&&t.jsx(o.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:re(c,a)})]})},it=W.withJsonFormsControlProps(sr),ct=v.rankWith(10,v.schemaMatches(e=>e.type==="object"&&typeof e["x-spreadsheet"]=="object")),lr=({data:e,path:n,schema:r,uischema:a,enabled:f,visible:d,addItem:u,removeItems:c,rootSchema:s,arraySchema:i})=>{const l=i?r:r.items,g=i||r;if(d===!1||!l||typeof l!="object"||Array.isArray(l))return null;const h=l,x=Array.isArray(e)?e:[],m=g.title||"Array Items",O=()=>{const j=v.createDefaultValue(h,s);u&&u(n,j)()},E=j=>{if(c){const S=c(n,[j]);S&&S()}};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:m}),x.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."})}),x.map((j,S)=>{var R;const L=`${n}.${S}`;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 ",S+1]}),f&&t.jsxs(o.Button,{type:"button",color:"red",variant:"soft",onClick:()=>E(S),title:"Remove item",children:[t.jsx(H.TrashIcon,{}),"Remove"]})]}),t.jsx(o.Box,{children:t.jsx(W.JsonFormsDispatch,{schema:h,uischema:((R=a.options)==null?void 0:R.detail)||(h.type==="object"||h.properties?{type:"VerticalLayout",elements:Object.keys(h.properties||{}).map(q=>({type:"Control",scope:`#/properties/${q}`}))}:{type:"Control",scope:"#"}),path:L,enabled:f,renderers:void 0,cells:void 0})})]})},L)}),f&&t.jsx(o.Box,{mt:"2",children:t.jsxs(o.Button,{type:"button",variant:"surface",onClick:O,children:[t.jsx(H.PlusIcon,{}),"Add Item"]})})]})})},Ce=W.withJsonFormsArrayControlProps(lr),at=v.rankWith(3,v.isObjectArrayControl),ut=({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})})},dt=v.rankWith(1,v.uiTypeIs("Label")),ir=v.rankWith(3,v.isPrimitiveArrayControl),cr=[{tester:ze,renderer:Ct},{tester:Be,renderer:Et},{tester:We,renderer:Rt},{tester:_e,renderer:wt},{tester:Je,renderer:Ge},{tester:He,renderer:St},{tester:Xe,renderer:It},{tester:Ye,renderer:qe},{tester:Qe,renderer:Ze},{tester:tt,renderer:et},{tester:nt,renderer:rt},{tester:st,renderer:ot},{tester:ct,renderer:it},{tester:at,renderer:Ce},{tester:ir,renderer:Ce},{tester:dt,renderer:ut}];exports.ArrayControl=Ce;exports.ArrayControlTester=at;exports.BooleanControl=Pe;exports.BooleanControlTester=We;exports.CategorizationLayoutRenderer=rt;exports.CategorizationLayoutTester=nt;exports.DateControl=Ke;exports.DateControlTester=Xe;exports.FileControl=ot;exports.FileControlTester=st;exports.GroupLayoutRenderer=et;exports.GroupLayoutTester=tt;exports.HorizontalLayoutRenderer=Ze;exports.HorizontalLayoutTester=Qe;exports.LabelRenderer=ut;exports.LabelTester=dt;exports.NumberControl=Ue;exports.NumberControlTester=Be;exports.RadioControl=$e;exports.RadioControlTester=_e;exports.SearchSelectControl=Ge;exports.SearchSelectControlTester=Je;exports.SearchServiceProvider=jt;exports.SelectControl=Ve;exports.SelectControlTester=He;exports.SpreadsheetControl=it;exports.SpreadsheetControlTester=ct;exports.TextControl=Me;exports.TextControlTester=ze;exports.UploadProvider=bt;exports.VerticalLayoutRenderer=qe;exports.VerticalLayoutTester=Ye;exports.radixRenderers=cr;exports.useSearchService=De;exports.useUpload=Le;
|
|
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;
|