@heybejs/core 1.5.1 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/package.json +1 -1
  2. package/src/db.ts +2 -1
  3. package/src/http/routes/health.ts +9 -0
  4. package/src/http/routes/realtime.ts +4 -0
  5. package/src/settings.ts +1 -1
  6. package/src/test-app.ts +5 -0
  7. package/ui/dist/assets/ApplicationPage-DkTYH6WR.js +1 -0
  8. package/ui/dist/assets/AuthCard-wJUv2Sdn.js +1 -0
  9. package/ui/dist/assets/AuthProvidersPage-Bx_JWAxt.js +1 -0
  10. package/ui/dist/assets/BackupsPage-BrFhpIgH.js +1 -0
  11. package/ui/dist/assets/Checkbox-qSXPT8qz.js +1 -0
  12. package/ui/dist/assets/CodeArea-D6AGlQG3.js +34 -0
  13. package/ui/dist/assets/CollectionsLayout-Bqr--gSO.js +8 -0
  14. package/ui/dist/assets/ConfirmEmailChangePage-C5AfNHo0.js +1 -0
  15. package/ui/dist/assets/ConfirmPasswordResetPage-Coe2vuTr.js +1 -0
  16. package/ui/dist/assets/ConfirmVerificationPage-BGX02YAe.js +1 -0
  17. package/ui/dist/assets/CopyButton-WiZL23ED.js +1 -0
  18. package/ui/dist/assets/CronsPage-BVCoYpo1.js +1 -0
  19. package/ui/dist/assets/EmptyState-BNvwv3Xw.js +1 -0
  20. package/ui/dist/assets/ExportPage-BLVcCe2X.js +1 -0
  21. package/ui/dist/assets/ExtensionPage-LezAvM5y.js +1 -0
  22. package/ui/dist/assets/FileField-BIdUasnF.js +1 -0
  23. package/ui/dist/assets/FormFooter-Ct4RFwgS.js +1 -0
  24. package/ui/dist/assets/ImportPage-DDr49aa6.js +1 -0
  25. package/ui/dist/assets/InstallerPage-DEl_f6Iv.js +1 -0
  26. package/ui/dist/assets/InvalidLink-DYrsAHEH.js +1 -0
  27. package/ui/dist/assets/LoginPage-DHnB3eBk.js +1 -0
  28. package/ui/dist/assets/Logo-Dn44Zx6g.js +1 -0
  29. package/ui/dist/assets/LogsPage-BAyH1SUu.js +1 -0
  30. package/ui/dist/assets/MailPage-BbLaQUdV.js +1 -0
  31. package/ui/dist/assets/Match-rL_mIMP3.js +1 -0
  32. package/ui/dist/assets/NumberField-83x9ooVV.js +1 -0
  33. package/ui/dist/assets/OAuth2RedirectPage-BGRd57zj.js +1 -0
  34. package/ui/dist/assets/Page-K-gAWDfu.js +1 -0
  35. package/ui/dist/assets/Popover-ykZ3O0Av.js +1 -0
  36. package/ui/dist/assets/ProviderDialog-DogoekAe.js +1 -0
  37. package/ui/dist/assets/QueryStatus-eTXKeftu.js +1 -0
  38. package/ui/dist/assets/RequestResetPage-CvVIo7hl.js +1 -0
  39. package/ui/dist/assets/{RichTextEditor-1oGZgu61.js → RichTextEditor-Bc3uTBp0.js} +5 -5
  40. package/ui/dist/assets/S3Fields-DejLGW2D.js +1 -0
  41. package/ui/dist/assets/SearchBar-DPaUcuh2.js +1 -0
  42. package/ui/dist/assets/Select-DsX5Ea_q.js +1 -0
  43. package/ui/dist/assets/SettingsLayout-wZHtJg8F.js +1 -0
  44. package/ui/dist/assets/SettingsPage-D8K4z39N.js +1 -0
  45. package/ui/dist/assets/SqlPage-CgdNUnO5.js +1 -0
  46. package/ui/dist/assets/StoragePage-Da-g-Cz5.js +1 -0
  47. package/ui/dist/assets/Switch-Duu2pizo.js +1 -0
  48. package/ui/dist/assets/Table-B0wJiwif.js +1 -0
  49. package/ui/dist/assets/TextField-IItAFjU7.js +1 -0
  50. package/ui/dist/assets/Tooltip-DMaATQZc.js +1 -0
  51. package/ui/dist/assets/atom-CsaMUDV6.js +1 -0
  52. package/ui/dist/assets/check-Dy5JlAkz.js +1 -0
  53. package/ui/dist/assets/chevron-down-CdFqRe9V.js +1 -0
  54. package/ui/dist/assets/clock-CQa7hjXl.js +1 -0
  55. package/ui/dist/assets/context-BLpmYnEM.js +2 -0
  56. package/ui/dist/assets/error-DIHpHIMq.js +1 -0
  57. package/ui/dist/assets/errors-BzXFkL79.js +3 -0
  58. package/ui/dist/assets/field-LSvWL6SU.js +1 -0
  59. package/ui/dist/assets/field-types-DmEN723Z.js +1 -0
  60. package/ui/dist/assets/glass-aa3ISPbD.js +1 -0
  61. package/ui/dist/assets/import-diff-CeufMjY3.js +1 -0
  62. package/ui/dist/assets/index-K3jp0HKn.js +10 -0
  63. package/ui/dist/assets/jwt-DZxaQ4-r.js +1 -0
  64. package/ui/dist/assets/link-IcX1XVhI.js +1 -0
  65. package/ui/dist/assets/preload-helper-DH03enJy.js +1 -0
  66. package/ui/dist/assets/queries-CUkLB99G.js +1 -0
  67. package/ui/dist/assets/search-CViJCnFi.js +1 -0
  68. package/ui/dist/assets/session-oCkjTB0W.js +3 -0
  69. package/ui/dist/assets/settings-Cj7IKVDy.js +1 -0
  70. package/ui/dist/assets/trash-BR5toR-2.js +1 -0
  71. package/ui/dist/assets/use-settings-1G2lnVQh.js +1 -0
  72. package/ui/dist/assets/use-settings-form-DWwEeaUC.js +3 -0
  73. package/ui/dist/assets/useControlledState-jTKE_mWM.js +1 -0
  74. package/ui/dist/assets/useForm-BJzA_-qG.js +1 -0
  75. package/ui/dist/assets/useMatch-CtmIEv-a.js +1 -0
  76. package/ui/dist/assets/useMutation-DQ60EOwe.js +1 -0
  77. package/ui/dist/assets/useNavigate-COQv2_P5.js +1 -0
  78. package/ui/dist/assets/useOverlayState-C6tmr5St.js +1 -0
  79. package/ui/dist/assets/useParams-DGtzGjmL.js +1 -0
  80. package/ui/dist/assets/useQuery-B14t2xNU.js +1 -0
  81. package/ui/dist/assets/useSearch-CNiDThqu.js +1 -0
  82. package/ui/dist/assets/useSelector-CNRxEOGR.js +1 -0
  83. package/ui/dist/assets/useStore-g5QKCOo7.js +1 -0
  84. package/ui/dist/assets/useTopLayer-Dh6x1Bza.js +1 -0
  85. package/ui/dist/assets/with-selector-B7Ab9ZeQ.js +1 -0
  86. package/ui/dist/index.html +33 -2
  87. package/ui/dist/assets/Popover-BKknruJI.js +0 -34
  88. package/ui/dist/assets/index-zHgtVQ8_.js +0 -23
