import{h as te,u as le,b as T,a as B,e as ae,f as ne,m as ue,V as oe,g as ie}from"./DmHQoNBb.js";import{f as se}from"./D_qxKlPu.js";import{au as re,cv as ce,cw as de,al as fe,a3 as g,bi as h,O as m,bO as y,bI as ve,bq as M,W as a,F as C,cT as me,bm as xe,N as Ve,bk as F,z as be}from"#entry";import{I as D}from"./Cp3UUybv.js";const ge=["color","file","time","date","datetime-local","week","month"],he=ve({autofocus:Boolean,counter:[Boolean,Number,String],counterValue:[Number,Function],prefix:String,placeholder:String,persistentPlaceholder:Boolean,persistentCounter:Boolean,suffix:String,role:String,type:{type:String,default:"text"},modelModifiers:Object,...ue(),...M(ne(),["direction"]),...ae()},"VTextField"),ke=re()({name:"VTextField",directives:{vIntersect:D},inheritAttrs:!1,props:he(),emits:{"click:control":e=>!0,"mousedown:control":e=>!0,"update:focused":e=>!0,"update:modelValue":e=>!0},setup(e,O){let{attrs:x,emit:P,slots:n}=O;const u=ce(e,"modelValue",void 0,t=>Object.is(t,-0)?"-0":t),{isFocused:o,focus:k,blur:E}=te(e),{onIntersect:z}=ie(e),j=m(()=>typeof e.counterValue=="function"?e.counterValue(u.value):typeof e.counterValue=="number"?e.counterValue:(u.value??"").toString().length),U=m(()=>{if(x.maxlength)return x.maxlength;if(!(!e.counter||typeof e.counter!="number"&&typeof e.counter!="string"))return e.counter}),_=m(()=>["plain","underlined"].includes(e.variant)),I=y(),S=y(),i=y(),d=le(e),$=m(()=>ge.includes(e.type)||e.persistentPlaceholder||o.value||e.active);function A(){d.isSuppressing.value&&d.update(),o.value||k(),F(()=>{i.value!==document.activeElement&&i.value?.focus()})}function q(t){P("mousedown:control",t),t.target!==i.value&&(A(),t.preventDefault())}function W(t){P("click:control",t)}function G(t,l){t.stopPropagation(),A(),F(()=>{l(),be(e["onClick:clear"],t)})}function H(t){const l=t.target;if(!(e.modelModifiers?.trim&&["text","search","password","tel","url"].includes(e.type))){u.value=l.value;return}const s=l.value,f=l.selectionStart,V=l.selectionEnd;u.value=s,F(()=>{let r=0;s.trimStart().length===l.value.length&&(r=s.length-l.value.length),f!=null&&(l.selectionStart=f-r),V!=null&&(l.selectionEnd=V-r)})}return de(()=>{const t=!!(n.counter||e.counter!==!1&&e.counter!=null),l=!!(t||n.details),[s,f]=fe(x),{modelValue:V,...r}=T.filterProps(e),J=B.filterProps(e);return g(T,h({ref:I,modelValue:u.value,"onUpdate:modelValue":c=>u.value=c,class:["v-text-field",{"v-text-field--prefixed":e.prefix,"v-text-field--suffixed":e.suffix,"v-input--plain-underlined":_.value},e.class],style:e.style},s,r,{centerAffix:!_.value,focused:o.value}),{...n,default:c=>{let{id:v,isDisabled:w,isDirty:N,isReadonly:K,isValid:L,hasDetails:Q,reset:X}=c;return g(B,h({ref:S,onMousedown:q,onClick:W,"onClick:clear":b=>G(b,X),role:e.role},M(J,["onClick:clear"]),{id:v.value,labelId:`${v.value}-label`,active:$.value||N.value,dirty:N.value||e.dirty,disabled:w.value,focused:o.value,details:Q.value,error:L.value===!1}),{...n,default:b=>{let{props:{class:p,...Y},controlRef:Z}=b;const R=a("input",h({ref:ee=>i.value=Z.value=ee,value:u.value,onInput:H,autofocus:e.autofocus,readonly:K.value,disabled:w.value,name:d.fieldName.value,autocomplete:d.fieldAutocomplete.value,placeholder:e.placeholder,size:1,role:e.role,type:e.type,onFocus:k,onBlur:E,"aria-labelledby":`${v.value}-label`},Y,f),null);return a(C,null,[e.prefix&&a("span",{class:"v-text-field__prefix"},[a("span",{class:"v-text-field__prefix__text"},[e.prefix])]),me(n.default?a("div",{class:xe(p),"data-no-activator":""},[n.default({id:v}),R]):Ve(R,{class:p}),[[D,z,null,{once:!0}]]),e.suffix&&a("span",{class:"v-text-field__suffix"},[a("span",{class:"v-text-field__suffix__text"},[e.suffix])])])}})},details:l?c=>a(C,null,[n.details?.(c),t&&a(C,null,[a("span",null,null),g(oe,{active:e.persistentCounter||o.value,value:j.value,max:U.value,disabled:e.disabled},n.counter)])]):void 0})}),se({},I,S,i)}});export{ke as V,he as m};
