@opennsw/jsonforms-renderers 0.12.0 → 0.13.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 +2 -0
- package/dist/renderers.cjs.js +3 -3
- package/dist/renderers.es.js +1586 -1433
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -115,6 +115,8 @@ export declare const SelectControl: ({ data, handleChange, path, label, required
|
|
|
115
115
|
|
|
116
116
|
export declare const SelectControlTester: RankedTester;
|
|
117
117
|
|
|
118
|
+
export declare const SelectObjectControlTester: RankedTester;
|
|
119
|
+
|
|
118
120
|
export declare const SpreadsheetControl: ComponentType<OwnPropsOfControl>;
|
|
119
121
|
|
|
120
122
|
export declare const SpreadsheetControlTester: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => number;
|
package/dist/renderers.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`).map(
|
|
3
|
-
`):"",ht=({data:e,handleChange:r,path:t,label:o,required:a,errors:i,uischema:l,schema:d,enabled:c,visible:u=!0})=>{var p;if(ve(u,t,r),u===!1)return null;const f=i.length===0;return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[o," ",a&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsx(s.TextField.Root,{value:e||"",onChange:h=>r(t,h.target.value),disabled:!c,placeholder:(p=l.options)==null?void 0:p.placeholder,color:f?void 0:"red",id:t}),!f&&n.jsx(s.Text,{color:"red",size:"1",children:xe(i,o)}),d.description&&n.jsx(s.Text,{size:"1",color:"gray",children:d.description})]})})},xt=v.rankWith(1,v.isStringControl),Sr=$.withJsonFormsControlProps(ht),mt=({data:e,handleChange:r,path:t,label:o,required:a,errors:i,uischema:l,schema:d,enabled:c,visible:u=!0})=>{var h;if(ve(u,t,r),u===!1)return null;const f=i.length===0,p=m=>{if(m===""){r(t,void 0);return}const y=Number(m);isNaN(y)||r(t,y)};return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[o," ",a&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsx(s.TextField.Root,{type:"number",value:e??"",onChange:m=>p(m.target.value),disabled:!c,placeholder:(h=l.options)==null?void 0:h.placeholder,color:f?void 0:"red",id:t}),!f&&n.jsx(s.Text,{color:"red",size:"1",children:xe(i,o)}),d.description&&n.jsx(s.Text,{size:"1",color:"gray",children:d.description})]})})},gt=v.rankWith(2,v.or(v.isNumberControl,v.isIntegerControl)),Rr=$.withJsonFormsControlProps(mt),yt=({data:e,handleChange:r,path:t,label:o,required:a,errors:i,schema:l,enabled:d,visible:c=!0})=>{if(ve(c,t,r),c===!1)return null;const u=i.length===0;return n.jsxs(s.Box,{mb:"4",children:[n.jsxs(s.Flex,{gap:"2",align:"center",children:[n.jsx(s.Checkbox,{checked:!!e,onCheckedChange:f=>r(t,f===!0),disabled:!d,id:t}),n.jsxs(s.Text,{as:"label",size:"2",htmlFor:t,children:[o," ",a&&"*"]})]}),!u&&n.jsx(s.Text,{color:"red",size:"1",className:"block mt-1",children:xe(i,o)}),l.description&&n.jsx(s.Text,{size:"1",color:"gray",className:"block mt-1",children:l.description})]})},bt=v.rankWith(2,v.isBooleanControl),Ar=$.withJsonFormsControlProps(yt),vt=({data:e,handleChange:r,path:t,label:o,required:a,errors:i,schema:l,enabled:d,visible:c=!0})=>{if(ve(c,t,r),c===!1)return null;const u=i.length===0;let f=[];l.enum?f=l.enum.map(h=>({value:h,label:String(h)})):l.oneOf&&(f=l.oneOf.map(h=>({value:h.const,label:h.title||String(h.const)})));const p=e;return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"div",size:"2",weight:"bold",children:[o," ",a&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsx(s.RadioGroup.Root,{value:p!==void 0?String(p):"",onValueChange:h=>{const m=f.find(y=>String(y.value)===h);m&&r(t,m.value)},disabled:!d,children:n.jsx(s.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:f.map(h=>n.jsxs(s.Flex,{align:"center",gap:"2",style:{minWidth:"max-content"},children:[n.jsx(s.RadioGroup.Item,{value:String(h.value)}),n.jsx(s.Text,{size:"2",color:d?void 0:"gray",children:h.label})]},String(h.value)))})}),!u&&n.jsx(s.Text,{color:"red",size:"1",children:xe(i,o)}),l.description&&n.jsx(s.Text,{size:"1",color:"gray",children:l.description})]})})},wt=(e,r,t)=>{var a;return v.or(v.isEnumControl,v.isOneOfControl)(e,r,t)&&((a=e==null?void 0:e.options)==null?void 0:a.format)==="radio"?3:-1},Fr=$.withJsonFormsControlProps(vt),Tt=({data:e,handleChange:r,path:t,label:o,required:a,errors:i,schema:l,uischema:d,enabled:c,visible:u=!0})=>{var I,L,B;ve(u,t,r);const f=((I=d.options)==null?void 0:I.autocomplete)===!0,[p,h]=g.useState(!1),[m,y]=g.useState(""),[N,O]=g.useState(0),M=g.useRef(null);if(g.useEffect(()=>{if(!f||!p)return;const b=E=>{M.current&&!M.current.contains(E.target)&&h(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[f,p]),u===!1)return null;const j=i.length===0;let S=[];l.enum?S=l.enum.map(b=>({value:String(b),label:String(b)})):l.oneOf&&(S=l.oneOf.map(b=>({value:String(b.const),label:b.title||String(b.const)})));const k=e!==void 0?String(e):"",C=((L=d.options)==null?void 0:L.placeholder)||"Select an option";if(f){const b=((B=S.find(F=>F.value===k))==null?void 0:B.label)??"",E=p?S.filter(F=>F.label.toLowerCase().includes(m.toLowerCase())):S,te=Math.min(N,E.length-1),H=F=>{r(t,F.value),h(!1)},X=F=>{F.stopPropagation(),r(t,void 0),y("")},D=F=>{(F.key==="Enter"||F.key===" ")&&X(F)};return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[o," ",a&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsxs("div",{ref:M,style:{position:"relative"},children:[n.jsx(s.TextField.Root,{id:t,value:p?m:b,placeholder:C,disabled:!c,style:j?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:F=>{y(F.target.value),O(0),p||h(!0)},onFocus:()=>{c&&!p&&(y(""),O(0),h(!0))},onKeyDown:F=>{F.key==="Escape"?h(!1):F.key==="ArrowDown"?(F.preventDefault(),p?O(Y=>Math.min(Y+1,E.length-1)):(y(""),h(!0))):F.key==="ArrowUp"?(F.preventDefault(),p&&O(Y=>Math.max(Y-1,0))):F.key==="Enter"&&p&&E[te]&&(F.preventDefault(),H(E[te]))},children:n.jsx(s.TextField.Slot,{side:"right",children:n.jsxs(s.Flex,{align:"center",gap:"1",children:[k&&c&&n.jsx("span",{role:"button",tabIndex:0,onMouseDown:F=>F.preventDefault(),onClick:X,onKeyDown:D,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),n.jsx(Z.ChevronDownIcon,{style:{transform:p?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),p&&n.jsx(s.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:n.jsx(s.ScrollArea,{style:{maxHeight:240},children:n.jsxs(s.Box,{p:"1",children:[E.length===0&&n.jsx(s.Box,{px:"3",py:"2",children:n.jsx(s.Text,{size:"2",color:"gray",children:"No results found."})}),E.map((F,Y)=>n.jsx(s.Box,{px:"3",py:"2",onMouseDown:Q=>Q.preventDefault(),onClick:()=>H(F),onMouseEnter:()=>O(Y),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:Y===te?"var(--accent-4)":F.value===k?"var(--accent-3)":void 0},children:n.jsx(s.Text,{size:"2",children:F.label})},F.value))]})})})]}),!j&&n.jsx(s.Text,{color:"red",size:"1",children:xe(i,o)}),l.description&&n.jsx(s.Text,{size:"1",color:"gray",children:l.description})]})})}return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[o," ",a&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsxs(s.Select.Root,{value:k,onValueChange:b=>r(t,b),disabled:!c,children:[n.jsx(s.Select.Trigger,{placeholder:C,color:j?void 0:"red",id:t}),n.jsx(s.Select.Content,{children:S.map(b=>n.jsx(s.Select.Item,{value:b.value,children:b.label},b.value))})]}),!j&&n.jsx(s.Text,{color:"red",size:"1",children:xe(i,o)}),l.description&&n.jsx(s.Text,{size:"1",color:"gray",children:l.description})]})})},jt=v.rankWith(2,v.or(v.isEnumControl,v.isOneOfControl)),Or=$.withJsonFormsControlProps(Tt),Et=/\{([A-Za-z0-9_]+)(?:\(([^(){}]*)\))?\}/g,Ir={today:e=>ct().format(e||"YYYY-MM-DD")},kr=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="bigint",Ye=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);function Ne(e,r,t={}){const o={...Ir,...t};return e.replace(Et,(a,i,l)=>{let d;if(l===void 0){if(!Ye(r,i))return a;d=r[i]}else{if(!Ye(o,i))return a;try{d=o[i](l)}catch{return a}}return d==null?"":kr(d)?String(d):a})}function _e(e){const r=[];let t=0;for(const o of e.matchAll(Et))o.index>t&&r.push(e.slice(t,o.index)),r.push(o[2]===void 0?{name:o[1]}:{name:o[1],arg:o[2]}),t=o.index+o[0].length;return t<e.length&&r.push(e.slice(t)),r}function Dr(e){if(typeof e=="string"&&e.length>0)return e;if(e&&typeof e=="object"&&typeof e.value=="string"){const r=e.value;return r.length>0?r:void 0}}function Nr(e){if(typeof e=="string")return e.length>0?{parent:e}:void 0;if(!e||typeof e!="object")return;const r=Object.entries(e);if(r.length===0)return;const t={},o=[];for(const[a,i]of r)typeof i=="string"&&i.length>0?t[a]=i:o.push(a);return o.length>0&&console.warn(`x-search.dependsOn: ignoring invalid entries [${o.join(", ")}]`),Object.keys(t).length===0?(console.warn("x-search.dependsOn: map has no valid entries; search will not fetch until fixed"),{}):t}function Lr(e,r,t){const o={};for(const[a,i]of Object.entries(e))o[a]=Dr(v.Resolve.data(r,t?`${t}.${i}`:i));return o}function Ke(e,r){return r?{...e,name:Ne(r,e)}:e}const Mr={"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}},zr=({data:e,handleChange:r,path:t,label:o,required:a,errors:i,enabled:l,visible:d=!0,schema:c,uischema:u})=>{var Oe,pe;const f=(c==null?void 0:c["x-search"])??{service:"",displayTemplate:""},p=f.service??"",h=f.mode??"large-paginated-list",m=Mr[h],y=(m==null?void 0:m.fetchOnOpen)??!1,N=typeof f.displayTemplate=="string"?f.displayTemplate:"",O=$.useJsonForms(),M=t.split(".").slice(0,-1).join("."),{parentValues:j,parentValuesKey:S,missingParent:k}=g.useMemo(()=>{var he;const T=Nr(f.dependsOn);if(!T)return{parentValues:void 0,parentValuesKey:"",missingParent:!1};const G=Lr(T,(he=O.core)==null?void 0:he.data,M),ie=Object.keys(G).length===0||Object.values(G).some(Te=>!Te);return{parentValues:G,parentValuesKey:JSON.stringify(G),missingParent:ie}},[f.dependsOn,(Oe=O.core)==null?void 0:Oe.data,M]),C=g.useMemo(()=>j?{...f.params,...j}:f.params,[j,S,f.params]),I=pt(p),L=c.type==="object",B=L?typeof e=="string"?{value:e}:e??void 0:void 0,b=L?B==null?void 0:B.value:e,E=B==null?void 0:B.label,te=p?I?m?N?null:"x-search.displayTemplate is required.":`Invalid x-search.mode "${h}". Expected "small-list", "large-searchable-list", or "large-paginated-list".`:`Search service "${p}" is not registered.`:"Search not configured.",H=l!==!1,X=!i||i.length===0,[D,F]=g.useState(!1),[Y,Q]=g.useState(""),[ce,re]=g.useState([]),[we,A]=g.useState(!1),[J,ue]=g.useState(!1),[me,ee]=g.useState(!1),[fe,oe]=g.useState(null),[ge,x]=g.useState(void 0),w=g.useRef(void 0),z=g.useRef(null),W=g.useRef(null),K=g.useRef(null),q=g.useRef(void 0),R=g.useRef(void 0);g.useEffect(()=>{if(!j)return;const T=R.current;if(R.current=j,!T||!b)return;Object.keys(j).some(ie=>T[ie]!==void 0&&T[ie]!==j[ie])&&r(t,L?void 0:null)},[S,b,r,t,L]),g.useEffect(()=>{var he,Te;if(te){x(void 0),q.current=void 0;return}if(!b){x(void 0),q.current=void 0;return}if(((he=q.current)==null?void 0:he.value)===b&&((Te=q.current)==null?void 0:Te.label)===E)return;if(L&&E){x({id:b,name:E}),q.current={value:b,label:E};return}if(x({id:b,name:E??b}),!(I!=null&&I.resolve)){q.current={value:b,label:E};return}let T=!1;const G=b,ie=E;return I.resolve(G,C).then(Fe=>{T||(Fe&&x(Ke(Fe,N)),q.current={value:G,label:ie})}).catch(()=>{T||(q.current={value:G,label:ie})}),()=>{T=!0}},[te,b,E,L,I,C,N]);const U=g.useCallback(async(T,G=!1)=>{var he;if(te)return;if(!I){oe("Search service not configured.");return}(he=W.current)==null||he.abort();const ie=new AbortController;W.current=ie,G?ee(!0):(ue(!0),ee(!1),oe(null));try{const Te=await I.search({query:T,cursor:G?w.current:void 0,signal:ie.signal,params:C});if(ie.signal.aborted)return;const Fe=(Te.options??[]).map(Le=>Ke(Le,N));re(G?Le=>[...Le,...Fe]:Fe),w.current=Te.nextCursor,A(((m==null?void 0:m.paginated)??!1)&&Te.nextCursor!=null)}catch{if(ie.signal.aborted)return;oe("Failed to load results. Please try again.")}finally{ie.signal.aborted||(G?ee(!1):ue(!1))}},[te,I,m==null?void 0:m.paginated,C,N]);if(g.useEffect(()=>{if(!D)return;const T=G=>{K.current&&!K.current.contains(G.target)&&F(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[D]),g.useEffect(()=>{var T;D||((T=W.current)==null||T.abort(),Q(""),re([]),A(!1),oe(null),ue(!1),ee(!1),w.current=void 0)},[D]),g.useEffect(()=>{if(!D)return;if(k){re([]),A(!1),oe(null),w.current=void 0;return}if(!Y&&!y){re([]),A(!1),oe(null),w.current=void 0;return}z.current&&clearTimeout(z.current);const T=Y?300:0;return z.current=setTimeout(()=>{re([]),A(!1),w.current=void 0,U(Y)},T),()=>{z.current&&clearTimeout(z.current)}},[Y,D,y,U,k,S]),ve(d,t,r),d===!1)return null;const se=()=>{Q(""),re([]),A(!1),oe(null),w.current=void 0,F(!0)},_=T=>{r(t,L?{value:T.id,label:T.name}:T.id),x(T),q.current={value:T.id,label:L?T.name:void 0},F(!1)},P=T=>{T.stopPropagation(),r(t,void 0),x(void 0)},je=T=>{(T.key==="Enter"||T.key===" ")&&P(T)},Ae=((pe=u==null?void 0:u.options)==null?void 0:pe.placeholder)??"Select an option";return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[o," ",a&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsxs("div",{ref:K,style:{position:"relative"},children:[n.jsx(s.TextField.Root,{id:t,value:D?Y:(ge==null?void 0:ge.name)??"",placeholder:D&&(m!=null&&m.searchable)?"Search...":Ae,disabled:!H,readOnly:D&&!(m!=null&&m.searchable),style:X?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:T=>{m!=null&&m.searchable&&(Q(T.target.value),D||se())},onFocus:()=>{H&&!D&&se()},onKeyDown:T=>{T.key==="Escape"&&F(!1)},children:n.jsx(s.TextField.Slot,{side:"right",children:n.jsxs(s.Flex,{align:"center",gap:"1",children:[b&&H&&n.jsx("span",{role:"button",tabIndex:0,onMouseDown:T=>T.preventDefault(),onClick:P,onKeyDown:je,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),n.jsx(Z.ChevronDownIcon,{style:{transform:D?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),D&&n.jsx(s.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:te?n.jsx(s.Box,{p:"3",children:n.jsx(s.Text,{size:"2",color:"gray",children:te})}):n.jsx(s.ScrollArea,{style:{maxHeight:240},children:n.jsxs(s.Box,{p:"1",children:[J&&n.jsx(s.Flex,{justify:"center",p:"4",children:n.jsx(s.Spinner,{})}),!J&&fe&&n.jsx(s.Box,{px:"3",py:"2",children:n.jsx(s.Text,{size:"2",color:"red",children:fe})}),!J&&!fe&&ce.length===0&&n.jsx(s.Box,{px:"3",py:"2",children:n.jsx(s.Text,{size:"2",color:"gray",children:k?"Select the related field first.":Y||y?"No results found.":"Type to search…"})}),ce.map(T=>n.jsx(s.Box,{px:"3",py:"2",onMouseDown:G=>G.preventDefault(),onClick:()=>_(T),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:T.id===b?"var(--accent-3)":void 0},className:"hover:bg-(--gray-3)",children:n.jsx(s.Text,{size:"2",children:T.name})},T.id)),(m==null?void 0:m.paginated)&&we&&!me&&n.jsx(s.Box,{px:"3",py:"2",children:n.jsx(s.Button,{variant:"ghost",size:"1",style:{width:"100%"},onMouseDown:T=>T.preventDefault(),onClick:()=>void U(Y,!0),children:"Load more"})}),me&&n.jsx(s.Flex,{justify:"center",p:"2",children:n.jsx(s.Spinner,{})})]})})})]}),!X&&n.jsx(s.Text,{color:"red",size:"1",children:xe(i,o)}),c.description&&n.jsx(s.Text,{size:"1",color:"gray",children:c.description})]})})},Ct=$.withJsonFormsControlProps(zr),St=v.rankWith(3,v.schemaMatches(e=>{const r=e["x-search"];return(e.type==="string"||e.type==="object")&&typeof(r==null?void 0:r.service)=="string"&&r.service!==""})),Ur=e=>{if(e)return/^\d{2}:\d{2}$/.test(e)?`${e}:00`:e},qe=(e,r)=>{if(!e)return"";const t=e.match(/^(\d{2}:\d{2})(:\d{2})?/);return t?r?`${t[1]}${t[2]??":00"}`:t[1]:e},Pr=(e,r)=>ct(`${e}T${r}`).format(),$r=({path:e,label:r,required:t,errors:o,description:a,children:i})=>{const l=o.length===0;return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:e,children:[r," ",t&&n.jsx(s.Text,{color:"red",children:"*"})]}),i,!l&&n.jsx(s.Text,{color:"red",size:"1",children:xe(o,r)}),a&&n.jsx(s.Text,{size:"1",color:"gray",children:a})]})})},Rt=({data:e,handleChange:r,path:t,label:o,required:a,errors:i,schema:l,uischema:d,enabled:c,visible:u=!0})=>{var k;if(g.useEffect(()=>{u===!1&&r(t,void 0)},[u,t,r]),u===!1)return null;const f=i.length===0,p=typeof e=="string"?e:"",h=((k=d==null?void 0:d.options)==null?void 0:k.showSeconds)===!0,m=h?1:60,y=C=>n.jsx($r,{path:t,label:o,required:a,errors:i,description:l.description,children:C});if(l.format==="time")return y(n.jsx(s.TextField.Root,{type:"time",step:m,value:qe(p,h),onChange:C=>r(t,Ur(C.target.value)),disabled:!c,color:f?void 0:"red",id:t}));const N=l.format==="date-time",[O="",M=""]=p.split("T"),j=qe(M,h),S=(C,I)=>{if(!C){r(t,void 0);return}r(t,N?Pr(C,I||"00:00"):C)};return y(n.jsxs(s.Flex,{gap:"2",align:"center",children:[n.jsx(s.TextField.Root,{type:"date",value:O,disabled:!c,color:f?void 0:"red",onChange:C=>S(C.target.value,j),id:t,style:{flex:1}}),N&&n.jsx(s.TextField.Root,{type:"time",step:m,value:j,disabled:!c||!O,color:f?void 0:"red",onChange:C=>S(O,C.target.value),style:{flex:1}})]}))},At=v.rankWith(2,v.or(v.isDateControl,v.isDateTimeControl,v.isTimeControl)),Br=$.withJsonFormsControlProps(Rt),Ft=({uischema:e,schema:r,path:t,renderers:o,cells:a,enabled:i,visible:l=!0})=>{const c=e.elements;return l===!1?null:n.jsx(s.Flex,{direction:"column",gap:"4",children:c.map((u,f)=>n.jsx($.JsonFormsDispatch,{uischema:u,schema:r,path:t,renderers:o,cells:a,enabled:i},`${t}-${f}`))})},Ot=v.rankWith(1,v.uiTypeIs("VerticalLayout")),It=({uischema:e,schema:r,path:t,renderers:o,cells:a,enabled:i,visible:l=!0})=>{const c=e.elements;return l===!1?null:n.jsx(s.Flex,{direction:"row",gap:"4",children:c.map((u,f)=>n.jsx(s.Box,{style:{flex:1},children:n.jsx($.JsonFormsDispatch,{uischema:u,schema:r,path:t,renderers:o,cells:a,enabled:i})},`${t}-${f}`))})},kt=v.rankWith(1,v.uiTypeIs("HorizontalLayout")),Dt=({uischema:e,schema:r,path:t,renderers:o,cells:a,enabled:i,visible:l=!0})=>{const d=e,c=d.elements;return l===!1?null:n.jsxs(s.Box,{mb:"6",children:[d.label&&n.jsx(s.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:d.label}),n.jsx(s.Flex,{direction:"column",gap:"4",children:c.map((u,f)=>n.jsx($.JsonFormsDispatch,{uischema:u,schema:r,path:t,renderers:o,cells:a,enabled:i},`${t}-${f}`))})]})},Nt=v.rankWith(1,v.uiTypeIs("Group")),Lt=({uischema:e,schema:r,path:t,renderers:o,cells:a,enabled:i,visible:l=!0})=>{var h;const c=e.elements.filter(m=>m.type==="Category"),[u,f]=g.useState(((h=c[0])==null?void 0:h.label)||"");if(l===!1||!c.length)return null;const p=c.find(m=>m.label===u)?u:c[0].label;return n.jsxs(s.Tabs.Root,{value:p,onValueChange:f,children:[n.jsx(s.Tabs.List,{children:c.map((m,y)=>n.jsx(s.Tabs.Trigger,{value:m.label,children:m.label},`${t}-${y}`))}),n.jsx(s.Box,{pt:"3",children:c.map((m,y)=>n.jsx(s.Tabs.Content,{value:m.label,children:n.jsx(s.Flex,{direction:"column",gap:"4",children:m.elements.map((N,O)=>n.jsx($.JsonFormsDispatch,{uischema:N,schema:r,path:t,renderers:o,cells:a,enabled:i},`${t}-${y}-${O}`))})},`${t}-${y}`))})]})},Mt=v.rankWith(1,v.uiTypeIs("Categorization"));function ye(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function be(e){const r=e.split(",").map(i=>i.trim()).filter(Boolean),t=r.filter(i=>i.startsWith(".")),a=(t.length>0?t:r).map(i=>{if(i.endsWith("/*"))return i.split("/")[0].toUpperCase()+"S";if(i.startsWith("."))return i.slice(1).toUpperCase();const l=i.split("/")[1];return l?l.toUpperCase():i});return[...new Set(a)].join(", ")}const _r="image/png,image/jpeg,image/gif,image/webp,application/pdf,text/html,text/plain,.png,.jpg,.jpeg,.gif,.webp,.pdf,.html,.htm,.txt";function zt(e,r){return r.split(",").map(o=>o.trim()).filter(Boolean).some(o=>o==="*"||o==="*/*"?!0:o.endsWith("/*")?(e.type??"").startsWith(o.slice(0,-1)):o.startsWith(".")?e.name.toLowerCase().endsWith(o.toLowerCase()):e.type===o)}function Vr(e){const r=!!e.type,t=Ue(e.name)!==void 0;return!r&&!t?!0:zt(e,_r)}function Ue(e){const r=e.split(/[/\\]/).pop()??e,t=r.lastIndexOf(".");if(!(t<=0||t===r.length-1))return r.slice(t)}function Wr(e,r,t){Ut(new Blob([e],{type:t}),r)}function Ut(e,r){const t=URL.createObjectURL(e),o=document.createElement("a");o.href=t,o.download=r,o.click(),setTimeout(()=>URL.revokeObjectURL(t),0)}async function Hr(e,r){const t=await fetch(e);if(!t.ok)throw new Error(`Download failed (${t.status})`);Ut(await t.blob(),r)}function Xr(e,r,t){const o=t.name||t.key;if(!e)return o;const a=Ve(e,r,o),i=Ue(t.name??"")??Ue(t.key);return!i||a.toLowerCase().endsWith(i.toLowerCase())?a:`${a}${i}`}const Jr=new Set(["/","\\","<",">",":",'"',"|","?","*"]),Yr=e=>Jr.has(e)||e.charCodeAt(0)<32||e.charCodeAt(0)===127;function Kr(e,r){const t=Array.from(e,o=>Yr(o)?"_":o).join("").trim();return t===""||t.startsWith(".")?r:t}function Ve(e,r,t){const o=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{};return Kr(Ne(e,o),t)}function qr(e){return e?Array.isArray(e)?e:[e]:[]}const Gr=({data:e,handleChange:r,path:t,label:o,required:a,uischema:i,schema:l,enabled:d,errors:c,visible:u=!0})=>{const f=dt();ve(u,t,r);const p=!c||c.length===0,h=(l==null?void 0:l["x-file"])??{},m=(i==null?void 0:i.options)??{},y=h.maxFiles??m.maxFiles??1,N=h.maxSize??m.maxSize??5*1024*1024,O=h.accept??m.accept??"image/*,application/pdf",M=typeof h.fileName=="string"?h.fileName:void 0,j=y>1,S=d!==!1,[k,C]=g.useState(!1),[I,L]=g.useState(null),[B,b]=g.useState({}),[E,te]=g.useState({}),H=g.useRef(new Set),X=g.useRef(null),D=qr(e),F=D.length>=y,Y=x=>{const w=E[x];return{name:(w==null?void 0:w.name)??x,type:w==null?void 0:w.type}},Q=async x=>{var W,K;const w=(W=E[x])==null?void 0:W.blobUrl;if(w)return w;const z=await((K=f==null?void 0:f.getDownloadUrl)==null?void 0:K.call(f,x));return z==null?void 0:z.url},ce=(x,w)=>{b(z=>({...z,[x]:w}))},re=x=>{b(w=>{if(!w[x])return w;const z={...w};return delete z[x],z})};g.useEffect(()=>()=>{H.current.forEach(x=>URL.revokeObjectURL(x)),H.current.clear()},[]);const we=g.useCallback(async x=>{if(L(null),D.length>=y){L(`Maximum ${y} file${y>1?"s":""} allowed.`);return}if(x.size>N){L(`File exceeds the ${ye(N)} limit.`);return}if(!zt(x,O)){L(`Invalid type. Accepted: ${be(O)}`);return}if(!(f!=null&&f.onUpload)){L("Upload service not configured.");return}try{const w=await f.onUpload(x),z=URL.createObjectURL(x);H.current.add(z);const W={key:w.key,name:w.name??x.name,type:x.type||void 0,blobUrl:z};te(q=>({...q,[w.key]:W}));const K=[...D,w.key];r(t,j?K:K[0])}catch{L("Upload failed. Please try again."),X.current&&(X.current.value="")}},[D,y,N,O,f,t,r,j]);if(u===!1)return null;const A=x=>{x.preventDefault(),x.stopPropagation(),!(!S||F)&&C(x.type==="dragenter"||x.type==="dragover")},J=x=>{var w;x.preventDefault(),x.stopPropagation(),C(!1),!(!S||F)&&(w=x.dataTransfer.files)!=null&&w[0]&&we(x.dataTransfer.files[0])},ue=x=>{var w;(w=x.target.files)!=null&&w[0]&&(we(x.target.files[0]),x.target.value="")},me=x=>{if(!S)return;te(z=>{var q;const W={...z},K=(q=W[x])==null?void 0:q.blobUrl;return K&&(URL.revokeObjectURL(K),H.current.delete(K)),delete W[x],W}),re(x);const w=D.filter(z=>z!==x);r(t,j?w.length>0?w:void 0:w[0])},ee=async(x,w)=>{var K,q;x.preventDefault(),re(w);const z=(K=E[w])==null?void 0:K.blobUrl;if(z){(q=window.open(z,"_blank","noopener,noreferrer"))==null||q.focus();return}const W=window.open("","_blank");if(W)try{const R=await Q(w);R?W.location.href=R:(W.close(),ce(w,"Unable to open file."))}catch{W.close(),ce(w,"Unable to open file.")}},fe=async(x,w)=>{re(x);try{const z=await Q(x);if(!z){ce(x,"Unable to download file.");return}await Hr(z,w)}catch{ce(x,"Unable to download file.")}};if(!S&&D.length===0)return null;const oe=y-D.length,ge=S&&!F;return n.jsxs(s.Box,{mb:"4",children:[n.jsxs(s.Flex,{align:"center",justify:"between",mb:"2",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",children:[o,a&&n.jsx(s.Text,{color:"red",children:" *"})]}),n.jsx(s.Text,{size:"1",color:"gray",children:j?`Up to ${y} files · ${ye(N)} each · ${be(O)}`:`${ye(N)} · ${be(O)}`})]}),D.map((x,w)=>{var _;const z=w+1,W=(_=E[x])==null?void 0:_.name,K=Xr(M,{index:z},{name:W,key:x}),q=M?K:W??"Uploaded File",R=!!(M&&W),U=B[x],se=Vr(Y(x));return n.jsxs(s.Card,{size:"2",variant:"surface",mb:"2",children:[n.jsxs(s.Flex,{align:"center",gap:"3",children:[n.jsx(s.Box,{style:{background:"var(--blue-3)",padding:8,borderRadius:6,color:"var(--blue-9)",flexShrink:0},children:n.jsx(Z.FileTextIcon,{width:"20",height:"20"})}),n.jsxs(s.Box,{style:{flex:1,overflow:"hidden"},children:[n.jsx(s.Text,{size:"2",weight:"bold",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:q}),R&&n.jsx(s.Text,{size:"1",color:"gray",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W})]}),n.jsxs(s.Flex,{align:"center",gap:"2",style:{flexShrink:0},children:[se&&n.jsx(s.Button,{variant:"soft",color:"blue",size:"1",onClick:P=>void ee(P,x),children:"View"}),n.jsx(s.Tooltip,{content:"Download",children:n.jsx(s.IconButton,{variant:"ghost",color:"gray","aria-label":"Download",onClick:()=>void fe(x,K),children:n.jsx(Z.DownloadIcon,{})})}),n.jsx(Z.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),S&&n.jsx(s.IconButton,{variant:"ghost",color:"gray",onClick:()=>me(x),children:n.jsx(Z.Cross2Icon,{})})]})]}),U&&n.jsx(s.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:U})]},x)}),ge&&n.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var x;return(x=X.current)==null?void 0:x.click()},onKeyDown:x=>{var w;(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),(w=X.current)==null||w.click())},onDragEnter:A,onDragLeave:A,onDragOver:A,onDrop:J,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":I?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[n.jsx("input",{ref:X,type:"file",style:{display:"none"},accept:O,onChange:ue}),n.jsx(s.Flex,{direction:"column",align:"center",gap:"2",children:I?n.jsxs(n.Fragment,{children:[n.jsx(Z.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),n.jsx(s.Text,{size:"2",color:"red",weight:"medium",children:I}),n.jsx(s.Text,{size:"1",color:"gray",children:"Click to try again"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Z.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),n.jsx(s.Text,{size:"2",weight:"medium",children:D.length>0?`Add another file (${oe} remaining)`:"Click to upload or drag and drop"}),n.jsxs(s.Text,{size:"1",color:"gray",children:[ye(N)," max · ",be(O)]})]})})]}),S&&F&&j&&n.jsxs(s.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",y," files uploaded. Remove one to replace it."]}),!p&&n.jsx(s.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:xe(c,o)})]})},Pt=$.withJsonFormsControlProps(Gr),$t=v.rankWith(10,v.and(v.schemaMatches(e=>{if(e.type==="string"&&e.format==="file")return!0;if(e.type==="array"){const r=e.items;return(r==null?void 0:r.type)==="string"&&(r==null?void 0:r.format)==="file"}return!1})));function Bt(e,r){return e!==!1&&r!==!0}class Pe extends Error{}async function Zr(e,r){const{read:t,utils:o}=await import("@e965/xlsx"),a=t(e,{type:"array",cellDates:!0});if(a.SheetNames.length===0)throw new Pe("This file has no sheets.");const i=r??a.SheetNames[0],l=a.Sheets[i];if(!l)throw new Pe(`This file doesn't have a sheet named "${i}".`);const d=o.sheet_to_json(l,{header:1,raw:!0,defval:null});return{sheetName:i,matrix:d,rowCount:d.length,colCount:Math.max(0,...d.map(c=>c.length))}}function Qr(e){let r=e+1,t="";for(;r>0;){const o=(r-1)%26;t=String.fromCharCode(65+o)+t,r=Math.floor((r-1)/26)}return t}class ae extends Error{constructor(t,o){super(o??t);Je(this,"code");this.code=t,this.name="FormulaError"}}const en=["IFS","IFERROR","AND","OR","NOT","ROUND","ROUNDUP","ROUNDDOWN","INDEX","VLOOKUP","HLOOKUP","SUM","AVERAGE","COUNT","DATE","TODAY"],tn=["MAX","MIN","MAXA","MINA","MEDIAN","LARGE","SMALL","PERMUT","PERMUTATIONA","MATCH","SWITCH","SUBSTITUTE","TEXTJOIN","COUNTA","UPPER"],rn=["YEAR","MONTH","DAY","WEEKDAY"],nn=["IF"],on=["CONCATENATE","CONCAT","LEN","TRIM","LOWER","LEFT","RIGHT","MID","FIND","SEARCH"],sn=new Set([...en,...tn,...rn,...on,...nn]),ln=/"(?:[^"]|"")*"/g,Ge=new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(","g");function an(e){const r=e.replace(ln,o=>" ".repeat(o.length));Ge.lastIndex=0;let t;for(;(t=Ge.exec(r))!==null;){const o=t[1].toUpperCase();if(!sn.has(o))throw new ae("NAME",`Function ${o} is not allowed.`)}}function cn(e,r,t){let o=e;if(o==null)throw t.NA;if(typeof o=="object"&&!(o instanceof t)&&(o=r.retrieveRef(o)),o instanceof t)throw o;if(typeof o=="boolean")return o;if(typeof o=="number")return o!==0;throw t.VALUE}function _t(e){return e!==null&&typeof e=="object"&&"value"in e?e.value:e}function Re(e){const r=_t(e);return Array.isArray(r)?r.flat(1/0):[r]}function V(e){const r=_t(e);return Array.isArray(r)?r.flat(1/0)[0]:r}function Ie(e){return e===void 0?void 0:V(e)}function le(e){return e==null||e===""?"":typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof Date?e.toLocaleDateString():String(e)}function un(e,r){return e instanceof r?e:new r(e.message||"#ERROR!")}function ne(e){return e.find(r=>r instanceof Error)}function dn(e,r){const t=i=>{throw un(i,r)},o=(i,{checkArgsForErrors:l=!0}={})=>(...d)=>{const c=d.flatMap(Re);if(l){const f=ne(c);f&&t(f)}const u=i(...c);return u instanceof Error?t(u):u},a=(i,{toText:l=!1}={})=>d=>{const c=V(d),u=ne([c]);u&&t(u);const f=i(l?le(c):c);return f instanceof Error?t(f):f};return{IF:(i,l,d,c)=>{const u=cn(l,i,r);if(d==null)throw r.NA;return u?d:c??!1},MAX:o(e.MAX),MIN:o(e.MIN),MAXA:o(e.MAXA),MINA:o(e.MINA),MEDIAN:o(e.MEDIAN),COUNTA:o(e.COUNTA,{checkArgsForErrors:!1}),LARGE:(i,l)=>{const d=Re(i),c=V(l),u=ne([...d,c]);u&&t(u);const f=e.LARGE(d,c);return f instanceof Error?t(f):f},SMALL:(i,l)=>{const d=Re(i),c=V(l),u=ne([...d,c]);u&&t(u);const f=e.SMALL(d,c);return f instanceof Error?t(f):f},PERMUT:(i,l)=>{const d=[V(i),V(l)],c=ne(d);c&&t(c);const u=e.PERMUT(d[0],d[1]);return u instanceof Error?t(u):u},PERMUTATIONA:(i,l)=>{const d=[V(i),V(l)],c=ne(d);c&&t(c);const u=e.PERMUTATIONA(d[0],d[1]);return u instanceof Error?t(u):u},MATCH:(i,l)=>{const d=V(i),c=Re(l),u=ne([d,...c]);u&&t(u);const f=e.MATCH(d,c,0);return f instanceof Error?t(f):f},SWITCH:(...i)=>{const l=i.map(V),d=ne(l);d&&t(d);const c=e.SWITCH(...l);return c instanceof Error?t(c):c},SUBSTITUTE:(i,l,d,c)=>{const u=[le(V(i)),le(V(l)),le(V(d))];c!==void 0&&u.push(V(c));const f=ne(u);f&&t(f);const p=e.SUBSTITUTE(...u);return p instanceof Error?t(p):p},TEXTJOIN:(i,l,...d)=>{const c=le(V(i)),u=V(l),f=d.flatMap(Re).map(le),p=ne([c,u]);p&&t(p);const h=e.TEXTJOIN(c,u,f);return h instanceof Error?t(h):h},UPPER:a(e.UPPER),YEAR:a(e.YEAR),MONTH:a(e.MONTH),DAY:a(e.DAY),WEEKDAY:(i,l)=>{const d=V(i),c=V(l),u=ne([d]);u&&t(u);const f=e.WEEKDAY(d,c);return f instanceof Error?t(f):f},CONCATENATE:(...i)=>{const l=i.flatMap(Re),d=ne(l);d&&t(d);const c=e.CONCATENATE(...l.map(le));return c instanceof Error?t(c):c},CONCAT:(...i)=>{const l=i.flatMap(Re),d=ne(l);d&&t(d);const c=e.CONCAT(...l.map(le));return c instanceof Error?t(c):c},LEN:a(e.LEN,{toText:!0}),TRIM:a(e.TRIM,{toText:!0}),LOWER:a(e.LOWER,{toText:!0}),LEFT:(i,l)=>{const d=V(i),c=Ie(l),u=ne([d]);u&&t(u);const f=e.LEFT(le(d),c);return f instanceof Error?t(f):f},RIGHT:(i,l)=>{const d=V(i),c=Ie(l),u=ne([d]);u&&t(u);const f=e.RIGHT(le(d),c);return f instanceof Error?t(f):f},MID:(i,l,d)=>{const c=V(i),u=V(l),f=V(d),p=ne([c,u,f]);p&&t(p);const h=e.MID(le(c),u,f);return h instanceof Error?t(h):h},FIND:(i,l,d)=>{const c=V(i),u=V(l),f=Ie(d),p=ne([c,u]);p&&t(p);const h=e.FIND(le(c),le(u),f);return h instanceof Error?t(h):h},SEARCH:(i,l,d)=>{const c=V(i),u=V(l),f=Ie(d),p=ne([c,u]);p&&t(p);const h=e.SEARCH(le(c),le(u),f);return h instanceof Error?t(h):h}}}const fn={"#REF!":"REF","#VALUE!":"VALUE","#DIV/0!":"DIV0","#NAME?":"NAME","#N/A":"NA","#NUM!":"NUM","#NULL!":"NULL"};function Ze(e){return fn[e.error]??"ERROR"}function Qe(e,r){if(e instanceof ae)return e;if(e instanceof r){const t=e.details;return t instanceof ae?t:t instanceof r?new ae(Ze(t),t.message):new ae(Ze(e),e.message)}return new ae("ERROR",e instanceof Error?e.message:void 0)}function pn(e){return Math.max(0,...e.map(r=>(r==null?void 0:r.length)??0))}function hn(e){return r=>{const t=e[r.row-1];if(r.row<1||r.col<1||t==null||r.col-1>=t.length)throw new ae("REF");const o=t[r.col-1];return o==null||o===""?null:o}}function xn(e){return r=>{const t=Math.min(r.from.row,r.to.row),o=Math.min(r.from.col,r.to.col),a=Math.max(r.from.row,r.to.row),i=Math.max(r.from.col,r.to.col),l=pn(e);if(t>e.length||o>l)throw new ae("REF");const d=Math.min(a,e.length),c=[];for(let u=t;u<=d;u++){const f=e[u-1],p=[];if(f!=null){const h=Math.min(i,f.length);for(let m=o;m<=h;m++){const y=f[m-1];p.push(y==null||y===""?null:y)}}c.push(p)}return c}}function mn(e){if(e==null||e==="")return null;if(typeof e=="number"||typeof e=="string"||typeof e=="boolean"||e instanceof Date)return e;throw new ae("VALUE")}async function Vt(e,r){if(typeof e!="string")throw new ae("ERROR");const t=e.trim();if(t==="")throw new ae("ERROR");const o=t.startsWith("=")?t.slice(1):t;an(o);const[a,i]=await Promise.all([import("fast-formula-parser"),import("@formulajs/formulajs")]),l=a.default??a,d=l.FormulaError,c=new l({...r,functions:dn(i,d)});let u;try{u=c.parse(o,{row:1,col:1,sheet:"Sheet1"})}catch(f){throw Qe(f,d)}if(u instanceof d)throw Qe(u,d);return mn(u)}async function gn(e,r){return Vt(r,{onCell:hn(e),onRange:xn(e)})}const et=-1;async function Wt(e,r){const t=Object.keys(e);return Vt(r,{onVariable:o=>{const a=t.indexOf(o);return a===-1?null:{row:et,col:a+1}},onCell:o=>{if(o.row===et)return e[t[o.col-1]]??null;throw new ae("REF")},onRange:()=>{throw new ae("REF")}})}const Ht={REF:"#REF!",VALUE:"#VALUE!",DIV0:"#DIV/0!",NAME:"#NAME?",ERROR:"#ERROR!",NA:"#N/A",NUM:"#NUM!",NULL:"#NULL!"};function We(e){const r=e instanceof ae?e.code:"ERROR";return Ht[r]}async function yn(e,r){return e.length===0?r.map(t=>({id:typeof(t==null?void 0:t.id)=="string"?t.id:"(unknown)",label:(t==null?void 0:t.label)??"(unknown)",value:null,error:Ht.ERROR})):Promise.all(r.map(async t=>{try{if(!t||typeof t.label!="string"||typeof t.expression!="string"||typeof t.id!="string")throw new ae("ERROR");return{id:t.id,label:t.label,value:await gn(e,t.expression)}}catch(o){return{id:typeof(t==null?void 0:t.id)=="string"?t.id:"(unknown)",label:(t==null?void 0:t.label)??"(unknown)",value:null,error:We(o)}}}))}function tt(e){const r=new Set;for(const{id:t}of e){if(r.has(t))return t;r.add(t)}return null}function Xt(e){const{columnHeader:r,rowHeader:t,columns:o,rows:a}=e;if(o!==void 0&&!Array.isArray(o))return"columns must be an array of { id, label } objects.";if(a!==void 0&&!Array.isArray(a))return"rows must be an array of { id, label } objects.";if(o!==void 0&&o.length===0)return"columns is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";if(a!==void 0&&a.length===0)return"rows is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";const i=f=>!!f&&typeof f.id=="string"&&f.id!==""&&typeof f.label=="string"&&f.label!=="",l=o==null?void 0:o.findIndex(f=>!i(f));if(l!=null&&l!==-1)return`columns[${l}] must be a { id, label } object with non-empty string fields.`;const d=a==null?void 0:a.findIndex(f=>!i(f));if(d!=null&&d!==-1)return`rows[${d}] must be a { id, label } object with non-empty string fields.`;const c=!!o&&o.length>0,u=!!a&&a.length>0;if(c){const f=tt(o);if(f)return`duplicate column id "${f}" — every declared column id must be unique.`}if(u){const f=tt(a);if(f)return`duplicate row id "${f}" — every declared row id must be unique.`}return r&&t?"columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape.":c&&u?"columns and rows cannot both be declared — pick one orientation for the persisted sheet shape.":r&&!c?"columnHeader is true but columns is missing or empty — declare the column list columnHeader positions map to.":t&&!u?"rowHeader is true but rows is missing or empty — declare the row list rowHeader positions map to.":null}function rt(e,r={}){const t=Xt(r);if(t)throw new Error(`x-spreadsheet: ${t}`);const{columnHeader:o,rowHeader:a,columns:i,rows:l}=r;return i&&i.length>0?bn(e,i,o===!0):l&&l.length>0?vn(e,l,a===!0):e}function bn(e,r,t){return(t?e.slice(1):e).map(a=>{const i=Object.create(null);return r.forEach((l,d)=>{i[l.id]=a[d]??null}),i})}function vn(e,r,t){const o=t?1:0,a=Math.max(0,...e.map(l=>l.length)),i=Math.max(0,a-o);return Array.from({length:i},(l,d)=>{const c=o+d,u=Object.create(null);return r.forEach((f,p)=>{var h;u[f.id]=((h=e[p])==null?void 0:h[c])??null}),u})}function Jt(e){return!Array.isArray(e[0])}function wn(e){const r=Object.create(null);for(const{id:t,label:o,value:a,error:i}of e)r[t]=i===void 0?{label:o,value:a}:{label:o,value:a,error:i};return r}function $e(e,r){const t=o=>o instanceof Date?o.toISOString():o??null;return t(e)===t(r)}function Tn(e,r){const t=e??{},o=r??{},a=Object.keys(t);return a.length!==Object.keys(o).length?!1:a.every(i=>{if(!Object.prototype.hasOwnProperty.call(o,i))return!1;const l=t[i],d=o[i];return l.label===d.label&&l.error===d.error&&$e(l.value,d.value)})}function jn(e,r){if(e==null||r==null)return e===r;const t=Array.isArray(e);if(t!==Array.isArray(r))return!1;if(t){const l=e,d=r;return l.length===d.length&&l.every((c,u)=>$e(c,d[u]))}const o=e,a=r,i=Object.keys(o);return i.length!==Object.keys(a).length?!1:i.every(l=>Object.prototype.hasOwnProperty.call(a,l)&&$e(o[l],a[l]))}function En(e,r){if(e===r)return!0;if(e==null||r==null)return!1;const t=e,o=r;return t.length!==o.length?!1:t.every((a,i)=>jn(a,o[i]))}function Cn(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Date}function Yt(e,r){if(e.length===0)return[];const t=[],o=new Set;for(const i of r??[])o.has(i)||(o.add(i),t.push(i));for(const i of e)for(const l of Object.keys(i))o.has(l)||(o.add(l),t.push(l));if(t.length===0)return[];const a=e.map(i=>t.map(l=>{if(!Object.prototype.hasOwnProperty.call(i,l))return null;const d=i[l];return Cn(d)?d:null}));return[t,...a]}function Sn(e){const r=Math.max(0,...e.map(t=>t.length));return Array.from({length:r},(t,o)=>e.map(a=>a[o]??null))}const Rn=".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv",An=10*1024*1024,ze=200,Fn=50,On=[];function nt(e){return e==null||e===""?"":e instanceof Date?e.toLocaleDateString():String(e)}const In=({data:e,handleChange:r,path:t,label:o,required:a,schema:i,enabled:l,readonly:d,errors:c,visible:u=!0})=>{ve(u,t,r);const f=!c||c.length===0,p=Bt(l,d),h=(i==null?void 0:i["x-spreadsheet"])??{},m=(i==null?void 0:i["x-evaluate"])??On,y=h.accept??Rn,N=h.maxSize??An,O=h.columnHeader===!0,M=h.rowHeader===!0,j=h.columns,S=h.rows,k=Array.isArray(j)&&j.length>0,C=Array.isArray(S)&&S.length>0,I=Xt({columnHeader:O,rowHeader:M,columns:j,rows:S}),L=h.showSheet!==!1,B=h.sheetName,b=h.persistSheet!==!1,E=e??null,[te,H]=g.useState(()=>E!=null&&E.sheet||Object.keys((E==null?void 0:E.derivations)??{}).length>0?"ready":"empty"),[X,D]=g.useState(null),[F,Y]=g.useState(!1),[Q,ce]=g.useState(null),[re,we]=g.useState(null),A=g.useRef(null),J=g.useRef(null),ue=(E==null?void 0:E.sheet)??null,me=g.useCallback(R=>{if(!Jt(R))return R;const U=C?S:k?j:void 0,se=Yt(R,U==null?void 0:U.map(_=>_.id));return C?Sn(se):se},[k,C,j,S]),ee=g.useMemo(()=>Q??(ue?me(ue):null),[Q,ue,me]),fe=((re==null?void 0:re.matrix)===ee?re.derivations:null)??(E==null?void 0:E.derivations)??{},oe=ee!=null||E!=null,ge=g.useMemo(()=>{const R=k?1:0,U=C?1:0,se=ee?ee.slice(R):[],_=se.slice(0,ze),P=Math.min(Fn,Math.max(0,..._.map(pe=>Math.max(0,pe.length-U)))),je=Array.from({length:P},(pe,T)=>T+U),Ae="",Oe=C&&!k;return n.jsx(n.Fragment,{children:ee&&L&&n.jsxs(s.Box,{mt:"3",children:[n.jsx(s.Box,{style:{overflow:"auto",maxHeight:420},children:n.jsxs(s.Table.Root,{variant:"surface",size:"1",children:[!Oe&&n.jsx(s.Table.Header,{children:n.jsxs(s.Table.Row,{children:[n.jsx(s.Table.ColumnHeaderCell,{children:Ae}),je.map(pe=>{var T;return n.jsx(s.Table.ColumnHeaderCell,{children:k?((T=j==null?void 0:j[pe])==null?void 0:T.label)??"":Qr(pe)},pe)})]})}),n.jsx(s.Table.Body,{children:_.map((pe,T)=>{var ie;const G=R+T;return n.jsxs(s.Table.Row,{children:[n.jsx(s.Table.RowHeaderCell,{style:C?{fontWeight:700,background:"var(--gray-a3)"}:void 0,children:C?((ie=S==null?void 0:S[G])==null?void 0:ie.label)??"":k?"":G+1}),je.map(he=>n.jsx(s.Table.Cell,{children:nt(pe[he])},he))]},T)})})]})}),se.length>ze&&n.jsxs(s.Text,{size:"1",color:"gray",mt:"1",style:{display:"block"},children:["Showing first ",ze," of ",se.length," rows"]})]})})},[ee,L,k,C,j,S]),x=g.useCallback(async R=>{if(D(null),R.size>N){D(`File exceeds the ${ye(N)} limit.`);return}if(!y.split(",").map(P=>P.trim()).some(P=>P==="*"||P==="*/*"?!0:P.endsWith("/*")?R.type.startsWith(P.slice(0,-1)):P.startsWith(".")?R.name.toLowerCase().endsWith(P.toLowerCase()):R.type===P)){D(`Invalid type. Accepted: ${be(y)}`);return}H("parsing");let _;try{const P=await R.arrayBuffer();_=(await Zr(P,B)).matrix}catch(P){H("error"),D(P instanceof Pe?P.message:"This doesn't look like a valid spreadsheet. Please check the file and try again.");return}if(k||C)try{_=me(rt(_,{columnHeader:O,rowHeader:M,columns:j,rows:S}))}catch(P){H("error"),D(P instanceof Error?P.message:"Failed to process this sheet.");return}J.current=(e==null?void 0:e.sheet)??null,ce(_),H("ready")},[y,N,B,e,O,M,j,S,k,C,me]);if(g.useEffect(()=>{Q!=null&&ue!=null&&ue!==J.current&&ce(null)},[Q,ue]),g.useEffect(()=>{if(I||m.length===0&&!b)return;let R=!1;const U=_=>{p&&(Tn(E==null?void 0:E.derivations,_==null?void 0:_.derivations)&&En(E==null?void 0:E.sheet,_==null?void 0:_.sheet)||(J.current=(_==null?void 0:_.sheet)??null,r(t,_)))},se=ee??[];if(se.length===0){E!=null&&U(void 0);return}return yn(se,m).then(_=>{if(R)return;let P;if(Q!=null){if(b)try{P=rt(se,{columnHeader:k,rowHeader:C,columns:j,rows:S})}catch(Ae){D(Ae instanceof Error?Ae.message:"Failed to process this sheet.");return}}else P=E==null?void 0:E.sheet;D(null);const je=wn(_);we({matrix:se,derivations:je}),U(P===void 0?{derivations:je}:{sheet:P,derivations:je})}),()=>{R=!0}},[ee,Q,m,p,b,k,C,j,S,I]),u===!1)return null;if(I)return n.jsxs(s.Box,{mb:"4",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",children:o}),n.jsxs(s.Text,{size:"2",color:"red",style:{display:"block"},children:["Invalid x-spreadsheet config: ",I]})]});if(!p&&!oe)return null;const w=R=>{R.preventDefault(),R.stopPropagation(),p&&Y(R.type==="dragenter"||R.type==="dragover")},z=R=>{var U;R.preventDefault(),R.stopPropagation(),Y(!1),p&&(U=R.dataTransfer.files)!=null&&U[0]&&x(R.dataTransfer.files[0])},W=R=>{var U;(U=R.target.files)!=null&&U[0]&&(x(R.target.files[0]),R.target.value="")},K=()=>{p&&(ce(null),we(null),J.current=null,D(null),H("empty"),r(t,void 0))},q=L&&ee==null&&E!=null;return n.jsxs(s.Box,{mb:"4",children:[n.jsxs(s.Flex,{align:"center",justify:"between",mb:"2",children:[n.jsxs(s.Flex,{align:"center",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",children:[o,a&&n.jsx(s.Text,{color:"red",children:" *"})]}),oe&&p&&n.jsxs(n.Fragment,{children:[n.jsx(s.Tooltip,{content:"Replace spreadsheet",children:n.jsx(s.IconButton,{variant:"ghost",size:"1",onClick:()=>{var R;return(R=A.current)==null?void 0:R.click()},"aria-label":"Replace spreadsheet",children:n.jsx(Z.UploadIcon,{})})}),n.jsx(s.Tooltip,{content:"Remove spreadsheet",children:n.jsx(s.IconButton,{variant:"ghost",size:"1",color:"gray",onClick:K,"aria-label":"Remove spreadsheet",children:n.jsx(Z.Cross2Icon,{})})})]})]}),n.jsxs(s.Text,{size:"1",color:"gray",children:[ye(N)," max · ",be(y)]})]}),oe&&X&&n.jsx(s.Text,{size:"2",color:"red",mb:"2",style:{display:"block"},children:X}),n.jsx("input",{ref:A,type:"file",style:{display:"none"},accept:y,onChange:W}),p&&!oe&&n.jsx("div",{role:"button",tabIndex:0,onClick:()=>{var R;return(R=A.current)==null?void 0:R.click()},onKeyDown:R=>{var U;(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),(U=A.current)==null||U.click())},onDragEnter:w,onDragLeave:w,onDragOver:w,onDrop:z,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",F?"border-blue-500 bg-blue-50":X?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:n.jsx(s.Flex,{direction:"column",align:"center",gap:"2",children:te==="parsing"?n.jsxs(n.Fragment,{children:[n.jsx(s.Spinner,{size:"3"}),n.jsx(s.Text,{size:"2",color:"gray",children:"Parsing spreadsheet…"})]}):X?n.jsxs(n.Fragment,{children:[n.jsx(Z.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),n.jsx(s.Text,{size:"2",color:"red",weight:"medium",children:X}),n.jsx(s.Text,{size:"1",color:"gray",children:"Click to try again"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Z.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),n.jsx(s.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),n.jsxs(s.Text,{size:"1",color:"gray",children:[ye(N)," max · ",be(y)]})]})})}),ge,q&&n.jsx(s.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(fe).length>0&&n.jsxs(s.Box,{mt:"3",children:[n.jsx(s.Text,{size:"2",weight:"bold",as:"div",mb:"1",children:"Computed values"}),n.jsx(s.Flex,{direction:"column",gap:"1",children:Object.entries(fe).map(([R,U])=>n.jsxs(s.Flex,{justify:"between",children:[n.jsx(s.Text,{size:"2",children:U.label}),U.error?n.jsx(s.Text,{size:"2",color:"red",children:U.error}):n.jsx(s.Text,{size:"2",children:nt(U.value)})]},R))})]}),!f&&n.jsx(s.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:xe(c,o)})]})},Kt=$.withJsonFormsControlProps(In),qt=v.rankWith(10,v.schemaMatches(e=>e.type==="object"&&typeof e["x-spreadsheet"]=="object")),kn="Sheet1",Dn="xlsx";function Nn(e){if(e===void 0)return null;if(!Array.isArray(e))return"columns must be an array of { id, label } objects.";if(e.length===0)return"columns is declared but empty — declare at least one field, or omit it entirely.";const r=e.findIndex(t=>!t||typeof t!="object"||typeof t.id!="string"||t.id===""||typeof t.label!="string"||t.label==="");return r!==-1?`columns[${r}] must be a { id, label } object with non-empty string fields.`:null}function Ln(e,r){if(!Jt(e))return e;const t=Yt(e,r==null?void 0:r.map(l=>l.id));if(!r||t.length===0)return t;const o=new Map(r.map(l=>[l.id,l.label])),[a,...i]=t;return[a.map(l=>o.get(String(l))??l),...i]}const Mn=({data:e,path:r,label:t,schema:o,visible:a=!0})=>{const[i,l]=g.useState(null),d=$.useJsonForms();if(a===!1)return null;const c=(o==null?void 0:o["x-spreadsheet-export"])??{},u=c.columns,f=c.sheetName??kn,p=c.fileType??Dn,h=c.fileName??`export.${p}`,m=Nn(u);if(m)return n.jsxs(s.Box,{mb:"4",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",children:t}),n.jsxs(s.Text,{size:"2",color:"red",style:{display:"block"},children:["Invalid x-spreadsheet-export config: ",m]})]});const y=Array.isArray(e)&&e.length>0,N=async()=>{var O,M;if(y){l(null);try{const j=await import("@e965/xlsx"),S=Ln(e,u),k=j.utils.aoa_to_sheet(S),C=j.utils.book_new();j.utils.book_append_sheet(C,k,f);const I=r.split(".").slice(0,-1).join("."),L=I?v.Resolve.data((O=d.core)==null?void 0:O.data,I):(M=d.core)==null?void 0:M.data;j.writeFile(C,Ve(h,L,`export.${p}`),{bookType:p})}catch(j){l(j instanceof Error?j.message:"Failed to build the workbook.")}}};return n.jsxs(s.Box,{mb:"4",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",style:{display:"block",marginBottom:"var(--space-2)"},children:t}),n.jsxs(s.Button,{type:"button",variant:"soft",disabled:!y,onClick:()=>void N(),children:[n.jsx(Z.DownloadIcon,{})," Download Spreadsheet"]}),i&&n.jsx(s.Text,{size:"2",color:"red",style:{display:"block",marginTop:"var(--space-2)"},children:i})]})},Gt=$.withJsonFormsControlProps(Mn),Zt=v.rankWith(10,v.and(v.schemaMatches(e=>{const r=e["x-spreadsheet-export"];return e.type==="array"&&typeof r=="object"&&r!==null}),v.not(v.optionIs("editable",!0))));class Ee extends Error{}const ot=5e6,zn=1024,Un=/^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["']/i,Pn={ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",parseTagValue:!0,parseAttributeValue:!0,numberParseOptions:{hex:!1,leadingZeros:!1,eNotation:!0},trimValues:!0,cdataPropName:!1,commentPropName:!1,processEntities:!0,htmlEntities:!0,ignoreDeclaration:!0,ignorePiTags:!0,alwaysCreateTextNode:!1,preserveOrder:!1,removeNSPrefix:!1,maxNestedTags:100,strictReservedNames:!0};function $n(e){const r=new Set(e);return r.size===0?()=>!1:(t,o)=>r.has(typeof o=="string"?o:o.toString())||r.has(t)}function Bn(e){const r=e instanceof Error?e.message:"";return r.startsWith("[SECURITY] Invalid name:")?"This document uses a reserved JavaScript name (__proto__, constructor or prototype) as an element or attribute name, which cannot be represented safely.":r==="External entities are not supported"||r==="Parameter entities are not supported"?`${r}. Please remove the DOCTYPE entity declarations and try again.`:r.startsWith("Maximum nested tags exceeded")?"This document is nested too deeply to parse.":r.startsWith("Entity count")||r.includes("exceeds maximum allowed")?"This document declares too many or too large entity definitions to expand safely.":"This doesn't look like a valid XML document. Please check the file and try again."}async function _n(e,r={}){var u;if(typeof e!="string")throw new Ee("This file could not be read as text.");const t=e.charCodeAt(0)===65279?e.slice(1):e;if(t.trim()==="")throw new Ee("This file is empty.");if(t.length>ot)throw new Ee(`This document is too large to parse (over ${ot/1e6} million characters).`);const o=(u=Un.exec(t.slice(0,zn)))==null?void 0:u[1];if(o&&!/^utf-?8$/i.test(o))throw new Ee(`This document declares the unsupported encoding "${o}". Only UTF-8 is supported.`);const{XMLParser:a,XMLValidator:i}=await import("fast-xml-parser"),l=i.validate(t,{allowBooleanAttributes:!1});if(l!==!0){const{msg:f,line:p,col:h}=l.err;throw new Ee(`Invalid XML at line ${p}, column ${h}: ${f}`)}const d=new a({...Pn,removeNSPrefix:r.removeNamespaces===!0,isArray:$n(r.arrayPaths??[])});let c;try{c=d.parse(t)}catch(f){throw new Ee(Bn(f))}if(c==null||typeof c!="object"||Array.isArray(c))throw new Ee("This document has no root element.");return c}function Qt(e,r,t){const{path:o,default:a}=typeof t=="string"?{path:t,default:void 0}:t,i=v.Resolve.data(e,r?`${r}.${o}`:o);return i??a}function Vn(e,r,t){const o={};for(const[a,i]of Object.entries(t)){const l=Qt(e,r,i);if(l===void 0)return;o[a]=l}return o}async function Wn(e,r){try{return{status:"ok",value:await Wt(e,r)}}catch(t){return{status:"error",error:We(t)}}}function er(e,r){return e==null?"":typeof e=="number"?e.toFixed(Hn(r)):e instanceof Date?e.toLocaleDateString():String(e)}function Hn(e){return Number.isFinite(e)?Math.min(100,Math.max(0,Math.trunc(e))):0}const Ce={found:!1},de=e=>({found:!0,value:e});function st(e){return e==null||e===""?Ce:Array.isArray(e)||e instanceof Date?de(e):typeof e=="object"?Ce:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?de(e):Ce}const Xn=new Set(["true","1","yes","y"]),Jn=new Set(["false","0","no","n"]),Yn=/^(\d{4}-\d{2}-\d{2})(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})?)?$/;async function Kn(e,r,t){switch(r.as){case void 0:return de(e);case"string":return de(e instanceof Date?e.toISOString():String(e));case"number":{const o=e instanceof Date?e.getTime():Number(e);return Number.isFinite(o)?de(r.decimals===void 0?o:er(o,r.decimals)):Ce}case"boolean":{const o=String(e).trim().toLowerCase();return Xn.has(o)?de(!0):Jn.has(o)?de(!1):Ce}case"date":{const{default:o}=await import("dayjs"),{default:a}=await Promise.resolve().then(()=>require("./customParseFormat-CLvZwox5.cjs")).then(d=>d.customParseFormat);if(o.extend(a),t==="export"){const d=typeof e=="string"?Yn.exec(e):null,c=e instanceof Date?o(e):d?o(d[1],"YYYY-MM-DD",!0):null;return c!=null&&c.isValid()?de(c.format(r.format??"YYYY-MM-DD")):Ce}const i=e instanceof Date?e.toISOString():String(e),l=r.format?o(i,r.format,!0):o(i);return l.isValid()?de(l.format("YYYY-MM-DD")):Ce}}}async function qn(e,r){if(r.formula!==void 0){const t={};for(const[o,a]of Object.entries(r.inputs??{})){const i=st(v.Resolve.data(e,a));if(!i.found||Array.isArray(i.value))return Ce;t[o]=i.value}try{return de(await Wt(t,r.formula))}catch(o){throw new Error(`writeTo "${r.to}": ${We(o)}`)}}if(r.from===void 0)throw new Error(`writeTo "${r.to}" needs either "from" or "formula".`);return st(v.Resolve.data(e,r.from))}const ke="@_",tr="#text",De=e=>e.split(".").filter(Boolean),rr=e=>e.startsWith(ke)||e===tr;function nr(e,r){if(typeof e.to!="string"||De(e.to).length===0)return'"to" must be a non-empty path.';if(e.format!==void 0&&e.as!=="date")return'"format" needs "as": "date".';if(e.decimals!==void 0){if(r==="import")return'"decimals" only applies on export — on import it would put text in a number field.';if(e.as!=="number")return'"decimals" needs "as": "number".';const{decimals:t}=e;if(!Number.isInteger(t)||t<0||t>100)return'"decimals" must be a whole number from 0 to 100.'}if(r==="export"){const t=De(e.to);for(const[o,a]of t.entries()){if(a===ke)return'"@_" needs an attribute name after it, e.g. "@_id".';if(rr(a)&&o<t.length-1)return`"${a}" must be the last segment — it belongs to the element before it.`}}return null}function it(e,r,t){const o=t?` To give "${r}" both text and attributes, write its text to "${r}.${tr}".`:"";return new Error(`writeTo "${e}": "${r}" is written both as a value and as the parent of other values.${o}`)}function or(e){const r={},t=new Set([r]);for(const{to:o,value:a}of e){const i=De(o);if(i.length===0)continue;let l=r;for(const[u,f]of i.slice(0,-1).entries()){const p=l[f];if(p===void 0){const h={};t.add(h),l[f]=h,l=h}else if(t.has(p))l=p;else throw it(o,i.slice(0,u+1).join("."),i[u+1].startsWith(ke))}const d=i[i.length-1],c=l[d];if(t.has(c)){const u=Object.keys(c).some(f=>f.startsWith(ke));throw it(o,i.join("."),u)}l[d]=a}return r}const Gn=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean";async function He(e,r,t){const o=[];for(const a of r){const i=nr(a,t);if(i)throw new Error(`writeTo "${a.to}": ${i}`);const l=De(a.to),d=t==="export"&&rr(l[l.length-1]),c=p=>{if(!(d&&p==null)){if(d&&!Gn(p)){const h=p instanceof Date?' Add "as": "date" to write a date.':"";throw new Error(`writeTo "${a.to}": an attribute or #text value must be text, a number or a boolean.${h}`)}o.push({to:a.to,value:p})}};let u=await qn(e,a);const f=u.found&&Array.isArray(u.value);if(u.found&&f&&a.writeTo){const p=await Promise.all(u.value.map(async h=>or(await He(h,a.writeTo,t))));c(p);continue}if(u.found&&!f&&a.writeTo)throw new Error(`writeTo "${a.to}": "writeTo" is set, but "from" did not resolve to a repeating element.`);if(u.found&&!f&&a.map){const p=u.value instanceof Date?u.value.toISOString():String(u.value);Object.prototype.hasOwnProperty.call(a.map,p)&&(u=de(a.map[p]))}if(u.found&&!f&&(u=await Kn(u.value,a,t)),!u.found){if(a.default===void 0)continue;c(a.default);continue}c(u.value)}return o}const Zn=".xml,text/xml,application/xml",Qn=5*1024*1024,eo=({data:e,handleChange:r,path:t,label:o,required:a,schema:i,enabled:l,readonly:d,errors:c,visible:u=!0})=>{ve(u,t,r);const f=!c||c.length===0,p=Bt(l,d),h=(i==null?void 0:i["x-xml"])??{},m=h.accept??Zn,y=h.maxSize??Qn,N=h.arrayPaths,O=h.removeNamespaces===!0,M=h.writeTo,j=h.writeBase??"root",S=h.persistDocument!==!1,k=$.useJsonForms(),C=e??null,[I,L]=g.useState(()=>C?"ready":"empty"),[B,b]=g.useState(null),[E,te]=g.useState(!1),H=g.useRef(null),X=g.useRef(0),D=C!=null,F=M!==void 0&&M.length>0,Y=g.useCallback(async A=>{var ge;const J=++X.current;if(b(null),A.size>y){b(`File exceeds the ${ye(y)} limit.`);return}if(!m.split(",").map(x=>x.trim()).some(x=>x==="*"||x==="*/*"?!0:x.endsWith("/*")?A.type.startsWith(x.slice(0,-1)):x.startsWith(".")?A.name.toLowerCase().endsWith(x.toLowerCase()):A.type===x)){b(`Invalid type. Accepted: ${be(m)}`);return}L("parsing");let ee;try{const x=await A.text();ee=await _n(x,{arrayPaths:N,removeNamespaces:O})}catch(x){if(J!==X.current)return;L("error"),b(x instanceof Ee?x.message:"This doesn't look like a valid XML document. Please check the file and try again.");return}let fe=[];if(M&&M.length>0)try{fe=await He(ee,M,"import")}catch(x){if(J!==X.current)return;L("error"),b(x instanceof Error?x.message:"This document could not be mapped onto the form.");return}if(J!==X.current)return;S&&r(t,ee);const oe=j==="parent"?t.split(".").slice(0,-1).join("."):"";for(const x of fe)(ge=k.dispatch)==null||ge.call(k,v.update(oe?`${oe}.${x.to}`:x.to,()=>x.value));L("ready")},[m,y,N,O,M,j,S,t,r,k]);if(u===!1||!p&&!D)return null;const Q=A=>{A.preventDefault(),A.stopPropagation(),p&&te(A.type==="dragenter"||A.type==="dragover")},ce=A=>{var J;A.preventDefault(),A.stopPropagation(),te(!1),p&&(J=A.dataTransfer.files)!=null&&J[0]&&Y(A.dataTransfer.files[0])},re=A=>{var J;(J=A.target.files)!=null&&J[0]&&(Y(A.target.files[0]),A.target.value="")},we=()=>{p&&(++X.current,b(null),L("empty"),r(t,void 0))};return n.jsxs(s.Box,{mb:"4",children:[n.jsxs(s.Flex,{align:"center",justify:"between",mb:"2",children:[n.jsxs(s.Flex,{align:"center",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",children:[o,a&&n.jsx(s.Text,{color:"red",children:" *"})]}),!F&&D&&p&&n.jsxs(n.Fragment,{children:[n.jsx(s.Tooltip,{content:"Replace document",children:n.jsx(s.IconButton,{variant:"ghost",size:"1",onClick:()=>{var A;return(A=H.current)==null?void 0:A.click()},"aria-label":"Replace document",children:n.jsx(Z.UploadIcon,{})})}),n.jsx(s.Tooltip,{content:"Remove document",children:n.jsx(s.IconButton,{variant:"ghost",size:"1",color:"gray",onClick:we,"aria-label":"Remove document",children:n.jsx(Z.Cross2Icon,{})})})]})]}),n.jsxs(s.Flex,{align:"center",gap:"2",children:[n.jsxs(s.Text,{size:"1",color:"gray",children:[ye(y)," max · ",be(m)]}),F&&p&&n.jsxs(s.Button,{size:"1",variant:"soft",onClick:()=>{var A;return(A=H.current)==null?void 0:A.click()},disabled:I==="parsing",children:[I==="parsing"?n.jsx(s.Spinner,{size:"1"}):n.jsx(Z.UploadIcon,{}),"Upload"]})]})]}),(F||D)&&B&&n.jsx(s.Text,{size:"2",color:"red",mb:"2",style:{display:"block"},children:B}),n.jsx("input",{ref:H,type:"file",style:{display:"none"},accept:m,onChange:re}),!F&&p&&!D&&n.jsx("div",{role:"button",tabIndex:0,onClick:()=>{var A;return(A=H.current)==null?void 0:A.click()},onKeyDown:A=>{var J;(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),(J=H.current)==null||J.click())},onDragEnter:Q,onDragLeave:Q,onDragOver:Q,onDrop:ce,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",E?"border-blue-500 bg-blue-50":B?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:n.jsx(s.Flex,{direction:"column",align:"center",gap:"2",children:I==="parsing"?n.jsxs(n.Fragment,{children:[n.jsx(s.Spinner,{size:"3"}),n.jsx(s.Text,{size:"2",color:"gray",children:"Parsing document…"})]}):B?n.jsxs(n.Fragment,{children:[n.jsx(Z.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),n.jsx(s.Text,{size:"2",color:"red",weight:"medium",children:B}),n.jsx(s.Text,{size:"1",color:"gray",children:"Click to try again"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Z.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),n.jsx(s.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),n.jsxs(s.Text,{size:"1",color:"gray",children:[ye(y)," max · ",be(m)]})]})})}),!f&&n.jsx(s.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:xe(c,o)})]})},sr=$.withJsonFormsControlProps(eo),ir=v.rankWith(10,v.schemaMatches(e=>{const r=e["x-xml"];return e.type==="object"&&typeof r=="object"&&r!==null})),to="root",lt="export.xml",ro={format:!0,indentBy:" ",ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",suppressBooleanAttributes:!1,processEntities:!0};function no(e){if(e===null||typeof e!="object"||Array.isArray(e))return'declaration must be an object, e.g. { "standalone": "no" }, or {} for the defaults.';const{version:r,encoding:t,standalone:o,...a}=e,[i]=Object.keys(a);return i?`declaration has an unknown key "${i}" — only version, encoding and standalone.`:r!==void 0&&r!=="1.0"&&r!=="1.1"?'declaration.version must be "1.0" or "1.1".':t!==void 0&&t!=="UTF-8"?'declaration.encoding can only be "UTF-8" — the file is always written as UTF-8.':o!==void 0&&o!=="yes"&&o!=="no"?'declaration.standalone must be "yes" or "no".':null}function lr(e){for(const r of e){if(r===null||typeof r!="object"||Array.isArray(r))return"every writeTo entry must be an object.";const{to:t,writeTo:o}=r,a=nr(r,"export");if(a)return`writeTo "${t}": ${a}`;if(o!==void 0){if(!Array.isArray(o))return`writeTo "${t}": its nested writeTo must be an array.`;const i=lr(o);if(i)return i}}return null}function oo({writeTo:e,declaration:r}){return e===void 0?"writeTo is required — see docs/xml-export-control.md.":Array.isArray(e)?e.length===0?"writeTo is declared but empty — declare at least one entry.":lr(e)??(r===void 0?null:no(r)):"writeTo must be an array of { from | formula, to } entries."}function so({version:e="1.0",standalone:r}){return{"@_version":e,"@_encoding":"UTF-8",...r&&{"@_standalone":r}}}function io(e){return e==null?!0:Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}const lo=({path:e,label:r,schema:t,visible:o=!0})=>{var j,S;const a=(t==null?void 0:t["x-xml-export"])??{},i=a.rootElement??to,l=a.fileName??lt,d=a.writeTo,c=a.writeBase??"root",u=a.declaration,f=oo(a),p=$.useJsonForms(),h=c==="parent"?e.split(".").slice(0,-1).join("."):"",m=h?v.Resolve.data((j=p.core)==null?void 0:j.data,h):(S=p.core)==null?void 0:S.data,[y,N]=g.useState(null),O=io(m),M=g.useCallback(async()=>{if(d){N(null);try{const k=or(await He(m,d,"export")),{XMLBuilder:C}=await import("fast-xml-parser"),I={...u&&{"?xml":so(u)},[i]:k},L=new C(ro).build(I);Wr(L,Ve(l,m,lt),"application/xml")}catch(k){N(k instanceof Error?k.message:"This export could not be built.")}}},[d,m,u,i,l]);return o===!1?null:f?n.jsxs(s.Box,{mb:"4",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",children:r}),n.jsxs(s.Text,{size:"2",color:"red",style:{display:"block"},children:["Invalid x-xml-export config: ",f]})]}):n.jsxs(s.Box,{mb:"4",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",style:{display:"block",marginBottom:"var(--space-2)"},children:r}),n.jsxs(s.Button,{size:"1",variant:"soft",disabled:O,onClick:()=>void M(),children:[n.jsx(Z.DownloadIcon,{}),"Download XML"]}),y&&n.jsx(s.Text,{size:"2",color:"red",style:{display:"block",marginTop:"var(--space-2)"},children:y})]})},ar=$.withJsonFormsControlProps(lo),cr=v.rankWith(10,v.schemaMatches(e=>{const r=e["x-xml-export"];return e.type==="object"&&typeof r=="object"&&r!==null})),ao="{value}",co=2,uo={},fo=({data:e,handleChange:r,path:t,label:o,schema:a,visible:i=!0})=>{var I;ve(i,t,r);const l=a==null?void 0:a["x-computed"],d=(l==null?void 0:l.inputs)??uo,c=(l==null?void 0:l.formula)??"",u=(l==null?void 0:l.format)??ao,f=(l==null?void 0:l.decimals)??co,p=$.useJsonForms(),h=t.split(".").slice(0,-1).join("."),m=Vn((I=p.core)==null?void 0:I.data,h,d),y=m?JSON.stringify(m):null,N=p.readonly===!0,[O,M]=g.useState(()=>typeof e=="number"?"ok":"unavailable"),[j,S]=g.useState(()=>typeof e=="number"?e:null),[k,C]=g.useState(null);return g.useEffect(()=>{if(!i)return;let L=!1;const B=b=>{N||b!==e&&r(t,b)};if(m===void 0){M("unavailable"),C(null),S(null),B(void 0);return}return M(b=>b==="ok"?b:"loading"),Wn(m,c).then(b=>{if(L)return;const E=b.status==="ok"&&typeof b.value=="number"&&Number.isFinite(b.value)?b.value:null;if(E===null){M("error"),C(b.status==="error"?b.error??"Unable to compute value.":"Computed value must be a number."),S(null),B(void 0);return}M("ok"),C(null),S(E),B(E)}),()=>{L=!0}},[y,c,i,N]),i===!1?null:n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",children:o}),O==="unavailable"?n.jsx(s.Text,{size:"2",color:"gray",children:"Not yet available."}):O==="loading"?n.jsxs(s.Flex,{align:"center",gap:"2",children:[n.jsx(s.Spinner,{size:"1"}),n.jsx(s.Text,{size:"2",color:"gray",children:"Computing…"})]}):O==="error"?n.jsx(s.Text,{size:"2",color:"red",children:k}):n.jsx(s.Text,{size:"2",children:Ne(u,{value:er(j,f)})}),a.description&&n.jsx(s.Text,{size:"1",color:"gray",children:a.description})]})})},ur=$.withJsonFormsControlProps(fo),dr=v.rankWith(5,v.schemaMatches(e=>{const r=e["x-computed"];return e.type==="number"&&typeof r=="object"&&r!==null})),fr="seq",at=2,po=e=>e==null||e==="",pr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,ho=e=>{const r=e==null?void 0:e["x-template"];if(typeof r!="object"||r===null)return;const{template:t,inputs:o}=r;if(!(typeof t!="string"||t===""))return{template:t,inputs:o}},Xe=e=>typeof e=="object"&&e.name===fr&&e.arg!==void 0,xo=e=>e.every((r,t)=>!Xe(r)||typeof e[t-1]!="object"&&typeof e[t+1]!="object"),mo=e=>{const r=new Set;for(const t of _e(e))typeof t=="object"&&t.arg===void 0&&r.add(t.name);return[...r]},go=e=>{const r=[];for(const[t,o]of Object.entries((e==null?void 0:e.properties)??{})){const a=ho(o);a&&r.push([t,a])}return r},yo=(e,r,t)=>{var a;const o={};for(const i of mo(t.template)){const l=Qt(e,r,((a=t.inputs)==null?void 0:a[i])??i);o[i]=typeof l=="string"||typeof l=="number"||typeof l=="boolean"?String(l):""}return o},bo=e=>r=>{const t=r.trim()===""?at:Number(r);return`${e}`.padStart(Number.isInteger(t)&&t>=0?t:at,"0")},vo=e=>{const r=o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");let t="";for(const o of _e(e))typeof o=="string"?t+=r(o):t+=Xe(o)?"(\\d+)":".*?";return new RegExp(`^${t}$`)},wo=(e,r,t)=>{var i,l;const o=vo(t.template);let a=0;for(const d of e){const c=(i=pr(d))==null?void 0:i[r];if(typeof c!="string")continue;const u=Number((l=o.exec(c))==null?void 0:l[1]);Number.isFinite(u)&&u>a&&(a=u)}return a},To=(e,r,t,o,a,i)=>{const l=go(e);if(l.length===0)return r;const d=pr(r);if(!d)return r;const c={...d};for(const[u,f]of l){if(!po(c[u]))continue;const p=_e(f.template),h={};if(p.some(Xe)){if(!xo(p)){console.warn(`x-template: {seq(…)} needs literal text between it and other placeholders; not numbering "${f.template}"`);continue}const m=Math.max(i[u]??0,wo(t,u,f))+1;i[u]=m,h[fr]=bo(m)}c[u]=Ne(f.template,yo(o,a,f),h)}return c},jo=({path:e,items:r,itemsSchema:t,rootSchema:o,addItem:a,sequences:i})=>{const l=$.useJsonForms(),d=()=>{var u;const c=To(t,v.createDefaultValue(t,o),r,(u=l.core)==null?void 0:u.data,e.split(".").slice(0,-1).join("."),i.current);a&&a(e,c)()};return n.jsx(s.Box,{mt:"2",children:n.jsxs(s.Button,{type:"button",variant:"surface",onClick:d,children:[n.jsx(Z.PlusIcon,{}),"Add Item"]})})},Eo=({data:e,path:r,schema:t,uischema:o,enabled:a,visible:i,addItem:l,removeItems:d,rootSchema:c,arraySchema:u})=>{const f=g.useRef({}),p=u?t:t.items,h=u||t;if(i===!1||!p||typeof p!="object"||Array.isArray(p))return null;const m=p,y=Array.isArray(e)?e:[],N=h.title||"Array Items",O=o.options??{},M=a&&O.addable!==!1,j=a&&O.removable!==!1,S=O.itemLabel||"Item",k=C=>{if(d){const I=d(r,[C]);I&&I()}};return n.jsx(s.Box,{mb:"6",children:n.jsxs(s.Flex,{direction:"column",gap:"4",children:[n.jsx(s.Text,{as:"div",size:"4",weight:"bold",children:N}),y.length===0&&n.jsx(s.Box,{py:"4",px:"4",style:{backgroundColor:"var(--gray-3)",borderRadius:"var(--radius-3)"},children:n.jsx(s.Text,{size:"2",color:"gray",children:"No items have been added yet."})}),y.map((C,I)=>{var B;const L=`${r}.${I}`;return n.jsx(s.Card,{size:"3",variant:"surface",children:n.jsxs(s.Flex,{direction:"column",gap:"4",children:[n.jsxs(s.Flex,{justify:"between",align:"center",children:[n.jsxs(s.Text,{size:"3",weight:"bold",children:[S," ",I+1]}),j&&n.jsxs(s.Button,{type:"button",color:"red",variant:"soft",onClick:()=>k(I),title:"Remove item",children:[n.jsx(Z.TrashIcon,{}),"Remove"]})]}),n.jsx(s.Box,{children:n.jsx($.JsonFormsDispatch,{schema:m,uischema:((B=o.options)==null?void 0:B.detail)||(m.type==="object"||m.properties?{type:"VerticalLayout",elements:Object.keys(m.properties||{}).map(b=>({type:"Control",scope:`#/properties/${b}`}))}:{type:"Control",scope:"#"}),path:L,enabled:a,renderers:void 0,cells:void 0})})]})},L)}),M&&n.jsx(jo,{path:r,items:y,itemsSchema:m,rootSchema:c,addItem:l,sequences:f})]})})},Be=$.withJsonFormsArrayControlProps(Eo),hr=v.rankWith(3,v.isObjectArrayControl),xr=({uischema:e,visible:r})=>{const t=e;return r===!1?null:n.jsx(s.Box,{mb:"4",children:n.jsx(s.Heading,{size:"4",children:t.text})})},mr=v.rankWith(1,v.uiTypeIs("Label")),Co=v.rankWith(3,v.isPrimitiveArrayControl),So=[{tester:xt,renderer:Sr},{tester:gt,renderer:Rr},{tester:bt,renderer:Ar},{tester:wt,renderer:Fr},{tester:St,renderer:Ct},{tester:jt,renderer:Or},{tester:At,renderer:Br},{tester:Ot,renderer:$.withJsonFormsLayoutProps(Ft)},{tester:kt,renderer:$.withJsonFormsLayoutProps(It)},{tester:Nt,renderer:$.withJsonFormsLayoutProps(Dt)},{tester:Mt,renderer:$.withJsonFormsLayoutProps(Lt)},{tester:$t,renderer:Pt},{tester:qt,renderer:Kt},{tester:Zt,renderer:Gt},{tester:ir,renderer:sr},{tester:cr,renderer:ar},{tester:dr,renderer:ur},{tester:hr,renderer:Be},{tester:Co,renderer:Be},{tester:mr,renderer:xr}];exports.ArrayControl=Be;exports.ArrayControlTester=hr;exports.BooleanControl=yt;exports.BooleanControlTester=bt;exports.CategorizationLayoutRenderer=Lt;exports.CategorizationLayoutTester=Mt;exports.ComputedControl=ur;exports.ComputedControlTester=dr;exports.DateControl=Rt;exports.DateControlTester=At;exports.FileControl=Pt;exports.FileControlTester=$t;exports.GroupLayoutRenderer=Dt;exports.GroupLayoutTester=Nt;exports.HorizontalLayoutRenderer=It;exports.HorizontalLayoutTester=kt;exports.LabelRenderer=xr;exports.LabelTester=mr;exports.NumberControl=mt;exports.NumberControlTester=gt;exports.RadioControl=vt;exports.RadioControlTester=wt;exports.SearchSelectControl=Ct;exports.SearchSelectControlTester=St;exports.SearchServiceProvider=Cr;exports.SelectControl=Tt;exports.SelectControlTester=jt;exports.SpreadsheetControl=Kt;exports.SpreadsheetControlTester=qt;exports.SpreadsheetExportControl=Gt;exports.SpreadsheetExportControlTester=Zt;exports.TextControl=ht;exports.TextControlTester=xt;exports.UploadProvider=Er;exports.VerticalLayoutRenderer=Ft;exports.VerticalLayoutTester=Ot;exports.XmlControl=sr;exports.XmlControlTester=ir;exports.XmlExportControl=ar;exports.XmlExportControlTester=cr;exports.radixRenderers=So;exports.useSearchService=pt;exports.useUpload=dt;
|
|
1
|
+
"use strict";var jr=Object.create;var Ue=Object.defineProperty;var Er=Object.getOwnPropertyDescriptor;var Cr=Object.getOwnPropertyNames;var Rr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var Ar=(e,r,t)=>r in e?Ue(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var Fr=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of Cr(r))!Sr.call(e,l)&&l!==t&&Ue(e,l,{get:()=>r[l],enumerable:!(o=Er(r,l))||o.enumerable});return e};var Ae=(e,r,t)=>(t=e!=null?jr(Rr(e)):{},Fr(r||!e||!e.__esModule?Ue(t,"default",{value:e,enumerable:!0}):t,e));var Ye=(e,r,t)=>Ar(e,typeof r!="symbol"?r+"":r,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),g=require("react"),b=require("@jsonforms/core"),B=require("@jsonforms/react"),s=require("@radix-ui/themes"),re=require("@radix-ui/react-icons"),ht=require("dayjs"),xt=g.createContext(null);function Or({children:e,onUpload:r,getDownloadUrl:t}){const o={onUpload:r,getDownloadUrl:t};return n.jsx(xt.Provider,{value:o,children:e})}function mt(){return g.useContext(xt)}const gt=g.createContext(null);function Ir({children:e,services:r}){const t=g.useMemo(()=>r,[r]);return n.jsx(gt.Provider,{value:t,children:e})}function yt(e){const r=g.useContext(gt);return!r||!e?null:r[e]??null}const je=(e,r,t,o=void 0)=>{g.useEffect(()=>{e===!1&&t(r,o)},[e,r,t,o])},Ge=new WeakMap;function kr(e){if(!e||typeof e!="object")return!1;const r=Ge.get(e);if(r!==void 0)return r;const t=Ie(e,e,new Set);return Ge.set(e,t),t}function Dr(e,r){if(!r.startsWith("#/"))return;const t=r.slice(2).split("/");let o=e;for(const l of t){if(!o||typeof o!="object")return;o=o[l]}return o&&typeof o=="object"?o:void 0}function Ie(e,r,t){if(!e||typeof e!="object"||t.has(e))return!1;t.add(e);const o=e;if(o.if!=null||o.dependentRequired!=null||o.dependencies!=null)return!0;for(const l of["allOf","anyOf","oneOf"]){const i=o[l];if(Array.isArray(i))for(const a of i){if(!a||typeof a!="object")continue;const c=a;if(Array.isArray(c.required)&&c.required.length>0||Ie(c,r,t))return!0}}if(typeof o.$ref=="string"){const l=Dr(r,o.$ref);if(l&&Ie(l,r,t))return!0}for(const l of["then","else","not","contains","additionalProperties","items"]){const i=o[l];if(i&&typeof i=="object"&&!Array.isArray(i)&&Ie(i,r,t))return!0}if(Array.isArray(o.items)){for(const l of o.items)if(Ie(l,r,t))return!0}for(const l of["properties","patternProperties","$defs","definitions"]){const i=o[l];if(!(!i||typeof i!="object")){for(const a of Object.values(i))if(Ie(a,r,t))return!0}}return!1}function Nr(e,r){const t=structuredClone(e??{});if(!r)return t;const o=r.split(".");let l=t;for(let a=0;a<o.length-1;a++){const c=o[a];if(l==null||typeof l!="object")return t;const u=l[c];if(u==null||typeof u!="object")return t;l=u}const i=o[o.length-1];return l!=null&&typeof l=="object"&&delete l[i],t}function Lr(e){const r=e.lastIndexOf(".");return r===-1?"":"/"+e.slice(0,r).split(".").join("/")}function Mr(e){if(!e)return"";const r=e.lastIndexOf(".");return r===-1?e:e.slice(r+1)}function zr(e,r){var t;return e.keyword!=="required"&&e.keyword!=="dependencies"||((t=e.params)==null?void 0:t.missingProperty)!==Mr(r)?!1:(e.instancePath??"")===Lr(r)}function Pr(e,r,t){if(!e||!t)return!1;const o=Nr(r,e);t(o);const l=t.errors;return l!=null&&l.length?l.some(i=>zr(i,e)):!1}function be(e,r=!1,t=!0){var c,u,d;const o=B.useJsonForms(),l=(c=o.core)==null?void 0:c.data,i=(u=o.core)==null?void 0:u.validator,a=(d=o.core)==null?void 0:d.schema;return g.useMemo(()=>t?r?!0:kr(a)?Pr(e,l,i):!1:!1,[t,r,e,l,i,a])}const ve=(e,r)=>{if(!e)return"";const t=r||"This field";return e.split(`
|
|
2
|
+
`).map(o=>{const l=o.trim();return l==="is a required property"?`${t} is required`:l.startsWith("must be > ")?`${t} must be greater than ${l.slice(10)}`:l.startsWith("must be >= ")?`${t} must be at least ${l.slice(11)}`:l.startsWith("must be multiple of ")?`${t} must be a multiple of ${l.slice(20)}`:o}).join(`
|
|
3
|
+
`)},bt=({data:e,handleChange:r,path:t,label:o,required:l,errors:i,uischema:a,schema:c,enabled:u,visible:d=!0})=>{var x;je(d,t,r);const f=be(t,l,d);if(d===!1)return null;const m=i.length===0;return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[o," ",f&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsx(s.TextField.Root,{value:e||"",onChange:p=>r(t,p.target.value),disabled:!u,placeholder:(x=a.options)==null?void 0:x.placeholder,color:m?void 0:"red",id:t}),!m&&n.jsx(s.Text,{color:"red",size:"1",children:ve(i,o)}),c.description&&n.jsx(s.Text,{size:"1",color:"gray",children:c.description})]})})},vt=b.rankWith(1,b.isStringControl),Ur=B.withJsonFormsControlProps(bt),$r=new Set(["-","+","e","E"]),wt=({data:e,handleChange:r,path:t,label:o,required:l,errors:i,uischema:a,schema:c,enabled:u,visible:d=!0})=>{var R;je(d,t,r);const f=be(t,l,d);if(d===!1)return null;const m=i.length===0,x=typeof c.exclusiveMinimum=="number"?c.exclusiveMinimum:void 0,p=typeof c.minimum=="number"?c.minimum:void 0,j=x??p,w=j!==void 0&&j>=0,N=typeof c.multipleOf=="number"?c.multipleOf:c.type==="integer"?1:void 0,I=v=>{if(v===""){r(t,void 0);return}const y=Number(v);isNaN(y)||r(t,y)},O=v=>{w&&$r.has(v.key)&&v.preventDefault()},C=v=>{if(!w)return;const y=v.clipboardData.getData("text");/[-+eE]/.test(y)&&v.preventDefault()};return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[o," ",f&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsx(s.TextField.Root,{type:"number",value:e??"",onChange:v=>I(v.target.value),onKeyDown:O,onPaste:C,min:j,step:N,disabled:!u,placeholder:(R=a.options)==null?void 0:R.placeholder,color:m?void 0:"red",id:t}),!m&&n.jsx(s.Text,{color:"red",size:"1",children:ve(i,o)}),c.description&&n.jsx(s.Text,{size:"1",color:"gray",children:c.description})]})})},Tt=b.rankWith(2,b.or(b.isNumberControl,b.isIntegerControl)),Br=B.withJsonFormsControlProps(wt),jt=({data:e,handleChange:r,path:t,label:o,required:l,errors:i,schema:a,enabled:c,visible:u=!0})=>{je(u,t,r);const d=be(t,l,u);if(u===!1)return null;const f=i.length===0;return n.jsxs(s.Box,{mb:"4",children:[n.jsxs(s.Flex,{gap:"2",align:"center",children:[n.jsx(s.Checkbox,{checked:!!e,onCheckedChange:m=>r(t,m===!0),disabled:!c,id:t}),n.jsxs(s.Text,{as:"label",size:"2",htmlFor:t,children:[o," ",d&&"*"]})]}),!f&&n.jsx(s.Text,{color:"red",size:"1",className:"block mt-1",children:ve(i,o)}),a.description&&n.jsx(s.Text,{size:"1",color:"gray",className:"block mt-1",children:a.description})]})},Et=b.rankWith(2,b.isBooleanControl),_r=B.withJsonFormsControlProps(jt),Ct=({data:e,handleChange:r,path:t,label:o,required:l,errors:i,schema:a,enabled:c,visible:u=!0})=>{je(u,t,r);const d=be(t,l,u);if(u===!1)return null;const f=i.length===0;let m=[];a.enum?m=a.enum.map(p=>({value:p,label:String(p)})):a.oneOf&&(m=a.oneOf.map(p=>({value:p.const,label:p.title||String(p.const)})));const x=e;return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"div",size:"2",weight:"bold",children:[o," ",d&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsx(s.RadioGroup.Root,{value:x!==void 0?String(x):"",onValueChange:p=>{const j=m.find(w=>String(w.value)===p);j&&r(t,j.value)},disabled:!c,children:n.jsx(s.Flex,{direction:"row",style:{flexWrap:"wrap",columnGap:"clamp(14px, 3vw, 36px)",rowGap:"clamp(8px, 1.6vw, 14px)"},children:m.map(p=>n.jsxs(s.Flex,{align:"center",gap:"2",style:{minWidth:"max-content"},children:[n.jsx(s.RadioGroup.Item,{value:String(p.value)}),n.jsx(s.Text,{size:"2",color:c?void 0:"gray",children:p.label})]},String(p.value)))})}),!f&&n.jsx(s.Text,{color:"red",size:"1",children:ve(i,o)}),a.description&&n.jsx(s.Text,{size:"1",color:"gray",children:a.description})]})})},Rt=(e,r,t)=>{var l;return b.or(b.isEnumControl,b.isOneOfControl)(e,r,t)&&((l=e==null?void 0:e.options)==null?void 0:l.format)==="radio"?3:-1},Wr=B.withJsonFormsControlProps(Ct),St=({data:e,handleChange:r,path:t,label:o,required:l,errors:i,schema:a,uischema:c,enabled:u,visible:d=!0})=>{var Q,de,oe,ee;je(d,t,r);const f=be(t,l,d),m=((Q=c.options)==null?void 0:Q.autocomplete)===!0,[x,p]=g.useState(!1),[j,w]=g.useState(""),[N,I]=g.useState(0),O=g.useRef(null);if(g.useEffect(()=>{if(!m||!x)return;const D=H=>{O.current&&!O.current.contains(H.target)&&p(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[m,x]),d===!1)return null;const C=a.type==="object",R=C?((de=a.properties)==null?void 0:de.value)??{}:a;let v=[];R.enum?v=R.enum.map(D=>({value:String(D),label:String(D),raw:D})):R.oneOf&&(v=R.oneOf.map(D=>{const H=D.const;return{value:String(H),label:D.title||String(H),raw:H}}));const y=C?typeof e=="string"||typeof e=="number"||typeof e=="boolean"?{value:e}:e??void 0:void 0,z=C?y==null?void 0:y.value:e,P=y==null?void 0:y.label,F=z!=null?String(z):"",$=P??((oe=v.find(D=>D.value===F))==null?void 0:oe.label)??"",k=((ee=c.options)==null?void 0:ee.placeholder)||"Select an option",ne=C&&F!==""&&!v.some(D=>D.value===F),K=i?ve(i,o):ne?`"${$||F}" is no longer an available option`:"",L=K==="",U=D=>{r(t,C?{value:D.raw,label:D.label}:D.value)};if(m){const D=x?v.filter(M=>M.label.toLowerCase().includes(j.toLowerCase())):v,H=Math.min(N,D.length-1),S=M=>{U(M),p(!1)},Y=M=>{M.stopPropagation(),r(t,void 0),w("")},fe=M=>{(M.key==="Enter"||M.key===" ")&&Y(M)};return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[o," ",f&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsxs("div",{ref:O,style:{position:"relative"},children:[n.jsx(s.TextField.Root,{id:t,value:x?j:$,placeholder:k,disabled:!u,style:L?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:M=>{w(M.target.value),I(0),x||p(!0)},onFocus:()=>{u&&!x&&(w(""),I(0),p(!0))},onKeyDown:M=>{M.key==="Escape"?p(!1):M.key==="ArrowDown"?(M.preventDefault(),x?I(G=>Math.min(G+1,D.length-1)):(w(""),p(!0))):M.key==="ArrowUp"?(M.preventDefault(),x&&I(G=>Math.max(G-1,0))):M.key==="Enter"&&x&&D[H]&&(M.preventDefault(),S(D[H]))},children:n.jsx(s.TextField.Slot,{side:"right",children:n.jsxs(s.Flex,{align:"center",gap:"1",children:[F&&u&&n.jsx("span",{role:"button",tabIndex:0,onMouseDown:M=>M.preventDefault(),onClick:Y,onKeyDown:fe,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),n.jsx(re.ChevronDownIcon,{style:{transform:x?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),x&&n.jsx(s.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:n.jsx(s.ScrollArea,{style:{maxHeight:240},children:n.jsxs(s.Box,{p:"1",children:[D.length===0&&n.jsx(s.Box,{px:"3",py:"2",children:n.jsx(s.Text,{size:"2",color:"gray",children:"No results found."})}),D.map((M,G)=>n.jsx(s.Box,{px:"3",py:"2",onMouseDown:ie=>ie.preventDefault(),onClick:()=>S(M),onMouseEnter:()=>I(G),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:G===H?"var(--accent-4)":M.value===F?"var(--accent-3)":void 0},children:n.jsx(s.Text,{size:"2",children:M.label})},M.value))]})})})]}),!L&&n.jsx(s.Text,{color:"red",size:"1",children:K}),a.description&&n.jsx(s.Text,{size:"1",color:"gray",children:a.description})]})})}return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[o," ",f&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsxs(s.Select.Root,{value:F,onValueChange:D=>{const H=v.find(S=>S.value===D);H&&U(H)},disabled:!u,children:[n.jsx(s.Select.Trigger,{placeholder:k,color:L?void 0:"red",id:t,children:C&&P?P:void 0}),n.jsx(s.Select.Content,{children:v.map(D=>n.jsx(s.Select.Item,{value:D.value,children:D.label},D.value))})]}),!L&&n.jsx(s.Text,{color:"red",size:"1",children:K}),a.description&&n.jsx(s.Text,{size:"1",color:"gray",children:a.description})]})})},At=b.rankWith(2,b.or(b.isEnumControl,b.isOneOfControl)),Ft=b.rankWith(3,b.schemaMatches(e=>{var t;if(e.type!=="object"||e["x-search"]!==void 0)return!1;const r=(t=e.properties)==null?void 0:t.value;return Array.isArray(r==null?void 0:r.enum)||Array.isArray(r==null?void 0:r.oneOf)})),Ze=B.withJsonFormsControlProps(St),Ot=/\{([A-Za-z0-9_]+)(?:\(([^(){}]*)\))?\}/g,Vr={today:e=>ht().format(e||"YYYY-MM-DD")},Hr=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="bigint",Qe=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);function ze(e,r,t={}){const o={...Vr,...t};return e.replace(Ot,(l,i,a)=>{let c;if(a===void 0){if(!Qe(r,i))return l;c=r[i]}else{if(!Qe(o,i))return l;try{c=o[i](a)}catch{return l}}return c==null?"":Hr(c)?String(c):l})}function He(e){const r=[];let t=0;for(const o of e.matchAll(Ot))o.index>t&&r.push(e.slice(t,o.index)),r.push(o[2]===void 0?{name:o[1]}:{name:o[1],arg:o[2]}),t=o.index+o[0].length;return t<e.length&&r.push(e.slice(t)),r}function qr(e){if(typeof e=="string"&&e.length>0)return e;if(e&&typeof e=="object"&&typeof e.value=="string"){const r=e.value;return r.length>0?r:void 0}}function Xr(e){if(typeof e=="string")return e.length>0?{parent:e}:void 0;if(!e||typeof e!="object")return;const r=Object.entries(e);if(r.length===0)return;const t={},o=[];for(const[l,i]of r)typeof i=="string"&&i.length>0?t[l]=i:o.push(l);return o.length>0&&console.warn(`x-search.dependsOn: ignoring invalid entries [${o.join(", ")}]`),Object.keys(t).length===0?(console.warn("x-search.dependsOn: map has no valid entries; search will not fetch until fixed"),{}):t}function Jr(e,r,t){const o={};for(const[l,i]of Object.entries(e))o[l]=qr(b.Resolve.data(r,t?`${t}.${i}`:i));return o}function et(e,r){return r?{...e,name:ze(r,e)}:e}const Kr={"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}},Yr=({data:e,handleChange:r,path:t,label:o,required:l,errors:i,enabled:a,visible:c=!0,schema:u,uischema:d})=>{var De,ge;const f=(u==null?void 0:u["x-search"])??{service:"",displayTemplate:""},m=f.service??"",x=f.mode??"large-paginated-list",p=Kr[x],j=(p==null?void 0:p.fetchOnOpen)??!1,w=typeof f.displayTemplate=="string"?f.displayTemplate:"",N=B.useJsonForms(),I=t.split(".").slice(0,-1).join("."),{parentValues:O,parentValuesKey:C,missingParent:R}=g.useMemo(()=>{var ye;const T=Xr(f.dependsOn);if(!T)return{parentValues:void 0,parentValuesKey:"",missingParent:!1};const te=Jr(T,(ye=N.core)==null?void 0:ye.data,I),ae=Object.keys(te).length===0||Object.values(te).some(Ee=>!Ee);return{parentValues:te,parentValuesKey:JSON.stringify(te),missingParent:ae}},[f.dependsOn,(De=N.core)==null?void 0:De.data,I]),v=g.useMemo(()=>O?{...f.params,...O}:f.params,[O,C,f.params]),y=yt(m),z=u.type==="object",P=z?typeof e=="string"?{value:e}:e??void 0:void 0,F=z?P==null?void 0:P.value:e,$=P==null?void 0:P.label,k=m?y?p?w?null:"x-search.displayTemplate is required.":`Invalid x-search.mode "${x}". Expected "small-list", "large-searchable-list", or "large-paginated-list".`:`Search service "${m}" is not registered.`:"Search not configured.",ne=a!==!1,K=!i||i.length===0,[L,U]=g.useState(!1),[Q,de]=g.useState(""),[oe,ee]=g.useState([]),[D,H]=g.useState(!1),[S,Y]=g.useState(!1),[fe,M]=g.useState(!1),[G,ie]=g.useState(null),[xe,pe]=g.useState(void 0),h=g.useRef(void 0),E=g.useRef(null),_=g.useRef(null),Z=g.useRef(null),q=g.useRef(void 0),he=g.useRef(void 0);g.useEffect(()=>{if(!O)return;const T=he.current;if(he.current=O,!T||!F)return;Object.keys(O).some(ae=>T[ae]!==void 0&&T[ae]!==O[ae])&&r(t,z?void 0:null)},[C,F,r,t,z]),g.useEffect(()=>{var ye,Ee;if(k){pe(void 0),q.current=void 0;return}if(!F){pe(void 0),q.current=void 0;return}if(((ye=q.current)==null?void 0:ye.value)===F&&((Ee=q.current)==null?void 0:Ee.label)===$)return;if(z&&$){pe({id:F,name:$}),q.current={value:F,label:$};return}if(pe({id:F,name:$??F}),!(y!=null&&y.resolve)){q.current={value:F,label:$};return}let T=!1;const te=F,ae=$;return y.resolve(te,v).then(ke=>{T||(ke&&pe(et(ke,w)),q.current={value:te,label:ae})}).catch(()=>{T||(q.current={value:te,label:ae})}),()=>{T=!0}},[k,F,$,z,y,v,w]);const A=g.useCallback(async(T,te=!1)=>{var ye;if(k)return;if(!y){ie("Search service not configured.");return}(ye=_.current)==null||ye.abort();const ae=new AbortController;_.current=ae,te?M(!0):(Y(!0),M(!1),ie(null));try{const Ee=await y.search({query:T,cursor:te?h.current:void 0,signal:ae.signal,params:v});if(ae.signal.aborted)return;const ke=(Ee.options??[]).map(Pe=>et(Pe,w));ee(te?Pe=>[...Pe,...ke]:ke),h.current=Ee.nextCursor,H(((p==null?void 0:p.paginated)??!1)&&Ee.nextCursor!=null)}catch{if(ae.signal.aborted)return;ie("Failed to load results. Please try again.")}finally{ae.signal.aborted||(te?M(!1):Y(!1))}},[k,y,p==null?void 0:p.paginated,v,w]);g.useEffect(()=>{if(!L)return;const T=te=>{Z.current&&!Z.current.contains(te.target)&&U(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[L]),g.useEffect(()=>{var T;L||((T=_.current)==null||T.abort(),de(""),ee([]),H(!1),ie(null),Y(!1),M(!1),h.current=void 0)},[L]),g.useEffect(()=>{if(!L)return;if(R){ee([]),H(!1),ie(null),h.current=void 0;return}if(!Q&&!j){ee([]),H(!1),ie(null),h.current=void 0;return}E.current&&clearTimeout(E.current);const T=Q?300:0;return E.current=setTimeout(()=>{ee([]),H(!1),h.current=void 0,A(Q)},T),()=>{E.current&&clearTimeout(E.current)}},[Q,L,j,A,R,C]),je(c,t,r);const W=be(t,l,c);if(c===!1)return null;const le=()=>{de(""),ee([]),H(!1),ie(null),h.current=void 0,U(!0)},X=T=>{r(t,z?{value:T.id,label:T.name}:T.id),pe(T),q.current={value:T.id,label:z?T.name:void 0},U(!1)},V=T=>{T.stopPropagation(),r(t,void 0),pe(void 0)},Ce=T=>{(T.key==="Enter"||T.key===" ")&&V(T)},Oe=((ge=d==null?void 0:d.options)==null?void 0:ge.placeholder)??"Select an option";return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:t,children:[o," ",W&&n.jsx(s.Text,{color:"red",children:"*"})]}),n.jsxs("div",{ref:Z,style:{position:"relative"},children:[n.jsx(s.TextField.Root,{id:t,value:L?Q:(xe==null?void 0:xe.name)??"",placeholder:L&&(p!=null&&p.searchable)?"Search...":Oe,disabled:!ne,readOnly:L&&!(p!=null&&p.searchable),style:K?void 0:{outline:"2px solid var(--red-7)",outlineOffset:"-1px"},onChange:T=>{p!=null&&p.searchable&&(de(T.target.value),L||le())},onFocus:()=>{ne&&!L&&le()},onKeyDown:T=>{T.key==="Escape"&&U(!1)},children:n.jsx(s.TextField.Slot,{side:"right",children:n.jsxs(s.Flex,{align:"center",gap:"1",children:[F&&ne&&n.jsx("span",{role:"button",tabIndex:0,onMouseDown:T=>T.preventDefault(),onClick:V,onKeyDown:Ce,style:{lineHeight:1,color:"var(--gray-9)",padding:"0 2px",cursor:"pointer"},"aria-label":"Clear selection",children:"×"}),n.jsx(re.ChevronDownIcon,{style:{transform:L?"rotate(180deg)":void 0,transition:"transform 150ms"}})]})})}),L&&n.jsx(s.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:k?n.jsx(s.Box,{p:"3",children:n.jsx(s.Text,{size:"2",color:"gray",children:k})}):n.jsx(s.ScrollArea,{style:{maxHeight:240},children:n.jsxs(s.Box,{p:"1",children:[S&&n.jsx(s.Flex,{justify:"center",p:"4",children:n.jsx(s.Spinner,{})}),!S&&G&&n.jsx(s.Box,{px:"3",py:"2",children:n.jsx(s.Text,{size:"2",color:"red",children:G})}),!S&&!G&&oe.length===0&&n.jsx(s.Box,{px:"3",py:"2",children:n.jsx(s.Text,{size:"2",color:"gray",children:R?"Select the related field first.":Q||j?"No results found.":"Type to search…"})}),oe.map(T=>n.jsx(s.Box,{px:"3",py:"2",onMouseDown:te=>te.preventDefault(),onClick:()=>X(T),style:{cursor:"pointer",borderRadius:"var(--radius-2)",backgroundColor:T.id===F?"var(--accent-3)":void 0},className:"hover:bg-(--gray-3)",children:n.jsx(s.Text,{size:"2",children:T.name})},T.id)),(p==null?void 0:p.paginated)&&D&&!fe&&n.jsx(s.Box,{px:"3",py:"2",children:n.jsx(s.Button,{variant:"ghost",size:"1",style:{width:"100%"},onMouseDown:T=>T.preventDefault(),onClick:()=>void A(Q,!0),children:"Load more"})}),fe&&n.jsx(s.Flex,{justify:"center",p:"2",children:n.jsx(s.Spinner,{})})]})})})]}),!K&&n.jsx(s.Text,{color:"red",size:"1",children:ve(i,o)}),u.description&&n.jsx(s.Text,{size:"1",color:"gray",children:u.description})]})})},It=B.withJsonFormsControlProps(Yr),kt=b.rankWith(3,b.schemaMatches(e=>{const r=e["x-search"];return(e.type==="string"||e.type==="object")&&typeof(r==null?void 0:r.service)=="string"&&r.service!==""})),Gr=e=>{if(e)return/^\d{2}:\d{2}$/.test(e)?`${e}:00`:e},tt=(e,r)=>{if(!e)return"";const t=e.match(/^(\d{2}:\d{2})(:\d{2})?/);return t?r?`${t[1]}${t[2]??":00"}`:t[1]:e},Zr=(e,r)=>ht(`${e}T${r}`).format(),Qr=({path:e,label:r,required:t,errors:o,description:l,children:i})=>{const a=o.length===0;return n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",htmlFor:e,children:[r," ",t&&n.jsx(s.Text,{color:"red",children:"*"})]}),i,!a&&n.jsx(s.Text,{color:"red",size:"1",children:ve(o,r)}),l&&n.jsx(s.Text,{size:"1",color:"gray",children:l})]})})},Dt=({data:e,handleChange:r,path:t,label:o,required:l,errors:i,schema:a,uischema:c,enabled:u,visible:d=!0})=>{var v;g.useEffect(()=>{d===!1&&r(t,void 0)},[d,t,r]);const f=be(t,l,d);if(d===!1)return null;const m=i.length===0,x=typeof e=="string"?e:"",p=((v=c==null?void 0:c.options)==null?void 0:v.showSeconds)===!0,j=p?1:60,w=y=>n.jsx(Qr,{path:t,label:o,required:f,errors:i,description:a.description,children:y});if(a.format==="time")return w(n.jsx(s.TextField.Root,{type:"time",step:j,value:tt(x,p),onChange:y=>r(t,Gr(y.target.value)),disabled:!u,color:m?void 0:"red",id:t}));const N=a.format==="date-time",[I="",O=""]=x.split("T"),C=tt(O,p),R=(y,z)=>{if(!y){r(t,void 0);return}r(t,N?Zr(y,z||"00:00"):y)};return w(n.jsxs(s.Flex,{gap:"2",align:"center",children:[n.jsx(s.TextField.Root,{type:"date",value:I,disabled:!u,color:m?void 0:"red",onChange:y=>R(y.target.value,C),id:t,style:{flex:1}}),N&&n.jsx(s.TextField.Root,{type:"time",step:j,value:C,disabled:!u||!I,color:m?void 0:"red",onChange:y=>R(I,y.target.value),style:{flex:1}})]}))},Nt=b.rankWith(2,b.or(b.isDateControl,b.isDateTimeControl,b.isTimeControl)),en=B.withJsonFormsControlProps(Dt),Lt=({uischema:e,schema:r,path:t,renderers:o,cells:l,enabled:i,visible:a=!0})=>{const u=e.elements;return a===!1?null:n.jsx(s.Flex,{direction:"column",gap:"4",children:u.map((d,f)=>n.jsx(B.JsonFormsDispatch,{uischema:d,schema:r,path:t,renderers:o,cells:l,enabled:i},`${t}-${f}`))})},Mt=b.rankWith(1,b.uiTypeIs("VerticalLayout")),zt=({uischema:e,schema:r,path:t,renderers:o,cells:l,enabled:i,visible:a=!0})=>{const u=e.elements;return a===!1?null:n.jsx(s.Flex,{direction:"row",gap:"4",children:u.map((d,f)=>n.jsx(s.Box,{style:{flex:1},children:n.jsx(B.JsonFormsDispatch,{uischema:d,schema:r,path:t,renderers:o,cells:l,enabled:i})},`${t}-${f}`))})},Pt=b.rankWith(1,b.uiTypeIs("HorizontalLayout")),Ut=({uischema:e,schema:r,path:t,renderers:o,cells:l,enabled:i,visible:a=!0})=>{const c=e,u=c.elements;return a===!1?null:n.jsxs(s.Box,{mb:"6",children:[c.label&&n.jsx(s.Heading,{size:"3",mb:"3",className:"text-gray-500 uppercase tracking-wide font-semibold",children:c.label}),n.jsx(s.Flex,{direction:"column",gap:"4",children:u.map((d,f)=>n.jsx(B.JsonFormsDispatch,{uischema:d,schema:r,path:t,renderers:o,cells:l,enabled:i},`${t}-${f}`))})]})},$t=b.rankWith(1,b.uiTypeIs("Group")),Bt=({uischema:e,schema:r,path:t,renderers:o,cells:l,enabled:i,visible:a=!0})=>{var x;const u=e.elements.filter(p=>p.type==="Category"),[d,f]=g.useState(((x=u[0])==null?void 0:x.label)||"");if(a===!1||!u.length)return null;const m=u.find(p=>p.label===d)?d:u[0].label;return n.jsxs(s.Tabs.Root,{value:m,onValueChange:f,children:[n.jsx(s.Tabs.List,{children:u.map((p,j)=>n.jsx(s.Tabs.Trigger,{value:p.label,children:p.label},`${t}-${j}`))}),n.jsx(s.Box,{pt:"3",children:u.map((p,j)=>n.jsx(s.Tabs.Content,{value:p.label,children:n.jsx(s.Flex,{direction:"column",gap:"4",children:p.elements.map((w,N)=>n.jsx(B.JsonFormsDispatch,{uischema:w,schema:r,path:t,renderers:o,cells:l,enabled:i},`${t}-${j}-${N}`))})},`${t}-${j}`))})]})},_t=b.rankWith(1,b.uiTypeIs("Categorization"));function we(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function Te(e){const r=e.split(",").map(i=>i.trim()).filter(Boolean),t=r.filter(i=>i.startsWith(".")),l=(t.length>0?t:r).map(i=>{if(i.endsWith("/*"))return i.split("/")[0].toUpperCase()+"S";if(i.startsWith("."))return i.slice(1).toUpperCase();const a=i.split("/")[1];return a?a.toUpperCase():i});return[...new Set(l)].join(", ")}const tn="image/png,image/jpeg,image/gif,image/webp,application/pdf,text/html,text/plain,.png,.jpg,.jpeg,.gif,.webp,.pdf,.html,.htm,.txt";function Wt(e,r){return r.split(",").map(o=>o.trim()).filter(Boolean).some(o=>o==="*"||o==="*/*"?!0:o.endsWith("/*")?(e.type??"").startsWith(o.slice(0,-1)):o.startsWith(".")?e.name.toLowerCase().endsWith(o.toLowerCase()):e.type===o)}function rn(e){const r=!!e.type,t=Be(e.name)!==void 0;return!r&&!t?!0:Wt(e,tn)}function Be(e){const r=e.split(/[/\\]/).pop()??e,t=r.lastIndexOf(".");if(!(t<=0||t===r.length-1))return r.slice(t)}function nn(e,r,t){Vt(new Blob([e],{type:t}),r)}function Vt(e,r){const t=URL.createObjectURL(e),o=document.createElement("a");o.href=t,o.download=r,o.click(),setTimeout(()=>URL.revokeObjectURL(t),0)}async function on(e,r){const t=await fetch(e);if(!t.ok)throw new Error(`Download failed (${t.status})`);Vt(await t.blob(),r)}function sn(e,r,t){const o=t.name||t.key;if(!e)return o;const l=qe(e,r,o),i=Be(t.name??"")??Be(t.key);return!i||l.toLowerCase().endsWith(i.toLowerCase())?l:`${l}${i}`}const ln=new Set(["/","\\","<",">",":",'"',"|","?","*"]),an=e=>ln.has(e)||e.charCodeAt(0)<32||e.charCodeAt(0)===127;function cn(e,r){const t=Array.from(e,o=>an(o)?"_":o).join("").trim();return t===""||t.startsWith(".")?r:t}function qe(e,r,t){const o=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{};return cn(ze(e,o),t)}function un(e){return e?Array.isArray(e)?e:[e]:[]}const dn=({data:e,handleChange:r,path:t,label:o,required:l,uischema:i,schema:a,enabled:c,errors:u,visible:d=!0})=>{const f=mt();je(d,t,r);const m=be(t,l,d),x=!u||u.length===0,p=(a==null?void 0:a["x-file"])??{},j=(i==null?void 0:i.options)??{},w=p.maxFiles??j.maxFiles??1,N=p.maxSize??j.maxSize??5*1024*1024,I=p.accept??j.accept??"image/*,application/pdf",O=typeof p.fileName=="string"?p.fileName:void 0,C=w>1,R=c!==!1,[v,y]=g.useState(!1),[z,P]=g.useState(null),[F,$]=g.useState({}),[k,ne]=g.useState({}),K=g.useRef(new Set),L=g.useRef(null),U=un(e),Q=U.length>=w,de=h=>{const E=k[h];return{name:(E==null?void 0:E.name)??h,type:E==null?void 0:E.type}},oe=async h=>{var Z,q;const E=(Z=k[h])==null?void 0:Z.blobUrl;if(E)return E;const _=await((q=f==null?void 0:f.getDownloadUrl)==null?void 0:q.call(f,h));return _==null?void 0:_.url},ee=(h,E)=>{$(_=>({..._,[h]:E}))},D=h=>{$(E=>{if(!E[h])return E;const _={...E};return delete _[h],_})};g.useEffect(()=>()=>{K.current.forEach(h=>URL.revokeObjectURL(h)),K.current.clear()},[]);const H=g.useCallback(async h=>{if(P(null),U.length>=w){P(`Maximum ${w} file${w>1?"s":""} allowed.`);return}if(h.size>N){P(`File exceeds the ${we(N)} limit.`);return}if(!Wt(h,I)){P(`Invalid type. Accepted: ${Te(I)}`);return}if(!(f!=null&&f.onUpload)){P("Upload service not configured.");return}try{const E=await f.onUpload(h),_=URL.createObjectURL(h);K.current.add(_);const Z={key:E.key,name:E.name??h.name,type:h.type||void 0,blobUrl:_};ne(he=>({...he,[E.key]:Z}));const q=[...U,E.key];r(t,C?q:q[0])}catch{P("Upload failed. Please try again."),L.current&&(L.current.value="")}},[U,w,N,I,f,t,r,C]);if(d===!1)return null;const S=h=>{h.preventDefault(),h.stopPropagation(),!(!R||Q)&&y(h.type==="dragenter"||h.type==="dragover")},Y=h=>{var E;h.preventDefault(),h.stopPropagation(),y(!1),!(!R||Q)&&(E=h.dataTransfer.files)!=null&&E[0]&&H(h.dataTransfer.files[0])},fe=h=>{var E;(E=h.target.files)!=null&&E[0]&&(H(h.target.files[0]),h.target.value="")},M=h=>{if(!R)return;ne(_=>{var he;const Z={..._},q=(he=Z[h])==null?void 0:he.blobUrl;return q&&(URL.revokeObjectURL(q),K.current.delete(q)),delete Z[h],Z}),D(h);const E=U.filter(_=>_!==h);r(t,C?E.length>0?E:void 0:E[0])},G=async(h,E)=>{var q,he;h.preventDefault(),D(E);const _=(q=k[E])==null?void 0:q.blobUrl;if(_){(he=window.open(_,"_blank","noopener,noreferrer"))==null||he.focus();return}const Z=window.open("","_blank");if(Z)try{const A=await oe(E);A?Z.location.href=A:(Z.close(),ee(E,"Unable to open file."))}catch{Z.close(),ee(E,"Unable to open file.")}},ie=async(h,E)=>{D(h);try{const _=await oe(h);if(!_){ee(h,"Unable to download file.");return}await on(_,E)}catch{ee(h,"Unable to download file.")}};if(!R&&U.length===0)return null;const xe=w-U.length,pe=R&&!Q;return n.jsxs(s.Box,{mb:"4",children:[n.jsxs(s.Flex,{align:"center",justify:"between",mb:"2",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",children:[o,m&&n.jsx(s.Text,{color:"red",children:" *"})]}),n.jsx(s.Text,{size:"1",color:"gray",children:C?`Up to ${w} files · ${we(N)} each · ${Te(I)}`:`${we(N)} · ${Te(I)}`})]}),U.map((h,E)=>{var X;const _=E+1,Z=(X=k[h])==null?void 0:X.name,q=sn(O,{index:_},{name:Z,key:h}),he=O?q:Z??"Uploaded File",A=!!(O&&Z),W=F[h],le=rn(de(h));return n.jsxs(s.Card,{size:"2",variant:"surface",mb:"2",children:[n.jsxs(s.Flex,{align:"center",gap:"3",children:[n.jsx(s.Box,{style:{background:"var(--blue-3)",padding:8,borderRadius:6,color:"var(--blue-9)",flexShrink:0},children:n.jsx(re.FileTextIcon,{width:"20",height:"20"})}),n.jsxs(s.Box,{style:{flex:1,overflow:"hidden"},children:[n.jsx(s.Text,{size:"2",weight:"bold",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:he}),A&&n.jsx(s.Text,{size:"1",color:"gray",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Z})]}),n.jsxs(s.Flex,{align:"center",gap:"2",style:{flexShrink:0},children:[le&&n.jsx(s.Button,{variant:"soft",color:"blue",size:"1",onClick:V=>void G(V,h),children:"View"}),n.jsx(s.Tooltip,{content:"Download",children:n.jsx(s.IconButton,{variant:"ghost",color:"gray","aria-label":"Download",onClick:()=>void ie(h,q),children:n.jsx(re.DownloadIcon,{})})}),n.jsx(re.CheckCircledIcon,{style:{color:"var(--green-9)",width:18,height:18}}),R&&n.jsx(s.IconButton,{variant:"ghost",color:"gray",onClick:()=>M(h),children:n.jsx(re.Cross2Icon,{})})]})]}),W&&n.jsx(s.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:W})]},h)}),pe&&n.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{var h;return(h=L.current)==null?void 0:h.click()},onKeyDown:h=>{var E;(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),(E=L.current)==null||E.click())},onDragEnter:S,onDragLeave:S,onDragOver:S,onDrop:Y,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",v?"border-blue-500 bg-blue-50":z?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:[n.jsx("input",{ref:L,type:"file",style:{display:"none"},accept:I,onChange:fe}),n.jsx(s.Flex,{direction:"column",align:"center",gap:"2",children:z?n.jsxs(n.Fragment,{children:[n.jsx(re.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),n.jsx(s.Text,{size:"2",color:"red",weight:"medium",children:z}),n.jsx(s.Text,{size:"1",color:"gray",children:"Click to try again"})]}):n.jsxs(n.Fragment,{children:[n.jsx(re.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),n.jsx(s.Text,{size:"2",weight:"medium",children:U.length>0?`Add another file (${xe} remaining)`:"Click to upload or drag and drop"}),n.jsxs(s.Text,{size:"1",color:"gray",children:[we(N)," max · ",Te(I)]})]})})]}),R&&Q&&C&&n.jsxs(s.Text,{size:"1",color:"gray",mt:"1",style:{display:"block",textAlign:"center"},children:["Maximum ",w," files uploaded. Remove one to replace it."]}),!x&&n.jsx(s.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:ve(u,o)})]})},Ht=B.withJsonFormsControlProps(dn),qt=b.rankWith(10,b.and(b.schemaMatches(e=>{if(e.type==="string"&&e.format==="file")return!0;if(e.type==="array"){const r=e.items;return(r==null?void 0:r.type)==="string"&&(r==null?void 0:r.format)==="file"}return!1})));function Xt(e,r){return e!==!1&&r!==!0}class _e extends Error{}async function fn(e,r){const{read:t,utils:o}=await import("@e965/xlsx"),l=t(e,{type:"array",cellDates:!0});if(l.SheetNames.length===0)throw new _e("This file has no sheets.");const i=r??l.SheetNames[0],a=l.Sheets[i];if(!a)throw new _e(`This file doesn't have a sheet named "${i}".`);const c=o.sheet_to_json(a,{header:1,raw:!0,defval:null});return{sheetName:i,matrix:c,rowCount:c.length,colCount:Math.max(0,...c.map(u=>u.length))}}function pn(e){let r=e+1,t="";for(;r>0;){const o=(r-1)%26;t=String.fromCharCode(65+o)+t,r=Math.floor((r-1)/26)}return t}class ue extends Error{constructor(t,o){super(o??t);Ye(this,"code");this.code=t,this.name="FormulaError"}}const hn=["IFS","IFERROR","AND","OR","NOT","ROUND","ROUNDUP","ROUNDDOWN","INDEX","VLOOKUP","HLOOKUP","SUM","AVERAGE","COUNT","DATE","TODAY"],xn=["MAX","MIN","MAXA","MINA","MEDIAN","LARGE","SMALL","PERMUT","PERMUTATIONA","MATCH","SWITCH","SUBSTITUTE","TEXTJOIN","COUNTA","UPPER"],mn=["YEAR","MONTH","DAY","WEEKDAY"],gn=["IF"],yn=["CONCATENATE","CONCAT","LEN","TRIM","LOWER","LEFT","RIGHT","MID","FIND","SEARCH"],bn=new Set([...hn,...xn,...mn,...yn,...gn]),vn=/"(?:[^"]|"")*"/g,rt=new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(","g");function wn(e){const r=e.replace(vn,o=>" ".repeat(o.length));rt.lastIndex=0;let t;for(;(t=rt.exec(r))!==null;){const o=t[1].toUpperCase();if(!bn.has(o))throw new ue("NAME",`Function ${o} is not allowed.`)}}function Tn(e,r,t){let o=e;if(o==null)throw t.NA;if(typeof o=="object"&&!(o instanceof t)&&(o=r.retrieveRef(o)),o instanceof t)throw o;if(typeof o=="boolean")return o;if(typeof o=="number")return o!==0;throw t.VALUE}function Jt(e){return e!==null&&typeof e=="object"&&"value"in e?e.value:e}function Fe(e){const r=Jt(e);return Array.isArray(r)?r.flat(1/0):[r]}function J(e){const r=Jt(e);return Array.isArray(r)?r.flat(1/0)[0]:r}function Ne(e){return e===void 0?void 0:J(e)}function ce(e){return e==null||e===""?"":typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof Date?e.toLocaleDateString():String(e)}function jn(e,r){return e instanceof r?e:new r(e.message||"#ERROR!")}function se(e){return e.find(r=>r instanceof Error)}function En(e,r){const t=i=>{throw jn(i,r)},o=(i,{checkArgsForErrors:a=!0}={})=>(...c)=>{const u=c.flatMap(Fe);if(a){const f=se(u);f&&t(f)}const d=i(...u);return d instanceof Error?t(d):d},l=(i,{toText:a=!1}={})=>c=>{const u=J(c),d=se([u]);d&&t(d);const f=i(a?ce(u):u);return f instanceof Error?t(f):f};return{IF:(i,a,c,u)=>{const d=Tn(a,i,r);if(c==null)throw r.NA;return d?c:u??!1},MAX:o(e.MAX),MIN:o(e.MIN),MAXA:o(e.MAXA),MINA:o(e.MINA),MEDIAN:o(e.MEDIAN),COUNTA:o(e.COUNTA,{checkArgsForErrors:!1}),LARGE:(i,a)=>{const c=Fe(i),u=J(a),d=se([...c,u]);d&&t(d);const f=e.LARGE(c,u);return f instanceof Error?t(f):f},SMALL:(i,a)=>{const c=Fe(i),u=J(a),d=se([...c,u]);d&&t(d);const f=e.SMALL(c,u);return f instanceof Error?t(f):f},PERMUT:(i,a)=>{const c=[J(i),J(a)],u=se(c);u&&t(u);const d=e.PERMUT(c[0],c[1]);return d instanceof Error?t(d):d},PERMUTATIONA:(i,a)=>{const c=[J(i),J(a)],u=se(c);u&&t(u);const d=e.PERMUTATIONA(c[0],c[1]);return d instanceof Error?t(d):d},MATCH:(i,a)=>{const c=J(i),u=Fe(a),d=se([c,...u]);d&&t(d);const f=e.MATCH(c,u,0);return f instanceof Error?t(f):f},SWITCH:(...i)=>{const a=i.map(J),c=se(a);c&&t(c);const u=e.SWITCH(...a);return u instanceof Error?t(u):u},SUBSTITUTE:(i,a,c,u)=>{const d=[ce(J(i)),ce(J(a)),ce(J(c))];u!==void 0&&d.push(J(u));const f=se(d);f&&t(f);const m=e.SUBSTITUTE(...d);return m instanceof Error?t(m):m},TEXTJOIN:(i,a,...c)=>{const u=ce(J(i)),d=J(a),f=c.flatMap(Fe).map(ce),m=se([u,d]);m&&t(m);const x=e.TEXTJOIN(u,d,f);return x instanceof Error?t(x):x},UPPER:l(e.UPPER),YEAR:l(e.YEAR),MONTH:l(e.MONTH),DAY:l(e.DAY),WEEKDAY:(i,a)=>{const c=J(i),u=J(a),d=se([c]);d&&t(d);const f=e.WEEKDAY(c,u);return f instanceof Error?t(f):f},CONCATENATE:(...i)=>{const a=i.flatMap(Fe),c=se(a);c&&t(c);const u=e.CONCATENATE(...a.map(ce));return u instanceof Error?t(u):u},CONCAT:(...i)=>{const a=i.flatMap(Fe),c=se(a);c&&t(c);const u=e.CONCAT(...a.map(ce));return u instanceof Error?t(u):u},LEN:l(e.LEN,{toText:!0}),TRIM:l(e.TRIM,{toText:!0}),LOWER:l(e.LOWER,{toText:!0}),LEFT:(i,a)=>{const c=J(i),u=Ne(a),d=se([c]);d&&t(d);const f=e.LEFT(ce(c),u);return f instanceof Error?t(f):f},RIGHT:(i,a)=>{const c=J(i),u=Ne(a),d=se([c]);d&&t(d);const f=e.RIGHT(ce(c),u);return f instanceof Error?t(f):f},MID:(i,a,c)=>{const u=J(i),d=J(a),f=J(c),m=se([u,d,f]);m&&t(m);const x=e.MID(ce(u),d,f);return x instanceof Error?t(x):x},FIND:(i,a,c)=>{const u=J(i),d=J(a),f=Ne(c),m=se([u,d]);m&&t(m);const x=e.FIND(ce(u),ce(d),f);return x instanceof Error?t(x):x},SEARCH:(i,a,c)=>{const u=J(i),d=J(a),f=Ne(c),m=se([u,d]);m&&t(m);const x=e.SEARCH(ce(u),ce(d),f);return x instanceof Error?t(x):x}}}const Cn={"#REF!":"REF","#VALUE!":"VALUE","#DIV/0!":"DIV0","#NAME?":"NAME","#N/A":"NA","#NUM!":"NUM","#NULL!":"NULL"};function nt(e){return Cn[e.error]??"ERROR"}function ot(e,r){if(e instanceof ue)return e;if(e instanceof r){const t=e.details;return t instanceof ue?t:t instanceof r?new ue(nt(t),t.message):new ue(nt(e),e.message)}return new ue("ERROR",e instanceof Error?e.message:void 0)}function Rn(e){return Math.max(0,...e.map(r=>(r==null?void 0:r.length)??0))}function Sn(e){return r=>{const t=e[r.row-1];if(r.row<1||r.col<1||t==null||r.col-1>=t.length)throw new ue("REF");const o=t[r.col-1];return o==null||o===""?null:o}}function An(e){return r=>{const t=Math.min(r.from.row,r.to.row),o=Math.min(r.from.col,r.to.col),l=Math.max(r.from.row,r.to.row),i=Math.max(r.from.col,r.to.col),a=Rn(e);if(t>e.length||o>a)throw new ue("REF");const c=Math.min(l,e.length),u=[];for(let d=t;d<=c;d++){const f=e[d-1],m=[];if(f!=null){const x=Math.min(i,f.length);for(let p=o;p<=x;p++){const j=f[p-1];m.push(j==null||j===""?null:j)}}u.push(m)}return u}}function Fn(e){if(e==null||e==="")return null;if(typeof e=="number"||typeof e=="string"||typeof e=="boolean"||e instanceof Date)return e;throw new ue("VALUE")}async function Kt(e,r){if(typeof e!="string")throw new ue("ERROR");const t=e.trim();if(t==="")throw new ue("ERROR");const o=t.startsWith("=")?t.slice(1):t;wn(o);const[l,i]=await Promise.all([import("fast-formula-parser"),import("@formulajs/formulajs")]),a=l.default??l,c=a.FormulaError,u=new a({...r,functions:En(i,c)});let d;try{d=u.parse(o,{row:1,col:1,sheet:"Sheet1"})}catch(f){throw ot(f,c)}if(d instanceof c)throw ot(d,c);return Fn(d)}async function On(e,r){return Kt(r,{onCell:Sn(e),onRange:An(e)})}const st=-1;async function Yt(e,r){const t=Object.keys(e);return Kt(r,{onVariable:o=>{const l=t.indexOf(o);return l===-1?null:{row:st,col:l+1}},onCell:o=>{if(o.row===st)return e[t[o.col-1]]??null;throw new ue("REF")},onRange:()=>{throw new ue("REF")}})}const Gt={REF:"#REF!",VALUE:"#VALUE!",DIV0:"#DIV/0!",NAME:"#NAME?",ERROR:"#ERROR!",NA:"#N/A",NUM:"#NUM!",NULL:"#NULL!"};function Xe(e){const r=e instanceof ue?e.code:"ERROR";return Gt[r]}async function In(e,r){return e.length===0?r.map(t=>({id:typeof(t==null?void 0:t.id)=="string"?t.id:"(unknown)",label:(t==null?void 0:t.label)??"(unknown)",value:null,error:Gt.ERROR})):Promise.all(r.map(async t=>{try{if(!t||typeof t.label!="string"||typeof t.expression!="string"||typeof t.id!="string")throw new ue("ERROR");return{id:t.id,label:t.label,value:await On(e,t.expression)}}catch(o){return{id:typeof(t==null?void 0:t.id)=="string"?t.id:"(unknown)",label:(t==null?void 0:t.label)??"(unknown)",value:null,error:Xe(o)}}}))}function it(e){const r=new Set;for(const{id:t}of e){if(r.has(t))return t;r.add(t)}return null}function Zt(e){const{columnHeader:r,rowHeader:t,columns:o,rows:l}=e;if(o!==void 0&&!Array.isArray(o))return"columns must be an array of { id, label } objects.";if(l!==void 0&&!Array.isArray(l))return"rows must be an array of { id, label } objects.";if(o!==void 0&&o.length===0)return"columns is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";if(l!==void 0&&l.length===0)return"rows is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";const i=f=>!!f&&typeof f.id=="string"&&f.id!==""&&typeof f.label=="string"&&f.label!=="",a=o==null?void 0:o.findIndex(f=>!i(f));if(a!=null&&a!==-1)return`columns[${a}] must be a { id, label } object with non-empty string fields.`;const c=l==null?void 0:l.findIndex(f=>!i(f));if(c!=null&&c!==-1)return`rows[${c}] must be a { id, label } object with non-empty string fields.`;const u=!!o&&o.length>0,d=!!l&&l.length>0;if(u){const f=it(o);if(f)return`duplicate column id "${f}" — every declared column id must be unique.`}if(d){const f=it(l);if(f)return`duplicate row id "${f}" — every declared row id must be unique.`}return r&&t?"columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape.":u&&d?"columns and rows cannot both be declared — pick one orientation for the persisted sheet shape.":r&&!u?"columnHeader is true but columns is missing or empty — declare the column list columnHeader positions map to.":t&&!d?"rowHeader is true but rows is missing or empty — declare the row list rowHeader positions map to.":null}function lt(e,r={}){const t=Zt(r);if(t)throw new Error(`x-spreadsheet: ${t}`);const{columnHeader:o,rowHeader:l,columns:i,rows:a}=r;return i&&i.length>0?kn(e,i,o===!0):a&&a.length>0?Dn(e,a,l===!0):e}function kn(e,r,t){return(t?e.slice(1):e).map(l=>{const i=Object.create(null);return r.forEach((a,c)=>{i[a.id]=l[c]??null}),i})}function Dn(e,r,t){const o=t?1:0,l=Math.max(0,...e.map(a=>a.length)),i=Math.max(0,l-o);return Array.from({length:i},(a,c)=>{const u=o+c,d=Object.create(null);return r.forEach((f,m)=>{var x;d[f.id]=((x=e[m])==null?void 0:x[u])??null}),d})}function Qt(e){return!Array.isArray(e[0])}function Nn(e){const r=Object.create(null);for(const{id:t,label:o,value:l,error:i}of e)r[t]=i===void 0?{label:o,value:l}:{label:o,value:l,error:i};return r}function We(e,r){const t=o=>o instanceof Date?o.toISOString():o??null;return t(e)===t(r)}function Ln(e,r){const t=e??{},o=r??{},l=Object.keys(t);return l.length!==Object.keys(o).length?!1:l.every(i=>{if(!Object.prototype.hasOwnProperty.call(o,i))return!1;const a=t[i],c=o[i];return a.label===c.label&&a.error===c.error&&We(a.value,c.value)})}function Mn(e,r){if(e==null||r==null)return e===r;const t=Array.isArray(e);if(t!==Array.isArray(r))return!1;if(t){const a=e,c=r;return a.length===c.length&&a.every((u,d)=>We(u,c[d]))}const o=e,l=r,i=Object.keys(o);return i.length!==Object.keys(l).length?!1:i.every(a=>Object.prototype.hasOwnProperty.call(l,a)&&We(o[a],l[a]))}function zn(e,r){if(e===r)return!0;if(e==null||r==null)return!1;const t=e,o=r;return t.length!==o.length?!1:t.every((l,i)=>Mn(l,o[i]))}function Pn(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Date}function er(e,r){if(e.length===0)return[];const t=[],o=new Set;for(const i of r??[])o.has(i)||(o.add(i),t.push(i));for(const i of e)for(const a of Object.keys(i))o.has(a)||(o.add(a),t.push(a));if(t.length===0)return[];const l=e.map(i=>t.map(a=>{if(!Object.prototype.hasOwnProperty.call(i,a))return null;const c=i[a];return Pn(c)?c:null}));return[t,...l]}function Un(e){const r=Math.max(0,...e.map(t=>t.length));return Array.from({length:r},(t,o)=>e.map(l=>l[o]??null))}const $n=".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv",Bn=10*1024*1024,$e=200,_n=50,Wn=[];function at(e){return e==null||e===""?"":e instanceof Date?e.toLocaleDateString():String(e)}const Vn=({data:e,handleChange:r,path:t,label:o,required:l,schema:i,enabled:a,readonly:c,errors:u,visible:d=!0})=>{je(d,t,r);const f=be(t,l,d),m=!u||u.length===0,x=Xt(a,c),p=(i==null?void 0:i["x-spreadsheet"])??{},j=(i==null?void 0:i["x-evaluate"])??Wn,w=p.accept??$n,N=p.maxSize??Bn,I=p.columnHeader===!0,O=p.rowHeader===!0,C=p.columns,R=p.rows,v=Array.isArray(C)&&C.length>0,y=Array.isArray(R)&&R.length>0,z=Zt({columnHeader:I,rowHeader:O,columns:C,rows:R}),P=p.showSheet!==!1,F=p.sheetName,$=p.persistSheet!==!1,k=e??null,[ne,K]=g.useState(()=>k!=null&&k.sheet||Object.keys((k==null?void 0:k.derivations)??{}).length>0?"ready":"empty"),[L,U]=g.useState(null),[Q,de]=g.useState(!1),[oe,ee]=g.useState(null),[D,H]=g.useState(null),S=g.useRef(null),Y=g.useRef(null),fe=(k==null?void 0:k.sheet)??null,M=g.useCallback(A=>{if(!Qt(A))return A;const W=y?R:v?C:void 0,le=er(A,W==null?void 0:W.map(X=>X.id));return y?Un(le):le},[v,y,C,R]),G=g.useMemo(()=>oe??(fe?M(fe):null),[oe,fe,M]),ie=((D==null?void 0:D.matrix)===G?D.derivations:null)??(k==null?void 0:k.derivations)??{},xe=G!=null||k!=null,pe=g.useMemo(()=>{const A=v?1:0,W=y?1:0,le=G?G.slice(A):[],X=le.slice(0,$e),V=Math.min(_n,Math.max(0,...X.map(ge=>Math.max(0,ge.length-W)))),Ce=Array.from({length:V},(ge,T)=>T+W),Oe="",De=y&&!v;return n.jsx(n.Fragment,{children:G&&P&&n.jsxs(s.Box,{mt:"3",children:[n.jsx(s.Box,{style:{overflow:"auto",maxHeight:420},children:n.jsxs(s.Table.Root,{variant:"surface",size:"1",children:[!De&&n.jsx(s.Table.Header,{children:n.jsxs(s.Table.Row,{children:[n.jsx(s.Table.ColumnHeaderCell,{children:Oe}),Ce.map(ge=>{var T;return n.jsx(s.Table.ColumnHeaderCell,{children:v?((T=C==null?void 0:C[ge])==null?void 0:T.label)??"":pn(ge)},ge)})]})}),n.jsx(s.Table.Body,{children:X.map((ge,T)=>{var ae;const te=A+T;return n.jsxs(s.Table.Row,{children:[n.jsx(s.Table.RowHeaderCell,{style:y?{fontWeight:700,background:"var(--gray-a3)"}:void 0,children:y?((ae=R==null?void 0:R[te])==null?void 0:ae.label)??"":v?"":te+1}),Ce.map(ye=>n.jsx(s.Table.Cell,{children:at(ge[ye])},ye))]},T)})})]})}),le.length>$e&&n.jsxs(s.Text,{size:"1",color:"gray",mt:"1",style:{display:"block"},children:["Showing first ",$e," of ",le.length," rows"]})]})})},[G,P,v,y,C,R]),h=g.useCallback(async A=>{if(U(null),A.size>N){U(`File exceeds the ${we(N)} limit.`);return}if(!w.split(",").map(V=>V.trim()).some(V=>V==="*"||V==="*/*"?!0:V.endsWith("/*")?A.type.startsWith(V.slice(0,-1)):V.startsWith(".")?A.name.toLowerCase().endsWith(V.toLowerCase()):A.type===V)){U(`Invalid type. Accepted: ${Te(w)}`);return}K("parsing");let X;try{const V=await A.arrayBuffer();X=(await fn(V,F)).matrix}catch(V){K("error"),U(V instanceof _e?V.message:"This doesn't look like a valid spreadsheet. Please check the file and try again.");return}if(v||y)try{X=M(lt(X,{columnHeader:I,rowHeader:O,columns:C,rows:R}))}catch(V){K("error"),U(V instanceof Error?V.message:"Failed to process this sheet.");return}Y.current=(e==null?void 0:e.sheet)??null,ee(X),K("ready")},[w,N,F,e,I,O,C,R,v,y,M]);if(g.useEffect(()=>{oe!=null&&fe!=null&&fe!==Y.current&&ee(null)},[oe,fe]),g.useEffect(()=>{if(z||j.length===0&&!$)return;let A=!1;const W=X=>{x&&(Ln(k==null?void 0:k.derivations,X==null?void 0:X.derivations)&&zn(k==null?void 0:k.sheet,X==null?void 0:X.sheet)||(Y.current=(X==null?void 0:X.sheet)??null,r(t,X)))},le=G??[];if(le.length===0){k!=null&&W(void 0);return}return In(le,j).then(X=>{if(A)return;let V;if(oe!=null){if($)try{V=lt(le,{columnHeader:v,rowHeader:y,columns:C,rows:R})}catch(Oe){U(Oe instanceof Error?Oe.message:"Failed to process this sheet.");return}}else V=k==null?void 0:k.sheet;U(null);const Ce=Nn(X);H({matrix:le,derivations:Ce}),W(V===void 0?{derivations:Ce}:{sheet:V,derivations:Ce})}),()=>{A=!0}},[G,oe,j,x,$,v,y,C,R,z]),d===!1)return null;if(z)return n.jsxs(s.Box,{mb:"4",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",children:o}),n.jsxs(s.Text,{size:"2",color:"red",style:{display:"block"},children:["Invalid x-spreadsheet config: ",z]})]});if(!x&&!xe)return null;const E=A=>{A.preventDefault(),A.stopPropagation(),x&&de(A.type==="dragenter"||A.type==="dragover")},_=A=>{var W;A.preventDefault(),A.stopPropagation(),de(!1),x&&(W=A.dataTransfer.files)!=null&&W[0]&&h(A.dataTransfer.files[0])},Z=A=>{var W;(W=A.target.files)!=null&&W[0]&&(h(A.target.files[0]),A.target.value="")},q=()=>{x&&(ee(null),H(null),Y.current=null,U(null),K("empty"),r(t,void 0))},he=P&&G==null&&k!=null;return n.jsxs(s.Box,{mb:"4",children:[n.jsxs(s.Flex,{align:"center",justify:"between",mb:"2",children:[n.jsxs(s.Flex,{align:"center",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",children:[o,f&&n.jsx(s.Text,{color:"red",children:" *"})]}),xe&&x&&n.jsxs(n.Fragment,{children:[n.jsx(s.Tooltip,{content:"Replace spreadsheet",children:n.jsx(s.IconButton,{variant:"ghost",size:"1",onClick:()=>{var A;return(A=S.current)==null?void 0:A.click()},"aria-label":"Replace spreadsheet",children:n.jsx(re.UploadIcon,{})})}),n.jsx(s.Tooltip,{content:"Remove spreadsheet",children:n.jsx(s.IconButton,{variant:"ghost",size:"1",color:"gray",onClick:q,"aria-label":"Remove spreadsheet",children:n.jsx(re.Cross2Icon,{})})})]})]}),n.jsxs(s.Text,{size:"1",color:"gray",children:[we(N)," max · ",Te(w)]})]}),xe&&L&&n.jsx(s.Text,{size:"2",color:"red",mb:"2",style:{display:"block"},children:L}),n.jsx("input",{ref:S,type:"file",style:{display:"none"},accept:w,onChange:Z}),x&&!xe&&n.jsx("div",{role:"button",tabIndex:0,onClick:()=>{var A;return(A=S.current)==null?void 0:A.click()},onKeyDown:A=>{var W;(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),(W=S.current)==null||W.click())},onDragEnter:E,onDragLeave:E,onDragOver:E,onDrop:_,style:{cursor:"pointer"},className:["border-2 border-dashed rounded-lg p-6 text-center","transition-all duration-200 ease-in-out",Q?"border-blue-500 bg-blue-50":L?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:n.jsx(s.Flex,{direction:"column",align:"center",gap:"2",children:ne==="parsing"?n.jsxs(n.Fragment,{children:[n.jsx(s.Spinner,{size:"3"}),n.jsx(s.Text,{size:"2",color:"gray",children:"Parsing spreadsheet…"})]}):L?n.jsxs(n.Fragment,{children:[n.jsx(re.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),n.jsx(s.Text,{size:"2",color:"red",weight:"medium",children:L}),n.jsx(s.Text,{size:"1",color:"gray",children:"Click to try again"})]}):n.jsxs(n.Fragment,{children:[n.jsx(re.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),n.jsx(s.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),n.jsxs(s.Text,{size:"1",color:"gray",children:[we(N)," max · ",Te(w)]})]})})}),pe,he&&n.jsx(s.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(ie).length>0&&n.jsxs(s.Box,{mt:"3",children:[n.jsx(s.Text,{size:"2",weight:"bold",as:"div",mb:"1",children:"Computed values"}),n.jsx(s.Flex,{direction:"column",gap:"1",children:Object.entries(ie).map(([A,W])=>n.jsxs(s.Flex,{justify:"between",children:[n.jsx(s.Text,{size:"2",children:W.label}),W.error?n.jsx(s.Text,{size:"2",color:"red",children:W.error}):n.jsx(s.Text,{size:"2",children:at(W.value)})]},A))})]}),!m&&n.jsx(s.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:ve(u,o)})]})},tr=B.withJsonFormsControlProps(Vn),rr=b.rankWith(10,b.schemaMatches(e=>e.type==="object"&&typeof e["x-spreadsheet"]=="object")),Hn="Sheet1",qn="xlsx";function Xn(e){if(e===void 0)return null;if(!Array.isArray(e))return"columns must be an array of { id, label } objects.";if(e.length===0)return"columns is declared but empty — declare at least one field, or omit it entirely.";const r=e.findIndex(t=>!t||typeof t!="object"||typeof t.id!="string"||t.id===""||typeof t.label!="string"||t.label==="");return r!==-1?`columns[${r}] must be a { id, label } object with non-empty string fields.`:null}function Jn(e,r){if(!Qt(e))return e;const t=er(e,r==null?void 0:r.map(a=>a.id));if(!r||t.length===0)return t;const o=new Map(r.map(a=>[a.id,a.label])),[l,...i]=t;return[l.map(a=>o.get(String(a))??a),...i]}const Kn=({data:e,path:r,label:t,schema:o,visible:l=!0})=>{const[i,a]=g.useState(null),c=B.useJsonForms();if(l===!1)return null;const u=(o==null?void 0:o["x-spreadsheet-export"])??{},d=u.columns,f=u.sheetName??Hn,m=u.fileType??qn,x=u.fileName??`export.${m}`,p=Xn(d);if(p)return n.jsxs(s.Box,{mb:"4",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",children:t}),n.jsxs(s.Text,{size:"2",color:"red",style:{display:"block"},children:["Invalid x-spreadsheet-export config: ",p]})]});const j=Array.isArray(e)&&e.length>0,w=async()=>{var N,I;if(j){a(null);try{const O=await import("@e965/xlsx"),C=Jn(e,d),R=O.utils.aoa_to_sheet(C),v=O.utils.book_new();O.utils.book_append_sheet(v,R,f);const y=r.split(".").slice(0,-1).join("."),z=y?b.Resolve.data((N=c.core)==null?void 0:N.data,y):(I=c.core)==null?void 0:I.data;O.writeFile(v,qe(x,z,`export.${m}`),{bookType:m})}catch(O){a(O instanceof Error?O.message:"Failed to build the workbook.")}}};return n.jsxs(s.Box,{mb:"4",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",style:{display:"block",marginBottom:"var(--space-2)"},children:t}),n.jsxs(s.Button,{type:"button",variant:"soft",disabled:!j,onClick:()=>void w(),children:[n.jsx(re.DownloadIcon,{})," Download Spreadsheet"]}),i&&n.jsx(s.Text,{size:"2",color:"red",style:{display:"block",marginTop:"var(--space-2)"},children:i})]})},nr=B.withJsonFormsControlProps(Kn),or=b.rankWith(10,b.and(b.schemaMatches(e=>{const r=e["x-spreadsheet-export"];return e.type==="array"&&typeof r=="object"&&r!==null}),b.not(b.optionIs("editable",!0))));class Re extends Error{}const ct=5e6,Yn=1024,Gn=/^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["']/i,Zn={ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",parseTagValue:!0,parseAttributeValue:!0,numberParseOptions:{hex:!1,leadingZeros:!1,eNotation:!0},trimValues:!0,cdataPropName:!1,commentPropName:!1,processEntities:!0,htmlEntities:!0,ignoreDeclaration:!0,ignorePiTags:!0,alwaysCreateTextNode:!1,preserveOrder:!1,removeNSPrefix:!1,maxNestedTags:100,strictReservedNames:!0};function Qn(e){const r=new Set(e);return r.size===0?()=>!1:(t,o)=>r.has(typeof o=="string"?o:o.toString())||r.has(t)}function eo(e){const r=e instanceof Error?e.message:"";return r.startsWith("[SECURITY] Invalid name:")?"This document uses a reserved JavaScript name (__proto__, constructor or prototype) as an element or attribute name, which cannot be represented safely.":r==="External entities are not supported"||r==="Parameter entities are not supported"?`${r}. Please remove the DOCTYPE entity declarations and try again.`:r.startsWith("Maximum nested tags exceeded")?"This document is nested too deeply to parse.":r.startsWith("Entity count")||r.includes("exceeds maximum allowed")?"This document declares too many or too large entity definitions to expand safely.":"This doesn't look like a valid XML document. Please check the file and try again."}async function to(e,r={}){var d;if(typeof e!="string")throw new Re("This file could not be read as text.");const t=e.charCodeAt(0)===65279?e.slice(1):e;if(t.trim()==="")throw new Re("This file is empty.");if(t.length>ct)throw new Re(`This document is too large to parse (over ${ct/1e6} million characters).`);const o=(d=Gn.exec(t.slice(0,Yn)))==null?void 0:d[1];if(o&&!/^utf-?8$/i.test(o))throw new Re(`This document declares the unsupported encoding "${o}". Only UTF-8 is supported.`);const{XMLParser:l,XMLValidator:i}=await import("fast-xml-parser"),a=i.validate(t,{allowBooleanAttributes:!1});if(a!==!0){const{msg:f,line:m,col:x}=a.err;throw new Re(`Invalid XML at line ${m}, column ${x}: ${f}`)}const c=new l({...Zn,removeNSPrefix:r.removeNamespaces===!0,isArray:Qn(r.arrayPaths??[])});let u;try{u=c.parse(t)}catch(f){throw new Re(eo(f))}if(u==null||typeof u!="object"||Array.isArray(u))throw new Re("This document has no root element.");return u}function sr(e,r,t){const{path:o,default:l}=typeof t=="string"?{path:t,default:void 0}:t,i=b.Resolve.data(e,r?`${r}.${o}`:o);return i??l}function ro(e,r,t){const o={};for(const[l,i]of Object.entries(t)){const a=sr(e,r,i);if(a===void 0)return;o[l]=a}return o}async function no(e,r){try{return{status:"ok",value:await Yt(e,r)}}catch(t){return{status:"error",error:Xe(t)}}}function ir(e,r){return e==null?"":typeof e=="number"?e.toFixed(oo(r)):e instanceof Date?e.toLocaleDateString():String(e)}function oo(e){return Number.isFinite(e)?Math.min(100,Math.max(0,Math.trunc(e))):0}const Se={found:!1},me=e=>({found:!0,value:e});function ut(e){return e==null||e===""?Se:Array.isArray(e)||e instanceof Date?me(e):typeof e=="object"?Se:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?me(e):Se}const so=new Set(["true","1","yes","y"]),io=new Set(["false","0","no","n"]),lo=/^(\d{4}-\d{2}-\d{2})(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})?)?$/;async function ao(e,r,t){switch(r.as){case void 0:return me(e);case"string":return me(e instanceof Date?e.toISOString():String(e));case"number":{const o=e instanceof Date?e.getTime():Number(e);return Number.isFinite(o)?me(r.decimals===void 0?o:ir(o,r.decimals)):Se}case"boolean":{const o=String(e).trim().toLowerCase();return so.has(o)?me(!0):io.has(o)?me(!1):Se}case"date":{const{default:o}=await import("dayjs"),{default:l}=await Promise.resolve().then(()=>require("./customParseFormat-CLvZwox5.cjs")).then(c=>c.customParseFormat);if(o.extend(l),t==="export"){const c=typeof e=="string"?lo.exec(e):null,u=e instanceof Date?o(e):c?o(c[1],"YYYY-MM-DD",!0):null;return u!=null&&u.isValid()?me(u.format(r.format??"YYYY-MM-DD")):Se}const i=e instanceof Date?e.toISOString():String(e),a=r.format?o(i,r.format,!0):o(i);return a.isValid()?me(a.format("YYYY-MM-DD")):Se}}}async function co(e,r){if(r.formula!==void 0){const t={};for(const[o,l]of Object.entries(r.inputs??{})){const i=ut(b.Resolve.data(e,l));if(!i.found||Array.isArray(i.value))return Se;t[o]=i.value}try{return me(await Yt(t,r.formula))}catch(o){throw new Error(`writeTo "${r.to}": ${Xe(o)}`)}}if(r.from===void 0)throw new Error(`writeTo "${r.to}" needs either "from" or "formula".`);return ut(b.Resolve.data(e,r.from))}const Le="@_",lr="#text",Me=e=>e.split(".").filter(Boolean),ar=e=>e.startsWith(Le)||e===lr;function cr(e,r){if(typeof e.to!="string"||Me(e.to).length===0)return'"to" must be a non-empty path.';if(e.format!==void 0&&e.as!=="date")return'"format" needs "as": "date".';if(e.decimals!==void 0){if(r==="import")return'"decimals" only applies on export — on import it would put text in a number field.';if(e.as!=="number")return'"decimals" needs "as": "number".';const{decimals:t}=e;if(!Number.isInteger(t)||t<0||t>100)return'"decimals" must be a whole number from 0 to 100.'}if(r==="export"){const t=Me(e.to);for(const[o,l]of t.entries()){if(l===Le)return'"@_" needs an attribute name after it, e.g. "@_id".';if(ar(l)&&o<t.length-1)return`"${l}" must be the last segment — it belongs to the element before it.`}}return null}function dt(e,r,t){const o=t?` To give "${r}" both text and attributes, write its text to "${r}.${lr}".`:"";return new Error(`writeTo "${e}": "${r}" is written both as a value and as the parent of other values.${o}`)}function ur(e){const r={},t=new Set([r]);for(const{to:o,value:l}of e){const i=Me(o);if(i.length===0)continue;let a=r;for(const[d,f]of i.slice(0,-1).entries()){const m=a[f];if(m===void 0){const x={};t.add(x),a[f]=x,a=x}else if(t.has(m))a=m;else throw dt(o,i.slice(0,d+1).join("."),i[d+1].startsWith(Le))}const c=i[i.length-1],u=a[c];if(t.has(u)){const d=Object.keys(u).some(f=>f.startsWith(Le));throw dt(o,i.join("."),d)}a[c]=l}return r}const uo=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean";async function Je(e,r,t){const o=[];for(const l of r){const i=cr(l,t);if(i)throw new Error(`writeTo "${l.to}": ${i}`);const a=Me(l.to),c=t==="export"&&ar(a[a.length-1]),u=m=>{if(!(c&&m==null)){if(c&&!uo(m)){const x=m instanceof Date?' Add "as": "date" to write a date.':"";throw new Error(`writeTo "${l.to}": an attribute or #text value must be text, a number or a boolean.${x}`)}o.push({to:l.to,value:m})}};let d=await co(e,l);const f=d.found&&Array.isArray(d.value);if(d.found&&f&&l.writeTo){const m=await Promise.all(d.value.map(async x=>ur(await Je(x,l.writeTo,t))));u(m);continue}if(d.found&&!f&&l.writeTo)throw new Error(`writeTo "${l.to}": "writeTo" is set, but "from" did not resolve to a repeating element.`);if(d.found&&!f&&l.map){const m=d.value instanceof Date?d.value.toISOString():String(d.value);Object.prototype.hasOwnProperty.call(l.map,m)&&(d=me(l.map[m]))}if(d.found&&!f&&(d=await ao(d.value,l,t)),!d.found){if(l.default===void 0)continue;u(l.default);continue}u(d.value)}return o}const fo=".xml,text/xml,application/xml",po=5*1024*1024,ho=({data:e,handleChange:r,path:t,label:o,required:l,schema:i,enabled:a,readonly:c,errors:u,visible:d=!0})=>{je(d,t,r);const f=be(t,l,d),m=!u||u.length===0,x=Xt(a,c),p=(i==null?void 0:i["x-xml"])??{},j=p.accept??fo,w=p.maxSize??po,N=p.arrayPaths,I=p.removeNamespaces===!0,O=p.writeTo,C=p.writeBase??"root",R=p.persistDocument!==!1,v=B.useJsonForms(),y=e??null,[z,P]=g.useState(()=>y?"ready":"empty"),[F,$]=g.useState(null),[k,ne]=g.useState(!1),K=g.useRef(null),L=g.useRef(0),U=y!=null,Q=O!==void 0&&O.length>0,de=g.useCallback(async S=>{var pe;const Y=++L.current;if($(null),S.size>w){$(`File exceeds the ${we(w)} limit.`);return}if(!j.split(",").map(h=>h.trim()).some(h=>h==="*"||h==="*/*"?!0:h.endsWith("/*")?S.type.startsWith(h.slice(0,-1)):h.startsWith(".")?S.name.toLowerCase().endsWith(h.toLowerCase()):S.type===h)){$(`Invalid type. Accepted: ${Te(j)}`);return}P("parsing");let G;try{const h=await S.text();G=await to(h,{arrayPaths:N,removeNamespaces:I})}catch(h){if(Y!==L.current)return;P("error"),$(h instanceof Re?h.message:"This doesn't look like a valid XML document. Please check the file and try again.");return}let ie=[];if(O&&O.length>0)try{ie=await Je(G,O,"import")}catch(h){if(Y!==L.current)return;P("error"),$(h instanceof Error?h.message:"This document could not be mapped onto the form.");return}if(Y!==L.current)return;R&&r(t,G);const xe=C==="parent"?t.split(".").slice(0,-1).join("."):"";for(const h of ie)(pe=v.dispatch)==null||pe.call(v,b.update(xe?`${xe}.${h.to}`:h.to,()=>h.value));P("ready")},[j,w,N,I,O,C,R,t,r,v]);if(d===!1||!x&&!U)return null;const oe=S=>{S.preventDefault(),S.stopPropagation(),x&&ne(S.type==="dragenter"||S.type==="dragover")},ee=S=>{var Y;S.preventDefault(),S.stopPropagation(),ne(!1),x&&(Y=S.dataTransfer.files)!=null&&Y[0]&&de(S.dataTransfer.files[0])},D=S=>{var Y;(Y=S.target.files)!=null&&Y[0]&&(de(S.target.files[0]),S.target.value="")},H=()=>{x&&(++L.current,$(null),P("empty"),r(t,void 0))};return n.jsxs(s.Box,{mb:"4",children:[n.jsxs(s.Flex,{align:"center",justify:"between",mb:"2",children:[n.jsxs(s.Flex,{align:"center",gap:"1",children:[n.jsxs(s.Text,{as:"label",size:"2",weight:"bold",children:[o,f&&n.jsx(s.Text,{color:"red",children:" *"})]}),!Q&&U&&x&&n.jsxs(n.Fragment,{children:[n.jsx(s.Tooltip,{content:"Replace document",children:n.jsx(s.IconButton,{variant:"ghost",size:"1",onClick:()=>{var S;return(S=K.current)==null?void 0:S.click()},"aria-label":"Replace document",children:n.jsx(re.UploadIcon,{})})}),n.jsx(s.Tooltip,{content:"Remove document",children:n.jsx(s.IconButton,{variant:"ghost",size:"1",color:"gray",onClick:H,"aria-label":"Remove document",children:n.jsx(re.Cross2Icon,{})})})]})]}),n.jsxs(s.Flex,{align:"center",gap:"2",children:[n.jsxs(s.Text,{size:"1",color:"gray",children:[we(w)," max · ",Te(j)]}),Q&&x&&n.jsxs(s.Button,{size:"1",variant:"soft",onClick:()=>{var S;return(S=K.current)==null?void 0:S.click()},disabled:z==="parsing",children:[z==="parsing"?n.jsx(s.Spinner,{size:"1"}):n.jsx(re.UploadIcon,{}),"Upload"]})]})]}),(Q||U)&&F&&n.jsx(s.Text,{size:"2",color:"red",mb:"2",style:{display:"block"},children:F}),n.jsx("input",{ref:K,type:"file",style:{display:"none"},accept:j,onChange:D}),!Q&&x&&!U&&n.jsx("div",{role:"button",tabIndex:0,onClick:()=>{var S;return(S=K.current)==null?void 0:S.click()},onKeyDown:S=>{var Y;(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),(Y=K.current)==null||Y.click())},onDragEnter:oe,onDragLeave:oe,onDragOver:oe,onDrop:ee,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":F?"border-red-300 bg-red-50":"border-gray-300 hover:border-blue-400 hover:bg-gray-50"].join(" "),children:n.jsx(s.Flex,{direction:"column",align:"center",gap:"2",children:z==="parsing"?n.jsxs(n.Fragment,{children:[n.jsx(s.Spinner,{size:"3"}),n.jsx(s.Text,{size:"2",color:"gray",children:"Parsing document…"})]}):F?n.jsxs(n.Fragment,{children:[n.jsx(re.ExclamationTriangleIcon,{style:{width:32,height:32,color:"var(--red-9)"}}),n.jsx(s.Text,{size:"2",color:"red",weight:"medium",children:F}),n.jsx(s.Text,{size:"1",color:"gray",children:"Click to try again"})]}):n.jsxs(n.Fragment,{children:[n.jsx(re.UploadIcon,{style:{width:32,height:32,color:"var(--gray-8)"}}),n.jsx(s.Text,{size:"2",weight:"medium",children:"Click to upload or drag and drop"}),n.jsxs(s.Text,{size:"1",color:"gray",children:[we(w)," max · ",Te(j)]})]})})}),!m&&n.jsx(s.Text,{color:"red",size:"1",mt:"2",style:{display:"block"},children:ve(u,o)})]})},dr=B.withJsonFormsControlProps(ho),fr=b.rankWith(10,b.schemaMatches(e=>{const r=e["x-xml"];return e.type==="object"&&typeof r=="object"&&r!==null})),xo="root",ft="export.xml",mo={format:!0,indentBy:" ",ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",suppressBooleanAttributes:!1,processEntities:!0};function go(e){if(e===null||typeof e!="object"||Array.isArray(e))return'declaration must be an object, e.g. { "standalone": "no" }, or {} for the defaults.';const{version:r,encoding:t,standalone:o,...l}=e,[i]=Object.keys(l);return i?`declaration has an unknown key "${i}" — only version, encoding and standalone.`:r!==void 0&&r!=="1.0"&&r!=="1.1"?'declaration.version must be "1.0" or "1.1".':t!==void 0&&t!=="UTF-8"?'declaration.encoding can only be "UTF-8" — the file is always written as UTF-8.':o!==void 0&&o!=="yes"&&o!=="no"?'declaration.standalone must be "yes" or "no".':null}function pr(e){for(const r of e){if(r===null||typeof r!="object"||Array.isArray(r))return"every writeTo entry must be an object.";const{to:t,writeTo:o}=r,l=cr(r,"export");if(l)return`writeTo "${t}": ${l}`;if(o!==void 0){if(!Array.isArray(o))return`writeTo "${t}": its nested writeTo must be an array.`;const i=pr(o);if(i)return i}}return null}function yo({writeTo:e,declaration:r}){return e===void 0?"writeTo is required — see docs/xml-export-control.md.":Array.isArray(e)?e.length===0?"writeTo is declared but empty — declare at least one entry.":pr(e)??(r===void 0?null:go(r)):"writeTo must be an array of { from | formula, to } entries."}function bo({version:e="1.0",standalone:r}){return{"@_version":e,"@_encoding":"UTF-8",...r&&{"@_standalone":r}}}function vo(e){return e==null?!0:Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1}const wo=({path:e,label:r,schema:t,visible:o=!0})=>{var O,C;const l=(t==null?void 0:t["x-xml-export"])??{},i=l.rootElement??xo,a=l.fileName??ft,c=l.writeTo,u=l.writeBase??"root",d=l.declaration,f=yo(l),m=B.useJsonForms(),x=u==="parent"?e.split(".").slice(0,-1).join("."):"",p=x?b.Resolve.data((O=m.core)==null?void 0:O.data,x):(C=m.core)==null?void 0:C.data,[j,w]=g.useState(null),N=vo(p),I=g.useCallback(async()=>{if(c){w(null);try{const R=ur(await Je(p,c,"export")),{XMLBuilder:v}=await import("fast-xml-parser"),y={...d&&{"?xml":bo(d)},[i]:R},z=new v(mo).build(y);nn(z,qe(a,p,ft),"application/xml")}catch(R){w(R instanceof Error?R.message:"This export could not be built.")}}},[c,p,d,i,a]);return o===!1?null:f?n.jsxs(s.Box,{mb:"4",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",children:r}),n.jsxs(s.Text,{size:"2",color:"red",style:{display:"block"},children:["Invalid x-xml-export config: ",f]})]}):n.jsxs(s.Box,{mb:"4",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",style:{display:"block",marginBottom:"var(--space-2)"},children:r}),n.jsxs(s.Button,{size:"1",variant:"soft",disabled:N,onClick:()=>void I(),children:[n.jsx(re.DownloadIcon,{}),"Download XML"]}),j&&n.jsx(s.Text,{size:"2",color:"red",style:{display:"block",marginTop:"var(--space-2)"},children:j})]})},hr=B.withJsonFormsControlProps(wo),xr=b.rankWith(10,b.schemaMatches(e=>{const r=e["x-xml-export"];return e.type==="object"&&typeof r=="object"&&r!==null})),To="{value}",jo=2,Eo={},Co=({data:e,handleChange:r,path:t,label:o,schema:l,visible:i=!0})=>{var y;je(i,t,r);const a=l==null?void 0:l["x-computed"],c=(a==null?void 0:a.inputs)??Eo,u=(a==null?void 0:a.formula)??"",d=(a==null?void 0:a.format)??To,f=(a==null?void 0:a.decimals)??jo,m=B.useJsonForms(),x=t.split(".").slice(0,-1).join("."),p=ro((y=m.core)==null?void 0:y.data,x,c),j=p?JSON.stringify(p):null,w=m.readonly===!0,[N,I]=g.useState(()=>typeof e=="number"?"ok":"unavailable"),[O,C]=g.useState(()=>typeof e=="number"?e:null),[R,v]=g.useState(null);return g.useEffect(()=>{if(!i)return;let z=!1;const P=F=>{w||F!==e&&r(t,F)};if(p===void 0){I("unavailable"),v(null),C(null),P(void 0);return}return I(F=>F==="ok"?F:"loading"),no(p,u).then(F=>{if(z)return;const $=F.status==="ok"&&typeof F.value=="number"&&Number.isFinite(F.value)?F.value:null;if($===null){I("error"),v(F.status==="error"?F.error??"Unable to compute value.":"Computed value must be a number."),C(null),P(void 0);return}I("ok"),v(null),C($),P($)}),()=>{z=!0}},[j,u,i,w]),i===!1?null:n.jsx(s.Box,{mb:"4",children:n.jsxs(s.Flex,{direction:"column",gap:"1",children:[n.jsx(s.Text,{as:"label",size:"2",weight:"bold",children:o}),N==="unavailable"?n.jsx(s.Text,{size:"2",color:"gray",children:"Not yet available."}):N==="loading"?n.jsxs(s.Flex,{align:"center",gap:"2",children:[n.jsx(s.Spinner,{size:"1"}),n.jsx(s.Text,{size:"2",color:"gray",children:"Computing…"})]}):N==="error"?n.jsx(s.Text,{size:"2",color:"red",children:R}):n.jsx(s.Text,{size:"2",children:ze(d,{value:ir(O,f)})}),l.description&&n.jsx(s.Text,{size:"1",color:"gray",children:l.description})]})})},mr=B.withJsonFormsControlProps(Co),gr=b.rankWith(5,b.schemaMatches(e=>{const r=e["x-computed"];return e.type==="number"&&typeof r=="object"&&r!==null})),yr="seq",pt=2,Ro=e=>e==null||e==="",br=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,So=e=>{const r=e==null?void 0:e["x-template"];if(typeof r!="object"||r===null)return;const{template:t,inputs:o}=r;if(!(typeof t!="string"||t===""))return{template:t,inputs:o}},Ke=e=>typeof e=="object"&&e.name===yr&&e.arg!==void 0,Ao=e=>e.every((r,t)=>!Ke(r)||typeof e[t-1]!="object"&&typeof e[t+1]!="object"),Fo=e=>{const r=new Set;for(const t of He(e))typeof t=="object"&&t.arg===void 0&&r.add(t.name);return[...r]},Oo=e=>{const r=[];for(const[t,o]of Object.entries((e==null?void 0:e.properties)??{})){const l=So(o);l&&r.push([t,l])}return r},Io=(e,r,t)=>{var l;const o={};for(const i of Fo(t.template)){const a=sr(e,r,((l=t.inputs)==null?void 0:l[i])??i);o[i]=typeof a=="string"||typeof a=="number"||typeof a=="boolean"?String(a):""}return o},ko=e=>r=>{const t=r.trim()===""?pt:Number(r);return`${e}`.padStart(Number.isInteger(t)&&t>=0?t:pt,"0")},Do=e=>{const r=o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");let t="";for(const o of He(e))typeof o=="string"?t+=r(o):t+=Ke(o)?"(\\d+)":".*?";return new RegExp(`^${t}$`)},No=(e,r,t)=>{var i,a;const o=Do(t.template);let l=0;for(const c of e){const u=(i=br(c))==null?void 0:i[r];if(typeof u!="string")continue;const d=Number((a=o.exec(u))==null?void 0:a[1]);Number.isFinite(d)&&d>l&&(l=d)}return l},Lo=(e,r,t,o,l,i)=>{const a=Oo(e);if(a.length===0)return r;const c=br(r);if(!c)return r;const u={...c};for(const[d,f]of a){if(!Ro(u[d]))continue;const m=He(f.template),x={};if(m.some(Ke)){if(!Ao(m)){console.warn(`x-template: {seq(…)} needs literal text between it and other placeholders; not numbering "${f.template}"`);continue}const p=Math.max(i[d]??0,No(t,d,f))+1;i[d]=p,x[yr]=ko(p)}u[d]=ze(f.template,Io(o,l,f),x)}return u},Mo=({path:e,items:r,itemsSchema:t,rootSchema:o,addItem:l,sequences:i})=>{const a=B.useJsonForms(),c=()=>{var d;const u=Lo(t,b.createDefaultValue(t,o),r,(d=a.core)==null?void 0:d.data,e.split(".").slice(0,-1).join("."),i.current);l&&l(e,u)()};return n.jsx(s.Box,{mt:"2",children:n.jsxs(s.Button,{type:"button",variant:"surface",onClick:c,children:[n.jsx(re.PlusIcon,{}),"Add Item"]})})},zo=({data:e,path:r,schema:t,uischema:o,enabled:l,visible:i,addItem:a,removeItems:c,rootSchema:u,arraySchema:d,required:f=!1,errors:m=""})=>{const x=g.useRef({}),p=be(r,f,i),j=d?t:t.items,w=d||t;if(i===!1||!j||typeof j!="object"||Array.isArray(j))return null;const N=j,I=Array.isArray(e)?e:[],O=w.title||"Array Items",C=o.options??{},R=l&&C.addable!==!1,v=l&&C.removable!==!1,y=C.itemLabel||"Item",z=p||typeof w.minItems=="number"&&w.minItems>=1,P=!m,F=P?"":I.length===0&&C.errorMessage||ve(m,O),$=k=>{if(c){const ne=c(r,[k]);ne&&ne()}};return n.jsx(s.Box,{mb:"6",children:n.jsxs(s.Flex,{direction:"column",gap:"4",children:[n.jsxs(s.Text,{as:"div",size:"4",weight:"bold",children:[O," ",z&&n.jsx(s.Text,{color:"red",children:"*"})]}),I.length===0&&n.jsx(s.Box,{py:"4",px:"4",style:{backgroundColor:"var(--gray-3)",borderRadius:"var(--radius-3)"},children:n.jsx(s.Text,{size:"2",color:"gray",children:"No items have been added yet."})}),!P&&n.jsx(s.Text,{color:"red",size:"1",children:F}),I.map((k,ne)=>{var L;const K=`${r}.${ne}`;return n.jsx(s.Card,{size:"3",variant:"surface",children:n.jsxs(s.Flex,{direction:"column",gap:"4",children:[n.jsxs(s.Flex,{justify:"between",align:"center",children:[n.jsxs(s.Text,{size:"3",weight:"bold",children:[y," ",ne+1]}),v&&n.jsxs(s.Button,{type:"button",color:"red",variant:"soft",onClick:()=>$(ne),title:"Remove item",children:[n.jsx(re.TrashIcon,{}),"Remove"]})]}),n.jsx(s.Box,{children:n.jsx(B.JsonFormsDispatch,{schema:N,uischema:((L=o.options)==null?void 0:L.detail)||(N.type==="object"||N.properties?{type:"VerticalLayout",elements:Object.keys(N.properties||{}).map(U=>({type:"Control",scope:`#/properties/${U}`}))}:{type:"Control",scope:"#"}),path:K,enabled:l,renderers:void 0,cells:void 0})})]})},K)}),R&&n.jsx(Mo,{path:r,items:I,itemsSchema:N,rootSchema:u,addItem:a,sequences:x})]})})},Ve=B.withJsonFormsArrayControlProps(zo),vr=b.rankWith(3,b.isObjectArrayControl),wr=({uischema:e,visible:r})=>{const t=e;return r===!1?null:n.jsx(s.Box,{mb:"4",children:n.jsx(s.Heading,{size:"4",children:t.text})})},Tr=b.rankWith(1,b.uiTypeIs("Label")),Po=b.rankWith(3,b.isPrimitiveArrayControl),Uo=[{tester:vt,renderer:Ur},{tester:Tt,renderer:Br},{tester:Et,renderer:_r},{tester:Rt,renderer:Wr},{tester:kt,renderer:It},{tester:At,renderer:Ze},{tester:Ft,renderer:Ze},{tester:Nt,renderer:en},{tester:Mt,renderer:B.withJsonFormsLayoutProps(Lt)},{tester:Pt,renderer:B.withJsonFormsLayoutProps(zt)},{tester:$t,renderer:B.withJsonFormsLayoutProps(Ut)},{tester:_t,renderer:B.withJsonFormsLayoutProps(Bt)},{tester:qt,renderer:Ht},{tester:rr,renderer:tr},{tester:or,renderer:nr},{tester:fr,renderer:dr},{tester:xr,renderer:hr},{tester:gr,renderer:mr},{tester:vr,renderer:Ve},{tester:Po,renderer:Ve},{tester:Tr,renderer:wr}];exports.ArrayControl=Ve;exports.ArrayControlTester=vr;exports.BooleanControl=jt;exports.BooleanControlTester=Et;exports.CategorizationLayoutRenderer=Bt;exports.CategorizationLayoutTester=_t;exports.ComputedControl=mr;exports.ComputedControlTester=gr;exports.DateControl=Dt;exports.DateControlTester=Nt;exports.FileControl=Ht;exports.FileControlTester=qt;exports.GroupLayoutRenderer=Ut;exports.GroupLayoutTester=$t;exports.HorizontalLayoutRenderer=zt;exports.HorizontalLayoutTester=Pt;exports.LabelRenderer=wr;exports.LabelTester=Tr;exports.NumberControl=wt;exports.NumberControlTester=Tt;exports.RadioControl=Ct;exports.RadioControlTester=Rt;exports.SearchSelectControl=It;exports.SearchSelectControlTester=kt;exports.SearchServiceProvider=Ir;exports.SelectControl=St;exports.SelectControlTester=At;exports.SelectObjectControlTester=Ft;exports.SpreadsheetControl=tr;exports.SpreadsheetControlTester=rr;exports.SpreadsheetExportControl=nr;exports.SpreadsheetExportControlTester=or;exports.TextControl=bt;exports.TextControlTester=vt;exports.UploadProvider=Or;exports.VerticalLayoutRenderer=Lt;exports.VerticalLayoutTester=Mt;exports.XmlControl=dr;exports.XmlControlTester=fr;exports.XmlExportControl=hr;exports.XmlExportControlTester=xr;exports.radixRenderers=Uo;exports.useSearchService=yt;exports.useUpload=mt;
|