import{c as h,B as x}from"./button-D5r5edT8.js";import{v as j,j as e,Y as l}from"./app-BGey7YPf.js";import{D as f,b as k,c as b,d as v,e as w,f as D}from"./dialog-OAe1w9Cd.js";import{X as C}from"./x-C4WIHhXm.js";import{T as y}from"./trash-Blc6Iqr5.js";import{D as N,c as M,d as _,e as $,f as A,g as i}from"./icons-hx7HvmR4.js";import{h as d}from"./app-layout-mnJEmZ7X.js";import{C as P}from"./chevron-left-7ssMp1N3.js";import{C as z}from"./chevron-right-CE_1krjA.js";/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const H=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]],S=h("CircleArrowRight",H);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Q=h("CirclePlus",B);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const R=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],T=h("Ellipsis",R);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const E=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],g=h("SquarePen",E);function V({open:r,onOpenChange:s,url:a}){const{delete:t}=j(),n=()=>{t(a,{preserveScroll:!0,onSuccess:()=>{s(!1)}})},u=c=>{c.key==="Enter"&&(c.preventDefault(),n())};return e.jsx(f,{open:r,onOpenChange:s,children:e.jsxs(k,{onKeyDown:u,children:[e.jsxs(b,{children:[e.jsx(v,{children:"Konfirmasi Hapus"}),e.jsx(w,{children:"Apakah anda yakin ingin menghapus data ini?"})]}),e.jsxs("div",{className:"flex justify-end items-center gap-2 mt-4",children:[e.jsx(D,{asChild:!0,children:e.jsxs(x,{variant:"destructive",children:[e.jsx(C,{className:"mr-2 h-4 w-4"}),"Batal"]})}),e.jsxs(x,{type:"button",variant:"default",onClick:n,children:[e.jsx(y,{className:"mr-2 h-4 w-4"}),"Hapus"]})]})]})})}function W({withDetail:r=!1,withEdit:s=!0,withDelete:a=!0,isModal:t=!1,actionEdit:n,actionDetailHref:u="",actionEditHref:c="",actionDelete:p,permissionPrefix:o,children:m}){return e.jsxs(N,{children:[e.jsx(M,{className:"focus-within:outline-none",children:e.jsx(T,{})}),e.jsxs(_,{side:"left",align:"start",children:[e.jsx($,{children:"Aksi"}),e.jsx(A,{}),m,r&&d([`${o}-show`])&&e.jsx(i,{asChild:!0,children:e.jsxs(l,{href:u,children:[e.jsx(S,{})," Detail"]})}),t?s&&d([`${o}-update`])&&e.jsxs(i,{onClick:n,children:[e.jsx(g,{})," Ubah"]}):s&&d([`${o}-update`])&&e.jsx(i,{asChild:!0,children:e.jsxs(l,{href:c,children:[e.jsx(g,{})," Ubah"]})}),a&&d([`${o}-delete`])&&e.jsxs(i,{onClick:p,children:[e.jsx(y,{})," Hapus"]})]})]})}function K({links:r}){const s="p-2 text-sm border rounded-md bg-white text-gray-500 hover:bg-gray-100 dark:bg-gray-950 dark:text-gray-400 dark:hover:bg-gray-900 dark:border-gray-900";return e.jsx(e.Fragment,{children:e.jsx("ul",{className:"justify-end flex items-center gap-1",children:r.map((a,t)=>a.url!=null?a.label.includes("Previous")?e.jsx(l,{className:s,href:a.url,children:e.jsx(P,{className:"size-4"})},t):a.label.includes("Next")?e.jsx(l,{className:s,href:a.url,children:e.jsx(z,{className:"size-4"})},t):e.jsx(l,{className:`px-3 py-1.5 text-sm border rounded-md text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-900 dark:border-gray-900 ${a.active?"bg-gray-200 text-gray-700 dark:bg-gray-900 dark:text-gray-50":"bg-white dark:bg-gray-950"}`,href:a.url,children:a.label},t):null)})})}function Z({data:r}){return e.jsxs("div",{className:"flex items-center justify-between mt-4 w-full overflow-x-auto gap-10 scrollbar-hide",children:[r.total>0&&e.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-400 py-4 whitespace-nowrap",children:["Menampilkan ",r.from," sampai ",r.to," dari ",r.total," data"]}),r.last_page!==1&&e.jsx(K,{links:r.links})]})}export{W as A,Q as C,V as M,Z as P};
