@airalogy/aimd-recorder 1.19.2 → 1.20.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.
- package/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/dist/{AimdDnaSequenceField-TBKunqU_.js → AimdDnaSequenceField-Cp0cgBYl.js} +1 -1
- package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-gTySIxvX.js → AimdEditor.vue_vue_type_style_index_0_lang-DTdcoNs1.js} +1588 -1584
- package/dist/{AimdMarkdownField-DGV5KFUs.js → AimdMarkdownField-D4AEz_mB.js} +18 -17
- package/dist/{AimdMarkdownNoteField-C78KHCBA.js → AimdMarkdownNoteField-CSGaShKi.js} +5 -4
- package/dist/aimd-recorder.css +1 -1
- package/dist/{arc-BMhAnOm7.js → arc-jL17V0L2.js} +1 -1
- package/dist/{architectureDiagram-3BPJPVTR-DXuPTBR3.js → architectureDiagram-3BPJPVTR-CijadmFI.js} +2 -2
- package/dist/{blockDiagram-GPEHLZMM-HKz9kQ49.js → blockDiagram-GPEHLZMM-BPqvb85_.js} +4 -4
- package/dist/{c4Diagram-AAUBKEIU-B2a8Aupm.js → c4Diagram-AAUBKEIU-i4fqlMXu.js} +2 -2
- package/dist/{channel-CQnbPm6T.js → channel-DnnUQTdl.js} +1 -1
- package/dist/{chunk-2J33WTMH-CPwhDANL.js → chunk-2J33WTMH-DKKEpdr1.js} +1 -1
- package/dist/{chunk-4BX2VUAB-BJV0R8-Z.js → chunk-4BX2VUAB-WvuuiYYH.js} +1 -1
- package/dist/{chunk-55IACEB6-CSqUgTVA.js → chunk-55IACEB6-B_UkHTnd.js} +1 -1
- package/dist/{chunk-727SXJPM-C3LCZWaC.js → chunk-727SXJPM-CR6Pb04P.js} +5 -5
- package/dist/{chunk-AQP2D5EJ-BC5kHyik.js → chunk-AQP2D5EJ-B68Ie417.js} +3 -3
- package/dist/{chunk-FMBD7UC4-lv-SQuSa.js → chunk-FMBD7UC4-CeCGT6rb.js} +1 -1
- package/dist/{chunk-ND2GUHAM-BnnHbOOp.js → chunk-ND2GUHAM-BYN-eC_q.js} +1 -1
- package/dist/{chunk-QZHKN3VN-DE1_5lrn.js → chunk-QZHKN3VN-BNSp120j.js} +1 -1
- package/dist/{classDiagram-v2-Q7XG4LA2-32SrXsR3.js → classDiagram-4FO5ZUOK-Cgbn4w3f.js} +2 -2
- package/dist/{classDiagram-4FO5ZUOK-32SrXsR3.js → classDiagram-v2-Q7XG4LA2-Cgbn4w3f.js} +2 -2
- package/dist/components.js +90 -89
- package/dist/composables.js +22 -22
- package/dist/{cose-bilkent-S5V4N54A-BKyR6PrF.js → cose-bilkent-S5V4N54A-TfrsQ2c3.js} +1 -1
- package/dist/{dagre-BM42HDAG-D8Nwouf2.js → dagre-BM42HDAG-BAyvB_JI.js} +3 -3
- package/dist/{diagram-2AECGRRQ-DfoNEchZ.js → diagram-2AECGRRQ-Bijq8bHO.js} +2 -2
- package/dist/{diagram-5GNKFQAL-Dlpl3XO8.js → diagram-5GNKFQAL-B3ZuTuxm.js} +3 -3
- package/dist/{diagram-KO2AKTUF-CgwROod_.js → diagram-KO2AKTUF-DrqLeGCI.js} +2 -2
- package/dist/{diagram-LMA3HP47-UiiviX43.js → diagram-LMA3HP47-CCSQH8O0.js} +2 -2
- package/dist/{diagram-OG6HWLK6-BPuH-4Wa.js → diagram-OG6HWLK6-DM5cUEjW.js} +3 -3
- package/dist/{erDiagram-TEJ5UH35-B19WKSiS.js → erDiagram-TEJ5UH35-DQhmDdAF.js} +4 -4
- package/dist/{flowDiagram-I6XJVG4X-SsfO1IYz.js → flowDiagram-I6XJVG4X-DrqiPSHI.js} +6 -6
- package/dist/{ganttDiagram-6RSMTGT7-8BCxW9SC.js → ganttDiagram-6RSMTGT7-DpX_Y2vA.js} +2 -2
- package/dist/{gitGraphDiagram-PVQCEYII-D-jzaXKg.js → gitGraphDiagram-PVQCEYII-3isOhIyZ.js} +3 -3
- package/dist/{graph-Dd8Vx0lj.js → graph-C30SJlSk.js} +1 -1
- package/dist/index-Dtvv88SS.js +1308 -0
- package/dist/index.js +19 -19
- package/dist/{infoDiagram-5YYISTIA-B_XwkyXw.js → infoDiagram-5YYISTIA-Cr_MlPvz.js} +1 -1
- package/dist/{ishikawaDiagram-YF4QCWOH-nevqOMkV.js → ishikawaDiagram-YF4QCWOH-DydyFn3h.js} +1 -1
- package/dist/{journeyDiagram-JHISSGLW-DKQOkZNx.js → journeyDiagram-JHISSGLW-V_5MmeOu.js} +4 -4
- package/dist/{kanban-definition-UN3LZRKU-BYvizbN0.js → kanban-definition-UN3LZRKU-C_XXCuvp.js} +2 -2
- package/dist/{layout-BiHDh2wu.js → layout-85j-z7Lr.js} +2 -2
- package/dist/{linear-BcUgIsNC.js → linear-DMtodz-6.js} +1 -1
- package/dist/{mermaid.core-DPv1ut6K.js → mermaid.core-CkanUCyS.js} +34 -34
- package/dist/{mindmap-definition-RKZ34NQL-CiT97EC2.js → mindmap-definition-RKZ34NQL-CyikmuF2.js} +3 -3
- package/dist/{pieDiagram-4H26LBE5-BHcFVpCC.js → pieDiagram-4H26LBE5-CesqzEGg.js} +3 -3
- package/dist/{quadrantDiagram-W4KKPZXB-BFBAb3Zx.js → quadrantDiagram-W4KKPZXB-BsPKPfNd.js} +2 -2
- package/dist/record.js +90 -1196
- package/dist/{requirementDiagram-4Y6WPE33-CUS2OOyE.js → requirementDiagram-4Y6WPE33-BwB1tQvi.js} +3 -3
- package/dist/{sankeyDiagram-5OEKKPKP-IuhX4tCb.js → sankeyDiagram-5OEKKPKP-CfSNbWMY.js} +1 -1
- package/dist/{sequenceDiagram-3UESZ5HK-DWHcFiUF.js → sequenceDiagram-3UESZ5HK-DZZlUNys.js} +3 -3
- package/dist/{stateDiagram-AJRCARHV-J49Kafj_.js → stateDiagram-AJRCARHV-DNJmz_op.js} +4 -4
- package/dist/{stateDiagram-v2-BHNVJYJU-DL2VCR5X.js → stateDiagram-v2-BHNVJYJU-DVfDNM6l.js} +2 -2
- package/dist/{timeline-definition-PNZ67QCA-l9xSQ_pX.js → timeline-definition-PNZ67QCA-DEUCAg_N.js} +2 -2
- package/dist/{useCodeBlockRendering-CY70U0Xm.js → useCodeBlockRendering-DF6zm7nf.js} +475 -526
- package/dist/{vennDiagram-CIIHVFJN-BQjdmOkd.js → vennDiagram-CIIHVFJN-DVDP__od.js} +1 -1
- package/dist/{wardleyDiagram-YWT4CUSO-CmVdsV9b.js → wardleyDiagram-YWT4CUSO-sEtxBd33.js} +2 -2
- package/dist/{xychartDiagram-2RQKCTM6-F-cC_Igm.js → xychartDiagram-2RQKCTM6-DM8QeR5M.js} +2 -2
- package/package.json +4 -4
- package/src/__tests__/recorder-editor.test.ts +3 -1
- package/src/__tests__/var-field-render.test.ts +33 -0
- package/src/components/AimdRecorderEditor.vue +3 -1
|
@@ -0,0 +1,1308 @@
|
|
|
1
|
+
const Ae = /* @__PURE__ */ JSON.parse(`{"UserName":{"type_name":"UserName","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"current-user","type":"string","description":"The user name of the current Airalogy user"},"CurrentTime":{"type_name":"CurrentTime","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"current-time","type":"string","description":"The current time. The timezone is based on the user's browser."},"CurrentProtocolId":{"type_name":"CurrentProtocolId","import_from":"airalogy.types","storage_kind":"scalar","type":"string","description":"The ID of the current Airalogy Protocol."},"CurrentRecordId":{"type_name":"CurrentRecordId","import_from":"airalogy.types","storage_kind":"scalar","type":"string","description":"The ID of the current Airalogy Record."},"BloodType":{"type_name":"BloodType","import_from":"airalogy.types","storage_kind":"scalar","type":"string","title":"Blood type","description":"Common ABO blood group values. Values such as A+ or A- combine an ABO group with Rh positive or Rh negative status. Rh+ and Rh- are allowed when only Rh factor is recorded.","enum":["A","B","AB","O","A+","A-","B+","B-","AB+","AB-","O+","O-","Rh+","Rh-"]},"ChineseEducationLevel":{"type_name":"ChineseEducationLevel","import_from":"airalogy.types","storage_kind":"scalar","type":"string","title":"文化程度","description":"中国居民信息登记中常用的文化程度分类。","enum":["无学历","小学","初中","高中","中专","大专","本科","硕士","博士"]},"ChineseEthnicGroup":{"type_name":"ChineseEthnicGroup","import_from":"airalogy.types","storage_kind":"scalar","type":"string","title":"民族","description":"中国国务院公布的 56 个法定民族之一。","enum":["汉族","蒙古族","回族","藏族","维吾尔族","苗族","彝族","壮族","布依族","朝鲜族","满族","侗族","瑶族","白族","土家族","哈尼族","哈萨克族","傣族","黎族","傈僳族","佤族","畲族","高山族","拉祜族","水族","东乡族","纳西族","景颇族","柯尔克孜族","土族","达斡尔族","仫佬族","羌族","布朗族","撒拉族","毛南族","仡佬族","锡伯族","阿昌族","普米族","塔吉克族","怒族","乌孜别克族","俄罗斯族","鄂温克族","德昂族","保安族","裕固族","京族","塔塔尔族","独龙族","鄂伦春族","赫哲族","门巴族","珞巴族","基诺族"]},"ChineseGender":{"type_name":"ChineseGender","import_from":"airalogy.types","storage_kind":"scalar","type":"string","title":"性别","description":"中国居民信息登记中常用的性别分类。","enum":["男","女"]},"ChineseMaritalStatus":{"type_name":"ChineseMaritalStatus","import_from":"airalogy.types","storage_kind":"scalar","type":"string","title":"婚姻状况","description":"中国居民信息登记中常用的婚姻状况分类。","enum":["未婚","已婚","丧偶","离婚","再婚"]},"ChineseProvinceLevelRegion":{"type_name":"ChineseProvinceLevelRegion","import_from":"airalogy.types","storage_kind":"scalar","type":"string","title":"省级行政区","description":"中国现行省级行政区(省、自治区、直辖市、特别行政区)。","enum":["北京","天津","上海","重庆","河北","山西","辽宁","吉林","黑龙江","江苏","浙江","安徽","福建","江西","山东","河南","湖北","湖南","广东","海南","四川","贵州","云南","陕西","甘肃","青海","台湾","西藏","内蒙古","广西","宁夏","新疆","香港","澳门"]},"AiralogyMarkdown":{"type_name":"AiralogyMarkdown","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"markdown","type":"string","description":"An Airalogy Markdown string"},"RecordId":{"type_name":"RecordId","import_from":"airalogy.types","storage_kind":"scalar","type":"string"},"FileIdPNG":{"type_name":"FileIdPNG","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdPNG. This type allows users to upload a .png file and inject it into the related data field."},"FileIdJPG":{"type_name":"FileIdJPG","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdJPG. This type allows users to upload a .jpg file and inject it into the related data field."},"FileIdSVG":{"type_name":"FileIdSVG","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdSVG. This type allows users to upload a .svg file and inject it into the related data field."},"FileIdWEBP":{"type_name":"FileIdWEBP","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdWEBP. This type allows users to upload a .webp file and inject it into the related data field."},"FileIdTIFF":{"type_name":"FileIdTIFF","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdTIFF. This type allows users to upload a .tiff file and inject it into the related data field."},"FileIdMP4":{"type_name":"FileIdMP4","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdMP4. This type allows users to upload a .mp4 file and inject it into the related data field."},"FileIdMP3":{"type_name":"FileIdMP3","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdMP3. This type allows users to upload a .mp3 file and inject it into the related data field."},"FileIdAIMD":{"type_name":"FileIdAIMD","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdAIMD. This type allows users to upload a .aimd file and inject it into the related data field."},"FileIdMD":{"type_name":"FileIdMD","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdMD. This type allows users to upload a .md file and inject it into the related data field."},"FileIdTXT":{"type_name":"FileIdTXT","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdTXT. This type allows users to upload a .txt file and inject it into the related data field."},"FileIdCSV":{"type_name":"FileIdCSV","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdCSV. This type allows users to upload a .csv file and inject it into the related data field."},"FileIdJSON":{"type_name":"FileIdJSON","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdJSON. This type allows users to upload a .json file and inject it into the related data field."},"FileIdDOCX":{"type_name":"FileIdDOCX","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdDOCX. This type allows users to upload a .docx file and inject it into the related data field."},"FileIdXLSX":{"type_name":"FileIdXLSX","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdXLSX. This type allows users to upload a .xlsx file and inject it into the related data field."},"FileIdPPTX":{"type_name":"FileIdPPTX","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdPPTX. This type allows users to upload a .pptx file and inject it into the related data field."},"FileIdPDF":{"type_name":"FileIdPDF","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdPDF. This type allows users to upload a .pdf file and inject it into the related data field."},"FileIdDNA":{"type_name":"FileIdDNA","import_from":"airalogy.types","storage_kind":"file-id","ui_kind":"file","type":"string","description":"Airalogy built-in type: FileIdDNA. This type allows users to upload a .dna file and inject it into the related data field."},"Recommended":{"type_name":"Recommended","import_from":"airalogy.types","storage_kind":"scalar","type":"object"},"IgnoreStr":{"type_name":"IgnoreStr","import_from":"airalogy.types","storage_kind":"scalar","type":"string","description":"In an Airalogy Field of this type, a user may provide a string; however, when the Airalogy Record is submitted, the string is not persisted. This is intended for sensitive input (such as an API key) that the Airalogy Protocol Assigner can consume during processing but that should never be stored in the final Record."},"CodeStr":{"type_name":"CodeStr","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"code","type":"string","description":"Airalogy built-in type: CodeStr (plaintext). Strings of this type contain language-agnostic code or structured text and are rendered in a plain code editor."},"PyStr":{"type_name":"PyStr","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"code","type":"string","description":"Airalogy built-in type: CodeStr (python). Strings of this type contain python source code and are rendered in an editor with python syntax highlighting."},"JsStr":{"type_name":"JsStr","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"code","type":"string","description":"Airalogy built-in type: CodeStr (javascript). Strings of this type contain javascript source code and are rendered in an editor with javascript syntax highlighting."},"TsStr":{"type_name":"TsStr","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"code","type":"string","description":"Airalogy built-in type: CodeStr (typescript). Strings of this type contain typescript source code and are rendered in an editor with typescript syntax highlighting."},"JsonStr":{"type_name":"JsonStr","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"code","type":"string","description":"Airalogy built-in type: CodeStr (json). Strings of this type contain json source code and are rendered in an editor with json syntax highlighting."},"TomlStr":{"type_name":"TomlStr","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"code","type":"string","description":"Airalogy built-in type: CodeStr (toml). Strings of this type contain toml source code and are rendered in an editor with toml syntax highlighting."},"YamlStr":{"type_name":"YamlStr","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"code","type":"string","description":"Airalogy built-in type: CodeStr (yaml). Strings of this type contain yaml source code and are rendered in an editor with yaml syntax highlighting."},"ATCG":{"type_name":"ATCG","import_from":"airalogy.types","storage_kind":"scalar","ui_kind":"dna-text","type":"string"},"DNASequence":{"type_name":"DNASequence","import_from":"airalogy.types","storage_kind":"structured","ui_kind":"dna-sequence","type":"object","title":"DNASequence","description":"Structured DNA sequence value used by Airalogy's dedicated sequence editor.\\n\\nThis model intentionally stays simpler than full GenBank flatfiles while\\npreserving the core pieces needed for practical import/export alignment:\\nmulti-segment feature locations, partial flags, and qualifier rows."},"SnakeStr":{"type_name":"SnakeStr","import_from":"airalogy.types","storage_kind":"scalar","type":"string"},"VersionStr":{"type_name":"VersionStr","import_from":"airalogy.types","storage_kind":"scalar","type":"string"},"ProtocolId":{"type_name":"ProtocolId","import_from":"airalogy.types","storage_kind":"scalar","type":"string"}}`), be = {
|
|
2
|
+
types: Ae
|
|
3
|
+
}, ke = be, Se = Object.fromEntries(
|
|
4
|
+
Object.values(ke.types).flatMap((e) => [
|
|
5
|
+
[e.type_name, e],
|
|
6
|
+
...(e.aliases ?? []).map((t) => [t, e])
|
|
7
|
+
])
|
|
8
|
+
), Ie = /* @__PURE__ */ new Set(["None", "none", "null", "Null", "undefined"]);
|
|
9
|
+
function le(e) {
|
|
10
|
+
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
11
|
+
}
|
|
12
|
+
function Z(e) {
|
|
13
|
+
return Array.isArray(e) ? e.filter((t) => t != null) : e == null || e === "" ? [] : [e];
|
|
14
|
+
}
|
|
15
|
+
function we(e) {
|
|
16
|
+
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
17
|
+
}
|
|
18
|
+
function V(e) {
|
|
19
|
+
return Array.isArray(e) ? e.filter(we) : [];
|
|
20
|
+
}
|
|
21
|
+
function xe(e) {
|
|
22
|
+
const t = e.trim();
|
|
23
|
+
if (!/^(?:(?:typing|typing_extensions|airalogy\.types)\.)?[A-Za-z_][A-Za-z0-9_]*$/.test(t))
|
|
24
|
+
return;
|
|
25
|
+
const i = t.split(".");
|
|
26
|
+
return i[i.length - 1];
|
|
27
|
+
}
|
|
28
|
+
function Ee(e) {
|
|
29
|
+
const t = [];
|
|
30
|
+
let i = "", n = 0;
|
|
31
|
+
for (const o of e) {
|
|
32
|
+
if (o === "[") {
|
|
33
|
+
n += 1, i += o;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (o === "]") {
|
|
37
|
+
n = Math.max(0, n - 1), i += o;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (o === "|" && n === 0) {
|
|
41
|
+
const a = i.trim();
|
|
42
|
+
a && t.push(a), i = "";
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
i += o;
|
|
46
|
+
}
|
|
47
|
+
const r = i.trim();
|
|
48
|
+
return r && t.push(r), t;
|
|
49
|
+
}
|
|
50
|
+
function De(e) {
|
|
51
|
+
const t = e.trim().match(/^(?:(?:typing|typing_extensions)\.)?Optional\s*\[([\s\S]+)\]$/);
|
|
52
|
+
return t ? t[1].trim() : e.trim();
|
|
53
|
+
}
|
|
54
|
+
function Fe(e) {
|
|
55
|
+
if (!e)
|
|
56
|
+
return;
|
|
57
|
+
const t = De(e), i = Ee(t), n = (i.length > 0 ? i : [t]).map(xe).filter((r) => typeof r == "string" && !Ie.has(r));
|
|
58
|
+
return n.length === 1 ? n[0] : void 0;
|
|
59
|
+
}
|
|
60
|
+
function Te(e) {
|
|
61
|
+
const t = Fe(e);
|
|
62
|
+
return t ? Se[t] : void 0;
|
|
63
|
+
}
|
|
64
|
+
function je(e) {
|
|
65
|
+
return V(Te(e)?.enum);
|
|
66
|
+
}
|
|
67
|
+
function Ne(e) {
|
|
68
|
+
return le(e?.kwargs?.title);
|
|
69
|
+
}
|
|
70
|
+
function yt(e) {
|
|
71
|
+
return le(e?.kwargs?.description);
|
|
72
|
+
}
|
|
73
|
+
function ht(e) {
|
|
74
|
+
const t = e?.kwargs;
|
|
75
|
+
if (!t)
|
|
76
|
+
return [];
|
|
77
|
+
const i = Z(t.examples);
|
|
78
|
+
return i.length > 0 ? i : Z(t.example);
|
|
79
|
+
}
|
|
80
|
+
function _t(e) {
|
|
81
|
+
const t = V(e?.enum);
|
|
82
|
+
if (t.length > 0)
|
|
83
|
+
return t;
|
|
84
|
+
const i = V(e?.kwargs?.enum);
|
|
85
|
+
return i.length > 0 ? i : je(e?.type);
|
|
86
|
+
}
|
|
87
|
+
function At(e, t) {
|
|
88
|
+
return Ne(t) ?? e;
|
|
89
|
+
}
|
|
90
|
+
function bt(e) {
|
|
91
|
+
if (typeof e == "string")
|
|
92
|
+
return e;
|
|
93
|
+
if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint")
|
|
94
|
+
return String(e);
|
|
95
|
+
if (e === null)
|
|
96
|
+
return "null";
|
|
97
|
+
try {
|
|
98
|
+
return JSON.stringify(e);
|
|
99
|
+
} catch {
|
|
100
|
+
return String(e);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const ve = ["var", "var_table", "step", "check", "quiz"], $ = {
|
|
104
|
+
file: "FILE",
|
|
105
|
+
image: "IMG",
|
|
106
|
+
audio: "AUD",
|
|
107
|
+
video: "VID",
|
|
108
|
+
csv: "CSV",
|
|
109
|
+
text: "TXT",
|
|
110
|
+
document: "DOC"
|
|
111
|
+
}, ce = {
|
|
112
|
+
csv: "csv",
|
|
113
|
+
png: "image",
|
|
114
|
+
jpg: "image",
|
|
115
|
+
jpeg: "image",
|
|
116
|
+
svg: "image",
|
|
117
|
+
webp: "image",
|
|
118
|
+
tif: "image",
|
|
119
|
+
tiff: "image",
|
|
120
|
+
mp3: "audio",
|
|
121
|
+
wav: "audio",
|
|
122
|
+
m4a: "audio",
|
|
123
|
+
mp4: "video",
|
|
124
|
+
mov: "video",
|
|
125
|
+
webm: "video",
|
|
126
|
+
aimd: "text",
|
|
127
|
+
md: "text",
|
|
128
|
+
txt: "text",
|
|
129
|
+
json: "text",
|
|
130
|
+
pdf: "document",
|
|
131
|
+
docx: "document",
|
|
132
|
+
xlsx: "document",
|
|
133
|
+
pptx: "document"
|
|
134
|
+
}, de = {
|
|
135
|
+
csv: "text/csv",
|
|
136
|
+
png: "image/png",
|
|
137
|
+
jpg: "image/jpeg",
|
|
138
|
+
jpeg: "image/jpeg",
|
|
139
|
+
svg: "image/svg+xml",
|
|
140
|
+
webp: "image/webp",
|
|
141
|
+
tif: "image/tiff",
|
|
142
|
+
tiff: "image/tiff",
|
|
143
|
+
mp3: "audio/mpeg",
|
|
144
|
+
wav: "audio/wav",
|
|
145
|
+
m4a: "audio/mp4",
|
|
146
|
+
mp4: "video/mp4",
|
|
147
|
+
mov: "video/quicktime",
|
|
148
|
+
webm: "video/webm",
|
|
149
|
+
md: "text/markdown",
|
|
150
|
+
txt: "text/plain",
|
|
151
|
+
aimd: "text/plain",
|
|
152
|
+
json: "application/json",
|
|
153
|
+
pdf: "application/pdf",
|
|
154
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
155
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
156
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
157
|
+
}, fe = {
|
|
158
|
+
file: { kind: "file", badge: "FILE" },
|
|
159
|
+
upload: { kind: "file", badge: "FILE" },
|
|
160
|
+
csv: { kind: "csv", accept: ".csv,text/csv", badge: "CSV" },
|
|
161
|
+
fileidcsv: { kind: "csv", accept: ".csv,text/csv", badge: "CSV" },
|
|
162
|
+
image: { kind: "image", accept: "image/*", badge: "IMG" },
|
|
163
|
+
fileidpng: { kind: "image", accept: ".png,image/png", badge: "IMG" },
|
|
164
|
+
fileidjpg: { kind: "image", accept: ".jpg,.jpeg,image/jpeg", badge: "IMG" },
|
|
165
|
+
fileidjpeg: { kind: "image", accept: ".jpg,.jpeg,image/jpeg", badge: "IMG" },
|
|
166
|
+
fileidsvg: { kind: "image", accept: ".svg,image/svg+xml", badge: "IMG" },
|
|
167
|
+
fileidwebp: { kind: "image", accept: ".webp,image/webp", badge: "IMG" },
|
|
168
|
+
fileidtiff: { kind: "image", accept: ".tif,.tiff,image/tiff", badge: "IMG" },
|
|
169
|
+
audio: { kind: "audio", accept: "audio/*", badge: "AUD" },
|
|
170
|
+
fileidmp3: { kind: "audio", accept: ".mp3,audio/mpeg", badge: "AUD" },
|
|
171
|
+
video: { kind: "video", accept: "video/*", badge: "VID" },
|
|
172
|
+
fileidmp4: { kind: "video", accept: ".mp4,video/mp4", badge: "VID" },
|
|
173
|
+
fileidaimd: { kind: "text", accept: ".aimd,text/plain", badge: "AIMD" },
|
|
174
|
+
fileidmd: { kind: "text", accept: ".md,text/markdown,text/plain", badge: "MD" },
|
|
175
|
+
fileidtxt: { kind: "text", accept: ".txt,text/plain", badge: "TXT" },
|
|
176
|
+
fileidjson: { kind: "text", accept: ".json,application/json", badge: "JSON" },
|
|
177
|
+
fileiddocx: { kind: "document", accept: ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document", badge: "DOC" },
|
|
178
|
+
fileidxlsx: { kind: "document", accept: ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", badge: "XLS" },
|
|
179
|
+
fileidpptx: { kind: "document", accept: ".pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation", badge: "PPT" },
|
|
180
|
+
fileidpdf: { kind: "document", accept: ".pdf,application/pdf", badge: "PDF" }
|
|
181
|
+
}, Ce = /^airalogy\.id\.file\.[^\s]+$/i, Me = ["id", "file_id", "fileId", "src"], Pe = ["id", "file_id", "fileId", "blob_id", "blobId", "src", "url", "href"];
|
|
182
|
+
function k(e) {
|
|
183
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
184
|
+
}
|
|
185
|
+
function U(e, t = "str") {
|
|
186
|
+
return typeof e != "string" ? t : e.trim().toLowerCase().replace(/[^a-z0-9]/g, "") || t;
|
|
187
|
+
}
|
|
188
|
+
function y(e) {
|
|
189
|
+
return U(e, "");
|
|
190
|
+
}
|
|
191
|
+
function T(e) {
|
|
192
|
+
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
193
|
+
}
|
|
194
|
+
function X(e, t) {
|
|
195
|
+
if (e)
|
|
196
|
+
for (const i of t) {
|
|
197
|
+
const n = T(e[i]);
|
|
198
|
+
if (n)
|
|
199
|
+
return n;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function Oe(e) {
|
|
203
|
+
return k(e) && k(e.data) ? e.data : e;
|
|
204
|
+
}
|
|
205
|
+
function K(e) {
|
|
206
|
+
return k(e) && "value" in e ? e.value : e;
|
|
207
|
+
}
|
|
208
|
+
function kt(e) {
|
|
209
|
+
const t = Oe(e), i = {};
|
|
210
|
+
if (!k(t))
|
|
211
|
+
return i;
|
|
212
|
+
for (const n of ve) {
|
|
213
|
+
const r = t[n];
|
|
214
|
+
i[n] = k(r) ? { ...r } : {};
|
|
215
|
+
}
|
|
216
|
+
return i;
|
|
217
|
+
}
|
|
218
|
+
function ue(e) {
|
|
219
|
+
return K(e);
|
|
220
|
+
}
|
|
221
|
+
function Be(e) {
|
|
222
|
+
const t = ue(e);
|
|
223
|
+
if (t == null)
|
|
224
|
+
return "";
|
|
225
|
+
if (typeof t == "string")
|
|
226
|
+
return t;
|
|
227
|
+
if (typeof t == "number" || typeof t == "boolean")
|
|
228
|
+
return String(t);
|
|
229
|
+
if (Array.isArray(t))
|
|
230
|
+
return t.map((i) => Be(i)).filter(Boolean).join(", ");
|
|
231
|
+
try {
|
|
232
|
+
return JSON.stringify(t, null, 2);
|
|
233
|
+
} catch {
|
|
234
|
+
return String(t);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function St(e) {
|
|
238
|
+
const t = ue(e);
|
|
239
|
+
if (typeof t == "boolean") return t;
|
|
240
|
+
if (typeof t == "number") return t !== 0;
|
|
241
|
+
if (typeof t == "string") {
|
|
242
|
+
const i = t.trim().toLowerCase();
|
|
243
|
+
if (i === "" || i === "false" || i === "0" || i === "no" || i === "off")
|
|
244
|
+
return !1;
|
|
245
|
+
if (i === "true" || i === "1" || i === "yes" || i === "on")
|
|
246
|
+
return !0;
|
|
247
|
+
}
|
|
248
|
+
return !!t;
|
|
249
|
+
}
|
|
250
|
+
function b(e) {
|
|
251
|
+
if (typeof e != "string")
|
|
252
|
+
return;
|
|
253
|
+
const t = e.trim().toLowerCase();
|
|
254
|
+
if (!(!t || t === "*"))
|
|
255
|
+
return t.replace(/^\./, "");
|
|
256
|
+
}
|
|
257
|
+
function Q(e, t) {
|
|
258
|
+
const i = b(t?.fileExtension);
|
|
259
|
+
return i || (b(e?.file_extension) ?? b(e?.fileExtension) ?? b(e?.extension));
|
|
260
|
+
}
|
|
261
|
+
function H(e) {
|
|
262
|
+
const t = T(e);
|
|
263
|
+
if (!t)
|
|
264
|
+
return;
|
|
265
|
+
const n = (t.split(/[?#]/, 1)[0] ?? t).match(/\.([A-Za-z0-9]+)$/);
|
|
266
|
+
return b(n?.[1]);
|
|
267
|
+
}
|
|
268
|
+
function ee(e) {
|
|
269
|
+
const t = e.replace(/^\./, "").toLowerCase(), i = de[t];
|
|
270
|
+
return i ? `.${t},${i}` : `.${t}`;
|
|
271
|
+
}
|
|
272
|
+
function D(e) {
|
|
273
|
+
const t = b(e);
|
|
274
|
+
return t ? ce[t] : void 0;
|
|
275
|
+
}
|
|
276
|
+
function pe(e) {
|
|
277
|
+
const t = y(e);
|
|
278
|
+
if (!t.startsWith("fileid") || t.length <= 6)
|
|
279
|
+
return;
|
|
280
|
+
const i = b(t.slice(6));
|
|
281
|
+
if (i)
|
|
282
|
+
return ce[i] || de[i] ? i : void 0;
|
|
283
|
+
}
|
|
284
|
+
function Re(e) {
|
|
285
|
+
if (!e)
|
|
286
|
+
return;
|
|
287
|
+
const t = e.toLowerCase();
|
|
288
|
+
if (t.startsWith("image/")) return "image";
|
|
289
|
+
if (t.startsWith("audio/")) return "audio";
|
|
290
|
+
if (t.startsWith("video/")) return "video";
|
|
291
|
+
if (t.includes("csv")) return "csv";
|
|
292
|
+
if (t.startsWith("text/") || t.includes("json") || t.includes("markdown")) return "text";
|
|
293
|
+
if (t.includes("pdf") || t.includes("word") || t.includes("spreadsheet") || t.includes("presentation")) return "document";
|
|
294
|
+
}
|
|
295
|
+
function $e(e, t, i) {
|
|
296
|
+
const n = y(i?.inputType ?? t?.input_type ?? t?.inputType), r = y(e), o = n || r;
|
|
297
|
+
if (!o)
|
|
298
|
+
return;
|
|
299
|
+
if (o === "image" || o.startsWith("fileidpng") || o.startsWith("fileidjpg") || o.startsWith("fileidjpeg") || o.startsWith("fileidsvg") || o.startsWith("fileidwebp") || o.startsWith("fileidtiff"))
|
|
300
|
+
return "image";
|
|
301
|
+
if (o === "audio" || o.startsWith("fileidmp3"))
|
|
302
|
+
return "audio";
|
|
303
|
+
if (o === "video" || o.startsWith("fileidmp4"))
|
|
304
|
+
return "video";
|
|
305
|
+
if (o === "csv" || o.startsWith("fileidcsv"))
|
|
306
|
+
return "csv";
|
|
307
|
+
if (o.startsWith("fileidmd") || o.startsWith("fileidtxt") || o.startsWith("fileidjson") || o.startsWith("fileidaimd"))
|
|
308
|
+
return "text";
|
|
309
|
+
if (o.startsWith("fileidpdf") || o.startsWith("fileiddocx") || o.startsWith("fileidxlsx") || o.startsWith("fileidpptx"))
|
|
310
|
+
return "document";
|
|
311
|
+
const a = pe(o), s = D(a);
|
|
312
|
+
return s || (o === "file" || o === "upload" || o.startsWith("fileid") ? "file" : D(Q(t, i)));
|
|
313
|
+
}
|
|
314
|
+
function G(e) {
|
|
315
|
+
return e ? !!fe[e] || e.startsWith("fileid") : !1;
|
|
316
|
+
}
|
|
317
|
+
function It(e, t, i) {
|
|
318
|
+
const n = y(i?.inputType), r = G(n) ? n : U(e), o = Q(t, i), a = T(i?.accept) ?? X(t, ["accept", "file_accept", "fileAccept"]), s = fe[r], c = pe(r);
|
|
319
|
+
if (o) {
|
|
320
|
+
const l = D(o) ?? "file";
|
|
321
|
+
return {
|
|
322
|
+
kind: l,
|
|
323
|
+
accept: a ?? ee(o),
|
|
324
|
+
badge: s?.badge ?? $[l]
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
if (s)
|
|
328
|
+
return {
|
|
329
|
+
...s,
|
|
330
|
+
accept: a ?? s.accept
|
|
331
|
+
};
|
|
332
|
+
if (c) {
|
|
333
|
+
const l = D(c) ?? "file";
|
|
334
|
+
return {
|
|
335
|
+
kind: l,
|
|
336
|
+
accept: a ?? ee(c),
|
|
337
|
+
badge: $[l]
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
kind: "file",
|
|
342
|
+
accept: a,
|
|
343
|
+
badge: $.file
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function wt(e, t, i) {
|
|
347
|
+
const n = U(e), r = y(i?.inputType);
|
|
348
|
+
return G(n) || G(r) || !!Q(t, i) || !!T(i?.accept);
|
|
349
|
+
}
|
|
350
|
+
function Le(e, t = Me) {
|
|
351
|
+
const i = K(e);
|
|
352
|
+
if (typeof i == "string")
|
|
353
|
+
return i.trim() || void 0;
|
|
354
|
+
if (k(i))
|
|
355
|
+
return X(i, t);
|
|
356
|
+
}
|
|
357
|
+
function ze(e) {
|
|
358
|
+
return typeof e == "string" && Ce.test(e);
|
|
359
|
+
}
|
|
360
|
+
function xt(e, t, i = {}) {
|
|
361
|
+
const n = T(t?.name ?? t?.filename ?? t?.downloadName);
|
|
362
|
+
if (n)
|
|
363
|
+
return n;
|
|
364
|
+
const r = K(e);
|
|
365
|
+
return typeof r == "string" ? i.hideAiralogyFileIds && ze(r) ? "" : r : k(r) ? X(r, i.keys ?? [
|
|
366
|
+
"name",
|
|
367
|
+
"fileName",
|
|
368
|
+
"file_name",
|
|
369
|
+
"filename",
|
|
370
|
+
"originalName",
|
|
371
|
+
"original_name",
|
|
372
|
+
"id",
|
|
373
|
+
"file_id",
|
|
374
|
+
"blob_id",
|
|
375
|
+
"src",
|
|
376
|
+
"url"
|
|
377
|
+
]) ?? "" : "";
|
|
378
|
+
}
|
|
379
|
+
function Et(e, t, i, n, r) {
|
|
380
|
+
return e?.kind ?? Re(e?.mimeType) ?? $e(i, n, r) ?? D(H(e?.filename ?? e?.name ?? e?.downloadName)) ?? D(H(Le(t, Pe))) ?? "file";
|
|
381
|
+
}
|
|
382
|
+
function Ve(e) {
|
|
383
|
+
return !!(e && /^(blob:|data:|https?:|file:|\/|\.\/|\.\.\/)/i.test(e));
|
|
384
|
+
}
|
|
385
|
+
function Dt(e) {
|
|
386
|
+
return e?.url ? e.url : Ve(e?.href) ? e?.href : void 0;
|
|
387
|
+
}
|
|
388
|
+
function Ft(e, t, i) {
|
|
389
|
+
const n = y(i?.inputType ?? t?.input_type ?? t?.inputType) || y(e);
|
|
390
|
+
return n === "md" || n === "markdown" || n === "airalogymarkdown";
|
|
391
|
+
}
|
|
392
|
+
function Tt(e, t, i) {
|
|
393
|
+
const n = y(i?.inputType ?? t?.input_type ?? t?.inputType) || y(e);
|
|
394
|
+
return n === "code" || n === "codestr" || n === "pystr" || n === "pythoncode" || n === "javascriptcode";
|
|
395
|
+
}
|
|
396
|
+
function jt(e, t, i) {
|
|
397
|
+
const n = y(i?.inputType ?? t?.input_type ?? t?.inputType) || y(e);
|
|
398
|
+
return n === "dna" || n === "dnasequence";
|
|
399
|
+
}
|
|
400
|
+
function Nt(e, t, i) {
|
|
401
|
+
const n = y(i?.inputType ?? t?.input_type ?? t?.inputType) || y(e);
|
|
402
|
+
return n === "bool" || n === "boolean" || n === "checkbox";
|
|
403
|
+
}
|
|
404
|
+
var S = 1e6, te = 1e6, j = "[big.js] ", N = j + "Invalid ", M = N + "decimal places", Ge = N + "rounding mode", me = j + "Division by zero", f = {}, A = void 0;
|
|
405
|
+
function I(e, t, i, n) {
|
|
406
|
+
var r = e.c;
|
|
407
|
+
if (i === A && (i = e.constructor.RM), i !== 0 && i !== 1 && i !== 2 && i !== 3)
|
|
408
|
+
throw Error(Ge);
|
|
409
|
+
if (t < 1)
|
|
410
|
+
n = i === 3 && (n || !!r[0]) || t === 0 && (i === 1 && r[0] >= 5 || i === 2 && (r[0] > 5 || r[0] === 5 && (n || r[1] !== A))), r.length = 1, n ? (e.e = e.e - t + 1, r[0] = 1) : r[0] = e.e = 0;
|
|
411
|
+
else if (t < r.length) {
|
|
412
|
+
if (n = i === 1 && r[t] >= 5 || i === 2 && (r[t] > 5 || r[t] === 5 && (n || r[t + 1] !== A || r[t - 1] & 1)) || i === 3 && (n || !!r[0]), r.length = t, n) {
|
|
413
|
+
for (; ++r[--t] > 9; )
|
|
414
|
+
if (r[t] = 0, t === 0) {
|
|
415
|
+
++e.e, r.unshift(1);
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
for (t = r.length; !r[--t]; ) r.pop();
|
|
420
|
+
}
|
|
421
|
+
return e;
|
|
422
|
+
}
|
|
423
|
+
function w(e, t, i) {
|
|
424
|
+
var n = e.e, r = e.c.join(""), o = r.length;
|
|
425
|
+
if (t)
|
|
426
|
+
r = r.charAt(0) + (o > 1 ? "." + r.slice(1) : "") + (n < 0 ? "e" : "e+") + n;
|
|
427
|
+
else if (n < 0) {
|
|
428
|
+
for (; ++n; ) r = "0" + r;
|
|
429
|
+
r = "0." + r;
|
|
430
|
+
} else if (n > 0)
|
|
431
|
+
if (++n > o)
|
|
432
|
+
for (n -= o; n--; ) r += "0";
|
|
433
|
+
else n < o && (r = r.slice(0, n) + "." + r.slice(n));
|
|
434
|
+
else o > 1 && (r = r.charAt(0) + "." + r.slice(1));
|
|
435
|
+
return e.s < 0 && i ? "-" + r : r;
|
|
436
|
+
}
|
|
437
|
+
f.abs = function() {
|
|
438
|
+
var e = new this.constructor(this);
|
|
439
|
+
return e.s = 1, e;
|
|
440
|
+
};
|
|
441
|
+
f.cmp = function(e) {
|
|
442
|
+
var t, i = this, n = i.c, r = (e = new i.constructor(e)).c, o = i.s, a = e.s, s = i.e, c = e.e;
|
|
443
|
+
if (!n[0] || !r[0]) return n[0] ? o : r[0] ? -a : 0;
|
|
444
|
+
if (o != a) return o;
|
|
445
|
+
if (t = o < 0, s != c) return s > c ^ t ? 1 : -1;
|
|
446
|
+
for (a = (s = n.length) < (c = r.length) ? s : c, o = -1; ++o < a; )
|
|
447
|
+
if (n[o] != r[o]) return n[o] > r[o] ^ t ? 1 : -1;
|
|
448
|
+
return s == c ? 0 : s > c ^ t ? 1 : -1;
|
|
449
|
+
};
|
|
450
|
+
f.div = function(e) {
|
|
451
|
+
var t = this, i = t.constructor, n = t.c, r = (e = new i(e)).c, o = t.s == e.s ? 1 : -1, a = i.DP;
|
|
452
|
+
if (a !== ~~a || a < 0 || a > S)
|
|
453
|
+
throw Error(M);
|
|
454
|
+
if (!r[0])
|
|
455
|
+
throw Error(me);
|
|
456
|
+
if (!n[0])
|
|
457
|
+
return e.s = o, e.c = [e.e = 0], e;
|
|
458
|
+
var s, c, l, p, d, g = r.slice(), x = s = r.length, m = n.length, u = n.slice(0, s), h = u.length, E = e, B = E.c = [], R = 0, F = a + (E.e = t.e - e.e) + 1;
|
|
459
|
+
for (E.s = o, o = F < 0 ? 0 : F, g.unshift(0); h++ < s; ) u.push(0);
|
|
460
|
+
do {
|
|
461
|
+
for (l = 0; l < 10; l++) {
|
|
462
|
+
if (s != (h = u.length))
|
|
463
|
+
p = s > h ? 1 : -1;
|
|
464
|
+
else
|
|
465
|
+
for (d = -1, p = 0; ++d < s; )
|
|
466
|
+
if (r[d] != u[d]) {
|
|
467
|
+
p = r[d] > u[d] ? 1 : -1;
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
if (p < 0) {
|
|
471
|
+
for (c = h == s ? r : g; h; ) {
|
|
472
|
+
if (u[--h] < c[h]) {
|
|
473
|
+
for (d = h; d && !u[--d]; ) u[d] = 9;
|
|
474
|
+
--u[d], u[h] += 10;
|
|
475
|
+
}
|
|
476
|
+
u[h] -= c[h];
|
|
477
|
+
}
|
|
478
|
+
for (; !u[0]; ) u.shift();
|
|
479
|
+
} else
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
B[R++] = p ? l : ++l, u[0] && p ? u[h] = n[x] || 0 : u = [n[x]];
|
|
483
|
+
} while ((x++ < m || u[0] !== A) && o--);
|
|
484
|
+
return !B[0] && R != 1 && (B.shift(), E.e--, F--), R > F && I(E, F, i.RM, u[0] !== A), E;
|
|
485
|
+
};
|
|
486
|
+
f.eq = function(e) {
|
|
487
|
+
return this.cmp(e) === 0;
|
|
488
|
+
};
|
|
489
|
+
f.gt = function(e) {
|
|
490
|
+
return this.cmp(e) > 0;
|
|
491
|
+
};
|
|
492
|
+
f.gte = function(e) {
|
|
493
|
+
return this.cmp(e) > -1;
|
|
494
|
+
};
|
|
495
|
+
f.lt = function(e) {
|
|
496
|
+
return this.cmp(e) < 0;
|
|
497
|
+
};
|
|
498
|
+
f.lte = function(e) {
|
|
499
|
+
return this.cmp(e) < 1;
|
|
500
|
+
};
|
|
501
|
+
f.minus = f.sub = function(e) {
|
|
502
|
+
var t, i, n, r, o = this, a = o.constructor, s = o.s, c = (e = new a(e)).s;
|
|
503
|
+
if (s != c)
|
|
504
|
+
return e.s = -c, o.plus(e);
|
|
505
|
+
var l = o.c.slice(), p = o.e, d = e.c, g = e.e;
|
|
506
|
+
if (!l[0] || !d[0])
|
|
507
|
+
return d[0] ? e.s = -c : l[0] ? e = new a(o) : e.s = 1, e;
|
|
508
|
+
if (s = p - g) {
|
|
509
|
+
for ((r = s < 0) ? (s = -s, n = l) : (g = p, n = d), n.reverse(), c = s; c--; ) n.push(0);
|
|
510
|
+
n.reverse();
|
|
511
|
+
} else
|
|
512
|
+
for (i = ((r = l.length < d.length) ? l : d).length, s = c = 0; c < i; c++)
|
|
513
|
+
if (l[c] != d[c]) {
|
|
514
|
+
r = l[c] < d[c];
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
if (r && (n = l, l = d, d = n, e.s = -e.s), (c = (i = d.length) - (t = l.length)) > 0) for (; c--; ) l[t++] = 0;
|
|
518
|
+
for (c = t; i > s; ) {
|
|
519
|
+
if (l[--i] < d[i]) {
|
|
520
|
+
for (t = i; t && !l[--t]; ) l[t] = 9;
|
|
521
|
+
--l[t], l[i] += 10;
|
|
522
|
+
}
|
|
523
|
+
l[i] -= d[i];
|
|
524
|
+
}
|
|
525
|
+
for (; l[--c] === 0; ) l.pop();
|
|
526
|
+
for (; l[0] === 0; )
|
|
527
|
+
l.shift(), --g;
|
|
528
|
+
return l[0] || (e.s = 1, l = [g = 0]), e.c = l, e.e = g, e;
|
|
529
|
+
};
|
|
530
|
+
f.mod = function(e) {
|
|
531
|
+
var t, i = this, n = i.constructor, r = i.s, o = (e = new n(e)).s;
|
|
532
|
+
if (!e.c[0])
|
|
533
|
+
throw Error(me);
|
|
534
|
+
return i.s = e.s = 1, t = e.cmp(i) == 1, i.s = r, e.s = o, t ? new n(i) : (r = n.DP, o = n.RM, n.DP = n.RM = 0, i = i.div(e), n.DP = r, n.RM = o, this.minus(i.times(e)));
|
|
535
|
+
};
|
|
536
|
+
f.neg = function() {
|
|
537
|
+
var e = new this.constructor(this);
|
|
538
|
+
return e.s = -e.s, e;
|
|
539
|
+
};
|
|
540
|
+
f.plus = f.add = function(e) {
|
|
541
|
+
var t, i, n, r = this, o = r.constructor;
|
|
542
|
+
if (e = new o(e), r.s != e.s)
|
|
543
|
+
return e.s = -e.s, r.minus(e);
|
|
544
|
+
var a = r.e, s = r.c, c = e.e, l = e.c;
|
|
545
|
+
if (!s[0] || !l[0])
|
|
546
|
+
return l[0] || (s[0] ? e = new o(r) : e.s = r.s), e;
|
|
547
|
+
if (s = s.slice(), t = a - c) {
|
|
548
|
+
for (t > 0 ? (c = a, n = l) : (t = -t, n = s), n.reverse(); t--; ) n.push(0);
|
|
549
|
+
n.reverse();
|
|
550
|
+
}
|
|
551
|
+
for (s.length - l.length < 0 && (n = l, l = s, s = n), t = l.length, i = 0; t; s[t] %= 10) i = (s[--t] = s[t] + l[t] + i) / 10 | 0;
|
|
552
|
+
for (i && (s.unshift(i), ++c), t = s.length; s[--t] === 0; ) s.pop();
|
|
553
|
+
return e.c = s, e.e = c, e;
|
|
554
|
+
};
|
|
555
|
+
f.pow = function(e) {
|
|
556
|
+
var t = this, i = new t.constructor("1"), n = i, r = e < 0;
|
|
557
|
+
if (e !== ~~e || e < -te || e > te)
|
|
558
|
+
throw Error(N + "exponent");
|
|
559
|
+
for (r && (e = -e); e & 1 && (n = n.times(t)), e >>= 1, !!e; )
|
|
560
|
+
t = t.times(t);
|
|
561
|
+
return r ? i.div(n) : n;
|
|
562
|
+
};
|
|
563
|
+
f.prec = function(e, t) {
|
|
564
|
+
if (e !== ~~e || e < 1 || e > S)
|
|
565
|
+
throw Error(N + "precision");
|
|
566
|
+
return I(new this.constructor(this), e, t);
|
|
567
|
+
};
|
|
568
|
+
f.round = function(e, t) {
|
|
569
|
+
if (e === A) e = 0;
|
|
570
|
+
else if (e !== ~~e || e < -S || e > S)
|
|
571
|
+
throw Error(M);
|
|
572
|
+
return I(new this.constructor(this), e + this.e + 1, t);
|
|
573
|
+
};
|
|
574
|
+
f.sqrt = function() {
|
|
575
|
+
var e, t, i, n = this, r = n.constructor, o = n.s, a = n.e, s = new r("0.5");
|
|
576
|
+
if (!n.c[0]) return new r(n);
|
|
577
|
+
if (o < 0)
|
|
578
|
+
throw Error(j + "No square root");
|
|
579
|
+
o = Math.sqrt(+w(n, !0, !0)), o === 0 || o === 1 / 0 ? (t = n.c.join(""), t.length + a & 1 || (t += "0"), o = Math.sqrt(t), a = ((a + 1) / 2 | 0) - (a < 0 || a & 1), e = new r((o == 1 / 0 ? "5e" : (o = o.toExponential()).slice(0, o.indexOf("e") + 1)) + a)) : e = new r(o + ""), a = e.e + (r.DP += 4);
|
|
580
|
+
do
|
|
581
|
+
i = e, e = s.times(i.plus(n.div(i)));
|
|
582
|
+
while (i.c.slice(0, a).join("") !== e.c.slice(0, a).join(""));
|
|
583
|
+
return I(e, (r.DP -= 4) + e.e + 1, r.RM);
|
|
584
|
+
};
|
|
585
|
+
f.times = f.mul = function(e) {
|
|
586
|
+
var t, i = this, n = i.constructor, r = i.c, o = (e = new n(e)).c, a = r.length, s = o.length, c = i.e, l = e.e;
|
|
587
|
+
if (e.s = i.s == e.s ? 1 : -1, !r[0] || !o[0])
|
|
588
|
+
return e.c = [e.e = 0], e;
|
|
589
|
+
for (e.e = c + l, a < s && (t = r, r = o, o = t, l = a, a = s, s = l), t = new Array(l = a + s); l--; ) t[l] = 0;
|
|
590
|
+
for (c = s; c--; ) {
|
|
591
|
+
for (s = 0, l = a + c; l > c; )
|
|
592
|
+
s = t[l] + o[c] * r[l - c - 1] + s, t[l--] = s % 10, s = s / 10 | 0;
|
|
593
|
+
t[l] = s;
|
|
594
|
+
}
|
|
595
|
+
for (s ? ++e.e : t.shift(), c = t.length; !t[--c]; ) t.pop();
|
|
596
|
+
return e.c = t, e;
|
|
597
|
+
};
|
|
598
|
+
f.toExponential = function(e, t) {
|
|
599
|
+
var i = this, n = i.c[0];
|
|
600
|
+
if (e !== A) {
|
|
601
|
+
if (e !== ~~e || e < 0 || e > S)
|
|
602
|
+
throw Error(M);
|
|
603
|
+
for (i = I(new i.constructor(i), ++e, t); i.c.length < e; ) i.c.push(0);
|
|
604
|
+
}
|
|
605
|
+
return w(i, !0, !!n);
|
|
606
|
+
};
|
|
607
|
+
f.toFixed = function(e, t) {
|
|
608
|
+
var i = this, n = i.c[0];
|
|
609
|
+
if (e !== A) {
|
|
610
|
+
if (e !== ~~e || e < 0 || e > S)
|
|
611
|
+
throw Error(M);
|
|
612
|
+
for (i = I(new i.constructor(i), e + i.e + 1, t), e = e + i.e + 1; i.c.length < e; ) i.c.push(0);
|
|
613
|
+
}
|
|
614
|
+
return w(i, !1, !!n);
|
|
615
|
+
};
|
|
616
|
+
f[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = f.toJSON = f.toString = function() {
|
|
617
|
+
var e = this, t = e.constructor;
|
|
618
|
+
return w(e, e.e <= t.NE || e.e >= t.PE, !!e.c[0]);
|
|
619
|
+
};
|
|
620
|
+
f.toNumber = function() {
|
|
621
|
+
var e = +w(this, !0, !0);
|
|
622
|
+
if (this.constructor.strict === !0 && !this.eq(e.toString()))
|
|
623
|
+
throw Error(j + "Imprecise conversion");
|
|
624
|
+
return e;
|
|
625
|
+
};
|
|
626
|
+
f.toPrecision = function(e, t) {
|
|
627
|
+
var i = this, n = i.constructor, r = i.c[0];
|
|
628
|
+
if (e !== A) {
|
|
629
|
+
if (e !== ~~e || e < 1 || e > S)
|
|
630
|
+
throw Error(N + "precision");
|
|
631
|
+
for (i = I(new n(i), e, t); i.c.length < e; ) i.c.push(0);
|
|
632
|
+
}
|
|
633
|
+
return w(i, e <= i.e || i.e <= n.NE || i.e >= n.PE, !!r);
|
|
634
|
+
};
|
|
635
|
+
f.valueOf = function() {
|
|
636
|
+
var e = this, t = e.constructor;
|
|
637
|
+
if (t.strict === !0)
|
|
638
|
+
throw Error(j + "valueOf disallowed");
|
|
639
|
+
return w(e, e.e <= t.NE || e.e >= t.PE, !0);
|
|
640
|
+
};
|
|
641
|
+
function We() {
|
|
642
|
+
return {
|
|
643
|
+
var: {},
|
|
644
|
+
step: {},
|
|
645
|
+
check: {},
|
|
646
|
+
quiz: {}
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
function Y() {
|
|
650
|
+
return {
|
|
651
|
+
checked: !1,
|
|
652
|
+
annotation: ""
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
function ge() {
|
|
656
|
+
return {
|
|
657
|
+
...Y(),
|
|
658
|
+
elapsed_ms: 0,
|
|
659
|
+
timer_started_at_ms: null,
|
|
660
|
+
started_at_ms: null,
|
|
661
|
+
ended_at_ms: null
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
function _(e, t = 0) {
|
|
665
|
+
if (e == null)
|
|
666
|
+
return t;
|
|
667
|
+
const i = typeof e == "number" ? e : typeof e == "string" && e.trim() ? Number(e) : Number.NaN;
|
|
668
|
+
return Number.isFinite(i) ? Math.max(0, i) : t;
|
|
669
|
+
}
|
|
670
|
+
function P(e) {
|
|
671
|
+
return typeof e.timer_started_at_ms == "number" && Number.isFinite(e.timer_started_at_ms);
|
|
672
|
+
}
|
|
673
|
+
function O(e, t = Date.now()) {
|
|
674
|
+
const i = _(e.elapsed_ms, 0) ?? 0;
|
|
675
|
+
if (!P(e))
|
|
676
|
+
return i;
|
|
677
|
+
const n = _(e.timer_started_at_ms, null);
|
|
678
|
+
return n == null ? i : i + Math.max(0, t - n);
|
|
679
|
+
}
|
|
680
|
+
function vt(e, t = Date.now()) {
|
|
681
|
+
return P(e) ? !1 : (e.started_at_ms == null && (e.started_at_ms = t), e.timer_started_at_ms = t, e.ended_at_ms = null, !0);
|
|
682
|
+
}
|
|
683
|
+
function qe(e, t = Date.now()) {
|
|
684
|
+
return P(e) ? (e.elapsed_ms = O(e, t), e.timer_started_at_ms = null, e.started_at_ms == null && (e.started_at_ms = t), e.ended_at_ms = t, !0) : !1;
|
|
685
|
+
}
|
|
686
|
+
function Ct(e) {
|
|
687
|
+
const t = e.elapsed_ms > 0 || e.timer_started_at_ms != null || e.started_at_ms != null || e.ended_at_ms != null;
|
|
688
|
+
return e.elapsed_ms = 0, e.timer_started_at_ms = null, e.started_at_ms = null, e.ended_at_ms = null, t;
|
|
689
|
+
}
|
|
690
|
+
function Mt(e, t, i = Date.now()) {
|
|
691
|
+
t && P(e) && qe(e, i);
|
|
692
|
+
const n = e.checked !== t;
|
|
693
|
+
return e.checked = t, n;
|
|
694
|
+
}
|
|
695
|
+
function Pt(e, t) {
|
|
696
|
+
const i = Math.max(0, Math.round(e / 1e3)), n = Math.floor(i / (24 * 3600)), r = Math.floor(i % (24 * 3600) / 3600), o = Math.floor(i % 3600 / 60), a = i % 60, s = t?.toLowerCase().startsWith("zh"), c = [];
|
|
697
|
+
return n > 0 && c.push(s ? `${n}天` : `${n}d`), r > 0 && c.push(s ? `${r}小时` : `${r}h`), o > 0 && c.push(s ? `${o}分` : `${o}m`), (a > 0 || c.length === 0) && c.push(s ? `${a}秒` : `${a}s`), s ? c.join("") : c.join(" ");
|
|
698
|
+
}
|
|
699
|
+
function Ot(e) {
|
|
700
|
+
const t = e.timer_mode ?? "elapsed", i = _(e.estimated_duration_ms, null);
|
|
701
|
+
return (t === "countdown" || t === "both") && (i == null || i <= 0) ? "elapsed" : t;
|
|
702
|
+
}
|
|
703
|
+
function Bt(e, t, i = Date.now()) {
|
|
704
|
+
const n = _(t, null);
|
|
705
|
+
if (!(n == null || n <= 0))
|
|
706
|
+
return n - O(e, i);
|
|
707
|
+
}
|
|
708
|
+
function Rt(e, t) {
|
|
709
|
+
const i = _(t, null);
|
|
710
|
+
return i == null || i <= 0 || e == null || e <= 0 ? !1 : e <= 1e4 || e / i <= 0.2;
|
|
711
|
+
}
|
|
712
|
+
function $t(e) {
|
|
713
|
+
if (!e?.length)
|
|
714
|
+
return 0;
|
|
715
|
+
const t = new Map(e.map((n) => [n.id, n]));
|
|
716
|
+
let i = 0;
|
|
717
|
+
for (const n of e) {
|
|
718
|
+
if (typeof n.estimated_duration_ms != "number" || !Number.isFinite(n.estimated_duration_ms) || n.estimated_duration_ms <= 0)
|
|
719
|
+
continue;
|
|
720
|
+
let r = !1, o = n.parent_id;
|
|
721
|
+
for (; o; ) {
|
|
722
|
+
const a = t.get(o);
|
|
723
|
+
if (!a)
|
|
724
|
+
break;
|
|
725
|
+
if (typeof a.estimated_duration_ms == "number" && Number.isFinite(a.estimated_duration_ms) && a.estimated_duration_ms > 0) {
|
|
726
|
+
r = !0;
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
o = a.parent_id;
|
|
730
|
+
}
|
|
731
|
+
r || (i += n.estimated_duration_ms);
|
|
732
|
+
}
|
|
733
|
+
return i;
|
|
734
|
+
}
|
|
735
|
+
function Lt(e, t = Date.now()) {
|
|
736
|
+
return Object.values(e).reduce((i, n) => i + O(n, t), 0);
|
|
737
|
+
}
|
|
738
|
+
function zt(e) {
|
|
739
|
+
return O(e) > 0 || e.started_at_ms != null || e.ended_at_ms != null;
|
|
740
|
+
}
|
|
741
|
+
function Je(e) {
|
|
742
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
743
|
+
return {
|
|
744
|
+
elapsed_ms: 0,
|
|
745
|
+
timer_started_at_ms: null,
|
|
746
|
+
started_at_ms: null,
|
|
747
|
+
ended_at_ms: null
|
|
748
|
+
};
|
|
749
|
+
const t = e, i = _(t.elapsed_ms, 0) ?? 0, n = _(t.timer_started_at_ms, null), r = _(t.started_at_ms, null), o = _(t.ended_at_ms, null);
|
|
750
|
+
return {
|
|
751
|
+
elapsed_ms: i,
|
|
752
|
+
timer_started_at_ms: n,
|
|
753
|
+
started_at_ms: r,
|
|
754
|
+
ended_at_ms: o
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function Vt(e) {
|
|
758
|
+
return JSON.parse(JSON.stringify(e));
|
|
759
|
+
}
|
|
760
|
+
function W(e) {
|
|
761
|
+
return e == null || typeof e != "object" ? JSON.stringify(e) : Array.isArray(e) ? `[${e.map((i) => W(i)).join(",")}]` : `{${Object.entries(e).sort(([i], [n]) => i.localeCompare(n)).map(([i, n]) => `${JSON.stringify(i)}:${W(n)}`).join(",")}}`;
|
|
762
|
+
}
|
|
763
|
+
function Gt(e) {
|
|
764
|
+
return W(ye(e));
|
|
765
|
+
}
|
|
766
|
+
function Ue(e) {
|
|
767
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
768
|
+
return Y();
|
|
769
|
+
const t = e;
|
|
770
|
+
return {
|
|
771
|
+
checked: !!t.checked,
|
|
772
|
+
annotation: typeof t.annotation == "string" ? t.annotation : ""
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
function Xe(e) {
|
|
776
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
777
|
+
return ge();
|
|
778
|
+
const t = e;
|
|
779
|
+
return {
|
|
780
|
+
checked: !!t.checked,
|
|
781
|
+
annotation: typeof t.annotation == "string" ? t.annotation : "",
|
|
782
|
+
...Je(t)
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
function ye(e) {
|
|
786
|
+
const t = We();
|
|
787
|
+
if (!e || typeof e != "object")
|
|
788
|
+
return t;
|
|
789
|
+
if (e.var && typeof e.var == "object" && (t.var = { ...e.var }), e.quiz && typeof e.quiz == "object" && (t.quiz = { ...e.quiz }), e.step && typeof e.step == "object")
|
|
790
|
+
for (const [i, n] of Object.entries(e.step))
|
|
791
|
+
t.step[i] = Xe(n);
|
|
792
|
+
if (e.check && typeof e.check == "object")
|
|
793
|
+
for (const [i, n] of Object.entries(e.check))
|
|
794
|
+
t.check[i] = Ue(n);
|
|
795
|
+
return t;
|
|
796
|
+
}
|
|
797
|
+
function v(e, t) {
|
|
798
|
+
for (const i of Object.keys(e))
|
|
799
|
+
delete e[i];
|
|
800
|
+
Object.assign(e, t);
|
|
801
|
+
}
|
|
802
|
+
function Ke(e, t) {
|
|
803
|
+
v(e.var, t.var), v(e.step, t.step), v(e.check, t.check), v(e.quiz, t.quiz);
|
|
804
|
+
}
|
|
805
|
+
function Wt(e, t) {
|
|
806
|
+
Ke(e, ye(t));
|
|
807
|
+
}
|
|
808
|
+
function Qe(e) {
|
|
809
|
+
return Array.isArray(e) ? e.map((t) => typeof t == "string" && t.trim() ? { name: t.trim() } : t && typeof t == "object" && typeof t.name == "string" ? { name: t.name } : null).filter((t) => t !== null) : [];
|
|
810
|
+
}
|
|
811
|
+
function Ye(e) {
|
|
812
|
+
if (!Array.isArray(e))
|
|
813
|
+
return [];
|
|
814
|
+
const t = [];
|
|
815
|
+
for (const i of e) {
|
|
816
|
+
if (typeof i == "string" && i.trim()) {
|
|
817
|
+
const n = i.trim();
|
|
818
|
+
t.push({ name: n, label: n });
|
|
819
|
+
continue;
|
|
820
|
+
}
|
|
821
|
+
if (i && typeof i == "object") {
|
|
822
|
+
const n = i;
|
|
823
|
+
typeof n.name == "string" && t.push({
|
|
824
|
+
name: n.name,
|
|
825
|
+
label: typeof n.label == "string" ? n.label : void 0
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
return t;
|
|
830
|
+
}
|
|
831
|
+
function Ze(e) {
|
|
832
|
+
return Array.isArray(e) ? e.filter((t) => !!t && typeof t == "object" && typeof t.id == "string" && typeof t.type == "string" && typeof t.stem == "string") : [];
|
|
833
|
+
}
|
|
834
|
+
function He(e) {
|
|
835
|
+
return Array.isArray(e) ? e.filter((t) => !!t && typeof t == "object" && typeof t.id == "string" && Array.isArray(t.subvars)) : [];
|
|
836
|
+
}
|
|
837
|
+
function ie(e) {
|
|
838
|
+
return (e.type === "choice" || e.type === "true_false") && Array.isArray(e.options) && e.options.some((t) => Array.isArray(t.followups) && t.followups.length > 0);
|
|
839
|
+
}
|
|
840
|
+
function L(e, t) {
|
|
841
|
+
const i = new Set(t), n = {};
|
|
842
|
+
for (const r of e.options || []) {
|
|
843
|
+
if (!i.has(r.key) || !Array.isArray(r.followups))
|
|
844
|
+
continue;
|
|
845
|
+
const o = {};
|
|
846
|
+
for (const a of r.followups)
|
|
847
|
+
a.default !== void 0 && (o[a.key] = a.default);
|
|
848
|
+
Object.keys(o).length > 0 && (n[r.key] = o);
|
|
849
|
+
}
|
|
850
|
+
return n;
|
|
851
|
+
}
|
|
852
|
+
function et(e) {
|
|
853
|
+
if (e.type === "choice") {
|
|
854
|
+
const t = new Set((e.options || []).map((r) => r.key)), i = ie(e);
|
|
855
|
+
if (e.mode === "multiple") {
|
|
856
|
+
let r = [];
|
|
857
|
+
return Array.isArray(e.default) && (r = e.default.filter((o) => typeof o == "string" && t.has(o))), i ? {
|
|
858
|
+
selected: r,
|
|
859
|
+
followups: L(e, r)
|
|
860
|
+
} : r;
|
|
861
|
+
}
|
|
862
|
+
let n = "";
|
|
863
|
+
return typeof e.default == "string" && t.has(e.default) && (n = e.default), i ? {
|
|
864
|
+
selected: n,
|
|
865
|
+
followups: L(e, n ? [n] : [])
|
|
866
|
+
} : n;
|
|
867
|
+
}
|
|
868
|
+
if (e.type === "true_false") {
|
|
869
|
+
const t = typeof e.default == "boolean" ? e.default : null;
|
|
870
|
+
return t !== null && ie(e) ? {
|
|
871
|
+
selected: t,
|
|
872
|
+
followups: L(e, [String(t)])
|
|
873
|
+
} : t;
|
|
874
|
+
}
|
|
875
|
+
if (e.type === "blank") {
|
|
876
|
+
const t = (e.blanks || []).map((n) => n.key);
|
|
877
|
+
if (e.default && typeof e.default == "object" && !Array.isArray(e.default)) {
|
|
878
|
+
const n = e.default, r = {};
|
|
879
|
+
for (const o of t) {
|
|
880
|
+
const a = n[o];
|
|
881
|
+
r[o] = typeof a == "string" ? a : "";
|
|
882
|
+
}
|
|
883
|
+
return r;
|
|
884
|
+
}
|
|
885
|
+
if (typeof e.default == "string" && t.length === 1)
|
|
886
|
+
return { [t[0]]: e.default };
|
|
887
|
+
const i = {};
|
|
888
|
+
for (const n of t)
|
|
889
|
+
i[n] = "";
|
|
890
|
+
return i;
|
|
891
|
+
}
|
|
892
|
+
if (e.type === "scale") {
|
|
893
|
+
const t = (e.items || []).map((o) => o.key), i = new Set((e.options || []).map((o) => o.key)), n = {}, r = e.default && typeof e.default == "object" && !Array.isArray(e.default) ? e.default : {};
|
|
894
|
+
for (const o of t) {
|
|
895
|
+
const a = r[o];
|
|
896
|
+
n[o] = typeof a == "string" && i.has(a) ? a : "";
|
|
897
|
+
}
|
|
898
|
+
return n;
|
|
899
|
+
}
|
|
900
|
+
return typeof e.default == "string" ? e.default : "";
|
|
901
|
+
}
|
|
902
|
+
function C(e) {
|
|
903
|
+
const t = {};
|
|
904
|
+
for (const i of e)
|
|
905
|
+
t[i] = "";
|
|
906
|
+
return t;
|
|
907
|
+
}
|
|
908
|
+
function ne(e, t) {
|
|
909
|
+
if (!Array.isArray(e))
|
|
910
|
+
return [C(t)];
|
|
911
|
+
const i = e.map((n) => {
|
|
912
|
+
if (!n || typeof n != "object" || Array.isArray(n))
|
|
913
|
+
return C(t);
|
|
914
|
+
const r = n, o = {};
|
|
915
|
+
for (const a of t) {
|
|
916
|
+
const s = r[a];
|
|
917
|
+
o[a] = typeof s == "string" ? s : `${s ?? ""}`;
|
|
918
|
+
}
|
|
919
|
+
return o;
|
|
920
|
+
});
|
|
921
|
+
return i.length === 0 && i.push(C(t)), i;
|
|
922
|
+
}
|
|
923
|
+
function re(e, t) {
|
|
924
|
+
return e.length !== 1 ? !1 : t.every((i) => e[0]?.[i] === "");
|
|
925
|
+
}
|
|
926
|
+
function qt(e) {
|
|
927
|
+
if (e === "")
|
|
928
|
+
return [];
|
|
929
|
+
const i = e.replace(/\r\n?/g, `
|
|
930
|
+
`).split(`
|
|
931
|
+
`);
|
|
932
|
+
for (; i.length > 0 && i[i.length - 1] === ""; )
|
|
933
|
+
i.pop();
|
|
934
|
+
return i.map((n) => n.split(" "));
|
|
935
|
+
}
|
|
936
|
+
function Jt(e, t, i, n, r, o) {
|
|
937
|
+
const a = [];
|
|
938
|
+
if (t.length === 0 || r.length === 0 || i < 0 || n < 0)
|
|
939
|
+
return { rowsAdded: 0, changedCells: a };
|
|
940
|
+
const s = new Set(o?.disabledColumns ?? []);
|
|
941
|
+
let c = 0;
|
|
942
|
+
for (const [l, p] of r.entries()) {
|
|
943
|
+
const d = i + l, g = p.map((m, u) => ({
|
|
944
|
+
value: m,
|
|
945
|
+
columnIndex: n + u
|
|
946
|
+
})).filter(({ columnIndex: m }) => m >= 0 && m < t.length).map(({ value: m, columnIndex: u }) => ({
|
|
947
|
+
value: m,
|
|
948
|
+
column: t[u]
|
|
949
|
+
})).filter(({ column: m }) => !s.has(m));
|
|
950
|
+
if (g.length === 0)
|
|
951
|
+
continue;
|
|
952
|
+
for (; d >= e.length; )
|
|
953
|
+
e.push(C(t)), c += 1;
|
|
954
|
+
const x = e[d];
|
|
955
|
+
for (const { column: m, value: u } of g)
|
|
956
|
+
x[m] !== u && (x[m] = u, a.push({ rowIndex: d, column: m, value: u }));
|
|
957
|
+
}
|
|
958
|
+
return { rowsAdded: c, changedCells: a };
|
|
959
|
+
}
|
|
960
|
+
function Ut(e, t) {
|
|
961
|
+
let i = !1;
|
|
962
|
+
for (const n of He(t.var_table)) {
|
|
963
|
+
const r = n.subvars.map((d) => d.id), o = n.id in e.var, a = Array.isArray(n.default) && n.default.length > 0 ? ne(n.default, r) : void 0, s = o ? e.var[n.id] : a ?? n.default, c = ne(s, r), p = !!(o && a && re(c, r) && !re(a, r)) && a ? a : c;
|
|
964
|
+
(!o || JSON.stringify(p) !== JSON.stringify(s)) && (e.var[n.id] = p, i = !0);
|
|
965
|
+
}
|
|
966
|
+
for (const n of Qe(t.step))
|
|
967
|
+
n.name in e.step || (e.step[n.name] = ge(), i = !0);
|
|
968
|
+
for (const n of Ye(t.check))
|
|
969
|
+
n.name in e.check || (e.check[n.name] = Y(), i = !0);
|
|
970
|
+
for (const n of Ze(t.quiz))
|
|
971
|
+
n.id in e.quiz || (e.quiz[n.id] = et(n), i = !0);
|
|
972
|
+
return i;
|
|
973
|
+
}
|
|
974
|
+
const z = "airalogy_dna_v1", tt = new Set("ACGTRYSWKMBDHVN".split("")), it = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
|
|
975
|
+
function oe(e, t) {
|
|
976
|
+
const i = typeof e == "string" ? e.trim() : String(e ?? ""), n = Number.parseInt(i, 10);
|
|
977
|
+
return Number.isFinite(n) && n > 0 ? n : t;
|
|
978
|
+
}
|
|
979
|
+
function ae(e) {
|
|
980
|
+
return e === !0 || e === "true" || e === 1 || e === "1";
|
|
981
|
+
}
|
|
982
|
+
function nt(e) {
|
|
983
|
+
return e === -1 || e === "-1" ? -1 : 1;
|
|
984
|
+
}
|
|
985
|
+
function q(e) {
|
|
986
|
+
return typeof e != "string" ? "" : e.toUpperCase().replace(/\s+/g, "");
|
|
987
|
+
}
|
|
988
|
+
function J(e) {
|
|
989
|
+
return typeof e != "string" ? "" : e.replace(/\s+/g, " ").trim();
|
|
990
|
+
}
|
|
991
|
+
function Xt(e) {
|
|
992
|
+
const t = /* @__PURE__ */ new Set();
|
|
993
|
+
for (const i of e.toUpperCase())
|
|
994
|
+
tt.has(i) || t.add(i);
|
|
995
|
+
return [...t];
|
|
996
|
+
}
|
|
997
|
+
function he() {
|
|
998
|
+
return {
|
|
999
|
+
start: 1,
|
|
1000
|
+
end: 1,
|
|
1001
|
+
partial_start: !1,
|
|
1002
|
+
partial_end: !1
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
function rt(e = "note") {
|
|
1006
|
+
return {
|
|
1007
|
+
key: e,
|
|
1008
|
+
value: ""
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
function ot(e = "ann_1") {
|
|
1012
|
+
return {
|
|
1013
|
+
id: e,
|
|
1014
|
+
name: "Feature",
|
|
1015
|
+
type: "misc_feature",
|
|
1016
|
+
strand: 1,
|
|
1017
|
+
color: "#2563eb",
|
|
1018
|
+
segments: [he()],
|
|
1019
|
+
qualifiers: []
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
function Kt(e) {
|
|
1023
|
+
const t = new Set(e.map((n) => n.id));
|
|
1024
|
+
let i = 1;
|
|
1025
|
+
for (; t.has(`ann_${i}`); )
|
|
1026
|
+
i += 1;
|
|
1027
|
+
return `ann_${i}`;
|
|
1028
|
+
}
|
|
1029
|
+
function se(e) {
|
|
1030
|
+
const t = he();
|
|
1031
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
1032
|
+
return t;
|
|
1033
|
+
const i = e, n = oe(i.start, t.start), r = oe(i.end, Math.max(n, t.end));
|
|
1034
|
+
return {
|
|
1035
|
+
start: n,
|
|
1036
|
+
end: r,
|
|
1037
|
+
partial_start: ae(i.partial_start),
|
|
1038
|
+
partial_end: ae(i.partial_end)
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
function at(e, t = 0) {
|
|
1042
|
+
const i = rt(t === 0 ? "note" : "qualifier");
|
|
1043
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
1044
|
+
return i;
|
|
1045
|
+
const n = e;
|
|
1046
|
+
return {
|
|
1047
|
+
key: typeof n.key == "string" && n.key.trim() ? n.key.trim() : i.key,
|
|
1048
|
+
value: typeof n.value == "string" ? n.value : String(n.value ?? "")
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
function st(e, t) {
|
|
1052
|
+
return Array.isArray(t) ? t.map((i) => ({
|
|
1053
|
+
key: e,
|
|
1054
|
+
value: typeof i == "string" ? i : String(i ?? "")
|
|
1055
|
+
})) : [{
|
|
1056
|
+
key: e,
|
|
1057
|
+
value: typeof t == "string" ? t : String(t ?? "")
|
|
1058
|
+
}];
|
|
1059
|
+
}
|
|
1060
|
+
function lt(e, t) {
|
|
1061
|
+
const i = [];
|
|
1062
|
+
if (Array.isArray(e))
|
|
1063
|
+
i.push(...e.map((n, r) => at(n, r)));
|
|
1064
|
+
else if (e && typeof e == "object")
|
|
1065
|
+
for (const [n, r] of Object.entries(e)) {
|
|
1066
|
+
const o = n.trim();
|
|
1067
|
+
o && i.push(...st(o, r));
|
|
1068
|
+
}
|
|
1069
|
+
return t != null && String(t).trim() && i.push({
|
|
1070
|
+
key: "note",
|
|
1071
|
+
value: typeof t == "string" ? t : String(t)
|
|
1072
|
+
}), i;
|
|
1073
|
+
}
|
|
1074
|
+
function ct(e, t = 0) {
|
|
1075
|
+
const i = ot(`ann_${t + 1}`);
|
|
1076
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
1077
|
+
return i;
|
|
1078
|
+
const n = e, r = Array.isArray(n.segments) && n.segments.length > 0 ? n.segments.map((o) => se(o)) : "start" in n || "end" in n ? [se({
|
|
1079
|
+
start: n.start,
|
|
1080
|
+
end: n.end,
|
|
1081
|
+
partial_start: n.partial_start,
|
|
1082
|
+
partial_end: n.partial_end
|
|
1083
|
+
})] : i.segments;
|
|
1084
|
+
return {
|
|
1085
|
+
id: typeof n.id == "string" && n.id.trim() ? n.id.trim() : i.id,
|
|
1086
|
+
name: typeof n.name == "string" && n.name.trim() ? n.name.trim() : i.name,
|
|
1087
|
+
type: typeof n.type == "string" && n.type.trim() ? n.type.trim() : i.type,
|
|
1088
|
+
strand: nt(n.strand),
|
|
1089
|
+
color: typeof n.color == "string" && n.color.trim() ? n.color.trim() : i.color,
|
|
1090
|
+
segments: r,
|
|
1091
|
+
qualifiers: lt(n.qualifiers, n.note)
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
function Qt(e) {
|
|
1095
|
+
if (typeof e == "string")
|
|
1096
|
+
return {
|
|
1097
|
+
format: z,
|
|
1098
|
+
name: "",
|
|
1099
|
+
sequence: q(e),
|
|
1100
|
+
topology: "linear",
|
|
1101
|
+
annotations: []
|
|
1102
|
+
};
|
|
1103
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
1104
|
+
return {
|
|
1105
|
+
format: z,
|
|
1106
|
+
name: "",
|
|
1107
|
+
sequence: "",
|
|
1108
|
+
topology: "linear",
|
|
1109
|
+
annotations: []
|
|
1110
|
+
};
|
|
1111
|
+
const t = e;
|
|
1112
|
+
return {
|
|
1113
|
+
format: z,
|
|
1114
|
+
name: J(t.name),
|
|
1115
|
+
sequence: q(t.sequence),
|
|
1116
|
+
topology: t.topology === "circular" ? "circular" : "linear",
|
|
1117
|
+
annotations: Array.isArray(t.annotations) ? t.annotations.map((i, n) => ct(i, n)) : []
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
function Yt(e) {
|
|
1121
|
+
let t = 0, i = 0;
|
|
1122
|
+
for (const n of e.toUpperCase())
|
|
1123
|
+
(n === "A" || n === "T" || n === "C" || n === "G") && (t += 1, (n === "C" || n === "G") && (i += 1));
|
|
1124
|
+
return t === 0 ? null : i / t * 100;
|
|
1125
|
+
}
|
|
1126
|
+
function Zt(e, t) {
|
|
1127
|
+
return e.end < e.start ? "range" : t <= 0 ? "requires_sequence" : e.end > t ? "out_of_bounds" : null;
|
|
1128
|
+
}
|
|
1129
|
+
function dt(e) {
|
|
1130
|
+
return e.trim().replace(/\s+/g, "_").replace(/[^A-Za-z0-9_.-]/g, "_") || "DNA_SEQUENCE";
|
|
1131
|
+
}
|
|
1132
|
+
function ft(e = /* @__PURE__ */ new Date()) {
|
|
1133
|
+
const t = String(e.getDate()).padStart(2, "0"), i = it[e.getMonth()] ?? "JAN", n = String(e.getFullYear());
|
|
1134
|
+
return `${t}-${i}-${n}`;
|
|
1135
|
+
}
|
|
1136
|
+
function _e(e, t, i = e, n = 79) {
|
|
1137
|
+
const r = t.replace(/\s+/g, " ").trim();
|
|
1138
|
+
if (!r)
|
|
1139
|
+
return [e.trimEnd()];
|
|
1140
|
+
const o = [];
|
|
1141
|
+
let a = r, s = e;
|
|
1142
|
+
for (; a.length > 0; ) {
|
|
1143
|
+
const c = Math.max(n - s.length, 12);
|
|
1144
|
+
if (a.length <= c) {
|
|
1145
|
+
o.push(`${s}${a}`);
|
|
1146
|
+
break;
|
|
1147
|
+
}
|
|
1148
|
+
let l = a.lastIndexOf(" ", c);
|
|
1149
|
+
l <= 0 && (l = c), o.push(`${s}${a.slice(0, l)}`), a = a.slice(l).trimStart(), s = i;
|
|
1150
|
+
}
|
|
1151
|
+
return o;
|
|
1152
|
+
}
|
|
1153
|
+
function ut(e) {
|
|
1154
|
+
const t = `${e.partial_start ? "<" : ""}${e.start}`, i = `${e.partial_end ? ">" : ""}${e.end}`;
|
|
1155
|
+
return `${t}..${i}`;
|
|
1156
|
+
}
|
|
1157
|
+
function pt(e) {
|
|
1158
|
+
const t = e.segments.map(ut).join(","), i = e.segments.length > 1 ? `join(${t})` : t;
|
|
1159
|
+
return e.strand === -1 ? `complement(${i})` : i;
|
|
1160
|
+
}
|
|
1161
|
+
function mt(e, t) {
|
|
1162
|
+
const i = e.trim() || "note", n = t.replace(/"/g, "'").trim();
|
|
1163
|
+
return n ? _e(
|
|
1164
|
+
" ",
|
|
1165
|
+
`/${i}="${n}"`,
|
|
1166
|
+
" "
|
|
1167
|
+
) : [` /${i}`];
|
|
1168
|
+
}
|
|
1169
|
+
function gt(e) {
|
|
1170
|
+
const t = [...e.qualifiers];
|
|
1171
|
+
return !t.some((n) => n.key.trim().toLowerCase() === "label") && e.name.trim() && t.unshift({
|
|
1172
|
+
key: "label",
|
|
1173
|
+
value: e.name.trim()
|
|
1174
|
+
}), t;
|
|
1175
|
+
}
|
|
1176
|
+
function Ht(e, t) {
|
|
1177
|
+
const i = q(e.sequence), n = J(e.name) || J(t?.name) || "DNA_SEQUENCE", r = dt(n), o = r.slice(0, 16) || "DNA_SEQUENCE", a = e.topology === "circular" ? "circular" : "linear", s = t?.definition?.trim() || n || `${r} exported from Airalogy AIMD recorder.`, l = [
|
|
1178
|
+
[
|
|
1179
|
+
"LOCUS".padEnd(12, " "),
|
|
1180
|
+
o.padEnd(16, " "),
|
|
1181
|
+
String(i.length).padStart(11, " "),
|
|
1182
|
+
"bp".padEnd(6, " "),
|
|
1183
|
+
"DNA".padEnd(8, " "),
|
|
1184
|
+
a.padEnd(9, " "),
|
|
1185
|
+
ft(t?.date)
|
|
1186
|
+
].join(""),
|
|
1187
|
+
..._e("DEFINITION ", s, " "),
|
|
1188
|
+
`ACCESSION ${o}`,
|
|
1189
|
+
`VERSION ${o}.1`,
|
|
1190
|
+
"KEYWORDS .",
|
|
1191
|
+
"SOURCE synthetic construct",
|
|
1192
|
+
" ORGANISM synthetic construct",
|
|
1193
|
+
" other sequences; artificial sequences.",
|
|
1194
|
+
"FEATURES Location/Qualifiers"
|
|
1195
|
+
];
|
|
1196
|
+
for (const p of e.annotations) {
|
|
1197
|
+
l.push(` ${(p.type.trim() || "misc_feature").slice(0, 16).padEnd(16, " ")}${pt(p)}`);
|
|
1198
|
+
for (const d of gt(p))
|
|
1199
|
+
l.push(...mt(d.key, d.value));
|
|
1200
|
+
}
|
|
1201
|
+
l.push("ORIGIN");
|
|
1202
|
+
for (let p = 0; p < i.length; p += 60) {
|
|
1203
|
+
const d = i.slice(p, p + 60).toLowerCase(), g = d.match(/.{1,10}/g)?.join(" ") ?? d;
|
|
1204
|
+
l.push(`${String(p + 1).padStart(9, " ")} ${g}`);
|
|
1205
|
+
}
|
|
1206
|
+
return l.push("//"), `${l.join(`
|
|
1207
|
+
`)}
|
|
1208
|
+
`;
|
|
1209
|
+
}
|
|
1210
|
+
export {
|
|
1211
|
+
qt as $,
|
|
1212
|
+
z as A,
|
|
1213
|
+
at as B,
|
|
1214
|
+
se as C,
|
|
1215
|
+
q as D,
|
|
1216
|
+
Qt as E,
|
|
1217
|
+
ye as F,
|
|
1218
|
+
Ze as G,
|
|
1219
|
+
Qe as H,
|
|
1220
|
+
Xe as I,
|
|
1221
|
+
Je as J,
|
|
1222
|
+
He as K,
|
|
1223
|
+
ne as L,
|
|
1224
|
+
qe as M,
|
|
1225
|
+
v as N,
|
|
1226
|
+
Ct as O,
|
|
1227
|
+
Ot as P,
|
|
1228
|
+
Ht as Q,
|
|
1229
|
+
Mt as R,
|
|
1230
|
+
vt as S,
|
|
1231
|
+
We as T,
|
|
1232
|
+
ht as U,
|
|
1233
|
+
bt as V,
|
|
1234
|
+
Ne as W,
|
|
1235
|
+
At as X,
|
|
1236
|
+
yt as Y,
|
|
1237
|
+
_t as Z,
|
|
1238
|
+
Gt as _,
|
|
1239
|
+
Wt as a,
|
|
1240
|
+
Jt as a0,
|
|
1241
|
+
U as a1,
|
|
1242
|
+
It as a2,
|
|
1243
|
+
Le as a3,
|
|
1244
|
+
xt as a4,
|
|
1245
|
+
St as a5,
|
|
1246
|
+
K as a6,
|
|
1247
|
+
wt as a7,
|
|
1248
|
+
G as a8,
|
|
1249
|
+
ze as a9,
|
|
1250
|
+
k as aA,
|
|
1251
|
+
b as aB,
|
|
1252
|
+
y as aC,
|
|
1253
|
+
kt as aD,
|
|
1254
|
+
T as aE,
|
|
1255
|
+
Oe as aF,
|
|
1256
|
+
Be as aG,
|
|
1257
|
+
J as aa,
|
|
1258
|
+
je as ab,
|
|
1259
|
+
Ce as ac,
|
|
1260
|
+
$ as ad,
|
|
1261
|
+
Me as ae,
|
|
1262
|
+
fe as af,
|
|
1263
|
+
ce as ag,
|
|
1264
|
+
Pe as ah,
|
|
1265
|
+
de as ai,
|
|
1266
|
+
ve as aj,
|
|
1267
|
+
ee as ak,
|
|
1268
|
+
Dt as al,
|
|
1269
|
+
Q as am,
|
|
1270
|
+
ue as an,
|
|
1271
|
+
H as ao,
|
|
1272
|
+
pe as ap,
|
|
1273
|
+
D as aq,
|
|
1274
|
+
Re as ar,
|
|
1275
|
+
$e as as,
|
|
1276
|
+
X as at,
|
|
1277
|
+
Et as au,
|
|
1278
|
+
Nt as av,
|
|
1279
|
+
Tt as aw,
|
|
1280
|
+
jt as ax,
|
|
1281
|
+
Ve as ay,
|
|
1282
|
+
Ft as az,
|
|
1283
|
+
Ke as b,
|
|
1284
|
+
Yt as c,
|
|
1285
|
+
Vt as d,
|
|
1286
|
+
Xt as e,
|
|
1287
|
+
Y as f,
|
|
1288
|
+
ot as g,
|
|
1289
|
+
rt as h,
|
|
1290
|
+
he as i,
|
|
1291
|
+
ge as j,
|
|
1292
|
+
C as k,
|
|
1293
|
+
Ut as l,
|
|
1294
|
+
Pt as m,
|
|
1295
|
+
Zt as n,
|
|
1296
|
+
Kt as o,
|
|
1297
|
+
$t as p,
|
|
1298
|
+
Lt as q,
|
|
1299
|
+
et as r,
|
|
1300
|
+
O as s,
|
|
1301
|
+
Bt as t,
|
|
1302
|
+
zt as u,
|
|
1303
|
+
P as v,
|
|
1304
|
+
Rt as w,
|
|
1305
|
+
Ye as x,
|
|
1306
|
+
Ue as y,
|
|
1307
|
+
ct as z
|
|
1308
|
+
};
|