extended-dynamic-forms 0.3.2 → 0.3.4

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.umd.js CHANGED
@@ -79,7 +79,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
79
79
  }
80
80
  `,t8=function(t){var r=B.useContext(x_),n=r.csp,i=r.prefixCls,a=r.layer,s=e8;i&&(s=s.replace(/anticon/g,i)),a&&(s="@layer ".concat(a,` {
81
81
  `).concat(s,`
82
- }`)),B.useEffect(function(){var l=t.current,u=HR(l);RR(s,"@ant-design-icons",{prepend:!a,csp:n,attachTo:u})},[])},r8=["icon","className","onClick","style","primaryColor","secondaryColor"],Po={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};function n8(e){var t=e.primaryColor,r=e.secondaryColor;Po.primaryColor=t,Po.secondaryColor=r||e1(t),Po.calculated=!!r}function i8(){return rn({},Po)}var va=function(t){var r=t.icon,n=t.className,i=t.onClick,a=t.style,s=t.primaryColor,l=t.secondaryColor,u=N_(t,r8),f=at.useRef(),d=Po;if(s&&(d={primaryColor:s,secondaryColor:l||e1(s)}),t8(f),QR(Z_(r),"icon should be icon definiton, but got ".concat(r)),!Z_(r))return null;var p=r;return p&&typeof p.icon=="function"&&(p=rn(rn({},p),{},{icon:p.icon(d.primaryColor,d.secondaryColor)})),Xd(p.icon,"svg-".concat(p.name),rn(rn({className:n,onClick:i,style:a,"data-icon":p.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},u),{},{ref:f}))};va.displayName="IconReact",va.getTwoToneColors=i8,va.setTwoToneColors=n8;function r1(e){var t=t1(e),r=F_(t,2),n=r[0],i=r[1];return va.setTwoToneColors({primaryColor:n,secondaryColor:i})}function a8(){var e=va.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor}var o8=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];r1(Ao.primary);var $r=at.forwardRef(function(e,t){var r=e.className,n=e.icon,i=e.spin,a=e.rotate,s=e.tabIndex,l=e.onClick,u=e.twoToneColor,f=N_(e,o8),d=at.useContext(x_),p=d.prefixCls,m=p===void 0?"anticon":p,y=d.rootClassName,_=Il(y,m,Kt(Kt({},"".concat(m,"-").concat(n.name),!!n.name),"".concat(m,"-spin"),!!i||n.name==="loading"),r),w=s;w===void 0&&l&&(w=-1);var v=a?{msTransform:"rotate(".concat(a,"deg)"),transform:"rotate(".concat(a,"deg)")}:void 0,g=t1(u),C=F_(g,2),S=C[0],E=C[1];return at.createElement("span",_r({role:"img","aria-label":n.name},f,{ref:t,tabIndex:w,onClick:l,className:_}),at.createElement(va,{icon:n,primaryColor:S,secondaryColor:E,style:v}))});$r.displayName="AntdIcon",$r.getTwoToneColor=a8,$r.setTwoToneColor=r1;var s8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},l8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:s8}))},Zd=at.forwardRef(l8);process.env.NODE_ENV!=="production"&&(Zd.displayName="CheckOutlined");var c8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},u8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:c8}))},n1=at.forwardRef(u8);process.env.NODE_ENV!=="production"&&(n1.displayName="DeleteOutlined");var f8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},d8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:f8}))},i1=at.forwardRef(d8);process.env.NODE_ENV!=="production"&&(i1.displayName="DownOutlined");var h8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},p8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:h8}))},Qd=at.forwardRef(p8);process.env.NODE_ENV!=="production"&&(Qd.displayName="LeftOutlined");var m8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M904 160H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0 624H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0-312H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8z"}}]},name:"menu",theme:"outlined"},g8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:m8}))},a1=at.forwardRef(g8);process.env.NODE_ENV!=="production"&&(a1.displayName="MenuOutlined");var y8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},v8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:y8}))},o1=at.forwardRef(v8);process.env.NODE_ENV!=="production"&&(o1.displayName="PlusOutlined");var b8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},_8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:b8}))},eh=at.forwardRef(_8);process.env.NODE_ENV!=="production"&&(eh.displayName="RightOutlined");var $8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},w8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:$8}))},s1=at.forwardRef(w8);process.env.NODE_ENV!=="production"&&(s1.displayName="UpOutlined");var S8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},C8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:S8}))},l1=at.forwardRef(C8);process.env.NODE_ENV!=="production"&&(l1.displayName="UploadOutlined");function c1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=c1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function E8(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=c1(e))&&(n&&(n+=" "),n+=t);return n}const u1=e=>{const{canAdd:t,disabled:r,idSchema:n,uiSchema:i,items:a,onAddClick:s,readonly:l,registry:u,required:f,schema:d,title:p}=e,m=we(i),y=Se("ArrayFieldDescriptionTemplate",u,m),_=Se("ArrayFieldItemTemplate",u,m),w=Se("ArrayFieldTitleTemplate",u,m),v=p||m.title?$.jsxs($.Fragment,{children:[$.jsx(w,{idSchema:n,title:m.title||p,required:f,schema:d,uiSchema:i,registry:u}),(m.description||d.description)&&$.jsx("div",{style:{marginTop:"8px"},children:$.jsx(y,{idSchema:n,description:m.description||d.description,schema:d,uiSchema:i,registry:u})})]}):void 0;return $.jsx("div",{className:E8("rjsf-array-field",m.classNames),children:$.jsx(re.Card,{title:v,style:{borderColor:"#e2e8f0"},children:$.jsxs(re.Space,{direction:"vertical",style:{width:"100%"},size:"middle",children:[a&&a.map(({key:g,...C})=>$.jsx(_,{...C},g)),t&&$.jsxs(re.Button,{type:"dashed",onClick:s,disabled:r||l,size:"small",block:!0,icon:$.jsx(o1,{}),children:["Add ",p||"Item"]})]})})})},f1=e=>{const{children:t,disabled:r,hasToolbar:n,buttonsProps:i,readonly:a}=e,{hasMoveDown:s,hasMoveUp:l,hasRemove:u,index:f,onDropIndexClick:d,onReorderClick:p}=i,m=n?$.jsxs(re.Space,{size:"small",children:[(l||s)&&$.jsx(a1,{style:{color:"#94a3b8",fontSize:"16px"}}),l&&$.jsx(re.Button,{type:"text",size:"small",disabled:r||a,onClick:p(f,f-1),icon:$.jsx(s1,{}),title:"Move up"}),s&&$.jsx(re.Button,{type:"text",size:"small",disabled:r||a,onClick:p(f,f+1),icon:$.jsx(i1,{}),title:"Move down"}),u&&$.jsx(re.Button,{type:"text",size:"small",danger:!0,disabled:r||a,onClick:d(f),icon:$.jsx(n1,{}),title:"Remove"})]}):null;return $.jsx(re.Card,{style:{borderColor:"#e2e8f0",position:"relative"},extra:m,bodyStyle:{padding:"16px"},children:$.jsx("div",{style:n?{paddingRight:"96px"}:void 0,children:t})})},d1=({currentStep:e,totalSteps:t,progressPercentage:r,className:n,style:i})=>$.jsxs("div",{className:n,style:{...i},children:[$.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"14px",marginBottom:"12px"},children:[$.jsxs("span",{style:{fontWeight:500,color:"#374151"},children:["Step ",e," of ",t]}),$.jsxs("span",{style:{fontWeight:500,color:"#374151"},children:[r,"% Complete"]})]}),$.jsx(re.Progress,{percent:r,showInfo:!1,strokeColor:"#1f2937",trailColor:"#e5e7eb"})]}),h1=({steps:e,currentStep:t,onStepChange:r,className:n,style:i})=>{const a=l=>{r&&!e[l].disabled&&r(l)},s=(l,u,f)=>l?{backgroundColor:"#1f2937",borderColor:"#1f2937",color:"white"}:u&&!l?{backgroundColor:"#f0fdf4",borderColor:"#86efac",color:"#15803d"}:f?{backgroundColor:"#f3f4f6",borderColor:"#f3f4f6",color:"#9ca3af",cursor:"not-allowed"}:{};return $.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",overflowX:"auto",...i},className:n,children:e.map((l,u)=>{const f=u===t,d=l.completed,p=l.disabled,m=l.icon;return $.jsxs(re.Button,{type:f?"primary":"default",size:"small",onClick:()=>a(u),disabled:p,style:{borderRadius:"9999px",display:"flex",alignItems:"center",gap:"8px",...s(f,d||!1,p||!1)},icon:m?$.jsx(m,{className:""}):void 0,children:[$.jsx("span",{style:{fontWeight:500,fontSize:"14px",whiteSpace:"nowrap"},children:l.title}),d&&!f&&$.jsx(re.Badge,{count:$.jsx(Zd,{style:{fontSize:"10px",color:"#15803d"}}),style:{backgroundColor:"#dcfce7",marginLeft:"4px"}})]},l.id)})})},p1=({onPrevious:e,onNext:t,onSubmit:r,canGoNext:n=!0,canGoPrevious:i=!0,isLastStep:a=!1,submitLabel:s="Submit",nextLabel:l="Next",previousLabel:u="Previous",className:f,style:d})=>{const p=()=>{a&&r?r():t&&t()};return $.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",...d},className:f,children:[$.jsx(re.Button,{onClick:e,disabled:!i||!e,icon:$.jsx(Qd,{}),children:u}),$.jsxs(re.Button,{type:a?"primary":"default",onClick:p,disabled:!n,style:a?{backgroundColor:"#52c41a",borderColor:"#52c41a"}:void 0,children:[a?s:l,!a&&$.jsx(eh,{})]})]})},O8=({title:e,subtitle:t,steps:r,currentStep:n,children:i,onStepChange:a,onPrevious:s,onNext:l,onSubmit:u,canGoNext:f=!0,canGoPrevious:d=!0,isLastStep:p=!1,submitLabel:m="Submit",nextLabel:y="Next",previousLabel:_="Previous",className:w})=>{const v=r.filter(S=>S.completed).length,g=r.length,C=Math.round(v/g*100);return $.jsx("div",{className:w,style:{minHeight:"100vh",backgroundColor:"#f5f5f5",padding:"32px 0"},children:$.jsxs("div",{style:{maxWidth:"896px",margin:"0 auto",padding:"0 16px"},children:[$.jsxs("div",{style:{textAlign:"center",marginBottom:"32px"},children:[$.jsx("h1",{style:{fontSize:"30px",fontWeight:"bold",color:"#1f2937",marginBottom:"8px"},children:e}),t&&$.jsx("p",{style:{fontSize:"16px",color:"#6b7280",marginBottom:"32px"},children:t}),$.jsx("div",{style:{marginBottom:"32px"},children:$.jsx(d1,{currentStep:n+1,totalSteps:g,progressPercentage:C})}),$.jsx("div",{style:{marginBottom:"32px"},children:$.jsx(h1,{steps:r,currentStep:n,onStepChange:a})})]}),$.jsx("div",{style:{backgroundColor:"white",borderRadius:"8px",boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)",border:"1px solid #e5e7eb",padding:"32px",marginBottom:"32px"},children:i}),$.jsx(p1,{onPrevious:s,onNext:l,onSubmit:u,canGoNext:f,canGoPrevious:d,isLastStep:p,submitLabel:m,nextLabel:y,previousLabel:_})]})})},m1=({title:e,description:t,properties:r,required:n,uiSchema:i,idSchema:a,schema:s,registry:l})=>{const u=we(i),f=Se("TitleFieldTemplate",l,u),d=Se("DescriptionFieldTemplate",l,u),p=e&&e!==s.title,m=u.icon,y=u.columns||1,_=u.sectionClass||"",w=()=>{switch(y){case 2:return"repeat(2, 1fr)";case 3:return"repeat(3, 1fr)";case 4:return"repeat(4, 1fr)";default:return"1fr"}};return $.jsxs("div",{className:_,style:{display:"flex",flexDirection:"column",gap:"24px"},children:[p&&$.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m&&B.createElement(m,{className:""}),$.jsx(f,{id:a.$id,title:e,required:n,schema:s,uiSchema:i,registry:l})]}),t&&$.jsx(d,{id:a.$id,description:t,schema:s,uiSchema:i,registry:l})]}),$.jsx("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:w()},children:r.map(v=>{const g=v.name==="description"||v.name==="notes"||v.name==="primaryActivity"||v.name==="residentialAddress";return $.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",gridColumn:g?"1 / -1":void 0},children:v.content},v.name)})})]})},g1=({title:e,description:t,properties:r,uiSchema:n,schema:i,sectionTitle:a,sectionDescription:s,sectionIcon:l})=>{const u=we(n),f=a||e,d=s||t,p=u.columns||1;return $.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[f&&$.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[l&&$.jsx(l,{className:""}),$.jsx("h2",{style:{fontSize:"20px",fontWeight:600,color:"#111827",margin:0},children:f})]}),d&&$.jsx("p",{style:{fontSize:"14px",color:"#6b7280",margin:0},children:d})]}),e&&e!==f&&$.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderBottom:"1px solid #e5e7eb",paddingBottom:"16px"},children:[$.jsx("h3",{style:{fontSize:"18px",fontWeight:500,color:"#111827",margin:0},children:e}),t&&$.jsx("p",{style:{fontSize:"14px",color:"#6b7280",margin:0},children:t})]}),$.jsx("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:p===1?"1fr":p===2?"repeat(2, 1fr)":"repeat(3, 1fr)",gridAutoRows:"min-content"},children:r.map(m=>{var v,g,C,S,E,A;const y=(v=i.properties)==null?void 0:v[m.name],_=y&&typeof y=="object"&&"type"in y&&y.type==="array",w=((g=m.name)==null?void 0:g.includes("address"))||((C=m.name)==null?void 0:C.includes("description"))||((S=m.name)==null?void 0:S.includes("notes"))||((E=m.name)==null?void 0:E.includes("Activity"))||_||((A=n==null?void 0:n[m.name])==null?void 0:A["ui:widget"])==="textarea";return $.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px",gridColumn:w&&p>1?"1 / -1":void 0},children:m.content},m.name)})})]})},y1=({uiSchema:e,...t})=>{const{submitText:r,norender:n,props:i={}}=jd(e);return n?null:$.jsx("div",{style:{display:"flex",justifyContent:"flex-end",paddingTop:"16px",borderTop:"1px solid #d9d9d9"},children:$.jsx(re.Button,{type:"primary",htmlType:"submit",size:"large",style:{minWidth:"96px"},...i,...t,children:r||"Submit"})})},v1=({id:e,children:t,displayLabel:r,rawErrors:n=[],errors:i,help:a,description:s,rawDescription:l,classNames:u,style:f,disabled:d,label:p,hidden:m,readonly:y,required:_,schema:w,uiSchema:v,registry:g})=>{var Y;const C=we(v),S=Se("WrapIfAdditionalTemplate",g,C);if(m)return $.jsx("div",{style:{display:"none"},children:t});const E=n.length>0?"error":void 0,x=a&&((Y=a.props)==null?void 0:Y.help)?a:r&&l?s:void 0,N=n.length>0?i:void 0;return $.jsx(S,{classNames:u,style:f,disabled:d,id:e,label:p,onDropPropertyClick:K=>()=>{},onKeyChange:K=>()=>{},readonly:y,required:_,schema:w,uiSchema:v,registry:g,children:$.jsxs(re.Form.Item,{label:r?p:void 0,required:_,validateStatus:E,help:x,labelCol:{span:24},wrapperCol:{span:24},style:{...f},className:`${u||""} vertical-form-item`,children:[t,N]})})},b1={address:jg,phone:Bg,currency:Ug},th={FieldTemplate:v1,ArrayFieldTemplate:u1,ArrayFieldItemTemplate:f1,WizardObjectFieldTemplate:m1,WizardSectionTemplate:g1,ButtonTemplates:{SubmitButton:y1}},_1=({id:e,value:t,required:r,disabled:n,readonly:i,onChange:a,onBlur:s,onFocus:l,schema:u})=>{const f=ht(e,u),d=async y=>{const _=y.target.value;a(_),await f.onChange(_)},p=async y=>{const _=y.target.value;s&&s(e,_),await f.onBlur(_)},m=async y=>{const _=y.target.value;l&&l(e,_),await f.onFocus(_)};return $.jsx(re.Input,{id:e,type:"color",value:t||"#000000",required:r,disabled:n||i,onChange:d,onBlur:p,onFocus:m,style:{height:"40px",width:"100%",cursor:"pointer"}})},Io=(e={})=>{const{emptyValue:t,size:r,placeholder:n,prefix:i,suffix:a,allowClear:s,bordered:l,variant:u,defaultValue:f,maxLength:d,showCount:p,status:m,style:y,className:_,addonBefore:w,addonAfter:v,...g}=e;let C=u;return l!==void 0&&!u&&(C=l?"outlined":"borderless"),{size:r,placeholder:n,prefix:i,suffix:a,allowClear:s,variant:C,defaultValue:f,maxLength:d,showCount:p,status:m,style:y,className:_,addonBefore:w,addonAfter:v,...g}},A8=(e={})=>{const{emptyValue:t,rows:r,autoSize:n,size:i,placeholder:a,allowClear:s,bordered:l,variant:u,defaultValue:f,maxLength:d,showCount:p,status:m,style:y,className:_,prefix:w,suffix:v,addonBefore:g,addonAfter:C,...S}=e;let E=u;return l!==void 0&&!u&&(E=l?"outlined":"borderless"),{size:i,placeholder:a,allowClear:s,variant:E,defaultValue:f,maxLength:d,showCount:p,status:m,style:y,className:_,rows:r,autoSize:n,...S}},$1=(e={})=>{const{emptyValue:t,format:r,picker:n,placeholder:i,placement:a,showTime:s,showNow:l,showToday:u,disabledDate:f,size:d,bordered:p,variant:m,suffixIcon:y,style:_,className:w,status:v,...g}=e;let C=m;p!==void 0&&!m&&(C=p?"outlined":"borderless");const S={format:r,picker:n,placement:a,showTime:s,showNow:l,showToday:u,disabledDate:f,size:d,variant:C,suffixIcon:y,style:_,className:w,status:v,...g};return i&&(S.placeholder=i),S},T8=(e={})=>{const{emptyValue:t,size:r,placeholder:n,prefix:i,min:a,max:s,step:l,precision:u,decimalSeparator:f,formatter:d,parser:p,keyboard:m,controls:y,bordered:_,variant:w,style:v,className:g,status:C,addonBefore:S,addonAfter:E,...A}=e;let x=w;return _!==void 0&&!w&&(x=_?"outlined":"borderless"),{size:r,placeholder:n,prefix:i,min:a,max:s,step:l,precision:u,decimalSeparator:f,formatter:d,parser:p,keyboard:m,controls:y,variant:x,style:v,className:g,status:C,addonBefore:S,addonAfter:E,...A}},nn=e=>(e||[]).length>0,xo=(e,t="")=>(e==null?void 0:e.emptyValue)!==void 0?e.emptyValue:t,rh=(e,t,r="")=>e===""||e===null||e===void 0?xo(t,r):e,P8=(e={})=>({min:e.minimum,max:e.maximum,step:e.multipleOf}),nc=(e,t=!1)=>typeof e=="string"?e.toLowerCase()==="true":typeof e=="boolean"?e:t,nh=({id:e,value:t,disabled:r,readonly:n,onChange:i,onBlur:a,onFocus:s,options:l,schema:u,label:f,required:d})=>{const p=u.minimum||0,m=u.maximum||100,y=l.step!==void 0?l.step:u.multipleOf||1,_=ht(e,u),w=l.marks,v=nc(l.dots,!1),g=l.included!==!1,C=nc(l.vertical,!1),S=nc(l.range,!1),E=l.tooltip||{},A=l.trackStyle,x=l.handleStyle,N=l.style,Y=l.onAfterChange,ae={id:e,min:p,max:m,value:t!==void 0?t:S?[p,m]:p,onChange:async k=>{i(k),await _.onChange(k)},onAfterChange:k=>{a&&a(e,k),Y&&Y(k)},onFocus:async()=>{s==null||s(e,t),await _.onFocus(t)},onBlur:async()=>{a==null||a(e,t),await _.onBlur(t)},disabled:r||n,vertical:C,range:S,dots:v,included:g,style:N};y!==null&&(ae.step=y),w!==void 0&&(ae.marks=w),E&&(ae.tooltip=E),A&&(ae.trackStyle=A),x&&(ae.handleStyle=x);const Q=()=>S&&Array.isArray(t)?`${t[0]} - ${t[1]}`:t!==void 0?t:p;return $.jsxs("div",{style:{marginBottom:"16px"},children:[(f||u.title)&&$.jsxs("label",{htmlFor:e,style:{display:"block",marginBottom:"4px",fontWeight:500},children:[f||u.title,d&&$.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}),u.description&&$.jsx("div",{style:{marginBottom:"4px",color:"#666",fontSize:"14px"},children:u.description}),!C&&!l.hideValue&&$.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",marginBottom:"8px"},children:$.jsx("span",{style:{fontSize:"14px",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:Q()})}),$.jsx(re.Slider,{...ae})]})},w1=({id:e,value:t,required:r,disabled:n,readonly:i,label:a,onChange:s,onFocus:l,onBlur:u,options:f,schema:d})=>{const p=ht(e,d),m=async Y=>{s(Y),await p.onChange(Y)},y=async()=>{l==null||l(e,t),await p.onFocus(t)},_=async()=>{u==null||u(e,t),await p.onBlur(t)},w=Number(f.count||f.max||d.maximum||5),v=nc(f.allowHalf,!1),g=f.allowClear!==!1,C=f.character,S=f.tooltips,E=f.style,A=f.onHoverChange,x={value:t||0,onChange:m,onFocus:y,onBlur:_,disabled:n||i,count:w,allowHalf:v,allowClear:r?!1:g,style:E};C&&(x.character=C),A&&(x.onHoverChange=A);const N=()=>S&&S.length>0?$.jsx(re.Rate,{...x,tooltips:S}):$.jsx(re.Rate,{...x});return $.jsxs("div",{style:{marginBottom:"16px"},children:[(a||d.title)&&$.jsxs("label",{htmlFor:e,style:{display:"block",marginBottom:"4px",fontWeight:500},children:[a||d.title,r&&$.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}),d.description&&$.jsx("div",{style:{marginBottom:"4px",color:"#666",fontSize:"14px"},children:d.description}),N()]})},ic=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d,schema:p,rawErrors:m=[]}=e,y=ht(t,p),_=A=>{const x=A===null?xo(d,void 0):A;l(x),y.onChange(x).catch(console.error)},w=async()=>{u&&u(t,r),await y.onBlur(r)},v=async()=>{f&&f(t,r),await y.onFocus(r)},g=nn(m),C=P8(p),S=T8(d),E={...S,min:S.min??C.min,max:S.max??C.max,step:S.step??C.step};return $.jsx(re.InputNumber,{id:t,value:r??void 0,placeholder:s||E.placeholder,required:n,disabled:i,readOnly:a,onChange:_,onBlur:w,onFocus:v,status:g?"error":void 0,style:{width:"100%",...E.style},...E})},ac=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d,rawErrors:p=[],schema:m}=e,y=ht(t,m),_=async S=>{const E=rh(S.target.value,d);l(E),await y.onChange(E)},w=async S=>{const E=S.target.value;u&&u(t,E),await y.onBlur(E)},v=async S=>{const E=S.target.value;f&&f(t,E),await y.onFocus(E)},g=nn(p),C=Io(d);return $.jsx(re.Input,{id:t,type:"tel",value:r||"",placeholder:s||C.placeholder||"Enter phone number",required:n,disabled:i,readOnly:a,onChange:_,onBlur:w,onFocus:v,"aria-invalid":g,status:g?"error":void 0,...C})},ih=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d,rawErrors:p=[],schema:m}=e,y=ht(t,m),_=async S=>{const E=rh(S.target.value,d);l(E),await y.onChange(E)},w=async S=>{const E=S.target.value;u&&u(t,E),await y.onBlur(E)},v=async S=>{const E=S.target.value;f&&f(t,E),await y.onFocus(E)},g=nn(p),C=Io(d);return $.jsx(re.Input,{id:t,type:"email",value:r||"",placeholder:s||C.placeholder||"Enter email address",required:n,disabled:i,readOnly:a,onChange:_,onBlur:w,onFocus:v,"aria-invalid":g,status:g?"error":void 0,...C})},ah=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d,rawErrors:p=[],schema:m}=e,y=ht(t,m),_=async S=>{const E=rh(S.target.value,d);l(E),await y.onChange(E)},w=async S=>{const E=S.target.value;u&&u(t,E),await y.onBlur(E)},v=async S=>{const E=S.target.value;f&&f(t,E),await y.onFocus(E)},g=nn(p),C=Io(d);return $.jsx(re.Input,{id:t,type:"url",value:r||"",placeholder:s||C.placeholder||"Enter URL",required:n,disabled:i,readOnly:a,onChange:_,onBlur:w,onFocus:v,"aria-invalid":g,status:g?"error":void 0,...C})},Do=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d={},rawErrors:p=[],schema:m}=e,y=ht(t,m),_=nn(p),w=async S=>{const E=S.target.value===""?xo(d):S.target.value;l(E),await y.onChange(E)},v=async S=>{const E=S.target.value;u&&u(t,E),await y.onBlur(E)},g=async S=>{const E=S.target.value;f&&f(t,E),await y.onFocus(E)},C=Io(d);return $.jsx(re.Input,{id:t,value:r||"",placeholder:s||C.placeholder,required:n,disabled:i,readOnly:a,onChange:w,onBlur:v,onFocus:g,status:_?"error":C.status,...C})},S1=Object.freeze(Object.defineProperty({__proto__:null,TextWidget:Do,default:Do},Symbol.toStringTag,{value:"Module"})),{TextArea:I8}=re.Input,Fo=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d={},rawErrors:p=[],schema:m}=e,y=ht(t,m),_=nn(p),w=async E=>{const A=E.target.value===""?xo(d):E.target.value;l(A),await y.onChange(A)},v=async E=>{const A=E.target.value;u&&u(t,A),await y.onBlur(A)},g=async E=>{const A=E.target.value;f&&f(t,A),await y.onFocus(A)},C=A8(d),S=C.rows||4;return $.jsx(I8,{id:t,value:r||"",placeholder:s||C.placeholder,required:n,disabled:i,readOnly:a,onChange:w,onBlur:v,onFocus:g,status:_?"error":C.status,style:{resize:"vertical",...C.style},...C,rows:S})},C1=Object.freeze(Object.defineProperty({__proto__:null,TextareaWidget:Fo,default:Fo},Symbol.toStringTag,{value:"Module"})),No=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d={},rawErrors:p=[],schema:m}=e,y=ht(t,m),_=nn(p),w=async A=>{const x=A.target.value===""?xo(d):A.target.value;l(x),await y.onChange(x)},v=async A=>{const x=A.target.value;u&&u(t,x),await y.onBlur(x)},g=async A=>{const x=A.target.value;f&&f(t,x),await y.onFocus(x)},C=Io(d),{visibilityToggle:S=!0,iconRender:E}=d;return $.jsx(re.Input.Password,{id:t,value:r||"",placeholder:s||C.placeholder||"Enter password",required:n,disabled:i,readOnly:a,onChange:w,onBlur:v,onFocus:g,status:_?"error":C.status,visibilityToggle:S,iconRender:E,...C})},E1=Object.freeze(Object.defineProperty({__proto__:null,PasswordWidget:No,default:No},Symbol.toStringTag,{value:"Module"})),x8=({id:e,value:t,required:r,disabled:n,readonly:i,label:a,onChange:s,onBlur:l,onFocus:u,options:f,schema:d})=>{const p=f.inputType||"date",m=ht(e,d),y=async v=>{const g=v.target.value;s(g),await m.onChange(g)},_=async v=>{const g=v.target.value;l&&l(e,g),await m.onBlur(g)},w=async v=>{const g=v.target.value;u&&u(e,g),await m.onFocus(g)};return $.jsxs("div",{style:{marginBottom:"16px"},children:[$.jsxs("label",{htmlFor:e,style:{display:"block",marginBottom:"4px",fontWeight:500},children:[a||d.title,r&&$.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}),$.jsx(re.Input,{id:e,type:p,value:t||"",required:r,disabled:n||i,onChange:y,onBlur:_,onFocus:w,min:typeof f.minDate=="string"||typeof f.minDate=="number"?f.minDate:void 0,max:typeof f.maxDate=="string"||typeof f.maxDate=="number"?f.maxDate:void 0,style:{width:"100%"}})]})};var O1={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(Nr,function(){var r=1e3,n=6e4,i=36e5,a="millisecond",s="second",l="minute",u="hour",f="day",d="week",p="month",m="quarter",y="year",_="date",w="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(Q){var k=["th","st","nd","rd"],W=Q%100;return"["+Q+(k[(W-20)%10]||k[W]||k[0])+"]"}},S=function(Q,k,W){var q=String(Q);return!q||q.length>=k?Q:""+Array(k+1-q.length).join(W)+Q},E={s:S,z:function(Q){var k=-Q.utcOffset(),W=Math.abs(k),q=Math.floor(W/60),L=W%60;return(k<=0?"+":"-")+S(q,2,"0")+":"+S(L,2,"0")},m:function Q(k,W){if(k.date()<W.date())return-Q(W,k);var q=12*(W.year()-k.year())+(W.month()-k.month()),L=k.clone().add(q,p),X=W-L<0,j=k.clone().add(q+(X?-1:1),p);return+(-(q+(W-L)/(X?L-j:j-L))||0)},a:function(Q){return Q<0?Math.ceil(Q)||0:Math.floor(Q)},p:function(Q){return{M:p,y,w:d,d:f,D:_,h:u,m:l,s,ms:a,Q:m}[Q]||String(Q||"").toLowerCase().replace(/s$/,"")},u:function(Q){return Q===void 0}},A="en",x={};x[A]=C;var N="$isDayjsObject",Y=function(Q){return Q instanceof ee||!(!Q||!Q[N])},K=function Q(k,W,q){var L;if(!k)return A;if(typeof k=="string"){var X=k.toLowerCase();x[X]&&(L=X),W&&(x[X]=W,L=X);var j=k.split("-");if(!L&&j.length>1)return Q(j[0])}else{var D=k.name;x[D]=k,L=D}return!q&&L&&(A=L),L||!q&&A},H=function(Q,k){if(Y(Q))return Q.clone();var W=typeof k=="object"?k:{};return W.date=Q,W.args=arguments,new ee(W)},te=E;te.l=K,te.i=Y,te.w=function(Q,k){return H(Q,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var ee=function(){function Q(W){this.$L=K(W.locale,null,!0),this.parse(W),this.$x=this.$x||W.x||{},this[N]=!0}var k=Q.prototype;return k.parse=function(W){this.$d=function(q){var L=q.date,X=q.utc;if(L===null)return new Date(NaN);if(te.u(L))return new Date;if(L instanceof Date)return new Date(L);if(typeof L=="string"&&!/Z$/i.test(L)){var j=L.match(v);if(j){var D=j[2]-1||0,z=(j[7]||"0").substring(0,3);return X?new Date(Date.UTC(j[1],D,j[3]||1,j[4]||0,j[5]||0,j[6]||0,z)):new Date(j[1],D,j[3]||1,j[4]||0,j[5]||0,j[6]||0,z)}}return new Date(L)}(W),this.init()},k.init=function(){var W=this.$d;this.$y=W.getFullYear(),this.$M=W.getMonth(),this.$D=W.getDate(),this.$W=W.getDay(),this.$H=W.getHours(),this.$m=W.getMinutes(),this.$s=W.getSeconds(),this.$ms=W.getMilliseconds()},k.$utils=function(){return te},k.isValid=function(){return this.$d.toString()!==w},k.isSame=function(W,q){var L=H(W);return this.startOf(q)<=L&&L<=this.endOf(q)},k.isAfter=function(W,q){return H(W)<this.startOf(q)},k.isBefore=function(W,q){return this.endOf(q)<H(W)},k.$g=function(W,q,L){return te.u(W)?this[q]:this.set(L,W)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(W,q){var L=this,X=!!te.u(q)||q,j=te.p(W),D=function(ue,he){var be=te.w(L.$u?Date.UTC(L.$y,he,ue):new Date(L.$y,he,ue),L);return X?be:be.endOf(f)},z=function(ue,he){return te.w(L.toDate()[ue].apply(L.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(he)),L)},U=this.$W,T=this.$M,F=this.$D,R="set"+(this.$u?"UTC":"");switch(j){case y:return X?D(1,0):D(31,11);case p:return X?D(1,T):D(0,T+1);case d:var Z=this.$locale().weekStart||0,oe=(U<Z?U+7:U)-Z;return D(X?F-oe:F+(6-oe),T);case f:case _:return z(R+"Hours",0);case u:return z(R+"Minutes",1);case l:return z(R+"Seconds",2);case s:return z(R+"Milliseconds",3);default:return this.clone()}},k.endOf=function(W){return this.startOf(W,!1)},k.$set=function(W,q){var L,X=te.p(W),j="set"+(this.$u?"UTC":""),D=(L={},L[f]=j+"Date",L[_]=j+"Date",L[p]=j+"Month",L[y]=j+"FullYear",L[u]=j+"Hours",L[l]=j+"Minutes",L[s]=j+"Seconds",L[a]=j+"Milliseconds",L)[X],z=X===f?this.$D+(q-this.$W):q;if(X===p||X===y){var U=this.clone().set(_,1);U.$d[D](z),U.init(),this.$d=U.set(_,Math.min(this.$D,U.daysInMonth())).$d}else D&&this.$d[D](z);return this.init(),this},k.set=function(W,q){return this.clone().$set(W,q)},k.get=function(W){return this[te.p(W)]()},k.add=function(W,q){var L,X=this;W=Number(W);var j=te.p(q),D=function(T){var F=H(X);return te.w(F.date(F.date()+Math.round(T*W)),X)};if(j===p)return this.set(p,this.$M+W);if(j===y)return this.set(y,this.$y+W);if(j===f)return D(1);if(j===d)return D(7);var z=(L={},L[l]=n,L[u]=i,L[s]=r,L)[j]||1,U=this.$d.getTime()+W*z;return te.w(U,this)},k.subtract=function(W,q){return this.add(-1*W,q)},k.format=function(W){var q=this,L=this.$locale();if(!this.isValid())return L.invalidDate||w;var X=W||"YYYY-MM-DDTHH:mm:ssZ",j=te.z(this),D=this.$H,z=this.$m,U=this.$M,T=L.weekdays,F=L.months,R=L.meridiem,Z=function(he,be,Le,ft){return he&&(he[be]||he(q,X))||Le[be].slice(0,ft)},oe=function(he){return te.s(D%12||12,he,"0")},ue=R||function(he,be,Le){var ft=he<12?"AM":"PM";return Le?ft.toLowerCase():ft};return X.replace(g,function(he,be){return be||function(Le){switch(Le){case"YY":return String(q.$y).slice(-2);case"YYYY":return te.s(q.$y,4,"0");case"M":return U+1;case"MM":return te.s(U+1,2,"0");case"MMM":return Z(L.monthsShort,U,F,3);case"MMMM":return Z(F,U);case"D":return q.$D;case"DD":return te.s(q.$D,2,"0");case"d":return String(q.$W);case"dd":return Z(L.weekdaysMin,q.$W,T,2);case"ddd":return Z(L.weekdaysShort,q.$W,T,3);case"dddd":return T[q.$W];case"H":return String(D);case"HH":return te.s(D,2,"0");case"h":return oe(1);case"hh":return oe(2);case"a":return ue(D,z,!0);case"A":return ue(D,z,!1);case"m":return String(z);case"mm":return te.s(z,2,"0");case"s":return String(q.$s);case"ss":return te.s(q.$s,2,"0");case"SSS":return te.s(q.$ms,3,"0");case"Z":return j}return null}(he)||j.replace(":","")})},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(W,q,L){var X,j=this,D=te.p(q),z=H(W),U=(z.utcOffset()-this.utcOffset())*n,T=this-z,F=function(){return te.m(j,z)};switch(D){case y:X=F()/12;break;case p:X=F();break;case m:X=F()/3;break;case d:X=(T-U)/6048e5;break;case f:X=(T-U)/864e5;break;case u:X=T/i;break;case l:X=T/n;break;case s:X=T/r;break;default:X=T}return L?X:te.a(X)},k.daysInMonth=function(){return this.endOf(p).$D},k.$locale=function(){return x[this.$L]},k.locale=function(W,q){if(!W)return this.$L;var L=this.clone(),X=K(W,q,!0);return X&&(L.$L=X),L},k.clone=function(){return te.w(this.$d,this)},k.toDate=function(){return new Date(this.valueOf())},k.toJSON=function(){return this.isValid()?this.toISOString():null},k.toISOString=function(){return this.$d.toISOString()},k.toString=function(){return this.$d.toUTCString()},Q}(),ae=ee.prototype;return H.prototype=ae,[["$ms",a],["$s",s],["$m",l],["$H",u],["$W",f],["$M",p],["$y",y],["$D",_]].forEach(function(Q){ae[Q[1]]=function(k){return this.$g(k,Q[0],Q[1])}}),H.extend=function(Q,k){return Q.$i||(Q(k,ee,H),Q.$i=!0),H},H.locale=K,H.isDayjs=Y,H.unix=function(Q){return H(1e3*Q)},H.en=x[A],H.Ls=x,H.p={},H})})(O1);var D8=O1.exports;const oc=Qt(D8),oh=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,onChange:s,onBlur:l,onFocus:u,options:f,rawErrors:d=[],schema:p}=e,m=ht(t,p),y=async(C,S)=>{const E=Array.isArray(S)?S[0]:S,A=E===""?f.emptyValue:E;s(A),await m.onChange(A)},_=async()=>{l&&l(t,r),await m.onBlur(r)},w=async()=>{u&&u(t,r),await m.onFocus(r)},v=nn(d);if(a)return $.jsx(re.Input,{id:t,type:"date",value:r||"",required:n,disabled:i,readOnly:a,"aria-invalid":v,status:v?"error":void 0});const g=$1(f);return $.jsx(re.DatePicker,{id:t,value:r?oc(r):void 0,placeholder:g.placeholder||"Select a date",disabled:i,onChange:y,onBlur:_,onFocus:w,status:v?"error":g.status,style:{width:"100%",...g.style},format:g.format||"YYYY-MM-DD",...g})},sh=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,onChange:s,onBlur:l,onFocus:u,options:f,rawErrors:d=[],schema:p}=e,m=ht(t,p),y=nn(d);if(f.useNativeInput||a){const S=async x=>{const N=x.target.value===""?f.emptyValue:x.target.value;s(N),await m.onChange(N)},E=async x=>{const N=x.target.value;l&&l(t,N),await m.onBlur(N)},A=async x=>{const N=x.target.value;u&&u(t,N),await m.onFocus(N)};return $.jsx(re.Input,{id:t,type:"datetime-local",value:r||"",required:n,disabled:i,readOnly:a,onChange:S,onBlur:E,onFocus:A,"aria-invalid":y,status:y?"error":void 0})}const _=async(S,E)=>{const A=Array.isArray(E)?E[0]:E,x=A===""?f.emptyValue:A;s(x),await m.onChange(x)},w=async()=>{l&&l(t,r),await m.onBlur(r)},v=async()=>{u&&u(t,r),await m.onFocus(r)},g=$1(f),C=g.showTime!==void 0?g.showTime:!0;return $.jsx(re.DatePicker,{id:t,value:r?oc(r):void 0,placeholder:g.placeholder||"Select date and time",disabled:i,onChange:_,onBlur:w,onFocus:v,status:y?"error":g.status,style:{width:"100%",...g.style},format:g.format||"YYYY-MM-DD HH:mm:ss",showTime:C,...g})},A1=({id:e,value:t,required:r,disabled:n,readonly:i,label:a,onChange:s,options:l,schema:u})=>{const f=B.useRef(null),d=l.accept||"*/*",p=l.multiple||!1,m=ht(e,u),y=async v=>{const g=v.target.files;if(!g)return;let C;if(p){const S=Array.from(g).map(E=>({name:E.name,size:E.size,type:E.type,lastModified:E.lastModified}));C=S,s(S)}else{const S=g[0];S&&(C={name:S.name,size:S.size,type:S.type,lastModified:S.lastModified},s(C))}C&&await m.onChange(C)},_=async()=>{f.current&&(f.current.value=""),s(null),await m.onChange(null)},w=v=>v<1024?v+" B":v<1024*1024?(v/1024).toFixed(1)+" KB":(v/(1024*1024)).toFixed(1)+" MB";return $.jsxs("div",{style:{marginBottom:"16px"},children:[$.jsxs("label",{htmlFor:e,style:{display:"block",marginBottom:"8px",fontWeight:500},children:[a||u.title,r&&$.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}),$.jsx("input",{ref:f,id:e,type:"file",accept:d,multiple:p,required:r,disabled:n||i,onChange:y,style:{cursor:"pointer",width:"100%"}}),t&&$.jsx("div",{style:{marginTop:"8px"},children:p&&Array.isArray(t)?$.jsx(re.Space,{wrap:!0,children:t.map((v,g)=>$.jsx(re.Tag,{closable:!n&&!i,onClose:_,style:{display:"flex",alignItems:"center",gap:"4px"},children:$.jsxs("span",{style:{fontSize:"12px"},children:[v.name," (",w(v.size),")"]})},g))}):t&&typeof t=="object"&&"name"in t?$.jsx(re.Tag,{closable:!n&&!i,onClose:_,style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:$.jsxs("span",{style:{fontSize:"12px"},children:[t.name," (",w(t.size),")"]})}):null})]})},sc=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,onChange:s,onBlur:l,onFocus:u,options:f,rawErrors:d=[],schema:p}=e,m=ht(t,p),[y,_]=B.useState(!1),w=f.useAntUpload===!0,v=typeof f.accept=="string"?f.accept:"*/*",g=typeof f.maxSize=="number"?f.maxSize:void 0,C=nn(d),S=H=>new Promise((te,ee)=>{const ae=new FileReader;ae.onload=()=>{const Q=ae.result;te(Q)},ae.onerror=Q=>ee(Q),ae.readAsDataURL(H)}),E=async H=>{const te=H.target.files;if(te&&te.length>0){const ee=te[0];if(g&&ee.size>g*1024*1024){re.message.error(`File size must be less than ${g}MB`);return}try{_(!0);const ae=await S(ee);s(ae),await m.onChange(ae)}catch(ae){console.error("Error converting file to base64:",ae),re.message.error("Failed to process file")}finally{_(!1)}}},A=async({file:H,onSuccess:te,onError:ee})=>{const ae=H;if(g&&ae.size>g*1024*1024){re.message.error(`File size must be less than ${g}MB`),ee&&ee(new Error("File too large"));return}try{_(!0);const Q=await S(ae);s(Q),await m.onChange(Q),te&&te("ok"),re.message.success("File uploaded successfully")}catch(Q){console.error("Error converting file to base64:",Q),re.message.error("Failed to upload file"),ee&&ee(Q)}finally{_(!1)}},x=async()=>{l&&l(t,r),await m.onBlur(r)},N=async()=>{u&&u(t,r),await m.onFocus(r)},Y=async()=>{s(void 0),await m.onChange(void 0)},K=r?[{uid:"-1",name:"Uploaded File",status:"done",url:r}]:[];return w?$.jsx(re.Upload,{id:t,accept:v,fileList:K,customRequest:A,onRemove:Y,disabled:i||a,maxCount:1,beforeUpload:H=>{var te;if(v!=="*/*"){const ee=v.split(",").map(W=>W.trim()),ae=`.${(te=H.name.split(".").pop())==null?void 0:te.toLowerCase()}`,Q=H.type;if(!ee.some(W=>W.startsWith(".")?ae===W.toLowerCase():W.includes("*")?Q.startsWith(W.replace("*","")):Q===W))return re.message.error(`File type not allowed. Please upload: ${v}`),!1}return!0},children:$.jsx(re.Button,{icon:$.jsx(l1,{}),loading:y,danger:C,children:r?"Replace File":"Click to Upload"})}):$.jsx(re.Input,{id:t,type:"file",required:n,disabled:i||y,readOnly:a,accept:v,onChange:E,onBlur:x,onFocus:N,"aria-invalid":C,className:"file:mr-4 file:py-1 file:px-2 file:rounded file:border-0 file:text-sm file:font-medium file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100",status:C?"error":void 0})};var bt=(e=>(e.DROPDOWN="dropdown",e.RADIO="radio",e.CHECKBOX="checkbox",e))(bt||{});function T1(e){return e.type==="static"}function P1(e){return e.type==="api"}function lh(e){return e.type==="websocket"}function I1(e){return e==="checkbox"}const Mo={presentationMode:"dropdown",multiple:!1,allowClear:!0,disabled:!1,readonly:!1,size:"middle",search:{enabled:!1,minLength:1,debounceMs:300,caseSensitive:!1,searchFields:["label"]},accessibility:{announceChanges:!0,keyboard:{arrowKeys:!0,typeAhead:!0,homeEnd:!0}}},ch={ttl:3e5,persistent:!1,storageType:"memory"},ko={type:"simple",simple:{labelField:"label",valueField:"value",disabledField:"disabled"}},x1={maxAttempts:3,baseDelayMs:1e3,maxDelayMs:1e4,backoffMultiplier:2,jitter:!0},mt=class mt{constructor(t={},r={},n){pe(this,"cache");pe(this,"retryConfig");pe(this,"loadingState");pe(this,"errorState");pe(this,"metrics");pe(this,"eventCallbacks");pe(this,"instanceId");pe(this,"isDestroyed",!1);pe(this,"supportsCaching",!0);pe(this,"supportsRealTime",!1);mt.instanceCount++,this.instanceId=`datasource_${mt.instanceCount}_${Date.now()}`,this.cache={...ch,...t},this.retryConfig={...x1,...r},this.eventCallbacks=n,this.loadingState={isLoading:!1,message:"",progress:0},this.errorState={hasError:!1,message:"",recoverable:!0},this.metrics={requestCount:0,successCount:0,errorCount:0,cacheHitCount:0,cacheMissCount:0,averageResponseTimeMs:0},mt.instanceCount===1&&this.startCacheCleanup()}async fetchOptions(){var n,i,a,s;if(this.isDestroyed)throw new Error("DataSourceProvider has been destroyed");const t=performance.now(),r=this.getCacheKey();try{if(this.supportsCaching&&r){const u=this.getCachedData(r);if(u)return this.metrics.cacheHitCount++,(i=(n=this.eventCallbacks)==null?void 0:n.onCacheHit)==null||i.call(n,this,r),this.logDebug(`Cache hit for key: ${r}`),u;this.metrics.cacheMissCount++,(s=(a=this.eventCallbacks)==null?void 0:a.onCacheMiss)==null||s.call(a,this,r),this.logDebug(`Cache miss for key: ${r}`)}const l=await this.fetchWithRetry();return this.supportsCaching&&r&&l.length>0&&(this.setCachedData(r,l),this.logDebug(`Cached ${l.length} options with key: ${r}`)),this.updateMetrics(t,!0),l}catch(l){throw this.updateMetrics(t,!1),this.handleError(l instanceof Error?l:new Error(String(l))),l}}getLoadingState(){return{...this.loadingState}}getErrorState(){return{...this.errorState}}getMetrics(){return{...this.metrics}}clearCache(t){var r,n;t?(mt.memoryCache.delete(t),this.logDebug(`Cleared cache for key: ${t}`)):(mt.memoryCache.clear(),this.logDebug("Cleared all cache entries")),(n=(r=this.eventCallbacks)==null?void 0:r.onCacheCleared)==null||n.call(r,this,t||void 0)}clearError(){this.errorState={hasError:!1,message:"",recoverable:!0},this.logDebug("Error state cleared")}resetMetrics(){this.metrics={requestCount:0,successCount:0,errorCount:0,cacheHitCount:0,cacheMissCount:0,averageResponseTimeMs:0},this.logDebug("Metrics reset")}hasCachedData(t){const r=t||this.getCacheKey();if(!r)return!1;const n=mt.memoryCache.get(r);return n?Date.now()-n.timestamp>n.ttl?(mt.memoryCache.delete(r),!1):!0:!1}cleanup(){if(this.isDestroyed)return;this.isDestroyed=!0;const t=this.getCacheKey();this.clearCache(t??void 0),this.cleanupResources(),mt.instanceCount--,mt.instanceCount===0&&(this.stopCacheCleanup(),mt.memoryCache.clear()),this.logDebug("DataSourceProvider cleanup completed")}cleanupResources(){}setLoadingState(t,r,n){var i,a;this.loadingState={isLoading:t,message:r||(t?"Loading options...":""),progress:n??(t?void 0:100)},t&&((a=(i=this.eventCallbacks)==null?void 0:i.onLoadingStart)==null||a.call(i,this))}validateAndTransformData(t){if(!Array.isArray(t))throw new Error("Data source must return an array of options");return t.map((r,n)=>{if(!r||typeof r!="object")throw new Error(`Invalid option at index ${n}: must be an object`);if(typeof r.label!="string")throw new Error(`Invalid option at index ${n}: label must be a string`);if(r.value===void 0||r.value===null)throw new Error(`Invalid option at index ${n}: value cannot be undefined or null`);if(!["string","number","boolean"].includes(typeof r.value))throw new Error(`Invalid option at index ${n}: value must be string, number, or boolean`);return{label:r.label,value:r.value,disabled:!!r.disabled,metadata:r.metadata||{}}})}logDebug(t,r){process.env.NODE_ENV==="development"&&console.debug(`[DataSourceProvider:${this.instanceId}] ${t}`,r||"")}logError(t,r){console.error(`[DataSourceProvider:${this.instanceId}] ${t}`,r||"")}async fetchWithRetry(){var r,n;let t=null;for(let i=1;i<=this.retryConfig.maxAttempts;i++)try{this.setLoadingState(!0,`Fetching options (attempt ${i})...`);const a=await this.fetchData(),s=this.validateAndTransformData(a);return this.setLoadingState(!1),this.clearError(),(n=(r=this.eventCallbacks)==null?void 0:r.onLoadingComplete)==null||n.call(r,this,s),s}catch(a){if(t=a instanceof Error?a:new Error(String(a)),this.logError(`Attempt ${i} failed:`,t),i===this.retryConfig.maxAttempts)break;const s=this.retryConfig.baseDelayMs*Math.pow(this.retryConfig.backoffMultiplier,i-1);let l=Math.min(s,this.retryConfig.maxDelayMs);if(this.retryConfig.jitter){const u=l*.25,f=(Math.random()-.5)*2*u;l=Math.max(0,l+f)}this.logDebug(`Retrying in ${Math.round(l)}ms...`),this.setLoadingState(!0,`Retrying in ${Math.round(l/1e3)}s...`,i/this.retryConfig.maxAttempts*100),await new Promise(u=>setTimeout(u,l))}throw this.setLoadingState(!1),t||new Error("Max retry attempts exceeded")}getCachedData(t){const r=mt.memoryCache.get(t);return r?Date.now()-r.timestamp>r.ttl?(mt.memoryCache.delete(t),null):[...r.data]:null}setCachedData(t,r){const n={data:[...r],timestamp:Date.now(),ttl:this.cache.ttl||ch.ttl,key:t};mt.memoryCache.set(t,n)}handleError(t){var r,n;this.errorState={hasError:!0,message:t.message||"An unknown error occurred",code:t.code||"UNKNOWN_ERROR",stack:process.env.NODE_ENV==="development"?t.stack:void 0,recoverable:!0,timestamp:Date.now()},this.metrics.lastErrorTimestamp=Date.now(),(n=(r=this.eventCallbacks)==null?void 0:r.onError)==null||n.call(r,this,t),this.logError("DataSource error:",t)}updateMetrics(t,r){const n=performance.now()-t;this.metrics.requestCount++,this.metrics.lastRequestTimestamp=Date.now(),r?this.metrics.successCount++:this.metrics.errorCount++;const i=this.metrics.requestCount;this.metrics.averageResponseTimeMs=(this.metrics.averageResponseTimeMs*(i-1)+n)/i}startCacheCleanup(){mt.cacheCleanupInterval=setInterval(()=>{this.runCacheCleanup()},3e5)}stopCacheCleanup(){mt.cacheCleanupInterval&&(clearInterval(mt.cacheCleanupInterval),mt.cacheCleanupInterval=void 0)}runCacheCleanup(){const t=Date.now();let r=0;for(const[n,i]of mt.memoryCache.entries())t-i.timestamp>i.ttl&&(mt.memoryCache.delete(n),r++);r>0&&this.logDebug(`Cache cleanup: removed ${r} expired entries`)}};pe(mt,"memoryCache",new Map),pe(mt,"cacheCleanupInterval"),pe(mt,"instanceCount",0);let ba=mt;function D1(e){let t=0;if(e.length===0)return t.toString();for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function F8(e){if(!Array.isArray(e))return["Options must be an array"];const t=[];return e.forEach((r,n)=>{if(!r||typeof r!="object"){t.push(`Option at index ${n} must be an object`);return}const i=r;typeof i.label!="string"&&t.push(`Option at index ${n} must have a string label`),(i.value===void 0||i.value===null)&&t.push(`Option at index ${n} must have a defined value`);const a=["string","number","boolean"];i.value!==void 0&&i.value!==null&&!a.includes(typeof i.value)&&t.push(`Option at index ${n} value must be string, number, or boolean`)}),t.length>0?t:null}class uh extends ba{constructor(r,n={}){const i={ttl:0,persistent:!1,storageType:"memory",...n.cache};super(i,{maxAttempts:1},n.eventCallbacks);pe(this,"validatedOptions");pe(this,"optionGroups",new Map);pe(this,"supportsRealTime",!0);this.validateConfig(r),this.validatedOptions=this.validateAndTransformData(r.options),this.buildOptionGroups(),this.logDebug(`StaticDataSource initialized with ${this.validatedOptions.length} options`)}async fetchData(){return this.validatedOptions.map(r=>({...r,metadata:r.metadata?{...r.metadata}:{}}))}getCacheKey(){return null}searchOptions(r,n){const i=l=>({...l,metadata:l.metadata?{...l.metadata}:{}});if(!n.enabled||!r)return this.validatedOptions.map(i);if(n.minLength&&r.length<n.minLength)return this.validatedOptions.map(i);const a=n.caseSensitive?r:r.toLowerCase(),s=n.searchFields||["label"];return this.validatedOptions.filter(l=>n.customFilter?n.customFilter(l,r):s.some(u=>{var p;let f="";switch(u){case"label":f=l.label;break;case"value":f=String(l.value);break;case"description":f=((p=l.metadata)==null?void 0:p.description)||"";break;default:return!1}return(n.caseSensitive?f:f.toLowerCase()).includes(a)})).map(i)}getGroupedOptions(){const r=new Map;for(const[n,i]of this.optionGroups)r.set(n,i.map(a=>({...a,metadata:a.metadata?{...a.metadata}:{}})));return r}getOptionsByGroup(r){return(this.optionGroups.get(r)||[]).map(i=>({...i,metadata:i.metadata?{...i.metadata}:{}}))}getGroupNames(){return Array.from(this.optionGroups.keys())}updateOptions(r){var i,a;this.logDebug("Updating static options",{oldCount:this.validatedOptions.length,newCount:r.length});const n=this.validateAndTransformData(r);this.validatedOptions.length=0,this.optionGroups.clear(),this.validatedOptions.push(...n),this.buildOptionGroups(),this.clearCache(),this.logDebug(`Updated static options: ${this.validatedOptions.length} options`),(a=(i=this.eventCallbacks)==null?void 0:i.onLoadingComplete)==null||a.call(i,this,this.validatedOptions)}addOptions(r){const n=this.validateAndTransformData(r),i=new Set(this.validatedOptions.map(s=>s.value)),a=n.filter(s=>i.has(s.value));if(a.length>0)throw new Error(`Duplicate option values found: ${a.map(s=>s.value).join(", ")}`);this.validatedOptions.push(...n),this.buildOptionGroups(),this.clearCache(),this.logDebug(`Added ${r.length} new options`)}removeOptions(r){const n=new Set(r),i=this.validatedOptions.length,a=this.validatedOptions.filter(l=>!n.has(l.value));this.validatedOptions.length=0,this.validatedOptions.push(...a),this.buildOptionGroups(),this.clearCache();const s=i-this.validatedOptions.length;return this.logDebug(`Removed ${s} options`),s}getOptionByValue(r){const n=this.validatedOptions.find(i=>i.value===r);return n?{...n,metadata:n.metadata?{...n.metadata}:{}}:null}hasOptionWithValue(r){return this.validatedOptions.some(n=>n.value===r)}getOptionCount(){return this.validatedOptions.length}getMemoryStats(){const r=JSON.stringify(this.validatedOptions).length,n=JSON.stringify(Array.from(this.optionGroups.entries())).length,i=Math.max(1,Math.round((r+n)/1024));return{optionCount:this.validatedOptions.length,groupCount:this.optionGroups.size,estimatedMemoryKB:i}}validateAndTransformData(r){return super.validateAndTransformData(r).map(i=>({...i,metadata:i.metadata?{...i.metadata}:{}}))}cleanupResources(){this.optionGroups.clear(),this.validatedOptions.length=0,this.logDebug("StaticDataSource resources cleaned up")}validateConfig(r){if(!r||typeof r!="object")throw new Error("StaticDataSourceConfig must be an object");if(r.type!=="static")throw new Error('StaticDataSourceConfig type must be "static"');if(!Array.isArray(r.options))throw new Error("StaticDataSourceConfig options must be an array");r.options.length===0&&this.logDebug("Warning: StaticDataSource initialized with empty options array")}buildOptionGroups(){var r;this.optionGroups.clear();for(const n of this.validatedOptions){const i=((r=n.metadata)==null?void 0:r.group)||"ungrouped";this.optionGroups.has(i)||this.optionGroups.set(i,[]),this.optionGroups.get(i).push(n)}this.logDebug(`Built ${this.optionGroups.size} option groups`)}}function N8(e,t){return new uh(e,t)}function M8(e){var t;return!!((t=e.metadata)!=null&&t.group)}function k8(e){const t=[];for(const[r,n]of Object.entries(e))for(const i of n)t.push({...i,metadata:{...i.metadata,group:r}});return t}const L8={delayMs:300,maxWaitMs:1e3,leading:!1,trailing:!0};class j8{constructor(t,r){pe(this,"timeoutId");pe(this,"maxTimeoutId");pe(this,"lastArgs");pe(this,"lastResult");this.func=t,this.config=r}execute(...t){return new Promise((r,n)=>{if(this.lastArgs=t,this.timeoutId&&clearTimeout(this.timeoutId),this.config.leading&&!this.timeoutId)try{const i=this.func(...t);this.lastResult=i,r(i);return}catch(i){n(i);return}this.config.trailing&&(this.timeoutId=setTimeout(async()=>{try{const i=await this.func(...this.lastArgs);this.lastResult=i,r(i)}catch(i){n(i)}finally{this.timeoutId=void 0}},this.config.delayMs)),this.config.maxWaitMs&&!this.maxTimeoutId&&(this.maxTimeoutId=setTimeout(async()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0);try{const i=await this.func(...this.lastArgs);this.lastResult=i,r(i)}catch(i){n(i)}finally{this.maxTimeoutId=void 0}},this.config.maxWaitMs))})}cancel(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.maxTimeoutId&&(clearTimeout(this.maxTimeoutId),this.maxTimeoutId=void 0)}flush(){if(this.timeoutId&&this.lastArgs){clearTimeout(this.timeoutId),this.timeoutId=void 0,this.maxTimeoutId&&(clearTimeout(this.maxTimeoutId),this.maxTimeoutId=void 0);const t=this.func(...this.lastArgs);return this.lastResult=t,t}return this.lastResult}}class B8{constructor(t={}){pe(this,"config");pe(this,"abortController");this.config={timeout:3e4,defaultHeaders:{"Content-Type":"application/json",Accept:"application/json"},...t}}async request(t){this.abortController=new AbortController;const r={method:"GET",headers:{...this.config.defaultHeaders},timeout:this.config.timeout,signal:this.abortController.signal,...t,url:this.resolveUrl(t.url||"")},n=this.config.requestInterceptor?await this.config.requestInterceptor(r):r,i=this.buildUrlWithParams(n.url,n.params),a={method:n.method,headers:new Headers(n.headers),signal:n.signal};["POST","PUT","PATCH"].includes(n.method)&&n.body&&(a.body=typeof n.body=="string"?n.body:JSON.stringify(n.body));const s=setTimeout(()=>{this.abortController&&!this.abortController.signal.aborted&&this.abortController.abort()},n.timeout),l=new Promise((u,f)=>{setTimeout(()=>{f(new Error(`Request timeout after ${n.timeout}ms`))},n.timeout)});try{const u=await Promise.race([fetch(i,a),l]);clearTimeout(s);const f=this.config.responseInterceptor?await this.config.responseInterceptor(u):u;if(!f.ok){const p=await f.text().catch(()=>"Unknown error");throw new Error(`HTTP ${f.status} ${f.statusText}: ${p}`)}const d=f.headers.get("content-type")||"";return d.includes("application/json")?await f.json():d.includes("text/")?await f.text():await f.blob()}catch(u){throw clearTimeout(s),u instanceof Error?u.name==="AbortError"?new Error("Request was cancelled"):u:new Error("Unknown request error")}}cancel(){this.abortController&&!this.abortController.signal.aborted&&this.abortController.abort()}resolveUrl(t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(this.config.baseUrl){const r=this.config.baseUrl.endsWith("/")?this.config.baseUrl.slice(0,-1):this.config.baseUrl,n=t.startsWith("/")?t:`/${t}`;return`${r}${n}`}return t}buildUrlWithParams(t,r){if(!r||Object.keys(r).length===0)return t;const n=new URL(t);return Object.entries(r).forEach(([i,a])=>{n.searchParams.set(i,String(a))}),n.toString()}}class U8{static mapResponse(t,r){switch(r.type){case"simple":return this.mapSimpleResponse(t,r.simple);case"nested":return this.mapNestedResponse(t,r.nested);case"custom":if(!r.custom)throw new Error("Custom mapper function is required for custom type");return r.custom(t);default:throw new Error(`Unknown response mapper type: ${r.type}`)}}static mapSimpleResponse(t,r=ko.simple){const{arrayPath:n="",labelField:i="label",valueField:a="value",disabledField:s="disabled"}=r||{};let l=[];if(n){const u=this.getNestedValue(t,n);if(!Array.isArray(u))throw new Error(`Array not found at path: ${n}`);l=u}else if(Array.isArray(t))l=t;else throw new Error("Response data must be an array or contain an array at specified path");return l.map((u,f)=>{if(!u||typeof u!="object")throw new Error(`Invalid item at index ${f}: must be an object`);const d=u,p=d[i],m=d[a],y=d[s];if(typeof p!="string")throw new Error(`Invalid label at index ${f}: must be a string`);if(m==null)throw new Error(`Invalid value at index ${f}: cannot be undefined or null`);if(!["string","number","boolean"].includes(typeof m))throw new Error(`Invalid value at index ${f}: must be string, number, or boolean`);return{label:p,value:m,disabled:!!y,metadata:{...d,_index:f}}})}static mapNestedResponse(t,r){if(!r)throw new Error("Nested mapper configuration is required");const{arrayPath:n,paths:i}=r,a=this.getNestedValue(t,n);if(!Array.isArray(a))throw new Error(`Array not found at path: ${n}`);return a.map((s,l)=>{if(!s||typeof s!="object")throw new Error(`Invalid item at index ${l}: must be an object`);const u=this.getNestedValue(s,i.label),f=this.getNestedValue(s,i.value),d=i.disabled?this.getNestedValue(s,i.disabled):!1,p=i.description?this.getNestedValue(s,i.description):void 0;if(typeof u!="string")throw new Error(`Invalid label at index ${l}: must be a string`);if(f==null)throw new Error(`Invalid value at index ${l}: cannot be undefined or null`);if(!["string","number","boolean"].includes(typeof f))throw new Error(`Invalid value at index ${l}: must be string, number, or boolean`);return{label:u,value:f,disabled:!!d,metadata:{description:typeof p=="string"?p:void 0,index:l,originalData:s}}})}static getNestedValue(t,r){if(!t||typeof t!="object")return;const n=r.split(".");let i=t;for(const a of n){if(i==null)return;i=i[a]}return i}}class fh extends ba{constructor(r,n={},i,a={}){super(r.cache,n,i);pe(this,"config");pe(this,"httpClient");pe(this,"debouncedFetch");pe(this,"lastRequestUrl");pe(this,"searchParams");pe(this,"supportsRealTime",!0);this.debounceConfig=a,this.config=this.validateAndNormalizeConfig(r),this.httpClient=this.createHttpClient();const s={...L8,...this.debounceConfig};this.debouncedFetch=new j8(()=>this.fetchDataInternal(),s),this.logDebug("ApiDataSource initialized",{url:this.config.url,method:this.config.method,hasAuth:!!this.config.auth,cacheEnabled:this.supportsCaching,debounceMs:s.delayMs})}async fetchData(){const r=this.buildRequestUrl(),n=this.hasSearchParams()||this.lastRequestUrl!==r;return this.lastRequestUrl=r,n&&this.debouncedFetch?(this.logDebug("Using debounced fetch for search request"),await this.debouncedFetch.execute()):(this.logDebug("Using direct fetch for regular request"),await this.fetchDataInternal())}setSearchParams(r){this.searchParams={...r},this.logDebug("Search parameters updated",r)}clearSearchParams(){this.searchParams=void 0,this.logDebug("Search parameters cleared")}cancelPendingRequests(){this.debouncedFetch&&this.debouncedFetch.cancel(),this.httpClient.cancel(),this.logDebug("Pending requests cancelled")}flushPendingRequests(){if(this.debouncedFetch)return this.debouncedFetch.flush()}getCacheKey(){var l;if(!this.supportsCaching||this.cache.ttl!==void 0&&this.cache.ttl<=0)return null;const r=this.buildRequestUrl(),n=this.config.method||"GET",i=((l=this.config.auth)==null?void 0:l.type)||"none",a={url:r,method:n,authType:i,body:this.config.body,searchParams:this.searchParams},s=JSON.stringify(a);return`api_${D1(s)}`}cleanupResources(){this.cancelPendingRequests(),this.debouncedFetch&&(this.debouncedFetch.cancel(),this.debouncedFetch=void 0),this.logDebug("API resources cleaned up")}async fetchDataInternal(){const r=performance.now();try{const n=this.buildRequestConfig();this.logDebug("Making API request",{url:n.url,method:n.method,hasAuth:!!this.config.auth,hasBody:!!n.body,paramsCount:Object.keys(n.params||{}).length});const i=await this.httpClient.request(n),a=U8.mapResponse(i,this.config.responseMapper),s=performance.now()-r;return this.logDebug(`API request completed in ${Math.round(s)}ms`,{optionsCount:a.length,responseTime:s}),a}catch(n){const i=performance.now()-r;throw this.logError(`API request failed after ${Math.round(i)}ms`,n instanceof Error?n:new Error(String(n))),n}}buildRequestConfig(){const r={"Content-Type":"application/json",Accept:"application/json",...this.config.headers},n={url:this.buildRequestUrl(),method:this.config.method||"GET",headers:r,body:this.config.body,params:this.buildRequestParams(),timeout:this.config.timeout||3e4};return this.config.auth&&this.addAuthenticationHeaders(n),n}buildRequestUrl(){return this.config.url}buildRequestParams(){return{...this.config.params,...this.searchParams}}addAuthenticationHeaders(r){if(!this.config.auth||!r.headers)return;const{type:n,credentials:i,headerName:a}=this.config.auth;switch(n){case"bearer":if(typeof i=="string")r.headers.Authorization=`Bearer ${i}`;else throw new Error("Bearer token must be a string");break;case"basic":if(typeof i=="object"&&i.username&&i.password){const s=btoa(`${i.username}:${i.password}`);r.headers.Authorization=`Basic ${s}`}else throw new Error("Basic auth requires username and password");break;case"apiKey":if(typeof i=="string"&&a)r.headers[a]=i;else throw new Error("API key auth requires credentials string and headerName");break;default:throw new Error(`Unsupported authentication type: ${n}`)}}hasSearchParams(){return!!this.searchParams&&Object.keys(this.searchParams).length>0}createHttpClient(){const r={"Content-Type":"application/json",Accept:"application/json"};return new B8({timeout:this.config.timeout||3e4,defaultHeaders:{...r,...this.config.headers}})}validateAndNormalizeConfig(r){if(!r.url)throw new Error("API URL is required");if(!r.responseMapper)throw new Error("Response mapper configuration is required");try{new URL(r.url)}catch{throw new Error("Invalid API URL format")}const n=["GET","POST","PUT","PATCH"];if(r.method&&!n.includes(r.method))throw new Error(`Invalid HTTP method: ${r.method}`);return r.auth&&this.validateAuthConfig(r.auth),this.validateResponseMapper(r.responseMapper),{...r,method:r.method||"GET",headers:r.headers||{},params:r.params||{},timeout:r.timeout||3e4,retries:r.retries||0,responseMapper:r.responseMapper||ko}}validateAuthConfig(r){if(!["bearer","basic","apiKey"].includes(r.type))throw new Error(`Invalid auth type: ${r.type}`);if(!r.credentials)throw new Error("Auth credentials are required");if(r.type==="basic"){if(typeof r.credentials!="object"||!r.credentials.username||!r.credentials.password)throw new Error("Basic auth requires username and password")}else if(r.type==="apiKey"){if(typeof r.credentials!="string"||!r.headerName)throw new Error("API key auth requires credentials string and headerName")}else if(r.type==="bearer"&&typeof r.credentials!="string")throw new Error("Bearer auth requires credentials string")}validateResponseMapper(r){if(!["simple","nested","custom"].includes(r.type))throw new Error(`Invalid response mapper type: ${r.type}`);if(r.type==="nested"&&!r.nested)throw new Error("Nested mapper configuration is required for nested type");if(r.type==="custom"&&!r.custom)throw new Error("Custom mapper function is required for custom type");if(r.type==="nested"&&r.nested){if(!r.nested.arrayPath)throw new Error("Array path is required for nested mapper");if(!r.nested.paths||!r.nested.paths.label||!r.nested.paths.value)throw new Error("Label and value paths are required for nested mapper")}}}function W8(e,t={}){return new fh(e,t.retryConfig,t.eventCallbacks,t.debounceConfig)}const q8={SIMPLE_ARRAY:{type:"simple",simple:{labelField:"label",valueField:"value",disabledField:"disabled"}},PAGINATED_DATA:{type:"simple",simple:{arrayPath:"data.items",labelField:"label",valueField:"value",disabledField:"disabled"}},REST_RESULTS:{type:"simple",simple:{arrayPath:"results",labelField:"name",valueField:"id",disabledField:"active"}},NESTED_OBJECTS:{type:"nested",nested:{arrayPath:"data.options",paths:{label:"display.name",value:"identifier",disabled:"status.disabled",description:"display.description"}}}},V8={bearer:e=>({type:"bearer",credentials:e}),basic:(e,t)=>({type:"basic",credentials:{username:e,password:t}}),apiKey:(e,t="X-API-Key")=>({type:"apiKey",credentials:e,headerName:t})};var F1=(e=>(e.DISCONNECTED="disconnected",e.CONNECTING="connecting",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.FAILED="failed",e))(F1||{});class dh extends ba{constructor(r,n={}){var a,s;const i={ttl:3e5,persistent:!0,storageType:"memory",...n.cache};super(i,{maxAttempts:((a=r.connection)==null?void 0:a.maxReconnectAttempts)||5,baseDelayMs:((s=r.connection)==null?void 0:s.reconnectDelay)||1e3,maxDelayMs:3e4,backoffMultiplier:2,jitter:!0},n.eventCallbacks);pe(this,"config");pe(this,"websocket",null);pe(this,"connectionState","disconnected");pe(this,"reconnectAttempts",0);pe(this,"heartbeatInterval",null);pe(this,"responseTimeout",null);pe(this,"searchTimeout",null);pe(this,"pendingRequests",new Map);pe(this,"currentOptions",[]);pe(this,"currentSearchParams",{});pe(this,"supportsRealTime",!0);this.validateConfig(r),this.config=this.normalizeConfig(r),this.logDebug("WebSocketDataSource initialized",{url:this.config.url})}async fetchData(){const r=this.getCacheKey();if(r&&this.hasCachedData(r)){this.logDebug("Using cached data while establishing WebSocket connection");const a=this.getWebSocketCachedData(r);if(a&&a.length>0)return this.ensureConnection(),a}await this.ensureConnection();const n=this.generateMessageId(),i={type:"search-request",messageId:n,timestamp:Date.now(),data:{searchParams:this.currentSearchParams,requestInitial:!0}};return new Promise((a,s)=>{var f;const l=((f=this.config.connection)==null?void 0:f.responseTimeout)||1e4,u=setTimeout(()=>{this.pendingRequests.delete(n),s(new Error(`Request timeout after ${l}ms`))},l);this.pendingRequests.set(n,{resolve:a,reject:s,timeout:u}),this.sendMessage(i)})}getCacheKey(){const r=this.config.url,n=Object.keys(this.currentSearchParams).length>0?JSON.stringify(this.currentSearchParams):"";return`websocket:${r}:${n}`}setSearchParams(r){var n;this.currentSearchParams={...r},this.clearCache(),(n=this.config.messageHandling)!=null&&n.enableRealtimeSearch&&this.debounceSearch(),this.logDebug("Search parameters updated",r)}clearSearchParams(){this.currentSearchParams={},this.clearCache(),this.searchTimeout&&(clearTimeout(this.searchTimeout),this.searchTimeout=null),this.logDebug("Search parameters cleared")}getConnectionState(){return this.connectionState}async reconnect(){this.logDebug("Manual reconnection requested"),this.websocket&&(this.websocket.close(),this.websocket=null),this.connectionState="disconnected",this.reconnectAttempts=0,await this.ensureConnection()}sendMessage(r){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)throw new Error("WebSocket is not connected");const n=JSON.stringify(r);this.websocket.send(n),this.logDebug("Message sent",{type:r.type,messageId:r.messageId})}subscribeToUpdates(r){const n=i=>{r(i)};return this._updateCallback=n,()=>{delete this._updateCallback}}cleanupResources(){this.logDebug("Cleaning up WebSocket resources"),this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.responseTimeout&&(clearTimeout(this.responseTimeout),this.responseTimeout=null),this.searchTimeout&&(clearTimeout(this.searchTimeout),this.searchTimeout=null);for(const[,r]of this.pendingRequests)clearTimeout(r.timeout),r.reject(new Error("WebSocket connection closed"));this.pendingRequests.clear(),this.websocket&&(this.websocket.close(),this.websocket=null),this.connectionState="disconnected"}validateConfig(r){if(!r||typeof r!="object")throw new Error("WebSocketDataSourceConfig must be an object");if(r.type!=="websocket")throw new Error('WebSocketDataSourceConfig type must be "websocket"');if(!r.url||typeof r.url!="string")throw new Error("WebSocketDataSourceConfig must have a valid URL");try{const n=new URL(r.url);if(!["ws:","wss:"].includes(n.protocol))throw new Error("WebSocket URL must use ws:// or wss:// protocol")}catch(n){throw new Error(`Invalid WebSocket URL format: ${n instanceof Error?n.message:String(n)}`)}if(r.auth){if(!["bearer","query","header"].includes(r.auth.type))throw new Error('WebSocket auth type must be "bearer", "query", or "header"');if(!r.auth.credentials||typeof r.auth.credentials!="string")throw new Error("WebSocket auth credentials must be a non-empty string")}}normalizeConfig(r){return{...r,connection:{connectTimeout:3e4,autoReconnect:!0,maxReconnectAttempts:5,reconnectDelay:1e3,heartbeatInterval:3e4,responseTimeout:1e4,...r.connection},messageHandling:{requestInitialOptions:!0,enableRealtimeSearch:!1,searchDebounceMs:300,...r.messageHandling},responseMapper:r.responseMapper||ko}}async ensureConnection(){if(this.connectionState!=="connected"){if(this.connectionState==="connecting"||this.connectionState==="reconnecting")return new Promise((r,n)=>{const i=()=>{this.connectionState==="connected"?r():this.connectionState==="failed"?n(new Error("WebSocket connection failed")):setTimeout(i,100)};i()});await this.connect()}}async connect(){return this.connectionState=this.reconnectAttempts>0?"reconnecting":"connecting",new Promise((r,n)=>{var i;try{const a=this.buildConnectionUrl(),s=this.config.protocols;this.logDebug("Connecting to WebSocket",{url:a.replace(/[?&].*$/,"")}),this.websocket=new WebSocket(a,s);const l=setTimeout(()=>{var u;(u=this.websocket)==null||u.close(),this.connectionState="failed",n(new Error("WebSocket connection timeout"))},((i=this.config.connection)==null?void 0:i.connectTimeout)||3e4);this.websocket.onopen=()=>{var u,f;clearTimeout(l),this.connectionState="connected",this.reconnectAttempts=0,this.logDebug("WebSocket connected successfully"),this.authenticateConnection(),(u=this.config.messageHandling)!=null&&u.initialMessage&&this.sendMessage(this.config.messageHandling.initialMessage),(f=this.config.messageHandling)!=null&&f.requestInitialOptions&&this.requestInitialOptions(),this.startHeartbeat(),r()},this.websocket.onmessage=u=>{this.handleMessage(u)},this.websocket.onclose=u=>{clearTimeout(l),this.handleConnectionClose(u)},this.websocket.onerror=u=>{clearTimeout(l),this.handleConnectionError(u),(this.connectionState==="connecting"||this.connectionState==="reconnecting")&&(this.connectionState="failed",n(new Error("WebSocket connection failed")))}}catch(a){this.connectionState="failed",n(a)}})}buildConnectionUrl(){var n;const r=new URL(this.config.url);if(((n=this.config.auth)==null?void 0:n.type)==="query"){const i=this.config.auth.paramName||"token";r.searchParams.set(i,this.config.auth.credentials)}return r.toString()}authenticateConnection(){if(!(!this.config.auth||this.config.auth.type==="query")&&this.config.auth.type==="bearer"){const r={type:"connection-ready",messageId:this.generateMessageId(),timestamp:Date.now(),data:{auth:{type:"bearer",token:this.config.auth.credentials}}};this.sendMessage(r)}}requestInitialOptions(){const n={type:"search-request",messageId:this.generateMessageId(),timestamp:Date.now(),data:{requestInitial:!0,searchParams:{}}};this.sendMessage(n)}handleMessage(r){try{const n=JSON.parse(r.data);switch(this.logDebug("Message received",{type:n.type,messageId:n.messageId}),n.type){case"search-response":this.handleSearchResponse(n);break;case"options-update":this.handleOptionsUpdate(n);break;case"options-add":this.handleOptionsAdd(n);break;case"options-remove":this.handleOptionsRemove(n);break;case"options-patch":this.handleOptionsPatch(n);break;case"error":this.handleErrorMessage(n);break;case"heartbeat":this.handleHeartbeat(n);break;default:this.logDebug("Unknown message type",{type:n.type})}}catch(n){this.logError("Error parsing WebSocket message",n)}}handleSearchResponse(r){if(!r.messageId){this.logError("Search response missing messageId");return}const n=this.pendingRequests.get(r.messageId);if(!n){this.logDebug("No pending request for messageId",{messageId:r.messageId});return}clearTimeout(n.timeout),this.pendingRequests.delete(r.messageId);try{if(r.error){n.reject(new Error(r.error.message));return}const i=this.transformResponseData(r.data);this.currentOptions=i;const a=this.getCacheKey();a&&this.setWebSocketCachedData(a,i),n.resolve(i),this._updateCallback&&this._updateCallback(i)}catch(i){n.reject(i)}}handleOptionsUpdate(r){try{const n=this.transformResponseData(r.data);this.currentOptions=n;const i=this.getCacheKey();i&&this.setWebSocketCachedData(i,n),this._updateCallback&&this._updateCallback(n),this.logDebug("Options updated",{count:n.length})}catch(n){this.logError("Error handling options update",n)}}handleOptionsAdd(r){try{const n=this.transformResponseData(r.data),i=new Set(this.currentOptions.map(l=>l.value)),a=n.filter(l=>!i.has(l.value));this.currentOptions=[...this.currentOptions,...a];const s=this.getCacheKey();s&&this.setWebSocketCachedData(s,this.currentOptions),this._updateCallback&&this._updateCallback(this.currentOptions),this.logDebug("Options added",{addedCount:a.length})}catch(n){this.logError("Error handling options add",n)}}handleOptionsRemove(r){var n;try{const i=new Set(((n=r.data)==null?void 0:n.values)||[]),a=this.currentOptions.length;this.currentOptions=this.currentOptions.filter(u=>!i.has(u.value));const s=a-this.currentOptions.length,l=this.getCacheKey();l&&this.setWebSocketCachedData(l,this.currentOptions),this._updateCallback&&this._updateCallback(this.currentOptions),this.logDebug("Options removed",{removedCount:s})}catch(i){this.logError("Error handling options remove",i)}}handleOptionsPatch(r){var n;try{const i=((n=r.data)==null?void 0:n.patches)||[];for(const s of i){const l=this.currentOptions.findIndex(u=>u.value===s.value);l!==-1&&(this.currentOptions[l]={...this.currentOptions[l],...s})}const a=this.getCacheKey();a&&this.setWebSocketCachedData(a,this.currentOptions),this._updateCallback&&this._updateCallback(this.currentOptions),this.logDebug("Options patched",{patchCount:i.length})}catch(i){this.logError("Error handling options patch",i)}}handleErrorMessage(r){var i;const n=new Error(((i=r.error)==null?void 0:i.message)||"Unknown server error");if(r.messageId){const a=this.pendingRequests.get(r.messageId);if(a){clearTimeout(a.timeout),this.pendingRequests.delete(r.messageId),a.reject(n);return}}this.logError("Server error message",n)}handleHeartbeat(r){var n;if(((n=r.data)==null?void 0:n.type)==="ping"){const i={type:"heartbeat",messageId:this.generateMessageId(),timestamp:Date.now(),data:{type:"pong"}};this.sendMessage(i)}}handleConnectionClose(r){var n;this.logDebug("WebSocket connection closed",{code:r.code,reason:r.reason}),this.connectionState="disconnected",this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),(n=this.config.connection)!=null&&n.autoReconnect&&r.code!==1e3&&this.scheduleReconnection()}handleConnectionError(r){this.logError("WebSocket connection error",new Error("Connection error")),this.connectionState==="connected"&&(this.connectionState="disconnected")}scheduleReconnection(){var i,a;if(this.reconnectAttempts>=(((i=this.config.connection)==null?void 0:i.maxReconnectAttempts)||5)){this.connectionState="failed",this.logError("Max reconnection attempts exceeded");return}this.reconnectAttempts++,this.connectionState="reconnecting";const r=((a=this.config.connection)==null?void 0:a.reconnectDelay)||1e3,n=Math.min(r*Math.pow(2,this.reconnectAttempts-1),3e4);this.logDebug(`Reconnecting in ${n}ms (attempt ${this.reconnectAttempts})`),setTimeout(()=>{this.connect().catch(s=>{this.logError("Reconnection failed",s),this.scheduleReconnection()})},n)}startHeartbeat(){var n;const r=((n=this.config.connection)==null?void 0:n.heartbeatInterval)||3e4;this.heartbeatInterval=setInterval(()=>{var i;if(((i=this.websocket)==null?void 0:i.readyState)===WebSocket.OPEN){const a={type:"heartbeat",messageId:this.generateMessageId(),timestamp:Date.now(),data:{type:"ping"}};this.sendMessage(a)}},r)}debounceSearch(){var n;this.searchTimeout&&clearTimeout(this.searchTimeout);const r=((n=this.config.messageHandling)==null?void 0:n.searchDebounceMs)||300;this.searchTimeout=setTimeout(()=>{this.connectionState==="connected"&&this.sendSearchRequest()},r)}sendSearchRequest(){const n={type:"search-request",messageId:this.generateMessageId(),timestamp:Date.now(),data:{searchParams:this.currentSearchParams}};this.sendMessage(n)}transformResponseData(r){if(!this.config.responseMapper)return this.validateAndTransformData(r);let n;switch(this.config.responseMapper.type){case"simple":n=this.applySimpleMapper(r,this.config.responseMapper.simple);break;case"nested":n=this.applyNestedMapper(r,this.config.responseMapper.nested);break;case"custom":n=this.config.responseMapper.custom(r);break;default:throw new Error(`Unknown response mapper type: ${this.config.responseMapper.type}`)}return this.validateAndTransformData(n)}applySimpleMapper(r,n){const i=n.arrayPath,a=n.labelField||"label",s=n.valueField||"value",l=n.disabledField||"disabled";let u;if(i){const f=i.split(".");let d=r;for(const p of f)if(d&&typeof d=="object"&&p in d)d=d[p];else throw new Error(`Path "${i}" not found in response data`);u=d}else u=r;if(!Array.isArray(u))throw new Error("Response data is not an array");return u.map((f,d)=>{if(!f||typeof f!="object")throw new Error(`Invalid item at index ${d}: must be an object`);return{label:String(f[a]||""),value:f[s],disabled:!!f[l],metadata:{...f,_index:d}}})}applyNestedMapper(r,n){const{arrayPath:i,paths:a}=n,s=i.split(".");let l=r;for(const u of s)if(l&&typeof l=="object"&&u in l)l=l[u];else throw new Error(`Path "${i}" not found in response data`);if(!Array.isArray(l))throw new Error("Nested response data is not an array");return l.map((u,f)=>{const d=y=>{const _=y.split(".");let w=u;for(const v of _)if(w&&typeof w=="object"&&v in w)w=w[v];else return;return w},p=d(a.value);let m;return typeof p=="string"||typeof p=="number"||typeof p=="boolean"?m=p:m=String(p??""),{label:String(d(a.label??"")),value:m,disabled:a.disabled?!!d(a.disabled):!1,metadata:{description:a.description&&d(a.description)||void 0,_index:f,...u}}})}getWebSocketCachedData(r){try{return super.hasCachedData(r)&&this.currentOptions.length>0?this.currentOptions:null}catch(n){return this.logError("Error retrieving cached data",n),null}}setWebSocketCachedData(r,n){try{this.currentOptions=[...n]}catch(i){this.logError("Error setting cached data",i)}}generateMessageId(){return`ws_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}}function R8(e,t){return new dh(e,t)}const z8={bearer:e=>({type:"bearer",credentials:e}),query:(e,t="token")=>({type:"query",credentials:e,paramName:t}),header:(e,t="Authorization")=>({type:"header",credentials:e,paramName:t})},H8={searchRequest:(e={},t)=>({type:"search-request",messageId:t||`search_${Date.now()}`,timestamp:Date.now(),data:{searchParams:e}}),heartbeatPing:e=>({type:"heartbeat",messageId:e||`heartbeat_${Date.now()}`,timestamp:Date.now(),data:{type:"ping"}}),optionsUpdate:(e,t)=>({type:"options-update",messageId:t||`update_${Date.now()}`,timestamp:Date.now(),data:{options:e}})};class Ye extends Error{constructor(t,r,n,i){super(t),this.path=r,this.index=n,this.originalError=i,this.name="ResponseMappingError"}}function lc(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Lo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function N1(e,t){if(!Lo(e))throw new Ye(`Invalid option at index ${t}: must be an object`,void 0,t);const{label:r,value:n,disabled:i,metadata:a}=e;if(typeof r!="string")throw new Ye(`Invalid label at index ${t}: must be a string, got ${typeof r}`,"label",t);if(n==null)throw new Ye(`Invalid value at index ${t}: cannot be undefined or null`,"value",t);if(!lc(n))throw new Ye(`Invalid value at index ${t}: must be string, number, or boolean, got ${typeof n}`,"value",t);return{label:r,value:n,disabled:!!i,metadata:Lo(a)?a:{}}}function M1(e){if(!Array.isArray(e))throw new Ye("Response must be an array of options");return e.map((t,r)=>N1(t,r))}function _a(e,t){var i;if(!e||typeof e!="object")return;if(!t||t==="")return e;const r=t.split(".");let n=e;for(const a of r){if(n==null)return;const s=a.match(/^(.+)\[(\d+)\]$/);if(s){const[,l,u]=s,f=parseInt(u,10);n=(i=n[l])==null?void 0:i[f]}else n=n[a]}return n}function K8(e,t,r){const n=t.split("."),i={...e};let a=i;for(let s=0;s<n.length-1;s++){const l=n[s];!a[l]||typeof a[l]!="object"?a[l]={}:a[l]=Array.isArray(a[l])?[...a[l]]:{...a[l]},a=a[l]}return a[n[n.length-1]]=r,i}function cc(e,t){if(!t){if(Array.isArray(e))return e;throw new Ye("Response data must be an array when no arrayPath is specified")}const r=_a(e,t);if(!Array.isArray(r))throw new Ye(`Array not found at path: ${t}. Got ${typeof r}`,t);return r}function k1(e,t=ko.simple){const{arrayPath:r,labelField:n="label",valueField:i="value",disabledField:a="disabled"}=t;return cc(e,r).map((l,u)=>{if(!Lo(l))throw new Ye(`Invalid item at index ${u}: must be an object`,void 0,u);const f=l[n],d=l[i],p=a?l[a]:!1;if(typeof f!="string")throw new Ye(`Invalid label at index ${u}: field '${n}' must be a string, got ${typeof f}`,n,u);if(d==null)throw new Ye(`Invalid value at index ${u}: field '${i}' cannot be undefined or null`,i,u);if(!lc(d))throw new Ye(`Invalid value at index ${u}: field '${i}' must be string, number, or boolean, got ${typeof d}`,i,u);return{label:f,value:d,disabled:!!p,metadata:{...l,_index:u}}})}function L1(e,t){if(!t)throw new Ye("Nested mapper configuration is required");const{arrayPath:r,paths:n}=t;if(!n||!n.label||!n.value)throw new Ye("Nested mapper requires paths.label and paths.value to be defined");return cc(e,r).map((a,s)=>{if(!Lo(a))throw new Ye(`Invalid item at index ${s}: must be an object`,void 0,s);const l=_a(a,n.label),u=_a(a,n.value),f=n.disabled?_a(a,n.disabled):!1,d=n.description?_a(a,n.description):void 0;if(typeof l!="string")throw new Ye(`Invalid label at index ${s}: path '${n.label}' must resolve to a string, got ${typeof l}`,n.label,s);if(u==null)throw new Ye(`Invalid value at index ${s}: path '${n.value}' cannot be undefined or null`,n.value,s);if(!lc(u))throw new Ye(`Invalid value at index ${s}: path '${n.value}' must resolve to string, number, or boolean, got ${typeof u}`,n.value,s);return{label:l,value:u,disabled:!!f,metadata:{description:typeof d=="string"?d:void 0,_index:s,_originalData:a}}})}function j1(e){return t=>{try{const r=e(t);if(!Array.isArray(r))throw new Ye("Custom mapper must return an array of ChoiceOption");return M1(r)}catch(r){throw r instanceof Ye?r:new Ye("Custom mapper failed",void 0,void 0,r instanceof Error?r:new Error(String(r)))}}}function G8(e,t){try{switch(t.type){case"simple":return k1(e,t.simple);case"nested":if(!t.nested)throw new Ye("Nested mapper configuration is required for nested type");return L1(e,t.nested);case"custom":if(!t.custom)throw new Ye("Custom mapper function is required for custom type");return j1(t.custom)(e);default:throw new Ye(`Unknown response mapper type: ${t.type}`)}}catch(r){throw r instanceof Ye?r:new Ye("Response mapping failed",void 0,void 0,r instanceof Error?r:new Error(String(r)))}}const Y8={SIMPLE_ARRAY:{type:"simple",simple:{labelField:"label",valueField:"value",disabledField:"disabled"}},NAME_ID:{type:"simple",simple:{labelField:"name",valueField:"id",disabledField:"disabled"}},TITLE_KEY:{type:"simple",simple:{labelField:"title",valueField:"key",disabledField:"disabled"}},TEXT_VALUE:{type:"simple",simple:{labelField:"text",valueField:"value",disabledField:"disabled"}},DISPLAY_CODE:{type:"simple",simple:{labelField:"display",valueField:"code",disabledField:"disabled"}}},J8={DATA_ARRAY:{type:"simple",simple:{arrayPath:"data",labelField:"label",valueField:"value",disabledField:"disabled"}},RESULTS_ARRAY:{type:"simple",simple:{arrayPath:"results",labelField:"name",valueField:"id",disabledField:"disabled"}},ITEMS_ARRAY:{type:"simple",simple:{arrayPath:"items",labelField:"label",valueField:"value",disabledField:"disabled"}},NESTED_DATA_ITEMS:{type:"simple",simple:{arrayPath:"data.items",labelField:"label",valueField:"value",disabledField:"disabled"}},RESPONSE_DATA:{type:"simple",simple:{arrayPath:"response.data",labelField:"name",valueField:"id",disabledField:"disabled"}}};function X8(e){const{invertActive:t=!1}=e;return{type:"custom",custom:r=>cc(r,e.arrayPath).map((i,a)=>{if(!Lo(i))throw new Ye(`Invalid item at index ${a}: must be an object`,void 0,a);const s=i[e.labelField],l=i[e.valueField],u=i[e.activeField];if(typeof s!="string")throw new Ye(`Invalid label at index ${a}: field '${e.labelField}' must be a string`,e.labelField,a);if(!lc(l))throw new Ye(`Invalid value at index ${a}: field '${e.valueField}' must be string, number, or boolean`,e.valueField,a);const f=!!u;return{label:s,value:l,disabled:t?f:!f,metadata:{...i,_index:a,_active:f}}})}}function Z8(e){return t=>{let r=t;for(let n=0;n<e.length;n++){const i=e[n];try{if(n===0){const a=i(r);if(!Array.isArray(a))throw new Error(`Mapper at index ${n} must return an array of ChoiceOption`);r=a}else{const a=i(r);if(!Array.isArray(a))throw new Error(`Mapper at index ${n} must return an array of ChoiceOption`);r=a}}catch(a){throw new Ye(`Pipeline failed at step ${n+1}`,void 0,n,a instanceof Error?a:new Error(String(a)))}}return M1(r)}}function Q8(e){return e.filter(t=>!t.disabled)}function ez(e,t){return[...e].sort((r,n)=>r.label.localeCompare(n.label,t))}function tz(e){return[...e].sort((t,r)=>typeof t.value=="string"&&typeof r.value=="string"?t.value.localeCompare(r.value):typeof t.value=="number"&&typeof r.value=="number"?t.value-r.value:String(t.value).localeCompare(String(r.value)))}function rz(e,t){return e.map(r=>({...r,metadata:{...r.metadata,group:t(r)}}))}function nz(e,t){return e.map((r,n)=>t(r,n))}class uc{constructor(){pe(this,"DefaultLoadingComponent",({message:t,progress:r})=>B.createElement("div",{className:"edf-choice-widget__loading",role:"status","aria-live":"polite"},[B.createElement("span",{key:"spinner",className:"edf-choice-widget__loading-spinner"}),t&&B.createElement("span",{key:"message",className:"edf-choice-widget__loading-message"},t),r!==void 0&&B.createElement("div",{key:"progress",className:"edf-choice-widget__loading-progress"},B.createElement("div",{className:"edf-choice-widget__loading-progress-bar",style:{width:`${r}%`},role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100}))]));pe(this,"DefaultErrorComponent",({message:t,recoverable:r,id:n})=>B.createElement("div",{className:"edf-choice-widget__error",role:"alert",id:n,"aria-live":"assertive"},[B.createElement("span",{key:"icon",className:"edf-choice-widget__error-icon","aria-hidden":!0},"⚠️"),B.createElement("span",{key:"message",className:"edf-choice-widget__error-message"},t),r&&B.createElement("span",{key:"hint",className:"edf-choice-widget__error-hint"},"Please try again")]));pe(this,"DefaultEmptyComponent",({message:t})=>B.createElement("div",{className:"edf-choice-widget__empty",role:"status"},[B.createElement("span",{key:"icon",className:"edf-choice-widget__empty-icon","aria-hidden":!0},"📭"),B.createElement("span",{key:"message",className:"edf-choice-widget__empty-message"},t||"No options available")]))}getAccessibilityProps(t,r,n){const{id:i,label:a,required:s,readonly:l,disabled:u,schema:f}=t,{error:d,loading:p}=r,m={"aria-label":(n==null?void 0:n.ariaLabel)||a||(f==null?void 0:f.title)||"Select an option","aria-required":s||!1,"aria-readonly":l||!1,"aria-disabled":u||!1,"aria-invalid":d.hasError,"aria-busy":p.isLoading,id:i,role:this.getAriaRole()};if(d.hasError&&d.message&&(m["aria-errormessage"]=`${i}-error`,m["aria-describedby"]=`${i}-error`),n!=null&&n.ariaDescription){const y=m["aria-describedby"];m["aria-describedby"]=y?`${y} ${i}-description`:`${i}-description`}return n!=null&&n.announceChanges&&(m["aria-live"]="polite",m["aria-atomic"]=!0),n!=null&&n.ariaAttributes&&Object.entries(n.ariaAttributes).forEach(([y,_])=>{(y.startsWith("aria-")||y==="role")&&(m[y]=_)}),m}handleKeyboardNavigation(t,r,n,i){var d;const{filteredOptions:a,focusedOptionIndex:s}=n,{keyboard:l}=((d=r.options.choiceConfig)==null?void 0:d.accessibility)||{};if(!(l!=null&&l.arrowKeys)&&!(l!=null&&l.homeEnd)&&!(l!=null&&l.typeAhead))return;const{key:u}=t,f=a.length;switch(u){case"ArrowDown":if(l!=null&&l.arrowKeys){t.preventDefault();const p=(s+1)%f;i.setFocusedIndex(p)}break;case"ArrowUp":if(l!=null&&l.arrowKeys){t.preventDefault();const p=s<=0?f-1:s-1;i.setFocusedIndex(p)}break;case"Home":l!=null&&l.homeEnd&&(t.preventDefault(),i.setFocusedIndex(0));break;case"End":l!=null&&l.homeEnd&&(t.preventDefault(),i.setFocusedIndex(f-1));break;case"Enter":case" ":if(s>=0&&s<f){t.preventDefault();const p=a[s];p.disabled||i.selectOption(p)}break;case"Escape":i.toggleDropdown&&(t.preventDefault(),i.toggleDropdown(!1));break;default:l!=null&&l.typeAhead&&u.length===1&&/\S/.test(u)&&this.handleTypeAhead(u,n,i);break}}handleTypeAhead(t,r,n){const{filteredOptions:i,focusedOptionIndex:a}=r,s=t.toLowerCase(),l=a+1;for(let u=0;u<i.length;u++){const f=(l+u)%i.length,d=i[f];if(d.label.toLowerCase().startsWith(s)&&!d.disabled){n.setFocusedIndex(f);break}}}getLoadingProps(t,r){return{component:r||this.DefaultLoadingComponent,props:t}}getErrorProps(t,r,n){return{component:r||this.DefaultErrorComponent,props:{...t,id:n?`${n}-error`:void 0}}}getEmptyProps(t,r){return{component:r||this.DefaultEmptyComponent,props:{message:t||"No options available"}}}normalizeValue(t,r){return t==null?[]:r?Array.isArray(t)?t.filter(n=>n!=null):[t]:Array.isArray(t)?t.length>0?[t[0]]:[]:[t]}denormalizeValue(t,r){return r?t:t.length>0?t[0]:void 0}getThemeClasses(t,r){return["edf-choice-widget",`edf-choice-widget--${this.presentationMode}`,t.size&&`edf-choice-widget--${t.size}`,t.disabled&&"edf-choice-widget--disabled",t.readonly&&"edf-choice-widget--readonly",t.className,r].filter(Boolean).join(" ")}getThemeStyles(t,r){return{...t.style,...r}}createEventHandlers(t,r,n,i){return{fieldId:t,schema:r,formData:n,fieldPath:i,_hookRequired:!0}}validateSelection(t,r,n){var d,p,m;const{validation:i,multiple:a,minSelections:s,maxSelections:l}=n;if(t.length===0&&((d=i==null?void 0:i.messages)!=null&&d.required))return i.messages.required;if(a){if(s&&t.length<s)return`Please select at least ${s} option${s>1?"s":""}`;if(l&&t.length>l)return`Please select at most ${l} option${l>1?"s":""}`}if(i!=null&&i.validator){const y=i.validator(t,r);if(y)return((p=i.messages)==null?void 0:p.custom)||y}const u=r.map(y=>y.value);return t.filter(y=>!u.includes(y)).length>0?((m=i==null?void 0:i.messages)==null?void 0:m.invalid)||"Invalid selection":null}getAntdSize(t){return t||"middle"}isSelected(t,r){return r.includes(t)}filterOptions(t,r,n){if(!(n!=null&&n.enabled)||!r||r.length<(n.minLength||1))return t;const i=n.caseSensitive?r:r.toLowerCase(),a=n.searchFields||["label"];return t.filter(s=>n.customFilter?n.customFilter(s,r):a.some(l=>{var d;let u;switch(l){case"label":u=s.label;break;case"value":u=String(s.value);break;case"description":u=(d=s.metadata)==null?void 0:d.description;break}return u?(n.caseSensitive?u:u.toLowerCase()).includes(i):!1}))}}var fc={exports:{}};/**
82
+ }`)),B.useEffect(function(){var l=t.current,u=HR(l);RR(s,"@ant-design-icons",{prepend:!a,csp:n,attachTo:u})},[])},r8=["icon","className","onClick","style","primaryColor","secondaryColor"],Po={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};function n8(e){var t=e.primaryColor,r=e.secondaryColor;Po.primaryColor=t,Po.secondaryColor=r||e1(t),Po.calculated=!!r}function i8(){return rn({},Po)}var va=function(t){var r=t.icon,n=t.className,i=t.onClick,a=t.style,s=t.primaryColor,l=t.secondaryColor,u=N_(t,r8),f=at.useRef(),d=Po;if(s&&(d={primaryColor:s,secondaryColor:l||e1(s)}),t8(f),QR(Z_(r),"icon should be icon definiton, but got ".concat(r)),!Z_(r))return null;var p=r;return p&&typeof p.icon=="function"&&(p=rn(rn({},p),{},{icon:p.icon(d.primaryColor,d.secondaryColor)})),Xd(p.icon,"svg-".concat(p.name),rn(rn({className:n,onClick:i,style:a,"data-icon":p.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},u),{},{ref:f}))};va.displayName="IconReact",va.getTwoToneColors=i8,va.setTwoToneColors=n8;function r1(e){var t=t1(e),r=F_(t,2),n=r[0],i=r[1];return va.setTwoToneColors({primaryColor:n,secondaryColor:i})}function a8(){var e=va.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor}var o8=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];r1(Ao.primary);var $r=at.forwardRef(function(e,t){var r=e.className,n=e.icon,i=e.spin,a=e.rotate,s=e.tabIndex,l=e.onClick,u=e.twoToneColor,f=N_(e,o8),d=at.useContext(x_),p=d.prefixCls,m=p===void 0?"anticon":p,y=d.rootClassName,_=Il(y,m,Kt(Kt({},"".concat(m,"-").concat(n.name),!!n.name),"".concat(m,"-spin"),!!i||n.name==="loading"),r),w=s;w===void 0&&l&&(w=-1);var v=a?{msTransform:"rotate(".concat(a,"deg)"),transform:"rotate(".concat(a,"deg)")}:void 0,g=t1(u),C=F_(g,2),S=C[0],E=C[1];return at.createElement("span",_r({role:"img","aria-label":n.name},f,{ref:t,tabIndex:w,onClick:l,className:_}),at.createElement(va,{icon:n,primaryColor:S,secondaryColor:E,style:v}))});$r.displayName="AntdIcon",$r.getTwoToneColor=a8,$r.setTwoToneColor=r1;var s8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},l8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:s8}))},Zd=at.forwardRef(l8);process.env.NODE_ENV!=="production"&&(Zd.displayName="CheckOutlined");var c8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},u8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:c8}))},n1=at.forwardRef(u8);process.env.NODE_ENV!=="production"&&(n1.displayName="DeleteOutlined");var f8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},d8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:f8}))},i1=at.forwardRef(d8);process.env.NODE_ENV!=="production"&&(i1.displayName="DownOutlined");var h8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},p8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:h8}))},Qd=at.forwardRef(p8);process.env.NODE_ENV!=="production"&&(Qd.displayName="LeftOutlined");var m8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M904 160H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0 624H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8zm0-312H120c-4.4 0-8 3.6-8 8v64c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-64c0-4.4-3.6-8-8-8z"}}]},name:"menu",theme:"outlined"},g8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:m8}))},a1=at.forwardRef(g8);process.env.NODE_ENV!=="production"&&(a1.displayName="MenuOutlined");var y8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},v8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:y8}))},o1=at.forwardRef(v8);process.env.NODE_ENV!=="production"&&(o1.displayName="PlusOutlined");var b8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},_8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:b8}))},eh=at.forwardRef(_8);process.env.NODE_ENV!=="production"&&(eh.displayName="RightOutlined");var $8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},w8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:$8}))},s1=at.forwardRef(w8);process.env.NODE_ENV!=="production"&&(s1.displayName="UpOutlined");var S8={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},C8=function(t,r){return at.createElement($r,_r({},t,{ref:r,icon:S8}))},l1=at.forwardRef(C8);process.env.NODE_ENV!=="production"&&(l1.displayName="UploadOutlined");function c1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=c1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function E8(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=c1(e))&&(n&&(n+=" "),n+=t);return n}const u1=e=>{const{canAdd:t,disabled:r,idSchema:n,uiSchema:i,items:a,onAddClick:s,readonly:l,registry:u,required:f,schema:d,title:p}=e,m=we(i),y=Se("ArrayFieldDescriptionTemplate",u,m),_=Se("ArrayFieldItemTemplate",u,m),w=Se("ArrayFieldTitleTemplate",u,m),v=p||m.title?$.jsxs($.Fragment,{children:[$.jsx(w,{idSchema:n,title:m.title||p,required:f,schema:d,uiSchema:i,registry:u}),(m.description||d.description)&&$.jsx("div",{style:{marginTop:"8px"},children:$.jsx(y,{idSchema:n,description:m.description||d.description,schema:d,uiSchema:i,registry:u})})]}):void 0;return $.jsx("div",{className:E8("rjsf-array-field",m.classNames),children:$.jsx(re.Card,{title:v,style:{borderColor:"#e2e8f0"},children:$.jsxs(re.Space,{direction:"vertical",style:{width:"100%"},size:"middle",children:[a&&a.map(({key:g,...C})=>$.jsx(_,{...C},g)),t&&$.jsxs(re.Button,{type:"dashed",onClick:s,disabled:r||l,size:"small",block:!0,icon:$.jsx(o1,{}),children:["Add ",p||"Item"]})]})})})},f1=e=>{const{children:t,disabled:r,hasToolbar:n,buttonsProps:i,readonly:a}=e,{hasMoveDown:s,hasMoveUp:l,hasRemove:u,index:f,onDropIndexClick:d,onReorderClick:p}=i,m=n?$.jsxs(re.Space,{size:"small",children:[(l||s)&&$.jsx(a1,{style:{color:"#94a3b8",fontSize:"16px"}}),l&&$.jsx(re.Button,{type:"text",size:"small",disabled:r||a,onClick:p(f,f-1),icon:$.jsx(s1,{}),title:"Move up"}),s&&$.jsx(re.Button,{type:"text",size:"small",disabled:r||a,onClick:p(f,f+1),icon:$.jsx(i1,{}),title:"Move down"}),u&&$.jsx(re.Button,{type:"text",size:"small",danger:!0,disabled:r||a,onClick:d(f),icon:$.jsx(n1,{}),title:"Remove"})]}):null;return $.jsx(re.Card,{style:{borderColor:"#e2e8f0",position:"relative"},extra:m,bodyStyle:{padding:"16px"},children:$.jsx("div",{style:n?{paddingRight:"96px"}:void 0,children:t})})},d1=({currentStep:e,totalSteps:t,progressPercentage:r,className:n,style:i})=>$.jsxs("div",{className:n,style:{...i},children:[$.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"14px",marginBottom:"12px"},children:[$.jsxs("span",{style:{fontWeight:500,color:"#374151"},children:["Step ",e," of ",t]}),$.jsxs("span",{style:{fontWeight:500,color:"#374151"},children:[r,"% Complete"]})]}),$.jsx(re.Progress,{percent:r,showInfo:!1,strokeColor:"#1f2937",trailColor:"#e5e7eb"})]}),h1=({steps:e,currentStep:t,onStepChange:r,className:n,style:i})=>{const a=l=>{r&&!e[l].disabled&&r(l)},s=(l,u,f)=>l?{backgroundColor:"#1f2937",borderColor:"#1f2937",color:"white"}:u&&!l?{backgroundColor:"#f0fdf4",borderColor:"#86efac",color:"#15803d"}:f?{backgroundColor:"#f3f4f6",borderColor:"#f3f4f6",color:"#9ca3af",cursor:"not-allowed"}:{};return $.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",overflowX:"auto",...i},className:n,children:e.map((l,u)=>{const f=u===t,d=l.completed,p=l.disabled,m=l.icon;return $.jsxs(re.Button,{type:f?"primary":"default",size:"small",onClick:()=>a(u),disabled:p,style:{borderRadius:"9999px",display:"flex",alignItems:"center",gap:"8px",...s(f,d||!1,p||!1)},icon:m?$.jsx(m,{className:""}):void 0,children:[$.jsx("span",{style:{fontWeight:500,fontSize:"14px",whiteSpace:"nowrap"},children:l.title}),d&&!f&&$.jsx(re.Badge,{count:$.jsx(Zd,{style:{fontSize:"10px",color:"#15803d"}}),style:{backgroundColor:"#dcfce7",marginLeft:"4px"}})]},l.id)})})},p1=({onPrevious:e,onNext:t,onSubmit:r,canGoNext:n=!0,canGoPrevious:i=!0,isLastStep:a=!1,submitLabel:s="Submit",nextLabel:l="Next",previousLabel:u="Previous",className:f,style:d})=>{const p=()=>{a&&r?r():t&&t()};return $.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",...d},className:f,children:[$.jsx(re.Button,{onClick:e,disabled:!i||!e,icon:$.jsx(Qd,{}),children:u}),$.jsxs(re.Button,{type:a?"primary":"default",onClick:p,disabled:!n,style:a?{backgroundColor:"#52c41a",borderColor:"#52c41a"}:void 0,children:[a?s:l,!a&&$.jsx(eh,{})]})]})},O8=({title:e,subtitle:t,steps:r,currentStep:n,children:i,onStepChange:a,onPrevious:s,onNext:l,onSubmit:u,canGoNext:f=!0,canGoPrevious:d=!0,isLastStep:p=!1,submitLabel:m="Submit",nextLabel:y="Next",previousLabel:_="Previous",className:w})=>{const v=r.filter(S=>S.completed).length,g=r.length,C=Math.round(v/g*100);return $.jsx("div",{className:w,style:{minHeight:"100vh",backgroundColor:"#f5f5f5",padding:"32px 0"},children:$.jsxs("div",{style:{maxWidth:"896px",margin:"0 auto",padding:"0 16px"},children:[$.jsxs("div",{style:{textAlign:"center",marginBottom:"32px"},children:[$.jsx("h1",{style:{fontSize:"30px",fontWeight:"bold",color:"#1f2937",marginBottom:"8px"},children:e}),t&&$.jsx("p",{style:{fontSize:"16px",color:"#6b7280",marginBottom:"32px"},children:t}),$.jsx("div",{style:{marginBottom:"32px"},children:$.jsx(d1,{currentStep:n+1,totalSteps:g,progressPercentage:C})}),$.jsx("div",{style:{marginBottom:"32px"},children:$.jsx(h1,{steps:r,currentStep:n,onStepChange:a})})]}),$.jsx("div",{style:{backgroundColor:"white",borderRadius:"8px",boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)",border:"1px solid #e5e7eb",padding:"32px",marginBottom:"32px"},children:i}),$.jsx(p1,{onPrevious:s,onNext:l,onSubmit:u,canGoNext:f,canGoPrevious:d,isLastStep:p,submitLabel:m,nextLabel:y,previousLabel:_})]})})},m1=({title:e,description:t,properties:r,required:n,uiSchema:i,idSchema:a,schema:s,registry:l})=>{const u=we(i),f=Se("TitleFieldTemplate",l,u),d=Se("DescriptionFieldTemplate",l,u),p=e&&e!==s.title,m=u.icon,y=u.columns||1,_=u.sectionClass||"",w=()=>{switch(y){case 2:return"repeat(2, 1fr)";case 3:return"repeat(3, 1fr)";case 4:return"repeat(4, 1fr)";default:return"1fr"}};return $.jsxs("div",{className:_,style:{display:"flex",flexDirection:"column",gap:"24px"},children:[p&&$.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m&&B.createElement(m,{className:""}),$.jsx(f,{id:a.$id,title:e,required:n,schema:s,uiSchema:i,registry:l})]}),t&&$.jsx(d,{id:a.$id,description:t,schema:s,uiSchema:i,registry:l})]}),$.jsx("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:w()},children:r.map(v=>{const g=v.name==="description"||v.name==="notes"||v.name==="primaryActivity"||v.name==="residentialAddress";return $.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",gridColumn:g?"1 / -1":void 0},children:v.content},v.name)})})]})},g1=({title:e,description:t,properties:r,uiSchema:n,schema:i,sectionTitle:a,sectionDescription:s,sectionIcon:l})=>{const u=we(n),f=a||e,d=s||t,p=u.columns||1;return $.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[f&&$.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[l&&$.jsx(l,{className:""}),$.jsx("h2",{style:{fontSize:"20px",fontWeight:600,color:"#111827",margin:0},children:f})]}),d&&$.jsx("p",{style:{fontSize:"14px",color:"#6b7280",margin:0},children:d})]}),e&&e!==f&&$.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",borderBottom:"1px solid #e5e7eb",paddingBottom:"16px"},children:[$.jsx("h3",{style:{fontSize:"18px",fontWeight:500,color:"#111827",margin:0},children:e}),t&&$.jsx("p",{style:{fontSize:"14px",color:"#6b7280",margin:0},children:t})]}),$.jsx("div",{style:{display:"grid",gap:"24px",gridTemplateColumns:p===1?"1fr":p===2?"repeat(2, 1fr)":"repeat(3, 1fr)",gridAutoRows:"min-content"},children:r.map(m=>{var v,g,C,S,E,A;const y=(v=i.properties)==null?void 0:v[m.name],_=y&&typeof y=="object"&&"type"in y&&y.type==="array",w=((g=m.name)==null?void 0:g.includes("address"))||((C=m.name)==null?void 0:C.includes("description"))||((S=m.name)==null?void 0:S.includes("notes"))||((E=m.name)==null?void 0:E.includes("Activity"))||_||((A=n==null?void 0:n[m.name])==null?void 0:A["ui:widget"])==="textarea";return $.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px",gridColumn:w&&p>1?"1 / -1":void 0},children:m.content},m.name)})})]})},y1=({uiSchema:e,...t})=>{const{submitText:r,norender:n,props:i={}}=jd(e);return n?null:$.jsx("div",{style:{display:"flex",justifyContent:"flex-end",paddingTop:"16px",borderTop:"1px solid #d9d9d9"},children:$.jsx(re.Button,{type:"primary",htmlType:"submit",size:"large",style:{minWidth:"96px"},...i,...t,children:r||"Submit"})})},v1=({id:e,children:t,displayLabel:r,rawErrors:n=[],errors:i,help:a,description:s,rawDescription:l,classNames:u,style:f,disabled:d,label:p,hidden:m,readonly:y,required:_,schema:w,uiSchema:v,registry:g})=>{var Y;const C=we(v),S=Se("WrapIfAdditionalTemplate",g,C);if(m)return $.jsx("div",{style:{display:"none"},children:t});const E=n.length>0?"error":void 0,x=a&&((Y=a.props)==null?void 0:Y.help)?a:r&&l?s:void 0,N=n.length>0?i:void 0;return $.jsx(S,{classNames:u,style:f,disabled:d,id:e,label:p,onDropPropertyClick:K=>()=>{},onKeyChange:K=>()=>{},readonly:y,required:_,schema:w,uiSchema:v,registry:g,children:$.jsxs(re.Form.Item,{label:r?p:void 0,required:_,validateStatus:E,help:x,labelCol:{span:24},wrapperCol:{span:24},style:{...f},className:`${u||""} vertical-form-item`,children:[t,N]})})},b1={address:jg,phone:Bg,currency:Ug},th={FieldTemplate:v1,ArrayFieldTemplate:u1,ArrayFieldItemTemplate:f1,WizardObjectFieldTemplate:m1,WizardSectionTemplate:g1,ButtonTemplates:{SubmitButton:y1}},_1=({id:e,value:t,required:r,disabled:n,readonly:i,onChange:a,onBlur:s,onFocus:l,schema:u})=>{const f=ht(e,u),d=async y=>{const _=y.target.value;a(_),await f.onChange(_)},p=async y=>{const _=y.target.value;s&&s(e,_),await f.onBlur(_)},m=async y=>{const _=y.target.value;l&&l(e,_),await f.onFocus(_)};return $.jsx(re.Input,{id:e,type:"color",value:t||"#000000",required:r,disabled:n||i,onChange:d,onBlur:p,onFocus:m,style:{height:"40px",width:"100%",cursor:"pointer"}})},Io=(e={})=>{const{emptyValue:t,size:r,placeholder:n,prefix:i,suffix:a,allowClear:s,bordered:l,variant:u,defaultValue:f,maxLength:d,showCount:p,status:m,style:y,className:_,addonBefore:w,addonAfter:v,...g}=e;let C=u;return l!==void 0&&!u&&(C=l?"outlined":"borderless"),{size:r,placeholder:n,prefix:i,suffix:a,allowClear:s,variant:C,defaultValue:f,maxLength:d,showCount:p,status:m,style:y,className:_,addonBefore:w,addonAfter:v,...g}},A8=(e={})=>{const{emptyValue:t,rows:r,autoSize:n,size:i,placeholder:a,allowClear:s,bordered:l,variant:u,defaultValue:f,maxLength:d,showCount:p,status:m,style:y,className:_,prefix:w,suffix:v,addonBefore:g,addonAfter:C,...S}=e;let E=u;return l!==void 0&&!u&&(E=l?"outlined":"borderless"),{size:i,placeholder:a,allowClear:s,variant:E,defaultValue:f,maxLength:d,showCount:p,status:m,style:y,className:_,rows:r,autoSize:n,...S}},$1=(e={})=>{const{emptyValue:t,format:r,picker:n,placeholder:i,placement:a,showTime:s,showNow:l,showToday:u,disabledDate:f,size:d,bordered:p,variant:m,suffixIcon:y,style:_,className:w,status:v,...g}=e;let C=m;p!==void 0&&!m&&(C=p?"outlined":"borderless");const S={format:r,picker:n,placement:a,showTime:s,showNow:l,showToday:u,disabledDate:f,size:d,variant:C,suffixIcon:y,style:_,className:w,status:v,...g};return i&&(S.placeholder=i),S},T8=(e={})=>{const{emptyValue:t,size:r,placeholder:n,prefix:i,min:a,max:s,step:l,precision:u,decimalSeparator:f,formatter:d,parser:p,keyboard:m,controls:y,bordered:_,variant:w,style:v,className:g,status:C,addonBefore:S,addonAfter:E,...A}=e;let x=w;return _!==void 0&&!w&&(x=_?"outlined":"borderless"),{size:r,placeholder:n,prefix:i,min:a,max:s,step:l,precision:u,decimalSeparator:f,formatter:d,parser:p,keyboard:m,controls:y,variant:x,style:v,className:g,status:C,addonBefore:S,addonAfter:E,...A}},nn=e=>(e||[]).length>0,xo=(e,t="")=>(e==null?void 0:e.emptyValue)!==void 0?e.emptyValue:t,rh=(e,t,r="")=>e===""||e===null||e===void 0?xo(t,r):e,P8=(e={})=>({min:e.minimum,max:e.maximum,step:e.multipleOf}),nc=(e,t=!1)=>typeof e=="string"?e.toLowerCase()==="true":typeof e=="boolean"?e:t,nh=({id:e,value:t,disabled:r,readonly:n,onChange:i,onBlur:a,onFocus:s,options:l,schema:u,label:f,required:d})=>{const p=u.minimum||0,m=u.maximum||100,y=l.step!==void 0?l.step:u.multipleOf||1,_=ht(e,u),w=l.marks,v=nc(l.dots,!1),g=l.included!==!1,C=nc(l.vertical,!1),S=nc(l.range,!1),E=l.tooltip||{},A=l.trackStyle,x=l.handleStyle,N=l.style,Y=l.onAfterChange,ae={id:e,min:p,max:m,value:t!==void 0?t:S?[p,m]:p,onChange:async k=>{i(k),await _.onChange(k)},onAfterChange:k=>{a&&a(e,k),Y&&Y(k)},onFocus:async()=>{s==null||s(e,t),await _.onFocus(t)},onBlur:async()=>{a==null||a(e,t),await _.onBlur(t)},disabled:r||n,vertical:C,range:S,dots:v,included:g,style:N};y!==null&&(ae.step=y),w!==void 0&&(ae.marks=w),E&&(ae.tooltip=E),A&&(ae.trackStyle=A),x&&(ae.handleStyle=x);const Q=()=>S&&Array.isArray(t)?`${t[0]} - ${t[1]}`:t!==void 0?t:p;return $.jsxs("div",{style:{marginBottom:"16px"},children:[(f||u.title)&&$.jsxs("label",{htmlFor:e,style:{display:"block",marginBottom:"4px",fontWeight:500},children:[f||u.title,d&&$.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}),u.description&&$.jsx("div",{style:{marginBottom:"4px",color:"#666",fontSize:"14px"},children:u.description}),!C&&!l.hideValue&&$.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",marginBottom:"8px"},children:$.jsx("span",{style:{fontSize:"14px",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:Q()})}),$.jsx(re.Slider,{...ae})]})},w1=({id:e,value:t,required:r,disabled:n,readonly:i,label:a,onChange:s,onFocus:l,onBlur:u,options:f,schema:d})=>{const p=ht(e,d),m=async Y=>{s(Y),await p.onChange(Y)},y=async()=>{l==null||l(e,t),await p.onFocus(t)},_=async()=>{u==null||u(e,t),await p.onBlur(t)},w=Number(f.count||f.max||d.maximum||5),v=nc(f.allowHalf,!1),g=f.allowClear!==!1,C=f.character,S=f.tooltips,E=f.style,A=f.onHoverChange,x={value:t||0,onChange:m,onFocus:y,onBlur:_,disabled:n||i,count:w,allowHalf:v,allowClear:r?!1:g,style:E};C&&(x.character=C),A&&(x.onHoverChange=A);const N=()=>S&&S.length>0?$.jsx(re.Rate,{...x,tooltips:S}):$.jsx(re.Rate,{...x});return $.jsxs("div",{style:{marginBottom:"16px"},children:[(a||d.title)&&$.jsxs("label",{htmlFor:e,style:{display:"block",marginBottom:"4px",fontWeight:500},children:[a||d.title,r&&$.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}),d.description&&$.jsx("div",{style:{marginBottom:"4px",color:"#666",fontSize:"14px"},children:d.description}),N()]})},ic=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d,schema:p,rawErrors:m=[]}=e,y=ht(t,p),_=A=>{const x=A===null?xo(d,void 0):A;l(x),y.onChange(x).catch(console.error)},w=async()=>{u&&u(t,r),await y.onBlur(r)},v=async()=>{f&&f(t,r),await y.onFocus(r)},g=nn(m),C=P8(p),S=T8(d),E={...S,min:S.min??C.min,max:S.max??C.max,step:S.step??C.step};return $.jsx(re.InputNumber,{id:t,value:r??void 0,placeholder:s||E.placeholder,required:n,disabled:i,readOnly:a,onChange:_,onBlur:w,onFocus:v,status:g?"error":void 0,style:{width:"100%",...E.style},...E})},ac=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d,rawErrors:p=[],schema:m}=e,y=ht(t,m),_=async S=>{const E=rh(S.target.value,d);l(E),await y.onChange(E)},w=async S=>{const E=S.target.value;u&&u(t,E),await y.onBlur(E)},v=async S=>{const E=S.target.value;f&&f(t,E),await y.onFocus(E)},g=nn(p),C=Io(d);return $.jsx(re.Input,{id:t,type:"tel",value:r||"",placeholder:s||C.placeholder||"Enter phone number",required:n,disabled:i,readOnly:a,onChange:_,onBlur:w,onFocus:v,"aria-invalid":g,status:g?"error":void 0,...C})},ih=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d,rawErrors:p=[],schema:m}=e,y=ht(t,m),_=async S=>{const E=rh(S.target.value,d);l(E),await y.onChange(E)},w=async S=>{const E=S.target.value;u&&u(t,E),await y.onBlur(E)},v=async S=>{const E=S.target.value;f&&f(t,E),await y.onFocus(E)},g=nn(p),C=Io(d);return $.jsx(re.Input,{id:t,type:"email",value:r||"",placeholder:s||C.placeholder||"Enter email address",required:n,disabled:i,readOnly:a,onChange:_,onBlur:w,onFocus:v,"aria-invalid":g,status:g?"error":void 0,...C})},ah=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d,rawErrors:p=[],schema:m}=e,y=ht(t,m),_=async S=>{const E=rh(S.target.value,d);l(E),await y.onChange(E)},w=async S=>{const E=S.target.value;u&&u(t,E),await y.onBlur(E)},v=async S=>{const E=S.target.value;f&&f(t,E),await y.onFocus(E)},g=nn(p),C=Io(d);return $.jsx(re.Input,{id:t,type:"url",value:r||"",placeholder:s||C.placeholder||"Enter URL",required:n,disabled:i,readOnly:a,onChange:_,onBlur:w,onFocus:v,"aria-invalid":g,status:g?"error":void 0,...C})},Do=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d={},rawErrors:p=[],schema:m}=e,y=ht(t,m),_=nn(p),w=async S=>{const E=S.target.value===""?xo(d):S.target.value;l(E),await y.onChange(E)},v=async S=>{const E=S.target.value;u&&u(t,E),await y.onBlur(E)},g=async S=>{const E=S.target.value;f&&f(t,E),await y.onFocus(E)},C=Io(d);return $.jsx(re.Input,{id:t,value:r||"",placeholder:s||C.placeholder,required:n,disabled:i,readOnly:a,onChange:w,onBlur:v,onFocus:g,status:_?"error":C.status,...C})},S1=Object.freeze(Object.defineProperty({__proto__:null,TextWidget:Do,default:Do},Symbol.toStringTag,{value:"Module"})),{TextArea:I8}=re.Input,Fo=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d={},rawErrors:p=[],schema:m}=e,y=ht(t,m),_=nn(p),w=async E=>{const A=E.target.value===""?xo(d):E.target.value;l(A),await y.onChange(A)},v=async E=>{const A=E.target.value;u&&u(t,A),await y.onBlur(A)},g=async E=>{const A=E.target.value;f&&f(t,A),await y.onFocus(A)},C=A8(d),S=C.rows||4;return $.jsx(I8,{id:t,value:r||"",placeholder:s||C.placeholder,required:n,disabled:i,readOnly:a,onChange:w,onBlur:v,onFocus:g,status:_?"error":C.status,style:{resize:"vertical",...C.style},...C,rows:S})},C1=Object.freeze(Object.defineProperty({__proto__:null,TextareaWidget:Fo,default:Fo},Symbol.toStringTag,{value:"Module"})),No=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,placeholder:s,onChange:l,onBlur:u,onFocus:f,options:d={},rawErrors:p=[],schema:m}=e,y=ht(t,m),_=nn(p),w=async A=>{const x=A.target.value===""?xo(d):A.target.value;l(x),await y.onChange(x)},v=async A=>{const x=A.target.value;u&&u(t,x),await y.onBlur(x)},g=async A=>{const x=A.target.value;f&&f(t,x),await y.onFocus(x)},C=Io(d),{visibilityToggle:S=!0,iconRender:E}=d;return $.jsx(re.Input.Password,{id:t,value:r||"",placeholder:s||C.placeholder||"Enter password",required:n,disabled:i,readOnly:a,onChange:w,onBlur:v,onFocus:g,status:_?"error":C.status,visibilityToggle:S,iconRender:E,...C})},E1=Object.freeze(Object.defineProperty({__proto__:null,PasswordWidget:No,default:No},Symbol.toStringTag,{value:"Module"})),x8=({id:e,value:t,required:r,disabled:n,readonly:i,label:a,onChange:s,onBlur:l,onFocus:u,options:f,schema:d})=>{const p=f.inputType||"date",m=ht(e,d),y=async v=>{const g=v.target.value;s(g),await m.onChange(g)},_=async v=>{const g=v.target.value;l&&l(e,g),await m.onBlur(g)},w=async v=>{const g=v.target.value;u&&u(e,g),await m.onFocus(g)};return $.jsxs("div",{style:{marginBottom:"16px"},children:[$.jsxs("label",{htmlFor:e,style:{display:"block",marginBottom:"4px",fontWeight:500},children:[a||d.title,r&&$.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}),$.jsx(re.Input,{id:e,type:p,value:t||"",required:r,disabled:n||i,onChange:y,onBlur:_,onFocus:w,min:typeof f.minDate=="string"||typeof f.minDate=="number"?f.minDate:void 0,max:typeof f.maxDate=="string"||typeof f.maxDate=="number"?f.maxDate:void 0,style:{width:"100%"}})]})};var O1={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(Nr,function(){var r=1e3,n=6e4,i=36e5,a="millisecond",s="second",l="minute",u="hour",f="day",d="week",p="month",m="quarter",y="year",_="date",w="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(Q){var k=["th","st","nd","rd"],W=Q%100;return"["+Q+(k[(W-20)%10]||k[W]||k[0])+"]"}},S=function(Q,k,W){var q=String(Q);return!q||q.length>=k?Q:""+Array(k+1-q.length).join(W)+Q},E={s:S,z:function(Q){var k=-Q.utcOffset(),W=Math.abs(k),q=Math.floor(W/60),L=W%60;return(k<=0?"+":"-")+S(q,2,"0")+":"+S(L,2,"0")},m:function Q(k,W){if(k.date()<W.date())return-Q(W,k);var q=12*(W.year()-k.year())+(W.month()-k.month()),L=k.clone().add(q,p),X=W-L<0,j=k.clone().add(q+(X?-1:1),p);return+(-(q+(W-L)/(X?L-j:j-L))||0)},a:function(Q){return Q<0?Math.ceil(Q)||0:Math.floor(Q)},p:function(Q){return{M:p,y,w:d,d:f,D:_,h:u,m:l,s,ms:a,Q:m}[Q]||String(Q||"").toLowerCase().replace(/s$/,"")},u:function(Q){return Q===void 0}},A="en",x={};x[A]=C;var N="$isDayjsObject",Y=function(Q){return Q instanceof ee||!(!Q||!Q[N])},K=function Q(k,W,q){var L;if(!k)return A;if(typeof k=="string"){var X=k.toLowerCase();x[X]&&(L=X),W&&(x[X]=W,L=X);var j=k.split("-");if(!L&&j.length>1)return Q(j[0])}else{var D=k.name;x[D]=k,L=D}return!q&&L&&(A=L),L||!q&&A},H=function(Q,k){if(Y(Q))return Q.clone();var W=typeof k=="object"?k:{};return W.date=Q,W.args=arguments,new ee(W)},te=E;te.l=K,te.i=Y,te.w=function(Q,k){return H(Q,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var ee=function(){function Q(W){this.$L=K(W.locale,null,!0),this.parse(W),this.$x=this.$x||W.x||{},this[N]=!0}var k=Q.prototype;return k.parse=function(W){this.$d=function(q){var L=q.date,X=q.utc;if(L===null)return new Date(NaN);if(te.u(L))return new Date;if(L instanceof Date)return new Date(L);if(typeof L=="string"&&!/Z$/i.test(L)){var j=L.match(v);if(j){var D=j[2]-1||0,z=(j[7]||"0").substring(0,3);return X?new Date(Date.UTC(j[1],D,j[3]||1,j[4]||0,j[5]||0,j[6]||0,z)):new Date(j[1],D,j[3]||1,j[4]||0,j[5]||0,j[6]||0,z)}}return new Date(L)}(W),this.init()},k.init=function(){var W=this.$d;this.$y=W.getFullYear(),this.$M=W.getMonth(),this.$D=W.getDate(),this.$W=W.getDay(),this.$H=W.getHours(),this.$m=W.getMinutes(),this.$s=W.getSeconds(),this.$ms=W.getMilliseconds()},k.$utils=function(){return te},k.isValid=function(){return this.$d.toString()!==w},k.isSame=function(W,q){var L=H(W);return this.startOf(q)<=L&&L<=this.endOf(q)},k.isAfter=function(W,q){return H(W)<this.startOf(q)},k.isBefore=function(W,q){return this.endOf(q)<H(W)},k.$g=function(W,q,L){return te.u(W)?this[q]:this.set(L,W)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(W,q){var L=this,X=!!te.u(q)||q,j=te.p(W),D=function(ue,he){var be=te.w(L.$u?Date.UTC(L.$y,he,ue):new Date(L.$y,he,ue),L);return X?be:be.endOf(f)},z=function(ue,he){return te.w(L.toDate()[ue].apply(L.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(he)),L)},U=this.$W,T=this.$M,F=this.$D,R="set"+(this.$u?"UTC":"");switch(j){case y:return X?D(1,0):D(31,11);case p:return X?D(1,T):D(0,T+1);case d:var Z=this.$locale().weekStart||0,oe=(U<Z?U+7:U)-Z;return D(X?F-oe:F+(6-oe),T);case f:case _:return z(R+"Hours",0);case u:return z(R+"Minutes",1);case l:return z(R+"Seconds",2);case s:return z(R+"Milliseconds",3);default:return this.clone()}},k.endOf=function(W){return this.startOf(W,!1)},k.$set=function(W,q){var L,X=te.p(W),j="set"+(this.$u?"UTC":""),D=(L={},L[f]=j+"Date",L[_]=j+"Date",L[p]=j+"Month",L[y]=j+"FullYear",L[u]=j+"Hours",L[l]=j+"Minutes",L[s]=j+"Seconds",L[a]=j+"Milliseconds",L)[X],z=X===f?this.$D+(q-this.$W):q;if(X===p||X===y){var U=this.clone().set(_,1);U.$d[D](z),U.init(),this.$d=U.set(_,Math.min(this.$D,U.daysInMonth())).$d}else D&&this.$d[D](z);return this.init(),this},k.set=function(W,q){return this.clone().$set(W,q)},k.get=function(W){return this[te.p(W)]()},k.add=function(W,q){var L,X=this;W=Number(W);var j=te.p(q),D=function(T){var F=H(X);return te.w(F.date(F.date()+Math.round(T*W)),X)};if(j===p)return this.set(p,this.$M+W);if(j===y)return this.set(y,this.$y+W);if(j===f)return D(1);if(j===d)return D(7);var z=(L={},L[l]=n,L[u]=i,L[s]=r,L)[j]||1,U=this.$d.getTime()+W*z;return te.w(U,this)},k.subtract=function(W,q){return this.add(-1*W,q)},k.format=function(W){var q=this,L=this.$locale();if(!this.isValid())return L.invalidDate||w;var X=W||"YYYY-MM-DDTHH:mm:ssZ",j=te.z(this),D=this.$H,z=this.$m,U=this.$M,T=L.weekdays,F=L.months,R=L.meridiem,Z=function(he,be,Le,ft){return he&&(he[be]||he(q,X))||Le[be].slice(0,ft)},oe=function(he){return te.s(D%12||12,he,"0")},ue=R||function(he,be,Le){var ft=he<12?"AM":"PM";return Le?ft.toLowerCase():ft};return X.replace(g,function(he,be){return be||function(Le){switch(Le){case"YY":return String(q.$y).slice(-2);case"YYYY":return te.s(q.$y,4,"0");case"M":return U+1;case"MM":return te.s(U+1,2,"0");case"MMM":return Z(L.monthsShort,U,F,3);case"MMMM":return Z(F,U);case"D":return q.$D;case"DD":return te.s(q.$D,2,"0");case"d":return String(q.$W);case"dd":return Z(L.weekdaysMin,q.$W,T,2);case"ddd":return Z(L.weekdaysShort,q.$W,T,3);case"dddd":return T[q.$W];case"H":return String(D);case"HH":return te.s(D,2,"0");case"h":return oe(1);case"hh":return oe(2);case"a":return ue(D,z,!0);case"A":return ue(D,z,!1);case"m":return String(z);case"mm":return te.s(z,2,"0");case"s":return String(q.$s);case"ss":return te.s(q.$s,2,"0");case"SSS":return te.s(q.$ms,3,"0");case"Z":return j}return null}(he)||j.replace(":","")})},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(W,q,L){var X,j=this,D=te.p(q),z=H(W),U=(z.utcOffset()-this.utcOffset())*n,T=this-z,F=function(){return te.m(j,z)};switch(D){case y:X=F()/12;break;case p:X=F();break;case m:X=F()/3;break;case d:X=(T-U)/6048e5;break;case f:X=(T-U)/864e5;break;case u:X=T/i;break;case l:X=T/n;break;case s:X=T/r;break;default:X=T}return L?X:te.a(X)},k.daysInMonth=function(){return this.endOf(p).$D},k.$locale=function(){return x[this.$L]},k.locale=function(W,q){if(!W)return this.$L;var L=this.clone(),X=K(W,q,!0);return X&&(L.$L=X),L},k.clone=function(){return te.w(this.$d,this)},k.toDate=function(){return new Date(this.valueOf())},k.toJSON=function(){return this.isValid()?this.toISOString():null},k.toISOString=function(){return this.$d.toISOString()},k.toString=function(){return this.$d.toUTCString()},Q}(),ae=ee.prototype;return H.prototype=ae,[["$ms",a],["$s",s],["$m",l],["$H",u],["$W",f],["$M",p],["$y",y],["$D",_]].forEach(function(Q){ae[Q[1]]=function(k){return this.$g(k,Q[0],Q[1])}}),H.extend=function(Q,k){return Q.$i||(Q(k,ee,H),Q.$i=!0),H},H.locale=K,H.isDayjs=Y,H.unix=function(Q){return H(1e3*Q)},H.en=x[A],H.Ls=x,H.p={},H})})(O1);var D8=O1.exports;const oc=Qt(D8),oh=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,onChange:s,onBlur:l,onFocus:u,options:f,rawErrors:d=[],schema:p}=e,m=ht(t,p),y=async(C,S)=>{const E=Array.isArray(S)?S[0]:S,A=E===""?f.emptyValue:E;s(A),await m.onChange(A)},_=async()=>{l&&l(t,r),await m.onBlur(r)},w=async()=>{u&&u(t,r),await m.onFocus(r)},v=nn(d);if(a)return $.jsx(re.Input,{id:t,type:"date",value:r||"",required:n,disabled:i,readOnly:a,"aria-invalid":v,status:v?"error":void 0});const g=$1(f);return $.jsx(re.DatePicker,{id:t,value:r?oc(r):void 0,placeholder:g.placeholder||"Select a date",disabled:i,onChange:y,onBlur:_,onFocus:w,status:v?"error":g.status,style:{width:"100%",...g.style},format:g.format||"YYYY-MM-DD",...g})},sh=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,onChange:s,onBlur:l,onFocus:u,options:f,rawErrors:d=[],schema:p}=e,m=ht(t,p),y=nn(d);if(f.useNativeInput||a){const S=async x=>{const N=x.target.value===""?f.emptyValue:x.target.value;s(N),await m.onChange(N)},E=async x=>{const N=x.target.value;l&&l(t,N),await m.onBlur(N)},A=async x=>{const N=x.target.value;u&&u(t,N),await m.onFocus(N)};return $.jsx(re.Input,{id:t,type:"datetime-local",value:r||"",required:n,disabled:i,readOnly:a,onChange:S,onBlur:E,onFocus:A,"aria-invalid":y,status:y?"error":void 0})}const _=async(S,E)=>{const A=Array.isArray(E)?E[0]:E,x=A===""?f.emptyValue:A;s(x),await m.onChange(x)},w=async()=>{l&&l(t,r),await m.onBlur(r)},v=async()=>{u&&u(t,r),await m.onFocus(r)},g=$1(f),C=g.showTime!==void 0?g.showTime:!0;return $.jsx(re.DatePicker,{id:t,value:r?oc(r):void 0,placeholder:g.placeholder||"Select date and time",disabled:i,onChange:_,onBlur:w,onFocus:v,status:y?"error":g.status,style:{width:"100%",...g.style},format:g.format||"YYYY-MM-DD HH:mm:ss",showTime:C,...g})},A1=({id:e,value:t,required:r,disabled:n,readonly:i,label:a,onChange:s,options:l,schema:u})=>{const f=B.useRef(null),d=l.accept||"*/*",p=l.multiple||!1,m=ht(e,u),y=async v=>{const g=v.target.files;if(!g)return;let C;if(p){const S=Array.from(g).map(E=>({name:E.name,size:E.size,type:E.type,lastModified:E.lastModified}));C=S,s(S)}else{const S=g[0];S&&(C={name:S.name,size:S.size,type:S.type,lastModified:S.lastModified},s(C))}C&&await m.onChange(C)},_=async()=>{f.current&&(f.current.value=""),s(null),await m.onChange(null)},w=v=>v<1024?v+" B":v<1024*1024?(v/1024).toFixed(1)+" KB":(v/(1024*1024)).toFixed(1)+" MB";return $.jsxs("div",{style:{marginBottom:"16px"},children:[$.jsxs("label",{htmlFor:e,style:{display:"block",marginBottom:"8px",fontWeight:500},children:[a||u.title,r&&$.jsx("span",{style:{color:"#ff4d4f",marginLeft:"4px"},children:"*"})]}),$.jsx("input",{ref:f,id:e,type:"file",accept:d,multiple:p,required:r,disabled:n||i,onChange:y,style:{cursor:"pointer",width:"100%"}}),t&&$.jsx("div",{style:{marginTop:"8px"},children:p&&Array.isArray(t)?$.jsx(re.Space,{wrap:!0,children:t.map((v,g)=>$.jsx(re.Tag,{closable:!n&&!i,onClose:_,style:{display:"flex",alignItems:"center",gap:"4px"},children:$.jsxs("span",{style:{fontSize:"12px"},children:[v.name," (",w(v.size),")"]})},g))}):t&&typeof t=="object"&&"name"in t?$.jsx(re.Tag,{closable:!n&&!i,onClose:_,style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:$.jsxs("span",{style:{fontSize:"12px"},children:[t.name," (",w(t.size),")"]})}):null})]})},sc=e=>{const{id:t,value:r,required:n,disabled:i,readonly:a,onChange:s,onBlur:l,onFocus:u,options:f,rawErrors:d=[],schema:p}=e,m=ht(t,p),[y,_]=B.useState(!1),w=f.useAntUpload===!0,v=typeof f.accept=="string"?f.accept:"*/*",g=typeof f.maxSize=="number"?f.maxSize:void 0,C=nn(d),S=H=>new Promise((te,ee)=>{const ae=new FileReader;ae.onload=()=>{const Q=ae.result;te(Q)},ae.onerror=Q=>ee(Q),ae.readAsDataURL(H)}),E=async H=>{const te=H.target.files;if(te&&te.length>0){const ee=te[0];if(g&&ee.size>g*1024*1024){re.message.error(`File size must be less than ${g}MB`);return}try{_(!0);const ae=await S(ee);s(ae),await m.onChange(ae)}catch(ae){console.error("Error converting file to base64:",ae),re.message.error("Failed to process file")}finally{_(!1)}}},A=async({file:H,onSuccess:te,onError:ee})=>{const ae=H;if(g&&ae.size>g*1024*1024){re.message.error(`File size must be less than ${g}MB`),ee&&ee(new Error("File too large"));return}try{_(!0);const Q=await S(ae);s(Q),await m.onChange(Q),te&&te("ok"),re.message.success("File uploaded successfully")}catch(Q){console.error("Error converting file to base64:",Q),re.message.error("Failed to upload file"),ee&&ee(Q)}finally{_(!1)}},x=async()=>{l&&l(t,r),await m.onBlur(r)},N=async()=>{u&&u(t,r),await m.onFocus(r)},Y=async()=>{s(void 0),await m.onChange(void 0)},K=r?[{uid:"-1",name:"Uploaded File",status:"done",url:r}]:[];return w?$.jsx(re.Upload,{id:t,accept:v,fileList:K,customRequest:A,onRemove:Y,disabled:i||a,maxCount:1,beforeUpload:H=>{var te;if(v!=="*/*"){const ee=v.split(",").map(W=>W.trim()),ae=`.${(te=H.name.split(".").pop())==null?void 0:te.toLowerCase()}`,Q=H.type;if(!ee.some(W=>W.startsWith(".")?ae===W.toLowerCase():W.includes("*")?Q.startsWith(W.replace("*","")):Q===W))return re.message.error(`File type not allowed. Please upload: ${v}`),!1}return!0},children:$.jsx(re.Button,{icon:$.jsx(l1,{}),loading:y,danger:C,children:r?"Replace File":"Click to Upload"})}):$.jsx(re.Input,{id:t,type:"file",required:n,disabled:i||y,readOnly:a,accept:v,onChange:E,onBlur:x,onFocus:N,"aria-invalid":C,className:"file:mr-4 file:py-1 file:px-2 file:rounded file:border-0 file:text-sm file:font-medium file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100",status:C?"error":void 0})};var bt=(e=>(e.DROPDOWN="dropdown",e.RADIO="radio",e.CHECKBOX="checkbox",e))(bt||{});function T1(e){return e.type==="static"}function P1(e){return e.type==="api"}function lh(e){return e.type==="websocket"}function I1(e){return e==="checkbox"}const Mo={presentationMode:"dropdown",multiple:!1,allowClear:!0,disabled:!1,readonly:!1,size:"middle",search:{enabled:!1,minLength:1,debounceMs:300,caseSensitive:!1,searchFields:["label"]},accessibility:{announceChanges:!0,keyboard:{arrowKeys:!0,typeAhead:!0,homeEnd:!0}}},ch={ttl:3e5,persistent:!1,storageType:"memory"},ko={type:"simple",simple:{labelField:"label",valueField:"value",disabledField:"disabled"}},x1={maxAttempts:3,baseDelayMs:1e3,maxDelayMs:1e4,backoffMultiplier:2,jitter:!0},mt=class mt{constructor(t={},r={},n){pe(this,"cache");pe(this,"retryConfig");pe(this,"loadingState");pe(this,"errorState");pe(this,"metrics");pe(this,"eventCallbacks");pe(this,"instanceId");pe(this,"isDestroyed",!1);pe(this,"supportsCaching",!0);pe(this,"supportsRealTime",!1);mt.instanceCount++,this.instanceId=`datasource_${mt.instanceCount}_${Date.now()}`,this.cache={...ch,...t},this.retryConfig={...x1,...r},this.eventCallbacks=n,this.loadingState={isLoading:!1,message:"",progress:0},this.errorState={hasError:!1,message:"",recoverable:!0},this.metrics={requestCount:0,successCount:0,errorCount:0,cacheHitCount:0,cacheMissCount:0,averageResponseTimeMs:0},mt.instanceCount===1&&this.startCacheCleanup()}async fetchOptions(){var n,i,a,s;if(this.isDestroyed)throw new Error("DataSourceProvider has been destroyed");const t=performance.now(),r=this.getCacheKey();try{if(this.supportsCaching&&r){const u=this.getCachedData(r);if(u)return this.metrics.cacheHitCount++,(i=(n=this.eventCallbacks)==null?void 0:n.onCacheHit)==null||i.call(n,this,r),this.logDebug(`Cache hit for key: ${r}`),u;this.metrics.cacheMissCount++,(s=(a=this.eventCallbacks)==null?void 0:a.onCacheMiss)==null||s.call(a,this,r),this.logDebug(`Cache miss for key: ${r}`)}const l=await this.fetchWithRetry();return this.supportsCaching&&r&&l.length>0&&(this.setCachedData(r,l),this.logDebug(`Cached ${l.length} options with key: ${r}`)),this.updateMetrics(t,!0),l}catch(l){throw this.updateMetrics(t,!1),this.handleError(l instanceof Error?l:new Error(String(l))),l}}getLoadingState(){return{...this.loadingState}}getErrorState(){return{...this.errorState}}getMetrics(){return{...this.metrics}}clearCache(t){var r,n;t?(mt.memoryCache.delete(t),this.logDebug(`Cleared cache for key: ${t}`)):(mt.memoryCache.clear(),this.logDebug("Cleared all cache entries")),(n=(r=this.eventCallbacks)==null?void 0:r.onCacheCleared)==null||n.call(r,this,t||void 0)}clearError(){this.errorState={hasError:!1,message:"",recoverable:!0},this.logDebug("Error state cleared")}resetMetrics(){this.metrics={requestCount:0,successCount:0,errorCount:0,cacheHitCount:0,cacheMissCount:0,averageResponseTimeMs:0},this.logDebug("Metrics reset")}hasCachedData(t){const r=t||this.getCacheKey();if(!r)return!1;const n=mt.memoryCache.get(r);return n?Date.now()-n.timestamp>n.ttl?(mt.memoryCache.delete(r),!1):!0:!1}cleanup(){if(this.isDestroyed)return;this.isDestroyed=!0;const t=this.getCacheKey();this.clearCache(t??void 0),this.cleanupResources(),mt.instanceCount--,mt.instanceCount===0&&(this.stopCacheCleanup(),mt.memoryCache.clear()),this.logDebug("DataSourceProvider cleanup completed")}cleanupResources(){}setLoadingState(t,r,n){var i,a;this.loadingState={isLoading:t,message:r||(t?"Loading options...":""),progress:n??(t?void 0:100)},t&&((a=(i=this.eventCallbacks)==null?void 0:i.onLoadingStart)==null||a.call(i,this))}validateAndTransformData(t){if(!Array.isArray(t))throw new Error("Data source must return an array of options");return t.map((r,n)=>{if(!r||typeof r!="object")throw new Error(`Invalid option at index ${n}: must be an object`);if(typeof r.label!="string")throw new Error(`Invalid option at index ${n}: label must be a string`);if(r.value===void 0||r.value===null)throw new Error(`Invalid option at index ${n}: value cannot be undefined or null`);if(!["string","number","boolean"].includes(typeof r.value))throw new Error(`Invalid option at index ${n}: value must be string, number, or boolean`);return{label:r.label,value:r.value,disabled:!!r.disabled,metadata:r.metadata||{}}})}logDebug(t,r){process.env.NODE_ENV==="development"&&console.debug(`[DataSourceProvider:${this.instanceId}] ${t}`,r||"")}logError(t,r){console.error(`[DataSourceProvider:${this.instanceId}] ${t}`,r||"")}async fetchWithRetry(){var r,n;let t=null;for(let i=1;i<=this.retryConfig.maxAttempts;i++)try{this.setLoadingState(!0,`Fetching options (attempt ${i})...`);const a=await this.fetchData(),s=this.validateAndTransformData(a);return this.setLoadingState(!1),this.clearError(),(n=(r=this.eventCallbacks)==null?void 0:r.onLoadingComplete)==null||n.call(r,this,s),s}catch(a){if(t=a instanceof Error?a:new Error(String(a)),this.logError(`Attempt ${i} failed:`,t),i===this.retryConfig.maxAttempts)break;const s=this.retryConfig.baseDelayMs*Math.pow(this.retryConfig.backoffMultiplier,i-1);let l=Math.min(s,this.retryConfig.maxDelayMs);if(this.retryConfig.jitter){const u=l*.25,f=(Math.random()-.5)*2*u;l=Math.max(0,l+f)}this.logDebug(`Retrying in ${Math.round(l)}ms...`),this.setLoadingState(!0,`Retrying in ${Math.round(l/1e3)}s...`,i/this.retryConfig.maxAttempts*100),await new Promise(u=>setTimeout(u,l))}throw this.setLoadingState(!1),t||new Error("Max retry attempts exceeded")}getCachedData(t){const r=mt.memoryCache.get(t);return r?Date.now()-r.timestamp>r.ttl?(mt.memoryCache.delete(t),null):[...r.data]:null}setCachedData(t,r){const n={data:[...r],timestamp:Date.now(),ttl:this.cache.ttl||ch.ttl,key:t};mt.memoryCache.set(t,n)}handleError(t){var r,n;this.errorState={hasError:!0,message:t.message||"An unknown error occurred",code:t.code||"UNKNOWN_ERROR",stack:process.env.NODE_ENV==="development"?t.stack:void 0,recoverable:!0,timestamp:Date.now()},this.metrics.lastErrorTimestamp=Date.now(),(n=(r=this.eventCallbacks)==null?void 0:r.onError)==null||n.call(r,this,t),this.logError("DataSource error:",t)}updateMetrics(t,r){const n=performance.now()-t;this.metrics.requestCount++,this.metrics.lastRequestTimestamp=Date.now(),r?this.metrics.successCount++:this.metrics.errorCount++;const i=this.metrics.requestCount;this.metrics.averageResponseTimeMs=(this.metrics.averageResponseTimeMs*(i-1)+n)/i}startCacheCleanup(){mt.cacheCleanupInterval=setInterval(()=>{this.runCacheCleanup()},3e5)}stopCacheCleanup(){mt.cacheCleanupInterval&&(clearInterval(mt.cacheCleanupInterval),mt.cacheCleanupInterval=void 0)}runCacheCleanup(){const t=Date.now();let r=0;for(const[n,i]of mt.memoryCache.entries())t-i.timestamp>i.ttl&&(mt.memoryCache.delete(n),r++);r>0&&this.logDebug(`Cache cleanup: removed ${r} expired entries`)}};pe(mt,"memoryCache",new Map),pe(mt,"cacheCleanupInterval"),pe(mt,"instanceCount",0);let ba=mt;function D1(e){let t=0;if(e.length===0)return t.toString();for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function F8(e){if(!Array.isArray(e))return["Options must be an array"];const t=[];return e.forEach((r,n)=>{if(!r||typeof r!="object"){t.push(`Option at index ${n} must be an object`);return}const i=r;typeof i.label!="string"&&t.push(`Option at index ${n} must have a string label`),(i.value===void 0||i.value===null)&&t.push(`Option at index ${n} must have a defined value`);const a=["string","number","boolean"];i.value!==void 0&&i.value!==null&&!a.includes(typeof i.value)&&t.push(`Option at index ${n} value must be string, number, or boolean`)}),t.length>0?t:null}class uh extends ba{constructor(r,n={}){const i={ttl:0,persistent:!1,storageType:"memory",...n.cache};super(i,{maxAttempts:1},n.eventCallbacks);pe(this,"validatedOptions");pe(this,"optionGroups",new Map);pe(this,"supportsRealTime",!0);this.validateConfig(r),this.validatedOptions=this.validateAndTransformData(r.options),this.buildOptionGroups(),this.logDebug(`StaticDataSource initialized with ${this.validatedOptions.length} options`)}async fetchData(){return this.validatedOptions.map(r=>({...r,metadata:r.metadata?{...r.metadata}:{}}))}getCacheKey(){return null}searchOptions(r,n){const i=l=>({...l,metadata:l.metadata?{...l.metadata}:{}});if(!n.enabled||!r)return this.validatedOptions.map(i);if(n.minLength&&r.length<n.minLength)return this.validatedOptions.map(i);const a=n.caseSensitive?r:r.toLowerCase(),s=n.searchFields||["label"];return this.validatedOptions.filter(l=>n.customFilter?n.customFilter(l,r):s.some(u=>{var p;let f="";switch(u){case"label":f=l.label;break;case"value":f=String(l.value);break;case"description":f=((p=l.metadata)==null?void 0:p.description)||"";break;default:return!1}return(n.caseSensitive?f:f.toLowerCase()).includes(a)})).map(i)}getGroupedOptions(){const r=new Map;for(const[n,i]of this.optionGroups)r.set(n,i.map(a=>({...a,metadata:a.metadata?{...a.metadata}:{}})));return r}getOptionsByGroup(r){return(this.optionGroups.get(r)||[]).map(i=>({...i,metadata:i.metadata?{...i.metadata}:{}}))}getGroupNames(){return Array.from(this.optionGroups.keys())}updateOptions(r){var i,a;this.logDebug("Updating static options",{oldCount:this.validatedOptions.length,newCount:r.length});const n=this.validateAndTransformData(r);this.validatedOptions.length=0,this.optionGroups.clear(),this.validatedOptions.push(...n),this.buildOptionGroups(),this.clearCache(),this.logDebug(`Updated static options: ${this.validatedOptions.length} options`),(a=(i=this.eventCallbacks)==null?void 0:i.onLoadingComplete)==null||a.call(i,this,this.validatedOptions)}addOptions(r){const n=this.validateAndTransformData(r),i=new Set(this.validatedOptions.map(s=>s.value)),a=n.filter(s=>i.has(s.value));if(a.length>0)throw new Error(`Duplicate option values found: ${a.map(s=>s.value).join(", ")}`);this.validatedOptions.push(...n),this.buildOptionGroups(),this.clearCache(),this.logDebug(`Added ${r.length} new options`)}removeOptions(r){const n=new Set(r),i=this.validatedOptions.length,a=this.validatedOptions.filter(l=>!n.has(l.value));this.validatedOptions.length=0,this.validatedOptions.push(...a),this.buildOptionGroups(),this.clearCache();const s=i-this.validatedOptions.length;return this.logDebug(`Removed ${s} options`),s}getOptionByValue(r){const n=this.validatedOptions.find(i=>i.value===r);return n?{...n,metadata:n.metadata?{...n.metadata}:{}}:null}hasOptionWithValue(r){return this.validatedOptions.some(n=>n.value===r)}getOptionCount(){return this.validatedOptions.length}getMemoryStats(){const r=JSON.stringify(this.validatedOptions).length,n=JSON.stringify(Array.from(this.optionGroups.entries())).length,i=Math.max(1,Math.round((r+n)/1024));return{optionCount:this.validatedOptions.length,groupCount:this.optionGroups.size,estimatedMemoryKB:i}}validateAndTransformData(r){return super.validateAndTransformData(r).map(i=>({...i,metadata:i.metadata?{...i.metadata}:{}}))}cleanupResources(){this.optionGroups.clear(),this.validatedOptions.length=0,this.logDebug("StaticDataSource resources cleaned up")}validateConfig(r){if(!r||typeof r!="object")throw new Error("StaticDataSourceConfig must be an object");if(r.type!=="static")throw new Error('StaticDataSourceConfig type must be "static"');if(!Array.isArray(r.options))throw new Error("StaticDataSourceConfig options must be an array");r.options.length===0&&this.logDebug("Warning: StaticDataSource initialized with empty options array")}buildOptionGroups(){var r;this.optionGroups.clear();for(const n of this.validatedOptions){const i=((r=n.metadata)==null?void 0:r.group)||"ungrouped";this.optionGroups.has(i)||this.optionGroups.set(i,[]),this.optionGroups.get(i).push(n)}this.logDebug(`Built ${this.optionGroups.size} option groups`)}}function N8(e,t){return new uh(e,t)}function M8(e){var t;return!!((t=e.metadata)!=null&&t.group)}function k8(e){const t=[];for(const[r,n]of Object.entries(e))for(const i of n)t.push({...i,metadata:{...i.metadata,group:r}});return t}const L8={delayMs:300,maxWaitMs:1e3,leading:!1,trailing:!0};class j8{constructor(t,r){pe(this,"timeoutId");pe(this,"maxTimeoutId");pe(this,"lastArgs");pe(this,"lastResult");this.func=t,this.config=r}execute(...t){return new Promise((r,n)=>{if(this.lastArgs=t,this.timeoutId&&clearTimeout(this.timeoutId),this.config.leading&&!this.timeoutId)try{const i=this.func(...t);this.lastResult=i,r(i);return}catch(i){n(i);return}this.config.trailing&&(this.timeoutId=setTimeout(async()=>{try{const i=await this.func(...this.lastArgs);this.lastResult=i,r(i)}catch(i){n(i)}finally{this.timeoutId=void 0}},this.config.delayMs)),this.config.maxWaitMs&&!this.maxTimeoutId&&(this.maxTimeoutId=setTimeout(async()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0);try{const i=await this.func(...this.lastArgs);this.lastResult=i,r(i)}catch(i){n(i)}finally{this.maxTimeoutId=void 0}},this.config.maxWaitMs))})}cancel(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0),this.maxTimeoutId&&(clearTimeout(this.maxTimeoutId),this.maxTimeoutId=void 0)}flush(){if(this.timeoutId&&this.lastArgs){clearTimeout(this.timeoutId),this.timeoutId=void 0,this.maxTimeoutId&&(clearTimeout(this.maxTimeoutId),this.maxTimeoutId=void 0);const t=this.func(...this.lastArgs);return this.lastResult=t,t}return this.lastResult}}class B8{constructor(t={}){pe(this,"config");pe(this,"abortController");this.config={timeout:3e4,defaultHeaders:{"Content-Type":"application/json",Accept:"application/json"},...t}}async request(t){this.abortController=new AbortController;const r={method:"GET",headers:{...this.config.defaultHeaders},timeout:this.config.timeout,signal:this.abortController.signal,...t,url:this.resolveUrl(t.url||"")},n=this.config.requestInterceptor?await this.config.requestInterceptor(r):r,i=this.buildUrlWithParams(n.url,n.params),a={method:n.method,headers:new Headers(n.headers),signal:n.signal};["POST","PUT","PATCH"].includes(n.method)&&n.body&&(a.body=typeof n.body=="string"?n.body:JSON.stringify(n.body));const s=setTimeout(()=>{this.abortController&&!this.abortController.signal.aborted&&this.abortController.abort()},n.timeout),l=new Promise((u,f)=>{setTimeout(()=>{f(new Error(`Request timeout after ${n.timeout}ms`))},n.timeout)});try{const u=await Promise.race([fetch(i,a),l]);clearTimeout(s);const f=this.config.responseInterceptor?await this.config.responseInterceptor(u):u;if(!f.ok){const p=await f.text().catch(()=>"Unknown error");throw new Error(`HTTP ${f.status} ${f.statusText}: ${p}`)}const d=f.headers.get("content-type")||"";if(d.includes("application/json"))return await f.json();if(d.includes("text/")){const p=await f.text();try{const m=p.trim();if(m.startsWith("{")||m.startsWith("["))return JSON.parse(m)}catch{}return p}else return await f.blob()}catch(u){throw clearTimeout(s),u instanceof Error?u.name==="AbortError"?new Error("Request was cancelled"):u:new Error("Unknown request error")}}cancel(){this.abortController&&!this.abortController.signal.aborted&&this.abortController.abort()}resolveUrl(t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(this.config.baseUrl){const r=this.config.baseUrl.endsWith("/")?this.config.baseUrl.slice(0,-1):this.config.baseUrl,n=t.startsWith("/")?t:`/${t}`;return`${r}${n}`}return t}buildUrlWithParams(t,r){if(!r||Object.keys(r).length===0)return t;const n=new URL(t);return Object.entries(r).forEach(([i,a])=>{n.searchParams.set(i,String(a))}),n.toString()}}class U8{static mapResponse(t,r){switch(r.type){case"simple":return this.mapSimpleResponse(t,r.simple);case"nested":return this.mapNestedResponse(t,r.nested);case"custom":if(!r.custom)throw new Error("Custom mapper function is required for custom type");return r.custom(t);default:throw new Error(`Unknown response mapper type: ${r.type}`)}}static mapSimpleResponse(t,r=ko.simple){const{arrayPath:n="",labelField:i="label",valueField:a="value",disabledField:s="disabled"}=r||{};let l=[];if(n){const u=this.getNestedValue(t,n);if(!Array.isArray(u))throw new Error(`Array not found at path: ${n}`);l=u}else if(Array.isArray(t))l=t;else throw new Error("Response data must be an array or contain an array at specified path");return l.map((u,f)=>{if(!u||typeof u!="object")throw new Error(`Invalid item at index ${f}: must be an object`);const d=u,p=d[i],m=d[a],y=d[s];if(typeof p!="string")throw new Error(`Invalid label at index ${f}: must be a string`);if(m==null)throw new Error(`Invalid value at index ${f}: cannot be undefined or null`);if(!["string","number","boolean"].includes(typeof m))throw new Error(`Invalid value at index ${f}: must be string, number, or boolean`);return{label:p,value:m,disabled:!!y,metadata:{...d,_index:f}}})}static mapNestedResponse(t,r){if(!r)throw new Error("Nested mapper configuration is required");const{arrayPath:n,paths:i}=r,a=this.getNestedValue(t,n);if(!Array.isArray(a))throw new Error(`Array not found at path: ${n}`);return a.map((s,l)=>{if(!s||typeof s!="object")throw new Error(`Invalid item at index ${l}: must be an object`);const u=this.getNestedValue(s,i.label),f=this.getNestedValue(s,i.value),d=i.disabled?this.getNestedValue(s,i.disabled):!1,p=i.description?this.getNestedValue(s,i.description):void 0;if(typeof u!="string")throw new Error(`Invalid label at index ${l}: must be a string`);if(f==null)throw new Error(`Invalid value at index ${l}: cannot be undefined or null`);if(!["string","number","boolean"].includes(typeof f))throw new Error(`Invalid value at index ${l}: must be string, number, or boolean`);return{label:u,value:f,disabled:!!d,metadata:{description:typeof p=="string"?p:void 0,index:l,originalData:s}}})}static getNestedValue(t,r){if(!t||typeof t!="object")return;const n=r.split(".");let i=t;for(const a of n){if(i==null)return;i=i[a]}return i}}class fh extends ba{constructor(r,n={},i,a={}){super(r.cache,n,i);pe(this,"config");pe(this,"httpClient");pe(this,"debouncedFetch");pe(this,"lastRequestUrl");pe(this,"searchParams");pe(this,"supportsRealTime",!0);this.debounceConfig=a,this.config=this.validateAndNormalizeConfig(r),this.httpClient=this.createHttpClient();const s={...L8,...this.debounceConfig};this.debouncedFetch=new j8(()=>this.fetchDataInternal(),s),this.logDebug("ApiDataSource initialized",{url:this.config.url,method:this.config.method,hasAuth:!!this.config.auth,cacheEnabled:this.supportsCaching,debounceMs:s.delayMs})}async fetchData(){const r=this.buildRequestUrl(),n=this.hasSearchParams()||this.lastRequestUrl!==r;return this.lastRequestUrl=r,n&&this.debouncedFetch?(this.logDebug("Using debounced fetch for search request"),await this.debouncedFetch.execute()):(this.logDebug("Using direct fetch for regular request"),await this.fetchDataInternal())}setSearchParams(r){this.searchParams={...r},this.logDebug("Search parameters updated",r)}clearSearchParams(){this.searchParams=void 0,this.logDebug("Search parameters cleared")}cancelPendingRequests(){this.debouncedFetch&&this.debouncedFetch.cancel(),this.httpClient.cancel(),this.logDebug("Pending requests cancelled")}flushPendingRequests(){if(this.debouncedFetch)return this.debouncedFetch.flush()}getCacheKey(){var l;if(!this.supportsCaching||this.cache.ttl!==void 0&&this.cache.ttl<=0)return null;const r=this.buildRequestUrl(),n=this.config.method||"GET",i=((l=this.config.auth)==null?void 0:l.type)||"none",a={url:r,method:n,authType:i,body:this.config.body,searchParams:this.searchParams},s=JSON.stringify(a);return`api_${D1(s)}`}cleanupResources(){this.cancelPendingRequests(),this.debouncedFetch&&(this.debouncedFetch.cancel(),this.debouncedFetch=void 0),this.logDebug("API resources cleaned up")}async fetchDataInternal(){const r=performance.now();try{const n=this.buildRequestConfig();this.logDebug("Making API request",{url:n.url,method:n.method,hasAuth:!!this.config.auth,hasBody:!!n.body,paramsCount:Object.keys(n.params||{}).length});const i=await this.httpClient.request(n),a=U8.mapResponse(i,this.config.responseMapper),s=performance.now()-r;return this.logDebug(`API request completed in ${Math.round(s)}ms`,{optionsCount:a.length,responseTime:s}),a}catch(n){const i=performance.now()-r;throw this.logError(`API request failed after ${Math.round(i)}ms`,n instanceof Error?n:new Error(String(n))),n}}buildRequestConfig(){const r={"Content-Type":"application/json",Accept:"application/json",...this.config.headers},n={url:this.buildRequestUrl(),method:this.config.method||"GET",headers:r,body:this.config.body,params:this.buildRequestParams(),timeout:this.config.timeout||3e4};return this.config.auth&&this.addAuthenticationHeaders(n),n}buildRequestUrl(){return this.config.url}buildRequestParams(){return{...this.config.params,...this.searchParams}}addAuthenticationHeaders(r){if(!this.config.auth||!r.headers)return;const{type:n,credentials:i,headerName:a}=this.config.auth;switch(n){case"bearer":if(typeof i=="string")r.headers.Authorization=`Bearer ${i}`;else throw new Error("Bearer token must be a string");break;case"basic":if(typeof i=="object"&&i.username&&i.password){const s=btoa(`${i.username}:${i.password}`);r.headers.Authorization=`Basic ${s}`}else throw new Error("Basic auth requires username and password");break;case"apiKey":if(typeof i=="string"&&a)r.headers[a]=i;else throw new Error("API key auth requires credentials string and headerName");break;default:throw new Error(`Unsupported authentication type: ${n}`)}}hasSearchParams(){return!!this.searchParams&&Object.keys(this.searchParams).length>0}createHttpClient(){const r={"Content-Type":"application/json",Accept:"application/json"};return new B8({timeout:this.config.timeout||3e4,defaultHeaders:{...r,...this.config.headers}})}validateAndNormalizeConfig(r){if(!r.url)throw new Error("API URL is required");if(!r.responseMapper)throw new Error("Response mapper configuration is required");try{new URL(r.url)}catch{throw new Error("Invalid API URL format")}const n=["GET","POST","PUT","PATCH"];if(r.method&&!n.includes(r.method))throw new Error(`Invalid HTTP method: ${r.method}`);return r.auth&&this.validateAuthConfig(r.auth),this.validateResponseMapper(r.responseMapper),{...r,method:r.method||"GET",headers:r.headers||{},params:r.params||{},timeout:r.timeout||3e4,retries:r.retries||0,responseMapper:r.responseMapper||ko}}validateAuthConfig(r){if(!["bearer","basic","apiKey"].includes(r.type))throw new Error(`Invalid auth type: ${r.type}`);if(!r.credentials)throw new Error("Auth credentials are required");if(r.type==="basic"){if(typeof r.credentials!="object"||!r.credentials.username||!r.credentials.password)throw new Error("Basic auth requires username and password")}else if(r.type==="apiKey"){if(typeof r.credentials!="string"||!r.headerName)throw new Error("API key auth requires credentials string and headerName")}else if(r.type==="bearer"&&typeof r.credentials!="string")throw new Error("Bearer auth requires credentials string")}validateResponseMapper(r){if(!["simple","nested","custom"].includes(r.type))throw new Error(`Invalid response mapper type: ${r.type}`);if(r.type==="nested"&&!r.nested)throw new Error("Nested mapper configuration is required for nested type");if(r.type==="custom"&&!r.custom)throw new Error("Custom mapper function is required for custom type");if(r.type==="nested"&&r.nested){if(!r.nested.arrayPath)throw new Error("Array path is required for nested mapper");if(!r.nested.paths||!r.nested.paths.label||!r.nested.paths.value)throw new Error("Label and value paths are required for nested mapper")}}}function W8(e,t={}){return new fh(e,t.retryConfig,t.eventCallbacks,t.debounceConfig)}const q8={SIMPLE_ARRAY:{type:"simple",simple:{labelField:"label",valueField:"value",disabledField:"disabled"}},PAGINATED_DATA:{type:"simple",simple:{arrayPath:"data.items",labelField:"label",valueField:"value",disabledField:"disabled"}},REST_RESULTS:{type:"simple",simple:{arrayPath:"results",labelField:"name",valueField:"id",disabledField:"active"}},NESTED_OBJECTS:{type:"nested",nested:{arrayPath:"data.options",paths:{label:"display.name",value:"identifier",disabled:"status.disabled",description:"display.description"}}}},V8={bearer:e=>({type:"bearer",credentials:e}),basic:(e,t)=>({type:"basic",credentials:{username:e,password:t}}),apiKey:(e,t="X-API-Key")=>({type:"apiKey",credentials:e,headerName:t})};var F1=(e=>(e.DISCONNECTED="disconnected",e.CONNECTING="connecting",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.FAILED="failed",e))(F1||{});class dh extends ba{constructor(r,n={}){var a,s;const i={ttl:3e5,persistent:!0,storageType:"memory",...n.cache};super(i,{maxAttempts:((a=r.connection)==null?void 0:a.maxReconnectAttempts)||5,baseDelayMs:((s=r.connection)==null?void 0:s.reconnectDelay)||1e3,maxDelayMs:3e4,backoffMultiplier:2,jitter:!0},n.eventCallbacks);pe(this,"config");pe(this,"websocket",null);pe(this,"connectionState","disconnected");pe(this,"reconnectAttempts",0);pe(this,"heartbeatInterval",null);pe(this,"responseTimeout",null);pe(this,"searchTimeout",null);pe(this,"pendingRequests",new Map);pe(this,"currentOptions",[]);pe(this,"currentSearchParams",{});pe(this,"supportsRealTime",!0);this.validateConfig(r),this.config=this.normalizeConfig(r),this.logDebug("WebSocketDataSource initialized",{url:this.config.url})}async fetchData(){const r=this.getCacheKey();if(r&&this.hasCachedData(r)){this.logDebug("Using cached data while establishing WebSocket connection");const a=this.getWebSocketCachedData(r);if(a&&a.length>0)return this.ensureConnection(),a}await this.ensureConnection();const n=this.generateMessageId(),i={type:"search-request",messageId:n,timestamp:Date.now(),data:{searchParams:this.currentSearchParams,requestInitial:!0}};return new Promise((a,s)=>{var f;const l=((f=this.config.connection)==null?void 0:f.responseTimeout)||1e4,u=setTimeout(()=>{this.pendingRequests.delete(n),s(new Error(`Request timeout after ${l}ms`))},l);this.pendingRequests.set(n,{resolve:a,reject:s,timeout:u}),this.sendMessage(i)})}getCacheKey(){const r=this.config.url,n=Object.keys(this.currentSearchParams).length>0?JSON.stringify(this.currentSearchParams):"";return`websocket:${r}:${n}`}setSearchParams(r){var n;this.currentSearchParams={...r},this.clearCache(),(n=this.config.messageHandling)!=null&&n.enableRealtimeSearch&&this.debounceSearch(),this.logDebug("Search parameters updated",r)}clearSearchParams(){this.currentSearchParams={},this.clearCache(),this.searchTimeout&&(clearTimeout(this.searchTimeout),this.searchTimeout=null),this.logDebug("Search parameters cleared")}getConnectionState(){return this.connectionState}async reconnect(){this.logDebug("Manual reconnection requested"),this.websocket&&(this.websocket.close(),this.websocket=null),this.connectionState="disconnected",this.reconnectAttempts=0,await this.ensureConnection()}sendMessage(r){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)throw new Error("WebSocket is not connected");const n=JSON.stringify(r);this.websocket.send(n),this.logDebug("Message sent",{type:r.type,messageId:r.messageId})}subscribeToUpdates(r){const n=i=>{r(i)};return this._updateCallback=n,()=>{delete this._updateCallback}}cleanupResources(){this.logDebug("Cleaning up WebSocket resources"),this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.responseTimeout&&(clearTimeout(this.responseTimeout),this.responseTimeout=null),this.searchTimeout&&(clearTimeout(this.searchTimeout),this.searchTimeout=null);for(const[,r]of this.pendingRequests)clearTimeout(r.timeout),r.reject(new Error("WebSocket connection closed"));this.pendingRequests.clear(),this.websocket&&(this.websocket.close(),this.websocket=null),this.connectionState="disconnected"}validateConfig(r){if(!r||typeof r!="object")throw new Error("WebSocketDataSourceConfig must be an object");if(r.type!=="websocket")throw new Error('WebSocketDataSourceConfig type must be "websocket"');if(!r.url||typeof r.url!="string")throw new Error("WebSocketDataSourceConfig must have a valid URL");try{const n=new URL(r.url);if(!["ws:","wss:"].includes(n.protocol))throw new Error("WebSocket URL must use ws:// or wss:// protocol")}catch(n){throw new Error(`Invalid WebSocket URL format: ${n instanceof Error?n.message:String(n)}`)}if(r.auth){if(!["bearer","query","header"].includes(r.auth.type))throw new Error('WebSocket auth type must be "bearer", "query", or "header"');if(!r.auth.credentials||typeof r.auth.credentials!="string")throw new Error("WebSocket auth credentials must be a non-empty string")}}normalizeConfig(r){return{...r,connection:{connectTimeout:3e4,autoReconnect:!0,maxReconnectAttempts:5,reconnectDelay:1e3,heartbeatInterval:3e4,responseTimeout:1e4,...r.connection},messageHandling:{requestInitialOptions:!0,enableRealtimeSearch:!1,searchDebounceMs:300,...r.messageHandling},responseMapper:r.responseMapper||ko}}async ensureConnection(){if(this.connectionState!=="connected"){if(this.connectionState==="connecting"||this.connectionState==="reconnecting")return new Promise((r,n)=>{const i=()=>{this.connectionState==="connected"?r():this.connectionState==="failed"?n(new Error("WebSocket connection failed")):setTimeout(i,100)};i()});await this.connect()}}async connect(){return this.connectionState=this.reconnectAttempts>0?"reconnecting":"connecting",new Promise((r,n)=>{var i;try{const a=this.buildConnectionUrl(),s=this.config.protocols;this.logDebug("Connecting to WebSocket",{url:a.replace(/[?&].*$/,"")}),this.websocket=new WebSocket(a,s);const l=setTimeout(()=>{var u;(u=this.websocket)==null||u.close(),this.connectionState="failed",n(new Error("WebSocket connection timeout"))},((i=this.config.connection)==null?void 0:i.connectTimeout)||3e4);this.websocket.onopen=()=>{var u,f;clearTimeout(l),this.connectionState="connected",this.reconnectAttempts=0,this.logDebug("WebSocket connected successfully"),this.authenticateConnection(),(u=this.config.messageHandling)!=null&&u.initialMessage&&this.sendMessage(this.config.messageHandling.initialMessage),(f=this.config.messageHandling)!=null&&f.requestInitialOptions&&this.requestInitialOptions(),this.startHeartbeat(),r()},this.websocket.onmessage=u=>{this.handleMessage(u)},this.websocket.onclose=u=>{clearTimeout(l),this.handleConnectionClose(u)},this.websocket.onerror=u=>{clearTimeout(l),this.handleConnectionError(u),(this.connectionState==="connecting"||this.connectionState==="reconnecting")&&(this.connectionState="failed",n(new Error("WebSocket connection failed")))}}catch(a){this.connectionState="failed",n(a)}})}buildConnectionUrl(){var n;const r=new URL(this.config.url);if(((n=this.config.auth)==null?void 0:n.type)==="query"){const i=this.config.auth.paramName||"token";r.searchParams.set(i,this.config.auth.credentials)}return r.toString()}authenticateConnection(){if(!(!this.config.auth||this.config.auth.type==="query")&&this.config.auth.type==="bearer"){const r={type:"connection-ready",messageId:this.generateMessageId(),timestamp:Date.now(),data:{auth:{type:"bearer",token:this.config.auth.credentials}}};this.sendMessage(r)}}requestInitialOptions(){const n={type:"search-request",messageId:this.generateMessageId(),timestamp:Date.now(),data:{requestInitial:!0,searchParams:{}}};this.sendMessage(n)}handleMessage(r){try{const n=JSON.parse(r.data);switch(this.logDebug("Message received",{type:n.type,messageId:n.messageId}),n.type){case"search-response":this.handleSearchResponse(n);break;case"options-update":this.handleOptionsUpdate(n);break;case"options-add":this.handleOptionsAdd(n);break;case"options-remove":this.handleOptionsRemove(n);break;case"options-patch":this.handleOptionsPatch(n);break;case"error":this.handleErrorMessage(n);break;case"heartbeat":this.handleHeartbeat(n);break;default:this.logDebug("Unknown message type",{type:n.type})}}catch(n){this.logError("Error parsing WebSocket message",n)}}handleSearchResponse(r){if(!r.messageId){this.logError("Search response missing messageId");return}const n=this.pendingRequests.get(r.messageId);if(!n){this.logDebug("No pending request for messageId",{messageId:r.messageId});return}clearTimeout(n.timeout),this.pendingRequests.delete(r.messageId);try{if(r.error){n.reject(new Error(r.error.message));return}const i=this.transformResponseData(r.data);this.currentOptions=i;const a=this.getCacheKey();a&&this.setWebSocketCachedData(a,i),n.resolve(i),this._updateCallback&&this._updateCallback(i)}catch(i){n.reject(i)}}handleOptionsUpdate(r){try{const n=this.transformResponseData(r.data);this.currentOptions=n;const i=this.getCacheKey();i&&this.setWebSocketCachedData(i,n),this._updateCallback&&this._updateCallback(n),this.logDebug("Options updated",{count:n.length})}catch(n){this.logError("Error handling options update",n)}}handleOptionsAdd(r){try{const n=this.transformResponseData(r.data),i=new Set(this.currentOptions.map(l=>l.value)),a=n.filter(l=>!i.has(l.value));this.currentOptions=[...this.currentOptions,...a];const s=this.getCacheKey();s&&this.setWebSocketCachedData(s,this.currentOptions),this._updateCallback&&this._updateCallback(this.currentOptions),this.logDebug("Options added",{addedCount:a.length})}catch(n){this.logError("Error handling options add",n)}}handleOptionsRemove(r){var n;try{const i=new Set(((n=r.data)==null?void 0:n.values)||[]),a=this.currentOptions.length;this.currentOptions=this.currentOptions.filter(u=>!i.has(u.value));const s=a-this.currentOptions.length,l=this.getCacheKey();l&&this.setWebSocketCachedData(l,this.currentOptions),this._updateCallback&&this._updateCallback(this.currentOptions),this.logDebug("Options removed",{removedCount:s})}catch(i){this.logError("Error handling options remove",i)}}handleOptionsPatch(r){var n;try{const i=((n=r.data)==null?void 0:n.patches)||[];for(const s of i){const l=this.currentOptions.findIndex(u=>u.value===s.value);l!==-1&&(this.currentOptions[l]={...this.currentOptions[l],...s})}const a=this.getCacheKey();a&&this.setWebSocketCachedData(a,this.currentOptions),this._updateCallback&&this._updateCallback(this.currentOptions),this.logDebug("Options patched",{patchCount:i.length})}catch(i){this.logError("Error handling options patch",i)}}handleErrorMessage(r){var i;const n=new Error(((i=r.error)==null?void 0:i.message)||"Unknown server error");if(r.messageId){const a=this.pendingRequests.get(r.messageId);if(a){clearTimeout(a.timeout),this.pendingRequests.delete(r.messageId),a.reject(n);return}}this.logError("Server error message",n)}handleHeartbeat(r){var n;if(((n=r.data)==null?void 0:n.type)==="ping"){const i={type:"heartbeat",messageId:this.generateMessageId(),timestamp:Date.now(),data:{type:"pong"}};this.sendMessage(i)}}handleConnectionClose(r){var n;this.logDebug("WebSocket connection closed",{code:r.code,reason:r.reason}),this.connectionState="disconnected",this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),(n=this.config.connection)!=null&&n.autoReconnect&&r.code!==1e3&&this.scheduleReconnection()}handleConnectionError(r){this.logError("WebSocket connection error",new Error("Connection error")),this.connectionState==="connected"&&(this.connectionState="disconnected")}scheduleReconnection(){var i,a;if(this.reconnectAttempts>=(((i=this.config.connection)==null?void 0:i.maxReconnectAttempts)||5)){this.connectionState="failed",this.logError("Max reconnection attempts exceeded");return}this.reconnectAttempts++,this.connectionState="reconnecting";const r=((a=this.config.connection)==null?void 0:a.reconnectDelay)||1e3,n=Math.min(r*Math.pow(2,this.reconnectAttempts-1),3e4);this.logDebug(`Reconnecting in ${n}ms (attempt ${this.reconnectAttempts})`),setTimeout(()=>{this.connect().catch(s=>{this.logError("Reconnection failed",s),this.scheduleReconnection()})},n)}startHeartbeat(){var n;const r=((n=this.config.connection)==null?void 0:n.heartbeatInterval)||3e4;this.heartbeatInterval=setInterval(()=>{var i;if(((i=this.websocket)==null?void 0:i.readyState)===WebSocket.OPEN){const a={type:"heartbeat",messageId:this.generateMessageId(),timestamp:Date.now(),data:{type:"ping"}};this.sendMessage(a)}},r)}debounceSearch(){var n;this.searchTimeout&&clearTimeout(this.searchTimeout);const r=((n=this.config.messageHandling)==null?void 0:n.searchDebounceMs)||300;this.searchTimeout=setTimeout(()=>{this.connectionState==="connected"&&this.sendSearchRequest()},r)}sendSearchRequest(){const n={type:"search-request",messageId:this.generateMessageId(),timestamp:Date.now(),data:{searchParams:this.currentSearchParams}};this.sendMessage(n)}transformResponseData(r){if(!this.config.responseMapper)return this.validateAndTransformData(r);let n;switch(this.config.responseMapper.type){case"simple":n=this.applySimpleMapper(r,this.config.responseMapper.simple);break;case"nested":n=this.applyNestedMapper(r,this.config.responseMapper.nested);break;case"custom":n=this.config.responseMapper.custom(r);break;default:throw new Error(`Unknown response mapper type: ${this.config.responseMapper.type}`)}return this.validateAndTransformData(n)}applySimpleMapper(r,n){const i=n.arrayPath,a=n.labelField||"label",s=n.valueField||"value",l=n.disabledField||"disabled";let u;if(i){const f=i.split(".");let d=r;for(const p of f)if(d&&typeof d=="object"&&p in d)d=d[p];else throw new Error(`Path "${i}" not found in response data`);u=d}else u=r;if(!Array.isArray(u))throw new Error("Response data is not an array");return u.map((f,d)=>{if(!f||typeof f!="object")throw new Error(`Invalid item at index ${d}: must be an object`);return{label:String(f[a]||""),value:f[s],disabled:!!f[l],metadata:{...f,_index:d}}})}applyNestedMapper(r,n){const{arrayPath:i,paths:a}=n,s=i.split(".");let l=r;for(const u of s)if(l&&typeof l=="object"&&u in l)l=l[u];else throw new Error(`Path "${i}" not found in response data`);if(!Array.isArray(l))throw new Error("Nested response data is not an array");return l.map((u,f)=>{const d=y=>{const _=y.split(".");let w=u;for(const v of _)if(w&&typeof w=="object"&&v in w)w=w[v];else return;return w},p=d(a.value);let m;return typeof p=="string"||typeof p=="number"||typeof p=="boolean"?m=p:m=String(p??""),{label:String(d(a.label??"")),value:m,disabled:a.disabled?!!d(a.disabled):!1,metadata:{description:a.description&&d(a.description)||void 0,_index:f,...u}}})}getWebSocketCachedData(r){try{return super.hasCachedData(r)&&this.currentOptions.length>0?this.currentOptions:null}catch(n){return this.logError("Error retrieving cached data",n),null}}setWebSocketCachedData(r,n){try{this.currentOptions=[...n]}catch(i){this.logError("Error setting cached data",i)}}generateMessageId(){return`ws_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}}function R8(e,t){return new dh(e,t)}const z8={bearer:e=>({type:"bearer",credentials:e}),query:(e,t="token")=>({type:"query",credentials:e,paramName:t}),header:(e,t="Authorization")=>({type:"header",credentials:e,paramName:t})},H8={searchRequest:(e={},t)=>({type:"search-request",messageId:t||`search_${Date.now()}`,timestamp:Date.now(),data:{searchParams:e}}),heartbeatPing:e=>({type:"heartbeat",messageId:e||`heartbeat_${Date.now()}`,timestamp:Date.now(),data:{type:"ping"}}),optionsUpdate:(e,t)=>({type:"options-update",messageId:t||`update_${Date.now()}`,timestamp:Date.now(),data:{options:e}})};class Ye extends Error{constructor(t,r,n,i){super(t),this.path=r,this.index=n,this.originalError=i,this.name="ResponseMappingError"}}function lc(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Lo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function N1(e,t){if(!Lo(e))throw new Ye(`Invalid option at index ${t}: must be an object`,void 0,t);const{label:r,value:n,disabled:i,metadata:a}=e;if(typeof r!="string")throw new Ye(`Invalid label at index ${t}: must be a string, got ${typeof r}`,"label",t);if(n==null)throw new Ye(`Invalid value at index ${t}: cannot be undefined or null`,"value",t);if(!lc(n))throw new Ye(`Invalid value at index ${t}: must be string, number, or boolean, got ${typeof n}`,"value",t);return{label:r,value:n,disabled:!!i,metadata:Lo(a)?a:{}}}function M1(e){if(!Array.isArray(e))throw new Ye("Response must be an array of options");return e.map((t,r)=>N1(t,r))}function _a(e,t){var i;if(!e||typeof e!="object")return;if(!t||t==="")return e;const r=t.split(".");let n=e;for(const a of r){if(n==null)return;const s=a.match(/^(.+)\[(\d+)\]$/);if(s){const[,l,u]=s,f=parseInt(u,10);n=(i=n[l])==null?void 0:i[f]}else n=n[a]}return n}function K8(e,t,r){const n=t.split("."),i={...e};let a=i;for(let s=0;s<n.length-1;s++){const l=n[s];!a[l]||typeof a[l]!="object"?a[l]={}:a[l]=Array.isArray(a[l])?[...a[l]]:{...a[l]},a=a[l]}return a[n[n.length-1]]=r,i}function cc(e,t){if(!t){if(Array.isArray(e))return e;throw new Ye("Response data must be an array when no arrayPath is specified")}const r=_a(e,t);if(!Array.isArray(r))throw new Ye(`Array not found at path: ${t}. Got ${typeof r}`,t);return r}function k1(e,t=ko.simple){const{arrayPath:r,labelField:n="label",valueField:i="value",disabledField:a="disabled"}=t;return cc(e,r).map((l,u)=>{if(!Lo(l))throw new Ye(`Invalid item at index ${u}: must be an object`,void 0,u);const f=l[n],d=l[i],p=a?l[a]:!1;if(typeof f!="string")throw new Ye(`Invalid label at index ${u}: field '${n}' must be a string, got ${typeof f}`,n,u);if(d==null)throw new Ye(`Invalid value at index ${u}: field '${i}' cannot be undefined or null`,i,u);if(!lc(d))throw new Ye(`Invalid value at index ${u}: field '${i}' must be string, number, or boolean, got ${typeof d}`,i,u);return{label:f,value:d,disabled:!!p,metadata:{...l,_index:u}}})}function L1(e,t){if(!t)throw new Ye("Nested mapper configuration is required");const{arrayPath:r,paths:n}=t;if(!n||!n.label||!n.value)throw new Ye("Nested mapper requires paths.label and paths.value to be defined");return cc(e,r).map((a,s)=>{if(!Lo(a))throw new Ye(`Invalid item at index ${s}: must be an object`,void 0,s);const l=_a(a,n.label),u=_a(a,n.value),f=n.disabled?_a(a,n.disabled):!1,d=n.description?_a(a,n.description):void 0;if(typeof l!="string")throw new Ye(`Invalid label at index ${s}: path '${n.label}' must resolve to a string, got ${typeof l}`,n.label,s);if(u==null)throw new Ye(`Invalid value at index ${s}: path '${n.value}' cannot be undefined or null`,n.value,s);if(!lc(u))throw new Ye(`Invalid value at index ${s}: path '${n.value}' must resolve to string, number, or boolean, got ${typeof u}`,n.value,s);return{label:l,value:u,disabled:!!f,metadata:{description:typeof d=="string"?d:void 0,_index:s,_originalData:a}}})}function j1(e){return t=>{try{const r=e(t);if(!Array.isArray(r))throw new Ye("Custom mapper must return an array of ChoiceOption");return M1(r)}catch(r){throw r instanceof Ye?r:new Ye("Custom mapper failed",void 0,void 0,r instanceof Error?r:new Error(String(r)))}}}function G8(e,t){try{switch(t.type){case"simple":return k1(e,t.simple);case"nested":if(!t.nested)throw new Ye("Nested mapper configuration is required for nested type");return L1(e,t.nested);case"custom":if(!t.custom)throw new Ye("Custom mapper function is required for custom type");return j1(t.custom)(e);default:throw new Ye(`Unknown response mapper type: ${t.type}`)}}catch(r){throw r instanceof Ye?r:new Ye("Response mapping failed",void 0,void 0,r instanceof Error?r:new Error(String(r)))}}const Y8={SIMPLE_ARRAY:{type:"simple",simple:{labelField:"label",valueField:"value",disabledField:"disabled"}},NAME_ID:{type:"simple",simple:{labelField:"name",valueField:"id",disabledField:"disabled"}},TITLE_KEY:{type:"simple",simple:{labelField:"title",valueField:"key",disabledField:"disabled"}},TEXT_VALUE:{type:"simple",simple:{labelField:"text",valueField:"value",disabledField:"disabled"}},DISPLAY_CODE:{type:"simple",simple:{labelField:"display",valueField:"code",disabledField:"disabled"}}},J8={DATA_ARRAY:{type:"simple",simple:{arrayPath:"data",labelField:"label",valueField:"value",disabledField:"disabled"}},RESULTS_ARRAY:{type:"simple",simple:{arrayPath:"results",labelField:"name",valueField:"id",disabledField:"disabled"}},ITEMS_ARRAY:{type:"simple",simple:{arrayPath:"items",labelField:"label",valueField:"value",disabledField:"disabled"}},NESTED_DATA_ITEMS:{type:"simple",simple:{arrayPath:"data.items",labelField:"label",valueField:"value",disabledField:"disabled"}},RESPONSE_DATA:{type:"simple",simple:{arrayPath:"response.data",labelField:"name",valueField:"id",disabledField:"disabled"}}};function X8(e){const{invertActive:t=!1}=e;return{type:"custom",custom:r=>cc(r,e.arrayPath).map((i,a)=>{if(!Lo(i))throw new Ye(`Invalid item at index ${a}: must be an object`,void 0,a);const s=i[e.labelField],l=i[e.valueField],u=i[e.activeField];if(typeof s!="string")throw new Ye(`Invalid label at index ${a}: field '${e.labelField}' must be a string`,e.labelField,a);if(!lc(l))throw new Ye(`Invalid value at index ${a}: field '${e.valueField}' must be string, number, or boolean`,e.valueField,a);const f=!!u;return{label:s,value:l,disabled:t?f:!f,metadata:{...i,_index:a,_active:f}}})}}function Z8(e){return t=>{let r=t;for(let n=0;n<e.length;n++){const i=e[n];try{if(n===0){const a=i(r);if(!Array.isArray(a))throw new Error(`Mapper at index ${n} must return an array of ChoiceOption`);r=a}else{const a=i(r);if(!Array.isArray(a))throw new Error(`Mapper at index ${n} must return an array of ChoiceOption`);r=a}}catch(a){throw new Ye(`Pipeline failed at step ${n+1}`,void 0,n,a instanceof Error?a:new Error(String(a)))}}return M1(r)}}function Q8(e){return e.filter(t=>!t.disabled)}function ez(e,t){return[...e].sort((r,n)=>r.label.localeCompare(n.label,t))}function tz(e){return[...e].sort((t,r)=>typeof t.value=="string"&&typeof r.value=="string"?t.value.localeCompare(r.value):typeof t.value=="number"&&typeof r.value=="number"?t.value-r.value:String(t.value).localeCompare(String(r.value)))}function rz(e,t){return e.map(r=>({...r,metadata:{...r.metadata,group:t(r)}}))}function nz(e,t){return e.map((r,n)=>t(r,n))}class uc{constructor(){pe(this,"DefaultLoadingComponent",({message:t,progress:r})=>B.createElement("div",{className:"edf-choice-widget__loading",role:"status","aria-live":"polite"},[B.createElement("span",{key:"spinner",className:"edf-choice-widget__loading-spinner"}),t&&B.createElement("span",{key:"message",className:"edf-choice-widget__loading-message"},t),r!==void 0&&B.createElement("div",{key:"progress",className:"edf-choice-widget__loading-progress"},B.createElement("div",{className:"edf-choice-widget__loading-progress-bar",style:{width:`${r}%`},role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100}))]));pe(this,"DefaultErrorComponent",({message:t,recoverable:r,id:n})=>B.createElement("div",{className:"edf-choice-widget__error",role:"alert",id:n,"aria-live":"assertive"},[B.createElement("span",{key:"icon",className:"edf-choice-widget__error-icon","aria-hidden":!0},"⚠️"),B.createElement("span",{key:"message",className:"edf-choice-widget__error-message"},t),r&&B.createElement("span",{key:"hint",className:"edf-choice-widget__error-hint"},"Please try again")]));pe(this,"DefaultEmptyComponent",({message:t})=>B.createElement("div",{className:"edf-choice-widget__empty",role:"status"},[B.createElement("span",{key:"icon",className:"edf-choice-widget__empty-icon","aria-hidden":!0},"📭"),B.createElement("span",{key:"message",className:"edf-choice-widget__empty-message"},t||"No options available")]))}getAccessibilityProps(t,r,n){const{id:i,label:a,required:s,readonly:l,disabled:u,schema:f}=t,{error:d,loading:p}=r,m={"aria-label":(n==null?void 0:n.ariaLabel)||a||(f==null?void 0:f.title)||"Select an option","aria-required":s||!1,"aria-readonly":l||!1,"aria-disabled":u||!1,"aria-invalid":d.hasError,"aria-busy":p.isLoading,id:i,role:this.getAriaRole()};if(d.hasError&&d.message&&(m["aria-errormessage"]=`${i}-error`,m["aria-describedby"]=`${i}-error`),n!=null&&n.ariaDescription){const y=m["aria-describedby"];m["aria-describedby"]=y?`${y} ${i}-description`:`${i}-description`}return n!=null&&n.announceChanges&&(m["aria-live"]="polite",m["aria-atomic"]=!0),n!=null&&n.ariaAttributes&&Object.entries(n.ariaAttributes).forEach(([y,_])=>{(y.startsWith("aria-")||y==="role")&&(m[y]=_)}),m}handleKeyboardNavigation(t,r,n,i){var d;const{filteredOptions:a,focusedOptionIndex:s}=n,{keyboard:l}=((d=r.options.choiceConfig)==null?void 0:d.accessibility)||{};if(!(l!=null&&l.arrowKeys)&&!(l!=null&&l.homeEnd)&&!(l!=null&&l.typeAhead))return;const{key:u}=t,f=a.length;switch(u){case"ArrowDown":if(l!=null&&l.arrowKeys){t.preventDefault();const p=(s+1)%f;i.setFocusedIndex(p)}break;case"ArrowUp":if(l!=null&&l.arrowKeys){t.preventDefault();const p=s<=0?f-1:s-1;i.setFocusedIndex(p)}break;case"Home":l!=null&&l.homeEnd&&(t.preventDefault(),i.setFocusedIndex(0));break;case"End":l!=null&&l.homeEnd&&(t.preventDefault(),i.setFocusedIndex(f-1));break;case"Enter":case" ":if(s>=0&&s<f){t.preventDefault();const p=a[s];p.disabled||i.selectOption(p)}break;case"Escape":i.toggleDropdown&&(t.preventDefault(),i.toggleDropdown(!1));break;default:l!=null&&l.typeAhead&&u.length===1&&/\S/.test(u)&&this.handleTypeAhead(u,n,i);break}}handleTypeAhead(t,r,n){const{filteredOptions:i,focusedOptionIndex:a}=r,s=t.toLowerCase(),l=a+1;for(let u=0;u<i.length;u++){const f=(l+u)%i.length,d=i[f];if(d.label.toLowerCase().startsWith(s)&&!d.disabled){n.setFocusedIndex(f);break}}}getLoadingProps(t,r){return{component:r||this.DefaultLoadingComponent,props:t}}getErrorProps(t,r,n){return{component:r||this.DefaultErrorComponent,props:{...t,id:n?`${n}-error`:void 0}}}getEmptyProps(t,r){return{component:r||this.DefaultEmptyComponent,props:{message:t||"No options available"}}}normalizeValue(t,r){return t==null?[]:r?Array.isArray(t)?t.filter(n=>n!=null):[t]:Array.isArray(t)?t.length>0?[t[0]]:[]:[t]}denormalizeValue(t,r){return r?t:t.length>0?t[0]:void 0}getThemeClasses(t,r){return["edf-choice-widget",`edf-choice-widget--${this.presentationMode}`,t.size&&`edf-choice-widget--${t.size}`,t.disabled&&"edf-choice-widget--disabled",t.readonly&&"edf-choice-widget--readonly",t.className,r].filter(Boolean).join(" ")}getThemeStyles(t,r){return{...t.style,...r}}createEventHandlers(t,r,n,i){return{fieldId:t,schema:r,formData:n,fieldPath:i,_hookRequired:!0}}validateSelection(t,r,n){var d,p,m;const{validation:i,multiple:a,minSelections:s,maxSelections:l}=n;if(t.length===0&&((d=i==null?void 0:i.messages)!=null&&d.required))return i.messages.required;if(a){if(s&&t.length<s)return`Please select at least ${s} option${s>1?"s":""}`;if(l&&t.length>l)return`Please select at most ${l} option${l>1?"s":""}`}if(i!=null&&i.validator){const y=i.validator(t,r);if(y)return((p=i.messages)==null?void 0:p.custom)||y}const u=r.map(y=>y.value);return t.filter(y=>!u.includes(y)).length>0?((m=i==null?void 0:i.messages)==null?void 0:m.invalid)||"Invalid selection":null}getAntdSize(t){return t||"middle"}isSelected(t,r){return r.includes(t)}filterOptions(t,r,n){if(!(n!=null&&n.enabled)||!r||r.length<(n.minLength||1))return t;const i=n.caseSensitive?r:r.toLowerCase(),a=n.searchFields||["label"];return t.filter(s=>n.customFilter?n.customFilter(s,r):a.some(l=>{var d;let u;switch(l){case"label":u=s.label;break;case"value":u=String(s.value);break;case"description":u=(d=s.metadata)==null?void 0:d.description;break}return u?(n.caseSensitive?u:u.toLowerCase()).includes(i):!1}))}}var fc={exports:{}};/**
83
83
  * @license
84
84
  * Lodash <https://lodash.com/>
85
85
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extended-dynamic-forms",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Extended React JSON Schema Form (RJSF) v6 with custom components, widgets, templates, layouts, and form events",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",