@isardsat/editorial-admin 6.18.2 → 6.19.1
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/build/client/assets/{dashboard-DOB6LY1b.js → dashboard-Dpm8zjXn.js} +1 -1
- package/build/client/assets/dashboard._collection-WrdG5htb.js +1 -0
- package/build/client/assets/dashboard._collection._document-jlBNC0sw.js +1 -0
- package/build/client/assets/dashboard._collection.new-BGBlbXgX.js +1 -0
- package/build/client/assets/dashboard._layout-BVHPyiAo.js +1 -0
- package/build/client/assets/itemForm-D65KUxgZ.js +2 -0
- package/build/client/assets/{manifest-6f70b5eb.js → manifest-a5f7d74e.js} +1 -1
- package/build/client/assets/{markdownEditor-DfaF8kYY.js → markdownEditor-Wu371MZi.js} +2 -2
- package/build/client/assets/{schemas-CsWpUuhN.js → schemas-MhAKMGOb.js} +1 -1
- package/build/client/index.html +1 -1
- package/package.json +2 -2
- package/build/client/assets/dashboard._collection-sb0M--Ej.js +0 -1
- package/build/client/assets/dashboard._collection._document-B29gnD6-.js +0 -1
- package/build/client/assets/dashboard._collection.new-BAgCKtvj.js +0 -1
- package/build/client/assets/dashboard._layout-DF619pFj.js +0 -1
- package/build/client/assets/itemForm-BR_x2kdj.js +0 -2
package/build/client/index.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en" class="min-h-screen"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Editorial Admin</title><meta name="robots" content="noindex"/><link rel="icon" type="image/ico" href="/admin/favicon.ico"/><link rel="modulepreload" href="/assets/manifest-
|
|
1
|
+
<!DOCTYPE html><html lang="en" class="min-h-screen"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Editorial Admin</title><meta name="robots" content="noindex"/><link rel="icon" type="image/ico" href="/admin/favicon.ico"/><link rel="modulepreload" href="/assets/manifest-a5f7d74e.js"/><link rel="modulepreload" href="/assets/entry.client-C94uvdU2.js"/><link rel="modulepreload" href="/assets/chunk-EPOLDU6W-CiSVlmCe.js"/><link rel="modulepreload" href="/assets/index-DLIEpuwL.js"/><link rel="modulepreload" href="/assets/root-CLpfMQQt.js"/><link rel="modulepreload" href="/assets/index-CZSVchcX.js"/><link rel="modulepreload" href="/assets/loader-circle-BDUbeTTe.js"/><link rel="modulepreload" href="/assets/createLucideIcon-BvSqmaUO.js"/><link rel="modulepreload" href="/assets/circle-check-C6CxUIig.js"/><link rel="modulepreload" href="/assets/utils-CCKKso3e.js"/><link rel="modulepreload" href="/assets/authSlice-BI_rlf3v.js"/><link rel="modulepreload" href="/assets/Loading-MKgXMPvl.js"/><link rel="stylesheet" href="/assets/root-D5WeoLDH.css"/></head><body class="h-full min-h-screen bg-background font-sans antialiased"><div class="flex gap-1 items-center justify-center min-h-screen"><svg xmlns="http://www.w3.org/2000/svg" width="28px" height="28px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-loader-circle animate-spin"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg><p class="text-gray-600">Loading Editorial...</p></div><section aria-label="Notifications alt+T" tabindex="-1" aria-live="polite" aria-relevant="additions text" aria-atomic="false"></section><script>window.__reactRouterContext = {"basename":"/","future":{"unstable_optimizeDeps":false,"unstable_subResourceIntegrity":false,"unstable_trailingSlashAwareDataRequests":false,"v8_middleware":false,"v8_splitRouteModules":false,"v8_viteEnvironmentApi":false},"routeDiscovery":{"mode":"initial"},"ssr":false,"isSpaMode":true};window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());</script><script type="module" async="">import "/assets/manifest-a5f7d74e.js";
|
|
2
2
|
import * as route0 from "/assets/root-CLpfMQQt.js";
|
|
3
3
|
|
|
4
4
|
window.__reactRouterRouteModules = {"root":route0};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isardsat/editorial-admin",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.19.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"tailwindcss-animate": "^1.0.7",
|
|
79
79
|
"vaul": "^1.1.2",
|
|
80
80
|
"zod": "^4.1.11",
|
|
81
|
-
"@isardsat/editorial-common": "^6.
|
|
81
|
+
"@isardsat/editorial-common": "^6.19.1"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@react-router/dev": "^7.7.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as e,a as h,x as f,R as H,w as E}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{B as O}from"./index-BhARCKRr.js";import{m as D,v as A,h as P,w as U,x as N,b}from"./utils-CCKKso3e.js";import{I as q}from"./input-Bk91TMQj.js";import{c as G,u as Q,T as J,a as K,b as k,d as W,f as C,e as X,g as Y,i as Z,j as ee,h as te}from"./index-pxU98Is7.js";import{A as se,a as ae,b as le,c as re,d as ne,e as ie,f as oe,g as ce,h as de}from"./alert-dialog-CN-uuUVp.js";import{c as d}from"./createLucideIcon-BvSqmaUO.js";import{C as j}from"./calendar-Frbsxn98.js";import{T as me,F as he}from"./trash-UKLAaALv.js";import{E as S}from"./external-link-ERgO2SVI.js";import{C as F}from"./circle-check-C6CxUIig.js";import{a as pe,A as xe}from"./arrow-up-C0I0e1Jt.js";import"./index-CtLWaleL.js";import"./index-DLIEpuwL.js";import"./index-cCny74f5.js";const ue=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],ge=d("arrow-up-down",ue);const fe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],T=d("circle",fe);const je=[["path",{d:"M15 12h6",key:"upa0zy"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"m3 13 3.553-7.724a.5.5 0 0 1 .894 0L11 13",key:"blevx4"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M4 11h6",key:"olkgv1"}]],v=d("letter-text",je);const we=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],ye=d("list-checks",we);const Ne=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],be=d("list",Ne);const ke=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ce=d("plus",ke),ve={boolean:F,date:j,datetime:j,markdown:v,select:be,multiselect:ye,string:v,url:S},u=G(),R=(r,a,n)=>{const i=r.getValue(n),o=a.getValue(n);return!i&&!o?0:i?o?new Date(i).getTime()-new Date(o).getTime():-1:1},M=[u.accessor("id",{header(){return e.jsxs("span",{className:"flex items-center max-w-48",children:[e.jsx(T,{className:"text-gray-500 h-4"})," ID"]})},cell(r){const a=r.getValue();return e.jsx("span",{title:a,className:"block overflow-hidden text-ellipsis w-48 max-w-48 whitespace-nowrap",children:a})}})],Me=[u.accessor("updatedAt",{header(){return e.jsxs("div",{className:"flex items-center max-w-48",children:[e.jsx(j,{className:"text-gray-500 h-4"})," Last updated"]})},sortingFn:R,cell(r){return D(new Date(r.getValue()))}})];function De({itemType:r}){const{data:a}=A(r),{data:n}=P(),[i,o]=h.useState([]),[_,$]=h.useState([{id:"updatedAt",desc:!0}]),[w]=U(),y=h.useMemo(()=>u.display({id:"actions",header:()=>e.jsx("span",{className:"flex justify-end ml-auto"}),cell(l){return e.jsx("div",{className:"flex gap-2 justify-end",onClick:s=>{s.preventDefault(),s.stopPropagation()},children:e.jsxs(se,{children:[e.jsx(ae,{asChild:!0,children:e.jsxs("button",{className:"hover:text-red-500 p-1 hover:bg-muted rounded-sm",children:[e.jsx(me,{size:16}),e.jsx("span",{className:"sr-only",children:"Delete entry"})]})}),e.jsxs(le,{children:[e.jsxs(re,{children:[e.jsxs(ne,{children:["Delete ",e.jsx("i",{children:l.row.original.id}),"?"]}),e.jsx(ie,{children:"This action cannot be undone. This will permanently delete this object."})]}),e.jsxs(oe,{children:[e.jsx(ce,{className:"cursor-pointer",children:"Cancel"}),e.jsx(de,{className:"bg-red-600 hover:bg-red-700 cursor-pointer",onClick:()=>w({type:r,id:l.row.original.id}),children:"Delete"})]})]})]})})},enableSorting:!1}),[r,w]),g=h.useMemo(()=>{if(!a)return M;const l=Object.entries(a.fields);return[...M,...l.filter(([,s])=>s.showInSummary).map(([s,c])=>u.accessor(m=>m[s],{id:s,sortingFn:c.type==="date"||c.type==="datetime"?R:"alphanumeric",header(){const m=c.isUploadedFile?he:ve[c.type]??H.Fragment;return e.jsxs("div",{className:"flex items-center ",children:[e.jsx(m,{className:"text-gray-500 h-4 flex-shrink-0"}),c.displayName]})},cell(m){const t=m.getValue();switch(c.type){case"boolean":const I=t?F:T;return e.jsx("span",{className:"flex justify-center items-center h-full text-nowrap",children:e.jsx(I,{className:N("mx-auto",t?"text-green-600":"text-gray-300"),size:14})});case"url":return t?e.jsx(f,{to:t,className:"flex items-center w-48 hover:text-blue-500 overflow-hidden text-ellipsis whitespace-nowrap",title:t,children:t}):"--";case"datetime":return t?e.jsx("span",{className:" text-nowrap",title:t,children:new Date(t).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:void 0})}):"--";case"date":return t?e.jsx("span",{className:"text-nowrap",title:t,children:D(new Date(t))}):"--";case"select":return t?e.jsx("span",{title:t,className:"inline-flex items-center px-2 py-0.5 font-medium max-w-48 overflow-hidden text-ellipsis whitespace-nowrap",children:t}):"--";case"multiselect":if(!t||Array.isArray(t)&&t.length===0)return"--";const x=Array.isArray(t)?t:[t],L=x.join(", ");return e.jsxs("span",{title:L,className:"flex items-center gap-1 w-48 overflow-hidden",children:[x.slice(0,3).map((V,B)=>e.jsx("span",{className:"inline-flex items-center px-0.5 py-0.5 font-medium whitespace-nowrap",children:V},B)),x.length>3&&e.jsxs("span",{className:"text-xs text-gray-500 whitespace-nowrap",children:["+",x.length-3]})]});case"markdown":case"string":return c.isUploadedFile?e.jsxs("span",{title:t,className:"flex items-center w-48 overflow-hidden text-ellipsis whitespace-nowrap",children:[e.jsx(S,{className:"h-4 shrink-0"})," ",t]}):e.jsx("span",{title:t,className:"block w-48 overflow-hidden text-ellipsis whitespace-nowrap",children:t});default:return Array.isArray(t)?t.join(", "):t}}})),...Me,y]},[y,a]),z=h.useMemo(()=>n?.[r]?Object.values(n[r]):[],[r,n]),p=Q({data:z,columns:g,getCoreRowModel:te(),onColumnFiltersChange:o,getFilteredRowModel:ee(),onSortingChange:$,getSortedRowModel:Z(),state:{sorting:_,columnFilters:i}});return!a||!n?null:e.jsxs("div",{className:"rounded-sm border overflow-auto",children:[a.filterBy&&Object.entries(a.fields).find(([l])=>l===a.filterBy)&&e.jsx("div",{className:"flex items-center py-2 pl-2 ",children:e.jsx(q,{placeholder:`Filter ${a.filterBy}...`,value:p.getColumn(a.filterBy)?.getFilterValue()??"",onChange:l=>p.getColumn(a.filterBy||"")?.setFilterValue(l.target.value),className:"max-w-sm rounded-sm"})}),e.jsxs(J,{children:[e.jsx(K,{className:"sticky top-0 z-50",children:p.getHeaderGroups().map(l=>e.jsx(k,{className:"grid",style:{gridTemplateColumns:`repeat(${g.length}, minmax(200px, 1fr))`},children:l.headers.map(s=>e.jsx(W,{className:N("bg-background transition-colors",s.column.getCanSort()&&"hover:bg-gray-100 cursor-default"),onClick:()=>{console.log("sorting",s.column.getIsSorted()),s.column.toggleSorting(s.column.getIsSorted()==="asc")},children:e.jsxs("div",{className:"flex items-center w-full overflow-hidden",children:[e.jsx("span",{className:"block overflow-hidden text-ellipsis whitespace-nowrap",title:s.column.columnDef.header?.toString?.()??"",children:s.isPlaceholder?null:C(s.column.columnDef.header,s.getContext())}),s.column.getCanSort()&&(s.column.getIsSorted()==="asc"?e.jsx(pe,{className:"ml-2 h-4 w-4 text-foreground"}):s.column.getIsSorted()==="desc"?e.jsx(xe,{className:"ml-2 h-4 w-4 text-foreground"}):e.jsx(ge,{className:"ml-2 h-4 w-4 text-gray-400"}))]})},s.id))},l.id))}),e.jsx(X,{children:p.getRowModel().rows.map(l=>e.jsx(f,{to:`/admin/dashboard/${r}/${l.original.id}`,children:e.jsx(k,{className:b("grid",l.original.isDraft&&"bg-orange-50 hover:bg-orange-100"),style:{gridTemplateColumns:`repeat(${g.length}, minmax(200px, 1fr))`},children:l.getVisibleCells().map(s=>e.jsx(Y,{className:b("h-10"),children:C(s.column.columnDef.cell,s.getContext())},s.id))})},l.id))})]})]})}const Pe=E(function({params:a}){const{collectionId:n}=a,{data:i,isFetching:o}=A(n);return o||!i?null:e.jsx("div",{className:"overflow-hidden flex flex-1 p-4 gap-4",children:e.jsx("div",{className:"flex flex-col overflow-hidden flex-1 gap-8",children:e.jsxs("div",{className:"flex flex-col h-full gap-4 last:mb-20",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("h2",{className:"scroll-mt-[4.5rem] text-xl font-semibold leading-none capitalize",id:i.displayName,children:i.displayName}),e.jsx(O,{asChild:!0,variant:"default",size:"sm",className:"ml-auto",children:e.jsxs(f,{to:`/admin/dashboard/${n}/new`,children:[e.jsx(Ce,{}),"Create"]})})]}),e.jsx(De,{itemType:n},n)]})})})});export{Pe as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as F,a as m,p as d}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{I as x}from"./itemForm-BR_x2kdj.js";import{v as y,y as I,p as j}from"./utils-CCKKso3e.js";import"./badge-gLcN3Bjg.js";import"./index-CtLWaleL.js";import"./index-BhARCKRr.js";import"./index-DLIEpuwL.js";import"./zod-BFfp0fV9.js";import"./index-CHzEoQKp.js";import"./check-DF0ucE8d.js";import"./createLucideIcon-BvSqmaUO.js";import"./schemas-CPJfa6mm.js";import"./input-Bk91TMQj.js";import"./index-cCny74f5.js";import"./index-B2dzkZu5.js";import"./x-BVtfHpQX.js";import"./alert-dialog-CN-uuUVp.js";import"./schemas-CsWpUuhN.js";import"./loader-circle-BDUbeTTe.js";const B=F(function({params:l}){const{collectionId:t,documentId:e}=l,[p,o]=m.useState(void 0),{data:s,isFetching:u}=y(t),{data:f,isFetching:h}=I({itemType:t,id:e}),{data:i}=j(),g=m.useMemo(()=>{if(!i)return[];const a=i.singles[t];if(a?.changedFields)return o(a.status),a.changedFields;const n=i.collections[t];if(!n)return[];const c=n.modified.find(r=>r.id===e);return c?(o("modified"),c.changedFields):(n.added.find(r=>r.id===e)&&o("added"),[])},[i,t,e]);return!s||(u||h)?null:d.jsx("div",{className:"overflow-auto scrollbar-stable",children:d.jsx("div",{className:"p-4 gap-4",children:d.jsx(x,{itemType:t,fields:s.fields,data:f??void 0,isSingleton:s.singleton,changedFields:g,itemStatus:p},`${t}-${e}`)})})});export{B as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as m,p as t}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{I as e}from"./itemForm-BR_x2kdj.js";import{v as p}from"./utils-CCKKso3e.js";import"./badge-gLcN3Bjg.js";import"./index-CtLWaleL.js";import"./index-BhARCKRr.js";import"./index-DLIEpuwL.js";import"./zod-BFfp0fV9.js";import"./index-CHzEoQKp.js";import"./check-DF0ucE8d.js";import"./createLucideIcon-BvSqmaUO.js";import"./schemas-CPJfa6mm.js";import"./input-Bk91TMQj.js";import"./index-cCny74f5.js";import"./index-B2dzkZu5.js";import"./x-BVtfHpQX.js";import"./alert-dialog-CN-uuUVp.js";import"./schemas-CsWpUuhN.js";import"./loader-circle-BDUbeTTe.js";const _=m(function({params:r}){const{collectionId:i}=r,{data:o}=p(i);return o?t.jsx("div",{className:"overflow-auto",children:t.jsx("div",{className:" p-4 gap-4",children:t.jsx(e,{itemType:i,fields:o.fields,isNew:!0,isSingleton:o.singleton})})}):null});export{_ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as e,a as r,x as N,y as X,v as he,z as xe,R as fe,w as be,O as me}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{u as ge,c as P,d as je}from"./authSlice-BI_rlf3v.js";import{b as l,d as z,h as ve,j as we,k as Ne,l as ye,u as Ce}from"./utils-CCKKso3e.js";import{t as M}from"./index-CZSVchcX.js";import{R as Z,C as Y,a as J,T as ee,D as te,P as ae,O as se,u as Se}from"./index-cCny74f5.js";import{X as ie,C as $}from"./x-BVtfHpQX.js";import{B as k,u as ke,c as _e,P as E,a as Me,b as Oe,d as Pe}from"./index-BhARCKRr.js";import{c as y}from"./createLucideIcon-BvSqmaUO.js";import{S as R,c as ze,u as Ee}from"./index-CtLWaleL.js";import{P as Re}from"./index-CHzEoQKp.js";import{P as Ae,R as De,T as Ie,a as Te,C as Le,A as $e}from"./index-B3bJjaCJ.js";import{A as Be,a as Ge}from"./arrow-up-C0I0e1Jt.js";import{L as He}from"./loader-circle-BDUbeTTe.js";import{U as Fe}from"./upload-DhJ5wU_H.js";import{E as Ve}from"./external-link-ERgO2SVI.js";import{L as Ke}from"./Loading-MKgXMPvl.js";import{C as Ue}from"./chevron-right-BFlMu-RJ.js";import"./index-DLIEpuwL.js";import"./index-B2dzkZu5.js";const qe=[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]],We=y("blocks",qe);const Qe=[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]],Xe=y("files",Qe);const Ze=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Ye=y("grid-3x3",Ze);const Je=[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]],et=y("heart",Je);const tt=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],at=y("log-out",tt);const st=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],it=y("panel-left",st);const nt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ot=y("square",nt);function rt({...t}){return e.jsx(Z,{"data-slot":"dialog",...t})}function lt({...t}){return e.jsx(ae,{"data-slot":"dialog-portal",...t})}function dt({className:t,...a}){return e.jsx(se,{"data-slot":"dialog-overlay",className:l("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),...a})}function ct({className:t,children:a,...i}){return e.jsxs(lt,{"data-slot":"dialog-portal",children:[e.jsx(dt,{}),e.jsxs(Y,{"data-slot":"dialog-content",className:l("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 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 sm:max-w-lg",t),...i,children:[a,e.jsxs(J,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(ie,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ut({className:t,...a}){return e.jsx("div",{"data-slot":"dialog-header",className:l("flex flex-col gap-2 text-center sm:text-left",t),...a})}function pt({className:t,...a}){return e.jsx("div",{"data-slot":"dialog-footer",className:l("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function ht({className:t,...a}){return e.jsx(ee,{"data-slot":"dialog-title",className:l("text-lg leading-none font-semibold",t),...a})}function xt({className:t,...a}){return e.jsx(te,{"data-slot":"dialog-description",className:l("text-muted-foreground text-sm",t),...a})}const ft="#181717",bt=r.forwardRef(function({title:a="GitHub",color:i="currentColor",size:s=24,...n},o){return i==="default"&&(i=ft),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,fill:i,viewBox:"0 0 24 24",ref:o,...n,children:[e.jsx("title",{children:a}),e.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})}),mt="#85EA2D",B=r.forwardRef(function({title:a="Swagger",color:i="currentColor",size:s=24,...n},o){return i==="default"&&(i=mt),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,fill:i,viewBox:"0 0 24 24",ref:o,...n,children:[e.jsx("title",{children:a}),e.jsx("path",{d:"M12 0C5.383 0 0 5.383 0 12s5.383 12 12 12c6.616 0 12-5.383 12-12S18.616 0 12 0zm0 1.144c5.995 0 10.856 4.86 10.856 10.856 0 5.995-4.86 10.856-10.856 10.856-5.996 0-10.856-4.86-10.856-10.856C1.144 6.004 6.004 1.144 12 1.144zM8.37 5.868a6.707 6.707 0 0 0-.423.005c-.983.056-1.573.517-1.735 1.472-.115.665-.096 1.348-.143 2.017-.013.35-.05.697-.115 1.038-.134.609-.397.798-1.016.83a2.65 2.65 0 0 0-.244.042v1.463c1.126.055 1.278.452 1.37 1.629.033.429-.013.858.015 1.287.018.406.073.808.156 1.2.259 1.075 1.307 1.435 2.575 1.218v-1.283c-.203 0-.383.005-.558 0-.43-.013-.591-.12-.632-.535-.056-.535-.042-1.08-.075-1.62-.064-1.001-.175-1.988-1.153-2.625.503-.37.868-.812.983-1.398.083-.41.134-.821.166-1.237.028-.415-.023-.84.014-1.25.06-.665.102-.937.9-.91.12 0 .235-.017.369-.027v-1.31c-.16 0-.31-.004-.454-.006zm7.593.009a4.247 4.247 0 0 0-.813.06v1.274c.245 0 .434 0 .623.005.328.004.577.13.61.494.032.332.031.669.064 1.006.065.669.101 1.347.217 2.007.102.544.475.95.941 1.283-.817.549-1.057 1.333-1.098 2.215-.023.604-.037 1.213-.069 1.822-.028.554-.222.734-.78.748-.157.004-.31.018-.484.028v1.305c.327 0 .627.019.927 0 .932-.055 1.495-.507 1.68-1.412.078-.498.124-1 .138-1.504.032-.461.028-.927.074-1.384.069-.715.397-1.01 1.112-1.057a.972.972 0 0 0 .199-.046v-1.463c-.12-.014-.204-.027-.291-.032-.536-.023-.804-.203-.937-.71a5.146 5.146 0 0 1-.152-.993c-.037-.618-.033-1.241-.074-1.86-.08-1.192-.794-1.753-1.887-1.786zm-6.89 5.28a.844.844 0 0 0-.083 1.684h.055a.83.83 0 0 0 .877-.78v-.046a.845.845 0 0 0-.83-.858zm2.911 0a.808.808 0 0 0-.834.78c0 .027 0 .05.004.078 0 .503.342.826.859.826.507 0 .826-.332.826-.853-.005-.503-.342-.836-.855-.831zm2.963 0a.861.861 0 0 0-.876.835c0 .47.378.849.849.849h.009c.425.074.853-.337.881-.83.023-.457-.392-.854-.863-.854z"})]})});function gt({isOpen:t,setOpen:a}){return e.jsx(rt,{open:t,onOpenChange:i=>a(i),children:e.jsxs(ct,{children:[e.jsxs(ut,{children:[e.jsx(ht,{children:"Editorial"}),e.jsx(xt,{children:"A simple CMS for static websites"})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(k,{asChild:!0,variant:"ghost",children:e.jsxs(N,{to:"https://lobelia-earth.github.io/editorial/",children:[e.jsx(B,{size:14}),"Documentation"]})}),e.jsx(k,{asChild:!0,variant:"ghost",children:e.jsxs(N,{to:"/doc/ui",children:[e.jsx(B,{size:14}),"Swagger API UI"]})}),e.jsx(k,{asChild:!0,variant:"ghost",children:e.jsxs(N,{to:"https://github.com/Lobelia-Earth/editorial",children:[e.jsx(bt,{size:14}),"GitHub repository"]})})]}),e.jsx(pt,{children:e.jsxs("p",{className:"flex items-center gap-1",children:["Created with",e.jsx(et,{size:14,className:"stroke-red-500 fill-red-500"})," by"," ",e.jsx(N,{to:"https://lobelia.earth",className:"underline hover:text-blue-500",children:"Lobelia.earth"})]})})]})})}var jt="Separator",G="horizontal",vt=["horizontal","vertical"],ne=r.forwardRef((t,a)=>{const{decorative:i,orientation:s=G,...n}=t,o=wt(s)?s:G,c=i?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return e.jsx(Re.div,{"data-orientation":o,...c,...n,ref:a})});ne.displayName=jt;function wt(t){return vt.includes(t)}var Nt=ne;function oe({className:t,orientation:a="horizontal",decorative:i=!0,...s}){return e.jsx(Nt,{"data-slot":"separator-root",decorative:i,orientation:a,className:l("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...s})}function yt({...t}){return e.jsx(Z,{"data-slot":"sheet",...t})}function Ct({...t}){return e.jsx(ae,{"data-slot":"sheet-portal",...t})}function St({className:t,...a}){return e.jsx(se,{"data-slot":"sheet-overlay",className:l("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),...a})}function kt({className:t,children:a,side:i="right",...s}){return e.jsxs(Ct,{children:[e.jsx(St,{}),e.jsxs(Y,{"data-slot":"sheet-content",className:l("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",i==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",i==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",i==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",i==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...s,children:[a,e.jsxs(J,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e.jsx(ie,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function _t({className:t,...a}){return e.jsx("div",{"data-slot":"sheet-header",className:l("flex flex-col gap-1.5 p-4",t),...a})}function Mt({className:t,...a}){return e.jsx(ee,{"data-slot":"sheet-title",className:l("text-foreground font-semibold",t),...a})}function Ot({className:t,...a}){return e.jsx(te,{"data-slot":"sheet-description",className:l("text-muted-foreground text-sm",t),...a})}function re({delayDuration:t=0,...a}){return e.jsx(Ae,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function Pt({...t}){return e.jsx(re,{children:e.jsx(De,{"data-slot":"tooltip",...t})})}function zt({...t}){return e.jsx(Ie,{"data-slot":"tooltip-trigger",...t})}function Et({className:t,sideOffset:a=0,children:i,...s}){return e.jsx(Te,{children:e.jsxs(Le,{"data-slot":"tooltip-content",sideOffset:a,className:l("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...s,children:[i,e.jsx($e,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const O=768;function Rt(){const[t,a]=r.useState(void 0);return r.useEffect(()=>{const i=window.matchMedia(`(max-width: ${O-1}px)`),s=()=>{a(window.innerWidth<O)};return i.addEventListener("change",s),a(window.innerWidth<O),()=>i.removeEventListener("change",s)},[]),!!t}const At="sidebar_state",Dt=3600*24*7,It="16rem",Tt="18rem",Lt="3rem",$t="b",le=r.createContext(null);function A(){const t=r.useContext(le);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Bt({defaultOpen:t=!0,open:a,onOpenChange:i,className:s,style:n,children:o,...d}){const c=Rt(),[f,u]=r.useState(!1),[m,C]=r.useState(t),b=a??m,j=r.useCallback(x=>{const p=typeof x=="function"?x(b):x;i?i(p):C(p),document.cookie=`${At}=${p}; path=/; max-age=${Dt}`},[i,b]),h=r.useCallback(()=>c?u(x=>!x):j(x=>!x),[c,j,u]);r.useEffect(()=>{const x=p=>{p.key===$t&&(p.metaKey||p.ctrlKey)&&(p.preventDefault(),h())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[h]);const v=b?"expanded":"collapsed",S=r.useMemo(()=>({state:v,open:b,setOpen:j,isMobile:c,openMobile:f,setOpenMobile:u,toggleSidebar:h}),[v,b,j,c,f,u,h]);return e.jsx(le.Provider,{value:S,children:e.jsx(re,{delayDuration:0,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":It,"--sidebar-width-icon":Lt,...n},className:l("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",s),...d,children:o})})})}function Gt({side:t="left",variant:a="sidebar",collapsible:i="offcanvas",className:s,children:n,...o}){const{isMobile:d,state:c,openMobile:f,setOpenMobile:u}=A();return i==="none"?e.jsx("div",{"data-slot":"sidebar",className:l("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",s),...o,children:n}):d?e.jsx(yt,{open:f,onOpenChange:u,...o,children:e.jsxs(kt,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":Tt},side:t,children:[e.jsxs(_t,{className:"sr-only",children:[e.jsx(Mt,{children:"Sidebar"}),e.jsx(Ot,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:n})]})}):e.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":c,"data-collapsible":c==="collapsed"?i:"","data-variant":a,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:l("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",a==="floating"||a==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container",className:l("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",a==="floating"||a==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...o,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:n})})]})}function Ht({className:t,onClick:a,...i}){const{toggleSidebar:s}=A();return e.jsxs(k,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:l("size-7",t),onClick:n=>{a?.(n),s()},...i,children:[e.jsx(it,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Ft({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:l("flex flex-col gap-2 p-2",t),...a})}function Vt({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:l("flex flex-col gap-2 p-2",t),...a})}function Kt({className:t,...a}){return e.jsx(oe,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:l("bg-sidebar-border mx-2 w-auto",t),...a})}function Ut({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:l("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...a})}function H({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:l("relative flex w-full min-w-0 flex-col p-2",t),...a})}function F({className:t,asChild:a=!1,...i}){const s=a?R:"div";return e.jsx(s,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:l("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...i})}function V({className:t,...a}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:l("w-full text-sm",t),...a})}function K({className:t,...a}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:l("flex w-full min-w-0 flex-col gap-1",t),...a})}function w({className:t,...a}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:l("group/menu-item relative",t),...a})}const qt=ze("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function g({asChild:t=!1,isActive:a=!1,variant:i="default",size:s="default",tooltip:n,className:o,...d}){const c=t?R:"button",{isMobile:f,state:u}=A(),m=e.jsx(c,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":a,className:l(qt({variant:i,size:s}),o),...d});return n?(typeof n=="string"&&(n={children:n}),e.jsxs(Pt,{children:[e.jsx(zt,{asChild:!0,children:m}),e.jsx(Et,{side:"right",align:"center",hidden:u!=="collapsed"||f,...n})]})):m}function Wt({className:t,...a}){return e.jsx("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:l("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...a})}function Qt({asChild:t=!1,size:a="md",isActive:i=!1,className:s,...n}){const o=t?R:"a";return e.jsx(o,{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":a,"data-active":i,className:l("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",a==="sm"&&"text-xs",a==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",s),...n})}function U({singleton:t}){const{data:a}=z(),{data:i}=ve();if(!a)return null;const s=r.useMemo(()=>Object.entries(a).filter(([,n])=>t?n.singleton:!n.singleton).toSorted(([n],[o])=>n.localeCompare(o)),[a,t]);return e.jsx(e.Fragment,{children:s.map(([n,o])=>e.jsx(Wt,{children:e.jsx(X,{to:t?`/admin/dashboard/${n}/default`:`/admin/dashboard/${n}`,className:({isActive:d,isPending:c})=>c?"pending":d?"active":"",children:({isActive:d})=>e.jsx(Qt,{isActive:d,asChild:!0,children:e.jsxs("div",{children:[e.jsx("span",{className:"inline-block overflow-hidden whitespace-nowrap text-ellipsis text-nowrap",children:o.displayName}),!t&&i?.[n]&&e.jsx("span",{className:"text-xs text-gray-500 ml-auto pr-1 min-w-[25px] text-right",children:Object.keys(i[n]).length})]})})})},o.displayName))})}var _="Collapsible",[Xt]=_e(_),[Zt,D]=Xt(_),de=r.forwardRef((t,a)=>{const{__scopeCollapsible:i,open:s,defaultOpen:n,disabled:o,onOpenChange:d,...c}=t,[f,u]=ke({prop:s,defaultProp:n??!1,onChange:d,caller:_});return e.jsx(Zt,{scope:i,disabled:o,contentId:Se(),open:f,onOpenToggle:r.useCallback(()=>u(m=>!m),[u]),children:e.jsx(E.div,{"data-state":T(f),"data-disabled":o?"":void 0,...c,ref:a})})});de.displayName=_;var ce="CollapsibleTrigger",ue=r.forwardRef((t,a)=>{const{__scopeCollapsible:i,...s}=t,n=D(ce,i);return e.jsx(E.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":T(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...s,ref:a,onClick:Me(t.onClick,n.onOpenToggle)})});ue.displayName=ce;var I="CollapsibleContent",pe=r.forwardRef((t,a)=>{const{forceMount:i,...s}=t,n=D(I,t.__scopeCollapsible);return e.jsx(Oe,{present:i||n.open,children:({present:o})=>e.jsx(Yt,{...s,ref:a,present:o})})});pe.displayName=I;var Yt=r.forwardRef((t,a)=>{const{__scopeCollapsible:i,present:s,children:n,...o}=t,d=D(I,i),[c,f]=r.useState(s),u=r.useRef(null),m=Ee(a,u),C=r.useRef(0),b=C.current,j=r.useRef(0),h=j.current,v=d.open||c,S=r.useRef(v),x=r.useRef(void 0);return r.useEffect(()=>{const p=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(p)},[]),Pe(()=>{const p=u.current;if(p){x.current=x.current||{transitionDuration:p.style.transitionDuration,animationName:p.style.animationName},p.style.transitionDuration="0s",p.style.animationName="none";const L=p.getBoundingClientRect();C.current=L.height,j.current=L.width,S.current||(p.style.transitionDuration=x.current.transitionDuration,p.style.animationName=x.current.animationName),f(s)}},[d.open,s]),e.jsx(E.div,{"data-state":T(d.open),"data-disabled":d.disabled?"":void 0,id:d.contentId,hidden:!v,...o,ref:m,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...t.style},children:v&&n})});function T(t){return t?"open":"closed"}var Jt=de;function q({...t}){return e.jsx(Jt,{"data-slot":"collapsible",...t})}function W({...t}){return e.jsx(ue,{"data-slot":"collapsible-trigger",...t})}function Q({...t}){return e.jsx(pe,{"data-slot":"collapsible-content",...t})}function ea(){const t=ge(),[a,i]=r.useState(!1),[s]=we(),[n]=Ne(),[o]=ye(),[d,c]=r.useState(!1),{data:f}=Ce(),{data:u}=z(),m=r.useMemo(()=>u&&!!Object.values(u).find(h=>!h.singleton),[u]),C=r.useMemo(()=>u&&!!Object.values(u).find(h=>h.singleton),[u]),b=P(h=>h.auth.user),j=async h=>{c(!0);try{await s({author:h}).unwrap()?M.success("Content published successfully."):M.error("Publishing failed.")}catch(v){M.error("Publishing failed."),console.error(v)}finally{c(!1)}};return e.jsxs(Gt,{className:"z-50",children:[e.jsx(gt,{isOpen:a,setOpen:i}),e.jsx(Ft,{className:"h-14 justify-center",children:e.jsx(H,{children:e.jsx(N,{to:"/admin/dashboard",className:"text-3xl font-semibold tracking-tight transition-colors",children:f?.name})})}),e.jsx(Ut,{children:e.jsxs(H,{children:[e.jsx(F,{children:"Content"}),e.jsx(V,{children:e.jsxs(K,{children:[e.jsx(q,{className:"group/collapsible",disabled:!m,children:e.jsxs(w,{children:[e.jsx(W,{asChild:!0,children:e.jsxs(g,{className:"group",children:[e.jsx(Ye,{}),e.jsx("span",{children:"Collections"}),e.jsx($,{className:"transition-transform ml-auto -mr-[2px] group-data-[state=open]:rotate-180"})]})}),e.jsx(Q,{children:e.jsx(U,{})})]})}),e.jsx(q,{className:"group/collapsible",disabled:!C,children:e.jsxs(w,{children:[e.jsx(W,{asChild:!0,children:e.jsxs(g,{className:"group",children:[e.jsx(ot,{}),e.jsx("span",{children:"Singles"}),e.jsx($,{className:"transition-transform ml-auto -mr-[2px] group-data-[state=open]:rotate-180"})]})}),e.jsx(Q,{children:e.jsx(U,{singleton:!0})})]})}),e.jsx(w,{children:e.jsx(g,{asChild:!0,children:e.jsxs(N,{to:"/admin/dashboard/files",children:[e.jsx(Xe,{}),e.jsx("span",{children:"Files"})]})})}),e.jsx(w,{children:e.jsxs(g,{disabled:!0,children:[e.jsx(We,{}),e.jsx("span",{children:"Components"})]})})]})})]})}),e.jsxs(Vt,{children:[e.jsx(F,{children:"Actions"}),e.jsx(V,{children:e.jsxs(K,{children:[b?.role==="developer"&&e.jsxs(e.Fragment,{children:[e.jsx(w,{children:e.jsxs(g,{className:"cursor-pointer",onClick:()=>n(),children:[e.jsx(Be,{}),e.jsx("span",{children:"Pull from repo"})]})}),e.jsx(w,{children:e.jsxs(g,{className:"cursor-pointer",onClick:()=>o({author:b.email}),children:[e.jsx(Ge,{}),e.jsx("span",{children:"Push to repo"})]})})]}),b&&e.jsx(w,{children:e.jsxs(g,{className:"cursor-pointer",onClick:()=>{j(b.email)},children:[d?e.jsx(He,{className:"animate-spin"}):e.jsx(Fe,{}),e.jsx("span",{children:"Publish"})]})})]})}),e.jsx(Kt,{}),e.jsx(g,{asChild:!0,children:e.jsxs(N,{to:f?.previewUrl,children:["Preview",e.jsx(Ve,{className:"ml-auto"})]})}),e.jsx(g,{className:"cursor-pointer",onClick:()=>i(!0),children:"About"}),e.jsxs(g,{className:"cursor-pointer",onClick:()=>t(je()),children:[e.jsx(at,{}),"Log out"]}),e.jsxs("div",{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",children:["Editorial v","6.18.2"]})]})]})}function ta({children:t}){const a=he(),i=P(n=>n.auth.user),s=P(n=>n.auth.isLoading);return r.useEffect(()=>{!s&&!i&&a("/admin")},[s,a,i]),s||!i?e.jsx(Ke,{}):t}function aa(){const{pathname:t}=xe(),{data:a}=z(),i=t.split("/").filter(s=>!["admin","dashboard"].includes(s)&&s!=="");return a?e.jsx(e.Fragment,{children:i.map((s,n,o)=>e.jsxs(fe.Fragment,{children:[o.length>1&&n>=1&&e.jsx(Ue,{size:12,className:"text-gray-500 pt-[1px]"}),e.jsxs("p",{className:"text-sm leading-none tracking-tight capitalize text-gray-500 last:text-foreground",children:[n<o.length-1&&a[s]&&a[s].singleton&&(a[s]?a[s].displayName:s),n<o.length-1&&a[s]&&!a[s].singleton&&e.jsx(X,{to:`/admin/dashboard/${s}`,className:({isActive:d,isPending:c})=>c?"pending":d?"active":"",children:a[s]?a[s].displayName:s}),n===o.length-1&&(a[s]?a[s].displayName:s)]},s)]},n))}):null}const Na=be(function(){return e.jsx(ta,{children:e.jsxs(Bt,{className:"flex h-full",children:[e.jsx(ea,{}),e.jsxs("main",{className:"flex flex-col flex-1 h-full w-0",children:[e.jsx("header",{className:"flex sticky bg-sidebar dark:bg-sidebar z-40 top-0 h-14 shrink-0 items-center gap-2 border-b",children:e.jsxs("div",{className:"flex items-center gap-2 px-3",children:[e.jsx(Ht,{}),e.jsx(oe,{orientation:"vertical",className:"h-4"}),e.jsx(aa,{})]})}),e.jsx(me,{})]})]})})});export{Na as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilePicker-CRgpF9yp.js","assets/chunk-EPOLDU6W-CiSVlmCe.js","assets/utils-CCKKso3e.js","assets/files-Cdeyho5X.js","assets/index-CZSVchcX.js","assets/index-DLIEpuwL.js","assets/badge-gLcN3Bjg.js","assets/index-CtLWaleL.js","assets/upload-DhJ5wU_H.js","assets/createLucideIcon-BvSqmaUO.js","assets/trash-UKLAaALv.js","assets/x-BVtfHpQX.js","assets/check-DF0ucE8d.js","assets/index-BhARCKRr.js","assets/input-Bk91TMQj.js","assets/external-link-ERgO2SVI.js","assets/markdownEditor-DfaF8kYY.js","assets/authSlice-BI_rlf3v.js","assets/index-cCny74f5.js","assets/zod-BFfp0fV9.js","assets/index-CHzEoQKp.js","assets/schemas-CPJfa6mm.js","assets/index-B0u0hYGX.js","assets/index-B2dzkZu5.js","assets/index-B3bJjaCJ.js","assets/alert-dialog-CN-uuUVp.js","assets/schemas-CsWpUuhN.js","assets/loader-circle-BDUbeTTe.js","assets/markdownEditor-Dha_UaaS.css","assets/date-picker-Dgbvfw_1.js","assets/clear-button-D05R9Y5Y.js","assets/chevron-right-BFlMu-RJ.js","assets/calendar-Frbsxn98.js","assets/datetime-picker-De7vM6e7.js","assets/URLInput-CPrLDhlu.js","assets/ColorPicker-kqchGTe4.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{R as V,p as e,a as l,A as Et,v as _t,z as Tt}from"./chunk-EPOLDU6W-CiSVlmCe.js";import{B as Pt}from"./badge-gLcN3Bjg.js";import{c as Ye,e as _e,u as Le,P as B,a as M,d as Z,B as ke}from"./index-BhARCKRr.js";import{g as Rt,u as Dt,a as Mt,F as At,b as pe,c as me,d as ce,e as fe,f as he,C as Ve,h as Ne}from"./zod-BFfp0fV9.js";import{I as Ee}from"./input-Bk91TMQj.js";import{a as Xe}from"./index-DLIEpuwL.js";import{u as H}from"./index-CtLWaleL.js";import{u as Ae,b as Ot,c as Lt,h as kt,d as Vt,e as Bt,F as Ft,f as Ht}from"./index-cCny74f5.js";import{c as Ze,R as zt,V as Ut,A as $t,C as Wt,a as Kt}from"./index-B2dzkZu5.js";import{b as F,z as qt,A as Gt,h as Yt,n as Xt}from"./utils-CCKKso3e.js";import{C as Qe,X as Be}from"./x-BVtfHpQX.js";import{C as Zt}from"./check-DF0ucE8d.js";import{c as Je}from"./createLucideIcon-BvSqmaUO.js";import{A as Qt,b as Jt,c as eo,d as to,e as oo,f as no,g as so,h as ro}from"./alert-dialog-CN-uuUVp.js";import{R as ao}from"./schemas-CsWpUuhN.js";import{L as lo}from"./loader-circle-BDUbeTTe.js";import{s as X,_ as Fe,u as co,n as io,l as uo,o as po,a as mo}from"./schemas-CPJfa6mm.js";const fo=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ho=Je("chevron-up",fo);const xo=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],go=Je("save",xo);function He(o){if(!o||o.length!==1)return null;const n=o[0].match(/^\$(.+)$/);return n?n[1]:null}const vo="modulepreload",So=function(o){return"/"+o},ze={},re=function(n,t,u){let p=Promise.resolve();if(t&&t.length>0){let f=function(x){return Promise.all(x.map(S=>Promise.resolve(S).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),i=c?.nonce||c?.getAttribute("nonce");p=f(t.map(x=>{if(x=So(x),x in ze)return;ze[x]=!0;const S=x.endsWith(".css"),y=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${x}"]${y}`))return;const b=document.createElement("link");if(b.rel=S?"stylesheet":vo,S||(b.as="script"),b.crossOrigin="",b.href=x,i&&b.setAttribute("nonce",i),document.head.appendChild(b),S)return new Promise((N,E)=>{b.addEventListener("load",N),b.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${x}`)))})}))}function h(c){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=c,window.dispatchEvent(i),!i.defaultPrevented)throw c}return p.then(c=>{for(const i of c||[])i.status==="rejected"&&h(i.reason);return n().catch(h)})};function Ue(o,[n,t]){return Math.min(t,Math.max(n,o))}function Co(o){const n=o+"CollectionProvider",[t,u]=Ye(n),[p,h]=t(n,{collectionRef:{current:null},itemMap:new Map}),c=s=>{const{scope:v,children:I}=s,g=V.useRef(null),C=V.useRef(new Map).current;return e.jsx(p,{scope:v,itemMap:C,collectionRef:g,children:I})};c.displayName=n;const i=o+"CollectionSlot",f=_e(i),x=V.forwardRef((s,v)=>{const{scope:I,children:g}=s,C=h(i,I),P=H(v,C.collectionRef);return e.jsx(f,{ref:P,children:g})});x.displayName=i;const S=o+"CollectionItemSlot",y="data-radix-collection-item",b=_e(S),N=V.forwardRef((s,v)=>{const{scope:I,children:g,...C}=s,P=V.useRef(null),r=H(v,P),a=h(S,I);return V.useEffect(()=>(a.itemMap.set(P,{ref:P,...C}),()=>{a.itemMap.delete(P)})),e.jsx(b,{[y]:"",ref:r,children:g})});N.displayName=S;function E(s){const v=h(o+"CollectionConsumer",s);return V.useCallback(()=>{const g=v.collectionRef.current;if(!g)return[];const C=Array.from(g.querySelectorAll(`[${y}]`));return Array.from(v.itemMap.values()).sort((a,m)=>C.indexOf(a.ref.current)-C.indexOf(m.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:x,ItemSlot:N},E,u]}var wo=l.createContext(void 0);function yo(o){const n=l.useContext(wo);return o||n||"ltr"}var bo=[" ","Enter","ArrowUp","ArrowDown"],jo=[" ","Enter"],oe="Select",[ge,ve,Io]=Co(oe),[ae]=Ye(oe,[Io,Ze]),Se=Ze(),[No,Q]=ae(oe),[Eo,_o]=ae(oe),et=o=>{const{__scopeSelect:n,children:t,open:u,defaultOpen:p,onOpenChange:h,value:c,defaultValue:i,onValueChange:f,dir:x,name:S,autoComplete:y,disabled:b,required:N,form:E}=o,s=Se(n),[v,I]=l.useState(null),[g,C]=l.useState(null),[P,r]=l.useState(!1),a=yo(x),[m,d]=Le({prop:u,defaultProp:p??!1,onChange:h,caller:oe}),[O,z]=Le({prop:c,defaultProp:i,onChange:f,caller:oe}),j=l.useRef(null),A=v?E||!!v.closest("form"):!0,[$,K]=l.useState(new Set),q=Array.from($).map(L=>L.props.value).join(";");return e.jsx(zt,{...s,children:e.jsxs(No,{required:N,scope:n,trigger:v,onTriggerChange:I,valueNode:g,onValueNodeChange:C,valueNodeHasChildren:P,onValueNodeHasChildrenChange:r,contentId:Ae(),value:O,onValueChange:z,open:m,onOpenChange:d,dir:a,triggerPointerDownPosRef:j,disabled:b,children:[e.jsx(ge.Provider,{scope:n,children:e.jsx(Eo,{scope:o.__scopeSelect,onNativeOptionAdd:l.useCallback(L=>{K(W=>new Set(W).add(L))},[]),onNativeOptionRemove:l.useCallback(L=>{K(W=>{const G=new Set(W);return G.delete(L),G})},[]),children:t})}),A?e.jsxs(bt,{"aria-hidden":!0,required:N,tabIndex:-1,name:S,autoComplete:y,value:O,onChange:L=>z(L.target.value),disabled:b,form:E,children:[O===void 0?e.jsx("option",{value:""}):null,Array.from($)]},q):null]})})};et.displayName=oe;var tt="SelectTrigger",ot=l.forwardRef((o,n)=>{const{__scopeSelect:t,disabled:u=!1,...p}=o,h=Se(t),c=Q(tt,t),i=c.disabled||u,f=H(n,c.onTriggerChange),x=ve(t),S=l.useRef("touch"),[y,b,N]=It(s=>{const v=x().filter(C=>!C.disabled),I=v.find(C=>C.value===c.value),g=Nt(v,s,I);g!==void 0&&c.onValueChange(g.value)}),E=s=>{i||(c.onOpenChange(!0),N()),s&&(c.triggerPointerDownPosRef.current={x:Math.round(s.pageX),y:Math.round(s.pageY)})};return e.jsx($t,{asChild:!0,...h,children:e.jsx(B.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":jt(c.value)?"":void 0,...p,ref:f,onClick:M(p.onClick,s=>{s.currentTarget.focus(),S.current!=="mouse"&&E(s)}),onPointerDown:M(p.onPointerDown,s=>{S.current=s.pointerType;const v=s.target;v.hasPointerCapture(s.pointerId)&&v.releasePointerCapture(s.pointerId),s.button===0&&s.ctrlKey===!1&&s.pointerType==="mouse"&&(E(s),s.preventDefault())}),onKeyDown:M(p.onKeyDown,s=>{const v=y.current!=="";!(s.ctrlKey||s.altKey||s.metaKey)&&s.key.length===1&&b(s.key),!(v&&s.key===" ")&&bo.includes(s.key)&&(E(),s.preventDefault())})})})});ot.displayName=tt;var nt="SelectValue",st=l.forwardRef((o,n)=>{const{__scopeSelect:t,className:u,style:p,children:h,placeholder:c="",...i}=o,f=Q(nt,t),{onValueNodeHasChildrenChange:x}=f,S=h!==void 0,y=H(n,f.onValueNodeChange);return Z(()=>{x(S)},[x,S]),e.jsx(B.span,{...i,ref:y,style:{pointerEvents:"none"},children:jt(f.value)?e.jsx(e.Fragment,{children:c}):h})});st.displayName=nt;var To="SelectIcon",rt=l.forwardRef((o,n)=>{const{__scopeSelect:t,children:u,...p}=o;return e.jsx(B.span,{"aria-hidden":!0,...p,ref:n,children:u||"▼"})});rt.displayName=To;var Po="SelectPortal",at=o=>e.jsx(Ot,{asChild:!0,...o});at.displayName=Po;var ne="SelectContent",lt=l.forwardRef((o,n)=>{const t=Q(ne,o.__scopeSelect),[u,p]=l.useState();if(Z(()=>{p(new DocumentFragment)},[]),!t.open){const h=u;return h?Xe.createPortal(e.jsx(ct,{scope:o.__scopeSelect,children:e.jsx(ge.Slot,{scope:o.__scopeSelect,children:e.jsx("div",{children:o.children})})}),h):null}return e.jsx(it,{...o,ref:n})});lt.displayName=ne;var U=10,[ct,J]=ae(ne),Ro="SelectContentImpl",Do=_e("SelectContent.RemoveScroll"),it=l.forwardRef((o,n)=>{const{__scopeSelect:t,position:u="item-aligned",onCloseAutoFocus:p,onEscapeKeyDown:h,onPointerDownOutside:c,side:i,sideOffset:f,align:x,alignOffset:S,arrowPadding:y,collisionBoundary:b,collisionPadding:N,sticky:E,hideWhenDetached:s,avoidCollisions:v,...I}=o,g=Q(ne,t),[C,P]=l.useState(null),[r,a]=l.useState(null),m=H(n,w=>P(w)),[d,O]=l.useState(null),[z,j]=l.useState(null),A=ve(t),[$,K]=l.useState(!1),q=l.useRef(!1);l.useEffect(()=>{if(C)return kt(C)},[C]),Vt();const L=l.useCallback(w=>{const[R,...k]=A().map(D=>D.ref.current),[_]=k.slice(-1),T=document.activeElement;for(const D of w)if(D===T||(D?.scrollIntoView({block:"nearest"}),D===R&&r&&(r.scrollTop=0),D===_&&r&&(r.scrollTop=r.scrollHeight),D?.focus(),document.activeElement!==T))return},[A,r]),W=l.useCallback(()=>L([d,C]),[L,d,C]);l.useEffect(()=>{$&&W()},[$,W]);const{onOpenChange:G,triggerPointerDownPosRef:Y}=g;l.useEffect(()=>{if(C){let w={x:0,y:0};const R=_=>{w={x:Math.abs(Math.round(_.pageX)-(Y.current?.x??0)),y:Math.abs(Math.round(_.pageY)-(Y.current?.y??0))}},k=_=>{w.x<=10&&w.y<=10?_.preventDefault():C.contains(_.target)||G(!1),document.removeEventListener("pointermove",R),Y.current=null};return Y.current!==null&&(document.addEventListener("pointermove",R),document.addEventListener("pointerup",k,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",R),document.removeEventListener("pointerup",k,{capture:!0})}}},[C,G,Y]),l.useEffect(()=>{const w=()=>G(!1);return window.addEventListener("blur",w),window.addEventListener("resize",w),()=>{window.removeEventListener("blur",w),window.removeEventListener("resize",w)}},[G]);const[Ce,de]=It(w=>{const R=A().filter(T=>!T.disabled),k=R.find(T=>T.ref.current===document.activeElement),_=Nt(R,w,k);_&&setTimeout(()=>_.ref.current.focus())}),we=l.useCallback((w,R,k)=>{const _=!q.current&&!k;(g.value!==void 0&&g.value===R||_)&&(O(w),_&&(q.current=!0))},[g.value]),ye=l.useCallback(()=>C?.focus(),[C]),se=l.useCallback((w,R,k)=>{const _=!q.current&&!k;(g.value!==void 0&&g.value===R||_)&&j(w)},[g.value]),ue=u==="popper"?Te:dt,le=ue===Te?{side:i,sideOffset:f,align:x,alignOffset:S,arrowPadding:y,collisionBoundary:b,collisionPadding:N,sticky:E,hideWhenDetached:s,avoidCollisions:v}:{};return e.jsx(ct,{scope:t,content:C,viewport:r,onViewportChange:a,itemRefCallback:we,selectedItem:d,onItemLeave:ye,itemTextRefCallback:se,focusSelectedItem:W,selectedItemText:z,position:u,isPositioned:$,searchRef:Ce,children:e.jsx(Bt,{as:Do,allowPinchZoom:!0,children:e.jsx(Ft,{asChild:!0,trapped:g.open,onMountAutoFocus:w=>{w.preventDefault()},onUnmountAutoFocus:M(p,w=>{g.trigger?.focus({preventScroll:!0}),w.preventDefault()}),children:e.jsx(Ht,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:h,onPointerDownOutside:c,onFocusOutside:w=>w.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:e.jsx(ue,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:w=>w.preventDefault(),...I,...le,onPlaced:()=>K(!0),ref:m,style:{display:"flex",flexDirection:"column",outline:"none",...I.style},onKeyDown:M(I.onKeyDown,w=>{const R=w.ctrlKey||w.altKey||w.metaKey;if(w.key==="Tab"&&w.preventDefault(),!R&&w.key.length===1&&de(w.key),["ArrowUp","ArrowDown","Home","End"].includes(w.key)){let _=A().filter(T=>!T.disabled).map(T=>T.ref.current);if(["ArrowUp","End"].includes(w.key)&&(_=_.slice().reverse()),["ArrowUp","ArrowDown"].includes(w.key)){const T=w.target,D=_.indexOf(T);_=_.slice(D+1)}setTimeout(()=>L(_)),w.preventDefault()}})})})})})})});it.displayName=Ro;var Mo="SelectItemAlignedPosition",dt=l.forwardRef((o,n)=>{const{__scopeSelect:t,onPlaced:u,...p}=o,h=Q(ne,t),c=J(ne,t),[i,f]=l.useState(null),[x,S]=l.useState(null),y=H(n,m=>S(m)),b=ve(t),N=l.useRef(!1),E=l.useRef(!0),{viewport:s,selectedItem:v,selectedItemText:I,focusSelectedItem:g}=c,C=l.useCallback(()=>{if(h.trigger&&h.valueNode&&i&&x&&s&&v&&I){const m=h.trigger.getBoundingClientRect(),d=x.getBoundingClientRect(),O=h.valueNode.getBoundingClientRect(),z=I.getBoundingClientRect();if(h.dir!=="rtl"){const T=z.left-d.left,D=O.left-T,ee=m.left-D,te=m.width+ee,be=Math.max(te,d.width),je=window.innerWidth-U,Ie=Ue(D,[U,Math.max(U,je-be)]);i.style.minWidth=te+"px",i.style.left=Ie+"px"}else{const T=d.right-z.right,D=window.innerWidth-O.right-T,ee=window.innerWidth-m.right-D,te=m.width+ee,be=Math.max(te,d.width),je=window.innerWidth-U,Ie=Ue(D,[U,Math.max(U,je-be)]);i.style.minWidth=te+"px",i.style.right=Ie+"px"}const j=b(),A=window.innerHeight-U*2,$=s.scrollHeight,K=window.getComputedStyle(x),q=parseInt(K.borderTopWidth,10),L=parseInt(K.paddingTop,10),W=parseInt(K.borderBottomWidth,10),G=parseInt(K.paddingBottom,10),Y=q+L+$+G+W,Ce=Math.min(v.offsetHeight*5,Y),de=window.getComputedStyle(s),we=parseInt(de.paddingTop,10),ye=parseInt(de.paddingBottom,10),se=m.top+m.height/2-U,ue=A-se,le=v.offsetHeight/2,w=v.offsetTop+le,R=q+L+w,k=Y-R;if(R<=se){const T=j.length>0&&v===j[j.length-1].ref.current;i.style.bottom="0px";const D=x.clientHeight-s.offsetTop-s.offsetHeight,ee=Math.max(ue,le+(T?ye:0)+D+W),te=R+ee;i.style.height=te+"px"}else{const T=j.length>0&&v===j[0].ref.current;i.style.top="0px";const ee=Math.max(se,q+s.offsetTop+(T?we:0)+le)+k;i.style.height=ee+"px",s.scrollTop=R-se+s.offsetTop}i.style.margin=`${U}px 0`,i.style.minHeight=Ce+"px",i.style.maxHeight=A+"px",u?.(),requestAnimationFrame(()=>N.current=!0)}},[b,h.trigger,h.valueNode,i,x,s,v,I,h.dir,u]);Z(()=>C(),[C]);const[P,r]=l.useState();Z(()=>{x&&r(window.getComputedStyle(x).zIndex)},[x]);const a=l.useCallback(m=>{m&&E.current===!0&&(C(),g?.(),E.current=!1)},[C,g]);return e.jsx(Oo,{scope:t,contentWrapper:i,shouldExpandOnScrollRef:N,onScrollButtonChange:a,children:e.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:e.jsx(B.div,{...p,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...p.style}})})})});dt.displayName=Mo;var Ao="SelectPopperPosition",Te=l.forwardRef((o,n)=>{const{__scopeSelect:t,align:u="start",collisionPadding:p=U,...h}=o,c=Se(t);return e.jsx(Wt,{...c,...h,ref:n,align:u,collisionPadding:p,style:{boxSizing:"border-box",...h.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Te.displayName=Ao;var[Oo,Oe]=ae(ne,{}),Pe="SelectViewport",ut=l.forwardRef((o,n)=>{const{__scopeSelect:t,nonce:u,...p}=o,h=J(Pe,t),c=Oe(Pe,t),i=H(n,h.onViewportChange),f=l.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:u}),e.jsx(ge.Slot,{scope:t,children:e.jsx(B.div,{"data-radix-select-viewport":"",role:"presentation",...p,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...p.style},onScroll:M(p.onScroll,x=>{const S=x.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:b}=c;if(b?.current&&y){const N=Math.abs(f.current-S.scrollTop);if(N>0){const E=window.innerHeight-U*2,s=parseFloat(y.style.minHeight),v=parseFloat(y.style.height),I=Math.max(s,v);if(I<E){const g=I+N,C=Math.min(E,g),P=g-C;y.style.height=C+"px",y.style.bottom==="0px"&&(S.scrollTop=P>0?P:0,y.style.justifyContent="flex-end")}}}f.current=S.scrollTop})})})]})});ut.displayName=Pe;var pt="SelectGroup",[Lo,ko]=ae(pt),Vo=l.forwardRef((o,n)=>{const{__scopeSelect:t,...u}=o,p=Ae();return e.jsx(Lo,{scope:t,id:p,children:e.jsx(B.div,{role:"group","aria-labelledby":p,...u,ref:n})})});Vo.displayName=pt;var mt="SelectLabel",Bo=l.forwardRef((o,n)=>{const{__scopeSelect:t,...u}=o,p=ko(mt,t);return e.jsx(B.div,{id:p.id,...u,ref:n})});Bo.displayName=mt;var xe="SelectItem",[Fo,ft]=ae(xe),ht=l.forwardRef((o,n)=>{const{__scopeSelect:t,value:u,disabled:p=!1,textValue:h,...c}=o,i=Q(xe,t),f=J(xe,t),x=i.value===u,[S,y]=l.useState(h??""),[b,N]=l.useState(!1),E=H(n,g=>f.itemRefCallback?.(g,u,p)),s=Ae(),v=l.useRef("touch"),I=()=>{p||(i.onValueChange(u),i.onOpenChange(!1))};if(u==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(Fo,{scope:t,value:u,disabled:p,textId:s,isSelected:x,onItemTextChange:l.useCallback(g=>{y(C=>C||(g?.textContent??"").trim())},[]),children:e.jsx(ge.ItemSlot,{scope:t,value:u,disabled:p,textValue:S,children:e.jsx(B.div,{role:"option","aria-labelledby":s,"data-highlighted":b?"":void 0,"aria-selected":x&&b,"data-state":x?"checked":"unchecked","aria-disabled":p||void 0,"data-disabled":p?"":void 0,tabIndex:p?void 0:-1,...c,ref:E,onFocus:M(c.onFocus,()=>N(!0)),onBlur:M(c.onBlur,()=>N(!1)),onClick:M(c.onClick,()=>{v.current!=="mouse"&&I()}),onPointerUp:M(c.onPointerUp,()=>{v.current==="mouse"&&I()}),onPointerDown:M(c.onPointerDown,g=>{v.current=g.pointerType}),onPointerMove:M(c.onPointerMove,g=>{v.current=g.pointerType,p?f.onItemLeave?.():v.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:M(c.onPointerLeave,g=>{g.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:M(c.onKeyDown,g=>{f.searchRef?.current!==""&&g.key===" "||(jo.includes(g.key)&&I(),g.key===" "&&g.preventDefault())})})})})});ht.displayName=xe;var ie="SelectItemText",xt=l.forwardRef((o,n)=>{const{__scopeSelect:t,className:u,style:p,...h}=o,c=Q(ie,t),i=J(ie,t),f=ft(ie,t),x=_o(ie,t),[S,y]=l.useState(null),b=H(n,I=>y(I),f.onItemTextChange,I=>i.itemTextRefCallback?.(I,f.value,f.disabled)),N=S?.textContent,E=l.useMemo(()=>e.jsx("option",{value:f.value,disabled:f.disabled,children:N},f.value),[f.disabled,f.value,N]),{onNativeOptionAdd:s,onNativeOptionRemove:v}=x;return Z(()=>(s(E),()=>v(E)),[s,v,E]),e.jsxs(e.Fragment,{children:[e.jsx(B.span,{id:f.textId,...h,ref:b}),f.isSelected&&c.valueNode&&!c.valueNodeHasChildren?Xe.createPortal(h.children,c.valueNode):null]})});xt.displayName=ie;var gt="SelectItemIndicator",vt=l.forwardRef((o,n)=>{const{__scopeSelect:t,...u}=o;return ft(gt,t).isSelected?e.jsx(B.span,{"aria-hidden":!0,...u,ref:n}):null});vt.displayName=gt;var Re="SelectScrollUpButton",St=l.forwardRef((o,n)=>{const t=J(Re,o.__scopeSelect),u=Oe(Re,o.__scopeSelect),[p,h]=l.useState(!1),c=H(n,u.onScrollButtonChange);return Z(()=>{if(t.viewport&&t.isPositioned){let i=function(){const x=f.scrollTop>0;h(x)};const f=t.viewport;return i(),f.addEventListener("scroll",i),()=>f.removeEventListener("scroll",i)}},[t.viewport,t.isPositioned]),p?e.jsx(wt,{...o,ref:c,onAutoScroll:()=>{const{viewport:i,selectedItem:f}=t;i&&f&&(i.scrollTop=i.scrollTop-f.offsetHeight)}}):null});St.displayName=Re;var De="SelectScrollDownButton",Ct=l.forwardRef((o,n)=>{const t=J(De,o.__scopeSelect),u=Oe(De,o.__scopeSelect),[p,h]=l.useState(!1),c=H(n,u.onScrollButtonChange);return Z(()=>{if(t.viewport&&t.isPositioned){let i=function(){const x=f.scrollHeight-f.clientHeight,S=Math.ceil(f.scrollTop)<x;h(S)};const f=t.viewport;return i(),f.addEventListener("scroll",i),()=>f.removeEventListener("scroll",i)}},[t.viewport,t.isPositioned]),p?e.jsx(wt,{...o,ref:c,onAutoScroll:()=>{const{viewport:i,selectedItem:f}=t;i&&f&&(i.scrollTop=i.scrollTop+f.offsetHeight)}}):null});Ct.displayName=De;var wt=l.forwardRef((o,n)=>{const{__scopeSelect:t,onAutoScroll:u,...p}=o,h=J("SelectScrollButton",t),c=l.useRef(null),i=ve(t),f=l.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return l.useEffect(()=>()=>f(),[f]),Z(()=>{i().find(S=>S.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[i]),e.jsx(B.div,{"aria-hidden":!0,...p,ref:n,style:{flexShrink:0,...p.style},onPointerDown:M(p.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(u,50))}),onPointerMove:M(p.onPointerMove,()=>{h.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(u,50))}),onPointerLeave:M(p.onPointerLeave,()=>{f()})})}),Ho="SelectSeparator",yt=l.forwardRef((o,n)=>{const{__scopeSelect:t,...u}=o;return e.jsx(B.div,{"aria-hidden":!0,...u,ref:n})});yt.displayName=Ho;var Me="SelectArrow",zo=l.forwardRef((o,n)=>{const{__scopeSelect:t,...u}=o,p=Se(t),h=Q(Me,t),c=J(Me,t);return h.open&&c.position==="popper"?e.jsx(Kt,{...p,...u,ref:n}):null});zo.displayName=Me;var Uo="SelectBubbleInput",bt=l.forwardRef(({__scopeSelect:o,value:n,...t},u)=>{const p=l.useRef(null),h=H(u,p),c=Rt(n);return l.useEffect(()=>{const i=p.current;if(!i)return;const f=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(f,"value").set;if(c!==n&&S){const y=new Event("change",{bubbles:!0});S.call(i,n),i.dispatchEvent(y)}},[c,n]),e.jsx(B.select,{...t,style:{...Ut,...t.style},ref:h,defaultValue:n})});bt.displayName=Uo;function jt(o){return o===""||o===void 0}function It(o){const n=Lt(o),t=l.useRef(""),u=l.useRef(0),p=l.useCallback(c=>{const i=t.current+c;n(i),(function f(x){t.current=x,window.clearTimeout(u.current),x!==""&&(u.current=window.setTimeout(()=>f(""),1e3))})(i)},[n]),h=l.useCallback(()=>{t.current="",window.clearTimeout(u.current)},[]);return l.useEffect(()=>()=>window.clearTimeout(u.current),[]),[t,p,h]}function Nt(o,n,t){const p=n.length>1&&Array.from(n).every(x=>x===n[0])?n[0]:n,h=t?o.indexOf(t):-1;let c=$o(o,Math.max(h,0));p.length===1&&(c=c.filter(x=>x!==t));const f=c.find(x=>x.textValue.toLowerCase().startsWith(p.toLowerCase()));return f!==t?f:void 0}function $o(o,n){return o.map((t,u)=>o[(n+u)%o.length])}var Wo=et,Ko=ot,qo=st,Go=rt,Yo=at,Xo=lt,Zo=ut,Qo=ht,Jo=xt,en=vt,tn=St,on=Ct,Pn=yt;function $e({...o}){return e.jsx(Wo,{"data-slot":"select",...o})}function We({...o}){return e.jsx(qo,{"data-slot":"select-value",...o})}function Ke({className:o,size:n="default",children:t,...u}){return e.jsxs(Ko,{"data-slot":"select-trigger","data-size":n,className:F("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),...u,children:[t,e.jsx(Go,{asChild:!0,children:e.jsx(Qe,{className:"size-4 opacity-50"})})]})}function qe({className:o,children:n,position:t="popper",...u}){return e.jsx(Yo,{children:e.jsxs(Xo,{"data-slot":"select-content",className:F("bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",t==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",o),position:t,...u,children:[e.jsx(nn,{}),e.jsx(Zo,{className:F("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),e.jsx(sn,{})]})})}function Ge({className:o,children:n,...t}){return e.jsxs(Qo,{"data-slot":"select-item",className:F("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),...t,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(en,{children:e.jsx(Zt,{className:"size-4"})})}),e.jsx(Jo,{children:n})]})}function nn({className:o,...n}){return e.jsx(tn,{"data-slot":"select-scroll-up-button",className:F("flex cursor-default items-center justify-center py-1",o),...n,children:e.jsx(ho,{className:"size-4"})})}function sn({className:o,...n}){return e.jsx(on,{"data-slot":"select-scroll-down-button",className:F("flex cursor-default items-center justify-center py-1",o),...n,children:e.jsx(Qe,{className:"size-4"})})}function rn({hasUnsavedChanges:o,title:n="Unsaved Changes",description:t="You have unsaved changes. Are you sure you want to leave this page? Your changes will be lost.",stayButtonText:u="Stay on Page",leaveButtonText:p="Leave Page"}){const h=Et(({currentLocation:S,nextLocation:y})=>o&&S.pathname!==y.pathname),[c,i]=l.useState(!1),f=()=>{h.state==="blocked"&&h.proceed()},x=()=>{h.state==="blocked"&&h.reset()};return l.useEffect(()=>{i(h.state==="blocked")},[h.state,c]),l.useEffect(()=>{const S=y=>{o&&(y.preventDefault(),y.returnValue="")};return o&&window.addEventListener("beforeunload",S),()=>{window.removeEventListener("beforeunload",S)}},[o]),e.jsx(Qt,{open:c,onOpenChange:i,children:e.jsxs(Jt,{children:[e.jsxs(eo,{children:[e.jsx(to,{children:n}),e.jsx(oo,{children:t})]}),e.jsxs(no,{children:[e.jsx(so,{onClick:x,children:u}),e.jsx(ro,{onClick:f,children:p})]})]})})}const an=V.lazy(()=>re(()=>import("./FilePicker-CRgpF9yp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),ln=V.lazy(()=>re(()=>import("./markdownEditor-DfaF8kYY.js"),__vite__mapDeps([16,1,17,2,5,18,13,7,19,20,12,9,21,22,23,24,6,14,11,25,26,27,28]))),cn=V.lazy(()=>re(()=>import("./date-picker-Dgbvfw_1.js"),__vite__mapDeps([29,1,13,7,2,5,30,9,31,11,22,18,23,20,32]))),dn=V.lazy(()=>re(()=>import("./datetime-picker-De7vM6e7.js"),__vite__mapDeps([33,1,13,7,2,5,30,9,31,11,22,18,23,20,14,32]))),un=V.lazy(()=>re(()=>import("./URLInput-CPrLDhlu.js"),__vite__mapDeps([34,1,14,2,15,9]))),pn=V.lazy(()=>re(()=>import("./ColorPicker-kqchGTe4.js"),__vite__mapDeps([35,1])));function Rn({itemType:o,fields:n,isSingleton:t,data:u,isNew:p,changedFields:h=[],itemStatus:c}){const i=_t(),{hash:f}=Tt(),[x]=qt(),[S]=Gt(),{data:y}=Yt(),b=r=>h.includes(r);l.useEffect(()=>{if(!f)return;const r=f.slice(1),a=document.getElementById(r);a&&(window.scrollTo({top:window.scrollY,behavior:"smooth"}),a.focus())},[f]);const N=l.useMemo(()=>({id:t?"default":u?.id??"",isDraft:String(u?.isDraft??!1),...Object.fromEntries(Object.keys(n).map(r=>{const a=n[r].type,m=u?.[r];return m!=null?a==="boolean"?[r,String(m)]:a==="multiselect"?[r,Array.isArray(m)?m:[m]]:[r,String(m)]:a==="boolean"?[r,"false"]:a==="multiselect"?[r,[]]:[r,""]}))}),[u,n,t]),E=l.useMemo(()=>{const r={id:X().min(1,"ID is required").regex(/^[a-z0-9-]+$/,"ID can only include lowercase letters and numbers"),isDraft:X()};return Object.entries(n).forEach(([a,m])=>{let d;switch(m.type){case"boolean":d=Fe(["true","false"]);break;case"number":d=io();break;case"url":d=co("Must be a valid URL");break;case"date":d=X();break;case"datetime":d=X();break;case"color":d=ao;break;case"select":He(m.choicesFixed)?d=X():m.choicesFixed&&m.choicesFixed.length>0?d=Fe(m.choicesFixed):d=X();break;case"multiselect":d=mo(X()),m.minSelectedChoices&&(d=d.min(m.minSelectedChoices,`${m.displayName} requires at least ${m.minSelectedChoices} selection${m.minSelectedChoices>1?"s":""}`)),m.maxSelectedChoices&&(d=d.max(m.maxSelectedChoices,`${m.displayName} allows maximum ${m.maxSelectedChoices} selection${m.maxSelectedChoices>1?"s":""}`));break;default:d=X()}m.optional?m.type==="multiselect"?m.minSelectedChoices||(d=d.optional()):d=d.optional().or(uo("")):m.type==="multiselect"&&!m.minSelectedChoices?d=d.min(1,`${m.displayName} requires at least one selection`):m.type!=="boolean"&&m.type!=="select"&&(d=d.min(1,`${m.displayName} is required`)),r[a]=d}),po(r)},[n]),s=Dt({resolver:Mt(E),defaultValues:N});l.useEffect(()=>{s.reset(N)},[N,s]),l.useEffect(()=>{if(!s)return;const r=window.location.hash;r&&s.setFocus(r.substring(1))},[s]),l.useEffect(()=>{const r=a=>{(a.ctrlKey||a.metaKey)&&a.key==="s"&&(a.preventDefault(),(s.formState.isDirty||p)&&s.handleSubmit(v)())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[s,p,v]);async function v(r){const a={...r,isDraft:r.isDraft==="true",type:o};if(Object.entries(n).forEach(([m,d])=>{d.type==="boolean"&&(a[m]=r[m]==="true")}),p){const m=await x(a);"error"in m||i(`/admin/dashboard/${o}/${m.data.id}`)}else await S(a),s.reset(r)}const I=l.useMemo(()=>Object.entries(n).filter(([,r])=>r.type==="boolean"),[n]),g=l.useMemo(()=>{const r={};return Object.entries(n).forEach(([a,m])=>{if(m.type==="select"||m.type==="multiselect"){const d=He(m.choicesFixed);if(d&&y){const O=y[d];O?r[a]=Object.values(O).map(z=>z.id):r[a]=[]}else r[a]=m.choicesFixed||[]}}),r},[n,y]),C="outline outline-1 outline-yellow-400 outline-offset-4 rounded-sm",P=()=>e.jsx("span",{className:"text-yellow-800 text-xs",children:"(modified)"});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[u&&u.updatedAt&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated:"}),e.jsx("p",{className:"text-sm",children:new Date(u.updatedAt).toLocaleString()})]}),c&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Unpublished status:"}),e.jsx(Pt,{className:F("capitalize",Xt[c]),children:c})]})]}),e.jsxs(At,{...s,children:[e.jsxs("form",{onSubmit:s.handleSubmit(v),className:"space-y-4 max-w-[800px] w-[800px]",children:[e.jsx(pe,{name:"id",control:s.control,rules:{required:!0},render:({field:r})=>e.jsxs(me,{id:"id",className:F((u?.id==="default"||t)&&"hidden",b("id")&&C),children:[e.jsxs(ce,{className:"flex gap-1 items-baseline",children:["ID",b("id")&&e.jsx(P,{})]}),e.jsx(fe,{children:e.jsx(Ee,{placeholder:"item-id",...s.register("id"),...r,value:r.value,onChange:a=>{const m=a.target.value.toLowerCase().replace(/\s+/g,"-").replace(/-+/g,"-").replace(/[^a-z0-9-]/g,"");r.onChange(m)},onBlur:a=>{const m=a.target.value.trim().replace(/^-+|-+$/g,"");r.onChange(m)}})}),e.jsx(he,{})]})}),e.jsx(pe,{name:"isDraft",control:s.control,render:({field:r})=>e.jsxs(me,{id:"isDraft",className:F("flex flex-col items-start",(u?.id==="default"||t)&&"hidden",b("isDraft")&&C),children:[e.jsxs("div",{className:"flex flex-row space-x-2",children:[e.jsx(fe,{children:e.jsx(Ve,{id:"isDraft",...s.register("isDraft"),checked:r.value==="true",onCheckedChange:a=>{r.onChange(a===!0?"true":"false")}})}),e.jsxs(ce,{className:"flex gap-1 items-baseline",children:["Draft",b("isDraft")&&e.jsx("span",{className:"text-yellow-600 text-xs",children:e.jsx(P,{})})]})]}),e.jsx(Ne,{children:"Draft items are not visible on the published site"}),e.jsx(he,{})]})}),I.length>0&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(ce,{children:"Flags"}),e.jsx("div",{className:"flex flex-row flex-wrap gap-4",children:I.map(([r,a])=>e.jsx(pe,{name:r,control:s.control,render:({field:m})=>e.jsxs(me,{className:F("flex flex-col items-start",b(r)&&C),children:[e.jsxs("div",{className:"flex flex-row space-x-2",children:[e.jsx(fe,{children:e.jsx(Ve,{id:r,...s.register(r),checked:m.value==="true",onCheckedChange:d=>{m.onChange(d===!0?"true":"false")}})}),e.jsxs(ce,{className:"flex gap-1 items-baseline",children:[a.displayName,b(r)&&e.jsx("span",{className:"text-yellow-800 text-xs",children:e.jsx(P,{})})]})]}),a.displayExtra&&e.jsx(Ne,{children:a.displayExtra}),e.jsx(he,{})]})},r))})]}),Object.entries(n).filter(([,r])=>r.type!=="boolean").map(([r,a])=>{const m=g[r]??[];return e.jsx(pe,{name:r,control:s.control,rules:{required:!a.optional},render:({field:d})=>{const O=d.value?.length??0,z=a.type==="multiselect"&&(a.minSelectedChoices||a.maxSelectedChoices);return e.jsxs(me,{id:r,className:F(b(r)&&C),children:[e.jsxs(ce,{className:"flex gap-1 items-baseline",children:[a.displayName,a.optional&&e.jsx("span",{className:"text-gray-400",children:"(optional)"}),b(r)&&e.jsx("span",{className:"text-yellow-600 text-xs",children:e.jsx(P,{})})]}),e.jsx(fe,{children:a.type==="markdown"?e.jsx(ln,{id:r,name:r,register:s.register,className:"h-52",markdown:d.value,onChange:(j,A)=>{A||d.onChange(j)},placeholder:a.placeholder,fieldDisplayName:a.displayName}):a.type==="url"?e.jsx(un,{id:r,...s.register(r),placeholder:a.placeholder??"https://example.website/",...d,value:d.value}):a.type==="string"&&a.isUploadedFile?e.jsx(an,{id:r,name:r,register:s.register,value:d.value,onChange:d.onChange}):a.type==="date"?e.jsx(cn,{id:r,...s.register(r),date:d.value?new Date(d.value):void 0,onDateChange:j=>{d.onChange(j?j.toISOString():"")},placeholder:a.placeholder??"Select date",allowClear:a.optional}):a.type==="datetime"?e.jsx("div",{className:"relative",children:e.jsx(dn,{id:r,...s.register(r),date:d.value?new Date(d.value):void 0,onDateTimeChange:j=>{d.onChange(j?j.toISOString():"")},placeholder:a.placeholder??"Select date and time",allowClear:a.optional})}):a.type==="color"?e.jsx(pn,{id:r,value:d.value,onChange:d.onChange,placeholder:a.placeholder}):a.type==="number"?e.jsx(Ee,{id:r,...s.register(r,{valueAsNumber:!0}),type:"number",value:d.value,onChange:d.onChange,placeholder:a.placeholder}):a.type==="select"?e.jsxs("div",{className:"flex gap-2",children:[e.jsxs($e,{value:d.value,onValueChange:d.onChange,children:[e.jsx(Ke,{id:r,className:"w-full",children:e.jsx(We,{placeholder:a.placeholder??"Select an item..."})}),e.jsx(qe,{children:m.map(j=>e.jsx(Ge,{value:j,children:j},j))})]}),a.optional&&d.value&&e.jsxs(ke,{type:"button",variant:"outline",size:"icon",onClick:()=>d.onChange(""),className:"shrink-0",children:[e.jsx(Be,{size:16}),e.jsx("span",{className:"sr-only",children:"Clear selection"})]})]}):a.type==="multiselect"?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:"flex flex-wrap gap-2 min-h-[38px] p-2 border rounded-md bg-background",children:d.value?.length>0?d.value.map(j=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md text-sm font-medium bg-gray-100 text-black-800",children:[j,e.jsxs("button",{type:"button",onClick:()=>{const A=d.value.filter($=>$!==j);d.onChange(A)},className:"hover:bg-gray-200 rounded-sm p-0.5",children:[e.jsx(Be,{size:14}),e.jsxs("span",{className:"sr-only",children:["Remove ",j]})]})]},j)):e.jsx("span",{className:"text-muted-foreground text-sm",children:a.placeholder??"Select items..."})}),(!a.maxSelectedChoices||O<a.maxSelectedChoices)&&e.jsxs($e,{value:"",onValueChange:j=>{const A=d.value||[];A.includes(j)||d.onChange([...A,j])},children:[e.jsx(Ke,{id:r,className:"w-full",children:e.jsx(We,{placeholder:"Add item..."})}),e.jsx(qe,{children:m.filter(j=>!d.value?.includes(j)).map(j=>e.jsx(Ge,{value:j,children:j},j))})]}),z&&e.jsxs("span",{className:F("text-xs",a.minSelectedChoices&&O<a.minSelectedChoices?"text-destructive":"text-muted-foreground"),children:[O,a.minSelectedChoices&&a.maxSelectedChoices?`/${a.maxSelectedChoices} (min ${a.minSelectedChoices})`:a.minSelectedChoices?` selected (min ${a.minSelectedChoices})`:`/${a.maxSelectedChoices} selected`]})]}):e.jsx(Ee,{id:r,...s.register(r),placeholder:a.placeholder,...d,value:d.value})}),a.displayExtra&&e.jsx(Ne,{children:a.displayExtra}),e.jsx(he,{})]})}},r)}),e.jsxs(ke,{disabled:!s.formState.isDirty&&!p||s.formState.isSubmitting,type:"submit",children:[s.formState.isSubmitting?e.jsx(lo,{className:"animate-spin"}):e.jsx(go,{}),s.formState.isSubmitting?"Saving":s.watch("isDraft")==="true"?"Save Draft":"Save"]})]}),e.jsx(rn,{hasUnsavedChanges:!s.formState.isSubmitting&&s.formState.isDirty})]})]})}export{Xo as C,Rn as I,Yo as P,Wo as R,Pn as S,Ko as T,qo as V,Go as a,Zo as b,Co as c,Qo as d,Jo as e,yo as u};
|