@bigduu/lotus-next 2026.10.17 → 2026.10.19

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 (35) hide show
  1. package/dist/asset-manifest.json +87 -55
  2. package/dist/assets/ErrorBoundary-uHpN4tTM.js +1 -0
  3. package/dist/assets/{ErrorBoundary-B5SQ9s2i.js → ErrorBoundary-xR7lJUW-.js} +1 -1
  4. package/dist/assets/{FileOperationsService-9hxn70fz.js → FileOperationsService-DcXQUL0H.js} +1 -1
  5. package/dist/assets/{JianduProjectMemories-BvUGqQKU.js → JianduProjectMemories-BrpNAEL7.js} +1 -1
  6. package/dist/assets/{RightWorkbench-B2lD0G-Q.js → RightWorkbench-DTEXCiiG.js} +1 -1
  7. package/dist/assets/{RightWorkbenchSurface-Bahf1nWd.js → RightWorkbenchSurface-C-zn_zvs.js} +1 -1
  8. package/dist/assets/Root-0-vGCfZ0.js +111 -0
  9. package/dist/assets/Settings-C_Pt4naT.js +9 -0
  10. package/dist/assets/{StreamdownMarkdown-DiH1qbHY.js → StreamdownMarkdown-UzYDuayu.js} +2 -2
  11. package/dist/assets/{StreamdownMermaid-BdgN_pW8.js → StreamdownMermaid-kBRofYfo.js} +1 -1
  12. package/dist/assets/TicketWorkPanel-D4ac0MGH.js +1 -0
  13. package/dist/assets/api-BUilODRu.js +1 -0
  14. package/dist/assets/en-US-B3dNCJpd.js +5 -0
  15. package/dist/assets/{index-DuxPcGF7.js → index-8rvcM8IW.js} +2 -2
  16. package/dist/assets/index-zQQhcRyU.css +2 -0
  17. package/dist/assets/jianduMemoryApi-BX4FRsDF.js +1 -0
  18. package/dist/assets/popover-BPup3_4n.js +74 -0
  19. package/dist/assets/{renderPdf-BXHL1sKa.js → renderPdf-E1_q8ToT.js} +1 -1
  20. package/dist/assets/select-ETv3WtsZ.js +12 -0
  21. package/dist/assets/ticketWorkLabels-CWImzvO5.js +1 -0
  22. package/dist/assets/{ui-CU7rSUrT.js → ui-CwXUF4vO.js} +1 -1
  23. package/dist/assets/{zh-CN-B4TrQyWP.js → zh-CN-BAUEMJz3.js} +1 -1
  24. package/dist/bundle-ownership.json +57 -30
  25. package/dist/index.html +2 -2
  26. package/dist/lotus-next-manifest.json +76 -61
  27. package/package.json +1 -1
  28. package/dist/assets/ErrorBoundary-BOPc_jMB.js +0 -1
  29. package/dist/assets/Root-CczVGPAW.js +0 -111
  30. package/dist/assets/Settings-BJNn3Y-h.js +0 -9
  31. package/dist/assets/en-US-C7hz4eId.js +0 -5
  32. package/dist/assets/index-VyKfi_EE.css +0 -2
  33. package/dist/assets/jianduMemoryApi-w4HCsBoN.js +0 -1
  34. package/dist/assets/popover-Cj_UDEOw.js +0 -74
  35. package/dist/assets/select-OsknUBRJ.js +0 -12
@@ -1,23 +1,23 @@
1
1
  {
2
- "_ErrorBoundary-B5SQ9s2i.js": {
3
- "file": "assets/ErrorBoundary-B5SQ9s2i.js",
2
+ "_ErrorBoundary-xR7lJUW-.js": {
3
+ "file": "assets/ErrorBoundary-xR7lJUW-.js",
4
4
  "name": "ErrorBoundary",
5
5
  "imports": [
6
6
  "_rolldown-runtime-QTnfLwEv.js",
7
7
  "_vendor-react-CCIEwYL0.js",
8
- "_ui-CU7rSUrT.js",
8
+ "_ui-CwXUF4vO.js",
9
9
  "_button-2PNVsNX1.js"
10
10
  ]
11
11
  },
12
- "_FileOperationsService-9hxn70fz.js": {
13
- "file": "assets/FileOperationsService-9hxn70fz.js",
12
+ "_FileOperationsService-DcXQUL0H.js": {
13
+ "file": "assets/FileOperationsService-DcXQUL0H.js",
14
14
  "name": "FileOperationsService",
15
15
  "imports": [
16
16
  "_rolldown-runtime-QTnfLwEv.js",
17
17
  "_vendor-react-CCIEwYL0.js",
18
18
  "_runtimeConfig-DNyol2mX.js",
19
19
  "_preload-helper-DYl5dUZ5.js",
20
- "_ui-CU7rSUrT.js",
20
+ "_ui-CwXUF4vO.js",
21
21
  "_button-2PNVsNX1.js",
22
22
  "_dropdown-menu-D7JzP-UT.js",
23
23
  "_dist-B6M1bB1x.js",
@@ -31,19 +31,26 @@
31
31
  "node_modules/@tauri-apps/plugin-fs/dist-js/index.js"
32
32
  ]
33
33
  },
34
- "_RightWorkbenchSurface-Bahf1nWd.js": {
35
- "file": "assets/RightWorkbenchSurface-Bahf1nWd.js",
34
+ "_RightWorkbenchSurface-C-zn_zvs.js": {
35
+ "file": "assets/RightWorkbenchSurface-C-zn_zvs.js",
36
36
  "name": "RightWorkbenchSurface",
37
37
  "imports": [
38
38
  "_rolldown-runtime-QTnfLwEv.js",
39
39
  "_vendor-react-CCIEwYL0.js",
40
- "_ui-CU7rSUrT.js",
40
+ "_ui-CwXUF4vO.js",
41
41
  "_button-2PNVsNX1.js",
42
42
  "_dist-B6M1bB1x.js",
43
43
  "_utils-DqNhCx4L.js",
44
44
  "_dist-BVFhuS8A.js"
45
45
  ]
46
46
  },
47
+ "_api-BUilODRu.js": {
48
+ "file": "assets/api-BUilODRu.js",
49
+ "name": "api",
50
+ "imports": [
51
+ "_runtimeConfig-DNyol2mX.js"
52
+ ]
53
+ },
47
54
  "_bundle-mjs-B_AA55HL.js": {
48
55
  "file": "assets/bundle-mjs-B_AA55HL.js",
49
56
  "name": "bundle-mjs"
@@ -133,14 +140,14 @@
133
140
  "_rolldown-runtime-QTnfLwEv.js"
134
141
  ]
135
142
  },
136
- "_jianduMemoryApi-w4HCsBoN.js": {
137
- "file": "assets/jianduMemoryApi-w4HCsBoN.js",
143
+ "_jianduMemoryApi-BX4FRsDF.js": {
144
+ "file": "assets/jianduMemoryApi-BX4FRsDF.js",
138
145
  "name": "jianduMemoryApi",
139
146
  "imports": [
140
147
  "_rolldown-runtime-QTnfLwEv.js",
141
148
  "_vendor-react-CCIEwYL0.js",
142
- "_select-OsknUBRJ.js",
143
149
  "_dist-B6M1bB1x.js",
150
+ "_api-BUilODRu.js",
144
151
  "_utils-DqNhCx4L.js"
145
152
  ]
146
153
  },
@@ -159,16 +166,16 @@
159
166
  "_button-2PNVsNX1.js"
160
167
  ]
161
168
  },
162
- "_popover-Cj_UDEOw.js": {
163
- "file": "assets/popover-Cj_UDEOw.js",
169
+ "_popover-BPup3_4n.js": {
170
+ "file": "assets/popover-BPup3_4n.js",
164
171
  "name": "popover",
165
172
  "imports": [
166
173
  "_rolldown-runtime-QTnfLwEv.js",
167
174
  "_vendor-react-CCIEwYL0.js",
168
- "_ui-CU7rSUrT.js",
175
+ "_ui-CwXUF4vO.js",
169
176
  "_button-2PNVsNX1.js",
170
- "_select-OsknUBRJ.js",
171
177
  "_dist-B6M1bB1x.js",
178
+ "_api-BUilODRu.js",
172
179
  "_utils-DqNhCx4L.js"
173
180
  ]
174
181
  },
@@ -192,18 +199,19 @@
192
199
  "file": "assets/runtimeConfig-DNyol2mX.js",
193
200
  "name": "runtimeConfig"
194
201
  },
195
- "_select-OsknUBRJ.js": {
196
- "file": "assets/select-OsknUBRJ.js",
202
+ "_select-ETv3WtsZ.js": {
203
+ "file": "assets/select-ETv3WtsZ.js",
197
204
  "name": "select",
198
205
  "imports": [
199
206
  "_rolldown-runtime-QTnfLwEv.js",
200
207
  "_vendor-react-CCIEwYL0.js",
201
208
  "_runtimeConfig-DNyol2mX.js",
202
- "_ui-CU7rSUrT.js",
209
+ "_ui-CwXUF4vO.js",
203
210
  "_button-2PNVsNX1.js",
204
211
  "_dist-B6M1bB1x.js",
205
212
  "_dist-Cyb9tXqw.js",
206
213
  "_react-BqtYw2Yd.js",
214
+ "_api-BUilODRu.js",
207
215
  "_utils-DqNhCx4L.js",
208
216
  "_dist-BVFhuS8A.js"
209
217
  ]
@@ -233,12 +241,20 @@
233
241
  "_react-BqtYw2Yd.js"
234
242
  ]
235
243
  },
244
+ "_ticketWorkLabels-CWImzvO5.js": {
245
+ "file": "assets/ticketWorkLabels-CWImzvO5.js",
246
+ "name": "ticketWorkLabels",
247
+ "imports": [
248
+ "_ui-CwXUF4vO.js",
249
+ "_api-BUilODRu.js"
250
+ ]
251
+ },
236
252
  "_typeof-B5XbjTb1.js": {
237
253
  "file": "assets/typeof-B5XbjTb1.js",
238
254
  "name": "typeof"
239
255
  },
240
- "_ui-CU7rSUrT.js": {
241
- "file": "assets/ui-CU7rSUrT.js",
256
+ "_ui-CwXUF4vO.js": {
257
+ "file": "assets/ui-CwXUF4vO.js",
242
258
  "name": "ui",
243
259
  "imports": [
244
260
  "_rolldown-runtime-QTnfLwEv.js",
@@ -337,7 +353,7 @@
337
353
  ]
338
354
  },
339
355
  "index.html": {
340
- "file": "assets/index-DuxPcGF7.js",
356
+ "file": "assets/index-8rvcM8IW.js",
341
357
  "name": "index",
342
358
  "src": "index.html",
343
359
  "isEntry": true,
@@ -349,10 +365,10 @@
349
365
  ],
350
366
  "dynamicImports": [
351
367
  "src/Root.tsx",
352
- "_ErrorBoundary-B5SQ9s2i.js"
368
+ "_ErrorBoundary-xR7lJUW-.js"
353
369
  ],
354
370
  "css": [
355
- "assets/index-VyKfi_EE.css"
371
+ "assets/index-zQQhcRyU.css"
356
372
  ]
357
373
  },
358
374
  "node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/architecture-TIHT7OUA.mjs": {
@@ -6333,7 +6349,7 @@
6333
6349
  ]
6334
6350
  },
6335
6351
  "src/Root.tsx": {
6336
- "file": "assets/Root-CczVGPAW.js",
6352
+ "file": "assets/Root-0-vGCfZ0.js",
6337
6353
  "name": "Root",
6338
6354
  "src": "src/Root.tsx",
6339
6355
  "isDynamicEntry": true,
@@ -6342,28 +6358,31 @@
6342
6358
  "_vendor-react-CCIEwYL0.js",
6343
6359
  "_runtimeConfig-DNyol2mX.js",
6344
6360
  "_preload-helper-DYl5dUZ5.js",
6345
- "_ui-CU7rSUrT.js",
6346
- "_popover-Cj_UDEOw.js",
6361
+ "_ui-CwXUF4vO.js",
6362
+ "_popover-BPup3_4n.js",
6347
6363
  "_button-2PNVsNX1.js",
6348
6364
  "_dropdown-menu-D7JzP-UT.js",
6349
- "_RightWorkbenchSurface-Bahf1nWd.js",
6350
- "_ErrorBoundary-B5SQ9s2i.js",
6351
- "_select-OsknUBRJ.js",
6365
+ "_RightWorkbenchSurface-C-zn_zvs.js",
6366
+ "_ErrorBoundary-xR7lJUW-.js",
6367
+ "_select-ETv3WtsZ.js",
6352
6368
  "_dist-B6M1bB1x.js",
6353
6369
  "_dist-gqDddrkT.js",
6354
6370
  "_external-link-Cw8nqDQM.js",
6355
6371
  "_plus-BVSBwjyF.js",
6356
6372
  "_dist-Cyb9tXqw.js",
6357
6373
  "_react-BqtYw2Yd.js",
6374
+ "_api-BUilODRu.js",
6358
6375
  "_utils-DqNhCx4L.js",
6359
- "_FileOperationsService-9hxn70fz.js",
6360
- "_themeStore-B8QBR2Ak.js"
6376
+ "_FileOperationsService-DcXQUL0H.js",
6377
+ "_themeStore-B8QBR2Ak.js",
6378
+ "_ticketWorkLabels-CWImzvO5.js"
6361
6379
  ],
6362
6380
  "dynamicImports": [
6363
6381
  "src/components/chat/Settings.tsx",
6364
6382
  "src/lib/export/renderPdf.tsx",
6365
6383
  "src/components/chat/StreamdownMarkdown.tsx",
6366
6384
  "src/components/chat/Markdown.tsx",
6385
+ "src/components/chat/TicketWorkPanel.tsx",
6367
6386
  "src/components/app/RightWorkbench.tsx"
6368
6387
  ],
6369
6388
  "css": [
@@ -6371,26 +6390,26 @@
6371
6390
  ]
6372
6391
  },
