@airalogy/aimd-renderer 2.4.1 → 2.6.0

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 (45) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +10 -5
  3. package/README.zh-CN.md +10 -5
  4. package/dist/__tests__/renderer.test.d.ts +2 -0
  5. package/dist/__tests__/renderer.test.d.ts.map +1 -0
  6. package/dist/aimd-renderer.css +1 -1
  7. package/dist/common/annotateStepReferences.d.ts +10 -0
  8. package/dist/common/annotateStepReferences.d.ts.map +1 -0
  9. package/dist/common/assignerHighlighting.d.ts +14 -0
  10. package/dist/common/assignerHighlighting.d.ts.map +1 -0
  11. package/dist/common/assignerVisibility.d.ts +33 -0
  12. package/dist/common/assignerVisibility.d.ts.map +1 -0
  13. package/dist/common/eventKeys.d.ts +20 -0
  14. package/dist/common/eventKeys.d.ts.map +1 -0
  15. package/dist/common/figureNumbering.d.ts +30 -0
  16. package/dist/common/figureNumbering.d.ts.map +1 -0
  17. package/dist/common/processor.d.ts +96 -0
  18. package/dist/common/processor.d.ts.map +1 -0
  19. package/dist/common/quiz-preview.d.ts +11 -0
  20. package/dist/common/quiz-preview.d.ts.map +1 -0
  21. package/dist/common/unified-token-renderer.d.ts +124 -0
  22. package/dist/common/unified-token-renderer.d.ts.map +1 -0
  23. package/dist/html/index.d.ts +9 -0
  24. package/dist/html/index.d.ts.map +1 -0
  25. package/dist/html.js +1 -1
  26. package/dist/index.d.ts +23 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +270 -225
  29. package/dist/locales.d.ts +52 -0
  30. package/dist/locales.d.ts.map +1 -0
  31. package/dist/{processor-Cv8E7QsA.js → processor-CHbNEcN8.js} +2977 -2212
  32. package/dist/vue/index.d.ts +10 -0
  33. package/dist/vue/index.d.ts.map +1 -0
  34. package/dist/vue/vue-renderer.d.ts +159 -0
  35. package/dist/vue/vue-renderer.d.ts.map +1 -0
  36. package/dist/vue.js +10 -9
  37. package/package.json +17 -17
  38. package/src/__tests__/renderer.test.ts +220 -2
  39. package/src/common/processor.ts +177 -43
  40. package/src/common/unified-token-renderer.ts +106 -26
  41. package/src/index.ts +3 -0
  42. package/src/locales.ts +5 -0
  43. package/src/styles/katex.css +109 -0
  44. package/src/vue/index.ts +3 -0
  45. package/src/vue/vue-renderer.ts +320 -50
package/dist/index.js CHANGED
@@ -1,37 +1,37 @@
1
- import { e as V, c as C, p as I, q as K, s as j, t as x, u as D } from "./processor-Cv8E7QsA.js";
2
- import { D as ie, f as re, g as ne, h as le, a as ce, i as de, b as oe, j as me, k as pe, l as ue, m as fe, n as _e, r as ye, d as ge, o as he } from "./processor-Cv8E7QsA.js";
1
+ import { e as V, c as D, p as B, s as H, t as I, u as z, v as F, w as j, x as K, y as N, z as O, A as Q } from "./processor-CHbNEcN8.js";
2
+ import { D as pe, f as ue, g as fe, h as _e, a as ye, i as ge, b as ve, j as he, k as be, l as Ae, m as we, n as xe, o as Te, r as ke, d as Re, q as qe } from "./processor-CHbNEcN8.js";
3
3
  import { h as e } from "vue";
