@airalogy/aimd-recorder 1.18.0 → 1.19.1

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 (81) hide show
  1. package/README.md +44 -0
  2. package/README.zh-CN.md +44 -0
  3. package/dist/{AimdDnaSequenceField-KZU2Zj3E.js → AimdDnaSequenceField-TBKunqU_.js} +1 -1
  4. package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-CzfYPp5r.js → AimdEditor.vue_vue_type_style_index_0_lang-tdh0dJNa.js} +1 -1
  5. package/dist/{AimdMarkdownField-t2d8uOeU.js → AimdMarkdownField-DmNX2g4j.js} +19 -19
  6. package/dist/{AimdMarkdownNoteField-_h1oZSwH.js → AimdMarkdownNoteField-B5ruzmwS.js} +19 -19
  7. package/dist/aimd-recorder.css +1 -1
  8. package/dist/{arc-DS_ocYoe.js → arc-B-vsgEXF.js} +1 -1
  9. package/dist/{architectureDiagram-3BPJPVTR-Dq2W8_tb.js → architectureDiagram-3BPJPVTR-BwPNOtNH.js} +2 -2
  10. package/dist/{blockDiagram-GPEHLZMM-B4hnSAF_.js → blockDiagram-GPEHLZMM-CMUI4kKc.js} +4 -4
  11. package/dist/{c4Diagram-AAUBKEIU-CbffqNLY.js → c4Diagram-AAUBKEIU-Cpmfsy_s.js} +2 -2
  12. package/dist/{channel-CtXnYrAk.js → channel-DlMAXHQK.js} +1 -1
  13. package/dist/{chunk-2J33WTMH-CROScrt5.js → chunk-2J33WTMH-DP9BS2ux.js} +1 -1
  14. package/dist/{chunk-4BX2VUAB-DTmsQu5_.js → chunk-4BX2VUAB-ncsOeLMb.js} +1 -1
  15. package/dist/{chunk-55IACEB6-B5wDJzeX.js → chunk-55IACEB6-C7wHk4B7.js} +1 -1
  16. package/dist/{chunk-727SXJPM-CfyltY6o.js → chunk-727SXJPM-Caa5aVUO.js} +5 -5
  17. package/dist/{chunk-AQP2D5EJ-B8274EYy.js → chunk-AQP2D5EJ-CL8egKqD.js} +3 -3
  18. package/dist/{chunk-FMBD7UC4-CT_FK-SH.js → chunk-FMBD7UC4-heVR6BSA.js} +1 -1
  19. package/dist/{chunk-ND2GUHAM-g9GulPi-.js → chunk-ND2GUHAM-BYH-wC2J.js} +1 -1
  20. package/dist/{chunk-QZHKN3VN-Di5HEktz.js → chunk-QZHKN3VN-Bx2K7vkq.js} +1 -1
  21. package/dist/{classDiagram-v2-Q7XG4LA2-BVUr246k.js → classDiagram-4FO5ZUOK-BLLfLYy0.js} +2 -2
  22. package/dist/{classDiagram-4FO5ZUOK-BVUr246k.js → classDiagram-v2-Q7XG4LA2-BLLfLYy0.js} +2 -2
  23. package/dist/components.js +2821 -2320
  24. package/dist/composables.js +95 -93
  25. package/dist/{cose-bilkent-S5V4N54A-GJ4IOO6v.js → cose-bilkent-S5V4N54A-E1YmM_xr.js} +1 -1
  26. package/dist/{dagre-BM42HDAG-oL7Br44o.js → dagre-BM42HDAG-BsXpQirH.js} +3 -3
  27. package/dist/{diagram-2AECGRRQ-DtoCG_N4.js → diagram-2AECGRRQ-CamqbWlY.js} +2 -2
  28. package/dist/{diagram-5GNKFQAL-f8QNdS7L.js → diagram-5GNKFQAL-DZyRFcOC.js} +3 -3
  29. package/dist/{diagram-KO2AKTUF-CsJOW_AX.js → diagram-KO2AKTUF-CmkGcy7R.js} +2 -2
  30. package/dist/{diagram-LMA3HP47-xmEKNZ7y.js → diagram-LMA3HP47-IdDwQPZ-.js} +2 -2
  31. package/dist/{diagram-OG6HWLK6-unpC7vo8.js → diagram-OG6HWLK6-t0LBcUIU.js} +3 -3
  32. package/dist/{erDiagram-TEJ5UH35-BGzFnCJD.js → erDiagram-TEJ5UH35-DJBY2iZG.js} +4 -4
  33. package/dist/{flowDiagram-I6XJVG4X-LBFhDnOs.js → flowDiagram-I6XJVG4X-DE4MzPPk.js} +6 -6
  34. package/dist/{ganttDiagram-6RSMTGT7-CFBc-jPD.js → ganttDiagram-6RSMTGT7-CmAc35Yw.js} +2 -2
  35. package/dist/{gitGraphDiagram-PVQCEYII-BLduh-Rb.js → gitGraphDiagram-PVQCEYII-DDQZ5flw.js} +3 -3
  36. package/dist/{graph-DdlKE625.js → graph-BsJ8-1Pq.js} +1 -1
  37. package/dist/index.js +112 -109
  38. package/dist/{infoDiagram-5YYISTIA-CLQQI6zM.js → infoDiagram-5YYISTIA-DSZjFR5g.js} +1 -1
  39. package/dist/{ishikawaDiagram-YF4QCWOH-CStdYBmW.js → ishikawaDiagram-YF4QCWOH-DCO9dx2L.js} +1 -1
  40. package/dist/{journeyDiagram-JHISSGLW-B6mRTzoE.js → journeyDiagram-JHISSGLW-b-PpuBqg.js} +4 -4
  41. package/dist/{kanban-definition-UN3LZRKU-C-vnN5v4.js → kanban-definition-UN3LZRKU-BjclDuJZ.js} +2 -2
  42. package/dist/{layout-DDt0fz-M.js → layout-D4wqKu72.js} +2 -2
  43. package/dist/{linear-C-IAFdOt.js → linear-Voc3BJib.js} +1 -1
  44. package/dist/{mermaid.core-CuZ3nINf.js → mermaid.core-Dt_VbeGP.js} +34 -34
  45. package/dist/{mindmap-definition-RKZ34NQL-TSZ1Vb3z.js → mindmap-definition-RKZ34NQL-B3vrXRVY.js} +3 -3
  46. package/dist/{pieDiagram-4H26LBE5-DYok-1-k.js → pieDiagram-4H26LBE5-DFpWxSxk.js} +3 -3
  47. package/dist/{quadrantDiagram-W4KKPZXB-Cg856sbH.js → quadrantDiagram-W4KKPZXB-BYHcrGoB.js} +2 -2
  48. package/dist/record.js +1199 -0
  49. package/dist/{requirementDiagram-4Y6WPE33-BN9fGdlJ.js → requirementDiagram-4Y6WPE33-C-FgWrRz.js} +3 -3
  50. package/dist/{sankeyDiagram-5OEKKPKP-CDqTgonY.js → sankeyDiagram-5OEKKPKP-IwN0Evji.js} +1 -1
  51. package/dist/{sequenceDiagram-3UESZ5HK-Chjrc0-W.js → sequenceDiagram-3UESZ5HK-_OnqhBO2.js} +3 -3
  52. package/dist/{stateDiagram-AJRCARHV-DRyLHrdr.js → stateDiagram-AJRCARHV-BRLv0Zcw.js} +4 -4
  53. package/dist/{stateDiagram-v2-BHNVJYJU-CZTIDHid.js → stateDiagram-v2-BHNVJYJU-BofX0AdS.js} +2 -2
  54. package/dist/{timeline-definition-PNZ67QCA-Bc3D9AAG.js → timeline-definition-PNZ67QCA-C-DpPLpw.js} +2 -2
  55. package/dist/{useCodeBlockRendering-qA6gj4vz.js → useCodeBlockRendering-DoTZaJTW.js} +2170 -3148
  56. package/dist/{vennDiagram-CIIHVFJN-CYAul48m.js → vennDiagram-CIIHVFJN-zTHQR9Oq.js} +1 -1
  57. package/dist/{wardleyDiagram-YWT4CUSO-B7Tg0MG9.js → wardleyDiagram-YWT4CUSO-au5koizO.js} +2 -2
  58. package/dist/{xychartDiagram-2RQKCTM6-xWYVEqth.js → xychartDiagram-2RQKCTM6-BNf12P8z.js} +2 -2
  59. package/package.json +7 -3
  60. package/src/__tests__/assigner-graph.test.ts +82 -0
  61. package/src/__tests__/recorder-assigner-control.test.ts +150 -1
  62. package/src/__tests__/recorder-editor.test.ts +34 -1
  63. package/src/__tests__/recorder-wysiwyg-field-host.test.ts +3 -0
  64. package/src/__tests__/var-field-render.test.ts +87 -0
  65. package/src/components/AimdAssignerGraph.vue +816 -0
  66. package/src/components/AimdMarkdownField.vue +8 -0
  67. package/src/components/AimdRecorder.vue +137 -42
  68. package/src/components/AimdRecorderEditor.vue +116 -10
  69. package/src/components/AimdRecorderWysiwygFieldHost.vue +4 -0
  70. package/src/components/AimdRecorderWysiwygSurface.vue +19 -1
  71. package/src/components/AimdVarTableField.vue +42 -28
  72. package/src/components/index.ts +9 -1
  73. package/src/components/recorderMilkdownPlugin.ts +7 -1
  74. package/src/composables/__tests__/useVarHelpers.test.ts +42 -0
  75. package/src/composables/index.ts +1 -0
  76. package/src/composables/useVarHelpers.ts +87 -250
  77. package/src/index.ts +7 -1
  78. package/src/record/index.ts +120 -0
  79. package/src/styles/aimd.css +230 -3
  80. package/src/type-utils.ts +1 -3
  81. package/src/types.ts +37 -0
