import"../../../vc-util/warning.mjs";import{ref as e}from"vue";function t(t,n){let r=e(null);function i(){try{let{selectionStart:e,selectionEnd:n,value:i}=t.value,a=i.substring(0,e),o=i.substring(n);r.value={start:e,end:n,value:i,beforeTxt:a,afterTxt:o}}catch{}}function a(){if(t.value&&r.value&&n.value)try{let{value:e}=t.value,{beforeTxt:n,afterTxt:i,start:a}=r.value,o=e.length;if(e.endsWith(i))o=e.length-r.value.afterTxt.length;else if(e.startsWith(n))o=n.length;else{let t=n[a-1],r=e.indexOf(t,a-1);r!==-1&&(o=r+1)}t.value.setSelectionRange(o,o)}catch(e){`${e.message}`}}return[i,a]}export{t as default};