import{__spreadArray}from"tslib";import{l as lodash_isnil}from"./index-82aff103.js";function getValues(r){if(Array.isArray(r)){return r.filter((function(r){return!lodash_isnil(r)}))}return[]}function length(r){return getValues(r).length}function removeValue(r,e){return getValues(r).filter((function(r){return r!==e}))}function addValue(r,e,n){var a=getValues(r);if(n){if(a.includes(e)){return removeValue(r,e)}return __spreadArray(__spreadArray([],a,true),[e],false)}return[e]}function validateAfterBlur(r,e,n){var a=getValues(r);if(a.length>0){var t=e.get(a[0]);if(lodash_isnil(t)||n!==t.label){return[]}}else{var i=findOptionByLabel(e,n);if(!lodash_isnil(i)){return addValue(r,i.value,false)}}return a}function findOptionByLabelIterator(r,e){var n=r.next(),a=n.value,t=n.done;if(!lodash_isnil(a)&&a.label===e){return a}if(t){return undefined}return findOptionByLabelIterator(r,e)}function findOptionByLabel(r,e){return findOptionByLabelIterator(r.values(),e)}function findLabelByValue(r,e){var n=r.get(e);if(!lodash_isnil(n)){return n.label}return""}function startsWith(r,e){var n=r.trim().toLowerCase();var a=e.trim().toLowerCase();return n.startsWith(a)}function includes(r,e){var n=r.trim().toLowerCase();var a=e.trim().toLowerCase();return n.includes(a)}function preventDefault(r){r.preventDefault();r.stopPropagation()}export{addValue as a,findOptionByLabel as b,findLabelByValue as f,getValues as g,includes as i,length as l,preventDefault as p,removeValue as r,startsWith as s,validateAfterBlur as v};