6373
6392
  "src/components/app/ErrorBoundary.tsx": {
6374
- "file": "assets/ErrorBoundary-BOPc_jMB.js",
6393
+ "file": "assets/ErrorBoundary-uHpN4tTM.js",
6375
6394
  "name": "ErrorBoundary",
6376
6395
  "src": "src/components/app/ErrorBoundary.tsx",
6377
6396
  "isDynamicEntry": true,
6378
6397
  "imports": [
6379
- "_ErrorBoundary-B5SQ9s2i.js"
6398
+ "_ErrorBoundary-xR7lJUW-.js"
6380
6399
  ]
6381
6400
  },
6382
6401
  "src/components/app/RightWorkbench.tsx": {
6383
- "file": "assets/RightWorkbench-B2lD0G-Q.js",
6402
+ "file": "assets/RightWorkbench-DTEXCiiG.js",
6384
6403
  "name": "RightWorkbench",
6385
6404
  "src": "src/components/app/RightWorkbench.tsx",
6386
6405
  "isDynamicEntry": true,
6387
6406
  "imports": [
6388
6407
  "_rolldown-runtime-QTnfLwEv.js",
6389
6408
  "_vendor-react-CCIEwYL0.js",
6390
- "_ui-CU7rSUrT.js",
6409
+ "_ui-CwXUF4vO.js",
6391
6410
  "_button-2PNVsNX1.js",
6392
6411
  "_dropdown-menu-D7JzP-UT.js",
6393
- "_RightWorkbenchSurface-Bahf1nWd.js",
6412
+ "_RightWorkbenchSurface-C-zn_zvs.js",
6394
6413
  "_dist-B6M1bB1x.js",
6395
6414
  "_plus-BVSBwjyF.js",
6396
6415
  "_utils-DqNhCx4L.js",
@@ -6443,7 +6462,7 @@
6443
6462
  ]
6444
6463
  },
6445
6464
  "src/components/chat/Settings.tsx": {
6446
- "file": "assets/Settings-BJNn3Y-h.js",
6465
+ "file": "assets/Settings-C_Pt4naT.js",
6447
6466
  "name": "Settings",
6448
6467
  "src": "src/components/chat/Settings.tsx",
6449
6468
  "isDynamicEntry": true,
@@ -6452,20 +6471,21 @@
6452
6471
  "_vendor-react-CCIEwYL0.js",
6453
6472
  "_runtimeConfig-DNyol2mX.js",
6454
6473
  "_preload-helper-DYl5dUZ5.js",
6455
- "_ui-CU7rSUrT.js",
6456
- "_popover-Cj_UDEOw.js",
6474
+ "_ui-CwXUF4vO.js",
6475
+ "_popover-BPup3_4n.js",
6457
6476
  "_button-2PNVsNX1.js",
6458
- "_select-OsknUBRJ.js",
6477
+ "_select-ETv3WtsZ.js",
6459
6478
  "_dist-B6M1bB1x.js",
6460
6479
  "_dist-gqDddrkT.js",
6461
6480
  "_external-link-Cw8nqDQM.js",
6462
6481
  "_plus-BVSBwjyF.js",
6463
6482
  "_dist-Cyb9tXqw.js",
6464
6483
  "_react-BqtYw2Yd.js",
6484
+ "_api-BUilODRu.js",
6465
6485
  "_utils-DqNhCx4L.js",
6466
6486
  "_themeStore-B8QBR2Ak.js",
6467
6487
  "_tabs-gpMLuUaw.js",
6468
- "_jianduMemoryApi-w4HCsBoN.js"
6488
+ "_jianduMemoryApi-BX4FRsDF.js"
6469
6489
  ],
6470
6490
  "dynamicImports": [
6471
6491
  "src/components/chat/settings/JianduProjectMemories.tsx"
@@ -6475,7 +6495,7 @@
6475
6495
  ]
6476
6496
  },
6477
6497
  "src/components/chat/StreamdownMarkdown.tsx": {
6478
- "file": "assets/StreamdownMarkdown-DiH1qbHY.js",
6498
+ "file": "assets/StreamdownMarkdown-UzYDuayu.js",
6479
6499
  "name": "StreamdownMarkdown",
6480
6500
  "src": "src/components/chat/StreamdownMarkdown.tsx",
6481
6501
  "isDynamicEntry": true,
@@ -6485,9 +6505,9 @@
6485
6505
  "_preload-helper-DYl5dUZ5.js",
6486
6506
  "_vendor-markdown-CfSBref-.js",
6487
6507
  "_vendor-streamdown-Ceq3XY-u.js",
6488
- "_ui-CU7rSUrT.js",
6508
+ "_ui-CwXUF4vO.js",
6489
6509
  "_utils-DqNhCx4L.js",
6490
- "_FileOperationsService-9hxn70fz.js",
6510
+ "_FileOperationsService-DcXQUL0H.js",
6491
6511
  "_markdownTheme-DZ_SWMdl.js"
6492
6512
  ],
6493
6513
  "dynamicImports": [
@@ -6499,7 +6519,7 @@
6499
6519
  ]
6500
6520
  },
6501
6521
  "src/components/chat/StreamdownMermaid.tsx": {
6502
- "file": "assets/StreamdownMermaid-BdgN_pW8.js",
6522
+ "file": "assets/StreamdownMermaid-kBRofYfo.js",
6503
6523
  "name": "StreamdownMermaid",
6504
6524
  "src": "src/components/chat/StreamdownMermaid.tsx",
6505
6525
  "isDynamicEntry": true,
@@ -6507,26 +6527,38 @@
6507
6527
  "_rolldown-runtime-QTnfLwEv.js",
6508
6528
  "_vendor-react-CCIEwYL0.js",
6509
6529
  "_vendor-mermaid-D-p0xABq.js",
6510
- "_ui-CU7rSUrT.js",
6530
+ "_ui-CwXUF4vO.js",
6511
6531
  "_strictConfig-BjTx9qA2.js"
6512
6532
  ]
6513
6533
  },
6534
+ "src/components/chat/TicketWorkPanel.tsx": {
6535
+ "file": "assets/TicketWorkPanel-D4ac0MGH.js",
6536
+ "name": "TicketWorkPanel",
6537
+ "src": "src/components/chat/TicketWorkPanel.tsx",
6538
+ "isDynamicEntry": true,
6539
+ "imports": [
6540
+ "_rolldown-runtime-QTnfLwEv.js",
6541
+ "_vendor-react-CCIEwYL0.js",
6542
+ "_ui-CwXUF4vO.js",
6543
+ "_ticketWorkLabels-CWImzvO5.js"
6544
+ ]
6545
+ },
6514
6546
  "src/components/chat/settings/JianduProjectMemories.tsx": {
6515
- "file": "assets/JianduProjectMemories-BvUGqQKU.js",
6547
+ "file": "assets/JianduProjectMemories-BrpNAEL7.js",
6516
6548
  "name": "JianduProjectMemories",
6517
6549
  "src": "src/components/chat/settings/JianduProjectMemories.tsx",
6518
6550
  "isDynamicEntry": true,
6519
6551
  "imports": [
6520
6552
  "_rolldown-runtime-QTnfLwEv.js",
6521
6553
  "_vendor-react-CCIEwYL0.js",
6522
- "_ui-CU7rSUrT.js",
6554
+ "_ui-CwXUF4vO.js",
6523
6555
  "_button-2PNVsNX1.js",
6524
- "_select-OsknUBRJ.js",
6525
- "_jianduMemoryApi-w4HCsBoN.js"
6556
+ "_select-ETv3WtsZ.js",
6557
+ "_jianduMemoryApi-BX4FRsDF.js"
6526
6558
  ]
6527
6559
  },
