"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("react/jsx-runtime"),r=require("react"),u=require("classnames"),i=require("../../TextInputNext/TextInputNext.js"),o=require("../../TextInput/TextInput.js"),l=require("../Autocomplete.scss.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(e),p=s(t),f=s(u),c=["inputProps","disabled","InputProps","prefix","loading","status","isNext"];function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){a.default(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}exports.AutocompleteInput=function(e){var t=e.inputProps,u=e.disabled,s=e.InputProps,a=e.prefix,d=e.loading,x=e.status,j=e.isNext,m=p.default(e,c),O=m.label,y=m.size,P=m.labelPlacement,g=m.elementsClassNames,v=m.readOnly,h=m.placeholder,C=t.onChange,I=t.onBlur,q=t.onFocus,w=t.onMouseDown,N=t.ref,A=t.value,T=r.useCallback((function(e,t,n){null==C||C(n,e)}),[C]),D=r.useCallback((function(e,t){null==C||C(t,e)}),[C]),k=r.useCallback((function(e){if(q(e),w(e),v){var t=e.target;t.selectionStart=t.selectionEnd}}),[q,w,v]),F=(a||s.startAdornment)&&n.jsxs(n.Fragment,{children:[a,s.startAdornment]}),B=r.useMemo((function(){return b(b({},g),{},{input:f.default(l.input,null==g?void 0:g.input,v&&l.readOnlyInput),prefix:f.default(l.prefix,null==g?void 0:g.prefix),suffix:f.default(l.suffix,null==g?void 0:g.suffix),inputContainer:f.default(l.inputContainer,null==g?void 0:g.inputContainer)})}),[g,v]);return j?n.jsx(i.TextInputNext,{disabled:u,prefix:F,suffix:s.endAdornment,onBlur:I,onChange:T,onFocus:k,inputRef:N,value:A,inputContainerRef:s.ref,status:d?"loading":x,label:O,size:y,labelPlacement:P,elementsClassNames:B,readOnly:v,placeholder:h}):n.jsx(o.TextInput,b({disabled:u,prefix:F,suffix:s.endAdornment,onBlur:I,onChange:D,onFocus:k,inputRef:N,value:A,ref:s.ref,status:d?"loading":x},m))};
//# sourceMappingURL=AutocompleteInput.js.map
