import e from"../_util/vue-types/index.mjs";import t from"../_util/BaseInput.mjs";import n from"./KeyCode.mjs";import{computed as r,createVNode as i,defineComponent as a,ref as o}from"vue";var s=a({compatConfig:{MODE:3},props:{disabled:{type:Boolean,default:void 0},changeSize:Function,quickGo:Function,selectComponentClass:e.any,current:Number,pageSizeOptions:e.array.def([`10`,`20`,`50`,`100`]),pageSize:Number,buildOptionText:Function,locale:e.object,rootPrefixCls:String,selectPrefixCls:String,goButton:e.any},setup(e){let a=o(``),s=r(()=>!a.value||isNaN(a.value)?void 0:Number(a.value)),c=t=>`${t.value} ${e.locale.items_per_page}`,l=e=>{let{value:t}=e.target;a.value!==t&&(a.value=t)},u=t=>{let{goButton:n,quickGo:r,rootPrefixCls:i}=e;n||a.value===``||(t.relatedTarget&&(t.relatedTarget.className.includes(`${i}-item-link`)||t.relatedTarget.className.includes(`${i}-item`))||r(s.value),a.value=``)},d=t=>{a.value!==``&&(t.keyCode===n.ENTER||t.type===`click`)&&(e.quickGo(s.value),a.value=``)},f=r(()=>{let{pageSize:t,pageSizeOptions:n}=e;return n.some(e=>e.toString()===t.toString())?n:n.concat([t.toString()]).sort((e,t)=>(isNaN(Number(e))?0:Number(e))-(isNaN(Number(t))?0:Number(t)))});return()=>{let{rootPrefixCls:n,locale:r,changeSize:o,quickGo:s,goButton:p,selectComponentClass:m,selectPrefixCls:h,pageSize:g,disabled:_}=e,v=`${n}-options`,y=null,b=null,x=null;if(!o&&!s)return null;if(o&&m){let t=e.buildOptionText||c,n=f.value.map((e,n)=>i(m.Option,{key:n,value:e},{default:()=>[t({value:e})]}));y=i(m,{disabled:_,prefixCls:h,showSearch:!1,class:`${v}-size-changer`,optionLabelProp:`children`,value:(g||f.value[0]).toString(),onChange:e=>o(Number(e)),getPopupContainer:e=>e.parentNode},{default:()=>[n]})}return s&&(p&&(x=typeof p==`boolean`?i(`button`,{type:`button`,onClick:d,onKeyup:d,disabled:_,class:`${v}-quick-jumper-button`},[r.jump_to_confirm]):i(`span`,{onClick:d,onKeyup:d},[p])),b=i(`div`,{class:`${v}-quick-jumper`},[r.jump_to,i(t,{disabled:_,type:`text`,value:a.value,onInput:l,onChange:l,onKeyup:d,onBlur:u},null),r.page,x])),i(`li`,{class:`${v}`},[y,b])}}});export{s as default};