6528
6560
  "src/lib/export/renderPdf.tsx": {
6529
- "file": "assets/renderPdf-BXHL1sKa.js",
6561
+ "file": "assets/renderPdf-E1_q8ToT.js",
6530
6562
  "name": "renderPdf",
6531
6563
  "src": "src/lib/export/renderPdf.tsx",
6532
6564
  "isDynamicEntry": true,
@@ -6538,7 +6570,7 @@
6538
6570
  "_vendor-markdown-CfSBref-.js",
6539
6571
  "_typeof-B5XbjTb1.js",
6540
6572
  "_html2canvas-BzlCjWQf.js",
6541
- "_ui-CU7rSUrT.js",
6573
+ "_ui-CwXUF4vO.js",
6542
6574
  "_unsupportedIterableToArray-7m2_meZB.js",
6543
6575
  "_strictConfig-BjTx9qA2.js"
6544
6576
  ],
@@ -6549,13 +6581,13 @@
6549
6581
  ]
6550
6582
  },
6551
6583
  "src/shared/i18n/resources/en-US.ts": {
6552
- "file": "assets/en-US-C7hz4eId.js",
6584
+ "file": "assets/en-US-B3dNCJpd.js",
6553
6585
  "name": "en-US",
6554
6586
  "src": "src/shared/i18n/resources/en-US.ts",
6555
6587
  "isDynamicEntry": true
6556
6588
  },
