var C=Object.defineProperty,I=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var j=(r,e,o)=>e in r?C(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,k=(r,e)=>{for(var o in e||(e={}))R.call(e,o)&&j(r,o,e[o]);if(P)for(var o of P(e))T.call(e,o)&&j(r,o,e[o]);return r},A=(r,e)=>I(r,K(e));import{g as z,i as B,aH as G,u as N,k as V,H as b,j as E,_ as p,I as _,f as J,bG as L}from"./main-634.js";import{S as M}from"./bf-982-242.js";import{E as Q}from"./bf-178-233.js";function Z({type:r,title:e,tipTitle:o,isUnique:i,className:F}){var a,f,m,g,l,u;const{fieldKey:n}=z(),[d,H]=B(G),t=N(V),s=b(d[n]),O=v=>{var $,w,x;if(!_)return;const{checked:h}=v.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=J(d,c=>{c[n]=s});H(S),L({event:`${e} ${h?"On":"Off"}`,type:e,state:{fields:S,fldKey:n}})};return E.jsx(M,A(k({id:`${r}-stng`,title:p(e),className:F,tip:o,toggleName:r,toggleAction:O,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]},_&&{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};
