import{_ as m}from"./tslib.es6-CxX45GIN-BGVaTf34.js";import{h as i,F as H}from"./index-Bphhj8Un.js";import{B as R}from"./variant-quote-CHD0qMkY-Di-MtwAe.js";import{T as E}from"./component-uWorUZss-CN_22NAm.js";import{T as $}from"./controller-BhIDd4zH-DAtIsCRY.js";import{b as M,s as W}from"./component-sn_z4L8i-BDtwqac9.js";import{K as D,a as z,i as G,b as J}from"./FormFieldStateWrapper-BVrH-o65-CnfN383n.js";import{c}from"./clsx-COFh-Vc8-D7cYsJM5.js";const f=new Map,Q=o=>{const l=f.get(o);if(l)return l;const n=new $(R.stateLess);return n.componentWillLoad({label:""}),f.set(o,n),n},U=o=>{const l=f.get(o);l&&(l.destroy(),f.delete(o))},V=(o,l)=>{var{class:n}=o,t=m(o,["class"]);return i("div",Object.assign({class:c("kol-field-control__input",n)},t),l)},X=(o,l)=>{const{class:n,id:t,disabled:L,label:s,hideLabel:p,labelAlign:b,renderNoTooltip:x,hint:w,renderNoHint:I,accessKey:C,shortKey:y,msg:_,touched:T,required:A,readonly:O,tooltipAlign:F,tooltipFloatingRef:u,fieldControlInputProps:a,fieldControlLabelProps:d,fieldControlTooltipProps:g,fieldControlHintProps:P}=o,N=m(o,["class","id","disabled","label","hideLabel","labelAlign","renderNoTooltip","hint","renderNoHint","accessKey","shortKey","msg","touched","required","readonly","tooltipAlign","tooltipFloatingRef","fieldControlInputProps","fieldControlLabelProps","fieldControlTooltipProps","fieldControlHintProps"]),S=!I,j=!x,v=W(s),K=j&&!v&&p,k=M(C,y),e=K?Q(t):void 0;e?(e.watchAlign(F),e.watchBadgeText(k||""),e.watchId(`${t}-label`),e.watchLabel(s)):U(t);const h=a?.ref,B=[i(H,null,i(V,Object.assign({},a,{ref:r=>{h?.(r),e&&r&&(e.initContext(r),e.syncListeners(void 0,r,!0))}}),l),K&&i("div",{class:c("kol-form-field__tooltip",g?.class)},i(E,{badgeText:k||"",label:s,align:F,id:`${t}-label`,refFloating:u??(r=>{e?.setTooltipElementRef(r)})}))),i(D,Object.assign({},d||{},{id:t,baseClassName:"kol-field-control",class:c(d?.class,{"kol-field-control__label--visually-hidden":!!p}),hasExpertSlot:v,label:s,accessKey:C,shortKey:y}))];b==="left"&&B.reverse();const q={"kol-field-control--disabled":!!L,"kol-field-control--required":!!A,"kol-field-control--touched":!!T,"kol-field-control--hide-label":!!p,"kol-field-control--read-only":!!O,[`kol-field-control--${z(_)}`]:!!G(_,T),[`kol-field-control--label-align-${b}`]:!!b};return i("div",Object.assign({class:c("kol-field-control",q,n)},N),B,S&&i(J,Object.assign({},P||{},{baseClassName:"kol-field-control",id:t,hint:w})))};function Y(o){const l={id:o._id,disabled:o._disabled,msg:o._msg,hint:o._hint,label:o._label,hideLabel:o._hideLabel,touched:o._touched};return"_required"in o&&(l.required=o._required),"_readOnly"in o&&(l.readonly=o._readOnly),"_labelAlign"in o&&(l.labelAlign=o._labelAlign),"_accessKey"in o&&(l.accessKey=o._accessKey),"_shortKey"in o&&(l.shortKey=o._shortKey),l}const ao=(o,l)=>{var{state:n}=o,t=m(o,["state"]);return i(X,Object.assign({},Y(n),t),l)};export{ao as F};
//# sourceMappingURL=FieldControlStateWrapper--n2Qrl3k-Cl1ACcc9.js.map
