function e(e){let{selectionStart:t}=e;return e.value.slice(0,t)}function t(e,t=``){return(Array.isArray(t)?t:[t]).reduce((t,n)=>{let r=e.lastIndexOf(n);return r>t.location?{location:r,prefix:n}:t},{location:-1,prefix:``})}function n(e){return(e||``).toLowerCase()}function r(e,t,r){let i=e[0];if(!i||i===r)return e;let a=e,o=t.length;for(let e=0;e<o;e+=1)if(n(a[e])!==n(t[e])){a=a.slice(e);break}else e===o-1&&(a=a.slice(o));return a}function i(e,t){let{measureLocation:n,prefix:i,targetText:a,selectionStart:o,split:s}=t,c=e.slice(0,n);c[c.length-s.length]===s&&(c=c.slice(0,c.length-s.length)),c&&(c=`${c}${s}`);let l=r(e.slice(o),a.slice(o-n-i.length),s);l.slice(0,s.length)===s&&(l=l.slice(s.length));let u=`${c}${i}${a}${s}`;return{text:`${u}${l}`,selectionLocation:u.length}}function a(e,t){e.setSelectionRange(t,t),e.blur(),e.focus()}function o(e,t){let{split:n}=t;return!n||!e.includes(n)}function s(e,{value:t=``}){let n=e.toLowerCase();return t.toLowerCase().includes(n)}export{s as filterOption,e as getBeforeSelectionText,t as getLastMeasureIndex,i as replaceWithMeasure,a as setInputSelection,o as validateSearch};