@meetquinn/animactl 0.1.30 → 0.1.31

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 (116) hide show
  1. package/dist/server/cli/cli-errors.js +4 -0
  2. package/dist/server/messages/contact-policy.service.d.ts +9 -0
  3. package/dist/server/messages/contact-policy.service.d.ts.map +1 -1
  4. package/dist/server/messages/contact-policy.service.js +44 -16
  5. package/dist/server/tests/contact-policy.test.js +45 -4
  6. package/dist/web/assets/{FileViewer-2hthjdQD.js → FileViewer-BtzV0xCy.js} +3 -3
  7. package/dist/web/assets/{OwnerPickerForm-BOG15_5q.js → OwnerPickerForm-Dad51XVK.js} +1 -1
  8. package/dist/web/assets/{SlackTimeline-DJMHtjVN.js → SlackTimeline-CEQmQliZ.js} +1 -1
  9. package/dist/web/assets/{UsageHeatmap-DIM_N0fI.js → UsageHeatmap-BW-EDtlf.js} +1 -1
  10. package/dist/web/assets/{activity-CF_uXyqx.js → activity-DxOg0Zpw.js} +1 -1
  11. package/dist/web/assets/{arc-DN3rV-nI.js → arc-fS3jqr6M.js} +1 -1
  12. package/dist/web/assets/architecture-7EHR7CIX-JFavxCHZ.js +1 -0
  13. package/dist/web/assets/{architectureDiagram-3BPJPVTR-BjOQPVOb.js → architectureDiagram-3BPJPVTR-CDsOHh13.js} +1 -1
  14. package/dist/web/assets/arrow-right-rNbgcgPM.js +1 -0
  15. package/dist/web/assets/{blockDiagram-GPEHLZMM-CxnJJyNZ.js → blockDiagram-GPEHLZMM-Dafvh8yC.js} +1 -1
  16. package/dist/web/assets/{c4Diagram-AAUBKEIU-MJtkpqPP.js → c4Diagram-AAUBKEIU-BqFnkKWL.js} +1 -1
  17. package/dist/web/assets/channel-CM3nHrAD.js +1 -0
  18. package/dist/web/assets/{channels-DAmTOZbW.js → channels-CFYn9Uzy.js} +1 -1
  19. package/dist/web/assets/{chunk-2J33WTMH-DH7F6Toz.js → chunk-2J33WTMH-BEmf3Qku.js} +1 -1
  20. package/dist/web/assets/{chunk-3OPIFGDE-SXmEESKD.js → chunk-3OPIFGDE-CtmMZbUU.js} +1 -1
  21. package/dist/web/assets/{chunk-4BX2VUAB-DB0OPa2S.js → chunk-4BX2VUAB-CacBYgOE.js} +1 -1
  22. package/dist/web/assets/{chunk-55IACEB6-DGr-WOhv.js → chunk-55IACEB6-BXURqjLZ.js} +1 -1
  23. package/dist/web/assets/{chunk-5ZQYHXKU-Vgr4jBt1.js → chunk-5ZQYHXKU-D_5qZ4Zv.js} +1 -1
  24. package/dist/web/assets/{chunk-727SXJPM-CWaX9Qk5.js → chunk-727SXJPM-BU31EEG5.js} +1 -1
  25. package/dist/web/assets/{chunk-AQP2D5EJ-CFTKUNkn.js → chunk-AQP2D5EJ-DTtKK5xv.js} +1 -1
  26. package/dist/web/assets/{chunk-BSJP7CBP-DD2WqzXl.js → chunk-BSJP7CBP-C5nluir4.js} +1 -1
  27. package/dist/web/assets/{chunk-CSCIHK7Q-xxNdF5BX.js → chunk-CSCIHK7Q-BeNiRoDm.js} +3 -3
  28. package/dist/web/assets/{chunk-FMBD7UC4-D637Lg0-.js → chunk-FMBD7UC4-LV5XAtCz.js} +1 -1
  29. package/dist/web/assets/{chunk-KSCS5N6A-B9pu9Zdk.js → chunk-KSCS5N6A-D80hU7za.js} +1 -1
  30. package/dist/web/assets/{chunk-L5ZTLDWV-DYHe5z-p.js → chunk-L5ZTLDWV-DtSiy2JS.js} +1 -1
  31. package/dist/web/assets/{chunk-LZXEDZCA-C2A3MD3P.js → chunk-LZXEDZCA-CFWlwpSj.js} +2 -2
  32. package/dist/web/assets/{chunk-ND2GUHAM-CzVnJeg1.js → chunk-ND2GUHAM-Cks69kWo.js} +1 -1
  33. package/dist/web/assets/{chunk-NZK2D7GU-Bi3zqbUv.js → chunk-NZK2D7GU-BKDBTHUK.js} +1 -1
  34. package/dist/web/assets/{chunk-O5CBEL6O-B7YJjftf.js → chunk-O5CBEL6O-Dh_KkhDf.js} +1 -1
  35. package/dist/web/assets/chunk-QZHKN3VN-CXmYofd4.js +1 -0
  36. package/dist/web/assets/chunk-WU5MYG2G-BAvj0V8I.js +1 -0
  37. package/dist/web/assets/{chunk-XPW4576I-BRwQ5uRX.js → chunk-XPW4576I-BaeieIoE.js} +1 -1
  38. package/dist/web/assets/classDiagram-4FO5ZUOK-CqWCXo7M.js +1 -0
  39. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CqWCXo7M.js +1 -0
  40. package/dist/web/assets/{copy-CrJlq9AF.js → copy-DI3PIiTH.js} +1 -1
  41. package/dist/web/assets/{cose-bilkent-S5V4N54A-T1Va7b5W.js → cose-bilkent-S5V4N54A-Illz9lmk.js} +1 -1
  42. package/dist/web/assets/{dagre-BM42HDAG-BP0-K47r.js → dagre-BM42HDAG-uzpuT_vy.js} +1 -1
  43. package/dist/web/assets/{diagram-2AECGRRQ-CezL6GWB.js → diagram-2AECGRRQ-BCPKQqtp.js} +1 -1
  44. package/dist/web/assets/{diagram-5GNKFQAL-DAToGWTN.js → diagram-5GNKFQAL-ComD16wh.js} +1 -1
  45. package/dist/web/assets/{diagram-KO2AKTUF-CkbuKqVt.js → diagram-KO2AKTUF-BzSas2Wg.js} +1 -1
  46. package/dist/web/assets/{diagram-LMA3HP47-Ccw5LzTI.js → diagram-LMA3HP47-Di6iEw3F.js} +1 -1
  47. package/dist/web/assets/{diagram-OG6HWLK6-DM8PEKD_.js → diagram-OG6HWLK6-BiJvsy5z.js} +1 -1
  48. package/dist/web/assets/{dist-CwHmnwO6.js → dist-BVWlbvC4.js} +1 -1
  49. package/dist/web/assets/{erDiagram-TEJ5UH35-DtZHusNf.js → erDiagram-TEJ5UH35-2dFfOUHh.js} +1 -1
  50. package/dist/web/assets/eventmodeling-FCH6USID-BHZ_hWV_.js +1 -0
  51. package/dist/web/assets/{files-BySZvVoJ.js → files-fW_iAV7E.js} +1 -1
  52. package/dist/web/assets/{flowDiagram-I6XJVG4X-BtiRpY_v.js → flowDiagram-I6XJVG4X-DENcgZKO.js} +1 -1
  53. package/dist/web/assets/{ganttDiagram-6RSMTGT7-CvsbKTJa.js → ganttDiagram-6RSMTGT7-CGsf5ccc.js} +1 -1
  54. package/dist/web/assets/gitGraph-WXDBUCRP-DhWA66Cy.js +1 -0
  55. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-D2UEiEmu.js → gitGraphDiagram-PVQCEYII-BQIgIegs.js} +1 -1
  56. package/dist/web/assets/{index-CbAhFc-0.js → index-DlHETnHC.js} +2 -2
  57. package/dist/web/assets/info-J43DQDTF-CEcqsbJ5.js +1 -0
  58. package/dist/web/assets/{infoDiagram-5YYISTIA-C1JIXj0K.js → infoDiagram-5YYISTIA-MrkM0y-m.js} +1 -1
  59. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-CrV-BAK2.js → ishikawaDiagram-YF4QCWOH-Dr8UsvPX.js} +1 -1
  60. package/dist/web/assets/{journeyDiagram-JHISSGLW-C5UZDjPg.js → journeyDiagram-JHISSGLW-DGypTGb1.js} +1 -1
  61. package/dist/web/assets/{kanban-definition-UN3LZRKU-CmAcW_Gm.js → kanban-definition-UN3LZRKU-yYXyv91m.js} +1 -1
  62. package/dist/web/assets/{kb-CrNRBaRa.js → kb-f003GncV.js} +1 -1
  63. package/dist/web/assets/{lightbulb-BZTBGg7G.js → lightbulb-17VUUl6S.js} +1 -1
  64. package/dist/web/assets/{line-BeG27-zH.js → line-CX3cghIS.js} +1 -1
  65. package/dist/web/assets/{linear-D6Qub4j1.js → linear-87q8d4nG.js} +1 -1
  66. package/dist/web/assets/{login-DF6d0xuk.js → login-DptYMeSz.js} +1 -1
  67. package/dist/web/assets/{mermaid-parser.core-OQrfCf7Q.js → mermaid-parser.core-DZTDfv4-.js} +2 -2
  68. package/dist/web/assets/{mermaid.core-DnM6i6kF.js → mermaid.core-BhLaljEz.js} +3 -3
  69. package/dist/web/assets/{mindmap-definition-RKZ34NQL-C90Pg8IG.js → mindmap-definition-RKZ34NQL-Cgrh68Ws.js} +1 -1
  70. package/dist/web/assets/{onboarding-Ds4m8CzL.js → onboarding-CGAqAgFX.js} +1 -1
  71. package/dist/web/assets/packet-YPE3B663-BmMYdqRg.js +1 -0
  72. package/dist/web/assets/pie-LRSECV5Y-1wIF2xtw.js +1 -0
  73. package/dist/web/assets/{pieDiagram-4H26LBE5-DMHbg7t6.js → pieDiagram-4H26LBE5-CsIniA7U.js} +1 -1
  74. package/dist/web/assets/{profile-D8xJTQW-.js → profile-BCiWQjvh.js} +1 -1
  75. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-CdlyTllG.js → quadrantDiagram-W4KKPZXB-ppRpf4TS.js} +1 -1
  76. package/dist/web/assets/radar-GUYGQ44K-p1z2JqZu.js +1 -0
  77. package/dist/web/assets/{reminders-Cls3R6H7.js → reminders-CYmvRDWq.js} +1 -1
  78. package/dist/web/assets/{requirementDiagram-4Y6WPE33-CJJ8Lrck.js → requirementDiagram-4Y6WPE33-lnX3NUSy.js} +1 -1
  79. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-BGraj5n6.js → sankeyDiagram-5OEKKPKP-DGuhoGFR.js} +1 -1
  80. package/dist/web/assets/search-BB_1c6y5.js +1 -0
  81. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-B8g-XwoX.js → sequenceDiagram-3UESZ5HK-C-LlJv8b.js} +1 -1
  82. package/dist/web/assets/{settings-9rtkfxfO.js → settings-BfsiJmaF.js} +1 -1
  83. package/dist/web/assets/{src-DOSXYjwH.js → src-B2YqOS_g.js} +1 -1
  84. package/dist/web/assets/{stateDiagram-AJRCARHV-tzHGG25a.js → stateDiagram-AJRCARHV-m_XE9xkX.js} +1 -1
  85. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-eKkkGk4l.js +1 -0
  86. package/dist/web/assets/{timeline-definition-PNZ67QCA-Bm5F6kuI.js → timeline-definition-PNZ67QCA-BD126VRM.js} +1 -1
  87. package/dist/web/assets/treeView-BLDUP644-Bt9NKcs-.js +1 -0
  88. package/dist/web/assets/treemap-LRROVOQU-Bw9RdNCX.js +1 -0
  89. package/dist/web/assets/{useInfiniteQuery-D4aujXNJ.js → useInfiniteQuery-BYCmT0Iw.js} +1 -1
  90. package/dist/web/assets/{useNow-BwVNU1Kt.js → useNow-BbEkaqh-.js} +1 -1
  91. package/dist/web/assets/{vennDiagram-CIIHVFJN-CD9fmg50.js → vennDiagram-CIIHVFJN-DLM0FNBN.js} +1 -1
  92. package/dist/web/assets/wardley-L42UT6IY-DpsUZBpc.js +1 -0
  93. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-CKu3d4sB.js → wardleyDiagram-YWT4CUSO-DQgt20IC.js} +1 -1
  94. package/dist/web/assets/{xychartDiagram-2RQKCTM6-CRRLjHSX.js → xychartDiagram-2RQKCTM6-CUCAmkCj.js} +1 -1
  95. package/dist/web/index.html +1 -1
  96. package/docs/agent/guide.md +1 -2
  97. package/docs/guide/working-with-your-agent.md +1 -1
  98. package/package.json +1 -1
  99. package/dist/web/assets/architecture-7EHR7CIX-DU_giWjw.js +0 -1
  100. package/dist/web/assets/arrow-right-Da05Wwlp.js +0 -1
  101. package/dist/web/assets/channel-BfxUxG5f.js +0 -1
  102. package/dist/web/assets/chunk-QZHKN3VN-NhFAU-9O.js +0 -1
  103. package/dist/web/assets/chunk-WU5MYG2G-CZXAqd3y.js +0 -1
  104. package/dist/web/assets/classDiagram-4FO5ZUOK-Dy777uwp.js +0 -1
  105. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-Dy777uwp.js +0 -1
  106. package/dist/web/assets/eventmodeling-FCH6USID-CDO-goTv.js +0 -1
  107. package/dist/web/assets/gitGraph-WXDBUCRP-Cn7wn299.js +0 -1
  108. package/dist/web/assets/info-J43DQDTF-BHUyVizh.js +0 -1
  109. package/dist/web/assets/packet-YPE3B663-B_2RTGcc.js +0 -1
  110. package/dist/web/assets/pie-LRSECV5Y-ieCDED7Y.js +0 -1
  111. package/dist/web/assets/radar-GUYGQ44K-CpqbrBX-.js +0 -1
  112. package/dist/web/assets/search-BoEnT13J.js +0 -1
  113. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-DeLaPJhU.js +0 -1
  114. package/dist/web/assets/treeView-BLDUP644-WRDNuShD.js +0 -1
  115. package/dist/web/assets/treemap-LRROVOQU-BlaZCSii.js +0 -1
  116. package/dist/web/assets/wardley-L42UT6IY-C-Xkgr9M.js +0 -1
