@syntrologie/runtime-sdk 2.8.0-canary.7 → 2.8.0-canary.71

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 (62) hide show
  1. package/CAPABILITIES.md +299 -167
  2. package/README.md +2 -0
  3. package/dist/actions/schema.d.ts +783 -783
  4. package/dist/actions/schema.js +3 -3
  5. package/dist/actions/types.d.ts +1 -1
  6. package/dist/actions/validation-core.d.ts +24 -0
  7. package/dist/actions/validation-rules.d.ts +74 -0
  8. package/dist/actions/validation.d.ts +5 -11
  9. package/dist/bootstrap-init.d.ts +33 -0
  10. package/dist/bootstrap-runtime.d.ts +7 -0
  11. package/dist/bootstrap-types.d.ts +90 -0
  12. package/dist/bootstrap.d.ts +19 -83
  13. package/dist/{chunk-R5DNAIRI.js → chunk-77TNZ66J.js} +4 -4
  14. package/dist/{chunk-R5DNAIRI.js.map → chunk-77TNZ66J.js.map} +2 -2
  15. package/dist/{chunk-XDYJ64IN.js → chunk-IR6UOR63.js} +4 -4
  16. package/dist/chunk-IR6UOR63.js.map +7 -0
  17. package/dist/{chunk-GWF5BTST.js → chunk-WX32GVSP.js} +1855 -783
  18. package/dist/chunk-WX32GVSP.js.map +7 -0
  19. package/dist/chunk-YLLWLUQX.js +241 -0
  20. package/dist/chunk-YLLWLUQX.js.map +7 -0
  21. package/dist/components/ShadowCanvasOverlay.d.ts +1 -2
  22. package/dist/components/TileIcon.d.ts +2 -2
  23. package/dist/components/emojiToIcon.d.ts +24 -0
  24. package/dist/config/schema.d.ts +147 -136
  25. package/dist/config/schema.js +2 -2
  26. package/dist/decisions/schema.d.ts +47 -47
  27. package/dist/decisions/schema.js +1 -1
  28. package/dist/events/EventBus.d.ts +27 -1
  29. package/dist/events/history.d.ts +9 -0
  30. package/dist/events/index.d.ts +3 -0
  31. package/dist/events/normalizers/posthog.d.ts +4 -50
  32. package/dist/events/types.d.ts +30 -23
  33. package/dist/events/validation.d.ts +7 -0
  34. package/dist/fetchers/experimentsFetcher.d.ts +3 -3
  35. package/dist/index.d.ts +0 -2
  36. package/dist/index.js +1529 -212
  37. package/dist/index.js.map +4 -4
  38. package/dist/overlays/runtime/overlay/overlay-runner.d.ts +4 -0
  39. package/dist/overlays/runtime/overlay/overlay-state.d.ts +21 -0
  40. package/dist/overlays/types.d.ts +3 -1
  41. package/dist/react.js +6 -4
  42. package/dist/react.js.map +2 -2
  43. package/dist/smart-canvas.esm.js +115 -65
  44. package/dist/smart-canvas.esm.js.map +4 -4
  45. package/dist/smart-canvas.js +5901 -3064
  46. package/dist/smart-canvas.js.map +4 -4
  47. package/dist/smart-canvas.min.js +115 -65
  48. package/dist/smart-canvas.min.js.map +4 -4
  49. package/dist/telemetry/InterventionTracker.d.ts +23 -0
  50. package/dist/telemetry/adapters/posthog.d.ts +30 -4
  51. package/dist/telemetry/index.d.ts +1 -0
  52. package/dist/test/setup.d.ts +1 -0
  53. package/dist/token.d.ts +2 -0
  54. package/dist/version.d.ts +1 -1
  55. package/package.json +23 -28
  56. package/schema/canvas-config.schema.json +1974 -10925
  57. package/scripts/syntroReactPlugin.mjs +3 -0
  58. package/scripts/validate-config.mjs +42 -0
  59. package/dist/chunk-BU4Z6PD7.js +0 -218
  60. package/dist/chunk-BU4Z6PD7.js.map +0 -7
  61. package/dist/chunk-GWF5BTST.js.map +0 -7
  62. package/dist/chunk-XDYJ64IN.js.map +0 -7
package/dist/index.js CHANGED
@@ -7,7 +7,9 @@ import {
7
7
  DEFAULT_TTL,
8
8
  EVENT_SCHEMA_VERSION,
9
9
  EventBus,
10
+ EventHistory,
10
11
  ExecutorRegistry,
12
+ InterventionTracker,
11
13
  MAX_VISIBLE_TOASTS,
12
14
  NavigationMonitor,
13
15
  NotificationToastStack,
@@ -99,8 +101,10 @@ import {
99
101
  useViewportContext,
100
102
  validateAction,
101
103
  validateActions,
104
+ validateEventName,
105
+ validateProps,
102
106
  widgetRegistry
103
- } from "./chunk-GWF5BTST.js";
107
+ } from "./chunk-WX32GVSP.js";
104
108
  import {
105
109
  AddClassZ,
106
110
  AnchorIdZ,
@@ -134,8 +138,8 @@ import {
134
138
  WaitZ,
135
139
  WidgetConfigZ,
136
140
  coreActionStepSchemas
137
- } from "./chunk-R5DNAIRI.js";
138
- import "./chunk-XDYJ64IN.js";
141
+ } from "./chunk-77TNZ66J.js";
142
+ import "./chunk-IR6UOR63.js";
139
143
  import {
140
144
  ActivationConfigZ,
141
145
  AnchorVisibleConditionZ,
@@ -160,11 +164,12 @@ import {
160
164
  StateEqualsConditionZ,
161
165
  TriggerWhenZ,
162
166
  ViewportConditionZ,
167
+ __publicField,
163
168
  decisionSchemas,
164
169
  validateActivationConfig,
165
170
  validateCondition,
166
171
  validateStrategy
167
- } from "./chunk-BU4Z6PD7.js";
172
+ } from "./chunk-YLLWLUQX.js";
168
173
 
169
174
  // src/index.ts
170
175
  import React4 from "react";
