headroom-cms 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/assets/{AdminsPage-DUMTsCEp.js → AdminsPage-lGd1MFW3.js} +1 -1
- package/admin/assets/AllContentPage-YykTt4xH.js +1 -0
- package/admin/assets/{ApiKeysPage-CzUOSoz_.js → ApiKeysPage-BCpNEKxF.js} +1 -1
- package/admin/assets/{AuditPage-CYAg4dbI.js → AuditPage-DBKiujoI.js} +1 -1
- package/admin/assets/{BackupsPage-04_oMy3v.js → BackupsPage-DCrmYnQc.js} +1 -1
- package/admin/assets/{BlockEditor-s0CRZsjy.js → BlockEditor-BQVXN_Yn.js} +3 -3
- package/admin/assets/{BlockTypeEditPage-D1OFIlJZ.js → BlockTypeEditPage-BZmvEezy.js} +1 -1
- package/admin/assets/{BlockTypesPage-cJNR25fN.js → BlockTypesPage-CAr2JDj9.js} +1 -1
- package/admin/assets/BulkActionBar-CgHMxSkm.js +1 -0
- package/admin/assets/{CollectionEditPage-DRmCA_73.js → CollectionEditPage-BQoXWAB-.js} +1 -1
- package/admin/assets/{CollectionsPage-CeQB5e9u.js → CollectionsPage-Dakk_NyE.js} +1 -1
- package/admin/assets/{ContentCreatePage-Cq8Pi8EF.js → ContentCreatePage-d-xxhoxO.js} +1 -1
- package/admin/assets/ContentEditPage-CUi_mFRC.js +1 -0
- package/admin/assets/{ContentField-BZT4OUfI.js → ContentField-D6UO6W9G.js} +1 -1
- package/admin/assets/ContentListPage-8riubzdw.js +1 -0
- package/admin/assets/{CustomBlockPreview-Kc6bb3oq.js → CustomBlockPreview-BuRfUKgt.js} +1 -1
- package/admin/assets/{FieldRenderer-CT-DgCbC.js → FieldRenderer-CUVay-yx.js} +2 -2
- package/admin/assets/{FileTypeIcon-CNHtffHC.js → FileTypeIcon-DRD08pW_.js} +1 -1
- package/admin/assets/{FloatingComposerController-D4uLQfUX-0_Y8mkGU.js → FloatingComposerController-D4uLQfUX-Dc1_NZ4l.js} +1 -1
- package/admin/assets/{IconPicker-BpPlHJO0.js → IconPicker-DR-6b0GI.js} +1 -1
- package/admin/assets/{LoginPage-Dya8sF_P.js → LoginPage-DbHhSxgY.js} +1 -1
- package/admin/assets/{MediaField-C3qFf3g5.js → MediaField-eRyEALYH.js} +1 -1
- package/admin/assets/{MediaPage-BNxc0wLq.js → MediaPage-DW85F2UV.js} +1 -1
- package/admin/assets/{Pagination-Dx8h11Rn.js → Pagination-DTboMLK6.js} +1 -1
- package/admin/assets/{RelationshipPicker-C2MTxrhl.js → RelationshipPicker-VVZN4dlP.js} +1 -1
- package/admin/assets/{SiteSettingsPage-BDZaUBmf.js → SiteSettingsPage-5-HzcJLC.js} +1 -1
- package/admin/assets/{SiteUserEditPage-MfzhPW7v.js → SiteUserEditPage-C_PPvEye.js} +1 -1
- package/admin/assets/{SiteUsersPage-CrYugXpx.js → SiteUsersPage-CIgMMi-T.js} +1 -1
- package/admin/assets/{SitesPage-Cl8V3Hb7.js → SitesPage-DkG0gyHT.js} +1 -1
- package/admin/assets/SubmissionDetailPage-BwFWjkVu.js +1 -0
- package/admin/assets/{SubmissionEditPage-B0Kq52fb.js → SubmissionEditPage-C6Og25NH.js} +1 -1
- package/admin/assets/SubmissionListPage-spPh8dwQ.js +1 -0
- package/admin/assets/{TagInput-C6tcB5Xw.js → TagInput-DxktEo07.js} +1 -1
- package/admin/assets/{TagsPage-BONR6bSu.js → TagsPage-Dcc1IkF7.js} +1 -1
- package/admin/assets/TrashPage-8ybk22ZM.js +1 -0
- package/admin/assets/{UsersPage-C2iCy0UR.js → UsersPage-D5uXgLV4.js} +1 -1
- package/admin/assets/{WebhookEditPage-DjZFxT72.js → WebhookEditPage-T5KsZGqe.js} +1 -1
- package/admin/assets/{WebhooksPage-g_a224a4.js → WebhooksPage-DEIu5cX0.js} +1 -1
- package/admin/assets/{card-DlfsF8lU.js → card-CVAiqxnT.js} +1 -1
- package/admin/assets/{checkbox-BX8EcGFf.js → checkbox-BO-Fusdb.js} +1 -1
- package/admin/assets/{command-DaTsImUa.js → command-D0ojin3H.js} +1 -1
- package/admin/assets/index-BCa3VYjL.css +1 -0
- package/admin/assets/{index-DC1UyCW2.js → index-CbEa9yyd.js} +10 -10
- package/admin/assets/{listCellValue-CBqXAwce.js → listCellValue-BUdbRyCz.js} +1 -1
- package/admin/assets/{popover-BA-47SRI.js → popover-B9WNjj2t.js} +1 -1
- package/admin/assets/{select-waaVyoQ5.js → select-B2yTIHJT.js} +1 -1
- package/admin/assets/{serializeToText-CjHhyvXp.js → serializeToText-Tv-7pIdy.js} +1 -1
- package/admin/assets/{table-Br-QgtTL.js → table-C3EQVw1z.js} +1 -1
- package/admin/assets/{textarea-BILv1DQB.js → textarea-DIHLWabG.js} +1 -1
- package/admin/assets/useAdminResolver-_OHcUYwq.js +1 -0
- package/admin/assets/useContent-DLo6FUYZ.js +1 -0
- package/admin/assets/{useContentSearch-DbiA8aG-.js → useContentSearch-D-D0veFh.js} +1 -1
- package/admin/assets/{usePageTitle-DOEFrHbj.js → usePageTitle-BJ2ARyuc.js} +1 -1
- package/admin/assets/{useSiteUsers-BFYAbJNT.js → useSiteUsers-Bn3GiEYB.js} +1 -1
- package/admin/assets/{useTags-DJlXwDyc.js → useTags-CyGo0zXa.js} +1 -1
- package/admin/assets/useTrash-BFJMIP8N.js +1 -0
- package/admin/assets/{useWebhooks-BkpJKNLN.js → useWebhooks-BgJL2-Ek.js} +1 -1
- package/admin/index.html +2 -2
- package/admin/sw.js +1 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +6 -0
- package/dist/api.js.map +1 -1
- package/dist/cron.d.ts +42 -0
- package/dist/cron.d.ts.map +1 -0
- package/dist/cron.js +128 -0
- package/dist/cron.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/lambda/api/bootstrap +0 -0
- package/lambda/backup-worker/bootstrap +0 -0
- package/lambda/image-lambda/node_modules/.package-lock.json +3 -3
- package/lambda/image-lambda/node_modules/semver/classes/semver.js +19 -2
- package/lambda/image-lambda/node_modules/semver/package.json +1 -1
- package/lambda/trash-sweeper/bootstrap +0 -0
- package/lambda/webhook-worker/bootstrap +0 -0
- package/package.json +1 -1
- package/src/api.ts +6 -0
- package/src/cron.ts +153 -0
- package/src/index.ts +21 -0
- package/src/sst-env.d.ts +17 -0
- package/admin/assets/AllContentPage-D5ey5AOV.js +0 -1
- package/admin/assets/BulkActionBar-BWysX7Wo.js +0 -1
- package/admin/assets/ContentEditPage-CEJ7I3WH.js +0 -1
- package/admin/assets/ContentListPage-BCEQrYVs.js +0 -1
- package/admin/assets/SubmissionDetailPage-BnVlsGb-.js +0 -1
- package/admin/assets/SubmissionListPage-K665VwMp.js +0 -1
- package/admin/assets/index-9sbb3-yI.css +0 -1
- package/admin/assets/useAdminResolver-CbDzGoDp.js +0 -1
- package/admin/assets/useContent-Bp4f9qe0.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-Bs3zYPPV.js";import{u as R,f as V,r as n}from"./react-vendor-C2CvUxFh.js";import{g as $,h as q,i as z,f as X}from"./useSiteUsers-
|
|
1
|
+
import{j as e}from"./tanstack-Bs3zYPPV.js";import{u as R,f as V,r as n}from"./react-vendor-C2CvUxFh.js";import{g as $,h as q,i as z,f as X}from"./useSiteUsers-Bn3GiEYB.js";import{S as T,x as G,L as u,I as j,j as p,X as J,B as r,a as I,D as Q,i as W,T as Y,k as Z,l as _,m as ee,n as se,o as ae,v as l}from"./index-CbEa9yyd.js";import{C as f,a as g,b as v,c as N}from"./card-CVAiqxnT.js";import{f as k}from"./format-BRcflvs9.js";import{u as te}from"./usePageTitle-BJ2ARyuc.js";import"./radix-C5ZmWuuL.js";function xe(){const{host:t,userId:a}=R(),{data:c,isLoading:d}=$(t,a);return d?e.jsxs("div",{className:"space-y-4",children:[e.jsx(T,{className:"h-8 w-64"}),e.jsx(T,{className:"h-64 w-full"})]}):c?e.jsx(ie,{host:t,user:c},c.userId):e.jsx("p",{className:"text-muted-foreground",children:"User not found."})}function ie({host:t,user:a}){const c=V(),d=q(t),x=z(t),y=X(t),A=G(),[b,L]=n.useState(a.name??""),[h,C]=n.useState(a.status),[o,D]=n.useState(a.tags??[]),[w,S]=n.useState(""),[m,P]=n.useState(a.email),[F,U]=n.useState(!1);te({title:a.name||a.email,showBack:!0,backTo:`/sites/${t}/settings/site-users`});async function B(s){s.preventDefault();try{await d.mutateAsync({userId:a.userId,name:b,status:h,tags:o}),l.success("User updated")}catch(i){l.error("Failed to update user",{description:i instanceof Error?i.message:void 0})}}async function O(s){if(s.preventDefault(),m!==a.email)try{await x.mutateAsync({userId:a.userId,email:m}),l.success("Email updated")}catch(i){l.error("Failed to change email",{description:i instanceof Error?i.message:void 0})}}async function H(){try{await y.mutateAsync(a.userId),l.success("User deleted"),c(`/sites/${t}/settings/site-users`)}catch(s){l.error("Failed to delete user",{description:s instanceof Error?s.message:void 0})}}function E(){const s=w.trim();s&&!o.includes(s)&&D([...o,s]),S("")}function K(s){D(o.filter(i=>i!==s))}function M(s){s.key==="Enter"&&(s.preventDefault(),E())}return e.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[!A&&e.jsx("h1",{className:"text-2xl font-semibold",children:"Edit User"}),e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(v,{children:"User Details"})}),e.jsx(N,{children:e.jsxs("form",{onSubmit:B,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"name",children:"Name"}),e.jsx(j,{id:"name",value:b,onChange:s=>L(s.target.value),placeholder:"User name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Status"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{variant:h==="active"?"default":"outline",className:"cursor-pointer",onClick:()=>C("active"),children:"active"}),e.jsx(p,{variant:h==="disabled"?"default":"outline",className:"cursor-pointer",onClick:()=>C("disabled"),children:"disabled"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:o.map(s=>e.jsxs(p,{variant:"secondary",className:"gap-1",children:[s,e.jsx("button",{type:"button",onClick:()=>K(s),className:"hover:text-destructive",children:e.jsx(J,{className:"h-3 w-3"})})]},s))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{value:w,onChange:s=>S(s.target.value),onKeyDown:M,placeholder:"Add tag...",className:"max-w-xs"}),e.jsx(r,{type:"button",variant:"outline",size:"sm",onClick:E,children:"Add"})]})]}),e.jsxs(r,{type:"submit",disabled:d.isPending,children:[d.isPending&&e.jsx(I,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})]})})]}),e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(v,{children:"Email"})}),e.jsx(N,{children:e.jsxs("form",{onSubmit:O,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"email",children:"Email Address"}),e.jsx(j,{id:"email",type:"email",value:m,onChange:s=>P(s.target.value),required:!0})]}),e.jsxs(r,{type:"submit",variant:"outline",disabled:x.isPending||m===a.email,children:[x.isPending&&e.jsx(I,{className:"mr-2 h-4 w-4 animate-spin"}),"Change Email"]})]})})]}),e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(v,{children:"Info"})}),e.jsxs(N,{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"User ID"}),e.jsx("span",{className:"font-mono",children:a.userId})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Created"}),e.jsx("span",{children:k(a.createdAt)})]}),a.lastLogin&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Last Login"}),e.jsx("span",{children:k(a.lastLogin)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Session Version"}),e.jsx("span",{children:a.sessionVersion})]})]})]}),e.jsxs(Q,{open:F,onOpenChange:U,children:[e.jsx(W,{asChild:!0,children:e.jsxs(r,{variant:"destructive",children:[e.jsx(Y,{className:"mr-2 h-4 w-4"}),"Delete User"]})}),e.jsxs(Z,{children:[e.jsxs(_,{children:[e.jsx(ee,{children:"Delete user?"}),e.jsx(se,{children:"This will permanently delete this user and all their identities. This action cannot be undone."})]}),e.jsxs(ae,{children:[e.jsx(r,{variant:"outline",onClick:()=>U(!1),children:"Cancel"}),e.jsx(r,{variant:"destructive",onClick:H,disabled:y.isPending,children:"Delete"})]})]})]})]})}export{xe as SiteUserEditPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-Bs3zYPPV.js";import{u as Z,f as _,m as ee,r as n}from"./react-vendor-C2CvUxFh.js";import{d as se,e as ae,f as te}from"./useSiteUsers-
|
|
1
|
+
import{j as e}from"./tanstack-Bs3zYPPV.js";import{u as Z,f as _,m as ee,r as n}from"./react-vendor-C2CvUxFh.js";import{d as se,e as ae,f as te}from"./useSiteUsers-Bn3GiEYB.js";import{x as re,B as c,P as I,I as v,S as ne,j as E,D as F,k,l as L,m as R,n as A,L as M,o as B,v as x}from"./index-CbEa9yyd.js";import{T as ie,a as le,b as O,c as o,d as ce,e as d}from"./table-C3EQVw1z.js";import{f as oe}from"./format-BRcflvs9.js";import{u as de}from"./usePageTitle-BJ2ARyuc.js";import{P as me}from"./Pagination-DTboMLK6.js";import"./radix-C5ZmWuuL.js";import"./select-B2yTIHJT.js";function Se(){const{host:m}=Z(),H=_(),[h,i]=ee(),r=Number(h.get("page"))||1,P=Number(h.get("perPage"))||20,[N,$]=n.useState(""),S=n.useMemo(()=>{const s=h.get("after")||"";return s?s.split(","):[]},[h]),b=r>1?S[r-2]:void 0,q=b?`USER#${b}`:void 0,{data:C,isLoading:z}=se(m,{cursor:q,tag:N||void 0,limit:P}),w=ae(m),y=te(m),[G,u]=n.useState(!1),[g,U]=n.useState(""),[D,T]=n.useState(""),[j,p]=n.useState(null),J=re();de({title:"Site Users",actions:e.jsx(c,{size:"sm",onClick:()=>u(!0),children:e.jsx(I,{className:"h-4 w-4"})})});const K=n.useCallback(()=>{i(s=>{const a=new URLSearchParams(s);return a.delete("page"),a.delete("perPage"),a.delete("after"),a},{replace:!0})},[i]);async function Q(s){s.preventDefault();try{await w.mutateAsync({email:g,name:D||void 0}),u(!1),U(""),T(""),x.success("User created")}catch(a){x.error("Failed to create user",{description:a instanceof Error?a.message:void 0})}}async function V(){if(j)try{await y.mutateAsync(j),p(null),x.success("User deleted")}catch(s){x.error("Failed to delete user",{description:s instanceof Error?s.message:void 0})}}const l=C?.items??[],W=!!C?.cursor;function X(s){i(a=>{const t=new URLSearchParams(a);return s===1?t.delete("page"):t.set("page",String(s)),t})}function Y(s){i(a=>{const t=new URLSearchParams(a);return t.delete("page"),t.delete("after"),s===20?t.delete("perPage"):t.set("perPage",String(s)),t},{replace:!0})}return e.jsxs("div",{children:[!J&&e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Site Users"}),e.jsxs(c,{onClick:()=>u(!0),children:[e.jsx(I,{className:"mr-2 h-4 w-4"}),"Add User"]})]}),e.jsx("div",{className:"mb-4",children:e.jsx(v,{placeholder:"Filter by tag...",value:N,onChange:s=>{$(s.target.value),K()},className:"max-w-xs"})}),z?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(s=>e.jsx(ne,{className:"h-12 w-full"},s))}):l.length===0?e.jsx("p",{className:"text-muted-foreground py-8 text-center",children:"No site users yet"}):e.jsxs(e.Fragment,{children:[e.jsxs(ie,{children:[e.jsx(le,{children:e.jsxs(O,{children:[e.jsx(o,{children:"Email"}),e.jsx(o,{children:"Name"}),e.jsx(o,{children:"Status"}),e.jsx(o,{children:"Tags"}),e.jsx(o,{children:"Created"})]})}),e.jsx(ce,{children:l.map(s=>e.jsxs(O,{className:"cursor-pointer",onClick:()=>H(`/sites/${m}/settings/site-users/${s.userId}`),children:[e.jsx(d,{className:"font-medium",children:s.email}),e.jsx(d,{children:s.name||"—"}),e.jsx(d,{children:e.jsx(E,{variant:s.status==="active"?"default":"secondary",children:s.status})}),e.jsx(d,{children:s.tags?.map(a=>e.jsx(E,{variant:"outline",className:"mr-1",children:a},a))}),e.jsx(d,{children:oe(s.createdAt)})]},s.userId))})]}),e.jsx(me,{page:r,hasNext:W,hasPrevious:r>1,onNext:()=>{if(l.length){const s=l[l.length-1].userId,a=[...S.slice(0,r-1),s];i(t=>{const f=new URLSearchParams(t);return f.set("page",String(r+1)),f.set("after",a.join(",")),f})}},onPrevious:()=>X(r-1),perPage:P,onPerPageChange:Y})]}),e.jsx(F,{open:G,onOpenChange:u,children:e.jsxs(k,{children:[e.jsxs(L,{children:[e.jsx(R,{children:"Add Site User"}),e.jsx(A,{children:"Create a new user for this site."})]}),e.jsxs("form",{onSubmit:Q,children:[e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"email",children:"Email"}),e.jsx(v,{id:"email",type:"email",value:g,onChange:s=>U(s.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"name",children:"Name (optional)"}),e.jsx(v,{id:"name",value:D,onChange:s=>T(s.target.value)})]})]}),e.jsx(B,{children:e.jsx(c,{type:"submit",disabled:w.isPending||!g,children:"Create"})})]})]})}),e.jsx(F,{open:!!j,onOpenChange:()=>p(null),children:e.jsxs(k,{children:[e.jsxs(L,{children:[e.jsx(R,{children:"Delete User"}),e.jsx(A,{children:"This will permanently delete this user and all their identities."})]}),e.jsxs(B,{children:[e.jsx(c,{variant:"outline",onClick:()=>p(null),children:"Cancel"}),e.jsx(c,{variant:"destructive",onClick:V,disabled:y.isPending,children:"Delete"})]})]})})]})}export{Se as SiteUsersPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-Bs3zYPPV.js";import{r as u,f as V}from"./react-vendor-C2CvUxFh.js";import{b as X,u as Z,d as ee,e as te,g as se,h as ae,H as U,D as G,i as J,B as k,P as R,U as ne,j as oe,k as ie,l as le,m as re,n as ce,L as W,I as Y,o as de}from"./index-DC1UyCW2.js";import{C as me,a as he,b as ue,d as ge}from"./card-DlfsF8lU.js";import{C as b}from"./checkbox-BX8EcGFf.js";import"./radix-C5ZmWuuL.js";const pe={name:"pages",label:"Pages",labelSingular:"Page",slug:"pages",singleton:!1,fields:[{name:"content",label:"Content",type:"blocks",options:{}}]},xe={name:"posts",label:"Blog Posts",labelSingular:"Blog Post",slug:"/blog",singleton:!1,fields:[{name:"author",label:"Author",type:"text",options:{}},{name:"content",label:"Content",type:"blocks",options:{}}]},fe={name:"site-settings",label:"Site Settings",labelSingular:"Site Settings",slug:"site-settings",singleton:!0,fields:[{name:"siteName",label:"Site Name",type:"text",options:{}},{name:"tagline",label:"Tagline",type:"text",options:{}},{name:"footerText",label:"Footer Text",type:"text",options:{}},{name:"menuItems",label:"Menu Items",type:"array",options:{itemFields:[{name:"label",label:"Label",type:"text",options:{}},{name:"href",label:"URL",type:"text",options:{}}]}}]};function C(s,o){return{id:o,type:"paragraph",props:{textColor:"default",backgroundColor:"default",textAlignment:"left"},content:[{type:"text",text:s}],children:[]}}function $(s,o,d){return{id:d,type:"heading",props:{textColor:"default",backgroundColor:"default",textAlignment:"left",level:o},content:[{type:"text",text:s}],children:[]}}const z=[{title:"Home",slug:"home",body:{content:[$("Welcome to Headroom",1,"home-h1"),C("This is your new site powered by Headroom CMS. Edit this page to add your own content.","home-p1"),$("Getting Started",2,"home-h2"),C("Head over to the admin panel to manage your content, collections, and media.","home-p2")]}},{title:"About",slug:"about",body:{content:[$("About Us",1,"about-h1"),C("Tell your visitors about your company, team, or project. This is a great place to share your story.","about-p1")]}},{title:"Contact",slug:"contact",body:{content:[$("Contact",1,"contact-h1"),C("Get in touch with us. Replace this with your contact information or a contact form.","contact-p1")]}}],K=[{title:"Welcome to Headroom",slug:"welcome-to-headroom",body:{author:"Admin",content:[C("This is your first blog post. You can edit or delete it and start writing your own content.","post-p1"),C("Headroom makes it easy to create and manage your content with a powerful block editor, media library, and flexible collections.","post-p2")]}}],Se={siteName:"Headroom Site",tagline:"A site powered by Headroom CMS",footerText:"© 2026 Headroom Site. Built with Headroom CMS.",menuItems:[{label:"Home",href:"/"},{label:"About",href:"/about"},{label:"Blog",href:"/blog"},{label:"Contact",href:"/contact"}]};function Q(s){const d=[s.createPages,s.createPosts,s.createSettings].filter(Boolean).length;if(!s.addSampleContent)return d;let g=0;return s.createPages&&(g+=z.length*2),s.createPosts&&(g+=K.length*2),s.createSettings&&(g+=3),d+g}async function be(s,o,d,g){const r={collectionsCreated:[],contentCreated:[],errors:[]},x=Q(d);let a=0;const m=t=>{g?.({completed:a,total:x,label:t})},y=[{key:"pages",enabled:d.createPages,schema:pe},{key:"posts",enabled:d.createPosts,schema:xe},{key:"site-settings",enabled:d.createSettings,schema:fe}],p=new Set;for(const{key:t,enabled:n,schema:f}of y)if(n){m(`Creating ${t} collection...`);try{await s.apiFetch(`/v1/admin/sites/${o}/collections`,{method:"POST",body:JSON.stringify(f)}),r.collectionsCreated.push(t),p.add(t)}catch(h){r.errors.push(`Failed to create ${t} collection: ${h instanceof Error?h.message:String(h)}`)}a++}if(!d.addSampleContent)return m("Done"),r;if(p.has("pages"))for(const t of z){m(`Creating page "${t.title}"...`);try{const n=await s.apiFetch(`/v1/admin/sites/${o}/content`,{method:"POST",body:JSON.stringify({collection:"pages",params:{title:t.title,slug:t.slug,body:t.body}})});a++,m(`Publishing page "${t.title}"...`),await s.apiFetch(`/v1/admin/sites/${o}/content/${n.contentId}/publish`,{method:"POST"}),a++,r.contentCreated.push(`pages/${t.slug}`)}catch(n){r.errors.push(`Failed to create page "${t.title}": ${n instanceof Error?n.message:String(n)}`),a+=2}}if(p.has("posts"))for(const t of K){m(`Creating post "${t.title}"...`);try{const n=await s.apiFetch(`/v1/admin/sites/${o}/content`,{method:"POST",body:JSON.stringify({collection:"posts",params:{title:t.title,slug:t.slug,body:t.body}})});a++,m(`Publishing post "${t.title}"...`),await s.apiFetch(`/v1/admin/sites/${o}/content/${n.contentId}/publish`,{method:"POST"}),a++,r.contentCreated.push(`posts/${t.slug}`)}catch(n){r.errors.push(`Failed to create post "${t.title}": ${n instanceof Error?n.message:String(n)}`),a+=2}}if(p.has("site-settings")){m("Configuring settings...");try{const t=await s.apiFetch(`/v1/admin/sites/${o}/collections/site-settings`);a++,t.singletonContentId?(m("Saving settings draft..."),await s.apiFetch(`/v1/admin/sites/${o}/content/${t.singletonContentId}/draft`,{method:"PUT",body:JSON.stringify({title:"Site Settings",slug:"site-settings",body:Se})}),a++,m("Publishing settings..."),await s.apiFetch(`/v1/admin/sites/${o}/content/${t.singletonContentId}/publish`,{method:"POST"}),a++,r.contentCreated.push("site-settings")):a+=2}catch(t){r.errors.push(`Failed to populate settings: ${t instanceof Error?t.message:String(t)}`),a+=3}}return m("Done"),r}function Pe(){const[s,o]=u.useState(!1),{data:d,isLoading:g}=X(s),r=V(),x=u.useMemo(()=>[...d?.items??[]].sort((l,A)=>(l.name||l.host).localeCompare(A.name||A.host)),[d]),{user:a}=Z(),{data:m}=ee(),y=a?(m?.superAdminIds??[]).includes(a.sub):!1,p=te(),t=se(),[n,f]=u.useState(!1),[h,j]=u.useState(""),[S,c]=u.useState(""),[N,i]=u.useState(!0),[v,D]=u.useState(!0),[w,O]=u.useState(!0),[P,E]=u.useState(!0),[F,L]=u.useState(!1),[H,T]=u.useState(null),I=()=>{j(""),c(""),i(!0),D(!0),O(!0),E(!0),L(!1),T(null)},B=l=>{f(l),l||I()};if(g)return e.jsx(ae,{});const _=async()=>{if(h.trim())try{await t.mutateAsync({host:h.trim(),name:S.trim()||h.trim()});const l={createPages:v,createPosts:w,createSettings:P,addSampleContent:F};if(N&&(v||w||P)){const A=Q(l);T({completed:0,total:A,label:"Setting up collections..."});const M=await be(p,h.trim(),l,T);M.errors.length>0&&console.warn("Scaffold warnings:",M.errors)}f(!1),I()}catch{T(null)}};return x.length===0?e.jsxs("div",{className:"flex h-dvh flex-col",children:[e.jsx(U,{}),e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"No sites available."}),e.jsxs(G,{open:n,onOpenChange:B,children:[e.jsx(J,{asChild:!0,children:e.jsxs(k,{children:[e.jsx(R,{className:"mr-2 h-4 w-4"}),"Create Site"]})}),e.jsx(q,{newHost:h,setNewHost:j,newName:S,setNewName:c,createDefaults:N,setCreateDefaults:i,createPages:v,setCreatePages:D,createPosts:w,setCreatePosts:O,createSettings:P,setCreateSettings:E,addSampleContent:F,setAddSampleContent:L,onSubmit:_,isPending:t.isPending,scaffoldProgress:H})]})]})]}):e.jsxs("div",{className:"flex h-dvh flex-col",children:[e.jsx(U,{}),e.jsxs("div",{className:"flex-1 p-4 sm:p-8",children:[e.jsxs("div",{className:"mb-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Select a site"}),y&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(b,{checked:s,onCheckedChange:l=>o(l===!0)}),"Show archived sites"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(k,{variant:"outline",onClick:()=>r("/users"),children:[e.jsx(ne,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"All Users"})]}),e.jsxs(G,{open:n,onOpenChange:B,children:[e.jsx(J,{asChild:!0,children:e.jsxs(k,{children:[e.jsx(R,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Create Site"})]})}),e.jsx(q,{newHost:h,setNewHost:j,newName:S,setNewName:c,createDefaults:N,setCreateDefaults:i,createPages:v,setCreatePages:D,createPosts:w,setCreatePosts:O,createSettings:P,setCreateSettings:E,addSampleContent:F,setAddSampleContent:L,onSubmit:_,isPending:t.isPending,scaffoldProgress:H})]})]})]})]}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:x.map(l=>e.jsx(me,{className:"cursor-pointer transition-shadow hover:shadow-md",onClick:()=>r(`/sites/${l.host}/content`),children:e.jsxs(he,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{children:l.name||l.host}),l.status==="archived"&&e.jsx(oe,{variant:"outline",children:"Archived"})]}),e.jsx(ge,{children:l.host})]})},l.host))})]})]})}function q({newHost:s,setNewHost:o,newName:d,setNewName:g,createDefaults:r,setCreateDefaults:x,createPages:a,setCreatePages:m,createPosts:y,setCreatePosts:p,createSettings:t,setCreateSettings:n,addSampleContent:f,setAddSampleContent:h,onSubmit:j,isPending:S,scaffoldProgress:c}){const N=S||!!c;return e.jsxs(ie,{children:[e.jsxs(le,{children:[e.jsx(re,{children:"Create Site"}),e.jsx(ce,{className:"sr-only",children:"Enter details for the new site"})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"host",children:"Host"}),e.jsx(Y,{id:"host",placeholder:"example.com",value:s,onChange:i=>o(i.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"name",children:"Display Name"}),e.jsx(Y,{id:"name",placeholder:"My Site",value:d,onChange:i=>g(i.target.value)})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(b,{checked:r,onCheckedChange:i=>x(i===!0)}),"Create Default Collections"]}),r&&e.jsxs("div",{className:"ml-6 mt-3 space-y-2",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(b,{checked:a,onCheckedChange:i=>m(i===!0)}),"Pages"]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(b,{checked:y,onCheckedChange:i=>p(i===!0)}),"Posts"]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(b,{checked:t,onCheckedChange:i=>n(i===!0)}),"Site Settings"]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(b,{checked:f,onCheckedChange:i=>h(i===!0)}),"Add Sample Content"]})]})]})]}),c&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300",style:{width:`${c.total>0?c.completed/c.total*100:0}%`},role:"progressbar","aria-valuenow":c.completed,"aria-valuemin":0,"aria-valuemax":c.total})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.label," ","(",c.completed,"/",c.total,")"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Please wait while your site is being set up. Do not close this tab."})]}),e.jsx(de,{children:e.jsx(k,{onClick:j,disabled:!s.trim()||N,children:c?c.label:S?"Creating...":"Create"})})]})}export{Pe as SitesPage};
|
|
1
|
+
import{j as e}from"./tanstack-Bs3zYPPV.js";import{r as u,f as V}from"./react-vendor-C2CvUxFh.js";import{b as X,u as Z,d as ee,e as te,g as se,h as ae,H as U,D as G,i as J,B as k,P as R,U as ne,j as oe,k as ie,l as le,m as re,n as ce,L as W,I as Y,o as de}from"./index-CbEa9yyd.js";import{C as me,a as he,b as ue,d as ge}from"./card-CVAiqxnT.js";import{C as b}from"./checkbox-BO-Fusdb.js";import"./radix-C5ZmWuuL.js";const pe={name:"pages",label:"Pages",labelSingular:"Page",slug:"pages",singleton:!1,fields:[{name:"content",label:"Content",type:"blocks",options:{}}]},xe={name:"posts",label:"Blog Posts",labelSingular:"Blog Post",slug:"/blog",singleton:!1,fields:[{name:"author",label:"Author",type:"text",options:{}},{name:"content",label:"Content",type:"blocks",options:{}}]},fe={name:"site-settings",label:"Site Settings",labelSingular:"Site Settings",slug:"site-settings",singleton:!0,fields:[{name:"siteName",label:"Site Name",type:"text",options:{}},{name:"tagline",label:"Tagline",type:"text",options:{}},{name:"footerText",label:"Footer Text",type:"text",options:{}},{name:"menuItems",label:"Menu Items",type:"array",options:{itemFields:[{name:"label",label:"Label",type:"text",options:{}},{name:"href",label:"URL",type:"text",options:{}}]}}]};function C(s,o){return{id:o,type:"paragraph",props:{textColor:"default",backgroundColor:"default",textAlignment:"left"},content:[{type:"text",text:s}],children:[]}}function $(s,o,d){return{id:d,type:"heading",props:{textColor:"default",backgroundColor:"default",textAlignment:"left",level:o},content:[{type:"text",text:s}],children:[]}}const z=[{title:"Home",slug:"home",body:{content:[$("Welcome to Headroom",1,"home-h1"),C("This is your new site powered by Headroom CMS. Edit this page to add your own content.","home-p1"),$("Getting Started",2,"home-h2"),C("Head over to the admin panel to manage your content, collections, and media.","home-p2")]}},{title:"About",slug:"about",body:{content:[$("About Us",1,"about-h1"),C("Tell your visitors about your company, team, or project. This is a great place to share your story.","about-p1")]}},{title:"Contact",slug:"contact",body:{content:[$("Contact",1,"contact-h1"),C("Get in touch with us. Replace this with your contact information or a contact form.","contact-p1")]}}],K=[{title:"Welcome to Headroom",slug:"welcome-to-headroom",body:{author:"Admin",content:[C("This is your first blog post. You can edit or delete it and start writing your own content.","post-p1"),C("Headroom makes it easy to create and manage your content with a powerful block editor, media library, and flexible collections.","post-p2")]}}],Se={siteName:"Headroom Site",tagline:"A site powered by Headroom CMS",footerText:"© 2026 Headroom Site. Built with Headroom CMS.",menuItems:[{label:"Home",href:"/"},{label:"About",href:"/about"},{label:"Blog",href:"/blog"},{label:"Contact",href:"/contact"}]};function Q(s){const d=[s.createPages,s.createPosts,s.createSettings].filter(Boolean).length;if(!s.addSampleContent)return d;let g=0;return s.createPages&&(g+=z.length*2),s.createPosts&&(g+=K.length*2),s.createSettings&&(g+=3),d+g}async function be(s,o,d,g){const r={collectionsCreated:[],contentCreated:[],errors:[]},x=Q(d);let a=0;const m=t=>{g?.({completed:a,total:x,label:t})},y=[{key:"pages",enabled:d.createPages,schema:pe},{key:"posts",enabled:d.createPosts,schema:xe},{key:"site-settings",enabled:d.createSettings,schema:fe}],p=new Set;for(const{key:t,enabled:n,schema:f}of y)if(n){m(`Creating ${t} collection...`);try{await s.apiFetch(`/v1/admin/sites/${o}/collections`,{method:"POST",body:JSON.stringify(f)}),r.collectionsCreated.push(t),p.add(t)}catch(h){r.errors.push(`Failed to create ${t} collection: ${h instanceof Error?h.message:String(h)}`)}a++}if(!d.addSampleContent)return m("Done"),r;if(p.has("pages"))for(const t of z){m(`Creating page "${t.title}"...`);try{const n=await s.apiFetch(`/v1/admin/sites/${o}/content`,{method:"POST",body:JSON.stringify({collection:"pages",params:{title:t.title,slug:t.slug,body:t.body}})});a++,m(`Publishing page "${t.title}"...`),await s.apiFetch(`/v1/admin/sites/${o}/content/${n.contentId}/publish`,{method:"POST"}),a++,r.contentCreated.push(`pages/${t.slug}`)}catch(n){r.errors.push(`Failed to create page "${t.title}": ${n instanceof Error?n.message:String(n)}`),a+=2}}if(p.has("posts"))for(const t of K){m(`Creating post "${t.title}"...`);try{const n=await s.apiFetch(`/v1/admin/sites/${o}/content`,{method:"POST",body:JSON.stringify({collection:"posts",params:{title:t.title,slug:t.slug,body:t.body}})});a++,m(`Publishing post "${t.title}"...`),await s.apiFetch(`/v1/admin/sites/${o}/content/${n.contentId}/publish`,{method:"POST"}),a++,r.contentCreated.push(`posts/${t.slug}`)}catch(n){r.errors.push(`Failed to create post "${t.title}": ${n instanceof Error?n.message:String(n)}`),a+=2}}if(p.has("site-settings")){m("Configuring settings...");try{const t=await s.apiFetch(`/v1/admin/sites/${o}/collections/site-settings`);a++,t.singletonContentId?(m("Saving settings draft..."),await s.apiFetch(`/v1/admin/sites/${o}/content/${t.singletonContentId}/draft`,{method:"PUT",body:JSON.stringify({title:"Site Settings",slug:"site-settings",body:Se})}),a++,m("Publishing settings..."),await s.apiFetch(`/v1/admin/sites/${o}/content/${t.singletonContentId}/publish`,{method:"POST"}),a++,r.contentCreated.push("site-settings")):a+=2}catch(t){r.errors.push(`Failed to populate settings: ${t instanceof Error?t.message:String(t)}`),a+=3}}return m("Done"),r}function Pe(){const[s,o]=u.useState(!1),{data:d,isLoading:g}=X(s),r=V(),x=u.useMemo(()=>[...d?.items??[]].sort((l,A)=>(l.name||l.host).localeCompare(A.name||A.host)),[d]),{user:a}=Z(),{data:m}=ee(),y=a?(m?.superAdminIds??[]).includes(a.sub):!1,p=te(),t=se(),[n,f]=u.useState(!1),[h,j]=u.useState(""),[S,c]=u.useState(""),[N,i]=u.useState(!0),[v,D]=u.useState(!0),[w,O]=u.useState(!0),[P,E]=u.useState(!0),[F,L]=u.useState(!1),[H,T]=u.useState(null),I=()=>{j(""),c(""),i(!0),D(!0),O(!0),E(!0),L(!1),T(null)},B=l=>{f(l),l||I()};if(g)return e.jsx(ae,{});const _=async()=>{if(h.trim())try{await t.mutateAsync({host:h.trim(),name:S.trim()||h.trim()});const l={createPages:v,createPosts:w,createSettings:P,addSampleContent:F};if(N&&(v||w||P)){const A=Q(l);T({completed:0,total:A,label:"Setting up collections..."});const M=await be(p,h.trim(),l,T);M.errors.length>0&&console.warn("Scaffold warnings:",M.errors)}f(!1),I()}catch{T(null)}};return x.length===0?e.jsxs("div",{className:"flex h-dvh flex-col",children:[e.jsx(U,{}),e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"No sites available."}),e.jsxs(G,{open:n,onOpenChange:B,children:[e.jsx(J,{asChild:!0,children:e.jsxs(k,{children:[e.jsx(R,{className:"mr-2 h-4 w-4"}),"Create Site"]})}),e.jsx(q,{newHost:h,setNewHost:j,newName:S,setNewName:c,createDefaults:N,setCreateDefaults:i,createPages:v,setCreatePages:D,createPosts:w,setCreatePosts:O,createSettings:P,setCreateSettings:E,addSampleContent:F,setAddSampleContent:L,onSubmit:_,isPending:t.isPending,scaffoldProgress:H})]})]})]}):e.jsxs("div",{className:"flex h-dvh flex-col",children:[e.jsx(U,{}),e.jsxs("div",{className:"flex-1 p-4 sm:p-8",children:[e.jsxs("div",{className:"mb-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Select a site"}),y&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(b,{checked:s,onCheckedChange:l=>o(l===!0)}),"Show archived sites"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(k,{variant:"outline",onClick:()=>r("/users"),children:[e.jsx(ne,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"All Users"})]}),e.jsxs(G,{open:n,onOpenChange:B,children:[e.jsx(J,{asChild:!0,children:e.jsxs(k,{children:[e.jsx(R,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Create Site"})]})}),e.jsx(q,{newHost:h,setNewHost:j,newName:S,setNewName:c,createDefaults:N,setCreateDefaults:i,createPages:v,setCreatePages:D,createPosts:w,setCreatePosts:O,createSettings:P,setCreateSettings:E,addSampleContent:F,setAddSampleContent:L,onSubmit:_,isPending:t.isPending,scaffoldProgress:H})]})]})]})]}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:x.map(l=>e.jsx(me,{className:"cursor-pointer transition-shadow hover:shadow-md",onClick:()=>r(`/sites/${l.host}/content`),children:e.jsxs(he,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{children:l.name||l.host}),l.status==="archived"&&e.jsx(oe,{variant:"outline",children:"Archived"})]}),e.jsx(ge,{children:l.host})]})},l.host))})]})]})}function q({newHost:s,setNewHost:o,newName:d,setNewName:g,createDefaults:r,setCreateDefaults:x,createPages:a,setCreatePages:m,createPosts:y,setCreatePosts:p,createSettings:t,setCreateSettings:n,addSampleContent:f,setAddSampleContent:h,onSubmit:j,isPending:S,scaffoldProgress:c}){const N=S||!!c;return e.jsxs(ie,{children:[e.jsxs(le,{children:[e.jsx(re,{children:"Create Site"}),e.jsx(ce,{className:"sr-only",children:"Enter details for the new site"})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"host",children:"Host"}),e.jsx(Y,{id:"host",placeholder:"example.com",value:s,onChange:i=>o(i.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"name",children:"Display Name"}),e.jsx(Y,{id:"name",placeholder:"My Site",value:d,onChange:i=>g(i.target.value)})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(b,{checked:r,onCheckedChange:i=>x(i===!0)}),"Create Default Collections"]}),r&&e.jsxs("div",{className:"ml-6 mt-3 space-y-2",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(b,{checked:a,onCheckedChange:i=>m(i===!0)}),"Pages"]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(b,{checked:y,onCheckedChange:i=>p(i===!0)}),"Posts"]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(b,{checked:t,onCheckedChange:i=>n(i===!0)}),"Site Settings"]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(b,{checked:f,onCheckedChange:i=>h(i===!0)}),"Add Sample Content"]})]})]})]}),c&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300",style:{width:`${c.total>0?c.completed/c.total*100:0}%`},role:"progressbar","aria-valuenow":c.completed,"aria-valuemin":0,"aria-valuemax":c.total})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.label," ","(",c.completed,"/",c.total,")"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Please wait while your site is being set up. Do not close this tab."})]}),e.jsx(de,{children:e.jsx(k,{onClick:j,disabled:!s.trim()||N,children:c?c.label:S?"Creating...":"Create"})})]})}export{Pe as SitesPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./tanstack-Bs3zYPPV.js";import{u as B,f as L,r as M,L as S}from"./react-vendor-C2CvUxFh.js";import{j as $,m as O}from"./useContent-DLo6FUYZ.js";import{u as E}from"./useTrash-BFJMIP8N.js";import{x as P,w as U,S as g,B as c,bb as z,a5 as H,Z as V,D as Y,i as Z,T as _,k as q,l as G,m as J,n as K,o as Q,aj as W,j as X,v as y}from"./index-CbEa9yyd.js";import{u as ss}from"./usePageTitle-BJ2ARyuc.js";import{C as v,a as w,b as D,c as C}from"./card-CVAiqxnT.js";import{f as es}from"./format-BRcflvs9.js";import{a as ts}from"./MediaField-eRyEALYH.js";import"./radix-C5ZmWuuL.js";import"./FileTypeIcon-DRD08pW_.js";import"./select-B2yTIHJT.js";import"./table-C3EQVw1z.js";import"./media-url-DdCoIedP.js";function ns({host:n,ref:t}){const l=!t.title&&!!t.contentId,{data:r}=$(n,l?t.contentId:""),d=l&&r?.content?r.content:null,u=t.title||d?.title||t.contentId,i=t.collection||d?.collection||"";return s.jsxs(S,{to:`/sites/${n}/content/${i}/${t.contentId}`,className:"flex items-center gap-3 rounded-md border p-2 transition-colors hover:bg-muted",children:[s.jsx(W,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"flex-1 truncate text-sm",children:u}),i&&s.jsx(X,{variant:"secondary",children:i})]})}function bs(){const{host:n,collection:t,id:l}=B(),r=L(),d=P(),{collections:u}=U(),{data:i,isLoading:k}=$(n,l),T=O(n,l),p=E(n),[I,f]=M.useState(!1),m=u.find(e=>e.name===t),b=m?.relationships??[];if(ss({title:"Submission Detail",showBack:!0,backTo:`/sites/${n}/submissions/${t}`}),k)return s.jsxs("div",{className:"space-y-4",children:[s.jsx(g,{className:"h-8 w-64"}),s.jsx(g,{className:"h-64 w-full"})]});if(!i?.content)return s.jsx("p",{className:"text-muted-foreground",children:"Submission not found."});const o=i.content,x=i.body??o.body,h=o.siteUser,j=o.relationships;function R(e,a){return a==null?"—":typeof a=="boolean"?a?"Yes":"No":Array.isArray(a)?a.join(", "):String(a)}async function A(){try{await T.mutateAsync(),y.success("Submission moved to trash"),r(`/sites/${n}/submissions/${t}`)}catch(e){y.error("Failed to delete",{description:e instanceof Error?e.message:void 0})}}const F=b.length>0&&j&&Object.keys(j).length>0;return s.jsxs("div",{className:"mx-auto max-w-2xl",children:[!d&&s.jsxs("div",{className:"mb-6 flex items-center gap-4",children:[s.jsxs(c,{variant:"ghost",size:"sm",onClick:()=>r(`/sites/${n}/submissions/${t}`),children:[s.jsx(z,{className:"mr-1.5 h-4 w-4"}),"Back"]}),s.jsx("h1",{className:"text-2xl font-semibold",children:"Submission Detail"}),s.jsx("div",{className:"ml-auto",children:s.jsxs(c,{variant:"outline",size:"sm",onClick:()=>r(`/sites/${n}/submissions/${t}/${l}/edit`),children:[s.jsx(H,{className:"mr-1.5 h-4 w-4"}),"Edit"]})})]}),s.jsxs(v,{children:[s.jsx(w,{children:s.jsx(D,{children:o.title||"Untitled"})}),s.jsxs(C,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2 text-sm",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"ID"}),s.jsx("span",{className:"font-mono text-xs",children:o.contentId})]}),!!o.publishedAt&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Submitted"}),s.jsx("span",{children:es(o.publishedAt)})]}),h&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Submitted by"}),s.jsx(S,{to:`/sites/${n}/settings/site-users/${h.userId}`,className:"text-primary hover:underline",children:h.name||h.email})]})]}),s.jsx(V,{}),s.jsxs("div",{className:"space-y-3",children:[m?.fields?.map(e=>s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:e.label||e.name}),e.type==="media"?s.jsx(ts,{field:e,value:x?.[e.name],onChange:()=>{},disabled:!0}):s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R(e,x?.[e.name])})]},e.name)),(!m?.fields||m.fields.length===0)&&x&&s.jsx("div",{className:"space-y-3",children:Object.entries(x).map(([e,a])=>s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:e}),s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:a==null?"—":String(a)})]},e))})]})]})]}),F&&s.jsxs(v,{className:"mt-6",children:[s.jsx(w,{children:s.jsx(D,{children:"Relationships"})}),s.jsx(C,{className:"space-y-4",children:b.map(e=>{const a=j?.[e.name]??[];return a.length===0?null:s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-sm font-medium",children:e.label}),s.jsx("div",{className:"space-y-2",children:a.map(N=>s.jsx(ns,{host:n,ref:N},N.contentId))})]},e.name)})})]}),s.jsx("div",{className:"mt-6",children:s.jsxs(Y,{open:I,onOpenChange:f,children:[s.jsx(Z,{asChild:!0,children:s.jsxs(c,{variant:"destructive",children:[s.jsx(_,{className:"mr-2 h-4 w-4"}),"Delete Submission"]})}),s.jsxs(q,{children:[s.jsxs(G,{children:[s.jsx(J,{children:"Move submission to trash?"}),s.jsxs(K,{children:["This submission will be moved to the trash and can be restored within ",p," days. After ",p," days it will be permanently deleted."]})]}),s.jsxs(Q,{children:[s.jsx(c,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),s.jsx(c,{onClick:A,children:"Move to trash"})]})]})]})})]})}export{bs as SubmissionDetailPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./tanstack-Bs3zYPPV.js";import{u as O,f as z,r as u}from"./react-vendor-C2CvUxFh.js";import{x as U,w as V,e as D,S as E,B as P,bb as H,L as q,bc as G,I as x,v as j}from"./index-
|
|
1
|
+
import{j as s}from"./tanstack-Bs3zYPPV.js";import{u as O,f as z,r as u}from"./react-vendor-C2CvUxFh.js";import{x as U,w as V,e as D,S as E,B as P,bb as H,L as q,bc as G,I as x,v as j}from"./index-CbEa9yyd.js";import{j as J,s as K,t as Q}from"./useContent-DLo6FUYZ.js";import{u as W}from"./usePageTitle-BJ2ARyuc.js";import{T as X}from"./textarea-DIHLWabG.js";import{C as Y}from"./checkbox-BO-Fusdb.js";import{S as Z,a as _,b as ee,c as se,d as te}from"./select-B2yTIHJT.js";import{C as ae,a as ne,b as ie,c as oe}from"./card-CVAiqxnT.js";import{a as re}from"./MediaField-eRyEALYH.js";import{R as ce}from"./RelationshipPicker-VVZN4dlP.js";import"./radix-C5ZmWuuL.js";import"./FileTypeIcon-DRD08pW_.js";import"./table-C3EQVw1z.js";import"./media-url-DdCoIedP.js";import"./format-BRcflvs9.js";import"./core.esm-DdQHdRkd.js";import"./sortable.esm-qVEMoaTg.js";import"./ContentField-D6UO6W9G.js";import"./popover-B9WNjj2t.js";import"./command-D0ojin3H.js";import"./useContentSearch-D-D0veFh.js";function Pe(){const{host:i,collection:c,id:m}=O(),b=z(),R=U(),{collections:A}=V(),o=!!m,d=A.find(t=>t.name===c),v=u.useMemo(()=>d?.relationships??[],[d?.relationships]),p=v.length>0,{data:h,isLoading:T}=J(i,m??""),S=D(),C=K(i),f=Q(i,m??""),[y,$]=u.useState({}),[w,N]=u.useState({}),[k,L]=u.useState(!o);W({title:o?"Edit Submission":"New Submission",showBack:!0,backTo:o?`/sites/${i}/submissions/${c}/${m}`:`/sites/${i}/submissions/${c}`});const I=u.useCallback(async t=>{const a={};for(const[e,n]of Object.entries(t))a[e]=await Promise.all(n.map(async r=>{if(r.title)return r;try{const g=await S.apiFetch(`/v1/admin/sites/${i}/content/${r.contentId}`);return{contentId:r.contentId,collection:g.content.collection??r.collection??"",slug:g.content.slug??r.slug??"",title:g.content.title??r.contentId}}catch{return r}}));return a},[S,i]);if(u.useEffect(()=>{if(o&&h&&!k){const t=h.body;t&&$({...t});const e=h.content?.relationships;e&&Object.keys(e).length>0&&I(e).then(N),L(!0)}},[o,h,k,I]),o&&T)return s.jsxs("div",{className:"space-y-4",children:[s.jsx(E,{className:"h-8 w-64"}),s.jsx(E,{className:"h-64 w-full"})]});function l(t,a){$(e=>({...e,[t]:a}))}function B(t){const a=y[t.name];switch(t.type){case"text":return s.jsx(x,{value:a??"",onChange:e=>l(t.name,e.target.value)});case"textarea":return s.jsx(X,{value:a??"",onChange:e=>l(t.name,e.target.value),rows:4});case"number":return s.jsx(x,{type:"number",value:a!=null?String(a):"",onChange:e=>l(t.name,e.target.value===""?void 0:Number(e.target.value))});case"boolean":return s.jsx(Y,{checked:!!a,onCheckedChange:e=>l(t.name,!!e)});case"select":{const e=t.options?.choices??[];return s.jsxs(Z,{value:a??"",onValueChange:n=>l(t.name,n),children:[s.jsx(_,{children:s.jsx(ee,{placeholder:"Select..."})}),s.jsx(se,{children:e.map(n=>s.jsx(te,{value:n,children:n},n))})]})}case"array":return s.jsx(x,{value:Array.isArray(a)?a.join(", "):a??"",onChange:e=>l(t.name,e.target.value?e.target.value.split(",").map(n=>n.trim()):[]),placeholder:"Comma-separated values"});case"media":return s.jsx(re,{field:t,value:a,onChange:()=>{},disabled:!0});default:return s.jsx(x,{value:a??"",onChange:e=>l(t.name,e.target.value)})}}async function M(){const t={};for(const[e,n]of Object.entries(y))n!==void 0&&n!==""&&(t[e]=n);const a={};if(p)for(const[e,n]of Object.entries(w))a[e]=n.map(r=>({contentId:r.contentId}));try{if(o)await f.mutateAsync({fields:t,...p?{relationships:a}:{}}),j.success("Submission updated"),b(`/sites/${i}/submissions/${c}/${m}`);else{const e=await C.mutateAsync({collection:c,fields:t,...p?{relationships:a}:{}});j.success("Submission created"),b(`/sites/${i}/submissions/${c}/${e.contentId}`)}}catch(e){const n=e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):String(e);j.error(o?"Failed to update":"Failed to create",{description:n})}}const F=C.isPending||f.isPending;return s.jsxs("div",{className:"mx-auto max-w-2xl",children:[!R&&s.jsxs("div",{className:"mb-6 flex items-center gap-4",children:[s.jsxs(P,{variant:"ghost",size:"sm",onClick:()=>b(o?`/sites/${i}/submissions/${c}/${m}`:`/sites/${i}/submissions/${c}`),children:[s.jsx(H,{className:"mr-1.5 h-4 w-4"}),"Back"]}),s.jsx("h1",{className:"text-2xl font-semibold",children:o?"Edit Submission":"New Submission"})]}),s.jsxs(ae,{children:[s.jsx(ne,{children:s.jsx(ie,{children:d?.label??c})}),s.jsxs(oe,{className:"space-y-4",children:[d?.fields?.map(t=>s.jsxs("div",{className:"space-y-2",children:[s.jsx(q,{htmlFor:`field-${t.name}`,children:t.label||t.name}),s.jsx("div",{id:`field-${t.name}`,children:B(t)})]},t.name)),s.jsx("div",{className:"pt-4",children:s.jsxs(P,{onClick:M,disabled:F,children:[s.jsx(G,{className:"mr-1.5 h-4 w-4"}),F?"Saving...":o?"Update":"Create"]})})]})]}),p&&s.jsx("div",{className:"mt-6",children:s.jsx(ce,{relationships:v,values:w,onChange:N,host:i})})]})}export{Pe as SubmissionEditPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./tanstack-Bs3zYPPV.js";import{u as H,f as G,r as x}from"./react-vendor-C2CvUxFh.js";import{u as J}from"./useFilterParams-DYdEuWPE.js";import{w as K,x as Q,B as M,P as W,T as X,v as U,S as Y,y as Z}from"./index-CbEa9yyd.js";import{d as ee,c as se}from"./useContent-DLo6FUYZ.js";import{u as te}from"./usePageTitle-BJ2ARyuc.js";import{u as ae,F as le,g as ne}from"./listCellValue-BUdbRyCz.js";import{C as re,c as ie}from"./card-CVAiqxnT.js";import{C as I}from"./checkbox-BO-Fusdb.js";import{S as oe,a as ce,b as de,c as ue,d as me}from"./select-B2yTIHJT.js";import{T as he,a as xe,b as L,c as S,d as pe,e as N}from"./table-C3EQVw1z.js";import{a as R,f as fe}from"./format-BRcflvs9.js";import{P as ge}from"./Pagination-DTboMLK6.js";import"./radix-C5ZmWuuL.js";import"./popover-B9WNjj2t.js";import"./command-D0ojin3H.js";import"./useContentSearch-D-D0veFh.js";import"./media-url-DdCoIedP.js";const be=[{value:"created_desc",label:"Newest first"},{value:"created_asc",label:"Oldest first"}];function Re(){const{host:m,collection:i}=H(),v=G(),{collections:_}=K(),[o,l]=J([{key:"sort",defaultValue:"created_desc"},{key:"relatedTo",defaultValue:""},{key:"relField",defaultValue:""},{key:"page",defaultValue:"1"},{key:"perPage",defaultValue:"20"},{key:"after",defaultValue:""}]),f=o.sort,c=o.relatedTo,n=o.relField,r=Number(o.page)||1,w=Number(o.perPage)||20,k=x.useMemo(()=>{const e=o.after;return e?e.split(","):[]},[o.after]),[d,a]=x.useState(new Set),T=Q(),h=_.find(e=>e.name===i),g=h?.relationships??[];te({title:h?.label??i??""});const{data:y}=ae(m,c||void 0),P=x.useMemo(()=>{if(!c||!n)return null;const e=g.find(t=>t.name===n);return{type:"relationship",relName:n,relLabel:e?.label??n,contentId:c,contentTitle:y??"Loading..."}},[c,n,g,y]),B=x.useCallback(()=>{l({page:"1",after:""}),a(new Set)},[l]),D=x.useMemo(()=>{const e={};return f!=="created_desc"&&(e.sort=f),c&&(e.relatedTo=c),n&&(e.relField=n),e.limit=w,e},[f,c,n,w]),O=r>1?k[r-2]:void 0,{data:p,isLoading:z}=ee(m,i,D,O),F=se(m),b=p?.items,j=h?.fields,A=x.useMemo(()=>{if(!j)return[];const e=j.filter(t=>(t.options??{}).listColumn===!0);return e.length>0?e:j.filter(t=>["text","number","boolean","select"].includes(t.type)).slice(0,4)},[j]),C=b?.map(e=>e.contentId)??[],$=C.length>0&&C.every(e=>d.has(e));function V(e){a(t=>{const u=new Set(t);return u.has(e)?u.delete(e):u.add(e),u})}function q(){a($?new Set:new Set(C))}return s.jsxs("div",{children:[!T&&s.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:h?.label??i}),s.jsxs(M,{onClick:()=>v(`/sites/${m}/submissions/${i}/new`),children:[s.jsx(W,{className:"mr-1.5 h-4 w-4"}),"New Submission"]})]}),s.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[g.length>0&&s.jsx(le,{relationships:g,activeFilters:P?[P]:[],onFilterAdd:e=>{l({relatedTo:e.contentId,relField:e.relName,page:"1",after:""}),a(new Set)},onFilterRemove:()=>{l({relatedTo:"",relField:"",page:"1",after:""}),a(new Set)}}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[d.size>0&&s.jsxs(M,{variant:"destructive",size:"sm",onClick:async()=>{const e=[...d],u=(await F.mutateAsync(e)).filter(E=>E.status==="rejected").length;u?U.error(`${u} of ${e.length} failed to delete`):U.success(`${e.length} submission(s) moved to trash`),B()},disabled:F.isPending,children:[s.jsx(X,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete (",d.size,")"]}),s.jsxs(oe,{value:f,onValueChange:e=>{l({sort:e,page:"1",after:""}),a(new Set)},children:[s.jsx(ce,{className:"w-[150px]",children:s.jsx(de,{})}),s.jsx(ue,{children:be.map(e=>s.jsx(me,{value:e.value,children:e.label},e.value))})]})]})]}),z?s.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((e,t)=>s.jsx(Y,{className:"h-12 w-full"},t))}):b?.length?s.jsxs(s.Fragment,{children:[T?s.jsx("div",{className:"grid gap-3","data-testid":"submission-card-view",children:b.map(e=>s.jsx(re,{className:Z("cursor-pointer gap-0 overflow-hidden py-0 transition-shadow hover:shadow-md",d.has(e.contentId)&&"ring-2 ring-primary"),onClick:()=>v(`/sites/${m}/submissions/${i}/${e.contentId}`),children:s.jsx(ie,{className:"p-3",children:s.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"font-medium truncate",children:["Submission ",e.contentId.slice(-6)]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e.publishedAt?R(e.publishedAt):"—"}),e.siteUser&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["by ",e.siteUser.name||e.siteUser.userId]})]}),s.jsx(I,{checked:d.has(e.contentId),onCheckedChange:()=>V(e.contentId),onClick:t=>t.stopPropagation(),className:"mt-1"})]})})},e.contentId))}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(he,{children:[s.jsx(xe,{children:s.jsxs(L,{children:[s.jsx(S,{className:"w-10",children:s.jsx(I,{checked:$,onCheckedChange:q,"aria-label":"Select all"})}),A.map(e=>s.jsx(S,{children:e.label||e.name},e.name)),h?.requireAuth&&s.jsx(S,{children:"Submitted by"}),s.jsx(S,{children:"Submitted"})]})}),s.jsx(pe,{children:b.map(e=>s.jsxs(L,{className:"cursor-pointer",onClick:()=>v(`/sites/${m}/submissions/${i}/${e.contentId}`),children:[s.jsx(N,{onClick:t=>t.stopPropagation(),children:s.jsx(I,{checked:d.has(e.contentId),onCheckedChange:()=>V(e.contentId),"aria-label":`Select submission ${e.contentId.slice(-6)}`})}),A.map(t=>s.jsx(N,{className:"text-muted-foreground text-sm",children:ne(e,t)},t.name)),h?.requireAuth&&s.jsx(N,{className:"text-muted-foreground text-sm",children:e.siteUser?e.siteUser.name||e.siteUser.userId:"—"}),s.jsx(N,{className:"text-muted-foreground",children:e.publishedAt?s.jsx("span",{title:fe(e.publishedAt),children:R(e.publishedAt)}):"—"})]},e.contentId))})]})}),s.jsx(ge,{page:r,hasNext:!!p?.hasMore,hasPrevious:r>1,onNext:()=>{if(p?.items.length){const e=p.items[p.items.length-1].contentId,t=[...k.slice(0,r-1),e];l({page:String(r+1),after:t.join(",")})}else l({page:String(r+1)});a(new Set)},onPrevious:()=>{const e=r-1;l(e<=1?{page:"1",after:""}:{page:String(e)}),a(new Set)},perPage:w,onPerPageChange:e=>{l({perPage:String(e),page:"1",after:""}),a(new Set)}})]}):s.jsx("p",{className:"text-muted-foreground",children:"No submissions yet."})]})}export{Re as SubmissionListPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-Bs3zYPPV.js";import{r as g}from"./react-vendor-C2CvUxFh.js";import{y as r,B as x,j as b,X as y,I as A}from"./index-
|
|
1
|
+
import{j as e}from"./tanstack-Bs3zYPPV.js";import{r as g}from"./react-vendor-C2CvUxFh.js";import{y as r,B as x,j as b,X as y,I as A}from"./index-CbEa9yyd.js";import{x as z,y as N,z as k,B as C,E as T,F as S,G as B,H as I,J as E}from"./radix-C5ZmWuuL.js";function K({...t}){return e.jsx(z,{"data-slot":"alert-dialog",...t})}function O({...t}){return e.jsx(B,{"data-slot":"alert-dialog-trigger",...t})}function R({...t}){return e.jsx(I,{"data-slot":"alert-dialog-portal",...t})}function _({className:t,...o}){return e.jsx(E,{"data-slot":"alert-dialog-overlay",className:r("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...o})}function P({className:t,size:o="default",...s}){return e.jsxs(R,{children:[e.jsx(_,{}),e.jsx(N,{"data-slot":"alert-dialog-content","data-size":o,className:r("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg",t),...s})]})}function G({className:t,...o}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:r("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",t),...o})}function J({className:t,...o}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:r("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",t),...o})}function U({className:t,...o}){return e.jsx(k,{"data-slot":"alert-dialog-title",className:r("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",t),...o})}function W({className:t,...o}){return e.jsx(C,{"data-slot":"alert-dialog-description",className:r("text-muted-foreground text-sm",t),...o})}function X({className:t,variant:o="default",size:s="default",...i}){return e.jsx(x,{variant:o,size:s,asChild:!0,children:e.jsx(S,{"data-slot":"alert-dialog-action",className:r(t),...i})})}function $({className:t,variant:o="outline",size:s="default",...i}){return e.jsx(x,{variant:o,size:s,asChild:!0,children:e.jsx(T,{"data-slot":"alert-dialog-cancel",className:r(t),...i})})}function q({tags:t,onChange:o,placeholder:s,suggestions:i}){const[d,p]=g.useState(""),[f,u]=g.useState(-1),[h,c]=g.useState(!1),w=g.useRef(null),n=d&&i?i.filter(a=>a.toLowerCase().startsWith(d.toLowerCase())&&!t.includes(a)):[];function m(a){const l=a.trim().toLowerCase();l&&!t.includes(l)&&o([...t,l]),p(""),u(-1),c(!1)}function j(a){if(a.key==="ArrowDown"&&n.length>0){a.preventDefault(),u(l=>Math.min(l+1,n.length-1));return}if(a.key==="ArrowUp"&&n.length>0){a.preventDefault(),u(l=>Math.max(l-1,0));return}if(a.key==="Enter"||a.key===","){a.preventDefault(),f>=0&&f<n.length?m(n[f]):m(d);return}if(a.key==="Escape"){c(!1),u(-1);return}a.key==="Backspace"&&!d&&t.length>0&&o(t.slice(0,-1))}function v(a){o(t.filter(l=>l!==a))}return e.jsxs("div",{className:"relative",ref:w,children:[e.jsxs("div",{className:"flex flex-wrap gap-1 rounded-md border p-2 focus-within:ring-1 focus-within:ring-ring",children:[t.map(a=>e.jsxs(b,{variant:"secondary",className:"gap-1",children:[a,e.jsx("button",{type:"button",onClick:()=>v(a),className:"ml-0.5 rounded-full hover:bg-muted",children:e.jsx(y,{className:"h-3 w-3"})})]},a)),e.jsx(A,{value:d,onChange:a=>{p(a.target.value),u(-1),c(!0)},onKeyDown:j,onFocus:()=>c(!0),onBlur:()=>{setTimeout(()=>c(!1),150)},placeholder:t.length===0?s??"Add tags...":"",className:"min-w-[80px] flex-1 border-0 p-0 shadow-none focus-visible:ring-0"})]}),h&&n.length>0&&e.jsx("div",{className:"absolute z-10 mt-1 max-h-48 w-full overflow-auto rounded-md border bg-popover p-1 shadow-md",children:n.map((a,l)=>e.jsx("button",{type:"button",className:`w-full rounded-sm px-2 py-1.5 text-left text-sm ${l===f?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,onMouseDown:D=>{D.preventDefault(),m(a)},children:a},a))})]})}export{K as A,q as T,P as a,G as b,U as c,W as d,J as e,$ as f,X as g,O as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-Bs3zYPPV.js";import{u as b,r as x}from"./react-vendor-C2CvUxFh.js";import{u as D,a as y,b as v}from"./useTags-
|
|
1
|
+
import{j as e}from"./tanstack-Bs3zYPPV.js";import{u as b,r as x}from"./react-vendor-C2CvUxFh.js";import{u as D,a as y,b as v}from"./useTags-CyGo0zXa.js";import{x as w,I as N,B as c,P as C,S as P,T as S,v as d,D as k,k as A,l as E,m as B,n as F,o as H}from"./index-CbEa9yyd.js";import{T as I,a as M,b as j,c as m,d as $,e as u}from"./table-C3EQVw1z.js";import{u as L}from"./usePageTitle-BJ2ARyuc.js";import"./radix-C5ZmWuuL.js";function Q(){const{host:t}=b(),{data:s,isLoading:n}=D(t),o=y(t),[l,r]=x.useState(""),[T,g]=x.useState(null),f=w();L({title:"Tags"});async function p(a){a.preventDefault();const i=l.trim().toLowerCase();if(i)try{await o.mutateAsync(i),r(""),d.success(`Tag "${i}" created`)}catch(h){d.error("Failed to create tag",{description:h instanceof Error?h.message:void 0})}}return e.jsxs("div",{children:[!f&&e.jsx("div",{className:"mb-6 flex items-center justify-between",children:e.jsxs("h1",{className:"text-2xl font-semibold",children:["Tags",s?` (${s.length})`:""]})}),e.jsxs("form",{onSubmit:p,className:"mb-6 flex gap-2",children:[e.jsx(N,{value:l,onChange:a=>r(a.target.value),placeholder:"New tag name...",className:"max-w-xs"}),e.jsxs(c,{type:"submit",disabled:o.isPending||!l.trim(),children:[e.jsx(C,{className:"mr-2 h-4 w-4"}),"Add Tag"]})]}),n?e.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((a,i)=>e.jsx(P,{className:"h-12 w-full"},i))}):s?.length?e.jsxs(I,{children:[e.jsx(M,{children:e.jsxs(j,{children:[e.jsx(m,{children:"Tag"}),e.jsx(m,{children:"Published Content"}),e.jsx(m,{})]})}),e.jsx($,{children:s.map(a=>e.jsxs(j,{children:[e.jsx(u,{className:"font-medium",children:a.tag}),e.jsx(u,{className:"text-muted-foreground",children:a.count}),e.jsx(u,{children:e.jsx(c,{variant:"ghost",size:"sm",disabled:a.count>0,title:a.count>0?"Cannot delete a tag that is in use":"Delete tag",onClick:()=>g(a.tag),children:e.jsx(S,{className:"h-4 w-4"})})})]},a.tag))})]}):e.jsx("p",{className:"text-muted-foreground",children:"No tags yet. Tags are created automatically when you publish content with tags, or you can create them manually above."}),e.jsx(R,{host:t,tag:T,onClose:()=>g(null)})]})}function R({host:t,tag:s,onClose:n}){const o=v(t);async function l(){if(s)try{await o.mutateAsync(s),d.success(`Tag "${s}" deleted`),n()}catch(r){d.error("Failed to delete tag",{description:r instanceof Error?r.message:void 0})}}return e.jsx(k,{open:!!s,onOpenChange:()=>n(),children:e.jsxs(A,{children:[e.jsxs(E,{children:[e.jsx(B,{children:"Delete tag?"}),e.jsxs(F,{children:["This will remove the tag “",s,"” from the tag list. This action cannot be undone."]})]}),e.jsxs(H,{children:[e.jsx(c,{variant:"outline",onClick:n,children:"Cancel"}),e.jsx(c,{variant:"destructive",onClick:l,children:"Delete"})]})]})})}export{Q as TagsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./tanstack-Bs3zYPPV.js";import{u as J,r as m}from"./react-vendor-C2CvUxFh.js";import{aL as K,x as Q,au as W,S as X,B as a,a$ as Y,a8 as Z,a9 as ee,ad as se,ab as te,ac as ae,T as re,D as C,k as w,l as D,m as S,n as E,o as I,v as l}from"./index-CbEa9yyd.js";import{u as ne,a as le,b as ie,c as oe,d as ce}from"./useTrash-BFJMIP8N.js";import{u as de}from"./useAdminResolver-_OHcUYwq.js";import{u as he}from"./usePageTitle-BJ2ARyuc.js";import{S as me,a as ue,b as xe,c as je,d as P}from"./select-B2yTIHJT.js";import{T as pe,a as fe,b as A,c as i,d as ge,e as o}from"./table-C3EQVw1z.js";import{a as ve,f as ye}from"./format-BRcflvs9.js";import"./radix-C5ZmWuuL.js";const f="__all__";function Ae(){const{host:r}=J(),[j,k]=m.useState(f),M=K(),L=Q(),p=ne(r),{data:R}=W(r),B=R?.items??[],c=j===f?void 0:j,{data:g,isLoading:F,fetchNextPage:O,hasNextPage:_,isFetchingNextPage:v}=le(r,c),n=m.useMemo(()=>g?.pages.flatMap(s=>s.items)??[],[g]),$=m.useMemo(()=>n.map(s=>s.trashedBy).filter(s=>!!s),[n]),{resolve:U}=de($);he({title:"Trash"});const y=ie(r),b=oe(r),T=ce(r),[d,u]=m.useState(null),[z,x]=m.useState(!1);async function H(s){try{await y.mutateAsync(s.contentId),l.success("Item restored")}catch(t){l.error("Failed to restore",{description:t instanceof Error?t.message:void 0})}}async function V(){if(!d)return;const s=d;u(null);try{await b.mutateAsync(s.contentId),l.success("Item permanently deleted")}catch(t){l.error("Failed to delete",{description:t instanceof Error?t.message:void 0})}}async function q(){x(!1);const s=c!==void 0?[c]:[...new Set(n.map(h=>h.collection))],N=(await Promise.allSettled(s.map(h=>T.mutateAsync(h)))).filter(h=>h.status==="rejected").length;N>0?l.error(`Failed to empty ${N} of ${s.length} collection${s.length===1?"":"s"}`):l.success("Trash emptied")}const G=M==="admin"&&n.length>0;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6",children:[!L&&e.jsx("h1",{className:"mb-1 text-2xl font-semibold",children:"Trash"}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Items in the trash are recoverable for ",p," days. After"," ",p," days they are permanently deleted."]})]}),e.jsx("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:e.jsxs(me,{value:j,onValueChange:s=>k(s),children:[e.jsx(ue,{className:"w-[220px]","data-testid":"trash-collection-filter",children:e.jsx(xe,{placeholder:"All collections"})}),e.jsxs(je,{children:[e.jsx(P,{value:f,children:"All collections"}),B.map(s=>e.jsx(P,{value:s.name,children:s.label},s.name))]})]})}),F?e.jsx("div",{className:"space-y-2",children:Array.from({length:4}).map((s,t)=>e.jsx(X,{className:"h-12 w-full"},t))}):n.length===0?e.jsxs("div",{className:"border-muted-foreground/20 rounded-md border border-dashed p-10 text-center",children:[e.jsx("p",{className:"text-lg font-medium",children:"Trash is empty"}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Deleted content will appear here for ",p," days."]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(pe,{children:[e.jsx(fe,{children:e.jsxs(A,{children:[e.jsx(i,{children:"Title"}),e.jsx(i,{children:"Collection"}),e.jsx(i,{children:"Submitter"}),e.jsx(i,{children:"Trashed"}),e.jsx(i,{children:"Trashed by"}),e.jsx(i,{className:"w-[140px]",children:"Actions"})]})}),e.jsx(ge,{children:n.map(s=>{const t=s.mode==="submission";return e.jsxs(A,{"data-testid":"trash-row",children:[e.jsx(o,{className:"font-medium",children:s.title||s.contentId}),e.jsx(o,{className:"text-muted-foreground",children:s.collection}),e.jsx(o,{className:"text-muted-foreground text-sm",children:t&&s.siteUser?s.siteUser.name||s.siteUser.userId:""}),e.jsx(o,{className:"text-muted-foreground",title:ye(s.trashedAt),children:ve(s.trashedAt)}),e.jsx(o,{className:"text-muted-foreground text-sm",children:U(s.trashedBy)}),e.jsx(o,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{size:"sm",variant:"default",onClick:()=>H(s),disabled:y.isPending,"data-testid":"trash-restore",children:[e.jsx(Y,{className:"mr-1.5 h-3.5 w-3.5"}),"Restore"]}),e.jsxs(Z,{children:[e.jsx(ee,{asChild:!0,children:e.jsx(a,{size:"sm",variant:"ghost",className:"size-8 p-0","aria-label":"More actions","data-testid":"trash-row-menu",children:e.jsx(se,{className:"h-4 w-4"})})}),e.jsx(te,{align:"end",children:e.jsxs(ae,{onClick:()=>u(s),className:"text-destructive focus:text-destructive","data-testid":"trash-delete-forever",children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete forever"]})})]})]})})]},s.contentId)})})]})}),_&&e.jsx("div",{className:"mt-4",children:e.jsx(a,{variant:"outline",onClick:()=>O(),disabled:v,children:v?"Loading...":"Load more"})}),G&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-6 border-t"}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Permanently delete every item in this trash. This action cannot be undone."}),e.jsx(a,{variant:"destructive",onClick:()=>x(!0),"data-testid":"trash-empty",children:"Empty trash"})]})]})]}),e.jsx(C,{open:d!==null,onOpenChange:s=>!s&&u(null),children:e.jsxs(w,{children:[e.jsxs(D,{children:[e.jsx(S,{children:"Delete forever?"}),e.jsxs(E,{children:["This action cannot be undone. “",d?.title||d?.contentId,"” will be permanently deleted."]})]}),e.jsxs(I,{children:[e.jsx(a,{variant:"outline",onClick:()=>u(null),children:"Cancel"}),e.jsx(a,{variant:"destructive",onClick:V,disabled:b.isPending,"data-testid":"trash-delete-forever-confirm",children:"Delete forever"})]})]})}),e.jsx(C,{open:z,onOpenChange:x,children:e.jsxs(w,{children:[e.jsxs(D,{children:[e.jsx(S,{children:"Empty the trash?"}),e.jsxs(E,{children:["Every item in"," ",c?`the "${c}" trash`:"the trash"," ","will be permanently deleted. This action cannot be undone."]})]}),e.jsxs(I,{children:[e.jsx(a,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),e.jsx(a,{variant:"destructive",onClick:q,disabled:T.isPending,"data-testid":"trash-empty-confirm",children:"Empty trash"})]})]})})]})}export{Ae as TrashPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-Bs3zYPPV.js";import{r as p}from"./react-vendor-C2CvUxFh.js";import{u as P,p as B,d as L,q as z,r as O,s as q,H as R,I as _,S as G,j as J,B as l,t as K,D as g,i as Q,T as V,k as D,l as v,m as A,n as C,o as N,v as n}from"./index-
|
|
1
|
+
import{j as e}from"./tanstack-Bs3zYPPV.js";import{r as p}from"./react-vendor-C2CvUxFh.js";import{u as P,p as B,d as L,q as z,r as O,s as q,H as R,I as _,S as G,j as J,B as l,t as K,D as g,i as Q,T as V,k as D,l as v,m as A,n as C,o as N,v as n}from"./index-CbEa9yyd.js";import{C as W}from"./checkbox-BO-Fusdb.js";import{T as X,a as Y,b as w,c as r,d as Z,e as c}from"./table-C3EQVw1z.js";import"./radix-C5ZmWuuL.js";function le(){const{user:S}=P(),{data:y,isLoading:T}=B(),{data:U}=L(),k=z(),u=O(),h=q(),m=y?.items??[],x=U?.superAdminIds??[],[j,F]=p.useState(""),[E,f]=p.useState(null),[d,o]=p.useState(null),b=j?m.filter(s=>s.email.toLowerCase().includes(j.toLowerCase())):m;async function M(s){try{await u.mutateAsync(s),n.success("User deleted"),f(null)}catch(a){n.error("Failed to delete user",{description:a instanceof Error?a.message:void 0})}}async function H(s){try{await h.mutateAsync(s),n.success("Two-factor authentication disabled"),o(null)}catch(a){n.error("Failed to disable 2FA",{description:a instanceof Error?a.message:void 0})}}async function I(s,a){const t=a?x.filter(i=>i!==s):[...x,s];if(t.length===0){n.error("At least one super admin is required");return}try{await k.mutateAsync({superAdminIds:t}),n.success(a?"Super admin removed":"Super admin added")}catch(i){n.error("Failed to update super admins",{description:i instanceof Error?i.message:void 0})}}return e.jsxs("div",{className:"flex h-dvh flex-col",children:[e.jsx(R,{}),e.jsxs("div",{className:"flex-1 p-8",children:[e.jsx("div",{className:"mb-6 flex items-center justify-between",children:e.jsx("h1",{className:"text-2xl font-semibold",children:"All Users"})}),e.jsx("div",{className:"mb-4",children:e.jsx(_,{placeholder:"Search by email...",value:j,onChange:s=>F(s.target.value),className:"max-w-sm"})}),T?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((s,a)=>e.jsx(G,{className:"h-12 w-full"},a))}):b.length===0?e.jsx("p",{className:"text-muted-foreground",children:"No users found."}):e.jsxs(X,{children:[e.jsx(Y,{children:e.jsxs(w,{children:[e.jsx(r,{children:"Email"}),e.jsx(r,{children:"Status"}),e.jsx(r,{children:"2FA"}),e.jsx(r,{children:"Super Admin"}),e.jsx(r,{})]})}),e.jsx(Z,{children:b.map(s=>{const a=s.sub===S?.sub,t=x.includes(s.sub);return e.jsxs(w,{children:[e.jsxs(c,{className:"text-sm",children:[s.email,a&&e.jsx("span",{className:"text-muted-foreground ml-2",children:"(you)"})]}),e.jsx(c,{className:"text-sm capitalize",children:s.status}),e.jsx(c,{children:s.mfaEnabled?e.jsx(J,{variant:"outline",className:"border-green-500 text-green-700",children:"Enabled"}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(c,{children:e.jsx(W,{checked:t,onCheckedChange:()=>I(s.sub,t)})}),e.jsx(c,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[!a&&s.mfaEnabled&&e.jsx(l,{variant:"ghost",size:"sm",title:"Disable 2FA",onClick:()=>o(s.sub),children:e.jsx(K,{className:"h-4 w-4"})}),!a&&e.jsxs(g,{open:E===s.sub,onOpenChange:i=>f(i?s.sub:null),children:[e.jsx(Q,{asChild:!0,children:e.jsx(l,{variant:"ghost",size:"sm",className:"text-destructive",title:"Delete account",children:e.jsx(V,{className:"h-4 w-4"})})}),e.jsxs(D,{children:[e.jsxs(v,{children:[e.jsx(A,{children:"Delete User Account"}),e.jsx(C,{className:"sr-only",children:"Confirm permanent deletion of this user account"})]}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:["This will permanently delete the account for"," ",e.jsx("strong",{children:s.email}),". They will lose access to all sites."]}),e.jsxs(N,{children:[e.jsx(l,{variant:"outline",onClick:()=>f(null),children:"Cancel"}),e.jsx(l,{variant:"destructive",onClick:()=>M(s.sub),disabled:u.isPending,children:u.isPending?"Deleting...":"Delete Account"})]})]})]})]})})]},s.sub)})})]}),e.jsx(g,{open:d!==null,onOpenChange:s=>{s||o(null)},children:e.jsxs(D,{children:[e.jsxs(v,{children:[e.jsx(A,{children:"Disable Two-Factor Authentication"}),e.jsxs(C,{children:["This will disable 2FA for"," ",e.jsx("strong",{children:m.find(s=>s.sub===d)?.email}),". They will be able to log in with just their password."]})]}),e.jsxs(N,{children:[e.jsx(l,{variant:"outline",onClick:()=>o(null),children:"Cancel"}),e.jsx(l,{variant:"destructive",onClick:()=>{d&&H(d)},disabled:h.isPending,children:h.isPending?"Disabling...":"Disable 2FA"})]})]})})]})]})}export{le as UsersPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./tanstack-Bs3zYPPV.js";import{u as R,f as U,r as d}from"./react-vendor-C2CvUxFh.js";import{a as K,b as M,c as q,d as V,e as Y,f as _}from"./useWebhooks-
|
|
1
|
+
import{j as e}from"./tanstack-Bs3zYPPV.js";import{u as R,f as U,r as d}from"./react-vendor-C2CvUxFh.js";import{a as K,b as M,c as q,d as V,e as Y,f as _}from"./useWebhooks-BgJL2-Ek.js";import{S as v,x as z,L as W,I as G,j as y,B as l,a as J,aK as Q,D as X,i as Z,T as ee,k as se,l as te,m as ae,n as ne,o as re,v as o}from"./index-CbEa9yyd.js";import{C as b,c as j,a as T,b as w}from"./card-CVAiqxnT.js";import{T as ie,a as oe,b as C,c as p,d as le,e as f}from"./table-C3EQVw1z.js";import{f as ce}from"./format-BRcflvs9.js";import{u as de}from"./usePageTitle-BJ2ARyuc.js";import"./radix-C5ZmWuuL.js";const he=["content.published","content.unpublished","content.deleted"];function ve(){const{host:t,id:a}=R(),n=a==="new",{data:i,isLoading:c}=K(t,n?"":a);return!n&&c?e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{className:"h-8 w-64"}),e.jsx(v,{className:"h-64 w-full"})]}):n?e.jsx(N,{host:t,isNew:!0}):i?e.jsx(N,{host:t,isNew:!1,webhook:i},i.webhookId):e.jsx("p",{className:"text-muted-foreground",children:"Webhook not found."})}function N({host:t,isNew:a,webhook:n}){const i=U(),c=M(t),h=q(t,n?.webhookId??""),D=V(t,n?.webhookId??""),S=Y(t,n?.webhookId??""),{data:u}=_(t,a?"":n?.webhookId??""),[m,E]=d.useState(n?.url??""),[x,I]=d.useState(n?.events??[]),[g,P]=d.useState(null),[B,k]=d.useState(!1),F=z();de({title:a?"New Webhook":"Edit Webhook",showBack:!0,backTo:`/sites/${t}/settings/webhooks`});function A(s){I(r=>r.includes(s)?r.filter($=>$!==s):[...r,s])}async function H(s){s.preventDefault();try{if(a){const r=await c.mutateAsync({url:m,events:x,enabled:!0});P(r.secret??null),o.success("Webhook created"),i(`/sites/${t}/settings/webhooks/${r.webhookId}`,{replace:!0})}else await h.mutateAsync({url:m,events:x,enabled:n?.enabled}),o.success("Webhook updated")}catch(r){o.error(a?"Failed to create":"Failed to update",{description:r instanceof Error?r.message:void 0})}}async function L(){try{await S.mutateAsync(),o.success("Test webhook sent")}catch(s){o.error("Test failed",{description:s instanceof Error?s.message:void 0})}}async function O(){try{await D.mutateAsync(),o.success("Webhook deleted"),i(`/sites/${t}/settings/webhooks`)}catch(s){o.error("Failed to delete",{description:s instanceof Error?s.message:void 0})}}return e.jsxs("div",{className:"mx-auto max-w-2xl space-y-6",children:[!F&&e.jsx("h1",{className:"text-2xl font-semibold",children:a?"New Webhook":"Edit Webhook"}),g&&e.jsx(b,{className:"border-yellow-500",children:e.jsxs(j,{className:"pt-6",children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:"Webhook Secret"}),e.jsx("p",{className:"text-muted-foreground mb-2 text-sm",children:"Save this secret now. You won't see it again."}),e.jsx("code",{className:"bg-muted rounded px-2 py-1 text-sm",children:g})]})}),e.jsxs(b,{children:[e.jsx(T,{children:e.jsx(w,{children:"Webhook Settings"})}),e.jsx(j,{children:e.jsxs("form",{onSubmit:H,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{htmlFor:"url",children:"URL"}),e.jsx(G,{id:"url",type:"url",value:m,onChange:s=>E(s.target.value),required:!0,placeholder:"https://example.com/webhook"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(W,{children:"Events"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:he.map(s=>e.jsx(y,{variant:x.includes(s)?"default":"outline",className:"cursor-pointer",onClick:()=>A(s),children:s},s))})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(l,{type:"submit",disabled:c.isPending||h.isPending,children:[(c.isPending||h.isPending)&&e.jsx(J,{className:"mr-2 h-4 w-4 animate-spin"}),a?"Create":"Save"]}),!a&&e.jsxs(l,{type:"button",variant:"outline",onClick:L,children:[e.jsx(Q,{className:"mr-2 h-4 w-4"}),"Test"]}),e.jsx(l,{type:"button",variant:"outline",onClick:()=>i(`/sites/${t}/settings/webhooks`),children:"Cancel"})]})]})})]}),!a&&u?.deliveries&&u.deliveries.length>0&&e.jsxs(b,{children:[e.jsx(T,{children:e.jsx(w,{children:"Recent Deliveries"})}),e.jsx(j,{children:e.jsxs(ie,{children:[e.jsx(oe,{children:e.jsxs(C,{children:[e.jsx(p,{children:"Event"}),e.jsx(p,{children:"Status"}),e.jsx(p,{children:"Time"})]})}),e.jsx(le,{children:u.deliveries.map(s=>e.jsxs(C,{children:[e.jsx(f,{children:s.event}),e.jsx(f,{children:e.jsx(y,{variant:s.status==="success"?"default":"destructive",children:s.responseStatus??"Error"})}),e.jsx(f,{className:"text-muted-foreground",children:ce(s.createdAt)})]},s.deliveryId))})]})})]}),!a&&e.jsxs(X,{open:B,onOpenChange:k,children:[e.jsx(Z,{asChild:!0,children:e.jsxs(l,{variant:"destructive",children:[e.jsx(ee,{className:"mr-2 h-4 w-4"}),"Delete Webhook"]})}),e.jsxs(se,{children:[e.jsxs(te,{children:[e.jsx(ae,{children:"Delete webhook?"}),e.jsx(ne,{children:"This action cannot be undone."})]}),e.jsxs(re,{children:[e.jsx(l,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),e.jsx(l,{variant:"destructive",onClick:O,children:"Delete"})]})]})]})]})}export{ve as WebhookEditPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./tanstack-Bs3zYPPV.js";import{u as j,f as b}from"./react-vendor-C2CvUxFh.js";import{u}from"./useWebhooks-
|
|
1
|
+
import{j as s}from"./tanstack-Bs3zYPPV.js";import{u as j,f as b}from"./react-vendor-C2CvUxFh.js";import{u}from"./useWebhooks-BgJL2-Ek.js";import{x as f,B as r,P as c,S as p,j as d}from"./index-CbEa9yyd.js";import{T as k,a as g,b as m,c as i,d as N,e as l}from"./table-C3EQVw1z.js";import{u as v}from"./usePageTitle-BJ2ARyuc.js";import"./radix-C5ZmWuuL.js";function I(){const{host:a}=j(),t=b(),{data:n,isLoading:x}=u(a),h=f();return v({title:"Webhooks",actions:s.jsx(r,{size:"sm",onClick:()=>t(`/sites/${a}/settings/webhooks/new`),children:s.jsx(c,{className:"h-4 w-4"})})}),s.jsxs("div",{children:[!h&&s.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Webhooks"}),s.jsxs(r,{onClick:()=>t(`/sites/${a}/settings/webhooks/new`),children:[s.jsx(c,{className:"mr-2 h-4 w-4"}),"New Webhook"]})]}),x?s.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((e,o)=>s.jsx(p,{className:"h-12 w-full"},o))}):n?.items.length?s.jsxs(k,{children:[s.jsx(g,{children:s.jsxs(m,{children:[s.jsx(i,{children:"URL"}),s.jsx(i,{children:"Events"}),s.jsx(i,{children:"Status"})]})}),s.jsx(N,{children:n.items.map(e=>s.jsxs(m,{className:"cursor-pointer",onClick:()=>t(`/sites/${a}/settings/webhooks/${e.webhookId}`),children:[s.jsx(l,{className:"max-w-xs truncate font-mono text-sm",children:e.url}),s.jsx(l,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:e.events.map(o=>s.jsx(d,{variant:"secondary",className:"text-xs",children:o},o))})}),s.jsx(l,{children:s.jsx(d,{variant:e.enabled?"default":"secondary",children:e.enabled?"Active":"Inactive"})})]},e.webhookId))})]}):s.jsx("p",{className:"text-muted-foreground",children:"No webhooks configured."})]})}export{I as WebhooksPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./tanstack-Bs3zYPPV.js";import"./react-vendor-C2CvUxFh.js";import{y as d}from"./index-
|
|
1
|
+
import{j as r}from"./tanstack-Bs3zYPPV.js";import"./react-vendor-C2CvUxFh.js";import{y as d}from"./index-CbEa9yyd.js";function n({className:a,...t}){return r.jsx("div",{"data-slot":"card",className:d("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...t})}function i({className:a,...t}){return r.jsx("div",{"data-slot":"card-header",className:d("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...t})}function c({className:a,...t}){return r.jsx("div",{"data-slot":"card-title",className:d("leading-none font-semibold",a),...t})}function l({className:a,...t}){return r.jsx("div",{"data-slot":"card-description",className:d("text-muted-foreground text-sm",a),...t})}function u({className:a,...t}){return r.jsx("div",{"data-slot":"card-content",className:d("px-6",a),...t})}export{n as C,i as a,c as b,u as c,l as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./tanstack-Bs3zYPPV.js";import"./react-vendor-C2CvUxFh.js";import{a4 as i,y as t}from"./index-
|
|
1
|
+
import{j as r}from"./tanstack-Bs3zYPPV.js";import"./react-vendor-C2CvUxFh.js";import{a4 as i,y as t}from"./index-CbEa9yyd.js";import{a1 as s,a2 as o}from"./radix-C5ZmWuuL.js";function b({className:e,...a}){return r.jsx(s,{"data-slot":"checkbox",className:t("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...a,children:r.jsx(o,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:r.jsx(i,{className:"size-3.5"})})})}export{b as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as C}from"./tanstack-Bs3zYPPV.js";import{r as l,b as Re}from"./react-vendor-C2CvUxFh.js";import{X as V,Y as L,h as Ae,m as je,O as $e,j as Pe}from"./radix-C5ZmWuuL.js";import{y as z,z as Me}from"./index-DC1UyCW2.js";var pe=1,Ne=.9,De=.8,Le=.17,te=.1,re=.999,Ve=.9999,_e=.99,Oe=/[\\\/_+.#"@\[\(\{&]/,Fe=/[\\\/_+.#"@\[\(\{&]/g,ze=/[\s-]/,he=/[\s-]/g;function le(e,r,t,u,a,o,s){if(o===r.length)return a===e.length?pe:_e;var f=`${a},${o}`;if(s[f]!==void 0)return s[f];for(var p=u.charAt(o),c=t.indexOf(p,a),v=0,h,k,w,I;c>=0;)h=le(e,r,t,u,c+1,o+1,s),h>v&&(c===a?h*=pe:Oe.test(e.charAt(c-1))?(h*=De,w=e.slice(a,c-1).match(Fe),w&&a>0&&(h*=Math.pow(re,w.length))):ze.test(e.charAt(c-1))?(h*=Ne,I=e.slice(a,c-1).match(he),I&&a>0&&(h*=Math.pow(re,I.length))):(h*=Le,a>0&&(h*=Math.pow(re,c-a))),e.charAt(c)!==r.charAt(o)&&(h*=Ve)),(h<te&&t.charAt(c-1)===u.charAt(o+1)||u.charAt(o+1)===u.charAt(o)&&t.charAt(c-1)!==u.charAt(o))&&(k=le(e,r,t,u,c+1,o+2,s),k*te>h&&(h=k*te)),h>v&&(v=h),c=t.indexOf(p,c+1);return s[f]=v,v}function ve(e){return e.toLowerCase().replace(he," ")}function Ke(e,r,t){return e=t&&t.length>0?`${e+" "+t.join(" ")}`:e,le(e,r,ve(e),ve(r),0,0,{})}var qe=Symbol.for("react.lazy"),W=Re[" use ".trim().toString()];function Te(e){return typeof e=="object"&&e!==null&&"then"in e}function be(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===qe&&"_payload"in e&&Te(e._payload)}function ye(e){const r=We(e),t=l.forwardRef((u,a)=>{let{children:o,...s}=u;be(o)&&typeof W=="function"&&(o=W(o._payload));const f=l.Children.toArray(o),p=f.find(He);if(p){const c=p.props.children,v=f.map(h=>h===p?l.Children.count(c)>1?l.Children.only(null):l.isValidElement(c)?c.props.children:null:h);return C.jsx(r,{...s,ref:a,children:l.isValidElement(c)?l.cloneElement(c,void 0,v):null})}return C.jsx(r,{...s,ref:a,children:o})});return t.displayName=`${e}.Slot`,t}var vt=ye("Slot");function We(e){const r=l.forwardRef((t,u)=>{let{children:a,...o}=t;if(be(a)&&typeof W=="function"&&(a=W(a._payload)),l.isValidElement(a)){const s=Ge(a),f=Ye(o,a.props);return a.type!==l.Fragment&&(f.ref=u?V(u,s):s),l.cloneElement(a,f)}return l.Children.count(a)>1?l.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}var Be=Symbol("radix.slottable");function He(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Be}function Ye(e,r){const t={...r};for(const u in r){const a=e[u],o=r[u];/^on[A-Z]/.test(u)?a&&o?t[u]=(...f)=>{const p=o(...f);return a(...f),p}:a&&(t[u]=a):u==="style"?t[u]={...a,...o}:u==="className"&&(t[u]=[a,o].filter(Boolean).join(" "))}return{...e,...t}}function Ge(e){let r=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=r&&"isReactWarning"in r&&r.isReactWarning;return t?e.ref:(r=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=r&&"isReactWarning"in r&&r.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var Ue=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],A=Ue.reduce((e,r)=>{const t=ye(`Primitive.${r}`),u=l.forwardRef((a,o)=>{const{asChild:s,...f}=a,p=s?t:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(p,{...f,ref:o})});return u.displayName=`Primitive.${r}`,{...e,[r]:u}},{}),F='[cmdk-group=""]',ne='[cmdk-group-items=""]',Xe='[cmdk-group-heading=""]',xe='[cmdk-item=""]',ge=`${xe}:not([aria-disabled="true"])`,ae="cmdk-item-select",N="data-value",Ze=(e,r,t)=>Ke(e,r,t),we=l.createContext(void 0),K=()=>l.useContext(we),Ee=l.createContext(void 0),oe=()=>l.useContext(Ee),Se=l.createContext(void 0),ke=l.forwardRef((e,r)=>{let t=D(()=>{var n,d;return{search:"",value:(d=(n=e.value)!=null?n:e.defaultValue)!=null?d:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),u=D(()=>new Set),a=D(()=>new Map),o=D(()=>new Map),s=D(()=>new Set),f=Ce(e),{label:p,children:c,value:v,onValueChange:h,filter:k,shouldFilter:w,loop:I,disablePointerSelection:H=!1,vimBindings:j=!0,...q}=e,Y=L(),ie=L(),G=L(),$=l.useRef(null),y=ut();P(()=>{if(v!==void 0){let n=v.trim();t.current.value=n,E.emit()}},[v]),P(()=>{y(6,ce)},[]);let E=l.useMemo(()=>({subscribe:n=>(s.current.add(n),()=>s.current.delete(n)),snapshot:()=>t.current,setState:(n,d,m)=>{var i,g,b,S;if(!Object.is(t.current[n],d)){if(t.current[n]=d,n==="search")J(),X(),y(1,Z);else if(n==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let x=document.getElementById(G);x?x.focus():(i=document.getElementById(Y))==null||i.focus()}if(y(7,()=>{var x;t.current.selectedItemId=(x=M())==null?void 0:x.id,E.emit()}),m||y(5,ce),((g=f.current)==null?void 0:g.value)!==void 0){let x=d??"";(S=(b=f.current).onValueChange)==null||S.call(b,x);return}}E.emit()}},emit:()=>{s.current.forEach(n=>n())}}),[]),U=l.useMemo(()=>({value:(n,d,m)=>{var i;d!==((i=o.current.get(n))==null?void 0:i.value)&&(o.current.set(n,{value:d,keywords:m}),t.current.filtered.items.set(n,ue(d,m)),y(2,()=>{X(),E.emit()}))},item:(n,d)=>(u.current.add(n),d&&(a.current.has(d)?a.current.get(d).add(n):a.current.set(d,new Set([n]))),y(3,()=>{J(),X(),t.current.value||Z(),E.emit()}),()=>{o.current.delete(n),u.current.delete(n),t.current.filtered.items.delete(n);let m=M();y(4,()=>{J(),m?.getAttribute("id")===n&&Z(),E.emit()})}),group:n=>(a.current.has(n)||a.current.set(n,new Set),()=>{o.current.delete(n),a.current.delete(n)}),filter:()=>f.current.shouldFilter,label:p||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:Y,inputId:G,labelId:ie,listInnerRef:$}),[]);function ue(n,d){var m,i;let g=(i=(m=f.current)==null?void 0:m.filter)!=null?i:Ze;return n?g(n,t.current.search,d):0}function X(){if(!t.current.search||f.current.shouldFilter===!1)return;let n=t.current.filtered.items,d=[];t.current.filtered.groups.forEach(i=>{let g=a.current.get(i),b=0;g.forEach(S=>{let x=n.get(S);b=Math.max(x,b)}),d.push([i,b])});let m=$.current;O().sort((i,g)=>{var b,S;let x=i.getAttribute("id"),T=g.getAttribute("id");return((b=n.get(T))!=null?b:0)-((S=n.get(x))!=null?S:0)}).forEach(i=>{let g=i.closest(ne);g?g.appendChild(i.parentElement===g?i:i.closest(`${ne} > *`)):m.appendChild(i.parentElement===m?i:i.closest(`${ne} > *`))}),d.sort((i,g)=>g[1]-i[1]).forEach(i=>{var g;let b=(g=$.current)==null?void 0:g.querySelector(`${F}[${N}="${encodeURIComponent(i[0])}"]`);b?.parentElement.appendChild(b)})}function Z(){let n=O().find(m=>m.getAttribute("aria-disabled")!=="true"),d=n?.getAttribute(N);E.setState("value",d||void 0)}function J(){var n,d,m,i;if(!t.current.search||f.current.shouldFilter===!1){t.current.filtered.count=u.current.size;return}t.current.filtered.groups=new Set;let g=0;for(let b of u.current){let S=(d=(n=o.current.get(b))==null?void 0:n.value)!=null?d:"",x=(i=(m=o.current.get(b))==null?void 0:m.keywords)!=null?i:[],T=ue(S,x);t.current.filtered.items.set(b,T),T>0&&g++}for(let[b,S]of a.current)for(let x of S)if(t.current.filtered.items.get(x)>0){t.current.filtered.groups.add(b);break}t.current.filtered.count=g}function ce(){var n,d,m;let i=M();i&&(((n=i.parentElement)==null?void 0:n.firstChild)===i&&((m=(d=i.closest(F))==null?void 0:d.querySelector(Xe))==null||m.scrollIntoView({block:"nearest"})),i.scrollIntoView({block:"nearest"}))}function M(){var n;return(n=$.current)==null?void 0:n.querySelector(`${xe}[aria-selected="true"]`)}function O(){var n;return Array.from(((n=$.current)==null?void 0:n.querySelectorAll(ge))||[])}function Q(n){let d=O()[n];d&&E.setState("value",d.getAttribute(N))}function ee(n){var d;let m=M(),i=O(),g=i.findIndex(S=>S===m),b=i[g+n];(d=f.current)!=null&&d.loop&&(b=g+n<0?i[i.length-1]:g+n===i.length?i[0]:i[g+n]),b&&E.setState("value",b.getAttribute(N))}function se(n){let d=M(),m=d?.closest(F),i;for(;m&&!i;)m=n>0?ot(m,F):it(m,F),i=m?.querySelector(ge);i?E.setState("value",i.getAttribute(N)):ee(n)}let de=()=>Q(O().length-1),fe=n=>{n.preventDefault(),n.metaKey?de():n.altKey?se(1):ee(1)},me=n=>{n.preventDefault(),n.metaKey?Q(0):n.altKey?se(-1):ee(-1)};return l.createElement(A.div,{ref:r,tabIndex:-1,...q,"cmdk-root":"",onKeyDown:n=>{var d;(d=q.onKeyDown)==null||d.call(q,n);let m=n.nativeEvent.isComposing||n.keyCode===229;if(!(n.defaultPrevented||m))switch(n.key){case"n":case"j":{j&&n.ctrlKey&&fe(n);break}case"ArrowDown":{fe(n);break}case"p":case"k":{j&&n.ctrlKey&&me(n);break}case"ArrowUp":{me(n);break}case"Home":{n.preventDefault(),Q(0);break}case"End":{n.preventDefault(),de();break}case"Enter":{n.preventDefault();let i=M();if(i){let g=new Event(ae);i.dispatchEvent(g)}}}}},l.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:st},p),B(e,n=>l.createElement(Ee.Provider,{value:E},l.createElement(we.Provider,{value:U},n))))}),Je=l.forwardRef((e,r)=>{var t,u;let a=L(),o=l.useRef(null),s=l.useContext(Se),f=K(),p=Ce(e),c=(u=(t=p.current)==null?void 0:t.forceMount)!=null?u:s?.forceMount;P(()=>{if(!c)return f.item(a,s?.id)},[c]);let v=Ie(a,o,[e.value,e.children,o],e.keywords),h=oe(),k=R(y=>y.value&&y.value===v.current),w=R(y=>c||f.filter()===!1?!0:y.search?y.filtered.items.get(a)>0:!0);l.useEffect(()=>{let y=o.current;if(!(!y||e.disabled))return y.addEventListener(ae,I),()=>y.removeEventListener(ae,I)},[w,e.onSelect,e.disabled]);function I(){var y,E;H(),(E=(y=p.current).onSelect)==null||E.call(y,v.current)}function H(){h.setState("value",v.current,!0)}if(!w)return null;let{disabled:j,value:q,onSelect:Y,forceMount:ie,keywords:G,...$}=e;return l.createElement(A.div,{ref:V(o,r),...$,id:a,"cmdk-item":"",role:"option","aria-disabled":!!j,"aria-selected":!!k,"data-disabled":!!j,"data-selected":!!k,onPointerMove:j||f.getDisablePointerSelection()?void 0:H,onClick:j?void 0:I},e.children)}),Qe=l.forwardRef((e,r)=>{let{heading:t,children:u,forceMount:a,...o}=e,s=L(),f=l.useRef(null),p=l.useRef(null),c=L(),v=K(),h=R(w=>a||v.filter()===!1?!0:w.search?w.filtered.groups.has(s):!0);P(()=>v.group(s),[]),Ie(s,f,[e.value,e.heading,p]);let k=l.useMemo(()=>({id:s,forceMount:a}),[a]);return l.createElement(A.div,{ref:V(f,r),...o,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},t&&l.createElement("div",{ref:p,"cmdk-group-heading":"","aria-hidden":!0,id:c},t),B(e,w=>l.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":t?c:void 0},l.createElement(Se.Provider,{value:k},w))))}),et=l.forwardRef((e,r)=>{let{alwaysRender:t,...u}=e,a=l.useRef(null),o=R(s=>!s.search);return!t&&!o?null:l.createElement(A.div,{ref:V(a,r),...u,"cmdk-separator":"",role:"separator"})}),tt=l.forwardRef((e,r)=>{let{onValueChange:t,...u}=e,a=e.value!=null,o=oe(),s=R(c=>c.search),f=R(c=>c.selectedItemId),p=K();return l.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),l.createElement(A.input,{ref:r,...u,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":p.listId,"aria-labelledby":p.labelId,"aria-activedescendant":f,id:p.inputId,type:"text",value:a?e.value:s,onChange:c=>{a||o.setState("search",c.target.value),t?.(c.target.value)}})}),rt=l.forwardRef((e,r)=>{let{children:t,label:u="Suggestions",...a}=e,o=l.useRef(null),s=l.useRef(null),f=R(c=>c.selectedItemId),p=K();return l.useEffect(()=>{if(s.current&&o.current){let c=s.current,v=o.current,h,k=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let w=c.offsetHeight;v.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return k.observe(c),()=>{cancelAnimationFrame(h),k.unobserve(c)}}},[]),l.createElement(A.div,{ref:V(o,r),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":u,id:p.listId},B(e,c=>l.createElement("div",{ref:V(s,p.listInnerRef),"cmdk-list-sizer":""},c)))}),nt=l.forwardRef((e,r)=>{let{open:t,onOpenChange:u,overlayClassName:a,contentClassName:o,container:s,...f}=e;return l.createElement(Ae,{open:t,onOpenChange:u},l.createElement(je,{container:s},l.createElement($e,{"cmdk-overlay":"",className:a}),l.createElement(Pe,{"aria-label":e.label,"cmdk-dialog":"",className:o},l.createElement(ke,{ref:r,...f}))))}),lt=l.forwardRef((e,r)=>R(t=>t.filtered.count===0)?l.createElement(A.div,{ref:r,...e,"cmdk-empty":"",role:"presentation"}):null),at=l.forwardRef((e,r)=>{let{progress:t,children:u,label:a="Loading...",...o}=e;return l.createElement(A.div,{ref:r,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},B(e,s=>l.createElement("div",{"aria-hidden":!0},s)))}),_=Object.assign(ke,{List:rt,Item:Je,Input:tt,Group:Qe,Separator:et,Dialog:nt,Empty:lt,Loading:at});function ot(e,r){let t=e.nextElementSibling;for(;t;){if(t.matches(r))return t;t=t.nextElementSibling}}function it(e,r){let t=e.previousElementSibling;for(;t;){if(t.matches(r))return t;t=t.previousElementSibling}}function Ce(e){let r=l.useRef(e);return P(()=>{r.current=e}),r}var P=typeof window>"u"?l.useEffect:l.useLayoutEffect;function D(e){let r=l.useRef();return r.current===void 0&&(r.current=e()),r}function R(e){let r=oe(),t=()=>e(r.snapshot());return l.useSyncExternalStore(r.subscribe,t,t)}function Ie(e,r,t,u=[]){let a=l.useRef(),o=K();return P(()=>{var s;let f=(()=>{var c;for(let v of t){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(c=v.current.textContent)==null?void 0:c.trim():a.current}})(),p=u.map(c=>c.trim());o.value(e,f,p),(s=r.current)==null||s.setAttribute(N,f),a.current=f}),a}var ut=()=>{let[e,r]=l.useState(),t=D(()=>new Map);return P(()=>{t.current.forEach(u=>u()),t.current=new Map},[e]),(u,a)=>{t.current.set(u,a),r({})}};function ct(e){let r=e.type;return typeof r=="function"?r(e.props):"render"in r?r.render(e.props):e}function B({asChild:e,children:r},t){return e&&l.isValidElement(r)?l.cloneElement(ct(r),{ref:r.ref},t(r.props.children)):t(r)}var st={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function gt({className:e,...r}){return C.jsx(_,{"data-slot":"command",className:z("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...r})}function ht({className:e,...r}){return C.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[C.jsx(Me,{className:"size-4 shrink-0 opacity-50"}),C.jsx(_.Input,{"data-slot":"command-input",className:z("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})}function bt({className:e,...r}){return C.jsx(_.List,{"data-slot":"command-list",className:z("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...r})}function yt({...e}){return C.jsx(_.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function xt({className:e,...r}){return C.jsx(_.Group,{"data-slot":"command-group",className:z("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...r})}function wt({className:e,...r}){return C.jsx(_.Item,{"data-slot":"command-item",className:z("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}export{gt as C,A as P,vt as S,ht as a,bt as b,yt as c,xt as d,wt as e};
|
|
1
|
+
import{j as C}from"./tanstack-Bs3zYPPV.js";import{r as l,b as Re}from"./react-vendor-C2CvUxFh.js";import{X as V,Y as L,h as Ae,m as je,O as $e,j as Pe}from"./radix-C5ZmWuuL.js";import{y as z,z as Me}from"./index-CbEa9yyd.js";var pe=1,Ne=.9,De=.8,Le=.17,te=.1,re=.999,Ve=.9999,_e=.99,Oe=/[\\\/_+.#"@\[\(\{&]/,Fe=/[\\\/_+.#"@\[\(\{&]/g,ze=/[\s-]/,he=/[\s-]/g;function le(e,r,t,u,a,o,s){if(o===r.length)return a===e.length?pe:_e;var f=`${a},${o}`;if(s[f]!==void 0)return s[f];for(var p=u.charAt(o),c=t.indexOf(p,a),v=0,h,k,w,I;c>=0;)h=le(e,r,t,u,c+1,o+1,s),h>v&&(c===a?h*=pe:Oe.test(e.charAt(c-1))?(h*=De,w=e.slice(a,c-1).match(Fe),w&&a>0&&(h*=Math.pow(re,w.length))):ze.test(e.charAt(c-1))?(h*=Ne,I=e.slice(a,c-1).match(he),I&&a>0&&(h*=Math.pow(re,I.length))):(h*=Le,a>0&&(h*=Math.pow(re,c-a))),e.charAt(c)!==r.charAt(o)&&(h*=Ve)),(h<te&&t.charAt(c-1)===u.charAt(o+1)||u.charAt(o+1)===u.charAt(o)&&t.charAt(c-1)!==u.charAt(o))&&(k=le(e,r,t,u,c+1,o+2,s),k*te>h&&(h=k*te)),h>v&&(v=h),c=t.indexOf(p,c+1);return s[f]=v,v}function ve(e){return e.toLowerCase().replace(he," ")}function Ke(e,r,t){return e=t&&t.length>0?`${e+" "+t.join(" ")}`:e,le(e,r,ve(e),ve(r),0,0,{})}var qe=Symbol.for("react.lazy"),W=Re[" use ".trim().toString()];function Te(e){return typeof e=="object"&&e!==null&&"then"in e}function be(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===qe&&"_payload"in e&&Te(e._payload)}function ye(e){const r=We(e),t=l.forwardRef((u,a)=>{let{children:o,...s}=u;be(o)&&typeof W=="function"&&(o=W(o._payload));const f=l.Children.toArray(o),p=f.find(He);if(p){const c=p.props.children,v=f.map(h=>h===p?l.Children.count(c)>1?l.Children.only(null):l.isValidElement(c)?c.props.children:null:h);return C.jsx(r,{...s,ref:a,children:l.isValidElement(c)?l.cloneElement(c,void 0,v):null})}return C.jsx(r,{...s,ref:a,children:o})});return t.displayName=`${e}.Slot`,t}var vt=ye("Slot");function We(e){const r=l.forwardRef((t,u)=>{let{children:a,...o}=t;if(be(a)&&typeof W=="function"&&(a=W(a._payload)),l.isValidElement(a)){const s=Ge(a),f=Ye(o,a.props);return a.type!==l.Fragment&&(f.ref=u?V(u,s):s),l.cloneElement(a,f)}return l.Children.count(a)>1?l.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}var Be=Symbol("radix.slottable");function He(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Be}function Ye(e,r){const t={...r};for(const u in r){const a=e[u],o=r[u];/^on[A-Z]/.test(u)?a&&o?t[u]=(...f)=>{const p=o(...f);return a(...f),p}:a&&(t[u]=a):u==="style"?t[u]={...a,...o}:u==="className"&&(t[u]=[a,o].filter(Boolean).join(" "))}return{...e,...t}}function Ge(e){let r=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=r&&"isReactWarning"in r&&r.isReactWarning;return t?e.ref:(r=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=r&&"isReactWarning"in r&&r.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var Ue=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],A=Ue.reduce((e,r)=>{const t=ye(`Primitive.${r}`),u=l.forwardRef((a,o)=>{const{asChild:s,...f}=a,p=s?t:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(p,{...f,ref:o})});return u.displayName=`Primitive.${r}`,{...e,[r]:u}},{}),F='[cmdk-group=""]',ne='[cmdk-group-items=""]',Xe='[cmdk-group-heading=""]',xe='[cmdk-item=""]',ge=`${xe}:not([aria-disabled="true"])`,ae="cmdk-item-select",N="data-value",Ze=(e,r,t)=>Ke(e,r,t),we=l.createContext(void 0),K=()=>l.useContext(we),Ee=l.createContext(void 0),oe=()=>l.useContext(Ee),Se=l.createContext(void 0),ke=l.forwardRef((e,r)=>{let t=D(()=>{var n,d;return{search:"",value:(d=(n=e.value)!=null?n:e.defaultValue)!=null?d:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),u=D(()=>new Set),a=D(()=>new Map),o=D(()=>new Map),s=D(()=>new Set),f=Ce(e),{label:p,children:c,value:v,onValueChange:h,filter:k,shouldFilter:w,loop:I,disablePointerSelection:H=!1,vimBindings:j=!0,...q}=e,Y=L(),ie=L(),G=L(),$=l.useRef(null),y=ut();P(()=>{if(v!==void 0){let n=v.trim();t.current.value=n,E.emit()}},[v]),P(()=>{y(6,ce)},[]);let E=l.useMemo(()=>({subscribe:n=>(s.current.add(n),()=>s.current.delete(n)),snapshot:()=>t.current,setState:(n,d,m)=>{var i,g,b,S;if(!Object.is(t.current[n],d)){if(t.current[n]=d,n==="search")J(),X(),y(1,Z);else if(n==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let x=document.getElementById(G);x?x.focus():(i=document.getElementById(Y))==null||i.focus()}if(y(7,()=>{var x;t.current.selectedItemId=(x=M())==null?void 0:x.id,E.emit()}),m||y(5,ce),((g=f.current)==null?void 0:g.value)!==void 0){let x=d??"";(S=(b=f.current).onValueChange)==null||S.call(b,x);return}}E.emit()}},emit:()=>{s.current.forEach(n=>n())}}),[]),U=l.useMemo(()=>({value:(n,d,m)=>{var i;d!==((i=o.current.get(n))==null?void 0:i.value)&&(o.current.set(n,{value:d,keywords:m}),t.current.filtered.items.set(n,ue(d,m)),y(2,()=>{X(),E.emit()}))},item:(n,d)=>(u.current.add(n),d&&(a.current.has(d)?a.current.get(d).add(n):a.current.set(d,new Set([n]))),y(3,()=>{J(),X(),t.current.value||Z(),E.emit()}),()=>{o.current.delete(n),u.current.delete(n),t.current.filtered.items.delete(n);let m=M();y(4,()=>{J(),m?.getAttribute("id")===n&&Z(),E.emit()})}),group:n=>(a.current.has(n)||a.current.set(n,new Set),()=>{o.current.delete(n),a.current.delete(n)}),filter:()=>f.current.shouldFilter,label:p||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:Y,inputId:G,labelId:ie,listInnerRef:$}),[]);function ue(n,d){var m,i;let g=(i=(m=f.current)==null?void 0:m.filter)!=null?i:Ze;return n?g(n,t.current.search,d):0}function X(){if(!t.current.search||f.current.shouldFilter===!1)return;let n=t.current.filtered.items,d=[];t.current.filtered.groups.forEach(i=>{let g=a.current.get(i),b=0;g.forEach(S=>{let x=n.get(S);b=Math.max(x,b)}),d.push([i,b])});let m=$.current;O().sort((i,g)=>{var b,S;let x=i.getAttribute("id"),T=g.getAttribute("id");return((b=n.get(T))!=null?b:0)-((S=n.get(x))!=null?S:0)}).forEach(i=>{let g=i.closest(ne);g?g.appendChild(i.parentElement===g?i:i.closest(`${ne} > *`)):m.appendChild(i.parentElement===m?i:i.closest(`${ne} > *`))}),d.sort((i,g)=>g[1]-i[1]).forEach(i=>{var g;let b=(g=$.current)==null?void 0:g.querySelector(`${F}[${N}="${encodeURIComponent(i[0])}"]`);b?.parentElement.appendChild(b)})}function Z(){let n=O().find(m=>m.getAttribute("aria-disabled")!=="true"),d=n?.getAttribute(N);E.setState("value",d||void 0)}function J(){var n,d,m,i;if(!t.current.search||f.current.shouldFilter===!1){t.current.filtered.count=u.current.size;return}t.current.filtered.groups=new Set;let g=0;for(let b of u.current){let S=(d=(n=o.current.get(b))==null?void 0:n.value)!=null?d:"",x=(i=(m=o.current.get(b))==null?void 0:m.keywords)!=null?i:[],T=ue(S,x);t.current.filtered.items.set(b,T),T>0&&g++}for(let[b,S]of a.current)for(let x of S)if(t.current.filtered.items.get(x)>0){t.current.filtered.groups.add(b);break}t.current.filtered.count=g}function ce(){var n,d,m;let i=M();i&&(((n=i.parentElement)==null?void 0:n.firstChild)===i&&((m=(d=i.closest(F))==null?void 0:d.querySelector(Xe))==null||m.scrollIntoView({block:"nearest"})),i.scrollIntoView({block:"nearest"}))}function M(){var n;return(n=$.current)==null?void 0:n.querySelector(`${xe}[aria-selected="true"]`)}function O(){var n;return Array.from(((n=$.current)==null?void 0:n.querySelectorAll(ge))||[])}function Q(n){let d=O()[n];d&&E.setState("value",d.getAttribute(N))}function ee(n){var d;let m=M(),i=O(),g=i.findIndex(S=>S===m),b=i[g+n];(d=f.current)!=null&&d.loop&&(b=g+n<0?i[i.length-1]:g+n===i.length?i[0]:i[g+n]),b&&E.setState("value",b.getAttribute(N))}function se(n){let d=M(),m=d?.closest(F),i;for(;m&&!i;)m=n>0?ot(m,F):it(m,F),i=m?.querySelector(ge);i?E.setState("value",i.getAttribute(N)):ee(n)}let de=()=>Q(O().length-1),fe=n=>{n.preventDefault(),n.metaKey?de():n.altKey?se(1):ee(1)},me=n=>{n.preventDefault(),n.metaKey?Q(0):n.altKey?se(-1):ee(-1)};return l.createElement(A.div,{ref:r,tabIndex:-1,...q,"cmdk-root":"",onKeyDown:n=>{var d;(d=q.onKeyDown)==null||d.call(q,n);let m=n.nativeEvent.isComposing||n.keyCode===229;if(!(n.defaultPrevented||m))switch(n.key){case"n":case"j":{j&&n.ctrlKey&&fe(n);break}case"ArrowDown":{fe(n);break}case"p":case"k":{j&&n.ctrlKey&&me(n);break}case"ArrowUp":{me(n);break}case"Home":{n.preventDefault(),Q(0);break}case"End":{n.preventDefault(),de();break}case"Enter":{n.preventDefault();let i=M();if(i){let g=new Event(ae);i.dispatchEvent(g)}}}}},l.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:st},p),B(e,n=>l.createElement(Ee.Provider,{value:E},l.createElement(we.Provider,{value:U},n))))}),Je=l.forwardRef((e,r)=>{var t,u;let a=L(),o=l.useRef(null),s=l.useContext(Se),f=K(),p=Ce(e),c=(u=(t=p.current)==null?void 0:t.forceMount)!=null?u:s?.forceMount;P(()=>{if(!c)return f.item(a,s?.id)},[c]);let v=Ie(a,o,[e.value,e.children,o],e.keywords),h=oe(),k=R(y=>y.value&&y.value===v.current),w=R(y=>c||f.filter()===!1?!0:y.search?y.filtered.items.get(a)>0:!0);l.useEffect(()=>{let y=o.current;if(!(!y||e.disabled))return y.addEventListener(ae,I),()=>y.removeEventListener(ae,I)},[w,e.onSelect,e.disabled]);function I(){var y,E;H(),(E=(y=p.current).onSelect)==null||E.call(y,v.current)}function H(){h.setState("value",v.current,!0)}if(!w)return null;let{disabled:j,value:q,onSelect:Y,forceMount:ie,keywords:G,...$}=e;return l.createElement(A.div,{ref:V(o,r),...$,id:a,"cmdk-item":"",role:"option","aria-disabled":!!j,"aria-selected":!!k,"data-disabled":!!j,"data-selected":!!k,onPointerMove:j||f.getDisablePointerSelection()?void 0:H,onClick:j?void 0:I},e.children)}),Qe=l.forwardRef((e,r)=>{let{heading:t,children:u,forceMount:a,...o}=e,s=L(),f=l.useRef(null),p=l.useRef(null),c=L(),v=K(),h=R(w=>a||v.filter()===!1?!0:w.search?w.filtered.groups.has(s):!0);P(()=>v.group(s),[]),Ie(s,f,[e.value,e.heading,p]);let k=l.useMemo(()=>({id:s,forceMount:a}),[a]);return l.createElement(A.div,{ref:V(f,r),...o,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},t&&l.createElement("div",{ref:p,"cmdk-group-heading":"","aria-hidden":!0,id:c},t),B(e,w=>l.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":t?c:void 0},l.createElement(Se.Provider,{value:k},w))))}),et=l.forwardRef((e,r)=>{let{alwaysRender:t,...u}=e,a=l.useRef(null),o=R(s=>!s.search);return!t&&!o?null:l.createElement(A.div,{ref:V(a,r),...u,"cmdk-separator":"",role:"separator"})}),tt=l.forwardRef((e,r)=>{let{onValueChange:t,...u}=e,a=e.value!=null,o=oe(),s=R(c=>c.search),f=R(c=>c.selectedItemId),p=K();return l.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),l.createElement(A.input,{ref:r,...u,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":p.listId,"aria-labelledby":p.labelId,"aria-activedescendant":f,id:p.inputId,type:"text",value:a?e.value:s,onChange:c=>{a||o.setState("search",c.target.value),t?.(c.target.value)}})}),rt=l.forwardRef((e,r)=>{let{children:t,label:u="Suggestions",...a}=e,o=l.useRef(null),s=l.useRef(null),f=R(c=>c.selectedItemId),p=K();return l.useEffect(()=>{if(s.current&&o.current){let c=s.current,v=o.current,h,k=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let w=c.offsetHeight;v.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return k.observe(c),()=>{cancelAnimationFrame(h),k.unobserve(c)}}},[]),l.createElement(A.div,{ref:V(o,r),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":u,id:p.listId},B(e,c=>l.createElement("div",{ref:V(s,p.listInnerRef),"cmdk-list-sizer":""},c)))}),nt=l.forwardRef((e,r)=>{let{open:t,onOpenChange:u,overlayClassName:a,contentClassName:o,container:s,...f}=e;return l.createElement(Ae,{open:t,onOpenChange:u},l.createElement(je,{container:s},l.createElement($e,{"cmdk-overlay":"",className:a}),l.createElement(Pe,{"aria-label":e.label,"cmdk-dialog":"",className:o},l.createElement(ke,{ref:r,...f}))))}),lt=l.forwardRef((e,r)=>R(t=>t.filtered.count===0)?l.createElement(A.div,{ref:r,...e,"cmdk-empty":"",role:"presentation"}):null),at=l.forwardRef((e,r)=>{let{progress:t,children:u,label:a="Loading...",...o}=e;return l.createElement(A.div,{ref:r,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},B(e,s=>l.createElement("div",{"aria-hidden":!0},s)))}),_=Object.assign(ke,{List:rt,Item:Je,Input:tt,Group:Qe,Separator:et,Dialog:nt,Empty:lt,Loading:at});function ot(e,r){let t=e.nextElementSibling;for(;t;){if(t.matches(r))return t;t=t.nextElementSibling}}function it(e,r){let t=e.previousElementSibling;for(;t;){if(t.matches(r))return t;t=t.previousElementSibling}}function Ce(e){let r=l.useRef(e);return P(()=>{r.current=e}),r}var P=typeof window>"u"?l.useEffect:l.useLayoutEffect;function D(e){let r=l.useRef();return r.current===void 0&&(r.current=e()),r}function R(e){let r=oe(),t=()=>e(r.snapshot());return l.useSyncExternalStore(r.subscribe,t,t)}function Ie(e,r,t,u=[]){let a=l.useRef(),o=K();return P(()=>{var s;let f=(()=>{var c;for(let v of t){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(c=v.current.textContent)==null?void 0:c.trim():a.current}})(),p=u.map(c=>c.trim());o.value(e,f,p),(s=r.current)==null||s.setAttribute(N,f),a.current=f}),a}var ut=()=>{let[e,r]=l.useState(),t=D(()=>new Map);return P(()=>{t.current.forEach(u=>u()),t.current=new Map},[e]),(u,a)=>{t.current.set(u,a),r({})}};function ct(e){let r=e.type;return typeof r=="function"?r(e.props):"render"in r?r.render(e.props):e}function B({asChild:e,children:r},t){return e&&l.isValidElement(r)?l.cloneElement(ct(r),{ref:r.ref},t(r.props.children)):t(r)}var st={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function gt({className:e,...r}){return C.jsx(_,{"data-slot":"command",className:z("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...r})}function ht({className:e,...r}){return C.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[C.jsx(Me,{className:"size-4 shrink-0 opacity-50"}),C.jsx(_.Input,{"data-slot":"command-input",className:z("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})}function bt({className:e,...r}){return C.jsx(_.List,{"data-slot":"command-list",className:z("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...r})}function yt({...e}){return C.jsx(_.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function xt({className:e,...r}){return C.jsx(_.Group,{"data-slot":"command-group",className:z("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...r})}function wt({className:e,...r}){return C.jsx(_.Item,{"data-slot":"command-item",className:z("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}export{gt as C,A as P,vt as S,ht as a,bt as b,yt as c,xt as d,wt as e};
|