package/dist/record.js ADDED
@@ -0,0 +1,1199 @@
1
+ const ht = ["var", "var_table", "step", "check", "quiz"], z = {
2
+ file: "FILE",
3
+ image: "IMG",
4
+ audio: "AUD",
5
+ video: "VID",
6
+ csv: "CSV",
7
+ text: "TXT",
8
+ document: "DOC"
9
+ }, st = {
10
+ csv: "csv",
11
+ png: "image",
12
+ jpg: "image",
13
+ jpeg: "image",
14
+ svg: "image",
15
+ webp: "image",
16
+ tif: "image",
17
+ tiff: "image",
18
+ mp3: "audio",
19
+ wav: "audio",
20
+ m4a: "audio",
21
+ mp4: "video",
22
+ mov: "video",
23
+ webm: "video",
24
+ aimd: "text",
25
+ md: "text",
26
+ txt: "text",
27
+ json: "text",
28
+ pdf: "document",
29
+ docx: "document",
30
+ xlsx: "document",
31
+ pptx: "document"
32
+ }, at = {
33
+ csv: "text/csv",
34
+ png: "image/png",
35
+ jpg: "image/jpeg",
36
+ jpeg: "image/jpeg",
37
+ svg: "image/svg+xml",
38
+ webp: "image/webp",
39
+ tif: "image/tiff",
40
+ tiff: "image/tiff",
41
+ mp3: "audio/mpeg",
42
+ wav: "audio/wav",
43
+ m4a: "audio/mp4",
44
+ mp4: "video/mp4",
45
+ mov: "video/quicktime",
46
+ webm: "video/webm",
47
+ md: "text/markdown",
48
+ txt: "text/plain",
49
+ aimd: "text/plain",
50
+ json: "application/json",
51
+ pdf: "application/pdf",
52
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
53
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
54
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
55
+ }, ct = {
56
+ file: { kind: "file", badge: "FILE" },
57
+ upload: { kind: "file", badge: "FILE" },
58
+ csv: { kind: "csv", accept: ".csv,text/csv", badge: "CSV" },
59
+ fileidcsv: { kind: "csv", accept: ".csv,text/csv", badge: "CSV" },
60
+ image: { kind: "image", accept: "image/*", badge: "IMG" },
61
+ fileidpng: { kind: "image", accept: ".png,image/png", badge: "IMG" },
62
+ fileidjpg: { kind: "image", accept: ".jpg,.jpeg,image/jpeg", badge: "IMG" },
63
+ fileidjpeg: { kind: "image", accept: ".jpg,.jpeg,image/jpeg", badge: "IMG" },
64
+ fileidsvg: { kind: "image", accept: ".svg,image/svg+xml", badge: "IMG" },
65
+ fileidwebp: { kind: "image", accept: ".webp,image/webp", badge: "IMG" },
66
+ fileidtiff: { kind: "image", accept: ".tif,.tiff,image/tiff", badge: "IMG" },
67
+ audio: { kind: "audio", accept: "audio/*", badge: "AUD" },
68
+ fileidmp3: { kind: "audio", accept: ".mp3,audio/mpeg", badge: "AUD" },
69
+ video: { kind: "video", accept: "video/*", badge: "VID" },
70
+ fileidmp4: { kind: "video", accept: ".mp4,video/mp4", badge: "VID" },
71
+ fileidaimd: { kind: "text", accept: ".aimd,text/plain", badge: "AIMD" },
72
+ fileidmd: { kind: "text", accept: ".md,text/markdown,text/plain", badge: "MD" },
73
+ fileidtxt: { kind: "text", accept: ".txt,text/plain", badge: "TXT" },
74
+ fileidjson: { kind: "text", accept: ".json,application/json", badge: "JSON" },
75
+ fileiddocx: { kind: "document", accept: ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", badge: "DOC" },
76
+ fileidxlsx: { kind: "document", accept: ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", badge: "XLS" },
77
+ fileidpptx: { kind: "document", accept: ".pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation", badge: "PPT" },
78
+ fileidpdf: { kind: "document", accept: ".pdf,application/pdf", badge: "PDF" }
79
+ }, yt = /^airalogy\.id\.file\.[^\s]+$/i, _t = ["id", "file_id", "fileId", "src"], bt = ["id", "file_id", "fileId", "blob_id", "blobId", "src", "url", "href"];
80
+ function x(t) {
81
+ return typeof t == "object" && t !== null && !Array.isArray(t);
82
+ }
83
+ function U(t, e = "str") {
84
+ return typeof t != "string" ? e : t.trim().toLowerCase().replace(/[^a-z0-9]/g, "") || e;
85
+ }
86
+ function h(t) {
87
+ return U(t, "");
88
+ }
89
+ function v(t) {
90
+ return typeof t == "string" && t.trim() ? t.trim() : void 0;
91
+ }
92
+ function K(t, e) {
93
+ if (t)
94
+ for (const n of e) {
95
+ const i = v(t[n]);
96
+ if (i)
97
+ return i;
98
+ }
99
+ }
100
+ function At(t) {
101
+ return x(t) && x(t.data) ? t.data : t;
102
+ }
103
+ function Q(t) {
104
+ return x(t) && "value" in t ? t.value : t;
105
+ }
106
+ function te(t) {
107
+ const e = At(t), n = {};
108
+ if (!x(e))
109
+ return n;
110
+ for (const i of ht) {
111
+ const r = e[i];
112
+ n[i] = x(r) ? { ...r } : {};
113
+ }
114
+ return n;
115
+ }
116
+ function ft(t) {
117
+ return Q(t);
118
+ }
119
+ function xt(t) {
120
+ const e = ft(t);
121
+ if (e == null)
122
+ return "";
123
+ if (typeof e == "string")
124
+ return e;
125
+ if (typeof e == "number" || typeof e == "boolean")
126
+ return String(e);
127
+ if (Array.isArray(e))
128
+ return e.map((n) => xt(n)).filter(Boolean).join(", ");
129
+ try {
130
+ return JSON.stringify(e, null, 2);
131
+ } catch {
132
+ return String(e);
133
+ }
134
+ }
135
+ function ee(t) {
136
+ const e = ft(t);
137
+ if (typeof e == "boolean") return e;
138
+ if (typeof e == "number") return e !== 0;
139
+ if (typeof e == "string") {
140
+ const n = e.trim().toLowerCase();
141
+ if (n === "" || n === "false" || n === "0" || n === "no" || n === "off")
142
+ return !1;
143
+ if (n === "true" || n === "1" || n === "yes" || n === "on")
144
+ return !0;
145
+ }
146
+ return !!e;
147
+ }
148
+ function A(t) {
149
+ if (typeof t != "string")
150
+ return;
151
+ const e = t.trim().toLowerCase();
152
+ if (!(!e || e === "*"))
153
+ return e.replace(/^\./, "");
154
+ }
155
+ function J(t, e) {
156
+ const n = A(e?.fileExtension);
157
+ return n || (A(t?.file_extension) ?? A(t?.fileExtension) ?? A(t?.extension));
158
+ }
159
+ function X(t) {
160
+ const e = v(t);
161
+ if (!e)
162
+ return;
163
+ const i = (e.split(/[?#]/, 1)[0] ?? e).match(/\.([A-Za-z0-9]+)$/);
164
+ return A(i?.[1]);
165
+ }
166
+ function H(t) {
167
+ const e = t.replace(/^\./, "").toLowerCase(), n = at[e];
168
+ return n ? `.${e},${n}` : `.${e}`;
169
+ }
170
+ function j(t) {
171
+ const e = A(t);
172
+ return e ? st[e] : void 0;
173
+ }
174
+ function ut(t) {
175
+ const e = h(t);
176
+ if (!e.startsWith("fileid") || e.length <= 6)
177
+ return;
178
+ const n = A(e.slice(6));
179
+ if (n)
180
+ return st[n] || at[n] ? n : void 0;
181
+ }
182
+ function Et(t) {
183
+ if (!t)
184
+ return;
185
+ const e = t.toLowerCase();
186
+ if (e.startsWith("image/")) return "image";
187
+ if (e.startsWith("audio/")) return "audio";
188
+ if (e.startsWith("video/")) return "video";
189
+ if (e.includes("csv")) return "csv";
190
+ if (e.startsWith("text/") || e.includes("json") || e.includes("markdown")) return "text";
191
+ if (e.includes("pdf") || e.includes("word") || e.includes("spreadsheet") || e.includes("presentation")) return "document";
192
+ }
193
+ function St(t, e, n) {
194
+ const i = h(n?.inputType ?? e?.input_type ?? e?.inputType), r = h(t), o = i || r;
195
+ if (!o)
196
+ return;
197
+ if (o === "image" || o.startsWith("fileidpng") || o.startsWith("fileidjpg") || o.startsWith("fileidjpeg") || o.startsWith("fileidsvg") || o.startsWith("fileidwebp") || o.startsWith("fileidtiff"))
198
+ return "image";
199
+ if (o === "audio" || o.startsWith("fileidmp3"))
200
+ return "audio";
201
+ if (o === "video" || o.startsWith("fileidmp4"))
202
+ return "video";
203
+ if (o === "csv" || o.startsWith("fileidcsv"))
204
+ return "csv";
205
+ if (o.startsWith("fileidmd") || o.startsWith("fileidtxt") || o.startsWith("fileidjson") || o.startsWith("fileidaimd"))
206
+ return "text";
207
+ if (o.startsWith("fileidpdf") || o.startsWith("fileiddocx") || o.startsWith("fileidxlsx") || o.startsWith("fileidpptx"))
208
+ return "document";
209
+ const a = ut(o), s = j(a);
210
+ return s || (o === "file" || o === "upload" || o.startsWith("fileid") ? "file" : j(J(e, n)));
211
+ }
212
+ function V(t) {
213
+ return t ? !!ct[t] || t.startsWith("fileid") : !1;
214
+ }
215
+ function ne(t, e, n) {
216
+ const i = h(n?.inputType), r = V(i) ? i : U(t), o = J(e, n), a = v(n?.accept) ?? K(e, ["accept", "file_accept", "fileAccept"]), s = ct[r], f = ut(r);
217
+ if (o) {
218
+ const c = j(o) ?? "file";
219
+ return {
220
+ kind: c,
221
+ accept: a ?? H(o),
222
+ badge: s?.badge ?? z[c]
223
+ };
224
+ }
225
+ if (s)
226
+ return {
227
+ ...s,
228
+ accept: a ?? s.accept
229
+ };
230
+ if (f) {
231
+ const c = j(f) ?? "file";
232
+ return {
233
+ kind: c,
234
+ accept: a ?? H(f),
235
+ badge: z[c]
236
+ };
237
+ }
238
+ return {
239
+ kind: "file",
240
+ accept: a,
241
+ badge: z.file
242
+ };
243
+ }
244
+ function ie(t, e, n) {
245
+ const i = U(t), r = h(n?.inputType);
246
+ return V(i) || V(r) || !!J(e, n) || !!v(n?.accept);
247
+ }
248
+ function wt(t, e = _t) {
249
+ const n = Q(t);
250
+ if (typeof n == "string")
251
+ return n.trim() || void 0;
252
+ if (x(n))
253
+ return K(n, e);
254
+ }
255
+ function kt(t) {
256
+ return typeof t == "string" && yt.test(t);
257
+ }
258
+ function re(t, e, n = {}) {
259
+ const i = v(e?.name ?? e?.filename ?? e?.downloadName);
260
+ if (i)
261
+ return i;
262
+ const r = Q(t);
263
+ return typeof r == "string" ? n.hideAiralogyFileIds && kt(r) ? "" : r : x(r) ? K(r, n.keys ?? [
264
+ "name",
265
+ "fileName",
266
+ "file_name",
267
+ "filename",
268
+ "originalName",
269
+ "original_name",
270
+ "id",
271
+ "file_id",
272
+ "blob_id",
273
+ "src",
274
+ "url"
275
+ ]) ?? "" : "";
276
+ }
277
+ function oe(t, e, n, i, r) {
278
+ return t?.kind ?? Et(t?.mimeType) ?? St(n, i, r) ?? j(X(t?.filename ?? t?.name ?? t?.downloadName)) ?? j(X(wt(e, bt))) ?? "file";
279
+ }
280
+ function Dt(t) {
281
+ return !!(t && /^(blob:|data:|https?:|file:|\/|\.\/|\.\.\/)/i.test(t));
282
+ }
283
+ function se(t) {
284
+ return t?.url ? t.url : Dt(t?.href) ? t?.href : void 0;
285
+ }
286
+ function ae(t, e, n) {
287
+ const i = h(n?.inputType ?? e?.input_type ?? e?.inputType) || h(t);
288
+ return i === "md" || i === "markdown" || i === "airalogymarkdown";
289
+ }
290
+ function ce(t, e, n) {
291
+ const i = h(n?.inputType ?? e?.input_type ?? e?.inputType) || h(t);
292
+ return i === "code" || i === "codestr" || i === "pystr" || i === "pythoncode" || i === "javascriptcode";
293
+ }
294
+ function fe(t, e, n) {
295
+ const i = h(n?.inputType ?? e?.input_type ?? e?.inputType) || h(t);
296
+ return i === "dna" || i === "dnasequence";
297
+ }
298
+ function ue(t, e, n) {
299
+ const i = h(n?.inputType ?? e?.input_type ?? e?.inputType) || h(t);
300
+ return i === "bool" || i === "boolean" || i === "checkbox";
301
+ }
302
+ var E = 1e6, Z = 1e6, N = "[big.js] ", T = N + "Invalid ", O = T + "decimal places", jt = T + "rounding mode", lt = N + "Division by zero", l = {}, b = void 0;
303
+ function S(t, e, n, i) {
304
+ var r = t.c;
305
+ if (n === b && (n = t.constructor.RM), n !== 0 && n !== 1 && n !== 2 && n !== 3)
306
+ throw Error(jt);
307
+ if (e < 1)
308
+ i = n === 3 && (i || !!r[0]) || e === 0 && (n === 1 && r[0] >= 5 || n === 2 && (r[0] > 5 || r[0] === 5 && (i || r[1] !== b))), r.length = 1, i ? (t.e = t.e - e + 1, r[0] = 1) : r[0] = t.e = 0;
309
+ else if (e < r.length) {
310
+ if (i = n === 1 && r[e] >= 5 || n === 2 && (r[e] > 5 || r[e] === 5 && (i || r[e + 1] !== b || r[e - 1] & 1)) || n === 3 && (i || !!r[0]), r.length = e, i) {
311
+ for (; ++r[--e] > 9; )
312
+ if (r[e] = 0, e === 0) {
313
+ ++t.e, r.unshift(1);
314
+ break;
315
+ }
316
+ }
317
+ for (e = r.length; !r[--e]; ) r.pop();
318
+ }
319
+ return t;
320
+ }
321
+ function w(t, e, n) {
322
+ var i = t.e, r = t.c.join(""), o = r.length;
323
+ if (e)
324
+ r = r.charAt(0) + (o > 1 ? "." + r.slice(1) : "") + (i < 0 ? "e" : "e+") + i;
325
+ else if (i < 0) {
326
+ for (; ++i; ) r = "0" + r;
327
+ r = "0." + r;
328
+ } else if (i > 0)
329
+ if (++i > o)
330
+ for (i -= o; i--; ) r += "0";
331
+ else i < o && (r = r.slice(0, i) + "." + r.slice(i));
332
+ else o > 1 && (r = r.charAt(0) + "." + r.slice(1));
333
+ return t.s < 0 && n ? "-" + r : r;
334
+ }
335
+ l.abs = function() {
336
+ var t = new this.constructor(this);
337
+ return t.s = 1, t;
338
+ };
339
+ l.cmp = function(t) {
340
+ var e, n = this, i = n.c, r = (t = new n.constructor(t)).c, o = n.s, a = t.s, s = n.e, f = t.e;
341
+ if (!i[0] || !r[0]) return i[0] ? o : r[0] ? -a : 0;
342
+ if (o != a) return o;
343
+ if (e = o < 0, s != f) return s > f ^ e ? 1 : -1;
344
+ for (a = (s = i.length) < (f = r.length) ? s : f, o = -1; ++o < a; )
345
+ if (i[o] != r[o]) return i[o] > r[o] ^ e ? 1 : -1;
346
+ return s == f ? 0 : s > f ^ e ? 1 : -1;
347
+ };
348
+ l.div = function(t) {
349
+ var e = this, n = e.constructor, i = e.c, r = (t = new n(t)).c, o = e.s == t.s ? 1 : -1, a = n.DP;
350
+ if (a !== ~~a || a < 0 || a > E)
351
+ throw Error(O);
352
+ if (!r[0])
353
+ throw Error(lt);
354
+ if (!i[0])
355
+ return t.s = o, t.c = [t.e = 0], t;
356
+ var s, f, c, p, u, g = r.slice(), k = s = r.length, m = i.length, d = i.slice(0, s), y = d.length, D = t, R = D.c = [], B = 0, I = a + (D.e = e.e - t.e) + 1;
357
+ for (D.s = o, o = I < 0 ? 0 : I, g.unshift(0); y++ < s; ) d.push(0);
358
+ do {
359
+ for (c = 0; c < 10; c++) {
360
+ if (s != (y = d.length))
361
+ p = s > y ? 1 : -1;
362
+ else
363
+ for (u = -1, p = 0; ++u < s; )
364
+ if (r[u] != d[u]) {
365
+ p = r[u] > d[u] ? 1 : -1;
366
+ break;
367
+ }
368
+ if (p < 0) {
369
+ for (f = y == s ? r : g; y; ) {
370
+ if (d[--y] < f[y]) {
371
+ for (u = y; u && !d[--u]; ) d[u] = 9;
372
+ --d[u], d[y] += 10;
373
+ }
374
+ d[y] -= f[y];
375
+ }
376
+ for (; !d[0]; ) d.shift();
377
+ } else
378
+ break;
379
+ }
380
+ R[B++] = p ? c : ++c, d[0] && p ? d[y] = i[k] || 0 : d = [i[k]];
381
+ } while ((k++ < m || d[0] !== b) && o--);
382
+ return !R[0] && B != 1 && (R.shift(), D.e--, I--), B > I && S(D, I, n.RM, d[0] !== b), D;
383
+ };
384
+ l.eq = function(t) {
385
+ return this.cmp(t) === 0;
386
+ };
387
+ l.gt = function(t) {
388
+ return this.cmp(t) > 0;
389
+ };
390
+ l.gte = function(t) {
391
+ return this.cmp(t) > -1;
392
+ };
393
+ l.lt = function(t) {
394
+ return this.cmp(t) < 0;
395
+ };
396
+ l.lte = function(t) {
397
+ return this.cmp(t) < 1;
398
+ };
399
+ l.minus = l.sub = function(t) {
400
+ var e, n, i, r, o = this, a = o.constructor, s = o.s, f = (t = new a(t)).s;
401
+ if (s != f)
402
+ return t.s = -f, o.plus(t);
403
+ var c = o.c.slice(), p = o.e, u = t.c, g = t.e;
404
+ if (!c[0] || !u[0])
405
+ return u[0] ? t.s = -f : c[0] ? t = new a(o) : t.s = 1, t;
406
+ if (s = p - g) {
407
+ for ((r = s < 0) ? (s = -s, i = c) : (g = p, i = u), i.reverse(), f = s; f--; ) i.push(0);
408
+ i.reverse();
409
+ } else
410
+ for (n = ((r = c.length < u.length) ? c : u).length, s = f = 0; f < n; f++)
411
+ if (c[f] != u[f]) {
412
+ r = c[f] < u[f];
413
+ break;
414
+ }
415
+ if (r && (i = c, c = u, u = i, t.s = -t.s), (f = (n = u.length) - (e = c.length)) > 0) for (; f--; ) c[e++] = 0;
416
+ for (f = e; n > s; ) {
417
+ if (c[--n] < u[n]) {
418
+ for (e = n; e && !c[--e]; ) c[e] = 9;
419
+ --c[e], c[n] += 10;
420
+ }
421
+ c[n] -= u[n];
422
+ }
423
+ for (; c[--f] === 0; ) c.pop();
424
+ for (; c[0] === 0; )
425
+ c.shift(), --g;
426
+ return c[0] || (t.s = 1, c = [g = 0]), t.c = c, t.e = g, t;
427
+ };
428
+ l.mod = function(t) {
429
+ var e, n = this, i = n.constructor, r = n.s, o = (t = new i(t)).s;
430
+ if (!t.c[0])
431
+ throw Error(lt);
432
+ return n.s = t.s = 1, e = t.cmp(n) == 1, n.s = r, t.s = o, e ? new i(n) : (r = i.DP, o = i.RM, i.DP = i.RM = 0, n = n.div(t), i.DP = r, i.RM = o, this.minus(n.times(t)));
433
+ };
434
+ l.neg = function() {
435
+ var t = new this.constructor(this);
436
+ return t.s = -t.s, t;
437
+ };
438
+ l.plus = l.add = function(t) {
439
+ var e, n, i, r = this, o = r.constructor;
440
+ if (t = new o(t), r.s != t.s)
441
+ return t.s = -t.s, r.minus(t);
442
+ var a = r.e, s = r.c, f = t.e, c = t.c;
443
+ if (!s[0] || !c[0])
444
+ return c[0] || (s[0] ? t = new o(r) : t.s = r.s), t;
445
+ if (s = s.slice(), e = a - f) {
446
+ for (e > 0 ? (f = a, i = c) : (e = -e, i = s), i.reverse(); e--; ) i.push(0);
447
+ i.reverse();
448
+ }
449
+ for (s.length - c.length < 0 && (i = c, c = s, s = i), e = c.length, n = 0; e; s[e] %= 10) n = (s[--e] = s[e] + c[e] + n) / 10 | 0;
450
+ for (n && (s.unshift(n), ++f), e = s.length; s[--e] === 0; ) s.pop();
451
+ return t.c = s, t.e = f, t;
452
+ };
453
+ l.pow = function(t) {
454
+ var e = this, n = new e.constructor("1"), i = n, r = t < 0;
455
+ if (t !== ~~t || t < -Z || t > Z)
456
+ throw Error(T + "exponent");
457
+ for (r && (t = -t); t & 1 && (i = i.times(e)), t >>= 1, !!t; )
458
+ e = e.times(e);
459
+ return r ? n.div(i) : i;
460
+ };
461
+ l.prec = function(t, e) {
462
+ if (t !== ~~t || t < 1 || t > E)
463
+ throw Error(T + "precision");
464
+ return S(new this.constructor(this), t, e);
465
+ };
466
+ l.round = function(t, e) {
467
+ if (t === b) t = 0;
468
+ else if (t !== ~~t || t < -E || t > E)
469
+ throw Error(O);
470
+ return S(new this.constructor(this), t + this.e + 1, e);
471
+ };
472
+ l.sqrt = function() {
473
+ var t, e, n, i = this, r = i.constructor, o = i.s, a = i.e, s = new r("0.5");
474
+ if (!i.c[0]) return new r(i);
475
+ if (o < 0)
476
+ throw Error(N + "No square root");
477
+ o = Math.sqrt(+w(i, !0, !0)), o === 0 || o === 1 / 0 ? (e = i.c.join(""), e.length + a & 1 || (e += "0"), o = Math.sqrt(e), a = ((a + 1) / 2 | 0) - (a < 0 || a & 1), t = new r((o == 1 / 0 ? "5e" : (o = o.toExponential()).slice(0, o.indexOf("e") + 1)) + a)) : t = new r(o + ""), a = t.e + (r.DP += 4);
478
+ do
479
+ n = t, t = s.times(n.plus(i.div(n)));
480
+ while (n.c.slice(0, a).join("") !== t.c.slice(0, a).join(""));
481
+ return S(t, (r.DP -= 4) + t.e + 1, r.RM);
482
+ };
483
+ l.times = l.mul = function(t) {
484
+ var e, n = this, i = n.constructor, r = n.c, o = (t = new i(t)).c, a = r.length, s = o.length, f = n.e, c = t.e;
485
+ if (t.s = n.s == t.s ? 1 : -1, !r[0] || !o[0])
486
+ return t.c = [t.e = 0], t;
487
+ for (t.e = f + c, a < s && (e = r, r = o, o = e, c = a, a = s, s = c), e = new Array(c = a + s); c--; ) e[c] = 0;
488
+ for (f = s; f--; ) {
489
+ for (s = 0, c = a + f; c > f; )
490
+ s = e[c] + o[f] * r[c - f - 1] + s, e[c--] = s % 10, s = s / 10 | 0;
491
+ e[c] = s;
492
+ }
493
+ for (s ? ++t.e : e.shift(), f = e.length; !e[--f]; ) e.pop();
494
+ return t.c = e, t;
495
+ };
496
+ l.toExponential = function(t, e) {
497
+ var n = this, i = n.c[0];
498
+ if (t !== b) {
499
+ if (t !== ~~t || t < 0 || t > E)
500
+ throw Error(O);
501
+ for (n = S(new n.constructor(n), ++t, e); n.c.length < t; ) n.c.push(0);
502
+ }
503
+ return w(n, !0, !!i);
504
+ };
505
+ l.toFixed = function(t, e) {
506
+ var n = this, i = n.c[0];
507
+ if (t !== b) {
508
+ if (t !== ~~t || t < 0 || t > E)
509
+ throw Error(O);
510
+ for (n = S(new n.constructor(n), t + n.e + 1, e), t = t + n.e + 1; n.c.length < t; ) n.c.push(0);
511
+ }
512
+ return w(n, !1, !!i);
513
+ };
514
+ l[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = l.toJSON = l.toString = function() {
515
+ var t = this, e = t.constructor;
516
+ return w(t, t.e <= e.NE || t.e >= e.PE, !!t.c[0]);
517
+ };
518
+ l.toNumber = function() {
519
+ var t = +w(this, !0, !0);
520
+ if (this.constructor.strict === !0 && !this.eq(t.toString()))
521
+ throw Error(N + "Imprecise conversion");
522
+ return t;
523
+ };
524
+ l.toPrecision = function(t, e) {
525
+ var n = this, i = n.constructor, r = n.c[0];
526
+ if (t !== b) {
527
+ if (t !== ~~t || t < 1 || t > E)
528
+ throw Error(T + "precision");
529
+ for (n = S(new i(n), t, e); n.c.length < t; ) n.c.push(0);
530
+ }
531
+ return w(n, t <= n.e || n.e <= i.NE || n.e >= i.PE, !!r);
532
+ };
533
+ l.valueOf = function() {
534
+ var t = this, e = t.constructor;
535
+ if (e.strict === !0)
536
+ throw Error(N + "valueOf disallowed");
537
+ return w(t, t.e <= e.NE || t.e >= e.PE, !0);
538
+ };
539
+ function It() {
540
+ return {
541
+ var: {},
542
+ step: {},
543
+ check: {},
544
+ quiz: {}
545
+ };
546
+ }
547
+ function Y() {
548
+ return {
549
+ checked: !1,
550
+ annotation: ""
551
+ };
552
+ }
553
+ function dt() {
554
+ return {
555
+ ...Y(),
556
+ elapsed_ms: 0,
557
+ timer_started_at_ms: null,
558
+ started_at_ms: null,
559
+ ended_at_ms: null
560
+ };
561
+ }
562
+ function _(t, e = 0) {
563
+ if (t == null)
564
+ return e;
565
+ const n = typeof t == "number" ? t : typeof t == "string" && t.trim() ? Number(t) : Number.NaN;
566
+ return Number.isFinite(n) ? Math.max(0, n) : e;
567
+ }
568
+ function C(t) {
569
+ return typeof t.timer_started_at_ms == "number" && Number.isFinite(t.timer_started_at_ms);
570
+ }
571
+ function $(t, e = Date.now()) {
572
+ const n = _(t.elapsed_ms, 0) ?? 0;
573
+ if (!C(t))
574
+ return n;
575
+ const i = _(t.timer_started_at_ms, null);
576
+ return i == null ? n : n + Math.max(0, e - i);
577
+ }
578
+ function le(t, e = Date.now()) {
579
+ return C(t) ? !1 : (t.started_at_ms == null && (t.started_at_ms = e), t.timer_started_at_ms = e, t.ended_at_ms = null, !0);
580
+ }
581
+ function vt(t, e = Date.now()) {
582
+ return C(t) ? (t.elapsed_ms = $(t, e), t.timer_started_at_ms = null, t.started_at_ms == null && (t.started_at_ms = e), t.ended_at_ms = e, !0) : !1;
583
+ }
584
+ function de(t) {
585
+ const e = t.elapsed_ms > 0 || t.timer_started_at_ms != null || t.started_at_ms != null || t.ended_at_ms != null;
586
+ return t.elapsed_ms = 0, t.timer_started_at_ms = null, t.started_at_ms = null, t.ended_at_ms = null, e;
587
+ }
588
+ function pe(t, e, n = Date.now()) {
589
+ e && C(t) && vt(t, n);
590
+ const i = t.checked !== e;
591
+ return t.checked = e, i;
592
+ }
593
+ function me(t, e) {
594
+ const n = Math.max(0, Math.round(t / 1e3)), i = Math.floor(n / (24 * 3600)), r = Math.floor(n % (24 * 3600) / 3600), o = Math.floor(n % 3600 / 60), a = n % 60, s = e?.toLowerCase().startsWith("zh"), f = [];
595
+ return i > 0 && f.push(s ? `${i}天` : `${i}d`), r > 0 && f.push(s ? `${r}小时` : `${r}h`), o > 0 && f.push(s ? `${o}分` : `${o}m`), (a > 0 || f.length === 0) && f.push(s ? `${a}秒` : `${a}s`), s ? f.join("") : f.join(" ");
596
+ }
597
+ function ge(t) {
598
+ const e = t.timer_mode ?? "elapsed", n = _(t.estimated_duration_ms, null);
599
+ return (e === "countdown" || e === "both") && (n == null || n <= 0) ? "elapsed" : e;
600
+ }
601
+ function he(t, e, n = Date.now()) {
602
+ const i = _(e, null);
603
+ if (!(i == null || i <= 0))
604
+ return i - $(t, n);
605
+ }
606
+ function ye(t, e) {
607
+ const n = _(e, null);
608
+ return n == null || n <= 0 || t == null || t <= 0 ? !1 : t <= 1e4 || t / n <= 0.2;
609
+ }
610
+ function _e(t) {
611
+ if (!t?.length)
612
+ return 0;
613
+ const e = new Map(t.map((i) => [i.id, i]));
614
+ let n = 0;
615
+ for (const i of t) {
616
+ if (typeof i.estimated_duration_ms != "number" || !Number.isFinite(i.estimated_duration_ms) || i.estimated_duration_ms <= 0)
617
+ continue;
618
+ let r = !1, o = i.parent_id;
619
+ for (; o; ) {
620
+ const a = e.get(o);
621
+ if (!a)
622
+ break;
623
+ if (typeof a.estimated_duration_ms == "number" && Number.isFinite(a.estimated_duration_ms) && a.estimated_duration_ms > 0) {
624
+ r = !0;
625
+ break;
626
+ }
627
+ o = a.parent_id;
628
+ }
629
+ r || (n += i.estimated_duration_ms);
630
+ }
631
+ return n;
632
+ }
633
+ function be(t, e = Date.now()) {
634
+ return Object.values(t).reduce((n, i) => n + $(i, e), 0);
635
+ }
636
+ function Ae(t) {
637
+ return $(t) > 0 || t.started_at_ms != null || t.ended_at_ms != null;
638
+ }
639
+ function Nt(t) {
640
+ if (!t || typeof t != "object" || Array.isArray(t))
641
+ return {
642
+ elapsed_ms: 0,
643
+ timer_started_at_ms: null,
644
+ started_at_ms: null,
645
+ ended_at_ms: null
646
+ };
647
+ const e = t, n = _(e.elapsed_ms, 0) ?? 0, i = _(e.timer_started_at_ms, null), r = _(e.started_at_ms, null), o = _(e.ended_at_ms, null);
648
+ return {
649
+ elapsed_ms: n,
650
+ timer_started_at_ms: i,
651
+ started_at_ms: r,
652
+ ended_at_ms: o
653
+ };
654
+ }
655
+ function xe(t) {
656
+ return JSON.parse(JSON.stringify(t));
657
+ }
658
+ function W(t) {
659
+ return t == null || typeof t != "object" ? JSON.stringify(t) : Array.isArray(t) ? `[${t.map((n) => W(n)).join(",")}]` : `{${Object.entries(t).sort(([n], [i]) => n.localeCompare(i)).map(([n, i]) => `${JSON.stringify(n)}:${W(i)}`).join(",")}}`;
660
+ }
661
+ function Ee(t) {
662
+ return W(pt(t));
663
+ }
664
+ function Tt(t) {
665
+ if (!t || typeof t != "object" || Array.isArray(t))
666
+ return Y();
667
+ const e = t;
668
+ return {
669
+ checked: !!e.checked,
670
+ annotation: typeof e.annotation == "string" ? e.annotation : ""
671
+ };
672
+ }
673
+ function Ft(t) {
674
+ if (!t || typeof t != "object" || Array.isArray(t))
675
+ return dt();
676
+ const e = t;
677
+ return {
678
+ checked: !!e.checked,
679
+ annotation: typeof e.annotation == "string" ? e.annotation : "",
680
+ ...Nt(e)
681
+ };
682
+ }
683
+ function pt(t) {
684
+ const e = It();
685
+ if (!t || typeof t != "object")
686
+ return e;
687
+ if (t.var && typeof t.var == "object" && (e.var = { ...t.var }), t.quiz && typeof t.quiz == "object" && (e.quiz = { ...t.quiz }), t.step && typeof t.step == "object")
688
+ for (const [n, i] of Object.entries(t.step))
689
+ e.step[n] = Ft(i);
690
+ if (t.check && typeof t.check == "object")
691
+ for (const [n, i] of Object.entries(t.check))
692
+ e.check[n] = Tt(i);
693
+ return e;
694
+ }
695
+ function F(t, e) {
696
+ for (const n of Object.keys(t))
697
+ delete t[n];
698
+ Object.assign(t, e);
699
+ }
700
+ function Mt(t, e) {
701
+ F(t.var, e.var), F(t.step, e.step), F(t.check, e.check), F(t.quiz, e.quiz);
702
+ }
703
+ function Se(t, e) {
704
+ Mt(t, pt(e));
705
+ }
706
+ function Ot(t) {
707
+ return Array.isArray(t) ? t.map((e) => typeof e == "string" && e.trim() ? { name: e.trim() } : e && typeof e == "object" && typeof e.name == "string" ? { name: e.name } : null).filter((e) => e !== null) : [];
708
+ }
709
+ function Ct(t) {
710
+ if (!Array.isArray(t))
711
+ return [];
712
+ const e = [];
713
+ for (const n of t) {
714
+ if (typeof n == "string" && n.trim()) {
715
+ const i = n.trim();
716
+ e.push({ name: i, label: i });
717
+ continue;
718
+ }
719
+ if (n && typeof n == "object") {
720
+ const i = n;
721
+ typeof i.name == "string" && e.push({
722
+ name: i.name,
723
+ label: typeof i.label == "string" ? i.label : void 0
724
+ });
725
+ }
726
+ }
727
+ return e;
728
+ }
729
+ function $t(t) {
730
+ return Array.isArray(t) ? t.filter((e) => !!e && typeof e == "object" && typeof e.id == "string" && typeof e.type == "string" && typeof e.stem == "string") : [];
731
+ }
732
+ function Rt(t) {
733
+ return Array.isArray(t) ? t.filter((e) => !!e && typeof e == "object" && typeof e.id == "string" && Array.isArray(e.subvars)) : [];
734
+ }
735
+ function tt(t) {
736
+ return (t.type === "choice" || t.type === "true_false") && Array.isArray(t.options) && t.options.some((e) => Array.isArray(e.followups) && e.followups.length > 0);
737
+ }
738
+ function L(t, e) {
739
+ const n = new Set(e), i = {};
740
+ for (const r of t.options || []) {
741
+ if (!n.has(r.key) || !Array.isArray(r.followups))
742
+ continue;
743
+ const o = {};
744
+ for (const a of r.followups)
745
+ a.default !== void 0 && (o[a.key] = a.default);
746
+ Object.keys(o).length > 0 && (i[r.key] = o);
747
+ }
748
+ return i;
749
+ }
750
+ function Bt(t) {
751
+ if (t.type === "choice") {
752
+ const e = new Set((t.options || []).map((r) => r.key)), n = tt(t);
753
+ if (t.mode === "multiple") {
754
+ let r = [];
755
+ return Array.isArray(t.default) && (r = t.default.filter((o) => typeof o == "string" && e.has(o))), n ? {
756
+ selected: r,
757
+ followups: L(t, r)
758
+ } : r;
759
+ }
760
+ let i = "";
761
+ return typeof t.default == "string" && e.has(t.default) && (i = t.default), n ? {
762
+ selected: i,
763
+ followups: L(t, i ? [i] : [])
764
+ } : i;
765
+ }
766
+ if (t.type === "true_false") {
767
+ const e = typeof t.default == "boolean" ? t.default : null;
768
+ return e !== null && tt(t) ? {
769
+ selected: e,
770
+ followups: L(t, [String(e)])
771
+ } : e;
772
+ }
773
+ if (t.type === "blank") {
774
+ const e = (t.blanks || []).map((i) => i.key);
775
+ if (t.default && typeof t.default == "object" && !Array.isArray(t.default)) {
776
+ const i = t.default, r = {};
777
+ for (const o of e) {
778
+ const a = i[o];
779
+ r[o] = typeof a == "string" ? a : "";
780
+ }
781
+ return r;
782
+ }
783
+ if (typeof t.default == "string" && e.length === 1)
784
+ return { [e[0]]: t.default };
785
+ const n = {};
786
+ for (const i of e)
787
+ n[i] = "";
788
+ return n;
789
+ }
790
+ if (t.type === "scale") {
791
+ const e = (t.items || []).map((o) => o.key), n = new Set((t.options || []).map((o) => o.key)), i = {}, r = t.default && typeof t.default == "object" && !Array.isArray(t.default) ? t.default : {};
792
+ for (const o of e) {
793
+ const a = r[o];
794
+ i[o] = typeof a == "string" && n.has(a) ? a : "";
795
+ }
796
+ return i;
797
+ }
798
+ return typeof t.default == "string" ? t.default : "";
799
+ }
800
+ function M(t) {
801
+ const e = {};
802
+ for (const n of t)
803
+ e[n] = "";
804
+ return e;
805
+ }
806
+ function et(t, e) {
807
+ if (!Array.isArray(t))
808
+ return [M(e)];
809
+ const n = t.map((i) => {
810
+ if (!i || typeof i != "object" || Array.isArray(i))
811
+ return M(e);
812
+ const r = i, o = {};
813
+ for (const a of e) {
814
+ const s = r[a];
815
+ o[a] = typeof s == "string" ? s : `${s ?? ""}`;
816
+ }
817
+ return o;
818
+ });
819
+ return n.length === 0 && n.push(M(e)), n;
820
+ }
821
+ function nt(t, e) {
822
+ return t.length !== 1 ? !1 : e.every((n) => t[0]?.[n] === "");
823
+ }
824
+ function we(t) {
825
+ if (t === "")
826
+ return [];
827
+ const n = t.replace(/\r\n?/g, `
828
+ `).split(`
829
+ `);
830
+ for (; n.length > 0 && n[n.length - 1] === ""; )
831
+ n.pop();
832
+ return n.map((i) => i.split(" "));
833
+ }
834
+ function ke(t, e, n, i, r, o) {
835
+ const a = [];
836
+ if (e.length === 0 || r.length === 0 || n < 0 || i < 0)
837
+ return { rowsAdded: 0, changedCells: a };
838
+ const s = new Set(o?.disabledColumns ?? []);
839
+ let f = 0;
840
+ for (const [c, p] of r.entries()) {
841
+ const u = n + c, g = p.map((m, d) => ({
842
+ value: m,
843
+ columnIndex: i + d
844
+ })).filter(({ columnIndex: m }) => m >= 0 && m < e.length).map(({ value: m, columnIndex: d }) => ({
845
+ value: m,
846
+ column: e[d]
847
+ })).filter(({ column: m }) => !s.has(m));
848
+ if (g.length === 0)
849
+ continue;
850
+ for (; u >= t.length; )
851
+ t.push(M(e)), f += 1;
852
+ const k = t[u];
853
+ for (const { column: m, value: d } of g)
854
+ k[m] !== d && (k[m] = d, a.push({ rowIndex: u, column: m, value: d }));
855
+ }
856
+ return { rowsAdded: f, changedCells: a };
857
+ }
858
+ function De(t, e) {
859
+ let n = !1;
860
+ for (const i of Rt(e.var_table)) {
861
+ const r = i.subvars.map((u) => u.id), o = i.id in t.var, a = Array.isArray(i.default) && i.default.length > 0 ? et(i.default, r) : void 0, s = o ? t.var[i.id] : a ?? i.default, f = et(s, r), p = !!(o && a && nt(f, r) && !nt(a, r)) && a ? a : f;
862
+ (!o || JSON.stringify(p) !== JSON.stringify(s)) && (t.var[i.id] = p, n = !0);
863
+ }
864
+ for (const i of Ot(e.step))
865
+ i.name in t.step || (t.step[i.name] = dt(), n = !0);
866
+ for (const i of Ct(e.check))
867
+ i.name in t.check || (t.check[i.name] = Y(), n = !0);
868
+ for (const i of $t(e.quiz))
869
+ i.id in t.quiz || (t.quiz[i.id] = Bt(i), n = !0);
870
+ return n;
871
+ }
872
+ const P = "airalogy_dna_v1", zt = new Set("ACGTRYSWKMBDHVN".split("")), Lt = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
873
+ function it(t, e) {
874
+ const n = typeof t == "string" ? t.trim() : String(t ?? ""), i = Number.parseInt(n, 10);
875
+ return Number.isFinite(i) && i > 0 ? i : e;
876
+ }
877
+ function rt(t) {
878
+ return t === !0 || t === "true" || t === 1 || t === "1";
879
+ }
880
+ function Pt(t) {
881
+ return t === -1 || t === "-1" ? -1 : 1;
882
+ }
883
+ function G(t) {
884
+ return typeof t != "string" ? "" : t.toUpperCase().replace(/\s+/g, "");
885
+ }
886
+ function q(t) {
887
+ return typeof t != "string" ? "" : t.replace(/\s+/g, " ").trim();
888
+ }
889
+ function je(t) {
890
+ const e = /* @__PURE__ */ new Set();
891
+ for (const n of t.toUpperCase())
892
+ zt.has(n) || e.add(n);
893
+ return [...e];
894
+ }
895
+ function mt() {
896
+ return {
897
+ start: 1,
898
+ end: 1,
899
+ partial_start: !1,
900
+ partial_end: !1
901
+ };
902
+ }
903
+ function Vt(t = "note") {
904
+ return {
905
+ key: t,
906
+ value: ""
907
+ };
908
+ }
909
+ function Wt(t = "ann_1") {
910
+ return {
911
+ id: t,
912
+ name: "Feature",
913
+ type: "misc_feature",
914
+ strand: 1,
915
+ color: "#2563eb",
916
+ segments: [mt()],
917
+ qualifiers: []
918
+ };
919
+ }
920
+ function Ie(t) {
921
+ const e = new Set(t.map((i) => i.id));
922
+ let n = 1;
923
+ for (; e.has(`ann_${n}`); )
924
+ n += 1;
925
+ return `ann_${n}`;
926
+ }
927
+ function ot(t) {
928
+ const e = mt();
929
+ if (!t || typeof t != "object" || Array.isArray(t))
930
+ return e;
931
+ const n = t, i = it(n.start, e.start), r = it(n.end, Math.max(i, e.end));
932
+ return {
933
+ start: i,
934
+ end: r,
935
+ partial_start: rt(n.partial_start),
936
+ partial_end: rt(n.partial_end)
937
+ };
938
+ }
939
+ function Gt(t, e = 0) {
940
+ const n = Vt(e === 0 ? "note" : "qualifier");
941
+ if (!t || typeof t != "object" || Array.isArray(t))
942
+ return n;
943
+ const i = t;
944
+ return {
945
+ key: typeof i.key == "string" && i.key.trim() ? i.key.trim() : n.key,
946
+ value: typeof i.value == "string" ? i.value : String(i.value ?? "")
947
+ };
948
+ }
949
+ function qt(t, e) {
950
+ return Array.isArray(e) ? e.map((n) => ({
951
+ key: t,
952
+ value: typeof n == "string" ? n : String(n ?? "")
953
+ })) : [{
954
+ key: t,
955
+ value: typeof e == "string" ? e : String(e ?? "")
956
+ }];
957
+ }
958
+ function Ut(t, e) {
959
+ const n = [];
960
+ if (Array.isArray(t))
961
+ n.push(...t.map((i, r) => Gt(i, r)));
962
+ else if (t && typeof t == "object")
963
+ for (const [i, r] of Object.entries(t)) {
964
+ const o = i.trim();
965
+ o && n.push(...qt(o, r));
966
+ }
967
+ return e != null && String(e).trim() && n.push({
968
+ key: "note",
969
+ value: typeof e == "string" ? e : String(e)
970
+ }), n;
971
+ }
972
+ function Kt(t, e = 0) {
973
+ const n = Wt(`ann_${e + 1}`);
974
+ if (!t || typeof t != "object" || Array.isArray(t))
975
+ return n;
976
+ const i = t, r = Array.isArray(i.segments) && i.segments.length > 0 ? i.segments.map((o) => ot(o)) : "start" in i || "end" in i ? [ot({
977
+ start: i.start,
978
+ end: i.end,
979
+ partial_start: i.partial_start,
980
+ partial_end: i.partial_end
981
+ })] : n.segments;
982
+ return {
983
+ id: typeof i.id == "string" && i.id.trim() ? i.id.trim() : n.id,
984
+ name: typeof i.name == "string" && i.name.trim() ? i.name.trim() : n.name,
985
+ type: typeof i.type == "string" && i.type.trim() ? i.type.trim() : n.type,
986
+ strand: Pt(i.strand),
987
+ color: typeof i.color == "string" && i.color.trim() ? i.color.trim() : n.color,
988
+ segments: r,
989
+ qualifiers: Ut(i.qualifiers, i.note)
990
+ };
991
+ }
992
+ function ve(t) {
993
+ if (typeof t == "string")
994
+ return {
995
+ format: P,
996
+ name: "",
997
+ sequence: G(t),
998
+ topology: "linear",
999
+ annotations: []
1000
+ };
1001
+ if (!t || typeof t != "object" || Array.isArray(t))
1002
+ return {
1003
+ format: P,
1004
+ name: "",
1005
+ sequence: "",
1006
+ topology: "linear",
1007
+ annotations: []
1008
+ };
1009
+ const e = t;
1010
+ return {
1011
+ format: P,
1012
+ name: q(e.name),
1013
+ sequence: G(e.sequence),
1014
+ topology: e.topology === "circular" ? "circular" : "linear",
1015
+ annotations: Array.isArray(e.annotations) ? e.annotations.map((n, i) => Kt(n, i)) : []
1016
+ };
1017
+ }
1018
+ function Ne(t) {
1019
+ let e = 0, n = 0;
1020
+ for (const i of t.toUpperCase())
1021
+ (i === "A" || i === "T" || i === "C" || i === "G") && (e += 1, (i === "C" || i === "G") && (n += 1));
1022
+ return e === 0 ? null : n / e * 100;
1023
+ }
1024
+ function Te(t, e) {
1025
+ return t.end < t.start ? "range" : e <= 0 ? "requires_sequence" : t.end > e ? "out_of_bounds" : null;
1026
+ }
1027
+ function Qt(t) {
1028
+ return t.trim().replace(/\s+/g, "_").replace(/[^A-Za-z0-9_.-]/g, "_") || "DNA_SEQUENCE";
1029
+ }
1030
+ function Jt(t = /* @__PURE__ */ new Date()) {
1031
+ const e = String(t.getDate()).padStart(2, "0"), n = Lt[t.getMonth()] ?? "JAN", i = String(t.getFullYear());
1032
+ return `${e}-${n}-${i}`;
1033
+ }
1034
+ function gt(t, e, n = t, i = 79) {
1035
+ const r = e.replace(/\s+/g, " ").trim();
1036
+ if (!r)
1037
+ return [t.trimEnd()];
1038
+ const o = [];
1039
+ let a = r, s = t;
1040
+ for (; a.length > 0; ) {
1041
+ const f = Math.max(i - s.length, 12);
1042
+ if (a.length <= f) {
1043
+ o.push(`${s}${a}`);
1044
+ break;
1045
+ }
1046
+ let c = a.lastIndexOf(" ", f);
1047
+ c <= 0 && (c = f), o.push(`${s}${a.slice(0, c)}`), a = a.slice(c).trimStart(), s = n;
1048
+ }
1049
+ return o;
1050
+ }
1051
+ function Yt(t) {
1052
+ const e = `${t.partial_start ? "<" : ""}${t.start}`, n = `${t.partial_end ? ">" : ""}${t.end}`;
1053
+ return `${e}..${n}`;
1054
+ }
1055
+ function Xt(t) {
1056
+ const e = t.segments.map(Yt).join(","), n = t.segments.length > 1 ? `join(${e})` : e;
1057
+ return t.strand === -1 ? `complement(${n})` : n;
1058
+ }
1059
+ function Ht(t, e) {
1060
+ const n = t.trim() || "note", i = e.replace(/"/g, "'").trim();
1061
+ return i ? gt(
1062
+ " ",
1063
+ `/${n}="${i}"`,
1064
+ " "
1065
+ ) : [` /${n}`];
1066
+ }
1067
+ function Zt(t) {
1068
+ const e = [...t.qualifiers];
1069
+ return !e.some((i) => i.key.trim().toLowerCase() === "label") && t.name.trim() && e.unshift({
1070
+ key: "label",
1071
+ value: t.name.trim()
1072
+ }), e;
1073
+ }
1074
+ function Fe(t, e) {
1075
+ const n = G(t.sequence), i = q(t.name) || q(e?.name) || "DNA_SEQUENCE", r = Qt(i), o = r.slice(0, 16) || "DNA_SEQUENCE", a = t.topology === "circular" ? "circular" : "linear", s = e?.definition?.trim() || i || `${r} exported from Airalogy AIMD recorder.`, c = [
1076
+ [
1077
+ "LOCUS".padEnd(12, " "),
1078
+ o.padEnd(16, " "),
1079
+ String(n.length).padStart(11, " "),
1080
+ "bp".padEnd(6, " "),
1081
+ "DNA".padEnd(8, " "),
1082
+ a.padEnd(9, " "),
1083
+ Jt(e?.date)
1084
+ ].join(""),
1085
+ ...gt("DEFINITION ", s, " "),
1086
+ `ACCESSION ${o}`,
1087
+ `VERSION ${o}.1`,
1088
+ "KEYWORDS .",
1089
+ "SOURCE synthetic construct",
1090
+ " ORGANISM synthetic construct",
1091
+ " other sequences; artificial sequences.",
1092
+ "FEATURES Location/Qualifiers"
1093
+ ];
1094
+ for (const p of t.annotations) {
1095
+ c.push(` ${(p.type.trim() || "misc_feature").slice(0, 16).padEnd(16, " ")}${Xt(p)}`);
1096
+ for (const u of Zt(p))
1097
+ c.push(...Ht(u.key, u.value));
1098
+ }
1099
+ c.push("ORIGIN");
1100
+ for (let p = 0; p < n.length; p += 60) {
1101
+ const u = n.slice(p, p + 60).toLowerCase(), g = u.match(/.{1,10}/g)?.join(" ") ?? u;
1102
+ c.push(`${String(p + 1).padStart(9, " ")} ${g}`);
1103
+ }
1104
+ return c.push("//"), `${c.join(`
1105
+ `)}
1106
+ `;
1107
+ }
1108
+ export {
1109
+ yt as AIMD_AIRALOGY_FILE_ID_RE,
1110
+ P as AIMD_DNA_SEQUENCE_FORMAT,
1111
+ z as AIMD_FILE_BADGE_BY_KIND,
1112
+ _t as AIMD_FILE_ID_VALUE_KEYS,
1113
+ ct as AIMD_FILE_INPUT_CONFIG_BY_TYPE,
1114
+ st as AIMD_FILE_KIND_BY_EXTENSION,
1115
+ bt as AIMD_FILE_REFERENCE_VALUE_KEYS,
1116
+ at as AIMD_MIME_BY_EXTENSION,
1117
+ ht as AIMD_RECORD_DATA_SCOPES,
1118
+ Se as applyIncomingRecord,
1119
+ Mt as applyNormalizedRecord,
1120
+ ke as applyPastedVarTableGrid,
1121
+ Ne as calculateDnaSequenceGcPercent,
1122
+ xe as cloneRecordData,
1123
+ je as collectInvalidDnaSequenceCharacters,
1124
+ Y as createEmptyCheckRecordItem,
1125
+ Wt as createEmptyDnaSequenceAnnotation,
1126
+ Vt as createEmptyDnaSequenceQualifier,
1127
+ mt as createEmptyDnaSequenceSegment,
1128
+ It as createEmptyProtocolRecordData,
1129
+ dt as createEmptyStepRecordItem,
1130
+ M as createEmptyVarTableRow,
1131
+ De as ensureDefaultsFromFields,
1132
+ me as formatStepDuration,
1133
+ H as getAimdAcceptFromExtension,
1134
+ se as getAimdAssetMediaSource,
1135
+ J as getAimdConfiguredFileExtension,
1136
+ ft as getAimdDisplayValue,
1137
+ re as getAimdFileDisplayName,
1138
+ X as getAimdFileExtension,
1139
+ ut as getAimdFileExtensionFromTypeName,
1140
+ ne as getAimdFileInputConfig,
1141
+ j as getAimdFileKindFromExtension,
1142
+ Et as getAimdFileKindFromMimeType,
1143
+ St as getAimdFileKindFromType,
1144
+ wt as getAimdFileValueId,
1145
+ K as getAimdStringFromRecord,
1146
+ Te as getDnaSequenceSegmentIssue,
1147
+ Ie as getNextDnaSequenceAnnotationId,
1148
+ _e as getProtocolEstimatedDurationMs,
1149
+ be as getProtocolRecordedDurationMs,
1150
+ Bt as getQuizDefaultValue,
1151
+ Ee as getRecordDataSignature,
1152
+ $ as getStepElapsedMs,
1153
+ he as getStepRemainingMs,
1154
+ Ae as hasRecordedStepDuration,
1155
+ oe as inferAimdAssetKind,
1156
+ kt as isAimdAiralogyFileId,
1157
+ ue as isAimdBooleanType,
1158
+ ce as isAimdCodeType,
1159
+ fe as isAimdDnaType,
1160
+ Dt as isAimdEmbeddableAssetUrl,
1161
+ ie as isAimdFileLikeType,
1162
+ ae as isAimdMarkdownType,
1163
+ x as isAimdPlainRecord,
1164
+ V as isKnownAimdFileTypeName,
1165
+ C as isStepTimerRunning,
1166
+ ye as isStepTimerWarning,
1167
+ A as normalizeAimdFileExtension,
1168
+ h as normalizeAimdOptionalTypeName,
1169
+ te as normalizeAimdRecordDataValue,
1170
+ v as normalizeAimdString,
1171
+ U as normalizeAimdTypeName,
1172
+ Ct as normalizeCheckFields,
1173
+ Tt as normalizeCheckLike,
1174
+ Kt as normalizeDnaSequenceAnnotation,
1175
+ q as normalizeDnaSequenceName,
1176
+ Gt as normalizeDnaSequenceQualifier,
1177
+ ot as normalizeDnaSequenceSegment,
1178
+ G as normalizeDnaSequenceText,
1179
+ ve as normalizeDnaSequenceValue,
1180
+ pt as normalizeIncomingRecord,
1181
+ $t as normalizeQuizFields,
1182
+ Ot as normalizeStepFields,
1183
+ Ft as normalizeStepLike,
1184
+ Nt as normalizeStepTimerState,
1185
+ Rt as normalizeVarTableFields,
1186
+ et as normalizeVarTableRows,
1187
+ we as parsePastedVarTableText,
1188
+ vt as pauseStepTimer,
1189
+ F as replaceSection,
1190
+ de as resetStepTimer,
1191
+ At as resolveAimdRecordData,
1192
+ ge as resolveStepTimerMode,
1193
+ Fe as serializeDnaSequenceToGenBank,
1194
+ pe as setStepChecked,
1195
+ le as startStepTimer,
1196
+ xt as stringifyAimdDisplayValue,
1197
+ ee as toAimdBooleanValue,
1198
+ Q as unwrapAimdStructuredValue
1199
+ };