@@ -275,7 +280,7 @@ function useChat(options) {
275
280
  const [error, setError] = useState(null);
276
281
  const batchHandleRef = useRef(null);
277
282
  const send = useCallback(async (text) => {
278
- var _a;
283
+ var _a2;
279
284
  const trimmed = text.trim();
280
285
  if (!trimmed)
281
286
  return;
@@ -290,9 +295,9 @@ function useChat(options) {
290
295
  setIsLoading(true);
291
296
  try {
292
297
  const currentMessages = [...messages, userMessage];
293
- const historySlice = currentMessages.slice(-maxHistory).map((m) => ({
294
- role: m.role,
295
- content: m.text
298
+ const historySlice = currentMessages.slice(-maxHistory).map((m2) => ({
299
+ role: m2.role,
300
+ content: m2.text
296
301
  }));
297
302
  const response = await sendMessage(backendUrl, {
298
303
  message: trimmed,
@@ -309,7 +314,7 @@ function useChat(options) {
309
314
  };
310
315
  setMessages((prev) => [...prev, assistantMessage]);
311
316
  if (actions.length > 0) {
312
- if ((_a = batchHandleRef.current) == null ? void 0 : _a.isApplied()) {
317
+ if ((_a2 = batchHandleRef.current) == null ? void 0 : _a2.isApplied()) {
313
318
  await batchHandleRef.current.revertAll();
314
319
  }
315
320
  batchHandleRef.current = await runtime7.actions.applyBatch(actions);
@@ -327,10 +332,10 @@ function useChat(options) {
327
332
  }
328
333
  }, [backendUrl, messages, maxHistory, mlflowRunId, config, runtime7, tileId]);
329
334
  const clearMessages = useCallback(() => {
330
- var _a;
335
+ var _a2;
331
336
  setMessages([]);
332
337
  setError(null);
333
- if ((_a = batchHandleRef.current) == null ? void 0 : _a.isApplied()) {
338
+ if ((_a2 = batchHandleRef.current) == null ? void 0 : _a2.isApplied()) {
334
339
  batchHandleRef.current.revertAll();
335
340
  batchHandleRef.current = null;
336
341
  }
@@ -538,7 +543,7 @@ function resolveItem(store, itemId, itemQuestion) {
538
543
  throw new Error("FAQ item not found");
539
544
  }
540
545
  async function executeScrollToFaq(action, context, store) {
541
- var _a;
546
+ var _a2;
542
547
  const item = resolveItem(store, action.itemId, action.itemQuestion);
543
548
  const { id } = item.config;
544
549
  if (action.expand !== false) {
@@ -547,7 +552,7 @@ async function executeScrollToFaq(action, context, store) {
547
552
  const el = document.querySelector(`[data-faq-item-id="${id}"]`);
548
553
  if (el) {
549
554
  el.scrollIntoView({
550
- behavior: (_a = action.behavior) != null ? _a : "smooth"
555
+ behavior: (_a2 = action.behavior) != null ? _a2 : "smooth"
551
556
  });
552
557
  }
553
558
  context.publishEvent("faq:scroll_to", { itemId: id });
@@ -557,10 +562,10 @@ async function executeScrollToFaq(action, context, store) {
557
562
  };
558
563
  }
559
564
  async function executeToggleFaqItem(action, context, store) {
560
- var _a;
565
+ var _a2;
561
566
  const item = resolveItem(store, action.itemId, action.itemQuestion);
562
567
  const { id } = item.config;
563
- const desiredState = (_a = action.state) != null ? _a : "toggle";
568
+ const desiredState = (_a2 = action.state) != null ? _a2 : "toggle";
564
569
  let newState;
565
570
  switch (desiredState) {
566
571
  case "open":
@@ -585,10 +590,10 @@ async function executeToggleFaqItem(action, context, store) {
585
590
  };
586
591
  }
587
592
  async function executeUpdateFaq(action, context, store) {
588
- var _a, _b, _c;
593
+ var _a2, _b, _c;
589
594
  switch (action.operation) {
590
595
  case "add": {
591
- const items = (_a = action.items) != null ? _a : [];
596
+ const items = (_a2 = action.items) != null ? _a2 : [];
592
597
  const position = action.position === "prepend" ? "prepend" : "append";
593
598
  store.addItems(items, position);
594
599
  break;
@@ -629,35 +634,1226 @@ var executorDefinitions = [
629
634
 
630
635
  // ../adaptives/adaptive-faq/dist/FAQWidget.js
631
636
  import { jsx as _jsx2, jsxs as _jsxs2 } from "react/jsx-runtime";
632
- import React2, { useCallback as useCallback2, useEffect as useEffect2, useMemo, useReducer, useState as useState2 } from "react";
633
- import { createRoot as createRoot2 } from "react-dom/client";
634
- function getAnswerText(answer) {
635
- if (typeof answer === "string")
636
- return answer;
637
- if (answer.type === "rich")
638
- return answer.html;
639
- return answer.content;
637
+
638
+ // ../../node_modules/marked/lib/marked.esm.js
639
+ function M() {
640
+ return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
640
641
  }
641
- function renderAnswer(answer) {
642
- if (typeof answer === "string") {
643
- return _jsx2("p", { style: { margin: 0 }, children: answer });
644
- }
645
- if (answer.type === "rich") {
646
- return _jsx2("div", { style: { margin: 0 }, dangerouslySetInnerHTML: { __html: answer.html } });
642
+ var T = M();
643
+ function G(u3) {
644
+ T = u3;
645
+ }
646
+ var _ = { exec: () => null };
647
+ function k(u3, e = "") {
648
+ let t = typeof u3 == "string" ? u3 : u3.source, n = { replace: (r, i) => {
649
+ let s = typeof i == "string" ? i : i.source;
650
+ return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
651
+ }, getRegex: () => new RegExp(t, e) };
652
+ return n;
653
+ }
654
+ var Re = (() => {
655
+ try {
656
+ return !!new RegExp("(?<=1)(?<!1)");
657
+ } catch {
658
+ return false;
647
659
  }
648
- return _jsx2("p", { style: { margin: 0 }, children: answer.content });
660
+ })();
661
+ var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (u3) => new RegExp(`^( {0,3}${u3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}#`), htmlBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}>`) };
662
+ var Te = /^(?:[ \t]*(?:\n|$))+/;
663
+ var Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
664
+ var we = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
665
+ var A = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
666
+ var ye = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
667
+ var N = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
668
+ var re = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
669
+ var se = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
670
+ var Pe = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
671
+ var Q = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
672
+ var Se = /^[^\n]+/;
673
+ var j = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
674
+ var $e = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", j).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
675
+ var _e = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex();
676
+ var q = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
677
+ var F = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
678
+ var Le = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", F).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
679
+ var ie = k(Q).replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex();
680
+ var Me = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ie).getRegex();
681
+ var U = { blockquote: Me, code: Oe, def: $e, fences: we, heading: ye, hr: A, html: Le, lheading: se, list: _e, newline: Te, paragraph: ie, table: _, text: Se };
682
+ var te = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex();
683
+ var ze = { ...U, lheading: Pe, table: te, paragraph: k(Q).replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", te).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex() };
684
+ var Ee = { ...U, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", F).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(Q).replace("hr", A).replace("heading", ` *#{1,6} *[^
685
+ ]`).replace("lheading", se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
686
+ var Ie = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
687
+ var Ae = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
688
+ var oe = /^( {2,}|\\)\n(?!\s*$)/;
689
+ var Ce = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
690
+ var v = /[\p{P}\p{S}]/u;
691
+ var K = /[\s\p{P}\p{S}]/u;
692
+ var ae = /[^\s\p{P}\p{S}]/u;
693
+ var Be = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex();
694
+ var le = /(?!~)[\p{P}\p{S}]/u;
695
+ var De = /(?!~)[\s\p{P}\p{S}]/u;
696
+ var qe = /(?:[^\s\p{P}\p{S}]|~)/u;
697
+ var ue = /(?![*_])[\p{P}\p{S}]/u;
698
+ var ve = /(?![*_])[\s\p{P}\p{S}]/u;
699
+ var He = /(?:[^\s\p{P}\p{S}]|[*_])/u;
700
+ var Ge = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Re ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
701
+ var pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
702
+ var Ze = k(pe, "u").replace(/punct/g, v).getRegex();
703
+ var Ne = k(pe, "u").replace(/punct/g, le).getRegex();
704
+ var ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
705
+ var Qe = k(ce, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, v).getRegex();
706
+ var je = k(ce, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, De).replace(/punct/g, le).getRegex();
707
+ var Fe = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, v).getRegex();
708
+ var Ue = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, ue).getRegex();
709
+ var Ke = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
710
+ var We = k(Ke, "gu").replace(/notPunctSpace/g, He).replace(/punctSpace/g, ve).replace(/punct/g, ue).getRegex();
711
+ var Xe = k(/\\(punct)/, "gu").replace(/punct/g, v).getRegex();
712
+ var Je = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
713
+ var Ve = k(F).replace("(?:-->|$)", "-->").getRegex();
714
+ var Ye = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Ve).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
715
+ var D = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/;
716
+ var et = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", D).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
717
+ var he = k(/^!?\[(label)\]\[(ref)\]/).replace("label", D).replace("ref", j).getRegex();
718
+ var ke = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", j).getRegex();
719
+ var tt = k("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex();
720
+ var ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
721
+ var W = { _backpedal: _, anyPunctuation: Xe, autolink: Je, blockSkip: Ge, br: oe, code: Ae, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Ze, emStrongRDelimAst: Qe, emStrongRDelimUnd: Fe, escape: Ie, link: et, nolink: ke, punctuation: Be, reflink: he, reflinkSearch: tt, tag: Ye, text: Ce, url: _ };
722
+ var nt = { ...W, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", D).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", D).getRegex() };
723
+ var Z = { ...W, emStrongRDelimAst: je, emStrongLDelim: Ne, delLDelim: Ue, delRDelim: We, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex() };
724
+ var rt = { ...Z, br: k(oe).replace("{2,}", "*").getRegex(), text: k(Z.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
725
+ var C = { normal: U, gfm: ze, pedantic: Ee };
726
+ var z = { normal: W, gfm: Z, breaks: rt, pedantic: nt };
727
+ var st = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
728
+ var de = (u3) => st[u3];
729
+ function O(u3, e) {
730
+ if (e) {
731
+ if (m.escapeTest.test(u3)) return u3.replace(m.escapeReplace, de);
732
+ } else if (m.escapeTestNoEncode.test(u3)) return u3.replace(m.escapeReplaceNoEncode, de);
733
+ return u3;
649
734
  }
650
- function resolveFeedbackConfig(feedback) {
651
- if (!feedback)
735
+ function X(u3) {
736
+ try {
737
+ u3 = encodeURI(u3).replace(m.percentDecode, "%");
738
+ } catch {
652
739
  return null;
653
- if (feedback === true) {
654
- return { style: "thumbs" };
655
740
  }
656
- return feedback;
741
+ return u3;
657
742
  }
658
- function getFeedbackPrompt(feedbackConfig) {
659
- return feedbackConfig.prompt || "Was this helpful?";
743
+ function J(u3, e) {
744
+ var _a2;
745
+ let t = u3.replace(m.findPipe, (i, s, a) => {
746
+ let o = false, l = s;
747
+ for (; --l >= 0 && a[l] === "\\"; ) o = !o;
748
+ return o ? "|" : " |";
749
+ }), n = t.split(m.splitPipe), r = 0;
750
+ if (n[0].trim() || n.shift(), n.length > 0 && !((_a2 = n.at(-1)) == null ? void 0 : _a2.trim()) && n.pop(), e) if (n.length > e) n.splice(e);
751
+ else for (; n.length < e; ) n.push("");
752
+ for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
753
+ return n;
754
+ }
755
+ function E(u3, e, t) {
756
+ let n = u3.length;
757
+ if (n === 0) return "";
758
+ let r = 0;
759
+ for (; r < n; ) {
760
+ let i = u3.charAt(n - r - 1);
761
+ if (i === e && !t) r++;
762
+ else if (i !== e && t) r++;
763
+ else break;
764
+ }
765
+ return u3.slice(0, n - r);
766
+ }
767
+ function ge(u3, e) {
768
+ if (u3.indexOf(e[1]) === -1) return -1;
769
+ let t = 0;
770
+ for (let n = 0; n < u3.length; n++) if (u3[n] === "\\") n++;
771
+ else if (u3[n] === e[0]) t++;
772
+ else if (u3[n] === e[1] && (t--, t < 0)) return n;
773
+ return t > 0 ? -2 : -1;
774
+ }
775
+ function fe(u3, e = 0) {
776
+ let t = e, n = "";
777
+ for (let r of u3) if (r === " ") {
778
+ let i = 4 - t % 4;
779
+ n += " ".repeat(i), t += i;
780
+ } else n += r, t++;
781
+ return n;
782
+ }
783
+ function me(u3, e, t, n, r) {
784
+ let i = e.href, s = e.title || null, a = u3[1].replace(r.other.outputLinkReplace, "$1");
785
+ n.state.inLink = true;
786
+ let o = { type: u3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
787
+ return n.state.inLink = false, o;
788
+ }
789
+ function it(u3, e, t) {
790
+ let n = u3.match(t.other.indentCodeCompensation);
791
+ if (n === null) return e;
792
+ let r = n[1];
793
+ return e.split(`
794
+ `).map((i) => {
795
+ let s = i.match(t.other.beginningSpace);
796
+ if (s === null) return i;
797
+ let [a] = s;
798
+ return a.length >= r.length ? i.slice(r.length) : i;
799
+ }).join(`
800
+ `);
801
+ }
802
+ var w = class {
803
+ constructor(e) {
804
+ __publicField(this, "options");
805
+ __publicField(this, "rules");
806
+ __publicField(this, "lexer");
807
+ this.options = e || T;
808
+ }
809
+ space(e) {
810
+ let t = this.rules.block.newline.exec(e);
811
+ if (t && t[0].length > 0) return { type: "space", raw: t[0] };
812
+ }
813
+ code(e) {
814
+ let t = this.rules.block.code.exec(e);
815
+ if (t) {
816
+ let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
817
+ return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : E(n, `
818
+ `) };
819
+ }
820
+ }
821
+ fences(e) {
822
+ let t = this.rules.block.fences.exec(e);
823
+ if (t) {
824
+ let n = t[0], r = it(n, t[3] || "", this.rules);
825
+ return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
826
+ }
827
+ }
828
+ heading(e) {
829
+ let t = this.rules.block.heading.exec(e);
830
+ if (t) {
831
+ let n = t[2].trim();
832
+ if (this.rules.other.endingHash.test(n)) {
833
+ let r = E(n, "#");
834
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
835
+ }
836
+ return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
837
+ }
838
+ }
839
+ hr(e) {
840
+ let t = this.rules.block.hr.exec(e);
841
+ if (t) return { type: "hr", raw: E(t[0], `
842
+ `) };
843
+ }
844
+ blockquote(e) {
845
+ let t = this.rules.block.blockquote.exec(e);
846
+ if (t) {
847
+ let n = E(t[0], `
848
+ `).split(`
849
+ `), r = "", i = "", s = [];
850
+ for (; n.length > 0; ) {
851
+ let a = false, o = [], l;
852
+ for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = true;
853
+ else if (!a) o.push(n[l]);
854
+ else break;
855
+ n = n.slice(l);
856
+ let p = o.join(`
857
+ `), c = p.replace(this.rules.other.blockquoteSetextReplace, `
858
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
859
+ r = r ? `${r}
860
+ ${p}` : p, i = i ? `${i}
861
+ ${c}` : c;
862
+ let d = this.lexer.state.top;
863
+ if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = d, n.length === 0) break;
864
+ let h = s.at(-1);
865
+ if ((h == null ? void 0 : h.type) === "code") break;
866
+ if ((h == null ? void 0 : h.type) === "blockquote") {
867
+ let R = h, f = R.raw + `
868
+ ` + n.join(`
869
+ `), S = this.blockquote(f);
870
+ s[s.length - 1] = S, r = r.substring(0, r.length - R.raw.length) + S.raw, i = i.substring(0, i.length - R.text.length) + S.text;
871
+ break;
872
+ } else if ((h == null ? void 0 : h.type) === "list") {
873
+ let R = h, f = R.raw + `
874
+ ` + n.join(`
875
+ `), S = this.list(f);
876
+ s[s.length - 1] = S, r = r.substring(0, r.length - h.raw.length) + S.raw, i = i.substring(0, i.length - R.raw.length) + S.raw, n = f.substring(s.at(-1).raw.length).split(`
877
+ `);
878
+ continue;
879
+ }
880
+ }
881
+ return { type: "blockquote", raw: r, tokens: s, text: i };
882
+ }
883
+ }
884
+ list(e) {
885
+ var _a2, _b;
886
+ let t = this.rules.block.list.exec(e);
887
+ if (t) {
888
+ let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
889
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
890
+ let s = this.rules.other.listItemRegex(n), a = false;
891
+ for (; e; ) {
892
+ let l = false, p = "", c = "";
893
+ if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
894
+ p = t[0], e = e.substring(p.length);
895
+ let d = fe(t[2].split(`
896
+ `, 1)[0], t[1].length), h = e.split(`
897
+ `, 1)[0], R = !d.trim(), f = 0;
898
+ if (this.options.pedantic ? (f = 2, c = d.trimStart()) : R ? f = t[1].length + 1 : (f = d.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = d.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `
899
+ `, e = e.substring(h.length + 1), l = true), !l) {
900
+ let S = this.rules.other.nextBulletRegex(f), V = this.rules.other.hrRegex(f), Y = this.rules.other.fencesBeginRegex(f), ee = this.rules.other.headingBeginRegex(f), xe = this.rules.other.htmlBeginRegex(f), be = this.rules.other.blockquoteBeginRegex(f);
901
+ for (; e; ) {
902
+ let H = e.split(`
903
+ `, 1)[0], I;
904
+ if (h = H, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), I = h) : I = h.replace(this.rules.other.tabCharGlobal, " "), Y.test(h) || ee.test(h) || xe.test(h) || be.test(h) || S.test(h) || V.test(h)) break;
905
+ if (I.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
906
+ ` + I.slice(f);
907
+ else {
908
+ if (R || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Y.test(d) || ee.test(d) || V.test(d)) break;
909
+ c += `
910
+ ` + h;
911
+ }
912
+ R = !h.trim(), p += H + `
913
+ `, e = e.substring(H.length + 1), d = I.slice(f);
914
+ }
915
+ }
916
+ i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (a = true)), i.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), i.raw += p;
917
+ }
918
+ let o = i.items.at(-1);
919
+ if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
920
+ else return;
921
+ i.raw = i.raw.trimEnd();
922
+ for (let l of i.items) {
923
+ if (this.lexer.state.top = false, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
924
+ if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), ((_a2 = l.tokens[0]) == null ? void 0 : _a2.type) === "text" || ((_b = l.tokens[0]) == null ? void 0 : _b.type) === "paragraph") {
925
+ l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
926
+ for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
927
+ this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
928
+ break;
929
+ }
930
+ }
931
+ let p = this.rules.other.listTaskCheckbox.exec(l.raw);
932
+ if (p) {
933
+ let c = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
934
+ l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({ type: "paragraph", raw: c.raw, text: c.raw, tokens: [c] }) : l.tokens.unshift(c);
935
+ }
936
+ }
937
+ if (!i.loose) {
938
+ let p = l.tokens.filter((d) => d.type === "space"), c = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
939
+ i.loose = c;
940
+ }
941
+ }
942
+ if (i.loose) for (let l of i.items) {
943
+ l.loose = true;
944
+ for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
945
+ }
946
+ return i;
947
+ }
948
+ }
949
+ html(e) {
950
+ let t = this.rules.block.html.exec(e);
951
+ if (t) return { type: "html", block: true, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
952
+ }
953
+ def(e) {
954
+ let t = this.rules.block.def.exec(e);
955
+ if (t) {
956
+ let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
957
+ return { type: "def", tag: n, raw: t[0], href: r, title: i };
958
+ }
959
+ }
960
+ table(e) {
961
+ var _a2;
962
+ let t = this.rules.block.table.exec(e);
963
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
964
+ let n = J(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = ((_a2 = t[3]) == null ? void 0 : _a2.trim()) ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
965
+ `) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
966
+ if (n.length === r.length) {
967
+ for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
968
+ for (let a = 0; a < n.length; a++) s.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: true, align: s.align[a] });
969
+ for (let a of i) s.rows.push(J(a, s.header.length).map((o, l) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[l] })));
970
+ return s;
971
+ }
972
+ }
973
+ lheading(e) {
974
+ let t = this.rules.block.lheading.exec(e);
975
+ if (t) return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: t[1], tokens: this.lexer.inline(t[1]) };
976
+ }
977
+ paragraph(e) {
978
+ let t = this.rules.block.paragraph.exec(e);
979
+ if (t) {
980
+ let n = t[1].charAt(t[1].length - 1) === `
981
+ ` ? t[1].slice(0, -1) : t[1];
982
+ return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
983
+ }
984
+ }
985
+ text(e) {
986
+ let t = this.rules.block.text.exec(e);
987
+ if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
988
+ }
989
+ escape(e) {
990
+ let t = this.rules.inline.escape.exec(e);
991
+ if (t) return { type: "escape", raw: t[0], text: t[1] };
992
+ }
993
+ tag(e) {
994
+ let t = this.rules.inline.tag.exec(e);
995
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
996
+ }
997
+ link(e) {
998
+ let t = this.rules.inline.link.exec(e);
999
+ if (t) {
1000
+ let n = t[2].trim();
1001
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
1002
+ if (!this.rules.other.endAngleBracket.test(n)) return;
1003
+ let s = E(n.slice(0, -1), "\\");
1004
+ if ((n.length - s.length) % 2 === 0) return;
1005
+ } else {
1006
+ let s = ge(t[2], "()");
1007
+ if (s === -2) return;
1008
+ if (s > -1) {
1009
+ let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
1010
+ t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
1011
+ }
1012
+ }
1013
+ let r = t[2], i = "";
1014
+ if (this.options.pedantic) {
1015
+ let s = this.rules.other.pedanticHrefTitle.exec(r);
1016
+ s && (r = s[1], i = s[3]);
1017
+ } else i = t[3] ? t[3].slice(1, -1) : "";
1018
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), me(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
1019
+ }
1020
+ }
1021
+ reflink(e, t) {
1022
+ let n;
1023
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
1024
+ let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
1025
+ if (!i) {
1026
+ let s = n[0].charAt(0);
1027
+ return { type: "text", raw: s, text: s };
1028
+ }
1029
+ return me(n, i, n[0], this.lexer, this.rules);
1030
+ }
1031
+ }
1032
+ emStrong(e, t, n = "") {
1033
+ let r = this.rules.inline.emStrongLDelim.exec(e);
1034
+ if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
1035
+ if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
1036
+ let s = [...r[0]].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
1037
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
1038
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
1039
+ if (o = [...a].length, r[3] || r[4]) {
1040
+ l += o;
1041
+ continue;
1042
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
1043
+ p += o;
1044
+ continue;
1045
+ }
1046
+ if (l -= o, l > 0) continue;
1047
+ o = Math.min(o, o + l + p);
1048
+ let d = [...r[0]][0].length, h = e.slice(0, s + r.index + d + o);
1049
+ if (Math.min(s, o) % 2) {
1050
+ let f = h.slice(1, -1);
1051
+ return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
1052
+ }
1053
+ let R = h.slice(2, -2);
1054
+ return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
1055
+ }
1056
+ }
1057
+ }
1058
+ codespan(e) {
1059
+ let t = this.rules.inline.code.exec(e);
1060
+ if (t) {
1061
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
1062
+ return r && i && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
1063
+ }
1064
+ }
1065
+ br(e) {
1066
+ let t = this.rules.inline.br.exec(e);
1067
+ if (t) return { type: "br", raw: t[0] };
1068
+ }
1069
+ del(e, t, n = "") {
1070
+ let r = this.rules.inline.delLDelim.exec(e);
1071
+ if (!r) return;
1072
+ if (!(r[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
1073
+ let s = [...r[0]].length - 1, a, o, l = s, p = this.rules.inline.delRDelim;
1074
+ for (p.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = p.exec(t)) != null; ) {
1075
+ if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a || (o = [...a].length, o !== s)) continue;
1076
+ if (r[3] || r[4]) {
1077
+ l += o;
1078
+ continue;
1079
+ }
1080
+ if (l -= o, l > 0) continue;
1081
+ o = Math.min(o, o + l);
1082
+ let c = [...r[0]][0].length, d = e.slice(0, s + r.index + c + o), h = d.slice(s, -s);
1083
+ return { type: "del", raw: d, text: h, tokens: this.lexer.inlineTokens(h) };
1084
+ }
1085
+ }
1086
+ }
1087
+ autolink(e) {
1088
+ let t = this.rules.inline.autolink.exec(e);
1089
+ if (t) {
1090
+ let n, r;
1091
+ return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
1092
+ }
1093
+ }
1094
+ url(e) {
1095
+ var _a2, _b;
1096
+ let t;
1097
+ if (t = this.rules.inline.url.exec(e)) {
1098
+ let n, r;
1099
+ if (t[2] === "@") n = t[0], r = "mailto:" + n;
1100
+ else {
1101
+ let i;
1102
+ do
1103
+ i = t[0], t[0] = (_b = (_a2 = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : _a2[0]) != null ? _b : "";
1104
+ while (i !== t[0]);
1105
+ n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
1106
+ }
1107
+ return { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
1108
+ }
1109
+ }
1110
+ inlineText(e) {
1111
+ let t = this.rules.inline.text.exec(e);
1112
+ if (t) {
1113
+ let n = this.lexer.state.inRawBlock;
1114
+ return { type: "text", raw: t[0], text: t[0], escaped: n };
1115
+ }
1116
+ }
1117
+ };
1118
+ var x = class u {
1119
+ constructor(e) {
1120
+ __publicField(this, "tokens");
1121
+ __publicField(this, "options");
1122
+ __publicField(this, "state");
1123
+ __publicField(this, "inlineQueue");
1124
+ __publicField(this, "tokenizer");
1125
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
1126
+ let t = { other: m, block: C.normal, inline: z.normal };
1127
+ this.options.pedantic ? (t.block = C.pedantic, t.inline = z.pedantic) : this.options.gfm && (t.block = C.gfm, this.options.breaks ? t.inline = z.breaks : t.inline = z.gfm), this.tokenizer.rules = t;
1128
+ }
1129
+ static get rules() {
1130
+ return { block: C, inline: z };
1131
+ }
1132
+ static lex(e, t) {
1133
+ return new u(t).lex(e);
1134
+ }
1135
+ static lexInline(e, t) {
1136
+ return new u(t).inlineTokens(e);
1137
+ }
1138
+ lex(e) {
1139
+ e = e.replace(m.carriageReturn, `
1140
+ `), this.blockTokens(e, this.tokens);
1141
+ for (let t = 0; t < this.inlineQueue.length; t++) {
1142
+ let n = this.inlineQueue[t];
1143
+ this.inlineTokens(n.src, n.tokens);
1144
+ }
1145
+ return this.inlineQueue = [], this.tokens;
1146
+ }
1147
+ blockTokens(e, t = [], n = false) {
1148
+ var _a2, _b, _c;
1149
+ for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
1150
+ let r;
1151
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
1152
+ if (r = this.tokenizer.space(e)) {
1153
+ e = e.substring(r.raw.length);
1154
+ let s = t.at(-1);
1155
+ r.raw.length === 1 && s !== void 0 ? s.raw += `
1156
+ ` : t.push(r);
1157
+ continue;
1158
+ }
1159
+ if (r = this.tokenizer.code(e)) {
1160
+ e = e.substring(r.raw.length);
1161
+ let s = t.at(-1);
1162
+ (s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
1163
+ `) ? "" : `
1164
+ `) + r.raw, s.text += `
1165
+ ` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
1166
+ continue;
1167
+ }
1168
+ if (r = this.tokenizer.fences(e)) {
1169
+ e = e.substring(r.raw.length), t.push(r);
1170
+ continue;
1171
+ }
1172
+ if (r = this.tokenizer.heading(e)) {
1173
+ e = e.substring(r.raw.length), t.push(r);
1174
+ continue;
1175
+ }
1176
+ if (r = this.tokenizer.hr(e)) {
1177
+ e = e.substring(r.raw.length), t.push(r);
1178
+ continue;
1179
+ }
1180
+ if (r = this.tokenizer.blockquote(e)) {
1181
+ e = e.substring(r.raw.length), t.push(r);
1182
+ continue;
1183
+ }
1184
+ if (r = this.tokenizer.list(e)) {
1185
+ e = e.substring(r.raw.length), t.push(r);
1186
+ continue;
1187
+ }
1188
+ if (r = this.tokenizer.html(e)) {
1189
+ e = e.substring(r.raw.length), t.push(r);
1190
+ continue;
1191
+ }
1192
+ if (r = this.tokenizer.def(e)) {
1193
+ e = e.substring(r.raw.length);
1194
+ let s = t.at(-1);
1195
+ (s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
1196
+ `) ? "" : `
1197
+ `) + r.raw, s.text += `
1198
+ ` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
1199
+ continue;
1200
+ }
1201
+ if (r = this.tokenizer.table(e)) {
1202
+ e = e.substring(r.raw.length), t.push(r);
1203
+ continue;
1204
+ }
1205
+ if (r = this.tokenizer.lheading(e)) {
1206
+ e = e.substring(r.raw.length), t.push(r);
1207
+ continue;
1208
+ }
1209
+ let i = e;
1210
+ if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
1211
+ let s = 1 / 0, a = e.slice(1), o;
1212
+ this.options.extensions.startBlock.forEach((l) => {
1213
+ o = l.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
1214
+ }), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
1215
+ }
1216
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
1217
+ let s = t.at(-1);
1218
+ n && (s == null ? void 0 : s.type) === "paragraph" ? (s.raw += (s.raw.endsWith(`
1219
+ `) ? "" : `
1220
+ `) + r.raw, s.text += `
1221
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
1222
+ continue;
1223
+ }
1224
+ if (r = this.tokenizer.text(e)) {
1225
+ e = e.substring(r.raw.length);
1226
+ let s = t.at(-1);
1227
+ (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
1228
+ `) ? "" : `
1229
+ `) + r.raw, s.text += `
1230
+ ` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
1231
+ continue;
1232
+ }
1233
+ if (e) {
1234
+ let s = "Infinite loop on byte: " + e.charCodeAt(0);
1235
+ if (this.options.silent) {
1236
+ console.error(s);
1237
+ break;
1238
+ } else throw new Error(s);
1239
+ }
1240
+ }
1241
+ return this.state.top = true, t;
1242
+ }
1243
+ inline(e, t = []) {
1244
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
1245
+ }
1246
+ inlineTokens(e, t = []) {
1247
+ var _a2, _b, _c, _d, _e2, _f;
1248
+ let n = e, r = null;
1249
+ if (this.tokens.links) {
1250
+ let o = Object.keys(this.tokens.links);
1251
+ if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1252
+ }
1253
+ for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1254
+ let i;
1255
+ for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1256
+ n = (_c = (_b = (_a2 = this.options.hooks) == null ? void 0 : _a2.emStrongMask) == null ? void 0 : _b.call({ lexer: this }, n)) != null ? _c : n;
1257
+ let s = false, a = "";
1258
+ for (; e; ) {
1259
+ s || (a = ""), s = false;
1260
+ let o;
1261
+ if ((_e2 = (_d = this.options.extensions) == null ? void 0 : _d.inline) == null ? void 0 : _e2.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
1262
+ if (o = this.tokenizer.escape(e)) {
1263
+ e = e.substring(o.raw.length), t.push(o);
1264
+ continue;
1265
+ }
1266
+ if (o = this.tokenizer.tag(e)) {
1267
+ e = e.substring(o.raw.length), t.push(o);
1268
+ continue;
1269
+ }
1270
+ if (o = this.tokenizer.link(e)) {
1271
+ e = e.substring(o.raw.length), t.push(o);
1272
+ continue;
1273
+ }
1274
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
1275
+ e = e.substring(o.raw.length);
1276
+ let p = t.at(-1);
1277
+ o.type === "text" && (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
1278
+ continue;
1279
+ }
1280
+ if (o = this.tokenizer.emStrong(e, n, a)) {
1281
+ e = e.substring(o.raw.length), t.push(o);
1282
+ continue;
1283
+ }
1284
+ if (o = this.tokenizer.codespan(e)) {
1285
+ e = e.substring(o.raw.length), t.push(o);
1286
+ continue;
1287
+ }
1288
+ if (o = this.tokenizer.br(e)) {
1289
+ e = e.substring(o.raw.length), t.push(o);
1290
+ continue;
1291
+ }
1292
+ if (o = this.tokenizer.del(e, n, a)) {
1293
+ e = e.substring(o.raw.length), t.push(o);
1294
+ continue;
1295
+ }
1296
+ if (o = this.tokenizer.autolink(e)) {
1297
+ e = e.substring(o.raw.length), t.push(o);
1298
+ continue;
1299
+ }
1300
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
1301
+ e = e.substring(o.raw.length), t.push(o);
1302
+ continue;
1303
+ }
1304
+ let l = e;
1305
+ if ((_f = this.options.extensions) == null ? void 0 : _f.startInline) {
1306
+ let p = 1 / 0, c = e.slice(1), d;
1307
+ this.options.extensions.startInline.forEach((h) => {
1308
+ d = h.call({ lexer: this }, c), typeof d == "number" && d >= 0 && (p = Math.min(p, d));
1309
+ }), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
1310
+ }
1311
+ if (o = this.tokenizer.inlineText(l)) {
1312
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
1313
+ let p = t.at(-1);
1314
+ (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
1315
+ continue;
1316
+ }
1317
+ if (e) {
1318
+ let p = "Infinite loop on byte: " + e.charCodeAt(0);
1319
+ if (this.options.silent) {
1320
+ console.error(p);
1321
+ break;
1322
+ } else throw new Error(p);
1323
+ }
1324
+ }
1325
+ return t;
1326
+ }
1327
+ };
1328
+ var y = class {
1329
+ constructor(e) {
1330
+ __publicField(this, "options");
1331
+ __publicField(this, "parser");
1332
+ this.options = e || T;
1333
+ }
1334
+ space(e) {
1335
+ return "";
1336
+ }
1337
+ code({ text: e, lang: t, escaped: n }) {
1338
+ var _a2;
1339
+ let r = (_a2 = (t || "").match(m.notSpaceStart)) == null ? void 0 : _a2[0], i = e.replace(m.endingNewline, "") + `
1340
+ `;
1341
+ return r ? '<pre><code class="language-' + O(r) + '">' + (n ? i : O(i, true)) + `</code></pre>
1342
+ ` : "<pre><code>" + (n ? i : O(i, true)) + `</code></pre>
1343
+ `;
1344
+ }
1345
+ blockquote({ tokens: e }) {
1346
+ return `<blockquote>
1347
+ ${this.parser.parse(e)}</blockquote>
1348
+ `;
1349
+ }
1350
+ html({ text: e }) {
1351
+ return e;
1352
+ }
1353
+ def(e) {
1354
+ return "";
1355
+ }
1356
+ heading({ tokens: e, depth: t }) {
1357
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
1358
+ `;
1359
+ }
1360
+ hr(e) {
1361
+ return `<hr>
1362
+ `;
1363
+ }
1364
+ list(e) {
1365
+ let t = e.ordered, n = e.start, r = "";
1366
+ for (let a = 0; a < e.items.length; a++) {
1367
+ let o = e.items[a];
1368
+ r += this.listitem(o);
1369
+ }
1370
+ let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
1371
+ return "<" + i + s + `>
1372
+ ` + r + "</" + i + `>
1373
+ `;
1374
+ }
1375
+ listitem(e) {
1376
+ return `<li>${this.parser.parse(e.tokens)}</li>
1377
+ `;
1378
+ }
1379
+ checkbox({ checked: e }) {
1380
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
1381
+ }
1382
+ paragraph({ tokens: e }) {
1383
+ return `<p>${this.parser.parseInline(e)}</p>
1384
+ `;
1385
+ }
1386
+ table(e) {
1387
+ let t = "", n = "";
1388
+ for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
1389
+ t += this.tablerow({ text: n });
1390
+ let r = "";
1391
+ for (let i = 0; i < e.rows.length; i++) {
1392
+ let s = e.rows[i];
1393
+ n = "";
1394
+ for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
1395
+ r += this.tablerow({ text: n });
1396
+ }
1397
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
1398
+ <thead>
1399
+ ` + t + `</thead>
1400
+ ` + r + `</table>
1401
+ `;
1402
+ }
1403
+ tablerow({ text: e }) {
1404
+ return `<tr>
1405
+ ${e}</tr>
1406
+ `;
1407
+ }
1408
+ tablecell(e) {
1409
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
1410
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
1411
+ `;
1412
+ }
1413
+ strong({ tokens: e }) {
1414
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
1415
+ }
1416
+ em({ tokens: e }) {
1417
+ return `<em>${this.parser.parseInline(e)}</em>`;
1418
+ }
1419
+ codespan({ text: e }) {
1420
+ return `<code>${O(e, true)}</code>`;
1421
+ }
1422
+ br(e) {
1423
+ return "<br>";
1424
+ }
1425
+ del({ tokens: e }) {
1426
+ return `<del>${this.parser.parseInline(e)}</del>`;
1427
+ }
1428
+ link({ href: e, title: t, tokens: n }) {
1429
+ let r = this.parser.parseInline(n), i = X(e);
1430
+ if (i === null) return r;
1431
+ e = i;
1432
+ let s = '<a href="' + e + '"';
1433
+ return t && (s += ' title="' + O(t) + '"'), s += ">" + r + "</a>", s;
1434
+ }
1435
+ image({ href: e, title: t, text: n, tokens: r }) {
1436
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
1437
+ let i = X(e);
1438
+ if (i === null) return O(n);
1439
+ e = i;
1440
+ let s = `<img src="${e}" alt="${O(n)}"`;
1441
+ return t && (s += ` title="${O(t)}"`), s += ">", s;
1442
+ }
1443
+ text(e) {
1444
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
1445
+ }
1446
+ };
1447
+ var $ = class {
1448
+ strong({ text: e }) {
1449
+ return e;
1450
+ }
1451
+ em({ text: e }) {
1452
+ return e;
1453
+ }
1454
+ codespan({ text: e }) {
1455
+ return e;
1456
+ }
1457
+ del({ text: e }) {
1458
+ return e;
1459
+ }
1460
+ html({ text: e }) {
1461
+ return e;
1462
+ }
1463
+ text({ text: e }) {
1464
+ return e;
1465
+ }
1466
+ link({ text: e }) {
1467
+ return "" + e;
1468
+ }
1469
+ image({ text: e }) {
1470
+ return "" + e;
1471
+ }
1472
+ br() {
1473
+ return "";
1474
+ }
1475
+ checkbox({ raw: e }) {
1476
+ return e;
1477
+ }
1478
+ };
1479
+ var b = class u2 {
1480
+ constructor(e) {
1481
+ __publicField(this, "options");
1482
+ __publicField(this, "renderer");
1483
+ __publicField(this, "textRenderer");
1484
+ this.options = e || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
1485
+ }
1486
+ static parse(e, t) {
1487
+ return new u2(t).parse(e);
1488
+ }
1489
+ static parseInline(e, t) {
1490
+ return new u2(t).parseInline(e);
1491
+ }
1492
+ parse(e) {
1493
+ var _a2, _b;
1494
+ let t = "";
1495
+ for (let n = 0; n < e.length; n++) {
1496
+ let r = e[n];
1497
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[r.type]) {
1498
+ let s = r, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
1499
+ if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(s.type)) {
1500
+ t += a || "";
1501
+ continue;
1502
+ }
1503
+ }
1504
+ let i = r;
1505
+ switch (i.type) {
1506
+ case "space": {
1507
+ t += this.renderer.space(i);
1508
+ break;
1509
+ }
1510
+ case "hr": {
1511
+ t += this.renderer.hr(i);
1512
+ break;
1513
+ }
1514
+ case "heading": {
1515
+ t += this.renderer.heading(i);
1516
+ break;
1517
+ }
1518
+ case "code": {
1519
+ t += this.renderer.code(i);
1520
+ break;
1521
+ }
1522
+ case "table": {
1523
+ t += this.renderer.table(i);
1524
+ break;
1525
+ }
1526
+ case "blockquote": {
1527
+ t += this.renderer.blockquote(i);
1528
+ break;
1529
+ }
1530
+ case "list": {
1531
+ t += this.renderer.list(i);
1532
+ break;
1533
+ }
1534
+ case "checkbox": {
1535
+ t += this.renderer.checkbox(i);
1536
+ break;
1537
+ }
1538
+ case "html": {
1539
+ t += this.renderer.html(i);
1540
+ break;
1541
+ }
1542
+ case "def": {
1543
+ t += this.renderer.def(i);
1544
+ break;
1545
+ }
1546
+ case "paragraph": {
1547
+ t += this.renderer.paragraph(i);
1548
+ break;
1549
+ }
1550
+ case "text": {
1551
+ t += this.renderer.text(i);
1552
+ break;
1553
+ }
1554
+ default: {
1555
+ let s = 'Token with "' + i.type + '" type was not found.';
1556
+ if (this.options.silent) return console.error(s), "";
1557
+ throw new Error(s);
1558
+ }
1559
+ }
1560
+ }
1561
+ return t;
1562
+ }
1563
+ parseInline(e, t = this.renderer) {
1564
+ var _a2, _b;
1565
+ let n = "";
1566
+ for (let r = 0; r < e.length; r++) {
1567
+ let i = e[r];
1568
+ if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[i.type]) {
1569
+ let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1570
+ if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
1571
+ n += a || "";
1572
+ continue;
1573
+ }
1574
+ }
1575
+ let s = i;
1576
+ switch (s.type) {
1577
+ case "escape": {
1578
+ n += t.text(s);
1579
+ break;
1580
+ }
1581
+ case "html": {
1582
+ n += t.html(s);
1583
+ break;
1584
+ }
1585
+ case "link": {
1586
+ n += t.link(s);
1587
+ break;
1588
+ }
1589
+ case "image": {
1590
+ n += t.image(s);
1591
+ break;
1592
+ }
1593
+ case "checkbox": {
1594
+ n += t.checkbox(s);
1595
+ break;
1596
+ }
1597
+ case "strong": {
1598
+ n += t.strong(s);
1599
+ break;
1600
+ }
1601
+ case "em": {
1602
+ n += t.em(s);
1603
+ break;
1604
+ }
1605
+ case "codespan": {
1606
+ n += t.codespan(s);
1607
+ break;
1608
+ }
1609
+ case "br": {
1610
+ n += t.br(s);
1611
+ break;
1612
+ }
1613
+ case "del": {
1614
+ n += t.del(s);
1615
+ break;
1616
+ }
1617
+ case "text": {
1618
+ n += t.text(s);
1619
+ break;
1620
+ }
1621
+ default: {
1622
+ let a = 'Token with "' + s.type + '" type was not found.';
1623
+ if (this.options.silent) return console.error(a), "";
1624
+ throw new Error(a);
1625
+ }
1626
+ }
1627
+ }
1628
+ return n;
1629
+ }
1630
+ };
1631
+ var _a;
1632
+ var P = (_a = class {
1633
+ constructor(e) {
1634
+ __publicField(this, "options");
1635
+ __publicField(this, "block");
1636
+ this.options = e || T;
1637
+ }
1638
+ preprocess(e) {
1639
+ return e;
1640
+ }
1641
+ postprocess(e) {
1642
+ return e;
1643
+ }
1644
+ processAllTokens(e) {
1645
+ return e;
1646
+ }
1647
+ emStrongMask(e) {
1648
+ return e;
1649
+ }
1650
+ provideLexer() {
1651
+ return this.block ? x.lex : x.lexInline;
1652
+ }
1653
+ provideParser() {
1654
+ return this.block ? b.parse : b.parseInline;
1655
+ }
1656
+ }, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
1657
+ var B = class {
1658
+ constructor(...e) {
1659
+ __publicField(this, "defaults", M());
1660
+ __publicField(this, "options", this.setOptions);
1661
+ __publicField(this, "parse", this.parseMarkdown(true));
1662
+ __publicField(this, "parseInline", this.parseMarkdown(false));
1663
+ __publicField(this, "Parser", b);
1664
+ __publicField(this, "Renderer", y);
1665
+ __publicField(this, "TextRenderer", $);
1666
+ __publicField(this, "Lexer", x);
1667
+ __publicField(this, "Tokenizer", w);
1668
+ __publicField(this, "Hooks", P);
1669
+ this.use(...e);
1670
+ }
1671
+ walkTokens(e, t) {
1672
+ var _a2, _b;
1673
+ let n = [];
1674
+ for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
1675
+ case "table": {
1676
+ let i = r;
1677
+ for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
1678
+ for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
1679
+ break;
1680
+ }
1681
+ case "list": {
1682
+ let i = r;
1683
+ n = n.concat(this.walkTokens(i.items, t));
1684
+ break;
1685
+ }
1686
+ default: {
1687
+ let i = r;
1688
+ ((_b = (_a2 = this.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[i.type]) ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
1689
+ let a = i[s].flat(1 / 0);
1690
+ n = n.concat(this.walkTokens(a, t));
1691
+ }) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
1692
+ }
1693
+ }
1694
+ return n;
1695
+ }
1696
+ use(...e) {
1697
+ let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1698
+ return e.forEach((n) => {
1699
+ let r = { ...n };
1700
+ if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
1701
+ if (!i.name) throw new Error("extension name required");
1702
+ if ("renderer" in i) {
1703
+ let s = t.renderers[i.name];
1704
+ s ? t.renderers[i.name] = function(...a) {
1705
+ let o = i.renderer.apply(this, a);
1706
+ return o === false && (o = s.apply(this, a)), o;
1707
+ } : t.renderers[i.name] = i.renderer;
1708
+ }
1709
+ if ("tokenizer" in i) {
1710
+ if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
1711
+ let s = t[i.level];
1712
+ s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
1713
+ }
1714
+ "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
1715
+ }), r.extensions = t), n.renderer) {
1716
+ let i = this.defaults.renderer || new y(this.defaults);
1717
+ for (let s in n.renderer) {
1718
+ if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
1719
+ if (["options", "parser"].includes(s)) continue;
1720
+ let a = s, o = n.renderer[a], l = i[a];
1721
+ i[a] = (...p) => {
1722
+ let c = o.apply(i, p);
1723
+ return c === false && (c = l.apply(i, p)), c || "";
1724
+ };
1725
+ }
1726
+ r.renderer = i;
1727
+ }
1728
+ if (n.tokenizer) {
1729
+ let i = this.defaults.tokenizer || new w(this.defaults);
1730
+ for (let s in n.tokenizer) {
1731
+ if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
1732
+ if (["options", "rules", "lexer"].includes(s)) continue;
1733
+ let a = s, o = n.tokenizer[a], l = i[a];
1734
+ i[a] = (...p) => {
1735
+ let c = o.apply(i, p);
1736
+ return c === false && (c = l.apply(i, p)), c;
1737
+ };
1738
+ }
1739
+ r.tokenizer = i;
1740
+ }
1741
+ if (n.hooks) {
1742
+ let i = this.defaults.hooks || new P();
1743
+ for (let s in n.hooks) {
1744
+ if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
1745
+ if (["options", "block"].includes(s)) continue;
1746
+ let a = s, o = n.hooks[a], l = i[a];
1747
+ P.passThroughHooks.has(s) ? i[a] = (p) => {
1748
+ if (this.defaults.async && P.passThroughHooksRespectAsync.has(s)) return (async () => {
1749
+ let d = await o.call(i, p);
1750
+ return l.call(i, d);
1751
+ })();
1752
+ let c = o.call(i, p);
1753
+ return l.call(i, c);
1754
+ } : i[a] = (...p) => {
1755
+ if (this.defaults.async) return (async () => {
1756
+ let d = await o.apply(i, p);
1757
+ return d === false && (d = await l.apply(i, p)), d;
1758
+ })();
1759
+ let c = o.apply(i, p);
1760
+ return c === false && (c = l.apply(i, p)), c;
1761
+ };
1762
+ }
1763
+ r.hooks = i;
1764
+ }
1765
+ if (n.walkTokens) {
1766
+ let i = this.defaults.walkTokens, s = n.walkTokens;
1767
+ r.walkTokens = function(a) {
1768
+ let o = [];
1769
+ return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
1770
+ };
1771
+ }
1772
+ this.defaults = { ...this.defaults, ...r };
1773
+ }), this;
1774
+ }
1775
+ setOptions(e) {
1776
+ return this.defaults = { ...this.defaults, ...e }, this;
1777
+ }
1778
+ lexer(e, t) {
1779
+ return x.lex(e, t != null ? t : this.defaults);
1780
+ }
1781
+ parser(e, t) {
1782
+ return b.parse(e, t != null ? t : this.defaults);
1783
+ }
1784
+ parseMarkdown(e) {
1785
+ return (n, r) => {
1786
+ let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
1787
+ if (this.defaults.async === true && i.async === false) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1788
+ if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
1789
+ if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1790
+ if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
1791
+ let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
1792
+ s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
1793
+ let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
1794
+ return s.hooks ? await s.hooks.postprocess(h) : h;
1795
+ })().catch(a);
1796
+ try {
1797
+ s.hooks && (n = s.hooks.preprocess(n));
1798
+ let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
1799
+ s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
1800
+ let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
1801
+ return s.hooks && (c = s.hooks.postprocess(c)), c;
1802
+ } catch (o) {
1803
+ return a(o);
1804
+ }
1805
+ };
1806
+ }
1807
+ onError(e, t) {
1808
+ return (n) => {
1809
+ if (n.message += `
1810
+ Please report this to https://github.com/markedjs/marked.`, e) {
1811
+ let r = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
1812
+ return t ? Promise.resolve(r) : r;
1813
+ }
1814
+ if (t) return Promise.reject(n);
1815
+ throw n;
1816
+ };
1817
+ }
1818
+ };
1819
+ var L = new B();
1820
+ function g(u3, e) {
1821
+ return L.parse(u3, e);
660
1822
  }
1823
+ g.options = g.setOptions = function(u3) {
1824
+ return L.setOptions(u3), g.defaults = L.defaults, G(g.defaults), g;
1825
+ };
1826
+ g.getDefaults = M;
1827
+ g.defaults = T;
1828
+ g.use = function(...u3) {
1829
+ return L.use(...u3), g.defaults = L.defaults, G(g.defaults), g;
1830
+ };
1831
+ g.walkTokens = function(u3, e) {
1832
+ return L.walkTokens(u3, e);
1833
+ };
1834
+ g.parseInline = L.parseInline;
1835
+ g.Parser = b;
1836
+ g.parser = b.parse;
1837
+ g.Renderer = y;
1838
+ g.TextRenderer = $;
1839
+ g.Lexer = x;
1840
+ g.lexer = x.lex;
1841
+ g.Tokenizer = w;
1842
+ g.Hooks = P;
1843
+ g.parse = g;
1844
+ var Ut = g.options;
1845
+ var Kt = g.setOptions;
1846
+ var Wt = g.use;
1847
+ var Xt = g.walkTokens;
1848
+ var Jt = g.parseInline;
1849
+ var Yt = b.parse;
1850
+ var en = x.lex;
1851
+
1852
+ // ../adaptives/adaptive-faq/dist/FAQWidget.js
1853
+ import React2, { useCallback as useCallback2, useEffect as useEffect2, useMemo, useReducer, useState as useState2 } from "react";
1854
+ import { createRoot as createRoot2 } from "react-dom/client";
1855
+
1856
+ // ../adaptives/adaptive-faq/dist/faq-styles.js
661
1857
  var baseStyles = {
662
1858
  container: {
663
1859
  fontFamily: "var(--sc-font-family, system-ui, -apple-system, sans-serif)",
@@ -774,7 +1970,10 @@ var themeStyles = {
774
1970
  },
775
1971
  item: {
776
1972
  backgroundColor: "var(--sc-content-background)",
777
- border: "var(--sc-content-border)"
1973
+ borderTop: "var(--sc-content-border)",
1974
+ borderRight: "var(--sc-content-border)",
1975
+ borderBottom: "var(--sc-content-border)",
1976
+ borderLeft: "var(--sc-content-border)"
778
1977
  },
779
1978
  itemExpanded: {
780
1979
  boxShadow: "0 4px 12px rgba(0, 0, 0, 0.08)"
@@ -813,7 +2012,10 @@ var themeStyles = {
813
2012
  },
814
2013
  item: {
815
2014
  backgroundColor: "var(--sc-content-background)",
816
- border: "var(--sc-content-border)"
2015
+ borderTop: "var(--sc-content-border)",
2016
+ borderRight: "var(--sc-content-border)",
2017
+ borderBottom: "var(--sc-content-border)",
2018
+ borderLeft: "var(--sc-content-border)"
817
2019
  },
818
2020
  itemExpanded: {
819
2021
  boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)"
@@ -843,6 +2045,44 @@ var themeStyles = {
843
2045
  }
844
2046
  }
845
2047
  };
2048
+
2049
+ // ../adaptives/adaptive-faq/dist/FAQWidget.js
2050
+ var marked = new B({ async: false, gfm: true, breaks: true });
2051
+ function getAnswerText(answer) {
2052
+ if (typeof answer === "string")
2053
+ return answer;
2054
+ if (answer.type === "rich")
2055
+ return answer.html;
2056
+ return answer.content;
2057
+ }
2058
+ function renderAnswer(answer) {
2059
+ if (typeof answer === "string") {
2060
+ const html2 = marked.parse(answer);
2061
+ return (
2062
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: content is CMS/config content, not user-controlled input
2063
+ _jsx2("div", { style: { margin: 0 }, "data-faq-markdown": "", dangerouslySetInnerHTML: { __html: html2 } })
2064
+ );
2065
+ }
2066
+ if (answer.type === "rich") {
2067
+ return _jsx2("div", { style: { margin: 0 }, dangerouslySetInnerHTML: { __html: answer.html } });
2068
+ }
2069
+ const html = marked.parse(answer.content);
2070
+ return (
2071
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: markdown content is CMS/config content, not user-controlled input
2072
+ _jsx2("div", { style: { margin: 0 }, "data-faq-markdown": "", dangerouslySetInnerHTML: { __html: html } })
2073
+ );
2074
+ }
2075
+ function resolveFeedbackConfig(feedback) {
2076
+ if (!feedback)
2077
+ return null;
2078
+ if (feedback === true) {
2079
+ return { style: "thumbs" };
2080
+ }
2081
+ return feedback;
2082
+ }
2083
+ function getFeedbackPrompt(feedbackConfig) {
2084
+ return feedbackConfig.prompt || "Was this helpful?";
2085
+ }
846
2086
  function FAQItem({ item, isExpanded, isHighlighted, isLast, onToggle, theme, feedbackConfig, feedbackValue, onFeedback }) {
847
2087
  const [isHovered, setIsHovered] = useState2(false);
848
2088
  const colors = themeStyles[theme];
@@ -852,7 +2092,8 @@ function FAQItem({ item, isExpanded, isHighlighted, isLast, onToggle, theme, fee
852
2092
  ...colors.item,
853
2093
  ...isExpanded ? colors.itemExpanded : {},
854
2094
  ...isHighlighted ? {
855
- boxShadow: "0 0 0 2px #6366f1, 0 0 12px rgba(99, 102, 241, 0.4)",
2095
+ // purple[4] = #6a59ce design system primary purple
2096
+ boxShadow: `0 0 0 2px ${purple[4]}, 0 0 12px rgba(106, 89, 206, 0.4)`,
856
2097
  transition: "box-shadow 0.3s ease"
857
2098
  } : {},
858
2099
  ...!isLast ? { borderBottom: "var(--sc-content-item-divider, none)" } : {}
@@ -885,7 +2126,7 @@ function FAQItem({ item, isExpanded, isHighlighted, isLast, onToggle, theme, fee
885
2126
  }, "aria-label": "Thumbs down", onClick: () => onFeedback(item.config.id, question, "down"), children: "\u{1F44E}" })] })] })] });
