import{J as K,r as i,j as e,Q as $,a as _,t as m,d as J}from"./app-BBZbvTSO.js";import{D as w,a as S,b as k,c as T,d as D,e as A}from"./dialog-D_v2qgP5.js";import{I as L}from"./input-dmj4QjAp.js";import{T as P}from"./textarea-DorjplNc.js";import{A as R,W as V}from"./app-layout-DgXit_SB.js";import{C as X,a as Y,b as Z,d as ee,c as se}from"./card-LUGiYPFK.js";import{S as ae}from"./separator-BzKY_P4f.js";import{c as U,B as l}from"./button-CZmOQP7j.js";import{B as o}from"./badge-BR_GnIty.js";import{a as te,b as le,c as ie}from"./tooltip-CRkL5R4V.js";import re from"./ProjectSidebar-UmpR7T3c.js";import ne from"./layout-BRkj1aws.js";import{G as z}from"./globe-DRyUQWUz.js";import{S as oe}from"./save-FXHhR0ew.js";import{C as F}from"./copy-MGAttPaC.js";import{I}from"./image-BEhzBCM8.js";import{S as ce}from"./settings-1sj5BLwD.js";import{U as de}from"./users-DU0sA3Q7.js";import{K as me}from"./index-BnKWxTXF.js";import{F as xe}from"./file-text-DfpLAAwR.js";/* empty css            */import"./index-C0VDnRYN.js";import"./index-CbDI-tXU.js";import"./utils-YhN_nlHn.js";import"./Combination-9YgcTppv.js";import"./index-13DH8-b5.js";import"./index-C1VwruLz.js";import"./dropdown-menu-DkvU_mzU.js";import"./index-IvSACaye.js";import"./index-BosTFUDi.js";import"./index-hDbW6ayQ.js";import"./floating-ui.dom-DtF1XweH.js";import"./index-AiAmtg3H.js";import"./index-Dbn6AP0q.js";import"./app-logo-icon-BZsH9yGo.js";import"./layout-grid-CF44vN4j.js";import"./chevron-right-fDICdnKB.js";import"./search-bar-FrEZMnbC.js";import"./dnd.esm-Cel5mZtS.js";import"./Select-BSWSW26d.js";import"./CreateCollectionModal-DJqF8xIf.js";import"./label-BPDCCRHl.js";import"./input-error-Bz7f2c6i.js";import"./checkbox-B0_9jnY6.js";import"./index-BCYyBCUm.js";import"./check-yuW7wFtQ.js";import"./DeleteCollectionModal-DwYdUse-.js";import"./plus-D8fMMvfS.js";import"./ellipsis-vertical-DoJR9-bA.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 pe=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],he=U("HardDrive",pe);/**
 * @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 ue=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],je=U("Layers",ue);function ps({project:s}){var v,y;const a=K().props.userCan,{copied:r,copyToClipboard:x}=fe(),[p,c]=i.useState(!1),[h,M]=i.useState(s.name),[j,O]=i.useState(s.description??""),[H,d]=i.useState(!1),[f,B]=i.useState(s.name+" Copy"),[N,E]=i.useState(s.description??""),G=t=>t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),Q=async()=>{try{await _.post(route("projects.saveAsTemplate",s.id),{name:h,slug:G(h),description:j}),m.success("Template saved"),c(!1)}catch(t){console.error(t),m.error("Failed to save template")}},W=async()=>{var t;try{const C=(t=(await _.post(route("projects.clone",s.id),{name:f,description:N})).data)==null?void 0:t.redirect;C?window.location.href=C:(m.success("Project cloned"),d(!1))}catch(b){console.error(b),m.error("Failed to clone project")}},g=s.disk==="public"?"Local Storage":s.disk.toUpperCase(),q=[{title:s.name,href:"/project"}];return e.jsxs(R,{breadcrumbs:q,children:[e.jsx($,{title:s.name}),e.jsxs(ne,{children:[e.jsx(re,{project:s}),e.jsx(ae,{className:"my-6 md:hidden"}),e.jsx("div",{className:"flex-1 max-w-full md:w-2xl lg:w-xl xl:w-3xl",children:e.jsx("section",{className:"space-y-6",children:e.jsxs(X,{children:[e.jsx(Y,{className:"space-y-2",children:e.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsx(Z,{className:"text-2xl font-bold",children:s.name}),e.jsx(ee,{children:s.description||"No description"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[e.jsxs(te,{children:[e.jsx(le,{asChild:!0,children:e.jsxs(o,{variant:"outline",className:"flex items-center gap-1 cursor-default",children:[e.jsx(he,{className:"h-3 w-3"})," ",g]})}),e.jsx(ie,{children:s.disk==="public"?"Files stored on this server.":"Amazon S3 storage"})]}),e.jsxs(o,{variant:"outline",className:"flex items-center gap-1",children:[e.jsx(z,{className:"h-3 w-3"})," ",s.default_locale.toUpperCase()]}),s.public_api&&e.jsx(o,{variant:"secondary",className:"flex items-center gap-1",children:"Public API"}),e.jsxs(l,{size:"sm",variant:"outline",className:"flex items-center gap-1",onClick:()=>c(!0),children:[e.jsx(oe,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Template"})]}),a.create_project&&e.jsxs(l,{size:"sm",variant:"outline",className:"flex items-center gap-1",onClick:()=>d(!0),children:[e.jsx(F,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Clone"})]})]})]})}),e.jsxs(se,{children:[e.jsxs("div",{className:"flex flex-wrap gap-3 justify-center mb-4",children:[a.access_assets&&e.jsx(n,{icon:I,label:"Asset Library",href:route("assets.index",s.id)}),a.access_project_settings&&e.jsx(n,{icon:ce,label:"General Settings",href:route("projects.settings.project",s.id)}),a.access_localization_settings&&e.jsx(n,{icon:z,label:"Localization",href:route("projects.settings.localization",s.id)}),a.access_user_access_settings&&e.jsx(n,{icon:de,label:"User Access",href:route("projects.settings.user-access",s.id)}),a.access_api_access_settings&&e.jsx(n,{icon:me,label:"API Access",href:route("projects.settings.api-access",s.id)}),a.access_webhooks_settings&&e.jsx(n,{icon:V,label:"Webhooks",href:route("projects.settings.webhooks",s.id)})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 justify-between",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium",children:"Project ID"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground break-all",children:s.uuid}),e.jsxs(l,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>x(s.uuid),children:[e.jsx(F,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Copy UUID"})]}),r&&e.jsx("span",{className:"text-xs text-green-500",children:"Copied!"})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium",children:"Storage"}),e.jsx("p",{className:"text-sm text-muted-foreground uppercase",children:g})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium",children:"Default Locale"}),e.jsx("p",{className:"text-sm text-muted-foreground uppercase",children:s.default_locale})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium",children:"Available Locales"}),e.jsx("p",{className:"text-sm text-muted-foreground uppercase",children:((v=s.locales)!=null&&v.length?s.locales.join(", "):s.default_locale).toUpperCase()})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium",children:"Public API"}),e.jsx("p",{className:"text-sm text-muted-foreground uppercase",children:s.public_api?e.jsx(o,{variant:"default",className:"flex items-center gap-1",children:"Enabled"}):e.jsx(o,{variant:"outline",className:"flex items-center gap-1",children:"Disabled"})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium",children:"Created At"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:new Date(s.created_at).toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium",children:"Last Updated"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:new Date(s.updated_at).toLocaleString()})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-center border border-dashed rounded-md p-4",children:e.jsx(u,{icon:je,label:"Collections",value:s.collections_count??((y=s.collections)==null?void 0:y.length)??0})}),e.jsx("div",{className:"text-center border border-dashed rounded-md p-4",children:e.jsx(u,{icon:xe,label:"Content Entries",value:s.content_count??0})}),e.jsx("div",{className:"text-center border border-dashed rounded-md p-4",children:e.jsx(u,{icon:I,label:"Assets",value:s.assets_count??0})})]})]})]})]})})})]}),e.jsx(w,{open:p,onOpenChange:c,children:e.jsxs(S,{children:[e.jsxs(k,{children:[e.jsx(T,{children:"Save Project as Template"}),e.jsx(D,{className:"sr-only",children:"Save Project as Template"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",htmlFor:"tpl_name",children:"Template Name"}),e.jsx(L,{id:"tpl_name",value:h,onChange:t=>M(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",htmlFor:"tpl_desc",children:"Description"}),e.jsx(P,{id:"tpl_desc",value:j,onChange:t=>O(t.target.value),rows:3})]})]}),e.jsxs(A,{children:[e.jsx(l,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(l,{onClick:Q,children:"Save"})]})]})}),e.jsx(w,{open:H,onOpenChange:d,children:e.jsxs(S,{children:[e.jsxs(k,{children:[e.jsx(T,{children:"Clone Project"}),e.jsx(D,{className:"sr-only",children:"Clone Project"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",htmlFor:"clone_name",children:"New Project Name"}),e.jsx(L,{id:"clone_name",value:f,onChange:t=>B(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",htmlFor:"clone_desc",children:"Description"}),e.jsx(P,{id:"clone_desc",value:N,onChange:t=>E(t.target.value),rows:3})]})]}),e.jsxs(A,{children:[e.jsx(l,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(l,{onClick:W,children:"Clone"})]})]})})]})}function fe(){const[s,a]=i.useState(!1);return{copied:s,copyToClipboard:async x=>{try{await navigator.clipboard.writeText(x),a(!0),setTimeout(()=>a(!1),2e3)}catch(p){console.error("Failed to copy",p)}}}}function u({icon:s,label:a,value:r}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{className:"mx-auto h-6 w-6 text-muted-foreground"}),e.jsx("p",{className:"text-2xl font-semibold",children:r}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]})}function n({icon:s,label:a,href:r}){return e.jsxs(J,{href:r,className:"inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm hover:bg-accent",children:[e.jsx(s,{className:"h-4 w-4"})," ",a]})}export{ps as default};