@@ -0,0 +1,8 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RichTextEditor-Bc3uTBp0.js","assets/rolldown-runtime-BWaJ3C7D.js","assets/field-LSvWL6SU.js","assets/glass-aa3ISPbD.js","assets/with-selector-B7Ab9ZeQ.js","assets/CodeArea-D6AGlQG3.js","assets/Popover-ykZ3O0Av.js","assets/useTopLayer-Dh6x1Bza.js","assets/useOverlayState-C6tmr5St.js","assets/useControlledState-jTKE_mWM.js","assets/Tooltip-DMaATQZc.js","assets/lib-C_lvLDN7.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{n as t,t as n}from"./useNavigate-COQv2_P5.js";import{n as r}from"./Match-rL_mIMP3.js";import{t as i}from"./useParams-DGtzGjmL.js";import{a,i as o,n as s,o as c,t as l}from"./field-LSvWL6SU.js";import{n as u,r as d,t as f}from"./queries-CUkLB99G.js";import{n as p}from"./use-settings-1G2lnVQh.js";import{t as m}from"./useQuery-B14t2xNU.js";import{E as h,a as g,c as _,o as v,r as y,s as b}from"./context-BLpmYnEM.js";import{t as x}from"./useSearch-CNiDThqu.js";import{n as S,r as C}from"./search-CViJCnFi.js";import{a as w,c as T,i as ee,n as E,o as D,r as O,s as k,t as te}from"./errors-BzXFkL79.js";import{n as A,r as j}from"./glass-aa3ISPbD.js";import{t as M}from"./settings-Cj7IKVDy.js";import{t as N}from"./EmptyState-BNvwv3Xw.js";import{t as ne}from"./Tooltip-DMaATQZc.js";import{t as P}from"./Page-K-gAWDfu.js";import{i as F,r as I,t as L}from"./NumberField-83x9ooVV.js";import{t as R}from"./CodeArea-D6AGlQG3.js";import{t as z}from"./CopyButton-WiZL23ED.js";import{a as re,i as ie,n as B,r as V,t as H}from"./Table-B0wJiwif.js";import{t as ae}from"./link-IcX1XVhI.js";import{t as oe}from"./chevron-down-CdFqRe9V.js";import{n as U,t as se}from"./preload-helper-DH03enJy.js";import{t as ce}from"./QueryStatus-eTXKeftu.js";import{t as W}from"./Checkbox-qSXPT8qz.js";import{n as le,r as ue,t as de}from"./Popover-ykZ3O0Av.js";import{t as fe}from"./useForm-BJzA_-qG.js";import{l as pe}from"./session-oCkjTB0W.js";import{i as me,n as he,o as ge,r as _e,s as ve,t as ye}from"./SearchBar-DPaUcuh2.js";import{t as be}from"./useMutation-DQ60EOwe.js";import{t as G}from"./TextField-IItAFjU7.js";import{t as xe}from"./FileField-BIdUasnF.js";import{t as Se}from"./Select-DsX5Ea_q.js";import{t as Ce}from"./useStore-g5QKCOo7.js";import{i as we,n as Te,r as Ee,t as De}from"./field-types-DmEN723Z.js";import{t as Oe}from"./clock-CQa7hjXl.js";import{t as ke}from"./trash-BR5toR-2.js";import{a as Ae,c as je,i as Me,l as Ne,n as K,o as Pe,r as Fe,s as Ie,t as Le,u as Re}from"./ProviderDialog-DogoekAe.js";var ze={name:`at-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]};ze.node;var Be=A(ze),Ve={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};Ve.node;var He=A(Ve),Ue={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Ue.node;var We=A(Ue),Ge={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Ge.node;var Ke=A(Ge),qe={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};qe.node;var Je=A(qe),Ye={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};Ye.node;var Xe=A(Ye),Ze={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};Ze.node;var Qe=A(Ze),$e={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};$e.node;var et=A($e),tt={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};tt.node;var nt=A(tt),rt={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};rt.node;var it=A(rt),at={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};at.node;var ot=A(at),st={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};st.node;var ct=A(st),lt={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};lt.node;var ut=A(lt),dt={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};dt.node;var ft=A(dt),pt={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};pt.node;var mt=A(pt),ht={name:`search-x`,size:24,node:[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};ht.node;var gt=A(ht),_t={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};_t.node;var vt=A(_t),yt={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};yt.node;var bt=A(yt),xt={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};xt.node;var St=A(xt),Ct={name:`users`,size:24,node:[[`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`}]]};Ct.node;var wt=A(Ct),q=e(c(),1),J=a();function Tt(e,t){return{tab:`${e}-tab-${t}`,panel:`${e}-panel-${t}`}}function Et(e){let t=(0,q.useId)(),n=e.id??t,r=(0,q.useRef)(null),i=e.tabs.filter(e=>!e.disabled),a=i.some(t=>t.value===e.value)?e.value:i[0]?.value,o=t=>{e.onChange(t),r.current?.querySelector(`[data-key="${CSS.escape(t)}"]`)?.focus()};return(0,J.jsx)(`div`,{ref:r,role:`tablist`,"aria-label":e.label,className:e.className,onKeyDown:t=>{if(!i.length)return;let n=i.findIndex(t=>t.value===e.value),r=n<=0?i.length-1:n-1,a=t.key===`ArrowRight`?i[(n+1)%i.length]:t.key===`ArrowLeft`?i[r]:t.key===`Home`?i[0]:t.key===`End`?i[i.length-1]:void 0;a&&(t.preventDefault(),o(a.value))},children:e.tabs.map(t=>{let r=t.value===e.value,i=Tt(n,t.value);return(0,J.jsx)(`button`,{id:i.tab,role:`tab`,type:`button`,"data-key":t.value,"aria-selected":r,"aria-controls":i.panel,"data-selected":r?``:void 0,disabled:t.disabled,tabIndex:t.value===a?0:-1,onClick:()=>e.onChange(t.value),children:t.label},t.value)})})}function Dt(e){return(0,J.jsx)(Et,{...e,className:`flex gap-1 border-b border-line [&_[role=tab]]:-mb-px [&_[role=tab]]:border-b-2 [&_[role=tab]]:border-transparent [&_[role=tab]]:px-3 [&_[role=tab]]:py-2 [&_[role=tab]]:text-sm [&_[role=tab]]:text-muted [&_[role=tab]]:transition-colors [&_[role=tab]]:duration-[var(--hb-duration)] motion-reduce:[&_[role=tab]]:transition-none [&_[role=tab]:disabled]:cursor-not-allowed [&_[role=tab]:disabled]:opacity-50 [&_[role=tab]:hover:not(:disabled)]:text-text [&_[role=tab]:focus-visible]:outline-2 [&_[role=tab]:focus-visible]:outline-focus [&_[role=tab][data-selected]]:border-accent [&_[role=tab][data-selected]]:font-medium [&_[role=tab][data-selected]]:text-text`})}function Ot(e){return e==null?`Superusers only`:e===``?`Everyone`:String(e)}function kt({collection:e,onClose:t}){let n=`/api/collections/${encodeURIComponent(e.name)}`,r=[[`List/Search`,`GET`,`${n}/records`,e.listRule],[`View`,`GET`,`${n}/records/{id}`,e.viewRule]];e.type!==`view`&&r.push([`Create`,`POST`,`${n}/records`,e.createRule],[`Update`,`PATCH`,`${n}/records/{id}`,e.updateRule],[`Delete`,`DELETE`,`${n}/records/{id}`,e.deleteRule]),e.type===`auth`&&r.push([`Auth with password`,`POST`,`${n}/auth-with-password`,e.authRule]);let i=[`import { createClient } from "@heybejs/client";`,``,`const heybe = createClient(${JSON.stringify(location.origin)});`,`const page = await heybe.records(${JSON.stringify(e.name)}).findMany({ page: 1, perPage: 20 });`].join(`
3
+ `);return(0,J.jsxs)(b,{open:!0,size:`lg`,onClose:t,title:`API preview`,children:[(0,J.jsxs)(H,{caption:`${e.name} endpoints`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(V,{children:`Action`}),(0,J.jsx)(V,{children:`Method`}),(0,J.jsx)(V,{children:`Path`}),(0,J.jsx)(V,{children:`Rule`})]})}),(0,J.jsx)(`tbody`,{children:r.map(([e,t,n,r])=>(0,J.jsxs)(`tr`,{className:`h-11`,children:[(0,J.jsx)(B,{children:e}),(0,J.jsx)(B,{children:(0,J.jsx)(F,{tone:`neutral`,children:t})}),(0,J.jsx)(B,{wrap:!0,children:(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`code`,{className:`min-w-0 max-w-md truncate`,title:n,children:n}),(0,J.jsx)(z,{text:n,label:`Copy ${e} path`})]})}),(0,J.jsx)(B,{children:Ot(r)})]},e))})]}),(0,J.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium`,children:`Client`}),(0,J.jsx)(z,{text:i,label:`Copy snippet`})]}),(0,J.jsx)(`div`,{className:`mt-1`,children:(0,J.jsx)(R,{label:`Client snippet`,hideLabel:!0,language:`javascript`,readOnly:!0,value:i})})]})}function At({collections:e,onClose:t}){let n=t=>e.find(e=>e.id===t)?.name??String(t);return(0,J.jsx)(b,{open:!0,onClose:t,title:`Collections overview`,children:(0,J.jsxs)(H,{caption:`Collections and their relations`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(V,{children:`Collection`}),(0,J.jsx)(V,{children:`Type`}),(0,J.jsx)(V,{children:`Relations`})]})}),(0,J.jsx)(`tbody`,{children:e.map(e=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(B,{children:e.name}),(0,J.jsx)(B,{children:e.type}),(0,J.jsx)(B,{children:e.fields.filter(e=>e.type===`relation`).map(e=>`${String(e.name)}: ${n(e.collectionId)}`).join(`, `)})]},e.id))})]})})}var jt=(0,q.createContext)(()=>{}),Mt=()=>(0,q.useContext)(jt);function Nt(){let e=u(),t=p(),[n,r]=(0,q.useState)(``),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),d=Mt(),f=n.trim().toLowerCase(),m=(e.data??[]).filter(e=>e.name.toLowerCase().includes(f)),h=m.filter(e=>e.system),{collectionId:g}=i({strict:!1}),v=(e.data??[]).some(e=>e.system&&(e.id===g||e.name===g)),y=f!==``||v,b=a||y,x=(0,q.useId)(),[S,C]=(0,q.useState)(!1),w=(0,q.useId)();return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`nav`,{"aria-label":`Collections`,className:`flex w-full flex-col gap-3 overflow-y-auto p-1 md:sticky md:-m-1 md:top-14 md:max-h-[calc(100dvh-4.5rem)] md:w-56 md:shrink-0 md:self-start`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":S,"aria-controls":w,onClick:()=>C(!S),className:`${Pt} font-medium hover:bg-hover md:hidden`,children:[S?(0,J.jsx)(oe,{...Y}):(0,J.jsx)(I,{...Y}),`Collections`]}),(0,J.jsxs)(`div`,{id:w,className:`${S?`flex`:`hidden`} flex-col gap-3 md:flex`,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(vt,{...Y,className:`pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-faint`}),(0,J.jsx)(`input`,{type:`text`,"aria-label":`Search collections`,placeholder:`Search collections`,value:n,onChange:e=>r(e.target.value),className:`${l} pr-8 pl-8`}),n&&(0,J.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>r(``),className:`absolute top-1/2 right-1.5 flex size-6 -translate-y-1/2 items-center justify-center rounded-control text-faint hover:bg-hover hover:text-text focus-visible:outline-2 focus-visible:outline-focus`,children:(0,J.jsx)(_,{...Y})})]}),(0,J.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),className:`${Pt} text-left hover:bg-hover`,children:[(0,J.jsx)(it,{...Y,className:`text-muted`}),`Overview`]}),(0,J.jsx)(Lt,{items:m.filter(e=>!e.system),editable:!t,onNavigate:()=>C(!1)}),h.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":b,"aria-controls":x,disabled:y,onClick:()=>o(!a),className:`flex items-center gap-1 rounded-control px-1 text-left text-xs font-medium text-muted uppercase focus-visible:outline-2 focus-visible:outline-focus disabled:cursor-default`,children:[b?(0,J.jsx)(oe,{size:13,strokeWidth:1.75,"aria-hidden":!0}):(0,J.jsx)(I,{size:13,strokeWidth:1.75,"aria-hidden":!0}),`System`]}),(0,J.jsx)(`div`,{id:x,hidden:!b,children:b&&(0,J.jsx)(Lt,{items:h,editable:!t,onNavigate:()=>C(!1)})})]}),f!==``&&m.length===0&&(0,J.jsx)(`p`,{className:`px-2 text-sm text-muted`,children:`No collections match`}),!t&&(0,J.jsx)(j,{variant:`ghost`,onClick:()=>d(),icon:(0,J.jsx)(mt,{...Y}),className:`justify-start`,children:`New collection`})]})]}),s&&(0,J.jsx)(At,{collections:e.data??[],onClose:()=>c(!1)})]})}var Y={size:15,strokeWidth:1.75,"aria-hidden":!0},Pt=`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-sm focus-visible:outline-2 focus-visible:outline-focus`,Ft={base:U,auth:wt,view:Je};function It(){let e=Mt();return(0,J.jsx)(j,{variant:`primary`,onClick:()=>e(),children:`New collection`})}function Lt({items:e,editable:t,onNavigate:n}){let r=Mt();return(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map(e=>{let i=Ft[e.type];return(0,J.jsxs)(`li`,{className:`group relative flex items-center`,children:[(0,J.jsxs)(ae,{to:`/collections/$collectionId`,params:{collectionId:e.id},onClick:n,className:`${Pt} min-w-0 hover:bg-hover`,activeProps:{"aria-current":`page`,className:`bg-hover font-medium`},children:[(0,J.jsx)(i,{...Y,className:`shrink-0 text-muted`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.name})]}),t&&(0,J.jsx)(j,{variant:`ghost`,size:`sm`,"aria-label":`Edit collection ${e.name}`,onClick:()=>r(e),icon:(0,J.jsx)(M,{size:14,strokeWidth:1.75}),className:`absolute right-1 w-7 px-0 opacity-0 focus-visible:opacity-100 group-hover:opacity-100`})]},e.id)})})}function Rt({names:e,hidden:t,onToggle:n}){return(0,J.jsx)(de,{trigger:(0,J.jsx)(j,{children:`Columns`}),placement:`bottom-end`,children:(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,J.jsx)(W,{label:e,checked:!t.includes(e),onChange:()=>n(e)},e))})})}function zt({page:e,totalPages:t,onPage:n}){return t<=1?null:(0,J.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 text-sm`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(j,{disabled:e<=1,onClick:()=>n(e-1),children:`Previous`}),(0,J.jsxs)(`span`,{children:[`Page `,e,` of `,Math.max(t,1)]}),(0,J.jsx)(j,{disabled:e>=t,onClick:()=>n(e+1),children:`Next`})]})})}function Bt({collection:e,recordId:t,label:n,onClose:r}){let i=y(),a=be({mutationFn:async n=>(await i.auth(e.name).impersonate(t,n)).authStore.token}),o=fe({defaultValues:{duration:`0`},onSubmit:({value:e})=>a.mutateAsync(Number(e.duration)).catch(()=>void 0)});return(0,J.jsx)(b,{open:!0,title:`Impersonate ${n}`,onClose:r,footer:(0,J.jsx)(j,{onClick:r,children:`Close`}),children:(0,J.jsxs)(`form`,{noValidate:!0,onSubmit:e=>{e.preventDefault(),o.handleSubmit()},className:`flex flex-col gap-4`,children:[(0,J.jsx)(o.Field,{name:`duration`,validators:{onSubmit:({value:e})=>/^\d+$/.test(e)?void 0:`Enter a whole number of seconds, 0 or more.`},children:e=>(0,J.jsx)(L,{label:`Token duration (seconds)`,hint:`0 uses the collection's auth token duration.`,min:0,step:1,error:e.state.meta.errors[0],value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,J.jsx)(o.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,J.jsx)(j,{type:`submit`,variant:`primary`,loading:e,children:`Generate token`})}),a.isError&&(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-danger-text`,children:O(a.error)}),a.data&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,J.jsx)(`div`,{className:`flex-1`,children:(0,J.jsx)(G,{label:`Token`,readOnly:!0,value:a.data,className:`font-mono`})}),(0,J.jsx)(z,{label:`Copy token`,text:a.data})]}),(0,J.jsx)(`p`,{className:`text-sm text-muted`,children:`This token is not refreshable.`})]})]})})}function Vt(e,t){let n=y(),r=g(),[i,a]=(0,q.useState)(!1),o=n.auth(e.name),s=String(t.email??``),c=e.passwordAuth,l=be({mutationFn:e=>e===`verification`?o.requestVerification(s):o.requestPasswordReset(s),onSuccess:(e,t)=>r.success(t===`verification`?`Verification email sent.`:`Password reset email sent.`),onError:e=>r.error(O(e))}),u=[];return s&&!t.verified&&u.push({key:`verification`,label:`Send verification email`}),s&&c?.enabled!==!1&&u.push({key:`reset`,label:`Send password reset email`}),u.push({key:`impersonate`,label:`Impersonate`}),{items:u,run:e=>{e===`verification`||e===`reset`?l.mutate(e):e===`impersonate`&&a(!0)},dialog:i?(0,J.jsx)(Bt,{collection:e,recordId:t.id,label:s||t.id,onClose:()=>a(!1)}):null}}var Ht=class extends Error{constructor(e){super(`Invalid JSON in ${e}.`),this.field=e}},Ut=[`autodate`,`password`],Wt=e=>e.fields,Gt=e=>Number(e.maxSelect)>1;function Kt(e){return Object.fromEntries(Wt(e).filter(e=>!e.hidden&&e.type===`relation`).map(e=>[e.name,!0]))}function qt(e){let t=/^(\d{4}-\d\d-\d\d)T(\d\d:\d\d)(?::(\d\d))?/.exec(e);return t?`${t[1]} ${t[2]}:${t[3]??`00`}.000Z`:``}function Jt(e){let t=/^(\d{4}-\d\d-\d\d)[ T](\d\d:\d\d:\d\d)/.exec(e);return t?`${t[1]}T${t[2]}`:``}function Yt(e,t){switch(e.type){case`number`:return t==null?``:String(t);case`bool`:return!!t;case`date`:return Jt(String(t??``));case`select`:case`relation`:return Gt(e)?Array.isArray(t)?t:t?[t]:[]:String(Array.isArray(t)?t[0]??``:t??``);case`file`:return{removed:[],added:[]};case`json`:return t==null||t===``?``:JSON.stringify(t,null,2);case`geoPoint`:{let e=t;return{lon:e?String(e.lon??0):``,lat:e?String(e.lat??0):``}}default:return String(t??``)}}function Xt(e,t){let n={};for(let r of Wt(e))r.type===`password`?(n.password=``,n.passwordConfirm=``):r.hidden||(n[r.name]=Yt(r,t?.[r.name]));return n}function Zt(e,t){switch(e.type){case`number`:return t===``?null:Number(t);case`date`:return qt(String(t));case`json`:{let n=String(t).trim();if(!n)return null;try{JSON.parse(n)}catch{throw new Ht(e.name)}return n}case`geoPoint`:{let{lon:e,lat:n}=t;return{lon:Number(e||0),lat:Number(n||0)}}default:return t}}function Qt(e,{removed:t,added:n},r){let i=Gt(e);return r?n.length?{[e.name]:i?n:n[0]}:{}:i?{...n.length&&{[`${e.name}+`]:n},...t.length&&{[`${e.name}-`]:t}}:n.length?{[e.name]:n[0]}:t.length?{[`${e.name}-`]:t}:{}}var $t=(e,t)=>{if(e.type===`bool`)return t===!1;if(e.type===`geoPoint`){let{lon:e,lat:n}=t;return e===``&&n===``}return Array.isArray(t)?t.length===0:String(t).trim()===``};function en(e,t,n){let r=n?Xt(e,n):void 0,i={};for(let n of Wt(e)){if(n.hidden||Ut.includes(n.type)||!(n.name in t))continue;let e=t[n.name];n.type===`file`?Object.assign(i,Qt(n,e,!r)):(r?JSON.stringify(e)!==JSON.stringify(r[n.name]):!$t(n,e))&&(i[n.name]=Zt(n,e))}return e.type===`auth`&&t.password&&(i.password=t.password,i.passwordConfirm=t.passwordConfirm),i}function tn({name:e,value:t,error:n,disabled:r,onChange:i}){let a=s({error:n});return(0,J.jsx)(o,{...a,label:`${e} (UTC)`,error:n,children:(0,J.jsxs)(`div`,{className:`flex h-9 items-center rounded-control border bg-field pr-1 focus-within:outline-2 focus-within:outline-focus ${n?`border-danger`:`border-field-line`} ${r?`opacity-50`:``}`,children:[(0,J.jsx)(`input`,{...a.aria,type:`datetime-local`,step:1,value:t,disabled:r,onChange:e=>i(e.target.value),className:`h-full min-w-0 flex-1 bg-transparent px-2.5 text-sm text-text outline-none`}),t&&(0,J.jsx)(`button`,{type:`button`,"aria-label":`Clear ${e}`,disabled:r,onClick:()=>i(``),className:`inline-flex size-7 items-center justify-center rounded-control text-muted hover:bg-hover hover:text-text focus-visible:outline-2 focus-visible:outline-focus`,children:(0,J.jsx)(_,{size:15,strokeWidth:1.75,"aria-hidden":!0})})]})})}var nn=(0,q.lazy)(()=>se(()=>import(`./RichTextEditor-Bc3uTBp0.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])));function rn({name:e,error:t}){let n=s({error:t});return(0,J.jsx)(o,{...n,label:e,error:t,children:(0,J.jsx)(`div`,{role:`status`,"aria-label":`Loading ${e} editor`,className:`h-52 animate-pulse rounded-control border border-field-line bg-field motion-reduce:animate-none`})})}function an(e){return(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(rn,{name:e.name,error:e.error}),children:(0,J.jsx)(nn,{...e})})}var on=100,sn=/\.(jpe?g|png|gif|webp)$/i,cn=e=>e.slice(0,on),ln=e=>Array.isArray(e)?e:e?[e]:[];function un(e){let{body:t}=new DOMParser().parseFromString(e,`text/html`);return t.querySelectorAll(`script, style`).forEach(e=>e.remove()),t.textContent??``}function dn({value:e}){let t=ge(e);return t===e?(0,J.jsx)(`span`,{children:e}):(0,J.jsx)(ne,{content:e,children:(0,J.jsx)(`span`,{tabIndex:0,children:t})})}function fn(e){let t=y();return m({queryKey:f.fileToken,queryFn:({signal:e})=>t.files.token({signal:e}),staleTime:12e4,enabled:!!e.protected}).data}function pn({field:e,names:t,record:n}){let r=y(),i=fn(e);return e.protected&&i===void 0?null:(0,J.jsx)(`span`,{className:`flex gap-1`,children:t.map(e=>sn.test(e)?(0,J.jsx)(`img`,{alt:e,width:32,height:32,src:r.files.url(n,e,{thumb:`100x100`,token:i})},e):(0,J.jsx)(`span`,{children:e},e))})}function mn(e,t,n){return(e?.fields??[]).filter(e=>e.presentable).map(e=>t?.[e.name]).filter(e=>e!=null&&e!==``).join(` `)||n}function hn(e,t){let n=e.expand?.[t];return new Map(ln(n).map(e=>[e.id,e]))}function gn({field:e,value:t,record:n}){let r=u().data?.find(t=>t.id===e.collectionId),i=hn(n,e.name),a=cn(ln(t).map(e=>mn(r,i.get(e),String(e))).join(`, `));return(0,J.jsx)(`span`,{className:`block truncate`,title:a,children:a})}function _n({field:e,value:t,record:n}){if(t==null||t===``)return null;switch(e.type){case`bool`:return t?`Yes`:`No`;case`date`:case`autodate`:return(0,J.jsx)(dn,{value:String(t)});case`editor`:return cn(un(String(t)));case`json`:return cn(JSON.stringify(t)??``);case`select`:return cn(ln(t).join(`, `));case`geoPoint`:{let{lon:e,lat:n}=t;return`${e}, ${n}`}case`password`:return`******`;case`relation`:return(0,J.jsx)(gn,{field:e,value:t,record:n});case`file`:return(0,J.jsx)(pn,{field:e,names:ln(t).map(String),record:n});default:return cn(String(t))}}function vn({name:e,url:t,onClose:n}){return(0,J.jsx)(b,{open:!0,title:e,onClose:n,children:(0,J.jsx)(`img`,{src:t,alt:e,className:`mx-auto max-h-[70vh]`})})}function yn({field:e,name:t,value:n,record:r,error:i,disabled:a,onChange:o}){let s=y(),c=fn(e),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(0),p=Gt(e),m=r?ln(r[e.name]).map(String):[],h=m.filter(e=>!n.removed.includes(e)).length+n.added.length,g=p&&h>=Number(e.maxSelect),_=!!e.protected&&c===void 0,v=(e,t)=>s.files.url(r??{},e,{thumb:t,token:c}),b=e=>o({...n,removed:n.removed.includes(e)?n.removed.filter(t=>t!==e):[...n.removed,e]});return(0,J.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-medium`,children:t}),(0,J.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[m.map(e=>{let t=n.removed.includes(e);return(0,J.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2 ${t?`line-through opacity-50`:``}`,children:[!_&&sn.test(e)&&(0,J.jsx)(`button`,{type:`button`,"aria-label":`Preview ${e}`,onClick:()=>u(e),children:(0,J.jsx)(`img`,{src:v(e,`100x100`),alt:e,width:48,height:48})}),_||sn.test(e)?(0,J.jsx)(`span`,{className:`min-w-0 truncate`,title:e,children:e}):(0,J.jsx)(`a`,{href:v(e),target:`_blank`,rel:`noopener noreferrer`,className:`min-w-0 truncate`,title:e,children:e})]}),(0,J.jsx)(j,{"aria-label":`${t?`Restore`:`Remove`} ${e}`,disabled:a,onClick:()=>b(e),children:t?`Restore`:`Remove`})]},e)}),n.added.map((e,t)=>(0,J.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),(0,J.jsx)(j,{"aria-label":`Remove new ${e.name}`,disabled:a,onClick:()=>o({...n,added:n.added.filter((e,n)=>n!==t)}),children:`Remove`})]},`${e.name}-${t}`))]}),(0,J.jsx)(`div`,{className:`[&_label]:sr-only`,children:(0,J.jsx)(xe,{label:`Add files`,multiple:p,disabled:a||g,error:i,onChange:e=>{e.length!==0&&(o({...n,added:p?[...n.added,...e]:[e[0]]}),f(e=>e+1))}},d)}),l&&(0,J.jsx)(vn,{name:l,url:v(l),onClose:()=>u(null)})]})}var bn=[`=`,`~`,`>`,`<`,`(`,`)`,`&`,`|`];function xn(e,t){let n=e.trim();if(!n||t.length===0||bn.some(e=>n.includes(e)))return n;let r=`"${(Number.isNaN(Number(n))&&n!==`true`&&n!==`false`?n.replace(/^["'`]|["'`]$/g,``):n).replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"`;return t.map(e=>`${e}?~${r}`).join(`||`)}function Sn({title:e,target:t,selected:n,known:r,maxSelect:i,onClose:a,onSelect:o}){let s=y(),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(()=>new Map(n.map(e=>[e,r.get(e)??{id:e}]))),m=t.fields.filter(e=>!e.hidden&&e.type!==`password`).map(e=>e.name),h=ve({queryKey:[`records`,t.id,`picker`,u],initialPageParam:1,queryFn:({pageParam:e,signal:n})=>s.records(t.name).findMany({page:e,perPage:40,filter:xn(u,m),sort:`-@rowid`},{signal:n}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0}),g=(h.data?.pages??[]).flatMap(e=>e.items),_=i<=1,v=f.size>=i,x=e=>p(t=>{if(_)return new Map([[e.id,e]]);let n=new Map(t);return n.delete(e.id)||n.set(e.id,e),n});return(0,J.jsx)(b,{open:!0,title:e,onClose:a,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j,{onClick:a,children:`Cancel`}),(0,J.jsx)(j,{variant:`primary`,onClick:()=>o([...f.values()]),children:`Select`})]}),children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsx)(G,{label:`Search`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d(c.trim()))}}),h.isError&&(0,J.jsx)(`p`,{role:`alert`,children:O(h.error)}),h.isPending&&(0,J.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Loading...`}),h.isSuccess&&g.length===0&&(0,J.jsx)(`p`,{className:`text-sm text-muted`,children:u?`No records match the search.`:`No records yet.`}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1`,children:g.map(e=>{let n=e.id,r=mn(t,e,n),i=f.has(n);return(0,J.jsx)(`li`,{children:(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(`input`,{type:_?`radio`:`checkbox`,name:`picker`,checked:i,disabled:!_&&v&&!i,onChange:()=>x(e)}),r]})},n)})}),h.hasNextPage&&(0,J.jsx)(j,{loading:h.isFetchingNextPage,onClick:()=>void h.fetchNextPage(),children:`Load more`})]})})}function Cn({field:e,name:t,value:n,record:r,error:i,disabled:a,onChange:o}){let s=u().data?.find(t=>t.id===e.collectionId),c=Gt(e),l=Array.isArray(n)?n:n?[n]:[],[d,f]=(0,q.useState)(()=>r?hn(r,e.name):new Map),[p,m]=(0,q.useState)(!1),h=(0,q.useId)(),g=e=>o(c?e:e[0]??``);return(0,J.jsxs)(`fieldset`,{"aria-invalid":i?!0:void 0,"aria-describedby":i?h:void 0,className:`flex flex-col gap-2`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-medium`,children:t}),(0,J.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:l.map(e=>{let t=mn(s,d.get(e),e);return(0,J.jsxs)(`li`,{className:`flex items-center gap-1 rounded-control border border-line bg-field py-0.5 pl-2.5 pr-1 text-sm`,children:[(0,J.jsx)(`span`,{children:t}),(0,J.jsx)(`button`,{type:`button`,disabled:a,"aria-label":`Remove ${t}`,onClick:()=>g(l.filter(t=>t!==e)),className:`inline-flex size-5 items-center justify-center rounded-control text-muted hover:bg-hover hover:text-text focus-visible:outline-2 focus-visible:outline-focus`,children:(0,J.jsx)(_,{size:13,strokeWidth:1.75,"aria-hidden":!0})})]},e)})}),(0,J.jsx)(j,{className:`self-start`,disabled:a||!s,onClick:()=>m(!0),children:`Choose records`}),i&&(0,J.jsx)(`p`,{id:h,className:`text-xs text-danger-text`,children:i}),p&&s&&(0,J.jsx)(Sn,{title:`Choose ${t}`,target:s,selected:l,known:d,maxSelect:c?Number(e.maxSelect):1,onClose:()=>m(!1),onSelect:e=>{f(t=>{let n=new Map(t);return e.forEach(e=>n.set(e.id,e)),n}),g(e.map(e=>e.id)),m(!1)}})]})}function wn({name:e,value:t,error:n,disabled:r,onChange:i}){let a=(0,q.useId)(),o={"aria-invalid":n?!0:void 0,"aria-describedby":n?a:void 0};return(0,J.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-medium`,children:e}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,J.jsx)(L,{label:`Longitude`,min:-180,max:180,step:`any`,value:t.lon,disabled:r,...o,onChange:e=>i({...t,lon:e.target.value})}),(0,J.jsx)(L,{label:`Latitude`,min:-90,max:90,step:`any`,value:t.lat,disabled:r,...o,onChange:e=>i({...t,lat:e.target.value})})]}),n&&(0,J.jsx)(`p`,{id:a,className:`text-xs text-danger-text`,children:n})]})}function Tn({name:e,value:t,error:n,disabled:r,onChange:i}){return(0,J.jsx)(R,{label:e,language:`json`,value:t,error:n,disabled:r,onChange:i})}function En({name:e,options:t,multiple:n,value:r,error:i,disabled:a,onChange:o}){let s=(0,q.useId)();if(!n)return(0,J.jsxs)(Se,{label:e,value:r,error:i,disabled:a,onChange:e=>o(e.target.value),children:[(0,J.jsx)(`option`,{value:``}),t.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]});let c=r;return(0,J.jsxs)(`fieldset`,{"aria-invalid":i?!0:void 0,"aria-describedby":i?s:void 0,className:`flex flex-col gap-1`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-medium`,children:e}),t.map(e=>(0,J.jsx)(W,{label:e,checked:c.includes(e),disabled:a,onChange:n=>o(n.target.checked?t.filter(t=>t===e||c.includes(t)):c.filter(t=>t!==e))},e)),i&&(0,J.jsx)(`p`,{id:s,className:`text-xs text-danger-text`,children:i})]})}function Dn({field:e,value:t,record:n,disabled:r,localError:i,onChange:a}){let o=T(e.name)??i,s=e.name,c=t;switch(e.type){case`text`:case`email`:case`url`:return(0,J.jsx)(G,{label:s,type:e.type===`text`?`text`:e.type,hint:e.name===`id`&&e.primaryKey?`Leave empty to generate`:void 0,value:c,error:o,disabled:r,onChange:e=>a(e.target.value)});case`number`:return(0,J.jsx)(L,{label:s,step:e.onlyInt?1:`any`,value:c,error:o,disabled:r,onChange:e=>a(e.target.value)});case`bool`:return(0,J.jsx)(W,{label:s,checked:t,error:o,disabled:r,onChange:e=>a(e.target.checked)});case`date`:return(0,J.jsx)(tn,{name:s,value:c,error:o,disabled:r,onChange:a});case`select`:return(0,J.jsx)(En,{name:s,options:e.values??[],multiple:Gt(e),value:t,error:o,disabled:r,onChange:a});case`json`:return(0,J.jsx)(Tn,{name:s,value:c,error:o,disabled:r,onChange:a});case`editor`:return(0,J.jsx)(an,{name:s,value:c,error:o,disabled:r,onChange:a});case`geoPoint`:return(0,J.jsx)(wn,{name:s,value:t,error:o,disabled:r,onChange:a});case`file`:return(0,J.jsx)(yn,{field:e,name:s,value:t,record:n,error:o,disabled:r,onChange:a});case`relation`:return(0,J.jsx)(Cn,{field:e,name:s,value:t,record:n,error:o,disabled:r,onChange:a});default:return null}}var On=e=>e.type!==`password`;function kn({isNew:e,password:t,confirm:n,onChange:r}){let[i,a]=(0,q.useState)(e),o=T(`password`),s=T(`passwordConfirm`);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!e&&(0,J.jsx)(W,{label:`Change password`,checked:i,onChange:e=>{a(e.target.checked),e.target.checked||r(``,``)}}),i&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(G,{label:`Password`,type:`password`,autoComplete:`new-password`,value:t,error:o,onChange:e=>r(e.target.value,n)}),(0,J.jsx)(G,{label:`Confirm password`,type:`password`,autoComplete:`new-password`,value:n,error:s,onChange:e=>r(t,e.target.value)})]})]})}var An=[`autodate`,`file`,`password`];function jn(e,t){let n={...t,id:``};for(let t of Wt(e))An.includes(t.type)&&delete n[t.name];return n}function Mn({collection:e,recordId:t,prefill:n,onClose:r,onDuplicate:i}){let a=y(),o=t===`new`,s=a.records(e.name),c=m({queryKey:[`records`,e.id,{id:t}],queryFn:({signal:n})=>s.findOne(t,{expand:Kt(e)},{signal:n}),enabled:!o}),l=e.type===`view`,u=o?`New record`:l?`Record`:`Edit record`,d=null;return!o&&c.isError?d=(0,J.jsx)(`p`,{role:`alert`,children:O(c.error)}):!o&&!c.data&&(d=(0,J.jsx)(`p`,{children:`Loading...`})),d?(0,J.jsx)(b,{open:!0,variant:`side`,title:u,onClose:r,children:d}):(0,J.jsx)(Nn,{collection:e,title:u,isNew:o,readOnly:l,record:o?n:c.data,onClose:r,onDuplicate:i})}function Nn({collection:e,title:n,isNew:r,readOnly:i,record:a,onClose:o,onDuplicate:s}){let c=y(),l=h(),u=t(),d=v(),f=g(),p=(0,q.useId)(),m=Xt(e,a),[_,x]=(0,q.useState)(null),[S,w]=(0,q.useState)({}),T=e.type===`auth`,ee=c.records(e.name),D=e.name===`_superusers`&&!!a&&a.id===c.authStore.record?.id,k=()=>{pe({client:c,queryClient:l}),u({to:`/login`})},A=async t=>{let n;try{n=en(e,t,r?void 0:a)}catch(e){if(!(e instanceof Ht))throw e;x(null),w({[e.field]:`Invalid JSON.`});return}w({}),x(null);try{if(r?await ee.create(n):await ee.update(a.id,n),D&&t.password){f.success(`Record saved.`),k();return}await l.invalidateQueries({queryKey:[`records`,e.id]}),f.success(`Record saved.`),o()}catch(e){x(e)}},M=Vt(e,a??{id:``});(0,q.useEffect)(()=>{if(!_&&Object.keys(S).length===0)return;let e=document.getElementById(p)?.querySelector(`[aria-invalid="true"]`);(e?.matches(`input, select, textarea, button`)?e:e?.querySelector(`input, select, textarea, button`))?.focus()},[_,S,p]);let N=fe({defaultValues:m,onSubmit:({value:e})=>A(e)}),ne=async()=>JSON.stringify(N.state.values)===JSON.stringify(m)||await d({title:`Discard unsaved changes?`,message:`Your edits to this record will be lost.`,confirmLabel:`Discard`,cancelLabel:`Keep editing`,danger:!0}),P=async()=>{await ne()&&o()},F=async()=>{if(await d({title:`Delete record`,message:`Delete record ${a.id}? This cannot be undone.`,confirmLabel:`Delete`,danger:!0}))try{if(await ee.delete(a.id),D){f.success(`Record deleted.`),k();return}o(),f.success(`Record deleted.`),await l.invalidateQueries({queryKey:[`records`,e.id],predicate:e=>e.queryKey[2]?.id!==a.id})}catch(e){f.error(O(e))}},I=Wt(e).filter(e=>e.type===`password`?!i:!e.hidden&&e.type!==`autodate`&&On(e)&&(r||e.name!==`id`)),L=[];a&&!r&&(i||L.push({key:`duplicate`,label:`Duplicate`}),L.push({key:`copy`,label:`Copy JSON`}),T&&L.push(...M.items),i||L.push({separator:!0},{key:`delete`,label:`Delete`,danger:!0}));let R=t=>{t===`duplicate`?ne().then(t=>t&&s(jn(e,a))):t===`copy`?navigator.clipboard.writeText(JSON.stringify(a,null,2)).then(()=>f.success(`Copied.`),()=>f.error(`Could not copy.`)):t===`delete`?F():M.run(t)},z=r?[]:Wt(e).filter(e=>e.type===`autodate`&&!e.hidden&&a?.[e.name]);return(0,J.jsx)(te,{error:_,children:(0,J.jsxs)(b,{open:!0,variant:`side`,title:n,onClose:()=>void P(),footer:(0,J.jsxs)(J.Fragment,{children:[a&&!r&&(0,J.jsx)(`div`,{className:`mr-auto`,children:(0,J.jsx)(C,{trigger:(0,J.jsx)(j,{icon:(0,J.jsx)(Ke,{size:15,"aria-hidden":!0}),children:`More actions`}),placement:`top-start`,items:L,onAction:R})}),(0,J.jsx)(j,{onClick:()=>void P(),children:i?`Close`:`Cancel`}),!i&&(0,J.jsx)(N.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,J.jsx)(j,{type:`submit`,form:p,variant:`primary`,loading:e,children:r?`Create`:`Save changes`})})]}),children:[(0,J.jsxs)(`form`,{id:p,noValidate:!0,onSubmit:e=>{e.preventDefault(),N.handleSubmit()},className:`flex flex-col gap-4`,children:[(0,J.jsx)(`div`,{className:`flex flex-col gap-4`,children:I.map(e=>e.type===`password`?T&&(0,J.jsx)(N.Subscribe,{selector:e=>[e.values.password,e.values.passwordConfirm],children:([e,t])=>(0,J.jsx)(kn,{isNew:r,password:e,confirm:t,onChange:(e,t)=>{N.setFieldValue(`password`,e),N.setFieldValue(`passwordConfirm`,t)}})},e.name):(0,J.jsx)(N.Field,{name:e.name,children:t=>(0,J.jsx)(Dn,{field:e,value:t.state.value,record:a,disabled:i,localError:S[e.name],onChange:t.handleChange})},e.name))}),!r&&(0,J.jsxs)(`dl`,{className:`flex flex-col gap-1 border-t border-line pt-3 text-xs text-muted`,children:[(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{children:`id`}),(0,J.jsx)(`dd`,{className:`font-mono`,children:a.id})]}),z.map(e=>(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`dt`,{children:e.name}),(0,J.jsx)(`dd`,{children:ge(String(a[e.name]))})]},e.name))]}),(0,J.jsx)(E,{})]}),M.dialog]})})}var Pn=`[&_tr>:nth-child(1)]:sticky [&_tr>:nth-child(1)]:left-0 [&_tr>:nth-child(1)]:z-[5] [&_thead_tr>:nth-child(1)]:z-20`,Fn=`[&_tr>:nth-child(2)]:sticky [&_tr>:nth-child(2)]:left-10 [&_tr>:nth-child(2)]:z-[5] [&_thead_tr>:nth-child(2)]:z-20`,In=`cursor-pointer bg-surface [&>td]:bg-surface [&:not([data-selected]):hover>td]:shadow-[inset_0_0_0_100vmax_var(--hb-hover)] data-[selected]:[&>td]:shadow-[inset_0_0_0_100vmax_var(--hb-accent-soft)]`;function Ln(e,t){return e===t?`asc`:e===`-${t}`?`desc`:null}function Rn({caption:e,fields:t,rows:n,sort:r,selected:i,onSort:a,onSelect:o,onSelectAll:s,onOpen:c,selectable:l=!0}){let[u,d]=(0,q.useState)({left:!1,right:!1}),f=(0,q.useRef)(null),p=e=>{let t=e.scrollLeft>0,n=e.scrollLeft+e.clientWidth<e.scrollWidth-1;d(e=>e.left===t&&e.right===n?e:{left:t,right:n})};(0,q.useLayoutEffect)(()=>{let e=f.current?.querySelector(`.overflow-auto`);if(!e||(p(e),typeof ResizeObserver>`u`))return;let t=new ResizeObserver(()=>p(e));return t.observe(e),e.firstElementChild&&t.observe(e.firstElementChild),()=>t.disconnect()},[t.length,n.length]);let m=t[0]?.name===`id`,h=[l?Pn:``,m?l?Fn:Pn:``].join(` `),g=e=>{let t=Ln(r,e);return t===null?e:t===`asc`?`-${e}`:``},_=n.length>0&&n.every(e=>i.has(e.id)),v=e=>String(e.title??e.name??e.id);return(0,J.jsxs)(`div`,{ref:f,onScrollCapture:e=>p(e.target),className:`relative ${h}`,children:[(0,J.jsx)(zn,{side:`left`,show:u.left}),(0,J.jsx)(zn,{side:`right`,show:u.right}),(0,J.jsxs)(H,{caption:e,stickyHeader:!0,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[l&&(0,J.jsx)(`th`,{scope:`col`,className:`w-10 border-b border-line px-3 py-2`,children:(0,J.jsx)(W,{hideLabel:!0,label:`Select all`,checked:_,onChange:e=>s(e.target.checked)})}),t.map(e=>(0,J.jsx)(V,{sort:Ln(r,e.name),onSort:()=>a(g(e.name)),children:e.name},e.name))]})}),(0,J.jsx)(`tbody`,{children:n.map(e=>(0,J.jsxs)(`tr`,{tabIndex:0,"data-selected":i.has(e.id)||void 0,className:In,onClick:()=>c(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&t.target===t.currentTarget&&(t.preventDefault(),c(e.id))},children:[l&&(0,J.jsx)(B,{children:(0,J.jsx)(W,{hideLabel:!0,label:`Select ${v(e)}`,checked:i.has(e.id),onClick:e=>e.stopPropagation(),onChange:()=>o(e.id)})}),t.map(t=>(0,J.jsx)(B,{children:_n({field:t,value:e[t.name],record:e})},t.name))]},e.id))})]})]})}function zn({side:e,show:t}){return(0,J.jsx)(`div`,{"aria-hidden":!0,"data-edge":e,className:`pointer-events-none absolute inset-y-0 z-30 w-3 transition-opacity motion-reduce:transition-none ${e===`left`?`left-0 bg-gradient-to-r`:`right-0 bg-gradient-to-l`} from-black/15 to-transparent ${t?`opacity-100`:`opacity-0`}`})}function Bn({collection:e}){let n=y(),r=h(),i=v(),a=g(),o=Mt(),s=p(),[c,l]=(0,q.useState)(!1),d=t(),_=x({strict:!1}),b=e.type===`view`,C=`hb_columns_${e.id}`,[w,T]=(0,q.useState)(()=>he(C)),[E,D]=(0,q.useState)(new Set),[O,k]=(0,q.useState)(),te=_.page??1,A=_.filter??``,F=_.sort??``,I=e.fields.filter(e=>!e.hidden),L=I.filter(e=>!w.includes(e.name)),R=Kt(e),z=I.filter(e=>e.type!==`password`).map(e=>e.name),re=u(),ie=me({collectionId:e.id,fields:I,collections:re.data}),B={page:te,filter:A,sort:F},V=m({queryKey:f.records(e.id,B),queryFn:({signal:t})=>n.records(e.name).findMany({page:te,perPage:40,filter:xn(A,z),sort:F||(b?``:`-@rowid`),expand:R},{signal:t}),placeholderData:e=>e}),H=e=>d({to:`.`,search:t=>S({...t,...e})}),ae=e=>{let t=w.includes(e)?w.filter(t=>t!==e):[...w,e];T(t),_e(C,t)},oe=e=>D(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),U=async()=>{let t=[...E];if(!await i({title:`Delete records`,message:`Delete ${t.length} selected record${t.length===1?``:`s`}? This cannot be undone.`,confirmLabel:`Delete`,danger:!0}))return;let o=await Promise.allSettled(t.map(t=>n.records(e.name).delete(t))),s=new Set(t.filter((e,t)=>o[t].status===`rejected`));if(s.size===0)a.success(`Records deleted.`);else{let e=t.length-s.size;a.error(`Deleted ${e} of ${t.length} records, ${s.size} failed.`)}D(s),await r.invalidateQueries({queryKey:[`records`,e.id]})},se=()=>{k(void 0),H({record:`new`})},W=V.data?.items??[];return(0,J.jsxs)(P,{width:`full`,crumbs:[{label:`Collections`,to:`/collections`},{label:e.name}],footer:V.data&&!V.isError?`Total: ${V.data.totalItems}`:void 0,actions:(0,J.jsxs)(J.Fragment,{children:[E.size>0&&(0,J.jsxs)(j,{variant:`danger`,onClick:U,children:[`Delete selected (`,E.size,`)`]}),(0,J.jsx)(j,{onClick:()=>l(!0),children:`API preview`}),(0,J.jsx)(Rt,{names:I.map(e=>e.name),hidden:w,onToggle:ae}),!b&&(0,J.jsx)(j,{variant:`primary`,onClick:se,children:`New record`}),!s&&(0,J.jsx)(ne,{content:`Edit ${e.name}`,children:(0,J.jsx)(j,{"aria-label":`Edit ${e.name}`,onClick:()=>o(e),icon:(0,J.jsx)(M,{"aria-hidden":!0,size:15,strokeWidth:1.75})})})]}),children:[(0,J.jsx)(ye,{filter:A,suggest:ie,error:V.error?ee(V.error):void 0,onSearch:e=>{D(new Set),H({filter:e,page:1})}}),V.isError?(0,J.jsxs)(`div`,{className:`grid gap-3`,children:[(0,J.jsx)(ce,{query:V}),A&&(0,J.jsx)(`div`,{children:(0,J.jsx)(j,{onClick:()=>H({filter:``,page:1}),children:`Clear filter`})})]}):V.data?W.length===0?A?(0,J.jsx)(N,{title:`No records match this filter`,icon:(0,J.jsx)(gt,{size:15,strokeWidth:1.75,"aria-hidden":!0})}):(0,J.jsx)(N,{title:`No records yet`,icon:(0,J.jsx)(nt,{size:15,strokeWidth:1.75,"aria-hidden":!0}),children:!b&&(0,J.jsx)(j,{variant:`primary`,onClick:se,children:`New record`})}):(0,J.jsx)(Rn,{caption:`${e.name} records`,fields:L,rows:W,sort:F,selected:E,onSort:e=>{D(new Set),H({sort:e,page:1})},selectable:!b,onSelect:oe,onSelectAll:e=>D(new Set(e?W.map(e=>e.id):[])),onOpen:e=>H({record:e})}):(0,J.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Loading...`}),c&&(0,J.jsx)(kt,{collection:e,onClose:()=>l(!1)}),V.data&&!V.isError&&(0,J.jsx)(zt,{page:V.data.page,totalPages:V.data.totalPages,onPage:e=>{D(new Set),H({page:e})}}),_.record&&(0,J.jsx)(Mn,{collection:e,recordId:_.record,prefill:O,onClose:()=>H({record:void 0}),onDuplicate:e=>{k(e),H({record:`new`})}},_.record)]})}function Vn({changes:e,onConfirm:t,onCancel:n}){let{renamedCollection:r,deletedFields:i,renamedFields:a,changedRules:o}=e;return(0,J.jsxs)(b,{open:!0,onClose:n,title:`Confirm changes`,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j,{onClick:n,children:`Cancel`}),(0,J.jsx)(j,{variant:`primary`,onClick:t,children:`Confirm`})]}),children:[(0,J.jsx)(`p`,{className:`text-sm`,children:`Review these changes before saving.`}),(0,J.jsxs)(`ul`,{className:`mt-2 list-disc pl-5 text-sm`,children:[r&&(0,J.jsxs)(`li`,{children:[`Rename collection `,r[0],` to `,r[1]]}),i.map(e=>(0,J.jsxs)(`li`,{children:[`Delete field `,e]},`delete-${e}`)),a.map(([e,t])=>(0,J.jsxs)(`li`,{children:[`Rename field `,e,` to `,t]},`rename-${e}`)),o.length>0&&(0,J.jsxs)(`li`,{children:[`Change API rules: `,o.join(`, `)]})]}),i.length>0&&(0,J.jsx)(`p`,{className:`mt-2 text-sm text-danger-text`,children:`Deleted fields lose all their data.`})]})}var X='`[^`]*`|"[^"]*"|\\[[^\\]]*\\]|\\w+',Hn=RegExp(`^\\s*CREATE\\s+(UNIQUE\\s+)?INDEX\\s+(?:IF\\s+NOT\\s+EXISTS\\s+)?(?:(?:${X})\\.)?(${X})\\s+ON\\s+(${X})\\s*\\(`,`i`),Un=RegExp(`^\\s*(${X})`),Wn=RegExp(`^\\s*(?:${X})\\s*$`),Gn=e=>"`"+e.replaceAll("`","``")+"`",Kn=e=>/^[`"[]/.test(e)?e.slice(1,-1):e;function qn(){let e=crypto.getRandomValues(new Uint8Array(10));return`idx_`+Array.from(e,e=>`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`[e%62]).join(``)}function Jn(e){let t=Gn(e.name??qn()),n=e.columns.map(Gn).join(`, `);return`CREATE ${e.unique?`UNIQUE `:``}INDEX ${t} ON ${Gn(e.table)} (${n})`}function Yn(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];if(a===`(`)n++;else if(a===`)`){if(n===0)return t.push(e.slice(r,i)),{parts:t,end:i+1};n--}else a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return null}function Xn(e){let t=Hn.exec(e);if(!t)return null;let n=e.slice(t[0].length),r=Yn(n),i=r?.parts.map(e=>Un.exec(e)?.[1]);return!r||!i||i.some(e=>!e)?null:{name:Kn(t[2]),unique:!!t[1],table:Kn(t[3]),columns:i.map(e=>Kn(e)),simple:r.parts.every(e=>Wn.test(e))&&/^\s*;?\s*$/.test(n.slice(r.end))}}var Zn=[`listRule`,`viewRule`,`createRule`,`updateRule`,`deleteRule`,`authRule`,`manageRule`],Qn=RegExp(`\\bON\\s+(${X})`,`i`),$n=RegExp(`(\\bINDEX\\s+(?:IF\\s+NOT\\s+EXISTS\\s+)?)(${X})`,`i`),er=RegExp(`'(?:[^']|'')*'|${X}`,`g`);function tr(e,t,n){let r=Qn.exec(e);if(!r)return e;let i=r.index+r[0].length,[a,o]=t;return(a!==o&&Kn(r[1]).toLowerCase()===a.toLowerCase()?e.slice(0,i-r[1].length)+Gn(o):e.slice(0,i))+e.slice(i).replace(er,(e,t,r)=>{if(e.startsWith(`'`))return e;let i=n.get(Kn(e).toLowerCase()),a=/^\s*\(/.test(r.slice(t+e.length));return i===void 0||a?e:Gn(i)})}var nr={select:{maxSelect:1},relation:{maxSelect:1},file:{maxSelect:1},autodate:{onCreate:!0}};function rr(e){let t=structuredClone(e);return{...t,_originalName:e.name,fields:t.fields.map(e=>({...e,_key:we(),_original:e.name}))}}function ir(e,t){return rr(t[e])}function ar(e){let t=rr(e);return{...t,id:``,name:`${e.name}_duplicate`,system:!1,fields:t.fields.map(({id:e,...t})=>t),indexes:t.indexes.map(e=>e.replace($n,(e,t)=>t+Gn(qn())))}}function or(e,t){let n=new Set(e.map(e=>e.name.toLowerCase())),r=`field`;for(let e=2;n.has(r);e++)r=`field${e}`;return{...Te(t),...nr[t],name:r}}function sr(e,t){return{...e,name:t}}function cr(e){return e.fields.filter(e=>!e._removed)}function lr(e){let t=new Map;for(let n of e.fields)n._original!==void 0&&n._original!==n.name&&t.set(n._original.toLowerCase(),n.name);return e.indexes.map(n=>tr(n,[e._originalName,e.name],t))}function ur(e,t){return{...e,_originalName:e.name,fields:e.fields.map(e=>({...e,_original:e.name})),indexes:t}}function dr(e){let{id:t,_originalName:n,created:r,updated:i,fields:a,...o}=e;return{...t?{id:t}:{},...o,indexes:lr(e),...e.type===`view`?{}:{fields:cr(e).map(({_key:e,_removed:t,_original:n,...r})=>r)}}}function fr(e,t){let n=cr(t),r=[],i=[];for(let t of e.fields){let e=n.find(e=>e.id&&e.id===t.id);e?e.name!==t.name&&r.push([String(t.name),e.name]):i.push(String(t.name))}return{renamedCollection:e.name===t.name?null:[e.name,t.name],deletedFields:i,renamedFields:r,changedRules:Zn.filter(n=>(e[n]??null)!==(t[n]??null))}}function pr(e){return!!e.renamedCollection||e.deletedFields.length>0||e.renamedFields.length>0||e.changedRules.length>0}function mr(e,t){return fe({defaultValues:e,onSubmitMeta:{confirmed:!1},onSubmit:({value:e,meta:n})=>t(e,n.confirmed)})}var hr=`rounded-full border border-line bg-hover px-2.5 py-0.5 text-xs text-text hover:border-accent hover:text-accent-text focus-visible:outline-2 focus-visible:outline-focus`,gr={Images:[`image/jpeg`,`image/png`,`image/svg+xml`,`image/gif`,`image/webp`],Documents:[`application/pdf`,`application/msword`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.ms-excel`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`text/plain`,`text/csv`],Videos:[`video/mp4`,`video/webm`,`video/quicktime`,`video/x-ms-wmv`],Archives:[`application/zip`,`application/x-7z-compressed`,`application/x-rar-compressed`,`application/gzip`]},_r=(e,t)=>T(`${e.errorPath}.${t}`);function vr({p:e,k:t,label:n,hint:r}){return(0,J.jsx)(G,{label:n,hint:r,value:String(e.field[t]??``),error:_r(e,t),onChange:n=>e.onChange({[t]:n.target.value})})}function Z({p:e,k:t,label:n,nullable:r}){let i=e.field[t];return(0,J.jsx)(L,{label:n,step:r?`any`:void 0,value:typeof i==`number`?i:``,error:_r(e,t),onChange:n=>e.onChange({[t]:n.target.value===``?r?null:0:Number(n.target.value)})})}function Q({p:e,k:t,label:n,disabled:r}){return(0,J.jsx)(W,{label:n,checked:!!e.field[t],disabled:r,error:_r(e,t),onChange:n=>e.onChange({[t]:n.target.checked})})}function yr({p:e,k:t,label:n,hint:r,disabled:i,lines:a}){let o=e.field[t]??[],s=a?`
4
+ `:`, `,c=e=>e.split(a?`
5
+ `:`,`).map(e=>e.trim()).filter(Boolean),[l,u]=(0,q.useState)(o.join(s)),d=o.join(`
6
+ `);(0,q.useEffect)(()=>{u(e=>c(e).join(`
7
+ `)===d?e:o.join(s))},[d]);let f=k(`${e.errorPath}.${t}.`),p=_r(e,t)??(f.map(([e,t])=>{let n=Number(e.slice(e.lastIndexOf(`.`)+1));return`${o[n]??n}: ${t}`}).join(` `)||void 0),m=n=>{u(n),e.onChange({[t]:c(n)})};return a?(0,J.jsx)(R,{label:n,hint:r,rows:4,value:l,error:p,onChange:m}):(0,J.jsx)(G,{label:n,hint:r,value:l,disabled:i,error:p,onChange:e=>m(e.target.value)})}function br({p:e,many:t}){let[n,r]=(0,q.useState)(Number(e.field.maxSelect)>1);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(W,{label:`Allow multiple`,checked:n,onChange:n=>{r(n.target.checked),e.onChange({maxSelect:n.target.checked?t():1})}}),n&&(0,J.jsx)(Z,{p:e,k:`maxSelect`,label:`Max select`})]})}function xr({p:e}){let t=e.field.onlyDomains??[],n=e.field.exceptDomains??[];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(yr,{p:e,k:`onlyDomains`,label:`Only domains`,hint:`Comma separated.`,disabled:n.length>0}),(0,J.jsx)(yr,{p:e,k:`exceptDomains`,label:`Except domains`,hint:`Comma separated.`,disabled:t.length>0})]})}function Sr({p:e}){let t=u();return(0,J.jsxs)(Se,{label:`Collection`,value:String(e.field.collectionId??``),disabled:!!e.field.id,error:_r(e,`collectionId`),onChange:t=>e.onChange({collectionId:t.target.value}),children:[(0,J.jsx)(`option`,{value:``,disabled:!0,children:`Choose a collection`}),(t.data??[]).filter(e=>e.type!==`view`).map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}function Cr({p:e}){let t=e.field.mimeTypes??[];return(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(yr,{p:e,k:`mimeTypes`,label:`MIME types`,hint:`Comma separated.`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(gr).map(([n,r])=>(0,J.jsx)(`button`,{type:`button`,className:hr,onClick:()=>e.onChange({mimeTypes:[...t,...r.filter(e=>!t.includes(e))]}),children:n},n))})]})}function wr({p:e}){switch(e.field.type){case`text`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{p:e,k:`min`,label:`Min length`}),(0,J.jsx)(Z,{p:e,k:`max`,label:`Max length`}),(0,J.jsx)(vr,{p:e,k:`pattern`,label:`Pattern`}),(0,J.jsx)(vr,{p:e,k:`autogeneratePattern`,label:`Autogenerate pattern`}),!!e.field.primaryKey&&(0,J.jsx)(Q,{p:e,k:`primaryKey`,label:`Primary key`,disabled:!0})]});case`number`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{p:e,k:`min`,label:`Min`,nullable:!0}),(0,J.jsx)(Z,{p:e,k:`max`,label:`Max`,nullable:!0}),(0,J.jsx)(Q,{p:e,k:`onlyInt`,label:`Integers only`})]});case`email`:case`url`:return(0,J.jsx)(xr,{p:e});case`date`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(vr,{p:e,k:`min`,label:`Min date`,hint:`YYYY-MM-DD HH:mm:ss.SSSZ (UTC)`}),(0,J.jsx)(vr,{p:e,k:`max`,label:`Max date`,hint:`YYYY-MM-DD HH:mm:ss.SSSZ (UTC)`})]});case`autodate`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{p:e,k:`onCreate`,label:`On create`}),(0,J.jsx)(Q,{p:e,k:`onUpdate`,label:`On update`})]});case`select`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(yr,{p:e,k:`values`,label:`Values`,hint:`One per line.`,lines:!0}),(0,J.jsx)(br,{p:e,many:()=>Math.max(2,(e.field.values??[]).length)})]});case`json`:return(0,J.jsx)(Z,{p:e,k:`maxSize`,label:`Max size (bytes)`});case`editor`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{p:e,k:`maxSize`,label:`Max size (bytes)`}),(0,J.jsx)(Q,{p:e,k:`convertURLs`,label:`Convert URLs`})]});case`relation`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Sr,{p:e}),(0,J.jsx)(br,{p:e,many:()=>999}),(0,J.jsx)(Z,{p:e,k:`minSelect`,label:`Min select`}),(0,J.jsx)(Q,{p:e,k:`cascadeDelete`,label:`Cascade delete`})]});case`file`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(br,{p:e,many:()=>99}),(0,J.jsx)(Z,{p:e,k:`maxSize`,label:`Max size (bytes)`}),(0,J.jsx)(Cr,{p:e}),(0,J.jsx)(yr,{p:e,k:`thumbs`,label:`Thumb sizes`,hint:`WxH, WxHt, WxHb, WxHf, 0xH, Wx0`}),(0,J.jsx)(Q,{p:e,k:`protected`,label:`Protected`})]});case`password`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{p:e,k:`min`,label:`Min length`}),(0,J.jsx)(Z,{p:e,k:`max`,label:`Max length`}),(0,J.jsx)(vr,{p:e,k:`pattern`,label:`Pattern`}),(0,J.jsx)(Z,{p:e,k:`cost`,label:`Bcrypt cost`})]});default:return null}}function Tr(e){return(0,J.jsxs)(`div`,{className:`grid items-end gap-3 sm:grid-cols-2`,children:[(0,J.jsx)(wr,{p:e}),e.field.type!==`autodate`&&(0,J.jsx)(vr,{p:e,k:`help`,label:`Help text`})]})}var Er={text:St,editor:Xe,number:et,bool:bt,email:Be,url:ue,date:We,autodate:Oe,select:le,file:ft,relation:ot,json:He,geoPoint:ut,password:ct},Dr=`flex flex-col gap-2 rounded border border-line p-3`;function Or(e){let{field:t}=e;return t._removed?(0,J.jsx)(`fieldset`,{"aria-label":t.name,className:`${Dr} opacity-60`,children:(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`text-sm line-through`,children:t.name}),(0,J.jsx)(j,{onClick:e.onRestore,children:`Restore`})]})}):(0,J.jsx)(kr,{...e})}function kr({field:e,errorPath:t,canMoveUp:n,canMoveDown:r,onChange:i,onMove:a,onDragStart:o,onDragEnd:s,onRemove:c}){let l=Er[e.type],u=T(`${t}.name`),[d,f]=(0,q.useState)(!e.id),p=k(`${t}.`,!1).filter(([e])=>e!==`${t}.name`).length>0;return(0,q.useEffect)(()=>{p&&f(!0)},[p]),(0,J.jsxs)(`fieldset`,{"aria-label":e.name||`New field`,className:Dr,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-[auto_auto_1fr_9rem_auto] items-center gap-2`,children:[(0,J.jsx)(`span`,{draggable:!0,"aria-hidden":!0,title:`Drag to reorder`,className:`-ml-1 cursor-grab text-muted active:cursor-grabbing`,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.name);let n=t.currentTarget.closest(`fieldset`);n&&t.dataTransfer.setDragImage(n,16,16),o()},onDragEnd:s,children:(0,J.jsx)(Qe,{size:15,strokeWidth:1.75})}),(0,J.jsx)(l,{size:15,strokeWidth:1.75,"aria-hidden":!0,className:`text-muted`}),(0,J.jsx)(`div`,{className:`[&_label]:sr-only`,children:(0,J.jsx)(G,{label:`Field name`,value:e.name,disabled:e.system,error:u,onChange:e=>i({name:e.target.value})})}),(0,J.jsx)(`span`,{className:`justify-self-end`,children:(0,J.jsxs)(F,{tone:`neutral`,children:[Ee(e.type),e.system&&` (system)`]})}),(0,J.jsx)(C,{trigger:(0,J.jsx)(j,{variant:`ghost`,"aria-label":`Actions for ${e.name||`new field`}`,icon:(0,J.jsx)(Ke,{size:15,strokeWidth:1.75}),className:`w-9 px-0`}),items:[{key:`up`,label:`Move up`,icon:(0,J.jsx)(ie,{size:15,strokeWidth:1.75}),disabled:!n},{key:`down`,label:`Move down`,icon:(0,J.jsx)(re,{size:15,strokeWidth:1.75}),disabled:!r},...e.system?[]:[{separator:!0},{key:`remove`,label:`Remove field`,icon:(0,J.jsx)(ke,{size:15,strokeWidth:1.75}),danger:!0}]],onAction:e=>e===`remove`?c():a(e===`up`?-1:1),placement:`bottom-start`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[e.type!==`autodate`&&(0,J.jsx)(W,{label:`Required`,checked:!!e.required,onChange:e=>i({required:e.target.checked})}),(0,J.jsx)(W,{label:`Hidden`,checked:e.hidden,onChange:e=>i({hidden:e.target.checked})}),(0,J.jsx)(W,{label:`Presentable`,checked:e.presentable,onChange:e=>i({presentable:e.target.checked})}),(0,J.jsx)(j,{variant:`ghost`,className:`ml-auto`,"aria-expanded":d,onClick:()=>f(!d),children:`Options`})]}),d&&(0,J.jsx)(Tr,{field:e,errorPath:t,onChange:i})]})}var Ar=`SELECT.DISTINCT.FROM.WHERE.JOIN.LEFT JOIN.INNER JOIN.ON.GROUP BY.HAVING.ORDER BY.LIMIT.AS.AND.OR.NOT.IN.LIKE.IS.NULL.CASE.WHEN.THEN.ELSE.END.COUNT.SUM.MAX.MIN.AVG`.split(`.`),jr=[`CREATE`,`UNIQUE`,`INDEX`,`IF NOT EXISTS`,`ON`,`ASC`,`DESC`,`COLLATE NOCASE`,`WHERE`,`AND`,`OR`,`NOT`,`IS`,`NULL`,`IN`,`LIKE`,`LOWER`,`UPPER`,`LENGTH`,`COALESCE`,`SUBSTR`];function Mr(e){let t=e.flatMap(e=>e.fields.map(t=>[e.name,String(t.name)]));return[...new Set([...e.map(e=>e.name),...t.map(([e,t])=>`${e}.${t}`),...t.map(([,e])=>e),...Ar])]}function Nr(e){return[...new Set([...e,...jr])]}function Pr({draft:e,onChange:t}){let n=(0,q.useId)(),[r,i]=(0,q.useState)(null),a=lr(e);return(0,J.jsxs)(`section`,{"aria-labelledby":n,className:`flex flex-col gap-2`,children:[(0,J.jsx)(`h3`,{id:n,className:`text-sm font-medium`,children:`Indexes`}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,children:a.map((e,n)=>(0,J.jsx)(Fr,{sql:e,errorPath:`indexes.${n}`,onEdit:()=>i(n),onRemove:()=>t(a.filter((e,t)=>t!==n))},n))}),(0,J.jsx)(j,{className:`self-start`,onClick:()=>i(`new`),children:`Add index`}),r!==null&&(0,J.jsx)(Ir,{table:e.name,columns:cr(e).map(e=>e.name).filter(Boolean),sql:r===`new`?null:a[r],onCancel:()=>i(null),onSave:e=>{t(r===`new`?[...a,e]:a.map((t,n)=>n===r?e:t)),i(null)}})]})}function Fr({sql:e,errorPath:t,onEdit:n,onRemove:r}){let i=T(t),a=Xn(e);return(0,J.jsxs)(`li`,{className:`flex flex-col gap-1 rounded border border-line p-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`flex-1 font-mono text-xs`,title:e,children:a?`${a.unique?`Unique: `:``}${a.columns.join(`, `)}`:e}),(0,J.jsx)(j,{variant:`ghost`,onClick:n,children:`Edit index`}),(0,J.jsx)(j,{variant:`ghost`,onClick:r,children:`Remove index`})]}),i&&(0,J.jsx)(`p`,{className:`text-xs text-danger-text`,children:i})]})}function Ir({table:e,columns:t,sql:n,onCancel:r,onSave:i}){let a=fe({defaultValues:{text:n??``,uniqueChoice:!1},onSubmit:({value:e})=>i(e.text.trim())}),{text:o,uniqueChoice:s}=Ce(a.store,e=>e.values),[c]=(0,q.useState)(qn),l=Xn(o),u=o.trim()===``||!!l?.simple,d=l?.columns??[],f=l?.unique??s,p=l?.name??c,m=(t,n)=>{a.setFieldValue(`uniqueChoice`,n),a.setFieldValue(`text`,t.length?Jn({table:e,columns:t,unique:n,name:p}):``)};return(0,J.jsx)(b,{open:!0,onClose:r,title:n?`Edit index`:`Add index`,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j,{onClick:r,children:`Cancel`}),(0,J.jsx)(j,{variant:`primary`,disabled:o.trim()===``,onClick:()=>void a.handleSubmit(),children:`Apply`})]}),children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`fieldset`,{className:`flex flex-wrap gap-3`,children:[(0,J.jsx)(`legend`,{className:`mb-1 text-sm font-medium`,children:`Columns`}),t.map(e=>(0,J.jsx)(W,{label:e,disabled:!u,checked:d.includes(e),onChange:t=>m(t.target.checked?[...d,e]:d.filter(t=>t!==e),f)},e))]}),(0,J.jsx)(W,{label:`Unique`,disabled:!u,hint:u?void 0:`This index uses SQL the checkboxes cannot show. Edit the SQL instead.`,checked:f,onChange:e=>m(d,e.target.checked)}),(0,J.jsx)(a.Field,{name:`text`,children:n=>(0,J.jsx)(R,{label:`Index SQL`,language:`sql`,sqlSchema:{[e]:t},completions:Nr(t),rows:4,value:n.state.value,onChange:n.handleChange})})]})})}function Lr({label:e,value:t,onChange:n,chips:r,suggest:i,errorPath:a,emptyHint:o=`Empty rule: everyone, guests included.`,lockable:s=!0}){let c=T(a),l=(0,q.useRef)(null),u=(0,q.useRef)(t??``);(0,q.useEffect)(()=>{t!==null&&(u.current=t)},[t]);let d=e=>l.current?.insert(e);return(0,J.jsxs)(`fieldset`,{className:`flex flex-col gap-2 rounded border border-line p-3`,children:[(0,J.jsx)(`legend`,{className:`sr-only`,children:e}),(0,J.jsx)(R,{ref:l,label:e,rows:3,suggest:i,value:t??``,disabled:t===null,error:c,hint:t===null?`Only superusers can do this.`:t===``?o:void 0,onChange:n}),s&&(0,J.jsx)(W,{label:`Superusers only`,checked:t===null,onChange:e=>n(e.target.checked?null:u.current)}),t!==null&&(0,J.jsx)(J.Fragment,{children:(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(e=>(0,J.jsx)(`button`,{type:`button`,className:`rounded-full border border-line bg-hover px-2.5 py-0.5 text-xs text-text hover:border-accent hover:text-accent-text focus-visible:outline-2 focus-visible:outline-focus font-mono`,onClick:()=>d(e),children:e},e))})})]})}var Rr=[`@now`,`@todayStart`,`@todayEnd`,`@monthStart`,`@monthEnd`,`@yearStart`,`@yearEnd`];function zr(e,t,n){let r=cr(e).map(e=>e.name).filter(Boolean),i=n===`createRule`||n===`updateRule`?r.map(e=>`@request.body.${e}`):[];return[...r,`@request.auth.id`,`@request.auth.collectionName`,...i,`@request.query.`,`@request.headers.`,...t.filter(t=>!e.id||t.id!==e.id).map(e=>`@collection.${e.name}.`),...Rr]}function Br(e,t,n){return me({collectionId:e.id,fields:cr(e).filter(e=>e.name),collections:t,request:{body:n===`createRule`||n===`updateRule`}})}var Vr=[{key:`listRule`,label:`List/Search rule`},{key:`viewRule`,label:`View rule`},{key:`createRule`,label:`Create rule`},{key:`updateRule`,label:`Update rule`},{key:`deleteRule`,label:`Delete rule`},{key:`authRule`,label:`Auth rule`,emptyHint:`Empty rule: any account with valid credentials can sign in.`},{key:`manageRule`,label:`Manage rule`,emptyHint:`A manage rule cannot be empty. Write a rule or lock it.`}],Hr=Vr.map(e=>e.key);function Ur(e){return e===`view`?Vr.slice(0,2):e===`auth`?Vr:Vr.slice(0,5)}function Wr({form:e,draft:t}){let n=u();return(0,J.jsx)(`div`,{className:`flex flex-col gap-3`,children:Ur(t.type).map(({key:r,label:i,emptyHint:a})=>(0,J.jsx)(e.Field,{name:r,children:e=>(0,J.jsx)(Lr,{label:i,emptyHint:a,errorPath:r,value:e.state.value??null,chips:zr(t,n.data??[],r),suggest:Br(t,n.data??[],r),onChange:e.handleChange})},r))})}var Gr=/\n?<!-- hb:mjml:([A-Za-z0-9+/=]*) -->\s*$/;function Kr(e){let t=``;for(let n of new TextEncoder().encode(e))t+=String.fromCharCode(n);return btoa(t)}function qr(e){let t=Uint8Array.from(atob(e),e=>e.charCodeAt(0));return new TextDecoder(`utf-8`,{fatal:!0}).decode(t)}function Jr(e,t){return`${e}\n<!-- hb:mjml:${Kr(t)} -->`}function Yr(e){let t=Gr.exec(e);if(!t)return null;try{return qr(t[1])}catch{return null}}function Xr(e){return e.replace(Gr,``)}function Zr(e){let t=/<head[^>]*>([\s\S]*?)<\/head>/i.exec(e)?.[1]??``,n=/<body[^>]*>([\s\S]*?)<\/body>/i.exec(e)?.[1]??e;return`${t.replace(/<title>[\s\S]*?<\/title>/gi,``).replace(/<meta [^>]*>/gi,``).trim()}\n${n.trim()}`}var Qr=()=>se(()=>import(`./lib-C_lvLDN7.js`).then(t=>e(t.default,1)).then(e=>e.default),__vite__mapDeps([11,1])),$r=null;async function ei(e,t=Qr){$r?.load!==t&&($r={load:t,promise:t()});let n;try{n=await $r.promise}catch(e){return $r=null,{html:``,errors:[O(e)]}}try{let t=await n(e,{validationLevel:`soft`,fonts:{}});return{html:Zr(t.html),errors:t.errors.map(e=>`Line ${e.line}: ${e.message}`)}}catch(e){return{html:``,errors:[O(e)]}}}var $=e=>` <mj-text>${e}</mj-text>`,ti=(e,t)=>` <mj-button href="{APP_URL}/_/#/auth/${e}/{TOKEN}" background-color="#16161a">${t}</mj-button>`;function ni(e,t){return[`<mjml>`,` <mj-head>`,` <mj-title>${e}</mj-title>`,` <mj-attributes>`,` <mj-all font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" />`,` <mj-text font-size="14px" line-height="1.5" />`,` </mj-attributes>`,` </mj-head>`,` <mj-body>`,` <mj-section>`,` <mj-column>`,$(`Hello,`),...t,$(`Thanks,<br />{APP_NAME} team`),` </mj-column>`,` </mj-section>`,` </mj-body>`,`</mjml>`,``].join(`
8
+ `)}function ri(e,t){let n=t?`{APP_NAME} superuser account`:`{APP_NAME} account`;switch(e){case`verification`:return ni(`Verify your {APP_NAME} email`,[$(t?`Click on the button below to verify the email of your {APP_NAME} superuser account.`:`Thank you for joining us at {APP_NAME}. Click on the button below to verify your email address.`),ti(`confirm-verification`,`Verify`),$(`<i>If you didn't recently register, please ignore this email.</i>`)]);case`resetPassword`:return ni(`Reset your {APP_NAME} password`,[$(`Click on the button below to reset the password of your ${n}.`),ti(`confirm-password-reset`,`Reset password`),$(`<i>If you didn't ask to reset your password, please ignore this email.</i>`)]);case`confirmEmailChange`:return ni(`Confirm your {APP_NAME} new email address`,[$(`Click on the button below to confirm the new email address of your ${n}.`),ti(`confirm-email-change`,`Confirm new email`),$(`<i>If you didn't ask to change your email address, please ignore this email.</i>`)]);case`otp`:return ni(`OTP for {APP_NAME}`,[$(`Your one-time password for your ${n} is: <strong>{OTP}</strong>`),$(`<i>If you didn't ask for the one-time password, you can ignore this email.</i>`)]);case`authAlert`:return ni(`Login from a new location`,[$(`We noticed a login to your ${n} from a new location:`),$(`<em>{ALERT_INFO}</em>`),$(`<strong>If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.</strong>`),$(`If this was you, you may disregard this email.`)])}}var ii=(0,q.createContext)(null),ai=ii.Provider;function oi(){let[e,t]=(0,q.useState)({}),n=(0,q.useRef)({}),r={states:e,put:(e,n)=>t(t=>({...t,[e]:n})),ticket:e=>n.current[e]=(n.current[e]??0)+1,latest:(e,t)=>n.current[e]===t},i=Object.values(e);return{store:r,invalid:i.some(e=>e.error),compiling:i.some(e=>e.compiling),reset:()=>t({})}}var si=`Placeholders: {APP_NAME}, {APP_URL}, {TOKEN}, {OTP}, {OTP_ID}, {RECORD:<field>}, {ALERT_INFO}`;function ci({c:e,path:t,label:n,kind:r,superuser:i,actions:a}){let o=(0,q.useContext)(ii),s=v(),[c,l]=(0,q.useState)(!1),u=t,d=`${t}.body`,f=e.form.getFieldValue(t)?.body??``,p=T(d),m=Yr(f),h=m===null&&!e.draft.id,g=o.states[u]??{mode:m!==null||h?`mjml`:`html`,source:m??(h?ri(r,i):``),error:null,compiling:!1},_=async t=>{let n=o.ticket(u);o.put(u,{mode:`mjml`,source:t,error:null,compiling:!0});let{html:r,errors:i}=await ei(t);if(!o.latest(u,n))return;let a=i.length>0?i.join(` `):null;o.put(u,{mode:`mjml`,source:t,error:a,compiling:!1}),a||e.form.setFieldValue(d,Jr(r,t))};(0,q.useEffect)(()=>{h&&!o.states[u]&&_(g.source)},[]);let y=async()=>{if(m!==null)return void _(m);await s({title:`Convert to MJML`,message:`The HTML body is replaced by the MJML starter for this email.`,confirmLabel:`Convert`})&&_(ri(r,i))},b=async()=>{await s({title:`Edit as HTML`,message:`The MJML source is dropped on your first HTML edit. Until then, Convert to MJML brings it back.`,confirmLabel:`Edit as HTML`})&&o.put(u,{...g,mode:`html`,error:null})},x=Xr(f);return(0,J.jsxs)(J.Fragment,{children:[g.mode===`mjml`?(0,J.jsx)(R,{label:`Body (MJML)`,language:`html`,rows:12,value:g.source,error:p??g.error??void 0,hint:si,onChange:e=>void _(e)}):(0,J.jsx)(R,{label:`Body (HTML)`,language:`html`,rows:8,value:x,error:p,hint:si,onChange:t=>e.form.setFieldValue(d,t)}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[g.mode===`mjml`?(0,J.jsx)(j,{onClick:()=>void b(),children:`Edit as HTML`}):(0,J.jsx)(j,{onClick:()=>void y(),children:`Convert to MJML`}),(0,J.jsx)(j,{"aria-expanded":c,onClick:()=>l(!c),children:c?`Hide preview`:`Show preview`}),a]}),c&&(0,J.jsx)(`iframe`,{sandbox:``,title:`${n} preview`,srcDoc:x,className:`h-72 w-full rounded border border-line-strong bg-surface`})]})}function li({collection:e,template:t,onClose:n}){let r=y(),i=g(),[a,o]=(0,q.useState)(null),s=fe({defaultValues:{email:``},onSubmit:async({value:a})=>{o(null);try{await r.settings.testEmail(e,a.email,t),i.success(`Test email sent.`),n()}catch(e){o(e)}}});return(0,J.jsx)(te,{error:a,children:(0,J.jsx)(b,{open:!0,onClose:n,title:`Send test email`,footer:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j,{onClick:n,children:`Cancel`}),(0,J.jsx)(s.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,J.jsx)(j,{type:`submit`,form:`test-email`,variant:`primary`,loading:e,children:`Send`})})]}),children:(0,J.jsxs)(`form`,{id:`test-email`,onSubmit:e=>{e.preventDefault(),s.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,J.jsx)(E,{}),(0,J.jsx)(s.Field,{name:`email`,children:e=>(0,J.jsx)(ui,{value:e.state.value,onChange:e.handleChange})})]})})})}function ui({value:e,onChange:t}){return(0,J.jsx)(G,{label:`Email`,type:`email`,required:!0,value:e,error:T(`email`),onChange:e=>t(e.target.value)})}var di=[{path:`verificationTemplate`,label:`Verification email`,kind:`verification`,template:`verification`},{path:`resetPasswordTemplate`,label:`Password reset email`,kind:`resetPassword`,template:`password-reset`},{path:`confirmEmailChangeTemplate`,label:`Email change email`,kind:`confirmEmailChange`,template:`email-change`},{path:`otp.emailTemplate`,label:`OTP email`,kind:`otp`,template:`otp`},{path:`authAlert.emailTemplate`,label:`Login alert email`,kind:`authAlert`,template:`login-alert`}];function fi({c:e,saved:t}){let[n,r]=(0,q.useState)(null);return(0,J.jsxs)(K,{title:`Email templates`,prefixes:di.map(e=>e.path),children:[di.map(({path:n,label:i,kind:a,template:o})=>{let s=JSON.stringify(e.form.getFieldValue(n))!==JSON.stringify(Pe(t,n));return(0,J.jsxs)(`fieldset`,{className:Ie,children:[(0,J.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:i}),(0,J.jsx)(Ae,{c:e,path:`${n}.subject`,label:`Subject`}),(0,J.jsx)(ci,{c:e,path:n,label:i,kind:a,superuser:e.draft.name===`_superusers`,actions:t&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j,{disabled:s,onClick:()=>r(o),children:`Send test email`}),s&&(0,J.jsx)(`span`,{className:`self-center text-xs text-muted`,children:`Save first: the test email uses the saved template.`})]})})]},o)}),n&&t&&(0,J.jsx)(li,{collection:t.name,template:n,onClose:()=>r(null)})]})}var pi=[[`authToken`,`Auth token`],[`verificationToken`,`Verification token`],[`passwordResetToken`,`Password reset token`],[`emailChangeToken`,`Email change token`],[`fileToken`,`File token`]];function mi({c:e}){return(0,J.jsx)(K,{title:`Tokens`,prefixes:pi.map(([e])=>e),children:pi.map(([t,n])=>{let r=!!e.draft[t]?.secret;return(0,J.jsxs)(`fieldset`,{className:Ie,children:[(0,J.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:n}),(0,J.jsx)(Me,{c:e,path:`${t}.duration`,label:`Duration (seconds)`}),r?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(`span`,{children:`All issued tokens stop working on save.`}),(0,J.jsx)(j,{onClick:()=>e.form.setFieldValue(`${t}.secret`,void 0),children:`Undo`})]}):(0,J.jsx)(j,{className:`self-start`,onClick:()=>e.form.setFieldValue(`${t}.secret`,Ne()),children:`Invalidate all issued tokens`})]},t)})})}function hi({form:e,draft:t,clearError:n,saved:r}){let i=u(),a={form:e,draft:t,clearError:n};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[t.name!==`_superusers`&&(0,J.jsx)(vi,{c:a}),(0,J.jsxs)(K,{title:`Password auth`,prefixes:[`passwordAuth`],defaultOpen:!0,children:[(0,J.jsx)(Fe,{c:a,path:`passwordAuth.enabled`,label:`Enable password auth`}),(0,J.jsx)(gi,{c:a})]}),(0,J.jsxs)(K,{title:`One-time password`,prefixes:[`otp`],children:[(0,J.jsx)(Fe,{c:a,path:`otp.enabled`,label:`Enable one-time password`}),(0,J.jsx)(Me,{c:a,path:`otp.duration`,label:`OTP duration (seconds)`}),(0,J.jsx)(Me,{c:a,path:`otp.length`,label:`OTP length`})]}),(0,J.jsxs)(K,{title:`Multi-factor auth`,prefixes:[`mfa`],children:[(0,J.jsx)(Fe,{c:a,path:`mfa.enabled`,label:`Enable multi-factor auth`,hint:`Needs at least two other auth methods.`}),(0,J.jsx)(Me,{c:a,path:`mfa.duration`,label:`MFA duration (seconds)`}),(0,J.jsx)(e.Field,{name:`mfa.rule`,children:e=>(0,J.jsx)(Lr,{label:`MFA rule`,lockable:!1,value:e.state.value??``,onChange:t=>e.handleChange(t??``),chips:zr(t,i.data??[],`mfaRule`),suggest:Br(t,i.data??[],`mfaRule`),errorPath:`mfa.rule`,emptyHint:`Empty rule: MFA applies to every account.`})})]}),(0,J.jsx)(K,{title:`Login alerts`,prefixes:[`authAlert`],children:(0,J.jsx)(Fe,{c:a,path:`authAlert.enabled`,label:`Send login alerts`})}),(0,J.jsx)(mi,{c:a}),(0,J.jsx)(fi,{c:a,saved:r})]})}function gi({c:e}){let t=T(`passwordAuth.identityFields`),n=e.draft.passwordAuth?.identityFields??[],r=new Set(cr(e.draft).filter(e=>!e.hidden).map(e=>e.name)),i=[...new Set(lr(e.draft).map(Xn).filter(e=>e?.unique&&e.columns.length===1).map(e=>e.columns[0]).filter(e=>r.has(e)))];return(0,J.jsxs)(`fieldset`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-medium`,children:`Identity fields`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:i.map(t=>(0,J.jsx)(W,{label:t,checked:n.includes(t),onChange:r=>e.form.setFieldValue(`passwordAuth.identityFields`,r.target.checked?[...n,t]:n.filter(e=>e!==t))},t))}),(0,J.jsx)(`p`,{className:`text-xs text-muted`,children:`Fields with a single column unique index.`}),t&&(0,J.jsx)(`p`,{className:`text-xs text-danger-text`,children:t})]})}var _i=[[`id`,`ID field`],[`name`,`Name field`],[`username`,`Username field`],[`avatarURL`,`Avatar URL field`]];function vi({c:e}){let t=e.draft.oauth2?.providers??[],[n,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(null),o=je.filter(e=>!t.some(t=>t.name===e.name)),s=t=>{e.clearError(),e.form.setFieldValue(`oauth2.providers`,t)},c=cr(e.draft).map(e=>e.name);return(0,J.jsxs)(K,{title:`OAuth2`,prefixes:[`oauth2`],defaultOpen:!0,children:[(0,J.jsx)(Fe,{c:e,path:`oauth2.enabled`,label:`Enable OAuth2`}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,children:t.map((e,n)=>(0,J.jsx)(yi,{provider:e,errorPath:`oauth2.providers.${n}`,onEdit:()=>a({index:n,provider:e}),onRemove:()=>s(t.filter((e,t)=>t!==n))},e.name))}),(0,J.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,J.jsx)(`div`,{className:`flex-1`,children:(0,J.jsxs)(Se,{label:`Provider`,value:n,onChange:e=>r(e.target.value),children:[(0,J.jsx)(`option`,{value:``,disabled:!0,children:`Choose a provider`}),o.map(e=>(0,J.jsxs)(`option`,{value:e.name,children:[e.displayName,` (`,e.name,`)`]},e.name))]})}),(0,J.jsx)(j,{disabled:!n,onClick:()=>{a({index:null,provider:{name:n}}),r(``)},children:`Add provider`})]}),(0,J.jsxs)(`fieldset`,{className:Ie,children:[(0,J.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:`Mapped fields`}),_i.map(([t,n])=>(0,J.jsx)(e.form.Field,{name:`oauth2.mappedFields.${t}`,children:e=>(0,J.jsxs)(Se,{label:n,value:e.state.value??``,onChange:t=>e.handleChange(t.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`Not mapped`}),c.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})},t))]}),i&&(0,J.jsx)(Le,{provider:i.provider,errorPath:i.index===null?`oauth2.providers.new`:`oauth2.providers.${i.index}`,onCancel:()=>a(null),onSave:n=>{i.index===null?s([...t,n]):e.form.setFieldValue(`oauth2.providers`,t.map((e,t)=>t===i.index?n:e)),a(null)}})]})}function yi({provider:e,errorPath:t,onEdit:n,onRemove:r}){let i=k(`${t}.`),a=String(e.displayName||``)||je.find(t=>t.name===e.name)?.displayName||e.name;return(0,J.jsxs)(`li`,{className:`flex flex-col gap-1 rounded border border-line p-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(Re,{name:e.name,displayName:a}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:a}),(0,J.jsx)(j,{variant:`ghost`,"aria-label":`Edit provider ${a}`,onClick:n,children:`Edit`}),(0,J.jsx)(j,{variant:`ghost`,"aria-label":`Remove provider ${a}`,onClick:r,children:`Remove`})]}),i.map(([e,n])=>(0,J.jsxs)(`p`,{className:`text-xs text-danger-text`,children:[e.slice(t.length+1),`: `,n]},e))]})}var bi=[`authAlert`,`oauth2`,`passwordAuth`,`mfa`,`otp`,`authToken`,`passwordResetToken`,`emailChangeToken`,`verificationToken`,`fileToken`,`verificationTemplate`,`resetPasswordTemplate`,`confirmEmailChangeTemplate`];function xi(e){let t=e.split(`.`)[0];return Hr.includes(t)?`rules`:[`fields`,`indexes`,`viewQuery`].includes(t)?`fields`:bi.includes(t)?`options`:null}var Si=(e,t)=>JSON.stringify(dr(e))===JSON.stringify(dr(t));function Ci(e){let t=y();return m({queryKey:[`collectionScaffolds`],queryFn:({signal:e})=>t.collections.scaffolds({signal:e}),enabled:e})}function wi({collection:e,onClose:t}){let n=Ci(!e);return!e&&!n.data?(0,J.jsx)(b,{open:!0,variant:`side`,onClose:t,title:`New collection`,children:(0,J.jsx)(ce,{query:n})}):(0,J.jsx)(Ti,{collection:e,onClose:t})}function Ti({collection:e,onClose:n}){let r=y(),a=h(),o=t(),{collectionId:s}=i({strict:!1}),c=v(),l=g(),u=(0,q.useId)(),[d,p]=(0,q.useState)(e),m=Ci(!d),[_,x]=(0,q.useState)(()=>e?rr(e):ir(`base`,m.data)),[S,T]=(0,q.useState)(`fields`),[ee,k]=(0,q.useState)(null),[A,M]=(0,q.useState)(null),N=oi(),ne=async e=>{M(null),k(null);try{let t=dr(e),i=d?await r.collections.update(d.id,t):await r.collections.create(t);d&&s===d.name&&i.name!==d.name&&await o({to:`/collections/$collectionId`,params:{collectionId:i.id},replace:!0}),await a.invalidateQueries({queryKey:f.collections}),await a.invalidateQueries({queryKey:[`records`,i.id]}),l.success(d?`Collection saved.`:`Collection created.`),n(),d||o({to:`/collections/$collectionId`,params:{collectionId:i.id}})}catch(e){k(e);let t=Object.keys(w(D(e))).map(xi),n=t.find(e=>e!==null);n&&!t.includes(U)&&T(n)}},P=mr(_,async(e,t)=>{if(!(N.invalid||N.compiling)){if(d&&!t){let t=fr(d,e);if(pr(t))return M(t)}await ne(e)}}),F=Ce(P.store,e=>e.values),I=e=>{x(e),P.reset(e),k(null),N.reset()},L=()=>k(null),R=async()=>Si(P.state.values,_)||await c({title:`Discard unsaved changes?`,message:`Your edits to this collection will be lost.`,confirmLabel:`Discard`,danger:!0}),z=async()=>{await R()&&n()},re=e=>{if(!m.data)return;let t=P.state.values;N.reset();let n=sr(ir(e,m.data),t.name);if(e===`view`)return P.reset(n,{keepDefaultValues:!0});let r=new Set(m.data[t.type].indexes.map(e=>Xn(e)?.name)),i=lr(t).filter(e=>!r.has(Xn(e)?.name));P.reset(ur({...n,fields:[...n.fields,...t.fields.filter(e=>!e.system)]},[...lr(n),...i]),{keepDefaultValues:!0})},ie=e=>{L();let t=ur(P.state.values,e);P.setFieldValue(`_originalName`,t._originalName),P.setFieldValue(`fields`,t.fields),P.setFieldValue(`indexes`,t.indexes)},B=async()=>{d&&await R()&&(p(void 0),I(ar(d)))},V=async()=>{if(d&&await c({title:`Truncate collection`,message:`Delete all records of ${d.name}? This cannot be undone.`,confirmLabel:`Truncate`,danger:!0,typeToConfirm:d.name}))try{await r.collections.truncate(d.id),await a.invalidateQueries({queryKey:[`records`]}),l.success(`Collection truncated.`)}catch(e){l.error(O(e))}},H=async()=>{if(d&&await c({title:`Delete collection`,message:`Delete ${d.name} with all its records? This cannot be undone.`,confirmLabel:`Delete`,danger:!0,typeToConfirm:d.name}))try{await r.collections.delete(d.id),await a.invalidateQueries({queryKey:f.collections}),l.success(`Collection deleted.`),n(),o({to:`/collections`})}catch(e){l.error(O(e))}},ae=!!d?.system,oe=[{value:`fields`,label:F.type===`view`?`Query`:`Fields`},{value:`rules`,label:`API rules`},...F.type===`auth`?[{value:`options`,label:`Auth`}]:[]],U=oe.some(e=>e.value===S)?S:`fields`;return(0,J.jsx)(ai,{value:N.store,children:(0,J.jsxs)(te,{error:ee,children:[(0,J.jsx)(b,{open:!0,variant:`side`,onClose:()=>void z(),title:d?`Edit ${d.name}`:`New collection`,footer:(0,J.jsxs)(J.Fragment,{children:[d&&(0,J.jsxs)(`div`,{className:`mr-auto flex gap-2`,children:[(0,J.jsx)(j,{onClick:()=>void B(),children:`Duplicate`}),!ae&&d.type!==`view`&&(0,J.jsx)(C,{trigger:(0,J.jsx)(j,{"aria-label":`More actions`,icon:(0,J.jsx)(Ke,{size:15,strokeWidth:1.75}),className:`w-9 px-0`}),items:[{key:`truncate`,label:`Truncate`,danger:!0}],onAction:()=>void V(),placement:`top-start`}),!ae&&(0,J.jsx)(j,{variant:`danger`,onClick:()=>void H(),children:`Delete`})]}),N.invalid&&(0,J.jsx)(`span`,{className:`self-center text-sm text-danger-text`,children:`Fix the MJML errors in the email templates before saving.`}),(0,J.jsx)(j,{onClick:()=>void z(),children:`Cancel`}),(0,J.jsx)(P.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,J.jsx)(j,{type:`submit`,form:u,variant:`primary`,loading:e,disabled:N.invalid||N.compiling,children:d?`Save changes`:`Create`})})]}),children:(0,J.jsxs)(`form`,{id:u,onSubmit:e=>{e.preventDefault(),P.handleSubmit()},className:`flex flex-col gap-4`,children:[(0,J.jsx)(E,{}),(0,J.jsxs)(`div`,{className:`grid grid-cols-[1fr_9rem] items-start gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(P.Field,{name:`name`,children:e=>(0,J.jsx)(Ei,{label:`Name`,path:`name`,value:e.state.value,disabled:ae,onChange:e.handleChange})})}),(0,J.jsxs)(Se,{label:`Type`,value:F.type,disabled:!!d,onChange:e=>re(e.target.value),children:[(0,J.jsx)(`option`,{value:`base`,children:`Base`}),(0,J.jsx)(`option`,{value:`view`,children:`View`}),(0,J.jsx)(`option`,{value:`auth`,children:`Auth`})]})]}),(0,J.jsx)(Dt,{label:`Collection sections`,tabs:oe,value:U,onChange:T}),U===`fields`&&(F.type===`view`?(0,J.jsx)(Di,{form:P,draft:F}):(0,J.jsx)(Oi,{form:P,draft:F,clearError:L,onIndexes:ie})),U===`rules`&&(0,J.jsx)(Wr,{form:P,draft:F}),U===`options`&&(0,J.jsx)(hi,{form:P,draft:F,clearError:L,saved:d})]})}),A&&(0,J.jsx)(Vn,{changes:A,onCancel:()=>M(null),onConfirm:()=>void P.handleSubmit({confirmed:!0})})]})})}function Ei({label:e,path:t,value:n,disabled:r,onChange:i}){return(0,J.jsx)(G,{label:e,value:n,disabled:r,error:T(t),onChange:e=>i(e.target.value)})}function Di({form:e,draft:t}){let n=T(`viewQuery`),r=d(),i=u(),a=(0,q.useMemo)(()=>Mr(i.data??[]),[i.data]);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsx)(e.Field,{name:`viewQuery`,children:e=>(0,J.jsx)(R,{label:`Select query`,language:`sql`,sqlSchema:r,completions:a,rows:8,value:e.state.value??``,error:n,onChange:e.handleChange})}),t.fields.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium`,children:`Fields from the saved query`}),(0,J.jsx)(`ul`,{"aria-label":`View fields`,className:`flex flex-wrap gap-2`,children:t.fields.map(e=>(0,J.jsx)(`li`,{className:`rounded bg-hover px-2 py-0.5 font-mono text-xs`,children:e.name},e._key))})]})]})}function Oi({form:e,draft:t,clearError:n,onIndexes:r}){let[i,a]=(0,q.useState)(`text`),o=Ce(e.store,e=>e.values.fields.map(e=>e._key)),s=Ce(e.store,e=>e.values.fields.map(e=>!!e._removed)),c=0,l=s.map(e=>e?-1:c++),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(null),m=()=>{d(null),p(null)},h=t=>{let r=e.getFieldValue(`fields[${t}]`);r.system||(n(),r.id?e.setFieldValue(`fields[${t}]._removed`,!0):e.removeFieldValue(`fields`,t))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[o.map((t,r)=>(0,J.jsx)(`div`,{className:f===r&&u!==r?`rounded outline-2 outline-focus`:void 0,onDragOver:e=>{u!==null&&(e.preventDefault(),p(r))},onDrop:t=>{t.preventDefault(),u!==null&&u!==r&&(n(),e.moveFieldValues(`fields`,u,r)),m()},children:(0,J.jsx)(e.Field,{name:`fields[${r}]`,children:t=>(0,J.jsx)(Or,{field:t.state.value,errorPath:`fields.${s[r]?-1:l[r]}`,canMoveUp:r>0,canMoveDown:r<o.length-1,onChange:e=>t.handleChange(t=>({...t,...e})),onMove:t=>{n(),e.moveFieldValues(`fields`,r,r+t)},onDragStart:()=>d(r),onDragEnd:m,onRemove:()=>h(r),onRestore:()=>{n(),e.setFieldValue(`fields[${r}]._removed`,!1)}})})},t)),(0,J.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,J.jsx)(`div`,{className:`flex-1`,children:(0,J.jsx)(Se,{label:`New field type`,value:i,onChange:e=>a(e.target.value),children:De.map(e=>(0,J.jsx)(`option`,{value:e.type,children:e.label},e.type))})}),(0,J.jsx)(j,{onClick:()=>{n(),e.pushFieldValue(`fields`,or(e.state.values.fields,i))},children:`Add field`})]}),(0,J.jsx)(Pr,{draft:t,onChange:r})]})}function ki(){let[e,t]=(0,q.useState)(null);return(0,J.jsxs)(jt.Provider,{value:e=>t({collection:e}),children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-6 md:flex-row`,children:[(0,J.jsx)(Nt,{}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(r,{})})]}),e&&(0,J.jsx)(wi,{collection:e.collection,onClose:()=>t(null)})]})}function Ai(){let e=u(),t=p();if(!e.data)return(0,J.jsx)(ce,{query:e});let r=e.data.find(e=>!e.system);return r?(0,J.jsx)(n,{to:`/collections/$collectionId`,params:{collectionId:r.id},replace:!0}):(0,J.jsx)(P,{crumbs:[{label:`Collections`}],width:`full`,children:(0,J.jsx)(N,{title:`No collections yet`,children:!t&&(0,J.jsx)(It,{})})})}function ji(){let{collectionId:e}=i({strict:!1}),t=u(),[n,r]=(0,q.useState)(),a=t.data?.find(t=>t.id===e||t.name===e),o=!!t.data&&!a,{refetch:s}=t;return(0,q.useEffect)(()=>{o&&n!==e&&(r(e),s())},[o,n,e,s]),a?(0,J.jsx)(Bn,{collection:a},a.id):n===e&&!t.isFetching?(0,J.jsx)(P,{crumbs:[{label:`Collections`,to:`/collections`},{label:`Not found`}],width:`full`,children:(0,J.jsx)(N,{title:`Collection not found`})}):null}export{ji as CollectionPage,Ai as CollectionsIndex,ki as CollectionsLayout};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./useForm-BJzA_-qG.js";import{t as n}from"./useParams-DGtzGjmL.js";import{a as r,o as i}from"./field-LSvWL6SU.js";import{r as a}from"./context-BLpmYnEM.js";import{n as o,t as s}from"./errors-BzXFkL79.js";import{r as c}from"./glass-aa3ISPbD.js";import{n as l,t as u}from"./AuthCard-wJUv2Sdn.js";import{n as d,t as f}from"./InvalidLink-DYrsAHEH.js";var p=e(i(),1),m=r(),h=`Confirm new email`;function g(){let{token:e}=n({from:`/auth/confirm-email-change/$token`}),t=d(e);return t?(0,m.jsx)(_,{token:e,collectionId:t}):(0,m.jsx)(f,{title:h})}function _({token:e,collectionId:n}){let r=a(),[i,d]=(0,p.useState)(!1),[f,g]=(0,p.useState)(null),_=t({defaultValues:{password:``},onSubmit:async({value:t})=>{g(null);try{await r.auth(n).confirmEmailChange(e,t.password),d(!0)}catch(e){g(e)}}});return i?(0,m.jsx)(u,{title:h,children:(0,m.jsx)(`p`,{role:`status`,children:`Your email address was changed.`})}):(0,m.jsx)(u,{title:h,children:(0,m.jsx)(s,{error:f,children:(0,m.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),_.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,m.jsx)(_.Field,{name:`password`,children:e=>(0,m.jsx)(l,{path:`password`,label:`Password`,type:`password`,autoFocus:!0,autoComplete:`current-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,m.jsx)(o,{}),(0,m.jsx)(_.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,m.jsx)(c,{type:`submit`,variant:`primary`,loading:e,children:`Confirm new email`})})]})})})}export{g as ConfirmEmailChangePage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./useForm-BJzA_-qG.js";import{t as n}from"./link-IcX1XVhI.js";import{t as r}from"./useParams-DGtzGjmL.js";import{a as i,o as a}from"./field-LSvWL6SU.js";import{r as o}from"./context-BLpmYnEM.js";import{n as s,t as c}from"./errors-BzXFkL79.js";import{r as l}from"./glass-aa3ISPbD.js";import{n as u,t as d}from"./AuthCard-wJUv2Sdn.js";import{n as f,t as p}from"./InvalidLink-DYrsAHEH.js";var m=e(a(),1),h=i(),g=`Reset password`,_=`hbc_3142635823`;function v(){let{token:e}=r({from:`/auth/confirm-password-reset/$token`}),t=f(e);return t?(0,h.jsx)(y,{token:e,collectionId:t}):(0,h.jsx)(p,{title:g})}function y({token:e,collectionId:r}){let i=o(),[a,f]=(0,m.useState)(!1),[p,v]=(0,m.useState)(null),y=t({defaultValues:{password:``,passwordConfirm:``},onSubmit:async({value:t})=>{v(null);try{await i.auth(r).confirmPasswordReset(e,t.password,t.passwordConfirm),f(!0)}catch(e){v(e)}}});return a?(0,h.jsxs)(d,{title:g,children:[(0,h.jsx)(`p`,{role:`status`,children:`Your password was changed.`}),r===_&&(0,h.jsx)(n,{to:`/login`,className:`text-sm underline`,children:`Sign in`})]}):(0,h.jsx)(d,{title:g,children:(0,h.jsx)(c,{error:p,children:(0,h.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),y.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,h.jsx)(y.Field,{name:`password`,children:e=>(0,h.jsx)(u,{path:`password`,label:`New password`,type:`password`,autoFocus:!0,autoComplete:`new-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,h.jsx)(y.Field,{name:`passwordConfirm`,children:e=>(0,h.jsx)(u,{path:`passwordConfirm`,label:`Confirm new password`,type:`password`,autoComplete:`new-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,h.jsx)(s,{}),(0,h.jsx)(y.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,h.jsx)(l,{type:`submit`,variant:`primary`,loading:e,children:`Set new password`})})]})})})}export{v as ConfirmPasswordResetPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./useParams-DGtzGjmL.js";import{a as n,o as r}from"./field-LSvWL6SU.js";import{r as i}from"./context-BLpmYnEM.js";import{r as a}from"./errors-BzXFkL79.js";import{t as o}from"./AuthCard-wJUv2Sdn.js";import{n as s,t as c}from"./InvalidLink-DYrsAHEH.js";var l=e(r(),1),u=n(),d=`Verify email`;function f(){let{token:e}=t({from:`/auth/confirm-verification/$token`}),n=s(e);return n?(0,u.jsx)(p,{token:e,collectionId:n}):(0,u.jsx)(c,{title:d})}function p({token:e,collectionId:t}){let n=i(),[r,s]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let r=new AbortController;return n.auth(t).confirmVerification(e,{signal:r.signal}).then(()=>s({}),e=>{r.signal.aborted||s({error:a(e)})}),()=>r.abort()},[n,t,e]),(0,u.jsx)(o,{title:d,children:r===null?(0,u.jsx)(`p`,{role:`status`,children:`Verifying...`}):r.error?(0,u.jsx)(`p`,{role:`alert`,children:r.error}):(0,u.jsx)(`p`,{role:`status`,children:`Your email address is verified.`})})}export{f as ConfirmVerificationPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./check-Dy5JlAkz.js";import{n,r}from"./glass-aa3ISPbD.js";import{a as i,o as a}from"./field-LSvWL6SU.js";import{t as o}from"./Tooltip-DMaATQZc.js";var s={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};s.node;var c=n(s),l={name:`triangle-exclamation-point`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`,`triangle-alert`]};l.node;var u=n(l),d=e(a(),1),f=i(),p={idle:`Copy`,copied:`Copied`,failed:`Could not copy`},m={idle:c,copied:t,failed:u};function h({text:e,label:t=`Copy`,showLabel:n=!1}){let[i,a]=(0,d.useState)(`idle`),s=(0,d.useRef)(void 0);(0,d.useEffect)(()=>()=>clearTimeout(s.current),[]);let c=async()=>{let t=`copied`;try{await navigator.clipboard.writeText(e)}catch{t=`failed`}a(t),clearTimeout(s.current),s.current=setTimeout(()=>a(`idle`),2e3)},l=m[i];return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o,{content:p[i],children:(0,f.jsx)(r,{variant:n?void 0:`ghost`,size:n?void 0:`sm`,"aria-label":n?void 0:t,onClick:c,icon:(0,f.jsx)(l,{size:15,strokeWidth:1.75,className:i===`failed`?`text-danger-text`:void 0}),children:n&&t})}),(0,f.jsx)(`span`,{role:`status`,className:`sr-only`,children:i===`idle`?``:p[i]})]})}export{h as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./useQuery-B14t2xNU.js";import{a as n,o as r}from"./field-LSvWL6SU.js";import{a as i,r as a}from"./context-BLpmYnEM.js";import{r as o}from"./errors-BzXFkL79.js";import{t as s}from"./queries-CUkLB99G.js";import{r as c}from"./glass-aa3ISPbD.js";import{n as l,r as u,t as d}from"./Table-B0wJiwif.js";import{t as f}from"./QueryStatus-eTXKeftu.js";import{t as p}from"./SettingsPage-D8K4z39N.js";var m=e(r(),1),h=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],g=(e,t)=>e===`1`?`every ${t}`:`every ${e} ${t}s`,_=(e,t)=>`${e.padStart(2,`0`)}:${t.padStart(2,`0`)}`;function v(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let[n,r,i,a,o]=t;if(i!==`*`||a!==`*`)return null;let s=/^\*\/(\d+)$/,c=/^\d+$/;if(r===`*`&&o===`*`){if(n===`*`)return`every minute`;if(n===`0`)return`every hour`;let e=s.exec(n);return e?g(e[1],`minute`):null}if(n===`0`&&o===`*`){if(r===`*`)return`every hour`;let e=s.exec(r);if(e)return g(e[1],`hour`)}return!c.test(n)||!c.test(r)?null:o===`*`?`daily at ${_(r,n)}`:c.test(o)&&Number(o)<=7?`weekly on ${h[Number(o)%7]} at ${_(r,n)}`:null}var y=n();function b(){let e=a(),n=i(),r=t({queryKey:s.crons,queryFn:({signal:t})=>e.crons.list({signal:t})}),[h,g]=(0,m.useState)(null),_=async t=>{g(t);try{await e.crons.run(t),n.success(`Started ${t}.`)}catch(e){n.error(o(e))}finally{g(null)}};return r.data?(0,y.jsx)(p,{title:`Crons`,children:(0,y.jsxs)(d,{caption:`Crons`,children:[(0,y.jsx)(`thead`,{children:(0,y.jsxs)(`tr`,{children:[(0,y.jsx)(u,{children:`ID`}),(0,y.jsx)(u,{children:`Schedule`}),(0,y.jsx)(u,{align:`right`,children:`Action`})]})}),(0,y.jsx)(`tbody`,{children:r.data.map(e=>{let t=v(e.expression);return(0,y.jsxs)(`tr`,{children:[(0,y.jsx)(l,{children:(0,y.jsx)(`span`,{className:`font-mono text-xs`,children:e.id})}),(0,y.jsxs)(l,{children:[(0,y.jsx)(`span`,{className:`font-mono text-xs`,children:e.expression}),t&&(0,y.jsx)(`span`,{className:`ml-2 text-muted`,children:t})]}),(0,y.jsx)(l,{align:`right`,children:(0,y.jsx)(c,{loading:h===e.id,onClick:()=>void _(e.id),children:`Run now`})})]},e.id)})})]})}):(0,y.jsx)(p,{title:`Crons`,children:(0,y.jsx)(f,{query:r})})}export{b as CronsPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./field-LSvWL6SU.js";var t=e();function n({title:e,icon:n,children:r}){return(0,t.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-8 py-12 text-center text-sm text-muted`,children:[n&&(0,t.jsx)(`span`,{className:`mb-1 flex size-9 items-center justify-center rounded-full bg-hover text-muted`,children:n}),(0,t.jsx)(`p`,{className:`font-medium text-text`,children:e}),r]})}export{n as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{a as t,o as n}from"./field-LSvWL6SU.js";import{n as r}from"./queries-CUkLB99G.js";import{r as i}from"./glass-aa3ISPbD.js";import{t as a}from"./Checkbox-qSXPT8qz.js";import{t as o}from"./CopyButton-WiZL23ED.js";import{n as s}from"./import-diff-CeufMjY3.js";import{t as c}from"./QueryStatus-eTXKeftu.js";import{t as l}from"./SettingsPage-D8K4z39N.js";var u=e(n(),1),d=t();function f(){let e=r(),[t,n]=(0,u.useState)(new Set);if(!e.data)return(0,d.jsx)(l,{title:`Export collections`,children:(0,d.jsx)(c,{query:e})});let f=e.data,m=f.filter(e=>!t.has(e.id)),h=s(m),g=e=>{let r=new Set(t);r.delete(e)||r.add(e),n(r)};return(0,d.jsx)(l,{title:`Export collections`,children:(0,d.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,d.jsx)(a,{label:`Select all`,checked:m.length===f.length,onChange:()=>n(m.length===f.length?new Set(f.map(e=>e.id)):new Set)}),(0,d.jsx)(p,{legend:`Collections`,items:f.filter(e=>!e.system),unselected:t,onToggle:g}),(0,d.jsx)(p,{legend:`System collections`,items:f.filter(e=>e.system),unselected:t,onToggle:g}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(i,{variant:`primary`,onClick:()=>{let e=URL.createObjectURL(new Blob([h],{type:`application/json`})),t=document.createElement(`a`);t.href=e,t.download=`hb_collections.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(e))},children:`Download`}),(0,d.jsx)(o,{text:h,label:`Copy JSON`,showLabel:!0})]}),(0,d.jsx)(`pre`,{"aria-label":`Export preview`,className:`max-h-[32rem] overflow-auto whitespace-pre-wrap break-all rounded-control border border-line p-3 font-mono text-xs`,children:h})]})})}function p({legend:e,items:t,unselected:n,onToggle:r}){return t.length===0?null:(0,d.jsxs)(`fieldset`,{className:`flex flex-wrap gap-x-4 gap-y-2`,children:[(0,d.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:e}),t.map(e=>(0,d.jsx)(a,{label:e.name,checked:!n.has(e.id),onChange:()=>r(e.id)},e.id))]})}export{f as ExportPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{a as t,o as n}from"./field-LSvWL6SU.js";import{t as r}from"./useParams-DGtzGjmL.js";import{i,r as a}from"./context-BLpmYnEM.js";import{t as o}from"./EmptyState-BNvwv3Xw.js";import{t as s}from"./Page-K-gAWDfu.js";var c=e(n(),1),l=t();function u(){let e=r({strict:!1})._splat??``,t=i().pages.find(t=>t.path===e),n=a(),u=(0,c.useRef)(null),[d,f]=(0,c.useState)();return(0,c.useEffect)(()=>{if(t){document.title=`${t.title} - Heybe`,f(void 0);try{let e=t.mount(u.current,{client:n});return()=>{try{e?.()}catch(e){console.warn(`Extension page "${t.path}" cleanup failed`,e)}}}catch(e){f(e instanceof Error?e.message:String(e))}}},[t,n]),t?d?(0,l.jsx)(s,{crumbs:[{label:`Extensions`},{label:t.title}],width:`full`,children:(0,l.jsxs)(`p`,{role:`alert`,className:`text-danger-text`,children:[`Extension "`,t.title,`" failed: `,d]})}):(0,l.jsx)(s,{crumbs:[{label:`Extensions`},{label:t.title}],width:`full`,children:(0,l.jsx)(`div`,{ref:u})}):(0,l.jsx)(s,{crumbs:[{label:`Extensions`}],width:`full`,children:(0,l.jsx)(o,{title:`Page not found.`})})}export{u as ExtensionPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{a as t,i as n,n as r,o as i}from"./field-LSvWL6SU.js";import{r as a}from"./glass-aa3ISPbD.js";var o=e(i(),1),s=t();function c({label:e,error:t,hint:i,accept:c,multiple:l,disabled:u,name:d,onChange:f}){let p=r({error:t,hint:i}),m=(0,o.useRef)(null),[h,g]=(0,o.useState)([]),[_,v]=(0,o.useState)(!1),y=e=>{e.length!==0&&(g(e.map(e=>e.name)),f(e))};return(0,s.jsx)(n,{...p,label:e,error:t,hint:i,children:(0,s.jsxs)(`div`,{"data-testid":`file-drop`,onDragOver:e=>{e.preventDefault(),u||v(!0)},onDragLeave:()=>v(!1),onDrop:e=>{if(e.preventDefault(),v(!1),u)return;let t=[...e.dataTransfer.files];y(l?t:t.slice(0,1))},className:`flex items-center gap-3 rounded-control border border-dashed bg-surface p-3 text-sm has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-focus ${_?`border-accent`:`border-field-line`} ${u?`opacity-50`:``}`,children:[(0,s.jsx)(`input`,{ref:m,type:`file`,name:d,accept:c,multiple:l,disabled:u,...p.aria,className:`sr-only`,onChange:e=>{y([...e.target.files??[]]),e.target.value=``}}),(0,s.jsx)(a,{tabIndex:-1,disabled:u,onClick:()=>m.current?.click(),children:l?`Choose files`:`Choose file`}),(0,s.jsx)(`span`,{className:`min-w-0 truncate text-muted`,children:h.length>0?h.join(`, `):`or drop here`})]})})}export{c as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./glass-aa3ISPbD.js";import{n as t}from"./errors-BzXFkL79.js";import{a as n}from"./field-LSvWL6SU.js";var r=n();function i({dirty:n,saving:i,onReset:a}){return(0,r.jsxs)(`div`,{role:`group`,"aria-label":`Form actions`,className:`flex items-start justify-between gap-3 border-t border-line pt-4`,children:[(0,r.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,r.jsx)(t,{})}),(0,r.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,r.jsx)(e,{disabled:!n,onClick:a,children:`Reset`}),(0,r.jsx)(e,{type:`submit`,variant:`primary`,disabled:!n,loading:i,children:`Save changes`})]})]})}export{i as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{E as t,a as n,o as r,r as i,s as a}from"./context-BLpmYnEM.js";import{t as o}from"./useForm-BJzA_-qG.js";import{a as s,o as c}from"./field-LSvWL6SU.js";import{a as l,o as u,r as d}from"./errors-BzXFkL79.js";import{n as f,t as p}from"./queries-CUkLB99G.js";import{r as m}from"./glass-aa3ISPbD.js";import{t as h}from"./Checkbox-qSXPT8qz.js";import{t as g}from"./CodeArea-D6AGlQG3.js";import{t as _}from"./EmptyState-BNvwv3Xw.js";import{t as v}from"./FileField-BIdUasnF.js";import{r as y,t as b}from"./import-diff-CeufMjY3.js";import{t as x}from"./QueryStatus-eTXKeftu.js";import{t as S}from"./SettingsPage-D8K4z39N.js";import{i as C}from"./use-settings-1G2lnVQh.js";var w=e(c(),1),T=s(),E=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function D(){let e=i(),a=C(),s=f(),c=t(),D=n(),k=r(),[A,j]=(0,w.useState)(),[M,N]=(0,w.useState)(null),P=o({defaultValues:{text:``,deleteMissing:!1},onSubmitMeta:{step:`review`},onSubmit:async({value:e,meta:t})=>{t.step===`review`?await L(e):await R(t.review,e.deleteMissing)}});if(!a.data)return(0,T.jsx)(S,{title:`Import collections`,children:(0,T.jsx)(x,{query:a})});if(a.data.meta.hideControls)return(0,T.jsx)(S,{title:`Import collections`,children:(0,T.jsx)(_,{title:`Collection controls are hidden.`})});let F=async e=>{let t=e[0];t&&(P.setFieldValue(`text`,await t.text()),j(void 0))},I=async(e,t)=>{let{data:n}=await s.refetch({throwOnError:!0});return b(n,e,t)},L=async({text:e,deleteMissing:t})=>{try{let n=y(e);j(void 0),N({list:n,diff:await I(n,t)})}catch(e){j({message:d(e),details:[]})}},R=async({list:t,diff:n},r)=>{let i=n.changed.reduce((e,t)=>e+t.fields.deleted.length,0);if(!(n.deleted.length+i>0&&!await k({title:`Delete data`,message:`This import deletes ${[n.deleted.length>0&&E(n.deleted.length,`collection`),i>0&&E(i,`field`)].filter(Boolean).join(` and `)} with all their data. This cannot be undone.`,confirmLabel:`Import and delete`,danger:!0})))try{let i=await I(t,r);if(JSON.stringify(i)!==JSON.stringify(n)){N({list:t,diff:i}),D.error(`The collections changed. Review the import again.`);return}await e.collections.import(t,r),await c.invalidateQueries({queryKey:p.collections}),D.success(`Collections imported.`)}catch(e){j({message:d(e),details:Object.values(l(u(e)))})}};return(0,T.jsx)(S,{title:`Import collections`,children:(0,T.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),P.handleSubmit({step:`review`})},className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`p`,{className:`rounded-control border border-warning-line bg-warning-bg p-3 text-sm text-warning-text`,children:[`Imports do not write migration files. Run`,` `,(0,T.jsx)(`code`,{children:`heybe migrate collections`}),` afterwards to snapshot the schema.`]}),(0,T.jsx)(`div`,{children:(0,T.jsx)(v,{label:`Collections file`,accept:`.json,application/json`,onChange:e=>void F(e)})}),(0,T.jsx)(P.Field,{name:`text`,children:e=>(0,T.jsx)(g,{label:`Collections JSON`,language:`json`,rows:16,value:e.state.value,onChange:t=>{e.handleChange(t),j(void 0)}})}),(0,T.jsx)(P.Field,{name:`deleteMissing`,children:e=>(0,T.jsx)(h,{label:`Delete collections and fields missing from the import`,hint:`System collections and system fields are never deleted.`,checked:e.state.value,onChange:t=>e.handleChange(t.target.checked)})}),A&&(0,T.jsxs)(`div`,{role:`alert`,className:`rounded border border-danger/40 bg-danger/10 p-3 text-sm text-danger-text`,children:[(0,T.jsx)(`p`,{children:A.message}),A.details.map((e,t)=>(0,T.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap text-xs`,children:e},t))]}),(0,T.jsx)(P.Subscribe,{selector:e=>[e.isSubmitting,!e.values.text.trim()],children:([e,t])=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.jsx)(m,{type:`submit`,variant:`primary`,loading:e,disabled:t||!s.data,children:`Review`}),t&&(0,T.jsx)(`p`,{className:`text-xs text-muted`,children:`Paste or load a JSON file to enable Review.`})]})}),M&&(0,T.jsx)(O,{diff:M.diff,onCancel:()=>N(null),onImport:()=>{N(null),P.handleSubmit({step:`import`,review:M})}})]})})}function O({diff:e,onCancel:t,onImport:n}){let r=e.added.length+e.changed.length+e.deleted.length===0,i=e.deleted.length>0||e.changed.some(e=>e.fields.deleted.length>0);return(0,T.jsxs)(a,{open:!0,onClose:t,title:`Review import`,footer:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(m,{onClick:t,children:`Cancel`}),(0,T.jsx)(m,{variant:`primary`,disabled:r,onClick:n,children:`Import`})]}),children:[r&&(0,T.jsx)(`p`,{className:`text-sm`,children:`No changes.`}),(0,T.jsx)(A,{title:`Added`,items:e.added.map(e=>({name:e}))}),(0,T.jsx)(A,{title:`Changed`,items:e.changed.map(k)}),(0,T.jsx)(A,{title:`Deleted`,items:e.deleted.map(e=>({name:e}))}),i&&(0,T.jsx)(`p`,{className:`mt-3 text-sm text-danger-text`,children:`Deleted collections and fields lose all their data.`})]})}function k(e){let{added:t,changed:n,deleted:r}=e.fields;return{name:e.previousName?`${e.previousName} -> ${e.name}`:e.name,lines:[t.length>0&&`Added fields: ${t.join(`, `)}`,n.length>0&&`Changed fields: ${n.join(`, `)}`,r.length>0&&`Deleted fields: ${r.join(`, `)}`].filter(e=>!!e)}}function A({title:e,items:t}){let n=(0,w.useId)();if(t.length===0)return null;let r=`${e} (${t.length})`;return(0,T.jsxs)(`section`,{className:`mt-3 first:mt-0`,children:[(0,T.jsx)(`h3`,{id:n,className:`text-sm font-semibold`,children:r}),(0,T.jsx)(`ul`,{"aria-labelledby":n,className:`mt-1 list-disc pl-5 text-sm`,children:t.map(e=>(0,T.jsxs)(`li`,{children:[(0,T.jsx)(`span`,{className:`font-mono`,children:e.name}),e.lines?.map(e=>(0,T.jsx)(`p`,{className:`text-xs text-muted`,children:e},e))]},e.name))})]})}export{D as ImportPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./jwt-DZxaQ4-r.js";import{t as n}from"./useForm-BJzA_-qG.js";import{t as r}from"./link-IcX1XVhI.js";import{n as i}from"./useNavigate-COQv2_P5.js";import{t as a}from"./useParams-DGtzGjmL.js";import{a as o,o as s}from"./field-LSvWL6SU.js";import{r as c}from"./context-BLpmYnEM.js";import{n as l,t as u}from"./errors-BzXFkL79.js";import{r as d}from"./glass-aa3ISPbD.js";import{t as f}from"./FileField-BIdUasnF.js";import{t as p}from"./TextField-IItAFjU7.js";import{n as m,t as h}from"./AuthCard-wJUv2Sdn.js";import{a as g}from"./session-oCkjTB0W.js";var _=e(s(),1),v=o();function y(){let{token:e}=a({from:`/hbinstall/$token`});return t(e,Date.now())?(0,v.jsxs)(h,{title:`Installer link expired`,children:[(0,v.jsx)(`p`,{role:`alert`,children:`This installer link has expired. Restart the server to print a new one.`}),(0,v.jsx)(r,{to:`/login`,className:`text-accent-text hover:underline`,children:`Sign in`})]}):(0,v.jsx)(x,{token:e})}function b(){let e=i(),[t,n]=(0,_.useState)(``),r=g(t);return(0,v.jsxs)(h,{title:`Set up Heybe`,children:[(0,v.jsxs)(`p`,{className:`text-sm`,children:[`This server has no superuser yet. Open the setup link printed where Heybe runs: the terminal, `,(0,v.jsx)(`code`,{children:`journalctl -u heybe`}),` or`,` `,(0,v.jsx)(`code`,{children:`docker logs`}),`. Paste it here to continue.`]}),(0,v.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),e({to:`/hbinstall/$token`,params:{token:r}})},className:`flex flex-col gap-3`,children:[(0,v.jsx)(p,{label:`Setup link or token`,autoFocus:!0,required:!0,value:t,onChange:e=>n(e.target.value)}),(0,v.jsx)(d,{type:`submit`,variant:`primary`,disabled:!r,children:`Continue`})]}),(0,v.jsxs)(`p`,{className:`text-sm text-muted`,children:[`You can also create one on the server with`,` `,(0,v.jsx)(`code`,{children:`heybe superuser upsert EMAIL PASS`}),`.`]})]})}function x({token:e}){let t=c(),r=i(),a={headers:{Authorization:e}},[o,s]=(0,_.useState)(null),[p,g]=(0,_.useState)(null),[y,b]=(0,_.useState)(!1),x=n({defaultValues:{email:``,password:``,passwordConfirm:``},onSubmit:async({value:e})=>{s(null);try{await t.records(`_superusers`).create(e,void 0,a),await t.auth(`_superusers`).withPassword(e.email,e.password),await r({to:`/collections`})}catch(e){s(e)}}}),S=n({defaultValues:{file:null},onSubmit:async({value:{file:e}})=>{if(e){g(null);try{await t.backups.upload(e,a),await t.backups.restore(e.name,a),b(!0)}catch(e){g(e)}}}});return y?(0,v.jsxs)(h,{title:`Restoring backup`,children:[(0,v.jsx)(`p`,{role:`status`,children:`Restore started. The server restarts with the restored data; reload this page in a few seconds.`}),(0,v.jsx)(d,{variant:`primary`,onClick:async()=>{await r({to:`/login`}),location.reload()},children:`Reload`})]}):(0,v.jsxs)(h,{title:`Create your first superuser`,children:[(0,v.jsx)(u,{error:o,children:(0,v.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),x.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,v.jsx)(x.Field,{name:`email`,children:e=>(0,v.jsx)(m,{path:`email`,label:`Email`,type:`email`,autoFocus:!0,autoComplete:`username`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,v.jsx)(x.Field,{name:`password`,children:e=>(0,v.jsx)(m,{path:`password`,label:`Password`,type:`password`,autoComplete:`new-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,v.jsx)(x.Field,{name:`passwordConfirm`,children:e=>(0,v.jsx)(m,{path:`passwordConfirm`,label:`Confirm password`,type:`password`,autoComplete:`new-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,v.jsx)(l,{}),(0,v.jsx)(x.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,v.jsx)(S.Subscribe,{selector:e=>e.isSubmitting,children:t=>(0,v.jsx)(d,{type:`submit`,variant:`primary`,loading:e,disabled:t,children:`Create superuser`})})})]})}),(0,v.jsx)(u,{error:p,children:(0,v.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),S.handleSubmit()},className:`flex flex-col gap-3 border-t border-line pt-4`,children:[(0,v.jsx)(`h2`,{className:`font-medium`,children:`Restore from a backup`}),(0,v.jsx)(`p`,{className:`text-sm text-muted`,children:`The backup is not validated. Only use files you trust.`}),(0,v.jsx)(S.Field,{name:`file`,children:e=>(0,v.jsx)(f,{label:`Backup file`,accept:`.zip,application/zip`,onChange:t=>e.handleChange(t[0]??null)})}),(0,v.jsx)(l,{}),(0,v.jsx)(S.Subscribe,{selector:e=>[e.isSubmitting,e.values.file],children:([e,t])=>(0,v.jsx)(x.Subscribe,{selector:e=>e.isSubmitting,children:n=>(0,v.jsx)(d,{type:`submit`,loading:e,disabled:!t||n,children:`Upload and restore`})})})]})})]})}export{y as InstallerPage,b as InstallerStartPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./field-LSvWL6SU.js";import{n as t}from"./jwt-DZxaQ4-r.js";import{t as n}from"./AuthCard-wJUv2Sdn.js";function r(e){let n=t(e).collectionId;return typeof n==`string`&&n?n:null}var i=e();function a({title:e}){return(0,i.jsx)(n,{title:e,children:(0,i.jsx)(`p`,{role:`alert`,children:`Invalid or expired link.`})})}export{r as n,a as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./error-DIHpHIMq.js";import{t as n}from"./useForm-BJzA_-qG.js";import{t as r}from"./useQuery-B14t2xNU.js";import{t as i}from"./link-IcX1XVhI.js";import{n as a}from"./useNavigate-COQv2_P5.js";import{t as o}from"./useSearch-CNiDThqu.js";import{a as s,o as c}from"./field-LSvWL6SU.js";import{r as l}from"./context-BLpmYnEM.js";import{n as u,r as d,t as f}from"./errors-BzXFkL79.js";import{r as p}from"./glass-aa3ISPbD.js";import{n as m,t as h}from"./AuthCard-wJUv2Sdn.js";import{c as g}from"./session-oCkjTB0W.js";var _=e(c(),1),v=s(),y=/^[^@\s]+@[^@\s]+$/;function b(){let e=l(),s=a(),c=o({from:`/login`}),b=e.auth(`_superusers`),x=r({queryKey:[`superuserAuthMethods`],queryFn:({signal:e})=>b.methods({signal:e})}),[S,C]=(0,_.useState)(``),[w,T]=(0,_.useState)(``),[E,D]=(0,_.useState)(``),[O,k]=(0,_.useState)(null),A=()=>s({href:g(c.redirect)}),j=async e=>{try{let t=await b.requestOTP(e);T(t.otpId),D(t.otpId)}catch(e){throw e instanceof t&&e.status===429&&T(E),e}},M=async({identity:e,password:n})=>{try{await b.withPassword(e,n)}catch(n){let r=n instanceof t&&n.response.mfaId;if(n instanceof t&&n.status===401&&r){C(String(r)),y.test(e)&&(N.setFieldValue(`otpEmail`,e),await j(e));return}throw n}await A()},N=n({defaultValues:{identity:``,password:``,otpEmail:``,otpPassword:``},onSubmitMeta:{step:`password`},onSubmit:async({value:e,meta:t})=>{k(null);try{t.step===`password`?await M(e):t.step===`sendCode`?await j(e.otpEmail):(await b.withOTP(w,e.otpPassword,S?{mfaId:S}:{}),await A())}catch(e){k(e)}}}),P;return P=x.isPending?(0,v.jsx)(`p`,{children:`Loading...`}):x.isError?(0,v.jsx)(`p`,{role:`alert`,children:d(x.error)}):x.data.password.enabled&&!S?(0,v.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),N.handleSubmit({step:`password`})},className:`flex flex-col gap-3`,children:[(0,v.jsx)(N.Field,{name:`identity`,children:e=>(0,v.jsx)(m,{path:`identity`,label:`Email`,type:`email`,autoFocus:!0,autoComplete:`username`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,v.jsx)(N.Field,{name:`password`,children:e=>(0,v.jsx)(m,{path:`password`,label:`Password`,type:`password`,autoComplete:`current-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,v.jsx)(u,{}),(0,v.jsx)(N.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,v.jsx)(p,{type:`submit`,variant:`primary`,loading:e,children:`Sign in`})}),(0,v.jsx)(i,{to:`/request-password-reset`,className:`text-sm underline`,children:`Forgot password?`})]},`password`):(x.data.otp.enabled||S)&&!w?(0,v.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),N.handleSubmit({step:`sendCode`})},className:`flex flex-col gap-3`,children:[S&&(0,v.jsx)(`p`,{className:`text-sm`,children:`Finish signing in with a code.`}),(0,v.jsx)(N.Field,{name:`otpEmail`,children:e=>(0,v.jsx)(m,{path:`email`,label:`Email`,type:`email`,autoFocus:!0,autoComplete:`username`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,v.jsx)(u,{}),(0,v.jsx)(N.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,v.jsx)(p,{type:`submit`,variant:`primary`,loading:e,children:`Send code`})})]},`request-otp`):w?(0,v.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),N.handleSubmit({step:`verify`})},className:`flex flex-col gap-3`,children:[(0,v.jsx)(N.Subscribe,{selector:e=>e.values.otpEmail,children:e=>(0,v.jsxs)(`p`,{className:`text-sm`,children:[`Check `,e,` for the code.`]})}),(0,v.jsx)(N.Field,{name:`otpPassword`,children:e=>(0,v.jsx)(m,{path:`password`,label:`One-time password`,autoFocus:!0,autoComplete:`one-time-code`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,v.jsx)(u,{}),(0,v.jsx)(N.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,v.jsx)(p,{type:`submit`,variant:`primary`,loading:e,children:`Verify`})}),(0,v.jsx)(p,{variant:`ghost`,onClick:()=>T(``),children:`Send a new code`})]},`verify-otp`):(0,v.jsx)(`p`,{children:`No sign-in method is enabled for superusers.`}),(0,v.jsx)(h,{title:`Superuser sign in`,children:(0,v.jsx)(f,{error:O,children:P})})}export{b as LoginPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./field-LSvWL6SU.js";var t=e();function n({size:e=22}){return(0,t.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 64 64`,"aria-hidden":`true`,children:[(0,t.jsx)(`rect`,{width:`64`,height:`64`,rx:`14`,fill:`#1b7b9b`}),(0,t.jsxs)(`g`,{fill:`none`,stroke:`#fff`,strokeWidth:`2.8`,children:[(0,t.jsx)(`path`,{d:`M29 7H35V14H42V22H50V29H57V35H50V42H42V50H35V57H29V50H22V42H14V35H7V29H14V22H22V14H29Z`}),(0,t.jsx)(`path`,{d:`M32 19 45 32 32 45 19 32Z`})]}),(0,t.jsx)(`path`,{d:`M32 27 37 32 32 37 27 32Z`,fill:`#fff`})]})}export{n as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{a as t,i as n,o as r,s as i,t as a}from"./SearchBar-DPaUcuh2.js";import{t as o}from"./useQuery-B14t2xNU.js";import{n as s}from"./useNavigate-COQv2_P5.js";import{t as c}from"./useSearch-CNiDThqu.js";import{a as l,o as u}from"./field-LSvWL6SU.js";import{r as d,s as f}from"./context-BLpmYnEM.js";import{t as p}from"./search-CViJCnFi.js";import{c as m,i as h,n as g,r as _,t as v}from"./errors-BzXFkL79.js";import{t as y}from"./Page-K-gAWDfu.js";import{t as b}from"./QueryStatus-eTXKeftu.js";import{i as x}from"./use-settings-1G2lnVQh.js";import{r as S}from"./glass-aa3ISPbD.js";import{t as C}from"./Checkbox-qSXPT8qz.js";import{n as w,r as T,t as E}from"./Table-B0wJiwif.js";import{t as D}from"./CopyButton-WiZL23ED.js";import{t as O}from"./Tooltip-DMaATQZc.js";import{n as k,s as A,t as j}from"./use-settings-form-DWwEeaUC.js";import{t as M}from"./Select-DsX5Ea_q.js";import{i as N}from"./NumberField-83x9ooVV.js";var P=e(u(),1),F=l(),I={[-4]:`DEBUG`,0:`INFO`,4:`WARN`,8:`ERROR`},L=e=>I[e]??String(e),R=e=>e==null?``:typeof e==`string`?e:JSON.stringify(e);function z({id:e,onClose:t}){let n=d(),i=o({queryKey:[`logs`,`one`,e],queryFn:({signal:t})=>n.logs.findOne(e,{signal:t})}),a=(i.data?[[`id`,i.data.id],[`created`,r(i.data.created,`full`)],[`level`,L(i.data.level)],[`message`,i.data.message],...Object.entries(i.data.data).map(([e,t])=>[e,R(t)])]:[]).filter(([,e])=>e!==``);return(0,F.jsxs)(f,{open:!0,onClose:t,title:`Log details`,footer:(0,F.jsxs)(F.Fragment,{children:[i.data&&(0,F.jsx)(D,{label:`Copy JSON`,showLabel:!0,text:JSON.stringify(i.data,null,2)}),(0,F.jsx)(S,{onClick:t,children:`Close`})]}),children:[i.isPending&&(0,F.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Loading...`}),i.error&&(0,F.jsx)(`p`,{role:`alert`,children:_(i.error)}),(0,F.jsx)(`dl`,{className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-4 gap-y-2 text-sm`,children:a.map(([e,t])=>(0,F.jsxs)(`div`,{className:`contents`,children:[(0,F.jsx)(`dt`,{className:`truncate font-medium text-muted`,title:e,children:e}),(0,F.jsx)(`dd`,{className:`min-w-0 whitespace-pre-wrap font-mono text-xs [overflow-wrap:anywhere]`,children:t})]},e))})]})}var B=36e5,V=e=>r(new Date(e));function H({stats:e}){if(e.length===0)return(0,F.jsx)(`p`,{className:`text-sm text-muted`,children:`No logs for this filter.`});let t=new Map(e.map(e=>[Date.parse(e.date.replace(` `,`T`)),e.total])),n=[...t.keys()],r=Math.max(...n),i=Math.min(Math.min(...n),r-23*B),a=Array.from({length:(r-i)/B+1},(e,t)=>i+t*B),o=e.reduce((e,t)=>e+t.total,0),s=Math.max(...e.map(e=>e.total)),c=[...new Set([s,Math.round(s/2),0])],l=[i,i+Math.floor((a.length-1)/2)*B,r];return(0,F.jsxs)(`div`,{role:`img`,"aria-label":`Requests per hour, ${o} in total`,className:`flex gap-2 text-xs text-faint`,children:[(0,F.jsx)(`div`,{className:`flex h-28 flex-col justify-between text-right tabular-nums`,children:c.map(e=>(0,F.jsx)(`span`,{children:e},e))}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`flex h-28 items-end border-b border-line-strong`,children:a.map(e=>{let n=t.get(e)??0,r=(0,F.jsx)(`div`,{className:`group flex h-full min-w-px flex-1 items-end justify-center`,children:(0,F.jsx)(`div`,{"data-bar":!0,style:{height:`${n>0?Math.max(n/s*100,2):0}%`,width:`calc(100% - 2px)`,maxWidth:16},className:`rounded-t-sm bg-accent group-hover:brightness-125`})},e);return n>0?(0,F.jsx)(O,{content:`${V(e)}: ${n}`,children:r},e):r})}),(0,F.jsx)(`div`,{className:`mt-1 flex justify-between`,children:l.map(e=>(0,F.jsx)(`span`,{children:V(e)},e))})]})]})}function U({settings:e,onClose:t}){let{form:n,save:r,submit:i}=j(e,t);return(0,F.jsx)(v,{error:r.error,children:(0,F.jsx)(f,{open:!0,onClose:t,title:`Logs settings`,footer:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{onClick:t,children:`Cancel`}),(0,F.jsx)(S,{type:`submit`,form:`logs-settings`,variant:`primary`,loading:r.isPending,children:`Save changes`})]}),children:(0,F.jsxs)(`form`,{id:`logs-settings`,onSubmit:i,className:`flex flex-col gap-3`,children:[(0,F.jsx)(g,{}),(0,F.jsx)(n.Field,{name:`settings.logs.maxDays`,children:e=>(0,F.jsx)(A,{path:`logs.maxDays`,label:`Retention (days)`,field:e})}),(0,F.jsx)(n.Field,{name:`settings.logs.minLevel`,children:e=>(0,F.jsx)(W,{value:e.state.value,onChange:e.handleChange})}),(0,F.jsx)(n.Field,{name:`settings.logs.logIP`,children:e=>(0,F.jsx)(k,{path:`logs.logIP`,label:`Log IP addresses`,field:e})}),(0,F.jsx)(n.Field,{name:`settings.logs.logAuthId`,children:e=>(0,F.jsx)(k,{path:`logs.logAuthId`,label:`Log authenticated user ids`,field:e})})]})})})}function W({value:e,onChange:t}){let n=[-4,0,4,8];return n.includes(e)||n.push(e),(0,F.jsx)(M,{label:`Min level`,value:e,error:m(`logs.minLevel`),onChange:e=>t(Number(e.target.value)),children:n.map(e=>(0,F.jsx)(`option`,{value:e,children:L(e)},e))})}var G={INFO:`success`,WARN:`warning`,ERROR:`danger`};function K({level:e}){let t=L(e);return(0,F.jsx)(N,{tone:G[t]??`neutral`,children:t})}var q=n(t),J=`data.auth != "_superusers"`;function Y({filter:e,superusers:t}){return t?e??``:e?`(${e}) && (${J})`:J}var X=e=>e==null?``:String(e);function Z(e){let{method:t,url:n,status:r,execTime:i}=e.data;if(!t)return e.message;let a=typeof i==`number`?`${Math.round(i)}ms`:``;return[X(t),X(r),a,X(n)].filter(Boolean).join(` `)}function Q(){let e=d(),t=s(),n=c({strict:!1}),l=x(),[u,f]=(0,P.useState)(!1),m=Y(n),g=i({queryKey:[`logs`,`list`,m],initialPageParam:1,queryFn:({signal:t,pageParam:n})=>e.logs.findMany({perPage:50,page:n,filter:m,sort:`-@rowid`},{signal:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0}),_=o({queryKey:[`logs`,`stats`,m],queryFn:({signal:t})=>e.logs.stats({filter:m},{signal:t})}),v=e=>t({to:`.`,search:t=>p({...t,...e})}),D=g.data?.pages.flatMap(e=>e.items);return(0,F.jsxs)(y,{crumbs:[{label:`Logs`}],width:`full`,footer:g.data&&`Total: ${g.data.pages[0].totalItems}`,actions:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{onClick:()=>{g.refetch(),_.refetch()},children:`Refresh`}),(0,F.jsx)(S,{disabled:!l.data,onClick:()=>f(!0),children:`Logs settings`})]}),children:[(0,F.jsx)(a,{label:`Filter logs`,suggest:q,placeholder:`e.g. level >= 8 && data.status >= 400`,filter:n.filter??``,error:g.error?h(g.error):void 0,onSearch:e=>void v({filter:e||void 0})}),(0,F.jsx)(C,{label:`Include superuser requests`,checked:!!n.superusers,onChange:e=>void v({superusers:e.target.checked||void 0})}),(_.data||g.error)&&(0,F.jsx)(H,{stats:_.data??[]}),_.isError&&!g.error&&(0,F.jsx)(b,{query:_}),g.isPending&&(0,F.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Loading...`}),D?.length===0&&(0,F.jsx)(`p`,{className:`text-sm text-muted`,children:n.filter?`No logs match the filter.`:`No logs yet.`}),(D&&D.length>0||g.error)&&(0,F.jsxs)(E,{caption:`Logs`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(T,{children:`Level`}),(0,F.jsx)(T,{children:`Message`}),(0,F.jsx)(T,{children:`Created`})]})}),(0,F.jsx)(`tbody`,{children:(D??[]).map(e=>(0,F.jsxs)(`tr`,{className:`cursor-pointer hover:bg-hover`,onClick:()=>void v({log:e.id}),children:[(0,F.jsx)(w,{children:(0,F.jsx)(K,{level:e.level})}),(0,F.jsx)(w,{fill:!0,children:(0,F.jsx)(`button`,{type:`button`,title:Z(e),className:`block w-full truncate text-left font-mono text-xs focus-visible:outline-2 focus-visible:outline-focus`,onClick:t=>{t.stopPropagation(),v({log:e.id})},children:Z(e)})}),(0,F.jsx)(w,{children:(0,F.jsx)(`span`,{title:e.created,className:`whitespace-nowrap text-muted`,children:r(e.created)})})]},e.id))})]}),g.hasNextPage&&(0,F.jsx)(S,{className:`self-center`,loading:g.isFetchingNextPage,onClick:()=>void g.fetchNextPage(),children:`Load more`}),n.log&&(0,F.jsx)(z,{id:n.log,onClose:()=>void v({log:void 0})}),u&&l.data&&(0,F.jsx)(U,{settings:l.data,onClose:()=>f(!1)})]})}export{Q as LogsPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./useForm-BJzA_-qG.js";import{a as n,o as r}from"./field-LSvWL6SU.js";import{a as i,r as a,s as o}from"./context-BLpmYnEM.js";import{c as s,n as c,t as l}from"./errors-BzXFkL79.js";import{n as u}from"./queries-CUkLB99G.js";import{r as d}from"./glass-aa3ISPbD.js";import{t as f}from"./Select-DsX5Ea_q.js";import{t as p}from"./TextField-IItAFjU7.js";import{c as m,d as h,i as g,l as _,r as v,s as y,t as b,u as x}from"./use-settings-form-DWwEeaUC.js";import{t as S}from"./QueryStatus-eTXKeftu.js";import{t as C}from"./FormFooter-Ct4RFwgS.js";import{t as w}from"./SettingsPage-D8K4z39N.js";import{i as T}from"./use-settings-1G2lnVQh.js";var E=e(r(),1),D=n();function O(){let e=T();return(0,D.jsx)(w,{title:`Mail`,children:e.data?(0,D.jsx)(k,{settings:e.data}):(0,D.jsx)(S,{query:e})})}function k({settings:e}){let{form:t,dirty:n,save:r,submit:i,reset:a}=b(e),[o,s]=(0,E.useState)(!1);return(0,D.jsxs)(l,{error:r.error,children:[(0,D.jsxs)(`form`,{onSubmit:i,className:`flex flex-col gap-4`,children:[(0,D.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,D.jsx)(t.Field,{name:`settings.meta.senderName`,children:e=>(0,D.jsx)(h,{path:`meta.senderName`,label:`Sender name`,field:e})}),(0,D.jsx)(t.Field,{name:`settings.meta.senderAddress`,children:e=>(0,D.jsx)(h,{path:`meta.senderAddress`,label:`Sender address`,field:e})})]}),(0,D.jsx)(t.Subscribe,{selector:e=>e.values.settings.smtp.enabled,children:e=>(0,D.jsx)(_,{errorPrefix:`smtp.`,title:`SMTP server`,badge:(0,D.jsx)(g,{on:e}),children:(0,D.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,D.jsx)(t.Field,{name:`settings.smtp.enabled`,children:e=>(0,D.jsx)(x,{path:`smtp.enabled`,label:`Use SMTP`,field:e})}),(0,D.jsxs)(v,{enabled:e,children:[(0,D.jsx)(t.Field,{name:`settings.smtp.host`,children:e=>(0,D.jsx)(h,{path:`smtp.host`,label:`Host`,field:e})}),(0,D.jsx)(t.Field,{name:`settings.smtp.port`,children:e=>(0,D.jsx)(y,{path:`smtp.port`,label:`Port`,field:e})}),(0,D.jsx)(t.Field,{name:`settings.smtp.username`,children:e=>(0,D.jsx)(h,{path:`smtp.username`,label:`Username`,field:e})}),(0,D.jsx)(t.Field,{name:`secrets.smtpPassword`,children:e=>(0,D.jsx)(m,{path:`smtp.password`,label:`Password`,field:e})}),(0,D.jsx)(t.Field,{name:`settings.smtp.authMethod`,children:e=>(0,D.jsx)(A,{value:e.state.value,onChange:e.handleChange})}),(0,D.jsx)(t.Field,{name:`settings.smtp.tls`,children:e=>(0,D.jsx)(x,{path:`smtp.tls`,label:`TLS`,field:e})}),(0,D.jsx)(t.Field,{name:`settings.smtp.localName`,children:e=>(0,D.jsx)(h,{path:`smtp.localName`,label:`Local name`,field:e})})]})]})})}),(0,D.jsx)(`div`,{children:(0,D.jsx)(d,{disabled:n,onClick:()=>s(!0),children:`Send test email`})}),(0,D.jsx)(C,{dirty:n,saving:r.isPending,onReset:a})]}),o&&(0,D.jsx)(M,{onClose:()=>s(!1)})]})}function A({value:e,onChange:t}){return(0,D.jsxs)(f,{label:`Auth method`,value:e,error:s(`smtp.authMethod`),onChange:e=>t(e.target.value),children:[(0,D.jsx)(`option`,{value:``,children:`Default`}),(0,D.jsx)(`option`,{value:`PLAIN`,children:`PLAIN`}),(0,D.jsx)(`option`,{value:`LOGIN`,children:`LOGIN`})]})}var j=[`verification`,`password-reset`,`email-change`,`otp`,`login-alert`];function M({onClose:e}){let n=a(),r=i(),s=u(),[p,m]=(0,E.useState)(null),h=(s.data??[]).filter(e=>e.type===`auth`),g=t({defaultValues:{template:j[0],email:``,collection:`_superusers`},onSubmit:async({value:t})=>{m(null);try{await n.settings.testEmail(t.collection,t.email,t.template),r.success(`Test email sent.`),e()}catch(e){m(e)}}});return(0,D.jsx)(l,{error:p,children:(0,D.jsx)(o,{open:!0,onClose:e,title:`Send test email`,footer:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(d,{onClick:e,children:`Cancel`}),(0,D.jsx)(g.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,D.jsx)(d,{type:`submit`,form:`send-test-email`,variant:`primary`,loading:e,children:`Send`})})]}),children:(0,D.jsxs)(`form`,{id:`send-test-email`,onSubmit:e=>{e.preventDefault(),g.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,D.jsx)(c,{}),(0,D.jsxs)(`fieldset`,{className:`flex flex-col gap-1`,children:[(0,D.jsx)(`legend`,{className:`text-sm font-medium`,children:`Template`}),(0,D.jsx)(g.Field,{name:`template`,children:e=>j.map(t=>(0,D.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,D.jsx)(`input`,{type:`radio`,name:`template`,checked:e.state.value===t,onChange:()=>e.handleChange(t)}),t]},t))})]}),(0,D.jsx)(g.Field,{name:`email`,children:e=>(0,D.jsx)(N,{value:e.state.value,onChange:e.handleChange})}),(0,D.jsx)(g.Field,{name:`collection`,children:e=>(0,D.jsxs)(f,{label:`Auth collection`,value:e.state.value,disabled:!s.data,onChange:t=>e.handleChange(t.target.value),children:[!s.data&&(0,D.jsx)(`option`,{value:e.state.value,children:e.state.value}),h.map(e=>(0,D.jsx)(`option`,{value:e.name,children:e.name},e.id))]})})]})})})}function N({value:e,onChange:t}){return(0,D.jsx)(p,{label:`Email`,type:`email`,required:!0,value:e,error:s(`email`),onChange:e=>t(e.target.value)})}export{O as MailPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{a as t,o as n}from"./field-LSvWL6SU.js";import{A as r,k as i,z as a}from"./context-BLpmYnEM.js";import{t as o}from"./useSelector-CNRxEOGR.js";var s=e(n(),1),c=t(),l=class extends s.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?s.createElement(this.props.errorComponent??u,{error:e[0],reset:this.reset}):this.props.children}};function u({error:e}){let[t,n]=s.useState(!1);return(0,c.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,c.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,c.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,c.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,c.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,c.jsx)(`div`,{children:(0,c.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,c.jsx)(`code`,{children:e.message}):null})}):null]})}var d=()=>!0,f=()=>!1;function p({children:e,fallback:t=null}){return(0,c.jsx)(s.Fragment,{children:m()?e:t})}function m(e=!0){return s.useSyncExternalStore(h,d,e?f:d)}function h(){return()=>{}}function g(e){let t=r(),n=`not-found-${o(t.stores.location,e=>e.pathname)}-${o(t.stores.status)}`;return(0,c.jsx)(l,{getResetKey:()=>n,onCatch:(t,n)=>{if(a(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(a(t))return e.fallback?.(t);throw t},children:e.children})}function _(){return(0,c.jsx)(`p`,{children:`Not Found`})}function v(e,t,n){return t.options.notFoundComponent?(0,c.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,c.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,c.jsx)(_,{})}function y(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,c.jsx)(n,{}):null}var b=(e,t)=>e[0]===t[0]&&e[1]===t[1],x=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,S=s.memo(function({routeId:e}){let t=r(),n=t.stores.getMatchStore(e);return C(t,o(n))});function C(e,t){let n=e.routesById[t.routeId],r=y(e,n),o=n.options.errorComponent??e.options.defaultErrorComponent,u=n.options.onCatch??e.options.defaultOnCatch,d=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,f=t.ssr===!1||t.ssr===`data-only`,m=x(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||f)),h=(0,c.jsx)(w,{match:t});f&&(h=(0,c.jsx)(p,{fallback:r,children:h})),d&&(h=(0,c.jsx)(g,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return s.createElement(d,e)},children:h})),o&&(h=(0,c.jsx)(l,{getResetKey:()=>t,errorComponent:o,onCatch:(e,n)=>{if(a(e))throw e.routeId??=t.routeId,e;u?.(e,n)},children:h})),m&&(h=(0,c.jsx)(s.Suspense,{fallback:r,children:h}));let _=n.isRoot&&n.options.shellComponent;return _?(0,c.jsx)(i.Provider,{value:t.routeId,children:(0,c.jsxs)(_,{children:[h,null]})}):(0,c.jsxs)(i.Provider,{value:t.routeId,children:[h,null]})}var w=s.memo(function({match:e}){let t=r(),n=e.routeId,i=t.routesById[n],a=s.useMemo(()=>{let r=(i.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return r?JSON.stringify(r):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,i.options.remountDeps,t.options.defaultRemountDeps]),o=s.useMemo(()=>{let e=i.options.component??t.options.defaultComponent;return e?(0,c.jsx)(e,{},a):(0,c.jsx)(T,{})},[a,i.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!x(t,i,e.ssr))return o;if(t._tx)throw t._tx[5];return y(t,i)}if(e.status===`notFound`)return v(t,i,e.error);if(e.status===`error`)throw e.error;return o}),T=s.memo(function(){let e=r(),t=s.useContext(i),n,a,l;{let r=e.stores.getMatchStore(t);[n,a]=o(r,e=>[!!e._notFound,e.error],{compare:b}),l=o(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return v(e,e.routesById[t],a);if(!l)return null;let u=(0,c.jsx)(S,{routeId:l});return t===`__root__`?(0,c.jsx)(s.Suspense,{fallback:y(e),children:u}):u});export{l as i,T as n,y as r,S as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{a as t,i as n,n as r,o as i,t as a}from"./field-LSvWL6SU.js";import{n as o}from"./glass-aa3ISPbD.js";var s=t(),c={neutral:`bg-hover text-muted`,success:`bg-success/15 text-success-text`,danger:`bg-danger/15 text-danger-text`,warning:`border border-warning-line bg-warning-bg text-warning-text`};function l({tone:e,children:t}){return(0,s.jsx)(`span`,{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${c[e]}`,children:t})}var u={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};u.node;var d=o(u),f=e(i(),1);function p({title:e,icon:t,badge:n,defaultOpen:r=!1,open:i,onOpenChange:a,children:o}){let[c,l]=(0,f.useState)(r),u=i??c,p=()=>{l(!u),a?.(!u)},m=(0,f.useId)();return(0,s.jsxs)(`div`,{className:`rounded-base border border-line`,children:[(0,s.jsxs)(`button`,{type:`button`,"aria-expanded":u,"aria-controls":m,onClick:p,className:`flex w-full items-center gap-2 rounded-base px-3 py-2 text-left text-sm font-medium text-text hover:bg-hover focus-visible:outline-2 focus-visible:outline-focus`,children:[(0,s.jsx)(d,{size:15,strokeWidth:1.75,"aria-hidden":!0,className:`text-muted transition-transform duration-(--hb-duration) motion-reduce:transition-none ${u?`rotate-90`:``}`}),t,(0,s.jsx)(`span`,{children:e}),n!=null&&(0,s.jsx)(`span`,{className:`ml-auto`,children:n})]}),(0,s.jsx)(`div`,{id:m,hidden:!u,className:`border-t border-line p-3`,children:o})]})}function m({label:e,error:t,hint:i,...o}){let c=r({error:t,hint:i}),l=[c.aria[`aria-describedby`],o[`aria-describedby`]].filter(Boolean).join(` `)||void 0;return(0,s.jsx)(n,{...c,label:e,error:t,hint:i,children:(0,s.jsx)(`input`,{type:`number`,...o,...c.aria,"aria-invalid":c.aria[`aria-invalid`]??o[`aria-invalid`],"aria-describedby":l,className:a})})}export{l as i,p as n,d as r,m as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{a as t,o as n}from"./field-LSvWL6SU.js";import{t as r}from"./AuthCard-wJUv2Sdn.js";var i=e(n(),1),a=t();function o({success:e}){return(0,i.useEffect)(()=>{window.close()},[]),(0,a.jsx)(r,{title:`Sign in`,children:(0,a.jsx)(`p`,{role:e?`status`:`alert`,children:e?`Sign-in completed. You can close this window.`:`Sign-in failed. Close this window and try again.`})})}export{o as OAuth2RedirectPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./link-IcX1XVhI.js";import{a as n,o as r}from"./field-LSvWL6SU.js";var i=e(r(),1),a=n(),o=`https://github.com/emresandikci/heybe#readme`;function s({crumbs:e,actions:n,width:r=`form`,footer:s,children:c}){let l=`mx-auto w-full ${r===`form`?`max-w-240`:``}`;return(0,a.jsxs)(`div`,{className:`flex flex-1 flex-col gap-4`,children:[(0,a.jsxs)(`div`,{className:`${l} flex flex-1 flex-col gap-4`,children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2`,children:[(0,a.jsx)(`h1`,{className:`flex min-w-0 items-center text-lg font-semibold`,children:e.map((n,r)=>{let o=r===e.length-1;return(0,a.jsxs)(i.Fragment,{children:[r>0&&(0,a.jsx)(`span`,{className:`shrink-0 whitespace-pre text-faint`,children:` / `}),n.to&&!o?(0,a.jsx)(t,{to:n.to,params:n.params,className:`shrink-0 rounded-control text-muted hover:text-text`,children:n.label}):(0,a.jsx)(`span`,{"aria-current":o?`page`:void 0,title:o?n.label:void 0,className:o?`min-w-0 truncate`:`shrink-0 text-muted`,children:n.label})]},r)})}),n&&(0,a.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:n})]}),c]}),(0,a.jsxs)(`footer`,{className:`${l} flex flex-wrap items-center justify-between gap-x-4 gap-y-2 border-t border-line pt-3 text-xs text-faint`,children:[(0,a.jsx)(`div`,{children:s}),(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:`hover:text-text`,children:`Docs`}),(0,a.jsxs)(`span`,{children:[`Heybe v`,`1.6.1`]})]})]})]})}export{s as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{a as t,o as n}from"./field-LSvWL6SU.js";import{a as r,i,n as a,t as o}from"./glass-aa3ISPbD.js";import{a as s,i as c,n as l,r as u,t as d}from"./useTopLayer-Dh6x1Bza.js";import{t as f}from"./useOverlayState-C6tmr5St.js";var p={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};p.node;var m=a(p),h={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};h.node;var g=a(h),_=e(n(),1),v=e(r(),1),y=t();function b(e){let t=f(e),n=(0,_.useId)(),r=(0,_.useRef)(null),i=s(r,e.trigger.props.ref),a=(0,_.useRef)(null),o=(0,_.useRef)(t.open),p=d(r,a,t.open),m=l(r,a,{open:t.open,placement:e.placement});c(a,{open:t.open,onDismiss:t.close,triggerRef:r});let h=()=>{document.activeElement&&document.activeElement!==document.body||r.current?.focus()};(0,_.useEffect)(()=>{t.open?a.current?.focus():o.current&&queueMicrotask(h),o.current=t.open},[t.open]);let g=(0,_.cloneElement)(e.trigger,u(e.trigger.props,{ref:i,"aria-expanded":t.open,"aria-controls":t.open?n:void 0,"aria-haspopup":`dialog`,onClick:t.toggle}));return(0,y.jsxs)(y.Fragment,{children:[g,p&&(0,v.createPortal)((0,y.jsx)(`div`,{ref:a,id:n,role:`dialog`,popover:`manual`,"aria-label":e.label,tabIndex:-1,className:e.className,style:m.style,"data-open":``,"data-placement":m.placement,children:e.children}),p)]})}var x=i({base:`${o} z-50 rounded-base p-3 text-sm text-text outline-none`});function S({className:e,...t}){return(0,y.jsx)(b,{...t,className:x({className:e})})}export{g as n,m as r,S as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{a as t,o as n}from"./field-LSvWL6SU.js";import{r,s as i}from"./context-BLpmYnEM.js";import{t as a}from"./useForm-BJzA_-qG.js";import{r as o}from"./glass-aa3ISPbD.js";import{n as s,t as c}from"./NumberField-83x9ooVV.js";import{t as l}from"./Checkbox-qSXPT8qz.js";import{t as u}from"./CodeArea-D6AGlQG3.js";import{t as d}from"./TextField-IItAFjU7.js";import{t as f}from"./Select-DsX5Ea_q.js";import{c as p,n as m,s as h,t as g}from"./errors-BzXFkL79.js";var _=`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>`,v=`</title><path d="`,y=`"/></svg>`,b={title:`Apple`,slug:`apple`,get svg(){return _+`Apple`+v+this.path+y},path:`M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701`,source:`https://www.apple.com`,hex:`000000`},x={title:`Bitbucket`,slug:`bitbucket`,get svg(){return _+`Bitbucket`+v+this.path+y},path:`M.778 1.213a.768.768 0 00-.768.892l3.263 19.81c.084.5.515.868 1.022.873H19.95a.772.772 0 00.77-.646l3.27-20.03a.768.768 0 00-.768-.891zM14.52 15.53H9.522L8.17 8.466h7.561z`,source:`https://atlassian.design/resources/logo-library`,hex:`0052CC`,guidelines:`https://atlassian.design/foundations/logos`},S={title:`Box`,slug:`box`,get svg(){return _+`Box`+v+this.path+y},path:`M.959 5.523c-.54 0-.959.42-.959.899v7.549a4.59 4.59 0 004.613 4.494 4.717 4.717 0 004.135-2.457c.779 1.438 2.337 2.457 4.074 2.457 2.577 0 4.674-2.037 4.674-4.613.06-2.457-2.037-4.495-4.613-4.495-1.738 0-3.295.959-4.074 2.397-.78-1.438-2.338-2.397-4.135-2.397-1.079 0-2.038.36-2.817.899V6.422a.92.92 0 00-.898-.899zM17.602 9.26a.95.95 0 00-.704.158c-.36.3-.479.899-.18 1.318l2.397 3.116-2.396 3.115c-.3.42-.24.96.18 1.26.419.3 1.016.298 1.316-.122l2.039-2.636 2.096 2.697c.3.36.899.419 1.318.12.36-.3.42-.84.121-1.259l-2.338-3.115 2.338-3.057c.3-.419.298-1.018-.121-1.318-.48-.3-1.019-.24-1.318.18l-2.096 2.576-2.04-2.695c-.149-.18-.373-.3-.612-.338zM4.613 11.154c1.558 0 2.817 1.26 2.817 2.758 0 1.558-1.259 2.756-2.817 2.756-1.558 0-2.816-1.198-2.816-2.756 0-1.498 1.258-2.758 2.816-2.758zm8.27 0c1.558 0 2.816 1.26 2.816 2.758-.06 1.558-1.318 2.756-2.816 2.756-1.558 0-2.817-1.198-2.817-2.756 0-1.498 1.259-2.758 2.817-2.758Z`,source:`https://www.box.com/en-gb/about-us/press`,hex:`0061D5`,guidelines:`https://www.box.com/en-gb/about-us/press`},C={title:`Discord`,slug:`discord`,get svg(){return _+`Discord`+v+this.path+y},path:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z`,source:`https://discord.com/branding`,hex:`5865F2`,guidelines:`https://discord.com/branding`},w={title:`Facebook`,slug:`facebook`,get svg(){return _+`Facebook`+v+this.path+y},path:`M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z`,source:`https://about.meta.com/brand/resources/facebook/logo`,hex:`0866FF`,guidelines:`https://about.meta.com/brand/resources/facebook/logo`},T={title:`Gitea`,slug:`gitea`,get svg(){return _+`Gitea`+v+this.path+y},path:`M4.209 4.603c-.247 0-.525.02-.84.088-.333.07-1.28.283-2.054 1.027C-.403 7.25.035 9.685.089 10.052c.065.446.263 1.687 1.21 2.768 1.749 2.141 5.513 2.092 5.513 2.092s.462 1.103 1.168 2.119c.955 1.263 1.936 2.248 2.89 2.367 2.406 0 7.212-.004 7.212-.004s.458.004 1.08-.394c.535-.324 1.013-.893 1.013-.893s.492-.527 1.18-1.73c.21-.37.385-.729.538-1.068 0 0 2.107-4.471 2.107-8.823-.042-1.318-.367-1.55-.443-1.627-.156-.156-.366-.153-.366-.153s-4.475.252-6.792.306c-.508.011-1.012.023-1.512.027v4.474l-.634-.301c0-1.39-.004-4.17-.004-4.17-1.107.016-3.405-.084-3.405-.084s-5.399-.27-5.987-.324c-.187-.011-.401-.032-.648-.032zm.354 1.832h.111s.271 2.269.6 3.597C5.549 11.147 6.22 13 6.22 13s-.996-.119-1.641-.348c-.99-.324-1.409-.714-1.409-.714s-.73-.511-1.096-1.52C1.444 8.73 2.021 7.7 2.021 7.7s.32-.859 1.47-1.145c.395-.106.863-.12 1.072-.12zm8.33 2.554c.26.003.509.127.509.127l.868.422-.529 1.075a.686.686 0 0 0-.614.359.685.685 0 0 0 .072.756l-.939 1.924a.69.69 0 0 0-.66.527.687.687 0 0 0 .347.763.686.686 0 0 0 .867-.206.688.688 0 0 0-.069-.882l.916-1.874a.667.667 0 0 0 .237-.02.657.657 0 0 0 .271-.137 8.826 8.826 0 0 1 1.016.512.761.761 0 0 1 .286.282c.073.21-.073.569-.073.569-.087.29-.702 1.55-.702 1.55a.692.692 0 0 0-.676.477.681.681 0 1 0 1.157-.252c.073-.141.141-.282.214-.431.19-.397.515-1.16.515-1.16.035-.066.218-.394.103-.814-.095-.435-.48-.638-.48-.638-.467-.301-1.116-.58-1.116-.58s0-.156-.042-.27a.688.688 0 0 0-.148-.241l.516-1.062 2.89 1.401s.48.218.583.619c.073.282-.019.534-.069.657-.24.587-2.1 4.317-2.1 4.317s-.232.554-.748.588a1.065 1.065 0 0 1-.393-.045l-.202-.08-4.31-2.1s-.417-.218-.49-.596c-.083-.31.104-.691.104-.691l2.073-4.272s.183-.37.466-.497a.855.855 0 0 1 .35-.077z`,source:`https://github.com/go-gitea/gitea/blob/e0c753e770a64cda5e3900aa1da3d7e1f3263c9a/assets/logo.svg`,hex:`609926`},ee={title:`Gitee`,slug:`gitee`,get svg(){return _+`Gitee`+v+this.path+y},path:`M11.984 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.016 0zm6.09 5.333c.328 0 .593.266.592.593v1.482a.594.594 0 0 1-.593.592H9.777c-.982 0-1.778.796-1.778 1.778v5.63c0 .327.266.592.593.592h5.63c.982 0 1.778-.796 1.778-1.778v-.296a.593.593 0 0 0-.592-.593h-4.15a.592.592 0 0 1-.592-.592v-1.482a.593.593 0 0 1 .593-.592h6.815c.327 0 .593.265.593.592v3.408a4 4 0 0 1-4 4H5.926a.593.593 0 0 1-.593-.593V9.778a4.444 4.444 0 0 1 4.445-4.444h8.296Z`,source:`https://gitee.com/about_us`,hex:`C71D23`},te={title:`GitHub`,slug:`github`,get svg(){return _+`GitHub`+v+this.path+y},path:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`,source:`https://github.com/logos`,hex:`181717`,guidelines:`https://github.com/logos`},ne={title:`GitLab`,slug:`gitlab`,get svg(){return _+`GitLab`+v+this.path+y},path:`m23.6004 9.5927-.0337-.0862L20.3.9814a.851.851 0 0 0-.3362-.405.8748.8748 0 0 0-.9997.0539.8748.8748 0 0 0-.29.4399l-2.2055 6.748H7.5375l-2.2057-6.748a.8573.8573 0 0 0-.29-.4412.8748.8748 0 0 0-.9997-.0537.8585.8585 0 0 0-.3362.4049L.4332 9.5015l-.0325.0862a6.0657 6.0657 0 0 0 2.0119 7.0105l.0113.0087.03.0213 4.976 3.7264 2.462 1.8633 1.4995 1.1321a1.0085 1.0085 0 0 0 1.2197 0l1.4995-1.1321 2.4619-1.8633 5.006-3.7489.0125-.01a6.0682 6.0682 0 0 0 2.0094-7.003z`,source:`https://about.gitlab.com/press/press-kit/`,hex:`FC6D26`,guidelines:`https://about.gitlab.com/handbook/marketing/corporate-marketing/brand-activation/trademark-guidelines/`},E={title:`Google`,slug:`google`,get svg(){return _+`Google`+v+this.path+y},path:`M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z`,source:`https://partnermarketinghub.withgoogle.com`,hex:`4285F4`,guidelines:`https://about.google/brand-resource-center/brand-elements/`},D={title:`Instagram`,slug:`instagram`,get svg(){return _+`Instagram`+v+this.path+y},path:`M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077`,source:`https://about.meta.com/brand/resources/instagram`,hex:`FF0069`,guidelines:`https://about.meta.com/brand/resources/instagram`},O={title:`KakaoTalk`,slug:`kakaotalk`,get svg(){return _+`KakaoTalk`+v+this.path+y},path:`M22.125 0H1.875C.8394 0 0 .8394 0 1.875v20.25C0 23.1606.8394 24 1.875 24h20.25C23.1606 24 24 23.1606 24 22.125V1.875C24 .8394 23.1606 0 22.125 0zM12 18.75c-.591 0-1.1697-.0413-1.7317-.1209-.5626.3965-3.813 2.6797-4.1198 2.7225 0 0-.1258.0489-.2328-.0141s-.0876-.2282-.0876-.2282c.0322-.2198.8426-3.0183.992-3.5333-2.7452-1.36-4.5701-3.7686-4.5701-6.5135C2.25 6.8168 6.6152 3.375 12 3.375s9.75 3.4418 9.75 7.6875c0 4.2457-4.3652 7.6875-9.75 7.6875zM8.0496 9.8672h-.8777v3.3417c0 .2963-.2523.5372-.5625.5372s-.5625-.2409-.5625-.5372V9.8672h-.8777c-.3044 0-.552-.2471-.552-.5508s.2477-.5508.552-.5508h2.8804c.3044 0 .552.2471.552.5508s-.2477.5508-.552.5508zm10.9879 2.9566a.558.558 0 0 1 .108.4167.5588.5588 0 0 1-.2183.371.5572.5572 0 0 1-.3383.1135.558.558 0 0 1-.4493-.2236l-1.3192-1.7479-.1952.1952v1.2273a.5635.5635 0 0 1-.5627.5628.563.563 0 0 1-.5625-.5625V9.3281c0-.3102.2523-.5625.5625-.5625s.5625.2523.5625.5625v1.209l1.5694-1.5694c.0807-.0807.1916-.1252.312-.1252.1404 0 .2814.0606.3871.1661.0985.0984.1573.2251.1654.3566.0082.1327-.036.2542-.1241.3425l-1.2818 1.2817 1.3845 1.8344zm-8.3502-3.5023c-.095-.2699-.3829-.5475-.7503-.5557-.3663.0083-.6542.2858-.749.5551l-1.3455 3.5415c-.1708.5305-.0217.7272.1333.7988a.8568.8568 0 0 0 .3576.0776c.2346 0 .4139-.0952.4678-.2481l.2787-.7297 1.7152.0001.2785.7292c.0541.1532.2335.2484.4681.2484a.8601.8601 0 0 0 .3576-.0775c.1551-.0713.3041-.2681.1329-.7999l-1.3449-3.5398zm-1.3116 2.4433l.5618-1.5961.5618 1.5961H9.3757zm5.9056 1.3836c0 .2843-.2418.5156-.5391.5156h-1.8047c-.2973 0-.5391-.2314-.5391-.5156V9.3281c0-.3102.2576-.5625.5742-.5625s.5742.2523.5742.5625v3.3047h1.1953c.2974 0 .5392.2314.5392.5156z`,source:`https://commons.wikimedia.org/wiki/File:KakaoTalk_logo.svg`,hex:`FFCD00`},k={title:`Linear`,slug:`linear`,get svg(){return _+`Linear`+v+this.path+y},path:`M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z`,source:`https://linear.app`,hex:`5E6AD2`},A={title:`LiveChat`,slug:`livechat`,get svg(){return _+`LiveChat`+v+this.path+y},path:`M23.849 14.91c-.24 2.94-2.73 5.22-5.7 5.19h-3.15l-6 3.9v-3.9l6-3.9h3.15c.93.03 1.71-.66 1.83-1.59.18-3 .18-6-.06-9-.06-.84-.75-1.47-1.56-1.53-2.04-.09-4.2-.18-6.36-.18s-4.32.06-6.36.21c-.84.06-1.5.69-1.56 1.53-.21 3-.24 6-.06 9 .09.93.9 1.59 1.83 1.56h3.15v3.9h-3.15a5.644 5.644 0 01-5.7-5.19c-.21-3.21-.18-6.39.06-9.6a5.57 5.57 0 015.19-5.1c2.1-.15 4.35-.21 6.6-.21s4.5.06 6.63.24a5.57 5.57 0 015.19 5.1c.21 3.18.24 6.39.03 9.57z`,source:`https://livechat.design`,hex:`FF5100`,guidelines:`https://livechat.design`},j={title:`Notion`,slug:`notion`,get svg(){return _+`Notion`+v+this.path+y},path:`M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z`,source:`https://www.notion.so`,hex:`000000`},M={title:`OpenID`,slug:`openid`,get svg(){return _+`OpenID`+v+this.path+y},path:`M14.54.889l-3.63 1.773v18.17c-4.15-.52-7.27-2.78-7.27-5.5 0-2.58 2.8-4.75 6.63-5.41v-2.31C4.42 8.322 0 11.502 0 15.332c0 3.96 4.74 7.24 10.91 7.78l3.63-1.71V.888m.64 6.724v2.31c1.43.25 2.71.7 3.76 1.31l-1.97 1.11 7.03 1.53-.5-5.21-1.87 1.06c-1.74-1.06-3.96-1.81-6.45-2.11z`,source:`https://openid.net/add-openid/logos/`,hex:`F78C40`},N={title:`Patreon`,slug:`patreon`,get svg(){return _+`Patreon`+v+this.path+y},path:`M22.957 7.21c-.004-3.064-2.391-5.576-5.191-6.482-3.478-1.125-8.064-.962-11.384.604C2.357 3.231 1.093 7.391 1.046 11.54c-.039 3.411.302 12.396 5.369 12.46 3.765.047 4.326-4.804 6.068-7.141 1.24-1.662 2.836-2.132 4.801-2.618 3.376-.836 5.678-3.501 5.673-7.031Z`,source:`https://www.patreon.com/brand`,hex:`000000`,guidelines:`https://www.patreon.com/brand`},P={title:`Spotify`,slug:`spotify`,get svg(){return _+`Spotify`+v+this.path+y},path:`M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z`,source:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`,hex:`1ED760`,guidelines:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`},F={title:`Strava`,slug:`strava`,get svg(){return _+`Strava`+v+this.path+y},path:`M15.387 17.944l-2.089-4.116h-3.065L15.387 24l5.15-10.172h-3.066m-7.008-5.599l2.836 5.598h4.172L10.463 0l-7 13.828h4.169`,source:`https://itunes.apple.com/us/app/strava-running-and-cycling-gps/id426826309`,hex:`FC4C02`},I={title:`Trakt`,slug:`trakt`,get svg(){return _+`Trakt`+v+this.path+y},path:`m15.082 15.107-.73-.73 9.578-9.583a4.499 4.499 0 0 0-.115-.575L13.662 14.382l1.08 1.08-.73.73-1.81-1.81L23.422 3.144c-.075-.15-.155-.3-.25-.44L11.508 14.377l2.154 2.155-.73.73-7.193-7.199.73-.73 4.309 4.31L22.546 1.86A5.618 5.618 0 0 0 18.362 0H5.635A5.637 5.637 0 0 0 0 5.634V18.37A5.632 5.632 0 0 0 5.635 24h12.732C21.477 24 24 21.48 24 18.37V6.19l-8.913 8.918zm-4.314-2.155L6.814 8.988l.73-.73 3.954 3.96zm1.075-1.084-3.954-3.96.73-.73 3.959 3.96zm9.853 5.688a4.141 4.141 0 0 1-4.14 4.14H6.438a4.144 4.144 0 0 1-4.139-4.14V6.438A4.141 4.141 0 0 1 6.44 2.3h10.387v1.04H6.438c-1.71 0-3.099 1.39-3.099 3.1V17.55c0 1.71 1.39 3.105 3.1 3.105h11.117c1.71 0 3.1-1.395 3.1-3.105v-1.754h1.04v1.754z`,source:`https://trakt.tv/branding`,hex:`9F42C6`,guidelines:`https://trakt.tv/branding`},L={title:`Twitch`,slug:`twitch`,get svg(){return _+`Twitch`+v+this.path+y},path:`M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z`,source:`https://brand.twitch.tv`,hex:`9146FF`,guidelines:`https://brand.twitch.tv`},R={title:`VK`,slug:`vk`,get svg(){return _+`VK`+v+this.path+y},path:`m9.489.004.729-.003h3.564l.73.003.914.01.433.007.418.011.403.014.388.016.374.021.36.025.345.03.333.033c1.74.196 2.933.616 3.833 1.516.9.9 1.32 2.092 1.516 3.833l.034.333.029.346.025.36.02.373.025.588.012.41.013.644.009.915.004.98-.001 3.313-.003.73-.01.914-.007.433-.011.418-.014.403-.016.388-.021.374-.025.36-.03.345-.033.333c-.196 1.74-.616 2.933-1.516 3.833-.9.9-2.092 1.32-3.833 1.516l-.333.034-.346.029-.36.025-.373.02-.588.025-.41.012-.644.013-.915.009-.98.004-3.313-.001-.73-.003-.914-.01-.433-.007-.418-.011-.403-.014-.388-.016-.374-.021-.36-.025-.345-.03-.333-.033c-1.74-.196-2.933-.616-3.833-1.516-.9-.9-1.32-2.092-1.516-3.833l-.034-.333-.029-.346-.025-.36-.02-.373-.025-.588-.012-.41-.013-.644-.009-.915-.004-.98.001-3.313.003-.73.01-.914.007-.433.011-.418.014-.403.016-.388.021-.374.025-.36.03-.345.033-.333c.196-1.74.616-2.933 1.516-3.833.9-.9 2.092-1.32 3.833-1.516l.333-.034.346-.029.36-.025.373-.02.588-.025.41-.012.644-.013.915-.009ZM6.79 7.3H4.05c.13 6.24 3.25 9.99 8.72 9.99h.31v-3.57c2.01.2 3.53 1.67 4.14 3.57h2.84c-.78-2.84-2.83-4.41-4.11-5.01 1.28-.74 3.08-2.54 3.51-4.98h-2.58c-.56 1.98-2.22 3.78-3.8 3.95V7.3H10.5v6.92c-1.6-.4-3.62-2.34-3.71-6.92Z`,source:`https://vk.com/brand`,hex:`0077FF`,guidelines:`https://vk.com/brand`},z={title:`WakaTime`,slug:`wakatime`,get svg(){return _+`WakaTime`+v+this.path+y},path:`M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm0 2.824a9.176 9.176 0 1 1 0 18.352 9.176 9.176 0 0 1 0-18.352zm5.097 5.058c-.327 0-.61.19-.764.45-1.025 1.463-2.21 3.162-3.288 4.706l-.387-.636a.897.897 0 0 0-.759-.439.901.901 0 0 0-.788.492l-.357.581-1.992-2.943a.897.897 0 0 0-.761-.446c-.514 0-.903.452-.903.96a1 1 0 0 0 .207.61l2.719 3.96c.152.272.44.47.776.47a.91.91 0 0 0 .787-.483c.046-.071.23-.368.314-.504l.324.52c-.035-.047.076.113.087.13.024.031.054.059.078.085.019.019.04.036.058.052.036.033.08.056.115.08.025.016.052.028.076.04.029.015.06.024.088.035.058.025.122.027.18.04.031.004.064.003.092.005.29 0 .546-.149.707-.36 1.4-2 2.842-4.055 4.099-5.849A.995.995 0 0 0 18 8.842c0-.508-.389-.96-.903-.96`,source:`https://wakatime.com/legal/logos-and-trademark-usage`,hex:`000000`,guidelines:`https://wakatime.com/legal/logos-and-trademark-usage`},B={title:`X`,slug:`x`,get svg(){return _+`X`+v+this.path+y},path:`M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z`,source:`https://x.com`,hex:`000000`,guidelines:`https://about.x.com/en/who-we-are/brand-toolkit`},V=(e,t,n,r)=>({d:`M${e} ${t}h${n}v${n}H${e}z`,fill:r}),re={apple:b,bitbucket:x,box:S,discord:C,facebook:w,gitea:T,gitee:ee,github:te,gitlab:ne,google:E,instagram2:D,linear:k,livechat:A,notion:j,oidc:M,oidc2:M,oidc3:M,patreon:N,spotify:P,strava:F,trakt:I,twitch:L,twitter:B,vk:R,wakatime:z,microsoft:{viewBox:`0 0 256 256`,shapes:[V(0,0,121.666,`#F1511B`),V(134.335,0,121.665,`#80CC28`),V(0,134.336,121.666,`#00ADEF`),V(134.335,134.336,121.666,`#FBBC09`)]},monday:{viewBox:`0 0 256 156`,shapes:[{d:`M31.846 153.489a31.97 31.97 0 0 1-27.86-16.167a30.91 30.91 0 0 1 .875-31.823l57.373-90.096A31.99 31.99 0 0 1 90.556.015a31.93 31.93 0 0 1 27.41 16.896c5.349 10.113 4.68 22.28-1.725 31.774L58.904 138.78a31.98 31.98 0 0 1-27.058 14.709`,fill:`#f62b54`},{d:`M130.256 153.488c-11.572 0-22.22-6.187-27.812-16.13a30.81 30.81 0 0 1 .875-31.737l57.264-89.89A31.94 31.94 0 0 1 188.93.016c11.669.255 22.244 6.782 27.592 16.993a30.81 30.81 0 0 1-2.066 31.92l-57.252 89.889a31.93 31.93 0 0 1-26.948 14.671`,fill:`#fc0`},{d:`M226.466 96.406a29.538 28.918 0 1 0 0 57.836a29.538 28.918 0 0 0 0-57.836z`,fill:`#00ca72`}]},yandex:{viewBox:`0 0 24 24`,shapes:[{d:`M16.376 12.644L21 2h-3.842l-4.624 10.644h3.842zM13.915 24v-3.733c0-2.822-.352-3.64-1.407-5.988L6.933 2H3l7.124 15.709V24h3.79z`,fill:`#FC3F1D`,fillRule:`evenodd`}]},kakao:{viewBox:`0 0 24 24`,shapes:[{d:`M22.125 0H1.875C.8394 0 0 .8394 0 1.875v20.25C0 23.1606.8394 24 1.875 24h20.25C23.1606 24 24 23.1606 24 22.125V1.875C24 .8394 23.1606 0 22.125 0z`,fill:`#191919`},{d:O.path,fill:`#FFCD00`}]},lark:{viewBox:`0 0 1024 1024`,shapes:[{d:`M512 0a512 512 0 1 0 0 1024A512 512 0 0 0 512 0z`,fill:`#3370ff`},{d:`M452.66 735.98c129.21-.05 240.96-73.62 296.01-181.49-28.47 55.36-88.93 81.63-149.06 66.88-34.65-8.89-68.49-21.04-101.43-34.95-88.52-38.05-168.71-94.13-234.5-164.53-2.65-2.92-7.95-.95-7.87 3.1l.14 213.29v17.31c0 10.06 4.96 19.44 13.3 25.03a328.727 328.727 0 0 0 183.41 55.37v-.02Zm89.96-222.18-.08.08a705.434 705.434 0 0 0-194.67-217.69 4.554 4.554 0 0 1 2.71-8.21h241.67c9.13 0 17.78 4.13 23.52 11.24a330.672 330.672 0 0 1 59.66 114.96c-30.57 9.47-58.51 25.96-80.81 48.28-7.65 7.52-15.59 15.38-23.27 23-8.6 8.53-17.5 17.35-26.05 25.72l-.07.07-.07.07c-.83.84-1.68 1.67-2.54 2.48Zm-55.3 55.67c22.18-13.01 42.79-28.57 61.47-46.28l1.38-1.38c.96-.9 1.9-1.83 2.83-2.77 16.22-15.89 33.15-32.84 49.36-48.76 53.08-53.16 136.95-68.88 205.83-40.1l-7.52 8.74c-12.15 14.11-22.3 29.94-30.16 47.04l-6.3 12.56c-8.01 15.97-24.68 49.19-25.58 50.92-8.74 16.48-20.4 30.55-33.74 40.68l-.13.1c-1.85 1.45-3.84 2.81-5.96 4.26-18.58 12.7-42.04 19.7-66.07 19.7-7.53 0-15.09-.68-22.47-2.02-2.72-.54-5.29-1.04-7.85-1.66-22.19-5.75-45.25-13.11-68.54-21.88-10.76-4.05-22.21-8.68-34.06-13.76l-12.5-5.38Z`,fill:`#ffffff`}]},mailcow:{viewBox:`0 0 1024 1024`,shapes:[{d:`M512 0a512 512 0 1 0 0 1024A512 512 0 0 0 512 0z`,fill:`#b58765`},{d:`M889.1 606.6s-13.8 81.8-57.6 81.1c-14.1.6-24-3.5-30.7-8.3-10.1 10.7-23.3 19.9-36.5 27.6l-.1.1c-10.8 6.2-21.5 11.3-30.3 15.2-3.1 1.3-5.9 2.5-8.4 3.5v-43.9c6.4.2 12.3-.1 17.8-1 22.6-3.5 37.6-14.7 43.7-20.1-4.3-13.2-10.9-52 55-58.1-2.7.6-9.3 3.5-15.1 18.3 19.5 1.6 51.5 4.4 62.2-14.4zm-242.4-16.1c-.5.5-1 1-1.4 1.3l-.7.6c-13.8 13.3-29.3 24.5-46.2 33.4-3.4 1.8-6.9 3.5-10.4 5-1.7.8-3.5 1.6-5.3 2.3-3.6 1.5-7.2 2.9-10.9 4.1-.5.2-1 .3-1.4.5L719.3 763c.9-2.8 1.4-5.7 1.4-8.6V479.2L700 495.8c-8.4 35.4-26.6 67.9-52.5 93.9l-.8.8zM563.8 640c-18.6 5.6-37.9 8.5-57.4 8.5-21.1 0-42-3.3-62-9.9L290.6 766.8l-2.2 1.7c5 8.5 14.1 13.8 24 13.8h380.4c9.9 0 19-5.3 24-13.8l-2.1-1.6L563.8 640zM316.1 507.8c-.5-1.5-.9-3.1-1.4-4.7l-30.2-24v275.2c0 2.9.5 5.8 1.4 8.6l152-126.7c-58.2-21.3-103.7-69.1-121.8-128.4zm388.2-36.7c-.6 5.3-1.4 10.6-2.5 15.9l14.1-11.3-11.6-4.6zm-414.6 4.2 22.5 17.9c-1.8-7.9-3.1-15.8-3.9-23.6l-18.6 5.7zm385.6-119.6c15.8 28.5 24.2 60.9 24.2 93.6 0 51.1-19.7 99.1-55.5 135.5-.6.6-2.1 2.2-2.8 2.8l-.6.6c-13.4 12.9-28.5 23.8-44.9 32.4-3.3 1.7-6.7 3.4-10.1 4.9-1.7.8-3.4 1.5-5.2 2.2-3.4 1.4-7 2.8-10.5 4-1.7.6-3.6 1.2-5.4 1.8-18.8 5.9-38.3 8.9-58.2 8.9-21.4 0-42.5-3.5-62.7-10.4-58.3-20-103.9-67.1-122-126-3.8-12.4-6.4-25.4-7.6-38.4-.6-6.1-.9-12.3-.9-18.3 0-6.6.3-13.2 1-19.8 2.5-24.8 9.7-48.5 21.4-70.5 2.2-4.1 4.5-8.1 6.9-12 5.9-9.4 12.6-18.3 19.9-26.5l.4-.4.7-.8c2.7-3 5.6-5.9 8.4-8.7 9-8.7 18.9-16.6 29.4-23.4 7-4.6 14.4-8.7 22-12.3 17.7-8.4 36.5-14.1 55.9-16.8 17-2.4 34.3-2.5 51.3-.4 18.9 2.4 37.3 7.5 54.7 15.3 7.4 3.3 14.6 7.1 21.4 11.3 11 6.7 21.4 14.6 30.9 23.4 11.5 10.7 21.7 22.7 30.3 35.8 2.8 3.9 5.3 8 7.6 12.2zm-32 89.7c0-80.5-59-148.5-137.1-158.2-6.3-.8-12.7-1.2-19.1-1.2-29.7 0-58.7 8.6-83.6 24.8-24.3 15.8-43.9 38-56.6 64.3-10.6 22-16 45.7-16 70.3 0 40.7 15 79.5 42.4 109.1 29.9 32.4 70.3 50.3 113.9 50.3 55.7 0 107.6-30.7 135.5-80 5.9-10.5 10.7-21.7 14.1-33.4 4.2-14.9 6.5-30.4 6.5-46zm48.9 11.9h2.2v-.1h-2.2v.1zm-77.8 63.6 1.7 3.1c-27.1 46.2-76.5 74.9-129.1 74.9-41.4 0-79.9-16.8-108.5-47.3v-4.2l.8-.3-.8-.9c1.9-41.9 56.4-75.9 121.8-75.9 50.4 0 96.2 20.4 114.1 50.6zm-170.3 14.8c0-10.7-8.7-19.3-19.3-19.3-10.6 0-19.3 8.7-19.3 19.3 0 10.7 8.7 19.3 19.3 19.3 10.7 0 19.3-8.7 19.3-19.3zm151.6 0c0-10.7-8.7-19.3-19.3-19.3-10.7 0-19.3 8.7-19.3 19.3 0 10.7 8.7 19.3 19.3 19.3 10.6 0 19.3-8.7 19.3-19.3zM487 291.9v-1.1 1.1c6.1 0 12.3.4 18.4 1.1 75.2 9.4 132 74.9 132 152.4 0 15.1-2.2 30-6.4 44.5v.1c-.5 1.7-1.1 3.6-1.8 5.8l-.5 1.4c-.7 1.9-1.4 3.8-2.1 5.6l-.5 1.2c-.7 1.7-1.4 3.4-2.1 5l-.4 1c-.8 1.7-1.6 3.5-2.6 5.4-.4.9-.9 1.8-1.4 2.7-19-32.1-66.5-53.6-119.1-53.6-33.9 0-65.8 8.6-89.9 24.3-22.9 14.9-36.1 34.5-37.7 55.5-1.2-4.1-2.1-8.3-2.7-12.3 0-.3-.1-.7-.2-1-.1-.3-.1-.6-.2-1-8.6-37.9-14.6-66.3-21.7-107.8-.8-6.6-1.2-12.3-1.4-17.9 0-.8-.1-1.6-.1-2.4-.1-1.4-.1-2.8-.1-4.3 0-2.2.1-4.5.3-7.3 1.3-3.5 2.8-7 4.4-10.4l1.1-2.3.1-.3 1.2-2.4.6-1.2c.2-.4.3-.7.5-1 .1-.2.2-.3.3-.5l.2-.4c12.2-22.7 30-42.1 51.4-56 24-15.7 51.8-23.9 80.4-23.9zm-34.8 104.9c0-11.9-9.6-21.5-21.5-21.5s-21.5 9.6-21.5 21.5 9.6 21.5 21.5 21.5c5.7 0 11.1-2.2 15.2-6.3 4-4 6.3-9.4 6.3-15.2zm105.4 0c0 11.9 9.6 21.5 21.5 21.5s21.5-9.6 21.5-21.5-9.7-21.5-21.5-21.5-21.5 9.7-21.5 21.5zm27.8 1.4c4.1 0 7.5-3.3 7.5-7.5 0-4.1-3.4-7.5-7.5-7.5s-7.5 3.4-7.5 7.5c0 4.2 3.3 7.5 7.5 7.5zm-147.1 0c4.1 0 7.5-3.3 7.5-7.5 0-4.1-3.3-7.5-7.5-7.5-4.1 0-7.5 3.4-7.5 7.5 0 4.2 3.3 7.5 7.5 7.5zm146.4-189.6c-3 6.5-16.4 33-40.4 44.6 14.9 2.9 29.4 7.4 43.1 13.5 6.4-11.8 17.4-38.7-2.7-58.1zm-163.9 60.1c13.9-6.6 28.6-11.6 43.7-14.8-25.1-11.1-39-38.7-42.1-45.4-20.9 20.3-8.6 48.1-1.6 60.2zm191.3 11c10.7 6.7 20.8 14.4 30 22.9l.1.1c14.1-9.1 35.8-18.6 59.7-12.8l1 .2-.1 1c0 .3-4 27.3-29 49 2.3 3.5 4.5 7.1 6.6 10.8 28.2-20.2 40.6-48.3 37-83.5-6.8-2.4-67.8-24-105.3 12.3zm-284.6-20.6c-19.9 1.4-36.2 7.2-39.5 8.5-3.9 37.5 10.4 66.8 42.4 87.1 1.9-3.6 4-7.1 6.1-10.5-29.3-22.2-33.8-52.7-33.9-53l-.1-1 1-.2c25.8-6.2 48.9 5 64 15.7 8.8-8.5 18.4-16.2 28.6-23-20.3-22-48.4-25-68.6-23.6z`,fill:`#ffffff`}]},planningcenter:{viewBox:`0 0 1024 1024`,shapes:[{d:`M512 0a512 512 0 1 0 0 1024A512 512 0 0 0 512 0z`,fill:`#2265f7`},{d:`M510.93 250.26c-14.18 0-28.57 2.12-42.95 6.35l-155.74 47.4c-35.55 11.85-59.25 44.01-59.25 81.25v253.92c0 37.24 23.7 69.4 59.25 81.25l157.43 47.4c27.08 8.46 55.86 8.46 84.64 0l157.43-47.4c35.55-11.85 59.25-44.01 59.25-81.25V385.26c-1.69-37.24-27.08-69.4-60.94-81.25l-157.43-47.4a139.3 139.3 0 0 0-41.68-6.35Zm102.93 150.3c15.7-.26 30.17 13.26 30.17 30.4v130.35c0 10.16-6.77 18.62-15.23 22.01l-104.95 32.16c-8.46 3.39-18.62 3.39-27.09 0l-67.71-20.31s-1.69 0-1.69 1.69v50.78c0 5.08-5.08 8.46-10.16 6.77l-35.55-10.16c-3.38-1.69-5.08-5.08-5.08-8.46V429.27c0-18.62 18.62-32.16 37.24-27.08l91.41 27.08c3.39 1.69 6.77 0 8.46 0l91.41-27.08c2.81-1.03 5.77-1.58 8.77-1.63Zm-179.74 55.8c-1.69 0-5.08 1.69-5.08 3.39v76.17c0 1.69 1.69 3.39 3.39 5.08l72.79 22c3.39 1.69 8.46 1.69 11.85 0l72.79-22.01c1.69 0 3.38-1.69 3.38-5.08v-74.48c0-1.69-1.69-3.39-5.08-3.39l-59.25 16.93c-11.85 3.39-23.7 3.39-35.55 0l-59.25-18.62Z`,fill:`#ffffff`}]}},H=t(),U=`#ffffff`,W=`#121216`;function G(e){let[t,n,r]=[0,2,4].map(t=>{let n=parseInt(e.slice(t,t+2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function K(e,t){let[n,r]=[G(e),G(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}function q({name:e,displayName:t}){let n=re[e],r=`flex size-8 shrink-0 items-center justify-center rounded-control bg-hover`;if(!n)return(0,H.jsx)(`span`,{"data-testid":`monogram`,"aria-hidden":`true`,className:`${r} text-sm font-semibold text-text`,children:t.charAt(0).toUpperCase()});if(`shapes`in n)return(0,H.jsx)(`span`,{"aria-hidden":`true`,className:r,children:(0,H.jsx)(`svg`,{viewBox:n.viewBox,className:`size-[18px]`,children:n.shapes.map(e=>(0,H.jsx)(`path`,{d:e.d,fill:e.fill,fillRule:e.fillRule},e.d))})});let i=K(n.hex,U)>=3,a=K(n.hex,W)>=3;return(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`${r} ${i?`text-[var(--brand)]`:`text-text`} ${a?`dark:text-[var(--brand)]`:`dark:text-text`}`,style:{"--brand":`#${n.hex}`},children:(0,H.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`size-[18px]`,fill:`currentColor`,children:(0,H.jsx)(`path`,{d:n.path})})})}var J=e(n(),1),Y=[{name:`apple`,displayName:`Apple`,needsURLs:!1},{name:`google`,displayName:`Google`,needsURLs:!1},{name:`microsoft`,displayName:`Microsoft`,needsURLs:!1},{name:`yandex`,displayName:`Yandex`,needsURLs:!1},{name:`facebook`,displayName:`Facebook`,needsURLs:!1},{name:`instagram2`,displayName:`Instagram`,needsURLs:!1},{name:`github`,displayName:`GitHub`,needsURLs:!1},{name:`gitlab`,displayName:`GitLab`,needsURLs:!1},{name:`bitbucket`,displayName:`Bitbucket`,needsURLs:!1},{name:`gitee`,displayName:`Gitee`,needsURLs:!1},{name:`gitea`,displayName:`Gitea/Forgejo`,needsURLs:!1},{name:`discord`,displayName:`Discord`,needsURLs:!1},{name:`twitter`,displayName:`X/Twitter`,needsURLs:!1},{name:`kakao`,displayName:`Kakao`,needsURLs:!1},{name:`vk`,displayName:`ВКонтакте`,needsURLs:!1},{name:`linear`,displayName:`Linear`,needsURLs:!1},{name:`notion`,displayName:`Notion`,needsURLs:!1},{name:`monday`,displayName:`monday.com`,needsURLs:!1},{name:`lark`,displayName:`Lark`,needsURLs:!1},{name:`box`,displayName:`Box`,needsURLs:!1},{name:`spotify`,displayName:`Spotify`,needsURLs:!1},{name:`trakt`,displayName:`Trakt`,needsURLs:!1},{name:`twitch`,displayName:`Twitch`,needsURLs:!1},{name:`patreon`,displayName:`Patreon`,needsURLs:!1},{name:`strava`,displayName:`Strava`,needsURLs:!1},{name:`wakatime`,displayName:`WakaTime`,needsURLs:!1},{name:`livechat`,displayName:`LiveChat`,needsURLs:!1},{name:`mailcow`,displayName:`mailcow`,needsURLs:!0},{name:`planningcenter`,displayName:`Planning Center`,needsURLs:!1},{name:`oidc`,displayName:`OpenID Connect`,needsURLs:!0},{name:`oidc2`,displayName:`OpenID Connect 2`,needsURLs:!0},{name:`oidc3`,displayName:`OpenID Connect 3`,needsURLs:!0}],X=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`;function ie(e=50){let t=crypto.getRandomValues(new Uint32Array(e));return Array.from(t,e=>X[e%62]).join(``)}function ae(e,t){return t.split(`.`).reduce((e,t)=>e?.[t],e)}function oe({c:e,path:t,label:n,hint:r}){let i=p(t);return(0,H.jsx)(e.form.Field,{name:t,children:e=>(0,H.jsx)(d,{label:n,hint:r,value:e.state.value??``,error:i,onChange:t=>e.handleChange(t.target.value)})})}function se({c:e,path:t,label:n,hint:r}){let i=p(t);return(0,H.jsx)(e.form.Field,{name:t,children:e=>(0,H.jsx)(c,{label:n,hint:r,value:e.state.value??``,error:i,onChange:t=>e.handleChange(t.target.value===``?0:Number(t.target.value))})})}function ce({c:e,path:t,label:n,hint:r}){let i=p(t);return(0,H.jsx)(e.form.Field,{name:t,children:e=>(0,H.jsx)(l,{label:n,hint:r,checked:e.state.value===!0,error:i,onChange:t=>e.handleChange(t.target.checked)})})}var Z=`flex flex-col gap-2 rounded border border-line p-3`;function le({title:e,prefixes:t,defaultOpen:n=!1,children:r}){let i=h(``,!1).some(([e])=>t.some(t=>e===t||e.startsWith(`${t}.`))),[a,o]=(0,J.useState)(n||i),[c,l]=(0,J.useState)(i);return i!==c&&(l(i),i&&o(!0)),(0,H.jsx)(s,{title:e,open:a,onOpenChange:o,children:(0,H.jsx)(`div`,{className:`flex flex-col gap-3`,children:r})})}var Q=15777e3;function $({label:e,path:t,value:n,onChange:r,hint:i,type:a,required:o,error:s}){let c=p(t);return(0,H.jsx)(d,{label:e,hint:i,type:a,required:o,value:n,error:s??c,onChange:e=>r(e.target.value)})}function ue({provider:e,errorPath:t,onCancel:n,onSave:r,submitLabel:c=`Apply`}){let l=Y.find(t=>t.name===e.name),u=!!e.clientId,[d,p]=(0,J.useState)({}),h=t=>String(e[t]??``),g=a({defaultValues:{clientId:h(`clientId`),clientSecret:``,displayName:h(`displayName`),authURL:h(`authURL`),tokenURL:h(`tokenURL`),userInfoURL:h(`userInfoURL`),pkce:e.pkce===!0?`on`:e.pkce===!1?`off`:`unset`},onSubmit:({value:{clientSecret:t,pkce:n,...i}})=>{let a={clientId:i.clientId.trim()?void 0:`Cannot be blank.`,clientSecret:t||u?void 0:`Cannot be blank.`};p(a),a.clientId||a.clientSecret||r({...e,...i,pkce:n===`on`||n!==`off`&&null,...t?{clientSecret:t}:{}})}}),_=(e,n,r={})=>(0,H.jsx)(g.Field,{name:e,children:i=>(0,H.jsx)($,{label:n,path:`${t}.${e}`,value:i.state.value,onChange:t=>{i.handleChange(t),p(t=>({...t,[e]:void 0}))},error:d[e],...r})}),v=(0,H.jsxs)(H.Fragment,{children:[_(`authURL`,`Auth URL`,{type:`url`,required:l?.needsURLs}),_(`tokenURL`,`Token URL`,{type:`url`,required:l?.needsURLs}),_(`userInfoURL`,`User info URL`,{type:`url`,required:l?.needsURLs})]});return(0,H.jsx)(i,{open:!0,onClose:n,title:`${l?.displayName??e.name} provider`,footer:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(o,{onClick:n,children:`Cancel`}),(0,H.jsx)(o,{variant:`primary`,onClick:()=>void g.handleSubmit(),children:c})]}),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(m,{}),_(`clientId`,`Client ID`),_(`clientSecret`,`Client secret`,{type:`password`,hint:u?`Leave empty to keep the current value`:void 0}),e.name===`apple`&&(0,H.jsxs)(`fieldset`,{className:`flex flex-col gap-2 rounded border border-line p-3`,children:[(0,H.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:`Generate client secret`}),(0,H.jsx)(de,{clientId:()=>g.state.values.clientId,onSecret:e=>g.setFieldValue(`clientSecret`,e)})]}),_(`displayName`,`Display name`),(0,H.jsx)(g.Field,{name:`pkce`,children:e=>(0,H.jsxs)(f,{label:`PKCE`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),children:[(0,H.jsx)(`option`,{value:`unset`,children:`Provider default`}),(0,H.jsx)(`option`,{value:`on`,children:`On`}),(0,H.jsx)(`option`,{value:`off`,children:`Off`})]})}),l?.needsURLs?v:(0,H.jsx)(s,{title:`Custom endpoints`,children:(0,H.jsx)(`div`,{className:`flex flex-col gap-3`,children:v})})]})})}function de({clientId:e,onSecret:t}){let n=r(),[i,s]=(0,J.useState)(null),c=a({defaultValues:{teamId:``,keyId:``,privateKey:``,duration:Q},onSubmit:async({value:r})=>{s(null);try{let{secret:i}=await n.settings.generateAppleClientSecret(e(),r.teamId,r.keyId,r.privateKey,r.duration);t(i)}catch(e){s(e)}}});return(0,H.jsxs)(g,{error:i,children:[(0,H.jsx)(m,{}),(0,H.jsx)(c.Field,{name:`teamId`,children:e=>(0,H.jsx)($,{label:`Team ID`,path:`teamId`,value:e.state.value,onChange:e.handleChange})}),(0,H.jsx)(c.Field,{name:`keyId`,children:e=>(0,H.jsx)($,{label:`Key ID`,path:`keyId`,value:e.state.value,onChange:e.handleChange})}),(0,H.jsx)(c.Field,{name:`privateKey`,children:e=>(0,H.jsx)(fe,{value:e.state.value,onChange:e.handleChange})}),(0,H.jsx)(c.Field,{name:`duration`,children:e=>(0,H.jsx)(pe,{value:e.state.value,onChange:e.handleChange})}),(0,H.jsx)(c.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,H.jsx)(o,{className:`self-start`,loading:e,onClick:()=>void c.handleSubmit(),children:`Generate client secret`})})]})}function fe(e){return(0,H.jsx)(u,{label:`Private key`,rows:4,value:e.value,error:p(`privateKey`),onChange:e.onChange})}function pe(e){return(0,H.jsx)(c,{label:`Duration (seconds)`,max:Q,value:e.value,error:p(`duration`),onChange:t=>e.onChange(Number(t.target.value))})}export{oe as a,Y as c,se as i,ie as l,le as n,ae as o,ce as r,Z as s,ue as t,q as u};
@@ -0,0 +1 @@
1
+ import{r as e}from"./glass-aa3ISPbD.js";import{r as t}from"./errors-BzXFkL79.js";import{a as n}from"./field-LSvWL6SU.js";var r=n();function i({query:n}){return n.isError?(0,r.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-3 rounded-control border border-danger/40 bg-danger/10 p-3 text-sm text-danger-text`,children:[(0,r.jsx)(`p`,{children:t(n.error)}),(0,r.jsx)(e,{onClick:()=>void n.refetch(),children:`Retry`})]}):(0,r.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Loading...`})}export{i as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./useForm-BJzA_-qG.js";import{t as n}from"./link-IcX1XVhI.js";import{a as r,o as i}from"./field-LSvWL6SU.js";import{r as a}from"./context-BLpmYnEM.js";import{r as o}from"./errors-BzXFkL79.js";import{r as s}from"./glass-aa3ISPbD.js";import{t as c}from"./TextField-IItAFjU7.js";import{t as l}from"./AuthCard-wJUv2Sdn.js";var u=e(i(),1),d=r();function f(){let e=a(),[r,i]=(0,u.useState)(!1),[f,p]=(0,u.useState)(null),m=t({defaultValues:{email:``},onSubmit:async({value:t})=>{p(null);try{await e.auth(`_superusers`).requestPasswordReset(t.email)}catch(e){let t=e.status??0;if(t===0||t>=500)return p(e)}i(!0)}});return(0,d.jsxs)(l,{title:`Reset password`,children:[r?(0,d.jsx)(`p`,{role:`status`,children:`If the email exists, a reset link was sent.`}):(0,d.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),m.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,d.jsx)(m.Field,{name:`email`,children:e=>(0,d.jsx)(c,{label:`Email`,type:`email`,autoComplete:`username`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),f!==null&&(0,d.jsx)(`p`,{role:`alert`,children:o(f)}),(0,d.jsx)(m.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,d.jsx)(s,{type:`submit`,variant:`primary`,loading:e,children:`Send reset link`})})]}),(0,d.jsx)(n,{to:`/login`,className:`text-sm underline`,children:`Back to sign in`})]})}export{f as RequestResetPage};