texlite 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/DESIGN.md +7 -0
  2. package/OPERATIONS.md +70 -3
  3. package/README.md +5 -0
  4. package/README.zh-CN.md +5 -0
  5. package/THIRD_PARTY_NOTICES.md +29 -0
  6. package/dist/client/assets/{AdminUsers-3CHb5012.js → AdminUsers-Buf5ZclR.js} +1 -1
  7. package/dist/client/assets/{CitationLibraryDialog-zPpsUhWJ.js → CitationLibraryDialog-DrKbIlD-.js} +1 -1
  8. package/dist/client/assets/Dashboard-DLk2j3oq.js +2 -0
  9. package/dist/client/assets/GitDialog-CTWAU8q6.js +3 -0
  10. package/dist/client/assets/HistoryDialog-Mo4p8HEg.js +7 -0
  11. package/dist/client/assets/LatexEditor-CwvakYva.js +135 -0
  12. package/dist/client/assets/{PdfPreview-BFVNczSk.js → PdfPreview-BUpELZd-.js} +1 -1
  13. package/dist/client/assets/{ProjectIconPickerDialog-Cf0zBf8u.js → ProjectIconPickerDialog-BiWSwDdt.js} +1 -1
  14. package/dist/client/assets/{ProjectNavigationDialogs-TPbe11iR.js → ProjectNavigationDialogs-CpjkXZTz.js} +1 -1
  15. package/dist/client/assets/{ProjectSettings-CDQvIlQ4.js → ProjectSettings-DoxitHbX.js} +1 -1
  16. package/dist/client/assets/ProjectWorkspace-iNqXZlsj.js +29 -0
  17. package/dist/client/assets/SelectionHistoryDialog-9FWlc3Rb.js +3 -0
  18. package/dist/client/assets/{SystemMetricsDialog-CuqHPUnn.js → SystemMetricsDialog-24kifZO6.js} +1 -1
  19. package/dist/client/assets/TagManagementDialog-BHIA0vEA.js +1 -0
  20. package/dist/client/assets/{WordCountDialog-B4PI0vEk.js → WordCountDialog-DFIWvLrP.js} +1 -1
  21. package/dist/client/assets/check-C3GZh6a1.js +1 -0
  22. package/dist/client/assets/chevron-left-l1oupvGO.js +1 -0
  23. package/dist/client/assets/editor-3rgn4IYh.js +14 -0
  24. package/dist/client/assets/{hard-drive-6uYFyezl.js → hard-drive-B-NSDVVA.js} +1 -1
  25. package/dist/client/assets/{index-BRT5O-Hg.js → index-CNTGCh7t.js} +1 -1
  26. package/dist/client/assets/index-CrlfruX_.css +1 -0
  27. package/dist/client/assets/index-DIM_KiG2.js +12 -0
  28. package/dist/client/assets/katex-D9PXdmFF.css +1 -0
  29. package/dist/client/assets/{key-round-DOAxDSfz.js → key-round-BjL9H8-H.js} +1 -1
  30. package/dist/client/assets/{latexFormatterWorker-DYkYtcFy.js → latexFormatterWorker-BRmsns8a.js} +2 -2
  31. package/dist/client/assets/minimize-2-DDCq8c49.js +1 -0
  32. package/dist/client/assets/{minus-9eVJnugf.js → minus-DgKZCT9F.js} +1 -1
  33. package/dist/client/assets/{pdf-BB1XvBIF.js → pdf-DUYcbPMK.js} +1 -1
  34. package/dist/client/assets/{plus-BGXipRoG.js → plus-CezUzSIZ.js} +1 -1
  35. package/dist/client/assets/{refresh-cw-Dvp3O90f.js → refresh-cw-CDFNL-qu.js} +1 -1
  36. package/dist/client/assets/{search-b1ORp1k8.js → search-CrDJjHoj.js} +1 -1
  37. package/dist/client/assets/{sigma-Bk0_MzWi.js → sigma-DOcJr7VG.js} +1 -1
  38. package/dist/client/assets/spellCheck-BgWyesvf.js +1 -0
  39. package/dist/client/assets/{tags-JAkbmWns.js → tags-BedQ75lh.js} +1 -1
  40. package/dist/client/assets/{type-CE2DYkPH.js → type-glZNdzZR.js} +1 -1
  41. package/dist/client/assets/{user-plus-CKalKSsw.js → user-plus-gQ6q5Nom.js} +1 -1
  42. package/dist/client/assets/{x-Bq29njHL.js → x-CSzFikn2.js} +1 -1
  43. package/dist/client/index.html +6 -4
  44. package/dist/server/app.js +130 -83
  45. package/dist/server/cli.js +4 -2
  46. package/dist/server/compileArtifacts.js +3 -2
  47. package/dist/server/config.js +27 -0
  48. package/dist/server/harper.js +205 -8
  49. package/dist/server/history.js +53 -3
  50. package/dist/server/i18n.js +8 -0
  51. package/dist/server/index.js +4 -2
  52. package/dist/server/instanceLock.js +4 -2
  53. package/dist/server/latexCompletion.js +126 -63
  54. package/dist/server/latexDocumentGraph.js +106 -0
  55. package/dist/server/latexSpellMask.js +196 -43
  56. package/dist/server/pm2.js +3 -2
  57. package/dist/server/projectReferences.js +109 -0
  58. package/dist/server/routes/auth.js +5 -2
  59. package/dist/server/routes/comments.js +13 -1
  60. package/dist/server/routes/compile.js +2 -2
  61. package/dist/server/routes/projectFiles.js +12 -3
  62. package/dist/server/routes/projectHistory.js +13 -1
  63. package/dist/server/routes/projectReferences.js +36 -0
  64. package/dist/server/routes/projects.js +41 -4
  65. package/dist/server/routes/system.js +1 -0
  66. package/dist/server/zip.js +2 -16
  67. package/dist/shared/basePath.js +44 -0
  68. package/dist/shared/bibtexReferences.js +135 -0
  69. package/dist/shared/latexCommandSnippets.js +91 -0
  70. package/dist/shared/latexDependencies.js +71 -0
  71. package/dist/shared/latexLiterals.js +215 -0
  72. package/dist/shared/latexReferenceCommands.js +75 -0
  73. package/dist/shared/latexReferences.js +193 -0
  74. package/dist/shared/latexRoot.js +21 -0
  75. package/dist/shared/latexScanner.js +183 -0
  76. package/dist/shared/writingChecks.js +4 -0
  77. package/package.json +11 -4
  78. package/texlite.config.example.json +2 -4
  79. package/dist/client/assets/Dashboard-CWfSLzD3.js +0 -2
  80. package/dist/client/assets/GitDialog-BUU2U_LV.js +0 -3
  81. package/dist/client/assets/HistoryDialog-B6aopsrw.js +0 -7
  82. package/dist/client/assets/LatexEditor-CM445Tk0.js +0 -65
  83. package/dist/client/assets/ProjectWorkspace-C6GrvKN6.js +0 -27
  84. package/dist/client/assets/SelectionHistoryDialog-CyE0_YDs.js +0 -3
  85. package/dist/client/assets/TagManagementDialog-gRLM3lLx.js +0 -1
  86. package/dist/client/assets/check-BXvzrdoz.js +0 -1
  87. package/dist/client/assets/chevron-left-BB5MYb7g.js +0 -1
  88. package/dist/client/assets/editor-CiK7TK0p.js +0 -14
  89. package/dist/client/assets/index-C0t11tlT.js +0 -14
  90. package/dist/client/assets/index-DXWp2bzM.css +0 -1
  91. package/dist/client/assets/katex-CEK31ho9.css +0 -1
  92. package/dist/client/assets/minimize-2-BWtbag2I.js +0 -1
  93. package/dist/client/assets/spellCheck-BJjWgnef.js +0 -1
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SystemMetricsDialog-CuqHPUnn.js","assets/react-BVUjbTTn.js","assets/index-C0t11tlT.js","assets/index-DXWp2bzM.css","assets/refresh-cw-Dvp3O90f.js","assets/hard-drive-6uYFyezl.js","assets/x-Bq29njHL.js","assets/sigma-Bk0_MzWi.js","assets/tags-JAkbmWns.js","assets/chevron-left-BB5MYb7g.js","assets/CitationLibraryDialog-zPpsUhWJ.js","assets/citationLibrary-ZeQPCv5O.js","assets/plus-BGXipRoG.js","assets/check-BXvzrdoz.js","assets/search-b1ORp1k8.js","assets/AdminUsers-3CHb5012.js","assets/user-plus-CKalKSsw.js","assets/key-round-DOAxDSfz.js","assets/TagManagementDialog-gRLM3lLx.js","assets/ProjectIconPickerDialog-Cf0zBf8u.js"])))=>i.map(i=>d[i]);
2
- import{c as r,S as da,L as ha,a as zt,M as se,b as Re,d as _e,C as pa,e as ma,f as C,g as D,_ as me,i as Ze}from"./index-C0t11tlT.js";import{j as e,r as i,u as ua}from"./react-BVUjbTTn.js";import{H as ya,F as ka}from"./hard-drive-6uYFyezl.js";import{G as ga,F as ja,L as xa,a as Ke,b as fa,S as va,B as Lt,c as Ma,d as ba,P as Ca,D as wa,T as Na,M as Dt,A as Et,e as St,U as za,f as Tt,g as Sa,C as Pt,h as Ta,X as Pa,i as Aa}from"./x-Bq29njHL.js";import{S as La}from"./sigma-Bk0_MzWi.js";import{T as We}from"./tags-JAkbmWns.js";import{C as Da}from"./chevron-left-BB5MYb7g.js";const Ea=r("Activity",[["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"}]]);const Fa=r("ArchiveRestore",[["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"}]]);const Ge=r("Archive",[["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"}]]);const Ia=r("ArrowDownUp",[["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"}]]);const Ft=r("ArrowRightLeft",[["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"}]]);const qa=r("Atom",[["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"}]]);const $a=r("Beaker",[["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"}]]);const Ba=r("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);const Va=r("Bot",[["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"}]]);const Ua=r("Braces",[["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"}]]);const Oa=r("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);const Ha=r("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);const Ra=r("Calculator",[["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"}]]);const It=r("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const _a=r("ChartColumn",[["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"}]]);const Za=r("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);const Ka=r("ChartNoAxesCombined",[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["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 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]]);const Wa=r("ChartPie",[["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"}]]);const Ga=r("ChartScatter",[["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"}]]);const Ja=r("CircuitBoard",[["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"}]]);const Qa=r("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);const Xa=r("CodeXml",[["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"}]]);const Ya=r("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const es=r("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);const ts=r("Database",[["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"}]]);const as=r("Dna",[["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"}]]);const ss=r("Earth",[["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"}]]);const ns=r("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const rs=r("FileChartColumnIncreasing",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]]);const os=r("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.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:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);const is=r("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);const cs=r("FileStack",[["path",{d:"M21 7h-3a2 2 0 0 1-2-2V2",key:"9rb54x"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z",key:"1059l0"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);const ls=r("FlaskConical",[["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"}]]);const ds=r("FolderArchive",[["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"}]]);const hs=r("FolderGit2",[["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"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);const ps=r("FolderKanban",[["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"}]]);const ms=r("GraduationCap",[["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"}]]);const us=r("History",[["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"}]]);const ys=r("Image",[["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"}]]);const ks=r("Languages",[["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"}]]);const gs=r("Library",[["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"}]]);const js=r("Lightbulb",[["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"}]]);const xs=r("Map",[["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"}]]);const fs=r("Microscope",[["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"}]]);const vs=r("Network",[["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"}]]);const Ms=r("Newspaper",[["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-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);const bs=r("NotebookPen",[["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"}]]);const Cs=r("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);const ws=r("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);const Ns=r("Presentation",[["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"}]]);const zs=r("Quote",[["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"}]]);const Ss=r("Regex",[["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"}]]);const Ts=r("Rocket",[["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-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);const Ps=r("Server",[["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"}]]);const As=r("ShieldCheck",[["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"}]]);const qt=r("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const Ls=r("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);const Ds=r("Target",[["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"}]]);const Es=r("Telescope",[["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"}]]);const Fs=r("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const Is=r("TestTubeDiagonal",[["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"}]]);const qs=r("TestTubes",[["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"}]]);const $s=r("University",[["circle",{cx:"12",cy:"10",r:"1",key:"1gnqs8"}],["path",{d:"M22 20V8h-4l-6-4-6 4H2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"1qj5sn"}],["path",{d:"M6 17v.01",key:"roodi6"}],["path",{d:"M6 13v.01",key:"67c122"}],["path",{d:"M18 17v.01",key:"12ktxm"}],["path",{d:"M18 13v.01",key:"tn1rt1"}],["path",{d:"M14 22v-5a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"11g7fi"}]]);const Bs=r("UsersRound",[["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"}]]);const Vs=r("Workflow",[["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"}]]),$t=["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"],Us=new Set($t);function Os(s){return typeof s=="string"&&Us.has(s)}function Hs(s){if(typeof s!="string")return null;const h=s.trim().replace(/^lucide:/i,"");return!h||h.length>96?null:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(h)?h:null}const Rs={"file-text":ba,"book-open":Ma,"notebook-pen":bs,"book-marked":Lt,"scroll-text":va,library:gs,"graduation-cap":ms,presentation:Ns,image:ys,"folder-kanban":ps,microscope:fs,"flask-conical":ls,"test-tube-diagonal":Is,atom:qa,dna:as,telescope:Es,earth:ss,map:xs,languages:ks,university:$s,"code-2":Xa,"file-code-2":ka,database:ts,server:Ps,network:vs,"circuit-board":Ja,brain:Ha,"brain-circuit":Oa,bot:Va,"shield-check":As,workflow:Vs,sigma:La,calculator:Ra,"chart-no-axes-combined":Ka,"line-chart":Za,"bar-chart-3":_a,"pie-chart":Wa,"chart-scatter":Ga,"file-spreadsheet":is,"file-chart-column-increasing":rs,lightbulb:js,rocket:Ts,target:Ds,sparkles:qt,"file-pen-line":os,"file-stack":cs,folder:fa,"folder-open":Ke,"folder-archive":ds,archive:Ge,bookmark:Ba,newspaper:Ms,"notepad-text":Cs,"sticky-note":Ls,"pen-tool":ws,quote:zs,"list-tree":xa,"file-search":ja,beaker:$a,"test-tubes":qs,"folder-git-2":hs,"git-branch":ga,terminal:Fs,braces:Ua,regex:Ss,cpu:es,"hard-drive":ya,cloud:Qa,"users-round":Bs,"calendar-days":It},hn=$t.map(s=>({name:s}));function _s(s){const h=Array.from(s.trim())[0];return h?h.toLocaleUpperCase():"?"}function Zs({icon:s,fallback:h,size:x=18}){const f=Os(s)?Rs[s]:null;if(f)return e.jsx(f,{"aria-hidden":"true",size:x,strokeWidth:1.9});const v=Hs(s);if(v){const a=`url(${`/api/project-icons/${encodeURIComponent(v)}`})`,k={maskImage:a,WebkitMaskImage:a};return e.jsx("span",{"aria-hidden":"true",className:"project-icon-external-glyph",style:k})}return e.jsx("span",{"aria-hidden":"true",children:h})}function Bt({icon:s,projectName:h,editable:x=!1,onEdit:f,editLabel:v,title:c,className:a=""}){const k=e.jsx(Zs,{icon:s,fallback:_s(h)}),m=`project-icon-avatar${x?" editable":""}${a?` ${a}`:""}`;return x&&f?e.jsx("button",{type:"button",className:m,title:v,"aria-label":v,onClick:f,children:k}):e.jsx("span",{className:m,title:c,"aria-hidden":"true",children:k})}function Vt({project:s,currentUser:h,showArchived:x,archiveBusy:f,menuOpen:v,t:c,variant:a,onToggleMenu:k,onCloseMenu:m,onAssignTags:y,onRename:E,onDuplicate:d,onArchive:z,onTransfer:B,onDelete:S}){const M=i.useRef(null),T=s.permission==="owner",F=h.role==="admin"||h.canCreateProjects,R=s.ownerId===h.id,V=s.permission==="owner";i.useEffect(()=>{if(!v)return;const l=L=>{L.target instanceof Node&&!M.current?.contains(L.target)&&m()},A=L=>{L.key==="Escape"&&m()};return document.addEventListener("pointerdown",l),document.addEventListener("keydown",A),()=>{document.removeEventListener("pointerdown",l),document.removeEventListener("keydown",A)}},[v,m]);const P=[{id:"tags",label:c("tags.assign"),icon:e.jsx(We,{"aria-hidden":!0,size:15}),section:"main",onSelect:y},...T?[{id:"rename",label:c("projects.rename"),icon:e.jsx(Ca,{"aria-hidden":!0,size:15}),section:"main",onSelect:E}]:[],...F?[{id:"duplicate",label:c("projects.duplicate"),icon:e.jsx(Ya,{"aria-hidden":!0,size:15}),section:"main",onSelect:d}]:[],{id:"download",label:c("projects.download"),icon:e.jsx(wa,{"aria-hidden":!0,size:15}),section:"main",href:`/api/projects/${s.id}/download`},{id:"archive",label:c(x?"projects.unarchive":"projects.archive"),icon:x?e.jsx(Fa,{"aria-hidden":!0,size:15}):e.jsx(Ge,{"aria-hidden":!0,size:15}),section:"main",disabled:f,onSelect:z},...R?[{id:"transfer",label:c("projects.transfer"),icon:e.jsx(Ft,{"aria-hidden":!0,size:15}),section:"main",onSelect:B}]:[],...V?[{id:"delete",label:c("common.delete"),icon:e.jsx(Na,{"aria-hidden":!0,size:15}),section:"danger",onSelect:S}]:[]],_=P.filter(l=>l.section==="main"),b=P.filter(l=>l.section==="danger"),ne=l=>{l.disabled||(m(),l.onSelect?.())};return e.jsxs("div",{ref:M,className:`project-action-menu-root project-action-menu-${a}`,onClick:l=>l.stopPropagation(),children:[e.jsx("button",{type:"button",className:"project-action-menu-trigger","aria-label":c("projects.projectActions",{project:s.name}),"aria-expanded":v,"aria-controls":`project-actions-${s.id}`,onClick:l=>{l.stopPropagation(),k()},children:e.jsx(ns,{"aria-hidden":!0,size:19})}),v&&e.jsxs("div",{id:`project-actions-${s.id}`,className:"project-action-menu",role:"group","aria-label":c("projects.projectActions",{project:s.name}),children:[_.map(l=>l.href?e.jsxs("a",{href:l.href,download:!0,onClick:A=>{A.stopPropagation(),m()},children:[l.icon,l.label]},l.id):e.jsxs("button",{type:"button",disabled:l.disabled,onClick:A=>{A.stopPropagation(),ne(l)},children:[l.icon,l.label]},l.id)),b.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"project-action-menu-separator","aria-hidden":"true"}),b.map(l=>e.jsxs("button",{type:"button",className:"danger",onClick:A=>{A.stopPropagation(),ne(l)},children:[l.icon,l.label]},l.id))]})]})]})}function Ks({project:s,currentUser:h,showArchived:x,archiveBusy:f,menuOpen:v,t:c,formatCreatedDate:a,formatUpdatedTime:k,formatExactTime:m,onOpenProject:y,onOpenMention:E,onToggleMenu:d,onCloseMenu:z,onAssignTags:B,onRename:S,onDuplicate:M,onArchive:T,onTransfer:F,onDelete:R,onChooseIcon:V}){const P=s.ownerDisplayName??s.ownerUsername??c("projects.deletedUser"),_=s.lastModifiedDisplayName??s.lastModifiedUsername??c("projects.deletedUser");return e.jsxs("article",{className:`project-card project-list-row${s.ownerId===h.id?" owned-project":""}${v?" project-list-menu-open":""}`,onClick:b=>{b.target===b.currentTarget&&y()},children:[e.jsx(Bt,{icon:s.icon,projectName:s.name,title:s.name,editable:s.permission==="owner",editLabel:c("projectIcons.change"),onEdit:V,className:"project-list-avatar"}),e.jsx("span",{className:"project-list-summary",children:e.jsx("button",{type:"button",className:"project-list-cell-open project-list-summary-open",onClick:y,"aria-label":c("projects.openProject",{project:s.name}),children:e.jsxs("span",{className:"project-list-title-line",children:[e.jsx("strong",{className:"project-list-title",title:s.name,children:s.name}),!!(s.unresolvedCommentCount&&s.unresolvedCommentCount>0)&&e.jsxs("span",{className:"project-comments-badge unresolved",title:c("projects.unresolvedCommentsTooltip",{unresolved:s.unresolvedCommentCount,total:s.commentCount??s.unresolvedCommentCount}),children:[e.jsx(Dt,{"aria-hidden":!0,size:10}),e.jsx("span",{children:c("projects.unresolvedCount",{count:s.unresolvedCommentCount})})]}),s.tags?.length>0&&e.jsx("span",{className:"project-list-tags",children:s.tags.map(b=>e.jsx("span",{className:`tag tag-${b.color} project-list-tag`,title:b.name,children:b.name},b.id))})]})})}),e.jsxs("button",{type:"button",className:"project-list-cell-open project-list-owner",onClick:y,title:P,"aria-label":c("projects.openProject",{project:s.name}),children:[e.jsxs("span",{className:"sr-only",children:[c("projects.owner"),": "]}),P]}),e.jsxs("button",{type:"button",className:"project-list-cell-open project-list-created",onClick:y,title:m(s.createdAt),"aria-label":c("projects.openProject",{project:s.name}),children:[e.jsxs("span",{className:"sr-only",children:[c("projects.created"),": "]}),e.jsx("time",{dateTime:s.createdAt,children:a(s.createdAt)})]}),e.jsxs("button",{type:"button",className:"project-list-cell-open project-list-modified",onClick:y,title:c("projects.modifiedByUser",{time:m(s.updatedAt),user:_}),"aria-label":c("projects.openProject",{project:s.name}),children:[e.jsxs("span",{className:"sr-only",children:[c("projects.modified"),": "]}),e.jsx("time",{dateTime:s.updatedAt,children:k(s.updatedAt)}),e.jsx("small",{children:c("projects.byUser",{user:_})})]}),s.unreadMentionCount&&s.unreadMentionCount>0?e.jsxs("button",{className:"project-mentions-badge project-list-mentions",type:"button",title:c("projects.unreadMentionsTooltip",{count:s.unreadMentionCount}),onClick:E,children:[e.jsx(Et,{"aria-hidden":!0,size:10}),e.jsx("span",{children:s.unreadMentionCount})]}):e.jsx("span",{className:"project-list-mentions"}),e.jsx(Vt,{variant:"list",project:s,currentUser:h,showArchived:x,archiveBusy:f,menuOpen:v,t:c,onToggleMenu:d,onCloseMenu:z,onAssignTags:B,onRename:S,onDuplicate:M,onArchive:T,onTransfer:F,onDelete:R})]})}const Ws=i.lazy(()=>me(()=>import("./SystemMetricsDialog-CuqHPUnn.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(s=>({default:s.SystemMetricsDialog}))),Gs=i.lazy(()=>me(()=>import("./CitationLibraryDialog-zPpsUhWJ.js"),__vite__mapDeps([10,1,2,3,11,6,12,13,14,9,8])).then(s=>({default:s.CitationLibraryDialog}))),Js=i.lazy(()=>me(()=>import("./AdminUsers-3CHb5012.js"),__vite__mapDeps([15,1,2,3,6,16,17,5,7,8,9])).then(s=>({default:s.AdminUsers}))),Qs=i.lazy(()=>me(()=>import("./TagManagementDialog-gRLM3lLx.js"),__vite__mapDeps([18,1,2,3,12,6,13])).then(s=>({default:s.TagManagementDialog}))),Xs=i.lazy(()=>me(()=>import("./ProjectIconPickerDialog-Cf0zBf8u.js"),__vite__mapDeps([19,1,2,3,14,5,6,7,8,9])).then(s=>({default:s.ProjectIconPickerDialog})));function Ys(s){return s instanceof Error&&s.name==="AbortError"}function en(s,h,x,f){const v=new Date(s).getTime();if(!Number.isFinite(v))return s;const c=v-x,a=Math.abs(c),k=60*1e3,m=60*k,y=24*m,E=3*y;if(a>E){const S=Math.floor(a/y),M=c<0?"Past":"Future";return f(`projects.relativeDays${M}`,{days:S,hours:0,minutes:0})}if(a>=y){const S=Math.floor(a/y),M=Math.floor(a%y/m),T=c<0?"Past":"Future",F=M>0?"DaysHours":"Days";return f(`projects.relative${F}${T}`,{days:S,hours:M,minutes:0})}if(a>=m){const S=Math.floor(a/m),M=Math.floor(a%m/k),T=c<0?"Past":"Future",F=M>0?"HoursMinutes":"Hours";return f(`projects.relative${F}${T}`,{days:0,hours:S,minutes:M})}const d="minute",z=k,B=Math.sign(c)*Math.max(1,Math.floor(a/z));return new Intl.RelativeTimeFormat(h,{numeric:"always"}).format(B,d)}function tn(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(1)} MB`}function an({site:s,user:h,initialData:x,onDataChange:f,onUser:v,onOpenProject:c}){const{t:a}=ua(),[k,m]=i.useState(()=>x?.projects??[]),[y,E]=i.useState(()=>x?.tags??[]),[d,z]=i.useState(()=>x?.pagination??{page:1,pageSize:20,total:x?.projects.length??0,totalPages:x?.projects.length?1:0}),[B,S]=i.useState(!!x),[M,T]=i.useState(!1),[F,R]=i.useState(!1),[V,P]=i.useState(!1),[_,b]=i.useState(""),[ne,l]=i.useState(""),[A,L]=i.useState(""),[Je,Z]=i.useState(""),[Qe,K]=i.useState(""),[Ut,re]=i.useState(""),[Ot,ue]=i.useState(!1),[ye,Xe]=i.useState(""),[W,Ye]=i.useState(!1),[Ht,ke]=i.useState(!1),[Fe,Ie]=i.useState(""),[I,et]=i.useState(null),[tt,U]=i.useState(""),ge=i.useRef(null),at=i.useRef(null),[st,nt]=i.useState(!1),[O,Rt]=i.useState(""),[w,rt]=i.useState(""),[je,qe]=i.useState(!1),[_t,$e]=i.useState(!1),[G,J]=i.useState(null),[ot,xe]=i.useState(null),[Be,oe]=i.useState(null),[fe,ve]=i.useState(""),[Q,it]=i.useState(!1),[Me,ie]=i.useState(null),[be,Y]=i.useState(""),[Ce,ct]=i.useState(!1),[ce,we]=i.useState(null),[Ne,lt]=i.useState(!1),[ze,Se]=i.useState(null),[Ve,dt]=i.useState([]),[Te,le]=i.useState(""),[ee,Pe]=i.useState(!1),[ht,te]=i.useState(""),[de,Zt]=i.useState(()=>localStorage.getItem("texlite-project-view")==="list"?"list":"grid"),[q,Kt]=i.useState(()=>localStorage.getItem("texlite-project-sort")==="created"?"created":"updated"),[u,Wt]=i.useState(!1),[pt,mt]=i.useState(""),[Ae,H]=i.useState(null),[N,$]=i.useState(1),[Gt,Jt]=i.useState(()=>Date.now()),[ut,Qt]=i.useState(""),Ue=i.useRef(0),he=i.useRef(null),yt=(t,n,o,p,g)=>`${t?"archived":"active"}|${n}|${o}|${p}|${g}`,kt=yt(u,N,O,w,q),pe=(t,n,o,p,g)=>{const j=new URLSearchParams({page:String(n),pageSize:"20",sort:g});t&&j.set("archived","1"),o.trim()&&j.set("search",o.trim()),p&&j.set("tag",p);const X=yt(t,n,o,p,g),De=++Ue.current;he.current?.abort();const Ee=new AbortController;return he.current=Ee,Promise.all([C(`/api/projects?${j.toString()}`,{signal:Ee.signal}),C("/api/tags",{signal:Ee.signal})]).then(([ae,la])=>{De===Ue.current&&(m(ae.projects),E(la.tags),z(ae.pagination),$(ae.pagination.page),S(!0),Qt(X))}).catch(ae=>{!Ys(ae)&&De===Ue.current&&b(D(ae))}).finally(()=>{he.current===Ee&&(he.current=null)})};i.useEffect(()=>(pe(u,N,O,w,q),()=>he.current?.abort()),[u,N,O,w,q]),i.useEffect(()=>{B&&!u&&ut===kt&&f(k,y,d)},[k,y,d,B,ut,kt,u]),i.useEffect(()=>{const t=window.setInterval(()=>Jt(Date.now()),6e4);return()=>window.clearInterval(t)},[]),i.useEffect(()=>{if(!je)return;const t=o=>{o.target instanceof Node&&!at.current?.contains(o.target)&&qe(!1)},n=o=>{o.key==="Escape"&&qe(!1)};return document.addEventListener("pointerdown",t),document.addEventListener("keydown",n),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",n)}},[je]);const gt=t=>{H(null),Zt(t),localStorage.setItem("texlite-project-view",t)},Xt=t=>{Kt(t),$(1),localStorage.setItem("texlite-project-sort",t)},jt=t=>{Wt(t),$(1)},xt=t=>{rt(t),$(1)},ft=async()=>{if(!(!ye.trim()||W)){Ye(!0),l("");try{const{project:t}=await C("/api/projects",{method:"POST",body:JSON.stringify({name:ye})});ue(!1),Xe("");const n=u||N!==1?k:[t,...k].slice(0,d.pageSize),o=u?d:{...d,total:d.total+1,totalPages:Math.ceil((d.total+1)/d.pageSize)};m(n),z(o),u||f(n,y,o),c(t.id)}catch(t){l(D(t))}finally{Ye(!1)}}},Yt=async()=>{if(!I)return;const t=s.maxUploadSizeMB;if(I.size>t*1024*1024)return U(a("errors.fileTooLarge",{size:t}));nt(!0),U("");const n=new FormData;n.append("file",I);try{const{project:o}=await C(`/api/projects/import?name=${encodeURIComponent(Fe.trim())}`,{method:"POST",body:n}),p=u||N!==1?k:[o,...k].slice(0,d.pageSize),g=u?d:{...d,total:d.total+1,totalPages:Math.ceil((d.total+1)/d.pageSize)};m(p),z(g),u||f(p,y,g),ke(!1),et(null),Ie(""),c(o.id)}catch(o){U(D(o))}finally{nt(!1)}},Oe=t=>{if(t&&!t.name.toLocaleLowerCase().endsWith(".zip")){U(a("errors.zipOnly"));return}U(""),et(t),t&&!Fe&&Ie(t.name.replace(/\.zip$/i,""))},ea=async()=>{await C("/api/auth/logout",{method:"POST"}),v(null)},ta=async t=>{if(!G)return;const n=G.tags.some(o=>o.id===t.id);L("");try{const p=(await C(n?`/api/projects/${G.id}/tags/${t.id}`:`/api/projects/${G.id}/tags`,n?{method:"DELETE"}:{method:"POST",body:JSON.stringify({tagId:t.id})})).project;J(p),m(g=>g.map(j=>j.id===p.id?p:j))}catch(o){L(D(o))}},aa=t=>{E(n=>[...n,t].sort((o,p)=>o.name.localeCompare(p.name)))},sa=t=>{const n=o=>o.map(p=>p.id===t.id?t:p);E(o=>n(o).sort((p,g)=>p.name.localeCompare(g.name))),m(o=>o.map(p=>({...p,tags:n(p.tags)}))),J(o=>o?{...o,tags:n(o.tags)}:null)},na=t=>{E(n=>n.filter(o=>o.id!==t)),m(n=>n.map(o=>({...o,tags:o.tags.filter(p=>p.id!==t)}))),J(n=>n?{...n,tags:n.tags.filter(o=>o.id!==t)}:null),rt(n=>n===t?"":n)},ra=async(t,n)=>{const o=await C(`/api/projects/${t}/icon`,{method:"PATCH",body:JSON.stringify({icon:n})});m(p=>{const g=p.map(j=>j.id===o.project.id?o.project:j);return q==="updated"?g.sort((j,X)=>X.updatedAt.localeCompare(j.updatedAt)||j.name.localeCompare(X.name)):g})},vt=async()=>{if(!(!Be||!fe.trim()||Q)){it(!0),Z("");try{const t=await C(`/api/projects/${Be.id}`,{method:"PATCH",body:JSON.stringify({name:fe})});m(n=>n.map(o=>o.id===t.project.id?t.project:o)),oe(null),ve("")}catch(t){Z(D(t))}finally{it(!1)}}},Mt=async()=>{if(!(!Me||!be.trim())){ct(!0),K("");try{await C(`/api/projects/${Me.id}/duplicate`,{method:"POST",body:JSON.stringify({name:be})}),ie(null),Y(""),pe(u,N,O,w,q)}catch(t){K(D(t))}finally{ct(!1)}}},oa=async()=>{if(!(!ce||Ne)){lt(!0),re("");try{await C(`/api/projects/${ce.id}`,{method:"DELETE"}),m(g=>g.filter(j=>j.id!==ce.id));const t=Math.max(0,d.total-1),n=Math.ceil(t/d.pageSize),o=n===0?1:Math.min(N,n),p={...d,page:o,total:t,totalPages:n};z(p),we(null),o!==N?$(o):pe(u,N,O,w,q)}catch(t){re(D(t))}finally{lt(!1)}}},bt=async t=>{Se(t),le(""),dt([]),te(""),Pe(!0);try{const n=await C("/api/users");dt(n.users.filter(o=>o.id!==t.ownerId))}catch(n){te(D(n))}finally{Pe(!1)}},ia=async()=>{if(!(!ze||!Te)){Pe(!0),te("");try{await C(`/api/projects/${ze.id}/owner`,{method:"PUT",body:JSON.stringify({userId:Te})}),Se(null),le(""),pe(u,N,O,w,q)}catch(t){te(D(t))}finally{Pe(!1)}}},Ct=async t=>{const n=!u;mt(t.id),b("");try{await C(`/api/projects/${t.id}/archive`,{method:n?"PUT":"DELETE"});const o=k.filter(De=>De.id!==t.id);m(o);const p=Math.max(0,d.total-1),g=Math.ceil(p/d.pageSize),j=g===0?1:Math.min(N,g),X={...d,page:j,total:p,totalPages:g};z(X),u||f(o,y,X),j!==N?$(j):pe(u,N,O,w,q)}catch(o){b(D(o))}finally{mt("")}},wt=async t=>{try{const o=(await C(`/api/projects/${t.id}/mentions?unread=1&limit=1`)).mentions[0];c(t.id,o?.id)}catch(n){b(D(n))}},Le=k,He=t=>new Date(t).toLocaleString(Ze.resolvedLanguage),ca=t=>{const n=new Date(t);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(Ze.resolvedLanguage??"en",{year:"numeric",month:"2-digit",day:"2-digit"}).format(n):t},Nt=t=>en(t,Ze.resolvedLanguage??"en",Gt,(n,o)=>a(n,o));return e.jsxs("div",{className:"page",children:[e.jsxs("header",{className:"topbar",children:[e.jsxs("a",{className:"brand-link",href:"/","aria-label":s.siteName,children:[e.jsx("span",{className:"site-title",children:s.siteName}),e.jsx(da,{siteName:s.siteName})]}),e.jsxs("div",{className:"top-actions",children:[h.role==="admin"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"ghost",onClick:()=>R(!0),children:[e.jsx(Ea,{"aria-hidden":!0,size:14}),a("metrics.title")]}),e.jsxs("button",{className:`ghost${M?" top-return-action":""}`,onClick:()=>{T(t=>!t),P(!1)},children:[M?e.jsx(St,{"aria-hidden":!0,size:14}):e.jsx(za,{"aria-hidden":!0,size:14}),a(M?"users.back":"users.manage")]})]}),e.jsxs("button",{className:`ghost${V?" top-return-action":""}`,onClick:()=>{T(!1),P(t=>!t)},children:[V?e.jsx(St,{"aria-hidden":!0,size:14}):e.jsx(Lt,{"aria-hidden":!0,size:14}),a(V?"users.back":"citationLibrary.title")]}),e.jsx(ha,{compact:!0}),e.jsxs("span",{className:"top-user-identity",children:[e.jsx("strong",{children:h.displayName}),e.jsxs("small",{children:["@",h.username]})]}),e.jsx("button",{className:"ghost",onClick:ea,children:a("auth.logout")})]})]}),M?e.jsx("main",{className:"dashboard",children:e.jsx(zt,{onClose:()=>T(!1),children:e.jsx(Js,{currentUser:h,minPasswordLength:s.minPasswordLength})})}):V?e.jsx("main",{className:"dashboard citation-library-page-shell",children:e.jsx(zt,{onClose:()=>P(!1),children:e.jsx(Gs,{page:!0,open:!0,onOpenChange:P,onBack:()=>P(!1),currentUserId:h.id,maxBibtexBytes:s.maxCitationBibtexBytes})})}):e.jsxs("main",{className:"dashboard",children:[e.jsxs("div",{className:"section-title",children:[e.jsxs("div",{children:[e.jsxs("h1",{children:[e.jsx(Ke,{"aria-hidden":!0,size:25}),a("projects.title")]}),e.jsx("p",{className:"muted",children:h.canCreateProjects?a("projects.subtitle"):a("projects.restricted")})]}),e.jsxs("div",{className:"section-actions",children:[e.jsxs("button",{onClick:()=>$e(!0),children:[e.jsx(We,{"aria-hidden":!0,size:15}),a("tags.manage")]}),h.canCreateProjects&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{U(""),ke(!0)},children:[e.jsx(Tt,{"aria-hidden":!0,size:15}),a("projects.upload")]}),e.jsxs("button",{className:"primary",onClick:()=>{l(""),ue(!0)},children:[e.jsx(Sa,{"aria-hidden":!0,size:15}),a("projects.new")]})]})]})]}),_&&e.jsx("p",{className:"error",children:_}),e.jsxs("div",{className:"project-catalog-layout",children:[e.jsxs("aside",{ref:at,className:`project-tag-sidebar${w?" has-active-filter":""}`,children:[e.jsxs("button",{type:"button",className:"project-tag-toggle",title:a("projects.filterTags"),"aria-label":a("projects.filterTags"),"aria-expanded":je,"aria-controls":"dashboard-tag-filters",onClick:()=>qe(t=>!t),children:[e.jsxs("span",{className:"project-tag-toggle-copy",children:[e.jsx(We,{"aria-hidden":!0,size:15}),e.jsx("span",{children:a("projects.filterTags")})]}),e.jsx(Pt,{className:"project-tag-toggle-chevron","aria-hidden":!0,size:15})]}),je&&e.jsxs("div",{id:"dashboard-tag-filters",className:"project-tag-filters",role:"group","aria-label":a("projects.filterTags"),children:[e.jsx("button",{type:"button",className:w?"":"active","aria-pressed":!w,onClick:()=>xt(""),children:a("projects.allTags")}),y.length>0?y.map(t=>e.jsxs("button",{type:"button",className:w===t.id?"active":"",title:t.name,"aria-pressed":w===t.id,onClick:()=>xt(w===t.id?"":t.id),children:[e.jsx(At,{color:t.color}),e.jsx("span",{children:t.name})]},t.id)):e.jsx("p",{className:"project-tag-empty",children:a("tags.none")})]})]}),e.jsxs("div",{className:"project-catalog-content",children:[e.jsxs("div",{className:"project-toolbar",children:[e.jsx("input",{type:"search",placeholder:a("projects.search"),value:O,onChange:t=>{Rt(t.target.value),$(1)}}),e.jsxs("div",{className:"project-scope",role:"tablist","aria-label":a("projects.scope"),children:[e.jsxs("button",{className:u?"":"active",onClick:()=>jt(!1),role:"tab","aria-selected":!u,children:[e.jsx(Ke,{size:14}),a("projects.active")]}),e.jsxs("button",{className:u?"active":"",onClick:()=>jt(!0),role:"tab","aria-selected":u,children:[e.jsx(Ge,{size:14}),a("projects.archived")]})]}),e.jsxs("label",{className:"project-sort",children:[e.jsx(Ia,{size:14}),e.jsx("span",{children:a("projects.sortBy")}),e.jsxs("select",{value:q,onChange:t=>Xt(t.target.value),children:[e.jsx("option",{value:"updated",children:a("projects.sortModified")}),e.jsx("option",{value:"created",children:a("projects.sortCreated")})]})]}),e.jsxs("div",{className:"view-toggle",children:[e.jsx("button",{className:de==="grid"?"active":"",onClick:()=>gt("grid"),title:a("projects.grid"),children:"▦"}),e.jsx("button",{className:de==="list"?"active":"",onClick:()=>gt("list"),title:a("projects.list"),children:"☷"})]})]}),e.jsxs("div",{className:`project-grid ${de==="list"?"list-view":""}${Ae?" project-list-menu-active":""}`,children:[de==="list"&&Le.length>0&&e.jsxs("div",{className:"project-list-header","aria-hidden":"true",children:[e.jsx("span",{className:"project-list-header-avatar"}),e.jsx("span",{children:a("projects.title")}),e.jsx("span",{children:a("projects.owner")}),e.jsx("span",{className:"project-list-header-created",children:a("projects.created")}),e.jsx("span",{children:a("projects.modified")}),e.jsx("span",{className:"project-list-header-mentions",children:a("projects.mentionsColumn")}),e.jsx("span",{className:"project-list-header-actions",children:a("projects.actions")})]}),de==="list"?Le.map(t=>e.jsx(Ks,{project:t,currentUser:h,showArchived:u,archiveBusy:pt===t.id,menuOpen:Ae===t.id,t:a,formatCreatedDate:ca,formatUpdatedTime:Nt,formatExactTime:He,onOpenProject:()=>{H(null),c(t.id)},onOpenMention:()=>{wt(t)},onToggleMenu:()=>H(n=>n===t.id?null:t.id),onCloseMenu:()=>H(n=>n===t.id?null:n),onAssignTags:()=>{L(""),J(t)},onRename:()=>{Z(""),oe(t),ve(t.name)},onDuplicate:()=>{K(""),ie(t),Y(`${t.name} (1)`)},onArchive:()=>{Ct(t)},onTransfer:()=>{bt(t)},onDelete:()=>{we(t),re("")},onChooseIcon:()=>xe(t)},t.id)):Le.map(t=>e.jsxs("article",{className:`project-card project-grid-card${t.ownerId===h.id?" owned-project":""}${Ae===t.id?" project-card-menu-open":""}`,role:"button",tabIndex:0,"aria-label":a("projects.openProject",{project:t.name}),onClick:()=>{H(null),c(t.id)},onKeyDown:n=>{n.target!==n.currentTarget||n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),H(null),c(t.id))},children:[e.jsxs("div",{className:"project-card-meta-row",children:[e.jsxs("div",{className:"project-card-badges",children:[e.jsx("span",{className:"owner-badge",title:t.ownerDisplayName??t.ownerUsername??a("projects.deletedUser"),children:t.ownerDisplayName??t.ownerUsername??a("projects.deletedUser")}),!!(t.unreadMentionCount&&t.unreadMentionCount>0)&&e.jsxs("button",{className:"project-mentions-badge",type:"button",title:a("projects.unreadMentionsTooltip",{count:t.unreadMentionCount}),"aria-label":a("projects.unreadMentionsTooltip",{count:t.unreadMentionCount}),onClick:n=>{n.stopPropagation(),wt(t)},children:[e.jsx(Et,{"aria-hidden":!0,size:11}),e.jsx("span",{children:t.unreadMentionCount})]})]}),e.jsx(Vt,{variant:"grid",project:t,currentUser:h,showArchived:u,archiveBusy:pt===t.id,menuOpen:Ae===t.id,t:a,onToggleMenu:()=>H(n=>n===t.id?null:t.id),onCloseMenu:()=>H(n=>n===t.id?null:n),onAssignTags:()=>{L(""),J(t)},onRename:()=>{Z(""),oe(t),ve(t.name)},onDuplicate:()=>{K(""),ie(t),Y(`${t.name} (1)`)},onArchive:()=>{Ct(t)},onTransfer:()=>{bt(t)},onDelete:()=>{we(t),re("")}})]}),e.jsxs("div",{className:"project-card-title-row",children:[e.jsx("span",{className:"project-card-icon-control",onClick:t.permission==="owner"?n=>n.stopPropagation():void 0,children:e.jsx(Bt,{icon:t.icon,projectName:t.name,title:t.name,editable:t.permission==="owner",editLabel:a("projectIcons.change"),onEdit:()=>xe(t),className:"project-card-icon"})}),e.jsx("strong",{className:"project-card-title",title:t.name,children:t.name})]}),e.jsx("div",{className:"project-card-tags","aria-label":a("tags.assignTitle",{project:t.name}),title:t.tags?.map(n=>n.name).join(", ")||void 0,children:t.tags?.map(n=>e.jsx("span",{className:`tag tag-${n.color}`,title:n.name,children:n.name},n.id))}),e.jsxs("dl",{className:"project-meta",children:[e.jsxs("div",{children:[e.jsxs("dt",{className:"project-meta-created-label",children:[e.jsxs("span",{children:[e.jsx(It,{"aria-hidden":!0,size:13}),a("projects.created")]}),!!(t.unresolvedCommentCount&&t.unresolvedCommentCount>0)&&e.jsxs("span",{className:"project-comments-badge unresolved",title:a("projects.unresolvedCommentsTooltip",{unresolved:t.unresolvedCommentCount,total:t.commentCount??t.unresolvedCommentCount}),children:[e.jsx(Dt,{"aria-hidden":!0,size:11}),e.jsx("span",{children:a("projects.unresolvedCount",{count:t.unresolvedCommentCount})})]})]}),e.jsx("dd",{children:e.jsx("time",{dateTime:t.createdAt,children:He(t.createdAt)})})]}),e.jsxs("div",{children:[e.jsxs("dt",{children:[e.jsx(us,{"aria-hidden":!0,size:13}),a("projects.modified")]}),e.jsxs("dd",{title:a("projects.modifiedByUser",{time:He(t.updatedAt),user:t.lastModifiedDisplayName??t.lastModifiedUsername??a("projects.deletedUser")}),children:[e.jsx("time",{dateTime:t.updatedAt,children:Nt(t.updatedAt)}),e.jsxs("span",{className:"project-modified-by",children:[" · ",a("projects.byUser",{user:t.lastModifiedDisplayName??t.lastModifiedUsername??a("projects.deletedUser")})]})]})]})]})]},t.id)),Le.length===0&&(k.length===0?u?e.jsx("div",{className:"empty",children:a("projects.noArchived")}):e.jsxs("div",{className:"project-empty",children:[e.jsx("span",{className:"project-empty-icon",children:e.jsx(qt,{size:28})}),e.jsx("h2",{children:a("projects.emptyTitle")}),e.jsx("p",{children:h.canCreateProjects?a("projects.emptyDescription"):a("projects.emptyRestricted")})]}):e.jsx("div",{className:"empty",children:a("projects.noMatches")}))]}),d.totalPages>1&&e.jsxs("nav",{className:"project-pagination","aria-label":a("projects.pagination"),children:[e.jsxs("button",{disabled:d.page<=1,onClick:()=>$(t=>Math.max(1,t-1)),title:a("projects.previousPage"),children:[e.jsx(Da,{size:15}),a("projects.previousPage")]}),e.jsx("span",{children:a("projects.pageOf",{page:d.page,totalPages:d.totalPages,count:d.total})}),e.jsxs("button",{disabled:d.page>=d.totalPages,onClick:()=>$(t=>Math.min(d.totalPages,t+1)),title:a("projects.nextPage"),children:[e.jsx(Pt,{size:15}),a("projects.nextPage")]})]})]})]}),e.jsx(se,{open:Ot,title:a("projects.new"),description:a("projects.newDescription"),onOpenChange:t=>{!t&&W||(ue(t),t||l(""))},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:W,onClick:()=>ue(!1),children:a("common.cancel")}),e.jsxs("button",{className:"primary",disabled:W||!ye.trim(),"aria-busy":W,onClick:()=>{ft()},children:[W&&e.jsx(Re,{className:"spin",size:14}),a(W?"common.loading":"common.create")]})]}),children:e.jsxs(e.Fragment,{children:[ne&&e.jsx("p",{className:"error dialog-error",children:ne}),e.jsxs("label",{className:"form-field",children:[a("projects.name"),e.jsx("input",{autoFocus:!0,value:ye,onChange:t=>{Xe(t.target.value),l("")},onKeyDown:t=>{t.key==="Enter"&&ft()}})]})]})}),e.jsx(se,{open:Ht,title:a("projects.upload"),description:a("projects.uploadDescription",{size:s.maxUploadSizeMB}),onOpenChange:t=>{ke(t),t||U("")},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{ke(!1),U("")},children:a("common.cancel")}),e.jsx("button",{className:"primary",disabled:!I||st,onClick:()=>{Yt()},children:a(st?"projects.importing":"projects.import")})]}),children:e.jsxs("div",{className:"form-stack",children:[tt&&e.jsx("p",{className:"error import-error",children:tt}),e.jsxs("div",{className:`upload-picker${I?" has-file":""}`,onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect="copy"},onDrop:t=>{t.preventDefault(),Oe(t.dataTransfer.files[0]??null)},children:[e.jsx("input",{ref:ge,className:"sr-only",type:"file",accept:".zip,application/zip",onChange:t=>Oe(t.target.files?.[0]??null)}),e.jsx(Ta,{size:34}),e.jsxs("div",{className:"upload-picker-copy",children:[e.jsx("strong",{children:I?.name??a("projects.chooseZip")}),e.jsx("span",{children:I?a("projects.selectedFileSize",{size:tn(I.size)}):a("projects.dropZip")})]}),e.jsxs("button",{type:"button",onClick:()=>ge.current?.click(),children:[e.jsx(Tt,{size:15}),a("projects.browse")]}),I&&e.jsx("button",{className:"upload-clear",type:"button",title:a("projects.clearFile"),"aria-label":a("projects.clearFile"),onClick:()=>{Oe(null),ge.current&&(ge.current.value="")},children:e.jsx(Pa,{size:14})})]}),e.jsxs("label",{className:"form-field",children:[a("projects.name"),e.jsx("input",{value:Fe,onChange:t=>Ie(t.target.value)})]})]})}),_t&&e.jsx(_e,{title:a("tags.manage"),onClose:()=>$e(!1),children:e.jsx(Qs,{open:!0,onOpenChange:$e,onTagCreated:aa,onTagUpdated:sa,onTagDeleted:na})}),ot&&e.jsx(_e,{title:a("projectIcons.title"),onClose:()=>xe(null),children:e.jsx(Xs,{project:ot,open:!0,onOpenChange:t=>{t||xe(null)},onSave:ra})}),e.jsx(se,{open:!!G,title:a("tags.assignTitle",{project:G?.name??""}),description:a("tags.assignDescription"),onOpenChange:t=>{t||(J(null),L(""))},footer:e.jsx("button",{onClick:()=>{J(null),L("")},children:a("common.close")}),children:e.jsxs("div",{className:"tag-assignment-list",children:[A&&e.jsx("p",{className:"error dialog-error",children:A}),y.map(t=>e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:!!G?.tags.some(n=>n.id===t.id),onChange:()=>{ta(t)}}),e.jsx(At,{color:t.color}),e.jsx("span",{children:t.name})]},t.id)),y.length===0&&e.jsx("p",{className:"muted",children:a("tags.empty")})]})}),e.jsx(se,{open:!!Be,title:a("projects.renameTitle"),onOpenChange:t=>{!t&&Q||t||(oe(null),Z(""))},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:Q,onClick:()=>{oe(null),Z("")},children:a("common.cancel")}),e.jsxs("button",{className:"primary",disabled:Q||!fe.trim(),"aria-busy":Q,onClick:()=>{vt()},children:[Q&&e.jsx(Re,{className:"spin",size:14}),a(Q?"common.loading":"projects.rename")]})]}),children:e.jsxs(e.Fragment,{children:[Je&&e.jsx("p",{className:"error dialog-error",children:Je}),e.jsxs("label",{className:"form-field",children:[a("projects.name"),e.jsx("input",{autoFocus:!0,value:fe,onChange:t=>{ve(t.target.value),Z("")},onKeyDown:t=>{t.key==="Enter"&&vt()}})]})]})}),e.jsx(se,{open:!!Me,title:a("projects.duplicateTitle"),description:a("projects.duplicateDescription",{project:Me?.name??""}),onOpenChange:t=>{!t&&!Ce&&(ie(null),Y(""),K(""))},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:Ce,onClick:()=>{ie(null),Y(""),K("")},children:a("common.cancel")}),e.jsx("button",{className:"primary",disabled:Ce||!be.trim(),onClick:()=>{Mt()},children:a(Ce?"projects.duplicating":"projects.duplicate")})]}),children:e.jsxs(e.Fragment,{children:[Qe&&e.jsx("p",{className:"error dialog-error",children:Qe}),e.jsxs("label",{className:"form-field",children:[a("projects.name"),e.jsx("input",{autoFocus:!0,value:be,onChange:t=>{Y(t.target.value),K("")},onKeyDown:t=>{t.key==="Enter"&&Mt()}})]})]})}),e.jsx(se,{open:!!ze,title:a("projects.transferOwnership"),description:a("projects.transferDescription",{project:ze?.name??""}),onOpenChange:t=>{!t&&!ee&&(Se(null),le(""),te(""))},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:ee,onClick:()=>{Se(null),le(""),te("")},children:a("common.cancel")}),e.jsxs("button",{className:"primary",disabled:ee||!Te,onClick:()=>{ia()},children:[ee?e.jsx(Re,{className:"spin",size:14}):e.jsx(Ft,{size:14}),a("projects.transfer")]})]}),children:e.jsxs("div",{className:"form-stack",children:[ht&&e.jsx("p",{className:"error dialog-error",children:ht}),e.jsxs("label",{className:"form-field",children:[a("projects.newOwner"),e.jsxs("select",{disabled:ee||Ve.length===0,value:Te,onChange:t=>le(t.target.value),children:[e.jsx("option",{value:"",children:ee?a("common.loading"):Ve.length>0?a("projects.chooseNewOwner"):a("projects.noTransferUsers")}),Ve.map(t=>e.jsxs("option",{value:t.id,children:[t.displayName??t.username," (@",t.username,")"]},t.id))]})]}),e.jsxs("p",{className:"warning",children:[e.jsx(Aa,{size:15}),a("projects.transferWarning")]})]})}),e.jsx(pa,{open:!!ce,title:a("projects.deleteTitle"),description:a("projects.deleteDescription",{project:ce?.name??""}),confirmLabel:a(Ne?"common.loading":"common.delete"),danger:!0,busy:Ne,error:Ut,onCancel:()=>{Ne||(we(null),re(""))},onConfirm:()=>{oa()}})]}),F&&e.jsx(_e,{title:a("metrics.title"),onClose:()=>R(!1),children:e.jsx(Ws,{open:!0,onOpenChange:R})}),e.jsx(ma,{})]})}function At({color:s}){return e.jsx("span",{className:`tag-dot tag-${s}`})}const pn=Object.freeze(Object.defineProperty({__proto__:null,Dashboard:an},Symbol.toStringTag,{value:"Module"}));export{Ea as A,pn as D,Zs as P,As as S,_s as a,Os as i,Hs as n,hn as p};
@@ -1,3 +0,0 @@
1
- import{u as be,r as n,j as e}from"./react-BVUjbTTn.js";import{c as p,M as H,b as x,f as l}from"./index-C0t11tlT.js";import{G as q,C as ie,T as ke}from"./x-Bq29njHL.js";import{K as ye}from"./key-round-DOAxDSfz.js";import{C as ne,R as ve}from"./ProjectWorkspace-C6GrvKN6.js";import{G as ae,M as Ce}from"./minimize-2-BWtbag2I.js";import{M as Ne,a as we}from"./minus-9eVJnugf.js";import{P as ze}from"./plus-BGXipRoG.js";import"./check-BXvzrdoz.js";import"./search-b1ORp1k8.js";import"./user-plus-CKalKSsw.js";import"./refresh-cw-Dvp3O90f.js";const Se=p("CloudUpload",[["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"}]]);const oe=p("ExternalLink",[["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"}]]);const G=p("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const W=p("Github",[["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",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);const Ee=p("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);const Te=p("Undo2",[["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"}]]);function Ge({open:h,project:o,onOpenChange:b,onBeforeMutation:r}){const{t:s,i18n:E}=be(),[i,u]=n.useState(null),[J,K]=n.useState([]),[T,k]=n.useState(""),[F,V]=n.useState(()=>re(o.name)),[_,ce]=n.useState(!0),[D,Z]=n.useState(""),[y,M]=n.useState(null),[m,j]=n.useState(null),[U,R]=n.useState(!1),[le,v]=n.useState(!1),[$,L]=n.useState(!0),[P,A]=n.useState(!0),[a,C]=n.useState(""),[Q,N]=n.useState(""),[X,B]=n.useState(""),[g,f]=n.useState(!1),[w,Y]=n.useState(10),O=n.useRef(null),z=async(t=!1)=>{const c=await l(`/api/projects/${o.id}/git`);if(u(c.status),t&&(L(!c.status.tokenConfigured),A(!c.status.remoteUrl)),c.status.initialized&&c.status.latestCommit){const S=await l(`/api/projects/${o.id}/git/history`);K(S.commits)}else K([])};n.useEffect(()=>{if(!h){document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),f(!1),k("");return}N(""),B(""),M(null),f(!1),V(re(o.name)),C("load"),r().then(()=>z(!0)).catch(t=>N(t instanceof Error?t.message:s("errors.generic"))).finally(()=>C(""))},[h,o.id]),n.useEffect(()=>{const t=()=>f(document.fullscreenElement===O.current);return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]),n.useEffect(()=>{if(!g)return;const t=c=>{c.key==="Escape"&&!document.fullscreenElement&&f(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[g]);const d=async(t,c,S,ee)=>{C(t),N(""),B("");try{await c(),S&&B(S)}catch(se){const te=se instanceof Error?se.message:s("errors.generic");N(ee?`${ee}: ${te}`:te)}finally{C("")}},de=()=>d("token",async()=>{const t=await l(`/api/projects/${o.id}/git/token`,{method:"PUT",body:JSON.stringify({token:T})});u(t.status),k(""),L(!1)},s("git.tokenSaved")),he=()=>d("remove-token",async()=>{const t=await l(`/api/projects/${o.id}/git/token`,{method:"DELETE"});u(t.status),k("")},s("git.tokenRemoved")),ge=()=>d("repository",async()=>{const t=await l(`/api/projects/${o.id}/git/repository`,{method:"POST",body:JSON.stringify({name:F,private:_})});u(t.status),A(!1)},s("git.repositoryCreated")),ue=()=>d("commit",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const t=await l(`/api/projects/${o.id}/git/commit`,{method:"POST",body:JSON.stringify({message:D})});u(t.status),Z(""),M(null),await z()},s("git.committed")),me=()=>d("push",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const t=await l(`/api/projects/${o.id}/git/push`,{method:"POST"});u(t.status),await z()},s("git.pushed"),s("git.pushFailed")),I=t=>d("diff",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));const c=t?`?revision=${encodeURIComponent(t)}`:"";M(await l(`/api/projects/${o.id}/git/diff${c}`))}),fe=async()=>{if(g){document.fullscreenElement&&await document.exitFullscreen().catch(()=>{}),f(!1);return}const t=O.current;if(t?.requestFullscreen)try{await t.requestFullscreen()}catch{}f(!0)},xe=()=>{const t=m;t&&(j(null),d("checkout",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));await l(`/api/projects/${o.id}/git/checkout`,{method:"POST",body:JSON.stringify({revision:t==="branch"?null:t.sha,force:U})}),window.location.reload()}))},pe=()=>{v(!1),d("discard",async()=>{if(!await r())throw new Error(s("errors.collaborationUnavailable"));await l(`/api/projects/${o.id}/git/discard`,{method:"POST"}),window.location.reload()})},je=a==="load"&&!i;return e.jsxs(e.Fragment,{children:[e.jsx(H,{open:h,extraWide:!0,className:g?"git-dialog-modal-fullscreen":void 0,title:s("git.title"),description:s("git.description"),onOpenChange:b,footer:e.jsx("button",{onClick:()=>b(!1),children:s("common.close")}),children:e.jsxs("div",{className:"git-dialog",children:[je&&e.jsxs("div",{className:"git-loading",children:[e.jsx(x,{className:"spin",size:22}),s("common.loading")]}),Q&&e.jsx("p",{className:"git-message error",children:Q}),X&&e.jsxs("p",{className:"git-message success",children:[e.jsx(q,{size:14}),X]}),i&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":$,onClick:()=>L(t=>!t),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(ye,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.authentication")}),e.jsx("small",{children:i.tokenConfigured?s("git.connectedAs",{login:i.githubLogin}):s("git.authenticationHint")})]})]}),$?e.jsx(ne,{size:16}):e.jsx(ie,{size:16})]}),$&&e.jsxs("div",{className:"git-section-content",children:[e.jsxs("div",{className:"git-token-guidance",children:[e.jsx("strong",{children:s("git.recommendedAccessTitle")}),e.jsx("span",{children:s("git.recommendedAccess")})]}),i.tokenConfigured&&e.jsxs("div",{className:"git-account",children:[e.jsx(W,{size:17}),e.jsx("span",{children:s("git.connectedAs",{login:i.githubLogin})}),e.jsxs("button",{className:"danger-text",disabled:!!a,onClick:he,children:[e.jsx(ke,{size:14}),s("git.removeToken")]})]}),e.jsxs("label",{className:"form-field",children:[i.tokenConfigured?s("git.replaceToken"):s("git.token"),e.jsx("input",{type:"password",autoComplete:"new-password",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",value:T,placeholder:s("git.tokenPlaceholder"),onChange:t=>k(t.target.value)})]}),e.jsxs("div",{className:"git-inline-actions",children:[e.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noreferrer",children:[s("git.createToken"),e.jsx(oe,{size:12})]}),e.jsxs("button",{disabled:!!a||T.trim().length<20,onClick:de,children:[a==="token"&&e.jsx(x,{className:"spin",size:13}),s("git.saveToken")]})]})]})]}),e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":P,onClick:()=>A(t=>!t),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(W,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.repository")}),e.jsx("small",{children:i.remoteUrl?i.repositoryName??i.remoteUrl:i.initialized?s("git.localReady"):s("git.localPending")})]})]}),P?e.jsx(ne,{size:16}):e.jsx(ie,{size:16})]}),P&&e.jsx("div",{className:"git-section-content",children:i.remoteUrl?e.jsxs("div",{className:"git-repository-card",children:[e.jsxs("div",{children:[e.jsx("strong",{children:i.repositoryName??s("git.origin")}),e.jsxs("small",{children:[i.branch??s("git.detachedAt",{revision:i.latestCommit?.shortSha??"HEAD"})," · ",i.dirty?s("git.changedFiles",{count:i.changedFiles}):s("git.clean")]})]}),i.repositoryHtmlUrl&&e.jsxs("a",{href:i.repositoryHtmlUrl,target:"_blank",rel:"noreferrer",children:[e.jsx(oe,{size:14}),s("git.openGitHub")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"form-field",children:[s("git.repositoryName"),e.jsx("input",{value:F,onChange:t=>V(t.target.value)})]}),e.jsxs("label",{className:"checkbox-field",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:t=>ce(t.target.checked)}),s("git.privateRepository")]}),e.jsxs("button",{className:"git-primary-action",disabled:!!a||!i.tokenConfigured||!F.trim(),onClick:ge,children:[a==="repository"?e.jsx(x,{className:"spin",size:14}):e.jsx(W,{size:14}),s("git.createRepository")]})]})})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(ae,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.commitAndPush")}),e.jsx("small",{children:i.branch?s("git.identity",{username:o.ownerUsername}):s("git.detachedHead")})]})]}),e.jsxs("label",{className:"form-field",children:[s("git.commitMessage"),e.jsx("textarea",{rows:3,value:D,placeholder:s("git.commitPlaceholder"),onChange:t=>Z(t.target.value)})]}),e.jsxs("div",{className:"git-action-row",children:[e.jsxs("button",{title:i.dirty?void 0:s("git.noChangesToCommit"),disabled:!!a||!i.branch||!i.dirty||!D.trim(),onClick:ue,children:[a==="commit"?e.jsx(x,{className:"spin",size:14}):e.jsx(ae,{size:14}),s("git.commit")]}),e.jsxs("button",{disabled:!!a||!i.branch||!i.tokenConfigured||!i.remoteUrl||!i.latestCommit,onClick:me,children:[a==="push"?e.jsx(x,{className:"spin",size:14}):e.jsx(Se,{size:14}),s("git.push"),i.ahead>0&&e.jsx("span",{className:"git-count",children:i.ahead})]}),e.jsxs("button",{disabled:!!a||!i.latestCommit,onClick:()=>{I()},children:[a==="diff"?e.jsx(x,{className:"spin",size:14}):e.jsx(G,{size:14}),s("git.workingDiff")]}),e.jsxs("button",{className:"git-discard-button",title:i.restorable?s("git.discardChanges"):s("git.noChangesToDiscard"),disabled:!!a||!i.latestCommit||!i.restorable,onClick:()=>v(!0),children:[e.jsx(ve,{size:14}),s("git.discardChanges")]}),!i.branch&&e.jsxs("button",{disabled:!!a,onClick:()=>{R(!1),j("branch")},children:[e.jsx(q,{size:14}),s("git.returnToBranch",{branch:i.defaultBranch})]}),e.jsxs("button",{disabled:!!a,onClick:()=>{d("refresh",z)},children:[e.jsx(Ee,{className:a==="refresh"?"spin":"",size:14}),s("git.refresh")]})]})]}),y&&e.jsxs("section",{ref:O,className:`git-section git-diff-section${g?" is-fullscreen":""}`,children:[e.jsxs("div",{className:"git-diff-heading",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(G,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.diffTitle")}),e.jsxs("small",{children:[y.title,y.truncated?` · ${s("git.diffTruncated")}`:""]})]})]}),e.jsxs("div",{className:"git-diff-controls",children:[e.jsxs("div",{className:"git-diff-font-controls",role:"group","aria-label":s("git.diffFontSize"),children:[e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w<=8,title:s("git.diffFontDecrease"),"aria-label":s("git.diffFontDecrease"),onClick:()=>Y(t=>Math.max(8,t-1)),children:e.jsx(Ne,{size:14})}),e.jsxs("span",{className:"git-diff-font-value","aria-live":"polite",children:[w,"px"]}),e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w>=24,title:s("git.diffFontIncrease"),"aria-label":s("git.diffFontIncrease"),onClick:()=>Y(t=>Math.min(24,t+1)),children:e.jsx(ze,{size:14})})]}),e.jsx("button",{type:"button",className:"git-diff-fullscreen",title:s(g?"git.exitFullscreenDiff":"git.fullscreenDiff"),"aria-label":s(g?"git.exitFullscreenDiff":"git.fullscreenDiff"),onClick:()=>{fe()},children:g?e.jsx(Ce,{size:15}):e.jsx(we,{size:15})})]})]}),e.jsx(Fe,{content:y.diff,empty:s("git.noChanges"),fontSize:w})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(q,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:s("git.history")}),e.jsx("small",{children:s("git.historyHint")})]})]}),e.jsxs("div",{className:"git-history",children:[J.map(t=>e.jsxs("article",{children:[e.jsx("code",{children:t.shortSha}),e.jsxs("div",{children:[e.jsx("strong",{children:t.message}),e.jsxs("small",{children:[t.authorName," · ",new Date(t.authoredAt).toLocaleString(E.resolvedLanguage)]})]}),e.jsxs("span",{children:[e.jsx("button",{title:s("git.viewCommitDiff"),disabled:!!a,onClick:()=>{I(t.sha)},children:e.jsx(G,{size:14})}),e.jsx("button",{title:s("git.checkoutVersion"),disabled:!!a,onClick:()=>{R(!1),j(t)},children:e.jsx(Te,{size:14})})]})]},t.sha)),J.length===0&&e.jsx("p",{className:"muted",children:s("git.noCommits")})]})]})]})]})}),e.jsx(H,{open:!!m,title:s(m==="branch"?"git.returnTitle":"git.checkoutTitle"),description:m==="branch"?s("git.returnDescription",{branch:i?.defaultBranch??"main"}):s("git.checkoutDescription",{revision:m?.shortSha??"",message:m?.message??""}),onOpenChange:t=>{t||j(null)},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>j(null),children:s("common.cancel")}),e.jsx("button",{className:U?"danger":"primary",onClick:xe,children:s("git.checkout")})]}),children:e.jsxs("label",{className:"git-force-checkout",children:[e.jsx("input",{type:"checkbox",checked:U,onChange:t=>R(t.target.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:s("git.forceCheckout")}),e.jsx("small",{children:s("git.forceCheckoutDescription")})]})]})}),e.jsx(H,{open:le,title:s("git.discardTitle"),description:s("git.discardDescription"),onOpenChange:v,footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>v(!1),children:s("common.cancel")}),e.jsx("button",{className:"danger",onClick:pe,children:s("git.discardConfirm")})]}),children:e.jsx(e.Fragment,{})})]})}function Fe({content:h,empty:o,fontSize:b}){return h.trim()?e.jsx("pre",{className:"git-diff",style:{fontSize:`${b}px`},children:h.split(`
2
- `).map((r,s)=>{const E=r.startsWith("+")&&!r.startsWith("+++")?"addition":r.startsWith("-")&&!r.startsWith("---")?"deletion":r.startsWith("@@")?"hunk":r.startsWith("diff ")?"header":"";return e.jsxs("span",{className:E,children:[r,`
3
- `]},s)})}):e.jsx("div",{className:"git-diff-empty",children:o})}function re(h){return h.trim().replace(/\s+/g,"-").replace(/[^A-Za-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^[.-]+|[.-]+$/g,"").slice(0,100)||"texlite-project"}export{Ge as GitDialog};
@@ -1,7 +0,0 @@
1
- import{u as Se,r as o,j as e}from"./react-BVUjbTTn.js";import{c as Te,f as A,M as Le,b as ee,C as fe}from"./index-C0t11tlT.js";import{d as Fe,C as me}from"./index-BRT5O-Hg.js";import{H as ze,F as De}from"./hard-drive-6uYFyezl.js";import{T as ge,d as Ee}from"./x-Bq29njHL.js";import{F as re,R as pe,S as ke,i as Me}from"./ProjectWorkspace-C6GrvKN6.js";import{G as Pe,M as Ae}from"./minimize-2-BWtbag2I.js";import{M as Be,a as Re}from"./minus-9eVJnugf.js";import{P as Ve}from"./plus-BGXipRoG.js";import"./check-BXvzrdoz.js";import"./search-b1ORp1k8.js";import"./user-plus-CKalKSsw.js";import"./refresh-cw-Dvp3O90f.js";const _e=Te("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);function xe(n,l,j,p="历史版本",s="当前版本",m=3){const L=l.replace(/\r\n/g,`
2
- `),M=j.replace(/\r\n/g,`
3
- `);if(L===M)return{diffText:"",additions:0,deletions:0,hasChanges:!1};const c=new Fe,z=c.diff_linesToChars_(L,M),S=c.diff_main(z.chars1,z.chars2,!1);c.diff_charsToLines_(S,z.lineArray);const N=[];let r=1,D=1,g=0,P=0;for(const[h,y]of S){if(!y)continue;const d=y.split(`
4
- `);d[d.length-1]===""&&d.pop();for(const C of d)h===0?N.push({op:0,text:C,oldNum:r++,newNum:D++}):h===-1?(P++,N.push({op:-1,text:C,oldNum:r++,newNum:D})):h===1&&(g++,N.push({op:1,text:C,oldNum:r,newNum:D++}))}if(g===0&&P===0)return{diffText:"",additions:0,deletions:0,hasChanges:!1};const x=[];let b=-1,u=-1;for(let h=0;h<N.length;h++)if(N[h].op!==0){const y=Math.max(0,h-m),d=Math.min(N.length-1,h+m);b===-1?(b=y,u=d):y<=u+1?u=Math.max(u,d):(x.push({start:b,end:u}),b=y,u=d)}b!==-1&&x.push({start:b,end:u});const V=[`--- a/${n} (${p})`,`+++ b/${n} (${s})`];for(const h of x){const y=N.slice(h.start,h.end+1),d=y.filter($=>$.op<=0).length,C=y.filter($=>$.op>=0).length,_=y[0],J=d===0?0:_.oldNum,B=C===0?0:_.newNum;V.push(`@@ -${J},${d} +${B},${C} @@`);for(const $ of y){const T=$.op===-1?"-":$.op===1?"+":" ";V.push(`${T}${$.text}`)}}return{diffText:V.join(`
5
- `),additions:g,deletions:P,hasChanges:!0}}function oe(n,l){try{const j=new Date(n);if(Number.isNaN(j.getTime()))return n;const p=new Date;return j.getFullYear()===p.getFullYear()&&j.getMonth()===p.getMonth()&&j.getDate()===p.getDate()?j.toLocaleTimeString(l,{hour:"2-digit",minute:"2-digit"}):j.toLocaleString(l,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return n}}function ae(n,l,j){if(n.label)return n.label;const p=oe(n.createdAt,j);if(n.changedPaths.length===1)return`${n.changedPaths[0].split("/").pop()||n.changedPaths[0]} (${p})`;if(n.changedPaths.length===2){const m=n.changedPaths[0].split("/").pop()||n.changedPaths[0],L=n.changedPaths[1].split("/").pop()||n.changedPaths[1];return`${m}, ${L} (${p})`}if(n.changedPaths.length>2)return`${n.changedPaths[0].split("/").pop()||n.changedPaths[0]} +${n.changedPaths.length-1} (${p})`;const s=n.author?.name||n.author?.username;return s?`${s} @ ${p}`:`${l} (${p})`}const ye=100;function et({open:n,project:l,onOpenChange:j,onBeforeMutation:p}){const{t:s,i18n:m}=Se(),[L,M]=o.useState([]),[c,z]=o.useState(null),[S,N]=o.useState(""),[r,D]=o.useState(null),[g,P]=o.useState(""),[x,b]=o.useState(null),[u,V]=o.useState("commit"),[h,y]=o.useState(11),[d,C]=o.useState(!1),[_,J]=o.useState(""),[B,$]=o.useState(null),[T,K]=o.useState(null),[U,w]=o.useState(""),[le,Z]=o.useState(null),[W,Q]=o.useState(!1),[ce,v]=o.useState(""),se=o.useRef(null),F=o.useRef(null),E=o.useRef(null),ie=l.permission!=="read",de=l.permission==="owner",H=!!U||W;o.useEffect(()=>{if(!n){E.current!==null&&window.clearTimeout(E.current),E.current=null,F.current?.abort(),F.current=null,Q(!1),document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),C(!1);return}F.current?.abort(),F.current=null;const t=new AbortController;return w("load"),v(""),b(null),Z(null),Q(!1),A(`/api/projects/${l.id}/history?limit=${ye}`,{signal:t.signal}).then(i=>{M(i.versions),z(i.stats),Z(i.nextCursor),N(a=>i.versions.some(f=>f.id===a)?a:i.versions[0]?.id??"")}).catch(i=>{te(i)||v(R(i))}).finally(()=>{t.signal.aborted||w("")}),()=>t.abort()},[n,l.id]),o.useEffect(()=>()=>{F.current?.abort(),F.current=null,E.current!==null&&window.clearTimeout(E.current)},[l.id]);const je=async()=>{const t=le;if(!t||W||U)return;F.current?.abort();const i=new AbortController;F.current=i,Q(!0),v("");try{const a=new URLSearchParams({limit:String(ye),before:t}),f=await A(`/api/projects/${l.id}/history?${a.toString()}`,{signal:i.signal});if(i.signal.aborted)return;M(O=>{const we=new Set(O.map(ne=>ne.id));return[...O,...f.versions.filter(ne=>!we.has(ne.id))]}),z(f.stats),Z(f.nextCursor)}catch(a){te(a)||v(R(a))}finally{F.current===i&&(F.current=null,Q(!1))}};o.useEffect(()=>{const t=()=>C(document.fullscreenElement===se.current);return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]),o.useEffect(()=>{if(!d)return;const t=i=>{i.key==="Escape"&&!document.fullscreenElement&&C(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[d]),o.useEffect(()=>{if(!n||!S){D(null);return}const t=new AbortController;return w("detail"),b(null),A(`/api/projects/${l.id}/history/${S}`,{signal:t.signal}).then(i=>{D(i),J(i.version.label??"");const a=i.version.changedPaths.find(f=>i.files.some(O=>O.path===f))??"";P(a)}).catch(i=>{te(i)||v(R(i))}).finally(()=>{t.signal.aborted||w("")}),()=>t.abort()},[n,l.id,S]);const I=x?.previousVersion??null;o.useEffect(()=>{if(!n||!S||!g){b(null);return}const t=new AbortController;w("compare"),v("");const i=u==="commit"?"&against=__previous__":"";return A(`/api/projects/${l.id}/history/${S}/file?path=${encodeURIComponent(g)}${i}`,{signal:t.signal}).then(a=>{b(a)}).catch(a=>{te(a)||v(R(a))}).finally(()=>{t.signal.aborted||w(a=>a==="compare"?"":a)}),()=>t.abort()},[n,l.id,S,g,u]);const k=o.useMemo(()=>{if(!r)return[];const t=new Set(r.version.changedPaths);return r.files.filter(i=>t.has(i.path))},[r]);o.useEffect(()=>{k.length>0&&!k.some(t=>t.path===g)?P(k[0].path):k.length===0&&g&&P("")},[k,g]);const be=async()=>{if(d){document.fullscreenElement&&await document.exitFullscreen().catch(()=>{}),C(!1);return}const t=se.current;if(t?.requestFullscreen)try{await t.requestFullscreen()}catch{}C(!0)},ve=async()=>{if(r){w("label"),v("");try{const t=await A(`/api/projects/${l.id}/history/${r.version.id}`,{method:"PATCH",body:JSON.stringify({label:_.trim()||null})});D(i=>i&&{...i,version:t.version}),M(i=>i.map(a=>a.id===t.version.id?t.version:a)),z(t.stats),t.retentionScheduled&&(E.current!==null&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{E.current=null,A(`/api/projects/${l.id}/history?limit=1`).then(i=>{z(i.stats)}).catch(()=>{})},t.retentionRefreshAfterMs))}catch(t){v(R(t))}finally{w("")}}},Ne=async()=>{const t=T;if(t){K(null),w("delete"),v("");try{if(!await p())throw new Error(s("errors.collaborationUnavailable"));const i=t==="all"?`/api/projects/${l.id}/history`:`/api/projects/${l.id}/history/${t.id}`,a=await A(i,{method:"DELETE"});if(z(a.stats),t==="all")M([]),N(""),D(null),b(null),Z(null);else{const f=L.filter(O=>O.id!==t.id);M(f),S===t.id&&(N(f[0]?.id??""),D(null),b(null))}}catch(i){v(R(i))}finally{w("")}}},Ce=async()=>{const t=B;if(!(!t||!r)){$(null),w("restore"),v("");try{if(!await p())throw new Error(s("errors.collaborationUnavailable"));await A(`/api/projects/${l.id}/history/${r.version.id}/restore`,{method:"POST",body:JSON.stringify(t==="project"?{}:{path:t})}),window.location.reload()}catch(i){v(R(i)),w("")}}},X=r?.version.author?.name||r?.version.author?.username||(r?.version.reason==="autosave"?s("history.reasons.autosave"):s("editor.deletedUser")),q=r?oe(r.version.createdAt,m.resolvedLanguage):"",G=o.useMemo(()=>{if(!x||!r)return{diffText:"",additions:0,deletions:0,hasChanges:!1};if(u==="commit"){const t=x.comparison,i=x.historical,a=I?`${I.label||s(`history.reasons.${I.reason}`)} (${oe(I.createdAt,m.resolvedLanguage)})`:"/dev/null",f=`${X} @ ${q}`;return xe(x.path,t,i,a,f)}else{const t=x.historical,i=x.comparison,a=`${r.version.label||s(`history.reasons.${r.version.reason}`)} (${q})`,f=s("history.currentVersion");return xe(x.path,t,i,a,f)}},[x,r,u,I,X,q,s,m.resolvedLanguage]),he=r?s(`history.reasons.${r.version.reason}`):"",ue=r?ae(r.version,he,m.resolvedLanguage):"",$e=T&&T!=="all"?ae(T,s(`history.reasons.${T.reason}`),m.resolvedLanguage):"";return e.jsxs(e.Fragment,{children:[e.jsx(Le,{open:n,extraWide:!0,draggable:!0,className:"history-dialog-modal",title:s("history.projectSnapshots"),description:s("history.description"),onOpenChange:j,footer:e.jsx("button",{onClick:()=>j(!1),children:s("common.close")}),children:e.jsxs("div",{className:"history-dialog",children:[ce&&e.jsx("p",{className:"error history-message",children:ce}),U==="load"&&L.length===0?e.jsxs("div",{className:"history-loading",children:[e.jsx(ee,{className:"spin",size:22}),s("common.loading")]}):e.jsxs("div",{className:"history-dialog-layout",children:[e.jsxs("aside",{className:"history-timeline",children:[de&&c&&e.jsxs("div",{className:`history-stats${c.storageLimitExceeded?" exceeded":""}`,children:[e.jsxs("header",{children:[e.jsxs("span",{children:[e.jsx(ze,{size:14}),s("history.storage")]}),e.jsx("button",{type:"button",disabled:H||L.length===0,title:s("history.clearAll"),"aria-label":s("history.clearAll"),onClick:()=>K("all"),children:e.jsx(ge,{size:13})})]}),e.jsx("strong",{children:s("history.storageUsage",{used:Y(c.totalBytes),limit:Y(c.maxStorageBytes)})}),e.jsx("progress",{max:c.maxStorageBytes,value:Math.min(c.totalBytes,c.maxStorageBytes)}),e.jsx("small",{children:s("history.storageBreakdown",{objects:Y(c.objectBytes),metadata:Y(c.metadataBytes),protected:Y(c.protectedBytes)})}),e.jsxs("small",{children:[s("history.versionUsage",{count:c.ordinaryVersionCount,limit:c.maxVersions>0?c.maxVersions:"∞"}),c.labeledVersionCount>0?` · ${s("history.protectedVersions",{count:c.labeledVersionCount})}`:""]}),c.storageLimitExceeded&&e.jsx("small",{className:"history-storage-warning",children:s("history.storageExceeded")})]}),L.map(t=>{const i=s(`history.reasons.${t.reason}`),a=ae(t,i,m.resolvedLanguage),f=t.author?.name||t.author?.username||(t.reason==="autosave"?s("history.reasons.autosave"):s("editor.deletedUser"));return e.jsxs("button",{className:t.id===S?"active":"",onClick:()=>N(t.id),children:[e.jsx(re,{size:15}),e.jsxs("span",{children:[e.jsxs("div",{className:"history-item-heading",children:[e.jsx("strong",{title:a,children:a}),e.jsx("span",{className:`history-reason-badge reason-${t.reason}`,children:i})]}),e.jsx("small",{children:new Date(t.createdAt).toLocaleString(m.resolvedLanguage)}),e.jsxs("small",{children:[f," · ",s("history.changedCount",{count:t.changedPaths.length})]})]})]},t.id)}),le&&e.jsx("div",{className:"history-load-more",children:e.jsxs("button",{type:"button",disabled:H,"aria-busy":W,onClick:()=>{je()},children:[W?e.jsx(ee,{className:"spin",size:13}):e.jsx(me,{size:13}),s(W?"common.loading":"history.loadOlder")]})}),L.length===0&&e.jsx("p",{className:"muted padded",children:s("history.empty")})]}),e.jsx("section",{className:"history-detail",children:r&&e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"history-detail-header",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"history-detail-title-row",children:[e.jsx("strong",{title:ue,children:ue}),e.jsx("span",{className:`history-reason-badge reason-${r.version.reason}`,children:he})]}),e.jsxs("small",{children:[e.jsx(me,{size:12}),new Date(r.version.createdAt).toLocaleString(m.resolvedLanguage)," · ",X," · ",s("history.fileCount",{count:r.version.fileCount})]})]}),e.jsxs("span",{className:"history-detail-actions",children:[de&&e.jsxs("button",{className:"danger-text",disabled:H,onClick:()=>K(r.version),children:[e.jsx(ge,{size:14}),s("history.deleteVersion")]}),ie&&e.jsxs("button",{className:"danger-text",disabled:H,onClick:()=>$("project"),children:[e.jsx(pe,{size:14}),s("history.restoreProject")]})]})]}),ie&&e.jsxs("div",{className:"history-label",children:[e.jsxs("label",{children:[e.jsx(_e,{size:14}),e.jsx("input",{value:_,maxLength:80,placeholder:s("history.labelPlaceholder"),onChange:t=>J(t.target.value)})]}),e.jsxs("button",{disabled:H||_.trim()===(r.version.label??""),onClick:()=>{ve()},children:[U==="label"?e.jsx(ee,{className:"spin",size:13}):e.jsx(ke,{size:13}),s("history.saveLabel")]})]}),e.jsxs("div",{className:"history-files",children:[e.jsxs("div",{className:"history-files-toolbar",children:[e.jsxs("div",{className:"history-files-heading",children:[e.jsx(De,{size:13}),e.jsx("span",{children:s("history.changedFilesHeading",{count:k.length})})]}),e.jsx("div",{className:"history-file-actions",children:ie&&e.jsxs("button",{disabled:!g||H,onClick:()=>$(g),children:[e.jsx(pe,{size:13}),s("history.restoreFile")]})})]}),k.length>0?e.jsx("div",{className:"history-file-list",children:k.map(t=>e.jsxs("button",{type:"button",className:t.path===g?"active":"",title:t.path,onClick:()=>P(t.path),children:[e.jsx(Ee,{size:13}),e.jsx("span",{children:t.path})]},t.path))}):e.jsx("p",{className:"muted padded-small",children:s("history.noChangedFiles")})]}),e.jsx("div",{ref:se,className:`history-comparison${d?" is-fullscreen":""}`,children:g?e.jsxs(e.Fragment,{children:[e.jsxs("header",{children:[e.jsxs("div",{className:"history-comparison-meta",children:[e.jsx("strong",{children:g}),e.jsxs("small",{className:"history-commit-summary",children:[u==="commit"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"history-commit-author",children:X}),e.jsx("span",{children:I?s("history.changedAt",{time:q}):s("history.createdAt",{time:q})})]}):e.jsx("span",{children:s("history.comparingCurrent")}),G.hasChanges&&e.jsxs("span",{className:"history-diff-stats",children:[e.jsxs("span",{className:"addition",children:["+",G.additions]})," ",e.jsxs("span",{className:"deletion",children:["-",G.deletions]})]})]})]}),e.jsxs("div",{className:"history-diff-controls",children:[e.jsxs("div",{className:"history-mode-toggle",role:"group","aria-label":s("history.diffMode"),children:[e.jsxs("button",{type:"button",className:u==="commit"?"active":"",onClick:()=>V("commit"),title:s("history.diffModeCommitHint"),children:[e.jsx(Pe,{size:13}),e.jsx("span",{children:s("history.diffModeCommit")})]}),e.jsxs("button",{type:"button",className:u==="current"?"active":"",onClick:()=>V("current"),title:s("history.diffModeCurrentHint"),children:[e.jsx(re,{size:13}),e.jsx("span",{children:s("history.diffModeCurrent")})]})]}),e.jsxs("div",{className:"git-diff-font-controls",role:"group","aria-label":s("git.diffFontSize"),children:[e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:h<=8,title:s("git.diffFontDecrease"),"aria-label":s("git.diffFontDecrease"),onClick:()=>y(t=>Math.max(8,t-1)),children:e.jsx(Be,{size:14})}),e.jsxs("span",{className:"git-diff-font-value","aria-live":"polite",children:[h,"px"]}),e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:h>=24,title:s("git.diffFontIncrease"),"aria-label":s("git.diffFontIncrease"),onClick:()=>y(t=>Math.min(24,t+1)),children:e.jsx(Ve,{size:14})})]}),e.jsx("button",{type:"button",className:"git-diff-fullscreen",title:s(d?"git.exitFullscreenDiff":"git.fullscreenDiff"),"aria-label":s(d?"git.exitFullscreenDiff":"git.fullscreenDiff"),onClick:()=>{be()},children:d?e.jsx(Ae,{size:15}):e.jsx(Re,{size:15})})]})]}),U==="compare"&&!x?e.jsxs("div",{className:"history-comparison-empty",children:[e.jsx(ee,{className:"spin",size:24}),e.jsx("span",{children:s("common.loading")})]}):G.hasChanges?e.jsx("pre",{className:"git-diff history-git-diff",style:{fontSize:`${h}px`},children:G.diffText.split(`
6
- `).map((t,i)=>{const a=t.startsWith("+")&&!t.startsWith("+++")?"addition":t.startsWith("-")&&!t.startsWith("---")?"deletion":t.startsWith("@@")?"hunk":t.startsWith("diff ")||t.startsWith("---")||t.startsWith("+++")?"header":"";return e.jsxs("span",{className:a,children:[t,`
7
- `]},i)})}):e.jsxs("div",{className:"git-diff-empty history-diff-empty",children:[e.jsx(Me,{size:24}),e.jsx("span",{children:s(u==="commit"?"history.noDifferencesInCommit":"history.noDifferences")})]})]}):e.jsxs("div",{className:"history-comparison-empty",children:[e.jsx(re,{size:25}),e.jsx("span",{children:k.length===0?s("history.noChangedFiles"):s("history.chooseFile")})]})})]})})]})]})}),e.jsx(fe,{open:!!B,title:s(B==="project"?"history.restoreProjectTitle":"history.restoreFileTitle"),description:B==="project"?s("history.restoreProjectDescription"):s("history.restoreFileDescription",{path:B??""}),confirmLabel:s("history.restore"),danger:!0,onCancel:()=>$(null),onConfirm:()=>{Ce()}}),e.jsx(fe,{open:!!T,title:s(T==="all"?"history.clearAllTitle":"history.deleteVersionTitle"),description:T==="all"?s("history.clearAllDescription"):s("history.deleteVersionDescription",{name:$e}),confirmLabel:s(T==="all"?"history.clearAll":"history.deleteVersion"),danger:!0,onCancel:()=>K(null),onConfirm:()=>{Ne()}})]})}function Y(n){return n<1024?`${n} B`:n<1024*1024?`${Math.round(n/102.4)/10} KB`:n<1024*1024*1024?`${Math.round(n/(1024*1024)*10)/10} MB`:`${Math.round(n/(1024*1024*1024)*10)/10} GB`}function R(n){return n instanceof Error?n.message:String(n)}function te(n){return n instanceof Error&&n.name==="AbortError"}export{et as HistoryDialog};