import{r as p,j as a}from"./app-CffHYkHW.js";import{a as x}from"./utils-C8zp8JNC.js";import{B as f}from"./button-qhe8lrPU.js";import{C as u,a as j,b as C,c as h,d as b,e as y,f as N}from"./command-CpAXc6dU.js";import{P as k,a as w,b as P}from"./popover-D5WRAV5I.js";import{C as g}from"./select-ClrGyhQo.js";function z({options:r,placeholder:d,value:e,setValue:l,withChain:o,message:m="produk",disabled:c=!1}){var t;const[n,i]=p.useState(!1);return a.jsxs(k,{open:n,onOpenChange:i,children:[a.jsx(w,{asChild:!0,children:a.jsxs(f,{size:"input",variant:"outline",role:"combobox","aria-expanded":n,className:"w-full justify-between",disabled:c,children:[e?(t=r.find(s=>s.id===e))==null?void 0:t.name:d,a.jsx(u,{className:"opacity-50"})]})}),a.jsx(P,{className:"p-0 min-w-full",children:a.jsxs(j,{children:[a.jsx(C,{placeholder:`Cari data ${m}`,className:"h-9 px-3 py-2 border-0 focus:ring-0 w-full"}),a.jsxs(h,{children:[a.jsxs(b,{children:[m," tidak ditemukan."]}),a.jsx(y,{children:r.map(s=>a.jsxs(N,{onSelect:()=>{l(s.id),o&&o(s.id),i(!1)},children:[s.name,a.jsx(g,{className:x("ml-auto",e===s.id?"opacity-100":"opacity-0")})]},s.id))})]})]})})]})}export{z as C};
