import{R as f,j as a}from"./app-BgLa5dit.js";const k="_container_7b9kk_1",R="_input_7b9kk_10",C="_item_7b9kk_20",s={container:k,input:R,item:C},_=/\r?\n|\r/;function b(n){return a.jsxs("div",{className:`${s.item} d-inline-flex align-items-center gap-1 px-2 py-0 m-0`,title:n.value,children:[a.jsx("span",{className:"cursor-default",children:n.value}),n.onRemove&&a.jsx("button",{type:"button",className:`${s.removeButton} btn-close btn-close-sm`,onClick:n.onRemove,"aria-label":"Remove"})]})}p.defaultProps={placeholder:"Type a value and press Enter"};function p(n){const[l,c]=f.useState(""),r=f.useRef(null);function u(e){const t=[...n.values];e.forEach(i=>{const o=i.trim();o&&!n.values.includes(o)&&t.push(o)}),n.onChange(t),c("")}function m(){var e;(e=r.current)==null||e.focus()}function v(e){c(e.target.value)}function d(e){e.key==="Enter"&&(e.preventDefault(),u([l])),e.key==="Backspace"&&l===""&&n.values.length&&n.onChange(n.values.slice(0,-1))}function x(e){n.onChange(n.values.filter(t=>t!==e))}function h(e){const i=e.clipboardData.getData("text").split(_);i.length&&(e.preventDefault(),u(i))}function g(){l&&u([l])}return a.jsxs("div",{className:`form-control ${s.container} d-flex flex-wrap gap-2`,onClick:m,children:[n.values.map((e,t)=>a.jsx(b,{value:e,onRemove:()=>x(e)},t)),a.jsx("input",{ref:r,value:l,type:"text",placeholder:n.values.length===0?n.placeholder:"",className:s.input,onChange:v,onKeyDown:d,onPaste:h,onBlur:g})]})}export{p as M,b as V};
//# sourceMappingURL=DLXdkhC4.chunk.js.map
