var I=Object.defineProperty,K=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var P=(r,e,o)=>e in r?I(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,j=(r,e)=>{for(var o in e||(e={}))T.call(e,o)&&P(r,o,e[o]);if(A)for(var o of A(e))z.call(e,o)&&P(r,o,e[o]);return r},k=(r,e)=>K(r,R(e));import{g as B,i as H,u as N,A as V,j as E,_ as b,I as F,f as p,bD as G,aF as J,k as L}from"./main-343.js";import{S as M}from"./bf-711-253.js";import{E as Q}from"./bf-794-390.js";function Z({type:r,title:e,tipTitle:o,isUnique:i,className:_}){var a,f,m,g,l,u;const{fieldKey:n}=B(),[d,O]=H(J),t=N(L),s=V(d[n]),v=C=>{var $,w,x;if(!F)return;const{checked:h}=C.target;if(s.err||(s.err={}),s.err[r]||(s.err[r]={}),h){s.err[r].show=!0;const c="That field value is taken. Try another";s.err[r].dflt||(s.err[r].dflt=((w=($=t==null?void 0:t.err)==null?void 0:$[s.typ])==null?void 0:w[r])||((x=t==null?void 0:t.err)==null?void 0:x[r])||c)}else delete s.err[r].show;const S=p(d,c=>{c[n]=s});O(S),G({event:`${e} ${h?"On":"Off"}`,type:e,state:{fields:S,fldKey:n}})};return E.jsx(M,k(j({id:`${r}-stng`,title:b(e),className:_,tip:o,toggleName:r,toggleAction:v,toggleChecked:(f=(a=s==null?void 0:s.err)==null?void 0:a[r])==null?void 0:f[i],switching:!0,tipProps:{width:200,icnSize:17},open:(g=(m=s==null?void 0:s.err)==null?void 0:m[r])==null?void 0:g[i]},F&&{disable:!((u=(l=s==null?void 0:s.err)==null?void 0:l[r])!=null&&u[i])}),{isPro:!0,proProperty:r,children:E.jsx(Q,{id:`${r}-stng`,type:r,title:e,tipTitle:o})}))}export{Z as U};
