import{g as S,i as b,aH as A,u as w,b2 as _,k as R,H as k,a as q,j as s,_ as V,h as m,f as y,bG as j,ed as H}from"./main-634.js";import{F as u}from"./bf-767-388.js";import{E as M}from"./bf-178-233.js";import{S as I}from"./bf-982-242.js";import"./bf-692-111.js";import"./bf-400-72.js";import"./bf-25-81.js";import"./bf-438-114.js";import"./bf-486-243.js";import"./bf-497-246.js";import"./bf-723-244.js";import"./bf-299-245.js";import"./bf-534-247.js";import"./bf-962-248.js";import"./bf-343-249.js";import"./bf-791-250.js";import"./bf-641-107.js";import"./bf-570-251.js";import"./bf-838-80.js";import"./bf-297-103.js";import"./bf-284-252.js";import"./bf-17-106.js";import"./bf-671-253.js";import"./bf-334-254.js";import"./bf-710-385.js";import"./bf-676-386.js";import"./bf-638-271.js";import"./bf-247-269.js";import"./bf-423-273.js";import"./bf-457-387.js";import"./bf-577-275.js";import"./bf-288-389.js";import"./bf-939-390.js";const N={minFile:"Change Minimum File to",maxFile:"Change Maximum File to"};function xi(){const{fieldKey:n}=S(),[p,x]=b(A);w(_);const f=w(R),t=k(p[n]),{multiple:F,minFile:h,maxFile:g}=t.config,l=(f==null?void 0:f.err)||{};let r=isNaN(h)?0:Number(h),d=isNaN(g)?0:Number(g);const{css:a}=q(),v=(i,o)=>{t.config[i]=o;const e=y(p,c=>{c[n]=t});x(e),j({event:`${N[i]||i} '${String(o||"Off").replace("true","On")}': ${t.lbl||n}`,type:`${i}_changed`,state:{fields:e,fldKey:n}})},$=(i,o)=>{const e=isNaN(Number(o))?0:Number(o);if(e>=0){i==="maxFile"&&r&&e<r?(t.config.minFile=e,t.err.minFile.dflt=(l==null?void 0:l.minFile)||`Minimum ${e} File Required`):i==="minFile"&&e>d&&d&&(t.config.maxFile=e,t.err.maxFile.dflt=(l==null?void 0:l.maxFile)||`Maximum ${e} File can uploaded`),i==="minFile"?t.err.minFile.dflt=(l==null?void 0:l.minFile)||`Minimum ${e} File Required`:i==="maxFile"&&(t.err.maxFile.dflt=(l==null?void 0:l.maxFile)||`Maximum ${e} File can uploaded`),t.config[i]=e;const c=y(p,C=>{C[n]=t});x(c),j({event:`${N[i]} '${e}': ${t.lbl||n}`,type:`${i}_changed`,state:{fields:c,fldKey:n}}),i==="minFile"&&e>0&&H({target:{checked:!0}})}};return s.jsx(I,{id:"alw-mltpl-stng",title:V("Allow Multiple:"),toggleAction:i=>v("multiple",i.target.checked),toggleChecked:F,className:a(u.fieldSection,u.hover_tip),switching:!0,tip:"By enabling this feature, you wil enable to select multiple file control file upload limit",tipProps:{width:200,icnSize:17},open:F,disable:!F,children:s.jsxs("div",{className:a(m.ml1,m.mr1),children:[s.jsxs("div",{className:a(m.flxc),children:[s.jsx("span",{children:"Minimum File"}),s.jsx("input",{"data-testid":"alw-mltpl-min-inp",className:a(u.input,m.w5,m.mt1),type:"number",value:r,onChange:i=>$("minFile",i.target.value)})]}),s.jsx(M,{className:a(m.mt0),id:"min-fil-err-msg",type:"minFile",defaultMsg:`Minimum ${r} File Required`,allowIcons:!1}),s.jsxs("div",{className:a(m.flxc,m.mt2),children:[s.jsx("span",{children:"Maximum File"}),s.jsx("input",{"data-testid":"alw-mltpl-max-inp",className:a(u.input,m.w5,m.mt1),type:"number",value:d,onChange:i=>$("maxFile",i.target.value)})]}),s.jsx(M,{className:a(m.mt0),id:"max-fil-err-msg",type:"maxFile",defaultMsg:`Maximum ${d} File can uploaded`,allowIcons:!1})]})})}export{xi as default};
