diff --git a/frontend-dist/Inter-Black.woff.a3efb88f6f.efe3f25b.woff b/frontend-dist/Inter-Black.woff.a3efb88f6f.efe3f25b.woff new file mode 100644 index 000000000..8fd1bd531 Binary files /dev/null and b/frontend-dist/Inter-Black.woff.a3efb88f6f.efe3f25b.woff differ diff --git a/frontend-dist/Inter-Black.woff2.a3efb88f6f.1f333c9f.woff2 b/frontend-dist/Inter-Black.woff2.a3efb88f6f.1f333c9f.woff2 new file mode 100644 index 000000000..c354e6390 Binary files /dev/null and b/frontend-dist/Inter-Black.woff2.a3efb88f6f.1f333c9f.woff2 differ diff --git a/frontend-dist/Inter-BlackItalic.woff.a3efb88f6f.f6e2e726.woff b/frontend-dist/Inter-BlackItalic.woff.a3efb88f6f.f6e2e726.woff new file mode 100644 index 000000000..be6a45bcf Binary files /dev/null and b/frontend-dist/Inter-BlackItalic.woff.a3efb88f6f.f6e2e726.woff differ diff --git a/frontend-dist/Inter-BlackItalic.woff2.a3efb88f6f.89710fff.woff2 b/frontend-dist/Inter-BlackItalic.woff2.a3efb88f6f.89710fff.woff2 new file mode 100644 index 000000000..8b2efe952 Binary files /dev/null and b/frontend-dist/Inter-BlackItalic.woff2.a3efb88f6f.89710fff.woff2 differ diff --git a/frontend-dist/Inter-Bold.woff.a3efb88f6f.d92ed350.woff b/frontend-dist/Inter-Bold.woff.a3efb88f6f.d92ed350.woff new file mode 100644 index 000000000..b5221b0e8 Binary files /dev/null and b/frontend-dist/Inter-Bold.woff.a3efb88f6f.d92ed350.woff differ diff --git a/frontend-dist/Inter-Bold.woff2.a3efb88f6f.e8bd971d.woff2 b/frontend-dist/Inter-Bold.woff2.a3efb88f6f.e8bd971d.woff2 new file mode 100644 index 000000000..619c3a741 Binary files /dev/null and b/frontend-dist/Inter-Bold.woff2.a3efb88f6f.e8bd971d.woff2 differ diff --git a/frontend-dist/Inter-BoldItalic.woff.a3efb88f6f.39f68e5f.woff b/frontend-dist/Inter-BoldItalic.woff.a3efb88f6f.39f68e5f.woff new file mode 100644 index 000000000..da912559e Binary files /dev/null and b/frontend-dist/Inter-BoldItalic.woff.a3efb88f6f.39f68e5f.woff differ diff --git a/frontend-dist/Inter-BoldItalic.woff2.a3efb88f6f.cd6e580e.woff2 b/frontend-dist/Inter-BoldItalic.woff2.a3efb88f6f.cd6e580e.woff2 new file mode 100644 index 000000000..4022cc8d9 Binary files /dev/null and b/frontend-dist/Inter-BoldItalic.woff2.a3efb88f6f.cd6e580e.woff2 differ diff --git a/frontend-dist/Inter-ExtraBold.woff.a3efb88f6f.cd51bf91.woff b/frontend-dist/Inter-ExtraBold.woff.a3efb88f6f.cd51bf91.woff new file mode 100644 index 000000000..7221d72ef Binary files /dev/null and b/frontend-dist/Inter-ExtraBold.woff.a3efb88f6f.cd51bf91.woff differ diff --git a/frontend-dist/Inter-ExtraBold.woff2.a3efb88f6f.ffc04ff0.woff2 b/frontend-dist/Inter-ExtraBold.woff2.a3efb88f6f.ffc04ff0.woff2 new file mode 100644 index 000000000..d3d23b43e Binary files /dev/null and b/frontend-dist/Inter-ExtraBold.woff2.a3efb88f6f.ffc04ff0.woff2 differ diff --git a/frontend-dist/Inter-ExtraBoldItalic.woff.a3efb88f6f.122106d3.woff b/frontend-dist/Inter-ExtraBoldItalic.woff.a3efb88f6f.122106d3.woff new file mode 100644 index 000000000..8520a3185 Binary files /dev/null and b/frontend-dist/Inter-ExtraBoldItalic.woff.a3efb88f6f.122106d3.woff differ diff --git a/frontend-dist/Inter-ExtraBoldItalic.woff2.a3efb88f6f.de4f3979.woff2 b/frontend-dist/Inter-ExtraBoldItalic.woff2.a3efb88f6f.de4f3979.woff2 new file mode 100644 index 000000000..863748b2e Binary files /dev/null and b/frontend-dist/Inter-ExtraBoldItalic.woff2.a3efb88f6f.de4f3979.woff2 differ diff --git a/frontend-dist/Inter-ExtraLight.woff.a3efb88f6f.018d6d24.woff b/frontend-dist/Inter-ExtraLight.woff.a3efb88f6f.018d6d24.woff new file mode 100644 index 000000000..559044109 Binary files /dev/null and b/frontend-dist/Inter-ExtraLight.woff.a3efb88f6f.018d6d24.woff differ diff --git a/frontend-dist/Inter-ExtraLight.woff2.a3efb88f6f.735b820a.woff2 b/frontend-dist/Inter-ExtraLight.woff2.a3efb88f6f.735b820a.woff2 new file mode 100644 index 000000000..7cb6e49fb Binary files /dev/null and b/frontend-dist/Inter-ExtraLight.woff2.a3efb88f6f.735b820a.woff2 differ diff --git a/frontend-dist/Inter-ExtraLightItalic.woff.a3efb88f6f.c051c5b4.woff b/frontend-dist/Inter-ExtraLightItalic.woff.a3efb88f6f.c051c5b4.woff new file mode 100644 index 000000000..0a9f00de8 Binary files /dev/null and b/frontend-dist/Inter-ExtraLightItalic.woff.a3efb88f6f.c051c5b4.woff differ diff --git a/frontend-dist/Inter-ExtraLightItalic.woff2.a3efb88f6f.75944d4e.woff2 b/frontend-dist/Inter-ExtraLightItalic.woff2.a3efb88f6f.75944d4e.woff2 new file mode 100644 index 000000000..e63644200 Binary files /dev/null and b/frontend-dist/Inter-ExtraLightItalic.woff2.a3efb88f6f.75944d4e.woff2 differ diff --git a/frontend-dist/Inter-Italic.woff.a3efb88f6f.d9effa31.woff b/frontend-dist/Inter-Italic.woff.a3efb88f6f.d9effa31.woff new file mode 100644 index 000000000..f2c424804 Binary files /dev/null and b/frontend-dist/Inter-Italic.woff.a3efb88f6f.d9effa31.woff differ diff --git a/frontend-dist/Inter-Italic.woff2.a3efb88f6f.85eee0c1.woff2 b/frontend-dist/Inter-Italic.woff2.a3efb88f6f.85eee0c1.woff2 new file mode 100644 index 000000000..b749909b0 Binary files /dev/null and b/frontend-dist/Inter-Italic.woff2.a3efb88f6f.85eee0c1.woff2 differ diff --git a/frontend-dist/Inter-Light.woff.a3efb88f6f.0cf765a1.woff b/frontend-dist/Inter-Light.woff.a3efb88f6f.0cf765a1.woff new file mode 100644 index 000000000..15672799e Binary files /dev/null and b/frontend-dist/Inter-Light.woff.a3efb88f6f.0cf765a1.woff differ diff --git a/frontend-dist/Inter-Light.woff2.a3efb88f6f.f86a8a97.woff2 b/frontend-dist/Inter-Light.woff2.a3efb88f6f.f86a8a97.woff2 new file mode 100644 index 000000000..ac2e1275e Binary files /dev/null and b/frontend-dist/Inter-Light.woff2.a3efb88f6f.f86a8a97.woff2 differ diff --git a/frontend-dist/Inter-LightItalic.woff.a3efb88f6f.6c91af65.woff b/frontend-dist/Inter-LightItalic.woff.a3efb88f6f.6c91af65.woff new file mode 100644 index 000000000..ebbb05b38 Binary files /dev/null and b/frontend-dist/Inter-LightItalic.woff.a3efb88f6f.6c91af65.woff differ diff --git a/frontend-dist/Inter-LightItalic.woff2.a3efb88f6f.cb22faff.woff2 b/frontend-dist/Inter-LightItalic.woff2.a3efb88f6f.cb22faff.woff2 new file mode 100644 index 000000000..d51474ca1 Binary files /dev/null and b/frontend-dist/Inter-LightItalic.woff2.a3efb88f6f.cb22faff.woff2 differ diff --git a/frontend-dist/Inter-Medium.woff.a3efb88f6f.cb391d89.woff b/frontend-dist/Inter-Medium.woff.a3efb88f6f.cb391d89.woff new file mode 100644 index 000000000..dac813a74 Binary files /dev/null and b/frontend-dist/Inter-Medium.woff.a3efb88f6f.cb391d89.woff differ diff --git a/frontend-dist/Inter-Medium.woff2.a3efb88f6f.4f0ea984.woff2 b/frontend-dist/Inter-Medium.woff2.a3efb88f6f.4f0ea984.woff2 new file mode 100644 index 000000000..ab9850258 Binary files /dev/null and b/frontend-dist/Inter-Medium.woff2.a3efb88f6f.4f0ea984.woff2 differ diff --git a/frontend-dist/Inter-MediumItalic.woff.a3efb88f6f.1f636c25.woff b/frontend-dist/Inter-MediumItalic.woff.a3efb88f6f.1f636c25.woff new file mode 100644 index 000000000..ae6e45fe3 Binary files /dev/null and b/frontend-dist/Inter-MediumItalic.woff.a3efb88f6f.1f636c25.woff differ diff --git a/frontend-dist/Inter-MediumItalic.woff2.a3efb88f6f.2b734b7a.woff2 b/frontend-dist/Inter-MediumItalic.woff2.a3efb88f6f.2b734b7a.woff2 new file mode 100644 index 000000000..ceb866e42 Binary files /dev/null and b/frontend-dist/Inter-MediumItalic.woff2.a3efb88f6f.2b734b7a.woff2 differ diff --git a/frontend-dist/Inter-Regular.woff.a3efb88f6f.d9325c13.woff b/frontend-dist/Inter-Regular.woff.a3efb88f6f.d9325c13.woff new file mode 100644 index 000000000..e3200e0b9 Binary files /dev/null and b/frontend-dist/Inter-Regular.woff.a3efb88f6f.d9325c13.woff differ diff --git a/frontend-dist/Inter-Regular.woff2.a3efb88f6f.c52a047f.woff2 b/frontend-dist/Inter-Regular.woff2.a3efb88f6f.c52a047f.woff2 new file mode 100644 index 000000000..28ae0b6ab Binary files /dev/null and b/frontend-dist/Inter-Regular.woff2.a3efb88f6f.c52a047f.woff2 differ diff --git a/frontend-dist/Inter-SemiBold.woff.a3efb88f6f.c6670c13.woff b/frontend-dist/Inter-SemiBold.woff.a3efb88f6f.c6670c13.woff new file mode 100644 index 000000000..295fbdfa9 Binary files /dev/null and b/frontend-dist/Inter-SemiBold.woff.a3efb88f6f.c6670c13.woff differ diff --git a/frontend-dist/Inter-SemiBold.woff2.a3efb88f6f.08366574.woff2 b/frontend-dist/Inter-SemiBold.woff2.a3efb88f6f.08366574.woff2 new file mode 100644 index 000000000..41ebbbb02 Binary files /dev/null and b/frontend-dist/Inter-SemiBold.woff2.a3efb88f6f.08366574.woff2 differ diff --git a/frontend-dist/Inter-SemiBoldItalic.woff.a3efb88f6f.13394743.woff b/frontend-dist/Inter-SemiBoldItalic.woff.a3efb88f6f.13394743.woff new file mode 100644 index 000000000..34d759f72 Binary files /dev/null and b/frontend-dist/Inter-SemiBoldItalic.woff.a3efb88f6f.13394743.woff differ diff --git a/frontend-dist/Inter-SemiBoldItalic.woff2.a3efb88f6f.5c7db07d.woff2 b/frontend-dist/Inter-SemiBoldItalic.woff2.a3efb88f6f.5c7db07d.woff2 new file mode 100644 index 000000000..4dd025adf Binary files /dev/null and b/frontend-dist/Inter-SemiBoldItalic.woff2.a3efb88f6f.5c7db07d.woff2 differ diff --git a/frontend-dist/Inter-Thin.woff.a3efb88f6f.832f7e9d.woff b/frontend-dist/Inter-Thin.woff.a3efb88f6f.832f7e9d.woff new file mode 100644 index 000000000..07ea92efb Binary files /dev/null and b/frontend-dist/Inter-Thin.woff.a3efb88f6f.832f7e9d.woff differ diff --git a/frontend-dist/Inter-Thin.woff2.a3efb88f6f.099a7dc1.woff2 b/frontend-dist/Inter-Thin.woff2.a3efb88f6f.099a7dc1.woff2 new file mode 100644 index 000000000..72707dcd3 Binary files /dev/null and b/frontend-dist/Inter-Thin.woff2.a3efb88f6f.099a7dc1.woff2 differ diff --git a/frontend-dist/Inter-ThinItalic.woff.a3efb88f6f.9a9e646f.woff b/frontend-dist/Inter-ThinItalic.woff.a3efb88f6f.9a9e646f.woff new file mode 100644 index 000000000..d35d6173c Binary files /dev/null and b/frontend-dist/Inter-ThinItalic.woff.a3efb88f6f.9a9e646f.woff differ diff --git a/frontend-dist/Inter-ThinItalic.woff2.a3efb88f6f.f5b32cfe.woff2 b/frontend-dist/Inter-ThinItalic.woff2.a3efb88f6f.f5b32cfe.woff2 new file mode 100644 index 000000000..884fe458c Binary files /dev/null and b/frontend-dist/Inter-ThinItalic.woff2.a3efb88f6f.f5b32cfe.woff2 differ diff --git a/frontend-dist/Inter-italic.var.woff2.a3efb88f6f.e62a3bb2.woff2 b/frontend-dist/Inter-italic.var.woff2.a3efb88f6f.e62a3bb2.woff2 new file mode 100644 index 000000000..b1d4bdc36 Binary files /dev/null and b/frontend-dist/Inter-italic.var.woff2.a3efb88f6f.e62a3bb2.woff2 differ diff --git a/frontend-dist/Inter-roman.var.woff2.a3efb88f6f.8120837c.woff2 b/frontend-dist/Inter-roman.var.woff2.a3efb88f6f.8120837c.woff2 new file mode 100644 index 000000000..f56c09796 Binary files /dev/null and b/frontend-dist/Inter-roman.var.woff2.a3efb88f6f.8120837c.woff2 differ diff --git a/frontend-dist/Inter.var.woff2.a3efb88f6f.ca82f9aa.woff2 b/frontend-dist/Inter.var.woff2.a3efb88f6f.ca82f9aa.woff2 new file mode 100644 index 000000000..0c4143192 Binary files /dev/null and b/frontend-dist/Inter.var.woff2.a3efb88f6f.ca82f9aa.woff2 differ diff --git a/frontend-dist/JuliaMono-Bold.24b57d33.woff2 b/frontend-dist/JuliaMono-Bold.24b57d33.woff2 new file mode 100644 index 000000000..212ccec35 Binary files /dev/null and b/frontend-dist/JuliaMono-Bold.24b57d33.woff2 differ diff --git a/frontend-dist/JuliaMono-BoldLatin.7ec5c608.woff2 b/frontend-dist/JuliaMono-BoldLatin.7ec5c608.woff2 new file mode 100644 index 000000000..1f8dde89e Binary files /dev/null and b/frontend-dist/JuliaMono-BoldLatin.7ec5c608.woff2 differ diff --git a/frontend-dist/JuliaMono-Regular.e0106c6f.woff2 b/frontend-dist/JuliaMono-Regular.e0106c6f.woff2 new file mode 100644 index 000000000..c2db12737 Binary files /dev/null and b/frontend-dist/JuliaMono-Regular.e0106c6f.woff2 differ diff --git a/frontend-dist/JuliaMono-RegularItalic.3159f647.woff2 b/frontend-dist/JuliaMono-RegularItalic.3159f647.woff2 new file mode 100644 index 000000000..987502fed Binary files /dev/null and b/frontend-dist/JuliaMono-RegularItalic.3159f647.woff2 differ diff --git a/frontend-dist/JuliaMono-RegularLatin.26c56b70.woff2 b/frontend-dist/JuliaMono-RegularLatin.26c56b70.woff2 new file mode 100644 index 000000000..f159a9285 Binary files /dev/null and b/frontend-dist/JuliaMono-RegularLatin.26c56b70.woff2 differ diff --git a/frontend-dist/Vollkorn-Black.0ebdfbf5.woff2 b/frontend-dist/Vollkorn-Black.0ebdfbf5.woff2 new file mode 100644 index 000000000..b51a37a40 Binary files /dev/null and b/frontend-dist/Vollkorn-Black.0ebdfbf5.woff2 differ diff --git a/frontend-dist/Vollkorn-BlackItalic.4095acfe.woff2 b/frontend-dist/Vollkorn-BlackItalic.4095acfe.woff2 new file mode 100644 index 000000000..bb2e060ce Binary files /dev/null and b/frontend-dist/Vollkorn-BlackItalic.4095acfe.woff2 differ diff --git a/frontend-dist/Vollkorn-Bold.6e1feb70.woff2 b/frontend-dist/Vollkorn-Bold.6e1feb70.woff2 new file mode 100644 index 000000000..cfb12e152 Binary files /dev/null and b/frontend-dist/Vollkorn-Bold.6e1feb70.woff2 differ diff --git a/frontend-dist/Vollkorn-BoldItalic.a48ab300.woff2 b/frontend-dist/Vollkorn-BoldItalic.a48ab300.woff2 new file mode 100644 index 000000000..23d7a6c84 Binary files /dev/null and b/frontend-dist/Vollkorn-BoldItalic.a48ab300.woff2 differ diff --git a/frontend-dist/Vollkorn-SemiBold.8072eb6c.woff2 b/frontend-dist/Vollkorn-SemiBold.8072eb6c.woff2 new file mode 100644 index 000000000..78b781055 Binary files /dev/null and b/frontend-dist/Vollkorn-SemiBold.8072eb6c.woff2 differ diff --git a/frontend-dist/Vollkorn-SemiBoldItalic.5c3cd265.woff2 b/frontend-dist/Vollkorn-SemiBoldItalic.5c3cd265.woff2 new file mode 100644 index 000000000..2162ab8ef Binary files /dev/null and b/frontend-dist/Vollkorn-SemiBoldItalic.5c3cd265.woff2 differ diff --git a/frontend-dist/add-outline.e3c93c35.svg b/frontend-dist/add-outline.e3c93c35.svg new file mode 100644 index 000000000..7c7fb1487 --- /dev/null +++ b/frontend-dist/add-outline.e3c93c35.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/arrow-back-outline.9ae1bed8.svg b/frontend-dist/arrow-back-outline.9ae1bed8.svg new file mode 100644 index 000000000..8fc34ff6e --- /dev/null +++ b/frontend-dist/arrow-back-outline.9ae1bed8.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/arrow-forward-outline.f5f68f5c.svg b/frontend-dist/arrow-forward-outline.f5f68f5c.svg new file mode 100644 index 000000000..32a9f4f30 --- /dev/null +++ b/frontend-dist/arrow-forward-outline.f5f68f5c.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/arrow-redo-circle-outline.dfa899f4.svg b/frontend-dist/arrow-redo-circle-outline.dfa899f4.svg new file mode 100644 index 000000000..d0d9e1124 --- /dev/null +++ b/frontend-dist/arrow-redo-circle-outline.dfa899f4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/arrow-undo-outline.d8c99108.svg b/frontend-dist/arrow-undo-outline.d8c99108.svg new file mode 100644 index 000000000..a5d529e72 --- /dev/null +++ b/frontend-dist/arrow-undo-outline.d8c99108.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/arrow-up-circle-outline.3f146ffe.svg b/frontend-dist/arrow-up-circle-outline.3f146ffe.svg new file mode 100644 index 000000000..ba46f260f --- /dev/null +++ b/frontend-dist/arrow-up-circle-outline.3f146ffe.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/ban-outline.c97da9b4.svg b/frontend-dist/ban-outline.c97da9b4.svg new file mode 100644 index 000000000..c52ff6227 --- /dev/null +++ b/frontend-dist/ban-outline.c97da9b4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/caret-down-outline.4253a2fe.svg b/frontend-dist/caret-down-outline.4253a2fe.svg new file mode 100644 index 000000000..c4c15b472 --- /dev/null +++ b/frontend-dist/caret-down-outline.4253a2fe.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/caret-forward-circle-outline.d0bf2b34.svg b/frontend-dist/caret-forward-circle-outline.d0bf2b34.svg new file mode 100644 index 000000000..093c8e4ca --- /dev/null +++ b/frontend-dist/caret-forward-circle-outline.d0bf2b34.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/caret-forward-outline.348a84b6.svg b/frontend-dist/caret-forward-outline.348a84b6.svg new file mode 100644 index 000000000..888285c95 --- /dev/null +++ b/frontend-dist/caret-forward-outline.348a84b6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/chatbox-ellipses-outline.4334a3a4.svg b/frontend-dist/chatbox-ellipses-outline.4334a3a4.svg new file mode 100644 index 000000000..4e04a5854 --- /dev/null +++ b/frontend-dist/chatbox-ellipses-outline.4334a3a4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/checkmark-outline.4fb8c646.svg b/frontend-dist/checkmark-outline.4fb8c646.svg new file mode 100644 index 000000000..f62dcf921 --- /dev/null +++ b/frontend-dist/checkmark-outline.4fb8c646.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/checkmark-outline.538ded54.svg b/frontend-dist/checkmark-outline.538ded54.svg new file mode 100644 index 000000000..7ceba660d --- /dev/null +++ b/frontend-dist/checkmark-outline.538ded54.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/chevron-down-outline.1efaf1cc.svg b/frontend-dist/chevron-down-outline.1efaf1cc.svg new file mode 100644 index 000000000..e7a50cd11 --- /dev/null +++ b/frontend-dist/chevron-down-outline.1efaf1cc.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/chevron-forward-circle-outline.babf2a99.svg b/frontend-dist/chevron-forward-circle-outline.babf2a99.svg new file mode 100644 index 000000000..9e63a3c04 --- /dev/null +++ b/frontend-dist/chevron-forward-circle-outline.babf2a99.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/close-circle-outline.4baeedb9.svg b/frontend-dist/close-circle-outline.4baeedb9.svg new file mode 100644 index 000000000..588e2d4c8 --- /dev/null +++ b/frontend-dist/close-circle-outline.4baeedb9.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/close-circle.d0f6eac6.svg b/frontend-dist/close-circle.d0f6eac6.svg new file mode 100644 index 000000000..cce96081a --- /dev/null +++ b/frontend-dist/close-circle.d0f6eac6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/close-outline.9c22a232.svg b/frontend-dist/close-outline.9c22a232.svg new file mode 100644 index 000000000..17d07818e --- /dev/null +++ b/frontend-dist/close-outline.9c22a232.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/cloud-download-outline.8c1ff9bb.svg b/frontend-dist/cloud-download-outline.8c1ff9bb.svg new file mode 100644 index 000000000..939a8c238 --- /dev/null +++ b/frontend-dist/cloud-download-outline.8c1ff9bb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/cloud-offline-outline.ac2eade9.svg b/frontend-dist/cloud-offline-outline.ac2eade9.svg new file mode 100644 index 000000000..426ff3b0d --- /dev/null +++ b/frontend-dist/cloud-offline-outline.ac2eade9.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/copy-outline.0f561529.svg b/frontend-dist/copy-outline.0f561529.svg new file mode 100644 index 000000000..01e29db63 --- /dev/null +++ b/frontend-dist/copy-outline.0f561529.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/copy-outline.6d5a7927.svg b/frontend-dist/copy-outline.6d5a7927.svg new file mode 100644 index 000000000..62e0956c3 --- /dev/null +++ b/frontend-dist/copy-outline.6d5a7927.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/document-lock-outline.69d176a4.svg b/frontend-dist/document-lock-outline.69d176a4.svg new file mode 100644 index 000000000..b602b075c --- /dev/null +++ b/frontend-dist/document-lock-outline.69d176a4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/document-text-outline.8d1e2333.svg b/frontend-dist/document-text-outline.8d1e2333.svg new file mode 100644 index 000000000..dacd264f4 --- /dev/null +++ b/frontend-dist/document-text-outline.8d1e2333.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/download-outline.523a74d8.svg b/frontend-dist/download-outline.523a74d8.svg new file mode 100644 index 000000000..8f0e68054 --- /dev/null +++ b/frontend-dist/download-outline.523a74d8.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/easel-outline.9b064e1f.svg b/frontend-dist/easel-outline.9b064e1f.svg new file mode 100644 index 000000000..cb8186f59 --- /dev/null +++ b/frontend-dist/easel-outline.9b064e1f.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/editor.09b09a3f.css b/frontend-dist/editor.09b09a3f.css new file mode 100644 index 000000000..85bb5489a --- /dev/null +++ b/frontend-dist/editor.09b09a3f.css @@ -0,0 +1 @@ +pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:var(--cm-color-editor-text)}.hljs-comment,.hljs-quote{color:var(--cm-color-comment);font-style:italic}.hljs-doctag,.hljs-formula,.hljs-keyword{color:var(--cm-color-keyword)}.hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:var(--cm-color-var2)}.hljs-literal{color:var(--cm-color-builtin)}.hljs-addition,.hljs-attribute,.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:var(--cm-color-string)}.hljs-attr,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:var(--cm-color-var)}.hljs-number{color:var(--cm-color-number)}.hljs-bullet,.hljs-link,.hljs-selector-id,.hljs-symbol,.hljs-title{color:var(--cm-color-link)}.hljs-meta{color:var(--cm-color-macro);font-weight:700}.hljs-built_in,.hljs-class .hljs-title,.hljs-title.class_{color:var(--cm-color-var2)}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-link{text-decoration:underline} \ No newline at end of file diff --git a/frontend-dist/editor.25621fbe.css b/frontend-dist/editor.25621fbe.css new file mode 100644 index 000000000..ee5d9d3d1 --- /dev/null +++ b/frontend-dist/editor.25621fbe.css @@ -0,0 +1 @@ +main{cursor:auto;margin-top:20px}#helpbox-wrapper,.dont-panic,body header#pluto-nav,footer,jlerror .doclink,pluto-cell>button,pluto-input>button,pluto-runarea,pluto-shoulder,preamble>button{display:none!important}@media print{.edit_or_run,.floating_back_button,.loading-bar,.MJX_HoverRegion,.MJX_LiveRegion,.MJX_ToolTip,.outline-frame,.outline-frame-actions-container,.pluto-frontmatter,nav#undo_delete,pkg-status-mark{display:none!important}main{padding-bottom:0}pluto-input .cm-editor{border-left:1px solid var(--normal-cell-color);border-radius:4px!important}pluto-cell{break-inside:avoid}pluto-cell.code_folded:has(p){break-inside:auto}pluto-output>div>div.markdown>hr,pluto-output>div>div>hr{break-after:page;height:0;margin:0;visibility:hidden}pluto-output h1{break-before:page}pluto-cell:first-of-type pluto-output h1{break-before:avoid}pluto-output :is(.admonition,.pluto-docs-binding,blockquote) h1{break-before:avoid}pluto-output :is(h1,h2,h3,h4){break-after:avoid}}@page{widows:2} \ No newline at end of file diff --git a/frontend-dist/editor.6386bd9d.js b/frontend-dist/editor.6386bd9d.js new file mode 100644 index 000000000..dd344f6c8 --- /dev/null +++ b/frontend-dist/editor.6386bd9d.js @@ -0,0 +1,8 @@ +/*! iFrame Resizer (iframeSizer.contentWindow.min.js) - v4.2.11 - 2020-06-02 + * Desc: Include this file in any page being loaded into an iframe + * to force the iframe to resize to the content size. + * Requires: iframeResizer.min.js on host page. + * Copyright: (c) 2020 David J. Bradshaw - dave@bradshaw.net + * License: MIT + */ +!function(e){if("undefined"!=typeof window){var t=!0,n=10,o="",i=0,r="",a=null,u="",c=!1,s={resize:1,click:1},d=128,l=!0,f=1,m="bodyOffset",h=m,g=!0,p="",v={},y=32,b=null,w=!1,T="[iFrameSizer]",E=T.length,O="",S={max:1,min:1,bodyScroll:1,documentElementScroll:1},M="child",I=!0,N=window.parent,A="*",C=0,z=!1,k=null,R=16,x=1,L="scroll",F=L,P=window,D=function(){re("onMessage function not defined")},j=function(){},q=function(){},H={height:function(){return re("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return re("Custom width calculation function not defined"),document.body.scrollWidth}},W={},B=!1;try{var J=Object.create({},{passive:{get:function(){B=!0}}});window.addEventListener("test",ee,J),window.removeEventListener("test",ee,J)}catch(e){}var U,V,K,Q,X,Y,G=Date.now||function(){return(new Date).getTime()},Z={bodyOffset:function(){return document.body.offsetHeight+pe("marginTop")+pe("marginBottom")},offset:function(){return Z.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return H.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,ye(Z))},min:function(){return Math.min.apply(null,ye(Z))},grow:function(){return Z.max()},lowestElement:function(){return Math.max(Z.bodyOffset()||Z.documentElementOffset(),ve("bottom",we()))},taggedElement:function(){return be("bottom","data-iframe-height")}},$={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return H.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max($.bodyScroll(),$.documentElementScroll())},max:function(){return Math.max.apply(null,ye($))},min:function(){return Math.min.apply(null,ye($))},rightMostElement:function(){return ve("right",we())},taggedElement:function(){return be("right","data-iframe-width")}},_=(U=Te,X=null,Y=0,function(){var e=G(),t=R-(e-(Y=Y||e));return V=this,K=arguments,t<=0||Ro),(e=>o=e)),e(t.exports,"resolve",(()=>a),(e=>a=e));var r={};o=function(e){for(var t=Object.keys(e),n=0;n1?t-1:0),o=1;o3?t.i-4:t.i:Array.isArray(e)?1:f(e)?2:_(e)?3:0}function p(e,t){return 2===u(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function m(e,t){return 2===u(e)?e.get(t):e[t]}function h(e,t,n){var o=u(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function g(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function f(e){return G&&e instanceof Map}function _(e){return W&&e instanceof Set}function b(e){return e.o||e.t}function v(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Y(e);delete t[Q];for(var n=X(t),o=0;o1&&(e.set=e.add=e.clear=e.delete=w),Object.freeze(e),t&&d(e,(function(e,t){return y(t,!0)}),!0)),e}function w(){s(2)}function k(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function E(e){var t=J[e];return t||s(18,e),t}function $(e,t){J[e]||(J[e]=t)}function x(){return q}function S(e,t){t&&(E("Patches"),e.u=[],e.s=[],e.v=t)}function N(e){C(e),e.p.forEach(M),e.p=null}function C(e){e===q&&(q=e.l)}function A(e){return q={p:[],l:q,h:e,m:!0,_:0}}function M(e){var t=e[Q];0===t.i||1===t.i?t.j():t.g=!0}function O(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.O||E("ES5").S(t,e,o),o?(n[Q].P&&(N(t),s(4)),c(e)&&(e=T(t,e),t.l||L(t,e)),t.u&&E("Patches").M(n[Q],e,t.u,t.s)):e=T(t,n,[]),N(t),t.u&&t.v(t.u,t.s),e!==Z?e:void 0}function T(e,t,n){if(k(t))return t;var o=t[Q];if(!o)return d(t,(function(a,r){return R(e,o,t,a,r,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return L(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var a=4===o.i||5===o.i?o.o=v(o.k):o.o;d(3===o.i?new Set(a):a,(function(t,r){return R(e,o,a,t,r,n)})),L(e,a,!1),n&&e.u&&E("Patches").R(o,n,e.u,e.s)}return o.o}function R(e,t,n,o,a,r){if(l(a)){var i=T(e,a,r&&t&&3!==t.i&&!p(t.D,o)?r.concat(o):void 0);if(h(n,o,i),!l(i))return;e.m=!1}if(c(a)&&!k(a)){if(!e.h.N&&e._<1)return;T(e,a),t&&t.A.l||L(e,a)}}function L(e,t,n){void 0===n&&(n=!1),e.h.N&&e.m&&y(t,n)}function D(e,t){var n=e[Q];return(n?b(n):e)[t]}function I(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function P(e){e.P||(e.P=!0,e.l&&P(e.l))}function j(e){e.o||(e.o=v(e.t))}function B(e,t,n){var o=f(t)?E("MapSet").T(t,n):_(t)?E("MapSet").F(t,n):e.O?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:x(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},a=o,r=ee;n&&(a=[o],r=te);var i=Proxy.revocable(a,r),s=i.revoke,l=i.proxy;return o.k=l,o.j=s,l}(t,n):E("ES5").J(t,n);return(n?n.A:x()).p.push(o),o}function U(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return v(e)}function F(){function e(t){if(!c(t))return t;if(Array.isArray(t))return t.map(e);if(f(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(_(t))return new Set(Array.from(t).map(e));var n=Object.create(Object.getPrototypeOf(t));for(var o in t)n[o]=e(t[o]);return n}function t(t){return l(t)?e(t):t}var n="add";$("Patches",{$:function(t,o){return o.forEach((function(o){for(var a=o.path,r=o.op,i=t,l=0;l1?r-1:0),s=1;s1?n-1:0),r=1;r=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}var a=E("Patches").$;return l(e)?a(e,t):this.produce(e,(function(e){return a(e,t.slice(n+1))}))},e}(),oe=new ne,ae=oe.produce,re=oe.produceWithPatches.bind(oe),ie=oe.setAutoFreeze.bind(oe),se=(oe.setUseProxies.bind(oe),oe.applyPatches.bind(oe)),le=(oe.createDraft.bind(oe),oe.finishDraft.bind(oe),ae);F(),ie(!1);var ce=r("9Ta4i"),de=r("4zMEb");de=r("4zMEb");let ue=async e=>e(),pe=null;r.register("54qll",(function(e,t){e.exports=import("./"+r("ko7kR").resolve("g8zEq")).then((()=>r("8WRsO")))})),r.register("7fNkl",(function(e,t){e.exports=Promise.all([import("./"+r("ko7kR").resolve("g8zEq")),import("./"+r("ko7kR").resolve("9IVCm"))]).then((()=>r("4rxkr")))}));const me=async()=>(null==pe&&(pe=ue((async()=>{let[{initializeApp:e},t]=await Promise.all([r("54qll"),r("7fNkl")]),{getFirestore:n,addDoc:o,doc:a,collection:i}=t,s=e({apiKey:"AIzaSyC0DqEcaM8AZ6cvApXuNcNU2RgZZOj7F68",authDomain:"localhost",projectId:"pluto-feedback"}),l=n(s),c=i(l,"feedback"),d=async e=>{let t=await o(c,e);console.debug("Firestore doc created ",t.id,t)};return console.log("🔥base loaded",{initializeApp:e,firestore_module:t,app:s,db:l,feedback_db:c,add_feedback:d}),d}))),await pe),he=async()=>{try{const e=document.querySelector("form#feedback");if(null==e)return;e.addEventListener("submit",(t=>{const n=prompt("Would you like us to contact you?\n\nEmail: (leave blank to stay anonymous 👀)");t.preventDefault(),ue((async()=>{try{const o=String(new FormData(t.target).get("opinion"));if(o.length<4)return;let a=await me();await de.timeout_promise(a({feedback:o,timestamp:Date.now(),email:n||""}),5e3);let r="Submitted. Thank you for your feedback! 💕";console.log(r),alert(r),e.querySelector("#opinion").value=""}catch(e){let t="Whoops, failed to send feedback 😢\nWe would really like to hear from you! Please got to https://github.com/fonsp/Pluto.jl/issues to report this failure:\n\n";console.error(t),console.error(e),alert(t+e)}}))})),e.addEventListener("focusin",(()=>{me()}))}catch(e){console.error("Something went wrong loading the feedback form:",e),document.querySelector("form#feedback").style.opacity=0;for(let e of"Oh noooooooooooooooooo...")document.querySelector("form#feedback input").value+=e,await new Promise((e=>setTimeout(e,200)))}};function ge(e){return e.replace(/\r\n/g,"\n").split(/# ╔═╡ \S+\n/).map((e=>e.trim())).filter((e=>""!==e))}function fe(e){const t=e.replace(/\r\n/g,"\n").split("julia> "),n=" ".repeat(prompt.length);return t.map((function(e){return(n+e).split("\n").filter((e=>e.startsWith(n))).map((e=>e.replace(n,""))).join("\n")})).map((e=>e.trim())).filter((e=>""!==e))}const _e=e=>{var t;return e.trim().startsWith("julia> ")?fe:(null===(t=e.match(/# ╔═╡ ........-....-....-....-............/g))||void 0===t?void 0:t.length)?ge:null};var be=r("2ZZ1r"),ve=(i=r("cNaMA"),r("aN0pg"));let ye=(i=r("cNaMA")).createContext(),we=i.createContext(null),ke=i.createContext(null);class Ee extends Set{constructor(e){super(),this.callback=e}delete(e){let t=super.delete(e);return t&&0===this.size&&this.callback(),t}}var $e=r("kjWx8");const xe=()=>"visible"===document.visibilityState?Promise.resolve():new Promise((e=>{const t=()=>{xe().then(e),document.removeEventListener("visibilitychange",t)};document.addEventListener("visibilitychange",t)})),Se=({any_code_differs:e,last_update_time:t,last_hot_reload_time:n,connected:o})=>{let a=i.useContext(ye);const[r,s]=i.useState(""),[l,c]=i.useState(""),d=i.useRef(null),u=i.useRef(null);i.useEffect((()=>(clearTimeout(null==d?void 0:d.current),e?s("ask_to_save"):Date.now()-t<1e3?(s("saved"),d.current=setTimeout((()=>{s("")}),1e3)):s(""),()=>clearTimeout(null==d?void 0:d.current))),[e]);const[p,m]=i.useState(!1);return i.useEffect((()=>{o&&setTimeout((()=>m(!0)),1e3)}),[o]),i.useEffect((()=>{if(console.log("Hottt",n,p),p)return c("reloaded_from_file"),console.log("set state"),xe().then((()=>{u.current=setTimeout((()=>{c(""),console.log("reset state")}),8e3)})),()=>clearTimeout(null==u?void 0:u.current)}),[n]),i.html` + ${"ask_to_save"===r?i.html` +
+ +
+ `:"saved"===r||"saving"===r?i.html` +
+ Saved +
+ `:"reloaded_from_file"===l?i.html` +
+ File change detected, notebook updated +
+ `:null} +
`};i=r("cNaMA"),ce=r("9Ta4i"),i=r("cNaMA"),i=r("cNaMA");var Ne={};t(Ne),e(Ne,"default",(()=>Et));var{entries:Ce,setPrototypeOf:Ae,isFrozen:Me,getPrototypeOf:Oe,getOwnPropertyDescriptor:Te}=Object,{freeze:Re,seal:Le,create:De}=Object,{apply:Ie,construct:Pe}=typeof Reflect<"u"&&Reflect;Ie||(Ie=function(e,t,n){return e.apply(t,n)}),Re||(Re=function(e){return e}),Le||(Le=function(e){return e}),Pe||(Pe=function(e,t){return new e(...t)});var je,Be=Qe(Array.prototype.forEach),Ue=Qe(Array.prototype.pop),Fe=Qe(Array.prototype.push),ze=Qe(String.prototype.toLowerCase),qe=Qe(String.prototype.toString),He=Qe(String.prototype.match),Ge=Qe(String.prototype.replace),We=Qe(String.prototype.indexOf),Ke=Qe(String.prototype.trim),Ze=Qe(RegExp.prototype.test),Ve=(je=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n1?n-1:0),a=1;a/gm),mt=Le(/\${[\w\W]*}/gm),ht=Le(/^data-[\-\w.\u00B7-\uFFFF]/),gt=Le(/^aria-[\-\w]+$/),ft=Le(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_t=Le(/^(?:\w+script|data):/i),bt=Le(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),vt=Le(/^html$/i),yt=Object.freeze({__proto__:null,MUSTACHE_EXPR:ut,ERB_EXPR:pt,TMPLIT_EXPR:mt,DATA_ATTR:ht,ARIA_ATTR:gt,IS_ALLOWED_URI:ft,IS_SCRIPT_OR_DATA:_t,ATTR_WHITESPACE:bt,DOCTYPE_NAME:vt}),wt=()=>typeof window>"u"?null:window,kt=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null,o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));let a="dompurify"+(n?"#"+n:"");try{return e.createPolicy(a,{createHTML:e=>e,createScriptURL:e=>e})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}};var Et=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wt(),n=t=>e(t);if(n.version="3.0.3",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;let o=t.document,a=o.currentScript,{document:r}=t,{DocumentFragment:i,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:h}=t,g=c.prototype,f=Je(g,"cloneNode"),_=Je(g,"nextSibling"),b=Je(g,"childNodes"),v=Je(g,"parentNode");if("function"==typeof s){let e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let y,w="",{implementation:k,createNodeIterator:E,createDocumentFragment:$,getElementsByTagName:x}=r,{importNode:S}=o,N={};n.isSupported="function"==typeof Ce&&"function"==typeof v&&k&&void 0!==k.createHTMLDocument;let C,A,{MUSTACHE_EXPR:M,ERB_EXPR:O,TMPLIT_EXPR:T,DATA_ATTR:R,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:D,ATTR_WHITESPACE:I}=yt,{IS_ALLOWED_URI:P}=yt,j=null,B=Xe({},[...et,...tt,...nt,...at,...it]),U=null,F=Xe({},[...st,...lt,...ct,...dt]),z=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),q=null,H=null,G=!0,W=!0,K=!1,Z=!0,V=!1,Q=!1,X=!1,Y=!1,J=!1,ee=!1,te=!1,ne=!0,oe=!1,ae="user-content-",re=!0,ie=!1,se={},le=null,ce=Xe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),de=null,ue=Xe({},["audio","video","img","source","image","track"]),pe=null,me=Xe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),he="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml",_e=fe,be=!1,ve=null,ye=Xe({},[he,ge,fe],qe),we=["application/xhtml+xml","text/html"],ke="text/html",Ee=null,$e=r.createElement("form"),xe=function(e){return e instanceof RegExp||e instanceof Function},Se=function(e){if(!Ee||Ee!==e){if((!e||"object"!=typeof e)&&(e={}),e=Ye(e),C=C=-1===we.indexOf(e.PARSER_MEDIA_TYPE)?ke:e.PARSER_MEDIA_TYPE,A="application/xhtml+xml"===C?qe:ze,j="ALLOWED_TAGS"in e?Xe({},e.ALLOWED_TAGS,A):B,U="ALLOWED_ATTR"in e?Xe({},e.ALLOWED_ATTR,A):F,ve="ALLOWED_NAMESPACES"in e?Xe({},e.ALLOWED_NAMESPACES,qe):ye,pe="ADD_URI_SAFE_ATTR"in e?Xe(Ye(me),e.ADD_URI_SAFE_ATTR,A):me,de="ADD_DATA_URI_TAGS"in e?Xe(Ye(ue),e.ADD_DATA_URI_TAGS,A):ue,le="FORBID_CONTENTS"in e?Xe({},e.FORBID_CONTENTS,A):ce,q="FORBID_TAGS"in e?Xe({},e.FORBID_TAGS,A):{},H="FORBID_ATTR"in e?Xe({},e.FORBID_ATTR,A):{},se="USE_PROFILES"in e&&e.USE_PROFILES,G=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,K=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Z=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,V=e.SAFE_FOR_TEMPLATES||!1,Q=e.WHOLE_DOCUMENT||!1,J=e.RETURN_DOM||!1,ee=e.RETURN_DOM_FRAGMENT||!1,te=e.RETURN_TRUSTED_TYPE||!1,Y=e.FORCE_BODY||!1,ne=!1!==e.SANITIZE_DOM,oe=e.SANITIZE_NAMED_PROPS||!1,re=!1!==e.KEEP_CONTENT,ie=e.IN_PLACE||!1,P=e.ALLOWED_URI_REGEXP||ft,_e=e.NAMESPACE||fe,z=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(z.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&xe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(z.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(z.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),V&&(W=!1),ee&&(J=!0),se&&(j=Xe({},[...it]),U=[],!0===se.html&&(Xe(j,et),Xe(U,st)),!0===se.svg&&(Xe(j,tt),Xe(U,lt),Xe(U,dt)),!0===se.svgFilters&&(Xe(j,nt),Xe(U,lt),Xe(U,dt)),!0===se.mathMl&&(Xe(j,at),Xe(U,ct),Xe(U,dt))),e.ADD_TAGS&&(j===B&&(j=Ye(j)),Xe(j,e.ADD_TAGS,A)),e.ADD_ATTR&&(U===F&&(U=Ye(U)),Xe(U,e.ADD_ATTR,A)),e.ADD_URI_SAFE_ATTR&&Xe(pe,e.ADD_URI_SAFE_ATTR,A),e.FORBID_CONTENTS&&(le===ce&&(le=Ye(le)),Xe(le,e.FORBID_CONTENTS,A)),re&&(j["#text"]=!0),Q&&Xe(j,["html","head","body"]),j.table&&(Xe(j,["tbody"]),delete q.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Ve('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Ve('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');y=e.TRUSTED_TYPES_POLICY,w=y.createHTML("")}else void 0===y&&(y=kt(h,a)),null!==y&&"string"==typeof w&&(w=y.createHTML(""));Re&&Re(e),Ee=e}},Ne=Xe({},["mi","mo","mn","ms","mtext"]),Ae=Xe({},["foreignobject","desc","title","annotation-xml"]),Me=Xe({},["title","style","font","a","script"]),Oe=Xe({},tt);Xe(Oe,nt),Xe(Oe,ot);let Te=Xe({},at);Xe(Te,rt);let Le=function(e){let t=v(e);(!t||!t.tagName)&&(t={namespaceURI:_e,tagName:"template"});let n=ze(e.tagName),o=ze(t.tagName);return!!ve[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===fe?"svg"===n:t.namespaceURI===he?"svg"===n&&("annotation-xml"===o||Ne[o]):!!Oe[n]:e.namespaceURI===he?t.namespaceURI===fe?"math"===n:t.namespaceURI===ge?"math"===n&&Ae[o]:!!Te[n]:e.namespaceURI===fe?!(t.namespaceURI===ge&&!Ae[o]||t.namespaceURI===he&&!Ne[o])&&(!Te[n]&&(Me[n]||!Oe[n])):!("application/xhtml+xml"!==C||!ve[e.namespaceURI]))},De=function(e){Fe(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch{e.remove()}},Ie=function(e,t){try{Fe(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{Fe(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!U[e])if(J||ee)try{De(t)}catch{}else try{t.setAttribute(e,"")}catch{}},Pe=function(e){let t,n;if(Y)e=""+e;else{let t=He(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===C&&_e===fe&&(e=''+e+"");let o=y?y.createHTML(e):e;if(_e===fe)try{t=(new m).parseFromString(o,C)}catch{}if(!t||!t.documentElement){t=k.createDocument(_e,"template",null);try{t.documentElement.innerHTML=be?w:o}catch{}}let a=t.body||t.documentElement;return e&&n&&a.insertBefore(r.createTextNode(n),a.childNodes[0]||null),_e===fe?x.call(t,Q?"html":"body")[0]:Q?t.documentElement:a},je=function(e){return E.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Qe=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},ut=function(e){return"object"==typeof l?e instanceof l:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},pt=function(e,t,o){N[e]&&Be(N[e],(e=>{e.call(n,t,o,Ee)}))},mt=function(e){let t;if(pt("beforeSanitizeElements",e,null),Qe(e))return De(e),!0;let o=A(e.nodeName);if(pt("uponSanitizeElement",e,{tagName:o,allowedTags:j}),e.hasChildNodes()&&!ut(e.firstElementChild)&&(!ut(e.content)||!ut(e.content.firstElementChild))&&Ze(/<[/\w]/g,e.innerHTML)&&Ze(/<[/\w]/g,e.textContent))return De(e),!0;if(!j[o]||q[o]){if(!q[o]&>(o)&&(z.tagNameCheck instanceof RegExp&&Ze(z.tagNameCheck,o)||z.tagNameCheck instanceof Function&&z.tagNameCheck(o)))return!1;if(re&&!le[o]){let t=v(e)||e.parentNode,n=b(e)||e.childNodes;if(n&&t){for(let o=n.length-1;o>=0;--o)t.insertBefore(f(n[o],!0),_(e))}}return De(e),!0}return e instanceof c&&!Le(e)||("noscript"===o||"noembed"===o)&&Ze(/<\/no(script|embed)/i,e.innerHTML)?(De(e),!0):(V&&3===e.nodeType&&(t=e.textContent,t=Ge(t,M," "),t=Ge(t,O," "),t=Ge(t,T," "),e.textContent!==t&&(Fe(n.removed,{element:e.cloneNode()}),e.textContent=t)),pt("afterSanitizeElements",e,null),!1)},ht=function(e,t,n){if(ne&&("id"===t||"name"===t)&&(n in r||n in $e))return!1;if((!W||H[t]||!Ze(R,t))&&(!G||!Ze(L,t)))if(!U[t]||H[t]){if(!(gt(e)&&(z.tagNameCheck instanceof RegExp&&Ze(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&Ze(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t))||"is"===t&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&Ze(z.tagNameCheck,n)||z.tagNameCheck instanceof Function&&z.tagNameCheck(n))))return!1}else if(!pe[t]&&!Ze(P,Ge(n,I,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==We(n,"data:")||!de[e])&&(!K||Ze(D,Ge(n,I,"")))&&n)return!1;return!0},gt=function(e){return e.indexOf("-")>0},_t=function(e){let t,o,a,r;pt("beforeSanitizeAttributes",e,null);let{attributes:i}=e;if(!i)return;let s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U};for(r=i.length;r--;){t=i[r];let{name:l,namespaceURI:c}=t;if(o="value"===l?t.value:Ke(t.value),a=A(l),s.attrName=a,s.attrValue=o,s.keepAttr=!0,s.forceKeepAttr=void 0,pt("uponSanitizeAttribute",e,s),o=s.attrValue,s.forceKeepAttr||(Ie(l,e),!s.keepAttr))continue;if(!Z&&Ze(/\/>/i,o)){Ie(l,e);continue}V&&(o=Ge(o,M," "),o=Ge(o,O," "),o=Ge(o,T," "));let d=A(e.nodeName);if(ht(d,a,o)){if(oe&&("id"===a||"name"===a)&&(Ie(l,e),o=ae+o),y&&"object"==typeof h&&"function"==typeof h.getAttributeType&&!c)switch(h.getAttributeType(d,a)){case"TrustedHTML":o=y.createHTML(o);break;case"TrustedScriptURL":o=y.createScriptURL(o)}try{c?e.setAttributeNS(c,l,o):e.setAttribute(l,o),Ue(n.removed)}catch{}}}pt("afterSanitizeAttributes",e,null)},bt=function e(t){let n,o=je(t);for(pt("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)pt("uponSanitizeShadowNode",n,null),!mt(n)&&(n.content instanceof i&&e(n.content),_t(n));pt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t,a,r,s,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(be=!e,be&&(e="\x3c!--\x3e"),"string"!=typeof e&&!ut(e)){if("function"!=typeof e.toString)throw Ve("toString is not a function");if("string"!=typeof(e=e.toString()))throw Ve("dirty is not a string, aborting")}if(!n.isSupported)return e;if(X||Se(c),n.removed=[],"string"==typeof e&&(ie=!1),ie){if(e.nodeName){let t=A(e.nodeName);if(!j[t]||q[t])throw Ve("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)t=Pe("\x3c!----\x3e"),a=t.ownerDocument.importNode(e,!0),1===a.nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?t=a:t.appendChild(a);else{if(!J&&!V&&!Q&&-1===e.indexOf("<"))return y&&te?y.createHTML(e):e;if(t=Pe(e),!t)return J?null:te?w:""}t&&Y&&De(t.firstChild);let d=je(ie?e:t);for(;r=d.nextNode();)mt(r)||(r.content instanceof i&&bt(r.content),_t(r));if(ie)return e;if(J){if(ee)for(s=$.call(t.ownerDocument);t.firstChild;)s.appendChild(t.firstChild);else s=t;return(U.shadowroot||U.shadowrootmod)&&(s=S.call(o,s,!0)),s}let u=Q?t.outerHTML:t.innerHTML;return Q&&j["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&Ze(vt,t.ownerDocument.doctype.name)&&(u="\n"+u),V&&(u=Ge(u,M," "),u=Ge(u,O," "),u=Ge(u,T," ")),y&&te?y.createHTML(u):u},n.setConfig=function(e){Se(e),X=!0},n.clearConfig=function(){Ee=null,X=!1},n.isValidAttribute=function(e,t,n){Ee||Se({});let o=A(e),a=A(t);return ht(o,a,n)},n.addHook=function(e,t){"function"==typeof t&&(N[e]=N[e]||[],Fe(N[e],t))},n.removeHook=function(e){if(N[e])return Ue(N[e])},n.removeHooks=function(e){N[e]&&(N[e]=[])},n.removeAllHooks=function(){N={}},n}(),$t=Et,xt=(ve=r("aN0pg"),i=r("cNaMA"),AnsiUp=window.AnsiUp);i=r("cNaMA");const St=({value:e})=>{const t=i.useRef(null),n=i.useRef(Date.now());return i.useEffect((()=>{if(!t.current)return;t.current.style.cssText=`--animation-delay: -${(Date.now()-n.current)%1e3}ms`,t.current.innerHTML=(new xt).ansi_to_html(e).replaceAll("◐",'');const o=t.current.parentElement;o&&(o.scrollTop=1e5)}),[t.current,e]),e?i.html`
`:null};ce=r("9Ta4i"),i=r("cNaMA"),ve=r("aN0pg"),i=r("cNaMA");var Nt=r("fUfdR");ve=r("aN0pg");let Ct=({focus_on_open:e,desired_doc_query:t,on_update_doc_query:n,notebook:o,sanitize_html:a=!0})=>{let r=i.useContext(ye),s=i.useRef(null),[l,c]=i.useState({shown_query:null,searched_query:null,body:'

Welcome to the Live docs! Keep this little window open while you work on the notebook, and you will get documentation of everything you type!

You can also type a query above.


Still stuck? Here are some tips.

',loading:!1}),d=e=>c(le((t=>e(t))));i.useEffect((()=>{l.loading||(null==t||/[^\s]/.test(t))&&l.searched_query!==t&&u(t)}),[t,l.loading,l.searched_query]),i.useLayoutEffect((()=>{e&&s.current&&(s.current.focus({preventScroll:!0}),s.current.select())}),[e]);let u=e=>{d((t=>{t.loading=!0,t.searched_query=e})),Promise.race([Nt.default.Promises.delay(2e3,!1),r.send("docs",{query:e.replace(/^\?/,"")},{notebook_id:o.notebook_id}).then((t=>"⌛"!==t.message.status&&("👍"===t.message.status?(d((n=>{n.shown_query=e,n.body=t.message.doc})),!0):void 0)))]).then((()=>{d((e=>{e.loading=!1}))}))},p=i.useMemo((()=>i.html`<${Tl} body=${Mt(l.body)} sanitize_html=${a} sanitize_html_message=${!1} />`),[l.body,a]),m=!1===l.loading&&""!==l.searched_query&&l.searched_query!==l.shown_query;return i.html` +
+ n(e.target.value)} + value=${t} + type="search" + > + +
+
null!=e&&At(e,n)}> +

${l.shown_query}

+ ${p} +
+ `};const At=(e,t)=>{for(let t of e.querySelectorAll("code:not([class])"))Rl(t,"julia");for(let n of e.querySelectorAll("a")){const e=n.getAttribute("href");if(null!=e&&e.startsWith("@ref")){const o=e.length>4?e.substr(5):n.textContent;n.onclick=e=>{t(o),e.preventDefault()}}}},Mt=e=>e.replace(/Main\.var"workspace\#\d+"\./g,"").replace(/Main\.workspace\#\d+\./g,"").replace(/ in Main\.var"workspace\#\d+"/g,"").replace(/ in Main\.workspace\#\d+/g,"").replace(/#==#[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\:\d+/g,"");i=r("cNaMA"),ve=r("aN0pg"),ce=r("9Ta4i"),i=r("cNaMA");r("kjWx8");var Ot=r("1gqBQ");const Tt=({runtime:e,running:t,queued:n,code_differs:o,on_run:a,on_interrupt:r,set_cell_disabled:s,depends_on_disabled_cells:l,running_disabled:c,on_jump:d})=>{const u=a,p=Lt(t),m=null==p?null:1e6*p,h=(i.useContext(ye),t||n?"interrupt":c?"save":l&&!o?"jump":"run"),g={on_interrupt:r,on_save:u,on_jump:d,on_run:a};return i.html` + + + ${Rt(t?m??e:e)} + + `},Rt=e=>{if(null==e)return"---";let t=e;const n=["n","μ","m",""];let o=0;for(;o=1e3;)o+=1,t/=1e3;return t.toFixed(e<100||t>=100?0:1)+" "+n[o]+"s"},Lt=e=>{const[t,n]=i.useState(0),[o,a]=i.useState(0);return i.useEffect((()=>{let t;if(e){const e=+new Date;a(e),n(e),t=setInterval((()=>n(+new Date)),50)}return()=>{t&&clearInterval(t)}}),[e]),e?t-o:void 0},Dt=(e,t=5)=>{const[n,o]=i.useState(e),a=i.useMemo((()=>ce.default.debounce(o,1e3*t)),[o]);return i.useEffect((()=>(e?(o(!0),a.cancel()):a(!1),()=>{})),[e]),n};ve=r("aN0pg"),i=r("cNaMA");const It=({total:e,done:t,busy:n,failed_indices:o})=>(e=Math.max(1,e),i.html` +
=8&&e<48,big:e>=48})} + data-total=${e} + > + ${[...Array(e)].map(((e,a)=>i.html`
=t&&a
`))} +
+ `);i=r("cNaMA"),ve=r("aN0pg"),Ot=r("1gqBQ");let Pt=({status:e})=>{const t=Object.values(e.subtasks).every(Wt),[n,o]=i.useState(!1);i.useEffect((()=>{if(n&&t){console.log("all done");let t=null,n=setTimeout((()=>{o(!1);let n=Vt(e);t=new Notification("Pluto: notebook ready",{tag:"notebook ready",body:`✓ All ${n} steps completed`,lang:"en-US",dir:"ltr",icon:Jc}),t.onclick=e=>{parent.focus(),window.focus(),null==t||t.close()}}),3e3);const a=()=>{"visible"===document.visibilityState&&(null==t||t.close())};return document.addEventListener("visibilitychange",a),document.body.addEventListener("click",a),()=>{null==t||t.close(),clearTimeout(n),document.removeEventListener("visibilitychange",a),document.body.removeEventListener("click",a)}}}),[t]);const a=ln(!t,2500)||n;return i.html` +
+ +
+ `};const jt=({status:e,notebook:t,backend_launch_logs:n,my_clock_is_ahead_by:o})=>i.html` +
+ <${qt} + status_tree=${e} + path=${[]} + my_clock_is_ahead_by=${o} + nbpkg=${t.nbpkg} + backend_launch_logs=${n} + /> + <${Pt} status=${e} /> +
+ `,Bt="\nworkspace\n\ncreate_process\ninit_process\n\n\npkg\n\nanalysis\nwaiting_for_others\nresolve\nremove\nadd\ninstantiate\ninstantiate1\ninstantiate2\ninstantiate3\nprecompile\n\nrun\n\n\nsaving\n\n".split("\n").map((e=>e.trim())).filter((e=>e.length>0)),Ut=["saving"],Ft={workspace:"Workspace setup",create_process:"Start Julia",init_process:"Initialize",pkg:"Package management",instantiate1:"instantiate",instantiate2:"instantiate",instantiate3:"instantiate",run:"Evaluating cells",evaluate:"Running code",registry_update:"Updating package registry",waiting_for_others:"Waiting for other notebooks to finish package operations",backend_launch:"Connecting to backend",backend_requesting:"Requesting a worker",backend_created:"Starting Pluto server",backend_responded:"Opening notebook file",backend_notebook_running:"Switching to live editing"},zt=e=>1e9*e,qt=({status_tree:e,path:t,my_clock_is_ahead_by:n,nbpkg:o,backend_launch_logs:a})=>{var r;if(null==e)return null;const s=t.reduce(((e,t)=>e.subtasks[t]),e);if(!s)return null;const[l,c]=i.useState(t.length<1),d=t.length>0&&Kt(s),u=d&&Wt(s),p=d&&!u,m=s.started_at??0,h=s.finished_at??0,g=(Lt(p)??0)/1e3,f=Date.now()/1e3,_=Math.max(g,f-m-("local"===s.timing?0:n));i.useEffect((()=>{if(p||!1===s.success){let e=setTimeout((()=>{c(!0)}),Math.max(100,500-200*t.length));return()=>clearTimeout(e)}}),[p||!1===s.success]),Yt((([e])=>{if(!e&&u){let e=setTimeout((()=>{c(!1)}),1800-200*t.length);return()=>clearTimeout(e)}}),[u]);const b=l?Object.values(s.subtasks).every((e=>Ht(e.name)))&&Object.values(s.subtasks).length>0?(()=>{let e=Object.values(s.subtasks),t=e.reduce(((e,t)=>e+(Wt(t)?1:0)),0),n=e.reduce(((e,t)=>e+(Zt(t)?1:0)),0),o=e.length,a=e.reduce(((e,t,n)=>!1===t.success?[...e,n]:e),[]);return i.html`<${It} busy=${n} done=${t} total=${o} failed_indices=${a} />`})():Object.entries(s.subtasks).sort(((e,t)=>Gt(e[1],t[1]))).map((([r,s])=>Ut.includes(r)?null:i.html`<${qt} + key=${r} + status_tree=${e} + my_clock_is_ahead_by=${n} + path=${[...t,r]} + nbpkg=${o} + backend_launch_logs=${a} + />`)):null;let v=null;if(d){let e=Qt(s),t=Vt(s);e>1&&(v=i.html`${" "}(${t}/${e})`)}const y=Object.values(s.subtasks).length>0;return 0===t.length?b:i.html` +
{c(!l)}} + > + + ${(e=>{const t=Ft[e];return null!=t?t:Ht(e)?`Step ${e}`:e})(s.name)}${v} + ${u?Rt(zt(h-m)):p?Rt(zt(_)):null} +
+ ${b} + ${l&&"pkg"===s.name?i.html`<${St} value=${null==o||null===(r=o.terminal_outputs)||void 0===r?void 0:r.nbpkg_sync} />`:l&&"backend_launch"===s.name?i.html`<${St} value=${a} />`:void 0} +
`},Ht=e=>/^\d+$/.test(e),Gt=(e,t)=>{const n=Bt.indexOf(e.name),o=Bt.indexOf(t.name);if(-1===n&&-1===o)return null!=e.started_at||null!=t.started_at?(e.started_at??1/0)-(t.started_at??1/0):Ht(e.name)&&Ht(t.name)?parseInt(e.name)-parseInt(t.name):e.name.localeCompare(t.name);{let e=e=>-1===e?1/0:e;return e(n)-e(o)}},Wt=e=>null!=e.finished_at,Kt=e=>null!=e.started_at,Zt=e=>Kt(e)&&!Wt(e),Vt=e=>Object.values(e.subtasks).reduce(((e,t)=>e+Vt(t)),Wt(e)?1:0),Qt=e=>Object.values(e.subtasks).reduce(((e,t)=>e+Qt(t)),1),Xt=(e,t,n,o={})=>({name:e,subtasks:o,timing:"local",started_at:i.useMemo((()=>t||n?Date.now()/1e3:null),[t||n]),finished_at:i.useMemo((()=>n?Date.now()/1e3:null),[n])}),Yt=(e,t)=>{const n=i.useRef(t);i.useEffect((()=>{let o=e(n.current);return n.current=t,o}),t)};i=r("cNaMA");de=r("4zMEb");var Jt=r("41Mhf");const en={wait_for_user:0,requesting:.4,created:.6,responded:.7,notebook_running:.9,ready:1},tn=e=>e.endsWith("/")?e:e+"/",nn=e=>fetch(`https://stats.plutojl.org/count?p=/${e}&s=${screen.width},${screen.height},${devicePixelRatio}#skip_sw`,{cache:"no-cache"}).catch((()=>{})),on=async({setStatePromise:e,connect:t,launch_params:n})=>{try{nn("binder-start"),await e(le((e=>{e.backend_launch_phase=en.requesting,e.disable_ui=!1,e.notebook.status_tree=null})));const{binder_session_url:o,binder_session_token:a}=await((e,{on_log:t})=>new Promise(((n,o)=>{console.log("Starting binder connection to",e);try{let a=new EventSource(e);a.onerror=t=>{console.error("Binder error: Lost connection to "+e,t),a.close(),o(t)};let r=null,i="",s=e=>{console.log("Binder: ",e,` at ${(new Date).toLocaleTimeString()}`),i=`${i}${e}\n`,t(i)};a.onmessage=t=>{let i=JSON.parse(t.data);switch(i.phase&&i.phase!==r&&(r=i.phase.toLowerCase(),s(`\n\n⏱️ Binder subphase: ${r}\n`)),i.message&&s(i.message.replace("] ","]\n")),i.phase){case"failed":console.error("Binder error: Failed to build",e,i),a.close(),o(new Error(i));break;case"ready":a.close(),n({binder_session_url:tn(i.url)+"pluto/",binder_session_token:i.token})}}}catch(e){console.error(e),o("Failed to open event source the mybinder.org. This probably means that the URL is invalid.")}})))(n.binder_url.replace("mybinder.org/v2/","mybinder.org/build/"),{on_log:t=>e(le((e=>{e.backend_launch_logs=t})))}),r=e=>Jt.with_query_params(e,{token:a});console.log("Binder URL:",r(o)),window.shutdown_binder=()=>{fetch(r(new URL("../api/shutdown",o)),{method:"POST"})},await e(le((e=>{e.backend_launch_phase=en.created,e.binder_session_url=o,e.binder_session_token=a}))),await fetch(r(o)),await e(le((e=>{e.backend_launch_phase=en.responded})));let i=async()=>{const e=r(Jt.with_query_params(new URL("notebookupload",o),{name:new URLSearchParams(window.location.search).get("name"),execution_allowed:"true"}));return console.log("downloading locally and uploading ",e,n.notebookfile),fetch(e,{method:"POST",body:await(await fetch(new Request(n.notebookfile,{integrity:n.notebookfile_integrity}))).arrayBuffer()})},s=async(e,t)=>{const n=Jt.with_query_params(new URL("open",o),{[e]:t,execution_allowed:"true"});return console.log(`open ${e}:`,n),fetch(r(n),{method:"POST"})},l=(e,t)=>()=>s(e,t),c=n.notebookfile.startsWith("data:")?[i]:[l("path",n.notebookfile),l("url",new URL(n.notebookfile,window.location.href).href),i],d=new Response;for(let e of c)if(d=await e(),d.ok)break;if(!d.ok){let e=await d.blob();return void(window.location.href=URL.createObjectURL(e))}const u=await d.text(),p=r(Jt.with_query_params(new URL("edit",o),{id:u}));console.info("notebook_id:",u),await e(le((e=>{e.notebook.notebook_id=u,e.backend_launch_phase=en.notebook_running,e.refresh_target=p}))),console.log("Connecting WebSocket");const m=t(r(new URL("channels",de.ws_address_from_base(o))));await de.timeout_promise(m,2e4).catch((e=>{console.error("Failed to establish connection within 20 seconds. Navigating to the edit URL directly.",e),window.parent.location.href=p}))}catch(e){console.error("Failed to initialize binder!",e),alert("Something went wrong! 😮\n\nWe failed to initialize the binder connection. Please try again with a different browser, or come back later.")}};var an=r("hrGZZ");const rn=e=>window.dispatchEvent(new CustomEvent("open_bottom_right_panel",{detail:e}));let sn=({desired_doc_query:e,on_update_doc_query:t,notebook:n,connected:o,backend_launch_phase:a,backend_launch_logs:r,sanitize_html:s=!0})=>{let l=i.useRef();const c=i.useRef(!1),[d,u]=i.useState(null),p=null==d;an.useEventListener(window,"open_bottom_right_panel",(e=>{console.log(e.detail),c.current=!1,u(e.detail),"none"===window.getComputedStyle(l.current).display&&alert("This browser window is too small to show docs.\n\nMake the window bigger, or try zooming out.")}),[u]);const m=cn(n,a),[h,g]=i.useMemo((()=>null==m?[0,0]:[Qt(m)-1,Vt(m)-(Wt(m)?1:0)]),[m]),f=g{let t=i.useContext(ye);const[n,o]=i.useState(0);return i.useEffect((()=>{if(e){let e=async()=>{let e=()=>t.send("current_time").then((e=>e.message.time)),n=()=>Date.now()/1e3;for(let t=0;t<16;t++)await e();let a=await n(),r=await e(),i=await e(),s=(a+await n())/2-(r+i)/2;isNaN(s)||o(s)};e();let n=setInterval(e,6e4);return()=>clearInterval(n)}}),[e]),n})({connected:o});return i.html` + + `};const ln=(e,t)=>{const[n,o]=i.useState(!1);return i.useEffect((()=>{if(e){let e=setTimeout((()=>{o(!0)}),t);return()=>clearTimeout(e)}o(!1)}),[e]),n},cn=(e,t)=>{var n;const o=dn(t);return null==t?e.status_tree:{name:"notebook",started_at:0,finished_at:null,subtasks:{...null===(n=e.status_tree)||void 0===n?void 0:n.subtasks,backend_launch:o}}},dn=e=>{let t=e??-1;const n=Object.fromEntries(["requesting","created","responded","notebook_running"].map((e=>{let n=en[e],o=`backend_${e}`;return[o,Xt(o,t>=n,t>n)]})));return Xt("backend_launch",null!=e&&e>en.wait_for_user,e===en.ready,n)},un=e=>{const t=e.indexOf("#==#");return-1!=t?e.substring(t+4,t+4+36):null},pn=(e,t)=>window.dispatchEvent(new CustomEvent("cell_focus",{detail:{cell_id:e,line:t}})),mn=({frame:e})=>{var t,n;let o=i.useContext(ye);if(un(e.file))return null;if(null==e.parent_module)return null;if(fn(e))return null;const a=e.func;if(""===a)return null;const r=o.get_notebook(),s=e.source_package,l=["Main","Core","Base"].includes(s),c=null!=(null==r||null===(t=r.nbpkg)||void 0===t||null===(n=t.installed_versions)||void 0===n?void 0:n[e.source_package]);return l||null==(null==r?void 0:r.nbpkg)||c?i.html`  {t.preventDefault(),rn("docs"),o.set_doc_query(`${e.parent_module}.${a}`)}} + >docs`:null},hn=({frame:e,cell_id:t})=>{if(_n(e))return null;const n=un(e.file);if(null!=n)return i.html`{pn(n,e.line-1),t.preventDefault()}} + > + ${n==t?"This cell":"Other cell"}: line ${e.line} + `;{var o,a;const t=e.source_package,n=["Main","Core","Base"].includes(t)?"julia":t,r=i.html`${e.file}:${e.line}`,s=null!=t?i.html`${n} → ${r}`:r,l=(null==e||null===(o=e.url)||void 0===o||null===(a=o.startsWith)||void 0===a?void 0:a.call(o,"https"))?e.url:null;return i.html`${s}`}},gn=i.html` from `,fn=e=>"top-level scope"===e.call,_n=e=>"none"===e.file,bn=e=>{const t=e.indexOf(")(");if(-1!=t)return[e.substring(0,t+1),e.substring(t+1)];{const t=e.indexOf("(");return-1!=t?[e.substring(0,t),e.substring(t)]:[e,""]}},vn=({frame:e})=>{let[t,n]=i.useState(!1);i.useEffect((()=>{n(!1)}),[e]);const o=(e.call_short.match(/…/g)??"").length<=1&&e.call.lengthanonymous function`:l;console.log(l,l.match(/^#\d+(#\d+)?$/),c);let d=i.html`${c}<${kn} code=${s[1]} />`;const u=i.useMemo((()=>Math.random().toString(36).substring(7)),[e]);return i.html`${d} ${a?null:i.html`{e.preventDefault(),n(!0)}} + >...show types...`}`},yn=({frame:e,num_context_lines:t=2})=>{let n=i.useContext(ye),o=un(e.file);if(o){var a,r;let s=null===(r=null===(a=n.get_notebook())||void 0===a?void 0:a.cell_inputs[o])||void 0===r?void 0:r.code;if(s){const n=s.split("\n");return i.html`{pn(o,e.line-1),t.preventDefault()}} + href=${`#${o}`} + class="frame-line-preview" + >
+
+${n.map(((n,o)=>e.line-1-t<=o&&o<=e.line-1+t?i.html`<${wn} code=${n} i=${o} frameLine=${o===e.line-1} />`:null))}
+
`}}},wn=({code:e,frameLine:t,i:n})=>{const o=i.useRef(null);return i.useLayoutEffect((()=>{o.current&&(o.current.innerText=e,delete o.current.dataset.highlighted,Rl(o.current,"julia"))}),[o.current,e]),i.html``},kn=({code:e})=>{const t=i.useRef(null);return i.useLayoutEffect((()=>{if(t.current){const n=e.replaceAll(/([^():{},; ]*)::/g,"$1::");t.current.innerHTML=n}}),[t.current,e]),i.html``},En=e=>e.flatMap(((t,n)=>n===e.length-1?[t]:n===e.length-2?[t," and "]:[t,", "])),$n=({cell_id:e,diagnostics:t})=>(i.useEffect((()=>(window.dispatchEvent(new CustomEvent("cell_diagnostics",{detail:{cell_id:e,diagnostics:t}})),()=>window.dispatchEvent(new CustomEvent("cell_diagnostics",{detail:{cell_id:e,diagnostics:[]}})))),[t]),i.html` + +

Syntax error

+
+
Syntax errors
+
    + ${t.map((({message:t,from:n,to:o,line:a})=>i.html`
  1. window.dispatchEvent(new CustomEvent("cell_highlight_range",{detail:{cell_id:e,from:n,to:o}}))} + onmouseleave=${()=>window.dispatchEvent(new CustomEvent("cell_highlight_range",{detail:{cell_id:e,from:null,to:null}}))} + > +
    + ${t} +
    ${gn}<${hn} frame=${{file:"#==#"+e,line:a}} cell_id=${e} />
    +
    +
  2. `))} +
+
+
+ `),xn=(e,t,n,o)=>{if(null!=o)return!0;const[a,r]=bn(e.call);return!["_collect","collect_similar","iterate","error","macro expansion"].includes(a)&&(!a.includes("throw")&&(!e.inlined&&(null!=r&&!((a.match(/#/g)??"").length>=2))))},Sn=({value:e})=>{const t=i.useRef(null);i.useEffect((()=>{t.current&&(t.current.innerHTML=(new xt).ansi_to_html(e))}),[t.current,e]);const n=e.replace(/\u001b\[[0-9;]*m/g,"");return""===e?i.html`


`:i.html`

${n}

`},Nn=({msg:e,stacktrace:t,cell_id:n})=>{var o;let a=i.useContext(ye);const r={pattern:/.?/,display:e=>ce.default.dropRightWhile(e.split("\n"),(e=>""===e)).map((e=>i.html`<${Sn} value=${e} />`))},s=[{pattern:/syntax: extra token after end of expression/,display:e=>{const t=i.html`{e.preventDefault(),a.wrap_remote_cell(n,"begin")}} + >Wrap all code in a begin ... end block.`;if(e.includes("\n\nBoundaries: ")){const o=JSON.parse(e.split("\n\nBoundaries: ")[1]).map((e=>e-1)),r=i.html`

+ {e.preventDefault(),a.split_remote_cell(n,o,!0)}} + >Split this cell into ${o.length} cells, or +

`;return i.html`

Multiple expressions in one cell.

+

How would you like to fix it?

+
    +
  • ${r}
  • +
  • ${t}
  • +
`}return i.html`

Multiple expressions in one cell.

+

${t}

`},show_stacktrace:()=>!1},{pattern:/LoadError: cannot assign a value to variable workspace#\d+\..+ from module workspace#\d+/,display:()=>i.html`

Tried to reevaluate an include call, this is not supported. You might need to restart this notebook from the main menu.

+

+ For a workaround, use the alternative version of include described here: + GH issue 115 +

+

In the future, include will be deprecated, and this will be the default.

`},{pattern:/MethodError: no method matching .*\nClosest candidates are:/,display:e=>e.split("\n").map((e=>i.html`

${e}

`))},{pattern:/Cyclic references among (.*)\./,display:e=>e.split("\n").map((e=>{const t=e.match(/Cyclic references among (.*)\./);if(t){let e=t[1].split(/, | and /).map((e=>i.html`${e}`));return i.html`

Cyclic references among${" "}${En(e)}.

`}return i.html`

${e}

`}))},{pattern:/Multiple definitions for (.*)\./,display:e=>e.split("\n").map((e=>{const t=e.match(/Multiple definitions for (.*)\./);if(t){let e=t[1].split(/, | and /).map((e=>i.html`{const o=document.querySelector(`pluto-cell:not([id='${n}']) span[id='${encodeURI(e)}']`);t.preventDefault(),null==o||o.scrollIntoView()}}>${e}`));return i.html`

Multiple definitions for${" "}${En(e)}.

`}return i.html`

${e}

`}))},{pattern:/^syntax: (.*)$/,display:r.display,show_stacktrace:()=>!1},{pattern:/^\s*$/,display:()=>r.display("Error")},{pattern:/^UndefVarError: (.*) not defined/,display:e=>{const t=a.get_notebook(),o=On(t,n),r=e.match(/UndefVarError: (.*) not defined/);let s=((null==r?void 0:r[1])??"").replaceAll("`","");const l=Object.values((null==t?void 0:t.cell_dependencies)??{}).some((e=>Object.keys(e.downstream_cells_map).includes(s)));if(0===Object.keys(o).length||!l)return i.html`

${e}

`;const c=Object.keys(o).map((e=>i.html`{t.preventDefault();const n=document.querySelector(`pluto-cell[id='${o[e]}']`);null==n||n.scrollIntoView()}}>${e}`));return i.html`

Another cell defining ${En(c)} contains errors.

`},show_stacktrace:()=>{const e=On(a.get_notebook(),n);return 0===Object.keys(e).length}},{pattern:/^ArgumentError: Package (.*) not found in current path/,display:e=>{var t,n,o;const r=e.match(/^ArgumentError: Package (.*) not found in current path/),s=((null==r?void 0:r[1])??"").replaceAll("`",""),l=null===(t=a.get_notebook())||void 0===t||null===(n=t.nbpkg)||void 0===n||null===(o=n.terminal_outputs)||void 0===o?void 0:o[s];return i.html`

The package ${s}.jl could not load because it failed to initialize.

+

That's not nice! Things you could try:

+
    +
  • Restart the notebook.
  • +
  • Try a different Julia version.
  • +
  • Contact the developers of ${s}.jl about this error.
  • +
+

You might find useful information in the package installation log:

+ <${St} value=${l} />`},show_stacktrace:()=>!1},r],l=s.find((({pattern:t})=>t.test(e)))??r,[c,d]=i.useState(!1);i.useEffect((()=>{d(!1)}),[e,t,n]);const u=t.findIndex((e=>null!=un(e.file))),p=!c&&-1!=u&&u!(_n(e)&&fn(e)))),h=Cn(m);return i.html` +
+ Error message${null==h?null:` from ${h}`} + +
+ +
${l.display(e)}
+ ${0!=t.length&&((null===(o=l.show_stacktrace)||void 0===o?void 0:o.call(l))??1)?i.html`
+
+ Stack trace +

Here is what happened, the most recent locations are first:

+
+ +
    + ${m.map(((e,t)=>{const o=un(e.file),a=null!=o,r=n===o,s=xn(e,0,0,o);return i.html`
  1. +
    + <${vn} frame=${e} /> +
    + ${gn}<${hn} frame=${e} cell_id=${n} /> + <${mn} frame=${e} /> +
    +
    + ${a?i.html`<${yn} frame=${e} num_context_lines=${r?1:2} />`:null} +
  2. `}))} + ${p?i.html`
  3. + {d(!0),e.preventDefault()}} + >Show more... +
  4. `:null} +
+
`:null} + <${Mn} stacktrace=${t} /> +
`},Cn=e=>{for(let[t,n]of e.entries()){const e=un(n.file);if(e)return;if(xn(n,0,0,e)&&n.source_package)return n.source_package}},An=["Don't panic!","Keep calm, you got this!","You got this!","Silly computer!","Silly computer!","beep boop CRASH 🤖","computer bad, you GREAT!","Probably not your fault!","Try asking on Julia Discourse!","uhmmmmmm??!","Maybe time for a break? ☕️","Everything is going to be okay!","Computers are hard!","C'est la vie !","¯\\_(ツ)_/¯","Oh no! 🙀","this suckz 💣","Be patient :)",...Array(100).fill(null)],Mn=({stacktrace:e})=>{const t=i.useMemo((()=>An[Math.floor(Math.random()*An.length)]),[e]);return null==t?null:i.html`
{var t;null===(t=window.open("https://discourse.julialang.org/","_blank"))||void 0===t||t.focus()}} + > + ${t} +
`},On=(e,t,n=[])=>{var o;let a={};if(null!=e&&(null==e||null===(r=e.cell_results)||void 0===r||null===(o=r[t])||void 0===o?void 0:o.errored)){var r;Object.keys(null===(r=e.cell_dependencies[t])||void 0===r?void 0:r.upstream_cells_map).forEach((o=>{if(!n.includes(o)){var r;n.push(o);(null===(r=e.cell_dependencies[t])||void 0===r?void 0:r.upstream_cells_map[o]).forEach((r=>{let i=On(e,r,n)??{};a={...a,...i},0===Object.keys(i).length&&e.cell_results[r].errored&&r!==t&&(a[o]=r)}))}}))}return a};i=r("cNaMA"),an=r("hrGZZ");const Tn=({mime:e,body:t,cell_id:n,persist_js_state:o,sanitize_html:a=!0})=>{switch(e){case"image/png":case"image/jpg":case"image/jpeg":case"image/gif":case"image/bmp":case"image/svg+xml":return i.html`<${El} mime=${e} body=${t} />`;case"text/plain":return i.html`
${t}
`;case"application/vnd.pluto.tree+object":return i.html`<${Pn} cell_id=${n} body=${t} persist_js_state=${o} sanitize_html=${a} />`;default:return $l({mime:e,body:t,cell_id:n,persist_js_state:o,sanitize_html:a,last_run_timestamp:null})}},Rn=({on_click_more:e})=>{const[t,n]=i.useState(!1),o=i.useRef(null);return Ln(o),i.html`{t||!1!==e()&&n(!0)}} + >more`},Ln=e=>{an.useEventListener(e,"keydown",(t=>{" "===t.key&&t.preventDefault(),"Enter"===t.key&&(t.preventDefault(),e.current.click())}),[]),an.useEventListener(e,"keyup",(t=>{" "===t.key&&(t.preventDefault(),e.current.click())}),[])},Dn=({prefix:e,prefix_short:t})=>{const n=i.useRef(null);return Ln(n),i.html`${e}${t}`},In=({pluto_actions:e,cell_id:t,node_ref:n,objectid:o,dim:a})=>{(e??n.current.closest("pluto-cell")._internal_pluto_actions).reshow_cell(t??n.current.closest("pluto-cell").id,o,a)},Pn=({mime:e,body:t,cell_id:n,persist_js_state:o,sanitize_html:a=!0})=>{let r=i.useContext(ye);const s=i.useRef(null),l=e=>i.html`<${Tn} cell_id=${n} mime=${e[1]} body=${e[0]} persist_js_state=${o} sanitize_html=${a} />`,c=i.html`<${Rn} on_click_more=${()=>{if(null==s.current||null!=s.current.closest("pluto-tree.collapsed"))return!1;In({pluto_actions:r,cell_id:n,node_ref:s,objectid:t.objectid,dim:1})}} />`;let d=null;switch(t.type){case"Pair":const e=t.key_value;return i.html`${l(e[0])}${l(e[1])}`;case"circular":return i.html`circular reference`;case"Array":case"Set":case"Tuple":d=i.html`<${Dn} prefix=${t.prefix} prefix_short=${t.prefix_short} />${t.elements.map((e=>"more"===e?c:i.html`${"Set"===t.type?"":i.html`${e[0]}`}${l(e[1])}`))}`;break;case"Dict":d=i.html`<${Dn} prefix=${t.prefix} prefix_short=${t.prefix_short} />${t.elements.map((e=>"more"===e?c:i.html`${l(e[0])}${l(e[1])}`))}`;break;case"NamedTuple":d=i.html`<${Dn} prefix=${t.prefix} prefix_short=${t.prefix_short} />${t.elements.map((e=>"more"===e?c:i.html`${e[0]}${l(e[1])}`))}`;break;case"struct":d=i.html`<${Dn} prefix=${t.prefix} prefix_short=${t.prefix_short} />${t.elements.map((e=>i.html`${e[0]}${l(e[1])}`))}`}return i.html``},jn=({colspan:e=999})=>i.html` + + +
(This table has no columns)
+ + +`,Bn=({colspan:e=999})=>i.html` + +
+
+ (This table has no rows) +
+ +`,Un=({mime:e,body:t,cell_id:n,persist_js_state:o,sanitize_html:a})=>{var r,s,l,c,d;let u=i.useContext(ye);const p=i.useRef(null),m=e=>i.html`<${Rn} + on_click_more=${()=>{In({pluto_actions:u,cell_id:n,node_ref:p,objectid:t.objectid,dim:e})}} + />`,h=3+((null==t||null===(r=t.schema)||void 0===r||null===(s=r.names)||void 0===s?void 0:s.length)??1),g=0===((null==t||null===(l=t.schema)||void 0===l||null===(c=l.names)||void 0===c?void 0:c.length)??0)?i.html`<${jn} colspan=${h} />`:i.html` + + ${["",...t.schema.names].map((e=>i.html`${"more"===e?m(2):e}`))} + + + ${["",...t.schema.types].map((e=>i.html`${"more"===e?null:e}`))} + + `,f=i.html` + ${0!==((null===(d=t.rows)||void 0===d?void 0:d.length)??0)?t.rows.map((e=>i.html` + ${"more"===e?i.html`${m(1)}`:i.html`${e[0]} + ${e[1].map((e=>{return i.html`
${"more"===e?null:(t=e,i.html`<${Tn} cell_id=${n} mime=${t[1]} body=${t[0]} persist_js_state=${o} sanitize_html=${a} />`)}
`;var t}))}`} + `)):i.html`<${Bn} colspan=${h} />`} + `;return i.html` + ${g}${f} +
`};Ot=r("1gqBQ"),ce=r("9Ta4i"),i=r("cNaMA"),Nt=r("fUfdR");function Fn(e){if(!(e instanceof HTMLInputElement))return e instanceof HTMLSelectElement&&e.multiple?Array.from(e.selectedOptions,(e=>e.value)):e.value;switch(e.type){case"range":case"number":return e.valueAsNumber;case"date":return e.valueAsDate;case"checkbox":return e.checked;case"file":var t;return e.multiple?e.files:null===(t=e.files)||void 0===t?void 0:t[0];default:return e.value}}function zn(e){switch(e.type){case"button":case"submit":case"checkbox":return"click";case"file":return"change";default:return"input"}}const qn=(e,t)=>{if(!(e instanceof HTMLInputElement&&"file"===e.type))if(null!=t){if(e instanceof HTMLInputElement)switch(e.type){case"range":case"number":return void(e.valueAsNumber!==t&&(e.valueAsNumber=t));case"date":return void(null!=e.valueAsDate&&Number(e.valueAsDate)===Number(t)||(e.valueAsDate=t));case"checkbox":return void(e.checked!==t&&(e.checked=t));case"file":return}else if(e instanceof HTMLSelectElement&&e.multiple){for(let n of Array.from(e.options))n.selected=t.includes(n.value);return}e.value!==t&&(e.value=t)}else e.value=t},Hn=(e,t)=>{e.forEach((e=>{let n=e.getAttribute("def");if(null!=n&&null!=e.firstElementChild&&null!=t[n]){let o=t[n].value;try{qn(e.firstElementChild,o)}catch(t){console.error("Error while setting input value",e.firstElementChild,"to value",o,": ",t)}}}))},Gn=(e,t,n,o)=>{let a=!1;o.then((()=>{a=!0})),e.forEach((async e=>{const o=e.getAttribute("def"),r=e.firstElementChild;if(null!=o&&null!=r){var i;const e=Fn(r);const s=Object.keys(n).includes(o)&&ce.default.isEqual(null===(i=n[o])||void 0===i?void 0:i.value,e)?null:t(o,e).catch(console.error);let l=!1;for(let e of function(e){return Nt.default.Generators.observe((function(t){var n=zn(e),o=Fn(e);function a(){t(Fn(e))}return e.addEventListener(n,a),void 0!==o&&t(o),function(){e.removeEventListener(n,a)}}))}(r)){if(a)break;if(!1===l){l=!0;continue}const n=await Wn(await e);await s,await t(o,n).catch(console.error)}}}))},Wn=async e=>e instanceof FileList?Promise.all(Array.from(e).map((e=>Wn(e)))):e instanceof File?await new Promise((t=>{const n=new FileReader;n.onload=()=>t({name:e.name,type:e.type,data:new Uint8Array(n.result)}),n.onerror=()=>t({name:e.name,type:e.type,data:null}),n.readAsArrayBuffer(e)})):e;ve=r("aN0pg"),Nt=r("fUfdR");var Kn=r("h2NGW"),Zn=r("hiQgq"),Vn=(i=r("cNaMA"),ce=r("9Ta4i"),r("2P6PH"));Zn=r("hiQgq"),Zn=r("hiQgq");r("9Ta4i");Zn=r("hiQgq"),ce=r("9Ta4i");var Qn={};t(Qn),e(Qn,"default",(()=>Xn.default));var Xn={};e(Xn,"default",(()=>fo),(e=>fo=e));var Yn,Jn,eo=Object.create,to=Object.defineProperty,no=Object.getOwnPropertyDescriptor,oo=Object.getOwnPropertyNames,ao=Object.getPrototypeOf,ro=Object.prototype.hasOwnProperty,io=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of oo(t))!ro.call(e,a)&&a!==n&&to(e,a,{get:()=>t[a],enumerable:!(o=no(t,a))||o.enumerable});return e},so=(e,t,n)=>(n=null!=e?eo(ao(e)):{},io(!t&&e&&e.__esModule?n:to(n,"default",{value:e,enumerable:!0}),e)),lo=(Yn=(e,t)=>{var n=Symbol("baseMap"),o=class{constructor(e){this.value=e}};function a(e){if(!Array.isArray(e))throw new TypeError("The keys parameter must be an array")}function r({[n]:e},t,o){for(let n of t){if(!e.has(n)){if(!o)return;e.set(n,new WeakMap)}e=e.get(n)}return e}t.exports=class extends WeakMap{constructor(){super(),this[n]=new WeakMap;let[e]=arguments;if(null!=e){if("function"!=typeof e[Symbol.iterator])throw new TypeError(typeof e+" is not iterable (cannot read property Symbol(Symbol.iterator))");for(let[t,n]of e)this.set(t,n)}}set(e,t){return a(e),r(this,e,!0).set(o,t),this}get(e){a(e);let t=r(this,e);return t?t.get(o):void 0}has(e){a(e);let t=r(this,e);return!!t&&t.has(o)}delete(e){a(e);let t=r(this,e);return!!t&&t.delete(o)}get[Symbol.toStringTag](){return"ManyKeysWeakMap"}}},()=>(Jn||Yn((Jn={exports:{}}).exports,Jn),Jn.exports)),co={};((e,t)=>{for(var n in t)to(e,n,{get:t[n],enumerable:!0})})(co,{default:()=>fo});var uo=so(lo());((e,t,n)=>{io(e,t,"default"),n&&io(n,t,"default")})(co,so(lo()));var po,mo,{default:ho,...go}=uo,fo=void 0!==ho?ho:go;po=Qn,mo=Xn,Object.keys(mo).forEach((function(e){"default"===e||"__esModule"===e||po.hasOwnProperty(e)||Object.defineProperty(po,e,{enumerable:!0,get:function(){return mo[e]}})}));let _o=e=>Zn.julia_andrey().language.parser.parse(e).topNode.firstChild;let bo=(e,t=(e=>e),n=new Map)=>(...o)=>{let a=t(...o),r=n.get(a);if(null!=r)return r;{let t=e(...o);if(null==t)throw new Error("Memoized function returned undefined");return n.set(a,t),t}},vo=(e,t=((...e)=>e))=>bo(e,t,new Xn.default),yo=e=>bo(e,(e=>e),new WeakMap),wo=function*(e){if(e.firstChild())try{do{yield e}while(e.nextSibling())}finally{e.parent()}},ko=function*(e){if(e.firstChild){let t=e.firstChild;do{yield t}while(t=t.nextSibling)}},Eo=(e,t,n,o=!1)=>{if(o){console.group("Current haystack:",e?e.node.name:null),console.groupCollapsed("Details");try{console.log("template:",t),console.log("haystack_cursor:",e?e.node.toString():null),"node"in t?(console.log("template.node:",t.node),console.log("template.node.toString():",t.node.toString())):"pattern"in t&&console.log("template.pattern:",t.pattern)}finally{console.groupEnd()}}try{if("pattern"in t){let a=t.pattern;if("function"!=typeof a)throw new Error(`Unknown pattern "${a}"`);let r={};o&&(r={...n},console.groupCollapsed(`Matching against pattern: ${t.pattern.name}()`));let i=null;try{i=a(e,n,o)}finally{o&&console.groupEnd()}if(o)if(i){if(console.log("✅ because the pattern was happy! All hail the pattern!"),!ce.default.isEqual(n,r)){let e=ce.default.omit(n,Object.keys(r));console.log(" WE EVEN GOT NEW MATCHES SAY WHAAAAAAT:",e)}}else console.log("❌ because... well, you should ask the pattern that!");return i}if(!("node"in t))throw console.log("template:",t),new Error("waaaah");{let{node:a,children:r}=t;if(o&&console.log(`Matching against node: ${t.node.name}`),!e)return"end"===a.name?(o&&console.log("✅ No node left to match, but it was the end anyway"),!0):(o&&console.log("❌ because no cursor left to match against"),!1);if(e.type.isError)return o&&console.log("✅ because ⚠"),!0;if(e.name!==a.name)return o&&console.log(`❌ because name mismatch "${e.name}" !== "${a.name}"`),!1;if(!e.firstChild()){if(0!==t.children.length){o&&console.log("Haystack node is empty, but template has children... lets see");for(let e of t.children)if(!Eo(null,e,n,o))return o&&console.log("❌ because child template wasn't okay with having no children",e),!1;return o&&console.log("✅ All template children we're fine with having no children to check on"),!0}return o&&console.log("✅ Template also has no children, yayyy"),!0}try{let a=!1;for(let t of r){if(a){if(o&&console.log("Haystack is empty, but there are more children in template... lets see"),!Eo(null,t,n,o))return o&&console.log("❌ template child did not accept null for an answer",t,e.toString()),!1;o&&console.log("👌🏽 This template child was fine with null");continue}for(;("Comment"===e.name||"BlockComment"===e.name)&&e.nextSibling(););if(!Eo(e,t,n,o))return o&&console.log("❌ because a child mismatch",t,e.toString()),!1;a=!e.nextSibling()}if(o&&!a){let n=[];do{n.push(e.node)}while(e.nextSibling());for(let t of n)e.prevSibling();console.warn("We did match all the children of the template, but there are more in the haystack... Might want to actually not match this?",n,t)}return o&&console.log("✅ because all children match"),!0}finally{e.parent()}}}finally{o&&console.groupEnd()}};class $o{constructor(e,t){let n=[],o=[];n.push(e[0]);for(let[a,r]of ce.default.zip(e.slice(1),t))if(r instanceof $o){n[n.length-1]+=r.template[0];for(let[e,t]of ce.default.zip(r.template.slice(1),r.substitutions))o.push(t),n.push(e);n[n.length-1]+=a}else o.push(r),n.push(a);this.template=n,this.substitutions=o}}let xo=(e,t)=>{for(let n of t)if(e.from===n.from&&e.to===n.to){n.used=!0;let t=n.generator.next({name:e.name,from:e.from,to:e.to,node:e});if(t.done)return t.value;throw new Error("Template generator not done providing ast node")}return{name:e.name,from:e.from,to:e.to,children:Array.from(ko(e)).map((e=>xo(e,t))),node:e}},So=function*(e){try{if(e instanceof $o){let t="",n=[];for(let[o,a]of ce.default.zip(e.template,e.substitutions))if(t+=o,a){let e=So(a),o=Bo(e.next());n.push({from:t.length,to:t.length+o.length,generator:e}),t+=o}let o=yield t,a=n.map((e=>({from:e.from+o.from,to:e.to+o.from,generator:e.generator,used:!1})));false;let r=xo(o.node,a),i=a.filter((e=>!e.used)).map((e=>({text:t.slice(e.from,e.to),from:e.from,to:e.to})));if(i.length>0)throw new Error(`Some substitutions not applied, this means it couldn't be matched to a AST position: ${JSON.stringify(i)}`);return r}if("function"==typeof e)return yield*e();throw console.log("julia_code_object:",e),new Error("Unknown substition type")}finally{}},No=vo(((e,...t)=>new $o(e,t))),Co=new WeakMap,Ao=(e,...t)=>{let n=Co.get(e);if(null!=n){let{input:e,result:t}=n;return t}{let n=new $o(e,t);return Co.set(e,{input:t,result:n}),n}},Mo=yo((e=>{let t=So(e),n=Bo(t.next()),o=_o(n),a=Uo(t.next({from:0,to:n.length,name:o.name,node:o}));return{template_description:a,match(e,t=!1){if("node"in a&&a.node.name!==e.name)return;if(e.type.isError)return null;"cursor"in e&&(e=e.cursor());let n={};t&&console.groupCollapsed(`Starting a match at ${e.name}`);try{return Eo(e,a,n,t)?n:null}finally{t&&console.groupEnd()}}}})),Oo=yo((e=>{let t=So(e),n=Bo(t.next());return t.return(),n})),To=(yo((e=>_o(Oo(e)))),yo((e=>Zn.Text.of([Oo(e)]))),e=>{let t={},n=bo((n=>yo((o=>e(n,o===t?void 0:o)))));return(e,o=t)=>n(e)(o)});function*Ro(){return yield"expression",{pattern:function(e,t,n=!1){return e?!e.type.is("keyword")||(n&&console.log("❌ Keywords are not allowed!"),!1):(n&&console.log("❌ I want anything!! YOU GIVE ME NULL???"),!1)}}}const Lo={any:Ro,many:To(((e,t=Ro)=>function*(){let n=So(t),o=yield Bo(n.next()),a=null,r=null;return o.node.firstChild&&o.node.from===o.node.firstChild.from&&o.node.to===o.node.firstChild.to?(a=o.node,r=Uo(n.next({...o,node:o.node.firstChild}))):r=Uo(n.next(o)),{narrowed_node:a,sub_template:r,pattern:function(t,n,o=!1){if(!t)return o&&console.log("✅ Nothing to see here... I'm fine with that - many"),!0;if(a){if(t.name!==a.name)return o&&console.log("❌ Tried to go in, but she wasn't my type - many"),t.prevSibling(),!0;t.firstChild()}try{let i=[];for(;;){if(t.type.isError)return t.prevSibling(),o&&console.log("✋ I don't do errors - many"),!0;let e={};if(!Eo(t,r,e,o)){t.prevSibling();break}if(i.push({node:t.node,match:e}),!t.nextSibling())break}return null!=e&&(n[e]=i),!0}finally{a&&t.parent()}}}})),maybe:yo((e=>function*(){let t=yield*So(e);return{sub_template:t,pattern:function(e,n,o=!1){if(!e)return!0;if(e.type.isError)return!0;return!1===Eo(e,t,n,o)&&e.prevSibling(),!0}}})),anything_that_fits:yo((e=>function*(){return yield*So(e),{pattern:function(e,t,n=!1){return!0}}})),something_with_the_same_type_as:yo((e=>function*(){let t=So(e),n=Bo(t.next()),o=yield n;return t.return(),{pattern:function(e,t,n=!1){return null!=e&&o.name===e.name}}})),as:To(((e,t=Ro)=>function*(){let n=yield*So(t);return{sub_template:n,pattern:function(t,o,a=!1){let r=Eo(t,n,o,a);return!0===r&&(o[e]=null==t?void 0:t.node),null!=t&&r}}})),Identifier:function*(){return yield"identifier",{pattern:function(e,t,n=!1){return null!=e&&"Identifier"===Po(e)}}},Number:function*(){return yield"69",{pattern:function(e,t,n=!1){return null!=e&&"Number"===Po(e)}}},String:function*(){return yield'"A113"',{pattern:function(e,t,n=!1){return null!=e&&("StringWithoutInterpolation"===Po(e)||"TripleStringWithoutInterpolation"===Po(e))}}}};let Do=vo(((e,t)=>{let n=So(e),o=Bo(n.next()),a=_o(o),r=null;if(r=t.match(a)){let{content:e}=r,t=[];for(;e.firstChild&&e.firstChild.from==e.from&&e.firstChild.to==e.to;)t.push(e.type),e=e.firstChild;if(null==e)throw console.log("match:",r),new Error("No content match?");let o=Uo(n.next({name:e.name,node:e,from:a.from,to:a.to}));return{possible_parents:t,template_description:o,match(e,n=!1){if(e.type.isError)return n&&console.log(`❌ Short circuiting because haystack(${e.name}) is an error`),!1;"cursor"in e&&(e=e.cursor());let a=0;for(let o of t){if(e.type!==o)break;{let t=e.from,r=e.to;if(e.firstChild()){if(e.from!==t||e.to!==r){e.parent(),n&&console.log(`❌ Was matching possible parent (${o}), but it wasn't filling?! That's weird.... ${e.toString()}`);for(let t=0;te.firstChild&&e.firstChild.from===e.from&&e.firstChild.to===e.to?Io(e.firstChild):e,Po=e=>{let t=e.from,n=e.to;if(e.firstChild())try{if(e.from===t&&e.to===n)return Po(e)}finally{e.parent()}return e.name},jo=e=>t=>{let n=Mo(e(Lo.as("content",t)));return Do(e(t),n)};let Bo=e=>{if(e.done)throw new Error("Expected `yield`-d value, but got `return`");return e.value},Uo=e=>{if(e.done)return e.value;throw new Error("Expected `yield`-d value, but got `return`")},Fo=(e,t)=>{if(e===t)return e;let n=[...e.usages,...t.usages],o=new Map(e.definitions);for(let[e,n]of t.definitions)o.set(e,n);return{usages:n,definitions:o,locals:[...e.locals,...t.locals]}},zo=function*(e){for(let t of wo(e))if("InterpolationExpression"===t.name)yield e;else if("QuoteExpression"===t.name||"QuoteStatement"===t.name)for(let e of zo(t))yield*zo(e);else yield*zo(t)},qo=e=>{let t=jo(e);return function(e,n=!1){return null==e?(e,...n)=>t(Ao(e,...n)):function(o,...a){return t(Ao(o,...a)).match(e,n)}}},Ho=qo((e=>No`[i for i in i ${e}]`)),Go=qo((e=>No`${e} = nothing`)),Wo=qo((e=>No`function f(${e}) end`)),Ko=qo((e=>No`f(${e})`)),Zo=qo((e=>No`f(; ${e})`)),Vo=(e,t,n,o=!1)=>{let a=null;if(a=Ko(e)`; ${Lo.many("named_args")}`){let{named_args:e=[]}=a;for(let{node:a}of e)n=Vo(a,t,n,o);return n}if(a=Wo(e)`${Lo.Identifier}`)return aa(n,t,e);if(a=Wo(e)`${Lo.as("subject")}...`)return Qo(a.subject,t,n,null,o);if(a=Wo(e)`${Lo.as("name")} = ${Lo.as("value")}`){let{name:e,value:r}=a;return n=Qo(e,t,n,r.to,o),n=ra(r.cursor(),t,n,o)}if((a=Wo(e)`${Lo.as("name")}::${Lo.as("type")}`)??(a=Wo(e)`${Lo.as("name")}:`)??(a=Wo(e)`::${Lo.as("type")}`)){let{name:e,type:r}=a;return e&&(n=Qo(e,t,n,r.to,o)),r&&(n=ra(r.cursor(),t,n,o)),n}return n=Qo(e,t,n),o&&console.warn("UNKNOWN FUNCTION DEFINITION ARGUMENT:",e.toString()),n},Qo=(e,t,n,o=null,a=!1)=>{let r=null;a&&console.group("Explorering pattern:",e.toString());try{if(r=Go(e)`${Lo.Identifier}`)return a&&console.log("It's an identifier, adding it to the scope"),aa(n,t,e,o);if(r=Go(e)`${Lo.as("object")}::${Lo.as("type")}`){let{object:e,type:o}=r;return n=ra(o.cursor(),t,n,a),n=aa(n,t,e)}if(r=Go(e)`${Lo.as("subject")}...`)return Qo(r.subject,t,n,o,a);if(r=Wo(e)`${Lo.as("name")} = ${Lo.as("value")}`){let{name:e,value:o}=r;return n=Qo(e,t,n,o.from,a),n=ra(o.cursor(),t,n,a)}if(r=Go(e)`(; ${Lo.many("named_tuples")})`){let{named_tuples:e}=r;for(let r of e)n=Qo(r.node.cursor(),t,n,o,a);return n}if((r=Go(e)`${Lo.as("first")}, ${Lo.many("rest")}`)??(r=Go(e)`(${Lo.as("first")}, ${Lo.many("rest")})`)){for(let{node:e}of[{node:r.first},...r.rest??[]])n=Qo(e.cursor(),t,n,o,a);return n}if(r=Yo(e)`${Lo.as("prefix")}${Lo.as("string",Lo.String)}`){let{prefix:o,string:i}=r;if("var"===t.sliceString(o.from,o.to)){let o=t.sliceString(i.from+1,i.to-1);0!==o.length&&n.definitions.set(o,{from:e.from,to:e.to,valid_from:e.to})}else n=ra("cursor"in e?e.cursor():e,t,n,a);return n}if(r=Go(e)`${Lo.as("object")}[${Lo.as("property")}]`){let{object:e,property:o}=r;return n=ra(e.cursor(),t,n,a),o&&(n=ra(o.cursor(),t,n,a)),n}if(r=Go(e)`${Lo.as("object")}.${Lo.as("property")}`){let{object:e,property:o}=r;return n=ra(e.cursor(),t,n,a)}return a&&console.warn("UNKNOWN PATTERN:",e.toString(),t.sliceString(e.from,e.to)),n}finally{a&&console.groupEnd()}},Xo=function(e,t,n,o=!1){let a=null;if("Definition"!==e.name||!e.firstChild()){if("Identifier"===e.name)return{inner:aa(n,t,e),outer:aa(ta(),t,e)};if(a=Yo(e)`${Lo.as("subject")}{ ${Lo.many("parameters")} }`){let{subject:e,parameters:o}=a,r=ta();if(e){let o=Xo(e.cursor(),t,n);r=o.outer,n=o.inner}for(let{node:e}of o){let{inner:o}=Xo(e.cursor(),t,n);n=o}return{inner:n,outer:r}}if(a=Yo(e)`${Lo.as("subject")} <: ${Lo.maybe(Lo.as("type"))}`){let{subject:e,type:o}=a,r=ta();return e&&({outer:r,inner:n}=Xo(e.cursor(),t,n)),o&&(n=ra(o.cursor(),t,n)),{inner:n,outer:r}}return o&&console.warn(`Unknown thing in definition: "${t.sliceString(e.from,e.to)}", "${e.toString()}"`),{inner:n,outer:ta()}}try{return Xo(e,t,n)}finally{e.parent()}},Yo=(Jo=Mo,function(e,t=!1){return null==e?(e,...t)=>Jo(Ao(e,...t)):function(n,...o){return Jo(Ao(n,...o)).match(e,t)}});var Jo;let ea=(e,t,n,o=!1)=>{let a=null,r=qo((e=>No`${e} x y z`));if(a=r(e)`${Lo.as("macro",Ao`@${Lo.any}`)}`){let{macro:e}=a,o=t.sliceString(e.from,e.to);return n.usages.push({usage:e,definition:n.definitions.get(o)??null,name:o}),n}if(a=r(e)`${Lo.as("object")}.@${Lo.as("macro")}`){let{object:e}=a,o=t.sliceString(e.from,e.to);return n.usages.push({usage:e,definition:n.definitions.get(o)??null,name:o}),n}if(a=r(e)`@${Lo.as("object")}.${Lo.as("macro")}`){let{object:e}=a,o=t.sliceString(e.from,e.to);return n.usages.push({usage:e,definition:n.definitions.get(o)??null,name:o}),n}return o&&console.warn("Mwep mweeeep",e.toString()),n},ta=()=>({usages:[],definitions:new Map,locals:[]}),na=e=>({usages:[],definitions:new Map(e.definitions),locals:[]}),oa=(e,t,n)=>({usages:[...t.usages,...e.usages],definitions:t.definitions,locals:[]}),aa=(e,t,n,o=null)=>(o=null===o?n.to:o,e.definitions.set(t.sliceString(n.from,n.to),{from:n.from,to:n.to,valid_from:o}),e),ra=(e,t,n={usages:[],definitions:new Map,locals:[]},o=!1)=>{"cursor"in e&&(e=e.cursor());let a=null;if(o){console.group(`Explorer: ${e.name}`),console.groupCollapsed("Details");try{console.log(`Full tree: ${e.toString()}`),console.log("Full text:",t.sliceString(e.from,e.to)),console.log("scopestate:",n)}finally{console.groupEnd()}a=e.node}try{let a=null;if(e.type.is("keyword")||"SourceFile"===e.name||"BooleanLiteral"===e.name||"Character"===e.name||"String"===e.name||"Number"===e.name||"Comment"===e.name||"BinaryExpression"===e.name||"Operator"===e.name||"MacroArgumentList"===e.name||"ReturnStatement"===e.name||"BareTupleExpression"===e.name||"ParenthesizedExpression"===e.name||"Type"===e.name||"InterpolationExpression"===e.name||"SpreadExpression"===e.name||"CompoundExpression"===e.name||"ParameterizedIdentifier"===e.name||"TypeArgumentList"===e.name||"TernaryExpression"===e.name||"Coefficient"===e.name||"TripleString"===e.name||"RangeExpression"===e.name||"SubscriptExpression"===e.name||"UnaryExpression"===e.name||"ConstStatement"===e.name||"GlobalStatement"===e.name||"ContinueStatement"===e.name||"MatrixExpression"===e.name||"MatrixRow"===e.name||"ArrayExpression"===e.name){for(let a of wo(e))n=ra(a,t,n,o);return n}if("Identifier"===e.name||"MacroIdentifier"===e.name){let o=t.sliceString(e.from,e.to);return n.usages.push({name:o,usage:{from:e.from,to:e.to},definition:n.definitions.get(o)??null}),n}if(a=Yo(e)`:${Lo.any}`)return n;if(a=Yo(e)`${Lo.Number}`)return n;if(a=Yo(e)`${Lo.String}`)return n;if(a=Yo(e)`${Lo.as("object")}.${Lo.as("property")}`){let{object:e,property:r}=a;return e&&(n=ra(e.cursor(),t,n,o)),n}if(a=Yo(e)`${Lo.as("assignee")} = ${Lo.maybe(Lo.as("value"))}`){let{assignee:e,value:r}=a;return r&&(n=ra(r.cursor(),t,n,o)),e&&(n=Qo(e.cursor(),t,n,(null==r?void 0:r.to)??null,o)),n}if(a=Yo(e)` + ${Lo.as("macro",Lo.anything_that_fits(Ao`@macro`))}(${Lo.many("args")}) ${Lo.maybe(Ao`do ${Lo.maybe(Lo.many("do_args"))} + ${Lo.many("do_expressions")} + end`)}} + `){let{macro:r,args:i=[],do_args:s,do_expressions:l}=a;r&&ea(r.cursor(),t,n,o);for(let{node:e}of i)if(a=Ko(e)`${Lo.as("name")} = ${Lo.as("value")}`){let{name:e,value:r}=a;r&&(n=ra(r.cursor(),t,n,o))}else n=ra(e.cursor(),t,n,o);if(s&&l){let a=na(n),r=s.firstChild;if("Identifier"===(null==r?void 0:r.name))a=aa(a,t,r);else if("ArgumentList"===(null==r?void 0:r.name))for(let e of ko(r))a=Vo(e,t,a);else if("BareTupleExpression"===(null==r?void 0:r.name))for(let e of ko(r))a=Vo(e,t,a);else o&&console.warn("Unrecognized do args",r.toString());for(let{node:e}of l)a=ra(e.cursor(),t,a,o);return oa(a,n,e.to)}return n}if(a=Yo(e)`${Lo.as("macro",Lo.anything_that_fits(Ao`@macro`))} ${Lo.many("args")}`){let{macro:e,args:r=[]}=a;e&&ea(e.cursor(),t,n,o);for(let{node:e}of r)n=ra(e.cursor(),t,n,o);return n}if((a=Yo(e)` + struct ${Lo.as("defined_as")} + ${Lo.many("expressions")} + end + `)??(a=Yo(e)` + mutable struct ${Lo.as("defined_as")} + ${Lo.many("expressions")} + end + `)){let{defined_as:r,expressions:i=[]}=a;r=Io(r);let s=na(n),l=ta();r&&({inner:s,outer:l}=Xo(r.cursor(),t,s));for(let{node:n}of i)if("Identifier"===e.name);else if(a=Yo(n)`${Lo.as("subject")}::${Lo.as("type")}`){let{subject:e,type:n}=a;s=ra(n.cursor(),t,s,o)}else if(a=Yo(n)`${Lo.as("assignee")} = ${Lo.as("value")}`){let{assignee:e,value:n}=a;if(a=Yo(e)`${Lo.as("subject")}::${Lo.as("type")}`){let{subject:e,type:n}=a;s=ra(n.cursor(),t,s,o)}s=ra(n.cursor(),t,s,o)}return n=oa(s,n,e.to),n=Fo(n,l)}if(a=Yo(e)`abstract type ${Lo.as("name")} end`){let{name:e}=a;if(e){let{outer:o}=Xo(e.cursor(),t,n);n=Fo(n,o)}return n}if((a=Yo(e)`quote ${Lo.many("body")} end`)??(a=Yo(e)`:(${Lo.many("body")})`)){for(let a of function*(e){if("QuoteExpression"!==e.name&&"QuoteStatement"!==e.name)throw new Error("Expected QuotedExpression or QuoteStatement");yield*zo(e)}(e))n=ra(a,t,n,o);return n}if(a=Yo(e)` + module ${Lo.as("name")} + ${Lo.many("expressions")} + end + `){let{name:e,expressions:o=[]}=a;e&&(n=aa(n,t,e));let r=ta();for(let{node:e}of o)r=ra(e.cursor(),t,r);n=Fo(n,{usages:Array.from(r.usages).filter((e=>null!=e.definition)),definitions:new Map,locals:[]});for(let{node:e}of o)n=ra(e.cursor(),t,n);return n}if(a=Yo(e)`${Lo.as("prefix")}${Lo.as("string",Lo.String)}`){let{prefix:o,string:r}=a,i=t.sliceString(o.from,o.to);if("var"===i){let o=t.sliceString(r.from+1,r.to-1);return 0!==o.length&&n.usages.push({name:o,usage:{from:e.from,to:e.to},definition:n.definitions.get(o)??null}),n}{let e=`@${i}_str`;n.usages.push({name:e,usage:{from:o.from,to:o.to},definition:n.definitions.get(e)??null})}return n}if(a=Yo(e)`${Lo.Number}${Lo.as("unit")}`)return ra(a.unit.cursor(),t,n,o);if((a=Yo(e)`import ${Lo.any}: ${Lo.many("specifiers")}`)??(a=Yo(e)`using ${Lo.any}: ${Lo.many("specifiers")}`)){let{specifiers:e=[]}=a,r=qo((e=>No`import X: ${e}`));for(let{node:i}of e)if(a=r(i)`${Lo.as("name")} as ${Lo.as("alias")}`){let{alias:e}=a;n=aa(n,t,e)}else if(a=r(i)`${Lo.as("name",Lo.Identifier)}`){let{name:e}=a;n=aa(n,t,e)}else(a=r(i)`@${Lo.any}`)?n=aa(n,t,i):o&&console.warn("Hmmmm, I don't know what to do with this selected import specifier:",i.toString());return n}if(a=Yo(e)`import ${Lo.many("specifiers")}`){let{specifiers:e=[]}=a,r=qo((e=>No`import ${e}`));for(let{node:i}of e)if(a=r(i)`${Lo.any} as ${Lo.as("alias")}`){let{alias:e}=a;n=aa(n,t,e)}else if(a=r(i)`${Lo.as("package")}.${Lo.as("name",Lo.Identifier)}`)n=aa(n,t,a.name);else if(a=r(i)`.${Lo.as("scoped")}`){let e=null;for(;e=r(a.scoped)`.${Lo.as("scoped")}`;)a=e;n=aa(n,t,a.scoped)}else(a=r(i)`${Lo.as("name",Lo.Identifier)}`)?n=aa(n,t,a.name):o&&console.warn("Hmmm, I don't know what to do with this import specifier:",i);return n}if(a=Yo(e)`using ${Lo.many()}`)return n;if(a=Yo(e)` + for ${Lo.many("bindings",Lo.something_with_the_same_type_as(Ao`x in y`))}; + ${Lo.many("expressions")} + end + `){let r=jo((e=>No`for ${e}; x end`)),i=e=>(...t)=>r(Ao(...t)).match(e),{bindings:s,expressions:l}=a,c=na(n);for(let{node:e}of s){let n=null;if((n=i(e)`${Lo.as("name")} in ${Lo.as("range")}`)??(n=i(e)`${Lo.as("name")} ∈ ${Lo.as("range")}`)??(n=i(e)`${Lo.as("name")} = ${Lo.as("range")}`)){let{name:e,range:a}=n;a&&(c=ra(a.cursor(),t,c,o)),e&&(c=Qo(e,t,c,(null==a?void 0:a.to)??null,o))}else o&&console.warn("Unrecognized for loop binding",e.toString())}for(let{node:e}of l)c=ra(e.cursor(),t,c,o);return oa(c,n,e.to)}if((a=Yo(e)` + ${Lo.as("callee")}(${Lo.many("args")}) ${Lo.maybe(Ao`do ${Lo.maybe(Lo.many("do_args"))} + ${Lo.many("do_expressions")} + end`)} + `)??(a=Yo(e)` + ${Lo.as("callee")}.(${Lo.many("args")}) + `)){let{callee:r,args:i=[],do_args:s=[],do_expressions:l=[]}=a;n=ra(r.cursor(),t,n,o);for(let{node:a}of i){let r=null;if(r=Ko(a)`; ${Lo.many("named_args")}`){let{named_args:e=[]}=r;for(let{node:a}of e){let e=null;if(e=Zo(a)`${Lo.as("name")} = ${Lo.as("value")}`){let{name:a,value:r}=e;n=ra(r.cursor(),t,n,o)}else n=ra(a.cursor(),t,n,o)}}else if(r=Ko(a)`${Lo.as("name")} = ${Lo.as("value")}`){let{name:e,value:a}=r;a&&(n=ra(a.cursor(),t,n,o))}else{if(r=Ko(a)`${Lo.as("result")} ${Lo.many("clauses",Lo.anything_that_fits(Ao`for x = y`))}`){let{result:a,clauses:i}=r,s=na(n);for(let{node:e}of i){let n=null;if((n=Ho(e)`for ${Lo.as("variable")} = ${Lo.maybe(Lo.as("value"))}`)??(n=Ho(e)`for ${Lo.as("variable")} in ${Lo.maybe(Lo.as("value"))}`)??(n=Ho(e)`for ${Lo.as("variable")} ∈ ${Lo.maybe(Lo.as("value"))}`)??(n=Ho(e)`for ${Lo.as("variable")}`)){let{variable:e,value:a}=n;a&&(s=ra(a.cursor(),t,s,o)),e&&(s=Qo(e,t,s))}else if(n=Ho(e)`if ${Lo.maybe(Lo.as("if"))}`){let{if:e}=n;e&&(s=ra(e.cursor(),t,s,o))}else o&&console.log("Hmmm, can't parse for binding",e)}return s=ra(a.cursor(),t,s,o),oa(s,n,e.to)}n=ra(a.cursor(),t,n,o)}}let c=na(n);for(let{node:e}of s)c=Vo(e,t,c);for(let{node:e}of l)c=ra(e.cursor(),t,c,o);return oa(c,n,e.to)}if(a=Yo(e)`(${Lo.many("tuple_elements")},)`){let{tuple_elements:r=[]}=a,i=qo((e=>No`(${e},)`)),s=r.map((({node:t})=>null!=i(e)`${Lo.Identifier} = ${Lo.any}`));if(s.every((e=>!0===e))||s.every((e=>!1===e)))for(let{node:a}of r){let r=null;if(r=i(e)`${Lo.as("name")} = ${Lo.as("value")}`){let{name:e,value:a}=r;a&&(n=ra(a.cursor(),t,n,o))}else n=ra(a.cursor(),t,n,o)}else for(let{node:a}of r){let r=null;if(r=i(e)`${Lo.as("name")} = ${Lo.as("value")}`){let{name:e,value:a}=r;a&&(n=ra(a.cursor(),t,n,o)),e&&(n=aa(n,t,e,(null==a?void 0:a.to)??null))}else n=ra(a.cursor(),t,n,o)}return n}if((a=Yo(e)`(${Lo.many("args")}) -> ${Lo.many("body")}`)??(a=Yo(e)`${Lo.as("arg")} -> ${Lo.many("body")}`)??(a=Yo(e)`${Lo.as("name")}(${Lo.many("args")})::${Lo.as("return_type")} = ${Lo.many("body")}`)??(a=Yo(e)`${Lo.as("name")}(${Lo.many("args")}) = ${Lo.many("body")}`)??(a=Yo(e)`${Lo.as("name")}(${Lo.many("args")}) = ${Lo.many("body",Lo.anything_that_fits(Ao`x, y`))}`)??(a=Yo(e)` + function ${Lo.as("name")}(${Lo.many("args")})::${Lo.as("return_type")} where ${Lo.as("type_param")} + ${Lo.many("body")} + end + `)??(a=Yo(e)` + function ${Lo.as("name")}(${Lo.many("args")}) where ${Lo.as("type_param")} + ${Lo.many("body")} + end + `)??(a=Yo(e)` + function ${Lo.as("name")}(${Lo.many("args")})::${Lo.as("return_type")} + ${Lo.many("body")} + end + `)??(a=Yo(e)` + function ${Lo.as("name")}(${Lo.many("args")}) + ${Lo.many("body")} + end + `)??(a=Yo(e)` + function ${Lo.as("name",Lo.Identifier)} end + `)??(a=Yo(e)`macro ${Lo.as("macro_name")} end`)??(a=Yo(e)` + macro ${Lo.as("macro_name")}(${Lo.many("args")}) + ${Lo.many("body")} + end + `)){let{name:r,macro_name:i,arg:s,args:l=[],return_type:c,type_param:d,body:u=[]}=a;s&&l.push({node:s}),r?n=aa(n,t,r):i&&n.definitions.set(`@${t.sliceString(i.from,i.to)}`,{from:i.from,to:i.to,valid_from:i.to});let p=na(n);if(d){let e=qo((e=>No`function X() where ${e} end`)),n=qo((e=>No`function X() where {${e}} end`)),a=[{node:d}],r=e(d)`{${Lo.many("type_params")}}`;r&&(a=r.type_params);for(let{node:e}of a){let a=null;if(a=n(e)`${Lo.as("defined",Lo.Identifier)} <: ${Lo.as("parent_type")}`){let{defined:e,parent_type:n}=a;p=ra(n,t,p,o),p=aa(p,t,e)}else if(a=n(e)`${Lo.as("defined",Lo.Identifier)}`){let{defined:e}=a;p=aa(p,t,e)}else o&&console.warn("Can't handle type param:",e)}}c&&(p=ra(Io(c).cursor(),t,p,o));for(let{node:e}of l)p=Vo(e.cursor(),t,p,o);for(let{node:e}of u)p=ra(e.cursor(),t,p,o);return oa(p,n,e.to)}if(a=Yo(e)` + let ${Lo.many("assignments",Ao`${Lo.as("assignee")} = ${Lo.as("value")}`)} + ${Lo.many("body",Lo.any)} + end + `){let{assignments:r=[],body:i=[]}=a,s=na(n);for(let{match:{assignee:e,value:a}}of r)e&&(s=Qo(e,t,s,(null==a?void 0:a.to)??null,o)),a&&(n=ra(a.cursor(),t,n,o));for(let{node:e}of i)s=ra(e.cursor(),t,s,o);return oa(s,n,e.to)}if((a=Yo(e)`[ + ${Lo.as("result")} + ${Lo.many("clauses",Lo.anything_that_fits(Ao`for x = y`))} + ]`)??(a=Yo(e)`(${Lo.as("result")} ${Lo.many("clauses",Lo.anything_that_fits(Ao`for x = y`))})`)){let{result:r,clauses:i}=a,s=na(n);for(let{node:e}of i){let n=null;if((n=Ho(e)`for ${Lo.as("variable")} = ${Lo.maybe(Lo.as("value"))}`)??(n=Ho(e)`for ${Lo.as("variable")} in ${Lo.maybe(Lo.as("value"))}`)??(n=Ho(e)`for ${Lo.as("variable")} ∈ ${Lo.maybe(Lo.as("value"))}`)??(n=Ho(e)`for ${Lo.as("variable")}`)){let{variable:e,value:a}=n;a&&(s=ra(a.cursor(),t,s,o)),e&&(s=Qo(e,t,s))}else if(n=Ho(e)`if ${Lo.maybe(Lo.as("if"))}`){let{if:e}=n;e&&(s=ra(e.cursor(),t,s,o))}else o&&console.warn("Hmmm, can't parse for binding",e)}return s=ra(r.cursor(),t,s,o),oa(s,n,e.to)}o&&(console.groupCollapsed("Cycling through all children of",e.name),console.log("text:",t.sliceString(e.from,e.to)),console.groupEnd());for(let a of wo(e))n=ra(a,t,n,o);return n}finally{o&&console.groupEnd()}},ia=Zn.StateField.define({create(e){try{let t=Zn.syntaxTree(e).cursor();return ra(t,e.doc,void 0)}catch(e){return console.error("Something went wrong while parsing variables...",e),{usages:[],definitions:new Map,locals:[]}}},update(e,t){try{if(Zn.syntaxTree(t.state)!=Zn.syntaxTree(t.startState)){let e=Zn.syntaxTree(t.state).cursor();return ra(e,t.state.doc)}return e}catch(e){return console.error("Something went wrong while parsing variables...",e),{usages:[],definitions:new Map,locals:[]}}}}),sa=e=>"SubscriptExpression"===e.name||"FieldExpression"===e.name?(e.firstChild(),sa(e)):"Identifier"===e.name?(e.firstChild(),e.node):null,la=["Identifier","FieldExpression","SubscriptExpression","MacroFieldExpression","MacroIdentifier","Operator","Definition","ParameterizedIdentifier"],ca=["import","export","try","catch","finally","quote","do","struct","mutable","module","baremodule","if","let"],da=e=>{if(ca.includes(e.name))return!0;if(la.includes(e.name)){if(e.firstChild()){do{if("Number"!==e.name&&"TypeArgumentList"!==e.name&&"FieldName"!==e.name&&"MacroName"!==e.name&&"MacroFieldName"!==e.name&&!da(e))return!1}while(e.nextSibling());return e.parent(),!0}return!0}return!1},ua=(e,t=!1)=>{let n=e.selection.main,o=e.field(ia);if(n.from!==n.to)return e.doc.sliceString(n.from,n.to).trim();{let a=e.doc.lineAt(n.from).text;if("?"===a[0])return a.slice(1);let r=Zn.syntaxTree(e).cursor();t&&console.log("Full tree:",r.toString()),r.moveTo(n.to,-1);let i=0;do{t&&console.group(`Iteration #${i}`);try{if(t&&console.log("cursor",r.toString()),i>100){console.group("Infinite loop while checking docs"),console.log("Selection:",n,e.doc.sliceString(n.from,n.to).trim()),console.log("Current node:",r.name,e.doc.sliceString(r.from,r.to).trim()),console.groupEnd();break}i+=1;let a=r.node.cursor(),s=[];for(;a.parent();)s.push(a.name);let l=r.node.parent;if(null==l)break;t&&console.log("parents:",s);let c=s.indexOf("StructDefinition");if(-1!==c)if(s.includes("AssignmentExpression")&&s.indexOf("AssignmentExpression")=r.to)return e.doc.sliceString(t.from,t.to)}}if("AbstractDefinition"===r.name)return"abstract type";if("CallExpression"===r.name)return r.firstChild(),da(r)?e.doc.sliceString(r.from,r.to):void 0;if(("Operator"===r.name||"⚠"===r.name||"Identifier"===r.name)&&"QuoteExpression"===l.name&&"FieldExpression"===l.parent.name)return e.sliceDoc(l.parent.from,l.parent.to);if("ParameterizedIdentifier"===r.name)return r.firstChild(),da(r)?e.doc.sliceString(r.from,r.to):void 0;if("Identifier"===r.name&&"Prefix"===l.name)continue;if("PrefixedString"===r.name){return r.firstChild(),`${e.doc.sliceString(r.from,r.to)}"`}if("Identifier"===r.name&&"TypedExpression"===l.name)return r.parent(),r.lastChild(),da(r)?e.doc.sliceString(r.from,r.to):void 0;if("TypedExpression"===r.name)return r.lastChild(),da(r)?e.doc.sliceString(r.from,r.to):void 0;if("SpreadExpression"===r.name)return"...";if(l.to===r.to&&la.includes(r.name)&&la.includes(l.name))continue;if("Identifier"===r.name&&"NamedField"===l.name&&l.lastChild.from!=r.from&&l.lastChild.to!=r.to)continue;if("AssignmentExpression"===r.name){let t=r.node.firstChild.to,n=r.node.lastChild.from;return e.doc.sliceString(t,n).trim()}if("ArgumentList"===r.name)continue;if("Identifier"===r.name&&"ArgumentList"===l.name&&("FunctionAssignmentExpression"===l.parent.parent.name||"FunctionDefinition"===l.parent.name))continue;if("Identifier"===r.name&&"Symbol"===l.name)continue;if("FunctionDefinition"===r.name)return r.firstChild(),r.nextSibling(),da(r)?e.doc.sliceString(r.from,r.to):void 0;if("FunctionAssignmentExpression"===r.name)return r.firstChild(),da(r)?e.doc.sliceString(r.from,r.to):void 0;if("Identifier"===r.name&&"MacroIdentifier"===l.name)continue;if("MacroExpression"===r.name)return r.firstChild(),e.doc.sliceString(r.from,r.to);if("BinaryExpression"===r.name){let t=r.node.firstChild.to,n=r.node.lastChild.from;return e.doc.sliceString(t,n).trim()}if("TernaryExpression"===r.name)return"??:";if(la.includes(r.name)||ca.includes(r.name)){if(!da(r))return;let t=sa(r.node.cursor);if(null==t)return e.doc.sliceString(r.from,r.to);let n=o.usages.find((e=>e.usage.from===t.from&&e.usage.to===t.to));if(null==(null==n?void 0:n.definition))return e.doc.sliceString(r.from,r.to)}if("FunctionDefinition"===l.name)return;if("AssignmentExpression"===l.name)return}finally{t&&console.groupEnd()}}while(r.parent())}};Zn=r("hiQgq"),$e=r("kjWx8"),ce=r("9Ta4i");let pa=(e,{scopestate:t,global_definitions:n})=>Zn.Decoration.set(ma(t.usages.map((({definition:e,usage:t,name:o})=>null==e?n[o]?Zn.Decoration.mark({tagName:"a",attributes:{title:`${$e.ctrl_or_cmd_name}-Click to jump to the definition of ${o}.`,"data-pluto-variable":o,href:`#${o}`}}).range(t.from,t.to):null:Zn.Decoration.mark({tagName:"a",attributes:{title:`${$e.ctrl_or_cmd_name}-Click to jump to the definition of ${o}.`,"data-cell-variable":o,"data-cell-variable-from":`${e.from}`,"data-cell-variable-to":`${e.to}`,href:"#"}}).range(t.from,t.to)))),!0);const ma=e=>e.filter((e=>null!=e)),ha=Zn.Facet.define({combine:e=>e[0],compare:ce.default.isEqual}),ga=Zn.ViewPlugin.fromClass(class{constructor(e){let t=e.state.facet(ha);this.decorations=pa(e.state,{scopestate:e.state.field(ia),global_definitions:t})}update(e){let t=e.state.facet(ha);(e.docChanged||e.viewportChanged||t!==e.startState.facet(ha))&&(this.decorations=pa(e.state,{scopestate:e.state.field(ia),global_definitions:t}))}},{decorations:e=>e.decorations,eventHandlers:{click:(e,t)=>{if(e.target instanceof Element){let o=e.target.closest("[data-pluto-variable]");if(o){var n;let a=o.getAttribute("data-pluto-variable");if(null==a)return!1;if(!$e.has_ctrl_or_cmd_pressed(e)&&!t.state.readOnly)return!1;e.preventDefault();let r=`[id='${encodeURI(a)}']`;null===(n=document.querySelector(r))||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"});let i=t.state.facet(ha);if(i[a])return window.dispatchEvent(new CustomEvent("cell_focus",{detail:{cell_id:i[a],line:0,definition_of:a}})),!0}let a=e.target.closest("[data-cell-variable]");if(a){let n=a.getAttribute("data-cell-variable"),o=Number(a.getAttribute("data-cell-variable-from")),r=Number(a.getAttribute("data-cell-variable-to"));return null!=n&&null!=o&&null!=r&&(!(!$e.has_ctrl_or_cmd_pressed(e)&&!t.state.readOnly)&&(e.preventDefault(),t.dispatch({scrollIntoView:!0,selection:{anchor:o,head:r}}),t.focus(),!0))}}}}});Zn=r("hiQgq");r("9Ta4i");const fa=(Zn=r("hiQgq")).htmlLanguage.parser,_a=Zn.markdownLanguage.parser.configure(Zn.parseCode({htmlParser:fa})),ba=Zn.PostgreSQL.language.parser,va=Zn.sql({dialect:Zn.PostgreSQL}),ya=Zn.pythonLanguage.parser,wa=["md","mermaid","cm","markdown","mdx","mdl","markdownliteral"].flatMap((e=>[e,`@${e}`])),ka=new Set(["TripleString","String","CommandString","TripleStringWithoutInterpolation","StringWithoutInterpolation","CommandStringWithoutInterpolation"]),Ea=Zn.parseMixed(((e,t)=>{var n,o,a;if(!ka.has(e.type.name))return null;const r="TripleString"===e.name||"TripleStringWithoutInterpolation"===e.name?3:1,i=e.from+r,s=Math.min(e.to-r,t.length);if(i>=s)return null;const l=(null===(n=e.node)||void 0===n?void 0:n.prevSibling)||(null===(o=e.node)||void 0===o||null===(a=o.parent)||void 0===a?void 0:a.prevSibling);if(null==l||"MacroIdentifier"!==l.name&&"Prefix"!==l.name)return null;const c="MacroIdentifier"===l.name,d=t.read(l.from,l.to);let u=null;if("@htl"===d||"html"===d)u=fa;else if(wa.includes(d))u=_a;else if("@javascript"===d||"@js"===d||"js"===d||"javascript"===d)u=Zn.javascriptLanguage.parser;else if("py"===d||"pyr"===d||"python"===d||"@python"===d)u=ya;else{if("sql"!==d)return null;u=ba}let p=[];if(null!=e.node.firstChild){let t=i,n=e.node.firstChild.cursor();do{t!==n.from&&p.push({from:t,to:n.from}),t=n.to}while(n.nextSibling());te.flatMap((({from:e,to:n})=>{const o=t.read(e,n),a=[];let r=e;for(let{index:t}of o.matchAll(/\\\$/g)){let n=e+t;r!==n&&a.push({from:r,to:n}),r=n+1}return r!==n&&a.push({from:r,to:n}),a})))(p,t)),[...wa].includes(d)?{parser:u,overlay:[{from:i,to:s}]}:{parser:u,overlay:p}})),$a=e=>{const t=Zn.julia_andrey(e);return t.language.parser=t.language.parser.configure({wrap:Ea}),t};Zn=r("hiQgq"),Zn=r("hiQgq"),ce=r("9Ta4i"),Zn=r("hiQgq"),ve=r("aN0pg");let{autocompletion:xa,completionKeymap:Sa,completionStatus:Na,acceptCompletion:Ca,selectedCompletion:Aa}=Zn.autocomplete;const Ma=xa()[1];const Oa=[{key:"Tab",run:e=>{if(Ca(e))return!0;if(e.state.readOnly)return!1;let t=e.state.selection.main;if(!t.empty)return!1;let n=e.state.sliceDoc(t.from-1,t.from),o=e.state.sliceDoc(e.state.doc.lineAt(t.from).from,t.from);return!"\t \n=".includes(n)&&(!(")"===n&&!o.includes("?"))&&Zn.autocomplete.startCompletion(e))}},{key:"?",run:e=>null!=Zn.autocomplete.completionStatus(e.state)&&(rn("docs"),!0)},{key:".",run:e=>(Ca(e),!1)}];let Ta=e=>Zn.EditorView.updateListener.of((t=>{var n;if(null==Aa(t.state))return;let o=t.state.field(Ma,!1),a=null==o?void 0:o.open;if(null==a)return;let r=a.options[a.selected],i=r.completion.apply??r.completion.label;if("string"!=typeof i)return;const s=t.view.state.field(Ma).active.find((e=>e.source==r.source));if(!0!==(null==s||null===(n=s.hasResult)||void 0===n?void 0:n.call(s)))return;const l=s.from,c=Math.min(s.to,t.state.doc.length);let d=t.state.update({changes:{from:l,to:c,insert:i}}),u=ua(d.state);null!=u&&e(u)}));const Ra=e=>e.matchBefore(/\\[\d\w_\^:]*/);let La=e=>/^[@\p{L}\p{Sc}\d_][\p{L}\p{Nl}\p{Sc}\d_!]*"?$/u.test(e)?null:":"===e?`:(${e})`:`:${e}`;const Da={name:"Suggestions",header:()=>document.createElement("div"),rank:0},Ia={name:"Operators",rank:1},Pa=(e,t)=>3*t+(/^\p{Ll}/u.test(e)?2:/^\p{Lu}/u.test(e)?1:0),ja=/^(.*\s)?(baremodule|begin|break|catch|const|continue|do|else|elseif|end|export|false|finally|for|function|global|if|import|let|local|macro|module|quote|return|struct|true|try|using|while)$/,Ba=e=>/[\p{L}\p{Nl}\p{Sc}\d_!]*$/u.test(e)&&!ja.test(e),Ua=e=>async t=>{if(Ra(t))return null;if(!t.explicit&&za(t))return null;if(!t.explicit&&null!=t.tokenBefore(["Number","Comment","String","TripleString","Symbol"]))return null;let n=t.state.sliceDoc(0,t.pos),o=(e=>e.matchBefore(/\.\:[^\s"'`()\[\]\{\}\.\,=]*/))(t);o&&(n=n.slice(0,o.from+1)+n.slice(o.from+2));const a=t.state.facet(ha);let r=await e({text:n});if(!r)return null;let{start:i,stop:s,results:l}=r;o&&(s+=1);const c=n.slice(0,i).endsWith("."),d=null!=t.matchBefore(/\~[^\s\"]*/);return{from:i,to:s,validFor:Ba,commitCharacters:void 0,filter:!d,options:[...l.filter((([e,n,o,r,i])=>(t.explicit||"path"!=i)&&!(r&&(e=>null!=e&&Object.keys(a).includes(e))(e)))).map((([e,t,o,a,r,i],s)=>{let l="method"===r?n:c?La(e)??e:e;return t="Function"===t&&e.startsWith("@")?"Macro":t,{label:e,apply:l,type:ve.cl({c_notexported:!o,[`c_${t}`]:!0,[`completion_${r}`]:!0,c_from_notebook:a})??void 0,section:Da,boost:"keyword_argument"===r?7:c?Pa(l,o):void 0}})),...l.filter((([e])=>c&&null!=La(e))).map((([e,t,n],o)=>{let a=La(e)??"";return{label:a,apply:a,type:(n?"":"c_notexported ")+(null==t?"":"c_"+t),section:Ia,is_not_exported:!n}}))]}},Fa=async e=>{var t;if(Ra(e))return null;if(!e.explicit&&za(e))return null;if(!e.explicit&&null!=e.tokenBefore(["Number","Comment","String","TripleString","Symbol"]))return null;const n=await Zn.autocomplete.completeAnyWord(e);if(null===n)return null;const o=e.tokenBefore(["Identifier","Number"]);return null==o||"Number"===(null===(t=o.type)||void 0===t?void 0:t.name)?null:{from:n.from,commitCharacters:void 0,options:n.options.map((({label:e},t)=>({label:e,apply:e,type:void 0,section:Da})))}},za=e=>{var t,n;let o=e.matchBefore(ja),a=e.matchBefore(/(catch|local|module|abstract type|struct|macro|const|for|function|let|do) ([@\p{L}\p{Nl}\p{Sc}\d_!,\(\)]|, )*$/u),r=e.matchBefore(/do [\(\), \p{L}\p{Nl}\p{Sc}\d_!]*$/u),i=Zn.syntaxTree(e.state).resolve(e.pos,-1),s="BareTupleExpression"===(null==i||null===(t=i.parent)||void 0===t?void 0:t.name)?null==i?void 0:i.parent:i,l="Identifier"===(null==i?void 0:i.name)&&"AssignmentExpression"===(null==s||null===(n=s.parent)||void 0===n?void 0:n.name)&&null!=(null==s?void 0:s.nextSibling);return o||a||r||l},qa=(e,t)=>async n=>{if(Ra(n))return null;if(!n.explicit&&za(n))return null;if(!n.explicit&&null!=n.tokenBefore(["Number","Comment","String","TripleString","Symbol"]))return null;if(n.matchBefore(/\.[\p{L}\p{Nl}\p{Sc}\d_!]*$/u))return null;const o=n.state.facet(ha),a=e(),r=ce.default.union(Object.entries(o).filter((([e,t])=>null==a[t])).map((([e])=>e)),...Object.values(ce.default.omit(a,t))),i=await Zn.autocomplete.completeFromList(r.map((e=>({label:e,apply:e,type:"c_from_notebook completion_module c_Any",section:Da}))))(n);return null==i?null:{...i,validFor:Ba,commitCharacters:void 0}},Ha=["\\sqrt","\\pi","\\approx"],Ga=["🐶","🐱","🐭","🐰","🐼","🐨","🐸","🐔","🐧"],Wa=(e,t,n,o)=>{const a=e.state.sliceDoc(n,o);let r=t.detail??t.label;if(!t.label.startsWith("\\:")&&a!==t.label){(function(e,t){const n=Zn.syntaxTree(e).resolve(t);return null!=n&&("TripleString"===n.name||"String"===n.name)})(e.state,o)&&(r=t.label)}e.dispatch({...Zn.autocomplete.insertCompletionText(e.state,r,n,o),annotations:Zn.autocomplete.pickedCompletion.of(t)})},Ka=e=>{let t=null;return async n=>{if(!Ra(n))return null;if(!n.explicit&&za(n))return null;if(!n.explicit&&null!=n.tokenBefore(["Number","Comment"]))return null;const o=await(async()=>{if(null==t){const n=await e().catch((e=>(console.warn("Failed to fetch special symbols",e),null)));if(null!=n){const{latex:e,emoji:o}=n;t=[o,e].flatMap((e=>Object.entries(e).map((([e,t])=>({label:e,apply:Wa,detail:t??void 0,type:"c_special_symbol",boost:"\\in"===e?3:Ha.includes(e)?2:Ga.includes(t)?1:0})))))}}return t})();return await Zn.autocomplete.completeFromList(o??[])(n)}};let Za=({request_autocomplete:e,request_special_symbols:t,on_update_doc_query:n,request_unsubmitted_global_definitions:o,cell_id:a})=>{let r=null,i=null;return[xa({activateOnTyping:_i,override:[qa(o,a),Ka(t),Ua((async t=>{if(ce.default.isEqual(t,r)){let e=await i;if(null!=e)return e}return r=t,i=e(t),await i})),Fa],defaultKeymap:!1,maxRenderedOptions:512,optionClass:e=>e.type??""}),Ta(n),Zn.keymap.of(Oa),Zn.keymap.of(Sa)]};ce=r("9Ta4i"),Zn=r("hiQgq"),Ot=r("1gqBQ"),ce=r("9Ta4i"),i=r("cNaMA"),i=r("cNaMA"),ve=r("aN0pg"),i=r("cNaMA"),ce=r("9Ta4i");const Va={current:null},Qa=()=>{const[e,t]=i.useState(null);return i.useEffect((()=>{(()=>{if(null!=Va.current)return Va.current;{const e=fetch("https://julia-loading-times-test.netlify.app/pkg_load_times.csv").then((e=>e.text())).then((e=>{const t=e.split("\n");return t[0].split(","),new Map(t.slice(1).map((e=>{let[t,...n]=e.split(",");return[t,{install:Number(n[0]),precompile:Number(n[1]),load:Number(n[2])}]})))})),t=fetch("https://julia-loading-times-test.netlify.app/top_packages_sorted_with_deps.txt").then((e=>e.text())).then((e=>new Map(e.split("\n").map((e=>{let[t,...n]=e.split(",");return[t,n]})))));return Va.current=Promise.all([e,t]).then((([e,t])=>({times:e,packages:t}))),Va.current}})().then(t)}),[]),e},Xa=(e,t,n=[])=>{const o=e.packages.get(t);if(null==o)return[];{const t=ce.default.union(n,o);return[...o,...ce.default.difference(o,n).flatMap((n=>Xa(e,n,t)))]}},Ya={install:2,load:1,precompile:.3};ce=r("9Ta4i"),i=r("cNaMA");r("kjWx8");var Ja=window.CustomEvent;function er(e,t){var n="on"+t.type.toLowerCase();return"function"==typeof e[n]&&e[n](t),e.dispatchEvent(t)}function tr(e){for(;e;){if("dialog"===e.localName)return e;e=e.parentElement?e.parentElement:e.parentNode?e.parentNode.host:null}return null}function nr(e){for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;e&&e.blur&&e!==document.body&&e.blur()}function or(e,t){for(var n=0;n=0&&(e=this.dialog_),e||(e=rr(this.dialog_)),nr(document.activeElement),e&&e.focus()},updateZIndex:function(e,t){if(e, the polyfill may not work correctly",e),"dialog"!==e.localName)throw new Error("Failed to register dialog: The element is not a dialog.");new cr(e)},registerDialog:function(e){e.showModal||dr.forceRegisterDialog(e)},DialogManager:function(){this.pendingDialogStack=[];var e=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",function(t){this.forwardTab_=void 0,t.stopPropagation(),e([])}.bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver((function(t){var n=[];t.forEach((function(e){for(var t,o=0;t=e.removedNodes[o];++o)t instanceof Element&&("dialog"===t.localName&&n.push(t),n=n.concat(t.querySelectorAll("dialog")))})),n.length&&e(n)})))}};if(dr.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})},dr.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()},dr.DialogManager.prototype.updateStacking=function(){for(var e,t=this.zIndexHigh_,n=0;e=this.pendingDialogStack[n];++n)e.updateZIndex(--t,--t),0===n&&(this.overlay.style.zIndex=--t);var o=this.pendingDialogStack[0];o?(o.dialog.parentNode||document.body).appendChild(this.overlay):this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)},dr.DialogManager.prototype.containedByTopDialog_=function(e){for(;e=tr(e);){for(var t,n=0;t=this.pendingDialogStack[n];++n)if(t.dialog===e)return 0===n;e=e.parentElement}return!1},dr.DialogManager.prototype.handleFocus_=function(e){var t=e.composedPath?e.composedPath()[0]:e.target;if(!this.containedByTopDialog_(t)&&document.activeElement!==document.documentElement&&(e.preventDefault(),e.stopPropagation(),nr(t),void 0!==this.forwardTab_)){var n=this.pendingDialogStack[0];return n.dialog.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?n.focus_():t!==document.documentElement&&document.documentElement.focus()),!1}},dr.DialogManager.prototype.handleKey_=function(e){if(this.forwardTab_=void 0,27===e.keyCode){e.preventDefault(),e.stopPropagation();var t=new Ja("cancel",{bubbles:!1,cancelable:!0}),n=this.pendingDialogStack[0];n&&er(n.dialog,t)&&n.dialog.close()}else 9===e.keyCode&&(this.forwardTab_=!e.shiftKey)},dr.DialogManager.prototype.checkDOM_=function(e){this.pendingDialogStack.slice().forEach((function(t){-1!==e.indexOf(t.dialog)?t.downgradeModal():t.maybeHideModal()}))},dr.DialogManager.prototype.pushDialog=function(e){var t=(this.zIndexHigh_-this.zIndexLow_)/2-1;return!(this.pendingDialogStack.length>=t||(1===this.pendingDialogStack.unshift(e)&&this.blockDocument(),this.updateStacking(),0))},dr.DialogManager.prototype.removeDialog=function(e){var t=this.pendingDialogStack.indexOf(e);-1!==t&&(this.pendingDialogStack.splice(t,1),0===this.pendingDialogStack.length&&this.unblockDocument(),this.updateStacking())},dr.dm=new dr.DialogManager,dr.formSubmitter=null,dr.imagemapUseValue=null,void 0===window.HTMLDialogElement){var ur=document.createElement("form");if(ur.setAttribute("method","dialog"),"dialog"!==ur.method){var pr=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(pr){var mr=pr.get;pr.get=function(){return ar(this)?"dialog":mr.call(this)};var hr=pr.set;pr.set=function(e){return"string"==typeof e&&"dialog"===e.toLowerCase()?this.setAttribute("method",e):hr.call(this,e)},Object.defineProperty(HTMLFormElement.prototype,"method",pr)}}document.addEventListener("click",(function(e){if(dr.formSubmitter=null,dr.imagemapUseValue=null,!e.defaultPrevented){var t=e.target;if("composedPath"in e&&(t=e.composedPath().shift()||t),t&&ar(t.form)){if(!("submit"===t.type&&["button","input"].indexOf(t.localName)>-1)){if("input"!==t.localName||"image"!==t.type)return;dr.imagemapUseValue=e.offsetX+","+e.offsetY}tr(t)&&(dr.formSubmitter=t)}}}),!1),document.addEventListener("submit",(function(e){var t=e.target;if(!tr(t)){var n=sr(e);"dialog"===(n&&n.getAttribute("formmethod")||t.getAttribute("method"))&&e.preventDefault()}}));var gr=HTMLFormElement.prototype.submit;HTMLFormElement.prototype.submit=function(){if(!ar(this))return gr.call(this);var e=tr(this);e&&e.close()}}var fr=dr;i=r("cNaMA");const _r=()=>{const e=i.useRef(null);return i.useLayoutEffect((()=>{null!=e.current&&"function"!=typeof HTMLDialogElement&&fr.registerDialog(e.current)}),[e.current]),i.useMemo((()=>[e,()=>{var t,n;(null===(t=e.current)||void 0===t?void 0:t.open)||null===(n=e.current)||void 0===n||n.showModal()},()=>{var t,n,o;!0===(null===(t=e.current)||void 0===t?void 0:t.open)&&(null===(n=e.current)||void 0===n||null===(o=n.close)||void 0===o||o.call(n))},()=>{var t,n,o,a,r;return!0===(null===(t=e.current)||void 0===t?void 0:t.open)?null===(n=e.current)||void 0===n||null===(o=n.close)||void 0===o?void 0:o.call(n):null===(a=e.current)||void 0===a||null===(r=a.showModal)||void 0===r?void 0:r.call(a)}]),[e])},br=({show:e,start_local:t})=>(window.open_edit_or_run_popup=()=>{t()},i.html`
+ +
`),vr=({offer_binder:e,start_binder:t,notebookfile:n,notebook:o})=>{const[a,r,s,l]=_r(),[c,d]=i.useState(!1),u=i.useRef("");u.current=n??"",window.open_edit_or_run_popup=r,i.useEffect((()=>(window.start_binder=e?t:null,()=>{window.start_binder=null})),[t,e]);const p=u.current.startsWith("data:"),m=yr(o);return i.html`
+ + + + ${e?i.html` +

+ ${"To be able to edit code and run cells, you need to run the notebook yourself. "} + Where would you like to run the notebook? +

+ ${null==m?null:i.html`
${"This notebook takes about "}${m}${" to run."}
`} +

In the cloud (experimental)

+
+ +
+

+ Binder is a free, open source service that runs scientific notebooks in the cloud! + It will take a while, usually 2-7 minutes to get a session. +

+

On your computer

+

(Recommended if you want to store your changes.)

+ `:null} +
    +
  1. +
    + ${p?i.html` +
    Download the notebook:
    +
    {"A"===e.target.tagName||e.target.closest("div").firstElementChild.click()}} + class="download_div" + > + notebook.jl + +
    + `:i.html` +
    Copy the notebook URL:
    +
    + e.target.select()} value=${u.current} readonly /> + {await navigator.clipboard.writeText(u.current),d(!0),setTimeout((()=>d(!1)),3e3)}} + /> +
    + `} +
    +
  2. +
  3. +
    Run Pluto
    +

    + ${"(Also see: "} + How to install Julia and Pluto) +

    + +
  4. +
  5. + ${p?i.html` +
    Open the notebook file
    +

    Type the saved filename in the open box.

    + + `:i.html` +
    Paste URL in the Open box
    +
  6. +
+
+
`},yr=e=>{const t=(e=>{var t;return(((null===(t=e.nbpkg)||void 0===t?void 0:t.install_time_ns)??NaN)+ce.default.sum(Object.values(e.cell_results).map((e=>e.runtime??0))))/1e9})(e);if(isNaN(t))return null;const n=ce.default.round(15+1.5*t,-1);return wr(n)},wr=e=>{const t=e/60,n=Math.ceil(e),o=Math.round(t);return e<60?`${n} second${n>1?"s":""}`:`${o} minute${o>1?"s":""}`};var kr;an=r("hrGZZ");kr=new URL(r("ko7kR").resolve("asIno"),import.meta.url).toString();const Er=new URL(kr);var $r;$r=new URL(r("ko7kR").resolve("1c0Rm"),import.meta.url).toString();const xr=new URL($r);var Sr;Sr=new URL(r("ko7kR").resolve("fUvXZ"),import.meta.url).toString();const Nr=new URL(Sr);var Cr;Cr=new URL(r("ko7kR").resolve("4brWx"),import.meta.url).toString();new URL(Cr);const Ar=({notebook:e,disable_input:t})=>{const[n,o]=i.useState(null),a=i.useRef(null);a.current=n;const r=i.useRef(null),s=i.useRef(""),l=i.useCallback((e=>{const t=e.detail.source_element;if(r.current=t,null==t)s.current="top: 20%; left: 50%; transform: translate(-50%, -50%); position: fixed;";else{const e=t.getBoundingClientRect(),n=document.body.getBoundingClientRect();s.current=`top: ${.5*(e.top+e.bottom)-n.top}px; left: min(max(0px,100vw - 251px - 30px), ${e.right-n.left}px);`}o(e.detail)}),[o]),c=i.useCallback((()=>{o(null)}),[o]);an.useEventListener(window,"open pluto popup",l,[l]),an.useEventListener(window,"close pluto popup",c,[c]),an.useEventListener(window,"pointerdown",(e=>{null!=a.current&&null!=e.target&&null==e.target.closest("pluto-popup")&&(null!=r.current&&r.current.contains(e.target)||c())}),[c]),an.useEventListener(window,"keydown",(e=>{"Escape"===e.key&&c()}),[c]);const d=i.useRef(null);i.useLayoutEffect((()=>{null!=n&&(!0===n.should_focus?requestAnimationFrame((()=>{var e,t;d.current=document.activeElement;const n=(null===(e=u.current)||void 0===e?void 0:e.querySelector("a"))??u.current;null==n||null===(t=n.focus)||void 0===t||t.call(n)})):d.current=null)}),[null!=n]);const u=i.useRef(null);an.useEventListener(u.current,"focusout",(e=>{if(null!=a.current&&!0===a.current.should_focus){var t,n,o,i;if(null===(t=u.current)||void 0===t?void 0:t.matches(":focus-within"))return;if(null===(n=u.current)||void 0===n?void 0:n.contains(e.relatedTarget))return;if(null!=r.current&&(r.current.contains(e.relatedTarget)||r.current.matches(":focus-within")))return;c(),e.preventDefault(),null===(o=d.current)||void 0===o||null===(i=o.focus)||void 0===i||i.call(o)}}),[c]);const p=null==n?void 0:n.type;return i.html` + ${"nbpkg"===p?i.html`<${Mr} + notebook=${e} + disable_input=${t} + recent_event=${n} + clear_recent_event=${()=>o(null)} + />`:"info"===p||"warn"===p?i.html`
${null==n?void 0:n.body}
`:null} +
+
+ +
`},Mr=({notebook:e,recent_event:t,clear_recent_event:n,disable_input:o})=>{var a,r,s,l,c,d,u;let p=i.useContext(ye);const[m,h]=i.useState(null);i.useEffect((()=>{let n=!0;return null==t?h(null):"nbpkg"===(null==t?void 0:t.type)&&(p.get_avaible_versions({package_name:t.package_name,notebook_id:e.notebook_id})??Promise.resolve([])).then((({versions:o,url:a})=>{n&&h(Rr({nbpkg:e.nbpkg,package_name:t.package_name,is_disable_pkg:t.is_disable_pkg,available_versions:o,package_url:a}))})),()=>{n=!1}}),[t,...Tr(e.nbpkg)]);const g=t.is_disable_pkg||((null===(a=e.nbpkg)||void 0===a?void 0:a.enabled)??!0);i.useEffect((()=>{g||n()}),[g]);const[f,_]=i.useState(!1),b=null==(null===(r=e.nbpkg)||void 0===r?void 0:r.restart_required_msg)&&!((null===(s=e.nbpkg)||void 0===s?void 0:s.instantiated)??1),v=null!=t&&(((null===(l=e.nbpkg)||void 0===l?void 0:l.busy_packages)??[]).includes(t.package_name)||b),y=Dt(v,2);i.useEffect((()=>{_(y)}),[y]);const w=null==(null===(c=e.nbpkg)||void 0===c?void 0:c.terminal_outputs)?"Loading...":(null===(d=e.nbpkg)||void 0===d?void 0:d.terminal_outputs[null==t?void 0:t.package_name])??"",k=(null==m?void 0:m.offer_update)??!1,E=Qa(),$=null==E||null==(null==t?void 0:t.package_name)?null:((e,t)=>{let n=t.flatMap((t=>Xa(e,t))),o=ce.default.uniq([...t,...n]).map((t=>e.times.get(t))).filter((e=>null!=e)),a=e=>e.reduce(((e,t)=>e+(null==t||isNaN(t)?0:t)),0);return{install:a(o.map(ce.default.property("install")))*Ya.install,precompile:a(o.map(ce.default.property("precompile")))*Ya.precompile,load:a(o.map(ce.default.property("load")))*Ya.load}})(E,[null==t?void 0:t.package_name]),x=null==$?0:$.install+$.load+$.precompile,S=null==$?0:$.load;return i.html` + ${(null==m?void 0:m.hint)??"Loading..."} + ${("will_be_installed"===(null==m?void 0:m.status)||"busy"===(null==m?void 0:m.status))&&x>10?i.html`
+ Installation can take ${wr(x)}${". "}
${"Afterwards, it loads in "} + ${wr(S)}. +
`:null} + + <${St} value=${w??"Loading..."} /> +
`},Or=e=>null==e?[null]:Object.entries(e).flat(),Tr=e=>null==e?[null]:Object.entries(e).flatMap((([e,t])=>"terminal_outputs"===e?[]:[t])),Rr=({nbpkg:e,package_name:t,available_versions:n,is_disable_pkg:o,package_url:a})=>{let r="error",s="error",l=i.html`error`,c=!1;a=a??`https://juliahub.com/ui/Packages/General/${t}`;const d=(null==e?void 0:e.installed_versions[t])??null,u=(null==e?void 0:e.waiting_for_permission)??!1,p=!u&&(((null==e?void 0:e.busy_packages)??[]).includes(t)||!((null==e?void 0:e.instantiated)??1)),m=i.html`${t} `;if(o){const e=t;r="disable_pkg",s=`${e} disables Pluto's built-in package manager.`,l=i.html`${e} disables Pluto's built-in package manager.`}else null!=d||ce.default.isEqual(n,["stdlib"])?null==d||"stdlib"===d?(r="installed",s=`${t} is part of Julia's pre-installed 'standard library'.`,l=i.html`${m} is part of Julia's pre-installed standard library.`):u?(r="will_be_installed",s=`${t} (v${ce.default.last(n)}) will be installed when you run this notebook.`,l=i.html`
${m} v${ce.default.last(n)}
+ will be installed when you run this notebook.`):p?(r="busy",s=`${t} (v${d}) is installing...`,l=i.html`
${m} v${d}
+ is installing...`):(r="installed",s=`${t} (v${d}) is installed in the notebook.`,l=i.html`
+ ${m} + v${d} +
+ is installed in the notebook.`,g=n,c=!("stdlib"===(h=d)||!ce.default.isArray(g))&&ce.default.last(g)!==h):null!=n&&ce.default.isArray(n)&&(0===n.length?(r="not_found",s=`The package "${t}" could not be found in the registry. Did you make a typo?`,l=i.html`The package "${t}" could not be found in the registry. +
Did you make a typo?
`):(r="will_be_installed",s=`${t} (v${ce.default.last(n)}) will be installed in the notebook when you run this cell.`,l=i.html`
${m} v${ce.default.last(n)}
+ will be installed in the notebook when you run this cell.`));var h,g;return{status:r,hint:l,hint_raw:s,available_versions:n??null,chosen_version:d,busy:p,offer_update:c,package_url:a}},Lr=({package_name:e,pluto_actions:t,notebook_id:n,nbpkg:o})=>{const[a,r]=i.useState(null),[s,l]=i.useState(null);i.useEffect((()=>{(t.get_avaible_versions({package_name:e,notebook_id:n})??Promise.resolve([])).then(r)}),[e]);const{status:c,hint_raw:d}=Rr({nbpkg:o,package_name:e,is_disable_pkg:!1,available_versions:null==a?void 0:a.versions,package_url:null==a?void 0:a.package_url});return i.html` + + + + `},Dr=({package_name:e})=>{const{hint_raw:t}=Rr({nbpkg:null,package_name:e,is_disable_pkg:!0});return i.html` + + + + `};i=r("cNaMA"),i=r("cNaMA"),Zn=r("hiQgq");class Ir extends Zn.WidgetType{constructor(e){super(),this.element=e}eq(e){return!1}toDOM(){let e=document.createElement("span");return i.render(this.element,e),e}updateDOM(e){return i.render(this.element,e),!0}}const Pr=["Pkg.activate","Pkg.API.activate","Pkg.develop","Pkg.API.develop","Pkg.add","Pkg.API.add","quickactivate","@quickactivate"];function jr(e,{pluto_actions:t,notebook_id:n,nbpkg:o}){let a=new Set,r=e.visibleRanges.flatMap((({from:r,to:s})=>{let l=function({doc:e,tree:t,from:n,to:o}){let a=0,r=[];return function({tree:e,enter:t,leave:n,from:o=0,to:a=e.length}){let r=e.cursor();for(;;){let e=!1;if(r.from<=a&&r.to>=o&&(r.type.isAnonymous||!1!==t(r))){if(r.firstChild())continue;r.type.isAnonymous||(e=!0)}for(;e&&n&&n(r),e=r.type.isAnonymous,!r.nextSibling();){if(!r.parent())return;e=!0}}}({tree:t,from:n,to:o,enter:t=>{if("QuoteExpression"!==t.name&&"QuoteStatement"!==t.name||a++,"InterpolationExpression"===t.name&&a--,0!==a)return;if("CallExpression"===t.name||"MacroExpression"===t.name){let n=t.node.firstChild,o=e.sliceString(n.from,n.to);return void(Pr.includes(o)&&r.push({type:"package_disabler",name:o,from:t.to,to:t.to}))}let n=jo((e=>No`import A, ${e}`)),o=e=>{let t=null;return(t=n(Ao`${Lo.as("package")}.${Lo.any}`).match(e))?o(t.package):(t=n(Ao`.${Lo.maybe(Lo.any)}`).match(e))?null:(t=n(Ao`${Lo.Identifier}`).match(e))?e:void console.warn("Unknown nested import specifier: "+e.toString())},i=null;if((i=Mo(Ao`import ${Lo.as("specifier")}: ${Lo.many()}`).match(t))??(i=Mo(Ao`import ${Lo.as("specifier")}, ${Lo.many("specifiers")}`).match(t))??(i=Mo(Ao`using ${Lo.as("specifier")}: ${Lo.many()}`).match(t))??(i=Mo(Ao`using ${Lo.as("specifier")}, ${Lo.many("specifiers")}`).match(t))){let{specifier:a,specifiers:s=[]}=i;a&&(s=[{node:a},...s]);for(let{node:t}of s){t=Io(t);let a=null;if(a=n(Ao`${Lo.as("package")} as ${Lo.maybe(Lo.any)}`).match(t)){let t=o(a.package);t&&r.push({type:"package",name:e.sliceString(t.from,t.to),from:t.to,to:t.to})}else if(a=n(Ao`${Lo.as("package")}.${Lo.any}`).match(t)){let t=o(a.package);t&&r.push({type:"package",name:e.sliceString(t.from,t.to),from:t.to,to:t.to})}else if(a=n(Ao`.${Lo.as("scoped")}`).match(t));else if(a=n(Ao`${Lo.as("package")}`).match(t)){let t=o(a.package);t&&r.push({type:"package",name:e.sliceString(t.from,t.to),from:t.to,to:t.to})}else console.warn("Unknown import specifier: "+t.toString())}if(i=null,i=Mo(Ao`using ${Lo.as("specifier")}, ${Lo.many("specifiers")}`).match(t)){let{specifier:t}=i;t&&("\n"!==e.sliceString(t.to,t.to+1)&&""!==e.sliceString(t.to,t.to+1)||r.push({type:"implicit_using",name:e.sliceString(t.from,t.to),from:t.to,to:t.to}))}return!1}if("ImportStatement"===t.name)throw new Error("What")},leave:e=>{"QuoteExpression"!==e.name&&"QuoteStatement"!==e.name||a--,"InterpolationExpression"===e.name&&a++}}),r}({doc:e.state.doc,tree:Zn.syntaxTree(e.state),from:r,to:s});return l.map((e=>{if("package"===e.type){let{name:r}=e;if("Base"!==r&&"Core"!==r&&!a.has(r)){return a.add(r),Zn.Decoration.widget({widget:new Ir(i.html` + <${Lr} + key=${r} + package_name=${r} + pluto_actions=${t} + notebook_id=${n} + nbpkg=${o} + /> + `),side:1}).range(e.to)}}else{if("package_disabler"===e.type){return Zn.Decoration.widget({widget:new Ir(i.html` <${Dr} package_name=${e.name} /> `),side:1}).range(e.to)}if("implicit_using"===e.type&&"HypertextLiteral"===e.name){return Zn.Decoration.widget({widget:new Ir(i.html` +
+ : @htl, @htl_str +
+
`),side:1}).range(e.to)}}}))})).filter((e=>null!=e));return Zn.Decoration.set(r,!0)}const Br=Zn.Facet.define({combine:e=>e[0],compare:ce.default.isEqual}),Ur=({pluto_actions:e,notebook_id_ref:t})=>Zn.ViewPlugin.fromClass(class{update_decos(n){const o=jr(n,{pluto_actions:e,notebook_id:t.current,nbpkg:n.state.facet(Br)});this.decorations=o}constructor(e){this.update_decos(e)}update(e){(e.docChanged||e.viewportChanged||e.state.facet(Br)!==e.startState.facet(Br))&&this.update_decos(e.view)}},{decorations:e=>e.decorations});ce=r("9Ta4i"),Zn=r("hiQgq"),i=r("cNaMA");const Fr=e=>{var t;return(null===(t=/^\t*/.exec(e))||void 0===t?void 0:t[0])??""},zr=e=>{let t=[];for(let n of ce.default.range(0,e.doc.lines)){let o=e.doc.line(n+1);const a=Fr(o.text).length;if(0===a)continue;const r=Math.min(a,12),s=r*e.tabSize,l=Zn.Decoration.line({attributes:{style:`--indented: ${s}ch;`,class:"awesome-wrapping-plugin-the-line"}});if(t.push(l.range(o.from,o.from)),r>0&&t.push(Zn.Decoration.mark({class:"awesome-wrapping-plugin-the-tabs"}).range(o.from,o.from+r)),a>r)for(let e of ce.default.range(r,a))t.push(Zn.Decoration.replace({widget:new Ir(i.html``),block:!1}).range(o.from+e,o.from+e+1))}return Zn.Decoration.set(t)},qr=Zn.StateField.define({create:e=>zr(e),update:(e,t)=>t.docChanged?zr(t.state):e,provide:e=>Zn.EditorView.decorations.from(e)});Zn=r("hiQgq");let Hr=Zn.EditorView.domEventHandlers({keydown:(e,t)=>{let n=t.state.selection.main;if(!n.empty)return!1;if(!e.repeat)return!1;if("Backspace"===e.key&&0===t.state.doc.length)return!0;if("Delete"===e.key&&0===t.state.doc.length)return!0;let o="active"===Zn.autocomplete.completionStatus(t.state);return"ArrowUp"!==e.key||o?"ArrowDown"!==e.key||o?"ArrowLeft"===e.key&&e.repeat?!!t.moveByChar(n,!1).eq(n):"ArrowRight"===e.key?!!t.moveByChar(n,!0).eq(n):void 0:!!t.moveVertically(t.state.selection.main,!0).eq(n):!!t.moveVertically(t.state.selection.main,!1).eq(n)}}),Gr=({focus_on_neighbor:e})=>(({focus_on_neighbor:e})=>Zn.keymap.of([{key:"PageUp",run:()=>(e({cell_delta:-1,line:0,character:0}),!0)},{key:"PageDown",run:()=>(e({cell_delta:1,line:0,character:0}),!0)},{key:"ArrowLeft",run:t=>{let n=t.state.selection.main;return!!n.empty&&!!t.moveByChar(n,!1).eq(n)&&(e({cell_delta:-1,line:1/0,character:1/0}),!0)}},{key:"ArrowUp",run:t=>{let n=t.state.selection.main;return!!n.empty&&!!t.moveVertically(n,!1).eq(n)&&(e({cell_delta:-1,line:1/0,character:1/0}),!0)}},{key:"ArrowRight",run:t=>{let n=t.state.selection.main;return!!n.empty&&!!t.moveByChar(n,!0).eq(n)&&(e({cell_delta:1,line:0,character:0}),!0)}},{key:"ArrowDown",run:t=>{let n=t.state.selection.main;return!!n.empty&&!!t.moveVertically(n,!0).eq(n)&&(e({cell_delta:1,line:0,character:0}),!0)}}]))({focus_on_neighbor:e});Zn=r("hiQgq");let Wr=({pluto_actions:e,cell_id:t})=>Zn.EditorView.domEventHandlers({paste:(n,o)=>{if(!o.hasFocus)return console.log("CodeMirror, why are you registring this paste? You aren't focused!"),!0;n.stopPropagation();const a=n.clipboardData.getData("text/plain"),r=_e(a);return null!=r&&(0===o.state.selection.main.from&&o.state.selection.main.to===o.state.doc.length?(e.add_deserialized_cells(a,t,r),e.confirm_delete_multiple("This Should Never Be Visible",[t]),!0):(o.state.selection.main.to===o.state.doc.length||0===o.state.selection.main.from)&&(e.add_deserialized_cells(a,t,r),!0))}});Zn=r("hiQgq"),Zn=r("hiQgq"),Zn=r("hiQgq");function Kr(e){var t,n,o;let a=e.parent.firstChild,r=e.parent.lastChild;if(!("end"===r.name))return null;let i=null===(t=e.parent.getChild("CatchClause"))||void 0===t?void 0:t.firstChild,s=null===(n=e.parent.getChild("TryElseClause"))||void 0===n?void 0:n.firstChild,l=null===(o=e.parent.getChild("FinallyClause"))||void 0===o?void 0:o.firstChild;return[{from:a.from,to:a.to},i&&{from:i.from,to:i.to},s&&{from:s.from,to:s.to},l&&{from:l.from,to:l.to},{from:r.from,to:r.to}].filter((e=>null!=e))}const Zr=(Zn=r("hiQgq")).EditorView.baseTheme({".cm-matchingBracket":{backgroundColor:"#328c8252"},".cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Vr=Zn.Facet.define({combine:e=>Zn.combineConfig(e,{afterCursor:!0,brackets:"()[]{}",maxScanDistance:1e4})}),Qr=Zn.Decoration.mark({class:"cm-matchingBracket"}),Xr=(Zn.Decoration.mark({class:"cm-nonmatchingBracket"}),[Zn.StateField.define({create:()=>Zn.Decoration.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],o=t.state.facet(Vr);for(let e of t.state.selection.ranges){if(!e.empty)continue;let a=Jr(t.state,e.head,-1,o)||e.head>0&&Jr(t.state,e.head-1,1,o)||o.afterCursor&&(Jr(t.state,e.head,1,o)||e.headZn.EditorView.decorations.from(e)}),Zr]);function Yr(e={}){return[Vr.of(e),Xr]}function Jr(e,t,n,o={}){let a=o.maxScanDistance||1e4,r=o.brackets||"()[]{}",i=Zn.syntaxTree(e),s=i.resolveInner(t,n),l=function(e){var t,n;if("end"===e.name&&(e="IfStatement"===e.parent.name?null===(t=e.parent)||void 0===t||null===(n=t.firstChild)||void 0===n?void 0:n.firstChild:e.parent.firstChild),null==e)return[];if("mutable"===e.name||"struct"===e.name){"struct"===e.name&&(e=e.parent.firstChild);let t=e.parent.getChild("struct"),n=e.parent.lastChild;return"end"===n.name&&t?[{from:e.from,to:t.to},{from:n.from,to:n.to}]:null}if("struct"===e.name){let t=e.parent.lastChild;return"end"===t.name?[{from:e.from,to:e.to},{from:t.from,to:t.to}]:null}if("quote"===e.name){let t=e.parent.lastChild;return"end"===t.name?[{from:e.from,to:e.to},{from:t.from,to:t.to}]:null}if("begin"===e.name){let t=e.parent.lastChild;return"end"===t.name?[{from:e.from,to:e.to},{from:t.from,to:t.to}]:null}if("do"===e.name){let t=e.parent.lastChild;return"end"===t.name?[{from:e.from,to:e.to},{from:t.from,to:t.to}]:null}if("for"===e.name){let t=e.parent.lastChild;return"end"===t.name?[{from:e.from,to:e.to},{from:t.from,to:t.to}]:null}if("let"===e.name){let t=e.parent.lastChild;return"end"===t.name?[{from:e.from,to:e.to},{from:t.from,to:t.to}]:null}if("macro"===e.name){let t=e.parent.lastChild;return"end"===t.name?[{from:e.from,to:e.to},{from:t.from,to:t.to}]:null}if("function"===e.name){let t=e.parent.lastChild;return"end"===t.name?[{from:e.from,to:e.to},{from:t.from,to:t.to}]:null}if("while"===e.name){let t=e.parent.lastChild;return"end"===t.name?[{from:e.from,to:e.to},{from:t.from,to:t.to}]:null}if("type"===e.name&&(e=e.parent.firstChild),"abstract"===e.name||"primitive"===e.name){let t=e.parent.lastChild,n="end"===t.name,o=e.parent.getChild("type");return n&&o?[{from:e.from,to:o.to},{from:t.from,to:t.to}]:null}if("if"===e.name||"else"===e.name||"elseif"===e.name){"if"===e.name&&(e=e.parent);let t=!1;"else"===e.name&&(e=e.parent,t=!0),"elseif"===e.name&&(e=e.parent.parent);let n=e.parent.firstChild,o=e.parent.lastChild;if("end"!==o.name)return null;if(t&&"try"===n.name)return Kr(e);let a=[];a.push({from:n.from,to:n.to});for(let t of e.parent.getChildren("ElseifClause")){let e=t.firstChild;a.push({from:e.from,to:e.to})}for(let t of e.parent.getChildren("ElseClause")){let e=t.firstChild;a.push({from:e.from,to:e.to})}return a.push({from:o.from,to:o.to}),a}if("try"===e.name||"catch"===e.name||"finally"===e.name||"else"===e.name)return"catch"===e.name&&(e=e.parent),"finally"===e.name&&(e=e.parent),"else"===e.name&&(e=e.parent),"end"===e.parent.lastChild.name?Kr(e):null;if("module"===e.name||"baremodule"===e.name){let t=e.parent.lastChild;return"end"===t.name?[{from:e.from,to:e.to},{from:t.from,to:t.to}]:null}return null}(s);return l||function(e,t,n,o,a,r,i){let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=i.indexOf(s);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},d=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!d.next().done&&e<=r;){let r=d.value;n<0&&(e+=r.length);let s=t+e*n;for(let e=n>0?0:r.length-1,t=n>0?r.length:-1;e!=t;e+=n){let t=i.indexOf(r[e]);if(!(t<0||o.resolve(s+e,1).type!=a))if(t%2==0==n>0)u++;else{if(1==u)return t>>1==l>>1?[c,{from:s+e,to:s+e+1}]:null;u--}}n>0&&(e+=r.length)}return d.done?[c]:null}(e,t,n,i,s.type,a,r)}ve=r("aN0pg");const ei=(Zn=r("hiQgq")).Decoration.line({attributes:{class:"cm-highlighted-line"}}),ti=Zn.Decoration.mark({attributes:{class:"cm-highlighted-range"}});const ni=Zn.Facet.define({combine:e=>e[0],compare:(e,t)=>e===t}),oi=Zn.Facet.define({combine:e=>e[0],compare:(e,t)=>e===t}),ai=()=>Zn.ViewPlugin.fromClass(class{updateDecos(e){this.decorations=function(e){let t=e.state.facet(ni);if(null==t||null==t||t<0||t>e.state.doc.lines)return Zn.Decoration.set([]);let n=e.state.doc.line(t);return Zn.Decoration.set([ei.range(n.from,n.from)])}(e)}constructor(e){this.decorations=Zn.Decoration.set([]),this.updateDecos(e)}update(e){(e.docChanged||e.state.facet(ni)!==e.startState.facet(ni))&&this.updateDecos(e.view)}},{decorations:e=>e.decorations}),ri=()=>Zn.ViewPlugin.fromClass(class{updateDecos(e){this.decorations=function(e){let t=e.state.facet(oi);if(null==t)return Zn.Decoration.set([]);let{from:n,to:o}=t;return n<0||n==o?Zn.Decoration.set([]):Zn.Decoration.set([ti.range(n,o)])}(e)}constructor(e){this.decorations=Zn.Decoration.set([]),this.updateDecos(e)}update(e){(e.docChanged||e.state.facet(oi)!==e.startState.facet(oi))&&this.updateDecos(e.view)}},{decorations:e=>e.decorations});Zn=r("hiQgq");function ii(e,t){return({state:n,dispatch:o})=>{if(n.readOnly)return!1;let a=e(t,n.selection.ranges,n);return!!a&&(o(n.update(a)),!0)}}const si=ii(pi,0),li=(ii(pi,1),ii(pi,2),ii(ui,0)),ci=(ii(ui,1),ii(ui,2),[{key:"Mod-/",run:e=>{let t=di(e.state);return t.line?si(e):!!t.block&&li(e)}},{key:"Alt-A",run:li}]);function di(e,t=e.selection.main.head){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}function ui(e,t,n){let o=t.map((e=>di(n,e.from).block));if(!o.every((e=>e)))return null;let a=t.map(((e,t)=>function(e,{open:t,close:n},o,a){let r,i,s=e.sliceDoc(o-50,o),l=e.sliceDoc(a,a+50),c=/\s*$/.exec(s)[0].length,d=/^\s*/.exec(l)[0].length,u=s.length-c;if(s.slice(u-t.length,u)==t&&l.slice(d,d+n.length)==n)return{open:{pos:o-c,margin:c&&1},close:{pos:a+d,margin:d&&1}};a-o<=100?r=i=e.sliceDoc(o,a):(r=e.sliceDoc(o,o+50),i=e.sliceDoc(a-50,a));let p=/^\s*/.exec(r)[0].length,m=/\s*$/.exec(i)[0].length,h=i.length-m-n.length;return r.slice(p,p+t.length)==t&&i.slice(h,h+n.length)==n?{open:{pos:o+p+t.length,margin:/\s/.test(r.charAt(p+t.length))?1:0},close:{pos:a-m-n.length,margin:/\s/.test(i.charAt(h-1))?1:0}}:null}(n,o[t],e.from,e.to)));if(2!=e&&!a.every((e=>e))){let e=0;return n.changeByRange((t=>{let{open:n,close:r}=o[e++];if(a[e])return{range:t};let i=n.length+1;return{changes:[{from:t.from,insert:n+" "},{from:t.to,insert:" "+r}],range:Zn.EditorSelection.range(t.anchor+i,t.head+i)}}))}if(1!=e&&a.some((e=>e))){let e=[];for(let t,n=0;na&&(e==r||r>s.from)){a=s.from;let e=i??di(n,t).line;if(!e)continue;let r=/^\s*/.exec(s.text)[0].length,c=r==s.length,d=s.text.slice(r,r+e.length)==e?r:-1;re.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:a,empty:r,single:i}of o)!i&&r||e.push({from:t.from+a,insert:n+" "});let t=n.changes(e);return{changes:t,selection:n.selection.map(t,1)}}if(1!=e&&o.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:a}of o)if(n>=0){let o=t.from+n,r=o+a.length;" "==t.text[r-t.from]&&r++,e.push({from:o,to:r})}return{changes:e}}return null}Zn=r("hiQgq");let mi={key:"Mod-d",run:({state:e,dispatch:t})=>{if(e.selection.main.empty){var n,o;let a=["Identifier","FieldName"],r=Zn.syntaxTree(e).cursorAt(e.selection.main.from,-1),i=Zn.syntaxTree(e).cursorAt(e.selection.main.from,1);for(let e of a){let n=r.name===e?r:i.name===e?i:null;if(n)return t({selection:{anchor:n.from,head:n.to}}),!0}let s=e.doc.lineAt(e.selection.main.from),l=e.selection.main.from-s.from,c=s.text.slice(0,l),d=s.text.slice(l),u=(null===(n=c.match(/(\w+)$/))||void 0===n?void 0:n[0])??"",p=(null===(o=d.match(/^(\w+)/))||void 0===o?void 0:o[0])??"";t({selection:{anchor:e.selection.main.from-u.length,head:e.selection.main.from+p.length}})}else Zn.selectNextOccurrence({state:e,dispatch:t});return!1},shift:({state:e,dispatch:t})=>{if(1===e.selection.ranges.length)return!1;let n=e.selection.ranges.at(e.selection.mainIndex-1),o=e.selection.ranges.filter((e=>e!==n)),a=o.indexOf(e.selection.main),r=(i=o,s=e.selection.mainIndex-1,i.slice(s,s+1)[0]);var i,s;return t({selection:Zn.EditorSelection.create(o,a),effects:null==r?[]:Zn.EditorView.scrollIntoView(r.from)}),!0},preventDefault:!0};de=r("4zMEb");var hi=r("aTIpG");an=r("hrGZZ"),Zn=r("hiQgq");r("kjWx8");const gi="true"===window.localStorage.getItem("ENABLE_CM_MIXED_PARSER"),fi="true"===window.localStorage.getItem("ENABLE_CM_SPELLCHECK"),_i="true"===(window.localStorage.getItem("ENABLE_CM_AUTOCOMPLETE_ON_TYPE")??(/Mac/.test(navigator.platform)?"true":"false"));gi&&console.log("YOU ENABLED THE CODEMIRROR MIXED LANGUAGE PARSER\nThanks! Awesome!\nPlease let us know if you find any bugs...\nIf enough people do this, we can make it the default parser.\n"),window.PLUTO_TOGGLE_CM_MIXED_PARSER=(e=!gi)=>{window.localStorage.setItem("ENABLE_CM_MIXED_PARSER",String(e)),window.location.reload()},window.PLUTO_TOGGLE_CM_SPELLCHECK=(e=!fi)=>{window.localStorage.setItem("ENABLE_CM_SPELLCHECK",String(e)),window.location.reload()},window.PLUTO_TOGGLE_CM_AUTOCOMPLETE_ON_TYPE=(e=!_i)=>{window.localStorage.setItem("ENABLE_CM_AUTOCOMPLETE_ON_TYPE",String(e)),window.location.reload()};const bi=[{tag:Zn.tags.comment,color:"var(--cm-color-comment)",fontStyle:"italic",filter:"none"},{tag:Zn.tags.keyword,color:"var(--cm-color-keyword)"},{tag:Zn.tags.variableName,color:"var(--cm-color-var)",fontWeight:700},{tag:Zn.tags.typeName,color:"var(--cm-color-type)",fontStyle:"italic"},{tag:Zn.tags.typeOperator,color:"var(--cm-color-type)",fontStyle:"italic"},{tag:Zn.tags.tagName,color:"var(--cm-color-tag)"},{tag:Zn.tags.propertyName,color:"var(--cm-color-property)"},{tag:Zn.tags.macroName,color:"var(--cm-color-macro)",fontWeight:700},{tag:Zn.tags.string,color:"var(--cm-color-string)"},{tag:Zn.tags.number,color:"var(--cm-color-number)"},{tag:Zn.tags.bool,color:"var(--cm-color-builtin)",fontWeight:700},{tag:Zn.tags.atom,color:"var(--cm-color-atom)"},{tag:Zn.tags.unit,color:"var(--cm-color-tag)"},{tag:Zn.tags.bracket,color:"var(--cm-color-bracket)"},{tag:Zn.tags.special(Zn.tags.brace),color:"var(--cm-color-macro)",fontWeight:700}],vi=Zn.HighlightStyle.define(bi,{all:{color:"var(--cm-color-editor-text)"},scope:Zn.julia_andrey().language}),yi=Zn.HighlightStyle.define(bi,{all:{color:"var(--cm-color-editor-text)",filter:"contrast(0.5)"},scope:Zn.javascriptLanguage}),wi=Zn.HighlightStyle.define(bi,{all:{color:"var(--cm-color-editor-text)",filter:"contrast(0.5)"},scope:Zn.pythonLanguage}),ki=Zn.HighlightStyle.define([{tag:Zn.tags.comment,color:"var(--cm-color-comment)",fontStyle:"italic"},{tag:Zn.tags.variableName,color:"var(--cm-color-css-accent)",fontWeight:700},{tag:Zn.tags.propertyName,color:"var(--cm-color-css-accent)",fontWeight:700},{tag:Zn.tags.tagName,color:"var(--cm-color-css)",fontWeight:700},{tag:Zn.tags.definitionOperator,color:"var(--cm-color-css)"},{tag:Zn.tags.keyword,color:"var(--cm-color-css)"},{tag:Zn.tags.modifier,color:"var(--cm-color-css-accent)"},{tag:Zn.tags.literal,color:"var(--cm-color-css)"},{tag:Zn.tags.punctuation,opacity:.5}],{scope:Zn.cssLanguage,all:{color:"var(--cm-color-css)"}}),Ei=Zn.HighlightStyle.define([{tag:Zn.tags.comment,color:"var(--cm-color-comment)",fontStyle:"italic"},{tag:Zn.tags.content,color:"var(--cm-color-html)",fontWeight:400},{tag:Zn.tags.tagName,color:"var(--cm-color-html-accent)",fontWeight:600},{tag:Zn.tags.documentMeta,color:"var(--cm-color-html-accent)"},{tag:Zn.tags.attributeName,color:"var(--cm-color-html-accent)",fontWeight:600},{tag:Zn.tags.attributeValue,color:"var(--cm-color-html-accent)"},{tag:Zn.tags.angleBracket,color:"var(--cm-color-html-accent)",fontWeight:600,opacity:.7}],{all:{color:"var(--cm-color-html)"},scope:Zn.htmlLanguage}),$i=Zn.HighlightStyle.define([{tag:Zn.tags.comment,color:"var(--cm-color-comment)",fontStyle:"italic"},{tag:Zn.tags.content,color:"var(--cm-color-md)"},{tag:Zn.tags.heading,color:"var(--cm-color-md)",fontWeight:700},{tag:Zn.tags.quote,color:"var(--cm-color-md)"},{tag:Zn.tags.emphasis,fontStyle:"italic"},{tag:Zn.tags.strong,fontWeight:"bolder"},{tag:Zn.tags.link,textDecoration:"underline"},{tag:Zn.tags.url,color:"var(--cm-color-md)",textDecoration:"none"},{tag:Zn.tags.monospace,color:"var(--cm-color-md-accent)"},{tag:Zn.tags.processingInstruction,color:"var(--cm-color-md-accent) !important",opacity:"0.5"}],{all:{color:"var(--cm-color-md)"},scope:Zn.markdownLanguage}),xi=e=>e.state.doc.toString(),Si=(e,t)=>e.dispatch({changes:{from:0,to:e.state.doc.length,insert:t}}),Ni=(e,t,n,o)=>e.dispatch({changes:{from:n,to:o,insert:t}});let Ci=(e,t)=>{let n=i.useRef(new Zn.Compartment),o=i.useRef(n.current.of(t));return i.useLayoutEffect((()=>{var o,a;null===(o=e.current)||void 0===o||null===(a=o.dispatch)||void 0===a||a.call(o,{effects:n.current.reconfigure(t)})}),[t]),o.current},Ai=(e,{line:t,ch:n})=>{let o=e.line(ce.default.clamp(t+1,1,e.lines)),a=ce.default.clamp(n,0,o.length);return o.from+a};const Mi=({local_code:e,remote_code:t,disable_input:n,focus_after_creation:o,cm_forced_focus:a,set_cm_forced_focus:r,show_input:s,skip_static_fake:l=!1,on_submit:c,on_delete:d,on_add_after:u,on_change:p,on_update_doc_query:m,on_focus_neighbor:h,on_line_heights:g,nbpkg:f,cell_id:_,notebook_id:b,any_logs:v,show_logs:y,set_show_logs:w,set_cell_disabled:k,cm_highlighted_line:E,cm_highlighted_range:$,metadata:x,global_definition_locations:S,cm_diagnostics:N})=>{let C=i.useContext(ye);const{disabled:A,skip_as_script:M}=x;let[O,T]=i.useState(null);if(O){const e=O;throw T(null),e}const R=i.useRef(b);R.current=b;const L=i.useRef(null),D=i.useRef(null),I=i.useRef(null);let P=Ci(L,Br.of(f)),j=Ci(L,ha.of(S)),B=Ci(L,ni.of(E)),U=Ci(L,oi.of($)),F=Ci(L,Zn.EditorState.readOnly.of(n)),z=Ci(L,i.useMemo((()=>Zn.EditorView.updateListener.of((e=>{e.docChanged&&p(e.state.doc.toString())}))),[p]));const[q,H]=i.useState(!l),G=i.useRef(!1);G.current||=navigator.userAgent.includes("Firefox")||o||null!=a||l;const W=!G.current&&q;return i.useLayoutEffect((()=>{if(!W)return;let e,t=D.current;if(null==t)return;const n=()=>{H(!1),e.disconnect(),window.removeEventListener("beforeprint",n)};return e=new IntersectionObserver((e=>{e.some((e=>e.isIntersecting))&&n()})),e.observe(t),window.addEventListener("beforeprint",n),()=>{e.disconnect(),window.removeEventListener("beforeprint",n)}}),[]),i.useLayoutEffect((()=>{if(W)return;if(null==D.current)return;const t=e=>(Zn.autocomplete.closeCompletion(e),(async e=>{await e()})((async()=>{await u();e.state.doc.toString()!==I.current&&c()})),!0);let n=Zn.autocomplete.completionKeymap.find((e=>"Enter"===e.key));const a=()=>{const e=L.current,t=xi(e),n=t.trim(),o=t.length-t.trimStart().length;if(console.table({value:t,trimmed:n,offset:o}),n.startsWith('md"')&&n.endsWith('"')){let t,a;if(n.startsWith('md"""')&&n.endsWith('"""')?(t=5,a=n.length-3):(t=3,a=n.length-1),t>=a||""==n.substring(t,a).trim())Si(e,"");else{for(;/\s/.test(n[t]);)++t;for(;/\s/.test(n[a-1]);)--a;Ni(e,"",a+o,e.state.doc.length),Ni(e,"",0,t+o)}}else{let t='md"""\n',n='\n"""',o=e.state.selection.main;e.dispatch({changes:[{from:0,to:0,insert:t},{from:e.state.doc.length,to:e.state.doc.length,insert:n}],selection:0===o.from?{anchor:o.from+t.length,head:o.to+t.length}:void 0})}return!0},i=e=>!e.state.facet(Zn.EditorState.readOnly)&&(0===e.state.doc.length&&(h(_,1),d(),!0)),s=e=>!e.state.facet(Zn.EditorState.readOnly)&&(0===e.state.doc.length&&(h(_,-1,1/0,1/0),d(),!0)),l=(e,t)=>{if(e.state.facet(Zn.EditorState.readOnly))return!1;const n=e.state.selection.main;return 0===n.anchor&&n.head===e.state.doc.length||1===e.state.doc.lines?(C.move_remote_cells([_],C.get_notebook().cell_order.indexOf(_)+(-1===t?-1:2)),requestIdleCallback((()=>{e.dispatch({selection:{anchor:0,head:e.state.doc.length},scrollIntoView:!0}),e.focus()})),!0):1===t?Zn.moveLineDown(e):Zn.moveLineUp(e)},p=(e,t)=>(r(!0),C.fold_remote_cells([_],t),!0),f=[{key:"Shift-Enter",run:e=>(Zn.autocomplete.closeCompletion(e),c(),!0)},{key:"Ctrl-Enter",mac:"Cmd-Enter",run:t},{key:"Ctrl-Enter",run:t},{key:"Tab",run:e=>{var t;if(e.state.readOnly)return!1;if(null==n||null===(t=n.run)||void 0===t?void 0:t.call(n,e))return!0;let o=e.state.selection.main;return o.empty?(e.dispatch({changes:{from:o.from,to:o.to,insert:"\t"},selection:Zn.EditorSelection.cursor(o.from+1)}),!0):Zn.indentMore(e)},shift:Zn.indentLess},{key:"Ctrl-m",mac:"Cmd-m",run:a},{key:"Ctrl-m",run:a},{key:"Ctrl-M",run:a},{key:"Delete",run:i},{key:"Ctrl-Delete",run:i},{key:"Backspace",run:s},{key:"Ctrl-Backspace",run:s},{key:"Alt-ArrowUp",run:e=>l(e,-1)},{key:"Alt-ArrowDown",run:e=>l(e,1)},{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>p(0,!0)},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>p(0,!1)},mi];let b=!1;const v=Zn.EditorView.updateListener.of((e=>{if(e.view.hasFocus&&(e.docChanged||e.selectionSet)){let t=e.state;try{let e=ua(t,b);null!=e&&m(e)}finally{}}})),y=Zn.EditorView.updateListener.of((e=>{if(e.docChanged){const t=[...e.startState.field(ia).definitions.keys()],n=[...e.state.field(ia).definitions.keys()];ce.default.isEqual(t,n)||C.set_unsubmitted_global_definitions(_,n)}})),w=window.matchMedia("(prefers-color-scheme: dark)").matches,k=L.current=new Zn.EditorView({state:Zn.EditorState.create({doc:e,extensions:[Zn.EditorView.theme({},{dark:w}),P,B,U,j,F,ai(),ri(),Hr,Ur({pluto_actions:C,notebook_id_ref:R}),ia,Zn.syntaxHighlighting(vi),Zn.syntaxHighlighting(Ei),Zn.syntaxHighlighting($i),Zn.syntaxHighlighting(yi),Zn.syntaxHighlighting(wi),Zn.syntaxHighlighting(ki),Zn.lineNumbers(),Zn.highlightSpecialChars(),Zn.history(),Zn.drawSelection(),Zn.EditorState.allowMultipleSelections.of(!0),Zn.EditorView.clickAddsSelectionRange.of((e=>e.altKey&&!e.shiftKey)),Zn.indentOnInput(),Zn.EditorState.languageData.of(((e,t,n)=>[{closeBrackets:{brackets:["(","[","{"]}}])),Zn.closeBrackets(),Zn.rectangularSelection({eventFilter:e=>e.altKey&&e.shiftKey&&0==e.button}),Zn.highlightSelectionMatches({minSelectionLength:2,wholeWords:!0}),Yr(),v,y,hi.tab_help_plugin,Zn.EditorView.domEventHandlers({blur:(e,t)=>{document.activeElement===t.contentDOM||(setTimeout((()=>{t.dispatch({selection:{anchor:t.state.selection.main.head},scrollIntoView:!1}),t.contentDOM.blur()}),0),r(null))}}),Wr({pluto_actions:C,cell_id:_}),Zn.EditorView.updateListener.of((e=>{e.docChanged&&e.state.doc.length>0&&"?"===e.state.sliceDoc(0,1)&&rn("docs")})),Zn.EditorState.tabSize.of(4),Zn.indentUnit.of("\t"),...gi?[$a(),Zn.markdown({defaultCodeLanguage:$a()}),Zn.html(),Zn.javascript(),Zn.python(),va]:[Zn.julia_andrey()],ga,Za({request_autocomplete:async({text:e})=>{let t=await de.timeout_promise(C.send("complete",{query:e},{notebook_id:R.current}),5e3).catch(console.warn);if(!t)return null;let{message:n}=t;return{start:Vn.utf8index_to_ut16index(e,n.start),stop:Vn.utf8index_to_ut16index(e,n.stop),results:n.results}},request_special_symbols:()=>C.send("complete_symbols").then((({message:e})=>e)),on_update_doc_query:m,request_unsubmitted_global_definitions:()=>C.get_unsubmitted_global_definitions(),cell_id:_}),Zn.keymap.of(f),Zn.keymap.of(ci),Gr({focus_on_neighbor:({cell_delta:e,line:t,character:n})=>h(_,e,t,n)}),Zn.keymap.of([...Zn.closeBracketsKeymap,...Zn.defaultKeymap,...Zn.historyKeymap,...Zn.foldKeymap]),Zn.placeholder("Enter cell code..."),Zn.EditorView.contentAttributes.of({spellcheck:String(fi)}),Zn.EditorView.lineWrapping,qr,Zn.EditorView.updateListener.of((e=>{e.docChanged&&e.view.dispatch(Zn.setDiagnostics(e.state,[]))})),z,Zn.EditorView.exceptionSink.of((e=>{T(e),console.error("EditorView exception!",e)}))]}),parent:D.current});k.dom.CodeMirror={getValue:()=>xi(k),setValue:e=>Si(k,e)},o&&setTimeout((()=>{let e=L.current;null!=e&&(e.dom.scrollIntoView({behavior:"smooth",block:"nearest"}),e.dispatch({selection:{anchor:e.state.doc.length,head:e.state.doc.length},effects:[hi.LastFocusWasForcedEffect.of(!0)]}),e.focus())}));const E=D.current.querySelector("div.cm-content");if(E){const e=new ResizeObserver((()=>{const e=E.children,t=ce.default.map(e,(e=>e.offsetTop)),n=[...t.slice(1).map(((e,n)=>e-t[n])),15];g(n)}));return e.observe(E),()=>{e.unobserve(E)}}}),[W]),i.useEffect((()=>{if(null==L.current)return;const e=L.current,t=N;e.dispatch(Zn.setDiagnostics(e.state,t))}),[N]),i.useEffect((()=>{if(null==L.current)return;const e=xi(L.current)??"";null==I.current&&""===t&&""!==e||(I.current=t,e!==t&&Si(L.current,t))}),[t]),i.useEffect((()=>{const e=L.current;if(null!=e)if(null==a)e.dispatch({selection:{anchor:e.state.selection.main.head,head:e.state.selection.main.head}});else if(!0===a);else{let n={anchor:Ai(e.state.doc,a[0]),head:Ai(e.state.doc,a[1])};if(null===(t=a[2])||void 0===t?void 0:t.definition_of){var t;let o=e.state.field(ia),r=null==o?void 0:o.definitions.get(null===(t=a[2])||void 0===t?void 0:t.definition_of);r&&(n={anchor:r.from,head:r.to})}e.dom.scrollIntoView({behavior:"smooth",block:"nearest"}),e.focus(),e.dispatch({scrollIntoView:!0,selection:n,effects:[Zn.EditorView.scrollIntoView(Zn.EditorSelection.range(n.anchor,n.head),{yMargin:80}),hi.LastFocusWasForcedEffect.of(!0)]})}}),[a]),i.html` + + ${W&&s?i.html`<${Li} value=${t} />`:null} + <${Ti} + on_delete=${d} + cell_id=${_} + run_cell=${c} + skip_as_script=${M} + running_disabled=${A} + any_logs=${v} + show_logs=${y} + set_show_logs=${w} + set_cell_disabled=${k} + /> + ${Oi} + + `},Oi=i.html`
👀 Reading hidden code
`,Ti=({on_delete:e,cell_id:t,run_cell:n,skip_as_script:o,running_disabled:a,any_logs:r,show_logs:s,set_show_logs:l,set_cell_disabled:c})=>{const d=i.useRef(null);let u=i.useContext(ye);const[p,m]=i.useState(!1),h=i.useRef(null),g=i.useRef(null),f=i.useRef(null),_=e=>{e&&(f.current=document.activeElement),m(e)};i.useLayoutEffect((()=>{var e,t;if(p)null===(t=null===(e=g.current)||void 0===e?void 0:e.querySelector("button"))||void 0===t||t.focus();else{let e=f.current;e instanceof HTMLElement&&e.focus()}}),[p]);return an.useEventListener(window,"keydown",(e=>{"Escape"===e.key&&_(!1)}),[]),i.html` + +
{var t,n;((null===(t=g.current)||void 0===t?void 0:t.matches(":focus-within"))||(null===(n=g.current)||void 0===n?void 0:n.contains(e.relatedTarget)))&&e.relatedTarget!==g.current||_(!1)}} + > + ${p?i.html`
    {d.current&&clearTimeout(d.current)}}> + <${Ri} tag="delete" contents="Delete cell" title="Delete cell" onClick=${e} setOpen=${_} /> + + <${Ri} + title=${a?"Enable and run the cell":"Disable this cell, and all cells that depend on it"} + tag=${a?"enable_cell":"disable_cell"} + contents=${a?i.html`Enable cell`:i.html`Disable cell`} + onClick=${async e=>{const t=!a;await c(t)}} + setOpen=${_} + /> + ${r?i.html`<${Ri} + title=${s?"Show cell logs":"Hide cell logs"} + tag=${s?"hide_logs":"show_logs"} + contents=${s?"Hide logs":"Show logs"} + onClick=${()=>l(!s)} + setOpen=${_} + />`:null} + ${(()=>{var e;let n=u.get_notebook(),o=null==n||null===(e=n.cell_results)||void 0===e?void 0:e[t];return!!o&&!o.errored&&!o.queued&&"text/plain"===o.output.mime&&o.output.body})()?i.html`<${Ri} + tag="copy_output" + contents="Copy output" + title="Copy the output of this cell to the clipboard." + onClick=${()=>{var e,n;let o=u.get_notebook(),a=(null==o||null===(e=o.cell_results)||void 0===e||null===(n=e[t])||void 0===n?void 0:n.output.body)??"";a&&navigator.clipboard.writeText(a).catch((e=>{alert("Error copying cell output")}))}} + setOpen=${_} + />`:null} + + <${Ri} + title=${o?"This cell is currently stored in the notebook file as a Julia comment. Click here to disable.":"Store this code in the notebook file as a Julia comment. This way, it will not run when the notebook runs as a script outside of Pluto."} + tag=${o?"run_as_script":"skip_as_script"} + contents=${o?i.html`Enable in file`:i.html`Disable in file`} + onClick=${async e=>{const n=!o;e.preventDefault(),await u.update_notebook((e=>{e.cell_inputs[t].metadata.skip_as_script=n}))}} + setOpen=${_} + /> +
`:i.html``} +
+ `},Ri=({contents:e,title:t,onClick:n,setOpen:o,tag:a})=>i.html`
  • + +
  • `,Li=({value:e})=>{const t=e.split("\n").map(((e,t)=>{const n=Fr(e),o=0==n.length?e:i.html`${n}${e.substring(n.length)}`;return i.html`
    + ${0===e.length?i.html`
    `:o} +
    `}));return i.html` +
    +
    + +
    + ${t} +
    +
    +
    + `}; +/*! + Highlight.js v11.9.0 (git: f47103d4f1) + (c) 2006-2023 undefined and other contributors + License: BSD-3-Clause + */ +function Di(e){return e instanceof Map?e.clear=e.delete=e.set=()=>{throw Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=()=>{throw Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((t=>{const n=e[t],o=typeof n;"object"!==o&&"function"!==o||Object.isFrozen(n)||Di(n)})),e}class Ii{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Pi(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function ji(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t];return t.forEach((e=>{for(const t in e)n[t]=e[t]})),n}const Bi=e=>!!e.scope;class Ui{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=Pi(e)}openNode(e){if(!Bi(e))return;const t=((e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ")}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){Bi(e)&&(this.buffer+="")}value(){return this.buffer}span(e){this.buffer+=``}}const Fi=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class zi{constructor(){this.rootNode=Fi(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=Fi({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{zi._collapse(e)})))}}class qi extends zi{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const n=e.root;t&&(n.scope="language:"+t),this.add(n)}toHTML(){return new Ui(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Hi(e){return e?"string"==typeof e?e:e.source:null}function Gi(e){return Zi("(?=",e,")")}function Wi(e){return Zi("(?:",e,")*")}function Ki(e){return Zi("(?:",e,")?")}function Zi(...e){return e.map((e=>Hi(e))).join("")}function Vi(...e){const t=(e=>{const t=e[e.length-1];return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}})(e);return"("+(t.capture?"":"?:")+e.map((e=>Hi(e))).join("|")+")"}function Qi(e){return RegExp(e.toString()+"|").exec("").length-1}const Xi=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Yi(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n;let o=Hi(e),a="";for(;o.length>0;){const e=Xi.exec(o);if(!e){a+=o;break}a+=o.substring(0,e.index),o=o.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?a+="\\"+(Number(e[1])+t):(a+=e[0],"("===e[0]&&n++)}return a})).map((e=>`(${e})`)).join(t)}const Ji={begin:"\\\\[\\s\\S]",relevance:0},es={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ji]},ts={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ji]},ns=(e,t,n={})=>{const o=ji({scope:"comment",begin:e,end:t,contains:[]},n);o.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const a=Vi("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return o.contains.push({begin:Zi(/[ ]+/,"(",a,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),o},os=ns("//","$"),as=ns("/\\*","\\*/"),rs=ns("#","$");var is=Object.freeze({__proto__:null,APOS_STRING_MODE:es,BACKSLASH_ESCAPE:Ji,BINARY_NUMBER_MODE:{scope:"number",begin:"\\b(0b[01]+)",relevance:0},BINARY_NUMBER_RE:"\\b(0b[01]+)",COMMENT:ns,C_BLOCK_COMMENT_MODE:as,C_LINE_COMMENT_MODE:os,C_NUMBER_MODE:{scope:"number",begin:"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",relevance:0},C_NUMBER_RE:"(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",END_SAME_AS_BEGIN:e=>Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}}),HASH_COMMENT_MODE:rs,IDENT_RE:"[a-zA-Z]\\w*",MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},NUMBER_MODE:{scope:"number",begin:"\\b\\d+(\\.\\d+)?",relevance:0},NUMBER_RE:"\\b\\d+(\\.\\d+)?",PHRASAL_WORDS_MODE:{begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},QUOTE_STRING_MODE:ts,REGEXP_MODE:{scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ji,{begin:/\[/,end:/\]/,relevance:0,contains:[Ji]}]},RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG:(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Zi(t,/.*\b/,e.binary,/\b.*/)),ji({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},TITLE_MODE:{scope:"title",begin:"[a-zA-Z]\\w*",relevance:0},UNDERSCORE_IDENT_RE:"[a-zA-Z_]\\w*",UNDERSCORE_TITLE_MODE:{scope:"title",begin:"[a-zA-Z_]\\w*",relevance:0}});function ss(e,t){"."===e.input[e.index-1]&&t.ignoreMatch()}function ls(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function cs(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=ss,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function ds(e,t){Array.isArray(e.illegal)&&(e.illegal=Vi(...e.illegal))}function us(e,t){if(e.match){if(e.begin||e.end)throw Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function ps(e,t){void 0===e.relevance&&(e.relevance=1)}const ms=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t]})),e.keywords=n.keywords,e.begin=Zi(n.beforeMatch,Gi(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},hs=["of","and","for","in","not","or","if","then","parent","list","value"];function gs(e,t,n="keyword"){const o=Object.create(null);function a(e,n){t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((t=>{const n=t.split("|");o[n[0]]=[e,fs(n[0],n[1])]}))}return"string"==typeof e?a(n,e.split(" ")):Array.isArray(e)?a(n,e):Object.keys(e).forEach((n=>{Object.assign(o,gs(e[n],t,n))})),o}function fs(e,t){return t?Number(t):(e=>hs.includes(e.toLowerCase()))(e)?0:1}const _s={},bs=e=>{console.error(e)},vs=(e,...t)=>{console.log("WARN: "+e,...t)},ys=(e,t)=>{_s[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),_s[`${e}/${t}`]=!0)},ws=Error();function ks(e,t,{key:n}){let o=0;const a=e[n],r={},i={};for(let e=1;e<=t.length;e++)i[e+o]=a[e],r[e+o]=!0,o+=Qi(t[e-1]);e[n]=i,e[n]._emit=r,e[n]._multi=!0}function Es(e){(e=>{e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope}),(e=>{if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw bs("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ws;if("object"!=typeof e.beginScope||null===e.beginScope)throw bs("beginScope must be object"),ws;ks(e,e.begin,{key:"beginScope"}),e.begin=Yi(e.begin,{joinWith:""})}})(e),(e=>{if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw bs("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ws;if("object"!=typeof e.endScope||null===e.endScope)throw bs("endScope must be object"),ws;ks(e,e.end,{key:"endScope"}),e.end=Yi(e.end,{joinWith:""})}})(e)}function $s(e){function t(t,n){return RegExp(Hi(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=Qi(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map((e=>e[1]));this.matcherRe=t(Yi(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),o=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,o)}}class o{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=ji(e.classNameAliases||{}),function n(a,r){const i=a;if(a.isCompiled)return i;[ls,us,Es,ms].forEach((e=>e(a,r))),e.compilerExtensions.forEach((e=>e(a,r))),a.__beforeBegin=null,[cs,ds,ps].forEach((e=>e(a,r))),a.isCompiled=!0;let s=null;return"object"==typeof a.keywords&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),s=a.keywords.$pattern,delete a.keywords.$pattern),s=s||/\w+/,a.keywords&&(a.keywords=gs(a.keywords,e.case_insensitive)),i.keywordPatternRe=t(s,!0),r&&(a.begin||(a.begin=/\B|\b/),i.beginRe=t(i.begin),a.end||a.endsWithParent||(a.end=/\B|\b/),a.end&&(i.endRe=t(i.end)),i.terminatorEnd=Hi(i.end)||"",a.endsWithParent&&r.terminatorEnd&&(i.terminatorEnd+=(a.end?"|":"")+r.terminatorEnd)),a.illegal&&(i.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>ji(e,{variants:null},t)))),e.cachedVariants?e.cachedVariants:xs(e)?ji(e,{starts:e.starts?ji(e.starts):null}):Object.isFrozen(e)?ji(e):e))("self"===e?a:e)))),a.contains.forEach((e=>{n(e,i)})),a.starts&&n(a.starts,r),i.matcher=(e=>{const t=new o;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin"}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(i),i}(e)}function xs(e){return!!e&&(e.endsWithParent||xs(e.starts))}class Ss extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const Ns=Pi,Cs=ji,As=Symbol("nomatch"),Ms=e=>{const t=Object.create(null),n=Object.create(null),o=[];let a=!0;const r="Could not find the language '{}', did you forget to load/include a language module?",i={disableAutodetect:!0,name:"Plain text",contains:[]};let s={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:qi};function l(e){return s.noHighlightRe.test(e)}function c(e,t,n){let o="",a="";"object"==typeof t?(o=e,n=t.ignoreIllegals,a=t.language):(ys("10.7.0","highlight(lang, code, ...args) has been deprecated."),ys("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),a=e,o=t),void 0===n&&(n=!0);const r={code:o,language:a};b("before:highlight",r);const i=r.result?r.result:d(r.language,r.code,n);return i.code=r.code,b("after:highlight",i),i}function d(e,n,o,i){const l=Object.create(null);function c(){if(!x.keywords)return void N.addText(C);let e=0;x.keywordPatternRe.lastIndex=0;let t=x.keywordPatternRe.exec(C),n="";for(;t;){n+=C.substring(e,t.index);const a=k.case_insensitive?t[0].toLowerCase():t[0],r=(o=a,x.keywords[o]);if(r){const[e,o]=r;if(N.addText(n),n="",l[a]=(l[a]||0)+1,l[a]<=7&&(A+=o),e.startsWith("_"))n+=t[0];else{const n=k.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=x.keywordPatternRe.lastIndex,t=x.keywordPatternRe.exec(C)}var o;n+=C.substring(e),N.addText(n)}function p(){null!=x.subLanguage?(()=>{if(""===C)return;let e=null;if("string"==typeof x.subLanguage){if(!t[x.subLanguage])return void N.addText(C);e=d(x.subLanguage,C,!0,S[x.subLanguage]),S[x.subLanguage]=e._top}else e=u(C,x.subLanguage.length?x.subLanguage:null);x.relevance>0&&(A+=e.relevance),N.__addSublanguage(e._emitter,e.language)})():c(),C=""}function m(e,t){""!==e&&(N.startScope(t),N.addText(e),N.endScope())}function h(e,t){let n=1;const o=t.length-1;for(;n<=o;){if(!e._emit[n]){n++;continue}const o=k.classNameAliases[e[n]]||e[n],a=t[n];o?m(a,o):(C=a,c(),C=""),n++}}function f(e,t){return e.scope&&"string"==typeof e.scope&&N.openNode(k.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(C,k.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),C=""):e.beginScope._multi&&(h(e.beginScope,t),C="")),x=Object.create(e,{parent:{value:x}}),x}function _(e,t,n){let o=((e,t)=>{const n=e&&e.exec(t);return n&&0===n.index})(e.endRe,n);if(o){if(e["on:end"]){const n=new Ii(e);e["on:end"](t,n),n.isMatchIgnored&&(o=!1)}if(o){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function b(e){return 0===x.matcher.regexIndex?(C+=e[0],1):(T=!0,0)}function v(e){const t=e[0],o=n.substring(e.index),a=_(x,e,o);if(!a)return As;const r=x;x.endScope&&x.endScope._wrap?(p(),m(t,x.endScope._wrap)):x.endScope&&x.endScope._multi?(p(),h(x.endScope,e)):r.skip?C+=t:(r.returnEnd||r.excludeEnd||(C+=t),p(),r.excludeEnd&&(C=t));do{x.scope&&N.closeNode(),x.skip||x.subLanguage||(A+=x.relevance),x=x.parent}while(x!==a.parent);return a.starts&&f(a.starts,e),r.returnEnd?0:t.length}let y={};function w(t,r){const i=r&&r[0];if(C+=t,null==i)return p(),0;if("begin"===y.type&&"end"===r.type&&y.index===r.index&&""===i){if(C+=n.slice(r.index,r.index+1),!a){const t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=y.rule,t}return 1}if(y=r,"begin"===r.type)return(e=>{const t=e[0],n=e.rule,o=new Ii(n),a=[n.__beforeBegin,n["on:begin"]];for(const n of a)if(n&&(n(e,o),o.isMatchIgnored))return b(t);return n.skip?C+=t:(n.excludeBegin&&(C+=t),p(),n.returnBegin||n.excludeBegin||(C=t)),f(n,e),n.returnBegin?0:t.length})(r);if("illegal"===r.type&&!o){const e=Error('Illegal lexeme "'+i+'" for mode "'+(x.scope||"")+'"');throw e.mode=x,e}if("end"===r.type){const e=v(r);if(e!==As)return e}if("illegal"===r.type&&""===i)return 1;if(O>1e5&&O>3*r.index)throw Error("potential infinite loop, way more iterations than matches");return C+=i,i.length}const k=g(e);if(!k)throw bs(r.replace("{}",e)),Error('Unknown language: "'+e+'"');const E=$s(k);let $="",x=i||E;const S={},N=new s.__emitter(s);(()=>{const e=[];for(let t=x;t!==k;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach((e=>N.openNode(e)))})();let C="",A=0,M=0,O=0,T=!1;try{if(k.__emitTokens)k.__emitTokens(n,N);else{for(x.matcher.considerAll();;){O++,T?T=!1:x.matcher.considerAll(),x.matcher.lastIndex=M;const e=x.matcher.exec(n);if(!e)break;const t=w(n.substring(M,e.index),e);M=e.index+t}w(n.substring(M))}return N.finalize(),$=N.toHTML(),{language:e,value:$,relevance:A,illegal:!1,_emitter:N,_top:x}}catch(t){if(t.message&&t.message.includes("Illegal"))return{language:e,value:Ns(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:M,context:n.slice(M-100,M+100),mode:t.mode,resultSoFar:$},_emitter:N};if(a)return{language:e,value:Ns(n),illegal:!1,relevance:0,errorRaised:t,_emitter:N,_top:x};throw t}}function u(e,n){n=n||s.languages||Object.keys(t);const o=(e=>{const t={value:Ns(e),illegal:!1,relevance:0,_top:i,_emitter:new s.__emitter(s)};return t._emitter.addText(e),t})(e),a=n.filter(g).filter(_).map((t=>d(t,e,!1)));a.unshift(o);const r=a.sort(((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(g(e.language).supersetOf===t.language)return 1;if(g(t.language).supersetOf===e.language)return-1}return 0})),[l,c]=r,u=l;return u.secondBest=c,u}function p(e){let t=null;const o=(e=>{let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=s.languageDetectRe.exec(t);if(n){const t=g(n[1]);return t||(vs(r.replace("{}",n[1])),vs("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find((e=>l(e)||g(e)))})(e);if(l(o))return;if(b("before:highlightElement",{el:e,language:o}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(s.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),s.throwUnescapedHTML))throw new Ss("One of your code blocks includes unescaped HTML.",e.innerHTML);t=e;const a=t.textContent,i=o?c(a,{language:o,ignoreIllegals:!0}):u(a);e.innerHTML=i.value,e.dataset.highlighted="yes",((e,t,o)=>{const a=t&&n[t]||o;e.classList.add("hljs"),e.classList.add("language-"+a)})(e,o,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),b("after:highlightElement",{el:e,result:i,text:a})}let m=!1;function h(){"loading"!==document.readyState?document.querySelectorAll(s.cssSelector).forEach(p):m=!0}function g(e){return e=(e||"").toLowerCase(),t[e]||t[n[e]]}function f(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{n[e.toLowerCase()]=t}))}function _(e){const t=g(e);return t&&!t.disableAutodetect}function b(e,t){const n=e;o.forEach((e=>{e[n]&&e[n](t)}))}"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{m&&h()}),!1),Object.assign(e,{highlight:c,highlightAuto:u,highlightAll:h,highlightElement:p,highlightBlock:e=>(ys("10.7.0","highlightBlock will be removed entirely in v12.0"),ys("10.7.0","Please use highlightElement now."),p(e)),configure:e=>{s=Cs(s,e)},initHighlighting:()=>{h(),ys("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")},initHighlightingOnLoad:()=>{h(),ys("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")},registerLanguage:(n,o)=>{let r=null;try{r=o(e)}catch(e){if(bs("Language definition for '{}' could not be registered.".replace("{}",n)),!a)throw e;bs(e),r=i}r.name||(r.name=n),t[n]=r,r.rawDefinition=o.bind(null,e),r.aliases&&f(r.aliases,{languageName:n})},unregisterLanguage:e=>{delete t[e];for(const t of Object.keys(n))n[t]===e&&delete n[t]},listLanguages:()=>Object.keys(t),getLanguage:g,registerAliases:f,autoDetection:_,inherit:Cs,addPlugin:e=>{(e=>{e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})})(e),o.push(e)},removePlugin:e=>{const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}),e.debugMode=()=>{a=!1},e.safeMode=()=>{a=!0},e.versionString="11.9.0",e.regex={concat:Zi,lookahead:Gi,either:Vi,optional:Ki,anyNumberOfTimes:Wi};for(const e in is)"object"==typeof is[e]&&Di(is[e]);return Object.assign(e,is),e},Os=Ms({});Os.newInstance=()=>Ms({});var Ts=Os;const Rs=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Ls=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Ds=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],Is=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],Ps=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],js=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse(),Bs=Is.concat(Ps);var Us={className:"number",variants:[{begin:"(\\b([0-9](_*[0-9])*)((\\.([0-9](_*[0-9])*))|\\.)?|(\\.([0-9](_*[0-9])*)))[eE][+-]?([0-9](_*[0-9])*)[fFdD]?\\b"},{begin:"\\b([0-9](_*[0-9])*)((\\.([0-9](_*[0-9])*))[fFdD]?\\b|\\.([fFdD]\\b)?)"},{begin:"(\\.([0-9](_*[0-9])*))[fFdD]?\\b"},{begin:"\\b([0-9](_*[0-9])*)[fFdD]\\b"},{begin:"\\b0[xX](([0-9a-fA-F](_*[0-9a-fA-F])*)\\.?|([0-9a-fA-F](_*[0-9a-fA-F])*)?\\.([0-9a-fA-F](_*[0-9a-fA-F])*))[pP][+-]?([0-9](_*[0-9])*)[fFdD]?\\b"},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:"\\b0[xX]([0-9a-fA-F](_*[0-9a-fA-F])*)[lL]?\\b"},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Fs(e,t,n){return-1===n?"":e.replace(t,(o=>Fs(e,t,n-1)))}const zs=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],qs=["true","false","null","undefined","NaN","Infinity"],Hs=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Gs=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Ws=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Ks=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Zs=[].concat(Ws,Hs,Gs);function Vs(e){const t=e.regex,n="[A-Za-z$_][0-9A-Za-z$_]*",o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{const n=e[0].length+e.index,o=e.input[n];if("<"===o||","===o)return void t.ignoreMatch();let a;">"===o&&(((e,{after:t})=>{const n="",N={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(S)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[b]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:_,CLASS_REFERENCE:y},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,d,u,p,m,h,{match:/\$\d+/},l,y,{className:"attr",begin:n+t.lookahead(":"),relevance:0},N,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[h,e.REGEXP_MODE,{className:"function",begin:S,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:_}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:"<>",end:""},{match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},w,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[b,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},$,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[b]},k,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},v,x,{match:/\$[(.]/}]}}const Qs=e=>Zi(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Xs=["Protocol","Type"].map(Qs),Ys=["init","self"].map(Qs),Js=["Any","Self"],el=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],tl=["false","nil","true"],nl=["assignment","associativity","higherThan","left","lowerThan","none","right"],ol=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],al=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],rl=Vi(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),il=Vi(rl,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),sl=Zi(rl,il,"*"),ll=Vi(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),cl=Vi(ll,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),dl=Zi(ll,cl,"*"),ul=Zi(/[A-Z]/,cl,"*"),pl=["attached","autoclosure",Zi(/convention\(/,Vi("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Zi(/objc\(/,dl,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],ml=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];var hl=Object.freeze({__proto__:null,grmr_bash:e=>{const t=e.regex,n={},o={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},o]});const a={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},r={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},i={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,a]};a.contains.push(i);const s={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},l=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10}),c={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:["if","then","else","elif","fi","for","while","until","in","do","done","case","esac","function","select"],literal:["true","false"],built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"]},contains:[l,e.SHEBANG(),c,s,e.HASH_COMMENT_MODE,r,{match:/(\/[a-z._-]+)+/},i,{match:/\\"/},{className:"string",begin:/'/,end:/'/},{match:/\\'/},n]}},grmr_c:e=>{const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",r="("+o+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",i={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},s={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},u=t.optional(a)+e.IDENT_RE+"\\s*\\(",p={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},m=[c,i,n,e.C_BLOCK_COMMENT_MODE,l,s],h={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p,contains:m.concat([{begin:/\(/,end:/\)/,keywords:p,contains:m.concat(["self"]),relevance:0}]),relevance:0},g={begin:"("+r+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[e.inherit(d,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,s,l,i,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,s,l,i]}]},i,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C",aliases:["h"],keywords:p,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:c,strings:s,keywords:p}}},grmr_cpp:e=>{const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),o="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",r="(?!struct)("+o+"|"+t.optional(a)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",i={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},s={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(a)+e.IDENT_RE,relevance:0},u=t.optional(a)+e.IDENT_RE+"\\s*\\(",p={type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"]},m={className:"function.dispatch",relevance:0,keywords:{_hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"]},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},h=[m,c,i,n,e.C_BLOCK_COMMENT_MODE,l,s],g={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:p,contains:h.concat([{begin:/\(/,end:/\)/,keywords:p,contains:h.concat(["self"]),relevance:0}]),relevance:0},f={className:"function",begin:"("+r+"[\\*&\\s]+)+"+u,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:p,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:o,keywords:p,relevance:0},{begin:u,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[s,l]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,s,l,i,{begin:/\(/,end:/\)/,keywords:p,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,s,l,i]}]},i,n,e.C_BLOCK_COMMENT_MODE,c]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:p,illegal:"",keywords:p,contains:["self",i]},{begin:e.IDENT_RE+"::",keywords:p},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}},grmr_csharp:e=>{const t={keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"]),built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],literal:["default","false","null","true"]},n=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),o={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},a={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},r=e.inherit(a,{illegal:/\n/}),i={className:"subst",begin:/\{/,end:/\}/,keywords:t},s=e.inherit(i,{illegal:/\n/}),l={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,s]},c={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},i]},d=e.inherit(c,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},s]});i.contains=[c,l,a,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,o,e.C_BLOCK_COMMENT_MODE],s.contains=[d,l,r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,o,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const u={variants:[c,l,a,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},p={begin:"<",end:">",contains:[{beginKeywords:"in out"},n]},m=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",h={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:t,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"\x3c!--|--\x3e"},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},u,o,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},n,p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[n,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[n,p,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+m+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:t,contains:[{beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial",relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,p],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:t,relevance:0,contains:[u,o,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},h]}},grmr_css:e=>{const t=e.regex,n=Rs(e),o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/},n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Is.join("|")+")"},{begin:":(:)?("+Ps.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+js.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:Ds.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Ls.join("|")+")\\b"}]}},grmr_diff:e=>{const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}},grmr_go:e=>{const t={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:t,illegal:"{const t=e.regex;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(/[_A-Za-z][_0-9A-Za-z]*/,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}},grmr_ini:e=>{const t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},o=e.COMMENT();o.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const a={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},r={className:"literal",begin:/\bon|off|true|false|yes|no\b/},i={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},s={begin:/\[/,end:/\]/,contains:[o,r,a,i,n,"self"],relevance:0},l=t.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[o,{className:"section",begin:/\[+/,end:/\]+/},{begin:t.concat(l,"(\\s*\\.\\s*",l,")*",t.lookahead(/\s*=\s*[^#\s]/)),className:"attr",starts:{end:/$/,contains:[o,s,r,a,i,n]}}]}},grmr_java:e=>{const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",o=n+Fs("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),a={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},r={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},i={className:"params",begin:/\(/,end:/\)/,keywords:a,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:a,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[i,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+o+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:a,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:a,relevance:0,contains:[r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Us,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Us,r]}},grmr_javascript:Vs,grmr_json:e=>{const t=["true","false","null"],n={scope:"literal",beginKeywords:t.join(" ")};return{name:"JSON",keywords:{literal:t},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},e.QUOTE_STRING_MODE,n,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}},grmr_kotlin:e=>{const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},o={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},a={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},r={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[a,o]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,a,o]}]};o.contains.push(r);const i={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},s={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(r,{className:"string"}),"self"]}]},l=Us,c=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},u=d;return u.variants[1].contains=[d],d.variants[1].contains=[u],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,c,{className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},n,i,s,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,c],relevance:0},e.C_LINE_COMMENT_MODE,c,i,s,r,e.C_NUMBER_MODE]},c]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},i,s]},r,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:"\n"},l]}},grmr_less:e=>{const t=Rs(e),n=Bs,o="[\\w-]+",a="("+o+"|@\\{"+o+"\\})",r=[],i=[],s=e=>({className:"string",begin:"~?"+e+".*?"+e}),l=(e,t,n)=>({className:e,begin:t,relevance:n}),c={$pattern:/[a-z-]+/,keyword:"and or not only",attribute:Ds.join(" ")},d={begin:"\\(",end:"\\)",contains:i,keywords:c,relevance:0};i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s("'"),s('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,d,l("variable","@@?"+o,10),l("variable","@\\{"+o+"\\}"),l("built_in","~?`[^`]*?`"),{className:"attribute",begin:o+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const u=i.concat({begin:/\{/,end:/\}/,contains:r}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(i)},m={begin:a+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+js.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:i}}]},h={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:c,returnEnd:!0,contains:i,relevance:0}},g={className:"variable",variants:[{begin:"@"+o+"\\s*:",relevance:15},{begin:"@"+o}],starts:{end:"[;}]",returnEnd:!0,contains:u}},f={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:a,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:"[<='$\"]",relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,l("keyword","all\\b"),l("variable","@\\{"+o+"\\}"),{begin:"\\b("+Ls.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,l("selector-tag",a,0),l("selector-id","#"+a),l("selector-class","\\."+a,0),l("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+Is.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Ps.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:u},{begin:"!important"},t.FUNCTION_DISPATCH]},_={begin:`[\\w-]+:(:)?(${n.join("|")})`,returnBegin:!0,contains:[f]};return r.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,h,g,_,m,f,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:r}},grmr_lua:e=>{const t="\\[=*\\[",n="\\]=*\\]",o={begin:t,end:n,contains:["self"]},a=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[o],relevance:10})];return{name:"Lua",keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:a.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:a}].concat(a)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[o],relevance:5}])}},grmr_makefile:e=>{const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%{const t={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},n={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.regex.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},o={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},a={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},r=e.inherit(o,{contains:[]}),i=e.inherit(a,{contains:[]});o.contains.push(i),a.contains.push(r);let s=[t,n];return[o,a,r,i].forEach((e=>{e.contains=e.contains.concat(s)})),s=s.concat(o,a),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:s},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:s}]}]},t,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o,a,{className:"quote",begin:"^>\\s+",contains:s,end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{begin:"^[-\\*]{3,}",end:"$"},n,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}},grmr_objectivec:e=>{const t=/[a-zA-Z@][a-zA-Z0-9_]*/,n={$pattern:t,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:{"variable.language":["this","super"],$pattern:t,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+n.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:n,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}},grmr_perl:e=>{const t=e.regex,n=/[dualxmsipngr]{0,12}/,o={$pattern:/[\w.]+/,keyword:"abs accept alarm and atan2 bind binmode bless break caller chdir chmod chomp chop chown chr chroot close closedir connect continue cos crypt dbmclose dbmopen defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl fileno flock for foreach fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat lt ma map mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q|0 qq quotemeta qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x|0 xor y|0"},a={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:o},r={begin:/->\{/,end:/\}/},i={variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@][^\s\w{]/,relevance:0}]},s=[e.BACKSLASH_ESCAPE,a,i],l=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],c=(e,o,a="\\1")=>{const r="\\1"===a?a:t.concat(a,o);return t.concat(t.concat("(?:",e,")"),o,/(?:\\.|[^\\\/])*?/,r,/(?:\\.|[^\\\/])*?/,a,n)},d=(e,o,a)=>t.concat(t.concat("(?:",e,")"),o,/(?:\\.|[^\\\/])*?/,a,n),u=[i,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),r,{className:"string",contains:s,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:c("s|tr|y",t.either(...l,{capture:!0}))},{begin:c("s|tr|y","\\(","\\)")},{begin:c("s|tr|y","\\[","\\]")},{begin:c("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:d("(?:m|qr)?",/\//,/\//)},{begin:d("m|qr",t.either(...l,{capture:!0}),/\1/)},{begin:d("m|qr",/\(/,/\)/)},{begin:d("m|qr",/\[/,/\]/)},{begin:d("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return a.contains=u,r.contains=u,{name:"Perl",aliases:["pl","pm"],keywords:o,contains:u}},grmr_php:e=>{const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,o=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),a=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),r={scope:"variable",match:"\\$+"+o},i={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},s=e.inherit(e.APOS_STRING_MODE,{illegal:null}),l="[ \t\n]",c={scope:"string",variants:[e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(i)}),s,{begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(i),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/})]},d={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},u=["false","null","true"],p=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],m=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],h={keyword:p,literal:(e=>{const t=[];return e.forEach((e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())})),t})(u),built_in:m},g=e=>e.map((e=>e.replace(/\|\d+$/,""))),f={variants:[{match:[/new/,t.concat(l,"+"),t.concat("(?!",g(m).join("\\b|"),"\\b)"),a],scope:{1:"keyword",4:"title.class"}}]},_=t.concat(o,"\\b(?!\\()"),b={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),_],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[a,t.concat(/::/,t.lookahead(/(?!class\b)/)),_],scope:{1:"title.class",3:"variable.constant"}},{match:[a,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[a,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},v={scope:"attr",match:t.concat(o,t.lookahead(":"),t.lookahead(/(?!::)/))},y={relevance:0,begin:/\(/,end:/\)/,keywords:h,contains:[v,r,b,e.C_BLOCK_COMMENT_MODE,c,d,f]},w={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",g(p).join("\\b|"),"|",g(m).join("\\b|"),"\\b)"),o,t.concat(l,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[y]};y.contains.push(w);const k=[v,b,e.C_BLOCK_COMMENT_MODE,c,d,f];return{case_insensitive:!1,keywords:h,contains:[{begin:t.concat(/#\[\s*/,a),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:u,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:u,keyword:["new","array"]},contains:["self",...k]},...k,{scope:"meta",match:a}]},e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},{scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},{scope:"variable.language",match:/\$this\b/},r,w,b,{match:[/const/,/\s/,o],scope:{1:"keyword",3:"variable.constant"}},f,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:h,contains:["self",r,b,e.C_BLOCK_COMMENT_MODE,c,d]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},c,d]}},grmr_php_template:e=>({name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}),grmr_plaintext:e=>({name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}),grmr_python:e=>{const t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,o=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:o,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},r={className:"meta",begin:/^(>>>|\.\.\.) /},i={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},s={begin:/\{\{/,relevance:0},l={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,r],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,r],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,r,s,i]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,r,s,i]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,i]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,i]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},c="[0-9](_?[0-9])*",d=`(\\b(${c}))?\\.(${c})|\\b(${c})\\.`,u="\\b|"+o.join("|"),p={className:"number",relevance:0,variants:[{begin:`(\\b(${c})|(${d}))[eE][+-]?(${c})[jJ]?(?=${u})`},{begin:`(${d})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${u})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${u})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${u})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${u})`},{begin:`\\b(${c})[jJ](?=${u})`}]},m={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},h={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",r,p,l,e.HASH_COMMENT_MODE]}]};return i.contains=[l,p,r],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[r,p,{begin:/\bself\b/},{beginKeywords:"if",relevance:0},l,m,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[h]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[p,h,l]}]}},grmr_python_repl:e=>({aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}),grmr_r:e=>{const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,o=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),a=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,r=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[a,o]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,o]},{scope:{1:"punctuation",2:"number"},match:[r,o]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,o]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:a},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}},grmr_ruby:e=>{const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",o=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),a=t.concat(o,/(::\w+)*/),r={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield","include","extend","prepend","public","private","protected","raise","throw"],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},i={className:"doctag",begin:"@[A-Za-z]+"},s={begin:"#<",end:">"},l=[e.COMMENT("#","$",{contains:[i]}),e.COMMENT("^=begin","^=end",{contains:[i],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/,end:/\}/,keywords:r},d={className:"string",contains:[e.BACKSLASH_ESCAPE,c],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,c]})]}]},u="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${u}))?([eE][+-]?(${u})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:r}]},h=[d,{variants:[{match:[/class\s+/,a,/\s+<\s+/,a]},{match:[/\b(class|module)\s+/,a]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:r},{match:[/(include|extend)\s+/,a],scope:{2:"title.class"},keywords:r},{relevance:0,match:[a,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:o,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:n}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:r},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(s,l),relevance:0}].concat(s,l);c.contains=h,m.contains=h;const g=[{begin:/^\s*=>/,starts:{end:"$",contains:h}},{className:"meta.prompt",begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])",starts:{end:"$",keywords:r,contains:h}}];return l.unshift(s),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:r,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(g).concat(l).concat(h)}},grmr_rust:e=>{const t=e.regex,n={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,e.IDENT_RE,t.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],r=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:r,keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","unsafe","unsized","use","virtual","where","while","yield"],literal:["true","false","Some","None","Ok","Err"],built_in:a},illegal:""},n]}},grmr_scss:e=>{const t=Rs(e),n=Ps,o=Is,a="@[a-z-]+",r={className:"variable",begin:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+Ls.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+o.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},r,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+js.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,r,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:a,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:"and or not only",attribute:Ds.join(" ")},contains:[{begin:a,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},r,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}},grmr_shell:e=>({name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}),grmr_sql:e=>{const t=e.regex,n=e.COMMENT("--","$"),o=["true","false","unknown"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],r=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],i=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],s=r,l=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter((e=>!r.includes(e))),c={begin:t.concat(/\b/,t.either(...s),/\s*\(/),relevance:0,keywords:{built_in:s}};return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:((e,{exceptions:t,when:n}={})=>{const o=n;return t=t||[],e.map((e=>e.match(/\|\d+$/)||t.includes(e)?e:o(e)?e+"|0":e))})(l,{when:e=>e.length<3}),literal:o,type:a,built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"]},contains:[{begin:t.either(...i),relevance:0,keywords:{$pattern:/[\w\.]+/,keyword:l.concat(i),literal:o,type:a}},{className:"type",begin:t.either("double precision","large object","with timezone","without timezone")},c,{className:"variable",begin:/@[a-z0-9][a-z0-9_]*/},{className:"string",variants:[{begin:/'/,end:/'/,contains:[{begin:/''/}]}]},{begin:/"/,end:/"/,contains:[{begin:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,{className:"operator",begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0}]}},grmr_swift:e=>{const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),o=[e.C_LINE_COMMENT_MODE,n],a={match:[/\./,Vi(...Xs,...Ys)],className:{2:"keyword"}},r={match:Zi(/\./,Vi(...el)),relevance:0},i=el.filter((e=>"string"==typeof e)).concat(["_|0"]),s={variants:[{className:"keyword",match:Vi(...el.filter((e=>"string"!=typeof e)).concat(Js).map(Qs),...Ys)}]},l={$pattern:Vi(/\b\w+/,/#\w+/),keyword:i.concat(ol),literal:tl},c=[a,r,s],d=[{match:Zi(/\./,Vi(...al)),relevance:0},{className:"built_in",match:Zi(/\b/,Vi(...al),/(?=\()/)}],u={match:/->/,relevance:0},p=[u,{className:"operator",relevance:0,variants:[{match:sl},{match:`\\.(\\.|${il})+`}]}],m="([0-9]_*)+",h="([0-9a-fA-F]_*)+",g={className:"number",relevance:0,variants:[{match:`\\b(${m})(\\.(${m}))?([eE][+-]?(${m}))?\\b`},{match:`\\b0x(${h})(\\.(${h}))?([pP][+-]?(${m}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},f=(e="")=>({className:"subst",variants:[{match:Zi(/\\/,e,/[0\\tnr"']/)},{match:Zi(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(e="")=>({className:"subst",match:Zi(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),b=(e="")=>({className:"subst",label:"interpol",begin:Zi(/\\/,e,/\(/),end:/\)/}),v=(e="")=>({begin:Zi(e,/"""/),end:Zi(/"""/,e),contains:[f(e),_(e),b(e)]}),y=(e="")=>({begin:Zi(e,/"/),end:Zi(/"/,e),contains:[f(e),b(e)]}),w={className:"string",variants:[v(),v("#"),v("##"),v("###"),y(),y("#"),y("##"),y("###")]},k=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],E={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:k},$=e=>{const t=Zi(e,/\//),n=Zi(/\//,e);return{begin:t,end:n,contains:[...k,{scope:"comment",begin:`#(?!.*${n})`,end:/$/}]}},x={scope:"regexp",variants:[$("###"),$("##"),$("#"),E]},S={match:Zi(/`/,dl,/`/)},N=[S,{className:"variable",match:/\$\d+/},{className:"variable",match:`\\$${cl}+`}],C=[{match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:ml,contains:[...p,g,w]}]}},{scope:"keyword",match:Zi(/@/,Vi(...pl))},{scope:"meta",match:Zi(/@/,dl)}],A={match:Gi(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Zi(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,cl,"+")},{className:"type",match:ul,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Zi(/\s+&\s+/,Gi(ul)),relevance:0}]},M={begin://,keywords:l,contains:[...o,...c,...C,u,A]};A.contains.push(M);const O={begin:/\(/,end:/\)/,relevance:0,keywords:l,contains:["self",{match:Zi(dl,/\s*:/),keywords:"_|0",relevance:0},...o,x,...c,...d,...p,g,w,...N,...C,A]},T={begin://,keywords:"repeat each",contains:[...o,A]},R={begin:/\(/,end:/\)/,keywords:l,contains:[{begin:Vi(Gi(Zi(dl,/\s*:/)),Gi(Zi(dl,/\s+/,dl,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:dl}]},...o,...c,...p,g,w,...C,A,O],endsParent:!0,illegal:/["']/},L={match:[/(func|macro)/,/\s+/,Vi(S.match,dl,sl)],className:{1:"keyword",3:"title.function"},contains:[T,R,t],illegal:[/\[/,/%/]},D={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[T,R,t],illegal:/\[|%/},I={match:[/operator/,/\s+/,sl],className:{1:"keyword",3:"title"}},P={begin:[/precedencegroup/,/\s+/,ul],className:{1:"keyword",3:"title"},contains:[A],keywords:[...nl,...tl],end:/}/};for(const e of w.variants){const t=e.contains.find((e=>"interpol"===e.label));t.keywords=l;const n=[...c,...d,...p,g,w,...N];t.contains=[...n,{begin:/\(/,end:/\)/,contains:["self",...n]}]}return{name:"Swift",keywords:l,contains:[...o,L,D,{beginKeywords:"struct protocol class extension enum actor",end:"\\{",excludeEnd:!0,keywords:l,contains:[e.inherit(e.TITLE_MODE,{className:"title.class",begin:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/}),...c]},I,P,{beginKeywords:"import",end:/$/,contains:[...o],relevance:0},x,...c,...d,...p,g,w,...N,...C,A,O]}},grmr_typescript:e=>{const t=Vs(e),n=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={beginKeywords:"namespace",end:/\{/,excludeEnd:!0,contains:[t.exports.CLASS_REFERENCE]},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:n},contains:[t.exports.CLASS_REFERENCE]},r={$pattern:"[A-Za-z$_][0-9A-Za-z$_]*",keyword:zs.concat(["type","namespace","interface","public","private","protected","implements","declare","abstract","readonly","enum","override"]),literal:qs,built_in:Zs.concat(n),"variable.language":Ks},i={className:"meta",begin:"@[A-Za-z$_][0-9A-Za-z$_]*"},s=(e,t,n)=>{const o=e.contains.findIndex((e=>e.label===t));if(-1===o)throw Error("can not find mode to replace");e.contains.splice(o,1,n)};return Object.assign(t.keywords,r),t.exports.PARAMS_CONTAINS.push(i),t.contains=t.contains.concat([i,o,a]),s(t,"shebang",e.SHEBANG()),s(t,"use_strict",{className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/}),t.contains.find((e=>"func.def"===e.label)).relevance=0,Object.assign(t,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),t},grmr_vbnet:e=>{const t=e.regex,n=/\d{1,2}\/\d{1,2}\/\d{4}/,o=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,r=/\d{1,2}(:\d{1,2}){1,2}/,i={className:"literal",variants:[{begin:t.concat(/# */,t.either(o,n),/ *#/)},{begin:t.concat(/# */,r,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(o,n),/ +/,t.either(a,r),/ *#/)}]},s=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),l=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[{className:"string",begin:/"(""|[^/n])"C\b/},{className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i,{className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},{className:"label",begin:/^\w+:/},s,l,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[l]}]}},grmr_wasm:e=>{e.regex;const t=e.COMMENT(/\(;/,/;\)/);return t.contains.push("self"),{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"]},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},{className:"variable",begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},{className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}},grmr_xml:e=>{const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),o={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},r=e.inherit(a,{begin:/\(/,end:/\)/}),i=e.inherit(e.APOS_STRING_MODE,{className:"string"}),s=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[a,s,i,r,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[a,r,s,i]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},o,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[s]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:l}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}},grmr_yaml:e=>{const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",o={className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},a=e.inherit(o,{variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),r={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},i={begin:/\{/,end:/\}/,contains:[r],illegal:"\\n",relevance:0},s={begin:"\\[",end:"\\]",contains:[r],illegal:"\\n",relevance:0},l=[{className:"attr",variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ \t]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ \t]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ \t]|$)"}]},{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},{className:"number",begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b"},{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},i,s,o],c=[...l];return c.pop(),c.push(a),r.contains=c,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:l}}});const gl=Ts;for(const e of Object.keys(hl)){const t=e.replace("grmr_","").replace("_","-");gl.registerLanguage(t,hl[e])} +/*! `julia` grammar compiled for Highlight.js 11.9.0 */var fl=e=>{const t="[A-Za-z_\\u00A1-\\uFFFF][A-Za-z_0-9\\u00A1-\\uFFFF]*",n={$pattern:t,keyword:["baremodule","begin","break","catch","ccall","const","continue","do","else","elseif","end","export","false","finally","for","function","global","if","import","in","isa","let","local","macro","module","quote","return","true","try","using","where","while"],literal:["ARGS","C_NULL","DEPOT_PATH","ENDIAN_BOM","ENV","Inf","Inf16","Inf32","Inf64","InsertionSort","LOAD_PATH","MergeSort","NaN","NaN16","NaN32","NaN64","PROGRAM_FILE","QuickSort","RoundDown","RoundFromZero","RoundNearest","RoundNearestTiesAway","RoundNearestTiesUp","RoundToZero","RoundUp","VERSION|0","devnull","false","im","missing","nothing","pi","stderr","stdin","stdout","true","undef","π","ℯ"],built_in:["AbstractArray","AbstractChannel","AbstractChar","AbstractDict","AbstractDisplay","AbstractFloat","AbstractIrrational","AbstractMatrix","AbstractRange","AbstractSet","AbstractString","AbstractUnitRange","AbstractVecOrMat","AbstractVector","Any","ArgumentError","Array","AssertionError","BigFloat","BigInt","BitArray","BitMatrix","BitSet","BitVector","Bool","BoundsError","CapturedException","CartesianIndex","CartesianIndices","Cchar","Cdouble","Cfloat","Channel","Char","Cint","Cintmax_t","Clong","Clonglong","Cmd","Colon","Complex","ComplexF16","ComplexF32","ComplexF64","CompositeException","Condition","Cptrdiff_t","Cshort","Csize_t","Cssize_t","Cstring","Cuchar","Cuint","Cuintmax_t","Culong","Culonglong","Cushort","Cvoid","Cwchar_t","Cwstring","DataType","DenseArray","DenseMatrix","DenseVecOrMat","DenseVector","Dict","DimensionMismatch","Dims","DivideError","DomainError","EOFError","Enum","ErrorException","Exception","ExponentialBackOff","Expr","Float16","Float32","Float64","Function","GlobalRef","HTML","IO","IOBuffer","IOContext","IOStream","IdDict","IndexCartesian","IndexLinear","IndexStyle","InexactError","InitError","Int","Int128","Int16","Int32","Int64","Int8","Integer","InterruptException","InvalidStateException","Irrational","KeyError","LinRange","LineNumberNode","LinearIndices","LoadError","MIME","Matrix","Method","MethodError","Missing","MissingException","Module","NTuple","NamedTuple","Nothing","Number","OrdinalRange","OutOfMemoryError","OverflowError","Pair","PartialQuickSort","PermutedDimsArray","Pipe","ProcessFailedException","Ptr","QuoteNode","Rational","RawFD","ReadOnlyMemoryError","Real","ReentrantLock","Ref","Regex","RegexMatch","RoundingMode","SegmentationFault","Set","Signed","Some","StackOverflowError","StepRange","StepRangeLen","StridedArray","StridedMatrix","StridedVecOrMat","StridedVector","String","StringIndexError","SubArray","SubString","SubstitutionString","Symbol","SystemError","Task","TaskFailedException","Text","TextDisplay","Timer","Tuple","Type","TypeError","TypeVar","UInt","UInt128","UInt16","UInt32","UInt64","UInt8","UndefInitializer","UndefKeywordError","UndefRefError","UndefVarError","Union","UnionAll","UnitRange","Unsigned","Val","Vararg","VecElement","VecOrMat","Vector","VersionNumber","WeakKeyDict","WeakRef"]},o={keywords:n,illegal:/<\//},a={className:"subst",begin:/\$\(/,end:/\)/,keywords:n},r={className:"variable",begin:"\\$"+t},i={className:"string",contains:[e.BACKSLASH_ESCAPE,a,r],variants:[{begin:/\w*"""/,end:/"""\w*/,relevance:10},{begin:/\w*"/,end:/"\w*/}]},s={className:"string",contains:[e.BACKSLASH_ESCAPE,a,r],begin:"`",end:"`"},l={className:"meta",begin:"@"+t};return o.name="Julia",o.contains=[{className:"number",begin:/(\b0x[\d_]*(\.[\d_]*)?|0x\.\d[\d_]*)p[-+]?\d+|\b0[box][a-fA-F0-9][a-fA-F0-9_]*|(\b\d[\d_]*(\.[\d_]*)?|\.\d[\d_]*)([eEfF][-+]?\d+)?/,relevance:0},{className:"string",begin:/'(.|\\[xXuU][a-zA-Z0-9]+)'/},i,s,l,{className:"comment",variants:[{begin:"#=",end:"=#",relevance:10},{begin:"#",end:"$"}]},e.HASH_COMMENT_MODE,{className:"keyword",begin:"\\b(((abstract|primitive)\\s+)type|(mutable\\s+)?struct)\\b"},{begin:/<:/}],a.contains=o.contains,o},_l=fl,bl=e=>({name:"Julia REPL",contains:[{className:"meta.prompt",begin:/^julia>/,relevance:10,starts:{end:/^(?![ ]{6})/,subLanguage:"julia"}}],aliases:["jldoctest"]});gl.registerLanguage("julia",_l),gl.registerLanguage("julia-repl",bl),window.hljs=gl;var vl=gl;Zn=r("hiQgq"),Ot=r("1gqBQ");r("9Ta4i");i=r("cNaMA");const yl=({process_waiting_for_permission:e,risky_file_source:t,restart:n,warn_about_untrusted_code:o})=>i.html` +
    + ${e?i.html`
    +
    + Safe preview + + +
    +
    `:null} + `,wl=()=>i.html`
    + ${"Code not executed in "}Safe preview +
    `;class kl extends i.Component{constructor(){super(),this.state={output_changed_once:!1},this.old_height=0,this.resize_observer=new ResizeObserver((e=>{const t=this.base.offsetHeight;if(document.body.querySelector("pluto-cell:focus-within")){var n;const e=document.body.querySelectorAll("pluto-cell:focus-within ~ pluto-cell > pluto-output");"SUMMARY"===(null===(n=document.activeElement)||void 0===n?void 0:n.tagName)||0!==e.length&&Array.from(e).includes(this.base)||window.scrollBy(0,t-this.old_height)}this.old_height=t}))}shouldComponentUpdate({last_run_timestamp:e,sanitize_html:t}){return e!==this.props.last_run_timestamp||t!==this.props.sanitize_html}componentDidUpdate(e){this.props.last_run_timestamp!==e.last_run_timestamp&&this.setState({output_changed_once:!0})}componentDidMount(){this.resize_observer.observe(this.base)}componentWillUnmount(){this.resize_observer.unobserve(this.base)}render(){const e=this.props.errored||!this.props.body||"application/vnd.pluto.tree+object"!==this.props.mime&&"application/vnd.pluto.table+object"!==this.props.mime&&"text/plain"!==this.props.mime,t=!this.props.errored&&e;return i.html` + + + <${$l} ...${this.props} /> + + `;var n}}let El=({body:e,mime:t})=>{let n=i.useRef();return i.useLayoutEffect((()=>{let o=URL.createObjectURL(new Blob([e],{type:t}));return n.current.onload=n.current.onerror=()=>{n.current&&(n.current.style.display=null)},""===n.current.src&&(n.current.style.display="none"),n.current.type=t,n.current.src=o,()=>URL.revokeObjectURL(o)}),[e,t]),i.html``};const $l=({mime:e,body:t,cell_id:n,persist_js_state:o=!1,last_run_timestamp:a,sanitize_html:r=!0})=>{switch(r="false"!==r&&!1!==r,o="true"===o||!0===o,e){case"image/png":case"image/jpg":case"image/jpeg":case"image/gif":case"image/bmp":case"image/svg+xml":return i.html`
    <${El} mime=${e} body=${t} />
    `;case"text/html":return t.startsWith("`:i.html`<${Tl} + cell_id=${n} + body=${t} + persist_js_state=${o} + last_run_timestamp=${a} + sanitize_html=${r} + />`;case"application/vnd.pluto.tree+object":return i.html`
    + <${Pn} cell_id=${n} body=${t} persist_js_state=${o} sanitize_html=${r} /> +
    `;case"application/vnd.pluto.table+object":return i.html`<${Un} cell_id=${n} body=${t} persist_js_state=${o} sanitize_html=${r} />`;case"application/vnd.pluto.parseerror+object":return i.html`
    <${$n} cell_id=${n} ...${t} />
    `;case"application/vnd.pluto.stacktrace+object":return i.html`
    <${Nn} cell_id=${n} ...${t} />
    `;case"application/vnd.pluto.divelement+object":return(({cell_id:e,style:t,classname:n,children:o,persist_js_state:a=!1,sanitize_html:r=!0})=>i.html`
    ${o.map((t=>i.html`<${Tn} cell_id=${e} mime=${t[1]} body=${t[0]} persist_js_state=${a} sanitize_html=${r} />`))}
    `)({cell_id:n,...t,persist_js_state:o,sanitize_html:r});case"text/plain":return t?i.html`
    +
    ${t}
    +
    `:i.html`
    `;case null:case void 0:case"":return i.html``;default:return i.html`
    🛑
    `}};Kn.default($l,"pluto-display",["mime","body","cell_id","persist_js_state","last_run_timestamp","sanitize_html"]);let xl=({body:e})=>{let t=i.useRef();return i.useLayoutEffect((()=>{let n=URL.createObjectURL(new Blob([e],{type:"text/html"}));return t.current.src=n,Ml((async()=>{await new Promise((e=>t.current.addEventListener("load",(()=>e(null)))));let e=t.current.contentWindow.document,n=document.querySelector("#iframe-resizer-content-window-script"),o=e.createElement("script");o.src=n.src,o.crossOrigin="anonymous",e.head.appendChild(o),new Promise((e=>o.addEventListener("load",(()=>e(null))))),window.iFrameResize({checkOrigin:!1},t.current)})),()=>URL.revokeObjectURL(n)}),[e]),i.html``},Sl=async({environment:e,code:t})=>{const n=`"use strict"; return (async () => {${t}})()`;let{this:o,...a}=e,r=Object.keys(a),i=Object.values(a);return await Function(...r,n).bind(o)(...i)},Nl=0,Cl=async(e,t)=>{let n=document.createElement("script");for(let t of e.attributes)n.attributes.setNamedItem(t.cloneNode(!0));const o=`____FUNCTION_TO_RUN_INSIDE_SCRIPT_${Nl}`;n.textContent=`{\n window.${o}.result = window.${o}.function_to_run(window.${o}.currentScript)\n }`,window[o]={function_to_run:t,currentScript:n,result:null};const a=e.parentNode;if(null==a)throw"Failed to execute script it has no parent in DOM.";a.replaceChild(n,e);let r=await window[o].result;return window[o]={function_to_run:t,result:null},{node:n,result:r}};const Al=e=>e instanceof Element&&e.nodeType===Node.ELEMENT_NODE;let Ml=e=>e(),Ol=e=>{try{const t=e.getAttribute("shadowroot"),n=e.parentElement.attachShadow({mode:t});n.appendChild(e.content),e.remove();return Array.from(n.querySelectorAll("script, template[shadowroot]")).flatMap((e=>"SCRIPT"===e.nodeName?[e]:"TEMPLATE"===e.nodeName?Ol(e):void 0))}catch(t){return console.error("Couldn't attach declarative shadow dom to",e,"because of",t),[]}},Tl=({body:e,className:t="",persist_js_state:n=!1,last_run_timestamp:o,sanitize_html:a=!0,sanitize_html_message:r=!0})=>{let s=i.useContext(ye),l=i.useContext(we),c=i.useContext(ke),d=i.useRef(new Map),u=i.useRef((()=>{})),p=i.useRef(null);return i.useLayoutEffect((()=>{p.current&&l&&Hn(p.current.querySelectorAll("bond"),l)}),[e,n,s,l,a]),i.useLayoutEffect((()=>{const t=p.current;if(null==t)return;let o=new Promise((e=>{u.current=()=>{e(null)}}));document.createElement("p-dumpster").append(...t.childNodes);let m=a?$t.sanitize(e,{FORBID_TAGS:["style"],ADD_ATTR:["target"]}):e;if(t.innerHTML=m,r&&m!==e){const n=new DOMParser,o=n.parseFromString(e,"text/html");if(n.parseFromString(m,"text/html").documentElement.innerHTML!==o.documentElement.innerHTML){console.info("HTML sanitized",{body:e,html_content_to_set:m});let n=document.createElement("div");n.innerHTML='
    \nScripts and styles not rendered in Safe preview\n
    ',t.prepend(n)}}if(a)return;const h=[...Array.from(t.querySelectorAll("template[shadowroot]")).flatMap((e=>Ol(e))),...Array.from(t.querySelectorAll("script"))];return Ml((async()=>{try{var e;if(null==c||c.add(t),d.current=await(async({root_node:e,script_nodes:t,previous_results_map:n,invalidation:o,pluto_actions:a})=>{let r=new Map;for(let e of t)if(null!=e.src&&""!==e.src);else{let t=e.id,o=t?n.get(t):null;Al(o)&&(null===(s=e.parentElement)||void 0===s||s.insertBefore(o,e))}for(let l of t){if(Nl+=1,null!=l.src&&""!==l.src){let e=Array.from(document.head.querySelectorAll("script")).find((e=>e.src===l.src));null==e&&(e=document.createElement("script"),e.referrerPolicy=l.referrerPolicy,e.crossOrigin=l.crossOrigin,e.integrity=l.integrity,e.noModule=l.noModule,e.nonce=l.nonce,e.type=l.type,e.src=l.src,e.pluto_is_loading_me=!0);let t=e;null!=t.pluto_is_loading_me&&(await new Promise((e=>{t.addEventListener("load",e),t.addEventListener("error",e),document.head.appendChild(t)})),t.pluto_is_loading_me=void 0)}else try{let t=l.innerText,c=l.id,d=c?n.get(c):null;if("module"===l.type&&console.warn("We don't (yet) fully support
    \ No newline at end of file diff --git a/frontend-dist/ellipsis-horizontal-circle-outline.6279ed30.svg b/frontend-dist/ellipsis-horizontal-circle-outline.6279ed30.svg new file mode 100644 index 000000000..4b8d05ea8 --- /dev/null +++ b/frontend-dist/ellipsis-horizontal-circle-outline.6279ed30.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/ellipsis-horizontal-outline.abb6e818.svg b/frontend-dist/ellipsis-horizontal-outline.abb6e818.svg new file mode 100644 index 000000000..bf94f28ac --- /dev/null +++ b/frontend-dist/ellipsis-horizontal-outline.abb6e818.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/ellipsis-horizontal.c9a6cc29.svg b/frontend-dist/ellipsis-horizontal.c9a6cc29.svg new file mode 100644 index 000000000..5df322580 --- /dev/null +++ b/frontend-dist/ellipsis-horizontal.c9a6cc29.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/ellipsis-vertical.a30e7430.svg b/frontend-dist/ellipsis-vertical.a30e7430.svg new file mode 100644 index 000000000..27f793a2c --- /dev/null +++ b/frontend-dist/ellipsis-vertical.a30e7430.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/error.jl.html b/frontend-dist/error.jl.html new file mode 100644 index 000000000..7c839e684 --- /dev/null +++ b/frontend-dist/error.jl.html @@ -0,0 +1 @@ +$TITLE$STYLE

    $TITLE

    $ADVICE


    Go back


    $BODYTITLE

    $BODY
    \ No newline at end of file diff --git a/frontend-dist/eye-off-outline.a37e03db.svg b/frontend-dist/eye-off-outline.a37e03db.svg new file mode 100644 index 000000000..4a7e91593 --- /dev/null +++ b/frontend-dist/eye-off-outline.a37e03db.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/eye-outline.6e6e0f7c.svg b/frontend-dist/eye-outline.6e6e0f7c.svg new file mode 100644 index 000000000..6901ef405 --- /dev/null +++ b/frontend-dist/eye-outline.6e6e0f7c.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/favicon-16x16.347d2855.png b/frontend-dist/favicon-16x16.347d2855.png new file mode 100644 index 000000000..bd77b0800 Binary files /dev/null and b/frontend-dist/favicon-16x16.347d2855.png differ diff --git a/frontend-dist/favicon-32x32.8789add4.png b/frontend-dist/favicon-32x32.8789add4.png new file mode 100644 index 000000000..96580877e Binary files /dev/null and b/frontend-dist/favicon-32x32.8789add4.png differ diff --git a/frontend-dist/favicon-96x96.48689391.png b/frontend-dist/favicon-96x96.48689391.png new file mode 100644 index 000000000..1d5d57d5b Binary files /dev/null and b/frontend-dist/favicon-96x96.48689391.png differ diff --git a/frontend-dist/favicon_unsaturated.d1387b25.svg b/frontend-dist/favicon_unsaturated.d1387b25.svg new file mode 100644 index 000000000..ccc316f31 --- /dev/null +++ b/frontend-dist/favicon_unsaturated.d1387b25.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/firebase-app.15ba8989.js b/frontend-dist/firebase-app.15ba8989.js new file mode 100644 index 000000000..3fd269f44 --- /dev/null +++ b/frontend-dist/firebase-app.15ba8989.js @@ -0,0 +1,279 @@ +var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function t(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}var r=e.parcelRequire94c2;r.register("8WRsO",(function(n,a){t(n.exports,"FirebaseError",(()=>g)),t(n.exports,"_DEFAULT_ENTRY_NAME",(()=>X)),t(n.exports,"_apps",(()=>Q)),t(n.exports,"_components",(()=>ee)),t(n.exports,"_addComponent",(()=>te)),t(n.exports,"_addOrOverwriteComponent",(()=>re)),t(n.exports,"_registerComponent",(()=>ne)),t(n.exports,"_getProvider",(()=>ae)),t(n.exports,"_removeServiceInstance",(()=>ie)),t(n.exports,"_clearComponents",(()=>se)),t(n.exports,"SDK_VERSION",(()=>he)),t(n.exports,"initializeApp",(()=>le)),t(n.exports,"getApp",(()=>de)),t(n.exports,"getApps",(()=>ue)),t(n.exports,"deleteApp",(()=>fe)),t(n.exports,"registerVersion",(()=>pe)),t(n.exports,"onLog",(()=>ge)),t(n.exports,"setLogLevel",(()=>me));var i=r("fnbc9"); +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const s=function(e){const t=[];let r=0;for(let n=0;n>6|192,t[r++]=63&a|128):55296==(64512&a)&&n+1>18|240,t[r++]=a>>12&63|128,t[r++]=a>>6&63|128,t[r++]=63&a|128):(t[r++]=a>>12|224,t[r++]=a>>6&63|128,t[r++]=63&a|128)}return t},o={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t>2,l=(3&a)<<4|s>>4;let d=(15&s)<<2|c>>6,u=63&c;o||(u=64,i||(d=64)),n.push(r[h],r[l],r[d],r[u])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(s(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r191&&a<224){const i=e[r++];t[n++]=String.fromCharCode((31&a)<<6|63&i)}else if(a>239&&a<365){const i=((7&a)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))}else{const i=e[r++],s=e[r++];t[n++]=String.fromCharCode((15&a)<<12|(63&i)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t>4;if(n.push(h),64!==s){const e=i<<4&240|s>>2;if(n.push(e),64!==o){const e=s<<6&192|o;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class c extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const h=function(e){return function(e){const t=s(e);return o.encodeByteArray(t,!0)}(e).replace(/\./g,"")}; +/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const l=()=> +/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,d=()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&function(e){try{return o.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(e[1]);return t&&JSON.parse(t)},u=()=>{try{return l()||(()=>{if(void 0===i||void 0===i.env)return})()||d()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},f=()=>{var e;return null===(e=u())||void 0===e?void 0:e.config}; +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +class p{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,r))}}}class g extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,g.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,m.prototype.create)}}class m{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,a=this.errors[e],i=a?function(e,t){return e.replace(b,((e,r)=>{const n=t[r];return null!=n?String(n):`<${r}?>`}))}(a,r):"Error",s=`${this.serviceName}: ${i} (${n}).`;return new g(n,s,r)}}const b=/\{\$([^}]+)}/g;function v(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const a of r){if(!n.includes(a))return!1;const r=e[a],i=t[a];if(E(r)&&E(i)){if(!v(r,i))return!1}else if(r!==i)return!1}for(const e of n)if(!r.includes(e))return!1;return!0}function E(e){return null!==e&&"object"==typeof e}class _{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}} +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const y="[DEFAULT]"; +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class w{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new p;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const r=this.getOrInitializeService({instanceIdentifier:t});r&&e.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(r)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:r})}catch(e){if(n)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode} +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */(e))try{this.getOrInitializeService({instanceIdentifier:y})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:r});t.resolve(e)}catch(e){}}}}clearInstance(e="[DEFAULT]"){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(e="[DEFAULT]"){return this.instances.has(e)}getOptions(e="[DEFAULT]"){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const n=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[e,t]of this.instancesDeferred.entries()){r===this.normalizeInstanceIdentifier(e)&&t.resolve(n)}return n}onInit(e,t){var r;const n=this.normalizeInstanceIdentifier(t),a=null!==(r=this.onInitCallbacks.get(n))&&void 0!==r?r:new Set;a.add(e),this.onInitCallbacks.set(n,a);const i=this.instances.get(n);return i&&e(i,n),()=>{a.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const n of r)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e,n===y?void 0:n),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch(e){}var n;return r||null}normalizeInstanceIdentifier(e="[DEFAULT]"){return this.component?this.component.multipleInstances?e:y:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class I{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new w(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}} +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const D=[];var S,C;(C=S||(S={}))[C.DEBUG=0]="DEBUG",C[C.VERBOSE=1]="VERBOSE",C[C.INFO=2]="INFO",C[C.WARN=3]="WARN",C[C.ERROR=4]="ERROR",C[C.SILENT=5]="SILENT";const A={debug:S.DEBUG,verbose:S.VERBOSE,info:S.INFO,warn:S.WARN,error:S.ERROR,silent:S.SILENT},O=S.INFO,L={[S.DEBUG]:"log",[S.VERBOSE]:"log",[S.INFO]:"info",[S.WARN]:"warn",[S.ERROR]:"error"},B=(e,t,...r)=>{if(t(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function k(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(N||(N=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(V(this),t),F(M.get(this))}:function(...t){return F(e.apply(V(this),t))}:function(t,...r){const n=e.call(V(this),t,...r);return P.set(n,t.sort?t.sort():[t]),F(n)}}function j(e){return"function"==typeof e?k(e):(e instanceof IDBTransaction&&function(e){if(R.has(e))return;const t=new Promise(((t,r)=>{const n=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",i),e.removeEventListener("abort",i)},a=()=>{t(),n()},i=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",a),e.addEventListener("error",i),e.addEventListener("abort",i)}));R.set(e,t)}(e),t=e,(T||(T=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,H):e);var t}function F(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,r)=>{const n=()=>{e.removeEventListener("success",a),e.removeEventListener("error",i)},a=()=>{t(F(e.result)),n()},i=()=>{r(e.error),n()};e.addEventListener("success",a),e.addEventListener("error",i)}));return t.then((t=>{t instanceof IDBCursor&&M.set(t,e)})).catch((()=>{})),$.set(t,e),t}(e);if(x.has(e))return x.get(e);const t=j(e);return t!==e&&(x.set(e,t),$.set(t,e)),t}const V=e=>$.get(e);const U=["get","getKey","getAll","getAllKeys","count"],z=["put","add","delete","clear"],W=new Map;function G(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(W.get(t))return W.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,a=z.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!a&&!U.includes(r))return;const i=async function(e,...t){const i=this.transaction(e,a?"readwrite":"readonly");let s=i.store;return n&&(s=s.index(t.shift())),(await Promise.all([s[r](...t),a&&i.done]))[0]};return W.set(t,i),i}H=(e=>({...e,get:(t,r,n)=>G(t,r)||e.get(t,r,n),has:(t,r)=>!!G(t,r)||e.has(t,r)}))(H); +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +class J{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const K="https://www.gstatic.com/firebasejs/10.8.0/firebase-app.js",q="0.9.27",Y=new class{constructor(e){this.name=e,this._logLevel=O,this._logHandler=B,this._userLogHandler=null,D.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in S))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?A[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,S.DEBUG,...e),this._logHandler(this,S.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,S.VERBOSE,...e),this._logHandler(this,S.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,S.INFO,...e),this._logHandler(this,S.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,S.WARN,...e),this._logHandler(this,S.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,S.ERROR,...e),this._logHandler(this,S.ERROR,...e)}}("https://www.gstatic.com/firebasejs/10.8.0/firebase-app.js"),X="[DEFAULT]",Z={[K]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},Q=new Map,ee=new Map;function te(e,t){try{e.container.addComponent(t)}catch(r){Y.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function re(e,t){e.container.addOrOverwriteComponent(t)}function ne(e){const t=e.name;if(ee.has(t))return Y.debug(`There were multiple attempts to register component ${t}.`),!1;ee.set(t,e);for(const t of Q.values())te(t,e);return!0}function ae(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function ie(e,t,r=X){ae(e,t).clearInstance(r)}function se(){ee.clear()} +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const oe=new m("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."}); +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +class ce{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new _("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw oe.create("app-deleted",{appName:this._name})}} +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const he="10.8.0";function le(e,t={}){let r=e;if("object"!=typeof t){t={name:t}}const n=Object.assign({name:X,automaticDataCollectionEnabled:!1},t),a=n.name;if("string"!=typeof a||!a)throw oe.create("bad-app-name",{appName:String(a)});if(r||(r=f()),!r)throw oe.create("no-options");const i=Q.get(a);if(i){if(v(r,i.options)&&v(n,i.config))return i;throw oe.create("duplicate-app",{appName:a})}const s=new I(a);for(const e of ee.values())s.addComponent(e);const o=new ce(r,n,s);return Q.set(a,o),o}function de(e=X){const t=Q.get(e);if(!t&&e===X&&f())return le();if(!t)throw oe.create("no-app",{appName:e});return t}function ue(){return Array.from(Q.values())}async function fe(e){const t=e.name;Q.has(t)&&(Q.delete(t),await Promise.all(e.container.getProviders().map((e=>e.delete()))),e.isDeleted=!0)}function pe(e,t,r){var n;let a=null!==(n=Z[e])&&void 0!==n?n:e;r&&(a+=`-${r}`);const i=a.match(/\s|\//),s=t.match(/\s|\//);if(i||s){const e=[`Unable to register library "${a}" with version "${t}":`];return i&&e.push(`library name "${a}" contains illegal characters (whitespace or "/")`),i&&s&&e.push("and"),s&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void Y.warn(e.join(" "))}ne(new _(`${a}-version`,(()=>({library:a,version:t})),"VERSION"))}function ge(e,t){if(null!==e&&"function"!=typeof e)throw oe.create("invalid-log-argument");!function(e,t){for(const r of D){let n=null;t&&t.level&&(n=A[t.level]),r.userLogHandler=null===e?null:(t,r,...a)=>{const i=a.map((e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}})).filter((e=>e)).join(" ");r>=(null!=n?n:t.logLevel)&&e({level:S[r].toLowerCase(),message:i,args:a,type:t.name})}}}(e,t)}function me(e){var t;t=e,D.forEach((e=>{e.setLogLevel(t)}))} +/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const be="firebase-heartbeat-store";let ve=null;function Ee(){return ve||(ve=function(e,t,{blocked:r,upgrade:n,blocking:a,terminated:i}={}){const s=indexedDB.open(e,t),o=F(s);return n&&s.addEventListener("upgradeneeded",(e=>{n(F(s.result),e.oldVersion,e.newVersion,F(s.transaction),e)})),r&&s.addEventListener("blocked",(e=>r(e.oldVersion,e.newVersion,e))),o.then((e=>{i&&e.addEventListener("close",(()=>i())),a&&e.addEventListener("versionchange",(e=>a(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),o}("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(be)}catch(e){console.warn(e)}}}).catch((e=>{throw oe.create("idb-open",{originalErrorMessage:e.message})}))),ve}async function _e(e,t){try{const r=(await Ee()).transaction(be,"readwrite"),n=r.objectStore(be);await n.put(t,ye(e)),await r.done}catch(e){if(e instanceof g)Y.warn(e.message);else{const t=oe.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});Y.warn(t.message)}}}function ye(e){return`${e.name}!${e.options.appId}`} +/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class we{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new De(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){var e,t;const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=Ie();if((null!=(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||(this._heartbeatsCache=await this._heartbeatsCachePromise,null!=(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))&&this._heartbeatsCache.lastSentHeartbeatDate!==n&&!this._heartbeatsCache.heartbeats.some((e=>e.date===n)))return this._heartbeatsCache.heartbeats.push({date:n,agent:r}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var e;if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=Ie(),{heartbeatsToSend:r,unsentEntries:n}=function(e,t=1024){const r=[];let n=e.slice();for(const a of e){const e=r.find((e=>e.agent===a.agent));if(e){if(e.dates.push(a.date),Se(r)>t){e.dates.pop();break}}else if(r.push({agent:a.agent,dates:[a.date]}),Se(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),a=h(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),a}}function Ie(){return(new Date).toISOString().substring(0,10)}class De{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise(((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(n);a.onsuccess=()=>{a.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},a.onupgradeneeded=()=>{r=!1},a.onerror=()=>{var e;t((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Ee()).transaction(be),r=await t.objectStore(be).get(ye(e));return await t.done,r}catch(e){if(e instanceof g)Y.warn(e.message);else{const t=oe.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});Y.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return _e(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return _e(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}}}function Se(e){return h(JSON.stringify({version:2,heartbeats:e})).length} +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */var Ce;Ce="",ne(new _("platform-logger",(e=>new J(e)),"PRIVATE")),ne(new _("heartbeat",(e=>new we(e)),"PRIVATE")),pe(K,q,Ce),pe(K,q,"esm2017"),pe("fire-js",""); +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +pe("firebase","10.8.0","cdn")})); \ No newline at end of file diff --git a/frontend-dist/firebase-firestore.f72d0b8a.js b/frontend-dist/firebase-firestore.f72d0b8a.js new file mode 100644 index 000000000..cb3c6ee7b --- /dev/null +++ b/frontend-dist/firebase-firestore.f72d0b8a.js @@ -0,0 +1 @@ +var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function e(t,e,n,r){Object.defineProperty(t,e,{get:n,set:r,enumerable:!0,configurable:!0})}var n=t.parcelRequire94c2;n.register("4rxkr",(function(r,s){e(r.exports,"setLogLevel",(()=>Gr)),e(r.exports,"_logWarn",(()=>$r)),e(r.exports,"_debugAssert",(()=>Yr)),e(r.exports,"FirestoreError",(()=>Zr)),e(r.exports,"_EmptyAuthCredentialsProvider",(()=>ns)),e(r.exports,"_EmptyAppCheckTokenProvider",(()=>cs)),e(r.exports,"_AutoId",(()=>hs)),e(r.exports,"Timestamp",(()=>ms)),e(r.exports,"_FieldPath",(()=>bs)),e(r.exports,"_DocumentKey",(()=>_s)),e(r.exports,"_isBase64Available",(()=>Vi)),e(r.exports,"_ByteString",(()=>qi)),e(r.exports,"_DatabaseId",(()=>Hi)),e(r.exports,"_validateIsNotUsedTogether",(()=>$f)),e(r.exports,"_cast",(()=>Yf)),e(r.exports,"connectFirestoreEmulator",(()=>tg)),e(r.exports,"Query",(()=>eg)),e(r.exports,"DocumentReference",(()=>ng)),e(r.exports,"CollectionReference",(()=>rg)),e(r.exports,"collection",(()=>sg)),e(r.exports,"collectionGroup",(()=>ig)),e(r.exports,"doc",(()=>og)),e(r.exports,"refEqual",(()=>ag)),e(r.exports,"queryEqual",(()=>ug)),e(r.exports,"LoadBundleTask",(()=>hg)),e(r.exports,"CACHE_SIZE_UNLIMITED",(()=>dg)),e(r.exports,"Firestore",(()=>fg)),e(r.exports,"initializeFirestore",(()=>gg)),e(r.exports,"getFirestore",(()=>mg)),e(r.exports,"ensureFirestoreConfigured",(()=>pg)),e(r.exports,"enableIndexedDbPersistence",(()=>wg)),e(r.exports,"enableMultiTabIndexedDbPersistence",(()=>vg)),e(r.exports,"clearIndexedDbPersistence",(()=>_g)),e(r.exports,"waitForPendingWrites",(()=>Ig)),e(r.exports,"enableNetwork",(()=>Eg)),e(r.exports,"disableNetwork",(()=>Tg)),e(r.exports,"terminate",(()=>Sg)),e(r.exports,"loadBundle",(()=>xg)),e(r.exports,"namedQuery",(()=>Cg)),e(r.exports,"AggregateField",(()=>Ag)),e(r.exports,"AggregateQuerySnapshot",(()=>Ng)),e(r.exports,"Bytes",(()=>kg)),e(r.exports,"FieldPath",(()=>Rg)),e(r.exports,"documentId",(()=>Mg)),e(r.exports,"FieldValue",(()=>Lg)),e(r.exports,"GeoPoint",(()=>Og)),e(r.exports,"QueryConstraint",(()=>fm)),e(r.exports,"query",(()=>gm)),e(r.exports,"QueryCompositeFilterConstraint",(()=>ym)),e(r.exports,"QueryFieldFilterConstraint",(()=>mm)),e(r.exports,"where",(()=>pm)),e(r.exports,"or",(()=>wm)),e(r.exports,"and",(()=>vm)),e(r.exports,"QueryOrderByConstraint",(()=>bm)),e(r.exports,"orderBy",(()=>_m)),e(r.exports,"QueryLimitConstraint",(()=>Im)),e(r.exports,"limit",(()=>Em)),e(r.exports,"limitToLast",(()=>Tm)),e(r.exports,"QueryStartAtConstraint",(()=>Sm)),e(r.exports,"startAt",(()=>xm)),e(r.exports,"startAfter",(()=>Cm)),e(r.exports,"QueryEndAtConstraint",(()=>Dm)),e(r.exports,"endBefore",(()=>Am)),e(r.exports,"endAt",(()=>Nm)),e(r.exports,"AbstractUserDataWriter",(()=>Pm)),e(r.exports,"sum",(()=>qm)),e(r.exports,"average",(()=>Bm)),e(r.exports,"count",(()=>Um)),e(r.exports,"aggregateFieldEqual",(()=>zm)),e(r.exports,"aggregateQuerySnapshotEqual",(()=>Gm)),e(r.exports,"SnapshotMetadata",(()=>jm)),e(r.exports,"DocumentSnapshot",(()=>Km)),e(r.exports,"QueryDocumentSnapshot",(()=>$m)),e(r.exports,"QuerySnapshot",(()=>Qm)),e(r.exports,"snapshotEqual",(()=>Wm)),e(r.exports,"getDoc",(()=>Ym)),e(r.exports,"getDocFromCache",(()=>Jm)),e(r.exports,"getDocFromServer",(()=>Zm)),e(r.exports,"getDocs",(()=>tp)),e(r.exports,"getDocsFromCache",(()=>ep)),e(r.exports,"getDocsFromServer",(()=>np)),e(r.exports,"setDoc",(()=>rp)),e(r.exports,"executeWrite",(()=>cp)),e(r.exports,"updateDoc",(()=>sp)),e(r.exports,"deleteDoc",(()=>ip)),e(r.exports,"addDoc",(()=>op)),e(r.exports,"onSnapshot",(()=>ap)),e(r.exports,"onSnapshotsInSync",(()=>up)),e(r.exports,"getCountFromServer",(()=>hp)),e(r.exports,"getAggregateFromServer",(()=>dp)),e(r.exports,"persistentSingleTabManager",(()=>Ep)),e(r.exports,"memoryEagerGarbageCollector",(()=>yp)),e(r.exports,"memoryLruGarbageCollector",(()=>wp)),e(r.exports,"memoryLocalCache",(()=>vp)),e(r.exports,"persistentLocalCache",(()=>bp)),e(r.exports,"persistentMultipleTabManager",(()=>Tp)),e(r.exports,"WriteBatch",(()=>xp)),e(r.exports,"Transaction",(()=>Dp)),e(r.exports,"runTransaction",(()=>Ap)),e(r.exports,"deleteField",(()=>Np)),e(r.exports,"serverTimestamp",(()=>kp)),e(r.exports,"arrayUnion",(()=>Rp)),e(r.exports,"arrayRemove",(()=>Mp)),e(r.exports,"increment",(()=>Lp)),e(r.exports,"writeBatch",(()=>Op)),e(r.exports,"setIndexConfiguration",(()=>Pp)),e(r.exports,"PersistentCacheIndexManager",(()=>Vp)),e(r.exports,"getPersistentCacheIndexManager",(()=>qp)),e(r.exports,"enablePersistentCacheIndexAutoCreation",(()=>Bp)),e(r.exports,"disablePersistentCacheIndexAutoCreation",(()=>Up)),e(r.exports,"deleteAllPersistentCacheIndexes",(()=>zp)),e(r.exports,"_TestingHooks",(()=>Kp));var i=n("8WRsO"),o=n("fnbc9");const a=function(t){const e=[];let n=0;for(let r=0;r>6|192,e[n++]=63&s|128):55296==(64512&s)&&r+1>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128)}return e},u={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e>2,l=(3&s)<<4|o>>4;let h=(15&o)<<2|u>>6,d=63&u;a||(d=64,i||(h=64)),r.push(n[c],n[l],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(a(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e>4;if(r.push(u),64!==o){const t=i<<4&240|o>>2;if(r.push(t),64!==a){const t=o<<6&192|a;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class c extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const l=function(t){return function(t){const e=a(t);return u.encodeByteArray(e,!0)}(t).replace(/\./g,"")},h=()=>{try{return function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==t)return t;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__||(()=>{if(void 0===o||void 0===o.env)return})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return u.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)})()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}};function d(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function f(){return!function(){var e;const n=null===(e=h())||void 0===e?void 0:e.forceEnvironment;if("node"===n)return!0;if("browser"===n)return!1;try{return"[object process]"===Object.prototype.toString.call(t.process)}catch(t){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}class g extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,g.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,m.prototype.create)}}class m{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,s=this.errors[t],i=s?function(t,e){return t.replace(p,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new g(r,o,n)}}const p=/\{\$([^}]+)}/g;function y(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const n=t[s],i=e[s];if(w(n)&&w(i)){if(!y(n,i))return!1}else if(n!==i)return!1}for(const t of r)if(!n.includes(t))return!1;return!0}function w(t){return null!==t&&"object"==typeof t}function v(t){return t&&t._delegate?t._delegate:t}class b{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}var _,I;(I=_||(_={}))[I.DEBUG=0]="DEBUG",I[I.VERBOSE=1]="VERBOSE",I[I.INFO=2]="INFO",I[I.WARN=3]="WARN",I[I.ERROR=4]="ERROR",I[I.SILENT=5]="SILENT";const E={debug:_.DEBUG,verbose:_.VERBOSE,info:_.INFO,warn:_.WARN,error:_.ERROR,silent:_.SILENT},T=_.INFO,S={[_.DEBUG]:"log",[_.VERBOSE]:"log",[_.INFO]:"info",[_.WARN]:"warn",[_.ERROR]:"error"},x=(t,e,...n)=>{if(e{};N.addEventListener("test",t,e),N.removeEventListener("test",t,e)}catch(t){}return t}();function j(t){return/^[\s\xa0]*$/.test(t)}function K(){var t=N.navigator;return t&&(t=t.userAgent)?t:""}function $(t){return-1!=K().indexOf(t)}function Q(t){return Q[" "](t),t}Q[" "]=function(){};var H,W,Y,X=$("Opera"),J=$("Trident")||$("MSIE"),Z=$("Edge"),tt=Z||J,et=$("Gecko")&&!(-1!=K().toLowerCase().indexOf("webkit")&&!$("Edge"))&&!($("Trident")||$("MSIE"))&&!$("Edge"),nt=-1!=K().toLowerCase().indexOf("webkit")&&!$("Edge");function rt(){var t=N.document;return t?t.documentMode:void 0}t:{var st="",it=(W=K(),et?/rv:([^\);]+)(\)|;)/.exec(W):Z?/Edge\/([\d\.]+)/.exec(W):J?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(W):nt?/WebKit\/(\S+)/.exec(W):X?/(?:Version)[ \/]?(\S+)/.exec(W):void 0);if(it&&(st=it?it[1]:""),J){var ot=rt();if(null!=ot&&ot>parseFloat(st)){H=String(ot);break t}}H=st}N.document&&J?Y=rt()||parseInt(H,10)||void 0:Y=void 0;var at=Y;function ut(t,e){if(z.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(et){t:{try{Q(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:ct[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&ut.$.h.call(this)}}F(ut,z);var ct={2:"touch",3:"pen",4:"mouse"};ut.prototype.h=function(){ut.$.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var lt="closure_listenable_"+(1e6*Math.random()|0),ht=0;function dt(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.la=s,this.key=++ht,this.fa=this.ia=!1}function ft(t){t.fa=!0,t.listener=null,t.proxy=null,t.src=null,t.la=null}function gt(t,e,n){for(const r in t)e.call(n,t[r],r,t)}function mt(t){const e={};for(const n in t)e[n]=t[n];return e}const pt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function yt(t,e){let n,r;for(let e=1;e>>0);function Rt(t){return"function"==typeof t?t:(t[kt]||(t[kt]=function(e){return t.handleEvent(e)}),t[kt])}function Mt(){V.call(this),this.i=new wt(this),this.S=this,this.J=null}function Lt(t,e){var n,r=t.J;if(r)for(n=[];r;r=r.J)n.push(r);if(t=t.S,r=e.type||e,"string"==typeof e)e=new z(e,t);else if(e instanceof z)e.target=e.target||t;else{var s=e;yt(e=new z(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=Ot(o,r,!0,e)&&s}if(s=Ot(o=e.g=t,r,!0,e)&&s,s=Ot(o,r,!1,e)&&s,n)for(i=0;inew qt),(t=>t.reset()));class qt{constructor(){this.next=this.g=this.h=null}set(t,e){this.h=t,this.g=e,this.next=null}reset(){this.next=this.g=this.h=null}}function Bt(t){var e=1;t=t.split(":");const n=[];for(;0{throw t}),0)}let zt,Gt=!1,jt=new class{constructor(){this.h=this.g=null}add(t,e){const n=Vt.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n}},Kt=()=>{const t=N.Promise.resolve(void 0);zt=()=>{t.then($t)}};var $t=()=>{for(var t;t=Ft();){try{t.h.call(t.g)}catch(t){Ut(t)}var e=Vt;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Gt=!1};function Qt(t,e){Mt.call(this),this.h=t||1,this.g=e||N,this.j=O(this.qb,this),this.l=Date.now()}function Ht(t){t.ga=!1,t.T&&(t.g.clearTimeout(t.T),t.T=null)}function Wt(t,e,n){if("function"==typeof t)n&&(t=O(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=O(t.handleEvent,t)}return 2147483647{t.g=null,t.i&&(t.i=!1,Yt(t))}),t.j);const e=t.h;t.h=null,t.m.apply(null,e)}F(Qt,Mt),(C=Qt.prototype).ga=!1,C.T=null,C.qb=function(){if(this.ga){var t=Date.now()-this.l;0r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;oe.length?Ce:(e=e.slice(r,r+n),t.o=r+n,e))}function Me(t){t.Y=Date.now()+t.P,Le(t,t.P)}function Le(t,e){if(null!=t.C)throw Error("WatchDog timer not null");t.C=de(O(t.lb,t),e)}function Oe(t){t.C&&(N.clearTimeout(t.C),t.C=null)}function Pe(t){0==t.l.H||t.J||tr(t.l,t)}function Fe(t){Oe(t);var e=t.M;e&&"function"==typeof e.sa&&e.sa(),t.M=null,Ht(t.V),ee(t.U),t.g&&(e=t.g,t.g=null,e.abort(),e.sa())}function Ve(t,e){try{var n=t.l;if(0!=n.H&&(n.g==t||fn(n.i,t)))if(!t.K&&fn(n.i,t)&&3==n.H){try{var r=n.Ja.g.parse(e)}catch(t){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.G+3e3s[2]&&n.G&&0==n.A&&!n.v&&(n.v=de(O(n.ib,n),6e3));if(1>=dn(n.i)&&n.oa){try{n.oa()}catch(t){}n.oa=void 0}}else nr(n,11)}else if((t.K||n.g==t)&&Zn(n),!j(e))for(s=n.Ja.g.parse(e),e=0;el)&&(3!=l||tt||this.g&&(this.h.h||this.g.ja()||Fn(this.g)))){this.J||4!=l||7==e||ue(),Oe(this);var n=this.g.da();this.ca=n;e:if(Ne(this)){var r=Fn(this.g);t="";var s=r.length,i=4==Pn(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Fe(this),Pe(this);var o="";break e}this.h.i=new N.TextDecoder}for(e=0;ee)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Ke(t,e,n){e instanceof nn?(t.i=e,function(t,e){e&&!t.j&&(rn(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(sn(this,e),an(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=We(e,tn)),t.i=new nn(e,t.h))}function $e(t,e,n){t.i.set(e,n)}function Qe(t){return $e(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function He(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function We(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Ye),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Ye(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Ue.prototype.toString=function(){var t=[],e=this.j;e&&t.push(We(e,Xe,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(We(e,Xe,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(We(n,"/"==n.charAt(0)?Ze:Je,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",We(n,en)),t.join("")};var Xe=/[#\/\?@]/g,Je=/[#\?:]/g,Ze=/[#\?]/g,tn=/[#\?@]/g,en=/#/g;function nn(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function rn(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n=t.j}function dn(t){return t.h?1:t.g?t.g.size:0}function fn(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function gn(t,e){t.g?t.g.add(e):t.h=e}function mn(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function pn(t){if(null!=t.h)return t.i.concat(t.h.F);if(null!=t.g&&0!==t.g.size){let e=t.i;for(const n of t.g.values())e=e.concat(n.F);return e}return B(t.i)}function yn(){this.g=new class{stringify(t){return N.JSON.stringify(t,void 0)}parse(t){return N.JSON.parse(t,void 0)}}}function wn(t,e,n){const r=n||"";try{qe(t,(function(t,n){let s=t;R(t)&&(s=Pt(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function vn(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function bn(t){this.l=t.ec||null,this.j=t.ob||!1}function _n(t,e){Mt.call(this),this.F=t,this.u=e,this.m=void 0,this.readyState=In,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}cn.prototype.cancel=function(){if(this.i=pn(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const t of this.g.values())t.cancel();this.g.clear()}},F(bn,me),bn.prototype.g=function(){return new _n(this.l,this.j)},bn.prototype.i=function(t){return function(){return t}}({}),F(_n,Mt);var In=0;function En(t){t.j.read().then(t.Xa.bind(t)).catch(t.ka.bind(t))}function Tn(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Sn(t)}function Sn(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(C=_n.prototype).open=function(t,e){if(this.readyState!=In)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Sn(this)},C.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.F||N).fetch(new Request(this.B,e)).then(this.$a.bind(this),this.ka.bind(this))},C.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((()=>{})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Tn(this)),this.readyState=In},C.$a=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Sn(this)),this.g&&(this.readyState=3,Sn(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(void 0!==N.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;En(this)}else t.text().then(this.Za.bind(this),this.ka.bind(this))},C.Xa=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Tn(this):Sn(this),3==this.readyState&&En(this)}},C.Za=function(t){this.g&&(this.response=this.responseText=t,Tn(this))},C.Ya=function(t){this.g&&(this.response=t,Tn(this))},C.ka=function(){this.g&&Tn(this)},C.setRequestHeader=function(t,e){this.v.append(t,e)},C.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},C.getAllResponseHeaders=function(){if(!this.h)return"";const t=[],e=this.h.entries();for(var n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(_n.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var xn=N.JSON.parse;function Cn(t){Mt.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=Dn,this.L=this.M=!1}F(Cn,Mt);var Dn="",An=/^https?$/i,Nn=["POST","PUT"];function kn(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Rn(t),Ln(t)}function Rn(t){t.F||(t.F=!0,Lt(t,"complete"),Lt(t,"error"))}function Mn(t){if(t.h&&void 0!==A&&(!t.C[1]||4!=Pn(t)||2!=t.da()))if(t.v&&4==Pn(t))Wt(t.La,0,t);else if(Lt(t,"readystatechange"),4==Pn(t)){t.h=!1;try{const o=t.da();t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break t;default:e=!1}var n;if(!(n=e)){var r;if(r=0===o){var s=String(t.I).match(Be)[1]||null;!s&&N.self&&N.self.location&&(s=N.self.location.protocol.slice(0,-1)),r=!An.test(s?s.toLowerCase():"")}n=r}if(n)Lt(t,"complete"),Lt(t,"success");else{t.m=6;try{var i=2{}:null;t.g=null,t.C=null,e||Lt(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function On(t){t.g&&t.L&&(t.g.ontimeout=null),t.A&&(N.clearTimeout(t.A),t.A=null)}function Pn(t){return t.g?t.g.readyState:0}function Fn(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.K){case Dn:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Vn(t){let e="";return gt(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function qn(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Vn(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):$e(t,e,n))}function Bn(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Un(t){this.Ga=0,this.j=[],this.l=new ne,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=Bn("failFast",!1,t),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=Bn("baseRetryDelayMs",5e3,t),this.hb=Bn("retryDelaySeedMs",1e4,t),this.eb=Bn("forwardChannelMaxRetries",2,t),this.xa=Bn("forwardChannelRequestTimeoutMs",2e4,t),this.va=t&&t.xmlHttpFactory||void 0,this.Ha=t&&t.useFetchStreams||!1,this.L=void 0,this.J=t&&t.supportsCrossDomainXhr||!1,this.K="",this.i=new cn(t&&t.concurrentRequestLimit),this.Ja=new yn,this.P=t&&t.fastHandshake||!1,this.O=t&&t.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=t&&t.bc||!1,t&&t.Ea&&this.l.Ea(),t&&t.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&t&&t.detectBufferingProxy||!1,this.qa=void 0,t&&t.longPollingTimeout&&0n)e=Math.max(0,s[o].g-100),i=!1;else try{wn(a,t,"req"+n+"_")}catch(t){r&&r(a)}}if(i){r=t.join("&");break t}}}return t=t.j.splice(0,n),e.F=t,r}function Wn(t){if(!t.g&&!t.u){t.ba=1;var e=t.Ma;zt||Kt(),Gt||(zt(),Gt=!0),jt.add(e,t),t.A=0}}function Yn(t){return!(t.g||t.u||3<=t.A||(t.ba++,t.u=de(O(t.Ma,t),er(t,t.A)),t.A++,0))}function Xn(t){null!=t.B&&(N.clearTimeout(t.B),t.B=null)}function Jn(t){t.g=new Ee(t,t.l,"rpc",t.ba),null===t.o&&(t.g.I=t.s),t.g.O=0;var e=ze(t.wa);$e(e,"RID","rpc"),$e(e,"SID",t.K),$e(e,"AID",t.V),$e(e,"CI",t.G?"0":"1"),!t.G&&t.qa&&$e(e,"TO",t.qa),$e(e,"TYPE","xmlhttp"),Qn(t,e),t.o&&t.s&&qn(e,t.o,t.s),t.L&&t.g.setTimeout(t.L);var n=t.g;t=t.pa,n.L=1,n.A=Qe(ze(e)),n.u=null,n.S=!0,Ae(n,t)}function Zn(t){null!=t.v&&(N.clearTimeout(t.v),t.v=null)}function tr(t,e){var n=null;if(t.g==e){Zn(t),Xn(t),t.g=null;var r=2}else{if(!fn(t.i,e))return;n=e.F,mn(t.i,e),r=1}if(0!=t.H)if(e.i)if(1==r){n=e.u?e.u.length:0,e=Date.now()-e.G;var s=t.C;Lt(r=oe(),new he(r,n)),Kn(t)}else Wn(t);else if(3==(s=e.s)||0==s&&0=t.i.j-(t.m?1:0)||(t.m?(t.j=e.F.concat(t.j),0):1==t.H||2==t.H||t.C>=(t.cb?0:t.eb)||(t.m=de(O(t.Na,t,e),er(t,t.C)),t.C++,0)))}(t,e)||2==r&&Yn(t)))switch(n&&0s;++s)r[s]=e.charCodeAt(n++)|e.charCodeAt(n++)<<8|e.charCodeAt(n++)<<16|e.charCodeAt(n++)<<24;else for(s=0;16>s;++s)r[s]=e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24;e=t.g[0],n=t.g[1],s=t.g[2];var i=t.g[3],o=e+(i^n&(s^i))+r[0]+3614090360&4294967295;o=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=(n=(s=(i=(e=n+(o<<7&4294967295|o>>>25))+((o=i+(s^e&(n^s))+r[1]+3905402710&4294967295)<<12&4294967295|o>>>20))+((o=s+(n^i&(e^n))+r[2]+606105819&4294967295)<<17&4294967295|o>>>15))+((o=n+(e^s&(i^e))+r[3]+3250441966&4294967295)<<22&4294967295|o>>>10))+((o=e+(i^n&(s^i))+r[4]+4118548399&4294967295)<<7&4294967295|o>>>25))+((o=i+(s^e&(n^s))+r[5]+1200080426&4294967295)<<12&4294967295|o>>>20))+((o=s+(n^i&(e^n))+r[6]+2821735955&4294967295)<<17&4294967295|o>>>15))+((o=n+(e^s&(i^e))+r[7]+4249261313&4294967295)<<22&4294967295|o>>>10))+((o=e+(i^n&(s^i))+r[8]+1770035416&4294967295)<<7&4294967295|o>>>25))+((o=i+(s^e&(n^s))+r[9]+2336552879&4294967295)<<12&4294967295|o>>>20))+((o=s+(n^i&(e^n))+r[10]+4294925233&4294967295)<<17&4294967295|o>>>15))+((o=n+(e^s&(i^e))+r[11]+2304563134&4294967295)<<22&4294967295|o>>>10))+((o=e+(i^n&(s^i))+r[12]+1804603682&4294967295)<<7&4294967295|o>>>25))+((o=i+(s^e&(n^s))+r[13]+4254626195&4294967295)<<12&4294967295|o>>>20))+((o=s+(n^i&(e^n))+r[14]+2792965006&4294967295)<<17&4294967295|o>>>15))+((o=n+(e^s&(i^e))+r[15]+1236535329&4294967295)<<22&4294967295|o>>>10))+((o=e+(s^i&(n^s))+r[1]+4129170786&4294967295)<<5&4294967295|o>>>27))+((o=i+(n^s&(e^n))+r[6]+3225465664&4294967295)<<9&4294967295|o>>>23))+((o=s+(e^n&(i^e))+r[11]+643717713&4294967295)<<14&4294967295|o>>>18))+((o=n+(i^e&(s^i))+r[0]+3921069994&4294967295)<<20&4294967295|o>>>12))+((o=e+(s^i&(n^s))+r[5]+3593408605&4294967295)<<5&4294967295|o>>>27))+((o=i+(n^s&(e^n))+r[10]+38016083&4294967295)<<9&4294967295|o>>>23))+((o=s+(e^n&(i^e))+r[15]+3634488961&4294967295)<<14&4294967295|o>>>18))+((o=n+(i^e&(s^i))+r[4]+3889429448&4294967295)<<20&4294967295|o>>>12))+((o=e+(s^i&(n^s))+r[9]+568446438&4294967295)<<5&4294967295|o>>>27))+((o=i+(n^s&(e^n))+r[14]+3275163606&4294967295)<<9&4294967295|o>>>23))+((o=s+(e^n&(i^e))+r[3]+4107603335&4294967295)<<14&4294967295|o>>>18))+((o=n+(i^e&(s^i))+r[8]+1163531501&4294967295)<<20&4294967295|o>>>12))+((o=e+(s^i&(n^s))+r[13]+2850285829&4294967295)<<5&4294967295|o>>>27))+((o=i+(n^s&(e^n))+r[2]+4243563512&4294967295)<<9&4294967295|o>>>23))+((o=s+(e^n&(i^e))+r[7]+1735328473&4294967295)<<14&4294967295|o>>>18))+((o=n+(i^e&(s^i))+r[12]+2368359562&4294967295)<<20&4294967295|o>>>12))+((o=e+(n^s^i)+r[5]+4294588738&4294967295)<<4&4294967295|o>>>28))+((o=i+(e^n^s)+r[8]+2272392833&4294967295)<<11&4294967295|o>>>21))+((o=s+(i^e^n)+r[11]+1839030562&4294967295)<<16&4294967295|o>>>16))+((o=n+(s^i^e)+r[14]+4259657740&4294967295)<<23&4294967295|o>>>9))+((o=e+(n^s^i)+r[1]+2763975236&4294967295)<<4&4294967295|o>>>28))+((o=i+(e^n^s)+r[4]+1272893353&4294967295)<<11&4294967295|o>>>21))+((o=s+(i^e^n)+r[7]+4139469664&4294967295)<<16&4294967295|o>>>16))+((o=n+(s^i^e)+r[10]+3200236656&4294967295)<<23&4294967295|o>>>9))+((o=e+(n^s^i)+r[13]+681279174&4294967295)<<4&4294967295|o>>>28))+((o=i+(e^n^s)+r[0]+3936430074&4294967295)<<11&4294967295|o>>>21))+((o=s+(i^e^n)+r[3]+3572445317&4294967295)<<16&4294967295|o>>>16))+((o=n+(s^i^e)+r[6]+76029189&4294967295)<<23&4294967295|o>>>9))+((o=e+(n^s^i)+r[9]+3654602809&4294967295)<<4&4294967295|o>>>28))+((o=i+(e^n^s)+r[12]+3873151461&4294967295)<<11&4294967295|o>>>21))+((o=s+(i^e^n)+r[15]+530742520&4294967295)<<16&4294967295|o>>>16))+((o=n+(s^i^e)+r[2]+3299628645&4294967295)<<23&4294967295|o>>>9))+((o=e+(s^(n|~i))+r[0]+4096336452&4294967295)<<6&4294967295|o>>>26))+((o=i+(n^(e|~s))+r[7]+1126891415&4294967295)<<10&4294967295|o>>>22))+((o=s+(e^(i|~n))+r[14]+2878612391&4294967295)<<15&4294967295|o>>>17))+((o=n+(i^(s|~e))+r[5]+4237533241&4294967295)<<21&4294967295|o>>>11))+((o=e+(s^(n|~i))+r[12]+1700485571&4294967295)<<6&4294967295|o>>>26))+((o=i+(n^(e|~s))+r[3]+2399980690&4294967295)<<10&4294967295|o>>>22))+((o=s+(e^(i|~n))+r[10]+4293915773&4294967295)<<15&4294967295|o>>>17))+((o=n+(i^(s|~e))+r[1]+2240044497&4294967295)<<21&4294967295|o>>>11))+((o=e+(s^(n|~i))+r[8]+1873313359&4294967295)<<6&4294967295|o>>>26))+((o=i+(n^(e|~s))+r[15]+4264355552&4294967295)<<10&4294967295|o>>>22))+((o=s+(e^(i|~n))+r[6]+2734768916&4294967295)<<15&4294967295|o>>>17))+((o=n+(i^(s|~e))+r[13]+1309151649&4294967295)<<21&4294967295|o>>>11))+((i=(e=n+((o=e+(s^(n|~i))+r[4]+4149444226&4294967295)<<6&4294967295|o>>>26))+((o=i+(n^(e|~s))+r[11]+3174756917&4294967295)<<10&4294967295|o>>>22))^((s=i+((o=s+(e^(i|~n))+r[2]+718787259&4294967295)<<15&4294967295|o>>>17))|~e))+r[9]+3951481745&4294967295,t.g[0]=t.g[0]+e&4294967295,t.g[1]=t.g[1]+(s+(o<<21&4294967295|o>>>11))&4294967295,t.g[2]=t.g[2]+s&4294967295,t.g[3]=t.g[3]+i&4294967295}function gr(t,e){this.h=e;for(var n=[],r=!0,s=t.length-1;0<=s;s--){var i=0|t[s];r&&i==e||(n[s]=i,r=!1)}this.g=n}(C=Cn.prototype).Oa=function(t){this.M=t},C.ha=function(t,e,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+t);e=e?e.toUpperCase():"GET",this.I=t,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():we.g(),this.C=this.u?pe(this.u):pe(we),this.g.onreadystatechange=O(this.La,this);try{this.G=!0,this.g.open(e,String(t),!0),this.G=!1}catch(t){return void kn(this,t)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var s in r)n.set(s,r[s]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));for(const t of r.keys())n.set(t,r.get(t))}r=Array.from(n.keys()).find((t=>"content-type"==t.toLowerCase())),s=N.FormData&&t instanceof N.FormData,!(0<=q(Nn,e))||r||s||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[t,e]of n)this.g.setRequestHeader(t,e);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{On(this),0=this.S)){var t=2*this.S;this.l.info("BP detection timer enabled: "+t),this.B=de(O(this.jb,this),t)}},C.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,le(10),Gn(this),Jn(this))},C.ib=function(){null!=this.v&&(this.v=null,Gn(this),Yn(this),le(19))},C.pb=function(t){t?(this.l.info("Successfully pinged google.com"),le(2)):(this.l.info("Failed to ping google.com"),le(1))},C.isActive=function(){return!!this.h&&this.h.isActive(this)},(C=or.prototype).Ba=function(){},C.Aa=function(){},C.za=function(){},C.ya=function(){},C.isActive=function(){return!0},C.Va=function(){},ar.prototype.g=function(t,e){return new ur(t,e)},F(ur,Mt),ur.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var t=this.g,e=this.l,n=this.h||void 0;le(0),t.Y=e,t.na=n||{},t.G=t.aa,t.I=sr(t,null,t.Y),Kn(t)},ur.prototype.close=function(){zn(this.g)},ur.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Pt(t),t=n);e.j.push(new class{constructor(t,e){this.g=t,this.map=e}}(e.fb++,t)),3==e.H&&Kn(e)},ur.prototype.N=function(){this.g.h=null,delete this.j,zn(this.g),delete this.g,ur.$.N.call(this)},F(cr,be),F(lr,_e),F(hr,or),hr.prototype.Ba=function(){Lt(this.g,"a")},hr.prototype.Aa=function(t){Lt(this.g,new cr(t))},hr.prototype.za=function(t){Lt(this.g,new lr)},hr.prototype.ya=function(){Lt(this.g,"b")},F(dr,(function(){this.blockSize=-1})),dr.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0},dr.prototype.j=function(t,e){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=this.m,s=this.h,i=0;ithis.h?this.blockSize:2*this.blockSize)-this.h);t[0]=128;for(var e=1;ee;++e)for(var r=0;32>r;r+=8)t[n++]=this.g[e]>>>r&255;return t};var mr={};function pr(t){return-128<=t&&128>t?function(t,e){var n=mr;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(t,(function(t){return new gr([0|t],0>t?-1:0)})):new gr([0|t],0>t?-1:0)}function yr(t){if(isNaN(t)||!isFinite(t))return vr;if(0>t)return Tr(yr(-t));for(var e=[],n=1,r=0;t>=n;r++)e[r]=t/n|0,n*=wr;return new gr(e,0)}var wr=4294967296,vr=pr(0),br=pr(1),_r=pr(16777216);function Ir(t){if(0!=t.h)return!1;for(var e=0;e>>16,t[e]&=65535,e++}function Cr(t,e){this.g=t,this.h=e}function Dr(t,e){if(Ir(e))throw Error("division by zero");if(Ir(t))return new Cr(vr,vr);if(Er(t))return e=Dr(Tr(t),e),new Cr(Tr(e.g),Tr(e.h));if(Er(e))return e=Dr(t,Tr(e)),new Cr(Tr(e.g),e.h);if(30=r.X(t);)n=Ar(n),r=Ar(r);var s=Nr(n,1),i=Nr(r,1);for(r=Nr(r,2),n=Nr(n,2);!Ir(r);){var o=i.add(r);0>=o.X(t)&&(s=s.add(n),i=o),r=Nr(r,1),n=Nr(n,1)}return e=Sr(t,s.R(e)),new Cr(s,e)}for(s=vr;0<=t.X(e);){for(n=Math.max(1,Math.floor(t.ea()/e.ea())),r=48>=(r=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,r-48),o=(i=yr(n)).R(e);Er(o)||0>>31;return new gr(n,t.h)}function Nr(t,e){var n=e>>5;e%=32;for(var r=t.g.length-n,s=[],i=0;i>>e|t.D(i+n+1)<<32-e:t.D(i+n);return new gr(s,t.h)}(C=gr.prototype).ea=function(){if(Er(this))return-Tr(this).ea();for(var t=0,e=1,n=0;n(t=t||10)||36>>0).toString(t);if(Ir(n=s))return i+r;for(;6>i.length;)i="0"+i;r=i+r}},C.D=function(t){return 0>t?0:t>>16)+(this.D(s)>>>16)+(t.D(s)>>>16);r=o>>>16,i&=65535,o&=65535,n[s]=o<<16|i}return new gr(n,-2147483648&n[n.length-1]?-1:0)},C.R=function(t){if(Ir(this)||Ir(t))return vr;if(Er(this))return Er(t)?Tr(this).R(Tr(t)):Tr(Tr(this).R(t));if(Er(t))return Tr(this.R(Tr(t)));if(0>this.X(_r)&&0>t.X(_r))return yr(this.ea()*t.ea());for(var e=this.g.length+t.g.length,n=[],r=0;r<2*e;r++)n[r]=0;for(r=0;r>>16,o=65535&this.D(r),a=t.D(s)>>>16,u=65535&t.D(s);n[2*r+2*s]+=o*u,xr(n,2*r+2*s),n[2*r+2*s+1]+=i*u,xr(n,2*r+2*s+1),n[2*r+2*s+1]+=o*a,xr(n,2*r+2*s+1),n[2*r+2*s+2]+=i*a,xr(n,2*r+2*s+2)}for(r=0;r(n=n||10)||36o?(o=yr(Math.pow(n,o)),s=s.R(o).add(yr(a))):s=(s=s.R(r)).add(yr(a))}return s};var kr=fe,Rr=ge,Mr=se,Lr=ye,Or=Cn,Pr=dr,Fr=gr;const Vr="@firebase/firestore";class qr{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}qr.UNAUTHENTICATED=new qr(null),qr.GOOGLE_CREDENTIALS=new qr("google-credentials-uid"),qr.FIRST_PARTY=new qr("first-party-uid"),qr.MOCK_USER=new qr("mock-user");let Br="10.8.0";const Ur=new class{constructor(t){this.name=t,this._logLevel=T,this._logHandler=x,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in _))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?E[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,_.DEBUG,...t),this._logHandler(this,_.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,_.VERBOSE,...t),this._logHandler(this,_.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,_.INFO,...t),this._logHandler(this,_.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,_.WARN,...t),this._logHandler(this,_.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,_.ERROR,...t),this._logHandler(this,_.ERROR,...t)}}("@firebase/firestore");function zr(){return Ur.logLevel}function Gr(t){Ur.setLogLevel(t)}function jr(t,...e){if(Ur.logLevel<=_.DEBUG){const n=e.map(Qr);Ur.debug(`Firestore (${Br}): ${t}`,...n)}}function Kr(t,...e){if(Ur.logLevel<=_.ERROR){const n=e.map(Qr);Ur.error(`Firestore (${Br}): ${t}`,...n)}}function $r(t,...e){if(Ur.logLevel<=_.WARN){const n=e.map(Qr);Ur.warn(`Firestore (${Br}): ${t}`,...n)}}function Qr(t){if("string"==typeof t)return t;try{return function(t){return JSON.stringify(t)}(t)}catch(e){return t}}function Hr(t="Unexpected state"){const e=`FIRESTORE (${Br}) INTERNAL ASSERTION FAILED: `+t;throw Kr(e),new Error(e)}function Wr(t,e){t||Hr()}function Yr(t,e){t||Hr()}function Xr(t,e){return t}const Jr={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Zr extends g{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class ts{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}class es{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class ns{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(qr.UNAUTHENTICATED)))}shutdown(){}}class rs{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class ss{constructor(t){this.t=t,this.currentUser=qr.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let s=new ts;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new ts,t.enqueueRetryable((()=>r(this.currentUser)))};const i=()=>{const e=s;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{jr("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),i()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(jr("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new ts)}}),0),i()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(jr("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Wr("string"==typeof e.accessToken),new es(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return Wr(null===t||"string"==typeof t),new qr(t)}}class is{constructor(t,e,n){this.l=t,this.h=e,this.P=n,this.type="FirstParty",this.user=qr.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const t=this.T();return t&&this.I.set("Authorization",t),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class os{constructor(t,e,n){this.l=t,this.h=e,this.P=n}getToken(){return Promise.resolve(new is(this.l,this.h,this.P))}start(t,e){t.enqueueRetryable((()=>e(qr.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class as{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class us{constructor(t){this.A=t,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(t,e){const n=t=>{null!=t.error&&jr("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.R;return this.R=t.token,jr("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{jr("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.A.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.A.getImmediate({optional:!0});t?r(t):jr("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Wr("string"==typeof t.token),this.R=t.token,new as(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}class cs{getToken(){return Promise.resolve(new as(""))}invalidateToken(){}start(t,e){}shutdown(){}}function ls(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;ee?1:0}function fs(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}function gs(t){return t+"\0"}class ms{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Zr(Jr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Zr(Jr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Zr(Jr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Zr(Jr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return ms.fromMillis(Date.now())}static fromDate(t){return ms.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new ms(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?ds(this.nanoseconds,t.nanoseconds):ds(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}class ps{constructor(t){this.timestamp=t}static fromTimestamp(t){return new ps(t)}static min(){return new ps(new ms(0,0))}static max(){return new ps(new ms(253402300799,999999999))}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}class ys{constructor(t,e,n){void 0===e?e=0:e>t.length&&Hr(),void 0===n?n=t.length-e:n>t.length-e&&Hr(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===ys.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof ys?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.lengths)return 1}return t.lengthe.length?1:0}}class ws extends ys{construct(t,e,n){return new ws(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new Zr(Jr.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new ws(e)}static emptyPath(){return new ws([])}}const vs=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class bs extends ys{construct(t,e,n){return new bs(t,e,n)}static isValidIdentifier(t){return vs.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),bs.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new bs(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Zr(Jr.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let i=!1;for(;r=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===ws.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return ws.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new _s(new ws(t.slice()))}}class Is{constructor(t,e,n,r){this.indexId=t,this.collectionGroup=e,this.fields=n,this.indexState=r}}function Es(t){return t.fields.find((t=>2===t.kind))}function Ts(t){return t.fields.filter((t=>2!==t.kind))}function Ss(t,e){let n=ds(t.collectionGroup,e.collectionGroup);if(0!==n)return n;for(let r=0;rt()))}}async function Os(t){if(t.code!==Jr.FAILED_PRECONDITION||t.message!==Ms)throw t;jr("LocalStore","Unexpectedly lost primary lease")}class Ps{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&Hr(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new Ps(((n,r)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,r)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,r)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof Ps?e:Ps.resolve(e)}catch(t){return Ps.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):Ps.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):Ps.reject(e)}static resolve(t){return new Ps(((e,n)=>{e(t)}))}static reject(t){return new Ps(((e,n)=>{n(t)}))}static waitFor(t){return new Ps(((e,n)=>{let r=0,s=0,i=!1;t.forEach((t=>{++r,t.next((()=>{++s,i&&s===r&&e()}),(t=>n(t)))})),i=!0,s===r&&e()}))}static or(t){let e=Ps.resolve(!1);for(const n of t)e=e.next((t=>t?Ps.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,r)=>{n.push(e.call(this,t,r))})),this.waitFor(n)}static mapArray(t,e){return new Ps(((n,r)=>{const s=t.length,i=new Array(s);let o=0;for(let a=0;a{i[u]=t,++o,o===s&&n(i)}),(t=>r(t)))}}))}static doWhile(t,e){return new Ps(((n,r)=>{const s=()=>{!0===t()?e().next((()=>{s()}),r):n()};s()}))}}class Fs{constructor(t,e){this.action=t,this.transaction=e,this.aborted=!1,this.V=new ts,this.transaction.oncomplete=()=>{this.V.resolve()},this.transaction.onabort=()=>{e.error?this.V.reject(new Bs(t,e.error)):this.V.resolve()},this.transaction.onerror=e=>{const n=Ks(e.target.error);this.V.reject(new Bs(t,n))}}static open(t,e,n,r){try{return new Fs(e,t.transaction(r,n))}catch(t){throw new Bs(e,t)}}get m(){return this.V.promise}abort(t){t&&this.V.reject(t),this.aborted||(jr("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}g(){const t=this.transaction;this.aborted||"function"!=typeof t.commit||t.commit()}store(t){const e=this.transaction.objectStore(t);return new zs(e)}}class Vs{constructor(t,e,n){this.name=t,this.version=e,this.p=n,12.2===Vs.S(d())&&Kr("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}static delete(t){return jr("SimpleDb","Removing database:",t),Gs(window.indexedDB.deleteDatabase(t)).toPromise()}static D(){if(!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}())return!1;if(Vs.C())return!0;const t=d(),e=Vs.S(t),n=00||t.indexOf("Trident/")>0||t.indexOf("Edge/")>0||n||s)}static C(){var t;return void 0!==o&&"YES"===(null===(t=o.__PRIVATE_env)||void 0===t?void 0:t.F)}static M(t,e){return t.store(e)}static S(t){const e=t.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=e?e[1].split("_").slice(0,2).join("."):"-1";return Number(n)}static v(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}async O(t){return this.db||(jr("SimpleDb","Opening database:",this.name),this.db=await new Promise(((e,n)=>{const r=indexedDB.open(this.name,this.version);r.onsuccess=t=>{const n=t.target.result;e(n)},r.onblocked=()=>{n(new Bs(t,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},r.onerror=e=>{const r=e.target.error;"VersionError"===r.name?n(new Zr(Jr.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):"InvalidStateError"===r.name?n(new Zr(Jr.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+r)):n(new Bs(t,r))},r.onupgradeneeded=t=>{jr("SimpleDb",'Database "'+this.name+'" requires upgrade from version:',t.oldVersion);const e=t.target.result;this.p.N(e,r.transaction,t.oldVersion,this.version).next((()=>{jr("SimpleDb","Database upgrade to version "+this.version+" complete")}))}}))),this.B&&(this.db.onversionchange=t=>this.B(t)),this.db}L(t){this.B=t,this.db&&(this.db.onversionchange=e=>t(e))}async runTransaction(t,e,n,r){const s="readonly"===e;let i=0;for(;;){++i;try{this.db=await this.O(t);const e=Fs.open(this.db,t,s?"readonly":"readwrite",n),i=r(e).next((t=>(e.g(),t))).catch((t=>(e.abort(t),Ps.reject(t)))).toPromise();return i.catch((()=>{})),await e.m,i}catch(t){const e=t,n="FirebaseError"!==e.name&&i<3;if(jr("SimpleDb","Transaction failed with error:",e.message,"Retrying:",n),this.close(),!n)return Promise.reject(e)}}}close(){this.db&&this.db.close(),this.db=void 0}}class qs{constructor(t){this.k=t,this.q=!1,this.K=null}get isDone(){return this.q}get $(){return this.K}set cursor(t){this.k=t}done(){this.q=!0}U(t){this.K=t}delete(){return Gs(this.k.delete())}}class Bs extends Zr{constructor(t,e){super(Jr.UNAVAILABLE,`IndexedDB transaction '${t}' failed: ${e}`),this.name="IndexedDbTransactionError"}}function Us(t){return"IndexedDbTransactionError"===t.name}class zs{constructor(t){this.store=t}put(t,e){let n;return void 0!==e?(jr("SimpleDb","PUT",this.store.name,t,e),n=this.store.put(e,t)):(jr("SimpleDb","PUT",this.store.name,"",t),n=this.store.put(t)),Gs(n)}add(t){return jr("SimpleDb","ADD",this.store.name,t,t),Gs(this.store.add(t))}get(t){return Gs(this.store.get(t)).next((e=>(void 0===e&&(e=null),jr("SimpleDb","GET",this.store.name,t,e),e)))}delete(t){return jr("SimpleDb","DELETE",this.store.name,t),Gs(this.store.delete(t))}count(){return jr("SimpleDb","COUNT",this.store.name),Gs(this.store.count())}W(t,e){const n=this.options(t,e),r=n.index?this.store.index(n.index):this.store;if("function"==typeof r.getAll){const t=r.getAll(n.range);return new Ps(((e,n)=>{t.onerror=t=>{n(t.target.error)},t.onsuccess=t=>{e(t.target.result)}}))}{const t=this.cursor(n),e=[];return this.G(t,((t,n)=>{e.push(n)})).next((()=>e))}}j(t,e){const n=this.store.getAll(t,null===e?void 0:e);return new Ps(((t,e)=>{n.onerror=t=>{e(t.target.error)},n.onsuccess=e=>{t(e.target.result)}}))}H(t,e){jr("SimpleDb","DELETE ALL",this.store.name);const n=this.options(t,e);n.J=!1;const r=this.cursor(n);return this.G(r,((t,e,n)=>n.delete()))}Y(t,e){let n;e?n=t:(n={},e=t);const r=this.cursor(n);return this.G(r,e)}Z(t){const e=this.cursor({});return new Ps(((n,r)=>{e.onerror=t=>{const e=Ks(t.target.error);r(e)},e.onsuccess=e=>{const r=e.target.result;r?t(r.primaryKey,r.value).next((t=>{t?r.continue():n()})):n()}}))}G(t,e){const n=[];return new Ps(((r,s)=>{t.onerror=t=>{s(t.target.error)},t.onsuccess=t=>{const s=t.target.result;if(!s)return void r();const i=new qs(s),o=e(s.primaryKey,s.value,i);if(o instanceof Ps){const t=o.catch((t=>(i.done(),Ps.reject(t))));n.push(t)}i.isDone?r():null===i.$?s.continue():s.continue(i.$)}})).next((()=>Ps.waitFor(n)))}options(t,e){let n;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}}cursor(t){let e="next";if(t.reverse&&(e="prev"),t.index){const n=this.store.index(t.index);return t.J?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)}}function Gs(t){return new Ps(((e,n)=>{t.onsuccess=t=>{const n=t.target.result;e(n)},t.onerror=t=>{const e=Ks(t.target.error);n(e)}}))}let js=!1;function Ks(t){const e=Vs.S(d());if(e>=12.2&&e<13){const e="An internal error was encountered in the Indexed Database server";if(t.message.indexOf(e)>=0){const t=new Zr("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${e}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return js||(js=!0,setTimeout((()=>{throw t}),0)),t}}return t}class $s{constructor(t,e){this.asyncQueue=t,this.X=e,this.task=null}start(){this.ee(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return null!==this.task}ee(t){jr("IndexBackfiller",`Scheduled in ${t}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",t,(async()=>{this.task=null;try{jr("IndexBackfiller",`Documents written: ${await this.X.te()}`)}catch(t){Us(t)?jr("IndexBackfiller","Ignoring IndexedDB error during index backfill: ",t):await Os(t)}await this.ee(6e4)}))}}class Qs{constructor(t,e){this.localStore=t,this.persistence=e}async te(t=50){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",(e=>this.ne(e,t)))}ne(t,e){const n=new Set;let r=e,s=!0;return Ps.doWhile((()=>!0===s&&r>0),(()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(t).next((e=>{if(null!==e&&!n.has(e))return jr("IndexBackfiller",`Processing collection: ${e}`),this.re(t,e,r).next((t=>{r-=t,n.add(e)}));s=!1})))).next((()=>e-r))}re(t,e,n){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(t,e).next((r=>this.localStore.localDocuments.getNextDocuments(t,e,r,n).next((n=>{const s=n.changes;return this.localStore.indexManager.updateIndexEntries(t,s).next((()=>this.ie(r,n))).next((n=>(jr("IndexBackfiller",`Updating offset: ${n}`),this.localStore.indexManager.updateCollectionGroup(t,e,n)))).next((()=>s.size))}))))}ie(t,e){let n=t;return e.changes.forEach(((t,e)=>{const r=Ns(e);Rs(r,n)>0&&(n=r)})),new ks(n.readTime,n.documentKey,Math.max(e.batchId,t.largestBatchId))}}class Hs{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.se(t),this.oe=t=>e.writeSequenceNumber(t))}se(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.oe&&this.oe(t),t}}function Ws(t){return null==t}function Ys(t){return 0===t&&1/t==-1/0}function Xs(t){return"number"==typeof t&&Number.isInteger(t)&&!Ys(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}function Js(t){let e="";for(let n=0;n0&&(e=ti(e)),e=Zs(t.get(n),e);return ti(e)}function Zs(t,e){let n=e;const r=t.length;for(let e=0;e=2),2===e)return Wr(""===t.charAt(0)&&""===t.charAt(1)),ws.emptyPath();const n=e-2,r=[];let s="";for(let i=0;in)&&Hr(),t.charAt(e+1)){case"":const n=t.substring(i,e);let o;0===s.length?o=n:(s+=n,o=s,s=""),r.push(o);break;case"":s+=t.substring(i,e),s+="\0";break;case"":s+=t.substring(i,e+1);break;default:Hr()}i=e+2}return new ws(r)}Hs._e=-1;const ni=["userId","batchId"];function ri(t,e){return[t,Js(e)]}function si(t,e,n){return[t,Js(e),n]}const ii={},oi=["prefixPath","collectionGroup","readTime","documentId"],ai=["prefixPath","collectionGroup","documentId"],ui=["collectionGroup","readTime","prefixPath","documentId"],ci=["canonicalId","targetId"],li=["targetId","path"],hi=["path","targetId"],di=["collectionId","parent"],fi=["indexId","uid"],gi=["uid","sequenceNumber"],mi=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],pi=["indexId","uid","orderedDocumentKey"],yi=["userId","collectionPath","documentId"],wi=["userId","collectionPath","largestBatchId"],vi=["userId","collectionGroup","largestBatchId"],bi=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries"],_i=[...bi,"documentOverlays"],Ii=["mutationQueues","mutations","documentMutations","remoteDocumentsV14","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries","documentOverlays"],Ei=Ii,Ti=[...Ei,"indexConfiguration","indexState","indexEntries"];class Si extends Ls{constructor(t,e){super(),this.ae=t,this.currentSequenceNumber=e}}function xi(t,e){const n=Xr(t);return Vs.M(n.ae,e)}function Ci(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function Di(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Ai(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}class Ni{constructor(t,e){this.comparator=t,this.root=e||Ri.EMPTY}insert(t,e){return new Ni(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,Ri.BLACK,null,null))}remove(t){return new Ni(this.comparator,this.root.remove(t,this.comparator).copy(null,null,Ri.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new ki(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new ki(this.root,t,this.comparator,!1)}getReverseIterator(){return new ki(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new ki(this.root,t,this.comparator,!0)}}class ki{constructor(t,e,n,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!t.isEmpty();)if(s=e?n(t.key,e):1,e&&r&&(s*=-1),s<0)t=this.isReverse?t.left:t.right;else{if(0===s){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class Ri{constructor(t,e,n,r,s){this.key=t,this.value=e,this.color=null!=n?n:Ri.RED,this.left=null!=r?r:Ri.EMPTY,this.right=null!=s?s:Ri.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,s){return new Ri(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let r=this;const s=n(t,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===s?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return Ri.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===e(t,r.key)){if(r.right.isEmpty())return Ri.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,Ri.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,Ri.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Hr();if(this.right.isRed())throw Hr();const t=this.left.check();if(t!==this.right.check())throw Hr();return t+(this.isRed()?0:1)}}Ri.EMPTY=null,Ri.RED=!0,Ri.BLACK=!1,Ri.EMPTY=new class{constructor(){this.size=0}get key(){throw Hr()}get value(){throw Hr()}get color(){throw Hr()}get left(){throw Hr()}get right(){throw Hr()}copy(t,e,n,r,s){return this}insert(t,e,n){return new Ri(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class Mi{constructor(t){this.comparator=t,this.data=new Ni(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new Li(this.data.getIterator())}getIteratorFrom(t){return new Li(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size{e=e.add(t)})),e}isEqual(t){if(!(t instanceof Mi))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(0!==this.comparator(t,r))return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new Mi(this.comparator);return e.data=t,e}}class Li{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}function Oi(t){return t.hasNext()?t.getNext():void 0}class Pi{constructor(t){this.fields=t,t.sort(bs.comparator)}static empty(){return new Pi([])}unionWith(t){let e=new Mi(bs.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new Pi(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return fs(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}class Fi extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}function Vi(){return"undefined"!=typeof atob}class qi{constructor(t){this.binaryString=t}static fromBase64String(t){const e=function(t){try{return atob(t)}catch(t){throw"undefined"!=typeof DOMException&&t instanceof DOMException?new Fi("Invalid base64 string: "+t):t}}(t);return new qi(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;ntJi(t,e)))}function to(t,e){if(t===e)return 0;const n=Xi(t),r=Xi(e);if(n!==r)return ds(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return ds(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=zi(t.integerValue||t.doubleValue),r=zi(e.integerValue||e.doubleValue);return nr?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return eo(t.timestampValue,e.timestampValue);case 4:return eo($i(t),$i(e));case 5:return ds(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Gi(t),r=Gi(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;tt+so(e)),0)}(t.arrayValue);case 10:return function(t){let e=0;return Di(t.fields,((t,n)=>{e+=t.length+so(n)})),e}(t.mapValue);default:throw Hr()}}function io(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function oo(t){return!!t&&"integerValue"in t}function ao(t){return!!t&&"arrayValue"in t}function uo(t){return!!t&&"nullValue"in t}function co(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function lo(t){return!!t&&"mapValue"in t}function ho(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return Di(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=ho(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=ho(t.arrayValue.values[n]);return e}return Object.assign({},t)}function fo(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}function go(t){return"nullValue"in t?Yi:"booleanValue"in t?{booleanValue:!1}:"integerValue"in t||"doubleValue"in t?{doubleValue:NaN}:"timestampValue"in t?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in t?{stringValue:""}:"bytesValue"in t?{bytesValue:""}:"referenceValue"in t?io(Hi.empty(),_s.empty()):"geoPointValue"in t?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in t?{arrayValue:{}}:"mapValue"in t?{mapValue:{}}:Hr()}function mo(t){return"nullValue"in t?{booleanValue:!1}:"booleanValue"in t?{doubleValue:NaN}:"integerValue"in t||"doubleValue"in t?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in t?{stringValue:""}:"stringValue"in t?{bytesValue:""}:"bytesValue"in t?io(Hi.empty(),_s.empty()):"referenceValue"in t?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in t?{arrayValue:{}}:"arrayValue"in t?{mapValue:{}}:"mapValue"in t?Wi:Hr()}function po(t,e){const n=to(t.value,e.value);return 0!==n?n:t.inclusive&&!e.inclusive?-1:!t.inclusive&&e.inclusive?1:0}function yo(t,e){const n=to(t.value,e.value);return 0!==n?n:t.inclusive&&!e.inclusive?1:!t.inclusive&&e.inclusive?-1:0}class wo{constructor(t){this.value=t}static empty(){return new wo({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n{if(!e.isImmediateParentOf(s)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=s.popLast()}t?n[s.lastSegment()]=ho(t):r.push(s.lastSegment())}));const s=this.getFieldsMap(e);this.applyChanges(s,n,r)}delete(t){const e=this.field(t.popLast());lo(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Ji(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;nt[e]=n));for(const e of n)delete t[e]}clone(){return new wo(ho(this.value))}}function vo(t){const e=[];return Di(t.fields,((t,n)=>{const r=new bs([t]);if(lo(n)){const t=vo(n.mapValue).fields;if(0===t.length)e.push(r);else for(const n of t)e.push(r.child(n))}else e.push(r)})),new Pi(e)}class bo{constructor(t,e,n,r,s,i,o){this.key=t,this.documentType=e,this.version=n,this.readTime=r,this.createTime=s,this.data=i,this.documentState=o}static newInvalidDocument(t){return new bo(t,0,ps.min(),ps.min(),ps.min(),wo.empty(),0)}static newFoundDocument(t,e,n,r){return new bo(t,1,e,ps.min(),n,r,0)}static newNoDocument(t,e){return new bo(t,2,e,ps.min(),ps.min(),wo.empty(),0)}static newUnknownDocument(t,e){return new bo(t,3,e,ps.min(),ps.min(),wo.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(ps.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=wo.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=wo.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ps.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(t){return t instanceof bo&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new bo(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}class _o{constructor(t,e){this.position=t,this.inclusive=e}}function Io(t,e,n){let r=0;for(let s=0;s":return t>0;case">=":return t>=0;default:return Hr()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Do extends xo{constructor(t,e){super(),this.filters=t,this.op=e,this.ue=null}static create(t,e){return new Do(t,e)}matches(t){return Ao(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ue||(this.ue=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ue}getFilters(){return Object.assign([],this.filters)}}function Ao(t){return"and"===t.op}function No(t){return"or"===t.op}function ko(t){return Ro(t)&&Ao(t)}function Ro(t){for(const e of t.filters)if(e instanceof Do)return!1;return!0}function Mo(t){if(t instanceof Co)return t.field.canonicalString()+t.op.toString()+no(t.value);if(ko(t))return t.filters.map((t=>Mo(t))).join(",");{const e=t.filters.map((t=>Mo(t))).join(",");return`${t.op}(${e})`}}function Lo(t,e){return t instanceof Co?function(t,e){return e instanceof Co&&t.op===e.op&&t.field.isEqual(e.field)&&Ji(t.value,e.value)}(t,e):t instanceof Do?function(t,e){return e instanceof Do&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&Lo(n,e.filters[r])),!0)}(t,e):void Hr()}function Oo(t,e){const n=t.filters.concat(e);return Do.create(n,t.op)}function Po(t){return t instanceof Co?function(t){return`${t.field.canonicalString()} ${t.op} ${no(t.value)}`}(t):t instanceof Do?function(t){return t.op.toString()+" {"+t.getFilters().map(Po).join(" ,")+"}"}(t):"Filter"}class Fo extends Co{constructor(t,e,n){super(t,e,n),this.key=_s.fromName(n.referenceValue)}matches(t){const e=_s.comparator(t.key,this.key);return this.matchesComparison(e)}}class Vo extends Co{constructor(t,e){super(t,"in",e),this.keys=Bo("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class qo extends Co{constructor(t,e){super(t,"not-in",e),this.keys=Bo("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function Bo(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>_s.fromName(t.referenceValue)))}class Uo extends Co{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return ao(e)&&Zi(e.arrayValue,this.value)}}class zo extends Co{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Zi(this.value.arrayValue,e)}}class Go extends Co{constructor(t,e){super(t,"not-in",e)}matches(t){if(Zi(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Zi(this.value.arrayValue,e)}}class jo extends Co{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!ao(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Zi(this.value.arrayValue,t)))}}class Ko{constructor(t,e=null,n=[],r=[],s=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.ce=null}}function $o(t,e=null,n=[],r=[],s=null,i=null,o=null){return new Ko(t,e,n,r,s,i,o)}function Qo(t){const e=Xr(t);if(null===e.ce){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>Mo(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),Ws(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>no(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>no(t))).join(",")),e.ce=t}return e.ce}function Ho(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;nt instanceof Co&&t.field.isEqual(e)))}function Xo(t,e,n){let r=Yi,s=!0;for(const n of Yo(t,e)){let t=Yi,e=!0;switch(n.op){case"<":case"<=":t=go(n.value);break;case"==":case"in":case">=":t=n.value;break;case">":t=n.value,e=!1;break;case"!=":case"not-in":t=Yi}po({value:r,inclusive:s},{value:t,inclusive:e})<0&&(r=t,s=e)}if(null!==n)for(let i=0;i=":case">":t=mo(n.value),e=!1;break;case"==":case"in":case"<=":t=n.value;break;case"<":t=n.value,e=!1;break;case"!=":case"not-in":t=Wi}yo({value:r,inclusive:s},{value:t,inclusive:e})>0&&(r=t,s=e)}if(null!==n)for(let i=0;i0&&(r=t,s=n.inclusive);break}return{value:r,inclusive:s}}class Zo{constructor(t,e=null,n=[],r=[],s=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=s,this.limitType=i,this.startAt=o,this.endAt=a,this.le=null,this.he=null,this.Pe=null,this.startAt,this.endAt}}function ta(t,e,n,r,s,i,o,a){return new Zo(t,e,n,r,s,i,o,a)}function ea(t){return new Zo(t)}function na(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function ra(t){return null!==t.collectionGroup}function sa(t){const e=Xr(t);if(null===e.le){e.le=[];const t=new Set;for(const n of e.explicitOrderBy)e.le.push(n),t.add(n.field.canonicalString());const n=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc",r=function(t){let e=new Mi(bs.comparator);return t.filters.forEach((t=>{t.getFlattenedFilters().forEach((t=>{t.isInequality()&&(e=e.add(t.field))}))})),e}(e);r.forEach((r=>{t.has(r.canonicalString())||r.isKeyField()||e.le.push(new To(r,n))})),t.has(bs.keyField().canonicalString())||e.le.push(new To(bs.keyField(),n))}return e.le}function ia(t){const e=Xr(t);return e.he||(e.he=oa(e,sa(t))),e.he}function oa(t,e){if("F"===t.limitType)return $o(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map((t=>{const e="desc"===t.dir?"asc":"desc";return new To(t.field,e)}));const n=t.endAt?new _o(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new _o(t.startAt.position,t.startAt.inclusive):null;return $o(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function aa(t,e){const n=t.filters.concat([e]);return new Zo(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function ua(t,e,n){return new Zo(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function ca(t,e){return Ho(ia(t),ia(e))&&t.limitType===e.limitType}function la(t){return`${Qo(ia(t))}|lt:${t.limitType}`}function ha(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>Po(t))).join(", ")}]`),Ws(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((t=>no(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>no(t))).join(",")),`Target(${e})`}(ia(t))}; limitType=${t.limitType})`}function da(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):_s.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of sa(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const r=Io(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,sa(t),e)||t.endAt&&!function(t,e,n){const r=Io(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,sa(t),e))}(t,e)}function fa(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function ga(t){return(e,n)=>{let r=!1;for(const s of sa(t)){const t=ma(s,e,n);if(0!==t)return t;r=r||s.field.isKeyField()}return 0}}function ma(t,e,n){const r=t.field.isKeyField()?_s.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),s=n.data.field(t);return null!==r&&null!==s?to(r,s):Hr()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Hr()}}class pa{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,r]of n)if(this.equalsFn(e,t))return r}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),r=this.inner[n];if(void 0===r)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n{for(const[e,r]of n)t(e,r)}))}isEmpty(){return Ai(this.inner)}size(){return this.innerSize}}const ya=new Ni(_s.comparator);function wa(){return ya}const va=new Ni(_s.comparator);function ba(...t){let e=va;for(const n of t)e=e.insert(n.key,n);return e}function _a(t){let e=va;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Ia(){return Ta()}function Ea(){return Ta()}function Ta(){return new pa((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Sa=new Ni(_s.comparator),xa=new Mi(_s.comparator);function Ca(...t){let e=xa;for(const n of t)e=e.add(n);return e}const Da=new Mi(ds);function Aa(){return Da}function Na(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Ys(e)?"-0":e}}function ka(t){return{integerValue:""+t}}function Ra(t,e){return Xs(e)?ka(e):Na(t,e)}class Ma{constructor(){this._=void 0}}function La(t,e,n){return t instanceof Fa?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&ji(e)&&(e=Ki(e)),e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof Va?qa(t,e):t instanceof Ba?Ua(t,e):function(t,e){const n=Pa(t,e),r=Ga(n)+Ga(t.Ie);return oo(n)&&oo(t.Ie)?ka(r):Na(t.serializer,r)}(t,e)}function Oa(t,e,n){return t instanceof Va?qa(t,e):t instanceof Ba?Ua(t,e):n}function Pa(t,e){return t instanceof za?function(t){return oo(t)||function(t){return!!t&&"doubleValue"in t}(t)}(e)?e:{integerValue:0}:null}class Fa extends Ma{}class Va extends Ma{constructor(t){super(),this.elements=t}}function qa(t,e){const n=ja(e);for(const e of t.elements)n.some((t=>Ji(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Ba extends Ma{constructor(t){super(),this.elements=t}}function Ua(t,e){let n=ja(e);for(const e of t.elements)n=n.filter((t=>!Ji(t,e)));return{arrayValue:{values:n}}}class za extends Ma{constructor(t,e){super(),this.serializer=t,this.Ie=e}}function Ga(t){return zi(t.integerValue||t.doubleValue)}function ja(t){return ao(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class Ka{constructor(t,e){this.field=t,this.transform=e}}class $a{constructor(t,e){this.version=t,this.transformResults=e}}class Qa{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Qa}static exists(t){return new Qa(void 0,t)}static updateTime(t){return new Qa(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function Ha(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class Wa{}function Ya(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new ou(t.key,Qa.none()):new eu(t.key,t.data,Qa.none());{const n=t.data,r=wo.empty();let s=new Mi(bs.comparator);for(let t of e.fields)if(!s.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),s=s.add(t)}return new nu(t.key,r,new Pi(s.toArray()),Qa.none())}}function Xa(t,e,n){t instanceof eu?function(t,e,n){const r=t.value.clone(),s=su(t.fieldTransforms,e,n.transformResults);r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof nu?function(t,e,n){if(!Ha(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=su(t.fieldTransforms,e,n.transformResults),s=e.data;s.setAll(ru(t)),s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function Ja(t,e,n,r){return t instanceof eu?function(t,e,n,r){if(!Ha(t.precondition,e))return n;const s=t.value.clone(),i=iu(t.fieldTransforms,r,e);return s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null}(t,e,n,r):t instanceof nu?function(t,e,n,r){if(!Ha(t.precondition,e))return n;const s=iu(t.fieldTransforms,r,e),i=e.data;return i.setAll(ru(t)),i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return Ha(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function Za(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),s=Pa(r.transform,t||null);null!=s&&(null===n&&(n=wo.empty()),n.set(r.field,s))}return n||null}function tu(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&fs(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Va&&e instanceof Va||t instanceof Ba&&e instanceof Ba?fs(t.elements,e.elements,Ji):t instanceof za&&e instanceof za?Ji(t.Ie,e.Ie):t instanceof Fa&&e instanceof Fa}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class eu extends Wa{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class nu extends Wa{constructor(t,e,n,r,s=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function ru(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function su(t,e,n){const r=new Map;Wr(t.length===n.length);for(let s=0;s{const s=t.get(r.key),i=s.overlayedDocument;let o=this.applyToLocalView(i,s.mutatedFields);o=e.has(r.key)?null:o;const a=Ya(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(ps.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Ca())}isEqual(t){return this.batchId===t.batchId&&fs(this.mutations,t.mutations,((t,e)=>tu(t,e)))&&fs(this.baseMutations,t.baseMutations,((t,e)=>tu(t,e)))}}class cu{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){Wr(t.mutations.length===n.length);let r=Sa;const s=t.mutations;for(let t=0;t=8)throw new Eu(`Invalid padding: ${e}`);if(n<0)throw new Eu(`Invalid hash count: ${n}`);if(t.length>0&&0===this.hashCount)throw new Eu(`Invalid hash count: ${n}`);if(0===t.length&&0!==e)throw new Eu(`Invalid padding when bitmap length is 0: ${e}`);this.Te=8*t.length-e,this.Ee=Fr.fromNumber(this.Te)}de(t,e,n){let r=t.add(e.multiply(Fr.fromNumber(n)));return 1===r.compare(vu)&&(r=new Fr([r.getBits(0),r.getBits(1)],0)),r.modulo(this.Ee).toNumber()}Ae(t){return 0!=(this.bitmap[Math.floor(t/8)]&1<i.insert(t))),i}insert(t){if(0===this.Te)return;const e=bu(t),[n,r]=_u(e);for(let t=0;t0&&(this.Se=!0,this.ye=t)}ve(){let t=Ca(),e=Ca(),n=Ca();return this.pe.forEach(((r,s)=>{switch(s){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Hr()}})),new Su(this.ye,this.we,t,e,n)}Fe(){this.Se=!1,this.pe=Ru()}Me(t,e){this.Se=!0,this.pe=this.pe.insert(t,e)}xe(t){this.Se=!0,this.pe=this.pe.remove(t)}Oe(){this.ge+=1}Ne(){this.ge-=1,Wr(this.ge>=0)}Be(){this.Se=!0,this.we=!0}}class Nu{constructor(t){this.Le=t,this.ke=new Map,this.qe=wa(),this.Qe=ku(),this.Ke=new Ni(ds)}$e(t){for(const e of t.Ve)t.me&&t.me.isFoundDocument()?this.Ue(e,t.me):this.We(e,t.key,t.me);for(const e of t.removedTargetIds)this.We(e,t.key,t.me)}Ge(t){this.forEachTarget(t,(e=>{const n=this.ze(e);switch(t.state){case 0:this.je(e)&&n.Ce(t.resumeToken);break;case 1:n.Ne(),n.be||n.Fe(),n.Ce(t.resumeToken);break;case 2:n.Ne(),n.be||this.removeTarget(e);break;case 3:this.je(e)&&(n.Be(),n.Ce(t.resumeToken));break;case 4:this.je(e)&&(this.He(e),n.Ce(t.resumeToken));break;default:Hr()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.ke.forEach(((t,n)=>{this.je(n)&&e(n)}))}Je(t){const e=t.targetId,n=t.fe.count,r=this.Ye(e);if(r){const s=r.target;if(Wo(s))if(0===n){const t=new _s(s.path);this.We(e,t,bo.newNoDocument(t,ps.min()))}else Wr(1===n);else{const r=this.Ze(e);if(r!==n){const n=this.Xe(t),s=n?this.et(n,t,r):1;if(0!==s){this.He(e);const t=2===s?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(e,t)}null==yu||yu.tt(function(t,e,n,r,s){var i,o,a,u,c,l;const h={localCacheCount:t,existenceFilterCount:e.count,databaseId:n.database,projectId:n.projectId},d=e.unchangedNames;return d&&(h.bloomFilter={applied:0===s,hashCount:null!==(i=null==d?void 0:d.hashCount)&&void 0!==i?i:0,bitmapLength:null!==(u=null===(a=null===(o=null==d?void 0:d.bits)||void 0===o?void 0:o.bitmap)||void 0===a?void 0:a.length)&&void 0!==u?u:0,padding:null!==(l=null===(c=null==d?void 0:d.bits)||void 0===c?void 0:c.padding)&&void 0!==l?l:0,mightContain:t=>{var e;return null!==(e=null==r?void 0:r.mightContain(t))&&void 0!==e&&e}}),h}(r,t.fe,this.Le.nt(),n,s))}}}}Xe(t){const e=t.fe.unchangedNames;if(!e||!e.bits)return null;const{bits:{bitmap:n="",padding:r=0},hashCount:s=0}=e;let i,o;try{i=Gi(n).toUint8Array()}catch(t){if(t instanceof Fi)return $r("Decoding the base64 bloom filter in existence filter failed ("+t.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw t}try{o=new Iu(i,r,s)}catch(t){return $r(t instanceof Eu?"BloomFilter error: ":"Applying bloom filter failed: ",t),null}return 0===o.Te?null:o}et(t,e,n){return e.fe.count===n-this.rt(t,e.targetId)?0:2}rt(t,e){const n=this.Le.getRemoteKeysForTarget(e);let r=0;return n.forEach((n=>{const s=this.Le.nt(),i=`projects/${s.projectId}/databases/${s.database}/documents/${n.path.canonicalString()}`;t.mightContain(i)||(this.We(e,n,null),r++)})),r}it(t){const e=new Map;this.ke.forEach(((n,r)=>{const s=this.Ye(r);if(s){if(n.current&&Wo(s.target)){const e=new _s(s.target.path);null!==this.qe.get(e)||this.st(r,e)||this.We(r,e,bo.newNoDocument(e,t))}n.De&&(e.set(r,n.ve()),n.Fe())}}));let n=Ca();this.Qe.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Ye(t);return!e||"TargetPurposeLimboResolution"===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.qe.forEach(((e,n)=>n.setReadTime(t)));const r=new Tu(t,e,this.Ke,this.qe,n);return this.qe=wa(),this.Qe=ku(),this.Ke=new Ni(ds),r}Ue(t,e){if(!this.je(t))return;const n=this.st(t,e.key)?2:0;this.ze(t).Me(e.key,n),this.qe=this.qe.insert(e.key,e),this.Qe=this.Qe.insert(e.key,this.ot(e.key).add(t))}We(t,e,n){if(!this.je(t))return;const r=this.ze(t);this.st(t,e)?r.Me(e,1):r.xe(e),this.Qe=this.Qe.insert(e,this.ot(e).delete(t)),n&&(this.qe=this.qe.insert(e,n))}removeTarget(t){this.ke.delete(t)}Ze(t){const e=this.ze(t).ve();return this.Le.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Oe(t){this.ze(t).Oe()}ze(t){let e=this.ke.get(t);return e||(e=new Au,this.ke.set(t,e)),e}ot(t){let e=this.Qe.get(t);return e||(e=new Mi(ds),this.Qe=this.Qe.insert(t,e)),e}je(t){const e=null!==this.Ye(t);return e||jr("WatchChangeAggregator","Detected inactive target",t),e}Ye(t){const e=this.ke.get(t);return e&&e.be?null:this.Le._t(t)}He(t){this.ke.set(t,new Au),this.Le.getRemoteKeysForTarget(t).forEach((e=>{this.We(t,e,null)}))}st(t,e){return this.Le.getRemoteKeysForTarget(t).has(e)}}function ku(){return new Ni(_s.comparator)}function Ru(){return new Ni(_s.comparator)}const Mu={asc:"ASCENDING",desc:"DESCENDING"},Lu={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Ou={and:"AND",or:"OR"};class Pu{constructor(t,e){this.databaseId=t,this.useProto3Json=e}}function Fu(t,e){return t.useProto3Json||Ws(e)?e:{value:e}}function Vu(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function qu(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function Bu(t,e){return Vu(t,e.toTimestamp())}function Uu(t){return Wr(!!t),ps.fromTimestamp(function(t){const e=Ui(t);return new ms(e.seconds,e.nanos)}(t))}function zu(t,e){return Gu(t,e).canonicalString()}function Gu(t,e){const n=function(t){return new ws(["projects",t.projectId,"databases",t.database])}(t).child("documents");return void 0===e?n:n.child(e)}function ju(t){const e=ws.fromString(t);return Wr(dc(e)),e}function Ku(t,e){return zu(t.databaseId,e.path)}function $u(t,e){const n=ju(e);if(n.get(1)!==t.databaseId.projectId)throw new Zr(Jr.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Zr(Jr.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new _s(Yu(n))}function Qu(t,e){return zu(t.databaseId,e)}function Hu(t){const e=ju(t);return 4===e.length?ws.emptyPath():Yu(e)}function Wu(t){return new ws(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Yu(t){return Wr(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function Xu(t,e,n){return{name:Ku(t,e),fields:n.value.mapValue.fields}}function Ju(t,e,n){const r=$u(t,e.name),s=Uu(e.updateTime),i=e.createTime?Uu(e.createTime):ps.min(),o=new wo({mapValue:{fields:e.fields}}),a=bo.newFoundDocument(r,s,i,o);return n&&a.setHasCommittedMutations(),n?a.setHasCommittedMutations():a}function Zu(t,e){let n;if(e instanceof eu)n={update:Xu(t,e.key,e.value)};else if(e instanceof ou)n={delete:Ku(t,e.key)};else if(e instanceof nu)n={update:Xu(t,e.key,e.data),updateMask:hc(e.fieldMask)};else{if(!(e instanceof au))return Hr();n={verify:Ku(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof Fa)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Va)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Ba)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof za)return{fieldPath:e.field.canonicalString(),increment:n.Ie};throw Hr()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Bu(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:Hr()}(t,e.precondition)),n}function tc(t,e){const n=e.currentDocument?function(t){return void 0!==t.updateTime?Qa.updateTime(Uu(t.updateTime)):void 0!==t.exists?Qa.exists(t.exists):Qa.none()}(e.currentDocument):Qa.none(),r=e.updateTransforms?e.updateTransforms.map((e=>function(t,e){let n=null;if("setToServerValue"in e)Wr("REQUEST_TIME"===e.setToServerValue),n=new Fa;else if("appendMissingElements"in e){const t=e.appendMissingElements.values||[];n=new Va(t)}else if("removeAllFromArray"in e){const t=e.removeAllFromArray.values||[];n=new Ba(t)}else"increment"in e?n=new za(t,e.increment):Hr();const r=bs.fromServerFormat(e.fieldPath);return new Ka(r,n)}(t,e))):[];if(e.update){e.update.name;const s=$u(t,e.update.name),i=new wo({mapValue:{fields:e.update.fields}});if(e.updateMask){const t=function(t){const e=t.fieldPaths||[];return new Pi(e.map((t=>bs.fromServerFormat(t))))}(e.updateMask);return new nu(s,i,t,n,r)}return new eu(s,i,n,r)}if(e.delete){const r=$u(t,e.delete);return new ou(r,n)}if(e.verify){const r=$u(t,e.verify);return new au(r,n)}return Hr()}function ec(t,e){return{documents:[Qu(t,e.path)]}}function nc(t,e){const n={structuredQuery:{}},r=e.path;let s;null!==e.collectionGroup?(s=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=Qu(t,s);const i=function(t){if(0!==t.length)return lc(Do.create(t,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const o=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:uc(t.field),direction:ic(t.dir)}}(t)))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const a=Fu(t,e.limit);return null!==a&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=function(t){return{before:t.inclusive,values:t.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),{ut:n,parent:s}}function rc(t){let e=Hu(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Wr(1===r);const t=n.from[0];t.allDescendants?s=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=sc(t);return e instanceof Do&&ko(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=function(t){return t.map((t=>function(t){return new To(cc(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t)))}(n.orderBy));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,Ws(e)?null:e}(n.limit));let u=null;n.startAt&&(u=function(t){const e=!!t.before,n=t.values||[];return new _o(n,e)}(n.startAt));let c=null;return n.endAt&&(c=function(t){const e=!t.before,n=t.values||[];return new _o(n,e)}(n.endAt)),ta(e,s,o,i,a,"F",u,c)}function sc(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=cc(t.unaryFilter.field);return Co.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=cc(t.unaryFilter.field);return Co.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=cc(t.unaryFilter.field);return Co.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=cc(t.unaryFilter.field);return Co.create(s,"!=",{nullValue:"NULL_VALUE"});default:return Hr()}}(t):void 0!==t.fieldFilter?function(t){return Co.create(cc(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Hr()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Do.create(t.compositeFilter.filters.map((t=>sc(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Hr()}}(t.compositeFilter.op))}(t):Hr()}function ic(t){return Mu[t]}function oc(t){return Lu[t]}function ac(t){return Ou[t]}function uc(t){return{fieldPath:t.canonicalString()}}function cc(t){return bs.fromServerFormat(t.fieldPath)}function lc(t){return t instanceof Co?function(t){if("=="===t.op){if(co(t.value))return{unaryFilter:{field:uc(t.field),op:"IS_NAN"}};if(uo(t.value))return{unaryFilter:{field:uc(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(co(t.value))return{unaryFilter:{field:uc(t.field),op:"IS_NOT_NAN"}};if(uo(t.value))return{unaryFilter:{field:uc(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:uc(t.field),op:oc(t.op),value:t.value}}}(t):t instanceof Do?function(t){const e=t.getFilters().map((t=>lc(t)));return 1===e.length?e[0]:{compositeFilter:{op:ac(t.op),filters:e}}}(t):Hr()}function hc(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function dc(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}class fc{constructor(t,e,n,r,s=ps.min(),i=ps.min(),o=qi.EMPTY_BYTE_STRING,a=null){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=o,this.expectedCount=a}withSequenceNumber(t){return new fc(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(t,e){return new fc(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t,null)}withExpectedCount(t){return new fc(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,t)}withLastLimboFreeSnapshotVersion(t){return new fc(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken,this.expectedCount)}}class gc{constructor(t){this.ct=t}}function mc(t,e){const n=e.key,r={prefixPath:n.getCollectionPath().popLast().toArray(),collectionGroup:n.collectionGroup,documentId:n.path.lastSegment(),readTime:pc(e.readTime),hasCommittedMutations:e.hasCommittedMutations};if(e.isFoundDocument())r.document=function(t,e){return{name:Ku(t,e.key),fields:e.data.value.mapValue.fields,updateTime:Vu(t,e.version.toTimestamp()),createTime:Vu(t,e.createTime.toTimestamp())}}(t.ct,e);else if(e.isNoDocument())r.noDocument={path:n.path.toArray(),readTime:yc(e.version)};else{if(!e.isUnknownDocument())return Hr();r.unknownDocument={path:n.path.toArray(),version:yc(e.version)}}return r}function pc(t){const e=t.toTimestamp();return[e.seconds,e.nanoseconds]}function yc(t){const e=t.toTimestamp();return{seconds:e.seconds,nanoseconds:e.nanoseconds}}function wc(t){const e=new ms(t.seconds,t.nanoseconds);return ps.fromTimestamp(e)}function vc(t,e){const n=(e.baseMutations||[]).map((e=>tc(t.ct,e)));for(let t=0;ttc(t.ct,e))),s=ms.fromMillis(e.localWriteTimeMs);return new uu(e.batchId,s,n,r)}function bc(t){const e=wc(t.readTime),n=void 0!==t.lastLimboFreeSnapshotVersion?wc(t.lastLimboFreeSnapshotVersion):ps.min();let r;return r=function(t){return void 0!==t.documents}(t.query)?function(t){return Wr(1===t.documents.length),ia(ea(Hu(t.documents[0])))}(t.query):function(t){return ia(rc(t))}(t.query),new fc(r,t.targetId,"TargetPurposeListen",t.lastListenSequenceNumber,e,n,qi.fromBase64String(t.resumeToken))}function _c(t,e){const n=yc(e.snapshotVersion),r=yc(e.lastLimboFreeSnapshotVersion);let s;s=Wo(e.target)?ec(t.ct,e.target):nc(t.ct,e.target).ut;const i=e.resumeToken.toBase64();return{targetId:e.targetId,canonicalId:Qo(e.target),readTime:n,resumeToken:i,lastListenSequenceNumber:e.sequenceNumber,lastLimboFreeSnapshotVersion:r,query:s}}function Ic(t){const e=rc({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?ua(e,e.limit,"L"):e}function Ec(t,e){return new lu(e.largestBatchId,tc(t.ct,e.overlayMutation))}function Tc(t,e){const n=e.path.lastSegment();return[t,Js(e.path.popLast()),n]}function Sc(t,e,n,r){return{indexId:t,uid:e,sequenceNumber:n,readTime:yc(r.readTime),documentKey:Js(r.documentKey.path),largestBatchId:r.largestBatchId}}class xc{getBundleMetadata(t,e){return Cc(t).get(e).next((t=>{if(t)return function(t){return{id:t.bundleId,createTime:wc(t.createTime),version:t.version}}(t)}))}saveBundleMetadata(t,e){return Cc(t).put(function(t){return{bundleId:t.id,createTime:yc(Uu(t.createTime)),version:t.version}}(e))}getNamedQuery(t,e){return Dc(t).get(e).next((t=>{if(t)return function(t){return{name:t.name,query:Ic(t.bundledQuery),readTime:wc(t.readTime)}}(t)}))}saveNamedQuery(t,e){return Dc(t).put(function(t){return{name:t.name,readTime:yc(Uu(t.readTime)),bundledQuery:t.bundledQuery}}(e))}}function Cc(t){return xi(t,"bundles")}function Dc(t){return xi(t,"namedQueries")}class Ac{constructor(t,e){this.serializer=t,this.userId=e}static lt(t,e){const n=e.uid||"";return new Ac(t,n)}getOverlay(t,e){return Nc(t).get(Tc(this.userId,e)).next((t=>t?Ec(this.serializer,t):null))}getOverlays(t,e){const n=Ia();return Ps.forEach(e,(e=>this.getOverlay(t,e).next((t=>{null!==t&&n.set(e,t)})))).next((()=>n))}saveOverlays(t,e,n){const r=[];return n.forEach(((n,s)=>{const i=new lu(e,s);r.push(this.ht(t,i))})),Ps.waitFor(r)}removeOverlaysForBatchId(t,e,n){const r=new Set;e.forEach((t=>r.add(Js(t.getCollectionPath()))));const s=[];return r.forEach((e=>{const r=IDBKeyRange.bound([this.userId,e,n],[this.userId,e,n+1],!1,!0);s.push(Nc(t).H("collectionPathOverlayIndex",r))})),Ps.waitFor(s)}getOverlaysForCollection(t,e,n){const r=Ia(),s=Js(e),i=IDBKeyRange.bound([this.userId,s,n],[this.userId,s,Number.POSITIVE_INFINITY],!0);return Nc(t).W("collectionPathOverlayIndex",i).next((t=>{for(const e of t){const t=Ec(this.serializer,e);r.set(t.getKey(),t)}return r}))}getOverlaysForCollectionGroup(t,e,n,r){const s=Ia();let i;const o=IDBKeyRange.bound([this.userId,e,n],[this.userId,e,Number.POSITIVE_INFINITY],!0);return Nc(t).Y({index:"collectionGroupOverlayIndex",range:o},((t,e,n)=>{const o=Ec(this.serializer,e);s.size()s))}ht(t,e){return Nc(t).put(function(t,e,n){const[r,s,i]=Tc(e,n.mutation.key);return{userId:e,collectionPath:s,documentId:i,collectionGroup:n.mutation.key.getCollectionGroup(),largestBatchId:n.largestBatchId,overlayMutation:Zu(t.ct,n.mutation)}}(this.serializer,this.userId,e))}}function Nc(t){return xi(t,"documentOverlays")}class kc{constructor(){}Pt(t,e){this.It(t,e),e.Tt()}It(t,e){if("nullValue"in t)this.Et(e,5);else if("booleanValue"in t)this.Et(e,10),e.dt(t.booleanValue?1:0);else if("integerValue"in t)this.Et(e,15),e.dt(zi(t.integerValue));else if("doubleValue"in t){const n=zi(t.doubleValue);isNaN(n)?this.Et(e,13):(this.Et(e,15),Ys(n)?e.dt(0):e.dt(n))}else if("timestampValue"in t){const n=t.timestampValue;this.Et(e,20),"string"==typeof n?e.At(n):(e.At(`${n.seconds||""}`),e.dt(n.nanos||0))}else if("stringValue"in t)this.Rt(t.stringValue,e),this.Vt(e);else if("bytesValue"in t)this.Et(e,30),e.ft(Gi(t.bytesValue)),this.Vt(e);else if("referenceValue"in t)this.gt(t.referenceValue,e);else if("geoPointValue"in t){const n=t.geoPointValue;this.Et(e,45),e.dt(n.latitude||0),e.dt(n.longitude||0)}else"mapValue"in t?fo(t)?this.Et(e,Number.MAX_SAFE_INTEGER):(this.yt(t.mapValue,e),this.Vt(e)):"arrayValue"in t?(this.wt(t.arrayValue,e),this.Vt(e)):Hr()}Rt(t,e){this.Et(e,25),this.St(t,e)}St(t,e){e.At(t)}yt(t,e){const n=t.fields||{};this.Et(e,55);for(const t of Object.keys(n))this.Rt(t,e),this.It(n[t],e)}wt(t,e){const n=t.values||[];this.Et(e,50);for(const t of n)this.It(t,e)}gt(t,e){this.Et(e,37),_s.fromName(t).path.forEach((t=>{this.Et(e,60),this.St(t,e)}))}Et(t,e){t.dt(e)}Vt(t){t.dt(2)}}function Rc(t){if(0===t)return 8;let e=0;return t>>4==0&&(e+=4,t<<=4),t>>6==0&&(e+=2,t<<=2),t>>7==0&&(e+=1),e}function Mc(t){const e=64-function(t){let e=0;for(let n=0;n<8;++n){const r=Rc(255&t[n]);if(e+=r,8!==r)break}return e}(t);return Math.ceil(e/8)}kc.bt=new kc;class Lc{constructor(){this.buffer=new Uint8Array(1024),this.position=0}Dt(t){const e=t[Symbol.iterator]();let n=e.next();for(;!n.done;)this.Ct(n.value),n=e.next();this.vt()}Ft(t){const e=t[Symbol.iterator]();let n=e.next();for(;!n.done;)this.Mt(n.value),n=e.next();this.xt()}Ot(t){for(const e of t){const t=e.charCodeAt(0);if(t<128)this.Ct(t);else if(t<2048)this.Ct(960|t>>>6),this.Ct(128|63&t);else if(e<"\ud800"||"\udbff">>12),this.Ct(128|63&t>>>6),this.Ct(128|63&t);else{const t=e.codePointAt(0);this.Ct(240|t>>>18),this.Ct(128|63&t>>>12),this.Ct(128|63&t>>>6),this.Ct(128|63&t)}}this.vt()}Nt(t){for(const e of t){const t=e.charCodeAt(0);if(t<128)this.Mt(t);else if(t<2048)this.Mt(960|t>>>6),this.Mt(128|63&t);else if(e<"\ud800"||"\udbff">>12),this.Mt(128|63&t>>>6),this.Mt(128|63&t);else{const t=e.codePointAt(0);this.Mt(240|t>>>18),this.Mt(128|63&t>>>12),this.Mt(128|63&t>>>6),this.Mt(128|63&t)}}this.xt()}Bt(t){const e=this.Lt(t),n=Mc(e);this.kt(1+n),this.buffer[this.position++]=255&n;for(let t=e.length-n;tbs.comparator(t.field,e.field))),this.collectionId=null!=t.collectionGroup?t.collectionGroup:t.path.lastSegment(),this.Zt=t.orderBy,this.Xt=[];for(const e of t.filters){const t=e;t.isInequality()?this.Yt=this.Yt.add(t):this.Xt.push(t)}}get en(){return this.Yt.size>1}tn(t){if(Wr(t.collectionGroup===this.collectionId),this.en)return!1;const e=Es(t);if(void 0!==e&&!this.nn(e))return!1;const n=Ts(t);let r=new Set,s=0,i=0;for(;s0){const t=this.Yt.getIterator().getNext();if(!r.has(t.field.canonicalString())){const e=n[s];if(!this.rn(t,e)||!this.sn(this.Zt[i++],e))return!1}++s}for(;s=this.Zt.length||!this.sn(this.Zt[i++],t))return!1}return!0}on(){if(this.en)return null;let t=new Mi(bs.comparator);const e=[];for(const n of this.Xt)if(!n.field.isKeyField())if("array-contains"===n.op||"array-contains-any"===n.op)e.push(new xs(n.field,2));else{if(t.has(n.field))continue;t=t.add(n.field),e.push(new xs(n.field,0))}for(const n of this.Zt)n.field.isKeyField()||t.has(n.field)||(t=t.add(n.field),e.push(new xs(n.field,"asc"===n.dir?0:1)));return new Is(Is.UNKNOWN_ID,this.collectionId,e,Ds.empty())}nn(t){for(const e of this.Xt)if(this.rn(e,t))return!0;return!1}rn(t,e){if(void 0===t||!t.field.isEqual(e.fieldPath))return!1;const n="array-contains"===t.op||"array-contains-any"===t.op;return 2===e.kind===n}sn(t,e){return!!t.field.isEqual(e.fieldPath)&&(0===e.kind&&"asc"===t.dir||1===e.kind&&"desc"===t.dir)}}function zc(t){var e,n;if(Wr(t instanceof Co||t instanceof Do),t instanceof Co){if(t instanceof zo){const r=(null===(n=null===(e=t.value.arrayValue)||void 0===e?void 0:e.values)||void 0===n?void 0:n.map((e=>Co.create(t.field,"==",e))))||[];return Do.create(r,"or")}return t}const r=t.filters.map((t=>zc(t)));return Do.create(r,t.op)}function Gc(t){if(0===t.getFilters().length)return[];const e=Qc(zc(t));return Wr($c(e)),jc(e)||Kc(e)?[e]:e.getFilters()}function jc(t){return t instanceof Co}function Kc(t){return t instanceof Do&&ko(t)}function $c(t){return jc(t)||Kc(t)||function(t){if(t instanceof Do&&No(t)){for(const e of t.getFilters())if(!jc(e)&&!Kc(e))return!1;return!0}return!1}(t)}function Qc(t){if(Wr(t instanceof Co||t instanceof Do),t instanceof Co)return t;if(1===t.filters.length)return Qc(t.filters[0]);const e=t.filters.map((t=>Qc(t)));let n=Do.create(e,t.op);return n=Yc(n),$c(n)?n:(Wr(n instanceof Do),Wr(Ao(n)),Wr(n.filters.length>1),n.filters.reduce(((t,e)=>Hc(t,e))))}function Hc(t,e){let n;return Wr(t instanceof Co||t instanceof Do),Wr(e instanceof Co||e instanceof Do),n=t instanceof Co?e instanceof Co?function(t,e){return Do.create([t,e],"and")}(t,e):Wc(t,e):e instanceof Co?Wc(e,t):function(t,e){if(Wr(t.filters.length>0&&e.filters.length>0),Ao(t)&&Ao(e))return Oo(t,e.getFilters());const n=No(t)?t:e,r=No(t)?e:t,s=n.filters.map((t=>Hc(t,r)));return Do.create(s,"or")}(t,e),Yc(n)}function Wc(t,e){if(Ao(e))return Oo(e,t.getFilters());{const n=e.filters.map((e=>Hc(t,e)));return Do.create(n,"or")}}function Yc(t){if(Wr(t instanceof Co||t instanceof Do),t instanceof Co)return t;const e=t.getFilters();if(1===e.length)return Yc(e[0]);if(Ro(t))return t;const n=e.map((t=>Yc(t))),r=[];return n.forEach((e=>{e instanceof Co?r.push(e):e instanceof Do&&(e.op===t.op?r.push(...e.filters):r.push(e))})),1===r.length?r[0]:Do.create(r,t.op)}class Xc{constructor(){this._n=new Jc}addToCollectionParentIndex(t,e){return this._n.add(e),Ps.resolve()}getCollectionParents(t,e){return Ps.resolve(this._n.getEntries(e))}addFieldIndex(t,e){return Ps.resolve()}deleteFieldIndex(t,e){return Ps.resolve()}deleteAllFieldIndexes(t){return Ps.resolve()}createTargetIndexes(t,e){return Ps.resolve()}getDocumentsMatchingTarget(t,e){return Ps.resolve(null)}getIndexType(t,e){return Ps.resolve(0)}getFieldIndexes(t,e){return Ps.resolve([])}getNextCollectionGroupToUpdate(t){return Ps.resolve(null)}getMinOffset(t,e){return Ps.resolve(ks.min())}getMinOffsetFromCollectionGroup(t,e){return Ps.resolve(ks.min())}updateCollectionGroup(t,e,n){return Ps.resolve()}updateIndexEntries(t,e){return Ps.resolve()}}class Jc{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new Mi(ws.comparator),s=!r.has(n);return this.index[e]=r.add(n),s}has(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e];return r&&r.has(n)}getEntries(t){return(this.index[t]||new Mi(ws.comparator)).toArray()}}const Zc=new Uint8Array(0);class tl{constructor(t,e){this.databaseId=e,this.an=new Jc,this.un=new pa((t=>Qo(t)),((t,e)=>Ho(t,e))),this.uid=t.uid||""}addToCollectionParentIndex(t,e){if(!this.an.has(e)){const n=e.lastSegment(),r=e.popLast();t.addOnCommittedListener((()=>{this.an.add(e)}));const s={collectionId:n,parent:Js(r)};return el(t).put(s)}return Ps.resolve()}getCollectionParents(t,e){const n=[],r=IDBKeyRange.bound([e,""],[gs(e),""],!1,!0);return el(t).W(r).next((t=>{for(const r of t){if(r.collectionId!==e)break;n.push(ei(r.parent))}return n}))}addFieldIndex(t,e){const n=rl(t),r=function(t){return{indexId:t.indexId,collectionGroup:t.collectionGroup,fields:t.fields.map((t=>[t.fieldPath.canonicalString(),t.kind]))}}(e);delete r.indexId;const s=n.add(r);if(e.indexState){const n=sl(t);return s.next((t=>{n.put(Sc(t,this.uid,e.indexState.sequenceNumber,e.indexState.offset))}))}return s.next()}deleteFieldIndex(t,e){const n=rl(t),r=sl(t),s=nl(t);return n.delete(e.indexId).next((()=>r.delete(IDBKeyRange.bound([e.indexId],[e.indexId+1],!1,!0)))).next((()=>s.delete(IDBKeyRange.bound([e.indexId],[e.indexId+1],!1,!0))))}deleteAllFieldIndexes(t){const e=rl(t),n=nl(t),r=sl(t);return e.H().next((()=>n.H())).next((()=>r.H()))}createTargetIndexes(t,e){return Ps.forEach(this.cn(e),(e=>this.getIndexType(t,e).next((n=>{if(0===n||1===n){const n=new Uc(e).on();if(null!=n)return this.addFieldIndex(t,n)}}))))}getDocumentsMatchingTarget(t,e){const n=nl(t);let r=!0;const s=new Map;return Ps.forEach(this.cn(e),(e=>this.ln(t,e).next((t=>{r&&(r=!!t),s.set(e,t)})))).next((()=>{if(r){let t=Ca();const r=[];return Ps.forEach(s,((s,i)=>{jr("IndexedDbIndexManager",`Using index ${function(t){return`id=${t.indexId}|cg=${t.collectionGroup}|f=${t.fields.map((t=>`${t.fieldPath}:${t.kind}`)).join(",")}`}(s)} to execute ${Qo(e)}`);const o=function(t,e){const n=Es(e);if(void 0===n)return null;for(const e of Yo(t,n.fieldPath))switch(e.op){case"array-contains-any":return e.value.arrayValue.values||[];case"array-contains":return[e.value]}return null}(i,s),a=function(t,e){const n=new Map;for(const r of Ts(e))for(const e of Yo(t,r.fieldPath))switch(e.op){case"==":case"in":n.set(r.fieldPath.canonicalString(),e.value);break;case"not-in":case"!=":return n.set(r.fieldPath.canonicalString(),e.value),Array.from(n.values())}return null}(i,s),u=function(t,e){const n=[];let r=!0;for(const s of Ts(e)){const e=0===s.kind?Xo(t,s.fieldPath,t.startAt):Jo(t,s.fieldPath,t.startAt);n.push(e.value),r&&(r=e.inclusive)}return new _o(n,r)}(i,s),c=function(t,e){const n=[];let r=!0;for(const s of Ts(e)){const e=0===s.kind?Jo(t,s.fieldPath,t.endAt):Xo(t,s.fieldPath,t.endAt);n.push(e.value),r&&(r=e.inclusive)}return new _o(n,r)}(i,s),l=this.hn(s,i,u),h=this.hn(s,i,c),d=this.Pn(s,i,a),f=this.In(s.indexId,o,l,u.inclusive,h,c.inclusive,d);return Ps.forEach(f,(s=>n.j(s,e.limit).next((e=>{e.forEach((e=>{const n=_s.fromSegments(e.documentKey);t.has(n)||(t=t.add(n),r.push(n))}))}))))})).next((()=>r))}return Ps.resolve(null)}))}cn(t){let e=this.un.get(t);return e||(e=0===t.filters.length?[t]:Gc(Do.create(t.filters,"and")).map((e=>$o(t.path,t.collectionGroup,t.orderBy,e.getFilters(),t.limit,t.startAt,t.endAt))),this.un.set(t,e),e)}In(t,e,n,r,s,i,o){const a=(null!=e?e.length:1)*Math.max(n.length,s.length),u=a/(null!=e?e.length:1),c=[];for(let l=0;lthis.En(t,a,e,!0)));c.push(...this.createRange(h,d,f))}return c}En(t,e,n,r){const s=new Vc(t,_s.empty(),e,n);return r?s:s.Jt()}dn(t,e,n,r){const s=new Vc(t,_s.empty(),e,n);return r?s.Jt():s}ln(t,e){const n=new Uc(e),r=null!=e.collectionGroup?e.collectionGroup:e.path.lastSegment();return this.getFieldIndexes(t,r).next((t=>{let e=null;for(const r of t)n.tn(r)&&(!e||r.fields.length>e.fields.length)&&(e=r);return e}))}getIndexType(t,e){let n=2;const r=this.cn(e);return Ps.forEach(r,(e=>this.ln(t,e).next((t=>{t?0!==n&&t.fields.lengthfunction(t){return null!==t.limit}(e)&&r.length>1&&2===n?1:n))}An(t,e){const n=new Fc;for(const r of Ts(t)){const t=e.data.field(r.fieldPath);if(null==t)return null;const s=n.Ht(r.kind);kc.bt.Pt(t,s)}return n.Wt()}Tn(t){const e=new Fc;return kc.bt.Pt(t,e.Ht(0)),e.Wt()}Rn(t,e){const n=new Fc;return kc.bt.Pt(io(this.databaseId,e),n.Ht(function(t){const e=Ts(t);return 0===e.length?0:e[e.length-1].kind}(t))),n.Wt()}Pn(t,e,n){if(null===n)return[];let r=[];r.push(new Fc);let s=0;for(const i of Ts(t)){const t=n[s++];for(const n of r)if(this.Vn(e,i.fieldPath)&&ao(t))r=this.mn(r,i,t);else{const e=n.Ht(i.kind);kc.bt.Pt(t,e)}}return this.fn(r)}hn(t,e,n){return this.Pn(t,e,n.position)}fn(t){const e=[];for(let n=0;nt instanceof Co&&t.field.isEqual(e)&&("in"===t.op||"not-in"===t.op)))}getFieldIndexes(t,e){const n=rl(t),r=sl(t);return(e?n.W("collectionGroupIndex",IDBKeyRange.bound(e,e)):n.W()).next((t=>{const e=[];return Ps.forEach(t,(t=>r.get([t.indexId,this.uid]).next((n=>{e.push(function(t,e){const n=e?new Ds(e.sequenceNumber,new ks(wc(e.readTime),new _s(ei(e.documentKey)),e.largestBatchId)):Ds.empty(),r=t.fields.map((([t,e])=>new xs(bs.fromServerFormat(t),e)));return new Is(t.indexId,t.collectionGroup,r,n)}(t,n))})))).next((()=>e))}))}getNextCollectionGroupToUpdate(t){return this.getFieldIndexes(t).next((t=>0===t.length?null:(t.sort(((t,e)=>{const n=t.indexState.sequenceNumber-e.indexState.sequenceNumber;return 0!==n?n:ds(t.collectionGroup,e.collectionGroup)})),t[0].collectionGroup)))}updateCollectionGroup(t,e,n){const r=rl(t),s=sl(t);return this.gn(t).next((t=>r.W("collectionGroupIndex",IDBKeyRange.bound(e,e)).next((e=>Ps.forEach(e,(e=>s.put(Sc(e.indexId,this.uid,t,n))))))))}updateIndexEntries(t,e){const n=new Map;return Ps.forEach(e,((e,r)=>{const s=n.get(e.collectionGroup);return(s?Ps.resolve(s):this.getFieldIndexes(t,e.collectionGroup)).next((s=>(n.set(e.collectionGroup,s),Ps.forEach(s,(n=>this.pn(t,e,n).next((e=>{const s=this.yn(r,n);return e.isEqual(s)?Ps.resolve():this.wn(t,r,n,e,s)})))))))}))}Sn(t,e,n,r){return nl(t).put({indexId:r.indexId,uid:this.uid,arrayValue:r.arrayValue,directionalValue:r.directionalValue,orderedDocumentKey:this.Rn(n,e.key),documentKey:e.key.path.toArray()})}bn(t,e,n,r){return nl(t).delete([r.indexId,this.uid,r.arrayValue,r.directionalValue,this.Rn(n,e.key),e.key.path.toArray()])}pn(t,e,n){const r=nl(t);let s=new Mi(qc);return r.Y({index:"documentKeyIndex",range:IDBKeyRange.only([n.indexId,this.uid,this.Rn(n,e)])},((t,r)=>{s=s.add(new Vc(n.indexId,e,r.arrayValue,r.directionalValue))})).next((()=>s))}yn(t,e){let n=new Mi(qc);const r=this.An(e,t);if(null==r)return n;const s=Es(e);if(null!=s){const i=t.data.field(s.fieldPath);if(ao(i))for(const s of i.arrayValue.values||[])n=n.add(new Vc(e.indexId,t.key,this.Tn(s),r))}else n=n.add(new Vc(e.indexId,t.key,Zc,r));return n}wn(t,e,n,r,s){jr("IndexedDbIndexManager","Updating index entries for document '%s'",e.key);const i=[];return function(t,e,n,r,s){const i=t.getIterator(),o=e.getIterator();let a=Oi(i),u=Oi(o);for(;a||u;){let t=!1,e=!1;if(a&&u){const r=n(a,u);r<0?e=!0:r>0&&(t=!0)}else null!=a?e=!0:t=!0;t?(r(u),u=Oi(o)):e?(s(a),a=Oi(i)):(a=Oi(i),u=Oi(o))}}(r,s,qc,(r=>{i.push(this.Sn(t,e,n,r))}),(r=>{i.push(this.bn(t,e,n,r))})),Ps.waitFor(i)}gn(t){let e=1;return sl(t).Y({index:"sequenceNumberIndex",reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},((t,n,r)=>{r.done(),e=n.sequenceNumber+1})).next((()=>e))}createRange(t,e,n){n=n.sort(((t,e)=>qc(t,e))).filter(((t,e,n)=>!e||0!==qc(t,n[e-1])));const r=[];r.push(t);for(const s of n){const n=qc(s,t),i=qc(s,e);if(0===n)r[0]=t.Jt();else if(n>0&&i<0)r.push(s),r.push(s.Jt());else if(i>0)break}r.push(e);const s=[];for(let t=0;t0}getMinOffsetFromCollectionGroup(t,e){return this.getFieldIndexes(t,e).next(il)}getMinOffset(t,e){return Ps.mapArray(this.cn(e),(e=>this.ln(t,e).next((t=>t||Hr())))).next(il)}}function el(t){return xi(t,"collectionParents")}function nl(t){return xi(t,"indexEntries")}function rl(t){return xi(t,"indexConfiguration")}function sl(t){return xi(t,"indexState")}function il(t){Wr(0!==t.length);let e=t[0].indexState.offset,n=e.largestBatchId;for(let r=1;r(a++,n.delete())));i.push(u.next((()=>{Wr(1===a)})));const c=[];for(const t of n.mutations){const r=si(e,t.key.path,n.batchId);i.push(s.delete(r)),c.push(t.key)}return Ps.waitFor(i).next((()=>c))}function cl(t){if(!t)return 0;let e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw Hr();e=t.noDocument}return JSON.stringify(e).length}al.DEFAULT_COLLECTION_PERCENTILE=10,al.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,al.DEFAULT=new al(41943040,al.DEFAULT_COLLECTION_PERCENTILE,al.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),al.DISABLED=new al(-1,0,0);class ll{constructor(t,e,n,r){this.userId=t,this.serializer=e,this.indexManager=n,this.referenceDelegate=r,this.Cn={}}static lt(t,e,n,r){Wr(""!==t.uid);const s=t.isAuthenticated()?t.uid:"";return new ll(s,e,n,r)}checkEmpty(t){let e=!0;const n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return dl(t).Y({index:"userMutationsIndex",range:n},((t,n,r)=>{e=!1,r.done()})).next((()=>e))}addMutationBatch(t,e,n,r){const s=fl(t),i=dl(t);return i.add({}).next((o=>{Wr("number"==typeof o);const a=new uu(o,e,n,r),u=function(t,e,n){const r=n.baseMutations.map((e=>Zu(t.ct,e))),s=n.mutations.map((e=>Zu(t.ct,e)));return{userId:e,batchId:n.batchId,localWriteTimeMs:n.localWriteTime.toMillis(),baseMutations:r,mutations:s}}(this.serializer,this.userId,a),c=[];let l=new Mi(((t,e)=>ds(t.canonicalString(),e.canonicalString())));for(const t of r){const e=si(this.userId,t.key.path,o);l=l.add(t.key.path.popLast()),c.push(i.put(u)),c.push(s.put(e,ii))}return l.forEach((e=>{c.push(this.indexManager.addToCollectionParentIndex(t,e))})),t.addOnCommittedListener((()=>{this.Cn[o]=a.keys()})),Ps.waitFor(c).next((()=>a))}))}lookupMutationBatch(t,e){return dl(t).get(e).next((t=>t?(Wr(t.userId===this.userId),vc(this.serializer,t)):null))}vn(t,e){return this.Cn[e]?Ps.resolve(this.Cn[e]):this.lookupMutationBatch(t,e).next((t=>{if(t){const n=t.keys();return this.Cn[e]=n,n}return null}))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=IDBKeyRange.lowerBound([this.userId,n]);let s=null;return dl(t).Y({index:"userMutationsIndex",range:r},((t,e,r)=>{e.userId===this.userId&&(Wr(e.batchId>=n),s=vc(this.serializer,e)),r.done()})).next((()=>s))}getHighestUnacknowledgedBatchId(t){const e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]);let n=-1;return dl(t).Y({index:"userMutationsIndex",range:e,reverse:!0},((t,e,r)=>{n=e.batchId,r.done()})).next((()=>n))}getAllMutationBatches(t){const e=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return dl(t).W("userMutationsIndex",e).next((t=>t.map((t=>vc(this.serializer,t)))))}getAllMutationBatchesAffectingDocumentKey(t,e){const n=ri(this.userId,e.path),r=IDBKeyRange.lowerBound(n),s=[];return fl(t).Y({range:r},((n,r,i)=>{const[o,a,u]=n,c=ei(a);if(o===this.userId&&e.path.isEqual(c))return dl(t).get(u).next((t=>{if(!t)throw Hr();Wr(t.userId===this.userId),s.push(vc(this.serializer,t))}));i.done()})).next((()=>s))}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new Mi(ds);const r=[];return e.forEach((e=>{const s=ri(this.userId,e.path),i=IDBKeyRange.lowerBound(s),o=fl(t).Y({range:i},((t,r,s)=>{const[i,o,a]=t,u=ei(o);i===this.userId&&e.path.isEqual(u)?n=n.add(a):s.done()}));r.push(o)})),Ps.waitFor(r).next((()=>this.Fn(t,n)))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1,s=ri(this.userId,n),i=IDBKeyRange.lowerBound(s);let o=new Mi(ds);return fl(t).Y({range:i},((t,e,s)=>{const[i,a,u]=t,c=ei(a);i===this.userId&&n.isPrefixOf(c)?c.length===r&&(o=o.add(u)):s.done()})).next((()=>this.Fn(t,o)))}Fn(t,e){const n=[],r=[];return e.forEach((e=>{r.push(dl(t).get(e).next((t=>{if(null===t)throw Hr();Wr(t.userId===this.userId),n.push(vc(this.serializer,t))})))})),Ps.waitFor(r).next((()=>n))}removeMutationBatch(t,e){return ul(t.ae,this.userId,e).next((n=>(t.addOnCommittedListener((()=>{this.Mn(e.batchId)})),Ps.forEach(n,(e=>this.referenceDelegate.markPotentiallyOrphaned(t,e))))))}Mn(t){delete this.Cn[t]}performConsistencyCheck(t){return this.checkEmpty(t).next((e=>{if(!e)return Ps.resolve();const n=IDBKeyRange.lowerBound(function(t){return[t]}(this.userId)),r=[];return fl(t).Y({range:n},((t,e,n)=>{if(t[0]===this.userId){const e=ei(t[1]);r.push(e)}else n.done()})).next((()=>{Wr(0===r.length)}))}))}containsKey(t,e){return hl(t,this.userId,e)}xn(t){return gl(t).get(this.userId).next((t=>t||{userId:this.userId,lastAcknowledgedBatchId:-1,lastStreamToken:""}))}}function hl(t,e,n){const r=ri(e,n.path),s=r[1],i=IDBKeyRange.lowerBound(r);let o=!1;return fl(t).Y({range:i,J:!0},((t,n,r)=>{const[i,a,u]=t;i===e&&a===s&&(o=!0),r.done()})).next((()=>o))}function dl(t){return xi(t,"mutations")}function fl(t){return xi(t,"documentMutations")}function gl(t){return xi(t,"mutationQueues")}class ml{constructor(t){this.On=t}next(){return this.On+=2,this.On}static Nn(){return new ml(0)}static Bn(){return new ml(-1)}}class pl{constructor(t,e){this.referenceDelegate=t,this.serializer=e}allocateTargetId(t){return this.Ln(t).next((e=>{const n=new ml(e.highestTargetId);return e.highestTargetId=n.next(),this.kn(t,e).next((()=>e.highestTargetId))}))}getLastRemoteSnapshotVersion(t){return this.Ln(t).next((t=>ps.fromTimestamp(new ms(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))))}getHighestSequenceNumber(t){return this.Ln(t).next((t=>t.highestListenSequenceNumber))}setTargetsMetadata(t,e,n){return this.Ln(t).next((r=>(r.highestListenSequenceNumber=e,n&&(r.lastRemoteSnapshotVersion=n.toTimestamp()),e>r.highestListenSequenceNumber&&(r.highestListenSequenceNumber=e),this.kn(t,r))))}addTargetData(t,e){return this.qn(t,e).next((()=>this.Ln(t).next((n=>(n.targetCount+=1,this.Qn(e,n),this.kn(t,n))))))}updateTargetData(t,e){return this.qn(t,e)}removeTargetData(t,e){return this.removeMatchingKeysForTargetId(t,e.targetId).next((()=>yl(t).delete(e.targetId))).next((()=>this.Ln(t))).next((e=>(Wr(e.targetCount>0),e.targetCount-=1,this.kn(t,e))))}removeTargets(t,e,n){let r=0;const s=[];return yl(t).Y(((i,o)=>{const a=bc(o);a.sequenceNumber<=e&&null===n.get(a.targetId)&&(r++,s.push(this.removeTargetData(t,a)))})).next((()=>Ps.waitFor(s))).next((()=>r))}forEachTarget(t,e){return yl(t).Y(((t,n)=>{const r=bc(n);e(r)}))}Ln(t){return wl(t).get("targetGlobalKey").next((t=>(Wr(null!==t),t)))}kn(t,e){return wl(t).put("targetGlobalKey",e)}qn(t,e){return yl(t).put(_c(this.serializer,e))}Qn(t,e){let n=!1;return t.targetId>e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n}getTargetCount(t){return this.Ln(t).next((t=>t.targetCount))}getTargetData(t,e){const n=Qo(e),r=IDBKeyRange.bound([n,Number.NEGATIVE_INFINITY],[n,Number.POSITIVE_INFINITY]);let s=null;return yl(t).Y({range:r,index:"queryTargetsIndex"},((t,n,r)=>{const i=bc(n);Ho(e,i.target)&&(s=i,r.done())})).next((()=>s))}addMatchingKeys(t,e,n){const r=[],s=vl(t);return e.forEach((e=>{const i=Js(e.path);r.push(s.put({targetId:n,path:i})),r.push(this.referenceDelegate.addReference(t,n,e))})),Ps.waitFor(r)}removeMatchingKeys(t,e,n){const r=vl(t);return Ps.forEach(e,(e=>{const s=Js(e.path);return Ps.waitFor([r.delete([n,s]),this.referenceDelegate.removeReference(t,n,e)])}))}removeMatchingKeysForTargetId(t,e){const n=vl(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)}getMatchingKeysForTargetId(t,e){const n=IDBKeyRange.bound([e],[e+1],!1,!0),r=vl(t);let s=Ca();return r.Y({range:n,J:!0},((t,e,n)=>{const r=ei(t[1]),i=new _s(r);s=s.add(i)})).next((()=>s))}containsKey(t,e){const n=Js(e.path),r=IDBKeyRange.bound([n],[gs(n)],!1,!0);let s=0;return vl(t).Y({index:"documentTargetsIndex",J:!0,range:r},(([t,e],n,r)=>{0!==t&&(s++,r.done())})).next((()=>s>0))}_t(t,e){return yl(t).get(e).next((t=>t?bc(t):null))}}function yl(t){return xi(t,"targets")}function wl(t){return xi(t,"targetGlobal")}function vl(t){return xi(t,"targetDocuments")}function bl([t,e],[n,r]){const s=ds(t,n);return 0===s?ds(e,r):s}class _l{constructor(t){this.Kn=t,this.buffer=new Mi(bl),this.$n=0}Un(){return++this.$n}Wn(t){const e=[t,this.Un()];if(this.buffer.size{this.Gn=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){Us(t)?jr("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",t):await Os(t)}await this.zn(3e5)}))}}class El{constructor(t,e){this.jn=t,this.params=e}calculateTargetCount(t,e){return this.jn.Hn(t).next((t=>Math.floor(e/100*t)))}nthSequenceNumber(t,e){if(0===e)return Ps.resolve(Hs._e);const n=new _l(e);return this.jn.forEachTarget(t,(t=>n.Wn(t.sequenceNumber))).next((()=>this.jn.Jn(t,(t=>n.Wn(t))))).next((()=>n.maxValue))}removeTargets(t,e,n){return this.jn.removeTargets(t,e,n)}removeOrphanedDocuments(t,e){return this.jn.removeOrphanedDocuments(t,e)}collect(t,e){return-1===this.params.cacheSizeCollectionThreshold?(jr("LruGarbageCollector","Garbage collection skipped; disabled"),Ps.resolve(ol)):this.getCacheSize(t).next((n=>n(e>this.params.maximumSequenceNumbersToCollect?(jr("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),r=this.params.maximumSequenceNumbersToCollect):r=e,i=Date.now(),this.nthSequenceNumber(t,r)))).next((r=>(n=r,o=Date.now(),this.removeTargets(t,n,e)))).next((e=>(s=e,a=Date.now(),this.removeOrphanedDocuments(t,n)))).next((t=>(u=Date.now(),zr()<=_.DEBUG&&jr("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${i-c}ms\n\tDetermined least recently used ${r} in `+(o-i)+"ms\n"+`\tRemoved ${s} targets in `+(a-o)+"ms\n"+`\tRemoved ${t} documents in `+(u-a)+"ms\n"+`Total Duration: ${u-c}ms`),Ps.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:s,documentsRemoved:t}))))}}function Tl(t,e){return new El(t,e)}class Sl{constructor(t,e){this.db=t,this.garbageCollector=Tl(this,e)}Hn(t){const e=this.Zn(t);return this.db.getTargetCache().getTargetCount(t).next((t=>e.next((e=>t+e))))}Zn(t){let e=0;return this.Jn(t,(t=>{e++})).next((()=>e))}forEachTarget(t,e){return this.db.getTargetCache().forEachTarget(t,e)}Jn(t,e){return this.Xn(t,((t,n)=>e(n)))}addReference(t,e,n){return xl(t,n)}removeReference(t,e,n){return xl(t,n)}removeTargets(t,e,n){return this.db.getTargetCache().removeTargets(t,e,n)}markPotentiallyOrphaned(t,e){return xl(t,e)}er(t,e){return function(t,e){let n=!1;return gl(t).Z((r=>hl(t,r,e).next((t=>(t&&(n=!0),Ps.resolve(!t)))))).next((()=>n))}(t,e)}removeOrphanedDocuments(t,e){const n=this.db.getRemoteDocumentCache().newChangeBuffer(),r=[];let s=0;return this.Xn(t,((i,o)=>{if(o<=e){const e=this.er(t,i).next((e=>{if(!e)return s++,n.getEntry(t,i).next((()=>(n.removeEntry(i,ps.min()),vl(t).delete(function(t){return[0,Js(t.path)]}(i)))))}));r.push(e)}})).next((()=>Ps.waitFor(r))).next((()=>n.apply(t))).next((()=>s))}removeTarget(t,e){const n=e.withSequenceNumber(t.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(t,n)}updateLimboDocument(t,e){return xl(t,e)}Xn(t,e){const n=vl(t);let r,s=Hs._e;return n.Y({index:"documentTargetsIndex"},(([t,n],{path:i,sequenceNumber:o})=>{0===t?(s!==Hs._e&&e(new _s(ei(r)),s),s=o,r=i):s=Hs._e})).next((()=>{s!==Hs._e&&e(new _s(ei(r)),s)}))}getCacheSize(t){return this.db.getRemoteDocumentCache().getSize(t)}}function xl(t,e){return vl(t).put(function(t,e){return{targetId:0,path:Js(t.path),sequenceNumber:e}}(e,t.currentSequenceNumber))}class Cl{constructor(){this.changes=new pa((t=>t.toString()),((t,e)=>t.isEqual(e))),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,bo.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?Ps.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}class Dl{constructor(t){this.serializer=t}setIndexManager(t){this.indexManager=t}addEntry(t,e,n){return Rl(t).put(n)}removeEntry(t,e,n){return Rl(t).delete(function(t,e){const n=t.path.toArray();return[n.slice(0,n.length-2),n[n.length-2],pc(e),n[n.length-1]]}(e,n))}updateMetadata(t,e){return this.getMetadata(t).next((n=>(n.byteSize+=e,this.tr(t,n))))}getEntry(t,e){let n=bo.newInvalidDocument(e);return Rl(t).Y({index:"documentKeyIndex",range:IDBKeyRange.only(Ml(e))},((t,r)=>{n=this.nr(e,r)})).next((()=>n))}rr(t,e){let n={size:0,document:bo.newInvalidDocument(e)};return Rl(t).Y({index:"documentKeyIndex",range:IDBKeyRange.only(Ml(e))},((t,r)=>{n={document:this.nr(e,r),size:cl(r)}})).next((()=>n))}getEntries(t,e){let n=wa();return this.ir(t,e,((t,e)=>{const r=this.nr(t,e);n=n.insert(t,r)})).next((()=>n))}sr(t,e){let n=wa(),r=new Ni(_s.comparator);return this.ir(t,e,((t,e)=>{const s=this.nr(t,e);n=n.insert(t,s),r=r.insert(t,cl(e))})).next((()=>({documents:n,_r:r})))}ir(t,e,n){if(e.isEmpty())return Ps.resolve();let r=new Mi(Ol);e.forEach((t=>r=r.add(t)));const s=IDBKeyRange.bound(Ml(r.first()),Ml(r.last())),i=r.getIterator();let o=i.getNext();return Rl(t).Y({index:"documentKeyIndex",range:s},((t,e,r)=>{const s=_s.fromSegments([...e.prefixPath,e.collectionGroup,e.documentId]);for(;o&&Ol(o,s)<0;)n(o,null),o=i.getNext();o&&o.isEqual(s)&&(n(o,e),o=i.hasNext()?i.getNext():null),o?r.U(Ml(o)):r.done()})).next((()=>{for(;o;)n(o,null),o=i.hasNext()?i.getNext():null}))}getDocumentsMatchingQuery(t,e,n,r,s){const i=e.path,o=[i.popLast().toArray(),i.lastSegment(),pc(n.readTime),n.documentKey.path.isEmpty()?"":n.documentKey.path.lastSegment()],a=[i.popLast().toArray(),i.lastSegment(),[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],""];return Rl(t).W(IDBKeyRange.bound(o,a,!0)).next((t=>{null==s||s.incrementDocumentReadCount(t.length);let n=wa();for(const s of t){const t=this.nr(_s.fromSegments(s.prefixPath.concat(s.collectionGroup,s.documentId)),s);t.isFoundDocument()&&(da(e,t)||r.has(t.key))&&(n=n.insert(t.key,t))}return n}))}getAllFromCollectionGroup(t,e,n,r){let s=wa();const i=Ll(e,n),o=Ll(e,ks.max());return Rl(t).Y({index:"collectionGroupIndex",range:IDBKeyRange.bound(i,o,!0)},((t,e,n)=>{const i=this.nr(_s.fromSegments(e.prefixPath.concat(e.collectionGroup,e.documentId)),e);s=s.insert(i.key,i),s.size===r&&n.done()})).next((()=>s))}newChangeBuffer(t){return new Nl(this,!!t&&t.trackRemovals)}getSize(t){return this.getMetadata(t).next((t=>t.byteSize))}getMetadata(t){return kl(t).get("remoteDocumentGlobalKey").next((t=>(Wr(!!t),t)))}tr(t,e){return kl(t).put("remoteDocumentGlobalKey",e)}nr(t,e){if(e){const t=function(t,e){let n;if(e.document)n=Ju(t.ct,e.document,!!e.hasCommittedMutations);else if(e.noDocument){const t=_s.fromSegments(e.noDocument.path),r=wc(e.noDocument.readTime);n=bo.newNoDocument(t,r),e.hasCommittedMutations&&n.setHasCommittedMutations()}else{if(!e.unknownDocument)return Hr();{const t=_s.fromSegments(e.unknownDocument.path),r=wc(e.unknownDocument.version);n=bo.newUnknownDocument(t,r)}}return e.readTime&&n.setReadTime(function(t){const e=new ms(t[0],t[1]);return ps.fromTimestamp(e)}(e.readTime)),n}(this.serializer,e);if(!t.isNoDocument()||!t.version.isEqual(ps.min()))return t}return bo.newInvalidDocument(t)}}function Al(t){return new Dl(t)}class Nl extends Cl{constructor(t,e){super(),this.ar=t,this.trackRemovals=e,this.ur=new pa((t=>t.toString()),((t,e)=>t.isEqual(e)))}applyChanges(t){const e=[];let n=0,r=new Mi(((t,e)=>ds(t.canonicalString(),e.canonicalString())));return this.changes.forEach(((s,i)=>{const o=this.ur.get(s);if(e.push(this.ar.removeEntry(t,s,o.readTime)),i.isValidDocument()){const a=mc(this.ar.serializer,i);r=r.add(s.path.popLast());const u=cl(a);n+=u-o.size,e.push(this.ar.addEntry(t,s,a))}else if(n-=o.size,this.trackRemovals){const n=mc(this.ar.serializer,i.convertToNoDocument(ps.min()));e.push(this.ar.addEntry(t,s,n))}})),r.forEach((n=>{e.push(this.ar.indexManager.addToCollectionParentIndex(t,n))})),e.push(this.ar.updateMetadata(t,n)),Ps.waitFor(e)}getFromCache(t,e){return this.ar.rr(t,e).next((t=>(this.ur.set(e,{size:t.size,readTime:t.document.readTime}),t.document)))}getAllFromCache(t,e){return this.ar.sr(t,e).next((({documents:t,_r:e})=>(e.forEach(((e,n)=>{this.ur.set(e,{size:n,readTime:t.get(e).readTime})})),t)))}}function kl(t){return xi(t,"remoteDocumentGlobal")}function Rl(t){return xi(t,"remoteDocumentsV14")}function Ml(t){const e=t.path.toArray();return[e.slice(0,e.length-2),e[e.length-2],e[e.length-1]]}function Ll(t,e){const n=e.documentKey.path.toArray();return[t,pc(e.readTime),n.slice(0,n.length-2),n.length>0?n[n.length-1]:""]}function Ol(t,e){const n=t.path.toArray(),r=e.path.toArray();let s=0;for(let t=0;t(n=r,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&Ja(n.mutation,t,Pi.empty(),ms.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Ca()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Ca()){const r=Ia();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=ba();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Ia();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Ca())))}populateOverlays(t,e,n){const r=[];return n.forEach((t=>{e.has(t)||r.push(t)})),this.documentOverlayCache.getOverlays(t,r).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,r){let s=wa();const i=Ta(),o=Ta();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof nu)?s=s.insert(e.key,e):void 0!==o?(i.set(e.key,o.mutation.getFieldMask()),Ja(o.mutation,e,o.mutation.getFieldMask(),ms.now())):i.set(e.key,Pi.empty())})),this.recalculateAndSaveOverlays(t,s).next((t=>(t.forEach(((t,e)=>i.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Pl(e,null!==(n=i.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=Ta();let r=new Ni(((t,e)=>t-e)),s=Ca();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const s of t)s.keys().forEach((t=>{const i=e.get(t);if(null===i)return;let o=n.get(t)||Pi.empty();o=s.applyToLocalView(i,o),n.set(t,o);const a=(r.get(s.batchId)||Ca()).add(t);r=r.insert(s.batchId,a)}))})).next((()=>{const i=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,u=r.value,c=Ea();u.forEach((t=>{if(!s.has(t)){const r=Ya(e.get(t),n.get(t));null!==r&&c.set(t,r),s=s.add(t)}})),i.push(this.documentOverlayCache.saveOverlays(t,a,c))}return Ps.waitFor(i)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.recalculateAndSaveOverlays(t,e)))}getDocumentsMatchingQuery(t,e,n,r){return function(t){return _s.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):ra(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n,r):this.getDocumentsMatchingCollectionQuery(t,e,n,r)}getNextDocuments(t,e,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,r).next((s=>{const i=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,r-s.size):Ps.resolve(Ia());let o=-1,a=s;return i.next((e=>Ps.forEach(e,((e,n)=>(o{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,s))).next((()=>this.computeViews(t,a,e,Ca()))).next((t=>({batchId:o,changes:_a(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new _s(e)).next((t=>{let e=ba();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n,r){const s=e.collectionGroup;let i=ba();return this.indexManager.getCollectionParents(t,s).next((o=>Ps.forEach(o,(o=>{const a=function(t,e){return new Zo(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,o.child(s));return this.getDocumentsMatchingCollectionQuery(t,a,n,r).next((t=>{t.forEach(((t,e)=>{i=i.insert(t,e)}))}))})).next((()=>i))))}getDocumentsMatchingCollectionQuery(t,e,n,r){let s;return this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId).next((i=>(s=i,this.remoteDocumentCache.getDocumentsMatchingQuery(t,e,n,s,r)))).next((t=>{s.forEach(((e,n)=>{const r=n.getKey();null===t.get(r)&&(t=t.insert(r,bo.newInvalidDocument(r)))}));let n=ba();return t.forEach(((t,r)=>{const i=s.get(t);void 0!==i&&Ja(i.mutation,r,Pi.empty(),ms.now()),da(e,r)&&(n=n.insert(t,r))})),n}))}}class Vl{constructor(t){this.serializer=t,this.cr=new Map,this.lr=new Map}getBundleMetadata(t,e){return Ps.resolve(this.cr.get(e))}saveBundleMetadata(t,e){return this.cr.set(e.id,function(t){return{id:t.id,version:t.version,createTime:Uu(t.createTime)}}(e)),Ps.resolve()}getNamedQuery(t,e){return Ps.resolve(this.lr.get(e))}saveNamedQuery(t,e){return this.lr.set(e.name,function(t){return{name:t.name,query:Ic(t.bundledQuery),readTime:Uu(t.readTime)}}(e)),Ps.resolve()}}class ql{constructor(){this.overlays=new Ni(_s.comparator),this.hr=new Map}getOverlay(t,e){return Ps.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Ia();return Ps.forEach(e,(e=>this.getOverlay(t,e).next((t=>{null!==t&&n.set(e,t)})))).next((()=>n))}saveOverlays(t,e,n){return n.forEach(((n,r)=>{this.ht(t,e,r)})),Ps.resolve()}removeOverlaysForBatchId(t,e,n){const r=this.hr.get(n);return void 0!==r&&(r.forEach((t=>this.overlays=this.overlays.remove(t))),this.hr.delete(n)),Ps.resolve()}getOverlaysForCollection(t,e,n){const r=Ia(),s=e.length+1,i=new _s(e.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const t=o.getNext().value,i=t.getKey();if(!e.isPrefixOf(i.path))break;i.path.length===s&&t.largestBatchId>n&&r.set(t.getKey(),t)}return Ps.resolve(r)}getOverlaysForCollectionGroup(t,e,n,r){let s=new Ni(((t,e)=>t-e));const i=this.overlays.getIterator();for(;i.hasNext();){const t=i.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=s.get(t.largestBatchId);null===e&&(e=Ia(),s=s.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Ia(),a=s.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=r)););return Ps.resolve(o)}ht(t,e,n){const r=this.overlays.get(n.key);if(null!==r){const t=this.hr.get(r.largestBatchId).delete(n.key);this.hr.set(r.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new lu(e,n));let s=this.hr.get(e);void 0===s&&(s=Ca(),this.hr.set(e,s)),this.hr.set(e,s.add(n.key))}}class Bl{constructor(){this.Pr=new Mi(Ul.Ir),this.Tr=new Mi(Ul.Er)}isEmpty(){return this.Pr.isEmpty()}addReference(t,e){const n=new Ul(t,e);this.Pr=this.Pr.add(n),this.Tr=this.Tr.add(n)}dr(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.Ar(new Ul(t,e))}Rr(t,e){t.forEach((t=>this.removeReference(t,e)))}Vr(t){const e=new _s(new ws([])),n=new Ul(e,t),r=new Ul(e,t+1),s=[];return this.Tr.forEachInRange([n,r],(t=>{this.Ar(t),s.push(t.key)})),s}mr(){this.Pr.forEach((t=>this.Ar(t)))}Ar(t){this.Pr=this.Pr.delete(t),this.Tr=this.Tr.delete(t)}gr(t){const e=new _s(new ws([])),n=new Ul(e,t),r=new Ul(e,t+1);let s=Ca();return this.Tr.forEachInRange([n,r],(t=>{s=s.add(t.key)})),s}containsKey(t){const e=new Ul(t,0),n=this.Pr.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Ul{constructor(t,e){this.key=t,this.pr=e}static Ir(t,e){return _s.comparator(t.key,e.key)||ds(t.pr,e.pr)}static Er(t,e){return ds(t.pr,e.pr)||_s.comparator(t.key,e.key)}}class zl{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.yr=1,this.wr=new Mi(Ul.Ir)}checkEmpty(t){return Ps.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,r){const s=this.yr;this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new uu(s,e,n,r);this.mutationQueue.push(i);for(const e of r)this.wr=this.wr.add(new Ul(e.key,s)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return Ps.resolve(i)}lookupMutationBatch(t,e){return Ps.resolve(this.Sr(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.br(n),s=r<0?0:r;return Ps.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return Ps.resolve(0===this.mutationQueue.length?-1:this.yr-1)}getAllMutationBatches(t){return Ps.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Ul(e,0),r=new Ul(e,Number.POSITIVE_INFINITY),s=[];return this.wr.forEachInRange([n,r],(t=>{const e=this.Sr(t.pr);s.push(e)})),Ps.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new Mi(ds);return e.forEach((t=>{const e=new Ul(t,0),r=new Ul(t,Number.POSITIVE_INFINITY);this.wr.forEachInRange([e,r],(t=>{n=n.add(t.pr)}))})),Ps.resolve(this.Dr(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let s=n;_s.isDocumentKey(s)||(s=s.child(""));const i=new Ul(new _s(s),0);let o=new Mi(ds);return this.wr.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t.pr)),!0)}),i),Ps.resolve(this.Dr(o))}Dr(t){const e=[];return t.forEach((t=>{const n=this.Sr(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){Wr(0===this.Cr(e.batchId,"removed")),this.mutationQueue.shift();let n=this.wr;return Ps.forEach(e.mutations,(r=>{const s=new Ul(r.key,e.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.wr=n}))}Mn(t){}containsKey(t,e){const n=new Ul(e,0),r=this.wr.firstAfterOrEqual(n);return Ps.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,Ps.resolve()}Cr(t,e){return this.br(t)}br(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}Sr(t){const e=this.br(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}class Gl{constructor(t){this.vr=t,this.docs=new Ni(_s.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,r=this.docs.get(n),s=r?r.size:0,i=this.vr(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:i}),this.size+=i-s,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return Ps.resolve(n?n.document.mutableCopy():bo.newInvalidDocument(e))}getEntries(t,e){let n=wa();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():bo.newInvalidDocument(t))})),Ps.resolve(n)}getDocumentsMatchingQuery(t,e,n,r){let s=wa();const i=e.path,o=new _s(i.child("")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){const{key:t,value:{document:o}}=a.getNext();if(!i.isPrefixOf(t.path))break;t.path.length>i.length+1||Rs(Ns(o),n)<=0||(r.has(o.key)||da(e,o))&&(s=s.insert(o.key,o.mutableCopy()))}return Ps.resolve(s)}getAllFromCollectionGroup(t,e,n,r){Hr()}Fr(t,e){return Ps.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new jl(this)}getSize(t){return Ps.resolve(this.size)}}class jl extends Cl{constructor(t){super(),this.ar=t}applyChanges(t){const e=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?e.push(this.ar.addEntry(t,r)):this.ar.removeEntry(n)})),Ps.waitFor(e)}getFromCache(t,e){return this.ar.getEntry(t,e)}getAllFromCache(t,e){return this.ar.getEntries(t,e)}}class Kl{constructor(t){this.persistence=t,this.Mr=new pa((t=>Qo(t)),Ho),this.lastRemoteSnapshotVersion=ps.min(),this.highestTargetId=0,this.Or=0,this.Nr=new Bl,this.targetCount=0,this.Br=ml.Nn()}forEachTarget(t,e){return this.Mr.forEach(((t,n)=>e(n))),Ps.resolve()}getLastRemoteSnapshotVersion(t){return Ps.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return Ps.resolve(this.Or)}allocateTargetId(t){return this.highestTargetId=this.Br.next(),Ps.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.Or&&(this.Or=e),Ps.resolve()}qn(t){this.Mr.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.Br=new ml(e),this.highestTargetId=e),t.sequenceNumber>this.Or&&(this.Or=t.sequenceNumber)}addTargetData(t,e){return this.qn(e),this.targetCount+=1,Ps.resolve()}updateTargetData(t,e){return this.qn(e),Ps.resolve()}removeTargetData(t,e){return this.Mr.delete(e.target),this.Nr.Vr(e.targetId),this.targetCount-=1,Ps.resolve()}removeTargets(t,e,n){let r=0;const s=[];return this.Mr.forEach(((i,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Mr.delete(i),s.push(this.removeMatchingKeysForTargetId(t,o.targetId)),r++)})),Ps.waitFor(s).next((()=>r))}getTargetCount(t){return Ps.resolve(this.targetCount)}getTargetData(t,e){const n=this.Mr.get(e)||null;return Ps.resolve(n)}addMatchingKeys(t,e,n){return this.Nr.dr(e,n),Ps.resolve()}removeMatchingKeys(t,e,n){this.Nr.Rr(e,n);const r=this.persistence.referenceDelegate,s=[];return r&&e.forEach((e=>{s.push(r.markPotentiallyOrphaned(t,e))})),Ps.waitFor(s)}removeMatchingKeysForTargetId(t,e){return this.Nr.Vr(e),Ps.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Nr.gr(e);return Ps.resolve(n)}containsKey(t,e){return Ps.resolve(this.Nr.containsKey(e))}}class $l{constructor(t,e){this.Lr={},this.overlays={},this.kr=new Hs(0),this.qr=!1,this.qr=!0,this.referenceDelegate=t(this),this.Qr=new Kl(this),this.indexManager=new Xc,this.remoteDocumentCache=function(t){return new Gl(t)}((t=>this.referenceDelegate.Kr(t))),this.serializer=new gc(e),this.$r=new Vl(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.qr=!1,Promise.resolve()}get started(){return this.qr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new ql,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Lr[t.toKey()];return n||(n=new zl(e,this.referenceDelegate),this.Lr[t.toKey()]=n),n}getTargetCache(){return this.Qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.$r}runTransaction(t,e,n){jr("MemoryPersistence","Starting transaction:",t);const r=new Ql(this.kr.next());return this.referenceDelegate.Ur(),n(r).next((t=>this.referenceDelegate.Wr(r).next((()=>t)))).toPromise().then((t=>(r.raiseOnCommittedEvent(),t)))}Gr(t,e){return Ps.or(Object.values(this.Lr).map((n=>()=>n.containsKey(t,e))))}}class Ql extends Ls{constructor(t){super(),this.currentSequenceNumber=t}}class Hl{constructor(t){this.persistence=t,this.zr=new Bl,this.jr=null}static Hr(t){return new Hl(t)}get Jr(){if(this.jr)return this.jr;throw Hr()}addReference(t,e,n){return this.zr.addReference(n,e),this.Jr.delete(n.toString()),Ps.resolve()}removeReference(t,e,n){return this.zr.removeReference(n,e),this.Jr.add(n.toString()),Ps.resolve()}markPotentiallyOrphaned(t,e){return this.Jr.add(e.toString()),Ps.resolve()}removeTarget(t,e){this.zr.Vr(e.targetId).forEach((t=>this.Jr.add(t.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((t=>{t.forEach((t=>this.Jr.add(t.toString())))})).next((()=>n.removeTargetData(t,e)))}Ur(){this.jr=new Set}Wr(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Ps.forEach(this.Jr,(n=>{const r=_s.fromPath(n);return this.Yr(t,r).next((t=>{t||e.removeEntry(r,ps.min())}))})).next((()=>(this.jr=null,e.apply(t))))}updateLimboDocument(t,e){return this.Yr(t,e).next((t=>{t?this.Jr.delete(e.toString()):this.Jr.add(e.toString())}))}Kr(t){return 0}Yr(t,e){return Ps.or([()=>Ps.resolve(this.zr.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Gr(t,e)])}}class Wl{constructor(t,e){this.persistence=t,this.Zr=new pa((t=>Js(t.path)),((t,e)=>t.isEqual(e))),this.garbageCollector=Tl(this,e)}static Hr(t,e){return new Wl(t,e)}Ur(){}Wr(t){return Ps.resolve()}forEachTarget(t,e){return this.persistence.getTargetCache().forEachTarget(t,e)}Hn(t){const e=this.Zn(t);return this.persistence.getTargetCache().getTargetCount(t).next((t=>e.next((e=>t+e))))}Zn(t){let e=0;return this.Jn(t,(t=>{e++})).next((()=>e))}Jn(t,e){return Ps.forEach(this.Zr,((n,r)=>this.er(t,n,r).next((t=>t?Ps.resolve():e(r)))))}removeTargets(t,e,n){return this.persistence.getTargetCache().removeTargets(t,e,n)}removeOrphanedDocuments(t,e){let n=0;const r=this.persistence.getRemoteDocumentCache(),s=r.newChangeBuffer();return r.Fr(t,(r=>this.er(t,r,e).next((t=>{t||(n++,s.removeEntry(r,ps.min()))})))).next((()=>s.apply(t))).next((()=>n))}markPotentiallyOrphaned(t,e){return this.Zr.set(e,t.currentSequenceNumber),Ps.resolve()}removeTarget(t,e){const n=e.withSequenceNumber(t.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(t,n)}addReference(t,e,n){return this.Zr.set(n,t.currentSequenceNumber),Ps.resolve()}removeReference(t,e,n){return this.Zr.set(n,t.currentSequenceNumber),Ps.resolve()}updateLimboDocument(t,e){return this.Zr.set(e,t.currentSequenceNumber),Ps.resolve()}Kr(t){let e=t.key.toString().length;return t.isFoundDocument()&&(e+=so(t.data.value)),e}er(t,e,n){return Ps.or([()=>this.persistence.Gr(t,e),()=>this.persistence.getTargetCache().containsKey(t,e),()=>{const t=this.Zr.get(e);return Ps.resolve(void 0!==t&&t>n)}])}getCacheSize(t){return this.persistence.getRemoteDocumentCache().getSize(t)}}class Yl{constructor(t){this.serializer=t}N(t,e,n,r){const s=new Fs("createOrUpgrade",e);n<1&&r>=1&&(function(t){t.createObjectStore("owner")}(t),function(t){t.createObjectStore("mutationQueues",{keyPath:"userId"}),t.createObjectStore("mutations",{keyPath:"batchId",autoIncrement:!0}).createIndex("userMutationsIndex",ni,{unique:!0}),t.createObjectStore("documentMutations")}(t),Xl(t),function(t){t.createObjectStore("remoteDocuments")}(t));let i=Ps.resolve();return n<3&&r>=3&&(0!==n&&(function(t){t.deleteObjectStore("targetDocuments"),t.deleteObjectStore("targets"),t.deleteObjectStore("targetGlobal")}(t),Xl(t)),i=i.next((()=>function(t){const e=t.store("targetGlobal"),n={highestTargetId:0,highestListenSequenceNumber:0,lastRemoteSnapshotVersion:ps.min().toTimestamp(),targetCount:0};return e.put("targetGlobalKey",n)}(s)))),n<4&&r>=4&&(0!==n&&(i=i.next((()=>function(t,e){return e.store("mutations").W().next((n=>{t.deleteObjectStore("mutations"),t.createObjectStore("mutations",{keyPath:"batchId",autoIncrement:!0}).createIndex("userMutationsIndex",ni,{unique:!0});const r=e.store("mutations"),s=n.map((t=>r.put(t)));return Ps.waitFor(s)}))}(t,s)))),i=i.next((()=>{!function(t){t.createObjectStore("clientMetadata",{keyPath:"clientId"})}(t)}))),n<5&&r>=5&&(i=i.next((()=>this.Xr(s)))),n<6&&r>=6&&(i=i.next((()=>(function(t){t.createObjectStore("remoteDocumentGlobal")}(t),this.ei(s))))),n<7&&r>=7&&(i=i.next((()=>this.ti(s)))),n<8&&r>=8&&(i=i.next((()=>this.ni(t,s)))),n<9&&r>=9&&(i=i.next((()=>{!function(t){t.objectStoreNames.contains("remoteDocumentChanges")&&t.deleteObjectStore("remoteDocumentChanges")}(t)}))),n<10&&r>=10&&(i=i.next((()=>this.ri(s)))),n<11&&r>=11&&(i=i.next((()=>{!function(t){t.createObjectStore("bundles",{keyPath:"bundleId"})}(t),function(t){t.createObjectStore("namedQueries",{keyPath:"name"})}(t)}))),n<12&&r>=12&&(i=i.next((()=>{!function(t){const e=t.createObjectStore("documentOverlays",{keyPath:yi});e.createIndex("collectionPathOverlayIndex",wi,{unique:!1}),e.createIndex("collectionGroupOverlayIndex",vi,{unique:!1})}(t)}))),n<13&&r>=13&&(i=i.next((()=>function(t){const e=t.createObjectStore("remoteDocumentsV14",{keyPath:oi});e.createIndex("documentKeyIndex",ai),e.createIndex("collectionGroupIndex",ui)}(t))).next((()=>this.ii(t,s))).next((()=>t.deleteObjectStore("remoteDocuments")))),n<14&&r>=14&&(i=i.next((()=>this.si(t,s)))),n<15&&r>=15&&(i=i.next((()=>function(t){t.createObjectStore("indexConfiguration",{keyPath:"indexId",autoIncrement:!0}).createIndex("collectionGroupIndex","collectionGroup",{unique:!1}),t.createObjectStore("indexState",{keyPath:fi}).createIndex("sequenceNumberIndex",gi,{unique:!1}),t.createObjectStore("indexEntries",{keyPath:mi}).createIndex("documentKeyIndex",pi,{unique:!1})}(t)))),i}ei(t){let e=0;return t.store("remoteDocuments").Y(((t,n)=>{e+=cl(n)})).next((()=>{const n={byteSize:e};return t.store("remoteDocumentGlobal").put("remoteDocumentGlobalKey",n)}))}Xr(t){const e=t.store("mutationQueues"),n=t.store("mutations");return e.W().next((e=>Ps.forEach(e,(e=>{const r=IDBKeyRange.bound([e.userId,-1],[e.userId,e.lastAcknowledgedBatchId]);return n.W("userMutationsIndex",r).next((n=>Ps.forEach(n,(n=>{Wr(n.userId===e.userId);const r=vc(this.serializer,n);return ul(t,e.userId,r).next((()=>{}))}))))}))))}ti(t){const e=t.store("targetDocuments"),n=t.store("remoteDocuments");return t.store("targetGlobal").get("targetGlobalKey").next((t=>{const r=[];return n.Y(((n,s)=>{const i=new ws(n),o=function(t){return[0,Js(t)]}(i);r.push(e.get(o).next((n=>n?Ps.resolve():(n=>e.put({targetId:0,path:Js(n),sequenceNumber:t.highestListenSequenceNumber}))(i))))})).next((()=>Ps.waitFor(r)))}))}ni(t,e){t.createObjectStore("collectionParents",{keyPath:di});const n=e.store("collectionParents"),r=new Jc,s=t=>{if(r.add(t)){const e=t.lastSegment(),r=t.popLast();return n.put({collectionId:e,parent:Js(r)})}};return e.store("remoteDocuments").Y({J:!0},((t,e)=>{const n=new ws(t);return s(n.popLast())})).next((()=>e.store("documentMutations").Y({J:!0},(([t,e,n],r)=>{const i=ei(e);return s(i.popLast())}))))}ri(t){const e=t.store("targets");return e.Y(((t,n)=>{const r=bc(n),s=_c(this.serializer,r);return e.put(s)}))}ii(t,e){const n=e.store("remoteDocuments"),r=[];return n.Y(((t,n)=>{const s=e.store("remoteDocumentsV14"),i=function(t){return t.document?new _s(ws.fromString(t.document.name).popFirst(5)):t.noDocument?_s.fromSegments(t.noDocument.path):t.unknownDocument?_s.fromSegments(t.unknownDocument.path):Hr()}(n).path.toArray(),o={prefixPath:i.slice(0,i.length-2),collectionGroup:i[i.length-2],documentId:i[i.length-1],readTime:n.readTime||[0,0],unknownDocument:n.unknownDocument,noDocument:n.noDocument,document:n.document,hasCommittedMutations:!!n.hasCommittedMutations};r.push(s.put(o))})).next((()=>Ps.waitFor(r)))}si(t,e){const n=e.store("mutations"),r=Al(this.serializer),s=new $l(Hl.Hr,this.serializer.ct);return n.W().next((t=>{const n=new Map;return t.forEach((t=>{var e;let r=null!==(e=n.get(t.userId))&&void 0!==e?e:Ca();vc(this.serializer,t).keys().forEach((t=>r=r.add(t))),n.set(t.userId,r)})),Ps.forEach(n,((t,n)=>{const i=new qr(n),o=Ac.lt(this.serializer,i),a=s.getIndexManager(i),u=ll.lt(i,this.serializer,a,s.referenceDelegate);return new Fl(r,u,o,a).recalculateAndSaveOverlaysForDocumentKeys(new Si(e,Hs._e),t).next()}))}))}}function Xl(t){t.createObjectStore("targetDocuments",{keyPath:li}).createIndex("documentTargetsIndex",hi,{unique:!0}),t.createObjectStore("targets",{keyPath:"targetId"}).createIndex("queryTargetsIndex",ci,{unique:!0}),t.createObjectStore("targetGlobal")}const Jl="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.";class Zl{constructor(t,e,n,r,s,i,o,a,u,c,l=15){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.oi=s,this.window=i,this.document=o,this._i=u,this.ai=c,this.ui=l,this.kr=null,this.qr=!1,this.isPrimary=!1,this.networkEnabled=!0,this.ci=null,this.inForeground=!1,this.li=null,this.hi=null,this.Pi=Number.NEGATIVE_INFINITY,this.Ii=t=>Promise.resolve(),!Zl.D())throw new Zr(Jr.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new Sl(this,r),this.Ti=e+"main",this.serializer=new gc(a),this.Ei=new Vs(this.Ti,this.ui,new Yl(this.serializer)),this.Qr=new pl(this.referenceDelegate,this.serializer),this.remoteDocumentCache=Al(this.serializer),this.$r=new xc,this.window&&this.window.localStorage?this.di=this.window.localStorage:(this.di=null,!1===c&&Kr("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}start(){return this.Ai().then((()=>{if(!this.isPrimary&&!this.allowTabSynchronization)throw new Zr(Jr.FAILED_PRECONDITION,Jl);return this.Ri(),this.Vi(),this.mi(),this.runTransaction("getHighestListenSequenceNumber","readonly",(t=>this.Qr.getHighestSequenceNumber(t)))})).then((t=>{this.kr=new Hs(t,this._i)})).then((()=>{this.qr=!0})).catch((t=>(this.Ei&&this.Ei.close(),Promise.reject(t))))}fi(t){return this.Ii=async e=>{if(this.started)return t(e)},t(this.isPrimary)}setDatabaseDeletedListener(t){this.Ei.L((async e=>{null===e.newVersion&&await t()}))}setNetworkEnabled(t){this.networkEnabled!==t&&(this.networkEnabled=t,this.oi.enqueueAndForget((async()=>{this.started&&await this.Ai()})))}Ai(){return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",(t=>eh(t).put({clientId:this.clientId,updateTimeMs:Date.now(),networkEnabled:this.networkEnabled,inForeground:this.inForeground}).next((()=>{if(this.isPrimary)return this.gi(t).next((t=>{t||(this.isPrimary=!1,this.oi.enqueueRetryable((()=>this.Ii(!1))))}))})).next((()=>this.pi(t))).next((e=>this.isPrimary&&!e?this.yi(t).next((()=>!1)):!!e&&this.wi(t).next((()=>!0)))))).catch((t=>{if(Us(t))return jr("IndexedDbPersistence","Failed to extend owner lease: ",t),this.isPrimary;if(!this.allowTabSynchronization)throw t;return jr("IndexedDbPersistence","Releasing owner lease after error during lease refresh",t),!1})).then((t=>{this.isPrimary!==t&&this.oi.enqueueRetryable((()=>this.Ii(t))),this.isPrimary=t}))}gi(t){return th(t).get("owner").next((t=>Ps.resolve(this.Si(t))))}bi(t){return eh(t).delete(this.clientId)}async Di(){if(this.isPrimary&&!this.Ci(this.Pi,18e5)){this.Pi=Date.now();const t=await this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",(t=>{const e=xi(t,"clientMetadata");return e.W().next((t=>{const n=this.vi(t,18e5),r=t.filter((t=>-1===n.indexOf(t)));return Ps.forEach(r,(t=>e.delete(t.clientId))).next((()=>r))}))})).catch((()=>[]));if(this.di)for(const e of t)this.di.removeItem(this.Fi(e.clientId))}}mi(){this.hi=this.oi.enqueueAfterDelay("client_metadata_refresh",4e3,(()=>this.Ai().then((()=>this.Di())).then((()=>this.mi()))))}Si(t){return!!t&&t.ownerId===this.clientId}pi(t){return this.ai?Ps.resolve(!0):th(t).get("owner").next((e=>{if(null!==e&&this.Ci(e.leaseTimestampMs,5e3)&&!this.Mi(e.ownerId)){if(this.Si(e)&&this.networkEnabled)return!0;if(!this.Si(e)){if(!e.allowTabSynchronization)throw new Zr(Jr.FAILED_PRECONDITION,Jl);return!1}}return!(!this.networkEnabled||!this.inForeground)||eh(t).W().next((t=>void 0===this.vi(t,5e3).find((t=>{if(this.clientId!==t.clientId){const e=!this.networkEnabled&&t.networkEnabled,n=!this.inForeground&&t.inForeground,r=this.networkEnabled===t.networkEnabled;if(e||n&&r)return!0}return!1}))))})).next((t=>(this.isPrimary!==t&&jr("IndexedDbPersistence",`Client ${t?"is":"is not"} eligible for a primary lease.`),t)))}async shutdown(){this.qr=!1,this.xi(),this.hi&&(this.hi.cancel(),this.hi=null),this.Oi(),this.Ni(),await this.Ei.runTransaction("shutdown","readwrite",["owner","clientMetadata"],(t=>{const e=new Si(t,Hs._e);return this.yi(e).next((()=>this.bi(e)))})),this.Ei.close(),this.Bi()}vi(t,e){return t.filter((t=>this.Ci(t.updateTimeMs,e)&&!this.Mi(t.clientId)))}Li(){return this.runTransaction("getActiveClients","readonly",(t=>eh(t).W().next((t=>this.vi(t,18e5).map((t=>t.clientId))))))}get started(){return this.qr}getMutationQueue(t,e){return ll.lt(t,this.serializer,e,this.referenceDelegate)}getTargetCache(){return this.Qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getIndexManager(t){return new tl(t,this.serializer.ct.databaseId)}getDocumentOverlayCache(t){return Ac.lt(this.serializer,t)}getBundleCache(){return this.$r}runTransaction(t,e,n){jr("IndexedDbPersistence","Starting transaction:",t);const r="readonly"===e?"readonly":"readwrite",s=function(t){return 15===t?Ti:14===t?Ei:13===t?Ii:12===t?_i:11===t?bi:void Hr()}(this.ui);let i;return this.Ei.runTransaction(t,r,s,(r=>(i=new Si(r,this.kr?this.kr.next():Hs._e),"readwrite-primary"===e?this.gi(i).next((t=>!!t||this.pi(i))).next((e=>{if(!e)throw Kr(`Failed to obtain primary lease for action '${t}'.`),this.isPrimary=!1,this.oi.enqueueRetryable((()=>this.Ii(!1))),new Zr(Jr.FAILED_PRECONDITION,Ms);return n(i)})).next((t=>this.wi(i).next((()=>t)))):this.ki(i).next((()=>n(i)))))).then((t=>(i.raiseOnCommittedEvent(),t)))}ki(t){return th(t).get("owner").next((t=>{if(null!==t&&this.Ci(t.leaseTimestampMs,5e3)&&!this.Mi(t.ownerId)&&!this.Si(t)&&!(this.ai||this.allowTabSynchronization&&t.allowTabSynchronization))throw new Zr(Jr.FAILED_PRECONDITION,Jl)}))}wi(t){const e={ownerId:this.clientId,allowTabSynchronization:this.allowTabSynchronization,leaseTimestampMs:Date.now()};return th(t).put("owner",e)}static D(){return Vs.D()}yi(t){const e=th(t);return e.get("owner").next((t=>this.Si(t)?(jr("IndexedDbPersistence","Releasing primary lease."),e.delete("owner")):Ps.resolve()))}Ci(t,e){const n=Date.now();return!(tn&&(Kr(`Detected an update time that is in the future: ${t} > ${n}`),1))}Ri(){null!==this.document&&"function"==typeof this.document.addEventListener&&(this.li=()=>{this.oi.enqueueAndForget((()=>(this.inForeground="visible"===this.document.visibilityState,this.Ai())))},this.document.addEventListener("visibilitychange",this.li),this.inForeground="visible"===this.document.visibilityState)}Oi(){this.li&&(this.document.removeEventListener("visibilitychange",this.li),this.li=null)}Vi(){var t;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.ci=()=>{this.xi();const t=/(?:Version|Mobile)\/1[456]/;f()&&(navigator.appVersion.match(t)||navigator.userAgent.match(t))&&this.oi.enterRestrictedMode(!0),this.oi.enqueueAndForget((()=>this.shutdown()))},this.window.addEventListener("pagehide",this.ci))}Ni(){this.ci&&(this.window.removeEventListener("pagehide",this.ci),this.ci=null)}Mi(t){var e;try{const n=null!==(null===(e=this.di)||void 0===e?void 0:e.getItem(this.Fi(t)));return jr("IndexedDbPersistence",`Client '${t}' ${n?"is":"is not"} zombied in LocalStorage`),n}catch(t){return Kr("IndexedDbPersistence","Failed to get zombied client id.",t),!1}}xi(){if(this.di)try{this.di.setItem(this.Fi(this.clientId),String(Date.now()))}catch(t){Kr("Failed to set zombie client id.",t)}}Bi(){if(this.di)try{this.di.removeItem(this.Fi(this.clientId))}catch(t){}}Fi(t){return`firestore_zombie_${this.persistenceKey}_${t}`}}function th(t){return xi(t,"owner")}function eh(t){return xi(t,"clientMetadata")}function nh(t,e){let n=t.projectId;return t.isDefaultDatabase||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}class rh{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.qi=n,this.Qi=r}static Ki(t,e){let n=Ca(),r=Ca();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:r=r.add(t.doc.key)}return new rh(t,e.fromCache,n,r)}}class sh{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(t){this._documentReadCount+=t}}class ih{constructor(){this.$i=!1,this.Ui=!1,this.Wi=100,this.Gi=f()?8:Vs.v(d())>0?6:4}initialize(t,e){this.zi=t,this.indexManager=e,this.$i=!0}getDocumentsMatchingQuery(t,e,n,r){const s={result:null};return this.ji(t,e).next((t=>{s.result=t})).next((()=>{if(!s.result)return this.Hi(t,e,r,n).next((t=>{s.result=t}))})).next((()=>{if(s.result)return;const n=new sh;return this.Ji(t,e,n).next((r=>{if(s.result=r,this.Ui)return this.Yi(t,e,n,r.size)}))})).next((()=>s.result))}Yi(t,e,n,r){return n.documentReadCountthis.Gi*r?(zr()<=_.DEBUG&&jr("QueryEngine","The SDK decides to create cache indexes for query:",ha(e),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(t,ia(e))):Ps.resolve())}ji(t,e){if(na(e))return Ps.resolve(null);let n=ia(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=ua(e,null,"F"),n=ia(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const s=Ca(...r);return this.zi.getDocuments(t,s).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const i=this.Zi(e,r);return this.Xi(e,i,s,n.readTime)?this.ji(t,ua(e,null,"F")):this.es(t,i,e,n)}))))})))))}Hi(t,e,n,r){return na(e)||r.isEqual(ps.min())?Ps.resolve(null):this.zi.getDocuments(t,n).next((s=>{const i=this.Zi(e,s);return this.Xi(e,i,n,r)?Ps.resolve(null):(zr()<=_.DEBUG&&jr("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),ha(e)),this.es(t,i,e,As(r,-1)).next((t=>t)))}))}Zi(t,e){let n=new Mi(ga(t));return e.forEach(((e,r)=>{da(t,r)&&(n=n.add(r))})),n}Xi(t,e,n,r){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const s="F"===t.limitType?e.last():e.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}Ji(t,e,n){return zr()<=_.DEBUG&&jr("QueryEngine","Using full collection scan to execute query:",ha(e)),this.zi.getDocumentsMatchingQuery(t,e,ks.min(),n)}es(t,e,n,r){return this.zi.getDocumentsMatchingQuery(t,n,r).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}class oh{constructor(t,e,n,r){this.persistence=t,this.ts=e,this.serializer=r,this.ns=new Ni(ds),this.rs=new pa((t=>Qo(t)),Ho),this.ss=new Map,this.os=t.getRemoteDocumentCache(),this.Qr=t.getTargetCache(),this.$r=t.getBundleCache(),this._s(n)}_s(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new Fl(this.os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.os.setIndexManager(this.indexManager),this.ts.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.ns)))}}function ah(t,e,n,r){return new oh(t,e,n,r)}async function uh(t,e){const n=Xr(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((s=>(r=s,n._s(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const s=[],i=[];let o=Ca();for(const t of r){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({us:t,removedBatchIds:s,addedBatchIds:i})))}))}))}function ch(t){const e=Xr(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Qr.getLastRemoteSnapshotVersion(t)))}function lh(t,e,n){let r=Ca(),s=Ca();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=wa();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(ps.min())?(e.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),r=r.insert(n,i)):jr("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{cs:r,ls:s}}))}function hh(t,e){const n=Xr(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}function dh(t,e){const n=Xr(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Qr.getTargetData(t,e).next((s=>s?(r=s,Ps.resolve(r)):n.Qr.allocateTargetId(t).next((s=>(r=new fc(e,s,"TargetPurposeListen",t.currentSequenceNumber),n.Qr.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.ns.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.ns=n.ns.insert(t.targetId,t),n.rs.set(e,t.targetId)),t}))}async function fh(t,e,n){const r=Xr(t),s=r.ns.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(t=>r.persistence.referenceDelegate.removeTarget(t,s)))}catch(t){if(!Us(t))throw t;jr("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.ns=r.ns.remove(e),r.rs.delete(s.target)}function gh(t,e,n){const r=Xr(t);let s=ps.min(),i=Ca();return r.persistence.runTransaction("Execute query","readwrite",(t=>function(t,e,n){const r=Xr(t),s=r.rs.get(n);return void 0!==s?Ps.resolve(r.ns.get(s)):r.Qr.getTargetData(e,n)}(r,t,ia(e)).next((e=>{if(e)return s=e.lastLimboFreeSnapshotVersion,r.Qr.getMatchingKeysForTargetId(t,e.targetId).next((t=>{i=t}))})).next((()=>r.ts.getDocumentsMatchingQuery(t,e,n?s:ps.min(),n?i:Ca()))).next((t=>(yh(r,fa(e),t),{documents:t,hs:i})))))}function mh(t,e){const n=Xr(t),r=Xr(n.Qr),s=n.ns.get(e);return s?Promise.resolve(s.target):n.persistence.runTransaction("Get target data","readonly",(t=>r._t(t,e).next((t=>t?t.target:null))))}function ph(t,e){const n=Xr(t),r=n.ss.get(e)||ps.min();return n.persistence.runTransaction("Get new document changes","readonly",(t=>n.os.getAllFromCollectionGroup(t,e,As(r,-1),Number.MAX_SAFE_INTEGER))).then((t=>(yh(n,e,t),t)))}function yh(t,e,n){let r=t.ss.get(e)||ps.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.ss.set(e,r)}async function wh(t,e,n=Ca()){const r=await dh(t,ia(Ic(e.bundledQuery))),s=Xr(t);return s.persistence.runTransaction("Save named query","readwrite",(t=>{const i=Uu(e.readTime);if(r.snapshotVersion.compareTo(i)>=0)return s.$r.saveNamedQuery(t,e);const o=r.withResumeToken(qi.EMPTY_BYTE_STRING,i);return s.ns=s.ns.insert(o.targetId,o),s.Qr.updateTargetData(t,o).next((()=>s.Qr.removeMatchingKeysForTargetId(t,r.targetId))).next((()=>s.Qr.addMatchingKeys(t,n,r.targetId))).next((()=>s.$r.saveNamedQuery(t,e)))}))}function vh(t,e){return`firestore_clients_${t}_${e}`}function bh(t,e,n){let r=`firestore_mutations_${t}_${n}`;return e.isAuthenticated()&&(r+=`_${e.uid}`),r}function _h(t,e){return`firestore_targets_${t}_${e}`}class Ih{constructor(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}static Es(t,e,n){const r=JSON.parse(n);let s,i="object"==typeof r&&-1!==["pending","acknowledged","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error);return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code,i&&(s=new Zr(r.error.code,r.error.message))),i?new Ih(t,e,r.state,s):(Kr("SharedClientState",`Failed to parse mutation state for ID '${e}': ${n}`),null)}ds(){const t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)}}class Eh{constructor(t,e,n){this.targetId=t,this.state=e,this.error=n}static Es(t,e){const n=JSON.parse(e);let r,s="object"==typeof n&&-1!==["not-current","current","rejected"].indexOf(n.state)&&(void 0===n.error||"object"==typeof n.error);return s&&n.error&&(s="string"==typeof n.error.message&&"string"==typeof n.error.code,s&&(r=new Zr(n.error.code,n.error.message))),s?new Eh(t,n.state,r):(Kr("SharedClientState",`Failed to parse target state for ID '${t}': ${e}`),null)}ds(){const t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)}}class Th{constructor(t,e){this.clientId=t,this.activeTargetIds=e}static Es(t,e){const n=JSON.parse(e);let r="object"==typeof n&&n.activeTargetIds instanceof Array,s=Aa();for(let t=0;r&&tthis.shutdown())),this.started=!0}writeSequenceNumber(t){this.setItem(this.Ss,JSON.stringify(t))}getAllActiveQueryTargets(){return this.Ns(this.ps)}isActiveQueryTarget(t){let e=!1;return this.ps.forEach(((n,r)=>{r.activeTargetIds.has(t)&&(e=!0)})),e}addPendingMutation(t){this.Bs(t,"pending")}updateMutationState(t,e,n){this.Bs(t,e,n),this.Ls(t)}addLocalQueryTarget(t){let e="not-current";if(this.isActiveQueryTarget(t)){const n=this.storage.getItem(_h(this.persistenceKey,t));if(n){const r=Eh.Es(t,n);r&&(e=r.state)}}return this.ks.As(t),this.Ms(),e}removeLocalQueryTarget(t){this.ks.Rs(t),this.Ms()}isLocalQueryTarget(t){return this.ks.activeTargetIds.has(t)}clearQueryState(t){this.removeItem(_h(this.persistenceKey,t))}updateQueryState(t,e,n){this.qs(t,e,n)}handleUserChange(t,e,n){e.forEach((t=>{this.Ls(t)})),this.currentUser=t,n.forEach((t=>{this.addPendingMutation(t)}))}setOnlineState(t){this.Qs(t)}notifyBundleLoaded(t){this.Ks(t)}shutdown(){this.started&&(this.window.removeEventListener("storage",this.fs),this.removeItem(this.ws),this.started=!1)}getItem(t){const e=this.storage.getItem(t);return jr("SharedClientState","READ",t,e),e}setItem(t,e){jr("SharedClientState","SET",t,e),this.storage.setItem(t,e)}removeItem(t){jr("SharedClientState","REMOVE",t),this.storage.removeItem(t)}gs(t){const e=t;if(e.storageArea===this.storage){if(jr("SharedClientState","EVENT",e.key,e.newValue),e.key===this.ws)return void Kr("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.oi.enqueueRetryable((async()=>{if(this.started){if(null!==e.key)if(this.bs.test(e.key)){if(null==e.newValue){const t=this.$s(e.key);return this.Us(t,null)}{const t=this.Ws(e.key,e.newValue);if(t)return this.Us(t.clientId,t)}}else if(this.Ds.test(e.key)){if(null!==e.newValue){const t=this.Gs(e.key,e.newValue);if(t)return this.zs(t)}}else if(this.Cs.test(e.key)){if(null!==e.newValue){const t=this.js(e.key,e.newValue);if(t)return this.Hs(t)}}else if(e.key===this.vs){if(null!==e.newValue){const t=this.xs(e.newValue);if(t)return this.Os(t)}}else if(e.key===this.Ss){const t=function(t){let e=Hs._e;if(null!=t)try{const n=JSON.parse(t);Wr("number"==typeof n),e=n}catch(t){Kr("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(e.newValue);t!==Hs._e&&this.sequenceNumberHandler(t)}else if(e.key===this.Fs){const t=this.Js(e.newValue);await Promise.all(t.map((t=>this.syncEngine.Ys(t))))}}else this.ys.push(e)}))}}get ks(){return this.ps.get(this.Vs)}Ms(){this.setItem(this.ws,this.ks.ds())}Bs(t,e,n){const r=new Ih(this.currentUser,t,e,n),s=bh(this.persistenceKey,this.currentUser,t);this.setItem(s,r.ds())}Ls(t){const e=bh(this.persistenceKey,this.currentUser,t);this.removeItem(e)}Qs(t){const e={clientId:this.Vs,onlineState:t};this.storage.setItem(this.vs,JSON.stringify(e))}qs(t,e,n){const r=_h(this.persistenceKey,t),s=new Eh(t,e,n);this.setItem(r,s.ds())}Ks(t){const e=JSON.stringify(Array.from(t));this.setItem(this.Fs,e)}$s(t){const e=this.bs.exec(t);return e?e[1]:null}Ws(t,e){const n=this.$s(t);return Th.Es(n,e)}Gs(t,e){const n=this.Ds.exec(t),r=Number(n[1]),s=void 0!==n[2]?n[2]:null;return Ih.Es(new qr(s),r,e)}js(t,e){const n=this.Cs.exec(t),r=Number(n[1]);return Eh.Es(r,e)}xs(t){return Sh.Es(t)}Js(t){return JSON.parse(t)}async zs(t){if(t.user.uid===this.currentUser.uid)return this.syncEngine.Zs(t.batchId,t.state,t.error);jr("SharedClientState",`Ignoring mutation for non-active user ${t.user.uid}`)}Hs(t){return this.syncEngine.Xs(t.targetId,t.state,t.error)}Us(t,e){const n=e?this.ps.insert(t,e):this.ps.remove(t),r=this.Ns(this.ps),s=this.Ns(n),i=[],o=[];return s.forEach((t=>{r.has(t)||i.push(t)})),r.forEach((t=>{s.has(t)||o.push(t)})),this.syncEngine.eo(i,o).then((()=>{this.ps=n}))}Os(t){this.ps.get(t.clientId)&&this.onlineStateHandler(t.onlineState)}Ns(t){let e=Aa();return t.forEach(((t,n)=>{e=e.unionWith(n.activeTargetIds)})),e}}class Dh{constructor(){this.no=new xh,this.ro={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.no.As(t),this.ro[t]||"not-current"}updateQueryState(t,e,n){this.ro[t]=e}removeLocalQueryTarget(t){this.no.Rs(t)}isLocalQueryTarget(t){return this.no.activeTargetIds.has(t)}clearQueryState(t){delete this.ro[t]}getAllActiveQueryTargets(){return this.no.activeTargetIds}isActiveQueryTarget(t){return this.no.activeTargetIds.has(t)}start(){return this.no=new xh,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}class Ah{io(t){}shutdown(){}}class Nh{constructor(){this.so=()=>this.oo(),this._o=()=>this.ao(),this.uo=[],this.co()}io(t){this.uo.push(t)}shutdown(){window.removeEventListener("online",this.so),window.removeEventListener("offline",this._o)}co(){window.addEventListener("online",this.so),window.addEventListener("offline",this._o)}oo(){jr("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.uo)t(0)}ao(){jr("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.uo)t(1)}static D(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let kh=null;function Rh(){return null===kh?kh=268435456+Math.round(2147483648*Math.random()):kh++,"0x"+kh.toString(16)}const Mh={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class Lh{constructor(t){this.lo=t.lo,this.ho=t.ho}Po(t){this.Io=t}To(t){this.Eo=t}onMessage(t){this.Ao=t}close(){this.ho()}send(t){this.lo(t)}Ro(){this.Io()}Vo(t){this.Eo(t)}mo(t){this.Ao(t)}}const Oh="WebChannelConnection";class Ph extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.fo=e+"://"+t.host,this.po=`projects/${n}/databases/${r}`,this.yo="(default)"===this.databaseId.database?`project_id=${n}`:`project_id=${n}&database_id=${r}`}get wo(){return!1}So(t,e,n,r,s){const i=Rh(),o=this.bo(t,e.toUriEncodedString());jr("RestConnection",`Sending RPC '${t}' ${i}:`,o,n);const a={"google-cloud-resource-prefix":this.po,"x-goog-request-params":this.yo};return this.Do(a,r,s),this.Co(t,o,a,n).then((e=>(jr("RestConnection",`Received RPC '${t}' ${i}: `,e),e)),(e=>{throw $r("RestConnection",`RPC '${t}' ${i} failed with error: `,e,"url: ",o,"request:",n),e}))}vo(t,e,n,r,s,i){return this.So(t,e,n,r,s)}Do(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Br,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((e,n)=>t[n]=e)),n&&n.headers.forEach(((e,n)=>t[n]=e))}bo(t,e){const n=Mh[t];return`${this.fo}/v1/${e}:${n}`}terminate(){}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams,this.longPollingOptions=t.longPollingOptions}Co(t,e,n,r){const s=Rh();return new Promise(((i,o)=>{const a=new Or;a.setWithCredentials(!0),a.listenOnce(Rr.COMPLETE,(()=>{try{switch(a.getLastErrorCode()){case kr.NO_ERROR:const e=a.getResponseJson();jr(Oh,`XHR for RPC '${t}' ${s} received:`,JSON.stringify(e)),i(e);break;case kr.TIMEOUT:jr(Oh,`RPC '${t}' ${s} timed out`),o(new Zr(Jr.DEADLINE_EXCEEDED,"Request time out"));break;case kr.HTTP_ERROR:const n=a.getStatus();if(jr(Oh,`RPC '${t}' ${s} failed with status:`,n,"response text:",a.getResponseText()),n>0){let t=a.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=null==t?void 0:t.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(Jr).indexOf(e)>=0?e:Jr.UNKNOWN}(e.status);o(new Zr(t,e.message))}else o(new Zr(Jr.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new Zr(Jr.UNAVAILABLE,"Connection failed."));break;default:Hr()}}finally{jr(Oh,`RPC '${t}' ${s} completed.`)}}));const u=JSON.stringify(r);jr(Oh,`RPC '${t}' ${s} sending request:`,r),a.send(e,"POST",u,n,15)}))}Fo(t,e,n){const r=Rh(),s=[this.fo,"/","google.firestore.v1.Firestore","/",t,"/channel"],i=new ar,o=oe(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},u=this.longPollingOptions.timeoutSeconds;void 0!==u&&(a.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(a.useFetchStreams=!0),this.Do(a.initMessageHeaders,e,n),a.encodeInitMessageHeaders=!0;const c=s.join("");jr(Oh,`Creating RPC '${t}' stream ${r}: ${c}`,a);const l=i.createWebChannel(c,a);let h=!1,d=!1;const f=new Lh({lo:e=>{d?jr(Oh,`Not sending because RPC '${t}' stream ${r} is closed:`,e):(h||(jr(Oh,`Opening RPC '${t}' stream ${r} transport.`),l.open(),h=!0),jr(Oh,`RPC '${t}' stream ${r} sending:`,e),l.send(e))},ho:()=>l.close()}),g=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return g(l,Lr.EventType.OPEN,(()=>{d||jr(Oh,`RPC '${t}' stream ${r} transport opened.`)})),g(l,Lr.EventType.CLOSE,(()=>{d||(d=!0,jr(Oh,`RPC '${t}' stream ${r} transport closed`),f.Vo())})),g(l,Lr.EventType.ERROR,(e=>{d||(d=!0,$r(Oh,`RPC '${t}' stream ${r} transport errored:`,e),f.Vo(new Zr(Jr.UNAVAILABLE,"The operation could not be completed")))})),g(l,Lr.EventType.MESSAGE,(e=>{var n;if(!d){const s=e.data[0];Wr(!!s);const i=s,o=i.error||(null===(n=i[0])||void 0===n?void 0:n.error);if(o){jr(Oh,`RPC '${t}' stream ${r} received error:`,o);const e=o.status;let n=function(t){const e=fu[t];if(void 0!==e)return pu(e)}(e),s=o.message;void 0===n&&(n=Jr.INTERNAL,s="Unknown error status: "+e+" with message "+o.message),d=!0,f.Vo(new Zr(n,s)),l.close()}else jr(Oh,`RPC '${t}' stream ${r} received:`,s),f.mo(s)}})),g(o,Mr.STAT_EVENT,(e=>{10===e.stat?jr(Oh,`RPC '${t}' stream ${r} detected buffering proxy`):11===e.stat&&jr(Oh,`RPC '${t}' stream ${r} detected no buffering proxy`)})),setTimeout((()=>{f.Ro()}),0),f}}function Fh(){return"undefined"!=typeof window?window:null}function Vh(){return"undefined"!=typeof document?document:null}function qh(t){return new Pu(t,!0)}class Bh{constructor(t,e,n=1e3,r=1.5,s=6e4){this.oi=t,this.timerId=e,this.Mo=n,this.xo=r,this.Oo=s,this.No=0,this.Bo=null,this.Lo=Date.now(),this.reset()}reset(){this.No=0}ko(){this.No=this.Oo}qo(t){this.cancel();const e=Math.floor(this.No+this.Qo()),n=Math.max(0,Date.now()-this.Lo),r=Math.max(0,e-n);r>0&&jr("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.No} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.Bo=this.oi.enqueueAfterDelay(this.timerId,r,(()=>(this.Lo=Date.now(),t()))),this.No*=this.xo,this.Nothis.Oo&&(this.No=this.Oo)}Ko(){null!==this.Bo&&(this.Bo.skipDelay(),this.Bo=null)}cancel(){null!==this.Bo&&(this.Bo.cancel(),this.Bo=null)}Qo(){return(Math.random()-.5)*this.No}}class Uh{constructor(t,e,n,r,s,i,o,a){this.oi=t,this.$o=n,this.Uo=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.Wo=0,this.Go=null,this.zo=null,this.stream=null,this.jo=new Bh(t,e)}Ho(){return 1===this.state||5===this.state||this.Jo()}Jo(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Yo()}async stop(){this.Ho()&&await this.close(0)}Zo(){this.state=0,this.jo.reset()}Xo(){this.Jo()&&null===this.Go&&(this.Go=this.oi.enqueueAfterDelay(this.$o,6e4,(()=>this.e_())))}t_(t){this.n_(),this.stream.send(t)}async e_(){if(this.Jo())return this.close(0)}n_(){this.Go&&(this.Go.cancel(),this.Go=null)}r_(){this.zo&&(this.zo.cancel(),this.zo=null)}async close(t,e){this.n_(),this.r_(),this.jo.cancel(),this.Wo++,4!==t?this.jo.reset():e&&e.code===Jr.RESOURCE_EXHAUSTED?(Kr(e.toString()),Kr("Using maximum backoff delay to prevent overloading the backend."),this.jo.ko()):e&&e.code===Jr.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.i_(),this.stream.close(),this.stream=null),this.state=t,await this.listener.To(e)}i_(){}auth(){this.state=1;const t=this.s_(this.Wo),e=this.Wo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.Wo===e&&this.o_(t,n)}),(e=>{t((()=>{const t=new Zr(Jr.UNKNOWN,"Fetching auth token failed: "+e.message);return this.__(t)}))}))}o_(t,e){const n=this.s_(this.Wo);this.stream=this.a_(t,e),this.stream.Po((()=>{n((()=>(this.state=2,this.zo=this.oi.enqueueAfterDelay(this.Uo,1e4,(()=>(this.Jo()&&(this.state=3),Promise.resolve()))),this.listener.Po())))})),this.stream.To((t=>{n((()=>this.__(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Yo(){this.state=5,this.jo.qo((async()=>{this.state=0,this.start()}))}__(t){return jr("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}s_(t){return e=>{this.oi.enqueueAndForget((()=>this.Wo===t?e():(jr("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class zh extends Uh{constructor(t,e,n,r,s,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,i),this.serializer=s}a_(t,e){return this.connection.Fo("Listen",t,e)}onMessage(t){this.jo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Hr()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(t,e){return t.useProto3Json?(Wr(void 0===e||"string"==typeof e),qi.fromBase64String(e||"")):(Wr(void 0===e||e instanceof Uint8Array),qi.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Jr.UNKNOWN:pu(t.code);return new Zr(e,t.message||"")}(o);n=new Du(r,s,i,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=$u(t,r.document.name),i=Uu(r.document.updateTime),o=r.document.createTime?Uu(r.document.createTime):ps.min(),a=new wo({mapValue:{fields:r.document.fields}}),u=bo.newFoundDocument(s,i,o,a),c=r.targetIds||[],l=r.removedTargetIds||[];n=new xu(c,l,u.key,u)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=$u(t,r.document),i=r.readTime?Uu(r.readTime):ps.min(),o=bo.newNoDocument(s,i),a=r.removedTargetIds||[];n=new xu([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=$u(t,r.document),i=r.removedTargetIds||[];n=new xu([],i,s,null)}else{if(!("filter"in e))return Hr();{e.filter;const t=e.filter;t.targetId;const{count:r=0,unchangedNames:s}=t,i=new du(r,s),o=t.targetId;n=new Cu(o,i)}}return n}(this.serializer,t),n=function(t){if(!("targetChange"in t))return ps.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?ps.min():e.readTime?Uu(e.readTime):ps.min()}(t);return this.listener.u_(e,n)}c_(t){const e={};e.database=Wu(this.serializer),e.addTarget=function(t,e){let n;const r=e.target;if(n=Wo(r)?{documents:ec(t,r)}:{query:nc(t,r).ut},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0){n.resumeToken=qu(t,e.resumeToken);const r=Fu(t,e.expectedCount);null!==r&&(n.expectedCount=r)}else if(e.snapshotVersion.compareTo(ps.min())>0){n.readTime=Vu(t,e.snapshotVersion.toTimestamp());const r=Fu(t,e.expectedCount);null!==r&&(n.expectedCount=r)}return n}(this.serializer,t);const n=function(t,e){const n=function(t){switch(t){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Hr()}}(e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,t);n&&(e.labels=n),this.t_(e)}l_(t){const e={};e.database=Wu(this.serializer),e.removeTarget=t,this.t_(e)}}class Gh extends Uh{constructor(t,e,n,r,s,i){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,r,i),this.serializer=s,this.h_=!1}get P_(){return this.h_}start(){this.h_=!1,this.lastStreamToken=void 0,super.start()}i_(){this.h_&&this.I_([])}a_(t,e){return this.connection.Fo("Write",t,e)}onMessage(t){if(Wr(!!t.streamToken),this.lastStreamToken=t.streamToken,this.h_){this.jo.reset();const e=function(t,e){return t&&t.length>0?(Wr(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Uu(t.updateTime):Uu(e);return n.isEqual(ps.min())&&(n=Uu(e)),new $a(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Uu(t.commitTime);return this.listener.T_(n,e)}return Wr(!t.writeResults||0===t.writeResults.length),this.h_=!0,this.listener.E_()}d_(){const t={};t.database=Wu(this.serializer),this.t_(t)}I_(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>Zu(this.serializer,t)))};this.t_(e)}}class jh extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.serializer=r,this.A_=!1}R_(){if(this.A_)throw new Zr(Jr.FAILED_PRECONDITION,"The client has already been terminated.")}So(t,e,n,r){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,i])=>this.connection.So(t,Gu(e,n),r,s,i))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Jr.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Zr(Jr.UNKNOWN,t.toString())}))}vo(t,e,n,r,s){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,o])=>this.connection.vo(t,Gu(e,n),r,i,o,s))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Jr.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Zr(Jr.UNKNOWN,t.toString())}))}terminate(){this.A_=!0,this.connection.terminate()}}class Kh{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.m_=0,this.f_=null,this.g_=!0}p_(){0===this.m_&&(this.y_("Unknown"),this.f_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.f_=null,this.w_("Backend didn't respond within 10 seconds."),this.y_("Offline"),Promise.resolve()))))}S_(t){"Online"===this.state?this.y_("Unknown"):(this.m_++,this.m_>=1&&(this.b_(),this.w_(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.y_("Offline")))}set(t){this.b_(),this.m_=0,"Online"===t&&(this.g_=!1),this.y_(t)}y_(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}w_(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.g_?(Kr(e),this.g_=!1):jr("OnlineStateTracker",e)}b_(){null!==this.f_&&(this.f_.cancel(),this.f_=null)}}class $h{constructor(t,e,n,r,s){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.D_=[],this.C_=new Map,this.v_=new Set,this.F_=[],this.M_=s,this.M_.io((t=>{n.enqueueAndForget((async()=>{ed(this)&&(jr("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Xr(t);e.v_.add(4),await Hh(e),e.x_.set("Unknown"),e.v_.delete(4),await Qh(e)}(this))}))})),this.x_=new Kh(n,r)}}async function Qh(t){if(ed(t))for(const e of t.F_)await e(!0)}async function Hh(t){for(const e of t.F_)await e(!1)}function Wh(t,e){const n=Xr(t);n.C_.has(e.targetId)||(n.C_.set(e.targetId,e),td(n)?Zh(n):vd(n).Jo()&&Xh(n,e))}function Yh(t,e){const n=Xr(t),r=vd(n);n.C_.delete(e),r.Jo()&&Jh(n,e),0===n.C_.size&&(r.Jo()?r.Xo():ed(n)&&n.x_.set("Unknown"))}function Xh(t,e){if(t.O_.Oe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(ps.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}vd(t).c_(e)}function Jh(t,e){t.O_.Oe(e),vd(t).l_(e)}function Zh(t){t.O_=new Nu({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),_t:e=>t.C_.get(e)||null,nt:()=>t.datastore.serializer.databaseId}),vd(t).start(),t.x_.p_()}function td(t){return ed(t)&&!vd(t).Ho()&&t.C_.size>0}function ed(t){return 0===Xr(t).v_.size}function nd(t){t.O_=void 0}async function rd(t){t.C_.forEach(((e,n)=>{Xh(t,e)}))}async function sd(t,e){nd(t),td(t)?(t.x_.S_(e),Zh(t)):t.x_.set("Unknown")}async function id(t,e,n){if(t.x_.set("Online"),e instanceof Du&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const r of e.targetIds)t.C_.has(r)&&(await t.remoteSyncer.rejectListen(r,n),t.C_.delete(r),t.O_.removeTarget(r))}(t,e)}catch(n){jr("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await od(t,n)}else if(e instanceof xu?t.O_.$e(e):e instanceof Cu?t.O_.Je(e):t.O_.Ge(e),!n.isEqual(ps.min()))try{const e=await ch(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.O_.it(e);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const s=t.C_.get(r);s&&t.C_.set(r,s.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach(((e,n)=>{const r=t.C_.get(e);if(!r)return;t.C_.set(e,r.withResumeToken(qi.EMPTY_BYTE_STRING,r.snapshotVersion)),Jh(t,e);const s=new fc(r.target,e,n,r.sequenceNumber);Xh(t,s)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){jr("RemoteStore","Failed to raise snapshot:",e),await od(t,e)}}async function od(t,e,n){if(!Us(e))throw e;t.v_.add(1),await Hh(t),t.x_.set("Offline"),n||(n=()=>ch(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{jr("RemoteStore","Retrying IndexedDB access"),await n(),t.v_.delete(1),await Qh(t)}))}function ad(t,e){return e().catch((n=>od(t,n,e)))}async function ud(t){const e=Xr(t),n=bd(e);let r=e.D_.length>0?e.D_[e.D_.length-1].batchId:-1;for(;cd(e);)try{const t=await hh(e.localStore,r);if(null===t){0===e.D_.length&&n.Xo();break}r=t.batchId,ld(e,t)}catch(t){await od(e,t)}hd(e)&&dd(e)}function cd(t){return ed(t)&&t.D_.length<10}function ld(t,e){t.D_.push(e);const n=bd(t);n.Jo()&&n.P_&&n.I_(e.mutations)}function hd(t){return ed(t)&&!bd(t).Ho()&&t.D_.length>0}function dd(t){bd(t).start()}async function fd(t){bd(t).d_()}async function gd(t){const e=bd(t);for(const n of t.D_)e.I_(n.mutations)}async function md(t,e,n){const r=t.D_.shift(),s=cu.from(r,e,n);await ad(t,(()=>t.remoteSyncer.applySuccessfulWrite(s))),await ud(t)}async function pd(t,e){e&&bd(t).P_&&await async function(t,e){if(function(t){return mu(t)&&t!==Jr.ABORTED}(e.code)){const n=t.D_.shift();bd(t).Zo(),await ad(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await ud(t)}}(t,e),hd(t)&&dd(t)}async function yd(t,e){const n=Xr(t);n.asyncQueue.verifyOperationInProgress(),jr("RemoteStore","RemoteStore received new credentials");const r=ed(n);n.v_.add(3),await Hh(n),r&&n.x_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.v_.delete(3),await Qh(n)}async function wd(t,e){const n=Xr(t);e?(n.v_.delete(2),await Qh(n)):e||(n.v_.add(2),await Hh(n),n.x_.set("Unknown"))}function vd(t){return t.N_||(t.N_=function(t,e,n){const r=Xr(t);return r.R_(),new zh(e,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(t.datastore,t.asyncQueue,{Po:rd.bind(null,t),To:sd.bind(null,t),u_:id.bind(null,t)}),t.F_.push((async e=>{e?(t.N_.Zo(),td(t)?Zh(t):t.x_.set("Unknown")):(await t.N_.stop(),nd(t))}))),t.N_}function bd(t){return t.B_||(t.B_=function(t,e,n){const r=Xr(t);return r.R_(),new Gh(e,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(t.datastore,t.asyncQueue,{Po:fd.bind(null,t),To:pd.bind(null,t),E_:gd.bind(null,t),T_:md.bind(null,t)}),t.F_.push((async e=>{e?(t.B_.Zo(),await ud(t)):(await t.B_.stop(),t.D_.length>0&&(jr("RemoteStore",`Stopping write stream with ${t.D_.length} pending writes`),t.D_=[]))}))),t.B_}class _d{constructor(t,e,n,r,s){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new ts,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(t,e,n,r,s){const i=Date.now()+n,o=new _d(t,e,i,r,s);return o.start(n),o}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Zr(Jr.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Id(t,e){if(Kr("AsyncQueue",`${e}: ${t}`),Us(t))return new Zr(Jr.UNAVAILABLE,`${e}: ${t}`);throw t}class Ed{constructor(t){this.comparator=t?(e,n)=>t(e,n)||_s.comparator(e.key,n.key):(t,e)=>_s.comparator(t.key,e.key),this.keyedMap=ba(),this.sortedSet=new Ni(this.comparator)}static emptySet(t){return new Ed(t.comparator)}has(t){return null!=this.keyedMap.get(t)}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof Ed))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(!t.isEqual(r))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){const n=new Ed;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}class Td{constructor(){this.L_=new Ni(_s.comparator)}track(t){const e=t.doc.key,n=this.L_.get(e);n?0!==t.type&&3===n.type?this.L_=this.L_.insert(e,t):3===t.type&&1!==n.type?this.L_=this.L_.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.L_=this.L_.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.L_=this.L_.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.L_=this.L_.remove(e):1===t.type&&2===n.type?this.L_=this.L_.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.L_=this.L_.insert(e,{type:2,doc:t.doc}):Hr():this.L_=this.L_.insert(e,t)}k_(){const t=[];return this.L_.inorderTraversal(((e,n)=>{t.push(n)})),t}}class Sd{constructor(t,e,n,r,s,i,o,a,u){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=s,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=u}static fromInitialDocuments(t,e,n,r,s){const i=[];return e.forEach((t=>{i.push({type:0,doc:t})})),new Sd(t,e,Ed.emptySet(e),i,n,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&ca(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let t=0;tla(t)),ca),this.onlineState="Unknown",this.K_=new Set}}async function Dd(t,e){const n=Xr(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new xd),s)try{i.q_=await n.onListen(r)}catch(t){const n=Id(t,`Initialization of query '${ha(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,i),i.Q_.push(e),e.U_(n.onlineState),i.q_&&e.W_(i.q_)&&Rd(n)}async function Ad(t,e){const n=Xr(t),r=e.query;let s=!1;const i=n.queries.get(r);if(i){const t=i.Q_.indexOf(e);t>=0&&(i.Q_.splice(t,1),s=0===i.Q_.length)}if(s)return n.queries.delete(r),n.onUnlisten(r)}function Nd(t,e){const n=Xr(t);let r=!1;for(const t of e){const e=t.query,s=n.queries.get(e);if(s){for(const e of s.Q_)e.W_(t)&&(r=!0);s.q_=t}}r&&Rd(n)}function kd(t,e,n){const r=Xr(t),s=r.queries.get(e);if(s)for(const t of s.Q_)t.onError(n);r.queries.delete(e)}function Rd(t){t.K_.forEach((t=>{t.next()}))}class Md{constructor(t,e,n){this.query=t,this.G_=e,this.z_=!1,this.j_=null,this.onlineState="Unknown",this.options=n||{}}W_(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new Sd(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.z_?this.H_(t)&&(this.G_.next(t),e=!0):this.J_(t,this.onlineState)&&(this.Y_(t),e=!0),this.j_=t,e}onError(t){this.G_.error(t)}U_(t){this.onlineState=t;let e=!1;return this.j_&&!this.z_&&this.J_(this.j_,t)&&(this.Y_(this.j_),e=!0),e}J_(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return(!this.options.Z_||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||"Offline"===e)}H_(t){if(t.docChanges.length>0)return!0;const e=this.j_&&this.j_.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}Y_(t){t=Sd.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.z_=!0,this.G_.next(t)}}class Ld{constructor(t,e){this.X_=t,this.byteLength=e}ea(){return"metadata"in this.X_}}class Od{constructor(t){this.serializer=t}Ps(t){return $u(this.serializer,t)}Is(t){return t.metadata.exists?Ju(this.serializer,t.document,!1):bo.newNoDocument(this.Ps(t.metadata.name),this.Ts(t.metadata.readTime))}Ts(t){return Uu(t)}}class Pd{constructor(t,e,n){this.ta=t,this.localStore=e,this.serializer=n,this.queries=[],this.documents=[],this.collectionGroups=new Set,this.progress=Fd(t)}na(t){this.progress.bytesLoaded+=t.byteLength;let e=this.progress.documentsLoaded;if(t.X_.namedQuery)this.queries.push(t.X_.namedQuery);else if(t.X_.documentMetadata){this.documents.push({metadata:t.X_.documentMetadata}),t.X_.documentMetadata.exists||++e;const n=ws.fromString(t.X_.documentMetadata.name);this.collectionGroups.add(n.get(n.length-2))}else t.X_.document&&(this.documents[this.documents.length-1].document=t.X_.document,++e);return e!==this.progress.documentsLoaded?(this.progress.documentsLoaded=e,Object.assign({},this.progress)):null}ra(t){const e=new Map,n=new Od(this.serializer);for(const r of t)if(r.metadata.queries){const t=n.Ps(r.metadata.name);for(const n of r.metadata.queries){const r=(e.get(n)||Ca()).add(t);e.set(n,r)}}return e}async complete(){const t=await async function(t,e,n,r){const s=Xr(t);let i=Ca(),o=wa();for(const t of n){const n=e.Ps(t.metadata.name);t.document&&(i=i.add(n));const r=e.Is(t);r.setReadTime(e.Ts(t.metadata.readTime)),o=o.insert(n,r)}const a=s.os.newChangeBuffer({trackRemovals:!0}),u=await dh(s,function(t){return ia(ea(ws.fromString(`__bundle__/docs/${t}`)))}(r));return s.persistence.runTransaction("Apply bundle documents","readwrite",(t=>lh(t,a,o).next((e=>(a.apply(t),e))).next((e=>s.Qr.removeMatchingKeysForTargetId(t,u.targetId).next((()=>s.Qr.addMatchingKeys(t,i,u.targetId))).next((()=>s.localDocuments.getLocalViewOfDocuments(t,e.cs,e.ls))).next((()=>e.cs))))))}(this.localStore,new Od(this.serializer),this.documents,this.ta.id),e=this.ra(this.documents);for(const t of this.queries)await wh(this.localStore,t,e.get(t.name));return this.progress.taskState="Success",{progress:this.progress,ia:this.collectionGroups,sa:t}}}function Fd(t){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:t.totalDocuments,totalBytes:t.totalBytes}}class Vd{constructor(t){this.key=t}}class qd{constructor(t){this.key=t}}class Bd{constructor(t,e){this.query=t,this.oa=e,this._a=null,this.hasCachedResults=!1,this.current=!1,this.aa=Ca(),this.mutatedKeys=Ca(),this.ua=ga(t),this.ca=new Ed(this.ua)}get la(){return this.oa}ha(t,e){const n=e?e.Pa:new Td,r=e?e.ca:this.ca;let s=e?e.mutatedKeys:this.mutatedKeys,i=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,u="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal(((t,e)=>{const c=r.get(t),l=da(this.query,e)?e:null,h=!!c&&this.mutatedKeys.has(c.key),d=!!l&&(l.hasLocalMutations||this.mutatedKeys.has(l.key)&&l.hasCommittedMutations);let f=!1;c&&l?c.data.isEqual(l.data)?h!==d&&(n.track({type:3,doc:l}),f=!0):this.Ia(c,l)||(n.track({type:2,doc:l}),f=!0,(a&&this.ua(l,a)>0||u&&this.ua(l,u)<0)&&(o=!0)):!c&&l?(n.track({type:0,doc:l}),f=!0):c&&!l&&(n.track({type:1,doc:c}),f=!0,(a||u)&&(o=!0)),f&&(l?(i=i.add(l),s=d?s.add(t):s.delete(t)):(i=i.delete(t),s=s.delete(t)))})),null!==this.query.limit)for(;i.size>this.query.limit;){const t="F"===this.query.limitType?i.last():i.first();i=i.delete(t.key),s=s.delete(t.key),n.track({type:1,doc:t})}return{ca:i,Pa:n,Xi:o,mutatedKeys:s}}Ia(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n,r){const s=this.ca;this.ca=t.ca,this.mutatedKeys=t.mutatedKeys;const i=t.Pa.k_();i.sort(((t,e)=>function(t,e){const n=t=>{switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Hr()}};return n(t)-n(e)}(t.type,e.type)||this.ua(t.doc,e.doc))),this.Ta(n),r=null!=r&&r;const o=e&&!r?this.Ea():[],a=0===this.aa.size&&this.current&&!r?1:0,u=a!==this._a;return this._a=a,0!==i.length||u?{snapshot:new Sd(this.query,t.ca,s,i,t.mutatedKeys,0===a,u,!1,!!n&&n.resumeToken.approximateByteSize()>0),da:o}:{da:o}}U_(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({ca:this.ca,Pa:new Td,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{da:[]}}Aa(t){return!this.oa.has(t)&&!!this.ca.has(t)&&!this.ca.get(t).hasLocalMutations}Ta(t){t&&(t.addedDocuments.forEach((t=>this.oa=this.oa.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.oa=this.oa.delete(t))),this.current=t.current)}Ea(){if(!this.current)return[];const t=this.aa;this.aa=Ca(),this.ca.forEach((t=>{this.Aa(t.key)&&(this.aa=this.aa.add(t.key))}));const e=[];return t.forEach((t=>{this.aa.has(t)||e.push(new qd(t))})),this.aa.forEach((n=>{t.has(n)||e.push(new Vd(n))})),e}Ra(t){this.oa=t.hs,this.aa=Ca();const e=this.ha(t.documents);return this.applyChanges(e,!0)}Va(){return Sd.fromInitialDocuments(this.query,this.ca,this.mutatedKeys,0===this._a,this.hasCachedResults)}}class Ud{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class zd{constructor(t){this.key=t,this.ma=!1}}class Gd{constructor(t,e,n,r,s,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.fa={},this.ga=new pa((t=>la(t)),ca),this.pa=new Map,this.ya=new Set,this.wa=new Ni(_s.comparator),this.Sa=new Map,this.ba=new Bl,this.Da={},this.Ca=new Map,this.va=ml.Bn(),this.onlineState="Unknown",this.Fa=void 0}get isPrimaryClient(){return!0===this.Fa}}async function jd(t,e){const n=yf(t);let r,s;const i=n.ga.get(e);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.Va();else{const t=await dh(n.localStore,ia(e)),i=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,s=await Kd(n,e,r,"current"===i,t.resumeToken),n.isPrimaryClient&&Wh(n.remoteStore,t)}return s}async function Kd(t,e,n,r,s){t.Ma=(e,n,r)=>async function(t,e,n,r){let s=e.view.ha(n);s.Xi&&(s=await gh(t.localStore,e.query,!1).then((({documents:t})=>e.view.ha(t,s))));const i=r&&r.targetChanges.get(e.targetId),o=r&&null!=r.targetMismatches.get(e.targetId),a=e.view.applyChanges(s,t.isPrimaryClient,i,o);return nf(t,e.targetId,a.da),a.snapshot}(t,e,n,r);const i=await gh(t.localStore,e,!0),o=new Bd(e,i.hs),a=o.ha(i.documents),u=Su.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,s),c=o.applyChanges(a,t.isPrimaryClient,u);nf(t,n,c.da);const l=new Ud(e,n,o);return t.ga.set(e,l),t.pa.has(n)?t.pa.get(n).push(e):t.pa.set(n,[e]),c.snapshot}async function $d(t,e){const n=Xr(t),r=n.ga.get(e),s=n.pa.get(r.targetId);if(s.length>1)return n.pa.set(r.targetId,s.filter((t=>!ca(t,e)))),void n.ga.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await fh(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),Yh(n.remoteStore,r.targetId),tf(n,r.targetId)})).catch(Os)):(tf(n,r.targetId),await fh(n.localStore,r.targetId,!0))}async function Qd(t,e){const n=Xr(t);try{const t=await function(t,e){const n=Xr(t),r=e.snapshotVersion;let s=n.ns;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.os.newChangeBuffer({trackRemovals:!0});s=n.ns;const o=[];e.targetChanges.forEach(((i,a)=>{const u=s.get(a);if(!u)return;o.push(n.Qr.removeMatchingKeys(t,i.removedDocuments,a).next((()=>n.Qr.addMatchingKeys(t,i.addedDocuments,a))));let c=u.withSequenceNumber(t.currentSequenceNumber);null!==e.targetMismatches.get(a)?c=c.withResumeToken(qi.EMPTY_BYTE_STRING,ps.min()).withLastLimboFreeSnapshotVersion(ps.min()):i.resumeToken.approximateByteSize()>0&&(c=c.withResumeToken(i.resumeToken,r)),s=s.insert(a,c),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(u,c,i)&&o.push(n.Qr.updateTargetData(t,c))}));let a=wa(),u=Ca();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(lh(t,i,e.documentUpdates).next((t=>{a=t.cs,u=t.ls}))),!r.isEqual(ps.min())){const e=n.Qr.getLastRemoteSnapshotVersion(t).next((e=>n.Qr.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return Ps.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,u))).next((()=>a))})).then((t=>(n.ns=s,t)))}(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.Sa.get(e);r&&(Wr(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.ma=!0:t.modifiedDocuments.size>0?Wr(r.ma):t.removedDocuments.size>0&&(Wr(r.ma),r.ma=!1))})),await of(n,t,e)}catch(t){await Os(t)}}function Hd(t,e,n){const r=Xr(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ga.forEach(((n,r)=>{const s=r.view.U_(e);s.snapshot&&t.push(s.snapshot)})),function(t,e){const n=Xr(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.Q_)t.U_(e)&&(r=!0)})),r&&Rd(n)}(r.eventManager,e),t.length&&r.fa.u_(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function Wd(t,e,n){const r=Xr(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.Sa.get(e),i=s&&s.key;if(i){let t=new Ni(_s.comparator);t=t.insert(i,bo.newNoDocument(i,ps.min()));const n=Ca().add(i),s=new Tu(ps.min(),new Map,new Ni(ds),t,n);await Qd(r,s),r.wa=r.wa.remove(i),r.Sa.delete(e),sf(r)}else await fh(r.localStore,e,!1).then((()=>tf(r,e,n))).catch(Os)}async function Yd(t,e){const n=Xr(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Xr(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),s=n.os.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const s=n.batch,i=s.keys();let o=Ps.resolve();return i.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const i=n.docVersions.get(t);Wr(null!==i),e.version.compareTo(i)<0&&(s.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,s)))}(n,t,e,s).next((()=>s.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Ca();for(let n=0;n0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);Zd(n,r,null),Jd(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await of(n,t)}catch(t){await Os(t)}}async function Xd(t,e,n){const r=Xr(t);try{const t=await function(t,e){const n=Xr(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Wr(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);Zd(r,e,n),Jd(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await of(r,t)}catch(t){await Os(t)}}function Jd(t,e){(t.Ca.get(e)||[]).forEach((t=>{t.resolve()})),t.Ca.delete(e)}function Zd(t,e,n){const r=Xr(t);let s=r.Da[r.currentUser.toKey()];if(s){const t=s.get(e);t&&(n?t.reject(n):t.resolve(),s=s.remove(e)),r.Da[r.currentUser.toKey()]=s}}function tf(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.pa.get(e))t.ga.delete(r),n&&t.fa.xa(r,n);t.pa.delete(e),t.isPrimaryClient&&t.ba.Vr(e).forEach((e=>{t.ba.containsKey(e)||ef(t,e)}))}function ef(t,e){t.ya.delete(e.path.canonicalString());const n=t.wa.get(e);null!==n&&(Yh(t.remoteStore,n),t.wa=t.wa.remove(e),t.Sa.delete(n),sf(t))}function nf(t,e,n){for(const r of n)r instanceof Vd?(t.ba.addReference(r.key,e),rf(t,r)):r instanceof qd?(jr("SyncEngine","Document no longer in limbo: "+r.key),t.ba.removeReference(r.key,e),t.ba.containsKey(r.key)||ef(t,r.key)):Hr()}function rf(t,e){const n=e.key,r=n.path.canonicalString();t.wa.get(n)||t.ya.has(r)||(jr("SyncEngine","New document in limbo: "+n),t.ya.add(r),sf(t))}function sf(t){for(;t.ya.size>0&&t.wa.size{o.push(r.Ma(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){s.push(t);const e=rh.Ki(a.targetId,t);i.push(e)}})))})),await Promise.all(o),r.fa.u_(s),await async function(t,e){const n=Xr(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>Ps.forEach(e,(e=>Ps.forEach(e.qi,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>Ps.forEach(e.Qi,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!Us(t))throw t;jr("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.ns.get(e),r=t.snapshotVersion,s=t.withLastLimboFreeSnapshotVersion(r);n.ns=n.ns.insert(e,s)}}}(r.localStore,i))}async function af(t,e){const n=Xr(t);if(!n.currentUser.isEqual(e)){jr("SyncEngine","User change. New user:",e.toKey());const t=await uh(n.localStore,e);n.currentUser=e,function(t,e){t.Ca.forEach((t=>{t.forEach((t=>{t.reject(new Zr(Jr.CANCELLED,e))}))})),t.Ca.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await of(n,t.us)}}function uf(t,e){const n=Xr(t),r=n.Sa.get(e);if(r&&r.ma)return Ca().add(r.key);{let t=Ca();const r=n.pa.get(e);if(!r)return t;for(const e of r){const r=n.ga.get(e);t=t.unionWith(r.view.la)}return t}}async function cf(t,e){const n=Xr(t),r=await gh(n.localStore,e.query,!0),s=e.view.Ra(r);return n.isPrimaryClient&&nf(n,e.targetId,s.da),s}async function lf(t,e){const n=Xr(t);return ph(n.localStore,e).then((t=>of(n,t)))}async function hf(t,e,n,r){const s=Xr(t),i=await function(t,e){const n=Xr(t),r=Xr(n.mutationQueue);return n.persistence.runTransaction("Lookup mutation documents","readonly",(t=>r.vn(t,e).next((e=>e?n.localDocuments.getDocuments(t,e):Ps.resolve(null)))))}(s.localStore,e);null!==i?("pending"===n?await ud(s.remoteStore):"acknowledged"===n||"rejected"===n?(Zd(s,e,r||null),Jd(s,e),function(t,e){Xr(Xr(t).mutationQueue).Mn(e)}(s.localStore,e)):Hr(),await of(s,i)):jr("SyncEngine","Cannot apply mutation batch with id: "+e)}async function df(t,e,n){const r=Xr(t),s=[],i=[];for(const t of e){let e;const n=r.pa.get(t);if(n&&0!==n.length){e=await dh(r.localStore,ia(n[0]));for(const t of n){const e=r.ga.get(t),n=await cf(r,e);n.snapshot&&i.push(n.snapshot)}}else{const n=await mh(r.localStore,t);e=await dh(r.localStore,n),await Kd(r,ff(n),t,!1,e.resumeToken)}s.push(e)}return r.fa.u_(i),s}function ff(t){return ta(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)}function gf(t){return function(t){return Xr(Xr(t).persistence).Li()}(Xr(t).localStore)}async function mf(t,e,n,r){const s=Xr(t);if(s.Fa)return void jr("SyncEngine","Ignoring unexpected query state notification.");const i=s.pa.get(e);if(i&&i.length>0)switch(n){case"current":case"not-current":{const t=await ph(s.localStore,fa(i[0])),r=Tu.createSynthesizedRemoteEventForCurrentChange(e,"current"===n,qi.EMPTY_BYTE_STRING);await of(s,t,r);break}case"rejected":await fh(s.localStore,e,!0),tf(s,e,r);break;default:Hr()}}async function pf(t,e,n){const r=yf(t);if(r.Fa){for(const t of e){if(r.pa.has(t)){jr("SyncEngine","Adding an already active target "+t);continue}const e=await mh(r.localStore,t),n=await dh(r.localStore,e);await Kd(r,ff(e),n.targetId,!1,n.resumeToken),Wh(r.remoteStore,n)}for(const t of n)r.pa.has(t)&&await fh(r.localStore,t,!1).then((()=>{Yh(r.remoteStore,t),tf(r,t)})).catch(Os)}}function yf(t){const e=Xr(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=Qd.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=uf.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Wd.bind(null,e),e.fa.u_=Nd.bind(null,e.eventManager),e.fa.xa=kd.bind(null,e.eventManager),e}function wf(t){const e=Xr(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Yd.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=Xd.bind(null,e),e}class vf{constructor(){this.synchronizeTabs=!1}async initialize(t){this.serializer=qh(t.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(t),this.persistence=this.createPersistence(t),await this.persistence.start(),this.localStore=this.createLocalStore(t),this.gcScheduler=this.createGarbageCollectionScheduler(t,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(t,this.localStore)}createGarbageCollectionScheduler(t,e){return null}createIndexBackfillerScheduler(t,e){return null}createLocalStore(t){return ah(this.persistence,new ih,t.initialUser,this.serializer)}createPersistence(t){return new $l(Hl.Hr,this.serializer)}createSharedClientState(t){return new Dh}async terminate(){var t,e;null===(t=this.gcScheduler)||void 0===t||t.stop(),null===(e=this.indexBackfillerScheduler)||void 0===e||e.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class bf extends vf{constructor(t){super(),this.cacheSizeBytes=t}createGarbageCollectionScheduler(t,e){Wr(this.persistence.referenceDelegate instanceof Wl);const n=this.persistence.referenceDelegate.garbageCollector;return new Il(n,t.asyncQueue,e)}createPersistence(t){const e=void 0!==this.cacheSizeBytes?al.withCacheSize(this.cacheSizeBytes):al.DEFAULT;return new $l((t=>Wl.Hr(t,e)),this.serializer)}}class _f extends vf{constructor(t,e,n){super(),this.Na=t,this.cacheSizeBytes=e,this.forceOwnership=n,this.synchronizeTabs=!1}async initialize(t){await super.initialize(t),await this.Na.initialize(this,t),await wf(this.Na.syncEngine),await ud(this.Na.remoteStore),await this.persistence.fi((()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve())))}createLocalStore(t){return ah(this.persistence,new ih,t.initialUser,this.serializer)}createGarbageCollectionScheduler(t,e){const n=this.persistence.referenceDelegate.garbageCollector;return new Il(n,t.asyncQueue,e)}createIndexBackfillerScheduler(t,e){const n=new Qs(e,this.persistence);return new $s(t.asyncQueue,n)}createPersistence(t){const e=nh(t.databaseInfo.databaseId,t.databaseInfo.persistenceKey),n=void 0!==this.cacheSizeBytes?al.withCacheSize(this.cacheSizeBytes):al.DEFAULT;return new Zl(this.synchronizeTabs,e,t.clientId,n,t.asyncQueue,Fh(),Vh(),this.serializer,this.sharedClientState,!!this.forceOwnership)}createSharedClientState(t){return new Dh}}class If extends _f{constructor(t,e){super(t,e,!1),this.Na=t,this.cacheSizeBytes=e,this.synchronizeTabs=!0}async initialize(t){await super.initialize(t);const e=this.Na.syncEngine;this.sharedClientState instanceof Ch&&(this.sharedClientState.syncEngine={Zs:hf.bind(null,e),Xs:mf.bind(null,e),eo:pf.bind(null,e),Li:gf.bind(null,e),Ys:lf.bind(null,e)},await this.sharedClientState.start()),await this.persistence.fi((async t=>{await async function(t,e){const n=Xr(t);if(yf(n),wf(n),!0===e&&!0!==n.Fa){const t=n.sharedClientState.getAllActiveQueryTargets(),e=await df(n,t.toArray());n.Fa=!0,await wd(n.remoteStore,!0);for(const t of e)Wh(n.remoteStore,t)}else if(!1===e&&!1!==n.Fa){const t=[];let e=Promise.resolve();n.pa.forEach(((r,s)=>{n.sharedClientState.isLocalQueryTarget(s)?t.push(s):e=e.then((()=>(tf(n,s),fh(n.localStore,s,!0)))),Yh(n.remoteStore,s)})),await e,await df(n,t),function(t){const e=Xr(t);e.Sa.forEach(((t,n)=>{Yh(e.remoteStore,n)})),e.ba.mr(),e.Sa=new Map,e.wa=new Ni(_s.comparator)}(n),n.Fa=!1,await wd(n.remoteStore,!1)}}(this.Na.syncEngine,t),this.gcScheduler&&(t&&!this.gcScheduler.started?this.gcScheduler.start():t||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(t&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():t||this.indexBackfillerScheduler.stop())}))}createSharedClientState(t){const e=Fh();if(!Ch.D(e))throw new Zr(Jr.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");const n=nh(t.databaseInfo.databaseId,t.databaseInfo.persistenceKey);return new Ch(e,t.asyncQueue,n,t.clientId,t.initialUser)}}class Ef{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>Hd(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=af.bind(null,this.syncEngine),await wd(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Cd}createDatastore(t){const e=qh(t.databaseInfo.databaseId),n=function(t){return new Ph(t)}(t.databaseInfo);return function(t,e,n,r){return new jh(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return function(t,e,n,r,s){return new $h(t,e,n,r,s)}(this.localStore,this.datastore,t.asyncQueue,(t=>Hd(this.syncEngine,t,0)),Nh.D()?new Nh:new Ah)}createSyncEngine(t,e){return function(t,e,n,r,s,i,o){const a=new Gd(t,e,n,r,s,i);return o&&(a.Fa=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}async terminate(){var t;await async function(t){const e=Xr(t);jr("RemoteStore","RemoteStore shutting down."),e.v_.add(5),await Hh(e),e.M_.shutdown(),e.x_.set("Unknown")}(this.remoteStore),null===(t=this.datastore)||void 0===t||t.terminate()}}function Tf(t,e=10240){let n=0;return{async read(){if(n{this.muted||t(e)}),0)}}class xf{constructor(t,e){this.ka=t,this.serializer=e,this.metadata=new ts,this.buffer=new Uint8Array,this.qa=new TextDecoder("utf-8"),this.Qa().then((t=>{t&&t.ea()?this.metadata.resolve(t.X_.metadata):this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is\n ${JSON.stringify(null==t?void 0:t.X_)}`))}),(t=>this.metadata.reject(t)))}close(){return this.ka.cancel()}async getMetadata(){return this.metadata.promise}async Oa(){return await this.getMetadata(),this.Qa()}async Qa(){const t=await this.Ka();if(null===t)return null;const e=this.qa.decode(t),n=Number(e);isNaN(n)&&this.$a(`length string (${e}) is not valid number`);const r=await this.Ua(n);return new Ld(JSON.parse(r),t.length+n)}Wa(){return this.buffer.findIndex((t=>t==="{".charCodeAt(0)))}async Ka(){for(;this.Wa()<0&&!await this.Ga(););if(0===this.buffer.length)return null;const t=this.Wa();t<0&&this.$a("Reached the end of bundle when a length string is expected.");const e=this.buffer.slice(0,t);return this.buffer=this.buffer.slice(t),e}async Ua(t){for(;this.buffer.length0)throw this.lastTransactionError=new Zr(Jr.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;const e=await async function(t,e){const n=Xr(t),r={documents:e.map((t=>Ku(n.serializer,t)))},s=await n.vo("BatchGetDocuments",n.serializer.databaseId,ws.emptyPath(),r,e.length),i=new Map;s.forEach((t=>{const e=function(t,e){return"found"in e?function(t,e){Wr(!!e.found),e.found.name,e.found.updateTime;const n=$u(t,e.found.name),r=Uu(e.found.updateTime),s=e.found.createTime?Uu(e.found.createTime):ps.min(),i=new wo({mapValue:{fields:e.found.fields}});return bo.newFoundDocument(n,r,s,i)}(t,e):"missing"in e?function(t,e){Wr(!!e.missing),Wr(!!e.readTime);const n=$u(t,e.missing),r=Uu(e.readTime);return bo.newNoDocument(n,r)}(t,e):Hr()}(n.serializer,t);i.set(e.key.toString(),e)}));const o=[];return e.forEach((t=>{const e=i.get(t.toString());Wr(!!e),o.push(e)})),o}(this.datastore,t);return e.forEach((t=>this.recordVersion(t))),e}set(t,e){this.write(e.toMutation(t,this.precondition(t))),this.writtenDocs.add(t.toString())}update(t,e){try{this.write(e.toMutation(t,this.preconditionForUpdate(t)))}catch(t){this.lastTransactionError=t}this.writtenDocs.add(t.toString())}delete(t){this.write(new ou(t,this.precondition(t))),this.writtenDocs.add(t.toString())}async commit(){if(this.ensureCommitNotCalled(),this.lastTransactionError)throw this.lastTransactionError;const t=this.readVersions;this.mutations.forEach((e=>{t.delete(e.key.toString())})),t.forEach(((t,e)=>{const n=_s.fromPath(e);this.mutations.push(new au(n,this.precondition(n)))})),await async function(t,e){const n=Xr(t),r={writes:e.map((t=>Zu(n.serializer,t)))};await n.So("Commit",n.serializer.databaseId,ws.emptyPath(),r)}(this.datastore,this.mutations),this.committed=!0}recordVersion(t){let e;if(t.isFoundDocument())e=t.version;else{if(!t.isNoDocument())throw Hr();e=ps.min()}const n=this.readVersions.get(t.key.toString());if(n){if(!e.isEqual(n))throw new Zr(Jr.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(t.key.toString(),e)}precondition(t){const e=this.readVersions.get(t.toString());return!this.writtenDocs.has(t.toString())&&e?e.isEqual(ps.min())?Qa.exists(!1):Qa.updateTime(e):Qa.none()}preconditionForUpdate(t){const e=this.readVersions.get(t.toString());if(!this.writtenDocs.has(t.toString())&&e){if(e.isEqual(ps.min()))throw new Zr(Jr.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Qa.updateTime(e)}return Qa.exists(!0)}write(t){this.ensureCommitNotCalled(),this.mutations.push(t)}ensureCommitNotCalled(){}}class Df{constructor(t,e,n,r,s){this.asyncQueue=t,this.datastore=e,this.options=n,this.updateFunction=r,this.deferred=s,this.za=n.maxAttempts,this.jo=new Bh(this.asyncQueue,"transaction_retry")}ja(){this.za-=1,this.Ha()}Ha(){this.jo.qo((async()=>{const t=new Cf(this.datastore),e=this.Ja(t);e&&e.then((e=>{this.asyncQueue.enqueueAndForget((()=>t.commit().then((()=>{this.deferred.resolve(e)})).catch((t=>{this.Ya(t)}))))})).catch((t=>{this.Ya(t)}))}))}Ja(t){try{const e=this.updateFunction(t);return!Ws(e)&&e.catch&&e.then?e:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.deferred.reject(t),null}}Ya(t){this.za>0&&this.Za(t)?(this.za-=1,this.asyncQueue.enqueueAndForget((()=>(this.Ha(),Promise.resolve())))):this.deferred.reject(t)}Za(t){if("FirebaseError"===t.name){const e=t.code;return"aborted"===e||"failed-precondition"===e||"already-exists"===e||!mu(e)}return!1}}class Af{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=qr.UNAUTHENTICATED,this.clientId=hs.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{jr("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(jr("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Zr(Jr.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new ts;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=Id(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function Nf(t,e){t.asyncQueue.verifyOperationInProgress(),jr("FirestoreClient","Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await uh(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t._offlineComponents=e}async function kf(t,e){t.asyncQueue.verifyOperationInProgress();const n=await Mf(t);jr("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener((t=>yd(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>yd(e.remoteStore,n))),t._onlineComponents=e}function Rf(t){return"FirebaseError"===t.name?t.code===Jr.FAILED_PRECONDITION||t.code===Jr.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code}async function Mf(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){jr("FirestoreClient","Using user provided OfflineComponentProvider");try{await Nf(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!Rf(n))throw n;$r("Error using user provided cache. Falling back to memory cache: "+n),await Nf(t,new vf)}}else jr("FirestoreClient","Using default OfflineComponentProvider"),await Nf(t,new vf);return t._offlineComponents}async function Lf(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(jr("FirestoreClient","Using user provided OnlineComponentProvider"),await kf(t,t._uninitializedComponentsProvider._online)):(jr("FirestoreClient","Using default OnlineComponentProvider"),await kf(t,new Ef))),t._onlineComponents}function Of(t){return Mf(t).then((t=>t.persistence))}function Pf(t){return Mf(t).then((t=>t.localStore))}function Ff(t){return Lf(t).then((t=>t.remoteStore))}function Vf(t){return Lf(t).then((t=>t.syncEngine))}function qf(t){return Lf(t).then((t=>t.datastore))}async function Bf(t){const e=await Lf(t),n=e.eventManager;return n.onListen=jd.bind(null,e.syncEngine),n.onUnlisten=$d.bind(null,e.syncEngine),n}function Uf(t,e,n={}){const r=new ts;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Sf({next:i=>{e.enqueueAndForget((()=>Ad(t,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new Zr(Jr.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new Zr(Jr.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(i)},error:t=>s.reject(t)}),o=new Md(ea(n.path),i,{includeMetadataChanges:!0,Z_:!0});return Dd(t,o)}(await Bf(t),t.asyncQueue,e,n,r))),r.promise}function zf(t,e,n={}){const r=new ts;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Sf({next:n=>{e.enqueueAndForget((()=>Ad(t,o))),n.fromCache&&"server"===r.source?s.reject(new Zr(Jr.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):s.resolve(n)},error:t=>s.reject(t)}),o=new Md(n,i,{includeMetadataChanges:!0,Z_:!0});return Dd(t,o)}(await Bf(t),t.asyncQueue,e,n,r))),r.promise}function Gf(t){const e={};return void 0!==t.timeoutSeconds&&(e.timeoutSeconds=t.timeoutSeconds),e}const jf=new Map;function Kf(t,e,n){if(!n)throw new Zr(Jr.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function $f(t,e,n,r){if(!0===e&&!0===r)throw new Zr(Jr.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function Qf(t){if(!_s.isDocumentKey(t))throw new Zr(Jr.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function Hf(t){if(_s.isDocumentKey(t))throw new Zr(Jr.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Wf(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Hr()}function Yf(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Zr(Jr.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Wf(t);throw new Zr(Jr.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}function Xf(t,e){if(e<=0)throw new Zr(Jr.INVALID_ARGUMENT,`Function ${t}() requires a positive number, but it was: ${e}.`)}class Jf{constructor(t){var e,n;if(void 0===t.host){if(void 0!==t.ssl)throw new Zr(Jr.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Zr(Jr.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}$f("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===t.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Gf(null!==(n=t.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(t){if(void 0!==t.timeoutSeconds){if(isNaN(t.timeoutSeconds))throw new Zr(Jr.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (must not be NaN)`);if(t.timeoutSeconds<5)throw new Zr(Jr.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (minimum allowed value is 5)`);if(t.timeoutSeconds>30)throw new Zr(Jr.INVALID_ARGUMENT,`invalid long polling timeout: ${t.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&function(t,e){return t.timeoutSeconds===e.timeoutSeconds}(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}class Zf{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Jf({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Zr(Jr.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Zr(Jr.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Jf(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new ns;switch(t.type){case"firstParty":return new os(t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Zr(Jr.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=jf.get(t);e&&(jr("ComponentProvider","Removing Datastore"),jf.delete(t),e.terminate())}(this),Promise.resolve()}}function tg(t,e,n,r={}){var s;const i=(t=Yf(t,Zf))._getSettings(),o=`${e}:${n}`;if("firestore.googleapis.com"!==i.host&&i.host!==o&&$r("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),t._setSettings(Object.assign(Object.assign({},i),{host:o,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=qr.MOCK_USER;else{e=function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",r=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},t);return[l(JSON.stringify({alg:"none",type:"JWT"})),l(JSON.stringify(i)),""].join(".")}(r.mockUserToken,null===(s=t._app)||void 0===s?void 0:s.options.projectId);const i=r.mockUserToken.sub||r.mockUserToken.user_id;if(!i)throw new Zr(Jr.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new qr(i)}t._authCredentials=new rs(new es(e,n))}}class eg{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new eg(this.firestore,t,this._query)}}class ng{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new rg(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new ng(this.firestore,t,this._key)}}class rg extends eg{constructor(t,e,n){super(t,e,ea(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new ng(this.firestore,null,new _s(t))}withConverter(t){return new rg(this.firestore,t,this._path)}}function sg(t,e,...n){if(t=v(t),Kf("collection","path",e),t instanceof Zf){const r=ws.fromString(e,...n);return Hf(r),new rg(t,null,r)}{if(!(t instanceof ng||t instanceof rg))throw new Zr(Jr.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(ws.fromString(e,...n));return Hf(r),new rg(t.firestore,null,r)}}function ig(t,e){if(t=Yf(t,Zf),Kf("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new Zr(Jr.INVALID_ARGUMENT,`Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new eg(t,null,function(t){return new Zo(ws.emptyPath(),t)}(e))}function og(t,e,...n){if(t=v(t),1===arguments.length&&(e=hs.newId()),Kf("doc","path",e),t instanceof Zf){const r=ws.fromString(e,...n);return Qf(r),new ng(t,null,new _s(r))}{if(!(t instanceof ng||t instanceof rg))throw new Zr(Jr.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(ws.fromString(e,...n));return Qf(r),new ng(t.firestore,t instanceof rg?t.converter:null,new _s(r))}}function ag(t,e){return t=v(t),e=v(e),(t instanceof ng||t instanceof rg)&&(e instanceof ng||e instanceof rg)&&t.firestore===e.firestore&&t.path===e.path&&t.converter===e.converter}function ug(t,e){return t=v(t),e=v(e),t instanceof eg&&e instanceof eg&&t.firestore===e.firestore&&ca(t._query,e._query)&&t.converter===e.converter}class cg{constructor(){this.Xa=Promise.resolve(),this.eu=[],this.tu=!1,this.nu=[],this.ru=null,this.iu=!1,this.su=!1,this.ou=[],this.jo=new Bh(this,"async_queue_retry"),this._u=()=>{const t=Vh();t&&jr("AsyncQueue","Visibility state changed to "+t.visibilityState),this.jo.Ko()};const t=Vh();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this._u)}get isShuttingDown(){return this.tu}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.au(),this.uu(t)}enterRestrictedMode(t){if(!this.tu){this.tu=!0,this.su=t||!1;const e=Vh();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this._u)}}enqueue(t){if(this.au(),this.tu)return new Promise((()=>{}));const e=new ts;return this.uu((()=>this.tu&&this.su?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.eu.push(t),this.cu())))}async cu(){if(0!==this.eu.length){try{await this.eu[0](),this.eu.shift(),this.jo.reset()}catch(t){if(!Us(t))throw t;jr("AsyncQueue","Operation failed with retryable error: "+t)}this.eu.length>0&&this.jo.qo((()=>this.cu()))}}uu(t){const e=this.Xa.then((()=>(this.iu=!0,t().catch((t=>{this.ru=t,this.iu=!1;const e=function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}(t);throw Kr("INTERNAL UNHANDLED ERROR: ",e),t})).then((t=>(this.iu=!1,t))))));return this.Xa=e,e}enqueueAfterDelay(t,e,n){this.au(),this.ou.indexOf(t)>-1&&(e=0);const r=_d.createAndSchedule(this,t,e,n,(t=>this.lu(t)));return this.nu.push(r),r}au(){this.ru&&Hr()}verifyOperationInProgress(){}async hu(){let t;do{t=this.Xa,await t}while(t!==this.Xa)}Pu(t){for(const e of this.nu)if(e.timerId===t)return!0;return!1}Iu(t){return this.hu().then((()=>{this.nu.sort(((t,e)=>t.targetTimeMs-e.targetTimeMs));for(const e of this.nu)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.hu()}))}Tu(t){this.ou.push(t)}lu(t){const e=this.nu.indexOf(t);this.nu.splice(e,1)}}function lg(t){return function(t,e){if("object"!=typeof t||null===t)return!1;const n=t;for(const t of e)if(t in n&&"function"==typeof n[t])return!0;return!1}(t,["next","error","complete"])}class hg{constructor(){this._progressObserver={},this._taskCompletionResolver=new ts,this._lastProgress={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}onProgress(t,e,n){this._progressObserver={next:t,error:e,complete:n}}catch(t){return this._taskCompletionResolver.promise.catch(t)}then(t,e){return this._taskCompletionResolver.promise.then(t,e)}_completeWith(t){this._updateProgress(t),this._progressObserver.complete&&this._progressObserver.complete(),this._taskCompletionResolver.resolve(t)}_failWith(t){this._lastProgress.taskState="Error",this._progressObserver.next&&this._progressObserver.next(this._lastProgress),this._progressObserver.error&&this._progressObserver.error(t),this._taskCompletionResolver.reject(t)}_updateProgress(t){this._lastProgress=t,this._progressObserver.next&&this._progressObserver.next(t)}}const dg=-1;class fg extends Zf{constructor(t,e,n,r){super(t,e,n,r),this.type="firestore",this._queue=new cg,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||yg(this),this._firestoreClient.terminate()}}function gg(t,e,n){n||(n="(default)");const r=i._getProvider(t,"firestore");if(r.isInitialized(n)){const t=r.getImmediate({identifier:n});if(y(r.getOptions(n),e))return t;throw new Zr(Jr.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(void 0!==e.cacheSizeBytes&&void 0!==e.localCache)throw new Zr(Jr.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(void 0!==e.cacheSizeBytes&&-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new Zr(Jr.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return r.initialize({options:e,instanceIdentifier:n})}function mg(t,e){const n="object"==typeof t?t:i.getApp(),r="string"==typeof t?t:e||"(default)",s=i._getProvider(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const t=(t=>{const e=(t=>{var e,n;return null===(n=null===(e=h())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),r]:[e.substring(0,n),r]})("firestore");t&&tg(s,...t)}return s}function pg(t){return t._firestoreClient||yg(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function yg(t){var e,n,r;const s=t._freezeSettings(),i=function(t,e,n,r){return new Qi(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,Gf(r.experimentalLongPollingOptions),r.useFetchStreams)}(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,s);t._firestoreClient=new Af(t._authCredentials,t._appCheckCredentials,t._queue,i),(null===(n=s.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(r=s.localCache)||void 0===r?void 0:r._onlineComponentProvider)&&(t._firestoreClient._uninitializedComponentsProvider={_offlineKind:s.localCache.kind,_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider})}function wg(t,e){Dg(t=Yf(t,fg));const n=pg(t);if(n._uninitializedComponentsProvider)throw new Zr(Jr.FAILED_PRECONDITION,"SDK cache is already specified.");$r("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");const r=t._freezeSettings(),s=new Ef;return bg(n,s,new _f(s,r.cacheSizeBytes,null==e?void 0:e.forceOwnership))}function vg(t){Dg(t=Yf(t,fg));const e=pg(t);if(e._uninitializedComponentsProvider)throw new Zr(Jr.FAILED_PRECONDITION,"SDK cache is already specified.");$r("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");const n=t._freezeSettings(),r=new Ef;return bg(e,r,new If(r,n.cacheSizeBytes))}function bg(t,e,n){const r=new ts;return t.asyncQueue.enqueue((async()=>{try{await Nf(t,n),await kf(t,e),r.resolve()}catch(t){const e=t;if(!Rf(e))throw e;$r("Error enabling indexeddb cache. Falling back to memory cache: "+e),r.reject(e)}})).then((()=>r.promise))}function _g(t){if(t._initialized&&!t._terminated)throw new Zr(Jr.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");const e=new ts;return t._queue.enqueueAndForgetEvenWhileRestricted((async()=>{try{await async function(t){if(!Vs.D())return Promise.resolve();const e=t+"main";await Vs.delete(e)}(nh(t._databaseId,t._persistenceKey)),e.resolve()}catch(t){e.reject(t)}})),e.promise}function Ig(t){return function(t){const e=new ts;return t.asyncQueue.enqueueAndForget((async()=>async function(t,e){const n=Xr(t);ed(n.remoteStore)||jr("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");try{const t=await function(t){const e=Xr(t);return e.persistence.runTransaction("Get highest unacknowledged batch id","readonly",(t=>e.mutationQueue.getHighestUnacknowledgedBatchId(t)))}(n.localStore);if(-1===t)return void e.resolve();const r=n.Ca.get(t)||[];r.push(e),n.Ca.set(t,r)}catch(t){const n=Id(t,"Initialization of waitForPendingWrites() operation failed");e.reject(n)}}(await Vf(t),e))),e.promise}(pg(t=Yf(t,fg)))}function Eg(t){return function(t){return t.asyncQueue.enqueue((async()=>{const e=await Of(t),n=await Ff(t);return e.setNetworkEnabled(!0),function(t){const e=Xr(t);return e.v_.delete(0),Qh(e)}(n)}))}(pg(t=Yf(t,fg)))}function Tg(t){return function(t){return t.asyncQueue.enqueue((async()=>{const e=await Of(t),n=await Ff(t);return e.setNetworkEnabled(!1),async function(t){const e=Xr(t);e.v_.add(0),await Hh(e),e.x_.set("Offline")}(n)}))}(pg(t=Yf(t,fg)))}function Sg(t){return i._removeServiceInstance(t.app,"firestore",t._databaseId.database),t._delete()}function xg(t,e){const n=pg(t=Yf(t,fg)),r=new hg;return function(t,e,n,r){const s=function(t,e){let n;return n="string"==typeof t?wu().encode(t):t,function(t,e){return new xf(t,e)}(function(t,e){if(t instanceof Uint8Array)return Tf(t,e);if(t instanceof ArrayBuffer)return Tf(new Uint8Array(t),e);if(t instanceof ReadableStream)return t.getReader();throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream")}(n),e)}(n,qh(e));t.asyncQueue.enqueueAndForget((async()=>{!function(t,e,n){const r=Xr(t);(async function(t,e,n){try{const r=await e.getMetadata();if(await function(t,e){const n=Xr(t),r=Uu(e.createTime);return n.persistence.runTransaction("hasNewerBundle","readonly",(t=>n.$r.getBundleMetadata(t,e.id))).then((t=>!!t&&t.createTime.compareTo(r)>=0))}(t.localStore,r))return await e.close(),n._completeWith(function(t){return{taskState:"Success",documentsLoaded:t.totalDocuments,bytesLoaded:t.totalBytes,totalDocuments:t.totalDocuments,totalBytes:t.totalBytes}}(r)),Promise.resolve(new Set);n._updateProgress(Fd(r));const s=new Pd(r,t.localStore,e.serializer);let i=await e.Oa();for(;i;){const t=await s.na(i);t&&n._updateProgress(t),i=await e.Oa()}const o=await s.complete();return await of(t,o.sa,void 0),await function(t,e){const n=Xr(t);return n.persistence.runTransaction("Save bundle","readwrite",(t=>n.$r.saveBundleMetadata(t,e)))}(t.localStore,r),n._completeWith(o.progress),Promise.resolve(o.ia)}catch(t){return $r("SyncEngine",`Loading bundle failed with ${t}`),n._failWith(t),Promise.resolve(new Set)}})(r,e,n).then((t=>{r.sharedClientState.notifyBundleLoaded(t)}))}(await Vf(t),s,r)}))}(n,t._databaseId,e,r),r}function Cg(t,e){return function(t,e){return t.asyncQueue.enqueue((async()=>function(t,e){const n=Xr(t);return n.persistence.runTransaction("Get named query","readonly",(t=>n.$r.getNamedQuery(t,e)))}(await Pf(t),e)))}(pg(t=Yf(t,fg)),e).then((e=>e?new eg(t,null,e.query):null))}function Dg(t){if(t._initialized||t._terminated)throw new Zr(Jr.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.")}class Ag{constructor(t="count",e){this._internalFieldPath=e,this.type="AggregateField",this.aggregateType=t}}class Ng{constructor(t,e,n){this._userDataWriter=e,this._data=n,this.type="AggregateQuerySnapshot",this.query=t}data(){return this._userDataWriter.convertObjectMap(this._data)}}class kg{constructor(t){this._byteString=t}static fromBase64String(t){try{return new kg(qi.fromBase64String(t))}catch(t){throw new Zr(Jr.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new kg(qi.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}class Rg{constructor(...t){for(let e=0;e90)throw new Zr(Jr.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Zr(Jr.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return ds(this._lat,t._lat)||ds(this._long,t._long)}}const Pg=/^__.*__$/;class Fg{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new nu(t,this.data,this.fieldMask,e,this.fieldTransforms):new eu(t,this.data,e,this.fieldTransforms)}}class Vg{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return new nu(t,this.data,this.fieldMask,e,this.fieldTransforms)}}function qg(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Hr()}}class Bg{constructor(t,e,n,r,s,i){this.settings=t,this.databaseId=e,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===s&&this.Eu(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get du(){return this.settings.du}Au(t){return new Bg(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Ru(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.Au({path:n,Vu:!1});return r.mu(t),r}fu(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.Au({path:n,Vu:!1});return r.Eu(),r}gu(t){return this.Au({path:void 0,Vu:!0})}pu(t){return om(t,this.settings.methodName,this.settings.yu||!1,this.path,this.settings.wu)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}Eu(){if(this.path)for(let t=0;tu.covers(t.field)))}else u=null,c=o.fieldTransforms;return new Fg(new wo(a),u,c)}class jg extends Lg{_toFieldTransform(t){if(2!==t.du)throw 1===t.du?t.pu(`${this._methodName}() can only appear at the top level of your update data`):t.pu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return t.fieldMask.push(t.path),null}isEqual(t){return t instanceof jg}}function Kg(t,e,n){return new Bg({du:3,wu:e.settings.wu,methodName:t._methodName,Vu:n},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}class $g extends Lg{_toFieldTransform(t){return new Ka(t.path,new Fa)}isEqual(t){return t instanceof $g}}class Qg extends Lg{constructor(t,e){super(t),this.bu=e}_toFieldTransform(t){const e=Kg(this,t,!0),n=this.bu.map((t=>Zg(t,e))),r=new Va(n);return new Ka(t.path,r)}isEqual(t){return t instanceof Qg&&y(this.bu,t.bu)}}class Hg extends Lg{constructor(t,e){super(t),this.bu=e}_toFieldTransform(t){const e=Kg(this,t,!0),n=this.bu.map((t=>Zg(t,e))),r=new Ba(n);return new Ka(t.path,r)}isEqual(t){return t instanceof Hg&&y(this.bu,t.bu)}}class Wg extends Lg{constructor(t,e){super(t),this.Du=e}_toFieldTransform(t){const e=new za(t.serializer,Ra(t.serializer,this.Du));return new Ka(t.path,e)}isEqual(t){return t instanceof Wg&&this.Du===t.Du}}function Yg(t,e,n,r){const s=t.Su(1,e,n);nm("Data must be an object, but it was:",s,r);const i=[],o=wo.empty();Di(r,((t,r)=>{const a=im(e,t,n);r=v(r);const u=s.fu(a);if(r instanceof jg)i.push(a);else{const t=Zg(r,u);null!=t&&(i.push(a),o.set(a,t))}}));const a=new Pi(i);return new Vg(o,a,s.fieldTransforms)}function Xg(t,e,n,r,s,i){const o=t.Su(1,e,n),a=[rm(e,r,n)],u=[s];if(i.length%2!=0)throw new Zr(Jr.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let t=0;t=0;--t)if(!am(c,a[t])){const e=a[t];let n=u[t];n=v(n);const r=o.fu(e);if(n instanceof jg)c.push(e);else{const t=Zg(n,r);null!=t&&(c.push(e),l.set(e,t))}}const h=new Pi(c);return new Vg(l,h,o.fieldTransforms)}function Jg(t,e,n,r=!1){return Zg(n,t.Su(r?4:3,e))}function Zg(t,e){if(em(t=v(t)))return nm("Unsupported field value:",e,t),tm(t,e);if(t instanceof Lg)return function(t,e){if(!qg(e.du))throw e.pu(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.pu(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.Vu&&4!==e.du)throw e.pu("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const s of t){let t=Zg(s,e.gu(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=v(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ra(e.serializer,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=ms.fromDate(t);return{timestampValue:Vu(e.serializer,n)}}if(t instanceof ms){const n=new ms(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Vu(e.serializer,n)}}if(t instanceof Og)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof kg)return{bytesValue:qu(e.serializer,t._byteString)};if(t instanceof ng){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.pu(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:zu(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.pu(`Unsupported field value: ${Wf(t)}`)}(t,e)}function tm(t,e){const n={};return Ai(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Di(t,((t,r)=>{const s=Zg(r,e.Ru(t));null!=s&&(n[t]=s)})),{mapValue:{fields:n}}}function em(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof ms||t instanceof Og||t instanceof kg||t instanceof ng||t instanceof Lg)}function nm(t,e,n){if(!em(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Wf(n);throw"an object"===r?e.pu(t+" a custom object"):e.pu(t+" "+r)}}function rm(t,e,n){if((e=v(e))instanceof Rg)return e._internalPath;if("string"==typeof e)return im(t,e);throw om("Field path arguments must be of type string or ",t,!1,void 0,n)}const sm=new RegExp("[~\\*/\\[\\]]");function im(t,e,n){if(e.search(sm)>=0)throw om(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Rg(...e.split("."))._internalPath}catch(r){throw om(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function om(t,e,n,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let u="";return(i||o)&&(u+=" (found",i&&(u+=` in field ${r}`),o&&(u+=` in document ${s}`),u+=")"),new Zr(Jr.INVALID_ARGUMENT,a+t+u)}function am(t,e){return t.some((t=>t.isEqual(e)))}class um{constructor(t,e,n,r,s){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new ng(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new cm(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(lm("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class cm extends um{data(){return super.data()}}function lm(t,e){return"string"==typeof e?im(t,e):e instanceof Rg?e._internalPath:e._delegate._internalPath}function hm(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Zr(Jr.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class dm{}class fm extends dm{}function gm(t,e,...n){let r=[];e instanceof dm&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof ym)).length,n=t.filter((t=>t instanceof mm)).length;if(e>1||e>0&&n>0)throw new Zr(Jr.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const e of r)t=e._apply(t);return t}class mm extends fm{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new mm(t,e,n)}_apply(t){const e=this._parse(t);return Lm(t._query,e),new eg(t.firestore,t.converter,aa(t._query,e))}_parse(t){const e=zg(t.firestore),n=function(t,e,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Zr(Jr.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Mm(o,i);const e=[];for(const n of o)e.push(Rm(r,t,n));a={arrayValue:{values:e}}}else a=Rm(r,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Mm(o,i),a=Jg(n,e,o,"in"===i||"not-in"===i);return Co.create(s,i,a)}(t._query,"where",e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function pm(t,e,n){const r=e,s=lm("where",t);return mm._create(s,r,n)}class ym extends dm{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new ym(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:Do.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)Lm(n,t),n=aa(n,t)}(t._query,e),new eg(t.firestore,t.converter,aa(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function wm(...t){return t.forEach((t=>Om("or",t))),ym._create("or",t)}function vm(...t){return t.forEach((t=>Om("and",t))),ym._create("and",t)}class bm extends fm{constructor(t,e){super(),this._field=t,this._direction=e,this.type="orderBy"}static _create(t,e){return new bm(t,e)}_apply(t){const e=function(t,e,n){if(null!==t.startAt)throw new Zr(Jr.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new Zr(Jr.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new To(e,n)}(t._query,this._field,this._direction);return new eg(t.firestore,t.converter,function(t,e){const n=t.explicitOrderBy.concat([e]);return new Zo(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(t._query,e))}}function _m(t,e="asc"){const n=e,r=lm("orderBy",t);return bm._create(r,n)}class Im extends fm{constructor(t,e,n){super(),this.type=t,this._limit=e,this._limitType=n}static _create(t,e,n){return new Im(t,e,n)}_apply(t){return new eg(t.firestore,t.converter,ua(t._query,this._limit,this._limitType))}}function Em(t){return Xf("limit",t),Im._create("limit",t,"F")}function Tm(t){return Xf("limitToLast",t),Im._create("limitToLast",t,"L")}class Sm extends fm{constructor(t,e,n){super(),this.type=t,this._docOrFields=e,this._inclusive=n}static _create(t,e,n){return new Sm(t,e,n)}_apply(t){const e=km(t,this.type,this._docOrFields,this._inclusive);return new eg(t.firestore,t.converter,function(t,e){return new Zo(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,e,t.endAt)}(t._query,e))}}function xm(...t){return Sm._create("startAt",t,!0)}function Cm(...t){return Sm._create("startAfter",t,!1)}class Dm extends fm{constructor(t,e,n){super(),this.type=t,this._docOrFields=e,this._inclusive=n}static _create(t,e,n){return new Dm(t,e,n)}_apply(t){const e=km(t,this.type,this._docOrFields,this._inclusive);return new eg(t.firestore,t.converter,function(t,e){return new Zo(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,e)}(t._query,e))}}function Am(...t){return Dm._create("endBefore",t,!1)}function Nm(...t){return Dm._create("endAt",t,!0)}function km(t,e,n,r){if(n[0]=v(n[0]),n[0]instanceof um)return function(t,e,n,r,s){if(!r)throw new Zr(Jr.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${n}().`);const i=[];for(const n of sa(t))if(n.field.isKeyField())i.push(io(e,r.key));else{const t=r.data.field(n.field);if(ji(t))throw new Zr(Jr.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+n.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===t){const t=n.field.canonicalString();throw new Zr(Jr.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`)}i.push(t)}return new _o(i,s)}(t._query,t.firestore._databaseId,e,n[0]._document,r);{const s=zg(t.firestore);return function(t,e,n,r,s,i){const o=t.explicitOrderBy;if(s.length>o.length)throw new Zr(Jr.INVALID_ARGUMENT,`Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const a=[];for(let i=0;i=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new Zr(Jr.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Zr(Jr.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function Om(t,e){if(!(e instanceof mm||e instanceof ym))throw new Zr(Jr.INVALID_ARGUMENT,`Function ${t}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}class Pm{convertValue(t,e="none"){switch(Xi(t)){case 0:return null;case 1:return t.booleanValue;case 2:return zi(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(Gi(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Hr()}}convertObject(t,e){return this.convertObjectMap(t.fields,e)}convertObjectMap(t,e="none"){const n={};return Di(t,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Og(zi(t.latitude),zi(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Ki(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp($i(t));default:return null}}convertTimestamp(t){const e=Ui(t);return new ms(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=ws.fromString(t);Wr(dc(n));const r=new Hi(n.get(1),n.get(3)),s=new _s(n.popFirst(5));return r.isEqual(e)||Kr(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),s}}function Fm(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}class Vm extends Pm{constructor(t){super(),this.firestore=t}convertBytes(t){return new kg(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new ng(this.firestore,null,e)}}function qm(t){return new Ag("sum",rm("sum",t))}function Bm(t){return new Ag("avg",rm("average",t))}function Um(){return new Ag("count")}function zm(t,e){var n,r;return t instanceof Ag&&e instanceof Ag&&t.aggregateType===e.aggregateType&&(null===(n=t._internalFieldPath)||void 0===n?void 0:n.canonicalString())===(null===(r=e._internalFieldPath)||void 0===r?void 0:r.canonicalString())}function Gm(t,e){return ug(t.query,e.query)&&y(t.data(),e.data())}class jm{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Km extends um{constructor(t,e,n,r,s,i){super(t,e,n,r,i),this._firestore=t,this._firestoreImpl=t,this.metadata=s}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new $m(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(lm("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class $m extends Km{data(t={}){return super.data(t)}}class Qm{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new jm(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new $m(this._firestore,this._userDataWriter,n.key,n,new jm(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Zr(Jr.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new $m(t._firestore,t._userDataWriter,n.doc.key,n.doc,new jm(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new $m(t._firestore,t._userDataWriter,e.doc.key,e.doc,new jm(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let s=-1,i=-1;return 0!==e.type&&(s=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:Hm(e.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Hm(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Hr()}}function Wm(t,e){return t instanceof Km&&e instanceof Km?t._firestore===e._firestore&&t._key.isEqual(e._key)&&(null===t._document?null===e._document:t._document.isEqual(e._document))&&t._converter===e._converter:t instanceof Qm&&e instanceof Qm&&t._firestore===e._firestore&&ug(t.query,e.query)&&t.metadata.isEqual(e.metadata)&&t._snapshot.isEqual(e._snapshot)}function Ym(t){t=Yf(t,ng);const e=Yf(t.firestore,fg);return Uf(pg(e),t._key).then((n=>lp(e,t,n)))}class Xm extends Pm{constructor(t){super(),this.firestore=t}convertBytes(t){return new kg(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new ng(this.firestore,null,e)}}function Jm(t){t=Yf(t,ng);const e=Yf(t.firestore,fg),n=pg(e),r=new Xm(e);return function(t,e){const n=new ts;return t.asyncQueue.enqueueAndForget((async()=>async function(t,e,n){try{const r=await function(t,e){const n=Xr(t);return n.persistence.runTransaction("read document","readonly",(t=>n.localDocuments.getDocument(t,e)))}(t,e);r.isFoundDocument()?n.resolve(r):r.isNoDocument()?n.resolve(null):n.reject(new Zr(Jr.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)"))}catch(t){const r=Id(t,`Failed to get document '${e} from cache`);n.reject(r)}}(await Pf(t),e,n))),n.promise}(n,t._key).then((n=>new Km(e,r,t._key,n,new jm(null!==n&&n.hasLocalMutations,!0),t.converter)))}function Zm(t){t=Yf(t,ng);const e=Yf(t.firestore,fg);return Uf(pg(e),t._key,{source:"server"}).then((n=>lp(e,t,n)))}function tp(t){t=Yf(t,eg);const e=Yf(t.firestore,fg),n=pg(e),r=new Xm(e);return hm(t._query),zf(n,t._query).then((n=>new Qm(e,r,t,n)))}function ep(t){t=Yf(t,eg);const e=Yf(t.firestore,fg),n=pg(e),r=new Xm(e);return function(t,e){const n=new ts;return t.asyncQueue.enqueueAndForget((async()=>async function(t,e,n){try{const r=await gh(t,e,!0),s=new Bd(e,r.hs),i=s.ha(r.documents),o=s.applyChanges(i,!1);n.resolve(o.snapshot)}catch(t){const r=Id(t,`Failed to execute query '${e} against cache`);n.reject(r)}}(await Pf(t),e,n))),n.promise}(n,t._query).then((n=>new Qm(e,r,t,n)))}function np(t){t=Yf(t,eg);const e=Yf(t.firestore,fg),n=pg(e),r=new Xm(e);return zf(n,t._query,{source:"server"}).then((n=>new Qm(e,r,t,n)))}function rp(t,e,n){t=Yf(t,ng);const r=Yf(t.firestore,fg),s=Fm(t.converter,e,n);return cp(r,[Gg(zg(r),"setDoc",t._key,s,null!==t.converter,n).toMutation(t._key,Qa.none())])}function sp(t,e,n,...r){t=Yf(t,ng);const s=Yf(t.firestore,fg),i=zg(s);let o;return o="string"==typeof(e=v(e))||e instanceof Rg?Xg(i,"updateDoc",t._key,e,n,r):Yg(i,"updateDoc",t._key,e),cp(s,[o.toMutation(t._key,Qa.exists(!0))])}function ip(t){return cp(Yf(t.firestore,fg),[new ou(t._key,Qa.none())])}function op(t,e){const n=Yf(t.firestore,fg),r=og(t),s=Fm(t.converter,e);return cp(n,[Gg(zg(t.firestore),"addDoc",r._key,s,null!==t.converter,{}).toMutation(r._key,Qa.exists(!1))]).then((()=>r))}function ap(t,...e){var n,r,s;t=v(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||lg(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(lg(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(s=t.complete)||void 0===s?void 0:s.bind(t)}let u,c,l;if(t instanceof ng)c=Yf(t.firestore,fg),l=ea(t._key.path),u={next:n=>{e[o]&&e[o](lp(c,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Yf(t,eg);c=Yf(n.firestore,fg),l=n._query;const r=new Xm(c);u={next:t=>{e[o]&&e[o](new Qm(c,r,n,t))},error:e[o+1],complete:e[o+2]},hm(t._query)}return function(t,e,n,r){const s=new Sf(r),i=new Md(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>Dd(await Bf(t),i))),()=>{s.La(),t.asyncQueue.enqueueAndForget((async()=>Ad(await Bf(t),i)))}}(pg(c),l,a,u)}function up(t,e){return function(t,e){const n=new Sf(e);return t.asyncQueue.enqueueAndForget((async()=>function(t,e){Xr(t).K_.add(e),e.next()}(await Bf(t),n))),()=>{n.La(),t.asyncQueue.enqueueAndForget((async()=>function(t,e){Xr(t).K_.delete(e)}(await Bf(t),n)))}}(pg(t=Yf(t,fg)),lg(e)?e:{next:e})}function cp(t,e){return function(t,e){const n=new ts;return t.asyncQueue.enqueueAndForget((async()=>async function(t,e,n){const r=wf(t);try{const t=await function(t,e){const n=Xr(t),r=ms.now(),s=e.reduce(((t,e)=>t.add(e.key)),Ca());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=wa(),u=Ca();return n.os.getEntries(t,s).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(u=u.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((s=>{i=s;const o=[];for(const t of e){const e=Za(t,i.get(t.key).overlayedDocument);null!=e&&o.push(new nu(t.key,e,vo(e.value.mapValue),Qa.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(i,u);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:_a(i)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.Da[t.currentUser.toKey()];r||(r=new Ni(ds)),r=r.insert(e,n),t.Da[t.currentUser.toKey()]=r}(r,t.batchId,n),await of(r,t.changes),await ud(r.remoteStore)}catch(t){const e=Id(t,"Failed to persist write");n.reject(e)}}(await Vf(t),e,n))),n.promise}(pg(t),e)}function lp(t,e,n){const r=n.docs.get(e._key),s=new Xm(t);return new Km(t,s,e._key,r,new jm(n.hasPendingWrites,n.fromCache),e.converter)}function hp(t){return dp(t,{count:Um()})}function dp(t,e){const n=Yf(t.firestore,fg),r=pg(n),s=function(t,e){const n=[];for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.push(e(t[r],r,t));return n}(e,((t,e)=>new hu(e,t.aggregateType,t._internalFieldPath)));return function(t,e,n){const r=new ts;return t.asyncQueue.enqueueAndForget((async()=>{try{const s=await qf(t);r.resolve(async function(t,e,n){var r;const s=Xr(t),{request:i,V_:o,parent:a}=function(t,e,n){const{ut:r,parent:s}=nc(t,e),i={},o=[];let a=0;return n.forEach((t=>{const e="aggregate_"+a++;i[e]=t.alias,"count"===t.aggregateType?o.push({alias:e,count:{}}):"avg"===t.aggregateType?o.push({alias:e,avg:{field:uc(t.fieldPath)}}):"sum"===t.aggregateType&&o.push({alias:e,sum:{field:uc(t.fieldPath)}})})),{request:{structuredAggregationQuery:{aggregations:o,structuredQuery:r.structuredQuery},parent:r.parent},V_:i,parent:s}}(s.serializer,function(t){const e=Xr(t);return e.Pe||(e.Pe=oa(e,t.explicitOrderBy)),e.Pe}(e),n);s.connection.wo||delete i.parent;const u=(await s.vo("RunAggregationQuery",s.serializer.databaseId,a,i,1)).filter((t=>!!t.result));Wr(1===u.length);const c=null===(r=u[0].result)||void 0===r?void 0:r.aggregateFields;return Object.keys(c).reduce(((t,e)=>(t[o[e]]=c[e],t)),{})}(s,e,n))}catch(t){r.reject(t)}})),r.promise}(r,t._query,s).then((e=>function(t,e,n){const r=new Xm(t);return new Ng(e,r,n)}(n,t,e)))}class fp{constructor(t){this.kind="memory",this._onlineComponentProvider=new Ef,(null==t?void 0:t.garbageCollector)?this._offlineComponentProvider=t.garbageCollector._offlineComponentProvider:this._offlineComponentProvider=new vf}toJSON(){return{kind:this.kind}}}class gp{constructor(t){let e;this.kind="persistent",(null==t?void 0:t.tabManager)?(t.tabManager._initialize(t),e=t.tabManager):(e=Ep(void 0),e._initialize(t)),this._onlineComponentProvider=e._onlineComponentProvider,this._offlineComponentProvider=e._offlineComponentProvider}toJSON(){return{kind:this.kind}}}class mp{constructor(){this.kind="memoryEager",this._offlineComponentProvider=new vf}toJSON(){return{kind:this.kind}}}class pp{constructor(t){this.kind="memoryLru",this._offlineComponentProvider=new bf(t)}toJSON(){return{kind:this.kind}}}function yp(){return new mp}function wp(t){return new pp(null==t?void 0:t.cacheSizeBytes)}function vp(t){return new fp(t)}function bp(t){return new gp(t)}class _p{constructor(t){this.forceOwnership=t,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(t){this._onlineComponentProvider=new Ef,this._offlineComponentProvider=new _f(this._onlineComponentProvider,null==t?void 0:t.cacheSizeBytes,this.forceOwnership)}}class Ip{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(t){this._onlineComponentProvider=new Ef,this._offlineComponentProvider=new If(this._onlineComponentProvider,null==t?void 0:t.cacheSizeBytes)}}function Ep(t){return new _p(null==t?void 0:t.forceOwnership)}function Tp(){return new Ip}const Sp={maxAttempts:5};class xp{constructor(t,e){this._firestore=t,this._commitHandler=e,this._mutations=[],this._committed=!1,this._dataReader=zg(t)}set(t,e,n){this._verifyNotCommitted();const r=Cp(t,this._firestore),s=Fm(r.converter,e,n),i=Gg(this._dataReader,"WriteBatch.set",r._key,s,null!==r.converter,n);return this._mutations.push(i.toMutation(r._key,Qa.none())),this}update(t,e,n,...r){this._verifyNotCommitted();const s=Cp(t,this._firestore);let i;return i="string"==typeof(e=v(e))||e instanceof Rg?Xg(this._dataReader,"WriteBatch.update",s._key,e,n,r):Yg(this._dataReader,"WriteBatch.update",s._key,e),this._mutations.push(i.toMutation(s._key,Qa.exists(!0))),this}delete(t){this._verifyNotCommitted();const e=Cp(t,this._firestore);return this._mutations=this._mutations.concat(new ou(e._key,Qa.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new Zr(Jr.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function Cp(t,e){if((t=v(t)).firestore!==e)throw new Zr(Jr.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}class Dp extends class{constructor(t,e){this._firestore=t,this._transaction=e,this._dataReader=zg(t)}get(t){const e=Cp(t,this._firestore),n=new Vm(this._firestore);return this._transaction.lookup([e._key]).then((t=>{if(!t||1!==t.length)return Hr();const r=t[0];if(r.isFoundDocument())return new um(this._firestore,n,r.key,r,e.converter);if(r.isNoDocument())return new um(this._firestore,n,e._key,null,e.converter);throw Hr()}))}set(t,e,n){const r=Cp(t,this._firestore),s=Fm(r.converter,e,n),i=Gg(this._dataReader,"Transaction.set",r._key,s,null!==r.converter,n);return this._transaction.set(r._key,i),this}update(t,e,n,...r){const s=Cp(t,this._firestore);let i;return i="string"==typeof(e=v(e))||e instanceof Rg?Xg(this._dataReader,"Transaction.update",s._key,e,n,r):Yg(this._dataReader,"Transaction.update",s._key,e),this._transaction.update(s._key,i),this}delete(t){const e=Cp(t,this._firestore);return this._transaction.delete(e._key),this}}{constructor(t,e){super(t,e),this._firestore=t}get(t){const e=Cp(t,this._firestore),n=new Xm(this._firestore);return super.get(t).then((t=>new Km(this._firestore,n,e._key,t._document,new jm(!1,!1),e.converter)))}}function Ap(t,e,n){t=Yf(t,fg);const r=Object.assign(Object.assign({},Sp),n);return function(t){if(t.maxAttempts<1)throw new Zr(Jr.INVALID_ARGUMENT,"Max attempts must be at least 1")}(r),function(t,e,n){const r=new ts;return t.asyncQueue.enqueueAndForget((async()=>{const s=await qf(t);new Df(t.asyncQueue,s,n,e,r).ja()})),r.promise}(pg(t),(n=>e(new Dp(t,n))),r)}function Np(){return new jg("deleteField")}function kp(){return new $g("serverTimestamp")}function Rp(...t){return new Qg("arrayUnion",t)}function Mp(...t){return new Hg("arrayRemove",t)}function Lp(t){return new Wg("increment",t)}function Op(t){return pg(t=Yf(t,fg)),new xp(t,(e=>cp(t,e)))}function Pp(t,e){var n;const r=pg(t=Yf(t,fg));if(!r._uninitializedComponentsProvider||"memory"===(null===(n=r._uninitializedComponentsProvider)||void 0===n?void 0:n._offlineKind))return $r("Cannot enable indexes when persistence is disabled"),Promise.resolve();const s=function(t){const e="string"==typeof t?function(t){try{return JSON.parse(t)}catch(t){throw new Zr(Jr.INVALID_ARGUMENT,"Failed to parse JSON: "+(null==t?void 0:t.message))}}(t):t,n=[];if(Array.isArray(e.indexes))for(const t of e.indexes){const e=Fp(t,"collectionGroup"),r=[];if(Array.isArray(t.fields))for(const e of t.fields){const t=im("setIndexConfiguration",Fp(e,"fieldPath"));"CONTAINS"===e.arrayConfig?r.push(new xs(t,2)):"ASCENDING"===e.order?r.push(new xs(t,0)):"DESCENDING"===e.order&&r.push(new xs(t,1))}n.push(new Is(Is.UNKNOWN_ID,e,r,Ds.empty()))}return n}(e);return function(t,e){return t.asyncQueue.enqueue((async()=>async function(t,e){const n=Xr(t),r=n.indexManager,s=[];return n.persistence.runTransaction("Configure indexes","readwrite",(t=>r.getFieldIndexes(t).next((n=>function(t,e,n,r,s){t=[...t],e=[...e],t.sort(n),e.sort(n);const i=t.length,o=e.length;let a=0,u=0;for(;a0?r(e[a++]):(a++,u++)}for(;a{s.push(r.addFieldIndex(t,e))}),(e=>{s.push(r.deleteFieldIndex(t,e))})))).next((()=>Ps.waitFor(s)))))}(await Pf(t),e)))}(r,s)}function Fp(t,e){if("string"!=typeof t[e])throw new Zr(Jr.INVALID_ARGUMENT,"Missing string value for: "+e);return t[e]}class Vp{constructor(t){this._client=t,this.type="PersistentCacheIndexManager"}}function qp(t){var e;t=Yf(t,fg);const n=jp.get(t);if(n)return n;const r=pg(t);if("persistent"!==(null===(e=r._uninitializedComponentsProvider)||void 0===e?void 0:e._offlineKind))return null;const s=new Vp(r);return jp.set(t,s),s}function Bp(t){Gp(t,!0)}function Up(t){Gp(t,!1)}function zp(t){t._client.verifyNotTerminated(),function(t){return t.asyncQueue.enqueue((async()=>function(t){const e=Xr(t),n=e.indexManager;return e.persistence.runTransaction("Delete All Indexes","readwrite",(t=>n.deleteAllFieldIndexes(t)))}(await Pf(t))))}(t._client).then((t=>jr("deleting all persistent cache indexes succeeded"))).catch((t=>$r("deleting all persistent cache indexes failed",t)))}function Gp(t,e){t._client.verifyNotTerminated(),function(t,e){return t.asyncQueue.enqueue((async()=>function(t,e){Xr(t).ts.Ui=e}(await Pf(t),e)))}(t._client,e).then((t=>jr(`setting persistent cache index auto creation isEnabled=${e} succeeded`))).catch((t=>$r(`setting persistent cache index auto creation isEnabled=${e} failed`,t)))}const jp=new WeakMap;class Kp{constructor(){throw new Error("instances of this class should not be created")}static onExistenceFilterMismatch(t){return $p.instance.onExistenceFilterMismatch(t)}}class $p{constructor(){this.Cu=new Map}static get instance(){return Qp||(Qp=new $p,function(t){if(yu)throw new Error("a TestingHooksSpi instance is already set");yu=t}(Qp)),Qp}tt(t){this.Cu.forEach((e=>e(t)))}onExistenceFilterMismatch(t){const e=Symbol(),n=this.Cu;return n.set(e,t),()=>n.delete(e)}}let Qp=null;!function(t,e=!0){!function(t){Br=t}(i.SDK_VERSION),i._registerComponent(new b("firestore",((t,{instanceIdentifier:n,options:r})=>{const s=t.getProvider("app").getImmediate(),i=new fg(new ss(t.getProvider("auth-internal")),new us(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Zr(Jr.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Hi(t.options.projectId,e)}(s,n),s);return r=Object.assign({useFetchStreams:e},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),i.registerVersion(Vr,"4.4.2",t),i.registerVersion(Vr,"4.4.2","esm2017")}()})); \ No newline at end of file diff --git a/frontend-dist/help-circle-outline.a023036a.svg b/frontend-dist/help-circle-outline.a023036a.svg new file mode 100644 index 000000000..17ce1e0bc --- /dev/null +++ b/frontend-dist/help-circle-outline.a023036a.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/index.4fff403b.js b/frontend-dist/index.4fff403b.js new file mode 100644 index 000000000..751709efc --- /dev/null +++ b/frontend-dist/index.4fff403b.js @@ -0,0 +1,123 @@ +var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},t={},o={},n=e.parcelRequire94c2;null==n&&((n=function(e){if(e in t)return t[e].exports;if(e in o){var n=o[e];delete o[e];var r={id:e,exports:{}};return t[e]=r,n.call(r.exports,r,r.exports),r.exports}var l=new Error("Cannot find module '"+e+"'");throw l.code="MODULE_NOT_FOUND",l}).register=function(e,t){o[e]=t},e.parcelRequire94c2=n);var r=n("cNaMA");n("eS9BV");var l,a,i,s,c={};l=c,a="Welcome",i=()=>B,s=e=>B=e,Object.defineProperty(l,a,{get:i,set:s,enumerable:!0,configurable:!0}),n("9Ta4i");r=n("cNaMA"),r=n("cNaMA");var u=n("4zMEb");const d=async()=>{let e=await fetch("https://api.github.com/repos/fonsp/Pluto.jl/releases",{method:"GET",mode:"cors",cache:"no-cache",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer"});return(await e.json()).reverse()};n("9Ta4i");r=n("cNaMA");var p=n("2ZZ1r"),h=n("hrGZZ");r=n("cNaMA");const f=e=>{const t=`${e}\n`.replace("\r\n","\n"),o=t.indexOf("### A Pluto.jl notebook ###"),n=t.match(/# ... ........-....-....-....-............/g),r=(null==n?void 0:n.length)??0;let l=t.indexOf("# ╔═╡ Cell order:")+17+1;for(let e=1;e<=r;e++)l=t.indexOf("\n",l+1)+1;return t.slice(o,l)},m=({on_start_navigation:e})=>{const t=async t=>{var o;let n;if(console.log(t),(null===(o=((null==t?void 0:t.path)??(null==t?void 0:t.composedPath())).filter((e=>{var t;return null==e||null===(t=e.classList)||void 0===t?void 0:t.contains(".cm-editor")})))||void 0===o?void 0:o.length)>0)return;switch(t.type){case"paste":n=f(t.clipboardData.getData("text/plain"));break;case"dragstart":return void(t.dataTransfer.dropEffect="move");case"dragover":return void t.preventDefault();case"drop":t.preventDefault(),n=t.dataTransfer.types.includes("Files")?await(l=t.dataTransfer.files[0],new Promise(((e,t)=>{const{name:o,type:n}=l,r=new FileReader;r.onerror=()=>t("Failed to read file!"),r.onloadstart=()=>{},r.onprogress=({loaded:e,total:t})=>{},r.onload=()=>{},r.onloadend=()=>e({file:r.result,name:o,type:n}),r.readAsText(l)}))).then((({file:e})=>e)):f(await(r=t.dataTransfer.items[0],new Promise(((e,t)=>{try{r.getAsString((t=>{console.log(t),e(t)}))}catch(e){t(e)}}))))}var r,l;if(!n)return;e("notebook from clipboard",!1),document.body.classList.add("loading");const a=await fetch("./notebookupload",{method:"POST",body:n});if(a.ok)window.location.href=b(await a.text());else{let e=await a.blob();window.location.href=URL.createObjectURL(e)}};return h.useEventListener(document,"paste",t,[t]),h.useEventListener(document,"drop",t,[t]),h.useEventListener(document,"dragstart",t,[t]),h.useEventListener(document,"dragover",t,[t]),r.html``};var _=n("1xJnC");const v=({client:e,connected:t,CustomPicker:o,show_samples:n,on_start_navigation:l})=>{const a=o??{text:"Open a notebook",placeholder:"Enter path or URL..."};return r.html`<${m} on_start_navigation=${l} /> +

    ${a.text}

    +
    + <${p.FilePicker} + key=${a.placeholder} + client=${e} + value="" + on_submit=${async e=>{const t=await _.guess_notebook_location(e);l(t.path_or_url),window.location.href=("path"===t.type?g:w)(t.path_or_url)}} + on_desktop_submit=${async e=>{var t;null===(t=window.plutoDesktop)||void 0===t||t.fileSystem.openNotebook("path")}} + clear_on_blur=${!1} + button_label=${window.plutoDesktop?"Open File":"Open"} + placeholder=${a.placeholder} + /> + ${null!=window.plutoDesktop?r.html`<${p.FilePicker} + key=${a.placeholder} + client=${e} + value="" + on_desktop_submit=${async e=>{var t;null===(t=window.plutoDesktop)||void 0===t||t.fileSystem.openNotebook("url",e)}} + button_label="Open from URL" + placeholder=${a.placeholder} + />`:null} +
    `},g=(e,t=!1)=>"open?"+new URLSearchParams({path:e}).toString(),w=e=>"open?"+new URLSearchParams({url:e}).toString(),b=e=>"edit?id="+e;var k=n("9Ta4i"),y=(r=n("cNaMA"),r=n("cNaMA"),n("aN0pg")),$=n("dYd4C");const j=e=>({transitioning:!1,entry:void 0,path:e}),P=e=>({transitioning:!1,entry:e,path:e.path}),S=(e,t)=>e.split(/\/|\\/).slice(-t).join("/"),E=(e,t)=>{let o=1;for(const n of t)if(n!==e)for(;S(e,o)===S(n,o);)o++;return S(e,o)},x=({client:e,connected:t,remote_notebooks:o,CustomRecent:n,on_start_navigation:l})=>{const[a,i]=r.useState(null),s=r.useRef(a);s.current=a;const c=(e,t)=>{i((o=>(null==o?void 0:o.map((o=>o.path==e?{...o,...t}:o)))??null))};r.useEffect((()=>{null!=e&&t&&e.send("get_all_notebooks",{},{}).then((({message:e})=>{const t=e.notebooks.map((e=>P(e))),o=L(),n=[...k.default.sortBy(t,[e=>k.default.findIndex([...o,...t],(t=>t.path===e.path))]),...k.default.differenceBy(o,t,(e=>e.path))];i(n),document.body.classList.remove("loading")}))}),[null!=e&&t]),r.useEffect((()=>{const e=o;if(null!=s.current){const t=[],o=s.current.map((o=>{let n=null;if(n=null!=o.entry?e.find((e=>{var t;return e.notebook_id===(null===(t=o.entry)||void 0===t?void 0:t.notebook_id)})):e.find((e=>e.path===o.path)),null==n)return j(o.path);{const e=P(n);return t.push(n),e}})),n=e.filter((e=>!t.includes(e))).map(P);i([...n,...o])}}),[o]);r.useEffect((()=>{document.body.classList.toggle("nosessions",!(null==a||a.length>0))}),[a]);const u=null==a?void 0:a.map((e=>e.path));let d=null==a?r.html`
  • Loading...
  • `:a.map((t=>{var o,n;const a=null!=t.entry;return r.html`
  • + + {a||(l(E(t.path,u)),c(t.path,{transitioning:!0}))}} + >${E(t.path,u)} +
  • `}));return null==n?r.html` +

    My work

    + + `:r.html`<${n} cl=${y.cl} combined=${a} client=${e} recents=${d} />`},L=()=>{const e=localStorage.getItem("recent notebooks"),t=null!=e?JSON.parse(e):[];return(t instanceof Array?t:[]).map(j)};k=n("9Ta4i"),r=n("cNaMA");var C=n("h2NGW"),N=n("1Mxs0");const T=[{title:"Featured Notebooks",description:"These notebooks from the Julia community show off what you can do with Pluto. Give it a try, you might learn something new!",collections:[{title:"Loading...",tags:[]}],notebooks:{}}],A=r.html` + +`,O=[{title:"Notebooks",tags:"everything"}],R=e=>(null==e?void 0:e.id)??e.url,M=({sources:e,direct_html_links:t})=>{const[o,n]=r.useState({});r.useEffect((()=>{if(null!=e){a(!1),n({});const t=Array.from(new Set(e.map(R))).map((t=>{const o=e.filter((e=>R(e)===t));return I(o.map((async e=>{const{url:o,integrity:n,valid_until:r}=e;if(null!=r&&new Date(r){n((n=>({...n,[t]:{...e,source_url:o}})))}))}));Promise.any(t).catch((e=>{console.error("All featured sources failed to load: ",e),((null==e?void 0:e.errors)??[]).forEach((e=>console.error(e))),a(!0)}))}}),[e]),r.useEffect((()=>{Object.entries(o).length>0&&console.log("Sources:",o)}),[o]);const[l,a]=r.useState(!1);r.useEffect((()=>{setTimeout((()=>{a(!0)}),8e3)}),[]);const i=0===Object.entries(o).length,s=Array.from(new Set((null==e?void 0:e.map(R))??[])).map((e=>o[e])).filter((e=>null!=e));return i&&l?A:r.html` + ${(i?T:s).map((e=>{let o=(null==e?void 0:e.collections)??O;return r.html` + + `}))} + `};C.default(M,"pluto-featured",["sources","direct_html_links"]);const D=(e,t)=>{const o="everything"===t?e:e.filter((e=>t.some((t=>{var o;return((null===(o=e.frontmatter)||void 0===o?void 0:o.tags)??[]).includes(t)}))));return k.default.sortBy(o,[e=>{var t;return(e=>isNaN(e)?e:Number(e))(null==e||null===(t=e.frontmatter)||void 0===t?void 0:t.order)},"id"])},I=(e,t=[])=>e.length<=1?Promise.any([...e,...t]):e[0].catch((()=>I(e.slice(1),[...t,e[0]])));var U,F=n("cpCG6"),G={sources:[{url:"https://featured.plutojl.org/pluto_export.json",valid_until:"2025-10",id:"featured pluto"},{id:"featured pluto",url:"https://cdn.jsdelivr.net/gh/JuliaPluto/featured@v5/pluto_export.json",integrity:"sha256-+zI9b/gHEIJGV/DrckBY85hkxNWGIewgYffkAkEq4/w="},{url:"https://plutojl.org/pluto_export.json",valid_until:"2025-10",id:"pluto website"}]};const q=(null===(U=document.head.querySelector("link[rel='pluto-logo-big']"))||void 0===U?void 0:U.getAttribute("href"))??"",B=({launch_params:e})=>{const[t,o]=r.useState([]),[n,l]=r.useState(!1),[a,i]=r.useState({show_samples:!0,CustomPicker:null,CustomRecent:null}),s=r.useRef({});r.useEffect((()=>{const t=l;u.create_pluto_connection({on_unrequested_update:({message:e,type:t})=>{"notebook_list"===t&&o(e.notebooks)},on_connection_status:t,on_reconnect:async()=>!0,ws_address:e.pluto_server_url?u.ws_address_from_base(e.pluto_server_url):void 0}).then((async e=>{Object.assign(s.current,e),l(!0);try{const t=await F.get_environment(e),{custom_recent:o,custom_filepicker:n,show_samples:l=!0}=t({client:e,editor:void 0,imports:{preact:r}});i((e=>({...e,CustomRecent:o,CustomPicker:n,show_samples:l})))}catch(e){}(e=>{d().then((t=>{const o=e.version_info.pluto,n=t[t.length-1].tag_name;console.log(`Pluto version ${o}`);const r=t.findIndex((e=>e.tag_name===o));-1!==r&&t.slice(r+1).filter((e=>e.body.toLowerCase().includes("recommended update"))).length>0&&(console.log(`Newer version ${n} is available`),e.version_info.dismiss_update_notification||alert("A new version of Pluto.jl is available! 🎉\n\n You have "+o+", the latest is "+n+'.\n\nYou can update Pluto.jl using the julia package manager:\n import Pkg; Pkg.update("Pluto")\nAfterwards, exit Pluto.jl and restart julia.'))})).catch((()=>{}))})(e),e.send("current_time"),e.send("completepath",{query:""},{})}))}),[]);const{show_samples:c,CustomRecent:p,CustomPicker:h}=a,[f,m]=r.useState(null),_=(e,t=!0)=>{if(t){const t=t=>{m(e)};window.addEventListener("beforeunload",t),setTimeout((()=>window.removeEventListener("beforeunload",t)),1e3)}else m(e)},g=r.useMemo((()=>e.featured_sources??(e.featured_source_url?[{url:e.featured_source_url,integrity:e.featured_source_integrity}]:G.sources)),[e]);return null!=f?r.html` + + `:r.html` +
    +

    welcome to

    +
    +
    +
    + <${x} + client=${s.current} + connected=${n} + remote_notebooks=${t} + CustomRecent=${p} + on_start_navigation=${_} + /> +
    +
    +
    +
    + <${v} + client=${s.current} + connected=${n} + CustomPicker=${h} + show_samples=${c} + on_start_navigation=${_} + /> +
    +
    + + `},J=new URLSearchParams(window.location.search),Y={featured_direct_html_links:!!(J.get("featured_direct_html_links")??window.pluto_featured_direct_html_links),featured_sources:window.pluto_featured_sources,featured_source_url:J.get("featured_source_url")??window.pluto_featured_source_url,featured_source_integrity:J.get("featured_source_integrity")??window.pluto_featured_source_integrity,pluto_server_url:J.get("pluto_server_url")??window.pluto_server_url};console.log("Launch parameters: ",Y),r.render(r.html`<${c.Welcome} launch_params=${Y} />`,document.querySelector("#app")); \ No newline at end of file diff --git a/frontend-dist/index.ba6bd48a.css b/frontend-dist/index.ba6bd48a.css new file mode 100644 index 000000000..d2c5756db --- /dev/null +++ b/frontend-dist/index.ba6bd48a.css @@ -0,0 +1 @@ +*{box-sizing:border-box}html{font-size:17px}#title h1{color:var(--pluto-output-h-color);font-family:Vollkorn,Palatino,serif;font-size:2em;font-style:italic;font-weight:500;letter-spacing:.08em;margin:0;padding:4rem 1rem 3rem;text-align:center}#title h1 img{filter:var(--image-filters);height:1.2em;margin-bottom:-.27em;margin-left:.1em;width:4.9em}body{background:var(--main-bg-color);margin:0;min-height:100%;position:absolute;width:100%}p{color:var(--index-text-color)}ul{list-style:none;padding-left:0}li{border-bottom:1px solid var(--welcome-recentnotebook-border);padding:.4em;white-space:nowrap}a{color:inherit;color:var(--index-clickable-text-color)}pluto-filepicker{background:var(--white);display:flex;flex-direction:row}.desktop_picker{display:flex;flex-direction:row;margin-left:5px}pluto-filepicker .cm-editor{background:none;border:2px solid var(--footer-filepicker-focus-color);border-radius:3px;border-bottom-right-radius:0;border-right:none;border-top-right-radius:0;color:var(--nav-filepicker-color);display:inline-block;flex:1 1 auto;font-family:var(--inter-ui-font-stack);font-size:.75rem;font-style:normal;font-weight:500;height:calc(1rem + 12px);letter-spacing:1px;width:100%;width:0}pluto-filepicker .cm-scroller{scrollbar-width:none}pluto-filepicker .cm-scroller::-webkit-scrollbar{display:none}.desktop_picker button,pluto-filepicker button{background:var(--footer-filepicker-focus-color);border:2px solid var(--nav-filepicker-focus-color);border-radius:3px;color:var(--white);font-family:Roboto Mono,monospace;font-size:.75rem;font-weight:600;margin:0}.desktop_picker_group{display:inline-flex}.desktop_picker_group>input{margin-left:1em}.desktop_picker>button{cursor:pointer}.desktop_picker>button.full_width{width:100%}pluto-filepicker button{border-bottom-left-radius:0;border-top-left-radius:0;cursor:pointer;flex:0 1 auto}pluto-filepicker button:disabled{cursor:not-allowed;opacity:.7}.cm-editor .cm-tooltip{border:1px solid var(--cm-color-editor-tooltip-border);border-radius:4px;box-shadow:3px 3px 4px rgb(0 0 0/20%)}.cm-tooltip-autocomplete{box-sizing:content-box;z-index:100}.cm-editor .cm-tooltip.cm-tooltip-autocomplete>ul{max-height:max(3em,min(50dvh,20em))}.cm-tooltip.cm-completionInfo.cm-completionInfo-right:empty{display:none}.cm-editor .cm-tooltip.cm-tooltip-autocomplete>ul>li{border-radius:3px;height:18px;margin-bottom:unset;overflow-y:hidden}.cm-editor .cm-tooltip.cm-tooltip-autocomplete>ul>li[aria-selected]{background:var(--cm-color-editor-li-aria-selected-bg);color:var(--cm-color-editor-li-aria-selected)}.cm-editor .cm-completionIcon{display:none}.cm-completionIcon:before{color:transparent;content:"⚫";margin-right:.5em;opacity:1}.cm-tooltip.cm-tooltip-autocomplete{background:var(--autocomplete-menu-bg-color);margin-left:-1.5em;padding:0}.cm-tooltip-autocomplete li.file.new:before{content:"👉 "}.cm-tooltip-autocomplete li.file:before{content:"📄 "}.cm-tooltip-autocomplete li.dir:before{content:"📁 "}.cm-tooltip-autocomplete>ul{padding:0}.cm-editor .cm-tooltip-autocomplete .cm-completionLabel{font-family:var(--inter-ui-font-stack);font-size:.8rem;font-variant-ligatures:none;font-weight:400}body.nosessions ul#new~*{display:none}#recent{scrollbar-gutter:stable;background:var(--welcome-recentnotebook-bg);border:.2rem solid #d5d5d5;border-radius:.4rem;box-shadow:-2px 4px 9px 0 #00000012;max-height:16em;overflow-x:hidden;overflow-y:auto}#recent>li.recent{opacity:.8}#recent button{background:none;border:none;color:var(--ui-button-color);cursor:pointer;margin:0 .2em 0 0;opacity:.6;padding:1px}span.ionicon:after{background-size:1rem 1rem;content:" ";display:inline-block;filter:var(--image-filters);height:1rem;margin-bottom:-.17rem;width:1rem}#recent li.running button>span:after{background-image:url(close-circle.d0f6eac6.svg)}#recent li.recent button>span:after{background-image:url(caret-forward-circle-outline.d0bf2b34.svg)}#recent li.transitioning button>span:after{background-image:url(ellipsis-horizontal-outline.abb6e818.svg)}#recent li.new span:after{background-image:url(add-outline.e3c93c35.svg)}loading-bar{background-color:var(--loading-grad-color-1);display:none;height:6px;position:fixed;top:0;width:100vw}body.loading loading-bar{animation:load 16s ease-in-out;display:block}@keyframes load{0%{right:100vw}20%{right:30vw}to{right:0}}.card-list{display:grid;place-items:center;align-items:stretch;gap:0;grid-template-columns:repeat(auto-fit,minmax(var(--card-width),1fr));justify-items:stretch}.navigating-away-banner{display:grid;min-height:70vh;padding:3em;place-content:center;width:100vw}.navigating-away-banner h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap} \ No newline at end of file diff --git a/frontend-dist/index.dbc7264b.css b/frontend-dist/index.dbc7264b.css new file mode 100644 index 000000000..17a18c7ef --- /dev/null +++ b/frontend-dist/index.dbc7264b.css @@ -0,0 +1 @@ +@font-face{font-display:swap;font-family:Inter;font-style:normal;font-weight:100;src:url(Inter-Thin.woff2.a3efb88f6f.099a7dc1.woff2) format("woff2"),url(Inter-Thin.woff.a3efb88f6f.832f7e9d.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:italic;font-weight:100;src:url(Inter-ThinItalic.woff2.a3efb88f6f.f5b32cfe.woff2) format("woff2"),url(Inter-ThinItalic.woff.a3efb88f6f.9a9e646f.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:normal;font-weight:200;src:url(Inter-ExtraLight.woff2.a3efb88f6f.735b820a.woff2) format("woff2"),url(Inter-ExtraLight.woff.a3efb88f6f.018d6d24.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:italic;font-weight:200;src:url(Inter-ExtraLightItalic.woff2.a3efb88f6f.75944d4e.woff2) format("woff2"),url(Inter-ExtraLightItalic.woff.a3efb88f6f.c051c5b4.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:normal;font-weight:300;src:url(Inter-Light.woff2.a3efb88f6f.f86a8a97.woff2) format("woff2"),url(Inter-Light.woff.a3efb88f6f.0cf765a1.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:italic;font-weight:300;src:url(Inter-LightItalic.woff2.a3efb88f6f.cb22faff.woff2) format("woff2"),url(Inter-LightItalic.woff.a3efb88f6f.6c91af65.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:normal;font-weight:400;src:url(Inter-Regular.woff2.a3efb88f6f.c52a047f.woff2) format("woff2"),url(Inter-Regular.woff.a3efb88f6f.d9325c13.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:italic;font-weight:400;src:url(Inter-Italic.woff2.a3efb88f6f.85eee0c1.woff2) format("woff2"),url(Inter-Italic.woff.a3efb88f6f.d9effa31.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:normal;font-weight:500;src:url(Inter-Medium.woff2.a3efb88f6f.4f0ea984.woff2) format("woff2"),url(Inter-Medium.woff.a3efb88f6f.cb391d89.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:italic;font-weight:500;src:url(Inter-MediumItalic.woff2.a3efb88f6f.2b734b7a.woff2) format("woff2"),url(Inter-MediumItalic.woff.a3efb88f6f.1f636c25.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:normal;font-weight:600;src:url(Inter-SemiBold.woff2.a3efb88f6f.08366574.woff2) format("woff2"),url(Inter-SemiBold.woff.a3efb88f6f.c6670c13.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:italic;font-weight:600;src:url(Inter-SemiBoldItalic.woff2.a3efb88f6f.5c7db07d.woff2) format("woff2"),url(Inter-SemiBoldItalic.woff.a3efb88f6f.13394743.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:normal;font-weight:700;src:url(Inter-Bold.woff2.a3efb88f6f.e8bd971d.woff2) format("woff2"),url(Inter-Bold.woff.a3efb88f6f.d92ed350.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:italic;font-weight:700;src:url(Inter-BoldItalic.woff2.a3efb88f6f.cd6e580e.woff2) format("woff2"),url(Inter-BoldItalic.woff.a3efb88f6f.39f68e5f.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:normal;font-weight:800;src:url(Inter-ExtraBold.woff2.a3efb88f6f.ffc04ff0.woff2) format("woff2"),url(Inter-ExtraBold.woff.a3efb88f6f.cd51bf91.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:italic;font-weight:800;src:url(Inter-ExtraBoldItalic.woff2.a3efb88f6f.de4f3979.woff2) format("woff2"),url(Inter-ExtraBoldItalic.woff.a3efb88f6f.122106d3.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:normal;font-weight:900;src:url(Inter-Black.woff2.a3efb88f6f.1f333c9f.woff2) format("woff2"),url(Inter-Black.woff.a3efb88f6f.efe3f25b.woff) format("woff")}@font-face{font-display:swap;font-family:Inter;font-style:italic;font-weight:900;src:url(Inter-BlackItalic.woff2.a3efb88f6f.89710fff.woff2) format("woff2"),url(Inter-BlackItalic.woff.a3efb88f6f.f6e2e726.woff) format("woff")}@font-face{font-named-instance:"Regular";font-display:swap;font-family:Inter var;font-style:normal;font-weight:100 900;src:url(Inter-roman.var.woff2.a3efb88f6f.8120837c.woff2) format("woff2 supports variations(gvar)"),url(Inter-roman.var.woff2.a3efb88f6f.8120837c.woff2) format("woff2-variations"),url(Inter-roman.var.woff2.a3efb88f6f.8120837c.woff2) format("woff2")}@font-face{font-named-instance:"Italic";font-display:swap;font-family:Inter var;font-style:italic;font-weight:100 900;src:url(Inter-italic.var.woff2.a3efb88f6f.e62a3bb2.woff2) format("woff2 supports variations(gvar)"),url(Inter-italic.var.woff2.a3efb88f6f.e62a3bb2.woff2) format("woff2-variations"),url(Inter-italic.var.woff2.a3efb88f6f.e62a3bb2.woff2) format("woff2")}@font-face{font-display:swap;font-family:Inter var experimental;font-style:oblique 0deg 10deg;font-weight:100 900;src:url(Inter.var.woff2.a3efb88f6f.ca82f9aa.woff2) format("woff2-variations"),url(Inter.var.woff2.a3efb88f6f.ca82f9aa.woff2) format("woff2")}:root{--pluto-cell-spacing:17px;--pluto-operator-ligatures:none;--julia-mono-font-stack:JuliaMono,Menlo,"Roboto Mono","Lucida Sans Typewriter","Source Code Pro",monospace;--sans-serif-font-stack:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;--lato-ui-font-stack:"Lato",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Cantarell,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol",system-ui,sans-serif;--inter-ui-font-stack:"Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Cantarell,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol",system-ui,sans-serif;color-scheme:light dark}html{font-family:var(--inter-ui-font-stack);font-size:17px}main{display:block;margin:0 auto;max-width:1200px;padding:1rem}header{background-color:#f5efd2;background-size:cover;display:flex;justify-content:center;padding:1.3rem}header h1{font-weight:500;text-align:center}section#mywork,section#open{background:var(--welcome-mywork-bg);position:relative}.pluto-logo{align-items:center;color:inherit;flex-direction:row;font-family:var(--inter-ui-font-stack);font-style:normal;font-weight:800;gap:.5ch;padding:.5em;transform:translateY(.23em)}.pluto-logo img{height:1.2em;width:1.2em}#new{background:var(--welcome-open-bg);border-radius:.6rem;box-shadow:-2px 4px 9px 0 #00000012;margin:1rem;padding:1.3rem}#new.desktop_opener{align-content:center;box-shadow:none;display:flex;flex-direction:row;justify-content:space-around;position:relative}#new.desktop_opener .desktop_picker{width:100%}section{display:flex;flex-direction:row;justify-content:center}section>div{flex:1 1 auto;margin:1rem;max-width:614px;min-width:0}.pluto-logo{background:#fff;border-radius:.4em;display:flex;flex:0 1 auto;font-size:1.6rem;transform:none}section#open{position:relative}section#featured>div{max-width:900px}header>div{display:flex;flex:1 1 auto;max-width:62rem;z-index:1}section#mywork:before,section#open:after{--c:rgba(53,72,80,0.06);background:linear-gradient(0deg,transparent,var(--c));content:"";display:block;height:50px;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:0}:where(#mywork,#open) h2{--off:4px;--offm:-4px;--oc:#fff;border-radius:.4em;display:inline-block;margin:2rem 0 0}section#open:after{background:linear-gradient(0deg,var(--c),transparent);bottom:0;top:unset}div#app{background-position:0 77%;background-size:cover}.new a{font-style:italic;font-weight:500;text-decoration:none}li.new{background:var(--welcome-newnotebook-bg);position:sticky;top:0;z-index:2}h1{font-size:2.8rem;margin-block-end:0}.collection{margin:6em 0}.collection h2{font-size:2.5rem;font-weight:600;margin:0}#featured p{max-width:54ch}#github img{aspect-ratio:1;filter:var(--image-filters);width:2rem}a#github{display:block;position:absolute;right:.5rem;top:.5rem}.show_scrollbar::-webkit-scrollbar{opacity:.1;width:10px}.show_scrollbar::-webkit-scrollbar-thumb{background-color:var(--black);border-radius:1000px;opacity:.6}.show_scrollbar::-webkit-scrollbar-thumb:hover{opacity:1} \ No newline at end of file diff --git a/frontend-dist/index.html b/frontend-dist/index.html new file mode 100644 index 000000000..acca383e5 --- /dev/null +++ b/frontend-dist/index.html @@ -0,0 +1 @@ +Pluto.jl

    welcome to

    My work

    Open a notebook

    Loading...

    \ No newline at end of file diff --git a/frontend-dist/information-circle-outline.008b2bb9.svg b/frontend-dist/information-circle-outline.008b2bb9.svg new file mode 100644 index 000000000..163c7e4d5 --- /dev/null +++ b/frontend-dist/information-circle-outline.008b2bb9.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/lato-all-400-italic.c29c8c6c.woff b/frontend-dist/lato-all-400-italic.c29c8c6c.woff new file mode 100644 index 000000000..613162455 Binary files /dev/null and b/frontend-dist/lato-all-400-italic.c29c8c6c.woff differ diff --git a/frontend-dist/lato-all-400-normal.a1a68bdf.woff b/frontend-dist/lato-all-400-normal.a1a68bdf.woff new file mode 100644 index 000000000..1f1fd49a1 Binary files /dev/null and b/frontend-dist/lato-all-400-normal.a1a68bdf.woff differ diff --git a/frontend-dist/lato-latin-400-italic.6edbc86c.woff2 b/frontend-dist/lato-latin-400-italic.6edbc86c.woff2 new file mode 100644 index 000000000..3246c1286 Binary files /dev/null and b/frontend-dist/lato-latin-400-italic.6edbc86c.woff2 differ diff --git a/frontend-dist/lato-latin-400-normal.77db3602.woff2 b/frontend-dist/lato-latin-400-normal.77db3602.woff2 new file mode 100644 index 000000000..6904b6649 Binary files /dev/null and b/frontend-dist/lato-latin-400-normal.77db3602.woff2 differ diff --git a/frontend-dist/lato-latin-ext-400-italic.336aaf51.woff2 b/frontend-dist/lato-latin-ext-400-italic.336aaf51.woff2 new file mode 100644 index 000000000..69af6c080 Binary files /dev/null and b/frontend-dist/lato-latin-ext-400-italic.336aaf51.woff2 differ diff --git a/frontend-dist/lato-latin-ext-400-normal.e1ce8ad3.woff2 b/frontend-dist/lato-latin-ext-400-normal.e1ce8ad3.woff2 new file mode 100644 index 000000000..0a0ee5eae Binary files /dev/null and b/frontend-dist/lato-latin-ext-400-normal.e1ce8ad3.woff2 differ diff --git a/frontend-dist/logo.004c1d7c.svg b/frontend-dist/logo.004c1d7c.svg new file mode 100644 index 000000000..cec701dc0 --- /dev/null +++ b/frontend-dist/logo.004c1d7c.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/mic-off-outline.251c22b7.svg b/frontend-dist/mic-off-outline.251c22b7.svg new file mode 100644 index 000000000..5ff2a050d --- /dev/null +++ b/frontend-dist/mic-off-outline.251c22b7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/mic-outline.e10eafe2.svg b/frontend-dist/mic-outline.e10eafe2.svg new file mode 100644 index 000000000..96d55c507 --- /dev/null +++ b/frontend-dist/mic-outline.e10eafe2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/newspaper-outline.e481c39c.svg b/frontend-dist/newspaper-outline.e481c39c.svg new file mode 100644 index 000000000..c142efa0f --- /dev/null +++ b/frontend-dist/newspaper-outline.e481c39c.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/notifications-outline.aa91b431.svg b/frontend-dist/notifications-outline.aa91b431.svg new file mode 100644 index 000000000..f284fa888 --- /dev/null +++ b/frontend-dist/notifications-outline.aa91b431.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/open-outline.87533923.svg b/frontend-dist/open-outline.87533923.svg new file mode 100644 index 000000000..71268bbac --- /dev/null +++ b/frontend-dist/open-outline.87533923.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/parcel-manifest.json b/frontend-dist/parcel-manifest.json new file mode 100644 index 000000000..3f59c724f --- /dev/null +++ b/frontend-dist/parcel-manifest.json @@ -0,0 +1 @@ +{"editor.html":"./editor.html","img/favicon-16x16.png":"./favicon-16x16.347d2855.png","img/favicon-32x32.png":"./favicon-32x32.8789add4.png","img/favicon-96x96.png":"./favicon-96x96.48689391.png","img/logo.svg":"./logo.004c1d7c.svg","img/favicon_unsaturated.svg":"./favicon_unsaturated.d1387b25.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js":"./editor.b8733d72.js",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@observablehq/stdlib@3.3.1/dist/stdlib.js":"./editor.9f9dc874.js",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/iframe-resizer@4.2.11/js/iframeResizer.min.js":"./editor.90ede145.js",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/ansi_up@5.1.0/ansi_up.min.js":"./editor.dbeed08a.js",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/iframe-resizer@4.2.11/js/iframeResizer.contentWindow.min.js":"./editor.6386bd9d.js","editor.css":"./editor.bc9e2665.css",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-cyrillic-ext-500-normal.woff2":"./roboto-mono-cyrillic-ext-500-normal.d362a132.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-all-500-normal.woff":"./roboto-mono-all-500-normal.cc559149.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-cyrillic-500-normal.woff2":"./roboto-mono-cyrillic-500-normal.8ed3add8.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-greek-500-normal.woff2":"./roboto-mono-greek-500-normal.dd57b097.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-vietnamese-500-normal.woff2":"./roboto-mono-vietnamese-500-normal.1320bb60.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-latin-ext-500-normal.woff2":"./roboto-mono-latin-ext-500-normal.415f7d14.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-latin-500-normal.woff2":"./roboto-mono-latin-500-normal.98ad1d4e.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-cyrillic-ext-700-normal.woff2":"./roboto-mono-cyrillic-ext-700-normal.5c7aabac.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-all-700-normal.woff":"./roboto-mono-all-700-normal.393c796d.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-cyrillic-700-normal.woff2":"./roboto-mono-cyrillic-700-normal.5e6410cf.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-greek-700-normal.woff2":"./roboto-mono-greek-700-normal.b101f80c.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-vietnamese-700-normal.woff2":"./roboto-mono-vietnamese-700-normal.edb1435b.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-latin-ext-700-normal.woff2":"./roboto-mono-latin-ext-700-normal.c497b002.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-latin-700-normal.woff2":"./roboto-mono-latin-700-normal.447ac127.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/lato@4.4.5/files/lato-latin-ext-400-normal.woff2":"./lato-latin-ext-400-normal.e1ce8ad3.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/lato@4.4.5/files/lato-all-400-normal.woff":"./lato-all-400-normal.a1a68bdf.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/lato@4.4.5/files/lato-latin-400-normal.woff2":"./lato-latin-400-normal.77db3602.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/lato@4.4.5/files/lato-latin-ext-400-italic.woff2":"./lato-latin-ext-400-italic.336aaf51.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/lato@4.4.5/files/lato-all-400-italic.woff":"./lato-all-400-italic.c29c8c6c.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/lato@4.4.5/files/lato-latin-400-italic.woff2":"./lato-latin-400-italic.6edbc86c.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/radio-button-on-outline.svg":"./radio-button-on-outline.778acac1.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/stop-circle-outline.svg":"./stop-circle-outline.6623356d.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/share-outline.svg":"./share-outline.50164ded.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/close-outline.svg":"./close-outline.9c22a232.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/newspaper-outline.svg":"./newspaper-outline.e481c39c.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/easel-outline.svg":"./easel-outline.9b064e1f.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/mic-outline.svg":"./mic-outline.e10eafe2.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/information-circle-outline.svg":"./information-circle-outline.008b2bb9.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/cloud-offline-outline.svg":"./cloud-offline-outline.ac2eade9.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/mic-off-outline.svg":"./mic-off-outline.251c22b7.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/arrow-undo-outline.svg":"./arrow-undo-outline.d8c99108.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/sync-circle-outline.svg":"./sync-circle-outline.65b15d76.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/checkmark-outline.svg":"./checkmark-outline.4fb8c646.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/eye-outline.svg":"./eye-outline.6e6e0f7c.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/eye-off-outline.svg":"./eye-off-outline.a37e03db.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/add-outline.svg":"./add-outline.e3c93c35.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/document-text-outline.svg":"./document-text-outline.8d1e2333.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/caret-forward-circle-outline.svg":"./caret-forward-circle-outline.d0bf2b34.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/ban-outline.svg":"./ban-outline.c97da9b4.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/close-circle-outline.svg":"./close-circle-outline.4baeedb9.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/document-lock-outline.svg":"./document-lock-outline.69d176a4.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/copy-outline.svg":"./copy-outline.0f561529.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/ellipsis-horizontal-circle-outline.svg":"./ellipsis-horizontal-circle-outline.6279ed30.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/time-outline.svg":"./time-outline.7c1877f0.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/sync-outline.svg":"./sync-outline.9a1bd27b.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/cloud-download-outline.svg":"./cloud-download-outline.8c1ff9bb.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/chatbox-ellipses-outline.svg":"./chatbox-ellipses-outline.4334a3a4.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/arrow-redo-circle-outline.svg":"./arrow-redo-circle-outline.dfa899f4.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/chevron-forward-circle-outline.svg":"./chevron-forward-circle-outline.babf2a99.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/search.svg":"./search.1ca5b3b3.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/terminal.svg":"./terminal.6b804248.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/pulse.svg":"./pulse.27a877a7.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/chevron-down-outline.svg":"./chevron-down-outline.1efaf1cc.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/open-outline.svg":"./open-outline.87533923.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/notifications-outline.svg":"./notifications-outline.aa91b431.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/warning-outline.svg":"./warning-outline.d84ed9e8.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/terminal-outline.svg":"./terminal-outline.79a23031.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/arrow-back-outline.svg":"./arrow-back-outline.9ae1bed8.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/arrow-forward-outline.svg":"./arrow-forward-outline.f5f68f5c.svg",".parcel-cache/.net/https/unpkg.com/ionicons@7.1.0/dist/svg/copy-outline.svg":"./copy-outline.6d5a7927.svg",".parcel-cache/.net/https/unpkg.com/ionicons@7.1.0/dist/svg/checkmark-outline.svg":"./checkmark-outline.538ded54.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-cyrillic-ext-400-normal.woff2":"./roboto-mono-cyrillic-ext-400-normal.dcb520ee.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-all-400-normal.woff":"./roboto-mono-all-400-normal.364ec368.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-cyrillic-400-normal.woff2":"./roboto-mono-cyrillic-400-normal.638e826e.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-greek-400-normal.woff2":"./roboto-mono-greek-400-normal.dd843e41.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-vietnamese-400-normal.woff2":"./roboto-mono-vietnamese-400-normal.306e7635.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-latin-ext-400-normal.woff2":"./roboto-mono-latin-ext-400-normal.d9409874.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-latin-400-normal.woff2":"./roboto-mono-latin-400-normal.cf1eee5f.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-cyrillic-ext-400-italic.woff2":"./roboto-mono-cyrillic-ext-400-italic.db052448.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-all-400-italic.woff":"./roboto-mono-all-400-italic.31a14f53.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-cyrillic-400-italic.woff2":"./roboto-mono-cyrillic-400-italic.e399ed93.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-greek-400-italic.woff2":"./roboto-mono-greek-400-italic.6f7e0b2f.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-vietnamese-400-italic.woff2":"./roboto-mono-vietnamese-400-italic.d8e0a32a.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-latin-ext-400-italic.woff2":"./roboto-mono-latin-ext-400-italic.aaa9a959.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/@fontsource/roboto-mono@4.4.5/files/roboto-mono-latin-400-italic.woff2":"./roboto-mono-latin-400-italic.ef82d48f.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/cormullion/juliamono@0.047/webfonts/JuliaMono-RegularLatin.woff2":"./JuliaMono-RegularLatin.26c56b70.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/cormullion/juliamono@0.047/webfonts/JuliaMono-BoldLatin.woff2":"./JuliaMono-BoldLatin.7ec5c608.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/cormullion/juliamono@0.047/webfonts/JuliaMono-Regular.woff2":"./JuliaMono-Regular.e0106c6f.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/cormullion/juliamono@0.047/webfonts/JuliaMono-Bold.woff2":"./JuliaMono-Bold.24b57d33.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/cormullion/juliamono@0.047/webfonts/JuliaMono-RegularItalic.woff2":"./JuliaMono-RegularItalic.3159f647.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/fonsp/Vollkorn-Typeface@1/fonts/woff2/Vollkorn-SemiBold.woff2":"./Vollkorn-SemiBold.8072eb6c.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/fonsp/Vollkorn-Typeface@1/fonts/woff2/Vollkorn-SemiBoldItalic.woff2":"./Vollkorn-SemiBoldItalic.5c3cd265.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/fonsp/Vollkorn-Typeface@1/fonts/woff2/Vollkorn-Bold.woff2":"./Vollkorn-Bold.6e1feb70.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/fonsp/Vollkorn-Typeface@1/fonts/woff2/Vollkorn-BoldItalic.woff2":"./Vollkorn-BoldItalic.a48ab300.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/fonsp/Vollkorn-Typeface@1/fonts/woff2/Vollkorn-Black.woff2":"./Vollkorn-Black.0ebdfbf5.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/fonsp/Vollkorn-Typeface@1/fonts/woff2/Vollkorn-BlackItalic.woff2":"./Vollkorn-BlackItalic.4095acfe.woff2","hide-ui.css":"./editor.25621fbe.css","binder.css":"./editor.d0a5b1f0.css",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/download-outline.svg":"./download-outline.523a74d8.svg","treeview.css":"./editor.e2e3dd3d.css",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/caret-down-outline.svg":"./caret-down-outline.4253a2fe.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/caret-forward-outline.svg":"./caret-forward-outline.348a84b6.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/ellipsis-vertical.svg":"./ellipsis-vertical.a30e7430.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/ellipsis-horizontal.svg":"./ellipsis-horizontal.c9a6cc29.svg","highlightjs.css":"./editor.09b09a3f.css","editor.js":"./editor.71c2f88d.js",".parcel-cache/.net/https/www.gstatic.com/firebasejs/10.8.0/firebase-app.js":"./firebase-app.15ba8989.js",".parcel-cache/.net/https/www.gstatic.com/firebasejs/10.8.0/firebase-firestore.js":"./firebase-firestore.f72d0b8a.js",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/arrow-up-circle-outline.svg":"./arrow-up-circle-outline.3f146ffe.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/help-circle-outline.svg":"./help-circle-outline.a023036a.svg",".parcel-cache/.net/https/unpkg.com/vmsg@0.4.0/vmsg.wasm":"./vmsg.56bb9389.wasm","warn_old_browsers.js":"./editor.8a3292da.js","index.html":"./index.html","welcome.css":"./index.dbc7264b.css",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Thin.woff2.a3efb88f6f.woff2":"./Inter-Thin.woff2.a3efb88f6f.099a7dc1.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Thin.woff.a3efb88f6f.woff":"./Inter-Thin.woff.a3efb88f6f.832f7e9d.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-ThinItalic.woff2.a3efb88f6f.woff2":"./Inter-ThinItalic.woff2.a3efb88f6f.f5b32cfe.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-ThinItalic.woff.a3efb88f6f.woff":"./Inter-ThinItalic.woff.a3efb88f6f.9a9e646f.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-ExtraLight.woff2.a3efb88f6f.woff2":"./Inter-ExtraLight.woff2.a3efb88f6f.735b820a.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-ExtraLight.woff.a3efb88f6f.woff":"./Inter-ExtraLight.woff.a3efb88f6f.018d6d24.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-ExtraLightItalic.woff2.a3efb88f6f.woff2":"./Inter-ExtraLightItalic.woff2.a3efb88f6f.75944d4e.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-ExtraLightItalic.woff.a3efb88f6f.woff":"./Inter-ExtraLightItalic.woff.a3efb88f6f.c051c5b4.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Light.woff2.a3efb88f6f.woff2":"./Inter-Light.woff2.a3efb88f6f.f86a8a97.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Light.woff.a3efb88f6f.woff":"./Inter-Light.woff.a3efb88f6f.0cf765a1.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-LightItalic.woff2.a3efb88f6f.woff2":"./Inter-LightItalic.woff2.a3efb88f6f.cb22faff.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-LightItalic.woff.a3efb88f6f.woff":"./Inter-LightItalic.woff.a3efb88f6f.6c91af65.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Regular.woff2.a3efb88f6f.woff2":"./Inter-Regular.woff2.a3efb88f6f.c52a047f.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Regular.woff.a3efb88f6f.woff":"./Inter-Regular.woff.a3efb88f6f.d9325c13.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Italic.woff2.a3efb88f6f.woff2":"./Inter-Italic.woff2.a3efb88f6f.85eee0c1.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Italic.woff.a3efb88f6f.woff":"./Inter-Italic.woff.a3efb88f6f.d9effa31.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Medium.woff2.a3efb88f6f.woff2":"./Inter-Medium.woff2.a3efb88f6f.4f0ea984.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Medium.woff.a3efb88f6f.woff":"./Inter-Medium.woff.a3efb88f6f.cb391d89.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-MediumItalic.woff2.a3efb88f6f.woff2":"./Inter-MediumItalic.woff2.a3efb88f6f.2b734b7a.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-MediumItalic.woff.a3efb88f6f.woff":"./Inter-MediumItalic.woff.a3efb88f6f.1f636c25.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-SemiBold.woff2.a3efb88f6f.woff2":"./Inter-SemiBold.woff2.a3efb88f6f.08366574.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-SemiBold.woff.a3efb88f6f.woff":"./Inter-SemiBold.woff.a3efb88f6f.c6670c13.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-SemiBoldItalic.woff2.a3efb88f6f.woff2":"./Inter-SemiBoldItalic.woff2.a3efb88f6f.5c7db07d.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-SemiBoldItalic.woff.a3efb88f6f.woff":"./Inter-SemiBoldItalic.woff.a3efb88f6f.13394743.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Bold.woff2.a3efb88f6f.woff2":"./Inter-Bold.woff2.a3efb88f6f.e8bd971d.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Bold.woff.a3efb88f6f.woff":"./Inter-Bold.woff.a3efb88f6f.d92ed350.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-BoldItalic.woff2.a3efb88f6f.woff2":"./Inter-BoldItalic.woff2.a3efb88f6f.cd6e580e.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-BoldItalic.woff.a3efb88f6f.woff":"./Inter-BoldItalic.woff.a3efb88f6f.39f68e5f.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-ExtraBold.woff2.a3efb88f6f.woff2":"./Inter-ExtraBold.woff2.a3efb88f6f.ffc04ff0.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-ExtraBold.woff.a3efb88f6f.woff":"./Inter-ExtraBold.woff.a3efb88f6f.cd51bf91.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-ExtraBoldItalic.woff2.a3efb88f6f.woff2":"./Inter-ExtraBoldItalic.woff2.a3efb88f6f.de4f3979.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-ExtraBoldItalic.woff.a3efb88f6f.woff":"./Inter-ExtraBoldItalic.woff.a3efb88f6f.122106d3.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Black.woff2.a3efb88f6f.woff2":"./Inter-Black.woff2.a3efb88f6f.1f333c9f.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-Black.woff.a3efb88f6f.woff":"./Inter-Black.woff.a3efb88f6f.efe3f25b.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-BlackItalic.woff2.a3efb88f6f.woff2":"./Inter-BlackItalic.woff2.a3efb88f6f.89710fff.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-BlackItalic.woff.a3efb88f6f.woff":"./Inter-BlackItalic.woff.a3efb88f6f.f6e2e726.woff",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-roman.var.woff2.a3efb88f6f.woff2":"./Inter-roman.var.woff2.a3efb88f6f.8120837c.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter-italic.var.woff2.a3efb88f6f.woff2":"./Inter-italic.var.woff2.a3efb88f6f.e62a3bb2.woff2",".parcel-cache/.net/https/cdn.jsdelivr.net/npm/inter-ui@3.19.3/Inter%20(web%20latin)/Inter.var.woff2.a3efb88f6f.woff2":"./Inter.var.woff2.a3efb88f6f.ca82f9aa.woff2","index.css":"./index.ba6bd48a.css",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/close-circle.svg":"./close-circle.d0f6eac6.svg",".parcel-cache/.net/https/cdn.jsdelivr.net/gh/ionic-team/ionicons@5.5.1/src/svg/ellipsis-horizontal-outline.svg":"./ellipsis-horizontal-outline.abb6e818.svg","index.js":"./index.4fff403b.js","error.jl.html":"./error.jl.html"} \ No newline at end of file diff --git a/frontend-dist/pulse.27a877a7.svg b/frontend-dist/pulse.27a877a7.svg new file mode 100644 index 000000000..3251eb43e --- /dev/null +++ b/frontend-dist/pulse.27a877a7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/radio-button-on-outline.778acac1.svg b/frontend-dist/radio-button-on-outline.778acac1.svg new file mode 100644 index 000000000..061b53468 --- /dev/null +++ b/frontend-dist/radio-button-on-outline.778acac1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/roboto-mono-all-400-italic.31a14f53.woff b/frontend-dist/roboto-mono-all-400-italic.31a14f53.woff new file mode 100644 index 000000000..723ffe83f Binary files /dev/null and b/frontend-dist/roboto-mono-all-400-italic.31a14f53.woff differ diff --git a/frontend-dist/roboto-mono-all-400-normal.364ec368.woff b/frontend-dist/roboto-mono-all-400-normal.364ec368.woff new file mode 100644 index 000000000..379f9ae19 Binary files /dev/null and b/frontend-dist/roboto-mono-all-400-normal.364ec368.woff differ diff --git a/frontend-dist/roboto-mono-all-500-normal.cc559149.woff b/frontend-dist/roboto-mono-all-500-normal.cc559149.woff new file mode 100644 index 000000000..6fc0cbe59 Binary files /dev/null and b/frontend-dist/roboto-mono-all-500-normal.cc559149.woff differ diff --git a/frontend-dist/roboto-mono-all-700-normal.393c796d.woff b/frontend-dist/roboto-mono-all-700-normal.393c796d.woff new file mode 100644 index 000000000..bd2a43d0a Binary files /dev/null and b/frontend-dist/roboto-mono-all-700-normal.393c796d.woff differ diff --git a/frontend-dist/roboto-mono-cyrillic-400-italic.e399ed93.woff2 b/frontend-dist/roboto-mono-cyrillic-400-italic.e399ed93.woff2 new file mode 100644 index 000000000..8695ed91d Binary files /dev/null and b/frontend-dist/roboto-mono-cyrillic-400-italic.e399ed93.woff2 differ diff --git a/frontend-dist/roboto-mono-cyrillic-400-normal.638e826e.woff2 b/frontend-dist/roboto-mono-cyrillic-400-normal.638e826e.woff2 new file mode 100644 index 000000000..68b8a8dc8 Binary files /dev/null and b/frontend-dist/roboto-mono-cyrillic-400-normal.638e826e.woff2 differ diff --git a/frontend-dist/roboto-mono-cyrillic-500-normal.8ed3add8.woff2 b/frontend-dist/roboto-mono-cyrillic-500-normal.8ed3add8.woff2 new file mode 100644 index 000000000..c307876e0 Binary files /dev/null and b/frontend-dist/roboto-mono-cyrillic-500-normal.8ed3add8.woff2 differ diff --git a/frontend-dist/roboto-mono-cyrillic-700-normal.5e6410cf.woff2 b/frontend-dist/roboto-mono-cyrillic-700-normal.5e6410cf.woff2 new file mode 100644 index 000000000..1967932df Binary files /dev/null and b/frontend-dist/roboto-mono-cyrillic-700-normal.5e6410cf.woff2 differ diff --git a/frontend-dist/roboto-mono-cyrillic-ext-400-italic.db052448.woff2 b/frontend-dist/roboto-mono-cyrillic-ext-400-italic.db052448.woff2 new file mode 100644 index 000000000..85a9f5b37 Binary files /dev/null and b/frontend-dist/roboto-mono-cyrillic-ext-400-italic.db052448.woff2 differ diff --git a/frontend-dist/roboto-mono-cyrillic-ext-400-normal.dcb520ee.woff2 b/frontend-dist/roboto-mono-cyrillic-ext-400-normal.dcb520ee.woff2 new file mode 100644 index 000000000..1630ec9c5 Binary files /dev/null and b/frontend-dist/roboto-mono-cyrillic-ext-400-normal.dcb520ee.woff2 differ diff --git a/frontend-dist/roboto-mono-cyrillic-ext-500-normal.d362a132.woff2 b/frontend-dist/roboto-mono-cyrillic-ext-500-normal.d362a132.woff2 new file mode 100644 index 000000000..b34eed974 Binary files /dev/null and b/frontend-dist/roboto-mono-cyrillic-ext-500-normal.d362a132.woff2 differ diff --git a/frontend-dist/roboto-mono-cyrillic-ext-700-normal.5c7aabac.woff2 b/frontend-dist/roboto-mono-cyrillic-ext-700-normal.5c7aabac.woff2 new file mode 100644 index 000000000..a89f2e841 Binary files /dev/null and b/frontend-dist/roboto-mono-cyrillic-ext-700-normal.5c7aabac.woff2 differ diff --git a/frontend-dist/roboto-mono-greek-400-italic.6f7e0b2f.woff2 b/frontend-dist/roboto-mono-greek-400-italic.6f7e0b2f.woff2 new file mode 100644 index 000000000..7bab226ca Binary files /dev/null and b/frontend-dist/roboto-mono-greek-400-italic.6f7e0b2f.woff2 differ diff --git a/frontend-dist/roboto-mono-greek-400-normal.dd843e41.woff2 b/frontend-dist/roboto-mono-greek-400-normal.dd843e41.woff2 new file mode 100644 index 000000000..466f9ec13 Binary files /dev/null and b/frontend-dist/roboto-mono-greek-400-normal.dd843e41.woff2 differ diff --git a/frontend-dist/roboto-mono-greek-500-normal.dd57b097.woff2 b/frontend-dist/roboto-mono-greek-500-normal.dd57b097.woff2 new file mode 100644 index 000000000..72f600238 Binary files /dev/null and b/frontend-dist/roboto-mono-greek-500-normal.dd57b097.woff2 differ diff --git a/frontend-dist/roboto-mono-greek-700-normal.b101f80c.woff2 b/frontend-dist/roboto-mono-greek-700-normal.b101f80c.woff2 new file mode 100644 index 000000000..9ab1293a8 Binary files /dev/null and b/frontend-dist/roboto-mono-greek-700-normal.b101f80c.woff2 differ diff --git a/frontend-dist/roboto-mono-latin-400-italic.ef82d48f.woff2 b/frontend-dist/roboto-mono-latin-400-italic.ef82d48f.woff2 new file mode 100644 index 000000000..721ca2e93 Binary files /dev/null and b/frontend-dist/roboto-mono-latin-400-italic.ef82d48f.woff2 differ diff --git a/frontend-dist/roboto-mono-latin-400-normal.cf1eee5f.woff2 b/frontend-dist/roboto-mono-latin-400-normal.cf1eee5f.woff2 new file mode 100644 index 000000000..ed384d22f Binary files /dev/null and b/frontend-dist/roboto-mono-latin-400-normal.cf1eee5f.woff2 differ diff --git a/frontend-dist/roboto-mono-latin-500-normal.98ad1d4e.woff2 b/frontend-dist/roboto-mono-latin-500-normal.98ad1d4e.woff2 new file mode 100644 index 000000000..01b58ed2c Binary files /dev/null and b/frontend-dist/roboto-mono-latin-500-normal.98ad1d4e.woff2 differ diff --git a/frontend-dist/roboto-mono-latin-700-normal.447ac127.woff2 b/frontend-dist/roboto-mono-latin-700-normal.447ac127.woff2 new file mode 100644 index 000000000..c89a6eb38 Binary files /dev/null and b/frontend-dist/roboto-mono-latin-700-normal.447ac127.woff2 differ diff --git a/frontend-dist/roboto-mono-latin-ext-400-italic.aaa9a959.woff2 b/frontend-dist/roboto-mono-latin-ext-400-italic.aaa9a959.woff2 new file mode 100644 index 000000000..9831c28b9 Binary files /dev/null and b/frontend-dist/roboto-mono-latin-ext-400-italic.aaa9a959.woff2 differ diff --git a/frontend-dist/roboto-mono-latin-ext-400-normal.d9409874.woff2 b/frontend-dist/roboto-mono-latin-ext-400-normal.d9409874.woff2 new file mode 100644 index 000000000..d4f9a09cc Binary files /dev/null and b/frontend-dist/roboto-mono-latin-ext-400-normal.d9409874.woff2 differ diff --git a/frontend-dist/roboto-mono-latin-ext-500-normal.415f7d14.woff2 b/frontend-dist/roboto-mono-latin-ext-500-normal.415f7d14.woff2 new file mode 100644 index 000000000..77a97cf73 Binary files /dev/null and b/frontend-dist/roboto-mono-latin-ext-500-normal.415f7d14.woff2 differ diff --git a/frontend-dist/roboto-mono-latin-ext-700-normal.c497b002.woff2 b/frontend-dist/roboto-mono-latin-ext-700-normal.c497b002.woff2 new file mode 100644 index 000000000..9b733dd3c Binary files /dev/null and b/frontend-dist/roboto-mono-latin-ext-700-normal.c497b002.woff2 differ diff --git a/frontend-dist/roboto-mono-vietnamese-400-italic.d8e0a32a.woff2 b/frontend-dist/roboto-mono-vietnamese-400-italic.d8e0a32a.woff2 new file mode 100644 index 000000000..2ec55df09 Binary files /dev/null and b/frontend-dist/roboto-mono-vietnamese-400-italic.d8e0a32a.woff2 differ diff --git a/frontend-dist/roboto-mono-vietnamese-400-normal.306e7635.woff2 b/frontend-dist/roboto-mono-vietnamese-400-normal.306e7635.woff2 new file mode 100644 index 000000000..2cf6dfc42 Binary files /dev/null and b/frontend-dist/roboto-mono-vietnamese-400-normal.306e7635.woff2 differ diff --git a/frontend-dist/roboto-mono-vietnamese-500-normal.1320bb60.woff2 b/frontend-dist/roboto-mono-vietnamese-500-normal.1320bb60.woff2 new file mode 100644 index 000000000..3ab766e25 Binary files /dev/null and b/frontend-dist/roboto-mono-vietnamese-500-normal.1320bb60.woff2 differ diff --git a/frontend-dist/roboto-mono-vietnamese-700-normal.edb1435b.woff2 b/frontend-dist/roboto-mono-vietnamese-700-normal.edb1435b.woff2 new file mode 100644 index 000000000..12357bd52 Binary files /dev/null and b/frontend-dist/roboto-mono-vietnamese-700-normal.edb1435b.woff2 differ diff --git a/frontend-dist/search.1ca5b3b3.svg b/frontend-dist/search.1ca5b3b3.svg new file mode 100644 index 000000000..c6b864ae9 --- /dev/null +++ b/frontend-dist/search.1ca5b3b3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/share-outline.50164ded.svg b/frontend-dist/share-outline.50164ded.svg new file mode 100644 index 000000000..601cb684a --- /dev/null +++ b/frontend-dist/share-outline.50164ded.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/stop-circle-outline.6623356d.svg b/frontend-dist/stop-circle-outline.6623356d.svg new file mode 100644 index 000000000..30addb7f9 --- /dev/null +++ b/frontend-dist/stop-circle-outline.6623356d.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/sync-circle-outline.65b15d76.svg b/frontend-dist/sync-circle-outline.65b15d76.svg new file mode 100644 index 000000000..3b41a36e9 --- /dev/null +++ b/frontend-dist/sync-circle-outline.65b15d76.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/sync-outline.9a1bd27b.svg b/frontend-dist/sync-outline.9a1bd27b.svg new file mode 100644 index 000000000..9f69e76f3 --- /dev/null +++ b/frontend-dist/sync-outline.9a1bd27b.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/terminal-outline.79a23031.svg b/frontend-dist/terminal-outline.79a23031.svg new file mode 100644 index 000000000..99c52751a --- /dev/null +++ b/frontend-dist/terminal-outline.79a23031.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/terminal.6b804248.svg b/frontend-dist/terminal.6b804248.svg new file mode 100644 index 000000000..030b7bb4e --- /dev/null +++ b/frontend-dist/terminal.6b804248.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/time-outline.7c1877f0.svg b/frontend-dist/time-outline.7c1877f0.svg new file mode 100644 index 000000000..b4d137133 --- /dev/null +++ b/frontend-dist/time-outline.7c1877f0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend-dist/vmsg.56bb9389.wasm b/frontend-dist/vmsg.56bb9389.wasm new file mode 100644 index 000000000..224bcc7fd Binary files /dev/null and b/frontend-dist/vmsg.56bb9389.wasm differ diff --git a/frontend-dist/warning-outline.d84ed9e8.svg b/frontend-dist/warning-outline.d84ed9e8.svg new file mode 100644 index 000000000..df490bfa1 --- /dev/null +++ b/frontend-dist/warning-outline.d84ed9e8.svg @@ -0,0 +1 @@ + \ No newline at end of file