6557
6589
  "src/shared/i18n/resources/zh-CN.ts": {
6558
- "file": "assets/zh-CN-B4TrQyWP.js",
6590
+ "file": "assets/zh-CN-BAUEMJz3.js",
6559
6591
  "name": "zh-CN",
6560
6592
  "src": "src/shared/i18n/resources/zh-CN.ts",
6561
6593
  "isDynamicEntry": true
@@ -0,0 +1 @@
1
+ import{t as e}from"./ErrorBoundary-xR7lJUW-.js";export{e as ErrorBoundary,e as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./vendor-react-CCIEwYL0.js";import{i as r,r as i}from"./ui-CU7rSUrT.js";import{c as a,t as o}from"./button-2PNVsNX1.js";var s=a(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),c=a(`rotate-ccw`,[[`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`}]]),l=e(t(),1),u=n(),d=class extends l.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){let n=this.props.name??`ErrorBoundary`;console.error(`[${n}] Uncaught error:`,e,t),this.props.onError?.(e,t)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){if(!this.state.hasError)return this.props.children;let{fallback:e}=this.props,t=this.state.error;return typeof e==`function`?e(t,this.handleReset):e===void 0?(0,u.jsx)(f,{error:t,onReset:this.handleReset}):e}};function f({error:e,onReset:t}){r();let[n,a]=(0,l.useState)(!1);return(0,u.jsxs)(`div`,{role:`alert`,className:`flex min-h-[200px] flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,u.jsx)(s,{className:`size-9 text-amber-500`}),(0,u.jsx)(`div`,{className:`text-base font-semibold`,children:i(`something_went_wrong_04c5b397`)}),(0,u.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:i(`this_section_could_not_render_try_again_or_reload_the_p_e644d5da`)}),(0,u.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[(0,u.jsxs)(o,{size:`sm`,onClick:t,children:[(0,u.jsx)(c,{className:`size-4`}),i(`retry_b8784c8d`)]}),(0,u.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>a(e=>!e),"aria-expanded":n,children:i(n?`hide_details_2e1b7da4`:`show_details_448d5d38`)})]}),n&&(0,u.jsxs)(`pre`,{className:`mt-2 max-h-[200px] w-full max-w-xl overflow-auto rounded-md bg-muted p-3 text-left text-xs`,children:[e.message,e.stack?`\n\n${e.stack}`:``]})]})}export{c as n,s as r,d as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./vendor-react-CCIEwYL0.js";import{i as r,r as i}from"./ui-CwXUF4vO.js";import{c as a,t as o}from"./button-2PNVsNX1.js";var s=a(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),c=a(`rotate-ccw`,[[`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`}]]),l=e(t(),1),u=n(),d=class extends l.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){let n=this.props.name??`ErrorBoundary`;console.error(`[${n}] Uncaught error:`,e,t),this.props.onError?.(e,t)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){if(!this.state.hasError)return this.props.children;let{fallback:e}=this.props,t=this.state.error;return typeof e==`function`?e(t,this.handleReset):e===void 0?(0,u.jsx)(f,{error:t,onReset:this.handleReset}):e}};function f({error:e,onReset:t}){r();let[n,a]=(0,l.useState)(!1);return(0,u.jsxs)(`div`,{role:`alert`,className:`flex min-h-[200px] flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,u.jsx)(s,{className:`size-9 text-amber-500`}),(0,u.jsx)(`div`,{className:`text-base font-semibold`,children:i(`something_went_wrong_04c5b397`)}),(0,u.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:i(`this_section_could_not_render_try_again_or_reload_the_p_e644d5da`)}),(0,u.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[(0,u.jsxs)(o,{size:`sm`,onClick:t,children:[(0,u.jsx)(c,{className:`size-4`}),i(`retry_b8784c8d`)]}),(0,u.jsx)(o,{size:`sm`,variant:`ghost`,onClick:()=>a(e=>!e),"aria-expanded":n,children:i(n?`hide_details_2e1b7da4`:`show_details_448d5d38`)})]}),n&&(0,u.jsxs)(`pre`,{className:`mt-2 max-h-[200px] w-full max-w-xl overflow-auto rounded-md bg-muted p-3 text-left text-xs`,children:[e.message,e.stack?`\n\n${e.stack}`:``]})]})}export{c as n,s as r,d as t};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-js-BRD7Ycov.js","./core-w4ZWUd33.js","./core-DGw2K2SP.js","./dist-js-CGF_d654.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./vendor-react-CCIEwYL0.js";import{i as r}from"./runtimeConfig-DNyol2mX.js";import{t as i}from"./preload-helper-DYl5dUZ5.js";import{i as a,r as o}from"./ui-CU7rSUrT.js";import{t as s}from"./button-2PNVsNX1.js";import{d as c,n as l,r as u,t as ee,u as d}from"./dropdown-menu-D7JzP-UT.js";import{M as f,j as p,m}from"./dist-B6M1bB1x.js";import{n as te,t as h}from"./external-link-Cw8nqDQM.js";import{a as g,c as _,i as v,l as y,n as b,o as x,r as S,s as C,t as w}from"./dist-Cyb9tXqw.js";import{t as T}from"./utils-DqNhCx4L.js";var E=e(t(),1),D=n();function O(e){return(0,D.jsx)(w,{"data-slot":`dialog`,...e})}function k(e){return(0,D.jsx)(_,{"data-slot":`dialog-trigger`,...e})}function A(e){return(0,D.jsx)(x,{"data-slot":`dialog-portal`,...e})}function j({className:e,...t}){return(0,D.jsx)(g,{"data-slot":`dialog-overlay`,className:T(`surface-fade fixed inset-0 z-50 bg-black/50`,m,e),...t})}function M({className:e,children:t,showCloseButton:n=!0,...r}){return(0,D.jsxs)(A,{"data-slot":`dialog-portal`,children:[(0,D.jsx)(j,{}),(0,D.jsxs)(S,{"data-slot":`dialog-content`,className:T(`bg-background fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg sm:max-w-lg`,m,e),...r,children:[t,n&&(0,D.jsxs)(b,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,D.jsx)(p,{}),(0,D.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function N({className:e,...t}){return(0,D.jsx)(`div`,{"data-slot":`dialog-header`,className:T(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function P({className:e,...t}){return(0,D.jsx)(`div`,{"data-slot":`dialog-footer`,className:T(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function F({className:e,...t}){return(0,D.jsx)(C,{"data-slot":`dialog-title`,className:T(`text-lg leading-none font-semibold`,e),...t})}function I({className:e,...t}){return(0,D.jsx)(v,{"data-slot":`dialog-description`,className:T(`text-muted-foreground text-sm`,e),...t})}var L=()=>r().host.kind===`bodhi-desktop`,R=()=>window.__TAURI_INTERNALS__?.invoke,z=e=>{if(typeof window>`u`)return;let t=window.open(e,`_blank`,`noopener,noreferrer`);if(t){t.opener=null;return}window.location.assign(e)},B=async e=>{let t=e.trim();if(t){if(L()){let e=R();if(typeof e!=`function`)throw Error(`Desktop shell is unavailable`);await e(`plugin:shell|open`,{path:t});return}z(t)}},V=async e=>{let t=e.trim();if(!t)throw Error(o(`this_project_has_no_primary_directory_configured_1b81c32a`));if(!L())throw Error(o(`open_the_local_directory_in_the_bodhi_desktop_app_74255b08`));let n=R();if(typeof n!=`function`)throw Error(o(`desktop_file_manager_is_temporarily_unavailable_331d04fe`));await n(`plugin:shell|open`,{path:t})},H=(0,E.createContext)(null),U=e=>{try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&!!t.hostname}catch{return!1}};function W({children:e,onOpenInApp:t}){return a(),(0,D.jsx)(H.Provider,{value:t??null,children:e})}function G({url:e,isOpen:t,onClose:n}){a();let r=(0,E.useContext)(H),[i,p]=(0,E.useState)(!1),[m,g]=(0,E.useState)(null),_=async(e,t)=>{if(!i){p(!0),g(null);try{await e(),n()}catch{g(t)}finally{p(!1)}}};return(0,D.jsx)(O,{open:t,onOpenChange:e=>{!e&&!i&&n()},children:(0,D.jsxs)(M,{className:`max-w-md`,"data-streamdown":`link-safety-modal`,children:[(0,D.jsxs)(N,{children:[(0,D.jsxs)(F,{className:`flex items-center gap-2`,children:[(0,D.jsx)(h,{className:`size-5`}),o(`open_external_link_fd407c70`)]}),(0,D.jsx)(I,{children:o(`you_are_about_to_visit_an_external_website_d5fdb530`)})]}),(0,D.jsx)(`div`,{className:`max-h-32 overflow-y-auto break-all rounded-md bg-muted p-3 font-mono text-sm`,children:e}),m?(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:m}):null,(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsxs)(s,{className:`min-w-0 flex-1`,disabled:i,variant:`outline`,onClick:()=>void _(()=>y(e),o(`could_not_copy_link_please_try_again_c54af852`)),children:[(0,D.jsx)(te,{}),o(`copy_link_8e86f9b1`)]}),(0,D.jsxs)(ee,{modal:!1,children:[(0,D.jsx)(d,{asChild:!0,children:(0,D.jsxs)(s,{className:`min-w-0 flex-1`,disabled:i,children:[o(`open_link_a2639495`),` `,(0,D.jsx)(f,{})]})}),(0,D.jsxs)(l,{align:`end`,className:`min-w-48`,style:{zIndex:60},children:[r&&U(e)?(0,D.jsxs)(u,{onSelect:()=>void _(()=>r(e),o(`could_not_open_the_link_in_the_app_please_try_again_769b498f`)),children:[(0,D.jsx)(c,{}),o(`open_in_app_af4b79db`)]}):null,(0,D.jsxs)(u,{onSelect:()=>void _(()=>B(e),o(`could_not_open_the_link_in_your_default_browser_please__14278433`)),children:[(0,D.jsx)(h,{}),o(`open_in_default_browser_a489338a`)]})]})]})]})]})})}var K=()=>i(()=>import(`./dist-js-BRD7Ycov.js`),__vite__mapDeps([0,1]),import.meta.url);async function q(e){if(!L())throw Error(`Local image preview requires Bodhi`);let{invoke:t}=await i(async()=>{let{invoke:e}=await import(`./core-DGw2K2SP.js`);return{invoke:e}},__vite__mapDeps([2,1]),import.meta.url);return t(`read_local_image`,{path:e})}var J=class{async saveFile(e){let{content:t,filters:n,defaultPath:r}=e,{save:a}=await K(),{writeFile:o,writeTextFile:s}=await i(async()=>{let{writeFile:e,writeTextFile:t}=await import(`./dist-js-CGF_d654.js`);return{writeFile:e,writeTextFile:t}},__vite__mapDeps([3,1]),import.meta.url),c=await a({filters:n.map(e=>({name:e.name,extensions:[...e.extensions]})),defaultPath:r});if(!c)throw Error(`User cancelled save operation`);return typeof t==`string`?await s(c,t):await o(c,t),{filename:Q(c,r),success:!0}}async pickDirectory(){let{open:e}=await K(),t=await e({directory:!0,multiple:!1});return typeof t==`string`?t:null}},Y=class{async saveFile(e){let{content:t,filters:n,defaultPath:r}=e,i=Q(r,r);if(typeof window>`u`||typeof document>`u`)throw Error(`File save is unavailable in this environment`);let a=ne(n,t),o=typeof t==`string`?new Blob([t],{type:`${a};charset=utf-8`}):new Blob([t],{type:a}),s=URL.createObjectURL(o);try{let e=document.createElement(`a`);e.href=s,e.download=i,e.style.display=`none`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}finally{URL.revokeObjectURL(s)}return{filename:i,success:!0}}async pickDirectory(){return null}},X=new J,Z=new Y,Q=(e,t)=>e.split(/[/\\]/).pop()||t,ne=(e,t)=>{switch(e[0]?.extensions?.[0]?.toLowerCase()||``){case`md`:return`text/markdown`;case`txt`:return`text/plain`;case`json`:return`application/json`;case`pdf`:return`application/pdf`;case`svg`:return`image/svg+xml`;case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;default:return typeof t==`string`?`text/plain`:`application/octet-stream`}},$=()=>L()?X:Z,re=class{static async pickDirectory(){return $().pickDirectory()}static async saveFile(e){try{return await $().saveFile(e)}catch(e){return{filename:``,success:!1,error:e instanceof Error?e.message:`Unknown error occurred`}}}static async saveTextFile(e,t,n){return this.saveFile({content:e,filters:t,defaultPath:n})}static async saveBinaryFile(e,t,n){return this.saveFile({content:e,filters:t,defaultPath:n})}static FILTERS={MARKDOWN:[{name:`Markdown`,extensions:[`md`]}],PDF:[{name:`PDF`,extensions:[`pdf`]}],SVG:[{name:`SVG`,extensions:[`svg`]}],PNG:[{name:`PNG`,extensions:[`png`]}],TEXT:[{name:`Text`,extensions:[`txt`]}],JSON:[{name:`JSON`,extensions:[`json`]}],ALL:[{name:`All Files`,extensions:[`*`]}]};static generateTimestampedFilename(e,t){return`${e}-${new Date().toISOString().slice(0,19).replace(/:/g,`-`)}.${t}`}};export{V as a,M as c,N as d,F as f,W as i,I as l,q as n,L as o,k as p,G as r,O as s,re as t,P as u};
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./vendor-react-CCIEwYL0.js";import{i as r}from"./runtimeConfig-DNyol2mX.js";import{t as i}from"./preload-helper-DYl5dUZ5.js";import{i as a,r as o}from"./ui-CwXUF4vO.js";import{t as s}from"./button-2PNVsNX1.js";import{d as c,n as l,r as u,t as ee,u as d}from"./dropdown-menu-D7JzP-UT.js";import{M as f,j as p,m}from"./dist-B6M1bB1x.js";import{n as te,t as h}from"./external-link-Cw8nqDQM.js";import{a as g,c as _,i as v,l as y,n as b,o as x,r as S,s as C,t as w}from"./dist-Cyb9tXqw.js";import{t as T}from"./utils-DqNhCx4L.js";var E=e(t(),1),D=n();function O(e){return(0,D.jsx)(w,{"data-slot":`dialog`,...e})}function k(e){return(0,D.jsx)(_,{"data-slot":`dialog-trigger`,...e})}function A(e){return(0,D.jsx)(x,{"data-slot":`dialog-portal`,...e})}function j({className:e,...t}){return(0,D.jsx)(g,{"data-slot":`dialog-overlay`,className:T(`surface-fade fixed inset-0 z-50 bg-black/50`,m,e),...t})}function M({className:e,children:t,showCloseButton:n=!0,...r}){return(0,D.jsxs)(A,{"data-slot":`dialog-portal`,children:[(0,D.jsx)(j,{}),(0,D.jsxs)(S,{"data-slot":`dialog-content`,className:T(`bg-background fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg sm:max-w-lg`,m,e),...r,children:[t,n&&(0,D.jsxs)(b,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,D.jsx)(p,{}),(0,D.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function N({className:e,...t}){return(0,D.jsx)(`div`,{"data-slot":`dialog-header`,className:T(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function P({className:e,...t}){return(0,D.jsx)(`div`,{"data-slot":`dialog-footer`,className:T(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function F({className:e,...t}){return(0,D.jsx)(C,{"data-slot":`dialog-title`,className:T(`text-lg leading-none font-semibold`,e),...t})}function I({className:e,...t}){return(0,D.jsx)(v,{"data-slot":`dialog-description`,className:T(`text-muted-foreground text-sm`,e),...t})}var L=()=>r().host.kind===`bodhi-desktop`,R=()=>window.__TAURI_INTERNALS__?.invoke,z=e=>{if(typeof window>`u`)return;let t=window.open(e,`_blank`,`noopener,noreferrer`);if(t){t.opener=null;return}window.location.assign(e)},B=async e=>{let t=e.trim();if(t){if(L()){let e=R();if(typeof e!=`function`)throw Error(`Desktop shell is unavailable`);await e(`plugin:shell|open`,{path:t});return}z(t)}},V=async e=>{let t=e.trim();if(!t)throw Error(o(`this_project_has_no_primary_directory_configured_1b81c32a`));if(!L())throw Error(o(`open_the_local_directory_in_the_bodhi_desktop_app_74255b08`));let n=R();if(typeof n!=`function`)throw Error(o(`desktop_file_manager_is_temporarily_unavailable_331d04fe`));await n(`plugin:shell|open`,{path:t})},H=(0,E.createContext)(null),U=e=>{try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&!!t.hostname}catch{return!1}};function W({children:e,onOpenInApp:t}){return a(),(0,D.jsx)(H.Provider,{value:t??null,children:e})}function G({url:e,isOpen:t,onClose:n}){a();let r=(0,E.useContext)(H),[i,p]=(0,E.useState)(!1),[m,g]=(0,E.useState)(null),_=async(e,t)=>{if(!i){p(!0),g(null);try{await e(),n()}catch{g(t)}finally{p(!1)}}};return(0,D.jsx)(O,{open:t,onOpenChange:e=>{!e&&!i&&n()},children:(0,D.jsxs)(M,{className:`max-w-md`,"data-streamdown":`link-safety-modal`,children:[(0,D.jsxs)(N,{children:[(0,D.jsxs)(F,{className:`flex items-center gap-2`,children:[(0,D.jsx)(h,{className:`size-5`}),o(`open_external_link_fd407c70`)]}),(0,D.jsx)(I,{children:o(`you_are_about_to_visit_an_external_website_d5fdb530`)})]}),(0,D.jsx)(`div`,{className:`max-h-32 overflow-y-auto break-all rounded-md bg-muted p-3 font-mono text-sm`,children:e}),m?(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:m}):null,(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsxs)(s,{className:`min-w-0 flex-1`,disabled:i,variant:`outline`,onClick:()=>void _(()=>y(e),o(`could_not_copy_link_please_try_again_c54af852`)),children:[(0,D.jsx)(te,{}),o(`copy_link_8e86f9b1`)]}),(0,D.jsxs)(ee,{modal:!1,children:[(0,D.jsx)(d,{asChild:!0,children:(0,D.jsxs)(s,{className:`min-w-0 flex-1`,disabled:i,children:[o(`open_link_a2639495`),` `,(0,D.jsx)(f,{})]})}),(0,D.jsxs)(l,{align:`end`,className:`min-w-48`,style:{zIndex:60},children:[r&&U(e)?(0,D.jsxs)(u,{onSelect:()=>void _(()=>r(e),o(`could_not_open_the_link_in_the_app_please_try_again_769b498f`)),children:[(0,D.jsx)(c,{}),o(`open_in_app_af4b79db`)]}):null,(0,D.jsxs)(u,{onSelect:()=>void _(()=>B(e),o(`could_not_open_the_link_in_your_default_browser_please__14278433`)),children:[(0,D.jsx)(h,{}),o(`open_in_default_browser_a489338a`)]})]})]})]})]})})}var K=()=>i(()=>import(`./dist-js-BRD7Ycov.js`),__vite__mapDeps([0,1]),import.meta.url);async function q(e){if(!L())throw Error(`Local image preview requires Bodhi`);let{invoke:t}=await i(async()=>{let{invoke:e}=await import(`./core-DGw2K2SP.js`);return{invoke:e}},__vite__mapDeps([2,1]),import.meta.url);return t(`read_local_image`,{path:e})}var J=class{async saveFile(e){let{content:t,filters:n,defaultPath:r}=e,{save:a}=await K(),{writeFile:o,writeTextFile:s}=await i(async()=>{let{writeFile:e,writeTextFile:t}=await import(`./dist-js-CGF_d654.js`);return{writeFile:e,writeTextFile:t}},__vite__mapDeps([3,1]),import.meta.url),c=await a({filters:n.map(e=>({name:e.name,extensions:[...e.extensions]})),defaultPath:r});if(!c)throw Error(`User cancelled save operation`);return typeof t==`string`?await s(c,t):await o(c,t),{filename:Q(c,r),success:!0}}async pickDirectory(){let{open:e}=await K(),t=await e({directory:!0,multiple:!1});return typeof t==`string`?t:null}},Y=class{async saveFile(e){let{content:t,filters:n,defaultPath:r}=e,i=Q(r,r);if(typeof window>`u`||typeof document>`u`)throw Error(`File save is unavailable in this environment`);let a=ne(n,t),o=typeof t==`string`?new Blob([t],{type:`${a};charset=utf-8`}):new Blob([t],{type:a}),s=URL.createObjectURL(o);try{let e=document.createElement(`a`);e.href=s,e.download=i,e.style.display=`none`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}finally{URL.revokeObjectURL(s)}return{filename:i,success:!0}}async pickDirectory(){return null}},X=new J,Z=new Y,Q=(e,t)=>e.split(/[/\\]/).pop()||t,ne=(e,t)=>{switch(e[0]?.extensions?.[0]?.toLowerCase()||``){case`md`:return`text/markdown`;case`txt`:return`text/plain`;case`json`:return`application/json`;case`pdf`:return`application/pdf`;case`svg`:return`image/svg+xml`;case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;default:return typeof t==`string`?`text/plain`:`application/octet-stream`}},$=()=>L()?X:Z,re=class{static async pickDirectory(){return $().pickDirectory()}static async saveFile(e){try{return await $().saveFile(e)}catch(e){return{filename:``,success:!1,error:e instanceof Error?e.message:`Unknown error occurred`}}}static async saveTextFile(e,t,n){return this.saveFile({content:e,filters:t,defaultPath:n})}static async saveBinaryFile(e,t,n){return this.saveFile({content:e,filters:t,defaultPath:n})}static FILTERS={MARKDOWN:[{name:`Markdown`,extensions:[`md`]}],PDF:[{name:`PDF`,extensions:[`pdf`]}],SVG:[{name:`SVG`,extensions:[`svg`]}],PNG:[{name:`PNG`,extensions:[`png`]}],TEXT:[{name:`Text`,extensions:[`txt`]}],JSON:[{name:`JSON`,extensions:[`json`]}],ALL:[{name:`All Files`,extensions:[`*`]}]};static generateTimestampedFilename(e,t){return`${e}-${new Date().toISOString().slice(0,19).replace(/:/g,`-`)}.${t}`}};export{V as a,M as c,N as d,F as f,W as i,I as l,q as n,L as o,k as p,G as r,O as s,re as t,P as u};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./vendor-react-CCIEwYL0.js";import{u as r}from"./ui-CU7rSUrT.js";import{t as i}from"./button-2PNVsNX1.js";import{_ as a,a as o,c as s,d as c,f as ee,i as te,l as ne,n as re,p as ie,r as l,s as u,t as ae,u as oe}from"./select-OsknUBRJ.js";import{a as d,c as se,i as ce,l as le,n as ue,o as de,s as fe,t as pe,u as f}from"./jianduMemoryApi-w4HCsBoN.js";var p=e(t(),1),m=n(),h={title:``,type:`project`,content:``,tags:``,keywords:``,entities:``,granularity:``},g=e=>{if(!(e instanceof d))return`unavailable`;switch(e.code){case`invalid_input`:return`invalid`;case`context_unavailable`:return`context`;case`access_denied`:return`denied`;case`action_rejected`:return`rejected`;case`malformed_response`:return`malformed`;case`request_failed`:return`unavailable`}},_=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),me=e=>({title:e.title,type:e.type,content:e.content,tags:_(e.tags),keywords:_(e.keywords),entities:_(e.entities),...e.granularity?{granularity:e.granularity}:{}}),he=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));return t.forEach(e=>n.set(e.id,e)),[...n.values()]};function v({api:e=fe}){let{t}=r(),n=a(e=>e.currentSessionId),d=(0,p.useRef)(n);d.current=n;let _=(0,p.useRef)(0),v=(0,p.useRef)(0),y=(0,p.useRef)(0),b=(0,p.useRef)(0),x=(0,p.useRef)(0),[ge,_e]=(0,p.useState)(0),[S,ve]=(0,p.useState)(null),[ye,C]=(0,p.useState)(!1),[be,w]=(0,p.useState)(null),[xe,Se]=(0,p.useState)(``),[T,Ce]=(0,p.useState)(``),[we,Te]=(0,p.useState)(`active`),[E,Ee]=(0,p.useState)(`active`),[De,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(null),[A,j]=(0,p.useState)(!1),[Oe,M]=(0,p.useState)(null),[N,P]=(0,p.useState)(null),[ke,F]=(0,p.useState)(null),[Ae,I]=(0,p.useState)(null),[je,L]=(0,p.useState)(!1),[R,z]=(0,p.useState)(h),[B,V]=(0,p.useState)(null),[Me,H]=(0,p.useState)(!1),[Ne,U]=(0,p.useState)(null),[W,G]=(0,p.useState)(null),[Pe,K]=(0,p.useState)(null),[Fe,q]=(0,p.useState)(null),[Ie,J]=(0,p.useState)(null),Y=(0,p.useCallback)(async(t,n,r,i,a,o)=>{let s=++v.current;j(!0),M(null);try{let c=await e.queryProjectMemories(t,{query:n,filters:{status:[r]},...i?{cursor:i}:{}});return _.current!==o||v.current!==s?`stale`:(D(e=>a?he(e,c.items):c.items),k(c),`ok`)}catch(e){return _.current!==o||v.current!==s?`stale`:(M(g(e)),a||(D([]),k(null)),`failed`)}finally{_.current===o&&v.current===s&&j(!1)}},[e]),Le=(0,p.useCallback)(e=>{let t=_.current;t===e&&(_.current=t+1)},[]);(0,p.useEffect)(()=>{let t=++_.current;if(++v.current,++y.current,++b.current,++x.current,ve(null),w(null),C(!!n),Se(``),Ce(``),Te(`active`),Ee(`active`),D([]),k(null),M(null),j(!1),P(null),F(null),I(null),L(!1),z(h),V(null),H(!1),U(null),G(null),K(null),q(null),J(null),!n){w(`context`);return}return e.resolveProjectContext(n).then(e=>{_.current!==t||d.current!==n||(ve(e),C(!1),Y(e,``,`active`,void 0,!1,t))}).catch(e=>{_.current!==t||d.current!==n||(C(!1),w(g(e)))}),()=>Le(t)},[e,n,Le,Y,ge]);let Re=(0,p.useCallback)(e=>{++_.current,++v.current,++y.current,++b.current,++x.current,ve(null),Se(``),Ce(``),Te(`active`),Ee(`active`),D([]),k(null),j(!1),M(null),P(null),F(null),I(null),L(!1),z(h),V(null),H(!1),U(null),G(null),K(null),q(null),J(null),w(e),C(!1)},[]),ze=(0,p.useCallback)(async(t,n)=>{let r=d.current;if(!r||_.current!==n)return null;try{let i=await e.resolveProjectContext(r);return _.current!==n||d.current!==r?null:le(t,i)?i:(Re(`context`),null)}catch(e){return _.current===n&&Re(g(e)),null}},[e,Re]),Be=()=>{if(!S)return;let e=xe.trim(),t=we;Ce(e),Ee(t),J(null),Y(S,e,t,void 0,!1,_.current)},Ve=async t=>{if(!S)return;let n=++y.current,r=_.current;P(null),I(null),F(t.id);try{let i=await e.getProjectMemory(S,t.id);if(_.current!==r||y.current!==n)return;P(i)}catch(e){_.current===r&&y.current===n&&I(g(e))}finally{_.current===r&&y.current===n&&F(null)}},He=()=>{++y.current,P(null),I(null),F(null),K(null),q(null)},Ue=(0,p.useMemo)(()=>JSON.stringify(R),[R]),X=(e,t)=>{++b.current,z(n=>({...n,[e]:t})),V(null),H(!1),U(null)},We=()=>{z(h),V(null),U(null),L(!0)},Ge=()=>{W!==`create`&&(++b.current,L(!1),z(h),V(null),U(null))},Ke=async()=>{if(!S||Me||W)return;let t=me(R);try{se(t)}catch(e){U(g(e));return}let n=Ue,r=++b.current,i=_.current;H(!0),V(null),U(null);try{let a=await e.queryProjectMemories(S,{query:``,limit:1});if(_.current!==i||b.current!==r)return;let o=a.matchedCount===0?a:await e.queryProjectMemories(S,{query:de(t),limit:5});if(_.current!==i||b.current!==r)return;V({fingerprint:n,items:o.items,truncated:o.truncated})}catch(e){_.current===i&&b.current===r&&U(g(e))}finally{_.current===i&&b.current===r&&H(!1)}},qe=async()=>{if(!S||W||!B||B.fingerprint!==Ue)return;let t=me(R);try{se(t)}catch(e){U(g(e));return}let n=_.current,r=++x.current;G(`create`),U(null);let i=await ze(S,n);if(!i||_.current!==n||x.current!==r){x.current===r&&G(null);return}try{let a=await e.createProjectMemory(i,t);if(_.current!==n||x.current!==r)return;L(!1),V(null),J({kind:`created`,title:a.title}),await Y(i,T,E,void 0,!1,n)===`failed`&&x.current===r&&J({kind:`createdRefreshFailed`,title:a.title})}catch(e){_.current===n&&x.current===r&&U(g(e))}finally{_.current===n&&x.current===r&&G(null)}},Je=async()=>{let t=Pe;if(!S||!t||W)return;let n=_.current,r=++x.current;G(`archive`),q(null);let i=await ze(S,n);if(!i||_.current!==n||x.current!==r){x.current===r&&G(null);return}try{if(await e.archiveProjectMemory(i,t.id),_.current!==n||x.current!==r)return;K(null),He(),J({kind:`archived`,title:t.title}),await Y(i,T,E,void 0,!1,n)===`failed`&&x.current===r&&J({kind:`archivedRefreshFailed`,title:t.title})}catch(e){_.current===n&&x.current===r&&q(g(e))}finally{_.current===n&&x.current===r&&G(null)}},Z=e=>t(`settings.jiandu.errors.${e}`),Q=e=>t(`settings.jiandu.types.${e}`),$=e=>t(`settings.jiandu.statuses.${e}`);return(0,m.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-4`,children:[(0,m.jsx)(`header`,{className:`space-y-1`,children:(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h2`,{className:`text-lg font-semibold`,children:t(`settings.jiandu.title`)}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`settings.jiandu.description`)})]}),(0,m.jsx)(i,{onClick:We,disabled:!S||ye,children:t(`settings.jiandu.create.open`)})]})}),(0,m.jsxs)(`section`,{className:`rounded-lg border p-3`,"aria-label":t(`settings.jiandu.context.label`),children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:t(`settings.jiandu.context.label`)}),ye?(0,m.jsx)(`p`,{className:`mt-1 text-sm`,children:t(`settings.jiandu.context.loading`)}):S?(0,m.jsxs)(`dl`,{className:`mt-2 grid gap-2 text-sm sm:grid-cols-2`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.session`)}),(0,m.jsx)(`dd`,{className:`break-words font-medium`,children:S.activeSessionTitle})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.project`)}),(0,m.jsx)(`dd`,{className:`break-all font-mono text-xs`,children:S.projectId})]}),S.activeSessionId===S.authoritySessionId?null:(0,m.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,m.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.rootSession`)}),(0,m.jsx)(`dd`,{children:S.authoritySessionTitle})]})]}):(0,m.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,m.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(be??`context`)}),n?(0,m.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>_e(e=>e+1),children:t(`settings.jiandu.context.retry`)}):null]})]}),Ie?(0,m.jsx)(`p`,{role:`status`,className:`rounded-lg border border-primary/30 bg-primary/5 p-3 text-sm`,children:t(`settings.jiandu.notices.${Ie.kind}`,{title:Ie.title})}):null,S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),Be()},children:[(0,m.jsx)(ne,{"aria-label":t(`settings.jiandu.search.label`),value:xe,maxLength:ue.queryChars,onChange:e=>Se(e.target.value),placeholder:t(`settings.jiandu.search.placeholder`)}),(0,m.jsxs)(ae,{value:we,disabled:A,onValueChange:e=>Te(e),children:[(0,m.jsx)(te,{className:`w-full sm:w-36`,"aria-label":t(`settings.jiandu.search.statusLabel`),children:(0,m.jsx)(o,{})}),(0,m.jsxs)(re,{className:`z-[150]`,children:[(0,m.jsx)(l,{value:`active`,children:$(`active`)}),(0,m.jsx)(l,{value:`archived`,children:$(`archived`)})]})]}),(0,m.jsx)(i,{type:`submit`,disabled:A,children:t(`settings.jiandu.search.action`)}),(0,m.jsx)(i,{type:`button`,variant:`outline`,disabled:A,onClick:()=>void Y(S,T,E,void 0,!1,_.current),children:t(`settings.jiandu.search.refresh`)})]}),Oe?(0,m.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-destructive/40 p-3 text-sm text-destructive`,children:Z(Oe)}):null,O?(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,m.jsx)(`span`,{children:t(`settings.jiandu.list.count`,{visible:De.length,matched:O.matchedCount})}),O.truncated?(0,m.jsx)(`span`,{children:t(`settings.jiandu.list.truncated`)}):null,O.remainingCount>0?(0,m.jsx)(`span`,{children:t(`settings.jiandu.list.remaining`,{count:O.remainingCount})}):null]}):null,De.length>0?(0,m.jsx)(`ul`,{className:`space-y-2`,"aria-label":t(`settings.jiandu.list.label`),children:De.map(e=>(0,m.jsxs)(`li`,{className:`rounded-lg border p-3`,children:[(0,m.jsx)(`button`,{type:`button`,className:`max-w-full break-words text-left text-sm font-semibold hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,disabled:ke===e.id,onClick:()=>void Ve(e),children:e.title}),(0,m.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[(0,m.jsx)(u,{variant:`outline`,children:Q(e.type)}),(0,m.jsx)(u,{variant:e.status===`archived`?`secondary`:`outline`,children:$(e.status)}),e.granularity?(0,m.jsx)(u,{variant:`outline`,children:e.granularity}):null]}),(0,m.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-muted-foreground`,children:e.summary})]},e.id))}):O&&!A?(0,m.jsx)(`p`,{className:`rounded-lg border p-4 text-sm text-muted-foreground`,children:t(`settings.jiandu.list.empty`)}):null,A?(0,m.jsx)(`p`,{role:`status`,children:t(`settings.jiandu.list.loading`)}):null,O?.nextCursor?(0,m.jsx)(i,{variant:`outline`,className:`w-full`,disabled:A,onClick:()=>void Y(S,T,E,O.nextCursor,!0,_.current),children:t(`settings.jiandu.list.more`)}):null]}):null,(0,m.jsx)(oe,{open:!!(N||ke||Ae),onOpenChange:e=>e?null:He(),children:(0,m.jsxs)(c,{showCloseButton:!1,className:`gap-4 p-5 sm:max-w-2xl`,children:[(0,m.jsx)(ie,{children:N?.title??t(`settings.jiandu.detail.title`)}),ke?(0,m.jsx)(`p`,{role:`status`,children:t(`settings.jiandu.detail.loading`)}):null,Ae?(0,m.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Ae)}):null,N?(0,m.jsxs)(`div`,{className:`min-h-0 space-y-3 overflow-y-auto`,children:[(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,m.jsx)(u,{variant:`outline`,children:Q(N.type)}),(0,m.jsx)(u,{variant:N.status===`archived`?`secondary`:`outline`,children:$(N.status)})]}),N.bodyTruncated||N.retrievalMetadataTruncated?(0,m.jsx)(`p`,{role:`status`,className:`text-xs text-amber-600 dark:text-amber-400`,children:N.bodyTruncated?t(`settings.jiandu.detail.bodyTruncated`):t(`settings.jiandu.detail.metadataTruncated`)}):null,(0,m.jsx)(`pre`,{className:`max-h-[50dvh] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted p-3 font-sans text-sm`,children:N.body})]}):null,(0,m.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[N&&N.status!==`archived`?(0,m.jsx)(i,{variant:`destructive`,onClick:()=>{q(null),K(N)},children:t(`settings.jiandu.archive.open`)}):null,(0,m.jsx)(i,{variant:`outline`,onClick:He,children:t(`settings.jiandu.detail.close`)})]})]})}),(0,m.jsx)(oe,{open:je,onOpenChange:e=>e?null:Ge(),children:(0,m.jsxs)(c,{showCloseButton:!1,dismissable:W!==`create`,className:`gap-4 p-5 sm:max-w-2xl`,children:[(0,m.jsx)(ie,{children:t(`settings.jiandu.create.title`)}),(0,m.jsx)(ee,{children:t(`settings.jiandu.create.description`)}),(0,m.jsxs)(`div`,{className:`min-h-0 space-y-3 overflow-y-auto pr-1`,children:[(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(f,{htmlFor:`jiandu-title`,children:t(`settings.jiandu.create.titleLabel`)}),(0,m.jsx)(ne,{id:`jiandu-title`,value:R.title,maxLength:ue.titleChars,disabled:!!W,onChange:e=>X(`title`,e.target.value)})]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(f,{children:t(`settings.jiandu.create.typeLabel`)}),(0,m.jsxs)(ae,{value:R.type,disabled:!!W,onValueChange:e=>X(`type`,e),children:[(0,m.jsx)(te,{className:`w-full`,"aria-label":t(`settings.jiandu.create.typeLabel`),children:(0,m.jsx)(o,{})}),(0,m.jsx)(re,{className:`z-[150]`,children:ce.map(e=>(0,m.jsx)(l,{value:e,children:Q(e)},e))})]})]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(f,{htmlFor:`jiandu-body`,children:t(`settings.jiandu.create.bodyLabel`)}),(0,m.jsx)(s,{id:`jiandu-body`,rows:7,value:R.content,maxLength:ue.bodyChars,disabled:!!W,onChange:e=>X(`content`,e.target.value)})]}),(0,m.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[[`tags`,`keywords`,`entities`].map(e=>(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(f,{htmlFor:`jiandu-${e}`,children:t(`settings.jiandu.create.${e}Label`)}),(0,m.jsx)(ne,{id:`jiandu-${e}`,value:R[e],disabled:!!W,onChange:t=>X(e,t.target.value),placeholder:t(`settings.jiandu.create.csvHint`)})]},e)),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(f,{children:t(`settings.jiandu.create.granularityLabel`)}),(0,m.jsxs)(ae,{value:R.granularity||`none`,disabled:!!W,onValueChange:e=>X(`granularity`,e===`none`?``:e),children:[(0,m.jsx)(te,{className:`w-full`,"aria-label":t(`settings.jiandu.create.granularityLabel`),children:(0,m.jsx)(o,{})}),(0,m.jsxs)(re,{className:`z-[150]`,children:[(0,m.jsx)(l,{value:`none`,children:t(`settings.jiandu.create.noGranularity`)}),pe.map(e=>(0,m.jsx)(l,{value:e,children:e},e))]})]})]})]}),Ne?(0,m.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Ne)}):null,B?(0,m.jsxs)(`section`,{className:`rounded-lg border p-3`,"aria-label":t(`settings.jiandu.create.matchesLabel`),children:[(0,m.jsx)(`h3`,{className:`text-sm font-medium`,children:B.items.length>0?t(`settings.jiandu.create.matches`):t(`settings.jiandu.create.noMatches`)}),B.items.length>0?(0,m.jsx)(`ul`,{className:`mt-2 space-y-1 text-sm`,children:B.items.map(e=>(0,m.jsxs)(`li`,{children:[e.title,` · `,$(e.status)]},e.id))}):null,B.truncated?(0,m.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:t(`settings.jiandu.create.matchesTruncated`)}):null]}):null]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,m.jsx)(i,{variant:`outline`,disabled:W===`create`,onClick:Ge,children:t(`settings.jiandu.create.close`)}),(0,m.jsx)(i,{variant:`secondary`,disabled:Me||!!W,onClick:()=>void Ke(),children:t(Me?`settings.jiandu.create.lookingUp`:`settings.jiandu.create.lookup`)}),(0,m.jsx)(i,{disabled:W===`create`||!B||B.fingerprint!==Ue,onClick:()=>void qe(),children:t(W===`create`?`settings.jiandu.create.creating`:`settings.jiandu.create.confirm`)})]})]})}),(0,m.jsx)(oe,{open:!!Pe,onOpenChange:e=>{!e&&W!==`archive`&&(K(null),q(null))},children:(0,m.jsxs)(c,{showCloseButton:!1,dismissable:W!==`archive`,className:`gap-4 p-5`,children:[(0,m.jsx)(ie,{children:t(`settings.jiandu.archive.title`,{title:Pe?.title??``})}),(0,m.jsx)(ee,{children:t(`settings.jiandu.archive.description`)}),Fe?(0,m.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Fe)}):null,(0,m.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,m.jsx)(i,{variant:`outline`,disabled:W===`archive`,onClick:()=>{K(null),q(null)},children:t(`settings.jiandu.archive.cancel`)}),(0,m.jsx)(i,{variant:`destructive`,disabled:W===`archive`,onClick:()=>void Je(),children:t(W===`archive`?`settings.jiandu.archive.archiving`:`settings.jiandu.archive.confirm`)})]})]})})]})}export{v as JianduProjectMemories};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./vendor-react-CCIEwYL0.js";import{u as r}from"./ui-CwXUF4vO.js";import{t as i}from"./button-2PNVsNX1.js";import{_ as a,a as o,c as s,d as c,f as ee,i as te,l as ne,n as re,p as ie,r as l,s as u,t as ae,u as oe}from"./select-ETv3WtsZ.js";import{a as d,c as se,i as ce,l as le,n as ue,o as de,s as fe,t as pe,u as f}from"./jianduMemoryApi-BX4FRsDF.js";var p=e(t(),1),m=n(),h={title:``,type:`project`,content:``,tags:``,keywords:``,entities:``,granularity:``},g=e=>{if(!(e instanceof d))return`unavailable`;switch(e.code){case`invalid_input`:return`invalid`;case`context_unavailable`:return`context`;case`access_denied`:return`denied`;case`action_rejected`:return`rejected`;case`malformed_response`:return`malformed`;case`request_failed`:return`unavailable`}},_=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),me=e=>({title:e.title,type:e.type,content:e.content,tags:_(e.tags),keywords:_(e.keywords),entities:_(e.entities),...e.granularity?{granularity:e.granularity}:{}}),he=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));return t.forEach(e=>n.set(e.id,e)),[...n.values()]};function v({api:e=fe}){let{t}=r(),n=a(e=>e.currentSessionId),d=(0,p.useRef)(n);d.current=n;let _=(0,p.useRef)(0),v=(0,p.useRef)(0),y=(0,p.useRef)(0),b=(0,p.useRef)(0),x=(0,p.useRef)(0),[ge,_e]=(0,p.useState)(0),[S,ve]=(0,p.useState)(null),[ye,C]=(0,p.useState)(!1),[be,w]=(0,p.useState)(null),[xe,Se]=(0,p.useState)(``),[T,Ce]=(0,p.useState)(``),[we,Te]=(0,p.useState)(`active`),[E,Ee]=(0,p.useState)(`active`),[De,D]=(0,p.useState)([]),[O,k]=(0,p.useState)(null),[A,j]=(0,p.useState)(!1),[Oe,M]=(0,p.useState)(null),[N,P]=(0,p.useState)(null),[ke,F]=(0,p.useState)(null),[Ae,I]=(0,p.useState)(null),[je,L]=(0,p.useState)(!1),[R,z]=(0,p.useState)(h),[B,V]=(0,p.useState)(null),[Me,H]=(0,p.useState)(!1),[Ne,U]=(0,p.useState)(null),[W,G]=(0,p.useState)(null),[Pe,K]=(0,p.useState)(null),[Fe,q]=(0,p.useState)(null),[Ie,J]=(0,p.useState)(null),Y=(0,p.useCallback)(async(t,n,r,i,a,o)=>{let s=++v.current;j(!0),M(null);try{let c=await e.queryProjectMemories(t,{query:n,filters:{status:[r]},...i?{cursor:i}:{}});return _.current!==o||v.current!==s?`stale`:(D(e=>a?he(e,c.items):c.items),k(c),`ok`)}catch(e){return _.current!==o||v.current!==s?`stale`:(M(g(e)),a||(D([]),k(null)),`failed`)}finally{_.current===o&&v.current===s&&j(!1)}},[e]),Le=(0,p.useCallback)(e=>{let t=_.current;t===e&&(_.current=t+1)},[]);(0,p.useEffect)(()=>{let t=++_.current;if(++v.current,++y.current,++b.current,++x.current,ve(null),w(null),C(!!n),Se(``),Ce(``),Te(`active`),Ee(`active`),D([]),k(null),M(null),j(!1),P(null),F(null),I(null),L(!1),z(h),V(null),H(!1),U(null),G(null),K(null),q(null),J(null),!n){w(`context`);return}return e.resolveProjectContext(n).then(e=>{_.current!==t||d.current!==n||(ve(e),C(!1),Y(e,``,`active`,void 0,!1,t))}).catch(e=>{_.current!==t||d.current!==n||(C(!1),w(g(e)))}),()=>Le(t)},[e,n,Le,Y,ge]);let Re=(0,p.useCallback)(e=>{++_.current,++v.current,++y.current,++b.current,++x.current,ve(null),Se(``),Ce(``),Te(`active`),Ee(`active`),D([]),k(null),j(!1),M(null),P(null),F(null),I(null),L(!1),z(h),V(null),H(!1),U(null),G(null),K(null),q(null),J(null),w(e),C(!1)},[]),ze=(0,p.useCallback)(async(t,n)=>{let r=d.current;if(!r||_.current!==n)return null;try{let i=await e.resolveProjectContext(r);return _.current!==n||d.current!==r?null:le(t,i)?i:(Re(`context`),null)}catch(e){return _.current===n&&Re(g(e)),null}},[e,Re]),Be=()=>{if(!S)return;let e=xe.trim(),t=we;Ce(e),Ee(t),J(null),Y(S,e,t,void 0,!1,_.current)},Ve=async t=>{if(!S)return;let n=++y.current,r=_.current;P(null),I(null),F(t.id);try{let i=await e.getProjectMemory(S,t.id);if(_.current!==r||y.current!==n)return;P(i)}catch(e){_.current===r&&y.current===n&&I(g(e))}finally{_.current===r&&y.current===n&&F(null)}},He=()=>{++y.current,P(null),I(null),F(null),K(null),q(null)},Ue=(0,p.useMemo)(()=>JSON.stringify(R),[R]),X=(e,t)=>{++b.current,z(n=>({...n,[e]:t})),V(null),H(!1),U(null)},We=()=>{z(h),V(null),U(null),L(!0)},Ge=()=>{W!==`create`&&(++b.current,L(!1),z(h),V(null),U(null))},Ke=async()=>{if(!S||Me||W)return;let t=me(R);try{se(t)}catch(e){U(g(e));return}let n=Ue,r=++b.current,i=_.current;H(!0),V(null),U(null);try{let a=await e.queryProjectMemories(S,{query:``,limit:1});if(_.current!==i||b.current!==r)return;let o=a.matchedCount===0?a:await e.queryProjectMemories(S,{query:de(t),limit:5});if(_.current!==i||b.current!==r)return;V({fingerprint:n,items:o.items,truncated:o.truncated})}catch(e){_.current===i&&b.current===r&&U(g(e))}finally{_.current===i&&b.current===r&&H(!1)}},qe=async()=>{if(!S||W||!B||B.fingerprint!==Ue)return;let t=me(R);try{se(t)}catch(e){U(g(e));return}let n=_.current,r=++x.current;G(`create`),U(null);let i=await ze(S,n);if(!i||_.current!==n||x.current!==r){x.current===r&&G(null);return}try{let a=await e.createProjectMemory(i,t);if(_.current!==n||x.current!==r)return;L(!1),V(null),J({kind:`created`,title:a.title}),await Y(i,T,E,void 0,!1,n)===`failed`&&x.current===r&&J({kind:`createdRefreshFailed`,title:a.title})}catch(e){_.current===n&&x.current===r&&U(g(e))}finally{_.current===n&&x.current===r&&G(null)}},Je=async()=>{let t=Pe;if(!S||!t||W)return;let n=_.current,r=++x.current;G(`archive`),q(null);let i=await ze(S,n);if(!i||_.current!==n||x.current!==r){x.current===r&&G(null);return}try{if(await e.archiveProjectMemory(i,t.id),_.current!==n||x.current!==r)return;K(null),He(),J({kind:`archived`,title:t.title}),await Y(i,T,E,void 0,!1,n)===`failed`&&x.current===r&&J({kind:`archivedRefreshFailed`,title:t.title})}catch(e){_.current===n&&x.current===r&&q(g(e))}finally{_.current===n&&x.current===r&&G(null)}},Z=e=>t(`settings.jiandu.errors.${e}`),Q=e=>t(`settings.jiandu.types.${e}`),$=e=>t(`settings.jiandu.statuses.${e}`);return(0,m.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-4`,children:[(0,m.jsx)(`header`,{className:`space-y-1`,children:(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h2`,{className:`text-lg font-semibold`,children:t(`settings.jiandu.title`)}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`settings.jiandu.description`)})]}),(0,m.jsx)(i,{onClick:We,disabled:!S||ye,children:t(`settings.jiandu.create.open`)})]})}),(0,m.jsxs)(`section`,{className:`rounded-lg border p-3`,"aria-label":t(`settings.jiandu.context.label`),children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:t(`settings.jiandu.context.label`)}),ye?(0,m.jsx)(`p`,{className:`mt-1 text-sm`,children:t(`settings.jiandu.context.loading`)}):S?(0,m.jsxs)(`dl`,{className:`mt-2 grid gap-2 text-sm sm:grid-cols-2`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.session`)}),(0,m.jsx)(`dd`,{className:`break-words font-medium`,children:S.activeSessionTitle})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.project`)}),(0,m.jsx)(`dd`,{className:`break-all font-mono text-xs`,children:S.projectId})]}),S.activeSessionId===S.authoritySessionId?null:(0,m.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,m.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.rootSession`)}),(0,m.jsx)(`dd`,{children:S.authoritySessionTitle})]})]}):(0,m.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,m.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(be??`context`)}),n?(0,m.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>_e(e=>e+1),children:t(`settings.jiandu.context.retry`)}):null]})]}),Ie?(0,m.jsx)(`p`,{role:`status`,className:`rounded-lg border border-primary/30 bg-primary/5 p-3 text-sm`,children:t(`settings.jiandu.notices.${Ie.kind}`,{title:Ie.title})}):null,S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),Be()},children:[(0,m.jsx)(ne,{"aria-label":t(`settings.jiandu.search.label`),value:xe,maxLength:ue.queryChars,onChange:e=>Se(e.target.value),placeholder:t(`settings.jiandu.search.placeholder`)}),(0,m.jsxs)(ae,{value:we,disabled:A,onValueChange:e=>Te(e),children:[(0,m.jsx)(te,{className:`w-full sm:w-36`,"aria-label":t(`settings.jiandu.search.statusLabel`),children:(0,m.jsx)(o,{})}),(0,m.jsxs)(re,{className:`z-[150]`,children:[(0,m.jsx)(l,{value:`active`,children:$(`active`)}),(0,m.jsx)(l,{value:`archived`,children:$(`archived`)})]})]}),(0,m.jsx)(i,{type:`submit`,disabled:A,children:t(`settings.jiandu.search.action`)}),(0,m.jsx)(i,{type:`button`,variant:`outline`,disabled:A,onClick:()=>void Y(S,T,E,void 0,!1,_.current),children:t(`settings.jiandu.search.refresh`)})]}),Oe?(0,m.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-destructive/40 p-3 text-sm text-destructive`,children:Z(Oe)}):null,O?(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,m.jsx)(`span`,{children:t(`settings.jiandu.list.count`,{visible:De.length,matched:O.matchedCount})}),O.truncated?(0,m.jsx)(`span`,{children:t(`settings.jiandu.list.truncated`)}):null,O.remainingCount>0?(0,m.jsx)(`span`,{children:t(`settings.jiandu.list.remaining`,{count:O.remainingCount})}):null]}):null,De.length>0?(0,m.jsx)(`ul`,{className:`space-y-2`,"aria-label":t(`settings.jiandu.list.label`),children:De.map(e=>(0,m.jsxs)(`li`,{className:`rounded-lg border p-3`,children:[(0,m.jsx)(`button`,{type:`button`,className:`max-w-full break-words text-left text-sm font-semibold hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,disabled:ke===e.id,onClick:()=>void Ve(e),children:e.title}),(0,m.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[(0,m.jsx)(u,{variant:`outline`,children:Q(e.type)}),(0,m.jsx)(u,{variant:e.status===`archived`?`secondary`:`outline`,children:$(e.status)}),e.granularity?(0,m.jsx)(u,{variant:`outline`,children:e.granularity}):null]}),(0,m.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-muted-foreground`,children:e.summary})]},e.id))}):O&&!A?(0,m.jsx)(`p`,{className:`rounded-lg border p-4 text-sm text-muted-foreground`,children:t(`settings.jiandu.list.empty`)}):null,A?(0,m.jsx)(`p`,{role:`status`,children:t(`settings.jiandu.list.loading`)}):null,O?.nextCursor?(0,m.jsx)(i,{variant:`outline`,className:`w-full`,disabled:A,onClick:()=>void Y(S,T,E,O.nextCursor,!0,_.current),children:t(`settings.jiandu.list.more`)}):null]}):null,(0,m.jsx)(oe,{open:!!(N||ke||Ae),onOpenChange:e=>e?null:He(),children:(0,m.jsxs)(c,{showCloseButton:!1,className:`gap-4 p-5 sm:max-w-2xl`,children:[(0,m.jsx)(ie,{children:N?.title??t(`settings.jiandu.detail.title`)}),ke?(0,m.jsx)(`p`,{role:`status`,children:t(`settings.jiandu.detail.loading`)}):null,Ae?(0,m.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Ae)}):null,N?(0,m.jsxs)(`div`,{className:`min-h-0 space-y-3 overflow-y-auto`,children:[(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,m.jsx)(u,{variant:`outline`,children:Q(N.type)}),(0,m.jsx)(u,{variant:N.status===`archived`?`secondary`:`outline`,children:$(N.status)})]}),N.bodyTruncated||N.retrievalMetadataTruncated?(0,m.jsx)(`p`,{role:`status`,className:`text-xs text-amber-600 dark:text-amber-400`,children:N.bodyTruncated?t(`settings.jiandu.detail.bodyTruncated`):t(`settings.jiandu.detail.metadataTruncated`)}):null,(0,m.jsx)(`pre`,{className:`max-h-[50dvh] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted p-3 font-sans text-sm`,children:N.body})]}):null,(0,m.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[N&&N.status!==`archived`?(0,m.jsx)(i,{variant:`destructive`,onClick:()=>{q(null),K(N)},children:t(`settings.jiandu.archive.open`)}):null,(0,m.jsx)(i,{variant:`outline`,onClick:He,children:t(`settings.jiandu.detail.close`)})]})]})}),(0,m.jsx)(oe,{open:je,onOpenChange:e=>e?null:Ge(),children:(0,m.jsxs)(c,{showCloseButton:!1,dismissable:W!==`create`,className:`gap-4 p-5 sm:max-w-2xl`,children:[(0,m.jsx)(ie,{children:t(`settings.jiandu.create.title`)}),(0,m.jsx)(ee,{children:t(`settings.jiandu.create.description`)}),(0,m.jsxs)(`div`,{className:`min-h-0 space-y-3 overflow-y-auto pr-1`,children:[(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(f,{htmlFor:`jiandu-title`,children:t(`settings.jiandu.create.titleLabel`)}),(0,m.jsx)(ne,{id:`jiandu-title`,value:R.title,maxLength:ue.titleChars,disabled:!!W,onChange:e=>X(`title`,e.target.value)})]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(f,{children:t(`settings.jiandu.create.typeLabel`)}),(0,m.jsxs)(ae,{value:R.type,disabled:!!W,onValueChange:e=>X(`type`,e),children:[(0,m.jsx)(te,{className:`w-full`,"aria-label":t(`settings.jiandu.create.typeLabel`),children:(0,m.jsx)(o,{})}),(0,m.jsx)(re,{className:`z-[150]`,children:ce.map(e=>(0,m.jsx)(l,{value:e,children:Q(e)},e))})]})]}),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(f,{htmlFor:`jiandu-body`,children:t(`settings.jiandu.create.bodyLabel`)}),(0,m.jsx)(s,{id:`jiandu-body`,rows:7,value:R.content,maxLength:ue.bodyChars,disabled:!!W,onChange:e=>X(`content`,e.target.value)})]}),(0,m.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[[`tags`,`keywords`,`entities`].map(e=>(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(f,{htmlFor:`jiandu-${e}`,children:t(`settings.jiandu.create.${e}Label`)}),(0,m.jsx)(ne,{id:`jiandu-${e}`,value:R[e],disabled:!!W,onChange:t=>X(e,t.target.value),placeholder:t(`settings.jiandu.create.csvHint`)})]},e)),(0,m.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,m.jsx)(f,{children:t(`settings.jiandu.create.granularityLabel`)}),(0,m.jsxs)(ae,{value:R.granularity||`none`,disabled:!!W,onValueChange:e=>X(`granularity`,e===`none`?``:e),children:[(0,m.jsx)(te,{className:`w-full`,"aria-label":t(`settings.jiandu.create.granularityLabel`),children:(0,m.jsx)(o,{})}),(0,m.jsxs)(re,{className:`z-[150]`,children:[(0,m.jsx)(l,{value:`none`,children:t(`settings.jiandu.create.noGranularity`)}),pe.map(e=>(0,m.jsx)(l,{value:e,children:e},e))]})]})]})]}),Ne?(0,m.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Ne)}):null,B?(0,m.jsxs)(`section`,{className:`rounded-lg border p-3`,"aria-label":t(`settings.jiandu.create.matchesLabel`),children:[(0,m.jsx)(`h3`,{className:`text-sm font-medium`,children:B.items.length>0?t(`settings.jiandu.create.matches`):t(`settings.jiandu.create.noMatches`)}),B.items.length>0?(0,m.jsx)(`ul`,{className:`mt-2 space-y-1 text-sm`,children:B.items.map(e=>(0,m.jsxs)(`li`,{children:[e.title,` · `,$(e.status)]},e.id))}):null,B.truncated?(0,m.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:t(`settings.jiandu.create.matchesTruncated`)}):null]}):null]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,m.jsx)(i,{variant:`outline`,disabled:W===`create`,onClick:Ge,children:t(`settings.jiandu.create.close`)}),(0,m.jsx)(i,{variant:`secondary`,disabled:Me||!!W,onClick:()=>void Ke(),children:t(Me?`settings.jiandu.create.lookingUp`:`settings.jiandu.create.lookup`)}),(0,m.jsx)(i,{disabled:W===`create`||!B||B.fingerprint!==Ue,onClick:()=>void qe(),children:t(W===`create`?`settings.jiandu.create.creating`:`settings.jiandu.create.confirm`)})]})]})}),(0,m.jsx)(oe,{open:!!Pe,onOpenChange:e=>{!e&&W!==`archive`&&(K(null),q(null))},children:(0,m.jsxs)(c,{showCloseButton:!1,dismissable:W!==`archive`,className:`gap-4 p-5`,children:[(0,m.jsx)(ie,{children:t(`settings.jiandu.archive.title`,{title:Pe?.title??``})}),(0,m.jsx)(ee,{children:t(`settings.jiandu.archive.description`)}),Fe?(0,m.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Fe)}):null,(0,m.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,m.jsx)(i,{variant:`outline`,disabled:W===`archive`,onClick:()=>{K(null),q(null)},children:t(`settings.jiandu.archive.cancel`)}),(0,m.jsx)(i,{variant:`destructive`,disabled:W===`archive`,onClick:()=>void Je(),children:t(W===`archive`?`settings.jiandu.archive.archiving`:`settings.jiandu.archive.confirm`)})]})]})})]})}export{v as JianduProjectMemories};