4
- const W = /* @__PURE__ */ Symbol("symbol-field-event-key"), J = /* @__PURE__ */ Symbol("symbol-protocol-key"), G = /* @__PURE__ */ Symbol("draft-event-key"), X = /* @__PURE__ */ Symbol("symbol-report-event-key"), Y = /* @__PURE__ */ Symbol("symbol-bubble-menu-event-key");
5
- function B(t) {
6
- return t === "var_table" ? "table" : t;
4
+ const te = /* @__PURE__ */ Symbol("symbol-field-event-key"), ie = /* @__PURE__ */ Symbol("symbol-protocol-key"), se = /* @__PURE__ */ Symbol("draft-event-key"), re = /* @__PURE__ */ Symbol("symbol-report-event-key"), ne = /* @__PURE__ */ Symbol("symbol-bubble-menu-event-key");
5
+ function U(a) {
6
+ return a === "var_table" ? "table" : a;
7
7
  }
8
- const H = /\[\[([^\[\]\s]+)\]\]/g;
9
- function z(t, i) {
10
- if (t !== "blank")
8
+ const W = /\[\[([^\[\]\s]+)\]\]/g;
9
+ function E(a, i) {
10
+ if (a !== "blank")
11
11
  return [e("span", i)];
12
- const n = [];
12
+ const r = [];
13
13
  let l = 0;
14
- for (const r of i.matchAll(H)) {
15
- const o = r.index ?? 0, h = r[0], m = r[1];
16
- o > l && n.push(e("span", i.slice(l, o))), n.push(
14
+ for (const n of i.matchAll(W)) {
15
+ const d = n.index ?? 0, g = n[0], p = n[1];
16
+ d > l && r.push(e("span", i.slice(l, d))), r.push(
17
17
  e("span", {
18
18
  class: "aimd-quiz__blank-placeholder",
19
- "data-blank-key": m
20
- }, m)
21
- ), l = o + h.length;
19
+ "data-blank-key": p
20
+ }, p)
21
+ ), l = d + g.length;
22
22
  }
23
- return l < i.length && n.push(e("span", i.slice(l))), n.length === 0 && n.push(e("span", i)), n;
23
+ return l < i.length && r.push(e("span", i.slice(l))), r.length === 0 && r.push(e("span", i)), r;
24
24
  }
25
- function P(t) {
26
- return typeof t.points == "number" && Number.isFinite(t.points) ? `${t.text} (${t.points})` : t.text;
25
+ function L(a) {
26
+ return typeof a.points == "number" && Number.isFinite(a.points) ? `${a.text} (${a.points})` : a.text;
27
27
  }
28
- function E(t) {
29
- return !Array.isArray(t.items) || t.items.length === 0 || !Array.isArray(t.options) || t.options.length === 0 ? [e("div", { class: "aimd-scale__empty" }, "Scale definition is incomplete.")] : t.display === "list" ? [
30
- e("div", { class: "aimd-scale__list" }, t.items.map(
28
+ function P(a) {
29
+ return !Array.isArray(a.items) || a.items.length === 0 || !Array.isArray(a.options) || a.options.length === 0 ? [e("div", { class: "aimd-scale__empty" }, "Scale definition is incomplete.")] : a.display === "list" ? [
30
+ e("div", { class: "aimd-scale__list" }, a.items.map(
31
31
  (i) => e("div", { class: "aimd-scale__list-item" }, [
32
32
  e("div", { class: "aimd-scale__item-stem" }, i.stem),
33
- e("ul", { class: "aimd-scale__item-options" }, t.options.map(
34
- (n) => e("li", P(n))
33
+ e("ul", { class: "aimd-scale__item-options" }, a.options.map(
34
+ (r) => e("li", L(r))
35
35
  ))
36
36
  ])
37
37
  ))
@@ -40,39 +40,83 @@ function E(t) {
40
40
  e("thead", [
41
41
  e("tr", [
42
42
  e("th", { class: "aimd-scale__item-header" }, "Item"),
43
- ...t.options.map((i) => e("th", P(i)))
43
+ ...a.options.map((i) => e("th", L(i)))
44
44
  ])
45
45
  ]),
46
- e("tbody", t.items.map(
46
+ e("tbody", a.items.map(
47
47
  (i) => e("tr", [
48
48
  e("th", { class: "aimd-scale__item-stem", scope: "row" }, i.stem),
49
- ...t.options.map(() => e("td", { class: "aimd-scale__cell" }, "○"))
49
+ ...a.options.map(() => e("td", { class: "aimd-scale__cell" }, "○"))
50
50
  ])
51
51
  ))
52
52
  ])
53
53
  ];
54
54
  }
55
- function L(t) {
56
- const i = Array.isArray(t.grading?.bands) ? t.grading.bands : [];
55
+ function M(a) {
56
+ const i = Array.isArray(a.grading?.bands) ? a.grading.bands : [];
57
57
  return i.length === 0 ? [] : [
58
58
  e("ul", { class: "aimd-scale__bands" }, i.map(
59
- (n) => e("li", `${n.min}-${n.max}: ${n.label}${n.interpretation ? ` · ${n.interpretation}` : ""}`)
59
+ (r) => e("li", `${r.min}-${r.max}: ${r.label}${r.interpretation ? ` · ${r.interpretation}` : ""}`)
60
60
  ))
61
61
  ];
62
62
  }
63
- function T(t, i, n, l) {
64
- const r = B(t), o = x(t, n);
65
- if (t === "var_table") {
66
- const m = [
63
+ function J(a) {
64
+ const i = N(a), r = O(a).map(Q).map((d) => d.trim()).filter(Boolean), l = r.length > 0 ? `e.g. ${r.join(", ")}` : void 0;
65
+ return {
66
+ tooltip: [i, l].filter((d) => !!d).join(`
67
+ `),
68
+ description: i,
69
+ examples: r
70
+ };
71
+ }
72
+ function G(a) {
73
+ if (!a.description && a.examples.length === 0)
74
+ return null;
75
+ const i = [];
76
+ return a.description && i.push(e("span", {
77
+ class: "aimd-field__metadata-popover-line"
78
+ }, a.description)), a.examples.length > 0 && i.push(e("span", { class: "aimd-field__metadata-examples" }, [
79
+ e("span", { class: "aimd-field__metadata-examples-label" }, "e.g."),
80
+ ...a.examples.map((r, l) => e("span", {
81
+ key: `${l}-${r}`,
82
+ class: "aimd-field__metadata-example"
83
+ }, r))
84
+ ])), e("span", {
85
+ class: "aimd-field__metadata-popover",
86
+ role: "tooltip"
87
+ }, i);
88
+ }
89
+ function $(a, i) {
90
+ const r = j(a, i), l = K(i) !== void 0 && r !== a, n = J(i), d = !!n.description || n.examples.length > 0;
91
+ return e("span", {
92
+ class: [
93
+ "aimd-field__name",
94
+ l || d ? "aimd-field__name--with-metadata" : void 0,
95
+ d ? "aimd-field__metadata-host" : void 0
96
+ ],
97
+ tabindex: d ? 0 : void 0,
98
+ "aria-label": n.tooltip || void 0
99
+ }, [
100
+ e("span", { class: "aimd-field__title" }, r),
101
+ l ? e("span", { class: "aimd-field__key" }, a) : null,
102
+ G(n)
103
+ ]);
104
+ }
105
+ function R(a, i, r, l, n) {
106
+ const d = U(a), g = z(a, r);
107
+ if (a === "var_table") {
108
+ const u = [
67
109
  e("div", { class: "aimd-field__header" }, [
68
- e("span", { class: "aimd-field__scope" }, n.scope.table),
69
- e("span", { class: "aimd-field__name" }, i)
110
+ e("span", { class: "aimd-field__scope" }, r.scope.table),
111
+ $(i, n)
70
112
  ])
71
113
  ];
72
- return l && l.length > 0 && m.push(
114
+ return l && l.length > 0 && u.push(
73
115
  e("table", { class: "aimd-field__table-preview" }, [
74
116
  e("thead", [
75
- e("tr", l.map((u) => e("th", u)))
117
+ e("tr", l.map((b) => e("th", {
118
+ "data-column-id": b
119
+ }, [$(b, n?.subvars?.[b])])))
76
120
  ]),
77
121
  e("tbody", [
78
122
  e("tr", l.map(() => e("td", "...")))
@@ -82,107 +126,107 @@ function T(t, i, n, l) {
82
126
  class: "aimd-field aimd-field--var-table",
83
127
  "data-aimd-type": "var_table",
84
128
  "data-aimd-id": i
85
- }, m);
129
+ }, u);
86
130
  }
87
131
  return e("span", {
88
- class: `aimd-field aimd-field--${r === "table" ? "var-table" : r}`,
89
- "data-aimd-type": r,
132
+ class: `aimd-field aimd-field--${d === "table" ? "var-table" : d}`,
133
+ "data-aimd-type": d,
90
134
  "data-aimd-id": i
91
135
  }, [
92
- e("span", { class: "aimd-field__scope" }, o),
93
- e("span", { class: "aimd-field__name" }, i)
136
+ e("span", { class: "aimd-field__scope" }, g),
137
+ $(i, n)
94
138
  ]);
95
139
  }
96
- function O(t) {
97
- const { getTokenProps: i, mode: n, components: l = {} } = t, r = C(t.locale, t.messages), {
98
- AIMDItem: o,
99
- AIMDTag: h,
100
- AIMDStepRef: m,
140
+ function X(a) {
141
+ const { getTokenProps: i, mode: r, components: l = {} } = a, n = D(a.locale, a.messages), {
142
+ AIMDItem: d,
143
+ AIMDTag: g,
144
+ AIMDStepRef: p,
101
145
  StepRenderer: u,
102
- CheckRenderer: q,
146
+ CheckRenderer: b,
103
147
  PreviewRenderer: _
104
- } = l, b = () => typeof n == "function" ? n() : n, v = () => b() === "preview", w = () => D(b(), t.quizPreview);
148
+ } = l, w = () => typeof r == "function" ? r() : r, A = () => w() === "preview", x = () => F(w(), a.quizPreview);
105
149
  return {
106
- var: async (d, y, f) => {
107
- const a = d, { id: s, scope: c } = a;
108
- if (v())
150
+ var: async (o, y, f) => {
151
+ const t = o, { id: s, scope: c } = t, m = t.definition;
152
+ if (A())
109
153
  return _ ? e(_, { type: "var" }, {
110
154
  default: () => f,
111
155
  name: () => s
112
- }) : T(c, s, r);
113
- if (i && o) {
114
- const p = await i({ meta: { node: { id: s, scope: c } } });
115
- if (p)
156
+ }) : R(c, s, n, void 0, m);
157
+ if (i && d) {
158
+ const v = await i({ meta: { node: { id: s, scope: c } } });
159
+ if (v)
116
160
  return e("span", {
117
161
  class: "aimd-field-wrapper aimd-field-wrapper--inline",
118
162
  id: `${c}-${s}`,
119
163
  "data-has-variable": "true"
120
- }, [e(o, p)]);
164
+ }, [e(d, v)]);
121
165
  }
122
- return T(c, s, r);
166
+ return R(c, s, n, void 0, m);
123
167
  },
124
- var_table: async (d, y, f) => {
125
- const a = d, { id: s, scope: c, columns: p } = a;
126
- if (v())
168
+ var_table: async (o, y, f) => {
169
+ const t = o, { id: s, scope: c, columns: m } = t, v = t.definition;
170
+ if (A())
127
171
  return _ ? e(_, { type: "var_table" }, {
128
172
  default: () => f,
129
173
  name: () => s
130
- }) : T(c, s, r, p);
131
- if (i && h) {
132
- const A = await i({ meta: { node: { id: s, scope: c } } });
133
- return e(h, { ...A, props: p });
174
+ }) : R(c, s, n, m, v);
175
+ if (i && g) {
176
+ const T = await i({ meta: { node: { id: s, scope: c } } });
177
+ return e(g, { ...T, props: m });
134
178
  }
135
- return T(c, s, r, p);
179
+ return R(c, s, n, m, v);
136
180
  },
137
- quiz: async (d, y, f) => {
138
- const a = d, { id: s, scope: c, quizType: p, stem: A, score: k } = a, S = j(p, a.mode, r);
139
- if (v()) {
181
+ quiz: async (o, y, f) => {
182
+ const t = o, { id: s, scope: c, quizType: m, stem: v, score: T } = t, q = I(m, t.mode, n);
183
+ if (A()) {
140
184
  if (_)
141
185
  return e(_, { type: "quiz" }, {
142
186
  default: () => f,
143
187
  name: () => s
144
188
  });
145
- const g = [
189
+ const h = [
146
190
  e("div", { class: "aimd-quiz__meta" }, [
147
- e("span", { class: "aimd-field__scope" }, x(c, r)),
191
+ e("span", { class: "aimd-field__scope" }, z(c, n)),
148
192
  e("span", { class: "aimd-field__name" }, s),
149
- e("span", { class: "aimd-field__type" }, `(${S})`),
150
- k !== void 0 ? e("span", { class: "aimd-quiz__score" }, r.quiz.score(k)) : null
193
+ e("span", { class: "aimd-field__type" }, `(${q})`),
194
+ T !== void 0 ? e("span", { class: "aimd-quiz__score" }, n.quiz.score(T)) : null
151
195
  ]),
152
- e("div", { class: "aimd-quiz__stem" }, z(p, A || s))
196
+ e("div", { class: "aimd-quiz__stem" }, E(m, v || s))
153
197
  ];
154
- typeof a.title == "string" && a.title.trim() && g.splice(1, 0, e("div", { class: "aimd-quiz__title" }, a.title)), typeof a.description == "string" && a.description.trim() && g.push(e("div", { class: "aimd-quiz__description" }, a.description)), p === "choice" && Array.isArray(a.options) && a.options.length > 0 && g.push(
155
- e("ul", { class: "aimd-quiz__options" }, a.options.map(
156
- (R) => e("li", `${R.key}. ${R.text}`)
198
+ typeof t.title == "string" && t.title.trim() && h.splice(1, 0, e("div", { class: "aimd-quiz__title" }, t.title)), typeof t.description == "string" && t.description.trim() && h.push(e("div", { class: "aimd-quiz__description" }, t.description)), (m === "choice" || m === "true_false") && Array.isArray(t.options) && t.options.length > 0 && h.push(
199
+ e("ul", { class: "aimd-quiz__options" }, t.options.map(
200
+ (k) => e("li", `${k.key}. ${k.text}`)
157
201
  ))
158
- ), p === "scale" && (g.push(...E(a)), g.push(...L(a)));
159
- const $ = w();
160
- if ($.showAnswers && p === "choice" && a.answer !== void 0) {
161
- const R = Array.isArray(a.answer) ? a.answer.join(", ") : String(a.answer);
162
- R.trim() && g.push(
163
- e("div", { class: "aimd-quiz__answer" }, r.quiz.answer(R))
202
+ ), m === "scale" && (h.push(...P(t)), h.push(...M(t)));
203
+ const S = x();
204
+ if (S.showAnswers && (m === "choice" || m === "true_false") && t.answer !== void 0) {
205
+ const k = Array.isArray(t.answer) ? t.answer.join(", ") : String(t.answer);
206
+ k.trim() && h.push(
207
+ e("div", { class: "aimd-quiz__answer" }, n.quiz.answer(k))
164
208
  );
165
209
  }
166
- return $.showAnswers && p === "blank" && Array.isArray(a.blanks) && a.blanks.length > 0 && g.push(
167
- e("ul", { class: "aimd-quiz__blanks" }, a.blanks.map(
168
- (R) => e("li", `${R.key}: ${R.answer}`)
210
+ return S.showAnswers && m === "blank" && Array.isArray(t.blanks) && t.blanks.length > 0 && h.push(
211
+ e("ul", { class: "aimd-quiz__blanks" }, t.blanks.map(
212
+ (k) => e("li", `${k.key}: ${k.answer}`)
169
213
  ))
170
- ), $.showRubric && p === "open" && typeof a.rubric == "string" && a.rubric.trim() && g.push(
171
- e("div", { class: "aimd-quiz__rubric" }, r.quiz.rubric(a.rubric))
214
+ ), S.showRubric && m === "open" && typeof t.rubric == "string" && t.rubric.trim() && h.push(
215
+ e("div", { class: "aimd-quiz__rubric" }, n.quiz.rubric(t.rubric))
172
216
  ), e("div", {
173
217
  class: "aimd-field aimd-field--quiz",
174
218
  "data-aimd-type": "quiz",
175
219
  "data-aimd-id": s
176
- }, g);
220
+ }, h);
177
221
  }
178
- if (i && o) {
179
- const g = await i({ meta: { node: { id: s, scope: c } } });
180
- if (g)
222
+ if (i && d) {
223
+ const h = await i({ meta: { node: { id: s, scope: c } } });
224
+ if (h)
181
225
  return e("span", {
182
226
  class: "aimd-field-wrapper aimd-field-wrapper--inline",
183
227
  id: `${c}-${s}`,
184
228
  "data-has-variable": "true"
185
- }, [e(o, g)]);
229
+ }, [e(d, h)]);
186
230
  }
187
231
  return e("div", {
188
232
  class: "aimd-field aimd-field--quiz",
@@ -190,63 +234,63 @@ function O(t) {
190
234
  "data-aimd-id": s
191
235
  }, [
192
236
  e("div", { class: "aimd-quiz__meta" }, [
193
- e("span", { class: "aimd-field__scope" }, x(c, r)),
237
+ e("span", { class: "aimd-field__scope" }, z(c, n)),
194
238
  e("span", { class: "aimd-field__name" }, s),
195
- e("span", { class: "aimd-field__type" }, `(${S})`)
239
+ e("span", { class: "aimd-field__type" }, `(${q})`)
196
240
  ]),
197
- ...typeof a.title == "string" && a.title.trim() ? [e("div", { class: "aimd-quiz__title" }, a.title)] : [],
198
- e("div", { class: "aimd-quiz__stem" }, z(p, A || s)),
199
- ...typeof a.description == "string" && a.description.trim() ? [e("div", { class: "aimd-quiz__description" }, a.description)] : [],
200
- ...p === "scale" ? [...E(a), ...L(a)] : []
241
+ ...typeof t.title == "string" && t.title.trim() ? [e("div", { class: "aimd-quiz__title" }, t.title)] : [],
242
+ e("div", { class: "aimd-quiz__stem" }, E(m, v || s)),
243
+ ...typeof t.description == "string" && t.description.trim() ? [e("div", { class: "aimd-quiz__description" }, t.description)] : [],
244
+ ...m === "scale" ? [...P(t), ...M(t)] : []
201
245
  ]);
202
246
  },
203
- step: async (d, y, f) => {
204
- const a = d, { id: s, scope: c, step: p, check: A } = a;
205
- if (v())
247
+ step: async (o, y, f) => {
248
+ const t = o, { id: s, scope: c, step: m, check: v } = t;
249
+ if (A())
206
250
  return _ ? e(_, { type: "step" }, {
207
251
  default: () => f,
208
252
  name: () => s
209
- }) : e("span", { class: "research-step__sequence" }, r.step.sequence(p));
253
+ }) : e("span", { class: "research-step__sequence" }, n.step.sequence(m));
210
254
  if (i && u) {
211
- const k = await i({ meta: { node: { id: s, scope: c } } }), S = await i({ meta: { node: { id: s, scope: c, type: "step-annotation" } } });
255
+ const T = await i({ meta: { node: { id: s, scope: c } } }), q = await i({ meta: { node: { id: s, scope: c, type: "step-annotation" } } });
212
256
  return e(u, {
213
- item: k,
214
- annotationItem: S,
257
+ item: T,
258
+ annotationItem: q,
215
259
  name: s,
216
- step: String(p),
217
- check: A
260
+ step: String(m),
261
+ check: v
218
262
  }, {
219
263
  default: () => f
220
264
  });
221
265
  }
222
- return e("span", { class: "research-step__sequence" }, r.step.sequence(p));
266
+ return e("span", { class: "research-step__sequence" }, n.step.sequence(m));
223
267
  },
224
- check: async (d, y, f) => {
225
- const a = d, { id: s, scope: c, label: p } = a;
226
- if (v())
268
+ check: async (o, y, f) => {
269
+ const t = o, { id: s, scope: c, label: m } = t;
270
+ if (A())
227
271
  return _ ? e(_, { type: "check" }, {
228
272
  default: () => f,
229
273
  name: () => s
230
- }) : T(c, s, r);
231
- if (i && q) {
232
- const A = await i({ meta: { node: { id: s, scope: c } } }), k = await i({ meta: { node: { id: s, scope: c, type: "check-annotation" } } });
233
- return e(q, {
234
- item: A,
235
- annotationItem: k,
274
+ }) : R(c, s, n);
275
+ if (i && b) {
276
+ const v = await i({ meta: { node: { id: s, scope: c } } }), T = await i({ meta: { node: { id: s, scope: c, type: "check-annotation" } } });
277
+ return e(b, {
278
+ item: v,
279
+ annotationItem: T,
236
280
  name: s
237
281
  }, {
238
282
  default: () => f
239
283
  });
240
284
  }
241
- return T(c, s, r);
285
+ return R(c, s, n);
242
286
  },
243
- ref_step: (d, y) => {
244
- const { id: f } = d, a = "refTarget" in d ? d.refTarget : f, s = "stepSequence" in d && typeof d.stepSequence == "string" ? d.stepSequence : void 0, c = s ? r.step.reference(s) : a;
245
- return m ? e(m, { name: a, type: "step", stepSequence: s }) : e("a", {
287
+ ref_step: (o, y) => {
288
+ const { id: f } = o, t = "refTarget" in o ? o.refTarget : f, s = "stepSequence" in o && typeof o.stepSequence == "string" ? o.stepSequence : void 0, c = s ? n.step.reference(s) : t;
289
+ return p ? e(p, { name: t, type: "step", stepSequence: s }) : e("a", {
246
290
  class: "aimd-ref aimd-ref--step",
247
- href: `#step-${a}`,
291
+ href: `#step-${t}`,
248
292
  "data-aimd-step-sequence": s,
249
- title: a
293
+ title: t
250
294
  }, [
251
295
  e("span", { class: "aimd-ref__content" }, [
252
296
  e("span", { class: "aimd-field aimd-field--step aimd-field--readonly" }, [
@@ -255,51 +299,51 @@ function O(t) {
255
299
  ])
256
300
  ]);
257
301
  },
258
- ref_var: (d, y) => {
259
- const { id: f } = d, a = "refTarget" in d ? d.refTarget : f, s = y.mode === "edit" ? F(y.value, a) : null;
260
- return m ? e(m, {
261
- name: a,
302
+ ref_var: (o, y) => {
303
+ const { id: f } = o, t = "refTarget" in o ? o.refTarget : f, s = y.mode === "edit" ? Y(y.value, t) : null;
304
+ return p ? e(p, {
305
+ name: t,
262
306
  type: "var",
263
307
  contextValue: y.value,
264
308
  displayValue: s ?? void 0
265
309
  }) : y.mode !== "edit" ? e("a", {
266
310
  class: "aimd-ref aimd-ref--var",
267
- href: `#var-${a}`,
268
- title: a
311
+ href: `#var-${t}`,
312
+ title: t
269
313
  }, [
270
314
  e("span", { class: "aimd-ref__icon" }, "📌"),
271
- e("span", { class: "aimd-ref__name" }, a)
315
+ e("span", { class: "aimd-ref__name" }, t)
272
316
  ]) : e("span", {
273
317
  class: "aimd-ref aimd-ref--var",
274
- "data-aimd-ref": a,
275
- title: a
318
+ "data-aimd-ref": t,
319
+ title: t
276
320
  }, [
277
321
  e("span", { class: "aimd-ref__content" }, [
278
322
  s !== null ? e("span", {
279
323
  class: "aimd-field aimd-field--var aimd-field--readonly",
280
- "data-aimd-id": a,
324
+ "data-aimd-id": t,
281
325
  "data-aimd-scope": "var"
282
326
  }, [
283
327
  e("span", { class: "aimd-field__value" }, s)
284
328
  ]) : e("span", { class: "aimd-field aimd-field--var" }, [
285
- e("span", { class: "aimd-field__scope" }, r.scope.var),
286
- e("span", { class: "aimd-field__name" }, a)
329
+ e("span", { class: "aimd-field__scope" }, n.scope.var),
330
+ e("span", { class: "aimd-field__name" }, t)
287
331
  ])
288
332
  ])
289
333
  ]);
290
334
  }
291
335
  };
292
336
  }
293
- function M(t) {
294
- return typeof t == "object" && t !== null && !Array.isArray(t);
337
+ function C(a) {
338
+ return typeof a == "object" && a !== null && !Array.isArray(a);
295
339
  }
296
- function F(t, i) {
297
- const n = t?.var?.[i], l = M(n) && "value" in n ? n.value : n;
340
+ function Y(a, i) {
341
+ const r = a?.var?.[i], l = C(r) && "value" in r ? r.value : r;
298
342
  if (l == null || l === "")
299
343
  return null;
300
344
  if (Array.isArray(l))
301
- return l.map((r) => String(r)).join(", ");
302
- if (M(l))
345
+ return l.map((n) => String(n)).join(", ");
346
+ if (C(l))
303
347
  try {
304
348
  return JSON.stringify(l);
305
349
  } catch {
@@ -307,40 +351,40 @@ function F(t, i) {
307
351
  }
308
352
  return String(l);
309
353
  }
310
- function N(t) {
311
- const { getStaticResearchAssets: i, highlighter: n, components: l = {} } = t, { AssetRenderer: r, EmbeddedRenderer: o, MermaidBlock: h } = l, m = {};
312
- return (r || i) && (m.img = (u, q, _) => {
313
- const { src: b, alt: v } = u.properties || {};
314
- return r ? e(r, {
315
- src: b,
316
- alt: v,
354
+ function Z(a) {
355
+ const { getStaticResearchAssets: i, highlighter: r, components: l = {} } = a, { AssetRenderer: n, EmbeddedRenderer: d, MermaidBlock: g } = l, p = {};
356
+ return (n || i) && (p.img = (u, b, _) => {
357
+ const { src: w, alt: A } = u.properties || {};
358
+ return n ? e(n, {
359
+ src: w,
360
+ alt: A,
317
361
  getStaticResearchAssets: i
318
- }) : e("img", { src: b, alt: v, class: "aimd-image", loading: "lazy" });
319
- }), m.pre = (u, q, _) => {
320
- const b = u.children.find(
362
+ }) : e("img", { src: w, alt: A, class: "aimd-image", loading: "lazy" });
363
+ }), p.pre = (u, b, _) => {
364
+ const w = u.children.find(
321
365
  (s) => s.type === "element" && s.tagName === "code"
322
366
  );
323
- if (!b)
324
- return e("pre", {}, q);
325
- const v = b.properties?.className;
326
- let w = "text";
327
- if (Array.isArray(v)) {
328
- const s = v.find((c) => typeof c == "string" && c.startsWith("language-"));
329
- s && typeof s == "string" && (w = s.replace("language-", ""));
367
+ if (!w)
368
+ return e("pre", {}, b);
369
+ const A = w.properties?.className;
370
+ let x = "text";
371
+ if (Array.isArray(A)) {
372
+ const s = A.find((c) => typeof c == "string" && c.startsWith("language-"));
373
+ s && typeof s == "string" && (x = s.replace("language-", ""));
330
374
  }
331
- const d = b.children.map((s) => s.type === "text" ? s.value : "").join(""), y = d.split(/\n/)[0].trim();
332
- if ((w === "mermaid" || y === "gantt" || y === "sequenceDiagram" || /^graph (?:TB|BT|RL|LR|TD);?$/.test(y)) && h)
333
- return e(h, { code: d });
334
- const a = typeof n == "function" ? n() : n;
335
- if (a)
375
+ const o = w.children.map((s) => s.type === "text" ? s.value : "").join(""), y = o.split(/\n/)[0].trim();
376
+ if ((x === "mermaid" || y === "gantt" || y === "sequenceDiagram" || /^graph (?:TB|BT|RL|LR|TD);?$/.test(y)) && g)
377
+ return e(g, { code: o });
378
+ const t = typeof r == "function" ? r() : r;
379
+ if (t)
336
380
  try {
337
- const s = a.codeToHtml(d, {
338
- lang: w,
381
+ const s = t.codeToHtml(o, {
382
+ lang: x,
339
383
  theme: "github-dark"
340
384
  });
341
385
  return e("div", {
342
386
  class: "shiki-code-block",
343
- "data-lang": w,
387
+ "data-lang": x,
344
388
  innerHTML: s
345
389
  });
346
390
  } catch (s) {
@@ -348,92 +392,93 @@ function N(t) {
348
392
  }
349
393
  return e(
350
394
  "pre",
351
- { class: `language-${w}` },
352
- e("code", { class: `language-${w}` }, d)
395
+ { class: `language-${x}` },
396
+ e("code", { class: `language-${x}` }, o)
353
397
  );
354
- }, o && (m.iframe = (u, q, _) => e(o, {
398
+ }, d && (p.iframe = (u, b, _) => e(d, {
355
399
  contentProps: { ...u.properties, credentialless: !0 },
356
400
  component: "iframe"
357
- }), m.video = (u, q, _) => e(o, {
401
+ }), p.video = (u, b, _) => e(d, {
358
402
  contentProps: u.properties,
359
403
  component: "video"
360
- })), m;
404
+ })), p;
361
405
  }
362
- function Z(t) {
363
- const i = () => typeof t.mode == "function" ? t.mode() : t.mode, n = () => D(i(), t.quizPreview), l = V(t.locale), r = C(l, t.messages), o = O(t), h = N(t), m = {
406
+ function le(a) {
407
+ const i = () => typeof a.mode == "function" ? a.mode() : a.mode, r = () => F(i(), a.quizPreview), l = V(a.locale), n = D(l, a.messages), d = X(a), g = Z(a), p = {
364
408
  locale: l,
365
- messages: r,
409
+ messages: n,
366
410
  context: {
367
411
  mode: i() === "timeline" ? "preview" : i(),
368
412
  readonly: i() === "preview",
369
- quizPreview: n(),
413
+ quizPreview: r(),
370
414
  locale: l,
371
- messages: r
415
+ messages: n
372
416
  },
373
- aimdRenderers: o,
374
- elementRenderers: h
417
+ aimdRenderers: d,
418
+ elementRenderers: g
375
419
  };
376
420
  return {
377
421
  async render(u) {
378
- return K(u, {
422
+ return H(u, {
379
423
  gfm: !0,
380
424
  math: !0,
381
425
  breaks: !0,
382
- assignerVisibility: t.assignerVisibility,
383
- ...m
426
+ assignerVisibility: a.assignerVisibility,
427
+ ...p
384
428
  });
385
429
  },
386
430
  extractFields(u) {
387
- return I(u);
431
+ return B(u);
388
432
  },
389
- vueOptions: m
433
+ vueOptions: p
390
434
  };
391
435
  }
392
- function ee(t) {
393
- const { parent: i, sequence: n, level: l } = t;
394
- let r = String(n + 1);
436
+ function de(a) {
437
+ const { parent: i, sequence: r, level: l } = a;
438
+ let n = String(r + 1);
395
439
  if (l === 1)
396
- return r;
397
- let o = i;
398
- for (; o; )
399
- r = `${o.sequence + 1}.${r}`, o = o.parent;
400
- return r;
440
+ return n;
441
+ let d = i;
442
+ for (; d; )
443
+ n = `${d.sequence + 1}.${n}`, d = d.parent;
444
+ return n;
401
445
  }
402
- function te(t) {
403
- if (t.startsWith("var_table")) {
404
- const [o, h, m, ...u] = t.split(/(\\)?\|/g);
405
- return [{ type: o, name: `${m}|${u.filter(Boolean).join(",")}` }];
446
+ function ce(a) {
447
+ if (a.startsWith("var_table")) {
448
+ const [d, g, p, ...u] = a.split(/(\\)?\|/g);
449
+ return [{ type: d, name: `${p}|${u.filter(Boolean).join(",")}` }];
406
450
  }
407
- const [n, l, r] = t.split(/(\\)?\|/);
408
- return [{ type: n, name: r }];
451
+ const [r, l, n] = a.split(/(\\)?\|/);
452
+ return [{ type: r, name: n }];
409
453
  }
410
454
  export {
411
- ie as DEFAULT_AIMD_RENDERER_LOCALE,
412
- Y as bubbleMenuEventKey,
413
- C as createAimdRendererMessages,
414
- re as createAssetRenderer,
415
- ne as createCodeBlockRenderer,
416
- le as createComponentRenderer,
417
- ce as createCustomElementAimdRenderer,
418
- de as createEmbeddedRenderer,
419
- oe as createHtmlProcessor,
420
- me as createMermaidRenderer,
421
- pe as createRenderer,
422
- ue as createStepCardRenderer,
423
- Z as createUnifiedTokenRenderer,
424
- fe as defaultRenderer,
425
- G as draftEventKey,
426
- W as fieldEventKey,
427
- j as getAimdRendererQuizTypeLabel,
428
- ee as getFinalIndent,
429
- _e as hastToVue,
430
- I as parseAndExtract,
431
- te as parseFieldTag,
432
- J as protocolKey,
433
- ye as renderToHtml,
434
- ge as renderToHtmlSync,
435
- he as renderToVNodes,
436
- K as renderToVue,
437
- X as reportEventKey,
455
+ pe as DEFAULT_AIMD_RENDERER_LOCALE,
456
+ ne as bubbleMenuEventKey,
457
+ D as createAimdRendererMessages,
458
+ ue as createAssetRenderer,
459
+ fe as createCodeBlockRenderer,
460
+ _e as createComponentRenderer,
461
+ ye as createCustomElementAimdRenderer,
462
+ ge as createEmbeddedRenderer,
463
+ ve as createHtmlProcessor,
464
+ he as createMermaidRenderer,
465
+ be as createRenderer,
466
+ Ae as createStepCardRenderer,
467
+ le as createUnifiedTokenRenderer,
468
+ we as defaultRenderer,
469
+ se as draftEventKey,
470
+ te as fieldEventKey,
471
+ I as getAimdRendererQuizTypeLabel,
472
+ de as getFinalIndent,
473
+ xe as hastToVue,
474
+ Te as loadShikiHighlighter,
475
+ B as parseAndExtract,
476
+ ce as parseFieldTag,
477
+ ie as protocolKey,
478
+ ke as renderToHtml,
479
+ Re as renderToHtmlSync,
480
+ qe as renderToVNodes,
481
+ H as renderToVue,
482
+ re as reportEventKey,
438
483
  V as resolveAimdRendererLocale
439
484
  };