texlite 0.18.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/DESIGN.md +442 -26
  2. package/NPM_TESTING.md +23 -0
  3. package/OPERATIONS.md +227 -6
  4. package/README.md +8 -2
  5. package/README.zh-CN.md +6 -2
  6. package/THIRD_PARTY_NOTICES.md +73 -0
  7. package/dist/client/assets/AdminUsers-CuYfWnEk.js +1 -0
  8. package/dist/client/assets/AdminUsers-CuYfWnEk.js.br +0 -0
  9. package/dist/client/assets/AdminUsers-CuYfWnEk.js.gz +0 -0
  10. package/dist/client/assets/AgentIcon-ClP5dPRL.js +1 -0
  11. package/dist/client/assets/AgentIcon-ClP5dPRL.js.br +0 -0
  12. package/dist/client/assets/AgentIcon-ClP5dPRL.js.gz +0 -0
  13. package/dist/client/assets/AgentIcon-DxrC-zx_.css +1 -0
  14. package/dist/client/assets/AgentIcon-DxrC-zx_.css.br +0 -0
  15. package/dist/client/assets/AgentIcon-DxrC-zx_.css.gz +0 -0
  16. package/dist/client/assets/AgentManagement-jY_BF6Qy.js +1 -0
  17. package/dist/client/assets/AgentManagement-jY_BF6Qy.js.br +0 -0
  18. package/dist/client/assets/AgentManagement-jY_BF6Qy.js.gz +0 -0
  19. package/dist/client/assets/AgentTerminal-JKP2SVkZ.js +2 -0
  20. package/dist/client/assets/AgentTerminal-JKP2SVkZ.js.br +0 -0
  21. package/dist/client/assets/AgentTerminal-JKP2SVkZ.js.gz +0 -0
  22. package/dist/client/assets/AgentTerminalSurface-B5LH8GIb.css +1 -0
  23. package/dist/client/assets/AgentTerminalSurface-B5LH8GIb.css.br +0 -0
  24. package/dist/client/assets/AgentTerminalSurface-B5LH8GIb.css.gz +0 -0
  25. package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js +16 -0
  26. package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js.br +0 -0
  27. package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js.gz +0 -0
  28. package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js +1 -0
  29. package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js.br +0 -0
  30. package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js.gz +0 -0
  31. package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js +1 -0
  32. package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js.br +0 -0
  33. package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js.gz +0 -0
  34. package/dist/client/assets/Dashboard-B7mMz5Gj.js +5 -0
  35. package/dist/client/assets/Dashboard-B7mMz5Gj.js.br +0 -0
  36. package/dist/client/assets/Dashboard-B7mMz5Gj.js.gz +0 -0
  37. package/dist/client/assets/GitDialog-C2H-jKVO.js +3 -0
  38. package/dist/client/assets/GitDialog-C2H-jKVO.js.br +0 -0
  39. package/dist/client/assets/GitDialog-C2H-jKVO.js.gz +0 -0
  40. package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js +1 -0
  41. package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js.br +0 -0
  42. package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js.gz +0 -0
  43. package/dist/client/assets/{GitHubIcon-DNR0CleM.js → GitHubIcon-Cjli8pd_.js} +1 -1
  44. package/dist/client/assets/HistoryDialog-CoxJ3EsK.js +8 -0
  45. package/dist/client/assets/HistoryDialog-CoxJ3EsK.js.br +0 -0
  46. package/dist/client/assets/HistoryDialog-CoxJ3EsK.js.gz +0 -0
  47. package/dist/client/assets/{LatexEditor-BzAk3WQM.js → LatexEditor-BhAKioho.js} +26 -26
  48. package/dist/client/assets/LatexEditor-BhAKioho.js.br +0 -0
  49. package/dist/client/assets/LatexEditor-BhAKioho.js.gz +0 -0
  50. package/dist/client/assets/PdfPreview-CC8KEz1Y.js +1 -0
  51. package/dist/client/assets/PdfPreview-CC8KEz1Y.js.br +0 -0
  52. package/dist/client/assets/PdfPreview-CC8KEz1Y.js.gz +0 -0
  53. package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js +1 -0
  54. package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js.br +0 -0
  55. package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js.gz +0 -0
  56. package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js +4 -0
  57. package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js.br +0 -0
  58. package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js.gz +0 -0
  59. package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js +30 -0
  60. package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js.br +0 -0
  61. package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js.gz +0 -0
  62. package/dist/client/assets/{QuickOpenDialog-CyqeckBM.js → QuickOpenDialog-BAzyrB-4.js} +1 -1
  63. package/dist/client/assets/QuickOpenDialog-BAzyrB-4.js.br +0 -0
  64. package/dist/client/assets/QuickOpenDialog-BAzyrB-4.js.gz +0 -0
  65. package/dist/client/assets/SaveButton-DkyoEu6j.js +1 -0
  66. package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js +3 -0
  67. package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js.br +0 -0
  68. package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js.gz +0 -0
  69. package/dist/client/assets/SuccessNotice-ubBtzzi_.js +1 -0
  70. package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js +1 -0
  71. package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js.br +0 -0
  72. package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js.gz +0 -0
  73. package/dist/client/assets/TagColorSelect-xbc2H5ou.js +1 -0
  74. package/dist/client/assets/TagManagementDialog-8pZUVaEI.js +1 -0
  75. package/dist/client/assets/TagManagementDialog-8pZUVaEI.js.br +0 -0
  76. package/dist/client/assets/TagManagementDialog-8pZUVaEI.js.gz +0 -0
  77. package/dist/client/assets/{WordCountDialog-Bp8kYngA.js → WordCountDialog-BODhL9iz.js} +1 -1
  78. package/dist/client/assets/WordCountDialog-BODhL9iz.js.br +0 -0
  79. package/dist/client/assets/WordCountDialog-BODhL9iz.js.gz +0 -0
  80. package/dist/client/assets/arrow-down-B6T7Z6IO.js +1 -0
  81. package/dist/client/assets/check-BRlv1lrZ.js +1 -0
  82. package/dist/client/assets/chevron-up-krb7w67X.js +1 -0
  83. package/dist/client/assets/{chktex-BcGmZVUy.js → chktex-Bz-LKycq.js} +1 -1
  84. package/dist/client/assets/{clock-3-x2vcGFSH.js → clock-3-Fb1_e3ec.js} +1 -1
  85. package/dist/client/assets/{dist-D5mbpudl.js → dist-CMYWzCHL.js} +1 -1
  86. package/dist/client/assets/dist-CMYWzCHL.js.br +0 -0
  87. package/dist/client/assets/dist-CMYWzCHL.js.gz +0 -0
  88. package/dist/client/assets/{eye-CvzXPIMu.js → eye-B6AX_5uX.js} +1 -1
  89. package/dist/client/assets/{hard-drive-BeGQ5o79.js → hard-drive-CBmnJ2xS.js} +1 -1
  90. package/dist/client/assets/i18n-DF6keNBA.js +13 -0
  91. package/dist/client/assets/i18n-DF6keNBA.js.br +0 -0
  92. package/dist/client/assets/i18n-DF6keNBA.js.gz +0 -0
  93. package/dist/client/assets/index-DCwfhKK9.js +42 -0
  94. package/dist/client/assets/index-DCwfhKK9.js.br +0 -0
  95. package/dist/client/assets/index-DCwfhKK9.js.gz +0 -0
  96. package/dist/client/assets/index-SVNFLCYh.css +1 -0
  97. package/dist/client/assets/index-SVNFLCYh.css.br +0 -0
  98. package/dist/client/assets/index-SVNFLCYh.css.gz +0 -0
  99. package/dist/client/assets/info-DNSAs0_-.js +1 -0
  100. package/dist/client/assets/{minimize-2-yYMmsVER.js → minimize-2-C8oL6PTV.js} +1 -1
  101. package/dist/client/assets/{minus-CNHOVLWS.js → minus-TCBOakyi.js} +1 -1
  102. package/dist/client/assets/plus-Dfkyfvvy.js +1 -0
  103. package/dist/client/assets/{refresh-cw-B7vZa5K2.js → refresh-cw-DuLtxWBX.js} +1 -1
  104. package/dist/client/assets/relativeTime-BR0CVAvz.js +1 -0
  105. package/dist/client/assets/relativeTime-BR0CVAvz.js.br +0 -0
  106. package/dist/client/assets/relativeTime-BR0CVAvz.js.gz +0 -0
  107. package/dist/client/assets/{search-Czv3qsBy.js → search-n-2tBATf.js} +1 -1
  108. package/dist/client/assets/{spellCheck-DDCaK8Yx.js → spellCheck-xzICTGx1.js} +1 -1
  109. package/dist/client/assets/spellCheck-xzICTGx1.js.br +0 -0
  110. package/dist/client/assets/spellCheck-xzICTGx1.js.gz +0 -0
  111. package/dist/client/assets/tags-Dy96boLq.js +1 -0
  112. package/dist/client/assets/terminal-C0xh8jVR.js +1 -0
  113. package/dist/client/assets/{type-NT195OCy.js → type-BjXWxrjH.js} +1 -1
  114. package/dist/client/assets/{user-plus-BRuwNzcg.js → user-plus-3oJZJXHW.js} +1 -1
  115. package/dist/client/index.html +13 -7
  116. package/dist/server/agents/adapters/claude.js +180 -0
  117. package/dist/server/agents/adapters/codex.js +47 -0
  118. package/dist/server/agents/adapters/common.js +86 -0
  119. package/dist/server/agents/adapters/opencode.js +196 -0
  120. package/dist/server/agents/adapters/types.js +1 -0
  121. package/dist/server/agents/execution.js +147 -0
  122. package/dist/server/agents/launcher.js +57 -0
  123. package/dist/server/agents/processIdentity.js +63 -0
  124. package/dist/server/agents/registry.js +72 -0
  125. package/dist/server/agents/sessions.js +574 -0
  126. package/dist/server/agents/terminal.js +84 -0
  127. package/dist/server/agents/workspaces.js +341 -0
  128. package/dist/server/app.js +32 -1
  129. package/dist/server/cli.js +19 -47
  130. package/dist/server/collaboration.js +64 -36
  131. package/dist/server/compileArtifacts.js +11 -44
  132. package/dist/server/compiler.js +16 -38
  133. package/dist/server/config.js +8 -2
  134. package/dist/server/db.js +33 -0
  135. package/dist/server/editHistory.js +59 -65
  136. package/dist/server/history.js +28 -13
  137. package/dist/server/i18n.js +26 -8
  138. package/dist/server/latexRoot.js +4 -2
  139. package/dist/server/locales/zh-Hant.js +145 -0
  140. package/dist/server/lucideIcons.js +14 -17
  141. package/dist/server/projectMutations.js +21 -0
  142. package/dist/server/routes/agents.js +135 -0
  143. package/dist/server/routes/compile.js +23 -43
  144. package/dist/server/routes/projectHistory.js +13 -6
  145. package/dist/server/routes/projectShared.js +6 -1
  146. package/dist/server/routes/projects.js +15 -23
  147. package/dist/shared/agentMessages.js +51 -0
  148. package/dist/shared/agentProtocol.js +41 -0
  149. package/dist/shared/historyFiles.js +1 -1
  150. package/dist/shared/historyTracking.js +2 -0
  151. package/dist/shared/locales.js +21 -0
  152. package/dist/shared/sourceCommentAnchors.js +52 -4
  153. package/package.json +7 -3
  154. package/templates/agents/AGENTS.md +135 -0
  155. package/texlite.config.example.json +3 -2
  156. package/dist/client/assets/AdminUsers-rPpYTAU6.js +0 -1
  157. package/dist/client/assets/AdminUsers-rPpYTAU6.js.br +0 -0
  158. package/dist/client/assets/AdminUsers-rPpYTAU6.js.gz +0 -0
  159. package/dist/client/assets/AvatarSettingsDialog-CIPKapVe.js +0 -1
  160. package/dist/client/assets/AvatarSettingsDialog-CIPKapVe.js.br +0 -0
  161. package/dist/client/assets/AvatarSettingsDialog-CIPKapVe.js.gz +0 -0
  162. package/dist/client/assets/CitationLibraryDialog-BhZX8BV2.js +0 -1
  163. package/dist/client/assets/CitationLibraryDialog-BhZX8BV2.js.br +0 -0
  164. package/dist/client/assets/CitationLibraryDialog-BhZX8BV2.js.gz +0 -0
  165. package/dist/client/assets/Dashboard-DppEhsjL.js +0 -5
  166. package/dist/client/assets/Dashboard-DppEhsjL.js.br +0 -0
  167. package/dist/client/assets/Dashboard-DppEhsjL.js.gz +0 -0
  168. package/dist/client/assets/GitDialog-BOu46hxA.js +0 -3
  169. package/dist/client/assets/GitDialog-BOu46hxA.js.br +0 -0
  170. package/dist/client/assets/GitDialog-BOu46hxA.js.gz +0 -0
  171. package/dist/client/assets/GitHubAccountDialog-hosK9cLW.js +0 -1
  172. package/dist/client/assets/GitHubAccountDialog-hosK9cLW.js.br +0 -0
  173. package/dist/client/assets/GitHubAccountDialog-hosK9cLW.js.gz +0 -0
  174. package/dist/client/assets/HistoryDialog-BdkuEl8r.js +0 -8
  175. package/dist/client/assets/HistoryDialog-BdkuEl8r.js.br +0 -0
  176. package/dist/client/assets/HistoryDialog-BdkuEl8r.js.gz +0 -0
  177. package/dist/client/assets/LatexEditor-BzAk3WQM.js.br +0 -0
  178. package/dist/client/assets/LatexEditor-BzAk3WQM.js.gz +0 -0
  179. package/dist/client/assets/PdfPreview-DkjI1eCo.js +0 -1
  180. package/dist/client/assets/PdfPreview-DkjI1eCo.js.br +0 -0
  181. package/dist/client/assets/PdfPreview-DkjI1eCo.js.gz +0 -0
  182. package/dist/client/assets/ProjectIconPickerDialog-D8Uo4H10.js +0 -1
  183. package/dist/client/assets/ProjectIconPickerDialog-D8Uo4H10.js.br +0 -0
  184. package/dist/client/assets/ProjectIconPickerDialog-D8Uo4H10.js.gz +0 -0
  185. package/dist/client/assets/ProjectSettings-Jdr94nOc.js +0 -1
  186. package/dist/client/assets/ProjectSettings-Jdr94nOc.js.br +0 -0
  187. package/dist/client/assets/ProjectSettings-Jdr94nOc.js.gz +0 -0
  188. package/dist/client/assets/ProjectWorkspace-D9v3Jj8T.js +0 -30
  189. package/dist/client/assets/ProjectWorkspace-D9v3Jj8T.js.br +0 -0
  190. package/dist/client/assets/ProjectWorkspace-D9v3Jj8T.js.gz +0 -0
  191. package/dist/client/assets/QuickOpenDialog-CyqeckBM.js.br +0 -0
  192. package/dist/client/assets/QuickOpenDialog-CyqeckBM.js.gz +0 -0
  193. package/dist/client/assets/SelectionHistoryDialog-Dlutex-A.js +0 -3
  194. package/dist/client/assets/SelectionHistoryDialog-Dlutex-A.js.br +0 -0
  195. package/dist/client/assets/SelectionHistoryDialog-Dlutex-A.js.gz +0 -0
  196. package/dist/client/assets/SystemMetricsDialog-CCWxXw6g.js +0 -1
  197. package/dist/client/assets/SystemMetricsDialog-CCWxXw6g.js.br +0 -0
  198. package/dist/client/assets/SystemMetricsDialog-CCWxXw6g.js.gz +0 -0
  199. package/dist/client/assets/TagColorSelect-D3T-rw4K.js +0 -1
  200. package/dist/client/assets/TagManagementDialog-CxjrSX-o.js +0 -1
  201. package/dist/client/assets/TagManagementDialog-CxjrSX-o.js.br +0 -0
  202. package/dist/client/assets/TagManagementDialog-CxjrSX-o.js.gz +0 -0
  203. package/dist/client/assets/WordCountDialog-Bp8kYngA.js.br +0 -0
  204. package/dist/client/assets/WordCountDialog-Bp8kYngA.js.gz +0 -0
  205. package/dist/client/assets/binary-B57nBiwS.js +0 -1
  206. package/dist/client/assets/check-DFoA73zZ.js +0 -1
  207. package/dist/client/assets/chevron-up-C8DyKLxi.js +0 -1
  208. package/dist/client/assets/dist-D5mbpudl.js.br +0 -0
  209. package/dist/client/assets/dist-D5mbpudl.js.gz +0 -0
  210. package/dist/client/assets/i18n-CRWKZA6W.js +0 -9
  211. package/dist/client/assets/i18n-CRWKZA6W.js.br +0 -0
  212. package/dist/client/assets/i18n-CRWKZA6W.js.gz +0 -0
  213. package/dist/client/assets/index-D0eqhDpZ.js +0 -42
  214. package/dist/client/assets/index-D0eqhDpZ.js.br +0 -0
  215. package/dist/client/assets/index-D0eqhDpZ.js.gz +0 -0
  216. package/dist/client/assets/index-DnhiIb1V.css +0 -1
  217. package/dist/client/assets/index-DnhiIb1V.css.br +0 -0
  218. package/dist/client/assets/index-DnhiIb1V.css.gz +0 -0
  219. package/dist/client/assets/plus-BDquy76g.js +0 -1
  220. package/dist/client/assets/relativeTime-DuOytR_J.js +0 -1
  221. package/dist/client/assets/relativeTime-DuOytR_J.js.br +0 -0
  222. package/dist/client/assets/relativeTime-DuOytR_J.js.gz +0 -0
  223. package/dist/client/assets/sigma-CI6gmAkl.js +0 -1
  224. package/dist/client/assets/spellCheck-DDCaK8Yx.js.br +0 -0
  225. package/dist/client/assets/spellCheck-DDCaK8Yx.js.gz +0 -0
  226. package/dist/client/assets/tags-CLK7WRSs.js +0 -1
  227. package/preview-1.png +0 -0
  228. package/preview-2.png +0 -0
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{C as r,D as i,T as a,b as o,tt as s,w as c,x as l}from"./relativeTime-BR0CVAvz.js";import{t as u}from"./check-BRlv1lrZ.js";import{t as d}from"./SaveButton-DkyoEu6j.js";import{t as f}from"./search-n-2tBATf.js";import{C as p,E as m,c as h,j as g}from"./index-DCwfhKK9.js";var _=e(t(),1),v=n(),y=e=>e.split(`-`).map(e=>e[0].toUpperCase()+e.slice(1)).join(` `);function b({value:e,disabled:t,onChange:n}){let{t:o}=g(),d=(0,_.useId)(),[p,m]=(0,_.useState)(!1),[h,b]=(0,_.useState)(``),[x,S]=(0,_.useState)(0),C=(0,_.useRef)(null),w=(0,_.useRef)(null),T=(0,_.useRef)(null),E=[{value:null,name:o(`account.avatarDefault`)},...l.map(e=>({value:e,name:y(e)}))],D=h.trim().toLowerCase().replace(/-/g,` `),O=E.filter(e=>e.name.toLowerCase().includes(D)),k=E.find(t=>t.value===e)?.name??o(`account.avatarDefault`),A=n=>{m(n&&!t),n&&(b(``),S(Math.max(0,E.findIndex(t=>t.value===e))))},j=e=>{let r=O[e];r&&!t&&(n(r.value),m(!1))},M=()=>T.current?.querySelector(`[data-index="${x}"]`)?.scrollIntoView?.({block:`nearest`});return(0,_.useEffect)(()=>{t&&m(!1)},[t]),(0,_.useEffect)(()=>{p&&T.current?.querySelector(`[data-index="${x}"]`)?.scrollIntoView?.({block:`nearest`})},[x,p,h]),(0,v.jsxs)(`div`,{className:`avatar-style-picker`,children:[(0,v.jsx)(`span`,{id:`${d}-label`,className:`avatar-style-label`,children:o(`account.avatarStyle`)}),(0,v.jsxs)(r,{open:p,onOpenChange:A,children:[(0,v.jsx)(i,{asChild:!0,children:(0,v.jsxs)(`button`,{ref:w,type:`button`,className:`avatar-style-trigger`,disabled:t,"aria-labelledby":`${d}-label ${d}-value`,"aria-haspopup":`dialog`,onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),A(!0))},children:[(0,v.jsx)(`span`,{id:`${d}-value`,children:k}),(0,v.jsx)(s,{size:14,"aria-hidden":!0})]})}),(0,v.jsx)(a,{container:w.current?.closest(`[role="dialog"]`),children:(0,v.jsxs)(c,{className:`avatar-style-popover`,align:`start`,side:`bottom`,sideOffset:6,collisionPadding:12,"aria-labelledby":`${d}-label`,onOpenAutoFocus:e=>{e.preventDefault(),C.current?.focus({preventScroll:!0}),M()},children:[(0,v.jsxs)(`div`,{className:`avatar-style-search`,children:[(0,v.jsx)(f,{size:14,"aria-hidden":!0}),(0,v.jsx)(`input`,{ref:C,role:`combobox`,"aria-label":o(`account.avatarSearch`),placeholder:o(`account.avatarSearch`),autoComplete:`off`,spellCheck:!1,value:h,"aria-autocomplete":`list`,"aria-expanded":p,"aria-controls":`${d}-list`,"aria-activedescendant":O[x]?`${d}-option-${x}`:void 0,onChange:e=>{b(e.target.value),S(0)},onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;S(e=>O.length?(e+t+O.length)%O.length:0)}else e.key===`Enter`&&(e.preventDefault(),j(x))}}})]}),(0,v.jsx)(`div`,{ref:T,id:`${d}-list`,role:`listbox`,"aria-labelledby":`${d}-label`,className:`avatar-style-options`,children:O.map((t,n)=>(0,v.jsxs)(`button`,{type:`button`,role:`option`,tabIndex:-1,id:`${d}-option-${n}`,"data-index":n,"data-active":n===x||void 0,"aria-selected":t.value===e,onMouseDown:e=>e.preventDefault(),onMouseMove:()=>S(n),onClick:()=>j(n),children:[(0,v.jsx)(`span`,{children:t.name}),t.value===e&&(0,v.jsx)(u,{size:14,"aria-hidden":!0})]},t.value??`initial`))}),O.length===0&&(0,v.jsx)(`p`,{className:`avatar-style-empty`,role:`status`,children:o(`account.avatarNoMatches`)})]})})]})]})}function x({user:e,onClose:t,onSaved:n}){let{t:r}=g(),[i,a]=(0,_.useState)(e.avatarStyle??null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(``),f=(0,_.useRef)(!1),y=async()=>{if(!(f.current||i===(e.avatarStyle??null))){f.current=!0,c(!0),u(``);try{n((await m(`/api/me/avatar`,{method:`PUT`,body:JSON.stringify({style:i})})).user),t()}catch(e){u(p(e))}finally{f.current=!1,c(!1)}}};return(0,v.jsx)(h,{open:!0,className:`avatar-settings-modal`,title:r(`account.avatarTitle`),description:r(`account.avatarDescription`),onOpenChange:e=>{!e&&!f.current&&t()},footer:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`button`,{type:`button`,disabled:s,onClick:t,children:r(`common.cancel`)}),(0,v.jsx)(d,{saving:s,disabled:i===(e.avatarStyle??null),onClick:()=>void y(),children:r(`common.save`)})]}),children:(0,v.jsxs)(`div`,{className:`avatar-settings`,children:[l&&(0,v.jsx)(`p`,{className:`error dialog-error`,role:`alert`,children:l}),(0,v.jsxs)(`div`,{className:`avatar-settings-choice`,children:[(0,v.jsx)(b,{value:i,disabled:s,onChange:a}),(0,v.jsx)(o,{userId:e.id,name:e.displayName,username:e.username,avatarStyle:i,preview:i!==(e.avatarStyle??null),className:`avatar-style-preview`})]}),(0,v.jsx)(`p`,{className:`avatar-settings-note`,children:(0,v.jsx)(`a`,{href:`https://www.dicebear.com/styles/`,target:`_blank`,rel:`noreferrer`,children:r(`account.avatarStyles`)})})]})})}export{x as AvatarSettingsDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{$ as r,F as i,I as a,M as o,Z as s,at as c,et as l,rt as u,tt as d,z as f}from"./relativeTime-BR0CVAvz.js";import{t as p}from"./check-BRlv1lrZ.js";import{t as m}from"./chevron-up-krb7w67X.js";import{t as h}from"./SaveButton-DkyoEu6j.js";import{n as g,t as _}from"./tags-Dy96boLq.js";import{t as v}from"./plus-Dfkyfvvy.js";import{t as y}from"./search-n-2tBATf.js";import{C as b,E as x,b as S,c as C,j as w,s as ee,y as te}from"./index-DCwfhKK9.js";import{a as T,c as E,l as D,n as O,r as k,t as ne}from"./dist-CMYWzCHL.js";import{t as re}from"./SuccessNotice-ubBtzzi_.js";import{t as A}from"./TagColorSelect-xbc2H5ou.js";import{citationBibtexLimitLabel as ie,citationVenue as j,parseBibEntriesResult as ae,parseSingleBibEntry as oe}from"./citationLibrary-BzlqZiFU.js";var M={name:`import`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m8 11 4 4 4-4`,key:`1dohi6`}],[`path`,{d:`M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4`,key:`1ywtjm`}]]};M.node;var N=S(M),se={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};se.node;var ce=S(se),P=e(t(),1),F=n();function le({tags:e,selectedId:t,onSelect:n,onManage:r}){let{t:i}=w(),[a,o]=(0,P.useState)(!1),[s,c]=(0,P.useState)(1/0),[l,u]=(0,P.useState)(),f=(0,P.useRef)(null),p=t?[...e.filter(e=>e.id===t),...e.filter(e=>e.id!==t)]:e;(0,P.useLayoutEffect)(()=>{let e=f.current;if(!e)return;let t=()=>{let t=Array.from(e.querySelectorAll(`button`)),n=[...new Set(t.map(e=>e.offsetTop))][2],r=n===void 0?t:t.filter(e=>e.offsetTop<n);c(r.length),u(r.length?Math.max(...r.map(e=>e.offsetTop+e.offsetHeight)):void 0)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e,t]);let h=s<e.length+1;return(0,F.jsxs)(`div`,{className:`citation-tag-bar`,children:[(0,F.jsxs)(`div`,{className:`citation-tag-filter-catalog`,children:[(0,F.jsx)(`div`,{className:`citation-tag-filter-clip`,style:!a&&h?{maxHeight:l}:void 0,children:(0,F.jsxs)(`div`,{className:`citation-tag-filters`,ref:f,children:[(0,F.jsx)(`button`,{type:`button`,className:t?``:`active`,"aria-pressed":!t,onClick:()=>n(``),children:i(`citationLibrary.allTags`)}),p.map((e,r)=>{let i=!a&&r+1>=s;return(0,F.jsxs)(`button`,{type:`button`,className:t===e.id?`active`:``,"aria-pressed":t===e.id,"aria-hidden":i||void 0,tabIndex:i?-1:0,title:e.name,onClick:()=>n(t===e.id?``:e.id),children:[(0,F.jsx)(`span`,{className:`citation-tag-dot tag-${e.color}`}),(0,F.jsx)(`span`,{className:`citation-tag-name`,children:e.name})]},e.id)})]})}),e.length===0&&(0,F.jsx)(`span`,{className:`muted`,children:i(`citationLibrary.noTags`)}),h&&(0,F.jsxs)(`button`,{type:`button`,className:`citation-tag-expand`,"aria-expanded":a,onClick:()=>o(e=>!e),children:[a?(0,F.jsx)(m,{size:13}):(0,F.jsx)(d,{size:13}),i(a?`citationTagManagement.collapse`:`citationTagManagement.expand`)]})]}),(0,F.jsxs)(`button`,{type:`button`,className:`citation-tag-manage`,onClick:r,children:[(0,F.jsx)(_,{size:14}),i(`citationTagManagement.title`)]})]})}async function I(e,t){try{if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}}catch{}let n=t();if(!n?.isConnected||typeof document.execCommand!=`function`)throw Error(`Clipboard unavailable`);let r=document.activeElement,i=window.getSelection(),a=i?Array.from({length:i.rangeCount},(e,t)=>i.getRangeAt(t).cloneRange()):[],o=document.createElement(`textarea`);o.value=e,o.readOnly=!0,o.tabIndex=-1,o.setAttribute(`aria-hidden`,`true`),o.style.cssText=`position:fixed;left:0;top:0;width:1px;height:1px;opacity:0;pointer-events:none`,n.append(o);try{if(o.focus({preventScroll:!0}),o.select(),!document.execCommand(`copy`))throw Error(`Copy rejected`)}finally{if(o.remove(),r instanceof HTMLElement&&r.isConnected&&r.focus({preventScroll:!0}),i){i.removeAllRanges();for(let e of a)i.addRange(e)}}}function L({citationKey:e,bibtex:t,onTags:n,onEdit:r,onDelete:i,deleting:o=!1}){let{t:c}=w(),[l,u]=(0,P.useState)(`idle`),d=(0,P.useRef)(null),f=(0,P.useRef)(!1),m=(0,P.useRef)(0),h=(0,P.useRef)(void 0);(0,P.useEffect)(()=>(u(`idle`),()=>{m.current++,clearTimeout(h.current)}),[t]);let v=async()=>{let e=++m.current;clearTimeout(h.current),u(`copying`);try{if(await I(t,()=>d.current),e!==m.current)return;u(`copied`)}catch{if(e!==m.current)return;u(`error`)}h.current=setTimeout(()=>u(`idle`),2e3)};return(0,F.jsxs)(`span`,{ref:d,className:`citation-entry-controls`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`citation-copy-button${l===`copied`?` is-copied`:l===`error`?` is-error`:``}`,disabled:l===`copying`,onClick:()=>void v(),children:[l===`copying`?(0,F.jsx)(te,{className:`spin`,size:13,"aria-hidden":!0}):l===`copied`?(0,F.jsx)(p,{size:13,"aria-hidden":!0}):(0,F.jsx)(g,{size:13,"aria-hidden":!0}),(0,F.jsx)(`span`,{role:`status`,"aria-live":`polite`,children:c(`citationLibraryActions.${l===`idle`?`copyBibtex`:l===`error`?`copyFailed`:l}`)})]}),(n||r||i)&&(0,F.jsxs)(ne,{modal:!1,children:[(0,F.jsx)(D,{asChild:!0,children:(0,F.jsx)(`button`,{type:`button`,className:`citation-entry-menu-trigger`,disabled:o,"aria-label":c(`citationLibraryActions.entryActions`,{key:e}),children:(0,F.jsx)(s,{size:17,"aria-hidden":!0})})}),(0,F.jsx)(T,{children:(0,F.jsxs)(O,{className:`citation-entry-menu`,align:`end`,sideOffset:5,collisionPadding:8,onCloseAutoFocus:e=>{f.current&&e.preventDefault(),f.current=!1},children:[n&&(0,F.jsxs)(k,{onSelect:()=>{f.current=!0,n()},children:[(0,F.jsx)(_,{size:14,"aria-hidden":!0}),c(`citationLibrary.tags`)]}),r&&(0,F.jsxs)(k,{onSelect:()=>{f.current=!0,r()},children:[(0,F.jsx)(ce,{size:14,"aria-hidden":!0}),c(`common.edit`)]}),i&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(E,{className:`citation-entry-menu-separator`}),(0,F.jsxs)(k,{className:`danger-text`,onSelect:()=>{f.current=!0,i()},children:[(0,F.jsx)(a,{size:14,"aria-hidden":!0}),c(`common.delete`)]})]})]})})]})]})}function ue({tags:e,onClose:t,onUpdated:n,onDeleted:r}){let{t:i}=w(),[o,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(`green`),[u,d]=(0,P.useState)(null),[p,m]=(0,P.useState)(``),[g,_]=(0,P.useState)(`green`),[y,S]=(0,P.useState)(!1),[T,E]=(0,P.useState)(``),D=re(),[O,k]=(0,P.useState)(null),[ne,ie]=(0,P.useState)(``),j=async e=>{let t=(e?p:o).trim();if(!y&&t){S(!0),E(``),D.clear();try{let r=await x(e?`/api/citations/tags/${encodeURIComponent(e.id)}`:`/api/citations/tags`,{method:e?`PATCH`:`POST`,body:JSON.stringify({name:t,color:e?g:c})});n(r.tag),e?d(r.tag):s(``),D.show(e?`edit:${e.id}`:r.created===!1?`exists`:`create`)}catch(e){E(b(e))}finally{S(!1)}}},ae=async()=>{if(O&&!y){S(!0),ie(``),D.clear();try{await x(`/api/citations/tags/${encodeURIComponent(O.id)}`,{method:`DELETE`}),r(O.id),u?.id===O.id&&d(null),k(null)}catch(e){ie(b(e))}finally{S(!1)}}};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(C,{open:!0,wide:!0,className:`tag-management-modal management-dialog`,title:i(`citationTagManagement.title`),description:i(`citationTagManagement.description`),onOpenChange:e=>{!e&&!y&&t()},footer:(0,F.jsx)(`button`,{disabled:y,onClick:t,children:i(`common.close`)}),children:(0,F.jsxs)(`div`,{className:`tag-management`,children:[T&&(0,F.jsx)(`p`,{className:`error dialog-error`,role:`alert`,children:T}),(0,F.jsxs)(`fieldset`,{disabled:y,className:`citation-tag-management-fields`,children:[(0,F.jsxs)(`form`,{className:`tag-management-create`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,F.jsxs)(`label`,{className:`tag-management-field`,children:[(0,F.jsx)(`span`,{children:i(`tags.name`)}),(0,F.jsx)(`input`,{autoFocus:!0,maxLength:32,value:o,placeholder:i(`citationLibrary.newTagPlaceholder`),onChange:e=>s(e.target.value)})]}),(0,F.jsxs)(`label`,{className:`tag-management-field tag-management-color`,children:[(0,F.jsx)(`span`,{children:i(`tags.color`)}),(0,F.jsx)(A,{value:c,onChange:l,disabled:y})]}),(0,F.jsxs)(`button`,{type:`submit`,className:`primary`,disabled:!o.trim(),children:[y?(0,F.jsx)(te,{className:`spin`,size:14}):(0,F.jsx)(v,{size:14}),(0,F.jsx)(`span`,{role:`status`,children:i(D.message===`create`?`common.done`:D.message===`exists`?`citationTagManagement.exists`:`citationLibrary.createTag`)})]})]}),e.length===0?(0,F.jsx)(`p`,{className:`tag-management-empty`,children:i(`citationLibrary.noTags`)}):(0,F.jsx)(`div`,{className:`tag-management-list`,children:e.map(e=>(0,F.jsxs)(`article`,{className:`tag-management-item${u?.id===e.id?` editing`:``}`,children:[(0,F.jsxs)(`div`,{className:`tag-management-item-main`,children:[(0,F.jsx)(`span`,{className:`tag-dot tag-${e.color}`,"aria-hidden":!0}),(0,F.jsx)(`strong`,{title:e.name,children:e.name})]}),(0,F.jsxs)(`div`,{className:`tag-management-item-actions`,children:[(0,F.jsx)(`button`,{type:`button`,"aria-label":i(`citationTagManagement.edit`,{tag:e.name}),onClick:()=>{d(e),m(e.name),_(e.color),E(``)},children:(0,F.jsx)(f,{size:14})}),(0,F.jsx)(`button`,{type:`button`,className:`danger-text`,"aria-label":i(`citationTagManagement.delete`,{tag:e.name}),onClick:()=>{k(e),ie(``)},children:(0,F.jsx)(a,{size:14})})]}),u?.id===e.id&&(0,F.jsxs)(`form`,{className:`tag-management-edit`,onSubmit:t=>{t.preventDefault(),j(e)},children:[(0,F.jsxs)(`label`,{className:`tag-management-field`,children:[(0,F.jsx)(`span`,{children:i(`tags.rename`)}),(0,F.jsx)(`input`,{maxLength:32,value:p,onChange:e=>m(e.target.value)})]}),(0,F.jsxs)(`label`,{className:`tag-management-field tag-management-color`,children:[(0,F.jsx)(`span`,{children:i(`tags.color`)}),(0,F.jsx)(A,{value:g,onChange:_,disabled:y})]}),(0,F.jsxs)(`div`,{className:`tag-management-edit-actions`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:()=>{d(null),E(``)},children:i(`common.cancel`)}),(0,F.jsx)(h,{type:`submit`,saving:y,feedback:D.message===`edit:${e.id}`?i(`editor.saved`):``,disabled:!p.trim(),children:i(`common.save`)})]})]})]},e.id))})]})]})}),(0,F.jsx)(ee,{open:!!O,title:i(`tags.deleteTitle`),description:i(`citationTagManagement.deleteDescription`,{tag:O?.name??``}),confirmLabel:i(`common.delete`),danger:!0,busy:y,error:ne,onCancel:()=>{y||k(null)},onConfirm:()=>void ae()})]})}var de={status:`empty`,entries:[]};function R({open:e,onOpenChange:t,page:n=!1,onBack:a,currentFile:s=``,currentSource:d=``,readOnly:f=!1,currentUserId:m,maxBibtexBytes:h,onInsert:g}){let{t:_}=w(),[S,T]=(0,P.useState)(`library`),[E,D]=(0,P.useState)(``),[O,k]=(0,P.useState)(``),[ne,A]=(0,P.useState)([]),[j,M]=(0,P.useState)(1),[N,se]=(0,P.useState)({page:1,pageSize:60,total:0,totalPages:0}),[ce,I]=(0,P.useState)(0),[L,R]=(0,P.useState)([]),[he,ge]=(0,P.useState)(!1),[z,B]=(0,P.useState)(null),[_e,V]=(0,P.useState)([]),[ve,ye]=(0,P.useState)(!1),[be,xe]=(0,P.useState)(!1),[H,U]=(0,P.useState)(null),[W,G]=(0,P.useState)(null),[Se,Ce]=(0,P.useState)(``),[we,K]=(0,P.useState)(!1),[Te,Ee]=(0,P.useState)(``),[De,Oe]=(0,P.useState)(null),[ke,Ae]=(0,P.useState)(null),[je,q]=(0,P.useState)(``),[J,Y]=(0,P.useState)(``),X=re();(0,P.useEffect)(()=>{e||ge(!1)},[e]);let[Me,Z]=(0,P.useState)(new Map),[Ne,Pe]=(0,P.useState)(!1),[Fe,Ie]=(0,P.useState)(0),Q=!!(/\.bib$/i.test(s)&&g),Le=(0,P.useMemo)(()=>e&&Q?ae(d,h):de,[e,d,Q,h]),Re=Le.status===`too-large`,ze=Le.status===`invalid`,$=Le.entries,Be=(0,P.useMemo)(()=>new Set($.map(e=>e.citationKey.toLowerCase())),[$]);(0,P.useEffect)(()=>{if(!e)return;let t=new AbortController,n=window.setTimeout(()=>{xe(!0),Y(``);let e=new URLSearchParams;E.trim()&&e.set(`q`,E.trim()),O&&e.set(`tag`,O),e.set(`page`,String(j)),e.set(`pageSize`,`60`),x(`/api/citations?${e.toString()}`,{signal:t.signal}).then(e=>{A(e.entries),se(e.pagination),e.pagination.page!==j&&M(e.pagination.page)}).catch(e=>{e instanceof Error&&e.name===`AbortError`||Y(b(e))}).finally(()=>{t.signal.aborted||xe(!1)})},E.trim()?180:0);return()=>{window.clearTimeout(n),t.abort()}},[e,E,O,j,ce]),(0,P.useEffect)(()=>{if(!e)return;let t=new AbortController;return x(`/api/citations/tags`,{signal:t.signal}).then(e=>R(e.tags)).catch(e=>{e instanceof Error&&e.name===`AbortError`||Y(b(e))}),()=>t.abort()},[e]),(0,P.useEffect)(()=>{if(!e||!Q){Z(new Map),Pe(!1);return}let t=new AbortController,n=[...new Set($.map(e=>e.citationKey))];return n.length?(Pe(!0),x(`/api/citations/lookup`,{method:`POST`,body:JSON.stringify({keys:n}),signal:t.signal}).then(e=>{Z(new Map(e.matches.map(e=>[e.citationKey.toLowerCase(),e])))}).catch(e=>{e instanceof Error&&e.name===`AbortError`||Y(b(e))}).finally(()=>{t.signal.aborted||Pe(!1)}),()=>t.abort()):(Z(new Map),Pe(!1),()=>t.abort())},[e,Q,$,Fe]),(0,P.useEffect)(()=>{e&&(T(`library`),D(``),k(``),M(1),se({page:1,pageSize:60,total:0,totalPages:0}),G(null),K(!1),Ee(``),B(null),Oe(null),Ae(null),q(``),Y(``),X.clear(),Z(new Map))},[e,Q]);let Ve=async e=>{X.clear(),U(e.citationKey),Y(``);try{let t=Me.get(e.citationKey.toLowerCase()),n=await x(`/api/citations`,{method:`POST`,body:JSON.stringify({bibtex:e.bibtex,citationKey:e.citationKey,entryType:e.entryType,title:e.title,authors:e.authors,year:e.year,overwrite:!!t,expectedRevision:t?.revision})});A(e=>[n.entry,...e.filter(e=>e.id!==n.entry.id&&e.citationKey.toLowerCase()!==n.entry.citationKey.toLowerCase())]),Z(e=>new Map(e).set(n.entry.citationKey.toLowerCase(),{id:n.entry.id,citationKey:n.entry.citationKey,revision:n.entry.revision})),B(n.entry),V(n.entry.tags.map(e=>e.id)),X.show(`entry:${e.citationKey.toLowerCase()}`),M(1),I(e=>e+1)}catch(e){Y(b(e)),Ie(e=>e+1)}finally{U(null)}},He=async()=>{if(W){X.clear(),U(W.citationKey),Y(``);try{let e=oe(Se,h);if(!e){Y(_(`citationErrors.invalid`));return}let t=await x(`/api/citations/${encodeURIComponent(W.id)}`,{method:`PATCH`,body:JSON.stringify({bibtex:e.bibtex,citationKey:e.citationKey,entryType:e.entryType,title:e.title,authors:e.authors,year:e.year,expectedRevision:W.revision})});A(e=>[t.entry,...e.filter(e=>e.id!==t.entry.id)]),Z(e=>{let n=new Map(e);return n.delete(W.citationKey.toLowerCase()),n.set(t.entry.citationKey.toLowerCase(),{id:t.entry.id,citationKey:t.entry.citationKey,revision:t.entry.revision}),n}),G(e=>e?.id===t.entry.id?t.entry:e),X.show(`edit:${t.entry.id}`),M(1),I(e=>e+1)}catch(e){Y(b(e))}finally{U(null)}}},Ue=async()=>{if(Te.trim()){X.clear(),U(`__new__`),Y(``);try{let e=oe(Te,h);if(!e){Y(_(`citationErrors.invalid`));return}let t=await x(`/api/citations`,{method:`POST`,body:JSON.stringify({bibtex:e.bibtex,citationKey:e.citationKey,entryType:e.entryType,title:e.title,authors:e.authors,year:e.year})});A(e=>[t.entry,...e.filter(e=>e.id!==t.entry.id&&e.citationKey.toLowerCase()!==t.entry.citationKey.toLowerCase())]),Z(e=>new Map(e).set(t.entry.citationKey.toLowerCase(),{id:t.entry.id,citationKey:t.entry.citationKey,revision:t.entry.revision})),K(!1),Ee(``),X.show(`add`),B(t.entry),V(t.entry.tags.map(e=>e.id)),M(1),I(e=>e+1)}catch(e){Y(b(e))}finally{U(null)}}},We=e=>{R(t=>[...t.filter(t=>t.id!==e.id),e].sort((e,t)=>e.name.localeCompare(t.name)));let t=t=>({...t,tags:t.tags.map(t=>t.id===e.id?e:t)});A(e=>e.map(t)),B(e=>e?t(e):null),G(e=>e?t(e):null)},Ge=e=>{R(t=>t.filter(t=>t.id!==e));let t=t=>({...t,tags:t.tags.filter(t=>t.id!==e)});A(e=>e.map(t)),B(e=>e?t(e):null),G(e=>e?t(e):null),V(t=>t.filter(t=>t!==e)),O===e&&(k(``),M(1))},Ke=e=>{X.clear(),G(null),K(!1),B(e),V(e.tags.map(e=>e.id))},qe=async()=>{if(z){X.clear(),ye(!0),Y(``);try{let e=await x(`/api/citations/${encodeURIComponent(z.id)}/tags`,{method:`PATCH`,body:JSON.stringify({tagIds:_e,expectedRevision:z.revision})});A(t=>t.map(t=>t.id===e.entry.id?e.entry:t)),Z(t=>new Map(t).set(e.entry.citationKey.toLowerCase(),{id:e.entry.id,citationKey:e.entry.citationKey,revision:e.entry.revision})),B(t=>t?.id===e.entry.id?e.entry:t),V(e.entry.tags.map(e=>e.id)),X.show(`tags:${e.entry.id}`),I(e=>e+1)}catch(e){Y(b(e))}finally{ye(!1)}}},Je=async e=>{Oe(e.id),q(``);try{await x(`/api/citations/${encodeURIComponent(e.id)}`,{method:`DELETE`}),A(t=>t.filter(t=>t.id!==e.id)),Z(t=>{let n=new Map(t);return n.delete(e.citationKey.toLowerCase()),n}),W?.id===e.id&&G(null),z?.id===e.id&&B(null),M(1),I(e=>e+1),Ae(null)}catch(e){q(b(e))}finally{Oe(null)}},Ye=(0,F.jsxs)(`div`,{className:`citation-library-dialog`,children:[(0,F.jsxs)(`div`,{className:`citation-library-tabs`,role:`tablist`,"aria-label":_(`citationLibrary.title`),children:[(0,F.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":S===`library`,className:S===`library`?`active`:``,onClick:()=>T(`library`),children:[(0,F.jsx)(u,{size:15}),_(`citationLibrary.myLibrary`),(0,F.jsx)(`span`,{children:N.total})]}),Q&&(0,F.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":S===`current`,className:S===`current`?`active`:``,onClick:()=>T(`current`),children:[(0,F.jsx)(v,{size:15}),_(`citationLibrary.currentFile`),(0,F.jsx)(`span`,{children:$.length})]})]}),J&&!(n&&(z||W))&&(0,F.jsx)(`p`,{className:`error dialog-error`,children:J}),S===`library`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`citation-library-search-row`,children:[(0,F.jsxs)(`label`,{className:`citation-library-search`,children:[(0,F.jsx)(y,{size:15}),(0,F.jsx)(`input`,{autoFocus:!0,placeholder:_(`citationLibrary.searchPlaceholder`),value:E,onChange:e=>{D(e.target.value),M(1)}}),(0,F.jsx)(`span`,{children:_(`citationLibrary.searchHint`)})]}),(0,F.jsxs)(`button`,{type:`button`,className:`citation-add-entry-button`,onClick:()=>{X.clear(),K(!0),G(null),B(null)},children:[(0,F.jsx)(v,{size:14}),(0,F.jsx)(`span`,{role:`status`,children:_(X.message===`add`?`common.done`:`citationLibraryActions.addEntry`)})]})]}),(0,F.jsx)(le,{tags:L,selectedId:O,onSelect:e=>{k(e),M(1)},onManage:()=>ge(!0)}),we&&(0,F.jsxs)(`div`,{className:`citation-edit-panel`,children:[(0,F.jsxs)(`div`,{className:`citation-edit-header`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`strong`,{children:_(`citationLibraryActions.addEntryTitle`)}),(0,F.jsx)(`small`,{children:_(`citationLibraryActions.addEntryDescription`)})]}),(0,F.jsx)(`button`,{type:`button`,"aria-label":_(`common.close`),onClick:()=>K(!1),children:(0,F.jsx)(o,{size:15})})]}),(0,F.jsx)(`textarea`,{autoFocus:!0,value:Te,onChange:e=>Ee(e.target.value),placeholder:_(`citationLibraryActions.addEntryPlaceholder`),spellCheck:!1,rows:9}),(0,F.jsxs)(`div`,{className:`citation-edit-actions`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:()=>K(!1),children:_(`common.cancel`)}),(0,F.jsxs)(`button`,{type:`button`,className:`primary`,disabled:!Te.trim()||H===`__new__`,onClick:()=>void Ue(),children:[H===`__new__`?(0,F.jsx)(te,{className:`spin`,size:14}):(0,F.jsx)(p,{size:14}),_(`citationLibraryActions.addEntry`)]})]})]}),be&&!W&&!z?(0,F.jsxs)(`div`,{className:`citation-library-empty`,children:[(0,F.jsx)(te,{className:`spin`,size:22}),(0,F.jsx)(`span`,{children:_(`common.loading`)})]}):ne.length===0?(0,F.jsxs)(`div`,{className:`citation-library-empty`,children:[(0,F.jsx)(u,{size:28}),(0,F.jsx)(`strong`,{children:_(`citationLibrary.emptyTitle`)}),(0,F.jsx)(`span`,{children:_(O?`citationLibrary.noTagMatches`:`citationLibrary.emptyDescription`)})]}):(0,F.jsx)(`div`,{className:`citation-entry-list`,children:ne.map(e=>(0,F.jsxs)(`div`,{className:`citation-entry-item`,children:[(0,F.jsx)(fe,{entry:e,selected:z?.id===e.id||W?.id===e.id,alreadyInFile:!n&&Be.has(e.citationKey.toLowerCase()),importDisabled:f,deleting:De===e.id,onImport:g?async()=>{await g(e)&&t(!1)}:void 0,onEdit:e.ownerId===m?()=>{X.clear(),B(null),K(!1),G(e),Ce(e.bibtex)}:void 0,onTags:e.ownerId===m?()=>Ke(e):void 0,onDelete:e.ownerId===m?()=>{Ae(e),q(``)}:void 0,t:_}),!n&&z?.id===e.id&&(0,F.jsx)(pe,{feedback:X.message===`tags:${z.id}`?_(`editor.saved`):``,entry:z,tags:L,selectedIds:_e,saving:ve,onClose:()=>B(null),onToggle:e=>V(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),onSave:()=>void qe(),t:_}),!n&&W?.id===e.id&&(0,F.jsx)(me,{feedback:X.message===`edit:${W.id}`?_(`editor.saved`):``,title:_(`citationLibrary.editTitle`,{key:W.citationKey}),value:Se,saving:H===W.citationKey,onChange:Ce,onClose:()=>G(null),onSave:()=>void He(),t:_})]},e.id))}),N.totalPages>1&&(0,F.jsxs)(`nav`,{className:`citation-library-pagination`,"aria-label":_(`citationLibraryPagination.pageOf`,{page:N.page,totalPages:N.totalPages,count:N.total}),children:[(0,F.jsxs)(`button`,{type:`button`,disabled:N.page<=1,onClick:()=>M(e=>Math.max(1,e-1)),children:[(0,F.jsx)(l,{size:14}),_(`citationLibraryPagination.previous`)]}),(0,F.jsx)(`span`,{children:_(`citationLibraryPagination.pageOf`,{page:N.page,totalPages:N.totalPages,count:N.total})}),(0,F.jsxs)(`button`,{type:`button`,disabled:N.page>=N.totalPages,onClick:()=>M(e=>Math.min(N.totalPages,e+1)),children:[_(`citationLibraryPagination.next`),(0,F.jsx)(r,{size:14})]})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`citation-current-heading`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`strong`,{children:_(`citationLibrary.currentFileTitle`)}),(0,F.jsx)(`span`,{children:_(`citationLibrary.currentFileDescription`)})]}),(0,F.jsxs)(`button`,{type:`button`,onClick:()=>T(`library`),children:[(0,F.jsx)(l,{size:14}),_(`citationLibrary.backToLibrary`)]})]}),Re&&(0,F.jsxs)(`p`,{className:`warning citation-library-warning`,children:[(0,F.jsx)(i,{size:15}),_(`citationLibrary.fileTooLarge`,{size:ie(h)})]}),ze&&(0,F.jsxs)(`p`,{className:`warning citation-library-warning`,children:[(0,F.jsx)(i,{size:15}),_(`citationLibrary.fileInvalid`)]}),$.length===0?(0,F.jsxs)(`div`,{className:`citation-library-empty`,children:[(0,F.jsx)(u,{size:28}),(0,F.jsx)(`strong`,{children:_(`citationLibrary.noEntries`)}),(0,F.jsx)(`span`,{children:_(Re?`citationLibrary.fileTooLargeHint`:ze?`citationLibrary.fileInvalidHint`:`citationLibrary.noEntriesDescription`)})]}):(0,F.jsx)(`div`,{className:`citation-entry-list`,children:$.map((e,t)=>(0,F.jsxs)(`div`,{className:`citation-entry-item`,children:[(0,F.jsx)(fe,{saveFeedback:X.message===`entry:${e.citationKey.toLowerCase()}`?_(`editor.saved`):``,entry:e,saved:Me.has(e.citationKey.toLowerCase()),saving:H===e.citationKey,saveDisabled:Ne,onSave:()=>void Ve(e),t:_}),!n&&z?.citationKey.toLowerCase()===e.citationKey.toLowerCase()&&(0,F.jsx)(pe,{feedback:X.message===`tags:${z.id}`?_(`editor.saved`):``,entry:z,tags:L,selectedIds:_e,saving:ve,onClose:()=>B(null),onToggle:e=>V(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),onSave:()=>void qe(),t:_})]},`${e.citationKey}-${t}`))})]})]}),Xe=(0,F.jsx)(ee,{open:!!ke,title:_(`citationLibrary.deleteTitle`),description:_(`citationLibrary.deleteDescription`,{key:ke?.citationKey??``}),confirmLabel:_(`common.delete`),danger:!0,error:je,busy:!!De,onCancel:()=>{Ae(null),q(``)},onConfirm:()=>{let e=ke;e&&Je(e)}}),Ze=e&&he&&(0,F.jsx)(ue,{tags:L,onClose:()=>ge(!1),onUpdated:We,onDeleted:Ge});return n?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`section`,{className:`citation-library-page management-page`,children:[(0,F.jsxs)(`header`,{className:`section-title citation-library-page-header`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`h1`,{children:[(0,F.jsx)(u,{"aria-hidden":!0,size:25}),_(`citationLibrary.title`)]}),(0,F.jsx)(`p`,{children:_(`citationLibraryHomeDescription`)})]}),a&&(0,F.jsxs)(`button`,{type:`button`,className:`dashboard-back-button`,onClick:a,children:[(0,F.jsx)(c,{size:14}),_(`navigation.backToProjects`)]})]}),Ye]}),z&&(0,F.jsx)(C,{open:!0,className:`management-dialog`,title:_(`citationLibrary.tagsTitle`,{key:z.citationKey}),description:_(`citationLibrary.tags`),onOpenChange:e=>{e||(B(null),Y(``))},children:(0,F.jsxs)(F.Fragment,{children:[J&&(0,F.jsx)(`p`,{className:`error dialog-error`,children:J}),(0,F.jsx)(pe,{feedback:X.message===`tags:${z.id}`?_(`editor.saved`):``,entry:z,tags:L,selectedIds:_e,saving:ve,modal:!0,onClose:()=>{B(null),Y(``)},onToggle:e=>V(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),onSave:()=>void qe(),t:_})]})}),W&&(0,F.jsx)(C,{open:!0,extraWide:!0,className:`management-dialog`,title:_(`citationLibrary.editTitle`,{key:W.citationKey}),description:_(`citationLibrary.title`),onOpenChange:e=>{e||(G(null),Y(``))},children:(0,F.jsxs)(F.Fragment,{children:[J&&(0,F.jsx)(`p`,{className:`error dialog-error`,children:J}),(0,F.jsx)(me,{feedback:X.message===`edit:${W.id}`?_(`editor.saved`):``,title:_(`citationLibrary.editTitle`,{key:W.citationKey}),value:Se,saving:H===W.citationKey,modal:!0,onChange:Ce,onClose:()=>{G(null),Y(``)},onSave:()=>void He(),t:_})]})}),Xe,Ze]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(C,{open:e,extraWide:!0,className:`citation-library-modal management-dialog`,title:_(`citationLibrary.title`),description:_(Q?`citationLibrary.description`:`citationLibraryHomeDescription`,{file:s}),onOpenChange:t,footer:(0,F.jsx)(`button`,{onClick:()=>t(!1),children:_(`common.close`)}),children:Ye}),Xe,Ze]})}function fe({entry:e,selected:t,alreadyInFile:n,saved:r,saving:i,saveFeedback:a,saveDisabled:o,importDisabled:s,deleting:c,onSave:l,onImport:u,onEdit:d,onTags:f,onDelete:m,t:g}){let _=`id`in e,v=_?e:null,y=j(e);return(0,F.jsxs)(`article`,{className:`citation-entry-card${t?` selected`:``}${n?` already-in-file`:``}`,title:n?g(`citationErrors.alreadyInFile`,{key:e.citationKey}):void 0,children:[(0,F.jsxs)(`div`,{className:`citation-entry-main`,children:[(0,F.jsxs)(`div`,{className:`citation-entry-heading`,children:[(0,F.jsx)(`code`,{children:e.citationKey}),(0,F.jsxs)(`span`,{children:[`@`,e.entryType]}),y&&(0,F.jsx)(`span`,{className:`citation-entry-venue`,title:y,children:y}),r&&(0,F.jsxs)(`em`,{children:[(0,F.jsx)(p,{size:11}),g(`citationLibrary.savedLabel`)]})]}),(0,F.jsx)(`strong`,{title:e.title||g(`citationLibrary.untitled`),children:e.title||g(`citationLibrary.untitled`)}),(0,F.jsxs)(`p`,{children:[e.authors||g(`citationLibrary.authorUnknown`),e.year&&(0,F.jsxs)(`span`,{children:[` · `,e.year]})]}),v&&v.tags.length>0&&(0,F.jsx)(`div`,{className:`citation-entry-tags`,children:v.tags.map(e=>(0,F.jsxs)(`span`,{className:`citation-tag-pill tag-${e.color}`,children:[(0,F.jsx)(`span`,{className:`citation-tag-dot`}),e.name]},e.id))})]}),(0,F.jsxs)(`div`,{className:`citation-entry-actions`,children:[l&&(0,F.jsx)(h,{iconSize:13,saving:i||o,feedback:a,onClick:l,children:g(i?`citationLibrary.saving`:r?`citationLibrary.update`:`citationLibrary.save`)}),u&&(0,F.jsxs)(`button`,{type:`button`,disabled:s||n,title:n?g(`citationErrors.alreadyInFile`,{key:e.citationKey}):g(s?`citationLibrary.importRequiresWrite`:`citationLibrary.importToFile`),onClick:()=>void u(),children:[(0,F.jsx)(N,{size:13}),g(`citationLibrary.import`)]}),(0,F.jsx)(L,{citationKey:e.citationKey,bibtex:e.bibtex,deleting:c,onTags:v?f:void 0,onEdit:_?d:void 0,onDelete:_?m:void 0})]})]})}function pe({entry:e,tags:t,selectedIds:n,saving:r,feedback:i,modal:a=!1,onClose:s,onToggle:c,onSave:l,t:u}){let d=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`citation-tag-choice-list`,children:t.length===0?(0,F.jsx)(`span`,{className:`muted`,children:u(`citationLibrary.noTagsToAssign`)}):t.map(e=>(0,F.jsxs)(`label`,{children:[(0,F.jsx)(`input`,{type:`checkbox`,disabled:r,checked:n.includes(e.id),onChange:()=>c(e.id)}),(0,F.jsx)(`span`,{className:`citation-tag-dot tag-${e.color}`}),e.name]},e.id))}),(0,F.jsxs)(`div`,{className:`citation-edit-actions`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:s,children:u(`common.cancel`)}),(0,F.jsx)(h,{saving:r,feedback:i,disabled:t.length===0,onClick:l,children:u(`citationLibrary.saveTags`)})]})]});return a?(0,F.jsx)(`div`,{className:`citation-modal-form`,children:d}):(0,F.jsxs)(`div`,{className:`citation-tag-editor`,children:[(0,F.jsxs)(`div`,{className:`citation-edit-header`,children:[(0,F.jsx)(`strong`,{children:u(`citationLibrary.tagsTitle`,{key:e.citationKey})}),(0,F.jsx)(`button`,{type:`button`,"aria-label":u(`common.close`),onClick:s,children:(0,F.jsx)(o,{size:15})})]}),d]})}function me({title:e,value:t,saving:n,feedback:r,modal:i=!1,onChange:a,onClose:s,onSave:c,t:l}){let u=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`textarea`,{autoFocus:!i,disabled:n,value:t,onChange:e=>a(e.target.value),spellCheck:!1,rows:12}),(0,F.jsxs)(`div`,{className:`citation-edit-actions`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:s,children:l(`common.cancel`)}),(0,F.jsx)(h,{saving:n,feedback:r,disabled:!t.trim(),onClick:c,children:l(`common.save`)})]})]});return i?(0,F.jsx)(`div`,{className:`citation-modal-form citation-edit-panel`,children:u}):(0,F.jsxs)(`div`,{className:`citation-edit-panel`,children:[(0,F.jsxs)(`div`,{className:`citation-edit-header`,children:[(0,F.jsx)(`strong`,{children:e}),(0,F.jsx)(`button`,{type:`button`,"aria-label":l(`common.close`),onClick:s,children:(0,F.jsx)(o,{size:15})})]}),u]})}export{R as CitationLibraryDialog};
@@ -0,0 +1,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./AvatarSettingsDialog-C2TACfvP.js","./rolldown-runtime-XKyaHtl9.js","./react-DUEFWlB7.js","./relativeTime-BR0CVAvz.js","./basePath-B5-c90eh.js","./index-DCwfhKK9.js","./i18nInstance-CIMFwH0l.js","./i18n-DF6keNBA.js","./vite-runtime-CRzLMJPS.js","./index-SVNFLCYh.css","./check-BRlv1lrZ.js","./SaveButton-DkyoEu6j.js","./search-n-2tBATf.js","./SystemMetricsDialog-C6RVZdJZ.js","./clock-3-Fb1_e3ec.js","./info-DNSAs0_-.js","./refresh-cw-DuLtxWBX.js","./CitationLibraryDialog-BdU9nbgG.js","./chevron-up-krb7w67X.js","./tags-Dy96boLq.js","./plus-Dfkyfvvy.js","./dist-CMYWzCHL.js","./SuccessNotice-ubBtzzi_.js","./TagColorSelect-xbc2H5ou.js","./citationLibrary-BzlqZiFU.js","./AdminUsers-CuYfWnEk.js","./user-plus-3oJZJXHW.js","./AgentManagement-jY_BF6Qy.js","./arrow-down-B6T7Z6IO.js","./AgentIcon-ClP5dPRL.js","./AgentIcon-DxrC-zx_.css","./TagManagementDialog-8pZUVaEI.js","./ProjectIconPickerDialog-vi_HwlCS.js","./GitHubAccountDialog-DdKiE3pw.js","./GitHubIcon-Cjli8pd_.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{i as n,t as r}from"./react-DUEFWlB7.js";import{n as i,t as a}from"./i18n-DF6keNBA.js";import{r as o,t as s}from"./basePath-B5-c90eh.js";import{t as c}from"./vite-runtime-CRzLMJPS.js";import{$ as l,B as u,C as d,D as f,F as p,G as m,H as h,I as g,J as _,K as v,L as ee,M as te,N as ne,P as y,Q as re,R as ie,T as b,U as x,V as ae,W as oe,X as se,Y as ce,Z as le,at as ue,b as de,et as fe,f as pe,i as me,it as he,n as ge,nt as _e,o as ve,q as ye,r as be,rt as xe,t as Se,tt as Ce,w as we,y as Te,z as S}from"./relativeTime-BR0CVAvz.js";import{n as Ee,t as De}from"./tags-Dy96boLq.js";import{n as Oe,r as ke,t as Ae}from"./GitHubIcon-Cjli8pd_.js";import{t as je}from"./hard-drive-CBmnJ2xS.js";import{n as Me,t as Ne}from"./terminal-C0xh8jVR.js";import{C,D as Pe,E as w,S as Fe,a as Ie,b as T,c as Le,i as Re,j as ze,r as Be,s as Ve,t as E,x as He,y as Ue}from"./index-DCwfhKK9.js";var We={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};We.node;var Ge=T(We),D={name:`archive-restore`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]};D.node;var Ke=T(D),O={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};O.node;var qe=T(O),Je={name:`arrow-down-up`,size:24,node:[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`m21 8-4-4-4 4`,key:`1c9v7m`}],[`path`,{d:`M17 4v16`,key:`7dpous`}]]};Je.node;var Ye=T(Je),Xe={name:`arrow-right-left`,size:24,node:[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]};Xe.node;var Ze=T(Xe),Qe={name:`atom`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`path`,{d:`M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z`,key:`1l2ple`}],[`path`,{d:`M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z`,key:`1wam0m`}]]};Qe.node;var $e=T(Qe),k={name:`beaker`,size:24,node:[[`path`,{d:`M4.5 3h15`,key:`c7n0jr`}],[`path`,{d:`M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3`,key:`m1uhx7`}],[`path`,{d:`M6 14h12`,key:`4cwo0f`}]]};k.node;var et=T(k),tt={name:`bell-off`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]};tt.node;var nt=T(tt),rt={name:`bookmark`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};rt.node;var it=T(rt),A={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};A.node;var at=T(A),ot={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`]};ot.node;var j=T(ot),M={name:`brain-circuit`,size:24,node:[[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 012 2v1`,key:`6s3bw4`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M12 9a4.17 4.17 0 01-3 4`,key:`13l7kh`}],[`path`,{d:`M16 8V5a2 2 0 012-2`,key:`gais5y`}],[`path`,{d:`M6 18a4 4 0 01-2-7.465`,key:`1y2m15`}],[`path`,{d:`M6.004 5.125a4 4 0 00-2.526 5.77`,key:`3cw1ss`}],[`path`,{d:`M6.294 6.294A3 3 0 1112 5v13a4 4 0 11-7.967-.518`,key:`m2z1wm`}],[`circle`,{cx:`16`,cy:`13`,r:`0.5`,fill:`currentColor`,key:`9zzywh`}],[`circle`,{cx:`18`,cy:`3`,r:`0.5`,fill:`currentColor`,key:`i2xui6`}],[`circle`,{cx:`20`,cy:`21`,r:`0.5`,fill:`currentColor`,key:`1dobdp`}],[`circle`,{cx:`20`,cy:`8`,r:`0.5`,fill:`currentColor`,key:`r9nqlq`}]]};M.node;var st=T(M),ct={name:`brain`,size:24,node:[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4`,key:`5nuw1p`}],[`path`,{d:`M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294`,key:`18ldcf`}],[`path`,{d:`M17.996 5.125a4 4 0 012.526 5.77`,key:`1sdu8q`}],[`path`,{d:`M18 18a4 4 0 002-7.465`,key:`7xqqvr`}],[`path`,{d:`M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517`,key:`t46ysz`}],[`path`,{d:`M6 18a4 4 0 01-2-7.465`,key:`1y2m15`}],[`path`,{d:`M6.004 5.125a4 4 0 00-2.526 5.77`,key:`3cw1ss`}]]};ct.node;var lt=T(ct),ut={name:`calculator`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]};ut.node;var dt=T(ut),N={name:`calendar-days`,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`}],[`path`,{d:`M8 13h.01`,key:`1sbv64`}],[`path`,{d:`M12 13h.01`,key:`y0uutt`}],[`path`,{d:`M16 13h.01`,key:`wip0gl`}],[`path`,{d:`M8 17h.01`,key:`p3bg7i`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M16 17h.01`,key:`ql8jdd`}]]};N.node;var ft=T(N),pt={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};pt.node;var P=T(pt),mt={name:`chart-line`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`m19 9-5 5-4-4-3 3`,key:`2osh9i`}]],aliases:[`line-chart`]};mt.node;var F=T(mt),ht={name:`chart-no-axes-combined`,size:24,node:[[`path`,{d:`M12 16v5`,key:`zza2cw`}],[`path`,{d:`M16 14.639V21`,key:`1s85h0`}],[`path`,{d:`M20 10.656V21`,key:`q45596`}],[`path`,{d:`m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15`,key:`1fw8x9`}],[`path`,{d:`M4 18.463V21`,key:`1otddq`}],[`path`,{d:`M8 14.656V21`,key:`1t2idw`}]]};ht.node;var gt=T(ht),_t={name:`chart-pie`,size:24,node:[[`path`,{d:`M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z`,key:`pzmjnu`}],[`path`,{d:`M21.21 15.89A10 10 0 1 1 8 2.83`,key:`k2fpak`}]],aliases:[`pie-chart`]};_t.node;var vt=T(_t),yt={name:`chart-scatter`,size:24,node:[[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}],[`circle`,{cx:`18.5`,cy:`5.5`,r:`.5`,fill:`currentColor`,key:`lysivs`}],[`circle`,{cx:`11.5`,cy:`11.5`,r:`.5`,fill:`currentColor`,key:`byv1b8`}],[`circle`,{cx:`7.5`,cy:`16.5`,r:`.5`,fill:`currentColor`,key:`nkw3mc`}],[`circle`,{cx:`17.5`,cy:`14.5`,r:`.5`,fill:`currentColor`,key:`1gjh6j`}],[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}]],aliases:[`scatter-chart`]};yt.node;var I=T(yt),L={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};L.node;var bt=T(L),xt={name:`circuit-board`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M11 9h4a2 2 0 0 0 2-2V3`,key:`1ve2rv`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`M7 21v-4a2 2 0 0 1 2-2h4`,key:`1fwkro`}],[`circle`,{cx:`15`,cy:`15`,r:`2`,key:`3i40o0`}]]};xt.node;var St=T(xt),R={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};R.node;var Ct=T(R),wt={name:`code-xml`,size:24,node:[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]],aliases:[`code-2`]};wt.node;var z=T(wt),Tt={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};Tt.node;var Et=T(Tt),B={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};B.node;var Dt=T(B),V={name:`dna`,size:24,node:[[`path`,{d:`m10 16 1.5 1.5`,key:`11lckj`}],[`path`,{d:`m14 8-1.5-1.5`,key:`1ohn8i`}],[`path`,{d:`M15 2c-1.798 1.998-2.518 3.995-2.807 5.993`,key:`80uv8i`}],[`path`,{d:`m16.5 10.5 1 1`,key:`696xn5`}],[`path`,{d:`m17 6-2.891-2.891`,key:`xu6p2f`}],[`path`,{d:`M2 15c6.667-6 13.333 0 20-6`,key:`1pyr53`}],[`path`,{d:`m20 9 .891.891`,key:`3xwk7g`}],[`path`,{d:`M3.109 14.109 4 15`,key:`q76aoh`}],[`path`,{d:`m6.5 12.5 1 1`,key:`cs35ky`}],[`path`,{d:`m7 18 2.891 2.891`,key:`1sisit`}],[`path`,{d:`M9 22c1.798-1.998 2.518-3.995 2.807-5.993`,key:`q3hbxp`}]]};V.node;var Ot=T(V),kt={name:`earth`,size:24,node:[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]],aliases:[`globe-2`]};kt.node;var H=T(kt),At={name:`file-chart-column-increasing`,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:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M12 18v-4`,key:`q1q25u`}],[`path`,{d:`M16 18v-6`,key:`15y0np`}]],aliases:[`file-bar-chart`]};At.node;var jt=T(At),Mt={name:`file-pen-line`,size:24,node:[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`,key:`ukzhwg`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`,key:`1klhew`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`,key:`rxaxab`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]],aliases:[`file-signature`]};Mt.node;var Nt=T(Mt),Pt={name:`file-stack`,size:24,node:[[`path`,{d:`M11 21a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1`,key:`likhh7`}],[`path`,{d:`M16 16a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1`,key:`17ky3x`}],[`path`,{d:`M21 6a2 2 0 0 0-.586-1.414l-2-2A2 2 0 0 0 17 2h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1z`,key:`1hyeo0`}]]};Pt.node;var Ft=T(Pt),It={name:`flask-conical`,size:24,node:[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]};It.node;var Lt=T(It),Rt={name:`folder-archive`,size:24,node:[[`circle`,{cx:`15`,cy:`19`,r:`2`,key:`u2pros`}],[`path`,{d:`M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1`,key:`1jj40k`}],[`path`,{d:`M15 11v-1`,key:`cntcp`}],[`path`,{d:`M15 17v-2`,key:`1279jj`}]]};Rt.node;var zt=T(Rt),U={name:`folder-kanban`,size:24,node:[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]};U.node;var W=T(U),Bt={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};Bt.node;var Vt=T(Bt),G={name:`graduation-cap`,size:24,node:[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]};G.node;var K=T(G),Ht={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Ht.node;var q=T(Ht),Ut={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};Ut.node;var J=T(Ut),Wt={name:`library`,size:24,node:[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]};Wt.node;var Gt=T(Wt),Kt={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};Kt.node;var qt=T(Kt),Y={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Y.node;var X=T(Y),Z={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};Z.node;var Jt=T(Z),Yt={name:`microscope`,size:24,node:[[`path`,{d:`M6 18h8`,key:`1borvv`}],[`path`,{d:`M3 22h18`,key:`8prr45`}],[`path`,{d:`M14 22a7 7 0 1 0 0-14h-1`,key:`1jwaiy`}],[`path`,{d:`M9 14h2`,key:`197e7h`}],[`path`,{d:`M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z`,key:`1bmzmy`}],[`path`,{d:`M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3`,key:`1drr47`}]]};Yt.node;var Xt=T(Yt),Zt={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};Zt.node;var Qt=T(Zt),$t={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};$t.node;var en=T($t),tn={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};tn.node;var nn=T(tn),rn={name:`newspaper`,size:24,node:[[`path`,{d:`M15 18h-5`,key:`95g1m2`}],[`path`,{d:`M18 14h-8`,key:`sponae`}],[`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0v-9a2 2 0 0 1 2-2h2`,key:`39pd36`}],[`rect`,{width:`8`,height:`4`,x:`10`,y:`6`,rx:`1`,key:`aywv1n`}]]};rn.node;var an=T(rn),on={name:`notebook-pen`,size:24,node:[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]};on.node;var sn=T(on),cn={name:`palette`,size:24,node:[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]};cn.node;var ln=T(cn),un={name:`pen-tool`,size:24,node:[[`path`,{d:`m18 13-.654-4.736a4 4 0 00-2.756-3.266l-9.163-2.9a2 2 0 00-2.017.493l-.82.819a2 2 0 00-.492 2.017l2.9 9.163a4 4 0 003.266 2.756L13 18`,key:`93nyr4`}],[`path`,{d:`M18.648 12.352a1.205 1.205 0 011.704 0l1.296 1.296a1.205 1.205 0 010 1.704l-6.296 6.296a1.205 1.205 0 01-1.704 0l-1.296-1.296a1.205 1.205 0 010-1.704z`,key:`lnux7s`}],[`path`,{d:`m3 3 6.586 6.586`,key:`1igwcn`}],[`circle`,{cx:`11`,cy:`11`,r:`2`,key:`xmgehs`}]]};un.node;var dn=T(un),fn={name:`presentation`,size:24,node:[[`path`,{d:`M2 3h20`,key:`91anmk`}],[`path`,{d:`M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3`,key:`2k9sn8`}],[`path`,{d:`m7 21 5-5 5 5`,key:`bip4we`}]]};fn.node;var pn=T(fn),mn={name:`quote`,size:24,node:[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]};mn.node;var hn=T(mn),gn={name:`regex`,size:24,node:[[`path`,{d:`M17 3v10`,key:`15fgeh`}],[`path`,{d:`m12.67 5.5 8.66 5`,key:`1gpheq`}],[`path`,{d:`m12.67 10.5 8.66-5`,key:`1dkfa6`}],[`path`,{d:`M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z`,key:`swwfx4`}]]};gn.node;var _n=T(gn),vn={name:`rocket`,size:24,node:[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]};vn.node;var yn=T(vn),bn={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};bn.node;var xn=T(bn),Sn={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};Sn.node;var Cn=T(Sn),wn={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};wn.node;var Tn=T(wn),En={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};En.node;var Dn=T(En),On={name:`sticky-note`,size:24,node:[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]};On.node;var kn=T(On),An={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};An.node;var jn=T(An),Mn={name:`target`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]};Mn.node;var Nn=T(Mn),Pn={name:`telescope`,size:24,node:[[`path`,{d:`m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44`,key:`k4qptu`}],[`path`,{d:`m13.56 11.747 4.332-.924`,key:`19l80z`}],[`path`,{d:`m16 21-3.105-6.21`,key:`7oh9d`}],[`path`,{d:`M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z`,key:`m7xp4m`}],[`path`,{d:`m6.158 8.633 1.114 4.456`,key:`74o979`}],[`path`,{d:`m8 21 3.105-6.21`,key:`1fvxut`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}]]};Pn.node;var Fn=T(Pn),In={name:`test-tube-diagonal`,size:24,node:[[`path`,{d:`M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3`,key:`1ub6xw`}],[`path`,{d:`m16 2 6 6`,key:`1gw87d`}],[`path`,{d:`M12 16H4`,key:`1cjfip`}]],aliases:[`test-tube-2`]};In.node;var Ln=T(In),Rn={name:`test-tubes`,size:24,node:[[`path`,{d:`M9 2v17.5A2.5 2.5 0 0 1 6.5 22A2.5 2.5 0 0 1 4 19.5V2`,key:`1hjrqt`}],[`path`,{d:`M20 2v17.5a2.5 2.5 0 0 1-2.5 2.5a2.5 2.5 0 0 1-2.5-2.5V2`,key:`16lc8n`}],[`path`,{d:`M3 2h7`,key:`7s29d5`}],[`path`,{d:`M14 2h7`,key:`7sicin`}],[`path`,{d:`M9 16H4`,key:`1bfye3`}],[`path`,{d:`M20 16h-5`,key:`ddnjpe`}]]};Rn.node;var zn=T(Rn),Bn={name:`university`,size:24,node:[[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M18 12h.01`,key:`yjnet6`}],[`path`,{d:`M18 16h.01`,key:`plv8zi`}],[`path`,{d:`M22 7a1 1 0 0 0-1-1h-2a2 2 0 0 1-1.143-.359L13.143 2.36a2 2 0 0 0-2.286-.001L6.143 5.64A2 2 0 0 1 5 6H3a1 1 0 0 0-1 1v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2z`,key:`1ogmi3`}],[`path`,{d:`M6 12h.01`,key:`c2rlol`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}],[`circle`,{cx:`12`,cy:`10`,r:`2`,key:`1yojzk`}]],aliases:[`school-2`]};Bn.node;var Vn=T(Bn),Hn={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};Hn.node;var Un=T(Hn),Wn={name:`users-round`,size:24,node:[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]],aliases:[`users-2`]};Wn.node;var Gn=T(Wn),Kn={name:`workflow`,size:24,node:[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]};Kn.node;var qn=T(Kn),Q=t(n(),1),$=r(),Jn=[{value:`light`,icon:jn},{value:`dark`,icon:en},{value:`system`,icon:Qt}];function Yn(){let{t:e}=ze(),t=Be();return(0,$.jsx)(`div`,{className:`theme-switcher`,role:`group`,"aria-label":e(`theme.title`),children:Jn.map(({value:n,icon:r})=>(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":t===n,onClick:()=>E(n),children:[(0,$.jsx)(r,{"aria-hidden":!0,size:14}),(0,$.jsx)(`span`,{children:e(`theme.${n}`)})]},n))})}var Xn=(0,Q.lazy)(()=>c(()=>import(`./AvatarSettingsDialog-C2TACfvP.js`).then(e=>({default:e.AvatarSettingsDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url));function Zn({user:e,onGitHub:t,onSignOut:n,onUserChange:r}){let{t:a,i18n:o}=ze(),[s,c]=(0,Q.useState)(!1),[u,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),v=(0,Q.useRef)(!1),ee=(0,Q.useRef)(!1),te=(0,Q.useRef)(null),ne=(0,Q.useId)(),y=e.displayName||e.username,re=async()=>{if(!v.current){v.current=!0,h(!0),_(``);try{await n()}catch(e){_(C(e))}finally{v.current=!1,h(!1)}}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(d,{open:s,onOpenChange:e=>{c(e),e&&_(``)},children:[(0,$.jsx)(f,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`user-menu-trigger`,"aria-label":a(`account.menu`,{name:y}),children:[(0,$.jsx)(de,{userId:e.id,name:y,username:e.username,avatarStyle:e.avatarStyle,className:`user-menu-avatar`}),(0,$.jsx)(`span`,{className:`user-menu-name`,children:y}),(0,$.jsx)(Ce,{size:14,"aria-hidden":`true`})]})}),(0,$.jsx)(b,{children:(0,$.jsxs)(we,{ref:te,tabIndex:-1,className:`user-menu-content`,align:`end`,sideOffset:10,collisionPadding:12,"aria-label":a(`account.menu`,{name:y}),onOpenAutoFocus:e=>{e.preventDefault(),te.current?.focus()},onCloseAutoFocus:e=>{ee.current&&e.preventDefault(),ee.current=!1},children:[(0,$.jsxs)(`div`,{className:`user-menu-profile`,children:[(0,$.jsx)(de,{userId:e.id,name:y,username:e.username,avatarStyle:e.avatarStyle,className:`user-menu-avatar`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:y}),(0,$.jsxs)(`span`,{children:[`@`,e.username]})]}),(0,$.jsx)(`button`,{type:`button`,className:`user-menu-github`,"aria-label":a(`account.openGithubSettings`),"data-tooltip":a(`account.githubTitle`),onClick:()=>{ee.current=!0,c(!1),t()},children:(0,$.jsx)(Ae,{size:19})})]}),(0,$.jsxs)(`div`,{className:`user-menu-settings`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`user-menu-avatar-setting`,onClick:()=>{ee.current=!0,c(!1),p(!0)},children:[(0,$.jsxs)(`span`,{className:`user-menu-setting-label`,children:[(0,$.jsx)(Un,{size:16,"aria-hidden":!0}),a(`account.avatarTitle`)]}),(0,$.jsx)(l,{size:14,"aria-hidden":!0})]}),(0,$.jsxs)(`div`,{className:`user-menu-language`,children:[(0,$.jsxs)(`label`,{htmlFor:ne,children:[(0,$.jsx)(J,{size:16,"aria-hidden":`true`}),a(`common.language`)]}),(0,$.jsxs)(`div`,{className:`user-menu-language-select`,children:[(0,$.jsxs)(`select`,{id:ne,value:i(o.resolvedLanguage),onChange:e=>void o.changeLanguage(e.target.value),children:[(0,$.jsx)(`option`,{value:`en`,children:a(`common.languageEnglish`)}),(0,$.jsx)(`option`,{value:`zh`,children:a(`common.languageChinese`)}),(0,$.jsx)(`option`,{value:`zh-Hant`,children:a(`common.languageTraditionalChinese`)})]}),(0,$.jsx)(Ce,{size:13,"aria-hidden":`true`})]})]}),(0,$.jsxs)(`div`,{className:`user-menu-theme`,children:[(0,$.jsxs)(`span`,{className:`user-menu-setting-label`,children:[(0,$.jsx)(ln,{size:16,"aria-hidden":`true`}),a(`theme.title`)]}),(0,$.jsx)(Yn,{})]})]}),g&&(0,$.jsx)(`p`,{className:`user-menu-error`,role:`alert`,children:g}),(0,$.jsxs)(`button`,{type:`button`,className:`user-menu-signout`,disabled:m,"aria-busy":m,onClick:()=>void re(),children:[m?(0,$.jsx)(Ue,{size:16,className:`spin`,"aria-hidden":`true`}):(0,$.jsx)(X,{size:16,"aria-hidden":`true`}),a(`auth.logout`)]})]})})]}),u&&(0,$.jsx)(Re,{title:a(`account.avatarTitle`),onClose:()=>p(!1),children:(0,$.jsx)(Xn,{user:e,onClose:()=>p(!1),onSaved:e=>r?.(e)})})]})}var Qn={npm:`npm install --global texlite@latest
3
+ texlite restart`,docker:`git pull --ff-only
4
+ ./scripts/compose.sh pull
5
+ ./scripts/compose.sh up -d`};function $n({userId:e}){let{t}=ze(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(`npm`),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(``),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let e=new AbortController,t=!1,n=async()=>{if(!(document.visibilityState===`hidden`||t)){t=!0;try{let t=await w(`/api/admin/updates`,{signal:e.signal});if(e.signal.aborted||t.update?.latestVersion===p.current)return;r(t.update)}catch{}finally{t=!1}}};n();let i=window.setInterval(()=>{n()},18e5),a=()=>{document.visibilityState===`visible`&&n()};return document.addEventListener(`visibilitychange`,a),()=>{e.abort(),window.clearInterval(i),document.removeEventListener(`visibilitychange`,a)}},[e]);let m=async()=>{if(n&&!f.current){f.current=!0,l(!0),d(``);try{await w(`/api/admin/updates/dismiss`,{method:`POST`,body:JSON.stringify({version:n.latestVersion})}),p.current=n.latestVersion,r(e=>e?.latestVersion===n.latestVersion?null:e),a(!1)}catch(e){d(C(e))}finally{f.current=!1,l(!1)}}};return n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`update-notice`,role:`status`,children:[(0,$.jsx)(bt,{"aria-hidden":!0,size:17}),(0,$.jsx)(`span`,{children:t(`updates.available`,{version:n.latestVersion})}),(0,$.jsx)(`button`,{type:`button`,className:`update-notice-details`,onClick:()=>{s(n.method),a(!0)},children:t(`updates.howToUpdate`)}),(0,$.jsx)(`button`,{type:`button`,className:`update-notice-dismiss`,disabled:c,onClick:()=>void m(),"aria-label":t(`updates.dismiss`),title:t(`updates.dismiss`),children:(0,$.jsx)(te,{"aria-hidden":!0,size:16})})]}),u&&!i&&(0,$.jsx)(`p`,{className:`error`,role:`alert`,children:u}),(0,$.jsxs)(Le,{open:i,onOpenChange:a,title:t(`updates.title`),description:t(`updates.versions`,{current:n.currentVersion,latest:n.latestVersion}),footer:(0,$.jsxs)(`button`,{type:`button`,className:`update-dismiss-action`,disabled:c,onClick:()=>void m(),children:[(0,$.jsx)(nt,{"aria-hidden":!0,size:15}),t(`updates.dismiss`)]}),children:[(0,$.jsx)(`div`,{className:`update-methods`,role:`group`,"aria-label":t(`updates.method`),children:[`npm`,`docker`].map(e=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":o===e,"aria-controls":`update-instructions`,onClick:()=>s(e),children:e===`npm`?`npm`:`Docker`},e))}),(0,$.jsxs)(`div`,{id:`update-instructions`,children:[(0,$.jsx)(`p`,{className:`update-command-hint`,children:t(o===`npm`?`updates.npmHint`:`updates.dockerHint`)}),(0,$.jsx)(`pre`,{className:`update-commands`,children:(0,$.jsx)(`code`,{children:Qn[o]})}),(0,$.jsx)(`p`,{className:`muted update-command-hint`,children:t(o===`npm`?`updates.restartHint`:`updates.imageHint`)})]}),(0,$.jsx)(`div`,{className:`update-links`,children:(0,$.jsxs)(`a`,{href:`https://github.com/SWUFE-DB-Group/TexLite/releases`,target:`_blank`,rel:`noreferrer`,children:[t(`updates.releaseNotes`),(0,$.jsx)(ke,{"aria-hidden":!0,size:12})]})}),u&&(0,$.jsx)(`p`,{className:`error`,role:`alert`,children:u})]})]}):null}var er=`file-text.book-open.notebook-pen.book-marked.scroll-text.library.graduation-cap.presentation.image.folder-kanban.microscope.flask-conical.test-tube-diagonal.atom.dna.telescope.earth.map.languages.university.code-2.file-code-2.database.server.network.circuit-board.brain.brain-circuit.bot.shield-check.workflow.sigma.calculator.chart-no-axes-combined.line-chart.bar-chart-3.pie-chart.chart-scatter.file-spreadsheet.file-chart-column-increasing.lightbulb.rocket.target.sparkles.file-pen-line.file-stack.folder.folder-open.folder-archive.archive.bookmark.newspaper.notepad-text.sticky-note.pen-tool.quote.list-tree.file-search.beaker.test-tubes.folder-git-2.git-branch.terminal.braces.regex.cpu.hard-drive.cloud.users-round.calendar-days`.split(`.`),tr=new Set(er);function nr(e){return typeof e==`string`&&tr.has(e)}function rr(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||t.length>96?null:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(t)?t:null}var ir={"file-text":v,"book-open":_e,"notebook-pen":sn,"book-marked":xe,"scroll-text":ie,library:Gt,"graduation-cap":K,presentation:pn,image:q,"folder-kanban":W,microscope:Xt,"flask-conical":Lt,"test-tube-diagonal":Ln,atom:$e,dna:Ot,telescope:Fn,earth:H,map:Jt,languages:J,university:Vn,"code-2":z,"file-code-2":ce,database:Dt,server:Cn,network:nn,"circuit-board":St,brain:lt,"brain-circuit":st,bot:at,"shield-check":Tn,workflow:qn,sigma:Me,calculator:dt,"chart-no-axes-combined":gt,"line-chart":F,"bar-chart-3":P,"pie-chart":vt,"chart-scatter":I,"file-spreadsheet":ye,"file-chart-column-increasing":jt,lightbulb:qt,rocket:yn,target:Nn,sparkles:Dn,"file-pen-line":Nt,"file-stack":Ft,folder:Vt,"folder-open":m,"folder-archive":zt,archive:qe,bookmark:it,newspaper:an,"notepad-text":u,"sticky-note":kn,"pen-tool":dn,quote:hn,"list-tree":h,"file-search":_,beaker:et,"test-tubes":zn,"folder-git-2":Oe,"git-branch":x,terminal:Ne,braces:j,regex:_n,cpu:Et,"hard-drive":je,cloud:Ct,"users-round":Gn,"calendar-days":ft},ar=er.map(e=>({name:e}));function or(e){let t=Array.from(e.trim())[0];return t?t.toLocaleUpperCase():`?`}function sr({icon:e,fallback:t,size:n=18}){let r=nr(e)?ir[e]:null;if(r)return(0,$.jsx)(r,{"aria-hidden":`true`,size:n,strokeWidth:1.9});let i=rr(e);if(i){let e=`url(${s(`/api/project-icons/${encodeURIComponent(i)}`)})`;return(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`project-icon-external-glyph`,style:{maskImage:e,WebkitMaskImage:e}})}return(0,$.jsx)(`span`,{"aria-hidden":`true`,children:t})}function cr({icon:e,projectName:t,editable:n=!1,onEdit:r,editLabel:i,title:a,className:o=``}){let s=(0,$.jsx)(sr,{icon:e,fallback:or(t)}),c=`project-icon-avatar${n?` editable`:``}${o?` ${o}`:``}`;return n&&r?(0,$.jsx)(`button`,{type:`button`,className:c,title:i,"aria-label":i,onClick:r,children:s}):(0,$.jsx)(`span`,{className:c,title:a,"aria-hidden":`true`,children:s})}function lr({project:e,currentUser:t,showArchived:n,archiveBusy:r,menuOpen:i,t:a,variant:o,onToggleMenu:c,onCloseMenu:l,onAssignTags:u,onRename:d,onDuplicate:f,onArchive:p,onTransfer:m,onDelete:h}){let _=(0,Q.useRef)(null),v=e.permission===`owner`,ee=t.role===`admin`||t.canCreateProjects,te=e.ownerId===t.id,ne=e.permission===`owner`;(0,Q.useEffect)(()=>{if(!i)return;let e=e=>{e.target instanceof Node&&!_.current?.contains(e.target)&&l()},t=e=>{e.key===`Escape`&&l()};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[i,l]);let y=[{id:`tags`,label:a(`tags.assign`),icon:(0,$.jsx)(De,{"aria-hidden":!0,size:15}),section:`main`,onSelect:u},...v?[{id:`rename`,label:a(`projects.rename`),icon:(0,$.jsx)(S,{"aria-hidden":!0,size:15}),section:`main`,onSelect:d}]:[],...ee?[{id:`duplicate`,label:a(`projects.duplicate`),icon:(0,$.jsx)(Ee,{"aria-hidden":!0,size:15}),section:`main`,onSelect:f}]:[],{id:`download`,label:a(`projects.download`),icon:(0,$.jsx)(re,{"aria-hidden":!0,size:15}),section:`main`,href:s(`/api/projects/${e.id}/download`)},{id:`archive`,label:a(n?`projects.unarchive`:`projects.archive`),icon:n?(0,$.jsx)(Ke,{"aria-hidden":!0,size:15}):(0,$.jsx)(qe,{"aria-hidden":!0,size:15}),section:`main`,disabled:r,onSelect:p},...te?[{id:`transfer`,label:a(`projects.transfer`),icon:(0,$.jsx)(Ze,{"aria-hidden":!0,size:15}),section:`main`,onSelect:m}]:[],...ne?[{id:`delete`,label:a(`common.delete`),icon:(0,$.jsx)(g,{"aria-hidden":!0,size:15}),section:`danger`,onSelect:h}]:[]],ie=y.filter(e=>e.section===`main`),b=y.filter(e=>e.section===`danger`),x=e=>{e.disabled||(l(),e.onSelect?.())};return(0,$.jsxs)(`div`,{ref:_,className:`project-action-menu-root project-action-menu-${o}`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(`button`,{type:`button`,className:`project-action-menu-trigger`,"aria-label":a(`projects.projectActions`,{project:e.name}),"aria-expanded":i,"aria-controls":`project-actions-${e.id}`,onClick:e=>{e.stopPropagation(),c()},children:(0,$.jsx)(le,{"aria-hidden":!0,size:19})}),i&&(0,$.jsxs)(`div`,{id:`project-actions-${e.id}`,className:`project-action-menu`,role:`group`,"aria-label":a(`projects.projectActions`,{project:e.name}),children:[ie.map(e=>e.href?(0,$.jsxs)(`a`,{href:e.href,download:!0,onClick:e=>{e.stopPropagation(),l()},children:[e.icon,e.label]},e.id):(0,$.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:t=>{t.stopPropagation(),x(e)},children:[e.icon,e.label]},e.id)),b.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`project-action-menu-separator`,"aria-hidden":`true`}),b.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`danger`,onClick:t=>{t.stopPropagation(),x(e)},children:[e.icon,e.label]},e.id))]})]})]})}function ur({project:e,removing:t=!1,onRemovalEnd:n,currentUser:r,showArchived:i,archiveBusy:a,menuOpen:o,t:s,formatCreatedDate:c,formatUpdatedTime:l,formatExactTime:u,onOpenProject:d,onOpenMention:f,onToggleMenu:p,onCloseMenu:m,onAssignTags:h,onRename:g,onDuplicate:_,onArchive:v,onTransfer:ee,onDelete:te,onChooseIcon:ne}){let y=e.ownerDisplayName??e.ownerUsername??s(`projects.deletedUser`),re=e.lastModifiedDisplayName??e.lastModifiedUsername??s(`projects.deletedUser`);return(0,$.jsxs)(`article`,{ref:t?be:void 0,inert:t?!0:void 0,"aria-hidden":t?!0:void 0,className:`project-card project-list-row${e.ownerId===r.id?` owned-project`:``}${o?` project-list-menu-open`:``}${t?` deletion-exit`:``}`,onAnimationEnd:e=>{e.target===e.currentTarget&&t&&n?.()},onClick:e=>{e.target===e.currentTarget&&d()},children:[(0,$.jsx)(cr,{icon:e.icon,projectName:e.name,title:e.name,editable:e.permission===`owner`,editLabel:s(`projectIcons.change`),onEdit:ne,className:`project-list-avatar`}),(0,$.jsx)(`span`,{className:`project-list-summary`,children:(0,$.jsx)(`button`,{type:`button`,className:`project-list-cell-open project-list-summary-open`,onClick:d,"aria-label":s(`projects.openProject`,{project:e.name}),children:(0,$.jsxs)(`span`,{className:`project-list-title-line`,children:[(0,$.jsx)(`strong`,{className:`project-list-title`,title:e.name,children:e.name}),!!(e.unresolvedCommentCount&&e.unresolvedCommentCount>0)&&(0,$.jsxs)(`span`,{className:`project-comments-badge unresolved`,title:s(`projects.unresolvedCommentsTooltip`,{count:e.commentCount??e.unresolvedCommentCount,unresolved:e.unresolvedCommentCount,total:e.commentCount??e.unresolvedCommentCount}),children:[(0,$.jsx)(ae,{"aria-hidden":!0,size:10}),(0,$.jsx)(`span`,{children:s(`projects.unresolvedCount`,{count:e.unresolvedCommentCount})})]}),e.tags?.length>0&&(0,$.jsx)(`span`,{className:`project-list-tags`,children:e.tags.map(e=>(0,$.jsx)(`span`,{className:`tag tag-${e.color} project-list-tag`,title:e.name,children:e.name},e.id))})]})})}),(0,$.jsxs)(`button`,{type:`button`,className:`project-list-cell-open project-list-owner`,onClick:d,title:y,"aria-label":s(`projects.openProject`,{project:e.name}),children:[(0,$.jsxs)(`span`,{className:`sr-only`,children:[s(`projects.owner`),`: `]}),y]}),(0,$.jsxs)(`button`,{type:`button`,className:`project-list-cell-open project-list-created`,onClick:d,title:u(e.createdAt),"aria-label":s(`projects.openProject`,{project:e.name}),children:[(0,$.jsxs)(`span`,{className:`sr-only`,children:[s(`projects.created`),`: `]}),(0,$.jsx)(`time`,{dateTime:e.createdAt,children:c(e.createdAt)})]}),(0,$.jsxs)(`button`,{type:`button`,className:`project-list-cell-open project-list-modified`,onClick:d,title:u(e.updatedAt),"aria-label":s(`projects.openProject`,{project:e.name}),children:[(0,$.jsxs)(`span`,{className:`sr-only`,children:[s(`projects.modified`),`: `]}),(0,$.jsx)(`time`,{dateTime:e.updatedAt,children:l(e.updatedAt)}),(0,$.jsx)(`small`,{children:s(`projects.byUser`,{user:re})})]}),e.unreadMentionCount&&e.unreadMentionCount>0?(0,$.jsxs)(`button`,{className:`project-mentions-badge project-list-mentions`,type:`button`,title:s(`projects.unreadMentionsTooltip`,{count:e.unreadMentionCount}),onClick:f,children:[(0,$.jsx)(he,{"aria-hidden":!0,size:10}),(0,$.jsx)(`span`,{children:e.unreadMentionCount})]}):(0,$.jsx)(`span`,{className:`project-list-mentions`}),(0,$.jsx)(lr,{variant:`list`,project:e,currentUser:r,showArchived:i,archiveBusy:a,menuOpen:o,t:s,onToggleMenu:p,onCloseMenu:m,onAssignTags:h,onRename:g,onDuplicate:_,onArchive:v,onTransfer:ee,onDelete:te})]})}var dr=e({Dashboard:()=>Sr}),fr=e=>e.id,pr=(0,Q.lazy)(()=>c(()=>import(`./SystemMetricsDialog-C6RVZdJZ.js`).then(e=>({default:e.SystemMetricsDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,14,15,16]),import.meta.url)),mr=(0,Q.lazy)(()=>c(()=>import(`./CitationLibraryDialog-BdU9nbgG.js`).then(e=>({default:e.CitationLibraryDialog})),__vite__mapDeps([17,1,2,3,4,5,6,7,8,9,10,18,11,19,20,12,21,22,23,24]),import.meta.url)),hr=(0,Q.lazy)(()=>c(()=>import(`./AdminUsers-CuYfWnEk.js`).then(e=>({default:e.AdminUsers})),__vite__mapDeps([25,1,2,3,4,5,6,7,8,9,12,26,21,22]),import.meta.url)),gr=(0,Q.lazy)(()=>c(()=>import(`./AgentManagement-jY_BF6Qy.js`).then(e=>({default:e.AgentManagement})),__vite__mapDeps([27,1,2,28,5,6,7,4,8,9,3,11,15,16,29,30,22]),import.meta.url)),_r=(0,Q.lazy)(()=>c(()=>import(`./TagManagementDialog-8pZUVaEI.js`).then(e=>({default:e.TagManagementDialog})),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,11,20,22,23,10,21]),import.meta.url)),vr=(0,Q.lazy)(()=>c(()=>import(`./ProjectIconPickerDialog-vi_HwlCS.js`).then(e=>({default:e.ProjectIconPickerDialog})),__vite__mapDeps([32,1,2,11,5,6,7,4,8,9,12]),import.meta.url)),yr=(0,Q.lazy)(()=>c(()=>import(`./GitHubAccountDialog-DdKiE3pw.js`).then(e=>({default:e.GitHubAccountDialog})),__vite__mapDeps([33,1,2,3,4,5,6,7,8,9,11,34,22]),import.meta.url));function br(e){return e instanceof Error&&e.name===`AbortError`}function xr(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Sr({site:e,user:t,initialData:n,onDataChange:r,onUser:i,onOpenProject:c}){let{t:u}=ze(),[d,f]=(0,Q.useState)(()=>n?.projects??[]),[h,g]=(0,Q.useState)(()=>n?.tags??[]),[_,v]=(0,Q.useState)(()=>n?.pagination??{page:1,pageSize:20,total:n?.projects.length??0,totalPages:+!!n?.projects.length}),[re,ie]=(0,Q.useState)(!!n),[b,x]=(0,Q.useState)(!1),[ce,le]=(0,Q.useState)(!1),de=ve(t.id),{showExecutionReminder:_e}=pe(),[ye,Ce]=(0,Q.useState)(!1),[we,S]=(0,Q.useState)(!1),[Ee,Oe]=(0,Q.useState)(!1),[ke,Ae]=(0,Q.useState)(``),[je,Me]=(0,Q.useState)(``),[Ne,T]=(0,Q.useState)(``),[Be,E]=(0,Q.useState)(``),[We,D]=(0,Q.useState)(``),[Ke,O]=(0,Q.useState)(``),[Je,Xe]=(0,Q.useState)(!1),[Qe,$e]=(0,Q.useState)(``),[k,et]=(0,Q.useState)(!1),[tt,nt]=(0,Q.useState)(!1),[rt,it]=(0,Q.useState)(``),[A,at]=(0,Q.useState)(null),[ot,j]=(0,Q.useState)(``),[M,st]=(0,Q.useState)(null),[ct,lt]=(0,Q.useState)(null),ut=(0,Q.useRef)(null),dt=(0,Q.useRef)(null),[N,pt]=(0,Q.useState)(!1),[P,mt]=(0,Q.useState)(``),[F,ht]=(0,Q.useState)(``),[gt,_t]=(0,Q.useState)(!1),[vt,yt]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(null),[bt,xt]=(0,Q.useState)(null),[St,R]=(0,Q.useState)(null),[Ct,wt]=(0,Q.useState)(``),[z,Tt]=(0,Q.useState)(!1),[Et,B]=(0,Q.useState)(null),[Dt,V]=(0,Q.useState)(``),[Ot,kt]=(0,Q.useState)(!1),[H,At]=(0,Q.useState)(null),[jt,Mt]=(0,Q.useState)(!1),[Nt,Pt]=(0,Q.useState)(null),[Ft,It]=(0,Q.useState)(null),[Lt,Rt]=(0,Q.useState)([]),[zt,U]=(0,Q.useState)(``),[W,Bt]=(0,Q.useState)(!1),[Vt,G]=(0,Q.useState)(``),[K,Ht]=(0,Q.useState)(()=>localStorage.getItem(o(`texlite-project-view`))===`list`?`list`:`grid`),[q,Ut]=(0,Q.useState)(()=>localStorage.getItem(o(`texlite-project-sort`))===`created`?`created`:`updated`),[J,Wt]=(0,Q.useState)(!1),[Gt,Kt]=(0,Q.useState)(``),[qt,Y]=(0,Q.useState)(null),[X,Z]=(0,Q.useState)(1),Jt=ge(),[Yt,Xt]=(0,Q.useState)(``),Zt=(0,Q.useRef)(0),Qt=(0,Q.useRef)(null),$t=(e,t,n,r,i)=>`${e?`archived`:`active`}|${t}|${n}|${r}|${i}`,en=$t(J,X,P,F,q),{entries:tn,finishExit:nn}=me(d,{scopeKey:`${en}|${K}|${b}|${we}`,deletedKey:Nt,keyOf:fr,duration:250}),rn=(e,t,n,r,i)=>{let a=new URLSearchParams({page:String(t),pageSize:`20`,sort:i});e&&a.set(`archived`,`1`),n.trim()&&a.set(`search`,n.trim()),r&&a.set(`tag`,r);let o=$t(e,t,n,r,i),s=++Zt.current;Qt.current?.abort();let c=new AbortController;return Qt.current=c,Promise.all([w(`/api/projects?${a.toString()}`,{signal:c.signal}),w(`/api/tags`,{signal:c.signal})]).then(([e,t])=>{s===Zt.current&&(f(e.projects),g(t.tags),v(e.pagination),Z(e.pagination.page),ie(!0),Xt(o))}).catch(e=>{!br(e)&&s===Zt.current&&Ae(C(e))}).finally(()=>{Qt.current===c&&(Qt.current=null)})};(0,Q.useEffect)(()=>(rn(J,X,P,F,q),()=>Qt.current?.abort()),[J,X,P,F,q]),(0,Q.useEffect)(()=>{re&&!J&&Yt===en&&r(d,h,_)},[d,h,_,re,Yt,en,J]),(0,Q.useEffect)(()=>{if(!gt)return;let e=e=>{e.target instanceof Node&&!dt.current?.contains(e.target)&&_t(!1)},t=e=>{e.key===`Escape`&&_t(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[gt]);let an=e=>{Y(null),Ht(e),localStorage.setItem(o(`texlite-project-view`),e)},on=e=>{Ut(e),Z(1),localStorage.setItem(o(`texlite-project-sort`),e)},sn=e=>{Wt(e),Z(1)},cn=e=>{ht(e),Z(1)},ln=async()=>{if(Qe.trim()&&!k){et(!0),Me(``);try{let{project:e}=await w(`/api/projects`,{method:`POST`,body:JSON.stringify({name:Qe})});Xe(!1),$e(``);let t=J||X!==1?d:[e,...d].slice(0,_.pageSize),n=J?_:{..._,total:_.total+1,totalPages:Math.ceil((_.total+1)/_.pageSize)};f(t),v(n),J||r(t,h,n),c(e.id)}catch(e){Me(C(e))}finally{et(!1)}}},un=async()=>{if(!A)return;let t=A,n=e.maxUploadSizeMB;if(t.size>n*1024*1024)return j(u(`errors.fileTooLarge`,{size:n}));pt(!0),j(``),st(`uploading`),lt(0);let i=new FormData;i.append(`file`,t);try{let{project:e}=await Pe(`/api/projects/import?name=${encodeURIComponent(rt.trim())}`,i,{onProgress:(e,t)=>{lt(t?Math.min(99,Math.floor(e/t*100)):null)},onUploadComplete:()=>{lt(null),st(`processing`)}}),t=J||X!==1?d:[e,...d].slice(0,_.pageSize),n=J?_:{..._,total:_.total+1,totalPages:Math.ceil((_.total+1)/_.pageSize)};f(t),v(n),J||r(t,h,n),nt(!1),at(null),it(``),c(e.id)}catch(e){j(C(e))}finally{pt(!1),st(null),lt(null)}},dn=e=>{N||(e&&!e.name.toLocaleLowerCase().endsWith(`.zip`)?j(u(`errors.zipOnly`)):(j(``),at(e),e&&!rt&&it(e.name.replace(/\.zip$/i,``))))},fn=async()=>{await w(`/api/auth/logout`,{method:`POST`}),i(null)},pn=async e=>{if(!I)return;let t=I.tags.some(t=>t.id===e.id);T(``);try{let n=(await w(t?`/api/projects/${I.id}/tags/${e.id}`:`/api/projects/${I.id}/tags`,t?{method:`DELETE`}:{method:`POST`,body:JSON.stringify({tagId:e.id})})).project;L(n),f(e=>e.map(e=>e.id===n.id?n:e))}catch(e){T(C(e))}},mn=e=>{g(t=>[...t,e].sort((e,t)=>e.name.localeCompare(t.name)))},hn=e=>{let t=t=>t.map(t=>t.id===e.id?e:t);g(e=>t(e).sort((e,t)=>e.name.localeCompare(t.name))),f(e=>e.map(e=>({...e,tags:t(e.tags)}))),L(e=>e?{...e,tags:t(e.tags)}:null)},gn=e=>{g(t=>t.filter(t=>t.id!==e)),f(t=>t.map(t=>({...t,tags:t.tags.filter(t=>t.id!==e)}))),L(t=>t?{...t,tags:t.tags.filter(t=>t.id!==e)}:null),ht(t=>t===e?``:t)},_n=async(e,t)=>{let n=await w(`/api/projects/${e}/icon`,{method:`PATCH`,body:JSON.stringify({icon:t})});f(e=>{let t=e.map(e=>e.id===n.project.id?n.project:e);return q===`updated`?t.sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)||e.name.localeCompare(t.name)):t})},vn=async()=>{if(St&&Ct.trim()&&!z){Tt(!0),E(``);try{let e=await w(`/api/projects/${St.id}`,{method:`PATCH`,body:JSON.stringify({name:Ct})});f(t=>t.map(t=>t.id===e.project.id?e.project:t)),R(null),wt(``)}catch(e){E(C(e))}finally{Tt(!1)}}},yn=async()=>{if(Et&&Dt.trim()){kt(!0),D(``);try{await w(`/api/projects/${Et.id}/duplicate`,{method:`POST`,body:JSON.stringify({name:Dt})}),B(null),V(``),rn(J,X,P,F,q)}catch(e){D(C(e))}finally{kt(!1)}}},bn=async()=>{if(H&&!jt){Mt(!0),O(``);try{await w(`/api/projects/${H.id}`,{method:`DELETE`}),Pt(H.id),f(e=>e.filter(e=>e.id!==H.id));let e=Math.max(0,_.total-1),t=Math.ceil(e/_.pageSize),n=t===0?1:Math.min(X,t),r={..._,page:n,total:e,totalPages:t};v(r),At(null),n===X?rn(J,X,P,F,q):Z(n)}catch(e){O(C(e))}finally{Mt(!1)}}},Sn=async e=>{It(e),U(``),Rt([]),G(``),Bt(!0);try{let t=await w(`/api/users`);Rt(t.users.filter(t=>t.id!==e.ownerId))}catch(e){G(C(e))}finally{Bt(!1)}},Cn=async()=>{if(Ft&&zt){Bt(!0),G(``);try{await w(`/api/projects/${Ft.id}/owner`,{method:`PUT`,body:JSON.stringify({userId:zt})}),It(null),U(``),rn(J,X,P,F,q)}catch(e){G(C(e))}finally{Bt(!1)}}},wn=async e=>{let t=!J;Kt(e.id),Ae(``);try{await w(`/api/projects/${e.id}/archive`,{method:t?`PUT`:`DELETE`});let n=d.filter(t=>t.id!==e.id);f(n);let i=Math.max(0,_.total-1),a=Math.ceil(i/_.pageSize),o=a===0?1:Math.min(X,a),s={..._,page:o,total:i,totalPages:a};v(s),J||r(n,h,s),o===X?rn(J,X,P,F,q):Z(o)}catch(e){Ae(C(e))}finally{Kt(``)}},Tn=async e=>{try{let t=(await w(`/api/projects/${e.id}/mentions?unread=1&limit=1`)).mentions[0];c(e.id,t?.id)}catch(e){Ae(C(e))}},En=e=>Te(e,a.resolvedLanguage),On=e=>Te(e,a.resolvedLanguage??`en`,{year:`numeric`,month:`2-digit`,day:`2-digit`}),kn=e=>Se(e,a.resolvedLanguage??`en`,Jt,(e,t)=>u(e,t));return(0,$.jsxs)(`div`,{className:`page`,children:[(0,$.jsxs)(`header`,{className:`topbar`,children:[(0,$.jsxs)(`a`,{className:`brand-link`,href:s(`/`),"aria-label":e.siteName,children:[(0,$.jsx)(Fe,{siteName:e.siteName}),(0,$.jsx)(`span`,{className:`site-title`,children:e.siteName})]}),(0,$.jsxs)(`div`,{className:`top-actions`,children:[t.role===`admin`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`ghost`,onClick:()=>Ce(!0),children:[(0,$.jsx)(Ge,{"aria-hidden":!0,size:14}),u(`metrics.title`)]}),(0,$.jsxs)(`button`,{className:`ghost${b?` top-return-action`:``}`,onClick:()=>{x(e=>!e),le(!1),S(!1)},children:[b?(0,$.jsx)(ue,{"aria-hidden":!0,size:14}):(0,$.jsx)(ne,{"aria-hidden":!0,size:14}),u(b?`users.back`:`users.manage`)]})]}),(0,$.jsxs)(`button`,{className:`ghost${we?` top-return-action`:``}`,onClick:()=>{x(!1),le(!1),S(e=>!e)},children:[we?(0,$.jsx)(ue,{"aria-hidden":!0,size:14}):(0,$.jsx)(xe,{"aria-hidden":!0,size:14}),u(we?`users.back`:`citationLibrary.title`)]}),(t.role===`admin`||de.visible)&&(0,$.jsxs)(`button`,{className:`ghost${ce?` top-return-action`:``}`,onClick:()=>{le(e=>!e),x(!1),S(!1)},children:[ce?(0,$.jsx)(ue,{size:14}):(0,$.jsx)(ee,{size:14}),u(ce?`agents.back`:t.role===`admin`?`agents.title`:`agents.tasks`),_e&&!ce&&de.activeCount>0&&(0,$.jsx)(`sup`,{className:`agent-active-count`,"aria-label":u(`agents.activeCount`,{count:de.activeCount}),children:de.activeCount})]}),(0,$.jsx)(Zn,{user:t,onGitHub:()=>Oe(!0),onSignOut:fn,onUserChange:i})]})]}),t.role===`admin`&&(0,$.jsx)(`div`,{className:`dashboard-update`,children:(0,$.jsx)($n,{userId:t.id},t.id)}),ce?(0,$.jsx)(`main`,{className:`dashboard`,children:(0,$.jsx)(Ie,{onClose:()=>le(!1),children:(0,$.jsx)(gr,{user:t,onBack:()=>le(!1)})})}):b?(0,$.jsx)(`main`,{className:`dashboard`,children:(0,$.jsx)(Ie,{onClose:()=>x(!1),children:(0,$.jsx)(hr,{currentUser:t,minPasswordLength:e.minPasswordLength,onBack:()=>x(!1)})})}):we?(0,$.jsx)(`main`,{className:`dashboard`,children:(0,$.jsx)(Ie,{onClose:()=>S(!1),children:(0,$.jsx)(mr,{page:!0,open:!0,onOpenChange:S,onBack:()=>S(!1),currentUserId:t.id,maxBibtexBytes:e.maxCitationBibtexBytes})})}):(0,$.jsxs)(`main`,{className:`dashboard`,children:[(0,$.jsxs)(`div`,{className:`section-title`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h1`,{children:[(0,$.jsx)(m,{"aria-hidden":!0,size:25}),u(`projects.title`)]}),(0,$.jsx)(`p`,{className:`muted`,children:t.canCreateProjects?u(`projects.subtitle`):u(`projects.restricted`)})]}),(0,$.jsxs)(`div`,{className:`section-actions`,children:[(0,$.jsxs)(`button`,{onClick:()=>yt(!0),children:[(0,$.jsx)(De,{"aria-hidden":!0,size:15}),u(`tags.manage`)]}),t.canCreateProjects&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{onClick:()=>{j(``),nt(!0)},children:[(0,$.jsx)(y,{"aria-hidden":!0,size:15}),u(`projects.upload`)]}),(0,$.jsxs)(`button`,{className:`primary`,onClick:()=>{Me(``),Xe(!0)},children:[(0,$.jsx)(oe,{"aria-hidden":!0,size:15}),u(`projects.new`)]})]})]})]}),ke&&(0,$.jsx)(`p`,{className:`error`,children:ke}),(0,$.jsxs)(`div`,{className:`project-catalog-layout`,children:[(0,$.jsxs)(`aside`,{ref:dt,className:`project-tag-sidebar${F?` has-active-filter`:``}`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`project-tag-toggle`,title:u(`projects.filterTags`),"aria-label":u(`projects.filterTags`),"aria-expanded":gt,"aria-controls":`dashboard-tag-filters`,onClick:()=>_t(e=>!e),children:[(0,$.jsxs)(`span`,{className:`project-tag-toggle-copy`,children:[(0,$.jsx)(De,{"aria-hidden":!0,size:15}),(0,$.jsx)(`span`,{children:u(`projects.filterTags`)})]}),(0,$.jsx)(l,{className:`project-tag-toggle-chevron`,"aria-hidden":!0,size:15})]}),gt&&(0,$.jsxs)(`div`,{id:`dashboard-tag-filters`,className:`project-tag-filters`,role:`group`,"aria-label":u(`projects.filterTags`),children:[(0,$.jsx)(`button`,{type:`button`,className:F?``:`active`,"aria-pressed":!F,onClick:()=>cn(``),children:u(`projects.allTags`)}),h.length>0?h.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:F===e.id?`active`:``,title:e.name,"aria-pressed":F===e.id,onClick:()=>cn(F===e.id?``:e.id),children:[(0,$.jsx)(Cr,{color:e.color}),(0,$.jsx)(`span`,{children:e.name})]},e.id)):(0,$.jsx)(`p`,{className:`project-tag-empty`,children:u(`tags.none`)})]})]}),(0,$.jsxs)(`div`,{className:`project-catalog-content`,children:[(0,$.jsxs)(`div`,{className:`project-toolbar`,children:[(0,$.jsx)(`input`,{type:`search`,placeholder:u(`projects.search`),value:P,onChange:e=>{mt(e.target.value),Z(1)}}),(0,$.jsxs)(`div`,{className:`project-scope`,role:`tablist`,"aria-label":u(`projects.scope`),children:[(0,$.jsxs)(`button`,{className:J?``:`active`,onClick:()=>sn(!1),role:`tab`,"aria-selected":!J,children:[(0,$.jsx)(m,{size:14}),u(`projects.active`)]}),(0,$.jsxs)(`button`,{className:J?`active`:``,onClick:()=>sn(!0),role:`tab`,"aria-selected":J,children:[(0,$.jsx)(qe,{size:14}),u(`projects.archived`)]})]}),(0,$.jsxs)(`label`,{className:`project-sort`,children:[(0,$.jsx)(Ye,{size:14}),(0,$.jsx)(`span`,{children:u(`projects.sortBy`)}),(0,$.jsxs)(`select`,{value:q,onChange:e=>on(e.target.value),children:[(0,$.jsx)(`option`,{value:`updated`,children:u(`projects.sortModified`)}),(0,$.jsx)(`option`,{value:`created`,children:u(`projects.sortCreated`)})]})]}),(0,$.jsxs)(`div`,{className:`view-toggle`,children:[(0,$.jsx)(`button`,{className:K===`grid`?`active`:``,onClick:()=>an(`grid`),title:u(`projects.grid`),children:`▦`}),(0,$.jsx)(`button`,{className:K===`list`?`active`:``,onClick:()=>an(`list`),title:u(`projects.list`),children:`☷`})]})]}),(0,$.jsxs)(`div`,{className:`project-grid ${K===`list`?`list-view`:``}${qt?` project-list-menu-active`:``}`,children:[K===`list`&&tn.length>0&&(0,$.jsxs)(`div`,{className:`project-list-header`,"aria-hidden":`true`,children:[(0,$.jsx)(`span`,{className:`project-list-header-avatar`}),(0,$.jsx)(`span`,{children:u(`projects.title`)}),(0,$.jsx)(`span`,{children:u(`projects.owner`)}),(0,$.jsx)(`span`,{className:`project-list-header-created`,children:u(`projects.created`)}),(0,$.jsx)(`span`,{children:u(`projects.modified`)}),(0,$.jsx)(`span`,{className:`project-list-header-mentions`,children:u(`projects.mentionsColumn`)}),(0,$.jsx)(`span`,{className:`project-list-header-actions`,children:u(`projects.actions`)})]}),K===`list`?tn.map(({item:e,removeAt:n})=>(0,$.jsx)(ur,{project:e,removing:n!==null,onRemovalEnd:()=>nn(e.id),currentUser:t,showArchived:J,archiveBusy:Gt===e.id,menuOpen:qt===e.id,t:u,formatCreatedDate:On,formatUpdatedTime:kn,formatExactTime:En,onOpenProject:()=>{Y(null),c(e.id)},onOpenMention:()=>void Tn(e),onToggleMenu:()=>Y(t=>t===e.id?null:e.id),onCloseMenu:()=>Y(t=>t===e.id?null:t),onAssignTags:()=>{T(``),L(e)},onRename:()=>{E(``),R(e),wt(e.name)},onDuplicate:()=>{D(``),B(e),V(`${e.name} (1)`)},onArchive:()=>void wn(e),onTransfer:()=>void Sn(e),onDelete:()=>{At(e),O(``)},onChooseIcon:()=>xt(e)},e.id)):tn.map(({item:e,removeAt:n})=>(0,$.jsxs)(`article`,{ref:n===null?void 0:be,inert:n!==null||void 0,"aria-hidden":n!==null||void 0,className:`project-card project-grid-card${e.ownerId===t.id?` owned-project`:``}${qt===e.id?` project-card-menu-open`:``}${n===null?``:` deletion-exit`}`,onAnimationEnd:t=>{t.target===t.currentTarget&&n!==null&&nn(e.id)},role:`button`,tabIndex:0,"aria-label":u(`projects.openProject`,{project:e.name}),onClick:()=>{Y(null),c(e.id)},onKeyDown:t=>{t.target!==t.currentTarget||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),Y(null),c(e.id))},children:[(0,$.jsxs)(`div`,{className:`project-card-meta-row`,children:[(0,$.jsxs)(`div`,{className:`project-card-badges`,children:[(0,$.jsx)(`span`,{className:`owner-badge`,title:e.ownerDisplayName??e.ownerUsername??u(`projects.deletedUser`),children:e.ownerDisplayName??e.ownerUsername??u(`projects.deletedUser`)}),!!(e.unreadMentionCount&&e.unreadMentionCount>0)&&(0,$.jsxs)(`button`,{className:`project-mentions-badge`,type:`button`,title:u(`projects.unreadMentionsTooltip`,{count:e.unreadMentionCount}),"aria-label":u(`projects.unreadMentionsTooltip`,{count:e.unreadMentionCount}),onClick:t=>{t.stopPropagation(),Tn(e)},children:[(0,$.jsx)(he,{"aria-hidden":!0,size:11}),(0,$.jsx)(`span`,{children:e.unreadMentionCount})]})]}),(0,$.jsx)(lr,{variant:`grid`,project:e,currentUser:t,showArchived:J,archiveBusy:Gt===e.id,menuOpen:qt===e.id,t:u,onToggleMenu:()=>Y(t=>t===e.id?null:e.id),onCloseMenu:()=>Y(t=>t===e.id?null:t),onAssignTags:()=>{T(``),L(e)},onRename:()=>{E(``),R(e),wt(e.name)},onDuplicate:()=>{D(``),B(e),V(`${e.name} (1)`)},onArchive:()=>void wn(e),onTransfer:()=>void Sn(e),onDelete:()=>{At(e),O(``)}})]}),(0,$.jsxs)(`div`,{className:`project-card-title-row`,children:[(0,$.jsx)(`span`,{className:`project-card-icon-control`,onClick:e.permission===`owner`?e=>e.stopPropagation():void 0,children:(0,$.jsx)(cr,{icon:e.icon,projectName:e.name,title:e.name,editable:e.permission===`owner`,editLabel:u(`projectIcons.change`),onEdit:()=>xt(e),className:`project-card-icon`})}),(0,$.jsx)(`strong`,{className:`project-card-title`,title:e.name,children:e.name})]}),(0,$.jsx)(`div`,{className:`project-card-tags`,"aria-label":u(`tags.assignTitle`,{project:e.name}),title:e.tags?.map(e=>e.name).join(`, `)||void 0,children:e.tags?.map(e=>(0,$.jsx)(`span`,{className:`tag tag-${e.color}`,title:e.name,children:e.name},e.id))}),(0,$.jsxs)(`dl`,{className:`project-meta`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`dt`,{className:`project-meta-created-label`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(ft,{"aria-hidden":!0,size:13}),u(`projects.created`)]}),!!(e.unresolvedCommentCount&&e.unresolvedCommentCount>0)&&(0,$.jsxs)(`span`,{className:`project-comments-badge unresolved`,title:u(`projects.unresolvedCommentsTooltip`,{count:e.commentCount??e.unresolvedCommentCount,unresolved:e.unresolvedCommentCount,total:e.commentCount??e.unresolvedCommentCount}),children:[(0,$.jsx)(ae,{"aria-hidden":!0,size:11}),(0,$.jsx)(`span`,{children:u(`projects.unresolvedCount`,{count:e.unresolvedCommentCount})})]})]}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`time`,{dateTime:e.createdAt,children:En(e.createdAt)})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`dt`,{children:[(0,$.jsx)(xn,{"aria-hidden":!0,size:13}),u(`projects.modified`)]}),(0,$.jsxs)(`dd`,{title:En(e.updatedAt),children:[(0,$.jsx)(`time`,{dateTime:e.updatedAt,children:kn(e.updatedAt)}),(0,$.jsxs)(`span`,{className:`project-modified-by`,children:[` · `,u(`projects.byUser`,{user:e.lastModifiedDisplayName??e.lastModifiedUsername??u(`projects.deletedUser`)})]})]})]})]})]},e.id)),tn.length===0&&(d.length===0?J?(0,$.jsxs)(`div`,{className:`project-empty project-empty-archived`,children:[(0,$.jsx)(`span`,{className:`project-empty-icon`,children:(0,$.jsx)(qe,{"aria-hidden":`true`,size:25,strokeWidth:1.5})}),(0,$.jsx)(`h2`,{children:u(`projects.noArchived`)}),(0,$.jsx)(`p`,{children:u(`projects.noArchivedDescription`)}),(0,$.jsxs)(`button`,{type:`button`,className:`project-empty-action`,onClick:()=>sn(!1),children:[(0,$.jsx)(ue,{"aria-hidden":`true`,size:14}),u(`projects.backToActive`)]})]}):(0,$.jsxs)(`div`,{className:`project-empty`,children:[(0,$.jsx)(`span`,{className:`project-empty-icon`,children:(0,$.jsx)(Dn,{size:28})}),(0,$.jsx)(`h2`,{children:u(`projects.emptyTitle`)}),(0,$.jsx)(`p`,{children:t.canCreateProjects?u(`projects.emptyDescription`):u(`projects.emptyRestricted`)})]}):(0,$.jsx)(`div`,{className:`empty`,children:u(`projects.noMatches`)}))]}),_.totalPages>1&&(0,$.jsxs)(`nav`,{className:`project-pagination`,"aria-label":u(`projects.pagination`),children:[(0,$.jsxs)(`button`,{disabled:_.page<=1,onClick:()=>Z(e=>Math.max(1,e-1)),title:u(`projects.previousPage`),children:[(0,$.jsx)(fe,{size:15}),u(`projects.previousPage`)]}),(0,$.jsx)(`span`,{children:u(`projects.pageOf`,{page:_.page,totalPages:_.totalPages,count:_.total})}),(0,$.jsxs)(`button`,{disabled:_.page>=_.totalPages,onClick:()=>Z(e=>Math.min(_.totalPages,e+1)),title:u(`projects.nextPage`),children:[(0,$.jsx)(l,{size:15}),u(`projects.nextPage`)]})]})]})]}),(0,$.jsx)(Le,{open:Je,title:u(`projects.new`),description:u(`projects.newDescription`),onOpenChange:e=>{(e||!k)&&(Xe(e),e||Me(``))},footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{disabled:k,onClick:()=>Xe(!1),children:u(`common.cancel`)}),(0,$.jsxs)(`button`,{className:`primary`,disabled:k||!Qe.trim(),"aria-busy":k,onClick:()=>void ln(),children:[k&&(0,$.jsx)(Ue,{className:`spin`,size:14}),u(k?`common.loading`:`common.create`)]})]}),children:(0,$.jsxs)($.Fragment,{children:[je&&(0,$.jsx)(`p`,{className:`error dialog-error`,children:je}),(0,$.jsxs)(`label`,{className:`form-field`,children:[u(`projects.name`),(0,$.jsx)(`input`,{autoFocus:!0,value:Qe,onChange:e=>{$e(e.target.value),Me(``)},onKeyDown:e=>{e.key===`Enter`&&ln()}})]})]})}),(0,$.jsx)(Le,{open:tt,title:u(`projects.upload`),description:u(`projects.uploadDescription`,{size:e.maxUploadSizeMB}),onOpenChange:e=>{(e||!N)&&(nt(e),e||j(``))},footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{disabled:N,onClick:()=>{nt(!1),j(``)},children:u(`common.cancel`)}),(0,$.jsxs)(`button`,{className:`primary`,disabled:!A||N,"aria-busy":N,onClick:()=>void un(),children:[N&&(0,$.jsx)(Ue,{className:`spin`,size:14}),u(N?M===`processing`?`projects.processing`:`projects.uploading`:`projects.import`)]})]}),children:(0,$.jsxs)(`div`,{className:`form-stack`,children:[ot&&(0,$.jsx)(`p`,{className:`error import-error`,children:ot}),(0,$.jsxs)(`div`,{className:`upload-picker${A?` has-file`:``}${N?` is-disabled`:``}`,onDragOver:e=>{e.preventDefault(),N||(e.dataTransfer.dropEffect=`copy`)},onDrop:e=>{e.preventDefault(),N||dn(e.dataTransfer.files[0]??null)},children:[(0,$.jsx)(`input`,{ref:ut,className:`sr-only`,type:`file`,accept:`.zip,application/zip`,disabled:N,onChange:e=>dn(e.target.files?.[0]??null)}),(0,$.jsx)(se,{size:34}),(0,$.jsxs)(`div`,{className:`upload-picker-copy`,children:[(0,$.jsx)(`strong`,{children:A?.name??u(`projects.chooseZip`)}),(0,$.jsx)(`span`,{children:A?u(`projects.selectedFileSize`,{size:xr(A.size)}):u(`projects.dropZip`)})]}),(0,$.jsxs)(`button`,{type:`button`,disabled:N,onClick:()=>ut.current?.click(),children:[(0,$.jsx)(y,{size:15}),u(`projects.browse`)]}),A&&(0,$.jsx)(`button`,{className:`upload-clear`,type:`button`,disabled:N,title:u(`projects.clearFile`),"aria-label":u(`projects.clearFile`),onClick:()=>{dn(null),ut.current&&(ut.current.value=``)},children:(0,$.jsx)(te,{size:14})})]}),(0,$.jsxs)(`label`,{className:`form-field`,children:[u(`projects.name`),(0,$.jsx)(`input`,{disabled:N,value:rt,onChange:e=>it(e.target.value)})]}),N&&(0,$.jsxs)(`div`,{className:`project-import-progress`,role:`status`,"aria-live":`polite`,children:[(0,$.jsxs)(`div`,{className:`project-import-progress-label`,children:[(0,$.jsx)(`span`,{children:u(M===`processing`?`projects.processing`:`projects.uploading`)}),M===`uploading`&&ct!==null&&(0,$.jsxs)(`small`,{"aria-hidden":`true`,children:[ct,`%`]})]}),(0,$.jsx)(`progress`,{"aria-label":u(`projects.uploadProgress`),max:100,value:M===`uploading`?ct??void 0:void 0}),M===`processing`&&(0,$.jsx)(`small`,{className:`import-progress-hint`,children:u(`projects.processingHint`)})]})]})}),vt&&(0,$.jsx)(Re,{title:u(`tags.manage`),onClose:()=>yt(!1),children:(0,$.jsx)(_r,{open:!0,onOpenChange:yt,onTagCreated:mn,onTagUpdated:hn,onTagDeleted:gn})}),bt&&(0,$.jsx)(Re,{title:u(`projectIcons.title`),onClose:()=>xt(null),children:(0,$.jsx)(vr,{project:bt,open:!0,onOpenChange:e=>{e||xt(null)},onSave:_n})}),(0,$.jsx)(Le,{open:!!I,title:u(`tags.assignTitle`,{project:I?.name??``}),description:u(`tags.assignDescription`),onOpenChange:e=>{e||(L(null),T(``))},footer:(0,$.jsx)(`button`,{onClick:()=>{L(null),T(``)},children:u(`common.close`)}),children:(0,$.jsxs)(`div`,{className:`tag-assignment-list`,children:[Ne&&(0,$.jsx)(`p`,{className:`error dialog-error`,children:Ne}),h.map(e=>(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:!!I?.tags.some(t=>t.id===e.id),onChange:()=>void pn(e)}),(0,$.jsx)(Cr,{color:e.color}),(0,$.jsx)(`span`,{children:e.name})]},e.id)),h.length===0&&(0,$.jsx)(`p`,{className:`muted`,children:u(`tags.empty`)})]})}),(0,$.jsx)(Le,{open:!!St,title:u(`projects.renameTitle`),onOpenChange:e=>{(e||!z)&&(e||(R(null),E(``)))},footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{disabled:z,onClick:()=>{R(null),E(``)},children:u(`common.cancel`)}),(0,$.jsxs)(`button`,{className:`primary`,disabled:z||!Ct.trim(),"aria-busy":z,onClick:()=>void vn(),children:[z&&(0,$.jsx)(Ue,{className:`spin`,size:14}),u(z?`common.loading`:`projects.rename`)]})]}),children:(0,$.jsxs)($.Fragment,{children:[Be&&(0,$.jsx)(`p`,{className:`error dialog-error`,children:Be}),(0,$.jsxs)(`label`,{className:`form-field`,children:[u(`projects.name`),(0,$.jsx)(`input`,{autoFocus:!0,value:Ct,onChange:e=>{wt(e.target.value),E(``)},onKeyDown:e=>{e.key===`Enter`&&vn()}})]})]})}),(0,$.jsx)(Le,{open:!!Et,title:u(`projects.duplicateTitle`),description:u(`projects.duplicateDescription`,{project:Et?.name??``}),onOpenChange:e=>{!e&&!Ot&&(B(null),V(``),D(``))},footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{disabled:Ot,onClick:()=>{B(null),V(``),D(``)},children:u(`common.cancel`)}),(0,$.jsx)(`button`,{className:`primary`,disabled:Ot||!Dt.trim(),onClick:()=>void yn(),children:u(Ot?`projects.duplicating`:`projects.duplicate`)})]}),children:(0,$.jsxs)($.Fragment,{children:[We&&(0,$.jsx)(`p`,{className:`error dialog-error`,children:We}),(0,$.jsxs)(`label`,{className:`form-field`,children:[u(`projects.name`),(0,$.jsx)(`input`,{autoFocus:!0,value:Dt,onChange:e=>{V(e.target.value),D(``)},onKeyDown:e=>{e.key===`Enter`&&yn()}})]})]})}),(0,$.jsx)(Le,{open:!!Ft,title:u(`projects.transferOwnership`),description:u(`projects.transferDescription`,{project:Ft?.name??``}),onOpenChange:e=>{!e&&!W&&(It(null),U(``),G(``))},footer:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{disabled:W,onClick:()=>{It(null),U(``),G(``)},children:u(`common.cancel`)}),(0,$.jsxs)(`button`,{className:`primary`,disabled:W||!zt,onClick:()=>void Cn(),children:[W?(0,$.jsx)(Ue,{className:`spin`,size:14}):(0,$.jsx)(Ze,{size:14}),u(`projects.transfer`)]})]}),children:(0,$.jsxs)(`div`,{className:`form-stack`,children:[Vt&&(0,$.jsx)(`p`,{className:`error dialog-error`,children:Vt}),(0,$.jsxs)(`label`,{className:`form-field`,children:[u(`projects.newOwner`),(0,$.jsxs)(`select`,{disabled:W||Lt.length===0,value:zt,onChange:e=>U(e.target.value),children:[(0,$.jsx)(`option`,{value:``,children:W?u(`common.loading`):Lt.length>0?u(`projects.chooseNewOwner`):u(`projects.noTransferUsers`)}),Lt.map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.displayName??e.username,` (@`,e.username,`)`]},e.id))]})]}),(0,$.jsxs)(`p`,{className:`warning`,children:[(0,$.jsx)(p,{size:15}),u(`projects.transferWarning`)]})]})}),(0,$.jsx)(Ve,{open:!!H,title:u(`projects.deleteTitle`),description:u(`projects.deleteDescription`,{project:H?.name??``}),confirmLabel:u(jt?`common.loading`:`common.delete`),danger:!0,busy:jt,error:Ke,onCancel:()=>{jt||(At(null),O(``))},onConfirm:()=>void bn()})]}),ye&&(0,$.jsx)(Re,{title:u(`metrics.title`),onClose:()=>Ce(!1),children:(0,$.jsx)(pr,{open:!0,onOpenChange:Ce})}),Ee&&(0,$.jsx)(Re,{title:u(`account.githubTitle`),onClose:()=>Oe(!1),children:(0,$.jsx)(yr,{open:!0,onOpenChange:Oe})}),(0,$.jsx)(He,{})]})}function Cr({color:e}){return(0,$.jsx)(`span`,{className:`tag-dot tag-${e}`})}export{Sr as Dashboard,nr as a,Ge as c,or as i,sr as n,rr as o,ar as r,Et as s,dr as t};
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{$ as r,U as i,tt as a,y as o}from"./relativeTime-BR0CVAvz.js";import{n as s,r as ee,t as c}from"./GitHubIcon-Cjli8pd_.js";import{t as l}from"./eye-B6AX_5uX.js";import{n as te,t as ne}from"./minus-TCBOakyi.js";import{t as re}from"./minimize-2-C8oL6PTV.js";import{t as ie}from"./plus-Dfkyfvvy.js";import{E as u,b as d,c as f,j as ae,y as p}from"./index-DCwfhKK9.js";import{L as oe}from"./ProjectWorkspace-1UOdyfBq.js";var m={name:`cloud-upload`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]],aliases:[`upload-cloud`]};m.node;var se=d(m),h={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};h.node;var ce=d(h),g={name:`git-commit-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]],aliases:[`git-commit`]};g.node;var _=d(g),v={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};v.node;var le=d(v),y=e(t(),1),b=n();function x({open:e,project:t,onOpenChange:n,onBeforeMutation:d}){let{t:m,i18n:h}=ae(),[g,v]=(0,y.useState)(null),[x,C]=(0,y.useState)([]),[w,T]=(0,y.useState)(()=>S(t.name)),[E,de]=(0,y.useState)(!0),[D,O]=(0,y.useState)(``),[k,A]=(0,y.useState)(null),[j,M]=(0,y.useState)(null),[N,P]=(0,y.useState)(!1),[fe,F]=(0,y.useState)(!1),[I,L]=(0,y.useState)(!0),[R,z]=(0,y.useState)(!0),[B,V]=(0,y.useState)(``),[H,U]=(0,y.useState)(``),[W,G]=(0,y.useState)(``),[K,q]=(0,y.useState)(!1),[J,Y]=(0,y.useState)(10),X=(0,y.useRef)(null),pe=async(e=!1)=>{let n=await u(`/api/projects/${t.id}/git`);if(v(n.status),e&&(L(!n.status.tokenConfigured),z(!n.status.remoteUrl)),n.status.initialized&&n.status.latestCommit){let e=await u(`/api/projects/${t.id}/git/history`);C(e.commits)}else C([])};(0,y.useEffect)(()=>{e?(U(``),G(``),A(null),q(!1),T(S(t.name)),V(`load`),d().then(()=>pe(!0)).catch(e=>U(e instanceof Error?e.message:m(`errors.generic`))).finally(()=>V(``))):(document.fullscreenElement&&document.exitFullscreen().catch(()=>void 0),q(!1))},[e,t.id]),(0,y.useEffect)(()=>{let e=()=>q(document.fullscreenElement===X.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),(0,y.useEffect)(()=>{if(!K)return;let e=e=>{e.key===`Escape`&&!document.fullscreenElement&&q(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[K]);let Z=async(e,t,n,r)=>{V(e),U(``),G(``);try{await t(),n&&G(n)}catch(e){let t=e instanceof Error?e.message:m(`errors.generic`);U(r?`${r}: ${t}`:t)}finally{V(``)}},me=()=>Z(`repository`,async()=>{let e=await u(`/api/projects/${t.id}/git/repository`,{method:`POST`,body:JSON.stringify({name:w,private:E})});v(e.status),z(!1)},m(`git.repositoryCreated`)),he=()=>Z(`commit`,async()=>{if(!await d())throw Error(m(`errors.collaborationUnavailable`));let e=await u(`/api/projects/${t.id}/git/commit`,{method:`POST`,body:JSON.stringify({message:D})});v(e.status),C(t=>[e.commit,...t.filter(t=>t.sha!==e.commit.sha)].slice(0,100)),O(``),A(null)},m(`git.committed`),m(`git.commitFailed`)),Q=()=>Z(`push`,async()=>{if(!await d())throw Error(m(`errors.collaborationUnavailable`));let e=await u(`/api/projects/${t.id}/git/push`,{method:`POST`});v(e.status)},m(`git.pushed`),m(`git.pushFailed`)),$=e=>Z(`diff`,async()=>{if(!await d())throw Error(m(`errors.collaborationUnavailable`));let n=e?`?revision=${encodeURIComponent(e)}`:``,r=await u(`/api/projects/${t.id}/git/diff${n}`);A({...r,revision:e})}),ge=e=>{k?.revision===e?(A(null),q(!1),document.fullscreenElement&&document.exitFullscreen().catch(()=>void 0)):$(e)},_e=async()=>{if(K){document.fullscreenElement&&await document.exitFullscreen().catch(()=>void 0),q(!1);return}let e=X.current;if(e?.requestFullscreen)try{await e.requestFullscreen()}catch{}q(!0)},ve=()=>{let e=j;e&&(M(null),Z(`checkout`,async()=>{if(!await d())throw Error(m(`errors.collaborationUnavailable`));await u(`/api/projects/${t.id}/git/checkout`,{method:`POST`,body:JSON.stringify({revision:e===`branch`?null:e.sha,force:N})}),window.location.reload()}))},ye=()=>{F(!1),Z(`discard`,async()=>{if(!await d())throw Error(m(`errors.collaborationUnavailable`));await u(`/api/projects/${t.id}/git/discard`,{method:`POST`}),window.location.reload()})},be=B===`load`&&!g;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f,{open:e,extraWide:!0,className:K?`git-dialog-modal-fullscreen`:void 0,title:m(`git.title`),description:m(`git.description`),onOpenChange:n,footer:(0,b.jsx)(`button`,{onClick:()=>n(!1),children:m(`common.close`)}),children:(0,b.jsxs)(`div`,{className:`git-dialog`,children:[be&&(0,b.jsxs)(`div`,{className:`git-loading`,children:[(0,b.jsx)(p,{className:`spin`,size:22}),m(`common.loading`)]}),H&&(0,b.jsx)(`p`,{className:`git-message error`,role:`alert`,children:H}),W&&(0,b.jsxs)(`p`,{className:`git-message success`,role:`status`,children:[(0,b.jsx)(i,{size:14}),W]}),g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`section`,{className:`git-section`,children:[(0,b.jsxs)(`button`,{className:`git-section-toggle`,type:`button`,"aria-expanded":I,onClick:()=>L(e=>!e),children:[(0,b.jsxs)(`span`,{className:`git-section-heading`,children:[(0,b.jsx)(c,{size:16}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`strong`,{children:m(`git.authentication`)}),(0,b.jsx)(`small`,{children:g.tokenConfigured?m(`git.connectedAs`,{login:g.githubLogin}):m(`git.authenticationHint`)})]})]}),I?(0,b.jsx)(a,{size:16}):(0,b.jsx)(r,{size:16})]}),I&&(0,b.jsx)(`div`,{className:`git-section-content`,children:(0,b.jsx)(`p`,{className:`git-account-guidance`,children:g.tokenConfigured?m(`git.accountTokenManaged`,{login:g.githubLogin}):m(`git.accountTokenMissing`)})})]}),(0,b.jsxs)(`section`,{className:`git-section`,children:[(0,b.jsxs)(`button`,{className:`git-section-toggle`,type:`button`,"aria-expanded":R,onClick:()=>z(e=>!e),children:[(0,b.jsxs)(`span`,{className:`git-section-heading`,children:[(0,b.jsx)(s,{size:16}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`strong`,{children:m(`git.repository`)}),(0,b.jsx)(`small`,{children:g.remoteUrl?g.repositoryName??g.remoteUrl:g.initialized?m(`git.localReady`):m(`git.localPending`)})]})]}),R?(0,b.jsx)(a,{size:16}):(0,b.jsx)(r,{size:16})]}),R&&(0,b.jsx)(`div`,{className:`git-section-content`,children:g.remoteUrl?(0,b.jsxs)(`div`,{className:`git-repository-card`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:g.repositoryName??m(`git.origin`)}),(0,b.jsxs)(`small`,{children:[g.branch??m(`git.detachedAt`,{revision:g.latestCommit?.shortSha??`HEAD`}),` · `,g.dirty?m(`git.changedFiles`,{count:g.changedFiles}):m(`git.clean`)]})]}),g.repositoryHtmlUrl&&(0,b.jsxs)(`a`,{href:g.repositoryHtmlUrl,target:`_blank`,rel:`noreferrer`,children:[(0,b.jsx)(ee,{size:14}),m(`git.openGitHub`)]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{className:`form-field`,children:[m(`git.repositoryName`),(0,b.jsx)(`input`,{value:w,onChange:e=>T(e.target.value)})]}),(0,b.jsxs)(`label`,{className:`checkbox-field`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>de(e.target.checked)}),m(`git.privateRepository`)]}),(0,b.jsxs)(`button`,{className:`git-primary-action`,disabled:!!B||!g.tokenConfigured||!w.trim(),onClick:me,children:[B===`repository`?(0,b.jsx)(p,{className:`spin`,size:14}):(0,b.jsx)(c,{size:14}),m(`git.createRepository`)]})]})})]}),g.initialized&&(0,b.jsxs)(`section`,{className:`git-section`,children:[(0,b.jsxs)(`div`,{className:`git-section-heading`,children:[(0,b.jsx)(_,{size:16}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:m(`git.commitAndPush`)}),(0,b.jsx)(`small`,{children:g.branch?m(`git.identity`,{username:t.ownerUsername}):m(`git.detachedHead`)})]})]}),(0,b.jsxs)(`label`,{className:`form-field`,children:[m(`git.commitMessage`),(0,b.jsx)(`textarea`,{rows:3,value:D,placeholder:m(`git.commitPlaceholder`),onChange:e=>O(e.target.value)})]}),(0,b.jsxs)(`div`,{className:`git-action-row`,children:[(0,b.jsxs)(`button`,{title:g.dirty?void 0:m(`git.noChangesToCommit`),disabled:!!B||!g.branch||!g.dirty||!D.trim(),onClick:he,children:[B===`commit`?(0,b.jsx)(p,{className:`spin`,size:14}):(0,b.jsx)(_,{size:14}),m(`git.commit`)]}),(0,b.jsxs)(`button`,{title:g.ahead===0&&g.branch&&g.remoteUrl&&g.tokenConfigured&&g.latestCommit?m(`git.noUnpushedCommits`):void 0,disabled:!!B||!g.branch||!g.tokenConfigured||!g.remoteUrl||!g.latestCommit||g.ahead===0,onClick:Q,children:[B===`push`?(0,b.jsx)(p,{className:`spin`,size:14}):(0,b.jsx)(se,{size:14}),m(`git.push`),g.ahead>0&&(0,b.jsx)(`span`,{className:`git-count`,children:g.ahead})]}),(0,b.jsxs)(`button`,{disabled:!!B||!g.latestCommit,onClick:()=>void $(),children:[B===`diff`?(0,b.jsx)(p,{className:`spin`,size:14}):(0,b.jsx)(l,{size:14}),m(`git.workingDiff`)]}),(0,b.jsxs)(`button`,{className:`git-discard-button`,title:g.restorable?m(`git.discardChanges`):m(`git.noChangesToDiscard`),disabled:!!B||!g.latestCommit||!g.restorable,onClick:()=>F(!0),children:[(0,b.jsx)(oe,{size:14}),m(`git.discardChanges`)]}),!g.branch&&(0,b.jsxs)(`button`,{disabled:!!B,onClick:()=>{P(!1),M(`branch`)},children:[(0,b.jsx)(i,{size:14}),m(`git.returnToBranch`,{branch:g.defaultBranch})]})]})]}),k&&(0,b.jsxs)(`section`,{ref:X,className:`git-section git-diff-section${K?` is-fullscreen`:``}`,children:[(0,b.jsxs)(`div`,{className:`git-diff-heading`,children:[(0,b.jsxs)(`div`,{className:`git-section-heading`,children:[(0,b.jsx)(l,{size:16}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:m(`git.diffTitle`)}),(0,b.jsxs)(`small`,{children:[k.title,k.truncated?` · ${m(`git.diffTruncated`)}`:``]})]})]}),(0,b.jsxs)(`div`,{className:`git-diff-controls`,children:[(0,b.jsxs)(`div`,{className:`git-diff-font-controls`,role:`group`,"aria-label":m(`git.diffFontSize`),children:[(0,b.jsx)(`button`,{type:`button`,className:`git-diff-font-button`,disabled:J<=8,title:m(`git.diffFontDecrease`),"aria-label":m(`git.diffFontDecrease`),onClick:()=>Y(e=>Math.max(8,e-1)),children:(0,b.jsx)(ne,{size:14})}),(0,b.jsxs)(`span`,{className:`git-diff-font-value`,"aria-live":`polite`,children:[J,`px`]}),(0,b.jsx)(`button`,{type:`button`,className:`git-diff-font-button`,disabled:J>=24,title:m(`git.diffFontIncrease`),"aria-label":m(`git.diffFontIncrease`),onClick:()=>Y(e=>Math.min(24,e+1)),children:(0,b.jsx)(ie,{size:14})})]}),(0,b.jsx)(`button`,{type:`button`,className:`git-diff-fullscreen`,title:m(K?`git.exitFullscreenDiff`:`git.fullscreenDiff`),"aria-label":m(K?`git.exitFullscreenDiff`:`git.fullscreenDiff`),onClick:()=>void _e(),children:K?(0,b.jsx)(re,{size:15}):(0,b.jsx)(te,{size:15})})]})]}),(0,b.jsx)(ue,{content:k.diff,empty:m(`git.noChanges`),fontSize:J})]}),g.initialized&&(0,b.jsxs)(`section`,{className:`git-section`,children:[(0,b.jsxs)(`div`,{className:`git-section-heading`,children:[(0,b.jsx)(i,{size:16}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:m(`git.history`)}),(0,b.jsx)(`small`,{children:m(`git.historyHint`)})]})]}),(0,b.jsxs)(`div`,{className:`git-history`,children:[x.map(e=>{let t=k?.revision===e.sha;return(0,b.jsxs)(`article`,{children:[(0,b.jsx)(`code`,{children:e.shortSha}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`strong`,{children:e.message}),(0,b.jsxs)(`small`,{children:[e.authorName,` · `,o(e.authoredAt,h.resolvedLanguage)]})]}),(0,b.jsxs)(`span`,{"data-texlite-tooltip-always":!0,children:[(0,b.jsx)(`button`,{type:`button`,className:t?`is-active`:void 0,title:m(t?`git.hideCommitDiff`:`git.viewCommitDiff`),"aria-label":m(t?`git.hideCommitDiff`:`git.viewCommitDiff`),"aria-pressed":t,disabled:!!B,onClick:()=>ge(e.sha),children:t?(0,b.jsx)(ce,{size:14}):(0,b.jsx)(l,{size:14})}),(0,b.jsx)(`button`,{type:`button`,title:m(`git.checkoutVersion`),disabled:!!B,onClick:()=>{P(!1),M(e)},children:(0,b.jsx)(le,{size:14})})]})]},e.sha)}),x.length===0&&(0,b.jsx)(`p`,{className:`muted`,children:m(`git.noCommits`)})]})]})]})]})}),(0,b.jsx)(f,{open:!!j,title:m(j===`branch`?`git.returnTitle`:`git.checkoutTitle`),description:j===`branch`?m(`git.returnDescription`,{branch:g?.defaultBranch??`main`}):m(`git.checkoutDescription`,{revision:j?.shortSha??``,message:j?.message??``}),onOpenChange:e=>{e||M(null)},footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{onClick:()=>M(null),children:m(`common.cancel`)}),(0,b.jsx)(`button`,{className:N?`danger`:`primary`,onClick:ve,children:m(`git.checkout`)})]}),children:(0,b.jsxs)(`label`,{className:`git-force-checkout`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:N,onChange:e=>P(e.target.checked)}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`strong`,{children:m(`git.forceCheckout`)}),(0,b.jsx)(`small`,{children:m(`git.forceCheckoutDescription`)})]})]})}),(0,b.jsx)(f,{open:fe,title:m(`git.discardTitle`),description:m(`git.discardDescription`),onOpenChange:F,footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{onClick:()=>F(!1),children:m(`common.cancel`)}),(0,b.jsx)(`button`,{className:`danger`,onClick:ye,children:m(`git.discardConfirm`)})]}),children:(0,b.jsx)(b.Fragment,{})})]})}function ue({content:e,empty:t,fontSize:n}){return e.trim()?(0,b.jsx)(`pre`,{className:`git-diff`,style:{fontSize:`${n}px`},children:e.split(`
2
+ `).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`addition`:e.startsWith(`-`)&&!e.startsWith(`---`)?`deletion`:e.startsWith(`@@`)?`hunk`:e.startsWith(`diff `)?`header`:``;return(0,b.jsxs)(`span`,{className:n,children:[e,`
3
+ `]},t)})}):(0,b.jsx)(`div`,{className:`git-diff-empty`,children:t})}function S(e){return e.trim().replace(/\s+/g,`-`).replace(/[^A-Za-z0-9._-]/g,`-`).replace(/-+/g,`-`).replace(/^[.-]+|[.-]+$/g,``).slice(0,100)||`texlite-project`}export{x as GitDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{I as r}from"./relativeTime-BR0CVAvz.js";import{t as i}from"./SaveButton-DkyoEu6j.js";import{r as a,t as o}from"./GitHubIcon-Cjli8pd_.js";import{C as s,E as c,c as l,j as u,y as d}from"./index-DCwfhKK9.js";import{t as f}from"./SuccessNotice-ubBtzzi_.js";var p=e(t(),1),m=n();function h(){let{t:e}=u();return(0,m.jsxs)(`div`,{className:`git-token-guidance`,children:[(0,m.jsx)(`strong`,{children:e(`git.recommendedAccessTitle`)}),(0,m.jsxs)(`span`,{children:[e(`git.recommendedAccessBeforeAll`),(0,m.jsx)(`em`,{className:`git-token-highlight`,children:`All repositories`}),e(`git.recommendedAccessBeforeAdministration`),(0,m.jsx)(`em`,{className:`git-token-highlight`,children:`Administration`}),e(`git.recommendedAccessBetweenPermissions`),(0,m.jsx)(`em`,{className:`git-token-highlight`,children:`Contents`}),e(`git.recommendedAccessAfterPermissions`)]})]})}function g({open:e,onOpenChange:t}){let{t:n}=u(),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(``),{message:w,show:T,clear:E}=f();(0,p.useEffect)(()=>{e&&(x(`load`),C(``),E(),y(``),c(`/api/account/github`).then(e=>_(e.status)).catch(e=>C(s(e))).finally(()=>x(e=>e===`load`?``:e)))},[e,E]);let D=async()=>{if(!b){x(`save`),C(``),E();try{let e=await c(`/api/account/github`,{method:`PUT`,body:JSON.stringify({token:v})});_(e.status),y(``),T(`save`)}catch(e){C(s(e))}finally{x(``)}}},O=async()=>{if(!b){x(`remove`),C(``),E();try{let e=await c(`/api/account/github`,{method:`DELETE`});_(e.status),y(``),T(`remove`)}catch(e){C(s(e))}finally{x(``)}}};return(0,m.jsx)(l,{open:e,title:n(`account.githubTitle`),description:n(`account.githubDescription`),onOpenChange:e=>{b||t(e)},footer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`button`,{disabled:!!b,onClick:()=>t(!1),children:n(`common.close`)}),(0,m.jsx)(i,{saving:b===`save`,feedback:w===`save`?n(`editor.saved`):``,disabled:!!b||v.trim().length<20,onClick:()=>void D(),children:n(`git.saveToken`)})]}),children:(0,m.jsxs)(`div`,{className:`git-dialog account-github-dialog`,children:[b===`load`&&!g&&(0,m.jsxs)(`div`,{className:`git-loading`,children:[(0,m.jsx)(d,{className:`spin`,size:20}),n(`common.loading`)]}),S&&(0,m.jsx)(`p`,{className:`git-message error dialog-error`,children:S}),g&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(h,{}),g.tokenConfigured&&(0,m.jsxs)(`div`,{className:`git-account`,children:[(0,m.jsx)(o,{size:17}),(0,m.jsx)(`span`,{children:n(`git.connectedAs`,{login:g.githubLogin})}),(0,m.jsxs)(`button`,{className:`danger-text`,disabled:!!b,onClick:()=>void O(),children:[b===`remove`?(0,m.jsx)(d,{className:`spin`,size:14}):(0,m.jsx)(r,{size:14}),n(`git.removeToken`)]})]}),(0,m.jsxs)(`label`,{className:`form-field`,children:[g.tokenConfigured?n(`git.replaceToken`):n(`git.token`),(0,m.jsx)(`input`,{type:`password`,autoComplete:`new-password`,spellCheck:!1,autoCapitalize:`none`,autoCorrect:`off`,value:v,placeholder:n(`git.tokenPlaceholder`),onChange:e=>{y(e.target.value),E()}})]}),(0,m.jsx)(`div`,{className:`git-inline-actions`,children:(0,m.jsxs)(`a`,{href:`https://github.com/settings/personal-access-tokens/new`,target:`_blank`,rel:`noreferrer`,children:[n(`git.createToken`),(0,m.jsx)(a,{size:12})]})}),(0,m.jsx)(`p`,{className:`muted account-github-encryption-note`,children:n(`account.githubEncryption`)})]})]})})}export{g as GitHubAccountDialog};
@@ -1 +1 @@
1
- import{t as e}from"./react-DUEFWlB7.js";import{b as t}from"./index-D0eqhDpZ.js";var n={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};n.node;var r=t(n),i={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};i.node;var a=t(i),o=e();function s({size:e=24,...t}){return(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,...t,children:[(0,o.jsx)(`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`}),(0,o.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]})}export{a as n,r,s as t};
1
+ import{t as e}from"./react-DUEFWlB7.js";import{b as t}from"./index-DCwfhKK9.js";var n={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};n.node;var r=t(n),i={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};i.node;var a=t(i),o=e();function s({size:e=24,...t}){return(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,...t,children:[(0,o.jsx)(`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`}),(0,o.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]})}export{a as n,r,s as t};
@@ -0,0 +1,8 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{I as r,K as i,Y as a,y as o}from"./relativeTime-BR0CVAvz.js";import{n as s,t as c}from"./SaveButton-DkyoEu6j.js";import{t as l}from"./clock-3-Fb1_e3ec.js";import{t as u}from"./hard-drive-CBmnJ2xS.js";import{n as d,t as f}from"./minus-TCBOakyi.js";import{t as p}from"./minimize-2-C8oL6PTV.js";import{t as m}from"./plus-Dfkyfvvy.js";import{t as h}from"./search-n-2tBATf.js";import{C as g,E as _,T as v,b as y,c as ee,j as te,s as ne,y as b}from"./index-DCwfhKK9.js";import{t as re}from"./SuccessNotice-ubBtzzi_.js";import{r as x}from"./dist-Dxkdrap6.js";import{B as ie,F as S,L as ae,P as C}from"./ProjectWorkspace-1UOdyfBq.js";var w={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};w.node;var oe=y(w),T={name:`tag`,size:24,node:[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]};T.node;var se=y(T),E=e(t(),1),D=55296,O=2048,k=63487,A=4e4;function j(e,t){if(e===t)return e?[[0,e]]:[];let n=[``],r=new Map,i=(e,t)=>{let i=[];for(let a=0;a<e.length;){let o=e.indexOf(`
2
+ `,a),s=o<0?e.length:o+1,c=e.slice(a,s),l=r.get(c);if(l===void 0&&(n.length===t&&(c=e.slice(a),s=e.length,l=r.get(c)),l===void 0)){let e=n.length;l=String.fromCharCode(e<D?e:e+O),n.push(c),r.set(c,l)}i.push(l),a=s}return i.join(``)},a=i(e,A),o=i(t,k);return x(a,o,{checkLines:!1,timeout:1}).map(([e,t])=>[e,Array.from(t,e=>{let t=e.charCodeAt(0),r=t<D?t:t-O;return n[r]}).join(``)])}function ce(e,t,n,r=`历史版本`,i=`当前版本`,a=3){let o=t.replace(/\r\n/g,`
3
+ `),s=n.replace(/\r\n/g,`
4
+ `);if(o===s)return{diffText:``,additions:0,deletions:0,hasChanges:!1};let c=j(o,s),l=[],u=1,d=1,f=0,p=0;for(let[e,t]of c){if(!t)continue;let n=t.split(`
5
+ `);n[n.length-1]===``&&n.pop();for(let t of n)e===0?l.push({op:0,text:t,oldNum:u++,newNum:d++}):e===-1?(p++,l.push({op:-1,text:t,oldNum:u++,newNum:d})):e===1&&(f++,l.push({op:1,text:t,oldNum:u,newNum:d++}))}if(f===0&&p===0)return{diffText:``,additions:0,deletions:0,hasChanges:!1};let m=[],h=-1,g=-1;for(let e=0;e<l.length;e++)if(l[e].op!==0){let t=Math.max(0,e-a),n=Math.min(l.length-1,e+a);h===-1?(h=t,g=n):t<=g+1?g=Math.max(g,n):(m.push({start:h,end:g}),h=t,g=n)}h!==-1&&m.push({start:h,end:g});let _=[`--- a/${e} (${r})`,`+++ b/${e} (${i})`];for(let e of m){let t=l.slice(e.start,e.end+1),n=t.filter(e=>e.op<=0).length,r=t.filter(e=>e.op>=0).length,i=t[0],a=n===0?0:i.oldNum,o=r===0?0:i.newNum;_.push(`@@ -${a},${n} +${o},${r} @@`);for(let e of t){let t=e.op===-1?`-`:e.op===1?`+`:` `;_.push(`${t}${e.text}`)}}return{diffText:_.join(`
6
+ `),additions:f,deletions:p,hasChanges:!0}}function le(e,t){try{let n=new Date(e);if(Number.isNaN(n.getTime()))return e;let r=new Date;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()?o(n,t,{hour:`2-digit`,minute:`2-digit`}):o(n,t,{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}catch{return e}}function ue(e,t,n){if(e.label)return e.label;let r=le(e.createdAt,n);if(e.changedPaths.length===1)return`${e.changedPaths[0].split(`/`).pop()||e.changedPaths[0]} (${r})`;if(e.changedPaths.length===2)return`${e.changedPaths[0].split(`/`).pop()||e.changedPaths[0]}, ${e.changedPaths[1].split(`/`).pop()||e.changedPaths[1]} (${r})`;if(e.changedPaths.length>2)return`${e.changedPaths[0].split(`/`).pop()||e.changedPaths[0]} +${e.changedPaths.length-1} (${r})`;let i=e.author?.name||e.author?.username;return i?`${i} @ ${r}`:`${t} (${r})`}function de(e){if(!e)return!1;let t=S(e);return t===`text`||t===`other`}var M=n();function fe({open:e,projectId:t,onOpenChange:n,onSaved:r}){let{t:i}=te(),[a,o]=(0,E.useState)([]),[s,c]=(0,E.useState)(``),[l,u]=(0,E.useState)(``),[d,f]=(0,E.useState)(!1),[p,m]=(0,E.useState)(``),v=(0,E.useRef)(null),y=(0,E.useRef)(!1);(0,E.useEffect)(()=>{if(!e)return;let n=new AbortController;return v.current=n,o([]),c(``),u(``),f(!0),m(``),y.current=!1,_(`/api/projects/${t}/history/files`,{signal:n.signal}).then(e=>{n.signal.aborted||o(e.files)}).catch(e=>{n.signal.aborted||u(g(e))}).finally(()=>{n.signal.aborted||f(!1)}),()=>{n.abort(),v.current===n&&(v.current=null)}},[e,t]);let ne=async(e,n)=>{let i=v.current;if(!(!i||i.signal.aborted||d||y.current)){y.current=!0,m(e),u(``);try{let a=await _(`/api/projects/${t}/history/files`,{method:`PATCH`,body:JSON.stringify({path:e,included:n}),signal:i.signal});if(i.signal.aborted)return;o(a.files),r()}catch(e){i.signal.aborted||u(g(e))}finally{i.signal.aborted||(y.current=!1,m(``))}}},re=(0,E.useMemo)(()=>a.filter(e=>e.path.toLowerCase().includes(s.trim().toLowerCase())),[a,s]);return(0,M.jsx)(ee,{open:e,wide:!0,className:`history-tracking-modal`,title:i(`history.manageFiles`),description:i(`history.trackingDescription`),onOpenChange:n,footer:(0,M.jsx)(`button`,{type:`button`,onClick:()=>n(!1),children:i(`common.close`)}),children:(0,M.jsxs)(`div`,{className:`history-tracking`,children:[(0,M.jsx)(`p`,{className:`muted`,children:i(`history.trackingHint`)}),(0,M.jsxs)(`label`,{className:`history-tracking-search`,children:[(0,M.jsx)(h,{size:15,"aria-hidden":!0}),(0,M.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:i(`history.searchFiles`),"aria-label":i(`history.searchFiles`)})]}),l&&(0,M.jsx)(`p`,{className:`error`,role:`alert`,children:l}),d?(0,M.jsxs)(`p`,{className:`muted`,children:[(0,M.jsx)(b,{className:`spin`,size:15}),i(`common.loading`)]}):(0,M.jsxs)(`div`,{className:`history-tracking-grid`,"aria-busy":!!p,children:[re.map(e=>{let t=e.path.lastIndexOf(`/`),n=e.path.slice(t+1),r=t<0?`./`:e.path.slice(0,t+1);return(0,M.jsxs)(`div`,{className:`history-tracking-card${e.included?` included`:``}${e.missing?` missing`:``}`,children:[(0,M.jsxs)(`label`,{children:[(0,M.jsx)(C,{path:e.path,size:21}),(0,M.jsxs)(`span`,{className:`history-tracking-path`,children:[(0,M.jsx)(`strong`,{title:e.path,children:n}),(0,M.jsx)(`small`,{title:r,children:r})]}),(0,M.jsx)(`input`,{type:`checkbox`,checked:e.included,disabled:!!p||e.missing,onChange:t=>void ne(e.path,t.target.checked)})]}),(0,M.jsxs)(`div`,{className:`history-tracking-card-footer`,children:[(0,M.jsx)(`small`,{children:e.missing?i(`history.fileMissing`):e.override===null?e.defaultIncluded?i(`history.defaultTracked`):i(`history.defaultUntracked`):i(`history.customTracking`)}),p===e.path?(0,M.jsx)(b,{className:`spin`,size:14,"aria-label":i(`common.loading`)}):e.override!==null&&(0,M.jsx)(`button`,{type:`button`,disabled:!!p,onClick:()=>void ne(e.path,null),title:i(`history.resetTracking`),"aria-label":i(`history.resetTracking`),children:(0,M.jsx)(ae,{size:14})})]})]},e.path)}),re.length===0&&(0,M.jsx)(`p`,{className:`muted`,children:i(`history.noMatchingFiles`)})]})]})})}var pe=100;function N({open:e,project:t,onOpenChange:n,onBeforeMutation:h}){let g=re(),{t:y,i18n:x}=te(),[S,C]=(0,E.useState)([]),[w,T]=(0,E.useState)(null),[D,O]=(0,E.useState)(``),[k,A]=(0,E.useState)(null),[j,N]=(0,E.useState)(``),[L,R]=(0,E.useState)(null),[me,he]=(0,E.useState)(0),[z,ge]=(0,E.useState)(`commit`),[_e,ve]=(0,E.useState)(11),[B,V]=(0,E.useState)(!1),[ye,be]=(0,E.useState)(``),[H,xe]=(0,E.useState)(null),[U,Se]=(0,E.useState)(null),[W,G]=(0,E.useState)(``),[Ce,we]=(0,E.useState)(null),[K,Te]=(0,E.useState)(!1),[Ee,q]=(0,E.useState)(``),[De,Oe]=(0,E.useState)(!1),[ke,Ae]=(0,E.useState)(0),je=(0,E.useRef)(null),J=(0,E.useRef)(null),Y=(0,E.useRef)(null),Me=(0,E.useRef)(D),Ne=(0,E.useRef)(t.id),Pe=(0,E.useRef)(!1),X=(0,E.useRef)(null);Me.current=D,Ne.current=t.id;let Fe=t.permission!==`read`,Ie=t.permission===`owner`,Z=!!W||K;(0,E.useEffect)(()=>{if(g.clear(),!e){Oe(!1),Y.current?.abort(),Y.current=null,X.current!==null&&window.clearTimeout(X.current),X.current=null,J.current?.abort(),J.current=null,Te(!1),document.fullscreenElement&&document.exitFullscreen().catch(()=>void 0),V(!1);return}J.current?.abort(),J.current=null;let n=new AbortController;return G(`load`),q(``),R(null),we(null),Te(!1),_(`/api/projects/${t.id}/history?limit=${pe}`,{signal:n.signal}).then(e=>{n.signal.aborted||(C(e.versions),T(e.stats),we(e.nextCursor),O(t=>e.versions.some(e=>e.id===t)?t:e.versions[0]?.id??``))}).catch(e=>{I(e)||q(F(e))}).finally(()=>{n.signal.aborted||G(``)}),()=>n.abort()},[e,t.id,ke]),(0,E.useEffect)(()=>()=>{J.current?.abort(),J.current=null,Y.current?.abort(),Y.current=null,X.current!==null&&window.clearTimeout(X.current)},[t.id]),(0,E.useEffect)(()=>{Y.current?.abort(),Y.current=null,g.clear()},[D]);let Le=async()=>{let e=Ce;if(!e||K||W)return;J.current?.abort();let n=new AbortController;J.current=n,Te(!0),q(``);try{let r=new URLSearchParams({limit:String(pe),before:e}),i=await _(`/api/projects/${t.id}/history?${r.toString()}`,{signal:n.signal});if(n.signal.aborted)return;C(e=>{let t=new Set(e.map(e=>e.id));return[...e,...i.versions.filter(e=>!t.has(e.id))]}),T(i.stats),we(i.nextCursor)}catch(e){I(e)||q(F(e))}finally{J.current===n&&(J.current=null,Te(!1))}};(0,E.useEffect)(()=>{let e=()=>V(document.fullscreenElement===je.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),(0,E.useEffect)(()=>{if(!B)return;let e=e=>{e.key===`Escape`&&!document.fullscreenElement&&V(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[B]),(0,E.useEffect)(()=>{if(!e||!D){A(null);return}let n=new AbortController;return G(`detail`),R(null),_(`/api/projects/${t.id}/history/${D}`,{signal:n.signal}).then(e=>{if(n.signal.aborted)return;A(e),be(e.version.label??``);let t=e.version.changedPaths.find(t=>e.files.some(e=>e.path===t))??``;N(t)}).catch(e=>{!n.signal.aborted&&!I(e)&&q(F(e))}).finally(()=>{n.signal.aborted||G(e=>e===`detail`?``:e)}),()=>n.abort()},[e,t.id,D]);let Q=L?.previousVersion??null,Re=k?.files.find(e=>e.path===j),ze=Re?.textContent??de(j),Be=Re?.deleted===!0;(0,E.useEffect)(()=>{if(!e||!D||!j||!ze){Pe.current=!1,R(null),G(e=>e===`compare`?``:e);return}let n=new AbortController;R(null),G(`compare`);let r=Pe.current;Pe.current=!1,r||q(``);let i=z===`commit`?`&against=__previous__`:``;return _(`/api/projects/${t.id}/history/${D}/file?path=${encodeURIComponent(j)}${i}`,{signal:n.signal}).then(e=>{n.signal.aborted||R(e)}).catch(e=>{!n.signal.aborted&&!I(e)&&q(F(e))}).finally(()=>{n.signal.aborted||G(e=>e===`compare`?``:e)}),()=>n.abort()},[e,t.id,D,j,ze,z,me]);let $=(0,E.useMemo)(()=>{if(!k)return[];let e=new Set(k.version.changedPaths);return k.files.filter(t=>e.has(t.path))},[k]);(0,E.useEffect)(()=>{$.length>0&&!$.some(e=>e.path===j)?N($[0].path):$.length===0&&j&&N(``)},[$,j]);let Ve=async()=>{if(B){document.fullscreenElement&&await document.exitFullscreen().catch(()=>void 0),V(!1);return}let e=je.current;if(e?.requestFullscreen)try{await e.requestFullscreen()}catch{}V(!0)},He=async(e,n=!1)=>{let r=t.id;Y.current?.abort();let i=new AbortController;Y.current=i;try{let t=await _(`/api/projects/${r}/history/${e}`,{signal:i.signal});return i.signal.aborted||Ne.current!==r||Me.current!==e?!1:(A(t),be(t.version.label??``),N(e=>e&&t.files.some(t=>t.path===e)?e:t.version.changedPaths.find(e=>t.files.some(t=>t.path===e))??``),R(null),n&&(Pe.current=!0),he(e=>e+1),C(e=>e.map(e=>e.id===t.version.id?t.version:e)),!0)}finally{Y.current===i&&(Y.current=null)}},Ue=async()=>{if(k){G(`label`),q(``),g.clear();try{let e=await _(`/api/projects/${t.id}/history/${k.version.id}`,{method:`PATCH`,body:JSON.stringify({label:ye.trim()||null,snapshotHash:k.version.snapshotHash})});A(t=>t?.version.id===e.version.id?{...t,version:e.version}:t),C(t=>t.map(t=>t.id===e.version.id?e.version:t)),T(e.stats),g.show(e.version.id),e.retentionScheduled&&(X.current!==null&&window.clearTimeout(X.current),X.current=window.setTimeout(()=>{X.current=null,_(`/api/projects/${t.id}/history?limit=1`).then(e=>{T(e.stats)}).catch(()=>void 0)},e.retentionRefreshAfterMs))}catch(e){if(e instanceof v&&e.code===`HISTORY_VERSION_CHANGED`)try{if(!await He(k.version.id,!0))return}catch(e){if(I(e))return;q(F(e));return}q(F(e))}finally{G(``)}}},We=async()=>{let e=U;if(e){Se(null),G(`delete`),q(``);try{if(!await h())throw Error(y(`errors.collaborationUnavailable`));let n=e===`all`?`/api/projects/${t.id}/history`:`/api/projects/${t.id}/history/${e.id}`,r=await _(n,{method:`DELETE`});if(T(r.stats),e===`all`)C([]),O(``),A(null),R(null),we(null);else{let t=S.filter(t=>t.id!==e.id);C(t),D===e.id&&(O(t[0]?.id??``),A(null),R(null))}}catch(e){q(F(e))}finally{G(``)}}},Ge=async()=>{let e=H;if(e&&k){xe(null),G(`restore`),q(``);try{if(!await h())throw Error(y(`errors.collaborationUnavailable`));await _(`/api/projects/${t.id}/history/${k.version.id}/restore`,{method:`POST`,body:JSON.stringify(e===`project`?{snapshotHash:k.version.snapshotHash}:{path:e,snapshotHash:k.version.snapshotHash})}),window.location.reload()}catch(e){if(e instanceof v&&e.code===`HISTORY_VERSION_CHANGED`)try{if(!await He(k.version.id,!0)){G(``);return}}catch(e){if(I(e)){G(``);return}q(F(e)),G(``);return}q(F(e)),G(``)}}},Ke=k?.version.author?.name||k?.version.author?.username||(k?.version.reason===`autosave`?y(`history.reasons.autosave`):y(`editor.deletedUser`)),qe=k?le(k.version.createdAt,x.resolvedLanguage):``,Je=(0,E.useMemo)(()=>{if(!L||!k)return{diffText:``,additions:0,deletions:0,hasChanges:!1};if(z===`commit`){let e=L.comparison,t=L.historical,n=Q?`${Q.label||y(`history.reasons.${Q.reason}`)} (${le(Q.createdAt,x.resolvedLanguage)})`:`/dev/null`,r=`${k.version.label||y(`history.reasons.${k.version.reason}`)} (${qe})`;return ce(L.path,e,t,n,r)}{let e=L.historical,t=L.comparison,n=`${k.version.label||y(`history.reasons.${k.version.reason}`)} (${qe})`,r=y(`history.currentVersion`);return ce(L.path,e,t,n,r)}},[L,k,z,Q,qe,y,x.resolvedLanguage]),Ye=k?y(`history.reasons.${k.version.reason}`):``,Xe=k?ue(k.version,Ye,x.resolvedLanguage):``,Ze=U&&U!==`all`?ue(U,y(`history.reasons.${U.reason}`),x.resolvedLanguage):``,Qe=Fe&&k?(0,M.jsxs)(`button`,{type:`button`,className:`history-restore-project`,disabled:Z,title:y(`history.restoreProjectTitle`),onClick:()=>xe(`project`),children:[(0,M.jsx)(ae,{size:14}),y(`history.restoreProject`)]}):null;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ee,{open:e,extraWide:!0,draggable:!0,className:`history-dialog-modal`,title:y(`history.projectSnapshots`),description:y(`history.description`),onOpenChange:n,footer:(0,M.jsxs)(M.Fragment,{children:[Fe&&(0,M.jsxs)(`button`,{type:`button`,className:`history-manage-files`,disabled:Z,onClick:()=>Oe(!0),children:[(0,M.jsx)(oe,{size:15,"aria-hidden":!0}),(0,M.jsx)(`span`,{children:y(`history.manageFiles`)})]}),(0,M.jsx)(`button`,{type:`button`,className:`history-close`,onClick:()=>n(!1),children:y(`common.close`)})]}),children:(0,M.jsxs)(`div`,{className:`history-dialog`,children:[Ee&&(0,M.jsx)(`p`,{className:`error history-message`,children:Ee}),W===`load`&&S.length===0?(0,M.jsxs)(`div`,{className:`history-loading`,children:[(0,M.jsx)(b,{className:`spin`,size:22}),y(`common.loading`)]}):(0,M.jsxs)(`div`,{className:`history-dialog-layout`,children:[(0,M.jsxs)(`aside`,{className:`history-timeline`,children:[Ie&&w&&(0,M.jsxs)(`div`,{className:`history-stats${w.storageLimitExceeded?` exceeded`:``}`,children:[(0,M.jsxs)(`header`,{children:[(0,M.jsxs)(`span`,{children:[(0,M.jsx)(u,{size:14}),y(`history.storage`)]}),(0,M.jsx)(`button`,{type:`button`,disabled:Z||S.length===0,title:y(`history.clearAll`),"aria-label":y(`history.clearAll`),onClick:()=>Se(`all`),children:(0,M.jsx)(r,{size:13})})]}),(0,M.jsx)(`strong`,{children:y(`history.storageUsage`,{used:P(w.totalBytes),limit:P(w.maxStorageBytes)})}),(0,M.jsx)(`progress`,{max:w.maxStorageBytes,value:Math.min(w.totalBytes,w.maxStorageBytes)}),(0,M.jsx)(`small`,{children:y(`history.storageBreakdown`,{objects:P(w.objectBytes),metadata:P(w.metadataBytes),protected:P(w.protectedBytes)})}),(0,M.jsxs)(`small`,{children:[y(`history.versionUsage`,{count:w.maxVersions,versions:w.ordinaryVersionCount,limit:w.maxVersions>0?w.maxVersions:`∞`}),w.labeledVersionCount>0?` · ${y(`history.protectedVersions`,{count:w.labeledVersionCount})}`:``]}),w.storageLimitExceeded&&(0,M.jsx)(`small`,{className:`history-storage-warning`,children:y(`history.storageExceeded`)})]}),S.map(e=>{let t=y(`history.reasons.${e.reason}`),n=ue(e,t,x.resolvedLanguage),r=e.author?.name||e.author?.username||(e.reason===`autosave`?y(`history.reasons.autosave`):y(`editor.deletedUser`));return(0,M.jsxs)(`button`,{className:e.id===D?`active`:``,onClick:()=>O(e.id),children:[(0,M.jsx)(ie,{size:15}),(0,M.jsxs)(`span`,{children:[(0,M.jsxs)(`div`,{className:`history-item-heading`,children:[(0,M.jsx)(`strong`,{title:n,children:n}),(0,M.jsx)(`span`,{className:`history-reason-badge reason-${e.reason}`,children:t})]}),(0,M.jsx)(`small`,{children:o(e.createdAt,x.resolvedLanguage)}),(0,M.jsxs)(`small`,{children:[(0,M.jsx)(`span`,{className:`history-author-name`,"data-tooltip":e.author?.username?`@${e.author.username}`:void 0,"data-texlite-tooltip-always":!0,children:r}),` · `,y(`history.changedCount`,{count:e.changedPaths.length})]})]})]},e.id)}),Ce&&(0,M.jsx)(`div`,{className:`history-load-more`,children:(0,M.jsxs)(`button`,{type:`button`,disabled:Z,"aria-busy":K,onClick:()=>void Le(),children:[K?(0,M.jsx)(b,{className:`spin`,size:13}):(0,M.jsx)(l,{size:13}),y(K?`common.loading`:`history.loadOlder`)]})}),S.length===0&&(0,M.jsx)(`p`,{className:`muted padded`,children:y(`history.empty`)})]}),(0,M.jsx)(`section`,{className:`history-detail`,children:k&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`header`,{className:`history-detail-header`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`history-detail-title-row`,children:[(0,M.jsx)(`strong`,{title:Xe,children:Xe}),(0,M.jsx)(`span`,{className:`history-reason-badge reason-${k.version.reason}`,children:Ye})]}),(0,M.jsxs)(`div`,{className:`history-snapshot-meta`,children:[(0,M.jsxs)(`span`,{className:`history-snapshot-time`,children:[(0,M.jsx)(l,{size:12,"aria-hidden":!0}),(0,M.jsx)(`time`,{dateTime:k.version.createdAt,title:o(k.version.createdAt,x.resolvedLanguage),children:o(k.version.createdAt,x.resolvedLanguage,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})})]}),k.version.author?(0,M.jsxs)(`span`,{className:`history-snapshot-attribution`,children:[(0,M.jsx)(`span`,{children:y(`history.lastChangedBy`)}),(0,M.jsx)(`strong`,{children:Ke})]}):(0,M.jsx)(`span`,{className:`history-snapshot-origin`,children:Ye}),(0,M.jsxs)(`span`,{className:`history-snapshot-file-count`,children:[(0,M.jsx)(i,{size:12,"aria-hidden":!0}),y(`history.fileCount`,{count:k.version.fileCount})]})]})]}),!Ie&&Qe]}),Ie&&(0,M.jsxs)(`div`,{className:`history-snapshot-actions`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`history-delete-action`,disabled:Z,title:y(`history.deleteVersionTitle`),onClick:()=>Se(k.version),children:[(0,M.jsx)(r,{size:14}),y(`history.deleteVersion`)]}),Qe]}),Fe&&(0,M.jsxs)(`div`,{className:`history-label`,children:[(0,M.jsxs)(`label`,{children:[(0,M.jsx)(se,{size:14}),(0,M.jsx)(`input`,{value:ye,maxLength:80,"aria-label":y(`history.labelPlaceholder`),placeholder:y(`history.labelPlaceholder`),onChange:e=>be(e.target.value)})]}),(0,M.jsx)(c,{className:`history-label-save`,iconSize:13,feedback:g.message===k.version.id?y(`editor.saved`):``,saving:W===`label`,disabled:Z||ye.trim()===(k.version.label??``),onClick:()=>void Ue(),children:y(`history.saveLabel`)})]}),(0,M.jsxs)(`div`,{className:`history-files`,children:[(0,M.jsx)(`div`,{className:`history-files-toolbar`,children:(0,M.jsxs)(`div`,{className:`history-files-heading`,children:[(0,M.jsx)(a,{size:13}),(0,M.jsx)(`span`,{children:y(`history.changedFilesHeading`,{count:$.length})})]})}),$.length>0?(0,M.jsxs)(`div`,{className:`history-file-tabs-row`,children:[(0,M.jsx)(`div`,{className:`history-file-list`,children:$.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:e.path===j?`active`:``,title:e.path,onClick:()=>N(e.path),children:[(0,M.jsx)(i,{size:13}),(0,M.jsx)(`span`,{children:e.path})]},e.path))}),Fe&&(0,M.jsx)(`div`,{className:`history-file-actions`,children:(0,M.jsxs)(`button`,{type:`button`,disabled:!j||Be||Z,title:y(`history.restoreFileTitle`),onClick:()=>xe(j),children:[(0,M.jsx)(ae,{size:13}),y(`history.restoreFile`)]})})]}):(0,M.jsx)(`p`,{className:`muted padded-small`,children:y(`history.noChangedFiles`)})]}),j&&!ze?(0,M.jsxs)(`p`,{className:`history-attachment-change`,children:[(0,M.jsx)(i,{size:14}),(0,M.jsx)(`span`,{children:y(Be?`history.nonTextFileDeleted`:`history.nonTextFileChanged`,{path:j})})]}):(0,M.jsx)(`div`,{ref:je,className:`history-comparison${B?` is-fullscreen`:``}`,children:j?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`header`,{children:[(0,M.jsxs)(`div`,{className:`history-comparison-meta`,children:[(0,M.jsx)(`strong`,{children:j}),(0,M.jsxs)(`small`,{className:`history-commit-summary`,children:[z===`commit`?(0,M.jsx)(`span`,{children:y(Q?`history.changedAt`:`history.createdAt`,{time:qe})}):(0,M.jsx)(`span`,{children:y(`history.comparingCurrent`)}),Je.hasChanges&&(0,M.jsxs)(`span`,{className:`history-diff-stats`,children:[(0,M.jsxs)(`span`,{className:`addition`,children:[`+`,Je.additions]}),` `,(0,M.jsxs)(`span`,{className:`deletion`,children:[`-`,Je.deletions]})]})]})]}),(0,M.jsxs)(`div`,{className:`history-diff-controls`,children:[(0,M.jsx)(`div`,{className:`history-diff-control-group`,children:(0,M.jsxs)(`div`,{className:`history-mode-toggle`,role:`group`,"aria-label":y(`history.diffMode`),children:[(0,M.jsx)(`button`,{type:`button`,className:z===`commit`?`active`:``,"aria-pressed":z===`commit`,onClick:()=>ge(`commit`),title:y(`history.diffModeCommitHint`),children:(0,M.jsx)(`span`,{children:y(`history.diffModeCommit`)})}),(0,M.jsx)(`button`,{type:`button`,className:z===`current`?`active`:``,"aria-pressed":z===`current`,onClick:()=>ge(`current`),title:y(`history.diffModeCurrentHint`),children:(0,M.jsx)(`span`,{children:y(`history.diffModeCurrent`)})})]})}),(0,M.jsx)(`span`,{className:`history-diff-control-divider`,"aria-hidden":`true`}),(0,M.jsx)(`div`,{className:`history-diff-control-group`,children:(0,M.jsxs)(`div`,{className:`git-diff-font-controls`,role:`group`,"aria-label":y(`git.diffFontSize`),children:[(0,M.jsx)(`button`,{type:`button`,className:`git-diff-font-button`,disabled:_e<=8,title:y(`git.diffFontDecrease`),"aria-label":y(`git.diffFontDecrease`),onClick:()=>ve(e=>Math.max(8,e-1)),children:(0,M.jsx)(f,{size:14})}),(0,M.jsxs)(`span`,{className:`git-diff-font-value`,"aria-live":`polite`,children:[_e,`px`]}),(0,M.jsx)(`button`,{type:`button`,className:`git-diff-font-button`,disabled:_e>=24,title:y(`git.diffFontIncrease`),"aria-label":y(`git.diffFontIncrease`),onClick:()=>ve(e=>Math.min(24,e+1)),children:(0,M.jsx)(m,{size:14})})]})}),(0,M.jsx)(`span`,{className:`history-diff-control-divider`,"aria-hidden":`true`}),(0,M.jsx)(`div`,{className:`history-diff-control-group`,children:(0,M.jsx)(`button`,{type:`button`,className:`git-diff-fullscreen`,title:y(B?`git.exitFullscreenDiff`:`git.fullscreenDiff`),"aria-label":y(B?`git.exitFullscreenDiff`:`git.fullscreenDiff`),onClick:()=>void Ve(),children:B?(0,M.jsx)(p,{size:15}):(0,M.jsx)(d,{size:15})})})]})]}),W===`compare`&&!L?(0,M.jsxs)(`div`,{className:`history-comparison-empty`,children:[(0,M.jsx)(b,{className:`spin`,size:24}),(0,M.jsx)(`span`,{children:y(`common.loading`)})]}):L?Je.hasChanges?(0,M.jsx)(`pre`,{className:`git-diff history-git-diff`,style:{fontSize:`${_e}px`},children:Je.diffText.split(`
7
+ `).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`addition`:e.startsWith(`-`)&&!e.startsWith(`---`)?`deletion`:e.startsWith(`@@`)?`hunk`:e.startsWith(`diff `)||e.startsWith(`---`)||e.startsWith(`+++`)?`header`:``;return(0,M.jsxs)(`span`,{className:n,children:[e,`
8
+ `]},t)})}):(0,M.jsxs)(`div`,{className:`git-diff-empty history-diff-empty`,children:[(0,M.jsx)(s,{size:24}),(0,M.jsx)(`span`,{children:y(z===`commit`?`history.noDifferencesInCommit`:`history.noDifferences`)})]}):(0,M.jsxs)(`div`,{className:`history-comparison-empty`,children:[(0,M.jsx)(i,{size:24}),(0,M.jsx)(`span`,{children:y(`apiErrors.historyPreviewUnsupported`)})]})]}):(0,M.jsxs)(`div`,{className:`history-comparison-empty`,children:[(0,M.jsx)(ie,{size:25}),(0,M.jsx)(`span`,{children:$.length===0?y(`history.noChangedFiles`):y(`history.chooseFile`)})]})})]})})]})]})}),(0,M.jsx)(fe,{open:e&&De,projectId:t.id,onOpenChange:Oe,onSaved:()=>{Ae(e=>e+1),he(e=>e+1)}}),(0,M.jsx)(ne,{open:!!H,title:y(H===`project`?`history.restoreProjectTitle`:`history.restoreFileTitle`),description:H===`project`?y(k?.scoped?`history.restoreTrackedDescription`:`history.restoreProjectDescription`):y(`history.restoreFileDescription`,{path:H??``}),confirmLabel:y(`history.restore`),danger:!0,onCancel:()=>xe(null),onConfirm:()=>void Ge()}),(0,M.jsx)(ne,{open:!!U,title:y(U===`all`?`history.clearAllTitle`:`history.deleteVersionTitle`),description:U===`all`?y(`history.clearAllDescription`):y(`history.deleteVersionDescription`,{name:Ze}),confirmLabel:y(U===`all`?`history.clearAll`:`history.deleteVersion`),danger:!0,onCancel:()=>Se(null),onConfirm:()=>void We()})]})}function P(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/102.4)/10} KB`:e<1073741824?`${Math.round(e/1048576*10)/10} MB`:`${Math.round(e/1073741824*10)/10} GB`}function F(e){return e instanceof Error?e.message:String(e)}function I(e){return e instanceof Error&&e.name===`AbortError`}export{N as HistoryDialog};