@ours.network/messenger-server 1.0.17 → 1.0.19
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 +44 -0
- package/dist/chunks/{chunk-G4FWV6DH.js → chunk-RNAB5CTB.js} +1 -1
- package/dist/chunks/{server-WRVY3ISV.js → server-FIDF7B55.js} +1493 -1139
- package/dist/cli.js +4 -3
- package/dist/web/assets/{abnfDiagram-N423BO3Z-D41fZ6wT.js → abnfDiagram-N423BO3Z-CT1KlrA8.js} +2 -2
- package/dist/web/assets/{abnfDiagram-N423BO3Z-D41fZ6wT.js.map → abnfDiagram-N423BO3Z-CT1KlrA8.js.map} +1 -1
- package/dist/web/assets/{arc-VbOEI3CC.js → arc-BijFekVi.js} +2 -2
- package/dist/web/assets/{arc-VbOEI3CC.js.map → arc-BijFekVi.js.map} +1 -1
- package/dist/web/assets/{architectureDiagram-T3A2C74G-BSHqjM5b.js → architectureDiagram-T3A2C74G-B0XUBGm4.js} +2 -2
- package/dist/web/assets/{architectureDiagram-T3A2C74G-BSHqjM5b.js.map → architectureDiagram-T3A2C74G-B0XUBGm4.js.map} +1 -1
- package/dist/web/assets/{blockDiagram-VBNYF7ZC-COK3pEAY.js → blockDiagram-VBNYF7ZC-CBss8R5v.js} +2 -2
- package/dist/web/assets/{blockDiagram-VBNYF7ZC-COK3pEAY.js.map → blockDiagram-VBNYF7ZC-CBss8R5v.js.map} +1 -1
- package/dist/web/assets/{browser-01l1cxqf.js → browser-Dx2A6RNU.js} +2 -2
- package/dist/web/assets/{browser-01l1cxqf.js.map → browser-Dx2A6RNU.js.map} +1 -1
- package/dist/web/assets/{c4Diagram-5PPSVZJV-CmXSm895.js → c4Diagram-5PPSVZJV-DutF7OxT.js} +2 -2
- package/dist/web/assets/{c4Diagram-5PPSVZJV-CmXSm895.js.map → c4Diagram-5PPSVZJV-DutF7OxT.js.map} +1 -1
- package/dist/web/assets/channel-COL3ITTM.js +2 -0
- package/dist/web/assets/{channel-xRuruGYf.js.map → channel-COL3ITTM.js.map} +1 -1
- package/dist/web/assets/{chunk-2GRJ4B5K-BzaUjdCL.js → chunk-2GRJ4B5K-BY_VWEnl.js} +2 -2
- package/dist/web/assets/{chunk-2GRJ4B5K-BzaUjdCL.js.map → chunk-2GRJ4B5K-BY_VWEnl.js.map} +1 -1
- package/dist/web/assets/{chunk-2Q5K7J3B-DliEZ6Fq.js → chunk-2Q5K7J3B-BT9-P1v2.js} +2 -2
- package/dist/web/assets/{chunk-2Q5K7J3B-DliEZ6Fq.js.map → chunk-2Q5K7J3B-BT9-P1v2.js.map} +1 -1
- package/dist/web/assets/{chunk-5RXB4S5H-D8sdhNbb.js → chunk-5RXB4S5H-CN9BMz8P.js} +2 -2
- package/dist/web/assets/{chunk-5RXB4S5H-D8sdhNbb.js.map → chunk-5RXB4S5H-CN9BMz8P.js.map} +1 -1
- package/dist/web/assets/{chunk-5VM5RSS4-CeJ08JWS.js → chunk-5VM5RSS4-DYuJx33g.js} +2 -2
- package/dist/web/assets/{chunk-5VM5RSS4-CeJ08JWS.js.map → chunk-5VM5RSS4-DYuJx33g.js.map} +1 -1
- package/dist/web/assets/{chunk-6Q2QTUOP-D_LsakJp.js → chunk-6Q2QTUOP-CLmhGTzm.js} +2 -2
- package/dist/web/assets/{chunk-6Q2QTUOP-D_LsakJp.js.map → chunk-6Q2QTUOP-CLmhGTzm.js.map} +1 -1
- package/dist/web/assets/{chunk-GF5L2VYU-DTVMhaqa.js → chunk-GF5L2VYU-BdIrlIgJ.js} +2 -2
- package/dist/web/assets/{chunk-GF5L2VYU-DTVMhaqa.js.map → chunk-GF5L2VYU-BdIrlIgJ.js.map} +1 -1
- package/dist/web/assets/{chunk-JWPE2WC7-C4A2Xh-G.js → chunk-JWPE2WC7-CVeHxbeO.js} +2 -2
- package/dist/web/assets/{chunk-JWPE2WC7-C4A2Xh-G.js.map → chunk-JWPE2WC7-CVeHxbeO.js.map} +1 -1
- package/dist/web/assets/{chunk-KBJHAD2P-CqqrZk6S.js → chunk-KBJHAD2P-Ch0ni_wK.js} +2 -2
- package/dist/web/assets/{chunk-KBJHAD2P-CqqrZk6S.js.map → chunk-KBJHAD2P-Ch0ni_wK.js.map} +1 -1
- package/dist/web/assets/{chunk-RYQCIY6F-B_KP_g_N.js → chunk-RYQCIY6F-CNfkqew0.js} +2 -2
- package/dist/web/assets/{chunk-RYQCIY6F-B_KP_g_N.js.map → chunk-RYQCIY6F-CNfkqew0.js.map} +1 -1
- package/dist/web/assets/{chunk-XXDRQBXY-BJ08Wpj1.js → chunk-XXDRQBXY-BACqkr8E.js} +2 -2
- package/dist/web/assets/{chunk-XXDRQBXY-BJ08Wpj1.js.map → chunk-XXDRQBXY-BACqkr8E.js.map} +1 -1
- package/dist/web/assets/classDiagram-JCYQIIEL-CvRiGYPi.js +2 -0
- package/dist/web/assets/{classDiagram-JCYQIIEL-B_V02saB.js.map → classDiagram-JCYQIIEL-CvRiGYPi.js.map} +1 -1
- package/dist/web/assets/classDiagram-v2-OCEON4UE-CvRiGYPi.js +2 -0
- package/dist/web/assets/{classDiagram-v2-OCEON4UE-B_V02saB.js.map → classDiagram-v2-OCEON4UE-CvRiGYPi.js.map} +1 -1
- package/dist/web/assets/{cose-bilkent-JH36ORCC-2sWJNMtt.js → cose-bilkent-JH36ORCC-b09W1_De.js} +2 -2
- package/dist/web/assets/{cose-bilkent-JH36ORCC-2sWJNMtt.js.map → cose-bilkent-JH36ORCC-b09W1_De.js.map} +1 -1
- package/dist/web/assets/{cynefin-VYW2F7L2-CzivNvjA.js → cynefin-VYW2F7L2-BlWedxog.js} +2 -2
- package/dist/web/assets/{cynefin-VYW2F7L2-CzivNvjA.js.map → cynefin-VYW2F7L2-BlWedxog.js.map} +1 -1
- package/dist/web/assets/{cynefinDiagram-MW4NZA55-Bxhm4IpO.js → cynefinDiagram-MW4NZA55-DxFQN09p.js} +2 -2
- package/dist/web/assets/{cynefinDiagram-MW4NZA55-Bxhm4IpO.js.map → cynefinDiagram-MW4NZA55-DxFQN09p.js.map} +1 -1
- package/dist/web/assets/{dagre-VZM6K2ZE-CLEhWdqM.js → dagre-VZM6K2ZE-BTlF6GSE.js} +2 -2
- package/dist/web/assets/{dagre-VZM6K2ZE-CLEhWdqM.js.map → dagre-VZM6K2ZE-BTlF6GSE.js.map} +1 -1
- package/dist/web/assets/{diagram-7IWD3JNH-Br9vndL1.js → diagram-7IWD3JNH-BzUtx4z4.js} +2 -2
- package/dist/web/assets/{diagram-7IWD3JNH-Br9vndL1.js.map → diagram-7IWD3JNH-BzUtx4z4.js.map} +1 -1
- package/dist/web/assets/{diagram-B4RE2ZJO-D-QpOT6c.js → diagram-B4RE2ZJO-DBJj2QQf.js} +2 -2
- package/dist/web/assets/{diagram-B4RE2ZJO-D-QpOT6c.js.map → diagram-B4RE2ZJO-DBJj2QQf.js.map} +1 -1
- package/dist/web/assets/{diagram-LBJQPF4R-Br005TYH.js → diagram-LBJQPF4R-BsZ5eUYu.js} +2 -2
- package/dist/web/assets/{diagram-LBJQPF4R-Br005TYH.js.map → diagram-LBJQPF4R-BsZ5eUYu.js.map} +1 -1
- package/dist/web/assets/{diagram-Q27KOJAE-Bl1rQPa9.js → diagram-Q27KOJAE-CZfHkWp2.js} +2 -2
- package/dist/web/assets/{diagram-Q27KOJAE-Bl1rQPa9.js.map → diagram-Q27KOJAE-CZfHkWp2.js.map} +1 -1
- package/dist/web/assets/{diagram-UB23O5K3-Dufn6-1e.js → diagram-UB23O5K3-C_pTB03W.js} +2 -2
- package/dist/web/assets/{diagram-UB23O5K3-Dufn6-1e.js.map → diagram-UB23O5K3-C_pTB03W.js.map} +1 -1
- package/dist/web/assets/{ebnfDiagram-BXEA7PRR-Bjjlp_7Y.js → ebnfDiagram-BXEA7PRR-CEPlrCkd.js} +2 -2
- package/dist/web/assets/{ebnfDiagram-BXEA7PRR-Bjjlp_7Y.js.map → ebnfDiagram-BXEA7PRR-CEPlrCkd.js.map} +1 -1
- package/dist/web/assets/{erDiagram-JOGREHBK-N3Ze9nMa.js → erDiagram-JOGREHBK-B9n_oRbh.js} +2 -2
- package/dist/web/assets/{erDiagram-JOGREHBK-N3Ze9nMa.js.map → erDiagram-JOGREHBK-B9n_oRbh.js.map} +1 -1
- package/dist/web/assets/{flowDiagram-UKHOOZJN-CnMV_nD5.js → flowDiagram-UKHOOZJN-h2fmVJsi.js} +2 -2
- package/dist/web/assets/{flowDiagram-UKHOOZJN-CnMV_nD5.js.map → flowDiagram-UKHOOZJN-h2fmVJsi.js.map} +1 -1
- package/dist/web/assets/{ganttDiagram-PKOTCBZU-CwIgkZ1H.js → ganttDiagram-PKOTCBZU-BE9rYUjL.js} +2 -2
- package/dist/web/assets/{ganttDiagram-PKOTCBZU-CwIgkZ1H.js.map → ganttDiagram-PKOTCBZU-BE9rYUjL.js.map} +1 -1
- package/dist/web/assets/{gitGraphDiagram-DS77QQ5N-BnLqDFhd.js → gitGraphDiagram-DS77QQ5N-DOmiKs-f.js} +2 -2
- package/dist/web/assets/{gitGraphDiagram-DS77QQ5N-BnLqDFhd.js.map → gitGraphDiagram-DS77QQ5N-DOmiKs-f.js.map} +1 -1
- package/dist/web/assets/index-B8q4dcom.js +321 -0
- package/dist/web/assets/index-B8q4dcom.js.map +1 -0
- package/dist/web/assets/index-x_ixrgA8.css +1 -0
- package/dist/web/assets/{infoDiagram-6WML65LV-jg-Y_vlG.js → infoDiagram-6WML65LV-DSkiq6m6.js} +2 -2
- package/dist/web/assets/{infoDiagram-6WML65LV-jg-Y_vlG.js.map → infoDiagram-6WML65LV-DSkiq6m6.js.map} +1 -1
- package/dist/web/assets/{ishikawaDiagram-WSZJBQD7-CYtfMYF9.js → ishikawaDiagram-WSZJBQD7-0hAs4ZI2.js} +2 -2
- package/dist/web/assets/{ishikawaDiagram-WSZJBQD7-CYtfMYF9.js.map → ishikawaDiagram-WSZJBQD7-0hAs4ZI2.js.map} +1 -1
- package/dist/web/assets/{journeyDiagram-NVQOT4AX-D_fr5q2a.js → journeyDiagram-NVQOT4AX-D6J6iPLd.js} +2 -2
- package/dist/web/assets/{journeyDiagram-NVQOT4AX-D_fr5q2a.js.map → journeyDiagram-NVQOT4AX-D6J6iPLd.js.map} +1 -1
- package/dist/web/assets/{jsQR-BfZmyYuo.js → jsQR-BF9etrBF.js} +2 -2
- package/dist/web/assets/{jsQR-BfZmyYuo.js.map → jsQR-BF9etrBF.js.map} +1 -1
- package/dist/web/assets/{kanban-definition-27J2QSJJ-B103VCbf.js → kanban-definition-27J2QSJJ-CWLeQv2I.js} +2 -2
- package/dist/web/assets/{kanban-definition-27J2QSJJ-B103VCbf.js.map → kanban-definition-27J2QSJJ-CWLeQv2I.js.map} +1 -1
- package/dist/web/assets/{linear-D0FcyqKv.js → linear-CcPR3dFT.js} +2 -2
- package/dist/web/assets/{linear-D0FcyqKv.js.map → linear-CcPR3dFT.js.map} +1 -1
- package/dist/web/assets/{mermaid.core-Dol0YxtF.js → mermaid.core-Cgd7HrQ-.js} +5 -5
- package/dist/web/assets/{mermaid.core-Dol0YxtF.js.map → mermaid.core-Cgd7HrQ-.js.map} +1 -1
- package/dist/web/assets/{mindmap-definition-FAOFIHXS-DLwa02VP.js → mindmap-definition-FAOFIHXS-Df0LAbV3.js} +2 -2
- package/dist/web/assets/{mindmap-definition-FAOFIHXS-DLwa02VP.js.map → mindmap-definition-FAOFIHXS-Df0LAbV3.js.map} +1 -1
- package/dist/web/assets/{pegDiagram-VL7TDLO6-B6ES3Nvu.js → pegDiagram-VL7TDLO6-BRjBqrSR.js} +2 -2
- package/dist/web/assets/{pegDiagram-VL7TDLO6-B6ES3Nvu.js.map → pegDiagram-VL7TDLO6-BRjBqrSR.js.map} +1 -1
- package/dist/web/assets/{pieDiagram-7S7Q4E2Y-DakZxCba.js → pieDiagram-7S7Q4E2Y-BnIoJEMm.js} +2 -2
- package/dist/web/assets/{pieDiagram-7S7Q4E2Y-DakZxCba.js.map → pieDiagram-7S7Q4E2Y-BnIoJEMm.js.map} +1 -1
- package/dist/web/assets/{quadrantDiagram-CIZ2JOQS-DWCBM26R.js → quadrantDiagram-CIZ2JOQS-Bn6UIbaT.js} +2 -2
- package/dist/web/assets/{quadrantDiagram-CIZ2JOQS-DWCBM26R.js.map → quadrantDiagram-CIZ2JOQS-Bn6UIbaT.js.map} +1 -1
- package/dist/web/assets/{railroadDiagram-AXF67PYL-DtwLSafl.js → railroadDiagram-AXF67PYL-DYXAEZew.js} +2 -2
- package/dist/web/assets/{railroadDiagram-AXF67PYL-DtwLSafl.js.map → railroadDiagram-AXF67PYL-DYXAEZew.js.map} +1 -1
- package/dist/web/assets/{requirementDiagram-LRYGKXZP-D1RVPYZR.js → requirementDiagram-LRYGKXZP-BIew6qwe.js} +2 -2
- package/dist/web/assets/{requirementDiagram-LRYGKXZP-D1RVPYZR.js.map → requirementDiagram-LRYGKXZP-BIew6qwe.js.map} +1 -1
- package/dist/web/assets/{sankeyDiagram-W5VNT64P-L7MWVXPS.js → sankeyDiagram-W5VNT64P-mVWhoIM_.js} +2 -2
- package/dist/web/assets/{sankeyDiagram-W5VNT64P-L7MWVXPS.js.map → sankeyDiagram-W5VNT64P-mVWhoIM_.js.map} +1 -1
- package/dist/web/assets/{sequenceDiagram-SI44F4Z6-dyCGQGHa.js → sequenceDiagram-SI44F4Z6-BhzFAkP7.js} +2 -2
- package/dist/web/assets/{sequenceDiagram-SI44F4Z6-dyCGQGHa.js.map → sequenceDiagram-SI44F4Z6-BhzFAkP7.js.map} +1 -1
- package/dist/web/assets/{sizeCapture-X5ZJPWSS-CDtReBKu.js → sizeCapture-X5ZJPWSS-CxiwFpXR.js} +2 -2
- package/dist/web/assets/{sizeCapture-X5ZJPWSS-CDtReBKu.js.map → sizeCapture-X5ZJPWSS-CxiwFpXR.js.map} +1 -1
- package/dist/web/assets/{stateDiagram-OKZ733FA-CP2LHI_V.js → stateDiagram-OKZ733FA-BD3vEv2W.js} +2 -2
- package/dist/web/assets/{stateDiagram-OKZ733FA-CP2LHI_V.js.map → stateDiagram-OKZ733FA-BD3vEv2W.js.map} +1 -1
- package/dist/web/assets/stateDiagram-v2-UEYNNEHI-DCCDLATj.js +2 -0
- package/dist/web/assets/{stateDiagram-v2-UEYNNEHI-FgCaTLoU.js.map → stateDiagram-v2-UEYNNEHI-DCCDLATj.js.map} +1 -1
- package/dist/web/assets/{swimlanes-SLNWSIFB-CV19FTtp.js → swimlanes-SLNWSIFB-C-C3oevY.js} +3 -3
- package/dist/web/assets/{swimlanes-SLNWSIFB-CV19FTtp.js.map → swimlanes-SLNWSIFB-C-C3oevY.js.map} +1 -1
- package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-Blyj4jMa.js +9 -0
- package/dist/web/assets/{swimlanesDiagram-ULZ7WXOC-DuRBG4kU.js.map → swimlanesDiagram-ULZ7WXOC-Blyj4jMa.js.map} +1 -1
- package/dist/web/assets/{timeline-definition-Z64GVDOM-B-pP2Q9Q.js → timeline-definition-Z64GVDOM-aSal9T7F.js} +2 -2
- package/dist/web/assets/{timeline-definition-Z64GVDOM-B-pP2Q9Q.js.map → timeline-definition-Z64GVDOM-aSal9T7F.js.map} +1 -1
- package/dist/web/assets/{vennDiagram-T6HMQDX7-CuYJ1iDW.js → vennDiagram-T6HMQDX7-5IuSjaAF.js} +2 -2
- package/dist/web/assets/{vennDiagram-T6HMQDX7-CuYJ1iDW.js.map → vennDiagram-T6HMQDX7-5IuSjaAF.js.map} +1 -1
- package/dist/web/assets/{wardleyDiagram-T6FBY63Y-CECFK9Yx.js → wardleyDiagram-T6FBY63Y-p3SggVDG.js} +2 -2
- package/dist/web/assets/{wardleyDiagram-T6FBY63Y-CECFK9Yx.js.map → wardleyDiagram-T6FBY63Y-p3SggVDG.js.map} +1 -1
- package/dist/web/assets/{xychartDiagram-ELKLHX3M-DWOty9V_.js → xychartDiagram-ELKLHX3M-B8d9G_0y.js} +2 -2
- package/dist/web/assets/{xychartDiagram-ELKLHX3M-DWOty9V_.js.map → xychartDiagram-ELKLHX3M-B8d9G_0y.js.map} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/dist/web/version.json +1 -1
- package/package.json +7 -7
- package/dist/web/assets/channel-xRuruGYf.js +0 -2
- package/dist/web/assets/classDiagram-JCYQIIEL-B_V02saB.js +0 -2
- package/dist/web/assets/classDiagram-v2-OCEON4UE-B_V02saB.js +0 -2
- package/dist/web/assets/index-D43xzU0f.css +0 -1
- package/dist/web/assets/index-D9hS6wFf.js +0 -321
- package/dist/web/assets/index-D9hS6wFf.js.map +0 -1
- package/dist/web/assets/stateDiagram-v2-UEYNNEHI-FgCaTLoU.js +0 -2
- package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-DuRBG4kU.js +0 -9
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
publicEngineError,
|
|
8
8
|
publicInternalError,
|
|
9
9
|
reportFailure
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RNAB5CTB.js";
|
|
11
11
|
|
|
12
12
|
// node_modules/bn.js/lib/bn.js
|
|
13
13
|
var require_bn = __commonJS({
|
|
@@ -503,22 +503,22 @@ var require_bn = __commonJS({
|
|
|
503
503
|
this.strip();
|
|
504
504
|
var littleEndian = endian === "le";
|
|
505
505
|
var res = new ArrayType(reqLength);
|
|
506
|
-
var
|
|
506
|
+
var b3, i2;
|
|
507
507
|
var q = this.clone();
|
|
508
508
|
if (!littleEndian) {
|
|
509
509
|
for (i2 = 0; i2 < reqLength - byteLength; i2++) {
|
|
510
510
|
res[i2] = 0;
|
|
511
511
|
}
|
|
512
512
|
for (i2 = 0; !q.isZero(); i2++) {
|
|
513
|
-
|
|
513
|
+
b3 = q.andln(255);
|
|
514
514
|
q.iushrn(8);
|
|
515
|
-
res[reqLength - i2 - 1] =
|
|
515
|
+
res[reqLength - i2 - 1] = b3;
|
|
516
516
|
}
|
|
517
517
|
} else {
|
|
518
518
|
for (i2 = 0; !q.isZero(); i2++) {
|
|
519
|
-
|
|
519
|
+
b3 = q.andln(255);
|
|
520
520
|
q.iushrn(8);
|
|
521
|
-
res[i2] =
|
|
521
|
+
res[i2] = b3;
|
|
522
522
|
}
|
|
523
523
|
for (; i2 < reqLength; i2++) {
|
|
524
524
|
res[i2] = 0;
|
|
@@ -596,9 +596,9 @@ var require_bn = __commonJS({
|
|
|
596
596
|
if (this.isZero()) return 0;
|
|
597
597
|
var r2 = 0;
|
|
598
598
|
for (var i2 = 0; i2 < this.length; i2++) {
|
|
599
|
-
var
|
|
600
|
-
r2 +=
|
|
601
|
-
if (
|
|
599
|
+
var b3 = this._zeroBits(this.words[i2]);
|
|
600
|
+
r2 += b3;
|
|
601
|
+
if (b3 !== 26) break;
|
|
602
602
|
}
|
|
603
603
|
return r2;
|
|
604
604
|
};
|
|
@@ -651,16 +651,16 @@ var require_bn = __commonJS({
|
|
|
651
651
|
return num.clone().iuor(this);
|
|
652
652
|
};
|
|
653
653
|
BN.prototype.iuand = function iuand(num) {
|
|
654
|
-
var
|
|
654
|
+
var b3;
|
|
655
655
|
if (this.length > num.length) {
|
|
656
|
-
|
|
656
|
+
b3 = num;
|
|
657
657
|
} else {
|
|
658
|
-
|
|
658
|
+
b3 = this;
|
|
659
659
|
}
|
|
660
|
-
for (var i2 = 0; i2 <
|
|
660
|
+
for (var i2 = 0; i2 < b3.length; i2++) {
|
|
661
661
|
this.words[i2] = this.words[i2] & num.words[i2];
|
|
662
662
|
}
|
|
663
|
-
this.length =
|
|
663
|
+
this.length = b3.length;
|
|
664
664
|
return this.strip();
|
|
665
665
|
};
|
|
666
666
|
BN.prototype.iand = function iand(num) {
|
|
@@ -677,16 +677,16 @@ var require_bn = __commonJS({
|
|
|
677
677
|
};
|
|
678
678
|
BN.prototype.iuxor = function iuxor(num) {
|
|
679
679
|
var a4;
|
|
680
|
-
var
|
|
680
|
+
var b3;
|
|
681
681
|
if (this.length > num.length) {
|
|
682
682
|
a4 = this;
|
|
683
|
-
|
|
683
|
+
b3 = num;
|
|
684
684
|
} else {
|
|
685
685
|
a4 = num;
|
|
686
|
-
|
|
686
|
+
b3 = this;
|
|
687
687
|
}
|
|
688
|
-
for (var i2 = 0; i2 <
|
|
689
|
-
this.words[i2] = a4.words[i2] ^
|
|
688
|
+
for (var i2 = 0; i2 < b3.length; i2++) {
|
|
689
|
+
this.words[i2] = a4.words[i2] ^ b3.words[i2];
|
|
690
690
|
}
|
|
691
691
|
if (this !== a4) {
|
|
692
692
|
for (; i2 < a4.length; i2++) {
|
|
@@ -756,17 +756,17 @@ var require_bn = __commonJS({
|
|
|
756
756
|
num.negative = 1;
|
|
757
757
|
return r2._normSign();
|
|
758
758
|
}
|
|
759
|
-
var a4,
|
|
759
|
+
var a4, b3;
|
|
760
760
|
if (this.length > num.length) {
|
|
761
761
|
a4 = this;
|
|
762
|
-
|
|
762
|
+
b3 = num;
|
|
763
763
|
} else {
|
|
764
764
|
a4 = num;
|
|
765
|
-
|
|
765
|
+
b3 = this;
|
|
766
766
|
}
|
|
767
767
|
var carry = 0;
|
|
768
|
-
for (var i2 = 0; i2 <
|
|
769
|
-
r2 = (a4.words[i2] | 0) + (
|
|
768
|
+
for (var i2 = 0; i2 < b3.length; i2++) {
|
|
769
|
+
r2 = (a4.words[i2] | 0) + (b3.words[i2] | 0) + carry;
|
|
770
770
|
this.words[i2] = r2 & 67108863;
|
|
771
771
|
carry = r2 >>> 26;
|
|
772
772
|
}
|
|
@@ -821,17 +821,17 @@ var require_bn = __commonJS({
|
|
|
821
821
|
this.words[0] = 0;
|
|
822
822
|
return this;
|
|
823
823
|
}
|
|
824
|
-
var a4,
|
|
824
|
+
var a4, b3;
|
|
825
825
|
if (cmp > 0) {
|
|
826
826
|
a4 = this;
|
|
827
|
-
|
|
827
|
+
b3 = num;
|
|
828
828
|
} else {
|
|
829
829
|
a4 = num;
|
|
830
|
-
|
|
830
|
+
b3 = this;
|
|
831
831
|
}
|
|
832
832
|
var carry = 0;
|
|
833
|
-
for (var i2 = 0; i2 <
|
|
834
|
-
r2 = (a4.words[i2] | 0) - (
|
|
833
|
+
for (var i2 = 0; i2 < b3.length; i2++) {
|
|
834
|
+
r2 = (a4.words[i2] | 0) - (b3.words[i2] | 0) + carry;
|
|
835
835
|
carry = r2 >> 26;
|
|
836
836
|
this.words[i2] = r2 & 67108863;
|
|
837
837
|
}
|
|
@@ -860,28 +860,28 @@ var require_bn = __commonJS({
|
|
|
860
860
|
out.length = len;
|
|
861
861
|
len = len - 1 | 0;
|
|
862
862
|
var a4 = self.words[0] | 0;
|
|
863
|
-
var
|
|
864
|
-
var r2 = a4 *
|
|
863
|
+
var b3 = num.words[0] | 0;
|
|
864
|
+
var r2 = a4 * b3;
|
|
865
865
|
var lo = r2 & 67108863;
|
|
866
866
|
var carry = r2 / 67108864 | 0;
|
|
867
867
|
out.words[0] = lo;
|
|
868
|
-
for (var
|
|
868
|
+
for (var k4 = 1; k4 < len; k4++) {
|
|
869
869
|
var ncarry = carry >>> 26;
|
|
870
870
|
var rword = carry & 67108863;
|
|
871
|
-
var maxJ = Math.min(
|
|
872
|
-
for (var j2 = Math.max(0,
|
|
873
|
-
var i2 =
|
|
871
|
+
var maxJ = Math.min(k4, num.length - 1);
|
|
872
|
+
for (var j2 = Math.max(0, k4 - self.length + 1); j2 <= maxJ; j2++) {
|
|
873
|
+
var i2 = k4 - j2 | 0;
|
|
874
874
|
a4 = self.words[i2] | 0;
|
|
875
|
-
|
|
876
|
-
r2 = a4 *
|
|
875
|
+
b3 = num.words[j2] | 0;
|
|
876
|
+
r2 = a4 * b3 + rword;
|
|
877
877
|
ncarry += r2 / 67108864 | 0;
|
|
878
878
|
rword = r2 & 67108863;
|
|
879
879
|
}
|
|
880
|
-
out.words[
|
|
880
|
+
out.words[k4] = rword | 0;
|
|
881
881
|
carry = ncarry | 0;
|
|
882
882
|
}
|
|
883
883
|
if (carry !== 0) {
|
|
884
|
-
out.words[
|
|
884
|
+
out.words[k4] = carry | 0;
|
|
885
885
|
} else {
|
|
886
886
|
out.length--;
|
|
887
887
|
}
|
|
@@ -889,7 +889,7 @@ var require_bn = __commonJS({
|
|
|
889
889
|
}
|
|
890
890
|
var comb10MulTo = function comb10MulTo2(self, num, out) {
|
|
891
891
|
var a4 = self.words;
|
|
892
|
-
var
|
|
892
|
+
var b3 = num.words;
|
|
893
893
|
var o2 = out.words;
|
|
894
894
|
var c4 = 0;
|
|
895
895
|
var lo;
|
|
@@ -925,34 +925,34 @@ var require_bn = __commonJS({
|
|
|
925
925
|
var a9 = a4[9] | 0;
|
|
926
926
|
var al9 = a9 & 8191;
|
|
927
927
|
var ah9 = a9 >>> 13;
|
|
928
|
-
var b0 =
|
|
928
|
+
var b0 = b3[0] | 0;
|
|
929
929
|
var bl0 = b0 & 8191;
|
|
930
930
|
var bh0 = b0 >>> 13;
|
|
931
|
-
var b1 =
|
|
931
|
+
var b1 = b3[1] | 0;
|
|
932
932
|
var bl1 = b1 & 8191;
|
|
933
933
|
var bh1 = b1 >>> 13;
|
|
934
|
-
var b22 =
|
|
934
|
+
var b22 = b3[2] | 0;
|
|
935
935
|
var bl2 = b22 & 8191;
|
|
936
936
|
var bh2 = b22 >>> 13;
|
|
937
|
-
var b32 =
|
|
937
|
+
var b32 = b3[3] | 0;
|
|
938
938
|
var bl3 = b32 & 8191;
|
|
939
939
|
var bh3 = b32 >>> 13;
|
|
940
|
-
var
|
|
941
|
-
var bl4 =
|
|
942
|
-
var bh4 =
|
|
943
|
-
var b5 =
|
|
940
|
+
var b4 = b3[4] | 0;
|
|
941
|
+
var bl4 = b4 & 8191;
|
|
942
|
+
var bh4 = b4 >>> 13;
|
|
943
|
+
var b5 = b3[5] | 0;
|
|
944
944
|
var bl5 = b5 & 8191;
|
|
945
945
|
var bh5 = b5 >>> 13;
|
|
946
|
-
var b6 =
|
|
946
|
+
var b6 = b3[6] | 0;
|
|
947
947
|
var bl6 = b6 & 8191;
|
|
948
948
|
var bh6 = b6 >>> 13;
|
|
949
|
-
var b7 =
|
|
949
|
+
var b7 = b3[7] | 0;
|
|
950
950
|
var bl7 = b7 & 8191;
|
|
951
951
|
var bh7 = b7 >>> 13;
|
|
952
|
-
var b8 =
|
|
952
|
+
var b8 = b3[8] | 0;
|
|
953
953
|
var bl8 = b8 & 8191;
|
|
954
954
|
var bh8 = b8 >>> 13;
|
|
955
|
-
var b9 =
|
|
955
|
+
var b9 = b3[9] | 0;
|
|
956
956
|
var bl9 = b9 & 8191;
|
|
957
957
|
var bh9 = b9 >>> 13;
|
|
958
958
|
out.negative = self.negative ^ num.negative;
|
|
@@ -1447,16 +1447,16 @@ var require_bn = __commonJS({
|
|
|
1447
1447
|
out.length = self.length + num.length;
|
|
1448
1448
|
var carry = 0;
|
|
1449
1449
|
var hncarry = 0;
|
|
1450
|
-
for (var
|
|
1450
|
+
for (var k4 = 0; k4 < out.length - 1; k4++) {
|
|
1451
1451
|
var ncarry = hncarry;
|
|
1452
1452
|
hncarry = 0;
|
|
1453
1453
|
var rword = carry & 67108863;
|
|
1454
|
-
var maxJ = Math.min(
|
|
1455
|
-
for (var j2 = Math.max(0,
|
|
1456
|
-
var i2 =
|
|
1454
|
+
var maxJ = Math.min(k4, num.length - 1);
|
|
1455
|
+
for (var j2 = Math.max(0, k4 - self.length + 1); j2 <= maxJ; j2++) {
|
|
1456
|
+
var i2 = k4 - j2;
|
|
1457
1457
|
var a4 = self.words[i2] | 0;
|
|
1458
|
-
var
|
|
1459
|
-
var r2 = a4 *
|
|
1458
|
+
var b3 = num.words[j2] | 0;
|
|
1459
|
+
var r2 = a4 * b3;
|
|
1460
1460
|
var lo = r2 & 67108863;
|
|
1461
1461
|
ncarry = ncarry + (r2 / 67108864 | 0) | 0;
|
|
1462
1462
|
lo = lo + rword | 0;
|
|
@@ -1465,12 +1465,12 @@ var require_bn = __commonJS({
|
|
|
1465
1465
|
hncarry += ncarry >>> 26;
|
|
1466
1466
|
ncarry &= 67108863;
|
|
1467
1467
|
}
|
|
1468
|
-
out.words[
|
|
1468
|
+
out.words[k4] = rword;
|
|
1469
1469
|
carry = ncarry;
|
|
1470
1470
|
ncarry = hncarry;
|
|
1471
1471
|
}
|
|
1472
1472
|
if (carry !== 0) {
|
|
1473
|
-
out.words[
|
|
1473
|
+
out.words[k4] = carry;
|
|
1474
1474
|
} else {
|
|
1475
1475
|
out.length--;
|
|
1476
1476
|
}
|
|
@@ -1527,21 +1527,21 @@ var require_bn = __commonJS({
|
|
|
1527
1527
|
var l2 = s4 << 1;
|
|
1528
1528
|
var rtwdf = Math.cos(2 * Math.PI / l2);
|
|
1529
1529
|
var itwdf = Math.sin(2 * Math.PI / l2);
|
|
1530
|
-
for (var
|
|
1530
|
+
for (var p3 = 0; p3 < N2; p3 += l2) {
|
|
1531
1531
|
var rtwdf_ = rtwdf;
|
|
1532
1532
|
var itwdf_ = itwdf;
|
|
1533
1533
|
for (var j2 = 0; j2 < s4; j2++) {
|
|
1534
|
-
var re = rtws[
|
|
1535
|
-
var ie = itws[
|
|
1536
|
-
var ro = rtws[
|
|
1537
|
-
var io = itws[
|
|
1534
|
+
var re = rtws[p3 + j2];
|
|
1535
|
+
var ie = itws[p3 + j2];
|
|
1536
|
+
var ro = rtws[p3 + j2 + s4];
|
|
1537
|
+
var io = itws[p3 + j2 + s4];
|
|
1538
1538
|
var rx = rtwdf_ * ro - itwdf_ * io;
|
|
1539
1539
|
io = rtwdf_ * io + itwdf_ * ro;
|
|
1540
1540
|
ro = rx;
|
|
1541
|
-
rtws[
|
|
1542
|
-
itws[
|
|
1543
|
-
rtws[
|
|
1544
|
-
itws[
|
|
1541
|
+
rtws[p3 + j2] = re + ro;
|
|
1542
|
+
itws[p3 + j2] = ie + io;
|
|
1543
|
+
rtws[p3 + j2 + s4] = re - ro;
|
|
1544
|
+
itws[p3 + j2 + s4] = ie - io;
|
|
1545
1545
|
if (j2 !== l2) {
|
|
1546
1546
|
rx = rtwdf * rtwdf_ - itwdf * itwdf_;
|
|
1547
1547
|
itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
|
|
@@ -1551,8 +1551,8 @@ var require_bn = __commonJS({
|
|
|
1551
1551
|
}
|
|
1552
1552
|
}
|
|
1553
1553
|
};
|
|
1554
|
-
FFTM.prototype.guessLen13b = function guessLen13b(n,
|
|
1555
|
-
var N2 = Math.max(
|
|
1554
|
+
FFTM.prototype.guessLen13b = function guessLen13b(n, m3) {
|
|
1555
|
+
var N2 = Math.max(m3, n) | 1;
|
|
1556
1556
|
var odd = N2 & 1;
|
|
1557
1557
|
var i2 = 0;
|
|
1558
1558
|
for (N2 = N2 / 2 | 0; N2; N2 = N2 >>> 1) {
|
|
@@ -1609,7 +1609,7 @@ var require_bn = __commonJS({
|
|
|
1609
1609
|
FFTM.prototype.mulp = function mulp(x3, y2, out) {
|
|
1610
1610
|
var N2 = 2 * this.guessLen13b(x3.length, y2.length);
|
|
1611
1611
|
var rbt = this.makeRBT(N2);
|
|
1612
|
-
var
|
|
1612
|
+
var _4 = this.stub(N2);
|
|
1613
1613
|
var rws = new Array(N2);
|
|
1614
1614
|
var rwst = new Array(N2);
|
|
1615
1615
|
var iwst = new Array(N2);
|
|
@@ -1620,16 +1620,16 @@ var require_bn = __commonJS({
|
|
|
1620
1620
|
rmws.length = N2;
|
|
1621
1621
|
this.convert13b(x3.words, x3.length, rws, N2);
|
|
1622
1622
|
this.convert13b(y2.words, y2.length, nrws, N2);
|
|
1623
|
-
this.transform(rws,
|
|
1624
|
-
this.transform(nrws,
|
|
1623
|
+
this.transform(rws, _4, rwst, iwst, N2, rbt);
|
|
1624
|
+
this.transform(nrws, _4, nrwst, niwst, N2, rbt);
|
|
1625
1625
|
for (var i2 = 0; i2 < N2; i2++) {
|
|
1626
1626
|
var rx = rwst[i2] * nrwst[i2] - iwst[i2] * niwst[i2];
|
|
1627
1627
|
iwst[i2] = rwst[i2] * niwst[i2] + iwst[i2] * nrwst[i2];
|
|
1628
1628
|
rwst[i2] = rx;
|
|
1629
1629
|
}
|
|
1630
1630
|
this.conjugate(rwst, iwst, N2);
|
|
1631
|
-
this.transform(rwst, iwst, rmws,
|
|
1632
|
-
this.conjugate(rmws,
|
|
1631
|
+
this.transform(rwst, iwst, rmws, _4, N2, rbt);
|
|
1632
|
+
this.conjugate(rmws, _4, N2);
|
|
1633
1633
|
this.normalize13b(rmws, N2);
|
|
1634
1634
|
out.negative = x3.negative ^ y2.negative;
|
|
1635
1635
|
out.length = x3.length + y2.length;
|
|
@@ -1730,18 +1730,18 @@ var require_bn = __commonJS({
|
|
|
1730
1730
|
};
|
|
1731
1731
|
BN.prototype.iushrn = function iushrn(bits, hint, extended) {
|
|
1732
1732
|
assert(typeof bits === "number" && bits >= 0);
|
|
1733
|
-
var
|
|
1733
|
+
var h3;
|
|
1734
1734
|
if (hint) {
|
|
1735
|
-
|
|
1735
|
+
h3 = (hint - hint % 26) / 26;
|
|
1736
1736
|
} else {
|
|
1737
|
-
|
|
1737
|
+
h3 = 0;
|
|
1738
1738
|
}
|
|
1739
1739
|
var r2 = bits % 26;
|
|
1740
1740
|
var s4 = Math.min((bits - r2) / 26, this.length);
|
|
1741
1741
|
var mask = 67108863 ^ 67108863 >>> r2 << r2;
|
|
1742
1742
|
var maskedWords = extended;
|
|
1743
|
-
|
|
1744
|
-
|
|
1743
|
+
h3 -= s4;
|
|
1744
|
+
h3 = Math.max(0, h3);
|
|
1745
1745
|
if (maskedWords) {
|
|
1746
1746
|
for (var i2 = 0; i2 < s4; i2++) {
|
|
1747
1747
|
maskedWords.words[i2] = this.words[i2];
|
|
@@ -1759,7 +1759,7 @@ var require_bn = __commonJS({
|
|
|
1759
1759
|
this.length = 1;
|
|
1760
1760
|
}
|
|
1761
1761
|
var carry = 0;
|
|
1762
|
-
for (i2 = this.length - 1; i2 >= 0 && (carry !== 0 || i2 >=
|
|
1762
|
+
for (i2 = this.length - 1; i2 >= 0 && (carry !== 0 || i2 >= h3); i2--) {
|
|
1763
1763
|
var word = this.words[i2] | 0;
|
|
1764
1764
|
this.words[i2] = carry << 26 - r2 | word >>> r2;
|
|
1765
1765
|
carry = word & mask;
|
|
@@ -1920,40 +1920,40 @@ var require_bn = __commonJS({
|
|
|
1920
1920
|
BN.prototype._wordDiv = function _wordDiv(num, mode) {
|
|
1921
1921
|
var shift = this.length - num.length;
|
|
1922
1922
|
var a4 = this.clone();
|
|
1923
|
-
var
|
|
1924
|
-
var bhi =
|
|
1923
|
+
var b3 = num;
|
|
1924
|
+
var bhi = b3.words[b3.length - 1] | 0;
|
|
1925
1925
|
var bhiBits = this._countBits(bhi);
|
|
1926
1926
|
shift = 26 - bhiBits;
|
|
1927
1927
|
if (shift !== 0) {
|
|
1928
|
-
|
|
1928
|
+
b3 = b3.ushln(shift);
|
|
1929
1929
|
a4.iushln(shift);
|
|
1930
|
-
bhi =
|
|
1930
|
+
bhi = b3.words[b3.length - 1] | 0;
|
|
1931
1931
|
}
|
|
1932
|
-
var
|
|
1932
|
+
var m3 = a4.length - b3.length;
|
|
1933
1933
|
var q;
|
|
1934
1934
|
if (mode !== "mod") {
|
|
1935
1935
|
q = new BN(null);
|
|
1936
|
-
q.length =
|
|
1936
|
+
q.length = m3 + 1;
|
|
1937
1937
|
q.words = new Array(q.length);
|
|
1938
1938
|
for (var i2 = 0; i2 < q.length; i2++) {
|
|
1939
1939
|
q.words[i2] = 0;
|
|
1940
1940
|
}
|
|
1941
1941
|
}
|
|
1942
|
-
var diff = a4.clone()._ishlnsubmul(
|
|
1942
|
+
var diff = a4.clone()._ishlnsubmul(b3, 1, m3);
|
|
1943
1943
|
if (diff.negative === 0) {
|
|
1944
1944
|
a4 = diff;
|
|
1945
1945
|
if (q) {
|
|
1946
|
-
q.words[
|
|
1946
|
+
q.words[m3] = 1;
|
|
1947
1947
|
}
|
|
1948
1948
|
}
|
|
1949
|
-
for (var j2 =
|
|
1950
|
-
var qj = (a4.words[
|
|
1949
|
+
for (var j2 = m3 - 1; j2 >= 0; j2--) {
|
|
1950
|
+
var qj = (a4.words[b3.length + j2] | 0) * 67108864 + (a4.words[b3.length + j2 - 1] | 0);
|
|
1951
1951
|
qj = Math.min(qj / bhi | 0, 67108863);
|
|
1952
|
-
a4._ishlnsubmul(
|
|
1952
|
+
a4._ishlnsubmul(b3, qj, j2);
|
|
1953
1953
|
while (a4.negative !== 0) {
|
|
1954
1954
|
qj--;
|
|
1955
1955
|
a4.negative = 0;
|
|
1956
|
-
a4._ishlnsubmul(
|
|
1956
|
+
a4._ishlnsubmul(b3, 1, j2);
|
|
1957
1957
|
if (!a4.isZero()) {
|
|
1958
1958
|
a4.negative ^= 1;
|
|
1959
1959
|
}
|
|
@@ -2071,10 +2071,10 @@ var require_bn = __commonJS({
|
|
|
2071
2071
|
};
|
|
2072
2072
|
BN.prototype.modn = function modn(num) {
|
|
2073
2073
|
assert(num <= 67108863);
|
|
2074
|
-
var
|
|
2074
|
+
var p3 = (1 << 26) % num;
|
|
2075
2075
|
var acc = 0;
|
|
2076
2076
|
for (var i2 = this.length - 1; i2 >= 0; i2--) {
|
|
2077
|
-
acc = (
|
|
2077
|
+
acc = (p3 * acc + (this.words[i2] | 0)) % num;
|
|
2078
2078
|
}
|
|
2079
2079
|
return acc;
|
|
2080
2080
|
};
|
|
@@ -2091,13 +2091,13 @@ var require_bn = __commonJS({
|
|
|
2091
2091
|
BN.prototype.divn = function divn(num) {
|
|
2092
2092
|
return this.clone().idivn(num);
|
|
2093
2093
|
};
|
|
2094
|
-
BN.prototype.egcd = function egcd(
|
|
2095
|
-
assert(
|
|
2096
|
-
assert(!
|
|
2094
|
+
BN.prototype.egcd = function egcd(p3) {
|
|
2095
|
+
assert(p3.negative === 0);
|
|
2096
|
+
assert(!p3.isZero());
|
|
2097
2097
|
var x3 = this;
|
|
2098
|
-
var y2 =
|
|
2098
|
+
var y2 = p3.clone();
|
|
2099
2099
|
if (x3.negative !== 0) {
|
|
2100
|
-
x3 = x3.umod(
|
|
2100
|
+
x3 = x3.umod(p3);
|
|
2101
2101
|
} else {
|
|
2102
2102
|
x3 = x3.clone();
|
|
2103
2103
|
}
|
|
@@ -2105,11 +2105,11 @@ var require_bn = __commonJS({
|
|
|
2105
2105
|
var B2 = new BN(0);
|
|
2106
2106
|
var C3 = new BN(0);
|
|
2107
2107
|
var D2 = new BN(1);
|
|
2108
|
-
var
|
|
2108
|
+
var g2 = 0;
|
|
2109
2109
|
while (x3.isEven() && y2.isEven()) {
|
|
2110
2110
|
x3.iushrn(1);
|
|
2111
2111
|
y2.iushrn(1);
|
|
2112
|
-
++
|
|
2112
|
+
++g2;
|
|
2113
2113
|
}
|
|
2114
2114
|
var yp = y2.clone();
|
|
2115
2115
|
var xp = x3.clone();
|
|
@@ -2151,23 +2151,23 @@ var require_bn = __commonJS({
|
|
|
2151
2151
|
return {
|
|
2152
2152
|
a: C3,
|
|
2153
2153
|
b: D2,
|
|
2154
|
-
gcd: y2.iushln(
|
|
2154
|
+
gcd: y2.iushln(g2)
|
|
2155
2155
|
};
|
|
2156
2156
|
};
|
|
2157
|
-
BN.prototype._invmp = function _invmp(
|
|
2158
|
-
assert(
|
|
2159
|
-
assert(!
|
|
2157
|
+
BN.prototype._invmp = function _invmp(p3) {
|
|
2158
|
+
assert(p3.negative === 0);
|
|
2159
|
+
assert(!p3.isZero());
|
|
2160
2160
|
var a4 = this;
|
|
2161
|
-
var
|
|
2161
|
+
var b3 = p3.clone();
|
|
2162
2162
|
if (a4.negative !== 0) {
|
|
2163
|
-
a4 = a4.umod(
|
|
2163
|
+
a4 = a4.umod(p3);
|
|
2164
2164
|
} else {
|
|
2165
2165
|
a4 = a4.clone();
|
|
2166
2166
|
}
|
|
2167
2167
|
var x1 = new BN(1);
|
|
2168
2168
|
var x22 = new BN(0);
|
|
2169
|
-
var delta =
|
|
2170
|
-
while (a4.cmpn(1) > 0 &&
|
|
2169
|
+
var delta = b3.clone();
|
|
2170
|
+
while (a4.cmpn(1) > 0 && b3.cmpn(1) > 0) {
|
|
2171
2171
|
for (var i2 = 0, im = 1; (a4.words[0] & im) === 0 && i2 < 26; ++i2, im <<= 1) ;
|
|
2172
2172
|
if (i2 > 0) {
|
|
2173
2173
|
a4.iushrn(i2);
|
|
@@ -2178,9 +2178,9 @@ var require_bn = __commonJS({
|
|
|
2178
2178
|
x1.iushrn(1);
|
|
2179
2179
|
}
|
|
2180
2180
|
}
|
|
2181
|
-
for (var j2 = 0, jm = 1; (
|
|
2181
|
+
for (var j2 = 0, jm = 1; (b3.words[0] & jm) === 0 && j2 < 26; ++j2, jm <<= 1) ;
|
|
2182
2182
|
if (j2 > 0) {
|
|
2183
|
-
|
|
2183
|
+
b3.iushrn(j2);
|
|
2184
2184
|
while (j2-- > 0) {
|
|
2185
2185
|
if (x22.isOdd()) {
|
|
2186
2186
|
x22.iadd(delta);
|
|
@@ -2188,11 +2188,11 @@ var require_bn = __commonJS({
|
|
|
2188
2188
|
x22.iushrn(1);
|
|
2189
2189
|
}
|
|
2190
2190
|
}
|
|
2191
|
-
if (a4.cmp(
|
|
2192
|
-
a4.isub(
|
|
2191
|
+
if (a4.cmp(b3) >= 0) {
|
|
2192
|
+
a4.isub(b3);
|
|
2193
2193
|
x1.isub(x22);
|
|
2194
2194
|
} else {
|
|
2195
|
-
|
|
2195
|
+
b3.isub(a4);
|
|
2196
2196
|
x22.isub(x1);
|
|
2197
2197
|
}
|
|
2198
2198
|
}
|
|
@@ -2203,7 +2203,7 @@ var require_bn = __commonJS({
|
|
|
2203
2203
|
res = x22;
|
|
2204
2204
|
}
|
|
2205
2205
|
if (res.cmpn(0) < 0) {
|
|
2206
|
-
res.iadd(
|
|
2206
|
+
res.iadd(p3);
|
|
2207
2207
|
}
|
|
2208
2208
|
return res;
|
|
2209
2209
|
};
|
|
@@ -2211,31 +2211,31 @@ var require_bn = __commonJS({
|
|
|
2211
2211
|
if (this.isZero()) return num.abs();
|
|
2212
2212
|
if (num.isZero()) return this.abs();
|
|
2213
2213
|
var a4 = this.clone();
|
|
2214
|
-
var
|
|
2214
|
+
var b3 = num.clone();
|
|
2215
2215
|
a4.negative = 0;
|
|
2216
|
-
|
|
2217
|
-
for (var shift = 0; a4.isEven() &&
|
|
2216
|
+
b3.negative = 0;
|
|
2217
|
+
for (var shift = 0; a4.isEven() && b3.isEven(); shift++) {
|
|
2218
2218
|
a4.iushrn(1);
|
|
2219
|
-
|
|
2219
|
+
b3.iushrn(1);
|
|
2220
2220
|
}
|
|
2221
2221
|
do {
|
|
2222
2222
|
while (a4.isEven()) {
|
|
2223
2223
|
a4.iushrn(1);
|
|
2224
2224
|
}
|
|
2225
|
-
while (
|
|
2226
|
-
|
|
2225
|
+
while (b3.isEven()) {
|
|
2226
|
+
b3.iushrn(1);
|
|
2227
2227
|
}
|
|
2228
|
-
var r2 = a4.cmp(
|
|
2228
|
+
var r2 = a4.cmp(b3);
|
|
2229
2229
|
if (r2 < 0) {
|
|
2230
2230
|
var t3 = a4;
|
|
2231
|
-
a4 =
|
|
2232
|
-
|
|
2233
|
-
} else if (r2 === 0 ||
|
|
2231
|
+
a4 = b3;
|
|
2232
|
+
b3 = t3;
|
|
2233
|
+
} else if (r2 === 0 || b3.cmpn(1) === 0) {
|
|
2234
2234
|
break;
|
|
2235
2235
|
}
|
|
2236
|
-
a4.isub(
|
|
2236
|
+
a4.isub(b3);
|
|
2237
2237
|
} while (true);
|
|
2238
|
-
return
|
|
2238
|
+
return b3.iushln(shift);
|
|
2239
2239
|
};
|
|
2240
2240
|
BN.prototype.invm = function invm(num) {
|
|
2241
2241
|
return this.egcd(num).a.umod(num);
|
|
@@ -2308,11 +2308,11 @@ var require_bn = __commonJS({
|
|
|
2308
2308
|
var res = 0;
|
|
2309
2309
|
for (var i2 = this.length - 1; i2 >= 0; i2--) {
|
|
2310
2310
|
var a4 = this.words[i2] | 0;
|
|
2311
|
-
var
|
|
2312
|
-
if (a4 ===
|
|
2313
|
-
if (a4 <
|
|
2311
|
+
var b3 = num.words[i2] | 0;
|
|
2312
|
+
if (a4 === b3) continue;
|
|
2313
|
+
if (a4 < b3) {
|
|
2314
2314
|
res = -1;
|
|
2315
|
-
} else if (a4 >
|
|
2315
|
+
} else if (a4 > b3) {
|
|
2316
2316
|
res = 1;
|
|
2317
2317
|
}
|
|
2318
2318
|
break;
|
|
@@ -2435,9 +2435,9 @@ var require_bn = __commonJS({
|
|
|
2435
2435
|
p192: null,
|
|
2436
2436
|
p25519: null
|
|
2437
2437
|
};
|
|
2438
|
-
function MPrime(name,
|
|
2438
|
+
function MPrime(name, p3) {
|
|
2439
2439
|
this.name = name;
|
|
2440
|
-
this.p = new BN(
|
|
2440
|
+
this.p = new BN(p3, 16);
|
|
2441
2441
|
this.n = this.p.bitLength();
|
|
2442
2442
|
this.k = new BN(1).iushln(this.n).isub(this.p);
|
|
2443
2443
|
this.tmp = this._tmp();
|
|
@@ -2586,14 +2586,14 @@ var require_bn = __commonJS({
|
|
|
2586
2586
|
primes[name] = prime2;
|
|
2587
2587
|
return prime2;
|
|
2588
2588
|
};
|
|
2589
|
-
function Red(
|
|
2590
|
-
if (typeof
|
|
2591
|
-
var prime = BN._prime(
|
|
2589
|
+
function Red(m3) {
|
|
2590
|
+
if (typeof m3 === "string") {
|
|
2591
|
+
var prime = BN._prime(m3);
|
|
2592
2592
|
this.m = prime.p;
|
|
2593
2593
|
this.prime = prime;
|
|
2594
2594
|
} else {
|
|
2595
|
-
assert(
|
|
2596
|
-
this.m =
|
|
2595
|
+
assert(m3.gtn(1), "modulus must be greater than 1");
|
|
2596
|
+
this.m = m3;
|
|
2597
2597
|
this.prime = null;
|
|
2598
2598
|
}
|
|
2599
2599
|
}
|
|
@@ -2601,10 +2601,10 @@ var require_bn = __commonJS({
|
|
|
2601
2601
|
assert(a4.negative === 0, "red works only with positives");
|
|
2602
2602
|
assert(a4.red, "red works only with red numbers");
|
|
2603
2603
|
};
|
|
2604
|
-
Red.prototype._verify2 = function _verify2(a4,
|
|
2605
|
-
assert((a4.negative |
|
|
2604
|
+
Red.prototype._verify2 = function _verify2(a4, b3) {
|
|
2605
|
+
assert((a4.negative | b3.negative) === 0, "red works only with positives");
|
|
2606
2606
|
assert(
|
|
2607
|
-
a4.red && a4.red ===
|
|
2607
|
+
a4.red && a4.red === b3.red,
|
|
2608
2608
|
"red works only with red numbers"
|
|
2609
2609
|
);
|
|
2610
2610
|
};
|
|
@@ -2618,33 +2618,33 @@ var require_bn = __commonJS({
|
|
|
2618
2618
|
}
|
|
2619
2619
|
return this.m.sub(a4)._forceRed(this);
|
|
2620
2620
|
};
|
|
2621
|
-
Red.prototype.add = function add(a4,
|
|
2622
|
-
this._verify2(a4,
|
|
2623
|
-
var res = a4.add(
|
|
2621
|
+
Red.prototype.add = function add(a4, b3) {
|
|
2622
|
+
this._verify2(a4, b3);
|
|
2623
|
+
var res = a4.add(b3);
|
|
2624
2624
|
if (res.cmp(this.m) >= 0) {
|
|
2625
2625
|
res.isub(this.m);
|
|
2626
2626
|
}
|
|
2627
2627
|
return res._forceRed(this);
|
|
2628
2628
|
};
|
|
2629
|
-
Red.prototype.iadd = function iadd(a4,
|
|
2630
|
-
this._verify2(a4,
|
|
2631
|
-
var res = a4.iadd(
|
|
2629
|
+
Red.prototype.iadd = function iadd(a4, b3) {
|
|
2630
|
+
this._verify2(a4, b3);
|
|
2631
|
+
var res = a4.iadd(b3);
|
|
2632
2632
|
if (res.cmp(this.m) >= 0) {
|
|
2633
2633
|
res.isub(this.m);
|
|
2634
2634
|
}
|
|
2635
2635
|
return res;
|
|
2636
2636
|
};
|
|
2637
|
-
Red.prototype.sub = function sub(a4,
|
|
2638
|
-
this._verify2(a4,
|
|
2639
|
-
var res = a4.sub(
|
|
2637
|
+
Red.prototype.sub = function sub(a4, b3) {
|
|
2638
|
+
this._verify2(a4, b3);
|
|
2639
|
+
var res = a4.sub(b3);
|
|
2640
2640
|
if (res.cmpn(0) < 0) {
|
|
2641
2641
|
res.iadd(this.m);
|
|
2642
2642
|
}
|
|
2643
2643
|
return res._forceRed(this);
|
|
2644
2644
|
};
|
|
2645
|
-
Red.prototype.isub = function isub(a4,
|
|
2646
|
-
this._verify2(a4,
|
|
2647
|
-
var res = a4.isub(
|
|
2645
|
+
Red.prototype.isub = function isub(a4, b3) {
|
|
2646
|
+
this._verify2(a4, b3);
|
|
2647
|
+
var res = a4.isub(b3);
|
|
2648
2648
|
if (res.cmpn(0) < 0) {
|
|
2649
2649
|
res.iadd(this.m);
|
|
2650
2650
|
}
|
|
@@ -2654,13 +2654,13 @@ var require_bn = __commonJS({
|
|
|
2654
2654
|
this._verify1(a4);
|
|
2655
2655
|
return this.imod(a4.ushln(num));
|
|
2656
2656
|
};
|
|
2657
|
-
Red.prototype.imul = function imul(a4,
|
|
2658
|
-
this._verify2(a4,
|
|
2659
|
-
return this.imod(a4.imul(
|
|
2657
|
+
Red.prototype.imul = function imul(a4, b3) {
|
|
2658
|
+
this._verify2(a4, b3);
|
|
2659
|
+
return this.imod(a4.imul(b3));
|
|
2660
2660
|
};
|
|
2661
|
-
Red.prototype.mul = function mul(a4,
|
|
2662
|
-
this._verify2(a4,
|
|
2663
|
-
return this.imod(a4.mul(
|
|
2661
|
+
Red.prototype.mul = function mul(a4, b3) {
|
|
2662
|
+
this._verify2(a4, b3);
|
|
2663
|
+
return this.imod(a4.mul(b3));
|
|
2664
2664
|
};
|
|
2665
2665
|
Red.prototype.isqr = function isqr(a4) {
|
|
2666
2666
|
return this.imul(a4, a4.clone());
|
|
@@ -2694,18 +2694,18 @@ var require_bn = __commonJS({
|
|
|
2694
2694
|
var c4 = this.pow(z, q);
|
|
2695
2695
|
var r2 = this.pow(a4, q.addn(1).iushrn(1));
|
|
2696
2696
|
var t3 = this.pow(a4, q);
|
|
2697
|
-
var
|
|
2697
|
+
var m3 = s4;
|
|
2698
2698
|
while (t3.cmp(one) !== 0) {
|
|
2699
2699
|
var tmp = t3;
|
|
2700
2700
|
for (var i2 = 0; tmp.cmp(one) !== 0; i2++) {
|
|
2701
2701
|
tmp = tmp.redSqr();
|
|
2702
2702
|
}
|
|
2703
|
-
assert(i2 <
|
|
2704
|
-
var
|
|
2705
|
-
r2 = r2.redMul(
|
|
2706
|
-
c4 =
|
|
2703
|
+
assert(i2 < m3);
|
|
2704
|
+
var b3 = this.pow(c4, new BN(1).iushln(m3 - i2 - 1));
|
|
2705
|
+
r2 = r2.redMul(b3);
|
|
2706
|
+
c4 = b3.redSqr();
|
|
2707
2707
|
t3 = t3.redMul(c4);
|
|
2708
|
-
|
|
2708
|
+
m3 = i2;
|
|
2709
2709
|
}
|
|
2710
2710
|
return r2;
|
|
2711
2711
|
};
|
|
@@ -2770,8 +2770,8 @@ var require_bn = __commonJS({
|
|
|
2770
2770
|
BN.mont = function mont(num) {
|
|
2771
2771
|
return new Mont(num);
|
|
2772
2772
|
};
|
|
2773
|
-
function Mont(
|
|
2774
|
-
Red.call(this,
|
|
2773
|
+
function Mont(m3) {
|
|
2774
|
+
Red.call(this, m3);
|
|
2775
2775
|
this.shift = this.m.bitLength();
|
|
2776
2776
|
if (this.shift % 26 !== 0) {
|
|
2777
2777
|
this.shift += 26 - this.shift % 26;
|
|
@@ -2792,13 +2792,13 @@ var require_bn = __commonJS({
|
|
|
2792
2792
|
r2.red = null;
|
|
2793
2793
|
return r2;
|
|
2794
2794
|
};
|
|
2795
|
-
Mont.prototype.imul = function imul(a4,
|
|
2796
|
-
if (a4.isZero() ||
|
|
2795
|
+
Mont.prototype.imul = function imul(a4, b3) {
|
|
2796
|
+
if (a4.isZero() || b3.isZero()) {
|
|
2797
2797
|
a4.words[0] = 0;
|
|
2798
2798
|
a4.length = 1;
|
|
2799
2799
|
return a4;
|
|
2800
2800
|
}
|
|
2801
|
-
var t3 = a4.imul(
|
|
2801
|
+
var t3 = a4.imul(b3);
|
|
2802
2802
|
var c4 = t3.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
|
|
2803
2803
|
var u3 = t3.isub(c4).iushrn(this.shift);
|
|
2804
2804
|
var res = u3;
|
|
@@ -2809,9 +2809,9 @@ var require_bn = __commonJS({
|
|
|
2809
2809
|
}
|
|
2810
2810
|
return res._forceRed(this);
|
|
2811
2811
|
};
|
|
2812
|
-
Mont.prototype.mul = function mul(a4,
|
|
2813
|
-
if (a4.isZero() ||
|
|
2814
|
-
var t3 = a4.mul(
|
|
2812
|
+
Mont.prototype.mul = function mul(a4, b3) {
|
|
2813
|
+
if (a4.isZero() || b3.isZero()) return new BN(0)._forceRed(this);
|
|
2814
|
+
var t3 = a4.mul(b3);
|
|
2815
2815
|
var c4 = t3.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
|
|
2816
2816
|
var u3 = t3.isub(c4).iushrn(this.shift);
|
|
2817
2817
|
var res = u3;
|
|
@@ -3141,7 +3141,7 @@ var require_buffer = __commonJS({
|
|
|
3141
3141
|
const isCompatible = typeof data === "object" && data.constructor.name === "EncoderBuffer" && typeof data.length === "number" && typeof data.join === "function";
|
|
3142
3142
|
return isCompatible;
|
|
3143
3143
|
};
|
|
3144
|
-
EncoderBuffer.prototype.join = function
|
|
3144
|
+
EncoderBuffer.prototype.join = function join3(out, offset) {
|
|
3145
3145
|
if (!out)
|
|
3146
3146
|
out = Buffer2.alloc(this.length);
|
|
3147
3147
|
if (!offset)
|
|
@@ -4023,10 +4023,10 @@ var require_pem = __commonJS({
|
|
|
4023
4023
|
module.exports = PEMEncoder;
|
|
4024
4024
|
PEMEncoder.prototype.encode = function encode(data, options) {
|
|
4025
4025
|
const buf = DEREncoder.prototype.encode.call(this, data);
|
|
4026
|
-
const
|
|
4026
|
+
const p3 = buf.toString("base64");
|
|
4027
4027
|
const out = ["-----BEGIN " + options.label + "-----"];
|
|
4028
|
-
for (let i2 = 0; i2 <
|
|
4029
|
-
out.push(
|
|
4028
|
+
for (let i2 = 0; i2 < p3.length; i2 += 64)
|
|
4029
|
+
out.push(p3.slice(i2, i2 + 64));
|
|
4030
4030
|
out.push("-----END " + options.label + "-----");
|
|
4031
4031
|
return out.join("\n");
|
|
4032
4032
|
};
|
|
@@ -4755,16 +4755,16 @@ var require_buffer_equal_constant_time = __commonJS({
|
|
|
4755
4755
|
var Buffer2 = __require("buffer").Buffer;
|
|
4756
4756
|
var SlowBuffer = __require("buffer").SlowBuffer;
|
|
4757
4757
|
module.exports = bufferEq;
|
|
4758
|
-
function bufferEq(a4,
|
|
4759
|
-
if (!Buffer2.isBuffer(a4) || !Buffer2.isBuffer(
|
|
4758
|
+
function bufferEq(a4, b3) {
|
|
4759
|
+
if (!Buffer2.isBuffer(a4) || !Buffer2.isBuffer(b3)) {
|
|
4760
4760
|
return false;
|
|
4761
4761
|
}
|
|
4762
|
-
if (a4.length !==
|
|
4762
|
+
if (a4.length !== b3.length) {
|
|
4763
4763
|
return false;
|
|
4764
4764
|
}
|
|
4765
4765
|
var c4 = 0;
|
|
4766
4766
|
for (var i2 = 0; i2 < a4.length; i2++) {
|
|
4767
|
-
c4 |= a4[i2] ^
|
|
4767
|
+
c4 |= a4[i2] ^ b3[i2];
|
|
4768
4768
|
}
|
|
4769
4769
|
return c4 === 0;
|
|
4770
4770
|
}
|
|
@@ -4890,16 +4890,16 @@ var require_jwa = __commonJS({
|
|
|
4890
4890
|
};
|
|
4891
4891
|
}
|
|
4892
4892
|
var bufferEqual;
|
|
4893
|
-
var timingSafeEqual2 = "timingSafeEqual" in crypto ? function timingSafeEqual3(a4,
|
|
4894
|
-
if (a4.byteLength !==
|
|
4893
|
+
var timingSafeEqual2 = "timingSafeEqual" in crypto ? function timingSafeEqual3(a4, b3) {
|
|
4894
|
+
if (a4.byteLength !== b3.byteLength) {
|
|
4895
4895
|
return false;
|
|
4896
4896
|
}
|
|
4897
|
-
return crypto.timingSafeEqual(a4,
|
|
4898
|
-
} : function timingSafeEqual3(a4,
|
|
4897
|
+
return crypto.timingSafeEqual(a4, b3);
|
|
4898
|
+
} : function timingSafeEqual3(a4, b3) {
|
|
4899
4899
|
if (!bufferEqual) {
|
|
4900
4900
|
bufferEqual = require_buffer_equal_constant_time();
|
|
4901
4901
|
}
|
|
4902
|
-
return bufferEqual(a4,
|
|
4902
|
+
return bufferEqual(a4, b3);
|
|
4903
4903
|
};
|
|
4904
4904
|
function createHmacVerifier(bits) {
|
|
4905
4905
|
return function verify(thing, signature, secret) {
|
|
@@ -5476,20 +5476,20 @@ var require_ece = __commonJS({
|
|
|
5476
5476
|
var MODE_DECRYPT = "decrypt";
|
|
5477
5477
|
var keylog;
|
|
5478
5478
|
if (process.env.ECE_KEYLOG === "1") {
|
|
5479
|
-
keylog = function(
|
|
5480
|
-
console.warn(
|
|
5481
|
-
return
|
|
5479
|
+
keylog = function(m3, k4) {
|
|
5480
|
+
console.warn(m3 + " [" + k4.length + "]: " + k4.toString("base64url"));
|
|
5481
|
+
return k4;
|
|
5482
5482
|
};
|
|
5483
5483
|
} else {
|
|
5484
|
-
keylog = function(
|
|
5485
|
-
return
|
|
5484
|
+
keylog = function(m3, k4) {
|
|
5485
|
+
return k4;
|
|
5486
5486
|
};
|
|
5487
5487
|
}
|
|
5488
|
-
function decode(
|
|
5489
|
-
if (typeof
|
|
5490
|
-
return Buffer.from(
|
|
5488
|
+
function decode(b3) {
|
|
5489
|
+
if (typeof b3 === "string") {
|
|
5490
|
+
return Buffer.from(b3, "base64url");
|
|
5491
5491
|
}
|
|
5492
|
-
return
|
|
5492
|
+
return b3;
|
|
5493
5493
|
}
|
|
5494
5494
|
function HMAC_hash(key, input) {
|
|
5495
5495
|
var hmac = crypto.createHmac("sha256", key);
|
|
@@ -5505,14 +5505,14 @@ var require_ece = __commonJS({
|
|
|
5505
5505
|
keylog("prk", prk);
|
|
5506
5506
|
keylog("info", info2);
|
|
5507
5507
|
var output = Buffer.alloc(0);
|
|
5508
|
-
var
|
|
5508
|
+
var T3 = Buffer.alloc(0);
|
|
5509
5509
|
info2 = Buffer.from(info2, "ascii");
|
|
5510
5510
|
var counter = 0;
|
|
5511
5511
|
var cbuf = Buffer.alloc(1);
|
|
5512
5512
|
while (output.length < l2) {
|
|
5513
5513
|
cbuf.writeUIntBE(++counter, 0, 1);
|
|
5514
|
-
|
|
5515
|
-
output = Buffer.concat([output,
|
|
5514
|
+
T3 = HMAC_hash(prk, Buffer.concat([T3, info2, cbuf]));
|
|
5515
|
+
output = Buffer.concat([output, T3]);
|
|
5516
5516
|
}
|
|
5517
5517
|
return keylog("expand", output.slice(0, l2));
|
|
5518
5518
|
}
|
|
@@ -5528,9 +5528,9 @@ var require_ece = __commonJS({
|
|
|
5528
5528
|
return result;
|
|
5529
5529
|
}
|
|
5530
5530
|
function lengthPrefix(buffer) {
|
|
5531
|
-
var
|
|
5532
|
-
|
|
5533
|
-
return
|
|
5531
|
+
var b3 = Buffer.concat([Buffer.alloc(2), buffer]);
|
|
5532
|
+
b3.writeUIntBE(buffer.length, 0, 2);
|
|
5533
|
+
return b3;
|
|
5534
5534
|
}
|
|
5535
5535
|
function extractDH(header, mode) {
|
|
5536
5536
|
var key = header.privateKey;
|
|
@@ -5711,8 +5711,8 @@ var require_ece = __commonJS({
|
|
|
5711
5711
|
}
|
|
5712
5712
|
function generateNonce(base, counter) {
|
|
5713
5713
|
var nonce = Buffer.from(base);
|
|
5714
|
-
var
|
|
5715
|
-
var x3 = ((
|
|
5714
|
+
var m3 = nonce.readUIntBE(nonce.length - 6, 6);
|
|
5715
|
+
var x3 = ((m3 ^ counter) & 16777215) + ((m3 / 16777216 ^ counter / 16777216) & 16777215) * 16777216;
|
|
5716
5716
|
nonce.writeUIntBE(x3, nonce.length - 6, 6);
|
|
5717
5717
|
keylog("nonce" + counter, nonce);
|
|
5718
5718
|
return nonce;
|
|
@@ -5990,9 +5990,9 @@ var require_ms = __commonJS({
|
|
|
5990
5990
|
"node_modules/https-proxy-agent/node_modules/ms/index.js"(exports, module) {
|
|
5991
5991
|
init_define_MESSENGER_BUILD_INFO();
|
|
5992
5992
|
var s4 = 1e3;
|
|
5993
|
-
var
|
|
5994
|
-
var
|
|
5995
|
-
var d3 =
|
|
5993
|
+
var m3 = s4 * 60;
|
|
5994
|
+
var h3 = m3 * 60;
|
|
5995
|
+
var d3 = h3 * 24;
|
|
5996
5996
|
var w3 = d3 * 7;
|
|
5997
5997
|
var y2 = d3 * 365.25;
|
|
5998
5998
|
module.exports = function(val, options) {
|
|
@@ -6040,13 +6040,13 @@ var require_ms = __commonJS({
|
|
|
6040
6040
|
case "hrs":
|
|
6041
6041
|
case "hr":
|
|
6042
6042
|
case "h":
|
|
6043
|
-
return n *
|
|
6043
|
+
return n * h3;
|
|
6044
6044
|
case "minutes":
|
|
6045
6045
|
case "minute":
|
|
6046
6046
|
case "mins":
|
|
6047
6047
|
case "min":
|
|
6048
6048
|
case "m":
|
|
6049
|
-
return n *
|
|
6049
|
+
return n * m3;
|
|
6050
6050
|
case "seconds":
|
|
6051
6051
|
case "second":
|
|
6052
6052
|
case "secs":
|
|
@@ -6068,11 +6068,11 @@ var require_ms = __commonJS({
|
|
|
6068
6068
|
if (msAbs >= d3) {
|
|
6069
6069
|
return Math.round(ms / d3) + "d";
|
|
6070
6070
|
}
|
|
6071
|
-
if (msAbs >=
|
|
6072
|
-
return Math.round(ms /
|
|
6071
|
+
if (msAbs >= h3) {
|
|
6072
|
+
return Math.round(ms / h3) + "h";
|
|
6073
6073
|
}
|
|
6074
|
-
if (msAbs >=
|
|
6075
|
-
return Math.round(ms /
|
|
6074
|
+
if (msAbs >= m3) {
|
|
6075
|
+
return Math.round(ms / m3) + "m";
|
|
6076
6076
|
}
|
|
6077
6077
|
if (msAbs >= s4) {
|
|
6078
6078
|
return Math.round(ms / s4) + "s";
|
|
@@ -6084,11 +6084,11 @@ var require_ms = __commonJS({
|
|
|
6084
6084
|
if (msAbs >= d3) {
|
|
6085
6085
|
return plural(ms, msAbs, d3, "day");
|
|
6086
6086
|
}
|
|
6087
|
-
if (msAbs >=
|
|
6088
|
-
return plural(ms, msAbs,
|
|
6087
|
+
if (msAbs >= h3) {
|
|
6088
|
+
return plural(ms, msAbs, h3, "hour");
|
|
6089
6089
|
}
|
|
6090
|
-
if (msAbs >=
|
|
6091
|
-
return plural(ms, msAbs,
|
|
6090
|
+
if (msAbs >= m3) {
|
|
6091
|
+
return plural(ms, msAbs, m3, "minute");
|
|
6092
6092
|
}
|
|
6093
6093
|
if (msAbs >= s4) {
|
|
6094
6094
|
return plural(ms, msAbs, s4, "second");
|
|
@@ -6383,11 +6383,11 @@ var require_browser = __commonJS({
|
|
|
6383
6383
|
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
6384
6384
|
return false;
|
|
6385
6385
|
}
|
|
6386
|
-
let
|
|
6386
|
+
let m3;
|
|
6387
6387
|
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
6388
6388
|
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
6389
6389
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
6390
|
-
typeof navigator !== "undefined" && navigator.userAgent && (
|
|
6390
|
+
typeof navigator !== "undefined" && navigator.userAgent && (m3 = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m3[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
6391
6391
|
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
6392
6392
|
}
|
|
6393
6393
|
function formatArgs(args) {
|
|
@@ -6556,8 +6556,8 @@ var require_node2 = __commonJS({
|
|
|
6556
6556
|
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
6557
6557
|
return /^debug_/i.test(key);
|
|
6558
6558
|
}).reduce((obj, key) => {
|
|
6559
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (
|
|
6560
|
-
return
|
|
6559
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_4, k4) => {
|
|
6560
|
+
return k4.toUpperCase();
|
|
6561
6561
|
});
|
|
6562
6562
|
let val = process.env[key];
|
|
6563
6563
|
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
@@ -6643,18 +6643,18 @@ var require_helpers = __commonJS({
|
|
|
6643
6643
|
"node_modules/agent-base/dist/helpers.js"(exports) {
|
|
6644
6644
|
"use strict";
|
|
6645
6645
|
init_define_MESSENGER_BUILD_INFO();
|
|
6646
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2,
|
|
6647
|
-
if (k22 === void 0) k22 =
|
|
6648
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
6649
|
-
if (!desc || ("get" in desc ? !
|
|
6646
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m3, k4, k22) {
|
|
6647
|
+
if (k22 === void 0) k22 = k4;
|
|
6648
|
+
var desc = Object.getOwnPropertyDescriptor(m3, k4);
|
|
6649
|
+
if (!desc || ("get" in desc ? !m3.__esModule : desc.writable || desc.configurable)) {
|
|
6650
6650
|
desc = { enumerable: true, get: function() {
|
|
6651
|
-
return
|
|
6651
|
+
return m3[k4];
|
|
6652
6652
|
} };
|
|
6653
6653
|
}
|
|
6654
6654
|
Object.defineProperty(o2, k22, desc);
|
|
6655
|
-
} : function(o2,
|
|
6656
|
-
if (k22 === void 0) k22 =
|
|
6657
|
-
o2[k22] =
|
|
6655
|
+
} : function(o2, m3, k4, k22) {
|
|
6656
|
+
if (k22 === void 0) k22 = k4;
|
|
6657
|
+
o2[k22] = m3[k4];
|
|
6658
6658
|
});
|
|
6659
6659
|
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o2, v3) {
|
|
6660
6660
|
Object.defineProperty(o2, "default", { enumerable: true, value: v3 });
|
|
@@ -6665,7 +6665,7 @@ var require_helpers = __commonJS({
|
|
|
6665
6665
|
if (mod && mod.__esModule) return mod;
|
|
6666
6666
|
var result = {};
|
|
6667
6667
|
if (mod != null) {
|
|
6668
|
-
for (var
|
|
6668
|
+
for (var k4 in mod) if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) __createBinding(result, mod, k4);
|
|
6669
6669
|
}
|
|
6670
6670
|
__setModuleDefault(result, mod);
|
|
6671
6671
|
return result;
|
|
@@ -6714,18 +6714,18 @@ var require_dist = __commonJS({
|
|
|
6714
6714
|
"node_modules/agent-base/dist/index.js"(exports) {
|
|
6715
6715
|
"use strict";
|
|
6716
6716
|
init_define_MESSENGER_BUILD_INFO();
|
|
6717
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2,
|
|
6718
|
-
if (k22 === void 0) k22 =
|
|
6719
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
6720
|
-
if (!desc || ("get" in desc ? !
|
|
6717
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m3, k4, k22) {
|
|
6718
|
+
if (k22 === void 0) k22 = k4;
|
|
6719
|
+
var desc = Object.getOwnPropertyDescriptor(m3, k4);
|
|
6720
|
+
if (!desc || ("get" in desc ? !m3.__esModule : desc.writable || desc.configurable)) {
|
|
6721
6721
|
desc = { enumerable: true, get: function() {
|
|
6722
|
-
return
|
|
6722
|
+
return m3[k4];
|
|
6723
6723
|
} };
|
|
6724
6724
|
}
|
|
6725
6725
|
Object.defineProperty(o2, k22, desc);
|
|
6726
|
-
} : function(o2,
|
|
6727
|
-
if (k22 === void 0) k22 =
|
|
6728
|
-
o2[k22] =
|
|
6726
|
+
} : function(o2, m3, k4, k22) {
|
|
6727
|
+
if (k22 === void 0) k22 = k4;
|
|
6728
|
+
o2[k22] = m3[k4];
|
|
6729
6729
|
});
|
|
6730
6730
|
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o2, v3) {
|
|
6731
6731
|
Object.defineProperty(o2, "default", { enumerable: true, value: v3 });
|
|
@@ -6736,13 +6736,13 @@ var require_dist = __commonJS({
|
|
|
6736
6736
|
if (mod && mod.__esModule) return mod;
|
|
6737
6737
|
var result = {};
|
|
6738
6738
|
if (mod != null) {
|
|
6739
|
-
for (var
|
|
6739
|
+
for (var k4 in mod) if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) __createBinding(result, mod, k4);
|
|
6740
6740
|
}
|
|
6741
6741
|
__setModuleDefault(result, mod);
|
|
6742
6742
|
return result;
|
|
6743
6743
|
};
|
|
6744
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
6745
|
-
for (var
|
|
6744
|
+
var __exportStar = exports && exports.__exportStar || function(m3, exports2) {
|
|
6745
|
+
for (var p3 in m3) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p3)) __createBinding(exports2, m3, p3);
|
|
6746
6746
|
};
|
|
6747
6747
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6748
6748
|
exports.Agent = void 0;
|
|
@@ -6883,9 +6883,9 @@ var require_parse_proxy_response = __commonJS({
|
|
|
6883
6883
|
let buffersLength = 0;
|
|
6884
6884
|
const buffers = [];
|
|
6885
6885
|
function read() {
|
|
6886
|
-
const
|
|
6887
|
-
if (
|
|
6888
|
-
ondata(
|
|
6886
|
+
const b3 = socket.read();
|
|
6887
|
+
if (b3)
|
|
6888
|
+
ondata(b3);
|
|
6889
6889
|
else
|
|
6890
6890
|
socket.once("readable", read);
|
|
6891
6891
|
}
|
|
@@ -6904,9 +6904,9 @@ var require_parse_proxy_response = __commonJS({
|
|
|
6904
6904
|
debug("onerror %o", err);
|
|
6905
6905
|
reject(err);
|
|
6906
6906
|
}
|
|
6907
|
-
function ondata(
|
|
6908
|
-
buffers.push(
|
|
6909
|
-
buffersLength +=
|
|
6907
|
+
function ondata(b3) {
|
|
6908
|
+
buffers.push(b3);
|
|
6909
|
+
buffersLength += b3.length;
|
|
6910
6910
|
const buffered = Buffer.concat(buffers, buffersLength);
|
|
6911
6911
|
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
6912
6912
|
if (endOfHeaders === -1) {
|
|
@@ -6968,18 +6968,18 @@ var require_dist2 = __commonJS({
|
|
|
6968
6968
|
"node_modules/https-proxy-agent/dist/index.js"(exports) {
|
|
6969
6969
|
"use strict";
|
|
6970
6970
|
init_define_MESSENGER_BUILD_INFO();
|
|
6971
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2,
|
|
6972
|
-
if (k22 === void 0) k22 =
|
|
6973
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
6974
|
-
if (!desc || ("get" in desc ? !
|
|
6971
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o2, m3, k4, k22) {
|
|
6972
|
+
if (k22 === void 0) k22 = k4;
|
|
6973
|
+
var desc = Object.getOwnPropertyDescriptor(m3, k4);
|
|
6974
|
+
if (!desc || ("get" in desc ? !m3.__esModule : desc.writable || desc.configurable)) {
|
|
6975
6975
|
desc = { enumerable: true, get: function() {
|
|
6976
|
-
return
|
|
6976
|
+
return m3[k4];
|
|
6977
6977
|
} };
|
|
6978
6978
|
}
|
|
6979
6979
|
Object.defineProperty(o2, k22, desc);
|
|
6980
|
-
} : function(o2,
|
|
6981
|
-
if (k22 === void 0) k22 =
|
|
6982
|
-
o2[k22] =
|
|
6980
|
+
} : function(o2, m3, k4, k22) {
|
|
6981
|
+
if (k22 === void 0) k22 = k4;
|
|
6982
|
+
o2[k22] = m3[k4];
|
|
6983
6983
|
});
|
|
6984
6984
|
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o2, v3) {
|
|
6985
6985
|
Object.defineProperty(o2, "default", { enumerable: true, value: v3 });
|
|
@@ -6990,7 +6990,7 @@ var require_dist2 = __commonJS({
|
|
|
6990
6990
|
if (mod && mod.__esModule) return mod;
|
|
6991
6991
|
var result = {};
|
|
6992
6992
|
if (mod != null) {
|
|
6993
|
-
for (var
|
|
6993
|
+
for (var k4 in mod) if (k4 !== "default" && Object.prototype.hasOwnProperty.call(mod, k4)) __createBinding(result, mod, k4);
|
|
6994
6994
|
}
|
|
6995
6995
|
__setModuleDefault(result, mod);
|
|
6996
6996
|
return result;
|
|
@@ -9211,7 +9211,7 @@ var require_sender = __commonJS({
|
|
|
9211
9211
|
const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
|
|
9212
9212
|
this._bufferedBytes += options[kByteLength];
|
|
9213
9213
|
this._state = DEFLATING;
|
|
9214
|
-
perMessageDeflate.compress(data, options.fin, (
|
|
9214
|
+
perMessageDeflate.compress(data, options.fin, (_4, buf) => {
|
|
9215
9215
|
if (this._socket.destroyed) {
|
|
9216
9216
|
const err = new Error(
|
|
9217
9217
|
"The socket was closed while data was being compressed"
|
|
@@ -9653,10 +9653,10 @@ var require_extension = __commonJS({
|
|
|
9653
9653
|
if (!Array.isArray(configurations)) configurations = [configurations];
|
|
9654
9654
|
return configurations.map((params) => {
|
|
9655
9655
|
return [extension2].concat(
|
|
9656
|
-
Object.keys(params).map((
|
|
9657
|
-
let values = params[
|
|
9656
|
+
Object.keys(params).map((k4) => {
|
|
9657
|
+
let values = params[k4];
|
|
9658
9658
|
if (!Array.isArray(values)) values = [values];
|
|
9659
|
-
return values.map((v3) => v3 === true ?
|
|
9659
|
+
return values.map((v3) => v3 === true ? k4 : `${k4}=${v3}`).join("; ");
|
|
9660
9660
|
})
|
|
9661
9661
|
).join("; ");
|
|
9662
9662
|
}).join(", ");
|
|
@@ -9676,7 +9676,7 @@ var require_websocket = __commonJS({
|
|
|
9676
9676
|
var http = __require("http");
|
|
9677
9677
|
var net = __require("net");
|
|
9678
9678
|
var tls = __require("tls");
|
|
9679
|
-
var { randomBytes: randomBytes2, createHash:
|
|
9679
|
+
var { randomBytes: randomBytes2, createHash: createHash4 } = __require("crypto");
|
|
9680
9680
|
var { Duplex, Readable } = __require("stream");
|
|
9681
9681
|
var { URL: URL2 } = __require("url");
|
|
9682
9682
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -10344,7 +10344,7 @@ var require_websocket = __commonJS({
|
|
|
10344
10344
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
10345
10345
|
return;
|
|
10346
10346
|
}
|
|
10347
|
-
const digest =
|
|
10347
|
+
const digest = createHash4("sha1").update(key + GUID).digest("base64");
|
|
10348
10348
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
10349
10349
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
10350
10350
|
return;
|
|
@@ -10716,7 +10716,7 @@ var require_websocket_server = __commonJS({
|
|
|
10716
10716
|
var EventEmitter = __require("events");
|
|
10717
10717
|
var http = __require("http");
|
|
10718
10718
|
var { Duplex } = __require("stream");
|
|
10719
|
-
var { createHash:
|
|
10719
|
+
var { createHash: createHash4 } = __require("crypto");
|
|
10720
10720
|
var extension2 = require_extension();
|
|
10721
10721
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
10722
10722
|
var subprotocol2 = require_subprotocol();
|
|
@@ -11023,7 +11023,7 @@ var require_websocket_server = __commonJS({
|
|
|
11023
11023
|
);
|
|
11024
11024
|
}
|
|
11025
11025
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
11026
|
-
const digest =
|
|
11026
|
+
const digest = createHash4("sha1").update(key + GUID).digest("base64");
|
|
11027
11027
|
const headers = [
|
|
11028
11028
|
"HTTP/1.1 101 Switching Protocols",
|
|
11029
11029
|
"Upgrade: websocket",
|
|
@@ -11095,7 +11095,7 @@ var require_websocket_server = __commonJS({
|
|
|
11095
11095
|
socket.once("finish", socket.destroy);
|
|
11096
11096
|
socket.end(
|
|
11097
11097
|
`HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r
|
|
11098
|
-
` + Object.keys(headers).map((
|
|
11098
|
+
` + Object.keys(headers).map((h3) => `${h3}: ${headers[h3]}`).join("\r\n") + "\r\n\r\n" + message
|
|
11099
11099
|
);
|
|
11100
11100
|
}
|
|
11101
11101
|
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
|
|
@@ -11115,7 +11115,7 @@ init_define_MESSENGER_BUILD_INFO();
|
|
|
11115
11115
|
import { existsSync } from "node:fs";
|
|
11116
11116
|
import { readFile, realpath, stat } from "node:fs/promises";
|
|
11117
11117
|
import { createServer } from "node:http";
|
|
11118
|
-
import { dirname as
|
|
11118
|
+
import { dirname as dirname3, extname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
11119
11119
|
import { fileURLToPath } from "node:url";
|
|
11120
11120
|
import { Worker } from "node:worker_threads";
|
|
11121
11121
|
|
|
@@ -11125,6 +11125,114 @@ init_define_MESSENGER_BUILD_INFO();
|
|
|
11125
11125
|
// src/conversation.ts
|
|
11126
11126
|
init_define_MESSENGER_BUILD_INFO();
|
|
11127
11127
|
|
|
11128
|
+
// src/typed-commands.ts
|
|
11129
|
+
init_define_MESSENGER_BUILD_INFO();
|
|
11130
|
+
import { createHash } from "node:crypto";
|
|
11131
|
+
var MAX_COMMANDS = 64;
|
|
11132
|
+
var MAX_COMMAND_NAME_LENGTH = 128;
|
|
11133
|
+
var MAX_COMMAND_DESCRIPTION_LENGTH = 2048;
|
|
11134
|
+
var MAX_SCHEMA_BYTES = 64 * 1024;
|
|
11135
|
+
var MAX_JSON_DEPTH = 12;
|
|
11136
|
+
var MAX_JSON_NODES = 2048;
|
|
11137
|
+
function jsonMetrics(value, depth = 0) {
|
|
11138
|
+
if (depth > MAX_JSON_DEPTH) throw new Error(`JSON value exceeds depth ${MAX_JSON_DEPTH}`);
|
|
11139
|
+
if (value === null || typeof value !== "object") return { nodes: 1, depth };
|
|
11140
|
+
let nodes = 1;
|
|
11141
|
+
let deepest = depth;
|
|
11142
|
+
const values = Array.isArray(value) ? value : Object.values(value);
|
|
11143
|
+
for (const child of values) {
|
|
11144
|
+
const measured = jsonMetrics(child, depth + 1);
|
|
11145
|
+
nodes += measured.nodes;
|
|
11146
|
+
deepest = Math.max(deepest, measured.depth);
|
|
11147
|
+
if (nodes > MAX_JSON_NODES) throw new Error(`JSON value exceeds ${MAX_JSON_NODES} nodes`);
|
|
11148
|
+
}
|
|
11149
|
+
return { nodes, depth: deepest };
|
|
11150
|
+
}
|
|
11151
|
+
function requireBoundedJson(value, label = "arguments") {
|
|
11152
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11153
|
+
const visit = (item, depth) => {
|
|
11154
|
+
if (depth > MAX_JSON_DEPTH) throw new Error(`${label} exceeds depth ${MAX_JSON_DEPTH}`);
|
|
11155
|
+
if (item === null || typeof item === "string" || typeof item === "boolean") return;
|
|
11156
|
+
if (typeof item === "number" && Number.isFinite(item)) return;
|
|
11157
|
+
if (typeof item !== "object" || seen.has(item)) throw new Error(`${label} must be valid JSON`);
|
|
11158
|
+
if (!Array.isArray(item) && Object.getPrototypeOf(item) !== Object.prototype) {
|
|
11159
|
+
throw new Error(`${label} must be valid JSON`);
|
|
11160
|
+
}
|
|
11161
|
+
seen.add(item);
|
|
11162
|
+
for (const child of Array.isArray(item) ? item : Object.values(item)) visit(child, depth + 1);
|
|
11163
|
+
seen.delete(item);
|
|
11164
|
+
};
|
|
11165
|
+
visit(value, 0);
|
|
11166
|
+
jsonMetrics(value);
|
|
11167
|
+
if (Buffer.byteLength(JSON.stringify(value), "utf8") > MAX_SCHEMA_BYTES) {
|
|
11168
|
+
throw new Error(`${label} exceeds ${MAX_SCHEMA_BYTES} bytes`);
|
|
11169
|
+
}
|
|
11170
|
+
}
|
|
11171
|
+
function canonical(value) {
|
|
11172
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
11173
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
11174
|
+
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonical(value[key])}`).join(",")}}`;
|
|
11175
|
+
}
|
|
11176
|
+
function projectCatalog(recipientCid, commands) {
|
|
11177
|
+
if (commands.length > MAX_COMMANDS) throw new Error(`command catalog exceeds ${MAX_COMMANDS} entries`);
|
|
11178
|
+
const projected = commands.map((command) => {
|
|
11179
|
+
if (!command.name || command.name.length > MAX_COMMAND_NAME_LENGTH) throw new Error("command name is invalid or too long");
|
|
11180
|
+
if (command.description !== void 0 && command.description.length > MAX_COMMAND_DESCRIPTION_LENGTH) {
|
|
11181
|
+
throw new Error("command description is too long");
|
|
11182
|
+
}
|
|
11183
|
+
requireBoundedJson(command.input_schema, `schema for ${command.name}`);
|
|
11184
|
+
return {
|
|
11185
|
+
name: command.name,
|
|
11186
|
+
...command.description === void 0 ? {} : { description: command.description },
|
|
11187
|
+
input_schema: command.input_schema
|
|
11188
|
+
};
|
|
11189
|
+
});
|
|
11190
|
+
const fingerprint2 = createHash("sha256").update(canonical({
|
|
11191
|
+
recipient_cid: recipientCid,
|
|
11192
|
+
commands: projected
|
|
11193
|
+
})).digest("base64url");
|
|
11194
|
+
return { recipient_cid: recipientCid, fingerprint: fingerprint2, commands: projected };
|
|
11195
|
+
}
|
|
11196
|
+
function parseTypedEnvelope(wireKind, body) {
|
|
11197
|
+
if (wireKind === "text") return null;
|
|
11198
|
+
if (wireKind !== "command" && wireKind !== "command_result") {
|
|
11199
|
+
return { kind: "unknown", wire_kind: wireKind, malformed: false };
|
|
11200
|
+
}
|
|
11201
|
+
let parsed;
|
|
11202
|
+
try {
|
|
11203
|
+
parsed = JSON.parse(body);
|
|
11204
|
+
} catch {
|
|
11205
|
+
return { kind: "unknown", wire_kind: wireKind, malformed: true };
|
|
11206
|
+
}
|
|
11207
|
+
try {
|
|
11208
|
+
requireBoundedJson(parsed, wireKind);
|
|
11209
|
+
} catch {
|
|
11210
|
+
return { kind: "unknown", wire_kind: wireKind, malformed: true };
|
|
11211
|
+
}
|
|
11212
|
+
if (wireKind === "command") {
|
|
11213
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
11214
|
+
return { kind: "unknown", wire_kind: wireKind, malformed: true };
|
|
11215
|
+
}
|
|
11216
|
+
const record2 = parsed;
|
|
11217
|
+
if (typeof record2.command !== "string" || record2.command.length === 0 || record2.command.length > MAX_COMMAND_NAME_LENGTH || !Object.hasOwn(record2, "arguments")) {
|
|
11218
|
+
return { kind: "unknown", wire_kind: wireKind, malformed: true };
|
|
11219
|
+
}
|
|
11220
|
+
return { kind: "command", command: record2.command, arguments: record2.arguments };
|
|
11221
|
+
}
|
|
11222
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
11223
|
+
return { kind: "unknown", wire_kind: wireKind, malformed: true };
|
|
11224
|
+
}
|
|
11225
|
+
const record = parsed;
|
|
11226
|
+
const keys = Object.keys(record).sort();
|
|
11227
|
+
if (record.ok === true && keys.length === 2 && keys[0] === "ok" && keys[1] === "result" && Object.hasOwn(record, "result")) {
|
|
11228
|
+
return { kind: "command_result", outcome: { ok: true, result: record.result } };
|
|
11229
|
+
}
|
|
11230
|
+
if (record.ok === false && keys.length === 2 && keys[0] === "error" && keys[1] === "ok" && typeof record.error === "string" && record.error.length > 0 && record.error.length <= MAX_COMMAND_DESCRIPTION_LENGTH) {
|
|
11231
|
+
return { kind: "command_result", outcome: { ok: false, error: record.error } };
|
|
11232
|
+
}
|
|
11233
|
+
return { kind: "unknown", wire_kind: wireKind, malformed: true };
|
|
11234
|
+
}
|
|
11235
|
+
|
|
11128
11236
|
// shared/roomMessageCore.mjs
|
|
11129
11237
|
init_define_MESSENGER_BUILD_INFO();
|
|
11130
11238
|
var ROOM_VOICE_ROLE = "room";
|
|
@@ -11379,8 +11487,11 @@ function projectHistoryPage(contact, history, summary, opts = {}) {
|
|
|
11379
11487
|
date: row.date,
|
|
11380
11488
|
read: row.direction === "out" || row.inbox_state === "read",
|
|
11381
11489
|
wire_id: row.wire_id,
|
|
11490
|
+
peer_cid: row.peer.id,
|
|
11382
11491
|
receipt: row.direction === "out" && (row.delivery_state === "delivered" || row.delivery_state === "read") ? row.delivery_state : null,
|
|
11383
|
-
reply_to: row.reply_to
|
|
11492
|
+
reply_to: row.reply_to,
|
|
11493
|
+
message_kind: row.message_kind ?? "text",
|
|
11494
|
+
typed: parseTypedEnvelope(row.message_kind ?? "text", row.body)
|
|
11384
11495
|
})).reverse();
|
|
11385
11496
|
return {
|
|
11386
11497
|
contact,
|
|
@@ -11512,6 +11623,102 @@ function toSse(event, identity) {
|
|
|
11512
11623
|
return { event: type, data: { v: 1, ...metadata } };
|
|
11513
11624
|
}
|
|
11514
11625
|
|
|
11626
|
+
// src/command-invocations.ts
|
|
11627
|
+
init_define_MESSENGER_BUILD_INFO();
|
|
11628
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
11629
|
+
import { chmodSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
11630
|
+
import { dirname, join } from "node:path";
|
|
11631
|
+
var MAX_INVOCATIONS = 4096;
|
|
11632
|
+
var InvocationConflictError = class extends Error {
|
|
11633
|
+
};
|
|
11634
|
+
var InvocationCapacityError = class extends Error {
|
|
11635
|
+
};
|
|
11636
|
+
function canonical2(value) {
|
|
11637
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
11638
|
+
if (Array.isArray(value)) return `[${value.map(canonical2).join(",")}]`;
|
|
11639
|
+
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonical2(value[key])}`).join(",")}}`;
|
|
11640
|
+
}
|
|
11641
|
+
function invocationFingerprint(input) {
|
|
11642
|
+
return createHash2("sha256").update(canonical2(input)).digest("base64url");
|
|
11643
|
+
}
|
|
11644
|
+
function validRecord(value) {
|
|
11645
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
11646
|
+
const row = value;
|
|
11647
|
+
return typeof row.invocation_id === "string" && typeof row.recipient_cid === "string" && typeof row.payload_fingerprint === "string" && typeof row.command === "string" && typeof row.catalog_fingerprint === "string" && typeof row.created_at === "string" && (row.status === "indeterminate" || row.status === "accepted" || row.status === "pending" || row.status === "failed") && (row.wire_id === null || typeof row.wire_id === "string") && typeof row.delivery === "string";
|
|
11648
|
+
}
|
|
11649
|
+
var CommandInvocationStore = class _CommandInvocationStore {
|
|
11650
|
+
constructor(file, state, capacity) {
|
|
11651
|
+
this.file = file;
|
|
11652
|
+
this.state = state;
|
|
11653
|
+
this.capacity = capacity;
|
|
11654
|
+
}
|
|
11655
|
+
static open(stateDir, identityCid, capacity = MAX_INVOCATIONS) {
|
|
11656
|
+
if (!Number.isInteger(capacity) || capacity < 1) throw new Error("invocation capacity must be a positive integer");
|
|
11657
|
+
const file = join(stateDir, `typed-commands-${createHash2("sha256").update(identityCid).digest("hex").slice(0, 24)}.json`);
|
|
11658
|
+
let state = { version: 1, records: {} };
|
|
11659
|
+
try {
|
|
11660
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
11661
|
+
if (!parsed || typeof parsed !== "object" || parsed.version !== 1 || !parsed.records || typeof parsed.records !== "object" || !Object.values(parsed.records).every(validRecord)) {
|
|
11662
|
+
throw new Error("invalid typed command invocation state");
|
|
11663
|
+
}
|
|
11664
|
+
state = parsed;
|
|
11665
|
+
} catch (error) {
|
|
11666
|
+
if (error.code !== "ENOENT") throw error;
|
|
11667
|
+
}
|
|
11668
|
+
return new _CommandInvocationStore(file, state, capacity);
|
|
11669
|
+
}
|
|
11670
|
+
find(input) {
|
|
11671
|
+
const existing = this.state.records[input.invocation_id];
|
|
11672
|
+
if (!existing) return null;
|
|
11673
|
+
if (existing.recipient_cid !== input.recipient_cid || existing.payload_fingerprint !== input.payload_fingerprint) {
|
|
11674
|
+
throw new InvocationConflictError("invocation_id is already bound to a different recipient or payload");
|
|
11675
|
+
}
|
|
11676
|
+
return existing;
|
|
11677
|
+
}
|
|
11678
|
+
begin(input) {
|
|
11679
|
+
const existing = this.find(input);
|
|
11680
|
+
if (existing) return { fresh: false, record: existing };
|
|
11681
|
+
if (Object.keys(this.state.records).length >= this.capacity) {
|
|
11682
|
+
throw new InvocationCapacityError("typed command invocation store is full");
|
|
11683
|
+
}
|
|
11684
|
+
const record = {
|
|
11685
|
+
...input,
|
|
11686
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11687
|
+
status: "indeterminate",
|
|
11688
|
+
wire_id: null,
|
|
11689
|
+
delivery: "indeterminate"
|
|
11690
|
+
};
|
|
11691
|
+
this.state.records[input.invocation_id] = record;
|
|
11692
|
+
this.save();
|
|
11693
|
+
return { fresh: true, record };
|
|
11694
|
+
}
|
|
11695
|
+
complete(invocationId, update) {
|
|
11696
|
+
const current = this.state.records[invocationId];
|
|
11697
|
+
if (!current) throw new Error("invocation reservation is missing");
|
|
11698
|
+
const record = {
|
|
11699
|
+
...current,
|
|
11700
|
+
...update,
|
|
11701
|
+
status: statusFor(update.delivery, update.wire_id)
|
|
11702
|
+
};
|
|
11703
|
+
this.state.records[invocationId] = record;
|
|
11704
|
+
this.save();
|
|
11705
|
+
return record;
|
|
11706
|
+
}
|
|
11707
|
+
save() {
|
|
11708
|
+
mkdirSync(dirname(this.file), { recursive: true, mode: 448 });
|
|
11709
|
+
const temp = `${this.file}.${process.pid}.tmp`;
|
|
11710
|
+
writeFileSync(temp, JSON.stringify(this.state), { mode: 384 });
|
|
11711
|
+
chmodSync(temp, 384);
|
|
11712
|
+
renameSync(temp, this.file);
|
|
11713
|
+
}
|
|
11714
|
+
};
|
|
11715
|
+
function statusFor(delivery, wireId) {
|
|
11716
|
+
if (delivery === "refused") return "failed";
|
|
11717
|
+
if (delivery === "migrating" || delivery === "deferred") return "pending";
|
|
11718
|
+
if (wireId && (delivery === "e2e" || delivery === "sent" || delivery === "introduced")) return "accepted";
|
|
11719
|
+
return "indeterminate";
|
|
11720
|
+
}
|
|
11721
|
+
|
|
11515
11722
|
// src/html-preview-transform.ts
|
|
11516
11723
|
init_define_MESSENGER_BUILD_INFO();
|
|
11517
11724
|
|
|
@@ -17483,214 +17690,214 @@ var Parser = class {
|
|
|
17483
17690
|
}
|
|
17484
17691
|
}
|
|
17485
17692
|
};
|
|
17486
|
-
function aaObtainFormattingElementEntry(
|
|
17487
|
-
let formattingElementEntry =
|
|
17693
|
+
function aaObtainFormattingElementEntry(p3, token) {
|
|
17694
|
+
let formattingElementEntry = p3.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName);
|
|
17488
17695
|
if (formattingElementEntry) {
|
|
17489
|
-
if (!
|
|
17490
|
-
|
|
17696
|
+
if (!p3.openElements.contains(formattingElementEntry.element)) {
|
|
17697
|
+
p3.activeFormattingElements.removeEntry(formattingElementEntry);
|
|
17491
17698
|
formattingElementEntry = null;
|
|
17492
|
-
} else if (!
|
|
17699
|
+
} else if (!p3.openElements.hasInScope(token.tagID)) {
|
|
17493
17700
|
formattingElementEntry = null;
|
|
17494
17701
|
}
|
|
17495
17702
|
} else {
|
|
17496
|
-
genericEndTagInBody(
|
|
17703
|
+
genericEndTagInBody(p3, token);
|
|
17497
17704
|
}
|
|
17498
17705
|
return formattingElementEntry;
|
|
17499
17706
|
}
|
|
17500
|
-
function aaObtainFurthestBlock(
|
|
17707
|
+
function aaObtainFurthestBlock(p3, formattingElementEntry) {
|
|
17501
17708
|
let furthestBlock = null;
|
|
17502
|
-
let idx =
|
|
17709
|
+
let idx = p3.openElements.stackTop;
|
|
17503
17710
|
for (; idx >= 0; idx--) {
|
|
17504
|
-
const element =
|
|
17711
|
+
const element = p3.openElements.items[idx];
|
|
17505
17712
|
if (element === formattingElementEntry.element) {
|
|
17506
17713
|
break;
|
|
17507
17714
|
}
|
|
17508
|
-
if (
|
|
17715
|
+
if (p3._isSpecialElement(element, p3.openElements.tagIDs[idx])) {
|
|
17509
17716
|
furthestBlock = element;
|
|
17510
17717
|
}
|
|
17511
17718
|
}
|
|
17512
17719
|
if (!furthestBlock) {
|
|
17513
|
-
|
|
17514
|
-
|
|
17720
|
+
p3.openElements.shortenToLength(Math.max(idx, 0));
|
|
17721
|
+
p3.activeFormattingElements.removeEntry(formattingElementEntry);
|
|
17515
17722
|
}
|
|
17516
17723
|
return furthestBlock;
|
|
17517
17724
|
}
|
|
17518
|
-
function aaInnerLoop(
|
|
17725
|
+
function aaInnerLoop(p3, furthestBlock, formattingElement) {
|
|
17519
17726
|
let lastElement = furthestBlock;
|
|
17520
|
-
let nextElement =
|
|
17727
|
+
let nextElement = p3.openElements.getCommonAncestor(furthestBlock);
|
|
17521
17728
|
for (let i2 = 0, element = nextElement; element !== formattingElement; i2++, element = nextElement) {
|
|
17522
|
-
nextElement =
|
|
17523
|
-
const elementEntry =
|
|
17729
|
+
nextElement = p3.openElements.getCommonAncestor(element);
|
|
17730
|
+
const elementEntry = p3.activeFormattingElements.getElementEntry(element);
|
|
17524
17731
|
const counterOverflow = elementEntry && i2 >= AA_INNER_LOOP_ITER;
|
|
17525
17732
|
const shouldRemoveFromOpenElements = !elementEntry || counterOverflow;
|
|
17526
17733
|
if (shouldRemoveFromOpenElements) {
|
|
17527
17734
|
if (counterOverflow) {
|
|
17528
|
-
|
|
17735
|
+
p3.activeFormattingElements.removeEntry(elementEntry);
|
|
17529
17736
|
}
|
|
17530
|
-
|
|
17737
|
+
p3.openElements.remove(element);
|
|
17531
17738
|
} else {
|
|
17532
|
-
element = aaRecreateElementFromEntry(
|
|
17739
|
+
element = aaRecreateElementFromEntry(p3, elementEntry);
|
|
17533
17740
|
if (lastElement === furthestBlock) {
|
|
17534
|
-
|
|
17741
|
+
p3.activeFormattingElements.bookmark = elementEntry;
|
|
17535
17742
|
}
|
|
17536
|
-
|
|
17537
|
-
|
|
17743
|
+
p3.treeAdapter.detachNode(lastElement);
|
|
17744
|
+
p3.treeAdapter.appendChild(element, lastElement);
|
|
17538
17745
|
lastElement = element;
|
|
17539
17746
|
}
|
|
17540
17747
|
}
|
|
17541
17748
|
return lastElement;
|
|
17542
17749
|
}
|
|
17543
|
-
function aaRecreateElementFromEntry(
|
|
17544
|
-
const ns =
|
|
17545
|
-
const newElement =
|
|
17546
|
-
|
|
17750
|
+
function aaRecreateElementFromEntry(p3, elementEntry) {
|
|
17751
|
+
const ns = p3.treeAdapter.getNamespaceURI(elementEntry.element);
|
|
17752
|
+
const newElement = p3.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);
|
|
17753
|
+
p3.openElements.replace(elementEntry.element, newElement);
|
|
17547
17754
|
elementEntry.element = newElement;
|
|
17548
17755
|
return newElement;
|
|
17549
17756
|
}
|
|
17550
|
-
function aaInsertLastNodeInCommonAncestor(
|
|
17551
|
-
const tn =
|
|
17757
|
+
function aaInsertLastNodeInCommonAncestor(p3, commonAncestor, lastElement) {
|
|
17758
|
+
const tn = p3.treeAdapter.getTagName(commonAncestor);
|
|
17552
17759
|
const tid = getTagID(tn);
|
|
17553
|
-
if (
|
|
17554
|
-
|
|
17760
|
+
if (p3._isElementCausesFosterParenting(tid)) {
|
|
17761
|
+
p3._fosterParentElement(lastElement);
|
|
17555
17762
|
} else {
|
|
17556
|
-
const ns =
|
|
17763
|
+
const ns = p3.treeAdapter.getNamespaceURI(commonAncestor);
|
|
17557
17764
|
if (tid === TAG_ID.TEMPLATE && ns === NS.HTML) {
|
|
17558
|
-
commonAncestor =
|
|
17765
|
+
commonAncestor = p3.treeAdapter.getTemplateContent(commonAncestor);
|
|
17559
17766
|
}
|
|
17560
|
-
|
|
17767
|
+
p3.treeAdapter.appendChild(commonAncestor, lastElement);
|
|
17561
17768
|
}
|
|
17562
17769
|
}
|
|
17563
|
-
function aaReplaceFormattingElement(
|
|
17564
|
-
const ns =
|
|
17770
|
+
function aaReplaceFormattingElement(p3, furthestBlock, formattingElementEntry) {
|
|
17771
|
+
const ns = p3.treeAdapter.getNamespaceURI(formattingElementEntry.element);
|
|
17565
17772
|
const { token } = formattingElementEntry;
|
|
17566
|
-
const newElement =
|
|
17567
|
-
|
|
17568
|
-
|
|
17569
|
-
|
|
17570
|
-
|
|
17571
|
-
|
|
17572
|
-
|
|
17573
|
-
}
|
|
17574
|
-
function callAdoptionAgency(
|
|
17773
|
+
const newElement = p3.treeAdapter.createElement(token.tagName, ns, token.attrs);
|
|
17774
|
+
p3._adoptNodes(furthestBlock, newElement);
|
|
17775
|
+
p3.treeAdapter.appendChild(furthestBlock, newElement);
|
|
17776
|
+
p3.activeFormattingElements.insertElementAfterBookmark(newElement, token);
|
|
17777
|
+
p3.activeFormattingElements.removeEntry(formattingElementEntry);
|
|
17778
|
+
p3.openElements.remove(formattingElementEntry.element);
|
|
17779
|
+
p3.openElements.insertAfter(furthestBlock, newElement, token.tagID);
|
|
17780
|
+
}
|
|
17781
|
+
function callAdoptionAgency(p3, token) {
|
|
17575
17782
|
for (let i2 = 0; i2 < AA_OUTER_LOOP_ITER; i2++) {
|
|
17576
|
-
const formattingElementEntry = aaObtainFormattingElementEntry(
|
|
17783
|
+
const formattingElementEntry = aaObtainFormattingElementEntry(p3, token);
|
|
17577
17784
|
if (!formattingElementEntry) {
|
|
17578
17785
|
break;
|
|
17579
17786
|
}
|
|
17580
|
-
const furthestBlock = aaObtainFurthestBlock(
|
|
17787
|
+
const furthestBlock = aaObtainFurthestBlock(p3, formattingElementEntry);
|
|
17581
17788
|
if (!furthestBlock) {
|
|
17582
17789
|
break;
|
|
17583
17790
|
}
|
|
17584
|
-
|
|
17585
|
-
const lastElement = aaInnerLoop(
|
|
17586
|
-
const commonAncestor =
|
|
17587
|
-
|
|
17791
|
+
p3.activeFormattingElements.bookmark = formattingElementEntry;
|
|
17792
|
+
const lastElement = aaInnerLoop(p3, furthestBlock, formattingElementEntry.element);
|
|
17793
|
+
const commonAncestor = p3.openElements.getCommonAncestor(formattingElementEntry.element);
|
|
17794
|
+
p3.treeAdapter.detachNode(lastElement);
|
|
17588
17795
|
if (commonAncestor)
|
|
17589
|
-
aaInsertLastNodeInCommonAncestor(
|
|
17590
|
-
aaReplaceFormattingElement(
|
|
17796
|
+
aaInsertLastNodeInCommonAncestor(p3, commonAncestor, lastElement);
|
|
17797
|
+
aaReplaceFormattingElement(p3, furthestBlock, formattingElementEntry);
|
|
17591
17798
|
}
|
|
17592
17799
|
}
|
|
17593
|
-
function appendComment(
|
|
17594
|
-
|
|
17800
|
+
function appendComment(p3, token) {
|
|
17801
|
+
p3._appendCommentNode(token, p3.openElements.currentTmplContentOrNode);
|
|
17595
17802
|
}
|
|
17596
|
-
function appendCommentToRootHtmlElement(
|
|
17597
|
-
|
|
17803
|
+
function appendCommentToRootHtmlElement(p3, token) {
|
|
17804
|
+
p3._appendCommentNode(token, p3.openElements.items[0]);
|
|
17598
17805
|
}
|
|
17599
|
-
function appendCommentToDocument(
|
|
17600
|
-
|
|
17806
|
+
function appendCommentToDocument(p3, token) {
|
|
17807
|
+
p3._appendCommentNode(token, p3.document);
|
|
17601
17808
|
}
|
|
17602
|
-
function stopParsing(
|
|
17603
|
-
|
|
17809
|
+
function stopParsing(p3, token) {
|
|
17810
|
+
p3.stopped = true;
|
|
17604
17811
|
if (token.location) {
|
|
17605
|
-
const target =
|
|
17606
|
-
for (let i2 =
|
|
17607
|
-
|
|
17812
|
+
const target = p3.fragmentContext ? 0 : 2;
|
|
17813
|
+
for (let i2 = p3.openElements.stackTop; i2 >= target; i2--) {
|
|
17814
|
+
p3._setEndLocation(p3.openElements.items[i2], token);
|
|
17608
17815
|
}
|
|
17609
|
-
if (!
|
|
17610
|
-
const htmlElement =
|
|
17611
|
-
const htmlLocation =
|
|
17816
|
+
if (!p3.fragmentContext && p3.openElements.stackTop >= 0) {
|
|
17817
|
+
const htmlElement = p3.openElements.items[0];
|
|
17818
|
+
const htmlLocation = p3.treeAdapter.getNodeSourceCodeLocation(htmlElement);
|
|
17612
17819
|
if (htmlLocation && !htmlLocation.endTag) {
|
|
17613
|
-
|
|
17614
|
-
if (
|
|
17615
|
-
const bodyElement =
|
|
17616
|
-
const bodyLocation =
|
|
17820
|
+
p3._setEndLocation(htmlElement, token);
|
|
17821
|
+
if (p3.openElements.stackTop >= 1) {
|
|
17822
|
+
const bodyElement = p3.openElements.items[1];
|
|
17823
|
+
const bodyLocation = p3.treeAdapter.getNodeSourceCodeLocation(bodyElement);
|
|
17617
17824
|
if (bodyLocation && !bodyLocation.endTag) {
|
|
17618
|
-
|
|
17825
|
+
p3._setEndLocation(bodyElement, token);
|
|
17619
17826
|
}
|
|
17620
17827
|
}
|
|
17621
17828
|
}
|
|
17622
17829
|
}
|
|
17623
17830
|
}
|
|
17624
17831
|
}
|
|
17625
|
-
function doctypeInInitialMode(
|
|
17626
|
-
|
|
17832
|
+
function doctypeInInitialMode(p3, token) {
|
|
17833
|
+
p3._setDocumentType(token);
|
|
17627
17834
|
const mode = token.forceQuirks ? DOCUMENT_MODE.QUIRKS : getDocumentMode(token);
|
|
17628
17835
|
if (!isConforming(token)) {
|
|
17629
|
-
|
|
17836
|
+
p3._err(token, ERR.nonConformingDoctype);
|
|
17630
17837
|
}
|
|
17631
|
-
|
|
17632
|
-
|
|
17838
|
+
p3.treeAdapter.setDocumentMode(p3.document, mode);
|
|
17839
|
+
p3.insertionMode = InsertionMode.BEFORE_HTML;
|
|
17633
17840
|
}
|
|
17634
|
-
function tokenInInitialMode(
|
|
17635
|
-
|
|
17636
|
-
|
|
17637
|
-
|
|
17638
|
-
|
|
17841
|
+
function tokenInInitialMode(p3, token) {
|
|
17842
|
+
p3._err(token, ERR.missingDoctype, true);
|
|
17843
|
+
p3.treeAdapter.setDocumentMode(p3.document, DOCUMENT_MODE.QUIRKS);
|
|
17844
|
+
p3.insertionMode = InsertionMode.BEFORE_HTML;
|
|
17845
|
+
p3._processToken(token);
|
|
17639
17846
|
}
|
|
17640
|
-
function startTagBeforeHtml(
|
|
17847
|
+
function startTagBeforeHtml(p3, token) {
|
|
17641
17848
|
if (token.tagID === TAG_ID.HTML) {
|
|
17642
|
-
|
|
17643
|
-
|
|
17849
|
+
p3._insertElement(token, NS.HTML);
|
|
17850
|
+
p3.insertionMode = InsertionMode.BEFORE_HEAD;
|
|
17644
17851
|
} else {
|
|
17645
|
-
tokenBeforeHtml(
|
|
17852
|
+
tokenBeforeHtml(p3, token);
|
|
17646
17853
|
}
|
|
17647
17854
|
}
|
|
17648
|
-
function endTagBeforeHtml(
|
|
17855
|
+
function endTagBeforeHtml(p3, token) {
|
|
17649
17856
|
const tn = token.tagID;
|
|
17650
17857
|
if (tn === TAG_ID.HTML || tn === TAG_ID.HEAD || tn === TAG_ID.BODY || tn === TAG_ID.BR) {
|
|
17651
|
-
tokenBeforeHtml(
|
|
17858
|
+
tokenBeforeHtml(p3, token);
|
|
17652
17859
|
}
|
|
17653
17860
|
}
|
|
17654
|
-
function tokenBeforeHtml(
|
|
17655
|
-
|
|
17656
|
-
|
|
17657
|
-
|
|
17861
|
+
function tokenBeforeHtml(p3, token) {
|
|
17862
|
+
p3._insertFakeRootElement();
|
|
17863
|
+
p3.insertionMode = InsertionMode.BEFORE_HEAD;
|
|
17864
|
+
p3._processToken(token);
|
|
17658
17865
|
}
|
|
17659
|
-
function startTagBeforeHead(
|
|
17866
|
+
function startTagBeforeHead(p3, token) {
|
|
17660
17867
|
switch (token.tagID) {
|
|
17661
17868
|
case TAG_ID.HTML: {
|
|
17662
|
-
startTagInBody(
|
|
17869
|
+
startTagInBody(p3, token);
|
|
17663
17870
|
break;
|
|
17664
17871
|
}
|
|
17665
17872
|
case TAG_ID.HEAD: {
|
|
17666
|
-
|
|
17667
|
-
|
|
17668
|
-
|
|
17873
|
+
p3._insertElement(token, NS.HTML);
|
|
17874
|
+
p3.headElement = p3.openElements.current;
|
|
17875
|
+
p3.insertionMode = InsertionMode.IN_HEAD;
|
|
17669
17876
|
break;
|
|
17670
17877
|
}
|
|
17671
17878
|
default: {
|
|
17672
|
-
tokenBeforeHead(
|
|
17879
|
+
tokenBeforeHead(p3, token);
|
|
17673
17880
|
}
|
|
17674
17881
|
}
|
|
17675
17882
|
}
|
|
17676
|
-
function endTagBeforeHead(
|
|
17883
|
+
function endTagBeforeHead(p3, token) {
|
|
17677
17884
|
const tn = token.tagID;
|
|
17678
17885
|
if (tn === TAG_ID.HEAD || tn === TAG_ID.BODY || tn === TAG_ID.HTML || tn === TAG_ID.BR) {
|
|
17679
|
-
tokenBeforeHead(
|
|
17886
|
+
tokenBeforeHead(p3, token);
|
|
17680
17887
|
} else {
|
|
17681
|
-
|
|
17888
|
+
p3._err(token, ERR.endTagWithoutMatchingOpenElement);
|
|
17682
17889
|
}
|
|
17683
17890
|
}
|
|
17684
|
-
function tokenBeforeHead(
|
|
17685
|
-
|
|
17686
|
-
|
|
17687
|
-
|
|
17688
|
-
|
|
17891
|
+
function tokenBeforeHead(p3, token) {
|
|
17892
|
+
p3._insertFakeElement(TAG_NAMES.HEAD, TAG_ID.HEAD);
|
|
17893
|
+
p3.headElement = p3.openElements.current;
|
|
17894
|
+
p3.insertionMode = InsertionMode.IN_HEAD;
|
|
17895
|
+
p3._processToken(token);
|
|
17689
17896
|
}
|
|
17690
|
-
function startTagInHead(
|
|
17897
|
+
function startTagInHead(p3, token) {
|
|
17691
17898
|
switch (token.tagID) {
|
|
17692
17899
|
case TAG_ID.HTML: {
|
|
17693
|
-
startTagInBody(
|
|
17900
|
+
startTagInBody(p3, token);
|
|
17694
17901
|
break;
|
|
17695
17902
|
}
|
|
17696
17903
|
case TAG_ID.BASE:
|
|
@@ -17698,94 +17905,94 @@ function startTagInHead(p4, token) {
|
|
|
17698
17905
|
case TAG_ID.BGSOUND:
|
|
17699
17906
|
case TAG_ID.LINK:
|
|
17700
17907
|
case TAG_ID.META: {
|
|
17701
|
-
|
|
17908
|
+
p3._appendElement(token, NS.HTML);
|
|
17702
17909
|
token.ackSelfClosing = true;
|
|
17703
17910
|
break;
|
|
17704
17911
|
}
|
|
17705
17912
|
case TAG_ID.TITLE: {
|
|
17706
|
-
|
|
17913
|
+
p3._switchToTextParsing(token, TokenizerMode.RCDATA);
|
|
17707
17914
|
break;
|
|
17708
17915
|
}
|
|
17709
17916
|
case TAG_ID.NOSCRIPT: {
|
|
17710
|
-
if (
|
|
17711
|
-
|
|
17917
|
+
if (p3.options.scriptingEnabled) {
|
|
17918
|
+
p3._switchToTextParsing(token, TokenizerMode.RAWTEXT);
|
|
17712
17919
|
} else {
|
|
17713
|
-
|
|
17714
|
-
|
|
17920
|
+
p3._insertElement(token, NS.HTML);
|
|
17921
|
+
p3.insertionMode = InsertionMode.IN_HEAD_NO_SCRIPT;
|
|
17715
17922
|
}
|
|
17716
17923
|
break;
|
|
17717
17924
|
}
|
|
17718
17925
|
case TAG_ID.NOFRAMES:
|
|
17719
17926
|
case TAG_ID.STYLE: {
|
|
17720
|
-
|
|
17927
|
+
p3._switchToTextParsing(token, TokenizerMode.RAWTEXT);
|
|
17721
17928
|
break;
|
|
17722
17929
|
}
|
|
17723
17930
|
case TAG_ID.SCRIPT: {
|
|
17724
|
-
|
|
17931
|
+
p3._switchToTextParsing(token, TokenizerMode.SCRIPT_DATA);
|
|
17725
17932
|
break;
|
|
17726
17933
|
}
|
|
17727
17934
|
case TAG_ID.TEMPLATE: {
|
|
17728
|
-
|
|
17729
|
-
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17935
|
+
p3._insertTemplate(token);
|
|
17936
|
+
p3.activeFormattingElements.insertMarker();
|
|
17937
|
+
p3.framesetOk = false;
|
|
17938
|
+
p3.insertionMode = InsertionMode.IN_TEMPLATE;
|
|
17939
|
+
p3.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);
|
|
17733
17940
|
break;
|
|
17734
17941
|
}
|
|
17735
17942
|
case TAG_ID.HEAD: {
|
|
17736
|
-
|
|
17943
|
+
p3._err(token, ERR.misplacedStartTagForHeadElement);
|
|
17737
17944
|
break;
|
|
17738
17945
|
}
|
|
17739
17946
|
default: {
|
|
17740
|
-
tokenInHead(
|
|
17947
|
+
tokenInHead(p3, token);
|
|
17741
17948
|
}
|
|
17742
17949
|
}
|
|
17743
17950
|
}
|
|
17744
|
-
function endTagInHead(
|
|
17951
|
+
function endTagInHead(p3, token) {
|
|
17745
17952
|
switch (token.tagID) {
|
|
17746
17953
|
case TAG_ID.HEAD: {
|
|
17747
|
-
|
|
17748
|
-
|
|
17954
|
+
p3.openElements.pop();
|
|
17955
|
+
p3.insertionMode = InsertionMode.AFTER_HEAD;
|
|
17749
17956
|
break;
|
|
17750
17957
|
}
|
|
17751
17958
|
case TAG_ID.BODY:
|
|
17752
17959
|
case TAG_ID.BR:
|
|
17753
17960
|
case TAG_ID.HTML: {
|
|
17754
|
-
tokenInHead(
|
|
17961
|
+
tokenInHead(p3, token);
|
|
17755
17962
|
break;
|
|
17756
17963
|
}
|
|
17757
17964
|
case TAG_ID.TEMPLATE: {
|
|
17758
|
-
templateEndTagInHead(
|
|
17965
|
+
templateEndTagInHead(p3, token);
|
|
17759
17966
|
break;
|
|
17760
17967
|
}
|
|
17761
17968
|
default: {
|
|
17762
|
-
|
|
17969
|
+
p3._err(token, ERR.endTagWithoutMatchingOpenElement);
|
|
17763
17970
|
}
|
|
17764
17971
|
}
|
|
17765
17972
|
}
|
|
17766
|
-
function templateEndTagInHead(
|
|
17767
|
-
if (
|
|
17768
|
-
|
|
17769
|
-
if (
|
|
17770
|
-
|
|
17973
|
+
function templateEndTagInHead(p3, token) {
|
|
17974
|
+
if (p3.openElements.tmplCount > 0) {
|
|
17975
|
+
p3.openElements.generateImpliedEndTagsThoroughly();
|
|
17976
|
+
if (p3.openElements.currentTagId !== TAG_ID.TEMPLATE) {
|
|
17977
|
+
p3._err(token, ERR.closingOfElementWithOpenChildElements);
|
|
17771
17978
|
}
|
|
17772
|
-
|
|
17773
|
-
|
|
17774
|
-
|
|
17775
|
-
|
|
17979
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE);
|
|
17980
|
+
p3.activeFormattingElements.clearToLastMarker();
|
|
17981
|
+
p3.tmplInsertionModeStack.shift();
|
|
17982
|
+
p3._resetInsertionMode();
|
|
17776
17983
|
} else {
|
|
17777
|
-
|
|
17984
|
+
p3._err(token, ERR.endTagWithoutMatchingOpenElement);
|
|
17778
17985
|
}
|
|
17779
17986
|
}
|
|
17780
|
-
function tokenInHead(
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
|
|
17987
|
+
function tokenInHead(p3, token) {
|
|
17988
|
+
p3.openElements.pop();
|
|
17989
|
+
p3.insertionMode = InsertionMode.AFTER_HEAD;
|
|
17990
|
+
p3._processToken(token);
|
|
17784
17991
|
}
|
|
17785
|
-
function startTagInHeadNoScript(
|
|
17992
|
+
function startTagInHeadNoScript(p3, token) {
|
|
17786
17993
|
switch (token.tagID) {
|
|
17787
17994
|
case TAG_ID.HTML: {
|
|
17788
|
-
startTagInBody(
|
|
17995
|
+
startTagInBody(p3, token);
|
|
17789
17996
|
break;
|
|
17790
17997
|
}
|
|
17791
17998
|
case TAG_ID.BASEFONT:
|
|
@@ -17795,56 +18002,56 @@ function startTagInHeadNoScript(p4, token) {
|
|
|
17795
18002
|
case TAG_ID.META:
|
|
17796
18003
|
case TAG_ID.NOFRAMES:
|
|
17797
18004
|
case TAG_ID.STYLE: {
|
|
17798
|
-
startTagInHead(
|
|
18005
|
+
startTagInHead(p3, token);
|
|
17799
18006
|
break;
|
|
17800
18007
|
}
|
|
17801
18008
|
case TAG_ID.NOSCRIPT: {
|
|
17802
|
-
|
|
18009
|
+
p3._err(token, ERR.nestedNoscriptInHead);
|
|
17803
18010
|
break;
|
|
17804
18011
|
}
|
|
17805
18012
|
default: {
|
|
17806
|
-
tokenInHeadNoScript(
|
|
18013
|
+
tokenInHeadNoScript(p3, token);
|
|
17807
18014
|
}
|
|
17808
18015
|
}
|
|
17809
18016
|
}
|
|
17810
|
-
function endTagInHeadNoScript(
|
|
18017
|
+
function endTagInHeadNoScript(p3, token) {
|
|
17811
18018
|
switch (token.tagID) {
|
|
17812
18019
|
case TAG_ID.NOSCRIPT: {
|
|
17813
|
-
|
|
17814
|
-
|
|
18020
|
+
p3.openElements.pop();
|
|
18021
|
+
p3.insertionMode = InsertionMode.IN_HEAD;
|
|
17815
18022
|
break;
|
|
17816
18023
|
}
|
|
17817
18024
|
case TAG_ID.BR: {
|
|
17818
|
-
tokenInHeadNoScript(
|
|
18025
|
+
tokenInHeadNoScript(p3, token);
|
|
17819
18026
|
break;
|
|
17820
18027
|
}
|
|
17821
18028
|
default: {
|
|
17822
|
-
|
|
18029
|
+
p3._err(token, ERR.endTagWithoutMatchingOpenElement);
|
|
17823
18030
|
}
|
|
17824
18031
|
}
|
|
17825
18032
|
}
|
|
17826
|
-
function tokenInHeadNoScript(
|
|
18033
|
+
function tokenInHeadNoScript(p3, token) {
|
|
17827
18034
|
const errCode = token.type === TokenType.EOF ? ERR.openElementsLeftAfterEof : ERR.disallowedContentInNoscriptInHead;
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
|
|
18035
|
+
p3._err(token, errCode);
|
|
18036
|
+
p3.openElements.pop();
|
|
18037
|
+
p3.insertionMode = InsertionMode.IN_HEAD;
|
|
18038
|
+
p3._processToken(token);
|
|
17832
18039
|
}
|
|
17833
|
-
function startTagAfterHead(
|
|
18040
|
+
function startTagAfterHead(p3, token) {
|
|
17834
18041
|
switch (token.tagID) {
|
|
17835
18042
|
case TAG_ID.HTML: {
|
|
17836
|
-
startTagInBody(
|
|
18043
|
+
startTagInBody(p3, token);
|
|
17837
18044
|
break;
|
|
17838
18045
|
}
|
|
17839
18046
|
case TAG_ID.BODY: {
|
|
17840
|
-
|
|
17841
|
-
|
|
17842
|
-
|
|
18047
|
+
p3._insertElement(token, NS.HTML);
|
|
18048
|
+
p3.framesetOk = false;
|
|
18049
|
+
p3.insertionMode = InsertionMode.IN_BODY;
|
|
17843
18050
|
break;
|
|
17844
18051
|
}
|
|
17845
18052
|
case TAG_ID.FRAMESET: {
|
|
17846
|
-
|
|
17847
|
-
|
|
18053
|
+
p3._insertElement(token, NS.HTML);
|
|
18054
|
+
p3.insertionMode = InsertionMode.IN_FRAMESET;
|
|
17848
18055
|
break;
|
|
17849
18056
|
}
|
|
17850
18057
|
case TAG_ID.BASE:
|
|
@@ -17857,321 +18064,321 @@ function startTagAfterHead(p4, token) {
|
|
|
17857
18064
|
case TAG_ID.STYLE:
|
|
17858
18065
|
case TAG_ID.TEMPLATE:
|
|
17859
18066
|
case TAG_ID.TITLE: {
|
|
17860
|
-
|
|
17861
|
-
|
|
17862
|
-
startTagInHead(
|
|
17863
|
-
|
|
18067
|
+
p3._err(token, ERR.abandonedHeadElementChild);
|
|
18068
|
+
p3.openElements.push(p3.headElement, TAG_ID.HEAD);
|
|
18069
|
+
startTagInHead(p3, token);
|
|
18070
|
+
p3.openElements.remove(p3.headElement);
|
|
17864
18071
|
break;
|
|
17865
18072
|
}
|
|
17866
18073
|
case TAG_ID.HEAD: {
|
|
17867
|
-
|
|
18074
|
+
p3._err(token, ERR.misplacedStartTagForHeadElement);
|
|
17868
18075
|
break;
|
|
17869
18076
|
}
|
|
17870
18077
|
default: {
|
|
17871
|
-
tokenAfterHead(
|
|
18078
|
+
tokenAfterHead(p3, token);
|
|
17872
18079
|
}
|
|
17873
18080
|
}
|
|
17874
18081
|
}
|
|
17875
|
-
function endTagAfterHead(
|
|
18082
|
+
function endTagAfterHead(p3, token) {
|
|
17876
18083
|
switch (token.tagID) {
|
|
17877
18084
|
case TAG_ID.BODY:
|
|
17878
18085
|
case TAG_ID.HTML:
|
|
17879
18086
|
case TAG_ID.BR: {
|
|
17880
|
-
tokenAfterHead(
|
|
18087
|
+
tokenAfterHead(p3, token);
|
|
17881
18088
|
break;
|
|
17882
18089
|
}
|
|
17883
18090
|
case TAG_ID.TEMPLATE: {
|
|
17884
|
-
templateEndTagInHead(
|
|
18091
|
+
templateEndTagInHead(p3, token);
|
|
17885
18092
|
break;
|
|
17886
18093
|
}
|
|
17887
18094
|
default: {
|
|
17888
|
-
|
|
18095
|
+
p3._err(token, ERR.endTagWithoutMatchingOpenElement);
|
|
17889
18096
|
}
|
|
17890
18097
|
}
|
|
17891
18098
|
}
|
|
17892
|
-
function tokenAfterHead(
|
|
17893
|
-
|
|
17894
|
-
|
|
17895
|
-
modeInBody(
|
|
18099
|
+
function tokenAfterHead(p3, token) {
|
|
18100
|
+
p3._insertFakeElement(TAG_NAMES.BODY, TAG_ID.BODY);
|
|
18101
|
+
p3.insertionMode = InsertionMode.IN_BODY;
|
|
18102
|
+
modeInBody(p3, token);
|
|
17896
18103
|
}
|
|
17897
|
-
function modeInBody(
|
|
18104
|
+
function modeInBody(p3, token) {
|
|
17898
18105
|
switch (token.type) {
|
|
17899
18106
|
case TokenType.CHARACTER: {
|
|
17900
|
-
characterInBody(
|
|
18107
|
+
characterInBody(p3, token);
|
|
17901
18108
|
break;
|
|
17902
18109
|
}
|
|
17903
18110
|
case TokenType.WHITESPACE_CHARACTER: {
|
|
17904
|
-
whitespaceCharacterInBody(
|
|
18111
|
+
whitespaceCharacterInBody(p3, token);
|
|
17905
18112
|
break;
|
|
17906
18113
|
}
|
|
17907
18114
|
case TokenType.COMMENT: {
|
|
17908
|
-
appendComment(
|
|
18115
|
+
appendComment(p3, token);
|
|
17909
18116
|
break;
|
|
17910
18117
|
}
|
|
17911
18118
|
case TokenType.START_TAG: {
|
|
17912
|
-
startTagInBody(
|
|
18119
|
+
startTagInBody(p3, token);
|
|
17913
18120
|
break;
|
|
17914
18121
|
}
|
|
17915
18122
|
case TokenType.END_TAG: {
|
|
17916
|
-
endTagInBody(
|
|
18123
|
+
endTagInBody(p3, token);
|
|
17917
18124
|
break;
|
|
17918
18125
|
}
|
|
17919
18126
|
case TokenType.EOF: {
|
|
17920
|
-
eofInBody(
|
|
18127
|
+
eofInBody(p3, token);
|
|
17921
18128
|
break;
|
|
17922
18129
|
}
|
|
17923
18130
|
default:
|
|
17924
18131
|
}
|
|
17925
18132
|
}
|
|
17926
|
-
function whitespaceCharacterInBody(
|
|
17927
|
-
|
|
17928
|
-
|
|
18133
|
+
function whitespaceCharacterInBody(p3, token) {
|
|
18134
|
+
p3._reconstructActiveFormattingElements();
|
|
18135
|
+
p3._insertCharacters(token);
|
|
17929
18136
|
}
|
|
17930
|
-
function characterInBody(
|
|
17931
|
-
|
|
17932
|
-
|
|
17933
|
-
|
|
18137
|
+
function characterInBody(p3, token) {
|
|
18138
|
+
p3._reconstructActiveFormattingElements();
|
|
18139
|
+
p3._insertCharacters(token);
|
|
18140
|
+
p3.framesetOk = false;
|
|
17934
18141
|
}
|
|
17935
|
-
function htmlStartTagInBody(
|
|
17936
|
-
if (
|
|
17937
|
-
|
|
18142
|
+
function htmlStartTagInBody(p3, token) {
|
|
18143
|
+
if (p3.openElements.tmplCount === 0) {
|
|
18144
|
+
p3.treeAdapter.adoptAttributes(p3.openElements.items[0], token.attrs);
|
|
17938
18145
|
}
|
|
17939
18146
|
}
|
|
17940
|
-
function bodyStartTagInBody(
|
|
17941
|
-
const bodyElement =
|
|
17942
|
-
if (bodyElement &&
|
|
17943
|
-
|
|
17944
|
-
|
|
18147
|
+
function bodyStartTagInBody(p3, token) {
|
|
18148
|
+
const bodyElement = p3.openElements.tryPeekProperlyNestedBodyElement();
|
|
18149
|
+
if (bodyElement && p3.openElements.tmplCount === 0) {
|
|
18150
|
+
p3.framesetOk = false;
|
|
18151
|
+
p3.treeAdapter.adoptAttributes(bodyElement, token.attrs);
|
|
17945
18152
|
}
|
|
17946
18153
|
}
|
|
17947
|
-
function framesetStartTagInBody(
|
|
17948
|
-
const bodyElement =
|
|
17949
|
-
if (
|
|
17950
|
-
|
|
17951
|
-
|
|
17952
|
-
|
|
17953
|
-
|
|
18154
|
+
function framesetStartTagInBody(p3, token) {
|
|
18155
|
+
const bodyElement = p3.openElements.tryPeekProperlyNestedBodyElement();
|
|
18156
|
+
if (p3.framesetOk && bodyElement) {
|
|
18157
|
+
p3.treeAdapter.detachNode(bodyElement);
|
|
18158
|
+
p3.openElements.popAllUpToHtmlElement();
|
|
18159
|
+
p3._insertElement(token, NS.HTML);
|
|
18160
|
+
p3.insertionMode = InsertionMode.IN_FRAMESET;
|
|
17954
18161
|
}
|
|
17955
18162
|
}
|
|
17956
|
-
function addressStartTagInBody(
|
|
17957
|
-
if (
|
|
17958
|
-
|
|
18163
|
+
function addressStartTagInBody(p3, token) {
|
|
18164
|
+
if (p3.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
18165
|
+
p3._closePElement();
|
|
17959
18166
|
}
|
|
17960
|
-
|
|
18167
|
+
p3._insertElement(token, NS.HTML);
|
|
17961
18168
|
}
|
|
17962
|
-
function numberedHeaderStartTagInBody(
|
|
17963
|
-
if (
|
|
17964
|
-
|
|
18169
|
+
function numberedHeaderStartTagInBody(p3, token) {
|
|
18170
|
+
if (p3.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
18171
|
+
p3._closePElement();
|
|
17965
18172
|
}
|
|
17966
|
-
if (
|
|
17967
|
-
|
|
18173
|
+
if (p3.openElements.currentTagId !== void 0 && NUMBERED_HEADERS.has(p3.openElements.currentTagId)) {
|
|
18174
|
+
p3.openElements.pop();
|
|
17968
18175
|
}
|
|
17969
|
-
|
|
18176
|
+
p3._insertElement(token, NS.HTML);
|
|
17970
18177
|
}
|
|
17971
|
-
function preStartTagInBody(
|
|
17972
|
-
if (
|
|
17973
|
-
|
|
18178
|
+
function preStartTagInBody(p3, token) {
|
|
18179
|
+
if (p3.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
18180
|
+
p3._closePElement();
|
|
17974
18181
|
}
|
|
17975
|
-
|
|
17976
|
-
|
|
17977
|
-
|
|
18182
|
+
p3._insertElement(token, NS.HTML);
|
|
18183
|
+
p3.skipNextNewLine = true;
|
|
18184
|
+
p3.framesetOk = false;
|
|
17978
18185
|
}
|
|
17979
|
-
function formStartTagInBody(
|
|
17980
|
-
const inTemplate =
|
|
17981
|
-
if (!
|
|
17982
|
-
if (
|
|
17983
|
-
|
|
18186
|
+
function formStartTagInBody(p3, token) {
|
|
18187
|
+
const inTemplate = p3.openElements.tmplCount > 0;
|
|
18188
|
+
if (!p3.formElement || inTemplate) {
|
|
18189
|
+
if (p3.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
18190
|
+
p3._closePElement();
|
|
17984
18191
|
}
|
|
17985
|
-
|
|
18192
|
+
p3._insertElement(token, NS.HTML);
|
|
17986
18193
|
if (!inTemplate) {
|
|
17987
|
-
|
|
18194
|
+
p3.formElement = p3.openElements.current;
|
|
17988
18195
|
}
|
|
17989
18196
|
}
|
|
17990
18197
|
}
|
|
17991
|
-
function listItemStartTagInBody(
|
|
17992
|
-
|
|
18198
|
+
function listItemStartTagInBody(p3, token) {
|
|
18199
|
+
p3.framesetOk = false;
|
|
17993
18200
|
const tn = token.tagID;
|
|
17994
|
-
for (let i2 =
|
|
17995
|
-
const elementId =
|
|
18201
|
+
for (let i2 = p3.openElements.stackTop; i2 >= 0; i2--) {
|
|
18202
|
+
const elementId = p3.openElements.tagIDs[i2];
|
|
17996
18203
|
if (tn === TAG_ID.LI && elementId === TAG_ID.LI || (tn === TAG_ID.DD || tn === TAG_ID.DT) && (elementId === TAG_ID.DD || elementId === TAG_ID.DT)) {
|
|
17997
|
-
|
|
17998
|
-
|
|
18204
|
+
p3.openElements.generateImpliedEndTagsWithExclusion(elementId);
|
|
18205
|
+
p3.openElements.popUntilTagNamePopped(elementId);
|
|
17999
18206
|
break;
|
|
18000
18207
|
}
|
|
18001
|
-
if (elementId !== TAG_ID.ADDRESS && elementId !== TAG_ID.DIV && elementId !== TAG_ID.P &&
|
|
18208
|
+
if (elementId !== TAG_ID.ADDRESS && elementId !== TAG_ID.DIV && elementId !== TAG_ID.P && p3._isSpecialElement(p3.openElements.items[i2], elementId)) {
|
|
18002
18209
|
break;
|
|
18003
18210
|
}
|
|
18004
18211
|
}
|
|
18005
|
-
if (
|
|
18006
|
-
|
|
18212
|
+
if (p3.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
18213
|
+
p3._closePElement();
|
|
18007
18214
|
}
|
|
18008
|
-
|
|
18215
|
+
p3._insertElement(token, NS.HTML);
|
|
18009
18216
|
}
|
|
18010
|
-
function plaintextStartTagInBody(
|
|
18011
|
-
if (
|
|
18012
|
-
|
|
18217
|
+
function plaintextStartTagInBody(p3, token) {
|
|
18218
|
+
if (p3.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
18219
|
+
p3._closePElement();
|
|
18013
18220
|
}
|
|
18014
|
-
|
|
18015
|
-
|
|
18221
|
+
p3._insertElement(token, NS.HTML);
|
|
18222
|
+
p3.tokenizer.state = TokenizerMode.PLAINTEXT;
|
|
18016
18223
|
}
|
|
18017
|
-
function buttonStartTagInBody(
|
|
18018
|
-
if (
|
|
18019
|
-
|
|
18020
|
-
|
|
18224
|
+
function buttonStartTagInBody(p3, token) {
|
|
18225
|
+
if (p3.openElements.hasInScope(TAG_ID.BUTTON)) {
|
|
18226
|
+
p3.openElements.generateImpliedEndTags();
|
|
18227
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.BUTTON);
|
|
18021
18228
|
}
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18229
|
+
p3._reconstructActiveFormattingElements();
|
|
18230
|
+
p3._insertElement(token, NS.HTML);
|
|
18231
|
+
p3.framesetOk = false;
|
|
18025
18232
|
}
|
|
18026
|
-
function aStartTagInBody(
|
|
18027
|
-
const activeElementEntry =
|
|
18233
|
+
function aStartTagInBody(p3, token) {
|
|
18234
|
+
const activeElementEntry = p3.activeFormattingElements.getElementEntryInScopeWithTagName(TAG_NAMES.A);
|
|
18028
18235
|
if (activeElementEntry) {
|
|
18029
|
-
callAdoptionAgency(
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
}
|
|
18033
|
-
|
|
18034
|
-
|
|
18035
|
-
|
|
18036
|
-
}
|
|
18037
|
-
function bStartTagInBody(
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
}
|
|
18042
|
-
function nobrStartTagInBody(
|
|
18043
|
-
|
|
18044
|
-
if (
|
|
18045
|
-
callAdoptionAgency(
|
|
18046
|
-
|
|
18047
|
-
}
|
|
18048
|
-
|
|
18049
|
-
|
|
18050
|
-
}
|
|
18051
|
-
function appletStartTagInBody(
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
}
|
|
18057
|
-
function tableStartTagInBody(
|
|
18058
|
-
if (
|
|
18059
|
-
|
|
18060
|
-
}
|
|
18061
|
-
|
|
18062
|
-
|
|
18063
|
-
|
|
18064
|
-
}
|
|
18065
|
-
function areaStartTagInBody(
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
|
|
18236
|
+
callAdoptionAgency(p3, token);
|
|
18237
|
+
p3.openElements.remove(activeElementEntry.element);
|
|
18238
|
+
p3.activeFormattingElements.removeEntry(activeElementEntry);
|
|
18239
|
+
}
|
|
18240
|
+
p3._reconstructActiveFormattingElements();
|
|
18241
|
+
p3._insertElement(token, NS.HTML);
|
|
18242
|
+
p3.activeFormattingElements.pushElement(p3.openElements.current, token);
|
|
18243
|
+
}
|
|
18244
|
+
function bStartTagInBody(p3, token) {
|
|
18245
|
+
p3._reconstructActiveFormattingElements();
|
|
18246
|
+
p3._insertElement(token, NS.HTML);
|
|
18247
|
+
p3.activeFormattingElements.pushElement(p3.openElements.current, token);
|
|
18248
|
+
}
|
|
18249
|
+
function nobrStartTagInBody(p3, token) {
|
|
18250
|
+
p3._reconstructActiveFormattingElements();
|
|
18251
|
+
if (p3.openElements.hasInScope(TAG_ID.NOBR)) {
|
|
18252
|
+
callAdoptionAgency(p3, token);
|
|
18253
|
+
p3._reconstructActiveFormattingElements();
|
|
18254
|
+
}
|
|
18255
|
+
p3._insertElement(token, NS.HTML);
|
|
18256
|
+
p3.activeFormattingElements.pushElement(p3.openElements.current, token);
|
|
18257
|
+
}
|
|
18258
|
+
function appletStartTagInBody(p3, token) {
|
|
18259
|
+
p3._reconstructActiveFormattingElements();
|
|
18260
|
+
p3._insertElement(token, NS.HTML);
|
|
18261
|
+
p3.activeFormattingElements.insertMarker();
|
|
18262
|
+
p3.framesetOk = false;
|
|
18263
|
+
}
|
|
18264
|
+
function tableStartTagInBody(p3, token) {
|
|
18265
|
+
if (p3.treeAdapter.getDocumentMode(p3.document) !== DOCUMENT_MODE.QUIRKS && p3.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
18266
|
+
p3._closePElement();
|
|
18267
|
+
}
|
|
18268
|
+
p3._insertElement(token, NS.HTML);
|
|
18269
|
+
p3.framesetOk = false;
|
|
18270
|
+
p3.insertionMode = InsertionMode.IN_TABLE;
|
|
18271
|
+
}
|
|
18272
|
+
function areaStartTagInBody(p3, token) {
|
|
18273
|
+
p3._reconstructActiveFormattingElements();
|
|
18274
|
+
p3._appendElement(token, NS.HTML);
|
|
18275
|
+
p3.framesetOk = false;
|
|
18069
18276
|
token.ackSelfClosing = true;
|
|
18070
18277
|
}
|
|
18071
18278
|
function isHiddenInput(token) {
|
|
18072
18279
|
const inputType = getTokenAttr(token, ATTRS.TYPE);
|
|
18073
18280
|
return inputType != null && inputType.toLowerCase() === HIDDEN_INPUT_TYPE;
|
|
18074
18281
|
}
|
|
18075
|
-
function inputStartTagInBody(
|
|
18076
|
-
|
|
18077
|
-
|
|
18282
|
+
function inputStartTagInBody(p3, token) {
|
|
18283
|
+
p3._reconstructActiveFormattingElements();
|
|
18284
|
+
p3._appendElement(token, NS.HTML);
|
|
18078
18285
|
if (!isHiddenInput(token)) {
|
|
18079
|
-
|
|
18286
|
+
p3.framesetOk = false;
|
|
18080
18287
|
}
|
|
18081
18288
|
token.ackSelfClosing = true;
|
|
18082
18289
|
}
|
|
18083
|
-
function paramStartTagInBody(
|
|
18084
|
-
|
|
18290
|
+
function paramStartTagInBody(p3, token) {
|
|
18291
|
+
p3._appendElement(token, NS.HTML);
|
|
18085
18292
|
token.ackSelfClosing = true;
|
|
18086
18293
|
}
|
|
18087
|
-
function hrStartTagInBody(
|
|
18088
|
-
if (
|
|
18089
|
-
|
|
18294
|
+
function hrStartTagInBody(p3, token) {
|
|
18295
|
+
if (p3.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
18296
|
+
p3._closePElement();
|
|
18090
18297
|
}
|
|
18091
|
-
|
|
18092
|
-
|
|
18298
|
+
p3._appendElement(token, NS.HTML);
|
|
18299
|
+
p3.framesetOk = false;
|
|
18093
18300
|
token.ackSelfClosing = true;
|
|
18094
18301
|
}
|
|
18095
|
-
function imageStartTagInBody(
|
|
18302
|
+
function imageStartTagInBody(p3, token) {
|
|
18096
18303
|
token.tagName = TAG_NAMES.IMG;
|
|
18097
18304
|
token.tagID = TAG_ID.IMG;
|
|
18098
|
-
areaStartTagInBody(
|
|
18305
|
+
areaStartTagInBody(p3, token);
|
|
18099
18306
|
}
|
|
18100
|
-
function textareaStartTagInBody(
|
|
18101
|
-
|
|
18102
|
-
|
|
18103
|
-
|
|
18104
|
-
|
|
18105
|
-
|
|
18106
|
-
|
|
18307
|
+
function textareaStartTagInBody(p3, token) {
|
|
18308
|
+
p3._insertElement(token, NS.HTML);
|
|
18309
|
+
p3.skipNextNewLine = true;
|
|
18310
|
+
p3.tokenizer.state = TokenizerMode.RCDATA;
|
|
18311
|
+
p3.originalInsertionMode = p3.insertionMode;
|
|
18312
|
+
p3.framesetOk = false;
|
|
18313
|
+
p3.insertionMode = InsertionMode.TEXT;
|
|
18107
18314
|
}
|
|
18108
|
-
function xmpStartTagInBody(
|
|
18109
|
-
if (
|
|
18110
|
-
|
|
18315
|
+
function xmpStartTagInBody(p3, token) {
|
|
18316
|
+
if (p3.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
18317
|
+
p3._closePElement();
|
|
18111
18318
|
}
|
|
18112
|
-
|
|
18113
|
-
|
|
18114
|
-
|
|
18319
|
+
p3._reconstructActiveFormattingElements();
|
|
18320
|
+
p3.framesetOk = false;
|
|
18321
|
+
p3._switchToTextParsing(token, TokenizerMode.RAWTEXT);
|
|
18115
18322
|
}
|
|
18116
|
-
function iframeStartTagInBody(
|
|
18117
|
-
|
|
18118
|
-
|
|
18323
|
+
function iframeStartTagInBody(p3, token) {
|
|
18324
|
+
p3.framesetOk = false;
|
|
18325
|
+
p3._switchToTextParsing(token, TokenizerMode.RAWTEXT);
|
|
18119
18326
|
}
|
|
18120
|
-
function rawTextStartTagInBody(
|
|
18121
|
-
|
|
18327
|
+
function rawTextStartTagInBody(p3, token) {
|
|
18328
|
+
p3._switchToTextParsing(token, TokenizerMode.RAWTEXT);
|
|
18122
18329
|
}
|
|
18123
|
-
function selectStartTagInBody(
|
|
18124
|
-
|
|
18125
|
-
|
|
18126
|
-
|
|
18127
|
-
|
|
18330
|
+
function selectStartTagInBody(p3, token) {
|
|
18331
|
+
p3._reconstructActiveFormattingElements();
|
|
18332
|
+
p3._insertElement(token, NS.HTML);
|
|
18333
|
+
p3.framesetOk = false;
|
|
18334
|
+
p3.insertionMode = p3.insertionMode === InsertionMode.IN_TABLE || p3.insertionMode === InsertionMode.IN_CAPTION || p3.insertionMode === InsertionMode.IN_TABLE_BODY || p3.insertionMode === InsertionMode.IN_ROW || p3.insertionMode === InsertionMode.IN_CELL ? InsertionMode.IN_SELECT_IN_TABLE : InsertionMode.IN_SELECT;
|
|
18128
18335
|
}
|
|
18129
|
-
function optgroupStartTagInBody(
|
|
18130
|
-
if (
|
|
18131
|
-
|
|
18336
|
+
function optgroupStartTagInBody(p3, token) {
|
|
18337
|
+
if (p3.openElements.currentTagId === TAG_ID.OPTION) {
|
|
18338
|
+
p3.openElements.pop();
|
|
18132
18339
|
}
|
|
18133
|
-
|
|
18134
|
-
|
|
18340
|
+
p3._reconstructActiveFormattingElements();
|
|
18341
|
+
p3._insertElement(token, NS.HTML);
|
|
18135
18342
|
}
|
|
18136
|
-
function rbStartTagInBody(
|
|
18137
|
-
if (
|
|
18138
|
-
|
|
18343
|
+
function rbStartTagInBody(p3, token) {
|
|
18344
|
+
if (p3.openElements.hasInScope(TAG_ID.RUBY)) {
|
|
18345
|
+
p3.openElements.generateImpliedEndTags();
|
|
18139
18346
|
}
|
|
18140
|
-
|
|
18347
|
+
p3._insertElement(token, NS.HTML);
|
|
18141
18348
|
}
|
|
18142
|
-
function rtStartTagInBody(
|
|
18143
|
-
if (
|
|
18144
|
-
|
|
18349
|
+
function rtStartTagInBody(p3, token) {
|
|
18350
|
+
if (p3.openElements.hasInScope(TAG_ID.RUBY)) {
|
|
18351
|
+
p3.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.RTC);
|
|
18145
18352
|
}
|
|
18146
|
-
|
|
18353
|
+
p3._insertElement(token, NS.HTML);
|
|
18147
18354
|
}
|
|
18148
|
-
function mathStartTagInBody(
|
|
18149
|
-
|
|
18355
|
+
function mathStartTagInBody(p3, token) {
|
|
18356
|
+
p3._reconstructActiveFormattingElements();
|
|
18150
18357
|
adjustTokenMathMLAttrs(token);
|
|
18151
18358
|
adjustTokenXMLAttrs(token);
|
|
18152
18359
|
if (token.selfClosing) {
|
|
18153
|
-
|
|
18360
|
+
p3._appendElement(token, NS.MATHML);
|
|
18154
18361
|
} else {
|
|
18155
|
-
|
|
18362
|
+
p3._insertElement(token, NS.MATHML);
|
|
18156
18363
|
}
|
|
18157
18364
|
token.ackSelfClosing = true;
|
|
18158
18365
|
}
|
|
18159
|
-
function svgStartTagInBody(
|
|
18160
|
-
|
|
18366
|
+
function svgStartTagInBody(p3, token) {
|
|
18367
|
+
p3._reconstructActiveFormattingElements();
|
|
18161
18368
|
adjustTokenSVGAttrs(token);
|
|
18162
18369
|
adjustTokenXMLAttrs(token);
|
|
18163
18370
|
if (token.selfClosing) {
|
|
18164
|
-
|
|
18371
|
+
p3._appendElement(token, NS.SVG);
|
|
18165
18372
|
} else {
|
|
18166
|
-
|
|
18373
|
+
p3._insertElement(token, NS.SVG);
|
|
18167
18374
|
}
|
|
18168
18375
|
token.ackSelfClosing = true;
|
|
18169
18376
|
}
|
|
18170
|
-
function genericStartTagInBody(
|
|
18171
|
-
|
|
18172
|
-
|
|
18377
|
+
function genericStartTagInBody(p3, token) {
|
|
18378
|
+
p3._reconstructActiveFormattingElements();
|
|
18379
|
+
p3._insertElement(token, NS.HTML);
|
|
18173
18380
|
}
|
|
18174
|
-
function startTagInBody(
|
|
18381
|
+
function startTagInBody(p3, token) {
|
|
18175
18382
|
switch (token.tagID) {
|
|
18176
18383
|
case TAG_ID.I:
|
|
18177
18384
|
case TAG_ID.S:
|
|
@@ -18185,11 +18392,11 @@ function startTagInBody(p4, token) {
|
|
|
18185
18392
|
case TAG_ID.SMALL:
|
|
18186
18393
|
case TAG_ID.STRIKE:
|
|
18187
18394
|
case TAG_ID.STRONG: {
|
|
18188
|
-
bStartTagInBody(
|
|
18395
|
+
bStartTagInBody(p3, token);
|
|
18189
18396
|
break;
|
|
18190
18397
|
}
|
|
18191
18398
|
case TAG_ID.A: {
|
|
18192
|
-
aStartTagInBody(
|
|
18399
|
+
aStartTagInBody(p3, token);
|
|
18193
18400
|
break;
|
|
18194
18401
|
}
|
|
18195
18402
|
case TAG_ID.H1:
|
|
@@ -18198,7 +18405,7 @@ function startTagInBody(p4, token) {
|
|
|
18198
18405
|
case TAG_ID.H4:
|
|
18199
18406
|
case TAG_ID.H5:
|
|
18200
18407
|
case TAG_ID.H6: {
|
|
18201
|
-
numberedHeaderStartTagInBody(
|
|
18408
|
+
numberedHeaderStartTagInBody(p3, token);
|
|
18202
18409
|
break;
|
|
18203
18410
|
}
|
|
18204
18411
|
case TAG_ID.P:
|
|
@@ -18226,13 +18433,13 @@ function startTagInBody(p4, token) {
|
|
|
18226
18433
|
case TAG_ID.FIELDSET:
|
|
18227
18434
|
case TAG_ID.BLOCKQUOTE:
|
|
18228
18435
|
case TAG_ID.FIGCAPTION: {
|
|
18229
|
-
addressStartTagInBody(
|
|
18436
|
+
addressStartTagInBody(p3, token);
|
|
18230
18437
|
break;
|
|
18231
18438
|
}
|
|
18232
18439
|
case TAG_ID.LI:
|
|
18233
18440
|
case TAG_ID.DD:
|
|
18234
18441
|
case TAG_ID.DT: {
|
|
18235
|
-
listItemStartTagInBody(
|
|
18442
|
+
listItemStartTagInBody(p3, token);
|
|
18236
18443
|
break;
|
|
18237
18444
|
}
|
|
18238
18445
|
case TAG_ID.BR:
|
|
@@ -18241,38 +18448,38 @@ function startTagInBody(p4, token) {
|
|
|
18241
18448
|
case TAG_ID.AREA:
|
|
18242
18449
|
case TAG_ID.EMBED:
|
|
18243
18450
|
case TAG_ID.KEYGEN: {
|
|
18244
|
-
areaStartTagInBody(
|
|
18451
|
+
areaStartTagInBody(p3, token);
|
|
18245
18452
|
break;
|
|
18246
18453
|
}
|
|
18247
18454
|
case TAG_ID.HR: {
|
|
18248
|
-
hrStartTagInBody(
|
|
18455
|
+
hrStartTagInBody(p3, token);
|
|
18249
18456
|
break;
|
|
18250
18457
|
}
|
|
18251
18458
|
case TAG_ID.RB:
|
|
18252
18459
|
case TAG_ID.RTC: {
|
|
18253
|
-
rbStartTagInBody(
|
|
18460
|
+
rbStartTagInBody(p3, token);
|
|
18254
18461
|
break;
|
|
18255
18462
|
}
|
|
18256
18463
|
case TAG_ID.RT:
|
|
18257
18464
|
case TAG_ID.RP: {
|
|
18258
|
-
rtStartTagInBody(
|
|
18465
|
+
rtStartTagInBody(p3, token);
|
|
18259
18466
|
break;
|
|
18260
18467
|
}
|
|
18261
18468
|
case TAG_ID.PRE:
|
|
18262
18469
|
case TAG_ID.LISTING: {
|
|
18263
|
-
preStartTagInBody(
|
|
18470
|
+
preStartTagInBody(p3, token);
|
|
18264
18471
|
break;
|
|
18265
18472
|
}
|
|
18266
18473
|
case TAG_ID.XMP: {
|
|
18267
|
-
xmpStartTagInBody(
|
|
18474
|
+
xmpStartTagInBody(p3, token);
|
|
18268
18475
|
break;
|
|
18269
18476
|
}
|
|
18270
18477
|
case TAG_ID.SVG: {
|
|
18271
|
-
svgStartTagInBody(
|
|
18478
|
+
svgStartTagInBody(p3, token);
|
|
18272
18479
|
break;
|
|
18273
18480
|
}
|
|
18274
18481
|
case TAG_ID.HTML: {
|
|
18275
|
-
htmlStartTagInBody(
|
|
18482
|
+
htmlStartTagInBody(p3, token);
|
|
18276
18483
|
break;
|
|
18277
18484
|
}
|
|
18278
18485
|
case TAG_ID.BASE:
|
|
@@ -18284,89 +18491,89 @@ function startTagInBody(p4, token) {
|
|
|
18284
18491
|
case TAG_ID.BGSOUND:
|
|
18285
18492
|
case TAG_ID.BASEFONT:
|
|
18286
18493
|
case TAG_ID.TEMPLATE: {
|
|
18287
|
-
startTagInHead(
|
|
18494
|
+
startTagInHead(p3, token);
|
|
18288
18495
|
break;
|
|
18289
18496
|
}
|
|
18290
18497
|
case TAG_ID.BODY: {
|
|
18291
|
-
bodyStartTagInBody(
|
|
18498
|
+
bodyStartTagInBody(p3, token);
|
|
18292
18499
|
break;
|
|
18293
18500
|
}
|
|
18294
18501
|
case TAG_ID.FORM: {
|
|
18295
|
-
formStartTagInBody(
|
|
18502
|
+
formStartTagInBody(p3, token);
|
|
18296
18503
|
break;
|
|
18297
18504
|
}
|
|
18298
18505
|
case TAG_ID.NOBR: {
|
|
18299
|
-
nobrStartTagInBody(
|
|
18506
|
+
nobrStartTagInBody(p3, token);
|
|
18300
18507
|
break;
|
|
18301
18508
|
}
|
|
18302
18509
|
case TAG_ID.MATH: {
|
|
18303
|
-
mathStartTagInBody(
|
|
18510
|
+
mathStartTagInBody(p3, token);
|
|
18304
18511
|
break;
|
|
18305
18512
|
}
|
|
18306
18513
|
case TAG_ID.TABLE: {
|
|
18307
|
-
tableStartTagInBody(
|
|
18514
|
+
tableStartTagInBody(p3, token);
|
|
18308
18515
|
break;
|
|
18309
18516
|
}
|
|
18310
18517
|
case TAG_ID.INPUT: {
|
|
18311
|
-
inputStartTagInBody(
|
|
18518
|
+
inputStartTagInBody(p3, token);
|
|
18312
18519
|
break;
|
|
18313
18520
|
}
|
|
18314
18521
|
case TAG_ID.PARAM:
|
|
18315
18522
|
case TAG_ID.TRACK:
|
|
18316
18523
|
case TAG_ID.SOURCE: {
|
|
18317
|
-
paramStartTagInBody(
|
|
18524
|
+
paramStartTagInBody(p3, token);
|
|
18318
18525
|
break;
|
|
18319
18526
|
}
|
|
18320
18527
|
case TAG_ID.IMAGE: {
|
|
18321
|
-
imageStartTagInBody(
|
|
18528
|
+
imageStartTagInBody(p3, token);
|
|
18322
18529
|
break;
|
|
18323
18530
|
}
|
|
18324
18531
|
case TAG_ID.BUTTON: {
|
|
18325
|
-
buttonStartTagInBody(
|
|
18532
|
+
buttonStartTagInBody(p3, token);
|
|
18326
18533
|
break;
|
|
18327
18534
|
}
|
|
18328
18535
|
case TAG_ID.APPLET:
|
|
18329
18536
|
case TAG_ID.OBJECT:
|
|
18330
18537
|
case TAG_ID.MARQUEE: {
|
|
18331
|
-
appletStartTagInBody(
|
|
18538
|
+
appletStartTagInBody(p3, token);
|
|
18332
18539
|
break;
|
|
18333
18540
|
}
|
|
18334
18541
|
case TAG_ID.IFRAME: {
|
|
18335
|
-
iframeStartTagInBody(
|
|
18542
|
+
iframeStartTagInBody(p3, token);
|
|
18336
18543
|
break;
|
|
18337
18544
|
}
|
|
18338
18545
|
case TAG_ID.SELECT: {
|
|
18339
|
-
selectStartTagInBody(
|
|
18546
|
+
selectStartTagInBody(p3, token);
|
|
18340
18547
|
break;
|
|
18341
18548
|
}
|
|
18342
18549
|
case TAG_ID.OPTION:
|
|
18343
18550
|
case TAG_ID.OPTGROUP: {
|
|
18344
|
-
optgroupStartTagInBody(
|
|
18551
|
+
optgroupStartTagInBody(p3, token);
|
|
18345
18552
|
break;
|
|
18346
18553
|
}
|
|
18347
18554
|
case TAG_ID.NOEMBED:
|
|
18348
18555
|
case TAG_ID.NOFRAMES: {
|
|
18349
|
-
rawTextStartTagInBody(
|
|
18556
|
+
rawTextStartTagInBody(p3, token);
|
|
18350
18557
|
break;
|
|
18351
18558
|
}
|
|
18352
18559
|
case TAG_ID.FRAMESET: {
|
|
18353
|
-
framesetStartTagInBody(
|
|
18560
|
+
framesetStartTagInBody(p3, token);
|
|
18354
18561
|
break;
|
|
18355
18562
|
}
|
|
18356
18563
|
case TAG_ID.TEXTAREA: {
|
|
18357
|
-
textareaStartTagInBody(
|
|
18564
|
+
textareaStartTagInBody(p3, token);
|
|
18358
18565
|
break;
|
|
18359
18566
|
}
|
|
18360
18567
|
case TAG_ID.NOSCRIPT: {
|
|
18361
|
-
if (
|
|
18362
|
-
rawTextStartTagInBody(
|
|
18568
|
+
if (p3.options.scriptingEnabled) {
|
|
18569
|
+
rawTextStartTagInBody(p3, token);
|
|
18363
18570
|
} else {
|
|
18364
|
-
genericStartTagInBody(
|
|
18571
|
+
genericStartTagInBody(p3, token);
|
|
18365
18572
|
}
|
|
18366
18573
|
break;
|
|
18367
18574
|
}
|
|
18368
18575
|
case TAG_ID.PLAINTEXT: {
|
|
18369
|
-
plaintextStartTagInBody(
|
|
18576
|
+
plaintextStartTagInBody(p3, token);
|
|
18370
18577
|
break;
|
|
18371
18578
|
}
|
|
18372
18579
|
case TAG_ID.COL:
|
|
@@ -18383,106 +18590,106 @@ function startTagInBody(p4, token) {
|
|
|
18383
18590
|
break;
|
|
18384
18591
|
}
|
|
18385
18592
|
default: {
|
|
18386
|
-
genericStartTagInBody(
|
|
18593
|
+
genericStartTagInBody(p3, token);
|
|
18387
18594
|
}
|
|
18388
18595
|
}
|
|
18389
18596
|
}
|
|
18390
|
-
function bodyEndTagInBody(
|
|
18391
|
-
if (
|
|
18392
|
-
|
|
18393
|
-
if (
|
|
18394
|
-
const bodyElement =
|
|
18597
|
+
function bodyEndTagInBody(p3, token) {
|
|
18598
|
+
if (p3.openElements.hasInScope(TAG_ID.BODY)) {
|
|
18599
|
+
p3.insertionMode = InsertionMode.AFTER_BODY;
|
|
18600
|
+
if (p3.options.sourceCodeLocationInfo) {
|
|
18601
|
+
const bodyElement = p3.openElements.tryPeekProperlyNestedBodyElement();
|
|
18395
18602
|
if (bodyElement) {
|
|
18396
|
-
|
|
18603
|
+
p3._setEndLocation(bodyElement, token);
|
|
18397
18604
|
}
|
|
18398
18605
|
}
|
|
18399
18606
|
}
|
|
18400
18607
|
}
|
|
18401
|
-
function htmlEndTagInBody(
|
|
18402
|
-
if (
|
|
18403
|
-
|
|
18404
|
-
endTagAfterBody(
|
|
18608
|
+
function htmlEndTagInBody(p3, token) {
|
|
18609
|
+
if (p3.openElements.hasInScope(TAG_ID.BODY)) {
|
|
18610
|
+
p3.insertionMode = InsertionMode.AFTER_BODY;
|
|
18611
|
+
endTagAfterBody(p3, token);
|
|
18405
18612
|
}
|
|
18406
18613
|
}
|
|
18407
|
-
function addressEndTagInBody(
|
|
18614
|
+
function addressEndTagInBody(p3, token) {
|
|
18408
18615
|
const tn = token.tagID;
|
|
18409
|
-
if (
|
|
18410
|
-
|
|
18411
|
-
|
|
18616
|
+
if (p3.openElements.hasInScope(tn)) {
|
|
18617
|
+
p3.openElements.generateImpliedEndTags();
|
|
18618
|
+
p3.openElements.popUntilTagNamePopped(tn);
|
|
18412
18619
|
}
|
|
18413
18620
|
}
|
|
18414
|
-
function formEndTagInBody(
|
|
18415
|
-
const inTemplate =
|
|
18416
|
-
const { formElement } =
|
|
18621
|
+
function formEndTagInBody(p3) {
|
|
18622
|
+
const inTemplate = p3.openElements.tmplCount > 0;
|
|
18623
|
+
const { formElement } = p3;
|
|
18417
18624
|
if (!inTemplate) {
|
|
18418
|
-
|
|
18625
|
+
p3.formElement = null;
|
|
18419
18626
|
}
|
|
18420
|
-
if ((formElement || inTemplate) &&
|
|
18421
|
-
|
|
18627
|
+
if ((formElement || inTemplate) && p3.openElements.hasInScope(TAG_ID.FORM)) {
|
|
18628
|
+
p3.openElements.generateImpliedEndTags();
|
|
18422
18629
|
if (inTemplate) {
|
|
18423
|
-
|
|
18630
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.FORM);
|
|
18424
18631
|
} else if (formElement) {
|
|
18425
|
-
|
|
18632
|
+
p3.openElements.remove(formElement);
|
|
18426
18633
|
}
|
|
18427
18634
|
}
|
|
18428
18635
|
}
|
|
18429
|
-
function pEndTagInBody(
|
|
18430
|
-
if (!
|
|
18431
|
-
|
|
18636
|
+
function pEndTagInBody(p3) {
|
|
18637
|
+
if (!p3.openElements.hasInButtonScope(TAG_ID.P)) {
|
|
18638
|
+
p3._insertFakeElement(TAG_NAMES.P, TAG_ID.P);
|
|
18432
18639
|
}
|
|
18433
|
-
|
|
18640
|
+
p3._closePElement();
|
|
18434
18641
|
}
|
|
18435
|
-
function liEndTagInBody(
|
|
18436
|
-
if (
|
|
18437
|
-
|
|
18438
|
-
|
|
18642
|
+
function liEndTagInBody(p3) {
|
|
18643
|
+
if (p3.openElements.hasInListItemScope(TAG_ID.LI)) {
|
|
18644
|
+
p3.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.LI);
|
|
18645
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.LI);
|
|
18439
18646
|
}
|
|
18440
18647
|
}
|
|
18441
|
-
function ddEndTagInBody(
|
|
18648
|
+
function ddEndTagInBody(p3, token) {
|
|
18442
18649
|
const tn = token.tagID;
|
|
18443
|
-
if (
|
|
18444
|
-
|
|
18445
|
-
|
|
18650
|
+
if (p3.openElements.hasInScope(tn)) {
|
|
18651
|
+
p3.openElements.generateImpliedEndTagsWithExclusion(tn);
|
|
18652
|
+
p3.openElements.popUntilTagNamePopped(tn);
|
|
18446
18653
|
}
|
|
18447
18654
|
}
|
|
18448
|
-
function numberedHeaderEndTagInBody(
|
|
18449
|
-
if (
|
|
18450
|
-
|
|
18451
|
-
|
|
18655
|
+
function numberedHeaderEndTagInBody(p3) {
|
|
18656
|
+
if (p3.openElements.hasNumberedHeaderInScope()) {
|
|
18657
|
+
p3.openElements.generateImpliedEndTags();
|
|
18658
|
+
p3.openElements.popUntilNumberedHeaderPopped();
|
|
18452
18659
|
}
|
|
18453
18660
|
}
|
|
18454
|
-
function appletEndTagInBody(
|
|
18661
|
+
function appletEndTagInBody(p3, token) {
|
|
18455
18662
|
const tn = token.tagID;
|
|
18456
|
-
if (
|
|
18457
|
-
|
|
18458
|
-
|
|
18459
|
-
|
|
18663
|
+
if (p3.openElements.hasInScope(tn)) {
|
|
18664
|
+
p3.openElements.generateImpliedEndTags();
|
|
18665
|
+
p3.openElements.popUntilTagNamePopped(tn);
|
|
18666
|
+
p3.activeFormattingElements.clearToLastMarker();
|
|
18460
18667
|
}
|
|
18461
18668
|
}
|
|
18462
|
-
function brEndTagInBody(
|
|
18463
|
-
|
|
18464
|
-
|
|
18465
|
-
|
|
18466
|
-
|
|
18669
|
+
function brEndTagInBody(p3) {
|
|
18670
|
+
p3._reconstructActiveFormattingElements();
|
|
18671
|
+
p3._insertFakeElement(TAG_NAMES.BR, TAG_ID.BR);
|
|
18672
|
+
p3.openElements.pop();
|
|
18673
|
+
p3.framesetOk = false;
|
|
18467
18674
|
}
|
|
18468
|
-
function genericEndTagInBody(
|
|
18675
|
+
function genericEndTagInBody(p3, token) {
|
|
18469
18676
|
const tn = token.tagName;
|
|
18470
18677
|
const tid = token.tagID;
|
|
18471
|
-
for (let i2 =
|
|
18472
|
-
const element =
|
|
18473
|
-
const elementId =
|
|
18474
|
-
if (tid === elementId && (tid !== TAG_ID.UNKNOWN ||
|
|
18475
|
-
|
|
18476
|
-
if (
|
|
18477
|
-
|
|
18678
|
+
for (let i2 = p3.openElements.stackTop; i2 > 0; i2--) {
|
|
18679
|
+
const element = p3.openElements.items[i2];
|
|
18680
|
+
const elementId = p3.openElements.tagIDs[i2];
|
|
18681
|
+
if (tid === elementId && (tid !== TAG_ID.UNKNOWN || p3.treeAdapter.getTagName(element) === tn)) {
|
|
18682
|
+
p3.openElements.generateImpliedEndTagsWithExclusion(tid);
|
|
18683
|
+
if (p3.openElements.stackTop >= i2)
|
|
18684
|
+
p3.openElements.shortenToLength(i2);
|
|
18478
18685
|
break;
|
|
18479
18686
|
}
|
|
18480
|
-
if (
|
|
18687
|
+
if (p3._isSpecialElement(element, elementId)) {
|
|
18481
18688
|
break;
|
|
18482
18689
|
}
|
|
18483
18690
|
}
|
|
18484
18691
|
}
|
|
18485
|
-
function endTagInBody(
|
|
18692
|
+
function endTagInBody(p3, token) {
|
|
18486
18693
|
switch (token.tagID) {
|
|
18487
18694
|
case TAG_ID.A:
|
|
18488
18695
|
case TAG_ID.B:
|
|
@@ -18498,11 +18705,11 @@ function endTagInBody(p4, token) {
|
|
|
18498
18705
|
case TAG_ID.SMALL:
|
|
18499
18706
|
case TAG_ID.STRIKE:
|
|
18500
18707
|
case TAG_ID.STRONG: {
|
|
18501
|
-
callAdoptionAgency(
|
|
18708
|
+
callAdoptionAgency(p3, token);
|
|
18502
18709
|
break;
|
|
18503
18710
|
}
|
|
18504
18711
|
case TAG_ID.P: {
|
|
18505
|
-
pEndTagInBody(
|
|
18712
|
+
pEndTagInBody(p3);
|
|
18506
18713
|
break;
|
|
18507
18714
|
}
|
|
18508
18715
|
case TAG_ID.DL:
|
|
@@ -18532,16 +18739,16 @@ function endTagInBody(p4, token) {
|
|
|
18532
18739
|
case TAG_ID.FIELDSET:
|
|
18533
18740
|
case TAG_ID.BLOCKQUOTE:
|
|
18534
18741
|
case TAG_ID.FIGCAPTION: {
|
|
18535
|
-
addressEndTagInBody(
|
|
18742
|
+
addressEndTagInBody(p3, token);
|
|
18536
18743
|
break;
|
|
18537
18744
|
}
|
|
18538
18745
|
case TAG_ID.LI: {
|
|
18539
|
-
liEndTagInBody(
|
|
18746
|
+
liEndTagInBody(p3);
|
|
18540
18747
|
break;
|
|
18541
18748
|
}
|
|
18542
18749
|
case TAG_ID.DD:
|
|
18543
18750
|
case TAG_ID.DT: {
|
|
18544
|
-
ddEndTagInBody(
|
|
18751
|
+
ddEndTagInBody(p3, token);
|
|
18545
18752
|
break;
|
|
18546
18753
|
}
|
|
18547
18754
|
case TAG_ID.H1:
|
|
@@ -18550,191 +18757,191 @@ function endTagInBody(p4, token) {
|
|
|
18550
18757
|
case TAG_ID.H4:
|
|
18551
18758
|
case TAG_ID.H5:
|
|
18552
18759
|
case TAG_ID.H6: {
|
|
18553
|
-
numberedHeaderEndTagInBody(
|
|
18760
|
+
numberedHeaderEndTagInBody(p3);
|
|
18554
18761
|
break;
|
|
18555
18762
|
}
|
|
18556
18763
|
case TAG_ID.BR: {
|
|
18557
|
-
brEndTagInBody(
|
|
18764
|
+
brEndTagInBody(p3);
|
|
18558
18765
|
break;
|
|
18559
18766
|
}
|
|
18560
18767
|
case TAG_ID.BODY: {
|
|
18561
|
-
bodyEndTagInBody(
|
|
18768
|
+
bodyEndTagInBody(p3, token);
|
|
18562
18769
|
break;
|
|
18563
18770
|
}
|
|
18564
18771
|
case TAG_ID.HTML: {
|
|
18565
|
-
htmlEndTagInBody(
|
|
18772
|
+
htmlEndTagInBody(p3, token);
|
|
18566
18773
|
break;
|
|
18567
18774
|
}
|
|
18568
18775
|
case TAG_ID.FORM: {
|
|
18569
|
-
formEndTagInBody(
|
|
18776
|
+
formEndTagInBody(p3);
|
|
18570
18777
|
break;
|
|
18571
18778
|
}
|
|
18572
18779
|
case TAG_ID.APPLET:
|
|
18573
18780
|
case TAG_ID.OBJECT:
|
|
18574
18781
|
case TAG_ID.MARQUEE: {
|
|
18575
|
-
appletEndTagInBody(
|
|
18782
|
+
appletEndTagInBody(p3, token);
|
|
18576
18783
|
break;
|
|
18577
18784
|
}
|
|
18578
18785
|
case TAG_ID.TEMPLATE: {
|
|
18579
|
-
templateEndTagInHead(
|
|
18786
|
+
templateEndTagInHead(p3, token);
|
|
18580
18787
|
break;
|
|
18581
18788
|
}
|
|
18582
18789
|
default: {
|
|
18583
|
-
genericEndTagInBody(
|
|
18790
|
+
genericEndTagInBody(p3, token);
|
|
18584
18791
|
}
|
|
18585
18792
|
}
|
|
18586
18793
|
}
|
|
18587
|
-
function eofInBody(
|
|
18588
|
-
if (
|
|
18589
|
-
eofInTemplate(
|
|
18794
|
+
function eofInBody(p3, token) {
|
|
18795
|
+
if (p3.tmplInsertionModeStack.length > 0) {
|
|
18796
|
+
eofInTemplate(p3, token);
|
|
18590
18797
|
} else {
|
|
18591
|
-
stopParsing(
|
|
18798
|
+
stopParsing(p3, token);
|
|
18592
18799
|
}
|
|
18593
18800
|
}
|
|
18594
|
-
function endTagInText(
|
|
18801
|
+
function endTagInText(p3, token) {
|
|
18595
18802
|
var _a;
|
|
18596
18803
|
if (token.tagID === TAG_ID.SCRIPT) {
|
|
18597
|
-
(_a =
|
|
18598
|
-
}
|
|
18599
|
-
|
|
18600
|
-
|
|
18601
|
-
}
|
|
18602
|
-
function eofInText(
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
}
|
|
18608
|
-
function characterInTable(
|
|
18609
|
-
if (
|
|
18610
|
-
|
|
18611
|
-
|
|
18612
|
-
|
|
18613
|
-
|
|
18804
|
+
(_a = p3.scriptHandler) === null || _a === void 0 ? void 0 : _a.call(p3, p3.openElements.current);
|
|
18805
|
+
}
|
|
18806
|
+
p3.openElements.pop();
|
|
18807
|
+
p3.insertionMode = p3.originalInsertionMode;
|
|
18808
|
+
}
|
|
18809
|
+
function eofInText(p3, token) {
|
|
18810
|
+
p3._err(token, ERR.eofInElementThatCanContainOnlyText);
|
|
18811
|
+
p3.openElements.pop();
|
|
18812
|
+
p3.insertionMode = p3.originalInsertionMode;
|
|
18813
|
+
p3.onEof(token);
|
|
18814
|
+
}
|
|
18815
|
+
function characterInTable(p3, token) {
|
|
18816
|
+
if (p3.openElements.currentTagId !== void 0 && TABLE_STRUCTURE_TAGS.has(p3.openElements.currentTagId)) {
|
|
18817
|
+
p3.pendingCharacterTokens.length = 0;
|
|
18818
|
+
p3.hasNonWhitespacePendingCharacterToken = false;
|
|
18819
|
+
p3.originalInsertionMode = p3.insertionMode;
|
|
18820
|
+
p3.insertionMode = InsertionMode.IN_TABLE_TEXT;
|
|
18614
18821
|
switch (token.type) {
|
|
18615
18822
|
case TokenType.CHARACTER: {
|
|
18616
|
-
characterInTableText(
|
|
18823
|
+
characterInTableText(p3, token);
|
|
18617
18824
|
break;
|
|
18618
18825
|
}
|
|
18619
18826
|
case TokenType.WHITESPACE_CHARACTER: {
|
|
18620
|
-
whitespaceCharacterInTableText(
|
|
18827
|
+
whitespaceCharacterInTableText(p3, token);
|
|
18621
18828
|
break;
|
|
18622
18829
|
}
|
|
18623
18830
|
}
|
|
18624
18831
|
} else {
|
|
18625
|
-
tokenInTable(
|
|
18832
|
+
tokenInTable(p3, token);
|
|
18626
18833
|
}
|
|
18627
18834
|
}
|
|
18628
|
-
function captionStartTagInTable(
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18835
|
+
function captionStartTagInTable(p3, token) {
|
|
18836
|
+
p3.openElements.clearBackToTableContext();
|
|
18837
|
+
p3.activeFormattingElements.insertMarker();
|
|
18838
|
+
p3._insertElement(token, NS.HTML);
|
|
18839
|
+
p3.insertionMode = InsertionMode.IN_CAPTION;
|
|
18633
18840
|
}
|
|
18634
|
-
function colgroupStartTagInTable(
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18841
|
+
function colgroupStartTagInTable(p3, token) {
|
|
18842
|
+
p3.openElements.clearBackToTableContext();
|
|
18843
|
+
p3._insertElement(token, NS.HTML);
|
|
18844
|
+
p3.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
18638
18845
|
}
|
|
18639
|
-
function colStartTagInTable(
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18643
|
-
startTagInColumnGroup(
|
|
18846
|
+
function colStartTagInTable(p3, token) {
|
|
18847
|
+
p3.openElements.clearBackToTableContext();
|
|
18848
|
+
p3._insertFakeElement(TAG_NAMES.COLGROUP, TAG_ID.COLGROUP);
|
|
18849
|
+
p3.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
18850
|
+
startTagInColumnGroup(p3, token);
|
|
18644
18851
|
}
|
|
18645
|
-
function tbodyStartTagInTable(
|
|
18646
|
-
|
|
18647
|
-
|
|
18648
|
-
|
|
18852
|
+
function tbodyStartTagInTable(p3, token) {
|
|
18853
|
+
p3.openElements.clearBackToTableContext();
|
|
18854
|
+
p3._insertElement(token, NS.HTML);
|
|
18855
|
+
p3.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
18649
18856
|
}
|
|
18650
|
-
function tdStartTagInTable(
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
startTagInTableBody(
|
|
18857
|
+
function tdStartTagInTable(p3, token) {
|
|
18858
|
+
p3.openElements.clearBackToTableContext();
|
|
18859
|
+
p3._insertFakeElement(TAG_NAMES.TBODY, TAG_ID.TBODY);
|
|
18860
|
+
p3.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
18861
|
+
startTagInTableBody(p3, token);
|
|
18655
18862
|
}
|
|
18656
|
-
function tableStartTagInTable(
|
|
18657
|
-
if (
|
|
18658
|
-
|
|
18659
|
-
|
|
18660
|
-
|
|
18863
|
+
function tableStartTagInTable(p3, token) {
|
|
18864
|
+
if (p3.openElements.hasInTableScope(TAG_ID.TABLE)) {
|
|
18865
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.TABLE);
|
|
18866
|
+
p3._resetInsertionMode();
|
|
18867
|
+
p3._processStartTag(token);
|
|
18661
18868
|
}
|
|
18662
18869
|
}
|
|
18663
|
-
function inputStartTagInTable(
|
|
18870
|
+
function inputStartTagInTable(p3, token) {
|
|
18664
18871
|
if (isHiddenInput(token)) {
|
|
18665
|
-
|
|
18872
|
+
p3._appendElement(token, NS.HTML);
|
|
18666
18873
|
} else {
|
|
18667
|
-
tokenInTable(
|
|
18874
|
+
tokenInTable(p3, token);
|
|
18668
18875
|
}
|
|
18669
18876
|
token.ackSelfClosing = true;
|
|
18670
18877
|
}
|
|
18671
|
-
function formStartTagInTable(
|
|
18672
|
-
if (!
|
|
18673
|
-
|
|
18674
|
-
|
|
18675
|
-
|
|
18878
|
+
function formStartTagInTable(p3, token) {
|
|
18879
|
+
if (!p3.formElement && p3.openElements.tmplCount === 0) {
|
|
18880
|
+
p3._insertElement(token, NS.HTML);
|
|
18881
|
+
p3.formElement = p3.openElements.current;
|
|
18882
|
+
p3.openElements.pop();
|
|
18676
18883
|
}
|
|
18677
18884
|
}
|
|
18678
|
-
function startTagInTable(
|
|
18885
|
+
function startTagInTable(p3, token) {
|
|
18679
18886
|
switch (token.tagID) {
|
|
18680
18887
|
case TAG_ID.TD:
|
|
18681
18888
|
case TAG_ID.TH:
|
|
18682
18889
|
case TAG_ID.TR: {
|
|
18683
|
-
tdStartTagInTable(
|
|
18890
|
+
tdStartTagInTable(p3, token);
|
|
18684
18891
|
break;
|
|
18685
18892
|
}
|
|
18686
18893
|
case TAG_ID.STYLE:
|
|
18687
18894
|
case TAG_ID.SCRIPT:
|
|
18688
18895
|
case TAG_ID.TEMPLATE: {
|
|
18689
|
-
startTagInHead(
|
|
18896
|
+
startTagInHead(p3, token);
|
|
18690
18897
|
break;
|
|
18691
18898
|
}
|
|
18692
18899
|
case TAG_ID.COL: {
|
|
18693
|
-
colStartTagInTable(
|
|
18900
|
+
colStartTagInTable(p3, token);
|
|
18694
18901
|
break;
|
|
18695
18902
|
}
|
|
18696
18903
|
case TAG_ID.FORM: {
|
|
18697
|
-
formStartTagInTable(
|
|
18904
|
+
formStartTagInTable(p3, token);
|
|
18698
18905
|
break;
|
|
18699
18906
|
}
|
|
18700
18907
|
case TAG_ID.TABLE: {
|
|
18701
|
-
tableStartTagInTable(
|
|
18908
|
+
tableStartTagInTable(p3, token);
|
|
18702
18909
|
break;
|
|
18703
18910
|
}
|
|
18704
18911
|
case TAG_ID.TBODY:
|
|
18705
18912
|
case TAG_ID.TFOOT:
|
|
18706
18913
|
case TAG_ID.THEAD: {
|
|
18707
|
-
tbodyStartTagInTable(
|
|
18914
|
+
tbodyStartTagInTable(p3, token);
|
|
18708
18915
|
break;
|
|
18709
18916
|
}
|
|
18710
18917
|
case TAG_ID.INPUT: {
|
|
18711
|
-
inputStartTagInTable(
|
|
18918
|
+
inputStartTagInTable(p3, token);
|
|
18712
18919
|
break;
|
|
18713
18920
|
}
|
|
18714
18921
|
case TAG_ID.CAPTION: {
|
|
18715
|
-
captionStartTagInTable(
|
|
18922
|
+
captionStartTagInTable(p3, token);
|
|
18716
18923
|
break;
|
|
18717
18924
|
}
|
|
18718
18925
|
case TAG_ID.COLGROUP: {
|
|
18719
|
-
colgroupStartTagInTable(
|
|
18926
|
+
colgroupStartTagInTable(p3, token);
|
|
18720
18927
|
break;
|
|
18721
18928
|
}
|
|
18722
18929
|
default: {
|
|
18723
|
-
tokenInTable(
|
|
18930
|
+
tokenInTable(p3, token);
|
|
18724
18931
|
}
|
|
18725
18932
|
}
|
|
18726
18933
|
}
|
|
18727
|
-
function endTagInTable(
|
|
18934
|
+
function endTagInTable(p3, token) {
|
|
18728
18935
|
switch (token.tagID) {
|
|
18729
18936
|
case TAG_ID.TABLE: {
|
|
18730
|
-
if (
|
|
18731
|
-
|
|
18732
|
-
|
|
18937
|
+
if (p3.openElements.hasInTableScope(TAG_ID.TABLE)) {
|
|
18938
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.TABLE);
|
|
18939
|
+
p3._resetInsertionMode();
|
|
18733
18940
|
}
|
|
18734
18941
|
break;
|
|
18735
18942
|
}
|
|
18736
18943
|
case TAG_ID.TEMPLATE: {
|
|
18737
|
-
templateEndTagInHead(
|
|
18944
|
+
templateEndTagInHead(p3, token);
|
|
18738
18945
|
break;
|
|
18739
18946
|
}
|
|
18740
18947
|
case TAG_ID.BODY:
|
|
@@ -18751,64 +18958,64 @@ function endTagInTable(p4, token) {
|
|
|
18751
18958
|
break;
|
|
18752
18959
|
}
|
|
18753
18960
|
default: {
|
|
18754
|
-
tokenInTable(
|
|
18961
|
+
tokenInTable(p3, token);
|
|
18755
18962
|
}
|
|
18756
18963
|
}
|
|
18757
18964
|
}
|
|
18758
|
-
function tokenInTable(
|
|
18759
|
-
const savedFosterParentingState =
|
|
18760
|
-
|
|
18761
|
-
modeInBody(
|
|
18762
|
-
|
|
18965
|
+
function tokenInTable(p3, token) {
|
|
18966
|
+
const savedFosterParentingState = p3.fosterParentingEnabled;
|
|
18967
|
+
p3.fosterParentingEnabled = true;
|
|
18968
|
+
modeInBody(p3, token);
|
|
18969
|
+
p3.fosterParentingEnabled = savedFosterParentingState;
|
|
18763
18970
|
}
|
|
18764
|
-
function whitespaceCharacterInTableText(
|
|
18765
|
-
|
|
18971
|
+
function whitespaceCharacterInTableText(p3, token) {
|
|
18972
|
+
p3.pendingCharacterTokens.push(token);
|
|
18766
18973
|
}
|
|
18767
|
-
function characterInTableText(
|
|
18768
|
-
|
|
18769
|
-
|
|
18974
|
+
function characterInTableText(p3, token) {
|
|
18975
|
+
p3.pendingCharacterTokens.push(token);
|
|
18976
|
+
p3.hasNonWhitespacePendingCharacterToken = true;
|
|
18770
18977
|
}
|
|
18771
|
-
function tokenInTableText(
|
|
18978
|
+
function tokenInTableText(p3, token) {
|
|
18772
18979
|
let i2 = 0;
|
|
18773
|
-
if (
|
|
18774
|
-
for (; i2 <
|
|
18775
|
-
tokenInTable(
|
|
18980
|
+
if (p3.hasNonWhitespacePendingCharacterToken) {
|
|
18981
|
+
for (; i2 < p3.pendingCharacterTokens.length; i2++) {
|
|
18982
|
+
tokenInTable(p3, p3.pendingCharacterTokens[i2]);
|
|
18776
18983
|
}
|
|
18777
18984
|
} else {
|
|
18778
|
-
for (; i2 <
|
|
18779
|
-
|
|
18985
|
+
for (; i2 < p3.pendingCharacterTokens.length; i2++) {
|
|
18986
|
+
p3._insertCharacters(p3.pendingCharacterTokens[i2]);
|
|
18780
18987
|
}
|
|
18781
18988
|
}
|
|
18782
|
-
|
|
18783
|
-
|
|
18989
|
+
p3.insertionMode = p3.originalInsertionMode;
|
|
18990
|
+
p3._processToken(token);
|
|
18784
18991
|
}
|
|
18785
18992
|
var TABLE_VOID_ELEMENTS = /* @__PURE__ */ new Set([TAG_ID.CAPTION, TAG_ID.COL, TAG_ID.COLGROUP, TAG_ID.TBODY, TAG_ID.TD, TAG_ID.TFOOT, TAG_ID.TH, TAG_ID.THEAD, TAG_ID.TR]);
|
|
18786
|
-
function startTagInCaption(
|
|
18993
|
+
function startTagInCaption(p3, token) {
|
|
18787
18994
|
const tn = token.tagID;
|
|
18788
18995
|
if (TABLE_VOID_ELEMENTS.has(tn)) {
|
|
18789
|
-
if (
|
|
18790
|
-
|
|
18791
|
-
|
|
18792
|
-
|
|
18793
|
-
|
|
18794
|
-
startTagInTable(
|
|
18996
|
+
if (p3.openElements.hasInTableScope(TAG_ID.CAPTION)) {
|
|
18997
|
+
p3.openElements.generateImpliedEndTags();
|
|
18998
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.CAPTION);
|
|
18999
|
+
p3.activeFormattingElements.clearToLastMarker();
|
|
19000
|
+
p3.insertionMode = InsertionMode.IN_TABLE;
|
|
19001
|
+
startTagInTable(p3, token);
|
|
18795
19002
|
}
|
|
18796
19003
|
} else {
|
|
18797
|
-
startTagInBody(
|
|
19004
|
+
startTagInBody(p3, token);
|
|
18798
19005
|
}
|
|
18799
19006
|
}
|
|
18800
|
-
function endTagInCaption(
|
|
19007
|
+
function endTagInCaption(p3, token) {
|
|
18801
19008
|
const tn = token.tagID;
|
|
18802
19009
|
switch (tn) {
|
|
18803
19010
|
case TAG_ID.CAPTION:
|
|
18804
19011
|
case TAG_ID.TABLE: {
|
|
18805
|
-
if (
|
|
18806
|
-
|
|
18807
|
-
|
|
18808
|
-
|
|
18809
|
-
|
|
19012
|
+
if (p3.openElements.hasInTableScope(TAG_ID.CAPTION)) {
|
|
19013
|
+
p3.openElements.generateImpliedEndTags();
|
|
19014
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.CAPTION);
|
|
19015
|
+
p3.activeFormattingElements.clearToLastMarker();
|
|
19016
|
+
p3.insertionMode = InsertionMode.IN_TABLE;
|
|
18810
19017
|
if (tn === TAG_ID.TABLE) {
|
|
18811
|
-
endTagInTable(
|
|
19018
|
+
endTagInTable(p3, token);
|
|
18812
19019
|
}
|
|
18813
19020
|
}
|
|
18814
19021
|
break;
|
|
@@ -18826,72 +19033,72 @@ function endTagInCaption(p4, token) {
|
|
|
18826
19033
|
break;
|
|
18827
19034
|
}
|
|
18828
19035
|
default: {
|
|
18829
|
-
endTagInBody(
|
|
19036
|
+
endTagInBody(p3, token);
|
|
18830
19037
|
}
|
|
18831
19038
|
}
|
|
18832
19039
|
}
|
|
18833
|
-
function startTagInColumnGroup(
|
|
19040
|
+
function startTagInColumnGroup(p3, token) {
|
|
18834
19041
|
switch (token.tagID) {
|
|
18835
19042
|
case TAG_ID.HTML: {
|
|
18836
|
-
startTagInBody(
|
|
19043
|
+
startTagInBody(p3, token);
|
|
18837
19044
|
break;
|
|
18838
19045
|
}
|
|
18839
19046
|
case TAG_ID.COL: {
|
|
18840
|
-
|
|
19047
|
+
p3._appendElement(token, NS.HTML);
|
|
18841
19048
|
token.ackSelfClosing = true;
|
|
18842
19049
|
break;
|
|
18843
19050
|
}
|
|
18844
19051
|
case TAG_ID.TEMPLATE: {
|
|
18845
|
-
startTagInHead(
|
|
19052
|
+
startTagInHead(p3, token);
|
|
18846
19053
|
break;
|
|
18847
19054
|
}
|
|
18848
19055
|
default: {
|
|
18849
|
-
tokenInColumnGroup(
|
|
19056
|
+
tokenInColumnGroup(p3, token);
|
|
18850
19057
|
}
|
|
18851
19058
|
}
|
|
18852
19059
|
}
|
|
18853
|
-
function endTagInColumnGroup(
|
|
19060
|
+
function endTagInColumnGroup(p3, token) {
|
|
18854
19061
|
switch (token.tagID) {
|
|
18855
19062
|
case TAG_ID.COLGROUP: {
|
|
18856
|
-
if (
|
|
18857
|
-
|
|
18858
|
-
|
|
19063
|
+
if (p3.openElements.currentTagId === TAG_ID.COLGROUP) {
|
|
19064
|
+
p3.openElements.pop();
|
|
19065
|
+
p3.insertionMode = InsertionMode.IN_TABLE;
|
|
18859
19066
|
}
|
|
18860
19067
|
break;
|
|
18861
19068
|
}
|
|
18862
19069
|
case TAG_ID.TEMPLATE: {
|
|
18863
|
-
templateEndTagInHead(
|
|
19070
|
+
templateEndTagInHead(p3, token);
|
|
18864
19071
|
break;
|
|
18865
19072
|
}
|
|
18866
19073
|
case TAG_ID.COL: {
|
|
18867
19074
|
break;
|
|
18868
19075
|
}
|
|
18869
19076
|
default: {
|
|
18870
|
-
tokenInColumnGroup(
|
|
19077
|
+
tokenInColumnGroup(p3, token);
|
|
18871
19078
|
}
|
|
18872
19079
|
}
|
|
18873
19080
|
}
|
|
18874
|
-
function tokenInColumnGroup(
|
|
18875
|
-
if (
|
|
18876
|
-
|
|
18877
|
-
|
|
18878
|
-
|
|
19081
|
+
function tokenInColumnGroup(p3, token) {
|
|
19082
|
+
if (p3.openElements.currentTagId === TAG_ID.COLGROUP) {
|
|
19083
|
+
p3.openElements.pop();
|
|
19084
|
+
p3.insertionMode = InsertionMode.IN_TABLE;
|
|
19085
|
+
p3._processToken(token);
|
|
18879
19086
|
}
|
|
18880
19087
|
}
|
|
18881
|
-
function startTagInTableBody(
|
|
19088
|
+
function startTagInTableBody(p3, token) {
|
|
18882
19089
|
switch (token.tagID) {
|
|
18883
19090
|
case TAG_ID.TR: {
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
|
|
19091
|
+
p3.openElements.clearBackToTableBodyContext();
|
|
19092
|
+
p3._insertElement(token, NS.HTML);
|
|
19093
|
+
p3.insertionMode = InsertionMode.IN_ROW;
|
|
18887
19094
|
break;
|
|
18888
19095
|
}
|
|
18889
19096
|
case TAG_ID.TH:
|
|
18890
19097
|
case TAG_ID.TD: {
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
startTagInRow(
|
|
19098
|
+
p3.openElements.clearBackToTableBodyContext();
|
|
19099
|
+
p3._insertFakeElement(TAG_NAMES.TR, TAG_ID.TR);
|
|
19100
|
+
p3.insertionMode = InsertionMode.IN_ROW;
|
|
19101
|
+
startTagInRow(p3, token);
|
|
18895
19102
|
break;
|
|
18896
19103
|
}
|
|
18897
19104
|
case TAG_ID.CAPTION:
|
|
@@ -18900,38 +19107,38 @@ function startTagInTableBody(p4, token) {
|
|
|
18900
19107
|
case TAG_ID.TBODY:
|
|
18901
19108
|
case TAG_ID.TFOOT:
|
|
18902
19109
|
case TAG_ID.THEAD: {
|
|
18903
|
-
if (
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
startTagInTable(
|
|
19110
|
+
if (p3.openElements.hasTableBodyContextInTableScope()) {
|
|
19111
|
+
p3.openElements.clearBackToTableBodyContext();
|
|
19112
|
+
p3.openElements.pop();
|
|
19113
|
+
p3.insertionMode = InsertionMode.IN_TABLE;
|
|
19114
|
+
startTagInTable(p3, token);
|
|
18908
19115
|
}
|
|
18909
19116
|
break;
|
|
18910
19117
|
}
|
|
18911
19118
|
default: {
|
|
18912
|
-
startTagInTable(
|
|
19119
|
+
startTagInTable(p3, token);
|
|
18913
19120
|
}
|
|
18914
19121
|
}
|
|
18915
19122
|
}
|
|
18916
|
-
function endTagInTableBody(
|
|
19123
|
+
function endTagInTableBody(p3, token) {
|
|
18917
19124
|
const tn = token.tagID;
|
|
18918
19125
|
switch (token.tagID) {
|
|
18919
19126
|
case TAG_ID.TBODY:
|
|
18920
19127
|
case TAG_ID.TFOOT:
|
|
18921
19128
|
case TAG_ID.THEAD: {
|
|
18922
|
-
if (
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
19129
|
+
if (p3.openElements.hasInTableScope(tn)) {
|
|
19130
|
+
p3.openElements.clearBackToTableBodyContext();
|
|
19131
|
+
p3.openElements.pop();
|
|
19132
|
+
p3.insertionMode = InsertionMode.IN_TABLE;
|
|
18926
19133
|
}
|
|
18927
19134
|
break;
|
|
18928
19135
|
}
|
|
18929
19136
|
case TAG_ID.TABLE: {
|
|
18930
|
-
if (
|
|
18931
|
-
|
|
18932
|
-
|
|
18933
|
-
|
|
18934
|
-
endTagInTable(
|
|
19137
|
+
if (p3.openElements.hasTableBodyContextInTableScope()) {
|
|
19138
|
+
p3.openElements.clearBackToTableBodyContext();
|
|
19139
|
+
p3.openElements.pop();
|
|
19140
|
+
p3.insertionMode = InsertionMode.IN_TABLE;
|
|
19141
|
+
endTagInTable(p3, token);
|
|
18935
19142
|
}
|
|
18936
19143
|
break;
|
|
18937
19144
|
}
|
|
@@ -18946,18 +19153,18 @@ function endTagInTableBody(p4, token) {
|
|
|
18946
19153
|
break;
|
|
18947
19154
|
}
|
|
18948
19155
|
default: {
|
|
18949
|
-
endTagInTable(
|
|
19156
|
+
endTagInTable(p3, token);
|
|
18950
19157
|
}
|
|
18951
19158
|
}
|
|
18952
19159
|
}
|
|
18953
|
-
function startTagInRow(
|
|
19160
|
+
function startTagInRow(p3, token) {
|
|
18954
19161
|
switch (token.tagID) {
|
|
18955
19162
|
case TAG_ID.TH:
|
|
18956
19163
|
case TAG_ID.TD: {
|
|
18957
|
-
|
|
18958
|
-
|
|
18959
|
-
|
|
18960
|
-
|
|
19164
|
+
p3.openElements.clearBackToTableRowContext();
|
|
19165
|
+
p3._insertElement(token, NS.HTML);
|
|
19166
|
+
p3.insertionMode = InsertionMode.IN_CELL;
|
|
19167
|
+
p3.activeFormattingElements.insertMarker();
|
|
18961
19168
|
break;
|
|
18962
19169
|
}
|
|
18963
19170
|
case TAG_ID.CAPTION:
|
|
@@ -18967,46 +19174,46 @@ function startTagInRow(p4, token) {
|
|
|
18967
19174
|
case TAG_ID.TFOOT:
|
|
18968
19175
|
case TAG_ID.THEAD:
|
|
18969
19176
|
case TAG_ID.TR: {
|
|
18970
|
-
if (
|
|
18971
|
-
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
startTagInTableBody(
|
|
19177
|
+
if (p3.openElements.hasInTableScope(TAG_ID.TR)) {
|
|
19178
|
+
p3.openElements.clearBackToTableRowContext();
|
|
19179
|
+
p3.openElements.pop();
|
|
19180
|
+
p3.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
19181
|
+
startTagInTableBody(p3, token);
|
|
18975
19182
|
}
|
|
18976
19183
|
break;
|
|
18977
19184
|
}
|
|
18978
19185
|
default: {
|
|
18979
|
-
startTagInTable(
|
|
19186
|
+
startTagInTable(p3, token);
|
|
18980
19187
|
}
|
|
18981
19188
|
}
|
|
18982
19189
|
}
|
|
18983
|
-
function endTagInRow(
|
|
19190
|
+
function endTagInRow(p3, token) {
|
|
18984
19191
|
switch (token.tagID) {
|
|
18985
19192
|
case TAG_ID.TR: {
|
|
18986
|
-
if (
|
|
18987
|
-
|
|
18988
|
-
|
|
18989
|
-
|
|
19193
|
+
if (p3.openElements.hasInTableScope(TAG_ID.TR)) {
|
|
19194
|
+
p3.openElements.clearBackToTableRowContext();
|
|
19195
|
+
p3.openElements.pop();
|
|
19196
|
+
p3.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
18990
19197
|
}
|
|
18991
19198
|
break;
|
|
18992
19199
|
}
|
|
18993
19200
|
case TAG_ID.TABLE: {
|
|
18994
|
-
if (
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
endTagInTableBody(
|
|
19201
|
+
if (p3.openElements.hasInTableScope(TAG_ID.TR)) {
|
|
19202
|
+
p3.openElements.clearBackToTableRowContext();
|
|
19203
|
+
p3.openElements.pop();
|
|
19204
|
+
p3.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
19205
|
+
endTagInTableBody(p3, token);
|
|
18999
19206
|
}
|
|
19000
19207
|
break;
|
|
19001
19208
|
}
|
|
19002
19209
|
case TAG_ID.TBODY:
|
|
19003
19210
|
case TAG_ID.TFOOT:
|
|
19004
19211
|
case TAG_ID.THEAD: {
|
|
19005
|
-
if (
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
|
|
19009
|
-
endTagInTableBody(
|
|
19212
|
+
if (p3.openElements.hasInTableScope(token.tagID) || p3.openElements.hasInTableScope(TAG_ID.TR)) {
|
|
19213
|
+
p3.openElements.clearBackToTableRowContext();
|
|
19214
|
+
p3.openElements.pop();
|
|
19215
|
+
p3.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
19216
|
+
endTagInTableBody(p3, token);
|
|
19010
19217
|
}
|
|
19011
19218
|
break;
|
|
19012
19219
|
}
|
|
@@ -19020,31 +19227,31 @@ function endTagInRow(p4, token) {
|
|
|
19020
19227
|
break;
|
|
19021
19228
|
}
|
|
19022
19229
|
default: {
|
|
19023
|
-
endTagInTable(
|
|
19230
|
+
endTagInTable(p3, token);
|
|
19024
19231
|
}
|
|
19025
19232
|
}
|
|
19026
19233
|
}
|
|
19027
|
-
function startTagInCell(
|
|
19234
|
+
function startTagInCell(p3, token) {
|
|
19028
19235
|
const tn = token.tagID;
|
|
19029
19236
|
if (TABLE_VOID_ELEMENTS.has(tn)) {
|
|
19030
|
-
if (
|
|
19031
|
-
|
|
19032
|
-
startTagInRow(
|
|
19237
|
+
if (p3.openElements.hasInTableScope(TAG_ID.TD) || p3.openElements.hasInTableScope(TAG_ID.TH)) {
|
|
19238
|
+
p3._closeTableCell();
|
|
19239
|
+
startTagInRow(p3, token);
|
|
19033
19240
|
}
|
|
19034
19241
|
} else {
|
|
19035
|
-
startTagInBody(
|
|
19242
|
+
startTagInBody(p3, token);
|
|
19036
19243
|
}
|
|
19037
19244
|
}
|
|
19038
|
-
function endTagInCell(
|
|
19245
|
+
function endTagInCell(p3, token) {
|
|
19039
19246
|
const tn = token.tagID;
|
|
19040
19247
|
switch (tn) {
|
|
19041
19248
|
case TAG_ID.TD:
|
|
19042
19249
|
case TAG_ID.TH: {
|
|
19043
|
-
if (
|
|
19044
|
-
|
|
19045
|
-
|
|
19046
|
-
|
|
19047
|
-
|
|
19250
|
+
if (p3.openElements.hasInTableScope(tn)) {
|
|
19251
|
+
p3.openElements.generateImpliedEndTags();
|
|
19252
|
+
p3.openElements.popUntilTagNamePopped(tn);
|
|
19253
|
+
p3.activeFormattingElements.clearToLastMarker();
|
|
19254
|
+
p3.insertionMode = InsertionMode.IN_ROW;
|
|
19048
19255
|
}
|
|
19049
19256
|
break;
|
|
19050
19257
|
}
|
|
@@ -19053,9 +19260,9 @@ function endTagInCell(p4, token) {
|
|
|
19053
19260
|
case TAG_ID.TFOOT:
|
|
19054
19261
|
case TAG_ID.THEAD:
|
|
19055
19262
|
case TAG_ID.TR: {
|
|
19056
|
-
if (
|
|
19057
|
-
|
|
19058
|
-
endTagInRow(
|
|
19263
|
+
if (p3.openElements.hasInTableScope(tn)) {
|
|
19264
|
+
p3._closeTableCell();
|
|
19265
|
+
endTagInRow(p3, token);
|
|
19059
19266
|
}
|
|
19060
19267
|
break;
|
|
19061
19268
|
}
|
|
@@ -19067,41 +19274,41 @@ function endTagInCell(p4, token) {
|
|
|
19067
19274
|
break;
|
|
19068
19275
|
}
|
|
19069
19276
|
default: {
|
|
19070
|
-
endTagInBody(
|
|
19277
|
+
endTagInBody(p3, token);
|
|
19071
19278
|
}
|
|
19072
19279
|
}
|
|
19073
19280
|
}
|
|
19074
|
-
function startTagInSelect(
|
|
19281
|
+
function startTagInSelect(p3, token) {
|
|
19075
19282
|
switch (token.tagID) {
|
|
19076
19283
|
case TAG_ID.HTML: {
|
|
19077
|
-
startTagInBody(
|
|
19284
|
+
startTagInBody(p3, token);
|
|
19078
19285
|
break;
|
|
19079
19286
|
}
|
|
19080
19287
|
case TAG_ID.OPTION: {
|
|
19081
|
-
if (
|
|
19082
|
-
|
|
19288
|
+
if (p3.openElements.currentTagId === TAG_ID.OPTION) {
|
|
19289
|
+
p3.openElements.pop();
|
|
19083
19290
|
}
|
|
19084
|
-
|
|
19291
|
+
p3._insertElement(token, NS.HTML);
|
|
19085
19292
|
break;
|
|
19086
19293
|
}
|
|
19087
19294
|
case TAG_ID.OPTGROUP: {
|
|
19088
|
-
if (
|
|
19089
|
-
|
|
19295
|
+
if (p3.openElements.currentTagId === TAG_ID.OPTION) {
|
|
19296
|
+
p3.openElements.pop();
|
|
19090
19297
|
}
|
|
19091
|
-
if (
|
|
19092
|
-
|
|
19298
|
+
if (p3.openElements.currentTagId === TAG_ID.OPTGROUP) {
|
|
19299
|
+
p3.openElements.pop();
|
|
19093
19300
|
}
|
|
19094
|
-
|
|
19301
|
+
p3._insertElement(token, NS.HTML);
|
|
19095
19302
|
break;
|
|
19096
19303
|
}
|
|
19097
19304
|
case TAG_ID.HR: {
|
|
19098
|
-
if (
|
|
19099
|
-
|
|
19305
|
+
if (p3.openElements.currentTagId === TAG_ID.OPTION) {
|
|
19306
|
+
p3.openElements.pop();
|
|
19100
19307
|
}
|
|
19101
|
-
if (
|
|
19102
|
-
|
|
19308
|
+
if (p3.openElements.currentTagId === TAG_ID.OPTGROUP) {
|
|
19309
|
+
p3.openElements.pop();
|
|
19103
19310
|
}
|
|
19104
|
-
|
|
19311
|
+
p3._appendElement(token, NS.HTML);
|
|
19105
19312
|
token.ackSelfClosing = true;
|
|
19106
19313
|
break;
|
|
19107
19314
|
}
|
|
@@ -19109,77 +19316,77 @@ function startTagInSelect(p4, token) {
|
|
|
19109
19316
|
case TAG_ID.KEYGEN:
|
|
19110
19317
|
case TAG_ID.TEXTAREA:
|
|
19111
19318
|
case TAG_ID.SELECT: {
|
|
19112
|
-
if (
|
|
19113
|
-
|
|
19114
|
-
|
|
19319
|
+
if (p3.openElements.hasInSelectScope(TAG_ID.SELECT)) {
|
|
19320
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
|
|
19321
|
+
p3._resetInsertionMode();
|
|
19115
19322
|
if (token.tagID !== TAG_ID.SELECT) {
|
|
19116
|
-
|
|
19323
|
+
p3._processStartTag(token);
|
|
19117
19324
|
}
|
|
19118
19325
|
}
|
|
19119
19326
|
break;
|
|
19120
19327
|
}
|
|
19121
19328
|
case TAG_ID.SCRIPT:
|
|
19122
19329
|
case TAG_ID.TEMPLATE: {
|
|
19123
|
-
startTagInHead(
|
|
19330
|
+
startTagInHead(p3, token);
|
|
19124
19331
|
break;
|
|
19125
19332
|
}
|
|
19126
19333
|
default:
|
|
19127
19334
|
}
|
|
19128
19335
|
}
|
|
19129
|
-
function endTagInSelect(
|
|
19336
|
+
function endTagInSelect(p3, token) {
|
|
19130
19337
|
switch (token.tagID) {
|
|
19131
19338
|
case TAG_ID.OPTGROUP: {
|
|
19132
|
-
if (
|
|
19133
|
-
|
|
19339
|
+
if (p3.openElements.stackTop > 0 && p3.openElements.currentTagId === TAG_ID.OPTION && p3.openElements.tagIDs[p3.openElements.stackTop - 1] === TAG_ID.OPTGROUP) {
|
|
19340
|
+
p3.openElements.pop();
|
|
19134
19341
|
}
|
|
19135
|
-
if (
|
|
19136
|
-
|
|
19342
|
+
if (p3.openElements.currentTagId === TAG_ID.OPTGROUP) {
|
|
19343
|
+
p3.openElements.pop();
|
|
19137
19344
|
}
|
|
19138
19345
|
break;
|
|
19139
19346
|
}
|
|
19140
19347
|
case TAG_ID.OPTION: {
|
|
19141
|
-
if (
|
|
19142
|
-
|
|
19348
|
+
if (p3.openElements.currentTagId === TAG_ID.OPTION) {
|
|
19349
|
+
p3.openElements.pop();
|
|
19143
19350
|
}
|
|
19144
19351
|
break;
|
|
19145
19352
|
}
|
|
19146
19353
|
case TAG_ID.SELECT: {
|
|
19147
|
-
if (
|
|
19148
|
-
|
|
19149
|
-
|
|
19354
|
+
if (p3.openElements.hasInSelectScope(TAG_ID.SELECT)) {
|
|
19355
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
|
|
19356
|
+
p3._resetInsertionMode();
|
|
19150
19357
|
}
|
|
19151
19358
|
break;
|
|
19152
19359
|
}
|
|
19153
19360
|
case TAG_ID.TEMPLATE: {
|
|
19154
|
-
templateEndTagInHead(
|
|
19361
|
+
templateEndTagInHead(p3, token);
|
|
19155
19362
|
break;
|
|
19156
19363
|
}
|
|
19157
19364
|
default:
|
|
19158
19365
|
}
|
|
19159
19366
|
}
|
|
19160
|
-
function startTagInSelectInTable(
|
|
19367
|
+
function startTagInSelectInTable(p3, token) {
|
|
19161
19368
|
const tn = token.tagID;
|
|
19162
19369
|
if (tn === TAG_ID.CAPTION || tn === TAG_ID.TABLE || tn === TAG_ID.TBODY || tn === TAG_ID.TFOOT || tn === TAG_ID.THEAD || tn === TAG_ID.TR || tn === TAG_ID.TD || tn === TAG_ID.TH) {
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19370
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
|
|
19371
|
+
p3._resetInsertionMode();
|
|
19372
|
+
p3._processStartTag(token);
|
|
19166
19373
|
} else {
|
|
19167
|
-
startTagInSelect(
|
|
19374
|
+
startTagInSelect(p3, token);
|
|
19168
19375
|
}
|
|
19169
19376
|
}
|
|
19170
|
-
function endTagInSelectInTable(
|
|
19377
|
+
function endTagInSelectInTable(p3, token) {
|
|
19171
19378
|
const tn = token.tagID;
|
|
19172
19379
|
if (tn === TAG_ID.CAPTION || tn === TAG_ID.TABLE || tn === TAG_ID.TBODY || tn === TAG_ID.TFOOT || tn === TAG_ID.THEAD || tn === TAG_ID.TR || tn === TAG_ID.TD || tn === TAG_ID.TH) {
|
|
19173
|
-
if (
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
|
|
19380
|
+
if (p3.openElements.hasInTableScope(tn)) {
|
|
19381
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.SELECT);
|
|
19382
|
+
p3._resetInsertionMode();
|
|
19383
|
+
p3.onEndTag(token);
|
|
19177
19384
|
}
|
|
19178
19385
|
} else {
|
|
19179
|
-
endTagInSelect(
|
|
19386
|
+
endTagInSelect(p3, token);
|
|
19180
19387
|
}
|
|
19181
19388
|
}
|
|
19182
|
-
function startTagInTemplate(
|
|
19389
|
+
function startTagInTemplate(p3, token) {
|
|
19183
19390
|
switch (token.tagID) {
|
|
19184
19391
|
// First, handle tags that can start without a mode change
|
|
19185
19392
|
case TAG_ID.BASE:
|
|
@@ -19192,7 +19399,7 @@ function startTagInTemplate(p4, token) {
|
|
|
19192
19399
|
case TAG_ID.STYLE:
|
|
19193
19400
|
case TAG_ID.TEMPLATE:
|
|
19194
19401
|
case TAG_ID.TITLE: {
|
|
19195
|
-
startTagInHead(
|
|
19402
|
+
startTagInHead(p3, token);
|
|
19196
19403
|
break;
|
|
19197
19404
|
}
|
|
19198
19405
|
// Re-process the token in the appropriate mode
|
|
@@ -19201,173 +19408,173 @@ function startTagInTemplate(p4, token) {
|
|
|
19201
19408
|
case TAG_ID.TBODY:
|
|
19202
19409
|
case TAG_ID.TFOOT:
|
|
19203
19410
|
case TAG_ID.THEAD: {
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
startTagInTable(
|
|
19411
|
+
p3.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE;
|
|
19412
|
+
p3.insertionMode = InsertionMode.IN_TABLE;
|
|
19413
|
+
startTagInTable(p3, token);
|
|
19207
19414
|
break;
|
|
19208
19415
|
}
|
|
19209
19416
|
case TAG_ID.COL: {
|
|
19210
|
-
|
|
19211
|
-
|
|
19212
|
-
startTagInColumnGroup(
|
|
19417
|
+
p3.tmplInsertionModeStack[0] = InsertionMode.IN_COLUMN_GROUP;
|
|
19418
|
+
p3.insertionMode = InsertionMode.IN_COLUMN_GROUP;
|
|
19419
|
+
startTagInColumnGroup(p3, token);
|
|
19213
19420
|
break;
|
|
19214
19421
|
}
|
|
19215
19422
|
case TAG_ID.TR: {
|
|
19216
|
-
|
|
19217
|
-
|
|
19218
|
-
startTagInTableBody(
|
|
19423
|
+
p3.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE_BODY;
|
|
19424
|
+
p3.insertionMode = InsertionMode.IN_TABLE_BODY;
|
|
19425
|
+
startTagInTableBody(p3, token);
|
|
19219
19426
|
break;
|
|
19220
19427
|
}
|
|
19221
19428
|
case TAG_ID.TD:
|
|
19222
19429
|
case TAG_ID.TH: {
|
|
19223
|
-
|
|
19224
|
-
|
|
19225
|
-
startTagInRow(
|
|
19430
|
+
p3.tmplInsertionModeStack[0] = InsertionMode.IN_ROW;
|
|
19431
|
+
p3.insertionMode = InsertionMode.IN_ROW;
|
|
19432
|
+
startTagInRow(p3, token);
|
|
19226
19433
|
break;
|
|
19227
19434
|
}
|
|
19228
19435
|
default: {
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
startTagInBody(
|
|
19436
|
+
p3.tmplInsertionModeStack[0] = InsertionMode.IN_BODY;
|
|
19437
|
+
p3.insertionMode = InsertionMode.IN_BODY;
|
|
19438
|
+
startTagInBody(p3, token);
|
|
19232
19439
|
}
|
|
19233
19440
|
}
|
|
19234
19441
|
}
|
|
19235
|
-
function endTagInTemplate(
|
|
19442
|
+
function endTagInTemplate(p3, token) {
|
|
19236
19443
|
if (token.tagID === TAG_ID.TEMPLATE) {
|
|
19237
|
-
templateEndTagInHead(
|
|
19444
|
+
templateEndTagInHead(p3, token);
|
|
19238
19445
|
}
|
|
19239
19446
|
}
|
|
19240
|
-
function eofInTemplate(
|
|
19241
|
-
if (
|
|
19242
|
-
|
|
19243
|
-
|
|
19244
|
-
|
|
19245
|
-
|
|
19246
|
-
|
|
19447
|
+
function eofInTemplate(p3, token) {
|
|
19448
|
+
if (p3.openElements.tmplCount > 0) {
|
|
19449
|
+
p3.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE);
|
|
19450
|
+
p3.activeFormattingElements.clearToLastMarker();
|
|
19451
|
+
p3.tmplInsertionModeStack.shift();
|
|
19452
|
+
p3._resetInsertionMode();
|
|
19453
|
+
p3.onEof(token);
|
|
19247
19454
|
} else {
|
|
19248
|
-
stopParsing(
|
|
19455
|
+
stopParsing(p3, token);
|
|
19249
19456
|
}
|
|
19250
19457
|
}
|
|
19251
|
-
function startTagAfterBody(
|
|
19458
|
+
function startTagAfterBody(p3, token) {
|
|
19252
19459
|
if (token.tagID === TAG_ID.HTML) {
|
|
19253
|
-
startTagInBody(
|
|
19460
|
+
startTagInBody(p3, token);
|
|
19254
19461
|
} else {
|
|
19255
|
-
tokenAfterBody(
|
|
19462
|
+
tokenAfterBody(p3, token);
|
|
19256
19463
|
}
|
|
19257
19464
|
}
|
|
19258
|
-
function endTagAfterBody(
|
|
19465
|
+
function endTagAfterBody(p3, token) {
|
|
19259
19466
|
var _a;
|
|
19260
19467
|
if (token.tagID === TAG_ID.HTML) {
|
|
19261
|
-
if (!
|
|
19262
|
-
|
|
19468
|
+
if (!p3.fragmentContext) {
|
|
19469
|
+
p3.insertionMode = InsertionMode.AFTER_AFTER_BODY;
|
|
19263
19470
|
}
|
|
19264
|
-
if (
|
|
19265
|
-
|
|
19266
|
-
const bodyElement =
|
|
19267
|
-
if (bodyElement && !((_a =
|
|
19268
|
-
|
|
19471
|
+
if (p3.options.sourceCodeLocationInfo && p3.openElements.tagIDs[0] === TAG_ID.HTML) {
|
|
19472
|
+
p3._setEndLocation(p3.openElements.items[0], token);
|
|
19473
|
+
const bodyElement = p3.openElements.items[1];
|
|
19474
|
+
if (bodyElement && !((_a = p3.treeAdapter.getNodeSourceCodeLocation(bodyElement)) === null || _a === void 0 ? void 0 : _a.endTag)) {
|
|
19475
|
+
p3._setEndLocation(bodyElement, token);
|
|
19269
19476
|
}
|
|
19270
19477
|
}
|
|
19271
19478
|
} else {
|
|
19272
|
-
tokenAfterBody(
|
|
19479
|
+
tokenAfterBody(p3, token);
|
|
19273
19480
|
}
|
|
19274
19481
|
}
|
|
19275
|
-
function tokenAfterBody(
|
|
19276
|
-
|
|
19277
|
-
modeInBody(
|
|
19482
|
+
function tokenAfterBody(p3, token) {
|
|
19483
|
+
p3.insertionMode = InsertionMode.IN_BODY;
|
|
19484
|
+
modeInBody(p3, token);
|
|
19278
19485
|
}
|
|
19279
|
-
function startTagInFrameset(
|
|
19486
|
+
function startTagInFrameset(p3, token) {
|
|
19280
19487
|
switch (token.tagID) {
|
|
19281
19488
|
case TAG_ID.HTML: {
|
|
19282
|
-
startTagInBody(
|
|
19489
|
+
startTagInBody(p3, token);
|
|
19283
19490
|
break;
|
|
19284
19491
|
}
|
|
19285
19492
|
case TAG_ID.FRAMESET: {
|
|
19286
|
-
|
|
19493
|
+
p3._insertElement(token, NS.HTML);
|
|
19287
19494
|
break;
|
|
19288
19495
|
}
|
|
19289
19496
|
case TAG_ID.FRAME: {
|
|
19290
|
-
|
|
19497
|
+
p3._appendElement(token, NS.HTML);
|
|
19291
19498
|
token.ackSelfClosing = true;
|
|
19292
19499
|
break;
|
|
19293
19500
|
}
|
|
19294
19501
|
case TAG_ID.NOFRAMES: {
|
|
19295
|
-
startTagInHead(
|
|
19502
|
+
startTagInHead(p3, token);
|
|
19296
19503
|
break;
|
|
19297
19504
|
}
|
|
19298
19505
|
default:
|
|
19299
19506
|
}
|
|
19300
19507
|
}
|
|
19301
|
-
function endTagInFrameset(
|
|
19302
|
-
if (token.tagID === TAG_ID.FRAMESET && !
|
|
19303
|
-
|
|
19304
|
-
if (!
|
|
19305
|
-
|
|
19508
|
+
function endTagInFrameset(p3, token) {
|
|
19509
|
+
if (token.tagID === TAG_ID.FRAMESET && !p3.openElements.isRootHtmlElementCurrent()) {
|
|
19510
|
+
p3.openElements.pop();
|
|
19511
|
+
if (!p3.fragmentContext && p3.openElements.currentTagId !== TAG_ID.FRAMESET) {
|
|
19512
|
+
p3.insertionMode = InsertionMode.AFTER_FRAMESET;
|
|
19306
19513
|
}
|
|
19307
19514
|
}
|
|
19308
19515
|
}
|
|
19309
|
-
function startTagAfterFrameset(
|
|
19516
|
+
function startTagAfterFrameset(p3, token) {
|
|
19310
19517
|
switch (token.tagID) {
|
|
19311
19518
|
case TAG_ID.HTML: {
|
|
19312
|
-
startTagInBody(
|
|
19519
|
+
startTagInBody(p3, token);
|
|
19313
19520
|
break;
|
|
19314
19521
|
}
|
|
19315
19522
|
case TAG_ID.NOFRAMES: {
|
|
19316
|
-
startTagInHead(
|
|
19523
|
+
startTagInHead(p3, token);
|
|
19317
19524
|
break;
|
|
19318
19525
|
}
|
|
19319
19526
|
default:
|
|
19320
19527
|
}
|
|
19321
19528
|
}
|
|
19322
|
-
function endTagAfterFrameset(
|
|
19529
|
+
function endTagAfterFrameset(p3, token) {
|
|
19323
19530
|
if (token.tagID === TAG_ID.HTML) {
|
|
19324
|
-
|
|
19531
|
+
p3.insertionMode = InsertionMode.AFTER_AFTER_FRAMESET;
|
|
19325
19532
|
}
|
|
19326
19533
|
}
|
|
19327
|
-
function startTagAfterAfterBody(
|
|
19534
|
+
function startTagAfterAfterBody(p3, token) {
|
|
19328
19535
|
if (token.tagID === TAG_ID.HTML) {
|
|
19329
|
-
startTagInBody(
|
|
19536
|
+
startTagInBody(p3, token);
|
|
19330
19537
|
} else {
|
|
19331
|
-
tokenAfterAfterBody(
|
|
19538
|
+
tokenAfterAfterBody(p3, token);
|
|
19332
19539
|
}
|
|
19333
19540
|
}
|
|
19334
|
-
function tokenAfterAfterBody(
|
|
19335
|
-
|
|
19336
|
-
modeInBody(
|
|
19541
|
+
function tokenAfterAfterBody(p3, token) {
|
|
19542
|
+
p3.insertionMode = InsertionMode.IN_BODY;
|
|
19543
|
+
modeInBody(p3, token);
|
|
19337
19544
|
}
|
|
19338
|
-
function startTagAfterAfterFrameset(
|
|
19545
|
+
function startTagAfterAfterFrameset(p3, token) {
|
|
19339
19546
|
switch (token.tagID) {
|
|
19340
19547
|
case TAG_ID.HTML: {
|
|
19341
|
-
startTagInBody(
|
|
19548
|
+
startTagInBody(p3, token);
|
|
19342
19549
|
break;
|
|
19343
19550
|
}
|
|
19344
19551
|
case TAG_ID.NOFRAMES: {
|
|
19345
|
-
startTagInHead(
|
|
19552
|
+
startTagInHead(p3, token);
|
|
19346
19553
|
break;
|
|
19347
19554
|
}
|
|
19348
19555
|
default:
|
|
19349
19556
|
}
|
|
19350
19557
|
}
|
|
19351
|
-
function nullCharacterInForeignContent(
|
|
19558
|
+
function nullCharacterInForeignContent(p3, token) {
|
|
19352
19559
|
token.chars = REPLACEMENT_CHARACTER;
|
|
19353
|
-
|
|
19560
|
+
p3._insertCharacters(token);
|
|
19354
19561
|
}
|
|
19355
|
-
function characterInForeignContent(
|
|
19356
|
-
|
|
19357
|
-
|
|
19562
|
+
function characterInForeignContent(p3, token) {
|
|
19563
|
+
p3._insertCharacters(token);
|
|
19564
|
+
p3.framesetOk = false;
|
|
19358
19565
|
}
|
|
19359
|
-
function popUntilHtmlOrIntegrationPoint(
|
|
19360
|
-
while (
|
|
19361
|
-
|
|
19566
|
+
function popUntilHtmlOrIntegrationPoint(p3) {
|
|
19567
|
+
while (p3.treeAdapter.getNamespaceURI(p3.openElements.current) !== NS.HTML && p3.openElements.currentTagId !== void 0 && !p3._isIntegrationPoint(p3.openElements.currentTagId, p3.openElements.current)) {
|
|
19568
|
+
p3.openElements.pop();
|
|
19362
19569
|
}
|
|
19363
19570
|
}
|
|
19364
|
-
function startTagInForeignContent(
|
|
19571
|
+
function startTagInForeignContent(p3, token) {
|
|
19365
19572
|
if (causesExit(token)) {
|
|
19366
|
-
popUntilHtmlOrIntegrationPoint(
|
|
19367
|
-
|
|
19573
|
+
popUntilHtmlOrIntegrationPoint(p3);
|
|
19574
|
+
p3._startTagOutsideForeignContent(token);
|
|
19368
19575
|
} else {
|
|
19369
|
-
const current =
|
|
19370
|
-
const currentNs =
|
|
19576
|
+
const current = p3._getAdjustedCurrentElement();
|
|
19577
|
+
const currentNs = p3.treeAdapter.getNamespaceURI(current);
|
|
19371
19578
|
if (currentNs === NS.MATHML) {
|
|
19372
19579
|
adjustTokenMathMLAttrs(token);
|
|
19373
19580
|
} else if (currentNs === NS.SVG) {
|
|
@@ -19376,29 +19583,29 @@ function startTagInForeignContent(p4, token) {
|
|
|
19376
19583
|
}
|
|
19377
19584
|
adjustTokenXMLAttrs(token);
|
|
19378
19585
|
if (token.selfClosing) {
|
|
19379
|
-
|
|
19586
|
+
p3._appendElement(token, currentNs);
|
|
19380
19587
|
} else {
|
|
19381
|
-
|
|
19588
|
+
p3._insertElement(token, currentNs);
|
|
19382
19589
|
}
|
|
19383
19590
|
token.ackSelfClosing = true;
|
|
19384
19591
|
}
|
|
19385
19592
|
}
|
|
19386
|
-
function endTagInForeignContent(
|
|
19593
|
+
function endTagInForeignContent(p3, token) {
|
|
19387
19594
|
if (token.tagID === TAG_ID.P || token.tagID === TAG_ID.BR) {
|
|
19388
|
-
popUntilHtmlOrIntegrationPoint(
|
|
19389
|
-
|
|
19595
|
+
popUntilHtmlOrIntegrationPoint(p3);
|
|
19596
|
+
p3._endTagOutsideForeignContent(token);
|
|
19390
19597
|
return;
|
|
19391
19598
|
}
|
|
19392
|
-
for (let i2 =
|
|
19393
|
-
const element =
|
|
19394
|
-
if (
|
|
19395
|
-
|
|
19599
|
+
for (let i2 = p3.openElements.stackTop; i2 > 0; i2--) {
|
|
19600
|
+
const element = p3.openElements.items[i2];
|
|
19601
|
+
if (p3.treeAdapter.getNamespaceURI(element) === NS.HTML) {
|
|
19602
|
+
p3._endTagOutsideForeignContent(token);
|
|
19396
19603
|
break;
|
|
19397
19604
|
}
|
|
19398
|
-
const tagName =
|
|
19605
|
+
const tagName = p3.treeAdapter.getTagName(element);
|
|
19399
19606
|
if (tagName.toLowerCase() === token.tagName) {
|
|
19400
19607
|
token.tagName = tagName;
|
|
19401
|
-
|
|
19608
|
+
p3.openElements.shortenToLength(i2);
|
|
19402
19609
|
break;
|
|
19403
19610
|
}
|
|
19404
19611
|
}
|
|
@@ -19684,13 +19891,23 @@ var HTML_PREVIEW_RESPONSE_CSP = `${HTML_PREVIEW_CSP}; sandbox; frame-ancestors '
|
|
|
19684
19891
|
var MAX_HTTP_BODY_BYTES = 32 * 1024 * 1024;
|
|
19685
19892
|
var MAX_INLINE_FILE_BYTES = 20 * 1024 * 1024;
|
|
19686
19893
|
var MAX_PUSH_BODY_BYTES = 16 * 1024;
|
|
19894
|
+
var invocationStores = /* @__PURE__ */ new WeakMap();
|
|
19895
|
+
function invocationStore(deps) {
|
|
19896
|
+
if (deps.commandInvocations) return deps.commandInvocations;
|
|
19897
|
+
let store = invocationStores.get(deps);
|
|
19898
|
+
if (!store) {
|
|
19899
|
+
store = CommandInvocationStore.open(deps.config.stateDir, deps.identityCid);
|
|
19900
|
+
invocationStores.set(deps, store);
|
|
19901
|
+
}
|
|
19902
|
+
return store;
|
|
19903
|
+
}
|
|
19687
19904
|
var HttpError = class extends Error {
|
|
19688
19905
|
constructor(status, message) {
|
|
19689
19906
|
super(message);
|
|
19690
19907
|
this.status = status;
|
|
19691
19908
|
}
|
|
19692
19909
|
};
|
|
19693
|
-
var bad = (
|
|
19910
|
+
var bad = (m3) => new HttpError(400, m3);
|
|
19694
19911
|
function str(body, key) {
|
|
19695
19912
|
const v3 = body[key];
|
|
19696
19913
|
if (typeof v3 !== "string" || v3 === "") throw bad(`${key} must be a non-empty string`);
|
|
@@ -20028,6 +20245,82 @@ var ROUTES = {
|
|
|
20028
20245
|
}
|
|
20029
20246
|
return { wire_id: wireId, delivery: "tracked" };
|
|
20030
20247
|
},
|
|
20248
|
+
"GET /api/contacts/:contact/commands": async ({ client, deps, params }) => {
|
|
20249
|
+
if (deps.config.typedCommands === false) throw new HttpError(404, "Typed commands are disabled");
|
|
20250
|
+
const peer = await resolveContact(client, params.contact);
|
|
20251
|
+
return projectCatalog(peer.cid, await client.listContactCommands({ contact: peer.cid }));
|
|
20252
|
+
},
|
|
20253
|
+
"POST /api/commands/send": async ({ client, deps, body }) => {
|
|
20254
|
+
if (deps.config.typedCommands === false) throw new HttpError(404, "Typed commands are disabled");
|
|
20255
|
+
const peer = await resolveContact(client, str(body, "contact"));
|
|
20256
|
+
const expectedRecipient = str(body, "recipient_cid");
|
|
20257
|
+
if (expectedRecipient !== peer.cid) throw new HttpError(409, "Recipient changed; refresh commands");
|
|
20258
|
+
const command = str(body, "command");
|
|
20259
|
+
const invocationId = str(body, "invocation_id");
|
|
20260
|
+
const fingerprint2 = str(body, "catalog_fingerprint");
|
|
20261
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(invocationId)) {
|
|
20262
|
+
throw bad("invocation_id must be a UUID v4");
|
|
20263
|
+
}
|
|
20264
|
+
if (!/^[A-Za-z0-9_-]{43}$/.test(fingerprint2)) throw bad("catalog_fingerprint is invalid");
|
|
20265
|
+
if (body.confirmed !== true) throw bad("explicit command confirmation is required");
|
|
20266
|
+
try {
|
|
20267
|
+
requireBoundedJson(body.arguments, "arguments");
|
|
20268
|
+
} catch {
|
|
20269
|
+
throw bad("arguments must be bounded valid JSON");
|
|
20270
|
+
}
|
|
20271
|
+
const payloadFingerprint = invocationFingerprint({
|
|
20272
|
+
recipient_cid: peer.cid,
|
|
20273
|
+
command,
|
|
20274
|
+
arguments: body.arguments,
|
|
20275
|
+
catalog_fingerprint: fingerprint2
|
|
20276
|
+
});
|
|
20277
|
+
const store = invocationStore(deps);
|
|
20278
|
+
try {
|
|
20279
|
+
const existing = store.find({
|
|
20280
|
+
invocation_id: invocationId,
|
|
20281
|
+
recipient_cid: peer.cid,
|
|
20282
|
+
payload_fingerprint: payloadFingerprint
|
|
20283
|
+
});
|
|
20284
|
+
if (existing) return { ...existing, deduplicated: true };
|
|
20285
|
+
} catch (error) {
|
|
20286
|
+
if (error instanceof InvocationConflictError) {
|
|
20287
|
+
throw new HttpError(409, "invocation_id is already bound to another recipient or payload");
|
|
20288
|
+
}
|
|
20289
|
+
throw error;
|
|
20290
|
+
}
|
|
20291
|
+
const current = projectCatalog(peer.cid, await client.listContactCommands({ contact: peer.cid }));
|
|
20292
|
+
if (current.fingerprint !== fingerprint2 || !current.commands.some((entry) => entry.name === command)) {
|
|
20293
|
+
throw new HttpError(409, "Command catalog changed; refresh before sending");
|
|
20294
|
+
}
|
|
20295
|
+
let reservation;
|
|
20296
|
+
try {
|
|
20297
|
+
reservation = store.begin({
|
|
20298
|
+
invocation_id: invocationId,
|
|
20299
|
+
recipient_cid: peer.cid,
|
|
20300
|
+
payload_fingerprint: payloadFingerprint,
|
|
20301
|
+
command,
|
|
20302
|
+
catalog_fingerprint: current.fingerprint
|
|
20303
|
+
});
|
|
20304
|
+
} catch (error) {
|
|
20305
|
+
if (error instanceof InvocationCapacityError) {
|
|
20306
|
+
throw new HttpError(503, "Command idempotency store is full; no command was sent");
|
|
20307
|
+
}
|
|
20308
|
+
if (error instanceof InvocationConflictError) {
|
|
20309
|
+
throw new HttpError(409, "invocation_id is already bound to another recipient or payload");
|
|
20310
|
+
}
|
|
20311
|
+
throw error;
|
|
20312
|
+
}
|
|
20313
|
+
if (!reservation.fresh) return { ...reservation.record, deduplicated: true };
|
|
20314
|
+
const result = await client.sendCommand({ contact: peer.cid, command, arguments: body.arguments });
|
|
20315
|
+
const completed = store.complete(invocationId, {
|
|
20316
|
+
wire_id: outcomeWireId(result) ?? null,
|
|
20317
|
+
delivery: outcomeKind(result) ?? "unknown"
|
|
20318
|
+
});
|
|
20319
|
+
return {
|
|
20320
|
+
...completed,
|
|
20321
|
+
deduplicated: false
|
|
20322
|
+
};
|
|
20323
|
+
},
|
|
20031
20324
|
"POST /api/messages/send-file": async ({ client, body }) => {
|
|
20032
20325
|
const dataBase64 = inlineBase64(body);
|
|
20033
20326
|
const contact = str(body, "contact");
|
|
@@ -20276,15 +20569,15 @@ var ROUTES = {
|
|
|
20276
20569
|
if (keys === null || typeof keys !== "object" || Array.isArray(keys)) {
|
|
20277
20570
|
throw bad("keys must be an object with p256dh and auth");
|
|
20278
20571
|
}
|
|
20279
|
-
const
|
|
20280
|
-
if (typeof
|
|
20572
|
+
const k4 = keys;
|
|
20573
|
+
if (typeof k4.p256dh !== "string" || typeof k4.auth !== "string") {
|
|
20281
20574
|
throw bad("keys.p256dh and keys.auth must be strings");
|
|
20282
20575
|
}
|
|
20283
20576
|
let saved;
|
|
20284
20577
|
try {
|
|
20285
20578
|
saved = deps.push.ensure({
|
|
20286
20579
|
endpoint: str(body, "endpoint"),
|
|
20287
|
-
keys: { p256dh:
|
|
20580
|
+
keys: { p256dh: k4.p256dh, auth: k4.auth },
|
|
20288
20581
|
label: optStr(body, "label"),
|
|
20289
20582
|
preview: body.preview === void 0 ? void 0 : str(body, "preview"),
|
|
20290
20583
|
bindingId: optStr(body, "binding_id")
|
|
@@ -20343,8 +20636,8 @@ var ROUTES = {
|
|
|
20343
20636
|
function match(method, pathname) {
|
|
20344
20637
|
const parts = pathname.split("/").filter(Boolean);
|
|
20345
20638
|
for (const key of Object.keys(ROUTES)) {
|
|
20346
|
-
const [
|
|
20347
|
-
if (
|
|
20639
|
+
const [m3, pattern] = key.split(" ");
|
|
20640
|
+
if (m3 !== method) continue;
|
|
20348
20641
|
const pp = pattern.split("/").filter(Boolean);
|
|
20349
20642
|
if (pp.length !== parts.length) continue;
|
|
20350
20643
|
const params = {};
|
|
@@ -20409,24 +20702,24 @@ import { randomBytes } from "node:crypto";
|
|
|
20409
20702
|
|
|
20410
20703
|
// node_modules/@ours.network/sdk/dist/index.js
|
|
20411
20704
|
init_define_MESSENGER_BUILD_INFO();
|
|
20412
|
-
import { createRequire as
|
|
20705
|
+
import { createRequire as createRequire9 } from "node:module";
|
|
20413
20706
|
|
|
20414
|
-
// node_modules/@ours.network/sdk/dist/chunk-
|
|
20707
|
+
// node_modules/@ours.network/sdk/dist/chunk-XLVE6LLL.js
|
|
20415
20708
|
init_define_MESSENGER_BUILD_INFO();
|
|
20416
20709
|
import { createRequire as createRequire5 } from "node:module";
|
|
20417
20710
|
|
|
20418
|
-
// node_modules/@ours.network/sdk/dist/chunk-
|
|
20711
|
+
// node_modules/@ours.network/sdk/dist/chunk-PAY4QDEG.js
|
|
20419
20712
|
init_define_MESSENGER_BUILD_INFO();
|
|
20420
20713
|
import { createRequire as createRequire3 } from "node:module";
|
|
20421
20714
|
|
|
20422
|
-
// node_modules/@ours.network/sdk/dist/chunk-
|
|
20715
|
+
// node_modules/@ours.network/sdk/dist/chunk-CFRWB74T.js
|
|
20423
20716
|
init_define_MESSENGER_BUILD_INFO();
|
|
20424
20717
|
import { createRequire } from "node:module";
|
|
20425
20718
|
var require2 = createRequire(import.meta.url);
|
|
20426
20719
|
var t = class extends Error {
|
|
20427
|
-
constructor(
|
|
20720
|
+
constructor(o2, r2, i2) {
|
|
20428
20721
|
super(r2);
|
|
20429
|
-
this.code =
|
|
20722
|
+
this.code = o2;
|
|
20430
20723
|
this.details = i2;
|
|
20431
20724
|
this.name = "OursError";
|
|
20432
20725
|
}
|
|
@@ -20452,14 +20745,23 @@ var d = { event: () => {
|
|
|
20452
20745
|
} };
|
|
20453
20746
|
var r = { ...d };
|
|
20454
20747
|
|
|
20455
|
-
// node_modules/@ours.network/sdk/dist/chunk-
|
|
20748
|
+
// node_modules/@ours.network/sdk/dist/chunk-PAY4QDEG.js
|
|
20456
20749
|
var require4 = createRequire3(import.meta.url);
|
|
20457
|
-
|
|
20750
|
+
function c(n, e = /* @__PURE__ */ new Set()) {
|
|
20751
|
+
if (n === null || typeof n == "string" || typeof n == "boolean") return true;
|
|
20752
|
+
if (typeof n == "number") return Number.isFinite(n);
|
|
20753
|
+
if (typeof n != "object" || e.has(n)) return false;
|
|
20754
|
+
e.add(n);
|
|
20755
|
+
let i2 = Array.isArray(n) ? n.every((r2) => c(r2, e)) : Object.getPrototypeOf(n) === Object.prototype && Object.values(n).every((r2) => c(r2, e));
|
|
20756
|
+
return e.delete(n), i2;
|
|
20757
|
+
}
|
|
20758
|
+
var h = class {
|
|
20458
20759
|
base;
|
|
20459
20760
|
leaseToken;
|
|
20460
20761
|
clientPid;
|
|
20461
20762
|
apiToken;
|
|
20462
20763
|
fetchImpl;
|
|
20764
|
+
commandHandlers = /* @__PURE__ */ new Map();
|
|
20463
20765
|
constructor(e) {
|
|
20464
20766
|
this.base = e.url.replace(/\/+$/, ""), this.leaseToken = e.leaseToken, this.clientPid = e.clientPid ?? process.pid, this.apiToken = e.apiToken, this.fetchImpl = e.fetch ?? globalThis.fetch;
|
|
20465
20767
|
}
|
|
@@ -20474,13 +20776,13 @@ var c = class {
|
|
|
20474
20776
|
throw new Error(`${e}: the daemon returned a non-JSON response (HTTP ${r2.status})`);
|
|
20475
20777
|
}
|
|
20476
20778
|
if (t3 && typeof t3 == "object" && !Array.isArray(t3) && "error" in t3) {
|
|
20477
|
-
let
|
|
20478
|
-
if (r2.status === 400 &&
|
|
20479
|
-
let { code:
|
|
20480
|
-
throw new t(
|
|
20779
|
+
let o2 = t3.error, s4 = o2 !== null && typeof o2 == "object" && "code" in o2 && "message" in o2;
|
|
20780
|
+
if (r2.status === 400 && s4) {
|
|
20781
|
+
let { code: p3, message: d3, details: m3 } = o2;
|
|
20782
|
+
throw new t(p3, d3, m3);
|
|
20481
20783
|
}
|
|
20482
|
-
let
|
|
20483
|
-
throw new Error(`${e}: ${
|
|
20784
|
+
let a4 = s4 ? o2.message : String(o2);
|
|
20785
|
+
throw new Error(`${e}: ${a4} (HTTP ${r2.status})`);
|
|
20484
20786
|
}
|
|
20485
20787
|
if (!r2.ok) throw new Error(`${e}: the daemon returned HTTP ${r2.status} with no error field`);
|
|
20486
20788
|
return t3;
|
|
@@ -20571,14 +20873,57 @@ var c = class {
|
|
|
20571
20873
|
sendMessage(e) {
|
|
20572
20874
|
return this.post("sendMessage", e);
|
|
20573
20875
|
}
|
|
20876
|
+
async registerCommands(e) {
|
|
20877
|
+
if (!Array.isArray(e)) throw new Error("registerCommands requires an array");
|
|
20878
|
+
let i2 = /* @__PURE__ */ new Map(), r2 = [];
|
|
20879
|
+
for (let t3 of e) {
|
|
20880
|
+
if (!t3 || typeof t3 != "object" || typeof t3.name != "string" || t3.name.length === 0 || typeof t3.handler != "function") throw new Error("invalid command registration");
|
|
20881
|
+
if (i2.has(t3.name)) throw new Error(`duplicate command registration: ${t3.name}`);
|
|
20882
|
+
i2.set(t3.name, t3.handler), r2.push({ name: t3.name, ...t3.description === void 0 ? {} : { description: t3.description }, input_schema: t3.input_schema });
|
|
20883
|
+
}
|
|
20884
|
+
await this.post("setCommandCatalog", { catalog: r2.length === 0 ? null : JSON.stringify({ commands: r2 }) }), this.commandHandlers = i2;
|
|
20885
|
+
}
|
|
20886
|
+
listSelfCommands() {
|
|
20887
|
+
return this.post("listSelfCommands", {});
|
|
20888
|
+
}
|
|
20889
|
+
listContactCommands(e) {
|
|
20890
|
+
return this.post("listContactCommands", e);
|
|
20891
|
+
}
|
|
20892
|
+
sendCommand(e) {
|
|
20893
|
+
return this.post("sendCommand", e);
|
|
20894
|
+
}
|
|
20574
20895
|
sendFile(e) {
|
|
20575
20896
|
return this.post("sendFile", e);
|
|
20576
20897
|
}
|
|
20577
20898
|
listIncomingMessages() {
|
|
20578
20899
|
return this.post("listIncomingMessages", {});
|
|
20579
20900
|
}
|
|
20580
|
-
getMessages(e = {}) {
|
|
20581
|
-
|
|
20901
|
+
async getMessages(e = {}) {
|
|
20902
|
+
let i2 = await this.post("getMessages", e), r2 = [], t3 = [], o2 = 0;
|
|
20903
|
+
for (let s4 of i2.messages) {
|
|
20904
|
+
if (s4.message_kind === "text") {
|
|
20905
|
+
r2.push(s4);
|
|
20906
|
+
continue;
|
|
20907
|
+
}
|
|
20908
|
+
if (s4.message_kind === "command_result") {
|
|
20909
|
+
t3.push(s4);
|
|
20910
|
+
continue;
|
|
20911
|
+
}
|
|
20912
|
+
o2 += 1;
|
|
20913
|
+
let a4 = { ok: false, error: "handler_failed" };
|
|
20914
|
+
try {
|
|
20915
|
+
let p3 = JSON.parse(s4.body);
|
|
20916
|
+
if (!p3 || typeof p3 != "object" || Array.isArray(p3) || Object.keys(p3).length !== 2 || typeof p3.command != "string" || !("arguments" in p3)) throw new Error("invalid command payload");
|
|
20917
|
+
let d3 = p3, m3 = d3.command, y2 = this.commandHandlers.get(m3);
|
|
20918
|
+
if (!y2) throw new Error("handler not registered");
|
|
20919
|
+
let u3 = Object.freeze({ sender_cid: s4.from.id, sender_name: s4.from.name, request_wire_id: s4.wire_id }), l2 = await y2(d3.arguments, u3);
|
|
20920
|
+
if (!c(l2)) throw new Error("handler returned a non-JSON value");
|
|
20921
|
+
a4 = { ok: true, result: l2 };
|
|
20922
|
+
} catch {
|
|
20923
|
+
}
|
|
20924
|
+
await this.post("sendCommandResult", { contact: s4.from.id, reply_to_wire_id: s4.wire_id, outcome: a4 });
|
|
20925
|
+
}
|
|
20926
|
+
return { messages: r2, command_results: t3, commands_handled: o2, remaining: i2.remaining };
|
|
20582
20927
|
}
|
|
20583
20928
|
listHistory(e = {}) {
|
|
20584
20929
|
return this.post("listHistory", e);
|
|
@@ -20616,24 +20961,27 @@ var c = class {
|
|
|
20616
20961
|
unread() {
|
|
20617
20962
|
return this.get("/unread", true);
|
|
20618
20963
|
}
|
|
20964
|
+
historyStorage() {
|
|
20965
|
+
return this.get("/history-storage", true);
|
|
20966
|
+
}
|
|
20619
20967
|
async *watchNotifications(e, i2 = {}) {
|
|
20620
|
-
let r2 = i2.since ?? "tip", t3 = `/identities/${encodeURIComponent(e)}/notifications`,
|
|
20968
|
+
let r2 = i2.since ?? "tip", t3 = `/identities/${encodeURIComponent(e)}/notifications`, o2 = i2.kinds?.length ? `&kinds=${encodeURIComponent(i2.kinds.join(","))}` : "";
|
|
20621
20969
|
for (; !i2.signal?.aborted; ) {
|
|
20622
|
-
let
|
|
20970
|
+
let s4;
|
|
20623
20971
|
try {
|
|
20624
|
-
let
|
|
20972
|
+
let a4 = await this.fetchImpl(`${this.base}${t3}?since=${r2}${o2}`, { headers: this.headers(), signal: i2.signal });
|
|
20625
20973
|
try {
|
|
20626
|
-
|
|
20974
|
+
s4 = await a4.json();
|
|
20627
20975
|
} catch {
|
|
20628
|
-
throw new Error(`watchNotifications(${e}): the daemon returned a non-JSON response (HTTP ${
|
|
20976
|
+
throw new Error(`watchNotifications(${e}): the daemon returned a non-JSON response (HTTP ${a4.status})`);
|
|
20629
20977
|
}
|
|
20630
|
-
} catch (
|
|
20978
|
+
} catch (a4) {
|
|
20631
20979
|
if (i2.signal?.aborted) return;
|
|
20632
|
-
throw
|
|
20980
|
+
throw a4;
|
|
20633
20981
|
}
|
|
20634
|
-
if ("error" in
|
|
20635
|
-
r2 =
|
|
20636
|
-
for (let
|
|
20982
|
+
if ("error" in s4) throw new Error(`watchNotifications(${e}): ${s4.error}`);
|
|
20983
|
+
r2 = s4.cursor;
|
|
20984
|
+
for (let a4 of s4.events) yield s(a4 && typeof a4 == "object" ? a4 : {});
|
|
20637
20985
|
}
|
|
20638
20986
|
}
|
|
20639
20987
|
async fetchFile(e) {
|
|
@@ -20668,32 +21016,33 @@ var c = class {
|
|
|
20668
21016
|
if (r2 === void 0) throw new Error("uploadFile: `size` is required when the body is a stream (the route needs Content-Length)");
|
|
20669
21017
|
let t3 = await this.fetchImpl(`${this.base}/files/upload`, { method: "POST", headers: { ...this.headers(), "x-ours-filename": encodeURIComponent(i2.filename), "Content-Type": i2.mime || "application/octet-stream", "Content-Length": String(r2) }, body: e, ...e instanceof Uint8Array ? {} : { duplex: "half" } });
|
|
20670
21018
|
if (!t3.ok) {
|
|
20671
|
-
let
|
|
21019
|
+
let o2 = `HTTP ${t3.status}`;
|
|
20672
21020
|
try {
|
|
20673
|
-
let
|
|
20674
|
-
|
|
21021
|
+
let s4 = await t3.json();
|
|
21022
|
+
s4 && s4.error !== void 0 && (o2 = String(s4.error));
|
|
20675
21023
|
} catch {
|
|
20676
21024
|
}
|
|
20677
|
-
throw new Error(`uploadFile(${i2.filename}): ${
|
|
21025
|
+
throw new Error(`uploadFile(${i2.filename}): ${o2}`);
|
|
20678
21026
|
}
|
|
20679
21027
|
return await t3.json();
|
|
20680
21028
|
}
|
|
20681
21029
|
};
|
|
20682
21030
|
|
|
20683
|
-
// node_modules/@ours.network/sdk/dist/chunk-
|
|
21031
|
+
// node_modules/@ours.network/sdk/dist/chunk-2X5HGMMO.js
|
|
20684
21032
|
init_define_MESSENGER_BUILD_INFO();
|
|
20685
21033
|
import { createRequire as createRequire4 } from "node:module";
|
|
20686
|
-
import { homedir as
|
|
20687
|
-
import { resolve as
|
|
21034
|
+
import { homedir as m } from "node:os";
|
|
21035
|
+
import { resolve as a, join as c2, dirname as f, basename as _ } from "node:path";
|
|
20688
21036
|
var require5 = createRequire4(import.meta.url);
|
|
20689
|
-
var
|
|
20690
|
-
var
|
|
21037
|
+
var T = 100 * 1024 * 1024;
|
|
21038
|
+
var s2 = { brokerUrl: "wss://broker1.ours.network", port: 3050, stateDir: a(m(), ".ours"), gcIntervalMs: 36e5, historyMaxBytes: T, apiVisibility: "owner" };
|
|
21039
|
+
var k = "daemon-token";
|
|
20691
21040
|
|
|
20692
|
-
// node_modules/@ours.network/sdk/dist/chunk-
|
|
21041
|
+
// node_modules/@ours.network/sdk/dist/chunk-XLVE6LLL.js
|
|
20693
21042
|
import { randomBytes as I } from "node:crypto";
|
|
20694
21043
|
import { readFileSync as w } from "node:fs";
|
|
20695
21044
|
import { homedir as x } from "node:os";
|
|
20696
|
-
import { join as v, resolve as
|
|
21045
|
+
import { join as v, resolve as p } from "node:path";
|
|
20697
21046
|
var require6 = createRequire5(import.meta.url);
|
|
20698
21047
|
var a2 = class extends Error {
|
|
20699
21048
|
constructor(i2, n) {
|
|
@@ -20710,25 +21059,25 @@ var S = class extends a2 {
|
|
|
20710
21059
|
this.name = "DaemonUnavailableError", d3.cause !== void 0 && (this.cause = d3.cause);
|
|
20711
21060
|
}
|
|
20712
21061
|
};
|
|
20713
|
-
var
|
|
20714
|
-
var C =
|
|
21062
|
+
var b = s2.port;
|
|
21063
|
+
var C = k;
|
|
20715
21064
|
var R = ".ours";
|
|
20716
|
-
var
|
|
20717
|
-
function
|
|
20718
|
-
let t3 = e.env ?? process.env, i2 = e.readTextFile ?? ((
|
|
21065
|
+
var k2 = ["explicit", "environment", "config-file"];
|
|
21066
|
+
function _2(e = {}) {
|
|
21067
|
+
let t3 = e.env ?? process.env, i2 = e.readTextFile ?? ((h3) => w(h3, "utf8")), n = e.homeDir ?? x(), d3 = f2(t3, "OURS_INSTANCE");
|
|
20719
21068
|
if (d3 !== void 0) throw new a2("INCOHERENT_SELECTION", `OURS_INSTANCE=${JSON.stringify(d3)} is set, but named daemon instances are not implemented. Select the daemon with an explicit endpoint/port option or with OURS_PORT, and unset OURS_INSTANCE.`);
|
|
20720
21069
|
if (e.stateDir !== void 0 && e.expectStateDir !== void 0) {
|
|
20721
|
-
let
|
|
20722
|
-
if (
|
|
21070
|
+
let h3 = p(e.stateDir), D2 = p(e.expectStateDir);
|
|
21071
|
+
if (h3 !== D2) throw new a2("INCOHERENT_SELECTION", `stateDir ${JSON.stringify(h3)} and expectStateDir ${JSON.stringify(D2)} name different directories. The state directory decides which token is read; the expected one decides which daemon that token may be sent to. Reconcile them, or pass only one.`);
|
|
20723
21072
|
}
|
|
20724
|
-
let r2 = V(e.configPath,
|
|
20725
|
-
A({ endpointSelected: e.endpoint !== void 0 || o2.source !== "default", endpointSource:
|
|
20726
|
-
let y2 = U(e.token,
|
|
20727
|
-
return { baseUrl:
|
|
21073
|
+
let r2 = V(e.configPath, f2(t3, "OURS_CONFIG")), s4 = r2 ? L(r2.value, i2) : {}, o2 = E(e.port, F(f2(t3, "OURS_PORT")), s4.port, b), c4 = E(e.stateDir ?? e.expectStateDir, f2(t3, "OURS_STATE_DIR"), s4.stateDir, v(n, R)), l2 = { value: p(c4.value), source: c4.source }, g2 = e.endpoint !== void 0 ? { value: P(e.endpoint), source: "explicit" } : { value: `http://127.0.0.1:${o2.value}`, source: o2.source }, m3 = f2(t3, "OURS_API_TOKEN");
|
|
21074
|
+
A({ endpointSelected: e.endpoint !== void 0 || o2.source !== "default", endpointSource: g2.source, stateDirIntentional: k2.includes(l2.source), stateDirSource: l2.source, hasExplicitToken: e.token !== void 0 && e.token !== "", hasEnvToken: m3 !== void 0, requireExplicitSelection: e.requireExplicitSelection === true, portSource: o2.source });
|
|
21075
|
+
let y2 = U(e.token, m3, s4, l2, i2);
|
|
21076
|
+
return { baseUrl: g2, port: o2, stateDir: l2, expectStateDir: e.expectStateDir !== void 0 ? p(e.expectStateDir) : l2.value, ...y2 ? { token: y2 } : {}, ...r2 ? { configPath: r2 } : {} };
|
|
20728
21077
|
}
|
|
20729
21078
|
function A(e) {
|
|
20730
21079
|
if (e.requireExplicitSelection) {
|
|
20731
|
-
if (e.endpointSource === "default" && e.portSource === "default") throw u(`requireExplicitSelection is set, but no daemon was selected. Pass endpoint/port, set OURS_PORT, or point OURS_CONFIG at a config file. Refusing the built-in default 127.0.0.1:${
|
|
21080
|
+
if (e.endpointSource === "default" && e.portSource === "default") throw u(`requireExplicitSelection is set, but no daemon was selected. Pass endpoint/port, set OURS_PORT, or point OURS_CONFIG at a config file. Refusing the built-in default 127.0.0.1:${b}.`);
|
|
20732
21081
|
if (!e.stateDirIntentional) throw u("requireExplicitSelection is set, but the state directory is the built-in default. Every auth-affecting field must be chosen deliberately: pass stateDir or expectStateDir, set OURS_STATE_DIR, or name a config file. Refusing before reading any token or opening any socket.");
|
|
20733
21082
|
}
|
|
20734
21083
|
if (e.endpointSelected && !e.stateDirIntentional) throw u(`the endpoint was selected (source: ${e.endpointSource}) but the state directory is the built-in default. A daemon's API token belongs to one state directory, so reading the default token and sending it to a separately chosen endpoint would disclose a credential to it. Select the state directory too: stateDir, expectStateDir, OURS_STATE_DIR, or one config file. An explicit token alone is not enough \u2014 without an expected state directory there is nothing to assert the endpoint against before the token is sent.`);
|
|
@@ -20785,7 +21134,7 @@ function L(e, t3) {
|
|
|
20785
21134
|
}
|
|
20786
21135
|
return r2;
|
|
20787
21136
|
}
|
|
20788
|
-
function
|
|
21137
|
+
function f2(e, t3) {
|
|
20789
21138
|
let i2 = e[t3];
|
|
20790
21139
|
if (i2 === void 0) return;
|
|
20791
21140
|
let n = i2.trim();
|
|
@@ -20818,13 +21167,13 @@ async function $2(e, t3 = {}) {
|
|
|
20818
21167
|
} finally {
|
|
20819
21168
|
clearTimeout(d3);
|
|
20820
21169
|
}
|
|
20821
|
-
let s4 = typeof r2.stateDir == "string" ?
|
|
21170
|
+
let s4 = typeof r2.stateDir == "string" ? p(r2.stateDir) : null;
|
|
20822
21171
|
if (s4 === null) throw new a2("INCOHERENT_SELECTION", `${e.baseUrl.value}/state-dir did not report a state directory, so this is not an ours daemon or not one this client understands. Refusing to send a credential to it.`);
|
|
20823
21172
|
if (s4 !== e.expectStateDir) throw new a2("INCOHERENT_SELECTION", `the daemon at ${e.baseUrl.value} owns state directory ${JSON.stringify(s4)}, but this selection expects ${JSON.stringify(e.expectStateDir)}. The token belongs to the expected directory, so it is NOT being sent. Point the endpoint and the state directory at the same daemon.`);
|
|
20824
21173
|
}
|
|
20825
21174
|
async function j(e = {}) {
|
|
20826
|
-
let { leaseToken: t3, clientPid: i2, fetch: n, ...d3 } = e, r2 =
|
|
20827
|
-
return await $2(r2, { fetch: n }), new
|
|
21175
|
+
let { leaseToken: t3, clientPid: i2, fetch: n, ...d3 } = e, r2 = _2(d3);
|
|
21176
|
+
return await $2(r2, { fetch: n }), new h({ url: r2.baseUrl.value, leaseToken: t3 ?? I(32).toString("hex"), clientPid: i2, apiToken: r2.token?.value, fetch: n });
|
|
20828
21177
|
}
|
|
20829
21178
|
|
|
20830
21179
|
// node_modules/@ours.network/sdk/dist/chunk-5EWCIQH6.js
|
|
@@ -20837,9 +21186,14 @@ init_define_MESSENGER_BUILD_INFO();
|
|
|
20837
21186
|
import { createRequire as createRequire7 } from "node:module";
|
|
20838
21187
|
var require8 = createRequire7(import.meta.url);
|
|
20839
21188
|
|
|
20840
|
-
// node_modules/@ours.network/sdk/dist/
|
|
21189
|
+
// node_modules/@ours.network/sdk/dist/chunk-Y7UQJLEF.js
|
|
21190
|
+
init_define_MESSENGER_BUILD_INFO();
|
|
21191
|
+
import { createRequire as createRequire8 } from "node:module";
|
|
20841
21192
|
var require9 = createRequire8(import.meta.url);
|
|
20842
21193
|
|
|
21194
|
+
// node_modules/@ours.network/sdk/dist/index.js
|
|
21195
|
+
var require10 = createRequire9(import.meta.url);
|
|
21196
|
+
|
|
20843
21197
|
// src/daemon.ts
|
|
20844
21198
|
function hasCode(error, code) {
|
|
20845
21199
|
return error instanceof Error && "code" in error && error.code === code;
|
|
@@ -20887,9 +21241,9 @@ async function bindIdentity(runtime, cfg) {
|
|
|
20887
21241
|
// src/push.ts
|
|
20888
21242
|
init_define_MESSENGER_BUILD_INFO();
|
|
20889
21243
|
var import_web_push = __toESM(require_src2(), 1);
|
|
20890
|
-
import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
20891
|
-
import { chmodSync, lstatSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
20892
|
-
import { dirname, join } from "node:path";
|
|
21244
|
+
import { createHash as createHash3, randomUUID, timingSafeEqual } from "node:crypto";
|
|
21245
|
+
import { chmodSync as chmodSync2, lstatSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
21246
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
20893
21247
|
var MAX_BINDINGS = 32;
|
|
20894
21248
|
var MAX_ENDPOINT_LENGTH = 2048;
|
|
20895
21249
|
var MAX_LABEL_LENGTH = 160;
|
|
@@ -20901,7 +21255,7 @@ function nonEmpty2(value, max = Number.MAX_SAFE_INTEGER) {
|
|
|
20901
21255
|
return typeof value === "string" && value.length > 0 && value.length <= max;
|
|
20902
21256
|
}
|
|
20903
21257
|
function fingerprint(publicKey) {
|
|
20904
|
-
return
|
|
21258
|
+
return createHash3("sha256").update(publicKey).digest("base64url");
|
|
20905
21259
|
}
|
|
20906
21260
|
function base64urlBytes(value, length, field) {
|
|
20907
21261
|
if (!nonEmpty2(value, 256) || !/^[A-Za-z0-9_-]+$/.test(value)) {
|
|
@@ -21023,15 +21377,15 @@ var PushStore = class _PushStore {
|
|
|
21023
21377
|
const env = typeof identityCidOrEnv === "string" ? envOrDependencies : identityCidOrEnv;
|
|
21024
21378
|
const deps = typeof identityCidOrEnv === "string" ? dependencies : envOrDependencies;
|
|
21025
21379
|
if (!nonEmpty2(identityCid, 512)) throw new Error("push identity CID must be a non-empty bounded string");
|
|
21026
|
-
const file =
|
|
21027
|
-
|
|
21380
|
+
const file = join2(stateDir, "push.json");
|
|
21381
|
+
mkdirSync2(dirname2(file), { recursive: true, mode: 448 });
|
|
21028
21382
|
let parsed;
|
|
21029
21383
|
try {
|
|
21030
21384
|
const stat2 = lstatSync(file);
|
|
21031
21385
|
if (!stat2.isFile() || stat2.isSymbolicLink()) throw preservedStateError(file, "not a safe regular file");
|
|
21032
21386
|
let value;
|
|
21033
21387
|
try {
|
|
21034
|
-
value = JSON.parse(
|
|
21388
|
+
value = JSON.parse(readFileSync2(file, "utf8"));
|
|
21035
21389
|
} catch (error) {
|
|
21036
21390
|
throw preservedStateError(file, `corrupt or unreadable (${error instanceof Error ? error.message : String(error)})`);
|
|
21037
21391
|
}
|
|
@@ -21094,10 +21448,10 @@ var PushStore = class _PushStore {
|
|
|
21094
21448
|
}
|
|
21095
21449
|
persist() {
|
|
21096
21450
|
const tmp = `${this.file}.tmp`;
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
|
|
21451
|
+
writeFileSync2(tmp, JSON.stringify(this.state, null, 2), { mode: 384 });
|
|
21452
|
+
chmodSync2(tmp, 384);
|
|
21453
|
+
renameSync2(tmp, this.file);
|
|
21454
|
+
chmodSync2(this.file, 384);
|
|
21101
21455
|
}
|
|
21102
21456
|
get publicKey() {
|
|
21103
21457
|
return this.state.vapid.publicKey;
|
|
@@ -21543,27 +21897,27 @@ async function pushEventFor(client, record) {
|
|
|
21543
21897
|
async function reconcileMissed(client, delivery, log2) {
|
|
21544
21898
|
let queued = 0;
|
|
21545
21899
|
const messages = await client.listIncomingMessages();
|
|
21546
|
-
for (const
|
|
21547
|
-
if (
|
|
21900
|
+
for (const m3 of messages) {
|
|
21901
|
+
if (m3.status !== "unread") continue;
|
|
21548
21902
|
if (delivery.enqueue({
|
|
21549
21903
|
event: "message_received",
|
|
21550
|
-
sender_id:
|
|
21551
|
-
sender_name:
|
|
21552
|
-
wire_id:
|
|
21904
|
+
sender_id: m3.from.id,
|
|
21905
|
+
sender_name: m3.from.name,
|
|
21906
|
+
wire_id: m3.wire_id
|
|
21553
21907
|
})) queued++;
|
|
21554
21908
|
}
|
|
21555
21909
|
const files = await client.listIncomingFiles();
|
|
21556
|
-
for (const
|
|
21557
|
-
if (
|
|
21910
|
+
for (const f4 of files) {
|
|
21911
|
+
if (f4.status !== "unread") continue;
|
|
21558
21912
|
if (delivery.enqueue({
|
|
21559
21913
|
event: "file_received",
|
|
21560
|
-
sender_id:
|
|
21561
|
-
sender_name:
|
|
21562
|
-
wire_id:
|
|
21914
|
+
sender_id: f4.from.id,
|
|
21915
|
+
sender_name: f4.from.name,
|
|
21916
|
+
wire_id: f4.wire_id,
|
|
21563
21917
|
// notificationKind() reads `kind` to split voice from file; passing the
|
|
21564
21918
|
// raw value keeps that decision in one place rather than duplicating it
|
|
21565
21919
|
// here, and matches what the live daemon record carries.
|
|
21566
|
-
kind:
|
|
21920
|
+
kind: f4.kind
|
|
21567
21921
|
})) queued++;
|
|
21568
21922
|
}
|
|
21569
21923
|
if (queued > 0) log2.info(`watch reconcile: queued ${queued} push(es) for notifications missed while disconnected`);
|
|
@@ -22141,7 +22495,7 @@ async function start(cfg, buildInfo, dependencies = DEFAULT_START_DEPENDENCIES)
|
|
|
22141
22495
|
events,
|
|
22142
22496
|
identityCid: bound.cid
|
|
22143
22497
|
};
|
|
22144
|
-
const moduleDir =
|
|
22498
|
+
const moduleDir = dirname3(fileURLToPath(import.meta.url));
|
|
22145
22499
|
const appCandidates = [
|
|
22146
22500
|
resolve(moduleDir, "../web"),
|
|
22147
22501
|
resolve(moduleDir, "../dist/web"),
|