import{Ft as e,H as t,It as n,K as r,L as i,Mt as a,Q as o,V as s,W as c,Y as l,_t as u,b as d,d as f,ft as p,ht as m,jt as h,mt as g,s as _,st as v,tt as y,v as b,x,yt as S}from"./BA99CCI5.js";import{t as C}from"./BJ4akexL.js";import"./xihTtKlq.js";import"./DGo8yE5j.js";import{a as w}from"./DvT-Y1N62.js";import{t as T}from"./BBtCGbx62.js";var E=c(`<span class="inline-flex items-center gap-1"><!> <button type="button" class="text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-200" aria-label="Remove tag"><!></button></span>`),D=c(`<div class="flex min-h-[2.5rem] flex-wrap items-center gap-2 rounded-xl border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 transition-colors dark:border-neutral-700/60 dark:bg-neutral-800/50 dark:text-neutral-50"><!> <input type="text" id="tags-input" class="min-w-[120px] flex-1 border-0 bg-transparent text-sm text-neutral-900 outline-none placeholder:text-neutral-400 focus:ring-0 dark:text-neutral-50 dark:placeholder:text-neutral-500"/></div>`);function O(c,O){a(O,!1);let k=_(O,`tags`,28,()=>[]),A=_(O,`placeholder`,8,`Type and press Enter to add tags`),j=_(O,`onchange`,8,void 0),M=m(``),N=null,P=0;function F(e){return e.toUpperCase().startsWith(`NOT:`)}function I(e){return F(e)?e.slice(4).trim():e}function L(e){k(e),j()?.(e)}function R(){let e=o(M).trim();if(!e)return;let t=e.toLowerCase();if(k().map(e=>e.toLowerCase()).includes(t)){let e=Date.now();(N!==t||e-P>1500)&&(C.add(`error`,`Tag already added.`,2e3),N=t,P=e);return}L([...k(),e]),u(M,``)}function z(e){L(k().filter((t,n)=>n!==e))}function B(e){e.key===`Enter`?(e.preventDefault(),R()):e.key===`Backspace`&&o(M)===``&&k().length>0&&z(k().length-1)}f();var V=D(),H=p(V);i(H,3,k,e=>e,(i,a,c)=>{var u=E(),d=p(u);{let n=S(()=>(o(a),y(()=>F(o(a))?`danger`:`info`)));T(d,{get variant(){return o(n)},size:`md`,rounded:`md`,children:(n,i)=>{e();var c=r();v(e=>s(c,e),[()=>(o(a),y(()=>I(o(a))))]),t(n,c)},$$slots:{default:!0}})}var f=g(d,2),m=p(f);w(m,{size:14}),n(f),n(u),l(`click`,f,()=>z(o(c))),t(i,u)});var U=g(H,2);d(U),n(V),v(()=>x(U,`placeholder`,A())),b(U,()=>o(M),e=>u(M,e)),l(`keydown`,U,B),t(c,V),h()}export{O as t};