kennel 0.2.3 → 0.2.6
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.
- package/README.md +23 -13
- package/dist/cli/dispatch.js +16 -3
- package/dist/cli/src/cli/dispatch.js +16 -3
- package/dist/cli/src/cli/usage.js +1 -1
- package/dist/cli/src/core/command.js +1 -0
- package/dist/cli/src/core/init.js +5 -5
- package/dist/cli/src/plugins/external.d.ts +28 -2
- package/dist/cli/src/plugins/external.js +77 -23
- package/dist/cli/src/site/server-plugins.d.ts +4 -9
- package/dist/cli/src/site/viewer.js +1 -0
- package/dist/cli/usage.js +1 -1
- package/dist/core/api-client.js +576 -10317
- package/dist/core/command.js +1 -0
- package/dist/core/core-folders.js +2313 -12088
- package/dist/core/init.js +5 -5
- package/dist/core/runtime.js +8237 -20713
- package/dist/package/preview.js +19617 -33352
- package/dist/plugins/external.d.ts +28 -2
- package/dist/plugins/external.js +77 -23
- package/dist/site/server-plugins.d.ts +4 -9
- package/dist/site/server-plugins.js +557 -10452
- package/dist/site/viewer.js +1 -0
- package/kernel/apps/web/package.json +2 -6
- package/kernel/apps/web/scripts/dev.mjs +53 -0
- package/kernel/apps/web/src/app.css +0 -3
- package/kernel/apps/web/src/external-plugins.ts +1 -1
- package/kernel/apps/web/src/folder-filter-icons.tsx +1 -1
- package/kernel/apps/web/src/folder-plugin-view.tsx +1 -1
- package/kernel/apps/web/src/main.tsx +0 -1
- package/kernel/apps/web/src/plugins.ts +1 -31
- package/kernel/apps/web/tsconfig.json +1 -2
- package/kernel/apps/web/vite.config.ts +32 -14
- package/kernel/packages/agents/package.json +1 -1
- package/kernel/packages/agents/src/agent-card.tsx +1 -1
- package/kernel/packages/agents/src/client.tsx +1 -1
- package/kernel/packages/agents/src/manifest.ts +1 -1
- package/kernel/packages/agents/src/server.ts +1 -1
- package/kernel/packages/agents/src/viewer.tsx +1 -1
- package/kernel/packages/api/package.json +1 -5
- package/kernel/packages/api/src/server/acp-live-plugin.ts +1 -1
- package/kernel/packages/api/src/server/api/create-agent-file.ts +2 -2
- package/kernel/packages/api/src/server/api/document-edit.ts +2 -2
- package/kernel/packages/api/src/server/api/open-path.ts +2 -2
- package/kernel/packages/api/src/server/folder-metadata-plugin.ts +17 -42
- package/kernel/packages/api/src/server/index.ts +0 -1
- package/kernel/packages/api/src/server/plugins.ts +52 -19
- package/kernel/packages/api/src/shared/viewer-route.ts +1 -1
- package/kernel/packages/api/test/core.test.ts +14 -26
- package/kernel/packages/markdown/README.md +1 -1
- package/kernel/packages/notes/package.json +1 -1
- package/kernel/packages/notes/src/client.tsx +1 -1
- package/kernel/packages/notes/src/manifest.ts +1 -1
- package/kernel/packages/notes/src/server.ts +1 -1
- package/kernel/packages/plugins/SKILL.md +39 -0
- package/kernel/{plugins/mail → packages/plugins}/package.json +53 -28
- package/kernel/packages/plugins/src/index.ts +52 -0
- package/kernel/packages/plugins/src/page.ts +17 -0
- package/kernel/{plugins/projects → packages/plugins}/tsconfig.json +5 -1
- package/kernel/packages/plugins/tsup.config.ts +25 -0
- package/kernel/packages/ui/src/components/content-issues.tsx +1 -1
- package/kernel/packages/ui/tsconfig.json +1 -1
- package/package.json +2 -3
- package/web/assets/{abnfDiagram-VRR7QNED-Bgfb1nEB.js → abnfDiagram-VRR7QNED-xd_g1uK3.js} +1 -1
- package/web/assets/app-CX20nNIa.js +2 -0
- package/web/assets/{app-options-D-RJiQ-X.js → app-options-CkPJE5ep.js} +1 -1
- package/web/assets/{app-view-header-BLvLq02T.js → app-view-header-CNk5KnA-.js} +1 -1
- package/web/assets/{arc-Dk_KI36B.js → arc-B0u5yBJA.js} +1 -1
- package/web/assets/{architectureDiagram-ZJ3FMSHR-NR_KhRCf.js → architectureDiagram-ZJ3FMSHR-DfxOAo8P.js} +1 -1
- package/web/assets/{ask-tray-TzeTcO6-.js → ask-tray-SscJecDY.js} +1 -1
- package/web/assets/{blockDiagram-677ZJIJ3-CkLkwx9C.js → blockDiagram-677ZJIJ3-Ci3Usxh6.js} +1 -1
- package/web/assets/{c4Diagram-LMCZKHZV-CFCUH8e_.js → c4Diagram-LMCZKHZV-BqgwIVgh.js} +1 -1
- package/web/assets/channel-X7WHyxxT.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-B_BPLWsW.js → chunk-2Q5K7J3B-CfX69l2U.js} +1 -1
- package/web/assets/{chunk-32BRIVSS-B1VB1hOy.js → chunk-32BRIVSS-CuFlzZkl.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-KFcYr8Co.js → chunk-5VM5RSS4-DidCMlJa.js} +1 -1
- package/web/assets/{chunk-EX3LRPZG-CpBX3kuK.js → chunk-EX3LRPZG-B5CDm1dS.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-BPSl40wG.js → chunk-JWPE2WC7-D5fGV_sH.js} +1 -1
- package/web/assets/{chunk-MOJQB5TN-D2RcYmoU.js → chunk-MOJQB5TN-ayhH5Q-H.js} +1 -1
- package/web/assets/{chunk-RYQCIY6F-m7Gyn-t3.js → chunk-RYQCIY6F-C4BfOOZn.js} +1 -1
- package/web/assets/{chunk-V7JOEXUC-TDvdopxS.js → chunk-V7JOEXUC-DpUEIM9V.js} +1 -1
- package/web/assets/{chunk-VR4S4FIN-DZTsG51a.js → chunk-VR4S4FIN-DoQuFFRh.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-Dp0--RE2.js → chunk-XXDRQBXY-CI9eiLwn.js} +1 -1
- package/web/assets/classDiagram-OUVF2IWQ-BjsLQ3dz.js +1 -0
- package/web/assets/classDiagram-v2-EOCWNBFH-BjsLQ3dz.js +1 -0
- package/web/assets/client-7OWw5kW2.js +6 -0
- package/web/assets/client-DYj_td4Q.js +17 -0
- package/web/assets/{client-j2kQmxsO.js → client-Dk-NBvJR.js} +4 -4
- package/web/assets/command-zkzH4hVz.js +38 -0
- package/web/assets/{copy-context-C0Uqsp-3.js → copy-context-D5oiWrYC.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-CPu3PI8h.js → cose-bilkent-JH36ORCC-BHRk1mO3.js} +1 -1
- package/web/assets/{cynefin-VYW2F7L2-DWxftYAm.js → cynefin-VYW2F7L2-C1B09TRE.js} +1 -1
- package/web/assets/{cynefinDiagram-TSTJHNR4-DsmN2V-p.js → cynefinDiagram-TSTJHNR4-B27qXQbv.js} +1 -1
- package/web/assets/{dagre-VKFMJZFB-COEbApyY.js → dagre-VKFMJZFB-B1qEi32g.js} +1 -1
- package/web/assets/{diagram-FQU43EPY-0O9WGWKB.js → diagram-FQU43EPY-BMkkgADD.js} +1 -1
- package/web/assets/{diagram-G47NLZAW-CutEdMVh.js → diagram-G47NLZAW-Cb8_g1A5.js} +1 -1
- package/web/assets/{diagram-NH7WQ7WH-C9KZc3B2.js → diagram-NH7WQ7WH-B51wuc5m.js} +1 -1
- package/web/assets/{diagram-OA4YK3LP-D8kkPXbY.js → diagram-OA4YK3LP-xnsecbbI.js} +1 -1
- package/web/assets/{diagram-WEI45ONY-_YqiTaGP.js → diagram-WEI45ONY-DSZdyaAV.js} +1 -1
- package/web/assets/{document-Dgt5eZFj.js → document-Dc2dftTW.js} +3 -3
- package/web/assets/{ebnfDiagram-CCIWWBDH-JO-zQh6g.js → ebnfDiagram-CCIWWBDH-aTHmcUGy.js} +1 -1
- package/web/assets/{entities-C3wz7FCx.js → entities-CCUtpskY.js} +1 -1
- package/web/assets/{erDiagram-Q63AITRT-9UjQwJ4P.js → erDiagram-Q63AITRT-CUUPBcvo.js} +1 -1
- package/web/assets/{file-viewer-DZJ8nYnl.js → file-viewer-DJ3rsmef.js} +1 -1
- package/web/assets/{flowDiagram-23GEKE2U-Ca08tnYM.js → flowDiagram-23GEKE2U-aTQXx2Mh.js} +1 -1
- package/web/assets/{folder-image-BfGgxo7i.js → folder-image-Bnv43tzP.js} +1 -1
- package/web/assets/{folder-landing-qUKBCnG-.js → folder-landing-DCnzYXXY.js} +1 -1
- package/web/assets/{folder-list-BfFjv7rR.js → folder-list-DvVkVjiR.js} +1 -1
- package/web/assets/{folder-metadata-DCw8xzHk.js → folder-metadata-C9hMMzIH.js} +1 -1
- package/web/assets/{folder-mobile-bar-Ubz4babf.js → folder-mobile-bar-VoTL1GS0.js} +1 -1
- package/web/assets/folder-plugin-view-Cvd804ZU.js +6 -0
- package/web/assets/{ganttDiagram-NO4QXBWP-KnHzX5W3.js → ganttDiagram-NO4QXBWP-DiwdUp7u.js} +1 -1
- package/web/assets/{gitGraphDiagram-IHSO6WYX-Cm8woNtK.js → gitGraphDiagram-IHSO6WYX-BL2gG_IS.js} +1 -1
- package/web/assets/{index-CNyy98F8.js → index-CUTtMSyJ.js} +2 -2
- package/web/assets/index-CegvVQ1C.js +1 -0
- package/web/assets/index-Dwhf8F_U.css +1 -0
- package/web/assets/{infoDiagram-FWYZ7A6U-yyqmUtIb.js → infoDiagram-FWYZ7A6U-B3n0zZpt.js} +1 -1
- package/web/assets/{ishikawaDiagram-FXEZZL3T-BfvR_Zy4.js → ishikawaDiagram-FXEZZL3T-D7YytbEv.js} +1 -1
- package/web/assets/{journeyDiagram-5HDEW3XC-BKuw06HM.js → journeyDiagram-5HDEW3XC-BYwqEl3C.js} +1 -1
- package/web/assets/{kanban-definition-HUTT4EX6-n0010rmQ.js → kanban-definition-HUTT4EX6-BQHNJgXZ.js} +1 -1
- package/web/assets/{linear-C0d0lT8O.js → linear-BPiQCLNk.js} +1 -1
- package/web/assets/{mermaid.core-BDVbShyO.js → mermaid.core-CD-KvBjV.js} +4 -4
- package/web/assets/{metadata-KV0dpp4G.js → metadata-COJ7fZul.js} +1 -1
- package/web/assets/{mindmap-definition-LN4V7U3C--_0ks3GF.js → mindmap-definition-LN4V7U3C-C1L_gyoj.js} +1 -1
- package/web/assets/{pegDiagram-2B236MQR-CBoNIpKR.js → pegDiagram-2B236MQR-BDAfItqS.js} +1 -1
- package/web/assets/{pieDiagram-ENE6RG2P-MA5tkYh5.js → pieDiagram-ENE6RG2P-CkZYH3Vz.js} +1 -1
- package/web/assets/{popover-DBD7FF-W.js → popover-0oA2lLUV.js} +2 -2
- package/web/assets/{project-search-dialog-DM1IkSZu.js → project-search-dialog-B2oqMT6h.js} +1 -1
- package/web/assets/{quadrantDiagram-ABIIQ3AL-CWT1ryqF.js → quadrantDiagram-ABIIQ3AL-Dy8Al3YZ.js} +1 -1
- package/web/assets/{railroadDiagram-RFXS5EU6-ZiLB5FGi.js → railroadDiagram-RFXS5EU6-Dd9_yo7B.js} +1 -1
- package/web/assets/{requirementDiagram-TGXJPOKE-CQq9uneq.js → requirementDiagram-TGXJPOKE-DPhIUsbs.js} +1 -1
- package/web/assets/{sankeyDiagram-HTMAVEWB-qDG-0JqI.js → sankeyDiagram-HTMAVEWB-B2QkYtub.js} +1 -1
- package/web/assets/{search-DNrQA5fF.js → search-C1J0-xiB.js} +1 -1
- package/web/assets/select-CtXC_PLC.js +30 -0
- package/web/assets/{selection-popup-DmtTeRs2.js → selection-popup-qhlUFzGq.js} +1 -1
- package/web/assets/{sequenceDiagram-DBY2YBRQ-CiApurLO.js → sequenceDiagram-DBY2YBRQ-Bx7fcZDx.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-DZSR5QXm.js → sizeCapture-X5ZJPWSS-CIXIhl_A.js} +1 -1
- package/web/assets/{stateDiagram-2N3HPSRC-CjJJR9_z.js → stateDiagram-2N3HPSRC-DCrdAflB.js} +1 -1
- package/web/assets/stateDiagram-v2-6OUMAXLB-0KCFLYeQ.js +1 -0
- package/web/assets/{swimlanes-5IMT3BWC-CKmo1sg6.js → swimlanes-5IMT3BWC-DA2vc7iZ.js} +2 -2
- package/web/assets/swimlanesDiagram-G3AALYLV-CAw3AV84.js +8 -0
- package/web/assets/{timeline-definition-FHXFAJF6-D-NMwS3y.js → timeline-definition-FHXFAJF6-lKfJiV9V.js} +1 -1
- package/web/assets/{vennDiagram-L72KCM5P-CfL6LBWw.js → vennDiagram-L72KCM5P-DO1q2KzG.js} +1 -1
- package/web/assets/{view-context-gyDl_p2V.js → view-context-DXKM3-l1.js} +4 -4
- package/web/assets/{viewer-capabilities-Bpp8Uvcg.js → viewer-capabilities-Cig_xM9u.js} +1 -1
- package/web/assets/{wardleyDiagram-EHGQE667-DgldMxaj.js → wardleyDiagram-EHGQE667-Dal9LkuZ.js} +1 -1
- package/web/assets/{xychartDiagram-FW5EYKEG-CIoAIFX8.js → xychartDiagram-FW5EYKEG-B3dPLPII.js} +1 -1
- package/web/index.html +2 -2
- package/kernel/packages/api/test/partial-loading.test.ts +0 -43
- package/kernel/packages/folder-plugin/package.json +0 -50
- package/kernel/packages/folder-plugin/src/index.ts +0 -15
- package/kernel/packages/folder-plugin/tsconfig.json +0 -17
- package/kernel/plugins/calendar/SKILL.md +0 -173
- package/kernel/plugins/calendar/eslint.config.js +0 -10
- package/kernel/plugins/calendar/package.json +0 -73
- package/kernel/plugins/calendar/schema.json +0 -137
- package/kernel/plugins/calendar/src/calendar.tsx +0 -328
- package/kernel/plugins/calendar/src/client.tsx +0 -139
- package/kernel/plugins/calendar/src/context.ts +0 -48
- package/kernel/plugins/calendar/src/copy-button.tsx +0 -66
- package/kernel/plugins/calendar/src/event-dialog.tsx +0 -270
- package/kernel/plugins/calendar/src/index.ts +0 -4
- package/kernel/plugins/calendar/src/manifest.ts +0 -7
- package/kernel/plugins/calendar/src/parse.ts +0 -610
- package/kernel/plugins/calendar/src/server.ts +0 -160
- package/kernel/plugins/calendar/src/utils.ts +0 -80
- package/kernel/plugins/calendar/src/views.tsx +0 -418
- package/kernel/plugins/calendar/test/context.test.mjs +0 -60
- package/kernel/plugins/calendar/test/package.test.mjs +0 -43
- package/kernel/plugins/calendar/test/parse.test.mjs +0 -392
- package/kernel/plugins/calendar/test/server.test.mjs +0 -126
- package/kernel/plugins/calendar/tsconfig.json +0 -17
- package/kernel/plugins/mail/SKILL.md +0 -97
- package/kernel/plugins/mail/eslint.config.js +0 -10
- package/kernel/plugins/mail/src/api.ts +0 -359
- package/kernel/plugins/mail/src/bun-ffi.d.ts +0 -14
- package/kernel/plugins/mail/src/client.tsx +0 -14
- package/kernel/plugins/mail/src/flock.ts +0 -137
- package/kernel/plugins/mail/src/folders.ts +0 -37
- package/kernel/plugins/mail/src/history.ts +0 -485
- package/kernel/plugins/mail/src/index.ts +0 -3
- package/kernel/plugins/mail/src/mail-card.tsx +0 -123
- package/kernel/plugins/mail/src/mail-conversation.tsx +0 -153
- package/kernel/plugins/mail/src/mail-detail-page.tsx +0 -467
- package/kernel/plugins/mail/src/mail-hooks.ts +0 -252
- package/kernel/plugins/mail/src/mail-page.tsx +0 -109
- package/kernel/plugins/mail/src/mail-request.ts +0 -78
- package/kernel/plugins/mail/src/mail-send-box.tsx +0 -175
- package/kernel/plugins/mail/src/mailos.ts +0 -723
- package/kernel/plugins/mail/src/manifest.ts +0 -7
- package/kernel/plugins/mail/src/node.ts +0 -171
- package/kernel/plugins/mail/src/parse.ts +0 -139
- package/kernel/plugins/mail/src/server.ts +0 -125
- package/kernel/plugins/mail/src/types.ts +0 -10
- package/kernel/plugins/mail/src/viewer.tsx +0 -147
- package/kernel/plugins/mail/test/flock.test.mjs +0 -156
- package/kernel/plugins/mail/test/folders.test.mjs +0 -138
- package/kernel/plugins/mail/test/history.test.mjs +0 -460
- package/kernel/plugins/mail/test/mailos.test.mjs +0 -752
- package/kernel/plugins/mail/test/node.test.mjs +0 -207
- package/kernel/plugins/mail/test/package.test.mjs +0 -54
- package/kernel/plugins/mail/test/parse.test.mjs +0 -32
- package/kernel/plugins/mail/test/server.test.mjs +0 -116
- package/kernel/plugins/mail/test/viewer.test.mjs +0 -192
- package/kernel/plugins/mail/tsconfig.json +0 -17
- package/kernel/plugins/projects/SKILL.md +0 -73
- package/kernel/plugins/projects/eslint.config.js +0 -10
- package/kernel/plugins/projects/package.json +0 -70
- package/kernel/plugins/projects/src/client.tsx +0 -17
- package/kernel/plugins/projects/src/data/model.ts +0 -129
- package/kernel/plugins/projects/src/index.ts +0 -17
- package/kernel/plugins/projects/src/manifest.ts +0 -7
- package/kernel/plugins/projects/src/project-context.ts +0 -41
- package/kernel/plugins/projects/src/server.ts +0 -276
- package/kernel/plugins/projects/src/ui/project-card.tsx +0 -61
- package/kernel/plugins/projects/src/ui/projects-page.tsx +0 -102
- package/kernel/plugins/projects/test/package.test.mjs +0 -51
- package/kernel/plugins/tasks/SKILL.md +0 -341
- package/kernel/plugins/tasks/eslint.config.js +0 -10
- package/kernel/plugins/tasks/package.json +0 -74
- package/kernel/plugins/tasks/schema.json +0 -939
- package/kernel/plugins/tasks/src/api.ts +0 -212
- package/kernel/plugins/tasks/src/client.tsx +0 -23
- package/kernel/plugins/tasks/src/data/parse.ts +0 -544
- package/kernel/plugins/tasks/src/data/task-id.ts +0 -56
- package/kernel/plugins/tasks/src/data/todo-model.ts +0 -795
- package/kernel/plugins/tasks/src/index.ts +0 -34
- package/kernel/plugins/tasks/src/manifest.ts +0 -7
- package/kernel/plugins/tasks/src/pages/task-detail.tsx +0 -48
- package/kernel/plugins/tasks/src/pages/task-list.tsx +0 -88
- package/kernel/plugins/tasks/src/server.ts +0 -447
- package/kernel/plugins/tasks/src/styles.css +0 -9
- package/kernel/plugins/tasks/src/ui/compact-todo-list.tsx +0 -372
- package/kernel/plugins/tasks/src/ui/error-details.tsx +0 -78
- package/kernel/plugins/tasks/src/ui/task-page.tsx +0 -392
- package/kernel/plugins/tasks/src/ui/todo-agent-filter.tsx +0 -36
- package/kernel/plugins/tasks/src/ui/todo-filter-bar.tsx +0 -66
- package/kernel/plugins/tasks/src/ui/todo-item.tsx +0 -494
- package/kernel/plugins/tasks/src/ui/todo-status-filter.tsx +0 -60
- package/kernel/plugins/tasks/src/ui/todo-tag-filter.tsx +0 -48
- package/kernel/plugins/tasks/src/ui/todo-warnings.tsx +0 -106
- package/kernel/plugins/tasks/test/api.test.mjs +0 -99
- package/kernel/plugins/tasks/test/folder-sources.test.mjs +0 -46
- package/kernel/plugins/tasks/test/package.test.mjs +0 -54
- package/kernel/plugins/tasks/test/parse.test.mjs +0 -225
- package/kernel/plugins/tasks/test/server.test.mjs +0 -386
- package/kernel/plugins/tasks/tsconfig.json +0 -17
- package/web/assets/app-DoGr2Zi7.js +0 -2
- package/web/assets/channel-uMEjV8qc.js +0 -1
- package/web/assets/classDiagram-OUVF2IWQ-fbZocVor.js +0 -1
- package/web/assets/classDiagram-v2-EOCWNBFH-fbZocVor.js +0 -1
- package/web/assets/client-C6Nxdfif.js +0 -2
- package/web/assets/client-CXYfBko5.js +0 -17
- package/web/assets/client-CoKtOq-X.js +0 -7
- package/web/assets/client-DyRQz5RU.js +0 -53
- package/web/assets/client-OY6HUzuD.js +0 -98
- package/web/assets/client-YOYWZIFi.js +0 -34
- package/web/assets/command-BugZBGXE.js +0 -38
- package/web/assets/folder-plugin-view-DsWR1zmQ.js +0 -6
- package/web/assets/index-BaRnbYRw.js +0 -1
- package/web/assets/index-BexmLxIP.css +0 -1
- package/web/assets/index-DDirZMgx.js +0 -1
- package/web/assets/note-card-DBfX6gW1.js +0 -6
- package/web/assets/select-D8cqNgcp.js +0 -30
- package/web/assets/stateDiagram-v2-6OUMAXLB-BpeGSCu9.js +0 -1
- package/web/assets/swimlanesDiagram-G3AALYLV-D9RjLKb9.js +0 -8
- package/web/assets/use-folder-filter-LQyXns5Q.js +0 -1
- /package/kernel/packages/{folder-plugin → plugins}/eslint.config.js +0 -0
- /package/kernel/packages/{folder-plugin → plugins}/src/client.ts +0 -0
- /package/kernel/packages/{folder-plugin → plugins}/src/endpoint.ts +0 -0
- /package/kernel/packages/{folder-plugin → plugins}/src/server.ts +0 -0
- /package/kernel/packages/{folder-plugin → plugins}/src/subpath.ts +0 -0
- /package/kernel/packages/{folder-plugin → plugins}/src/types.ts +0 -0
- /package/kernel/packages/{folder-plugin → plugins}/src/validation.ts +0 -0
- /package/kernel/packages/{folder-plugin → plugins}/test/contract.test.mjs +0 -0
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import{c as w,j as t}from"./react-B9jn2M18.js";import{l as d,o as A,t as N,e as z}from"./view-context-gyDl_p2V.js";import{C as P}from"./copy-context-C0Uqsp-3.js";import{m as h}from"./tanstack-YzX_Mi37.js";import{a as F}from"./index-CNyy98F8.js";import{a as T,m as L}from"./folder-plugin-view-DsWR1zmQ.js";import{f as q,u as E}from"./use-folder-filter-LQyXns5Q.js";import"./markdown-Bw9RgUGR.js";import"./button-C6arH7zt.js";import"./utils-DCaHk0Gm.js";import"./command-BugZBGXE.js";import"./index-CCXE8zc9.js";import"./index-DDirZMgx.js";import"./popover-DBD7FF-W.js";import"./folder-image-BfGgxo7i.js";import"./viewer-capabilities-Bpp8Uvcg.js";const B=new Set([".avif",".bmp",".gif",".jpeg",".jpg",".pdf",".png",".webp"]),O=new Set([".avif",".bmp",".gif",".jpeg",".jpg",".png",".webp"]);function D(e){const s=e.lastIndexOf(".");return s<0?"":e.slice(s).toLowerCase()}function k(e){const s=e.lastIndexOf("/"),r=s>0?e.slice(0,s):"/",a=e.slice(s+1);return`/api/raw?${new URLSearchParams({path:r,file:a})}`}function Q(e){A(e).catch(s=>N.error(s instanceof Error?s.message:"Could not open the default app."))}function K({path:e}){const[s,r]=w.useState(!1),a=D(e),n=e.slice(e.lastIndexOf("/")+1),i=B.has(a)&&!s,l=O.has(a);return t.jsxs("figure",{className:`m-0 flex w-44 shrink-0 flex-col overflow-hidden rounded-lg
|
|
2
|
-
border border-[#e7ebe7] bg-white shadow-[0_1px_2px_rgb(31_41_55/0.05)]`,children:[t.jsx("a",{"aria-label":`Preview ${n}`,className:"block h-28 bg-[#f3f5f2] transition-colors hover:bg-[#e9ede8]",href:i?k(e):void 0,target:"_blank",rel:"noreferrer",onClick:i?void 0:o=>{o.preventDefault()},children:i?l?t.jsx("img",{alt:`Preview of ${n}`,className:"size-full object-contain",onError:()=>r(!0),src:k(e)}):t.jsx("iframe",{className:"pointer-events-none size-full border-0",src:`${k(e)}#page=1&toolbar=0`,title:`Preview of ${n}`}):t.jsx("span",{className:"flex size-full items-center justify-center",children:t.jsx(d.FileText,{"aria-hidden":"true",className:"size-8 text-[#8a968b]"})})}),t.jsxs("figcaption",{className:`flex min-w-0 items-center gap-2 border-t border-[#e7ebe7]
|
|
3
|
-
px-2 py-1.5`,children:[t.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-[#2f382f]",title:n,children:n}),t.jsx("button",{className:`shrink-0 cursor-pointer rounded-md border border-[#dde1dc]
|
|
4
|
-
bg-white px-2 py-0.5 text-xs text-[#4a554b] hover:bg-[#f3f5f2]`,type:"button",onClick:()=>Q(e),children:"Open"})]})]})}class $ extends Error{status;constructor(s,r){super(r),this.name="MailRequestFailure",this.status=s}}function U(e){try{const s=JSON.parse(e);if(s.error?.message)return s.error.message}catch{}return e.trim()||"Mail request failed."}async function j(e,s={}){const r=new URLSearchParams;for(const[x,c]of Object.entries(s.search??{}))c!==void 0&&r.set(x,c);const a=r.toString(),n=`${e}${a?`?${a}`:""}`,i={};let l;s.body!==void 0&&(i["content-type"]="application/json",l=JSON.stringify(s.body));const o=await fetch(n,{body:l,headers:i,method:s.method??"GET",signal:s.signal}),u=await o.text();if(!o.ok)throw new $(o.status,U(u));if(!o.headers.get("content-type")?.includes("application/json"))throw new $(o.status,"The server returned a non-JSON response.");return JSON.parse(u)}function g(e){return e instanceof $||e instanceof Error?e.message:"Mail request failed."}function C(e){return{path:e??""}}function v(e){return["folder",e?F(e):"none","mail"]}function J(e){return h.useQuery({enabled:!!e,gcTime:5*6e4,queryFn:({signal:s})=>j("/api/mail",{search:C(e),signal:s}),queryKey:[...v(e)],staleTime:15e3})}function G(e,s){return h.useQuery({enabled:!!(e&&s),gcTime:5*6e4,queryFn:({signal:r})=>j("/api/mail/item",{search:{...C(e),id:s??""},signal:r}),queryKey:[...v(e),s??""],retry:!1,staleTime:15e3})}function X(e,s,r){return h.useQuery({enabled:!!(r&&s),gcTime:5*6e4,queryFn:({signal:a})=>j("/api/mail/from",{search:{...C(e),id:s??""},signal:a}),queryKey:[...v(e),s??"","from"],retry:!1,staleTime:15e3})}function V(e,s,r){return h.useQuery({enabled:!!(r&&s),gcTime:5*6e4,queryFn:({signal:a})=>j("/api/mail/conversation",{search:{...C(e),id:s??""},signal:a}),queryKey:[...v(e),s??"","conversation"],retry:!1,staleTime:5*6e4})}function W(e){const s=h.useQueryClient();return h.useMutation({mutationFn:r=>j("/api/mail/action",{body:r,method:"POST"}),onSuccess:()=>{s.invalidateQueries({queryKey:[...v(e)]})}})}function Y(e){const s=h.useQueryClient();return h.useMutation({mutationFn:r=>j("/api/mail/send",{body:{path:e??"",...r},method:"POST"}),onSuccess:()=>{s.invalidateQueries({queryKey:[...v(e)]})}})}function H(e){if(!e.enabled)return{variant:"hidden"};if(e.isPending&&!e.data)return{variant:"loading"};if(e.error&&!e.data)return{variant:"error",message:e.error instanceof Error?e.error.message:"Could not load the conversation."};switch(e.data?.outcome){case"empty":return{variant:"empty"};case"ok":return e.data.items.length?{variant:"ok"}:{variant:"empty"};case"partial":return{variant:"partial",missing:e.data.missing.length};case"not-found":return{variant:"not-found"};case"timeout":return{variant:"timeout"};default:return{variant:"hidden"}}}function S(e,s){return t.jsxs("p",{className:"m-0 flex flex-wrap items-center gap-2 text-sm text-[#6c7a6d]",children:[t.jsx("span",{className:"break-words",children:e}),t.jsxs("button",{type:"button",className:`inline-flex items-center gap-1.5 rounded-md border
|
|
5
|
-
border-[#dde1dc] bg-white px-2.5 py-1 text-[0.82rem] text-[#4a554b]
|
|
6
|
-
hover:bg-[#f3f5f2]`,onClick:s,children:[t.jsx(d.RefreshCw,{className:"size-3.5"}),"Retry"]})]})}function Z({items:e}){return t.jsx("ol",{className:"m-0 grid list-none gap-0 p-0",children:e.map((s,r)=>t.jsxs("li",{className:r===0?"px-4 py-4":"border-t border-[#e7ebe7] px-4 py-4",children:[t.jsxs("div",{className:"mb-2 grid gap-1",children:[t.jsx("p",{className:"m-0 font-semibold break-words text-[#233025]",children:s.subject??"(no subject)"}),t.jsxs("p",{className:"m-0 text-[0.82rem] text-[#6c7a6d]",children:[s.from??"Unknown sender",s.date?` · ${s.date}`:""]})]}),t.jsx("div",{className:"prose prose-neutral max-w-none",children:t.jsx(z,{value:s.body})})]},s.id))})}function I({enabled:e,folder:s,mailId:r}){const a=V(s,r,e),n=H({data:a.data,enabled:e,error:a.error,isPending:a.isPending}),i=()=>{a.refetch()};if(n.variant==="hidden"||n.variant==="empty")return null;if(n.variant==="loading")return t.jsx("p",{className:"m-0 text-sm text-[#6c7a6d]",children:"Loading conversation…"});if(n.variant==="error")return t.jsxs("p",{className:"m-0 flex flex-wrap items-center gap-2 text-sm text-[#9c3a3a]",children:[t.jsxs("span",{className:"break-words",children:["Could not load the conversation. ",g(a.error)]}),t.jsx(ee,{onRetry:i})]});const l=a.data?.items??[];return t.jsxs("section",{className:`overflow-hidden rounded-xl border border-[#e7ebe7] bg-white
|
|
7
|
-
shadow-[0_1px_2px_rgb(31_41_55/0.05)]`,children:[t.jsx("header",{className:"border-b border-[#e7ebe7] bg-[#fbfcfb] px-4 py-3",children:t.jsx("h2",{className:`m-0 text-[0.75rem] font-medium tracking-wide text-[#6c7a6d]
|
|
8
|
-
uppercase`,children:"Previous conversation"})}),l.length?t.jsx(Z,{items:l}):null,t.jsxs("footer",{className:"border-t border-[#e7ebe7] bg-[#fbfcfb] px-4 py-3",children:[n.variant==="partial"?S(`Some earlier messages could not be loaded (${n.missing}).`,i):null,n.variant==="not-found"?S("Earlier messages could not be found.",i):null,n.variant==="timeout"?S("Loading earlier messages timed out.",i):null,n.variant==="ok"&&l.length?t.jsx("p",{className:"m-0 text-[0.82rem] text-[#6c7a6d]",children:"Thread loaded from references."}):null]})]})}function ee({onRetry:e}){return t.jsxs("button",{type:"button",className:`inline-flex items-center gap-1.5 rounded-md border
|
|
9
|
-
border-[#dde1dc] bg-white px-2.5 py-1 text-[0.82rem] text-[#4a554b]
|
|
10
|
-
hover:bg-[#f3f5f2]`,onClick:e,children:[t.jsx(d.RefreshCw,{className:"size-3.5"}),"Retry"]})}function te({folder:e,mailId:s,status:r}){const[a,n]=w.useState("idle"),[i,l]=w.useState(null),[o,u]=w.useState(null),x=Y(e);w.useEffect(()=>{n("idle"),l(null),u(null)},[s]);const c=x.isPending||a==="previewing"||a==="sending";async function y(){if(!(!s||c)){u(null),n("previewing");try{const f=await x.mutateAsync({dryRun:!0,id:s});if(!("revision"in f))throw new Error("MailOS did not return a revision.");l(f),n("confirm")}catch(f){u(g(f)),n("failed")}}}async function m(){if(!(!s||!i||c)){u(null),n("sending");try{await x.mutateAsync({dryRun:!1,id:s,revision:i.revision}),n("sent")}catch(f){u(g(f)),n("failed")}}}return t.jsxs("div",{className:`rounded-xl border border-[#e7ebe7] bg-white px-4 py-3
|
|
11
|
-
shadow-[0_1px_2px_rgb(31_41_55/0.05)]`,children:[a==="idle"?t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs("button",{type:"button",className:`inline-flex w-fit items-center gap-2 rounded-md
|
|
12
|
-
bg-[#395641] px-3 py-1.5 text-sm text-white hover:bg-[#2f4b38]
|
|
13
|
-
disabled:pointer-events-none disabled:opacity-50`,onClick:()=>{y()},disabled:r==="sent"||c,children:[t.jsx(d.Send,{className:"size-4"}),r==="sent"?"Already sent":"Send"]}),t.jsx("span",{className:"text-[0.82rem] text-[#6c7a6d]",children:"Will preview for confirmation before delivering."})]}):null,a==="previewing"||a==="sending"?t.jsxs("p",{className:"m-0 flex items-center gap-2 text-sm text-[#4a554b]",children:[t.jsx(d.Loader2,{className:"size-4 animate-spin"}),a==="previewing"?"Previewing…":"Sending…"]}):null,a==="confirm"&&i?t.jsxs("div",{className:"grid gap-3",children:[t.jsx("p",{className:"m-0 text-sm text-[#4a554b]",children:"Ready to send this draft to its recipients."}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("button",{type:"button",className:`inline-flex w-fit items-center gap-2 rounded-md
|
|
14
|
-
bg-[#395641] px-3 py-1.5 text-sm text-white hover:bg-[#2f4b38]
|
|
15
|
-
disabled:pointer-events-none disabled:opacity-50`,onClick:()=>{m()},disabled:c,children:[t.jsx(d.Send,{className:"size-4"}),"Send now"]}),t.jsx("button",{type:"button",className:`w-fit rounded-md border border-[#dde1dc] bg-white px-3
|
|
16
|
-
py-1.5 text-sm text-[#4a554b] hover:bg-[#f3f5f2]
|
|
17
|
-
disabled:pointer-events-none disabled:opacity-50`,onClick:()=>{n("idle"),l(null)},disabled:c,children:"Cancel"})]}),t.jsxs("details",{className:"text-[0.82rem] text-[#6c7a6d]",children:[t.jsx("summary",{className:"cursor-pointer",children:"Preview output"}),t.jsx("pre",{className:`mt-2 max-h-48 overflow-auto rounded-md bg-[#f3f5f2] p-2
|
|
18
|
-
text-[0.75rem] whitespace-pre-wrap text-[#4a554b]`,children:i.output})]})]}):null,a==="sent"?t.jsxs("p",{className:"m-0 flex items-center gap-2 text-sm text-[#2f5b3a]",children:[t.jsx(d.CheckCircle2,{className:"size-4"}),"Sent."]}):null,a==="failed"?t.jsxs("div",{className:"grid gap-3",children:[t.jsxs("p",{className:"m-0 flex items-center gap-2 text-sm text-[#9c3a3a]",children:[t.jsx(d.XCircle,{className:"size-4 shrink-0"}),t.jsx("span",{className:"break-words",children:o})]}),t.jsxs("button",{type:"button",className:`inline-flex w-fit items-center gap-2 rounded-md border
|
|
19
|
-
border-[#dde1dc] bg-white px-3 py-1.5 text-sm text-[#4a554b]
|
|
20
|
-
hover:bg-[#f3f5f2]`,onClick:()=>{y()},children:[t.jsx(d.Send,{className:"size-4"}),"Try again"]})]}):null]})}function se(e){if(!e)return"—";const s=Date.parse(e);if(Number.isNaN(s))return e;const r=Date.now()-s,a=Math.round(r/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const n=Math.round(a/60);return n<48?`${n}h ago`:`${Math.round(n/24)}d ago`}function ne({actions:e,folderLabel:s,href:r,item:a}){const n=a.to.length?{label:"To",items:a.to}:a.cc.length?{label:"CC",items:a.cc}:a.bcc.length?{label:"BCC",items:a.bcc}:null,i=a.to[0]??"",l=/<([^<>]+)>/.exec(i)?.[1]??i,o=/^[^\s@<>]+@([a-z0-9.-]+\.[a-z]{2,})$/i.exec(l.trim())?.[1]?.toLowerCase();return t.jsxs("li",{className:"relative min-w-0",children:[t.jsxs("a",{className:`grid grid-cols-[2rem_minmax(0,1fr)] items-start gap-3
|
|
21
|
-
rounded-xl border border-[#e7ebe7] bg-white px-3.5 py-2.5 pr-10
|
|
22
|
-
text-[#2f382f] no-underline shadow-[0_1px_2px_rgb(31_41_55/0.05)]
|
|
23
|
-
hover:bg-[#fafbfa] focus-visible:outline-2
|
|
24
|
-
focus-visible:outline-offset-1 focus-visible:outline-[#56725e]`,href:r,children:[t.jsxs("span",{"aria-hidden":"true",className:`relative flex size-8 items-center justify-center rounded-md
|
|
25
|
-
bg-[#f3f5f2] text-[#6c7a6d]`,children:[t.jsx(d.Mail,{className:"size-4"}),o?t.jsx("img",{alt:"",className:"absolute size-6 rounded-sm bg-[#f3f5f2] object-contain",height:24,loading:"lazy",onError:u=>{u.currentTarget.style.display="none"},referrerPolicy:"no-referrer",src:`https://www.google.com/s2/favicons?domain=${encodeURIComponent(o)}&sz=32`,width:24},o):null]}),t.jsxs("div",{className:"grid min-w-0 gap-1",children:[t.jsx("span",{className:"line-clamp-2 min-w-0 font-semibold break-words",children:a.subject??"(no subject)"}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("span",{className:`shrink-0 text-[0.75rem] whitespace-nowrap
|
|
26
|
-
text-[#6c7a6d]`,children:se(a.updatedAt??a.createdAt)}),n?t.jsxs("span",{className:"min-w-0 truncate text-[0.82rem] text-[#4a554b]",children:[n.label,": ",n.items[0],n.items.length>1?` +${n.items.length-1}`:""]}):t.jsx("span",{className:"text-[0.82rem] text-[#6c7a6d]",children:"No recipients"})]}),s?t.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs text-[#6c7a6d]",title:a.folder??void 0,children:[t.jsx(d.Folder,{"aria-hidden":"true",className:"size-3 shrink-0"}),t.jsx("span",{className:"truncate",children:s})]}):null,a.excerpt?t.jsx("p",{className:"m-0 min-w-0 truncate text-[0.82rem] text-[#6c7a6d]",children:a.excerpt}):null]})]}),e?t.jsx("div",{className:"absolute top-2 right-2",children:e(a)}):null]})}const _=(e,s)=>["You are helping with an email draft. Use the context below to understand the message and what it needs next.","","Instructions for the LLM:","- Treat the subject as the draft's objective.","- Use recipients, tags and body (or the owning draft file) as the authoritative message context.","- If information is missing, state the exact missing input or recipient needed.","- Return: 1) current status, 2) what the message needs next, 3) suggested edits or reply if asked.","","Mail context:",`- Subject: ${e.subject??"(no subject)"}`,e.from?`- From: ${e.from}`:null,e.to?.length?`- To: ${e.to.join(", ")}`:null,e.cc?.length?`- Cc: ${e.cc.join(", ")}`:null,e.bcc?.length?`- Bcc: ${e.bcc.join(", ")}`:null,e.attachments?.length?`- Attachments: ${e.attachments.join(", ")}`:null,`- Status: ${e.status??"unknown"}`,e.folder?`- Folder: ${e.folder}`:null,e.tags?.length?`- Tags: ${e.tags.map(r=>`#${r}`).join(" ")}`:null,`- Draft file: ${e.filePath}`,s?"":null,s?"Draft body:":null,s??null,!s&&e.excerpt?"":null,!s&&e.excerpt?"Draft excerpt:":null,!s&&e.excerpt?e.excerpt:null].filter(r=>r!=null).join(`
|
|
27
|
-
`);function ae({choices:e,onSelect:s,selected:r,total:a}){return t.jsx(T,{allLabel:"All folders",ariaLabel:"Filter drafts by folder",choices:e,onSelect:s,selected:r,total:a})}function re({actions:e,folderLabel:s,mailHref:r,items:a}){return t.jsx("ol",{className:"m-0 grid list-none grid-cols-1 gap-2 p-0",children:a.map(n=>t.jsx(ne,{actions:e,folderLabel:s?.(n.folder),href:r(n.id),item:n},n.id))})}function ie(e){if(!e)return"—";const s=Date.parse(e);return Number.isNaN(s)?e:new Date(s).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function b({label:e,value:s}){return t.jsxs("div",{className:"grid grid-cols-[88px_1fr] items-start gap-x-3 gap-y-1",children:[t.jsx("span",{className:`pt-0.5 text-[0.75rem] font-medium tracking-wide
|
|
28
|
-
text-[#6c7a6d] uppercase`,children:e}),t.jsx("span",{className:"min-w-0 text-sm break-words",children:s})]})}function M({items:e,max:s}){if(!e.length)return t.jsx("span",{className:"text-[#6c7a6d]",children:"—"});const r=s?e.slice(0,s):e,a=s&&e.length>s?e.length-s:0,n="rounded-md bg-[#f3f5f2] px-2 py-1 text-[0.85rem] text-[#2f382f]";return t.jsxs("span",{className:"flex min-w-0 flex-wrap gap-1",children:[r.map(i=>t.jsx("span",{className:n,title:i,children:t.jsx("span",{className:"break-all",children:i})},i)),a?t.jsxs("span",{className:n,title:`${a} more recipients`,children:["+",a]}):null]})}function le({paths:e,pending:s,onRemove:r}){return t.jsx("span",{className:"flex min-w-0 flex-wrap gap-2",children:e.map(a=>{const n=a.slice(a.lastIndexOf("/")+1);return t.jsxs("span",{className:"relative",children:[t.jsx(K,{path:a}),r?t.jsx("button",{type:"button","aria-label":`Remove ${n} from this draft`,title:`Remove ${n} from this draft}`,className:`absolute top-1.5 right-1.5 z-10 flex size-6
|
|
29
|
-
cursor-pointer items-center justify-center rounded-full border
|
|
30
|
-
border-[#e5c4c4] bg-white text-[#9c3a3a] shadow-xs
|
|
31
|
-
hover:bg-[#fbf3f3] disabled:pointer-events-none
|
|
32
|
-
disabled:opacity-50`,onClick:()=>r(a),disabled:s,children:t.jsx(d.X,{className:"size-3.5"})}):null]},a)})})}function oe({mail:e,error:s,preview:r,refreshing:a,onRefresh:n,onArchive:i,onDelete:l,actionPending:o,onOpenPath:u,onRemoveAttachment:x}){return t.jsxs("div",{className:"grid min-w-0 grid-cols-1 gap-4",children:[t.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"m-0 text-2xl font-semibold break-words text-[#233025]",children:e.subject??"(no subject)"}),t.jsxs("p",{className:"m-0 mt-1 text-sm text-[#6c7a6d]",children:["Updated:"," ",e.updatedAt??e.createdAt?t.jsx("time",{dateTime:e.updatedAt??e.createdAt??void 0,title:e.updatedAt??e.createdAt??void 0,children:ie(e.updatedAt??e.createdAt)}):"—"]})]}),t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[t.jsx(P,{className:`border bg-white text-[#4a554b] shadow-xs
|
|
33
|
-
hover:bg-[#f3f5f2]`,context:()=>_(e,r?.body??e.body),label:`Copy full context for ${e.subject??"this draft"}`,size:"sm",variant:"ghost"}),t.jsx(P,{className:`border bg-white text-[#4a554b] shadow-xs
|
|
34
|
-
hover:bg-[#f3f5f2]`,context:e.filePath,label:"Copy draft path",size:"sm",variant:"ghost"}),t.jsxs("button",{type:"button",className:`inline-flex items-center gap-2 rounded-md border px-3
|
|
35
|
-
py-1.5 text-sm`,onClick:n,disabled:a,children:[t.jsx(d.RefreshCw,{className:a?"size-4 animate-spin":"size-4"}),"Refresh"]}),u?t.jsxs("button",{type:"button",className:`inline-flex cursor-pointer items-center gap-2
|
|
36
|
-
rounded-md border px-3 py-1.5 text-sm`,onClick:()=>{u(e.filePath)},children:[t.jsx(d.ExternalLink,{className:"size-4"}),"Open"]}):null,i&&e.status!=="sent"?t.jsxs("button",{type:"button",className:`inline-flex items-center gap-2 rounded-md border px-3
|
|
37
|
-
py-1.5 text-sm disabled:pointer-events-none disabled:opacity-50`,onClick:i,disabled:o,children:[t.jsx(d.Archive,{className:"size-4"}),"Archive"]}):null,l?t.jsxs("button",{type:"button",className:`inline-flex items-center gap-2 rounded-md border
|
|
38
|
-
border-[#e5c4c4] px-3 py-1.5 text-sm text-[#9c3a3a]
|
|
39
|
-
hover:bg-[#fbf3f3] disabled:pointer-events-none
|
|
40
|
-
disabled:opacity-50`,onClick:l,disabled:o,children:[t.jsx(d.Trash2,{className:"size-4"}),"Delete"]}):null]})]}),t.jsxs("div",{className:`grid grid-cols-1 gap-3 rounded-xl border border-[#e7ebe7]
|
|
41
|
-
bg-white px-4 py-4 shadow-[0_1px_2px_rgb(31_41_55/0.05)]`,children:[e.from?t.jsx(b,{label:"From",value:e.from}):null,e.subject?t.jsx(b,{label:"Subject",value:e.subject}):null,t.jsx(b,{label:"To",value:t.jsx(M,{items:e.to})}),t.jsx(b,{label:"CC",value:t.jsx(M,{items:e.cc})}),t.jsx(b,{label:"BCC",value:t.jsx(M,{items:e.bcc})}),e.noSignature?t.jsx(b,{label:"Signature",value:"none"}):null,e.attachments.length?t.jsx(b,{label:"Attachments",value:t.jsx(le,{paths:e.attachments,pending:o,onRemove:x})}):null]}),s?t.jsx("p",{className:"m-0 text-sm text-[#9c3a3a]",children:s}):null,r?t.jsx("article",{className:`overflow-hidden rounded-xl border border-[#e7ebe7] bg-white
|
|
42
|
-
shadow-[0_1px_2px_rgb(31_41_55/0.05)]`,children:t.jsx("section",{className:"px-4 py-4",children:!r.body.trim()&&!r.signature?t.jsx("p",{className:"m-0 text-sm text-[#6c7a6d]",children:"(empty body)"}):t.jsx("div",{className:"prose prose-neutral max-w-none",children:t.jsx(z,{value:[r.body,r.signature].filter(Boolean).join(`
|
|
43
|
-
|
|
44
|
-
`)})})})}):null]})}function ce({folder:e,subpath:s,listHref:r,hostActions:a}){const n=G(e,s),i=W(e);async function l(){if(m)try{await i.mutateAsync({action:"archive",id:s,path:e??"",revision:m.revision}),n.refetch()}catch(p){N.error(g(p))}}async function o(p){if(m&&window.confirm(`Remove "${p}" from this draft? The file is kept on disk.`))try{await i.mutateAsync({action:"remove-attachment",id:s,path:e??"",revision:m.revision,attachment:p}),n.refetch()}catch(R){N.error(g(R))}}async function u(){if(m&&window.confirm("Delete this draft? It will be moved to draft history first."))try{await i.mutateAsync({action:"delete",id:s,path:e??"",revision:m.revision}),window.location.assign(r)}catch(p){N.error(g(p))}}const x=!!(n.data?.mail&&!n.data.mail.from),c=X(e,s,x),y=n.data?.mail?.from??(c.data?.name&&c.data?.from?`${c.data.name} <${c.data.from}>`:c.data?.from??null),m=n.data?.mail?{...n.data.mail,from:y}:void 0,f=!!(n.data?.mail&&(n.data.mail.inReplyTo??n.data.mail.references.length>0));return!e||!s?t.jsxs("div",{className:`mx-auto grid w-full max-w-3xl min-w-0 grid-cols-1 gap-4 px-4
|
|
45
|
-
py-5`,children:[t.jsx("p",{className:"m-0 text-sm text-[#6c7a6d]",children:"Select a mail from the list."}),t.jsx("a",{className:`w-fit cursor-pointer rounded-md border border-[#dde1dc]
|
|
46
|
-
bg-white px-3 py-1.5 text-[0.85rem] text-[#4a554b]
|
|
47
|
-
hover:bg-[#f3f5f2]`,href:r,children:"Back"})]}):t.jsxs("div",{className:`mx-auto grid w-full max-w-3xl min-w-0 grid-cols-1 gap-4 px-4
|
|
48
|
-
py-5`,children:[t.jsxs("a",{className:`inline-flex w-fit items-center gap-2 rounded-md border
|
|
49
|
-
border-[#dde1dc] bg-white px-3 py-1.5 text-sm text-[#4a554b]
|
|
50
|
-
no-underline hover:bg-[#f3f5f2]`,href:r,children:[t.jsx(d.ArrowLeft,{className:"size-4"}),"Back to Mail"]}),n.isPending?t.jsx("p",{className:"m-0 text-sm text-[#6c7a6d]",children:"Loading…"}):null,n.error&&!n.data?.mail?t.jsx("p",{className:"m-0 text-sm text-[#9c3a3a]",children:"Could not load mail preview."}):null,m?t.jsx(oe,{mail:m,preview:n.error?void 0:n.data?.preview,error:n.error?"Could not load mail preview.":n.data?.preview?void 0:"Could not load mail preview.",refreshing:n.isFetching,onRefresh:()=>{n.refetch()},onArchive:m.status==="sent"?void 0:()=>{l()},onDelete:()=>{u()},actionPending:i.isPending,onOpenPath:a?.openPath,onRemoveAttachment:p=>{o(p)}}):null,t.jsx(I,{enabled:f,folder:e,mailId:s}),m?t.jsx(te,{folder:e,mailId:s,status:m.status}):null,!n.isPending&&!n.error&&!n.data?.mail?t.jsx("p",{className:"m-0 text-sm text-[#6c7a6d]",children:"Mail not found."}):null]})}function de(e,s){return q(e,s)}function ue({folder:e,href:s}){const r=J(e),a=r.data?.items??[],n=!!r.data?.items.length,{choices:i,effectiveSelected:l,setSelected:o,total:u,visibleItems:x}=E(a,{getFolder:c=>c.folder,rootFolder:e??""});return e?t.jsxs("div",{className:`mx-auto grid w-full max-w-3xl min-w-0 grid-cols-1 gap-4 px-4
|
|
51
|
-
py-5`,children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("h1",{className:"m-0 text-2xl font-semibold text-[#233025]",children:"Mail"}),t.jsxs("button",{type:"button",className:`inline-flex items-center gap-2 rounded-md border px-3
|
|
52
|
-
py-1.5 text-sm disabled:pointer-events-none disabled:opacity-50`,onClick:()=>{r.refetch()},disabled:r.isFetching,children:[t.jsx(d.RefreshCw,{className:r.isFetching?"size-4 animate-spin":"size-4"}),"Refresh"]})]}),n?t.jsx(ae,{choices:i,onSelect:o,selected:l,total:u}):null,r.isPending?t.jsx("p",{className:"m-0 text-sm text-[#6c7a6d]",children:"Loading…"}):null,r.error?t.jsx("p",{className:"m-0 text-sm text-[#9c3a3a]",children:g(r.error)}):null,!r.isPending&&!r.error&&!r.data?.items.length?t.jsx("p",{className:"m-0 text-sm text-[#6c7a6d]",children:"No mail found."}):null,n?x.length?t.jsx(re,{actions:c=>t.jsx(P,{className:"text-[#6c7a6d] hover:text-[#2f382f]",context:()=>_(c),label:`Copy context for ${c.subject??"this draft"}`}),folderLabel:c=>de(c,e),items:x,mailHref:s}):t.jsx("p",{className:"m-0 text-sm text-[#6c7a6d]",children:"No drafts in this folder."}):null]}):t.jsx("div",{className:`mx-auto grid w-full max-w-3xl min-w-0 grid-cols-1 gap-4 px-4
|
|
53
|
-
py-5`,children:t.jsx("p",{className:"m-0 text-sm text-[#6c7a6d]",children:"Open mail from a folder."})})}function me(e){return e.subpath?t.jsx(ce,{...e}):t.jsx(ue,{...e})}const $e={...L,component:me};export{me as MailPlugin,$e as mailClient};
|