@plumix/admin 0.6.0 → 0.7.0

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.
Files changed (80) hide show
  1. package/dist/assets/-errors-RB-rEi-I.js +1 -0
  2. package/dist/assets/{_-C6mMIz3l.js → _-DngjjFK4.js} +1 -1
  3. package/dist/assets/{_-CljmxTlS.js → _-h-_izgKQ.js} +2 -2
  4. package/dist/assets/_authenticated-Bgi03W1b.js +1 -0
  5. package/dist/assets/{_authenticated-kVO_-7Sn.js → _authenticated-CH4N_cSi.js} +2 -2
  6. package/dist/assets/{_authenticated-BYa_DMSE.js → _authenticated-E1SDZnP9.js} +1 -1
  7. package/dist/assets/{_name-aKYVqU32.js → _name-BEnhsrWI.js} +2 -2
  8. package/dist/assets/{_name-BGOHegOZ.js → _name-DQVev0AG.js} +1 -1
  9. package/dist/assets/_page-D0l1kYXx.js +1 -0
  10. package/dist/assets/_page-wrWlHYyD.js +2 -0
  11. package/dist/assets/{_slug-Bdb7jL1l.js → _slug-BfC_rJhz.js} +1 -1
  12. package/dist/assets/{_slug-DWmiGCz6.js → _slug-Bztim-i3.js} +2 -2
  13. package/dist/assets/{_token-s0TefqyQ.js → _token-D-j4VVVI.js} +1 -1
  14. package/dist/assets/{_token-DVnFp6Xw.js → _token-Dsc9zTxr.js} +2 -2
  15. package/dist/assets/{allowed-domains-CQYTKIje.js → allowed-domains-B6oGNO8i.js} +1 -1
  16. package/dist/assets/{ar-Dh1_Madu.js → ar-D0lPKYVq.js} +1 -1
  17. package/dist/assets/{bootstrap-DAMkwOTO.js → bootstrap-Dbv-AIOo.js} +2 -2
  18. package/dist/assets/{bootstrap-oBDU-2AF.js → bootstrap-jj58lGRM.js} +1 -1
  19. package/dist/assets/breadcrumb-Di_E7s51.js +1 -0
  20. package/dist/assets/{create-CaxQlu5L.js → create-CXFn-yel.js} +1 -1
  21. package/dist/assets/{create-DQ5AIyqG.js → create-Cvo5wKBV.js} +2 -2
  22. package/dist/assets/{create-DgEbjT-H.js → create-CylSqfDG.js} +1 -1
  23. package/dist/assets/create-Dg10UEnK.js +1 -0
  24. package/dist/assets/{create-CICYrKqG.js → create-DnLK3SmI.js} +2 -2
  25. package/dist/assets/{de-BDyIkMJC.js → de-ByPNuZ6R.js} +1 -1
  26. package/dist/assets/{device-COTq1gdI.js → device-CxnTgMZ6.js} +1 -1
  27. package/dist/assets/{device-Ae_X8x7B.js → device-vY_uxsCV.js} +2 -2
  28. package/dist/assets/{edit-BAIuOGAs.js → edit-2aEJRHSG.js} +3 -3
  29. package/dist/assets/edit-BPw2fZ5B.js +1 -0
  30. package/dist/assets/{edit-BskWld1E.js → edit-BRhq3mGx.js} +2 -2
  31. package/dist/assets/{edit-DtsKHyYT.js → edit-Cc5hxhM7.js} +2 -2
  32. package/dist/assets/{edit-DLcsu05p.js → edit-Cu_XtYMX.js} +1 -1
  33. package/dist/assets/edit-D9-iSIWu.js +2 -0
  34. package/dist/assets/edit-DOoYH9tG.js +1 -0
  35. package/dist/assets/{en-DYui4aSX.js → en-LRPc5lfW.js} +1 -1
  36. package/dist/assets/form-CY307HEl.js +1 -0
  37. package/dist/assets/index-B9lFt9M4.css +1 -0
  38. package/dist/assets/{index-MLqJwsKQ.js → index-D7rrOihJ.js} +3 -3
  39. package/dist/assets/json-code-editor-9PGQwSkN.js +12 -0
  40. package/dist/assets/{login-DU7y_Ylt.js → login-0-PQLYlS.js} +2 -2
  41. package/dist/assets/{login-Bify50W1.js → login-Dk-LKP1e.js} +1 -1
  42. package/dist/assets/{mailer-DoyD5gWW.js → mailer-BemLhNOI.js} +1 -1
  43. package/dist/assets/{mailer-DeygotUf.js → mailer-CTVZRBU2.js} +2 -2
  44. package/dist/assets/manifest-2YUNz_ML.js +1 -0
  45. package/dist/assets/meta-box-CwZHh0Nj.js +1 -0
  46. package/dist/assets/meta-field-errors-Za3ulViR.js +1 -0
  47. package/dist/assets/{palette-commands-DX18c0wH.js → palette-commands-Di6Dnj4z.js} +2 -2
  48. package/dist/assets/{plugin-registry-nSDhEMki.js → plugin-registry-DLDusPOA.js} +1 -1
  49. package/dist/assets/{register-core-blocks-Bh6u65qH.js → register-core-blocks-CVavxPiP.js} +1 -1
  50. package/dist/assets/rich-text-field-DGgpOqHQ.js +123 -0
  51. package/dist/assets/{search-input-BG9KotQw.js → search-input-B7zZp8UE.js} +2 -2
  52. package/dist/assets/{settings-CXPqdjqb.js → settings-199pUzJn.js} +1 -1
  53. package/dist/assets/{settings-BtTviWkj.js → settings-DZyJ36D2.js} +2 -2
  54. package/dist/assets/{toast-CWtRg47-.js → toast-26daCjvR.js} +1 -1
  55. package/dist/assets/{uk-Cq7H12wQ.js → uk-CTQT1XuD.js} +1 -1
  56. package/dist/assets/use-visible-fields-C0FKrnz6.js +2 -0
  57. package/dist/assets/{users-DzXByAic.js → users-BmZY207i.js} +1 -1
  58. package/dist/assets/{users-CMJAWmSV.js → users-ZRNKnWGa.js} +2 -2
  59. package/dist/assets/{utils-kFAy0YTP.js → utils-RSNxndzY.js} +2 -2
  60. package/dist/assets/{valibot-DO4fmSyX.js → valibot-CHirPb_E.js} +1 -1
  61. package/dist/assets/w3c-keyname-BOAvb0qz.js +1 -0
  62. package/dist/assets/{zh-CN-YIfV5Hug.js → zh-CN-g4V81dTW.js} +1 -1
  63. package/dist/index.html +23 -23
  64. package/package.json +9 -5
  65. package/dist/assets/-errors-CapunOga.js +0 -1
  66. package/dist/assets/_authenticated-Dcp2Ynic.js +0 -1
  67. package/dist/assets/_page--PcGMzdu.js +0 -2
  68. package/dist/assets/_page-Be9sR1G2.js +0 -1
  69. package/dist/assets/breadcrumb-x0qfIbU9.js +0 -1
  70. package/dist/assets/create-3wo13Gal.js +0 -1
  71. package/dist/assets/edit-DU82eAhY.js +0 -1
  72. package/dist/assets/edit-Ds4B6Pmi.js +0 -2
  73. package/dist/assets/edit-evcBUaDE.js +0 -1
  74. package/dist/assets/form-B_PPIck3.js +0 -1
  75. package/dist/assets/index-BtnQdcjJ.css +0 -1
  76. package/dist/assets/manifest-Bdiv3Qyq.js +0 -1
  77. package/dist/assets/meta-box-B-hP57rw.js +0 -1
  78. package/dist/assets/meta-box-field-BTDudxyS.js +0 -1
  79. package/dist/assets/meta-box-grid-CoW6o7O7.js +0 -1
  80. package/dist/assets/rich-text-field-CS-OOttw.js +0 -123
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{n}from"./dist-BL2bKHuR.js";import{a as r,i,n as a,r as o,t as s}from"./select-D3kIVy0H.js";import{t as c}from"./button-DG1Ca1S5.js";import{t as l}from"./textarea-iIsBg5jH.js";import{t as u}from"./use-label-CykSHq9A.js";import{D as d,b as f,d as p,h as m,k as h,l as g,p as _,w as v,x as y,y as b}from"./dist-ClOzYsk5.js";import{n as x}from"./vmessage-CRX68a8a.js";import{n as S}from"./validation-Cl_jr4SS.js";import{t as C}from"./input-xYuLUQID.js";import{a as w,f as T,i as E,n as D,o as O,s as k,t as A}from"./form-CY307HEl.js";import{n as j,t as M}from"./alert-cwX3fWUu.js";import{t as N}from"./valibot-CHirPb_E.js";import{t as P}from"./meta-box-CwZHh0Nj.js";import{r as F,t as I}from"./meta-field-errors-Za3ulViR.js";var L=e(t(),1),R={slugFormat:{id:`termForm.slug.format`},rootOption:{id:`termForm.parent.rootOption`}},z=`__root__`,B=m({name:b(v(),d(),p(1),g(200)),slug:b(v(),d(),g(200),y(/^[a-z0-9-]*$/,x(R.slugFormat))),description:b(v(),d(),g(2e3)),parentId:_(S),meta:f(v(),h())});function V({initialValues:e,isHierarchical:t,parentOptions:d,isSubmitting:f,serverError:p,serverFieldErrors:m,submitLabel:h,metaBoxes:g,onSubmit:_,onCancel:v}){let y=u(),b=T({resolver:N(B),defaultValues:e});F(b,I,m);let x=b.handleSubmit(e=>{_(e)});return(0,L.jsx)(A,{...b,children:(0,L.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:x,children:[(0,L.jsx)(E,{control:b.control,name:`name`,render:({field:e})=>(0,L.jsxs)(w,{children:[(0,L.jsx)(O,{children:(0,L.jsx)(n,{id:`termForm.name`,message:`Name`})}),(0,L.jsx)(D,{children:(0,L.jsx)(C,{type:`text`,required:!0,disabled:f,"data-testid":`term-form-name-input`,...e})}),(0,L.jsx)(k,{})]})}),(0,L.jsx)(E,{control:b.control,name:`slug`,render:({field:e})=>(0,L.jsxs)(w,{children:[(0,L.jsx)(O,{children:(0,L.jsx)(n,{id:`termForm.slug`,message:`Slug`})}),(0,L.jsx)(D,{children:(0,L.jsx)(C,{type:`text`,autoComplete:`off`,disabled:f,"data-testid":`term-form-slug-input`,...e})}),(0,L.jsx)(k,{})]})}),(0,L.jsx)(E,{control:b.control,name:`description`,render:({field:e})=>(0,L.jsxs)(w,{children:[(0,L.jsx)(O,{children:(0,L.jsx)(n,{id:`termForm.description`,message:`Description`})}),(0,L.jsx)(D,{children:(0,L.jsx)(l,{...e,disabled:f,rows:3,"data-testid":`term-form-description-input`,className:`min-h-20`})}),(0,L.jsx)(k,{})]})}),t?(0,L.jsx)(E,{control:b.control,name:`parentId`,render:({field:e})=>(0,L.jsxs)(w,{children:[(0,L.jsx)(O,{children:(0,L.jsx)(n,{id:`termForm.parent`,message:`Parent`})}),(0,L.jsxs)(s,{value:e.value==null?z:String(e.value),onValueChange:t=>{e.onChange(t===z?null:Number(t))},disabled:f,children:[(0,L.jsx)(D,{children:(0,L.jsx)(i,{className:`w-full`,onBlur:e.onBlur,"data-testid":`term-form-parent-select`,children:(0,L.jsx)(r,{})})}),(0,L.jsxs)(a,{children:[(0,L.jsx)(o,{value:z,"data-testid":`term-form-parent-select-option-root`,children:y(R.rootOption)}),d.map(e=>(0,L.jsx)(o,{value:String(e.id),"data-testid":`term-form-parent-select-option-${e.id}`,children:e.label},e.id))]})]}),(0,L.jsx)(k,{})]})}):null,g.map(e=>(0,L.jsx)(P,{box:e,basePath:`meta`,disabled:f},e.id)),p?(0,L.jsx)(M,{variant:`destructive`,"data-testid":`term-form-server-error`,children:(0,L.jsx)(j,{children:y(p)})}):null,(0,L.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,L.jsx)(c,{type:`button`,variant:`outline`,onClick:v,disabled:f,children:(0,L.jsx)(n,{id:`termForm.cancel`,message:`Cancel`})}),(0,L.jsx)(c,{type:`submit`,disabled:f,"data-testid":`term-form-submit`,children:f?(0,L.jsx)(n,{id:`termForm.submitting`,message:`Saving…`}):y(h)})]})]})})}var H={slug_taken:{id:`terms.error.slugTaken`},parent_mismatch:{id:`terms.error.parentMismatch`},parent_self_or_cycle:{id:`terms.error.parentSelfOrCycle`}};function U(){let e=u();return(t,n)=>{let r=W(t);return r===`slug_taken`?e(H.slug_taken):r===`parent_mismatch`?e(H.parent_mismatch):r===`parent_is_self`||r===`parent_cycle`?e(H.parent_self_or_cycle):t instanceof Error?t.message:n}}function W(e){if(e&&typeof e==`object`&&`data`in e)return e.data?.reason}export{V as n,U as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a}from"./use-label-CykSHq9A.js";import{t as o}from"./edit-skeleton-oIsvepSM.js";import{t as s}from"./_-CljmxTlS.js";import{r as c}from"./plugin-registry-nSDhEMki.js";import{t as l}from"./plugin-error-boundary-FjZbsCsp.js";var u=e(n()),d=e(t()),f={loadingAria:{id:`pluginPage.loading.aria`}};function p(){let{navItem:e}=s.useRouteContext(),{i18n:t}=r(),n=a()(e.label),i=e.to.replace(/^\/pages/,``),p=c(i);return p?(0,d.jsx)(l,{kind:`page`,pluginLabel:n,children:(0,d.jsx)(u.Suspense,{fallback:(0,d.jsx)(o,{ariaLabel:t._(f.loadingAria.id,{label:n},{message:f.loadingAria.message}),testId:`plugin-page__loading__${i}`}),children:(0,d.jsx)(p,{})})}):(0,d.jsx)(m,{path:i})}function m({path:e}){return(0,d.jsxs)(`div`,{className:`mx-auto max-w-2xl py-12`,"data-testid":`plugin-page__not-loaded__${e}`,children:[(0,d.jsx)(`h1`,{className:`text-2xl font-semibold`,children:(0,d.jsx)(i,{id:`pluginPage.notLoaded.title`,message:`Plugin not loaded`})}),(0,d.jsx)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:(0,d.jsx)(i,{id:`pluginPage.notLoaded.body`,message:`The admin manifest declares a page at <code>{path}</code> but no React component has been registered for it.`,values:{path:e},components:{code:(0,d.jsx)(`code`,{className:`font-mono`})},comment:`path: the manifest-declared admin-route path (e.g. '/audit-log'); pass through verbatim`})})]})}export{p as component};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a}from"./use-label-CykSHq9A.js";import{t as o}from"./edit-skeleton-oIsvepSM.js";import{t as s}from"./_-h-_izgKQ.js";import{r as c}from"./plugin-registry-DLDusPOA.js";import{t as l}from"./plugin-error-boundary-FjZbsCsp.js";var u=e(n()),d=e(t()),f={loadingAria:{id:`pluginPage.loading.aria`}};function p(){let{navItem:e}=s.useRouteContext(),{i18n:t}=r(),n=a()(e.label),i=e.to.replace(/^\/pages/,``),p=c(i);return p?(0,d.jsx)(l,{kind:`page`,pluginLabel:n,children:(0,d.jsx)(u.Suspense,{fallback:(0,d.jsx)(o,{ariaLabel:t._(f.loadingAria.id,{label:n},{message:f.loadingAria.message}),testId:`plugin-page__loading__${i}`}),children:(0,d.jsx)(p,{})})}):(0,d.jsx)(m,{path:i})}function m({path:e}){return(0,d.jsxs)(`div`,{className:`mx-auto max-w-2xl py-12`,"data-testid":`plugin-page__not-loaded__${e}`,children:[(0,d.jsx)(`h1`,{className:`text-2xl font-semibold`,children:(0,d.jsx)(i,{id:`pluginPage.notLoaded.title`,message:`Plugin not loaded`})}),(0,d.jsx)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:(0,d.jsx)(i,{id:`pluginPage.notLoaded.body`,message:`The admin manifest declares a page at <code>{path}</code> but no React component has been registered for it.`,values:{path:e},components:{code:(0,d.jsx)(`code`,{className:`font-mono`})},comment:`path: the manifest-declared admin-route path (e.g. '/audit-log'); pass through verbatim`})})]})}export{p as component};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_-C6mMIz3l.js","./jsx-runtime-DUAcabCT.js","./react-DbyrFoBd.js","./dist-BL2bKHuR.js","./use-label-CykSHq9A.js","./edit-skeleton-oIsvepSM.js","./card-L2-kK5VK.js","./utils-DKOQrNEG.js","./skeleton-BnBM1862.js","./plugin-registry-nSDhEMki.js","./errors-BDz8PxwA.js","./plugin-error-boundary-FjZbsCsp.js","./dist-DKhWWf1L.js","./triangle-alert-BpzHmkii.js","./createLucideIcon-C0O-yxZG.js","./alert-cwX3fWUu.js"])))=>i.map(i=>d[i]);
2
- import{T as e,a as t,t as n}from"./lazyRouteComponent-CQbKoKTD.js";import{i as r,s as i}from"./matchContext-DKtpdvCQ.js";import{i as a}from"./manifest-Bdiv3Qyq.js";import{t as o}from"./caps-SYhabp1B.js";var s=t(`/_authenticated/pages/$`)({beforeLoad:({context:e,params:t})=>{let n=t._splat;if(!n)throw i();let s=a(`/pages/${n}`);if(!s)throw i();if(s.capability&&!o(e.user.capabilities,s.capability))throw r({to:`/`});return{navItem:s}},component:n(()=>e(()=>import(`./_-C6mMIz3l.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url),`component`)});export{s as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_-DngjjFK4.js","./jsx-runtime-DUAcabCT.js","./react-DbyrFoBd.js","./dist-BL2bKHuR.js","./use-label-CykSHq9A.js","./edit-skeleton-oIsvepSM.js","./card-L2-kK5VK.js","./utils-DKOQrNEG.js","./skeleton-BnBM1862.js","./plugin-registry-DLDusPOA.js","./errors-BDz8PxwA.js","./plugin-error-boundary-FjZbsCsp.js","./dist-DKhWWf1L.js","./triangle-alert-BpzHmkii.js","./createLucideIcon-C0O-yxZG.js","./alert-cwX3fWUu.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,a as t,t as n}from"./lazyRouteComponent-CQbKoKTD.js";import{i as r,s as i}from"./matchContext-DKtpdvCQ.js";import{i as a}from"./manifest-2YUNz_ML.js";import{t as o}from"./caps-SYhabp1B.js";var s=t(`/_authenticated/pages/$`)({beforeLoad:({context:e,params:t})=>{let n=t._splat;if(!n)throw i();let s=a(`/pages/${n}`);if(!s)throw i();if(s.capability&&!o(e.user.capabilities,s.capability))throw r({to:`/`});return{navItem:s}},component:n(()=>e(()=>import(`./_-DngjjFK4.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url),`component`)});export{s as t};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{s as a,t as o}from"./orpc-CmtRGLtZ.js";import{t as ee}from"./useQuery-QAYxQfCx.js";import{t as s}from"./useMutation-vgMtqBOX.js";import{n as c}from"./useStore-Vo4KhxPy.js";import{n as l}from"./Match-Dr0Ejexl.js";import{o as u,t as d}from"./link-CI3qhqYu.js";import{a as f,i as p,o as m,r as h,t as te}from"./palette-commands-Di6Dnj4z.js";import{t as g}from"./createLucideIcon-C0O-yxZG.js";import{A as _,B as v,C as y,D as b,E as x,F as S,H as C,L as ne,M as re,N as ie,O as ae,P as oe,R as w,S as se,T as ce,U as le,V as ue,_ as de,a as fe,b as pe,d as me,f as T,g as he,i as ge,j as E,k as D,l as O,m as k,n as A,o as j,p as M,r as N,s as P,t as F,u as I,w as L,x as _e,y as ve,z as R}from"./breadcrumb-Di_E7s51.js";import{t as ye}from"./chevrons-up-down-DmmG8bmI.js";import{n as z,t as B}from"./puzzle-CkL6fcG1.js";import{t as be}from"./image-CYG4gQQy.js";import{t as V}from"./settings-K6TF73jB.js";import{t as H}from"./use-label-CykSHq9A.js";import{h as U,n as W}from"./manifest-2YUNz_ML.js";import{t as xe}from"./session-Y-9LAiv-.js";import{i as Se}from"./passkey-DN4QfROE.js";import{t as Ce}from"./separator-DzRLZTkg.js";import{r as we}from"./tooltip-Bf2rZUeB.js";var Te=g(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Ee=g(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),De=g(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Oe=g(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),ke=g(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Ae=g(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),je=g(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),Me=g(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Ne=g(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Pe=g(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),G=e(t(),1),Fe={dashboard:Oe,content:z,"file-text":z,layout:je,image:be,calendar:Te,tag:Me,folder:Ee,users:Pe,settings:V,puzzle:B,mail:Ae,key:De};function K({name:e}){return(0,G.jsx)(e?Fe[e]:B,{})}function Ie({user:e}){let{isMobile:t}=le(),n=c(),r=s({mutationFn:Se,onSettled:async e=>{if(await n.invalidate(),n.options.context.queryClient.removeQueries({queryKey:xe}),e?.redirectTo){window.location.assign(e.redirectTo);return}await n.navigate({to:`/login`})}}),a=e.name??e.email,o=a.slice(0,2).toUpperCase();return(0,G.jsxs)(_e,{children:[(0,G.jsx)(b,{asChild:!0,children:(0,G.jsxs)(R,{size:`lg`,"data-testid":`user-menu-trigger`,className:`data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground`,children:[(0,G.jsx)(ae,{className:`size-8`,children:(0,G.jsx)(D,{className:`bg-sidebar-accent text-sidebar-accent-foreground text-xs font-semibold`,children:o})}),(0,G.jsxs)(`div`,{className:`grid flex-1 text-start text-sm leading-tight`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium`,children:a}),(0,G.jsx)(`span`,{className:`text-muted-foreground truncate text-xs`,children:e.email})]}),(0,G.jsx)(ye,{className:`ms-auto size-4`})]})}),(0,G.jsxs)(se,{className:`w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg`,side:t?`bottom`:`right`,align:`end`,sideOffset:4,children:[(0,G.jsx)(ce,{className:`p-0 font-normal`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1.5 text-start text-sm`,children:[(0,G.jsx)(`div`,{"aria-hidden":!0,className:`bg-sidebar-accent text-sidebar-accent-foreground flex size-8 items-center justify-center rounded-md text-xs font-semibold`,children:o}),(0,G.jsxs)(`div`,{className:`grid flex-1 text-start text-sm leading-tight`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium`,children:a}),(0,G.jsx)(`span`,{className:`text-muted-foreground truncate text-xs`,children:e.email})]})]})}),(0,G.jsx)(x,{}),(0,G.jsxs)(y,{children:[(0,G.jsx)(L,{asChild:!0,children:(0,G.jsxs)(d,{to:`/profile`,"data-testid":`user-menu-profile-link`,children:[(0,G.jsx)(Ne,{className:`size-4`}),(0,G.jsx)(i,{id:`menu.profile`,message:`Profile`})]})}),(0,G.jsxs)(L,{disabled:!0,children:[(0,G.jsx)(V,{className:`size-4`}),(0,G.jsx)(i,{id:`menu.settings`,message:`Settings`})]})]}),(0,G.jsx)(x,{}),(0,G.jsxs)(L,{onSelect:()=>r.mutate(),disabled:r.isPending,"data-testid":`user-menu-sign-out`,children:[(0,G.jsx)(ke,{className:`size-4`}),r.isPending?(0,G.jsx)(i,{id:`menu.signOut.pending`,message:`Signing out…`}):(0,G.jsx)(i,{id:`menu.signOut`,message:`Sign out`})]})]})]})}function Le({user:e,capabilities:t}){let n=U(t),r=H();return(0,G.jsxs)(_,{collapsible:`icon`,variant:`inset`,children:[(0,G.jsx)(E,{children:n.map(e=>(0,G.jsxs)(ie,{children:[(0,G.jsx)(S,{children:r(e.label)}),(0,G.jsx)(oe,{children:(0,G.jsx)(w,{children:e.items.map(e=>(0,G.jsx)(v,{children:(0,G.jsx)(R,{asChild:!0,tooltip:r(e.label),children:(0,G.jsxs)(d,{to:e.to,activeProps:{"data-active":`true`},activeOptions:{exact:e.exact??!1},children:[(0,G.jsx)(K,{name:e.coreIcon}),(0,G.jsx)(`span`,{children:r(e.label)})]})})},e.to))})})]},e.id))}),(0,G.jsx)(re,{children:(0,G.jsx)(w,{children:(0,G.jsx)(v,{children:(0,G.jsx)(Ie,{user:e})})})})]})}var q=e(n(),1);function Re(e,t){return U(e,t).flatMap(e=>e.items.map(e=>({to:e.to,label:e.label,...e.coreIcon?{coreIcon:e.coreIcon}:{},...e.keywords?{keywords:e.keywords}:{}})))}function ze(e,t,n){let r=t.trim().toLowerCase();return r.length===0?e:e.filter(e=>[e.label,...e.keywords??[]].map(n).join(` `).toLowerCase().includes(r))}function J(e){let t=e.indexOf(`:`);return t===-1?{domain:e,name:``}:{domain:e.slice(0,t),name:e.slice(t+1)}}function Be(e,t,n){let{domain:r,name:i}=J(e),o=encodeURIComponent(t);switch(r){case`entry`:return`${a}/entries/${encodeURIComponent(n(i))}/${o}/edit`;case`term`:return`${a}/terms/${encodeURIComponent(i)}/${o}/edit`;case`users`:return`${a}/users/${o}/edit`;default:return null}}function Ve(e){return e.metaKey||e.ctrlKey}var Y=`plumix.v2.palette.recent`,He=8;function Ue(e){try{let t=[e,...X().filter(t=>t!==e)].slice(0,He);localStorage.setItem(Y,JSON.stringify(t))}catch{}}function X(){try{let e=localStorage.getItem(Y);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function We(e,t,n){let r=new Map(e.map(e=>[e.to,e])),i=[];for(let e of t){let t=r.get(e);if(t&&i.push(t),i.length>=n)break}return i}var Z=2,Ge=250,Q=5,$={title:{id:`palette.title`},description:{id:`palette.description`},placeholder:{id:`palette.placeholder`},empty:{id:`palette.empty`},noTitle:{id:`entries.list.noTitle`},navigation:{id:`palette.group.navigation`},recent:{id:`palette.group.recent`},commands:{id:`palette.group.commands`},loading:{id:`palette.loading`},hintNavigate:{id:`palette.hint.navigate`},hintSelect:{id:`palette.hint.select`},hintClose:{id:`palette.hint.close`}},Ke=[{id:`core:profile`,title:{id:`palette.command.profile`},coreIcon:`users`,run:({navigate:e})=>void e({to:`/profile`})},{id:`core:settings`,title:{id:`palette.command.settings`},coreIcon:`settings`,capability:`settings:manage`,run:({navigate:e})=>void e({to:`/settings`})}];function qe(e,t){let[n,r]=(0,q.useState)(e);return(0,q.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function Je({capabilities:e}){let[t,n]=(0,q.useState)(!1),[r,i]=(0,q.useState)(``),a=u(),s=H(),c=(0,q.useRef)(!1);(0,q.useEffect)(()=>{function e(e){e.key===`k`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),n(e=>!e))}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[]);let l=r.trim(),d=qe(l,Ge),f=ee(o.search.query.queryOptions({input:{query:d},enabled:t&&d.length>=Z})),p=h([...Ke,...te()],e,l,s),m=ze(Re(e),l,s),g=t&&l.length===0?We(m,X(),Q):[],_=l.length>=Z?f.data??[]:[],v=l.length>=Z&&(l!==d||f.isFetching);function y(){n(!1),i(``)}function b(e){Ue(e),y(),a({to:e})}function x(e,t){let n=c.current;if(c.current=!1,y(),n){let n=Be(e,t,e=>W(e)?.adminSlug??e);n&&window.open(n,`_blank`,`noopener,noreferrer`);return}let{domain:r,name:i}=J(e);switch(r){case`entry`:{let e=W(i)?.adminSlug??i;a({to:`/entries/$slug/$id/edit`,params:{slug:e,id:Number(t)}});return}case`term`:a({to:`/terms/$name/$id/edit`,params:{name:i,id:Number(t)}});return;case`users`:a({to:`/users/$id/edit`,params:{id:Number(t)}});return}}function S(e){c.current=Ve(e)}return(0,G.jsxs)(k,{open:t,onOpenChange:e=>{n(e),e||i(``)},children:[(0,G.jsxs)(ve,{className:`sr-only`,children:[(0,G.jsx)(pe,{children:s($.title)}),(0,G.jsx)(de,{children:s($.description)})]}),(0,G.jsx)(he,{className:`overflow-hidden p-0`,children:(0,G.jsxs)(P,{shouldFilter:!1,onClickCapture:S,onKeyDown:e=>{e.key===`Enter`&&S(e)},children:[(0,G.jsx)(me,{value:r,onValueChange:i,"data-testid":`command-palette-input`,placeholder:s($.placeholder)}),(0,G.jsxs)(M,{children:[v?(0,G.jsx)(`div`,{"data-testid":`command-palette-loading`,className:`text-muted-foreground px-3 py-2 text-sm`,children:s($.loading)}):(0,G.jsx)(O,{children:s($.empty)}),g.length>0?(0,G.jsx)(I,{heading:s($.recent),children:g.map(e=>(0,G.jsxs)(T,{value:`recent:${e.to}`,"data-testid":`command-palette-recent-${e.to}`,onSelect:()=>{b(e.to)},children:[(0,G.jsx)(K,{name:e.coreIcon}),(0,G.jsx)(`span`,{children:s(e.label)})]},`recent:${e.to}`))}):null,p.length>0?(0,G.jsx)(I,{heading:s($.commands),children:p.map(e=>(0,G.jsxs)(T,{value:e.id,"data-testid":`command-palette-command-${e.id}`,onSelect:()=>{y(),e.run({navigate:a})},children:[e.coreIcon?(0,G.jsx)(K,{name:e.coreIcon}):null,(0,G.jsx)(`span`,{children:s(e.title)})]},e.id))}):null,m.length>0?(0,G.jsx)(I,{heading:s($.navigation),children:m.map(e=>(0,G.jsxs)(T,{value:e.to,"data-testid":`command-palette-nav-${e.to}`,onSelect:()=>{b(e.to)},children:[(0,G.jsx)(K,{name:e.coreIcon}),(0,G.jsx)(`span`,{children:s(e.label)})]},e.to))}):null,_.map(e=>(0,G.jsx)(I,{heading:s(e.label),children:e.items.map(t=>(0,G.jsx)(T,{value:`${e.key}:${t.id}`,"data-testid":`command-palette-result-${e.key}:${t.id}`,onSelect:()=>{x(e.key,t.id)},children:(0,G.jsx)(`span`,{children:t.title||s($.noTitle)})},`${e.key}:${t.id}`))},e.key))]}),(0,G.jsxs)(`div`,{"data-testid":`command-palette-footer`,className:`text-muted-foreground flex items-center gap-4 border-t px-3 py-2 text-xs`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(j,{children:`↑↓`}),s($.hintNavigate)]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(j,{children:`↵`}),s($.hintSelect)]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(j,{children:`⎋`}),s($.hintClose)]})]})]})})]})}function Ye(){return f(m({select:e=>e.location.pathname}))}function Xe(){let e=Ye(),{i18n:t}=r(),n=e=>typeof e.label==`string`?e.label:t._(e.label.id,e.values,{message:e.label.message});return(0,G.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center gap-2 border-b px-4`,children:[(0,G.jsx)(C,{className:`-ms-1`}),(0,G.jsx)(Ce,{orientation:`vertical`,className:`me-2 h-4`}),(0,G.jsx)(F,{children:(0,G.jsx)(N,{children:e.map((t,r)=>{let i=r===e.length-1,a=n(t);return(0,G.jsxs)(q.Fragment,{children:[r>0?(0,G.jsx)(fe,{}):null,(0,G.jsx)(A,{children:i?(0,G.jsx)(ge,{children:a}):t.to===void 0?(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:a}):(0,G.jsx)(d,{to:t.to,className:`text-muted-foreground hover:text-foreground transition-colors`,children:a})})]},`${String(r)}-${a}`)})})})]})}function Ze(){let{user:e}=p.useRouteContext();return(0,G.jsx)(we,{delayDuration:100,children:(0,G.jsxs)(ue,{children:[(0,G.jsx)(Je,{capabilities:e.capabilities}),(0,G.jsx)(Le,{user:e,capabilities:e.capabilities}),(0,G.jsxs)(ne,{children:[(0,G.jsx)(Xe,{}),(0,G.jsx)(`main`,{className:`flex-1 overflow-y-auto p-6`,children:(0,G.jsx)(l,{})})]})]})})}export{Ze as component};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_authenticated-BYa_DMSE.js","./jsx-runtime-DUAcabCT.js","./react-DbyrFoBd.js","./dist-BL2bKHuR.js","./orpc-CmtRGLtZ.js","./useQuery-QAYxQfCx.js","./link-CI3qhqYu.js","./react-dom-i-Mcm3wj.js","./useStore-Vo4KhxPy.js","./with-selector-Bf4HMdmS.js","./button-DG1Ca1S5.js","./dist-Dgy1ZZMQ.js","./utils-DKOQrNEG.js","./dist-B66OmIyr.js","./empty-p3QKoEqD.js","./createLucideIcon-C0O-yxZG.js","./puzzle-CkL6fcG1.js","./use-label-CykSHq9A.js","./manifest-Bdiv3Qyq.js","./style-emitter-CDGtTiRG.js","./use-formatters-DLJOFcWE.js","./dist-DKhWWf1L.js","./card-L2-kK5VK.js","./skeleton-BnBM1862.js","./plugin-registry-nSDhEMki.js","./errors-BDz8PxwA.js","./dates-CSmOj6E-.js","./entries-MizUUcD8.js","./plugin-error-boundary-FjZbsCsp.js","./triangle-alert-BpzHmkii.js","./alert-cwX3fWUu.js"])))=>i.map(i=>d[i]);
2
- import{T as e,a as t,t as n}from"./lazyRouteComponent-CQbKoKTD.js";var r=t(`/_authenticated/`)({component:n(()=>e(()=>import(`./_authenticated-BYa_DMSE.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]),import.meta.url),`component`)});export{r as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_authenticated-E1SDZnP9.js","./jsx-runtime-DUAcabCT.js","./react-DbyrFoBd.js","./dist-BL2bKHuR.js","./orpc-CmtRGLtZ.js","./useQuery-QAYxQfCx.js","./link-CI3qhqYu.js","./react-dom-i-Mcm3wj.js","./useStore-Vo4KhxPy.js","./with-selector-Bf4HMdmS.js","./button-DG1Ca1S5.js","./dist-Dgy1ZZMQ.js","./utils-DKOQrNEG.js","./dist-B66OmIyr.js","./empty-p3QKoEqD.js","./createLucideIcon-C0O-yxZG.js","./puzzle-CkL6fcG1.js","./use-label-CykSHq9A.js","./manifest-2YUNz_ML.js","./style-emitter-CDGtTiRG.js","./use-formatters-DLJOFcWE.js","./dist-DKhWWf1L.js","./card-L2-kK5VK.js","./skeleton-BnBM1862.js","./plugin-registry-DLDusPOA.js","./errors-BDz8PxwA.js","./dates-CSmOj6E-.js","./entries-MizUUcD8.js","./plugin-error-boundary-FjZbsCsp.js","./triangle-alert-BpzHmkii.js","./alert-cwX3fWUu.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,a as t,t as n}from"./lazyRouteComponent-CQbKoKTD.js";var r=t(`/_authenticated/`)({component:n(()=>e(()=>import(`./_authenticated-E1SDZnP9.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]),import.meta.url),`component`)});export{r as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a}from"./orpc-CmtRGLtZ.js";import{t as o}from"./useQuery-QAYxQfCx.js";import{t as s}from"./link-CI3qhqYu.js";import{t as c}from"./button-DG1Ca1S5.js";import{a as l,i as u,o as d,r as f,t as p}from"./empty-p3QKoEqD.js";import{t as m}from"./createLucideIcon-C0O-yxZG.js";import{n as h,t as g}from"./puzzle-CkL6fcG1.js";import{t as _}from"./use-label-CykSHq9A.js";import{g as v,h as y}from"./manifest-Bdiv3Qyq.js";import{t as b}from"./_authenticated-kVO_-7Sn.js";import{t as x}from"./use-formatters-DLJOFcWE.js";import{a as S,i as C,n as w,r as T,t as E}from"./card-L2-kK5VK.js";import{t as D}from"./skeleton-BnBM1862.js";import{t as O}from"./plugin-registry-nSDhEMki.js";import{t as k}from"./dates-CSmOj6E-.js";import{t as A}from"./entries-MizUUcD8.js";import{t as j}from"./plugin-error-boundary-FjZbsCsp.js";var M=m(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),N=e(n(),1),P=e(t(),1);function F({widgets:e}){let t=_(),n=e.flatMap(e=>{let t=O(e.id);return t?[{widget:e,Component:t}]:[]});return n.length===0?null:(0,P.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,"data-testid":`dashboard-widgets`,children:n.map(({widget:e,Component:n})=>(0,P.jsxs)(E,{"data-testid":`dashboard-widget-${e.id}`,children:[(0,P.jsx)(C,{children:(0,P.jsx)(S,{children:t(e.title)})}),(0,P.jsx)(w,{children:(0,P.jsx)(j,{kind:`widget`,pluginLabel:t(e.title),children:(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(D,{className:`h-16 w-full`}),children:(0,P.jsx)(n,{})})})})]},e.id))})}var I={countPublished:{id:`dashboard.count.published`},countDraft:{id:`dashboard.count.draft`}};function L(){let{user:e}=b.useRouteContext(),t=e.name??e.email,n=v(e.capabilities),m=_(),{i18n:D}=r(),{formatRelative:O}=x(),j=o(a.entry.stats.queryOptions({input:{}})),L=o(a.entry.recentActivity.queryOptions({input:{limit:8}})),R=(0,N.useMemo)(()=>{let e={};for(let t of j.data??[])(e[t.type]??={})[t.status]=t.count;return e},[j.data]);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{"data-testid":`dashboard-welcome-heading`,className:`text-2xl font-semibold`,children:(0,P.jsx)(i,{id:`dashboard.welcome`,message:`Welcome, {greeting}`,values:{greeting:(0,P.jsx)(`bdi`,{children:t})},comment:`greeting: the user's display name or email`})}),(0,P.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,P.jsx)(i,{id:`dashboard.tagline`,message:`What would you like to work on today?`})})]}),n.length>0?(0,P.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:n.map(e=>{let t=m(e.labels?.plural??e.label),n=R[e.name]??{};return(0,P.jsxs)(E,{"data-testid":`dashboard-tile-${e.name}`,children:[(0,P.jsxs)(C,{children:[(0,P.jsx)(`div`,{className:`bg-primary/10 text-primary mb-2 flex size-10 items-center justify-center rounded-md`,children:(0,P.jsx)(h,{className:`size-5`,"aria-hidden":!0})}),(0,P.jsx)(S,{children:t}),(0,P.jsxs)(T,{"data-testid":`dashboard-tile-${e.name}-counts`,children:[D._(I.countPublished.id,{count:n.published??0},{message:I.countPublished.message}),` · `,D._(I.countDraft.id,{count:n.draft??0},{message:I.countDraft.message})]})]}),(0,P.jsx)(w,{children:(0,P.jsx)(c,{asChild:!0,variant:`outline`,className:`w-full`,children:(0,P.jsxs)(s,{to:`/entries/$slug`,params:{slug:e.adminSlug},search:A,"data-testid":`dashboard-tile-${e.name}-link`,children:[(0,P.jsx)(i,{id:`dashboard.tile.browse.generic`,message:`Browse`}),(0,P.jsx)(M,{className:`rtl:rotate-180`})]})})})]},e.name)})}):(0,P.jsx)(E,{className:`max-w-xl`,"data-testid":`dashboard-empty-state`,children:(0,P.jsx)(p,{children:(0,P.jsxs)(u,{children:[(0,P.jsx)(l,{variant:`icon`,children:(0,P.jsx)(g,{})}),(0,P.jsx)(d,{children:(0,P.jsx)(i,{id:`dashboard.empty.title`,message:`No content types yet`})}),(0,P.jsx)(f,{children:(0,P.jsx)(i,{id:`dashboard.empty.description`,message:`Add a plugin that registers a post type (e.g. <0>@plumix/plugin-blog</0>) to see it here.`,components:{0:(0,P.jsx)(`code`,{})}})})]})})}),n.length>0?(0,P.jsxs)(E,{"data-testid":`dashboard-recent-activity`,children:[(0,P.jsx)(C,{children:(0,P.jsx)(S,{children:(0,P.jsx)(i,{id:`dashboard.recent.title`,message:`Recent activity`})})}),(0,P.jsx)(w,{children:(L.data??[]).length===0?(0,P.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,P.jsx)(i,{id:`dashboard.recent.empty`,message:`Nothing yet.`})}):(0,P.jsx)(`ul`,{className:`flex flex-col divide-y`,children:(L.data??[]).map(e=>{let t=n.find(t=>t.name===e.type),r=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`truncate`,children:e.title}),(0,P.jsx)(`span`,{className:`text-muted-foreground ms-auto shrink-0 text-xs`,children:O(k(e.updatedAt))})]});return(0,P.jsx)(`li`,{"data-testid":`dashboard-recent-${e.id}`,children:t?(0,P.jsx)(s,{to:`/entries/$slug/$id/edit`,params:{slug:t.adminSlug,id:e.id},className:`hover:text-primary flex items-center gap-2 py-2 text-sm`,children:r}):(0,P.jsx)(`div`,{className:`flex items-center gap-2 py-2 text-sm`,children:r})},e.id)})})})]}):null,(0,P.jsx)(F,{widgets:y(e.capabilities)})]})}export{L as component};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a}from"./orpc-CmtRGLtZ.js";import{t as o}from"./useQuery-QAYxQfCx.js";import{t as s}from"./link-CI3qhqYu.js";import{t as c}from"./button-DG1Ca1S5.js";import{a as l,i as u,o as d,r as f,t as p}from"./empty-p3QKoEqD.js";import{t as m}from"./createLucideIcon-C0O-yxZG.js";import{n as h,t as g}from"./puzzle-CkL6fcG1.js";import{t as _}from"./use-label-CykSHq9A.js";import{_ as v,g as y}from"./manifest-2YUNz_ML.js";import{t as b}from"./_authenticated-CH4N_cSi.js";import{t as x}from"./use-formatters-DLJOFcWE.js";import{a as S,i as C,n as w,r as T,t as E}from"./card-L2-kK5VK.js";import{t as D}from"./skeleton-BnBM1862.js";import{t as O}from"./plugin-registry-DLDusPOA.js";import{t as k}from"./dates-CSmOj6E-.js";import{t as A}from"./entries-MizUUcD8.js";import{t as j}from"./plugin-error-boundary-FjZbsCsp.js";var M=m(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),N=e(n(),1),P=e(t(),1);function F({widgets:e}){let t=_(),n=e.flatMap(e=>{let t=O(e.id);return t?[{widget:e,Component:t}]:[]});return n.length===0?null:(0,P.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,"data-testid":`dashboard-widgets`,children:n.map(({widget:e,Component:n})=>(0,P.jsxs)(E,{"data-testid":`dashboard-widget-${e.id}`,children:[(0,P.jsx)(C,{children:(0,P.jsx)(S,{children:t(e.title)})}),(0,P.jsx)(w,{children:(0,P.jsx)(j,{kind:`widget`,pluginLabel:t(e.title),children:(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(D,{className:`h-16 w-full`}),children:(0,P.jsx)(n,{})})})})]},e.id))})}var I={countPublished:{id:`dashboard.count.published`},countDraft:{id:`dashboard.count.draft`}};function L(){let{user:e}=b.useRouteContext(),t=e.name??e.email,n=v(e.capabilities),m=_(),{i18n:D}=r(),{formatRelative:O}=x(),j=o(a.entry.stats.queryOptions({input:{}})),L=o(a.entry.recentActivity.queryOptions({input:{limit:8}})),R=(0,N.useMemo)(()=>{let e={};for(let t of j.data??[])(e[t.type]??={})[t.status]=t.count;return e},[j.data]);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{"data-testid":`dashboard-welcome-heading`,className:`text-2xl font-semibold`,children:(0,P.jsx)(i,{id:`dashboard.welcome`,message:`Welcome, {greeting}`,values:{greeting:(0,P.jsx)(`bdi`,{children:t})},comment:`greeting: the user's display name or email`})}),(0,P.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,P.jsx)(i,{id:`dashboard.tagline`,message:`What would you like to work on today?`})})]}),n.length>0?(0,P.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:n.map(e=>{let t=m(e.labels?.plural??e.label),n=R[e.name]??{};return(0,P.jsxs)(E,{"data-testid":`dashboard-tile-${e.name}`,children:[(0,P.jsxs)(C,{children:[(0,P.jsx)(`div`,{className:`bg-primary/10 text-primary mb-2 flex size-10 items-center justify-center rounded-md`,children:(0,P.jsx)(h,{className:`size-5`,"aria-hidden":!0})}),(0,P.jsx)(S,{children:t}),(0,P.jsxs)(T,{"data-testid":`dashboard-tile-${e.name}-counts`,children:[D._(I.countPublished.id,{count:n.published??0},{message:I.countPublished.message}),` · `,D._(I.countDraft.id,{count:n.draft??0},{message:I.countDraft.message})]})]}),(0,P.jsx)(w,{children:(0,P.jsx)(c,{asChild:!0,variant:`outline`,className:`w-full`,children:(0,P.jsxs)(s,{to:`/entries/$slug`,params:{slug:e.adminSlug},search:A,"data-testid":`dashboard-tile-${e.name}-link`,children:[(0,P.jsx)(i,{id:`dashboard.tile.browse.generic`,message:`Browse`}),(0,P.jsx)(M,{className:`rtl:rotate-180`})]})})})]},e.name)})}):(0,P.jsx)(E,{className:`max-w-xl`,"data-testid":`dashboard-empty-state`,children:(0,P.jsx)(p,{children:(0,P.jsxs)(u,{children:[(0,P.jsx)(l,{variant:`icon`,children:(0,P.jsx)(g,{})}),(0,P.jsx)(d,{children:(0,P.jsx)(i,{id:`dashboard.empty.title`,message:`No content types yet`})}),(0,P.jsx)(f,{children:(0,P.jsx)(i,{id:`dashboard.empty.description`,message:`Add a plugin that registers a post type (e.g. <0>@plumix/plugin-blog</0>) to see it here.`,components:{0:(0,P.jsx)(`code`,{})}})})]})})}),n.length>0?(0,P.jsxs)(E,{"data-testid":`dashboard-recent-activity`,children:[(0,P.jsx)(C,{children:(0,P.jsx)(S,{children:(0,P.jsx)(i,{id:`dashboard.recent.title`,message:`Recent activity`})})}),(0,P.jsx)(w,{children:(L.data??[]).length===0?(0,P.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,P.jsx)(i,{id:`dashboard.recent.empty`,message:`Nothing yet.`})}):(0,P.jsx)(`ul`,{className:`flex flex-col divide-y`,children:(L.data??[]).map(e=>{let t=n.find(t=>t.name===e.type),r=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`truncate`,children:e.title||(0,P.jsx)(i,{id:`entries.list.noTitle`,message:`(no title)`})}),(0,P.jsx)(`span`,{className:`text-muted-foreground ms-auto shrink-0 text-xs`,children:O(k(e.updatedAt))})]});return(0,P.jsx)(`li`,{"data-testid":`dashboard-recent-${e.id}`,children:t?(0,P.jsx)(s,{to:`/entries/$slug/$id/edit`,params:{slug:t.adminSlug,id:e.id},className:`hover:text-primary flex items-center gap-2 py-2 text-sm`,children:r}):(0,P.jsx)(`div`,{className:`flex items-center gap-2 py-2 text-sm`,children:r})},e.id)})})})]}):null,(0,P.jsx)(F,{widgets:y(e.capabilities)})]})}export{L as component};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_name-BGOHegOZ.js","./jsx-runtime-DUAcabCT.js","./react-DbyrFoBd.js","./dist-BL2bKHuR.js","./orpc-CmtRGLtZ.js","./useQuery-QAYxQfCx.js","./link-CI3qhqYu.js","./react-dom-i-Mcm3wj.js","./useStore-Vo4KhxPy.js","./with-selector-Bf4HMdmS.js","./button-DG1Ca1S5.js","./dist-Dgy1ZZMQ.js","./utils-DKOQrNEG.js","./dist-B66OmIyr.js","./empty-p3QKoEqD.js","./search-input-BG9KotQw.js","./createLucideIcon-C0O-yxZG.js","./breadcrumb-x0qfIbU9.js","./dist-C4yHjFuP.js","./es2015-Di0DqwZ-.js","./dist-RxmsRBXP.js","./dist-BbwCNMFC.js","./dist-vYFq1OyT.js","./dist-DWZq3eNY.js","./skeleton-BnBM1862.js","./input-xYuLUQID.js","./separator-DzRLZTkg.js","./dist-BaNJ6JYm.js","./tooltip-Bf2rZUeB.js","./dist-BreUs1Gf.js","./utils-kFAy0YTP.js","./sonner-1kBVu4ZN.js","./dist-BP9v0gZx.js","./select-D3kIVy0H.js","./dist-Cz1zPiFe.js","./textarea-iIsBg5jH.js","./dist-hUh7dFZi.js","./card-L2-kK5VK.js","./popover-BoiNmQB7.js","./dist-CFgtqwWs.js","./toggle-M64NT8hi.js","./form-B_PPIck3.js","./alert-cwX3fWUu.js","./use-label-CykSHq9A.js","./caps-SYhabp1B.js","./type-labels-DEpt0nSb.js","./tree-BUpunTXw.js"])))=>i.map(i=>d[i]);
2
- import{T as e,a as t,t as n}from"./lazyRouteComponent-CQbKoKTD.js";import{s as r}from"./matchContext-DKtpdvCQ.js";import{o as i}from"./manifest-Bdiv3Qyq.js";import{D as a,E as o,_ as s,f as c,g as l,h as u,i as d,l as f,m as p,o as m,w as h,y as g}from"./dist-ClOzYsk5.js";import{t as _}from"./caps-SYhabp1B.js";var v=()=>e(()=>import(`./_name-BGOHegOZ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46]),import.meta.url),y=u({page:l(d(g(p(),m(),c(1)),1),1),q:l(d(g(h(),a(),f(200),o(e=>e.length===0?void 0:e)),void 0))}),b=t(`/_authenticated/terms/$name/`)({validateSearch:e=>s(y,e),beforeLoad:({context:e,params:t})=>{let n=i(t.name);if(!n||!_(e.user.capabilities,`term:${n.name}:read`))throw r();return{taxonomy:n}},component:n(v,`component`)});export{b as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_name-DQVev0AG.js","./jsx-runtime-DUAcabCT.js","./react-DbyrFoBd.js","./dist-BL2bKHuR.js","./orpc-CmtRGLtZ.js","./useQuery-QAYxQfCx.js","./link-CI3qhqYu.js","./react-dom-i-Mcm3wj.js","./useStore-Vo4KhxPy.js","./with-selector-Bf4HMdmS.js","./button-DG1Ca1S5.js","./dist-Dgy1ZZMQ.js","./utils-DKOQrNEG.js","./dist-B66OmIyr.js","./empty-p3QKoEqD.js","./search-input-B7zZp8UE.js","./createLucideIcon-C0O-yxZG.js","./breadcrumb-Di_E7s51.js","./dist-C4yHjFuP.js","./es2015-Di0DqwZ-.js","./dist-RxmsRBXP.js","./dist-BbwCNMFC.js","./dist-vYFq1OyT.js","./dist-DWZq3eNY.js","./skeleton-BnBM1862.js","./input-xYuLUQID.js","./separator-DzRLZTkg.js","./dist-BaNJ6JYm.js","./tooltip-Bf2rZUeB.js","./dist-BreUs1Gf.js","./utils-RSNxndzY.js","./sonner-1kBVu4ZN.js","./dist-BP9v0gZx.js","./select-D3kIVy0H.js","./dist-Cz1zPiFe.js","./textarea-iIsBg5jH.js","./dist-hUh7dFZi.js","./card-L2-kK5VK.js","./popover-BoiNmQB7.js","./dist-CFgtqwWs.js","./toggle-M64NT8hi.js","./form-CY307HEl.js","./alert-cwX3fWUu.js","./use-label-CykSHq9A.js","./caps-SYhabp1B.js","./type-labels-DEpt0nSb.js","./tree-BUpunTXw.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,a as t,t as n}from"./lazyRouteComponent-CQbKoKTD.js";import{s as r}from"./matchContext-DKtpdvCQ.js";import{o as i}from"./manifest-2YUNz_ML.js";import{D as a,E as o,_ as s,f as c,g as l,h as u,i as d,l as f,m as p,o as m,w as h,y as g}from"./dist-ClOzYsk5.js";import{t as _}from"./caps-SYhabp1B.js";var v=()=>e(()=>import(`./_name-DQVev0AG.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46]),import.meta.url),y=u({page:l(d(g(p(),m(),c(1)),1),1),q:l(d(g(h(),a(),f(200),o(e=>e.length===0?void 0:e)),void 0))}),b=t(`/_authenticated/terms/$name/`)({validateSearch:e=>s(y,e),beforeLoad:({context:e,params:t})=>{let n=i(t.name);if(!n||!_(e.user.capabilities,`term:${n.name}:read`))throw r();return{taxonomy:n}},component:n(v,`component`)});export{b as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{n as r}from"./dist-BL2bKHuR.js";import{t as i}from"./orpc-CmtRGLtZ.js";import{t as a}from"./useQuery-QAYxQfCx.js";import{t as o}from"./link-CI3qhqYu.js";import{t as s}from"./button-DG1Ca1S5.js";import{i as c,n as l,o as u,r as d,t as f}from"./empty-p3QKoEqD.js";import{n as p,r as m,t as h}from"./search-input-BG9KotQw.js";import{K as g}from"./utils-kFAy0YTP.js";import{t as _}from"./use-label-CykSHq9A.js";import{t as v}from"./caps-SYhabp1B.js";import{n as y}from"./type-labels-DEpt0nSb.js";import{t as b}from"./_name-aKYVqU32.js";import{n as x,t as S}from"./alert-cwX3fWUu.js";import{r as C,t as w}from"./tree-BUpunTXw.js";var T=e(n()),E=e(t()),D={columnName:{id:`terms.list.column.name`},columnDescription:{id:`terms.list.column.description`}},O=50,k=200;function A(e,t,n){return!t||n?e.map(e=>({term:e,displayDepth:0})):C(w(e)).map(e=>({term:e.term,displayDepth:e.depth}))}function j(){let e=b.useNavigate();return{setPage:(0,T.useCallback)(t=>{e({search:e=>({...e,page:t})})},[e]),setSearch:(0,T.useCallback)(t=>{e({search:e=>({...e,q:t,page:1})})},[e])}}function M(){let e=b.useSearch(),{user:t,taxonomy:n}=b.useRouteContext(),r=_(),c=n.isHierarchical===!0,l=c?k:O,u=a(i.term.list.queryOptions({input:{taxonomy:n.name,limit:l,offset:(e.page-1)*l,...e.q?{search:e.q}:{}}})),{setPage:d,setSearch:f}=j(),C=u.data,w=(0,T.useMemo)(()=>A(C??[],c,!!e.q),[C,c,e.q]),M=e.page>1,P=(C?.length??0)===l,F=v(t.capabilities,`term:${n.name}:edit`),I=(0,T.useMemo)(()=>[{accessorKey:`name`,header:r(D.columnName),cell:({row:e})=>{let t=e.original.term,r=e.original.displayDepth;return(0,E.jsxs)(o,{to:`/terms/$name/$id/edit`,params:{name:n.name,id:t.id},"data-testid":`taxonomy-list-row-${String(t.id)}`,"aria-level":r+1,className:`hover:text-primary flex min-w-0 flex-col transition-colors`,children:[(0,E.jsxs)(`span`,{className:`font-medium`,children:[r>0?(0,E.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/60 me-1 font-normal select-none`,children:`— `.repeat(r)}):null,t.name]}),(0,E.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:t.slug})]})}},{accessorKey:`description`,header:r(D.columnDescription),cell:({row:e})=>{let t=e.original.term.description;return t===null||t.length===0?(0,E.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`—`}):(0,E.jsx)(`span`,{className:`text-muted-foreground line-clamp-1 text-sm`,children:t})}}],[n.name,r]);return(0,E.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h1`,{"data-testid":`taxonomy-list-heading`,className:`text-2xl font-semibold capitalize`,children:r(n.label)}),n.description?(0,E.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:n.description}):null]}),F?(0,E.jsx)(s,{asChild:!0,children:(0,E.jsxs)(o,{to:`/terms/$name/create`,params:{name:n.name},"data-testid":`taxonomy-list-new-button`,children:[(0,E.jsx)(g,{}),r(y(n,`addNewItem`))]})}):null]}),(0,E.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,E.jsx)(`div`,{className:`ms-auto`,children:(0,E.jsx)(h,{initialValue:e.q??``,placeholder:r(y(n,`searchItems`)),testId:`taxonomy-list-search-input`,onCommit:f},e.q??``)})}),u.isError?(0,E.jsx)(S,{variant:`destructive`,children:(0,E.jsx)(x,{children:u.error instanceof Error?u.error.message:r(y(n,`loadErrorItems`))})}):(0,E.jsx)(m,{columns:I,data:w,isLoading:u.isPending,loadingLabel:r(y(n,`loadingItems`)),emptyState:(0,E.jsx)(N,{taxonomy:n,canCreate:F})}),(0,E.jsx)(p,{page:e.page,canPrev:M,canNext:P,isLoading:u.isPending,onPageChange:d})]})}function N({taxonomy:e,canCreate:t}){let n=_(),i=n(y(e,`addNewItem`));return(0,E.jsxs)(f,{"data-testid":`taxonomy-list-empty-state`,className:`border`,children:[(0,E.jsxs)(c,{children:[(0,E.jsx)(u,{children:n(y(e,`notFound`))}),(0,E.jsx)(d,{children:(0,E.jsx)(r,{id:`terms.list.empty.description`,message:`Create one to see it here.`})})]}),(0,E.jsx)(l,{children:t?(0,E.jsx)(s,{asChild:!0,children:(0,E.jsxs)(o,{to:`/terms/$name/create`,params:{name:e.name},children:[(0,E.jsx)(g,{}),i]})}):(0,E.jsxs)(s,{disabled:!0,children:[(0,E.jsx)(g,{}),i]})})]})}export{M as component};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{n as r}from"./dist-BL2bKHuR.js";import{t as i}from"./orpc-CmtRGLtZ.js";import{t as a}from"./useQuery-QAYxQfCx.js";import{t as o}from"./link-CI3qhqYu.js";import{t as s}from"./button-DG1Ca1S5.js";import{i as c,n as l,o as u,r as d,t as f}from"./empty-p3QKoEqD.js";import{n as p,r as m,t as h}from"./search-input-B7zZp8UE.js";import{K as g}from"./utils-RSNxndzY.js";import{t as _}from"./use-label-CykSHq9A.js";import{t as v}from"./caps-SYhabp1B.js";import{n as y}from"./type-labels-DEpt0nSb.js";import{t as b}from"./_name-BEnhsrWI.js";import{n as x,t as S}from"./alert-cwX3fWUu.js";import{r as C,t as w}from"./tree-BUpunTXw.js";var T=e(n()),E=e(t()),D={columnName:{id:`terms.list.column.name`},columnDescription:{id:`terms.list.column.description`}},O=50,k=200;function A(e,t,n){return!t||n?e.map(e=>({term:e,displayDepth:0})):C(w(e)).map(e=>({term:e.term,displayDepth:e.depth}))}function j(){let e=b.useNavigate();return{setPage:(0,T.useCallback)(t=>{e({search:e=>({...e,page:t})})},[e]),setSearch:(0,T.useCallback)(t=>{e({search:e=>({...e,q:t,page:1})})},[e])}}function M(){let e=b.useSearch(),{user:t,taxonomy:n}=b.useRouteContext(),r=_(),c=n.isHierarchical===!0,l=c?k:O,u=a(i.term.list.queryOptions({input:{taxonomy:n.name,limit:l,offset:(e.page-1)*l,...e.q?{search:e.q}:{}}})),{setPage:d,setSearch:f}=j(),C=u.data,w=(0,T.useMemo)(()=>A(C??[],c,!!e.q),[C,c,e.q]),M=e.page>1,P=(C?.length??0)===l,F=v(t.capabilities,`term:${n.name}:edit`),I=(0,T.useMemo)(()=>[{accessorKey:`name`,header:r(D.columnName),cell:({row:e})=>{let t=e.original.term,r=e.original.displayDepth;return(0,E.jsxs)(o,{to:`/terms/$name/$id/edit`,params:{name:n.name,id:t.id},"data-testid":`taxonomy-list-row-${String(t.id)}`,"aria-level":r+1,className:`hover:text-primary flex min-w-0 flex-col transition-colors`,children:[(0,E.jsxs)(`span`,{className:`font-medium`,children:[r>0?(0,E.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/60 me-1 font-normal select-none`,children:`— `.repeat(r)}):null,t.name]}),(0,E.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:t.slug})]})}},{accessorKey:`description`,header:r(D.columnDescription),cell:({row:e})=>{let t=e.original.term.description;return t===null||t.length===0?(0,E.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`—`}):(0,E.jsx)(`span`,{className:`text-muted-foreground line-clamp-1 text-sm`,children:t})}}],[n.name,r]);return(0,E.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h1`,{"data-testid":`taxonomy-list-heading`,className:`text-2xl font-semibold capitalize`,children:r(n.label)}),n.description?(0,E.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:n.description}):null]}),F?(0,E.jsx)(s,{asChild:!0,children:(0,E.jsxs)(o,{to:`/terms/$name/create`,params:{name:n.name},"data-testid":`taxonomy-list-new-button`,children:[(0,E.jsx)(g,{}),r(y(n,`addNewItem`))]})}):null]}),(0,E.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,E.jsx)(`div`,{className:`ms-auto`,children:(0,E.jsx)(h,{initialValue:e.q??``,placeholder:r(y(n,`searchItems`)),testId:`taxonomy-list-search-input`,onCommit:f},e.q??``)})}),u.isError?(0,E.jsx)(S,{variant:`destructive`,children:(0,E.jsx)(x,{children:u.error instanceof Error?u.error.message:r(y(n,`loadErrorItems`))})}):(0,E.jsx)(m,{columns:I,data:w,isLoading:u.isPending,loadingLabel:r(y(n,`loadingItems`)),emptyState:(0,E.jsx)(N,{taxonomy:n,canCreate:F})}),(0,E.jsx)(p,{page:e.page,canPrev:M,canNext:P,isLoading:u.isPending,onPageChange:d})]})}function N({taxonomy:e,canCreate:t}){let n=_(),i=n(y(e,`addNewItem`));return(0,E.jsxs)(f,{"data-testid":`taxonomy-list-empty-state`,className:`border`,children:[(0,E.jsxs)(c,{children:[(0,E.jsx)(u,{children:n(y(e,`notFound`))}),(0,E.jsx)(d,{children:(0,E.jsx)(r,{id:`terms.list.empty.description`,message:`Create one to see it here.`})})]}),(0,E.jsx)(l,{children:t?(0,E.jsx)(s,{asChild:!0,children:(0,E.jsxs)(o,{to:`/terms/$name/create`,params:{name:e.name},children:[(0,E.jsx)(g,{}),i]})}):(0,E.jsxs)(s,{disabled:!0,children:[(0,E.jsx)(g,{}),i]})})]})}export{M as component};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a,u as o}from"./orpc-CmtRGLtZ.js";import{t as s}from"./useMutation-vgMtqBOX.js";import{t as c}from"./useSuspenseQuery-9GLTSYHf.js";import{t as l}from"./button-DG1Ca1S5.js";import{i as u,o as d,r as f,t as p}from"./empty-p3QKoEqD.js";import{n as m,r as h,t as g}from"./use-visible-fields-C0FKrnz6.js";import{t as _}from"./use-label-CykSHq9A.js";import{S as v,u as y}from"./manifest-2YUNz_ML.js";import{t as b}from"./_page-Rj3wR-yR.js";import{a as x,i as S,n as C,r as w,t as T}from"./card-L2-kK5VK.js";import{t as E}from"./_page-wrWlHYyD.js";import{f as D,t as O}from"./form-CY307HEl.js";import{n as k,t as A}from"./alert-cwX3fWUu.js";var j=e(n()),M=e(t()),N=`ctx.registerSettingsPage(name, { groups: [...] })`;function P(){let{page:e}=E.useRouteContext(),t=y(e),n=_();return(0,M.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6`,children:[(0,M.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,"data-testid":`settings-page-heading`,children:n(e.label)}),e.description?(0,M.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:n(e.description)}):null]}),t.length===0?(0,M.jsx)(I,{}):t.map(e=>(0,M.jsx)(F,{group:e},e.name))]})}function F({group:e}){let{i18n:t}=r(),n=_(),u=o(),[d,f]=(0,j.useState)(null),[p,y]=(0,j.useState)(null),{data:E}=c(a.settings.get.queryOptions({input:{group:e.name}})),N=D({defaultValues:v([e],E)}),P=g(e.fields,{control:N.control}),F=s({mutationFn:t=>a.settings.upsert.call({group:e.name,values:t}),onMutate:()=>{f(null),y(null)},onSuccess:async t=>{N.reset(v([e],t)),await u.invalidateQueries({queryKey:a.settings.get.queryOptions({input:{group:e.name}}).queryKey}),y(b.saved)},onError:e=>{f(e instanceof Error?e.message:b.saveFailed)}}),I=N.handleSubmit(e=>{F.mutate(e)});return(0,M.jsx)(T,{className:`@container`,"data-testid":`settings-group-card-${e.name}`,children:(0,M.jsx)(O,{...N,children:(0,M.jsxs)(`form`,{onSubmit:I,className:`flex flex-col gap-6`,children:[(0,M.jsxs)(S,{children:[(0,M.jsx)(x,{children:(0,M.jsx)(`h2`,{className:`text-lg font-semibold`,"data-testid":`settings-group-heading-${e.name}`,children:n(e.label)})}),e.description?(0,M.jsx)(w,{children:n(e.description)}):null]}),(0,M.jsxs)(C,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(`div`,{className:`grid grid-cols-12 gap-4`,children:P.map(e=>(0,M.jsx)(m,{field:e,name:e.key,disabled:F.isPending,className:h(e.span)},e.key))}),d?(0,M.jsx)(A,{variant:`destructive`,role:`alert`,"data-testid":`settings-server-error-${e.name}`,children:(0,M.jsx)(k,{children:typeof d==`string`?d:t._(d.id,void 0,{message:d.message})})}):null,p?(0,M.jsx)(A,{role:`status`,"aria-live":`polite`,"data-testid":`settings-save-notice-${e.name}`,children:(0,M.jsx)(k,{children:t._(p.id,void 0,{message:p.message})})}):null]}),(0,M.jsx)(`div`,{className:`flex justify-end px-6`,children:(0,M.jsx)(l,{type:`submit`,disabled:F.isPending,"data-testid":`settings-submit-${e.name}`,children:F.isPending?(0,M.jsx)(i,{id:`settings.page.submit.pending`,message:`Saving…`}):(0,M.jsx)(i,{id:`settings.page.submit.idle`,message:`Save changes`})})})]})})})}function I(){return(0,M.jsx)(T,{children:(0,M.jsx)(p,{children:(0,M.jsxs)(u,{children:[(0,M.jsx)(d,{children:(0,M.jsx)(i,{id:`settings.page.empty.title`,message:`No groups on this page`})}),(0,M.jsxs)(f,{children:[(0,M.jsx)(i,{id:`settings.page.empty.description`,message:`This settings page doesn't reference any registered groups yet. Plugins compose pages with the registerSettingsPage helper:`}),` `,(0,M.jsx)(`code`,{className:`font-mono text-xs`,children:N})]})]})})})}export{P as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_page-BSBKYWFe.js","./jsx-runtime-DUAcabCT.js","./dist-BL2bKHuR.js","./react-DbyrFoBd.js","./error-placeholder-ULkA-k6_.js","./empty-p3QKoEqD.js","./utils-DKOQrNEG.js","./dist-B66OmIyr.js","./triangle-alert-BpzHmkii.js","./createLucideIcon-C0O-yxZG.js","./_page-Rj3wR-yR.js","./_page-D0l1kYXx.js","./orpc-CmtRGLtZ.js","./useMutation-vgMtqBOX.js","./useSuspenseQuery-9GLTSYHf.js","./useQuery-QAYxQfCx.js","./button-DG1Ca1S5.js","./dist-Dgy1ZZMQ.js","./use-visible-fields-C0FKrnz6.js","./lazyRouteComponent-CQbKoKTD.js","./useStore-Vo4KhxPy.js","./with-selector-Bf4HMdmS.js","./matchContext-DKtpdvCQ.js","./link-CI3qhqYu.js","./react-dom-i-Mcm3wj.js","./select-D3kIVy0H.js","./dist-C4yHjFuP.js","./dist-BbwCNMFC.js","./dist-vYFq1OyT.js","./es2015-Di0DqwZ-.js","./dist-BP9v0gZx.js","./breadcrumb-Di_E7s51.js","./dist-RxmsRBXP.js","./dist-DWZq3eNY.js","./skeleton-BnBM1862.js","./input-xYuLUQID.js","./separator-DzRLZTkg.js","./dist-BaNJ6JYm.js","./tooltip-Bf2rZUeB.js","./dist-BreUs1Gf.js","./textarea-iIsBg5jH.js","./dist-hUh7dFZi.js","./utils-RSNxndzY.js","./sonner-1kBVu4ZN.js","./dist-Cz1zPiFe.js","./card-L2-kK5VK.js","./popover-BoiNmQB7.js","./dist-CFgtqwWs.js","./toggle-M64NT8hi.js","./form-CY307HEl.js","./alert-cwX3fWUu.js","./use-label-CykSHq9A.js","./manifest-2YUNz_ML.js","./style-emitter-CDGtTiRG.js","./type-labels-DEpt0nSb.js","./plugin-registry-DLDusPOA.js","./errors-BDz8PxwA.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{i as n}from"./dist-BL2bKHuR.js";import{t as r}from"./orpc-CmtRGLtZ.js";import{T as i,a,t as o}from"./lazyRouteComponent-CQbKoKTD.js";import{s}from"./matchContext-DKtpdvCQ.js";import{a as c,u as l}from"./manifest-2YUNz_ML.js";import{t as u}from"./caps-SYhabp1B.js";import{t as d}from"./_page-Rj3wR-yR.js";import{t as f}from"./edit-skeleton-oIsvepSM.js";var p=e(t(),1),m=a(`/_authenticated/settings/$page`)({beforeLoad:({context:e,params:t})=>{let n=c(t.page);if(!n||!u(e.user.capabilities,`settings:manage`))throw s();return{page:n}},loader:({context:e})=>{let t=l(e.page);return Promise.all(t.map(t=>e.queryClient.ensureQueryData(r.settings.get.queryOptions({input:{group:t.name}}))))},pendingComponent:h,errorComponent:o(()=>i(()=>import(`./_page-BSBKYWFe.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url),`errorComponent`),component:o(()=>i(()=>import(`./_page-D0l1kYXx.js`),__vite__mapDeps([11,1,3,2,12,13,14,15,16,17,6,7,5,18,19,20,21,22,23,24,25,26,27,28,29,30,9,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,8,51,52,53,54,55,56,10]),import.meta.url),`component`)});function h(){let{i18n:e}=n();return(0,p.jsx)(f,{ariaLabel:e._(d.loadingAria.id,void 0,{message:d.loadingAria.message}),testId:`settings-page-loading`})}export{m as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a,u as o}from"./orpc-CmtRGLtZ.js";import{t as s}from"./useQuery-QAYxQfCx.js";import{t as c}from"./useMutation-vgMtqBOX.js";import{t as l}from"./link-CI3qhqYu.js";import{a as u,i as d,n as f,r as p,t as m}from"./select-D3kIVy0H.js";import{t as h}from"./utils-DKOQrNEG.js";import{n as g,t as _}from"./button-DG1Ca1S5.js";import{i as v,n as y,o as b,r as x,t as ee}from"./empty-p3QKoEqD.js";import{t as S}from"./createLucideIcon-C0O-yxZG.js";import{a as C,i as te,n as w,o as T,s as E,t as ne}from"./toast-CWtRg47-.js";import{n as D,r as O,t as re}from"./search-input-BG9KotQw.js";import{B as k,F as A,I as j,K as M,L as N,M as P,N as F,P as I,R as L,V as ie,n as ae,t as R,z as oe}from"./utils-kFAy0YTP.js";import{t as z}from"./use-label-CykSHq9A.js";import{o as B}from"./manifest-Bdiv3Qyq.js";import{t as se}from"./caps-SYhabp1B.js";import{t as ce}from"./use-formatters-DLJOFcWE.js";import{r as V,t as H}from"./type-labels-DEpt0nSb.js";import{t as U}from"./_slug-DWmiGCz6.js";import{n as le,t as ue}from"./alert-cwX3fWUu.js";import{t as W}from"./dates-CSmOj6E-.js";var G=S(`arrow-up-down`,[[`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`}]]),K=e(n(),1),q=e(t(),1),J={selected:{id:`entries.list.bulk.selected`},trash:{id:`entries.list.bulk.trash`},restore:{id:`entries.list.bulk.restore`},delete:{id:`entries.list.bulk.delete`},trashTitle:{id:`entries.list.bulk.trashTitle`},deleteTitle:{id:`entries.list.bulk.deleteTitle`},deleteBody:{id:`entries.list.bulk.deleteBody`},confirm:{id:`entries.list.bulk.confirm`},cancel:{id:`entries.list.bulk.cancel`}};function de({count:e,view:t,busy:n,onTrash:i,onRestore:a,onDeletePermanent:o}){let{i18n:s}=r(),[c,l]=(0,K.useState)(null),u=t=>s._(t.id,{count:e},{message:t.message});return(0,q.jsxs)(`div`,{"data-testid":`content-list-bulk-bar`,className:`bg-muted/40 flex items-center gap-3 rounded-md border px-4 py-2`,children:[(0,q.jsx)(`span`,{"data-testid":`content-list-bulk-count`,className:`text-sm font-medium`,children:u(J.selected)}),(0,q.jsx)(`div`,{className:`ms-auto flex items-center gap-2`,children:t===`trash`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(_,{variant:`outline`,size:`sm`,disabled:n,onClick:a,"data-testid":`content-list-bulk-restore`,children:s._(J.restore.id,{},{message:J.restore.message})}),(0,q.jsx)(_,{variant:`destructive`,size:`sm`,disabled:n,onClick:()=>{l(`delete`)},"data-testid":`content-list-bulk-delete`,children:s._(J.delete.id,{},{message:J.delete.message})})]}):(0,q.jsx)(_,{variant:`outline`,size:`sm`,disabled:n,onClick:()=>{l(`trash`)},"data-testid":`content-list-bulk-trash`,children:s._(J.trash.id,{},{message:J.trash.message})})}),(0,q.jsx)(I,{open:c!==null,onOpenChange:e=>{e||l(null)},children:(0,q.jsxs)(N,{children:[(0,q.jsxs)(k,{children:[(0,q.jsx)(ie,{children:u(c===`delete`?J.deleteTitle:J.trashTitle)}),c===`delete`?(0,q.jsx)(L,{children:s._(J.deleteBody.id,{},{message:J.deleteBody.message})}):null]}),(0,q.jsxs)(oe,{children:[(0,q.jsx)(j,{disabled:n,children:s._(J.cancel.id,{},{message:J.cancel.message})}),(0,q.jsx)(A,{"data-testid":`content-list-bulk-confirm`,className:g({variant:`destructive`}),disabled:n,onClick:e=>{e.preventDefault();let t=c;l(null),t===`delete`?o():t===`trash`&&i()},children:s._(J.confirm.id,{},{message:J.confirm.message})})]})]})})]})}var fe=20,Y={published:`default`,draft:`secondary`,scheduled:`outline`,trash:`destructive`},X={columnTitle:{id:`entries.list.column.title`},columnStatus:{id:`entries.list.column.status`},columnUpdated:{id:`entries.list.column.updated`},statusAll:{id:`entries.list.statusFilter.all`},statusPublished:{id:`entries.list.statusFilter.published`},statusDraft:{id:`entries.list.statusFilter.draft`},statusScheduled:{id:`entries.list.statusFilter.scheduled`},statusTrash:{id:`entries.list.statusFilter.trash`},authorAll:{id:`entries.list.authorFilter.all`},authorMine:{id:`entries.list.authorFilter.mine`},filterStatusAria:{id:`entries.list.filterStatusAria`},filterAuthorAria:{id:`entries.list.filterAuthorAria`},sortAria:{id:`entries.list.sortAria`},noTitle:{id:`entries.list.noTitle`},rowEdit:{id:`entries.list.row.edit`},rowTrash:{id:`entries.list.row.trash`},rowTrashing:{id:`entries.list.row.trashing`},trashingMove:{id:`entries.list.trashDialog.moving`},trashingConfirm:{id:`entries.list.trashDialog.confirm`},rowRestore:{id:`entries.list.row.restore`},rowRestoring:{id:`entries.list.row.restoring`},rowDelete:{id:`entries.list.row.deletePermanently`},deleteDialogTitle:{id:`entries.list.deleteDialog.title`},deleteDialogDeleting:{id:`entries.list.deleteDialog.deleting`},deleteDialogConfirm:{id:`entries.list.deleteDialog.confirm`},toastTrashed:{id:`entries.list.toast.trashed`},toastRestored:{id:`entries.list.toast.restored`},toastDeleted:{id:`entries.list.toast.deleted`},toastFailed:{id:`entries.list.toast.failed`},toastDuplicated:{id:`entries.list.toast.duplicated`},rowDuplicate:{id:`entries.list.row.duplicate`},rowDuplicating:{id:`entries.list.row.duplicating`},selectAllAria:{id:`entries.list.selectAllAria`},selectRowAria:{id:`entries.list.selectRowAria`},bulkFailed:{id:`entries.list.bulk.toastFailed`},bulkTrashed:{id:`entries.list.bulk.toastTrashed`},bulkRestored:{id:`entries.list.bulk.toastRestored`},bulkDeleted:{id:`entries.list.bulk.toastDeleted`}},pe=[{value:`all`,label:X.statusAll},{value:`published`,label:X.statusPublished},{value:`draft`,label:X.statusDraft},{value:`scheduled`,label:X.statusScheduled},{value:`trash`,label:X.statusTrash}];function me({activeOrderBy:e,activeOrder:t,onSort:n,adminSlug:r,canDelete:i,canCreate:a,onTrash:o,trashingId:s,onDuplicate:c,duplicatingId:l,onRestore:u,restoringId:d,onDeletePermanent:f,showSelect:p,selectAllLabel:m,selectRowLabel:h,renderLabel:g,editLabel:_,formatDate:v}){return[...p?[{id:`select`,meta:{className:`w-8`},header:({table:e})=>{let t=e.getIsAllPageRowsSelected(),n=e.getIsSomePageRowsSelected();return(0,q.jsx)(P,{checked:t?!0:n?`indeterminate`:!1,onCheckedChange:t=>{e.toggleAllPageRowsSelected(t===!0)},"aria-label":m,"data-testid":`content-list-select-all`})},cell:({row:e})=>(0,q.jsx)(P,{checked:e.getIsSelected(),disabled:!e.getCanSelect(),onCheckedChange:t=>{e.toggleSelected(t===!0)},"aria-label":h,"data-testid":`content-list-select-${String(e.original.id)}`})}]:[],{accessorKey:`title`,header:()=>(0,q.jsx)($,{label:g(X.columnTitle),column:`title`,defaultDirection:`asc`,activeOrderBy:e,activeOrder:t,onSort:n}),cell:({row:e})=>(0,q.jsx)(ye,{entry:e.original,adminSlug:r,canDelete:i,canCreate:a,onTrash:o,isTrashing:s===e.original.id,onDuplicate:c,isDuplicating:l===e.original.id,onRestore:u,isRestoring:d===e.original.id,onDeletePermanent:f,editLabel:_})},{accessorKey:`status`,header:g(X.columnStatus),cell:({row:e})=>(0,q.jsx)(F,{variant:Y[e.original.status],className:`capitalize`,children:e.original.status})},{accessorKey:`updatedAt`,meta:{className:`text-end`},header:()=>(0,q.jsx)($,{label:g(X.columnUpdated),column:`updated_at`,defaultDirection:`desc`,activeOrderBy:e,activeOrder:t,onSort:n,align:`right`}),cell:({row:e})=>(0,q.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:v(W(e.original.updatedAt),{dateStyle:`medium`,timeStyle:`short`})})}]}function he(e,t){let n={};for(let r of t){let t=e[r];if(typeof t!=`string`||t.length===0)continue;let i=t.split(`,`).map(e=>e.trim()).filter(e=>e.length>0);i.length>0&&(n[r]=i)}return n}function ge(){let e=U.useNavigate();return{setStatus:(0,K.useCallback)(t=>{e({search:e=>({...e,status:t,page:1})})},[e]),setPage:(0,K.useCallback)(t=>{e({search:e=>({...e,page:t})})},[e]),setSearch:(0,K.useCallback)(t=>{e({search:e=>({...e,q:t,page:1})})},[e]),setAuthor:(0,K.useCallback)(t=>{e({search:e=>({...e,author:t,page:1})})},[e]),setTermFilter:(0,K.useCallback)((t,n)=>{e({search:e=>{let r={...e,page:1};return n.length>0?r[t]=n.join(`,`):delete r[t],r}})},[e]),setSort:(0,K.useCallback)((t,n)=>{e({search:e=>({...e,orderBy:t,order:Z(e.orderBy===t,e.order,n),page:1})})},[e])}}function _e({entryType:e,rows:t,canDelete:n,renderLabel:i}){let s=o(),l=(0,K.useCallback)(()=>s.invalidateQueries({queryKey:a.entry.list.key({input:{type:e.name}})}),[s,e.name]),[u,d]=(0,K.useState)(null),f=(0,K.useCallback)(()=>{ne(i(X.toastFailed))},[i]),p=(0,K.useCallback)(e=>()=>(w(i(e)),l()),[i,l]),m=c({mutationFn:e=>a.entry.trash.call({id:e}),onSuccess:p(X.toastTrashed),onError:f,onSettled:()=>{d(null)}}),h=(0,K.useCallback)(e=>{d(e)},[d]),g=m.isPending&&typeof m.variables==`number`?m.variables:null,_=c({mutationFn:e=>a.entry.duplicate.call({id:e}),onSuccess:p(X.toastDuplicated),onError:f}),v=(0,K.useCallback)(e=>{_.mutate(e)},[_]),y=_.isPending&&typeof _.variables==`number`?_.variables:null,b=c({mutationFn:e=>a.entry.restore.call({id:e}),onSuccess:p(X.toastRestored),onError:f}),x=(0,K.useCallback)(e=>{b.mutate(e)},[b]),ee=b.isPending&&typeof b.variables==`number`?b.variables:null,[S,C]=(0,K.useState)(null),te=c({mutationFn:e=>a.entry.deletePermanent.call({id:e}),onSuccess:p(X.toastDeleted),onError:f,onSettled:()=>{C(null)}}),T=(0,K.useCallback)(e=>{C(e)},[C]),{i18n:E}=r(),[D,O]=(0,K.useState)({}),re=(0,K.useMemo)(()=>{let e=new Set(t.map(e=>e.id));return Object.keys(D).map(Number).filter(t=>D[String(t)]&&e.has(t))},[D,t]),k=n&&t.length>0,A=(0,K.useCallback)((e,t)=>{w(E._(e.id,{count:t},{message:e.message}))},[E]),j=(0,K.useCallback)(e=>t=>(A(e,t.ids.length),O({}),l()),[A,l]),M=c({mutationFn:e=>a.entry.trashMany.call({ids:e}),onSuccess:j(X.bulkTrashed),onError:f}),N=c({mutationFn:e=>a.entry.restoreMany.call({ids:e}),onSuccess:j(X.bulkRestored),onError:f}),P=c({mutationFn:e=>a.entry.deletePermanentMany.call({ids:e}),onSuccess:j(X.bulkDeleted),onError:f});return{onTrash:h,trashingId:g,onDuplicate:v,duplicatingId:y,onRestore:x,restoringId:ee,onDeletePermanent:T,pendingTrashId:u,setPendingTrashId:d,trash:m,pendingDeleteId:S,setPendingDeleteId:C,deletePermanent:te,rowSelection:D,setRowSelection:O,selectedIds:re,showSelect:k,bulkBusy:M.isPending||N.isPending||P.isPending,trashMany:M,restoreMany:N,deletePermanentMany:P}}function ve(){let e=U.useSearch(),{user:t,entryType:n}=U.useRouteContext(),r=n.termTaxonomies??Se,o=(0,K.useMemo)(()=>he(e,r),[e,r]),c=s(a.entry.list.queryOptions({input:{type:n.name,limit:fe,offset:(e.page-1)*fe,orderBy:e.orderBy,order:e.order,...e.status===`all`?{}:{status:e.status},...e.q?{search:e.q}:{},...e.author===`mine`?{authorId:t.id}:{},...Object.keys(o).length>0?{termTaxonomies:o}:{}}})),{setStatus:u,setPage:d,setSearch:f,setAuthor:p,setTermFilter:m,setSort:h}=ge(),v=(0,K.useMemo)(()=>c.data??[],[c.data]),y=e.page>1,b=v.length===fe,x=z(),ee=x(n.labels?.plural??n.label),S=`entry:${n.capabilityType??n.name}:create`,C=se(t.capabilities,S),te=`entry:${n.capabilityType??n.name}:delete`,w=se(t.capabilities,te),{onTrash:T,trashingId:E,onDuplicate:ne,duplicatingId:P,onRestore:F,restoringId:ae,onDeletePermanent:R,pendingTrashId:B,setPendingTrashId:V,trash:W,pendingDeleteId:G,setPendingDeleteId:J,deletePermanent:Y,rowSelection:pe,setRowSelection:ve,selectedIds:Z,showSelect:Q,bulkBusy:$,trashMany:ye,restoreMany:xe,deletePermanentMany:Ce}=_e({entryType:n,rows:v,canDelete:w,renderLabel:x}),De=e.status===`trash`,Oe=x(H(n,`editItem`)),{formatDate:ke}=ce(),Ae=(0,K.useMemo)(()=>me({activeOrderBy:e.orderBy,activeOrder:e.order,onSort:h,adminSlug:n.adminSlug,canDelete:w,canCreate:C,onTrash:T,trashingId:E,onDuplicate:ne,duplicatingId:P,onRestore:F,restoringId:ae,onDeletePermanent:R,showSelect:Q,selectAllLabel:x(X.selectAllAria),selectRowLabel:x(X.selectRowAria),renderLabel:x,editLabel:Oe,formatDate:ke}),[e.orderBy,e.order,h,n.adminSlug,w,C,T,E,ne,P,F,ae,R,Q,x,Oe,ke]);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,q.jsx)(`div`,{children:(0,q.jsx)(`h1`,{"data-testid":`content-list-heading`,className:`text-2xl font-semibold`,children:ee})}),C?(0,q.jsx)(_,{asChild:!0,children:(0,q.jsxs)(l,{to:`/entries/$slug/create`,params:{slug:n.adminSlug},"data-testid":`content-list-new-button`,children:[(0,q.jsx)(M,{}),x(H(n,`addNewItem`))]})}):null]}),(0,q.jsx)(be,{value:e.status,onChange:u}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(we,{value:e.author,onChange:p}),r.map(e=>(0,q.jsx)(Te,{taxonomyName:e,value:o[e]??Se,onChange:t=>{m(e,t)}},e)),(0,q.jsx)(`div`,{className:`ms-auto`,children:(0,q.jsx)(re,{initialValue:e.q??``,placeholder:x(H(n,`searchItems`)),testId:`content-list-search-input`,onCommit:f},e.q??``)})]}),Q&&Z.length>0?(0,q.jsx)(de,{count:Z.length,view:De?`trash`:`active`,busy:$,onTrash:()=>{ye.mutate(Z)},onRestore:()=>{xe.mutate(Z)},onDeletePermanent:()=>{Ce.mutate(Z)}}):null,c.isError?(0,q.jsx)(ue,{variant:`destructive`,"data-testid":`content-list-load-error`,children:(0,q.jsx)(le,{children:c.error instanceof Error?c.error.message:x(H(n,`loadErrorItems`))})}):(0,q.jsx)(O,{columns:Ae,data:v,isLoading:c.isPending,loadingLabel:x(H(n,`loadingItems`)),...Q?{rowSelection:pe,onRowSelectionChange:ve,getRowId:e=>String(e.id)}:{},emptyState:(0,q.jsx)(Ee,{entryType:n,canCreate:C,entryTypeSlug:n.adminSlug})}),(0,q.jsx)(D,{page:e.page,canPrev:y,canNext:b,isLoading:c.isPending,onPageChange:d}),(0,q.jsx)(I,{open:B!==null,onOpenChange:e=>{e||V(null)},children:(0,q.jsxs)(N,{children:[(0,q.jsxs)(k,{children:[(0,q.jsx)(ie,{children:x(H(n,`moveToTrash`))}),(0,q.jsx)(L,{children:(0,q.jsx)(i,{id:`entries.list.trashDialog.description`,message:`You can restore it from the Trash view later.`})})]}),(0,q.jsxs)(oe,{children:[(0,q.jsx)(j,{disabled:W.isPending,children:(0,q.jsx)(i,{id:`entries.list.trashDialog.cancel`,message:`Cancel`})}),(0,q.jsx)(A,{"data-testid":`content-list-trash-confirm`,className:g({variant:`destructive`}),disabled:W.isPending,onClick:e=>{e.preventDefault(),B!==null&&W.mutate(B)},children:W.isPending?x(X.trashingMove):x(X.trashingConfirm)})]})]})}),(0,q.jsx)(I,{open:G!==null,onOpenChange:e=>{e||J(null)},children:(0,q.jsxs)(N,{children:[(0,q.jsxs)(k,{children:[(0,q.jsx)(ie,{children:x(X.deleteDialogTitle)}),(0,q.jsx)(L,{children:(0,q.jsx)(i,{id:`entries.list.deleteDialog.description`,message:`This permanently deletes the entry and its revisions. It cannot be undone.`})})]}),(0,q.jsxs)(oe,{children:[(0,q.jsx)(j,{disabled:Y.isPending,children:(0,q.jsx)(i,{id:`entries.list.deleteDialog.cancel`,message:`Cancel`})}),(0,q.jsx)(A,{"data-testid":`content-list-delete-confirm`,className:g({variant:`destructive`}),disabled:Y.isPending,onClick:e=>{e.preventDefault(),G!==null&&Y.mutate(G)},children:Y.isPending?x(X.deleteDialogDeleting):x(X.deleteDialogConfirm)})]})]})})]})}function Z(e,t,n){return e?t===`asc`?`desc`:`asc`:n}function Q({isActive:e,order:t}){return e?t===`asc`?(0,q.jsx)(T,{"aria-hidden":!0,className:`size-3.5`}):(0,q.jsx)(E,{"aria-hidden":!0,className:`size-3.5`}):(0,q.jsx)(G,{"aria-hidden":!0,className:`size-3.5`})}function $({label:e,column:t,defaultDirection:n,activeOrderBy:i,activeOrder:a,onSort:o,align:s=`left`}){let{i18n:c}=r(),l=i===t,u=Z(l,a,n);return(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{o(t,n)},"data-testid":`content-list-sort-${t}`,className:h(`hover:text-foreground inline-flex items-center gap-1 rounded px-2 py-1 font-medium transition-colors`,s===`right`?`-me-2 text-end`:`-ms-2 text-start`),"aria-label":c._(X.sortAria.id,{label:e,direction:u},{message:X.sortAria.message}),"aria-pressed":l,children:[e,(0,q.jsx)(Q,{isActive:l,order:a})]})}function ye({entry:e,adminSlug:t,canDelete:n,canCreate:r,onTrash:a,isTrashing:o,onDuplicate:s,isDuplicating:c,onRestore:u,isRestoring:d,onDeletePermanent:f,editLabel:p}){let m=z(),g=e.status===`trash`,_=n&&!g,v=r&&!g,y=n&&g;return(0,q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsx)(l,{to:`/entries/$slug/$id/edit`,params:{slug:t,id:e.id},"data-testid":`content-list-row-${String(e.id)}`,className:`hover:text-primary font-medium transition-colors`,children:e.title||(0,q.jsx)(`span`,{className:`text-muted-foreground italic`,children:(0,q.jsx)(i,{id:`entries.list.noTitle`,message:`(no title)`})})}),(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.slug}),(0,q.jsxs)(`div`,{className:h(`flex h-4 items-center gap-2 text-xs transition-opacity`,`invisible group-hover/row:visible focus-within:visible`),"data-testid":`content-list-row-actions-${String(e.id)}`,children:[(0,q.jsx)(l,{to:`/entries/$slug/$id/edit`,params:{slug:t,id:e.id},className:`text-muted-foreground hover:text-foreground`,children:p}),_?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`|`}),(0,q.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>{a(e.id)},className:`text-muted-foreground hover:text-destructive disabled:opacity-50`,"data-testid":`content-list-row-trash-${String(e.id)}`,children:m(o?X.rowTrashing:X.rowTrash)})]}):null,v?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`|`}),(0,q.jsx)(`button`,{type:`button`,disabled:c,onClick:()=>{s(e.id)},className:`text-muted-foreground hover:text-foreground disabled:opacity-50`,"data-testid":`content-list-row-duplicate-${String(e.id)}`,children:m(c?X.rowDuplicating:X.rowDuplicate)})]}):null,y?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`|`}),(0,q.jsx)(`button`,{type:`button`,disabled:d,onClick:()=>{u(e.id)},className:`text-muted-foreground hover:text-foreground disabled:opacity-50`,"data-testid":`content-list-row-restore-${String(e.id)}`,children:m(d?X.rowRestoring:X.rowRestore)}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`|`}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>{f(e.id)},className:`text-muted-foreground hover:text-destructive`,"data-testid":`content-list-row-delete-${String(e.id)}`,children:m(X.rowDelete)})]}):null]})]})}function be({value:e,onChange:t}){let n=z();return(0,q.jsx)(R,{type:`single`,variant:`outline`,value:e,onValueChange:e=>{t(e||`all`)},"aria-label":n(X.filterStatusAria),children:pe.map(e=>(0,q.jsx)(ae,{value:e.value,"data-testid":`status-view-${e.value}`,children:n(e.label)},e.value))})}var xe=[],Se=[],Ce=[{value:`all`,label:X.authorAll},{value:`mine`,label:X.authorMine}];function we({value:e,onChange:t}){let n=z();return(0,q.jsxs)(m,{value:e,onValueChange:e=>{t(e)},children:[(0,q.jsx)(d,{size:`sm`,"aria-label":n(X.filterAuthorAria),"data-testid":`author-filter`,children:(0,q.jsx)(u,{})}),(0,q.jsx)(f,{children:Ce.map(e=>(0,q.jsx)(p,{value:e.value,"data-testid":`author-filter-${e.value}`,children:n(e.label)},e.value))})]})}function Te({taxonomyName:e,value:t,onChange:n}){let r=z(),i=B(e),o=s(a.term.list.queryOptions({input:{taxonomy:e,limit:200}})),c=i?.isHierarchical===!0;return(0,q.jsx)(C,{options:(0,K.useMemo)(()=>te(o.data??xe,c),[o.data,c]),value:t,onChange:n,placeholder:r(V(i,`allItems`)),searchPlaceholder:r(V(i,`searchItems`)),emptyText:r(V(i,`noMatch`)),"aria-label":r(V(i,`filterByItem`)),testId:`taxonomy-filter-${e}`})}function Ee({entryType:e,canCreate:t,entryTypeSlug:n}){let r=z(),a=r(H(e,`addNewItem`));return(0,q.jsxs)(ee,{"data-testid":`content-list-empty-state`,className:`border`,children:[(0,q.jsxs)(v,{children:[(0,q.jsx)(b,{children:r(H(e,`notFound`))}),(0,q.jsx)(x,{children:(0,q.jsx)(i,{id:`entries.list.empty.description`,message:`Create one to see it here.`})})]}),(0,q.jsx)(y,{children:t?(0,q.jsx)(_,{asChild:!0,children:(0,q.jsxs)(l,{to:`/entries/$slug/create`,params:{slug:n},children:[(0,q.jsx)(M,{}),a]})}):(0,q.jsxs)(_,{disabled:!0,children:[(0,q.jsx)(M,{}),a]})})]})}export{ve as component};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a,u as o}from"./orpc-CmtRGLtZ.js";import{t as s}from"./useQuery-QAYxQfCx.js";import{t as c}from"./useMutation-vgMtqBOX.js";import{t as l}from"./link-CI3qhqYu.js";import{a as u,i as d,n as f,r as p,t as m}from"./select-D3kIVy0H.js";import{t as h}from"./utils-DKOQrNEG.js";import{n as g,t as _}from"./button-DG1Ca1S5.js";import{i as v,n as y,o as b,r as x,t as ee}from"./empty-p3QKoEqD.js";import{t as S}from"./createLucideIcon-C0O-yxZG.js";import{a as C,i as te,n as w,o as T,s as E,t as ne}from"./toast-26daCjvR.js";import{n as D,r as O,t as re}from"./search-input-B7zZp8UE.js";import{B as k,F as A,I as j,K as M,L as N,M as P,N as F,P as I,R as L,V as ie,n as ae,t as R,z as oe}from"./utils-RSNxndzY.js";import{t as z}from"./use-label-CykSHq9A.js";import{o as B}from"./manifest-2YUNz_ML.js";import{t as se}from"./caps-SYhabp1B.js";import{t as ce}from"./use-formatters-DLJOFcWE.js";import{r as V,t as H}from"./type-labels-DEpt0nSb.js";import{t as U}from"./_slug-Bztim-i3.js";import{n as le,t as ue}from"./alert-cwX3fWUu.js";import{t as W}from"./dates-CSmOj6E-.js";var G=S(`arrow-up-down`,[[`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`}]]),K=e(n(),1),q=e(t(),1),J={selected:{id:`entries.list.bulk.selected`},trash:{id:`entries.list.bulk.trash`},restore:{id:`entries.list.bulk.restore`},delete:{id:`entries.list.bulk.delete`},trashTitle:{id:`entries.list.bulk.trashTitle`},deleteTitle:{id:`entries.list.bulk.deleteTitle`},deleteBody:{id:`entries.list.bulk.deleteBody`},confirm:{id:`entries.list.bulk.confirm`},cancel:{id:`entries.list.bulk.cancel`}};function de({count:e,view:t,busy:n,onTrash:i,onRestore:a,onDeletePermanent:o}){let{i18n:s}=r(),[c,l]=(0,K.useState)(null),u=t=>s._(t.id,{count:e},{message:t.message});return(0,q.jsxs)(`div`,{"data-testid":`content-list-bulk-bar`,className:`bg-muted/40 flex items-center gap-3 rounded-md border px-4 py-2`,children:[(0,q.jsx)(`span`,{"data-testid":`content-list-bulk-count`,className:`text-sm font-medium`,children:u(J.selected)}),(0,q.jsx)(`div`,{className:`ms-auto flex items-center gap-2`,children:t===`trash`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(_,{variant:`outline`,size:`sm`,disabled:n,onClick:a,"data-testid":`content-list-bulk-restore`,children:s._(J.restore.id,{},{message:J.restore.message})}),(0,q.jsx)(_,{variant:`destructive`,size:`sm`,disabled:n,onClick:()=>{l(`delete`)},"data-testid":`content-list-bulk-delete`,children:s._(J.delete.id,{},{message:J.delete.message})})]}):(0,q.jsx)(_,{variant:`outline`,size:`sm`,disabled:n,onClick:()=>{l(`trash`)},"data-testid":`content-list-bulk-trash`,children:s._(J.trash.id,{},{message:J.trash.message})})}),(0,q.jsx)(I,{open:c!==null,onOpenChange:e=>{e||l(null)},children:(0,q.jsxs)(N,{children:[(0,q.jsxs)(k,{children:[(0,q.jsx)(ie,{children:u(c===`delete`?J.deleteTitle:J.trashTitle)}),c===`delete`?(0,q.jsx)(L,{children:s._(J.deleteBody.id,{},{message:J.deleteBody.message})}):null]}),(0,q.jsxs)(oe,{children:[(0,q.jsx)(j,{disabled:n,children:s._(J.cancel.id,{},{message:J.cancel.message})}),(0,q.jsx)(A,{"data-testid":`content-list-bulk-confirm`,className:g({variant:`destructive`}),disabled:n,onClick:e=>{e.preventDefault();let t=c;l(null),t===`delete`?o():t===`trash`&&i()},children:s._(J.confirm.id,{},{message:J.confirm.message})})]})]})})]})}var fe=20,Y={published:`default`,draft:`secondary`,scheduled:`outline`,trash:`destructive`},X={columnTitle:{id:`entries.list.column.title`},columnStatus:{id:`entries.list.column.status`},columnUpdated:{id:`entries.list.column.updated`},statusAll:{id:`entries.list.statusFilter.all`},statusPublished:{id:`entries.list.statusFilter.published`},statusDraft:{id:`entries.list.statusFilter.draft`},statusScheduled:{id:`entries.list.statusFilter.scheduled`},statusTrash:{id:`entries.list.statusFilter.trash`},authorAll:{id:`entries.list.authorFilter.all`},authorMine:{id:`entries.list.authorFilter.mine`},filterStatusAria:{id:`entries.list.filterStatusAria`},filterAuthorAria:{id:`entries.list.filterAuthorAria`},sortAria:{id:`entries.list.sortAria`},noTitle:{id:`entries.list.noTitle`},rowEdit:{id:`entries.list.row.edit`},rowTrash:{id:`entries.list.row.trash`},rowTrashing:{id:`entries.list.row.trashing`},trashingMove:{id:`entries.list.trashDialog.moving`},trashingConfirm:{id:`entries.list.trashDialog.confirm`},rowRestore:{id:`entries.list.row.restore`},rowRestoring:{id:`entries.list.row.restoring`},rowDelete:{id:`entries.list.row.deletePermanently`},deleteDialogTitle:{id:`entries.list.deleteDialog.title`},deleteDialogDeleting:{id:`entries.list.deleteDialog.deleting`},deleteDialogConfirm:{id:`entries.list.deleteDialog.confirm`},toastTrashed:{id:`entries.list.toast.trashed`},toastRestored:{id:`entries.list.toast.restored`},toastDeleted:{id:`entries.list.toast.deleted`},toastFailed:{id:`entries.list.toast.failed`},toastDuplicated:{id:`entries.list.toast.duplicated`},rowDuplicate:{id:`entries.list.row.duplicate`},rowDuplicating:{id:`entries.list.row.duplicating`},selectAllAria:{id:`entries.list.selectAllAria`},selectRowAria:{id:`entries.list.selectRowAria`},bulkFailed:{id:`entries.list.bulk.toastFailed`},bulkTrashed:{id:`entries.list.bulk.toastTrashed`},bulkRestored:{id:`entries.list.bulk.toastRestored`},bulkDeleted:{id:`entries.list.bulk.toastDeleted`}},pe=[{value:`all`,label:X.statusAll},{value:`published`,label:X.statusPublished},{value:`draft`,label:X.statusDraft},{value:`scheduled`,label:X.statusScheduled},{value:`trash`,label:X.statusTrash}];function me({activeOrderBy:e,activeOrder:t,onSort:n,adminSlug:r,canDelete:i,canCreate:a,onTrash:o,trashingId:s,onDuplicate:c,duplicatingId:l,onRestore:u,restoringId:d,onDeletePermanent:f,showSelect:p,selectAllLabel:m,selectRowLabel:h,renderLabel:g,editLabel:_,formatDate:v}){return[...p?[{id:`select`,meta:{className:`w-8`},header:({table:e})=>{let t=e.getIsAllPageRowsSelected(),n=e.getIsSomePageRowsSelected();return(0,q.jsx)(P,{checked:t?!0:n?`indeterminate`:!1,onCheckedChange:t=>{e.toggleAllPageRowsSelected(t===!0)},"aria-label":m,"data-testid":`content-list-select-all`})},cell:({row:e})=>(0,q.jsx)(P,{checked:e.getIsSelected(),disabled:!e.getCanSelect(),onCheckedChange:t=>{e.toggleSelected(t===!0)},"aria-label":h,"data-testid":`content-list-select-${String(e.original.id)}`})}]:[],{accessorKey:`title`,header:()=>(0,q.jsx)($,{label:g(X.columnTitle),column:`title`,defaultDirection:`asc`,activeOrderBy:e,activeOrder:t,onSort:n}),cell:({row:e})=>(0,q.jsx)(ye,{entry:e.original,adminSlug:r,canDelete:i,canCreate:a,onTrash:o,isTrashing:s===e.original.id,onDuplicate:c,isDuplicating:l===e.original.id,onRestore:u,isRestoring:d===e.original.id,onDeletePermanent:f,editLabel:_})},{accessorKey:`status`,header:g(X.columnStatus),cell:({row:e})=>(0,q.jsx)(F,{variant:Y[e.original.status],className:`capitalize`,children:e.original.status})},{accessorKey:`updatedAt`,meta:{className:`text-end`},header:()=>(0,q.jsx)($,{label:g(X.columnUpdated),column:`updated_at`,defaultDirection:`desc`,activeOrderBy:e,activeOrder:t,onSort:n,align:`right`}),cell:({row:e})=>(0,q.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:v(W(e.original.updatedAt),{dateStyle:`medium`,timeStyle:`short`})})}]}function he(e,t){let n={};for(let r of t){let t=e[r];if(typeof t!=`string`||t.length===0)continue;let i=t.split(`,`).map(e=>e.trim()).filter(e=>e.length>0);i.length>0&&(n[r]=i)}return n}function ge(){let e=U.useNavigate();return{setStatus:(0,K.useCallback)(t=>{e({search:e=>({...e,status:t,page:1})})},[e]),setPage:(0,K.useCallback)(t=>{e({search:e=>({...e,page:t})})},[e]),setSearch:(0,K.useCallback)(t=>{e({search:e=>({...e,q:t,page:1})})},[e]),setAuthor:(0,K.useCallback)(t=>{e({search:e=>({...e,author:t,page:1})})},[e]),setTermFilter:(0,K.useCallback)((t,n)=>{e({search:e=>{let r={...e,page:1};return n.length>0?r[t]=n.join(`,`):delete r[t],r}})},[e]),setSort:(0,K.useCallback)((t,n)=>{e({search:e=>({...e,orderBy:t,order:Z(e.orderBy===t,e.order,n),page:1})})},[e])}}function _e({entryType:e,rows:t,canDelete:n,renderLabel:i}){let s=o(),l=(0,K.useCallback)(()=>s.invalidateQueries({queryKey:a.entry.list.key({input:{type:e.name}})}),[s,e.name]),[u,d]=(0,K.useState)(null),f=(0,K.useCallback)(()=>{ne(i(X.toastFailed))},[i]),p=(0,K.useCallback)(e=>()=>(w(i(e)),l()),[i,l]),m=c({mutationFn:e=>a.entry.trash.call({id:e}),onSuccess:p(X.toastTrashed),onError:f,onSettled:()=>{d(null)}}),h=(0,K.useCallback)(e=>{d(e)},[d]),g=m.isPending&&typeof m.variables==`number`?m.variables:null,_=c({mutationFn:e=>a.entry.duplicate.call({id:e}),onSuccess:p(X.toastDuplicated),onError:f}),v=(0,K.useCallback)(e=>{_.mutate(e)},[_]),y=_.isPending&&typeof _.variables==`number`?_.variables:null,b=c({mutationFn:e=>a.entry.restore.call({id:e}),onSuccess:p(X.toastRestored),onError:f}),x=(0,K.useCallback)(e=>{b.mutate(e)},[b]),ee=b.isPending&&typeof b.variables==`number`?b.variables:null,[S,C]=(0,K.useState)(null),te=c({mutationFn:e=>a.entry.deletePermanent.call({id:e}),onSuccess:p(X.toastDeleted),onError:f,onSettled:()=>{C(null)}}),T=(0,K.useCallback)(e=>{C(e)},[C]),{i18n:E}=r(),[D,O]=(0,K.useState)({}),re=(0,K.useMemo)(()=>{let e=new Set(t.map(e=>e.id));return Object.keys(D).map(Number).filter(t=>D[String(t)]&&e.has(t))},[D,t]),k=n&&t.length>0,A=(0,K.useCallback)((e,t)=>{w(E._(e.id,{count:t},{message:e.message}))},[E]),j=(0,K.useCallback)(e=>t=>(A(e,t.ids.length),O({}),l()),[A,l]),M=c({mutationFn:e=>a.entry.trashMany.call({ids:e}),onSuccess:j(X.bulkTrashed),onError:f}),N=c({mutationFn:e=>a.entry.restoreMany.call({ids:e}),onSuccess:j(X.bulkRestored),onError:f}),P=c({mutationFn:e=>a.entry.deletePermanentMany.call({ids:e}),onSuccess:j(X.bulkDeleted),onError:f});return{onTrash:h,trashingId:g,onDuplicate:v,duplicatingId:y,onRestore:x,restoringId:ee,onDeletePermanent:T,pendingTrashId:u,setPendingTrashId:d,trash:m,pendingDeleteId:S,setPendingDeleteId:C,deletePermanent:te,rowSelection:D,setRowSelection:O,selectedIds:re,showSelect:k,bulkBusy:M.isPending||N.isPending||P.isPending,trashMany:M,restoreMany:N,deletePermanentMany:P}}function ve(){let e=U.useSearch(),{user:t,entryType:n}=U.useRouteContext(),r=n.termTaxonomies??Se,o=(0,K.useMemo)(()=>he(e,r),[e,r]),c=s(a.entry.list.queryOptions({input:{type:n.name,limit:fe,offset:(e.page-1)*fe,orderBy:e.orderBy,order:e.order,...e.status===`all`?{}:{status:e.status},...e.q?{search:e.q}:{},...e.author===`mine`?{authorId:t.id}:{},...Object.keys(o).length>0?{termTaxonomies:o}:{}}})),{setStatus:u,setPage:d,setSearch:f,setAuthor:p,setTermFilter:m,setSort:h}=ge(),v=(0,K.useMemo)(()=>c.data??[],[c.data]),y=e.page>1,b=v.length===fe,x=z(),ee=x(n.labels?.plural??n.label),S=`entry:${n.capabilityType??n.name}:create`,C=se(t.capabilities,S),te=`entry:${n.capabilityType??n.name}:delete`,w=se(t.capabilities,te),{onTrash:T,trashingId:E,onDuplicate:ne,duplicatingId:P,onRestore:F,restoringId:ae,onDeletePermanent:R,pendingTrashId:B,setPendingTrashId:V,trash:W,pendingDeleteId:G,setPendingDeleteId:J,deletePermanent:Y,rowSelection:pe,setRowSelection:ve,selectedIds:Z,showSelect:Q,bulkBusy:$,trashMany:ye,restoreMany:xe,deletePermanentMany:Ce}=_e({entryType:n,rows:v,canDelete:w,renderLabel:x}),De=e.status===`trash`,Oe=x(H(n,`editItem`)),{formatDate:ke}=ce(),Ae=(0,K.useMemo)(()=>me({activeOrderBy:e.orderBy,activeOrder:e.order,onSort:h,adminSlug:n.adminSlug,canDelete:w,canCreate:C,onTrash:T,trashingId:E,onDuplicate:ne,duplicatingId:P,onRestore:F,restoringId:ae,onDeletePermanent:R,showSelect:Q,selectAllLabel:x(X.selectAllAria),selectRowLabel:x(X.selectRowAria),renderLabel:x,editLabel:Oe,formatDate:ke}),[e.orderBy,e.order,h,n.adminSlug,w,C,T,E,ne,P,F,ae,R,Q,x,Oe,ke]);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,q.jsx)(`div`,{children:(0,q.jsx)(`h1`,{"data-testid":`content-list-heading`,className:`text-2xl font-semibold`,children:ee})}),C?(0,q.jsx)(_,{asChild:!0,children:(0,q.jsxs)(l,{to:`/entries/$slug/create`,params:{slug:n.adminSlug},"data-testid":`content-list-new-button`,children:[(0,q.jsx)(M,{}),x(H(n,`addNewItem`))]})}):null]}),(0,q.jsx)(be,{value:e.status,onChange:u}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(we,{value:e.author,onChange:p}),r.map(e=>(0,q.jsx)(Te,{taxonomyName:e,value:o[e]??Se,onChange:t=>{m(e,t)}},e)),(0,q.jsx)(`div`,{className:`ms-auto`,children:(0,q.jsx)(re,{initialValue:e.q??``,placeholder:x(H(n,`searchItems`)),testId:`content-list-search-input`,onCommit:f},e.q??``)})]}),Q&&Z.length>0?(0,q.jsx)(de,{count:Z.length,view:De?`trash`:`active`,busy:$,onTrash:()=>{ye.mutate(Z)},onRestore:()=>{xe.mutate(Z)},onDeletePermanent:()=>{Ce.mutate(Z)}}):null,c.isError?(0,q.jsx)(ue,{variant:`destructive`,"data-testid":`content-list-load-error`,children:(0,q.jsx)(le,{children:c.error instanceof Error?c.error.message:x(H(n,`loadErrorItems`))})}):(0,q.jsx)(O,{columns:Ae,data:v,isLoading:c.isPending,loadingLabel:x(H(n,`loadingItems`)),...Q?{rowSelection:pe,onRowSelectionChange:ve,getRowId:e=>String(e.id)}:{},emptyState:(0,q.jsx)(Ee,{entryType:n,canCreate:C,entryTypeSlug:n.adminSlug})}),(0,q.jsx)(D,{page:e.page,canPrev:y,canNext:b,isLoading:c.isPending,onPageChange:d}),(0,q.jsx)(I,{open:B!==null,onOpenChange:e=>{e||V(null)},children:(0,q.jsxs)(N,{children:[(0,q.jsxs)(k,{children:[(0,q.jsx)(ie,{children:x(H(n,`moveToTrash`))}),(0,q.jsx)(L,{children:(0,q.jsx)(i,{id:`entries.list.trashDialog.description`,message:`You can restore it from the Trash view later.`})})]}),(0,q.jsxs)(oe,{children:[(0,q.jsx)(j,{disabled:W.isPending,children:(0,q.jsx)(i,{id:`entries.list.trashDialog.cancel`,message:`Cancel`})}),(0,q.jsx)(A,{"data-testid":`content-list-trash-confirm`,className:g({variant:`destructive`}),disabled:W.isPending,onClick:e=>{e.preventDefault(),B!==null&&W.mutate(B)},children:W.isPending?x(X.trashingMove):x(X.trashingConfirm)})]})]})}),(0,q.jsx)(I,{open:G!==null,onOpenChange:e=>{e||J(null)},children:(0,q.jsxs)(N,{children:[(0,q.jsxs)(k,{children:[(0,q.jsx)(ie,{children:x(X.deleteDialogTitle)}),(0,q.jsx)(L,{children:(0,q.jsx)(i,{id:`entries.list.deleteDialog.description`,message:`This permanently deletes the entry and its revisions. It cannot be undone.`})})]}),(0,q.jsxs)(oe,{children:[(0,q.jsx)(j,{disabled:Y.isPending,children:(0,q.jsx)(i,{id:`entries.list.deleteDialog.cancel`,message:`Cancel`})}),(0,q.jsx)(A,{"data-testid":`content-list-delete-confirm`,className:g({variant:`destructive`}),disabled:Y.isPending,onClick:e=>{e.preventDefault(),G!==null&&Y.mutate(G)},children:Y.isPending?x(X.deleteDialogDeleting):x(X.deleteDialogConfirm)})]})]})})]})}function Z(e,t,n){return e?t===`asc`?`desc`:`asc`:n}function Q({isActive:e,order:t}){return e?t===`asc`?(0,q.jsx)(T,{"aria-hidden":!0,className:`size-3.5`}):(0,q.jsx)(E,{"aria-hidden":!0,className:`size-3.5`}):(0,q.jsx)(G,{"aria-hidden":!0,className:`size-3.5`})}function $({label:e,column:t,defaultDirection:n,activeOrderBy:i,activeOrder:a,onSort:o,align:s=`left`}){let{i18n:c}=r(),l=i===t,u=Z(l,a,n);return(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{o(t,n)},"data-testid":`content-list-sort-${t}`,className:h(`hover:text-foreground inline-flex items-center gap-1 rounded px-2 py-1 font-medium transition-colors`,s===`right`?`-me-2 text-end`:`-ms-2 text-start`),"aria-label":c._(X.sortAria.id,{label:e,direction:u},{message:X.sortAria.message}),"aria-pressed":l,children:[e,(0,q.jsx)(Q,{isActive:l,order:a})]})}function ye({entry:e,adminSlug:t,canDelete:n,canCreate:r,onTrash:a,isTrashing:o,onDuplicate:s,isDuplicating:c,onRestore:u,isRestoring:d,onDeletePermanent:f,editLabel:p}){let m=z(),g=e.status===`trash`,_=n&&!g,v=r&&!g,y=n&&g;return(0,q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsx)(l,{to:`/entries/$slug/$id/edit`,params:{slug:t,id:e.id},"data-testid":`content-list-row-${String(e.id)}`,className:`hover:text-primary font-medium transition-colors`,children:e.title||(0,q.jsx)(`span`,{className:`text-muted-foreground italic`,children:(0,q.jsx)(i,{id:`entries.list.noTitle`,message:`(no title)`})})}),(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.slug}),(0,q.jsxs)(`div`,{className:h(`flex h-4 items-center gap-2 text-xs transition-opacity`,`invisible group-hover/row:visible focus-within:visible`),"data-testid":`content-list-row-actions-${String(e.id)}`,children:[(0,q.jsx)(l,{to:`/entries/$slug/$id/edit`,params:{slug:t,id:e.id},className:`text-muted-foreground hover:text-foreground`,children:p}),_?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`|`}),(0,q.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>{a(e.id)},className:`text-muted-foreground hover:text-destructive disabled:opacity-50`,"data-testid":`content-list-row-trash-${String(e.id)}`,children:m(o?X.rowTrashing:X.rowTrash)})]}):null,v?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`|`}),(0,q.jsx)(`button`,{type:`button`,disabled:c,onClick:()=>{s(e.id)},className:`text-muted-foreground hover:text-foreground disabled:opacity-50`,"data-testid":`content-list-row-duplicate-${String(e.id)}`,children:m(c?X.rowDuplicating:X.rowDuplicate)})]}):null,y?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`|`}),(0,q.jsx)(`button`,{type:`button`,disabled:d,onClick:()=>{u(e.id)},className:`text-muted-foreground hover:text-foreground disabled:opacity-50`,"data-testid":`content-list-row-restore-${String(e.id)}`,children:m(d?X.rowRestoring:X.rowRestore)}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground/50`,children:`|`}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>{f(e.id)},className:`text-muted-foreground hover:text-destructive`,"data-testid":`content-list-row-delete-${String(e.id)}`,children:m(X.rowDelete)})]}):null]})]})}function be({value:e,onChange:t}){let n=z();return(0,q.jsx)(R,{type:`single`,variant:`outline`,value:e,onValueChange:e=>{t(e||`all`)},"aria-label":n(X.filterStatusAria),children:pe.map(e=>(0,q.jsx)(ae,{value:e.value,"data-testid":`status-view-${e.value}`,children:n(e.label)},e.value))})}var xe=[],Se=[],Ce=[{value:`all`,label:X.authorAll},{value:`mine`,label:X.authorMine}];function we({value:e,onChange:t}){let n=z();return(0,q.jsxs)(m,{value:e,onValueChange:e=>{t(e)},children:[(0,q.jsx)(d,{size:`sm`,"aria-label":n(X.filterAuthorAria),"data-testid":`author-filter`,children:(0,q.jsx)(u,{})}),(0,q.jsx)(f,{children:Ce.map(e=>(0,q.jsx)(p,{value:e.value,"data-testid":`author-filter-${e.value}`,children:n(e.label)},e.value))})]})}function Te({taxonomyName:e,value:t,onChange:n}){let r=z(),i=B(e),o=s(a.term.list.queryOptions({input:{taxonomy:e,limit:200}})),c=i?.isHierarchical===!0;return(0,q.jsx)(C,{options:(0,K.useMemo)(()=>te(o.data??xe,c),[o.data,c]),value:t,onChange:n,placeholder:r(V(i,`allItems`)),searchPlaceholder:r(V(i,`searchItems`)),emptyText:r(V(i,`noMatch`)),"aria-label":r(V(i,`filterByItem`)),testId:`taxonomy-filter-${e}`})}function Ee({entryType:e,canCreate:t,entryTypeSlug:n}){let r=z(),a=r(H(e,`addNewItem`));return(0,q.jsxs)(ee,{"data-testid":`content-list-empty-state`,className:`border`,children:[(0,q.jsxs)(v,{children:[(0,q.jsx)(b,{children:r(H(e,`notFound`))}),(0,q.jsx)(x,{children:(0,q.jsx)(i,{id:`entries.list.empty.description`,message:`Create one to see it here.`})})]}),(0,q.jsx)(y,{children:t?(0,q.jsx)(_,{asChild:!0,children:(0,q.jsxs)(l,{to:`/entries/$slug/create`,params:{slug:n},children:[(0,q.jsx)(M,{}),a]})}):(0,q.jsxs)(_,{disabled:!0,children:[(0,q.jsx)(M,{}),a]})})]})}export{ve as component};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_slug-Bdb7jL1l.js","./jsx-runtime-DUAcabCT.js","./react-DbyrFoBd.js","./dist-BL2bKHuR.js","./orpc-CmtRGLtZ.js","./useQuery-QAYxQfCx.js","./useMutation-vgMtqBOX.js","./link-CI3qhqYu.js","./react-dom-i-Mcm3wj.js","./useStore-Vo4KhxPy.js","./with-selector-Bf4HMdmS.js","./select-D3kIVy0H.js","./dist-Dgy1ZZMQ.js","./dist-C4yHjFuP.js","./dist-BbwCNMFC.js","./dist-vYFq1OyT.js","./es2015-Di0DqwZ-.js","./dist-BP9v0gZx.js","./utils-DKOQrNEG.js","./createLucideIcon-C0O-yxZG.js","./button-DG1Ca1S5.js","./dist-B66OmIyr.js","./empty-p3QKoEqD.js","./toast-CWtRg47-.js","./sonner-1kBVu4ZN.js","./dist-RxmsRBXP.js","./dist-DWZq3eNY.js","./dist-Cz1zPiFe.js","./breadcrumb-x0qfIbU9.js","./skeleton-BnBM1862.js","./input-xYuLUQID.js","./separator-DzRLZTkg.js","./dist-BaNJ6JYm.js","./tooltip-Bf2rZUeB.js","./dist-BreUs1Gf.js","./chevrons-up-down-DmmG8bmI.js","./utils-kFAy0YTP.js","./textarea-iIsBg5jH.js","./dist-hUh7dFZi.js","./card-L2-kK5VK.js","./popover-BoiNmQB7.js","./dist-CFgtqwWs.js","./toggle-M64NT8hi.js","./form-B_PPIck3.js","./alert-cwX3fWUu.js","./use-label-CykSHq9A.js","./tree-BUpunTXw.js","./search-input-BG9KotQw.js","./manifest-Bdiv3Qyq.js","./style-emitter-CDGtTiRG.js","./caps-SYhabp1B.js","./use-formatters-DLJOFcWE.js","./dist-DKhWWf1L.js","./type-labels-DEpt0nSb.js","./dates-CSmOj6E-.js"])))=>i.map(i=>d[i]);
2
- import{T as e,a as t,t as n}from"./lazyRouteComponent-CQbKoKTD.js";import{s as r}from"./matchContext-DKtpdvCQ.js";import{r as i}from"./manifest-Bdiv3Qyq.js";import{D as a,E as o,_ as s,c,f as l,g as u,i as d,l as f,m as p,o as m,v as h,w as g,y as _}from"./dist-ClOzYsk5.js";var v=()=>e(()=>import(`./_slug-Bdb7jL1l.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54]),import.meta.url),y=c({page:u(d(_(p(),m(),l(1)),1),1),status:u(d(h([`draft`,`published`,`scheduled`,`trash`,`all`]),`all`),`all`),q:u(d(_(g(),a(),f(200),o(e=>e.length===0?void 0:e)),void 0)),author:u(d(h([`all`,`mine`]),`all`),`all`),orderBy:u(d(h([`updated_at`,`published_at`,`title`,`sort_order`]),`updated_at`),`updated_at`),order:u(d(h([`asc`,`desc`]),`desc`),`desc`)}),b=t(`/_authenticated/entries/$slug/`)({validateSearch:e=>s(y,e),beforeLoad:({params:e})=>{let t=i(e.slug);if(!t)throw r();return{entryType:t}},component:n(v,`component`)});export{b as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_slug-BfC_rJhz.js","./jsx-runtime-DUAcabCT.js","./react-DbyrFoBd.js","./dist-BL2bKHuR.js","./orpc-CmtRGLtZ.js","./useQuery-QAYxQfCx.js","./useMutation-vgMtqBOX.js","./link-CI3qhqYu.js","./react-dom-i-Mcm3wj.js","./useStore-Vo4KhxPy.js","./with-selector-Bf4HMdmS.js","./select-D3kIVy0H.js","./dist-Dgy1ZZMQ.js","./dist-C4yHjFuP.js","./dist-BbwCNMFC.js","./dist-vYFq1OyT.js","./es2015-Di0DqwZ-.js","./dist-BP9v0gZx.js","./utils-DKOQrNEG.js","./createLucideIcon-C0O-yxZG.js","./button-DG1Ca1S5.js","./dist-B66OmIyr.js","./empty-p3QKoEqD.js","./toast-26daCjvR.js","./sonner-1kBVu4ZN.js","./dist-RxmsRBXP.js","./dist-DWZq3eNY.js","./dist-Cz1zPiFe.js","./breadcrumb-Di_E7s51.js","./skeleton-BnBM1862.js","./input-xYuLUQID.js","./separator-DzRLZTkg.js","./dist-BaNJ6JYm.js","./tooltip-Bf2rZUeB.js","./dist-BreUs1Gf.js","./chevrons-up-down-DmmG8bmI.js","./utils-RSNxndzY.js","./textarea-iIsBg5jH.js","./dist-hUh7dFZi.js","./card-L2-kK5VK.js","./popover-BoiNmQB7.js","./dist-CFgtqwWs.js","./toggle-M64NT8hi.js","./form-CY307HEl.js","./alert-cwX3fWUu.js","./use-label-CykSHq9A.js","./tree-BUpunTXw.js","./search-input-B7zZp8UE.js","./manifest-2YUNz_ML.js","./style-emitter-CDGtTiRG.js","./caps-SYhabp1B.js","./use-formatters-DLJOFcWE.js","./dist-DKhWWf1L.js","./type-labels-DEpt0nSb.js","./dates-CSmOj6E-.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,a as t,t as n}from"./lazyRouteComponent-CQbKoKTD.js";import{s as r}from"./matchContext-DKtpdvCQ.js";import{r as i}from"./manifest-2YUNz_ML.js";import{D as a,E as o,_ as s,c,f as l,g as u,i as d,l as f,m as p,o as m,v as h,w as g,y as _}from"./dist-ClOzYsk5.js";var v=()=>e(()=>import(`./_slug-BfC_rJhz.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54]),import.meta.url),y=c({page:u(d(_(p(),m(),l(1)),1),1),status:u(d(h([`draft`,`published`,`scheduled`,`trash`,`all`]),`all`),`all`),q:u(d(_(g(),a(),f(200),o(e=>e.length===0?void 0:e)),void 0)),author:u(d(h([`all`,`mine`]),`all`),`all`),orderBy:u(d(h([`updated_at`,`published_at`,`title`,`sort_order`]),`updated_at`),`updated_at`),order:u(d(h([`asc`,`desc`]),`desc`),`desc`)}),b=t(`/_authenticated/entries/$slug/`)({validateSearch:e=>s(y,e),beforeLoad:({params:e})=>{let t=i(e.slug);if(!t)throw r();return{entryType:t}},component:n(v,`component`)});export{b as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a}from"./useMutation-vgMtqBOX.js";import{n as o}from"./useStore-Vo4KhxPy.js";import{t as s}from"./button-DG1Ca1S5.js";import{f as c}from"./manifest-Bdiv3Qyq.js";import{t as l}from"./session-Y-9LAiv-.js";import{n as u,r as d,t as f}from"./-locale-param-DNqvygi2.js";import{a as p,i as m,n as h,r as g,t as _}from"./card-L2-kK5VK.js";import{t as v}from"./_token-DVnFp6Xw.js";import{t as y}from"./input-xYuLUQID.js";import{a as b,o as x,t as S}from"./passkey-DN4QfROE.js";import{a as C,f as w,i as T,n as E,o as D,s as O,t as k}from"./form-B_PPIck3.js";import{n as A,t as j}from"./alert-cwX3fWUu.js";var M=e(n()),N=e(t());function P(){let e=x(),{token:t}=v.useParams(),n=v.useSearch(),P=c(),{i18n:F}=r(),I=o(),[L,R]=(0,M.useState)(null),z=e=>{u(e),window.location.assign(f(n,e))},B=a({mutationFn:e=>S({token:t,...e.name?{name:e.name}:{}}),onMutate:()=>{R(null)},onSuccess:async()=>{await I.options.context.queryClient.invalidateQueries({queryKey:l}),await I.navigate({to:`/`})},onError:e=>{R(e instanceof b?e.code:`unknown`)}}),V=w({defaultValues:{name:``}}),H=V.handleSubmit(e=>{B.mutate({name:e.name||void 0})});return(0,N.jsxs)(_,{children:[(0,N.jsxs)(m,{children:[(0,N.jsx)(p,{children:(0,N.jsx)(`h1`,{"data-testid":`accept-invite-heading`,children:(0,N.jsx)(i,{id:`auth.acceptInvite.title`,message:`Accept your invite`})})}),(0,N.jsx)(g,{children:(0,N.jsx)(i,{id:`auth.acceptInvite.description`,message:`Set up a passkey to finish creating your account. Your browser or device will guide you through the prompt.`})})]}),(0,N.jsxs)(h,{children:[(0,N.jsx)(k,{...V,children:(0,N.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:H,children:[(0,N.jsx)(T,{control:V.control,name:`name`,render:({field:e})=>(0,N.jsxs)(C,{children:[(0,N.jsx)(D,{children:(0,N.jsx)(i,{id:`auth.acceptInvite.name`,message:`Name`})}),(0,N.jsx)(E,{children:(0,N.jsx)(y,{type:`text`,autoComplete:`name`,disabled:B.isPending,"data-testid":`accept-invite-name-input`,...e})}),(0,N.jsx)(O,{})]})}),L?(0,N.jsx)(j,{variant:`destructive`,"data-testid":`accept-invite-error`,children:(0,N.jsx)(A,{children:e(L)})}):null,(0,N.jsx)(s,{type:`submit`,disabled:B.isPending,"data-testid":`accept-invite-submit`,children:B.isPending?(0,N.jsx)(i,{id:`auth.acceptInvite.submit.pending`,message:`Setting up…`}):(0,N.jsx)(i,{id:`auth.acceptInvite.submit.idle`,message:`Create passkey`})})]})}),(0,N.jsx)(d,{currentCode:F.locale,manifest:P,onSelect:z})]})]})}export{P as component};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a}from"./useMutation-vgMtqBOX.js";import{n as o}from"./useStore-Vo4KhxPy.js";import{t as s}from"./button-DG1Ca1S5.js";import{p as c}from"./manifest-2YUNz_ML.js";import{t as l}from"./session-Y-9LAiv-.js";import{n as u,r as d,t as f}from"./-locale-param-DNqvygi2.js";import{a as p,i as m,n as h,r as g,t as _}from"./card-L2-kK5VK.js";import{t as v}from"./_token-Dsc9zTxr.js";import{t as y}from"./input-xYuLUQID.js";import{a as b,o as x,t as S}from"./passkey-DN4QfROE.js";import{a as C,f as w,i as T,n as E,o as D,s as O,t as k}from"./form-CY307HEl.js";import{n as A,t as j}from"./alert-cwX3fWUu.js";var M=e(n()),N=e(t());function P(){let e=x(),{token:t}=v.useParams(),n=v.useSearch(),P=c(),{i18n:F}=r(),I=o(),[L,R]=(0,M.useState)(null),z=e=>{u(e),window.location.assign(f(n,e))},B=a({mutationFn:e=>S({token:t,...e.name?{name:e.name}:{}}),onMutate:()=>{R(null)},onSuccess:async()=>{await I.options.context.queryClient.invalidateQueries({queryKey:l}),await I.navigate({to:`/`})},onError:e=>{R(e instanceof b?e.code:`unknown`)}}),V=w({defaultValues:{name:``}}),H=V.handleSubmit(e=>{B.mutate({name:e.name||void 0})});return(0,N.jsxs)(_,{children:[(0,N.jsxs)(m,{children:[(0,N.jsx)(p,{children:(0,N.jsx)(`h1`,{"data-testid":`accept-invite-heading`,children:(0,N.jsx)(i,{id:`auth.acceptInvite.title`,message:`Accept your invite`})})}),(0,N.jsx)(g,{children:(0,N.jsx)(i,{id:`auth.acceptInvite.description`,message:`Set up a passkey to finish creating your account. Your browser or device will guide you through the prompt.`})})]}),(0,N.jsxs)(h,{children:[(0,N.jsx)(k,{...V,children:(0,N.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:H,children:[(0,N.jsx)(T,{control:V.control,name:`name`,render:({field:e})=>(0,N.jsxs)(C,{children:[(0,N.jsx)(D,{children:(0,N.jsx)(i,{id:`auth.acceptInvite.name`,message:`Name`})}),(0,N.jsx)(E,{children:(0,N.jsx)(y,{type:`text`,autoComplete:`name`,disabled:B.isPending,"data-testid":`accept-invite-name-input`,...e})}),(0,N.jsx)(O,{})]})}),L?(0,N.jsx)(j,{variant:`destructive`,"data-testid":`accept-invite-error`,children:(0,N.jsx)(A,{children:e(L)})}):null,(0,N.jsx)(s,{type:`submit`,disabled:B.isPending,"data-testid":`accept-invite-submit`,children:B.isPending?(0,N.jsx)(i,{id:`auth.acceptInvite.submit.pending`,message:`Setting up…`}):(0,N.jsx)(i,{id:`auth.acceptInvite.submit.idle`,message:`Create passkey`})})]})}),(0,N.jsx)(d,{currentCode:F.locale,manifest:P,onSelect:z})]})]})}export{P as component};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_token-s0TefqyQ.js","./jsx-runtime-DUAcabCT.js","./react-DbyrFoBd.js","./dist-BL2bKHuR.js","./useMutation-vgMtqBOX.js","./orpc-CmtRGLtZ.js","./useStore-Vo4KhxPy.js","./with-selector-Bf4HMdmS.js","./button-DG1Ca1S5.js","./dist-Dgy1ZZMQ.js","./utils-DKOQrNEG.js","./dist-B66OmIyr.js","./manifest-Bdiv3Qyq.js","./style-emitter-CDGtTiRG.js","./session-Y-9LAiv-.js","./matchContext-DKtpdvCQ.js","./-locale-param-DNqvygi2.js","./select-D3kIVy0H.js","./react-dom-i-Mcm3wj.js","./dist-C4yHjFuP.js","./dist-BbwCNMFC.js","./dist-vYFq1OyT.js","./es2015-Di0DqwZ-.js","./dist-BP9v0gZx.js","./createLucideIcon-C0O-yxZG.js","./card-L2-kK5VK.js","./input-xYuLUQID.js","./passkey-DN4QfROE.js","./use-label-CykSHq9A.js","./form-B_PPIck3.js","./alert-cwX3fWUu.js"])))=>i.map(i=>d[i]);
2
- import{T as e,a as t,t as n}from"./lazyRouteComponent-CQbKoKTD.js";import{i as r}from"./matchContext-DKtpdvCQ.js";import{r as i}from"./session-Y-9LAiv-.js";import{n as a}from"./-schemas-Cbs_-MW6.js";var o=t(`/_auth/accept-invite/$token`)({validateSearch:a,beforeLoad:async({context:e})=>{if((await e.queryClient.ensureQueryData(i())).user)throw r({to:`/`})},component:n(()=>e(()=>import(`./_token-s0TefqyQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]),import.meta.url),`component`)});export{o as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_token-D-j4VVVI.js","./jsx-runtime-DUAcabCT.js","./react-DbyrFoBd.js","./dist-BL2bKHuR.js","./useMutation-vgMtqBOX.js","./orpc-CmtRGLtZ.js","./useStore-Vo4KhxPy.js","./with-selector-Bf4HMdmS.js","./button-DG1Ca1S5.js","./dist-Dgy1ZZMQ.js","./utils-DKOQrNEG.js","./dist-B66OmIyr.js","./manifest-2YUNz_ML.js","./style-emitter-CDGtTiRG.js","./session-Y-9LAiv-.js","./matchContext-DKtpdvCQ.js","./-locale-param-DNqvygi2.js","./select-D3kIVy0H.js","./react-dom-i-Mcm3wj.js","./dist-C4yHjFuP.js","./dist-BbwCNMFC.js","./dist-vYFq1OyT.js","./es2015-Di0DqwZ-.js","./dist-BP9v0gZx.js","./createLucideIcon-C0O-yxZG.js","./card-L2-kK5VK.js","./input-xYuLUQID.js","./passkey-DN4QfROE.js","./use-label-CykSHq9A.js","./form-CY307HEl.js","./alert-cwX3fWUu.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,a as t,t as n}from"./lazyRouteComponent-CQbKoKTD.js";import{i as r}from"./matchContext-DKtpdvCQ.js";import{r as i}from"./session-Y-9LAiv-.js";import{n as a}from"./-schemas-Cbs_-MW6.js";var o=t(`/_auth/accept-invite/$token`)({validateSearch:a,beforeLoad:async({context:e})=>{if((await e.queryClient.ensureQueryData(i())).user)throw r({to:`/`})},component:n(()=>e(()=>import(`./_token-D-j4VVVI.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]),import.meta.url),`component`)});export{o as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a,u as o}from"./orpc-CmtRGLtZ.js";import{t as s}from"./useQuery-QAYxQfCx.js";import{t as c}from"./useMutation-vgMtqBOX.js";import{a as l,i as u,n as d,r as f,t as p}from"./select-D3kIVy0H.js";import{t as m}from"./button-DG1Ca1S5.js";import{t as h}from"./trash-2-Bn-rv3EX.js";import{t as g}from"./use-label-CykSHq9A.js";import{D as _,T as v,h as y,v as b,w as x,x as S,y as C}from"./dist-ClOzYsk5.js";import{n as w}from"./vmessage-CRX68a8a.js";import{t as T}from"./user-role-labels-NFC7DRSs.js";import{a as E,i as D,n as O,r as k,t as A}from"./card-L2-kK5VK.js";import{t as j}from"./input-xYuLUQID.js";import{t as M}from"./toggle-M64NT8hi.js";import{a as N,f as P,i as F,n as I,o as L,s as R,t as z}from"./form-B_PPIck3.js";import{n as B,t as V}from"./alert-cwX3fWUu.js";import{t as H}from"./valibot-DO4fmSyX.js";var U=e(n()),W=e(t()),G=[`subscriber`,`contributor`,`author`,`editor`,`admin`],K={domainPlaceholder:{id:`allowedDomains.add.placeholder`},deleteAria:{id:`allowedDomains.row.deleteAria`},errDomainExists:{id:`allowedDomains.error.domainExists`},errFallback:{id:`allowedDomains.error.fallback`}},q=y({domain:C(x(),_(),v(),S(/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,w({id:`allowedDomains.add.domain.invalid`}))),defaultRole:b(G)});function J(){let e=g(),t=o(),[n,r]=(0,U.useState)(null),h=s(a.auth.allowedDomains.list.queryOptions({input:{}})),_=()=>t.invalidateQueries({queryKey:a.auth.allowedDomains.list.key()}),v=c({mutationFn:e=>a.auth.allowedDomains.create.call(e),onMutate:()=>r(null),onSuccess:async()=>{await _(),x.reset({domain:``,defaultRole:`subscriber`})},onError:e=>r(X(e))}),y=c({mutationFn:e=>a.auth.allowedDomains.update.call(e),onSuccess:()=>_()}),b=c({mutationFn:e=>a.auth.allowedDomains.delete.call(e),onSuccess:()=>_()}),x=P({resolver:H(q),defaultValues:{domain:``,defaultRole:`subscriber`},mode:`onBlur`}),S=x.handleSubmit(e=>{v.mutate({domain:e.domain,defaultRole:e.defaultRole})});return(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4`,children:[(0,W.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`h1`,{className:`text-2xl font-semibold`,"data-testid":`allowed-domains-heading`,children:(0,W.jsx)(i,{id:`allowedDomains.title`,message:`Allowed domains`})}),(0,W.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,W.jsx)(i,{id:`allowedDomains.description`,message:`Email domains permitted to sign up via OAuth. New OAuth accounts are created with the role set here. Disabled rows reject signup but preserve their role mapping.`})})]}),(0,W.jsxs)(A,{children:[(0,W.jsxs)(D,{children:[(0,W.jsx)(E,{children:(0,W.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,W.jsx)(i,{id:`allowedDomains.add.title`,message:`Add domain`})})}),(0,W.jsx)(k,{children:(0,W.jsx)(i,{id:`allowedDomains.add.description`,message:`Use the bare domain — no protocol, no path.`})})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(z,{...x,children:(0,W.jsxs)(`form`,{className:`flex flex-col gap-4 sm:flex-row sm:items-end`,onSubmit:S,children:[(0,W.jsx)(F,{control:x.control,name:`domain`,render:({field:t})=>(0,W.jsxs)(N,{className:`flex-1`,children:[(0,W.jsx)(L,{children:(0,W.jsx)(i,{id:`allowedDomains.add.domain.label`,message:`Domain`})}),(0,W.jsx)(I,{children:(0,W.jsx)(j,{type:`text`,placeholder:e(K.domainPlaceholder),autoComplete:`off`,spellCheck:!1,"data-testid":`allowed-domains-domain-input`,disabled:v.isPending,...t})}),(0,W.jsx)(R,{})]})}),(0,W.jsx)(F,{control:x.control,name:`defaultRole`,render:({field:t})=>(0,W.jsxs)(N,{className:`sm:w-48`,children:[(0,W.jsx)(L,{children:(0,W.jsx)(i,{id:`allowedDomains.add.defaultRole.label`,message:`Default role`})}),(0,W.jsxs)(p,{value:t.value,onValueChange:t.onChange,disabled:v.isPending,children:[(0,W.jsx)(I,{children:(0,W.jsx)(u,{"data-testid":`allowed-domains-role-select`,children:(0,W.jsx)(l,{})})}),(0,W.jsx)(d,{children:G.map(t=>(0,W.jsx)(f,{value:t,children:e(T[t])},t))})]}),(0,W.jsx)(R,{})]})}),(0,W.jsx)(m,{type:`submit`,disabled:v.isPending,"data-testid":`allowed-domains-add-button`,children:v.isPending?(0,W.jsx)(i,{id:`allowedDomains.add.submit.pending`,message:`Adding…`}):(0,W.jsx)(i,{id:`allowedDomains.add.submit.idle`,message:`Add`})})]})}),n?(0,W.jsx)(V,{variant:`destructive`,className:`mt-4`,"data-testid":`allowed-domains-error`,children:(0,W.jsx)(B,{children:e(n)})}):null]})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(D,{children:(0,W.jsx)(E,{children:(0,W.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,W.jsx)(i,{id:`allowedDomains.list.title`,message:`Configured domains`})})})}),(0,W.jsx)(O,{children:h.isLoading?(0,W.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`allowed-domains-loading`,children:(0,W.jsx)(i,{id:`allowedDomains.list.loading`,message:`Loading…`})}):(h.data??[]).length===0?(0,W.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`allowed-domains-empty`,children:(0,W.jsx)(i,{id:`allowedDomains.list.empty`,message:`No domains configured. OAuth signup is closed until at least one enabled domain is added.`})}):(0,W.jsx)(`ul`,{className:`flex flex-col gap-2`,"data-testid":`allowed-domains-list`,children:(h.data??[]).map(e=>(0,W.jsx)(Y,{row:e,onToggle:t=>{y.mutate({domain:e.domain,isEnabled:t})},onChangeRole:t=>{y.mutate({domain:e.domain,defaultRole:t})},onDelete:()=>{b.mutate({domain:e.domain})},busy:y.isPending||b.isPending},e.domain))})})]})]})}function Y({row:e,onToggle:t,onChangeRole:n,onDelete:a,busy:o}){let{i18n:s}=r(),c=g(),[_,v]=(0,U.useState)(!1);return(0,W.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-md border p-3 sm:flex-row sm:items-center sm:gap-4`,"data-testid":`allowed-domains-row-${e.domain}`,children:[(0,W.jsx)(`span`,{className:`flex-1 font-mono text-sm`,children:e.domain}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(p,{value:e.defaultRole,onValueChange:e=>n(e),disabled:o,children:[(0,W.jsx)(u,{className:`w-44`,"data-testid":`allowed-domains-row-role-${e.domain}`,children:(0,W.jsx)(l,{})}),(0,W.jsx)(d,{children:G.map(e=>(0,W.jsx)(f,{value:e,children:c(T[e])},e))})]}),(0,W.jsx)(M,{variant:`outline`,size:`sm`,pressed:e.isEnabled,onPressedChange:t,disabled:o,"data-testid":`allowed-domains-row-toggle-${e.domain}`,children:e.isEnabled?(0,W.jsx)(i,{id:`allowedDomains.row.enabled`,message:`Enabled`}):(0,W.jsx)(i,{id:`allowedDomains.row.disabled`,message:`Disabled`})}),_?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(m,{type:`button`,variant:`destructive`,size:`sm`,onClick:()=>{v(!1),a()},disabled:o,"data-testid":`allowed-domains-row-delete-confirm-${e.domain}`,children:(0,W.jsx)(i,{id:`allowedDomains.row.deleteConfirm`,message:`Confirm delete`})}),(0,W.jsx)(m,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>v(!1),disabled:o,"data-testid":`allowed-domains-row-delete-cancel-${e.domain}`,children:(0,W.jsx)(i,{id:`allowedDomains.row.deleteCancel`,message:`Cancel`})})]}):(0,W.jsx)(m,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>v(!0),disabled:o,"aria-label":s._(K.deleteAria.id,{domain:e.domain},{message:K.deleteAria.message}),"data-testid":`allowed-domains-row-delete-${e.domain}`,children:(0,W.jsx)(h,{className:`size-4`})})]})]})}function X(e){return e&&typeof e==`object`&&`data`in e&&e.data?.reason===`domain_exists`?K.errDomainExists:e instanceof Error?e.message:K.errFallback}export{J as component};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{t as a,u as o}from"./orpc-CmtRGLtZ.js";import{t as s}from"./useQuery-QAYxQfCx.js";import{t as c}from"./useMutation-vgMtqBOX.js";import{a as l,i as u,n as d,r as f,t as p}from"./select-D3kIVy0H.js";import{t as m}from"./button-DG1Ca1S5.js";import{t as h}from"./trash-2-Bn-rv3EX.js";import{t as g}from"./use-label-CykSHq9A.js";import{D as _,T as v,h as y,v as b,w as x,x as S,y as C}from"./dist-ClOzYsk5.js";import{n as w}from"./vmessage-CRX68a8a.js";import{t as T}from"./user-role-labels-NFC7DRSs.js";import{a as E,i as D,n as O,r as k,t as A}from"./card-L2-kK5VK.js";import{t as j}from"./input-xYuLUQID.js";import{t as M}from"./toggle-M64NT8hi.js";import{a as N,f as P,i as F,n as I,o as L,s as R,t as z}from"./form-CY307HEl.js";import{n as B,t as V}from"./alert-cwX3fWUu.js";import{t as H}from"./valibot-CHirPb_E.js";var U=e(n()),W=e(t()),G=[`subscriber`,`contributor`,`author`,`editor`,`admin`],K={domainPlaceholder:{id:`allowedDomains.add.placeholder`},deleteAria:{id:`allowedDomains.row.deleteAria`},errDomainExists:{id:`allowedDomains.error.domainExists`},errFallback:{id:`allowedDomains.error.fallback`}},q=y({domain:C(x(),_(),v(),S(/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,w({id:`allowedDomains.add.domain.invalid`}))),defaultRole:b(G)});function J(){let e=g(),t=o(),[n,r]=(0,U.useState)(null),h=s(a.auth.allowedDomains.list.queryOptions({input:{}})),_=()=>t.invalidateQueries({queryKey:a.auth.allowedDomains.list.key()}),v=c({mutationFn:e=>a.auth.allowedDomains.create.call(e),onMutate:()=>r(null),onSuccess:async()=>{await _(),x.reset({domain:``,defaultRole:`subscriber`})},onError:e=>r(X(e))}),y=c({mutationFn:e=>a.auth.allowedDomains.update.call(e),onSuccess:()=>_()}),b=c({mutationFn:e=>a.auth.allowedDomains.delete.call(e),onSuccess:()=>_()}),x=P({resolver:H(q),defaultValues:{domain:``,defaultRole:`subscriber`},mode:`onBlur`}),S=x.handleSubmit(e=>{v.mutate({domain:e.domain,defaultRole:e.defaultRole})});return(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4`,children:[(0,W.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`h1`,{className:`text-2xl font-semibold`,"data-testid":`allowed-domains-heading`,children:(0,W.jsx)(i,{id:`allowedDomains.title`,message:`Allowed domains`})}),(0,W.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,W.jsx)(i,{id:`allowedDomains.description`,message:`Email domains permitted to sign up via OAuth. New OAuth accounts are created with the role set here. Disabled rows reject signup but preserve their role mapping.`})})]}),(0,W.jsxs)(A,{children:[(0,W.jsxs)(D,{children:[(0,W.jsx)(E,{children:(0,W.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,W.jsx)(i,{id:`allowedDomains.add.title`,message:`Add domain`})})}),(0,W.jsx)(k,{children:(0,W.jsx)(i,{id:`allowedDomains.add.description`,message:`Use the bare domain — no protocol, no path.`})})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(z,{...x,children:(0,W.jsxs)(`form`,{className:`flex flex-col gap-4 sm:flex-row sm:items-end`,onSubmit:S,children:[(0,W.jsx)(F,{control:x.control,name:`domain`,render:({field:t})=>(0,W.jsxs)(N,{className:`flex-1`,children:[(0,W.jsx)(L,{children:(0,W.jsx)(i,{id:`allowedDomains.add.domain.label`,message:`Domain`})}),(0,W.jsx)(I,{children:(0,W.jsx)(j,{type:`text`,placeholder:e(K.domainPlaceholder),autoComplete:`off`,spellCheck:!1,"data-testid":`allowed-domains-domain-input`,disabled:v.isPending,...t})}),(0,W.jsx)(R,{})]})}),(0,W.jsx)(F,{control:x.control,name:`defaultRole`,render:({field:t})=>(0,W.jsxs)(N,{className:`sm:w-48`,children:[(0,W.jsx)(L,{children:(0,W.jsx)(i,{id:`allowedDomains.add.defaultRole.label`,message:`Default role`})}),(0,W.jsxs)(p,{value:t.value,onValueChange:t.onChange,disabled:v.isPending,children:[(0,W.jsx)(I,{children:(0,W.jsx)(u,{"data-testid":`allowed-domains-role-select`,children:(0,W.jsx)(l,{})})}),(0,W.jsx)(d,{children:G.map(t=>(0,W.jsx)(f,{value:t,children:e(T[t])},t))})]}),(0,W.jsx)(R,{})]})}),(0,W.jsx)(m,{type:`submit`,disabled:v.isPending,"data-testid":`allowed-domains-add-button`,children:v.isPending?(0,W.jsx)(i,{id:`allowedDomains.add.submit.pending`,message:`Adding…`}):(0,W.jsx)(i,{id:`allowedDomains.add.submit.idle`,message:`Add`})})]})}),n?(0,W.jsx)(V,{variant:`destructive`,className:`mt-4`,"data-testid":`allowed-domains-error`,children:(0,W.jsx)(B,{children:e(n)})}):null]})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(D,{children:(0,W.jsx)(E,{children:(0,W.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,W.jsx)(i,{id:`allowedDomains.list.title`,message:`Configured domains`})})})}),(0,W.jsx)(O,{children:h.isLoading?(0,W.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`allowed-domains-loading`,children:(0,W.jsx)(i,{id:`allowedDomains.list.loading`,message:`Loading…`})}):(h.data??[]).length===0?(0,W.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`allowed-domains-empty`,children:(0,W.jsx)(i,{id:`allowedDomains.list.empty`,message:`No domains configured. OAuth signup is closed until at least one enabled domain is added.`})}):(0,W.jsx)(`ul`,{className:`flex flex-col gap-2`,"data-testid":`allowed-domains-list`,children:(h.data??[]).map(e=>(0,W.jsx)(Y,{row:e,onToggle:t=>{y.mutate({domain:e.domain,isEnabled:t})},onChangeRole:t=>{y.mutate({domain:e.domain,defaultRole:t})},onDelete:()=>{b.mutate({domain:e.domain})},busy:y.isPending||b.isPending},e.domain))})})]})]})}function Y({row:e,onToggle:t,onChangeRole:n,onDelete:a,busy:o}){let{i18n:s}=r(),c=g(),[_,v]=(0,U.useState)(!1);return(0,W.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-md border p-3 sm:flex-row sm:items-center sm:gap-4`,"data-testid":`allowed-domains-row-${e.domain}`,children:[(0,W.jsx)(`span`,{className:`flex-1 font-mono text-sm`,children:e.domain}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsxs)(p,{value:e.defaultRole,onValueChange:e=>n(e),disabled:o,children:[(0,W.jsx)(u,{className:`w-44`,"data-testid":`allowed-domains-row-role-${e.domain}`,children:(0,W.jsx)(l,{})}),(0,W.jsx)(d,{children:G.map(e=>(0,W.jsx)(f,{value:e,children:c(T[e])},e))})]}),(0,W.jsx)(M,{variant:`outline`,size:`sm`,pressed:e.isEnabled,onPressedChange:t,disabled:o,"data-testid":`allowed-domains-row-toggle-${e.domain}`,children:e.isEnabled?(0,W.jsx)(i,{id:`allowedDomains.row.enabled`,message:`Enabled`}):(0,W.jsx)(i,{id:`allowedDomains.row.disabled`,message:`Disabled`})}),_?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(m,{type:`button`,variant:`destructive`,size:`sm`,onClick:()=>{v(!1),a()},disabled:o,"data-testid":`allowed-domains-row-delete-confirm-${e.domain}`,children:(0,W.jsx)(i,{id:`allowedDomains.row.deleteConfirm`,message:`Confirm delete`})}),(0,W.jsx)(m,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>v(!1),disabled:o,"data-testid":`allowed-domains-row-delete-cancel-${e.domain}`,children:(0,W.jsx)(i,{id:`allowedDomains.row.deleteCancel`,message:`Cancel`})})]}):(0,W.jsx)(m,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>v(!0),disabled:o,"aria-label":s._(K.deleteAria.id,{domain:e.domain},{message:K.deleteAria.message}),"data-testid":`allowed-domains-row-delete-${e.domain}`,children:(0,W.jsx)(h,{className:`size-4`})})]})]})}function X(e){return e&&typeof e==`object`&&`data`in e&&e.data?.reason===`domain_exists`?K.errDomainExists:e instanceof Error?e.message:K.errFallback}export{J as component};