const e=require("../../_util/vue-types/index.js"),t=require("../../vc-tree-select/LegacyContext.js"),n=require("../../_util/pickAttrs.js"),r=require("./Input.js");let i=require("vue");var a={inputElement:e.default.any,id:String,prefixCls:String,values:e.default.array,open:{type:Boolean,default:void 0},searchValue:String,inputRef:e.default.any,placeholder:e.default.any,compositionStatus:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},mode:String,showSearch:{type:Boolean,default:void 0},autofocus:{type:Boolean,default:void 0},autocomplete:String,activeDescendantId:String,tabindex:e.default.oneOfType([e.default.number,e.default.string]),activeValue:String,backfill:{type:Boolean,default:void 0},optionLabelRender:Function,onInputChange:Function,onInputPaste:Function,onInputKeyDown:Function,onInputMouseDown:Function,onInputCompositionStart:Function,onInputCompositionEnd:Function},o=(0,i.defineComponent)({name:`SingleSelector`,setup(e){let a=(0,i.shallowRef)(!1),o=(0,i.computed)(()=>e.mode===`combobox`),s=(0,i.computed)(()=>o.value||e.showSearch),c=(0,i.computed)(()=>{let t=e.searchValue||``;return o.value&&e.activeValue&&!a.value&&(t=e.activeValue),t}),l=t.default();(0,i.watch)([o,()=>e.activeValue],()=>{o.value&&(a.value=!1)},{immediate:!0});let u=(0,i.computed)(()=>e.mode!==`combobox`&&!e.open&&!e.showSearch?!1:!!c.value||e.compositionStatus),d=(0,i.computed)(()=>{let t=e.values[0];return t&&(typeof t.label==`string`||typeof t.label==`number`)?t.label.toString():void 0}),f=()=>{if(e.values[0])return null;let t=u.value?{visibility:`hidden`}:void 0;return(0,i.createVNode)(`span`,{class:`${e.prefixCls}-selection-placeholder`,style:t},[e.placeholder])},p=t=>{t.target.composing||(a.value=!0,e.onInputChange(t))};return()=>{let{inputElement:t,prefixCls:a,id:m,values:h,inputRef:g,disabled:_,autofocus:v,autocomplete:y,activeDescendantId:b,open:x,tabindex:S,optionLabelRender:C,onInputKeyDown:w,onInputMouseDown:T,onInputPaste:E,onInputCompositionStart:D,onInputCompositionEnd:O}=e,k=h[0],A=null;if(k&&l.customSlots){let e=k.key??k.value,t=l.keyEntities[e]?.node||{};A=l.customSlots[t.slots?.title]||l.customSlots.title||k.label,typeof A==`function`&&(A=A(t))}else A=C&&k?C(k.option):k?.label;return(0,i.createVNode)(i.Fragment,null,[(0,i.createVNode)(`span`,{class:`${a}-selection-search`},[(0,i.createVNode)(r.default,{inputRef:g,prefixCls:a,id:m,open:x,inputElement:t,disabled:_,autofocus:v,autocomplete:y,editable:s.value,activeDescendantId:b,value:c.value,onKeydown:w,onMousedown:T,onChange:p,onPaste:E,onCompositionstart:D,onCompositionend:O,tabindex:S,attrs:n.default(e,!0)},null)]),!o.value&&k&&!u.value&&(0,i.createVNode)(`span`,{class:`${a}-selection-item`,title:d.value},[(0,i.createVNode)(i.Fragment,{key:k.key??k.value},[A])]),f()])}}});o.props=a,o.inheritAttrs=!1,exports.default=o;