@@ -23,6 +23,10 @@ function classifyCliError(error) {
23
23
  if (error instanceof CliError)
24
24
  return error.cli;
25
25
  if (error instanceof ContactPolicyRefusal) {
26
+ if (error.kind === 'unverified')
27
+ return { code: 'anima.contact_unverified', hint: error.message, retryable: true };
28
+ if (error.kind === 'config')
29
+ return { code: 'anima.contact_policy_config', hint: error.message, retryable: false };
26
30
  return { code: 'anima.do_not_contact', hint: error.message, retryable: false };
27
31
  }
28
32
  const commander = classifyCommanderError(error);
@@ -9,8 +9,17 @@ type ContactPolicyInput = {
9
9
  content: SlackMessageTextInput;
10
10
  tool: 'anima.message.send' | 'anima.message.update' | 'anima.ask' | 'anima.file.send';
11
11
  };
12
+ /**
13
+ * `listed`: a recipient or mention is on the do-not-contact list (final).
14
+ * `unverified`: the check could not establish who would receive the message,
15
+ * so it failed closed. That is a lookup failure, not a do-not-contact match.
16
+ * `config`: the host policy itself is unreadable or invalid.
17
+ */
18
+ export type ContactPolicyRefusalKind = 'listed' | 'unverified' | 'config';
12
19
  export declare class ContactPolicyRefusal extends Error {
20
+ readonly kind: ContactPolicyRefusalKind;
13
21
  readonly name = "ContactPolicyRefusal";
22
+ constructor(message: string, kind?: ContactPolicyRefusalKind);
14
23
  }
15
24
  /** A tool-layer constraint, not a sandbox against direct filesystem/Slack access. */
16
25
  export declare function assertSlackContactAllowed(input: ContactPolicyInput): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"contact-policy.service.d.ts","sourceRoot":"","sources":["../../../server/messages/contact-policy.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAA4B,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAIhG,KAAK,kBAAkB,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,qBAAqB,CAAC;IAC/B,IAAI,EAAE,oBAAoB,GAAG,sBAAsB,GAAG,WAAW,GAAG,iBAAiB,CAAC;CACvF,CAAC;AAEF,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,SAAkB,IAAI,0BAA0B;CACjD;AAED,qFAAqF;AACrF,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAcxF"}
1
+ {"version":3,"file":"contact-policy.service.d.ts","sourceRoot":"","sources":["../../../server/messages/contact-policy.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAA4B,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAIhG,KAAK,kBAAkB,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,qBAAqB,CAAC;IAC/B,IAAI,EAAE,oBAAoB,GAAG,sBAAsB,GAAG,WAAW,GAAG,iBAAiB,CAAC;CACvF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE1E,qBAAa,oBAAqB,SAAQ,KAAK;IAGhB,QAAQ,CAAC,IAAI,EAAE,wBAAwB;IAFpE,SAAkB,IAAI,0BAA0B;gBAEpC,OAAO,EAAE,MAAM,EAAW,IAAI,GAAE,wBAAmC;CAGhF;AAUD,qFAAqF;AACrF,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAcxF"}
@@ -3,12 +3,22 @@ import { slackEventMentionsUserId } from '../slack/message-text.js';
3
3
  import { SlackWorkspaceDirectoryService } from '../slack/workspace-directory.service.js';
4
4
  import { serverConfigStore } from '../storage/schema/server.store.js';
5
5
  export class ContactPolicyRefusal extends Error {
6
+ kind;
6
7
  name = 'ContactPolicyRefusal';
8
+ constructor(message, kind = 'listed') {
9
+ super(message);
10
+ this.kind = kind;
11
+ }
7
12
  }
13
+ const FAILURE_KIND = {
14
+ listed: 'do-not-contact',
15
+ unverified: 'contact-unverified',
16
+ config: 'contact-policy-config',
17
+ };
8
18
  /** A tool-layer constraint, not a sandbox against direct filesystem/Slack access. */
9
19
  export async function assertSlackContactAllowed(input) {
10
- const reason = await refusalReason(input);
11
- if (!reason)
20
+ const refusal = await refusalReason(input);
21
+ if (!refusal)
12
22
  return;
13
23
  await activityServiceForAgent(input.agentId).record({
14
24
  type: 'tool.call.failed',
@@ -16,23 +26,26 @@ export async function assertSlackContactAllowed(input) {
16
26
  tool: input.tool,
17
27
  channel: input.channelId,
18
28
  status: 'failed',
19
- failureKind: 'do-not-contact',
20
- error: reason,
29
+ failureKind: FAILURE_KIND[refusal.kind],
30
+ error: refusal.message,
21
31
  },
22
32
  });
23
- throw new ContactPolicyRefusal(reason);
33
+ throw new ContactPolicyRefusal(refusal.message, refusal.kind);
24
34
  }
25
35
  async function refusalReason(input) {
26
36
  let blocked;
27
37
  try {
28
38
  const config = await serverConfigStore.read();
29
39
  if (!input.teamId)
30
- return unresolved('the sending Slack workspace');
40
+ return unresolved(input.channelId, 'which Slack workspace is sending');
31
41
  blocked = config.doNotContact?.[input.teamId] ?? [];
32
42
  }
33
43
  catch {
34
44
  // Do not expose config contents or silently weaken an unreadable policy.
35
- return 'Not sent. The do-not-contact configuration could not be read or is invalid. Ask your human owner to repair the host configuration before sending.';
45
+ return {
46
+ kind: 'config',
47
+ message: 'Not sent. The do-not-contact configuration could not be read or is invalid. Ask your human owner to repair the host configuration before sending.',
48
+ };
36
49
  }
37
50
  if (blocked.length === 0)
38
51
  return undefined;
@@ -47,24 +60,24 @@ async function refusalReason(input) {
47
60
  // A display-label lookup's best-effort fallback is not an authorization fact.
48
61
  const conversation = await directory.getConversation(input.channelId);
49
62
  if (!conversation)
50
- return unresolved('the Slack conversation');
63
+ return unresolved(input.channelId, 'the conversation (Slack did not return it; the ID may be wrong or not visible to this bot)');
51
64
  if (conversation.isMpim) {
52
65
  recipientIds = await directory.getConversationMemberIds(input.channelId);
53
66
  if (recipientIds.length === 0)
54
- return unresolved('the group DM membership');
67
+ return unresolved(input.channelId, 'the group DM membership');
55
68
  }
56
69
  else if (conversation.isIm || input.channelId.startsWith('D')) {
57
70
  if (!conversation.userId)
58
- return unresolved('the DM recipient');
71
+ return unresolved(input.channelId, 'the DM recipient');
59
72
  recipientIds = [conversation.userId];
60
73
  }
61
74
  else if (conversation.isMpim !== false) {
62
- return unresolved('whether the private conversation is a group DM');
75
+ return unresolved(input.channelId, 'whether the private conversation is a group DM');
63
76
  }
64
77
  }
65
78
  }
66
- catch {
67
- return unresolved('the DM recipient or group DM membership');
79
+ catch (error) {
80
+ return unresolved(input.channelId, 'the DM recipient or group DM membership', slackErrorCode(error));
68
81
  }
69
82
  const userId = blocked.find((id) => recipientIds.includes(id) || slackEventMentionsUserId(input.content, id));
70
83
  if (!userId)
@@ -72,8 +85,23 @@ async function refusalReason(input) {
72
85
  const user = await directory.getUser(userId).catch(() => undefined);
73
86
  const name = user?.displayName?.trim() || user?.realName?.trim() || user?.name?.trim();
74
87
  const person = name ? `${name} (${userId})` : userId;
75
- return `Not sent. ${person} is on this workspace's do-not-contact list: they asked never to receive messages from agents. Do not DM or @mention them, do not try another agent or channel to reach them. If something needs to reach them, hand it to your human owner.`;
88
+ return {
89
+ kind: 'listed',
90
+ message: `Not sent. ${person} is on this workspace's do-not-contact list: they asked never to receive messages from agents. Do not DM or @mention them, do not try another agent or channel to reach them. If something needs to reach them, hand it to your human owner.`,
91
+ };
92
+ }
93
+ /**
94
+ * Fail closed, but say what actually happened: agents otherwise read a lookup
95
+ * failure as "this person asked not to be contacted" and stop reaching them.
96
+ */
97
+ function unresolved(channelId, subject, slackError) {
98
+ const cause = slackError ? ` (Slack: ${slackError})` : '';
99
+ return {
100
+ kind: 'unverified',
101
+ message: `Not sent. Could not verify ${subject} for ${channelId}${cause}, and sends are held while a do-not-contact list is active. This is a lookup failure, not a do-not-contact match: it does not mean the recipient is on the list. Check that the channel ID is complete and correct, then retry. If the ID is correct and this keeps failing, tell your human owner.`,
102
+ };
76
103
  }
77
- function unresolved(subject) {
78
- return `Not sent. An active do-not-contact policy could not verify ${subject}. Ask your human owner to resolve this before sending; do not try another route.`;
104
+ function slackErrorCode(error) {
105
+ const code = error?.data?.error;
106
+ return typeof code === 'string' && /^[a-z0-9_]{1,64}$/.test(code) ? code : undefined;
79
107
  }
@@ -166,17 +166,19 @@ test('MPIM walks all membership pages; unknown/private channel classification fa
166
166
  override.set('conversations.info', (data) => ({ ok: true, channel: { id: data.channel, is_mpim: false } }));
167
167
  await check({ channelId: 'GPRIVATE' });
168
168
  override.set('conversations.info', (data) => ({ ok: true, channel: { id: data.channel } }));
169
- await assert.rejects(check({ channelId: 'GUNKNOWN' }), /could not verify/);
169
+ await assert.rejects(check({ channelId: 'GUNKNOWN' }), /could not verify/i);
170
170
  }));
171
171
  for (const response of [{ ok: false, error: 'missing_scope' }, { ok: true }, { ok: true, members: [] }, { ok: true, members: [null] }]) {
172
172
  test(`membership failure refuses: ${JSON.stringify(response)}`, async () => fixture(async ({ check, override }) => {
173
173
  override.set('conversations.members', () => response);
174
- await assert.rejects(check({ channelId: 'G123' }), /could not verify/);
174
+ await assert.rejects(check({ channelId: 'G123' }), response.error
175
+ ? /Could not verify the DM recipient or group DM membership for G123 \(Slack: missing_scope\)/
176
+ : /could not verify/i);
175
177
  }));
176
178
  }
177
179
  test('raw DM lookup failure refuses; absent name uses ID alone', async () => fixture(async ({ home, check, override }) => {
178
180
  override.set('conversations.info', () => ({ ok: false, error: 'channel_not_found' }));
179
- await assert.rejects(check({ channelId: 'DUNKNOWN' }), /could not verify/);
181
+ await assert.rejects(check({ channelId: 'DUNKNOWN' }), /could not verify/i);
180
182
  override.set('users.info', () => ({ ok: false, error: 'user_not_found' }));
181
183
  await writeFile(join(home, 'config.json'), JSON.stringify({ doNotContact: { TNONAME: [USER] } }));
182
184
  await assert.rejects(check({ teamId: 'TNONAME', dmUserId: USER }), { message: refusal.replace('Jialin (U0AAAA)', 'U0AAAA') });
@@ -194,6 +196,28 @@ test('corrupt and unreadable config refuse with a safe actionable failure', asyn
194
196
  assert.equal(rows.length, 3);
195
197
  assert.equal(JSON.stringify(rows).includes('SECRET'), false);
196
198
  }));
199
+ test('lookup failure is reported as unverified, names the channel, and is not a list match', async () => fixture(async ({ run, calls, override, outputs }) => {
200
+ override.set('conversations.info', () => ({ ok: false, error: 'channel_not_found' }));
201
+ const expected = 'Not sent. Could not verify the conversation (Slack did not return it; the ID may be wrong or not visible to this bot) for D0TRUNCATED, and sends are held while a do-not-contact list is active. This is a lookup failure, not a do-not-contact match: it does not mean the recipient is on the list. Check that the channel ID is complete and correct, then retry. If the ID is correct and this keeps failing, tell your human owner.';
202
+ for (let attempt = 0; attempt < 2; attempt += 1) {
203
+ await assert.rejects(run('send', 'D0TRUNCATED', 'hello'), (error) => {
204
+ assert.equal(error.message, expected);
205
+ assert.equal(error.kind, 'unverified');
206
+ return true;
207
+ });
208
+ }
209
+ assert.equal(calls.includes('chat.postMessage'), false);
210
+ assert.deepEqual(outputs, []);
211
+ const rows = await activityServiceForAgent('scout').readAll();
212
+ assert.deepEqual(rows.map((row) => row.payload?.failureKind), ['contact-unverified', 'contact-unverified']);
213
+ assert.equal(JSON.stringify(rows).includes('is on this workspace'), false);
214
+ }));
215
+ test('corrupt config records its own failure kind', async () => fixture(async ({ home, run }) => {
216
+ await writeFile(join(home, 'config.json'), '{"SECRET":');
217
+ await assert.rejects(run('send', 'C123', 'hello'), (error) => error.kind === 'config');
218
+ const rows = await activityServiceForAgent('scout').readAll();
219
+ assert.equal(rows[0]?.payload?.failureKind, 'contact-policy-config');
220
+ }));
197
221
  test('policy refusal precedes hold and never advances its cursor', async () => fixture(async ({ run }) => {
198
222
  setCursorDeliveryEnabledForTests(true);
199
223
  const store = new ObservedConversationStore('scout');
@@ -224,6 +248,23 @@ for (const kind of ['send', 'update', 'ask', 'file']) {
224
248
  assert.equal(stderr.trim(), `error anima.do_not_contact (not retryable): ${refusal}`);
225
249
  }));
226
250
  }
251
+ test('unverified lookup CLI exits 1 with a distinct retryable code', async () => fixture(async ({ home, url, override }) => {
252
+ override.set('conversations.info', () => ({ ok: false, error: 'channel_not_found' }));
253
+ const child = spawn(process.execPath, [resolve('dist/server/cli/anima.js'), 'message', 'send', '--channel', 'D0TRUNCATED'], {
254
+ env: { PATH: process.env.PATH, ANIMA_HOME: home, ANIMA_AGENT_ID: 'scout', ANIMA_SLACK_API_URL: url },
255
+ stdio: ['pipe', 'pipe', 'pipe'],
256
+ });
257
+ child.stdin.end('hello');
258
+ let stdout = '';
259
+ let stderr = '';
260
+ child.stdout.on('data', (chunk) => { stdout += chunk; });
261
+ child.stderr.on('data', (chunk) => { stderr += chunk; });
262
+ const code = await new Promise((resolveExit, reject) => { child.on('error', reject); child.on('exit', resolveExit); });
263
+ assert.equal(code, 1);
264
+ assert.equal(stdout, '');
265
+ assert.match(stderr, /^error anima\.contact_unverified \(retryable\): Not sent\. Could not verify .* for D0TRUNCATED, .*not a do-not-contact match/);
266
+ assert.doesNotMatch(stderr, /anima\.do_not_contact/);
267
+ }));
227
268
  test('group membership is rechecked at send time and a failed later page refuses', async () => fixture(async ({ check, override }) => {
228
269
  override.set('conversations.members', () => ({ ok: true, members: ['UBOT', 'UOTHER'] }));
229
270
  await check({ channelId: 'G123' });
@@ -231,7 +272,7 @@ test('group membership is rechecked at send time and a failed later page refuses
231
272
  await assert.rejects(check({ channelId: 'G123' }), { message: refusal });
232
273
  override.set('conversations.members', (data) => data.cursor ? { ok: false, error: 'missing_scope' }
233
274
  : { ok: true, members: ['UBOT'], response_metadata: { next_cursor: 'page2' } });
234
- await assert.rejects(check({ channelId: 'G123' }), /could not verify/);
275
+ await assert.rejects(check({ channelId: 'G123' }), /could not verify/i);
235
276
  }));
236
277
  test('operator guide retains the shipped heading and rule', async () => {
237
278
  const guide = await readFile(resolve('docs/guide/working-with-your-agent.md'), 'utf8');
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DnM6i6kF.js","assets/index-CbAhFc-0.js","assets/index-DIncpmwE.css","assets/chunk-O5CBEL6O-B7YJjftf.js","assets/src-DOSXYjwH.js","assets/chunk-5ZQYHXKU-Vgr4jBt1.js","assets/dist-CwHmnwO6.js","assets/chunk-CSCIHK7Q-xxNdF5BX.js","assets/chunk-3OPIFGDE-SXmEESKD.js","assets/chunk-L5ZTLDWV-DYHe5z-p.js","assets/chunk-NZK2D7GU-Bi3zqbUv.js","assets/rough.esm-CSKSodPl.js","assets/chunk-BSJP7CBP-DD2WqzXl.js","assets/chunk-KSCS5N6A-B9pu9Zdk.js","assets/line-BeG27-zH.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-LZXEDZCA-C2A3MD3P.js","assets/chunk-WU5MYG2G-CZXAqd3y.js","assets/chunk-XPW4576I-BRwQ5uRX.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./copy-CrJlq9AF.js";import{t}from"./lightbulb-BZTBGg7G.js";import{$t as n,Cn as r,Dr as i,Er as a,F as o,Ht as s,Or as c,Qt as l,Ut as u,Zt as d,an as f,en as p,fr as m,kr as h,r as g,sn as _,tn as v,un as y,wn as b,wr as x,xr as S,zt as C}from"./index-CbAhFc-0.js";import{c as ee,o as te}from"./useNow-BwVNU1Kt.js";var ne=y(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),re=y(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ie=y(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),w=y(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),ae=y(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),oe=y(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),se=y(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ce=y(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),le=y(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),ue=y(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),de=y(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),fe=y(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),pe=y(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),T=h(a(),1),E=m(),me=c({ParseError:()=>D,SETTINGS_SCHEMA:()=>we,__defineFunction:()=>B,__defineMacro:()=>H,__defineSymbol:()=>A,__domTree:()=>Do,__parse:()=>So,__renderToDomTree:()=>wo,__renderToHTMLTree:()=>To,__setFontMetrics:()=>Pt,default:()=>Oo,render:()=>bo,renderToString:()=>xo,version:()=>Eo}),D=class e extends Error{constructor(t,n){var r=`KaTeX parse error: `+t,i,a,o=n&&n.loc;if(o&&o.start<=o.end){var s=o.lexer.input;i=o.start,a=o.end,i===s.length?r+=` at end of input: `:r+=` at position `+(i+1)+`: `;var c=s.slice(i,a).replace(/[^]/g,`$&̲`),l=i>15?`…`+s.slice(i-15,i):s.slice(0,i),u=a+15<s.length?s.slice(a,a+15)+`…`:s.slice(a);r+=l+c+u}super(r),this.name=`ParseError`,this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}},he=/([A-Z])/g,ge=e=>e.replace(he,`-$1`).toLowerCase(),_e={"&":`&amp;`,">":`&gt;`,"<":`&lt;`,'"':`&quot;`,"'":`&#x27;`},ve=/[&><"']/g,ye=e=>String(e).replace(ve,e=>_e[e]),be=e=>e.type===`ordgroup`||e.type===`color`?e.body.length===1?be(e.body[0]):e:e.type===`font`?be(e.body):e,xe=new Set([`mathord`,`textord`,`atom`]),Se=e=>xe.has(be(e).type),Ce=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},we={displayMode:{type:`boolean`,description:`Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.`,cli:`-d, --display-mode`},output:{type:{enum:[`htmlAndMathml`,`html`,`mathml`]},description:`Determines the markup language of the output.`,cli:`-F, --format <type>`},leqno:{type:`boolean`,description:`Render display math in leqno style (left-justified tags).`},fleqn:{type:`boolean`,description:`Render display math flush left.`},throwOnError:{type:`boolean`,default:!0,cli:`-t, --no-throw-on-error`,cliDescription:`Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error.`},errorColor:{type:`string`,default:`#cc0000`,cli:`-c, --error-color <color>`,cliDescription:`A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.`,cliProcessor:e=>`#`+e},macros:{type:`object`,cli:`-m, --macro <def>`,cliDescription:`Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).`,cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:`number`,description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:`--min-rule-thickness <size>`,cliProcessor:parseFloat},colorIsTextColor:{type:`boolean`,description:`Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.`,cli:`-b, --color-is-text-color`},strict:{type:[{enum:[`warn`,`ignore`,`error`]},`boolean`,`function`],description:`Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.`,cli:`-S, --strict`,cliDefault:!1},trust:{type:[`boolean`,`function`],description:`Trust the input, enabling all HTML features such as \\url.`,cli:`-T, --trust`},maxSize:{type:`number`,default:1/0,description:`If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large`,processor:e=>Math.max(0,e),cli:`-s, --max-size <n>`,cliProcessor:parseInt},maxExpand:{type:`number`,default:1e3,description:`Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.`,processor:e=>Math.max(0,e),cli:`-e, --max-expand <n>`,cliProcessor:e=>e===`Infinity`?1/0:parseInt(e)},globalGroup:{type:`boolean`,cli:!1}};function Te(e){if(typeof e!=`string`)return e.enum[0];switch(e){case`boolean`:return!1;case`string`:return``;case`number`:return 0;case`object`:return{};default:throw Error(`Unexpected schema type; settings must declare an explicit default.`)}}function Ee(e){return e.default===void 0?Te(Array.isArray(e.type)?e.type[0]:e.type):e.default}function De(e,t,n,r){var i=n[t];e[t]=i===void 0?Ee(r):r.processor?r.processor(i):i}var Oe=class{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e||={};for(var t of Object.keys(we)){var n=we[t];n&&De(this,t,e,n)}}reportNonstrict(e,t,n){var r=this.strict;if(typeof r==`function`&&(r=r(e,t,n)),!(!r||r===`ignore`)){if(r===!0||r===`error`)throw new D(`LaTeX-incompatible input and strict mode is set to 'error': `+(t+` [`+e+`]`),n);r===`warn`?typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)):typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`))}}useStrictBehavior(e,t,n){var r=this.strict;if(typeof r==`function`)try{r=r(e,t,n)}catch{r=`error`}return!r||r===`ignore`?!1:r===!0||r===`error`?!0:r===`warn`?(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)),!1):(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`)),!1)}isTrusted(e){if(`url`in e&&e.url&&!e.protocol){var t=Ce(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},ke=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return Re[ze[this.id]]}sub(){return Re[Be[this.id]]}fracNum(){return Re[Ve[this.id]]}fracDen(){return Re[He[this.id]]}cramp(){return Re[Ue[this.id]]}text(){return Re[We[this.id]]}isTight(){return this.size>=2}},Ae=0,je=1,Me=2,Ne=3,Pe=4,Fe=5,Ie=6,Le=7,Re=[new ke(Ae,0,!1),new ke(je,0,!0),new ke(Me,1,!1),new ke(Ne,1,!0),new ke(Pe,2,!1),new ke(Fe,2,!0),new ke(Ie,3,!1),new ke(Le,3,!0)],ze=[Pe,Fe,Pe,Fe,Ie,Le,Ie,Le],Be=[Fe,Fe,Fe,Fe,Le,Le,Le,Le],Ve=[Me,Ne,Pe,Fe,Ie,Le,Ie,Le],He=[Ne,Ne,Fe,Fe,Le,Le,Le,Le],Ue=[je,je,Ne,Ne,Fe,Fe,Le,Le],We=[Ae,je,Me,Ne,Me,Ne,Me,Ne],O={DISPLAY:Re[Ae],TEXT:Re[Me],SCRIPT:Re[Pe],SCRIPTSCRIPT:Re[Ie]},Ge=[{name:`latin`,blocks:[[256,591],[768,879]]},{name:`cyrillic`,blocks:[[1024,1279]]},{name:`armenian`,blocks:[[1328,1423]]},{name:`brahmic`,blocks:[[2304,4255]]},{name:`georgian`,blocks:[[4256,4351]]},{name:`cjk`,blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:`hangul`,blocks:[[44032,55215]]}];function Ke(e){for(var t=0;t<Ge.length;t++)for(var n=Ge[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}var qe=[];Ge.forEach(e=>e.blocks.forEach(e=>qe.push(...e)));function Je(e){for(var t=0;t<qe.length;t+=2)if(e>=qe[t]&&e<=qe[t+1])return!0;return!1}var Ye=e=>e+` `+e,Xe=80,Ze=function(e,t){return`M95,`+(622+e+t)+`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BhLaljEz.js","assets/index-DlHETnHC.js","assets/index-DIncpmwE.css","assets/chunk-O5CBEL6O-Dh_KkhDf.js","assets/src-B2YqOS_g.js","assets/chunk-5ZQYHXKU-D_5qZ4Zv.js","assets/dist-BVWlbvC4.js","assets/chunk-CSCIHK7Q-BeNiRoDm.js","assets/chunk-3OPIFGDE-CtmMZbUU.js","assets/chunk-L5ZTLDWV-DtSiy2JS.js","assets/chunk-NZK2D7GU-BKDBTHUK.js","assets/rough.esm-CSKSodPl.js","assets/chunk-BSJP7CBP-C5nluir4.js","assets/chunk-KSCS5N6A-D80hU7za.js","assets/line-CX3cghIS.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-LZXEDZCA-CFWlwpSj.js","assets/chunk-WU5MYG2G-BAvj0V8I.js","assets/chunk-XPW4576I-BaeieIoE.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./copy-DI3PIiTH.js";import{t}from"./lightbulb-17VUUl6S.js";import{$t as n,Cn as r,Dr as i,Er as a,F as o,Ht as s,Or as c,Qt as l,Ut as u,Zt as d,an as f,en as p,fr as m,kr as h,r as g,sn as _,tn as v,un as y,wn as b,wr as x,xr as S,zt as C}from"./index-DlHETnHC.js";import{c as ee,o as te}from"./useNow-BbEkaqh-.js";var ne=y(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),re=y(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ie=y(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),w=y(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),ae=y(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),oe=y(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),se=y(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ce=y(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),le=y(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),ue=y(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),de=y(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),fe=y(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),pe=y(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),T=h(a(),1),E=m(),me=c({ParseError:()=>D,SETTINGS_SCHEMA:()=>we,__defineFunction:()=>B,__defineMacro:()=>H,__defineSymbol:()=>A,__domTree:()=>Do,__parse:()=>So,__renderToDomTree:()=>wo,__renderToHTMLTree:()=>To,__setFontMetrics:()=>Pt,default:()=>Oo,render:()=>bo,renderToString:()=>xo,version:()=>Eo}),D=class e extends Error{constructor(t,n){var r=`KaTeX parse error: `+t,i,a,o=n&&n.loc;if(o&&o.start<=o.end){var s=o.lexer.input;i=o.start,a=o.end,i===s.length?r+=` at end of input: `:r+=` at position `+(i+1)+`: `;var c=s.slice(i,a).replace(/[^]/g,`$&̲`),l=i>15?`…`+s.slice(i-15,i):s.slice(0,i),u=a+15<s.length?s.slice(a,a+15)+`…`:s.slice(a);r+=l+c+u}super(r),this.name=`ParseError`,this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}},he=/([A-Z])/g,ge=e=>e.replace(he,`-$1`).toLowerCase(),_e={"&":`&amp;`,">":`&gt;`,"<":`&lt;`,'"':`&quot;`,"'":`&#x27;`},ve=/[&><"']/g,ye=e=>String(e).replace(ve,e=>_e[e]),be=e=>e.type===`ordgroup`||e.type===`color`?e.body.length===1?be(e.body[0]):e:e.type===`font`?be(e.body):e,xe=new Set([`mathord`,`textord`,`atom`]),Se=e=>xe.has(be(e).type),Ce=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},we={displayMode:{type:`boolean`,description:`Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.`,cli:`-d, --display-mode`},output:{type:{enum:[`htmlAndMathml`,`html`,`mathml`]},description:`Determines the markup language of the output.`,cli:`-F, --format <type>`},leqno:{type:`boolean`,description:`Render display math in leqno style (left-justified tags).`},fleqn:{type:`boolean`,description:`Render display math flush left.`},throwOnError:{type:`boolean`,default:!0,cli:`-t, --no-throw-on-error`,cliDescription:`Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error.`},errorColor:{type:`string`,default:`#cc0000`,cli:`-c, --error-color <color>`,cliDescription:`A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.`,cliProcessor:e=>`#`+e},macros:{type:`object`,cli:`-m, --macro <def>`,cliDescription:`Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).`,cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:`number`,description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:`--min-rule-thickness <size>`,cliProcessor:parseFloat},colorIsTextColor:{type:`boolean`,description:`Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.`,cli:`-b, --color-is-text-color`},strict:{type:[{enum:[`warn`,`ignore`,`error`]},`boolean`,`function`],description:`Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.`,cli:`-S, --strict`,cliDefault:!1},trust:{type:[`boolean`,`function`],description:`Trust the input, enabling all HTML features such as \\url.`,cli:`-T, --trust`},maxSize:{type:`number`,default:1/0,description:`If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large`,processor:e=>Math.max(0,e),cli:`-s, --max-size <n>`,cliProcessor:parseInt},maxExpand:{type:`number`,default:1e3,description:`Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.`,processor:e=>Math.max(0,e),cli:`-e, --max-expand <n>`,cliProcessor:e=>e===`Infinity`?1/0:parseInt(e)},globalGroup:{type:`boolean`,cli:!1}};function Te(e){if(typeof e!=`string`)return e.enum[0];switch(e){case`boolean`:return!1;case`string`:return``;case`number`:return 0;case`object`:return{};default:throw Error(`Unexpected schema type; settings must declare an explicit default.`)}}function Ee(e){return e.default===void 0?Te(Array.isArray(e.type)?e.type[0]:e.type):e.default}function De(e,t,n,r){var i=n[t];e[t]=i===void 0?Ee(r):r.processor?r.processor(i):i}var Oe=class{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e||={};for(var t of Object.keys(we)){var n=we[t];n&&De(this,t,e,n)}}reportNonstrict(e,t,n){var r=this.strict;if(typeof r==`function`&&(r=r(e,t,n)),!(!r||r===`ignore`)){if(r===!0||r===`error`)throw new D(`LaTeX-incompatible input and strict mode is set to 'error': `+(t+` [`+e+`]`),n);r===`warn`?typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)):typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`))}}useStrictBehavior(e,t,n){var r=this.strict;if(typeof r==`function`)try{r=r(e,t,n)}catch{r=`error`}return!r||r===`ignore`?!1:r===!0||r===`error`?!0:r===`warn`?(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)),!1):(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`)),!1)}isTrusted(e){if(`url`in e&&e.url&&!e.protocol){var t=Ce(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},ke=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return Re[ze[this.id]]}sub(){return Re[Be[this.id]]}fracNum(){return Re[Ve[this.id]]}fracDen(){return Re[He[this.id]]}cramp(){return Re[Ue[this.id]]}text(){return Re[We[this.id]]}isTight(){return this.size>=2}},Ae=0,je=1,Me=2,Ne=3,Pe=4,Fe=5,Ie=6,Le=7,Re=[new ke(Ae,0,!1),new ke(je,0,!0),new ke(Me,1,!1),new ke(Ne,1,!0),new ke(Pe,2,!1),new ke(Fe,2,!0),new ke(Ie,3,!1),new ke(Le,3,!0)],ze=[Pe,Fe,Pe,Fe,Ie,Le,Ie,Le],Be=[Fe,Fe,Fe,Fe,Le,Le,Le,Le],Ve=[Me,Ne,Pe,Fe,Ie,Le,Ie,Le],He=[Ne,Ne,Fe,Fe,Le,Le,Le,Le],Ue=[je,je,Ne,Ne,Fe,Fe,Le,Le],We=[Ae,je,Me,Ne,Me,Ne,Me,Ne],O={DISPLAY:Re[Ae],TEXT:Re[Me],SCRIPT:Re[Pe],SCRIPTSCRIPT:Re[Ie]},Ge=[{name:`latin`,blocks:[[256,591],[768,879]]},{name:`cyrillic`,blocks:[[1024,1279]]},{name:`armenian`,blocks:[[1328,1423]]},{name:`brahmic`,blocks:[[2304,4255]]},{name:`georgian`,blocks:[[4256,4351]]},{name:`cjk`,blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:`hangul`,blocks:[[44032,55215]]}];function Ke(e){for(var t=0;t<Ge.length;t++)for(var n=Ge[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}var qe=[];Ge.forEach(e=>e.blocks.forEach(e=>qe.push(...e)));function Je(e){for(var t=0;t<qe.length;t+=2)if(e>=qe[t]&&e<=qe[t+1])return!0;return!1}var Ye=e=>e+` `+e,Xe=80,Ze=function(e,t){return`M95,`+(622+e+t)+`
3
3
  c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
4
4
  c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
5
5
  c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
@@ -299,4 +299,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
299
299
  `),n=!1;return t.map(e=>{if(/^(`{3,}|~{3,})/.test(e))return n=!n,e;if(n)return e;let t=e.match(/^(#{1,6}\s+)(.+)$/);if(!t)return e;let{text:r,explicitId:i}=CT(t[2]);return i?`${t[1]}${r}`:e}).join(`
300
300
  `)}function AT(e){let{origin:t,pathname:n,search:r}=window.location;return`${t}${n}${r}#${e}`}function jT(e){let t=/^#L(\d+)$/.exec(e);if(!t)return null;let n=Number(t[1]);return Number.isInteger(n)&&n>0?n:null}function MT({text:t,variant:n=`floating`}){let[r,i]=(0,T.useState)(!1),a=(0,T.useRef)(null),o=(0,T.useCallback)(()=>{g(t).then(()=>{i(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(!1),2e3)}).catch(()=>{})},[t]);return(0,T.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,E.jsxs)(`button`,{onClick:o,title:r?`Copied!`:`Copy`,"aria-label":r?`Copied`:`Copy code`,className:n===`floating`?`chrome absolute right-2 top-2 flex h-7 items-center gap-1 rounded-sm bg-surface-elevated/80 px-2 text-[11px] text-text-subtle opacity-0 transition-opacity hover:bg-surface-elevated hover:text-text focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`:`chrome flex h-7 items-center gap-1 rounded-sm px-2 text-[11px] text-text-subtle transition-colors hover:bg-surface-hover hover:text-text focus-visible:bg-surface-hover focus-visible:text-text`,children:[(0,E.jsx)(e,{className:`h-3 w-3`}),r&&(0,E.jsx)(`span`,{children:`Copied!`})]})}function NT({id:e}){let[t,n]=(0,T.useState)(!1),r=(0,T.useRef)(null),i=(0,T.useCallback)(t=>{t.stopPropagation(),t.preventDefault(),DT(e),g(AT(e)).then(()=>{n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1500)}).catch(()=>{})},[e]);return(0,T.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),(0,E.jsx)(`a`,{href:`#${e}`,onClick:i,"aria-label":t?`Link copied`:`Copy link to this section`,title:t?`Link copied!`:`Copy link to this section`,contentEditable:!1,className:`absolute right-full top-[0.1em] mr-1 inline-flex items-center px-1 text-text-subtle no-underline opacity-0 transition-opacity duration-100 hover:text-accent focus-visible:opacity-100 group-hover:opacity-100 [@media(hover:none)]:static [@media(hover:none)]:ml-1 [@media(hover:none)]:mr-0 [@media(hover:none)]:px-1.5 [@media(hover:none)]:opacity-60`,children:(0,E.jsx)(le,{className:`h-[0.7em] w-[0.7em]`,strokeWidth:2.5,"aria-hidden":`true`})})}function PT({filePath:e}){let t=e.split(`/`).filter(Boolean),n=t[t.length-1]??e,r=t.slice(0,-1),i=r[r.length-1],a=r.length>1;return(0,E.jsxs)(`div`,{title:e,className:`flex min-w-0 items-center gap-1 font-sans text-[12px] text-text-subtle`,children:[i&&(0,E.jsxs)(E.Fragment,{children:[a&&(0,E.jsx)(`span`,{className:`shrink-0 text-text-subtle/70`,children:`…`}),a&&(0,E.jsx)(f,{className:`h-3 w-3 shrink-0 text-text-subtle/50`}),(0,E.jsx)(`span`,{className:`max-w-[12rem] shrink truncate`,children:i}),(0,E.jsx)(f,{className:`h-3 w-3 shrink-0 text-text-subtle/50`})]}),(0,E.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium text-text-muted`,children:n})]})}function FT({id:t,filePath:r,size:i,rawUrl:a,downloadUrl:o}){let[s,c]=(0,T.useState)(!1),[l,u]=(0,T.useState)(!1),d=(0,T.useRef)(null),f=(0,T.useRef)(null);(0,T.useEffect)(()=>{if(!s)return;function e(e){d.current&&!d.current.contains(e.target)&&c(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[s]),(0,T.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let m=a??b(t,r),h=o===void 0?C(t,r):o,_=(0,T.useCallback)(()=>{g(r).then(()=>{u(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>u(!1),2e3)}).catch(()=>{})},[r]),y=`flex w-full items-center gap-2 px-3 py-2 text-left font-sans text-[12px] text-text-muted transition-colors hover:bg-surface-elevated`;return(0,E.jsxs)(`div`,{ref:d,className:`relative`,children:[(0,E.jsx)(`button`,{onClick:()=>c(e=>!e),title:`More actions`,"aria-label":`More actions`,"aria-haspopup":`menu`,"aria-expanded":s,className:[`chrome flex min-h-[44px] shrink-0 items-center justify-center rounded-sm px-2 transition-colors`,s?`text-text`:`text-text-subtle hover:bg-surface-elevated hover:text-text-muted`].join(` `),children:(0,E.jsx)(p,{className:`h-3.5 w-3.5`})}),s&&(0,E.jsxs)(`div`,{role:`menu`,className:`absolute right-0 top-full z-20 mt-1 w-44 overflow-hidden rounded-sm border border-border-soft bg-surface shadow-deep`,children:[i!==void 0&&(0,E.jsx)(`div`,{className:`border-b border-border-soft px-3 py-1.5 font-sans text-[11px] text-text-subtle`,children:te(i)}),(0,E.jsxs)(`button`,{role:`menuitem`,onClick:_,className:y,children:[(0,E.jsx)(e,{className:`h-3.5 w-3.5 shrink-0`}),l?`Path copied`:`Copy path`]}),(0,E.jsxs)(`a`,{role:`menuitem`,href:m,target:`_blank`,rel:`noreferrer`,onClick:()=>c(!1),className:y,children:[(0,E.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),`Open raw`]}),h&&(0,E.jsxs)(`a`,{role:`menuitem`,href:h,download:!0,onClick:()=>c(!1),className:y,children:[(0,E.jsx)(v,{className:`h-3.5 w-3.5 shrink-0`}),`Download`]})]})]})}function IT({entries:e}){let[t,n]=(0,T.useState)(!1),r=(0,T.useRef)(null);return(0,T.useEffect)(()=>{if(!t)return;function e(e){r.current&&!r.current.contains(e.target)&&n(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]),e.length===0?null:(0,E.jsxs)(`div`,{ref:r,className:`relative`,children:[(0,E.jsx)(`button`,{onClick:()=>n(e=>!e),title:`Table of contents`,className:[`chrome flex min-h-[44px] shrink-0 items-center justify-center rounded-sm px-2 transition-colors`,t?`text-text`:`text-text-subtle hover:bg-surface-elevated hover:text-text-muted`].join(` `),children:(0,E.jsx)(ue,{className:`h-3.5 w-3.5`})}),t&&(0,E.jsx)(`div`,{className:`absolute right-0 top-full z-20 mt-1 w-72 max-h-[480px] overflow-y-auto rounded-sm border border-border-soft bg-surface shadow-deep`,children:(0,E.jsx)(`nav`,{className:`py-1`,children:e.map((e,t)=>(0,E.jsx)(`a`,{href:`#${e.id}`,onClick:t=>{t.preventDefault(),n(!1),window.history.replaceState(null,``,`#${e.id}`),document.getElementById(e.id)?.scrollIntoView({behavior:`smooth`})},className:`flex min-h-[44px] md:min-h-[40px] items-center font-sans text-[13px] text-text-muted transition-colors hover:bg-surface-elevated/60 hover:text-text`,style:{paddingLeft:`${.75+(e.depth-1)*.75}rem`,paddingRight:`0.75rem`},children:e.text},t))})})]})}var LT=[{value:`preview`,label:`Preview`,Icon:re},{value:`code`,label:`Code`,Icon:ne}];function RT({mode:e,onChange:t}){return(0,E.jsx)(`div`,{role:`tablist`,"aria-label":`File view mode`,className:`chrome inline-flex shrink-0 items-center gap-0.5 rounded-md border border-border-soft bg-surface-raised/40 p-0.5`,children:LT.map(({value:n,label:r,Icon:i})=>{let a=e===n;return(0,E.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":a,title:r,onClick:()=>t(n),className:[`flex min-h-[44px] md:min-h-[28px] items-center gap-1.5 rounded-[5px] px-2 text-[11px] font-medium transition-colors`,a?`bg-surface text-text shadow-sm`:`text-text-subtle hover:text-text-muted`].join(` `),children:[(0,E.jsx)(i,{className:`h-3.5 w-3.5`,strokeWidth:2}),r]},n)})})}var zT=`kb-file-view-mode`;function BT(){try{return window.sessionStorage.getItem(`kb-file-view-mode`)===`code`?`code`:`preview`}catch{return`preview`}}function VT(e){try{window.sessionStorage.setItem(zT,e)}catch{}}var HT=`kb-code-wrap`;function UT(){try{return window.sessionStorage.getItem(HT)!==`off`}catch{return!0}}function WT(e){try{window.sessionStorage.setItem(HT,e?`on`:`off`)}catch{}}function GT({body:e,language:t}){let n=(0,T.useRef)(null),[r,i]=(0,T.useState)(()=>jT(window.location.hash)),[a,o]=(0,T.useState)(UT),s=(0,T.useCallback)(()=>{o(e=>{let t=!e;return WT(t),t})},[]);(0,T.useEffect)(()=>{function e(){i(jT(window.location.hash))}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),(0,T.useEffect)(()=>{let e=jT(window.location.hash);if(e===null)return;let t=n.current?.querySelector(`#L${e}`);if(!t)return;let r=setTimeout(()=>t.scrollIntoView({behavior:`smooth`,block:`center`}),80);return()=>clearTimeout(r)},[]);function c(e){let t=r===e?null:e;i(t);let n=t===null?window.location.pathname+window.location.search:`#L${t}`;window.history.replaceState(null,``,n)}return(0,E.jsx)(`div`,{ref:n,className:`min-h-0 flex-1 overflow-auto`,children:(0,E.jsxs)(`div`,{className:`relative group min-h-0 flex-1 overflow-auto`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:s,"aria-pressed":a,title:a?`Disable soft wrap`:`Enable soft wrap`,className:[`chrome absolute right-12 top-2 z-10 flex h-7 items-center gap-1 rounded-sm px-2 text-[11px] transition-opacity`,`opacity-0 focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100`,a?`bg-accent/10 text-accent hover:bg-accent/15`:`bg-surface-elevated/80 text-text-subtle hover:bg-surface-elevated hover:text-text`].join(` `),children:(0,E.jsx)(pe,{className:`h-3 w-3`})}),(0,E.jsx)(MT,{text:e}),(0,E.jsx)(bT,{code:e.replace(/\n$/,``),language:t,theme:Uw.github,children:({className:e,style:t,tokens:n,getLineProps:i,getTokenProps:o})=>(0,E.jsx)(`pre`,{className:`${e} min-h-full font-mono text-[12.5px] leading-relaxed ${a?``:`w-max`}`,style:{...t,background:`transparent`,padding:0,whiteSpace:a?`pre-wrap`:`pre`,wordBreak:a?`break-word`:`normal`},children:(0,E.jsx)(`div`,{className:`py-4`,children:n.map((e,t)=>{let n=t+1,{className:s,...l}=i({line:e}),u=r===n;return(0,E.jsxs)(`div`,{...l,id:`L${n}`,className:[s??``,`flex px-5`,a?``:`min-w-full`,u?`bg-accent/10`:``].join(` `).trim(),children:[(0,E.jsx)(`a`,{href:`#L${n}`,onClick:e=>{e.preventDefault(),c(n)},title:`Link to line ${n}`,className:[`mr-4 inline-block w-8 shrink-0 select-none text-right tabular-nums transition-colors`,u?`text-accent`:`text-text-subtle/50 hover:text-text-muted`].join(` `),children:n}),(0,E.jsx)(`span`,{className:a?`min-w-0 flex-1`:`shrink-0`,children:e.map((e,t)=>(0,E.jsx)(`span`,{...o({token:e})},t))})]},t)})})})})]})})}function KT(e){if(e.length>=2){let t=e[0],n=e[e.length-1];if(t===`"`&&n===`"`||t===`'`&&n===`'`)return e.slice(1,-1)}return e}function qT(e){let t=e.split(`
301
301
  `),n=[],r=0;for(;r<t.length;){let e=t[r];if(e.trim()===``||e.trimStart().startsWith(`#`)){r++;continue}let i=/^([A-Za-z0-9_][\w .-]*):(?:[ \t]+(.*))?$/.exec(e);if(!i||/^\s/.test(e)){r++;continue}let a=i[1],o=(i[2]??``).trim();if(o!==``){n.push({key:a,value:KT(o),block:null}),r++;continue}let s=[];for(r++;r<t.length;){let e=t[r];if(e.trim()===``){r++;continue}if(/^\s/.test(e)||/^-[ \t]/.test(e)){s.push(e),r++;continue}break}n.push({key:a,value:null,block:s.length>0?s:null})}return n}function JT(e){let t=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(e);if(!t)return{entries:null,body:e};let n=qT(t[1]);return n.length===0?{entries:null,body:e}:{entries:n,body:e.slice(t[0].length)}}function YT(e){let t=e.filter(e=>e.trim()!==``).map(e=>/^[ \t]*/.exec(e)?.[0].length??0),n=t.length>0?Math.min(...t):0;return e.map(e=>e.slice(n))}function XT({block:e}){let t=YT(e),n=t.filter(e=>e.trim()!==``);return n.length>0&&n.every(e=>/^-[ \t]+/.test(e))?(0,E.jsx)(`ul`,{className:`m-0 list-disc space-y-0.5 pl-4`,children:n.map((e,t)=>(0,E.jsx)(`li`,{className:`font-mono text-[12px] text-text`,children:KT(e.replace(/^-[ \t]+/,``).trim())},t))}):(0,E.jsx)(`pre`,{className:`m-0 whitespace-pre-wrap break-words font-mono text-[12px] leading-relaxed text-text`,children:t.join(`
302
- `).trimEnd()})}function ZT({entries:e}){return(0,E.jsx)(`div`,{className:`mb-5 overflow-hidden rounded-sm border border-border-soft bg-surface-raised/30`,children:(0,E.jsx)(`table`,{className:`m-0 w-full border-collapse text-left align-top`,children:(0,E.jsx)(`tbody`,{children:e.map((e,t)=>(0,E.jsxs)(`tr`,{className:t>0?`border-t border-border-soft/70`:void 0,children:[(0,E.jsx)(`th`,{scope:`row`,className:`w-px whitespace-nowrap border-r border-border-soft/70 bg-surface-raised/40 px-3 py-2 align-top font-sans text-[11px] font-semibold uppercase tracking-wide text-text-subtle`,children:e.key}),(0,E.jsx)(`td`,{className:`px-3 py-2 align-top font-mono text-[12px] text-text`,children:e.block?(0,E.jsx)(XT,{block:e.block}):(0,E.jsx)(`span`,{className:`break-words`,children:e.value})})]},e.key+t))})})})}function QT({src:e,alt:t}){let[n,r]=(0,T.useState)(!1),i=(0,T.useRef)(null),a=(0,T.useRef)(null),o=(0,T.useCallback)(()=>{a.current=document.activeElement instanceof HTMLElement?document.activeElement:null,r(!0)},[]),c=(0,T.useCallback)(()=>{r(!1)},[]);return(0,T.useEffect)(()=>{if(!n)return;function e(e){e.key===`Escape`?c():e.key===`Tab`&&(e.preventDefault(),i.current?.focus())}return i.current?.focus(),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),a.current?.focus()}},[c,n]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`img`,{src:e,alt:t,onClick:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},role:`button`,tabIndex:0,"aria-label":t?`Open image: ${t}`:`Open image`,className:`max-w-full cursor-zoom-in rounded`}),n&&(0,E.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":t?`Image preview: ${t}`:`Image preview`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4`,onClick:c,children:[(0,E.jsx)(`button`,{ref:i,onClick:e=>{e.stopPropagation(),c()},"aria-label":`Close image preview`,title:`Close`,className:`chrome absolute right-4 top-4 flex min-h-[44px] min-w-[44px] items-center justify-center rounded-sm bg-black/40 text-white transition-colors hover:bg-black/60 focus-visible:bg-black/60`,children:(0,E.jsx)(s,{className:`h-4 w-4`})}),(0,E.jsx)(`img`,{src:e,alt:t,className:`max-h-full max-w-full object-contain`,onClick:e=>e.stopPropagation()}),t&&(0,E.jsx)(`div`,{className:`chrome absolute bottom-4 left-4 right-4 rounded-sm bg-black/45 px-3 py-2 text-center text-[12px] text-white/85`,children:t})]})]})}var $T=null;function eE(){return $T||=x(async()=>{let{default:e}=await import(`./mermaid.core-DnM6i6kF.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`neutral`,htmlLabels:!1,flowchart:{htmlLabels:!1}}),e)),$T}function tE(e){return Ks.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:[`foreignObject`,`img`,`image`,`script`,`iframe`,`object`,`embed`,`a`,`audio`,`video`,`source`,`link`,`base`],FORBID_ATTR:[`href`,`xlink:href`,`src`,`onerror`,`onload`,`onclick`]})}function nE({code:e}){let t=(0,T.useId)(),[n,r]=(0,T.useState)({svg:null,failed:!1});(0,T.useEffect)(()=>{let n=!1,i=`mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,``)}`;return eE().then(t=>t.render(i,e)).then(({svg:e})=>{n||r({svg:e,failed:!1})}).catch(()=>{n||r({svg:null,failed:!0})}),()=>{n=!0}},[e,t]);let{svg:i,failed:a}=n;return a?(0,E.jsx)(`pre`,{className:`font-mono text-[0.82em] leading-[1.55] text-text-muted`,style:{background:`transparent`,margin:0},children:e}):i===null?(0,E.jsx)(`div`,{className:`px-3 py-4 text-[0.82em] text-text-subtle`,children:`Rendering diagram…`}):(0,E.jsx)(`div`,{className:`flex justify-center overflow-x-auto px-3 py-3 [&_svg]:max-w-full [&_svg]:h-auto`,dangerouslySetInnerHTML:{__html:tE(i)}})}var rE={note:{label:`Note`,Icon:ce},tip:{label:`Tip`,Icon:t},important:{label:`Important`,Icon:de},warning:{label:`Warning`,Icon:u},caution:{label:`Caution`,Icon:fe}},iE=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i;function aE(e){let t=Array.isArray(e)?e:typeof e==`string`?e.split(/\s+/):[];if(!t.includes(`markdown-alert`))return null;for(let e of Object.keys(rE))if(t.includes(`markdown-alert-${e}`))return e;return null}function oE(){function e(e){let t=e.children?.find(e=>e.type===`element`&&e.tagName===`p`),n=t?.children?.[0];if(!t||!n||n.type!==`text`||typeof n.value!=`string`)return;let r=iE.exec(n.value);if(!r)return;let i=r[1].toLowerCase(),a=n.value.slice(r[0].length).replace(/^[^\S\n]*\n?/,``);if(a)n.value=a;else{t.children.shift();let n=t.children[0];(n&&n.type===`text`&&typeof n.value==`string`&&/^\s+$/.test(n.value)||n&&n.type===`element`&&n.tagName===`br`)&&t.children.shift(),t.children.length===0&&(e.children=e.children.filter(e=>e!==t))}e.properties=e.properties??{},e.properties.className=[`markdown-alert`,`markdown-alert-${i}`]}function t(n){if(n.children)for(let r of n.children)r.type===`element`&&r.tagName===`blockquote`&&e(r),t(r)}return e=>t(e)}function sE(e,t){if(!e||e.startsWith(`#`)||/^[a-z][a-z\d+\-.]*:/i.test(e))return null;try{let n=new URL(e,`http://x/${t}`);if(n.host!==`x`)return null;let r=n.pathname.slice(1);return r?{path:r,hash:n.hash}:null}catch{return null}}function cE(e,t,n){if(!e||/^[a-z][a-z\d+\-.]*:/i.test(e)||e.startsWith(`#`)||e.startsWith(`/`))return e;let r=sE(e,n);return r?t(r.path):e}function lE(e){if(typeof e!=`string`||e.trim()===``)return!0;if(/prefers-color-scheme:\s*dark/i.test(e))return!1;if(/prefers-color-scheme:\s*light/i.test(e))return!0;if(typeof window<`u`&&typeof window.matchMedia==`function`)try{return window.matchMedia(e).matches}catch{return!0}return!0}function uE(e,t,n){let r=Array.isArray(e)?e.join(`, `):typeof e==`string`?e:``;if(r)return r.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let[r,...i]=e.split(/\s+/);return[cE(r,t,n),...i].join(` `).trim()}).join(`, `)}function dE(e){return T.Children.toArray(e).map(e=>typeof e==`string`?e:(0,T.isValidElement)(e)?dE(e.props.children):``).join(``)}function fE(e,t){return function({children:n,node:r,className:i,...a}){let o=r?.position?.start?.line,s=(typeof o==`number`?t.get(o):void 0)??xT(dE(n));return(0,E.jsxs)(e,{...a,id:s,onClick:()=>{DT(s)},className:[`group relative cursor-pointer`,i].filter(Boolean).join(` `),children:[(0,E.jsx)(NT,{id:s}),n]})}}function pE(e){return{h1:fE(`h1`,e),h2:fE(`h2`,e),h3:fE(`h3`,e),h4:fE(`h4`,e),h5:fE(`h5`,e),h6:fE(`h6`,e)}}var mE=[`div`,`p`,`span`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`td`,`th`],hE={...cw,tagNames:[...cw.tagNames??[],`picture`,`source`,`details`,`summary`],attributes:{...cw.attributes,source:[`srcSet`,`srcset`,`media`,`type`,`sizes`,`width`,`height`],img:[...cw.attributes?.img??[],`align`,`width`,`height`,`loading`],details:[...cw.attributes?.details??[],`open`],blockquote:[...cw.attributes?.blockquote??[],[`className`,`markdown-alert`,`markdown-alert-note`,`markdown-alert-tip`,`markdown-alert-important`,`markdown-alert-warning`,`markdown-alert-caution`]],...Object.fromEntries(mE.map(e=>[e,[...cw.attributes?.[e]??[],`align`]]))}};function gE(e,t,n){return function({href:r,children:i,...a}){let o=S();if(!r||r.startsWith(`#`))return(0,E.jsx)(`a`,{href:r,...a,onClick:e=>{!r||r===`#`||(e.preventDefault(),n.current?.scrollToHash(r.slice(1)))},children:i});if(/^[a-z][a-z\d+\-.]*:/i.test(r))return(0,E.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,...a,children:i});let s=sE(r,t);if(!s)return(0,E.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,...a,children:i});let c=e.browsePath(s.path)+s.hash;return(0,E.jsx)(`a`,{href:c,onClick:e=>{e.preventDefault(),o(c)},...a,children:i})}}function _E({id:e,filePath:t,file:i,loading:a,error:o,links:s,mode:c,onModeChange:l}){let u=(0,T.useMemo)(()=>s??{rawPath:t=>b(e,t),browsePath:t=>r({id:e,filePath:t})},[s,e]),d=u.rawPath(t),f=(0,T.useRef)(null),p=(0,T.useRef)(null),{entries:m,body:h}=(0,T.useMemo)(()=>i?.kind!==`markdown`||!i.content?{entries:null,body:``}:JT(i.content),[i]),g=(0,T.useMemo)(()=>i?.kind!==`markdown`||!h?[]:OT(h),[i,h]),_=(0,T.useMemo)(()=>h?kT(h):``,[h]),v=(0,T.useMemo)(()=>new Map(g.map(e=>[e.line,e.id])),[g]),y=(0,T.useMemo)(()=>g.map(e=>e.id),[g]),[x,S]=(0,T.useState)(null),C=g.length>=3,ee=g.length?Math.min(...g.map(e=>e.depth)):1,[ne,re]=(0,T.useState)(()=>jT(window.location.hash)?`code`:BT()),ie=c!==void 0&&l!==void 0,w=ie?c:ne,ae=(0,T.useCallback)(e=>{ie&&l?l(e):(re(e),VT(e))},[ie,l]),oe=i?.kind===`markdown`&&w===`code`,se=(0,T.useRef)(null),ce=(0,T.useCallback)(e=>{se.current={id:e,until:Date.now()+2e3}},[]),le=(0,T.useCallback)(e=>{let t=ET(e,y)??e,n=document.getElementById(t);return n?.id?(ce(n.id),n.scrollIntoView({behavior:`smooth`}),DT(n.id),S(n.id),!0):!1},[ce,y]);(0,T.useEffect)(()=>{p.current={scrollToHash:le}},[le]),(0,T.useEffect)(()=>{if(i?.kind!==`markdown`||w!==`preview`)return;let e=window.location.hash.slice(1);if(!e)return;let t=ET(e,y)??e,n=document.getElementById(t);if(n){ce(n.id);let e=setTimeout(()=>{g.some(e=>e.id===n.id)&&S(n.id),n.scrollIntoView({behavior:`smooth`}),DT(n.id)},100);return()=>clearTimeout(e)}},[i,w,g,y,ce]),(0,T.useEffect)(()=>{if(i?.kind!==`markdown`||w!==`preview`)return;let e=f.current;if(!e)return;let t=e,n=()=>Array.from(t.querySelectorAll(`h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]`)),r=0;function a(e){r=0;let i=n();if(i.length===0)return;let a=t.getBoundingClientRect().top+24,o=i[0];for(let e of i)if(e.getBoundingClientRect().top<=a)o=e;else break;if(!o?.id)return;let s=se.current;if(s&&Date.now()<s.until){if(o.id!==s.id)return;se.current=null}else se.current=null;e&&DT(o.id),S(o.id)}function o(){r||=window.requestAnimationFrame(()=>a(!0))}let s=window.location.hash.slice(1);return s&&(ET(s,y)??(n().some(e=>e.id===s)?s:null))||(r=window.requestAnimationFrame(()=>a(!1))),t.addEventListener(`scroll`,o,{passive:!0}),()=>{t.removeEventListener(`scroll`,o),r&&window.cancelAnimationFrame(r)}},[i,w,y]);let ue=(0,T.useMemo)(()=>({a:gE(u,t,p),...pE(v),img:({src:e,alt:n})=>{let r=e??``;if(r&&!/^[a-z][a-z\d+\-.]*:/i.test(r)&&!r.startsWith(`#`)){let e=sE(r,t);e&&(r=u.rawPath(e.path))}return(0,E.jsx)(QT,{src:r,alt:n??``})},picture:({node:e})=>{let n=null,r=null;for(let i of e?.children??[]){if(i.type!==`element`)continue;let e=i.properties??{};if(i.tagName===`source`&&!n&&lE(e.media)){let r=uE(e.srcSet??e.srcset,u.rawPath,t),i=r?r.split(`,`)[0]?.trim().split(/\s+/)[0]:``;i&&(n=i)}else i.tagName===`img`&&!r&&(r={src:cE(typeof e.src==`string`?e.src:``,u.rawPath,t),alt:typeof e.alt==`string`?e.alt:``,width:e.width==null?void 0:String(e.width)})}let i=n??r?.src;return i?(0,E.jsx)(`img`,{src:i,alt:r?.alt??``,width:r?.width,className:`inline-block h-auto max-w-full`}):null},blockquote:({node:e,children:t,...n})=>{let r=aE(e?.properties?.className);if(!r)return(0,E.jsx)(`blockquote`,{...n,children:t});let{label:i,Icon:a}=rE[r];return(0,E.jsxs)(`blockquote`,{className:`markdown-alert markdown-alert-${r}`,children:[(0,E.jsxs)(`p`,{className:`markdown-alert-title`,children:[(0,E.jsx)(a,{className:`h-4 w-4 shrink-0`,strokeWidth:2,"aria-hidden":`true`}),i]}),t]})},table:({children:e,...t})=>(0,E.jsx)(`div`,{className:`overflow-x-auto`,children:(0,E.jsx)(`table`,{...t,children:e})}),pre:({children:e})=>{let t=dE(e),n=``,r=T.Children.toArray(e)[0];if((0,T.isValidElement)(r)){let e=(r.props.className??``).match(/language-(\S+)/);e&&(n=e[1])}return n===`mermaid`?(0,E.jsxs)(`div`,{className:`kb-markdown-code-block group`,children:[(0,E.jsxs)(`div`,{className:`chrome flex min-h-9 items-center justify-between gap-2 border-b border-border-soft/70 bg-surface-raised/45 px-2 py-1`,children:[(0,E.jsx)(`span`,{className:`rounded-sm px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-text-subtle`,children:`mermaid`}),(0,E.jsx)(MT,{text:t,variant:`inline`})]}),(0,E.jsx)(nE,{code:t.replace(/\n$/,``)})]}):(0,E.jsxs)(`div`,{className:`kb-markdown-code-block group`,children:[(0,E.jsxs)(`div`,{className:`chrome flex min-h-9 items-center justify-between gap-2 border-b border-border-soft/70 bg-surface-raised/45 px-2 py-1`,children:[n?(0,E.jsx)(`span`,{className:`rounded-sm px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-text-subtle`,children:n}):(0,E.jsx)(`span`,{"aria-hidden":`true`}),(0,E.jsx)(MT,{text:t,variant:`inline`})]}),(0,E.jsx)(bT,{code:t.replace(/\n$/,``),language:n||`text`,theme:Uw.github,children:({className:e,style:t,tokens:n,getLineProps:r,getTokenProps:i})=>(0,E.jsx)(`pre`,{className:`${e} font-mono text-[0.82em] leading-[1.55]`,style:{...t,background:`transparent`,margin:0},children:n.map((e,t)=>(0,E.jsx)(`div`,{...r({line:e}),children:e.map((e,t)=>(0,E.jsx)(`span`,{...i({token:e})},t))},t))})})]})}}),[v,u,t]);if(o)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-health-error`,children:[`Could not open `,(0,E.jsx)(`span`,{className:`font-mono`,children:t}),`: `,o.message]});if(a||!i)return(0,E.jsx)(`div`,{className:`p-6 font-sans text-[13px] text-text-subtle`,children:`Loading…`});if(i.kind===`html`)return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsx)(`div`,{className:`flex h-8 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,title:`Open the full-width report in a new tab`,className:`chrome flex items-center gap-1 rounded-sm px-2 py-0.5 text-[10px] uppercase tracking-[0.08em] text-text-subtle transition-colors hover:bg-surface-elevated hover:text-text-muted`,children:[(0,E.jsx)(n,{className:`h-3 w-3`}),`Open full page`]})}),(0,E.jsx)(`iframe`,{title:i.name,src:d,sandbox:`allow-scripts`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]});if(i.kind===`image`)return(0,E.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,E.jsx)(`div`,{className:`flex flex-1 items-center justify-center overflow-auto bg-surface-elevated/30 p-6`,children:(0,E.jsx)(QT,{src:d,alt:i.name})})});if(i.kind===`pdf`)return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsx)(`div`,{className:`flex h-8 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,title:`Open the PDF in a new tab`,className:`chrome flex items-center gap-1 rounded-sm px-2 py-0.5 text-[10px] uppercase tracking-[0.08em] text-text-subtle transition-colors hover:bg-surface-elevated hover:text-text-muted`,children:[(0,E.jsx)(n,{className:`h-3 w-3`}),`Open full page`]})}),(0,E.jsx)(`iframe`,{title:i.name,src:d,className:`min-h-0 w-full flex-1 border-0 bg-surface-elevated/30`})]});if(i.truncated)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-text-muted`,children:[`This file is too large to inline (`,te(i.size),`).`,` `,(0,E.jsx)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`text-accent underline underline-offset-2`,children:`Open raw`})]});if(i.kind===`binary`||i.content===void 0)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-text-muted`,children:[`Binary file (`,te(i.size),`).`,` `,(0,E.jsx)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`text-accent underline underline-offset-2`,children:`Open raw`})]});if(i.kind===`markdown`)return(0,E.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[!ie&&(0,E.jsx)(`div`,{className:`flex h-9 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsx)(RT,{mode:w,onChange:ae})}),oe?(0,E.jsx)(GT,{body:i.content,language:`markdown`}):(0,E.jsx)(`div`,{ref:f,className:`@container min-h-0 flex-1 overflow-y-auto px-6 py-6 md:px-10 md:py-10`,children:(0,E.jsxs)(`div`,{className:[`mx-auto flex w-full max-w-[1024px] gap-12`,C?`@min-[1372px]:max-w-[1292px]`:``].join(` `),children:[(0,E.jsxs)(`div`,{className:`w-full min-w-0 max-w-[1024px] flex-1`,children:[m&&(0,E.jsx)(ZT,{entries:m}),(0,E.jsx)(`div`,{className:`md-prose`,children:(0,E.jsx)(Hm,{remarkPlugins:[J_,ov,lv],rehypePlugins:[bC,oE,[Tw,hE],ow],components:ue,children:_})})]}),C&&(0,E.jsxs)(`nav`,{"aria-label":`On this page`,className:`sticky top-2 hidden w-[220px] shrink-0 self-start @min-[1372px]:block`,children:[(0,E.jsx)(`div`,{className:`chrome mb-3 text-[11px] uppercase tracking-[0.14em] text-text-muted`,children:`On this page`}),(0,E.jsx)(`ul`,{className:`space-y-2 border-l border-border-soft pl-3`,children:g.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsx)(`a`,{href:`#${e.id}`,onClick:t=>{t.preventDefault(),ce(e.id),document.getElementById(e.id)?.scrollIntoView({behavior:`smooth`}),DT(e.id),S(e.id)},className:[`block truncate font-sans text-[14px] leading-snug transition-colors`,x===e.id?`text-accent`:`text-text-muted hover:text-text`].join(` `),style:{paddingLeft:`${(e.depth-ee)*12}px`},children:e.text})},`${e.id}-${e.line}`))})]})]})})]});let de=i.kind===`json`?`json`:i.language??`text`,fe=i.content;if(i.kind===`json`)try{fe=JSON.stringify(JSON.parse(i.content),null,2)}catch{}return(0,E.jsx)(GT,{body:fe,language:de})}export{FT as a,OT as c,ic as d,Qs as f,PT as i,jT as l,me as m,BT as n,IT as o,Ks as p,VT as r,RT as s,_E as t,rc as u};
302
+ `).trimEnd()})}function ZT({entries:e}){return(0,E.jsx)(`div`,{className:`mb-5 overflow-hidden rounded-sm border border-border-soft bg-surface-raised/30`,children:(0,E.jsx)(`table`,{className:`m-0 w-full border-collapse text-left align-top`,children:(0,E.jsx)(`tbody`,{children:e.map((e,t)=>(0,E.jsxs)(`tr`,{className:t>0?`border-t border-border-soft/70`:void 0,children:[(0,E.jsx)(`th`,{scope:`row`,className:`w-px whitespace-nowrap border-r border-border-soft/70 bg-surface-raised/40 px-3 py-2 align-top font-sans text-[11px] font-semibold uppercase tracking-wide text-text-subtle`,children:e.key}),(0,E.jsx)(`td`,{className:`px-3 py-2 align-top font-mono text-[12px] text-text`,children:e.block?(0,E.jsx)(XT,{block:e.block}):(0,E.jsx)(`span`,{className:`break-words`,children:e.value})})]},e.key+t))})})})}function QT({src:e,alt:t}){let[n,r]=(0,T.useState)(!1),i=(0,T.useRef)(null),a=(0,T.useRef)(null),o=(0,T.useCallback)(()=>{a.current=document.activeElement instanceof HTMLElement?document.activeElement:null,r(!0)},[]),c=(0,T.useCallback)(()=>{r(!1)},[]);return(0,T.useEffect)(()=>{if(!n)return;function e(e){e.key===`Escape`?c():e.key===`Tab`&&(e.preventDefault(),i.current?.focus())}return i.current?.focus(),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),a.current?.focus()}},[c,n]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`img`,{src:e,alt:t,onClick:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},role:`button`,tabIndex:0,"aria-label":t?`Open image: ${t}`:`Open image`,className:`max-w-full cursor-zoom-in rounded`}),n&&(0,E.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":t?`Image preview: ${t}`:`Image preview`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4`,onClick:c,children:[(0,E.jsx)(`button`,{ref:i,onClick:e=>{e.stopPropagation(),c()},"aria-label":`Close image preview`,title:`Close`,className:`chrome absolute right-4 top-4 flex min-h-[44px] min-w-[44px] items-center justify-center rounded-sm bg-black/40 text-white transition-colors hover:bg-black/60 focus-visible:bg-black/60`,children:(0,E.jsx)(s,{className:`h-4 w-4`})}),(0,E.jsx)(`img`,{src:e,alt:t,className:`max-h-full max-w-full object-contain`,onClick:e=>e.stopPropagation()}),t&&(0,E.jsx)(`div`,{className:`chrome absolute bottom-4 left-4 right-4 rounded-sm bg-black/45 px-3 py-2 text-center text-[12px] text-white/85`,children:t})]})]})}var $T=null;function eE(){return $T||=x(async()=>{let{default:e}=await import(`./mermaid.core-BhLaljEz.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`neutral`,htmlLabels:!1,flowchart:{htmlLabels:!1}}),e)),$T}function tE(e){return Ks.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:[`foreignObject`,`img`,`image`,`script`,`iframe`,`object`,`embed`,`a`,`audio`,`video`,`source`,`link`,`base`],FORBID_ATTR:[`href`,`xlink:href`,`src`,`onerror`,`onload`,`onclick`]})}function nE({code:e}){let t=(0,T.useId)(),[n,r]=(0,T.useState)({svg:null,failed:!1});(0,T.useEffect)(()=>{let n=!1,i=`mermaid-${t.replace(/[^a-zA-Z0-9_-]/g,``)}`;return eE().then(t=>t.render(i,e)).then(({svg:e})=>{n||r({svg:e,failed:!1})}).catch(()=>{n||r({svg:null,failed:!0})}),()=>{n=!0}},[e,t]);let{svg:i,failed:a}=n;return a?(0,E.jsx)(`pre`,{className:`font-mono text-[0.82em] leading-[1.55] text-text-muted`,style:{background:`transparent`,margin:0},children:e}):i===null?(0,E.jsx)(`div`,{className:`px-3 py-4 text-[0.82em] text-text-subtle`,children:`Rendering diagram…`}):(0,E.jsx)(`div`,{className:`flex justify-center overflow-x-auto px-3 py-3 [&_svg]:max-w-full [&_svg]:h-auto`,dangerouslySetInnerHTML:{__html:tE(i)}})}var rE={note:{label:`Note`,Icon:ce},tip:{label:`Tip`,Icon:t},important:{label:`Important`,Icon:de},warning:{label:`Warning`,Icon:u},caution:{label:`Caution`,Icon:fe}},iE=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i;function aE(e){let t=Array.isArray(e)?e:typeof e==`string`?e.split(/\s+/):[];if(!t.includes(`markdown-alert`))return null;for(let e of Object.keys(rE))if(t.includes(`markdown-alert-${e}`))return e;return null}function oE(){function e(e){let t=e.children?.find(e=>e.type===`element`&&e.tagName===`p`),n=t?.children?.[0];if(!t||!n||n.type!==`text`||typeof n.value!=`string`)return;let r=iE.exec(n.value);if(!r)return;let i=r[1].toLowerCase(),a=n.value.slice(r[0].length).replace(/^[^\S\n]*\n?/,``);if(a)n.value=a;else{t.children.shift();let n=t.children[0];(n&&n.type===`text`&&typeof n.value==`string`&&/^\s+$/.test(n.value)||n&&n.type===`element`&&n.tagName===`br`)&&t.children.shift(),t.children.length===0&&(e.children=e.children.filter(e=>e!==t))}e.properties=e.properties??{},e.properties.className=[`markdown-alert`,`markdown-alert-${i}`]}function t(n){if(n.children)for(let r of n.children)r.type===`element`&&r.tagName===`blockquote`&&e(r),t(r)}return e=>t(e)}function sE(e,t){if(!e||e.startsWith(`#`)||/^[a-z][a-z\d+\-.]*:/i.test(e))return null;try{let n=new URL(e,`http://x/${t}`);if(n.host!==`x`)return null;let r=n.pathname.slice(1);return r?{path:r,hash:n.hash}:null}catch{return null}}function cE(e,t,n){if(!e||/^[a-z][a-z\d+\-.]*:/i.test(e)||e.startsWith(`#`)||e.startsWith(`/`))return e;let r=sE(e,n);return r?t(r.path):e}function lE(e){if(typeof e!=`string`||e.trim()===``)return!0;if(/prefers-color-scheme:\s*dark/i.test(e))return!1;if(/prefers-color-scheme:\s*light/i.test(e))return!0;if(typeof window<`u`&&typeof window.matchMedia==`function`)try{return window.matchMedia(e).matches}catch{return!0}return!0}function uE(e,t,n){let r=Array.isArray(e)?e.join(`, `):typeof e==`string`?e:``;if(r)return r.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let[r,...i]=e.split(/\s+/);return[cE(r,t,n),...i].join(` `).trim()}).join(`, `)}function dE(e){return T.Children.toArray(e).map(e=>typeof e==`string`?e:(0,T.isValidElement)(e)?dE(e.props.children):``).join(``)}function fE(e,t){return function({children:n,node:r,className:i,...a}){let o=r?.position?.start?.line,s=(typeof o==`number`?t.get(o):void 0)??xT(dE(n));return(0,E.jsxs)(e,{...a,id:s,onClick:()=>{DT(s)},className:[`group relative cursor-pointer`,i].filter(Boolean).join(` `),children:[(0,E.jsx)(NT,{id:s}),n]})}}function pE(e){return{h1:fE(`h1`,e),h2:fE(`h2`,e),h3:fE(`h3`,e),h4:fE(`h4`,e),h5:fE(`h5`,e),h6:fE(`h6`,e)}}var mE=[`div`,`p`,`span`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`td`,`th`],hE={...cw,tagNames:[...cw.tagNames??[],`picture`,`source`,`details`,`summary`],attributes:{...cw.attributes,source:[`srcSet`,`srcset`,`media`,`type`,`sizes`,`width`,`height`],img:[...cw.attributes?.img??[],`align`,`width`,`height`,`loading`],details:[...cw.attributes?.details??[],`open`],blockquote:[...cw.attributes?.blockquote??[],[`className`,`markdown-alert`,`markdown-alert-note`,`markdown-alert-tip`,`markdown-alert-important`,`markdown-alert-warning`,`markdown-alert-caution`]],...Object.fromEntries(mE.map(e=>[e,[...cw.attributes?.[e]??[],`align`]]))}};function gE(e,t,n){return function({href:r,children:i,...a}){let o=S();if(!r||r.startsWith(`#`))return(0,E.jsx)(`a`,{href:r,...a,onClick:e=>{!r||r===`#`||(e.preventDefault(),n.current?.scrollToHash(r.slice(1)))},children:i});if(/^[a-z][a-z\d+\-.]*:/i.test(r))return(0,E.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,...a,children:i});let s=sE(r,t);if(!s)return(0,E.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,...a,children:i});let c=e.browsePath(s.path)+s.hash;return(0,E.jsx)(`a`,{href:c,onClick:e=>{e.preventDefault(),o(c)},...a,children:i})}}function _E({id:e,filePath:t,file:i,loading:a,error:o,links:s,mode:c,onModeChange:l}){let u=(0,T.useMemo)(()=>s??{rawPath:t=>b(e,t),browsePath:t=>r({id:e,filePath:t})},[s,e]),d=u.rawPath(t),f=(0,T.useRef)(null),p=(0,T.useRef)(null),{entries:m,body:h}=(0,T.useMemo)(()=>i?.kind!==`markdown`||!i.content?{entries:null,body:``}:JT(i.content),[i]),g=(0,T.useMemo)(()=>i?.kind!==`markdown`||!h?[]:OT(h),[i,h]),_=(0,T.useMemo)(()=>h?kT(h):``,[h]),v=(0,T.useMemo)(()=>new Map(g.map(e=>[e.line,e.id])),[g]),y=(0,T.useMemo)(()=>g.map(e=>e.id),[g]),[x,S]=(0,T.useState)(null),C=g.length>=3,ee=g.length?Math.min(...g.map(e=>e.depth)):1,[ne,re]=(0,T.useState)(()=>jT(window.location.hash)?`code`:BT()),ie=c!==void 0&&l!==void 0,w=ie?c:ne,ae=(0,T.useCallback)(e=>{ie&&l?l(e):(re(e),VT(e))},[ie,l]),oe=i?.kind===`markdown`&&w===`code`,se=(0,T.useRef)(null),ce=(0,T.useCallback)(e=>{se.current={id:e,until:Date.now()+2e3}},[]),le=(0,T.useCallback)(e=>{let t=ET(e,y)??e,n=document.getElementById(t);return n?.id?(ce(n.id),n.scrollIntoView({behavior:`smooth`}),DT(n.id),S(n.id),!0):!1},[ce,y]);(0,T.useEffect)(()=>{p.current={scrollToHash:le}},[le]),(0,T.useEffect)(()=>{if(i?.kind!==`markdown`||w!==`preview`)return;let e=window.location.hash.slice(1);if(!e)return;let t=ET(e,y)??e,n=document.getElementById(t);if(n){ce(n.id);let e=setTimeout(()=>{g.some(e=>e.id===n.id)&&S(n.id),n.scrollIntoView({behavior:`smooth`}),DT(n.id)},100);return()=>clearTimeout(e)}},[i,w,g,y,ce]),(0,T.useEffect)(()=>{if(i?.kind!==`markdown`||w!==`preview`)return;let e=f.current;if(!e)return;let t=e,n=()=>Array.from(t.querySelectorAll(`h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]`)),r=0;function a(e){r=0;let i=n();if(i.length===0)return;let a=t.getBoundingClientRect().top+24,o=i[0];for(let e of i)if(e.getBoundingClientRect().top<=a)o=e;else break;if(!o?.id)return;let s=se.current;if(s&&Date.now()<s.until){if(o.id!==s.id)return;se.current=null}else se.current=null;e&&DT(o.id),S(o.id)}function o(){r||=window.requestAnimationFrame(()=>a(!0))}let s=window.location.hash.slice(1);return s&&(ET(s,y)??(n().some(e=>e.id===s)?s:null))||(r=window.requestAnimationFrame(()=>a(!1))),t.addEventListener(`scroll`,o,{passive:!0}),()=>{t.removeEventListener(`scroll`,o),r&&window.cancelAnimationFrame(r)}},[i,w,y]);let ue=(0,T.useMemo)(()=>({a:gE(u,t,p),...pE(v),img:({src:e,alt:n})=>{let r=e??``;if(r&&!/^[a-z][a-z\d+\-.]*:/i.test(r)&&!r.startsWith(`#`)){let e=sE(r,t);e&&(r=u.rawPath(e.path))}return(0,E.jsx)(QT,{src:r,alt:n??``})},picture:({node:e})=>{let n=null,r=null;for(let i of e?.children??[]){if(i.type!==`element`)continue;let e=i.properties??{};if(i.tagName===`source`&&!n&&lE(e.media)){let r=uE(e.srcSet??e.srcset,u.rawPath,t),i=r?r.split(`,`)[0]?.trim().split(/\s+/)[0]:``;i&&(n=i)}else i.tagName===`img`&&!r&&(r={src:cE(typeof e.src==`string`?e.src:``,u.rawPath,t),alt:typeof e.alt==`string`?e.alt:``,width:e.width==null?void 0:String(e.width)})}let i=n??r?.src;return i?(0,E.jsx)(`img`,{src:i,alt:r?.alt??``,width:r?.width,className:`inline-block h-auto max-w-full`}):null},blockquote:({node:e,children:t,...n})=>{let r=aE(e?.properties?.className);if(!r)return(0,E.jsx)(`blockquote`,{...n,children:t});let{label:i,Icon:a}=rE[r];return(0,E.jsxs)(`blockquote`,{className:`markdown-alert markdown-alert-${r}`,children:[(0,E.jsxs)(`p`,{className:`markdown-alert-title`,children:[(0,E.jsx)(a,{className:`h-4 w-4 shrink-0`,strokeWidth:2,"aria-hidden":`true`}),i]}),t]})},table:({children:e,...t})=>(0,E.jsx)(`div`,{className:`overflow-x-auto`,children:(0,E.jsx)(`table`,{...t,children:e})}),pre:({children:e})=>{let t=dE(e),n=``,r=T.Children.toArray(e)[0];if((0,T.isValidElement)(r)){let e=(r.props.className??``).match(/language-(\S+)/);e&&(n=e[1])}return n===`mermaid`?(0,E.jsxs)(`div`,{className:`kb-markdown-code-block group`,children:[(0,E.jsxs)(`div`,{className:`chrome flex min-h-9 items-center justify-between gap-2 border-b border-border-soft/70 bg-surface-raised/45 px-2 py-1`,children:[(0,E.jsx)(`span`,{className:`rounded-sm px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-text-subtle`,children:`mermaid`}),(0,E.jsx)(MT,{text:t,variant:`inline`})]}),(0,E.jsx)(nE,{code:t.replace(/\n$/,``)})]}):(0,E.jsxs)(`div`,{className:`kb-markdown-code-block group`,children:[(0,E.jsxs)(`div`,{className:`chrome flex min-h-9 items-center justify-between gap-2 border-b border-border-soft/70 bg-surface-raised/45 px-2 py-1`,children:[n?(0,E.jsx)(`span`,{className:`rounded-sm px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-text-subtle`,children:n}):(0,E.jsx)(`span`,{"aria-hidden":`true`}),(0,E.jsx)(MT,{text:t,variant:`inline`})]}),(0,E.jsx)(bT,{code:t.replace(/\n$/,``),language:n||`text`,theme:Uw.github,children:({className:e,style:t,tokens:n,getLineProps:r,getTokenProps:i})=>(0,E.jsx)(`pre`,{className:`${e} font-mono text-[0.82em] leading-[1.55]`,style:{...t,background:`transparent`,margin:0},children:n.map((e,t)=>(0,E.jsx)(`div`,{...r({line:e}),children:e.map((e,t)=>(0,E.jsx)(`span`,{...i({token:e})},t))},t))})})]})}}),[v,u,t]);if(o)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-health-error`,children:[`Could not open `,(0,E.jsx)(`span`,{className:`font-mono`,children:t}),`: `,o.message]});if(a||!i)return(0,E.jsx)(`div`,{className:`p-6 font-sans text-[13px] text-text-subtle`,children:`Loading…`});if(i.kind===`html`)return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsx)(`div`,{className:`flex h-8 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,title:`Open the full-width report in a new tab`,className:`chrome flex items-center gap-1 rounded-sm px-2 py-0.5 text-[10px] uppercase tracking-[0.08em] text-text-subtle transition-colors hover:bg-surface-elevated hover:text-text-muted`,children:[(0,E.jsx)(n,{className:`h-3 w-3`}),`Open full page`]})}),(0,E.jsx)(`iframe`,{title:i.name,src:d,sandbox:`allow-scripts`,className:`min-h-0 w-full flex-1 border-0 bg-white`})]});if(i.kind===`image`)return(0,E.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,E.jsx)(`div`,{className:`flex flex-1 items-center justify-center overflow-auto bg-surface-elevated/30 p-6`,children:(0,E.jsx)(QT,{src:d,alt:i.name})})});if(i.kind===`pdf`)return(0,E.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,E.jsx)(`div`,{className:`flex h-8 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,title:`Open the PDF in a new tab`,className:`chrome flex items-center gap-1 rounded-sm px-2 py-0.5 text-[10px] uppercase tracking-[0.08em] text-text-subtle transition-colors hover:bg-surface-elevated hover:text-text-muted`,children:[(0,E.jsx)(n,{className:`h-3 w-3`}),`Open full page`]})}),(0,E.jsx)(`iframe`,{title:i.name,src:d,className:`min-h-0 w-full flex-1 border-0 bg-surface-elevated/30`})]});if(i.truncated)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-text-muted`,children:[`This file is too large to inline (`,te(i.size),`).`,` `,(0,E.jsx)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`text-accent underline underline-offset-2`,children:`Open raw`})]});if(i.kind===`binary`||i.content===void 0)return(0,E.jsxs)(`div`,{className:`p-6 font-sans text-[13px] text-text-muted`,children:[`Binary file (`,te(i.size),`).`,` `,(0,E.jsx)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`text-accent underline underline-offset-2`,children:`Open raw`})]});if(i.kind===`markdown`)return(0,E.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[!ie&&(0,E.jsx)(`div`,{className:`flex h-9 shrink-0 items-center justify-end border-b border-border-soft px-3`,children:(0,E.jsx)(RT,{mode:w,onChange:ae})}),oe?(0,E.jsx)(GT,{body:i.content,language:`markdown`}):(0,E.jsx)(`div`,{ref:f,className:`@container min-h-0 flex-1 overflow-y-auto px-6 py-6 md:px-10 md:py-10`,children:(0,E.jsxs)(`div`,{className:[`mx-auto flex w-full max-w-[1024px] gap-12`,C?`@min-[1372px]:max-w-[1292px]`:``].join(` `),children:[(0,E.jsxs)(`div`,{className:`w-full min-w-0 max-w-[1024px] flex-1`,children:[m&&(0,E.jsx)(ZT,{entries:m}),(0,E.jsx)(`div`,{className:`md-prose`,children:(0,E.jsx)(Hm,{remarkPlugins:[J_,ov,lv],rehypePlugins:[bC,oE,[Tw,hE],ow],components:ue,children:_})})]}),C&&(0,E.jsxs)(`nav`,{"aria-label":`On this page`,className:`sticky top-2 hidden w-[220px] shrink-0 self-start @min-[1372px]:block`,children:[(0,E.jsx)(`div`,{className:`chrome mb-3 text-[11px] uppercase tracking-[0.14em] text-text-muted`,children:`On this page`}),(0,E.jsx)(`ul`,{className:`space-y-2 border-l border-border-soft pl-3`,children:g.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsx)(`a`,{href:`#${e.id}`,onClick:t=>{t.preventDefault(),ce(e.id),document.getElementById(e.id)?.scrollIntoView({behavior:`smooth`}),DT(e.id),S(e.id)},className:[`block truncate font-sans text-[14px] leading-snug transition-colors`,x===e.id?`text-accent`:`text-text-muted hover:text-text`].join(` `),style:{paddingLeft:`${(e.depth-ee)*12}px`},children:e.text})},`${e.id}-${e.line}`))})]})]})})]});let de=i.kind===`json`?`json`:i.language??`text`,fe=i.content;if(i.kind===`json`)try{fe=JSON.stringify(JSON.parse(i.content),null,2)}catch{}return(0,E.jsx)(GT,{body:fe,language:de})}export{FT as a,OT as c,ic as d,Qs as f,PT as i,jT as l,me as m,BT as n,IT as o,Ks as p,VT as r,RT as s,_E as t,rc as u};