886
2127
  }
887
2128
  function FAQWidget({ config, runtime: runtime7, instanceId }) {
888
- const [renderTick, forceUpdate] = useReducer((x) => x + 1, 0);
2129
+ const [renderTick, forceUpdate] = useReducer((x2) => x2 + 1, 0);
889
2130
  const [expandedIds, setExpandedIds] = useState2(/* @__PURE__ */ new Set());
890
2131
  const [highlightId, setHighlightId] = useState2(null);
891
2132
  const [searchQuery, setSearchQuery] = useState2("");
@@ -898,8 +2139,8 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
898
2139
  return unsubscribe;
899
2140
  }, [runtime7.context]);
900
2141
  useEffect2(() => {
901
- var _a;
902
- if (!((_a = runtime7.accumulator) == null ? void 0 : _a.subscribe))
2142
+ var _a2;
2143
+ if (!((_a2 = runtime7.accumulator) == null ? void 0 : _a2.subscribe))
903
2144
  return;
904
2145
  return runtime7.accumulator.subscribe(() => {
905
2146
  forceUpdate();
@@ -911,8 +2152,8 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
911
2152
  if (runtime7.events.getRecent) {
912
2153
  const recentEvents = runtime7.events.getRecent({ patterns: ["^action\\.tooltip_cta_clicked$", "^action\\.modal_cta_clicked$"] }, 10);
913
2154
  const pendingEvent = recentEvents.filter((e) => {
914
- var _a;
915
- const actionId = (_a = e.props) == null ? void 0 : _a.actionId;
2155
+ var _a2;
2156
+ const actionId = (_a2 = e.props) == null ? void 0 : _a2.actionId;
916
2157
  return typeof actionId === "string" && actionId.startsWith("faq:open:");
917
2158
  }).pop();
918
2159
  if (pendingEvent && Date.now() - pendingEvent.ts < 1e4) {
@@ -926,8 +2167,8 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
926
2167
  }
927
2168
  }
928
2169
  const unsubscribe = runtime7.events.subscribe({ patterns: ["^action\\.tooltip_cta_clicked$", "^action\\.modal_cta_clicked$"] }, (event) => {
929
- var _a;
930
- const actionId = (_a = event.props) == null ? void 0 : _a.actionId;
2170
+ var _a2;
2171
+ const actionId = (_a2 = event.props) == null ? void 0 : _a2.actionId;
931
2172
  if (typeof actionId !== "string" || !actionId.startsWith("faq:open:"))
932
2173
  return;
933
2174
  const questionId = actionId.replace("faq:open:", "");
@@ -945,8 +2186,8 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
945
2186
  if (!runtime7.events.subscribe)
946
2187
  return;
947
2188
  const handleDeepLink = (event) => {
948
- var _a, _b;
949
- const tileId = (_a = event.props) == null ? void 0 : _a.tileId;
2189
+ var _a2, _b;
2190
+ const tileId = (_a2 = event.props) == null ? void 0 : _a2.tileId;
950
2191
  const itemId = (_b = event.props) == null ? void 0 : _b.itemId;
951
2192
  if (tileId !== instanceId)
952
2193
  return;
@@ -964,8 +2205,8 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
964
2205
  if (runtime7.events.getRecent) {
965
2206
  const recent = runtime7.events.getRecent({ names: ["notification.deep_link"] }, 5);
966
2207
  const pending = recent.filter((e) => {
967
- var _a, _b;
968
- return ((_a = e.props) == null ? void 0 : _a.tileId) === instanceId && ((_b = e.props) == null ? void 0 : _b.itemId);
2208
+ var _a2, _b;
2209
+ return ((_a2 = e.props) == null ? void 0 : _a2.tileId) === instanceId && ((_b = e.props) == null ? void 0 : _b.itemId);
969
2210
  }).pop();
970
2211
  if (pending && Date.now() - pending.ts < 1e4) {
971
2212
  handleDeepLink(pending);
@@ -974,17 +2215,20 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
974
2215
  const unsubscribe = runtime7.events.subscribe({ names: ["notification.deep_link"] }, handleDeepLink);
975
2216
  return unsubscribe;
976
2217
  }, [runtime7, instanceId]);
977
- const visibleQuestions = useMemo(() => config.actions.filter((q) => {
978
- if (!q.triggerWhen)
979
- return true;
980
- const result = runtime7.evaluateSync(q.triggerWhen);
981
- return result.value;
982
- }), [config.actions, runtime7, renderTick]);
2218
+ const visibleQuestions = useMemo(() => {
2219
+ var _a2;
2220
+ return ((_a2 = config.actions) != null ? _a2 : []).filter((q2) => {
2221
+ if (!q2.triggerWhen)
2222
+ return true;
2223
+ const result = runtime7.evaluateSync(q2.triggerWhen);
2224
+ return result.value;
2225
+ });
2226
+ }, [config.actions, runtime7, renderTick]);
983
2227
  const orderedQuestions = useMemo(() => {
984
2228
  if (config.ordering === "priority") {
985
- return [...visibleQuestions].sort((a, b) => {
986
- var _a, _b;
987
- return ((_a = b.config.priority) != null ? _a : 0) - ((_b = a.config.priority) != null ? _b : 0);
2229
+ return [...visibleQuestions].sort((a, b2) => {
2230
+ var _a2, _b;
2231
+ return ((_a2 = b2.config.priority) != null ? _a2 : 0) - ((_b = a.config.priority) != null ? _b : 0);
988
2232
  });
989
2233
  }
990
2234
  return visibleQuestions;
@@ -994,29 +2238,29 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
994
2238
  return orderedQuestions;
995
2239
  }
996
2240
  const query = searchQuery.toLowerCase();
997
- return orderedQuestions.filter((q) => {
998
- var _a;
999
- return q.config.question.toLowerCase().includes(query) || getAnswerText(q.config.answer).toLowerCase().includes(query) || ((_a = q.config.category) == null ? void 0 : _a.toLowerCase().includes(query));
2241
+ return orderedQuestions.filter((q2) => {
2242
+ var _a2;
2243
+ return q2.config.question.toLowerCase().includes(query) || getAnswerText(q2.config.answer).toLowerCase().includes(query) || ((_a2 = q2.config.category) == null ? void 0 : _a2.toLowerCase().includes(query));
1000
2244
  });
1001
2245
  }, [orderedQuestions, searchQuery, config.searchable]);
1002
2246
  const categoryGroups = useMemo(() => {
1003
2247
  const groups = /* @__PURE__ */ new Map();
1004
- for (const q of filteredQuestions) {
1005
- const cat = q.config.category;
2248
+ for (const q2 of filteredQuestions) {
2249
+ const cat = q2.config.category;
1006
2250
  if (!groups.has(cat)) {
1007
2251
  groups.set(cat, []);
1008
2252
  }
1009
- groups.get(cat).push(q);
2253
+ groups.get(cat).push(q2);
1010
2254
  }
1011
2255
  return groups;
1012
2256
  }, [filteredQuestions]);
1013
- const hasCategories = useMemo(() => filteredQuestions.some((q) => q.config.category), [filteredQuestions]);
2257
+ const hasCategories = useMemo(() => filteredQuestions.some((q2) => q2.config.category), [filteredQuestions]);
1014
2258
  const resolvedTheme = useMemo(() => {
1015
- var _a;
2259
+ var _a2;
1016
2260
  if (config.theme && config.theme !== "auto")
1017
2261
  return config.theme;
1018
2262
  if (typeof window !== "undefined") {
1019
- return ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
2263
+ return ((_a2 = window.matchMedia) == null ? void 0 : _a2.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
1020
2264
  }
1021
2265
  return "light";
1022
2266
  }, [config.theme]);
@@ -1071,7 +2315,7 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
1071
2315
  ...baseStyles.categoryHeader,
1072
2316
  ...themeStyles[resolvedTheme].categoryHeader
1073
2317
  };
1074
- const renderItems = (items) => items.map((q, index) => _jsx2(FAQItem, { item: q, isExpanded: expandedIds.has(q.config.id), isHighlighted: highlightId === q.config.id, isLast: index === items.length - 1, onToggle: () => handleToggle(q.config.id), theme: resolvedTheme, feedbackConfig, feedbackValue: feedbackState.get(q.config.id), onFeedback: handleFeedback }, q.config.id));
2318
+ const renderItems = (items) => items.map((q2, index) => _jsx2(FAQItem, { item: q2, isExpanded: expandedIds.has(q2.config.id), isHighlighted: highlightId === q2.config.id, isLast: index === items.length - 1, onToggle: () => handleToggle(q2.config.id), theme: resolvedTheme, feedbackConfig, feedbackValue: feedbackState.get(q2.config.id), onFeedback: handleFeedback }, q2.config.id));
1075
2319
  if (visibleQuestions.length === 0) {
1076
2320
  return _jsx2("div", { style: containerStyle, "data-adaptive-id": instanceId, "data-adaptive-type": "adaptive-faq", children: _jsx2("div", { style: emptyStateStyle, children: "You're all set for now! We'll surface answers here when they're relevant to what you're doing." }) });
1077
2321
  }
@@ -1096,20 +2340,6 @@ var FAQMountableWidget = {
1096
2340
  root.unmount();
1097
2341
  };
1098
2342
  }
1099
- const questions = faqConfig.actions || [];
1100
- container.innerHTML = `
1101
- <div style="font-family: system-ui; max-width: 800px;">
1102
- ${questions.map((q) => `
1103
- <div style="margin-bottom: 8px; padding: 16px; background: ${slateGrey[12]}; border-radius: 8px;">
1104
- <strong>${q.config.question}</strong>
1105
- <p style="margin-top: 8px; color: ${slateGrey[6]};">${getAnswerText(q.config.answer)}</p>
1106
- </div>
1107
- `).join("")}
1108
- </div>
1109
- `;
1110
- return () => {
1111
- container.innerHTML = "";
1112
- };
1113
2343
  }
1114
2344
  };
1115
2345
 
@@ -1144,8 +2374,8 @@ var runtime4 = {
1144
2374
  * and publishes faq:question_revealed when triggerWhen transitions false → true.
1145
2375
  */
1146
2376
  notifyWatchers(props) {
1147
- var _a;
1148
- const actions = (_a = props.actions) != null ? _a : [];
2377
+ var _a2;
2378
+ const actions = (_a2 = props.actions) != null ? _a2 : [];
1149
2379
  return actions.filter((a) => a.notify && a.triggerWhen).map((a) => ({
1150
2380
  id: `faq:${a.config.id}`,
1151
2381
  strategy: a.triggerWhen,
@@ -1209,6 +2439,21 @@ var runtime5 = {
1209
2439
  import { jsx as _jsx3, jsxs as _jsxs3 } from "react/jsx-runtime";
1210
2440
  import React3, { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useReducer as useReducer2, useState as useState3 } from "react";
1211
2441
  import { createRoot as createRoot3 } from "react-dom/client";
2442
+ var EMOJI_SVG_MAP = {
2443
+ "\u{1F4B5}": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="12" x="2" y="6" rx="2"/><circle cx="12" cy="12" r="2"/><path d="M6 12h.01M18 12h.01"/></svg>',
2444
+ "\u{1F3DB}\uFE0F": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" x2="21" y1="22" y2="22"/><line x1="6" x2="6" y1="18" y2="11"/><line x1="10" x2="10" y1="18" y2="11"/><line x1="14" x2="14" y1="18" y2="11"/><line x1="18" x2="18" y1="18" y2="11"/><polygon points="12 2 20 7 4 7"/></svg>',
2445
+ "\u23ED\uFE0F": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 4 15 12 5 20 5 4"/><line x1="19" x2="19" y1="5" y2="19"/></svg>',
2446
+ "\u27A1\uFE0F": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>',
2447
+ "\u{1F4A1}": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/></svg>',
2448
+ "\u{1F4B0}": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="12" x="2" y="6" rx="2"/><circle cx="12" cy="12" r="2"/><path d="M6 12h.01M18 12h.01"/></svg>',
2449
+ "\u{1F4CB}": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/></svg>',
2450
+ "\u2705": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/></svg>',
2451
+ "\u26A0\uFE0F": '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>'
2452
+ };
2453
+ function renderIcon(emoji) {
2454
+ var _a2;
2455
+ return (_a2 = EMOJI_SVG_MAP[emoji]) != null ? _a2 : escapeHtml(emoji);
2456
+ }
1212
2457
  function escapeHtml(str) {
1213
2458
  return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
1214
2459
  }
@@ -1314,7 +2559,8 @@ var themeStyles2 = {
1314
2559
  color: "var(--sc-content-text-secondary-color)"
1315
2560
  },
1316
2561
  linkButton: {
1317
- backgroundColor: "var(--sc-color-primary, #6366f1)",
2562
+ // purple[4] = #6a59ce — design system primary purple, used as fallback when --sc-color-primary is not set
2563
+ backgroundColor: `var(--sc-color-primary, ${purple[4]})`,
1318
2564
  color: "#ffffff"
1319
2565
  },
1320
2566
  categoryHeader: {
@@ -1347,7 +2593,8 @@ var themeStyles2 = {
1347
2593
  color: "var(--sc-content-text-secondary-color)"
1348
2594
  },
1349
2595
  linkButton: {
1350
- backgroundColor: "var(--sc-color-primary, #6366f1)",
2596
+ // purple[4] = #6a59ce — design system primary purple, used as fallback when --sc-color-primary is not set
2597
+ backgroundColor: `var(--sc-color-primary, ${purple[4]})`,
1351
2598
  color: "#ffffff"
1352
2599
  },
1353
2600
  categoryHeader: {
@@ -1358,10 +2605,29 @@ var themeStyles2 = {
1358
2605
  }
1359
2606
  }
1360
2607
  };
1361
- function NavTipItem({ item, isExpanded, isLast, onToggle, onNavigate, theme }) {
2608
+ function routeMatchesCurrent(routes) {
2609
+ if (typeof window === "undefined")
2610
+ return false;
2611
+ const current = window.location.pathname;
2612
+ return routes.some((route) => {
2613
+ const routePath = route.split("?")[0].split("#")[0];
2614
+ if (routePath.endsWith("/**")) {
2615
+ return current.startsWith(routePath.slice(0, -3));
2616
+ }
2617
+ return current === routePath;
2618
+ });
2619
+ }
2620
+ function pulseElement(el) {
2621
+ const keyframes = [
2622
+ { boxShadow: "0 0 0 0 rgba(13, 148, 136, 0.5)" },
2623
+ { boxShadow: "0 0 0 8px rgba(13, 148, 136, 0)" }
2624
+ ];
2625
+ el.animate(keyframes, { duration: 600, iterations: 3, easing: "ease-out" });
2626
+ }
2627
+ function NavTipItem({ item, isExpanded, isLast, onToggle, onNavigate, onFocusAnchor, theme }) {
1362
2628
  const [isHovered, setIsHovered] = useState3(false);
1363
2629
  const colors = themeStyles2[theme];
1364
- const { title, description, href, icon, external } = item.config;
2630
+ const { title, description, href, icon, external, anchor } = item.config;
1365
2631
  const itemStyle = {
1366
2632
  ...baseStyles2.item,
1367
2633
  ...colors.item,
@@ -1383,17 +2649,26 @@ function NavTipItem({ item, isExpanded, isLast, onToggle, onNavigate, theme }) {
1383
2649
  maxHeight: isExpanded ? "500px" : "0",
1384
2650
  paddingBottom: isExpanded ? "16px" : "0"
1385
2651
  };
2652
+ const effectiveHref = anchor ? Array.isArray(anchor.route) ? anchor.route[0] : anchor.route : href;
2653
+ const isSamePage = anchor ? routeMatchesCurrent(Array.isArray(anchor.route) ? anchor.route : [anchor.route]) : effectiveHref ? routeMatchesCurrent([effectiveHref]) : false;
2654
+ const hasSelector = (anchor == null ? void 0 : anchor.selector) && anchor.selector !== "*";
2655
+ const isFocusAction = isSamePage && hasSelector;
2656
+ const hasAction = !!effectiveHref || isFocusAction;
1386
2657
  const handleLinkClick = (e) => {
1387
2658
  e.preventDefault();
1388
2659
  e.stopPropagation();
1389
- if (href) {
1390
- onNavigate(href, external != null ? external : false);
2660
+ if (isFocusAction && anchor) {
2661
+ onFocusAnchor(anchor);
2662
+ } else if (effectiveHref) {
2663
+ onNavigate(effectiveHref, external != null ? external : false);
1391
2664
  }
1392
2665
  };
1393
- return _jsxs3("div", { style: itemStyle, "data-nav-tip-id": item.config.id, children: [_jsxs3("button", { type: "button", style: headerStyle, onClick: onToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-expanded": isExpanded, children: [icon && _jsx3("span", { style: baseStyles2.icon, children: icon }), _jsx3("span", { children: title }), _jsx3("span", { style: chevronStyle, children: "\u203A" })] }), _jsxs3("div", { style: bodyStyle, "aria-hidden": !isExpanded, children: [_jsx3("p", { style: baseStyles2.description, children: description }), href && _jsxs3("a", { href, onClick: handleLinkClick, style: { ...baseStyles2.linkButton, ...colors.linkButton }, target: external ? "_blank" : void 0, rel: external ? "noopener noreferrer" : void 0, children: ["Go ", external ? "\u2197" : "\u2192"] })] })] });
2666
+ const ctaLabel = isFocusAction ? `Focus \u2192` : external ? `Go \u2197` : `Go \u2192`;
2667
+ return _jsxs3("div", { style: itemStyle, "data-nav-tip-id": item.config.id, children: [_jsxs3("button", { type: "button", style: headerStyle, onClick: onToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-expanded": isExpanded, children: [icon && // biome-ignore lint/security/noDangerouslySetInnerHtml: renderIcon returns sanitized SVG from EMOJI_SVG_MAP or escapeHtml
2668
+ _jsx3("span", { style: baseStyles2.icon, dangerouslySetInnerHTML: { __html: renderIcon(icon) } }), _jsx3("span", { children: title }), _jsx3("span", { style: chevronStyle, children: "\u203A" })] }), _jsxs3("div", { style: bodyStyle, "aria-hidden": !isExpanded, children: [_jsx3("p", { style: baseStyles2.description, children: description }), hasAction && _jsx3("a", { href: effectiveHref || "#", onClick: handleLinkClick, style: { ...baseStyles2.linkButton, ...colors.linkButton }, target: external ? "_blank" : void 0, rel: external ? "noopener noreferrer" : void 0, children: ctaLabel })] })] });
1394
2669
  }
1395
2670
  function NavWidget({ config, runtime: runtime7, instanceId }) {
1396
- const [renderTick, forceUpdate] = useReducer2((x) => x + 1, 0);
2671
+ const [renderTick, forceUpdate] = useReducer2((x2) => x2 + 1, 0);
1397
2672
  const [expandedIds, setExpandedIds] = useState3(/* @__PURE__ */ new Set());
1398
2673
  useEffect3(() => {
1399
2674
  const unsubscribe = runtime7.context.subscribe(() => {
@@ -1402,8 +2677,8 @@ function NavWidget({ config, runtime: runtime7, instanceId }) {
1402
2677
  return unsubscribe;
1403
2678
  }, [runtime7.context]);
1404
2679
  useEffect3(() => {
1405
- var _a;
1406
- if (!((_a = runtime7.accumulator) == null ? void 0 : _a.subscribe))
2680
+ var _a2;
2681
+ if (!((_a2 = runtime7.accumulator) == null ? void 0 : _a2.subscribe))
1407
2682
  return;
1408
2683
  return runtime7.accumulator.subscribe(() => {
1409
2684
  forceUpdate();
@@ -1432,11 +2707,11 @@ function NavWidget({ config, runtime: runtime7, instanceId }) {
1432
2707
  }, [visibleTips]);
1433
2708
  const hasCategories = useMemo2(() => visibleTips.some((t) => t.config.category), [visibleTips]);
1434
2709
  const resolvedTheme = useMemo2(() => {
1435
- var _a;
2710
+ var _a2;
1436
2711
  if (config.theme && config.theme !== "auto")
1437
2712
  return config.theme;
1438
2713
  if (typeof window !== "undefined") {
1439
- return ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
2714
+ return ((_a2 = window.matchMedia) == null ? void 0 : _a2.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
1440
2715
  }
1441
2716
  return "light";
1442
2717
  }, [config.theme]);
@@ -1489,9 +2764,26 @@ function NavWidget({ config, runtime: runtime7, instanceId }) {
1489
2764
  } else {
1490
2765
  const url = new URL(href, window.location.origin);
1491
2766
  url.search = window.location.search;
1492
- window.location.href = url.toString();
2767
+ if (!navigateWithFrameworkRouter(url.toString())) {
2768
+ window.history.pushState(null, "", url.toString());
2769
+ window.dispatchEvent(new PopStateEvent("popstate"));
2770
+ }
1493
2771
  }
1494
2772
  }, [runtime7.events, instanceId]);
2773
+ const handleFocusAnchor = useCallback3((anchor) => {
2774
+ const el = document.querySelector(anchor.selector);
2775
+ if (!(el instanceof HTMLElement))
2776
+ return;
2777
+ runtime7.events.publish("nav:tip_focused", {
2778
+ instanceId,
2779
+ selector: anchor.selector,
2780
+ route: anchor.route,
2781
+ timestamp: Date.now()
2782
+ });
2783
+ el.scrollIntoView({ behavior: "smooth", block: "center" });
2784
+ pulseElement(el);
2785
+ setTimeout(() => el.focus(), 400);
2786
+ }, [runtime7.events, instanceId]);
1495
2787
  const containerStyle = {
1496
2788
  ...baseStyles2.container,
1497
2789
  ...themeStyles2[resolvedTheme].container
@@ -1504,7 +2796,7 @@ function NavWidget({ config, runtime: runtime7, instanceId }) {
1504
2796
  ...baseStyles2.emptyState,
1505
2797
  ...themeStyles2[resolvedTheme].emptyState
1506
2798
  };
1507
- const renderItems = (items) => items.map((tip, index) => _jsx3(NavTipItem, { item: tip, isExpanded: expandedIds.has(tip.config.id), isLast: index === items.length - 1, onToggle: () => handleToggle(tip.config.id), onNavigate: handleNavigate, theme: resolvedTheme }, tip.config.id));
2799
+ const renderItems = (items) => items.map((tip, index) => _jsx3(NavTipItem, { item: tip, isExpanded: expandedIds.has(tip.config.id), isLast: index === items.length - 1, onToggle: () => handleToggle(tip.config.id), onNavigate: handleNavigate, onFocusAnchor: handleFocusAnchor, theme: resolvedTheme }, tip.config.id));
1508
2800
  if (visibleTips.length === 0) {
1509
2801
  return _jsx3("div", { style: containerStyle, "data-adaptive-id": instanceId, "data-adaptive-type": "adaptive-nav", children: _jsx3("div", { style: emptyStateStyle, children: "You're all set for now! We'll share helpful tips here when they're relevant to what you're doing." }) });
1510
2802
  }
@@ -1528,27 +2820,12 @@ var NavMountableWidget = {
1528
2820
  root.unmount();
1529
2821
  };
1530
2822
  }
1531
- const tips = navConfig.actions || [];
1532
- container.innerHTML = `
1533
- <div style="font-family: system-ui; max-width: 100%;">
1534
- ${tips.map((tip) => `
1535
- <div style="margin-bottom: 4px; padding: 12px 16px; background: ${slateGrey[12]}; border-radius: 8px;">
1536
- ${tip.config.icon ? `<span>${escapeHtml(tip.config.icon)}</span> ` : ""}<strong>${escapeHtml(tip.config.title)}</strong>
1537
- <p style="margin-top: 8px; color: ${slateGrey[6]}; font-size: 13px;">${escapeHtml(tip.config.description)}</p>
1538
- ${tip.config.href ? `<a href="${escapeHtml(tip.config.href)}" style="color: ${purple[2]}; font-size: 13px;">Go &rarr;</a>` : ""}
1539
- </div>
1540
- `).join("")}
1541
- </div>
1542
- `;
1543
- return () => {
1544
- container.innerHTML = "";
1545
- };
1546
2823
  }
1547
2824
  };
1548
2825
 
1549
2826
  // ../adaptives/adaptive-nav/dist/runtime.js
1550
2827
  var executeScrollTo = async (action, context) => {
1551
- var _a, _b, _c, _d;
2828
+ var _a2, _b, _c, _d;
1552
2829
  const anchorEl = context.resolveAnchor(action.anchorId);
1553
2830
  if (!anchorEl) {
1554
2831
  console.error(`[adaptive-nav] Anchor not found for scrollTo, skipping: ${action.anchorId.selector}`);
@@ -1556,7 +2833,7 @@ var executeScrollTo = async (action, context) => {
1556
2833
  } };
1557
2834
  }
1558
2835
  anchorEl.scrollIntoView({
1559
- behavior: (_a = action.behavior) != null ? _a : "smooth",
2836
+ behavior: (_a2 = action.behavior) != null ? _a2 : "smooth",
1560
2837
  block: (_b = action.block) != null ? _b : "center",
1561
2838
  inline: (_c = action.inline) != null ? _c : "nearest"
1562
2839
  });
@@ -1571,6 +2848,40 @@ var executeScrollTo = async (action, context) => {
1571
2848
  }
1572
2849
  };
1573
2850
  };
2851
+ function navigateWithFrameworkRouter(url) {
2852
+ var _a2, _b, _c, _d;
2853
+ if (typeof window === "undefined")
2854
+ return false;
2855
+ const w2 = window;
2856
+ try {
2857
+ const nextRouter = (_a2 = w2.next) == null ? void 0 : _a2.router;
2858
+ if (nextRouter == null ? void 0 : nextRouter.push) {
2859
+ nextRouter.push(url);
2860
+ return true;
2861
+ }
2862
+ } catch {
2863
+ }
2864
+ try {
2865
+ if ((_c = (_b = w2.$nuxt) == null ? void 0 : _b.$router) == null ? void 0 : _c.push) {
2866
+ w2.$nuxt.$router.push(url);
2867
+ return true;
2868
+ }
2869
+ } catch {
2870
+ }
2871
+ if (w2.ng || w2.getAllAngularRootElements || document.querySelector("[ng-version]")) {
2872
+ window.location.href = url;
2873
+ return true;
2874
+ }
2875
+ if (w2.__SVELTEKIT_DATA__ || ((_d = document.body) == null ? void 0 : _d.hasAttribute("data-sveltekit"))) {
2876
+ window.location.href = url;
2877
+ return true;
2878
+ }
2879
+ if (document.querySelector("[data-astro-transition-fallback]")) {
2880
+ window.location.href = url;
2881
+ return true;
2882
+ }
2883
+ return false;
2884
+ }
1574
2885
  function isSameOrigin(url) {
1575
2886
  try {
1576
2887
  const parsed = new URL(url, window.location.origin);
@@ -1580,12 +2891,12 @@ function isSameOrigin(url) {
1580
2891
  }
1581
2892
  }
1582
2893
  var executeNavigate = async (action, context) => {
1583
- var _a;
2894
+ var _a2;
1584
2895
  const url = action.url.trim();
1585
2896
  if (url.toLowerCase().startsWith("javascript:")) {
1586
2897
  throw new Error("javascript: URLs are not allowed");
1587
2898
  }
1588
- const target = (_a = action.target) != null ? _a : "_self";
2899
+ const target = (_a2 = action.target) != null ? _a2 : "_self";
1589
2900
  context.publishEvent("action.applied", {
1590
2901
  id: context.generateId(),
1591
2902
  kind: "navigation:navigate",
@@ -1595,8 +2906,10 @@ var executeNavigate = async (action, context) => {
1595
2906
  if (target === "_blank") {
1596
2907
  window.open(url, "_blank", "noopener,noreferrer");
1597
2908
  } else if (!action.forceFullNavigation && isSameOrigin(url)) {
1598
- window.history.pushState(null, "", url);
1599
- window.dispatchEvent(new PopStateEvent("popstate"));
2909
+ if (!navigateWithFrameworkRouter(url)) {
2910
+ window.history.pushState(null, "", url);
2911
+ window.dispatchEvent(new PopStateEvent("popstate"));
2912
+ }
1600
2913
  } else {
1601
2914
  window.location.href = url;
1602
2915
  }
@@ -1638,8 +2951,8 @@ var runtime6 = {
1638
2951
  * and publishes nav:tip_revealed when triggerWhen transitions false → true.
1639
2952
  */
1640
2953
  notifyWatchers(props) {
1641
- var _a;
1642
- const actions = (_a = props.actions) != null ? _a : [];
2954
+ var _a2;
2955
+ const actions = (_a2 = props.actions) != null ? _a2 : [];
1643
2956
  return actions.filter((a) => a.notify && a.triggerWhen).map((a) => ({
1644
2957
  id: `nav:${a.config.id}`,
1645
2958
  strategy: a.triggerWhen,
@@ -1687,9 +3000,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
1687
3000
  function TileWheel({ tiles, intervalMs = 7e3, telemetry }) {
1688
3001
  const [index, setIndex] = useState4(0);
1689
3002
  const ordered = useMemo3(
1690
- () => [...tiles].sort((a, b) => {
1691
- var _a, _b;
1692
- return ((_a = a.priority) != null ? _a : 0) - ((_b = b.priority) != null ? _b : 0);
3003
+ () => [...tiles].sort((a, b2) => {
3004
+ var _a2, _b;
3005
+ return ((_a2 = a.priority) != null ? _a2 : 0) - ((_b = b2.priority) != null ? _b : 0);
1693
3006
  }),
1694
3007
  [tiles]
1695
3008
  );
@@ -1857,50 +3170,50 @@ function needsMigration(config) {
1857
3170
  }
1858
3171
 
1859
3172
  // src/overlays/schema.ts
1860
- import { z } from "zod";
1861
- var SelectorZ = z.union([
1862
- z.object({ type: z.literal("data"), key: z.string(), value: z.string().optional() }),
1863
- z.object({ type: z.literal("css"), value: z.string() }),
1864
- z.object({ type: z.literal("aria"), role: z.string().optional(), label: z.string().optional() }),
1865
- z.object({ type: z.literal("shadow-css"), value: z.string() }),
1866
- z.object({ type: z.literal("ref"), el: z.any() })
3173
+ import { z as z2 } from "zod";
3174
+ var SelectorZ = z2.union([
3175
+ z2.object({ type: z2.literal("data"), key: z2.string(), value: z2.string().optional() }),
3176
+ z2.object({ type: z2.literal("css"), value: z2.string() }),
3177
+ z2.object({ type: z2.literal("aria"), role: z2.string().optional(), label: z2.string().optional() }),
3178
+ z2.object({ type: z2.literal("shadow-css"), value: z2.string() }),
3179
+ z2.object({ type: z2.literal("ref"), el: z2.any() })
1867
3180
  // runtime-only
1868
3181
  ]);
1869
- var TooltipStepZ = z.object({
1870
- kind: z.literal("tooltip"),
1871
- id: z.string(),
3182
+ var TooltipStepZ = z2.object({
3183
+ kind: z2.literal("tooltip"),
3184
+ id: z2.string(),
1872
3185
  anchor: SelectorZ,
1873
- content: z.object({ title: z.string().optional(), body: z.string() }),
1874
- placement: z.enum(["top", "bottom", "left", "right", "auto"]).optional(),
1875
- offsetPx: z.number().optional(),
1876
- blocking: z.boolean().optional(),
1877
- trigger: z.enum(["immediate", "hover", "click"]).optional(),
1878
- dismiss: z.object({
1879
- onEsc: z.boolean().optional(),
1880
- closeButton: z.boolean().optional(),
1881
- timeoutMs: z.number().optional()
3186
+ content: z2.object({ title: z2.string().optional(), body: z2.string() }),
3187
+ placement: z2.enum(["top", "bottom", "left", "right", "auto"]).optional(),
3188
+ offsetPx: z2.number().optional(),
3189
+ blocking: z2.boolean().optional(),
3190
+ trigger: z2.enum(["immediate", "hover", "click"]).optional(),
3191
+ dismiss: z2.object({
3192
+ onEsc: z2.boolean().optional(),
3193
+ closeButton: z2.boolean().optional(),
3194
+ timeoutMs: z2.number().optional()
1882
3195
  }).optional()
1883
3196
  });
1884
- var HighlightStepZ = z.object({
1885
- kind: z.literal("highlight"),
1886
- id: z.string(),
3197
+ var HighlightStepZ = z2.object({
3198
+ kind: z2.literal("highlight"),
3199
+ id: z2.string(),
1887
3200
  anchor: SelectorZ,
1888
- copy: z.string().optional(),
1889
- ring: z.object({ paddingPx: z.number().optional(), radiusPx: z.number().optional() }).optional(),
1890
- scrim: z.object({ opacity: z.number().optional() }).optional(),
1891
- ringColor: z.string().optional(),
1892
- blocking: z.boolean().optional(),
1893
- dismiss: z.object({
1894
- onClickOutside: z.boolean().optional(),
1895
- onEsc: z.boolean().optional(),
1896
- timeoutMs: z.number().optional()
3201
+ copy: z2.string().optional(),
3202
+ ring: z2.object({ paddingPx: z2.number().optional(), radiusPx: z2.number().optional() }).optional(),
3203
+ scrim: z2.object({ opacity: z2.number().optional() }).optional(),
3204
+ ringColor: z2.string().optional(),
3205
+ blocking: z2.boolean().optional(),
3206
+ dismiss: z2.object({
3207
+ onClickOutside: z2.boolean().optional(),
3208
+ onEsc: z2.boolean().optional(),
3209
+ timeoutMs: z2.number().optional()
1897
3210
  }).optional()
1898
3211
  });
1899
- var CanvasRecipeZ = z.object({
1900
- id: z.string(),
1901
- version: z.number(),
1902
- routes: z.array(z.string()).optional(),
1903
- steps: z.array(z.union([TooltipStepZ, HighlightStepZ]))
3212
+ var CanvasRecipeZ = z2.object({
3213
+ id: z2.string(),
3214
+ version: z2.number(),
3215
+ routes: z2.array(z2.string()).optional(),
3216
+ steps: z2.array(z2.union([TooltipStepZ, HighlightStepZ]))
1904
3217
  });
1905
3218
  function validateRecipe(json) {
1906
3219
  return CanvasRecipeZ.parse(json);
@@ -1943,47 +3256,47 @@ function SmartCanvasPortal({ element, children }) {
1943
3256
  }
1944
3257
 
1945
3258
  // src/context/schema.ts
1946
- import { z as z2 } from "zod";
1947
- var PageContextZ = z2.object({
1948
- url: z2.string(),
1949
- routeId: z2.string().optional(),
1950
- title: z2.string().optional(),
1951
- locale: z2.string().optional()
3259
+ import { z as z3 } from "zod";
3260
+ var PageContextZ = z3.object({
3261
+ url: z3.string(),
3262
+ routeId: z3.string().optional(),
3263
+ title: z3.string().optional(),
3264
+ locale: z3.string().optional()
1952
3265
  });
1953
- var PageHistoryEntryZ = z2.object({
1954
- url: z2.string(),
1955
- ts: z2.number()
3266
+ var PageHistoryEntryZ = z3.object({
3267
+ url: z3.string(),
3268
+ ts: z3.number()
1956
3269
  });
1957
- var SessionContextZ = z2.object({
1958
- sessionId: z2.string(),
1959
- startTs: z2.number(),
1960
- pageHistory: z2.array(PageHistoryEntryZ).optional()
3270
+ var SessionContextZ = z3.object({
3271
+ sessionId: z3.string(),
3272
+ startTs: z3.number(),
3273
+ pageHistory: z3.array(PageHistoryEntryZ).optional()
1961
3274
  });
1962
- var ViewportContextZ = z2.object({
1963
- width: z2.number(),
1964
- height: z2.number()
3275
+ var ViewportContextZ = z3.object({
3276
+ width: z3.number(),
3277
+ height: z3.number()
1965
3278
  });
1966
- var BoundingBoxZ = z2.object({
1967
- x: z2.number(),
1968
- y: z2.number(),
1969
- w: z2.number(),
1970
- h: z2.number()
3279
+ var BoundingBoxZ = z3.object({
3280
+ x: z3.number(),
3281
+ y: z3.number(),
3282
+ w: z3.number(),
3283
+ h: z3.number()
1971
3284
  });
1972
- var AnchorStateZ = z2.object({
1973
- anchorId: z2.string(),
1974
- present: z2.boolean(),
1975
- visible: z2.boolean().optional(),
3285
+ var AnchorStateZ = z3.object({
3286
+ anchorId: z3.string(),
3287
+ present: z3.boolean(),
3288
+ visible: z3.boolean().optional(),
1976
3289
  boundingBox: BoundingBoxZ.optional()
1977
3290
  });
1978
- var AugmentationZ = z2.record(
1979
- z2.string(),
1980
- z2.union([z2.number(), z2.string(), z2.boolean(), z2.undefined()])
3291
+ var AugmentationZ = z3.record(
3292
+ z3.string(),
3293
+ z3.union([z3.number(), z3.string(), z3.boolean(), z3.undefined()])
1981
3294
  );
1982
- var RuntimeContextZ = z2.object({
3295
+ var RuntimeContextZ = z3.object({
1983
3296
  page: PageContextZ,
1984
3297
  session: SessionContextZ,
1985
3298
  viewport: ViewportContextZ,
1986
- anchors: z2.array(AnchorStateZ).optional(),
3299
+ anchors: z3.array(AnchorStateZ).optional(),
1987
3300
  augmented: AugmentationZ.optional()
1988
3301
  });
1989
3302
  function validateRuntimeContext(data) {
@@ -1991,19 +3304,19 @@ function validateRuntimeContext(data) {
1991
3304
  }
1992
3305
 
1993
3306
  // src/events/schema.ts
1994
- import { z as z3 } from "zod";
1995
- var EventSourceZ = z3.enum(["posthog", "canvas", "derived"]);
1996
- var NormalizedEventZ = z3.object({
1997
- ts: z3.number(),
1998
- name: z3.string(),
3307
+ import { z as z4 } from "zod";
3308
+ var EventSourceZ = z4.enum(["posthog", "canvas", "derived"]);
3309
+ var NormalizedEventZ = z4.object({
3310
+ ts: z4.number(),
3311
+ name: z4.string(),
1999
3312
  source: EventSourceZ,
2000
- props: z3.record(z3.string(), z3.unknown()).optional(),
2001
- schemaVersion: z3.string()
3313
+ props: z4.record(z4.string(), z4.unknown()).optional(),
3314
+ schemaVersion: z4.string()
2002
3315
  });
2003
- var EventFilterZ = z3.object({
2004
- names: z3.array(z3.string()).optional(),
2005
- patterns: z3.array(z3.string()).optional(),
2006
- sources: z3.array(EventSourceZ).optional()
3316
+ var EventFilterZ = z4.object({
3317
+ names: z4.array(z4.string()).optional(),
3318
+ patterns: z4.array(z4.string()).optional(),
3319
+ sources: z4.array(EventSourceZ).optional()
2007
3320
  });
2008
3321
  function validateNormalizedEvent(data) {
2009
3322
  return NormalizedEventZ.safeParse(data);
@@ -2013,14 +3326,14 @@ function validateEventFilter(data) {
2013
3326
  }
2014
3327
 
2015
3328
  // src/state/schema.ts
2016
- import { z as z4 } from "zod";
2017
- var StoredValueZ = z4.object({
2018
- value: z4.unknown(),
2019
- expiresAt: z4.number().optional()
3329
+ import { z as z5 } from "zod";
3330
+ var StoredValueZ = z5.object({
3331
+ value: z5.unknown(),
3332
+ expiresAt: z5.number().optional()
2020
3333
  });
2021
- var FrequencyEntryZ = z4.object({
2022
- count: z4.number(),
2023
- resetAt: z4.number().optional()
3334
+ var FrequencyEntryZ = z5.object({
3335
+ count: z5.number(),
3336
+ resetAt: z5.number().optional()
2024
3337
  });
2025
3338
  function validateStoredValue(data) {
2026
3339
  return StoredValueZ.safeParse(data);
@@ -2071,6 +3384,7 @@ export {
2071
3384
  EventBus,
2072
3385
  EventCountConditionZ,
2073
3386
  EventFilterZ,
3387
+ EventHistory,
2074
3388
  EventOccurredConditionZ,
2075
3389
  EventSourceZ,
2076
3390
  ExecutorRegistry,
@@ -2082,6 +3396,7 @@ export {
2082
3396
  HighlightZ,
2083
3397
  InsertHtmlZ,
2084
3398
  InsertPositionZ,
3399
+ InterventionTracker,
2085
3400
  MAX_VISIBLE_TOASTS,
2086
3401
  MatchOpZ,
2087
3402
  ModalContentZ,
@@ -2224,8 +3539,10 @@ export {
2224
3539
  validateCondition,
2225
3540
  validateConfig,
2226
3541
  validateEventFilter,
3542
+ validateEventName,
2227
3543
  validateFrequencyEntry,
2228
3544
  validateNormalizedEvent,
3545
+ validateProps,
2229
3546
  validateRecipe,
2230
3547
  validateRuntimeContext,
2231
3548
  validateStoredValue,